/*
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, __values } from "tslib";
import { Series } from "./Series";
import { DependencyProperty } from "igniteui-react-core";
import { Point_$type, Boolean_$type, enumGetBox, runOn, delegateRemove, typeCast, delegateCombine, fromEnum, fromEn, markType, markDep } from "igniteui-react-core";
import { AnnotationAppearanceMode_$type } from "./AnnotationAppearanceMode";
import { DoubleCollection } from "igniteui-react-core";
import { SeriesView } from "./SeriesView";
import { XamDataChart } from "./XamDataChart";
import { Tuple$2 } from "igniteui-react-core";
import { PropertyMetadata } from "igniteui-react-core";
import { isNaN_ } from "igniteui-react-core";
/**
 * @hidden
 */
var AnnotationLayer = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(AnnotationLayer, _super);
    function AnnotationLayer() {
        var _this = _super.call(this) || this;
        _this.zo = null;
        _this.w4 = null;
        _this.w3 = null;
        _this.w5 = null;
        _this.zm = { $type: Point_$type, x: NaN, y: NaN };
        _this.w6 = false;
        _this.zo = { $type: Point_$type, x: NaN, y: NaN };
        _this.yr();
        return _this;
    }
    AnnotationLayer.prototype.cq = function () {
        return new AnnotationLayerView(this);
    };
    AnnotationLayer.prototype.qx = function (a) {
        _super.prototype.qx.call(this, a);
        this.w2 = a;
    };
    AnnotationLayer.prototype.xa = function (a) {
        if (a == null) {
            return false;
        }
        if (a.eq) {
            return false;
        }
        if (a.isValueOverlay) {
            return false;
        }
        if (a == this) {
            return false;
        }
        return a.hc(a.ct.bx, a.ct.by, a.ct);
    };
    AnnotationLayer.prototype.get_ez = function () {
        return this.w7;
    };
    AnnotationLayer.prototype.b0 = function () {
        if (this.b1 == 0) {
            return 1;
        }
        else {
            return _super.prototype.b0.call(this);
        }
    };
    AnnotationLayer.prototype.get_fe = function () {
        return this.xc || this.xd;
    };
    AnnotationLayer.prototype.get_isUsableInLegend = function () {
        return this.xd;
    };
    AnnotationLayer.prototype.q5 = function (a, b, c, d) {
        _super.prototype.q5.call(this, a, b, c, d);
        switch (b) {
            case "SeriesViewer":
                var e = c;
                var f = d;
                if (e != null) {
                    this.yq(e.series);
                    var g = e.series;
                    g.collectionChanged = delegateRemove(g.collectionChanged, runOn(this, this.yn));
                    if (typeCast(XamDataChart.$, e) !== null) {
                        var h = e;
                        this.yp(h.axes);
                        var i = h.axes;
                        i.collectionChanged = delegateRemove(i.collectionChanged, runOn(this, this.yd));
                    }
                }
                if (f != null) {
                    this.yl(f.series);
                    var j = f.series;
                    j.collectionChanged = delegateCombine(j.collectionChanged, runOn(this, this.yn));
                    if (typeCast(XamDataChart.$, f) !== null) {
                        var k = f;
                        this.yk(k.axes);
                        var l = k.axes;
                        l.collectionChanged = delegateCombine(l.collectionChanged, runOn(this, this.yd));
                    }
                }
                break;
            case AnnotationLayer.$$p[16]:
            case AnnotationLayer.$$p[15]:
                if (this.fe) {
                    if (this.index == -1) {
                        this.index = XamDataChart.x7(this);
                    }
                }
                else {
                    this.index = -1;
                    this.u3 = null;
                    this.u7 = null;
                }
                if (this.c9 != null) {
                    this.c9.o0();
                }
                this.rn(true);
                break;
            case "TransitionProgress":
                this.w5.c(this.jo, this.w4, this.w3);
                if (this.d3(this.ct)) {
                    return;
                }
                if (this.jo == 1) {
                    this.ym(this.w3, this.ct);
                    this.qk();
                }
                else {
                    this.ym(this.w5, this.ct);
                }
                if (this.c9 != null) {
                    this.c9.qa(this);
                }
                break;
            case AnnotationLayer.$$p[13]:
                if (this.c9 != null) {
                    this.c9.ou();
                }
                break;
            case AnnotationLayer.$$p[9]:
                this.zo = this.zn;
                this.qn(this.zn);
                break;
            case "ShouldRenderAsOverlay":
                if (this.c9 != null) {
                    this.ct.al(this.c9);
                    this.ct.ag(this.c9);
                }
                break;
            case AnnotationLayer.$$p[8]:
            case AnnotationLayer.$$p[14]:
            case "DashArray":
            case AnnotationLayer.$$p[10]:
            case AnnotationLayer.$$p[17]:
            case AnnotationLayer.$$p[12]:
            case AnnotationLayer.$$p[19]:
            case AnnotationLayer.$$p[11]:
            case AnnotationLayer.$$p[18]:
                this.yr();
                break;
            case AnnotationLayer.$$p[0]:
            case AnnotationLayer.$$p[4]:
            case AnnotationLayer.$$p[1]:
            case AnnotationLayer.$$p[5]:
            case AnnotationLayer.$$p[3]:
            case AnnotationLayer.$$p[7]:
            case AnnotationLayer.$$p[2]:
            case AnnotationLayer.$$p[6]:
                this.rn(true);
                break;
        }
    };
    AnnotationLayer.prototype.yq = function (a) {
        var e_1, _a;
        try {
            for (var _b = __values(fromEnum(a)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var b = _c.value;
                if (!(b == this)) {
                    b.renderRequested = delegateRemove(b.renderRequested, runOn(this, this.yo));
                }
            }
        }
        catch (e_1_1) {
            e_1 = { error: e_1_1 };
        }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return))
                    _a.call(_b);
            }
            finally {
                if (e_1)
                    throw e_1.error;
            }
        }
        this.rn(true);
    };
    AnnotationLayer.prototype.yp = function (a) {
        var e_2, _a;
        try {
            for (var _b = __values(fromEnum(a)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var b = _c.value;
                b.renderRequested = delegateRemove(b.renderRequested, runOn(this, this.ye));
            }
        }
        catch (e_2_1) {
            e_2 = { error: e_2_1 };
        }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return))
                    _a.call(_b);
            }
            finally {
                if (e_2)
                    throw e_2.error;
            }
        }
        this.rn(true);
    };
    AnnotationLayer.prototype.yl = function (a) {
        var e_3, _a;
        try {
            for (var _b = __values(fromEnum(a)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var b = _c.value;
                if (!(b == this)) {
                    b.renderRequested = delegateCombine(b.renderRequested, runOn(this, this.yo));
                }
            }
        }
        catch (e_3_1) {
            e_3 = { error: e_3_1 };
        }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return))
                    _a.call(_b);
            }
            finally {
                if (e_3)
                    throw e_3.error;
            }
        }
        this.rn(true);
    };
    AnnotationLayer.prototype.yk = function (a) {
        var e_4, _a;
        try {
            for (var _b = __values(fromEnum(a)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var b = _c.value;
                b.renderRequested = delegateCombine(b.renderRequested, runOn(this, this.ye));
            }
        }
        catch (e_4_1) {
            e_4 = { error: e_4_1 };
        }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return))
                    _a.call(_b);
            }
            finally {
                if (e_4)
                    throw e_4.error;
            }
        }
        this.rn(true);
    };
    AnnotationLayer.prototype.w8 = function (a) {
        if (a == null) {
            return false;
        }
        return true;
    };
    AnnotationLayer.prototype.ye = function (a, b) {
        if (this.w8(a)) {
            this.yg(a, b.animate);
        }
    };
    AnnotationLayer.prototype.w9 = function (a) {
        if (a == null) {
            return false;
        }
        if (a.eq) {
            return false;
        }
        return true;
    };
    AnnotationLayer.prototype.yo = function (a, b) {
        if (this.w9(a)) {
            this.yh(a, b.animate);
        }
    };
    AnnotationLayer.prototype.yg = function (a, b) {
    };
    AnnotationLayer.prototype.yh = function (a, b) {
    };
    AnnotationLayer.prototype.yn = function (a, b) {
        this.yi(b);
    };
    AnnotationLayer.prototype.yd = function (a, b) {
        this.yf(b);
    };
    AnnotationLayer.prototype.zc = function () {
        if (this.u3 != null) {
            return this.u3;
        }
        return this.u9;
    };
    AnnotationLayer.prototype.zd = function () {
        if (this.u7 != null) {
            return this.u7;
        }
        return this.vp;
    };
    AnnotationLayer.prototype.yf = function (a) {
        var e_5, _a, e_6, _b;
        if (a.oldItems != null) {
            try {
                for (var _c = __values(fromEn(a.oldItems)), _d = _c.next(); !_d.done; _d = _c.next()) {
                    var b = _d.value;
                    b.renderRequested = delegateRemove(b.renderRequested, runOn(this, this.ye));
                }
            }
            catch (e_5_1) {
                e_5 = { error: e_5_1 };
            }
            finally {
                try {
                    if (_d && !_d.done && (_a = _c.return))
                        _a.call(_c);
                }
                finally {
                    if (e_5)
                        throw e_5.error;
                }
            }
        }
        if (a.newItems != null) {
            try {
                for (var _e = __values(fromEn(a.newItems)), _f = _e.next(); !_f.done; _f = _e.next()) {
                    var c = _f.value;
                    c.renderRequested = delegateCombine(c.renderRequested, runOn(this, this.ye));
                }
            }
            catch (e_6_1) {
                e_6 = { error: e_6_1 };
            }
            finally {
                try {
                    if (_f && !_f.done && (_b = _e.return))
                        _b.call(_e);
                }
                finally {
                    if (e_6)
                        throw e_6.error;
                }
            }
        }
        this.rn(true);
    };
    AnnotationLayer.prototype.yi = function (a) {
        var e_7, _a, e_8, _b;
        if (a.oldItems != null) {
            try {
                for (var _c = __values(fromEn(a.oldItems)), _d = _c.next(); !_d.done; _d = _c.next()) {
                    var b = _d.value;
                    b.renderRequested = delegateRemove(b.renderRequested, runOn(this, this.yo));
                }
            }
            catch (e_7_1) {
                e_7 = { error: e_7_1 };
            }
            finally {
                try {
                    if (_d && !_d.done && (_a = _c.return))
                        _a.call(_c);
                }
                finally {
                    if (e_7)
                        throw e_7.error;
                }
            }
        }
        if (a.newItems != null) {
            try {
                for (var _e = __values(fromEn(a.newItems)), _f = _e.next(); !_f.done; _f = _e.next()) {
                    var c = _f.value;
                    c.renderRequested = delegateCombine(c.renderRequested, runOn(this, this.yo));
                }
            }
            catch (e_8_1) {
                e_8 = { error: e_8_1 };
            }
            finally {
                try {
                    if (_f && !_f.done && (_b = _e.return))
                        _b.call(_e);
                }
                finally {
                    if (e_8)
                        throw e_8.error;
                }
            }
        }
        this.rn(true);
    };
    AnnotationLayer.prototype.sl = function (a, b) {
        this.rn(false);
    };
    AnnotationLayer.prototype.sk = function (a, b) {
        this.rn(true);
    };
    AnnotationLayer.prototype.ro = function (a) {
        _super.prototype.ro.call(this, a);
        if (this.d3(this.ct)) {
            return;
        }
        if (this.gd(a) && !this.gp) {
            var b = this.w4;
            if (this.d1()) {
                if (this.da.g) {
                    this.da.t();
                }
                this.w4 = this.w5;
                this.w5 = b;
            }
            else {
                this.w4 = this.w3;
                this.w3 = b;
            }
            this.yj(this.w3, this.ct);
            this.r1();
        }
        else {
            if (!this.gp) {
                this.yj(this.w3, this.ct);
            }
            this.ym(this.w3, this.ct);
        }
    };
    AnnotationLayer.prototype.get_eq = function () {
        return true;
    };
    AnnotationLayer.prototype.yj = function (a, b) {
    };
    AnnotationLayer.prototype.ym = function (a, b) {
        this.qt();
        this.w2.b4();
    };
    AnnotationLayer.prototype.yc = function (a) {
        var b = { $type: Point_$type, x: this.zm.x, y: this.zm.y };
        if (a.isVertical) {
            if (isNaN_(this.zm.y)) {
                return new Tuple$2(Boolean_$type, Point_$type, false, b);
            }
            if (isNaN_(this.zm.x)) {
                b.x = 0;
                return new Tuple$2(Boolean_$type, Point_$type, true, b);
            }
        }
        else {
            if (isNaN_(this.zm.x)) {
                return new Tuple$2(Boolean_$type, Point_$type, false, b);
            }
            if (isNaN_(this.zm.y)) {
                b.y = 0;
                return new Tuple$2(Boolean_$type, Point_$type, true, b);
            }
        }
        return new Tuple$2(Boolean_$type, Point_$type, true, b);
    };
    AnnotationLayer.prototype.qn = function (a) {
        _super.prototype.qn.call(this, a);
        if (isNaN_(this.zo.x) && isNaN_(this.zo.y)) {
            if (isNaN_(a.x) && isNaN_(a.y)) {
                this.w2.b3();
                return;
            }
            else {
                this.w2.b5();
                this.zm = a;
            }
        }
        else {
            this.w2.b5();
            this.zm = this.zo;
        }
        this.rn(true);
    };
    AnnotationLayer.prototype.hc = function (a, b, c) {
        var d = _super.prototype.hc.call(this, a, b, c);
        if (this.c9 == null) {
            return false;
        }
        if (!this.ct.t()) {
            d = false;
            return d;
        }
        return d;
    };
    AnnotationLayer.prototype.xn = function () {
        if (isNaN_(this.xq)) {
            switch (this.wq) {
                case 1: return this.xh();
                case 2: return this.xk();
                case 4: return this.xj();
            }
        }
        return this.xq;
    };
    AnnotationLayer.prototype.xm = function () {
        if (isNaN_(this.xp)) {
            return this.xf;
        }
        return this.xp;
    };
    AnnotationLayer.prototype.xo = function () {
        if (isNaN_(this.xr)) {
            return this.xf;
        }
        return this.xr;
    };
    AnnotationLayer.prototype.wx = function () {
        switch (this.wt) {
            case 0: return this.wu();
        }
        return this.wt;
    };
    AnnotationLayer.prototype.wy = function () {
        switch (this.w0) {
            case 0: return this.wq;
        }
        return this.w0;
    };
    AnnotationLayer.prototype.wz = function () {
        switch (this.w1) {
            case 0: return this.wq;
        }
        return this.w1;
    };
    AnnotationLayer.prototype.zi = function () {
        if (this.zk == null) {
            if (this.vw == null) {
                return this.zg();
            }
            return this.vw;
        }
        return this.zk;
    };
    AnnotationLayer.prototype.zj = function () {
        if (this.zl == null) {
            if (this.vw == null) {
                return this.zh();
            }
            return this.vw;
        }
        return this.zl;
    };
    AnnotationLayer.prototype.wu = function () {
        return 0;
    };
    AnnotationLayer.prototype.wv = function () {
        return this.wu();
    };
    AnnotationLayer.prototype.ww = function () {
        return this.wu();
    };
    AnnotationLayer.prototype.xh = function () {
        return NaN;
    };
    AnnotationLayer.prototype.xk = function () {
        return NaN;
    };
    AnnotationLayer.prototype.xj = function () {
        return NaN;
    };
    AnnotationLayer.prototype.xi = function () {
        return NaN;
    };
    AnnotationLayer.prototype.xl = function () {
        return NaN;
    };
    AnnotationLayer.prototype.zg = function () {
        return null;
    };
    AnnotationLayer.prototype.zh = function () {
        return null;
    };
    AnnotationLayer.prototype.yr = function () {
        this.wq = this.wx();
        this.xf = this.xn();
        this.wr = this.wy();
        this.xe = this.xm();
        this.ws = this.wz();
        this.xg = this.xo();
        this.ze = this.zi();
        this.zf = this.zj();
    };
    AnnotationLayer.prototype.get_g8 = function () {
        return this.xb;
    };
    Object.defineProperty(AnnotationLayer.prototype, "xb", {
        get: function () {
            return this.w6;
        },
        set: function (a) {
            var b = this.w6;
            this.w6 = a;
            this.raisePropertyChanged("ShouldRenderAsOverlay", b, this.w6);
        },
        enumerable: false,
        configurable: true
    });
    AnnotationLayer.$t = markType(AnnotationLayer, 'AnnotationLayer', Series.$);
    AnnotationLayer.$$p = markDep(DependencyProperty, PropertyMetadata, AnnotationLayer, 'raisePropertyChanged', ['ActualAppearanceMode:wq:ys', [AnnotationAppearanceMode_$type, enumGetBox(AnnotationAppearanceMode_$type, 0)], 'ActualHorizontalAppearanceMode:wr:yt', [AnnotationAppearanceMode_$type, enumGetBox(AnnotationAppearanceMode_$type, 0)], 'ActualHorizontalDashArray:ze:yu', [DoubleCollection.$], 'ActualHorizontalShiftAmount:xe:yv', [1, NaN], 'ActualShiftAmount:xf:yw', [1, NaN], 'ActualVerticalAppearanceMode:ws:yx', [AnnotationAppearanceMode_$type, enumGetBox(AnnotationAppearanceMode_$type, 0)], 'ActualVerticalDashArray:zf:yy', [DoubleCollection.$], 'ActualVerticalShiftAmount:xg:yz', [1, NaN], 'AppearanceMode:wt:y0', [AnnotationAppearanceMode_$type, enumGetBox(AnnotationAppearanceMode_$type, 0)], 'CursorPosition:zn:y1', [Point_$type, { $type: Point_$type, x: NaN, y: NaN }], 'HorizontalAppearanceMode:w0:y2', [AnnotationAppearanceMode_$type, enumGetBox(AnnotationAppearanceMode_$type, 0)], 'HorizontalDashArray:zk:y3', [DoubleCollection.$], 'HorizontalShiftAmount:xp:y4', [1, NaN], 'IsDefaultCrosshairDisabled:w7:y5', [0, true], 'ShiftAmount:xq:y6', [1, NaN], 'UseIndex:xc:y7', [0, false], 'UseLegend:xd:y8', [0, false], 'VerticalAppearanceMode:w1:y9', [AnnotationAppearanceMode_$type, enumGetBox(AnnotationAppearanceMode_$type, 0)], 'VerticalDashArray:zl:za', [DoubleCollection.$], 'VerticalShiftAmount:xr:zb', [1, NaN]]);
    return AnnotationLayer;
}(Series));
export { AnnotationLayer };
/**
 * @hidden
 */
