/*
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 "igniteui-react-core";
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 { PolarTrendLineManager } from "./PolarTrendLineManager";
import { TrendResolutionParams } from "./TrendResolutionParams";
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.yq = null;
        _this.yh = null;
        _this.yo = null;
        _this.ab7 = null;
        _this.ab6 = null;
        _this.ab5 = null;
        _this.y2 = null;
        _this.y9 = null;
        _this.za = null;
        _this.yu = new PolarFrame();
        _this.yw = new PolarFrame();
        _this.ys = new PolarFrame();
        _this.yn = null;
        _this.zs = null;
        _this.yy = 1;
        _this.ze = false;
        _this.zd = false;
        _this.y7 = null;
        _this.y8 = null;
        _this.assigningPolarStyle = null;
        _this.assigningPolarMarkerStyle = null;
        _this.yx = null;
        _this.yv = null;
        _this.yr = null;
        _this.yx = new PolarSeriesRenderManager();
        _this.yz = _this.y0();
        _this.yv = new PolarFrame();
        _this.yw.x = runOn(_this, _this.ab4);
        _this.yu.x = runOn(_this, _this.ab4);
        _this.ys.x = runOn(_this, _this.ab4);
        _this.y2 = new SeriesRenderer$2(PolarFrame.$, PolarBaseView.$, 0, runOn(_this, _this.aa5), runOn(_this, _this.aa9), runOn(_this, _this.d1), runOn(_this, _this.r1), runOn(_this, _this.aay));
        return _this;
    }
    PolarBase.prototype.cq = function () {
        return new PolarBaseView(this);
    };
    PolarBase.prototype.qx = function (a) {
        _super.prototype.qx.call(this, a);
        this.yp = a;
    };
    PolarBase.prototype.o0 = function () {
        _super.prototype.o0.call(this);
        this.yl = null;
        this.ym = null;
    };
    PolarBase.prototype.get_fn = function () {
        return true;
    };
    PolarBase.prototype.d9 = function (a, b, c, d) {
        var _this = this;
        if (!this.hasMarkers) {
            return false;
        }
        var e = this.yl;
        var f = new ScalerParams(1, this.c9.vl, this.wl, e.ch);
        f.c = this.getEffectiveViewport1(this.ct);
        var g = this.ym;
        var h = new ScalerParams(1, this.c9.vl, this.wl, g.ch);
        h.c = this.getEffectiveViewport1(this.ct);
        a.clear();
        this.wy.cj(function (i) {
            if (i._visibility == 0) {
                var j = new SeriesPointOfInterest();
                var k = i.n;
                var l = i.o;
                if (k < _this.wl.left || k > _this.wl.right || l < _this.wl.top || l > _this.wl.bottom) {
                    return;
                }
                var m = void 0;
                var n = void 0;
                var o = _this.yn.f(k, l, _this.ct.by, _this.ct.bx, _this.ct.getEffectiveViewport(), m, n);
                m = o.p5;
                n = o.p6;
                j.d = m;
                j.e = n;
                j.b = i.content;
                j.g = _this.va;
                j.c = i.ak;
                if (_this.g7) {
                    j.g = _this.vh(i.ak);
                }
                a.add(j);
            }
        });
        return true;
    };
    PolarBase.prototype.aay = function () {
        if (this.da.g) {
            this.da.t();
        }
    };
    PolarBase.prototype.aa0 = function () {
        this.yn.e(this.yq.w, this.zb, this.zc, this.ab7, this.ab6, this.ab5, function (a, b) { return Math.cos(b); }, function (a, b) { return Math.sin(b); }, true);
    };
    PolarBase.prototype.f9 = function () {
        return this.highlightedItemsSource != null || (this.aag != null && this.aae != null);
    };
    PolarBase.prototype.zq = function () {
        return false;
    };
    PolarBase.prototype.hr = function () {
        var a = _super.prototype.hr.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.aa1));
            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.aa2));
            a.add(c);
        }
        if (this.zq()) {
            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.zq()) {
            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.rv));
            a.add(e);
        }
        if (!this.zq()) {
            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.rv));
            a.add(f);
        }
        return a;
    };
    PolarBase.prototype.aa2 = function (a, b) {
        if (this.aag != null) {
            b.value = this.aag;
            return;
        }
        b.value = this.aat;
    };
    PolarBase.prototype.aa1 = function (a, b) {
        if (this.aae != null) {
            b.value = this.aae;
            return;
        }
        b.value = this.aab;
    };
    Object.defineProperty(PolarBase.prototype, "zb", {
        get: function () {
            return this.y9;
        },
        set: function (a) {
            if (this.y9 != a) {
                var b = this.zb;
                this.y9 = a;
                this.raisePropertyChanged("AngleColumn", b, this.zb);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(PolarBase.prototype, "zc", {
        get: function () {
            return this.za;
        },
        set: function (a) {
            if (this.za != a) {
                var b = this.zc;
                this.za = a;
                this.raisePropertyChanged("RadiusColumn", b, this.zc);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(PolarBase.prototype, "abz", {
        get: function () {
            return this.c(PolarBase.aba);
        },
        set: function (a) {
            this.h(PolarBase.aba, a);
        },
        enumerable: false,
        configurable: true
    });
    PolarBase.prototype.yt = function () {
        var a = this.ys;
        if (this.d1()) {
            if (this.da.g) {
                this.da.t();
            }
            a = this.yw;
        }
        return a;
    };
    PolarBase.prototype.p6 = function () {
        _super.prototype.p6.call(this);
        if (this.ym != null) {
            this.ym.h9(false);
        }
        if (this.yl != null) {
            this.yl.h9(false);
        }
    };
    PolarBase.prototype.o9 = function (a, b, c, d) {
        var e = false;
        this.yp.c0.g$e(a, b, c, d);
        if (this.yl != null && !this.yl.c1()) {
            e = true;
        }
        if (this.ym != null && !this.ym.c1()) {
            e = true;
        }
        if (e) {
            this.rn(true);
        }
    };
    PolarBase.prototype.sk = function (a, b) {
        this.rn(false);
    };
    PolarBase.prototype.sl = function (a, b) {
        this.rn(false);
    };
    PolarBase.prototype.hc = function (a, b, c) {
        var d = true;
        if (!_super.prototype.hc.call(this, a, b, c) || !c.o() || b.isEmpty || a.isEmpty || this.yl == null || this.ym == null || this.zb == null || this.zc == null || this.zb.count == 0 || this.zc.count == 0 || this.dl == null || this.dl.count != this.zb.count || this.dl.count != this.zc.count || this.yn == null || this.yl.bi == null || this.ym.bi == null || this.yl.ly == this.yl.lx || this.ym.ly == this.ym.lx) {
            d = false;
        }
        return d;
    };
    PolarBase.prototype.ro = function (a) {
        _super.prototype.ro.call(this, a);
        var b;
        var c;
        var d = this.getViewInfo(c, b);
        c = d.p0;
        b = d.p1;
        if (!this.hc(c, b, this.ct)) {
            this.o3(true, this.ct);
            return;
        }
        this.ab7 = b;
        this.ab6 = c;
        this.ab5 = this.ct.getEffectiveViewport();
        this.yo = new PolarAxisInfoCache(this.yl, this.ym, this.dl);
        var e = new SeriesRenderingArguments(this, c, b, a, this.gp);
        var f = this.y2.g(e, this.yu, this.ys, this.yw, this.yp);
        this.yu = f.p1;
        this.ys = f.p2;
        this.yw = f.p3;
    };
    PolarBase.prototype.ab4 = function (a) {
        var b = this.yn.h(a.x, a.y, this.ab7, this.ab6, this.ab5, this.yo.e, this.yo.d, this.yo.g, this.yo.f, this.yo.i, this.yo.h);
        return b;
    };
    PolarBase.prototype.ax = function (a) {
        if (a != null && a == this.yl && this.zb != null) {
            return new AxisRange(this.zb.minimum, this.zb.maximum);
        }
        if (a != null && a == this.ym && this.zc != null) {
            return new AxisRange(this.zc.minimum, this.zc.maximum);
        }
        return null;
    };
    PolarBase.prototype.gb = function (a) {
        var b = this.ct.by;
        b = b.copy();
        var c = this.ct.bx;
        var d = !b.isEmpty && !c.isEmpty && this.dl != null ? this.dl.indexOf(a) : -1;
        if (this.yl == null || this.zb == null || this.ym == null || this.zc == null) {
            return false;
        }
        if (d < 0 || d > this.zb.count - 1 || d > this.zc.count - 1) {
            return false;
        }
        var e = this.yl.getScaledAngle(this.zb.item(d));
        var f = this.ym.nv(this.zc.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.c1 != null) {
            this.c1.au(this.c9, b, true);
        }
        return d >= 0;
    };
    PolarBase.prototype.kl = function (a) {
        var b = this.j1(a);
        if (this.dl != null && b >= 0 && b < this.dl.count) {
            return this.dl.item(b);
        }
        return null;
    };
    PolarBase.prototype.j1 = function (a) {
        var b = truncate(Math.round(this.ip(a)));
        return b;
    };
    PolarBase.prototype.ip = function (a) {
        switch (this.yz) {
            case 1: return this.zw(a);
            case 3: return this.zx(a);
            case 2: return this.zu(a);
            case 4: return this.zv(a);
        }
        return -1;
    };
    PolarBase.prototype.zv = function (a) {
        return this.zy(a, false);
    };
    PolarBase.prototype.zu = function (a) {
        var b = this.v1(a);
        var c = b.x;
        var d = b.y;
        if (this.dl == null || this.yl == null || this.ym == null || this.zb == null || this.zc == null) {
            return -1;
        }
        if (this.dl.count > this.z0) {
            return -1;
        }
        if (!this.zi()) {
            return -1;
        }
        var e = this.zs;
        var f = 1.7976931348623157E+308;
        var g = -1;
        for (var h = 0; h < this.zb.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.zi = function () {
        var a = this.ys;
        if (this.d1()) {
            a = this.yw;
        }
        if (a == null || a.w.count == 0) {
            return false;
        }
        this.zs = a.w;
        return true;
    };
    PolarBase.prototype.zy = function (a, b) {
        if (!this.zl) {
            return -1;
        }
        var c = { $type: Point_$type, x: 0, y: 0 };
        var d = true;
        var e = this.ys;
        if (this.d1()) {
            e = this.yw;
        }
        if (e == null) {
            return -1;
        }
        if (e.m == null) {
            return -1;
        }
        if (this.dl == null || this.dl.count > this.z0) {
            return -1;
        }
        if (!this.zi()) {
            return -1;
        }
        var f = this.zs;
        var g = this.v1(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.dl.item(j)) || e.j.containsKey(this.dl.item(j - 1))) {
                    var l = GeometryUtil.g(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.dl.item(i)) && e.j.containsKey(this.dl.item(i - 1)))) {
                var o = GeometryUtil.l(g, n, m);
                return (i - 1) + o;
            }
            else if (e.j.containsKey(this.dl.item(i))) {
                return i;
            }
            else {
                return i - 1;
            }
        }
        return -1;
    };
    PolarBase.prototype.zx = function (a) {
        return this.zy(a, true);
    };
    PolarBase.prototype.zw = function (a) {
        var _this = this;
        var b = null;
        var c = 1.7976931348623157E+308;
        var d = this.v1(a);
        var e = d.x;
        var f = d.y;
        if (this.yp.c1.e > this.z0) {
            return -1;
        }
        this.yp.c4(function (g) {
            if (g._visibility == 0) {
                var h = _this.yp.cu(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.v6 = function (a, b, c) {
        var _this = this;
        if (this.yl == null || this.ym == null || this.zb == null || this.zc == null) {
            return { $type: Point_$type, x: NaN, y: NaN };
        }
        var d = this.ct.by;
        var e = this.ct.bx;
        var f = this.getEffectiveViewport();
        var g = new ScalerParams(0, d, e, this.yl.ch, f);
        var h = ((function () {
            var $ret = new ScalerParams(0, d, e, _this.ym.ch, f);
            $ret.b = _this.iw();
            return $ret;
        })());
        if (b) {
            var i = this.ip(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.dl.count - 1) {
                k = this.dl.count - 1;
            }
            if (j > this.dl.count - 1) {
                j = this.dl.count - 1;
            }
            if (k == j) {
                return this.yn.h(this.zb.item(j), this.zc.item(j), d, e, f, this.yo.e, this.yo.d, this.yo.g, this.yo.f, this.yo.i, this.yo.h);
            }
            var l = i - Math.floor(i);
            var m = this.yn.h(this.zb.item(j), this.zc.item(j), d, e, f, this.yo.e, this.yo.d, this.yo.g, this.yo.f, this.yo.i, this.yo.h);
            var n = this.yn.h(this.zb.item(k), this.zc.item(k), d, e, f, this.yo.e, this.yo.d, this.yo.g, this.yo.f, this.yo.i, this.yo.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.j1(a);
            if (u == -1) {
                return { $type: Point_$type, x: NaN, y: NaN };
            }
            return this.yn.h(this.zb.item(u), this.zc.item(u), d, e, f, this.yo.e, this.yo.d, this.yo.g, this.yo.f, this.yo.i, this.yo.h);
        }
    };
    PolarBase.prototype.ai = function () {
        return [this.yl, this.ym];
    };
    PolarBase.prototype.ko = function (a, b) {
        var c = this.nb(b);
        if (c == PolarBase.$$p[3]) {
            return this.kp(a, b, this.aab);
        }
        if (c == PolarBase.$$p[15]) {
            return this.kp(a, b, this.aat);
        }
        if (c == PolarBase.$$p[5]) {
            return this.kp(a, b, this.aae);
        }
        if (c == PolarBase.$$p[6]) {
            return this.kp(a, b, this.aag);
        }
        return _super.prototype.ko.call(this, a, b);
    };
    PolarBase.prototype.mb = function (a) {
        var b = this.nb(a);
        if (b == PolarBase.$$p[3]) {
            return this.aab;
        }
        if (b == PolarBase.$$p[15]) {
            return this.aat;
        }
        if (b == PolarBase.$$p[5]) {
            return this.aae;
        }
        if (b == PolarBase.$$p[6]) {
            return this.aag;
        }
        return _super.prototype.mb.call(this, a);
    };
    PolarBase.prototype.q5 = function (a, b, c, d) {
        _super.prototype.q5.call(this, a, b, c, d);
        if (this.yp.c0.g$b(a, b, c, d)) {
            this.rn(false);
            this.qh();
        }
        switch (b) {
            case PolarBase.$$p[1]:
            case PolarBase.$$p[2]:
            case PolarBase.$$p[13]:
            case PolarBase.$$p[14]:
                this.qb();
                break;
            case "FastItemsSource":
                if (typeCast(IFastItemsSource_$type, c) != null) {
                    c.deregisterColumn(this.zb);
                    c.deregisterColumn(this.zc);
                    this.zb = null;
                    this.zc = null;
                }
                if (typeCast(IFastItemsSource_$type, d) != null) {
                    this.zb = this.di(this.aab);
                    this.zc = this.di(this.aat);
                }
                if ((this.ym != null && !this.ym.c1()) || (this.yl != null && !this.yl.c1())) {
                    this.rn(this.ge && c != null);
                }
                break;
            case PolarBase.$$p[0]:
                if (this.yl != null && this.ym != null) {
                    this.yn = new PolarAxes(this.ym, this.yl);
                }
                if (c != null) {
                    c.b0(this);
                }
                if (d != null) {
                    d.ct(this);
                }
                if (this.yl != null && !this.yl.c1()) {
                    this.rn(false);
                }
                else if (c != null && d == null) {
                    this.o3(true, this.ct);
                }
                break;
            case PolarBase.$$p[12]:
                if (this.yl != null && this.ym != null) {
                    this.yn = new PolarAxes(this.ym, this.yl);
                }
                if (c != null) {
                    c.b0(this);
                }
                if (d != null) {
                    d.ct(this);
                }
                if (this.ym != null && !this.ym.c1()) {
                    this.rn(false);
                }
                else if (c != null && d == null) {
                    this.o3(true, this.ct);
                }
                if (this.yl != null && !this.yl.c1()) {
                    this.yl.h5();
                }
                break;
            case PolarBase.$$p[3]:
                if (this.dl != null) {
                    this.dl.deregisterColumn(this.zb);
                    this.zb = this.di(this.aab);
                }
                break;
            case "AngleColumn":
                this.yp.c0.g$i();
                if (this.yl != null && !this.yl.c1()) {
                    this.rn(this.ge && this.d5);
                }
                break;
            case PolarBase.$$p[15]:
                if (this.dl != null) {
                    this.dl.deregisterColumn(this.zc);
                    this.zc = this.di(this.aat);
                }
                break;
            case "RadiusColumn":
                this.yp.c0.g$i();
                if (this.ym != null && !this.ym.c1()) {
                    this.rn(this.ge && this.d5);
                }
                break;
            case PolarBase.$$p[16]:
                this.rn(false);
                this.qh();
                break;
            case PolarBase.$$p[11]:
                this.rn(false);
                this.qh();
                break;
            case "TransitionProgress":
                this.yo = new PolarAxisInfoCache(this.yl, this.ym, this.dl);
                this.ab7 = this.ct.by;
                this.ab6 = this.ct.bx;
                this.ab5 = this.ct.getEffectiveViewport();
                this.yw.v = this.zr;
                this.yw.c(this.jo, this.yu, this.ys);
                if (this.d3(this.ct)) {
                    return;
                }
                if (this.jo == 1) {
                    this.aa9(this.ys, this.yp);
                    this.qk();
                }
                else {
                    this.aa9(this.yw, this.yp);
                }
                if (this.c9 != null) {
                    this.c9.qa(this);
                }
                break;
            case "TrendLineBrush":
                this.rb(b);
                break;
            case PolarBase.$$p[4]:
                this.rn(false);
                this.qh();
                break;
            case "TrendLineType":
                this.qh();
                break;
            case PolarBase.$$p[8]:
                this.ze = this.zn();
                this.rn(false);
                break;
            case PolarBase.$$p[7]:
                this.zd = this.zm();
                this.rn(false);
                break;
            case PolarBase.$$p[9]:
                this.yz = this.y0();
                break;
        }
    };
    Object.defineProperty(PolarBase.prototype, "yz", {
        get: function () {
            return this.yy;
        },
        set: function (a) {
            var b = this.yy;
            this.yy = a;
            if (b != this.yy) {
                this.raisePropertyChanged("ActualItemSearchMode", enumGetBox(ScatterItemSearchMode_$type, b), enumGetBox(ScatterItemSearchMode_$type, this.yy));
            }
        },
        enumerable: false,
        configurable: true
    });
    PolarBase.prototype.y0 = function () {
        if (this.y1 != 0) {
            return this.y1;
        }
        return this.zl ? 4 : 1;
    };
    PolarBase.prototype.get_zl = function () {
        return false;
    };
    Object.defineProperty(PolarBase.prototype, "zl", {
        get: function () {
            return this.get_zl();
        },
        enumerable: false,
        configurable: true
    });
    PolarBase.prototype.zn = function () {
        return this.zk;
    };
    PolarBase.prototype.zm = function () {
        return this.zj;
    };
    PolarBase.prototype.zg = function (a) {
        if (typeCast(NumericRadiusAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    PolarBase.prototype.zf = function (a) {
        if (typeCast(NumericAngleAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    PolarBase.prototype.o3 = function (a, b) {
        _super.prototype.o3.call(this, a, b);
        var c = b;
        if (a) {
            c.c1.clear();
        }
        c.c0.g$d();
    };
    PolarBase.prototype.yi = 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.aax = function (a, b, c, d) {
        a.g = new Dictionary$2(Base.$, OwnedPoint.$, 1, b);
        var e = this.dl;
        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.zb.item(f), y: this_1.zc.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.aa5 = function (a, b) {
        var _this = this;
        var c = b.by;
        var d = b.bx;
        var e = b.getEffectiveViewport();
        a.j.clear();
        a.n.clear();
        var f = Math.min(this.zb != null ? this.zb.count : 0, this.zc != null ? this.zc.count : 0);
        if (f < 1) {
            return;
        }
        this.yo = new PolarAxisInfoCache(this.yl, this.ym, this.dl);
        this.yq = a;
        this.ab6 = d;
        this.ab7 = c;
        this.ab5 = b.getEffectiveViewport();
        b.cy.l(a.j, this.z1, c, d, this.ib);
        if (f <= this.z1) {
            this.aax(a, f, c, d);
        }
        var g = this.yi(d, a.n);
        var h = Math.min(this.yl.ly, this.yl.lx);
        var i = Math.max(this.yl.lx, this.yl.ly);
        b.c0.i = this.zr;
        b.c0.h = 0;
        b.c0.k = this.ym.np;
        b.c0.j = this.ym.no;
        b.c0.l = function (j, k) { return _this.yn.c(j, k, c, d, e, Math.cos); };
        b.c0.m = function (j, k) { return _this.yn.d(j, k, c, d, e, Math.sin); };
        var j = new List$1(Number_$type, 0);
        for (var k = 0; k < this.zb.count; k++) {
            if (this.zb.item(k) >= h && this.zb.item(k) <= i) {
                j.add(this.zb.item(k));
            }
        }
        var l = this.zc;
        if (j.count != this.zb.count) {
            l = new List$1(Number_$type, 0);
            for (var m = 0; m < this.zb.count; m++) {
                if (this.zb.item(m) >= h && this.zb.item(m) <= i) {
                    l.add(this.zc.item(m));
                }
            }
        }
        b.c0.n(a.n, this.y3, j, l, this.z2, runOn(this.yl, this.yl.getScaledAngle), runOn(this.ym, this.ym.nv), ((function () {
            var $ret = new TrendResolutionParams();
            $ret.d = _this.ib;
            $ret.i = d;
            $ret.h = e;
            $ret.j = c;
            return $ret;
        })()), g, h, i);
    };
    PolarBase.prototype.get_fc = function () {
        return true;
    };
    PolarBase.prototype.y5 = function (a, b, c) {
        return null;
    };
    PolarBase.prototype.y6 = function (a, b, c) {
        if (this.dl == null) {
            return null;
        }
        var d = this.yt();
        var e = this.yp.b1(this.v1(b));
        var f = -1;
        if (e == null) {
            if (a != null) {
                f = this.dl.indexOf(a);
            }
            else {
                return null;
            }
        }
        else {
            f = e.ak;
        }
        if (f == -1) {
            return null;
        }
        var g = new HighlightingInfo();
        g.i = this;
        g.g = f;
        g.f = f;
        g.c = false;
        g.d = true;
        if (c != null && c.g == g.g && c.f == g.f) {
            return c;
        }
        return g;
    };
    PolarBase.prototype.y4 = function (a, b, c) {
        var d = new HighlightingInfo();
        d.i = this;
        d.g = 0;
        d.f = this.dl.count - 1;
        d.c = true;
        if (c != null && c.g == d.g && c.f == d.f) {
            return c;
        }
        return d;
    };
    PolarBase.prototype.de = function (a, b, c) {
        if (this.eb && this.fx(this.bv) && !c) {
            var d = this.y5(a, b, this.y7);
            this.y7 = d;
            return d;
        }
        else {
            var e = this.y4(a, b, this.y7);
            this.y7 = e;
            return e;
        }
    };
    PolarBase.prototype.df = function (a, b, c) {
        if (this.fx(this.bv) && !c) {
            var d = this.y6(a, b, this.y8);
            this.y8 = d;
            return d;
        }
        else {
            var e = this.y4(a, b, this.y8);
            e.d = true;
            this.y8 = e;
            return e;
        }
    };
    PolarBase.prototype.zp = function () {
        return (this.assigningPolarStyle != null && this.ze) || (this.bv != 1) || this.d0 || (this.cn != 1) || (this.cm != 1);
    };
    PolarBase.prototype.zo = function () {
        return (this.assigningPolarMarkerStyle != null && this.zd) || this.d0 || (this.bv != 1) || (this.cn != 1) || (this.cm != 1);
    };
    PolarBase.prototype.aa9 = function (a, b) {
        this.qt();
        var c = b.by;
        var d = b.bx;
        var e = this.getEffectiveViewport1(b);
        var f = this.wd(b);
        this.yo = new PolarAxisInfoCache(this.yl, this.ym, this.dl);
        if (this.w8()) {
            b.cy.j(a.j, this.xa);
            if (this.zo()) {
                this.aaz(b, a);
            }
        }
        b.cr();
        var g = this.yi(d, b.c0.g$j.an);
        b.c0.g$h(a.n, g);
        this.aaw(d, c, e, f, b);
    };
    PolarBase.prototype.yf = function (a, b) {
        return this.yg(a, b);
    };
    PolarBase.prototype.yg = function (a, b) {
        if (b < a || a < 0 || a > this.zb.count || b < 0 || b > this.zb.count) {
            return null;
        }
        var c = new Array((b - a) + 1);
        for (var d = a; d <= b; d++) {
            var e = d;
            c[d - a] = this.dl.item(d);
        }
        return c;
    };
    PolarBase.prototype.aaz = function (a, b) {
        var _this = this;
        a.b7 = true;
        this.yx.ay(this, this.zo(), runOn(this, this.yf));
        var c = this.yx.d;
        var d = c != null;
        var e = this.getEffectiveViewport1(a);
        var f = this.dl == null ? 0 : this.dl.count;
        this.yp.cj(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.aa3(h, f, a.q);
                }
                _this.yx.ac(g, i);
            }
        });
    };
    PolarBase.prototype.aa4 = function (a, b, c) {
        var d = this.bv != 1;
        var e = this.cn != 1;
        var f = this.cm != 1;
        this.yx.a0(this.yx.b, a, b, false);
        this.yx.ab(this.h9);
        var g = this.yx.ax;
        var h = null;
        var i = null;
        var j = null;
        var k = this.dl;
        if (d && this.c9 != null) {
            h = this.c9.dj.getHighlightingInfo(this, k, g.z, g.y, false);
            g.c = h;
        }
        if (e && this.c9 != null) {
            i = this.c9.dk.getHighlightingInfo(this, k, g.z, g.y, false);
            if (i == null && this.bl != null) {
                i = this.c9.dk.getHighlightingInfo(this.bl, this.bl.dl, g.z, g.y, false);
            }
            g.d = i;
        }
        if (f && this.c9 != null) {
            j = this.c9.di.getHighlightingInfo(this, k, g.z, g.y, false);
            g.b = j;
        }
        g.h = c;
        this.aa7(g);
        this.yx.z(this, h, i, j, c, d, e, f, a < 0);
    };
    PolarBase.prototype.aa3 = function (a, b, c) {
        var d = this.bv != 1;
        var e = this.cn != 1;
        var f = this.cm != 1;
        this.yx.a0(this.yx.d, a, b, true);
        this.yx.aa(this.h9);
        var g = this.yx.aw;
        var h = null;
        var i = null;
        var j = null;
        var k = this.dl;
        var l = null;
        var m = null;
        var n = null;
        if (d && this.c9 != null) {
            h = this.c9.dj.getHighlightingInfo(this, k, g.z, g.y, true);
            if (this.c9.dj.isCrossContextHighlight(this)) {
                l = this.c9.dj.getHighlightingInfo(this, k, g.z, g.y, true);
            }
            g.c = h;
        }
        if (e && this.c9 != null) {
            i = this.c9.dk.getHighlightingInfo(this, k, g.z, g.y, true);
            if (i == null && this.bl != null) {
                i = this.c9.dk.getHighlightingInfo(this.bl, this.bl.dl, g.z, g.y, true);
            }
            if (this.c9.dk.isCrossContextHighlight(this)) {
                m = this.c9.dk.getHighlightingInfo(this, k, g.z, g.y, true);
            }
            g.d = i;
        }
        if (f && this.c9 != null) {
            j = this.c9.di.getHighlightingInfo(this, k, g.z, g.y, true);
            if (this.c9.di.isCrossContextHighlight(this)) {
                n = this.c9.di.getHighlightingInfo(this, k, g.z, g.y, true);
            }
            g.d = i;
        }
        g.h = c;
        this.aa6(g);
        this.yx.y(this, h, i, j, c, d, e, f, g.v, this.c9.dj.totalHighWaterMark, g.x, this.c9.dk.totalHighWaterMark, g.t, this.c9.di.totalHighWaterMark);
    };
    PolarBase.prototype.aa7 = function (a) {
        if (this.assigningPolarStyle != null && this.ze) {
            this.assigningPolarStyle(this, a);
        }
    };
    PolarBase.prototype.aa6 = function (a) {
        if (this.assigningPolarMarkerStyle != null && this.zd) {
            this.assigningPolarMarkerStyle(this, a);
        }
    };
    PolarBase.prototype.aaw = function (a, b, c, d, e) {
        e.c3(a, b, c, d);
    };
    PolarBase.prototype.sb = function () {
        _super.prototype.sb.call(this);
        if (this.index < 0) {
            return;
        }
        this.yp.c6();
    };
    PolarBase.prototype.rp = function (a, b) {
        _super.prototype.rp.call(this, a, b);
        if (!this.gy) {
            this.ct.a4(b);
            return;
        }
        this.ct.a4(b);
        if (this.d3(this.cs)) {
            return;
        }
        var c = this.cs;
        if (!this.gq) {
            this.yv = new PolarFrame();
            this.aa5(this.yv, c);
        }
        this.gq = false;
        this.aa9(this.yv, c);
        this.gy = false;
    };
    PolarBase.prototype.rm = function (a, b, c, d, e) {
        _super.prototype.rm.call(this, a, b, c, d, e);
        var f = this.a9.a$j.item(d);
        var g = f;
        f.a3(c);
        if (this.d3(g)) {
            return;
        }
        if (this.yr == null) {
            this.yr = new PolarFrame();
        }
        this.aa5(this.yr, g);
        this.aa9(this.yr, g);
    };
    PolarBase.prototype.aa8 = 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.ye = function (a, b, c) {
        this.aa0();
        return this.yq.w.toArray();
    };
    PolarBase.prototype.zt = function (a) {
        var e_3, _a;
        var b = new List$1(Number_$type, 0);
        var c = this.dl;
        try {
            for (var _b = __values(fromEnum(this.yp.c1.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.ab3 = function (a) {
        return { $type: Point_$type, x: this.zb.item(a), y: this.zc.item(a) };
    };
    PolarBase.prototype.pv = function (a) {
        _super.prototype.pv.call(this, a);
        this.bb.exportTrendlineData(this, a, this.yp.c0.g$j);
    };
    PolarBase.prototype.getDataLegendSeriesContextAt = function (a, b) {
        var c = { $type: Point_$type, x: a, y: b };
        var d = this.kl(c);
        var e = d == null ? NaN : this.iv(d, "RadiusMemberPath");
        var f = d == null ? NaN : this.iv(d, "AngleMemberPath");
        var g = new DataLegendSeriesValueInfo();
        g.l = e;
        g.a = 11;
        g.r = this.aat != null ? this.aat : "Radius";
        g.q = "Radius";
        g.s = this.aap != null ? this.aap : "R:";
        g.t = this.aar != null ? this.aar : "";
        var h = new DataLegendSeriesValueInfo();
        h.l = f;
        h.a = 10;
        h.r = this.aab != null ? this.aab : "Angle";
        h.q = "Angle";
        h.s = this.z7 != null ? this.z7 : "A:";
        h.t = this.z9 != null ? this.z9 : "";
        var i = new DataLegendSeriesContext();
        i.e = ((function () {
            var $ret = new List$1(DataLegendSeriesValueInfo.$, 0);
            $ret.add(g);
            $ret.add(h);
            return $ret;
        })());
        i.h = this.ma();
        return i;
    };
    PolarBase.$t = markType(PolarBase, 'PolarBase', MarkerSeries.$);
    PolarBase.aba = 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:yl:abb', [NumericAngleAxis.$, null], 'AngleMemberAsLegendLabel:z7:abc', [2, null], 'AngleMemberAsLegendUnit:z9:abd', [2, null], 'AngleMemberPath:aab:abe', [2], 'ClipSeriesToBounds:zh:abf', [0, false], 'HighlightedAngleMemberPath:aae:abg', [2, null], 'HighlightedRadiusMemberPath:aag:abh', [2, null], 'IsCustomPolarMarkerStyleAllowed:zj:abi', [0, false], 'IsCustomPolarStyleAllowed:zk:abj', [0, false], 'ItemSearchMode:y1:abk', [ScatterItemSearchMode_$type, enumGetBox(ScatterItemSearchMode_$type, 0)], 'ItemSearchThreshold:z0:abl', [1, 10000], 'MaximumMarkers:z1:abm', [1, 400], 'RadiusAxis:ym:abn', [NumericRadiusAxis.$, null], 'RadiusMemberAsLegendLabel:aap:abo', [2, null], 'RadiusMemberAsLegendUnit:aar:abp', [2, null], 'RadiusMemberPath:aat:abq', [2], 'UseCartesianInterpolation:zr:aby', [0, true], 'TrendLineType:y3:abw', [TrendLineType_$type, enumGetBox(TrendLineType_$type, 0)], 'TrendLineThickness:zz:abv', [1, 1.5], 'TrendLinePeriod:z2:abu', [1, 7], 'TrendLineZIndex:z3:abx', [1, 1], 'TrendLineBrush:ab0:abr', [Brush.$, null], 'TrendLineDashArray:ab1:abs', [DoubleCollection.$], 'TrendLineDashCap:ab2:abt', [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.e = false;
            a.z = 0;
            a.y = c - 1;
        }
        else {
            if (d) {
                a.z = b;
                a.y = b;
            }
            else {
                a.e = false;
                a.z = b;
                a.y = 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.cz = null;
        _this.cy = null;
        _this.c0 = null;
        _this.c1 = null;
        _this.cz = a;
        _this.c1 = new HashPool$2(Base.$, Marker.$);
        _this.cm(_this.c1);
        _this.c0 = new PolarTrendLineManager();
        return _this;
    }
    PolarBaseView.prototype.au = function () {
        _super.prototype.au.call(this);
        this.cy = this.cx();
        if (!this.q) {
            this.cz.z1 = 1000;
            this.b4.w2 = Defaults.e;
        }
    };
    PolarBaseView.prototype.c4 = function (a) {
        this.c1.g(a);
    };
    PolarBaseView.prototype.cx = function () {
        var _this = this;
        var a = new NumericMarkerManager(0, function (b) { return _this.c1.item(b); }, function (b) { return _this.cz.yo.c.item(b); }, runOn(this, this.c5), runOn(this, this.cw), runOn(this, this.c2));
        a.n = true;
        a.p = runOn(this.cz, this.cz.ab3);
        return a;
    };
    PolarBaseView.prototype.c5 = function (a) {
        this.cz.aa8(a, this.c1);
    };
    PolarBaseView.prototype.cw = function () {
        return this.cz.ye(this.c1, this.by, this.bx);
    };
    PolarBaseView.prototype.c2 = function () {
        return this.cz.zt(this.c1);
    };
    PolarBaseView.prototype.c3 = function (a, b, c, d) {
        if (this.cz.zh) {
            var e = new GeometryGroup();
            this.cz.ym.n3(e, a, b, c, d);
        }
        else {
        }
    };
    PolarBaseView.prototype.c6 = function () {
        if (this.cz.ab0 != null) {
            this.cz.abz = this.cz.ab0;
        }
        else {
            this.cz.abz = this.cz.u3;
        }
    };
    PolarBaseView.prototype.cj = function (a) {
        this.c1.f(a);
    };
    PolarBaseView.prototype.a7 = function (a, b) {
        if (a.d) {
            if (this.cz.y3 != 0 && !b) {
                var c = this.c0.g$j;
                c.ad = this.cz.zz;
                c._stroke = this.cz.abz;
                c.aj = this.cz.ab2;
                c.ai = this.cz.ab1;
                a.v(c);
            }
        }
        _super.prototype.a7.call(this, a, b);
    };
    PolarBaseView.prototype.c7 = function () {
        return Rect.empty;
    };
    PolarBaseView.prototype.getDefaultTooltipTemplate = function () {
        var a = "<div class='ui-chart-default-tooltip-content'><span>" + "${item." + this.cz.aab + "}" + "</span><br/><span";
        var b = this.e.a9.a$u(this.e);
        if (!stringIsNullOrEmpty(b)) {
            a += " style='color:" + b + "'";
        }
        a += ">" + this.cz.title + ": </span><span class='ui-priority-primary'>" + "${item." + this.cz.aat + "}</span></div>";
        return a;
    };
    PolarBaseView.$t = markType(PolarBaseView, 'PolarBaseView', MarkerSeriesView.$);
    return PolarBaseView;
}(MarkerSeriesView));
export { PolarBaseView };
