/*
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 { ShapeSeriesBase } from "./ShapeSeriesBase";
import { ShapeAxisInfoCache } from "./ShapeAxisInfoCache";
import { StyleSelector } from "./StyleSelector";
import { DependencyProperty } from "igniteui-react-core";
import { Style } from "igniteui-react-core";
import { MarkerType_$type } from "./MarkerType";
import { DataTemplate } from "igniteui-react-core";
import { Brush } from "igniteui-react-core";
import { CollisionAvoidanceType_$type } from "./CollisionAvoidanceType";
import { Rect } from "igniteui-react-core";
import { ScalerParams } from "./ScalerParams";
import { Base, enumGetBox, typeCast, fromEnum, markType, markDep, PointUtil, runOn } from "igniteui-react-core";
import { Dictionary$2 } from "igniteui-react-core";
import { OwnedPoint } from "./OwnedPoint";
import { ShapeSeriesViewBase } from "./ShapeSeriesViewBase";
import { MarkerSeries } from "./MarkerSeries";
import { DataContext } from "igniteui-react-core";
import { Marker } from "./Marker";
import { HashPool$2 } from "igniteui-react-core";
import { List$1 } from "igniteui-react-core";
import { SeriesPointOfInterest } from "./SeriesPointOfInterest";
import { RectUtil } from "igniteui-react-core";
import { PropertyMetadata } from "igniteui-react-core";
import { DeviceUtils } from "igniteui-react-core";
import { NumericMarkerManager } from "./NumericMarkerManager";
import { DataTemplateMeasureInfo } from "igniteui-react-core";
import { Size } from "igniteui-react-core";
import { DataTemplatePassInfo } from "igniteui-react-core";
import { DataTemplateRenderInfo } from "igniteui-react-core";
import { MarkerVisualData } from "./MarkerVisualData";
import { isNaN_, isInfinity } from "igniteui-react-core";
import { stringIsNullOrEmpty } from "igniteui-react-core";
/**
 * @hidden
 */
