/*
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-angular-core";
import { CategoryYAxis } from "./CategoryYAxis";
import { IVerticalAnchoredCategorySeriesInteractionManager_$type } from "./IVerticalAnchoredCategorySeriesInteractionManager";
import { DVContainer } from "igniteui-angular-core";
import { runOn, typeCast, EnumUtil, markType, markDep } from "igniteui-angular-core";
import { Axis } from "./Axis";
import { ScalerParams } from "./ScalerParams";
import { AxisRange } from "./AxisRange";
import { Rect } from "igniteui-angular-core";
import { TrendLineType_$type } from "igniteui-angular-core";
import { CategoryTrendLineManagerFactory } from "./CategoryTrendLineManagerFactory";
import { PropertyMetadata } from "igniteui-angular-core";
import { truncate, isNaN_, isInfinity } from "igniteui-angular-core";
/**
 * @hidden
 */
var VerticalAnchoredCategorySeries = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(VerticalAnchoredCategorySeries, _super);
    function VerticalAnchoredCategorySeries() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.acq = null;
        return _this;
    }
    VerticalAnchoredCategorySeries.prototype.cl = function () {
        if (this.xAxis != null && this.xAxis.df) {
            return 4;
        }
        return 3;
    };
    VerticalAnchoredCategorySeries.prototype.cm = function () {
        return 1;
    };
    VerticalAnchoredCategorySeries.prototype.o8 = function () {
        _super.prototype.o8.call(this);
        this.xAxis = null;
        this.yAxis = null;
    };
    Object.defineProperty(VerticalAnchoredCategorySeries.prototype, "acr", {
        get: function () {
            var _this = this;
            if (this.acq == null) {
                this.acq = DVContainer.instance.createInstance(IVerticalAnchoredCategorySeriesInteractionManager_$type, function () { return _this.ds.n; });
            }
            return this.acq;
        },
        enumerable: false,
        configurable: true
    });
    VerticalAnchoredCategorySeries.prototype.get_isVertical = function () {
        return true;
    };
    VerticalAnchoredCategorySeries.prototype.y2 = function () {
        return this.yAxis;
    };
    VerticalAnchoredCategorySeries.prototype.zj = function () {
        return this.xAxis;
    };
    VerticalAnchoredCategorySeries.prototype.getOffsetValue = function () {
        return this.y9.r(this.y2(), this.cw.ca, this.cw.b9, this.getEffectiveViewport1(this.cw));
    };
    VerticalAnchoredCategorySeries.prototype.getCategoryWidth = function () {
        return this.yAxis.getCategorySize(this.cw.ca, this.cw.b9, this.getEffectiveViewport1(this.cw));
    };
    VerticalAnchoredCategorySeries.prototype.kc = function (a, b) {
        return this.kd(a, b, this.y2(), runOn(this, this.z3), this.valueColumn);
    };
    VerticalAnchoredCategorySeries.prototype.ke = function (a, b) {
        return this.kf(a, b, this.y2(), runOn(this, this.z3), this.valueColumn);
    };
    VerticalAnchoredCategorySeries.prototype.ir = function (a, b, c, d, e) {
        if (this.valueColumn == null) {
            return Number.POSITIVE_INFINITY;
        }
        return this.is(a, b, this.yAxis, d, e, this.valueColumn.count, runOn(this, this.z3));
    };
    VerticalAnchoredCategorySeries.prototype.az = function (a) {
        if (a.isEmpty && this.dc != null) {
            a = this.dc.xm;
        }
        if (this.valueColumn == null) {
            return null;
        }
        var b = this.wt(this.cw);
        var c = this.y2();
        var d = new ScalerParams(0, a, this.dc.x4, c.df, this.getEffectiveViewport());
        var e = (c.fw(b.top, d));
        var f = (c.fw(b.bottom, d));
        if (!c.df) {
            var g = e;
            e = f;
            f = g;
        }
        e -= this.abn;
        f += this.abn;
        var h = null;
        if (c.dm) {
            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.zj(), a);
        return n;
    };
    VerticalAnchoredCategorySeries.prototype.b3 = function () {
        if (this.b4 == 0) {
            return 1;
        }
        else {
            return _super.prototype.b3.call(this);
        }
    };
    VerticalAnchoredCategorySeries.prototype.wz = function (a) {
        if (!this.hasMarkers || !this.xq()) {
            return Rect.empty;
        }
        return this.acr.e$b(this, this.y4.p, a, runOn(this, this.acz));
    };
    VerticalAnchoredCategorySeries.prototype.acz = function (a) {
        return this.aa7.ds(a);
    };
    VerticalAnchoredCategorySeries.prototype.gx = function (a, b) {
        if (this.gw(a, b)) {
            return true;
        }
        if (this.xr(a, b)) {
            return true;
        }
        return false;
    };
    VerticalAnchoredCategorySeries.prototype.i8 = function (a, b, c) {
        if (this.dc == null) {
            return NaN;
        }
        var d = this.getEffectiveViewport1(this.cw);
        var e = this.y2();
        var f = new ScalerParams(0, this.dc.xm, this.cw.b9, e.df, d);
        var g = this.y9.r(e, this.dc.xm, this.cw.b9, d);
        return this.ja(this.valueColumn, a, e, f, g, runOn(this, this.z3), b, c);
    };
    VerticalAnchoredCategorySeries.prototype.wm = function (a, b, c) {
        var d = this.y2();
        return this.wo(a, b, c, this.y9.r(d, this.cw.ca, this.cw.b9, this.getEffectiveViewport1(this.cw)), this.zj(), d, null, null, null);
    };
    VerticalAnchoredCategorySeries.prototype.fetchXAxis = function () {
        return this.xAxis;
    };
    VerticalAnchoredCategorySeries.prototype.fetchYAxis = function () {
        return this.yAxis;
    };
    VerticalAnchoredCategorySeries.prototype.ab3 = function (a) {
        this.xAxis = typeCast(NumericXAxis.$, a);
    };
    VerticalAnchoredCategorySeries.prototype.ab4 = function (a) {
        this.yAxis = typeCast(CategoryYAxis.$, a);
    };
    VerticalAnchoredCategorySeries.prototype.zz = function () {
        return this.xAxis != null && this.xAxis.d2();
    };
    VerticalAnchoredCategorySeries.prototype.yw = function (a, b) {
        return this.aa4(a, b, this.yAxis);
    };
    VerticalAnchoredCategorySeries.prototype.it = function (a) {
        return this.acr.e$a(this, a);
    };
    VerticalAnchoredCategorySeries.prototype.z3 = function (a) {
        return this.iv(a, this.y2());
    };
    VerticalAnchoredCategorySeries.prototype.j7 = function (a) {
        return truncate(Math.round(this.it(a)));
    };
    VerticalAnchoredCategorySeries.prototype.kr = function (a) {
        var b = this.j7(a);
        return b >= 0 && this.dp != null && b < this.dp.count ? this.dp.item(b) : null;
    };
    VerticalAnchoredCategorySeries.prototype.rg = function (a, b, c, d) {
        _super.prototype.rg.call(this, a, b, c, d);
        switch (b) {
            case VerticalAnchoredCategorySeries.$$p[0]:
                if (c != d) {
                    this.pi(typeCast(Axis.$, c));
                    this.ro(typeCast(Axis.$, d));
                    this.zd.c9.g(this.ie);
                    if (this.dc != null) {
                        this.dc.o0();
                    }
                    this.ry(false);
                    this.qr();
                }
                break;
            case VerticalAnchoredCategorySeries.$$p[1]:
                if (c != d) {
                    this.pi(typeCast(Axis.$, c));
                    this.ro(typeCast(Axis.$, d));
                    this.zd.c9.g(this.ie);
                    this.zz();
                    this.ry(false);
                    this.qr();
                }
                break;
            case "TrendLineType":
                var e = EnumUtil.getEnumValue(TrendLineType_$type, d);
                if (e != 0) {
                    this.aa7.dk = CategoryTrendLineManagerFactory.a(this.aa7.dk, this.yAxis, this.s3, this, this.ds);
                }
                break;
        }
    };
    VerticalAnchoredCategorySeries.prototype.acu = function (a) {
        if (typeCast(CategoryYAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    VerticalAnchoredCategorySeries.prototype.act = function (a) {
        if (typeCast(NumericXAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    Object.defineProperty(VerticalAnchoredCategorySeries.prototype, "useHighMarkerFidelity", {
        get: function () {
            return this.z0;
        },
        enumerable: false,
        configurable: true
    });
    VerticalAnchoredCategorySeries.$t = markType(VerticalAnchoredCategorySeries, 'VerticalAnchoredCategorySeries', AnchoredCategorySeries.$);
    VerticalAnchoredCategorySeries.$$p = markDep(DependencyProperty, PropertyMetadata, VerticalAnchoredCategorySeries, 'raisePropertyChanged', ['XAxis::acx', [NumericXAxis.$, null], 'YAxis::acy', [CategoryYAxis.$, null]]);
    return VerticalAnchoredCategorySeries;
}(AnchoredCategorySeries));
export { VerticalAnchoredCategorySeries };
