UNPKG

igniteui-react-charts

Version:

Ignite UI React charting components for building rich data visualizations using TypeScript APIs.

1,820 lines 61 kB
/*
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, __values } from "tslib";
import { Base, typeCast, markType, Array_$type, Number_$type, Point_$type, enumGetBox, runOn, delegateCombine, fromEnum, markDep } from "igniteui-react-core";
import { IBucketizer_$type } from "./IBucketizer";
import { ArgumentNullException } from "igniteui-react-core";
import { Rect } from "igniteui-react-core";
import { CategoryAxisBase } from "./CategoryAxisBase";
import { ISortingAxis_$type } from "./ISortingAxis";
import { ScalerParams } from "./ScalerParams";
import { Series } from "./Series";
import { truncate, intDivide, isNaN_, isInfinity } from "igniteui-react-core";
import { FramePreparer } from "./FramePreparer";
import { IIsCategoryBased_$type } from "./IIsCategoryBased";
import { List$1 } from "igniteui-react-core";
import { ISupportsMarkers_$type } from "./ISupportsMarkers";
import { IProvidesViewport_$type } from "./IProvidesViewport";
import { ISupportsErrorBars_$type } from "./ISupportsErrorBars";
import { CategoryFrame } from "./CategoryFrame";
import { PreparationParams } from "./PreparationParams";
import { IDateTimeAxis_$type } from "./IDateTimeAxis";
import { NumericAxisBase } from "./NumericAxisBase";
import { IHasCategoryTrendline_$type } from "./IHasCategoryTrendline";
import { IHasSingleValueCategory_$type } from "./IHasSingleValueCategory";
import { DefaultCategoryTrendlineHost } from "./DefaultCategoryTrendlineHost";
import { DefaultSingleValueProvider } from "./DefaultSingleValueProvider";
import { SingleValuesHolder } from "./SingleValuesHolder";
import { MarkerSeries } from "./MarkerSeries";
import { IHasCategoryModePreference_$type } from "./IHasCategoryModePreference";
import { ICategorySeriesInteractionManager_$type } from "./ICategorySeriesInteractionManager";
import { DVContainer } from "igniteui-react-core";
import { DependencyProperty } from "igniteui-react-core";
import { CategoryCollisionMode_$type } from "./CategoryCollisionMode";
import { CategoryTransitionInMode_$type } from "./CategoryTransitionInMode";
import { HighlightingInfo } from "igniteui-react-core";
import { CategoryTransitionSourceFramePreparer } from "./CategoryTransitionSourceFramePreparer";
import { SeriesPointOfInterest } from "./SeriesPointOfInterest";
import { Marker } from "./Marker";
import { MarkerSeriesView } from "./MarkerSeriesView";
import { MathUtil } from "igniteui-react-core";
import { CategorySeriesRenderManager } from "./CategorySeriesRenderManager";
import { Pool$1 } from "igniteui-react-core";
import { SeriesLayerPropertyOverlay } from "./SeriesLayerPropertyOverlay";
import { DoubleCollection } from "igniteui-react-core";
import { Clipper } from "igniteui-react-core";
import { ChartSelection } from "./ChartSelection";
import { PropertyMetadata } from "igniteui-react-core";
import { round10N } from "igniteui-react-core";
/**
 * @hidden
 */
var CategoryBucketCalculator = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(CategoryBucketCalculator, _super);
    function CategoryBucketCalculator(a) {
        var _this = _super.call(this) || this;
        _this.c = null;
        _this.e = 0;
        _this.f = 0;
        _this.d = 0;
        if (a == null) {
            throw new ArgumentNullException(0, "view");
        }
        _this.c = a;
        _this.e = -1;
        _this.d = 0;
        return _this;
    }
    CategoryBucketCalculator.prototype.getBucket = function (a) {
        return null;
    };
    CategoryBucketCalculator.prototype.getBucketWithoutUnknowns = function (a) {
        return this.getBucket(a);
    };
    CategoryBucketCalculator.prototype.getErrorBucket = function (a, b) {
        return NaN;
    };
    CategoryBucketCalculator.prototype.g = function (a) {
        var b = this.c.ca;
        var c = this.c.b9;
        var d = this.c.db;
        var e = typeCast(CategoryAxisBase.$, d.fetchXAxis());
        var f = d.dp;
        if (b.isEmpty || c.isEmpty || e == null || f == null || f.count == 0) {
            this.d = 0;
            return;
        }
        var g = d.getEffectiveViewport1(this.c);
        var h = d.w4(this.c);
        var i = typeCast(ISortingAxis_$type, e);
        if (i == null || i.i$b == null) {
            var j = new ScalerParams(0, b, c, e.dn, g);
            var k = Math.floor(e.f9(h.left, j));
            var l = Math.ceil(e.f9(h.right, j));
            if (e.dn) {
                l = Math.ceil(e.f9(h.left, j));
                k = Math.floor(e.f9(h.right, j));
            }
            l = Math.min(l, e.qb - 1);
            var m = Math.floor((l - k + 1) * a / h.width);
            this.d = truncate(Math.max(1, m));
            this.e = truncate(Math.max(0, Math.floor(k / this.d) - 1));
            this.f = truncate(Math.ceil(l / this.d));
        }
        else {
            this.e = i.i$e(b, c, g, h);
            this.f = i.i$g(b, c, g, h);
            this.d = 1;
        }
    };
    CategoryBucketCalculator.prototype.getBucketInfo = function (a, b, c, d) {
        a = this.e;
        b = this.f;
        c = this.d;
        d = this.c.db.ik;
        return {
            p0: a,
            p1: b,
            p2: c,
            p3: d
        };
    };
    CategoryBucketCalculator.prototype.cacheValues = function () {
    };
    CategoryBucketCalculator.prototype.unCacheValues = function () {
    };
    CategoryBucketCalculator.$t = markType(CategoryBucketCalculator, 'CategoryBucketCalculator', Base.$, [IBucketizer_$type]);
    return CategoryBucketCalculator;
}(Base));
export { CategoryBucketCalculator };
/**
 * @hidden
 */
