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