/*
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 { Series } from "./Series";
import { NumericXAxis } from "./NumericXAxis";
import { DependencyProperty } from "igniteui-react-core";
import { NumericYAxis } from "./NumericYAxis";
import { Color } from "igniteui-react-core";
import { ScatterFrame } from "./ScatterFrame";
import { KDTree2D } from "./KDTree2D";
import { typeGetValue, runOn, delegateRemove, typeCast, delegateCombine, markType, markDep, toNullable } from "igniteui-react-core";
import { Rect } from "igniteui-react-core";
import { IFastItemsSource_$type } from "igniteui-react-core";
import { SeriesView } from "./SeriesView";
import { List$1 } from "igniteui-react-core";
import { KDPointData } from "./KDPointData";
import { ScalerParams } from "./ScalerParams";
import { ProgressiveLoadStatusEventArgs } from "./ProgressiveLoadStatusEventArgs";
import { SearchArgs } from "./SearchArgs";
import { KDTreeNode2D } from "./KDTreeNode2D";
import { AxisRange } from "./AxisRange";
import { PropertyMetadata } from "igniteui-react-core";
import { truncate, isNaN_, isInfinity, logBase, intDivide } from "igniteui-react-core";
import { boxArray$1, arrayShallowClone } from "igniteui-react-core";
import { dateNow } from "igniteui-react-core";
import { RenderingContext } from "igniteui-react-core";
import { CanvasViewRenderer } from "igniteui-react-core";
import { Rectangle } from "igniteui-react-core";
/**
 * @hidden
 */
