/*
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 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.cp);
        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.ow != null ? g.ow.length : 0, g.ov != null ? g.ov.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.ow[u]) + g.ov[u];
            if (k < l) {
                p = Math.min(p, (i.logicalSeriesLink.ad._inner[u] + k) / q * 100);
                o = Math.max(o, i.logicalSeriesLink.ad._inner[u] / q * 100);
            }
            else {
                p = Math.min(p, i.logicalSeriesLink.ac._inner[u] / q * 100);
                o = Math.max(o, (i.logicalSeriesLink.ac._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.b8, j);
        h = [f.f._inner[b - this.e][0], i.fragmentYAxis.dw(n, v), i.fragmentYAxis.dw(m, v)];
        return h;
    }
}
Stacked100ColumnBucketCalculator.$t = markType(Stacked100ColumnBucketCalculator, 'Stacked100ColumnBucketCalculator', StackedColumnBucketCalculator.$);
//# sourceMappingURL=Stacked100ColumnBucketCalculator.js.map