/*
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 { __extends } from "tslib";
import { HorizontalAnchoredCategorySeries } from "./HorizontalAnchoredCategorySeries";
import { CategoryLineRasterizer } from "./CategoryLineRasterizer";
import { typeCast, Array_$type, runOn, markType } from "igniteui-react-core";
import { ISortingAxis_$type } from "./ISortingAxis";
import { List$1 } from "igniteui-react-core";
import { Path } from "igniteui-react-core";
import { ScalerParams } from "./ScalerParams";
import { intDivide, isNaN_ } from "igniteui-react-core";
import { AnchoredCategorySeriesView } from "./AnchoredCategorySeriesView";
import { Defaults } from "./Defaults";
/**
 * @hidden
 */
var StepAreaSeries = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(StepAreaSeries, _super);
    function StepAreaSeries() {
        var _this = _super.call(this) || this;
        _this.ze = null;
        _this.ze = new CategoryLineRasterizer();
        _this.ab = StepAreaSeries.$;
        return _this;
    }
    StepAreaSeries.prototype.cg = function () {
        return new StepAreaSeriesView(this);
    };
    StepAreaSeries.prototype.o0 = function (a) {
        _super.prototype.o0.call(this, a);
        this.zf = a;
    };
    StepAreaSeries.prototype.get_d9 = function () {
        return true;
    };
    StepAreaSeries.prototype.get_d8 = function () {
        return true;
    };
    StepAreaSeries.prototype.get_fe = function () {
        return true;
    };
    StepAreaSeries.prototype.get_ey = function () {
        return true;
    };
    StepAreaSeries.prototype.cm = function () {
        if (this.cn == 0) {
            return 2;
        }
        return _super.prototype.cm.call(this);
    };
    StepAreaSeries.prototype.preferredCategoryMode = function (a) {
        return typeCast(ISortingAxis_$type, a) !== null ? 0 : 1;
    };
    StepAreaSeries.prototype.nj = function (a, b) {
        _super.prototype.nj.call(this, a, b);
        var c = b;
        c.de();
    };
    StepAreaSeries.prototype.zg = function (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);
    };
    StepAreaSeries.prototype.vw = function () {
        return 1;
    };
    StepAreaSeries.prototype.hz = function (a, b, c, d, e, f, g, h) {
        var i = NaN;
        if (c >= 0 && c < b.count) {
            i = b.item(c);
        }
        var 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;
    };
    StepAreaSeries.prototype.bx = function () {
        if (this.by == 0) {
            return 2;
        }
        else {
            return _super.prototype.bx.call(this);
        }
    };
    StepAreaSeries.prototype.w5 = function (a, b) {
        var _this = this;
        _super.prototype.w5.call(this, a, b);
        var c = b.by;
        var d = b.bx;
        var e = this.getEffectiveViewport1(b);
        var f = typeCast(ISortingAxis_$type, this.yv) != null;
        var g = this.yv != null ? 0.5 * this.yv.getCategorySize(c, d, e) : 0;
        if (this.yv != null && this.yv.ch) {
            g = -g;
        }
        var h = a.f.count * 2;
        var i = new List$1(Array_$type, 2, h);
        this.vu.a2(this, this.we(), runOn(this, this.vf), this.wn(b), this.wo(b));
        var j = false;
        var k = this.vu.b;
        if (k != null) {
            j = true;
        }
        for (var l = 0; l < h; l++) {
            var m = new Array(4);
            m[0] = this.zg(l, false, a, g, f);
            m[1] = a.f._inner[(intDivide(l, 2))][1];
            m[2] = this.zg(l, true, a, g, f);
            m[3] = a.f._inner[(intDivide(l, 2))][2];
            i.add(m);
        }
        var n = this.vv.cu.d;
        if (j) {
            var o = new ScalerParams(0, b.by, b.bx, this.yv.ch, e);
            this.w1(i, -1, this.valueColumn.count, this.yv, o, b.q);
        }
        var p = typeCast(StepAreaSeriesView.$, b);
        var q = p.ds;
        var r = p.dt;
        var s = p.dq;
        var t = p.dr;
        this.vu.ad(q, true, false, true, true);
        this.vu.ad(r, true, false, true, true);
        this.vu.ad(s, false, true, false, false);
        this.vu.ad(t, false, true, false, false);
        if (b.cy(a)) {
            p.dg(h, i, false, n, this.hj, function (u, v, w, x, y) { return _this.yb(u, 2 * a.f.count, b); }, 1, this.xe(i, i.count - 1, b.bx, b.by, true));
            b.c1(a);
        }
        var u = this.fetchYAxis();
        p.dq._opacity = this.vu.j * this.hf;
        p.dr._opacity = 0.5 * this.vu.j * this.hf;
    };
    Object.defineProperty(StepAreaSeries.prototype, "useHighMarkerFidelity", {
        get: function () {
            return this.wi;
        },
        enumerable: false,
        configurable: true
    });
    StepAreaSeries.$t = markType(StepAreaSeries, 'StepAreaSeries', HorizontalAnchoredCategorySeries.$);
    return StepAreaSeries;
}(HorizontalAnchoredCategorySeries));
export { StepAreaSeries };
/**
 * @hidden
 */