var AnnotationLayerView = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(AnnotationLayerView, _super);
    function AnnotationLayerView(a) {
        var _this = _super.call(this, a) || this;
        _this.b0 = null;
        _this.b1 = false;
        _this.b2 = -1;
        _this.b0 = a;
        return _this;
    }
    AnnotationLayerView.prototype.b6 = function () {
        if (this.b1) {
            this.b1 = false;
            this.b2 = -1;
            this.b0.zm = { $type: Point_$type, x: NaN, y: NaN };
            this.b0.rn(true);
        }
    };
    AnnotationLayerView.prototype.b3 = function () {
        this.b1 = true;
        if (this.e.jx != null) {
            this.e.jx.setTimeout(runOn(this, this.b6), 300);
        }
        else {
            this.b2 = window.setTimeout(runOn(this, this.b6), 300);
        }
    };
    AnnotationLayerView.prototype.b5 = function () {
        if (this.b1 == true) {
            this.b1 = false;
            if (this.b2 != -1) {
                window.clearTimeout(this.b2);
                this.b2 = -1;
            }
        }
    };
    AnnotationLayerView.prototype.b4 = function () {
        this.as();
    };
    AnnotationLayerView.$t = markType(AnnotationLayerView, 'AnnotationLayerView', SeriesView.$);
    return AnnotationLayerView;
}(SeriesView));
export { AnnotationLayerView };
