/*
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 { FinancialSeries } from "./FinancialSeries";
import { ITrendLineSeries_$type } from "./ITrendLineSeries";
import { IndicatorDisplayType_$type } from "./IndicatorDisplayType";
import { DependencyProperty } from "igniteui-angular-core";
import { TrendLineType_$type } from "igniteui-angular-core";
import { Brush } from "igniteui-angular-core";
import { PenLineCap_$type } from "igniteui-angular-core";
import { DoubleCollection } from "igniteui-angular-core";
import { List$1 } from "igniteui-angular-core";
import { AxisRange } from "./AxisRange";
import { CategoryFrame } from "./CategoryFrame";
import { Number_$type, typeCast, enumGetBox, EnumUtil, runOn, markType, markDep } from "igniteui-angular-core";
import { Rect } from "igniteui-angular-core";
import { ScalerParams } from "./ScalerParams";
import { ISortingAxis_$type } from "./ISortingAxis";
import { CategoryTrendLineManagerFactory } from "./CategoryTrendLineManagerFactory";
import { FinancialSeriesView } from "./FinancialSeriesView";
import { FinancialBucketCalculator } from "./FinancialBucketCalculator";
import { TrendResolutionParams } from "./TrendResolutionParams";
import { CategorySeries } from "./CategorySeries";
import { NotImplementedException } from "igniteui-angular-core";
import { Path } from "igniteui-angular-core";
import { PropertyMetadata } from "igniteui-angular-core";
import { isNaN_ } from "igniteui-angular-core";
import { Pool$1 } from "igniteui-angular-core";
import { LineGeometry } from "igniteui-angular-core";
import { PathGeometry } from "igniteui-angular-core";
import { GeometryGroup } from "igniteui-angular-core";
import { Defaults } from "./Defaults";
import { Extensions } from "igniteui-angular-core";
import { IndicatorRenderer } from "./IndicatorRenderer";
/**
 * @hidden
 */
