/*
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.t8 = null;
        _this.t9 = null;
        _this.uh = false;
        _this.t4 = null;
        _this.triangulationStatusChanged = null;
        _this.uk = null;
        _this.t5 = null;
        _this.t6 = null;
        _this.t7 = null;
        return _this;
    }
    ScatterTriangulationSeries.prototype.ng = function () {
        _super.prototype.ng.call(this);
        this.t1 = null;
        this.t2 = null;
    };
    ScatterTriangulationSeries.prototype.ju = function (a, b) {
        var c = this.lv(b);
        if (c == ScatterTriangulationSeries.$$p[8]) {
            return this.jv(a, b, this.u3);
        }
        if (c == ScatterTriangulationSeries.$$p[12]) {
            return this.jv(a, b, this.vb);
        }
        return _super.prototype.ju.call(this, a, b);
    };
    Object.defineProperty(ScatterTriangulationSeries.prototype, "ue", {
        get: function () {
            return this.t8;
        },
        set: function (a) {
            var b = this.ue != a;
            if (b) {
                var c = this.ue;
                this.t8 = a;
                this.raisePropertyChanged("XColumn", c, this.ue);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(ScatterTriangulationSeries.prototype, "uf", {
        get: function () {
            return this.t9;
        },
        set: function (a) {
            var b = this.uf != a;
            if (b) {
                var c = this.uf;
                this.t9 = a;
                this.raisePropertyChanged("YColumn", c, this.uf);
            }
        },
        enumerable: false,
        configurable: true
    });
    ScatterTriangulationSeries.prototype.pq = function (a) {
        var b = this.c6 != null && this.ug == null && this.uk == null && this.ue != null && this.uf != null && this.ue.count >= 3 && this.uf.count >= 3 && !this.uh;
        if (b) {
            this.vf();
            this.uh = true;
        }
    };
    ScatterTriangulationSeries.prototype.vf = function () {
        this.t4 = new Triangulator(this.c6.count, this.ue, this.uf);
        var a = this.t4;
        a.triangulationStatusChanged = delegateCombine(a.triangulationStatusChanged, runOn(this, this.vg));
        this.t4.y();
    };
    ScatterTriangulationSeries.prototype.vd = function () {
        if (this.t4 == null) {
            return;
        }
        this.t4.r();
        var a = this.t4;
        a.triangulationStatusChanged = delegateRemove(a.triangulationStatusChanged, runOn(this, this.vg));
        this.t4 = null;
    };
    ScatterTriangulationSeries.prototype.vg = function (a, b) {
        var _this = this;
        if (this.triangulationStatusChanged != null) {
            this.triangulationStatusChanged(this, new TriangulationStatusEventArgs(b.currentStatus));
        }
        if (b.currentStatus >= 100) {
            if (this.t4 == null) {
                return;
            }
            var c = this.t4;
            c.triangulationStatusChanged = delegateRemove(c.triangulationStatusChanged, runOn(this, this.vg));
            this.uk = this.t4.n();
            this.t4 = null;
            var d = ((function () {
                var $ret = new FastItemsSource();
                $ret.e = _this.uk;
                return $ret;
            })());
            this.ub = this.ua(d, "v1");
            this.uc = this.ua(d, "v2");
            this.ud = this.ua(d, "v3");
            this.pp(false);
        }
    };
    ScatterTriangulationSeries.prototype.ua = function (a, b) {
        if (b == null) {
            return a.registerColumnInt(null, null, false);
        }
        var c = null;
        var d = SeriesViewer.ch(b, this.coercionMethods);
        c = d.a;
        return a.registerColumnInt(b, c, this.expectFunctions);
    };
    ScatterTriangulationSeries.prototype.o8 = function (a, b, c, d) {
        var _this = this;
        _super.prototype.o8.call(this, a, b, c, d);
        switch (b) {
            case "FastItemsSource":
                var e = typeCast(IFastItemsSource_$type, c);
                if (e != null) {
                    e.deregisterColumn(this.ue);
                    e.deregisterColumn(this.uf);
                    this.ue = null;
                    this.uf = null;
                }
                this.ve();
                var f = typeCast(IFastItemsSource_$type, d);
                if (f != null) {
                    this.ue = this.c3(this.u3);
                    this.uf = this.c3(this.vb);
                }
                this.pp(this.fq && c != null);
                break;
            case ScatterTriangulationSeries.$$p[8]:
                if (this.c6 != null) {
                    this.c6.deregisterColumn(this.ue);
                    this.ue = this.c3(this.u3);
                }
                this.ve();
                this.pp(false);
                this.ol();
                break;
            case ScatterTriangulationSeries.$$p[12]:
                if (this.c6 != null) {
                    this.c6.deregisterColumn(this.uf);
                    this.uf = this.c3(this.vb);
                }
                this.ve();
                this.pp(false);
                this.ol();
                break;
            case ScatterTriangulationSeries.$$p[5]:
                if (c != null) {
                    (typeCast(Axis.$, c)).b0(this);
                }
                if (d != null) {
                    (typeCast(Axis.$, d)).ct(this);
                }
                if ((this.t1 != null && !this.t1.c1()) || (d == null && c != null)) {
                    this.pp(false);
                }
                this.ol();
                break;
            case ScatterTriangulationSeries.$$p[9]:
                if (c != null) {
                    (typeCast(Axis.$, c)).b0(this);
                }
                if (d != null) {
                    (typeCast(Axis.$, d)).ct(this);
                }
                if ((this.t2 != null && !this.t2.c1()) || (d == null && c != null)) {
                    this.pp(false);
                }
                this.ol();
                break;
            case ScatterTriangulationSeries.$$p[1]:
                if (this.trianglesSource != null) {
                    this.vd();
                    this.ug = ((function () {
                        var $ret = new FastItemsSource();
                        $ret.e = _this.trianglesSource;
                        return $ret;
                    })());
                }
                else {
                    this.ug = null;
                }
                break;
            case ScatterTriangulationSeries.$$p[0]:
                var g = typeCast(IFastItemsSource_$type, c);
                if (g != null) {
                    g.deregisterColumn(this.ub);
                    g.deregisterColumn(this.uc);
                    g.deregisterColumn(this.ud);
                    this.ub = null;
                    this.uc = null;
                    this.ud = null;
                }
                var h = typeCast(IFastItemsSource_$type, d);
                if (h != null) {
                    this.ub = this.ua(h, this.ur);
                    this.uc = this.ua(h, this.ut);
                    this.ud = this.ua(h, this.uv);
                }
                this.pp(false);
                this.ol();
                break;
            case ScatterTriangulationSeries.$$p[2]:
                if (this.ug != null) {
                    this.ug.deregisterColumn(this.ub);
                    this.ub = this.ua(this.ug, this.ur);
                }
                this.pp(false);
                this.ol();
                break;
            case ScatterTriangulationSeries.$$p[3]:
                if (this.ug != null) {
                    this.ug.deregisterColumn(this.uc);
                    this.uc = this.ua(this.ug, this.ut);
                }
                this.pp(false);
                this.ol();
                break;
            case ScatterTriangulationSeries.$$p[4]:
                if (this.ug != null) {
                    this.ug.deregisterColumn(this.ud);
                    this.ud = this.ua(this.ug, this.uv);
                }
                this.pp(false);
                this.ol();
                break;
            case "XColumn":
                if (this.t1 != null) {
                    this.t1.c1();
                }
                break;
            case "YColumn":
                if (this.t2 != null) {
                    this.t2.c1();
                }
                break;
        }
    };
    ScatterTriangulationSeries.prototype.uj = function (a) {
        if (typeCast(NumericYAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    ScatterTriangulationSeries.prototype.ui = function (a) {
        if (typeCast(NumericXAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    ScatterTriangulationSeries.prototype.gl = function (a, b, c) {
        return _super.prototype.gl.call(this, a, b, c) && this.c6 != null && this.t1 != null && this.t2 != null && this.t1.bi != null && this.t2.bi != null && a.width > 0 && a.height > 0 && this.ub != null && this.ub.count > 0 && this.uc != null && this.uc.count > 0 && this.ud != null && this.ud.count > 0 && this.ue != null && this.ue.count > 0 && this.uf != null && this.uf.count > 0;
    };
    ScatterTriangulationSeries.prototype.ve = function () {
        if (this.trianglesSource == null) {
            this.uk = null;
            this.ub = null;
            this.uc = null;
            this.ud = null;
            this.uh = false;
        }
    };
    ScatterTriangulationSeries.prototype.ob = function () {
        _super.prototype.ob.call(this);
        if (this.t1 != null) {
            this.t1.h7();
        }
        if (this.t2 != null) {
            this.t2.h7();
        }
    };
    ScatterTriangulationSeries.prototype.no = function (a, b, c, d) {
        _super.prototype.no.call(this, a, b, c, d);
        this.ve();
        this.pp(false);
    };
    ScatterTriangulationSeries.prototype.aq = function (a) {
        if (a != null && a == this.t1 && this.ue != null) {
            return new AxisRange(this.ue.minimum, this.ue.maximum);
        }
        if (a != null && a == this.t2 && this.uf != null) {
            return new AxisRange(this.uf.minimum, this.uf.maximum);
        }
        return null;
    };
    ScatterTriangulationSeries.prototype.qn = function (a, b) {
        this.pp(false);
    };
    ScatterTriangulationSeries.prototype.qm = function (a, b) {
        this.pp(false);
    };
    Object.defineProperty(ScatterTriangulationSeries.prototype, "ub", {
        get: function () {
            return this.t5;
        },
        set: function (a) {
            var b = this.ub != a;
            if (b) {
                var c = this.ub;
                this.t5 = a;
                this.raisePropertyChanged("TriangleVertexColumn1", c, this.ub);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(ScatterTriangulationSeries.prototype, "uc", {
        get: function () {
            return this.t6;
        },
        set: function (a) {
            var b = this.uc != a;
            if (b) {
                var c = this.uc;
                this.t6 = a;
                this.raisePropertyChanged("TriangleVertexColumn2", c, this.uc);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(ScatterTriangulationSeries.prototype, "ud", {
        get: function () {
            return this.t7;
        },
        set: function (a) {
            var b = this.ud != a;
            if (b) {
                var c = this.ud;
                this.t7 = a;
                this.raisePropertyChanged("TriangleVertexColumn3", c, this.ud);
            }
        },
        enumerable: false,
        configurable: true
    });
    ScatterTriangulationSeries.prototype.get_fa = function () {
        return true;
    };
    ScatterTriangulationSeries.prototype.get_ey = function () {
        return true;
    };
    ScatterTriangulationSeries.prototype.getDataLegendSeriesContextAt = function (a, b) {
        var c = { $type: Point_$type, x: a, y: b };
        var d = this.jr(c);
        var e = d == null ? NaN : this.h1(d, "XMemberPath");
        var f = d == null ? NaN : this.h1(d, "YMemberPath");
        var g = new DataLegendSeriesValueInfo();
        g.l = e;
        g.a = 13;
        g.p = "X";
        g.q = this.u3 != null ? this.u3 : "X";
        g.r = this.uz != null ? this.uz : "X:";
        g.s = this.u1 != null ? this.u1 : "";
        var h = new DataLegendSeriesValueInfo();
        h.l = f;
        h.a = 14;
        h.p = "Y";
        h.q = this.vb != null ? this.vb : "Y";
        h.r = this.u7 != null ? this.u7 : "Y:";
        h.s = this.u9 != null ? this.u9 : "";
        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:ug:vh', [IFastItemsSource_$type, null], 'TrianglesSource::vi', [IEnumerable_$type, null], 'TriangleVertexMemberPath1:ur:vj', [2, null], 'TriangleVertexMemberPath2:ut:vk', [2, null], 'TriangleVertexMemberPath3:uv:vl', [2, null], 'XAxis:t1:vm', [NumericXAxis.$, null], 'XMemberAsLegendLabel:uz:vn', [2, null], 'XMemberAsLegendUnit:u1:vo', [2, null], 'XMemberPath:u3:vp', [2, null], 'YAxis:t2:vq', [NumericYAxis.$, null], 'YMemberAsLegendLabel:u7:vr', [2, null], 'YMemberAsLegendUnit:u9:vs', [2, null], 'YMemberPath:vb:vt', [2, null]]);
    return ScatterTriangulationSeries;
}(Series));
export { ScatterTriangulationSeries };