var CategoryFramePreparerBase = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(CategoryFramePreparerBase, _super);
    function CategoryFramePreparerBase(a) {
        var _rest = [];
        for (var _i = 1; _i < arguments.length; _i++) {
            _rest[_i - 1] = arguments[_i];
        }
        var _this = this;
        a = (a == void 0) ? 0 : a;
        switch (a) {
            case 0:
                {
                    var c = _rest[0];
                    var d = [c, typeCast(ISupportsMarkers_$type, c), typeCast(IProvidesViewport_$type, c), typeCast(ISupportsErrorBars_$type, c), typeCast(IBucketizer_$type, c)];
                    {
                        var f = d[0];
                        var g = d[1];
                        var h = d[2];
                        var i = d[3];
                        var j = d[4];
                        _this = _super.call(this, 1, g, h, i) || this;
                        _this.g = null;
                        _this.h = null;
                        _this.m = false;
                        _this.o = new List$1(Array_$type, 0);
                        _this.p = new List$1(Number_$type, 0);
                        _this.n = new List$1(Number_$type, 0);
                        _this.h = f;
                        _this.g = j;
                    }
                }
                break;
            case 1:
                {
                    var c = _rest[0];
                    var d = _rest[1];
                    var e = _rest[2];
                    var f = _rest[3];
                    var g = _rest[4];
                    _this = _super.call(this, 1, d, e, f) || this;
                    _this.g = null;
                    _this.h = null;
                    _this.m = false;
                    _this.o = new List$1(Array_$type, 0);
                    _this.p = new List$1(Number_$type, 0);
                    _this.n = new List$1(Number_$type, 0);
                    _this.h = c;
                    _this.g = g;
                }
                break;
        }
        return _this;
    }
    CategoryFramePreparerBase.prototype.i = function (a) {
        var b = new PreparationParams();
        b.f = this.h.useHighMarkerFidelity;
        b.b = this.h.scaler;
        b.c = this.h.yScaler;
        b.d = typeCast(ISortingAxis_$type, b.b);
        b.a = typeCast(CategoryFrame.$, a);
        if (b.a == null || b.b == null || b.c == null) {
            return null;
        }
        var c;
        var d;
        var e;
        var f;
        var g = this.g.getBucketInfo(c, d, e, f);
        c = g.p0;
        d = g.p1;
        e = g.p2;
        f = g.p3;
        b.k = c;
        b.l = d;
        b.j = e;
        b.i = f;
        if (b.l < b.k) {
            return null;
        }
        var h;
        var i;
        var j;
        var k = this.a.getViewInfo(i, h);
        i = k.p0;
        h = k.p1;
        j = this.a.getEffectiveViewport();
        var l = this.a.getMainContentViewport();
        b.p = h;
        b.o = i;
        b.n = j;
        b.m = l;
        if (Rect.l_op_Equality(b.p, Rect.empty) || Rect.l_op_Equality(b.o, Rect.empty)) {
            return null;
        }
        if (this.h != null && (typeCast(Series.$, this.h) !== null && this.h.isFragment) && this.g != null) {
            b.e = true;
        }
        return b;
    };
    CategoryFramePreparerBase.prototype.r = function (a, b, c, d) {
        return a.getSeriesOffset(b, c, d, this.h.currentMode2Index, this.h.currentCategoryMode);
    };
    CategoryFramePreparerBase.prototype.s = function (a) {
        return this.r(a.b, a.p, a.o, a.n);
    };
    CategoryFramePreparerBase.prototype.d = function (a, b) {
        var c = this.i(a);
        if (c == null || this.g == null) {
            return;
        }
        c.a.k.clear();
        c.a.p.clear();
        c.a.s.clear();
        c.a.v.clear();
        c.a.n.clear();
        c.a.m.clear();
        c.a.l.clear();
        if (c.a.r != null) {
            c.a.r.clear();
        }
        var d = this.c.shouldDisplayMarkers;
        var e = false;
        var f = this.s(c);
        var g = this.j(c);
        if (c.d != null && c.d.i$b != null && c.d.i$b.count != g.e) {
            return;
        }
        if (c.d != null && c.d.i$a) {
            c.d.i$h();
        }
        this.g.cacheValues();
        if (this.m && c.d != null && c.d.i$b.count > 0) {
            var h = c.d.i$b._inner[c.k];
            this.z(g, h, true, c.e);
            while ((isNaN_(g.c) || isNaN_(g.d)) && c.k > 0) {
                c.k = c.k - 1;
                h = c.d.i$b._inner[c.k];
                this.z(g, h, true, c.e);
            }
            var i = c.d.i$b._inner[c.l];
            this.z(g, i, true, c.e);
            while ((isNaN_(g.c) || isNaN_(g.d)) && c.l < g.e - 1) {
                c.l = c.l + 1;
                i = c.d.i$b._inner[c.l];
                this.z(g, i, true, c.e);
            }
        }
        if (this.m && c.d == null) {
            var j = c.k;
            var k = this.g.getBucket(j);
            while ((isNaN_(k[1]) || isNaN_(k[2])) && c.k > 0) {
                c.k = c.k - 1;
                j = c.k;
                k = this.g.getBucket(j);
            }
            var l = c.l;
            k = this.g.getBucket(l);
            while ((isNaN_(k[1]) || isNaN_(k[2])) && c.l < (intDivide(g.e, c.j))) {
                c.l = c.l + 1;
                l = c.l;
                k = this.g.getBucket(l);
            }
        }
        this.w(c, g, f);
        var m = this.t(c, g, f, d, e);
        this.c.updateMarkerCount(m);
        this.v(typeCast(CategoryFrame.$, a), b, c);
        this.g.unCacheValues();
        return;
    };
    CategoryFramePreparerBase.prototype.v = function (a, b, c) {
    };
    Object.defineProperty(CategoryFramePreparerBase.prototype, "q", {
        get: function () {
            return this.o;
        },
        enumerable: false,
        configurable: true
    });
    CategoryFramePreparerBase.prototype.t = function (a, b, c, d, e) {
        var _this = this;
        var f = 0;
        var g = false;
        var h = null;
        var i = false;
        var j = a.d != null;
        var k = a.p;
        var l = a.o;
        var m = typeCast(NumericAxisBase.$, a.c) !== null && a.c.qh;
        var n = a.f;
        var o = this.h.mayContainUnknowns;
        var p = this.o;
        var q = this.n;
        var r = this.p;
        p.clear();
        q.clear();
        r.clear();
        var s = this.g;
        var t = this.h.provideCollisionDetector();
        var u = 0;
        var v = a.n;
        var w = new ScalerParams(0, k, l, a.b.j$b, v);
        var x = ((function () {
            var $ret = new ScalerParams(0, k, l, a.c.j$b, v);
            $ret.b = typeCast(Series.$, _this.h) !== null ? _this.h.i5() : NaN;
            return $ret;
        })());
        if (j) {
            u = a.b.j$d(2, w) - a.b.j$d(1, w);
            i = this.k();
        }
        var y = a.k;
        var z = a.l;
        var aa = a.a.k;
        var ab = typeCast(IDateTimeAxis_$type, a.b);
        if (ab != null) {
            ab.StartTimeCursor();
        }
        var _loop_1 = function (ac) {
            var ad = void 0;
            if (!j) {
                if (!o) {
                    ad = s.getBucketWithoutUnknowns(ac);
                }
                else {
                    ad = s.getBucket(ac);
                }
            }
            else {
                ad = ((function () { var ae = _this.f(a, ac, b, u, g, h, c); ac = ae.p1; g = ae.p4; h = ae.p5; return ae.ret; })());
            }
            var ae = !m || (m && ad[1] > 0);
            var af = ad[0];
            if (!j || !isNaN_(ad[0])) {
                aa.add(ad);
                if (j) {
                    if (a.a.r == null) {
                        a.a.r = new List$1(Number_$type, 0);
                    }
                    a.a.r.add(ac * a.j);
                }
                if (g && i) {
                    if (h != null) {
                        aa.add(h);
                        if (j) {
                            if (a.a.r == null) {
                                a.a.r = new List$1(Number_$type, 0);
                            }
                            a.a.r.add(ac * a.j);
                        }
                    }
                }
                if (d && ae) {
                    var ag = ac * a.j;
                    var ah = ag;
                    if (j && a.d.i$b != null && ag >= 0 && ag < a.d.i$b.count) {
                        ag = a.d.i$b._inner[ag];
                    }
                    var ai = new Array(ad.length);
                    ai[0] = ad[0];
                    ai[1] = ad[1];
                    ai[2] = ad[2];
                    if (n && ag < b.e) {
                        ai = new Array(ad.length);
                        ai[0] = af;
                        this_1.z(b, ag, true, a.e);
                        ai[1] = b.c;
                        ai[2] = b.d;
                    }
                    p.add(ai);
                    q.add(a.a.k.count - 1);
                    r.add(ag);
                }
            }
            out_ac_1 = ac;
        };
        var this_1 = this, out_ac_1;
        for (var ac = y; ac <= z; ++ac) {
            _loop_1(ac);
            ac = out_ac_1;
        }
        if (ab != null) {
            ab.ResetTimeCursor();
        }
        this.y(a, c, j, w, x, e, d);
        if (d) {
            var aj = p.count;
            var ak = void 0;
            for (var al = 0; al < aj; al++) {
                ak = p._inner[al];
                if (this.l(a.a, ak, t, Math.min(r._inner[al], b.e - 1), f, q._inner[al])) {
                    ++f;
                }
            }
        }
        return f;
    };
    CategoryFramePreparerBase.prototype.k = function () {
        if (typeCast(Series.$, this.h) !== null) {
            return this.h.ey;
        }
        return false;
    };
    CategoryFramePreparerBase.prototype.f = function (a, b, c, d, e, f, g) {
        var h;
        f = null;
        e = false;
        var i = typeCast(CategorySeries.$, this.h);
        var j = a.o;
        var k = a.p;
        var l = a.n;
        var m = new ScalerParams(0, k, j, a.b.j$b, l);
        var n = new ScalerParams(0, k, j, a.c.j$b, l);
        var o = a.e;
        if (a.d == null || a.d.i$b == null || a.d.i$b.count == 0) {
            return {
                ret: [NaN, NaN, NaN],
                p1: b,
                p4: e,
                p5: f
            };
        }
        if (i != null && i.dp != null && i.dp.count < a.d.i$b.count) {
            return {
                ret: [NaN, NaN, NaN],
                p1: b,
                p4: e,
                p5: f
            };
        }
        var p = a.d.i$b._inner[b];
        var q = a.d.i$d(p);
        var r = q;
        this.z(c, p, false, o);
        while (b < a.l) {
            p = a.d.i$b._inner[b + 1];
            r = a.d.i$d(p);
            this.z(c, p, true, o);
            if (r - q >= d || isNaN_(c.c) || isNaN_(c.d)) {
                if (e) {
                    var s = a.d.i$b._inner[b];
                    this.z(c, s, true, o);
                    f = [a.b.j$c(q, m), c.c, c.d];
                }
                break;
            }
            if (!e && this.k()) {
                var t = a.d.i$b._inner[b];
                this.z(c, t, true, o);
                var u = [a.b.j$c(q, m), c.c, c.d];
                if (!isNaN_(u[0])) {
                    if (!isNaN_(u[1]) && !isNaN_(u[2])) {
                        if (a.d != null) {
                            u[0] = u[0] + g;
                        }
                        a.a.k.add(u);
                        if (a.d != null) {
                            if (a.a.r == null) {
                                a.a.r = new List$1(Number_$type, 0);
                            }
                            a.a.r.add(b);
                        }
                        e = true;
                    }
                    else {
                        break;
                    }
                }
            }
            b++;
            this.u(c, p, o);
        }
        var v = NaN;
        if (!isNaN_(q)) {
            v = a.b.j$c(q, m);
        }
        h = this.e(v, c);
        return {
            ret: h,
            p1: b,
            p4: e,
            p5: f
        };
    };
    CategoryFramePreparerBase.prototype.y = function (a, b, c, d, e, f, g) {
        var h = a.j;
        var i = a.a.k.count;
        var j = a.a.k;
        var k = this.o;
        var l = k.count;
        if (f) {
            var m = a.c.j$c(a.c.rb, e);
            a.c.j$f(a.a.p, 0, a.a.p.count, e);
            var n = a.a.p;
            var o = n.count;
            for (var p = 0; p < n.count; p++) {
                n._inner[p] = Math.abs(n._inner[p] - m);
            }
        }
    };
    CategoryFramePreparerBase.prototype.w = function (a, b, c) {
    };
    CategoryFramePreparerBase.$t = markType(CategoryFramePreparerBase, 'CategoryFramePreparerBase', FramePreparer.$);
    return CategoryFramePreparerBase;
}(FramePreparer));
export { CategoryFramePreparerBase };
/**
 * @hidden
 */
