/*
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 { Series } from "./Series";
import { DependencyProperty } from "igniteui-react-core";
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 { 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.nk = null;
        _this.nj = null;
        var a = new FinalValueLayerFrame();
        var b = new FinalValueLayerFrame();
        var c = new FinalValueLayerFrame();
        var d = _this.fi / 1000;
        _this.mc = a;
        _this.mb = b;
        _this.md = c;
        _this.ab = FinalValueLayer.$;
        return _this;
    }
    FinalValueLayer.prototype.bf = function () {
        return new FinalValueLayerView(this);
    };
    FinalValueLayer.prototype.i2 = function (a) {
        _super.prototype.i2.call(this, a);
        this.nf = a;
    };
    Object.defineProperty(FinalValueLayer.prototype, "oj", {
        get: function () {
            return new Thickness(1, this.nm, this.no, this.nn, this.nl);
        },
        enumerable: true,
        configurable: true
    });
    FinalValueLayer.prototype.ni = function () {
        return this.axisAnnotationFormatLabel != null;
    };
    FinalValueLayer.prototype.mv = function (a, b) {
        if (this.nh == null || this.nh == a) {
            if (!this.aq.c) {
                this.jl(b);
            }
        }
    };
    FinalValueLayer.prototype.mx = function (a, b) {
        var e_1, _a;
        _super.prototype.mx.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.mi(this.nh)) {
            this.n2(this.nh, c);
        }
        else {
            try {
                for (var _b = tslib_1.__values(fromEnum(this.bs.series)), _c = _b.next(); !_c.done; _c = _b.next()) {
                    var d = _c.value;
                    if (this.mi(d)) {
                        this.n2(d, c);
                    }
                }
            }
            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.mi = function (a) {
        if (!_super.prototype.mi.call(this, a)) {
            return false;
        }
        return true;
    };
    FinalValueLayer.prototype.iw = function () {
        _super.prototype.iw.call(this);
        if (!this.aq.c && !this.ca()) {
            return;
        }
        if (this.ca()) {
            this.n3(this.md, false);
        }
        else {
            this.n3(this.mb, false);
        }
    };
    FinalValueLayer.prototype.oi = function (a) {
        var b = NaN;
        var c = NaN;
        var d = this.ng;
        if (d == 0) {
            d = 1;
        }
        var e = false;
        if (d == 2) {
            e = true;
        }
        if (a.isVertical) {
            var f = a.ap();
            if (f != null) {
                if (d == 1 || d == 2) {
                    if (f.ca) {
                        c = a.ly({ $type: Point_$type, x: this.l8.right, y: this.l8.bottom }).y;
                    }
                    else {
                        c = a.ly({ $type: Point_$type, x: this.l8.right, y: this.l8.top }).y;
                    }
                }
                else {
                    if (f.ca) {
                        c = 1;
                    }
                    else {
                        c = 0;
                    }
                }
            }
            return a.lv({ $type: Point_$type, x: 0, y: c }, e, true);
        }
        else {
            var g = a.ap();
            if (g != null) {
                if (d == 1 || d == 2) {
                    if (g.ca) {
                        b = a.ly({ $type: Point_$type, x: this.l8.left, y: this.l8.top }).x;
                    }
                    else {
                        b = a.ly({ $type: Point_$type, x: this.l8.right, y: this.l8.top }).x;
                    }
                }
                else {
                    if (g.ca) {
                        b = 0;
                    }
                    else {
                        b = 1;
                    }
                }
            }
            if (a.cr) {
                return a.lv({ $type: Point_$type, x: b, y: 0 }, e, true);
            }
            else {
                return a.lv({ $type: Point_$type, x: b, y: 0 }, e, true);
            }
        }
    };
    FinalValueLayer.prototype.n2 = function (a, b) {
        var c = this.oi(a);
        var d = this.ly(c);
        var e = this.lb;
        if (e == null) {
            e = this.ld;
        }
        if (e == null) {
            e = a.lb;
            if (e != null) {
                e = this.nf.b2(e);
            }
        }
        AxisAnnotationFrameManager.c(b, c, a, this.bs, this.getEffectiveViewport(), e, this.of, this.oh, this.og, this.oj, this.np, this.of, this.oh, this.og, this.oj, this.np, a.isVertical, !a.isVertical);
    };
    FinalValueLayer.prototype.n3 = function (a, b) {
        var c = false;
        if (this.nj == null) {
            c = true;
            this.nk = new List$1(Axis.$, 0);
            this.nj = new Dictionary$2(Axis.$, Pool$1.$.specialize(AxisAnnotation.$), 0);
        }
        AxisAnnotationFrameManager.d(this, a, c, this.nj, this.nk, b, this.nq, this.nq, this.axisAnnotationFormatLabel, this.axisAnnotationFormatLabel);
    };
    FinalValueLayer.prototype.m0 = function (a, b) {
        _super.prototype.m0.call(this, a, b);
        if (this.ca()) {
            this.n3(this.md, true);
        }
        else {
            this.n3(this.mb, false);
        }
    };
    FinalValueLayer.prototype.c8 = function () {
        return true;
    };
    FinalValueLayer.prototype.i7 = function (a, b, c, d) {
        var e_2, _a;
        _super.prototype.i7.call(this, a, b, c, d);
        switch (b) {
            case FinalValueLayer.$$p[10]:
                this.jl(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.jl(true);
                break;
            case "SeriesViewer":
                var e = this.nk;
                var f = this.nj;
                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:of:n4', [Brush.$, null], 'AxisAnnotationInterpolatedValuePrecision:nq:n5', [1, -1], 'AxisAnnotationOutline:og:n6', [Brush.$, null], 'AxisAnnotationPaddingBottom:nl:n7', [1, NaN], 'AxisAnnotationPaddingLeft:nm:n8', [1, NaN], 'AxisAnnotationPaddingRight:nn:n9', [1, NaN], 'AxisAnnotationPaddingTop:no:oa', [1, NaN], 'AxisAnnotationStrokeThickness:np:ob', [1, NaN], 'AxisAnnotationTextColor:oh:oc', [Brush.$, null], 'FinalValueSelectionMode:ng:od', [FinalValueSelectionMode_$type, enumGetBox(FinalValueSelectionMode_$type, 0)], 'TargetSeries:nh:oe', [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.b1 = null;
        _this.b1 = a;
        return _this;
    }
    FinalValueLayerView.prototype.ap = function () {
        _super.prototype.ap.call(this);
    };
    FinalValueLayerView.prototype.b2 = function (a) {
        if (a == null) {
            return a;
        }
        return BrushUtil.l(a, 0.1);
    };
    FinalValueLayerView.prototype.ai = function (a) {
        _super.prototype.ai.call(this, a);
    };
    FinalValueLayerView.$t = markType(FinalValueLayerView, 'FinalValueLayerView', AnnotationLayerView.$);
    return FinalValueLayerView;
}(AnnotationLayerView));
export { FinalValueLayerView };
//# sourceMappingURL=FinalValueLayer_combined.js.map
