/*
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 { AnnotationLayer } from "./AnnotationLayer";
import { Series } from "./Series";
import { DependencyProperty } from "igniteui-angular-core/ES2015/DependencyProperty";
import { FinalValueSelectionMode_$type } from "./FinalValueSelectionMode";
import { Brush } from "igniteui-angular-core/ES2015/Brush";
import { Thickness } from "igniteui-angular-core/ES2015/Thickness";
import { FinalValueLayerFrame } from "./FinalValueLayerFrame";
import { List$1 } from "igniteui-angular-core/ES2015/List$1";
import { Axis } from "./Axis";
import { Dictionary$2 } from "igniteui-angular-core/ES2015/Dictionary$2";
import { Pool$1 } from "igniteui-angular-core/ES2015/Pool$1";
import { AxisAnnotation } from "./AxisAnnotation";
import { Type, enumGetBox, fromEnum, Point_$type, markType } from "igniteui-angular-core/ES2015/type";
import { AxisAnnotationFrameManager } from "./AxisAnnotationFrameManager";
import { PropertyMetadata } from "igniteui-angular-core/ES2015/PropertyMetadata";
import { AnnotationLayerView } from "./AnnotationLayerView";
import { BrushUtil } from "igniteui-angular-core/ES2015/BrushUtil";
/**
 * @hidden
 */
