/*
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 * as tslib_1 from "tslib";
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
 */
var PolarBase = /** @class */ /*@__PURE__*/ (function (_super) {
    tslib_1.__extends(PolarBase, _super);
    function PolarBase() {
        var _this = _super.call(this) || this;
        _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));
        return _this;
    }
    PolarBase.prototype.bp = function () {
        return new PolarBaseView(this);
    };
    PolarBase.prototype.kk = function (a) {
        _super.prototype.kk.call(this, a);
        this.p4 = a;
    };
    PolarBase.prototype.ji = function () {
        _super.prototype.ji.call(this);
        this.p0 = null;
        this.p1 = null;
    };
    PolarBase.prototype.get_df = function () {
        return true;
    };
    PolarBase.prototype.ct = function (a, b, c) {
        var _this = this;
        if (!this.hasMarkers) {
            return false;
        }
        var d = this.p0;
        var e = new ScalerParams(1, this.b6.os, this.n6, d.ca);
        e.c = this.getEffectiveViewport1(this.bs);
        var f = this.p1;
        var g = new ScalerParams(1, this.b6.os, this.n6, f.ca);
        g.c = this.getEffectiveViewport1(this.bs);
        a.clear();
        this.oh.cf(function (h) {
            if (h._visibility == 0) {
                var i = new SeriesPointOfInterest();
                var j = h.n;
                var k = h.o;
                if (j < _this.n6.left || j > _this.n6.right || k < _this.n6.top || k > _this.n6.bottom) {
                    return;
                }
                var l = void 0;
                var m = void 0;
                var 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;
    };
    PolarBase.prototype.ru = function () {
        if (this.b7.g) {
            this.b7.t();
        }
    };
    PolarBase.prototype.rw = function () {
        this.p2.e(this.p5.w, this.qk, this.ql, this.su, this.st, function (a, b) { return Math.cos(b); }, function (a, b) { return Math.sin(b); }, true);
    };
    Object.defineProperty(PolarBase.prototype, "qk", {
        get: function () {
            return this.qi;
        },
        set: function (a) {
            if (this.qi != a) {
                var b = this.qk;
                this.qi = a;
                this.raisePropertyChanged("AngleColumn", b, this.qk);
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(PolarBase.prototype, "ql", {
        get: function () {
            return this.qj;
        },
        set: function (a) {
            if (this.qj != a) {
                var b = this.ql;
                this.qj = a;
                this.raisePropertyChanged("RadiusColumn", b, this.ql);
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(PolarBase.prototype, "sn", {
        get: function () {
            return this.c(PolarBase.r4);
        },
        set: function (a) {
            this.h(PolarBase.r4, a);
        },
        enumerable: true,
        configurable: true
    });
    PolarBase.prototype.j2 = function () {
        _super.prototype.j2.call(this);
        if (this.p1 != null) {
            this.p1.hc(false);
        }
        if (this.p0 != null) {
            this.p0.hc(false);
        }
    };
    PolarBase.prototype.jo = function (a, b, c, d) {
        var 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);
        }
    };
    PolarBase.prototype.ln = function (a, b) {
        this.k3(false);
    };
    PolarBase.prototype.lo = function (a, b) {
        this.k3(false);
    };
    PolarBase.prototype.ec = function (a, b, c) {
        var d = true;
        if (!_super.prototype.ec.call(this, 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;
    };
    PolarBase.prototype.k4 = function (a) {
        var b;
        var c;
        var 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);
        var e = new SeriesRenderingArguments(this, c, b, a, this.dv);
        var 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;
    };
    PolarBase.prototype.ss = function (a) {
        var 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;
    };
    PolarBase.prototype.ao = function (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;
    };
    PolarBase.prototype.dq = function (a) {
        var b = this.bs.bv;
        b = b.copy();
        var c = this.bs.bu;
        var 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;
        }
        var e = this.p0.getScaledAngle(this.qk.item(d));
        var f = this.p1.ly(this.ql.item(d));
        var g = 0.5 + (Math.cos(e) * f);
        var 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;
    };
    PolarBase.prototype.gq = function (a) {
        var b = this.f9(a);
        if (this.cd != null && b >= 0 && b < this.cd.count) {
            return this.cd.item(b);
        }
        return null;
    };
    PolarBase.prototype.f9 = function (a) {
        var b = truncate(Math.round(this.e4(a)));
        return b;
    };
    PolarBase.prototype.e4 = function (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;
    };
    PolarBase.prototype.q3 = function (a) {
        return this.q6(a, false);
    };
    PolarBase.prototype.q2 = function (a) {
        var b = this.no(a);
        var c = b.x;
        var 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();
        var e = this.q0;
        var f = 1.7976931348623157E+308;
        var g = -1;
        for (var h = 0; h < this.qk.count; h++) {
            var i = e._inner[h].x;
            var j = e._inner[h].y;
            var k = (c - i) * (c - i) + (d - j) * (d - j);
            if (k < f) {
                f = k;
                g = h;
            }
        }
        return g;
    };
    PolarBase.prototype.qr = function () {
        var a = this.p7;
        if (this.cn()) {
            a = this.qa;
        }
        if (a == null || a.w.count == 0) {
            return false;
        }
        this.q0 = a.w;
        return true;
    };
    PolarBase.prototype.q6 = function (a, b) {
        if (!this.qu) {
            return -1;
        }
        var c = { $type: Point_$type, x: 0, y: 0 };
        var d = true;
        var 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();
        var f = this.q0;
        var g = this.no(a);
        var h = 1.7976931348623157E+308;
        var i = -1;
        for (var j = 0; j < f.count; j++) {
            var 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))) {
                    var l = GeometryUtil.d(g, c, k);
                    if (l < h) {
                        h = l;
                        i = j;
                    }
                }
            }
            c = k;
        }
        if (i >= 0) {
            var m = f._inner[i];
            var n = f._inner[i - 1];
            if (!b || (e.j.containsKey(this.cd.item(i)) && e.j.containsKey(this.cd.item(i - 1)))) {
                var 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;
    };
    PolarBase.prototype.q5 = function (a) {
        return this.q6(a, true);
    };
    PolarBase.prototype.q4 = function (a) {
        var _this = this;
        var b = null;
        var c = 1.7976931348623157E+308;
        var d = this.no(a);
        var e = d.x;
        var f = d.y;
        if (this.p4.cw.e > this.q8) {
            return -1;
        }
        this.p4.cz(function (g) {
            if (g._visibility == 0) {
                var h = _this.p4.cp(g);
                var i = h.left + h.width / 2;
                var j = h.top + h.height / 2;
                var k = (e - i) * (e - i) + (f - j) * (f - j);
                if (k < c) {
                    c = k;
                    b = g;
                }
            }
        });
        if (b != null) {
            return b.ak;
        }
        return -1;
    };
    PolarBase.prototype.nt = function (a, b, c) {
        var _this = this;
        if (this.p0 == null || this.p1 == null || this.qk == null || this.ql == null) {
            return { $type: Point_$type, x: NaN, y: NaN };
        }
        var d = this.bs.bv;
        var e = this.bs.bu;
        var f = this.getEffectiveViewport();
        var g = new ScalerParams(0, d, e, this.p0.ca, f);
        var h = ((function () {
            var $ret = new ScalerParams(0, d, e, _this.p1.ca, f);
            $ret.b = _this.fa();
            return $ret;
        })());
        if (b) {
            var i = this.e4(a);
            if (i == -1) {
                return { $type: Point_$type, x: NaN, y: NaN };
            }
            var j = truncate(Math.floor(i));
            var 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);
            }
            var l = i - Math.floor(i);
            var 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);
            var 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);
            var o = m.x;
            var p = m.y;
            var q = n.x;
            var r = n.y;
            var s = q - o;
            var t = r - p;
            return { $type: Point_$type, x: o + s * l, y: p + t * l };
        }
        else {
            var 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);
        }
    };
    PolarBase.prototype.ag = function () {
        return [this.p0, this.p1];
    };
    PolarBase.prototype.gt = function (a, b) {
        var 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.prototype.gt.call(this, a, b);
    };
    PolarBase.prototype.kp = function (a, b, c, d) {
        _super.prototype.kp.call(this, 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;
        }
    };
    Object.defineProperty(PolarBase.prototype, "qd", {
        get: function () {
            return this.qc;
        },
        set: function (a) {
            var b = this.qc;
            this.qc = a;
            if (b != this.qc) {
                this.raisePropertyChanged("ActualItemSearchMode", enumGetBox(ScatterItemSearchMode_$type, b), enumGetBox(ScatterItemSearchMode_$type, this.qc));
            }
        },
        enumerable: true,
        configurable: true
    });
    PolarBase.prototype.qe = function () {
        if (this.qf != 0) {
            return this.qf;
        }
        return this.qu ? 4 : 1;
    };
    PolarBase.prototype.get_qu = function () {
        return false;
    };
    Object.defineProperty(PolarBase.prototype, "qu", {
        get: function () {
            return this.get_qu();
        },
        enumerable: true,
        configurable: true
    });
    PolarBase.prototype.qw = function () {
        return this.qt;
    };
    PolarBase.prototype.qv = function () {
        return this.qs;
    };
    PolarBase.prototype.qp = function (a) {
        if (typeCast(NumericRadiusAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    PolarBase.prototype.qo = function (a) {
        if (typeCast(NumericAngleAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    PolarBase.prototype.jl = function (a, b) {
        _super.prototype.jl.call(this, a, b);
        var c = b;
        if (a) {
            c.cw.clear();
        }
        c.cv.g$d();
    };
    PolarBase.prototype.ps = function (a, b) {
        var c = a.top - 10;
        var d = a.bottom + 10;
        var e = a.left - 10;
        var f = a.right + 10;
        var g = ((function () {
            var $ret = new Clipper(1, e, d, f, c, false);
            $ret.i = b;
            return $ret;
        })());
        return g;
    };
    PolarBase.prototype.rt = function (a, b, c, d) {
        a.g = new Dictionary$2(Base.$, OwnedPoint.$, 1, b);
        var e = this.cd;
        var _loop_1 = function (f) {
            var g = a.w._inner[f];
            if (!isInfinity(g.x) && !isInfinity(g.y)) {
                var h_1 = { $type: Point_$type, x: this_1.qk.item(f), y: this_1.ql.item(f) };
                var i_1 = { $type: Point_$type, x: g.x, y: g.y };
                a.g.addItem(e.item(f), ((function () {
                    var $ret = new OwnedPoint();
                    $ret.a = e.item(f);
                    $ret.b = h_1;
                    $ret.c = i_1;
                    return $ret;
                })()));
            }
        };
        var this_1 = this;
        for (var f = 0; f < b; f++) {
            _loop_1(f);
        }
    };
    PolarBase.prototype.rz = function (a, b) {
        var _this = this;
        var c = b.bv;
        var d = b.bu;
        a.j.clear();
        a.n.clear();
        var 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);
        }
        var f = this.ps(d, a.n);
        var g = Math.min(this.p0.kd, this.p0.kc);
        var 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 = function (i, j) { return _this.p2.c(i, j, c, d, Math.cos); };
        b.cv.m = function (i, j) { return _this.p2.d(i, j, c, d, Math.sin); };
        var i = new List$1(Number_$type, 0);
        for (var j = 0; j < this.qk.count; j++) {
            if (this.qk.item(j) >= g && this.qk.item(j) <= h) {
                i.add(this.qk.item(j));
            }
        }
        var k = this.ql;
        if (i.count != this.qk.count) {
            k = new List$1(Number_$type, 0);
            for (var 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), ((function () {
            var $ret = new TrendResolutionParams();
            $ret.b = _this.fq;
            $ret.f = d;
            $ret.g = c;
            return $ret;
        })()), f, g, h);
    };
    PolarBase.prototype.get_da = function () {
        return true;
    };
    PolarBase.prototype.pw = function (a, b, c) {
        return null;
    };
    PolarBase.prototype.px = function (a, b, c) {
        var d = this.p7;
        if (this.cn()) {
            d = this.qa;
        }
        var e = this.p4.by(this.no(b));
        var 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;
        }
        var 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;
    };
    PolarBase.prototype.pv = function (a, b, c) {
        var 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;
    };
    PolarBase.prototype.au = function (a, b, c) {
        if (this.cu && this.dl(this.be) && !c) {
            var d = this.pw(a, b, this.py);
            this.py = d;
            return d;
        }
        else {
            var e = this.pv(a, b, this.py);
            this.py = e;
            return e;
        }
    };
    PolarBase.prototype.av = function (a, b, c) {
        if (this.dl(this.be) && !c) {
            var d = this.px(a, b, this.pz);
            this.pz = d;
            return d;
        }
        else {
            var e = this.pv(a, b, this.pz);
            e.e = true;
            this.pz = e;
            return e;
        }
    };
    PolarBase.prototype.qy = function () {
        return (this.assigningPolarStyle != null && this.qn) || (this.be != 1);
    };
    PolarBase.prototype.qx = function () {
        return (this.assigningPolarMarkerStyle != null && this.qm) || (this.be != 1);
    };
    PolarBase.prototype.r3 = function (a, b) {
        var c = b.bv;
        var d = b.bu;
        var e = this.getEffectiveViewport1(b);
        var 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();
        var g = this.ps(d, b.cv.g$j.ak);
        b.cv.g$h(a.n, g);
        this.rs(d, c, e, f, b);
    };
    PolarBase.prototype.pp = function (a, b) {
        return this.pq(a, b);
    };
    PolarBase.prototype.pq = function (a, b) {
        if (b < a || a < 0 || a > this.qk.count || b < 0 || b > this.qk.count) {
            return null;
        }
        var c = new Array((b - a) + 1);
        for (var d = a; d <= b; d++) {
            var e = d;
            c[d - a] = this.cd.item(d);
        }
        return c;
    };
    PolarBase.prototype.rv = function (a, b) {
        var _this = this;
        a.b3 = true;
        this.qb.aw(this, this.qx(), runOn(this, this.pp));
        var c = this.qb.d;
        var d = c != null;
        var e = this.getEffectiveViewport1(a);
        var f = this.cd == null ? 0 : this.cd.count;
        this.p4.cf(function (g) {
            if (g._visibility == 0) {
                var h = g.ak;
                var 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);
            }
        });
    };
    PolarBase.prototype.ry = function (a, b, c) {
        var d = this.be != 1;
        this.qb.ay(this.qb.b, a, b, false);
        this.qb.ab(this.es);
        var e = this.qb.av;
        var f = null;
        var 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);
    };
    PolarBase.prototype.rx = function (a, b, c) {
        var d = this.be != 1;
        this.qb.ay(this.qb.d, a, b, true);
        this.qb.aa(this.es);
        var e = this.qb.au;
        var f = null;
        var g = this.cd;
        var 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);
    };
    PolarBase.prototype.r1 = function (a) {
        if (this.assigningPolarStyle != null && this.qn) {
            this.assigningPolarStyle(this, a);
        }
    };
    PolarBase.prototype.r0 = function (a) {
        if (this.assigningPolarMarkerStyle != null && this.qm) {
            this.assigningPolarMarkerStyle(this, a);
        }
    };
    PolarBase.prototype.rs = function (a, b, c, d, e) {
        e.cy(a, b, c, d);
    };
    PolarBase.prototype.lg = function () {
        _super.prototype.lg.call(this);
        if (this.gi < 0) {
            return;
        }
        this.p4.c1();
    };
    PolarBase.prototype.k5 = function (a, b) {
        _super.prototype.k5.call(this, a, b);
        if (!this.d2) {
            this.bs.a2(b);
            return;
        }
        this.bs.a2(b);
        if (this.cp(this.br)) {
            return;
        }
        var 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;
    };
    PolarBase.prototype.k2 = function (a, b, c, d, e) {
        _super.prototype.k2.call(this, a, b, c, d, e);
        var f = this.a3.a$h.item(d);
        var 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);
    };
    PolarBase.prototype.r2 = function (a, b) {
        var e_1, _a, e_2, _b;
        var c = new List$1(Base.$, 0);
        try {
            for (var _c = tslib_1.__values(fromEnum(b.c)), _d = _c.next(); !_d.done; _d = _c.next()) {
                var d = _d.value;
                if (!a.containsKey(d)) {
                    c.add1(d);
                }
            }
        }
        catch (e_1_1) {
            e_1 = { error: e_1_1 };
        }
        finally {
            try {
                if (_d && !_d.done && (_a = _c.return))
                    _a.call(_c);
            }
            finally {
                if (e_1)
                    throw e_1.error;
            }
        }
        try {
            for (var _e = tslib_1.__values(fromEnum(c)), _f = _e.next(); !_f.done; _f = _e.next()) {
                var e = _f.value;
                b.h(e);
            }
        }
        catch (e_2_1) {
            e_2 = { error: e_2_1 };
        }
        finally {
            try {
                if (_f && !_f.done && (_b = _e.return))
                    _b.call(_e);
            }
            finally {
                if (e_2)
                    throw e_2.error;
            }
        }
    };
    PolarBase.prototype.po = function (a, b, c) {
        this.rw();
        return this.p5.w.toArray();
    };
    PolarBase.prototype.q1 = function (a) {
        var e_3, _a;
        var b = new List$1(Number_$type, 0);
        var c = this.cd;
        try {
            for (var _b = tslib_1.__values(fromEnum(this.p4.cw.c)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var d = _c.value;
                b.add(c.indexOf(d));
            }
        }
        catch (e_3_1) {
            e_3 = { error: e_3_1 };
        }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return))
                    _a.call(_b);
            }
            finally {
                if (e_3)
                    throw e_3.error;
            }
        }
        return b;
    };
    PolarBase.prototype.sr = function (a) {
        return { $type: Point_$type, x: this.qk.item(a), y: this.ql.item(a) };
    };
    PolarBase.prototype.jv = function (a) {
        _super.prototype.jv.call(this, a);
        this.a5.exportTrendlineData(this, a, this.p4.cv.g$j);
    };
    PolarBase.$t = markType(PolarBase, 'PolarBase', MarkerSeries.$);
    PolarBase.r4 = DependencyProperty.i("ActualTrendLineBrush", Brush.$, PolarBase.$, new PropertyMetadata(2, null, function (a, b) { return a.raisePropertyChanged("ActualTrendLineBrush", b.oldValue, b.newValue); }));
    PolarBase.$$p = 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, 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, 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, enumGetBox(PenLineCap_$type, 0)]]);
    return PolarBase;
}(MarkerSeries));
export { PolarBase };
/**
 * @hidden
 */
