/*
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 { FinancialSeries } from "./FinancialSeries";
import { ITrendLineSeries_$type } from "./ITrendLineSeries";
import { TrendLineType_$type } from "igniteui-angular-core";
import { DependencyProperty } from "igniteui-angular-core";
import { Brush } from "igniteui-angular-core";
import { PenLineCap_$type } from "igniteui-angular-core";
import { DoubleCollection } from "igniteui-angular-core";
import { PriceDisplayType_$type } from "./PriceDisplayType";
import { enumGetBox, EnumUtil, typeCast, fromEnum, runOn, Point_$type, markType, markDep } from "igniteui-angular-core";
import { CategoryFrame } from "./CategoryFrame";
import { ISortingAxis_$type } from "./ISortingAxis";
import { FinancialSeriesView } from "./FinancialSeriesView";
import { Series } from "./Series";
import { Rect } from "igniteui-angular-core";
import { List$1 } from "igniteui-angular-core";
import { RectUtil } from "igniteui-angular-core";
import { CategoryTrendLineManagerFactory } from "./CategoryTrendLineManagerFactory";
import { AxisRange } from "./AxisRange";
import { ScalerParams } from "./ScalerParams";
import { TrendResolutionParams } from "./TrendResolutionParams";
import { Pool$1 } from "igniteui-angular-core";
import { Path } from "igniteui-angular-core";
import { PathGeometry } from "igniteui-angular-core";
import { PathFigure } from "igniteui-angular-core";
import { LineSegment } from "igniteui-angular-core";
import { GeometryGroup } from "igniteui-angular-core";
import { LineGeometry } from "igniteui-angular-core";
import { RectangleGeometry } from "igniteui-angular-core";
import { PropertyMetadata } from "igniteui-angular-core";
import { truncate, isNaN_ } from "igniteui-angular-core";
import { boxArray$1 } from "igniteui-angular-core";
import { FinancialPriceBucketCalculator } from "./FinancialPriceBucketCalculator";
import { Extensions } from "igniteui-angular-core";
/**
 * @hidden
 */
