/*
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 { AnchoredCategorySeries } from "./AnchoredCategorySeries";
import { NumericXAxis } from "./NumericXAxis";
import { DependencyProperty } from "igniteui-react-core";
import { CategoryYAxis } from "./CategoryYAxis";
import { IVerticalAnchoredCategorySeriesInteractionManager_$type } from "./IVerticalAnchoredCategorySeriesInteractionManager";
import { DVContainer } from "igniteui-react-core";
import { runOn, typeCast, EnumUtil, markType, markDep } from "igniteui-react-core";
import { Axis } from "./Axis";
import { ScalerParams } from "./ScalerParams";
import { AxisRange } from "./AxisRange";
import { Rect } from "igniteui-react-core";
import { TrendLineType_$type } from "igniteui-react-core";
import { CategoryTrendLineManagerFactory } from "./CategoryTrendLineManagerFactory";
import { PropertyMetadata } from "igniteui-react-core";
import { truncate, isNaN_, isInfinity } from "igniteui-react-core";
/**
 * @hidden
 */
var VerticalAnchoredCategorySeries = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(VerticalAnchoredCategorySeries, _super);
    function VerticalAnchoredCategorySeries() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.abu = null;
        return _this;
    }
    VerticalAnchoredCategorySeries.prototype.ci = function () {
        if (this.xAxis != null && this.xAxis.ch) {
            return 4;
        }
        return 3;
    };
    VerticalAnchoredCategorySeries.prototype.cj = function () {
        return 1;
    };
    VerticalAnchoredCategorySeries.prototype.oz = function () {
        _super.prototype.oz.call(this);
        this.xAxis = null;
        this.yAxis = null;
    };
    Object.defineProperty(VerticalAnchoredCategorySeries.prototype, "abv", {
        get: function () {
            var _this = this;
            if (this.abu == null) {
                this.abu = DVContainer.instance.createInstance(IVerticalAnchoredCategorySeriesInteractionManager_$type, function () { return _this.dp.n; });
            }
            return this.abu;
        },
        enumerable: false,
        configurable: true
    });
    VerticalAnchoredCategorySeries.prototype.get_isVertical = function () {
        return true;
    };
    VerticalAnchoredCategorySeries.prototype.yj = function () {
        return this.yAxis;
    };
    VerticalAnchoredCategorySeries.prototype.yz = function () {
        return this.xAxis;
    };
    VerticalAnchoredCategorySeries.prototype.getOffsetValue = function () {
        return this.yp.r(this.yj(), this.ct.by, this.ct.bx, this.getEffectiveViewport1(this.ct));
    };
    VerticalAnchoredCategorySeries.prototype.getCategoryWidth = function () {
        return this.yAxis.getCategorySize(this.ct.by, this.ct.bx, this.getEffectiveViewport1(this.ct));
    };
    VerticalAnchoredCategorySeries.prototype.j6 = function (a, b) {
        return this.j7(a, b, this.yj(), runOn(this, this.zj), this.valueColumn);
    };
    VerticalAnchoredCategorySeries.prototype.j8 = function (a, b) {
        return this.j9(a, b, this.yj(), runOn(this, this.zj), this.valueColumn);
    };
    VerticalAnchoredCategorySeries.prototype.im = function (a, b, c, d, e) {
        if (this.valueColumn == null) {
            return Number.POSITIVE_INFINITY;
        }
        return this.io(a, b, this.yAxis, d, e, this.valueColumn.count, runOn(this, this.zj));
    };
    VerticalAnchoredCategorySeries.prototype.ay = function (a) {
        if (a.isEmpty && this.c9 != null) {
            a = this.c9.vl;
        }
        if (this.valueColumn == null) {
            return null;
        }
        var b = this.wc(this.ct);
        var c = this.yj();
        var d = new ScalerParams(0, a, this.c9.v0, c.ch, this.getEffectiveViewport());
        var e = (c.en(b.top, d));
        var f = (c.en(b.bottom, d));
        if (!c.ch) {
            var g = e;
            e = f;
            f = g;
        }
        e -= this.aar;
        f += this.aar;
        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.aw(n, this.yz(), a);
        return n;
    };
    VerticalAnchoredCategorySeries.prototype.b0 = function () {
        if (this.b1 == 0) {
            return 1;
        }
        else {
            return _super.prototype.b0.call(this);
        }
    };
    VerticalAnchoredCategorySeries.prototype.wi = function (a) {
        if (!this.hasMarkers || !this.w7()) {
            return Rect.empty;
        }
        return this.abv.e$b(this, this.yk.n, a, runOn(this, this.ab3));
    };
    VerticalAnchoredCategorySeries.prototype.ab3 = function (a) {
        return this.aad.de(a);
    };
    VerticalAnchoredCategorySeries.prototype.gu = function (a, b) {
        if (this.gt(a, b)) {
            return true;
        }
        if (this.w8(a, b)) {
            return true;
        }
        return false;
    };
    VerticalAnchoredCategorySeries.prototype.i3 = function (a, b, c) {
        if (this.c9 == null) {
            return NaN;
        }
        var d = this.getEffectiveViewport1(this.ct);
        var e = this.yj();
        var f = new ScalerParams(0, this.c9.vl, this.ct.bx, e.ch, d);
        var g = this.yp.r(e, this.c9.vl, this.ct.bx, d);
        return this.i5(this.valueColumn, a, e, f, g, runOn(this, this.zj), b, c);
    };
    VerticalAnchoredCategorySeries.prototype.v5 = function (a, b, c) {
        var d = this.yj();
        return this.v7(a, b, c, this.yp.r(d, this.ct.by, this.ct.bx, this.getEffectiveViewport1(this.ct)), this.yz(), d, null, null, null);
    };
    VerticalAnchoredCategorySeries.prototype.fetchXAxis = function () {
        return this.xAxis;
    };
    VerticalAnchoredCategorySeries.prototype.fetchYAxis = function () {
        return this.yAxis;
    };
    VerticalAnchoredCategorySeries.prototype.aa7 = function (a) {
        this.xAxis = typeCast(NumericXAxis.$, a);
    };
    VerticalAnchoredCategorySeries.prototype.aa8 = function (a) {
        this.yAxis = typeCast(CategoryYAxis.$, a);
    };
    VerticalAnchoredCategorySeries.prototype.zf = function () {
        return this.xAxis != null && this.xAxis.c1();
    };
    VerticalAnchoredCategorySeries.prototype.yd = function (a, b) {
        return this.aaa(a, b, this.yAxis);
    };
    VerticalAnchoredCategorySeries.prototype.ip = function (a) {
        return this.abv.e$a(this, a);
    };
    VerticalAnchoredCategorySeries.prototype.zj = function (a) {
        return this.ir(a, this.yj());
    };
    VerticalAnchoredCategorySeries.prototype.j1 = function (a) {
        return truncate(Math.round(this.ip(a)));
    };
    VerticalAnchoredCategorySeries.prototype.kl = function (a) {
        var b = this.j1(a);
        return b >= 0 && this.dl != null && b < this.dl.count ? this.dl.item(b) : null;
    };
    VerticalAnchoredCategorySeries.prototype.q4 = function (a, b, c, d) {
        _super.prototype.q4.call(this, a, b, c, d);
        switch (b) {
            case VerticalAnchoredCategorySeries.$$p[0]:
                if (c != d) {
                    this.o9(typeCast(Axis.$, c));
                    this.rc(typeCast(Axis.$, d));
                    this.yt.cw.g(this.ib);
                    if (this.c9 != null) {
                        this.c9.nq();
                    }
                    this.rm(false);
                    this.qg();
                }
                break;
            case VerticalAnchoredCategorySeries.$$p[1]:
                if (c != d) {
                    this.o9(typeCast(Axis.$, c));
                    this.rc(typeCast(Axis.$, d));
                    this.yt.cw.g(this.ib);
                    this.zf();
                    this.rm(false);
                    this.qg();
                }
                break;
            case "TrendLineType":
                var e = EnumUtil.getEnumValue(TrendLineType_$type, d);
                if (e != 0) {
                    this.aad.c7 = CategoryTrendLineManagerFactory.a(this.aad.c7, this.yAxis, this.so, this, this.dp);
                }
                break;
        }
    };
    VerticalAnchoredCategorySeries.prototype.aby = function (a) {
        if (typeCast(CategoryYAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    VerticalAnchoredCategorySeries.prototype.abx = function (a) {
        if (typeCast(NumericXAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    Object.defineProperty(VerticalAnchoredCategorySeries.prototype, "useHighMarkerFidelity", {
        get: function () {
            return this.zg;
        },
        enumerable: false,
        configurable: true
    });
    VerticalAnchoredCategorySeries.$t = markType(VerticalAnchoredCategorySeries, 'VerticalAnchoredCategorySeries', AnchoredCategorySeries.$);
    VerticalAnchoredCategorySeries.$$p = markDep(DependencyProperty, PropertyMetadata, VerticalAnchoredCategorySeries, 'raisePropertyChanged', ['XAxis::ab1', [NumericXAxis.$, null], 'YAxis::ab2', [CategoryYAxis.$, null]]);
    return VerticalAnchoredCategorySeries;
}(AnchoredCategorySeries));
export { VerticalAnchoredCategorySeries };
