/*
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 { CategorySeries } from "./CategorySeries";
import { IIsCategoryBased_$type } from "./IIsCategoryBased";
import { IHasSingleValueCategory_$type } from "./IHasSingleValueCategory";
import { IHasCategoryTrendline_$type } from "./IHasCategoryTrendline";
import { ITrendLineSeries_$type } from "./ITrendLineSeries";
import { IAnchoredCategorySeriesInteractionManager_$type } from "./IAnchoredCategorySeriesInteractionManager";
import { DVContainer } from "igniteui-angular-core";
import { Point_$type, enumGetBox, typeCast, runOn, delegateCombine, markType, markDep } from "igniteui-angular-core";
import { DependencyProperty } from "igniteui-angular-core";
import { Series } from "./Series";
import { TrendLineType_$type } from "igniteui-angular-core";
import { Brush } from "igniteui-angular-core";
import { PenLineCap_$type } from "igniteui-angular-core";
import { DoubleCollection } from "igniteui-angular-core";
import { CategoryFrame } from "./CategoryFrame";
import { ICategoryScaler_$type } from "./ICategoryScaler";
import { IScaler_$type } from "./IScaler";
import { CategorySeriesView } from "./CategorySeriesView";
import { CategorySeriesMarkerCollisionAvoidance_$type } from "./CategorySeriesMarkerCollisionAvoidance";
import { ConsolidatedItemHitTestBehavior_$type } from "./ConsolidatedItemHitTestBehavior";
import { CategoryFramePreparer } from "./CategoryFramePreparer";
import { DataLegendSeriesValueInfo } from "igniteui-angular-core";
import { DataLegendSeriesContext } from "igniteui-angular-core";
import { List$1 } from "igniteui-angular-core";
import { Rect } from "igniteui-angular-core";
import { ISortingAxis_$type } from "./ISortingAxis";
import { IFastItemsSource_$type } from "igniteui-angular-core";
import { NumericAxisBase } from "./NumericAxisBase";
import { CategoryBucketCalculator } from "./CategoryBucketCalculator";
import { AxisRange } from "./AxisRange";
import { NumericYAxis } from "./NumericYAxis";
import { ScalerParams } from "./ScalerParams";
import { SeriesLayerPropertyOverlay } from "./SeriesLayerPropertyOverlay";
import { CategoryMarkerManager } from "./CategoryMarkerManager";
import { CollisionAvoider } from "./CollisionAvoider";
import { NonCollisionAvoider } from "./NonCollisionAvoider";
import { CategoryAxisBase } from "./CategoryAxisBase";
import { ChartSelection } from "./ChartSelection";
import { PropertyMetadata } from "igniteui-angular-core";
import { truncate, isNaN_, isInfinity } from "igniteui-angular-core";
import { CategoryTrendLineManagerFactory } from "./CategoryTrendLineManagerFactory";
/**
 * @hidden
 */
