/*
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-react-core/ES2015/DependencyProperty";
import { FinalValueSelectionMode_$type } from "./FinalValueSelectionMode";
import { Brush } from "igniteui-react-core/ES2015/Brush";
import { FinalValueLayerFrame } from "./FinalValueLayerFrame";
import { List$1 } from "igniteui-react-core/ES2015/List$1";
import { Axis } from "./Axis";
import { Dictionary$2 } from "igniteui-react-core/ES2015/Dictionary$2";
import { Pool$1 } from "igniteui-react-core/ES2015/Pool$1";
import { AxisAnnotation } from "./AxisAnnotation";
import { Type, enumGetBox, fromEnum, Point_$type, markType } from "igniteui-react-core/ES2015/type";
import { AxisAnnotationFrameManager } from "./AxisAnnotationFrameManager";
import { PropertyMetadata } from "igniteui-react-core/ES2015/PropertyMetadata";
import { AnnotationLayerView } from "./AnnotationLayerView";
import { BrushUtil } from "igniteui-react-core/ES2015/BrushUtil";
export class FinalValueLayer extends AnnotationLayer {
    constructor() {
        super();
        this.mu = null;
        this.mt = null;
        let a = new FinalValueLayerFrame();
        let b = new FinalValueLayerFrame();
        let c = new FinalValueLayerFrame();
        let d = this.fc / 1000;
        this.lq = a;
        this.lp = b;
        this.lr = c;
        this.ab = FinalValueLayer.$;
    }
    bf() {
        return new FinalValueLayerView(this);
    }
    ii(a) {
        super.ii(a);
        this.mq = a;
    }
    l7(a, b) {
        if (this.ms == null || this.ms == a) {
            if (!this.aq.c) {
                this.i1(b);
            }
        }
    }
    l9(a, b) {
        super.l9(a, b);
        let c = a;
        c.f.clear();
        c.n.clear();
        c.m.clear();
        c.u.clear();
        c.l.clear();
        c.t.clear();
        c.g.clear();
        c.h.clear();
        c.i.clear();
        c.j.clear();
        c.k.clear();
        c.o.clear();
        c.p.clear();
        c.q.clear();
        c.r.clear();
        c.s.clear();
        if (this.lu(this.ms)) {
            this.m6(this.ms, c);
        }
        else {
            for (let d of fromEnum(this.bs.series)) {
                if (this.lu(d)) {
                    this.m6(d, c);
                }
            }
        }
    }
    lu(a) {
        if (!super.lu(a)) {
            return false;
        }
        return true;
    }
    ib() {
        super.ib();
        if (!this.aq.c && !this.ca()) {
            return;
        }
        if (this.ca()) {
            this.m7(this.lr, false);
        }
        else {
            this.m7(this.lp, false);
        }
    }
    nj(a) {
        let b = NaN;
        let c = NaN;
        let d = this.mr;
        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.lc({ $type: Point_$type, x: this.lm.right, y: this.lm.top }).y;
                    }
                    else {
                        c = a.lc({ $type: Point_$type, x: this.lm.right, y: this.lm.bottom }).y;
                    }
                }
                else {
                    if (f.b8) {
                        c = 0;
                    }
                    else {
                        c = 1;
                    }
                }
            }
            return a.k9({ $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.lc({ $type: Point_$type, x: this.lm.left, y: this.lm.top }).x;
                    }
                    else {
                        b = a.lc({ $type: Point_$type, x: this.lm.right, y: this.lm.top }).x;
                    }
                }
                else {
                    if (g.b8) {
                        b = 0;
                    }
                    else {
                        b = 1;
                    }
                }
            }
            if (a.cq) {
                return a.k9({ $type: Point_$type, x: b, y: 0 }, e, true);
            }
            else {
                return a.k9({ $type: Point_$type, x: b, y: 0 }, e, true);
            }
        }
    }
    m6(a, b) {
        let c = this.nj(a);
        let d = this.lc(c);
        let e = this.kr;
        if (e == null) {
            e = this.kt;
        }
        if (e == null) {
            e = a.kr;
            if (e != null) {
                e = this.mq.b0(e);
            }
        }
        AxisAnnotationFrameManager.c(b, c, a, this.bs, this.getEffectiveViewport(), e, this.ng, this.ni, this.nh, this.mv, this.mw, this.ng, this.ni, this.nh, this.mv, this.mw, a.isVertical, !a.isVertical);
    }
    m7(a, b) {
        let c = false;
        if (this.mt == null) {
            c = true;
            this.mu = new List$1(Axis.$, 0);
            this.mt = new Dictionary$2(Axis.$, Pool$1.$.specialize(AxisAnnotation.$), 0);
        }
        AxisAnnotationFrameManager.d(a, c, this.mt, this.mu, b, this.mx, this.mx);
    }
    mc(a, b) {
        super.mc(a, b);
        if (this.ca()) {
            this.m7(this.lr, true);
        }
        else {
            this.m7(this.lp, false);
        }
    }
    c5() {
        return true;
    }
    io(a, b, c, d) {
        super.io(a, b, c, d);
        switch (b) {
            case FinalValueLayer.$$p[7]:
                this.i1(true);
                break;
            case FinalValueLayer.$$p[0]:
            case FinalValueLayer.$$p[2]:
            case FinalValueLayer.$$p[3]:
            case FinalValueLayer.$$p[4]:
            case FinalValueLayer.$$p[5]:
            case FinalValueLayer.$$p[6]:
                this.i1(true);
                break;
        }
    }
}
FinalValueLayer.$t = markType(FinalValueLayer, 'FinalValueLayer', AnnotationLayer.$);
Type.dep(DependencyProperty, PropertyMetadata, FinalValueLayer, 'raisePropertyChanged', ['AxisAnnotationBackground:ng:m8', [Brush.$, null], 'AxisAnnotationInterpolatedValuePrecision:mx:m9', [1, -1], 'AxisAnnotationOutline:nh:na', [Brush.$, null], 'AxisAnnotationPadding:mv:nb', [1, NaN], 'AxisAnnotationStrokeThickness:mw:nc', [1, NaN], 'AxisAnnotationTextColor:ni:nd', [Brush.$, null], 'FinalValueSelectionMode:mr:ne', [FinalValueSelectionMode_$type, enumGetBox(FinalValueSelectionMode_$type, 0)], 'TargetSeries:ms:nf', [Series.$, null]]);
export class FinalValueLayerView extends AnnotationLayerView {
    constructor(a) {
        super(a);
        this.bz = null;
        this.bz = a;
    }
    ap() {
        super.ap();
    }
    b0(a) {
        if (a == null) {
            return a;
        }
        return BrushUtil.h(a, 0.1);
    }
    ai(a) {
        super.ai(a);
    }
}
FinalValueLayerView.$t = markType(FinalValueLayerView, 'FinalValueLayerView', AnnotationLayerView.$);
/*<BeginStatics Name="Infragistics.Controls.Charts.FinalValueLayer" />*/
/*<EndStatics Name="Infragistics.Controls.Charts.FinalValueLayer" />*/