var StepAreaSeriesView = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(StepAreaSeriesView, _super);
    function StepAreaSeriesView(a) {
        var _this = _super.call(this, a) || this;
        _this.dd = null;
        _this.dl = new Path();
        _this.dn = new Path();
        _this.dm = new Path();
        _this.dp = new Path();
        _this.dh = new Path();
        _this.dj = new Path();
        _this.di = new Path();
        _this.dk = new Path();
        _this.dd = a;
        return _this;
    }
    StepAreaSeriesView.prototype.au = function () {
        _super.prototype.au.call(this);
        if (!this.q) {
            this.dd.ua = Defaults.c;
        }
    };
    Object.defineProperty(StepAreaSeriesView.prototype, "dq", {
        get: function () {
            return this.dl;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(StepAreaSeriesView.prototype, "ds", {
        get: function () {
            return this.dn;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(StepAreaSeriesView.prototype, "dr", {
        get: function () {
            return this.dm;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(StepAreaSeriesView.prototype, "dt", {
        get: function () {
            return this.dp;
        },
        enumerable: false,
        configurable: true
    });
    StepAreaSeriesView.prototype.de = function () {
        this.dl.an = null;
        this.dm.an = null;
        this.dn.an = null;
        this.dp.an = null;
        this.as();
    };
    StepAreaSeriesView.prototype.df = function (a, b, c, d, e, f, g) {
        this.df(a, b, c, d, e, f, g);
    };
    StepAreaSeriesView.prototype.dg = function (a, b, c, d, e, f, g, h) {
        this.dd.ze.a = typeCast(ISortingAxis_$type, this.cw.fetchXAxis()) !== null ? true : false;
        this.dd.ze.j(this.dl, this.dn, this.dm, this.dp, a, b, c, d, e, f, g, h);
        this.as();
    };
    StepAreaSeriesView.prototype.be = function () {
        _super.prototype.be.call(this);
        this.dh.an = this.dl.an;
        this.dj.an = this.dn.an;
        this.di.an = this.dm.an;
        this.dk.an = this.dp.an;
        var a = this.br();
        this.dh._fill = a;
        this.dh._opacity = 1;
        this.di._fill = a;
        this.di._opacity = 1;
        this.dj._stroke = a;
        this.dj.ad = this.e.hk + 3;
        this.dk._stroke = a;
        this.dk.ad = this.e.hk + 3;
    };
    StepAreaSeriesView.prototype.a8 = function (a, b) {
        _super.prototype.a8.call(this, a, b);
        if (b) {
            a.t(this.dh);
            a.t(this.di);
            a.t(this.dj);
            a.t(this.dk);
        }
        else {
            a.t(this.dl);
            a.t(this.dm);
            a.t(this.dn);
            a.t(this.dp);
        }
    };
    StepAreaSeriesView.prototype.an = function (a) {
        _super.prototype.an.call(this, a);
        this.e.a9.exportPathData(a, this.dn, "lowerShape", ["Lower"]);
        this.e.a9.exportPathData(a, this.dp, "upperShape", ["Upper", "Main"]);
        this.e.a9.exportPathData(a, this.dm, "translucentShape", ["Translucent"]);
        this.e.a9.exportPathData(a, this.dl, "fillShape", ["Fill"]);
    };
    StepAreaSeriesView.$t = markType(StepAreaSeriesView, 'StepAreaSeriesView', AnchoredCategorySeriesView.$);
    return StepAreaSeriesView;
}(AnchoredCategorySeriesView));
export { StepAreaSeriesView };
