/*
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, TypeRegistrar } from "igniteui-angular-core";
import { HorizontalAxisLabelPanel } from "./HorizontalAxisLabelPanel";
import { ScalerParams } from "./ScalerParams";
import { Rect } from "igniteui-angular-core";
import { RangeInfo } from "./RangeInfo";
import { HorizontalLogarithmicScaler } from "./HorizontalLogarithmicScaler";
import { FastHorizontalLinearScaler } from "./FastHorizontalLinearScaler";
import { isNaN_ } from "igniteui-angular-core";
import { StraightNumericAxisBaseView } from "./StraightNumericAxisBaseView";
/**
 * @hidden
 */
var NumericXAxis = /** @class */ (function (_super) {
    tslib_1.__extends(NumericXAxis, _super);
    function NumericXAxis() {
        var _this = _super.call(this) || this;
        _this.ab = NumericXAxis.$;
        _this.jf = _this.jd();
        return _this;
    }
    NumericXAxis.prototype.a1 = function () {
        return new NumericXAxisView(this);
    };
    NumericXAxis.prototype.gs = function (a) {
        _super.prototype.gs.call(this, a);
        this.lv = a;
    };
    NumericXAxis.prototype.as = function () {
        if (this.cp) {
            return (TypeRegistrar.create('HorizontalSmartAxisLabelPanel'));
        }
        else {
            return new HorizontalAxisLabelPanel();
        }
    };
    NumericXAxis.prototype.jd = function () {
        var _this = this;
        var a = _super.prototype.jd.call(this);
        a.b.c = function (b) {
            if ((_this.aw == null || _this.aw.visibility == 0) && _this.ag != null) {
                _this.at.a8 = b;
                if (_this.aw != null && (_this.aw.location == 4 || _this.aw.location == 5)) {
                    _this.bf.ht();
                }
            }
        };
        a.k = function (b, c, d) { return _this.hf(c, d, b.z, b.b, false); };
        a.l = function (b, c, d, e) { return _this.hg(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.dw(c, e);
        };
        a.q = function (b, c) { return true; };
        a.j = function (b) { return _this.gq(b.t, b.n, b.z, b.a, true); };
        a.e = function (b) {
            b.n = b.z.bottom;
            if (_this.ag != null && _this.ag.bf != null) {
                var c = b.n;
                var d = b.r;
                var e = _this.ha(c, d, b.aa, b.z, b.y, b.z.top, b.z.bottom);
                c = e.p0;
                d = e.p1;
                b.n = c;
                b.r = d;
            }
        };
        a.p = function (b, c, d) {
            var e = Math.round(c);
            return e >= Math.floor(b.z.left) && e <= Math.ceil(b.z.right);
        };
        return a;
    };
    NumericXAxis.prototype.dw = function (a, b) {
        if (this.le != null) {
            return this.le.p(a, b);
        }
        return this.ld.p(a, b);
    };
    NumericXAxis.prototype.dz = function (a, b) {
        if (this.le != null) {
            return this.le.q(a, b);
        }
        return this.ld.q(a, b);
    };
    NumericXAxis.prototype.gn = function (a, b, c, d) {
        if (this.le != null) {
            this.le.v(a, b, c, d);
            return;
        }
        this.ld.v(a, b, c, d);
    };
    NumericXAxis.prototype.gm = function (a, b, c, d, e) {
        if (this.le != null) {
            this.le.u(a, b, c, d, e);
            return;
        }
        this.ld.u(a, b, c, d, e);
    };
    NumericXAxis.prototype.go = function (a, b, c, d) {
        if (this.le != null) {
            this.le.j(a, b, c, d);
            return;
        }
        this.ld.j(a, b, c, d);
    };
    NumericXAxis.prototype.lw = function (a, b) {
        if (this.bf == null || a == NaN || b == NaN) {
            return;
        }
        var c = this.lj(a, this);
        var d = this.lj(b, this);
        if (c == NaN || d == NaN) {
            return;
        }
        this.bf.m4 = new Rect(0, c, this.bf.m4.y, d - c, this.bf.m4.height);
    };
    NumericXAxis.prototype.jg = function (a, b, c, d) {
        var e = d;
        var f = _super.prototype.jg.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.right == 1) {
            i = this.j3;
        }
        else if (this.b8 && b.left == 0) {
            h = this.j3;
        }
        if (isNaN_(h)) {
            h = this.dz(e.left, g);
        }
        if (isNaN_(i)) {
            i = this.dz(e.right, g);
        }
        var j = Math.min(h, i);
        var k = Math.max(h, i);
        this.j7 = j;
        this.j6 = k;
        f.k.add(((function () {
            var $ret = new RangeInfo();
            $ret.d = j;
            $ret.c = k;
            $ret.b = e.width;
            return $ret;
        })()));
        return f;
    };
    NumericXAxis.prototype.g7 = function (a) {
        _super.prototype.g7.call(this, a);
        var b = this.bf != null ? this.bf.mq : Rect.empty;
        var c = !b.isEmpty ? this.i1 : Rect.empty;
        var d = this.iw();
        var e = this.iv();
        var f = this.jf.c(a, c, b, d, e);
        if (f != null) {
            this.j2 = f.f.m;
            this.j5 = f.f.l;
        }
    };
    NumericXAxis.prototype.hh = function (a, b) {
        _super.prototype.hh.call(this, a, b);
        if (b.height != a.height) {
            this.cl();
        }
    };
    NumericXAxis.prototype.get_az = function () {
        return 0;
    };
    Object.defineProperty(NumericXAxis.prototype, "az", {
        get: function () {
            return this.get_az();
        },
        enumerable: true,
        configurable: true
    });
    NumericXAxis.prototype.ji = function () {
        if (this.jt) {
            return new HorizontalLogarithmicScaler();
        }
        switch (this.lc) {
            case 0: return new FastHorizontalLinearScaler();
            case 1: return new HorizontalLogarithmicScaler();
        }
        return null;
    };
    NumericXAxis.prototype.j$c = function (a, b) {
        return this.dz.apply(this, arguments);
    };
    NumericXAxis.prototype.j$b = function (a, b) {
        return this.dw.apply(this, arguments);
    };
    NumericXAxis.prototype.j$d = function (a, b, c, d, e) {
        this.gm.apply(this, arguments);
    };
    NumericXAxis.prototype.j$e = function (a, b, c, d) {
        this.gn.apply(this, arguments);
    };
    NumericXAxis.prototype.j$f = function (a, b, c, d) {
        this.go.apply(this, arguments);
    };
    Object.defineProperty(NumericXAxis.prototype, "j$a", {
        get: function () {
            return this.b8;
        },
        enumerable: true,
        configurable: true
    });
    NumericXAxis.$t = markType(NumericXAxis, 'NumericXAxis', StraightNumericAxisBase.$, [IScaler_$type]);
    return NumericXAxis;
}(StraightNumericAxisBase));
export { NumericXAxis };
/**
 * @hidden
 */
var NumericXAxisView = /** @class */ (function (_super) {
    tslib_1.__extends(NumericXAxisView, _super);
    function NumericXAxisView(a) {
        var _this = _super.call(this, a) || this;
        _this.bi = null;
        _this.bi = a;
        return _this;
    }
    NumericXAxisView.$t = markType(NumericXAxisView, 'NumericXAxisView', StraightNumericAxisBaseView.$);
    return NumericXAxisView;
}(StraightNumericAxisBaseView));
export { NumericXAxisView };
//# sourceMappingURL=NumericXAxis_combined.js.map