export let HighDensityScatterSeries = /*@__PURE__*/ (() => {
    class HighDensityScatterSeries extends Series {
        constructor() {
            super();
            this.mn = null;
            this.mp = null;
            this.nv = 0;
            this.mr = false;
            this.nb = 0;
            this.na = 0;
            this.m9 = 0;
            this.m8 = 255;
            this.m7 = 0;
            this.m6 = 0;
            this.ne = 255;
            this.nd = 0;
            this.nc = 0;
            this.mf = null;
            this.mk = null;
            this.ml = null;
            this.mg = null;
            this.mi = null;
            this.mt = false;
            this.nw = 0;
            this.ny = 0;
            this.ns = 0;
            this.nr = 0;
            this.progressiveLoadStatusChanged = null;
            this.my = null;
            this.m4 = 0;
            this.m3 = 0;
            this.m5 = 0;
            this.nh = 0;
            this.nf = 0;
            this.ng = 0;
            this.ni = 0;
            this.nk = 0;
            this.nm = 0;
            this.nl = 0;
            this.nj = 0;
            this.m0 = 0;
            this.m1 = 0;
            this.m2 = 0;
            this.mz = 0;
            this.nu = 0;
            this.nt = 0;
            this.mc = null;
            this.nx = 0;
            this.ms = false;
            this._itemIndexes = null;
            this.md = null;
            this.ma = null;
            this.mm = null;
            this.ab = HighDensityScatterSeries.$;
            this.c7 = false;
        }
        get_c4() {
            return true;
        }
        get mo() {
            return this.mn;
        }
        set mo(a) {
            if (this.mn != a) {
                let b = this.mo;
                this.mn = a;
                this.raisePropertyChanged("XColumn", b, this.mo);
            }
        }
        fs(a, b) {
            let c = this.g2(b);
            if (c == HighDensityScatterSeries.$$p[8]) {
                return this.ft(a, b, this.od);
            }
            if (c == HighDensityScatterSeries.$$p[10]) {
                return this.ft(a, b, this.oh);
            }
            return super.fs(a, b);
        }
        get mq() {
            return this.mp;
        }
        set mq(a) {
            if (this.mp != a) {
                let b = this.mq;
                this.mp = a;
                this.raisePropertyChanged("YColumn", b, this.mq);
            }
        }
        ov() {
            if (this.mf == null) {
                return;
            }
            this.mf.s();
            let a = this.mf;
            a.progressiveThunkCompleted = delegateRemove(a.progressiveThunkCompleted, runOn(this, this.oj));
            this.mf = null;
        }
        i7(a, b, c, d) {
            super.i7(a, b, c, d);
            switch (b) {
                case "SeriesViewer":
                    if (this.bs != null) {
                        let e = this.getEffectiveViewport1(this.bi);
                        this.ms = !e.isEmpty;
                    }
                    break;
                case "FastItemsSource":
                    this.ov();
                    if (typeCast(IFastItemsSource_$type, c) != null) {
                        c.deregisterColumn(this.mo);
                        c.deregisterColumn(this.mq);
                        this.mo = null;
                        this.mq = null;
                    }
                    if (typeCast(IFastItemsSource_$type, d) != null) {
                        this.mo = this.bw(this.od);
                        this.mq = this.bw(this.oh);
                    }
                    if ((this.mj != null && !this.mj.cn()) || (this.mh != null && !this.mh.cn())) {
                        this.jl(false);
                    }
                    this.iu();
                    break;
                case HighDensityScatterSeries.$$p[7]:
                    let f = this.mg;
                    this.mg = this.mh;
                    this.ov();
                    if (f != null) {
                        f.rangeChanged = delegateRemove(f.rangeChanged, runOn(this, this.om));
                    }
                    if (this.mg != null) {
                        let g = this.mg;
                        g.rangeChanged = delegateCombine(g.rangeChanged, runOn(this, this.om));
                    }
                    if (c != null) {
                        c.bx(this);
                    }
                    if (d != null) {
                        d.ck(this);
                    }
                    if ((this.mh != null && !this.mh.cn()) || (d == null && c != null)) {
                        this.jl(false);
                    }
                    break;
                case HighDensityScatterSeries.$$p[9]:
                    let h = this.mi;
                    this.mi = this.mj;
                    this.ov();
                    if (h != null) {
                        h.rangeChanged = delegateRemove(h.rangeChanged, runOn(this, this.om));
                    }
                    if (this.mi != null) {
                        let i = this.mi;
                        i.rangeChanged = delegateCombine(i.rangeChanged, runOn(this, this.om));
                    }
                    if (c != null) {
                        c.bx(this);
                    }
                    if (d != null) {
                        d.ck(this);
                    }
                    if ((this.mj != null && !this.mj.cn()) || (d == null && c != null)) {
                        this.jl(false);
                    }
                    break;
                case "MouseOverEnabled":
                    this.mt = this.c7;
                    this.jl(false);
                    break;
                case HighDensityScatterSeries.$$p[8]:
                    if (this.bz != null) {
                        this.bz.deregisterColumn(this.mo);
                        this.mo = this.bw(this.od);
                    }
                    break;
                case "XColumn":
                    this.ov();
                    if (this.mh != null && !this.mh.cn()) {
                        this.jl(false);
                    }
                    this.iu();
                    break;
                case HighDensityScatterSeries.$$p[10]:
                    if (this.bz != null) {
                        this.bz.deregisterColumn(this.mq);
                        this.mq = this.bw(this.oh);
                    }
                    break;
                case "YColumn":
                    this.ov();
                    if (this.mj != null && !this.mj.cn()) {
                        this.jl(false);
                    }
                    this.iu();
                    break;
                case HighDensityScatterSeries.$$p[6]:
                    this.ov();
                    this.jl(false);
                    this.it();
                    break;
                case HighDensityScatterSeries.$$p[3]:
                    this.jl(false);
                    this.it();
                    break;
                case HighDensityScatterSeries.$$p[1]:
                    this.jl(false);
                    this.it();
                    break;
                case HighDensityScatterSeries.$$p[0]:
                case HighDensityScatterSeries.$$p[2]:
                    if (!this.me.by(this.pa, this.o9)) {
                        return;
                    }
                    this.nb = this.pa.o;
                    this.na = this.pa.n;
                    this.m9 = this.pa.m;
                    this.m8 = this.o9.o;
                    this.m7 = this.o9.n;
                    this.m6 = this.o9.m;
                    this.ne = this.m8 - this.nb;
                    this.nd = this.m7 - this.na;
                    this.nc = this.m6 - this.m9;
                    this.jl(false);
                    this.it();
                    break;
                case HighDensityScatterSeries.$$p[4]:
                    this.nv = Math.max(typeGetValue(d) - 1, 0);
                    this.mr = this.nv > 0;
                    this.jl(false);
                    this.it();
                    break;
                case HighDensityScatterSeries.$$p[5]:
                    this.jl(false);
                    this.it();
                    break;
            }
        }
        mv(a) {
            if (typeCast(NumericYAxis.$, a) !== null) {
                return true;
            }
            return false;
        }
        mu(a) {
            if (typeCast(NumericXAxis.$, a) !== null) {
                return true;
            }
            return false;
        }
        om(a, b) {
            this.ov();
            this.jl(false);
        }
        dw(a, b, c) {
            let d = super.dw(a, b, c);
            if (this.mj == null || this.mh == null || this.mh.bh == null || this.mj.bh == null || this.mq == null || this.mo == null || this.mq.count < 1 || this.mo.count < 1 || this.mq.count != this.mo.count || this.mh.kc == this.mh.kb || this.mj.kc == this.mj.kb || this.l8.isEmpty) {
                d = false;
            }
            return d;
        }
        get n2() {
            return this.nw;
        }
        set n2(a) {
            let b = this.nw;
            this.nw = a;
            this.raisePropertyChanged("ProgressiveStatus", b, this.nw);
        }
        jm(a) {
            super.jm(a);
            this.oo(a, this.bi);
        }
        oo(a, b) {
            if (this.cc(b)) {
                return;
            }
            if (this.mf == null && !this.mx) {
                let c = new List$1(KDPointData.$, 2, this.mo.count);
                let d = this.mh;
                let e = this.mj;
                let f = new Rect(0, 0, 0, 1, 1);
                let g = new Rect(0, 0, 0, 1, 1);
                let h = new ScalerParams(1, f, g, d.ca);
                let i = new ScalerParams(1, f, g, e.ca);
                let j;
                let k;
                for (let l = 0; l < this.mo.count; l++) {
                    j = d.dy(this.mo.item(l), h);
                    k = e.dy(this.mq.item(l), i);
                    if (!isNaN_(j) && !isNaN_(k) && !isInfinity(j) && !isInfinity(k)) {
                        c.add(((() => {
                            let $ret = new KDPointData();
                            $ret.a = j;
                            $ret.b = k;
                            $ret.c = l;
                            return $ret;
                        })()));
                    }
                }
                if (this.mw) {
                    this.nr = 1;
                    this.ns = truncate(logBase(c.count, 2)) + 3;
                    this.n2 = truncate(((this.nr / this.ns) * 100));
                    if (this.progressiveLoadStatusChanged != null) {
                        this.progressiveLoadStatusChanged(this, new ProgressiveLoadStatusEventArgs(this.n2));
                    }
                    this.mf = KDTree2D.b(c.toArray(), 1);
                    let m = this.mf;
                    m.progressiveThunkCompleted = delegateCombine(m.progressiveThunkCompleted, runOn(this, this.oj));
                    if (!this.mf.f(this.e4)) {
                        let n = this.mf;
                        n.progressiveThunkCompleted = delegateRemove(n.progressiveThunkCompleted, runOn(this, this.oj));
                    }
                    this.it();
                }
                else {
                    let o = dateNow();
                    this.mf = new KDTree2D(0, c.toArray(), 1);
                    let p = dateNow();
                }
            }
            if (this.mw && !this.mx) {
                this.op(b);
            }
            else {
                this.oq(b);
            }
        }
        h6(a, b, c, d) {
            super.h6(a, b, c, d);
            this.ov();
            let e = false;
            if (this.mh != null && !this.mh.cn()) {
                e = true;
            }
            if (this.mj != null && !this.mj.cn()) {
                e = true;
            }
            if (e) {
                this.jl(false);
            }
            this.iu();
        }
        ol(a) {
            let b = a;
            let c = this.nu * this.nt;
            if (this.mt) {
                if (this._itemIndexes == null || this._itemIndexes.length != c) {
                    this._itemIndexes = new Array(c);
                    for (let d = 0; d < c; d++) {
                        this._itemIndexes[d] = 0;
                    }
                }
                else {
                    for (let e = 0; e < c; e++) {
                        this._itemIndexes[e] = 0;
                    }
                }
            }
        }
        oq(a) {
            let b;
            let c;
            let d = null;
            if (a.n) {
                d = this._itemIndexes;
            }
            let e = a.getViewInfo(c, b);
            c = e.p0;
            b = e.p1;
            let f = a;
            let g = this.getEffectiveViewport1(a);
            this.mk = new ScalerParams(0, b, c, this.mg.ca, g);
            this.ml = new ScalerParams(0, b, c, this.mi.ca, g);
            this.ok(a);
            this.ol(a);
            let h = this.nu * this.nt;
            if (this.md == null || this.md.length != h) {
                this.md = new Array(h);
                this.ma = new Array(h);
            }
            let i = this.md.length;
            let j = this.md;
            let k = this.ma;
            for (let l = 0; l < i; l++) {
                j[l] = 0;
                k[l] = 0;
            }
            this.ny = truncate(Math.round(this.eu));
            this.mc = f.bv();
            let m = this.mc.length;
            let n = this.mc;
            for (let o = 0; o < m; o++) {
                n[o] = 0;
            }
            let p = this.np;
            let q = this.no;
            if (isNaN_(p) || isInfinity(p)) {
                p = 0;
            }
            if (isNaN_(q) || isInfinity(q)) {
                q = 50;
            }
            this.m4 = Math.min(p, q);
            this.m3 = Math.max(p, q);
            if (this.m4 < 0) {
                this.m4 = 0;
            }
            if (this.m3 < 0) {
                this.m3 = 0;
            }
            this.m5 = this.m3 - this.m4;
            if (this.mx) {
                this.on(a);
            }
            else {
                this.ox(a);
            }
            f.b6();
            if (a.n) {
                this._itemIndexes = d;
                this.me.b7();
            }
        }
        op(a) {
            if (this.mf == null) {
                return;
            }
            this.oq(a);
        }
        oj(a, b) {
            this.me.b5(() => {
                if (this.nr < this.ns - 1) {
                    this.nr++;
                }
                this.n2 = truncate(((this.nr / this.ns) * 100));
                if (this.progressiveLoadStatusChanged != null) {
                    this.progressiveLoadStatusChanged(this, new ProgressiveLoadStatusEventArgs(this.n2));
                }
                this.op(this.bi);
                this.it();
                if (this.mf != null) {
                    if (!this.mf.f(this.e4)) {
                        let c = this.mf;
                        c.progressiveThunkCompleted = delegateRemove(c.progressiveThunkCompleted, runOn(this, this.oj));
                        this.n2 = 100;
                        if (this.progressiveLoadStatusChanged != null) {
                            this.progressiveLoadStatusChanged(this, new ProgressiveLoadStatusEventArgs(this.n2));
                        }
                    }
                }
            });
        }
        on(a) {
            let b = arrayShallowClone(this.mo.asArray());
            this.mh.gs(boxArray$1(b), 0, b.length, this.mk);
            let c = arrayShallowClone(this.mq.asArray());
            this.nx = 0;
            let d = this.nv;
            let e = this.mr;
            let f = this.md.length;
            this.mj.gs(boxArray$1(c), 0, c.length, this.ml);
            let g = 255 << 24 | truncate(this.nb) << 16 | truncate(this.na) << 8 | truncate(this.m9);
            for (let h = 0; h < b.length; h++) {
                let i = truncate(b[h]);
                let j = truncate(c[h]);
                i = truncate(Math.floor(i));
                j = truncate(Math.floor(j));
                if (i < 0 || i >= this.nu || j < 0 || j >= this.nt) {
                    continue;
                }
                if (e) {
                    let k = i - d;
                    let l = i + d;
                    l = l > (this.nu - 1) ? (this.nu - 1) : l;
                    k = k < 0 ? 0 : k;
                    let m = j + d;
                    let n = j - d;
                    for (let o = k; o <= l; o++) {
                        for (let p = n; p <= m; p++) {
                            let q = (p * this.nu) + o;
                            if (q < 0 || q > f - 1) {
                                continue;
                            }
                            this.md[q] = this.md[q] + 1;
                            this.ma[q] = 1;
                            this.nx++;
                            if (this.mt) {
                                this._itemIndexes[q] = h + 1;
                            }
                        }
                    }
                }
                else {
                    let r = (j * this.nu) + i;
                    this.md[r] = this.md[r] + 1;
                    this.ma[r] = 1;
                    this.nx++;
                    if (this.mt) {
                        this._itemIndexes[r] = h + 1;
                    }
                }
            }
            this.or();
        }
        ox(a) {
            let b;
            let c;
            let d = a.getViewInfo(b, c);
            b = d.p0;
            c = d.p1;
            if (this.mf == null) {
                return;
            }
            if (this.my == null) {
                this.my = new List$1(KDTreeNode2D.$, 2, truncate(Math.round(b.width * b.height)));
            }
            else {
                this.my.clear();
            }
            let e = c.left;
            let f = c.right;
            let g = c.top;
            let h = c.bottom;
            this.nl = c.top;
            this.nj = c.height;
            this.nk = c.left;
            this.nm = c.width;
            this.nh = b.top;
            this.nf = b.height;
            this.ng = b.left;
            this.ni = b.width;
            let i = this.getEffectiveViewport1(a);
            this.m0 = (i.left - this.ng) / this.ni;
            this.m1 = (i.top - this.nh) / this.nf;
            let j = (i.right - this.ng) / this.ni;
            this.m2 = j - this.m0;
            let k = (i.bottom - this.nh) / this.nf;
            this.mz = k - this.m1;
            if (this.ms) {
                e = (e - this.m0) / this.m2;
                f = (f - this.m0) / this.m2;
                g = (g - this.m1) / this.mz;
                h = (h - this.m1) / this.mz;
            }
            let l = this.eu / b.width * c.width;
            let m = this.eu / b.height * c.height;
            let n = Math.min(l, m);
            let o = ((() => {
                let $ret = new SearchArgs();
                $ret.c = e;
                $ret.a = f;
                $ret.d = g;
                $ret.b = h;
                $ret.e = l;
                $ret.f = m;
                $ret.g = 0x7FFFFFFF;
                return $ret;
            })());
            this.mf.t(this.my, o, 0, 1, 0, 1);
            let p;
            this.nx = 0;
            for (let q = 0; q < this.my.count; q++) {
                p = this.my._inner[q];
                this.os(p);
            }
            this.or();
        }
        os(a) {
            if (a.g) {
                return;
            }
            let b = a.e != null && a.e.a;
            let c = a.a == null ? 0 : a.a.length;
            let d = (a.h - c) + 1;
            if (b && d > 0) {
            }
            else {
                d = 1;
            }
            this.ou(a.b, d, b, a.e);
            if (c > 0 && !b) {
                let e;
                for (let f = 0; f < c; f++) {
                    e = a.a[f];
                    this.ou(e, d, false, a.e);
                }
            }
            if (a.e != null) {
                a.e.a = false;
            }
        }
        c9(a) {
            let b = this.bs != null ? this.bs.n2 : Rect.empty;
            let c = this.bs != null ? this.bs.oh : Rect.empty;
            let d = new Rect(0, 0, 0, 1, 1);
            let e = this.l2(this.bi);
            let f = new ScalerParams(0, d, d, this.mh.ca, e);
            let g = new ScalerParams(0, d, d, this.mj.ca, e);
            let h = !b.isEmpty && !c.isEmpty && this.bz != null ? this.bz.indexOf(a) : -1;
            let i = this.mh != null && this.mo != null && h < this.mo.count ? this.mh.dy(this.mo.item(h), f) : NaN;
            let j = this.mj != null && this.mq != null && h < this.mq.count ? this.mj.dy(this.mq.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.bn != null) {
                this.bn.ap(this.bs, b, true);
            }
            return h >= 0;
        }
        ou(a, b, c, d) {
            let e = this.n0(b);
            let f = a.c;
            let g = this.nv;
            if (c) {
                let h = d.d;
                let i = d.b;
                let j = d.e;
                let k = d.c;
                if (this.ms) {
                    h = this.m0 + this.m2 * h;
                    i = this.m0 + this.m2 * i;
                    j = this.m1 + this.mz * j;
                    k = this.m1 + this.mz * k;
                }
                let l = truncate((this.ng + this.ni * (h - this.nk) / this.nm));
                let m = truncate((this.ng + this.ni * (i - this.nk) / this.nm));
                let n = truncate((this.nh + this.nf * (j - this.nl) / this.nj));
                let o = truncate((this.nh + this.nf * (k - this.nl) / this.nj));
                l = truncate(Math.floor(l));
                m = truncate(Math.floor(m));
                n = truncate(Math.floor(n));
                o = truncate(Math.floor(o));
                if (this.mr) {
                    l -= g;
                    m += g;
                    n -= g;
                    o += g;
                }
                let p = ((m - l) + 1) * ((o - n) + 1);
                let q = b / p;
                let r = q;
                for (let s = l; s <= m; s++) {
                    for (let t = n; t <= o; t++) {
                        this.ot(f, s, t, q, r);
                    }
                }
            }
            else {
                let u = a.a;
                let v = a.b;
                if (this.ms) {
                    u = this.m0 + this.m2 * u;
                    v = this.m1 + this.mz * v;
                }
                let w = truncate((this.ng + this.ni * (u - this.nk) / this.nm));
                let x = truncate((this.nh + this.nf * (v - this.nl) / this.nj));
                w = truncate(Math.floor(w));
                x = truncate(Math.floor(x));
                if (this.mr) {
                    let y = w - g;
                    let z = w + g;
                    let aa = x + g;
                    let ab = x - g;
                    let ac = ((z - y) + 1) * ((aa - ab) + 1);
                    let ad = b / ac;
                    let ae = ad;
                    for (let af = y; af <= z; af++) {
                        for (let ag = ab; ag <= aa; ag++) {
                            this.ot(f, af, ag, ad, ae);
                        }
                    }
                }
                else {
                    this.ot(f, w, x, b, 1);
                }
            }
        }
        nz(a, b) {
            return truncate((Math.floor(255 * b))) << 24 | truncate(Math.floor(b * (this.nb + a * this.ne))) << 16 | truncate(Math.floor(b * (this.na + a * this.nd))) << 8 | truncate(Math.floor(b * (this.m9 + a * this.nc)));
        }
        n0(a) {
            return 255 << 24 | truncate(Math.floor((this.nb + a * this.ne))) << 16 | truncate(Math.floor((this.na + a * this.nd))) << 8 | truncate(Math.floor((this.m9 + a * this.nc)));
        }
        nn(a) {
            return (a >> 24 & 255) / 255;
        }
        ot(a, b, c, d, e) {
            if (b < 0 || b >= this.nu || c < 0 || c >= this.nt) {
                return;
            }
            let f = (c * this.nu) + b;
            this.md[f] = this.md[f] + d;
            this.ma[f] = this.ma[f] + e;
            if (this.mt) {
                this._itemIndexes[f] = a + 1;
            }
            this.nx += truncate(d);
        }
        or() {
            let a = 0;
            let b = 0;
            let c = this.m5;
            let d = this.m4;
            let e = this.m3;
            let f = this.md.length;
            let g = this.md;
            let h = this.ma;
            let i = this.mc;
            let j = NaN;
            let k = NaN;
            let l = 0;
            let m = 0;
            for (let n = 0; n < f; n++) {
                a = g[n];
                if (a != 0) {
                    b = h[n];
                    if (a >= e) {
                        a = 1;
                    }
                    else if (a <= d) {
                        a = 0;
                    }
                    else {
                        a = (a - d) / (c);
                    }
                    if (b > 1) {
                        b = 1;
                    }
                    if (b < 0.2) {
                        b = 0.2;
                    }
                    if (j != a || k != b) {
                        l = this.nz(a, b);
                        j = a;
                        k = b;
                    }
                    i[m] = l >> 16 & 255;
                    i[m + 1] = l >> 8 & 255;
                    i[m + 2] = l & 255;
                    i[m + 3] = l >> 24 & 255;
                }
                m += 4;
            }
        }
        ok(a) {
            let b = a;
            b.b3();
        }
        bf() {
            return new HighDensityScatterSeriesView(this);
        }
        i2(a) {
            super.i2(a);
            this.me = a;
        }
        an(a) {
            if (a != null && a == this.mh && this.mo != null) {
                return new AxisRange(this.mo.minimum, this.mo.maximum);
            }
            if (a != null && a == this.mj && this.mq != null) {
                return new AxisRange(this.mq.minimum, this.mq.maximum);
            }
            return null;
        }
        j0(a, b) {
            if (this.bs != null) {
                let c = this.getEffectiveViewport1(this.bi);
                this.ms = !c.isEmpty;
            }
            this.jl(false);
        }
        j1(a, b) {
            this.jl(false);
        }
        fp(a) {
            if (!this.mt || this._itemIndexes == null || this.bs == null || this.bz == null || this._itemIndexes.length != (this.nu * this.nt)) {
                return null;
            }
            let b = this.bs.n2;
            let c = (a.x - b.left) / b.width;
            let d = (a.y - b.top) / b.height;
            let e = truncate(Math.round(this.l8.left + (this.l8.width * c)));
            let f = truncate(Math.round(this.l8.top + (this.l8.height * d)));
            let g = this.n3(e, f);
            if (g < 0 || g > this._itemIndexes.length - 1) {
                return null;
            }
            let h = this._itemIndexes[g] - 1;
            if (h < 0 || h > this.bz.count) {
                return null;
            }
            return this.bz.item(h);
        }
        n3(a, b) {
            let c = (this.nu * b) + a;
            if (c > 0 && c < this._itemIndexes.length && this._itemIndexes[c] > 0) {
                return c;
            }
            let d = 1;
            c = (this.nu * (b - d)) + a;
            if (c > 0 && c < this._itemIndexes.length && this._itemIndexes[c] > 0) {
                return c;
            }
            c = (this.nu * (b + d)) + a;
            if (c > 0 && c < this._itemIndexes.length && this._itemIndexes[c] > 0) {
                return c;
            }
            c = (this.nu * (b)) + a - 1;
            if (c > 0 && c < this._itemIndexes.length && this._itemIndexes[c] > 0) {
                return c;
            }
            c = (this.nu * (b)) + a + 1;
            if (c > 0 && c < this._itemIndexes.length && this._itemIndexes[c] > 0) {
                return c;
            }
            c = (this.nu * (b - d)) + a - 1;
            if (c > 0 && c < this._itemIndexes.length && this._itemIndexes[c] > 0) {
                return c;
            }
            c = (this.nu * (b + d)) + a + 1;
            if (c > 0 && c < this._itemIndexes.length && this._itemIndexes[c] > 0) {
                return c;
            }
            c = (this.nu * (b - d)) + a + 1;
            if (c > 0 && c < this._itemIndexes.length && this._itemIndexes[c] > 0) {
                return c;
            }
            c = (this.nu * (b + d)) + a - 1;
            if (c > 0 && c < this._itemIndexes.length && this._itemIndexes[c] > 0) {
                return c;
            }
            return 0;
        }
        ow(a, b, c) {
            this.mc = a;
            this.nu = b;
            this.nt = c;
        }
        get_dq() {
            return true;
        }
        set_dq(a) {
            super.set_dq(a);
        }
        h3(a, b) {
            super.h3(a, b);
            this.me.b4();
            if (this.bh != null) {
                this.bh.b4();
            }
            this.it();
        }
        jn(a, b) {
            super.jn(a, b);
            if (!this.dl) {
                this.bi.az(b);
                return;
            }
            this.bi.az(b);
            if (this.cc(this.bh)) {
                return;
            }
            let c = typeCast(HighDensityScatterSeriesView.$, this.bh);
            let d = new ScatterFrame();
            this.oo(false, c);
            this.dl = false;
        }
        jk(a, b, c, d, e) {
            super.jk(a, b, c, d, e);
            let f = this.a0.a$h.item(d);
            let g = f;
            f.ay(c);
            if (this.cc(g)) {
                return;
            }
            if (this.mm == null) {
                this.mm = new ScatterFrame();
            }
            this.oo(false, f);
        }
        h1() {
            super.h1();
            this.mh = null;
            this.mj = null;
        }
    }
    HighDensityScatterSeries.$t = /*@__PURE__*/ markType(HighDensityScatterSeries, 'HighDensityScatterSeries', Series.$);
    HighDensityScatterSeries.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, HighDensityScatterSeries, 'raisePropertyChanged', ['HeatMaximumColor:o9:oy', [Color.$, null], 'HeatMaximum:no:oz', [1, 50], 'HeatMinimumColor:pa:o0', [Color.$, null], 'HeatMinimum:np:o1', [1, 0], 'PointExtent:n1:o2', [1, 1], 'ProgressiveLoad:mw:o3', [0, true], 'UseBruteForce:mx:o4', [0, false], 'XAxis:mh:o5', [NumericXAxis.$, null], 'XMemberPath:od:o6', [2, null], 'YAxis:mj:o7', [NumericYAxis.$, null], 'YMemberPath:oh:o8', [2, null]]);
    return HighDensityScatterSeries;
})();
/**
 * @hidden
 */
