/*
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.yp = null;
        _this.yg = null;
        _this.yn = null;
        _this.ab6 = null;
        _this.ab5 = null;
        _this.ab4 = null;
        _this.y1 = null;
        _this.y8 = null;
        _this.y9 = null;
        _this.yt = new PolarFrame();
        _this.yv = new PolarFrame();
        _this.yr = new PolarFrame();
        _this.ym = null;
        _this.zr = null;
        _this.yx = 1;
        _this.zd = false;
        _this.zc = false;
        _this.y6 = null;
        _this.y7 = null;
        _this.assigningPolarStyle = null;
        _this.assigningPolarMarkerStyle = null;
        _this.yw = null;
        _this.yu = null;
        _this.yq = null;
        _this.yw = new PolarSeriesRenderManager();
        _this.yy = _this.yz();
        _this.yu = new PolarFrame();
        _this.yv.x = runOn(_this, _this.ab3);
        _this.yt.x = runOn(_this, _this.ab3);
        _this.yr.x = runOn(_this, _this.ab3);
        _this.y1 = new SeriesRenderer$2(PolarFrame.$, PolarBaseView.$, 0, runOn(_this, _this.aa4), runOn(_this, _this.aa8), runOn(_this, _this.d1), runOn(_this, _this.r0), runOn(_this, _this.aax));
        return _this;
    }
    PolarBase.prototype.cq = function () {
        return new PolarBaseView(this);
    };
    PolarBase.prototype.qw = function (a) {
        _super.prototype.qw.call(this, a);
        this.yo = a;
    };
    PolarBase.prototype.oz = function () {
        _super.prototype.oz.call(this);
        this.yk = null;
        this.yl = 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.yk;
        var f = new ScalerParams(1, this.c9.vl, this.wk, e.ch);
        f.c = this.getEffectiveViewport1(this.ct);
        var g = this.yl;
        var h = new ScalerParams(1, this.c9.vl, this.wk, g.ch);
        h.c = this.getEffectiveViewport1(this.ct);
        a.clear();
        this.wx.cj(function (i) {
            if (i._visibility == 0) {
                var j = new SeriesPointOfInterest();
                var k = i.n;
                var l = i.o;
                if (k < _this.wk.left || k > _this.wk.right || l < _this.wk.top || l > _this.wk.bottom) {
                    return;
                }
                var m = void 0;
                var n = void 0;
                var o = _this.ym.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.u9;
                j.c = i.ak;
                if (_this.g7) {
                    j.g = _this.vg(i.ak);
                }
                a.add(j);
            }
        });
        return true;
    };
    PolarBase.prototype.aax = function () {
        if (this.da.g) {
            this.da.t();
        }
    };
    PolarBase.prototype.aaz = function () {
        this.ym.e(this.yp.w, this.za, this.zb, this.ab6, this.ab5, this.ab4, function (a, b) { return Math.cos(b); }, function (a, b) { return Math.sin(b); }, true);
    };
    PolarBase.prototype.f9 = function () {
        return this.highlightedItemsSource != null || (this.aaf != null && this.aad != null);
    };
    PolarBase.prototype.zp = 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.aa0));
            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.aa1));
            a.add(c);
        }
        if (this.zp()) {
            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.zp()) {
            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.ru));
            a.add(e);
        }
        if (!this.zp()) {
            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.ru));
            a.add(f);
        }
        return a;
    };
    PolarBase.prototype.aa1 = function (a, b) {
        if (this.aaf != null) {
            b.value = this.aaf;
            return;
        }
        b.value = this.aas;
    };
    PolarBase.prototype.aa0 = function (a, b) {
        if (this.aad != null) {
            b.value = this.aad;
            return;
        }
        b.value = this.aaa;
    };
    Object.defineProperty(PolarBase.prototype, "za", {
        get: function () {
            return this.y8;
        },
        set: function (a) {
            if (this.y8 != a) {
                var b = this.za;
                this.y8 = a;
                this.raisePropertyChanged("AngleColumn", b, this.za);
            }
        },
        enumerable: false,
        configurable: true
    });
    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("RadiusColumn", b, this.zb);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(PolarBase.prototype, "aby", {
        get: function () {
            return this.c(PolarBase.aa9);
        },
        set: function (a) {
            this.h(PolarBase.aa9, a);
        },
        enumerable: false,
        configurable: true
    });
    PolarBase.prototype.ys = function () {
        var a = this.yr;
        if (this.d1()) {
            if (this.da.g) {
                this.da.t();
            }
            a = this.yv;
        }
        return a;
    };
    PolarBase.prototype.p5 = function () {
        _super.prototype.p5.call(this);
        if (this.yl != null) {
            this.yl.h9(false);
        }
        if (this.yk != null) {
            this.yk.h9(false);
        }
    };
    PolarBase.prototype.o8 = function (a, b, c, d) {
        var e = false;
        this.yo.c0.g$e(a, b, c, d);
        if (this.yk != null && !this.yk.c1()) {
            e = true;
        }
        if (this.yl != null && !this.yl.c1()) {
            e = true;
        }
        if (e) {
            this.rm(true);
        }
    };
    PolarBase.prototype.sj = function (a, b) {
        this.rm(false);
    };
    PolarBase.prototype.sk = function (a, b) {
        this.rm(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.yk == null || this.yl == null || this.za == null || this.zb == null || this.za.count == 0 || this.zb.count == 0 || this.dl == null || this.dl.count != this.za.count || this.dl.count != this.zb.count || this.ym == null || this.yk.bi == null || this.yl.bi == null || this.yk.ly == this.yk.lx || this.yl.ly == this.yl.lx) {
            d = false;
        }
        return d;
    };
    PolarBase.prototype.rn = function (a) {
        _super.prototype.rn.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.o2(true, this.ct);
            return;
        }
        this.ab6 = b;
        this.ab5 = c;
        this.ab4 = this.ct.getEffectiveViewport();
        this.yn = new PolarAxisInfoCache(this.yk, this.yl, this.dl);
        var e = new SeriesRenderingArguments(this, c, b, a, this.gp);
        var f = this.y1.g(e, this.yt, this.yr, this.yv, this.yo);
        this.yt = f.p1;
        this.yr = f.p2;
        this.yv = f.p3;
    };
    PolarBase.prototype.ab3 = function (a) {
        var b = this.ym.h(a.x, a.y, this.ab6, this.ab5, this.ab4, this.yn.e, this.yn.d, this.yn.g, this.yn.f, this.yn.i, this.yn.h);
        return b;
    };
    PolarBase.prototype.ax = function (a) {
        if (a != null && a == this.yk && this.za != null) {
            return new AxisRange(this.za.minimum, this.za.maximum);
        }
        if (a != null && a == this.yl && this.zb != null) {
            return new AxisRange(this.zb.minimum, this.zb.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.yk == null || this.za == null || this.yl == null || this.zb == null) {
            return false;
        }
        if (d < 0 || d > this.za.count - 1 || d > this.zb.count - 1) {
            return false;
        }
        var e = this.yk.getScaledAngle(this.za.item(d));
        var f = this.yl.nv(this.zb.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.yy) {
            case 1: return this.zv(a);
            case 3: return this.zw(a);
            case 2: return this.zt(a);
            case 4: return this.zu(a);
        }
        return -1;
    };
    PolarBase.prototype.zu = function (a) {
        return this.zx(a, false);
    };
    PolarBase.prototype.zt = function (a) {
        var b = this.v0(a);
        var c = b.x;
        var d = b.y;
        if (this.dl == null || this.yk == null || this.yl == null || this.za == null || this.zb == null) {
            return -1;
        }
        if (this.dl.count > this.zz) {
            return -1;
        }
        if (!this.zh()) {
            return -1;
        }
        var e = this.zr;
        var f = 1.7976931348623157E+308;
        var g = -1;
        for (var h = 0; h < this.za.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.zh = function () {
        var a = this.yr;
        if (this.d1()) {
            a = this.yv;
        }
        if (a == null || a.w.count == 0) {
            return false;
        }
        this.zr = a.w;
        return true;
    };
    PolarBase.prototype.zx = function (a, b) {
        if (!this.zk) {
            return -1;
        }
        var c = { $type: Point_$type, x: 0, y: 0 };
        var d = true;
        var e = this.yr;
        if (this.d1()) {
            e = this.yv;
        }
        if (e == null) {
            return -1;
        }
        if (e.m == null) {
            return -1;
        }
        if (this.dl == null || this.dl.count > this.zz) {
            return -1;
        }
        if (!this.zh()) {
            return -1;
        }
        var f = this.zr;
        var g = this.v0(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.zw = function (a) {
        return this.zx(a, true);
    };
    PolarBase.prototype.zv = function (a) {
        var _this = this;
        var b = null;
        var c = 1.7976931348623157E+308;
        var d = this.v0(a);
        var e = d.x;
        var f = d.y;
        if (this.yo.c1.e > this.zz) {
            return -1;
        }
        this.yo.c4(function (g) {
            if (g._visibility == 0) {
                var h = _this.yo.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.v5 = function (a, b, c) {
        var _this = this;
        if (this.yk == null || this.yl == null || this.za == null || this.zb == 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.yk.ch, f);
        var h = ((function () {
            var $ret = new ScalerParams(0, d, e, _this.yl.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.ym.h(this.za.item(j), this.zb.item(j), d, e, f, this.yn.e, this.yn.d, this.yn.g, this.yn.f, this.yn.i, this.yn.h);
            }
            var l = i - Math.floor(i);
            var m = this.ym.h(this.za.item(j), this.zb.item(j), d, e, f, this.yn.e, this.yn.d, this.yn.g, this.yn.f, this.yn.i, this.yn.h);
            var n = this.ym.h(this.za.item(k), this.zb.item(k), d, e, f, this.yn.e, this.yn.d, this.yn.g, this.yn.f, this.yn.i, this.yn.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.ym.h(this.za.item(u), this.zb.item(u), d, e, f, this.yn.e, this.yn.d, this.yn.g, this.yn.f, this.yn.i, this.yn.h);
        }
    };
    PolarBase.prototype.ai = function () {
        return [this.yk, this.yl];
    };
    PolarBase.prototype.ko = function (a, b) {
        var c = this.na(b);
        if (c == PolarBase.$$p[3]) {
            return this.kp(a, b, this.aaa);
        }
        if (c == PolarBase.$$p[15]) {
            return this.kp(a, b, this.aas);
        }
        if (c == PolarBase.$$p[5]) {
            return this.kp(a, b, this.aad);
        }
        if (c == PolarBase.$$p[6]) {
            return this.kp(a, b, this.aaf);
        }
        return _super.prototype.ko.call(this, a, b);
    };
    PolarBase.prototype.ma = function (a) {
        var b = this.na(a);
        if (b == PolarBase.$$p[3]) {
            return this.aaa;
        }
        if (b == PolarBase.$$p[15]) {
            return this.aas;
        }
        if (b == PolarBase.$$p[5]) {
            return this.aad;
        }
        if (b == PolarBase.$$p[6]) {
            return this.aaf;
        }
        return _super.prototype.ma.call(this, a);
    };
    PolarBase.prototype.q4 = function (a, b, c, d) {
        _super.prototype.q4.call(this, a, b, c, d);
        if (this.yo.c0.g$b(a, b, c, d)) {
            this.rm(false);
            this.qg();
        }
        switch (b) {
            case PolarBase.$$p[1]:
            case PolarBase.$$p[2]:
            case PolarBase.$$p[13]:
            case PolarBase.$$p[14]:
                this.qa();
                break;
            case "FastItemsSource":
                if (typeCast(IFastItemsSource_$type, c) != null) {
                    c.deregisterColumn(this.za);
                    c.deregisterColumn(this.zb);
                    this.za = null;
                    this.zb = null;
                }
                if (typeCast(IFastItemsSource_$type, d) != null) {
                    this.za = this.di(this.aaa);
                    this.zb = this.di(this.aas);
                }
                if ((this.yl != null && !this.yl.c1()) || (this.yk != null && !this.yk.c1())) {
                    this.rm(this.ge && c != null);
                }
                break;
            case PolarBase.$$p[0]:
                if (this.yk != null && this.yl != null) {
                    this.ym = new PolarAxes(this.yl, this.yk);
                }
                if (c != null) {
                    c.b0(this);
                }
                if (d != null) {
                    d.ct(this);
                }
                if (this.yk != null && !this.yk.c1()) {
                    this.rm(false);
                }
                else if (c != null && d == null) {
                    this.o2(true, this.ct);
                }
                break;
            case PolarBase.$$p[12]:
                if (this.yk != null && this.yl != null) {
                    this.ym = new PolarAxes(this.yl, this.yk);
                }
                if (c != null) {
                    c.b0(this);
                }
                if (d != null) {
                    d.ct(this);
                }
                if (this.yl != null && !this.yl.c1()) {
                    this.rm(false);
                }
                else if (c != null && d == null) {
                    this.o2(true, this.ct);
                }
                if (this.yk != null && !this.yk.c1()) {
                    this.yk.h5();
                }
                break;
            case PolarBase.$$p[3]:
                if (this.dl != null) {
                    this.dl.deregisterColumn(this.za);
                    this.za = this.di(this.aaa);
                }
                break;
            case "AngleColumn":
                this.yo.c0.g$i();
                if (this.yk != null && !this.yk.c1()) {
                    this.rm(this.ge && this.d5);
                }
                break;
            case PolarBase.$$p[15]:
                if (this.dl != null) {
                    this.dl.deregisterColumn(this.zb);
                    this.zb = this.di(this.aas);
                }
                break;
            case "RadiusColumn":
                this.yo.c0.g$i();
                if (this.yl != null && !this.yl.c1()) {
                    this.rm(this.ge && this.d5);
                }
                break;
            case PolarBase.$$p[16]:
                this.rm(false);
                this.qg();
                break;
            case PolarBase.$$p[11]:
                this.rm(false);
                this.qg();
                break;
            case "TransitionProgress":
                this.yn = new PolarAxisInfoCache(this.yk, this.yl, this.dl);
                this.ab6 = this.ct.by;
                this.ab5 = this.ct.bx;
                this.ab4 = this.ct.getEffectiveViewport();
                this.yv.v = this.zq;
                this.yv.c(this.jo, this.yt, this.yr);
                if (this.d3(this.ct)) {
                    return;
                }
                if (this.jo == 1) {
                    this.aa8(this.yr, this.yo);
                    this.qj();
                }
                else {
                    this.aa8(this.yv, this.yo);
                }
                if (this.c9 != null) {
                    this.c9.qa(this);
                }
                break;
            case "TrendLineBrush":
                this.ra(b);
                break;
            case PolarBase.$$p[4]:
                this.rm(false);
                this.qg();
                break;
            case "TrendLineType":
                this.qg();
                break;
            case PolarBase.$$p[8]:
                this.zd = this.zm();
                this.rm(false);
                break;
            case PolarBase.$$p[7]:
                this.zc = this.zl();
                this.rm(false);
                break;
            case PolarBase.$$p[9]:
                this.yy = this.yz();
                break;
        }
    };
    Object.defineProperty(PolarBase.prototype, "yy", {
        get: function () {
            return this.yx;
        },
        set: function (a) {
            var b = this.yx;
            this.yx = a;
            if (b != this.yx) {
                this.raisePropertyChanged("ActualItemSearchMode", enumGetBox(ScatterItemSearchMode_$type, b), enumGetBox(ScatterItemSearchMode_$type, this.yx));
            }
        },
        enumerable: false,
        configurable: true
    });
    PolarBase.prototype.yz = function () {
        if (this.y0 != 0) {
            return this.y0;
        }
        return this.zk ? 4 : 1;
    };
    PolarBase.prototype.get_zk = function () {
        return false;
    };
    Object.defineProperty(PolarBase.prototype, "zk", {
        get: function () {
            return this.get_zk();
        },
        enumerable: false,
        configurable: true
    });
    PolarBase.prototype.zm = function () {
        return this.zj;
    };
    PolarBase.prototype.zl = function () {
        return this.zi;
    };
    PolarBase.prototype.zf = function (a) {
        if (typeCast(NumericRadiusAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    PolarBase.prototype.ze = function (a) {
        if (typeCast(NumericAngleAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    PolarBase.prototype.o2 = function (a, b) {
        _super.prototype.o2.call(this, a, b);
        var c = b;
        if (a) {
            c.c1.clear();
        }
        c.c0.g$d();
    };
    PolarBase.prototype.yh = 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.aaw = 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.za.item(f), y: this_1.zb.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.aa4 = 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.za != null ? this.za.count : 0, this.zb != null ? this.zb.count : 0);
        if (f < 1) {
            return;
        }
        this.yn = new PolarAxisInfoCache(this.yk, this.yl, this.dl);
        this.yp = a;
        this.ab5 = d;
        this.ab6 = c;
        this.ab4 = b.getEffectiveViewport();
        b.cy.l(a.j, this.z0, c, d, this.ib);
        if (f <= this.z0) {
            this.aaw(a, f, c, d);
        }
        var g = this.yh(d, a.n);
        var h = Math.min(this.yk.ly, this.yk.lx);
        var i = Math.max(this.yk.lx, this.yk.ly);
        b.c0.i = this.zq;
        b.c0.h = 0;
        b.c0.k = this.yl.np;
        b.c0.j = this.yl.no;
        b.c0.l = function (j, k) { return _this.ym.c(j, k, c, d, e, Math.cos); };
        b.c0.m = function (j, k) { return _this.ym.d(j, k, c, d, e, Math.sin); };
        var j = new List$1(Number_$type, 0);
        for (var k = 0; k < this.za.count; k++) {
            if (this.za.item(k) >= h && this.za.item(k) <= i) {
                j.add(this.za.item(k));
            }
        }
        var l = this.zb;
        if (j.count != this.za.count) {
            l = new List$1(Number_$type, 0);
            for (var m = 0; m < this.za.count; m++) {
                if (this.za.item(m) >= h && this.za.item(m) <= i) {
                    l.add(this.zb.item(m));
                }
            }
        }
        b.c0.n(a.n, this.y2, j, l, this.z1, runOn(this.yk, this.yk.getScaledAngle), runOn(this.yl, this.yl.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.y4 = function (a, b, c) {
        return null;
    };
    PolarBase.prototype.y5 = function (a, b, c) {
        if (this.dl == null) {
            return null;
        }
        var d = this.ys();
        var e = this.yo.b1(this.v0(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.y3 = 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.y4(a, b, this.y6);
            this.y6 = d;
            return d;
        }
        else {
            var e = this.y3(a, b, this.y6);
            this.y6 = e;
            return e;
        }
    };
    PolarBase.prototype.df = function (a, b, c) {
        if (this.fx(this.bv) && !c) {
            var d = this.y5(a, b, this.y7);
            this.y7 = d;
            return d;
        }
        else {
            var e = this.y3(a, b, this.y7);
            e.d = true;
            this.y7 = e;
            return e;
        }
    };
    PolarBase.prototype.zo = function () {
        return (this.assigningPolarStyle != null && this.zd) || (this.bv != 1) || this.d0 || (this.cn != 1) || (this.cm != 1);
    };
    PolarBase.prototype.zn = function () {
        return (this.assigningPolarMarkerStyle != null && this.zc) || this.d0 || (this.bv != 1) || (this.cn != 1) || (this.cm != 1);
    };
    PolarBase.prototype.aa8 = function (a, b) {
        this.qs();
        var c = b.by;
        var d = b.bx;
        var e = this.getEffectiveViewport1(b);
        var f = this.wc(b);
        this.yn = new PolarAxisInfoCache(this.yk, this.yl, this.dl);
        if (this.w7()) {
            b.cy.j(a.j, this.w9);
            if (this.zn()) {
                this.aay(b, a);
            }
        }
        b.cr();
        var g = this.yh(d, b.c0.g$j.an);
        b.c0.g$h(a.n, g);
        this.aav(d, c, e, f, b);
    };
    PolarBase.prototype.ye = function (a, b) {
        return this.yf(a, b);
    };
    PolarBase.prototype.yf = function (a, b) {
        if (b < a || a < 0 || a > this.za.count || b < 0 || b > this.za.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.aay = function (a, b) {
        var _this = this;
        a.b7 = true;
        this.yw.ay(this, this.zn(), runOn(this, this.ye));
        var c = this.yw.d;
        var d = c != null;
        var e = this.getEffectiveViewport1(a);
        var f = this.dl == null ? 0 : this.dl.count;
        this.yo.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.aa2(h, f, a.q);
                }
                _this.yw.ac(g, i);
            }
        });
    };
    PolarBase.prototype.aa3 = function (a, b, c) {
        var d = this.bv != 1;
        var e = this.cn != 1;
        var f = this.cm != 1;
        this.yw.a0(this.yw.b, a, b, false);
        this.yw.ab(this.h9);
        var g = this.yw.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.aa6(g);
        this.yw.z(this, h, i, j, c, d, e, f, a < 0);
    };
    PolarBase.prototype.aa2 = function (a, b, c) {
        var d = this.bv != 1;
        var e = this.cn != 1;
        var f = this.cm != 1;
        this.yw.a0(this.yw.d, a, b, true);
        this.yw.aa(this.h9);
        var g = this.yw.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.aa5(g);
        this.yw.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.aa6 = function (a) {
        if (this.assigningPolarStyle != null && this.zd) {
            this.assigningPolarStyle(this, a);
        }
    };
    PolarBase.prototype.aa5 = function (a) {
        if (this.assigningPolarMarkerStyle != null && this.zc) {
            this.assigningPolarMarkerStyle(this, a);
        }
    };
    PolarBase.prototype.aav = function (a, b, c, d, e) {
        e.c3(a, b, c, d);
    };
    PolarBase.prototype.sa = function () {
        _super.prototype.sa.call(this);
        if (this.index < 0) {
            return;
        }
        this.yo.c6();
    };
    PolarBase.prototype.ro = function (a, b) {
        _super.prototype.ro.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.yu = new PolarFrame();
            this.aa4(this.yu, c);
        }
        this.gq = false;
        this.aa8(this.yu, c);
        this.gy = false;
    };
    PolarBase.prototype.rl = function (a, b, c, d, e) {
        _super.prototype.rl.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.yq == null) {
            this.yq = new PolarFrame();
        }
        this.aa4(this.yq, g);
        this.aa8(this.yq, g);
    };
    PolarBase.prototype.aa7 = 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.yd = function (a, b, c) {
        this.aaz();
        return this.yp.w.toArray();
    };
    PolarBase.prototype.zs = 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.yo.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.ab2 = function (a) {
        return { $type: Point_$type, x: this.za.item(a), y: this.zb.item(a) };
    };
    PolarBase.prototype.pu = function (a) {
        _super.prototype.pu.call(this, a);
        this.bb.exportTrendlineData(this, a, this.yo.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.aas != null ? this.aas : "Radius";
        g.q = "Radius";
        g.s = this.aao != null ? this.aao : "R:";
        g.t = this.aaq != null ? this.aaq : "";
        var h = new DataLegendSeriesValueInfo();
        h.l = f;
        h.a = 10;
        h.r = this.aaa != null ? this.aaa : "Angle";
        h.q = "Angle";
        h.s = this.z6 != null ? this.z6 : "A:";
        h.t = this.z8 != null ? this.z8 : "";
        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.l9();
        return i;
    };
    PolarBase.$t = markType(PolarBase, 'PolarBase', MarkerSeries.$);
    PolarBase.aa9 = 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:yk:aba', [NumericAngleAxis.$, null], 'AngleMemberAsLegendLabel:z6:abb', [2, null], 'AngleMemberAsLegendUnit:z8:abc', [2, null], 'AngleMemberPath:aaa:abd', [2], 'ClipSeriesToBounds:zg:abe', [0, false], 'HighlightedAngleMemberPath:aad:abf', [2, null], 'HighlightedRadiusMemberPath:aaf:abg', [2, null], 'IsCustomPolarMarkerStyleAllowed:zi:abh', [0, false], 'IsCustomPolarStyleAllowed:zj:abi', [0, false], 'ItemSearchMode:y0:abj', [ScatterItemSearchMode_$type, enumGetBox(ScatterItemSearchMode_$type, 0)], 'ItemSearchThreshold:zz:abk', [1, 10000], 'MaximumMarkers:z0:abl', [1, 400], 'RadiusAxis:yl:abm', [NumericRadiusAxis.$, null], 'RadiusMemberAsLegendLabel:aao:abn', [2, null], 'RadiusMemberAsLegendUnit:aaq:abo', [2, null], 'RadiusMemberPath:aas:abp', [2], 'UseCartesianInterpolation:zq:abx', [0, true], 'TrendLineType:y2:abv', [TrendLineType_$type, enumGetBox(TrendLineType_$type, 0)], 'TrendLineThickness:zy:abu', [1, 1.5], 'TrendLinePeriod:z1:abt', [1, 7], 'TrendLineZIndex:z2:abw', [1, 1], 'TrendLineBrush:abz:abq', [Brush.$, null], 'TrendLineDashArray:ab0:abr', [DoubleCollection.$], 'TrendLineDashCap:ab1:abs', [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.z0 = 1000;
            this.b4.w1 = 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.yn.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.ab2);
        return a;
    };
    PolarBaseView.prototype.c5 = function (a) {
        this.cz.aa7(a, this.c1);
    };
    PolarBaseView.prototype.cw = function () {
        return this.cz.yd(this.c1, this.by, this.bx);
    };
    PolarBaseView.prototype.c2 = function () {
        return this.cz.zs(this.c1);
    };
    PolarBaseView.prototype.c3 = function (a, b, c, d) {
        if (this.cz.zg) {
            var e = new GeometryGroup();
            this.cz.yl.n3(e, a, b, c, d);
        }
        else {
        }
    };
    PolarBaseView.prototype.c6 = function () {
        if (this.cz.abz != null) {
            this.cz.aby = this.cz.abz;
        }
        else {
            this.cz.aby = this.cz.u2;
        }
    };
    PolarBaseView.prototype.cj = function (a) {
        this.c1.f(a);
    };
    PolarBaseView.prototype.a7 = function (a, b) {
        if (a.d) {
            if (this.cz.y2 != 0 && !b) {
                var c = this.c0.g$j;
                c.ad = this.cz.zy;
                c._stroke = this.cz.aby;
                c.aj = this.cz.ab1;
                c.ai = this.cz.ab0;
                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.aaa + "}" + "</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.aas + "}</span></div>";
        return a;
    };
    PolarBaseView.$t = markType(PolarBaseView, 'PolarBaseView', MarkerSeriesView.$);
    return PolarBaseView;
}(MarkerSeriesView));
export { PolarBaseView };
