/*
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 { DependencyProperty } from "igniteui-react-core";
import { IEnumerable_$type, runOn, delegateCombine, delegateRemove, typeCast, markType, markDep } from "igniteui-react-core";
import { NumericXAxis } from "./NumericXAxis";
import { NumericYAxis } from "./NumericYAxis";
import { IFastItemsSource_$type } from "igniteui-react-core";
import { Triangulator } from "igniteui-react-core";
import { TriangulationStatusEventArgs } from "igniteui-react-core";
import { FastItemsSource } from "igniteui-react-core";
import { SeriesViewer } from "./SeriesViewer";
import { Axis } from "./Axis";
import { AxisRange } from "./AxisRange";
import { PropertyMetadata } from "igniteui-react-core";
/**
 * @hidden
 */
export let ScatterTriangulationSeries = /*@__PURE__*/ (() => {
    class ScatterTriangulationSeries extends Series {
        constructor() {
            super(...arguments);
            this.og = null;
            this.oh = null;
            this.op = false;
            this.oc = null;
            this.triangulationStatusChanged = null;
            this.os = null;
            this.od = null;
            this.oe = null;
            this.of = null;
        }
        ji() {
            super.ji();
            this.n9 = null;
            this.oa = null;
        }
        gt(a, b) {
            let c = this.ic(b);
            if (c == ScatterTriangulationSeries.$$p[6]) {
                return this.gu(a, b, this.o7);
            }
            if (c == ScatterTriangulationSeries.$$p[8]) {
                return this.gu(a, b, this.pb);
            }
            return super.gt(a, b);
        }
        get om() {
            return this.og;
        }
        set om(a) {
            let b = this.om != a;
            if (b) {
                let c = this.om;
                this.og = a;
                this.raisePropertyChanged("XColumn", c, this.om);
            }
        }
        get on() {
            return this.oh;
        }
        set on(a) {
            let b = this.on != a;
            if (b) {
                let c = this.on;
                this.oh = a;
                this.raisePropertyChanged("YColumn", c, this.on);
            }
        }
        k4(a) {
            let b = this.cd != null && this.oo == null && this.os == null && this.om != null && this.on != null && this.om.count >= 3 && this.on.count >= 3 && !this.op;
            if (b) {
                this.pf();
                this.op = true;
            }
        }
        pf() {
            this.oc = new Triangulator(this.cd.count, this.om, this.on);
            let a = this.oc;
            a.triangulationStatusChanged = delegateCombine(a.triangulationStatusChanged, runOn(this, this.pg));
            this.oc.y();
        }
        pd() {
            if (this.oc == null) {
                return;
            }
            this.oc.r();
            let a = this.oc;
            a.triangulationStatusChanged = delegateRemove(a.triangulationStatusChanged, runOn(this, this.pg));
            this.oc = null;
        }
        pg(a, b) {
            if (this.triangulationStatusChanged != null) {
                this.triangulationStatusChanged(this, new TriangulationStatusEventArgs(b.currentStatus));
            }
            if (b.currentStatus >= 100) {
                if (this.oc == null) {
                    return;
                }
                let c = this.oc;
                c.triangulationStatusChanged = delegateRemove(c.triangulationStatusChanged, runOn(this, this.pg));
                this.os = this.oc.n();
                this.oc = null;
                let d = ((() => {
                    let $ret = new FastItemsSource();
                    $ret.e = this.os;
                    return $ret;
                })());
                this.oj = this.oi(d, "v1");
                this.ok = this.oi(d, "v2");
                this.ol = this.oi(d, "v3");
                this.k3(false);
            }
        }
        oi(a, b) {
            if (b == null) {
                return a.registerColumnInt(null, null, false);
            }
            let c = null;
            let d = SeriesViewer.bu(b, this.coercionMethods);
            c = d.a;
            return a.registerColumnInt(b, c, this.expectFunctions);
        }
        kp(a, b, c, d) {
            super.kp(a, b, c, d);
            switch (b) {
                case "FastItemsSource":
                    let e = typeCast(IFastItemsSource_$type, c);
                    if (e != null) {
                        e.deregisterColumn(this.om);
                        e.deregisterColumn(this.on);
                        this.om = null;
                        this.on = null;
                    }
                    this.pe();
                    let f = typeCast(IFastItemsSource_$type, d);
                    if (f != null) {
                        this.om = this.ca(this.o7);
                        this.on = this.ca(this.pb);
                    }
                    this.k3(false);
                    break;
                case ScatterTriangulationSeries.$$p[6]:
                    if (this.cd != null) {
                        this.cd.deregisterColumn(this.om);
                        this.om = this.ca(this.o7);
                    }
                    this.pe();
                    this.k3(false);
                    this.ka();
                    break;
                case ScatterTriangulationSeries.$$p[8]:
                    if (this.cd != null) {
                        this.cd.deregisterColumn(this.on);
                        this.on = this.ca(this.pb);
                    }
                    this.pe();
                    this.k3(false);
                    this.ka();
                    break;
                case ScatterTriangulationSeries.$$p[5]:
                    if (c != null) {
                        (typeCast(Axis.$, c)).bx(this);
                    }
                    if (d != null) {
                        (typeCast(Axis.$, d)).ck(this);
                    }
                    if ((this.n9 != null && !this.n9.cn()) || (d == null && c != null)) {
                        this.k3(false);
                    }
                    this.ka();
                    break;
                case ScatterTriangulationSeries.$$p[7]:
                    if (c != null) {
                        (typeCast(Axis.$, c)).bx(this);
                    }
                    if (d != null) {
                        (typeCast(Axis.$, d)).ck(this);
                    }
                    if ((this.oa != null && !this.oa.cn()) || (d == null && c != null)) {
                        this.k3(false);
                    }
                    this.ka();
                    break;
                case ScatterTriangulationSeries.$$p[1]:
                    if (this.trianglesSource != null) {
                        this.pd();
                        this.oo = ((() => {
                            let $ret = new FastItemsSource();
                            $ret.e = this.trianglesSource;
                            return $ret;
                        })());
                    }
                    else {
                        this.oo = null;
                    }
                    break;
                case ScatterTriangulationSeries.$$p[0]:
                    let g = typeCast(IFastItemsSource_$type, c);
                    if (g != null) {
                        g.deregisterColumn(this.oj);
                        g.deregisterColumn(this.ok);
                        g.deregisterColumn(this.ol);
                        this.oj = null;
                        this.ok = null;
                        this.ol = null;
                    }
                    let h = typeCast(IFastItemsSource_$type, d);
                    if (h != null) {
                        this.oj = this.oi(h, this.oz);
                        this.ok = this.oi(h, this.o1);
                        this.ol = this.oi(h, this.o3);
                    }
                    this.k3(false);
                    this.ka();
                    break;
                case ScatterTriangulationSeries.$$p[2]:
                    if (this.oo != null) {
                        this.oo.deregisterColumn(this.oj);
                        this.oj = this.oi(this.oo, this.oz);
                    }
                    this.k3(false);
                    this.ka();
                    break;
                case ScatterTriangulationSeries.$$p[3]:
                    if (this.oo != null) {
                        this.oo.deregisterColumn(this.ok);
                        this.ok = this.oi(this.oo, this.o1);
                    }
                    this.k3(false);
                    this.ka();
                    break;
                case ScatterTriangulationSeries.$$p[4]:
                    if (this.oo != null) {
                        this.oo.deregisterColumn(this.ol);
                        this.ol = this.oi(this.oo, this.o3);
                    }
                    this.k3(false);
                    this.ka();
                    break;
                case "XColumn":
                    if (this.n9 != null) {
                        this.n9.cn();
                    }
                    break;
                case "YColumn":
                    if (this.oa != null) {
                        this.oa.cn();
                    }
                    break;
            }
        }
        or(a) {
            if (typeCast(NumericYAxis.$, a) !== null) {
                return true;
            }
            return false;
        }
        oq(a) {
            if (typeCast(NumericXAxis.$, a) !== null) {
                return true;
            }
            return false;
        }
        ec(a, b, c) {
            return super.ec(a, b, c) && this.cd != null && this.n9 != null && this.oa != null && this.n9.bh != null && this.oa.bh != null && a.width > 0 && a.height > 0 && this.oj != null && this.oj.count > 0 && this.ok != null && this.ok.count > 0 && this.ol != null && this.ol.count > 0 && this.om != null && this.om.count > 0 && this.on != null && this.on.count > 0;
        }
        pe() {
            if (this.trianglesSource == null) {
                this.os = null;
                this.oj = null;
                this.ok = null;
                this.ol = null;
                this.op = false;
            }
        }
        j2() {
            super.j2();
            if (this.n9 != null) {
                this.n9.hb();
            }
            if (this.oa != null) {
                this.oa.hb();
            }
        }
        jo(a, b, c, d) {
            super.jo(a, b, c, d);
            this.pe();
            this.k3(false);
        }
        ao(a) {
            if (a != null && a == this.n9 && this.om != null) {
                return new AxisRange(this.om.minimum, this.om.maximum);
            }
            if (a != null && a == this.oa && this.on != null) {
                return new AxisRange(this.on.minimum, this.on.maximum);
            }
            return null;
        }
        lo(a, b) {
            this.k3(false);
        }
        ln(a, b) {
            this.k3(false);
        }
        get oj() {
            return this.od;
        }
        set oj(a) {
            let b = this.oj != a;
            if (b) {
                let c = this.oj;
                this.od = a;
                this.raisePropertyChanged("TriangleVertexColumn1", c, this.oj);
            }
        }
        get ok() {
            return this.oe;
        }
        set ok(a) {
            let b = this.ok != a;
            if (b) {
                let c = this.ok;
                this.oe = a;
                this.raisePropertyChanged("TriangleVertexColumn2", c, this.ok);
            }
        }
        get ol() {
            return this.of;
        }
        set ol(a) {
            let b = this.ol != a;
            if (b) {
                let c = this.ol;
                this.of = a;
                this.raisePropertyChanged("TriangleVertexColumn3", c, this.ol);
            }
        }
        get_dk() {
            return true;
        }
    }
    ScatterTriangulationSeries.$t = /*@__PURE__*/ markType(ScatterTriangulationSeries, 'ScatterTriangulationSeries', Series.$);
    ScatterTriangulationSeries.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, ScatterTriangulationSeries, 'raisePropertyChanged', ['FastTrianglesSource:oo:ph', [IFastItemsSource_$type, null], 'TrianglesSource::pi', [IEnumerable_$type, null], 'TriangleVertexMemberPath1:oz:pj', [2, null], 'TriangleVertexMemberPath2:o1:pk', [2, null], 'TriangleVertexMemberPath3:o3:pl', [2, null], 'XAxis:n9:pm', [NumericXAxis.$, null], 'XMemberPath:o7:pn', [2, null], 'YAxis:oa:po', [NumericYAxis.$, null], 'YMemberPath:pb:pp', [2, null]]);
    return ScatterTriangulationSeries;
})();
//# sourceMappingURL=ScatterTriangulationSeries.js.map
