/*
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-angular-core";
import { VerticalAxisLabelPanel } from "./VerticalAxisLabelPanel";
import { Rect } from "igniteui-angular-core";
import { ScalerParams } from "./ScalerParams";
import { RangeInfo } from "./RangeInfo";
import { VerticalLogarithmicScaler } from "./VerticalLogarithmicScaler";
import { FastVerticalLinearScaler } from "./FastVerticalLinearScaler";
import { isNaN_ } from "igniteui-angular-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.ky = _this.kw();
        return _this;
    }
    NumericYAxis.prototype.a3 = function () {
        return new NumericYAxisView(this);
    };
    NumericYAxis.prototype.au = function () {
        return new VerticalAxisLabelPanel();
    };
    NumericYAxis.prototype.get_co = function () {
        return true;
    };
    NumericYAxis.prototype.eh = function () {
        return this.j6().height;
    };
    NumericYAxis.prototype.ei = function (a, b) {
        if (this.nh != null) {
            return this.nh.p(a, b);
        }
        return this.ng.p(a, b);
    };
    NumericYAxis.prototype.hm = function (a, b, c, d) {
        if (this.nh != null) {
            this.nh.v(a, b, c, d);
            return;
        }
        this.ng.v(a, b, c, d);
    };
    NumericYAxis.prototype.hl = function (a, b, c, d, e) {
        if (this.nh != null) {
            this.nh.u(a, b, c, d, e);
            return;
        }
        this.ng.u(a, b, c, d, e);
    };
    NumericYAxis.prototype.el = function (a, b) {
        if (this.nh != null) {
            return this.nh.q(a, b);
        }
        return this.ng.q(a, b);
    };
    NumericYAxis.prototype.hn = function (a, b, c, d) {
        if (this.nh != null) {
            this.nh.j(a, b, c, d);
            return;
        }
        this.ng.j(a, b, c, d);
    };
    NumericYAxis.prototype.ny = function (a, b) {
        if (this.bh == null || a == NaN || b == NaN) {
            return;
        }
        var c = this.nm(a, this);
        var d = this.nm(b, this);
        if (c == NaN || d == NaN) {
            return;
        }
        this.bh.sv = new Rect(0, this.bh.sv.x, d, this.bh.sv.width, c - d);
    };
    NumericYAxis.prototype.kw = function () {
        var _this = this;
        var a = _super.prototype.kw.call(this);
        a.b.c = function (b) {
            if (_this.ay == null || _this.ay.visibility == 0) {
                _this.av.bg = b;
                if (_this.ay != null && (_this.ay.location == 7 || _this.ay.location == 6)) {
                    _this.bh.lj();
                }
            }
        };
        a.k = function (b, c, d) { return _this.hp(c, d, b.z, b.b, false); };
        a.l = function (b, c, d, e) { return _this.hq(c, d, e, b.z); };
        a.m = function (b, c) {
            var d = b.y;
            var e = new ScalerParams(0, b.aa, b.z, _this.ch, d);
            return _this.ei(c, e);
        };
        a.q = function (b, c) { return true; };
        a.j = function (b) { return _this.il(b.t, b.n, b.z, b.a, true); };
        a.e = function (b) {
            b.n = _this.ay != null && (_this.ay.location == 7 || _this.ay.location == 3) ? b.z.right : b.z.left;
            var c = b.y;
            var d = new ScalerParams(0, b.aa, b.z, _this.ch, c);
            if (_this.ai != null && _this.ai.bh != null) {
                var e = b.n;
                var f = b.r;
                var g = _this.id(e, f, b.aa, b.z, b.y, b.z.left, b.z.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.z.top) && e <= Math.ceil(b.z.bottom);
        };
        return a;
    };
    NumericYAxis.prototype.kz = function (a, b, c, d) {
        var e = d;
        var f = _super.prototype.kz.call(this, a, b, c, d);
        var g = new ScalerParams(0, b, a, this.cg, c);
        var h = NaN;
        var i = NaN;
        if (!this.cg && b.top == 0) {
            i = this.lu;
        }
        else if (this.cg && b.bottom == 1) {
            h = this.lu;
        }
        if (isNaN_(h)) {
            h = this.el(e.bottom, g);
        }
        if (isNaN_(i)) {
            i = this.el(e.top, g);
        }
        var j = Math.min(h, i);
        var k = Math.max(h, i);
        this.ly = j;
        this.lx = 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.h8 = function (a) {
        _super.prototype.h8.call(this, a);
        var b = this.bh != null ? this.bh.sf : Rect.empty;
        var c = this.kc;
        var d = this.j7();
        var e = this.j6();
        var f = this.ky.c(a, c, b, d, e);
        if (f != null) {
            this.lt = f.f.m;
            this.lw = f.f.l;
        }
    };
    NumericYAxis.prototype.io = function (a, b) {
        _super.prototype.io.call(this, a, b);
        if (b.height != a.height) {
            this.c0();
        }
    };
    NumericYAxis.prototype.get_a1 = function () {
        return 1;
    };
    Object.defineProperty(NumericYAxis.prototype, "a1", {
        get: function () {
            return this.get_a1();
        },
        enumerable: false,
        configurable: true
    });
    NumericYAxis.prototype.k1 = function () {
        if (this.lg) {
            return new VerticalLogarithmicScaler();
        }
        switch (this.nf) {
            case 0: return new FastVerticalLinearScaler();
            case 1: return new VerticalLogarithmicScaler();
        }
        return null;
    };
    NumericYAxis.prototype.j$c = function (a, b) {
        return this.el.apply(this, arguments);
    };
    NumericYAxis.prototype.j$b = function (a, b) {
        return this.ei.apply(this, arguments);
    };
    NumericYAxis.prototype.j$d = function (a, b, c, d, e) {
        this.hl.apply(this, arguments);
    };
    NumericYAxis.prototype.j$e = function (a, b, c, d) {
        this.hm.apply(this, arguments);
    };
    NumericYAxis.prototype.j$f = function (a, b, c, d) {
        this.hn.apply(this, arguments);
    };
    Object.defineProperty(NumericYAxis.prototype, "j$a", {
        get: function () {
            return this.cg;
        },
        enumerable: false,
        configurable: true
    });
    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.bl = null;
        _this.bl = a;
        return _this;
    }
    NumericYAxisView.prototype.aj = function () {
        _super.prototype.aj.call(this);
        this.a.jv = AxisDefaults.h;
    };
    NumericYAxisView.$t = markType(NumericYAxisView, 'NumericYAxisView', StraightNumericAxisBaseView.$);
    return NumericYAxisView;
}(StraightNumericAxisBaseView));
export { NumericYAxisView };
