/*
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-angular-core/ES5/DependencyProperty";
import { FinalValueSelectionMode_$type } from "./FinalValueSelectionMode";
import { Brush } from "igniteui-angular-core/ES5/Brush";
import { Thickness } from "igniteui-angular-core/ES5/Thickness";
import { FinalValueLayerFrame } from "./FinalValueLayerFrame";
import { List$1 } from "igniteui-angular-core/ES5/List$1";
import { Axis } from "./Axis";
import { Dictionary$2 } from "igniteui-angular-core/ES5/Dictionary$2";
import { Pool$1 } from "igniteui-angular-core/ES5/Pool$1";
import { AxisAnnotation } from "./AxisAnnotation";
import { Type, enumGetBox, fromEnum, Point_$type, markType } from "igniteui-angular-core/ES5/type";
import { AxisAnnotationFrameManager } from "./AxisAnnotationFrameManager";
import { PropertyMetadata } from "igniteui-angular-core/ES5/PropertyMetadata";
import { AnnotationLayerView } from "./AnnotationLayerView";
import { BrushUtil } from "igniteui-angular-core/ES5/BrushUtil";
/**
 * @hidden
 */
var FinalValueLayer = /** @class */ (function (_super) {
    tslib_1.__extends(FinalValueLayer, _super);
    function FinalValueLayer() {
        var _this = _super.call(this) || this;
        _this.axisAnnotationFormatLabel = null;
        _this.m0 = null;
        _this.mz = null;
        var a = new FinalValueLayerFrame();
        var b = new FinalValueLayerFrame();
        var c = new FinalValueLayerFrame();
        var d = _this.ff / 1000;
        _this.lu = a;
        _this.lt = b;
        _this.lv = c;
        _this.ab = FinalValueLayer.$;
        return _this;
    }
    FinalValueLayer.prototype.bf = function () {
        return new FinalValueLayerView(this);
    };
    FinalValueLayer.prototype.im = function (a) {
        _super.prototype.im.call(this, a);
        this.mv = a;
    };
    Object.defineProperty(FinalValueLayer.prototype, "nz", {
        get: function () {
            return new Thickness(1, this.m2, this.m4, this.m3, this.m1);
        },
        enumerable: true,
        configurable: true
    });
    FinalValueLayer.prototype.my = function () {
        return this.axisAnnotationFormatLabel != null;
    };
    FinalValueLayer.prototype.mb = function (a, b) {
        if (this.mx == null || this.mx == a) {
            if (!this.aq.c) {
                this.i5(b);
            }
        }
    };
    FinalValueLayer.prototype.md = function (a, b) {
        var e_1, _a;
        _super.prototype.md.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.ly(this.mx)) {
            this.ni(this.mx, 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.ly(d)) {
                        this.ni(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.ly = function (a) {
        if (!_super.prototype.ly.call(this, a)) {
            return false;
        }
        return true;
    };
    FinalValueLayer.prototype.ig = function () {
        _super.prototype.ig.call(this);
        if (!this.aq.c && !this.ca()) {
            return;
        }
        if (this.ca()) {
            this.nj(this.lv, false);
        }
        else {
            this.nj(this.lt, false);
        }
    };
    FinalValueLayer.prototype.ny = function (a) {
        var b = NaN;
        var c = NaN;
        var d = this.mw;
        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.b8) {
                        c = a.lg({ $type: Point_$type, x: this.lq.right, y: this.lq.bottom }).y;
                    }
                    else {
                        c = a.lg({ $type: Point_$type, x: this.lq.right, y: this.lq.top }).y;
                    }
                }
                else {
                    if (f.b8) {
                        c = 1;
                    }
                    else {
                        c = 0;
                    }
                }
            }
            return a.ld({ $type: Point_$type, x: 0, y: c }, e, true);
        }
        else {
            var g = a.ap();
            if (g != null) {
                if (d == 1 || d == 2) {
                    if (g.b8) {
                        b = a.lg({ $type: Point_$type, x: this.lq.left, y: this.lq.top }).x;
                    }
                    else {
                        b = a.lg({ $type: Point_$type, x: this.lq.right, y: this.lq.top }).x;
                    }
                }
                else {
                    if (g.b8) {
                        b = 0;
                    }
                    else {
                        b = 1;
                    }
                }
            }
            if (a.cr) {
                return a.ld({ $type: Point_$type, x: b, y: 0 }, e, true);
            }
            else {
                return a.ld({ $type: Point_$type, x: b, y: 0 }, e, true);
            }
        }
    };
    FinalValueLayer.prototype.ni = function (a, b) {
        var c = this.ny(a);
        var d = this.lg(c);
        var e = this.kv;
        if (e == null) {
            e = this.kx;
        }
        if (e == null) {
            e = a.kv;
            if (e != null) {
                e = this.mv.b2(e);
            }
        }
        AxisAnnotationFrameManager.c(b, c, a, this.bs, this.getEffectiveViewport(), e, this.nv, this.nx, this.nw, this.nz, this.m5, this.nv, this.nx, this.nw, this.nz, this.m5, a.isVertical, !a.isVertical);
    };
    FinalValueLayer.prototype.nj = function (a, b) {
        var c = false;
        if (this.mz == null) {
            c = true;
            this.m0 = new List$1(Axis.$, 0);
            this.mz = new Dictionary$2(Axis.$, Pool$1.$.specialize(AxisAnnotation.$), 0);
        }
        AxisAnnotationFrameManager.d(this, a, c, this.mz, this.m0, b, this.m6, this.m6, this.axisAnnotationFormatLabel, this.axisAnnotationFormatLabel);
    };
    FinalValueLayer.prototype.mg = function (a, b) {
        _super.prototype.mg.call(this, a, b);
        if (this.ca()) {
            this.nj(this.lv, true);
        }
        else {
            this.nj(this.lt, false);
        }
    };
    FinalValueLayer.prototype.c7 = function () {
        return true;
    };
    FinalValueLayer.prototype.is = function (a, b, c, d) {
        var e_2, _a;
        _super.prototype.is.call(this, a, b, c, d);
        switch (b) {
            case FinalValueLayer.$$p[10]:
                this.i5(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.i5(true);
                break;
            case "SeriesViewer":
                var e = this.m0;
                var f = this.mz;
                if (f != null) {
                    var _loop_1 = function (g) {
                        var h = g.value;
                        h.c(function (i) { return g.key.ak.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.$);
    return FinalValueLayer;
}(AnnotationLayer));
export { FinalValueLayer };
Type.dep(DependencyProperty, PropertyMetadata, FinalValueLayer, 'raisePropertyChanged', ['AxisAnnotationBackground:nv:nk', [Brush.$, null], 'AxisAnnotationInterpolatedValuePrecision:m6:nl', [1, -1], 'AxisAnnotationOutline:nw:nm', [Brush.$, null], 'AxisAnnotationPaddingBottom:m1:nn', [1, NaN], 'AxisAnnotationPaddingLeft:m2:no', [1, NaN], 'AxisAnnotationPaddingRight:m3:np', [1, NaN], 'AxisAnnotationPaddingTop:m4:nq', [1, NaN], 'AxisAnnotationStrokeThickness:m5:nr', [1, NaN], 'AxisAnnotationTextColor:nx:ns', [Brush.$, null], 'FinalValueSelectionMode:mw:nt', [FinalValueSelectionMode_$type, enumGetBox(FinalValueSelectionMode_$type, 0)], 'TargetSeries:mx:nu', [Series.$, null]]);
/**
 * @hidden
 */
var FinalValueLayerView = /** @class */ (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.h(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