/*
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 * as tslib_1 from "tslib";
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 { AnnotationLayerView } from "./AnnotationLayerView";
import { BrushUtil } from "igniteui-react-core";
/**
 * @hidden
 */
var FinalValueLayer = /** @class */ /*@__PURE__*/ (function (_super) {
    tslib_1.__extends(FinalValueLayer, _super);
    function FinalValueLayer() {
        var _this = _super.call(this) || this;
        _this.axisAnnotationFormatLabel = null;
        _this.pj = null;
        _this.pi = null;
        var a = new FinalValueLayerFrame();
        var b = new FinalValueLayerFrame();
        var c = new FinalValueLayerFrame();
        var d = _this.gj / 1000;
        _this.ob = a;
        _this.oa = b;
        _this.oc = c;
        _this.ab = FinalValueLayer.$;
        return _this;
    }
    FinalValueLayer.prototype.bp = function () {
        return new FinalValueLayerView(this);
    };
    FinalValueLayer.prototype.kk = function (a) {
        _super.prototype.kk.call(this, a);
        this.pe = a;
    };
    Object.defineProperty(FinalValueLayer.prototype, "ql", {
        get: function () {
            return new Thickness(1, this.pl, this.pn, this.pm, this.pk);
        },
        enumerable: true,
        configurable: true
    });
    FinalValueLayer.prototype.ph = function () {
        return this.axisAnnotationFormatLabel != null;
    };
    FinalValueLayer.prototype.ou = function (a, b) {
        if (this.pg == null || this.pg == a) {
            if (!this.ar.c) {
                this.k3(b);
            }
        }
    };
    FinalValueLayer.prototype.ow = function (a, b) {
        var e_1, _a;
        var _this = this;
        _super.prototype.ow.call(this, a, b);
        var 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.oh(this.pg)) {
            this.p3(this.pg, c);
        }
        else {
            try {
                for (var _b = tslib_1.__values(fromEnum(this.b6.series)), _c = _b.next(); !_c.done; _c = _b.next()) {
                    var d = _c.value;
                    if (this.oh(d)) {
                        this.p3(d, c);
                    }
                    if (d.isStacked) {
                        d.jy(function (e) {
                            if (_this.oh(e)) {
                                _this.p3(e, c);
                            }
                            return true;
                        });
                    }
                }
            }
            catch (e_1_1) {
                e_1 = { error: e_1_1 };
            }
            finally {
                try {
                    if (_c && !_c.done && (_a = _b.return))
                        _a.call(_b);
                }
                finally {
                    if (e_1)
                        throw e_1.error;
                }
            }
        }
    };
    FinalValueLayer.prototype.oh = function (a) {
        if (!_super.prototype.oh.call(this, a)) {
            return false;
        }
        if (this.p0 != null) {
            if (a.c7) {
                var b = a.ib();
                if (!Base.equalsStatic(this.p0, b)) {
                    return false;
                }
            }
            else {
                if (!Base.equalsStatic(this.p0, a.name)) {
                    return false;
                }
            }
        }
        return true;
    };
    FinalValueLayer.prototype.kd = function () {
        _super.prototype.kd.call(this);
        if (!this.ar.c && !this.cn()) {
            return;
        }
        if (this.cn()) {
            this.p4(this.oc, false);
        }
        else {
            this.p4(this.oa, false);
        }
    };
    FinalValueLayer.prototype.qk = function (a) {
        var b = NaN;
        var c = NaN;
        var d = this.pf;
        if (d == 0) {
            d = 1;
        }
        var e = false;
        if (d == 2) {
            e = true;
        }
        if (a.isVertical) {
            var f = a.aq();
            if (f != null) {
                if (d == 1 || d == 2) {
                    if (f.ca) {
                        c = a.nw({ $type: Point_$type, x: this.n6.right, y: this.n6.bottom }).y;
                    }
                    else {
                        c = a.nw({ $type: Point_$type, x: this.n6.right, y: this.n6.top }).y;
                    }
                }
                else {
                    if (f.ca) {
                        c = 1;
                    }
                    else {
                        c = 0;
                    }
                }
            }
            return a.nt({ $type: Point_$type, x: 0, y: c }, e, true);
        }
        else {
            var g = a.aq();
            if (g != null) {
                if (d == 1 || d == 2) {
                    if (g.ca) {
                        b = a.nw({ $type: Point_$type, x: this.n6.left, y: this.n6.top }).x;
                    }
                    else {
                        b = a.nw({ $type: Point_$type, x: this.n6.right, y: this.n6.top }).x;
                    }
                }
                else {
                    if (g.ca) {
                        b = 0;
                    }
                    else {
                        b = 1;
                    }
                }
            }
            if (a.c6) {
                return a.nt({ $type: Point_$type, x: b, y: 0 }, e, true);
            }
            else {
                return a.nt({ $type: Point_$type, x: b, y: 0 }, e, true);
            }
        }
    };
    FinalValueLayer.prototype.p3 = function (a, b) {
        var c = this.qk(a);
        var d = this.nw(c);
        var e = this.m9;
        if (e == null) {
            e = this.nb;
        }
        if (e == null) {
            e = a.m9;
            if (e != null) {
                e = this.pe.b5(e);
            }
        }
        AxisAnnotationFrameManager.c(b, c, a, this.b6, this.getEffectiveViewport(), e, this.qh, this.qj, this.qi, this.ql, this.po, this.qh, this.qj, this.qi, this.ql, this.po, a.isVertical, !a.isVertical);
    };
    FinalValueLayer.prototype.p4 = function (a, b) {
        var c = false;
        if (this.pi == null) {
            c = true;
            this.pj = new List$1(Axis.$, 0);
            this.pi = new Dictionary$2(Axis.$, Pool$1.$.specialize(AxisAnnotation.$), 0);
        }
        AxisAnnotationFrameManager.d(this, a, c, this.pi, this.pj, b, this.pp, this.pp, this.axisAnnotationFormatLabel, this.axisAnnotationFormatLabel);
    };
    FinalValueLayer.prototype.oz = function (a, b) {
        _super.prototype.oz.call(this, a, b);
        if (this.cn()) {
            this.p4(this.oc, true);
        }
        else {
            this.p4(this.oa, false);
        }
    };
    FinalValueLayer.prototype.dp = function () {
        return true;
    };
    FinalValueLayer.prototype.kp = function (a, b, c, d) {
        var e_2, _a;
        _super.prototype.kp.call(this, a, b, c, d);
        switch (b) {
            case FinalValueLayer.$$p[10]:
            case FinalValueLayer.$$p[11]:
                this.k3(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.k3(true);
                break;
            case "SeriesViewer":
                var e = this.pj;
                var f = this.pi;
                if (f != null) {
                    var _loop_1 = function (g) {
                        var h = g.value;
                        h.c(function (i) { return g.key.am.remove(i); });
                        h.clear();
                    };
                    try {
                        for (var _b = tslib_1.__values(fromEnum(f)), _c = _b.next(); !_c.done; _c = _b.next()) {
                            var g = _c.value;
                            _loop_1(g);
                        }
                    }
                    catch (e_2_1) {
                        e_2 = { error: e_2_1 };
                    }
                    finally {
                        try {
                            if (_c && !_c.done && (_a = _b.return))
                                _a.call(_b);
                        }
                        finally {
                            if (e_2)
                                throw e_2.error;
                        }
                    }
                    e.clear();
                    f.clear();
                }
                break;
        }
    };
    FinalValueLayer.$t = markType(FinalValueLayer, 'FinalValueLayer', AnnotationLayer.$);
    FinalValueLayer.$$p = markDep(DependencyProperty, PropertyMetadata, FinalValueLayer, 'raisePropertyChanged', ['AxisAnnotationBackground:qh:p5', [Brush.$, null], 'AxisAnnotationInterpolatedValuePrecision:pp:p6', [1, -1], 'AxisAnnotationOutline:qi:p7', [Brush.$, null], 'AxisAnnotationPaddingBottom:pk:p8', [1, NaN], 'AxisAnnotationPaddingLeft:pl:p9', [1, NaN], 'AxisAnnotationPaddingRight:pm:qa', [1, NaN], 'AxisAnnotationPaddingTop:pn:qb', [1, NaN], 'AxisAnnotationStrokeThickness:po:qc', [1, NaN], 'AxisAnnotationTextColor:qj:qd', [Brush.$, null], 'FinalValueSelectionMode:pf:qe', [FinalValueSelectionMode_$type, enumGetBox(FinalValueSelectionMode_$type, 0)], 'TargetSeriesName:p0:qf', [2, null], 'TargetSeries:pg:qg', [Series.$, null]]);
    return FinalValueLayer;
}(AnnotationLayer));
export { FinalValueLayer };
/**
 * @hidden
 */
var FinalValueLayerView = /** @class */ /*@__PURE__*/ (function (_super) {
    tslib_1.__extends(FinalValueLayerView, _super);
    function FinalValueLayerView(a) {
        var _this = _super.call(this, a) || this;
        _this.b4 = null;
        _this.b4 = a;
        return _this;
    }
    FinalValueLayerView.prototype.as = function () {
        _super.prototype.as.call(this);
    };
    FinalValueLayerView.prototype.b5 = function (a) {
        if (a == null) {
            return a;
        }
        return BrushUtil.l(a, 0.1);
    };
    FinalValueLayerView.prototype.al = function (a) {
        _super.prototype.al.call(this, a);
    };
    FinalValueLayerView.$t = markType(FinalValueLayerView, 'FinalValueLayerView', AnnotationLayerView.$);
    return FinalValueLayerView;
}(AnnotationLayerView));
export { FinalValueLayerView };
//# sourceMappingURL=FinalValueLayer_combined.js.map
