/*
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 { ChartSelection } from "./ChartSelection";
import { intDivide, isNaN_ } from "igniteui-react-core";
import { AnchoredCategorySeriesView } from "./AnchoredCategorySeriesView";
import { Defaults } from "./Defaults";
import { Color } from "igniteui-react-core";
/**
 * @hidden
 */
var StepLineSeries = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(StepLineSeries, _super);
    function StepLineSeries() {
        var _this = _super.call(this) || this;
        _this.acu = null;
        _this.acu = new CategoryLineRasterizer();
        _this.ab = StepLineSeries.$;
        return _this;
    }
    StepLineSeries.prototype.bj = function () {
        return new StepLineSeries();
    };
    StepLineSeries.prototype.get_fk = function () {
        return true;
    };
    StepLineSeries.prototype.get_f1 = function () {
        return true;
    };
    StepLineSeries.prototype.get_fl = function () {
        return true;
    };
    StepLineSeries.prototype.cs = function () {
        return new StepLineSeriesView(this);
    };
    StepLineSeries.prototype.zm = function () {
        return true;
    };
    StepLineSeries.prototype.qz = function (a) {
        _super.prototype.qz.call(this, a);
        this.acv = a;
    };
    StepLineSeries.prototype.ac = function () {
        _super.prototype.ac.call(this);
    };
    StepLineSeries.prototype.preferredCategoryMode = function (a) {
        return typeCast(ISortingAxis_$type, a) !== null ? 0 : 1;
    };
    StepLineSeries.prototype.get_ev = function () {
        return true;
    };
    StepLineSeries.prototype.o5 = function (a, b) {
        _super.prototype.o5.call(this, a, b);
        var c = b;
        c.dg();
    };
    StepLineSeries.prototype.b2 = function () {
        if (this.b3 == 0) {
            return 2;
        }
        else {
            return _super.prototype.b2.call(this);
        }
    };
    StepLineSeries.prototype.iv = 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;
    };
    StepLineSeries.prototype.acw = function (a, b, c, d, e, f) {
        var g;
        if (b) {
            if (f) {
                g = (a & 1) == 0;
                if (g || (intDivide(a, 2)) + 1 < 0) {
                    return c.f._inner[(intDivide(a, 2))][0];
                }
                if (c.f.count == (intDivide(a, 2)) + 1) {
                    return c.f._inner[(intDivide(a, 2))][0];
                }
                return c.f._inner[(intDivide(a, 2)) + 1][0];
            }
            g = (a & 1) == 0;
            return c.f._inner[(intDivide(a, 2))][0] + (g ? d : -d);
        }
        if (f) {
            g = (a & 1) == 0;
            if (g || ((intDivide(a, 2)) + 1) >= c.f.count) {
                return c.f._inner[(intDivide(a, 2))][0];
            }
            if (c.f.count == (intDivide(a, 2)) + 1) {
                return c.f._inner[(intDivide(a, 2))][0];
            }
            return c.f._inner[(intDivide(a, 2)) + 1][0];
        }
        g = (a & 1) == 0;
        return c.f._inner[(intDivide(a, 2))][0] + (g ? -d : d);
    };
    StepLineSeries.prototype.aai = function (a, b) {
        _super.prototype.aai.call(this, a, b);
        var c = b.by;
        var d = b.bx;
        var e = this.getEffectiveViewport1(b);
        var f = typeCast(ISortingAxis_$type, this.acb) != null;
        var g = this.acb.ch;
        var h = 0;
        if (this.acb != null) {
            h = 0.5 * this.acb.getCategorySize(c, d, e);
        }
        var i = a.f;
        var j = 2 * i.count;
        var k = new List$1(Array_$type, 2, j);
        if (!this.acb.ch) {
            for (var l = 0; l < j; l++) {
                var m = new Array(4);
                m[0] = this.acw(l, false, a, h, g, f);
                m[1] = a.f._inner[(intDivide(l, 2))][1];
                m[2] = this.acw(l, true, a, h, g, f);
                m[3] = a.f._inner[(intDivide(l, 2))][2];
                k.add(m);
            }
        }
        else {
            for (var n = 0; n < j; n++) {
                var o = new Array(4);
                o[0] = this.acw(n, true, a, h, g, f);
                o[1] = a.f._inner[(intDivide(n, 2))][1];
                o[2] = this.acw(n, true, a, h, g, f);
                o[3] = a.f._inner[(intDivide(n, 2))][2];
                k.add(o);
            }
        }
        var p = typeCast(StepLineSeriesView.$, b);
        var q = p.cw.d;
        this.y0.a2(this, this.zk(), runOn(this, this.yk), this.zt(b), this.zu(b));
        var r = false;
        var s = this.y0.b;
        if (s != null) {
            r = true;
        }
        if (r) {
            var t = new ScalerParams(0, b.by, b.bx, this.acb.ch, e);
            this.aae(i, -1, this.valueColumn.count, this.acb, t, b.q, -1);
        }
        var u = p.dm;
        var v = p.dn;
        var w = p.dl;
        this.y0.ad(u, true, false, true, false);
        this.y0.ad(v, true, false, true, false);
        this.y0.ad(w, false, true, false, false);
        w._opacity = 0.75 * this.y0.j;
        if (b.c0(a)) {
            p.dh(j, k, false, 1, this.aar(k, j - 1, b.bx, b.by), q, this.id);
            b.c3(a);
        }
    };
    StepLineSeries.prototype.p2 = function (a, b, c) {
        this.aaa(a, b, c, this.yr, 0);
    };
    StepLineSeries.prototype.ak = function (a, b) {
        var c = new List$1(ChartSelection.$, 0);
        this.p2(a, c, b);
        return c.toArray();
    };
    Object.defineProperty(StepLineSeries.prototype, "useHighMarkerFidelity", {
        get: function () {
            return this.zo;
        },
        enumerable: false,
        configurable: true
    });
    StepLineSeries.$t = markType(StepLineSeries, 'StepLineSeries', HorizontalAnchoredCategorySeries.$);
    return StepLineSeries;
}(HorizontalAnchoredCategorySeries));
export { StepLineSeries };
/**
 * @hidden
 */
