/*
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, fromEnum, Point_$type, typeCast, 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 "igniteui-angular-core";
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 { SeriesLayerPropertyOverlay } from "./SeriesLayerPropertyOverlay";
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 { PolarTrendLineManager } from "./PolarTrendLineManager";
import { TrendResolutionParams } from "./TrendResolutionParams";
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 { ChartSelection } from "./ChartSelection";
import { CollisionRect } 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.y8 = null;
            this.yz = null;
            this.y6 = null;
            this.acp = null;
            this.aco = null;
            this.acn = null;
            this.zk = null;
            this.zr = null;
            this.zs = null;
            this.zc = new PolarFrame();
            this.ze = new PolarFrame();
            this.za = new PolarFrame();
            this.y5 = null;
            this.aaa = null;
            this.zg = 1;
            this.zw = false;
            this.zv = false;
            this.zp = null;
            this.zq = null;
            this.assigningPolarStyle = null;
            this.assigningPolarMarkerStyle = null;
            this.zf = null;
            this.zd = null;
            this.y9 = null;
            this.zf = new PolarSeriesRenderManager();
            this.zh = this.zi();
            this.zd = new PolarFrame();
            this.ze.y = runOn(this, this.acm);
            this.zc.y = runOn(this, this.acm);
            this.za.y = runOn(this, this.acm);
            this.zk = new SeriesRenderer$2(PolarFrame.$, PolarBaseView.$, 0, runOn(this, this.abn), runOn(this, this.abr), runOn(this, this.d4), runOn(this, this.sf), runOn(this, this.abg));
        }
        ct() {
            return new PolarBaseView(this);
        }
        q7(a) {
            super.q7(a);
            this.y7 = a;
        }
        o8() {
            super.o8();
            this.y3 = null;
            this.y4 = null;
        }
        get_fq() {
            return true;
        }
        ed(a, b, c, d, e) {
            if (!this.hasMarkers) {
                return false;
            }
            let f = this.y3;
            let g = new ScalerParams(1, this.dc.xm, this.w2, f.df);
            g.c = this.getEffectiveViewport1(this.cw);
            let h = this.y4;
            let i = new ScalerParams(1, this.dc.xm, this.w2, h.df);
            i.c = this.getEffectiveViewport1(this.cw);
            a.clear();
            this.xg.cw((j) => {
                if (j._visibility == 0) {
                    let k = new SeriesPointOfInterest();
                    let l = j.n;
                    let m = j.o;
                    if (!e && (l < this.w2.left || l > this.w2.right || m < this.w2.top || m > this.w2.bottom)) {
                        return;
                    }
                    let n;
                    let o;
                    let p = this.y5.f(l, m, this.cw.ca, this.cw.b9, this.cw.getEffectiveViewport(), n, o);
                    n = p.p5;
                    o = p.p6;
                    k.d = n;
                    k.e = o;
                    k.b = j.content;
                    k.g = this.vq;
                    k.c = j.ak;
                    if (this.ha) {
                        k.g = this.vx(j.ak);
                    }
                    a.add(k);
                }
            });
            return true;
        }
        abg() {
            if (this.dd.g) {
                this.dd.t();
            }
        }
        abi() {
            this.y5.e(this.y8.x, this.zt, this.zu, this.acp, this.aco, this.acn, (a, b) => Math.cos(b), (a, b) => Math.sin(b), true);
        }
        gc() {
            return this.highlightedItemsSource != null || (this.aay != null && this.aaw != null);
        }
        z8() {
            return false;
        }
        hu() {
            let a = super.hu();
            {
                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.abj));
                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.abk));
                a.add(c);
            }
            if (this.z8()) {
                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.z8()) {
                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.r8));
                a.add(e);
            }
            if (!this.z8()) {
                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.r8));
                a.add(f);
            }
            return a;
        }
        abk(a, b) {
            if (this.aay != null) {
                b.value = this.aay;
                return;
            }
            b.value = this.abb;
        }
        abj(a, b) {
            if (this.aaw != null) {
                b.value = this.aaw;
                return;
            }
            b.value = this.aat;
        }
        get zt() {
            return this.zr;
        }
        set zt(a) {
            if (this.zr != a) {
                let b = this.zt;
                this.zr = a;
                this.raisePropertyChanged("AngleColumn", b, this.zt);
            }
        }
        get zu() {
            return this.zs;
        }
        set zu(a) {
            if (this.zs != a) {
                let b = this.zu;
                this.zs = a;
                this.raisePropertyChanged("RadiusColumn", b, this.zu);
            }
        }
        get ach() {
            return this.c(PolarBase.abs);
        }
        set ach(a) {
            this.h(PolarBase.abs, a);
        }
        zb() {
            let a = this.za;
            if (this.d4()) {
                if (this.dd.g) {
                    this.dd.t();
                }
                a = this.ze;
            }
            return a;
        }
        qh() {
            super.qh();
            if (this.y4 != null) {
                this.y4.k3(false);
            }
            if (this.y3 != null) {
                this.y3.k3(false);
            }
        }
        ph(a, b, c, d) {
            let e = false;
            this.y7.dd.g$i(a, b, c, d);
            if (this.y7.aa.count > 0) {
                for (let f of fromEnum(this.y7.aa)) {
                    f.g$i(a, b, c, d);
                }
            }
            if (this.y3 != null && !this.y3.d2()) {
                e = true;
            }
            if (this.y4 != null && !this.y4.d2()) {
                e = true;
            }
            if (e) {
                this.ry(true);
            }
        }
        sy(a, b) {
            this.ry(false);
        }
        sz(a, b) {
            this.ry(false);
        }
        hf(a, b, c) {
            let d = true;
            if (!super.hf(a, b, c) || !c.r() || b.isEmpty || a.isEmpty || this.y3 == null || this.y4 == null || this.zt == null || this.zu == null || this.zt.count == 0 || this.zu.count == 0 || this.dp == null || this.dp.count != this.zt.count || this.dp.count != this.zu.count || this.y5 == null || this.y3.b0 == null || this.y4.b0 == null || this.y3.pr == this.y3.pq || this.y4.pr == this.y4.pq) {
                d = false;
            }
            return d;
        }
        rz(a) {
            super.rz(a);
            let b;
            let c;
            let d = this.getViewInfo(c, b);
            c = d.p0;
            b = d.p1;
            if (!this.hf(c, b, this.cw)) {
                this.pb(true, this.cw);
                return;
            }
            this.acp = b;
            this.aco = c;
            this.acn = this.cw.getEffectiveViewport();
            this.y6 = new PolarAxisInfoCache(this.y3, this.y4, this.dp);
            let e = new SeriesRenderingArguments(this, c, b, a, this.gs);
            let f = this.zk.g(e, this.zc, this.za, this.ze, this.y7);
            this.zc = f.p1;
            this.za = f.p2;
            this.ze = f.p3;
        }
        acm(a) {
            let b = this.y5.h(a.x, a.y, this.acp, this.aco, this.acn, this.y6.e, this.y6.d, this.y6.g, this.y6.f, this.y6.i, this.y6.h);
            return b;
        }
        ay(a) {
            if (a != null && a == this.y3 && this.zt != null) {
                return new AxisRange(this.zt.minimum, this.zt.maximum);
            }
            if (a != null && a == this.y4 && this.zu != null) {
                return new AxisRange(this.zu.minimum, this.zu.maximum);
            }
            return null;
        }
        ge(a) {
            let b = this.cw.ca;
            b = b.copy();
            let c = this.cw.b9;
            let d = !b.isEmpty && !c.isEmpty && this.dp != null ? this.dp.indexOf(a) : -1;
            if (this.y3 == null || this.zt == null || this.y4 == null || this.zu == null) {
                return false;
            }
            if (d < 0 || d > this.zt.count - 1 || d > this.zu.count - 1) {
                return false;
            }
            let e = this.y3.getScaledAngle(this.zt.item(d));
            let f = this.y4.sh(this.zu.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.c4 != null) {
                this.c4.au(this.dc, b, true);
            }
            return d >= 0;
        }
        kr(a) {
            let b = this.j7(a);
            if (this.dp != null && b >= 0 && b < this.dp.count) {
                return this.dp.item(b);
            }
            return null;
        }
        j7(a) {
            let b = truncate(Math.round(this.it(a)));
            return b;
        }
        it(a) {
            switch (this.zh) {
                case 1: return this.aae(a);
                case 3: return this.aaf(a);
                case 2: return this.aac(a);
                case 4: return this.aad(a);
            }
            return -1;
        }
        aad(a) {
            return this.aag(a, false);
        }
        aac(a) {
            let b = this.wh(a);
            let c = b.x;
            let d = b.y;
            if (this.dp == null || this.y3 == null || this.y4 == null || this.zt == null || this.zu == null) {
                return -1;
            }
            if (this.dp.count > this.aai) {
                return -1;
            }
            if (!this.z0()) {
                return -1;
            }
            let e = this.aaa;
            let f = 1.7976931348623157E+308;
            let g = -1;
            for (let h = 0; h < this.zt.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;
        }
        z0() {
            let a = this.za;
            if (this.d4()) {
                a = this.ze;
            }
            if (a == null || a.x.count == 0) {
                return false;
            }
            this.aaa = a.x;
            return true;
        }
        aag(a, b) {
            if (!this.z3) {
                return -1;
            }
            let c = { $type: Point_$type, x: 0, y: 0 };
            let d = true;
            let e = this.za;
            if (this.d4()) {
                e = this.ze;
            }
            if (e == null) {
                return -1;
            }
            if (e.n == null) {
                return -1;
            }
            if (this.dp == null || this.dp.count > this.aai) {
                return -1;
            }
            if (!this.z0()) {
                return -1;
            }
            let f = this.aaa;
            let g = this.wh(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.dp.item(j)) || e.j.containsKey(this.dp.item(j - 1))) {
                        let l = GeometryUtil.h(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.dp.item(i)) && e.j.containsKey(this.dp.item(i - 1)))) {
                    let o = GeometryUtil.m(g, n, m);
                    return (i - 1) + o;
                }
                else if (e.j.containsKey(this.dp.item(i))) {
                    return i;
                }
                else {
                    return i - 1;
                }
            }
            return -1;
        }
        aaf(a) {
            return this.aag(a, true);
        }
        aae(a) {
            let b = null;
            let c = 1.7976931348623157E+308;
            let d = this.wh(a);
            let e = d.x;
            let f = d.y;
            if (this.y7.de.e > this.aai) {
                return -1;
            }
            this.y7.dh((g) => {
                if (g._visibility == 0) {
                    let h = this.y7.c7(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;
        }
        wm(a, b, c) {
            if (this.y3 == null || this.y4 == null || this.zt == null || this.zu == null) {
                return { $type: Point_$type, x: NaN, y: NaN };
            }
            let d = this.cw.ca;
            let e = this.cw.b9;
            let f = this.getEffectiveViewport();
            let g = new ScalerParams(0, d, e, this.y3.df, f);
            let h = ((() => {
                let $ret = new ScalerParams(0, d, e, this.y4.df, f);
                $ret.b = this.i0();
                return $ret;
            })());
            if (b) {
                let i = this.it(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.dp.count - 1) {
                    k = this.dp.count - 1;
                }
                if (j > this.dp.count - 1) {
                    j = this.dp.count - 1;
                }
                if (k == j) {
                    return this.y5.h(this.zt.item(j), this.zu.item(j), d, e, f, this.y6.e, this.y6.d, this.y6.g, this.y6.f, this.y6.i, this.y6.h);
                }
                let l = i - Math.floor(i);
                let m = this.y5.h(this.zt.item(j), this.zu.item(j), d, e, f, this.y6.e, this.y6.d, this.y6.g, this.y6.f, this.y6.i, this.y6.h);
                let n = this.y5.h(this.zt.item(k), this.zu.item(k), d, e, f, this.y6.e, this.y6.d, this.y6.g, this.y6.f, this.y6.i, this.y6.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.j7(a);
                if (u == -1) {
                    return { $type: Point_$type, x: NaN, y: NaN };
                }
                return this.y5.h(this.zt.item(u), this.zu.item(u), d, e, f, this.y6.e, this.y6.d, this.y6.g, this.y6.f, this.y6.i, this.y6.h);
            }
        }
        ai() {
            return [this.y3, this.y4];
        }
        ku(a, b) {
            let c = this.ni(b);
            if (c == PolarBase.$$p[3]) {
                return this.kv(a, b, this.aat);
            }
            if (c == PolarBase.$$p[15]) {
                return this.kv(a, b, this.abb);
            }
            if (c == PolarBase.$$p[5]) {
                return this.kv(a, b, this.aaw);
            }
            if (c == PolarBase.$$p[6]) {
                return this.kv(a, b, this.aay);
            }
            return super.ku(a, b);
        }
        mi(a) {
            let b = this.ni(a);
            if (b == PolarBase.$$p[3]) {
                return this.aat;
            }
            if (b == PolarBase.$$p[15]) {
                return this.abb;
            }
            if (b == PolarBase.$$p[5]) {
                return this.aaw;
            }
            if (b == PolarBase.$$p[6]) {
                return this.aay;
            }
            return super.mi(a);
        }
        rg(a, b, c, d) {
            super.rg(a, b, c, d);
            if (this.y7.dd.g$e(a, b, c, d)) {
                this.ry(false);
                this.qr();
            }
            switch (b) {
                case PolarBase.$$p[1]:
                case PolarBase.$$p[2]:
                case PolarBase.$$p[13]:
                case PolarBase.$$p[14]:
                    this.ql();
                    break;
                case "FastItemsSource":
                    if (typeCast(IFastItemsSource_$type, c) != null) {
                        c.deregisterColumn(this.zt);
                        c.deregisterColumn(this.zu);
                        this.zt = null;
                        this.zu = null;
                    }
                    if (typeCast(IFastItemsSource_$type, d) != null) {
                        this.zt = this.dl(this.aat);
                        this.zu = this.dl(this.abb);
                    }
                    if ((this.y4 != null && !this.y4.d2()) || (this.y3 != null && !this.y3.d2())) {
                        this.ry(this.gh && c != null);
                    }
                    break;
                case PolarBase.$$p[0]:
                    if (this.y3 != null && this.y4 != null) {
                        this.y5 = new PolarAxes(this.y4, this.y3);
                    }
                    if (c != null) {
                        c.cq(this);
                    }
                    if (d != null) {
                        d.du(this);
                    }
                    if (this.y3 != null && !this.y3.d2()) {
                        this.ry(false);
                    }
                    else if (c != null && d == null) {
                        this.pb(true, this.cw);
                    }
                    break;
                case PolarBase.$$p[12]:
                    if (this.y3 != null && this.y4 != null) {
                        this.y5 = new PolarAxes(this.y4, this.y3);
                    }
                    if (c != null) {
                        c.cq(this);
                    }
                    if (d != null) {
                        d.du(this);
                    }
                    if (this.y4 != null && !this.y4.d2()) {
                        this.ry(false);
                    }
                    else if (c != null && d == null) {
                        this.pb(true, this.cw);
                    }
                    if (this.y3 != null && !this.y3.d2()) {
                        this.y3.kz();
                    }
                    break;
                case PolarBase.$$p[3]:
                    if (this.dp != null) {
                        this.dp.deregisterColumn(this.zt);
                        this.zt = this.dl(this.aat);
                    }
                    break;
                case "AngleColumn":
                    this.y7.dd.g$m();
                    if (this.y3 != null && !this.y3.d2()) {
                        this.ry(this.gh && this.d9);
                    }
                    break;
                case PolarBase.$$p[15]:
                    if (this.dp != null) {
                        this.dp.deregisterColumn(this.zu);
                        this.zu = this.dl(this.abb);
                    }
                    break;
                case "RadiusColumn":
                    this.y7.dd.g$m();
                    if (this.y4 != null && !this.y4.d2()) {
                        this.ry(this.gh && this.d9);
                    }
                    break;
                case PolarBase.$$p[16]:
                    this.ry(false);
                    this.qr();
                    break;
                case PolarBase.$$p[11]:
                    this.ry(false);
                    this.qr();
                    break;
                case "TransitionProgress":
                    this.y6 = new PolarAxisInfoCache(this.y3, this.y4, this.dp);
                    this.acp = this.cw.ca;
                    this.aco = this.cw.b9;
                    this.acn = this.cw.getEffectiveViewport();
                    this.ze.w = this.z9;
                    this.ze.c(this.ju, this.zc, this.za);
                    if (this.d7(this.cw)) {
                        return;
                    }
                    if (this.ju == 1) {
                        this.abr(this.za, this.y7);
                        this.qu();
                    }
                    else {
                        this.abr(this.ze, this.y7);
                    }
                    if (this.dc != null) {
                        this.dc.rz(this);
                    }
                    break;
                case "TrendLineBrush":
                    this.rm(b);
                    break;
                case PolarBase.$$p[4]:
                    this.ry(false);
                    this.qr();
                    break;
                case "TrendLineType":
                    this.qr();
                    break;
                case PolarBase.$$p[8]:
                    this.zw = this.z5();
                    this.ry(false);
                    break;
                case PolarBase.$$p[7]:
                    this.zv = this.z4();
                    this.ry(false);
                    break;
                case PolarBase.$$p[9]:
                    this.zh = this.zi();
                    break;
            }
        }
        get zh() {
            return this.zg;
        }
        set zh(a) {
            let b = this.zg;
            this.zg = a;
            if (b != this.zg) {
                this.raisePropertyChanged("ActualItemSearchMode", enumGetBox(ScatterItemSearchMode_$type, b), enumGetBox(ScatterItemSearchMode_$type, this.zg));
            }
        }
        zi() {
            if (this.zj != 0) {
                return this.zj;
            }
            return this.z3 ? 4 : 1;
        }
        get_z3() {
            return false;
        }
        get z3() {
            return this.get_z3();
        }
        z5() {
            return this.z2;
        }
        z4() {
            return this.z1;
        }
        zy(a) {
            if (typeCast(NumericRadiusAxis.$, a) !== null) {
                return true;
            }
            return false;
        }
        zx(a) {
            if (typeCast(NumericAngleAxis.$, a) !== null) {
                return true;
            }
            return false;
        }
        pb(a, b) {
            super.pb(a, b);
            let c = b;
            if (a) {
                c.de.clear();
            }
            c.dd.g$h();
        }
        y0(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;
        }
        abf(a, b, c, d) {
            a.g = new Dictionary$2(Base.$, OwnedPoint.$, 1, b);
            let e = this.dp;
            for (let f = 0; f < b; f++) {
                let g = a.x._inner[f];
                if (!isInfinity(g.x) && !isInfinity(g.y)) {
                    let h = { $type: Point_$type, x: this.zt.item(f), y: this.zu.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;
                    })()));
                }
            }
        }
        abn(a, b) {
            let c = b.ca;
            let d = b.b9;
            let e = b.getEffectiveViewport();
            a.j.clear();
            a.o.clear();
            let f = Math.min(this.zt != null ? this.zt.count : 0, this.zu != null ? this.zu.count : 0);
            if (f < 1) {
                return;
            }
            this.y6 = new PolarAxisInfoCache(this.y3, this.y4, this.dp);
            this.y8 = a;
            this.aco = d;
            this.acp = c;
            this.acn = b.getEffectiveViewport();
            b.db.l(a.j, this.aaj, c, d, this.ie);
            if (f <= this.aaj) {
                this.abf(a, f, c, d);
            }
            let g = this.y0(d, a.o);
            let h = Math.min(this.y3.pr, this.y3.pq);
            let i = Math.max(this.y3.pq, this.y3.pr);
            b.dd.k = this.z9;
            b.dd.j = 0;
            b.dd.m = this.y4.sb;
            b.dd.l = this.y4.sa;
            b.dd.n = (j, k) => this.y5.c(j, k, c, d, e, Math.cos);
            b.dd.o = (j, k) => this.y5.d(j, k, c, d, e, Math.sin);
            let j = new List$1(Number_$type, 0);
            for (let k = 0; k < this.zt.count; k++) {
                if (this.zt.item(k) >= h && this.zt.item(k) <= i) {
                    j.add(this.zt.item(k));
                }
            }
            let l = this.zu;
            if (j.count != this.zt.count) {
                l = new List$1(Number_$type, 0);
                for (let m = 0; m < this.zt.count; m++) {
                    if (this.zt.item(m) >= h && this.zt.item(m) <= i) {
                        l.add(this.zu.item(m));
                    }
                }
            }
            b.dd.p(a.o, this.zl, j, l, this.aak, runOn(this.y3, this.y3.getScaledAngle), runOn(this.y4, this.y4.sh), ((() => {
                let $ret = new TrendResolutionParams();
                $ret.d = this.ie;
                $ret.i = d;
                $ret.h = e;
                $ret.j = c;
                return $ret;
            })()), g, h, i);
            if (b.aa.count > 0) {
                a.m.clear();
                for (let n = 0; n < b.aa.count; n++) {
                    a.m.add(new List$1(Point_$type, 0));
                    let o = b.aa._inner[n];
                    o.k = this.z9;
                    o.j = 0;
                    o.m = this.y4.sb;
                    o.l = this.y4.sa;
                    o.n = (p, q) => this.y5.c(p, q, c, d, e, Math.cos);
                    o.o = (p, q) => this.y5.d(p, q, c, d, e, Math.sin);
                    o.p(a.m._inner[n], o.g$b, j, l, o.g$f, runOn(this.y3, this.y3.getScaledAngle), runOn(this.y4, this.y4.sh), ((() => {
                        let $ret = new TrendResolutionParams();
                        $ret.d = this.ie;
                        $ret.i = d;
                        $ret.h = e;
                        $ret.j = c;
                        return $ret;
                    })()), g, h, i);
                }
            }
        }
        get_ff() {
            return true;
        }
        zn(a, b, c) {
            return null;
        }
        zo(a, b, c) {
            if (this.dp == null) {
                return null;
            }
            let d = this.zb();
            let e = this.y7.ce(this.wh(b));
            let f = -1;
            if (e == null) {
                if (a != null) {
                    f = this.dp.indexOf(a);
                }
                else {
                    return null;
                }
            }
            else {
                f = e.ak;
            }
            if (f == -1) {
                return null;
            }
            let g = new HighlightingInfo();
            g.i = this;
            g.g = f;
            g.f = f;
            g.c = false;
            g.d = true;
            if (c != null && c.g == g.g && c.f == g.f) {
                return c;
            }
            return g;
        }
        zm(a, b, c) {
            let d = new HighlightingInfo();
            d.i = this;
            d.g = 0;
            d.f = this.dp.count - 1;
            d.c = true;
            if (c != null && c.g == d.g && c.f == d.f) {
                return c;
            }
            return d;
        }
        dh(a, b, c) {
            if (this.ef && this.f0(this.by) && !c) {
                let d = this.zn(a, b, this.zp);
                this.zp = d;
                return d;
            }
            else {
                let e = this.zm(a, b, this.zp);
                this.zp = e;
                return e;
            }
        }
        di(a, b, c) {
            if (this.f0(this.by) && !c) {
                let d = this.zo(a, b, this.zq);
                this.zq = d;
                return d;
            }
            else {
                let e = this.zm(a, b, this.zq);
                e.d = true;
                this.zq = e;
                return e;
            }
        }
        z7() {
            return (this.assigningPolarStyle != null && this.zw) || (this.by != 1) || this.d3 || (this.cq != 1) || (this.cp != 1);
        }
        z6() {
            return (this.assigningPolarMarkerStyle != null && this.zv) || this.d3 || (this.by != 1) || (this.cq != 1) || (this.cp != 1);
        }
        abr(a, b) {
            this.q3();
            let c = b.ca;
            let d = b.b9;
            let e = this.getEffectiveViewport1(b);
            let f = this.wt(b);
            this.y6 = new PolarAxisInfoCache(this.y3, this.y4, this.dp);
            if (this.xq()) {
                b.db.j(a.j, this.xs);
                if (this.z6()) {
                    this.abh(b, a);
                }
            }
            b.c4();
            let g = this.y0(d, b.dd.g$n.an);
            b.dd.g$l(a.o, g);
            if (b.aa.count > 0) {
                for (let h = 0; h < b.aa.count; h++) {
                    let i = b.aa._inner[h];
                    i.g$l(a.m._inner[h], g);
                }
            }
            this.abe(d, c, e, f, b);
        }
        yx(a, b) {
            return this.yy(a, b);
        }
        yy(a, b) {
            if (b < a || a < 0 || a > this.zt.count || b < 0 || b > this.zt.count) {
                return null;
            }
            let c = new Array((b - a) + 1);
            for (let d = a; d <= b; d++) {
                let e = d;
                c[d - a] = this.dp.item(d);
            }
            return c;
        }
        abh(a, b) {
            a.ck = true;
            this.zf.ay(this, this.z6(), runOn(this, this.yx));
            let c = this.zf.d;
            let d = c != null;
            let e = this.getEffectiveViewport1(a);
            let f = this.dp == null ? 0 : this.dp.count;
            this.y7.cw((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.abl(h, f, a.t);
                    }
                    this.zf.ac(g, i);
                }
            });
        }
        abm(a, b, c) {
            let d = this.by != 1;
            let e = this.cq != 1;
            let f = this.cp != 1;
            this.zf.a0(this.zf.b, a, b, false);
            this.zf.ab(this.ic);
            let g = this.zf.ax;
            let h = null;
            let i = null;
            let j = null;
            let k = this.dp;
            if (d && this.dc != null) {
                h = this.dc.d0.getHighlightingInfo(this, k, g.z, g.y, false);
                g.c = h;
            }
            if (e && this.dc != null) {
                i = this.dc.d1.getHighlightingInfo(this, k, g.z, g.y, false);
                if (i == null && this.bo != null) {
                    i = this.dc.d1.getHighlightingInfo(this.bo, this.bo.dp, g.z, g.y, false);
                }
                g.d = i;
            }
            if (f && this.dc != null) {
                j = this.dc.dz.getHighlightingInfo(this, k, g.z, g.y, false);
                g.b = j;
            }
            g.h = c;
            this.abp(g);
            this.zf.z(this, h, i, j, c, d, e, f, a < 0);
        }
        abl(a, b, c) {
            let d = this.by != 1;
            let e = this.cq != 1;
            let f = this.cp != 1;
            this.zf.a0(this.zf.d, a, b, true);
            this.zf.aa(this.ic);
            let g = this.zf.aw;
            let h = null;
            let i = null;
            let j = null;
            let k = this.dp;
            let l = null;
            let m = null;
            let n = null;
            if (d && this.dc != null) {
                h = this.dc.d0.getHighlightingInfo(this, k, g.z, g.y, true);
                if (this.dc.d0.isCrossContextHighlight(this)) {
                    l = this.dc.d0.getHighlightingInfo(this, k, g.z, g.y, true);
                }
                g.c = h;
            }
            if (e && this.dc != null) {
                i = this.dc.d1.getHighlightingInfo(this, k, g.z, g.y, true);
                if (i == null && this.bo != null) {
                    i = this.dc.d1.getHighlightingInfo(this.bo, this.bo.dp, g.z, g.y, true);
                }
                if (this.dc.d1.isCrossContextHighlight(this)) {
                    m = this.dc.d1.getHighlightingInfo(this, k, g.z, g.y, true);
                }
                g.d = i;
            }
            if (f && this.dc != null) {
                j = this.dc.dz.getHighlightingInfo(this, k, g.z, g.y, true);
                if (this.dc.dz.isCrossContextHighlight(this)) {
                    n = this.dc.dz.getHighlightingInfo(this, k, g.z, g.y, true);
                }
                g.d = i;
            }
            g.h = c;
            this.abo(g);
            this.zf.y(this, h, i, j, c, d, e, f, g.v, this.dc.d0.totalHighWaterMark, g.x, this.dc.d1.totalHighWaterMark, g.t, this.dc.dz.totalHighWaterMark);
        }
        abp(a) {
            if (this.assigningPolarStyle != null && this.zw) {
                this.assigningPolarStyle(this, a);
            }
        }
        abo(a) {
            if (this.assigningPolarMarkerStyle != null && this.zv) {
                this.assigningPolarMarkerStyle(this, a);
            }
        }
        abe(a, b, c, d, e) {
            e.dg(a, b, c, d);
        }
        sp() {
            super.sp();
            if (this.index < 0) {
                return;
            }
            this.y7.dj();
        }
        r0(a, b) {
            super.r0(a, b);
            if (!this.g1) {
                this.cw.be(b);
                return;
            }
            this.cw.be(b);
            if (this.d7(this.cv)) {
                return;
            }
            this.r1();
            this.g1 = false;
        }
        r1() {
            super.r1();
            let a = this.cv;
            if (!this.gt) {
                this.zd = new PolarFrame();
                this.abn(this.zd, a);
            }
            this.gt = false;
            this.abr(this.zd, a);
        }
        rx(a, b, c, d, e) {
            super.rx(a, b, c, d, e);
            let f = this.ba.a$j.item(d);
            let g = f;
            f.bd(c);
            if (this.d7(g)) {
                return;
            }
            if (this.y9 == null) {
                this.y9 = new PolarFrame();
            }
            this.abn(this.y9, g);
            this.abr(this.y9, g);
        }
        abq(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);
            }
        }
        yw(a, b, c) {
            this.abi();
            return this.y8.x.toArray();
        }
        aab(a) {
            let b = new List$1(Number_$type, 0);
            let c = this.dp;
            for (let d of fromEnum(this.y7.de.c)) {
                b.add(c.indexOf(d));
            }
            return b;
        }
        acl(a) {
            return { $type: Point_$type, x: this.zt.item(a), y: this.zu.item(a) };
        }
        p5(a) {
            super.p5(a);
            this.bc.exportTrendlineData(this, a, this.y7.dd.g$n);
        }
        getDataLegendSeriesContextAt(a, b) {
            let c = { $type: Point_$type, x: a, y: b };
            let d = this.kr(c);
            let e = d == null ? NaN : this.iz(d, "RadiusMemberPath");
            let f = d == null ? NaN : this.iz(d, "AngleMemberPath");
            let g = new DataLegendSeriesValueInfo();
            g.l = e;
            g.a = 11;
            g.r = this.abb != null ? this.abb : "Radius";
            g.q = "Radius";
            g.s = this.aa7 != null ? this.aa7 : "R:";
            g.t = this.aa9 != null ? this.aa9 : "";
            let h = new DataLegendSeriesValueInfo();
            h.l = f;
            h.a = 10;
            h.r = this.aat != null ? this.aat : "Angle";
            h.q = "Angle";
            h.s = this.aap != null ? this.aap : "A:";
            h.t = this.aar != null ? this.aar : "";
            let i = new DataLegendSeriesContext();
            i.e = ((() => {
                let $ret = new List$1(DataLegendSeriesValueInfo.$, 0);
                $ret.add(g);
                $ret.add(h);
                return $ret;
            })());
            i.h = this.mh();
            return i;
        }
        ak(a, b) {
            let c = new List$1(ChartSelection.$, 0);
            this.qa(a, c, b);
            return c.toArray();
        }
        qa(a, b, c) {
            let d = this.cw.ca;
            let e = this.cw.b9;
            let f = this.getEffectiveViewport1(this.cw);
            let g = this.dc.xu(this.w2, this.getEffectiveViewport(), d);
            let h = new CollisionRect(0, this.dc.xr(a));
            let i = this.y4.or(e, d, f, g);
            for (let j = 0; j < this.dp.count; j++) {
                let k = this.y3.getScaledAngle(this.zt.item(j));
                let l = this.y4.sh(this.zu.item(j));
                let m = this.y5.c(k, l, d, e, f, Math.cos);
                let n = this.y5.d(k, l, d, e, f, Math.sin);
                if (h.containsLocation(m, n)) {
                    if (c == 7 || c == 6) {
                        b.add(((() => {
                            let $ret = new ChartSelection();
                            $ret.series = this;
                            return $ret;
                        })()));
                        return;
                    }
                    else if (c == 2 || c == 1) {
                        b.add(((() => {
                            let $ret = new ChartSelection();
                            $ret.item = this.dp.item(j);
                            return $ret;
                        })()));
                    }
                    else {
                        b.add(((() => {
                            let $ret = new ChartSelection();
                            $ret.item = this.dp.item(j);
                            $ret.series = this;
                            return $ret;
                        })()));
                    }
                }
            }
        }
        bd() {
            return new PolarTrendLineManager();
        }
    }
    PolarBase.$t = markType(PolarBase, 'PolarBase', MarkerSeries.$);
    PolarBase.abs = 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:y3:abt', [NumericAngleAxis.$, null], 'AngleMemberAsLegendLabel:aap:abu', [2, null], 'AngleMemberAsLegendUnit:aar:abv', [2, null], 'AngleMemberPath:aat:abw', [2], 'ClipSeriesToBounds:zz:abx', [0, false], 'HighlightedAngleMemberPath:aaw:aby', [2, null], 'HighlightedRadiusMemberPath:aay:abz', [2, null], 'IsCustomPolarMarkerStyleAllowed:z1:ab0', [0, false], 'IsCustomPolarStyleAllowed:z2:ab1', [0, false], 'ItemSearchMode:zj:ab2', [ScatterItemSearchMode_$type, enumGetBox(ScatterItemSearchMode_$type, 0)], 'ItemSearchThreshold:aai:ab3', [1, 10000], 'MaximumMarkers:aaj:ab4', [1, 400], 'RadiusAxis:y4:ab5', [NumericRadiusAxis.$, null], 'RadiusMemberAsLegendLabel:aa7:ab6', [2, null], 'RadiusMemberAsLegendUnit:aa9:ab7', [2, null], 'RadiusMemberPath:abb:ab8', [2], 'UseCartesianInterpolation:z9:acg', [0, true], 'TrendLineType:zl:ace', [TrendLineType_$type, enumGetBox(TrendLineType_$type, 0)], 'TrendLineThickness:aah:acd', [1, 1.5], 'TrendLinePeriod:aak:acc', [1, 7], 'TrendLineZIndex:aal:acf', [1, 1], 'TrendLineBrush:aci:ab9', [Brush.$, null], 'TrendLineDashArray:acj:aca', [DoubleCollection.$], 'TrendLineDashCap:ack:acb', [PenLineCap_$type, 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.e = false;
                a.z = 0;
                a.y = c - 1;
            }
            else {
                if (d) {
                    a.z = b;
                    a.y = b;
                }
                else {
                    a.e = false;
                    a.z = b;
                    a.y = b;
                }
            }
        }
    }
    PolarSeriesRenderManager.$t = markType(PolarSeriesRenderManager, 'PolarSeriesRenderManager', SeriesRenderManager.$);
    return PolarSeriesRenderManager;
})();
/**
 * @hidden
 */
