/*
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-angular-core";
import { Point_$type, Boolean_$type, runOn, delegateRemove, typeCast, delegateCombine, fromEnum, fromEn, markType, markDep } from "igniteui-angular-core";
import { SeriesView } from "./SeriesView";
import { XamDataChart } from "./XamDataChart";
import { Tuple$2 } from "igniteui-angular-core";
import { PropertyMetadata } from "igniteui-angular-core";
import { isNaN_ } from "igniteui-angular-core";
/**
 * @hidden
 */
export class AnnotationLayer extends Series {
    constructor() {
        super();
        this.m3 = null;
        this.l2 = null;
        this.l1 = null;
        this.l3 = null;
        this.m1 = { $type: Point_$type, x: NaN, y: NaN };
        this.l4 = false;
        this.m3 = { $type: Point_$type, x: NaN, y: NaN };
    }
    bf() {
        return new AnnotationLayerView(this);
    }
    iu(a) {
        super.iu(a);
        this.l0 = a;
    }
    l8(a) {
        if (a == null) {
            return false;
        }
        if (a.cj) {
            return false;
        }
        if (a.c6) {
            return false;
        }
        if (a == this) {
            return false;
        }
        return a.dw(a.bi.br, a.bi.bs, a.bi);
    }
    get_cm() {
        return this.l5;
    }
    bd() {
        if (this.be == 0) {
            return 1;
        }
        else {
            return super.bd();
        }
    }
    get_cw() {
        return this.ma || this.mb;
    }
    get_isUsableInLegend() {
        return this.mb;
    }
    iz(a, b, c, d) {
        super.iz(a, b, c, d);
        switch (b) {
            case "SeriesViewer":
                let e = c;
                let f = d;
                if (e != null) {
                    this.mu(e.series);
                    let g = e.series;
                    g.collectionChanged = delegateRemove(g.collectionChanged, runOn(this, this.mr));
                    if (typeCast(XamDataChart.$, e) !== null) {
                        let h = e;
                        this.mt(h.axes);
                        let i = h.axes;
                        i.collectionChanged = delegateRemove(i.collectionChanged, runOn(this, this.mh));
                    }
                }
                if (f != null) {
                    this.mp(f.series);
                    let j = f.series;
                    j.collectionChanged = delegateCombine(j.collectionChanged, runOn(this, this.mr));
                    if (typeCast(XamDataChart.$, f) !== null) {
                        let k = f;
                        this.mo(k.axes);
                        let l = k.axes;
                        l.collectionChanged = delegateCombine(l.collectionChanged, runOn(this, this.mh));
                    }
                }
                break;
            case AnnotationLayer.$$p[3]:
            case AnnotationLayer.$$p[2]:
                if (this.cw) {
                    if (this.fh == -1) {
                        this.fh = XamDataChart.od(this);
                    }
                }
                else {
                    this.fh = -1;
                    this.k3 = null;
                    this.k4 = null;
                }
                if (this.bs != null) {
                    this.bs.ii();
                }
                this.jd(true);
                break;
            case "TransitionProgress":
                this.l3.c(this.ez, this.l2, this.l1);
                if (this.cc(this.bi)) {
                    return;
                }
                if (this.ez == 1) {
                    this.mq(this.l1, this.bi);
                }
                else {
                    this.mq(this.l3, this.bi);
                }
                if (this.bs != null) {
                    this.bs.jj(this);
                }
                break;
            case AnnotationLayer.$$p[1]:
                if (this.bs != null) {
                    this.bs.ig();
                }
                break;
            case AnnotationLayer.$$p[0]:
                this.m3 = this.m2;
                this.ip(this.m2);
                break;
            case "ShouldRenderAsOverlay":
                if (this.bs != null) {
                    this.bi.ah(this.bs);
                    this.bi.ad(this.bs);
                }
                break;
        }
    }
    mu(a) {
        for (let b of fromEnum(a)) {
            if (!(b == this)) {
                b.renderRequested = delegateRemove(b.renderRequested, runOn(this, this.ms));
            }
        }
        this.jd(true);
    }
    mt(a) {
        for (let b of fromEnum(a)) {
            b.renderRequested = delegateRemove(b.renderRequested, runOn(this, this.mi));
        }
        this.jd(true);
    }
    mp(a) {
        for (let b of fromEnum(a)) {
            if (!(b == this)) {
                b.renderRequested = delegateCombine(b.renderRequested, runOn(this, this.ms));
            }
        }
        this.jd(true);
    }
    mo(a) {
        for (let b of fromEnum(a)) {
            b.renderRequested = delegateCombine(b.renderRequested, runOn(this, this.mi));
        }
        this.jd(true);
    }
    l6(a) {
        if (a == null) {
            return false;
        }
        return true;
    }
    mi(a, b) {
        if (this.l6(a)) {
            this.mk(a, b.animate);
        }
    }
    l7(a) {
        if (a == null) {
            return false;
        }
        if (a.cj) {
            return false;
        }
        return true;
    }
    ms(a, b) {
        if (this.l7(a)) {
            this.ml(a, b.animate);
        }
    }
    mk(a, b) {
    }
    ml(a, b) {
    }
    mr(a, b) {
        this.mm(b);
    }
    mh(a, b) {
        this.mj(b);
    }
    mz() {
        if (this.k3 != null) {
            return this.k3;
        }
        return this.k5;
    }
    m0() {
        if (this.k4 != null) {
            return this.k4;
        }
        return this.k8;
    }
    mj(a) {
        if (a.oldItems != null) {
            for (let b of fromEn(a.oldItems)) {
                b.renderRequested = delegateRemove(b.renderRequested, runOn(this, this.mi));
            }
        }
        if (a.newItems != null) {
            for (let c of fromEn(a.newItems)) {
                c.renderRequested = delegateCombine(c.renderRequested, runOn(this, this.mi));
            }
        }
        this.jd(true);
    }
    mm(a) {
        if (a.oldItems != null) {
            for (let b of fromEn(a.oldItems)) {
                b.renderRequested = delegateRemove(b.renderRequested, runOn(this, this.ms));
            }
        }
        if (a.newItems != null) {
            for (let c of fromEn(a.newItems)) {
                c.renderRequested = delegateCombine(c.renderRequested, runOn(this, this.ms));
            }
        }
        this.jd(true);
    }
    jt(a, b) {
        this.jd(false);
    }
    js(a, b) {
        this.jd(true);
    }
    je(a) {
        super.je(a);
        if (this.cc(this.bi)) {
            return;
        }
        if (this.da(a) && !this.de) {
            let b = this.l2;
            if (this.ca()) {
                if (this.bt.g) {
                    this.bt.t();
                }
                this.l2 = this.l3;
                this.l3 = b;
            }
            else {
                this.l2 = this.l1;
                this.l1 = b;
            }
            this.mn(this.l1, this.bi);
            this.jl();
        }
        else {
            if (!this.de) {
                this.mn(this.l1, this.bi);
            }
            this.mq(this.l1, this.bi);
        }
    }
    get_cj() {
        return true;
    }
    mn(a, b) {
    }
    mq(a, b) {
        this.l0.by();
    }
    mg(a) {
        let b = { $type: Point_$type, x: this.m1.x, y: this.m1.y };
        if (a.isVertical) {
            if (isNaN_(this.m1.y)) {
                return new Tuple$2(Boolean_$type, Point_$type, false, b);
            }
            if (isNaN_(this.m1.x)) {
                b.x = 0;
                return new Tuple$2(Boolean_$type, Point_$type, true, b);
            }
        }
        else {
            if (isNaN_(this.m1.x)) {
                return new Tuple$2(Boolean_$type, Point_$type, false, b);
            }
            if (isNaN_(this.m1.y)) {
                b.y = 0;
                return new Tuple$2(Boolean_$type, Point_$type, true, b);
            }
        }
        return new Tuple$2(Boolean_$type, Point_$type, true, b);
    }
    ip(a) {
        super.ip(a);
        if (isNaN_(this.m3.x) && isNaN_(this.m3.y)) {
            if (isNaN_(a.x) && isNaN_(a.y)) {
                this.l0.bx();
                return;
            }
            else {
                this.l0.bz();
                this.m1 = a;
            }
        }
        else {
            this.l0.bz();
            this.m1 = this.m3;
        }
        this.jd(true);
    }
    dw(a, b, c) {
        let d = super.dw(a, b, c);
        if (!this.bi.q()) {
            return d = false;
        }
        return d;
    }
    get_ds() {
        return this.l9;
    }
    get l9() {
        return this.l4;
    }
    set l9(a) {
        let b = this.l4;
        this.l4 = a;
        this.raisePropertyChanged("ShouldRenderAsOverlay", b, this.l4);
    }
}
AnnotationLayer.$t = markType(AnnotationLayer, 'AnnotationLayer', Series.$);
AnnotationLayer.$$p = markDep(DependencyProperty, PropertyMetadata, AnnotationLayer, 'raisePropertyChanged', ['CursorPosition:m2:mv', [Point_$type, { $type: Point_$type, x: NaN, y: NaN }], 'IsDefaultCrosshairDisabled:l5:mw', [0, true], 'UseIndex:ma:mx', [0, false], 'UseLegend:mb:my', [0, false]]);
/**
 * @hidden
 */
export class AnnotationLayerView extends SeriesView {
    constructor(a) {
        super(a);
        this.bu = null;
        this.bv = false;
        this.bw = -1;
        this.bu = a;
    }
    b0() {
        if (this.bv) {
            this.bv = false;
            this.bw = -1;
            this.bu.m1 = { $type: Point_$type, x: NaN, y: NaN };
            this.bu.jd(true);
        }
    }
    bx() {
        this.bv = true;
        if (this.e.e4 != null) {
            this.e.e4.setTimeout(runOn(this, this.b0), 300);
        }
        else {
            this.bw = window.setTimeout(runOn(this, this.b0), 300);
        }
    }
    bz() {
        if (this.bv == true) {
            this.bv = false;
            if (this.bw != -1) {
                window.clearTimeout(this.bw);
                this.bw = -1;
            }
        }
    }
    by() {
        this.an();
    }
}
AnnotationLayerView.$t = markType(AnnotationLayerView, 'AnnotationLayerView', SeriesView.$);
//# sourceMappingURL=AnnotationLayer_combined.js.map