/*
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 { ISupportsErrorBars_$type } from "./ISupportsErrorBars";
import { ITrendLineSeries_$type } from "./ITrendLineSeries";
import { ScatterAxisInfoCache } from "./ScatterAxisInfoCache";
import { NumericXAxis } from "./NumericXAxis";
import { DependencyProperty } from "igniteui-angular-core";
import { NumericYAxis } from "./NumericYAxis";
import { Series } from "./Series";
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 { CollisionAvoidanceType_$type } from "./CollisionAvoidanceType";
import { ScatterItemSearchMode_$type } from "./ScatterItemSearchMode";
import { ScatterErrorBarSettings } from "./ScatterErrorBarSettings";
import { HighlightingInfo } from "./HighlightingInfo";
import { ScatterFrame } from "./ScatterFrame";
import { Base, enumGetBox, Number_$type, typeCast, fromEnum, Point_$type, runOn, markType, markDep, PointUtil } from "igniteui-angular-core";
import { List$1 } from "igniteui-angular-core";
import { SeriesPointOfInterest } from "./SeriesPointOfInterest";
import { ScalerParams } from "./ScalerParams";
import { Rect } from "igniteui-angular-core";
import { Marker } from "./Marker";
import { MarkerSeriesView } from "./MarkerSeriesView";
import { IFastItemsSource_$type } from "igniteui-angular-core";
import { Clipper } from "igniteui-angular-core";
import { OwnedPoint } from "./OwnedPoint";
import { Dictionary$2 } from "igniteui-angular-core";
import { AxisRange } from "./AxisRange";
import { GeometryUtil } from "igniteui-angular-core";
import { HashPool$2 } from "igniteui-angular-core";
import { DataContext } from "igniteui-angular-core";
import { TrendResolutionParams } from "./TrendResolutionParams";
import { ScatterTrendLineManager } from "./ScatterTrendLineManager";
import { Thickness } from "igniteui-angular-core";
import { Size } from "igniteui-angular-core";
import { AssigningScatterStyleEventArgs } from "./AssigningScatterStyleEventArgs";
import { AssigningScatterMarkerStyleEventArgs } from "./AssigningScatterMarkerStyleEventArgs";
import { SeriesRenderManager } from "./SeriesRenderManager";
import { ErrorBarsHelper } from "./ErrorBarsHelper";
import { PathGeometry } from "igniteui-angular-core";
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 { boxArray$1, arrayShallowClone } from "igniteui-angular-core";
import { Path } from "igniteui-angular-core";
import { DataTemplateMeasureInfo } from "igniteui-angular-core";
import { NumericMarkerManager } from "./NumericMarkerManager";
import { stringIsNullOrEmpty } from "igniteui-angular-core";
/**
 * @hidden
 */
