/*
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 "igniteui-angular-core";
import { ScatterFrame } from "./ScatterFrame";
import { Base, runOn, delegateCombine, enumGetBox, Number_$type, typeCast, fromEnum, Point_$type, 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 { SeriesLayerPropertyOverlay } from "./SeriesLayerPropertyOverlay";
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 { ChartSelection } from "./ChartSelection";
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.yw = null;
            this.zf = null;
            this.zg = null;
            this.acl = null;
            this.acm = null;
            this.y5 = 1;
            this.ym = null;
            this.yn = null;
            this.y2 = null;
            this.y4 = null;
            this.y0 = null;
            this.zl = false;
            this.zk = false;
            this.zd = null;
            this.ze = null;
            this.assigningScatterStyle = null;
            this.assigningScatterMarkerStyle = null;
            this.y9 = null;
            this.y3 = null;
            this.yz = null;
            this.zj = true;
            this.zy = 0;
            this.zz = 0;
            this.z0 = 0;
            this.z1 = 0;
            this.y6 = this.y7();
            this.y9 = new ScatterSeriesRenderManager();
            this.y3 = new ScatterFrame();
            this.acm = Rect.empty;
            this.acl = Rect.empty;
        }
        cs() {
            return new ScatterBaseView(this);
        }
        o2() {
            super.o2();
            this.xAxis = null;
            this.yAxis = null;
        }
        q1(a) {
            super.q1(a);
            this.yx = a;
        }
        get_fw() {
            return true;
        }
        ai() {
            return [this.xAxis, this.yAxis];
        }
        kq(a, b) {
            let c = this.nd(b);
            if (c == ScatterBase.$$p[12]) {
                return this.kr(a, b, this.aat);
            }
            if (c == ScatterBase.$$p[16]) {
                return this.kr(a, b, this.aa1);
            }
            if (c == ScatterBase.$$p[1]) {
                return this.kr(a, b, this.aad);
            }
            if (c == ScatterBase.$$p[2]) {
                return this.kr(a, b, this.aaf);
            }
            return null;
        }
        md(a) {
            let b = this.nd(a);
            if (b == ScatterBase.$$p[12]) {
                return this.aat;
            }
            if (b == ScatterBase.$$p[16]) {
                return this.aa1;
            }
            if (b == ScatterBase.$$p[1]) {
                return this.aad;
            }
            if (b == ScatterBase.$$p[2]) {
                return this.aaf;
            }
            return super.md(a);
        }
        eb(a, b, c, d, e) {
            if (!this.hasMarkers) {
                return false;
            }
            let f = this.xAxis;
            let g = new ScalerParams(1, this.db.v4, this.ws, f.ch);
            g.c = this.getEffectiveViewport1(this.cv);
            let h = this.yAxis;
            let i = new ScalerParams(1, this.db.v4, this.ws, h.ch);
            i.c = this.getEffectiveViewport1(this.cv);
            a.clear();
            this.w6.cj((j) => {
                if (j._visibility == 0) {
                    let k = new SeriesPointOfInterest();
                    let l = j.n;
                    let m = j.o;
                    if (l < this.ws.left || l > this.ws.right || m < this.ws.top || m > this.ws.bottom) {
                        return;
                    }
                    k.d = f.eo(l, g);
                    k.e = h.eo(m, i);
                    k.b = j.content;
                    k.g = this.vg;
                    k.c = j.ak;
                    if (this.g9) {
                        k.g = this.vn(j.ak);
                    }
                    a.add(k);
                }
            });
            return true;
        }
        b2() {
            if (this.b3 == 0) {
                if (this.z9 <= 2000) {
                    return 1;
                }
                else {
                    return super.b2();
                }
            }
            else {
                return super.b2();
            }
        }
        wp(a) {
            if (!this.hasMarkers || !this.xg()) {
                return Rect.empty;
            }
            let b = this.w6.b1(this.v7(a));
            if (b != null) {
                return this.w6.cu(b);
            }
            return Rect.empty;
        }
        gw(a, b) {
            if (this.xh(a, b)) {
                return true;
            }
            return false;
        }
        get zh() {
            return this.zf;
        }
        set zh(a) {
            if (this.zf != a) {
                let b = this.zh;
                this.zf = a;
                this.raisePropertyChanged("XColumn", b, this.zh);
            }
        }
        get zi() {
            return this.zg;
        }
        set zi(a) {
            if (this.zg != a) {
                let b = this.zi;
                this.zg = a;
                this.raisePropertyChanged("YColumn", b, this.zi);
            }
        }
        gb() {
            return this.highlightedItemsSource != null || (this.aad != null && this.aaf != null);
        }
        zw() {
            return false;
        }
        ht() {
            let a = super.ht();
            {
                let b = ((() => {
                    let $ret = new SeriesLayerPropertyOverlay();
                    $ret.ad = "YMemberPath";
                    $ret.p = true;
                    $ret.y = "HighlightedYMemberPath";
                    $ret.q = true;
                    return $ret;
                })());
                b.valueResolving = delegateCombine(b.valueResolving, runOn(this, this.aa9));
                a.add(b);
            }
            {
                let c = ((() => {
                    let $ret = new SeriesLayerPropertyOverlay();
                    $ret.ad = "XMemberPath";
                    $ret.p = true;
                    $ret.y = "HighlightedXMemberPath";
                    $ret.q = true;
                    return $ret;
                })());
                c.valueResolving = delegateCombine(c.valueResolving, runOn(this, this.aa8));
                a.add(c);
            }
            if (this.zw()) {
                let d = ((() => {
                    let $ret = new SeriesLayerPropertyOverlay();
                    $ret.r = true;
                    $ret.ad = "DashArray";
                    $ret.p = true;
                    $ret.x = ((() => {
                        let $ret = new DoubleCollection();
                        $ret.add(5);
                        $ret.add(5);
                        return $ret;
                    })());
                    $ret.q = true;
                    return $ret;
                })());
                a.add(d);
            }
            if (!this.zw()) {
                let e = ((() => {
                    let $ret = new SeriesLayerPropertyOverlay();
                    $ret.r = true;
                    $ret.ad = "Brush";
                    $ret.p = true;
                    $ret.y = "ActualBrush";
                    $ret.q = true;
                    return $ret;
                })());
                e.valueResolving = delegateCombine(e.valueResolving, runOn(this, this.r0));
                a.add(e);
            }
            if (!this.zw()) {
                let f = ((() => {
                    let $ret = new SeriesLayerPropertyOverlay();
                    $ret.r = true;
                    $ret.ad = "Outline";
                    $ret.p = true;
                    $ret.y = "ActualOutline";
                    $ret.q = true;
                    return $ret;
                })());
                f.valueResolving = delegateCombine(f.valueResolving, runOn(this, this.r0));
                a.add(f);
            }
            return a;
        }
        aa8(a, b) {
            if (this.aad != null) {
                b.value = this.aad;
                return;
            }
            b.value = this.aat;
        }
        aa9(a, b) {
            if (this.aaf != null) {
                b.value = this.aaf;
                return;
            }
            b.value = this.aa1;
        }
        get aci() {
            return this.c(ScatterBase.abt);
        }
        set aci(a) {
            this.h(ScatterBase.abt, a);
        }
        get GetErrorBarsXAxis() {
            return this.xAxis;
        }
        get GetErrorBarsYAxis() {
            return this.yAxis;
        }
        qb() {
            super.qb();
            if (this.xAxis != null) {
                this.xAxis.ib(false);
            }
            if (this.yAxis != null) {
                this.yAxis.ib(false);
            }
        }
        q9(a, b, c, d) {
            super.q9(a, b, c, d);
            if (this.yx.c2.g$b(a, b, c, d)) {
                this.rr(false);
                this.ql();
            }
            switch (b) {
                case ScatterBase.$$p[10]:
                case ScatterBase.$$p[14]:
                case ScatterBase.$$p[11]:
                case ScatterBase.$$p[15]:
                    this.qf();
                    break;
                case "FastItemsSource":
                    if (typeCast(IFastItemsSource_$type, c) != null) {
                        c.deregisterColumn(this.zh);
                        c.deregisterColumn(this.zi);
                        this.zh = null;
                        this.zi = null;
                    }
                    if (typeCast(IFastItemsSource_$type, d) != null) {
                        this.zh = this.dk(this.aat);
                        this.zi = this.dk(this.aa1);
                    }
                    if ((this.yAxis != null && !this.yAxis.c1()) || (this.xAxis != null && !this.xAxis.c1())) {
                        this.rr(this.gg && c != null);
                    }
                    break;
                case ScatterBase.$$p[9]:
                    if (c != null) {
                        c.b0(this);
                    }
                    if (d != null) {
                        d.ct(this);
                    }
                    if ((this.xAxis != null && !this.xAxis.c1()) || (d == null && c != null)) {
                        this.rr(false);
                    }
                    this.ql();
                    break;
                case ScatterBase.$$p[13]:
                    if (c != null) {
                        c.b0(this);
                    }
                    if (d != null) {
                        d.ct(this);
                    }
                    if ((this.yAxis != null && !this.yAxis.c1()) || (d == null && c != null)) {
                        this.rr(false);
                    }
                    this.ql();
                    break;
                case ScatterBase.$$p[12]:
                    if (this.dn != null) {
                        this.dn.deregisterColumn(this.zh);
                        this.zh = this.dk(this.aat);
                    }
                    break;
                case "XColumn":
                    this.yx.c2.g$i();
                    if (this.xAxis != null && !this.xAxis.c1()) {
                        this.rr(this.gg && this.d7);
                    }
                    break;
                case ScatterBase.$$p[16]:
                    if (this.dn != null) {
                        this.dn.deregisterColumn(this.zi);
                        this.zi = this.dk(this.aa1);
                    }
                    break;
                case "YColumn":
                    this.yx.c2.g$i();
                    if (this.yAxis != null && !this.yAxis.c1()) {
                        this.rr(this.gg && this.d7);
                    }
                    break;
                case ScatterBase.$$p[7]:
                    this.rr(false);
                    this.ql();
                    break;
                case ScatterBase.$$p[8]:
                    this.rr(false);
                    this.ql();
                    break;
                case "TransitionProgress":
                    this.y4.c(this.jq, this.y2, this.y0);
                    this.aa3();
                    try {
                        if (this.d5(this.cv)) {
                            return;
                        }
                        if ((Math.round(this.jq * 100000) / 100000) == 1) {
                            this.abq(this.y0, this.yx);
                        }
                        else {
                            this.abq(this.y4, this.yx);
                        }
                        if (this.db != null) {
                            this.db.qo(this);
                        }
                    }
                    finally {
                        this.abr();
                    }
                    break;
                case "TrendLineBrush":
                    this.rf(b);
                    break;
                case ScatterBase.$$p[0]:
                    if (this.yy != null) {
                        this.yy.r = this;
                    }
                    this.rr(false);
                    this.ql();
                    break;
                case "TrendLineType":
                    this.ql();
                    break;
                case ScatterBase.$$p[4]:
                    this.zl = this.zt();
                    this.rr(false);
                    break;
                case ScatterBase.$$p[3]:
                    this.zk = this.zs();
                    this.rr(false);
                    break;
                case ScatterBase.$$p[5]:
                    this.y6 = this.y7();
                    break;
            }
        }
        zt() {
            return this.zp;
        }
        zs() {
            return this.zo;
        }
        zn(a) {
            if (typeCast(NumericYAxis.$, a) !== null) {
                return true;
            }
            return false;
        }
        zm(a) {
            if (typeCast(NumericXAxis.$, a) !== null) {
                return true;
            }
            return false;
        }
        abr() {
            this.acl = Rect.empty;
            this.acm = Rect.empty;
        }
        aa3() {
            let a = this.getViewInfo(this.acl, this.acm);
            this.acl = a.p0;
            this.acm = a.p1;
        }
        zr(a, b) {
            if (b != 3) {
                return true;
            }
            if (a == null) {
                return true;
            }
            if (this.aat == a || this.aa1 == a) {
                return true;
            }
            return false;
        }
        pb(a, b, c, d) {
            let e = false;
            if (!this.zr(d, a)) {
                return;
            }
            this.yx.c2.g$e(a, b, c, d);
            if (this.xAxis != null && !this.xAxis.c1()) {
                e = true;
            }
            if (this.yAxis != null && !this.yAxis.c1()) {
                e = true;
            }
            if (a == 0 || a == 2 || a == 3 || a == 4) {
                this.zj = true;
            }
            else if (a == 1) {
                for (let f = b; f < b + c; f++) {
                    this.zy += this.zh.item(f);
                    this.zz += this.zi.item(f);
                }
                this.z0 = this.zy / this.zh.count;
                this.z1 = this.zz / this.zi.count;
            }
            if (e) {
                this.rr(true);
            }
        }
        abi(a) {
            this.abj(a, null);
        }
        abj(a, b) {
            let c = this.zh != null ? this.zh.count : 0;
            let d = this.zi != null ? this.zi.count : 0;
            let e = Math.min(c, d);
            if (e <= this.z9) {
                a.m.clear();
                let f = new List$1(OwnedPoint.$, 0);
                for (let g of fromEnum(a.u.values)) {
                    f.add(g);
                }
                let h = this.dn;
                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 });
                        }
                    }
                }
            }
        }
        ay(a) {
            if (a != null && a == this.xAxis && this.zh != null) {
                return new AxisRange(this.zh.minimum, this.zh.maximum);
            }
            if (a != null && a == this.yAxis && this.zi != null) {
                return new AxisRange(this.zi.minimum, this.zi.maximum);
            }
            return null;
        }
        kn(a) {
            let b = this.j3(a);
            if (this.dn != null && b >= 0 && b < this.dn.count) {
                return this.dn.item(b);
            }
            return null;
        }
        get y6() {
            return this.y5;
        }
        set y6(a) {
            let b = this.y5;
            this.y5 = a;
            if (b != this.y5) {
                this.raisePropertyChanged("ActualItemSearchMode", enumGetBox(ScatterItemSearchMode_$type, b), enumGetBox(ScatterItemSearchMode_$type, this.y5));
            }
        }
        y7() {
            if (this.y8 != 0) {
                return this.y8;
            }
            return this.zq ? 4 : 1;
        }
        j3(a) {
            let b = truncate(Math.round(this.ir(a)));
            return b;
        }
        ir(a) {
            switch (this.y6) {
                case 1: return this.z5(a);
                case 3: return this.z6(a);
                case 2: return this.z3(a);
                case 4: return this.z4(a);
                case 5: return this.z2(a);
            }
            return -1;
        }
        z4(a) {
            return this.z7(a, false);
        }
        z3(a) {
            let b = this.v7(a);
            let c = b.x;
            let d = b.y;
            if (this.dn == null || this.xAxis == null || this.yAxis == null || this.zh == null || this.zi == null) {
                return -1;
            }
            if (this.dn.count > this.z8) {
                return -1;
            }
            this.aa6();
            let e = this.ym;
            let f = this.yn;
            if (e == null || f == null) {
                return -1;
            }
            let g = 1.7976931348623157E+308;
            let h = -1;
            for (let i = 0; i < this.zh.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;
        }
        aa6() {
            let a = this.cv.by;
            let b = this.cv.bx;
            let c = this.getEffectiveViewport();
            if (this.yw == null) {
                return;
            }
            let d = new ScalerParams(0, a, b, this.yw.d, c);
            let e = ((() => {
                let $ret = new ScalerParams(0, a, b, this.yw.e, c);
                $ret.b = this.iy();
                return $ret;
            })());
            if (this.ym == null || this.yn == null) {
                let f = arrayShallowClone(this.zh.asArray());
                let g = arrayShallowClone(this.zi.asArray());
                this.xAxis.hq(boxArray$1(f), 0, f.length, d);
                this.yAxis.hq(boxArray$1(g), 0, g.length, e);
                this.ym = f;
                this.yn = g;
            }
        }
        get_zq() {
            return false;
        }
        get zq() {
            return this.get_zq();
        }
        z7(a, b) {
            if (!this.zq) {
                return -1;
            }
            let c = { $type: Point_$type, x: 0, y: 0 };
            let d = true;
            let e = this.y1();
            if (e == null) {
                return -1;
            }
            if (e.m == null) {
                return -1;
            }
            if (this.dn == null || this.dn.count > this.z8) {
                return -1;
            }
            this.aa6();
            let f = this.ym;
            let g = this.yn;
            if (f == null || g == null) {
                return -1;
            }
            let h = this.v7(a);
            let i = 1.7976931348623157E+308;
            let j = -1;
            for (let k = 0; k < this.ym.length; k++) {
                let l = { $type: Point_$type, x: this.ym[k], y: this.yn[k] };
                if (k > 0) {
                    if (!b || e.j.containsKey(this.dn.item(k)) || e.j.containsKey(this.dn.item(k - 1))) {
                        let m = GeometryUtil.h(h, c, l);
                        if (m < i) {
                            i = m;
                            j = k;
                        }
                    }
                }
                c = l;
            }
            if (j >= 0) {
                let n = { $type: Point_$type, x: this.ym[j], y: this.yn[j] };
                let o = { $type: Point_$type, x: this.ym[j - 1], y: this.yn[j - 1] };
                if (!b || (e.j.containsKey(this.dn.item(j)) && e.j.containsKey(this.dn.item(j - 1)))) {
                    let p = GeometryUtil.m(h, o, n);
                    return (j - 1) + p;
                }
                else if (e.j.containsKey(this.dn.item(j))) {
                    return j;
                }
                else {
                    return j - 1;
                }
            }
            return -1;
        }
        z6(a) {
            return this.z7(a, true);
        }
        z2(a) {
            let b = this.v7(a);
            let c = b.x;
            let d = b.y;
            if (this.yx.c3.e > this.z8) {
                return -1;
            }
            let e = -1;
            this.w6.ck((f) => {
                let g = this.yx.cu(f);
                let h = g.left;
                let i = g.top;
                let j = g.width;
                let k = g.height;
                if (this.xd) {
                    let l = h + j / 2;
                    let m = i + k / 2;
                    let n = (j / 2) * (j / 2);
                    let o = (c - l) * (c - l) + (d - m) * (d - m);
                    if (o < n) {
                        if (e == -1) {
                            e = f.ak;
                        }
                    }
                }
                else {
                    if (c > h && c < h + j && d > i && d < i + k) {
                        if (e == -1) {
                            e = f.ak;
                        }
                    }
                }
            });
            return e;
        }
        z5(a) {
            let b = null;
            let c = 1.7976931348623157E+308;
            let d = this.v7(a);
            let e = d.x;
            let f = d.y;
            if (this.yx.c3.e > this.z8) {
                return -1;
            }
            this.yx.da((g) => {
                if (g._visibility == 0) {
                    let h = this.yx.cu(g);
                    let i = h.left + h.width / 2;
                    let j = h.top + h.height / 2;
                    let k = (e - i) * (e - i) + (f - j) * (f - j);
                    if (k < c) {
                        c = k;
                        b = g;
                    }
                }
            });
            if (b != null) {
                return b.ak;
            }
            return -1;
        }
        wc(a, b, c) {
            if (this.xAxis == null || this.yAxis == null || this.zh == null || this.zi == null) {
                return { $type: Point_$type, x: NaN, y: NaN };
            }
            let d = this.cv.by;
            let e = this.cv.bx;
            let f = this.getEffectiveViewport();
            let g = new ScalerParams(0, d, e, this.xAxis.ch, f);
            let h = ((() => {
                let $ret = new ScalerParams(0, d, e, this.yAxis.ch, f);
                $ret.b = this.iy();
                return $ret;
            })());
            if (b) {
                let i = this.ir(a);
                if (i == -1) {
                    return { $type: Point_$type, x: NaN, y: NaN };
                }
                let j = truncate(Math.floor(i));
                let k = truncate(Math.ceil(i));
                if (j < 0) {
                    j = 0;
                }
                if (k < 0) {
                    k = 0;
                }
                if (k > this.dn.count - 1) {
                    k = this.dn.count - 1;
                }
                if (j > this.dn.count - 1) {
                    j = this.dn.count - 1;
                }
                if (k == j) {
                    let l = this.xAxis.el(this.zh.item(j), g);
                    let m = this.yAxis.el(this.zi.item(j), h);
                    return { $type: Point_$type, x: l, y: m };
                }
                let n = i - Math.floor(i);
                let o = this.xAxis.el(this.zh.item(j), g);
                let p = this.yAxis.el(this.zi.item(j), h);
                let q = this.xAxis.el(this.zh.item(k), g);
                let r = this.yAxis.el(this.zi.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.j3(a);
                if (u == -1) {
                    return { $type: Point_$type, x: NaN, y: NaN };
                }
                let v = this.xAxis.el(this.zh.item(u), g);
                let w = this.yAxis.el(this.zi.item(u), h);
                return { $type: Point_$type, x: v, y: w };
            }
        }
        gd(a) {
            let b = this.db != null ? this.db.v4 : Rect.empty;
            b = b.copy();
            let c = this.db != null ? this.db.wk : Rect.empty;
            let d = new Rect(0, 0, 0, 1, 1);
            let e = this.wl(this.cv);
            let f = new ScalerParams(0, d, d, this.xAxis.ch, e);
            let g = ((() => {
                let $ret = new ScalerParams(0, d, d, this.yAxis.ch, e);
                $ret.b = this.iy();
                return $ret;
            })());
            let h = !b.isEmpty && !c.isEmpty && this.dn != null ? this.dn.indexOf(a) : -1;
            let i = this.xAxis != null && this.zh != null && h < this.zh.count ? this.xAxis.el(this.zh.item(h), f) : NaN;
            let j = this.yAxis != null && this.zi != null && h < this.zi.count ? this.yAxis.el(this.zi.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.c3 != null) {
                this.c3.au(this.db, b, true);
            }
            return h >= 0;
        }
        sq(a, b) {
            this.rr(false);
        }
        sr(a, b) {
            this.rr(false);
        }
        y1() {
            let a = this.y0;
            if (this.d3()) {
                if (this.dc.g) {
                    this.dc.t();
                }
                a = this.y4;
            }
            return a;
        }
        aa4(a, b, c, d, e) {
            b.g = new Dictionary$2(Base.$, OwnedPoint.$, 1, c);
            let f = this.getEffectiveViewport1(a);
            let g = this.dn;
            let h;
            let i;
            let j = ((() => {
                let $ret = new ScalerParams(0, d, e, this.yw.d, f);
                $ret.c = this.getEffectiveViewport1(a);
                return $ret;
            })());
            let k = ((() => {
                let $ret = new ScalerParams(0, d, e, this.yw.e, f);
                $ret.c = this.getEffectiveViewport1(a);
                $ret.b = this.iy();
                return $ret;
            })());
            let l = false;
            let m = 0;
            if (this.db != null) {
                if (this.db.f4()) {
                    let n = this.db.m4(d, j);
                    l = n.c;
                    m = n.d;
                }
            }
            for (let o = 0; o < c; o++) {
                h = this.zh.item(o);
                i = this.zi.item(o);
                let p = { $type: Point_$type, x: this.yw.a.el(h, j), y: this.yw.b.el(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;
                        })()));
                    }
                }
            }
        }
        abf(a, b) {
            this.ym = null;
            this.yn = null;
            a.j.clear();
            a.n.clear();
            a.h.clear();
            a.l.clear();
            a.i.clear();
            a.k.clear();
            let c = Math.min(this.zh != null ? this.zh.count : 0, this.zi != null ? this.zi.count : 0);
            let d = b.by;
            let e = b.bx;
            let f = this.getEffectiveViewport1(b);
            let g = new ScalerParams(0, d, e, this.xAxis.ch, f);
            g.c = this.getEffectiveViewport1(b);
            let h = ((() => {
                let $ret = new ScalerParams(0, d, e, this.yAxis.ch, f);
                $ret.b = this.iy();
                return $ret;
            })());
            h.c = this.getEffectiveViewport1(b);
            if (c < 1) {
                return;
            }
            this.yw = ((() => {
                let $ret = new ScatterAxisInfoCache();
                $ret.a = this.xAxis;
                $ret.b = this.yAxis;
                $ret.d = this.xAxis.ch;
                $ret.e = this.yAxis.ch;
                $ret.c = this.dn;
                return $ret;
            })());
            let i = b;
            if (c <= this.z9) {
                this.aa4(i, a, c, d, e);
            }
            if (this.xg()) {
                b.c0.l(a.j, this.z9, d, e, this.id);
            }
            let j = ((() => {
                let $ret = new Clipper(0, e, false);
                $ret.i = a.n;
                return $ret;
            })());
            let k = this.wj(b);
            let l = this.xAxis.eo(k.left, g);
            let m = this.xAxis.eo(k.right, g);
            b.c2.h(a.n, this.trendLineType, this.zh, this.zi, this.trendLinePeriod, (n) => this.xAxis.el(n, g), (n) => this.yAxis.el(n, h), ((() => {
                let $ret = new TrendResolutionParams();
                $ret.d = this.id;
                $ret.i = e;
                $ret.h = f;
                $ret.j = d;
                return $ret;
            })()), j, l, m);
            this.abd(a, b);
        }
        o5(a, b) {
            super.o5(a, b);
            let c = b;
            c.c9(a);
        }
        get_fe() {
            return true;
        }
        zb(a, b, c) {
            return null;
        }
        zc(a, b, c) {
            if (this.dn == null) {
                return null;
            }
            let d = this.y1();
            let e = this.yx.b1(this.v7(b));
            let f = -1;
            if (e == null) {
                if (a != null) {
                    f = this.dn.indexOf(a);
                }
                else {
                    return null;
                }
            }
            else {
                f = e.ak;
            }
            if (f == -1) {
                return null;
            }
            let g = new HighlightingInfo();
            g.i = this;
            g.g = f;
            g.f = f;
            g.c = false;
            g.d = true;
            if (c != null && c.g == g.g && c.f == g.f) {
                return c;
            }
            return g;
        }
        wv(a, b) {
            if (this.w8 != 1 && this.w8 != 13) {
                let c = this.w6.cv();
                let d = (c.width / 2) + (this.xj / 2);
                let e = (c.height / 2) + (this.xj / 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);
        }
        za(a, b, c) {
            let d = new HighlightingInfo();
            d.i = this;
            d.g = 0;
            d.f = this.dn.count - 1;
            d.c = true;
            if (c != null && c.g == d.g && c.f == d.f) {
                return c;
            }
            return d;
        }
        dg(a, b, c) {
            if (this.ed && this.fz(this.bx) && !c) {
                let d = this.zb(a, b, this.zd);
                this.zd = d;
                return d;
            }
            else {
                let e = this.za(a, b, this.zd);
                this.zd = e;
                return e;
            }
        }
        dh(a, b, c) {
            if (this.fz(this.bx) && !c) {
                let d = this.zc(a, b, this.ze);
                this.ze = d;
                return d;
            }
            else {
                let e = this.za(a, b, this.ze);
                e.d = true;
                this.ze = e;
                return e;
            }
        }
        zv() {
            return (this.assigningScatterStyle != null && this.zl) || this.d2 || (this.bx != 1) || (this.cp != 1) || (this.co != 1);
        }
        zu() {
            return (this.assigningScatterMarkerStyle != null && this.zk) || this.d2 || (this.bx != 1) || (this.cp != 1) || (this.co != 1);
        }
        abq(a, b) {
            this.qx();
            let c = b.bx;
            this.yw = ((() => {
                let $ret = new ScatterAxisInfoCache();
                $ret.a = this.xAxis;
                $ret.b = this.yAxis;
                $ret.d = this.xAxis.ch;
                $ret.e = this.yAxis.ch;
                return $ret;
            })());
            if (this.xg()) {
                b.c0.j(a.j, this.xi);
                if (this.zu()) {
                    this.aa5(b, a);
                }
            }
            b.cr();
            let d = ((() => {
                let $ret = new Clipper(1, NaN, c.bottom, NaN, c.top, false);
                $ret.i = b.c2.g$j.an;
                return $ret;
            })());
            b.c2.g$h(a.n, d);
            this.abn(a, b);
        }
        ak(a, b) {
            let c = new List$1(ChartSelection.$, 0);
            this.p4(a, c, b);
            return c.toArray();
        }
        p4(a, b, c) {
            this.aa7(a, b, c, 0, null);
        }
        aa7(a, b, c, d, e) {
            let f = this.wr(a);
            let g = this.dn.count;
            let h = this.yw.a;
            let i = this.yw.b;
            let j = this.wj(this.cv);
            let k = new ScalerParams(0, f, this.db.wk, h.ch, this.getEffectiveViewport());
            let l = new ScalerParams(0, f, this.db.wk, i.ch, this.getEffectiveViewport());
            if (d == 0) {
                for (let m = 0; m < g; m++) {
                    let n = h.el(this.zh.item(m), k);
                    let o = i.el(this.zi.item(m), l);
                    if (n < j.width && n > 0 && o < j.height && o > 0) {
                        if (c == 7 || c == 6) {
                            b.add(((() => {
                                let $ret = new ChartSelection();
                                $ret.series = this;
                                return $ret;
                            })()));
                            return;
                        }
                        else if (c == 2 || c == 1) {
                            b.add(((() => {
                                let $ret = new ChartSelection();
                                $ret.item = this.dn.item(m);
                                return $ret;
                            })()));
                        }
                        else {
                            b.add(((() => {
                                let $ret = new ChartSelection();
                                $ret.item = this.dn.item(m);
                                $ret.series = this;
                                return $ret;
                            })()));
                        }
                    }
                }
            }
            else {
                for (let p = 0; p < g; p++) {
                    let q = h.el(this.zh.item(p), k);
                    let r = i.el(this.zi.item(p), l);
                    let s = e.item(p) / f.height;
                    let t = e.item(p) / f.width;
                    let u = new Rect(0, q - t / 2, r - s / 2, t, s);
                    if (j.intersectsWith(u)) {
                        if (c == 7 || c == 6) {
                            b.add(((() => {
                                let $ret = new ChartSelection();
                                $ret.series = this;
                                return $ret;
                            })()));
                            return;
                        }
                        else if (c == 2 || c == 1) {
                            b.add(((() => {
                                let $ret = new ChartSelection();
                                $ret.item = this.dn.item(p);
                                return $ret;
                            })()));
                        }
                        else {
                            b.add(((() => {
                                let $ret = new ChartSelection();
                                $ret.item = this.dn.item(p);
                                $ret.series = this;
                                return $ret;
                            })()));
                        }
                    }
                }
            }
        }
        yp(a, b) {
            return this.yq(a, b);
        }
        yq(a, b) {
            if (b < a || a < 0 || a > this.zh.count || b < 0 || b > this.zh.count) {
                return null;
            }
            let c = new Array((b - a) + 1);
            for (let d = a; d <= b; d++) {
                let e = d;
                c[d - a] = this.dn.item(d);
            }
            return c;
        }
        aa5(a, b) {
            a.b7 = true;
            this.y9.ay(this, this.zu(), runOn(this, this.yp));
            let c = this.y9.d;
            let d = c != null;
            let e = this.getEffectiveViewport1(a);
            let f = this.dn == null ? 0 : this.dn.count;
            this.yx.cj((g) => {
                if (g._visibility == 0) {
                    let h = g.ak;
                    let i = g.content;
                    if (i == null) {
                        i = new DataContext();
                        g.content = i;
                    }
                    if (d) {
                        this.aba(h, f, a.q);
                    }
                    this.y9.ac(g, i);
                }
            });
        }
        abb(a, b, c) {
            let d = this.bx != 1;
            let e = this.cp != 1;
            let f = this.co != 1;
            this.y9.a0(this.y9.b, a, b, false);
            this.y9.ab(this.ib);
            let g = this.y9.ax;
            let h = null;
            let i = null;
            let j = null;
            let k = this.dn;
            if (d && this.db != null) {
                h = this.db.dl.getHighlightingInfo(this, k, g.z, g.y, false);
                g.c = h;
            }
            if (e && this.db != null) {
                h = this.db.dm.getHighlightingInfo(this, k, g.z, g.y, false);
                g.d = h;
            }
            if (f && this.db != null) {
                h = this.db.dk.getHighlightingInfo(this, k, g.z, g.y, false);
                g.b = h;
            }
            g.h = c;
            this.abl(g);
            this.y9.z(this, h, i, j, c, d, e, f, a < 0);
        }
        aba(a, b, c) {
            let d = this.bx != 1;
            let e = this.cp != 1;
            let f = this.co != 1;
            this.y9.a0(this.y9.d, a, b, true);
            this.y9.aa(this.ib);
            let g = this.y9.aw;
            let h = null;
            let i = null;
            let j = null;
            let k = this.dn;
            let l = null;
            let m = null;
            let n = null;
            if (d && this.db != null) {
                h = this.db.dl.getHighlightingInfo(this, k, g.z, g.y, true);
                if (this.db.dl.isCrossContextHighlight(this)) {
                    l = this.db.dl.getHighlightingInfo(this, k, g.z, g.y, true);
                }
                g.c = h;
            }
            if (e && this.db != null) {
                i = this.db.dm.getHighlightingInfo(this, k, g.z, g.y, true);
                if (i == null && this.bn != null) {
                    i = this.db.dm.getHighlightingInfo(this.bn, this.bn.dn, g.z, g.y, true);
                }
                if (i == null && this.bk != null) {
                    i = this.db.dm.getHighlightingInfo(this.bk, this.bk.dn, g.z, g.y, true);
                }
                if (this.db.dm.isCrossContextHighlight(this)) {
                    m = this.db.dm.getHighlightingInfo(this, k, g.z, g.y, true);
                }
                g.d = i;
            }
            if (f && this.db != null) {
                j = this.db.dk.getHighlightingInfo(this, k, g.z, g.y, true);
                if (this.db.dk.isCrossContextHighlight(this)) {
                    n = this.db.dk.getHighlightingInfo(this, k, g.z, g.y, true);
                }
                g.d = i;
            }
            g.h = c;
            this.abk(g);
            this.y9.y(this, h, i, j, c, d, e, f, g.v, this.db.dl.totalHighWaterMark, g.x, this.db.dm.totalHighWaterMark, g.t, this.db.dk.totalHighWaterMark);
        }
        abl(a) {
            if (this.assigningScatterStyle != null && this.zl) {
                this.assigningScatterStyle(this, a);
            }
        }
        abk(a) {
            if (this.assigningScatterMarkerStyle != null && this.zk) {
                this.assigningScatterMarkerStyle(this, a);
            }
        }
        abd(a, b) {
            let c = new ErrorBarsHelper(this, b);
            if (this.yy == null) {
                return;
            }
            let d = this.yy.u;
            let e = this.yy.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.abg(k, c, d, h, i, true);
                            h = l.p3;
                            i = l.p4;
                            break;
                        case 0:
                            let m = this.abe(k, c, d, h, i, true);
                            h = m.p3;
                            i = m.p4;
                            break;
                        case 2:
                            let n = this.abc(k, c, d, j, h, i, true);
                            h = n.p4;
                            i = n.p5;
                            break;
                        case 3:
                            let o = this.abh(c, d, f, h, i, true);
                            f = o.p2;
                            h = o.p3;
                            i = o.p4;
                            break;
                        case 4:
                            let p = this.abe(k, c, d, h, i, true);
                            h = p.p3;
                            i = p.p4;
                            break;
                    }
                    ;
                    let q = new OwnedPoint();
                    q.c = c.l(d, this.yw.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.abg(k, c, e, h, i, false);
                            h = r.p3;
                            i = r.p4;
                            break;
                        case 0:
                            let s = this.abe(k, c, e, h, i, false);
                            h = s.p3;
                            i = s.p4;
                            break;
                        case 2:
                            let t = this.abc(k, c, e, j, h, i, false);
                            h = t.p4;
                            i = t.p5;
                            break;
                        case 3:
                            let u = this.abh(c, e, g, h, i, false);
                            g = u.p2;
                            h = u.p3;
                            i = u.p4;
                            break;
                        case 4:
                            let v = this.abe(k, c, e, h, i, false);
                            h = v.p3;
                            i = v.p4;
                            break;
                    }
                    ;
                    let w = new OwnedPoint();
                    w.c = c.m(e, this.yw.b, k.c, g);
                    w.a = k.a;
                    a.l.addItem(j, w);
                    a.k.addItem(j, [h, i]);
                }
            }
        }
        abg(a, b, c, d, e, f) {
            if (f) {
                let g;
                let h, i;
                i = this.yw.a;
                if (this.yy.s == 0) {
                    g = a.c.x;
                    h = this.yw.a;
                }
                else {
                    g = a.c.y;
                    h = this.yw.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.yw.b;
                if (this.yy.t == 0) {
                    k = a.c.x;
                    l = this.yw.a;
                }
                else {
                    k = a.c.y;
                    l = this.yw.b;
                }
                let n = b.f(k, c, l, m, d, e);
                d = n.p4;
                e = n.p5;
            }
            return {
                p3: d,
                p4: e
            };
        }
        abe(a, b, c, d, e, f) {
            if (f) {
                let g = b.j(a.c.x, c, this.yw.a, d, e);
                d = g.p3;
                e = g.p4;
            }
            else {
                let h = b.j(a.c.y, c, this.yw.b, d, e);
                d = h.p3;
                e = h.p4;
            }
            return {
                p3: d,
                p4: e
            };
        }
        abc(a, b, c, d, e, f, g) {
            let h = c.getItemColumn();
            let i = this.dn.indexOf(d);
            if (h != null && i < h.count) {
                let j = h.item(i);
                if (g) {
                    let k = b.h(a.c.x, j, this.yw.a, e, f);
                    e = k.p3;
                    f = k.p4;
                }
                else {
                    let l = b.h(a.c.y, j, this.yw.b, e, f);
                    e = l.p3;
                    f = l.p4;
                }
            }
            else {
                e = NaN;
                f = NaN;
            }
            return {
                p4: e,
                p5: f
            };
        }
        abh(a, b, c, d, e, f) {
            let g = a.i(b, c);
            c = g.p1;
            if (f) {
                let h = a.k(c, b, this.yw.a, d, e);
                d = h.p3;
                e = h.p4;
            }
            else {
                let i = a.k(c, b, this.yw.b, d, e);
                d = i.p3;
                e = i.p4;
            }
            return {
                p2: c,
                p3: d,
                p4: e
            };
        }
        abn(a, b) {
            if (!b.o() || this.yy == null) {
                b.db();
                return;
            }
            this.abo(a, b);
            this.abp(a, b);
        }
        abo(a, b) {
            b.c7();
            let c = new ErrorBarsHelper(this, b);
            let d = new PathGeometry();
            let e = this.yy.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.yy.o == 1 || this.yy.o == 2) {
                            c.d(d, i, g, true);
                        }
                        if (this.yy.o == 1 || this.yy.o == 3) {
                            c.d(d, i, h, false);
                        }
                    }
                }
            }
            b.dc(d);
        }
        abp(a, b) {
            b.c8();
            let c = new ErrorBarsHelper(this, b);
            let d = new PathGeometry();
            let e = this.yy.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.yy.p == 1 || this.yy.p == 2) {
                            c.e(d, i, g, true);
                        }
                        if (this.yy.p == 1 || this.yy.p == 3) {
                            c.e(d, i, h, false);
                        }
                    }
                }
            }
        }
        he(a, b, c) {
            let d = true;
            if (!super.he(a, b, c) || b.isEmpty || a.isEmpty || this.xAxis == null || this.yAxis == null || this.xAxis.bi == null || this.yAxis.bi == null || this.zh == null || this.zi == null || this.zh.count == 0 || this.zi.count == 0 || this.dn == null || this.dn.count != this.zh.count || this.dn.count != this.zi.count || this.xAxis.bi == null || this.yAxis.bi == null || this.xAxis.l4 == this.xAxis.l3 || this.yAxis.l4 == this.yAxis.l3) {
                d = false;
            }
            return d;
        }
        getViewInfo(a, b) {
            if (!this.acl.isEmpty && !this.acm.isEmpty) {
                a = this.acl;
                b = this.acm;
                return {
                    p0: a,
                    p1: b
                };
            }
            a = this.cv.bx;
            b = this.cv.by;
            return {
                p0: a,
                p1: b
            };
        }
        rs(a) {
            super.rs(a);
            this.aa3();
            try {
                if (this.d5(this.cv)) {
                    return;
                }
                if (this.dn != null && this.dn.count > this.z9) {
                    a = false;
                }
                if (this.gf(a) && !this.gr) {
                    let b = this.y2;
                    if (this.d3()) {
                        if (this.dc.g) {
                            this.dc.t();
                        }
                        this.y2 = this.y4;
                        this.y4 = b;
                    }
                    else {
                        this.y2 = this.y0;
                        this.y0 = b;
                    }
                    this.abf(this.y0, this.yx);
                    this.r7();
                }
                else {
                    if (!this.gr) {
                        this.abf(this.y0, this.yx);
                    }
                    this.abq(this.y0, this.yx);
                }
            }
            finally {
                this.abr();
            }
        }
        sh() {
            super.sh();
            if (this.index < 0) {
                return;
            }
            this.yx.df();
        }
        rt(a, b) {
            super.rt(a, b);
            if (!this.g0) {
                this.cv.a4(b);
                return;
            }
            this.cv.a4(b);
            if (this.d5(this.cu)) {
                return;
            }
            let c = typeCast(ScatterBaseView.$, this.cu);
            if (!this.gs) {
                this.y3 = new ScatterFrame();
                this.abf(this.y3, c);
            }
            this.gs = false;
            this.abq(this.y3, c);
            this.g0 = false;
        }
        rq(a, b, c, d, e) {
            super.rq(a, b, c, d, e);
            let f = this.ba.a$j.item(d);
            let g = f;
            f.a3(c);
            if (this.d5(g)) {
                return;
            }
            if (this.yz == null) {
                this.yz = new ScatterFrame();
            }
            this.abf(this.yz, g);
            this.abq(this.yz, g);
        }
        abm(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);
            }
        }
        yo(a, b, c, d, e) {
            if (c == null || c.length != this.yw.c.count) {
                c = new Array(this.yw.c.count);
                for (let f = 0; f < this.yw.c.count; f++) {
                    c[f] = PointUtil.create();
                }
            }
            let g = this.getEffectiveViewport1(a);
            let h = ((() => {
                let $ret = new ScalerParams(0, d, e, this.xAxis.ch, g);
                $ret.c = this.getEffectiveViewport1(a);
                return $ret;
            })());
            let i = ((() => {
                let $ret = new ScalerParams(0, d, e, this.yAxis.ch, g);
                $ret.c = this.getEffectiveViewport1(a);
                $ret.b = this.iy();
                return $ret;
            })());
            let j = this.wj(a);
            let k = this.yw.a.eo(j.left, h);
            let l = this.yw.a.eo(j.right, h);
            let m = this.yw.b.eo(j.bottom, i);
            let n = this.yw.b.eo(j.top, i);
            if (this.yw.d) {
                let o = k;
                k = l;
                l = o;
            }
            if (this.yw.e) {
                let p = m;
                m = n;
                n = p;
            }
            let q = this.yw;
            let r = q.a;
            let s = q.b;
            let t;
            let u;
            let v = this.zh;
            let w = this.zi;
            let x = false;
            let y = 0;
            let z = 0;
            if (this.db != null) {
                if (this.db.f4()) {
                    let aa = this.db.m4(d, h);
                    x = aa.c;
                    y = aa.d;
                    z = r.eo(0 + y, h);
                    let ab = r.eo(0, h);
                    z -= ab;
                }
            }
            for (let ac = 0; ac < this.yw.c.count; ac++) {
                t = v.item(ac);
                u = w.item(ac);
                let ad = 1E-10;
                if (x) {
                    if (t >= k - ad && t <= l + ad && u >= m - ad && u <= n + ad) {
                        c[ac].x = r.el(t, h);
                        c[ac].y = s.el(u, i);
                    }
                    else {
                        if ((t + z) >= k && (t + z) <= l && u >= m && u <= n) {
                            c[ac].x = r.el(t, h) + y;
                            c[ac].y = s.el(u, i);
                        }
                        else {
                            c[ac].x = NaN;
                            c[ac].y = NaN;
                        }
                    }
                }
                else {
                    if (t >= k - ad && t <= l + ad && u >= m - ad && u <= n + ad) {
                        c[ac].x = r.el(t, h);
                        c[ac].y = s.el(u, i);
                    }
                    else {
                        c[ac].x = NaN;
                        c[ac].y = NaN;
                    }
                }
            }
            return c;
        }
        zx(a, b) {
            if (b == null) {
                b = new List$1(Number_$type, 2, a.e);
            }
            else {
                b.clear();
            }
            let c = 0;
            let d = this.dn;
            for (let e of fromEnum(a.c)) {
                b.add(d.indexOf(e));
            }
            return b;
        }
        pz(a) {
            super.pz(a);
            this.bc.exportTrendlineData(this, a, this.yx.c2.g$j);
        }
        iy() {
            return Series.iz(this.zi, null);
        }
        getDataLegendSeriesContextAt(a, b) {
            let c = { $type: Point_$type, x: a, y: b };
            let d = this.kn(c);
            let e = d == null ? NaN : this.ix(d, "XMemberPath");
            let f = d == null ? NaN : this.ix(d, "YMemberPath");
            let g = new DataLegendSeriesValueInfo();
            g.l = e;
            g.a = 13;
            g.q = "X";
            g.r = this.aat != null ? this.aat : "X";
            g.s = this.aap != null ? this.aap : "X:";
            g.t = this.aar != null ? this.aar : "";
            let h = new DataLegendSeriesValueInfo();
            h.l = f;
            h.a = 14;
            h.q = "Y";
            h.r = this.aa1 != null ? this.aa1 : "Y";
            h.s = this.aax != null ? this.aax : "Y:";
            h.t = this.aaz != null ? this.aaz : "";
            let i = new DataLegendSeriesContext();
            i.e = ((() => {
                let $ret = new List$1(DataLegendSeriesValueInfo.$, 0);
                $ret.add(g);
                $ret.add(h);
                return $ret;
            })());
            i.h = this.mc();
            return i;
        }
        abs() {
            if (this.zj) {
                this.zy = 0;
                this.zz = 0;
                for (let a = 0; a < this.zh.count; a++) {
                    this.zy += this.zh.item(a);
                    this.zz += this.zi.item(a);
                }
                this.z0 = this.zy / this.zh.count;
                this.z1 = this.zz / this.zi.count;
                this.zj = false;
            }
        }
        i8(a, b) {
            if (b == null || !b.cj) {
                return NaN;
            }
            if (b != this.xAxis && b != this.yAxis) {
                return NaN;
            }
            let c = this.aq(a);
            if (b.cp) {
                return c[1];
            }
            else {
                return c[0];
            }
        }
        aq(a) {
            let b = NaN;
            let c = NaN;
            switch (a) {
                case 5:
                case 2:
                    b = this.zh.maximum;
                    c = this.zi.maximum;
                    break;
                case 4:
                case 1:
                    b = this.zh.minimum;
                    c = this.zi.minimum;
                    break;
                case 6:
                case 3:
                    if (this.zj) {
                        this.abs();
                    }
                    b = this.z0;
                    c = this.z1;
                    break;
            }
            return [b, c];
        }
        wg(a) {
            let b = this.getEffectiveViewport1(this.cv);
            let c = new ScalerParams(0, this.cv.by, this.cv.bx, this.xAxis.ch, b);
            c.c = b;
            let d = isNaN_(a[0]) ? NaN : this.xAxis.el(a[0], c);
            c = new ScalerParams(0, this.cv.by, this.cv.bx, this.yAxis.ch, b);
            c.b = this.iy();
            c.c = b;
            let e = isNaN_(a[1]) ? NaN : this.yAxis.el(a[1], c);
            return { $type: Point_$type, x: d, y: e };
        }
        wf(a) {
            let b = this.aq(a);
            return this.wg(b);
        }
    }
    ScatterBase.$t = markType(ScatterBase, 'ScatterBase', MarkerSeries.$, [ISupportsErrorBars_$type, ITrendLineSeries_$type]);
    ScatterBase.abt = 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:yy:abu', [ScatterErrorBarSettings.$, null], 'HighlightedXMemberPath:aad:abv', [2, null], 'HighlightedYMemberPath:aaf:abw', [2, null], 'IsCustomScatterMarkerStyleAllowed:zo:abx', [0, false], 'IsCustomScatterStyleAllowed:zp:aby', [0, false], 'ItemSearchMode:y8:abz', [ScatterItemSearchMode_$type, enumGetBox(ScatterItemSearchMode_$type, 0)], 'ItemSearchThreshold:z8:ab0', [1, 10000], 'MarkerCollisionAvoidance:yt:ab1', [CollisionAvoidanceType_$type, enumGetBox(CollisionAvoidanceType_$type, 0)], 'MaximumMarkers:z9:ab2', [1, 400], 'XAxis::aca', [NumericXAxis.$, null], 'XMemberAsLegendLabel:aap:acb', [2, null], 'XMemberAsLegendUnit:aar:acc', [2, null], 'XMemberPath:aat:acd', [2, null], 'YAxis::ace', [NumericYAxis.$, null], 'YMemberAsLegendLabel:aax:acf', [2, null], 'YMemberAsLegendUnit:aaz:acg', [2, null], 'YMemberPath:aa1:ach', [2, null], 'TrendLineType::ab8', [TrendLineType_$type, enumGetBox(TrendLineType_$type, 0)], 'TrendLineThickness::ab7', [1, 1.5], 'TrendLinePeriod::ab6', [1, 7], 'TrendLineBrush::ab3', [Brush.$, null], 'TrendLineZIndex:aaa:ab9', [1, 1001], 'TrendLineDashArray:acj:ab4', [DoubleCollection.$], 'TrendLineDashCap:ack:ab5', [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.e = false;
                a.z = 0;
                a.y = c - 1;
            }
            else {
                if (d) {
                    a.z = b;
                    a.y = b;
                }
                else {
                    a.e = false;
                    a.z = b;
                    a.y = b;
                }
            }
        }
    }
    ScatterSeriesRenderManager.$t = markType(ScatterSeriesRenderManager, 'ScatterSeriesRenderManager', SeriesRenderManager.$);
    return ScatterSeriesRenderManager;
})();
/**
 * @hidden
 */
