/*
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-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.yy = null;
            this.yp = null;
            this.yw = null;
            this.acf = null;
            this.ace = null;
            this.acd = null;
            this.za = null;
            this.zh = null;
            this.zi = null;
            this.y2 = new PolarFrame();
            this.y4 = new PolarFrame();
            this.y0 = new PolarFrame();
            this.yv = null;
            this.z0 = null;
            this.y6 = 1;
            this.zm = false;
            this.zl = false;
            this.zf = null;
            this.zg = null;
            this.assigningPolarStyle = null;
            this.assigningPolarMarkerStyle = null;
            this.y5 = null;
            this.y3 = null;
            this.yz = null;
            this.y5 = new PolarSeriesRenderManager();
            this.y7 = this.y8();
            this.y3 = new PolarFrame();
            this.y4.x = runOn(this, this.acc);
            this.y2.x = runOn(this, this.acc);
            this.y0.x = runOn(this, this.acc);
            this.za = new SeriesRenderer$2(PolarFrame.$, PolarBaseView.$, 0, runOn(this, this.abd), runOn(this, this.abh), runOn(this, this.d3), runOn(this, this.r7), runOn(this, this.aa6));
        }
        cs() {
            return new PolarBaseView(this);
        }
        q1(a) {
            super.q1(a);
            this.yx = a;
        }
        o2() {
            super.o2();
            this.yt = null;
            this.yu = null;
        }
        get_fp() {
            return true;
        }
        eb(a, b, c, d, e) {
            if (!this.hasMarkers) {
                return false;
            }
            let f = this.yt;
            let g = new ScalerParams(1, this.db.v4, this.ws, f.ch);
            g.c = this.getEffectiveViewport1(this.cv);
            let h = this.yu;
            let i = new ScalerParams(1, this.db.v4, this.ws, h.ch);
            i.c = this.getEffectiveViewport1(this.cv);
            a.clear();
            this.w6.cj((j) => {
                if (j._visibility == 0) {
                    let k = new SeriesPointOfInterest();
                    let l = j.n;
                    let m = j.o;
                    if (l < this.ws.left || l > this.ws.right || m < this.ws.top || m > this.ws.bottom) {
                        return;
                    }
                    let n;
                    let o;
                    let p = this.yv.f(l, m, this.cv.by, this.cv.bx, this.cv.getEffectiveViewport(), n, o);
                    n = p.p5;
                    o = p.p6;
                    k.d = n;
                    k.e = o;
                    k.b = j.content;
                    k.g = this.vg;
                    k.c = j.ak;
                    if (this.g9) {
                        k.g = this.vn(j.ak);
                    }
                    a.add(k);
                }
            });
            return true;
        }
        aa6() {
            if (this.dc.g) {
                this.dc.t();
            }
        }
        aa8() {
            this.yv.e(this.yy.w, this.zj, this.zk, this.acf, this.ace, this.acd, (a, b) => Math.cos(b), (a, b) => Math.sin(b), true);
        }
        gb() {
            return this.highlightedItemsSource != null || (this.aao != null && this.aam != null);
        }
        zy() {
            return false;
        }
        ht() {
            let a = super.ht();
            {
                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.aa9));
                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.aba));
                a.add(c);
            }
            if (this.zy()) {
                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.zy()) {
                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.r0));
                a.add(e);
            }
            if (!this.zy()) {
                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.r0));
                a.add(f);
            }
            return a;
        }
        aba(a, b) {
            if (this.aao != null) {
                b.value = this.aao;
                return;
            }
            b.value = this.aa1;
        }
        aa9(a, b) {
            if (this.aam != null) {
                b.value = this.aam;
                return;
            }
            b.value = this.aaj;
        }
        get zj() {
            return this.zh;
        }
        set zj(a) {
            if (this.zh != a) {
                let b = this.zj;
                this.zh = a;
                this.raisePropertyChanged("AngleColumn", b, this.zj);
            }
        }
        get zk() {
            return this.zi;
        }
        set zk(a) {
            if (this.zi != a) {
                let b = this.zk;
                this.zi = a;
                this.raisePropertyChanged("RadiusColumn", b, this.zk);
            }
        }
        get ab7() {
            return this.c(PolarBase.abi);
        }
        set ab7(a) {
            this.h(PolarBase.abi, a);
        }
        y1() {
            let a = this.y0;
            if (this.d3()) {
                if (this.dc.g) {
                    this.dc.t();
                }
                a = this.y4;
            }
            return a;
        }
        qb() {
            super.qb();
            if (this.yu != null) {
                this.yu.ib(false);
            }
            if (this.yt != null) {
                this.yt.ib(false);
            }
        }
        pb(a, b, c, d) {
            let e = false;
            this.yx.c0.g$e(a, b, c, d);
            if (this.yt != null && !this.yt.c1()) {
                e = true;
            }
            if (this.yu != null && !this.yu.c1()) {
                e = true;
            }
            if (e) {
                this.rr(true);
            }
        }
        sq(a, b) {
            this.rr(false);
        }
        sr(a, b) {
            this.rr(false);
        }
        he(a, b, c) {
            let d = true;
            if (!super.he(a, b, c) || !c.o() || b.isEmpty || a.isEmpty || this.yt == null || this.yu == null || this.zj == null || this.zk == null || this.zj.count == 0 || this.zk.count == 0 || this.dn == null || this.dn.count != this.zj.count || this.dn.count != this.zk.count || this.yv == null || this.yt.bi == null || this.yu.bi == null || this.yt.l4 == this.yt.l3 || this.yu.l4 == this.yu.l3) {
                d = false;
            }
            return d;
        }
        rs(a) {
            super.rs(a);
            let b;
            let c;
            let d = this.getViewInfo(c, b);
            c = d.p0;
            b = d.p1;
            if (!this.he(c, b, this.cv)) {
                this.o5(true, this.cv);
                return;
            }
            this.acf = b;
            this.ace = c;
            this.acd = this.cv.getEffectiveViewport();
            this.yw = new PolarAxisInfoCache(this.yt, this.yu, this.dn);
            let e = new SeriesRenderingArguments(this, c, b, a, this.gr);
            let f = this.za.g(e, this.y2, this.y0, this.y4, this.yx);
            this.y2 = f.p1;
            this.y0 = f.p2;
            this.y4 = f.p3;
        }
        acc(a) {
            let b = this.yv.h(a.x, a.y, this.acf, this.ace, this.acd, this.yw.e, this.yw.d, this.yw.g, this.yw.f, this.yw.i, this.yw.h);
            return b;
        }
        ay(a) {
            if (a != null && a == this.yt && this.zj != null) {
                return new AxisRange(this.zj.minimum, this.zj.maximum);
            }
            if (a != null && a == this.yu && this.zk != null) {
                return new AxisRange(this.zk.minimum, this.zk.maximum);
            }
            return null;
        }
        gd(a) {
            let b = this.cv.by;
            b = b.copy();
            let c = this.cv.bx;
            let d = !b.isEmpty && !c.isEmpty && this.dn != null ? this.dn.indexOf(a) : -1;
            if (this.yt == null || this.zj == null || this.yu == null || this.zk == null) {
                return false;
            }
            if (d < 0 || d > this.zj.count - 1 || d > this.zk.count - 1) {
                return false;
            }
            let e = this.yt.getScaledAngle(this.zj.item(d));
            let f = this.yu.od(this.zk.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.c3 != null) {
                this.c3.au(this.db, b, true);
            }
            return d >= 0;
        }
        kn(a) {
            let b = this.j3(a);
            if (this.dn != null && b >= 0 && b < this.dn.count) {
                return this.dn.item(b);
            }
            return null;
        }
        j3(a) {
            let b = truncate(Math.round(this.ir(a)));
            return b;
        }
        ir(a) {
            switch (this.y7) {
                case 1: return this.z4(a);
                case 3: return this.z5(a);
                case 2: return this.z2(a);
                case 4: return this.z3(a);
            }
            return -1;
        }
        z3(a) {
            return this.z6(a, false);
        }
        z2(a) {
            let b = this.v7(a);
            let c = b.x;
            let d = b.y;
            if (this.dn == null || this.yt == null || this.yu == null || this.zj == null || this.zk == null) {
                return -1;
            }
            if (this.dn.count > this.z8) {
                return -1;
            }
            if (!this.zq()) {
                return -1;
            }
            let e = this.z0;
            let f = 1.7976931348623157E+308;
            let g = -1;
            for (let h = 0; h < this.zj.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;
        }
        zq() {
            let a = this.y0;
            if (this.d3()) {
                a = this.y4;
            }
            if (a == null || a.w.count == 0) {
                return false;
            }
            this.z0 = a.w;
            return true;
        }
        z6(a, b) {
            if (!this.zt) {
                return -1;
            }
            let c = { $type: Point_$type, x: 0, y: 0 };
            let d = true;
            let e = this.y0;
            if (this.d3()) {
                e = this.y4;
            }
            if (e == null) {
                return -1;
            }
            if (e.m == null) {
                return -1;
            }
            if (this.dn == null || this.dn.count > this.z8) {
                return -1;
            }
            if (!this.zq()) {
                return -1;
            }
            let f = this.z0;
            let g = this.v7(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.dn.item(j)) || e.j.containsKey(this.dn.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.dn.item(i)) && e.j.containsKey(this.dn.item(i - 1)))) {
                    let o = GeometryUtil.m(g, n, m);
                    return (i - 1) + o;
                }
                else if (e.j.containsKey(this.dn.item(i))) {
                    return i;
                }
                else {
                    return i - 1;
                }
            }
            return -1;
        }
        z5(a) {
            return this.z6(a, true);
        }
        z4(a) {
            let b = null;
            let c = 1.7976931348623157E+308;
            let d = this.v7(a);
            let e = d.x;
            let f = d.y;
            if (this.yx.c1.e > this.z8) {
                return -1;
            }
            this.yx.c4((g) => {
                if (g._visibility == 0) {
                    let h = this.yx.cu(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;
        }
        wc(a, b, c) {
            if (this.yt == null || this.yu == null || this.zj == null || this.zk == null) {
                return { $type: Point_$type, x: NaN, y: NaN };
            }
            let d = this.cv.by;
            let e = this.cv.bx;
            let f = this.getEffectiveViewport();
            let g = new ScalerParams(0, d, e, this.yt.ch, f);
            let h = ((() => {
                let $ret = new ScalerParams(0, d, e, this.yu.ch, f);
                $ret.b = this.iy();
                return $ret;
            })());
            if (b) {
                let i = this.ir(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.dn.count - 1) {
                    k = this.dn.count - 1;
                }
                if (j > this.dn.count - 1) {
                    j = this.dn.count - 1;
                }
                if (k == j) {
                    return this.yv.h(this.zj.item(j), this.zk.item(j), d, e, f, this.yw.e, this.yw.d, this.yw.g, this.yw.f, this.yw.i, this.yw.h);
                }
                let l = i - Math.floor(i);
                let m = this.yv.h(this.zj.item(j), this.zk.item(j), d, e, f, this.yw.e, this.yw.d, this.yw.g, this.yw.f, this.yw.i, this.yw.h);
                let n = this.yv.h(this.zj.item(k), this.zk.item(k), d, e, f, this.yw.e, this.yw.d, this.yw.g, this.yw.f, this.yw.i, this.yw.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.j3(a);
                if (u == -1) {
                    return { $type: Point_$type, x: NaN, y: NaN };
                }
                return this.yv.h(this.zj.item(u), this.zk.item(u), d, e, f, this.yw.e, this.yw.d, this.yw.g, this.yw.f, this.yw.i, this.yw.h);
            }
        }
        ai() {
            return [this.yt, this.yu];
        }
        kq(a, b) {
            let c = this.nd(b);
            if (c == PolarBase.$$p[3]) {
                return this.kr(a, b, this.aaj);
            }
            if (c == PolarBase.$$p[15]) {
                return this.kr(a, b, this.aa1);
            }
            if (c == PolarBase.$$p[5]) {
                return this.kr(a, b, this.aam);
            }
            if (c == PolarBase.$$p[6]) {
                return this.kr(a, b, this.aao);
            }
            return super.kq(a, b);
        }
        md(a) {
            let b = this.nd(a);
            if (b == PolarBase.$$p[3]) {
                return this.aaj;
            }
            if (b == PolarBase.$$p[15]) {
                return this.aa1;
            }
            if (b == PolarBase.$$p[5]) {
                return this.aam;
            }
            if (b == PolarBase.$$p[6]) {
                return this.aao;
            }
            return super.md(a);
        }
        q9(a, b, c, d) {
            super.q9(a, b, c, d);
            if (this.yx.c0.g$b(a, b, c, d)) {
                this.rr(false);
                this.ql();
            }
            switch (b) {
                case PolarBase.$$p[1]:
                case PolarBase.$$p[2]:
                case PolarBase.$$p[13]:
                case PolarBase.$$p[14]:
                    this.qf();
                    break;
                case "FastItemsSource":
                    if (typeCast(IFastItemsSource_$type, c) != null) {
                        c.deregisterColumn(this.zj);
                        c.deregisterColumn(this.zk);
                        this.zj = null;
                        this.zk = null;
                    }
                    if (typeCast(IFastItemsSource_$type, d) != null) {
                        this.zj = this.dk(this.aaj);
                        this.zk = this.dk(this.aa1);
                    }
                    if ((this.yu != null && !this.yu.c1()) || (this.yt != null && !this.yt.c1())) {
                        this.rr(this.gg && c != null);
                    }
                    break;
                case PolarBase.$$p[0]:
                    if (this.yt != null && this.yu != null) {
                        this.yv = new PolarAxes(this.yu, this.yt);
                    }
                    if (c != null) {
                        c.b0(this);
                    }
                    if (d != null) {
                        d.ct(this);
                    }
                    if (this.yt != null && !this.yt.c1()) {
                        this.rr(false);
                    }
                    else if (c != null && d == null) {
                        this.o5(true, this.cv);
                    }
                    break;
                case PolarBase.$$p[12]:
                    if (this.yt != null && this.yu != null) {
                        this.yv = new PolarAxes(this.yu, this.yt);
                    }
                    if (c != null) {
                        c.b0(this);
                    }
                    if (d != null) {
                        d.ct(this);
                    }
                    if (this.yu != null && !this.yu.c1()) {
                        this.rr(false);
                    }
                    else if (c != null && d == null) {
                        this.o5(true, this.cv);
                    }
                    if (this.yt != null && !this.yt.c1()) {
                        this.yt.h7();
                    }
                    break;
                case PolarBase.$$p[3]:
                    if (this.dn != null) {
                        this.dn.deregisterColumn(this.zj);
                        this.zj = this.dk(this.aaj);
                    }
                    break;
                case "AngleColumn":
                    this.yx.c0.g$i();
                    if (this.yt != null && !this.yt.c1()) {
                        this.rr(this.gg && this.d7);
                    }
                    break;
                case PolarBase.$$p[15]:
                    if (this.dn != null) {
                        this.dn.deregisterColumn(this.zk);
                        this.zk = this.dk(this.aa1);
                    }
                    break;
                case "RadiusColumn":
                    this.yx.c0.g$i();
                    if (this.yu != null && !this.yu.c1()) {
                        this.rr(this.gg && this.d7);
                    }
                    break;
                case PolarBase.$$p[16]:
                    this.rr(false);
                    this.ql();
                    break;
                case PolarBase.$$p[11]:
                    this.rr(false);
                    this.ql();
                    break;
                case "TransitionProgress":
                    this.yw = new PolarAxisInfoCache(this.yt, this.yu, this.dn);
                    this.acf = this.cv.by;
                    this.ace = this.cv.bx;
                    this.acd = this.cv.getEffectiveViewport();
                    this.y4.v = this.zz;
                    this.y4.c(this.jq, this.y2, this.y0);
                    if (this.d5(this.cv)) {
                        return;
                    }
                    if (this.jq == 1) {
                        this.abh(this.y0, this.yx);
                        this.qo();
                    }
                    else {
                        this.abh(this.y4, this.yx);
                    }
                    if (this.db != null) {
                        this.db.qo(this);
                    }
                    break;
                case "TrendLineBrush":
                    this.rf(b);
                    break;
                case PolarBase.$$p[4]:
                    this.rr(false);
                    this.ql();
                    break;
                case "TrendLineType":
                    this.ql();
                    break;
                case PolarBase.$$p[8]:
                    this.zm = this.zv();
                    this.rr(false);
                    break;
                case PolarBase.$$p[7]:
                    this.zl = this.zu();
                    this.rr(false);
                    break;
                case PolarBase.$$p[9]:
                    this.y7 = this.y8();
                    break;
            }
        }
        get y7() {
            return this.y6;
        }
        set y7(a) {
            let b = this.y6;
            this.y6 = a;
            if (b != this.y6) {
                this.raisePropertyChanged("ActualItemSearchMode", enumGetBox(ScatterItemSearchMode_$type, b), enumGetBox(ScatterItemSearchMode_$type, this.y6));
            }
        }
        y8() {
            if (this.y9 != 0) {
                return this.y9;
            }
            return this.zt ? 4 : 1;
        }
        get_zt() {
            return false;
        }
        get zt() {
            return this.get_zt();
        }
        zv() {
            return this.zs;
        }
        zu() {
            return this.zr;
        }
        zo(a) {
            if (typeCast(NumericRadiusAxis.$, a) !== null) {
                return true;
            }
            return false;
        }
        zn(a) {
            if (typeCast(NumericAngleAxis.$, a) !== null) {
                return true;
            }
            return false;
        }
        o5(a, b) {
            super.o5(a, b);
            let c = b;
            if (a) {
                c.c1.clear();
            }
            c.c0.g$d();
        }
        yq(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;
        }
        aa5(a, b, c, d) {
            a.g = new Dictionary$2(Base.$, OwnedPoint.$, 1, b);
            let e = this.dn;
            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.zj.item(f), y: this.zk.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;
                    })()));
                }
            }
        }
        abd(a, b) {
            let c = b.by;
            let d = b.bx;
            let e = b.getEffectiveViewport();
            a.j.clear();
            a.n.clear();
            let f = Math.min(this.zj != null ? this.zj.count : 0, this.zk != null ? this.zk.count : 0);
            if (f < 1) {
                return;
            }
            this.yw = new PolarAxisInfoCache(this.yt, this.yu, this.dn);
            this.yy = a;
            this.ace = d;
            this.acf = c;
            this.acd = b.getEffectiveViewport();
            b.cy.l(a.j, this.z9, c, d, this.id);
            if (f <= this.z9) {
                this.aa5(a, f, c, d);
            }
            let g = this.yq(d, a.n);
            let h = Math.min(this.yt.l4, this.yt.l3);
            let i = Math.max(this.yt.l3, this.yt.l4);
            b.c0.i = this.zz;
            b.c0.h = 0;
            b.c0.k = this.yu.n7;
            b.c0.j = this.yu.n6;
            b.c0.l = (j, k) => this.yv.c(j, k, c, d, e, Math.cos);
            b.c0.m = (j, k) => this.yv.d(j, k, c, d, e, Math.sin);
            let j = new List$1(Number_$type, 0);
            for (let k = 0; k < this.zj.count; k++) {
                if (this.zj.item(k) >= h && this.zj.item(k) <= i) {
                    j.add(this.zj.item(k));
                }
            }
            let l = this.zk;
            if (j.count != this.zj.count) {
                l = new List$1(Number_$type, 0);
                for (let m = 0; m < this.zj.count; m++) {
                    if (this.zj.item(m) >= h && this.zj.item(m) <= i) {
                        l.add(this.zk.item(m));
                    }
                }
            }
            b.c0.n(a.n, this.zb, j, l, this.aaa, runOn(this.yt, this.yt.getScaledAngle), runOn(this.yu, this.yu.od), ((() => {
                let $ret = new TrendResolutionParams();
                $ret.d = this.id;
                $ret.i = d;
                $ret.h = e;
                $ret.j = c;
                return $ret;
            })()), g, h, i);
        }
        get_fe() {
            return true;
        }
        zd(a, b, c) {
            return null;
        }
        ze(a, b, c) {
            if (this.dn == null) {
                return null;
            }
            let d = this.y1();
            let e = this.yx.b1(this.v7(b));
            let f = -1;
            if (e == null) {
                if (a != null) {
                    f = this.dn.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;
        }
        zc(a, b, c) {
            let d = new HighlightingInfo();
            d.i = this;
            d.g = 0;
            d.f = this.dn.count - 1;
            d.c = true;
            if (c != null && c.g == d.g && c.f == d.f) {
                return c;
            }
            return d;
        }
        dg(a, b, c) {
            if (this.ed && this.fz(this.bx) && !c) {
                let d = this.zd(a, b, this.zf);
                this.zf = d;
                return d;
            }
            else {
                let e = this.zc(a, b, this.zf);
                this.zf = e;
                return e;
            }
        }
        dh(a, b, c) {
            if (this.fz(this.bx) && !c) {
                let d = this.ze(a, b, this.zg);
                this.zg = d;
                return d;
            }
            else {
                let e = this.zc(a, b, this.zg);
                e.d = true;
                this.zg = e;
                return e;
            }
        }
        zx() {
            return (this.assigningPolarStyle != null && this.zm) || (this.bx != 1) || this.d2 || (this.cp != 1) || (this.co != 1);
        }
        zw() {
            return (this.assigningPolarMarkerStyle != null && this.zl) || this.d2 || (this.bx != 1) || (this.cp != 1) || (this.co != 1);
        }
        abh(a, b) {
            this.qx();
            let c = b.by;
            let d = b.bx;
            let e = this.getEffectiveViewport1(b);
            let f = this.wj(b);
            this.yw = new PolarAxisInfoCache(this.yt, this.yu, this.dn);
            if (this.xg()) {
                b.cy.j(a.j, this.xi);
                if (this.zw()) {
                    this.aa7(b, a);
                }
            }
            b.cr();
            let g = this.yq(d, b.c0.g$j.an);
            b.c0.g$h(a.n, g);
            this.aa4(d, c, e, f, b);
        }
        yn(a, b) {
            return this.yo(a, b);
        }
        yo(a, b) {
            if (b < a || a < 0 || a > this.zj.count || b < 0 || b > this.zj.count) {
                return null;
            }
            let c = new Array((b - a) + 1);
            for (let d = a; d <= b; d++) {
                let e = d;
                c[d - a] = this.dn.item(d);
            }
            return c;
        }
        aa7(a, b) {
            a.b7 = true;
            this.y5.ay(this, this.zw(), runOn(this, this.yn));
            let c = this.y5.d;
            let d = c != null;
            let e = this.getEffectiveViewport1(a);
            let f = this.dn == null ? 0 : this.dn.count;
            this.yx.cj((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.abb(h, f, a.q);
                    }
                    this.y5.ac(g, i);
                }
            });
        }
        abc(a, b, c) {
            let d = this.bx != 1;
            let e = this.cp != 1;
            let f = this.co != 1;
            this.y5.a0(this.y5.b, a, b, false);
            this.y5.ab(this.ib);
            let g = this.y5.ax;
            let h = null;
            let i = null;
            let j = null;
            let k = this.dn;
            if (d && this.db != null) {
                h = this.db.dl.getHighlightingInfo(this, k, g.z, g.y, false);
                g.c = h;
            }
            if (e && this.db != null) {
                i = this.db.dm.getHighlightingInfo(this, k, g.z, g.y, false);
                if (i == null && this.bn != null) {
                    i = this.db.dm.getHighlightingInfo(this.bn, this.bn.dn, g.z, g.y, false);
                }
                g.d = i;
            }
            if (f && this.db != null) {
                j = this.db.dk.getHighlightingInfo(this, k, g.z, g.y, false);
                g.b = j;
            }
            g.h = c;
            this.abf(g);
            this.y5.z(this, h, i, j, c, d, e, f, a < 0);
        }
        abb(a, b, c) {
            let d = this.bx != 1;
            let e = this.cp != 1;
            let f = this.co != 1;
            this.y5.a0(this.y5.d, a, b, true);
            this.y5.aa(this.ib);
            let g = this.y5.aw;
            let h = null;
            let i = null;
            let j = null;
            let k = this.dn;
            let l = null;
            let m = null;
            let n = null;
            if (d && this.db != null) {
                h = this.db.dl.getHighlightingInfo(this, k, g.z, g.y, true);
                if (this.db.dl.isCrossContextHighlight(this)) {
                    l = this.db.dl.getHighlightingInfo(this, k, g.z, g.y, true);
                }
                g.c = h;
            }
            if (e && this.db != null) {
                i = this.db.dm.getHighlightingInfo(this, k, g.z, g.y, true);
                if (i == null && this.bn != null) {
                    i = this.db.dm.getHighlightingInfo(this.bn, this.bn.dn, g.z, g.y, true);
                }
                if (this.db.dm.isCrossContextHighlight(this)) {
                    m = this.db.dm.getHighlightingInfo(this, k, g.z, g.y, true);
                }
                g.d = i;
            }
            if (f && this.db != null) {
                j = this.db.dk.getHighlightingInfo(this, k, g.z, g.y, true);
                if (this.db.dk.isCrossContextHighlight(this)) {
                    n = this.db.dk.getHighlightingInfo(this, k, g.z, g.y, true);
                }
                g.d = i;
            }
            g.h = c;
            this.abe(g);
            this.y5.y(this, h, i, j, c, d, e, f, g.v, this.db.dl.totalHighWaterMark, g.x, this.db.dm.totalHighWaterMark, g.t, this.db.dk.totalHighWaterMark);
        }
        abf(a) {
            if (this.assigningPolarStyle != null && this.zm) {
                this.assigningPolarStyle(this, a);
            }
        }
        abe(a) {
            if (this.assigningPolarMarkerStyle != null && this.zl) {
                this.assigningPolarMarkerStyle(this, a);
            }
        }
        aa4(a, b, c, d, e) {
            e.c3(a, b, c, d);
        }
        sh() {
            super.sh();
            if (this.index < 0) {
                return;
            }
            this.yx.c6();
        }
        rt(a, b) {
            super.rt(a, b);
            if (!this.g0) {
                this.cv.a4(b);
                return;
            }
            this.cv.a4(b);
            if (this.d5(this.cu)) {
                return;
            }
            let c = this.cu;
            if (!this.gs) {
                this.y3 = new PolarFrame();
                this.abd(this.y3, c);
            }
            this.gs = false;
            this.abh(this.y3, c);
            this.g0 = false;
        }
        rq(a, b, c, d, e) {
            super.rq(a, b, c, d, e);
            let f = this.ba.a$j.item(d);
            let g = f;
            f.a3(c);
            if (this.d5(g)) {
                return;
            }
            if (this.yz == null) {
                this.yz = new PolarFrame();
            }
            this.abd(this.yz, g);
            this.abh(this.yz, g);
        }
        abg(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);
            }
        }
        ym(a, b, c) {
            this.aa8();
            return this.yy.w.toArray();
        }
        z1(a) {
            let b = new List$1(Number_$type, 0);
            let c = this.dn;
            for (let d of fromEnum(this.yx.c1.c)) {
                b.add(c.indexOf(d));
            }
            return b;
        }
        acb(a) {
            return { $type: Point_$type, x: this.zj.item(a), y: this.zk.item(a) };
        }
        pz(a) {
            super.pz(a);
            this.bc.exportTrendlineData(this, a, this.yx.c0.g$j);
        }
        getDataLegendSeriesContextAt(a, b) {
            let c = { $type: Point_$type, x: a, y: b };
            let d = this.kn(c);
            let e = d == null ? NaN : this.ix(d, "RadiusMemberPath");
            let f = d == null ? NaN : this.ix(d, "AngleMemberPath");
            let g = new DataLegendSeriesValueInfo();
            g.l = e;
            g.a = 11;
            g.r = this.aa1 != null ? this.aa1 : "Radius";
            g.q = "Radius";
            g.s = this.aax != null ? this.aax : "R:";
            g.t = this.aaz != null ? this.aaz : "";
            let h = new DataLegendSeriesValueInfo();
            h.l = f;
            h.a = 10;
            h.r = this.aaj != null ? this.aaj : "Angle";
            h.q = "Angle";
            h.s = this.aaf != null ? this.aaf : "A:";
            h.t = this.aah != null ? this.aah : "";
            let i = new DataLegendSeriesContext();
            i.e = ((() => {
                let $ret = new List$1(DataLegendSeriesValueInfo.$, 0);
                $ret.add(g);
                $ret.add(h);
                return $ret;
            })());
            i.h = this.mc();
            return i;
        }
        ak(a, b) {
            let c = new List$1(ChartSelection.$, 0);
            this.p4(a, c, b);
            return c.toArray();
        }
        p4(a, b, c) {
            let d = this.cv.by;
            let e = this.cv.bx;
            let f = this.getEffectiveViewport1(this.cv);
            let g = this.wj(this.cv);
            let h = new CollisionRect(0, a);
            let i = this.yu.k5(e, d, f, g);
            for (let j = 0; j < this.dn.count; j++) {
                let k = this.yt.getScaledAngle(this.zj.item(j));
                let l = this.yu.od(this.zk.item(j));
                let m = this.yv.c(k, l, d, e, f, Math.cos);
                let n = this.yv.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.dn.item(j);
                            return $ret;
                        })()));
                    }
                    else {
                        b.add(((() => {
                            let $ret = new ChartSelection();
                            $ret.item = this.dn.item(j);
                            $ret.series = this;
                            return $ret;
                        })()));
                    }
                }
            }
        }
    }
    PolarBase.$t = markType(PolarBase, 'PolarBase', MarkerSeries.$);
    PolarBase.abi = 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:yt:abj', [NumericAngleAxis.$, null], 'AngleMemberAsLegendLabel:aaf:abk', [2, null], 'AngleMemberAsLegendUnit:aah:abl', [2, null], 'AngleMemberPath:aaj:abm', [2], 'ClipSeriesToBounds:zp:abn', [0, false], 'HighlightedAngleMemberPath:aam:abo', [2, null], 'HighlightedRadiusMemberPath:aao:abp', [2, null], 'IsCustomPolarMarkerStyleAllowed:zr:abq', [0, false], 'IsCustomPolarStyleAllowed:zs:abr', [0, false], 'ItemSearchMode:y9:abs', [ScatterItemSearchMode_$type, enumGetBox(ScatterItemSearchMode_$type, 0)], 'ItemSearchThreshold:z8:abt', [1, 10000], 'MaximumMarkers:z9:abu', [1, 400], 'RadiusAxis:yu:abv', [NumericRadiusAxis.$, null], 'RadiusMemberAsLegendLabel:aax:abw', [2, null], 'RadiusMemberAsLegendUnit:aaz:abx', [2, null], 'RadiusMemberPath:aa1:aby', [2], 'UseCartesianInterpolation:zz:ab6', [0, true], 'TrendLineType:zb:ab4', [TrendLineType_$type, enumGetBox(TrendLineType_$type, 0)], 'TrendLineThickness:z7:ab3', [1, 1.5], 'TrendLinePeriod:aaa:ab2', [1, 7], 'TrendLineZIndex:aab:ab5', [1, 1], 'TrendLineBrush:ab8:abz', [Brush.$, null], 'TrendLineDashArray:ab9:ab0', [DoubleCollection.$], 'TrendLineDashCap:aca:ab1', [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.cz = null;
            this.cy = null;
            this.c0 = null;
            this.c1 = null;
            this.cz = a;
            this.c1 = new HashPool$2(Base.$, Marker.$);
            this.cm(this.c1);
            this.c0 = new PolarTrendLineManager();
        }
        au() {
            super.au();
            this.cy = this.cx();
            if (!this.q) {
                this.cz.z9 = 1000;
                this.b4.xa = Defaults.e;
            }
        }
        c4(a) {
            this.c1.g(a);
        }
        cx() {
            let a = new NumericMarkerManager(0, (b) => this.c1.item(b), (b) => this.cz.yw.c.item(b), runOn(this, this.c5), runOn(this, this.cw), runOn(this, this.c2));
            a.n = true;
            a.p = runOn(this.cz, this.cz.acb);
            return a;
        }
        c5(a) {
            this.cz.abg(a, this.c1);
        }
        cw() {
            return this.cz.ym(this.c1, this.by, this.bx);
        }
        c2() {
            return this.cz.z1(this.c1);
        }
        c3(a, b, c, d) {
            if (this.cz.zp) {
                let e = new GeometryGroup();
                this.cz.yu.ol(e, a, b, c, d);
            }
            else {
            }
        }
        c6() {
            if (this.cz.ab8 != null) {
                this.cz.ab7 = this.cz.ab8;
            }
            else {
                this.cz.ab7 = this.cz.u9;
            }
        }
        cj(a) {
            this.c1.f(a);
        }
        a7(a, b) {
            if (a.d) {
                if (this.cz.zb != 0 && !b) {
                    let c = this.c0.g$j;
                    c.ad = this.cz.z7;
                    c._stroke = this.cz.ab7;
                    c.aj = this.cz.aca;
                    c.ai = this.cz.ab9;
                    a.v(c);
                }
            }
            super.a7(a, b);
        }
        c7() {
            return Rect.empty;
        }
        getDefaultTooltipTemplate() {
            let a = "<div class='ui-chart-default-tooltip-content'><span>" + "${item." + this.cz.aaj + "}" + "</span><br/><span";
            let b = this.e.ba.a$u(this.e);
            if (!stringIsNullOrEmpty(b)) {
                a += " style='color:" + b + "'";
            }
            a += ">" + this.cz.title + ": </span><span class='ui-priority-primary'>" + "${item." + this.cz.aa1 + "}</span></div>";
            return a;
        }
    }
    PolarBaseView.$t = markType(PolarBaseView, 'PolarBaseView', MarkerSeriesView.$);
    return PolarBaseView;
})();
