/*
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 { Series } from "./Series";
import { DependencyProperty } from "igniteui-react-core";
import { IEnumerable$1_$type, typeCast, Point_$type, fromEnum, Array_$type, Number_$type, markType, markDep, runOn } from "igniteui-react-core";
import { NumericXAxis } from "./NumericXAxis";
import { NumericYAxis } from "./NumericYAxis";
import { List$1 } from "igniteui-react-core";
import { Rect } from "igniteui-react-core";
import { IFastItemsSource_$type } from "igniteui-react-core";
import { PointCollectionUtil } from "igniteui-react-core";
import { FlattenedShape } from "./FlattenedShape";
import { SeriesView } from "./SeriesView";
import { Clipper } from "igniteui-react-core";
import { ScalerParams } from "./ScalerParams";
import { Dictionary$2 } from "igniteui-react-core";
import { Tuple$2 } from "igniteui-react-core";
import { PolySimplification } from "igniteui-react-core";
import { DefaultFlattener } from "./DefaultFlattener";
import { DataContext } from "igniteui-react-core";
import { FrameworkElement } from "igniteui-react-core";
import { AxisRange } from "./AxisRange";
import { Style } from "igniteui-react-core";
import { StyleShapeEventArgs } from "./StyleShapeEventArgs";
import { PropertyMetadata } from "igniteui-react-core";
import { boxArray$1 } from "igniteui-react-core";
import { InvalidOperationException } from "igniteui-react-core";
import { isNaN_, truncate } from "igniteui-react-core";
import { FastItemObjectColumn } from "igniteui-react-core";
import { Path } from "igniteui-react-core";
import { Pool$1 } from "igniteui-react-core";
import { ShapeHitRegion } from "./ShapeHitRegion";
import { PointCollection } from "igniteui-react-core";
import { PathGeometry } from "igniteui-react-core";
import { PolyLineSegment } from "igniteui-react-core";
import { PathFigure } from "igniteui-react-core";
import { GeometryUtil } from "igniteui-react-core";
import { PolygonUtil } from "igniteui-react-core";
import { RectUtil } from "igniteui-react-core";
/**
 * @hidden
 */
