/*
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, __values } from "tslib";
import { MarkerSeries } from "./MarkerSeries";
import { Base, runOn, delegateCombine, Number_$type, enumGetBox, Point_$type, typeCast, fromEnum, markType, markDep } from "igniteui-react-core";
import { PolarAxisInfoCache } from "./PolarAxisInfoCache";
import { SeriesRenderer$2 } from "./SeriesRenderer$2";
import { PolarFrame } from "./PolarFrame";
import { DependencyProperty } from "igniteui-react-core";
import { NumericAngleAxis } from "./NumericAngleAxis";
import { NumericRadiusAxis } from "./NumericRadiusAxis";
import { TrendLineType_$type } from "igniteui-react-core";
import { Brush } from "igniteui-react-core";
import { PenLineCap_$type } from "igniteui-react-core";
import { DoubleCollection } from "igniteui-react-core";
import { ScatterItemSearchMode_$type } from "./ScatterItemSearchMode";
import { HighlightingInfo } from "./HighlightingInfo";
import { List$1 } from "igniteui-react-core";
import { SeriesPointOfInterest } from "./SeriesPointOfInterest";
import { ScalerParams } from "./ScalerParams";
import { Rect } from "igniteui-react-core";
import { Marker } from "./Marker";
import { MarkerSeriesView } from "./MarkerSeriesView";
import { PolarAxes } from "./PolarAxes";
import { SeriesLayerPropertyOverlay } from "./SeriesLayerPropertyOverlay";
import { IFastItemsSource_$type } from "igniteui-react-core";
import { SeriesRenderingArguments } from "./SeriesRenderingArguments";
import { AxisRange } from "./AxisRange";
import { Dictionary$2 } from "igniteui-react-core";
import { OwnedPoint } from "./OwnedPoint";
import { GeometryUtil } from "igniteui-react-core";
import { DataContext } from "igniteui-react-core";
import { HashPool$2 } from "igniteui-react-core";
import { Clipper } from "igniteui-react-core";
import { TrendResolutionParams } from "./TrendResolutionParams";
import { PolarTrendLineManager } from "./PolarTrendLineManager";
import { AssigningPolarStyleEventArgs } from "./AssigningPolarStyleEventArgs";
import { AssigningPolarMarkerStyleEventArgs } from "./AssigningPolarMarkerStyleEventArgs";
import { SeriesRenderManager } from "./SeriesRenderManager";
import { DataLegendSeriesValueInfo } from "igniteui-react-core";
import { DataLegendSeriesContext } from "igniteui-react-core";
import { PropertyMetadata } from "igniteui-react-core";
import { truncate, isNaN_, isInfinity } from "igniteui-react-core";
import { Defaults } from "./Defaults";
import { NumericMarkerManager } from "./NumericMarkerManager";
import { GeometryGroup } from "igniteui-react-core";
import { stringIsNullOrEmpty } from "igniteui-react-core";
/**
 * @hidden
 */