var FinancialPriceSeries = /** @class */ (function (_super) {
    tslib_1.__extends(FinancialPriceSeries, _super);
    function FinancialPriceSeries() {
        var _this = _super.call(this) || this;
        _this.ab = FinancialPriceSeries.$;
        _this.mb = new CategoryFrame(5);
        _this.md = new CategoryFrame(5);
        _this.ma = new CategoryFrame(5);
        return _this;
    }
    FinancialPriceSeries.prototype.bf = function () {
        return new FinancialPriceSeriesView(this);
    };
    FinancialPriceSeries.prototype.iu = function (a) {
        _super.prototype.iu.call(this, a);
        this.pj = a;
    };
    Object.defineProperty(FinancialPriceSeries.prototype, "p3", {
        get: function () {
            return this.c(FinancialPriceSeries.pt);
        },
        set: function (a) {
            this.h(FinancialPriceSeries.pt, a);
        },
        enumerable: true,
        configurable: true
    });
    FinancialPriceSeries.prototype.hy = function (a, b, c, d) {
        _super.prototype.hy.call(this, a, b, c, d);
        if (this.l8 != null && typeCast(ISortingAxis_$type, this.l8) !== null) {
            this.l8.i$i();
        }
        this.pj.bu.e(this.eu);
        if (this.pj.b4) {
            this.pj.b2.g$e(a, b, c, d);
        }
        if (this.mt != null) {
            this.mt.cl();
        }
        this.jd(true);
    };
    FinancialPriceSeries.prototype.bd = function () {
        if (this.be == 0) {
            return 1;
        }
        else {
            return _super.prototype.bd.call(this);
        }
    };
    FinancialPriceSeries.prototype.lu = function (a) {
        if (this.ma == null || this.ma.f.count == 0) {
            return Rect.empty;
        }
        var b = this.lg(a);
        var c = this.bi.bs;
        var d = this.bi.br;
        var e = this.getEffectiveViewport1(this.bi);
        var f = this.aj(this.l8, this.ma.f, this.n5(this.bi), this.n7(this.bi), a, true);
        var g = f[0];
        var h = f[1];
        var i = Math.abs(b.x - g[0]);
        var j = Math.abs(b.x - h[0]);
        var k = this.pl(this.mo, e);
        k = Math.max(k, 3);
        var l = (k - 1) / 2;
        if (i < j) {
            var m = g[0] - l;
            var n = g[0];
            var o = g[0] + l;
            var p = g[1];
            var q = g[2];
            var r = g[3];
            var s = g[4];
            var t = Math.min(Math.min(Math.min(p, q), r), s);
            var u = Math.max(Math.max(Math.max(p, q), r), s);
            return new Rect(0, m, t, Math.abs(o - m), u - t);
        }
        else {
            var v = h[0] - l;
            var w = h[0];
            var x = h[0] + l;
            var y = h[1];
            var z = h[2];
            var aa = h[3];
            var ab = h[4];
            var ac = Math.min(Math.min(Math.min(y, z), aa), ab);
            var ad = Math.max(Math.max(Math.max(y, z), aa), ab);
            return new Rect(0, v, ac, Math.abs(x - v), ad - ac);
        }
    };
    FinancialPriceSeries.prototype.pi = function (a, b) {
        var c = a[0] - b;
        var d = a[0];
        var e = a[0] + b;
        var f = a[1];
        var g = a[2];
        var h = a[3];
        var i = a[4];
        var j = Math.min(Math.min(Math.min(f, g), h), i);
        var k = Math.max(Math.max(Math.max(f, g), h), i);
        var l = Math.min(g, h);
        var m = Math.max(g, h);
        var n = Math.min(f, i);
        var o = Math.max(f, i);
        if (this.pk == 1) {
            var p = new Array(3);
            var q = new Rect(0, c, f, b, 0);
            var r = new Rect(0, d, i, b, 0);
            var s = new Rect(0, d, l, 0, m - l);
            p[0] = q;
            p[1] = r;
            p[2] = s;
            return p;
        }
        else {
            var t = new Array(2);
            var u = new Rect(0, d, l, 0, m - l);
            var v = new Rect(0, c, n, b * 2, o - n);
            t[0] = u;
            t[1] = v;
            return t;
        }
    };
    FinancialPriceSeries.prototype.ak = function (a) {
        var b = new List$1(Rect.$, 0);
        var c = this.lg(a);
        var d = this.bi.bs;
        var e = this.bi.br;
        var f = this.getEffectiveViewport1(this.bi);
        var g = this.aj(this.l8, this.ma.f, this.n5(this.bi), this.n7(this.bi), a, true);
        var h = g[0];
        var i = g[1];
        var j = Math.abs(c.x - h[0]);
        var k = Math.abs(c.x - i[0]);
        var l = this.pl(this.mo, f);
        l = Math.max(l, 3);
        var m = (l - 1) / 2;
        if (j < k) {
            return this.pi(h, m);
        }
        else {
            return this.pi(i, m);
        }
    };
    FinancialPriceSeries.prototype.dh = function (a, b) {
        if (this.dk(a, b)) {
            return true;
        }
        return false;
    };
    FinancialPriceSeries.prototype.dk = function (a, b) {
        var c = this.lv(a);
        if (c.isEmpty) {
            return false;
        }
        var d = RectUtil.r(c, (this.ey / 2) + this.ee(b));
        if (d.containsPoint(a)) {
            var e = this.al(a);
            if (e != null) {
                for (var f = 0; f < e.length; f++) {
                    var g = e[f];
                    var h = RectUtil.r(g, (this.ey / 2) + this.ee(b));
                    if (h.containsPoint(a)) {
                        return true;
                    }
                }
            }
        }
        return false;
    };
    FinancialPriceSeries.prototype.iz = function (a, b, c, d) {
        switch (b) {
            case FinancialSeries.$$p[9]:
                this.pj.ca();
                break;
            case "TrendLineType":
                var e = EnumUtil.getEnumValue(TrendLineType_$type, d);
                if (e != 0) {
                    this.pj.b2 = CategoryTrendLineManagerFactory.a(this.pj.b2, this.l8, this.jx, this, this.b2);
                }
                break;
        }
        _super.prototype.iz.call(this, a, b, c, d);
        if (this.pj.b4 && this.pj.b2 != null && this.pj.b2.g$b(a, b, c, d)) {
            this.jd(false);
            this.ik();
        }
        switch (b) {
            case FinancialPriceSeries.$$p[0]:
                if (this.jx != null) {
                    this.ps();
                    this.ma.w();
                    this.o1(this.ma, this.pj);
                }
                this.ik();
                break;
            case "TrendLineBrush":
                this.jo();
                break;
            case "TrendLineType":
                this.ik();
                break;
            case FinancialSeries.$$p[5]:
            case FinancialPriceSeries.$$p[1]:
                this.iw();
                break;
        }
    };
    FinancialPriceSeries.prototype.ps = function () {
        this.pj.ce();
        if (this.bh != null) {
            this.bh.ce();
        }
    };
    FinancialPriceSeries.prototype.an = function (a) {
        if (a != null && a == this.mt && this.m0 != null && !isNaN_(this.m0.minimum) && this.my != null && !isNaN_(this.my.maximum)) {
            return new AxisRange(this.m0.minimum, this.my.maximum);
        }
        return null;
    };
    FinancialPriceSeries.prototype.ao = function () {
        if (this.m0 == null || this.my == null) {
            return null;
        }
        var a = new ScalerParams(0, this.bs.mq, this.bs.m3, this.l8.b8, this.getEffectiveViewport());
        var b = (this.l8.dz(this.bs.m3.left, a));
        var c = (this.l8.dz(this.bs.m3.right, a));
        var d = null;
        if (this.l8.cd) {
            d = this.l8;
            b = d.i$f(b);
            c = d.i$f(c);
        }
        else {
            b = Math.floor(b);
            c = Math.ceil(c);
        }
        b = Math.max(0, Math.min(this.m0.count - 1, b));
        c = Math.max(0, Math.min(this.m0.count - 1, c));
        var e = 1.7976931348623157E+308;
        var f = -1.7976931348623157E+308;
        for (var g = truncate(b); g <= truncate(c); g++) {
            var h = g;
            if (d != null) {
                h = d.i$b._inner[g];
            }
            e = Math.min(e, this.m0.item(h));
            f = Math.max(f, this.my.item(h));
        }
        return new AxisRange(e, f);
    };
    FinancialPriceSeries.prototype.eh = function () {
        return Series.ei(this.m2, typeCast(ISortingAxis_$type, this.l8));
    };
    FinancialPriceSeries.prototype.c9 = function (a) {
        var b = this.bz != null ? this.bz.indexOf(a) : -1;
        var c = this.bi.bs;
        c = c.copy();
        var d = this.bi.br;
        var e = new Rect(0, 0, 0, 1, 1);
        var f = this.ls(this.bi);
        if (b >= 0 && Rect.l_op_Inequality(c, null) && Rect.l_op_Inequality(d, null)) {
            if (this.l8 != null) {
                var g = new ScalerParams(0, e, e, this.l8.b8, f);
                var h = this.l8.dw(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.mt != null && this.m0 != null && this.my != null && b < this.m0.count && b < this.my.count) {
                var i = new ScalerParams(0, e, e, this.mt.b8, f);
                i.b = this.eh();
                var j = this.mt.dw(this.m0.item(b), i);
                var k = this.mt.dw(this.my.item(b), i);
                if (!isNaN_(j) && !isNaN_(k)) {
                    var l = Math.abs(j - k);
                    if (c.height < l) {
                        c.height = l;
                        c.y = Math.min(j, k);
                    }
                    else {
                        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.bn.ap(this.bs, c, true);
        }
        return b >= 0;
    };
    FinancialPriceSeries.prototype.dw = function (a, b, c) {
        var d = _super.prototype.dw.call(this, a, b, c);
        if (this.m2 == null || this.mw == null || this.my == null || this.m0 == null) {
            d = false;
        }
        return d;
    };
    FinancialPriceSeries.prototype.oz = function (a, b) {
        var e_1, _a;
        var _this = this;
        _super.prototype.oz.call(this, a, b);
        var c = b.bs;
        var d = b.br;
        var e = this.getEffectiveViewport1(b);
        var f = this.l8;
        var g = this.mt;
        var h = new ScalerParams(0, c, d, f.b8, e);
        var i = ((function () {
            var $ret = new ScalerParams(0, c, d, g.b8, e);
            $ret.b = _this.eh();
            return $ret;
        })());
        a.f.clear();
        a.m.clear();
        a.p.clear();
        var j = 0;
        var k = typeCast(ISortingAxis_$type, this.l8);
        if (k != null && (k.i$b == null || k.i$b.count != this.bz.count)) {
            return;
        }
        j = this.nz(c, d, e);
        var l = typeCast(FinancialPriceSeriesView.$, b);
        var m = this.eu;
        if (this.trendLineType != 0) {
            var n = new Array(this.bz.count);
            var o = 0;
            try {
                for (var _b = tslib_1.__values(fromEnum(this.nq)), _c = _b.next(); !_c.done; _c = _b.next()) {
                    var p = _c.value;
                    n[o] = p;
                    o++;
                }
            }
            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; }
            }
            if (this.pj.b4) {
                this.pj.b2.prepareLineCore(a.p, this.trendLineType, boxArray$1(n), this.trendLinePeriod, function (q) { return _this.l8.dw(q, h); }, function (q) { return _this.mt.dw(q, i); }, ((function () {
                    var $ret = new TrendResolutionParams();
                    $ret.c = b.bu.b;
                    $ret.d = b.bu.c;
                    $ret.e = b.bu.d;
                    $ret.a = j;
                    $ret.b = m;
                    $ret.f = d;
                    return $ret;
                })()));
            }
        }
        var q = this.l8.dz(2, h) - this.l8.dz(1, h);
        for (var r = b.bu.c; r <= b.bu.d; ++r) {
            var s = void 0;
            if (k == null) {
                s = b.bu.getBucket(r);
            }
            else {
                var t = k.i$b._inner[r];
                var u = k.i$d(t);
                var v = this.m2.item(t);
                var w = this.my.item(t);
                var x = this.m0.item(t);
                var y = this.mw.item(t);
                var z = v;
                var aa = w;
                var ab = x;
                var ac = y;
                var ad = u;
                while (r < b.bu.d) {
                    t = k.i$b._inner[r + 1];
                    ad = k.i$d(t);
                    if (ad - u > q * m) {
                        break;
                    }
                    r++;
                    aa = Math.max(aa, this.my.item(t));
                    ab = Math.min(ab, this.m0.item(t));
                    ac = this.mw.item(t);
                }
                var ae = NaN;
                if (!isNaN_(u)) {
                    ae = this.l8.dw(u, h);
                }
                s = [ae, z, aa, ab, ac];
            }
            if (!isNaN_(s[0])) {
                if (k != null) {
                    s[0] = s[0] + j;
                }
                else {
                    s[0] = f.dw(s[0], h) + j;
                }
                s[1] = g.dw(s[1], i);
                s[2] = g.dw(s[2], i);
                s[3] = g.dw(s[3], i);
                s[4] = g.dw(s[4], i);
                a.f.add(s);
            }
        }
        return;
    };
    FinancialPriceSeries.prototype.hv = function (a, b) {
        _super.prototype.hv.call(this, a, b);
        var c = typeCast(FinancialPriceSeriesView.$, b);
        c.b8();
        if (a) {
            c.b3.count = 0;
        }
        if (c.b4 && c.b2 != null) {
            c.b2.g$d();
        }
    };
    FinancialPriceSeries.prototype.get_nc = function () {
        return true;
    };
    FinancialPriceSeries.prototype.o1 = function (a, b) {
        _super.prototype.o1.call(this, a, b);
        if (this.l8 == null || this.mt == null) {
            return;
        }
        var c = false;
        if (b.bx(a)) {
            c = true;
            b.bz(a);
        }
        this.mg.x(this, this.ng(), this.l8, runOn(this, this.l0), this.n5(b), this.n7(b));
        var d = false;
        var e = this.mg.c;
        if (e != null) {
            d = true;
        }
        var f = typeCast(FinancialPriceSeriesView.$, b);
        f.b7();
        f.b5 = false;
        if (f.b4) {
            f.b2.g$d();
        }
        if (this.trendLineType != 0) {
            f.b2.g$g(a.p);
        }
        if (d) {
            this.pr(a, b, c);
        }
        else {
            f.b3.count = 0;
            this.pq(a, b);
        }
    };
    FinancialPriceSeries.prototype.eg = function () {
        var a = this.getEffectiveViewport1(this.bi);
        return this.pl(this.mo, a);
    };
    FinancialPriceSeries.prototype.pr = function (a, b, c) {
        var d = this.pk;
        var e = this.getEffectiveViewport1(b);
        var f = this.pl(b, e);
        var g = (f - 1) / 2;
        var h = typeCast(FinancialPriceSeriesView.$, b);
        h.b5 = true;
        var i = a.f;
        var j = 0;
        var k = this.bz.count;
        var l = this.l8;
        var m = new ScalerParams(0, b.bs, b.br, l.b8, e);
        var n = this.k3;
        var o = this.pe;
        if (o == null) {
            o = n;
        }
        var p = this.k4;
        var q = this.p4;
        if (q == null) {
            q = p;
        }
        var _loop_1 = function (r) {
            var s = i._inner[r][0] - g;
            var t = i._inner[r][0];
            var u = i._inner[r][0] + g;
            var v = i._inner[r][1];
            var w = i._inner[r][2];
            var x = i._inner[r][3];
            var y = i._inner[r][4];
            if (isNaN_(v) || isNaN_(w) || isNaN_(x) || isNaN_(y)) {
                return "continue";
            }
            var z = h.b3.item(j);
            j++;
            var aa = v < y;
            var ab = new PathGeometry();
            if (c) {
                switch (d) {
                    case 0:
                        if (aa) {
                            var ac = v;
                            v = y;
                            y = ac;
                        }
                        var ad = new PathFigure();
                        ad._startPoint = { $type: Point_$type, x: t, y: x };
                        ad._segments.add(((function () {
                            var $ret = new LineSegment(1);
                            $ret.c = { $type: Point_$type, x: t, y: v };
                            return $ret;
                        })()));
                        var ae = new PathFigure();
                        ae._startPoint = { $type: Point_$type, x: s, y: y };
                        ae._segments.add(((function () {
                            var $ret = new LineSegment(1);
                            $ret.c = { $type: Point_$type, x: u, y: y };
                            return $ret;
                        })()));
                        ae._segments.add(((function () {
                            var $ret = new LineSegment(1);
                            $ret.c = { $type: Point_$type, x: u, y: v };
                            return $ret;
                        })()));
                        ae._segments.add(((function () {
                            var $ret = new LineSegment(1);
                            $ret.c = { $type: Point_$type, x: s, y: v };
                            return $ret;
                        })()));
                        ae._segments.add(((function () {
                            var $ret = new LineSegment(1);
                            $ret.c = { $type: Point_$type, x: s, y: y };
                            return $ret;
                        })()));
                        var af = new PathFigure();
                        af._startPoint = { $type: Point_$type, x: t, y: y };
                        af._segments.add(((function () {
                            var $ret = new LineSegment(1);
                            $ret.c = { $type: Point_$type, x: t, y: w };
                            return $ret;
                        })()));
                        ab.c.add(ad);
                        ab.c.add(ae);
                        ab.c.add(af);
                        break;
                    case 1:
                        var ag = new PathFigure();
                        ag._startPoint = { $type: Point_$type, x: s, y: v };
                        ag._segments.add(((function () {
                            var $ret = new LineSegment(1);
                            $ret.c = { $type: Point_$type, x: t, y: v };
                            return $ret;
                        })()));
                        var ah = new PathFigure();
                        ah._startPoint = { $type: Point_$type, x: t, y: x };
                        ah._segments.add(((function () {
                            var $ret = new LineSegment(1);
                            $ret.c = { $type: Point_$type, x: t, y: w };
                            return $ret;
                        })()));
                        var ai = new PathFigure();
                        ai._startPoint = { $type: Point_$type, x: t, y: y };
                        ai._segments.add(((function () {
                            var $ret = new LineSegment(1);
                            $ret.c = { $type: Point_$type, x: u, y: y };
                            return $ret;
                        })()));
                        ab.c.add(ag);
                        ab.c.add(ah);
                        ab.c.add(ai);
                        break;
                }
            }
            if (aa) {
                this_1.mg.al = o;
                this_1.mg.ah = o;
                this_1.mg.am = this_1.mg.ai = q;
                this_1.mg.f = true;
            }
            else {
                this_1.mg.al = n;
                this_1.mg.ah = n;
                this_1.mg.am = this_1.mg.ai = p;
                this_1.mg.f = false;
            }
            this_1.oy(i, r, k, l, m, b.n);
            if (d == 1) {
                this_1.mg.ae(z, true, false, false, false);
            }
            else {
                this_1.mg.ae(z, false, false, false, false);
            }
            if (c) {
                z.ak = ab;
            }
        };
        var this_1 = this;
        for (var r = 0; r < i.count; ++r) {
            _loop_1(r);
        }
        h.b3.count = j;
        h.b9();
    };
    FinancialPriceSeries.prototype.pl = function (a, b) {
        var c = this.l8.jr(a.bs, a.br, b);
        c = Math.max(c, this.eu * 0.9);
        c = Math.max(c, 3);
        return c;
    };
    FinancialPriceSeries.prototype.pq = function (a, b) {
        var c = this.pk;
        var d = this.getEffectiveViewport1(b);
        var e = this.pl(b, d);
        var f = (e - 1) / 2;
        var g = typeCast(FinancialPriceSeriesView.$, b);
        var h = g.ch();
        var i = g.cg();
        var j = a.f;
        var _loop_2 = function (k) {
            var l = j._inner[k][0] - f;
            var m = j._inner[k][0];
            var n = j._inner[k][0] + f;
            var o = j._inner[k][1];
            var p = j._inner[k][2];
            var q = j._inner[k][3];
            var r = j._inner[k][4];
            if (isNaN_(o) || isNaN_(p) || isNaN_(q) || isNaN_(r)) {
                return "continue";
            }
            var s = o < r;
            var t = s ? i : h;
            switch (c) {
                case 0:
                    if (s) {
                        var u = o;
                        o = r;
                        r = u;
                    }
                    t.d.add(((function () {
                        var $ret = new LineGeometry();
                        $ret.d = { $type: Point_$type, x: m, y: q };
                        $ret.c = { $type: Point_$type, x: m, y: o };
                        return $ret;
                    })()));
                    t.d.add(((function () {
                        var $ret = new RectangleGeometry();
                        $ret.e = new Rect(0, l, r, n - l, o - r);
                        return $ret;
                    })()));
                    t.d.add(((function () {
                        var $ret = new LineGeometry();
                        $ret.d = { $type: Point_$type, x: m, y: r };
                        $ret.c = { $type: Point_$type, x: m, y: p };
                        return $ret;
                    })()));
                    break;
                case 1:
                    t.d.add(((function () {
                        var $ret = new LineGeometry();
                        $ret.d = { $type: Point_$type, x: l, y: o };
                        $ret.c = { $type: Point_$type, x: m, y: o };
                        return $ret;
                    })()));
                    t.d.add(((function () {
                        var $ret = new LineGeometry();
                        $ret.d = { $type: Point_$type, x: m, y: q };
                        $ret.c = { $type: Point_$type, x: m, y: p };
                        return $ret;
                    })()));
                    t.d.add(((function () {
                        var $ret = new LineGeometry();
                        $ret.d = { $type: Point_$type, x: m, y: r };
                        $ret.c = { $type: Point_$type, x: n, y: r };
                        return $ret;
                    })()));
                    break;
            }
        };
        for (var k = 0; k < j.count; ++k) {
            _loop_2(k);
        }
    };
    FinancialPriceSeries.prototype.fv = function (a, b) {
        if (this.pj.b4 && a == this.pj.b2.g$j) {
            return null;
        }
        return _super.prototype.fv.call(this, a, b);
    };
    FinancialPriceSeries.prototype.jo = function () {
        _super.prototype.jo.call(this);
        if (this.fh < 0) {
            return;
        }
        this.pj.cf();
    };
    FinancialPriceSeries.prototype.h4 = function (a) {
        _super.prototype.h4.call(this, a);
        if (this.pj.b4) {
            this.a2.exportTrendlineData(this, a, this.pj.b2.g$j);
        }
    };
    FinancialPriceSeries.prototype.ji = function (a, b) {
        _super.prototype.ji.call(this, a, b);
        this.p4 = b;
    };
    FinancialPriceSeries.$t = markType(FinancialPriceSeries, 'FinancialPriceSeries', FinancialSeries.$, [ITrendLineSeries_$type]);
    FinancialPriceSeries.pt = DependencyProperty.i("ActualTrendLineBrush", Brush.$, FinancialPriceSeries.$, new PropertyMetadata(2, null, function (a, b) { return a.raisePropertyChanged("ActualTrendLineBrush", b.oldValue, b.newValue); }));
    FinancialPriceSeries.$$p = markDep(DependencyProperty, PropertyMetadata, FinancialPriceSeries, 'raisePropertyChanged', ['DisplayType:pk:pu', [PriceDisplayType_$type, enumGetBox(PriceDisplayType_$type, 0)], 'NegativeOutline:p4:pv', [Brush.$, null], 'TrendLineType::p1', [TrendLineType_$type, enumGetBox(TrendLineType_$type, 0)], 'TrendLineThickness::p0', [1, 1.5], 'TrendLinePeriod::pz', [1, 7], 'TrendLineBrush::pw', [Brush.$, null], 'TrendLineZIndex:pn:p2', [1, 1001], 'TrendLineDashArray:p5:px', [DoubleCollection.$], 'TrendLineDashCap:p6:py', [PenLineCap_$type, enumGetBox(PenLineCap_$type, 0)]]);
    return FinancialPriceSeries;
}(FinancialSeries));
export { FinancialPriceSeries };
/**
 * @hidden
 */
var FinancialPriceSeriesView = /** @class */ (function (_super) {
    tslib_1.__extends(FinancialPriceSeriesView, _super);
    function FinancialPriceSeriesView(a) {
        var _this = _super.call(this, a) || this;
        _this.b0 = null;
        _this.b3 = null;
        _this.b6 = null;
        _this.ck = ((function () {
            var $ret = new Path();
            $ret.ak = new GeometryGroup();
            return $ret;
        })());
        _this.cj = ((function () {
            var $ret = new Path();
            $ret.ak = new GeometryGroup();
            return $ret;
        })());
        _this.b1 = null;
        _this.ci = new Path();
        _this.b5 = false;
        _this.b0 = a;
        _this.b6 = new List$1(Path.$, 0);
        _this.b3 = ((function () {
            var $ret = new Pool$1(Path.$);
            $ret.create = runOn(_this, _this.cl);
            $ret.activate = runOn(_this, _this.cb);
            $ret.disactivate = runOn(_this, _this.cd);
            $ret.destroy = runOn(_this, _this.cc);
            return $ret;
        })());
        return _this;
    }
    FinancialPriceSeriesView.prototype.cl = function () {
        var a = new Path();
        this.b6.add(a);
        a._visibility = 1;
        return a;
    };
    FinancialPriceSeriesView.prototype.cb = function (a) {
        a._visibility = 0;
    };
    FinancialPriceSeriesView.prototype.cd = function (a) {
        a._visibility = 1;
    };
    FinancialPriceSeriesView.prototype.cc = function (a) {
        this.b6.remove(a);
    };
    FinancialPriceSeriesView.prototype.bv = function () {
        return new FinancialPriceBucketCalculator(this);
    };
    FinancialPriceSeriesView.prototype.ap = function () {
        _super.prototype.ap.call(this);
        if (!this.n) {
            this.bw.pe = ((function () {
                var $ret = new Brush();
                $ret.fill = "#C62828";
                return $ret;
            })());
            this.b0.p4 = this.bw.pe;
            this.bw.eu = 5;
            this.bw.ey = 1;
        }
    };
    Object.defineProperty(FinancialPriceSeriesView.prototype, "b2", {
        get: function () {
            if (this.b1 == null) {
                this.b1 = CategoryTrendLineManagerFactory.a(this.b1, this.e.ap(), this.e.jx, this.e, this.e.b2);
            }
            return this.b1;
        },
        set: function (a) {
            this.b1 = a;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FinancialPriceSeriesView.prototype, "b4", {
        get: function () {
            return this.b1 != null;
        },
        enumerable: true,
        configurable: true
    });
    FinancialPriceSeriesView.prototype.ce = function () {
        if (this.b0.pk == 1) {
            this.ck._stroke = this.e.k3;
        }
        else {
            this.ck._stroke = this.e.k4;
        }
        if (this.b0.pk == 1) {
            this.cj._stroke = this.bw.pe;
        }
        else {
            this.cj._stroke = this.b0.p4;
        }
    };
    FinancialPriceSeriesView.prototype.b8 = function () {
        this.an();
        this.b3.count = 0;
        this.b7();
    };
    FinancialPriceSeriesView.prototype.b7 = function () {
        var a = typeCast(GeometryGroup.$, this.ck.ak);
        var b = typeCast(GeometryGroup.$, this.cj.ak);
        Extensions.d(a);
        Extensions.d(b);
    };
    FinancialPriceSeriesView.prototype.ch = function () {
        this.an();
        return typeCast(GeometryGroup.$, this.ck.ak);
    };
    FinancialPriceSeriesView.prototype.cg = function () {
        this.an();
        return typeCast(GeometryGroup.$, this.cj.ak);
    };
    FinancialPriceSeriesView.prototype.cf = function () {
        this.b0.p3 = null;
        if (this.b0.trendLineBrush != null) {
            this.b0.p3 = this.b0.trendLineBrush;
        }
        else {
            this.b0.p3 = this.b0.k3;
        }
    };
    FinancialPriceSeriesView.prototype.a8 = function () {
        _super.prototype.a8.call(this);
        this.ck.ac = this.e.ey;
        this.ck.ai = this.e.lb;
        this.ck.ad = this.e.lc;
        if (this.b0.pk == 1) {
            this.ck._stroke = this.e.k3;
        }
        else {
            this.ck._stroke = this.e.k4;
            this.ck._fill = this.e.k3;
        }
        this.cj.ac = this.e.ey;
        this.cj.ai = this.e.lb;
        this.cj.ad = this.e.lc;
        if (this.b0.pk == 1) {
            this.cj._stroke = this.bw.pe;
        }
        else {
            this.cj._stroke = this.b0.p4;
            this.cj._fill = this.bw.pe;
        }
    };
    FinancialPriceSeriesView.prototype.a9 = function () {
        _super.prototype.a9.call(this);
        var a = this.bl();
        this.ck.ac = this.e.ey + 3;
        if (this.b0.pk == 1) {
            this.ck._stroke = a;
        }
        else {
            this.ck._stroke = a;
            this.ck._fill = a;
        }
        this.cj.ac = this.e.ey + 3;
        if (this.b0.pk == 1) {
            this.cj._stroke = a;
        }
        else {
            this.cj._stroke = a;
            this.cj._fill = a;
        }
    };
    FinancialPriceSeriesView.prototype.z = function (a) {
        return this.b6._inner[a];
    };
    FinancialPriceSeriesView.prototype.y = function (a) {
        var b = this.b6._inner[a];
        this.ci._visibility = b._visibility;
        this.ci.ak = b.ak;
        var c = this.bm(a);
        this.ci._fill = c;
        this.ci._stroke = c;
        this.ci.ac = this.e.ey + 3;
        return this.ci;
    };
    FinancialPriceSeriesView.prototype.a3 = function (a, b) {
        _super.prototype.a3.call(this, a, b);
        if (a.d) {
            if (this.b5) {
                for (var c = 0; c < this.b6.count; c++) {
                    var d = this.x(c, b);
                    if (d._visibility == 0) {
                        a.s(d);
                    }
                }
            }
            else {
                a.s(this.ck);
                a.s(this.cj);
            }
        }
    };
    FinancialPriceSeriesView.prototype.a2 = function (a, b) {
        if (a.d) {
            if (this.b0.trendLineType != 0 && !b) {
                var c = this.b2.g$j;
                c.ac = this.b0.trendLineThickness;
                c._stroke = this.b0.p3;
                c.ai = this.b0.p5;
                c.ad = this.b0.p6;
                a.u(c);
            }
        }
        _super.prototype.a2.call(this, a, b);
    };
    FinancialPriceSeriesView.prototype.ai = function (a) {
        _super.prototype.ai.call(this, a);
        this.e.a2.exportPathData(a, this.ck, "positivePathShape", ["Positive", "Main"]);
        this.e.a2.exportPathData(a, this.cj, "negativePathShape", ["Negative"]);
    };
    FinancialPriceSeriesView.prototype.b9 = function () {
        this.an();
    };
    FinancialPriceSeriesView.prototype.ca = function () {
        if (this.b4) {
            this.b1 = CategoryTrendLineManagerFactory.a(this.b1, this.e.ap(), this.e.jx, this.e, this.e.b2);
        }
    };
    FinancialPriceSeriesView.$t = markType(FinancialPriceSeriesView, 'FinancialPriceSeriesView', FinancialSeriesView.$);
    return FinancialPriceSeriesView;
}(FinancialSeriesView));
export { FinancialPriceSeriesView };
//# sourceMappingURL=FinancialPriceSeries_combined.js.map