/*
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 { HorizontalAnchoredCategorySeries } from "./HorizontalAnchoredCategorySeries";
import { IIsCategoryBased_$type } from "./IIsCategoryBased";
import { CategoryLineRasterizer } from "./CategoryLineRasterizer";
import { typeCast, Array_$type, runOn, markType } from "igniteui-angular-core";
import { ISortingAxis_$type } from "./ISortingAxis";
import { List$1 } from "igniteui-angular-core";
import { Path } from "igniteui-angular-core";
import { ScalerParams } from "./ScalerParams";
import { intDivide, isNaN_ } from "igniteui-angular-core";
import { AnchoredCategorySeriesView } from "./AnchoredCategorySeriesView";
/**
 * @hidden
 */
export class StepAreaSeries extends HorizontalAnchoredCategorySeries {
    constructor() {
        super();
        this.qh = null;
        this.qh = new CategoryLineRasterizer();
        this.ab = StepAreaSeries.$;
    }
    bf() {
        return new StepAreaSeriesView(this);
    }
    getHostReferenceValue() {
        return this.eh();
    }
    iu(a) {
        super.iu(a);
        this.qi = a;
    }
    get_ck() {
        return true;
    }
    preferredCategoryMode(a) {
        return typeCast(ISortingAxis_$type, a) !== null ? 0 : 1;
    }
    hv(a, b) {
        super.hv(a, b);
        let c = b;
        c.c7();
    }
    qj(a, b, c, d, e) {
        if (b) {
            if (e) {
                if ((a & 1) == 0 || ((intDivide(a, 2)) + 1) >= c.f.count) {
                    return c.f._inner[(intDivide(a, 2))][0];
                }
                return c.f._inner[(intDivide(a, 2)) + 1][0];
            }
            return c.f._inner[(intDivide(a, 2))][0] + ((a & 1) == 1 ? -d : d);
        }
        if (e) {
            if ((a & 1) == 0 || ((intDivide(a, 2)) + 1) >= c.f.count) {
                return c.f._inner[(intDivide(a, 2))][0];
            }
            return c.f._inner[(intDivide(a, 2)) + 1][0];
        }
        return c.f._inner[(intDivide(a, 2))][0] + ((a & 1) == 0 ? -d : d);
    }
    ng() {
        return 1;
    }
    ef(a, b, c, d, e, f, g, h) {
        let i = NaN;
        if (c >= 0 && c < b.count) {
            i = b.item(c);
        }
        let j = NaN;
        if (d >= 0 && d < b.count) {
            j = b.item(d);
        }
        if (f == 0) {
            return j;
        }
        if (e == b.count - 1) {
            return i;
        }
        if (isNaN_(j) && g != 0 && a <= 0.5 && !h) {
            return i;
        }
        if (isNaN_(i) && g != 0 && a >= 0.5 && !h) {
            return j;
        }
        if (a > 0.5) {
            return j;
        }
        return i;
    }
    bd() {
        if (this.be == 0) {
            return 2;
        }
        else {
            return super.bd();
        }
    }
    oo(a, b) {
        super.oo(a, b);
        let c = b.bs;
        let d = b.br;
        let e = this.getEffectiveViewport1(b);
        let f = typeCast(ISortingAxis_$type, this.py) != null;
        let g = this.py != null ? 0.5 * this.py.getCategorySize(c, d, e) : 0;
        if (this.py != null && this.py.b8) {
            g = -g;
        }
        let h = a.f.count * 2;
        let i = new List$1(Array_$type, 2, h);
        this.ne.x(this, this.nz(), this.py, runOn(this, this.m0), this.n7(b), this.n8(b));
        let j = false;
        let k = this.ne.c;
        if (k != null) {
            j = true;
        }
        for (let l = 0; l < h; l++) {
            let m = new Array(4);
            m[0] = this.qj(l, false, a, g, f);
            m[1] = a.f._inner[(intDivide(l, 2))][1];
            m[2] = this.qj(l, true, a, g, f);
            m[3] = a.f._inner[(intDivide(l, 2))][2];
            i.add(m);
        }
        let n = this.nf.cn.d;
        if (j) {
            let o = new ScalerParams(0, b.bs, b.br, this.py.b8, e);
            this.ok(i, -1, this.valueColumn.count, this.py, o, b.n);
        }
        let p = typeCast(StepAreaSeriesView.$, b);
        let q = p.dj;
        let r = p.dl;
        let s = p.df;
        let t = p.dh;
        this.ne.ae(q, true, false, true, true);
        this.ne.ae(r, true, false, true, true);
        this.ne.ae(s, false, true, false, false);
        this.ne.ae(t, false, true, false, false);
        if (b.cr(a)) {
            p.c9(h, i, false, n, this.eu, (u, v, w, x, y) => this.pi(u, 2 * a.f.count, b), 1, this.ox(i, i.count - 1, b.br, b.bs, true));
            b.cu(a);
        }
        let u = this.fetchYAxis();
        p.df._opacity = this.d6;
        p.dh._opacity = 0.5 * this.d6;
    }
    get currentCategoryMode() {
        return this.preferredCategoryMode(this.py);
    }
    get useHighMarkerFidelity() {
        return this.n2;
    }
}
StepAreaSeries.$t = markType(StepAreaSeries, 'StepAreaSeries', HorizontalAnchoredCategorySeries.$, [IIsCategoryBased_$type]);
/**
 * @hidden
 */