export let PolarBaseView = /*@__PURE__*/ (() => {
    class PolarBaseView extends MarkerSeriesView {
        constructor(a) {
            super(a);
            this.dc = null;
            this.db = null;
            this.dd = null;
            this.de = null;
            this.dc = a;
            this.de = new HashPool$2(Base.$, Marker.$);
            this.cz(this.de);
            this.dd = new PolarTrendLineManager();
        }
        a4() {
            super.a4();
            this.db = this.da();
            if (!this.t) {
                this.dc.aaj = 1000;
                this.ch.xk = Defaults.e;
            }
        }
        dh(a) {
            this.de.g(a);
        }
        da() {
            let a = new NumericMarkerManager(0, (b) => this.de.item(b), (b) => this.dc.y6.c.item(b), runOn(this, this.di), runOn(this, this.c9), runOn(this, this.df));
            a.n = true;
            a.p = runOn(this.dc, this.dc.acl);
            return a;
        }
        di(a) {
            this.dc.abq(a, this.de);
        }
        c9() {
            return this.dc.yw(this.de, this.ca, this.b9);
        }
        df() {
            return this.dc.aab(this.de);
        }
        dg(a, b, c, d) {
            if (this.dc.zz) {
                let e = new GeometryGroup();
                this.dc.y4.sp(e, a, b, c, d);
            }
            else {
            }
        }
        dj() {
            if (this.dc.aci != null) {
                this.dc.ach = this.dc.aci;
            }
            else {
                this.dc.ach = this.dc.vj;
            }
        }
        cw(a) {
            this.de.f(a);
        }
        bi(a, b) {
            if (a.d) {
                if (this.dc.zl != 0 && !b) {
                    let c = this.dd.g$n;
                    c.ad = this.dc.aah;
                    c._stroke = this.dc.ach;
                    c.aj = this.dc.ack;
                    c.ai = this.dc.acj;
                    a.v(c);
                }
            }
            super.bi(a, b);
        }
        dk() {
            return Rect.empty;
        }
        getDefaultTooltipTemplate() {
            let a = "<div class='ui-chart-default-tooltip-content'><span>" + "${item." + this.dc.aat + "}" + "</span><br/><span";
            let b = this.f.ba.a$u(this.f);
            if (!stringIsNullOrEmpty(b)) {
                a += " style='color:" + b + "'";
            }
            a += ">" + this.dc.title + ": </span><span class='ui-priority-primary'>" + "${item." + this.dc.abb + "}</span></div>";
            return a;
        }
    }
    PolarBaseView.$t = markType(PolarBaseView, 'PolarBaseView', MarkerSeriesView.$);
    return PolarBaseView;
})();
