/*
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.mh = null;
        _this.mi = null;
        _this.mq = false;
        _this.md = null;
        _this.triangulationStatusChanged = null;
        _this.mt = null;
        _this.me = null;
        _this.mf = null;
        _this.mg = null;
        return _this;
    }
    ScatterTriangulationSeries.prototype.h1 = function () {
        _super.prototype.h1.call(this);
        this.ma = null;
        this.mb = null;
    };
    ScatterTriangulationSeries.prototype.fs = function (a, b) {
        var c = this.g2(b);
        if (c == ScatterTriangulationSeries.$$p[6]) {
            return this.ft(a, b, this.m8);
        }
        if (c == ScatterTriangulationSeries.$$p[8]) {
            return this.ft(a, b, this.nc);
        }
        return _super.prototype.fs.call(this, a, b);
    };
    Object.defineProperty(ScatterTriangulationSeries.prototype, "mn", {
        get: function () {
            return this.mh;
        },
        set: function (a) {
            var b = this.mn != a;
            if (b) {
                var c = this.mn;
                this.mh = a;
                this.raisePropertyChanged("XColumn", c, this.mn);
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(ScatterTriangulationSeries.prototype, "mo", {
        get: function () {
            return this.mi;
        },
        set: function (a) {
            var b = this.mo != a;
            if (b) {
                var c = this.mo;
                this.mi = a;
                this.raisePropertyChanged("YColumn", c, this.mo);
            }
        },
        enumerable: true,
        configurable: true
    });
    ScatterTriangulationSeries.prototype.jm = function (a) {
        var b = this.bz != null && this.mp == null && this.mt == null && this.mn != null && this.mo != null && this.mn.count >= 3 && this.mo.count >= 3 && !this.mq;
        if (b) {
            this.ng();
            this.mq = true;
        }
    };
    ScatterTriangulationSeries.prototype.ng = function () {
        this.md = new Triangulator(this.bz.count, this.mn, this.mo);
        var a = this.md;
        a.triangulationStatusChanged = delegateCombine(a.triangulationStatusChanged, runOn(this, this.nh));
        this.md.y();
    };
    ScatterTriangulationSeries.prototype.ne = function () {
        if (this.md == null) {
            return;
        }
        this.md.r();
        var a = this.md;
        a.triangulationStatusChanged = delegateRemove(a.triangulationStatusChanged, runOn(this, this.nh));
        this.md = null;
    };
    ScatterTriangulationSeries.prototype.nh = function (a, b) {
        var _this = this;
        if (this.triangulationStatusChanged != null) {
            this.triangulationStatusChanged(this, new TriangulationStatusEventArgs(b.currentStatus));
        }
        if (b.currentStatus >= 100) {
            if (this.md == null) {
                return;
            }
            var c = this.md;
            c.triangulationStatusChanged = delegateRemove(c.triangulationStatusChanged, runOn(this, this.nh));
            this.mt = this.md.n();
            this.md = null;
            var d = ((function () {
                var $ret = new FastItemsSource();
                $ret.e = _this.mt;
                return $ret;
            })());
            this.mk = this.mj(d, "v1");
            this.ml = this.mj(d, "v2");
            this.mm = this.mj(d, "v3");
            this.jl(false);
        }
    };
    ScatterTriangulationSeries.prototype.mj = function (a, b) {
        if (b == null) {
            return a.registerColumnInt(null, null, false);
        }
        var c = null;
        var d = SeriesViewer.bn(b, this.coercionMethods);
        c = d.a;
        return a.registerColumnInt(b, c, this.expectFunctions);
    };
    ScatterTriangulationSeries.prototype.i7 = function (a, b, c, d) {
        var _this = this;
        _super.prototype.i7.call(this, a, b, c, d);
        switch (b) {
            case "FastItemsSource":
                var e = typeCast(IFastItemsSource_$type, c);
                if (e != null) {
                    e.deregisterColumn(this.mn);
                    e.deregisterColumn(this.mo);
                    this.mn = null;
                    this.mo = null;
                }
                this.nf();
                var f = typeCast(IFastItemsSource_$type, d);
                if (f != null) {
                    this.mn = this.bw(this.m8);
                    this.mo = this.bw(this.nc);
                }
                this.jl(false);
                break;
            case ScatterTriangulationSeries.$$p[6]:
                if (this.bz != null) {
                    this.bz.deregisterColumn(this.mn);
                    this.mn = this.bw(this.m8);
                }
                this.nf();
                this.jl(false);
                this.it();
                break;
            case ScatterTriangulationSeries.$$p[8]:
                if (this.bz != null) {
                    this.bz.deregisterColumn(this.mo);
                    this.mo = this.bw(this.nc);
                }
                this.nf();
                this.jl(false);
                this.it();
                break;
            case ScatterTriangulationSeries.$$p[5]:
                if (c != null) {
                    (typeCast(Axis.$, c)).bx(this);
                }
                if (d != null) {
                    (typeCast(Axis.$, d)).ck(this);
                }
                if ((this.ma != null && !this.ma.cn()) || (d == null && c != null)) {
                    this.jl(false);
                }
                this.it();
                break;
            case ScatterTriangulationSeries.$$p[7]:
                if (c != null) {
                    (typeCast(Axis.$, c)).bx(this);
                }
                if (d != null) {
                    (typeCast(Axis.$, d)).ck(this);
                }
                if ((this.mb != null && !this.mb.cn()) || (d == null && c != null)) {
                    this.jl(false);
                }
                this.it();
                break;
            case ScatterTriangulationSeries.$$p[1]:
                if (this.trianglesSource != null) {
                    this.ne();
                    this.mp = ((function () {
                        var $ret = new FastItemsSource();
                        $ret.e = _this.trianglesSource;
                        return $ret;
                    })());
                }
                else {
                    this.mp = null;
                }
                break;
            case ScatterTriangulationSeries.$$p[0]:
                var g = typeCast(IFastItemsSource_$type, c);
                if (g != null) {
                    g.deregisterColumn(this.mk);
                    g.deregisterColumn(this.ml);
                    g.deregisterColumn(this.mm);
                    this.mk = null;
                    this.ml = null;
                    this.mm = null;
                }
                var h = typeCast(IFastItemsSource_$type, d);
                if (h != null) {
                    this.mk = this.mj(h, this.m0);
                    this.ml = this.mj(h, this.m2);
                    this.mm = this.mj(h, this.m4);
                }
                this.jl(false);
                this.it();
                break;
            case ScatterTriangulationSeries.$$p[2]:
                if (this.mp != null) {
                    this.mp.deregisterColumn(this.mk);
                    this.mk = this.mj(this.mp, this.m0);
                }
                this.jl(false);
                this.it();
                break;
            case ScatterTriangulationSeries.$$p[3]:
                if (this.mp != null) {
                    this.mp.deregisterColumn(this.ml);
                    this.ml = this.mj(this.mp, this.m2);
                }
                this.jl(false);
                this.it();
                break;
            case ScatterTriangulationSeries.$$p[4]:
                if (this.mp != null) {
                    this.mp.deregisterColumn(this.mm);
                    this.mm = this.mj(this.mp, this.m4);
                }
                this.jl(false);
                this.it();
                break;
            case "XColumn":
                if (this.ma != null) {
                    this.ma.cn();
                }
                break;
            case "YColumn":
                if (this.mb != null) {
                    this.mb.cn();
                }
                break;
        }
    };
    ScatterTriangulationSeries.prototype.ms = function (a) {
        if (typeCast(NumericYAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    ScatterTriangulationSeries.prototype.mr = function (a) {
        if (typeCast(NumericXAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    ScatterTriangulationSeries.prototype.dw = function (a, b, c) {
        return _super.prototype.dw.call(this, a, b, c) && this.bz != null && this.ma != null && this.mb != null && this.ma.bh != null && this.mb.bh != null && a.width > 0 && a.height > 0 && this.mk != null && this.mk.count > 0 && this.ml != null && this.ml.count > 0 && this.mm != null && this.mm.count > 0 && this.mn != null && this.mn.count > 0 && this.mo != null && this.mo.count > 0;
    };
    ScatterTriangulationSeries.prototype.nf = function () {
        if (this.trianglesSource == null) {
            this.mt = null;
            this.mk = null;
            this.ml = null;
            this.mm = null;
            this.mq = false;
        }
    };
    ScatterTriangulationSeries.prototype.ik = function () {
        _super.prototype.ik.call(this);
        if (this.ma != null) {
            this.ma.ha();
        }
        if (this.mb != null) {
            this.mb.ha();
        }
    };
    ScatterTriangulationSeries.prototype.h6 = function (a, b, c, d) {
        _super.prototype.h6.call(this, a, b, c, d);
        this.nf();
        this.jl(false);
    };
    ScatterTriangulationSeries.prototype.an = function (a) {
        if (a != null && a == this.ma && this.mn != null) {
            return new AxisRange(this.mn.minimum, this.mn.maximum);
        }
        if (a != null && a == this.mb && this.mo != null) {
            return new AxisRange(this.mo.minimum, this.mo.maximum);
        }
        return null;
    };
    ScatterTriangulationSeries.prototype.j1 = function (a, b) {
        this.jl(false);
    };
    ScatterTriangulationSeries.prototype.j0 = function (a, b) {
        this.jl(false);
    };
    Object.defineProperty(ScatterTriangulationSeries.prototype, "mk", {
        get: function () {
            return this.me;
        },
        set: function (a) {
            var b = this.mk != a;
            if (b) {
                var c = this.mk;
                this.me = a;
                this.raisePropertyChanged("TriangleVertexColumn1", c, this.mk);
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(ScatterTriangulationSeries.prototype, "ml", {
        get: function () {
            return this.mf;
        },
        set: function (a) {
            var b = this.ml != a;
            if (b) {
                var c = this.ml;
                this.mf = a;
                this.raisePropertyChanged("TriangleVertexColumn2", c, this.ml);
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(ScatterTriangulationSeries.prototype, "mm", {
        get: function () {
            return this.mg;
        },
        set: function (a) {
            var b = this.mm != a;
            if (b) {
                var c = this.mm;
                this.mg = a;
                this.raisePropertyChanged("TriangleVertexColumn3", c, this.mm);
            }
        },
        enumerable: true,
        configurable: true
    });
    ScatterTriangulationSeries.prototype.get_c5 = function () {
        return true;
    };
    ScatterTriangulationSeries.$t = markType(ScatterTriangulationSeries, 'ScatterTriangulationSeries', Series.$);
    ScatterTriangulationSeries.$$p = markDep(DependencyProperty, PropertyMetadata, ScatterTriangulationSeries, 'raisePropertyChanged', ['FastTrianglesSource:mp:ni', [IFastItemsSource_$type, null], 'TrianglesSource::nj', [IEnumerable_$type, null], 'TriangleVertexMemberPath1:m0:nk', [2, null], 'TriangleVertexMemberPath2:m2:nl', [2, null], 'TriangleVertexMemberPath3:m4:nm', [2, null], 'XAxis:ma:nn', [NumericXAxis.$, null], 'XMemberPath:m8:no', [2, null], 'YAxis:mb:np', [NumericYAxis.$, null], 'YMemberPath:nc:nq', [2, null]]);
    return ScatterTriangulationSeries;
}(Series));
export { ScatterTriangulationSeries };
//# sourceMappingURL=ScatterTriangulationSeries.js.map
