/*
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/ES5/DependencyProperty";
import { FinalValueSelectionMode_$type } from "./FinalValueSelectionMode";
import { Brush } from "igniteui-react-core/ES5/Brush";
import { FinalValueLayerFrame } from "./FinalValueLayerFrame";
import { List$1 } from "igniteui-react-core/ES5/List$1";
import { Axis } from "./Axis";
import { Dictionary$2 } from "igniteui-react-core/ES5/Dictionary$2";
import { Pool$1 } from "igniteui-react-core/ES5/Pool$1";
import { AxisAnnotation } from "./AxisAnnotation";
import { Type, enumGetBox, fromEnum, Point_$type, markType } from "igniteui-react-core/ES5/type";
import { AxisAnnotationFrameManager } from "./AxisAnnotationFrameManager";
import { PropertyMetadata } from "igniteui-react-core/ES5/PropertyMetadata";
import { AnnotationLayerView } from "./AnnotationLayerView";
import { BrushUtil } from "igniteui-react-core/ES5/BrushUtil";
var FinalValueLayer = /** @class */ (function (_super) {
    tslib_1.__extends(FinalValueLayer, _super);
    function FinalValueLayer() {
        var _this = _super.call(this) || this;
        _this.mu = null;
        _this.mt = null;
        var a = new FinalValueLayerFrame();
        var b = new FinalValueLayerFrame();
        var c = new FinalValueLayerFrame();
        var d = _this.fc / 1000;
        _this.lq = a;
        _this.lp = b;
        _this.lr = c;
        _this.ab = FinalValueLayer.$;
        return _this;
    }
    FinalValueLayer.prototype.bf = function () {
        return new FinalValueLayerView(this);
    };
    FinalValueLayer.prototype.ii = function (a) {
        _super.prototype.ii.call(this, a);
        this.mq = a;
    };
    FinalValueLayer.prototype.l7 = function (a, b) {
        if (this.ms == null || this.ms == a) {
            if (!this.aq.c) {
                this.i1(b);
            }
        }
    };
    FinalValueLayer.prototype.l9 = function (a, b) {
        _super.prototype.l9.call(this, a, b);
        var 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 {
            try {
                for (var _a = tslib_1.__values(fromEnum(this.bs.series)), _b = _a.next(); !_b.done; _b = _a.next()) {
                    var d = _b.value;
                    if (this.lu(d)) {
                        this.m6(d, c);
                    }
                }
            }
            catch (e_1_1) { e_1 = { error: e_1_1 }; }
            finally {
                try {
                    if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
                }
                finally { if (e_1) throw e_1.error; }
            }
        }
        var e_1, _c;
    };
    FinalValueLayer.prototype.lu = function (a) {
        if (!_super.prototype.lu.call(this, a)) {
            return false;
        }
        return true;
    };
    FinalValueLayer.prototype.ib = function () {
        _super.prototype.ib.call(this);
        if (!this.aq.c && !this.ca()) {
            return;
        }
        if (this.ca()) {
            this.m7(this.lr, false);
        }
        else {
            this.m7(this.lp, false);
        }
    };
    FinalValueLayer.prototype.nj = function (a) {
        var b = NaN;
        var c = NaN;
        var d = this.mr;
        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.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 {
            var 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);
            }
        }
    };
    FinalValueLayer.prototype.m6 = function (a, b) {
        var c = this.nj(a);
        var d = this.lc(c);
        var 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);
    };
    FinalValueLayer.prototype.m7 = function (a, b) {
        var 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);
    };
    FinalValueLayer.prototype.mc = function (a, b) {
        _super.prototype.mc.call(this, a, b);
        if (this.ca()) {
            this.m7(this.lr, true);
        }
        else {
            this.m7(this.lp, false);
        }
    };
    FinalValueLayer.prototype.c5 = function () {
        return true;
    };
    FinalValueLayer.prototype.io = function (a, b, c, d) {
        _super.prototype.io.call(this, 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.$);
    return FinalValueLayer;
}(AnnotationLayer));
export { FinalValueLayer };
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]]);
var FinalValueLayerView = /** @class */ (function (_super) {
    tslib_1.__extends(FinalValueLayerView, _super);
    function FinalValueLayerView(a) {
        var _this = _super.call(this, a) || this;
        _this.bz = null;
        _this.bz = a;
        return _this;
    }
    FinalValueLayerView.prototype.ap = function () {
        _super.prototype.ap.call(this);
    };
    FinalValueLayerView.prototype.b0 = 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 };
/*<BeginStatics Name="Infragistics.Controls.Charts.FinalValueLayer" />*/
/*<EndStatics Name="Infragistics.Controls.Charts.FinalValueLayer" />*/
