/*
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/ES2015/type";
import { HorizontalAxisLabelPanel } from "./HorizontalAxisLabelPanel";
import { ScalerParams } from "./ScalerParams";
import { Rect } from "igniteui-angular-core/ES2015/Rect";
import { RangeInfo } from "./RangeInfo";
import { HorizontalLogarithmicScaler } from "./HorizontalLogarithmicScaler";
import { FastHorizontalLinearScaler } from "./FastHorizontalLinearScaler";
import { isNaN_ } from "igniteui-angular-core/ES2015/number";
import { StraightNumericAxisBaseView } from "./StraightNumericAxisBaseView";
/**
 * @hidden
 */
export class NumericXAxis extends StraightNumericAxisBase {
    constructor() {
        super();
        this.ab = NumericXAxis.$;
        this.i8 = this.i6();
    }
    a1() {
        return new NumericXAxisView(this);
    }
    gm(a) {
        super.gm(a);
        this.lo = a;
    }
    as() {
        if (this.co) {
            return (TypeRegistrar.create('HorizontalSmartAxisLabelPanel'));
        }
        else {
            return new HorizontalAxisLabelPanel();
        }
    }
    i6() {
        let a = super.i6();
        a.b.c = (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 = (b, c, d) => this.g9(c, d, b.z, b.b, false);
        a.l = (b, c, d, e) => this.ha(c, d, e, b.z);
        a.m = (b, c) => {
            let d = b.y;
            let e = new ScalerParams(0, b.aa, b.z, this.b9, d);
            return this.dt(c, e);
        };
        a.q = (b, c) => true;
        a.j = (b) => this.gk(b.t, b.n, b.z, b.a, true);
        a.e = (b) => {
            b.n = b.z.bottom;
            if (this.ag != null && this.ag.bf != null) {
                let c = b.n;
                let d = b.r;
                let e = this.g4(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;
    }
    dt(a, b) {
        if (this.k7 != null) {
            return this.k7.p(a, b);
        }
        return this.k6.p(a, b);
    }
    dw(a, b) {
        if (this.k7 != null) {
            return this.k7.q(a, b);
        }
        return this.k6.q(a, b);
    }
    gh(a, b, c, d) {
        if (this.k7 != null) {
            this.k7.v(a, b, c, d);
            return;
        }
        this.k6.v(a, b, c, d);
    }
    gg(a, b, c, d, e) {
        if (this.k7 != null) {
            this.k7.u(a, b, c, d, e);
            return;
        }
        this.k6.u(a, b, c, d, e);
    }
    gi(a, b, c, d) {
        if (this.k7 != null) {
            this.k7.j(a, b, c, d);
            return;
        }
        this.k6.j(a, b, c, d);
    }
    lp(a, b) {
        if (this.bf == null || a == NaN || b == NaN) {
            return;
        }
        let c = this.lc(a, this);
        let d = this.lc(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);
    }
    i9(a, b, c, d) {
        let e = d;
        let f = super.i9(a, b, c, d);
        let g = new ScalerParams(0, b, a, this.b8, c);
        let h = NaN;
        let i = NaN;
        if (!this.b8 && b.right == 1) {
            i = this.jw;
        }
        else if (this.b8 && b.left == 0) {
            h = this.jw;
        }
        if (isNaN_(h)) {
            h = this.dw(e.left, g);
        }
        if (isNaN_(i)) {
            i = this.dw(e.right, g);
        }
        let j = Math.min(h, i);
        let k = Math.max(h, i);
        this.j0 = j;
        this.jz = k;
        f.k.add(((() => {
            let $ret = new RangeInfo();
            $ret.d = j;
            $ret.c = k;
            $ret.b = e.width;
            return $ret;
        })()));
        return f;
    }
    g1(a) {
        super.g1(a);
        let b = this.bf != null ? this.bf.mq : Rect.empty;
        let c = !b.isEmpty ? this.iu : Rect.empty;
        let d = this.ip();
        let e = this.io();
        let f = this.i8.c(a, c, b, d, e);
        if (f != null) {
            this.jv = f.f.m;
            this.jy = f.f.l;
        }
    }
    hb(a, b) {
        super.hb(a, b);
        if (b.height != a.height) {
            this.ck();
        }
    }
    get_az() {
        return 0;
    }
    get az() {
        return this.get_az();
    }
    jb() {
        if (this.jm) {
            return new HorizontalLogarithmicScaler();
        }
        switch (this.k5) {
            case 0: return new FastHorizontalLinearScaler();
            case 1: return new HorizontalLogarithmicScaler();
        }
        return null;
    }
    j$c(a, b) {
        return this.dw.apply(this, arguments);
    }
    j$b(a, b) {
        return this.dt.apply(this, arguments);
    }
    j$d(a, b, c, d, e) {
        this.gg.apply(this, arguments);
    }
    j$e(a, b, c, d) {
        this.gh.apply(this, arguments);
    }
    j$f(a, b, c, d) {
        this.gi.apply(this, arguments);
    }
    get j$a() {
        return this.b8;
    }
}
NumericXAxis.$t = markType(NumericXAxis, 'NumericXAxis', StraightNumericAxisBase.$, [IScaler_$type]);
/**
 * @hidden
 */
export class NumericXAxisView extends StraightNumericAxisBaseView {
    constructor(a) {
        super(a);
        this.bh = null;
        this.bh = a;
    }
}
NumericXAxisView.$t = markType(NumericXAxisView, 'NumericXAxisView', StraightNumericAxisBaseView.$);
//# sourceMappingURL=NumericXAxis_combined.js.map