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