/*
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.wx = null;
        _this.wy = null;
        _this.w6 = false;
        _this.wt = null;
        _this.triangulationStatusChanged = null;
        _this.w9 = null;
        _this.wu = null;
        _this.wv = null;
        _this.ww = null;
        return _this;
    }
    ScatterTriangulationSeries.prototype.o0 = function () {
        _super.prototype.o0.call(this);
        this.wq = null;
        this.wr = null;
    };
    ScatterTriangulationSeries.prototype.ko = function (a, b) {
        var c = this.nb(b);
        if (c == ScatterTriangulationSeries.$$p[8]) {
            return this.kp(a, b, this.xs);
        }
        if (c == ScatterTriangulationSeries.$$p[12]) {
            return this.kp(a, b, this.x0);
        }
        return _super.prototype.ko.call(this, a, b);
    };
    ScatterTriangulationSeries.prototype.mb = function (a) {
        var b = this.nb(a);
        if (b == ScatterTriangulationSeries.$$p[8]) {
            return this.xs;
        }
        if (b == ScatterTriangulationSeries.$$p[12]) {
            return this.x0;
        }
        return _super.prototype.mb.call(this, a);
    };
    Object.defineProperty(ScatterTriangulationSeries.prototype, "w3", {
        get: function () {
            return this.wx;
        },
        set: function (a) {
            var b = this.w3 != a;
            if (b) {
                var c = this.w3;
                this.wx = a;
                this.raisePropertyChanged("XColumn", c, this.w3);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(ScatterTriangulationSeries.prototype, "w4", {
        get: function () {
            return this.wy;
        },
        set: function (a) {
            var b = this.w4 != a;
            if (b) {
                var c = this.w4;
                this.wy = a;
                this.raisePropertyChanged("YColumn", c, this.w4);
            }
        },
        enumerable: false,
        configurable: true
    });
    ScatterTriangulationSeries.prototype.ro = function (a) {
        var b = this.dl != null && this.w5 == null && this.w9 == null && this.w3 != null && this.w4 != null && this.w3.count >= 3 && this.w4.count >= 3 && !this.w6;
        if (b) {
            this.x4();
            this.w6 = true;
        }
    };
    ScatterTriangulationSeries.prototype.x4 = function () {
        this.wt = new Triangulator(this.dl.count, this.w3, this.w4);
        var a = this.wt;
        a.triangulationStatusChanged = delegateCombine(a.triangulationStatusChanged, runOn(this, this.x5));
        this.wt.y();
    };
    ScatterTriangulationSeries.prototype.x2 = function () {
        if (this.wt == null) {
            return;
        }
        this.wt.r();
        var a = this.wt;
        a.triangulationStatusChanged = delegateRemove(a.triangulationStatusChanged, runOn(this, this.x5));
        this.wt = null;
    };
    ScatterTriangulationSeries.prototype.x5 = function (a, b) {
        var _this = this;
        if (this.triangulationStatusChanged != null) {
            this.triangulationStatusChanged(this, new TriangulationStatusEventArgs(b.currentStatus));
        }
        if (b.currentStatus >= 100) {
            if (this.wt == null) {
                return;
            }
            var c = this.wt;
            c.triangulationStatusChanged = delegateRemove(c.triangulationStatusChanged, runOn(this, this.x5));
            this.w9 = this.wt.n();
            this.wt = null;
            var d = ((function () {
                var $ret = new FastItemsSource();
                $ret.e = _this.w9;
                return $ret;
            })());
            this.w0 = this.wz(d, "v1");
            this.w1 = this.wz(d, "v2");
            this.w2 = this.wz(d, "v3");
            this.rn(false);
        }
    };
    ScatterTriangulationSeries.prototype.wz = function (a, b) {
        if (b == null) {
            return a.registerColumnInt(null, null, false);
        }
        var c = null;
        var d = SeriesViewer.cu(b, this.coercionMethods);
        c = d.a;
        return a.registerColumnInt(b, c, this.expectFunctions);
    };
    ScatterTriangulationSeries.prototype.q5 = function (a, b, c, d) {
        var _this = this;
        _super.prototype.q5.call(this, a, b, c, d);
        switch (b) {
            case ScatterTriangulationSeries.$$p[6]:
            case ScatterTriangulationSeries.$$p[10]:
            case ScatterTriangulationSeries.$$p[7]:
            case ScatterTriangulationSeries.$$p[11]:
                this.qb();
                break;
            case "FastItemsSource":
                var e = typeCast(IFastItemsSource_$type, c);
                if (e != null) {
                    e.deregisterColumn(this.w3);
                    e.deregisterColumn(this.w4);
                    this.w3 = null;
                    this.w4 = null;
                }
                this.x3();
                var f = typeCast(IFastItemsSource_$type, d);
                if (f != null) {
                    this.w3 = this.di(this.xs);
                    this.w4 = this.di(this.x0);
                }
                this.rn(this.ge && c != null);
                break;
            case ScatterTriangulationSeries.$$p[8]:
                if (this.dl != null) {
                    this.dl.deregisterColumn(this.w3);
                    this.w3 = this.di(this.xs);
                }
                this.x3();
                this.rn(false);
                this.qh();
                break;
            case ScatterTriangulationSeries.$$p[12]:
                if (this.dl != null) {
                    this.dl.deregisterColumn(this.w4);
                    this.w4 = this.di(this.x0);
                }
                this.x3();
                this.rn(false);
                this.qh();
                break;
            case ScatterTriangulationSeries.$$p[5]:
                if (c != null) {
                    (typeCast(Axis.$, c)).b0(this);
                }
                if (d != null) {
                    (typeCast(Axis.$, d)).ct(this);
                }
                if ((this.wq != null && !this.wq.c1()) || (d == null && c != null)) {
                    this.rn(false);
                }
                this.qh();
                break;
            case ScatterTriangulationSeries.$$p[9]:
                if (c != null) {
                    (typeCast(Axis.$, c)).b0(this);
                }
                if (d != null) {
                    (typeCast(Axis.$, d)).ct(this);
                }
                if ((this.wr != null && !this.wr.c1()) || (d == null && c != null)) {
                    this.rn(false);
                }
                this.qh();
                break;
            case ScatterTriangulationSeries.$$p[4]:
                if (this.trianglesSource != null) {
                    this.x2();
                    this.w5 = ((function () {
                        var $ret = new FastItemsSource();
                        $ret.e = _this.trianglesSource;
                        return $ret;
                    })());
                }
                else {
                    this.w5 = null;
                }
                break;
            case ScatterTriangulationSeries.$$p[0]:
                var g = typeCast(IFastItemsSource_$type, c);
                if (g != null) {
                    g.deregisterColumn(this.w0);
                    g.deregisterColumn(this.w1);
                    g.deregisterColumn(this.w2);
                    this.w0 = null;
                    this.w1 = null;
                    this.w2 = null;
                }
                var h = typeCast(IFastItemsSource_$type, d);
                if (h != null) {
                    this.w0 = this.wz(h, this.xg);
                    this.w1 = this.wz(h, this.xi);
                    this.w2 = this.wz(h, this.xk);
                }
                this.rn(false);
                this.qh();
                break;
            case ScatterTriangulationSeries.$$p[1]:
                if (this.w5 != null) {
                    this.w5.deregisterColumn(this.w0);
                    this.w0 = this.wz(this.w5, this.xg);
                }
                this.rn(false);
                this.qh();
                break;
            case ScatterTriangulationSeries.$$p[2]:
                if (this.w5 != null) {
                    this.w5.deregisterColumn(this.w1);
                    this.w1 = this.wz(this.w5, this.xi);
                }
                this.rn(false);
                this.qh();
                break;
            case ScatterTriangulationSeries.$$p[3]:
                if (this.w5 != null) {
                    this.w5.deregisterColumn(this.w2);
                    this.w2 = this.wz(this.w5, this.xk);
                }
                this.rn(false);
                this.qh();
                break;
            case "XColumn":
                if (this.wq != null) {
                    this.wq.c1();
                }
                break;
            case "YColumn":
                if (this.wr != null) {
                    this.wr.c1();
                }
                break;
        }
    };
    ScatterTriangulationSeries.prototype.w8 = function (a) {
        if (typeCast(NumericYAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    ScatterTriangulationSeries.prototype.w7 = function (a) {
        if (typeCast(NumericXAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    ScatterTriangulationSeries.prototype.hc = function (a, b, c) {
        return _super.prototype.hc.call(this, a, b, c) && this.dl != null && this.wq != null && this.wr != null && this.wq.bi != null && this.wr.bi != null && a.width > 0 && a.height > 0 && this.w0 != null && this.w0.count > 0 && this.w1 != null && this.w1.count > 0 && this.w2 != null && this.w2.count > 0 && this.w3 != null && this.w3.count > 0 && this.w4 != null && this.w4.count > 0;
    };
    ScatterTriangulationSeries.prototype.x3 = function () {
        if (this.trianglesSource == null) {
            this.w9 = null;
            this.w0 = null;
            this.w1 = null;
            this.w2 = null;
            this.w6 = false;
        }
    };
    ScatterTriangulationSeries.prototype.p6 = function () {
        _super.prototype.p6.call(this);
        if (this.wq != null) {
            this.wq.h8();
        }
        if (this.wr != null) {
            this.wr.h8();
        }
    };
    ScatterTriangulationSeries.prototype.o9 = function (a, b, c, d) {
        _super.prototype.o9.call(this, a, b, c, d);
        this.x3();
        this.rn(false);
    };
    ScatterTriangulationSeries.prototype.ax = function (a) {
        if (a != null && a == this.wq && this.w3 != null) {
            return new AxisRange(this.w3.minimum, this.w3.maximum);
        }
        if (a != null && a == this.wr && this.w4 != null) {
            return new AxisRange(this.w4.minimum, this.w4.maximum);
        }
        return null;
    };
    ScatterTriangulationSeries.prototype.sl = function (a, b) {
        this.rn(false);
    };
    ScatterTriangulationSeries.prototype.sk = function (a, b) {
        this.rn(false);
    };
    Object.defineProperty(ScatterTriangulationSeries.prototype, "w0", {
        get: function () {
            return this.wu;
        },
        set: function (a) {
            var b = this.w0 != a;
            if (b) {
                var c = this.w0;
                this.wu = a;
                this.raisePropertyChanged("TriangleVertexColumn1", c, this.w0);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(ScatterTriangulationSeries.prototype, "w1", {
        get: function () {
            return this.wv;
        },
        set: function (a) {
            var b = this.w1 != a;
            if (b) {
                var c = this.w1;
                this.wv = a;
                this.raisePropertyChanged("TriangleVertexColumn2", c, this.w1);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(ScatterTriangulationSeries.prototype, "w2", {
        get: function () {
            return this.ww;
        },
        set: function (a) {
            var b = this.w2 != a;
            if (b) {
                var c = this.w2;
                this.ww = a;
                this.raisePropertyChanged("TriangleVertexColumn3", c, this.w2);
            }
        },
        enumerable: false,
        configurable: true
    });
    ScatterTriangulationSeries.prototype.get_fv = function () {
        return true;
    };
    ScatterTriangulationSeries.prototype.get_fj = function () {
        return true;
    };
    ScatterTriangulationSeries.prototype.getDataLegendSeriesContextAt = function (a, b) {
        var c = { $type: Point_$type, x: a, y: b };
        var d = this.kl(c);
        var e = d == null ? NaN : this.iv(d, "XMemberPath");
        var f = d == null ? NaN : this.iv(d, "YMemberPath");
        var g = new DataLegendSeriesValueInfo();
        g.l = e;
        g.a = 13;
        g.q = "X";
        g.r = this.xs != null ? this.xs : "X";
        g.s = this.xo != null ? this.xo : "X:";
        g.t = this.xq != null ? this.xq : "";
        var h = new DataLegendSeriesValueInfo();
        h.l = f;
        h.a = 14;
        h.q = "Y";
        h.r = this.x0 != null ? this.x0 : "Y";
        h.s = this.xw != null ? this.xw : "Y:";
        h.t = this.xy != null ? this.xy : "";
        var i = new DataLegendSeriesContext();
        i.e = ((function () {
            var $ret = new List$1(DataLegendSeriesValueInfo.$, 0);
            $ret.add(g);
            $ret.add(h);
            return $ret;
        })());
        i.h = this.ma();
        return i;
    };
    ScatterTriangulationSeries.$t = markType(ScatterTriangulationSeries, 'ScatterTriangulationSeries', Series.$);
    ScatterTriangulationSeries.$$p = markDep(DependencyProperty, PropertyMetadata, ScatterTriangulationSeries, 'raisePropertyChanged', ['FastTrianglesSource:w5:x6', [IFastItemsSource_$type, null], 'TriangleVertexMemberPath1:xg:x8', [2, null], 'TriangleVertexMemberPath2:xi:x9', [2, null], 'TriangleVertexMemberPath3:xk:ya', [2, null], 'TrianglesSource::x7', [IEnumerable_$type, null], 'XAxis:wq:yb', [NumericXAxis.$, null], 'XMemberAsLegendLabel:xo:yc', [2, null], 'XMemberAsLegendUnit:xq:yd', [2, null], 'XMemberPath:xs:ye', [2, null], 'YAxis:wr:yf', [NumericYAxis.$, null], 'YMemberAsLegendLabel:xw:yg', [2, null], 'YMemberAsLegendUnit:xy:yh', [2, null], 'YMemberPath:x0:yi', [2, null]]);
    return ScatterTriangulationSeries;
}(Series));
export { ScatterTriangulationSeries };
