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