/*
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 { markType } from "igniteui-angular-core";
import { ExcelCalcErrorValue } from "./ExcelCalcErrorValue";
import { CalcManagerUtilities } from "./CalcManagerUtilities";
/**
 * @hidden
 */
export let UltraCalcFunctionDateDiff = /*@__PURE__*/ (() => {
    class UltraCalcFunctionDateDiff extends BuiltInFunctionBase {
        evaluate(a, b) {
            let c = a.pop();
            let d = a.pop();
            let e = a.pop().toString().toLowerCase().trim();
            if (c.isNull || d.isNull) {
                let f = new ExcelCalcErrorValue(4);
                return new ExcelCalcValue(f);
            }
            let g = c._toDateTime1();
            let h = d._toDateTime1();
            let i = UltraCalcFunctionDateDiff._an(a._w, e, h, g);
            return new ExcelCalcValue(i);
        }
        static _al(a) {
            if (a >= 0) {
                return Math.floor(a);
            }
            return -Math.floor(-a);
        }
        get_name() {
            return "datediff";
        }
        get name() {
            return this.get_name();
        }
        get_minArgs() {
            return 3;
        }
        get minArgs() {
            return this.get_minArgs();
        }
        get_maxArgs() {
            return 3;
        }
        get maxArgs() {
            return this.get_maxArgs();
        }
        static _ak(a) {
            switch (a) {
                case 2: return 2;
                case 1: return 3;
                case 0:
                default: return 1;
            }
        }
        static _an(a, b, c, d) {
            let e = 1;
            let f = UltraCalcFunctionDateDiff._ak(0);
            let g = CalcManagerUtilities.e(b, c, d, e, f);
            return g;
        }
        static _am(a, b, c, d) {
            let e = 1;
            let f = UltraCalcFunctionDateDiff._ak(0);
            let g = CalcManagerUtilities.d(b, c, d, e, f);
            return g;
        }
    }
    UltraCalcFunctionDateDiff.$t = markType(UltraCalcFunctionDateDiff, 'UltraCalcFunctionDateDiff', BuiltInFunctionBase.$);
    return UltraCalcFunctionDateDiff;
})();
