/*
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, Number_$type, enumGetBox, Point_$type, typeCast, fromEnum, markType, markDep } from "igniteui-angular-core";
import { PolarAxisInfoCache } from "./PolarAxisInfoCache";
import { SeriesRenderer$2 } from "./SeriesRenderer$2";
import { PolarFrame } from "./PolarFrame";
import { DependencyProperty } from "igniteui-angular-core";
import { NumericAngleAxis } from "./NumericAngleAxis";
import { NumericRadiusAxis } from "./NumericRadiusAxis";
import { TrendLineType_$type } from "igniteui-angular-core";
import { Brush } from "igniteui-angular-core";
import { PenLineCap_$type } from "igniteui-angular-core";
import { DoubleCollection } from "igniteui-angular-core";
import { ScatterItemSearchMode_$type } from "./ScatterItemSearchMode";
import { HighlightingInfo } from "./HighlightingInfo";
import { List$1 } from "igniteui-angular-core";
import { SeriesPointOfInterest } from "./SeriesPointOfInterest";
import { ScalerParams } from "./ScalerParams";
import { Rect } from "igniteui-angular-core";
import { Marker } from "./Marker";
import { MarkerSeriesView } from "./MarkerSeriesView";
import { PolarAxes } from "./PolarAxes";
import { IFastItemsSource_$type } from "igniteui-angular-core";
import { SeriesRenderingArguments } from "./SeriesRenderingArguments";
import { AxisRange } from "./AxisRange";
import { Dictionary$2 } from "igniteui-angular-core";
import { OwnedPoint } from "./OwnedPoint";
import { GeometryUtil } from "igniteui-angular-core";
import { DataContext } from "igniteui-angular-core";
import { HashPool$2 } from "igniteui-angular-core";
import { Clipper } from "igniteui-angular-core";
import { TrendResolutionParams } from "./TrendResolutionParams";
import { PolarTrendLineManager } from "./PolarTrendLineManager";
import { AssigningPolarStyleEventArgs } from "./AssigningPolarStyleEventArgs";
import { AssigningPolarMarkerStyleEventArgs } from "./AssigningPolarMarkerStyleEventArgs";
import { SeriesRenderManager } from "./SeriesRenderManager";
import { DataLegendSeriesValueInfo } from "igniteui-angular-core";
import { DataLegendSeriesContext } from "igniteui-angular-core";
import { PropertyMetadata } from "igniteui-angular-core";
import { truncate, isNaN_, isInfinity } from "igniteui-angular-core";
import { Defaults } from "./Defaults";
import { NumericMarkerManager } from "./NumericMarkerManager";
import { GeometryGroup } from "igniteui-angular-core";
import { stringIsNullOrEmpty } from "igniteui-angular-core";
/**
 * @hidden
 */
