/*
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 { 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
 */
export let AnnotationLayer = /*@__PURE__*/ (() => {
    class AnnotationLayer extends Series {
        constructor() {
            super();
            this.w1 = null;
            this.uh = null;
            this.ug = null;
            this.ui = null;
            this.wz = { $type: Point_$type, x: NaN, y: NaN };
            this.uj = false;
            this.w1 = { $type: Point_$type, x: NaN, y: NaN };
            this.v4();
        }
        cd() {
            return new AnnotationLayerView(this);
        }
        o2(a) {
            super.o2(a);
            this.uf = a;
        }
        un(a) {
            if (a == null) {
                return false;
            }
            if (a.d7) {
                return false;
            }
            if (a.isValueOverlay) {
                return false;
            }
            if (a == this) {
                return false;
            }
            return a.gm(a.cg.bx, a.cg.by, a.cg);
        }
        get_eg() {
            return this.uk;
        }
        bu() {
            if (this.bv == 0) {
                return 1;
            }
            else {
                return super.bu();
            }
        }
        get_eu() {
            return this.up || this.uq;
        }
        get_isUsableInLegend() {
            return this.uq;
        }
        pa(a, b, c, d) {
            super.pa(a, b, c, d);
            switch (b) {
                case "SeriesViewer":
                    let e = c;
                    let f = d;
                    if (e != null) {
                        this.v3(e.series);
                        let g = e.series;
                        g.collectionChanged = delegateRemove(g.collectionChanged, runOn(this, this.v0));
                        if (typeCast(XamDataChart.$, e) !== null) {
                            let h = e;
                            this.v2(h.axes);
                            let i = h.axes;
                            i.collectionChanged = delegateRemove(i.collectionChanged, runOn(this, this.vq));
                        }
                    }
                    if (f != null) {
                        this.vy(f.series);
                        let j = f.series;
                        j.collectionChanged = delegateCombine(j.collectionChanged, runOn(this, this.v0));
                        if (typeCast(XamDataChart.$, f) !== null) {
                            let k = f;
                            this.vx(k.axes);
                            let l = k.axes;
                            l.collectionChanged = delegateCombine(l.collectionChanged, runOn(this, this.vq));
                        }
                    }
                    break;
                case AnnotationLayer.$$p[16]:
                case AnnotationLayer.$$p[15]:
                    if (this.eu) {
                        if (this.index == -1) {
                            this.index = XamDataChart.wd(this);
                        }
                    }
                    else {
                        this.index = -1;
                        this.su = null;
                        this.sx = null;
                    }
                    if (this.cv != null) {
                        this.cv.nk();
                    }
                    this.pr(true);
                    break;
                case "TransitionProgress":
                    this.ui.c(this.iw, this.uh, this.ug);
                    if (this.dm(this.cg)) {
                        return;
                    }
                    if (this.iw == 1) {
                        this.vz(this.ug, this.cg);
                        this.op();
                    }
                    else {
                        this.vz(this.ui, this.cg);
                    }
                    if (this.cv != null) {
                        this.cv.or(this);
                    }
                    break;
                case AnnotationLayer.$$p[13]:
                    if (this.cv != null) {
                        this.cv.ni();
                    }
                    break;
                case AnnotationLayer.$$p[9]:
                    this.w1 = this.w0;
                    this.os(this.w0);
                    break;
                case "ShouldRenderAsOverlay":
                    if (this.cv != null) {
                        this.cg.al(this.cv);
                        this.cg.ag(this.cv);
                    }
                    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.v4();
                    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.pr(true);
                    break;
            }
        }
        v3(a) {
            for (let b of fromEnum(a)) {
                if (!(b == this)) {
                    b.renderRequested = delegateRemove(b.renderRequested, runOn(this, this.v1));
                }
            }
            this.pr(true);
        }
        v2(a) {
            for (let b of fromEnum(a)) {
                b.renderRequested = delegateRemove(b.renderRequested, runOn(this, this.vr));
            }
            this.pr(true);
        }
        vy(a) {
            for (let b of fromEnum(a)) {
                if (!(b == this)) {
                    b.renderRequested = delegateCombine(b.renderRequested, runOn(this, this.v1));
                }
            }
            this.pr(true);
        }
        vx(a) {
            for (let b of fromEnum(a)) {
                b.renderRequested = delegateCombine(b.renderRequested, runOn(this, this.vr));
            }
            this.pr(true);
        }
        ul(a) {
            if (a == null) {
                return false;
            }
            return true;
        }
        vr(a, b) {
            if (this.ul(a)) {
                this.vt(a, b.animate);
            }
        }
        um(a) {
            if (a == null) {
                return false;
            }
            if (a.d7) {
                return false;
            }
            return true;
        }
        v1(a, b) {
            if (this.um(a)) {
                this.vu(a, b.animate);
            }
        }
        vt(a, b) {
        }
        vu(a, b) {
        }
        v0(a, b) {
            this.vv(b);
        }
        vq(a, b) {
            this.vs(b);
        }
        wp() {
            if (this.su != null) {
                return this.su;
            }
            return this.sy;
        }
        wq() {
            if (this.sx != null) {
                return this.sx;
            }
            return this.s4;
        }
        vs(a) {
            if (a.oldItems != null) {
                for (let b of fromEn(a.oldItems)) {
                    b.renderRequested = delegateRemove(b.renderRequested, runOn(this, this.vr));
                }
            }
            if (a.newItems != null) {
                for (let c of fromEn(a.newItems)) {
                    c.renderRequested = delegateCombine(c.renderRequested, runOn(this, this.vr));
                }
            }
            this.pr(true);
        }
        vv(a) {
            if (a.oldItems != null) {
                for (let b of fromEn(a.oldItems)) {
                    b.renderRequested = delegateRemove(b.renderRequested, runOn(this, this.v1));
                }
            }
            if (a.newItems != null) {
                for (let c of fromEn(a.newItems)) {
                    c.renderRequested = delegateCombine(c.renderRequested, runOn(this, this.v1));
                }
            }
            this.pr(true);
        }
        qp(a, b) {
            this.pr(false);
        }
        qo(a, b) {
            this.pr(true);
        }
        ps(a) {
            super.ps(a);
            if (this.dm(this.cg)) {
                return;
            }
            if (this.fq(a) && !this.f1) {
                let b = this.uh;
                if (this.dk()) {
                    if (this.cw.g) {
                        this.cw.t();
                    }
                    this.uh = this.ui;
                    this.ui = b;
                }
                else {
                    this.uh = this.ug;
                    this.ug = b;
                }
                this.vw(this.ug, this.cg);
                this.p5();
            }
            else {
                if (!this.f1) {
                    this.vw(this.ug, this.cg);
                }
                this.vz(this.ug, this.cg);
            }
        }
        get_d7() {
            return true;
        }
        vw(a, b) {
        }
        vz(a, b) {
            this.oy();
            this.uf.b4();
        }
        vp(a) {
            let b = { $type: Point_$type, x: this.wz.x, y: this.wz.y };
            if (a.isVertical) {
                if (isNaN_(this.wz.y)) {
                    return new Tuple$2(Boolean_$type, Point_$type, false, b);
                }
                if (isNaN_(this.wz.x)) {
                    b.x = 0;
                    return new Tuple$2(Boolean_$type, Point_$type, true, b);
                }
            }
            else {
                if (isNaN_(this.wz.x)) {
                    return new Tuple$2(Boolean_$type, Point_$type, false, b);
                }
                if (isNaN_(this.wz.y)) {
                    b.y = 0;
                    return new Tuple$2(Boolean_$type, Point_$type, true, b);
                }
            }
            return new Tuple$2(Boolean_$type, Point_$type, true, b);
        }
        os(a) {
            super.os(a);
            if (isNaN_(this.w1.x) && isNaN_(this.w1.y)) {
                if (isNaN_(a.x) && isNaN_(a.y)) {
                    this.uf.b3();
                    return;
                }
                else {
                    this.uf.b5();
                    this.wz = a;
                }
            }
            else {
                this.uf.b5();
                this.wz = this.w1;
            }
            this.pr(true);
        }
        gm(a, b, c) {
            let d = super.gm(a, b, c);
            if (this.cv == null) {
                return false;
            }
            if (!this.cg.t()) {
                d = false;
                return d;
            }
            return d;
        }
        u0() {
            if (isNaN_(this.u3)) {
                switch (this.t3) {
                    case 1: return this.uu();
                    case 2: return this.ux();
                    case 4: return this.uw();
                }
            }
            return this.u3;
        }
        uz() {
            if (isNaN_(this.u2)) {
                return this.us;
            }
            return this.u2;
        }
        u1() {
            if (isNaN_(this.u4)) {
                return this.us;
            }
            return this.u4;
        }
        ua() {
            switch (this.t6) {
                case 0: return this.t7();
            }
            return this.t6;
        }
        ub() {
            switch (this.ud) {
                case 0: return this.t3;
            }
            return this.ud;
        }
        uc() {
            switch (this.ue) {
                case 0: return this.t3;
            }
            return this.ue;
        }
        wv() {
            if (this.wx == null) {
                if (this.s9 == null) {
                    return this.wt();
                }
                return this.s9;
            }
            return this.wx;
        }
        ww() {
            if (this.wy == null) {
                if (this.s9 == null) {
                    return this.wu();
                }
                return this.s9;
            }
            return this.wy;
        }
        t7() {
            return 0;
        }
        t8() {
            return this.t7();
        }
        t9() {
            return this.t7();
        }
        uu() {
            return NaN;
        }
        ux() {
            return NaN;
        }
        uw() {
            return NaN;
        }
        uv() {
            return NaN;
        }
        uy() {
            return NaN;
        }
        wt() {
            return null;
        }
        wu() {
            return null;
        }
        v4() {
            this.t3 = this.ua();
            this.us = this.u0();
            this.t4 = this.ub();
            this.ur = this.uz();
            this.t5 = this.uc();
            this.ut = this.u1();
            this.wr = this.wv();
            this.ws = this.ww();
        }
        get_gi() {
            return this.uo;
        }
        get uo() {
            return this.uj;
        }
        set uo(a) {
            let b = this.uj;
            this.uj = a;
            this.raisePropertyChanged("ShouldRenderAsOverlay", b, this.uj);
        }
    }
    AnnotationLayer.$t = /*@__PURE__*/ markType(AnnotationLayer, 'AnnotationLayer', Series.$);
    AnnotationLayer.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, AnnotationLayer, 'raisePropertyChanged', ['ActualAppearanceMode:t3:v5', [AnnotationAppearanceMode_$type, /*@__PURE__*/ enumGetBox(AnnotationAppearanceMode_$type, 0)], 'ActualHorizontalAppearanceMode:t4:v6', [AnnotationAppearanceMode_$type, /*@__PURE__*/ enumGetBox(AnnotationAppearanceMode_$type, 0)], 'ActualHorizontalDashArray:wr:v7', [DoubleCollection.$], 'ActualHorizontalShiftAmount:ur:v8', [1, NaN], 'ActualShiftAmount:us:v9', [1, NaN], 'ActualVerticalAppearanceMode:t5:wa', [AnnotationAppearanceMode_$type, /*@__PURE__*/ enumGetBox(AnnotationAppearanceMode_$type, 0)], 'ActualVerticalDashArray:ws:wb', [DoubleCollection.$], 'ActualVerticalShiftAmount:ut:wc', [1, NaN], 'AppearanceMode:t6:wd', [AnnotationAppearanceMode_$type, /*@__PURE__*/ enumGetBox(AnnotationAppearanceMode_$type, 0)], 'CursorPosition:w0:we', [Point_$type, { $type: Point_$type, x: NaN, y: NaN }], 'HorizontalAppearanceMode:ud:wf', [AnnotationAppearanceMode_$type, /*@__PURE__*/ enumGetBox(AnnotationAppearanceMode_$type, 0)], 'HorizontalDashArray:wx:wg', [DoubleCollection.$], 'HorizontalShiftAmount:u2:wh', [1, NaN], 'IsDefaultCrosshairDisabled:uk:wi', [0, true], 'ShiftAmount:u3:wj', [1, NaN], 'UseIndex:up:wk', [0, false], 'UseLegend:uq:wl', [0, false], 'VerticalAppearanceMode:ue:wm', [AnnotationAppearanceMode_$type, /*@__PURE__*/ enumGetBox(AnnotationAppearanceMode_$type, 0)], 'VerticalDashArray:wy:wn', [DoubleCollection.$], 'VerticalShiftAmount:u4:wo', [1, NaN]]);
    return AnnotationLayer;
})();
/**
 * @hidden
 */
export let AnnotationLayerView = /*@__PURE__*/ (() => {
    class AnnotationLayerView extends SeriesView {
        constructor(a) {
            super(a);
            this.b0 = null;
            this.b1 = false;
            this.b2 = -1;
            this.b0 = a;
        }
        b6() {
            if (this.b1) {
                this.b1 = false;
                this.b2 = -1;
                this.b0.wz = { $type: Point_$type, x: NaN, y: NaN };
                this.b0.pr(true);
            }
        }
        b3() {
            this.b1 = true;
            if (this.e.i5 != null) {
                this.e.i5.setTimeout(runOn(this, this.b6), 300);
            }
            else {
                this.b2 = window.setTimeout(runOn(this, this.b6), 300);
            }
        }
        b5() {
            if (this.b1 == true) {
                this.b1 = false;
                if (this.b2 != -1) {
                    window.clearTimeout(this.b2);
                    this.b2 = -1;
                }
            }
        }
        b4() {
            this.as();
        }
    }
    AnnotationLayerView.$t = /*@__PURE__*/ markType(AnnotationLayerView, 'AnnotationLayerView', SeriesView.$);
    return AnnotationLayerView;
})();