var ShapeSeriesBase = /** @class */ /*@__PURE__*/ (function (_super) {
    tslib_1.__extends(ShapeSeriesBase, _super);
    function ShapeSeriesBase() {
        var _this = _super.call(this) || this;
        _this.mk = null;
        _this.mf = null;
        _this.mh = null;
        _this.mx = 0;
        _this.mt = null;
        _this.mb = null;
        _this.md = null;
        _this.mc = null;
        _this.ma = null;
        _this.nj = null;
        _this.mz = 0;
        _this.styleShape = null;
        FastItemObjectColumn.m();
        _this.mz = _this.my;
        _this.nj = Rect.empty;
        return _this;
    }
    ShapeSeriesBase.prototype.h1 = function () {
        _super.prototype.h1.call(this);
        this.mg = null;
        this.mi = null;
    };
    ShapeSeriesBase.prototype.ag = function () {
        return [this.mg, this.mi];
    };
    ShapeSeriesBase.prototype.fs = function (a, b) {
        var c = this.g2(b);
        if (c == ShapeSeriesBase.$$p[1]) {
            return this.ft(a, b, this.m4);
        }
        return null;
    };
    Object.defineProperty(ShapeSeriesBase.prototype, "ml", {
        get: function () {
            return this.mk;
        },
        set: function (a) {
            var b = this.ml != a;
            if (b) {
                var c = this.ml;
                this.mk = a;
                this.raisePropertyChanged("ShapeColumn", c, this.ml);
            }
        },
        enumerable: true,
        configurable: true
    });
    ShapeSeriesBase.prototype.mo = function (array_) {
        var a = (Array.isArray(array_));
        return a;
    };
    ShapeSeriesBase.mq = function (a) {
        if (a == null) {
            return true;
        }
        var val_ = a;
        return (val_ == undefined);
    };
    ShapeSeriesBase.prototype.convertToListList = function (a) {
        if (a == null) {
            return null;
        }
        var b = new List$1(List$1.$.specialize(Point_$type), 0);
        var c;
        var curr_;
        var d;
        var e;
        var f = false;
        var g = false;
        for (var h = 0; h < a.length; h++) {
            c = a[h];
            if (c == null) {
                continue;
            }
            var i = new List$1(Point_$type, 0);
            for (var j = 0; j < c.length; j++) {
                curr_ = c[j];
                if (f) {
                    d = (curr_.X);
                    e = (curr_.Y);
                }
                else {
                    d = (curr_.x);
                    e = (curr_.y);
                }
                if (!g) {
                    if ((isNaN_(d) || ShapeSeriesBase.mq(d)) && (isNaN_(e) || ShapeSeriesBase.mq(e))) {
                        d = (curr_.X);
                        e = (curr_.Y);
                        if (!isNaN_(d) && !ShapeSeriesBase.mq(d) && !isNaN_(e) && !ShapeSeriesBase.mq(e)) {
                            g = true;
                            f = true;
                        }
                    }
                    else {
                        g = true;
                    }
                }
                i.add({ $type: Point_$type, x: d, y: e });
            }
            b.add(i);
        }
        return b;
    };
    ShapeSeriesBase.prototype.by = function (a) {
        if (this.bz != null && this.mo(this.itemsSource) && a != null && a.split('!').length != 2) {
            if (this.coercionMethods == null) {
                this.coercionMethods = {};
            }
            var methods_ = this.coercionMethods;
            methods_.convertToListList = this.convertToListList;
            a += "!convertToListList";
        }
        return _super.prototype.by.call(this, a);
    };
    ShapeSeriesBase.prototype.i7 = function (a, b, c, d) {
        _super.prototype.i7.call(this, a, b, c, d);
        var e = false;
        var f = false;
        switch (b) {
            case "FastItemsSource":
                var g = typeCast(IFastItemsSource_$type, c);
                if (g != null) {
                    g.deregisterColumn(this.ml);
                    this.ml = null;
                }
                var h = typeCast(IFastItemsSource_$type, d);
                if (h != null) {
                    this.ml = this.by(this.m4);
                }
                e = this.mg != null && !this.mg.cn();
                f = this.mi != null && !this.mi.cn();
                if (e || f) {
                    this.jl(false);
                }
                break;
            case ShapeSeriesBase.$$p[1]:
                if (this.bz != null) {
                    this.bz.deregisterColumn(this.ml);
                    this.ml = this.by(this.m4);
                }
                break;
            case "ShapeColumn":
                this.nc();
                e = this.mg != null && !this.mg.cn();
                f = this.mi != null && !this.mi.cn();
                if (e || f) {
                    this.jl(false);
                }
                this.it();
                break;
            case ShapeSeriesBase.$$p[2]:
            case ShapeSeriesBase.$$p[3]:
                this.mf = this.mg;
                this.mh = this.mi;
                var i = c;
                var j = d;
                this.nd(i);
                this.m9(j);
                if ((j != null && !j.cn()) || (j == null && i != null)) {
                    this.jl(false);
                }
                this.it();
                break;
            case "Resolution":
                this.mx = this.eu;
                this.it();
                break;
            case "ActualBrush":
                this.jl(false);
                break;
            case ShapeSeriesBase.$$p[0]:
                this.mz = this.my;
                this.jl(false);
                this.it();
                break;
            case "Thickness":
                this.jl(false);
                this.it();
                break;
        }
    };
    ShapeSeriesBase.prototype.mn = function (a) {
        if (typeCast(NumericYAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    ShapeSeriesBase.prototype.mm = function (a) {
        if (typeCast(NumericXAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    ShapeSeriesBase.prototype.nc = function () {
        this.mt = null;
        if (this.ml == null) {
            return;
        }
        this.mt = new List$1(Rect.$, 2, this.ml.count);
        for (var a = 0; a < this.ml.count; a++) {
            this.mt.add(PointCollectionUtil.j(this.ml.item(a)));
        }
    };
    ShapeSeriesBase.prototype.nk = function (a) {
        if (typeCast(IEnumerable$1_$type.specialize(IEnumerable$1_$type.specialize(Point_$type)), a) !== null) {
            return PointCollectionUtil.h(a);
        }
        else if (typeCast(IEnumerable$1_$type.specialize(Point_$type), a) !== null) {
            return PointCollectionUtil.g(a);
        }
        return Rect.empty;
    };
    ShapeSeriesBase.prototype.mv = function (a, b, c, d, e, f, g) {
        var e_1, _a;
        return this.mw(a, b, c, d, e, f, g);
        if (typeCast(List$1.$.specialize(List$1.$.specialize(Point_$type)), c) !== null) {
            return this.mw(a, b, c, d, e, f, g);
        }
        else if (typeCast(IEnumerable$1_$type.specialize(IEnumerable$1_$type.specialize(Point_$type)), c) !== null) {
            var h = c;
            var i = new List$1(FlattenedShape.$, 0);
            var j = null;
            try {
                for (var _b = tslib_1.__values(fromEnum(h)), _c = _b.next(); !_c.done; _c = _b.next()) {
                    var k = _c.value;
                    j = this.me(a, b, PointCollectionUtil.b(k), d, e, f, g);
                    if (j == null) {
                        continue;
                    }
                    i.add(j);
                }
            }
            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;
                }
            }
            return i;
        }
        else if (typeCast(IEnumerable$1_$type.specialize(Point_$type), c) !== null) {
            var l = c;
            var m = this.me(a, b, PointCollectionUtil.b(l), d, e, f, g);
            var n = new List$1(FlattenedShape.$, 0);
            if (m != null) {
                n.add(m);
            }
            return n;
        }
        else {
            throw new InvalidOperationException(1, "Unrecognized data in ShapeColumn");
        }
    };
    ShapeSeriesBase.prototype.get_mp = function () {
        return true;
    };
    Object.defineProperty(ShapeSeriesBase.prototype, "mp", {
        get: function () {
            return this.get_mp();
        },
        enumerable: true,
        configurable: true
    });
    ShapeSeriesBase.prototype.ms = function () {
        return false;
    };
    ShapeSeriesBase.prototype.jm = function (a) {
        this.nb(this.bi);
    };
    ShapeSeriesBase.prototype.jk = function (a, b, c, d, e) {
        _super.prototype.jk.call(this, a, b, c, d, e);
        var f = this.a0.a$h.item(d);
        var g = f;
        f.ay(c);
        if (this.cc(f)) {
            return;
        }
        this.nb(f);
    };
    ShapeSeriesBase.prototype.nb = function (a) {
        if (this.cc(a)) {
            return;
        }
        var b;
        var c;
        var d = a;
        var e = a.getViewInfo(c, b);
        c = e.p0;
        b = e.p1;
        if (c.width < 1 || c.height < 1 || this.ml == null) {
            return;
        }
        var f = this.mg;
        var g = this.mi;
        var h = this.getEffectiveViewport1(a);
        var i = new ScalerParams(1, b, c, f.ca);
        i.c = h;
        var j = new ScalerParams(1, b, c, g.ca);
        j.c = h;
        d.cj();
        var k = new Rect(0, 0, 0, 0, 0);
        var l;
        var m;
        var n;
        var o;
        var p = this.ml.count;
        if (this.md == null || this.md.length != p) {
            this.md = new Array(p);
            this.mb = new Array(p);
            this.mc = new Array(p);
            this.ma = new Array(p);
        }
        var q = this.md;
        var r = this.mb;
        var s = this.mc;
        var t = this.ma;
        var u;
        for (var v = 0; v < p; v++) {
            u = this.mt._inner[v];
            q[v] = u.top;
            r[v] = u.left;
            s[v] = u.right;
            t[v] = u.bottom;
        }
        this.mf.gs(boxArray$1(r), 0, r.length, i);
        this.mf.gs(boxArray$1(s), 0, s.length, i);
        this.mh.gs(boxArray$1(q), 0, q.length, j);
        this.mh.gs(boxArray$1(t), 0, t.length, j);
        d.ck(r, q, s, t);
        var w = this.ml;
        var x = this.bz;
        this.ne(d);
        var y = c.left;
        var z = c.right;
        var aa = c.top;
        var ab = c.bottom;
        var ac = null;
        if (this.nj.isEmpty) {
            ac = null;
        }
        else {
            ac = new Clipper(1, this.nj.left, this.nj.bottom, this.nj.right, this.nj.top, this.mp);
        }
        var ad = this.ms();
        if (ad) {
            d.b3.clear();
        }
        var ae = false;
        var af = true;
        var ag = 0;
        if (this.bs != null) {
            if (this.bs.d1()) {
                var ah = this.bs.h4(b, i);
                ae = ah.c;
                ag = ah.d;
            }
        }
        var ai;
        for (var aj = 0; aj < p; aj++) {
            n = r[aj];
            l = q[aj];
            m = t[aj];
            o = s[aj];
            k.x = Math.min(n, o);
            k.y = Math.min(l, m);
            k.width = Math.max(n, o) - k.x;
            k.height = Math.max(l, m) - k.y;
            if (k.intersectsWith(c)) {
                if (k.x < y || k.y < aa || k.x > z || k.y > ab) {
                    ai = ac;
                }
                else {
                    ai = null;
                }
                var ak = this.mv(a, ai, w.item(aj), i, j, 0, ag);
                if (ad) {
                    ShapeSeriesBase.na(d, aj, ak);
                }
                d.b8(aj, x.item(aj), k, ak);
            }
            else if (ae) {
                k.x = k.x + ag;
                if (k.intersectsWith(c)) {
                    if (k.x < y || k.y < aa || k.x > z || k.y > ab) {
                        ai = ac;
                    }
                    else {
                        ai = null;
                    }
                    var al = this.mv(a, ai, w.item(aj), i, j, ag, ag);
                    if (ad) {
                        ShapeSeriesBase.na(d, aj, al);
                    }
                    d.b8(aj, x.item(aj), k, al);
                }
            }
        }
        d.ci();
    };
    ShapeSeriesBase.na = function (a, b, c) {
        var d = 0;
        var e = null;
        for (var f = 0; f < c.count; f++) {
            var g = c._inner[f];
            var h = g.b.width * g.b.height;
            if (h > d) {
                d = h;
                e = g;
            }
        }
        a.b3.addItem(b, e);
    };
    ShapeSeriesBase.prototype.ik = function () {
        _super.prototype.ik.call(this);
        if (this.mg != null) {
            this.mg.ha();
        }
        if (this.mi != null) {
            this.mi.ha();
        }
    };
    ShapeSeriesBase.prototype.j1 = function (a, b) {
        this.jl(false);
    };
    ShapeSeriesBase.prototype.j0 = function (a, b) {
        this.jl(false);
    };
    ShapeSeriesBase.prototype.h6 = function (a, b, c, d) {
        _super.prototype.h6.call(this, a, b, c, d);
        switch (a) {
            case 3:
                if (d == this.m4) {
                    this.mt._inner[b] = this.nk(this.ml.item(b));
                }
                break;
            case 1:
                for (var e = b; e < b + c; e++) {
                    this.mt.insert(e, this.nk(this.ml.item(e)));
                }
                break;
            case 0:
                this.mt.v(b, c);
                break;
            case 2:
                for (var f = b; f < b + c; f++) {
                    this.mt._inner[f] = this.nk(this.ml.item(f));
                }
                break;
            case 4:
                this.nc();
                break;
        }
        this.jl(false);
    };
    ShapeSeriesBase.prototype.dw = function (a, b, c) {
        var d = true;
        if (!_super.prototype.dw.call(this, a, b, c) || (this.mr && this.ml == null) || b.isEmpty || a.isEmpty || this.mg == null || this.mi == null || this.mg.bh == null || this.mi.bh == null || this.mg.kc == this.mg.kb || this.mi.kc == this.mi.kb || this.ml == null || this.ml.count == 0 || this.mt == null || this.mt.count == 0 || this.mt.count != this.ml.count) {
            d = false;
        }
        return d;
    };
    ShapeSeriesBase.prototype.get_mr = function () {
        return true;
    };
    Object.defineProperty(ShapeSeriesBase.prototype, "mr", {
        get: function () {
            return this.get_mr();
        },
        enumerable: true,
        configurable: true
    });
    ShapeSeriesBase.prototype.i2 = function (a) {
        _super.prototype.i2.call(this, a);
        this.mj = typeCast(ShapeSeriesViewBase.$, a);
    };
    ShapeSeriesBase.prototype.mw = function (a, b, c, d, e, f, g) {
        var h = new List$1(FlattenedShape.$, 0);
        var i;
        var j = c.count;
        for (var k = 0; k < j; k++) {
            i = c._inner[k];
            var l = this.me(a, b, i, d, e, f, g);
            if (l == null) {
                continue;
            }
            h.add(l);
        }
        return h;
    };
    ShapeSeriesBase.prototype.me = function (a, b, c, d, e, f, g) {
        var h = this.m8(c, d, e);
        var i = h.c;
        var j = h.d;
        var k = i.length;
        var l = 1.7976931348623157E+308;
        var m = 1.7976931348623157E+308;
        var n = -1.7976931348623157E+308;
        var o = -1.7976931348623157E+308;
        var p;
        var q;
        if (f != 0) {
            for (var r = 0; r < k; r++) {
                i[r] = i[r] + f;
            }
        }
        for (var s = 0; s < k; s++) {
            p = i[s];
            q = j[s];
            l = p < l ? p : l;
            m = q < m ? q : m;
            n = p > n ? p : n;
            o = q > o ? q : o;
        }
        var t = !(l > this.nj.right || n < this.nj.left || m > this.nj.bottom || o < this.nj.top);
        if (!t && f == 0 && g != 0) {
            if (g != 0) {
                for (var u = 0; u < k; u++) {
                    i[u] = i[u] + g;
                }
            }
            for (var v = 0; v < k; v++) {
                p = i[v];
                q = j[v];
                l = p < l ? p : l;
                m = q < m ? q : m;
                n = p > n ? p : n;
                o = q > o ? q : o;
            }
            t = !(l > this.nj.right || n < this.nj.left || m > this.nj.bottom || o < this.nj.top);
        }
        if (!t) {
            return null;
        }
        var w = b != null && (l < this.nj.left || m < this.nj.top || n > this.nj.right || o > this.nj.bottom);
        var x = new Rect(0, l, m, n - l, o - m);
        if (!a.b2(x)) {
            return null;
        }
        l = l < this.nj.left ? this.nj.left : l;
        n = n > this.nj.right ? this.nj.right : n;
        m = m < this.nj.top ? this.nj.top : m;
        o = o > this.nj.bottom ? this.nj.bottom : o;
        var y = PolySimplification.b(h, this.eu);
        var z = new DefaultFlattener().c(h.c, h.d, y, this.mx);
        var aa = z.count;
        if (w) {
            var ab = new List$1(Point_$type, 0);
            b.i = ab;
            for (var ac = 0; ac < aa; ac++) {
                b.j(z._inner[ac]);
            }
            b.i = null;
            z = ab;
        }
        if (z == null || z.count == 0) {
            return null;
        }
        var ad = new FlattenedShape();
        ad.a = z;
        ad.b = new Rect(0, l, m, n - l, o - m);
        ad.c = x;
        return ad;
    };
    ShapeSeriesBase.prototype.m8 = function (a, b, c) {
        var d = this.mf;
        var e = this.mh;
        var f = a.count;
        var g = new Array(f);
        var h = new Array(f);
        for (var i = 0; i < f; i++) {
            g[i] = a._inner[i].x;
            h[i] = a._inner[i].y;
        }
        d.gs(boxArray$1(g), 0, g.length, b);
        e.gs(boxArray$1(h), 0, h.length, c);
        return new Tuple$2(Array_$type, Array_$type, g, h);
    };
    ShapeSeriesBase.prototype.ne = function (a) {
        a.cp();
    };
    ShapeSeriesBase.prototype.h3 = function (a, b) {
        _super.prototype.h3.call(this, a, b);
        var c = b;
        c.cd();
    };
    ShapeSeriesBase.prototype.m9 = function (a) {
        if (a != null) {
            a.ck(this);
        }
    };
    ShapeSeriesBase.prototype.nd = function (a) {
        if (a != null) {
            a.bx(this);
        }
    };
    ShapeSeriesBase.prototype.ar = function (a, b) {
        var c = this.mj.cr(a, b);
        var d = null;
        if (c != null) {
            d = c.dataContext;
        }
        if (d != null) {
            return d;
        }
        return _super.prototype.ar.call(this, a, b);
    };
    ShapeSeriesBase.prototype.m1 = function (a) {
        return this.bz.item(a);
    };
    ShapeSeriesBase.prototype.get_dq = function () {
        return true;
    };
    ShapeSeriesBase.prototype.set_dq = function (a) {
        _super.prototype.set_dq.call(this, a);
    };
    ShapeSeriesBase.prototype.an = function (a) {
        var e_2, _a, e_3, _b;
        if (typeCast(NumericXAxis.$, a) !== null && this.mt != null) {
            var b = 1.7976931348623157E+308;
            var c = -1.7976931348623157E+308;
            try {
                for (var _c = tslib_1.__values(fromEnum(this.mt)), _d = _c.next(); !_d.done; _d = _c.next()) {
                    var d = _d.value;
                    b = Math.min(b, d.left);
                    c = Math.max(c, d.right);
                }
            }
            catch (e_2_1) {
                e_2 = { error: e_2_1 };
            }
            finally {
                try {
                    if (_d && !_d.done && (_a = _c.return))
                        _a.call(_c);
                }
                finally {
                    if (e_2)
                        throw e_2.error;
                }
            }
            return new AxisRange(b, c);
        }
        if (typeCast(NumericYAxis.$, a) !== null && this.mt != null) {
            var e = 1.7976931348623157E+308;
            var f = -1.7976931348623157E+308;
            try {
                for (var _e = tslib_1.__values(fromEnum(this.mt)), _f = _e.next(); !_f.done; _f = _e.next()) {
                    var g = _f.value;
                    e = Math.min(e, g.top);
                    f = Math.max(f, g.bottom);
                }
            }
            catch (e_3_1) {
                e_3 = { error: e_3_1 };
            }
            finally {
                try {
                    if (_f && !_f.done && (_b = _e.return))
                        _b.call(_e);
                }
                finally {
                    if (e_3)
                        throw e_3.error;
                }
            }
            return new AxisRange(e, f);
        }
        return null;
    };
    ShapeSeriesBase.prototype.get_c5 = function () {
        return true;
    };
    ShapeSeriesBase.prototype.nl = function (a, b, c) {
        if (this.styleShape != null) {
            if (this.mj.cx != null && c == this.mj.cx) {
                c = new Style();
                var d = this.mj.cx;
                c.fill = d.fill;
                c.opacity = d.opacity;
                c.stroke = d.stroke;
                c.strokeThickness = d.strokeThickness;
            }
            else {
                if (c != null) {
                    var e = new Style();
                    e.fill = c.fill;
                    e.opacity = c.opacity;
                    e.stroke = c.stroke;
                    e.strokeThickness = c.strokeThickness;
                    c = e;
                }
                else {
                    c = new Style();
                }
            }
            var f = new StyleShapeEventArgs(a, b, c);
            this.styleShape(this, f);
            return f.d();
        }
        return null;
    };
    ShapeSeriesBase.$t = markType(ShapeSeriesBase, 'ShapeSeriesBase', Series.$);
    ShapeSeriesBase.$$p = markDep(DependencyProperty, PropertyMetadata, ShapeSeriesBase, 'raisePropertyChanged', ['ShapeFilterResolution:my:nf', [1, 2], 'ShapeMemberPath:m4:ng', [2, null], 'XAxis:mg:nh', [NumericXAxis.$, null], 'YAxis:mi:ni', [NumericYAxis.$, null]]);
    return ShapeSeriesBase;
}(Series));
export { ShapeSeriesBase };
/**
 * @hidden
 */
var ShapeSeriesViewBase = /** @class */ /*@__PURE__*/ (function (_super) {
    tslib_1.__extends(ShapeSeriesViewBase, _super);
    function ShapeSeriesViewBase(a) {
        var _this = _super.call(this, a) || this;
        _this.b3 = null;
        _this.by = null;
        _this.b4 = new List$1(ShapeHitRegion.$, 0);
        _this.b7 = 0;
        _this.b6 = null;
        _this.b1 = null;
        _this.bz = null;
        _this.cw = null;
        _this.bv = null;
        _this.bx = null;
        _this.bw = null;
        _this.bu = null;
        _this.by = a;
        _this.b1 = _this.b0();
        _this.b6 = new List$1(Path.$, 0);
        _this.b3 = new Dictionary$2(Number_$type, FlattenedShape.$, 0);
        return _this;
    }
    ShapeSeriesViewBase.prototype.b0 = function () {
        var _this = this;
        return ((function () {
            var $ret = new Pool$1(FrameworkElement.$);
            $ret.create = runOn(_this, _this.cq);
            $ret.activate = runOn(_this, _this.cf);
            $ret.disactivate = runOn(_this, _this.cg);
            $ret.destroy = runOn(_this, _this.ch);
            return $ret;
        })());
    };
    ShapeSeriesViewBase.prototype.b2 = function (a) {
        return a.width >= this.by.mz && a.height >= this.by.mz;
    };
    ShapeSeriesViewBase.b5 = function (a) {
        var b = new List$1(PointCollection.$, 0);
        var c;
        var d = a.count;
        for (var e = 0; e < d; e++) {
            c = a._inner[e];
            var f = new PointCollection(1, c.a);
            b.add(f);
        }
        return b;
    };
    ShapeSeriesViewBase.prototype.b8 = function (a, b, c, d) {
        if (d != null && d.count > 0) {
            var e = ShapeSeriesViewBase.b5(d);
            c.intersect(this.br);
            if (!this.b2(c)) {
            }
            else {
                var f = this.cu(a, e);
                if (f != null) {
                    var g = this.ct(this.b7, b);
                    for (var h = 0; h < d.count; h++) {
                        var i = new ShapeHitRegion();
                        i.d = d._inner[h].b;
                        i.a = d._inner[h].a;
                        i.b = a;
                        i.c = g;
                        this.b4.add(i);
                    }
                    this.ce(g);
                    this.ca(g, f);
                    this.cc(g, b);
                    this.b7 = this.b7 + 1;
                }
            }
        }
    };
    ShapeSeriesViewBase.prototype.ct = function (a, b) {
        var c = this.b1.item(this.b7);
        if (c.dataContext != null) {
            c.dataContext.item = b;
        }
        return c;
    };
    ShapeSeriesViewBase.cb = function (a, b, c) {
        if (b._fill == null) {
            b._fill = a.e.lb;
        }
        if (b._stroke == null) {
            b._stroke = a.e.lc;
        }
        if (b.y == null) {
            b.ac = a.e.ey;
        }
    };
    ShapeSeriesViewBase.prototype.cc = function (a, b) {
        if (a == null) {
            return;
        }
        var c = false;
        if (this.bz != null) {
            var d = this.bz.selectStyle(b, a);
            if (d != null) {
                c = true;
            }
            a.y = d;
        }
        if (!c) {
            a.y = this.cw;
        }
        a.y = this.by.nl(b, a, a.y);
    };
    ShapeSeriesViewBase.prototype.ce = function (a) {
    };
    ShapeSeriesViewBase.prototype.b9 = function (a, b) {
        var c = truncate(Math.floor(a.left));
        var d = truncate(Math.ceil(a.right));
        var e = truncate(Math.floor(a.top));
        var f = truncate(Math.ceil(a.bottom));
        for (var g = c; g < d; g++) {
            for (var h = e; h < f; h++) {
                this.cm(g, h, b);
            }
        }
    };
    ShapeSeriesViewBase.prototype.cm = function (a, b, c) {
    };
    ShapeSeriesViewBase.prototype.cj = function () {
        this.b7 = 0;
    };
    ShapeSeriesViewBase.prototype.ci = function () {
        this.b1.count = this.b7;
        this.an();
    };
    ShapeSeriesViewBase.prototype.cl = function (a, b) {
    };
    ShapeSeriesViewBase.prototype.cd = function () {
        this.b1.count = 0;
        this.an();
    };
    ShapeSeriesViewBase.prototype.cq = function () {
        var a = this.by;
        var b = ((function () {
            var $ret = new Path();
            $ret.dataContext = ((function () {
                var $ret = new DataContext();
                $ret.series = a;
                return $ret;
            })());
            return $ret;
        })());
        this.b6.add(b);
        return b;
    };
    ShapeSeriesViewBase.prototype.cf = function (a) {
        a._visibility = 0;
    };
    ShapeSeriesViewBase.prototype.cg = function (a) {
        a.dataContext.item = null;
        a._visibility = 1;
    };
    ShapeSeriesViewBase.prototype.ch = function (a) {
        this.b6.remove(a);
    };
    ShapeSeriesViewBase.prototype.cv = function (a, b, c) {
        if (b == null) {
            return null;
        }
        var d = new PathGeometry();
        var e;
        var f = b.count;
        for (var g = 0; g < f; g++) {
            e = b._inner[g];
            if (e.count < 1) {
                continue;
            }
            var h = new PolyLineSegment();
            h._points = e;
            var i = new PathFigure();
            i._isFilled = c;
            i._isClosed = c;
            i._startPoint = e._inner[0];
            i._segments.add(h);
            d.c.add(i);
        }
        return d;
    };
    ShapeSeriesViewBase.prototype.bb = function (a, b) {
        _super.prototype.bb.call(this, a, b);
        var c = a;
        c._fill = this.e.lb;
        c._stroke = this.e.lc;
        c.ac = this.e.ey;
        if (c.y != null) {
            this.h.i(c, c.y);
        }
    };
    ShapeSeriesViewBase.prototype.bc = function (a, b) {
        _super.prototype.bc.call(this, a, b);
        var c = a;
        var d = this.bm(b);
        c._fill = d;
        c._stroke = d;
        c.ac = this.e.ey + 3;
    };
    ShapeSeriesViewBase.prototype.a3 = function (a, b) {
        _super.prototype.a3.call(this, a, b);
        for (var c = 0; c < this.b6.count; c++) {
            var d = this.b6._inner[c];
            if (d._visibility != 1) {
                this.ba(d, c, b);
                a.s(d);
            }
        }
    };
    Object.defineProperty(ShapeSeriesViewBase.prototype, "cx", {
        get: function () {
            return this.cw;
        },
        enumerable: true,
        configurable: true
    });
    ShapeSeriesViewBase.prototype.co = function (a) {
        this.bz = a;
    };
    ShapeSeriesViewBase.prototype.cn = function (a) {
        this.cw = a;
    };
    ShapeSeriesViewBase.prototype.cr = function (a, b) {
        return this.cs(a, b, false);
    };
    ShapeSeriesViewBase.prototype.cs = function (a, b, c) {
        if (this.b4.count == 0) {
            return null;
        }
        var d = a.x;
        var e = a.y;
        var f = this.b4.count;
        var g = this.b4;
        var h = null;
        for (var i = 0; i < f; i++) {
            h = g._inner[i];
            if (h.a == null || h.a.count == 0) {
                continue;
            }
            if (d >= h.d.left && d <= h.d.right && e >= h.d.top && e <= h.d.bottom) {
                if (c) {
                    var j = this.by.ey / 2 + this.by.ee(b);
                    if (GeometryUtil.b(a, h.a._inner[0], h.a, j)) {
                        return h.c;
                    }
                }
                else {
                    if (PolygonUtil.a(h.a, a)) {
                        return h.c;
                    }
                }
            }
        }
        return null;
    };
    ShapeSeriesViewBase.prototype.ck = function (a, b, c, d) {
        this.bv = a;
        this.bx = b;
        this.bw = c;
        this.bu = d;
        this.b4.clear();
    };
    ShapeSeriesViewBase.prototype.cp = function () {
        var _this = this;
        var a = this.br;
        var b = ((function () {
            var $ret = new Path();
            $ret.y = _this.cw;
            return $ret;
        })());
        b.ac = 1;
        if (this.h != null) {
            this.h.i(b, b.y);
        }
        this.by.nj = RectUtil.r(a, b.ac);
    };
    ShapeSeriesViewBase.prototype.ai = function (a) {
        _super.prototype.ai.call(this, a);
        if (this.b1.a == null) {
            return;
        }
        for (var b = 0; b < this.b1.a.count; b++) {
            var c = typeCast(Path.$, this.b1.a._inner[b]);
            if (c._visibility != 1) {
                this.e.a2.exportPathData(a, c, "shape" + b, ["Main "]);
            }
        }
    };
    ShapeSeriesViewBase.$t = markType(ShapeSeriesViewBase, 'ShapeSeriesViewBase', SeriesView.$);
    return ShapeSeriesViewBase;
}(SeriesView));
export { ShapeSeriesViewBase };
//# sourceMappingURL=ShapeSeriesBase_combined.js.map