export let ScatterBase = /*@__PURE__*/ (() => {
    class ScatterBase extends MarkerSeries {
        constructor() {
            super();
            this.r5 = null;
            this.sj = null;
            this.sk = null;
            this.ve = null;
            this.vf = null;
            this.se = 1;
            this.rq = null;
            this.rr = null;
            this.sb = null;
            this.sd = null;
            this.r9 = null;
            this.sp = false;
            this.so = false;
            this.r1 = null;
            this.r2 = null;
            this.assigningScatterStyle = null;
            this.assigningScatterMarkerStyle = null;
            this.si = null;
            this.sc = null;
            this.r8 = null;
            this.sn = true;
            this.s1 = 0;
            this.s2 = 0;
            this.s3 = 0;
            this.s4 = 0;
            this.sf = this.sg();
            this.si = new ScatterSeriesRenderManager();
            this.sc = new ScatterFrame();
            this.vf = Rect.empty;
            this.ve = Rect.empty;
        }
        by() {
            return new ScatterBaseView(this);
        }
        kz() {
            super.kz();
            this.xAxis = null;
            this.yAxis = null;
        }
        l4(a) {
            super.l4(a);
            this.r6 = a;
        }
        get_ef() {
            return true;
        }
        ag() {
            return [this.xAxis, this.yAxis];
        }
        h1(a, b) {
            let c = this.jv(b);
            if (c == ScatterBase.$$p[10]) {
                return this.h2(a, b, this.tr);
            }
            if (c == ScatterBase.$$p[14]) {
                return this.h2(a, b, this.tz);
            }
            return null;
        }
        c2(a, b, c, d) {
            if (!this.hasMarkers) {
                return false;
            }
            let e = this.xAxis;
            let f = new ScalerParams(1, this.ce.ta, this.p7, e.cg);
            f.c = this.getEffectiveViewport1(this.b1);
            let g = this.yAxis;
            let h = new ScalerParams(1, this.ce.ta, this.p7, g.cg);
            h.c = this.getEffectiveViewport1(this.b1);
            a.clear();
            this.qk.cf((i) => {
                if (i._visibility == 0) {
                    let j = new SeriesPointOfInterest();
                    let k = i.n;
                    let l = i.o;
                    if (k < this.p7.left || k > this.p7.right || l < this.p7.top || l > this.p7.bottom) {
                        return;
                    }
                    j.b = e.el(k, f);
                    j.c = g.el(l, h);
                    j.a = i.content;
                    a.add(j);
                }
            });
            return true;
        }
        bq() {
            if (this.br == 0) {
                if (this.tb <= 2000) {
                    return 1;
                }
                else {
                    return super.bq();
                }
            }
            else {
                return super.bq();
            }
        }
        p5(a) {
            if (!this.hasMarkers || !this.qn()) {
                return Rect.empty;
            }
            let b = this.qk.by(this.pn(a));
            if (b != null) {
                return this.qk.cp(b);
            }
            return Rect.empty;
        }
        ez(a, b) {
            if (this.qo(a, b)) {
                return true;
            }
            return false;
        }
        get sl() {
            return this.sj;
        }
        set sl(a) {
            if (this.sj != a) {
                let b = this.sl;
                this.sj = a;
                this.raisePropertyChanged("XColumn", b, this.sl);
            }
        }
        get sm() {
            return this.sk;
        }
        set sm(a) {
            if (this.sk != a) {
                let b = this.sm;
                this.sk = a;
                this.raisePropertyChanged("YColumn", b, this.sm);
            }
        }
        get vb() {
            return this.c(ScatterBase.uo);
        }
        set vb(a) {
            this.h(ScatterBase.uo, a);
        }
        get GetErrorBarsXAxis() {
            return this.xAxis;
        }
        get GetErrorBarsYAxis() {
            return this.yAxis;
        }
        lk() {
            super.lk();
            if (this.xAxis != null) {
                this.xAxis.h7(false);
            }
            if (this.yAxis != null) {
                this.yAxis.h7(false);
            }
        }
        l9(a, b, c, d) {
            super.l9(a, b, c, d);
            if (this.r6.cx.g$b(a, b, c, d)) {
                this.mn(false);
                this.lu();
            }
            switch (b) {
                case "FastItemsSource":
                    if (typeCast(IFastItemsSource_$type, c) != null) {
                        c.deregisterColumn(this.sl);
                        c.deregisterColumn(this.sm);
                        this.sl = null;
                        this.sm = null;
                    }
                    if (typeCast(IFastItemsSource_$type, d) != null) {
                        this.sl = this.ci(this.tr);
                        this.sm = this.ci(this.tz);
                    }
                    if ((this.yAxis != null && !this.yAxis.c0()) || (this.xAxis != null && !this.xAxis.c0())) {
                        this.mn(false);
                    }
                    break;
                case ScatterBase.$$p[7]:
                    if (c != null) {
                        c.bz(this);
                    }
                    if (d != null) {
                        d.cs(this);
                    }
                    if ((this.xAxis != null && !this.xAxis.c0()) || (d == null && c != null)) {
                        this.mn(false);
                    }
                    this.lu();
                    break;
                case ScatterBase.$$p[11]:
                    if (c != null) {
                        c.bz(this);
                    }
                    if (d != null) {
                        d.cs(this);
                    }
                    if ((this.yAxis != null && !this.yAxis.c0()) || (d == null && c != null)) {
                        this.mn(false);
                    }
                    this.lu();
                    break;
                case ScatterBase.$$p[10]:
                    if (this.cl != null) {
                        this.cl.deregisterColumn(this.sl);
                        this.sl = this.ci(this.tr);
                    }
                    break;
                case "XColumn":
                    this.r6.cx.g$i();
                    if (this.xAxis != null && !this.xAxis.c0()) {
                        this.mn(false);
                    }
                    break;
                case ScatterBase.$$p[14]:
                    if (this.cl != null) {
                        this.cl.deregisterColumn(this.sm);
                        this.sm = this.ci(this.tz);
                    }
                    break;
                case "YColumn":
                    this.r6.cx.g$i();
                    if (this.yAxis != null && !this.yAxis.c0()) {
                        this.mn(false);
                    }
                    break;
                case ScatterBase.$$p[5]:
                    this.mn(false);
                    this.lu();
                    break;
                case ScatterBase.$$p[6]:
                    this.mn(false);
                    this.lu();
                    break;
                case "TransitionProgress":
                    this.sd.c(this.g5, this.sb, this.r9);
                    this.t1();
                    try {
                        if (this.cy(this.b1)) {
                            return;
                        }
                        if ((Math.round(this.g5 * 100000) / 100000) == 1) {
                            this.ul(this.r9, this.r6);
                        }
                        else {
                            this.ul(this.sd, this.r6);
                        }
                        if (this.ce != null) {
                            this.ce.ob(this);
                        }
                    }
                    finally {
                        this.um();
                    }
                    break;
                case "TrendLineBrush":
                    this.m1();
                    break;
                case ScatterBase.$$p[0]:
                    if (this.r7 != null) {
                        this.r7.r = this;
                    }
                    this.mn(false);
                    this.lu();
                    break;
                case "TrendLineType":
                    this.lu();
                    break;
                case ScatterBase.$$p[2]:
                    this.sp = this.sx();
                    this.mn(false);
                    break;
                case ScatterBase.$$p[1]:
                    this.so = this.sw();
                    this.mn(false);
                    break;
                case ScatterBase.$$p[3]:
                    this.sf = this.sg();
                    break;
            }
        }
        sx() {
            return this.st;
        }
        sw() {
            return this.ss;
        }
        sr(a) {
            if (typeCast(NumericYAxis.$, a) !== null) {
                return true;
            }
            return false;
        }
        sq(a) {
            if (typeCast(NumericXAxis.$, a) !== null) {
                return true;
            }
            return false;
        }
        um() {
            this.ve = Rect.empty;
            this.vf = Rect.empty;
        }
        t1() {
            let a = this.getViewInfo(this.ve, this.vf);
            this.ve = a.p0;
            this.vf = a.p1;
        }
        sv(a, b) {
            if (b != 3) {
                return true;
            }
            if (a == null) {
                return true;
            }
            if (this.tr == a || this.tz == a) {
                return true;
            }
            return false;
        }
        k5(a, b, c, d) {
            let e = false;
            if (!this.sv(d, a)) {
                return;
            }
            this.r6.cx.g$e(a, b, c, d);
            if (this.xAxis != null && !this.xAxis.c0()) {
                e = true;
            }
            if (this.yAxis != null && !this.yAxis.c0()) {
                e = true;
            }
            if (a == 0 || a == 2 || a == 3 || a == 4) {
                this.sn = true;
            }
            else if (a == 1) {
                for (let f = b; f < b + c; f++) {
                    this.s1 += this.sl.item(f);
                    this.s2 += this.sm.item(f);
                }
                this.s3 = this.s1 / this.sl.count;
                this.s4 = this.s2 / this.sm.count;
            }
            if (e) {
                this.mn(true);
            }
        }
        ud(a) {
            this.ue(a, null);
        }
        ue(a, b) {
            let c = this.sl != null ? this.sl.count : 0;
            let d = this.sm != null ? this.sm.count : 0;
            let e = Math.min(c, d);
            if (e <= this.tb) {
                a.m.clear();
                let f = new List$1(OwnedPoint.$, 0);
                for (let g of fromEnum(a.u.values)) {
                    f.add(g);
                }
                let h = this.cl;
                f.aa((i, j) => {
                    let k = h.indexOf(i.a);
                    let l = h.indexOf(j.a);
                    if (k < l) {
                        return -1;
                    }
                    if (k > l) {
                        return 1;
                    }
                    return 0;
                });
                if (b != null) {
                    b.i = a.m;
                }
                for (let i of fromEnum(f)) {
                    if (h.indexOf(i.a) >= 0) {
                        if (b != null) {
                            b.j(i.c);
                        }
                        else {
                            a.m.add({ $type: Point_$type, x: i.c.x, y: i.c.y });
                        }
                    }
                }
            }
        }
        aq(a) {
            if (a != null && a == this.xAxis && this.sl != null) {
                return new AxisRange(this.sl.minimum, this.sl.maximum);
            }
            if (a != null && a == this.yAxis && this.sm != null) {
                return new AxisRange(this.sm.minimum, this.sm.maximum);
            }
            return null;
        }
        hy(a) {
            let b = this.hi(a);
            if (this.cl != null && b >= 0 && b < this.cl.count) {
                return this.cl.item(b);
            }
            return null;
        }
        get sf() {
            return this.se;
        }
        set sf(a) {
            let b = this.se;
            this.se = a;
            if (b != this.se) {
                this.raisePropertyChanged("ActualItemSearchMode", enumGetBox(ScatterItemSearchMode_$type, b), enumGetBox(ScatterItemSearchMode_$type, this.se));
            }
        }
        sg() {
            if (this.sh != 0) {
                return this.sh;
            }
            return this.su ? 4 : 1;
        }
        hi(a) {
            let b = truncate(Math.round(this.f9(a)));
            return b;
        }
        f9(a) {
            switch (this.sf) {
                case 1: return this.s7(a);
                case 3: return this.s8(a);
                case 2: return this.s5(a);
                case 4: return this.s6(a);
            }
            return -1;
        }
        s6(a) {
            return this.s9(a, false);
        }
        s5(a) {
            let b = this.pn(a);
            let c = b.x;
            let d = b.y;
            if (this.cl == null || this.xAxis == null || this.yAxis == null || this.sl == null || this.sm == null) {
                return -1;
            }
            if (this.cl.count > this.ta) {
                return -1;
            }
            this.t4();
            let e = this.rq;
            let f = this.rr;
            if (e == null || f == null) {
                return -1;
            }
            let g = 1.7976931348623157E+308;
            let h = -1;
            for (let i = 0; i < this.sl.count; i++) {
                let j = e[i];
                let k = f[i];
                let l = (c - j) * (c - j) + (d - k) * (d - k);
                if (l < g) {
                    g = l;
                    h = i;
                }
            }
            return h;
        }
        t4() {
            let a = this.b1.bv;
            let b = this.b1.bu;
            let c = this.getEffectiveViewport();
            if (this.r5 == null) {
                return;
            }
            let d = new ScalerParams(0, a, b, this.r5.d, c);
            let e = ((() => {
                let $ret = new ScalerParams(0, a, b, this.r5.e, c);
                $ret.b = this.gg();
                return $ret;
            })());
            if (this.rq == null || this.rr == null) {
                let f = arrayShallowClone(this.sl.asArray());
                let g = arrayShallowClone(this.sm.asArray());
                this.xAxis.hm(boxArray$1(f), 0, f.length, d);
                this.yAxis.hm(boxArray$1(g), 0, g.length, e);
                this.rq = f;
                this.rr = g;
            }
        }
        get_su() {
            return false;
        }
        get su() {
            return this.get_su();
        }
        s9(a, b) {
            if (!this.su) {
                return -1;
            }
            let c = { $type: Point_$type, x: 0, y: 0 };
            let d = true;
            let e = this.sa();
            if (e == null) {
                return -1;
            }
            if (e.m == null) {
                return -1;
            }
            if (this.cl == null || this.cl.count > this.ta) {
                return -1;
            }
            this.t4();
            let f = this.rq;
            let g = this.rr;
            if (f == null || g == null) {
                return -1;
            }
            let h = this.pn(a);
            let i = 1.7976931348623157E+308;
            let j = -1;
            for (let k = 0; k < this.rq.length; k++) {
                let l = { $type: Point_$type, x: this.rq[k], y: this.rr[k] };
                if (k > 0) {
                    if (!b || e.j.containsKey(this.cl.item(k)) || e.j.containsKey(this.cl.item(k - 1))) {
                        let m = GeometryUtil.d(h, c, l);
                        if (m < i) {
                            i = m;
                            j = k;
                        }
                    }
                }
                c = l;
            }
            if (j >= 0) {
                let n = { $type: Point_$type, x: this.rq[j], y: this.rr[j] };
                let o = { $type: Point_$type, x: this.rq[j - 1], y: this.rr[j - 1] };
                if (!b || (e.j.containsKey(this.cl.item(j)) && e.j.containsKey(this.cl.item(j - 1)))) {
                    let p = GeometryUtil.h(h, o, n);
                    return (j - 1) + p;
                }
                else if (e.j.containsKey(this.cl.item(j))) {
                    return j;
                }
                else {
                    return j - 1;
                }
            }
            return -1;
        }
        s8(a) {
            return this.s9(a, true);
        }
        s7(a) {
            let b = null;
            let c = 1.7976931348623157E+308;
            let d = this.pn(a);
            let e = d.x;
            let f = d.y;
            if (this.r6.cy.e > this.ta) {
                return -1;
            }
            this.r6.c5((g) => {
                if (g._visibility == 0) {
                    let h = this.r6.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;
        }
        ps(a, b, c) {
            if (this.xAxis == null || this.yAxis == null || this.sl == null || this.sm == null) {
                return { $type: Point_$type, x: NaN, y: NaN };
            }
            let d = this.b1.bv;
            let e = this.b1.bu;
            let f = this.getEffectiveViewport();
            let g = new ScalerParams(0, d, e, this.xAxis.cg, f);
            let h = ((() => {
                let $ret = new ScalerParams(0, d, e, this.yAxis.cg, f);
                $ret.b = this.gg();
                return $ret;
            })());
            if (b) {
                let i = this.f9(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.cl.count - 1) {
                    k = this.cl.count - 1;
                }
                if (j > this.cl.count - 1) {
                    j = this.cl.count - 1;
                }
                if (k == j) {
                    let l = this.xAxis.ei(this.sl.item(j), g);
                    let m = this.yAxis.ei(this.sm.item(j), h);
                    return { $type: Point_$type, x: l, y: m };
                }
                let n = i - Math.floor(i);
                let o = this.xAxis.ei(this.sl.item(j), g);
                let p = this.yAxis.ei(this.sm.item(j), h);
                let q = this.xAxis.ei(this.sl.item(k), g);
                let r = this.yAxis.ei(this.sm.item(k), h);
                let s = q - o;
                let t = r - p;
                return { $type: Point_$type, x: o + s * n, y: p + t * n };
            }
            else {
                let u = this.hi(a);
                if (u == -1) {
                    return { $type: Point_$type, x: NaN, y: NaN };
                }
                let v = this.xAxis.ei(this.sl.item(u), g);
                let w = this.yAxis.ei(this.sm.item(u), h);
                return { $type: Point_$type, x: v, y: w };
            }
        }
        eq(a) {
            let b = this.ce != null ? this.ce.ta : Rect.empty;
            b = b.copy();
            let c = this.ce != null ? this.ce.tp : Rect.empty;
            let d = new Rect(0, 0, 0, 1, 1);
            let e = this.p1(this.b1);
            let f = new ScalerParams(0, d, d, this.xAxis.cg, e);
            let g = ((() => {
                let $ret = new ScalerParams(0, d, d, this.yAxis.cg, e);
                $ret.b = this.gg();
                return $ret;
            })());
            let h = !b.isEmpty && !c.isEmpty && this.cl != null ? this.cl.indexOf(a) : -1;
            let i = this.xAxis != null && this.sl != null && h < this.sl.count ? this.xAxis.ei(this.sl.item(h), f) : NaN;
            let j = this.yAxis != null && this.sm != null && h < this.sm.count ? this.yAxis.ei(this.sm.item(h), g) : NaN;
            if (!isNaN_(i)) {
                if (i < b.left + 0.1 * b.width) {
                    i = i + 0.4 * b.width;
                    b.x = i - 0.5 * b.width;
                }
                if (i > b.right - 0.1 * b.width) {
                    i = i - 0.4 * b.width;
                    b.x = i - 0.5 * b.width;
                }
            }
            if (!isNaN_(j)) {
                if (j < b.top + 0.1 * b.height) {
                    j = j + 0.4 * b.height;
                    b.y = j - 0.5 * b.height;
                }
                if (j > b.bottom - 0.1 * b.height) {
                    j = j - 0.4 * b.height;
                    b.y = j - 0.5 * b.height;
                }
            }
            if (this.b9 != null) {
                this.b9.au(this.ce, b, true);
            }
            return h >= 0;
        }
        na(a, b) {
            this.mn(false);
        }
        nb(a, b) {
            this.mn(false);
        }
        sa() {
            let a = this.r9;
            if (this.cw()) {
                if (this.cf.g) {
                    this.cf.t();
                }
                a = this.sd;
            }
            return a;
        }
        t2(a, b, c, d, e) {
            b.g = new Dictionary$2(Base.$, OwnedPoint.$, 1, c);
            let f = this.getEffectiveViewport1(a);
            let g = this.cl;
            let h;
            let i;
            let j = ((() => {
                let $ret = new ScalerParams(0, d, e, this.r5.d, f);
                $ret.c = this.getEffectiveViewport1(a);
                return $ret;
            })());
            let k = ((() => {
                let $ret = new ScalerParams(0, d, e, this.r5.e, f);
                $ret.c = this.getEffectiveViewport1(a);
                $ret.b = this.gg();
                return $ret;
            })());
            let l = false;
            let m = 0;
            if (this.ce != null) {
                if (this.ce.e8()) {
                    let n = this.ce.li(d, j);
                    l = n.c;
                    m = n.d;
                }
            }
            for (let o = 0; o < c; o++) {
                h = this.sl.item(o);
                i = this.sm.item(o);
                let p = { $type: Point_$type, x: this.r5.a.ei(h, j), y: this.r5.b.ei(i, k) };
                if (l) {
                    if (p.x < e.left || p.x > e.right) {
                        if (p.x + m >= e.left && p.x + m <= e.right) {
                            p = { $type: Point_$type, x: p.x + m, y: i };
                        }
                    }
                }
                if (!isInfinity(p.x) && !isInfinity(p.y)) {
                    let q = g.item(o);
                    if (!b.g.containsKey(q)) {
                        let r = { $type: Point_$type, x: h, y: i };
                        let s = { $type: Point_$type, x: p.x, y: p.y };
                        b.g.addItem(q, ((() => {
                            let $ret = new OwnedPoint();
                            $ret.a = q;
                            $ret.b = r;
                            $ret.c = s;
                            return $ret;
                        })()));
                    }
                }
            }
        }
        ua(a, b) {
            this.rq = null;
            this.rr = null;
            a.j.clear();
            a.n.clear();
            a.h.clear();
            a.l.clear();
            a.i.clear();
            a.k.clear();
            let c = Math.min(this.sl != null ? this.sl.count : 0, this.sm != null ? this.sm.count : 0);
            let d = b.bv;
            let e = b.bu;
            let f = this.getEffectiveViewport1(b);
            let g = new ScalerParams(0, d, e, this.xAxis.cg, f);
            g.c = this.getEffectiveViewport1(b);
            let h = ((() => {
                let $ret = new ScalerParams(0, d, e, this.yAxis.cg, f);
                $ret.b = this.gg();
                return $ret;
            })());
            h.c = this.getEffectiveViewport1(b);
            if (c < 1) {
                return;
            }
            this.r5 = ((() => {
                let $ret = new ScatterAxisInfoCache();
                $ret.a = this.xAxis;
                $ret.b = this.yAxis;
                $ret.d = this.xAxis.cg;
                $ret.e = this.yAxis.cg;
                $ret.c = this.cl;
                return $ret;
            })());
            let i = b;
            if (c <= this.tb) {
                this.t2(i, a, c, d, e);
            }
            if (this.qn()) {
                b.cv.l(a.j, this.tb, d, e, this.fx);
            }
            let j = ((() => {
                let $ret = new Clipper(0, e, false);
                $ret.i = a.n;
                return $ret;
            })());
            let k = this.pz(b);
            let l = this.xAxis.el(k.left, g);
            let m = this.xAxis.el(k.right, g);
            b.cx.h(a.n, this.trendLineType, this.sl, this.sm, this.trendLinePeriod, (n) => this.xAxis.ei(n, g), (n) => this.yAxis.ei(n, h), ((() => {
                let $ret = new TrendResolutionParams();
                $ret.b = this.fx;
                $ret.f = e;
                $ret.g = d;
                return $ret;
            })()), j, l, m);
            this.t8(a, b);
        }
        k2(a, b) {
            super.k2(a, b);
            let c = b;
            c.c4(a);
        }
        get_d0() {
            return true;
        }
        rz(a, b, c) {
            return null;
        }
        r0(a, b, c) {
            let d = this.sa();
            let e = this.r6.by(this.pn(b));
            let f = -1;
            if (e == null) {
                if (a != null) {
                    f = this.cl.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;
        }
        p9(a, b) {
            if (this.ql != 1 && this.ql != 13) {
                let c = this.qk.cq();
                let d = (c.width / 2) + (this.qq / 2);
                let e = (c.height / 2) + (this.qq / 2);
                let f = d;
                let g = d;
                let h = e;
                let i = e;
                if (a == 2 || a == 4) {
                    f = 0;
                }
                if (a == 2 || a == 3) {
                    g = 0;
                }
                if (b == 2 || b == 3) {
                    h = 0;
                }
                if (b == 2 || b == 4) {
                    i = 0;
                }
                return new Thickness(1, f, h, g, i);
            }
            return new Thickness(1, 0, 0, 0, 0);
        }
        ry(a, b, c) {
            let d = new HighlightingInfo();
            d.b = this;
            d.h = 0;
            d.g = this.cl.count - 1;
            d.d = true;
            if (c != null && c.h == d.h && c.g == d.g) {
                return c;
            }
            return d;
        }
        ax(a, b, c) {
            if (this.c3 && this.ei(this.bl) && !c) {
                let d = this.rz(a, b, this.r1);
                this.r1 = d;
                return d;
            }
            else {
                let e = this.ry(a, b, this.r1);
                this.r1 = e;
                return e;
            }
        }
        ay(a, b, c) {
            if (this.ei(this.bl) && !c) {
                let d = this.r0(a, b, this.r2);
                this.r2 = d;
                return d;
            }
            else {
                let e = this.ry(a, b, this.r2);
                e.e = true;
                this.r2 = e;
                return e;
            }
        }
        sz() {
            return (this.assigningScatterStyle != null && this.sp) || (this.bl != 1);
        }
        sy() {
            return (this.assigningScatterMarkerStyle != null && this.so) || (this.bl != 1);
        }
        ul(a, b) {
            let c = b.bu;
            this.r5 = ((() => {
                let $ret = new ScatterAxisInfoCache();
                $ret.a = this.xAxis;
                $ret.b = this.yAxis;
                $ret.d = this.xAxis.cg;
                $ret.e = this.yAxis.cg;
                return $ret;
            })());
            if (this.qn()) {
                b.cv.j(a.j, this.qp);
                if (this.sy()) {
                    this.t3(b, a);
                }
            }
            b.cm();
            let d = ((() => {
                let $ret = new Clipper(1, NaN, c.bottom, NaN, c.top, false);
                $ret.i = b.cx.g$j.an;
                return $ret;
            })());
            b.cx.g$h(a.n, d);
            this.ui(a, b);
        }
        rt(a, b) {
            return this.ru(a, b);
        }
        ru(a, b) {
            if (b < a || a < 0 || a > this.sl.count || b < 0 || b > this.sl.count) {
                return null;
            }
            let c = new Array((b - a) + 1);
            for (let d = a; d <= b; d++) {
                let e = d;
                c[d - a] = this.cl.item(d);
            }
            return c;
        }
        t3(a, b) {
            a.b3 = true;
            this.si.ay(this, this.sy(), runOn(this, this.rt));
            let c = this.si.d;
            let d = c != null;
            let e = this.getEffectiveViewport1(a);
            let f = this.cl == null ? 0 : this.cl.count;
            this.r6.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.t5(h, f, a.q);
                    }
                    this.si.ac(g, i);
                }
            });
        }
        t6(a, b, c) {
            let d = this.bl != 1;
            this.si.a0(this.si.b, a, b, false);
            this.si.ab(this.fv);
            let e = this.si.ax;
            let f = null;
            let g = this.cl;
            if (d && this.ce != null) {
                f = this.ce.a7.getHighlightingInfo(this, g, e.o, e.n, false);
                e.b = f;
            }
            e.f = c;
            this.ug(e);
            this.si.z(this, f, c, d, a < 0);
        }
        t5(a, b, c) {
            let d = this.bl != 1;
            this.si.a0(this.si.d, a, b, true);
            this.si.aa(this.fv);
            let e = this.si.aw;
            let f = null;
            let g = this.cl;
            let h = null;
            if (d && this.ce != null) {
                f = this.ce.a7.getHighlightingInfo(this, g, e.o, e.n, true);
                if (this.ce.a7.isCrossSeriesHighlight(this)) {
                    h = this.ce.a7.getHighlightingInfo(this, g, e.o, e.n, true);
                }
                e.b = f;
            }
            e.f = c;
            this.uf(e);
            this.si.y(this, f, c, d, e.m, this.ce.a7.totalHighlightingProgress);
        }
        ug(a) {
            if (this.assigningScatterStyle != null && this.sp) {
                this.assigningScatterStyle(this, a);
            }
        }
        uf(a) {
            if (this.assigningScatterMarkerStyle != null && this.so) {
                this.assigningScatterMarkerStyle(this, a);
            }
        }
        t8(a, b) {
            let c = new ErrorBarsHelper(this, b);
            if (this.r7 == null) {
                return;
            }
            let d = this.r7.u;
            let e = this.r7.v;
            let f = 0;
            let g = 0;
            let h = 0;
            let i = 0;
            for (let j of fromEnum(a.j.keys)) {
                let k = a.j.item(j);
                if (d != null) {
                    switch (d.getCalculatorType()) {
                        case 1:
                            let l = this.ub(k, c, d, h, i, true);
                            h = l.p3;
                            i = l.p4;
                            break;
                        case 0:
                            let m = this.t9(k, c, d, h, i, true);
                            h = m.p3;
                            i = m.p4;
                            break;
                        case 2:
                            let n = this.t7(k, c, d, j, h, i, true);
                            h = n.p4;
                            i = n.p5;
                            break;
                        case 3:
                            let o = this.uc(c, d, f, h, i, true);
                            f = o.p2;
                            h = o.p3;
                            i = o.p4;
                            break;
                        case 4:
                            let p = this.t9(k, c, d, h, i, true);
                            h = p.p3;
                            i = p.p4;
                            break;
                    }
                    ;
                    let q = new OwnedPoint();
                    q.c = c.l(d, this.r5.a, k.c, f);
                    q.a = k.a;
                    a.h.addItem(j, q);
                    a.i.addItem(j, [h, i]);
                }
                if (e != null) {
                    switch (e.getCalculatorType()) {
                        case 1:
                            let r = this.ub(k, c, e, h, i, false);
                            h = r.p3;
                            i = r.p4;
                            break;
                        case 0:
                            let s = this.t9(k, c, e, h, i, false);
                            h = s.p3;
                            i = s.p4;
                            break;
                        case 2:
                            let t = this.t7(k, c, e, j, h, i, false);
                            h = t.p4;
                            i = t.p5;
                            break;
                        case 3:
                            let u = this.uc(c, e, g, h, i, false);
                            g = u.p2;
                            h = u.p3;
                            i = u.p4;
                            break;
                        case 4:
                            let v = this.t9(k, c, e, h, i, false);
                            h = v.p3;
                            i = v.p4;
                            break;
                    }
                    ;
                    let w = new OwnedPoint();
                    w.c = c.m(e, this.r5.b, k.c, g);
                    w.a = k.a;
                    a.l.addItem(j, w);
                    a.k.addItem(j, [h, i]);
                }
            }
        }
        ub(a, b, c, d, e, f) {
            if (f) {
                let g;
                let h, i;
                i = this.r5.a;
                if (this.r7.s == 0) {
                    g = a.c.x;
                    h = this.r5.a;
                }
                else {
                    g = a.c.y;
                    h = this.r5.b;
                }
                let j = b.f(g, c, h, i, d, e);
                d = j.p4;
                e = j.p5;
            }
            else {
                let k;
                let l, m;
                m = this.r5.b;
                if (this.r7.t == 0) {
                    k = a.c.x;
                    l = this.r5.a;
                }
                else {
                    k = a.c.y;
                    l = this.r5.b;
                }
                let n = b.f(k, c, l, m, d, e);
                d = n.p4;
                e = n.p5;
            }
            return {
                p3: d,
                p4: e
            };
        }
        t9(a, b, c, d, e, f) {
            if (f) {
                let g = b.j(a.c.x, c, this.r5.a, d, e);
                d = g.p3;
                e = g.p4;
            }
            else {
                let h = b.j(a.c.y, c, this.r5.b, d, e);
                d = h.p3;
                e = h.p4;
            }
            return {
                p3: d,
                p4: e
            };
        }
        t7(a, b, c, d, e, f, g) {
            let h = c.getItemColumn();
            let i = this.cl.indexOf(d);
            if (h != null && i < h.count) {
                let j = h.item(i);
                if (g) {
                    let k = b.h(a.c.x, j, this.r5.a, e, f);
                    e = k.p3;
                    f = k.p4;
                }
                else {
                    let l = b.h(a.c.y, j, this.r5.b, e, f);
                    e = l.p3;
                    f = l.p4;
                }
            }
            else {
                e = NaN;
                f = NaN;
            }
            return {
                p4: e,
                p5: f
            };
        }
        uc(a, b, c, d, e, f) {
            let g = a.i(b, c);
            c = g.p1;
            if (f) {
                let h = a.k(c, b, this.r5.a, d, e);
                d = h.p3;
                e = h.p4;
            }
            else {
                let i = a.k(c, b, this.r5.b, d, e);
                d = i.p3;
                e = i.p4;
            }
            return {
                p2: c,
                p3: d,
                p4: e
            };
        }
        ui(a, b) {
            if (!b.o() || this.r7 == null) {
                b.c6();
                return;
            }
            this.uj(a, b);
            this.uk(a, b);
        }
        uj(a, b) {
            b.c2();
            let c = new ErrorBarsHelper(this, b);
            let d = new PathGeometry();
            let e = this.r7.u;
            for (let f of fromEnum(a.j.keys)) {
                if (e != null && a.i.containsKey(f)) {
                    let g = a.i.item(f)[0];
                    let h = a.i.item(f)[1];
                    if (!isNaN_(g) && !isNaN_(h)) {
                        let i = a.h.item(f).c;
                        if (this.r7.o == 1 || this.r7.o == 2) {
                            c.d(d, i, g, true);
                        }
                        if (this.r7.o == 1 || this.r7.o == 3) {
                            c.d(d, i, h, false);
                        }
                    }
                }
            }
            b.c7(d);
        }
        uk(a, b) {
            b.c3();
            let c = new ErrorBarsHelper(this, b);
            let d = new PathGeometry();
            let e = this.r7.v;
            for (let f of fromEnum(a.j.keys)) {
                if (e != null && a.k.containsKey(f)) {
                    let g = a.k.item(f)[0];
                    let h = a.k.item(f)[1];
                    if (!isNaN_(g) && !isNaN_(h)) {
                        let i = a.l.item(f).c;
                        if (this.r7.p == 1 || this.r7.p == 2) {
                            c.e(d, i, g, true);
                        }
                        if (this.r7.p == 1 || this.r7.p == 3) {
                            c.e(d, i, h, false);
                        }
                    }
                }
            }
        }
        fd(a, b, c) {
            let d = true;
            if (!super.fd(a, b, c) || b.isEmpty || a.isEmpty || this.xAxis == null || this.yAxis == null || this.xAxis.bh == null || this.yAxis.bh == null || this.sl == null || this.sm == null || this.sl.count == 0 || this.sm.count == 0 || this.cl == null || this.cl.count != this.sl.count || this.cl.count != this.sm.count || this.xAxis.bh == null || this.yAxis.bh == null || this.xAxis.lw == this.xAxis.lv || this.yAxis.lw == this.yAxis.lv) {
                d = false;
            }
            return d;
        }
        getViewInfo(a, b) {
            if (!this.ve.isEmpty && !this.vf.isEmpty) {
                a = this.ve;
                b = this.vf;
                return {
                    p0: a,
                    p1: b
                };
            }
            a = this.b1.bu;
            b = this.b1.bv;
            return {
                p0: a,
                p1: b
            };
        }
        mo(a) {
            this.t1();
            try {
                if (this.cy(this.b1)) {
                    return;
                }
                if (this.cl != null && this.cl.count > this.tb) {
                    a = false;
                }
                if (this.er(a) && !this.ew) {
                    let b = this.sb;
                    if (this.cw()) {
                        if (this.cf.g) {
                            this.cf.t();
                        }
                        this.sb = this.sd;
                        this.sd = b;
                    }
                    else {
                        this.sb = this.r9;
                        this.r9 = b;
                    }
                    this.ua(this.r9, this.r6);
                    this.mw();
                }
                else {
                    if (!this.ew) {
                        this.ua(this.r9, this.r6);
                    }
                    this.ul(this.r9, this.r6);
                }
            }
            finally {
                this.um();
            }
        }
        m1() {
            super.m1();
            if (this.index < 0) {
                return;
            }
            this.r6.da();
        }
        mp(a, b) {
            super.mp(a, b);
            if (!this.e3) {
                this.b1.a2(b);
                return;
            }
            this.b1.a2(b);
            if (this.cy(this.b0)) {
                return;
            }
            let c = typeCast(ScatterBaseView.$, this.b0);
            if (!this.ex) {
                this.sc = new ScatterFrame();
                this.ua(this.sc, c);
            }
            this.ex = false;
            this.ul(this.sc, c);
            this.e3 = false;
        }
        mm(a, b, c, d, e) {
            super.mm(a, b, c, d, e);
            let f = this.a7.a$h.item(d);
            let g = f;
            f.a1(c);
            if (this.cy(g)) {
                return;
            }
            if (this.r8 == null) {
                this.r8 = new ScatterFrame();
            }
            this.ua(this.r8, g);
            this.ul(this.r8, g);
        }
        uh(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);
            }
        }
        rs(a, b, c, d, e) {
            if (c == null || c.length != this.r5.c.count) {
                c = new Array(this.r5.c.count);
                for (let f = 0; f < this.r5.c.count; f++) {
                    c[f] = PointUtil.create();
                }
            }
            let g = this.getEffectiveViewport1(a);
            let h = ((() => {
                let $ret = new ScalerParams(0, d, e, this.xAxis.cg, g);
                $ret.c = this.getEffectiveViewport1(a);
                return $ret;
            })());
            let i = ((() => {
                let $ret = new ScalerParams(0, d, e, this.yAxis.cg, g);
                $ret.c = this.getEffectiveViewport1(a);
                $ret.b = this.gg();
                return $ret;
            })());
            let j = this.pz(a);
            let k = this.r5.a.el(j.left, h);
            let l = this.r5.a.el(j.right, h);
            let m = this.r5.b.el(j.bottom, i);
            let n = this.r5.b.el(j.top, i);
            if (this.r5.d) {
                let o = k;
                k = l;
                l = o;
            }
            if (this.r5.e) {
                let p = m;
                m = n;
                n = p;
            }
            let q = this.r5;
            let r = q.a;
            let s = q.b;
            let t;
            let u;
            let v = this.sl;
            let w = this.sm;
            let x = false;
            let y = 0;
            let z = 0;
            if (this.ce != null) {
                if (this.ce.e8()) {
                    let aa = this.ce.li(d, h);
                    x = aa.c;
                    y = aa.d;
                    z = r.el(0 + y, h);
                    let ab = r.el(0, h);
                    z -= ab;
                }
            }
            for (let ac = 0; ac < this.r5.c.count; ac++) {
                t = v.item(ac);
                u = w.item(ac);
                if (x) {
                    if (t >= k && t <= l && u >= m && u <= n) {
                        c[ac].x = r.ei(t, h);
                        c[ac].y = s.ei(u, i);
                    }
                    else {
                        if ((t + z) >= k && (t + z) <= l && u >= m && u <= n) {
                            c[ac].x = r.ei(t, h) + y;
                            c[ac].y = s.ei(u, i);
                        }
                        else {
                            c[ac].x = NaN;
                            c[ac].y = NaN;
                        }
                    }
                }
                else {
                    if (t >= k && t <= l && u >= m && u <= n) {
                        c[ac].x = r.ei(t, h);
                        c[ac].y = s.ei(u, i);
                    }
                    else {
                        c[ac].x = NaN;
                        c[ac].y = NaN;
                    }
                }
            }
            return c;
        }
        s0(a, b) {
            if (b == null) {
                b = new List$1(Number_$type, 2, a.e);
            }
            else {
                b.clear();
            }
            let c = 0;
            let d = this.cl;
            for (let e of fromEnum(a.c)) {
                b.add(d.indexOf(e));
            }
            return b;
        }
        lc(a) {
            super.lc(a);
            this.a9.exportTrendlineData(this, a, this.r6.cx.g$j);
        }
        gg() {
            return Series.gh(this.sm, null);
        }
        getDataLegendSeriesContextAt(a, b) {
            let c = { $type: Point_$type, x: a, y: b };
            let d = this.hy(c);
            let e = d == null ? NaN : this.gf(d, "XMemberPath");
            let f = d == null ? NaN : this.gf(d, "YMemberPath");
            let g = new DataLegendSeriesValueInfo();
            g.l = e;
            g.a = 13;
            g.p = "X";
            g.q = this.tr != null ? this.tr : "X";
            g.r = this.tn != null ? this.tn : "X:";
            g.s = this.tp != null ? this.tp : "";
            let h = new DataLegendSeriesValueInfo();
            h.l = f;
            h.a = 14;
            h.p = "Y";
            h.q = this.tz != null ? this.tz : "Y";
            h.r = this.tv != null ? this.tv : "Y:";
            h.s = this.tx != null ? this.tx : "";
            let i = new DataLegendSeriesContext();
            i.f = ((() => {
                let $ret = new List$1(DataLegendSeriesValueInfo.$, 0);
                $ret.add(g);
                $ret.add(h);
                return $ret;
            })());
            i.b = this.aw();
            return i;
        }
        un() {
            if (this.sn) {
                this.s1 = 0;
                this.s2 = 0;
                for (let a = 0; a < this.sl.count; a++) {
                    this.s1 += this.sl.item(a);
                    this.s2 += this.sm.item(a);
                }
                this.s3 = this.s1 / this.sl.count;
                this.s4 = this.s2 / this.sm.count;
                this.sn = false;
            }
        }
        gq(a, b) {
            if (b == null || !b.ci) {
                return NaN;
            }
            if (b != this.xAxis && b != this.yAxis) {
                return NaN;
            }
            let c = this.am(a);
            if (b.co) {
                return c[1];
            }
            else {
                return c[0];
            }
        }
        am(a) {
            let b = NaN;
            let c = NaN;
            switch (a) {
                case 5:
                case 2:
                    b = this.sl.maximum;
                    c = this.sm.maximum;
                    break;
                case 4:
                case 1:
                    b = this.sl.minimum;
                    c = this.sm.minimum;
                    break;
                case 6:
                case 3:
                    if (this.sn) {
                        this.un();
                    }
                    b = this.s3;
                    c = this.s4;
                    break;
            }
            return [b, c];
        }
        pw(a) {
            let b = this.getEffectiveViewport1(this.b1);
            let c = new ScalerParams(0, this.b1.bv, this.b1.bu, this.xAxis.cg, b);
            c.c = b;
            let d = isNaN_(a[0]) ? NaN : this.xAxis.ei(a[0], c);
            c = new ScalerParams(0, this.b1.bv, this.b1.bu, this.yAxis.cg, b);
            c.b = this.gg();
            c.c = b;
            let e = isNaN_(a[1]) ? NaN : this.yAxis.ei(a[1], c);
            return { $type: Point_$type, x: d, y: e };
        }
        pv(a) {
            let b = this.am(a);
            return this.pw(b);
        }
    }
    ScatterBase.$t = markType(ScatterBase, 'ScatterBase', MarkerSeries.$, [ISupportsErrorBars_$type, ITrendLineSeries_$type]);
    ScatterBase.uo = DependencyProperty.i("ActualTrendLineBrush", Brush.$, ScatterBase.$, new PropertyMetadata(2, null, (a, b) => a.raisePropertyChanged("ActualTrendLineBrush", b.oldValue, b.newValue)));
    ScatterBase.$$p = markDep(DependencyProperty, PropertyMetadata, ScatterBase, 'raisePropertyChanged', ['ErrorBarSettings:r7:up', [ScatterErrorBarSettings.$, null], 'IsCustomScatterMarkerStyleAllowed:ss:uq', [0, false], 'IsCustomScatterStyleAllowed:st:ur', [0, false], 'ItemSearchMode:sh:us', [ScatterItemSearchMode_$type, enumGetBox(ScatterItemSearchMode_$type, 0)], 'ItemSearchThreshold:ta:ut', [1, 10000], 'MarkerCollisionAvoidance:rx:uu', [CollisionAvoidanceType_$type, enumGetBox(CollisionAvoidanceType_$type, 0)], 'MaximumMarkers:tb:uv', [1, 400], 'XAxis::u3', [NumericXAxis.$, null], 'XMemberAsLegendLabel:tn:u4', [2, null], 'XMemberAsLegendUnit:tp:u5', [2, null], 'XMemberPath:tr:u6', [2, null], 'YAxis::u7', [NumericYAxis.$, null], 'YMemberAsLegendLabel:tv:u8', [2, null], 'YMemberAsLegendUnit:tx:u9', [2, null], 'YMemberPath:tz:va', [2, null], 'TrendLineType::u1', [TrendLineType_$type, enumGetBox(TrendLineType_$type, 0)], 'TrendLineThickness::u0', [1, 1.5], 'TrendLinePeriod::uz', [1, 7], 'TrendLineBrush::uw', [Brush.$, null], 'TrendLineZIndex:tc:u2', [1, 1001], 'TrendLineDashArray:vc:ux', [DoubleCollection.$], 'TrendLineDashCap:vd:uy', [PenLineCap_$type, enumGetBox(PenLineCap_$type, 0)]]);
    return ScatterBase;
})();
/**
 * @hidden
 */