var FinancialIndicator = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(FinancialIndicator, _super);
    function FinancialIndicator() {
        var _this = _super.call(this) || this;
        _this._indicatorColumn = null;
        _this.tq = null;
        _this.qk = new CategoryFrame(3);
        _this.qm = new CategoryFrame(3);
        _this.qi = new CategoryFrame(3);
        _this.indicatorColumn = new List$1(Number_$type, 0);
        _this.tq = new AxisRange(-100, 100);
        return _this;
    }
    FinancialIndicator.prototype.get_dr = function () {
        return true;
    };
    FinancialIndicator.prototype.bx = function () {
        return new FinancialIndicatorView(this);
    };
    FinancialIndicator.prototype.l2 = function (a) {
        _super.prototype.l2.call(this, a);
        this.tr = a;
    };
    FinancialIndicator.prototype.t4 = function (a) {
        if (this.q2 != null && !this.q2.c0()) {
            this.ml(true);
        }
    };
    FinancialIndicator.prototype.tw = function (a, b, c) {
        if (isNaN_(b.x) || isNaN_(b.y)) {
            return false;
        }
        var d = this.q2;
        var e = 0;
        if (d != null) {
            e = d.e3(d.l5);
        }
        if ((a.y >= e && a.y <= b.y) || (a.y <= e && a.y >= b.y)) {
            return true;
        }
        return false;
    };
    FinancialIndicator.prototype.bp = function () {
        if (this.bq == 0) {
            return 1;
        }
        else {
            return _super.prototype.bp.call(this);
        }
    };
    FinancialIndicator.prototype.pz = function (a) {
        if (this.qg == null || this.q2 == null) {
            return Rect.empty;
        }
        var b = this.pl(a);
        var c = this.b0.bv;
        var d = this.b0.bu;
        var e = this.getEffectiveViewport1(this.b0);
        var f = new ScalerParams(0, c, d, this.q2.cg, e);
        f.b = this.ge();
        var g = this.aj(this.qg, this.qi.f, this.sd(this.b0), this.sf(this.b0), a, true);
        if (g == null) {
            return Rect.empty;
        }
        var h = g[0];
        var i = g[1];
        var j = Math.abs(b.x - h[0]);
        var k = Math.abs(b.x - i[0]);
        var l = this.q2.ei(this.q2.l5, f);
        var m = 1;
        if (j < k) {
            var n = h[0] - 0.5 * m;
            var o = h[1];
            var p = l;
            return new Rect(0, n, Math.min(o, p), m, Math.max(o, p) - Math.min(o, p));
        }
        else {
            var q = i[0] - 0.5 * m;
            var r = i[1];
            var s = l;
            return new Rect(0, q, Math.min(r, s), m, Math.max(r, s) - Math.min(r, s));
        }
    };
    FinancialIndicator.prototype.ex = function (a, b) {
        var c = this.pq(this.pt(a), true, false);
        if (this.tt == 1) {
            if (this.tw(a, c, b)) {
                return true;
            }
        }
        if (this.tt == 1 || this.tt == 0) {
            if (this.ew(a, b)) {
                return true;
            }
        }
        if (this.tt == 2) {
            if (this.e0(a, b)) {
                return true;
            }
        }
        return false;
    };
    FinancialIndicator.prototype.k3 = function (a, b, c, d) {
        _super.prototype.k3.call(this, a, b, c, d);
        if (this.qg != null && typeCast(ISortingAxis_$type, this.qg) !== null) {
            this.qg.i$i();
        }
        if (this.tr.b7) {
            this.tr.b5.g$e(a, b, c, d);
        }
        if (d != null && this.rs.containsKey(d)) {
            var e = this.rs.tryGetValue(d, d);
            d = e.p1;
        }
        if (this.qg != null && typeCast(ISortingAxis_$type, this.qg) !== null) {
            a = 4;
            b = 0;
            c = this.ck.count;
        }
        switch (a) {
            case 3:
                if (this.tv(b, c, d)) {
                    this.t6(b, c, d);
                    this.t4(true);
                }
                break;
            case 2:
                if (this.tv(b, this.ck.count - b, d)) {
                    this.t6(b, this.ck.count - b, d);
                    this.t4(true);
                }
                break;
            case 1:
                if (this.tv(b, this.ck.count - b, d)) {
                    var f = new Array(c);
                    for (var g = 0; g < c; g++) {
                        f[g] = 0;
                    }
                    this.indicatorColumn.s(b, f);
                    this.t6(b, this.ck.count - b, d);
                    this.t4(true);
                }
                break;
            case 0:
                if (this.tv(b, this.ck.count - b, d)) {
                    this.indicatorColumn.v(b, c);
                    this.t6(b, this.ck.count - b, d);
                    this.t4(true);
                }
                break;
            case 4:
                if (this.tv(b, this.ck.count - b, d)) {
                    this.indicatorColumn = new List$1(Number_$type, 2, this.ck.count);
                    var h = new Array(c);
                    for (var i = 0; i < c; i++) {
                        h[i] = 0;
                    }
                    this.indicatorColumn.s(0, h);
                    this.t6(b, this.ck.count - b, d);
                    this.t4(true);
                }
                break;
        }
    };
    FinancialIndicator.prototype.get_ts = function () {
        return 0;
    };
    Object.defineProperty(FinancialIndicator.prototype, "ts", {
        get: function () {
            return this.get_ts();
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(FinancialIndicator.prototype, "uh", {
        get: function () {
            return this.c(FinancialIndicator.t7);
        },
        set: function (a) {
            this.h(FinancialIndicator.t7, a);
        },
        enumerable: false,
        configurable: true
    });
    FinancialIndicator.prototype.t1 = function () {
        return -1;
    };
    Object.defineProperty(FinancialIndicator.prototype, "indicatorColumn", {
        get: function () {
            return this._indicatorColumn;
        },
        set: function (a) {
            this._indicatorColumn = a;
        },
        enumerable: false,
        configurable: true
    });
    FinancialIndicator.prototype.l7 = function (a, b, c, d) {
        switch (b) {
            case "XAxis":
                this.tr.cd();
                break;
            case "TrendLineType":
                var e = EnumUtil.getEnumValue(TrendLineType_$type, d);
                if (e != 0) {
                    this.tr.b5 = CategoryTrendLineManagerFactory.a(this.tr.b5, this.qg, this.nd, this, this.cn);
                }
                break;
        }
        _super.prototype.l7.call(this, a, b, c, d);
        if (this.tr.b7 && this.tr.b5.g$b(a, b, c, d)) {
            this.ml(false);
            var f = typeCast(FinancialIndicatorView.$, this.bz);
            if (f != null && f.b7) {
                f.b5.g$b(a, b, c, d);
            }
            this.ls();
        }
        switch (b) {
            case "FastItemsSource":
                if (this.ck != null) {
                    this.indicatorColumn = new List$1(Number_$type, 2, this.ck.count);
                    var g = new Array(this.ck.count);
                    for (var h = 0; h < this.ck.count; h++) {
                        g[h] = 0;
                    }
                    this.indicatorColumn.s(0, g);
                    this.t6(0, this.ck.count, null);
                    if (this.q2 != null && !this.q2.c0()) {
                        this.qx.bx.e(this.fv);
                        this.ml(false);
                    }
                }
                break;
            case "TrendLineBrush":
                this.mz();
                break;
            case FinancialIndicator.$$p[0]:
                this.k0(true, this.b0);
                this.m0();
                this.ml(false);
                this.ls();
                break;
            case "OpenColumn":
            case "HighColumn":
            case "LowColumn":
            case "CloseColumn":
            case "VolumeColumn":
                if (this.ck != null) {
                    if (this.indicatorColumn.count != this.ck.count) {
                        this.indicatorColumn = new List$1(Number_$type, 2, this.ck.count);
                        var i = new Array(this.ck.count);
                        for (var j = 0; j < this.ck.count; j++) {
                            i[j] = 0;
                        }
                        this.indicatorColumn.s(0, i);
                    }
                    if (this.tv(0, this.ck.count - 1, b)) {
                        this.t5();
                    }
                }
                break;
            case "XAxis":
                if (this.qg != null && (typeCast(ISortingAxis_$type, this.qg) !== null || typeCast(ISortingAxis_$type, c) !== null)) {
                    this.t5();
                }
                break;
            case "YAxis":
            case FinancialIndicator.$$p[1]:
                this.t5();
                this.ls();
                break;
            case "TrendLineType":
                this.ls();
                break;
        }
    };
    FinancialIndicator.prototype.gl = function (a, b, c) {
        if (this.indicatorColumn == null) {
            return _super.prototype.gl.call(this, a, b, c);
        }
        var d = this.getEffectiveViewport1(this.b0);
        var e = this.r7(this.b0.bv, this.b0.bu, d);
        var f = new ScalerParams(0, this.b0.bv, this.b0.bu, this.qg.cg, d);
        f.c = this.cd.to;
        return this.gn(this.indicatorColumn, a, this.qg, f, e, runOn(this, this.r6), b, c);
    };
    FinancialIndicator.prototype.hl = function (a, b) {
        if (this.indicatorColumn == null) {
            return _super.prototype.hl.call(this, a, b);
        }
        return this.hm(a, b, this.qg, runOn(this, this.r6), this.indicatorColumn);
    };
    FinancialIndicator.prototype.hj = function (a, b) {
        if (this.indicatorColumn == null) {
            return _super.prototype.hj.call(this, a, b);
        }
        return this.hk(a, b, this.qg, runOn(this, this.r6), this.indicatorColumn);
    };
    FinancialIndicator.prototype.get_fa = function () {
        return true;
    };
    FinancialIndicator.prototype.tv = function (a, b, c) {
        if (c == null) {
            return true;
        }
        if (this.tx(a, b).contains(c)) {
            return true;
        }
        return false;
    };
    FinancialIndicator.prototype.t6 = function (a, b, c) {
        this.tu(a, b);
    };
    FinancialIndicator.prototype.ap = function (a) {
        if (this.ck == null) {
            return null;
        }
        if (a != null && a == this.q2) {
            return this.tq;
        }
        return null;
    };
    FinancialIndicator.prototype.eo = function (a) {
        var b = this.ck != null ? this.ck.indexOf(a) : -1;
        var c = this.b0.bv;
        c = c.copy();
        var d = this.b0.bu;
        var e = new Rect(0, 0, 0, 1, 1);
        var f = this.px(this.b0);
        if (b >= 0 && Rect.l_op_Inequality(c, null) && Rect.l_op_Inequality(d, null)) {
            if (this.qg != null) {
                var g = new ScalerParams(0, e, e, this.qg.cg, f);
                var h = this.qg.ei(b, g);
                if (h < c.left + 0.1 * c.width) {
                    h = h + 0.4 * c.width;
                }
                if (h > c.right - 0.1 * c.width) {
                    h = h - 0.4 * c.width;
                }
                c.x = h - 0.5 * c.width;
            }
            if (this.q2 != null && this.indicatorColumn != null && b < this.indicatorColumn.count) {
                var i = new ScalerParams(0, e, e, this.q2.cg, f);
                i.b = this.ge();
                var j = this.q2.ei(this.indicatorColumn._inner[b], i);
                if (j < c.top + 0.1 * c.height) {
                    j = j + 0.4 * c.height;
                }
                if (j > c.bottom - 0.1 * c.height) {
                    j = j - 0.4 * c.height;
                }
                c.y = j - 0.5 * c.height;
            }
            this.b8.au(this.cd, c, true);
        }
        return b >= 0;
    };
    FinancialIndicator.prototype.fb = function (a, b, c) {
        var d = _super.prototype.fb.call(this, a, b, c);
        if (this.indicatorColumn == null || this.indicatorColumn.count == 0) {
            d = false;
        }
        return d;
    };
    FinancialIndicator.prototype.s7 = function (a, b) {
        var _this = this;
        _super.prototype.s7.call(this, a, b);
        var c = b.bv;
        var d = b.bu;
        var e = this.getEffectiveViewport1(b);
        var f = this.qg;
        var g = this.q2;
        var h = new ScalerParams(0, c, d, f.cg, e);
        var i = new ScalerParams(0, c, d, g.cg, e);
        i.b = this.ge();
        a.f.clear();
        a.m.clear();
        a.p.clear();
        var j = 0;
        var k = typeCast(ISortingAxis_$type, this.qg);
        if (k != null && k.i$b.count != this.ck.count) {
            return;
        }
        j = this.r7(c, d, e);
        var l = this.t1();
        if (l == -1) {
            l = this.trendLinePeriod;
        }
        var m = typeCast(FinancialIndicatorView.$, b);
        if (m.b7) {
            m.b5.prepareLineCore(a.p, this.trendLineType, this.indicatorColumn, l, function (n) { return _this.qg.ei(n, h); }, function (n) { return _this.q2.ei(n, i); }, ((function () {
                var $ret = new TrendResolutionParams();
                $ret.c = b.bx.b;
                $ret.d = b.bx.c;
                $ret.e = b.bx.d;
                $ret.a = j;
                $ret.b = _this.fv;
                $ret.f = d;
                $ret.g = c;
                return $ret;
            })()));
        }
        var n = this.qg.el(2, h) - this.qg.el(1, h);
        for (var o = b.bx.c; o <= b.bx.d; ++o) {
            var p = void 0;
            if (k == null) {
                p = b.bx.getBucket(o);
            }
            else {
                var q = k.i$b._inner[o];
                var r = k.i$d(q);
                var s = this.indicatorColumn._inner[o];
                var t = s;
                var u = r;
                while (o < b.bx.d) {
                    q = k.i$b._inner[o + 1];
                    u = k.i$d(q);
                    if (u - r > n) {
                        break;
                    }
                    o++;
                    var v = this.indicatorColumn._inner[o];
                    s = Math.min(s, v);
                    t = Math.max(t, v);
                }
                var w = NaN;
                if (!isNaN_(r)) {
                    w = this.qg.ei(r, h);
                }
                p = [w, s, t];
            }
            if (!isNaN_(p[0])) {
                if (this.qg != null && typeCast(ISortingAxis_$type, this.qg) !== null) {
                    p[0] = p[0] + j;
                }
                else {
                    p[0] = f.ei(p[0], h) + j;
                }
                p[1] = g.ei(p[1], i);
                if (b.bx.b > 1 || k != null) {
                    p[2] = g.ei(p[2], i);
                }
                else {
                    p[2] = p[1];
                }
                a.f.add(p);
            }
        }
        return;
    };
    FinancialIndicator.prototype.k0 = function (a, b) {
        _super.prototype.k0.call(this, a, b);
        var c = b;
        c.b8(a);
        if (c.b7) {
            c.b5.g$d();
        }
    };
    FinancialIndicator.prototype.qq = function () {
        switch (this.tt) {
            case 1: return 1;
            case 2: return 1;
            case 0: return 12;
        }
        return 1;
    };
    FinancialIndicator.prototype.s9 = function (a, b) {
        _super.prototype.s9.call(this, a, b);
        var c = typeCast(FinancialIndicatorView.$, b);
        var d = function (e) { return a.f._inner[e][0]; };
        var e = function (f) { return a.f._inner[f][1]; };
        if (c.b7) {
            c.b5.g$d();
            c.b5.g$g(a.p);
        }
        var f = b.bu;
        var g = this.getEffectiveViewport1(b);
        var h = 0;
        var i = this.o3;
        var j = this.tm;
        if (b.b0(a)) {
            c.b8(false);
            if (a.f.count > 0) {
                switch (this.tt) {
                    case 0:
                        var k = CategorySeries.rn(a.f, a.f.count - 1, f, b.bv, false);
                        c.cc(a.f.count, d, e, true, k);
                        break;
                    case 1:
                        if (this.q2 != null) {
                            h = this.sb(b);
                        }
                        else {
                            h = 0.5 * (f.top + f.bottom);
                        }
                        var l = CategorySeries.rn(a.f, a.f.count - 1, f, b.bv, false);
                        c.ca(a.f.count, d, e, true, h, l);
                        break;
                    case 2:
                        h = this.sb(b);
                        c.cb(a.f.count, d, e, true, h);
                        break;
                    default: throw new NotImplementedException(0);
                }
            }
            b.b2(a);
        }
        var m = a.f;
        var n = this.ck.count;
        this.qp.a0(this, this.ro(), runOn(this, this.p8), this.sd(b), this.sf(b));
        var o = false;
        var p = this.qp.b;
        if (p != null) {
            o = true;
        }
        this.qp.ak = i;
        this.qp.ag = i;
        if (o) {
            var q = new ScalerParams(0, b.bv, b.bu, this.qg.cg, g);
            this.qp.f = false;
            this.s6(m, -1, n, this.qg, q, b.q);
        }
        this.qp.ad(c.cu, true, false, true, false);
        this.qp.ad(c.cw, true, false, true, false);
        this.qp.ad(c.cv, false, true, false, false);
        c.cv._opacity = 0.8 * this.qp.j * this.fs;
        this.qp.ad(c.ct, true, false, false, false);
        this.qp.ak = j;
        this.qp.ag = j;
        if (o) {
            var r = new ScalerParams(0, b.bv, b.bu, this.qg.cg, g);
            this.qp.f = true;
            this.s6(m, -1, n, this.qg, r, b.q);
        }
        this.qp.ad(c.cq, true, false, true, false);
        this.qp.ad(c.cs, true, false, true, false);
        this.qp.ad(c.cr, false, true, false, false);
        c.cr._opacity = 0.8 * this.qp.j * this.fs;
        this.qp.ad(c.cp, true, false, false, false);
        c.ce();
    };
    FinancialIndicator.prototype.mz = function () {
        _super.prototype.mz.call(this);
        if (this.index < 0) {
            return;
        }
        if (this.tr.b7) {
            this.tr.cf();
        }
    };
    FinancialIndicator.prototype.t5 = function () {
        if (this.tr.b7) {
            this.tr.b5.g$i();
        }
        this.tu(0, this.indicatorColumn.count);
        if (this.q2 != null && !this.q2.c0()) {
            this.ml(false);
        }
    };
    FinancialIndicator.prototype.la = function (a) {
        _super.prototype.la.call(this, a);
        this.a8.exportTrendlineData(this, a, this.tr.b5.g$j);
    };
    FinancialIndicator.prototype.ba = function (a) {
        if (this.tt == 1 || this.tt == 2) {
            return 3;
        }
        else if (this.tt == 0) {
            return 2;
        }
        return a;
    };
    FinancialIndicator.$t = markType(FinancialIndicator, 'FinancialIndicator', FinancialSeries.$, [ITrendLineSeries_$type]);
    FinancialIndicator.t7 = DependencyProperty.i("ActualTrendLineBrush", Brush.$, FinancialIndicator.$, new PropertyMetadata(2, null, function (a, b) { return a.raisePropertyChanged("ActualTrendLineBrush", b.oldValue, b.newValue); }));
    FinancialIndicator.$$p = markDep(DependencyProperty, PropertyMetadata, FinancialIndicator, 'raisePropertyChanged', ['DisplayType:tt:t8', [IndicatorDisplayType_$type, enumGetBox(IndicatorDisplayType_$type, 0)], 'IgnoreFirst:tz:t9', [1, 0], 'TrendLineType::uf', [TrendLineType_$type, enumGetBox(TrendLineType_$type, 0)], 'TrendLineThickness::ue', [1, 1.5], 'TrendLinePeriod::ud', [1, 7], 'TrendLineBrush::ua', [Brush.$, null], 'TrendLineZIndex:t0:ug', [1, 1001], 'TrendLineDashArray:ui:ub', [DoubleCollection.$], 'TrendLineDashCap:uj:uc', [PenLineCap_$type, enumGetBox(PenLineCap_$type, 0)]]);
    return FinancialIndicator;
}(FinancialSeries));
export { FinancialIndicator };
/**
 * @hidden
 */
var FinancialIndicatorBucketCalculator = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(FinancialIndicatorBucketCalculator, _super);
    function FinancialIndicatorBucketCalculator(a) {
        var _this = _super.call(this, a) || this;
        _this.f = null;
        _this.f = a;
        return _this;
    }
    FinancialIndicatorBucketCalculator.prototype.getBucket = function (a) {
        var b = a * this.b;
        var c = Math.min(b + this.b - 1, this.f.b3.indicatorColumn.count - 1);
        var d = NaN;
        var e = NaN;
        for (var f = b; f <= c; ++f) {
            var g = this.f.b3.indicatorColumn._inner[f];
            if (!isNaN_(d)) {
                if (!isNaN_(g)) {
                    d = Math.min(d, g);
                    e = Math.max(e, g);
                }
            }
            else {
                d = g;
                e = g;
            }
        }
        if (!isNaN_(d)) {
            return [0.5 * (b + c), d, e];
        }
        return [NaN, NaN, NaN];
    };
    FinancialIndicatorBucketCalculator.$t = markType(FinancialIndicatorBucketCalculator, 'FinancialIndicatorBucketCalculator', FinancialBucketCalculator.$);
    return FinancialIndicatorBucketCalculator;
}(FinancialBucketCalculator));
export { FinancialIndicatorBucketCalculator };
/**
 * @hidden
 */
