/*
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-react-core";
import { PolarAxisInfoCache } from "./PolarAxisInfoCache";
import { SeriesRenderer$2 } from "./SeriesRenderer$2";
import { PolarFrame } from "./PolarFrame";
import { DependencyProperty } from "igniteui-react-core";
import { NumericAngleAxis } from "./NumericAngleAxis";
import { NumericRadiusAxis } from "./NumericRadiusAxis";
import { TrendLineType_$type } from "igniteui-react-core";
import { Brush } from "igniteui-react-core";
import { PenLineCap_$type } from "igniteui-react-core";
import { DoubleCollection } from "igniteui-react-core";
import { ScatterItemSearchMode_$type } from "./ScatterItemSearchMode";
import { HighlightingInfo } from "./HighlightingInfo";
import { List$1 } from "igniteui-react-core";
import { SeriesPointOfInterest } from "./SeriesPointOfInterest";
import { ScalerParams } from "./ScalerParams";
import { Rect } from "igniteui-react-core";
import { Marker } from "./Marker";
import { MarkerSeriesView } from "./MarkerSeriesView";
import { PolarAxes } from "./PolarAxes";
import { IFastItemsSource_$type } from "igniteui-react-core";
import { SeriesRenderingArguments } from "./SeriesRenderingArguments";
import { AxisRange } from "./AxisRange";
import { Dictionary$2 } from "igniteui-react-core";
import { OwnedPoint } from "./OwnedPoint";
import { GeometryUtil } from "igniteui-react-core";
import { DataContext } from "igniteui-react-core";
import { HashPool$2 } from "igniteui-react-core";
import { Clipper } from "igniteui-react-core";
import { TrendResolutionParams } from "./TrendResolutionParams";
import { PolarTrendLineManager } from "./PolarTrendLineManager";
import { AssigningPolarStyleEventArgs } from "./AssigningPolarStyleEventArgs";
import { AssigningPolarMarkerStyleEventArgs } from "./AssigningPolarMarkerStyleEventArgs";
import { SeriesRenderManager } from "./SeriesRenderManager";
import { PropertyMetadata } from "igniteui-react-core";
import { truncate, isNaN_, isInfinity } from "igniteui-react-core";
import { NumericMarkerManager } from "./NumericMarkerManager";
import { GeometryGroup } from "igniteui-react-core";
import { stringIsNullOrEmpty } from "igniteui-react-core";
/**
 * @hidden
 */
