/*
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 { StraightNumericAxisBase } from "./StraightNumericAxisBase";
import { IScaler_$type } from "./IScaler";
import { markType } from "igniteui-react-core/ES5/type";
import { VerticalAxisLabelPanel } from "./VerticalAxisLabelPanel";
import { Rect } from "igniteui-react-core/ES5/Rect";
import { ScalerParams } from "./ScalerParams";
import { RangeInfo } from "./RangeInfo";
import { VerticalLogarithmicScaler } from "./VerticalLogarithmicScaler";
import { FastVerticalLinearScaler } from "./FastVerticalLinearScaler";
import { isNaN_ } from "igniteui-react-core/ES5/number";
import { StraightNumericAxisBaseView } from "./StraightNumericAxisBaseView";
var NumericYAxis = /** @class */ (function (_super) {
    tslib_1.__extends(NumericYAxis, _super);
    function NumericYAxis() {
        var _this = _super.call(this) || this;
        _this.ab = NumericYAxis.$;
        _this.i7 = _this.i5();
        return _this;
    }
    NumericYAxis.prototype.a1 = function () {
        return new NumericYAxisView(this);
    };
    NumericYAxis.prototype.as = function () {
        return new VerticalAxisLabelPanel();
    };
    NumericYAxis.prototype.get_ce = function () {
        return true;
    };
    Object.defineProperty(NumericYAxis.prototype, "ce", {
        get: function () {
            return this.get_ce();
        },
        enumerable: true,
        configurable: true
    });
    NumericYAxis.prototype.ds = function () {
        return this.it.height;
    };
    NumericYAxis.prototype.dt = function (a, b) {
        if (this.k6 != null) {
            return this.k6.p(a, b);
        }
        return this.k5.p(a, b);
    };
    NumericYAxis.prototype.gg = function (a, b, c, d) {
        if (this.k6 != null) {
            this.k6.v(a, b, c, d);
            return;
        }
        this.k5.v(a, b, c, d);
    };
    NumericYAxis.prototype.gf = function (a, b, c, d, e) {
        if (this.k6 != null) {
            this.k6.u(a, b, c, d, e);
            return;
        }
        this.k5.u(a, b, c, d, e);
    };
    NumericYAxis.prototype.dw = function (a, b) {
        if (this.k6 != null) {
            return this.k6.q(a, b);
        }
        return this.k5.q(a, b);
    };
    NumericYAxis.prototype.gh = function (a, b, c, d) {
        if (this.k6 != null) {
            this.k6.j(a, b, c, d);
            return;
        }
        this.k5.j(a, b, c, d);
    };
    NumericYAxis.prototype.ln = function (a, b) {
        if (this.bf == null || a == NaN || b == NaN) {
            return;
        }
        var c = this.lb(a, this);
        var d = this.lb(b, this);
        if (c == NaN || d == NaN) {
            return;
        }
        this.bf.my = new Rect(0, this.bf.my.x, d, this.bf.my.width, c - d);
    };
    NumericYAxis.prototype.i5 = function () {
        var _this = this;
        var a = _super.prototype.i5.call(this);
        a.b.c = function (b) {
            if (_this.aw == null || _this.aw.visibility == 0) {
                _this.at.a8 = b;
                if (_this.aw != null && (_this.aw.location == 7 || _this.aw.location == 6)) {
                    _this.bf.hp();
                }
            }
        };
        a.k = function (b, c, d) { return _this.gj(c, d, b.z, b.b, false); };
        a.l = function (b, c, d, e) { return _this.gk(c, d, e, b.z); };
        a.m = function (b, c) {
            var d = b.y;
            var e = new ScalerParams(0, b.aa, b.z, _this.b9, d);
            return _this.dt(c, e);
        };
        a.q = function (b, c) { return true; };
        a.j = function (b) { return _this.g8(b.t, b.n, b.z, b.a, true); };
        a.e = function (b) {
            b.n = (_this.aw.location == 7 || _this.aw.location == 3) ? b.z.right : b.z.left;
            var c = b.y;
            var d = new ScalerParams(0, b.aa, b.z, _this.b9, c);
            if (_this.ag != null && _this.ag.bf != null) {
                var e = b.n;
                var f = b.r;
                var g = _this.g3(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.i8 = function (a, b, c, d) {
        var e = d;
        var f = _super.prototype.i8.call(this, a, b, c, d);
        var g = new ScalerParams(0, b, a, this.b8, c);
        var h = NaN;
        var i = NaN;
        if (!this.b8 && b.top == 0) {
            i = this.jv;
        }
        else if (this.b8 && b.bottom == 1) {
            h = this.jv;
        }
        if (isNaN_(h)) {
            h = this.dw(e.bottom, g);
        }
        if (isNaN_(i)) {
            i = this.dw(e.top, g);
        }
        var j = Math.min(h, i);
        var k = Math.max(h, i);
        this.jz = j;
        this.jy = 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.g0 = function (a) {
        _super.prototype.g0.call(this, a);
        var b = this.bf != null ? this.bf.mk : Rect.empty;
        var c = this.it;
        var d = this.io();
        var e = this.im();
        var f = this.i7.c(a, c, b, d, e);
        if (f != null) {
            this.ju = f.f.m;
            this.jx = f.f.l;
        }
    };
    NumericYAxis.prototype.ha = function (a, b) {
        _super.prototype.ha.call(this, a, b);
        if (b.height != a.height) {
            this.ck();
        }
    };
    NumericYAxis.prototype.get_az = function () {
        return 1;
    };
    Object.defineProperty(NumericYAxis.prototype, "az", {
        get: function () {
            return this.get_az();
        },
        enumerable: true,
        configurable: true
    });
    NumericYAxis.prototype.ja = function () {
        if (this.jl) {
            return new VerticalLogarithmicScaler();
        }
        switch (this.k4) {
            case 0: return new FastVerticalLinearScaler();
            case 1: return new VerticalLogarithmicScaler();
        }
        return null;
    };
    NumericYAxis.prototype.j$c = function (a, b) {
        return this.dw.apply(this, arguments);
    };
    NumericYAxis.prototype.j$b = function (a, b) {
        return this.dt.apply(this, arguments);
    };
    NumericYAxis.prototype.j$d = function (a, b, c, d, e) {
        this.gf.apply(this, arguments);
    };
    NumericYAxis.prototype.j$e = function (a, b, c, d) {
        this.gg.apply(this, arguments);
    };
    NumericYAxis.prototype.j$f = function (a, b, c, d) {
        this.gh.apply(this, arguments);
    };
    Object.defineProperty(NumericYAxis.prototype, "j$a", {
        get: function () {
            return this.b8;
        },
        enumerable: true,
        configurable: true
    });
    NumericYAxis.$t = markType(NumericYAxis, 'NumericYAxis', StraightNumericAxisBase.$, [IScaler_$type]);
    return NumericYAxis;
}(StraightNumericAxisBase));
export { NumericYAxis };
var NumericYAxisView = /** @class */ (function (_super) {
    tslib_1.__extends(NumericYAxisView, _super);
    function NumericYAxisView(a) {
        var _this = _super.call(this, a) || this;
        _this.bh = null;
        _this.bh = a;
        return _this;
    }
    NumericYAxisView.$t = markType(NumericYAxisView, 'NumericYAxisView', StraightNumericAxisBaseView.$);
    return NumericYAxisView;
}(StraightNumericAxisBaseView));
export { NumericYAxisView };
