/*
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 { __extends } from "tslib";
import { StraightNumericAxisBase } from "./StraightNumericAxisBase";
import { IScaler_$type } from "./IScaler";
import { markType } from "igniteui-react-core";
import { VerticalAxisLabelPanel } from "./VerticalAxisLabelPanel";
import { Rect } from "igniteui-react-core";
import { ScalerParams } from "./ScalerParams";
import { RangeInfo } from "./RangeInfo";
import { VerticalLogarithmicScaler } from "./VerticalLogarithmicScaler";
import { FastVerticalLinearScaler } from "./FastVerticalLinearScaler";
import { isNaN_ } from "igniteui-react-core";
import { StraightNumericAxisBaseView } from "./StraightNumericAxisBaseView";
import { AxisDefaults } from "./AxisDefaults";
/**
 * @hidden
 */
var NumericYAxis = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(NumericYAxis, _super);
    function NumericYAxis() {
        var _this = _super.call(this) || this;
        _this.ab = NumericYAxis.$;
        _this.k4 = _this.k2();
        return _this;
    }
    NumericYAxis.prototype.a4 = function () {
        return new NumericYAxisView(this);
    };
    NumericYAxis.prototype.av = function () {
        return new VerticalAxisLabelPanel();
    };
    NumericYAxis.prototype.get_cp = function () {
        return true;
    };
    NumericYAxis.prototype.ek = function () {
        return this.kb().height;
    };
    NumericYAxis.prototype.el = function (a, b) {
        if (this.n2 != null) {
            return this.n2.p(a, b);
        }
        return this.n1.p(a, b);
    };
    NumericYAxis.prototype.hq = function (a, b, c, d) {
        if (this.n2 != null) {
            this.n2.v(a, b, c, d);
            return;
        }
        this.n1.v(a, b, c, d);
    };
    NumericYAxis.prototype.hp = function (a, b, c, d, e) {
        if (this.n2 != null) {
            this.n2.u(a, b, c, d, e);
            return;
        }
        this.n1.u(a, b, c, d, e);
    };
    NumericYAxis.prototype.eo = function (a, b) {
        if (this.n2 != null) {
            return this.n2.q(a, b);
        }
        return this.n1.q(a, b);
    };
    NumericYAxis.prototype.hr = function (a, b, c, d) {
        if (this.n2 != null) {
            this.n2.j(a, b, c, d);
            return;
        }
        this.n1.j(a, b, c, d);
    };
    NumericYAxis.prototype.oj = function (a, b) {
        if (this.bi == null || isNaN_(a) || isNaN_(b)) {
            return;
        }
        var c = this.n7(a, this);
        var d = this.n7(b, this);
        if (isNaN_(c) || isNaN_(d)) {
            return;
        }
        this.bi.wk = new Rect(0, this.bi.wk.x, d, this.bi.wk.width, c - d);
    };
    NumericYAxis.prototype.k2 = function () {
        var _this = this;
        var a = _super.prototype.k2.call(this);
        a.b.c = function (b) {
            if (_this.az == null || _this.az.visibility == 0) {
                _this.aw.bg = b;
                if (_this.az != null && (_this.az.location == 7 || _this.az.location == 6)) {
                    _this.bi.n3();
                }
            }
        };
        a.k = function (b, c, d) { return _this.ht(c, d, b.aa, b.b, false); };
        a.l = function (b, c, d, e) { return _this.hu(c, d, e, b.aa); };
        a.m = function (b, c) {
            var d = b.z;
            var e = new ScalerParams(0, b.ab, b.aa, _this.ci, d);
            return _this.el(c, e);
        };
        a.q = function (b, c) { return true; };
        a.j = function (b) { return _this.iq(b.u, b.n, b.aa, b.a, true); };
        a.e = function (b) {
            b.n = _this.az != null && (_this.az.location == 7 || _this.az.location == 3) ? b.aa.right : b.aa.left;
            var c = b.z;
            var d = new ScalerParams(0, b.ab, b.aa, _this.ci, c);
            if (_this.aj != null && _this.aj.bi != null) {
                var e = b.n;
                var f = b.r;
                var g = _this.ii(e, f, b.ab, b.aa, b.z, b.aa.left, b.aa.right);
                e = g.p0;
                f = g.p1;
                b.n = e;
                b.r = f;
            }
        };
        a.p = function (b, c, d) {
            var e = Math.round(c);
            return e >= Math.floor(b.aa.top) && e <= Math.ceil(b.aa.bottom);
        };
        return a;
    };
    NumericYAxis.prototype.k5 = function (a, b, c, d) {
        var e = d;
        var f = _super.prototype.k5.call(this, a, b, c, d);
        var g = new ScalerParams(0, b, a, this.ch, c);
        var h = NaN;
        var i = NaN;
        if (!this.ch && b.top == 0) {
            i = this.l3;
        }
        else if (this.ch && b.bottom == 1) {
            h = this.l3;
        }
        if (isNaN_(h)) {
            h = this.eo(e.bottom, g);
        }
        if (isNaN_(i)) {
            i = this.eo(e.top, g);
        }
        var j = Math.min(h, i);
        var k = Math.max(h, i);
        this.l7 = j;
        this.l6 = k;
        var l = ((function () {
            var $ret = new RangeInfo();
            $ret.d = j;
            $ret.c = k;
            $ret.b = e.height;
            return $ret;
        })());
        f.k.add(l);
        return f;
    };
    NumericYAxis.prototype.ic = function (a) {
        _super.prototype.ic.call(this, a);
        var b = this.bi != null ? this.bi.v4 : Rect.empty;
        var c = this.kh;
        var d = this.kc();
        var e = this.kb();
        var f = this.k4.c(a, c, b, d, e);
        if (f != null) {
            this.l2 = f.f.m;
            this.l5 = f.f.l;
        }
    };
    NumericYAxis.prototype.is = function (a, b) {
        _super.prototype.is.call(this, a, b);
        if (b.height != a.height) {
            this.c1();
        }
    };
    NumericYAxis.prototype.get_a2 = function () {
        return 1;
    };
    Object.defineProperty(NumericYAxis.prototype, "a2", {
        get: function () {
            return this.get_a2();
        },
        enumerable: false,
        configurable: true
    });
    NumericYAxis.prototype.k7 = function () {
        if (this.lo) {
            return new VerticalLogarithmicScaler();
        }
        switch (this.n0) {
            case 0: return new FastVerticalLinearScaler();
            case 1: return new VerticalLogarithmicScaler();
        }
        return null;
    };
    NumericYAxis.prototype.j$d = function (a, b) {
        return this.eo.apply(this, arguments);
    };
    NumericYAxis.prototype.j$c = function (a, b) {
        return this.el.apply(this, arguments);
    };
    NumericYAxis.prototype.j$e = function (a, b, c, d, e) {
        this.hp.apply(this, arguments);
    };
    NumericYAxis.prototype.j$f = function (a, b, c, d) {
        this.hq.apply(this, arguments);
    };
    NumericYAxis.prototype.j$g = function (a, b, c, d) {
        this.hr.apply(this, arguments);
    };
    Object.defineProperty(NumericYAxis.prototype, "j$b", {
        get: function () {
            return this.ch;
        },
        enumerable: false,
        configurable: true
    });
    NumericYAxis.prototype.j$a = function () {
        return this.ag.apply(this, arguments);
    };
    NumericYAxis.$t = markType(NumericYAxis, 'NumericYAxis', StraightNumericAxisBase.$, [IScaler_$type]);
    return NumericYAxis;
}(StraightNumericAxisBase));
export { NumericYAxis };
/**
 * @hidden
 */
var NumericYAxisView = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(NumericYAxisView, _super);
    function NumericYAxisView(a) {
        var _this = _super.call(this, a) || this;
        _this.bo = null;
        _this.bo = a;
        return _this;
    }
    NumericYAxisView.prototype.al = function () {
        _super.prototype.al.call(this);
        this.a.jz = AxisDefaults.h;
    };
    NumericYAxisView.$t = markType(NumericYAxisView, 'NumericYAxisView', StraightNumericAxisBaseView.$);
    return NumericYAxisView;
}(StraightNumericAxisBaseView));
export { NumericYAxisView };
