/*
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 } from "tslib";
import { Series } from "./Series";
import { DependencyProperty } from "igniteui-react-core";
import { IEnumerable_$type, runOn, delegateCombine, delegateRemove, typeCast, Point_$type, 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 { DataLegendSeriesValueInfo } from "igniteui-react-core";
import { DataLegendSeriesContext } from "igniteui-react-core";
import { List$1 } from "igniteui-react-core";
import { PropertyMetadata } from "igniteui-react-core";
/**
 * @hidden
 */
var ScatterTriangulationSeries = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(ScatterTriangulationSeries, _super);
    function ScatterTriangulationSeries() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.qj = null;
        _this.qk = null;
        _this.qs = false;
        _this.qf = null;
        _this.triangulationStatusChanged = null;
        _this.qv = null;
        _this.qg = null;
        _this.qh = null;
        _this.qi = null;
        return _this;
    }
    ScatterTriangulationSeries.prototype.kz = function () {
        _super.prototype.kz.call(this);
        this.qc = null;
        this.qd = null;
    };
    ScatterTriangulationSeries.prototype.h1 = function (a, b) {
        var c = this.jv(b);
        if (c == ScatterTriangulationSeries.$$p[8]) {
            return this.h2(a, b, this.re);
        }
        if (c == ScatterTriangulationSeries.$$p[12]) {
            return this.h2(a, b, this.rm);
        }
        return _super.prototype.h1.call(this, a, b);
    };
    Object.defineProperty(ScatterTriangulationSeries.prototype, "qp", {
        get: function () {
            return this.qj;
        },
        set: function (a) {
            var b = this.qp != a;
            if (b) {
                var c = this.qp;
                this.qj = a;
                this.raisePropertyChanged("XColumn", c, this.qp);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(ScatterTriangulationSeries.prototype, "qq", {
        get: function () {
            return this.qk;
        },
        set: function (a) {
            var b = this.qq != a;
            if (b) {
                var c = this.qq;
                this.qk = a;
                this.raisePropertyChanged("YColumn", c, this.qq);
            }
        },
        enumerable: false,
        configurable: true
    });
    ScatterTriangulationSeries.prototype.mo = function (a) {
        var b = this.cl != null && this.qr == null && this.qv == null && this.qp != null && this.qq != null && this.qp.count >= 3 && this.qq.count >= 3 && !this.qs;
        if (b) {
            this.rq();
            this.qs = true;
        }
    };
    ScatterTriangulationSeries.prototype.rq = function () {
        this.qf = new Triangulator(this.cl.count, this.qp, this.qq);
        var a = this.qf;
        a.triangulationStatusChanged = delegateCombine(a.triangulationStatusChanged, runOn(this, this.rr));
        this.qf.y();
    };
    ScatterTriangulationSeries.prototype.ro = function () {
        if (this.qf == null) {
            return;
        }
        this.qf.r();
        var a = this.qf;
        a.triangulationStatusChanged = delegateRemove(a.triangulationStatusChanged, runOn(this, this.rr));
        this.qf = null;
    };
    ScatterTriangulationSeries.prototype.rr = function (a, b) {
        var _this = this;
        if (this.triangulationStatusChanged != null) {
            this.triangulationStatusChanged(this, new TriangulationStatusEventArgs(b.currentStatus));
        }
        if (b.currentStatus >= 100) {
            if (this.qf == null) {
                return;
            }
            var c = this.qf;
            c.triangulationStatusChanged = delegateRemove(c.triangulationStatusChanged, runOn(this, this.rr));
            this.qv = this.qf.n();
            this.qf = null;
            var d = ((function () {
                var $ret = new FastItemsSource();
                $ret.e = _this.qv;
                return $ret;
            })());
            this.qm = this.ql(d, "v1");
            this.qn = this.ql(d, "v2");
            this.qo = this.ql(d, "v3");
            this.mn(false);
        }
    };
    ScatterTriangulationSeries.prototype.ql = function (a, b) {
        if (b == null) {
            return a.registerColumnInt(null, null, false);
        }
        var c = null;
        var d = SeriesViewer.cg(b, this.coercionMethods);
        c = d.a;
        return a.registerColumnInt(b, c, this.expectFunctions);
    };
    ScatterTriangulationSeries.prototype.l9 = function (a, b, c, d) {
        var _this = this;
        _super.prototype.l9.call(this, a, b, c, d);
        switch (b) {
            case "FastItemsSource":
                var e = typeCast(IFastItemsSource_$type, c);
                if (e != null) {
                    e.deregisterColumn(this.qp);
                    e.deregisterColumn(this.qq);
                    this.qp = null;
                    this.qq = null;
                }
                this.rp();
                var f = typeCast(IFastItemsSource_$type, d);
                if (f != null) {
                    this.qp = this.ci(this.re);
                    this.qq = this.ci(this.rm);
                }
                this.mn(false);
                break;
            case ScatterTriangulationSeries.$$p[8]:
                if (this.cl != null) {
                    this.cl.deregisterColumn(this.qp);
                    this.qp = this.ci(this.re);
                }
                this.rp();
                this.mn(false);
                this.lu();
                break;
            case ScatterTriangulationSeries.$$p[12]:
                if (this.cl != null) {
                    this.cl.deregisterColumn(this.qq);
                    this.qq = this.ci(this.rm);
                }
                this.rp();
                this.mn(false);
                this.lu();
                break;
            case ScatterTriangulationSeries.$$p[5]:
                if (c != null) {
                    (typeCast(Axis.$, c)).b0(this);
                }
                if (d != null) {
                    (typeCast(Axis.$, d)).ct(this);
                }
                if ((this.qc != null && !this.qc.c1()) || (d == null && c != null)) {
                    this.mn(false);
                }
                this.lu();
                break;
            case ScatterTriangulationSeries.$$p[9]:
                if (c != null) {
                    (typeCast(Axis.$, c)).b0(this);
                }
                if (d != null) {
                    (typeCast(Axis.$, d)).ct(this);
                }
                if ((this.qd != null && !this.qd.c1()) || (d == null && c != null)) {
                    this.mn(false);
                }
                this.lu();
                break;
            case ScatterTriangulationSeries.$$p[1]:
                if (this.trianglesSource != null) {
                    this.ro();
                    this.qr = ((function () {
                        var $ret = new FastItemsSource();
                        $ret.e = _this.trianglesSource;
                        return $ret;
                    })());
                }
                else {
                    this.qr = null;
                }
                break;
            case ScatterTriangulationSeries.$$p[0]:
                var g = typeCast(IFastItemsSource_$type, c);
                if (g != null) {
                    g.deregisterColumn(this.qm);
                    g.deregisterColumn(this.qn);
                    g.deregisterColumn(this.qo);
                    this.qm = null;
                    this.qn = null;
                    this.qo = null;
                }
                var h = typeCast(IFastItemsSource_$type, d);
                if (h != null) {
                    this.qm = this.ql(h, this.q2);
                    this.qn = this.ql(h, this.q4);
                    this.qo = this.ql(h, this.q6);
                }
                this.mn(false);
                this.lu();
                break;
            case ScatterTriangulationSeries.$$p[2]:
                if (this.qr != null) {
                    this.qr.deregisterColumn(this.qm);
                    this.qm = this.ql(this.qr, this.q2);
                }
                this.mn(false);
                this.lu();
                break;
            case ScatterTriangulationSeries.$$p[3]:
                if (this.qr != null) {
                    this.qr.deregisterColumn(this.qn);
                    this.qn = this.ql(this.qr, this.q4);
                }
                this.mn(false);
                this.lu();
                break;
            case ScatterTriangulationSeries.$$p[4]:
                if (this.qr != null) {
                    this.qr.deregisterColumn(this.qo);
                    this.qo = this.ql(this.qr, this.q6);
                }
                this.mn(false);
                this.lu();
                break;
            case "XColumn":
                if (this.qc != null) {
                    this.qc.c1();
                }
                break;
            case "YColumn":
                if (this.qd != null) {
                    this.qd.c1();
                }
                break;
        }
    };
    ScatterTriangulationSeries.prototype.qu = function (a) {
        if (typeCast(NumericYAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    ScatterTriangulationSeries.prototype.qt = function (a) {
        if (typeCast(NumericXAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    ScatterTriangulationSeries.prototype.fd = function (a, b, c) {
        return _super.prototype.fd.call(this, a, b, c) && this.cl != null && this.qc != null && this.qd != null && this.qc.bi != null && this.qd.bi != null && a.width > 0 && a.height > 0 && this.qm != null && this.qm.count > 0 && this.qn != null && this.qn.count > 0 && this.qo != null && this.qo.count > 0 && this.qp != null && this.qp.count > 0 && this.qq != null && this.qq.count > 0;
    };
    ScatterTriangulationSeries.prototype.rp = function () {
        if (this.trianglesSource == null) {
            this.qv = null;
            this.qm = null;
            this.qn = null;
            this.qo = null;
            this.qs = false;
        }
    };
    ScatterTriangulationSeries.prototype.lk = function () {
        _super.prototype.lk.call(this);
        if (this.qc != null) {
            this.qc.h7();
        }
        if (this.qd != null) {
            this.qd.h7();
        }
    };
    ScatterTriangulationSeries.prototype.k5 = function (a, b, c, d) {
        _super.prototype.k5.call(this, a, b, c, d);
        this.rp();
        this.mn(false);
    };
    ScatterTriangulationSeries.prototype.aq = function (a) {
        if (a != null && a == this.qc && this.qp != null) {
            return new AxisRange(this.qp.minimum, this.qp.maximum);
        }
        if (a != null && a == this.qd && this.qq != null) {
            return new AxisRange(this.qq.minimum, this.qq.maximum);
        }
        return null;
    };
    ScatterTriangulationSeries.prototype.nb = function (a, b) {
        this.mn(false);
    };
    ScatterTriangulationSeries.prototype.na = function (a, b) {
        this.mn(false);
    };
    Object.defineProperty(ScatterTriangulationSeries.prototype, "qm", {
        get: function () {
            return this.qg;
        },
        set: function (a) {
            var b = this.qm != a;
            if (b) {
                var c = this.qm;
                this.qg = a;
                this.raisePropertyChanged("TriangleVertexColumn1", c, this.qm);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(ScatterTriangulationSeries.prototype, "qn", {
        get: function () {
            return this.qh;
        },
        set: function (a) {
            var b = this.qn != a;
            if (b) {
                var c = this.qn;
                this.qh = a;
                this.raisePropertyChanged("TriangleVertexColumn2", c, this.qn);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(ScatterTriangulationSeries.prototype, "qo", {
        get: function () {
            return this.qi;
        },
        set: function (a) {
            var b = this.qo != a;
            if (b) {
                var c = this.qo;
                this.qi = a;
                this.raisePropertyChanged("TriangleVertexColumn3", c, this.qo);
            }
        },
        enumerable: false,
        configurable: true
    });
    ScatterTriangulationSeries.prototype.get_eg = function () {
        return true;
    };
    ScatterTriangulationSeries.prototype.get_d5 = function () {
        return true;
    };
    ScatterTriangulationSeries.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.re != null ? this.re : "X";
        g.r = this.ra != null ? this.ra : "X:";
        g.s = this.rc != null ? this.rc : "";
        var h = new DataLegendSeriesValueInfo();
        h.l = f;
        h.a = 14;
        h.p = "Y";
        h.q = this.rm != null ? this.rm : "Y";
        h.r = this.ri != null ? this.ri : "Y:";
        h.s = this.rk != null ? this.rk : "";
        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;
    };
    ScatterTriangulationSeries.$t = markType(ScatterTriangulationSeries, 'ScatterTriangulationSeries', Series.$);
    ScatterTriangulationSeries.$$p = markDep(DependencyProperty, PropertyMetadata, ScatterTriangulationSeries, 'raisePropertyChanged', ['FastTrianglesSource:qr:rs', [IFastItemsSource_$type, null], 'TrianglesSource::rt', [IEnumerable_$type, null], 'TriangleVertexMemberPath1:q2:ru', [2, null], 'TriangleVertexMemberPath2:q4:rv', [2, null], 'TriangleVertexMemberPath3:q6:rw', [2, null], 'XAxis:qc:rx', [NumericXAxis.$, null], 'XMemberAsLegendLabel:ra:ry', [2, null], 'XMemberAsLegendUnit:rc:rz', [2, null], 'XMemberPath:re:r0', [2, null], 'YAxis:qd:r1', [NumericYAxis.$, null], 'YMemberAsLegendLabel:ri:r2', [2, null], 'YMemberAsLegendUnit:rk:r3', [2, null], 'YMemberPath:rm:r4', [2, null]]);
    return ScatterTriangulationSeries;
}(Series));
export { ScatterTriangulationSeries };
