/*
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-react-core";
import { ISortingAxis_$type } from "./ISortingAxis";
import { typeCast, markType, markDep } from "igniteui-react-core";
import { Rect } from "igniteui-react-core";
import { ScalerParams } from "./ScalerParams";
import { AxisRange } from "./AxisRange";
import { PropertyMetadata } from "igniteui-react-core";
import { isNaN_ } from "igniteui-react-core";
/**
 * @hidden
 */
export let FinancialOverlay = /*@__PURE__*/ (() => {
    class FinancialOverlay extends FinancialSeries {
        get_e6() {
            return true;
        }
        constructor() {
            super();
            this.aar = false;
            this.aar = false;
        }
        o8(a, b, c, d) {
            super.o8(a, b, c, d);
            if (this.wx != null && typeCast(ISortingAxis_$type, this.wx) !== null) {
                this.wx.i$i();
            }
            this.xe.b0.e(this.ib);
            this.aas();
            if (this.xg != null) {
                this.xg.c1();
            }
            this.rm(true);
        }
        get_hb() {
            return true;
        }
        q4(a, b, c, d) {
            switch (b) {
                case "FastItemsSource":
                    this.aar = false;
                    break;
                case FinancialOverlay.$$p[0]:
                    this.aar = false;
                    this.rm(false);
                    this.qg();
                    break;
                case "XAxis":
                    this.aar = false;
                    break;
            }
            super.q4(a, b, c, d);
        }
        b0() {
            if (this.b1 == 0) {
                return 1;
            }
            else {
                return super.b0();
            }
        }
        gu(a, b) {
            if (this.gt(a, b)) {
                return true;
            }
            return false;
        }
        ac() {
            super.ac();
            this.rm(false);
        }
        gb(a) {
            let b = this.dl != null ? this.dl.indexOf(a) : -1;
            let c = this.ct.by;
            c = c.copy();
            let d = this.ct.bx;
            let e = new Rect(0, 0, 0, 1, 1);
            let f = this.we(this.ct);
            let g = new ScalerParams(0, e, e, this.wx.ch, f);
            let h = new ScalerParams(0, e, e, this.xg.ch, f);
            h.b = this.iw();
            if (b >= 0 && Rect.l_op_Inequality(c, null) && Rect.l_op_Inequality(d, null)) {
                if (this.wx != null) {
                    let i = this.wx.ek(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.xg != null && this.xs != null && this.xr != null && b < this.xs.count && b < this.xr.count) {
                    let j = this.xg.ek(this.xs.item(b), h);
                    let k = this.xg.ek(this.xr.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.c1.au(this.c9, c, true);
            }
            return b >= 0;
        }
        ax(a) {
            if (a != null && a == this.xg && this.xs != null && this.xr != null) {
                return new AxisRange(this.xs.minimum, this.xr.maximum);
            }
            return null;
        }
    }
    FinancialOverlay.$t = /*@__PURE__*/ markType(FinancialOverlay, 'FinancialOverlay', FinancialSeries.$);
    FinancialOverlay.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, FinancialOverlay, 'raisePropertyChanged', ['IgnoreFirst:aat:aav', [1, 0]]);
    return FinancialOverlay;
})();