var StepLineSeriesView = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(StepLineSeriesView, _super);
    function StepLineSeriesView(a) {
        var _this = _super.call(this, a) || this;
        _this.df = null;
        _this.dq = new Path();
        _this.dp = new Path();
        _this.dr = new Path();
        _this.dk = new Path();
        _this.dj = new Path();
        _this.di = new Path();
        _this.df = a;
        return _this;
    }
    StepLineSeriesView.prototype.au = function () {
        _super.prototype.au.call(this);
        if (!this.q) {
            this.df.w8 = Defaults.c;
        }
    };
    Object.defineProperty(StepLineSeriesView.prototype, "dm", {
        get: function () {
            return this.dq;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(StepLineSeriesView.prototype, "dn", {
        get: function () {
            return this.dr;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(StepLineSeriesView.prototype, "dl", {
        get: function () {
            return this.dp;
        },
        enumerable: false,
        configurable: true
    });
    StepLineSeriesView.prototype.dg = function () {
        this.dp.an = null;
        this.dq.an = null;
        this.dr.an = null;
        this.as();
    };
    StepLineSeriesView.prototype.dh = function (a, b, c, d, e, f, g) {
        this.df.acu.a = typeCast(ISortingAxis_$type, this.cy.fetchXAxis()) !== null ? true : false;
        this.df.acu.m(this.dq, this.dp, this.dr, a, b, c, d, e, f, g);
        this.as();
    };
    StepLineSeriesView.prototype.be = function () {
        _super.prototype.be.call(this);
        this.dj.an = this.dq.an;
        this.dk.an = this.dr.an;
        this.di.an = this.dp.an;
        var a = this.br();
        this.dj._stroke = a;
        this.dj.ad = this.e.ie + 3;
        this.dk._stroke = a;
        this.dk.ad = this.e.ie + 3;
        this.di._fill = a;
        this.di._opacity = 1;
    };
    StepLineSeriesView.prototype.a8 = function (a, b) {
        _super.prototype.a8.call(this, a, b);
        if (a.d) {
            if (b) {
                a.t(this.di);
                a.t(this.dj);
                a.t(this.dk);
            }
            else {
                a.t(this.dp);
                a.t(this.dq);
                a.t(this.dr);
            }
        }
    };
    StepLineSeriesView.prototype.an = function (a) {
        _super.prototype.an.call(this, a);
        this.e.bc.exportPathData(a, this.dq, "lowerShape", ["Lower", "Main"]);
        this.e.bc.exportPathData(a, this.dr, "upperShape", ["Upper"]);
        this.e.bc.exportPathData(a, this.dp, "translucentShape", ["Translucent"]);
    };
    StepLineSeriesView.prototype.af = function () {
        var a = new Color();
        a.colorString = "rgba(95,95,95,0.5)";
        this.e.vz = a;
        this.e.jm = 3;
        this.e.jn = 1;
        this.e.jo = 4;
        this.e.hc = false;
    };
    StepLineSeriesView.$t = markType(StepLineSeriesView, 'StepLineSeriesView', AnchoredCategorySeriesView.$);
    return StepLineSeriesView;
}(AnchoredCategorySeriesView));
export { StepLineSeriesView };
