/*
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 * as tslib_1 from "tslib";
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
 */
var ScatterTriangulationSeries = /** @class */ /*@__PURE__*/ (function (_super) {
    tslib_1.__extends(ScatterTriangulationSeries, _super);
    function ScatterTriangulationSeries() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _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;
        return _this;
    }
    ScatterTriangulationSeries.prototype.ji = function () {
        _super.prototype.ji.call(this);
        this.n9 = null;
        this.oa = null;
    };
    ScatterTriangulationSeries.prototype.gt = function (a, b) {
        var 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.prototype.gt.call(this, a, b);
    };
    Object.defineProperty(ScatterTriangulationSeries.prototype, "om", {
        get: function () {
            return this.og;
        },
        set: function (a) {
            var b = this.om != a;
            if (b) {
                var c = this.om;
                this.og = a;
                this.raisePropertyChanged("XColumn", c, this.om);
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(ScatterTriangulationSeries.prototype, "on", {
        get: function () {
            return this.oh;
        },
        set: function (a) {
            var b = this.on != a;
            if (b) {
                var c = this.on;
                this.oh = a;
                this.raisePropertyChanged("YColumn", c, this.on);
            }
        },
        enumerable: true,
        configurable: true
    });
    ScatterTriangulationSeries.prototype.k4 = function (a) {
        var 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;
        }
    };
    ScatterTriangulationSeries.prototype.pf = function () {
        this.oc = new Triangulator(this.cd.count, this.om, this.on);
        var a = this.oc;
        a.triangulationStatusChanged = delegateCombine(a.triangulationStatusChanged, runOn(this, this.pg));
        this.oc.y();
    };
    ScatterTriangulationSeries.prototype.pd = function () {
        if (this.oc == null) {
            return;
        }
        this.oc.r();
        var a = this.oc;
        a.triangulationStatusChanged = delegateRemove(a.triangulationStatusChanged, runOn(this, this.pg));
        this.oc = null;
    };
    ScatterTriangulationSeries.prototype.pg = function (a, b) {
        var _this = this;
        if (this.triangulationStatusChanged != null) {
            this.triangulationStatusChanged(this, new TriangulationStatusEventArgs(b.currentStatus));
        }
        if (b.currentStatus >= 100) {
            if (this.oc == null) {
                return;
            }
            var c = this.oc;
            c.triangulationStatusChanged = delegateRemove(c.triangulationStatusChanged, runOn(this, this.pg));
            this.os = this.oc.n();
            this.oc = null;
            var d = ((function () {
                var $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);
        }
    };
    ScatterTriangulationSeries.prototype.oi = function (a, b) {
        if (b == null) {
            return a.registerColumnInt(null, null, false);
        }
        var c = null;
        var d = SeriesViewer.bu(b, this.coercionMethods);
        c = d.a;
        return a.registerColumnInt(b, c, this.expectFunctions);
    };
    ScatterTriangulationSeries.prototype.kp = function (a, b, c, d) {
        var _this = this;
        _super.prototype.kp.call(this, a, b, c, d);
        switch (b) {
            case "FastItemsSource":
                var e = typeCast(IFastItemsSource_$type, c);
                if (e != null) {
                    e.deregisterColumn(this.om);
                    e.deregisterColumn(this.on);
                    this.om = null;
                    this.on = null;
                }
                this.pe();
                var 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 = ((function () {
                        var $ret = new FastItemsSource();
                        $ret.e = _this.trianglesSource;
                        return $ret;
                    })());
                }
                else {
                    this.oo = null;
                }
                break;
            case ScatterTriangulationSeries.$$p[0]:
                var 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;
                }
                var 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;
        }
    };
    ScatterTriangulationSeries.prototype.or = function (a) {
        if (typeCast(NumericYAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    ScatterTriangulationSeries.prototype.oq = function (a) {
        if (typeCast(NumericXAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    ScatterTriangulationSeries.prototype.ec = function (a, b, c) {
        return _super.prototype.ec.call(this, 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;
    };
    ScatterTriangulationSeries.prototype.pe = function () {
        if (this.trianglesSource == null) {
            this.os = null;
            this.oj = null;
            this.ok = null;
            this.ol = null;
            this.op = false;
        }
    };
    ScatterTriangulationSeries.prototype.j2 = function () {
        _super.prototype.j2.call(this);
        if (this.n9 != null) {
            this.n9.hb();
        }
        if (this.oa != null) {
            this.oa.hb();
        }
    };
    ScatterTriangulationSeries.prototype.jo = function (a, b, c, d) {
        _super.prototype.jo.call(this, a, b, c, d);
        this.pe();
        this.k3(false);
    };
    ScatterTriangulationSeries.prototype.ao = function (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;
    };
    ScatterTriangulationSeries.prototype.lo = function (a, b) {
        this.k3(false);
    };
    ScatterTriangulationSeries.prototype.ln = function (a, b) {
        this.k3(false);
    };
    Object.defineProperty(ScatterTriangulationSeries.prototype, "oj", {
        get: function () {
            return this.od;
        },
        set: function (a) {
            var b = this.oj != a;
            if (b) {
                var c = this.oj;
                this.od = a;
                this.raisePropertyChanged("TriangleVertexColumn1", c, this.oj);
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(ScatterTriangulationSeries.prototype, "ok", {
        get: function () {
            return this.oe;
        },
        set: function (a) {
            var b = this.ok != a;
            if (b) {
                var c = this.ok;
                this.oe = a;
                this.raisePropertyChanged("TriangleVertexColumn2", c, this.ok);
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(ScatterTriangulationSeries.prototype, "ol", {
        get: function () {
            return this.of;
        },
        set: function (a) {
            var b = this.ol != a;
            if (b) {
                var c = this.ol;
                this.of = a;
                this.raisePropertyChanged("TriangleVertexColumn3", c, this.ol);
            }
        },
        enumerable: true,
        configurable: true
    });
    ScatterTriangulationSeries.prototype.get_dk = function () {
        return true;
    };
    ScatterTriangulationSeries.$t = markType(ScatterTriangulationSeries, 'ScatterTriangulationSeries', Series.$);
    ScatterTriangulationSeries.$$p = 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;
}(Series));
export { ScatterTriangulationSeries };
//# sourceMappingURL=ScatterTriangulationSeries.js.map