export let PolarBase = /*@__PURE__*/ (() => {
    class PolarBase extends MarkerSeries {
        constructor() {
            super();
            this.p5 = null;
            this.pr = null;
            this.p3 = null;
            this.su = null;
            this.st = null;
            this.qg = null;
            this.qi = null;
            this.qj = null;
            this.p8 = new PolarFrame();
            this.qa = new PolarFrame();
            this.p7 = new PolarFrame();
            this.p2 = null;
            this.q0 = null;
            this.qc = 1;
            this.qn = false;
            this.qm = false;
            this.py = null;
            this.pz = null;
            this.assigningPolarStyle = null;
            this.assigningPolarMarkerStyle = null;
            this.qb = null;
            this.p9 = null;
            this.p6 = null;
            this.qb = new PolarSeriesRenderManager();
            this.qd = this.qe();
            this.p9 = new PolarFrame();
            this.qa.x = runOn(this, this.ss);
            this.p8.x = runOn(this, this.ss);
            this.p7.x = runOn(this, this.ss);
            this.qg = new SeriesRenderer$2(PolarFrame.$, PolarBaseView.$, 0, runOn(this, this.rz), runOn(this, this.r3), runOn(this, this.cn), runOn(this, this.lb), runOn(this, this.ru));
        }
        bp() {
            return new PolarBaseView(this);
        }
        kk(a) {
            super.kk(a);
            this.p4 = a;
        }
        ji() {
            super.ji();
            this.p0 = null;
            this.p1 = null;
        }
        get_df() {
            return true;
        }
        ct(a, b, c) {
            if (!this.hasMarkers) {
                return false;
            }
            let d = this.p0;
            let e = new ScalerParams(1, this.b6.os, this.n6, d.ca);
            e.c = this.getEffectiveViewport1(this.bs);
            let f = this.p1;
            let g = new ScalerParams(1, this.b6.os, this.n6, f.ca);
            g.c = this.getEffectiveViewport1(this.bs);
            a.clear();
            this.oh.cf((h) => {
                if (h._visibility == 0) {
                    let i = new SeriesPointOfInterest();
                    let j = h.n;
                    let k = h.o;
                    if (j < this.n6.left || j > this.n6.right || k < this.n6.top || k > this.n6.bottom) {
                        return;
                    }
                    let l;
                    let m;
                    let n = this.p2.f(j, k, this.bs.bv, this.bs.bu, l, m);
                    l = n.p4;
                    m = n.p5;
                    i.b = l;
                    i.c = m;
                    i.a = h.content;
                    a.add(i);
                }
            });
            return true;
        }
        ru() {
            if (this.b7.g) {
                this.b7.t();
            }
        }
        rw() {
            this.p2.e(this.p5.w, this.qk, this.ql, this.su, this.st, (a, b) => Math.cos(b), (a, b) => Math.sin(b), true);
        }
        get qk() {
            return this.qi;
        }
        set qk(a) {
            if (this.qi != a) {
                let b = this.qk;
                this.qi = a;
                this.raisePropertyChanged("AngleColumn", b, this.qk);
            }
        }
        get ql() {
            return this.qj;
        }
        set ql(a) {
            if (this.qj != a) {
                let b = this.ql;
                this.qj = a;
                this.raisePropertyChanged("RadiusColumn", b, this.ql);
            }
        }
        get sn() {
            return this.c(PolarBase.r4);
        }
        set sn(a) {
            this.h(PolarBase.r4, a);
        }
        j2() {
            super.j2();
            if (this.p1 != null) {
                this.p1.hc(false);
            }
            if (this.p0 != null) {
                this.p0.hc(false);
            }
        }
        jo(a, b, c, d) {
            let e = false;
            this.p4.cv.g$e(a, b, c, d);
            if (this.p0 != null && !this.p0.cn()) {
                e = true;
            }
            if (this.p1 != null && !this.p1.cn()) {
                e = true;
            }
            if (e) {
                this.k3(true);
            }
        }
        ln(a, b) {
            this.k3(false);
        }
        lo(a, b) {
            this.k3(false);
        }
        ec(a, b, c) {
            let d = true;
            if (!super.ec(a, b, c) || !c.o() || b.isEmpty || a.isEmpty || this.p0 == null || this.p1 == null || this.qk == null || this.ql == null || this.qk.count == 0 || this.ql.count == 0 || this.cd == null || this.cd.count != this.qk.count || this.cd.count != this.ql.count || this.p2 == null || this.p0.bh == null || this.p1.bh == null || this.p0.kd == this.p0.kc || this.p1.kd == this.p1.kc) {
                d = false;
            }
            return d;
        }
        k4(a) {
            let b;
            let c;
            let d = this.getViewInfo(c, b);
            c = d.p0;
            b = d.p1;
            if (!this.ec(c, b, this.bs)) {
                this.jl(true, this.bs);
                return;
            }
            this.su = b;
            this.st = c;
            this.p3 = new PolarAxisInfoCache(this.p0, this.p1, this.cd);
            let e = new SeriesRenderingArguments(this, c, b, a, this.dv);
            let f = this.qg.g(e, this.p8, this.p7, this.qa, this.p4);
            this.p8 = f.p1;
            this.p7 = f.p2;
            this.qa = f.p3;
        }
        ss(a) {
            let b = this.p2.h(a.x, a.y, this.su, this.st, this.p3.e, this.p3.d, this.p3.g, this.p3.f, this.p3.i, this.p3.h);
            return b;
        }
        ao(a) {
            if (a != null && a == this.p0 && this.qk != null) {
                return new AxisRange(this.qk.minimum, this.qk.maximum);
            }
            if (a != null && a == this.p1 && this.ql != null) {
                return new AxisRange(this.ql.minimum, this.ql.maximum);
            }
            return null;
        }
        dq(a) {
            let b = this.bs.bv;
            b = b.copy();
            let c = this.bs.bu;
            let d = !b.isEmpty && !c.isEmpty && this.cd != null ? this.cd.indexOf(a) : -1;
            if (this.p0 == null || this.qk == null || this.p1 == null || this.ql == null) {
                return false;
            }
            if (d < 0 || d > this.qk.count - 1 || d > this.ql.count - 1) {
                return false;
            }
            let e = this.p0.getScaledAngle(this.qk.item(d));
            let f = this.p1.ly(this.ql.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.b1 != null) {
                this.b1.ap(this.b6, b, true);
            }
            return d >= 0;
        }
        gq(a) {
            let b = this.f9(a);
            if (this.cd != null && b >= 0 && b < this.cd.count) {
                return this.cd.item(b);
            }
            return null;
        }
        f9(a) {
            let b = truncate(Math.round(this.e4(a)));
            return b;
        }
        e4(a) {
            switch (this.qd) {
                case 1: return this.q4(a);
                case 3: return this.q5(a);
                case 2: return this.q2(a);
                case 4: return this.q3(a);
            }
            return -1;
        }
        q3(a) {
            return this.q6(a, false);
        }
        q2(a) {
            let b = this.no(a);
            let c = b.x;
            let d = b.y;
            if (this.cd == null || this.p0 == null || this.p1 == null || this.qk == null || this.ql == null) {
                return -1;
            }
            if (this.cd.count > this.q8) {
                return -1;
            }
            this.qr();
            let e = this.q0;
            let f = 1.7976931348623157E+308;
            let g = -1;
            for (let h = 0; h < this.qk.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;
        }
        qr() {
            let a = this.p7;
            if (this.cn()) {
                a = this.qa;
            }
            if (a == null || a.w.count == 0) {
                return false;
            }
            this.q0 = a.w;
            return true;
        }
        q6(a, b) {
            if (!this.qu) {
                return -1;
            }
            let c = { $type: Point_$type, x: 0, y: 0 };
            let d = true;
            let e = this.p7;
            if (this.cn()) {
                e = this.qa;
            }
            if (e == null) {
                return -1;
            }
            if (e.m == null) {
                return -1;
            }
            if (this.cd.count > this.q8) {
                return -1;
            }
            this.qr();
            let f = this.q0;
            let g = this.no(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.cd.item(j)) || e.j.containsKey(this.cd.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.cd.item(i)) && e.j.containsKey(this.cd.item(i - 1)))) {
                    let o = GeometryUtil.h(g, n, m);
                    return (i - 1) + o;
                }
                else if (e.j.containsKey(this.cd.item(i))) {
                    return i;
                }
                else {
                    return i - 1;
                }
            }
            return -1;
        }
        q5(a) {
            return this.q6(a, true);
        }
        q4(a) {
            let b = null;
            let c = 1.7976931348623157E+308;
            let d = this.no(a);
            let e = d.x;
            let f = d.y;
            if (this.p4.cw.e > this.q8) {
                return -1;
            }
            this.p4.cz((g) => {
                if (g._visibility == 0) {
                    let h = this.p4.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;
        }
        nt(a, b, c) {
            if (this.p0 == null || this.p1 == null || this.qk == null || this.ql == null) {
                return { $type: Point_$type, x: NaN, y: NaN };
            }
            let d = this.bs.bv;
            let e = this.bs.bu;
            let f = this.getEffectiveViewport();
            let g = new ScalerParams(0, d, e, this.p0.ca, f);
            let h = ((() => {
                let $ret = new ScalerParams(0, d, e, this.p1.ca, f);
                $ret.b = this.fa();
                return $ret;
            })());
            if (b) {
                let i = this.e4(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.cd.count - 1) {
                    k = this.cd.count - 1;
                }
                if (j > this.cd.count - 1) {
                    j = this.cd.count - 1;
                }
                if (k == j) {
                    return this.p2.h(this.qk.item(j), this.ql.item(j), d, e, this.p3.e, this.p3.d, this.p3.g, this.p3.f, this.p3.i, this.p3.h);
                }
                let l = i - Math.floor(i);
                let m = this.p2.h(this.qk.item(j), this.ql.item(j), d, e, this.p3.e, this.p3.d, this.p3.g, this.p3.f, this.p3.i, this.p3.h);
                let n = this.p2.h(this.qk.item(k), this.ql.item(k), d, e, this.p3.e, this.p3.d, this.p3.g, this.p3.f, this.p3.i, this.p3.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.f9(a);
                if (u == -1) {
                    return { $type: Point_$type, x: NaN, y: NaN };
                }
                return this.p2.h(this.qk.item(u), this.ql.item(u), d, e, this.p3.e, this.p3.d, this.p3.g, this.p3.f, this.p3.i, this.p3.h);
            }
        }
        ag() {
            return [this.p0, this.p1];
        }
        gt(a, b) {
            let c = this.ic(b);
            if (c == PolarBase.$$p[1]) {
                return this.gu(a, b, this.rf);
            }
            if (c == PolarBase.$$p[9]) {
                return this.gu(a, b, this.rp);
            }
            return super.gt(a, b);
        }
        kp(a, b, c, d) {
            super.kp(a, b, c, d);
            if (this.p4.cv.g$b(a, b, c, d)) {
                this.k3(false);
                this.ka();
            }
            switch (b) {
                case "FastItemsSource":
                    if (typeCast(IFastItemsSource_$type, c) != null) {
                        c.deregisterColumn(this.qk);
                        c.deregisterColumn(this.ql);
                        this.qk = null;
                        this.ql = null;
                    }
                    if (typeCast(IFastItemsSource_$type, d) != null) {
                        this.qk = this.ca(this.rf);
                        this.ql = this.ca(this.rp);
                    }
                    if ((this.p1 != null && !this.p1.cn()) || (this.p0 != null && !this.p0.cn())) {
                        this.k3(false);
                    }
                    break;
                case PolarBase.$$p[0]:
                    if (this.p0 != null && this.p1 != null) {
                        this.p2 = new PolarAxes(this.p1, this.p0);
                    }
                    if (c != null) {
                        c.bx(this);
                    }
                    if (d != null) {
                        d.ck(this);
                    }
                    if (this.p0 != null && !this.p0.cn()) {
                        this.k3(false);
                    }
                    else if (c != null && d == null) {
                        this.jl(true, this.bs);
                    }
                    break;
                case PolarBase.$$p[8]:
                    if (this.p0 != null && this.p1 != null) {
                        this.p2 = new PolarAxes(this.p1, this.p0);
                    }
                    if (c != null) {
                        c.bx(this);
                    }
                    if (d != null) {
                        d.ck(this);
                    }
                    if (this.p1 != null && !this.p1.cn()) {
                        this.k3(false);
                    }
                    else if (c != null && d == null) {
                        this.jl(true, this.bs);
                    }
                    if (this.p0 != null && !this.p0.cn()) {
                        this.p0.g8();
                    }
                    break;
                case PolarBase.$$p[1]:
                    if (this.cd != null) {
                        this.cd.deregisterColumn(this.qk);
                        this.qk = this.ca(this.rf);
                    }
                    break;
                case "AngleColumn":
                    this.p4.cv.g$i();
                    if (this.p0 != null && !this.p0.cn()) {
                        this.k3(false);
                    }
                    break;
                case PolarBase.$$p[9]:
                    if (this.cd != null) {
                        this.cd.deregisterColumn(this.ql);
                        this.ql = this.ca(this.rp);
                    }
                    break;
                case "RadiusColumn":
                    this.p4.cv.g$i();
                    if (this.p1 != null && !this.p1.cn()) {
                        this.k3(false);
                    }
                    break;
                case PolarBase.$$p[10]:
                    this.k3(false);
                    this.ka();
                    break;
                case PolarBase.$$p[7]:
                    this.k3(false);
                    this.ka();
                    break;
                case "TransitionProgress":
                    this.p3 = new PolarAxisInfoCache(this.p0, this.p1, this.cd);
                    this.su = this.bs.bv;
                    this.st = this.bs.bu;
                    this.qa.v = this.qz;
                    this.qa.c(this.fw, this.p8, this.p7);
                    if (this.cp(this.bs)) {
                        return;
                    }
                    if (this.fw == 1) {
                        this.r3(this.p7, this.p4);
                    }
                    else {
                        this.r3(this.qa, this.p4);
                    }
                    if (this.b6 != null) {
                        this.b6.k7(this);
                    }
                    break;
                case "TrendLineBrush":
                    this.lg();
                    break;
                case PolarBase.$$p[2]:
                    this.k3(false);
                    this.ka();
                    break;
                case "TrendLineType":
                    this.ka();
                    break;
                case PolarBase.$$p[4]:
                    this.qn = this.qw();
                    this.k3(false);
                    break;
                case PolarBase.$$p[3]:
                    this.qm = this.qv();
                    this.k3(false);
                    break;
                case PolarBase.$$p[5]:
                    this.qd = this.qe();
                    break;
            }
        }
        get qd() {
            return this.qc;
        }
        set qd(a) {
            let b = this.qc;
            this.qc = a;
            if (b != this.qc) {
                this.raisePropertyChanged("ActualItemSearchMode", enumGetBox(ScatterItemSearchMode_$type, b), enumGetBox(ScatterItemSearchMode_$type, this.qc));
            }
        }
        qe() {
            if (this.qf != 0) {
                return this.qf;
            }
            return this.qu ? 4 : 1;
        }
        get_qu() {
            return false;
        }
        get qu() {
            return this.get_qu();
        }
        qw() {
            return this.qt;
        }
        qv() {
            return this.qs;
        }
        qp(a) {
            if (typeCast(NumericRadiusAxis.$, a) !== null) {
                return true;
            }
            return false;
        }
        qo(a) {
            if (typeCast(NumericAngleAxis.$, a) !== null) {
                return true;
            }
            return false;
        }
        jl(a, b) {
            super.jl(a, b);
            let c = b;
            if (a) {
                c.cw.clear();
            }
            c.cv.g$d();
        }
        ps(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;
        }
        rt(a, b, c, d) {
            a.g = new Dictionary$2(Base.$, OwnedPoint.$, 1, b);
            let e = this.cd;
            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.qk.item(f), y: this.ql.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;
                    })()));
                }
            }
        }
        rz(a, b) {
            let c = b.bv;
            let d = b.bu;
            a.j.clear();
            a.n.clear();
            let e = Math.min(this.qk != null ? this.qk.count : 0, this.ql != null ? this.ql.count : 0);
            if (e < 1) {
                return;
            }
            this.p3 = new PolarAxisInfoCache(this.p0, this.p1, this.cd);
            this.p5 = a;
            this.st = d;
            this.su = c;
            b.ct.l(a.j, this.q9, c, d, this.fq);
            if (e <= this.q9) {
                this.rt(a, e, c, d);
            }
            let f = this.ps(d, a.n);
            let g = Math.min(this.p0.kd, this.p0.kc);
            let h = Math.max(this.p0.kc, this.p0.kd);
            b.cv.i = this.qz;
            b.cv.h = 0;
            b.cv.k = this.p1.ls;
            b.cv.j = this.p1.lr;
            b.cv.l = (i, j) => this.p2.c(i, j, c, d, Math.cos);
            b.cv.m = (i, j) => this.p2.d(i, j, c, d, Math.sin);
            let i = new List$1(Number_$type, 0);
            for (let j = 0; j < this.qk.count; j++) {
                if (this.qk.item(j) >= g && this.qk.item(j) <= h) {
                    i.add(this.qk.item(j));
                }
            }
            let k = this.ql;
            if (i.count != this.qk.count) {
                k = new List$1(Number_$type, 0);
                for (let l = 0; l < this.qk.count; l++) {
                    if (this.qk.item(l) >= g && this.qk.item(l) <= h) {
                        k.add(this.ql.item(l));
                    }
                }
            }
            b.cv.n(a.n, this.qh, i, k, this.ra, runOn(this.p0, this.p0.getScaledAngle), runOn(this.p1, this.p1.ly), ((() => {
                let $ret = new TrendResolutionParams();
                $ret.b = this.fq;
                $ret.f = d;
                $ret.g = c;
                return $ret;
            })()), f, g, h);
        }
        get_da() {
            return true;
        }
        pw(a, b, c) {
            return null;
        }
        px(a, b, c) {
            let d = this.p7;
            if (this.cn()) {
                d = this.qa;
            }
            let e = this.p4.by(this.no(b));
            let f = -1;
            if (e == null) {
                if (a != null) {
                    f = this.cd.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;
        }
        pv(a, b, c) {
            let d = new HighlightingInfo();
            d.b = this;
            d.h = 0;
            d.g = this.cd.count - 1;
            d.d = true;
            if (c != null && c.h == d.h && c.g == d.g) {
                return c;
            }
            return d;
        }
        au(a, b, c) {
            if (this.cu && this.dl(this.be) && !c) {
                let d = this.pw(a, b, this.py);
                this.py = d;
                return d;
            }
            else {
                let e = this.pv(a, b, this.py);
                this.py = e;
                return e;
            }
        }
        av(a, b, c) {
            if (this.dl(this.be) && !c) {
                let d = this.px(a, b, this.pz);
                this.pz = d;
                return d;
            }
            else {
                let e = this.pv(a, b, this.pz);
                e.e = true;
                this.pz = e;
                return e;
            }
        }
        qy() {
            return (this.assigningPolarStyle != null && this.qn) || (this.be != 1);
        }
        qx() {
            return (this.assigningPolarMarkerStyle != null && this.qm) || (this.be != 1);
        }
        r3(a, b) {
            let c = b.bv;
            let d = b.bu;
            let e = this.getEffectiveViewport1(b);
            let f = this.ny(b);
            this.p3 = new PolarAxisInfoCache(this.p0, this.p1, this.cd);
            if (this.ok()) {
                b.ct.j(a.j, this.om);
                if (this.qx()) {
                    this.rv(b, a);
                }
            }
            b.cm();
            let g = this.ps(d, b.cv.g$j.ak);
            b.cv.g$h(a.n, g);
            this.rs(d, c, e, f, b);
        }
        pp(a, b) {
            return this.pq(a, b);
        }
        pq(a, b) {
            if (b < a || a < 0 || a > this.qk.count || b < 0 || b > this.qk.count) {
                return null;
            }
            let c = new Array((b - a) + 1);
            for (let d = a; d <= b; d++) {
                let e = d;
                c[d - a] = this.cd.item(d);
            }
            return c;
        }
        rv(a, b) {
            a.b3 = true;
            this.qb.aw(this, this.qx(), runOn(this, this.pp));
            let c = this.qb.d;
            let d = c != null;
            let e = this.getEffectiveViewport1(a);
            let f = this.cd == null ? 0 : this.cd.count;
            this.p4.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.rx(h, f, a.q);
                    }
                    this.qb.ac(g, i);
                }
            });
        }
        ry(a, b, c) {
            let d = this.be != 1;
            this.qb.ay(this.qb.b, a, b, false);
            this.qb.ab(this.es);
            let e = this.qb.av;
            let f = null;
            let g = this.cd;
            if (d && this.b6 != null) {
                f = this.b6.az.getHighlightingInfo(this, g, e.o, e.n, false);
                e.b = f;
            }
            e.f = c;
            this.r1(e);
            this.qb.z(this, f, c, d, a < 0);
        }
        rx(a, b, c) {
            let d = this.be != 1;
            this.qb.ay(this.qb.d, a, b, true);
            this.qb.aa(this.es);
            let e = this.qb.au;
            let f = null;
            let g = this.cd;
            let h = null;
            if (d && this.b6 != null) {
                f = this.b6.az.getHighlightingInfo(this, g, e.o, e.n, true);
                if (this.b6.az.isCrossSeriesHighlight(this)) {
                    h = this.b6.az.getHighlightingInfo(this, g, e.o, e.n, true);
                }
                e.b = f;
            }
            e.f = c;
            this.r0(e);
            this.qb.y(this, f, c, d, e.l, this.b6.az.sumHighlightingProgress);
        }
        r1(a) {
            if (this.assigningPolarStyle != null && this.qn) {
                this.assigningPolarStyle(this, a);
            }
        }
        r0(a) {
            if (this.assigningPolarMarkerStyle != null && this.qm) {
                this.assigningPolarMarkerStyle(this, a);
            }
        }
        rs(a, b, c, d, e) {
            e.cy(a, b, c, d);
        }
        lg() {
            super.lg();
            if (this.gi < 0) {
                return;
            }
            this.p4.c1();
        }
        k5(a, b) {
            super.k5(a, b);
            if (!this.d2) {
                this.bs.a2(b);
                return;
            }
            this.bs.a2(b);
            if (this.cp(this.br)) {
                return;
            }
            let c = this.br;
            if (!this.dw) {
                this.p9 = new PolarFrame();
                this.rz(this.p9, c);
            }
            this.dw = false;
            this.r3(this.p9, c);
            this.d2 = false;
        }
        k2(a, b, c, d, e) {
            super.k2(a, b, c, d, e);
            let f = this.a3.a$h.item(d);
            let g = f;
            f.a1(c);
            if (this.cp(g)) {
                return;
            }
            if (this.p6 == null) {
                this.p6 = new PolarFrame();
            }
            this.rz(this.p6, g);
            this.r3(this.p6, g);
        }
        r2(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);
            }
        }
        po(a, b, c) {
            this.rw();
            return this.p5.w.toArray();
        }
        q1(a) {
            let b = new List$1(Number_$type, 0);
            let c = this.cd;
            for (let d of fromEnum(this.p4.cw.c)) {
                b.add(c.indexOf(d));
            }
            return b;
        }
        sr(a) {
            return { $type: Point_$type, x: this.qk.item(a), y: this.ql.item(a) };
        }
        jv(a) {
            super.jv(a);
            this.a5.exportTrendlineData(this, a, this.p4.cv.g$j);
        }
    }
    PolarBase.$t = /*@__PURE__*/ markType(PolarBase, 'PolarBase', MarkerSeries.$);
    PolarBase.r4 = /*@__PURE__*/ DependencyProperty.i("ActualTrendLineBrush", Brush.$, PolarBase.$, /*@__PURE__*/ new PropertyMetadata(2, null, (a, b) => a.raisePropertyChanged("ActualTrendLineBrush", b.oldValue, b.newValue)));
    PolarBase.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, PolarBase, 'raisePropertyChanged', ['AngleAxis:p0:r5', [NumericAngleAxis.$, null], 'AngleMemberPath:rf:r6', [2], 'ClipSeriesToBounds:qq:r7', [0, false], 'IsCustomPolarMarkerStyleAllowed:qs:r8', [0, false], 'IsCustomPolarStyleAllowed:qt:r9', [0, false], 'ItemSearchMode:qf:sa', [ScatterItemSearchMode_$type, /*@__PURE__*/ enumGetBox(ScatterItemSearchMode_$type, 0)], 'ItemSearchThreshold:q8:sb', [1, 10000], 'MaximumMarkers:q9:sc', [1, 400], 'RadiusAxis:p1:sd', [NumericRadiusAxis.$, null], 'RadiusMemberPath:rp:se', [2], 'UseCartesianInterpolation:qz:sm', [0, true], 'TrendLineType:qh:sk', [TrendLineType_$type, /*@__PURE__*/ enumGetBox(TrendLineType_$type, 0)], 'TrendLineThickness:q7:sj', [1, 1.5], 'TrendLinePeriod:ra:si', [1, 7], 'TrendLineZIndex:rb:sl', [1, 1], 'TrendLineBrush:so:sf', [Brush.$, null], 'TrendLineDashArray:sp:sg', [DoubleCollection.$], 'TrendLineDashCap:sq:sh', [PenLineCap_$type, /*@__PURE__*/ 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 = /*@__PURE__*/ 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.q9 = 1000;
                this.b1.oi = 2;
            }
        }
        cz(a) {
            this.cw.g(a);
        }
        cs() {
            let a = new NumericMarkerManager(0, (b) => this.cw.item(b), (b) => this.cu.p3.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.sr);
            return a;
        }
        c0(a) {
            this.cu.r2(a, this.cw);
        }
        cr() {
            return this.cu.po(this.cw, this.bv, this.bu);
        }
        cx() {
            return this.cu.q1(this.cw);
        }
        cy(a, b, c, d) {
            if (this.cu.qq) {
                let e = new GeometryGroup();
                this.cu.p1.l6(e, a, b, c, d);
            }
            else {
            }
        }
        c1() {
            if (this.cu.so != null) {
                this.cu.sn = this.cu.so;
            }
            else {
                this.cu.sn = this.cu.m9;
            }
        }
        cf(a) {
            this.cw.f(a);
        }
        a5(a, b) {
            if (a.d) {
                if (this.cu.qh != 0 && !b) {
                    let c = this.cv.g$j;
                    c.ac = this.cu.q7;
                    c._stroke = this.cu.sn;
                    c.ad = this.cu.sq;
                    c.ai = this.cu.sp;
                    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.rf + "}" + "</span><br/><span";
            let b = this.e.a3.a$r(this.e);
            if (!stringIsNullOrEmpty(b)) {
                a += " style='color:" + b + "'";
            }
            a += ">" + this.cu.gy + ": </span><span class='ui-priority-primary'>" + "${item." + this.cu.rp + "}</span></div>";
            return a;
        }
    }
    PolarBaseView.$t = /*@__PURE__*/ markType(PolarBaseView, 'PolarBaseView', MarkerSeriesView.$);
    return PolarBaseView;
})();
//# sourceMappingURL=PolarBase_combined.js.map
