/*
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 { 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";
import { AxisDefaults } from "./AxisDefaults";
/**
 * @hidden
 */
export let NumericXAxis = /*@__PURE__*/ (() => {
    class NumericXAxis extends StraightNumericAxisBase {
        constructor() {
            super();
            this.ab = NumericXAxis.$;
            this.ky = this.kw();
        }
        a3() {
            return new NumericXAxisView(this);
        }
        hr(a) {
            super.hr(a);
            this.ny = a;
        }
        au() {
            if (this.c5) {
                return (TypeRegistrar.create('HorizontalSmartAxisLabelPanel'));
            }
            else {
                return new HorizontalAxisLabelPanel();
            }
        }
        kw() {
            let a = super.kw();
            a.b.c = (b) => {
                if ((this.ay == null || this.ay.visibility == 0) && this.ai != null) {
                    this.av.bg = b;
                    if (this.ay != null && (this.ay.location == 4 || this.ay.location == 5)) {
                        this.bh.l6();
                    }
                }
            };
            a.k = (b, c, d) => this.il(c, d, b.z, b.b, false);
            a.l = (b, c, d, e) => this.im(c, d, e, b.z);
            a.m = (b, c) => {
                let d = b.y;
                let e = new ScalerParams(0, b.aa, b.z, this.ch, d);
                return this.ei(c, e);
            };
            a.q = (b, c) => true;
            a.j = (b) => this.hp(b.t, b.n, b.z, b.a, true);
            a.e = (b) => {
                b.n = b.z.bottom;
                if (this.ai != null && this.ai.bh != null) {
                    let c = b.n;
                    let d = b.r;
                    let e = this.id(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 = (b, c, d) => {
                let e = Math.round(c);
                return e >= Math.floor(b.z.left) && e <= Math.ceil(b.z.right);
            };
            return a;
        }
        ei(a, b) {
            if (this.nh != null) {
                return this.nh.p(a, b);
            }
            return this.ng.p(a, b);
        }
        el(a, b) {
            if (this.nh != null) {
                return this.nh.q(a, b);
            }
            return this.ng.q(a, b);
        }
        hm(a, b, c, d) {
            if (this.nh != null) {
                this.nh.v(a, b, c, d);
                return;
            }
            this.ng.v(a, b, c, d);
        }
        hl(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);
        }
        hn(a, b, c, d) {
            if (this.nh != null) {
                this.nh.j(a, b, c, d);
                return;
            }
            this.ng.j(a, b, c, d);
        }
        nz(a, b) {
            if (this.bh == null || isNaN_(a) || isNaN_(b)) {
                return;
            }
            let c = this.nm(a, this);
            let d = this.nm(b, this);
            if (isNaN_(c) || isNaN_(d)) {
                return;
            }
            this.bh.tp = new Rect(0, c, this.bh.tp.y, d - c, this.bh.tp.height);
        }
        kz(a, b, c, d) {
            let e = d;
            let f = super.kz(a, b, c, d);
            let g = new ScalerParams(0, b, a, this.cg, c);
            let h = NaN;
            let i = NaN;
            if (!this.cg && b.right == 1) {
                i = this.lu;
            }
            else if (this.cg && b.left == 0) {
                h = this.lu;
            }
            if (isNaN_(h)) {
                h = this.el(e.left, g);
            }
            if (isNaN_(i)) {
                i = this.el(e.right, g);
            }
            let j = Math.min(h, i);
            let k = Math.max(h, i);
            this.ly = j;
            this.lx = k;
            f.k.add(((() => {
                let $ret = new RangeInfo();
                $ret.d = j;
                $ret.c = k;
                $ret.b = e.width;
                return $ret;
            })()));
            return f;
        }
        h8(a) {
            super.h8(a);
            let b = this.bh != null ? this.bh.s9 : Rect.empty;
            let c = !b.isEmpty ? this.kc : Rect.empty;
            let d = this.j7();
            let e = this.j6();
            let f = this.ky.c(a, c, b, d, e);
            if (f != null) {
                this.lt = f.f.m;
                this.lw = f.f.l;
            }
        }
        io(a, b) {
            super.io(a, b);
            if (b.height != a.height) {
                this.c0();
            }
        }
        get_a1() {
            return 0;
        }
        get a1() {
            return this.get_a1();
        }
        k1() {
            if (this.lg) {
                return new HorizontalLogarithmicScaler();
            }
            switch (this.nf) {
                case 0: return new FastHorizontalLinearScaler();
                case 1: return new HorizontalLogarithmicScaler();
            }
            return null;
        }
        j$c(a, b) {
            return this.el.apply(this, arguments);
        }
        j$b(a, b) {
            return this.ei.apply(this, arguments);
        }
        j$d(a, b, c, d, e) {
            this.hl.apply(this, arguments);
        }
        j$e(a, b, c, d) {
            this.hm.apply(this, arguments);
        }
        j$f(a, b, c, d) {
            this.hn.apply(this, arguments);
        }
        get j$a() {
            return this.cg;
        }
    }
    NumericXAxis.$t = markType(NumericXAxis, 'NumericXAxis', StraightNumericAxisBase.$, [IScaler_$type]);
    return NumericXAxis;
})();
/**
 * @hidden
 */
export let NumericXAxisView = /*@__PURE__*/ (() => {
    class NumericXAxisView extends StraightNumericAxisBaseView {
        constructor(a) {
            super(a);
            this.bl = null;
            this.bl = a;
        }
        aj() {
            super.aj();
            this.a.jv = AxisDefaults.h;
        }
    }
    NumericXAxisView.$t = markType(NumericXAxisView, 'NumericXAxisView', StraightNumericAxisBaseView.$);
    return NumericXAxisView;
})();
