/*
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/ES2015/DependencyProperty";
import { Type, Point_$type, Boolean_$type, runOn, delegateRemove, typeCast, delegateCombine, fromEnum, fromEn, markType } from "igniteui-angular-core/ES2015/type";
import { SeriesView } from "./SeriesView";
import { XamDataChart } from "./XamDataChart";
import { Tuple$2 } from "igniteui-angular-core/ES2015/Tuple$2";
import { PropertyMetadata } from "igniteui-angular-core/ES2015/PropertyMetadata";
import { isNaN_ } from "igniteui-angular-core/ES2015/number";
/**
 * @hidden
 */
export class AnnotationLayer extends Series {
    constructor() {
        super();
        this.m2 = null;
        this.l1 = null;
        this.l0 = null;
        this.l2 = null;
        this.m0 = { $type: Point_$type, x: NaN, y: NaN };
        this.l3 = false;
        this.m2 = { $type: Point_$type, x: NaN, y: NaN };
    }
    bf() {
        return new AnnotationLayerView(this);
    }
    it(a) {
        super.it(a);
        this.lz = a;
    }
    l7(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.l4;
    }
    bd() {
        if (this.be == 0) {
            return 1;
        }
        else {
            return super.bd();
        }
    }
    get_cw() {
        return this.l9 || this.ma;
    }
    get_isUsableInLegend() {
        return this.ma;
    }
    iy(a, b, c, d) {
        super.iy(a, b, c, d);
        switch (b) {
            case "SeriesViewer":
                let e = c;
                let f = d;
                if (e != null) {
                    this.mt(e.series);
                    let g = e.series;
                    g.collectionChanged = delegateRemove(g.collectionChanged, runOn(this, this.mq));
                    if (typeCast(XamDataChart.$, e) !== null) {
                        let h = e;
                        this.ms(h.axes);
                        let i = h.axes;
                        i.collectionChanged = delegateRemove(i.collectionChanged, runOn(this, this.mg));
                    }
                }
                if (f != null) {
                    this.mo(f.series);
                    let j = f.series;
                    j.collectionChanged = delegateCombine(j.collectionChanged, runOn(this, this.mq));
                    if (typeCast(XamDataChart.$, f) !== null) {
                        let k = f;
                        this.mn(k.axes);
                        let l = k.axes;
                        l.collectionChanged = delegateCombine(l.collectionChanged, runOn(this, this.mg));
                    }
                }
                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.k2 = null;
                    this.k3 = null;
                }
                if (this.bs != null) {
                    this.bs.ii();
                }
                this.jc(true);
                break;
            case "TransitionProgress":
                this.l2.c(this.ez, this.l1, this.l0);
                if (this.cc(this.bi)) {
                    return;
                }
                if (this.ez == 1) {
                    this.mp(this.l0, this.bi);
                }
                else {
                    this.mp(this.l2, 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.m2 = this.m1;
                this.io(this.m1);
                break;
            case "ShouldRenderAsOverlay":
                if (this.bs != null) {
                    this.bi.ah(this.bs);
                    this.bi.ad(this.bs);
                }
                break;
        }
    }
    mt(a) {
        for (let b of fromEnum(a)) {
            if (!(b == this)) {
                b.renderRequested = delegateRemove(b.renderRequested, runOn(this, this.mr));
            }
        }
        this.jc(true);
    }
    ms(a) {
        for (let b of fromEnum(a)) {
            b.renderRequested = delegateRemove(b.renderRequested, runOn(this, this.mh));
        }
        this.jc(true);
    }
    mo(a) {
        for (let b of fromEnum(a)) {
            if (!(b == this)) {
                b.renderRequested = delegateCombine(b.renderRequested, runOn(this, this.mr));
            }
        }
        this.jc(true);
    }
    mn(a) {
        for (let b of fromEnum(a)) {
            b.renderRequested = delegateCombine(b.renderRequested, runOn(this, this.mh));
        }
        this.jc(true);
    }
    l5(a) {
        if (a == null) {
            return false;
        }
        return true;
    }
    mh(a, b) {
        if (this.l5(a)) {
            this.mj(a, b.animate);
        }
    }
    l6(a) {
        if (a == null) {
            return false;
        }
        if (a.cj) {
            return false;
        }
        return true;
    }
    mr(a, b) {
        if (this.l6(a)) {
            this.mk(a, b.animate);
        }
    }
    mj(a, b) {
    }
    mk(a, b) {
    }
    mq(a, b) {
        this.ml(b);
    }
    mg(a, b) {
        this.mi(b);
    }
    my() {
        if (this.k2 != null) {
            return this.k2;
        }
        return this.k4;
    }
    mz() {
        if (this.k3 != null) {
            return this.k3;
        }
        return this.k7;
    }
    mi(a) {
        if (a.oldItems != null) {
            for (let b of fromEn(a.oldItems)) {
                b.renderRequested = delegateRemove(b.renderRequested, runOn(this, this.mh));
            }
        }
        if (a.newItems != null) {
            for (let c of fromEn(a.newItems)) {
                c.renderRequested = delegateCombine(c.renderRequested, runOn(this, this.mh));
            }
        }
        this.jc(true);
    }
    ml(a) {
        if (a.oldItems != null) {
            for (let b of fromEn(a.oldItems)) {
                b.renderRequested = delegateRemove(b.renderRequested, runOn(this, this.mr));
            }
        }
        if (a.newItems != null) {
            for (let c of fromEn(a.newItems)) {
                c.renderRequested = delegateCombine(c.renderRequested, runOn(this, this.mr));
            }
        }
        this.jc(true);
    }
    js(a, b) {
        this.jc(false);
    }
    jr(a, b) {
        this.jc(true);
    }
    jd(a) {
        super.jd(a);
        if (this.cc(this.bi)) {
            return;
        }
        if (this.da(a) && !this.de) {
            let b = this.l1;
            if (this.ca()) {
                if (this.bt.g) {
                    this.bt.t();
                }
                this.l1 = this.l2;
                this.l2 = b;
            }
            else {
                this.l1 = this.l0;
                this.l0 = b;
            }
            this.mm(this.l0, this.bi);
            this.jk();
        }
        else {
            if (!this.de) {
                this.mm(this.l0, this.bi);
            }
            this.mp(this.l0, this.bi);
        }
    }
    get_cj() {
        return true;
    }
    mm(a, b) {
    }
    mp(a, b) {
        this.lz.by();
    }
    mf(a) {
        let b = { $type: Point_$type, x: this.m0.x, y: this.m0.y };
        if (a.isVertical) {
            if (isNaN_(this.m0.y)) {
                return new Tuple$2(Boolean_$type, Point_$type, false, b);
            }
            if (isNaN_(this.m0.x)) {
                b.x = 0;
                return new Tuple$2(Boolean_$type, Point_$type, true, b);
            }
        }
        else {
            if (isNaN_(this.m0.x)) {
                return new Tuple$2(Boolean_$type, Point_$type, false, b);
            }
            if (isNaN_(this.m0.y)) {
                b.y = 0;
                return new Tuple$2(Boolean_$type, Point_$type, true, b);
            }
        }
        return new Tuple$2(Boolean_$type, Point_$type, true, b);
    }
    io(a) {
        super.io(a);
        if (isNaN_(this.m2.x) && isNaN_(this.m2.y)) {
            if (isNaN_(a.x) && isNaN_(a.y)) {
                this.lz.bx();
                return;
            }
            else {
                this.lz.bz();
                this.m0 = a;
            }
        }
        else {
            this.lz.bz();
            this.m0 = this.m2;
        }
        this.jc(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.l8;
    }
    get l8() {
        return this.l3;
    }
    set l8(a) {
        let b = this.l3;
        this.l3 = a;
        this.raisePropertyChanged("ShouldRenderAsOverlay", b, this.l3);
    }
}
AnnotationLayer.$t = markType(AnnotationLayer, 'AnnotationLayer', Series.$);
Type.dep(DependencyProperty, PropertyMetadata, AnnotationLayer, 'raisePropertyChanged', ['CursorPosition:m1:mu', [Point_$type, { $type: Point_$type, x: NaN, y: NaN }], 'IsDefaultCrosshairDisabled:l4:mv', [0, true], 'UseIndex:l9:mw', [0, false], 'UseLegend:ma:mx', [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.m0 = { $type: Point_$type, x: NaN, y: NaN };
            this.bu.jc(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