export let ScatterSeriesRenderManager = /*@__PURE__*/ (() => {
    class ScatterSeriesRenderManager extends SeriesRenderManager {
        constructor() {
            super(...arguments);
            this.aw = null;
            this.ax = null;
        }
        c() {
            this.aw = new AssigningScatterMarkerStyleEventArgs();
            return this.aw;
        }
        a() {
            this.ax = new AssigningScatterStyleEventArgs();
            return this.ax;
        }
        ay(a, b, c) {
            this.w(a, b, c);
        }
        az(a, b, c) {
            this.x(a, b, c);
        }
        a0(a, b, c, d) {
            if (b == -1) {
                a.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;
                }
            }
        }
    }
    ScatterSeriesRenderManager.$t = markType(ScatterSeriesRenderManager, 'ScatterSeriesRenderManager', SeriesRenderManager.$);
    return ScatterSeriesRenderManager;
})();
/**
 * @hidden
 */
export let ScatterBaseView = /*@__PURE__*/ (() => {
    class ScatterBaseView extends MarkerSeriesView {
        constructor(a) {
            super(a);
            this.cv = null;
            this.ct = null;
            this.cw = null;
            this.c1 = null;
            this.dc = null;
            this.dd = null;
            this.cx = null;
            this.db = null;
            this.cy = null;
            this.cw = a;
            this.cy = new HashPool$2(Base.$, Marker.$);
            this.ch(this.cy);
            this.cx = new ScatterTrendLineManager();
        }
        as() {
            super.as();
            this.cv = this.cu();
            this.dc = new Path();
            this.dd = new Path();
            if (!this.q) {
                this.cw.tb = 2000;
            }
        }
        de(a) {
            if (this.db == null) {
                this.db = new DataTemplateMeasureInfo();
                this.db.context = this.k.h();
            }
            this.db.width = a.width;
            this.db.height = a.height;
            this.db.data = a.content;
            let b = a.ah;
            if (b.measure != null) {
                b.measure(this.db);
            }
            return new Size(1, this.db.width, this.db.height);
        }
        cu() {
            let a = new NumericMarkerManager(1, (b) => this.cy.item(b), (b) => this.cw.r5.c.item(b), runOn(this, this.c9), runOn(this, this.cr), runOn(this, this.cz), () => this.cw.rx);
            a.q = runOn(this, this.de);
            return a;
        }
        c9(a) {
            this.cw.uh(a, this.cy);
        }
        c0() {
            return this.b4;
        }
        cs() {
            return this.ct;
        }
        cr() {
            this.ct = this.cw.rs(this, this.cy, this.ct, this.bv, this.bu);
            return this.ct;
        }
        cz() {
            this.c1 = this.cw.s0(this.cy, this.c1);
            return this.c1;
        }
        c2() {
        }
        c7(a) {
        }
        c3() {
        }
        c8(a) {
        }
        da() {
            if (this.cw.trendLineBrush != null) {
                this.cw.vb = this.cw.trendLineBrush;
            }
            else {
                this.cw.vb = this.cw.o5;
            }
        }
        cf(a) {
            this.cy.f(a);
        }
        c5(a) {
            this.cy.g(a);
        }
        c6() {
        }
        a5(a, b) {
            super.a5(a, b);
            if (a.d) {
                if (this.cw.trendLineType != 0 && !b) {
                    let c = this.cx.g$j;
                    c.ad = this.cw.trendLineThickness;
                    c._stroke = this.cw.vb;
                    c.ai = this.cw.vc;
                    c.aj = this.cw.vd;
                    a.v(c);
                }
            }
        }
        c4(a) {
            if (a) {
                this.c6();
                this.cy.clear();
            }
            this.cx.g$d();
            this.aq();
        }
        getDefaultTooltipTemplate() {
            let a = "<div class='ui-chart-default-tooltip-content'><span";
            let b = this.e.a7.a$r(this.e);
            if (!stringIsNullOrEmpty(b)) {
                a += " style='color:" + b + "'";
            }
            a += ">" + this.cw.title + "</span><br/><span>" + "x: </span><span class='ui-priority-primary'>${item." + this.cw.tr + "}</span><br/><span>" + "y: </span><span class='ui-priority-primary'>${item." + this.cw.tz + "}</span></div>";
            return a;
        }
    }
    ScatterBaseView.$t = markType(ScatterBaseView, 'ScatterBaseView', MarkerSeriesView.$);
    return ScatterBaseView;
})();