export let ScatterBaseView = /*@__PURE__*/ (() => {
    class ScatterBaseView extends MarkerSeriesView {
        constructor(a) {
            super(a);
            this.c0 = null;
            this.cy = null;
            this.c1 = null;
            this.c6 = null;
            this.dh = null;
            this.di = null;
            this.c2 = null;
            this.dg = null;
            this.c3 = null;
            this.c1 = a;
            this.c3 = new HashPool$2(Base.$, Marker.$);
            this.cm(this.c3);
            this.c2 = new ScatterTrendLineManager();
        }
        au() {
            super.au();
            this.c0 = this.cz();
            this.dh = new Path();
            this.di = new Path();
            if (!this.q) {
                this.c1.z9 = 2000;
            }
        }
        dj(a) {
            if (this.dg == null) {
                this.dg = new DataTemplateMeasureInfo();
                this.dg.context = this.k.h();
            }
            this.dg.width = a.width;
            this.dg.height = a.height;
            this.dg.data = a.content;
            let b = a.ah;
            if (b.measure != null) {
                b.measure(this.dg);
            }
            return new Size(1, this.dg.width, this.dg.height);
        }
        cz() {
            let a = new NumericMarkerManager(1, (b) => this.c3.item(b), (b) => this.c1.yw.c.item(b), runOn(this, this.de), runOn(this, this.cw), runOn(this, this.c4), () => this.c1.yt);
            a.q = runOn(this, this.dj);
            return a;
        }
        de(a) {
            this.c1.abm(a, this.c3);
        }
        c5() {
            return this.b8;
        }
        cx() {
            return this.cy;
        }
        cw() {
            this.cy = this.c1.yo(this, this.c3, this.cy, this.by, this.bx);
            return this.cy;
        }
        c4() {
            this.c6 = this.c1.zx(this.c3, this.c6);
            return this.c6;
        }
        c7() {
        }
        dc(a) {
        }
        c8() {
        }
        dd(a) {
        }
        df() {
            if (this.c1.trendLineBrush != null) {
                this.c1.aci = this.c1.trendLineBrush;
            }
            else {
                this.c1.aci = this.c1.u9;
            }
        }
        cj(a) {
            this.c3.f(a);
        }
        da(a) {
            this.c3.g(a);
        }
        db() {
        }
        a7(a, b) {
            super.a7(a, b);
            if (a.d) {
                if (this.c1.trendLineType != 0 && !b) {
                    let c = this.c2.g$j;
                    c.ad = this.c1.trendLineThickness;
                    c._stroke = this.c1.aci;
                    c.ai = this.c1.acj;
                    c.aj = this.c1.ack;
                    a.v(c);
                }
            }
        }
        c9(a) {
            if (a) {
                this.db();
                this.c3.clear();
            }
            this.c2.g$d();
            this.as();
        }
        getDefaultTooltipTemplate() {
            let a = "<div class='ui-chart-default-tooltip-content'><span";
            let b = this.e.ba.a$u(this.e);
            if (!stringIsNullOrEmpty(b)) {
                a += " style='color:" + b + "'";
            }
            a += ">" + this.c1.title + "</span><br/><span>" + "x: </span><span class='ui-priority-primary'>${item." + this.c1.aat + "}</span><br/><span>" + "y: </span><span class='ui-priority-primary'>${item." + this.c1.aa1 + "}</span></div>";
            return a;
        }
    }
    ScatterBaseView.$t = markType(ScatterBaseView, 'ScatterBaseView', MarkerSeriesView.$);
    return ScatterBaseView;
})();