export class FinalValueLayer extends AnnotationLayer {
    constructor() {
        super();
        this.axisAnnotationFormatLabel = null;
        this.m9 = null;
        this.m8 = null;
        let a = new FinalValueLayerFrame();
        let b = new FinalValueLayerFrame();
        let c = new FinalValueLayerFrame();
        let d = this.fi / 1000;
        this.l1 = a;
        this.l0 = b;
        this.l2 = c;
        this.ab = FinalValueLayer.$;
    }
    bf() {
        return new FinalValueLayerView(this);
    }
    it(a) {
        super.it(a);
        this.m4 = a;
    }
    get n8() {
        return new Thickness(1, this.nb, this.nd, this.nc, this.na);
    }
    m7() {
        return this.axisAnnotationFormatLabel != null;
    }
    mk(a, b) {
        if (this.m6 == null || this.m6 == a) {
            if (!this.aq.c) {
                this.jc(b);
            }
        }
    }
    mm(a, b) {
        super.mm(a, b);
        let c = a;
        c.f.clear();
        c.q.clear();
        c.p.clear();
        c.aa.clear();
        c.o.clear();
        c.z.clear();
        c.g.clear();
        c.h.clear();
        c.j.clear();
        c.l.clear();
        c.k.clear();
        c.i.clear();
        c.m.clear();
        c.n.clear();
        c.r.clear();
        c.s.clear();
        c.u.clear();
        c.w.clear();
        c.v.clear();
        c.t.clear();
        c.x.clear();
        c.y.clear();
        if (this.l7(this.m6)) {
            this.nr(this.m6, c);
        }
        else {
            for (let d of fromEnum(this.bs.series)) {
                if (this.l7(d)) {
                    this.nr(d, c);
                }
            }
        }
    }
    l7(a) {
        if (!super.l7(a)) {
            return false;
        }
        return true;
    }
    im() {
        super.im();
        if (!this.aq.c && !this.ca()) {
            return;
        }
        if (this.ca()) {
            this.ns(this.l2, false);
        }
        else {
            this.ns(this.l0, false);
        }
    }
    n7(a) {
        let b = NaN;
        let c = NaN;
        let d = this.m5;
        if (d == 0) {
            d = 1;
        }
        let e = false;
        if (d == 2) {
            e = true;
        }
        if (a.isVertical) {
            let f = a.ap();
            if (f != null) {
                if (d == 1 || d == 2) {
                    if (f.b8) {
                        c = a.ln({ $type: Point_$type, x: this.lx.right, y: this.lx.bottom }).y;
                    }
                    else {
                        c = a.ln({ $type: Point_$type, x: this.lx.right, y: this.lx.top }).y;
                    }
                }
                else {
                    if (f.b8) {
                        c = 1;
                    }
                    else {
                        c = 0;
                    }
                }
            }
            return a.lk({ $type: Point_$type, x: 0, y: c }, e, true);
        }
        else {
            let g = a.ap();
            if (g != null) {
                if (d == 1 || d == 2) {
                    if (g.b8) {
                        b = a.ln({ $type: Point_$type, x: this.lx.left, y: this.lx.top }).x;
                    }
                    else {
                        b = a.ln({ $type: Point_$type, x: this.lx.right, y: this.lx.top }).x;
                    }
                }
                else {
                    if (g.b8) {
                        b = 0;
                    }
                    else {
                        b = 1;
                    }
                }
            }
            if (a.cr) {
                return a.lk({ $type: Point_$type, x: b, y: 0 }, e, true);
            }
            else {
                return a.lk({ $type: Point_$type, x: b, y: 0 }, e, true);
            }
        }
    }
    nr(a, b) {
        let c = this.n7(a);
        let d = this.ln(c);
        let e = this.k2;
        if (e == null) {
            e = this.k4;
        }
        if (e == null) {
            e = a.k2;
            if (e != null) {
                e = this.m4.b2(e);
            }
        }
        AxisAnnotationFrameManager.c(b, c, a, this.bs, this.getEffectiveViewport(), e, this.n4, this.n6, this.n5, this.n8, this.ne, this.n4, this.n6, this.n5, this.n8, this.ne, a.isVertical, !a.isVertical);
    }
    ns(a, b) {
        let c = false;
        if (this.m8 == null) {
            c = true;
            this.m9 = new List$1(Axis.$, 0);
            this.m8 = new Dictionary$2(Axis.$, Pool$1.$.specialize(AxisAnnotation.$), 0);
        }
        AxisAnnotationFrameManager.d(this, a, c, this.m8, this.m9, b, this.nf, this.nf, this.axisAnnotationFormatLabel, this.axisAnnotationFormatLabel);
    }
    mp(a, b) {
        super.mp(a, b);
        if (this.ca()) {
            this.ns(this.l2, true);
        }
        else {
            this.ns(this.l0, false);
        }
    }
    c8() {
        return true;
    }
    iy(a, b, c, d) {
        super.iy(a, b, c, d);
        switch (b) {
            case FinalValueLayer.$$p[10]:
                this.jc(true);
                break;
            case FinalValueLayer.$$p[0]:
            case FinalValueLayer.$$p[2]:
            case FinalValueLayer.$$p[4]:
            case FinalValueLayer.$$p[6]:
            case FinalValueLayer.$$p[5]:
            case FinalValueLayer.$$p[3]:
            case FinalValueLayer.$$p[7]:
            case FinalValueLayer.$$p[8]:
            case FinalValueLayer.$$p[9]:
                this.jc(true);
                break;
            case "SeriesViewer":
                let e = this.m9;
                let f = this.m8;
                if (f != null) {
                    for (let g of fromEnum(f)) {
                        let h = g.value;
                        h.c((i) => g.key.ak.remove(i));
                        h.clear();
                    }
                    e.clear();
                    f.clear();
                }
                break;
        }
    }
}
FinalValueLayer.$t = markType(FinalValueLayer, 'FinalValueLayer', AnnotationLayer.$);
Type.dep(DependencyProperty, PropertyMetadata, FinalValueLayer, 'raisePropertyChanged', ['AxisAnnotationBackground:n4:nt', [Brush.$, null], 'AxisAnnotationInterpolatedValuePrecision:nf:nu', [1, -1], 'AxisAnnotationOutline:n5:nv', [Brush.$, null], 'AxisAnnotationPaddingBottom:na:nw', [1, NaN], 'AxisAnnotationPaddingLeft:nb:nx', [1, NaN], 'AxisAnnotationPaddingRight:nc:ny', [1, NaN], 'AxisAnnotationPaddingTop:nd:nz', [1, NaN], 'AxisAnnotationStrokeThickness:ne:n0', [1, NaN], 'AxisAnnotationTextColor:n6:n1', [Brush.$, null], 'FinalValueSelectionMode:m5:n2', [FinalValueSelectionMode_$type, enumGetBox(FinalValueSelectionMode_$type, 0)], 'TargetSeries:m6:n3', [Series.$, null]]);
/**
 * @hidden
 */
export class FinalValueLayerView extends AnnotationLayerView {
    constructor(a) {
        super(a);
        this.b1 = null;
        this.b1 = a;
    }
    ap() {
        super.ap();
    }
    b2(a) {
        if (a == null) {
            return a;
        }
        return BrushUtil.h(a, 0.1);
    }
    ai(a) {
        super.ai(a);
    }
}
FinalValueLayerView.$t = markType(FinalValueLayerView, 'FinalValueLayerView', AnnotationLayerView.$);
//# sourceMappingURL=FinalValueLayer_combined.js.map