export let ScatterPolygonSeries = /*@__PURE__*/ (() => {
    class ScatterPolygonSeries extends ShapeSeriesBase {
        constructor() {
            super();
            this.nt = null;
            this.nq = new ScalerParams(1, ScatterPolygonSeries.os, ScatterPolygonSeries.os, false);
            this.nr = new ScalerParams(1, ScatterPolygonSeries.os, ScatterPolygonSeries.os, false);
            this.ab = ScatterPolygonSeries.$;
        }
        ms() {
            return this.nv();
        }
        nb(a) {
            let b = a;
            b.cn(this.ou);
            b.co(this.nu);
            super.nb(a);
            if (this.cc(a)) {
                return;
            }
            let c, d;
            let e = a.getViewInfo(c, d);
            c = e.p0;
            d = e.p1;
            let f = this.getEffectiveViewport1(a);
            this.nq = new ScalerParams(1, d, c, this.mg.ca);
            this.nq.c = f;
            this.nr = new ScalerParams(1, d, c, this.mi.ca);
            this.nr.c = f;
            if (c.width < 1 || c.height < 1) {
                return;
            }
            this.nt = ((() => {
                let $ret = new ShapeAxisInfoCache();
                $ret.a = this.mg;
                $ret.b = this.mi;
                $ret.e = this.mg.ca;
                $ret.f = this.mi.ca;
                $ret.d = this.bz;
                $ret.c = this.ml;
                return $ret;
            })());
            if (this.nv()) {
                let g = new Dictionary$2(Base.$, OwnedPoint.$, 0);
                b.c5.l(g, 400, d, c, this.eu);
                b.c5.j(g, false);
            }
        }
        nv() {
            return this.oa != null && ((this.np != 1 && this.np != 0) || this.ob != null);
        }
        bf() {
            return new ScatterPolygonSeriesView(this);
        }
        i2(a) {
            super.i2(a);
            this.ns = a;
        }
        get_hasMarkers() {
            return true;
        }
        lg() {
            return this.oo;
        }
        lh() {
            return this.op;
        }
        j7() {
            return this.oa;
        }
        jw() {
            super.jw();
            if (this.ob != null) {
                this.ns.dd();
            }
            else {
                let a = MarkerSeries.mc(this, this.np);
                let b = MarkerSeries.ml(a);
                if (b == null) {
                    this.oa = MarkerSeries.mx;
                }
                else {
                    this.ns.da(b);
                }
            }
            if (this.oq != null) {
                this.ns.db();
            }
            else {
                this.oo = this.bs == null ? null : this.bs.nk(this.fh);
            }
            if (this.or != null) {
                this.ns.dc();
            }
            else {
                this.op = this.bs == null ? null : this.bs.nl(this.fh);
            }
        }
        i7(a, b, c, d) {
            super.i7(a, b, c, d);
            switch (b) {
                case ScatterPolygonSeries.$$p[3]:
                case ScatterPolygonSeries.$$p[9]:
                case ScatterPolygonSeries.$$p[5]:
                case ScatterPolygonSeries.$$p[7]:
                case ScatterPolygonSeries.$$p[8]:
                    this.jw();
                    this.jl(false);
                    break;
                case ScatterPolygonSeries.$$p[2]:
                    if (c == MarkerSeries.mx || d == MarkerSeries.mx || (c == null || d != null)) {
                        this.ns.df();
                        this.jl(false);
                    }
                    this.jl(false);
                    this.it();
                    break;
                case ScatterPolygonSeries.$$p[10]:
                    this.ns.cn(this.ou);
                    this.jl(false);
                    this.it();
                    break;
                case ScatterPolygonSeries.$$p[11]:
                    this.ns.co(this.nu);
                    this.jl(false);
                    this.it();
                    break;
                case ScatterPolygonSeries.$$p[4]:
                    this.jl(false);
                    this.it();
                    break;
            }
        }
        ar(a, b) {
            let c = this.ns.c2(a);
            let d = null;
            if (c != null) {
                d = c.content;
            }
            if (d != null) {
                return d;
            }
            return super.ar(a, b);
        }
        n9(a, b) {
            let c = new List$1(Base.$, 0);
            for (let d of fromEnum(b.c)) {
                if (!a.containsKey(d)) {
                    c.add1(d);
                }
            }
            for (let e of fromEnum(c)) {
                b.g(e);
            }
        }
        ch(a, b, c) {
            if (!this.hasMarkers) {
                return false;
            }
            let d = this.mg;
            let e = new ScalerParams(1, this.bs.n2, this.l8, d.ca);
            e.c = this.getEffectiveViewport1(this.bi);
            let f = this.mi;
            let g = new ScalerParams(1, this.bs.n2, this.l8, f.ca);
            g.c = this.getEffectiveViewport1(this.bi);
            a.clear();
            this.ns.de((h) => {
                if (h._visibility == 0) {
                    let i = new SeriesPointOfInterest();
                    let j = h.n;
                    let k = h.o;
                    if (j < this.l8.left || j > this.l8.right || k < this.l8.top || k > this.l8.bottom) {
                        return;
                    }
                    i.b = d.d1(j, e);
                    i.c = f.d1(k, g);
                    i.a = h.content;
                    a.add(i);
                }
            });
            return true;
        }
        nn(a, b, c, d, e) {
            if (c == null || c.length != this.nt.d.count) {
                c = new Array(this.nt.d.count);
                for (let f = 0; f < this.nt.d.count; f++) {
                    c[f] = PointUtil.create();
                }
            }
            let g = ((() => {
                let $ret = new ScalerParams(1, d, e, this.mg.ca);
                $ret.c = this.getEffectiveViewport1(a);
                return $ret;
            })());
            let h = ((() => {
                let $ret = new ScalerParams(1, d, e, this.mi.ca);
                $ret.c = this.getEffectiveViewport1(a);
                return $ret;
            })());
            let i = this.l0(a);
            let j = this.nt.a.d1(i.left, g);
            let k = this.nt.a.d1(i.right, g);
            let l = this.nt.b.d1(i.bottom, h);
            let m = this.nt.b.d1(i.top, h);
            if (this.nt.e) {
                let n = j;
                j = k;
                k = n;
            }
            if (this.nt.f) {
                let o = l;
                l = m;
                m = o;
            }
            let p = this.nt;
            let q = p.a;
            let r = p.b;
            let s;
            let t;
            let u = g.d.left;
            let v = g.d.right;
            let w = h.d.top;
            let x = h.d.bottom;
            for (let y = 0; y < this.nt.d.count; y++) {
                s = 0;
                t = 0;
                let z = null;
                let aa = a.b3.tryGetValue(y, z);
                z = aa.p1;
                if (z == null) {
                    c[y].x = NaN;
                    c[y].y = NaN;
                }
                else {
                    let ab = z.c;
                    let ac = RectUtil.l(ab);
                    s = ac.x;
                    t = ac.y;
                    if (s >= u && s <= v && t >= w && t <= x) {
                        c[y].x = s;
                        c[y].y = t;
                    }
                    else {
                        c[y].x = NaN;
                        c[y].y = NaN;
                    }
                }
            }
            return c;
        }
        nm(a, b) {
            if (b == null || b.length != a.e) {
                b = new Array(a.e);
            }
            let c = 0;
            let d = this.bz;
            for (let e of fromEnum(a.c)) {
                b[c] = d.indexOf(e);
                c++;
            }
            return b;
        }
    }
    ScatterPolygonSeries.$t = /*@__PURE__*/ markType(ScatterPolygonSeries, 'ScatterPolygonSeries', ShapeSeriesBase.$);
    ScatterPolygonSeries.os = /*@__PURE__*/ new Rect(0, 0, 0, 1, 1);
    ScatterPolygonSeries.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, ScatterPolygonSeries, 'raisePropertyChanged', ['ActualMarkerBrush:oo:oc', [Brush.$], 'ActualMarkerOutline:op:od', [Brush.$], 'ActualMarkerTemplate:oa:oe', [DataTemplate.$, null], 'MarkerBrush:oq:of', [Brush.$], 'MarkerCollisionAvoidance:no:og', [CollisionAvoidanceType_$type, /*@__PURE__*/ enumGetBox(CollisionAvoidanceType_$type, 0)], 'MarkerOutline:or:oh', [Brush.$], 'MarkerStyle:ot:oi', [Style.$], 'MarkerTemplate:ob:oj', [DataTemplate.$, null], 'MarkerThickness:nw:ok', [1, /*@__PURE__*/ DeviceUtils.g(2)], 'MarkerType:np:ol', [MarkerType_$type, /*@__PURE__*/ enumGetBox(MarkerType_$type, 1)], 'ShapeStyle:ou:om', [Style.$, null], 'ShapeStyleSelector:nu:on', [StyleSelector.$, null]]);
    return ScatterPolygonSeries;
})();
/**
 * @hidden
 */
