/*
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 { BuiltInFunctionBase } from "./BuiltInFunctionBase";
import { ExcelCalcValue } from "./ExcelCalcValue";
import { MathUtilities } from "./MathUtilities";
import { ExcelCalcErrorValue } from "./ExcelCalcErrorValue";
import { markType } from "igniteui-angular-core";
import { stringEndsWith, stringStartsWith } from "igniteui-angular-core";
import { trim } from "igniteui-angular-core";
/**
 * @hidden
 */
export class UltraCalcFunctionValue extends BuiltInFunctionBase {
    evaluate(a, b) {
        let c = a.pop();
        if (c.isError) {
            return new ExcelCalcValue(c.toErrorValue());
        }
        let d = false;
        let e = 0;
        if (typeof c.value === 'string') {
            let f = (c.value).trim();
            if (stringEndsWith(f, "kr")) {
                f = f.substr(0, f.length - 2);
            }
            else if (stringStartsWith(f, "R$") || stringStartsWith(f, "S/")) {
                f = f.substr(2, f.length - 2);
            }
            else {
                f = trim(f, ...UltraCalcFunctionValue._ak);
            }
            d = ((() => { let g = MathUtilities.c(f, a._w, e); e = g.p2; return g.ret; })());
        }
        if (!d) {
            d = ((() => { let g = c._toDouble1(e); e = g.p0; return g.ret; })());
        }
        return (d) ? new ExcelCalcValue(e) : new ExcelCalcValue(new ExcelCalcErrorValue(4));
    }
    get_name() {
        return "value";
    }
    get name() {
        return this.get_name();
    }
    get_minArgs() {
        return 1;
    }
    get minArgs() {
        return this.get_minArgs();
    }
    get_maxArgs() {
        return 1;
    }
    get maxArgs() {
        return this.get_maxArgs();
    }
    doesParameterAllowIntermediateResultArray(a, b) {
        return true;
    }
}
UltraCalcFunctionValue.$t = markType(UltraCalcFunctionValue, 'UltraCalcFunctionValue', BuiltInFunctionBase.$);
UltraCalcFunctionValue._ak = ['$', '\u0080', '£', '¤', '¥', '৲', '৳', '฿', '៛', '₠', '₡', '₢', '₣', '₤', '₦', '₧', '₨', '₩', '₪', '₫', '€', '₭', '₮', '₯', '﷼', '﹩', '＄', '￡', '￥', '￦'];
//# sourceMappingURL=UltraCalcFunctionValue.js.map