/*
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 { DependencyProperty } from "igniteui-react-core";
import { Series } from "./Series";
import { FinalValueSelectionMode_$type } from "./FinalValueSelectionMode";
import { Brush } from "igniteui-react-core";
import { Thickness } from "igniteui-react-core";
import { FinalValueLayerFrame } from "./FinalValueLayerFrame";
import { List$1 } from "igniteui-react-core";
import { Axis } from "./Axis";
import { Dictionary$2 } from "igniteui-react-core";
import { Pool$1 } from "igniteui-react-core";
import { AxisAnnotation } from "./AxisAnnotation";
import { Base, enumGetBox, fromEnum, Point_$type, markType, markDep } from "igniteui-react-core";
import { AxisAnnotationFrameManager } from "./AxisAnnotationFrameManager";
import { PropertyMetadata } from "igniteui-react-core";
import { DeviceUtils } from "igniteui-react-core";
import { AnnotationLayerView } from "./AnnotationLayerView";
import { BrushUtil } from "igniteui-react-core";
/**
 * @hidden
 */
export let FinalValueLayer = /*@__PURE__*/ (() => {
    class FinalValueLayer extends AnnotationLayer {
        bc() {
            return new FinalValueLayer();
        }
        get_d5() {
            return true;
        }
        constructor() {
            super();
            this.axisAnnotationFormatLabel = null;
            this.w8 = null;
            this.w7 = null;
            let a = new FinalValueLayerFrame();
            let b = new FinalValueLayerFrame();
            let c = new FinalValueLayerFrame();
            let d = this.jj / 1000;
            this.uh = a;
            this.ug = b;
            this.ui = c;
            this.ab = FinalValueLayer.$;
        }
        cd() {
            return new FinalValueLayerView(this);
        }
        o2(a) {
            super.o2(a);
            this.w3 = a;
        }
        get yd() {
            return new Thickness(1, this.xb, this.xd, this.xc, this.xa);
        }
        w6() {
            return this.axisAnnotationFormatLabel != null;
        }
        vu(a, b) {
            if (this.w5 == null || this.w5 == a) {
                if (!this.at.c) {
                    this.pr(b);
                }
            }
        }
        vw(a, b) {
            super.vw(a, b);
            let c = a;
            c.f.clear();
            c.r.clear();
            c.q.clear();
            c.ac.clear();
            c.p.clear();
            c.ab.clear();
            c.h.clear();
            c.g.clear();
            c.i.clear();
            c.k.clear();
            c.m.clear();
            c.l.clear();
            c.j.clear();
            c.n.clear();
            c.o.clear();
            c.t.clear();
            c.s.clear();
            c.u.clear();
            c.w.clear();
            c.y.clear();
            c.x.clear();
            c.v.clear();
            c.z.clear();
            c.aa.clear();
            if (this.un(this.w5)) {
                this.xu(this.w5, c);
            }
            else {
                for (let d of fromEnum(this.cv.series)) {
                    if (this.un(d)) {
                        this.xu(d, c);
                    }
                    if (d.isStacked) {
                        d.n6((e) => {
                            if (this.un(e)) {
                                this.xu(e, c);
                            }
                            if (e.dw) {
                                e.n4((f) => {
                                    if (this.un(f)) {
                                        this.xu(f, c);
                                    }
                                    return true;
                                });
                            }
                            return true;
                        });
                    }
                    if (d.dw) {
                        d.n4((e) => {
                            if (this.un(e)) {
                                this.xu(e, c);
                            }
                            return true;
                        });
                    }
                }
            }
        }
        un(a) {
            if (!super.un(a)) {
                return false;
            }
            if (this.xr != null) {
                if (a.eq) {
                    let b = a.lv();
                    if (!Base.equalsStatic(this.xr, b)) {
                        return false;
                    }
                }
                else {
                    if (!Base.equalsStatic(this.xr, a.name)) {
                        return false;
                    }
                }
            }
            return true;
        }
        oq() {
            super.oq();
            if (!this.at.c && !this.dk()) {
                return;
            }
            if (this.dk()) {
                this.xv(this.ui, false);
            }
            else {
                this.xv(this.ug, false);
            }
        }
        yc(a) {
            let b = NaN;
            let c = NaN;
            let d = this.w4;
            if (d == 0) {
                d = 1;
            }
            let e = false;
            if (d == 2) {
                e = true;
            }
            if (a.isVertical) {
                let f = a.as();
                if (f != null) {
                    if (d == 1 || d == 2) {
                        let g = this.tq(this.cg);
                        if (f.ch) {
                            c = a.to({ $type: Point_$type, x: g.right, y: g.bottom }).y;
                        }
                        else {
                            c = a.to({ $type: Point_$type, x: g.right, y: g.top }).y;
                        }
                    }
                    else {
                        if (f.ch) {
                            c = 1;
                        }
                        else {
                            c = 0;
                        }
                    }
                }
                return a.tj({ $type: Point_$type, x: 0, y: c }, e, true);
            }
            else {
                let h = a.as();
                if (h != null) {
                    if (d == 1 || d == 2) {
                        let i = this.tq(this.cg);
                        if (h.ch) {
                            b = a.to({ $type: Point_$type, x: i.left, y: i.top }).x;
                        }
                        else {
                            b = a.to({ $type: Point_$type, x: i.right, y: i.top }).x;
                        }
                    }
                    else {
                        if (h.ch) {
                            b = 0;
                        }
                        else {
                            b = 1;
                        }
                    }
                }
                if (a.el) {
                    return a.tj({ $type: Point_$type, x: b, y: 0 }, e, true);
                }
                else {
                    return a.tj({ $type: Point_$type, x: b, y: 0 }, e, true);
                }
            }
        }
        xu(a, b) {
            let c = this.yc(a);
            let d = this.to(c);
            let e = this.su;
            if (e == null) {
                e = this.sy;
            }
            if (e == null) {
                e = a.su;
                if (e != null) {
                    e = this.w3.b8(e);
                }
            }
            AxisAnnotationFrameManager.c(b, c, a, this.cv, this.getEffectiveViewport(), e, this.x9, this.w9, this.yb, this.ya, this.yd, this.xe, this.x9, this.w9, this.yb, this.ya, this.yd, this.xe, a.isVertical, !a.isVertical);
        }
        xv(a, b) {
            let c = false;
            if (this.w7 == null) {
                c = true;
                this.w8 = new List$1(Axis.$, 0);
                this.w7 = new Dictionary$2(Axis.$, Pool$1.$.specialize(AxisAnnotation.$), 0);
            }
            AxisAnnotationFrameManager.d(this, a, c, this.w7, this.w8, b, this.xf, this.xf, this.axisAnnotationFormatLabel, this.axisAnnotationFormatLabel);
        }
        vz(a, b) {
            super.vz(a, b);
            if (this.dk()) {
                this.xv(this.ui, true);
            }
            else {
                this.xv(this.ug, false);
            }
        }
        fn() {
            return true;
        }
        pa(a, b, c, d) {
            super.pa(a, b, c, d);
            switch (b) {
                case FinalValueLayer.$$p[11]:
                case FinalValueLayer.$$p[12]:
                    this.pr(true);
                    break;
                case FinalValueLayer.$$p[1]:
                case FinalValueLayer.$$p[0]:
                case FinalValueLayer.$$p[3]:
                case FinalValueLayer.$$p[5]:
                case FinalValueLayer.$$p[7]:
                case FinalValueLayer.$$p[6]:
                case FinalValueLayer.$$p[4]:
                case FinalValueLayer.$$p[8]:
                case FinalValueLayer.$$p[9]:
                case FinalValueLayer.$$p[10]:
                    this.pr(true);
                    break;
                case "SeriesViewer":
                    let e = this.w8;
                    let f = this.w7;
                    if (f != null) {
                        for (let g of fromEnum(f)) {
                            let h = g.value;
                            h.c((i) => g.key.an.remove(i));
                            h.clear();
                        }
                        e.clear();
                        f.clear();
                    }
                    break;
            }
        }
    }
    FinalValueLayer.$t = /*@__PURE__*/ markType(FinalValueLayer, 'FinalValueLayer', AnnotationLayer.$);
    FinalValueLayer.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, FinalValueLayer, 'raisePropertyChanged', ['AxisAnnotationBackgroundCornerRadius:w9:xw', [1, /*@__PURE__*/ DeviceUtils.g(3)], 'AxisAnnotationBackground:x9:xx', [Brush.$, null], 'AxisAnnotationInterpolatedValuePrecision:xf:xy', [1, -1], 'AxisAnnotationOutline:ya:xz', [Brush.$, null], 'AxisAnnotationPaddingBottom:xa:x0', [1, NaN], 'AxisAnnotationPaddingLeft:xb:x1', [1, NaN], 'AxisAnnotationPaddingRight:xc:x2', [1, NaN], 'AxisAnnotationPaddingTop:xd:x3', [1, NaN], 'AxisAnnotationStrokeThickness:xe:x4', [1, NaN], 'AxisAnnotationTextColor:yb:x5', [Brush.$, null], 'FinalValueSelectionMode:w4:x6', [FinalValueSelectionMode_$type, /*@__PURE__*/ enumGetBox(FinalValueSelectionMode_$type, 0)], 'TargetSeriesName:xr:x7', [2, null], 'TargetSeries:w5:x8', [Series.$, null]]);
    return FinalValueLayer;
})();
/**
 * @hidden
 */
export let FinalValueLayerView = /*@__PURE__*/ (() => {
    class FinalValueLayerView extends AnnotationLayerView {
        constructor(a) {
            super(a);
            this.b7 = null;
            this.b7 = a;
        }
        au() {
            super.au();
        }
        b8(a) {
            if (a == null) {
                return a;
            }
            return BrushUtil.m(a, 0.1);
        }
        an(a) {
            super.an(a);
        }
    }
    FinalValueLayerView.$t = /*@__PURE__*/ markType(FinalValueLayerView, 'FinalValueLayerView', AnnotationLayerView.$);
    return FinalValueLayerView;
})();
