/*
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/ES5/type";
import { DependencyProperty } from "igniteui-react-core/ES5/DependencyProperty";
import { PropertyMetadata } from "igniteui-react-core/ES5/PropertyMetadata";
import { List$1 } from "igniteui-react-core/ES5/List$1";
import { AxisRange } from "./AxisRange";
import { isNaN_ } from "igniteui-react-core/ES5/number";
var StrategyBasedIndicator = /** @class */ (function (_super) {
    tslib_1.__extends(StrategyBasedIndicator, _super);
    function StrategyBasedIndicator() {
        var _this = _super.call(this) || this;
        _this.qe();
        return _this;
    }
    StrategyBasedIndicator.prototype.qe = function () {
        this.pz = this.p0;
        this.ab = this.qd;
    };
    StrategyBasedIndicator.prototype.p6 = function () {
        return -2147483648;
    };
    StrategyBasedIndicator.prototype.qf = function (a) {
    };
    StrategyBasedIndicator.prototype.p8 = function () {
        return -2147483648;
    };
    StrategyBasedIndicator.prototype.p5 = function () {
        return -2147483648;
    };
    StrategyBasedIndicator.qj = 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.p3.add(c);
        return d;
    };
    StrategyBasedIndicator.qi = function (a, b) {
        return StrategyBasedIndicator.qj(a, b, "Period");
    };
    StrategyBasedIndicator.qg = function (a, b) {
        return StrategyBasedIndicator.qj(a, b, "LongPeriod");
    };
    StrategyBasedIndicator.qk = function (a, b) {
        return StrategyBasedIndicator.qj(a, b, "ShortPeriod");
    };
    StrategyBasedIndicator.prototype.pc = function (a, b) {
        var c = this.l8(a, b);
        var d = this.l9(c);
        return this.pz.b(c, d);
    };
    StrategyBasedIndicator.prototype.o9 = function (a, b) {
        var c = this.l8(a, b);
        if (b == 0) {
            return false;
        }
        if (!this.m3(this.pc(a, b))) {
            return false;
        }
        var d = this.l9(c);
        if (this.o6 != null) {
            c.minimumValue = this.o6.c;
            c.maximumValue = this.o6.b;
        }
        var e = this.pz.a(c, d);
        for (var f = 0; f < this.pe && f < c.indicatorColumn.count; f++) {
            c.indicatorColumn.item(f, NaN);
        }
        if (this.mg != null && this.p2(c)) {
            this.mg.ck();
        }
        return e;
    };
    StrategyBasedIndicator.prototype.p2 = function (a) {
        if (!isNaN_(a.minimumValue) && !isNaN_(a.maximumValue) && a.specifiesRange) {
            var b = this.o6;
            this.o6 = new AxisRange(a.minimumValue, a.maximumValue);
            return this.p1(b, this.o6);
        }
        var c = 1.7976931348623157E+308;
        var d = -1.7976931348623157E+308;
        try {
            for (var _a = tslib_1.__values(fromEnum(a.indicatorColumn)), _b = _a.next(); !_b.done; _b = _a.next()) {
                var e = _b.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 (_b && !_b.done && (_c = _a.return)) _c.call(_a);
            }
            finally { if (e_1) throw e_1.error; }
        }
        var f = this.o6;
        this.o6 = new AxisRange(c, d);
        return this.p1(f, this.o6);
        var e_1, _c;
    };
    StrategyBasedIndicator.prototype.p1 = 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.p7 = 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.l8 = function (a, b) {
        var c = _super.prototype.l8.call(this, a, b);
        c.indicatorColumn = this.indicatorColumn;
        c.period = this.p7(this.p6());
        c.shortPeriod = this.p7(this.p8());
        c.longPeriod = this.p7(this.p5());
        c.multiplier = this.p4();
        return c;
    };
    StrategyBasedIndicator.prototype.p4 = function () {
        return 1;
    };
    StrategyBasedIndicator.qh = 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.p3.add("Multiplier");
        return c;
    };
    StrategyBasedIndicator.prototype.io = function (a, b, c, d) {
        _super.prototype.io.call(this, a, b, c, d);
        if (StrategyBasedIndicator.p3.contains(b)) {
            if (this.mg != null && !this.mg.ck()) {
                this.mc.bs.e(this.eo);
                this.o9(0, this.indicatorColumn.count);
                if (this.o7.b2) {
                    this.o7.b0.g$i();
                }
                this.i1(false);
            }
        }
    };
    StrategyBasedIndicator.p3 = new List$1(String_$type, 0);
    StrategyBasedIndicator.$t = markType(StrategyBasedIndicator, 'StrategyBasedIndicator', FinancialIndicator.$);
    return StrategyBasedIndicator;
}(FinancialIndicator));
export { StrategyBasedIndicator };
/*<BeginStatics Name="Infragistics.Controls.Charts.StrategyBasedIndicator" />*/
/*<EndStatics Name="Infragistics.Controls.Charts.StrategyBasedIndicator" />*/
