/*
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 } from "igniteui-angular-core";
import { VerticalAxisLabelPanel } from "./VerticalAxisLabelPanel";
import { Rect } from "igniteui-angular-core";
import { ScalerParams } from "./ScalerParams";
import { RangeInfo } from "./RangeInfo";
import { VerticalLogarithmicScaler } from "./VerticalLogarithmicScaler";
import { FastVerticalLinearScaler } from "./FastVerticalLinearScaler";
import { isNaN_ } from "igniteui-angular-core";
import { StraightNumericAxisBaseView } from "./StraightNumericAxisBaseView";
import { AxisDefaults } from "./AxisDefaults";
/**
 * @hidden
 */
export let NumericYAxis = /*@__PURE__*/ (() => {
    class NumericYAxis extends StraightNumericAxisBase {
        constructor() {
            super();
            this.ab = NumericYAxis.$;
            this.oq = this.oo();
        }
        bm() {
            return new NumericYAxisView(this);
        }
        az() {
            return new VerticalAxisLabelPanel();
        }
        ak() {
            return new NumericYAxis();
        }
        get_dq() {
            return true;
        }
        fs() {
            return this.nv().height;
        }
        ft(a, b) {
            if (this.r6 != null) {
                return this.r6.p(a, b);
            }
            return this.r5.p(a, b);
        }
        j6(a, b, c, d) {
            if (this.r6 != null) {
                this.r6.v(a, b, c, d);
                return;
            }
            this.r5.v(a, b, c, d);
        }
        j5(a, b, c, d, e) {
            if (this.r6 != null) {
                this.r6.u(a, b, c, d, e);
                return;
            }
            this.r5.u(a, b, c, d, e);
        }
        fw(a, b) {
            if (this.r6 != null) {
                return this.r6.q(a, b);
            }
            return this.r5.q(a, b);
        }
        j7(a, b, c, d) {
            if (this.r6 != null) {
                this.r6.j(a, b, c, d);
                return;
            }
            this.r5.j(a, b, c, d);
        }
        sn(a, b) {
            if (this.b0 == null || isNaN_(a) || isNaN_(b)) {
                return;
            }
            let c = this.sb(a, this);
            let d = this.sb(b, this);
            if (isNaN_(c) || isNaN_(d)) {
                return;
            }
            this.b0.x5 = new Rect(0, this.b0.x5.x, d, this.b0.x5.width, c - d);
        }
        oo() {
            let a = super.oo();
            a.b.c = (b) => {
                if (this.a3 == null || this.a3.visibility == 0) {
                    this.a0.bj = b;
                    if (this.a3 != null && (this.a3.location == 7 || this.a3.location == 6)) {
                        this.b0.o1();
                    }
                }
            };
            a.k = (b, c, d) => this.j9(c, d, b.aa, b.b, false);
            a.l = (b, c, d, e) => this.ka(c, d, e, b.aa);
            a.m = (b, c) => {
                let d = b.z;
                let e = new ScalerParams(0, b.ab, b.aa, this.dg, d);
                return this.ft(c, e);
            };
            a.q = (b, c) => true;
            a.j = (b) => this.lg(b.u, b.n, b.aa, b.a, true);
            a.e = (b) => {
                b.n = this.a3 != null && (this.a3.location == 7 || this.a3.location == 3) ? b.aa.right : b.aa.left;
                let c = b.z;
                let d = new ScalerParams(0, b.ab, b.aa, this.dg, c);
                if (this.am != null && this.am.b0 != null) {
                    let e = b.n;
                    let f = b.r;
                    let g = this.k9(e, f, b.ab, b.aa, b.z, b.aa.left, b.aa.right);
                    e = g.p0;
                    f = g.p1;
                    b.n = e;
                    b.r = f;
                }
            };
            a.p = (b, c, d) => {
                let e = Math.round(c);
                return e >= Math.floor(b.aa.top) && e <= Math.ceil(b.aa.bottom);
            };
            return a;
        }
        or(a, b, c, d) {
            let e = d;
            let f = super.or(a, b, c, d);
            let g = new ScalerParams(0, b, a, this.df, c);
            let h = NaN;
            let i = NaN;
            if (!this.df && b.top == 0) {
                i = this.pq;
            }
            else if (this.df && b.bottom == 1) {
                h = this.pq;
            }
            if (isNaN_(h)) {
                h = this.fw(e.bottom, g);
            }
            if (isNaN_(i)) {
                i = this.fw(e.top, g);
            }
            let j = Math.min(h, i);
            let k = Math.max(h, i);
            this.pu = j;
            this.pt = k;
            let l = ((() => {
                let $ret = new RangeInfo();
                $ret.d = j;
                $ret.c = k;
                $ret.b = e.height;
                return $ret;
            })());
            f.k.add(l);
            return f;
        }
        k4(a) {
            super.k4(a);
            let b = this.b0 != null ? this.b0.xm : Rect.empty;
            let c = this.n1;
            let d = this.nw();
            let e = this.nv();
            let f = this.oq.c(a, c, b, d, e);
            if (f != null) {
                this.pp = f.f.m;
                this.ps = f.f.l;
            }
        }
        li(a, b) {
            super.li(a, b);
            if (b.height != a.height) {
                this.d2();
            }
        }
        get_bk() {
            return 1;
        }
        get bk() {
            return this.get_bk();
        }
        ot() {
            if (this.pb) {
                return new VerticalLogarithmicScaler();
            }
            switch (this.r4) {
                case 0: return new FastVerticalLinearScaler();
                case 1: return new VerticalLogarithmicScaler();
            }
            return null;
        }
        j$d(a, b) {
            return this.fw.apply(this, arguments);
        }
        j$c(a, b) {
            return this.ft.apply(this, arguments);
        }
        j$e(a, b, c, d, e) {
            this.j5.apply(this, arguments);
        }
        j$f(a, b, c, d) {
            this.j6.apply(this, arguments);
        }
        j$g(a, b, c, d) {
            this.j7.apply(this, arguments);
        }
        get j$b() {
            return this.df;
        }
        j$a() {
            return this.ag.apply(this, arguments);
        }
    }
    NumericYAxis.$t = markType(NumericYAxis, 'NumericYAxis', StraightNumericAxisBase.$, [IScaler_$type]);
    return NumericYAxis;
})();
/**
 * @hidden
 */
export let NumericYAxisView = /*@__PURE__*/ (() => {
    class NumericYAxisView extends StraightNumericAxisBaseView {
        constructor(a) {
            super(a);
            this.bo = null;
            this.bo = a;
        }
        al() {
            super.al();
            this.a.ni = AxisDefaults.axis_MajorBrush;
        }
    }
    NumericYAxisView.$t = markType(NumericYAxisView, 'NumericYAxisView', StraightNumericAxisBaseView.$);
    return NumericYAxisView;
})();