var PolarBase = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(PolarBase, _super);
    function PolarBase() {
        var _this = _super.call(this) || this;
        _this.vw = null;
        _this.vi = null;
        _this.vu = null;
        _this.y7 = null;
        _this.y6 = null;
        _this.v8 = null;
        _this.wa = null;
        _this.wb = null;
        _this.v0 = new PolarFrame();
        _this.v2 = new PolarFrame();
        _this.vy = new PolarFrame();
        _this.vt = null;
        _this.wt = null;
        _this.v4 = 1;
        _this.wf = false;
        _this.we = false;
        _this.vp = null;
        _this.vq = null;
        _this.assigningPolarStyle = null;
        _this.assigningPolarMarkerStyle = null;
        _this.v3 = null;
        _this.v1 = null;
        _this.vx = null;
        _this.v3 = new PolarSeriesRenderManager();
        _this.v5 = _this.v6();
        _this.v1 = new PolarFrame();
        _this.v2.x = runOn(_this, _this.y5);
        _this.v0.x = runOn(_this, _this.y5);
        _this.vy.x = runOn(_this, _this.y5);
        _this.v8 = new SeriesRenderer$2(PolarFrame.$, PolarBaseView.$, 0, runOn(_this, _this.x6), runOn(_this, _this.ya), runOn(_this, _this.dj), runOn(_this, _this.p3), runOn(_this, _this.xz));
        return _this;
    }
    PolarBase.prototype.cg = function () {
        return new PolarBaseView(this);
    };
    PolarBase.prototype.o0 = function (a) {
        _super.prototype.o0.call(this, a);
        this.vv = a;
    };
    PolarBase.prototype.ng = function () {
        _super.prototype.ng.call(this);
        this.vr = null;
        this.vs = null;
    };
    PolarBase.prototype.get_e2 = function () {
        return true;
    };
    PolarBase.prototype.ds = function (a, b, c, d) {
        var _this = this;
        if (!this.hasMarkers) {
            return false;
        }
        var e = this.vr;
        var f = new ScalerParams(1, this.cy.tn, this.tw, e.ch);
        f.c = this.getEffectiveViewport1(this.cj);
        var g = this.vs;
        var h = new ScalerParams(1, this.cy.tn, this.tw, g.ch);
        h.c = this.getEffectiveViewport1(this.cj);
        a.clear();
        this.t9.ci(function (i) {
            if (i._visibility == 0) {
                var j = new SeriesPointOfInterest();
                var k = i.n;
                var l = i.o;
                if (k < _this.tw.left || k > _this.tw.right || l < _this.tw.top || l > _this.tw.bottom) {
                    return;
                }
                var m = void 0;
                var n = void 0;
                var o = _this.vt.f(k, l, _this.cj.by, _this.cj.bx, m, n);
                m = o.p4;
                n = o.p5;
                j.b = m;
                j.c = n;
                j.a = i.content;
                a.add(j);
            }
        });
        return true;
    };
    PolarBase.prototype.xz = function () {
        if (this.cz.g) {
            this.cz.t();
        }
    };
    PolarBase.prototype.x1 = function () {
        this.vt.e(this.vw.w, this.wc, this.wd, this.y7, this.y6, function (a, b) { return Math.cos(b); }, function (a, b) { return Math.sin(b); }, true);
    };
    PolarBase.prototype.fn = function () {
        return this.highlightedItemsSource != null || (this.xh != null && this.xf != null);
    };
    PolarBase.prototype.wr = function () {
        return false;
    };
    PolarBase.prototype.g0 = function () {
        var a = _super.prototype.g0.call(this);
        {
            var b = ((function () {
                var $ret = new SeriesLayerPropertyOverlay();
                $ret.ad = "AngleMemberPath";
                $ret.p = true;
                $ret.y = "HighlightedAngleMemberPath";
                $ret.q = true;
                return $ret;
            })());
            b.valueResolving = delegateCombine(b.valueResolving, runOn(this, this.x2));
            a.add(b);
        }
        {
            var c = ((function () {
                var $ret = new SeriesLayerPropertyOverlay();
                $ret.ad = "RadiusMemberPath";
                $ret.p = true;
                $ret.y = "HighlightedRadiusMemberPath";
                $ret.q = true;
                return $ret;
            })());
            c.valueResolving = delegateCombine(c.valueResolving, runOn(this, this.x3));
            a.add(c);
        }
        if (this.wr()) {
            var d = ((function () {
                var $ret = new SeriesLayerPropertyOverlay();
                $ret.r = true;
                $ret.ad = "DashArray";
                $ret.p = true;
                $ret.x = ((function () {
                    var $ret = new DoubleCollection();
                    $ret.add(5);
                    $ret.add(5);
                    return $ret;
                })());
                $ret.q = true;
                return $ret;
            })());
            a.add(d);
        }
        if (!this.wr()) {
            var e = ((function () {
                var $ret = new SeriesLayerPropertyOverlay();
                $ret.r = true;
                $ret.ad = "Brush";
                $ret.p = true;
                $ret.y = "ActualBrush";
                $ret.q = true;
                return $ret;
            })());
            e.valueResolving = delegateCombine(e.valueResolving, runOn(this, this.px));
            a.add(e);
        }
        if (!this.wr()) {
            var f = ((function () {
                var $ret = new SeriesLayerPropertyOverlay();
                $ret.r = true;
                $ret.ad = "Outline";
                $ret.p = true;
                $ret.y = "ActualOutline";
                $ret.q = true;
                return $ret;
            })());
            f.valueResolving = delegateCombine(f.valueResolving, runOn(this, this.px));
            a.add(f);
        }
        return a;
    };
    PolarBase.prototype.x3 = function (a, b) {
        if (this.xh != null) {
            b.value = this.xh;
            return;
        }
        b.value = this.xu;
    };
    PolarBase.prototype.x2 = function (a, b) {
        if (this.xf != null) {
            b.value = this.xf;
            return;
        }
        b.value = this.xc;
    };
    Object.defineProperty(PolarBase.prototype, "wc", {
        get: function () {
            return this.wa;
        },
        set: function (a) {
            if (this.wa != a) {
                var b = this.wc;
                this.wa = a;
                this.raisePropertyChanged("AngleColumn", b, this.wc);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(PolarBase.prototype, "wd", {
        get: function () {
            return this.wb;
        },
        set: function (a) {
            if (this.wb != a) {
                var b = this.wd;
                this.wb = a;
                this.raisePropertyChanged("RadiusColumn", b, this.wd);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(PolarBase.prototype, "y0", {
        get: function () {
            return this.c(PolarBase.yb);
        },
        set: function (a) {
            this.h(PolarBase.yb, a);
        },
        enumerable: false,
        configurable: true
    });
    PolarBase.prototype.vz = function () {
        var a = this.vy;
        if (this.dj()) {
            if (this.cz.g) {
                this.cz.t();
            }
            a = this.v2;
        }
        return a;
    };
    PolarBase.prototype.ob = function () {
        _super.prototype.ob.call(this);
        if (this.vs != null) {
            this.vs.h8(false);
        }
        if (this.vr != null) {
            this.vr.h8(false);
        }
    };
    PolarBase.prototype.no = function (a, b, c, d) {
        var e = false;
        this.vv.cy.g$e(a, b, c, d);
        if (this.vr != null && !this.vr.c1()) {
            e = true;
        }
        if (this.vs != null && !this.vs.c1()) {
            e = true;
        }
        if (e) {
            this.pp(true);
        }
    };
    PolarBase.prototype.qm = function (a, b) {
        this.pp(false);
    };
    PolarBase.prototype.qn = function (a, b) {
        this.pp(false);
    };
    PolarBase.prototype.gl = function (a, b, c) {
        var d = true;
        if (!_super.prototype.gl.call(this, a, b, c) || !c.o() || b.isEmpty || a.isEmpty || this.vr == null || this.vs == null || this.wc == null || this.wd == null || this.wc.count == 0 || this.wd.count == 0 || this.c6 == null || this.c6.count != this.wc.count || this.c6.count != this.wd.count || this.vt == null || this.vr.bi == null || this.vs.bi == null || this.vr.lx == this.vr.lw || this.vs.lx == this.vs.lw) {
            d = false;
        }
        return d;
    };
    PolarBase.prototype.pq = function (a) {
        _super.prototype.pq.call(this, a);
        var b;
        var c;
        var d = this.getViewInfo(c, b);
        c = d.p0;
        b = d.p1;
        if (!this.gl(c, b, this.cj)) {
            this.nj(true, this.cj);
            return;
        }
        this.y7 = b;
        this.y6 = c;
        this.vu = new PolarAxisInfoCache(this.vr, this.vs, this.c6);
        var e = new SeriesRenderingArguments(this, c, b, a, this.f0);
        var f = this.v8.g(e, this.v0, this.vy, this.v2, this.vv);
        this.v0 = f.p1;
        this.vy = f.p2;
        this.v2 = f.p3;
    };
    PolarBase.prototype.y5 = function (a) {
        var b = this.vt.h(a.x, a.y, this.y7, this.y6, this.vu.e, this.vu.d, this.vu.g, this.vu.f, this.vu.i, this.vu.h);
        return b;
    };
    PolarBase.prototype.aq = function (a) {
        if (a != null && a == this.vr && this.wc != null) {
            return new AxisRange(this.wc.minimum, this.wc.maximum);
        }
        if (a != null && a == this.vs && this.wd != null) {
            return new AxisRange(this.wd.minimum, this.wd.maximum);
        }
        return null;
    };
    PolarBase.prototype.fo = function (a) {
        var b = this.cj.by;
        b = b.copy();
        var c = this.cj.bx;
        var d = !b.isEmpty && !c.isEmpty && this.c6 != null ? this.c6.indexOf(a) : -1;
        if (this.vr == null || this.wc == null || this.vs == null || this.wd == null) {
            return false;
        }
        if (d < 0 || d > this.wc.count - 1 || d > this.wd.count - 1) {
            return false;
        }
        var e = this.vr.getScaledAngle(this.wc.item(d));
        var f = this.vs.nu(this.wd.item(d));
        var g = 0.5 + (Math.cos(e) * f);
        var h = 0.5 + (Math.sin(e) * f);
        if (!isNaN_(g)) {
            if (g < b.left + 0.1 * b.width) {
                g = g + 0.4 * b.width;
                b.x = g - 0.5 * b.width;
            }
            if (g > b.right - 0.1 * b.width) {
                g = g - 0.4 * b.width;
                b.x = g - 0.5 * b.width;
            }
        }
        if (!isNaN_(h)) {
            if (h < b.top + 0.1 * b.height) {
                h = h + 0.4 * b.height;
                b.y = h - 0.5 * b.height;
            }
            if (h > b.bottom - 0.1 * b.height) {
                h = h - 0.4 * b.height;
                b.y = h - 0.5 * b.height;
            }
        }
        if (this.cr != null) {
            this.cr.au(this.cy, b, true);
        }
        return d >= 0;
    };
    PolarBase.prototype.jr = function (a) {
        var b = this.i8(a);
        if (this.c6 != null && b >= 0 && b < this.c6.count) {
            return this.c6.item(b);
        }
        return null;
    };
    PolarBase.prototype.i8 = function (a) {
        var b = truncate(Math.round(this.hv(a)));
        return b;
    };
    PolarBase.prototype.hv = function (a) {
        switch (this.v5) {
            case 1: return this.wx(a);
            case 3: return this.wy(a);
            case 2: return this.wv(a);
            case 4: return this.ww(a);
        }
        return -1;
    };
    PolarBase.prototype.ww = function (a) {
        return this.wz(a, false);
    };
    PolarBase.prototype.wv = function (a) {
        var b = this.tc(a);
        var c = b.x;
        var d = b.y;
        if (this.c6 == null || this.vr == null || this.vs == null || this.wc == null || this.wd == null) {
            return -1;
        }
        if (this.c6.count > this.w1) {
            return -1;
        }
        if (!this.wj()) {
            return -1;
        }
        var e = this.wt;
        var f = 1.7976931348623157E+308;
        var g = -1;
        for (var h = 0; h < this.wc.count; h++) {
            var i = e._inner[h].x;
            var j = e._inner[h].y;
            var k = (c - i) * (c - i) + (d - j) * (d - j);
            if (k < f) {
                f = k;
                g = h;
            }
        }
        return g;
    };
    PolarBase.prototype.wj = function () {
        var a = this.vy;
        if (this.dj()) {
            a = this.v2;
        }
        if (a == null || a.w.count == 0) {
            return false;
        }
        this.wt = a.w;
        return true;
    };
    PolarBase.prototype.wz = function (a, b) {
        if (!this.wm) {
            return -1;
        }
        var c = { $type: Point_$type, x: 0, y: 0 };
        var d = true;
        var e = this.vy;
        if (this.dj()) {
            e = this.v2;
        }
        if (e == null) {
            return -1;
        }
        if (e.m == null) {
            return -1;
        }
        if (this.c6 == null || this.c6.count > this.w1) {
            return -1;
        }
        if (!this.wj()) {
            return -1;
        }
        var f = this.wt;
        var g = this.tc(a);
        var h = 1.7976931348623157E+308;
        var i = -1;
        for (var j = 0; j < f.count; j++) {
            var k = f._inner[j];
            if (j > 0) {
                if (isNaN_(k.x) || isNaN_(k.y) || isNaN_(c.x) || isNaN_(c.y)) {
                    c = k;
                    continue;
                }
                if (!b || e.j.containsKey(this.c6.item(j)) || e.j.containsKey(this.c6.item(j - 1))) {
                    var l = GeometryUtil.d(g, c, k);
                    if (l < h) {
                        h = l;
                        i = j;
                    }
                }
            }
            c = k;
        }
        if (i >= 0) {
            var m = f._inner[i];
            var n = f._inner[i - 1];
            if (!b || (e.j.containsKey(this.c6.item(i)) && e.j.containsKey(this.c6.item(i - 1)))) {
                var o = GeometryUtil.h(g, n, m);
                return (i - 1) + o;
            }
            else if (e.j.containsKey(this.c6.item(i))) {
                return i;
            }
            else {
                return i - 1;
            }
        }
        return -1;
    };
    PolarBase.prototype.wy = function (a) {
        return this.wz(a, true);
    };
    PolarBase.prototype.wx = function (a) {
        var _this = this;
        var b = null;
        var c = 1.7976931348623157E+308;
        var d = this.tc(a);
        var e = d.x;
        var f = d.y;
        if (this.vv.cz.e > this.w1) {
            return -1;
        }
        this.vv.c2(function (g) {
            if (g._visibility == 0) {
                var h = _this.vv.cs(g);
                var i = h.left + h.width / 2;
                var j = h.top + h.height / 2;
                var k = (e - i) * (e - i) + (f - j) * (f - j);
                if (k < c) {
                    c = k;
                    b = g;
                }
            }
        });
        if (b != null) {
            return b.ak;
        }
        return -1;
    };
    PolarBase.prototype.th = function (a, b, c) {
        var _this = this;
        if (this.vr == null || this.vs == null || this.wc == null || this.wd == null) {
            return { $type: Point_$type, x: NaN, y: NaN };
        }
        var d = this.cj.by;
        var e = this.cj.bx;
        var f = this.getEffectiveViewport();
        var g = new ScalerParams(0, d, e, this.vr.ch, f);
        var h = ((function () {
            var $ret = new ScalerParams(0, d, e, _this.vs.ch, f);
            $ret.b = _this.h2();
            return $ret;
        })());
        if (b) {
            var i = this.hv(a);
            if (i == -1) {
                return { $type: Point_$type, x: NaN, y: NaN };
            }
            var j = truncate(Math.floor(i));
            var k = truncate(Math.ceil(i));
            if (j < 0) {
                j = 0;
            }
            if (k < 0) {
                k = 0;
            }
            if (k > this.c6.count - 1) {
                k = this.c6.count - 1;
            }
            if (j > this.c6.count - 1) {
                j = this.c6.count - 1;
            }
            if (k == j) {
                return this.vt.h(this.wc.item(j), this.wd.item(j), d, e, this.vu.e, this.vu.d, this.vu.g, this.vu.f, this.vu.i, this.vu.h);
            }
            var l = i - Math.floor(i);
            var m = this.vt.h(this.wc.item(j), this.wd.item(j), d, e, this.vu.e, this.vu.d, this.vu.g, this.vu.f, this.vu.i, this.vu.h);
            var n = this.vt.h(this.wc.item(k), this.wd.item(k), d, e, this.vu.e, this.vu.d, this.vu.g, this.vu.f, this.vu.i, this.vu.h);
            var o = m.x;
            var p = m.y;
            var q = n.x;
            var r = n.y;
            var s = q - o;
            var t = r - p;
            return { $type: Point_$type, x: o + s * l, y: p + t * l };
        }
        else {
            var u = this.i8(a);
            if (u == -1) {
                return { $type: Point_$type, x: NaN, y: NaN };
            }
            return this.vt.h(this.wc.item(u), this.wd.item(u), d, e, this.vu.e, this.vu.d, this.vu.g, this.vu.f, this.vu.i, this.vu.h);
        }
    };
    PolarBase.prototype.ag = function () {
        return [this.vr, this.vs];
    };
    PolarBase.prototype.ju = function (a, b) {
        var c = this.lv(b);
        if (c == PolarBase.$$p[3]) {
            return this.jv(a, b, this.xc);
        }
        if (c == PolarBase.$$p[15]) {
            return this.jv(a, b, this.xu);
        }
        return _super.prototype.ju.call(this, a, b);
    };
    PolarBase.prototype.o8 = function (a, b, c, d) {
        _super.prototype.o8.call(this, a, b, c, d);
        if (this.vv.cy.g$b(a, b, c, d)) {
            this.pp(false);
            this.ol();
        }
        switch (b) {
            case "FastItemsSource":
                if (typeCast(IFastItemsSource_$type, c) != null) {
                    c.deregisterColumn(this.wc);
                    c.deregisterColumn(this.wd);
                    this.wc = null;
                    this.wd = null;
                }
                if (typeCast(IFastItemsSource_$type, d) != null) {
                    this.wc = this.c3(this.xc);
                    this.wd = this.c3(this.xu);
                }
                if ((this.vs != null && !this.vs.c1()) || (this.vr != null && !this.vr.c1())) {
                    this.pp(this.fq && c != null);
                }
                break;
            case PolarBase.$$p[0]:
                if (this.vr != null && this.vs != null) {
                    this.vt = new PolarAxes(this.vs, this.vr);
                }
                if (c != null) {
                    c.b0(this);
                }
                if (d != null) {
                    d.ct(this);
                }
                if (this.vr != null && !this.vr.c1()) {
                    this.pp(false);
                }
                else if (c != null && d == null) {
                    this.nj(true, this.cj);
                }
                break;
            case PolarBase.$$p[12]:
                if (this.vr != null && this.vs != null) {
                    this.vt = new PolarAxes(this.vs, this.vr);
                }
                if (c != null) {
                    c.b0(this);
                }
                if (d != null) {
                    d.ct(this);
                }
                if (this.vs != null && !this.vs.c1()) {
                    this.pp(false);
                }
                else if (c != null && d == null) {
                    this.nj(true, this.cj);
                }
                if (this.vr != null && !this.vr.c1()) {
                    this.vr.h4();
                }
                break;
            case PolarBase.$$p[3]:
                if (this.c6 != null) {
                    this.c6.deregisterColumn(this.wc);
                    this.wc = this.c3(this.xc);
                }
                break;
            case "AngleColumn":
                this.vv.cy.g$i();
                if (this.vr != null && !this.vr.c1()) {
                    this.pp(this.fq && this.dn);
                }
                break;
            case PolarBase.$$p[15]:
                if (this.c6 != null) {
                    this.c6.deregisterColumn(this.wd);
                    this.wd = this.c3(this.xu);
                }
                break;
            case "RadiusColumn":
                this.vv.cy.g$i();
                if (this.vs != null && !this.vs.c1()) {
                    this.pp(this.fq && this.dn);
                }
                break;
            case PolarBase.$$p[16]:
                this.pp(false);
                this.ol();
                break;
            case PolarBase.$$p[11]:
                this.pp(false);
                this.ol();
                break;
            case "TransitionProgress":
                this.vu = new PolarAxisInfoCache(this.vr, this.vs, this.c6);
                this.y7 = this.cj.by;
                this.y6 = this.cj.bx;
                this.v2.v = this.ws;
                this.v2.c(this.iv, this.v0, this.vy);
                if (this.dl(this.cj)) {
                    return;
                }
                if (this.iv == 1) {
                    this.ya(this.vy, this.vv);
                }
                else {
                    this.ya(this.v2, this.vv);
                }
                if (this.cy != null) {
                    this.cy.on(this);
                }
                break;
            case "TrendLineBrush":
                this.pe(b);
                break;
            case PolarBase.$$p[4]:
                this.pp(false);
                this.ol();
                break;
            case "TrendLineType":
                this.ol();
                break;
            case PolarBase.$$p[8]:
                this.wf = this.wo();
                this.pp(false);
                break;
            case PolarBase.$$p[7]:
                this.we = this.wn();
                this.pp(false);
                break;
            case PolarBase.$$p[9]:
                this.v5 = this.v6();
                break;
        }
    };
    Object.defineProperty(PolarBase.prototype, "v5", {
        get: function () {
            return this.v4;
        },
        set: function (a) {
            var b = this.v4;
            this.v4 = a;
            if (b != this.v4) {
                this.raisePropertyChanged("ActualItemSearchMode", enumGetBox(ScatterItemSearchMode_$type, b), enumGetBox(ScatterItemSearchMode_$type, this.v4));
            }
        },
        enumerable: false,
        configurable: true
    });
    PolarBase.prototype.v6 = function () {
        if (this.v7 != 0) {
            return this.v7;
        }
        return this.wm ? 4 : 1;
    };
    PolarBase.prototype.get_wm = function () {
        return false;
    };
    Object.defineProperty(PolarBase.prototype, "wm", {
        get: function () {
            return this.get_wm();
        },
        enumerable: false,
        configurable: true
    });
    PolarBase.prototype.wo = function () {
        return this.wl;
    };
    PolarBase.prototype.wn = function () {
        return this.wk;
    };
    PolarBase.prototype.wh = function (a) {
        if (typeCast(NumericRadiusAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    PolarBase.prototype.wg = function (a) {
        if (typeCast(NumericAngleAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    PolarBase.prototype.nj = function (a, b) {
        _super.prototype.nj.call(this, a, b);
        var c = b;
        if (a) {
            c.cz.clear();
        }
        c.cy.g$d();
    };
    PolarBase.prototype.vj = function (a, b) {
        var c = a.top - 10;
        var d = a.bottom + 10;
        var e = a.left - 10;
        var f = a.right + 10;
        var g = ((function () {
            var $ret = new Clipper(1, e, d, f, c, false);
            $ret.i = b;
            return $ret;
        })());
        return g;
    };
    PolarBase.prototype.xy = function (a, b, c, d) {
        a.g = new Dictionary$2(Base.$, OwnedPoint.$, 1, b);
        var e = this.c6;
        var _loop_1 = function (f) {
            var g = a.w._inner[f];
            if (!isInfinity(g.x) && !isInfinity(g.y)) {
                var h_1 = { $type: Point_$type, x: this_1.wc.item(f), y: this_1.wd.item(f) };
                var i_1 = { $type: Point_$type, x: g.x, y: g.y };
                a.g.addItem(e.item(f), ((function () {
                    var $ret = new OwnedPoint();
                    $ret.a = e.item(f);
                    $ret.b = h_1;
                    $ret.c = i_1;
                    return $ret;
                })()));
            }
        };
        var this_1 = this;
        for (var f = 0; f < b; f++) {
            _loop_1(f);
        }
    };
    PolarBase.prototype.x6 = function (a, b) {
        var _this = this;
        var c = b.by;
        var d = b.bx;
        a.j.clear();
        a.n.clear();
        var e = Math.min(this.wc != null ? this.wc.count : 0, this.wd != null ? this.wd.count : 0);
        if (e < 1) {
            return;
        }
        this.vu = new PolarAxisInfoCache(this.vr, this.vs, this.c6);
        this.vw = a;
        this.y6 = d;
        this.y7 = c;
        b.cw.l(a.j, this.w2, c, d, this.hj);
        if (e <= this.w2) {
            this.xy(a, e, c, d);
        }
        var f = this.vj(d, a.n);
        var g = Math.min(this.vr.lx, this.vr.lw);
        var h = Math.max(this.vr.lw, this.vr.lx);
        b.cy.i = this.ws;
        b.cy.h = 0;
        b.cy.k = this.vs.no;
        b.cy.j = this.vs.nn;
        b.cy.l = function (i, j) { return _this.vt.c(i, j, c, d, Math.cos); };
        b.cy.m = function (i, j) { return _this.vt.d(i, j, c, d, Math.sin); };
        var i = new List$1(Number_$type, 0);
        for (var j = 0; j < this.wc.count; j++) {
            if (this.wc.item(j) >= g && this.wc.item(j) <= h) {
                i.add(this.wc.item(j));
            }
        }
        var k = this.wd;
        if (i.count != this.wc.count) {
            k = new List$1(Number_$type, 0);
            for (var l = 0; l < this.wc.count; l++) {
                if (this.wc.item(l) >= g && this.wc.item(l) <= h) {
                    k.add(this.wd.item(l));
                }
            }
        }
        b.cy.n(a.n, this.v9, i, k, this.w3, runOn(this.vr, this.vr.getScaledAngle), runOn(this.vs, this.vs.nu), ((function () {
            var $ret = new TrendResolutionParams();
            $ret.d = _this.hj;
            $ret.h = d;
            $ret.i = c;
            return $ret;
        })()), f, g, h);
    };
    PolarBase.prototype.get_es = function () {
        return true;
    };
    PolarBase.prototype.vn = function (a, b, c) {
        return null;
    };
    PolarBase.prototype.vo = function (a, b, c) {
        var d = this.vz();
        var e = this.vv.b1(this.tc(b));
        var f = -1;
        if (e == null) {
            if (a != null) {
                f = this.c6.indexOf(a);
            }
            else {
                return null;
            }
        }
        else {
            f = e.ak;
        }
        if (f == -1) {
            return null;
        }
        var g = new HighlightingInfo();
        g.b = this;
        g.h = f;
        g.g = f;
        g.d = false;
        g.e = true;
        if (c != null && c.h == g.h && c.g == g.g) {
            return c;
        }
        return g;
    };
    PolarBase.prototype.vm = function (a, b, c) {
        var d = new HighlightingInfo();
        d.b = this;
        d.h = 0;
        d.g = this.c6.count - 1;
        d.d = true;
        if (c != null && c.h == d.h && c.g == d.g) {
            return c;
        }
        return d;
    };
    PolarBase.prototype.ax = function (a, b, c) {
        if (this.du && this.fc(this.bs) && !c) {
            var d = this.vn(a, b, this.vp);
            this.vp = d;
            return d;
        }
        else {
            var e = this.vm(a, b, this.vp);
            this.vp = e;
            return e;
        }
    };
    PolarBase.prototype.ay = function (a, b, c) {
        if (this.fc(this.bs) && !c) {
            var d = this.vo(a, b, this.vq);
            this.vq = d;
            return d;
        }
        else {
            var e = this.vm(a, b, this.vq);
            e.e = true;
            this.vq = e;
            return e;
        }
    };
    PolarBase.prototype.wq = function () {
        return (this.assigningPolarStyle != null && this.wf) || (this.bs != 1);
    };
    PolarBase.prototype.wp = function () {
        return (this.assigningPolarMarkerStyle != null && this.we) || (this.bs != 1);
    };
    PolarBase.prototype.ya = function (a, b) {
        this.ow();
        var c = b.by;
        var d = b.bx;
        var e = this.getEffectiveViewport1(b);
        var f = this.to(b);
        this.vu = new PolarAxisInfoCache(this.vr, this.vs, this.c6);
        if (this.uc()) {
            b.cw.j(a.j, this.ue);
            if (this.wp()) {
                this.x0(b, a);
            }
        }
        b.cp();
        var g = this.vj(d, b.cy.g$j.an);
        b.cy.g$h(a.n, g);
        this.xx(d, c, e, f, b);
    };
    PolarBase.prototype.vg = function (a, b) {
        return this.vh(a, b);
    };
    PolarBase.prototype.vh = function (a, b) {
        if (b < a || a < 0 || a > this.wc.count || b < 0 || b > this.wc.count) {
            return null;
        }
        var c = new Array((b - a) + 1);
        for (var d = a; d <= b; d++) {
            var e = d;
            c[d - a] = this.c6.item(d);
        }
        return c;
    };
    PolarBase.prototype.x0 = function (a, b) {
        var _this = this;
        a.b6 = true;
        this.v3.ay(this, this.wp(), runOn(this, this.vg));
        var c = this.v3.d;
        var d = c != null;
        var e = this.getEffectiveViewport1(a);
        var f = this.c6 == null ? 0 : this.c6.count;
        this.vv.ci(function (g) {
            if (g._visibility == 0) {
                var h = g.ak;
                var i = g.content;
                if (i == null) {
                    i = new DataContext();
                    g.content = i;
                }
                if (d) {
                    _this.x4(h, f, a.q);
                }
                _this.v3.ac(g, i);
            }
        });
    };
    PolarBase.prototype.x5 = function (a, b, c) {
        var d = this.bs != 1;
        this.v3.a0(this.v3.b, a, b, false);
        this.v3.ab(this.hh);
        var e = this.v3.ax;
        var f = null;
        var g = this.c6;
        if (d && this.cy != null) {
            f = this.cy.a7.getHighlightingInfo(this, g, e.o, e.n, false);
            e.b = f;
        }
        e.f = c;
        this.x8(e);
        this.v3.z(this, f, c, d, a < 0);
    };
    PolarBase.prototype.x4 = function (a, b, c) {
        var d = this.bs != 1;
        this.v3.a0(this.v3.d, a, b, true);
        this.v3.aa(this.hh);
        var e = this.v3.aw;
        var f = null;
        var g = this.c6;
        var h = null;
        if (d && this.cy != null) {
            f = this.cy.a7.getHighlightingInfo(this, g, e.o, e.n, true);
            if (this.cy.a7.isCrossSeriesHighlight(this)) {
                h = this.cy.a7.getHighlightingInfo(this, g, e.o, e.n, true);
            }
            e.b = f;
        }
        e.f = c;
        this.x7(e);
        this.v3.y(this, f, c, d, e.l, this.cy.a7.sumHighlightingProgress);
    };
    PolarBase.prototype.x8 = function (a) {
        if (this.assigningPolarStyle != null && this.wf) {
            this.assigningPolarStyle(this, a);
        }
    };
    PolarBase.prototype.x7 = function (a) {
        if (this.assigningPolarMarkerStyle != null && this.we) {
            this.assigningPolarMarkerStyle(this, a);
        }
    };
    PolarBase.prototype.xx = function (a, b, c, d, e) {
        e.c1(a, b, c, d);
    };
    PolarBase.prototype.qd = function () {
        _super.prototype.qd.call(this);
        if (this.index < 0) {
            return;
        }
        this.vv.c4();
    };
    PolarBase.prototype.pr = function (a, b) {
        _super.prototype.pr.call(this, a, b);
        if (!this.f8) {
            this.cj.a4(b);
            return;
        }
        this.cj.a4(b);
        if (this.dl(this.ci)) {
            return;
        }
        var c = this.ci;
        if (!this.f1) {
            this.v1 = new PolarFrame();
            this.x6(this.v1, c);
        }
        this.f1 = false;
        this.ya(this.v1, c);
        this.f8 = false;
    };
    PolarBase.prototype.po = function (a, b, c, d, e) {
        _super.prototype.po.call(this, a, b, c, d, e);
        var f = this.a7.a$h.item(d);
        var g = f;
        f.a3(c);
        if (this.dl(g)) {
            return;
        }
        if (this.vx == null) {
            this.vx = new PolarFrame();
        }
        this.x6(this.vx, g);
        this.ya(this.vx, g);
    };
    PolarBase.prototype.x9 = function (a, b) {
        var e_1, _a, e_2, _b;
        var c = new List$1(Base.$, 0);
        try {
            for (var _c = __values(fromEnum(b.c)), _d = _c.next(); !_d.done; _d = _c.next()) {
                var d = _d.value;
                if (!a.containsKey(d)) {
                    c.add1(d);
                }
            }
        }
        catch (e_1_1) {
            e_1 = { error: e_1_1 };
        }
        finally {
            try {
                if (_d && !_d.done && (_a = _c.return))
                    _a.call(_c);
            }
            finally {
                if (e_1)
                    throw e_1.error;
            }
        }
        try {
            for (var _e = __values(fromEnum(c)), _f = _e.next(); !_f.done; _f = _e.next()) {
                var e = _f.value;
                b.h(e);
            }
        }
        catch (e_2_1) {
            e_2 = { error: e_2_1 };
        }
        finally {
            try {
                if (_f && !_f.done && (_b = _e.return))
                    _b.call(_e);
            }
            finally {
                if (e_2)
                    throw e_2.error;
            }
        }
    };
    PolarBase.prototype.vf = function (a, b, c) {
        this.x1();
        return this.vw.w.toArray();
    };
    PolarBase.prototype.wu = function (a) {
        var e_3, _a;
        var b = new List$1(Number_$type, 0);
        var c = this.c6;
        try {
            for (var _b = __values(fromEnum(this.vv.cz.c)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var d = _c.value;
                b.add(c.indexOf(d));
            }
        }
        catch (e_3_1) {
            e_3 = { error: e_3_1 };
        }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return))
                    _a.call(_b);
            }
            finally {
                if (e_3)
                    throw e_3.error;
            }
        }
        return b;
    };
    PolarBase.prototype.y4 = function (a) {
        return { $type: Point_$type, x: this.wc.item(a), y: this.wd.item(a) };
    };
    PolarBase.prototype.n1 = function (a) {
        _super.prototype.n1.call(this, a);
        this.a9.exportTrendlineData(this, a, this.vv.cy.g$j);
    };
    PolarBase.prototype.getDataLegendSeriesContextAt = function (a, b) {
        var c = { $type: Point_$type, x: a, y: b };
        var d = this.jr(c);
        var e = d == null ? NaN : this.h1(d, "RadiusMemberPath");
        var f = d == null ? NaN : this.h1(d, "AngleMemberPath");
        var g = new DataLegendSeriesValueInfo();
        g.l = e;
        g.a = 11;
        g.q = this.xu != null ? this.xu : "Radius";
        g.p = "Radius";
        g.r = this.xq != null ? this.xq : "R:";
        g.s = this.xs != null ? this.xs : "";
        var h = new DataLegendSeriesValueInfo();
        h.l = f;
        h.a = 10;
        h.q = this.xc != null ? this.xc : "Angle";
        h.p = "Angle";
        h.r = this.w8 != null ? this.w8 : "A:";
        h.s = this.xa != null ? this.xa : "";
        var i = new DataLegendSeriesContext();
        i.f = ((function () {
            var $ret = new List$1(DataLegendSeriesValueInfo.$, 0);
            $ret.add(g);
            $ret.add(h);
            return $ret;
        })());
        i.b = this.aw();
        return i;
    };
    PolarBase.$t = markType(PolarBase, 'PolarBase', MarkerSeries.$);
    PolarBase.yb = DependencyProperty.i("ActualTrendLineBrush", Brush.$, PolarBase.$, new PropertyMetadata(2, null, function (a, b) { return a.raisePropertyChanged("ActualTrendLineBrush", b.oldValue, b.newValue); }));
    PolarBase.$$p = markDep(DependencyProperty, PropertyMetadata, PolarBase, 'raisePropertyChanged', ['AngleAxis:vr:yc', [NumericAngleAxis.$, null], 'AngleMemberAsLegendLabel:w8:yd', [2, null], 'AngleMemberAsLegendUnit:xa:ye', [2, null], 'AngleMemberPath:xc:yf', [2], 'ClipSeriesToBounds:wi:yg', [0, false], 'HighlightedAngleMemberPath:xf:yh', [2, null], 'HighlightedRadiusMemberPath:xh:yi', [2, null], 'IsCustomPolarMarkerStyleAllowed:wk:yj', [0, false], 'IsCustomPolarStyleAllowed:wl:yk', [0, false], 'ItemSearchMode:v7:yl', [ScatterItemSearchMode_$type, enumGetBox(ScatterItemSearchMode_$type, 0)], 'ItemSearchThreshold:w1:ym', [1, 10000], 'MaximumMarkers:w2:yn', [1, 400], 'RadiusAxis:vs:yo', [NumericRadiusAxis.$, null], 'RadiusMemberAsLegendLabel:xq:yp', [2, null], 'RadiusMemberAsLegendUnit:xs:yq', [2, null], 'RadiusMemberPath:xu:yr', [2], 'UseCartesianInterpolation:ws:yz', [0, true], 'TrendLineType:v9:yx', [TrendLineType_$type, enumGetBox(TrendLineType_$type, 0)], 'TrendLineThickness:w0:yw', [1, 1.5], 'TrendLinePeriod:w3:yv', [1, 7], 'TrendLineZIndex:w4:yy', [1, 1], 'TrendLineBrush:y1:ys', [Brush.$, null], 'TrendLineDashArray:y2:yt', [DoubleCollection.$], 'TrendLineDashCap:y3:yu', [PenLineCap_$type, enumGetBox(PenLineCap_$type, 0)]]);
    return PolarBase;
}(MarkerSeries));
export { PolarBase };
/**
 * @hidden
 */
var PolarSeriesRenderManager = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(PolarSeriesRenderManager, _super);
    function PolarSeriesRenderManager() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.aw = null;
        _this.ax = null;
        return _this;
    }
    PolarSeriesRenderManager.prototype.c = function () {
        this.aw = new AssigningPolarMarkerStyleEventArgs();
        return this.aw;
    };
    PolarSeriesRenderManager.prototype.a = function () {
        this.ax = new AssigningPolarStyleEventArgs();
        return this.ax;
    };
    PolarSeriesRenderManager.prototype.ay = function (a, b, c) {
        this.w(a, b, c);
    };
    PolarSeriesRenderManager.prototype.az = function (a, b, c) {
        this.x(a, b, c);
    };
    PolarSeriesRenderManager.prototype.a0 = function (a, b, c, d) {
        if (b == -1) {
            a.c = false;
            a.o = 0;
            a.n = c - 1;
        }
        else {
            if (d) {
                a.o = b;
                a.n = b;
            }
            else {
                a.c = false;
                a.o = b;
                a.n = b;
            }
        }
    };
    PolarSeriesRenderManager.$t = markType(PolarSeriesRenderManager, 'PolarSeriesRenderManager', SeriesRenderManager.$);
    return PolarSeriesRenderManager;
}(SeriesRenderManager));
export { PolarSeriesRenderManager };
/**
 * @hidden
 */
var PolarBaseView = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(PolarBaseView, _super);
    function PolarBaseView(a) {
        var _this = _super.call(this, a) || this;
        _this.cx = null;
        _this.cw = null;
        _this.cy = null;
        _this.cz = null;
        _this.cx = a;
        _this.cz = new HashPool$2(Base.$, Marker.$);
        _this.ck(_this.cz);
        _this.cy = new PolarTrendLineManager();
        return _this;
    }
    PolarBaseView.prototype.au = function () {
        _super.prototype.au.call(this);
        this.cw = this.cv();
        if (!this.q) {
            this.cx.w2 = 1000;
            this.b4.ua = Defaults.e;
        }
    };
    PolarBaseView.prototype.c2 = function (a) {
        this.cz.g(a);
    };
    PolarBaseView.prototype.cv = function () {
        var _this = this;
        var a = new NumericMarkerManager(0, function (b) { return _this.cz.item(b); }, function (b) { return _this.cx.vu.c.item(b); }, runOn(this, this.c3), runOn(this, this.cu), runOn(this, this.c0));
        a.n = true;
        a.p = runOn(this.cx, this.cx.y4);
        return a;
    };
    PolarBaseView.prototype.c3 = function (a) {
        this.cx.x9(a, this.cz);
    };
    PolarBaseView.prototype.cu = function () {
        return this.cx.vf(this.cz, this.by, this.bx);
    };
    PolarBaseView.prototype.c0 = function () {
        return this.cx.wu(this.cz);
    };
    PolarBaseView.prototype.c1 = function (a, b, c, d) {
        if (this.cx.wi) {
            var e = new GeometryGroup();
            this.cx.vs.n2(e, a, b, c, d);
        }
        else {
        }
    };
    PolarBaseView.prototype.c4 = function () {
        if (this.cx.y1 != null) {
            this.cx.y0 = this.cx.y1;
        }
        else {
            this.cx.y0 = this.cx.ss;
        }
    };
    PolarBaseView.prototype.ci = function (a) {
        this.cz.f(a);
    };
    PolarBaseView.prototype.a7 = function (a, b) {
        if (a.d) {
            if (this.cx.v9 != 0 && !b) {
                var c = this.cy.g$j;
                c.ad = this.cx.w0;
                c._stroke = this.cx.y0;
                c.aj = this.cx.y3;
                c.ai = this.cx.y2;
                a.v(c);
            }
        }
        _super.prototype.a7.call(this, a, b);
    };
    PolarBaseView.prototype.c5 = function () {
        return Rect.empty;
    };
    PolarBaseView.prototype.getDefaultTooltipTemplate = function () {
        var a = "<div class='ui-chart-default-tooltip-content'><span>" + "${item." + this.cx.xc + "}" + "</span><br/><span";
        var b = this.e.a7.a$r(this.e);
        if (!stringIsNullOrEmpty(b)) {
            a += " style='color:" + b + "'";
        }
        a += ">" + this.cx.title + ": </span><span class='ui-priority-primary'>" + "${item." + this.cx.xu + "}</span></div>";
        return a;
    };
    PolarBaseView.$t = markType(PolarBaseView, 'PolarBaseView', MarkerSeriesView.$);
    return PolarBaseView;
}(MarkerSeriesView));
export { PolarBaseView };
