/*
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 { UltraCalcFunctionTwoMatrixFunction } from "./UltraCalcFunctionTwoMatrixFunction";
import { ExcelCalcValue } from "./ExcelCalcValue";
import { ExcelCalcErrorValue } from "./ExcelCalcErrorValue";
import { markType } from "igniteui-angular-core";
/**
 * @hidden
 */
var UltraCalcFunctionSteyx = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(UltraCalcFunctionSteyx, _super);
    function UltraCalcFunctionSteyx() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    UltraCalcFunctionSteyx.prototype.evaluate = function (a, b) {
        var c;
        var d;
        var e;
        var f = UltraCalcFunctionTwoMatrixFunction._ao(a, c, d, e);
        c = f.p1;
        d = f.p2;
        e = f.p3;
        if (c != null) {
            return new ExcelCalcValue(c);
        }
        var g;
        var h;
        var i;
        var j = UltraCalcFunctionTwoMatrixFunction._ar(d, e, g, h, i);
        g = j.p2;
        h = j.p3;
        i = j.p4;
        if (g < 3) {
            return new ExcelCalcValue(new ExcelCalcErrorValue(2));
        }
        var k = h / g;
        var l = i / g;
        var m = UltraCalcFunctionTwoMatrixFunction._am(d, e, function (n, o) { return (n - k) * (o - l); });
        var n = UltraCalcFunctionTwoMatrixFunction._an(d, function (o) { return Math.pow((o - k), 2); });
        var o = UltraCalcFunctionTwoMatrixFunction._an(e, function (p) { return Math.pow((p - l), 2); });
        if (o == 0) {
            return new ExcelCalcValue(new ExcelCalcErrorValue(2));
        }
        var p = 1 / (g - 2);
        var q = n - ((m * m) / o);
        var r = Math.sqrt(p * q);
        return new ExcelCalcValue(r);
    };
    UltraCalcFunctionSteyx.prototype.get_name = function () {
        return "steyx";
    };
    Object.defineProperty(UltraCalcFunctionSteyx.prototype, "name", {
        get: function () {
            return this.get_name();
        },
        enumerable: false,
        configurable: true
    });
    UltraCalcFunctionSteyx.$t = markType(UltraCalcFunctionSteyx, 'UltraCalcFunctionSteyx', UltraCalcFunctionTwoMatrixFunction.$);
    return UltraCalcFunctionSteyx;
}(UltraCalcFunctionTwoMatrixFunction));
export { UltraCalcFunctionSteyx };
