/*
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 { StackedColumnBucketCalculator } from "./StackedColumnBucketCalculator";
import { StackedSeriesBase } from "./StackedSeriesBase";
import { ColumnFragment } from "./ColumnFragment";
import { ScalerParams } from "./ScalerParams";
import { typeCast, markType } from "igniteui-angular-core";
import { isNaN_ } from "igniteui-angular-core";
/**
 * @hidden
 */
export let Stacked100ColumnBucketCalculator = /*@__PURE__*/ (() => {
    class Stacked100ColumnBucketCalculator extends StackedColumnBucketCalculator {
        constructor(a) {
            super(a);
        }
        getBucket(a) {
            return super.getBucket(a);
        }
        getBucket1(a, b, c, d, e, f) {
            let g = typeCast(StackedSeriesBase.$, this.c.ct);
            let h = [NaN, NaN, NaN];
            let i = typeCast(ColumnFragment.$, a);
            if (i == null || i.logicalSeriesLink == null) {
                return h;
            }
            let j = g.getEffectiveViewport1(this.c);
            let k = a.valueColumn.item(c);
            let l = 0;
            let m = NaN;
            let n = NaN;
            let o = Number.NEGATIVE_INFINITY;
            let p = Number.POSITIVE_INFINITY;
            let q = 0;
            let r = Math.min(g.rk != null ? g.rk.length : 0, g.rj != null ? g.rj.length : 0);
            let s = c * this.d;
            let t = Math.min(s + this.d - 1, r - 1);
            for (let u = s; u <= t; ++u) {
                k = a.valueColumn.item(u);
                q = Math.abs(g.rk[u]) + g.rj[u];
                if (k < l) {
                    p = Math.min(p, (i.logicalSeriesLink.ak._inner[u] + k) / q * 100);
                    o = Math.max(o, i.logicalSeriesLink.ak._inner[u] / q * 100);
                }
                else {
                    p = Math.min(p, i.logicalSeriesLink.aj._inner[u] / q * 100);
                    o = Math.max(o, (i.logicalSeriesLink.aj._inner[u] + k) / q * 100);
                }
                if (!isNaN_(m)) {
                    if (!isNaN_(p)) {
                        m = Math.min(m, p);
                        n = Math.max(n, p);
                    }
                    if (!isNaN_(o)) {
                        m = Math.min(m, o);
                        n = Math.max(n, o);
                    }
                }
                else {
                    m = p;
                    n = o;
                }
            }
            let v = new ScalerParams(0, d, e, i.fragmentYAxis.ca, j);
            h = [f.f._inner[b - this.e][0], i.fragmentYAxis.dz(n, v), i.fragmentYAxis.dz(m, v)];
            return h;
        }
    }
    Stacked100ColumnBucketCalculator.$t = markType(Stacked100ColumnBucketCalculator, 'Stacked100ColumnBucketCalculator', StackedColumnBucketCalculator.$);
    return Stacked100ColumnBucketCalculator;
})();
//# sourceMappingURL=Stacked100ColumnBucketCalculator.js.map
