/*
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 { 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
 */
export let PolarBase = /*@__PURE__*/ (() => {
    class PolarBase extends MarkerSeries {
        constructor() {
            super();
            this.r3 = null;
            this.rp = null;
            this.r1 = null;
            this.u5 = null;
            this.u4 = null;
            this.sf = null;
            this.sh = null;
            this.si = null;
            this.r7 = new PolarFrame();
            this.r9 = new PolarFrame();
            this.r5 = new PolarFrame();
            this.r0 = null;
            this.sz = null;
            this.sb = 1;
            this.sm = false;
            this.sl = false;
            this.rw = null;
            this.rx = null;
            this.assigningPolarStyle = null;
            this.assigningPolarMarkerStyle = null;
            this.sa = null;
            this.r8 = null;
            this.r4 = null;
            this.sa = new PolarSeriesRenderManager();
            this.sc = this.sd();
            this.r8 = new PolarFrame();
            this.r9.x = runOn(this, this.u3);
            this.r7.x = runOn(this, this.u3);
            this.r5.x = runOn(this, this.u3);
            this.sf = new SeriesRenderer$2(PolarFrame.$, PolarBaseView.$, 0, runOn(this, this.t6), runOn(this, this.ua), runOn(this, this.cv), runOn(this, this.mu), runOn(this, this.t1));
        }
        bx() {
            return new PolarBaseView(this);
        }
        l2(a) {
            super.l2(a);
            this.r2 = a;
        }
        kx() {
            super.kx();
            this.ry = null;
            this.rz = null;
        }
        get_d7() {
            return true;
        }
        c1(a, b, c, d) {
            if (!this.hasMarkers) {
                return false;
            }
            let e = this.ry;
            let f = new ScalerParams(1, this.cd.s9, this.p3, e.cg);
            f.c = this.getEffectiveViewport1(this.b0);
            let g = this.rz;
            let h = new ScalerParams(1, this.cd.s9, this.p3, g.cg);
            h.c = this.getEffectiveViewport1(this.b0);
            a.clear();
            this.qg.cf((i) => {
                if (i._visibility == 0) {
                    let j = new SeriesPointOfInterest();
                    let k = i.n;
                    let l = i.o;
                    if (k < this.p3.left || k > this.p3.right || l < this.p3.top || l > this.p3.bottom) {
                        return;
                    }
                    let m;
                    let n;
                    let o = this.r0.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;
        }
        t1() {
            if (this.ce.g) {
                this.ce.t();
            }
        }
        t3() {
            this.r0.e(this.r3.w, this.sj, this.sk, this.u5, this.u4, (a, b) => Math.cos(b), (a, b) => Math.sin(b), true);
        }
        get sj() {
            return this.sh;
        }
        set sj(a) {
            if (this.sh != a) {
                let b = this.sj;
                this.sh = a;
                this.raisePropertyChanged("AngleColumn", b, this.sj);
            }
        }
        get sk() {
            return this.si;
        }
        set sk(a) {
            if (this.si != a) {
                let b = this.sk;
                this.si = a;
                this.raisePropertyChanged("RadiusColumn", b, this.sk);
            }
        }
        get uy() {
            return this.c(PolarBase.ub);
        }
        set uy(a) {
            this.h(PolarBase.ub, a);
        }
        r6() {
            let a = this.r5;
            if (this.cv()) {
                if (this.ce.g) {
                    this.ce.t();
                }
                a = this.r9;
            }
            return a;
        }
        li() {
            super.li();
            if (this.rz != null) {
                this.rz.h7(false);
            }
            if (this.ry != null) {
                this.ry.h7(false);
            }
        }
        k3(a, b, c, d) {
            let e = false;
            this.r2.cv.g$e(a, b, c, d);
            if (this.ry != null && !this.ry.c0()) {
                e = true;
            }
            if (this.rz != null && !this.rz.c0()) {
                e = true;
            }
            if (e) {
                this.ml(true);
            }
        }
        m8(a, b) {
            this.ml(false);
        }
        m9(a, b) {
            this.ml(false);
        }
        fb(a, b, c) {
            let d = true;
            if (!super.fb(a, b, c) || !c.o() || b.isEmpty || a.isEmpty || this.ry == null || this.rz == null || this.sj == null || this.sk == null || this.sj.count == 0 || this.sk.count == 0 || this.ck == null || this.ck.count != this.sj.count || this.ck.count != this.sk.count || this.r0 == null || this.ry.bh == null || this.rz.bh == null || this.ry.lv == this.ry.lu || this.rz.lv == this.rz.lu) {
                d = false;
            }
            return d;
        }
        mm(a) {
            let b;
            let c;
            let d = this.getViewInfo(c, b);
            c = d.p0;
            b = d.p1;
            if (!this.fb(c, b, this.b0)) {
                this.k0(true, this.b0);
                return;
            }
            this.u5 = b;
            this.u4 = c;
            this.r1 = new PolarAxisInfoCache(this.ry, this.rz, this.ck);
            let e = new SeriesRenderingArguments(this, c, b, a, this.eu);
            let f = this.sf.g(e, this.r7, this.r5, this.r9, this.r2);
            this.r7 = f.p1;
            this.r5 = f.p2;
            this.r9 = f.p3;
        }
        u3(a) {
            let b = this.r0.h(a.x, a.y, this.u5, this.u4, this.r1.e, this.r1.d, this.r1.g, this.r1.f, this.r1.i, this.r1.h);
            return b;
        }
        ap(a) {
            if (a != null && a == this.ry && this.sj != null) {
                return new AxisRange(this.sj.minimum, this.sj.maximum);
            }
            if (a != null && a == this.rz && this.sk != null) {
                return new AxisRange(this.sk.minimum, this.sk.maximum);
            }
            return null;
        }
        eo(a) {
            let b = this.b0.bv;
            b = b.copy();
            let c = this.b0.bu;
            let d = !b.isEmpty && !c.isEmpty && this.ck != null ? this.ck.indexOf(a) : -1;
            if (this.ry == null || this.sj == null || this.rz == null || this.sk == null) {
                return false;
            }
            if (d < 0 || d > this.sj.count - 1 || d > this.sk.count - 1) {
                return false;
            }
            let e = this.ry.getScaledAngle(this.sj.item(d));
            let f = this.rz.ns(this.sk.item(d));
            let g = 0.5 + (Math.cos(e) * f);
            let 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;
        }
        hv(a) {
            let b = this.hf(a);
            if (this.ck != null && b >= 0 && b < this.ck.count) {
                return this.ck.item(b);
            }
            return null;
        }
        hf(a) {
            let b = truncate(Math.round(this.f7(a)));
            return b;
        }
        f7(a) {
            switch (this.sc) {
                case 1: return this.s3(a);
                case 3: return this.s4(a);
                case 2: return this.s1(a);
                case 4: return this.s2(a);
            }
            return -1;
        }
        s2(a) {
            return this.s5(a, false);
        }
        s1(a) {
            let b = this.pl(a);
            let c = b.x;
            let d = b.y;
            if (this.ck == null || this.ry == null || this.rz == null || this.sj == null || this.sk == null) {
                return -1;
            }
            if (this.ck.count > this.s7) {
                return -1;
            }
            if (!this.sq()) {
                return -1;
            }
            let e = this.sz;
            let f = 1.7976931348623157E+308;
            let g = -1;
            for (let h = 0; h < this.sj.count; h++) {
                let i = e._inner[h].x;
                let j = e._inner[h].y;
                let k = (c - i) * (c - i) + (d - j) * (d - j);
                if (k < f) {
                    f = k;
                    g = h;
                }
            }
            return g;
        }
        sq() {
            let a = this.r5;
            if (this.cv()) {
                a = this.r9;
            }
            if (a == null || a.w.count == 0) {
                return false;
            }
            this.sz = a.w;
            return true;
        }
        s5(a, b) {
            if (!this.st) {
                return -1;
            }
            let c = { $type: Point_$type, x: 0, y: 0 };
            let d = true;
            let e = this.r5;
            if (this.cv()) {
                e = this.r9;
            }
            if (e == null) {
                return -1;
            }
            if (e.m == null) {
                return -1;
            }
            if (this.ck == null || this.ck.count > this.s7) {
                return -1;
            }
            if (!this.sq()) {
                return -1;
            }
            let f = this.sz;
            let g = this.pl(a);
            let h = 1.7976931348623157E+308;
            let i = -1;
            for (let j = 0; j < f.count; j++) {
                let 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))) {
                        let l = GeometryUtil.d(g, c, k);
                        if (l < h) {
                            h = l;
                            i = j;
                        }
                    }
                }
                c = k;
            }
            if (i >= 0) {
                let m = f._inner[i];
                let n = f._inner[i - 1];
                if (!b || (e.j.containsKey(this.ck.item(i)) && e.j.containsKey(this.ck.item(i - 1)))) {
                    let 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;
        }
        s4(a) {
            return this.s5(a, true);
        }
        s3(a) {
            let b = null;
            let c = 1.7976931348623157E+308;
            let d = this.pl(a);
            let e = d.x;
            let f = d.y;
            if (this.r2.cw.e > this.s7) {
                return -1;
            }
            this.r2.cz((g) => {
                if (g._visibility == 0) {
                    let h = this.r2.cp(g);
                    let i = h.left + h.width / 2;
                    let j = h.top + h.height / 2;
                    let k = (e - i) * (e - i) + (f - j) * (f - j);
                    if (k < c) {
                        c = k;
                        b = g;
                    }
                }
            });
            if (b != null) {
                return b.ak;
            }
            return -1;
        }
        pq(a, b, c) {
            if (this.ry == null || this.rz == null || this.sj == null || this.sk == null) {
                return { $type: Point_$type, x: NaN, y: NaN };
            }
            let d = this.b0.bv;
            let e = this.b0.bu;
            let f = this.getEffectiveViewport();
            let g = new ScalerParams(0, d, e, this.ry.cg, f);
            let h = ((() => {
                let $ret = new ScalerParams(0, d, e, this.rz.cg, f);
                $ret.b = this.ge();
                return $ret;
            })());
            if (b) {
                let i = this.f7(a);
                if (i == -1) {
                    return { $type: Point_$type, x: NaN, y: NaN };
                }
                let j = truncate(Math.floor(i));
                let 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.r0.h(this.sj.item(j), this.sk.item(j), d, e, this.r1.e, this.r1.d, this.r1.g, this.r1.f, this.r1.i, this.r1.h);
                }
                let l = i - Math.floor(i);
                let m = this.r0.h(this.sj.item(j), this.sk.item(j), d, e, this.r1.e, this.r1.d, this.r1.g, this.r1.f, this.r1.i, this.r1.h);
                let n = this.r0.h(this.sj.item(k), this.sk.item(k), d, e, this.r1.e, this.r1.d, this.r1.g, this.r1.f, this.r1.i, this.r1.h);
                let o = m.x;
                let p = m.y;
                let q = n.x;
                let r = n.y;
                let s = q - o;
                let t = r - p;
                return { $type: Point_$type, x: o + s * l, y: p + t * l };
            }
            else {
                let u = this.hf(a);
                if (u == -1) {
                    return { $type: Point_$type, x: NaN, y: NaN };
                }
                return this.r0.h(this.sj.item(u), this.sk.item(u), d, e, this.r1.e, this.r1.d, this.r1.g, this.r1.f, this.r1.i, this.r1.h);
            }
        }
        ag() {
            return [this.ry, this.rz];
        }
        hy(a, b) {
            let c = this.js(b);
            if (c == PolarBase.$$p[3]) {
                return this.hz(a, b, this.ti);
            }
            if (c == PolarBase.$$p[13]) {
                return this.hz(a, b, this.tw);
            }
            return super.hy(a, b);
        }
        l7(a, b, c, d) {
            super.l7(a, b, c, d);
            if (this.r2.cv.g$b(a, b, c, d)) {
                this.ml(false);
                this.ls();
            }
            switch (b) {
                case "FastItemsSource":
                    if (typeCast(IFastItemsSource_$type, c) != null) {
                        c.deregisterColumn(this.sj);
                        c.deregisterColumn(this.sk);
                        this.sj = null;
                        this.sk = null;
                    }
                    if (typeCast(IFastItemsSource_$type, d) != null) {
                        this.sj = this.ch(this.ti);
                        this.sk = this.ch(this.tw);
                    }
                    if ((this.rz != null && !this.rz.c0()) || (this.ry != null && !this.ry.c0())) {
                        this.ml(false);
                    }
                    break;
                case PolarBase.$$p[0]:
                    if (this.ry != null && this.rz != null) {
                        this.r0 = new PolarAxes(this.rz, this.ry);
                    }
                    if (c != null) {
                        c.bz(this);
                    }
                    if (d != null) {
                        d.cs(this);
                    }
                    if (this.ry != null && !this.ry.c0()) {
                        this.ml(false);
                    }
                    else if (c != null && d == null) {
                        this.k0(true, this.b0);
                    }
                    break;
                case PolarBase.$$p[10]:
                    if (this.ry != null && this.rz != null) {
                        this.r0 = new PolarAxes(this.rz, this.ry);
                    }
                    if (c != null) {
                        c.bz(this);
                    }
                    if (d != null) {
                        d.cs(this);
                    }
                    if (this.rz != null && !this.rz.c0()) {
                        this.ml(false);
                    }
                    else if (c != null && d == null) {
                        this.k0(true, this.b0);
                    }
                    if (this.ry != null && !this.ry.c0()) {
                        this.ry.h3();
                    }
                    break;
                case PolarBase.$$p[3]:
                    if (this.ck != null) {
                        this.ck.deregisterColumn(this.sj);
                        this.sj = this.ch(this.ti);
                    }
                    break;
                case "AngleColumn":
                    this.r2.cv.g$i();
                    if (this.ry != null && !this.ry.c0()) {
                        this.ml(false);
                    }
                    break;
                case PolarBase.$$p[13]:
                    if (this.ck != null) {
                        this.ck.deregisterColumn(this.sk);
                        this.sk = this.ch(this.tw);
                    }
                    break;
                case "RadiusColumn":
                    this.r2.cv.g$i();
                    if (this.rz != null && !this.rz.c0()) {
                        this.ml(false);
                    }
                    break;
                case PolarBase.$$p[14]:
                    this.ml(false);
                    this.ls();
                    break;
                case PolarBase.$$p[9]:
                    this.ml(false);
                    this.ls();
                    break;
                case "TransitionProgress":
                    this.r1 = new PolarAxisInfoCache(this.ry, this.rz, this.ck);
                    this.u5 = this.b0.bv;
                    this.u4 = this.b0.bu;
                    this.r9.v = this.sy;
                    this.r9.c(this.g2, this.r7, this.r5);
                    if (this.cx(this.b0)) {
                        return;
                    }
                    if (this.g2 == 1) {
                        this.ua(this.r5, this.r2);
                    }
                    else {
                        this.ua(this.r9, this.r2);
                    }
                    if (this.cd != null) {
                        this.cd.oa(this);
                    }
                    break;
                case "TrendLineBrush":
                    this.mz();
                    break;
                case PolarBase.$$p[4]:
                    this.ml(false);
                    this.ls();
                    break;
                case "TrendLineType":
                    this.ls();
                    break;
                case PolarBase.$$p[6]:
                    this.sm = this.sv();
                    this.ml(false);
                    break;
                case PolarBase.$$p[5]:
                    this.sl = this.su();
                    this.ml(false);
                    break;
                case PolarBase.$$p[7]:
                    this.sc = this.sd();
                    break;
            }
        }
        get sc() {
            return this.sb;
        }
        set sc(a) {
            let b = this.sb;
            this.sb = a;
            if (b != this.sb) {
                this.raisePropertyChanged("ActualItemSearchMode", enumGetBox(ScatterItemSearchMode_$type, b), enumGetBox(ScatterItemSearchMode_$type, this.sb));
            }
        }
        sd() {
            if (this.se != 0) {
                return this.se;
            }
            return this.st ? 4 : 1;
        }
        get_st() {
            return false;
        }
        get st() {
            return this.get_st();
        }
        sv() {
            return this.ss;
        }
        su() {
            return this.sr;
        }
        so(a) {
            if (typeCast(NumericRadiusAxis.$, a) !== null) {
                return true;
            }
            return false;
        }
        sn(a) {
            if (typeCast(NumericAngleAxis.$, a) !== null) {
                return true;
            }
            return false;
        }
        k0(a, b) {
            super.k0(a, b);
            let c = b;
            if (a) {
                c.cw.clear();
            }
            c.cv.g$d();
        }
        rq(a, b) {
            let c = a.top - 10;
            let d = a.bottom + 10;
            let e = a.left - 10;
            let f = a.right + 10;
            let g = ((() => {
                let $ret = new Clipper(1, e, d, f, c, false);
                $ret.i = b;
                return $ret;
            })());
            return g;
        }
        t0(a, b, c, d) {
            a.g = new Dictionary$2(Base.$, OwnedPoint.$, 1, b);
            let e = this.ck;
            for (let f = 0; f < b; f++) {
                let g = a.w._inner[f];
                if (!isInfinity(g.x) && !isInfinity(g.y)) {
                    let h = { $type: Point_$type, x: this.sj.item(f), y: this.sk.item(f) };
                    let i = { $type: Point_$type, x: g.x, y: g.y };
                    a.g.addItem(e.item(f), ((() => {
                        let $ret = new OwnedPoint();
                        $ret.a = e.item(f);
                        $ret.b = h;
                        $ret.c = i;
                        return $ret;
                    })()));
                }
            }
        }
        t6(a, b) {
            let c = b.bv;
            let d = b.bu;
            a.j.clear();
            a.n.clear();
            let e = Math.min(this.sj != null ? this.sj.count : 0, this.sk != null ? this.sk.count : 0);
            if (e < 1) {
                return;
            }
            this.r1 = new PolarAxisInfoCache(this.ry, this.rz, this.ck);
            this.r3 = a;
            this.u4 = d;
            this.u5 = c;
            b.ct.l(a.j, this.s8, c, d, this.fv);
            if (e <= this.s8) {
                this.t0(a, e, c, d);
            }
            let f = this.rq(d, a.n);
            let g = Math.min(this.ry.lv, this.ry.lu);
            let h = Math.max(this.ry.lu, this.ry.lv);
            b.cv.i = this.sy;
            b.cv.h = 0;
            b.cv.k = this.rz.nm;
            b.cv.j = this.rz.nl;
            b.cv.l = (i, j) => this.r0.c(i, j, c, d, Math.cos);
            b.cv.m = (i, j) => this.r0.d(i, j, c, d, Math.sin);
            let i = new List$1(Number_$type, 0);
            for (let j = 0; j < this.sj.count; j++) {
                if (this.sj.item(j) >= g && this.sj.item(j) <= h) {
                    i.add(this.sj.item(j));
                }
            }
            let k = this.sk;
            if (i.count != this.sj.count) {
                k = new List$1(Number_$type, 0);
                for (let l = 0; l < this.sj.count; l++) {
                    if (this.sj.item(l) >= g && this.sj.item(l) <= h) {
                        k.add(this.sk.item(l));
                    }
                }
            }
            b.cv.n(a.n, this.sg, i, k, this.s9, runOn(this.ry, this.ry.getScaledAngle), runOn(this.rz, this.rz.ns), ((() => {
                let $ret = new TrendResolutionParams();
                $ret.b = this.fv;
                $ret.f = d;
                $ret.g = c;
                return $ret;
            })()), f, g, h);
        }
        get_dy() {
            return true;
        }
        ru(a, b, c) {
            return null;
        }
        rv(a, b, c) {
            let d = this.r6();
            let e = this.r2.by(this.pl(b));
            let 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;
            }
            let 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;
        }
        rt(a, b, c) {
            let 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;
        }
        aw(a, b, c) {
            if (this.c2 && this.eg(this.bk) && !c) {
                let d = this.ru(a, b, this.rw);
                this.rw = d;
                return d;
            }
            else {
                let e = this.rt(a, b, this.rw);
                this.rw = e;
                return e;
            }
        }
        ax(a, b, c) {
            if (this.eg(this.bk) && !c) {
                let d = this.rv(a, b, this.rx);
                this.rx = d;
                return d;
            }
            else {
                let e = this.rt(a, b, this.rx);
                e.e = true;
                this.rx = e;
                return e;
            }
        }
        sx() {
            return (this.assigningPolarStyle != null && this.sm) || (this.bk != 1);
        }
        sw() {
            return (this.assigningPolarMarkerStyle != null && this.sl) || (this.bk != 1);
        }
        ua(a, b) {
            let c = b.bv;
            let d = b.bu;
            let e = this.getEffectiveViewport1(b);
            let f = this.pv(b);
            this.r1 = new PolarAxisInfoCache(this.ry, this.rz, this.ck);
            if (this.qj()) {
                b.ct.j(a.j, this.ql);
                if (this.sw()) {
                    this.t2(b, a);
                }
            }
            b.cm();
            let g = this.rq(d, b.cv.g$j.ak);
            b.cv.g$h(a.n, g);
            this.tz(d, c, e, f, b);
        }
        rn(a, b) {
            return this.ro(a, b);
        }
        ro(a, b) {
            if (b < a || a < 0 || a > this.sj.count || b < 0 || b > this.sj.count) {
                return null;
            }
            let c = new Array((b - a) + 1);
            for (let d = a; d <= b; d++) {
                let e = d;
                c[d - a] = this.ck.item(d);
            }
            return c;
        }
        t2(a, b) {
            a.b3 = true;
            this.sa.aw(this, this.sw(), runOn(this, this.rn));
            let c = this.sa.d;
            let d = c != null;
            let e = this.getEffectiveViewport1(a);
            let f = this.ck == null ? 0 : this.ck.count;
            this.r2.cf((g) => {
                if (g._visibility == 0) {
                    let h = g.ak;
                    let i = g.content;
                    if (i == null) {
                        i = new DataContext();
                        g.content = i;
                    }
                    if (d) {
                        this.t4(h, f, a.q);
                    }
                    this.sa.ac(g, i);
                }
            });
        }
        t5(a, b, c) {
            let d = this.bk != 1;
            this.sa.ay(this.sa.b, a, b, false);
            this.sa.ab(this.ft);
            let e = this.sa.av;
            let f = null;
            let g = this.ck;
            if (d && this.cd != null) {
                f = this.cd.a7.getHighlightingInfo(this, g, e.o, e.n, false);
                e.b = f;
            }
            e.f = c;
            this.t8(e);
            this.sa.z(this, f, c, d, a < 0);
        }
        t4(a, b, c) {
            let d = this.bk != 1;
            this.sa.ay(this.sa.d, a, b, true);
            this.sa.aa(this.ft);
            let e = this.sa.au;
            let f = null;
            let g = this.ck;
            let h = null;
            if (d && this.cd != null) {
                f = this.cd.a7.getHighlightingInfo(this, g, e.o, e.n, true);
                if (this.cd.a7.isCrossSeriesHighlight(this)) {
                    h = this.cd.a7.getHighlightingInfo(this, g, e.o, e.n, true);
                }
                e.b = f;
            }
            e.f = c;
            this.t7(e);
            this.sa.y(this, f, c, d, e.l, this.cd.a7.sumHighlightingProgress);
        }
        t8(a) {
            if (this.assigningPolarStyle != null && this.sm) {
                this.assigningPolarStyle(this, a);
            }
        }
        t7(a) {
            if (this.assigningPolarMarkerStyle != null && this.sl) {
                this.assigningPolarMarkerStyle(this, a);
            }
        }
        tz(a, b, c, d, e) {
            e.cy(a, b, c, d);
        }
        mz() {
            super.mz();
            if (this.index < 0) {
                return;
            }
            this.r2.c1();
        }
        mn(a, b) {
            super.mn(a, b);
            if (!this.e1) {
                this.b0.a2(b);
                return;
            }
            this.b0.a2(b);
            if (this.cx(this.bz)) {
                return;
            }
            let c = this.bz;
            if (!this.ev) {
                this.r8 = new PolarFrame();
                this.t6(this.r8, c);
            }
            this.ev = false;
            this.ua(this.r8, c);
            this.e1 = false;
        }
        mk(a, b, c, d, e) {
            super.mk(a, b, c, d, e);
            let f = this.a6.a$h.item(d);
            let g = f;
            f.a1(c);
            if (this.cx(g)) {
                return;
            }
            if (this.r4 == null) {
                this.r4 = new PolarFrame();
            }
            this.t6(this.r4, g);
            this.ua(this.r4, g);
        }
        t9(a, b) {
            let c = new List$1(Base.$, 0);
            for (let d of fromEnum(b.c)) {
                if (!a.containsKey(d)) {
                    c.add1(d);
                }
            }
            for (let e of fromEnum(c)) {
                b.h(e);
            }
        }
        rm(a, b, c) {
            this.t3();
            return this.r3.w.toArray();
        }
        s0(a) {
            let b = new List$1(Number_$type, 0);
            let c = this.ck;
            for (let d of fromEnum(this.r2.cw.c)) {
                b.add(c.indexOf(d));
            }
            return b;
        }
        u2(a) {
            return { $type: Point_$type, x: this.sj.item(a), y: this.sk.item(a) };
        }
        la(a) {
            super.la(a);
            this.a8.exportTrendlineData(this, a, this.r2.cv.g$j);
        }
        getDataLegendSeriesContextAt(a, b) {
            let c = { $type: Point_$type, x: a, y: b };
            let d = this.hv(c);
            let e = d == null ? NaN : this.gd(d, "RadiusMemberPath");
            let f = d == null ? NaN : this.gd(d, "AngleMemberPath");
            let g = new DataLegendSeriesValueInfo();
            g.l = e;
            g.a = 11;
            g.q = this.tw != null ? this.tw : "Radius";
            g.p = "Radius";
            g.r = this.ts != null ? this.ts : "R:";
            g.s = this.tu != null ? this.tu : "";
            let h = new DataLegendSeriesValueInfo();
            h.l = f;
            h.a = 10;
            h.q = this.ti != null ? this.ti : "Angle";
            h.p = "Angle";
            h.r = this.te != null ? this.te : "A:";
            h.s = this.tg != null ? this.tg : "";
            let i = new DataLegendSeriesContext();
            i.f = ((() => {
                let $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.ub = DependencyProperty.i("ActualTrendLineBrush", Brush.$, PolarBase.$, new PropertyMetadata(2, null, (a, b) => a.raisePropertyChanged("ActualTrendLineBrush", b.oldValue, b.newValue)));
    PolarBase.$$p = markDep(DependencyProperty, PropertyMetadata, PolarBase, 'raisePropertyChanged', ['AngleAxis:ry:uc', [NumericAngleAxis.$, null], 'AngleMemberAsLegendLabel:te:ud', [2, null], 'AngleMemberAsLegendUnit:tg:ue', [2, null], 'AngleMemberPath:ti:uf', [2], 'ClipSeriesToBounds:sp:ug', [0, false], 'IsCustomPolarMarkerStyleAllowed:sr:uh', [0, false], 'IsCustomPolarStyleAllowed:ss:ui', [0, false], 'ItemSearchMode:se:uj', [ScatterItemSearchMode_$type, enumGetBox(ScatterItemSearchMode_$type, 0)], 'ItemSearchThreshold:s7:uk', [1, 10000], 'MaximumMarkers:s8:ul', [1, 400], 'RadiusAxis:rz:um', [NumericRadiusAxis.$, null], 'RadiusMemberAsLegendLabel:ts:un', [2, null], 'RadiusMemberAsLegendUnit:tu:uo', [2, null], 'RadiusMemberPath:tw:up', [2], 'UseCartesianInterpolation:sy:ux', [0, true], 'TrendLineType:sg:uv', [TrendLineType_$type, enumGetBox(TrendLineType_$type, 0)], 'TrendLineThickness:s6:uu', [1, 1.5], 'TrendLinePeriod:s9:ut', [1, 7], 'TrendLineZIndex:ta:uw', [1, 1], 'TrendLineBrush:uz:uq', [Brush.$, null], 'TrendLineDashArray:u0:ur', [DoubleCollection.$], 'TrendLineDashCap:u1:us', [PenLineCap_$type, enumGetBox(PenLineCap_$type, 0)]]);
    return PolarBase;
})();
/**
 * @hidden
 */
export let PolarSeriesRenderManager = /*@__PURE__*/ (() => {
    class PolarSeriesRenderManager extends SeriesRenderManager {
        constructor() {
            super(...arguments);
            this.au = null;
            this.av = null;
        }
        c() {
            this.au = new AssigningPolarMarkerStyleEventArgs();
            return this.au;
        }
        a() {
            this.av = new AssigningPolarStyleEventArgs();
            return this.av;
        }
        aw(a, b, c) {
            this.w(a, b, c);
        }
        ax(a, b, c) {
            this.x(a, b, c);
        }
        ay(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;
})();
/**
 * @hidden
 */
export let PolarBaseView = /*@__PURE__*/ (() => {
    class PolarBaseView extends MarkerSeriesView {
        constructor(a) {
            super(a);
            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();
        }
        as() {
            super.as();
            this.ct = this.cs();
            if (!this.q) {
                this.cu.s8 = 1000;
                this.b1.qh = Defaults.e;
            }
        }
        cz(a) {
            this.cw.g(a);
        }
        cs() {
            let a = new NumericMarkerManager(0, (b) => this.cw.item(b), (b) => this.cu.r1.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.u2);
            return a;
        }
        c0(a) {
            this.cu.t9(a, this.cw);
        }
        cr() {
            return this.cu.rm(this.cw, this.bv, this.bu);
        }
        cx() {
            return this.cu.s0(this.cw);
        }
        cy(a, b, c, d) {
            if (this.cu.sp) {
                let e = new GeometryGroup();
                this.cu.rz.n0(e, a, b, c, d);
            }
            else {
            }
        }
        c1() {
            if (this.cu.uz != null) {
                this.cu.uy = this.cu.uz;
            }
            else {
                this.cu.uy = this.cu.o3;
            }
        }
        cf(a) {
            this.cw.f(a);
        }
        a5(a, b) {
            if (a.d) {
                if (this.cu.sg != 0 && !b) {
                    let c = this.cv.g$j;
                    c.ac = this.cu.s6;
                    c._stroke = this.cu.uy;
                    c.ad = this.cu.u1;
                    c.ai = this.cu.u0;
                    a.v(c);
                }
            }
            super.a5(a, b);
        }
        c2() {
            return Rect.empty;
        }
        getDefaultTooltipTemplate() {
            let a = "<div class='ui-chart-default-tooltip-content'><span>" + "${item." + this.cu.ti + "}" + "</span><br/><span";
            let 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.tw + "}</span></div>";
            return a;
        }
    }
    PolarBaseView.$t = markType(PolarBaseView, 'PolarBaseView', MarkerSeriesView.$);
    return PolarBaseView;
})();
