/*
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 { FinancialSeries } from "./FinancialSeries";
import { DependencyProperty } from "igniteui-angular-core";
import { ISortingAxis_$type } from "./ISortingAxis";
import { typeCast, markType, markDep } from "igniteui-angular-core";
import { Rect } from "igniteui-angular-core";
import { ScalerParams } from "./ScalerParams";
import { AxisRange } from "./AxisRange";
import { PropertyMetadata } from "igniteui-angular-core";
import { isNaN_ } from "igniteui-angular-core";
/**
 * @hidden
 */
export let FinancialOverlay = /*@__PURE__*/ (() => {
    class FinancialOverlay extends FinancialSeries {
        constructor() {
            super();
            this.tl = false;
            this.tl = false;
        }
        get_dr() {
            return true;
        }
        k0(a, b, c, d) {
            super.k0(a, b, c, d);
            if (this.qb != null && typeCast(ISortingAxis_$type, this.qb) !== null) {
                this.qb.i$i();
            }
            this.qs.bx.e(this.ft);
            this.tm();
            if (this.qx != null) {
                this.qx.c0();
            }
            this.mh(true);
        }
        get_e8() {
            return true;
        }
        l3(a, b, c, d) {
            switch (b) {
                case "FastItemsSource":
                    this.tl = false;
                    break;
                case FinancialOverlay.$$p[0]:
                    this.tl = false;
                    this.mh(false);
                    this.lo();
                    break;
                case "XAxis":
                    this.tl = false;
                    break;
            }
            super.l3(a, b, c, d);
        }
        bp() {
            if (this.bq == 0) {
                return 1;
            }
            else {
                return super.bp();
            }
        }
        ev(a, b) {
            if (this.eu(a, b)) {
                return true;
            }
            return false;
        }
        ac() {
            super.ac();
            this.mh(false);
        }
        en(a) {
            let b = this.ck != null ? this.ck.indexOf(a) : -1;
            let c = this.b0.bv;
            c = c.copy();
            let d = this.b0.bu;
            let e = new Rect(0, 0, 0, 1, 1);
            let f = this.ps(this.b0);
            let g = new ScalerParams(0, e, e, this.qb.cg, f);
            let h = new ScalerParams(0, e, e, this.qx.cg, f);
            h.b = this.gc();
            if (b >= 0 && Rect.l_op_Inequality(c, null) && Rect.l_op_Inequality(d, null)) {
                if (this.qb != null) {
                    let i = this.qb.ei(b, g);
                    if (i < c.left + 0.1 * c.width) {
                        i = i + 0.4 * c.width;
                    }
                    if (i > c.right - 0.1 * c.width) {
                        i = i - 0.4 * c.width;
                    }
                    c.x = i - 0.5 * c.width;
                }
                if (this.qx != null && this.q6 != null && this.q5 != null && b < this.q6.count && b < this.q5.count) {
                    let j = this.qx.ei(this.q6.item(b), h);
                    let k = this.qx.ei(this.q5.item(b), h);
                    if (!isNaN_(j) && !isNaN_(k)) {
                        let l = Math.abs(j - k);
                        if (c.height < l) {
                            c.height = l;
                            c.y = Math.min(j, k);
                        }
                        else {
                            if (j < c.top + 0.1 * c.height) {
                                j = j + 0.4 * c.height;
                            }
                            if (j > c.bottom - 0.1 * c.height) {
                                j = j - 0.4 * c.height;
                            }
                            c.y = j - 0.5 * c.height;
                        }
                    }
                }
                this.b8.au(this.cd, c, true);
            }
            return b >= 0;
        }
        ap(a) {
            if (a != null && a == this.qx && this.q6 != null && this.q5 != null) {
                return new AxisRange(this.q6.minimum, this.q5.maximum);
            }
            return null;
        }
    }
    FinancialOverlay.$t = markType(FinancialOverlay, 'FinancialOverlay', FinancialSeries.$);
    FinancialOverlay.$$p = markDep(DependencyProperty, PropertyMetadata, FinancialOverlay, 'raisePropertyChanged', ['IgnoreFirst:tn:tp', [1, 0]]);
    return FinancialOverlay;
})();