var FinancialIndicatorView = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(FinancialIndicatorView, _super);
    function FinancialIndicatorView(a) {
        var _this = _super.call(this, a) || this;
        _this.b3 = null;
        _this.b6 = null;
        _this.cu = ((function () {
            var $ret = new Path();
            $ret.ak = new PathGeometry();
            return $ret;
        })());
        _this.cq = ((function () {
            var $ret = new Path();
            $ret.ak = new PathGeometry();
            return $ret;
        })());
        _this.cv = ((function () {
            var $ret = new Path();
            $ret.ak = new PathGeometry();
            return $ret;
        })());
        _this.cr = ((function () {
            var $ret = new Path();
            $ret.ak = new PathGeometry();
            return $ret;
        })());
        _this.cw = ((function () {
            var $ret = new Path();
            $ret.ak = new PathGeometry();
            return $ret;
        })());
        _this.cs = ((function () {
            var $ret = new Path();
            $ret.ak = new PathGeometry();
            return $ret;
        })());
        _this.ct = ((function () {
            var $ret = new Path();
            $ret.ak = new GeometryGroup();
            return $ret;
        })());
        _this.cp = ((function () {
            var $ret = new Path();
            $ret.ak = new GeometryGroup();
            return $ret;
        })());
        _this.b4 = null;
        _this.cm = new Path();
        _this.co = new Path();
        _this.cn = new Path();
        _this.cl = new Path();
        _this.ci = new Path();
        _this.ck = new Path();
        _this.cj = new Path();
        _this.ch = new Path();
        _this.b3 = a;
        _this.b6 = ((function () {
            var $ret = new Pool$1(LineGeometry.$);
            $ret.create = runOn(_this, _this.cg);
            $ret.destroy = runOn(_this, _this.b9);
            return $ret;
        })());
        return _this;
    }
    FinancialIndicatorView.prototype.by = function () {
        return new FinancialIndicatorBucketCalculator(this);
    };
    FinancialIndicatorView.prototype.as = function () {
        _super.prototype.as.call(this);
        if (!this.q) {
            this.b3.tm = Defaults.ah;
            this.b3.tt = this.b3.ts;
        }
    };
    FinancialIndicatorView.prototype.cg = function () {
        return new LineGeometry();
    };
    FinancialIndicatorView.prototype.b9 = function (a) {
    };
    Object.defineProperty(FinancialIndicatorView.prototype, "b5", {
        get: function () {
            if (this.b4 == null) {
                this.b4 = CategoryTrendLineManagerFactory.a(this.b4, this.e.ar(), this.e.nd, this.e, this.e.cn);
            }
            return this.b4;
        },
        set: function (a) {
            this.b4 = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(FinancialIndicatorView.prototype, "b7", {
        get: function () {
            return this.b4 != null;
        },
        enumerable: false,
        configurable: true
    });
    FinancialIndicatorView.prototype.b8 = function (a) {
        Extensions.e(this.cu.ak);
        Extensions.e(this.cv.ak);
        Extensions.e(this.cw.ak);
        Extensions.e(this.cq.ak);
        Extensions.e(this.cr.ak);
        Extensions.e(this.cs.ak);
        Extensions.d(this.ct.ak);
        Extensions.d(this.cp.ak);
        if (a) {
            this.b6.count = 0;
        }
        this.aq();
    };
    FinancialIndicatorView.prototype.ce = function () {
    };
    FinancialIndicatorView.prototype.cc = function (a, b, c, d, e) {
        IndicatorRenderer.g(a, b, c, d, this.bv, this.bu, this.cu, this.cq, this.bx.b, this.e.fv, e);
        this.aq();
    };
    FinancialIndicatorView.prototype.ca = function (a, b, c, d, e, f) {
        IndicatorRenderer.e(a, b, c, d, this.bv, this.bu, this.cu, this.cv, this.cq, this.cr, e, this.bx.b, this.e.fv, f);
        this.aq();
    };
    FinancialIndicatorView.prototype.cb = function (a, b, c, d, e) {
        IndicatorRenderer.f(a, b, c, d, this.bu, e, this.b6, this.ct, this.cp);
        this.aq();
    };
    FinancialIndicatorView.prototype.cf = function () {
        this.b3.uh = null;
        if (this.b3.trendLineBrush != null) {
            this.b3.uh = this.b3.trendLineBrush;
        }
        else {
            this.b3.uh = this.b3.o3;
        }
    };
    FinancialIndicatorView.prototype.bc = function () {
        _super.prototype.bc.call(this);
        var a = this.bo();
        this.cm.ak = this.cu.ak;
        this.co.ak = this.cw.ak;
        this.cn.ak = this.cv.ak;
        this.cl.ak = this.ct.ak;
        this.ci.ak = this.cq.ak;
        this.ck.ak = this.cs.ak;
        this.cj.ak = this.cr.ak;
        this.ch.ak = this.cp.ak;
        this.cm._stroke = a;
        this.co._stroke = a;
        this.cm.ac = this.e.fw + 3;
        this.co.ac = this.e.fw + 3;
        this.cn._fill = a;
        this.cn._opacity = 1;
        this.cl._stroke = a;
        this.cl.ac = this.e.fw + 3;
        this.ci._stroke = a;
        this.ck._stroke = a;
        this.ci.ac = this.e.fw + 3;
        this.ck.ac = this.e.fw + 3;
        this.cj._fill = a;
        this.cj._opacity = 1;
        this.ch._stroke = a;
        this.ch.ac = this.e.fw + 3;
    };
    FinancialIndicatorView.prototype.a6 = function (a, b) {
        _super.prototype.a6.call(this, a, b);
        if (a.d) {
            if (b) {
                if (this.b3.tt == 2) {
                    a.t(this.cl);
                    a.t(this.ch);
                }
                else {
                    a.t(this.cn);
                    a.t(this.cm);
                    a.t(this.co);
                    a.t(this.cj);
                    a.t(this.ci);
                    a.t(this.ck);
                }
            }
            else {
                if (this.b3.tt == 2) {
                    a.t(this.ct);
                    a.t(this.cp);
                }
                else {
                    a.t(this.cv);
                    a.t(this.cu);
                    a.t(this.cw);
                    a.t(this.cr);
                    a.t(this.cq);
                    a.t(this.cs);
                }
            }
        }
    };
    FinancialIndicatorView.prototype.a5 = function (a, b) {
        if (a.d) {
            if (this.b3.trendLineType != 0 && !b) {
                var c = this.b5.g$j;
                c.ac = this.b3.trendLineThickness;
                c._stroke = this.b3.uh;
                c.ad = this.b3.uj;
                c.ai = this.b3.ui;
                a.v(c);
            }
        }
        _super.prototype.a5.call(this, a, b);
    };
    FinancialIndicatorView.prototype.al = function (a) {
        _super.prototype.al.call(this, a);
        this.e.a8.exportPathData(a, this.ct, "positiveColumnsShape", ["Positive", "Main"]);
        this.e.a8.exportPathData(a, this.cp, "negativeColumnsShape", ["Negative"]);
        this.e.a8.exportPathData(a, this.cu, "positive0", ["Positive", "Main"]);
        this.e.a8.exportPathData(a, this.cw, "positive1", ["Positive"]);
        this.e.a8.exportPathData(a, this.cv, "positive01", ["PositiveFill"]);
        this.e.a8.exportPathData(a, this.cq, "negative0", ["Negative", "Main"]);
        this.e.a8.exportPathData(a, this.cs, "negative1", ["Negative"]);
        this.e.a8.exportPathData(a, this.cr, "negative01", ["NegativeFill"]);
    };
    FinancialIndicatorView.prototype.cd = function () {
        if (this.b7) {
            this.b4 = CategoryTrendLineManagerFactory.a(this.b4, this.e.ar(), this.e.nd, this.e, this.e.cn);
        }
    };
    FinancialIndicatorView.$t = markType(FinancialIndicatorView, 'FinancialIndicatorView', FinancialSeriesView.$);
    return FinancialIndicatorView;
}(FinancialSeriesView));
export { FinancialIndicatorView };
