/*
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.mt = null;
        this.lu = null;
        this.lt = null;
        this.lv = null;
        this.mr = { $type: Point_$type, x: NaN, y: NaN };
        this.lw = false;
        this.mt = { $type: Point_$type, x: NaN, y: NaN };
    }
    bf() {
        return new AnnotationLayerView(this);
    }
    im(a) {
        super.im(a);
        this.ls = a;
    }
    ly(a) {
        if (a == null) {
            return false;
        }
        if (a.cj) {
            return false;
        }
        if (a == this) {
            return false;
        }
        return a.dv(a.bi.br, a.bi.bs, a.bi);
    }
    get_cm() {
        return this.lx;
    }
    bd() {
        if (this.be == 0) {
            return 1;
        }
        else {
            return super.bd();
        }
    }
    get_cw() {
        return this.l0 || this.l1;
    }
    get_isUsableInLegend() {
        return this.l1;
    }
    is(a, b, c, d) {
        super.is(a, b, c, d);
        switch (b) {
            case "SeriesViewer":
                let e = c;
                let f = d;
                if (e != null) {
                    this.mk(e.series);
                    let g = e.series;
                    g.collectionChanged = delegateRemove(g.collectionChanged, runOn(this, this.mh));
                    if (typeCast(XamDataChart.$, e) !== null) {
                        let h = e;
                        this.mj(h.axes);
                        let i = h.axes;
                        i.collectionChanged = delegateRemove(i.collectionChanged, runOn(this, this.l7));
                    }
                }
                if (f != null) {
                    this.mf(f.series);
                    let j = f.series;
                    j.collectionChanged = delegateCombine(j.collectionChanged, runOn(this, this.mh));
                    if (typeCast(XamDataChart.$, f) !== null) {
                        let k = f;
                        this.me(k.axes);
                        let l = k.axes;
                        l.collectionChanged = delegateCombine(l.collectionChanged, runOn(this, this.l7));
                    }
                }
                break;
            case AnnotationLayer.$$p[3]:
            case AnnotationLayer.$$p[2]:
                if (this.cw) {
                    if (this.fe == -1) {
                        this.fe = XamDataChart.od(this);
                    }
                }
                else {
                    this.fe = -1;
                    this.kv = null;
                    this.kw = null;
                }
                if (this.bs != null) {
                    this.bs.ii();
                }
                this.i5(true);
                break;
            case "TransitionProgress":
                this.lv.c(this.ew, this.lu, this.lt);
                if (this.cc(this.bi)) {
                    return;
                }
                if (this.ew == 1) {
                    this.mg(this.lt, this.bi);
                }
                else {
                    this.mg(this.lv, 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.mt = this.ms;
                this.ih(this.ms);
                break;
            case "ShouldRenderAsOverlay":
                if (this.bs != null) {
                    this.bi.ah(this.bs);
                    this.bi.ad(this.bs);
                }
                break;
        }
    }
    mk(a) {
        for (let b of fromEnum(a)) {
            if (!(b == this)) {
                b.renderRequested = delegateRemove(b.renderRequested, runOn(this, this.mi));
            }
        }
        this.i5(true);
    }
    mj(a) {
        for (let b of fromEnum(a)) {
            b.renderRequested = delegateRemove(b.renderRequested, runOn(this, this.l8));
        }
        this.i5(true);
    }
    mf(a) {
        for (let b of fromEnum(a)) {
            if (!(b == this)) {
                b.renderRequested = delegateCombine(b.renderRequested, runOn(this, this.mi));
            }
        }
        this.i5(true);
    }
    me(a) {
        for (let b of fromEnum(a)) {
            b.renderRequested = delegateCombine(b.renderRequested, runOn(this, this.l8));
        }
        this.i5(true);
    }
    l8(a, b) {
        this.ma(a, b.animate);
    }
    mi(a, b) {
        this.mb(a, b.animate);
    }
    ma(a, b) {
    }
    mb(a, b) {
    }
    mh(a, b) {
        this.mc(b);
    }
    l7(a, b) {
        this.l9(b);
    }
    mp() {
        if (this.kv != null) {
            return this.kv;
        }
        return this.kx;
    }
    mq() {
        if (this.kw != null) {
            return this.kw;
        }
        return this.k0;
    }
    l9(a) {
        if (a.oldItems != null) {
            for (let b of fromEn(a.oldItems)) {
                b.renderRequested = delegateRemove(b.renderRequested, runOn(this, this.l8));
            }
        }
        if (a.newItems != null) {
            for (let c of fromEn(a.newItems)) {
                c.renderRequested = delegateCombine(c.renderRequested, runOn(this, this.l8));
            }
        }
        this.i5(true);
    }
    mc(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.i5(true);
    }
    jl(a, b) {
        this.i5(false);
    }
    jk(a, b) {
        this.i5(true);
    }
    i6(a) {
        super.i6(a);
        if (this.cc(this.bi)) {
            return;
        }
        if (this.c9(a) && !this.dd) {
            let b = this.lu;
            if (this.ca()) {
                if (this.bt.g) {
                    this.bt.t();
                }
                this.lu = this.lv;
                this.lv = b;
            }
            else {
                this.lu = this.lt;
                this.lt = b;
            }
            this.md(this.lt, this.bi);
            this.jd();
        }
        else {
            if (!this.dd) {
                this.md(this.lt, this.bi);
            }
            this.mg(this.lt, this.bi);
        }
    }
    get_cj() {
        return true;
    }
    md(a, b) {
    }
    mg(a, b) {
        this.ls.by();
    }
    l6(a) {
        let b = { $type: Point_$type, x: this.mr.x, y: this.mr.y };
        if (a.isVertical) {
            if (isNaN_(this.mr.y)) {
                return new Tuple$2(Boolean_$type, Point_$type, false, b);
            }
            if (isNaN_(this.mr.x)) {
                b.x = 0;
                return new Tuple$2(Boolean_$type, Point_$type, true, b);
            }
        }
        else {
            if (isNaN_(this.mr.x)) {
                return new Tuple$2(Boolean_$type, Point_$type, false, b);
            }
            if (isNaN_(this.mr.y)) {
                b.y = 0;
                return new Tuple$2(Boolean_$type, Point_$type, true, b);
            }
        }
        return new Tuple$2(Boolean_$type, Point_$type, true, b);
    }
    ih(a) {
        super.ih(a);
        if (isNaN_(this.mt.x) && isNaN_(this.mt.y)) {
            if (isNaN_(a.x) && isNaN_(a.y)) {
                this.ls.bx();
                return;
            }
            else {
                this.ls.bz();
                this.mr = a;
            }
        }
        else {
            this.ls.bz();
            this.mr = this.mt;
        }
        this.i5(true);
    }
    dv(a, b, c) {
        let d = super.dv(a, b, c);
        if (!this.bi.q()) {
            return d = false;
        }
        return d;
    }
    get_dr() {
        return this.lz;
    }
    get lz() {
        return this.lw;
    }
    set lz(a) {
        let b = this.lw;
        this.lw = a;
        this.raisePropertyChanged("ShouldRenderAsOverlay", b, this.lw);
    }
}
AnnotationLayer.$t = markType(AnnotationLayer, 'AnnotationLayer', Series.$);
Type.dep(DependencyProperty, PropertyMetadata, AnnotationLayer, 'raisePropertyChanged', ['CursorPosition:ms:ml', [Point_$type, { $type: Point_$type, x: NaN, y: NaN }], 'IsDefaultCrosshairDisabled:lx:mm', [0, true], 'UseIndex:l0:mn', [0, false], 'UseLegend:l1:mo', [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.mr = { $type: Point_$type, x: NaN, y: NaN };
            this.bu.i5(true);
        }
    }
    bx() {
        this.bv = true;
        if (this.e.e1 != null) {
            this.e.e1.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