var PolarBase = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(PolarBase, _super);
    function PolarBase() {
        var _this = _super.call(this) || this;
        _this.ry = null;
        _this.rk = null;
        _this.rw = null;
        _this.u0 = null;
        _this.uz = null;
        _this.sa = null;
        _this.sc = null;
        _this.sd = null;
        _this.r2 = new PolarFrame();
        _this.r4 = new PolarFrame();
        _this.r0 = new PolarFrame();
        _this.rv = null;
        _this.su = null;
        _this.r6 = 1;
        _this.sh = false;
        _this.sg = false;
        _this.rr = null;
        _this.rs = null;
        _this.assigningPolarStyle = null;
        _this.assigningPolarMarkerStyle = null;
        _this.r5 = null;
        _this.r3 = null;
        _this.rz = null;
        _this.r5 = new PolarSeriesRenderManager();
        _this.r7 = _this.r8();
        _this.r3 = new PolarFrame();
        _this.r4.x = runOn(_this, _this.uy);
        _this.r2.x = runOn(_this, _this.uy);
        _this.r0.x = runOn(_this, _this.uy);
        _this.sa = new SeriesRenderer$2(PolarFrame.$, PolarBaseView.$, 0, runOn(_this, _this.t1), runOn(_this, _this.t5), runOn(_this, _this.cv), runOn(_this, _this.mq), runOn(_this, _this.tw));
        return _this;
    }
    PolarBase.prototype.bx = function () {
        return new PolarBaseView(this);
    };
    PolarBase.prototype.ly = function (a) {
        _super.prototype.ly.call(this, a);
        this.rx = a;
    };
    PolarBase.prototype.ku = function () {
        _super.prototype.ku.call(this);
        this.rt = null;
        this.ru = null;
    };
    PolarBase.prototype.get_d6 = function () {
        return true;
    };
    PolarBase.prototype.c1 = function (a, b, c, d) {
        var _this = this;
        if (!this.hasMarkers) {
            return false;
        }
        var e = this.rt;
        var f = new ScalerParams(1, this.cd.sf, this.py, e.cg);
        f.c = this.getEffectiveViewport1(this.b0);
        var g = this.ru;
        var h = new ScalerParams(1, this.cd.sf, this.py, g.cg);
        h.c = this.getEffectiveViewport1(this.b0);
        a.clear();
        this.qb.cf(function (i) {
            if (i._visibility == 0) {
                var j = new SeriesPointOfInterest();
                var k = i.n;
                var l = i.o;
                if (k < _this.py.left || k > _this.py.right || l < _this.py.top || l > _this.py.bottom) {
                    return;
                }
                var m = void 0;
                var n = void 0;
                var o = _this.rv.f(k, l, _this.b0.bv, _this.b0.bu, m, n);
                m = o.p4;
                n = o.p5;
                j.b = m;
                j.c = n;
                j.a = i.content;
                a.add(j);
            }
        });
        return true;
    };
    PolarBase.prototype.tw = function () {
        if (this.ce.g) {
            this.ce.t();
        }
    };
    PolarBase.prototype.ty = function () {
        this.rv.e(this.ry.w, this.se, this.sf, this.u0, this.uz, function (a, b) { return Math.cos(b); }, function (a, b) { return Math.sin(b); }, true);
    };
    Object.defineProperty(PolarBase.prototype, "se", {
        get: function () {
            return this.sc;
        },
        set: function (a) {
            if (this.sc != a) {
                var b = this.se;
                this.sc = a;
                this.raisePropertyChanged("AngleColumn", b, this.se);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(PolarBase.prototype, "sf", {
        get: function () {
            return this.sd;
        },
        set: function (a) {
            if (this.sd != a) {
                var b = this.sf;
                this.sd = a;
                this.raisePropertyChanged("RadiusColumn", b, this.sf);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(PolarBase.prototype, "ut", {
        get: function () {
            return this.c(PolarBase.t6);
        },
        set: function (a) {
            this.h(PolarBase.t6, a);
        },
        enumerable: false,
        configurable: true
    });
    PolarBase.prototype.r1 = function () {
        var a = this.r0;
        if (this.cv()) {
            if (this.ce.g) {
                this.ce.t();
            }
            a = this.r4;
        }
        return a;
    };
    PolarBase.prototype.le = function () {
        _super.prototype.le.call(this);
        if (this.ru != null) {
            this.ru.h7(false);
        }
        if (this.rt != null) {
            this.rt.h7(false);
        }
    };
    PolarBase.prototype.k0 = function (a, b, c, d) {
        var e = false;
        this.rx.cv.g$e(a, b, c, d);
        if (this.rt != null && !this.rt.c0()) {
            e = true;
        }
        if (this.ru != null && !this.ru.c0()) {
            e = true;
        }
        if (e) {
            this.mh(true);
        }
    };
    PolarBase.prototype.m4 = function (a, b) {
        this.mh(false);
    };
    PolarBase.prototype.m5 = function (a, b) {
        this.mh(false);
    };
    PolarBase.prototype.e9 = function (a, b, c) {
        var d = true;
        if (!_super.prototype.e9.call(this, a, b, c) || !c.o() || b.isEmpty || a.isEmpty || this.rt == null || this.ru == null || this.se == null || this.sf == null || this.se.count == 0 || this.sf.count == 0 || this.ck == null || this.ck.count != this.se.count || this.ck.count != this.sf.count || this.rv == null || this.rt.bh == null || this.ru.bh == null || this.rt.lv == this.rt.lu || this.ru.lv == this.ru.lu) {
            d = false;
        }
        return d;
    };
    PolarBase.prototype.mi = function (a) {
        var b;
        var c;
        var d = this.getViewInfo(c, b);
        c = d.p0;
        b = d.p1;
        if (!this.e9(c, b, this.b0)) {
            this.kx(true, this.b0);
            return;
        }
        this.u0 = b;
        this.uz = c;
        this.rw = new PolarAxisInfoCache(this.rt, this.ru, this.ck);
        var e = new SeriesRenderingArguments(this, c, b, a, this.es);
        var f = this.sa.g(e, this.r2, this.r0, this.r4, this.rx);
        this.r2 = f.p1;
        this.r0 = f.p2;
        this.r4 = f.p3;
    };
    PolarBase.prototype.uy = function (a) {
        var b = this.rv.h(a.x, a.y, this.u0, this.uz, this.rw.e, this.rw.d, this.rw.g, this.rw.f, this.rw.i, this.rw.h);
        return b;
    };
    PolarBase.prototype.ap = function (a) {
        if (a != null && a == this.rt && this.se != null) {
            return new AxisRange(this.se.minimum, this.se.maximum);
        }
        if (a != null && a == this.ru && this.sf != null) {
            return new AxisRange(this.sf.minimum, this.sf.maximum);
        }
        return null;
    };
    PolarBase.prototype.en = function (a) {
        var b = this.b0.bv;
        b = b.copy();
        var c = this.b0.bu;
        var d = !b.isEmpty && !c.isEmpty && this.ck != null ? this.ck.indexOf(a) : -1;
        if (this.rt == null || this.se == null || this.ru == null || this.sf == null) {
            return false;
        }
        if (d < 0 || d > this.se.count - 1 || d > this.sf.count - 1) {
            return false;
        }
        var e = this.rt.getScaledAngle(this.se.item(d));
        var f = this.ru.ns(this.sf.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.b8 != null) {
            this.b8.au(this.cd, b, true);
        }
        return d >= 0;
    };
    PolarBase.prototype.ht = function (a) {
        var b = this.hd(a);
        if (this.ck != null && b >= 0 && b < this.ck.count) {
            return this.ck.item(b);
        }
        return null;
    };
    PolarBase.prototype.hd = function (a) {
        var b = truncate(Math.round(this.f5(a)));
        return b;
    };
    PolarBase.prototype.f5 = function (a) {
        switch (this.r7) {
            case 1: return this.sy(a);
            case 3: return this.sz(a);
            case 2: return this.sw(a);
            case 4: return this.sx(a);
        }
        return -1;
    };
    PolarBase.prototype.sx = function (a) {
        return this.s0(a, false);
    };
    PolarBase.prototype.sw = function (a) {
        var b = this.pg(a);
        var c = b.x;
        var d = b.y;
        if (this.ck == null || this.rt == null || this.ru == null || this.se == null || this.sf == null) {
            return -1;
        }
        if (this.ck.count > this.s2) {
            return -1;
        }
        if (!this.sl()) {
            return -1;
        }
        var e = this.su;
        var f = 1.7976931348623157E+308;
        var g = -1;
        for (var h = 0; h < this.se.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.sl = function () {
        var a = this.r0;
        if (this.cv()) {
            a = this.r4;
        }
        if (a == null || a.w.count == 0) {
            return false;
        }
        this.su = a.w;
        return true;
    };
    PolarBase.prototype.s0 = function (a, b) {
        if (!this.so) {
            return -1;
        }
        var c = { $type: Point_$type, x: 0, y: 0 };
        var d = true;
        var e = this.r0;
        if (this.cv()) {
            e = this.r4;
        }
        if (e == null) {
            return -1;
        }
        if (e.m == null) {
            return -1;
        }
        if (this.ck == null || this.ck.count > this.s2) {
            return -1;
        }
        if (!this.sl()) {
            return -1;
        }
        var f = this.su;
        var g = this.pg(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.ck.item(j)) || e.j.containsKey(this.ck.item(j - 1))) {
                    var l = GeometryUtil.d(g, c, k);
                    if (l < h) {
                        h = l;
                        i = j;
                    }
                }
            }
            c = k;
        }
        if (i >= 0) {
            var m = f._inner[i];
            var n = f._inner[i - 1];
            if (!b || (e.j.containsKey(this.ck.item(i)) && e.j.containsKey(this.ck.item(i - 1)))) {
                var o = GeometryUtil.h(g, n, m);
                return (i - 1) + o;
            }
            else if (e.j.containsKey(this.ck.item(i))) {
                return i;
            }
            else {
                return i - 1;
            }
        }
        return -1;
    };
    PolarBase.prototype.sz = function (a) {
        return this.s0(a, true);
    };
    PolarBase.prototype.sy = function (a) {
        var _this = this;
        var b = null;
        var c = 1.7976931348623157E+308;
        var d = this.pg(a);
        var e = d.x;
        var f = d.y;
        if (this.rx.cw.e > this.s2) {
            return -1;
        }
        this.rx.cz(function (g) {
            if (g._visibility == 0) {
                var h = _this.rx.cp(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.pl = function (a, b, c) {
        var _this = this;
        if (this.rt == null || this.ru == null || this.se == null || this.sf == null) {
            return { $type: Point_$type, x: NaN, y: NaN };
        }
        var d = this.b0.bv;
        var e = this.b0.bu;
        var f = this.getEffectiveViewport();
        var g = new ScalerParams(0, d, e, this.rt.cg, f);
        var h = ((function () {
            var $ret = new ScalerParams(0, d, e, _this.ru.cg, f);
            $ret.b = _this.gc();
            return $ret;
        })());
        if (b) {
            var i = this.f5(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.ck.count - 1) {
                k = this.ck.count - 1;
            }
            if (j > this.ck.count - 1) {
                j = this.ck.count - 1;
            }
            if (k == j) {
                return this.rv.h(this.se.item(j), this.sf.item(j), d, e, this.rw.e, this.rw.d, this.rw.g, this.rw.f, this.rw.i, this.rw.h);
            }
            var l = i - Math.floor(i);
            var m = this.rv.h(this.se.item(j), this.sf.item(j), d, e, this.rw.e, this.rw.d, this.rw.g, this.rw.f, this.rw.i, this.rw.h);
            var n = this.rv.h(this.se.item(k), this.sf.item(k), d, e, this.rw.e, this.rw.d, this.rw.g, this.rw.f, this.rw.i, this.rw.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.hd(a);
            if (u == -1) {
                return { $type: Point_$type, x: NaN, y: NaN };
            }
            return this.rv.h(this.se.item(u), this.sf.item(u), d, e, this.rw.e, this.rw.d, this.rw.g, this.rw.f, this.rw.i, this.rw.h);
        }
    };
    PolarBase.prototype.ag = function () {
        return [this.rt, this.ru];
    };
    PolarBase.prototype.hw = function (a, b) {
        var c = this.jq(b);
        if (c == PolarBase.$$p[3]) {
            return this.hx(a, b, this.td);
        }
        if (c == PolarBase.$$p[13]) {
            return this.hx(a, b, this.tr);
        }
        return _super.prototype.hw.call(this, a, b);
    };
    PolarBase.prototype.l3 = function (a, b, c, d) {
        _super.prototype.l3.call(this, a, b, c, d);
        if (this.rx.cv.g$b(a, b, c, d)) {
            this.mh(false);
            this.lo();
        }
        switch (b) {
            case "FastItemsSource":
                if (typeCast(IFastItemsSource_$type, c) != null) {
                    c.deregisterColumn(this.se);
                    c.deregisterColumn(this.sf);
                    this.se = null;
                    this.sf = null;
                }
                if (typeCast(IFastItemsSource_$type, d) != null) {
                    this.se = this.ch(this.td);
                    this.sf = this.ch(this.tr);
                }
                if ((this.ru != null && !this.ru.c0()) || (this.rt != null && !this.rt.c0())) {
                    this.mh(false);
                }
                break;
            case PolarBase.$$p[0]:
                if (this.rt != null && this.ru != null) {
                    this.rv = new PolarAxes(this.ru, this.rt);
                }
                if (c != null) {
                    c.bz(this);
                }
                if (d != null) {
                    d.cs(this);
                }
                if (this.rt != null && !this.rt.c0()) {
                    this.mh(false);
                }
                else if (c != null && d == null) {
                    this.kx(true, this.b0);
                }
                break;
            case PolarBase.$$p[10]:
                if (this.rt != null && this.ru != null) {
                    this.rv = new PolarAxes(this.ru, this.rt);
                }
                if (c != null) {
                    c.bz(this);
                }
                if (d != null) {
                    d.cs(this);
                }
                if (this.ru != null && !this.ru.c0()) {
                    this.mh(false);
                }
                else if (c != null && d == null) {
                    this.kx(true, this.b0);
                }
                if (this.rt != null && !this.rt.c0()) {
                    this.rt.h3();
                }
                break;
            case PolarBase.$$p[3]:
                if (this.ck != null) {
                    this.ck.deregisterColumn(this.se);
                    this.se = this.ch(this.td);
                }
                break;
            case "AngleColumn":
                this.rx.cv.g$i();
                if (this.rt != null && !this.rt.c0()) {
                    this.mh(false);
                }
                break;
            case PolarBase.$$p[13]:
                if (this.ck != null) {
                    this.ck.deregisterColumn(this.sf);
                    this.sf = this.ch(this.tr);
                }
                break;
            case "RadiusColumn":
                this.rx.cv.g$i();
                if (this.ru != null && !this.ru.c0()) {
                    this.mh(false);
                }
                break;
            case PolarBase.$$p[14]:
                this.mh(false);
                this.lo();
                break;
            case PolarBase.$$p[9]:
                this.mh(false);
                this.lo();
                break;
            case "TransitionProgress":
                this.rw = new PolarAxisInfoCache(this.rt, this.ru, this.ck);
                this.u0 = this.b0.bv;
                this.uz = this.b0.bu;
                this.r4.v = this.st;
                this.r4.c(this.g0, this.r2, this.r0);
                if (this.cx(this.b0)) {
                    return;
                }
                if (this.g0 == 1) {
                    this.t5(this.r0, this.rx);
                }
                else {
                    this.t5(this.r4, this.rx);
                }
                if (this.cd != null) {
                    this.cd.nn(this);
                }
                break;
            case "TrendLineBrush":
                this.mv();
                break;
            case PolarBase.$$p[4]:
                this.mh(false);
                this.lo();
                break;
            case "TrendLineType":
                this.lo();
                break;
            case PolarBase.$$p[6]:
                this.sh = this.sq();
                this.mh(false);
                break;
            case PolarBase.$$p[5]:
                this.sg = this.sp();
                this.mh(false);
                break;
            case PolarBase.$$p[7]:
                this.r7 = this.r8();
                break;
        }
    };
    Object.defineProperty(PolarBase.prototype, "r7", {
        get: function () {
            return this.r6;
        },
        set: function (a) {
            var b = this.r6;
            this.r6 = a;
            if (b != this.r6) {
                this.raisePropertyChanged("ActualItemSearchMode", enumGetBox(ScatterItemSearchMode_$type, b), enumGetBox(ScatterItemSearchMode_$type, this.r6));
            }
        },
        enumerable: false,
        configurable: true
    });
    PolarBase.prototype.r8 = function () {
        if (this.r9 != 0) {
            return this.r9;
        }
        return this.so ? 4 : 1;
    };
    PolarBase.prototype.get_so = function () {
        return false;
    };
    Object.defineProperty(PolarBase.prototype, "so", {
        get: function () {
            return this.get_so();
        },
        enumerable: false,
        configurable: true
    });
    PolarBase.prototype.sq = function () {
        return this.sn;
    };
    PolarBase.prototype.sp = function () {
        return this.sm;
    };
    PolarBase.prototype.sj = function (a) {
        if (typeCast(NumericRadiusAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    PolarBase.prototype.si = function (a) {
        if (typeCast(NumericAngleAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    PolarBase.prototype.kx = function (a, b) {
        _super.prototype.kx.call(this, a, b);
        var c = b;
        if (a) {
            c.cw.clear();
        }
        c.cv.g$d();
    };
    PolarBase.prototype.rl = 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.tv = function (a, b, c, d) {
        a.g = new Dictionary$2(Base.$, OwnedPoint.$, 1, b);
        var e = this.ck;
        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.se.item(f), y: this_1.sf.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.t1 = function (a, b) {
        var _this = this;
        var c = b.bv;
        var d = b.bu;
        a.j.clear();
        a.n.clear();
        var e = Math.min(this.se != null ? this.se.count : 0, this.sf != null ? this.sf.count : 0);
        if (e < 1) {
            return;
        }
        this.rw = new PolarAxisInfoCache(this.rt, this.ru, this.ck);
        this.ry = a;
        this.uz = d;
        this.u0 = c;
        b.ct.l(a.j, this.s3, c, d, this.ft);
        if (e <= this.s3) {
            this.tv(a, e, c, d);
        }
        var f = this.rl(d, a.n);
        var g = Math.min(this.rt.lv, this.rt.lu);
        var h = Math.max(this.rt.lu, this.rt.lv);
        b.cv.i = this.st;
        b.cv.h = 0;
        b.cv.k = this.ru.nm;
        b.cv.j = this.ru.nl;
        b.cv.l = function (i, j) { return _this.rv.c(i, j, c, d, Math.cos); };
        b.cv.m = function (i, j) { return _this.rv.d(i, j, c, d, Math.sin); };
        var i = new List$1(Number_$type, 0);
        for (var j = 0; j < this.se.count; j++) {
            if (this.se.item(j) >= g && this.se.item(j) <= h) {
                i.add(this.se.item(j));
            }
        }
        var k = this.sf;
        if (i.count != this.se.count) {
            k = new List$1(Number_$type, 0);
            for (var l = 0; l < this.se.count; l++) {
                if (this.se.item(l) >= g && this.se.item(l) <= h) {
                    k.add(this.sf.item(l));
                }
            }
        }
        b.cv.n(a.n, this.sb, i, k, this.s4, runOn(this.rt, this.rt.getScaledAngle), runOn(this.ru, this.ru.ns), ((function () {
            var $ret = new TrendResolutionParams();
            $ret.b = _this.ft;
            $ret.f = d;
            $ret.g = c;
            return $ret;
        })()), f, g, h);
    };
    PolarBase.prototype.get_dx = function () {
        return true;
    };
    PolarBase.prototype.rp = function (a, b, c) {
        return null;
    };
    PolarBase.prototype.rq = function (a, b, c) {
        var d = this.r1();
        var e = this.rx.by(this.pg(b));
        var f = -1;
        if (e == null) {
            if (a != null) {
                f = this.ck.indexOf(a);
            }
            else {
                return null;
            }
        }
        else {
            f = e.ak;
        }
        if (f == -1) {
            return null;
        }
        var g = new HighlightingInfo();
        g.b = this;
        g.h = f;
        g.g = f;
        g.d = false;
        g.e = true;
        if (c != null && c.h == g.h && c.g == g.g) {
            return c;
        }
        return g;
    };
    PolarBase.prototype.ro = function (a, b, c) {
        var d = new HighlightingInfo();
        d.b = this;
        d.h = 0;
        d.g = this.ck.count - 1;
        d.d = true;
        if (c != null && c.h == d.h && c.g == d.g) {
            return c;
        }
        return d;
    };
    PolarBase.prototype.aw = function (a, b, c) {
        if (this.c2 && this.ef(this.bk) && !c) {
            var d = this.rp(a, b, this.rr);
            this.rr = d;
            return d;
        }
        else {
            var e = this.ro(a, b, this.rr);
            this.rr = e;
            return e;
        }
    };
    PolarBase.prototype.ax = function (a, b, c) {
        if (this.ef(this.bk) && !c) {
            var d = this.rq(a, b, this.rs);
            this.rs = d;
            return d;
        }
        else {
            var e = this.ro(a, b, this.rs);
            e.e = true;
            this.rs = e;
            return e;
        }
    };
    PolarBase.prototype.ss = function () {
        return (this.assigningPolarStyle != null && this.sh) || (this.bk != 1);
    };
    PolarBase.prototype.sr = function () {
        return (this.assigningPolarMarkerStyle != null && this.sg) || (this.bk != 1);
    };
    PolarBase.prototype.t5 = function (a, b) {
        var c = b.bv;
        var d = b.bu;
        var e = this.getEffectiveViewport1(b);
        var f = this.pq(b);
        this.rw = new PolarAxisInfoCache(this.rt, this.ru, this.ck);
        if (this.qe()) {
            b.ct.j(a.j, this.qg);
            if (this.sr()) {
                this.tx(b, a);
            }
        }
        b.cm();
        var g = this.rl(d, b.cv.g$j.ak);
        b.cv.g$h(a.n, g);
        this.tu(d, c, e, f, b);
    };
    PolarBase.prototype.ri = function (a, b) {
        return this.rj(a, b);
    };
    PolarBase.prototype.rj = function (a, b) {
        if (b < a || a < 0 || a > this.se.count || b < 0 || b > this.se.count) {
            return null;
        }
        var c = new Array((b - a) + 1);
        for (var d = a; d <= b; d++) {
            var e = d;
            c[d - a] = this.ck.item(d);
        }
        return c;
    };
    PolarBase.prototype.tx = function (a, b) {
        var _this = this;
        a.b3 = true;
        this.r5.aw(this, this.sr(), runOn(this, this.ri));
        var c = this.r5.d;
        var d = c != null;
        var e = this.getEffectiveViewport1(a);
        var f = this.ck == null ? 0 : this.ck.count;
        this.rx.cf(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.tz(h, f, a.q);
                }
                _this.r5.ac(g, i);
            }
        });
    };
    PolarBase.prototype.t0 = function (a, b, c) {
        var d = this.bk != 1;
        this.r5.ay(this.r5.b, a, b, false);
        this.r5.ab(this.fr);
        var e = this.r5.av;
        var f = null;
        var g = this.ck;
        if (d && this.cd != null) {
            f = this.cd.a3.getHighlightingInfo(this, g, e.o, e.n, false);
            e.b = f;
        }
        e.f = c;
        this.t3(e);
        this.r5.z(this, f, c, d, a < 0);
    };
    PolarBase.prototype.tz = function (a, b, c) {
        var d = this.bk != 1;
        this.r5.ay(this.r5.d, a, b, true);
        this.r5.aa(this.fr);
        var e = this.r5.au;
        var f = null;
        var g = this.ck;
        var h = null;
        if (d && this.cd != null) {
            f = this.cd.a3.getHighlightingInfo(this, g, e.o, e.n, true);
            if (this.cd.a3.isCrossSeriesHighlight(this)) {
                h = this.cd.a3.getHighlightingInfo(this, g, e.o, e.n, true);
            }
            e.b = f;
        }
        e.f = c;
        this.t2(e);
        this.r5.y(this, f, c, d, e.l, this.cd.a3.sumHighlightingProgress);
    };
    PolarBase.prototype.t3 = function (a) {
        if (this.assigningPolarStyle != null && this.sh) {
            this.assigningPolarStyle(this, a);
        }
    };
    PolarBase.prototype.t2 = function (a) {
        if (this.assigningPolarMarkerStyle != null && this.sg) {
            this.assigningPolarMarkerStyle(this, a);
        }
    };
    PolarBase.prototype.tu = function (a, b, c, d, e) {
        e.cy(a, b, c, d);
    };
    PolarBase.prototype.mv = function () {
        _super.prototype.mv.call(this);
        if (this.index < 0) {
            return;
        }
        this.rx.c1();
    };
    PolarBase.prototype.mj = function (a, b) {
        _super.prototype.mj.call(this, a, b);
        if (!this.ez) {
            this.b0.a2(b);
            return;
        }
        this.b0.a2(b);
        if (this.cx(this.bz)) {
            return;
        }
        var c = this.bz;
        if (!this.et) {
            this.r3 = new PolarFrame();
            this.t1(this.r3, c);
        }
        this.et = false;
        this.t5(this.r3, c);
        this.ez = false;
    };
    PolarBase.prototype.mg = function (a, b, c, d, e) {
        _super.prototype.mg.call(this, a, b, c, d, e);
        var f = this.a6.a$h.item(d);
        var g = f;
        f.a1(c);
        if (this.cx(g)) {
            return;
        }
        if (this.rz == null) {
            this.rz = new PolarFrame();
        }
        this.t1(this.rz, g);
        this.t5(this.rz, g);
    };
    PolarBase.prototype.t4 = 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.rh = function (a, b, c) {
        this.ty();
        return this.ry.w.toArray();
    };
    PolarBase.prototype.sv = function (a) {
        var e_3, _a;
        var b = new List$1(Number_$type, 0);
        var c = this.ck;
        try {
            for (var _b = __values(fromEnum(this.rx.cw.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.ux = function (a) {
        return { $type: Point_$type, x: this.se.item(a), y: this.sf.item(a) };
    };
    PolarBase.prototype.k7 = function (a) {
        _super.prototype.k7.call(this, a);
        this.a8.exportTrendlineData(this, a, this.rx.cv.g$j);
    };
    PolarBase.prototype.getDataLegendSeriesContextAt = function (a, b) {
        var c = { $type: Point_$type, x: a, y: b };
        var d = this.ht(c);
        var e = d == null ? NaN : this.gb(d, "RadiusMemberPath");
        var f = d == null ? NaN : this.gb(d, "AngleMemberPath");
        var g = new DataLegendSeriesValueInfo();
        g.l = e;
        g.a = 11;
        g.p = this.tr != null ? this.tr : "Radius";
        g.q = this.tn != null ? this.tn : "R:";
        g.r = this.tp != null ? this.tp : "";
        var h = new DataLegendSeriesValueInfo();
        h.l = f;
        h.a = 10;
        h.p = this.td != null ? this.td : "Angle";
        h.q = this.s9 != null ? this.s9 : "A:";
        h.r = this.tb != null ? this.tb : "";
        var i = new DataLegendSeriesContext();
        i.f = ((function () {
            var $ret = new List$1(DataLegendSeriesValueInfo.$, 0);
            $ret.add(g);
            $ret.add(h);
            return $ret;
        })());
        i.b = this.av();
        return i;
    };
    PolarBase.$t = markType(PolarBase, 'PolarBase', MarkerSeries.$);
    PolarBase.t6 = 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:rt:t7', [NumericAngleAxis.$, null], 'AngleMemberAsLegendLabel:s9:t8', [2, null], 'AngleMemberAsLegendUnit:tb:t9', [2, null], 'AngleMemberPath:td:ua', [2], 'ClipSeriesToBounds:sk:ub', [0, false], 'IsCustomPolarMarkerStyleAllowed:sm:uc', [0, false], 'IsCustomPolarStyleAllowed:sn:ud', [0, false], 'ItemSearchMode:r9:ue', [ScatterItemSearchMode_$type, enumGetBox(ScatterItemSearchMode_$type, 0)], 'ItemSearchThreshold:s2:uf', [1, 10000], 'MaximumMarkers:s3:ug', [1, 400], 'RadiusAxis:ru:uh', [NumericRadiusAxis.$, null], 'RadiusMemberAsLegendLabel:tn:ui', [2, null], 'RadiusMemberAsLegendUnit:tp:uj', [2, null], 'RadiusMemberPath:tr:uk', [2], 'UseCartesianInterpolation:st:us', [0, true], 'TrendLineType:sb:uq', [TrendLineType_$type, enumGetBox(TrendLineType_$type, 0)], 'TrendLineThickness:s1:up', [1, 1.5], 'TrendLinePeriod:s4:uo', [1, 7], 'TrendLineZIndex:s5:ur', [1, 1], 'TrendLineBrush:uu:ul', [Brush.$, null], 'TrendLineDashArray:uv:um', [DoubleCollection.$], 'TrendLineDashCap:uw:un', [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.au = null;
        _this.av = null;
        return _this;
    }
    PolarSeriesRenderManager.prototype.c = function () {
        this.au = new AssigningPolarMarkerStyleEventArgs();
        return this.au;
    };
    PolarSeriesRenderManager.prototype.a = function () {
        this.av = new AssigningPolarStyleEventArgs();
        return this.av;
    };
    PolarSeriesRenderManager.prototype.aw = function (a, b, c) {
        this.w(a, b, c);
    };
    PolarSeriesRenderManager.prototype.ax = function (a, b, c) {
        this.x(a, b, c);
    };
    PolarSeriesRenderManager.prototype.ay = function (a, b, c, d) {
        if (b == -1) {
            a.c = false;
            a.o = 0;
            a.n = c - 1;
        }
        else {
            if (d) {
                a.o = b;
                a.n = b;
            }
            else {
                a.c = false;
                a.o = b;
                a.n = b;
            }
        }
    };
    PolarSeriesRenderManager.$t = markType(PolarSeriesRenderManager, 'PolarSeriesRenderManager', SeriesRenderManager.$);
    return PolarSeriesRenderManager;
}(SeriesRenderManager));
export { PolarSeriesRenderManager };
/**
 * @hidden
 */
var PolarBaseView = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(PolarBaseView, _super);
    function PolarBaseView(a) {
        var _this = _super.call(this, a) || this;
        _this.cu = null;
        _this.ct = null;
        _this.cv = null;
        _this.cw = null;
        _this.cu = a;
        _this.cw = new HashPool$2(Base.$, Marker.$);
        _this.ch(_this.cw);
        _this.cv = new PolarTrendLineManager();
        return _this;
    }
    PolarBaseView.prototype.as = function () {
        _super.prototype.as.call(this);
        this.ct = this.cs();
        if (!this.q) {
            this.cu.s3 = 1000;
            this.b1.qc = Defaults.e;
        }
    };
    PolarBaseView.prototype.cz = function (a) {
        this.cw.g(a);
    };
    PolarBaseView.prototype.cs = function () {
        var _this = this;
        var a = new NumericMarkerManager(0, function (b) { return _this.cw.item(b); }, function (b) { return _this.cu.rw.c.item(b); }, runOn(this, this.c0), runOn(this, this.cr), runOn(this, this.cx));
        a.n = true;
        a.p = runOn(this.cu, this.cu.ux);
        return a;
    };
    PolarBaseView.prototype.c0 = function (a) {
        this.cu.t4(a, this.cw);
    };
    PolarBaseView.prototype.cr = function () {
        return this.cu.rh(this.cw, this.bv, this.bu);
    };
    PolarBaseView.prototype.cx = function () {
        return this.cu.sv(this.cw);
    };
    PolarBaseView.prototype.cy = function (a, b, c, d) {
        if (this.cu.sk) {
            var e = new GeometryGroup();
            this.cu.ru.n0(e, a, b, c, d);
        }
        else {
        }
    };
    PolarBaseView.prototype.c1 = function () {
        if (this.cu.uu != null) {
            this.cu.ut = this.cu.uu;
        }
        else {
            this.cu.ut = this.cu.oy;
        }
    };
    PolarBaseView.prototype.cf = function (a) {
        this.cw.f(a);
    };
    PolarBaseView.prototype.a5 = function (a, b) {
        if (a.d) {
            if (this.cu.sb != 0 && !b) {
                var c = this.cv.g$j;
                c.ac = this.cu.s1;
                c._stroke = this.cu.ut;
                c.ad = this.cu.uw;
                c.ai = this.cu.uv;
                a.u(c);
            }
        }
        _super.prototype.a5.call(this, a, b);
    };
    PolarBaseView.prototype.c2 = function () {
        return Rect.empty;
    };
    PolarBaseView.prototype.getDefaultTooltipTemplate = function () {
        var a = "<div class='ui-chart-default-tooltip-content'><span>" + "${item." + this.cu.td + "}" + "</span><br/><span";
        var b = this.e.a6.a$r(this.e);
        if (!stringIsNullOrEmpty(b)) {
            a += " style='color:" + b + "'";
        }
        a += ">" + this.cu.title + ": </span><span class='ui-priority-primary'>" + "${item." + this.cu.tr + "}</span></div>";
        return a;
    };
    PolarBaseView.$t = markType(PolarBaseView, 'PolarBaseView', MarkerSeriesView.$);
    return PolarBaseView;
}(MarkerSeriesView));
export { PolarBaseView };
