/*
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 { UltraCalcFunctionComplex_ComplexNumber } from "./UltraCalcFunctionComplex_ComplexNumber";
import { markType } from "igniteui-angular-core";
import { ExcelCalcErrorValue } from "./ExcelCalcErrorValue";
/**
 * @hidden
 */
export class UltraCalcFunctionImSum extends BuiltInFunctionBase {
    evaluate(a, b) {
        let c = this._getArguments(a, b, true);
        c.reverse();
        let d = null;
        let e = null;
        for (let g = 0; g < c.length; g++) {
            let f = c[g];
            if (f.isError) {
                return new ExcelCalcValue(f.toErrorValue());
            }
            let h = new UltraCalcFunctionComplex_ComplexNumber(1, a._w, f.toString());
            if (h.y == false) {
                return new ExcelCalcValue(new ExcelCalcErrorValue(4));
            }
            if (e == null) {
                e = h.an;
            }
            else if (h.an != e) {
                return new ExcelCalcValue(new ExcelCalcErrorValue(4));
            }
            if (d == null) {
                d = h;
            }
            else {
                d = UltraCalcFunctionComplex_ComplexNumber.h(d, h);
            }
        }
        if (d.y == false) {
            return new ExcelCalcValue(new ExcelCalcErrorValue(4));
        }
        return new ExcelCalcValue(d.toString());
    }
    canParameterBeEnumerable(a) {
        return true;
    }
    get_name() {
        return "imsum";
    }
    get name() {
        return this.get_name();
    }
    get_minArgs() {
        return 1;
    }
    get minArgs() {
        return this.get_minArgs();
    }
    get_maxArgs() {
        return 0x7FFFFFFF;
    }
    get maxArgs() {
        return this.get_maxArgs();
    }
}
UltraCalcFunctionImSum.$t = markType(UltraCalcFunctionImSum, 'UltraCalcFunctionImSum', BuiltInFunctionBase.$);
//# sourceMappingURL=UltraCalcFunctionImSum.js.map