var CategoryFramePreparer = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(CategoryFramePreparer, _super);
    function CategoryFramePreparer(a) {
        var _rest = [];
        for (var _i = 1; _i < arguments.length; _i++) {
            _rest[_i - 1] = arguments[_i];
        }
        var _this = this;
        a = (a == void 0) ? 0 : a;
        switch (a) {
            case 0:
                {
                    var c = _rest[0];
                    var d = [c, typeCast(ISupportsMarkers_$type, c), typeCast(IProvidesViewport_$type, c), typeCast(ISupportsErrorBars_$type, c), typeCast(IBucketizer_$type, c)];
                    {
                        var f = d[0];
                        var g = d[1];
                        var h = d[2];
                        var i = d[3];
                        var j = d[4];
                        _this = _super.call(this, 1, f, g, h, i, j) || this;
                        _this.aa = new DefaultCategoryTrendlineHost();
                        _this.ab = new DefaultSingleValueProvider();
                        _this.ac = null;
                        _this.ad = null;
                        _this.ac = _this.aa;
                        if (typeCast(IHasCategoryTrendline_$type, f) !== null) {
                            _this.ac = typeCast(IHasCategoryTrendline_$type, f);
                        }
                        _this.ad = _this.ab;
                        if (typeCast(IHasSingleValueCategory_$type, f) !== null) {
                            _this.ad = typeCast(IHasSingleValueCategory_$type, f);
                        }
                    }
                }
                break;
            case 1:
                {
                    var c = _rest[0];
                    var d = _rest[1];
                    var e = _rest[2];
                    var f = _rest[3];
                    var g = _rest[4];
                    _this = _super.call(this, 1, c, d, e, f, g) || this;
                    _this.aa = new DefaultCategoryTrendlineHost();
                    _this.ab = new DefaultSingleValueProvider();
                    _this.ac = null;
                    _this.ad = null;
                    _this.ac = _this.aa;
                    if (typeCast(IHasCategoryTrendline_$type, c) !== null) {
                        _this.ac = typeCast(IHasCategoryTrendline_$type, c);
                    }
                    _this.ad = _this.ab;
                    if (typeCast(IHasSingleValueCategory_$type, c) !== null) {
                        _this.ad = typeCast(IHasSingleValueCategory_$type, c);
                    }
                }
                break;
        }
        return _this;
    }
    CategoryFramePreparer.prototype.l = function (a, b, c, d, e, f) {
        var g = b[0];
        var h = b[1];
        var i = new Rect(0, g - 5, h - 5, 11, 11);
        if (!isNaN_(g) && !isNaN_(h) && !isInfinity(g) && !isInfinity(h) && c.tryAdd(i)) {
            a.s.add({ $type: Point_$type, x: g, y: h });
            this.c.updateMarkerTemplate(e, d, f);
            return true;
        }
        return false;
    };
    CategoryFramePreparer.prototype.j = function (a) {
        var b = new SingleValuesHolder();
        var c = this.ad.valueColumn;
        b.f = c;
        return b;
    };
    CategoryFramePreparer.prototype.x = function (a, b, c, d, e, f) {
        if (d) {
            b[0] = b[0] + c;
        }
        else {
            b[0] = a.b.j$c(b[0], e) + c;
        }
        b[1] = a.c.j$c(b[1], f);
        if (a.j > 1 || d) {
            b[2] = a.c.j$c(b[2], f);
        }
        else {
            b[2] = b[1];
        }
    };
    CategoryFramePreparer.prototype.y = function (a, b, c, d, e, f, g) {
        _super.prototype.y.call(this, a, b, c, d, e, f, g);
        var h = a.j;
        var i = a.a.k.count;
        var j = a.a.k;
        var k = this.q;
        var l = k.count;
        var m = new List$1(Number_$type, 0);
        if (!c) {
            m.add(0);
        }
        var n = new List$1(Number_$type, 0);
        n.add(1);
        if (c || h > 1) {
            n.add(2);
        }
        a.b.j$e(j, m, 0, i, d);
        a.c.j$e(j, n, 0, i, e);
        for (var o = 0; o < i; o++) {
            j._inner[o][0] = j._inner[o][0] + b;
        }
        if (h == 1 && !c) {
            for (var p = 0; p < i; p++) {
                j._inner[p][2] = j._inner[p][1];
            }
        }
        if (g) {
            a.b.j$e(k, m, 0, l, d);
            a.c.j$e(k, n, 0, l, e);
            for (var q = 0; q < l; q++) {
                k._inner[q][0] = k._inner[q][0] + b;
            }
            if (h == 1 && !c) {
                for (var r = 0; r < l; r++) {
                    k._inner[r][2] = k._inner[r][1];
                }
            }
        }
    };
    CategoryFramePreparer.prototype.w = function (a, b, c) {
        if (this.ac.trendLineType == 0 || this.ac.trendlinePreparer == null || this.ac.trendLinePeriod < 1) {
            return;
        }
        this.ac.trendlinePreparer.prepareLine(this.ac, a, b, c);
    };
    CategoryFramePreparer.prototype.z = function (a, b, c, d) {
        var e = a;
        var f = e.f;
        var g = f.item(b);
        var h = g;
        if (d) {
            var i = this.g.getBucket(b);
            g = i[1];
            h = i[1];
        }
        if (c) {
            e.c = g;
            e.d = h;
        }
        else {
            e.a = g;
            e.b = h;
        }
    };
    CategoryFramePreparer.prototype.u = function (a, b, c) {
        var d = a;
        var e = d.f;
        if (b < e.count) {
            var f = void 0;
            if (c) {
                var g = this.g.getBucket(b);
                f = g[1];
            }
            else {
                f = e.item(b);
            }
            d.a = Math.min(d.a, f);
            d.b = Math.max(d.b, f);
        }
    };
    CategoryFramePreparer.prototype.e = function (a, b) {
        var c = b;
        return [a, c.a, c.b];
    };
    CategoryFramePreparer.$t = markType(CategoryFramePreparer, 'CategoryFramePreparer', CategoryFramePreparerBase.$);
    return CategoryFramePreparer;
}(CategoryFramePreparerBase));
export { CategoryFramePreparer };
/**
 * @hidden
 */
