/*
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 { ScatterTrendLineManager } from "./ScatterTrendLineManager";
import { TrendResolutionParams } from "./TrendResolutionParams";
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.y6 = null;
            this.zp = null;
            this.zq = null;
            this.acv = null;
            this.acw = null;
            this.zf = 1;
            this.yw = null;
            this.yx = null;
            this.zc = null;
            this.ze = null;
            this.za = null;
            this.zv = false;
            this.zu = false;
            this.zn = null;
            this.zo = null;
            this.assigningScatterStyle = null;
            this.assigningScatterMarkerStyle = null;
            this.zj = null;
            this.zd = null;
            this.y9 = null;
            this.zt = true;
            this.z8 = 0;
            this.z9 = 0;
            this.aaa = 0;
            this.aab = 0;
            this.zg = this.zh();
            this.zj = new ScatterSeriesRenderManager();
            this.zd = new ScatterFrame();
            this.acw = Rect.empty;
            this.acv = Rect.empty;
        }
        ct() {
            return new ScatterBaseView(this);
        }
        o8() {
            super.o8();
            this.xAxis = null;
            this.yAxis = null;
        }
        q7(a) {
            super.q7(a);
            this.y7 = a;
        }
        get_fx() {
            return true;
        }
        ai() {
            return [this.xAxis, this.yAxis];
        }
        ku(a, b) {
            let c = this.ni(b);
            if (c == ScatterBase.$$p[12]) {
                return this.kv(a, b, this.aa3);
            }
            if (c == ScatterBase.$$p[16]) {
                return this.kv(a, b, this.abb);
            }
            if (c == ScatterBase.$$p[1]) {
                return this.kv(a, b, this.aan);
            }
            if (c == ScatterBase.$$p[2]) {
                return this.kv(a, b, this.aap);
            }
            return null;
        }
        mi(a) {
            let b = this.ni(a);
            if (b == ScatterBase.$$p[12]) {
                return this.aa3;
            }
            if (b == ScatterBase.$$p[16]) {
                return this.abb;
            }
            if (b == ScatterBase.$$p[1]) {
                return this.aan;
            }
            if (b == ScatterBase.$$p[2]) {
                return this.aap;
            }
            return super.mi(a);
        }
        ed(a, b, c, d, e) {
            if (!this.hasMarkers) {
                return false;
            }
            let f = this.xAxis;
            let g = new ScalerParams(1, this.dc.xm, this.w2, f.df);
            g.c = this.getEffectiveViewport1(this.cw);
            let h = this.yAxis;
            let i = new ScalerParams(1, this.dc.xm, this.w2, h.df);
            i.c = this.getEffectiveViewport1(this.cw);
            a.clear();
            this.xg.cw((j) => {
                if (j._visibility == 0) {
                    let k = new SeriesPointOfInterest();
                    let l = j.n;
                    let m = j.o;
                    if (!e && (l < this.w2.left || l > this.w2.right || m < this.w2.top || m > this.w2.bottom)) {
                        return;
                    }
                    k.d = f.fw(l, g);
                    k.e = h.fw(m, i);
                    k.b = j.content;
                    k.g = this.vq;
                    k.c = j.ak;
                    if (this.ha) {
                        k.g = this.vx(j.ak);
                    }
                    a.add(k);
                }
            });
            return true;
        }
        b3() {
            if (this.b4 == 0) {
                if (this.aaj <= 2000) {
                    return 1;
                }
                else {
                    return super.b3();
                }
            }
            else {
                return super.b3();
            }
        }
        wz(a) {
            if (!this.hasMarkers || !this.xq()) {
                return Rect.empty;
            }
            let b = this.xg.ce(this.wh(a));
            if (b != null) {
                return this.xg.c7(b);
            }
            return Rect.empty;
        }
        gx(a, b) {
            if (this.xr(a, b)) {
                return true;
            }
            return false;
        }
        get zr() {
            return this.zp;
        }
        set zr(a) {
            if (this.zp != a) {
                let b = this.zr;
                this.zp = a;
                this.raisePropertyChanged("XColumn", b, this.zr);
            }
        }
        get zs() {
            return this.zq;
        }
        set zs(a) {
            if (this.zq != a) {
                let b = this.zs;
                this.zq = a;
                this.raisePropertyChanged("YColumn", b, this.zs);
            }
        }
        gc() {
            return this.highlightedItemsSource != null || (this.aan != null && this.aap != null);
        }
        z6() {
            return false;
        }
        hu() {
            let a = super.hu();
            {
                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.abj));
                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.abi));
                a.add(c);
            }
            if (this.z6()) {
                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.z6()) {
                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.r8));
                a.add(e);
            }
            if (!this.z6()) {
                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.r8));
                a.add(f);
            }
            return a;
        }
        abi(a, b) {
            if (this.aan != null) {
                b.value = this.aan;
                return;
            }
            b.value = this.aa3;
        }
        abj(a, b) {
            if (this.aap != null) {
                b.value = this.aap;
                return;
            }
            b.value = this.abb;
        }
        get acs() {
            return this.c(ScatterBase.ab3);
        }
        set acs(a) {
            this.h(ScatterBase.ab3, a);
        }
        get GetErrorBarsXAxis() {
            return this.xAxis;
        }
        get GetErrorBarsYAxis() {
            return this.yAxis;
        }
        qh() {
            super.qh();
            if (this.xAxis != null) {
                this.xAxis.k3(false);
            }
            if (this.yAxis != null) {
                this.yAxis.k3(false);
            }
        }
        rg(a, b, c, d) {
            super.rg(a, b, c, d);
            if (this.y7.df.g$e(a, b, c, d)) {
                this.ry(false);
                this.qr();
            }
            switch (b) {
                case ScatterBase.$$p[10]:
                case ScatterBase.$$p[14]:
                case ScatterBase.$$p[11]:
                case ScatterBase.$$p[15]:
                    this.ql();
                    break;
                case "FastItemsSource":
                    if (typeCast(IFastItemsSource_$type, c) != null) {
                        c.deregisterColumn(this.zr);
                        c.deregisterColumn(this.zs);
                        this.zr = null;
                        this.zs = null;
                    }
                    if (typeCast(IFastItemsSource_$type, d) != null) {
                        this.zr = this.dl(this.aa3);
                        this.zs = this.dl(this.abb);
                    }
                    if ((this.yAxis != null && !this.yAxis.d2()) || (this.xAxis != null && !this.xAxis.d2())) {
                        this.ry(this.gh && c != null);
                    }
                    break;
                case ScatterBase.$$p[9]:
                    if (c != null) {
                        c.cq(this);
                    }
                    if (d != null) {
                        d.du(this);
                    }
                    if ((this.xAxis != null && !this.xAxis.d2()) || (d == null && c != null)) {
                        this.ry(false);
                    }
                    this.qr();
                    break;
                case ScatterBase.$$p[13]:
                    if (c != null) {
                        c.cq(this);
                    }
                    if (d != null) {
                        d.du(this);
                    }
                    if ((this.yAxis != null && !this.yAxis.d2()) || (d == null && c != null)) {
                        this.ry(false);
                    }
                    this.qr();
                    break;
                case ScatterBase.$$p[12]:
                    if (this.dp != null) {
                        this.dp.deregisterColumn(this.zr);
                        this.zr = this.dl(this.aa3);
                    }
                    break;
                case "XColumn":
                    this.y7.df.g$m();
                    if (this.xAxis != null && !this.xAxis.d2()) {
                        this.ry(this.gh && this.d9);
                    }
                    break;
                case ScatterBase.$$p[16]:
                    if (this.dp != null) {
                        this.dp.deregisterColumn(this.zs);
                        this.zs = this.dl(this.abb);
                    }
                    break;
                case "YColumn":
                    this.y7.df.g$m();
                    if (this.yAxis != null && !this.yAxis.d2()) {
                        this.ry(this.gh && this.d9);
                    }
                    break;
                case ScatterBase.$$p[7]:
                    this.ry(false);
                    this.qr();
                    break;
                case ScatterBase.$$p[8]:
                    this.ry(false);
                    this.qr();
                    break;
                case "TransitionProgress":
                    this.ze.c(this.ju, this.zc, this.za);
                    this.abd();
                    try {
                        if (this.d7(this.cw)) {
                            return;
                        }
                        if ((Math.round(this.ju * 100000) / 100000) == 1) {
                            this.ab0(this.za, this.y7);
                        }
                        else {
                            this.ab0(this.ze, this.y7);
                        }
                        if (this.dc != null) {
                            this.dc.rz(this);
                        }
                    }
                    finally {
                        this.ab1();
                    }
                    break;
                case "TrendLineBrush":
                    this.rm(b);
                    break;
                case ScatterBase.$$p[0]:
                    if (this.y8 != null) {
                        this.y8.r = this;
                    }
                    this.ry(false);
                    this.qr();
                    break;
                case "TrendLineType":
                    this.qr();
                    break;
                case ScatterBase.$$p[4]:
                    this.zv = this.z3();
                    this.ry(false);
                    break;
                case ScatterBase.$$p[3]:
                    this.zu = this.z2();
                    this.ry(false);
                    break;
                case ScatterBase.$$p[5]:
                    this.zg = this.zh();
                    break;
            }
        }
        z3() {
            return this.zz;
        }
        z2() {
            return this.zy;
        }
        zx(a) {
            if (typeCast(NumericYAxis.$, a) !== null) {
                return true;
            }
            return false;
        }
        zw(a) {
            if (typeCast(NumericXAxis.$, a) !== null) {
                return true;
            }
            return false;
        }
        ab1() {
            this.acv = Rect.empty;
            this.acw = Rect.empty;
        }
        abd() {
            let a = this.getViewInfo(this.acv, this.acw);
            this.acv = a.p0;
            this.acw = a.p1;
        }
        z1(a, b) {
            if (b != 3) {
                return true;
            }
            if (a == null) {
                return true;
            }
            if (this.aa3 == a || this.abb == a) {
                return true;
            }
            return false;
        }
        ph(a, b, c, d) {
            let e = false;
            if (!this.z1(d, a)) {
                return;
            }
            this.y7.df.g$i(a, b, c, d);
            if (this.y7.aa.count > 0) {
                for (let f of fromEnum(this.y7.aa)) {
                    f.g$i(a, b, c, d);
                }
            }
            if (this.xAxis != null && !this.xAxis.d2()) {
                e = true;
            }
            if (this.yAxis != null && !this.yAxis.d2()) {
                e = true;
            }
            if (a == 0 || a == 2 || a == 3 || a == 4) {
                this.zt = true;
            }
            else if (a == 1) {
                for (let g = b; g < b + c; g++) {
                    this.z8 += this.zr.item(g);
                    this.z9 += this.zs.item(g);
                }
                this.aaa = this.z8 / this.zr.count;
                this.aab = this.z9 / this.zs.count;
            }
            if (e) {
                this.ry(true);
            }
        }
        abs(a) {
            this.abt(a, null);
        }
        abt(a, b) {
            let c = this.zr != null ? this.zr.count : 0;
            let d = this.zs != null ? this.zs.count : 0;
            let e = Math.min(c, d);
            if (e <= this.aaj) {
                a.n.clear();
                let f = new List$1(OwnedPoint.$, 0);
                for (let g of fromEnum(a.v.values)) {
                    f.add(g);
                }
                let h = this.dp;
                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.n;
                }
                for (let i of fromEnum(f)) {
                    if (h.indexOf(i.a) >= 0) {
                        if (b != null) {
                            b.j(i.c);
                        }
                        else {
                            a.n.add({ $type: Point_$type, x: i.c.x, y: i.c.y });
                        }
                    }
                }
            }
        }
        ay(a) {
            if (a != null && a == this.xAxis && this.zr != null) {
                return new AxisRange(this.zr.minimum, this.zr.maximum);
            }
            if (a != null && a == this.yAxis && this.zs != null) {
                return new AxisRange(this.zs.minimum, this.zs.maximum);
            }
            return null;
        }
        kr(a) {
            let b = this.j7(a);
            if (this.dp != null && b >= 0 && b < this.dp.count) {
                return this.dp.item(b);
            }
            return null;
        }
        get zg() {
            return this.zf;
        }
        set zg(a) {
            let b = this.zf;
            this.zf = a;
            if (b != this.zf) {
                this.raisePropertyChanged("ActualItemSearchMode", enumGetBox(ScatterItemSearchMode_$type, b), enumGetBox(ScatterItemSearchMode_$type, this.zf));
            }
        }
        zh() {
            if (this.zi != 0) {
                return this.zi;
            }
            return this.z0 ? 4 : 1;
        }
        j7(a) {
            let b = truncate(Math.round(this.it(a)));
            return b;
        }
        it(a) {
            switch (this.zg) {
                case 1: return this.aaf(a);
                case 3: return this.aag(a);
                case 2: return this.aad(a);
                case 4: return this.aae(a);
                case 5: return this.aac(a);
            }
            return -1;
        }
        aae(a) {
            return this.aah(a, false);
        }
        aad(a) {
            let b = this.wh(a);
            let c = b.x;
            let d = b.y;
            if (this.dp == null || this.xAxis == null || this.yAxis == null || this.zr == null || this.zs == null) {
                return -1;
            }
            if (this.dp.count > this.aai) {
                return -1;
            }
            this.abg();
            let e = this.yw;
            let f = this.yx;
            if (e == null || f == null) {
                return -1;
            }
            let g = 1.7976931348623157E+308;
            let h = -1;
            for (let i = 0; i < this.zr.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;
        }
        abg() {
            let a = this.cw.ca;
            let b = this.cw.b9;
            let c = this.getEffectiveViewport();
            if (this.y6 == null) {
                return;
            }
            let d = new ScalerParams(0, a, b, this.y6.d, c);
            let e = ((() => {
                let $ret = new ScalerParams(0, a, b, this.y6.e, c);
                $ret.b = this.i0();
                return $ret;
            })());
            if (this.yw == null || this.yx == null) {
                let f = arrayShallowClone(this.zr.asArray());
                let g = arrayShallowClone(this.zs.asArray());
                this.xAxis.j6(boxArray$1(f), 0, f.length, d);
                this.yAxis.j6(boxArray$1(g), 0, g.length, e);
                this.yw = f;
                this.yx = g;
            }
        }
        get_z0() {
            return false;
        }
        get z0() {
            return this.get_z0();
        }
        aah(a, b) {
            if (!this.z0) {
                return -1;
            }
            let c = { $type: Point_$type, x: 0, y: 0 };
            let d = true;
            let e = this.zb();
            if (e == null) {
                return -1;
            }
            if (e.n == null) {
                return -1;
            }
            if (this.dp == null || this.dp.count > this.aai) {
                return -1;
            }
            this.abg();
            let f = this.yw;
            let g = this.yx;
            if (f == null || g == null) {
                return -1;
            }
            let h = this.wh(a);
            let i = 1.7976931348623157E+308;
            let j = -1;
            for (let k = 0; k < this.yw.length; k++) {
                let l = { $type: Point_$type, x: this.yw[k], y: this.yx[k] };
                if (k > 0) {
                    if (!b || e.j.containsKey(this.dp.item(k)) || e.j.containsKey(this.dp.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.yw[j], y: this.yx[j] };
                let o = { $type: Point_$type, x: this.yw[j - 1], y: this.yx[j - 1] };
                if (!b || (e.j.containsKey(this.dp.item(j)) && e.j.containsKey(this.dp.item(j - 1)))) {
                    let p = GeometryUtil.m(h, o, n);
                    return (j - 1) + p;
                }
                else if (e.j.containsKey(this.dp.item(j))) {
                    return j;
                }
                else {
                    return j - 1;
                }
            }
            return -1;
        }
        aag(a) {
            return this.aah(a, true);
        }
        aac(a) {
            let b = this.wh(a);
            let c = b.x;
            let d = b.y;
            if (this.y7.dg.e > this.aai) {
                return -1;
            }
            let e = -1;
            this.xg.cx((f) => {
                let g = this.y7.c7(f);
                let h = g.left;
                let i = g.top;
                let j = g.width;
                let k = g.height;
                if (this.xn) {
                    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;
        }
        aaf(a) {
            let b = null;
            let c = 1.7976931348623157E+308;
            let d = this.wh(a);
            let e = d.x;
            let f = d.y;
            if (this.y7.dg.e > this.aai) {
                return -1;
            }
            this.y7.dn((g) => {
                if (g._visibility == 0) {
                    let h = this.y7.c7(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;
        }
        wm(a, b, c) {
            if (this.xAxis == null || this.yAxis == null || this.zr == null || this.zs == null) {
                return { $type: Point_$type, x: NaN, y: NaN };
            }
            let d = this.cw.ca;
            let e = this.cw.b9;
            let f = this.getEffectiveViewport();
            let g = new ScalerParams(0, d, e, this.xAxis.df, f);
            let h = ((() => {
                let $ret = new ScalerParams(0, d, e, this.yAxis.df, f);
                $ret.b = this.i0();
                return $ret;
            })());
            if (b) {
                let i = this.it(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.dp.count - 1) {
                    k = this.dp.count - 1;
                }
                if (j > this.dp.count - 1) {
                    j = this.dp.count - 1;
                }
                if (k == j) {
                    let l = this.xAxis.ft(this.zr.item(j), g);
                    let m = this.yAxis.ft(this.zs.item(j), h);
                    return { $type: Point_$type, x: l, y: m };
                }
                let n = i - Math.floor(i);
                let o = this.xAxis.ft(this.zr.item(j), g);
                let p = this.yAxis.ft(this.zs.item(j), h);
                let q = this.xAxis.ft(this.zr.item(k), g);
                let r = this.yAxis.ft(this.zs.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.j7(a);
                if (u == -1) {
                    return { $type: Point_$type, x: NaN, y: NaN };
                }
                let v = this.xAxis.ft(this.zr.item(u), g);
                let w = this.yAxis.ft(this.zs.item(u), h);
                return { $type: Point_$type, x: v, y: w };
            }
        }
        ge(a) {
            let b = this.dc != null ? this.dc.xm : Rect.empty;
            b = b.copy();
            let c = this.dc != null ? this.dc.x4 : Rect.empty;
            let d = new Rect(0, 0, 0, 1, 1);
            let e = this.wv(this.cw);
            let f = new ScalerParams(0, d, d, this.xAxis.df, e);
            let g = ((() => {
                let $ret = new ScalerParams(0, d, d, this.yAxis.df, e);
                $ret.b = this.i0();
                return $ret;
            })());
            let h = !b.isEmpty && !c.isEmpty && this.dp != null ? this.dp.indexOf(a) : -1;
            let i = this.xAxis != null && this.zr != null && h < this.zr.count ? this.xAxis.ft(this.zr.item(h), f) : NaN;
            let j = this.yAxis != null && this.zs != null && h < this.zs.count ? this.yAxis.ft(this.zs.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.c4 != null) {
                this.c4.au(this.dc, b, true);
            }
            return h >= 0;
        }
        sy(a, b) {
            this.ry(false);
        }
        sz(a, b) {
            this.ry(false);
        }
        zb() {
            let a = this.za;
            if (this.d4()) {
                if (this.dd.g) {
                    this.dd.t();
                }
                a = this.ze;
            }
            return a;
        }
        abe(a, b, c, d, e) {
            b.g = new Dictionary$2(Base.$, OwnedPoint.$, 1, c);
            let f = this.getEffectiveViewport1(a);
            let g = this.dp;
            let h;
            let i;
            let j = ((() => {
                let $ret = new ScalerParams(0, d, e, this.y6.d, f);
                $ret.c = this.getEffectiveViewport1(a);
                return $ret;
            })());
            let k = ((() => {
                let $ret = new ScalerParams(0, d, e, this.y6.e, f);
                $ret.c = this.getEffectiveViewport1(a);
                $ret.b = this.i0();
                return $ret;
            })());
            let l = false;
            let m = 0;
            if (this.dc != null) {
                if (this.dc.gl()) {
                    let n = this.dc.n1(d, j);
                    l = n.c;
                    m = n.d;
                }
            }
            for (let o = 0; o < c; o++) {
                h = this.zr.item(o);
                i = this.zs.item(o);
                let p = { $type: Point_$type, x: this.y6.a.ft(h, j), y: this.y6.b.ft(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;
                        })()));
                    }
                }
            }
        }
        abp(a, b) {
            this.yw = null;
            this.yx = null;
            a.j.clear();
            a.o.clear();
            a.h.clear();
            a.l.clear();
            a.i.clear();
            a.k.clear();
            let c = Math.min(this.zr != null ? this.zr.count : 0, this.zs != null ? this.zs.count : 0);
            let d = b.ca;
            let e = b.b9;
            let f = this.getEffectiveViewport1(b);
            let g = new ScalerParams(0, d, e, this.xAxis.df, f);
            g.c = this.getEffectiveViewport1(b);
            let h = ((() => {
                let $ret = new ScalerParams(0, d, e, this.yAxis.df, f);
                $ret.b = this.i0();
                return $ret;
            })());
            h.c = this.getEffectiveViewport1(b);
            if (c < 1) {
                return;
            }
            this.y6 = ((() => {
                let $ret = new ScatterAxisInfoCache();
                $ret.a = this.xAxis;
                $ret.b = this.yAxis;
                $ret.d = this.xAxis.df;
                $ret.e = this.yAxis.df;
                $ret.c = this.dp;
                return $ret;
            })());
            let i = b;
            if (c <= this.aaj) {
                this.abe(i, a, c, d, e);
            }
            if (this.xq()) {
                b.dd.l(a.j, this.aaj, d, e, this.ie);
            }
            let j = ((() => {
                let $ret = new Clipper(0, e, false);
                $ret.i = a.o;
                return $ret;
            })());
            let k = this.wt(b);
            let l = this.xAxis.fw(k.left, g);
            let m = this.xAxis.fw(k.right, g);
            b.df.j(a.o, this.trendLineType, this.zr, this.zs, this.trendLinePeriod, (n) => this.xAxis.ft(n, g), (n) => this.yAxis.ft(n, h), ((() => {
                let $ret = new TrendResolutionParams();
                $ret.d = this.ie;
                $ret.i = e;
                $ret.h = f;
                $ret.j = d;
                return $ret;
            })()), j, l, m);
            if (b.aa.count > 0) {
                a.m.clear();
                for (let n = 0; n < b.aa.count; n++) {
                    a.m.add(new List$1(Point_$type, 0));
                    let o = b.aa._inner[n];
                    o.j(a.m._inner[n], o.g$b, this.zr, this.zs, o.g$f, (p) => this.xAxis.ft(p, g), (p) => this.yAxis.ft(p, h), ((() => {
                        let $ret = new TrendResolutionParams();
                        $ret.d = this.ie;
                        $ret.i = e;
                        $ret.h = f;
                        $ret.j = d;
                        return $ret;
                    })()), j, l, m);
                }
            }
            this.abn(a, b);
        }
        pb(a, b) {
            super.pb(a, b);
            let c = b;
            c.dm(a);
        }
        get_ff() {
            return true;
        }
        zl(a, b, c) {
            return null;
        }
        zm(a, b, c) {
            if (this.dp == null) {
                return null;
            }
            let d = this.zb();
            let e = this.y7.ce(this.wh(b));
            let f = -1;
            if (e == null) {
                if (a != null) {
                    f = this.dp.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;
        }
        w5(a, b) {
            if (this.xi != 1 && this.xi != 13) {
                let c = this.xg.c8();
                let d = (c.width / 2) + (this.xt / 2);
                let e = (c.height / 2) + (this.xt / 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);
        }
        zk(a, b, c) {
            let d = new HighlightingInfo();
            d.i = this;
            d.g = 0;
            d.f = this.dp.count - 1;
            d.c = true;
            if (c != null && c.g == d.g && c.f == d.f) {
                return c;
            }
            return d;
        }
        dh(a, b, c) {
            if (this.ef && this.f0(this.by) && !c) {
                let d = this.zl(a, b, this.zn);
                this.zn = d;
                return d;
            }
            else {
                let e = this.zk(a, b, this.zn);
                this.zn = e;
                return e;
            }
        }
        di(a, b, c) {
            if (this.f0(this.by) && !c) {
                let d = this.zm(a, b, this.zo);
                this.zo = d;
                return d;
            }
            else {
                let e = this.zk(a, b, this.zo);
                e.d = true;
                this.zo = e;
                return e;
            }
        }
        z5() {
            return (this.assigningScatterStyle != null && this.zv) || this.d3 || (this.by != 1) || (this.cq != 1) || (this.cp != 1);
        }
        z4() {
            return (this.assigningScatterMarkerStyle != null && this.zu) || this.d3 || (this.by != 1) || (this.cq != 1) || (this.cp != 1);
        }
        ab0(a, b) {
            this.q3();
            let c = b.b9;
            this.y6 = ((() => {
                let $ret = new ScatterAxisInfoCache();
                $ret.a = this.xAxis;
                $ret.b = this.yAxis;
                $ret.d = this.xAxis.df;
                $ret.e = this.yAxis.df;
                return $ret;
            })());
            if (this.xq()) {
                b.dd.j(a.j, this.xs);
                if (this.z4()) {
                    this.abf(b, a);
                }
            }
            b.c4();
            let d = ((() => {
                let $ret = new Clipper(1, NaN, c.bottom, NaN, c.top, false);
                $ret.i = b.df.g$n.an;
                return $ret;
            })());
            b.df.g$l(a.o, d);
            if (b.aa.count > 0) {
                for (let e = 0; e < b.aa.count; e++) {
                    let f = b.aa._inner[e];
                    f.g$l(a.m._inner[e], d);
                }
            }
            this.abx(a, b);
        }
        ak(a, b) {
            let c = new List$1(ChartSelection.$, 0);
            this.qa(a, c, b);
            return c.toArray();
        }
        qa(a, b, c) {
            this.abh(a, b, c, 0, null);
        }
        abh(a, b, c, d, e) {
            let f = this.dc.x1(this.dc.xr(a));
            let g = this.dp.count;
            let h = this.y6.a;
            let i = this.y6.b;
            let j = this.dc.xu(this.w2, this.getEffectiveViewport(), f);
            let k = new ScalerParams(0, f, this.dc.x4, h.df, this.getEffectiveViewport());
            let l = new ScalerParams(0, f, this.dc.x4, i.df, this.getEffectiveViewport());
            if (d == 0) {
                for (let m = 0; m < g; m++) {
                    let n = h.ft(this.zr.item(m), k);
                    let o = i.ft(this.zs.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.dp.item(m);
                                return $ret;
                            })()));
                        }
                        else {
                            b.add(((() => {
                                let $ret = new ChartSelection();
                                $ret.item = this.dp.item(m);
                                $ret.series = this;
                                return $ret;
                            })()));
                        }
                    }
                }
            }
            else {
                for (let p = 0; p < g; p++) {
                    let q = h.ft(this.zr.item(p), k);
                    let r = i.ft(this.zs.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.dp.item(p);
                                return $ret;
                            })()));
                        }
                        else {
                            b.add(((() => {
                                let $ret = new ChartSelection();
                                $ret.item = this.dp.item(p);
                                $ret.series = this;
                                return $ret;
                            })()));
                        }
                    }
                }
            }
        }
        yz(a, b) {
            return this.y0(a, b);
        }
        y0(a, b) {
            if (b < a || a < 0 || a > this.zr.count || b < 0 || b > this.zr.count) {
                return null;
            }
            let c = new Array((b - a) + 1);
            for (let d = a; d <= b; d++) {
                let e = d;
                c[d - a] = this.dp.item(d);
            }
            return c;
        }
        abf(a, b) {
            a.ck = true;
            this.zj.ay(this, this.z4(), runOn(this, this.yz));
            let c = this.zj.d;
            let d = c != null;
            let e = this.getEffectiveViewport1(a);
            let f = this.dp == null ? 0 : this.dp.count;
            this.y7.cw((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.abk(h, f, a.t);
                    }
                    this.zj.ac(g, i);
                }
            });
        }
        abl(a, b, c) {
            let d = this.by != 1;
            let e = this.cq != 1;
            let f = this.cp != 1;
            this.zj.a0(this.zj.b, a, b, false);
            this.zj.ab(this.ic);
            let g = this.zj.ax;
            let h = null;
            let i = null;
            let j = null;
            let k = this.dp;
            if (d && this.dc != null) {
                h = this.dc.d0.getHighlightingInfo(this, k, g.z, g.y, false);
                g.c = h;
            }
            if (e && this.dc != null) {
                h = this.dc.d1.getHighlightingInfo(this, k, g.z, g.y, false);
                g.d = h;
            }
            if (f && this.dc != null) {
                h = this.dc.dz.getHighlightingInfo(this, k, g.z, g.y, false);
                g.b = h;
            }
            g.h = c;
            this.abv(g);
            this.zj.z(this, h, i, j, c, d, e, f, a < 0);
        }
        abk(a, b, c) {
            let d = this.by != 1;
            let e = this.cq != 1;
            let f = this.cp != 1;
            this.zj.a0(this.zj.d, a, b, true);
            this.zj.aa(this.ic);
            let g = this.zj.aw;
            let h = null;
            let i = null;
            let j = null;
            let k = this.dp;
            let l = null;
            let m = null;
            let n = null;
            if (d && this.dc != null) {
                h = this.dc.d0.getHighlightingInfo(this, k, g.z, g.y, true);
                if (this.dc.d0.isCrossContextHighlight(this)) {
                    l = this.dc.d0.getHighlightingInfo(this, k, g.z, g.y, true);
                }
                g.c = h;
            }
            if (e && this.dc != null) {
                i = this.dc.d1.getHighlightingInfo(this, k, g.z, g.y, true);
                if (i == null && this.bo != null) {
                    i = this.dc.d1.getHighlightingInfo(this.bo, this.bo.dp, g.z, g.y, true);
                }
                if (i == null && this.bl != null) {
                    i = this.dc.d1.getHighlightingInfo(this.bl, this.bl.dp, g.z, g.y, true);
                }
                if (this.dc.d1.isCrossContextHighlight(this)) {
                    m = this.dc.d1.getHighlightingInfo(this, k, g.z, g.y, true);
                }
                g.d = i;
            }
            if (f && this.dc != null) {
                j = this.dc.dz.getHighlightingInfo(this, k, g.z, g.y, true);
                if (this.dc.dz.isCrossContextHighlight(this)) {
                    n = this.dc.dz.getHighlightingInfo(this, k, g.z, g.y, true);
                }
                g.d = i;
            }
            g.h = c;
            this.abu(g);
            this.zj.y(this, h, i, j, c, d, e, f, g.v, this.dc.d0.totalHighWaterMark, g.x, this.dc.d1.totalHighWaterMark, g.t, this.dc.dz.totalHighWaterMark);
        }
        abv(a) {
            if (this.assigningScatterStyle != null && this.zv) {
                this.assigningScatterStyle(this, a);
            }
        }
        abu(a) {
            if (this.assigningScatterMarkerStyle != null && this.zu) {
                this.assigningScatterMarkerStyle(this, a);
            }
        }
        abn(a, b) {
            let c = new ErrorBarsHelper(this, b);
            if (this.y8 == null) {
                return;
            }
            let d = this.y8.u;
            let e = this.y8.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.abq(k, c, d, h, i, true);
                            h = l.p3;
                            i = l.p4;
                            break;
                        case 0:
                            let m = this.abo(k, c, d, h, i, true);
                            h = m.p3;
                            i = m.p4;
                            break;
                        case 2:
                            let n = this.abm(k, c, d, j, h, i, true);
                            h = n.p4;
                            i = n.p5;
                            break;
                        case 3:
                            let o = this.abr(c, d, f, h, i, true);
                            f = o.p2;
                            h = o.p3;
                            i = o.p4;
                            break;
                        case 4:
                            let p = this.abo(k, c, d, h, i, true);
                            h = p.p3;
                            i = p.p4;
                            break;
                    }
                    ;
                    let q = new OwnedPoint();
                    q.c = c.l(d, this.y6.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.abq(k, c, e, h, i, false);
                            h = r.p3;
                            i = r.p4;
                            break;
                        case 0:
                            let s = this.abo(k, c, e, h, i, false);
                            h = s.p3;
                            i = s.p4;
                            break;
                        case 2:
                            let t = this.abm(k, c, e, j, h, i, false);
                            h = t.p4;
                            i = t.p5;
                            break;
                        case 3:
                            let u = this.abr(c, e, g, h, i, false);
                            g = u.p2;
                            h = u.p3;
                            i = u.p4;
                            break;
                        case 4:
                            let v = this.abo(k, c, e, h, i, false);
                            h = v.p3;
                            i = v.p4;
                            break;
                    }
                    ;
                    let w = new OwnedPoint();
                    w.c = c.m(e, this.y6.b, k.c, g);
                    w.a = k.a;
                    a.l.addItem(j, w);
                    a.k.addItem(j, [h, i]);
                }
            }
        }
        abq(a, b, c, d, e, f) {
            if (f) {
                let g;
                let h, i;
                i = this.y6.a;
                if (this.y8.s == 0) {
                    g = a.c.x;
                    h = this.y6.a;
                }
                else {
                    g = a.c.y;
                    h = this.y6.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.y6.b;
                if (this.y8.t == 0) {
                    k = a.c.x;
                    l = this.y6.a;
                }
                else {
                    k = a.c.y;
                    l = this.y6.b;
                }
                let n = b.f(k, c, l, m, d, e);
                d = n.p4;
                e = n.p5;
            }
            return {
                p3: d,
                p4: e
            };
        }
        abo(a, b, c, d, e, f) {
            if (f) {
                let g = b.j(a.c.x, c, this.y6.a, d, e);
                d = g.p3;
                e = g.p4;
            }
            else {
                let h = b.j(a.c.y, c, this.y6.b, d, e);
                d = h.p3;
                e = h.p4;
            }
            return {
                p3: d,
                p4: e
            };
        }
        abm(a, b, c, d, e, f, g) {
            let h = c.getItemColumn();
            let i = this.dp.indexOf(d);
            if (h != null && i < h.count) {
                let j = h.item(i);
                if (g) {
                    let k = b.h(a.c.x, j, this.y6.a, e, f);
                    e = k.p3;
                    f = k.p4;
                }
                else {
                    let l = b.h(a.c.y, j, this.y6.b, e, f);
                    e = l.p3;
                    f = l.p4;
                }
            }
            else {
                e = NaN;
                f = NaN;
            }
            return {
                p4: e,
                p5: f
            };
        }
        abr(a, b, c, d, e, f) {
            let g = a.i(b, c);
            c = g.p1;
            if (f) {
                let h = a.k(c, b, this.y6.a, d, e);
                d = h.p3;
                e = h.p4;
            }
            else {
                let i = a.k(c, b, this.y6.b, d, e);
                d = i.p3;
                e = i.p4;
            }
            return {
                p2: c,
                p3: d,
                p4: e
            };
        }
        abx(a, b) {
            if (!b.r() || this.y8 == null) {
                b.dp();
                return;
            }
            this.aby(a, b);
            this.abz(a, b);
        }
        aby(a, b) {
            b.dk();
            let c = new ErrorBarsHelper(this, b);
            let d = new PathGeometry();
            let e = this.y8.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.y8.o == 1 || this.y8.o == 2) {
                            c.d(d, i, g, true);
                        }
                        if (this.y8.o == 1 || this.y8.o == 3) {
                            c.d(d, i, h, false);
                        }
                    }
                }
            }
            b.dq(d);
        }
        abz(a, b) {
            b.dl();
            let c = new ErrorBarsHelper(this, b);
            let d = new PathGeometry();
            let e = this.y8.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.y8.p == 1 || this.y8.p == 2) {
                            c.e(d, i, g, true);
                        }
                        if (this.y8.p == 1 || this.y8.p == 3) {
                            c.e(d, i, h, false);
                        }
                    }
                }
            }
        }
        hf(a, b, c) {
            let d = true;
            if (!super.hf(a, b, c) || b.isEmpty || a.isEmpty || this.xAxis == null || this.yAxis == null || this.xAxis.b0 == null || this.yAxis.b0 == null || this.zr == null || this.zs == null || this.zr.count == 0 || this.zs.count == 0 || this.dp == null || this.dp.count != this.zr.count || this.dp.count != this.zs.count || this.xAxis.b0 == null || this.yAxis.b0 == null || this.xAxis.pr == this.xAxis.pq || this.yAxis.pr == this.yAxis.pq) {
                d = false;
            }
            return d;
        }
        getViewInfo(a, b) {
            if (!this.acv.isEmpty && !this.acw.isEmpty) {
                a = this.acv;
                b = this.acw;
                return {
                    p0: a,
                    p1: b
                };
            }
            a = this.cw.b9;
            b = this.cw.ca;
            return {
                p0: a,
                p1: b
            };
        }
        rz(a) {
            super.rz(a);
            this.abd();
            try {
                if (this.d7(this.cw)) {
                    return;
                }
                if (this.dp != null && this.dp.count > this.aaj) {
                    a = false;
                }
                if (this.gg(a) && !this.gs) {
                    let b = this.zc;
                    if (this.d4()) {
                        if (this.dd.g) {
                            this.dd.t();
                        }
                        this.zc = this.ze;
                        this.ze = b;
                    }
                    else {
                        this.zc = this.za;
                        this.za = b;
                    }
                    this.abp(this.za, this.y7);
                    this.sf();
                }
                else {
                    if (!this.gs) {
                        this.abp(this.za, this.y7);
                    }
                    this.ab0(this.za, this.y7);
                }
            }
            finally {
                this.ab1();
            }
        }
        sp() {
            super.sp();
            if (this.index < 0) {
                return;
            }
            this.y7.dt();
        }
        r0(a, b) {
            super.r0(a, b);
            if (!this.g1) {
                this.cw.be(b);
                return;
            }
            this.cw.be(b);
            if (this.d7(this.cv)) {
                return;
            }
            let c = typeCast(ScatterBaseView.$, this.cv);
            this.r1();
            this.g1 = false;
        }
        r1() {
            super.r1();
            let a = typeCast(ScatterBaseView.$, this.cv);
            if (!this.gt) {
                this.zd = new ScatterFrame();
                this.abp(this.zd, a);
            }
            this.gt = false;
            this.ab0(this.zd, a);
        }
        rx(a, b, c, d, e) {
            super.rx(a, b, c, d, e);
            let f = this.ba.a$j.item(d);
            let g = f;
            f.bd(c);
            if (this.d7(g)) {
                return;
            }
            if (this.y9 == null) {
                this.y9 = new ScatterFrame();
            }
            this.abp(this.y9, g);
            this.ab0(this.y9, g);
        }
        abw(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);
            }
        }
        yy(a, b, c, d, e) {
            if (c == null || c.length != this.y6.c.count) {
                c = new Array(this.y6.c.count);
                for (let f = 0; f < this.y6.c.count; f++) {
                    c[f] = PointUtil.create();
                }
            }
            let g = this.getEffectiveViewport1(a);
            let h = ((() => {
                let $ret = new ScalerParams(0, d, e, this.xAxis.df, g);
                $ret.c = this.getEffectiveViewport1(a);
                return $ret;
            })());
            let i = ((() => {
                let $ret = new ScalerParams(0, d, e, this.yAxis.df, g);
                $ret.c = this.getEffectiveViewport1(a);
                $ret.b = this.i0();
                return $ret;
            })());
            let j = this.wt(a);
            let k = this.y6.a.fw(j.left, h);
            let l = this.y6.a.fw(j.right, h);
            let m = this.y6.b.fw(j.bottom, i);
            let n = this.y6.b.fw(j.top, i);
            if (this.y6.d) {
                let o = k;
                k = l;
                l = o;
            }
            if (this.y6.e) {
                let p = m;
                m = n;
                n = p;
            }
            let q = this.y6;
            let r = q.a;
            let s = q.b;
            let t;
            let u;
            let v = this.zr;
            let w = this.zs;
            let x = false;
            let y = 0;
            let z = 0;
            if (this.dc != null) {
                if (this.dc.gl()) {
                    let aa = this.dc.n1(d, h);
                    x = aa.c;
                    y = aa.d;
                    z = r.fw(0 + y, h);
                    let ab = r.fw(0, h);
                    z -= ab;
                }
            }
            for (let ac = 0; ac < this.y6.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.ft(t, h);
                        c[ac].y = s.ft(u, i);
                    }
                    else {
                        if ((t + z) >= k && (t + z) <= l && u >= m && u <= n) {
                            c[ac].x = r.ft(t, h) + y;
                            c[ac].y = s.ft(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.ft(t, h);
                        c[ac].y = s.ft(u, i);
                    }
                    else {
                        c[ac].x = NaN;
                        c[ac].y = NaN;
                    }
                }
            }
            return c;
        }
        z7(a, b) {
            if (b == null) {
                b = new List$1(Number_$type, 2, a.e);
            }
            else {
                b.clear();
            }
            let c = 0;
            let d = this.dp;
            for (let e of fromEnum(a.c)) {
                b.add(d.indexOf(e));
            }
            return b;
        }
        p5(a) {
            super.p5(a);
            this.bc.exportTrendlineData(this, a, this.y7.df.g$n);
        }
        i0() {
            return Series.i1(this.zs, null);
        }
        getDataLegendSeriesContextAt(a, b) {
            let c = { $type: Point_$type, x: a, y: b };
            let d = this.kr(c);
            let e = d == null ? NaN : this.iz(d, "XMemberPath");
            let f = d == null ? NaN : this.iz(d, "YMemberPath");
            let g = new DataLegendSeriesValueInfo();
            g.l = e;
            g.a = 13;
            g.q = "X";
            g.r = this.aa3 != null ? this.aa3 : "X";
            g.s = this.aaz != null ? this.aaz : "X:";
            g.t = this.aa1 != null ? this.aa1 : "";
            let h = new DataLegendSeriesValueInfo();
            h.l = f;
            h.a = 14;
            h.q = "Y";
            h.r = this.abb != null ? this.abb : "Y";
            h.s = this.aa7 != null ? this.aa7 : "Y:";
            h.t = this.aa9 != null ? this.aa9 : "";
            let i = new DataLegendSeriesContext();
            i.e = ((() => {
                let $ret = new List$1(DataLegendSeriesValueInfo.$, 0);
                $ret.add(g);
                $ret.add(h);
                return $ret;
            })());
            i.h = this.mh();
            return i;
        }
        ab2() {
            if (this.zt) {
                this.z8 = 0;
                this.z9 = 0;
                for (let a = 0; a < this.zr.count; a++) {
                    this.z8 += this.zr.item(a);
                    this.z9 += this.zs.item(a);
                }
                this.aaa = this.z8 / this.zr.count;
                this.aab = this.z9 / this.zs.count;
                this.zt = false;
            }
        }
        jb(a, b) {
            if (b == null || !b.dh) {
                return NaN;
            }
            if (b != this.xAxis && b != this.yAxis) {
                return NaN;
            }
            let c = this.aq(a);
            if (b.dq) {
                return c[1];
            }
            else {
                return c[0];
            }
        }
        aq(a) {
            let b = NaN;
            let c = NaN;
            switch (a) {
                case 5:
                case 2:
                    b = this.zr.maximum;
                    c = this.zs.maximum;
                    break;
                case 4:
                case 1:
                    b = this.zr.minimum;
                    c = this.zs.minimum;
                    break;
                case 6:
                case 3:
                    if (this.zt) {
                        this.ab2();
                    }
                    b = this.aaa;
                    c = this.aab;
                    break;
            }
            return [b, c];
        }
        wq(a) {
            let b = this.getEffectiveViewport1(this.cw);
            let c = new ScalerParams(0, this.cw.ca, this.cw.b9, this.xAxis.df, b);
            c.c = b;
            let d = isNaN_(a[0]) ? NaN : this.xAxis.ft(a[0], c);
            c = new ScalerParams(0, this.cw.ca, this.cw.b9, this.yAxis.df, b);
            c.b = this.i0();
            c.c = b;
            let e = isNaN_(a[1]) ? NaN : this.yAxis.ft(a[1], c);
            return { $type: Point_$type, x: d, y: e };
        }
        wp(a) {
            let b = this.aq(a);
            return this.wq(b);
        }
        bd() {
            return new ScatterTrendLineManager();
        }
    }
    ScatterBase.$t = markType(ScatterBase, 'ScatterBase', MarkerSeries.$, [ISupportsErrorBars_$type, ITrendLineSeries_$type]);
    ScatterBase.ab3 = 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:y8:ab4', [ScatterErrorBarSettings.$, null], 'HighlightedXMemberPath:aan:ab5', [2, null], 'HighlightedYMemberPath:aap:ab6', [2, null], 'IsCustomScatterMarkerStyleAllowed:zy:ab7', [0, false], 'IsCustomScatterStyleAllowed:zz:ab8', [0, false], 'ItemSearchMode:zi:ab9', [ScatterItemSearchMode_$type, enumGetBox(ScatterItemSearchMode_$type, 0)], 'ItemSearchThreshold:aai:aca', [1, 10000], 'MarkerCollisionAvoidance:y3:acb', [CollisionAvoidanceType_$type, enumGetBox(CollisionAvoidanceType_$type, 0)], 'MaximumMarkers:aaj:acc', [1, 400], 'XAxis::ack', [NumericXAxis.$, null], 'XMemberAsLegendLabel:aaz:acl', [2, null], 'XMemberAsLegendUnit:aa1:acm', [2, null], 'XMemberPath:aa3:acn', [2, null], 'YAxis::aco', [NumericYAxis.$, null], 'YMemberAsLegendLabel:aa7:acp', [2, null], 'YMemberAsLegendUnit:aa9:acq', [2, null], 'YMemberPath:abb:acr', [2, null], 'TrendLineType::aci', [TrendLineType_$type, enumGetBox(TrendLineType_$type, 0)], 'TrendLineThickness::ach', [1, 1.5], 'TrendLinePeriod::acg', [1, 7], 'TrendLineBrush::acd', [Brush.$, null], 'TrendLineZIndex:aak:acj', [1, 1001], 'TrendLineDashArray:act:ace', [DoubleCollection.$], 'TrendLineDashCap:acu:acf', [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.dd = null;
            this.db = null;
            this.de = null;
            this.dj = null;
            this.dv = null;
            this.dw = null;
            this.df = null;
            this.du = null;
            this.dg = null;
            this.de = a;
            this.dg = new HashPool$2(Base.$, Marker.$);
            this.cz(this.dg);
            this.df = new ScatterTrendLineManager();
        }
        a4() {
            super.a4();
            this.dd = this.dc();
            this.dv = new Path();
            this.dw = new Path();
            if (!this.t) {
                this.de.aaj = 2000;
            }
        }
        dx(a) {
            if (this.du == null) {
                this.du = new DataTemplateMeasureInfo();
                this.du.context = this.m.h();
            }
            this.du.width = a.width;
            this.du.height = a.height;
            this.du.data = a.content;
            let b = a.ah;
            if (b.measure != null) {
                b.measure(this.du);
            }
            return new Size(1, this.du.width, this.du.height);
        }
        dc() {
            let a = new NumericMarkerManager(1, (b) => this.dg.item(b), (b) => this.de.y6.c.item(b), runOn(this, this.ds), runOn(this, this.c9), runOn(this, this.dh), () => this.de.y3);
            a.q = runOn(this, this.dx);
            return a;
        }
        ds(a) {
            this.de.abw(a, this.dg);
        }
        di() {
            return this.cl;
        }
        da() {
            return this.db;
        }
        c9() {
            this.db = this.de.yy(this, this.dg, this.db, this.ca, this.b9);
            return this.db;
        }
        dh() {
            this.dj = this.de.z7(this.dg, this.dj);
            return this.dj;
        }
        dk() {
        }
        dq(a) {
        }
        dl() {
        }
        dr(a) {
        }
        dt() {
            if (this.de.trendLineBrush != null) {
                this.de.acs = this.de.trendLineBrush;
            }
            else {
                this.de.acs = this.de.vj;
            }
        }
        cw(a) {
            this.dg.f(a);
        }
        dn(a) {
            this.dg.g(a);
        }
        dp() {
        }
        bi(a, b) {
            super.bi(a, b);
            if (a.d) {
                if (this.de.trendLineType != 0 && !b) {
                    let c = this.df.g$n;
                    c.ad = this.de.trendLineThickness;
                    c._stroke = this.de.acs;
                    c.ai = this.de.act;
                    c.aj = this.de.acu;
                    a.v(c);
                }
            }
        }
        dm(a) {
            if (a) {
                this.dp();
                this.dg.clear();
            }
            this.df.g$h();
            this.a2();
        }
        getDefaultTooltipTemplate() {
            let a = "<div class='ui-chart-default-tooltip-content'><span";
            let b = this.f.ba.a$u(this.f);
            if (!stringIsNullOrEmpty(b)) {
                a += " style='color:" + b + "'";
            }
            a += ">" + this.de.title + "</span><br/><span>" + "x: </span><span class='ui-priority-primary'>${item." + this.de.aa3 + "}</span><br/><span>" + "y: </span><span class='ui-priority-primary'>${item." + this.de.abb + "}</span></div>";
            return a;
        }
    }
    ScatterBaseView.$t = markType(ScatterBaseView, 'ScatterBaseView', MarkerSeriesView.$);
    return ScatterBaseView;
})();