export class StepAreaSeriesView extends AnchoredCategorySeriesView {
    constructor(a) {
        super(a);
        this.c6 = null;
        this.de = new Path();
        this.di = new Path();
        this.dg = new Path();
        this.dk = new Path();
        this.da = new Path();
        this.dc = new Path();
        this.db = new Path();
        this.dd = new Path();
        this.c6 = a;
    }
    ap() {
        super.ap();
        if (!this.n) {
            this.e.bj = 1;
        }
    }
    get df() {
        return this.de;
    }
    get dj() {
        return this.di;
    }
    get dh() {
        return this.dg;
    }
    get dl() {
        return this.dk;
    }
    c7() {
        this.de.ak = null;
        this.dg.ak = null;
        this.di.ak = null;
        this.dk.ak = null;
        this.an();
    }
    c8(a, b, c, d, e, f, g) {
        this.c8(a, b, c, d, e, f, g);
    }
    c9(a, b, c, d, e, f, g, h) {
        this.c6.qh.a = typeCast(ISortingAxis_$type, this.cp.fetchXAxis()) !== null ? true : false;
        this.c6.qh.j(this.de, this.di, this.dg, this.dk, a, b, c, d, e, f, g, h);
        this.an();
    }
    a9() {
        super.a9();
        this.da.ak = this.de.ak;
        this.dc.ak = this.di.ak;
        this.db.ak = this.dg.ak;
        this.dd.ak = this.dk.ak;
        let a = this.bl();
        this.da._fill = a;
        this.da._opacity = 1;
        this.db._fill = a;
        this.db._opacity = 1;
        this.dc._stroke = a;
        this.dc.ac = this.e.ey + 3;
        this.dd._stroke = a;
        this.dd.ac = this.e.ey + 3;
    }
    a3(a, b) {
        super.a3(a, b);
        if (b) {
            a.s(this.da);
            a.s(this.db);
            a.s(this.dc);
            a.s(this.dd);
        }
        else {
            a.s(this.de);
            a.s(this.dg);
            a.s(this.di);
            a.s(this.dk);
        }
    }
    ai(a) {
        super.ai(a);
        this.e.a2.exportPathData(a, this.di, "lowerShape", ["Lower"]);
        this.e.a2.exportPathData(a, this.dk, "upperShape", ["Upper", "Main"]);
        this.e.a2.exportPathData(a, this.dg, "translucentShape", ["Translucent"]);
        this.e.a2.exportPathData(a, this.de, "fillShape", ["Fill"]);
    }
}
StepAreaSeriesView.$t = markType(StepAreaSeriesView, 'StepAreaSeriesView', AnchoredCategorySeriesView.$);
//# sourceMappingURL=StepAreaSeries_combined.js.map