/*
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.je = this.jc();
    }
    a1() {
        return new NumericXAxisView(this);
    }
    gr(a) {
        super.gr(a);
        this.lu = a;
    }
    as() {
        if (this.co) {
            return (TypeRegistrar.create('HorizontalSmartAxisLabelPanel'));
        }
        else {
            return new HorizontalAxisLabelPanel();
        }
    }
    jc() {
        let a = super.jc();
        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.he(c, d, b.z, b.b, false);
        a.l = (b, c, d, e) => this.hf(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.dv(c, e);
        };
        a.q = (b, c) => true;
        a.j = (b) => this.gp(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.g9(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;
    }
    dv(a, b) {
        if (this.ld != null) {
            return this.ld.p(a, b);
        }
        return this.lc.p(a, b);
    }
    dy(a, b) {
        if (this.ld != null) {
            return this.ld.q(a, b);
        }
        return this.lc.q(a, b);
    }
    gm(a, b, c, d) {
        if (this.ld != null) {
            this.ld.v(a, b, c, d);
            return;
        }
        this.lc.v(a, b, c, d);
    }
    gl(a, b, c, d, e) {
        if (this.ld != null) {
            this.ld.u(a, b, c, d, e);
            return;
        }
        this.lc.u(a, b, c, d, e);
    }
    gn(a, b, c, d) {
        if (this.ld != null) {
            this.ld.j(a, b, c, d);
            return;
        }
        this.lc.j(a, b, c, d);
    }
    lv(a, b) {
        if (this.bf == null || a == NaN || b == NaN) {
            return;
        }
        let c = this.li(a, this);
        let d = this.li(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);
    }
    jf(a, b, c, d) {
        let e = d;
        let f = super.jf(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.j2;
        }
        else if (this.b8 && b.left == 0) {
            h = this.j2;
        }
        if (isNaN_(h)) {
            h = this.dy(e.left, g);
        }
        if (isNaN_(i)) {
            i = this.dy(e.right, g);
        }
        let j = Math.min(h, i);
        let k = Math.max(h, i);
        this.j6 = j;
        this.j5 = k;
        f.k.add(((() => {
            let $ret = new RangeInfo();
            $ret.d = j;
            $ret.c = k;
            $ret.b = e.width;
            return $ret;
        })()));
        return f;
    }
    g6(a) {
        super.g6(a);
        let b = this.bf != null ? this.bf.mq : Rect.empty;
        let c = !b.isEmpty ? this.i0 : Rect.empty;
        let d = this.iv();
        let e = this.iu();
        let f = this.je.c(a, c, b, d, e);
        if (f != null) {
            this.j1 = f.f.m;
            this.j4 = f.f.l;
        }
    }
    hg(a, b) {
        super.hg(a, b);
        if (b.height != a.height) {
            this.ck();
        }
    }
    get_az() {
        return 0;
    }
    get az() {
        return this.get_az();
    }
    jh() {
        if (this.js) {
            return new HorizontalLogarithmicScaler();
        }
        switch (this.lb) {
            case 0: return new FastHorizontalLinearScaler();
            case 1: return new HorizontalLogarithmicScaler();
        }
        return null;
    }
    j$c(a, b) {
        return this.dy.apply(this, arguments);
    }
    j$b(a, b) {
        return this.dv.apply(this, arguments);
    }
    j$d(a, b, c, d, e) {
        this.gl.apply(this, arguments);
    }
    j$e(a, b, c, d) {
        this.gm.apply(this, arguments);
    }
    j$f(a, b, c, d) {
        this.gn.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.bi = null;
        this.bi = a;
    }
}
NumericXAxisView.$t = markType(NumericXAxisView, 'NumericXAxisView', StraightNumericAxisBaseView.$);
//# sourceMappingURL=NumericXAxis_combined.js.map