var AnchoredCategorySeries = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(AnchoredCategorySeries, _super);
    function AnchoredCategorySeries() {
        var _this = _super.call(this) || this;
        _this.aaz = null;
        _this.aa6 = false;
        _this.aa1 = null;
        _this.aaw = null;
        _this.abd = null;
        _this.abc = null;
        _this.aa3 = true;
        _this.aa7 = 0;
        _this.aa8 = 0;
        _this.yz = new CategoryFramePreparer(1, _this, _this.y3, _this, _this, _this.y3.cw);
        return _this;
    }
    Object.defineProperty(AnchoredCategorySeries.prototype, "aa0", {
        get: function () {
            var _this = this;
            if (this.aaz == null) {
                this.aaz = DVContainer.instance.createInstance(IAnchoredCategorySeriesInteractionManager_$type, function () { return _this.dr.n; });
            }
            return this.aaz;
        },
        enumerable: false,
        configurable: true
    });
    AnchoredCategorySeries.prototype.getHostReferenceValue = function () {
        return this.iy();
    };
    AnchoredCategorySeries.prototype.me = function () {
        return AnchoredCategorySeries.$$p[5];
    };
    AnchoredCategorySeries.prototype.cs = function () {
        var a = new AnchoredCategorySeriesView(this);
        return a;
    };
    AnchoredCategorySeries.prototype.q1 = function (a) {
        _super.prototype.q1.call(this, a);
        this.aav = a;
    };
    AnchoredCategorySeries.prototype.kq = function (a, b) {
        var c = this.nd(b);
        if (c == AnchoredCategorySeries.$$p[5]) {
            return this.kr(a, b, this.abn);
        }
        if (c == AnchoredCategorySeries.$$p[1]) {
            return this.kr(a, b, this.abf);
        }
        return _super.prototype.kq.call(this, a, b);
    };
    AnchoredCategorySeries.prototype.md = function (a) {
        var b = this.nd(a);
        if (b == AnchoredCategorySeries.$$p[5]) {
            return this.abn;
        }
        if (b == AnchoredCategorySeries.$$p[1]) {
            return this.abf;
        }
        return _super.prototype.md.call(this, a);
    };
    Object.defineProperty(AnchoredCategorySeries.prototype, "valueColumn", {
        get: function () {
            return this.aa1;
        },
        set: function (a) {
            if (this.aa1 != a) {
                var b = this.aa1;
                this.aa1 = a;
                if (!this.aa6) {
                    this.raisePropertyChanged("ValueColumn", b, this.aa1);
                }
            }
        },
        enumerable: false,
        configurable: true
    });
    AnchoredCategorySeries.prototype.getDataLegendSeriesContextAt = function (a, b) {
        var c = new DataLegendSeriesValueInfo();
        c.a = 0;
        c.l = this.i5({ $type: Point_$type, x: a, y: b }, false, false);
        c.r = this.abn != null ? this.abn : "Value";
        c.q = "Value";
        c.s = this.abj != null ? this.abj : "V:";
        c.t = this.abl != null ? this.abl : "";
        var d = new DataLegendSeriesContext();
        d.e = ((function () {
            var $ret = new List$1(DataLegendSeriesValueInfo.$, 0);
            $ret.add(c);
            return $ret;
        })());
        d.h = this.mc();
        return d;
    };
    Object.defineProperty(AnchoredCategorySeries.prototype, "aca", {
        get: function () {
            return this.c(AnchoredCategorySeries.abw);
        },
        set: function (a) {
            this.h(AnchoredCategorySeries.abw, a);
        },
        enumerable: false,
        configurable: true
    });
    AnchoredCategorySeries.prototype.gd = function (a) {
        var b = new Rect(0, 0, 0, 1, 1);
        var c = this.fetchXAxis();
        var d = this.fetchYAxis();
        var e = this.wl(this.cv);
        var f = c != null ? this.yz.r(typeCast(ICategoryScaler_$type, c), b, b, e) : 0;
        return this.aa0.c$a(this, this.valueColumn, c, d, f, a);
    };
    AnchoredCategorySeries.prototype.aas = function (a, b, c) {
        if (b < a || a < 0 || a > this.valueColumn.count || b < 0 || b > this.valueColumn.count || c == null) {
            return null;
        }
        var d = new Array((b - a) + 1);
        var e = c.cn;
        var f = null;
        if (e) {
            f = c.i$b;
        }
        for (var g = a; g <= b; g++) {
            var h = g;
            if (e) {
                h = f._inner[h];
            }
            d[g - a] = this.dn.item(g);
        }
        return d;
    };
    AnchoredCategorySeries.prototype.q9 = function (a, b, c, d) {
        _super.prototype.q9.call(this, a, b, c, d);
        if (this.aav.c8 && this.aav.c7.g$b(a, b, c, d)) {
            var e = false;
            if (b == "FastItemsSource") {
                e = this.gg && c != null;
            }
            this.rr(e);
            this.ql();
        }
        switch (b) {
            case AnchoredCategorySeries.$$p[3]:
            case AnchoredCategorySeries.$$p[4]:
                this.qf();
                break;
            case "FastItemsSource":
                if (typeCast(IFastItemsSource_$type, c) != null) {
                    c.deregisterColumn(this.valueColumn);
                    this.valueColumn = null;
                }
                if (typeCast(IFastItemsSource_$type, d) != null) {
                    this.valueColumn = this.dk(this.abn);
                }
                var f = typeCast(NumericAxisBase.$, this.fetchYAxis());
                if (f != null && !f.c1()) {
                    this.aav.cw.g(this.id);
                    this.rr(this.gg && c != null);
                }
                break;
            case AnchoredCategorySeries.$$p[5]:
                if (this.dn != null) {
                    this.dn.deregisterColumn(this.valueColumn);
                    this.valueColumn = this.dk(this.abn);
                }
                this.abd = this.abn;
                break;
            case AnchoredCategorySeries.$$p[1]:
                this.abc = this.abf;
                this.rr(true);
                break;
            case "ValueColumn":
                if (this.aav.c8) {
                    this.aav.c7.g$i();
                }
                var g = typeCast(NumericAxisBase.$, this.fetchYAxis());
                if (g != null && !g.c1()) {
                    this.aav.cw.g(this.id);
                    this.rr(this.gg && this.d7);
                }
                this.abv();
                this.sn();
                break;
            case "TrendLineBrush":
                this.rf(b);
                break;
            case "ErrorBarSettings":
                this.rr(false);
                break;
            case "TrendLineType":
                this.ql();
                break;
            case AnchoredCategorySeries.$$p[2]:
                this.rr(false);
                break;
        }
    };
    AnchoredCategorySeries.prototype.ay = function (a) {
        if (this.valueColumn == null || this.valueColumn.count == 0) {
            return null;
        }
        if (a == this.fetchXAxis()) {
            return new AxisRange(0, this.valueColumn.count - 1);
        }
        if (a == this.fetchYAxis()) {
            return new AxisRange(this.valueColumn.minimum, this.valueColumn.maximum);
        }
        return null;
    };
    AnchoredCategorySeries.prototype.pb = function (a, b, c, d) {
        switch (a) {
            case 4:
            case 1:
            case 0:
                this.aav.cw.g(this.id);
                break;
        }
        if (this.aav.c8) {
            this.aav.c7.g$e(a, b, c, d);
        }
        this.abv();
        this.sn();
        if (a == 0 || a == 2 || a == 3 || a == 4) {
            this.aa3 = true;
        }
        else if (a == 1) {
            for (var e = b; e < b + c; e++) {
                this.aa7 += this.valueColumn.item(e);
            }
            this.aa8 = this.aa7 / this.valueColumn.count;
        }
    };
    AnchoredCategorySeries.prototype.zu = function () {
        return this.aa9(this.y3);
    };
    AnchoredCategorySeries.prototype.aa9 = function (a) {
        var b = 0;
        var c = a.by;
        var d = a.bx;
        var e = this.getEffectiveViewport1(a);
        var f = typeCast(NumericYAxis.$, this.fetchYAxis());
        if (!c.isEmpty && !d.isEmpty && f != null) {
            var g = new ScalerParams(0, c, d, f.ch, e);
            if (f.cp) {
                g.b = this.iy();
            }
            b = f.el(f.me, g);
        }
        return b;
    };
    AnchoredCategorySeries.prototype.abt = function (a, b, c) {
        var d = this.aa9(c);
        if (a.count > 0) {
            var e = d;
            a.add({ $type: Point_$type, x: a._inner[a.count - 1].x, y: e });
            a.add({ $type: Point_$type, x: a._inner[0].x, y: e });
        }
    };
    AnchoredCategorySeries.prototype.aat = function (a, b, c, d) {
        return this.aau(a, b, c, d, false);
    };
    AnchoredCategorySeries.prototype.aau = function (a, b, c, d, e) {
        return CategorySeries.yn(a, b, c, d, e);
    };
    AnchoredCategorySeries.prototype.gb = function () {
        return this.highlightedItemsSource != null || this.abf != null;
    };
    AnchoredCategorySeries.prototype.ht = function () {
        var a = _super.prototype.ht.call(this);
        {
            var b = ((function () {
                var $ret = new SeriesLayerPropertyOverlay();
                $ret.ad = "ValueMemberPath";
                $ret.p = true;
                $ret.y = "HighlightedValueMemberPath";
                $ret.q = true;
                return $ret;
            })());
            b.valueResolving = delegateCombine(b.valueResolving, runOn(this, this.abp));
            a.add(b);
        }
        return a;
    };
    AnchoredCategorySeries.prototype.abp = function (a, b) {
        if (this.abf != null) {
            b.value = this.abf;
            return;
        }
        b.value = this.abn;
    };
    AnchoredCategorySeries.prototype.he = function (a, b, c) {
        var d = _super.prototype.he.call(this, a, b, c);
        var e = c;
        if (this.valueColumn == null || this.valueColumn.count == 0 || e.cw.d < 1) {
            d = false;
        }
        return d;
    };
    AnchoredCategorySeries.prototype.o5 = function (a, b) {
        _super.prototype.o5.call(this, a, b);
        var c = b;
        c.c2();
        if (c.c8) {
            c.c7.g$d();
        }
    };
    AnchoredCategorySeries.prototype.aah = function (a, b) {
        _super.prototype.aah.call(this, a, b);
        this.y0(b).d(a, b);
    };
    AnchoredCategorySeries.prototype.aak = function (a, b) {
        _super.prototype.aak.call(this, a, b);
        var c = typeCast(AnchoredCategorySeriesView.$, b);
        c.b7 = true;
        if (c.c8) {
            c.c7.g$g(a.q);
        }
        if (this.xg()) {
            CategoryMarkerManager.e(this, a.n, b.cz, this.xi);
            this.z9(b, a);
            b.cr();
        }
        this.abq(a, b);
    };
    AnchoredCategorySeries.prototype.rq = function (a, b, c, d, e) {
        _super.prototype.rq.call(this, a, b, c, d, e);
        var f = this.ba.a$j.item(d);
        var g = f;
        g.cw.g(this.id);
        f.a3(c);
        if (this.d5(g)) {
            return;
        }
        if (this.aaw == null) {
            this.aaw = new CategoryFrame(3);
        }
        this.aaw.v();
        this.aah(this.aaw, g);
        this.aak(this.aaw, g);
    };
    AnchoredCategorySeries.prototype.abq = function (a, b) {
    };
    AnchoredCategorySeries.prototype.sh = function () {
        _super.prototype.sh.call(this);
        if (this.index < 0) {
            return;
        }
        this.aav.dc();
        if (this.trendLineBrush != null) {
            this.aav.da();
        }
        else {
            this.aav.c9();
        }
    };
    AnchoredCategorySeries.prototype.kx = function (a, b) {
        if (this.aav.c8 && a == this.aav.c7.g$j) {
            return null;
        }
        return _super.prototype.kx.call(this, a, b);
    };
    Object.defineProperty(AnchoredCategorySeries.prototype, "currentCategoryMode", {
        get: function () {
            return this.preferredCategoryMode(typeCast(CategoryAxisBase.$, this.ys()));
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(AnchoredCategorySeries.prototype, "scaler", {
        get: function () {
            return typeCast(ICategoryScaler_$type, this.ys());
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(AnchoredCategorySeries.prototype, "yScaler", {
        get: function () {
            return typeCast(IScaler_$type, this.y9());
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(AnchoredCategorySeries.prototype, "bucketizer", {
        get: function () {
            return this.aav.cw;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(AnchoredCategorySeries.prototype, "currentMode2Index", {
        get: function () {
            return this.zy();
        },
        enumerable: false,
        configurable: true
    });
    AnchoredCategorySeries.prototype.provideCollisionDetector = function () {
        if (this.aax == 1) {
            return new CollisionAvoider();
        }
        return NonCollisionAvoider.b;
    };
    Object.defineProperty(AnchoredCategorySeries.prototype, "trendlinePreparer", {
        get: function () {
            return this.aav.c8 ? this.aav.c7 : null;
        },
        enumerable: false,
        configurable: true
    });
    AnchoredCategorySeries.prototype.pz = function (a) {
        _super.prototype.pz.call(this, a);
        if (this.aav.c8) {
            this.bc.exportTrendlineData(this, a, this.aav.c7.g$j);
        }
    };
    AnchoredCategorySeries.prototype.kn = function (a) {
        var _this = this;
        var b = this.fetchXAxis();
        var c = this.fetchYAxis();
        return this.aa0.c$b(this, a, this.zv(this.cv), this.valueColumn, b, c, this.aay == 1, function (d) { return _super.prototype.kn.call(_this, d); });
    };
    Object.defineProperty(AnchoredCategorySeries.prototype, "mayContainUnknowns", {
        get: function () {
            return this.valueColumn == null || this.valueColumn.mayContainUnknowns;
        },
        enumerable: false,
        configurable: true
    });
    AnchoredCategorySeries.prototype.iy = function () {
        return Series.iz(this.valueColumn, typeCast(ISortingAxis_$type, this.fetchXAxis()));
    };
    AnchoredCategorySeries.prototype.get_abb = function () {
        return 0;
    };
    Object.defineProperty(AnchoredCategorySeries.prototype, "abb", {
        get: function () {
            return this.get_abb();
        },
        enumerable: false,
        configurable: true
    });
    AnchoredCategorySeries.prototype.az = function (a) {
        if (a.isEmpty && this.db != null) {
            a = this.db.v4;
        }
        if (this.valueColumn == null) {
            return null;
        }
        var b = this.wj(this.cv);
        var c = this.ys();
        var d = new ScalerParams(0, a, this.db.wk, c.ch, this.getEffectiveViewport());
        var e = (c.eo(b.left, d));
        var f = (c.eo(b.right, d));
        if (c.ch) {
            var g = e;
            e = f;
            f = g;
        }
        e -= this.abb;
        f += this.abb;
        var h = null;
        if (c.cn) {
            h = c;
            e = h.i$f(e);
            f = h.i$f(f);
        }
        else {
            e = Math.floor(e);
            f = Math.ceil(f);
        }
        if (isNaN_(e) || isNaN_(f)) {
            return null;
        }
        e = Math.max(0, Math.min(this.valueColumn.count - 1, e));
        f = Math.max(0, Math.min(this.valueColumn.count - 1, f));
        var i = 1.7976931348623157E+308;
        var j = -1.7976931348623157E+308;
        if (truncate(e) <= truncate(f)) {
            for (var k = truncate(e); k <= truncate(f); k++) {
                var l = k;
                if (h != null) {
                    l = h.i$b._inner[k];
                }
                var m = this.valueColumn.item(l);
                if (this.valueColumn.mayContainUnknowns) {
                    if (isInfinity(m) || isNaN_(m)) {
                        continue;
                    }
                }
                i = Math.min(i, m);
                j = Math.max(j, m);
            }
        }
        var n = new AxisRange(i, j);
        n = this.ax(n, this.y9(), a);
        return n;
    };
    AnchoredCategorySeries.prototype.abv = function () {
        this.im = this.valueColumn == null || this.valueColumn.count == 0 ? NaN : this.valueColumn.item(this.valueColumn.count - 1);
    };
    AnchoredCategorySeries.prototype.abu = function () {
        if (this.aa3) {
            this.aa7 = 0;
            for (var a = 0; a < this.valueColumn.count; a++) {
                this.aa7 += this.valueColumn.item(a);
            }
            this.aa8 = this.aa7 / this.valueColumn.count;
            this.aa3 = false;
        }
    };
    AnchoredCategorySeries.prototype.i8 = function (a, b) {
        if (b == null || !b.cj) {
            return NaN;
        }
        var c = this.y9();
        if (b != c) {
            return NaN;
        }
        var d = this.aq(a);
        if (c.cp) {
            return d[1];
        }
        else {
            return d[0];
        }
    };
    AnchoredCategorySeries.prototype.aq = function (a) {
        var b = NaN;
        switch (a) {
            case 5:
            case 2:
                b = this.valueColumn.maximum;
                break;
            case 4:
            case 1:
                b = this.valueColumn.minimum;
                break;
            case 6:
            case 3:
                if (this.aa3) {
                    this.abu();
                }
                b = this.aa8;
                break;
        }
        var c = this.y9();
        if (c.cp) {
            return [NaN, b];
        }
        else {
            return [b, NaN];
        }
    };
    AnchoredCategorySeries.prototype.wf = function (a) {
        var b = NaN;
        switch (a) {
            case 5:
            case 2:
                b = this.valueColumn.maximum;
                break;
            case 4:
            case 1:
                b = this.valueColumn.minimum;
                break;
            case 6:
            case 3:
                if (this.aa3) {
                    this.abu();
                }
                b = this.aa8;
                break;
        }
        if (isNaN_(b)) {
            return { $type: Point_$type, x: NaN, y: NaN };
        }
        var c = this.y9();
        var d = this.getEffectiveViewport1(this.cv);
        var e = new ScalerParams(0, this.cv.by, this.cv.bx, c.ch, d);
        if (c.cp) {
            e.b = this.iy();
        }
        e.c = d;
        if (c.cp) {
            return { $type: Point_$type, x: NaN, y: c.el(b, e) };
        }
        else {
            return { $type: Point_$type, x: c.el(b, e), y: NaN };
        }
    };
    AnchoredCategorySeries.prototype.wg = function (a) {
        var b = this.y9();
        var c = this.getEffectiveViewport1(this.cv);
        var d = new ScalerParams(0, this.cv.by, this.cv.bx, b.ch, c);
        if (b.cp) {
            d.b = this.iy();
        }
        d.c = c;
        if (b.cp) {
            return { $type: Point_$type, x: NaN, y: b.el(a[1], d) };
        }
        else {
            return { $type: Point_$type, x: b.el(a[0], d), y: NaN };
        }
    };
    AnchoredCategorySeries.prototype.aad = function (a, b, c, d, e, f, g) {
        var _this = this;
        if (c < 0 || d < 0) {
            return;
        }
        for (var h = c; h <= d; h++) {
            if (a == 1) {
                if (this.aa4(e, f, h)) {
                    if (g == 7 || g == 6) {
                        b.add(((function () {
                            var $ret = new ChartSelection();
                            $ret.series = _this;
                            return $ret;
                        })()));
                        return;
                    }
                    this.z7(b, h, g);
                }
            }
            else {
                if (this.aa5(e, f, h)) {
                    if (g == 7 || g == 6) {
                        b.add(((function () {
                            var $ret = new ChartSelection();
                            $ret.series = _this;
                            return $ret;
                        })()));
                        return;
                    }
                    this.z7(b, h, g);
                }
            }
        }
    };
    AnchoredCategorySeries.prototype.aa5 = function (a, b, c) {
        return this.valueColumn.item(c) < b && a < this.valueColumn.item(c);
    };
    AnchoredCategorySeries.prototype.aa4 = function (a, b, c) {
        return 0 < b && a < this.valueColumn.item(c);
    };
    AnchoredCategorySeries.prototype.z7 = function (a, b, c) {
        var _this = this;
        if (c == 2 || c == 1) {
            a.add(((function () {
                var $ret = new ChartSelection();
                $ret.item = _this.dn.item(b);
                return $ret;
            })()));
        }
        else {
            a.add(((function () {
                var $ret = new ChartSelection();
                $ret.item = _this.dn.item(b);
                $ret.series = _this;
                return $ret;
            })()));
        }
    };
    Object.defineProperty(AnchoredCategorySeries.prototype, "useHighMarkerFidelity", {
        get: function () {
            return this.zq;
        },
        enumerable: false,
        configurable: true
    });
    AnchoredCategorySeries.$t = markType(AnchoredCategorySeries, 'AnchoredCategorySeries', CategorySeries.$, [IIsCategoryBased_$type, IHasSingleValueCategory_$type, IHasCategoryTrendline_$type, ITrendLineSeries_$type]);
    AnchoredCategorySeries.abw = DependencyProperty.i("ActualTrendLineBrush", Brush.$, AnchoredCategorySeries.$, new PropertyMetadata(2, null, function (a, b) { return a.raisePropertyChanged("ActualTrendLineBrush", b.oldValue, b.newValue); }));
    AnchoredCategorySeries.$$p = markDep(DependencyProperty, PropertyMetadata, AnchoredCategorySeries, 'raisePropertyChanged', ['ConsolidatedItemHitTestBehavior:aay:abx', [ConsolidatedItemHitTestBehavior_$type, enumGetBox(ConsolidatedItemHitTestBehavior_$type, 0)], 'HighlightedValueMemberPath:abf:aby', [2, null], 'MarkerCollisionAvoidance:aax:abz', [CategorySeriesMarkerCollisionAvoidance_$type, enumGetBox(CategorySeriesMarkerCollisionAvoidance_$type, 1)], 'ValueMemberAsLegendLabel:abj:ab7', [2, null], 'ValueMemberAsLegendUnit:abl:ab8', [2, null], 'ValueMemberPath:abn:ab9', [2, null], 'TrendLineType::ab5', [TrendLineType_$type, enumGetBox(TrendLineType_$type, 0)], 'TrendLineThickness::ab4', [1, 1.5], 'TrendLinePeriod::ab3', [1, 7], 'TrendLineBrush::ab0', [Brush.$, null], 'TrendLineZIndex:aba:ab6', [1, 1001], 'TrendLineDashArray:acb:ab1', [DoubleCollection.$], 'TrendLineDashCap:acc:ab2', [PenLineCap_$type, enumGetBox(PenLineCap_$type, 0)]]);
    return AnchoredCategorySeries;
}(CategorySeries));
export { AnchoredCategorySeries };
/**
 * @hidden
 */
var AnchoredCategoryBucketCalculator = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(AnchoredCategoryBucketCalculator, _super);
    function AnchoredCategoryBucketCalculator(a) {
        var _this = _super.call(this, a) || this;
        _this.i = null;
        _this.h = null;
        _this.j = 0;
        _this.i = a;
        return _this;
    }
    AnchoredCategoryBucketCalculator.prototype.getBucketWithoutUnknowns = function (a) {
        var b = this.h;
        var c = this.j;
        var d = a * this.d;
        var e = d + this.d - 1;
        var f = c - 1;
        d = d < f ? d : f;
        e = e < f ? e : f;
        var g = 1.7976931348623157E+308;
        var h = -1.7976931348623157E+308;
        var i = true;
        for (var j = d; j <= e; ++j) {
            var k = b[j];
            g = g < k ? g : k;
            h = h > k ? h : k;
            i = false;
        }
        if (!i) {
            return [0.5 * (d + e), g, h];
        }
        return [0.5 * (d + e), NaN, NaN];
    };
    AnchoredCategoryBucketCalculator.prototype.getBucket = function (a) {
        var b = this.h;
        var c = this.j;
        var d = a * this.d;
        var e = d + this.d - 1;
        var f = c - 1;
        d = d < f ? d : f;
        e = e < f ? e : f;
        var g = 0;
        var h = 0;
        var i = true;
        for (var j = d; j <= e; ++j) {
            var k = b[j];
            if (!i) {
                if (!isNaN_(k)) {
                    g = g < k ? g : k;
                    h = h > k ? h : k;
                }
            }
            else {
                if (!isNaN_(k)) {
                    g = k;
                    h = k;
                    i = false;
                }
            }
        }
        if (!i) {
            return [0.5 * (d + e), g, h];
        }
        return [0.5 * (d + e), NaN, NaN];
    };
    AnchoredCategoryBucketCalculator.prototype.cacheValues = function () {
        this.j = this.i.c5.valueColumn.count;
        this.h = this.i.c5.valueColumn.asArray();
    };
    AnchoredCategoryBucketCalculator.prototype.unCacheValues = function () {
        this.h = null;
    };
    AnchoredCategoryBucketCalculator.$t = markType(AnchoredCategoryBucketCalculator, 'AnchoredCategoryBucketCalculator', CategoryBucketCalculator.$);
    return AnchoredCategoryBucketCalculator;
}(CategoryBucketCalculator));
export { AnchoredCategoryBucketCalculator };
/**
 * @hidden
 */
var AnchoredCategorySeriesView = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(AnchoredCategorySeriesView, _super);
    function AnchoredCategorySeriesView(a) {
        var _this = _super.call(this, a) || this;
        _this.c5 = null;
        _this.c6 = null;
        _this.c5 = a;
        return _this;
    }
    Object.defineProperty(AnchoredCategorySeriesView.prototype, "c7", {
        get: function () {
            if (this.c6 == null) {
                this.c6 = CategoryTrendLineManagerFactory.a(this.c6, this.e.a0(), this.e.sv, this.e, this.e.dr);
            }
            return this.c6;
        },
        set: function (a) {
            this.c6 = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(AnchoredCategorySeriesView.prototype, "c8", {
        get: function () {
            return this.c6 != null;
        },
        enumerable: false,
        configurable: true
    });
    AnchoredCategorySeriesView.prototype.dc = function () {
        this.c5.aca = null;
    };
    AnchoredCategorySeriesView.prototype.da = function () {
        this.c5.aca = this.c5.trendLineBrush;
    };
    AnchoredCategorySeriesView.prototype.c9 = function () {
        this.c5.aca = this.c5.u9;
    };
    AnchoredCategorySeriesView.prototype.cx = function () {
        return new AnchoredCategoryBucketCalculator(this);
    };
    AnchoredCategorySeriesView.prototype.db = function () {
        this.cw.cacheValues();
    };
    AnchoredCategorySeriesView.prototype.dd = function () {
        this.cw.unCacheValues();
    };
    AnchoredCategorySeriesView.prototype.de = function (a) {
        var b = this.cz.item(a);
        return this.cu(b);
    };
    AnchoredCategorySeriesView.prototype.a7 = function (a, b) {
        if (a.d) {
            if (this.c5.trendLineType != 0 && !b) {
                var c = this.c7.g$j;
                c.ad = this.c5.trendLineThickness;
                c._stroke = this.c5.aca;
                c.ai = this.c5.acb;
                c.aj = this.c5.acc;
                a.v(c);
            }
        }
        _super.prototype.a7.call(this, a, b);
    };
    AnchoredCategorySeriesView.prototype.getDefaultTooltipTemplate = function () {
        return this.c5.aa0.c$c(this.e, this.c5.abn);
    };
    AnchoredCategorySeriesView.$t = markType(AnchoredCategorySeriesView, 'AnchoredCategorySeriesView', CategorySeriesView.$);
    return AnchoredCategorySeriesView;
}(CategorySeriesView));
export { AnchoredCategorySeriesView };