export let ScatterPolygonSeriesView = /*@__PURE__*/ (() => {
    class ScatterPolygonSeriesView extends ShapeSeriesViewBase {
        constructor(a) {
            super(a);
            this.c1 = null;
            this.c0 = null;
            this.c6 = null;
            this.c4 = null;
            this.c8 = false;
            this.c7 = null;
            this.c9 = null;
            this.dm = null;
            this.c6 = a;
            this.c7 = new HashPool$2(Base.$, Marker.$);
            this.c9 = new List$1(Marker.$, 0);
            this.dg(this.c7);
            this.c4 = new NumericMarkerManager(1, (b) => this.c7.item(b), (b) => this.c6.nt.d.item(b), runOn(this, this.dk), runOn(this, this.cz), runOn(this, this.cy), () => this.c6.no);
            this.c4.q = runOn(this, this.dn);
        }
        ap() {
            super.ap();
            if (!this.n) {
                this.e.bj = 8;
            }
        }
        get c5() {
            return this.c4;
        }
        dk(a) {
            this.c6.n9(a, this.c7);
        }
        cz() {
            this.c1 = this.c6.nn(this, this.c7, this.c1, this.bs, this.br);
            return this.c1;
        }
        cy() {
            this.c0 = this.c6.nm(this.c7, this.c0);
            return this.c0;
        }
        cu(a, b) {
            return this.cv(a, b, true);
        }
        cc(a, b) {
            super.cc(a, b);
            ShapeSeriesViewBase.cb(this, a, b);
        }
        ca(a, b) {
            let c = a;
            if (c == null) {
                return;
            }
            c.ak = b;
        }
        de(a) {
            this.c7.f(a);
        }
        dg(a) {
            a.create = runOn(this, this.c3);
            a.destroy = runOn(this, this.di);
            a.activate = runOn(this, this.dh);
            a.disactivate = runOn(this, this.dj);
        }
        c3() {
            let a = new Marker();
            if (!this.c8) {
                a.content = ((() => {
                    let $ret = new DataContext();
                    $ret.series = this.e;
                    return $ret;
                })());
            }
            a.ah = this.e.oa;
            this.c9.add(a);
            return a;
        }
        di(a) {
            a.content = null;
            this.c9.remove(a);
        }
        dh(a) {
            a._visibility = 0;
        }
        dj(a) {
            if (a.content != null) {
                (typeCast(DataContext.$, a.content)).item = null;
            }
            a._visibility = 1;
        }
        dl(a) {
            this.c8 = a;
        }
        be(a, b) {
            super.be(a, b);
            let c = a;
            let d = c.content;
            if (d != null) {
                if (this.c6.oo != null) {
                    d.actualItemBrush = this.c6.oo;
                }
                else {
                    d.actualItemBrush = this.by.lb;
                }
                if (this.c6.oo != null) {
                    d.outline = this.c6.op;
                }
                else {
                    d.outline = this.by.lc;
                }
                d.thickness = 0.5;
            }
        }
        bf(a, b) {
            super.bf(a, b);
            let c = a;
            let d = this.bm(b);
            let e = c.content;
            if (e != null) {
                e.actualItemBrush = d;
                e.outline = d;
                e.thickness = 1 + 3;
            }
        }
        a2(a, b) {
            super.a2(a, b);
            let c = new DataTemplatePassInfo();
            c.isHitTestRender = b;
            c.context = a.g();
            c.viewportTop = this.br.top;
            c.viewportLeft = this.br.left;
            c.viewportWidth = this.br.width;
            c.viewportHeight = this.br.height;
            c.passID = "Markers";
            let d = new DataTemplateRenderInfo();
            d.passInfo = c;
            d.isHitTestRender = b;
            let e = new DataTemplateMeasureInfo();
            e.passInfo = c;
            let f = false;
            let g = a.g();
            e.context = g;
            d.context = g;
            let h = 0;
            let i = 0;
            if (this.c6.oa != null && this.c6.oa.passStarting != null) {
                this.c6.oa.passStarting(c);
            }
            for (let j = 0; j < this.c9.count; j++) {
                let k = this.c9._inner[j];
                if (k._visibility == 1) {
                    continue;
                }
                this.bd(k, j, b);
                if (!f) {
                    e.width = k.width;
                    e.height = k.height;
                    e.renderOffsetX = 0;
                    e.renderOffsetY = 0;
                    e.renderContext = a;
                    let l = k.ah;
                    if (l.measure != null) {
                        e.data = k.content;
                        l.measure(e);
                        f = e.isConstant;
                        if (f) {
                            h = e.width;
                            i = e.height;
                        }
                    }
                    d.availableWidth = e.width;
                    d.availableHeight = e.height;
                    d.renderOffsetX = e.renderOffsetX;
                    d.renderOffsetY = e.renderOffsetY;
                    d.renderContext = a;
                }
                else {
                    d.availableWidth = h;
                    d.availableHeight = i;
                }
                if (!isNaN_(k.width) && !isInfinity(k.width)) {
                    d.availableWidth = k.width;
                }
                if (!isNaN_(k.height) && !isInfinity(k.height)) {
                    d.availableHeight = k.height;
                }
                a.p(d, k);
                k.m = d.availableWidth;
                k.l = d.availableHeight;
                k.ai = d.renderOffsetX;
                k.aj = d.renderOffsetY;
            }
            if (this.c6.oa != null && this.c6.oa.passCompleted != null) {
                this.c6.oa.passCompleted(c);
            }
        }
        dd() {
            this.c6.oa = null;
            this.c6.oa = this.c6.ob;
        }
        db() {
            this.c6.oo = null;
            this.c6.oo = this.c6.oq;
        }
        dc() {
            this.c6.op = null;
            this.c6.op = this.c6.or;
        }
        da(a) {
            switch (a) {
                case "CircleMarkerTemplate":
                    this.c6.oa = this.c6.bs.ls;
                    break;
                case "TriangleMarkerTemplate":
                    this.c6.oa = this.c6.bs.l1;
                    break;
                case "PyramidMarkerTemplate":
                    this.c6.oa = this.c6.bs.ly;
                    break;
                case "SquareMarkerTemplate":
                    this.c6.oa = this.c6.bs.lz;
                    break;
                case "DiamondMarkerTemplate":
                    this.c6.oa = this.c6.bs.lt;
                    break;
                case "PentagonMarkerTemplate":
                    this.c6.oa = this.c6.bs.lw;
                    break;
                case "HexagonMarkerTemplate":
                    this.c6.oa = this.c6.bs.lu;
                    break;
                case "TetragramMarkerTemplate":
                    this.c6.oa = this.c6.bs.lw;
                    break;
                case "PentagramMarkerTemplate":
                    this.c6.oa = this.c6.bs.lx;
                    break;
                case "HexagramMarkerTemplate":
                    this.c6.oa = this.c6.bs.lv;
                    break;
            }
        }
        df() {
            for (let a of fromEnum(this.c9)) {
                a.ah = this.c6.oa;
            }
            this.an();
        }
        dn(a) {
            if (this.dm == null) {
                this.dm = new DataTemplateMeasureInfo();
                this.dm.context = this.h.g();
            }
            this.dm.width = a.width;
            this.dm.height = a.height;
            this.dm.data = a.content;
            let b = a.ah;
            if (b.measure != null) {
                b.measure(this.dm);
            }
            return new Size(1, this.dm.width, this.dm.height);
        }
        c2(a) {
            let b;
            let c;
            let d;
            let e;
            for (let f = this.c9.count - 1; f >= 0; f--) {
                let g = this.c9._inner[f];
                if (g._visibility == 1 || g._opacity == 0) {
                    continue;
                }
                b = (g.m / 2) + 3;
                c = (g.l / 2) + 3;
                d = g.ai;
                e = g.aj;
                if ((g.n + d) - b <= a.x && (g.n + d) + b >= a.x && (g.o + e) - c <= a.y && (g.o + e) + c >= a.y) {
                    return g;
                }
            }
            return null;
        }
        ai(a) {
            let b = a;
            super.ai(b);
            for (let c of fromEnum(this.c7.c)) {
                let d = this.c7.item(c);
                if (d._visibility != 1) {
                    let e = typeCast(ScatterPolygonSeries.$, this.e);
                    let f = this.e.a2.getMarkerVisualData(e, d, e.oa);
                    b.markerShapes.add(typeCast(MarkerVisualData.$, f));
                }
            }
        }
        getDefaultTooltipTemplate() {
            let a = "<div class='ui-chart-default-tooltip-content'><span";
            let b = this.e.a0.a$q(this.e);
            if (!stringIsNullOrEmpty(b)) {
                a += " style='color:" + b + "'";
            }
            a += ">" + this.c6.fx + "</span><br/>";
            a += "</div>";
            return a;
        }
    }
    ScatterPolygonSeriesView.$t = /*@__PURE__*/ markType(ScatterPolygonSeriesView, 'ScatterPolygonSeriesView', ShapeSeriesViewBase.$);
    return ScatterPolygonSeriesView;
})();
//# sourceMappingURL=ScatterPolygonSeries_combined.js.map
