/*
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, __values } from "tslib";
import { FinancialIndicator } from "./FinancialIndicator";
import { String_$type, Number_$type, typeCast, fromEnum, markType } from "igniteui-angular-core";
import { DependencyProperty } from "igniteui-angular-core";
import { PropertyMetadata } from "igniteui-angular-core";
import { List$1 } from "igniteui-angular-core";
import { AxisRange } from "./AxisRange";
import { isNaN_ } from "igniteui-angular-core";
/**
 * @hidden
 */
var StrategyBasedIndicator = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(StrategyBasedIndicator, _super);
    function StrategyBasedIndicator() {
        var _this = _super.call(this) || this;
        _this.acj();
        return _this;
    }
    StrategyBasedIndicator.prototype.acj = function () {
        this.ab4 = this.ab5;
        this.ab = this.aci;
    };
    StrategyBasedIndicator.prototype.acb = function () {
        return -2147483648;
    };
    StrategyBasedIndicator.prototype.ack = function (a) {
    };
    StrategyBasedIndicator.prototype.acd = function () {
        return -2147483648;
    };
    StrategyBasedIndicator.prototype.aca = function () {
        return -2147483648;
    };
    StrategyBasedIndicator.aco = function (a, b, c) {
        var d = DependencyProperty.i(c, Number_$type, b, new PropertyMetadata(2, a, function (e, f) { return (typeCast(StrategyBasedIndicator.$, e)).raisePropertyChanged(c, f.oldValue, f.newValue); }));
        StrategyBasedIndicator.ab8.add(c);
        return d;
    };
    StrategyBasedIndicator.acn = function (a, b) {
        return StrategyBasedIndicator.aco(a, b, "Period");
    };
    StrategyBasedIndicator.acl = function (a, b) {
        return StrategyBasedIndicator.aco(a, b, "LongPeriod");
    };
    StrategyBasedIndicator.acp = function (a, b) {
        return StrategyBasedIndicator.aco(a, b, "ShortPeriod");
    };
    StrategyBasedIndicator.prototype.abh = function (a, b) {
        var c = this.xt(a, b);
        var d = this.xu(c);
        return this.ab4.b(c, d);
    };
    StrategyBasedIndicator.prototype.abe = function (a, b) {
        var c = this.xt(a, b);
        if (b == 0) {
            return false;
        }
        if (!this.yp(this.abh(a, b))) {
            return false;
        }
        var d = this.xu(c);
        if (this.aba != null) {
            c.minimumValue = this.aba.c;
            c.maximumValue = this.aba.b;
        }
        var e = this.ab4.a(c, d);
        for (var f = 0; f < this.abj && f < c.indicatorColumn.count; f++) {
            c.indicatorColumn.item(f, NaN);
        }
        if (this.xz != null && this.ab7(c)) {
            this.xz.d2();
        }
        return e;
    };
    StrategyBasedIndicator.prototype.ab7 = function (a) {
        var e_1, _a;
        if (!isNaN_(a.minimumValue) && !isNaN_(a.maximumValue) && a.specifiesRange) {
            var b = this.aba;
            this.aba = new AxisRange(a.minimumValue, a.maximumValue);
            return this.ab6(b, this.aba);
        }
        var c = 1.7976931348623157E+308;
        var d = -1.7976931348623157E+308;
        try {
            for (var _b = __values(fromEnum(a.indicatorColumn)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var e = _c.value;
                if (!isNaN_(e)) {
                    c = Math.min(c, e);
                    d = Math.max(d, e);
                }
            }
        }
        catch (e_1_1) {
            e_1 = { error: e_1_1 };
        }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return))
                    _a.call(_b);
            }
            finally {
                if (e_1)
                    throw e_1.error;
            }
        }
        var f = this.aba;
        this.aba = new AxisRange(c, d);
        return this.ab6(f, this.aba);
    };
    StrategyBasedIndicator.prototype.ab6 = function (a, b) {
        if (a == null || b == null) {
            return true;
        }
        if (a.c != b.c) {
            return true;
        }
        if (a.b != b.b) {
            return true;
        }
        return false;
    };
    StrategyBasedIndicator.prototype.acc = function (a) {
        if (a == -2147483648) {
            return 0;
        }
        if (a > this.indicatorColumn.count && this.indicatorColumn.count > 0) {
            a = this.indicatorColumn.count - 1;
        }
        if (a < 1) {
            return 1;
        }
        return a;
    };
    StrategyBasedIndicator.prototype.xt = function (a, b) {
        var c = _super.prototype.xt.call(this, a, b);
        c.indicatorColumn = this.indicatorColumn;
        c.period = this.acc(this.acb());
        c.shortPeriod = this.acc(this.acd());
        c.longPeriod = this.acc(this.aca());
        c.multiplier = this.ab9();
        return c;
    };
    StrategyBasedIndicator.prototype.ab9 = function () {
        return 1;
    };
    StrategyBasedIndicator.acm = function (a, b) {
        var c = DependencyProperty.i("Multiplier", Number_$type, b, new PropertyMetadata(2, a, function (d, e) { return (typeCast(StrategyBasedIndicator.$, d)).raisePropertyChanged("Multiplier", e.oldValue, e.newValue); }));
        StrategyBasedIndicator.ab8.add("Multiplier");
        return c;
    };
    StrategyBasedIndicator.prototype.rg = function (a, b, c, d) {
        _super.prototype.rg.call(this, a, b, c, d);
        if (StrategyBasedIndicator.ab8.contains(b)) {
            if (this.xz != null && !this.xz.d2()) {
                this.xx.cd.e(this.ie);
                this.abe(0, this.indicatorColumn.count);
                if (this.abb.cn) {
                    this.abb.cl.g$m();
                }
                this.ry(false);
            }
        }
    };
    StrategyBasedIndicator.$t = markType(StrategyBasedIndicator, 'StrategyBasedIndicator', FinancialIndicator.$);
    StrategyBasedIndicator.ab8 = new List$1(String_$type, 0);
    return StrategyBasedIndicator;
}(FinancialIndicator));
export { StrategyBasedIndicator };