var CategorySeries = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(CategorySeries, _super);
    function CategorySeries() {
        var _this = _super.call(this) || this;
        _this.zk = null;
        _this.zs = null;
        _this.z1 = false;
        _this.z0 = false;
        _this.assigningCategoryStyle = null;
        _this.assigningCategoryMarkerStyle = null;
        _this.zy = null;
        _this.zz = null;
        _this.zh = new CategoryFrame(3);
        _this.zj = new CategoryFrame(3);
        _this.zf = new CategoryFrame(3);
        _this.zi = new CategoryFrame(3);
        _this.zn = null;
        _this.zr = null;
        _this.zn = new CategorySeriesRenderManager();
        _this.zr = new CategoryTransitionSourceFramePreparer();
        _this.z1 = false;
        _this.d3 = false;
        _this.z0 = false;
        _this.ab = CategorySeries.$;
        return _this;
    }
    CategorySeries.prototype.ct = function () {
        var a = new CategorySeriesView(this);
        return a;
    };
    Object.defineProperty(CategorySeries.prototype, "zt", {
        get: function () {
            var _this = this;
            if (this.zs == null) {
                this.zs = DVContainer.instance.createInstance(ICategorySeriesInteractionManager_$type, function () { return _this.ds.n; });
            }
            return this.zs;
        },
        enumerable: false,
        configurable: true
    });
    CategorySeries.prototype.ed = function (a, b, c, d, e) {
        var _this = this;
        if (!this.hasMarkers) {
            return false;
        }
        var f = this.getEffectiveViewport1(this.cw);
        var g = this.zd();
        var h = new ScalerParams(1, this.dc.yr, this.xd, g.dn);
        h.c = f;
        var i = this.zu();
        var j = new ScalerParams(1, this.dc.yr, this.xd, i.dn);
        j.c = f;
        var k = this.dc.yr;
        var l = this.xd;
        var m = this.currentMode2Index;
        var n = 0;
        if (g.dj && g.dg) {
            n = g.getSeriesOffset(k, l, f, m, g.categoryMode);
        }
        a.clear();
        this.xr.cw(function (o) {
            if (o._visibility == 0) {
                var p = new SeriesPointOfInterest();
                var q = o.n;
                var r = o.o;
                if (!e && (q < _this.xd.left || q > _this.xd.right || r < _this.xd.top || r > _this.xd.bottom)) {
                    return;
                }
                if (_this.isVertical) {
                    if (g.df && !g.dj && g.categoryMode != 0) {
                        p.e = o.ak;
                    }
                    else {
                        p.e = g.f9(r, h);
                    }
                    p.d = i.f9(q, j);
                }
                else {
                    if (g.df && !g.dj && g.categoryMode != 0) {
                        p.d = o.ak;
                    }
                    else {
                        p.d = g.f9(q, h);
                    }
                    p.e = i.f9(r, j);
                }
                p.b = o.content;
                if (b) {
                    if (_this.isVertical) {
                        if (c) {
                            p.f = _this.aak(p.d, d);
                        }
                        else {
                            var s = _this.jl(o);
                            if (!isNaN_(s)) {
                                p.f = _this.aak(s, d);
                            }
                            else {
                                p.f = _this.aak(p.d, d);
                            }
                        }
                    }
                    else {
                        if (c) {
                            p.f = _this.aak(p.e, d);
                        }
                        else {
                            var t = _this.jl(o);
                            if (!isNaN_(t)) {
                                p.f = _this.aak(t, d);
                            }
                            else {
                                p.f = _this.aak(p.e, d);
                            }
                        }
                    }
                }
                else {
                    var u = _this.au(true);
                    if (u != null) {
                        var v = _this.k1(o.ak, false);
                        if (v != null) {
                            p.f = u.i(v);
                        }
                        else {
                            p.f = null;
                        }
                    }
                    else {
                        p.f = g.i8(o.ak);
                    }
                }
                p.c = o.ak;
                p.g = _this.v0;
                if (_this.hf) {
                    p.g = _this.v7(o.ak);
                }
                a.add(p);
            }
        });
        return true;
    };
    CategorySeries.prototype.aak = function (a, b) {
        var c;
        if (b >= 0) {
            c = round10N(a, b);
        }
        else {
            c = a;
        }
        var d = this.au(false);
        if (d != null) {
            var e = d;
            return e.i(c);
        }
        else {
            return MathUtil.t(c);
        }
    };
    CategorySeries.prototype.rh = function (a) {
        _super.prototype.rh.call(this, a);
        this.zo = a;
    };
    CategorySeries.prototype.preferredCategoryMode = function (a) {
        return 0;
    };
    Object.defineProperty(CategorySeries.prototype, "categoryAxis", {
        get: function () {
            return this.zd();
        },
        enumerable: false,
        configurable: true
    });
    CategorySeries.prototype.zd = function () {
        return this.fetchXAxis();
    };
    CategorySeries.prototype.zu = function () {
        return this.fetchYAxis();
    };
    CategorySeries.prototype.get_em = function () {
        return true;
    };
    CategorySeries.prototype.get_gb = function () {
        return this.zu() != null && this.zu().dn;
    };
    CategorySeries.prototype.get_e1 = function () {
        return true;
    };
    CategorySeries.prototype.ac = function () {
        _super.prototype.ac.call(this);
        this.zo.c9.g(this.ik);
    };
    CategorySeries.prototype.z7 = function () {
        return (this.assigningCategoryStyle != null && this.z1) || (this.by != 1) || this.d3 || (this.cq != 1) || (this.cp != 1);
    };
    CategorySeries.prototype.z8 = function () {
        return (this.assigningCategoryMarkerStyle != null && this.z0) || (this.by != 1) || this.d3 || (this.cq != 1) || (this.cp != 1);
    };
    CategorySeries.prototype.aa7 = function (a) {
        if (this.assigningCategoryStyle != null && this.z1) {
            this.assigningCategoryStyle(this, a);
        }
    };
    CategorySeries.prototype.aa6 = function (a) {
        if (this.assigningCategoryMarkerStyle != null && this.z0) {
            this.assigningCategoryMarkerStyle(this, a);
        }
    };
    CategorySeries.prototype.y7 = function (a, b) {
        return null;
    };
    CategorySeries.prototype.pi = function (a, b) {
        _super.prototype.pi.call(this, a, b);
        if (a) {
            this.aat(b);
        }
    };
    CategorySeries.prototype.bs = function () {
        var a = _super.prototype.bs.call(this);
        return a;
    };
    CategorySeries.prototype.qp = function () {
        _super.prototype.qp.call(this);
        var a = this.fetchXAxis();
        if (a != null) {
            a.ly(false);
        }
        var b = this.fetchYAxis();
        if (b != null) {
            b.ly(false);
        }
    };
    CategorySeries.prototype.s9 = function (a, b) {
        _super.prototype.s9.call(this, a, b);
        this.zo.c9.g(this.ik);
        this.r8(false);
    };
    CategorySeries.prototype.s8 = function (a, b) {
        if (this.g7 && this.jz < 0.05 && (this.dc == null || !this.dc.gi())) {
            this.g8 = true;
            this.hb = false;
            this.gq = false;
        }
        _super.prototype.s8.call(this, a, b);
        this.zo.c9.g(this.ik);
        this.r8(false);
    };
    CategorySeries.prototype.rq = function (a, b, c, d) {
        _super.prototype.rq.call(this, a, b, c, d);
        switch (b) {
            case "SeriesViewer":
                var e = this.fetchYAxis();
                var f = this.fetchXAxis();
                if (c != null && d == null) {
                    this.pp(f);
                    this.pp(e);
                }
                if (c == null && d != null) {
                    this.ry(f);
                    this.ry(e);
                }
                this.zo.c9.g(this.ik);
                this.r8(false);
                break;
            case "SyncLink":
                if (this.c4 != null && this.dc != null) {
                    this.zo.c9.g(this.ik);
                }
                this.r8(false);
                break;
            case "TransitionProgress":
                this.zj.d(this.jz, this.zh, this.zf);
                if (this.d7(this.cw)) {
                    return;
                }
                if (this.jz == 1) {
                    this.zf.ab();
                    this.aa8(this.zf, this.zo);
                    if (this.g7) {
                        this.g7 = false;
                        this.pj();
                        this.dd.r = truncate(this.jh());
                        this.dd.b = this.de;
                    }
                    if (this.ha) {
                        this.ha = false;
                        this.pj();
                        this.dd.r = truncate(this.jh());
                        this.dd.b = this.de;
                        this.rg();
                    }
                    this.q3();
                }
                else {
                    this.aa8(this.zj, this.zo);
                }
                if (this.dc != null) {
                    this.dc.st(this);
                }
                break;
            case "ErrorBarSettings":
                this.q0();
                break;
            case CategorySeries.$$p[5]:
                this.r8(false);
                break;
            case CategorySeries.$$p[2]:
                this.z1 = this.z3();
                this.r8(false);
                break;
            case CategorySeries.$$p[1]:
                this.z0 = this.z2();
                this.r8(false);
                break;
        }
    };
    CategorySeries.prototype.z3 = function () {
        return this.z5;
    };
    CategorySeries.prototype.z2 = function () {
        return this.z4;
    };
    CategorySeries.prototype.aae = function (a) {
        return this.i0(a, this.fetchXAxis());
    };
    CategorySeries.prototype.get_fv = function () {
        return typeCast(ISortingAxis_$type, this.zd()) !== null;
    };
    CategorySeries.prototype.a0 = function () {
        return this.zd();
    };
    CategorySeries.prototype.ke = function (a) {
        return this.zt.b$d(this, a);
    };
    CategorySeries.prototype.kw = function (a) {
        return this.zt.b$f(this, a);
    };
    CategorySeries.prototype.kc = function (a) {
        var b = truncate(Math.round(this.iy(a)));
        return b;
    };
    CategorySeries.prototype.iy = function (a) {
        return this.zt.b$c(this, a);
    };
    CategorySeries.prototype.di = function (a, b, c) {
        if (this.f2(this.by) && !c) {
            var d = this.zx(a, b, this.zz);
            this.zz = d;
            return d;
        }
        else {
            var e = this.zv(a, b, this.zz);
            e.d = true;
            this.zz = e;
            return e;
        }
    };
    CategorySeries.prototype.get_fh = function () {
        return true;
    };
    CategorySeries.prototype.pg = function () {
        _super.prototype.pg.call(this);
        this.zy = null;
        this.zz = null;
    };
    CategorySeries.prototype.dh = function (a, b, c) {
        if (this.ef && this.f2(this.by) && !c) {
            var d = this.zw(a, b, this.zy);
            this.zy = d;
            return d;
        }
        else {
            var e = this.zv(a, b, this.zy);
            this.zy = e;
            return e;
        }
    };
    CategorySeries.prototype.aad = function () {
        return this.zo.dc.a;
    };
    CategorySeries.prototype.zx = function (a, b, c) {
        if (!this.x1()) {
            return null;
        }
        var d = this.zg();
        var e = this.aad();
        return this.zt.b$b(this, e, this.aah(this.cw), this.aag(this.cw), d.k, a, b, c);
    };
    CategorySeries.prototype.zw = function (a, b, c) {
        var d = this.aah(this.cw);
        var e = this.aai(this.cw);
        var f = this.aag(this.cw);
        var g = this.zg();
        return this.zt.b$a(this, g.k, g.r, d, e, f, a, b, c);
    };
    CategorySeries.prototype.zv = function (a, b, c) {
        var d = new HighlightingInfo();
        d.i = this;
        d.g = 0;
        d.f = this.dp != null ? this.dp.count - 1 : 0;
        d.c = true;
        if (c != null && c.g == d.g && c.f == d.f) {
            return c;
        }
        return d;
    };
    CategorySeries.prototype.zg = function () {
        var a = this.zf;
        if (this.d4()) {
            if (this.dd.g) {
                this.dd.t();
            }
            a = this.zj;
        }
        return a;
    };
    CategorySeries.prototype.aa3 = function (a, b, c, d, e, f, g) {
        var h = this.by != 1;
        var i = this.d3;
        var j = this.cq != 1;
        var k = this.cp != 1;
        this.zn.a3(this.zn.d, d.dv, a, b, c, d, e, f, true, g);
        this.zn.aa(this.ii);
        var l = this.zn.ax;
        var m = null;
        var n = this.dp;
        var o = null;
        var p = null;
        var q = null;
        var r = null;
        var s = null;
        if (i && this.dc != null && !l.e) {
            var t = this.v8(l.z);
            var u = this.v9(l.z);
            this.zn.ae = t;
            this.zn.af = u;
            l.aa = t;
            l.ab = u;
        }
        if (h && this.dc != null) {
            m = this.dc.d7.getHighlightingInfo(this, n, l.z, l.y, true);
            if (this.dc.d7.isCrossContextHighlight(this)) {
                o = this.dc.d7.getHighlightingInfo(this, n, l.z, l.y, true);
            }
            l.c = m;
        }
        if (j && this.dc != null) {
            p = this.dc.d8.getHighlightingInfo(this, n, l.z, l.y, true);
            if (p == null && this.bo != null) {
                p = this.dc.d8.getHighlightingInfo(this.bo, this.bo.dp, l.z, l.y, true);
            }
            if (this.dc.d8.isCrossContextHighlight(this)) {
                r = this.dc.d8.getHighlightingInfo(this, n, l.z, l.y, true);
            }
            l.d = p;
        }
        if (k && this.dc != null) {
            q = this.dc.d6.getHighlightingInfo(this, n, l.z, l.y, true);
            if (this.dc.d6.isCrossContextHighlight(this)) {
                s = this.dc.d6.getHighlightingInfo(this, n, l.z, l.y, true);
            }
            l.b = q;
        }
        l.h = f;
        this.aa6(l);
        this.zn.y(this, m, p, q, f, h, j, k, l.v, this.dc.d7.totalHighWaterMark, l.x, this.dc.d8.totalHighWaterMark, l.t, this.dc.d6.totalHighWaterMark);
    };
    CategorySeries.prototype.aa4 = function (a, b, c, d, e, f, g) {
        var h = this.by != 1;
        var i = this.cq != 1;
        var j = this.cp != 1;
        var k = this.d3;
        this.zn.a3(this.zn.b, d.dv, a, b, c, d, e, f, false, g);
        this.zn.ab(this.ii);
        var l = this.zn.ay;
        var m = null;
        var n = null;
        var o = null;
        var p = this.dp;
        if (k && this.dc != null && !l.e) {
            var q = this.v7(l.z);
            var r = this.wa(l.z);
            this.zn.ag = q;
            this.zn.ah = r;
            l.aa = q;
            l.ab = r;
        }
        if (h && this.dc != null) {
            m = this.dc.d7.getHighlightingInfo(this, p, l.z, l.y, false);
            l.c = m;
        }
        if (i && this.dc != null) {
            n = this.dc.d8.getHighlightingInfo(this, p, l.z, l.y, false);
            if (n == null && this.bo != null) {
                n = this.dc.d8.getHighlightingInfo(this.bo, this.bo.dp, l.z, l.y, false);
            }
            l.d = n;
        }
        if (j && this.dc != null) {
            o = this.dc.d6.getHighlightingInfo(this, p, l.z, l.y, false);
            if (o == null && this.bo != null) {
                o = this.dc.d6.getHighlightingInfo(this.bo, this.bo.dp, l.z, l.y, false);
            }
            l.b = o;
        }
        l.h = f;
        this.aa7(l);
        this.zn.z(this, m, n, o, f, h, i, j, b < 0);
    };
    CategorySeries.prototype.hk = function (a, b, c) {
        var d = _super.prototype.hk.call(this, a, b, c);
        d = d && this.aac(this.fetchXAxis());
        d = d && this.aac(this.fetchYAxis());
        var e = c;
        if (!c.r() || b.isEmpty || a.isEmpty || this.dp == null) {
            d = false;
        }
        if (!d) {
            e.c9.d = 0;
        }
        return d;
    };
    CategorySeries.prototype.aac = function (a) {
        if (a == null || a.b7 == null) {
            return false;
        }
        var b = typeCast(CategoryAxisBase.$, a);
        if (b != null) {
            if (b.itemsSource == null) {
                return false;
            }
            if (b.qa < 1) {
                return false;
            }
        }
        else {
            var c = typeCast(NumericAxisBase.$, a);
            if (c != null) {
                return c.qw != c.qv;
            }
        }
        return true;
    };
    CategorySeries.prototype.gt = function () {
        return this.z6;
    };
    CategorySeries.prototype.gu = function () {
        return true;
    };
    CategorySeries.prototype.zp = function () {
        return 12;
    };
    CategorySeries.prototype.pj = function () {
        _super.prototype.pj.call(this);
        this.zh.ab();
        this.zf.ab();
        this.zj.ab();
    };
    CategorySeries.prototype.r9 = function (a) {
        _super.prototype.r9.call(this, a);
        this.zo.c9.g(this.ik);
        if (this.d7(this.cw)) {
            this.zf.ae();
            this.zj.ae();
            this.zh.ae();
            return;
        }
        if (this.gx) {
            if (this.d4()) {
                if (this.dd.g) {
                    this.dd.t();
                }
                this.aa8(this.zj, this.zo);
            }
            else {
                this.aa8(this.zf, this.zo);
            }
            return;
        }
        if (this.gl(a)) {
            var b = this.zh;
            if (this.d4()) {
                if (this.dd.g) {
                    this.dd.t();
                }
                this.zh = this.zj;
                this.zj = b;
            }
            else {
                this.zh = this.zf;
                this.zf = b;
            }
            var c = false;
            this.aa5(this.zf, this.zo);
            if (this.g9) {
                this.dd.w();
                this.dd.r = truncate(this.ji());
                this.dd.b = this.df != null ? this.df : this.de;
                if (this.ha) {
                    var d = this.zj;
                    this.zj = this.zh;
                    this.zh = d;
                    c = true;
                }
                this.zr.x(this, this.zh, this.zf, this.isVertical, this.fetchXAxis(), this.fetchYAxis(), this.zq, this.zp(), this.c6, this.c5(), runOn(this, this.aaf), this.zo.b9);
                if (this.ha) {
                    var e = this.zj;
                    this.zj = this.zh;
                    this.zh = e;
                }
                this.ha = false;
            }
            if (this.hc) {
                this.dd.w();
                this.dd.r = truncate(this.jj());
                this.dd.b = this.dg != null ? this.dg : this.de;
                if (this.g7) {
                    var f = this.zj;
                    this.zj = this.zh;
                    this.zh = f;
                    c = true;
                }
                this.zr.x(this, this.zh, this.zf, this.isVertical, this.fetchXAxis(), this.fetchYAxis(), this.zq, this.zp(), this.c6, this.c5(), runOn(this, this.aaf), this.zo.b9);
                var g = this.zf;
                this.zf = this.zh;
                this.zh = g;
                if (this.g7) {
                    var h = this.zj;
                    this.zj = this.zh;
                    this.zh = h;
                }
                this.g7 = false;
            }
            this.eb = false;
            if (!c) {
                this.pe();
            }
            this.sp();
            if (this.g9) {
                this.g8 = false;
                this.g7 = true;
            }
            if (this.hc) {
                this.hb = false;
                this.ha = true;
            }
        }
        else {
            this.aa5(this.zf, this.zo);
            this.aa8(this.zf, this.zo);
        }
    };
    CategorySeries.prototype.c5 = function () {
        return 3;
    };
    CategorySeries.prototype.c8 = function () {
        var a = this.c5();
        switch (a) {
            case 0: return 0;
            case 1: return 1;
            case 4: return 4;
            case 2: return 2;
            case 3: return 3;
        }
        return 3;
    };
    CategorySeries.prototype.aaf = function () {
        if (this.isVertical) {
            return this.xd.left;
        }
        return this.xd.bottom;
    };
    CategorySeries.prototype.z9 = function () {
        return false;
    };
    CategorySeries.prototype.hz = function () {
        var a = _super.prototype.hz.call(this);
        if (this.z9()) {
            var b = ((function () {
                var $ret = new SeriesLayerPropertyOverlay();
                $ret.r = true;
                $ret.ad = "DashArray";
                $ret.p = true;
                $ret.x = ((function () {
                    var $ret = new DoubleCollection();
                    $ret.add(5);
                    $ret.add(5);
                    return $ret;
                })());
                $ret.q = true;
                return $ret;
            })());
            a.add(b);
        }
        if (!this.z9()) {
            var c = ((function () {
                var $ret = new SeriesLayerPropertyOverlay();
                $ret.r = true;
                $ret.ad = "Brush";
                $ret.p = true;
                $ret.y = "ActualBrush";
                $ret.q = true;
                return $ret;
            })());
            c.valueResolving = delegateCombine(c.valueResolving, runOn(this, this.si));
            a.add(c);
        }
        if (!this.z9()) {
            var d = ((function () {
                var $ret = new SeriesLayerPropertyOverlay();
                $ret.r = true;
                $ret.ad = "Outline";
                $ret.p = true;
                $ret.y = "ActualOutline";
                $ret.q = true;
                return $ret;
            })());
            d.valueResolving = delegateCombine(d.valueResolving, runOn(this, this.si));
            a.add(d);
        }
        var e = ((function () {
            var $ret = new SeriesLayerPropertyOverlay();
            $ret.p = true;
            $ret.ad = "IsTransitionInEnabled";
            $ret.x = true;
            $ret.q = true;
            return $ret;
        })());
        a.add(e);
        var f = ((function () {
            var $ret = new SeriesLayerPropertyOverlay();
            $ret.p = true;
            $ret.ad = "TransitionInMode";
            $ret.x = enumGetBox(CategoryTransitionInMode_$type, 20);
            $ret.q = true;
            return $ret;
        })());
        a.add(f);
        return a;
    };
    CategorySeries.prototype.k4 = function () {
        if (this.d4()) {
            return this.bo.zj;
        }
        else {
            return this.bo.zf;
        }
    };
    CategorySeries.prototype.aaj = function () {
        var e_1, _a;
        if (this.bo != null) {
            var a = this.bo;
            return a.aaj();
        }
        var b = 0;
        var c = this.fetchXAxis();
        try {
            for (var _b = __values(fromEnum(this.dc.b9)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var d = _c.value;
                if (d == this) {
                    return b;
                }
                var e = typeCast(CategorySeries.$, d);
                if (e != null) {
                    var f = typeCast(CategoryAxisBase.$, e.fetchXAxis());
                    if (f == c && e.preferredCategoryMode(f) == 2) {
                        b++;
                    }
                }
            }
        }
        catch (e_1_1) {
            e_1 = { error: e_1_1 };
        }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return))
                    _a.call(_b);
            }
            finally {
                if (e_1)
                    throw e_1.error;
            }
        }
        return -1;
    };
    Object.defineProperty(CategorySeries.prototype, "GetErrorBarsXAxis", {
        get: function () {
            return this.fetchXAxis();
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(CategorySeries.prototype, "GetErrorBarsYAxis", {
        get: function () {
            return this.fetchYAxis();
        },
        enumerable: false,
        configurable: true
    });
    CategorySeries.prototype.aau = function (a, b) {
        this.zn.a1(this, this.z8(), runOn(this, this.y7), this.aag(a), this.aah(a));
        var c = this.zn.d;
        var d = c != null;
        var e = this.zd();
        if (e == null) {
            return;
        }
        var f = this.getEffectiveViewport1(a);
        var g = new ScalerParams(0, a.ca, a.b9, e.dn, f);
        var h = this.dp == null ? 0 : this.dp.count;
        var i = a;
        var j = b.k;
        var k = i.c9.e;
        var l = i.c9.f;
        var m = i.c9.d;
        var n = k * m;
        for (var o = 0; o < a.dc.count; o++) {
            var p = a.dc.item(o);
            var q = p.content;
            if (d) {
                var r = p.al;
                this.aa3(j, r, h, e, g, a.t, p.ak);
            }
            this.zn.ac(p, q);
        }
    };
    CategorySeries.prototype.aa8 = function (a, b) {
        this.rd();
        this.w3 = a.ag;
        b.a6();
    };
    CategorySeries.prototype.aa5 = function (a, b) {
        a.aa();
    };
    CategorySeries.prototype.aag = function (a) {
        return a.c9.d;
    };
    CategorySeries.prototype.aah = function (a) {
        return a.c9.e;
    };
    CategorySeries.prototype.aai = function (a) {
        return a.c9.f;
    };
    CategorySeries.prototype.aat = function (a) {
        var b = a;
        b.dc.count = 0;
    };
    CategorySeries.prototype.sa = function (a, b) {
        _super.prototype.sa.call(this, a, b);
        if (!this.g6) {
            this.cw.be(b);
            return;
        }
        var c = typeCast(CategorySeriesView.$, this.cv);
        c.c9.g(this.ik);
        this.cw.be(b);
        if (this.d7(this.cv)) {
            return;
        }
        this.sb();
        this.g6 = false;
    };
    CategorySeries.prototype.sb = function () {
        _super.prototype.sb.call(this);
        var a = typeCast(CategorySeriesView.$, this.cv);
        if (!this.gy) {
            this.aa5(this.zi, a);
        }
        this.gy = false;
        this.aa8(this.zi, a);
    };
    CategorySeries.prototype.zl = function (a) {
        var b = typeCast(CategorySeriesView.$, a);
        if (b != null && b.t) {
            if (b.s) {
                return new CategoryFramePreparer(1, typeCast(IIsCategoryBased_$type, this), typeCast(ISupportsMarkers_$type, b), b, this, b.c9);
            }
            else {
                return new CategoryFramePreparer(1, typeCast(IIsCategoryBased_$type, this), typeCast(ISupportsMarkers_$type, b), this.dc.dw.o, this, b.c9);
            }
        }
        else {
            return this.zk;
        }
    };
    CategorySeries.prototype.aw = function (a) {
        if (this.fetchXAxis() == a) {
            return this.fetchYAxis();
        }
        if (this.fetchYAxis() == a) {
            return this.fetchXAxis();
        }
        return null;
    };
    CategorySeries.prototype.ai = function () {
        return [this.fetchXAxis(), this.fetchYAxis()];
    };
    CategorySeries.y8 = function (a, b, c, d, e) {
        var f = null;
        if (b > -1 && !d.isEmpty && !c.isEmpty) {
            var g = a._inner[0][0] < c.left - 2000 ? c.left - 10 : NaN;
            var h = c.bottom + 10;
            var i = a._inner[b][0] > c.right + 2000 ? c.right + 10 : NaN;
            var j = c.top - 10;
            f = new Clipper(1, g, h, i, j, e);
        }
        return f;
    };
    CategorySeries.prototype.aa0 = function (a, b, c, d, e) {
        var f = this.dc.y6(this.dc.yw(a));
        var g = this.zd();
        var h = this.zu();
        var i = this.fetchXAxis();
        var j = g == i;
        var k = this.dc.yz(this.xd, this.getEffectiveViewport(), f);
        var l, m;
        var n = this.aaw(f, g, j, k, l, m);
        l = n.p4;
        m = n.p5;
        if (d == 0) {
            this.aa2(b, l, m, c);
        }
        else {
            var o = void 0, p = void 0;
            var q = this.aav(f, h, j, k, o, p);
            o = q.p4;
            p = q.p5;
            this.aa1(e, b, l, m, o, p, c);
        }
    };
    CategorySeries.prototype.aa2 = function (a, b, c, d) {
        var _this = this;
        if (b == -1 || c == -1) {
            return;
        }
        if (d == 7 || d == 6) {
            a.add(((function () {
                var $ret = new ChartSelection();
                $ret.series = _this;
                return $ret;
            })()));
            return;
        }
        for (var e = b; e <= c; e++) {
            this.aas(a, e, d);
        }
    };
    CategorySeries.prototype.aav = function (a, b, c, d, e, f) {
        var g = new ScalerParams(0, a, this.dc.y9, b.dn, this.getEffectiveViewport());
        var h = c ? (b.dn ? d.top : d.bottom) : (b.dn ? d.right : d.left);
        var i = c ? (b.dn ? d.bottom : d.top) : (b.dn ? d.left : d.right);
        e = b.f9(h, g);
        f = b.f9(i, g);
        return {
            p4: e,
            p5: f
        };
    };
    CategorySeries.prototype.aaw = function (a, b, c, d, e, f) {
        var g = new ScalerParams(0, a, this.dc.y9, b.dn, this.getEffectiveViewport());
        var h = c ? (b.dn ? d.right : d.left) : (b.dn ? d.top : d.bottom);
        var i = c ? (b.dn ? d.left : d.right) : (b.dn ? d.bottom : d.top);
        var j = b.f9(h, g);
        var k = b.f9(i, g);
        var l = this.aax(b, j, k, e, f);
        e = l.p3;
        f = l.p4;
        return {
            p4: e,
            p5: f
        };
    };
    CategorySeries.prototype.aax = function (a, b, c, d, e) {
        var f = this.aaz(a, b, c, d, e);
        d = f.p3;
        e = f.p4;
        return {
            p3: d,
            p4: e
        };
    };
    CategorySeries.prototype.aaz = function (a, b, c, d, e) {
        var f = a.pz(this.cw.ca, this.cw.b9, this.getEffectiveViewport1(this.cw));
        var g = a.getCategorySize(this.cw.ca, this.cw.b9, this.getEffectiveViewport1(this.cw));
        var h = (f * a.qc) / g;
        var i = 1 - h;
        var j = f / g;
        var k = 0;
        for (var l = 0; l < a.es.count; l++) {
            if (!a.es._inner[l].e1) {
                continue;
            }
            var m = a.es._inner[l];
            var n = m;
            var o = n.preferredCategoryMode(a);
            if (o != 2) {
                continue;
            }
            if (a.es._inner[l] == this) {
                break;
            }
            k++;
        }
        var p = a.qc - k - 1;
        d = Math.max(0, truncate((a.categoryMode == 0 ? Math.ceil(b) : Math.floor(b + (i / 2) + (p * j)))));
        e = Math.min(truncate(Math.floor(c - (i / 2) - (k * j))), this.dp.count - 1);
        return {
            p3: d,
            p4: e
        };
    };
    CategorySeries.prototype.aay = function (a, b, c, d, e) {
        d = Math.max(0, truncate((a.categoryMode == 0 ? Math.ceil(b) : Math.ceil(b - 0.5))));
        e = Math.min(truncate((a.categoryMode == 0 ? Math.floor(c) : Math.floor(c - 0.5))), this.dp.count - 1);
        return {
            p3: d,
            p4: e
        };
    };
    CategorySeries.$t = markType(CategorySeries, 'CategorySeries', MarkerSeries.$, [IHasCategoryModePreference_$type, ISupportsErrorBars_$type]);
    CategorySeries.$$p = markDep(DependencyProperty, PropertyMetadata, CategorySeries, 'raisePropertyChanged', ['CategoryCollisionMode:ze:aa9', [CategoryCollisionMode_$type, enumGetBox(CategoryCollisionMode_$type, 0)], 'IsCustomCategoryMarkerStyleAllowed:z4:aba', [0, false], 'IsCustomCategoryStyleAllowed:z5:abb', [0, false], 'IsTransitionInEnabled:z6:abc', [0, false], 'TransitionInMode:zq:abd', [CategoryTransitionInMode_$type, enumGetBox(CategoryTransitionInMode_$type, 0)], 'UseHighMarkerFidelity:aab:abe', [0, false]]);
    return CategorySeries;
}(MarkerSeries));
export { CategorySeries };
/**
 * @hidden
 */
var CategorySeriesView = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(CategorySeriesView, _super);
    function CategorySeriesView(a) {
        var _this = _super.call(this, a) || this;
        _this.db = null;
        _this.de = 0;
        _this.c9 = null;
        _this.dc = null;
        _this.de = -1;
        _this.db = a;
        _this.c9 = _this.da();
        _this.dc = ((function () {
            var $ret = new Pool$1(Marker.$);
            $ret.create = runOn(_this, _this.cg);
            $ret.activate = runOn(_this, _this.c1);
            $ret.disactivate = runOn(_this, _this.c3);
            $ret.destroy = runOn(_this, _this.c2);
            return $ret;
        })());
        return _this;
    }
    CategorySeriesView.prototype.dd = function (a) {
        if (this.de != a.z) {
            return true;
        }
        return false;
    };
    CategorySeriesView.prototype.dg = function (a) {
        this.de = a.z;
    };
    CategorySeriesView.prototype.updateMarkerTemplate = function (a, b, c) {
        if (!this.ch.x3) {
            var d = this.dc.item(a);
            var e = d.content;
            e.item = this.f.dp.item(b);
            d.ak = b;
            d.al = c;
        }
    };
    CategorySeriesView.prototype.da = function () {
        return new CategoryBucketCalculator(this);
    };
    Object.defineProperty(CategorySeriesView.prototype, "shouldDisplayMarkers", {
        get: function () {
            return this.db.x1();
        },
        enumerable: false,
        configurable: true
    });
    CategorySeriesView.prototype.updateMarkerCount = function (a) {
        this.dc.count = a;
    };
    CategorySeriesView.prototype.cw = function (a) {
        this.dc.c(a);
    };
    CategorySeriesView.prototype.df = function () {
    };
    CategorySeriesView.$t = markType(CategorySeriesView, 'CategorySeriesView', MarkerSeriesView.$, [ISupportsMarkers_$type]);
    return CategorySeriesView;
}(MarkerSeriesView));
export { CategorySeriesView };