/*
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 * as tslib_1 from "tslib";
import { FinancialIndicator } from "./FinancialIndicator";
import { String_$type, Number_$type, typeCast, fromEnum, markType } from "igniteui-react-core";
import { DependencyProperty } from "igniteui-react-core";
import { PropertyMetadata } from "igniteui-react-core";
import { List$1 } from "igniteui-react-core";
import { AxisRange } from "./AxisRange";
import { isNaN_ } from "igniteui-react-core";
/**
 * @hidden
 */
var StrategyBasedIndicator = /** @class */ /*@__PURE__*/ (function (_super) {
    tslib_1.__extends(StrategyBasedIndicator, _super);
    function StrategyBasedIndicator() {
        var _this = _super.call(this) || this;
        _this.sy();
        return _this;
    }
    StrategyBasedIndicator.prototype.sy = function () {
        this.sj = this.sk;
        this.ab = this.sx;
    };
    StrategyBasedIndicator.prototype.sq = function () {
        return -2147483648;
    };
    StrategyBasedIndicator.prototype.sz = function (a) {
    };
    StrategyBasedIndicator.prototype.ss = function () {
        return -2147483648;
    };
    StrategyBasedIndicator.prototype.sp = function () {
        return -2147483648;
    };
    StrategyBasedIndicator.s3 = 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.sn.add(c);
        return d;
    };
    StrategyBasedIndicator.s2 = function (a, b) {
        return StrategyBasedIndicator.s3(a, b, "Period");
    };
    StrategyBasedIndicator.s0 = function (a, b) {
        return StrategyBasedIndicator.s3(a, b, "LongPeriod");
    };
    StrategyBasedIndicator.s4 = function (a, b) {
        return StrategyBasedIndicator.s3(a, b, "ShortPeriod");
    };
    StrategyBasedIndicator.prototype.rw = function (a, b) {
        var c = this.ot(a, b);
        var d = this.ou(c);
        return this.sj.b(c, d);
    };
    StrategyBasedIndicator.prototype.rt = function (a, b) {
        var c = this.ot(a, b);
        if (b == 0) {
            return false;
        }
        if (!this.pp(this.rw(a, b))) {
            return false;
        }
        var d = this.ou(c);
        if (this.rq != null) {
            c.minimumValue = this.rq.c;
            c.maximumValue = this.rq.b;
        }
        var e = this.sj.a(c, d);
        for (var f = 0; f < this.ry && f < c.indicatorColumn.count; f++) {
            c.indicatorColumn.item(f, NaN);
        }
        if (this.o2 != null && this.sm(c)) {
            this.o2.cn();
        }
        return e;
    };
    StrategyBasedIndicator.prototype.sm = function (a) {
        var e_1, _a;
        if (!isNaN_(a.minimumValue) && !isNaN_(a.maximumValue) && a.specifiesRange) {
            var b = this.rq;
            this.rq = new AxisRange(a.minimumValue, a.maximumValue);
            return this.sl(b, this.rq);
        }
        var c = 1.7976931348623157E+308;
        var d = -1.7976931348623157E+308;
        try {
            for (var _b = tslib_1.__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.rq;
        this.rq = new AxisRange(c, d);
        return this.sl(f, this.rq);
    };
    StrategyBasedIndicator.prototype.sl = 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.sr = 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.ot = function (a, b) {
        var c = _super.prototype.ot.call(this, a, b);
        c.indicatorColumn = this.indicatorColumn;
        c.period = this.sr(this.sq());
        c.shortPeriod = this.sr(this.ss());
        c.longPeriod = this.sr(this.sp());
        c.multiplier = this.so();
        return c;
    };
    StrategyBasedIndicator.prototype.so = function () {
        return 1;
    };
    StrategyBasedIndicator.s1 = 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.sn.add("Multiplier");
        return c;
    };
    StrategyBasedIndicator.prototype.kp = function (a, b, c, d) {
        _super.prototype.kp.call(this, a, b, c, d);
        if (StrategyBasedIndicator.sn.contains(b)) {
            if (this.o2 != null && !this.o2.cn()) {
                this.ox.bx.e(this.fq);
                this.rt(0, this.indicatorColumn.count);
                if (this.rr.b7) {
                    this.rr.b5.g$i();
                }
                this.k3(false);
            }
        }
    };
    StrategyBasedIndicator.$t = markType(StrategyBasedIndicator, 'StrategyBasedIndicator', FinancialIndicator.$);
    StrategyBasedIndicator.sn = new List$1(String_$type, 0);
    return StrategyBasedIndicator;
}(FinancialIndicator));
export { StrategyBasedIndicator };
//# sourceMappingURL=StrategyBasedIndicator.js.map