var PolarSeriesRenderManager = /** @class */ /*@__PURE__*/ (function (_super) {
    tslib_1.__extends(PolarSeriesRenderManager, _super);
    function PolarSeriesRenderManager() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.au = null;
        _this.av = null;
        return _this;
    }
    PolarSeriesRenderManager.prototype.c = function () {
        this.au = new AssigningPolarMarkerStyleEventArgs();
        return this.au;
    };
    PolarSeriesRenderManager.prototype.a = function () {
        this.av = new AssigningPolarStyleEventArgs();
        return this.av;
    };
    PolarSeriesRenderManager.prototype.aw = function (a, b, c) {
        this.w(a, b, c);
    };
    PolarSeriesRenderManager.prototype.ax = function (a, b, c) {
        this.x(a, b, c);
    };
    PolarSeriesRenderManager.prototype.ay = function (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;
}(SeriesRenderManager));
export { PolarSeriesRenderManager };
/**
 * @hidden
 */
var PolarBaseView = /** @class */ /*@__PURE__*/ (function (_super) {
    tslib_1.__extends(PolarBaseView, _super);
    function PolarBaseView(a) {
        var _this = _super.call(this, a) || this;
        _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();
        return _this;
    }
    PolarBaseView.prototype.as = function () {
        _super.prototype.as.call(this);
        this.ct = this.cs();
        if (!this.q) {
            this.cu.q9 = 1000;
            this.b1.oi = 2;
        }
    };
    PolarBaseView.prototype.cz = function (a) {
        this.cw.g(a);
    };
    PolarBaseView.prototype.cs = function () {
        var _this = this;
        var a = new NumericMarkerManager(0, function (b) { return _this.cw.item(b); }, function (b) { return _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;
    };
    PolarBaseView.prototype.c0 = function (a) {
        this.cu.r2(a, this.cw);
    };
    PolarBaseView.prototype.cr = function () {
        return this.cu.po(this.cw, this.bv, this.bu);
    };
    PolarBaseView.prototype.cx = function () {
        return this.cu.q1(this.cw);
    };
    PolarBaseView.prototype.cy = function (a, b, c, d) {
        if (this.cu.qq) {
            var e = new GeometryGroup();
            this.cu.p1.l6(e, a, b, c, d);
        }
        else {
        }
    };
    PolarBaseView.prototype.c1 = function () {
        if (this.cu.so != null) {
            this.cu.sn = this.cu.so;
        }
        else {
            this.cu.sn = this.cu.m9;
        }
    };
    PolarBaseView.prototype.cf = function (a) {
        this.cw.f(a);
    };
    PolarBaseView.prototype.a5 = function (a, b) {
        if (a.d) {
            if (this.cu.qh != 0 && !b) {
                var 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.prototype.a5.call(this, a, b);
    };
    PolarBaseView.prototype.c2 = function () {
        return Rect.empty;
    };
    PolarBaseView.prototype.getDefaultTooltipTemplate = function () {
        var a = "<div class='ui-chart-default-tooltip-content'><span>" + "${item." + this.cu.rf + "}" + "</span><br/><span";
        var 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 = markType(PolarBaseView, 'PolarBaseView', MarkerSeriesView.$);
    return PolarBaseView;
}(MarkerSeriesView));
export { PolarBaseView };
//# sourceMappingURL=PolarBase_combined.js.map
