/*
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 * as tslib_1 from "tslib";
import { HorizontalAnchoredCategorySeries } from "./HorizontalAnchoredCategorySeries";
import { IIsCategoryBased_$type } from "./IIsCategoryBased";
import { CategoryLineRasterizer } from "./CategoryLineRasterizer";
import { typeCast, Array_$type, runOn, markType } from "igniteui-react-core/ES5/type";
import { ISortingAxis_$type } from "./ISortingAxis";
import { List$1 } from "igniteui-react-core/ES5/List$1";
import { Path } from "igniteui-react-core/ES5/Path";
import { ScalerParams } from "./ScalerParams";
import { intDivide, isNaN_ } from "igniteui-react-core/ES5/number";
import { AnchoredCategorySeriesView } from "./AnchoredCategorySeriesView";
var StepAreaSeries = /** @class */ (function (_super) {
    tslib_1.__extends(StepAreaSeries, _super);
    function StepAreaSeries() {
        var _this = _super.call(this) || this;
        _this.p6 = null;
        _this.p6 = new CategoryLineRasterizer();
        _this.ab = StepAreaSeries.$;
        return _this;
    }
    StepAreaSeries.prototype.bf = function () {
        return new StepAreaSeriesView(this);
    };
    StepAreaSeries.prototype.ii = function (a) {
        _super.prototype.ii.call(this, a);
        this.p7 = a;
    };
    StepAreaSeries.prototype.get_cj = function () {
        return true;
    };
    Object.defineProperty(StepAreaSeries.prototype, "cj", {
        get: function () {
            return this.get_cj();
        },
        enumerable: true,
        configurable: true
    });
    StepAreaSeries.prototype.preferredCategoryMode = function (a) {
        return typeCast(ISortingAxis_$type, a) !== null ? 0 : 1;
    };
    StepAreaSeries.prototype.hl = function (a, b) {
        _super.prototype.hl.call(this, a, b);
        var c = b;
        c.c5();
    };
    StepAreaSeries.prototype.p8 = 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.m4 = function () {
        return 1;
    };
    StepAreaSeries.prototype.ea = 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.bd = function () {
        if (this.be == 0) {
            return 2;
        }
        else {
            return _super.prototype.bd.call(this);
        }
    };
    StepAreaSeries.prototype.ob = function (a, b) {
        var _this = this;
        _super.prototype.ob.call(this, a, b);
        var c = b.bq;
        var d = b.bp;
        var e = this.getEffectiveViewport1(b);
        var f = typeCast(ISortingAxis_$type, this.pn) != null;
        var g = this.pn != null ? 0.5 * this.pn.getCategorySize(c, d, e) : 0;
        if (this.pn != null && this.pn.b8) {
            g = -g;
        }
        var h = a.f.count * 2;
        var i = new List$1(Array_$type, 2, h);
        this.m2.x(this, this.nn(), this.pn, runOn(this, this.mo), this.nv(b), this.nw(b));
        var j = false;
        var k = this.m2.c;
        if (k != null) {
            j = true;
        }
        for (var l = 0; l < h; l++) {
            var m = new Array(4);
            m[0] = this.p8(l, false, a, g, f);
            m[1] = a.f._inner[(intDivide(l, 2))][1];
            m[2] = this.p8(l, true, a, g, f);
            m[3] = a.f._inner[(intDivide(l, 2))][2];
            i.add(m);
        }
        var n = this.m3.cl.d;
        if (j) {
            var o = new ScalerParams(0, b.bq, b.bp, this.pn.b8, e);
            this.n7(i, -1, this.valueColumn.count, this.pn, o, b.n);
        }
        var p = typeCast(StepAreaSeriesView.$, b);
        var q = p.dh;
        var r = p.dj;
        var s = p.dd;
        var t = p.df;
        this.m2.ae(q, true, false, true, true);
        this.m2.ae(r, true, false, true, true);
        this.m2.ae(s, false, true, false, false);
        this.m2.ae(t, false, true, false, false);
        if (b.cp(a)) {
            p.c7(h, i, false, n, this.eo, function (u, v, w, x, y) { return _this.o7(u, 2 * a.f.count, b); }, 1, this.om(i, i.count - 1, b.bp, b.bq, true));
            b.cs(a);
        }
        var u = this.fetchYAxis();
        p.dd._opacity = this.d1;
        p.df._opacity = 0.5 * this.d1;
    };
    Object.defineProperty(StepAreaSeries.prototype, "currentCategoryMode", {
        get: function () {
            return this.preferredCategoryMode(this.pn);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(StepAreaSeries.prototype, "useHighMarkerFidelity", {
        get: function () {
            return this.nq;
        },
        enumerable: true,
        configurable: true
    });
    StepAreaSeries.$t = markType(StepAreaSeries, 'StepAreaSeries', HorizontalAnchoredCategorySeries.$, [IIsCategoryBased_$type]);
    return StepAreaSeries;
}(HorizontalAnchoredCategorySeries));
export { StepAreaSeries };
var StepAreaSeriesView = /** @class */ (function (_super) {
    tslib_1.__extends(StepAreaSeriesView, _super);
    function StepAreaSeriesView(a) {
        var _this = _super.call(this, a) || this;
        _this.c4 = null;
        _this.dc = new Path();
        _this.dg = new Path();
        _this.de = new Path();
        _this.di = new Path();
        _this.c8 = new Path();
        _this.da = new Path();
        _this.c9 = new Path();
        _this.db = new Path();
        _this.c4 = a;
        return _this;
    }
    StepAreaSeriesView.prototype.ap = function () {
        _super.prototype.ap.call(this);
        if (!this.n) {
            this.e.bj = 1;
        }
    };
    Object.defineProperty(StepAreaSeriesView.prototype, "dd", {
        get: function () {
            return this.dc;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(StepAreaSeriesView.prototype, "dh", {
        get: function () {
            return this.dg;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(StepAreaSeriesView.prototype, "df", {
        get: function () {
            return this.de;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(StepAreaSeriesView.prototype, "dj", {
        get: function () {
            return this.di;
        },
        enumerable: true,
        configurable: true
    });
    StepAreaSeriesView.prototype.c5 = function () {
        this.dc.aj = null;
        this.de.aj = null;
        this.dg.aj = null;
        this.di.aj = null;
        this.an();
    };
    StepAreaSeriesView.prototype.c6 = function (a, b, c, d, e, f, g) {
        this.c6(a, b, c, d, e, f, g);
    };
    StepAreaSeriesView.prototype.c7 = function (a, b, c, d, e, f, g, h) {
        this.c4.p6.a = typeCast(ISortingAxis_$type, this.cn.fetchXAxis()) !== null ? true : false;
        this.c4.p6.j(this.dc, this.dg, this.de, this.di, a, b, c, d, e, f, g, h);
        this.an();
    };
    StepAreaSeriesView.prototype.a9 = function () {
        _super.prototype.a9.call(this);
        this.c8.aj = this.dc.aj;
        this.da.aj = this.dg.aj;
        this.c9.aj = this.de.aj;
        this.db.aj = this.di.aj;
        var a = this.bk();
        this.c8._fill = a;
        this.c8._opacity = 1;
        this.c9._fill = a;
        this.c9._opacity = 1;
        this.da._stroke = a;
        this.da.ac = this.e.es + 3;
        this.db._stroke = a;
        this.db.ac = this.e.es + 3;
    };
    StepAreaSeriesView.prototype.a3 = function (a, b) {
        _super.prototype.a3.call(this, a, b);
        if (b) {
            a.s(this.c8);
            a.s(this.c9);
            a.s(this.da);
            a.s(this.db);
        }
        else {
            a.s(this.dc);
            a.s(this.de);
            a.s(this.dg);
            a.s(this.di);
        }
    };
    StepAreaSeriesView.prototype.ai = function (a) {
        _super.prototype.ai.call(this, a);
        this.e.a2.exportPathData(a, this.dg, "lowerShape", ["Lower"]);
        this.e.a2.exportPathData(a, this.di, "upperShape", ["Upper", "Main"]);
        this.e.a2.exportPathData(a, this.de, "translucentShape", ["Translucent"]);
        this.e.a2.exportPathData(a, this.dc, "fillShape", ["Fill"]);
    };
    StepAreaSeriesView.$t = markType(StepAreaSeriesView, 'StepAreaSeriesView', AnchoredCategorySeriesView.$);
    return StepAreaSeriesView;
}(AnchoredCategorySeriesView));
export { StepAreaSeriesView };
