/*
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE  AGREEMENT ("AGREEMENT") LOCATED HERE:
https://www.infragistics.com/legal/license/igultimate-la
https://www.infragistics.com/legal/license/igultimate-eula
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE:  you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
*/
import { __extends } from "tslib";
import { BuiltInFunctionBase } from "./BuiltInFunctionBase";
import { ExcelCalcValue } from "./ExcelCalcValue";
import { markType } from "igniteui-angular-core";
import { StringBuilder } from "igniteui-angular-core";
import { StringUtilities } from "./StringUtilities";
import { isLetter } from "igniteui-angular-core";
/**
 * @hidden
 */
var UltraCalcFunctionProper = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(UltraCalcFunctionProper, _super);
    function UltraCalcFunctionProper() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    UltraCalcFunctionProper.prototype.evaluate = function (a, b) {
        var c = a.pop();
        if (c.isError) {
            return new ExcelCalcValue(c.toErrorValue());
        }
        var d;
        if (c.isNull) {
            d = null;
        }
        else {
            var e = c.toString();
            var f = new StringBuilder(0);
            var g = false;
            var h = a._w;
            for (var i = 0; i < e.length; i++) {
                var j = e.charAt(i);
                if (isLetter(j)) {
                    if (g) {
                        f.h(StringUtilities.b(j, h));
                    }
                    else {
                        g = true;
                        f.h(StringUtilities.c(j, h));
                    }
                }
                else {
                    g = false;
                    f.h(j);
                }
            }
            d = f.toString();
        }
        return new ExcelCalcValue(d);
    };
    UltraCalcFunctionProper.prototype.get_name = function () {
        return "proper";
    };
    Object.defineProperty(UltraCalcFunctionProper.prototype, "name", {
        get: function () {
            return this.get_name();
        },
        enumerable: false,
        configurable: true
    });
    UltraCalcFunctionProper.prototype.get_minArgs = function () {
        return 1;
    };
    Object.defineProperty(UltraCalcFunctionProper.prototype, "minArgs", {
        get: function () {
            return this.get_minArgs();
        },
        enumerable: false,
        configurable: true
    });
    UltraCalcFunctionProper.prototype.get_maxArgs = function () {
        return 1;
    };
    Object.defineProperty(UltraCalcFunctionProper.prototype, "maxArgs", {
        get: function () {
            return this.get_maxArgs();
        },
        enumerable: false,
        configurable: true
    });
    UltraCalcFunctionProper.$t = markType(UltraCalcFunctionProper, 'UltraCalcFunctionProper', BuiltInFunctionBase.$);
    return UltraCalcFunctionProper;
}(BuiltInFunctionBase));
export { UltraCalcFunctionProper };