export let HighDensityScatterSeriesView = /*@__PURE__*/ (() => {
    class HighDensityScatterSeriesView extends SeriesView {
        constructor(a) {
            super(a);
            this.bw = null;
            this.bu = null;
            this.b2 = 0;
            this.b1 = 0;
            this.bz = null;
            this.b0 = null;
            this.bx = null;
            this.bw = a;
        }
        ap() {
            super.ap();
            if (!this.n) {
                this.e.eu = 4;
                this.bw.pa = Color.u(255, 0, 0, 0);
                this.bw.o9 = Color.u(255, 255, 0, 0);
            }
        }
        b7() {
            this.bw.ow(this.bu, this.b2, this.b1);
        }
        b3() {
            if (this.bz == null) {
                this.bz = this.e.e4.createElement("canvas");
                let a = this.e.e4.get2DCanvasContext(this.bz);
                this.bx = new RenderingContext(new CanvasViewRenderer(), a);
            }
            let b;
            if (this.m) {
                b = this.br;
            }
            else {
                b = this.e.bs.n7();
            }
            let c = truncate(Math.round(b.left));
            let d = truncate(Math.round(b.top));
            let e = truncate(Math.round(b.width));
            let f = truncate(Math.round(b.height));
            let g = this.b2;
            let h = this.b1;
            this.b2 = e;
            this.b1 = f;
            if (g != this.b2 || h != this.b1 || this.bu == null) {
                this.bz.setAttribute("width", e.toString());
                this.bz.setAttribute("height", f.toString());
                this.b0 = this.bx.g().getImageData(0, 0, e, f);
                let imageDataArray_ = this.b0.data;
                this.bu = imageDataArray_;
            }
            this.bw.ow(this.bu, this.b2, this.b1);
        }
        bv() {
            return this.bu;
        }
        b6() {
            let a = truncate(Math.round(this.br.left));
            let b = truncate(Math.round(this.br.left));
            let c = truncate(Math.round(this.br.width));
            let d = truncate(Math.round(this.br.height));
            this.bx.g().putImageData(this.b0, 0, 0);
            this.an();
        }
        b5(a) {
            if (this.e.e4 != null) {
                this.e.e4.setTimeout(a, 0);
            }
            else {
                window.setTimeout(a, 0);
            }
        }
        a3(a, b) {
            super.a3(a, b);
            if (b) {
                if (!this.bw.c7) {
                    return;
                }
                let c = new Rectangle();
                c.n = this.br.left;
                c.o = this.br.top;
                c.width = this.br.width;
                c.height = this.br.height;
                c._fill = this.bl();
                a.v(c);
                return;
            }
            if (this.bz == null) {
                return;
            }
            let d = truncate(Math.round(this.br.left));
            let e = truncate(Math.round(this.br.top));
            let f = truncate(Math.round(this.br.width));
            let g = truncate(Math.round(this.br.height));
            this.h.n(this.bz.getNativeElement(), this.e._opacity, d, e, f, g, d, e, f, g);
        }
        by(a, b) {
            return Color.e(toNullable(Color.$, a), toNullable(Color.$, null)) && Color.e(toNullable(Color.$, b), toNullable(Color.$, null));
        }
        b4() {
            if (this.bu != null) {
                for (let a = 0; a < this.bu.length; a++) {
                    this.bu[a] = 0;
                }
                this.b6();
            }
        }
        ai(a) {
            super.ai(a);
            if (this.bu == null) {
                this.e.a2.exportSeriesPixelsData(a, null, this.b2, this.b1);
                return;
            }
            let b = new Array(intDivide(this.bu.length, 4));
            let c;
            for (let d = 0; d < intDivide(this.bu.length, 4); d++) {
                c = d * 4;
                b[d] = this.bu[c + 3] << 24 | this.bu[c] << 16 | this.bu[c + 1] << 8 | this.bu[c + 2];
            }
            this.e.a2.exportSeriesPixelsData(a, b, this.b2, this.b1);
        }
    }
    HighDensityScatterSeriesView.$t = /*@__PURE__*/ markType(HighDensityScatterSeriesView, 'HighDensityScatterSeriesView', SeriesView.$);
    return HighDensityScatterSeriesView;
})();
//# sourceMappingURL=HighDensityScatterSeries_combined.js.map
