/*
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.u1 = null;
        return _this;
    }
    VerticalAnchoredCategorySeries.prototype.bw = function () {
        if (this.xAxis != null && this.xAxis.cg) {
            return 4;
        }
        return 3;
    };
    VerticalAnchoredCategorySeries.prototype.bx = function () {
        return 1;
    };
    VerticalAnchoredCategorySeries.prototype.kz = function () {
        _super.prototype.kz.call(this);
        this.xAxis = null;
        this.yAxis = null;
    };
    Object.defineProperty(VerticalAnchoredCategorySeries.prototype, "u2", {
        get: function () {
            var _this = this;
            if (this.u1 == null) {
                this.u1 = DVContainer.instance.createInstance(IVerticalAnchoredCategorySeriesInteractionManager_$type, function () { return _this.co.n; });
            }
            return this.u1;
        },
        enumerable: false,
        configurable: true
    });
    VerticalAnchoredCategorySeries.prototype.get_isVertical = function () {
        return true;
    };
    VerticalAnchoredCategorySeries.prototype.rw = function () {
        return this.yAxis;
    };
    VerticalAnchoredCategorySeries.prototype.sh = function () {
        return this.xAxis;
    };
    VerticalAnchoredCategorySeries.prototype.getOffsetValue = function () {
        return this.r2.r(this.rw(), this.b1.bv, this.b1.bu, this.getEffectiveViewport1(this.b1));
    };
    VerticalAnchoredCategorySeries.prototype.getCategoryWidth = function () {
        return this.yAxis.getCategorySize(this.b1.bv, this.b1.bu, this.getEffectiveViewport1(this.b1));
    };
    VerticalAnchoredCategorySeries.prototype.hm = function (a, b) {
        return this.hn(a, b, this.rw(), runOn(this, this.sv), this.valueColumn);
    };
    VerticalAnchoredCategorySeries.prototype.ho = function (a, b) {
        return this.hp(a, b, this.rw(), runOn(this, this.sv), this.valueColumn);
    };
    VerticalAnchoredCategorySeries.prototype.f7 = function (a, b, c, d, e) {
        if (this.valueColumn == null) {
            return Number.POSITIVE_INFINITY;
        }
        return this.f8(a, b, this.yAxis, d, e, this.valueColumn.count, runOn(this, this.sv));
    };
    VerticalAnchoredCategorySeries.prototype.ar = function (a) {
        if (a.isEmpty && this.ce != null) {
            a = this.ce.ta;
        }
        if (this.valueColumn == null) {
            return null;
        }
        var b = this.pz(this.b1);
        var c = this.rw();
        var d = new ScalerParams(0, a, this.ce.tp, c.cg, this.getEffectiveViewport());
        var e = (c.el(b.top, d));
        var f = (c.el(b.bottom, d));
        if (!c.cg) {
            var g = e;
            e = f;
            f = g;
        }
        e -= this.t3;
        f += this.t3;
        var h = null;
        if (c.cm) {
            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.ap(n, this.sh(), a);
        return n;
    };
    VerticalAnchoredCategorySeries.prototype.bq = function () {
        if (this.br == 0) {
            return 1;
        }
        else {
            return _super.prototype.bq.call(this);
        }
    };
    VerticalAnchoredCategorySeries.prototype.p5 = function (a) {
        if (!this.hasMarkers || !this.qn()) {
            return Rect.empty;
        }
        return this.u2.e$b(this, this.rx.m, a, runOn(this, this.va));
    };
    VerticalAnchoredCategorySeries.prototype.va = function (a) {
        return this.tp.c9(a);
    };
    VerticalAnchoredCategorySeries.prototype.ez = function (a, b) {
        if (this.ey(a, b)) {
            return true;
        }
        if (this.qo(a, b)) {
            return true;
        }
        return false;
    };
    VerticalAnchoredCategorySeries.prototype.gn = function (a, b, c) {
        if (this.ce == null) {
            return NaN;
        }
        var d = this.getEffectiveViewport1(this.b1);
        var e = this.rw();
        var f = new ScalerParams(0, this.ce.ta, this.b1.bu, e.cg, d);
        var g = this.r2.r(e, this.ce.ta, this.b1.bu, d);
        return this.gp(this.valueColumn, a, e, f, g, runOn(this, this.sv), b, c);
    };
    VerticalAnchoredCategorySeries.prototype.ps = function (a, b, c) {
        var d = this.rw();
        return this.pu(a, b, c, this.r2.r(d, this.b1.bv, this.b1.bu, this.getEffectiveViewport1(this.b1)), this.sh(), d, null, null, null);
    };
    VerticalAnchoredCategorySeries.prototype.fetchXAxis = function () {
        return this.xAxis;
    };
    VerticalAnchoredCategorySeries.prototype.fetchYAxis = function () {
        return this.yAxis;
    };
    VerticalAnchoredCategorySeries.prototype.uf = function (a) {
        this.xAxis = typeCast(NumericXAxis.$, a);
    };
    VerticalAnchoredCategorySeries.prototype.ug = function (a) {
        this.yAxis = typeCast(CategoryYAxis.$, a);
    };
    VerticalAnchoredCategorySeries.prototype.sr = function () {
        return this.xAxis != null && this.xAxis.c0();
    };
    VerticalAnchoredCategorySeries.prototype.rq = function (a, b) {
        return this.tm(a, b, this.yAxis);
    };
    VerticalAnchoredCategorySeries.prototype.f9 = function (a) {
        return this.u2.e$a(this, a);
    };
    VerticalAnchoredCategorySeries.prototype.sv = function (a) {
        return this.gb(a, this.rw());
    };
    VerticalAnchoredCategorySeries.prototype.hi = function (a) {
        return truncate(Math.round(this.f9(a)));
    };
    VerticalAnchoredCategorySeries.prototype.hy = function (a) {
        var b = this.hi(a);
        return b >= 0 && this.cl != null && b < this.cl.count ? this.cl.item(b) : null;
    };
    VerticalAnchoredCategorySeries.prototype.l9 = function (a, b, c, d) {
        _super.prototype.l9.call(this, a, b, c, d);
        switch (b) {
            case VerticalAnchoredCategorySeries.$$p[0]:
                if (c != d) {
                    this.k6(typeCast(Axis.$, c));
                    this.me(typeCast(Axis.$, d));
                    this.r6.cr.g(this.fx);
                    if (this.ce != null) {
                        this.ce.l6();
                    }
                    this.mn(false);
                    this.lu();
                }
                break;
            case VerticalAnchoredCategorySeries.$$p[1]:
                if (c != d) {
                    this.k6(typeCast(Axis.$, c));
                    this.me(typeCast(Axis.$, d));
                    this.r6.cr.g(this.fx);
                    this.sr();
                    this.mn(false);
                    this.lu();
                }
                break;
            case "TrendLineType":
                var e = EnumUtil.getEnumValue(TrendLineType_$type, d);
                if (e != 0) {
                    this.tp.c2 = CategoryTrendLineManagerFactory.a(this.tp.c2, this.yAxis, this.nf, this, this.co);
                }
                break;
        }
    };
    VerticalAnchoredCategorySeries.prototype.u5 = function (a) {
        if (typeCast(CategoryYAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    VerticalAnchoredCategorySeries.prototype.u4 = function (a) {
        if (typeCast(NumericXAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    Object.defineProperty(VerticalAnchoredCategorySeries.prototype, "useHighMarkerFidelity", {
        get: function () {
            return this.ss;
        },
        enumerable: false,
        configurable: true
    });
    VerticalAnchoredCategorySeries.$t = markType(VerticalAnchoredCategorySeries, 'VerticalAnchoredCategorySeries', AnchoredCategorySeries.$);
    VerticalAnchoredCategorySeries.$$p = markDep(DependencyProperty, PropertyMetadata, VerticalAnchoredCategorySeries, 'raisePropertyChanged', ['XAxis::u8', [NumericXAxis.$, null], 'YAxis::u9', [CategoryYAxis.$, null]]);
    return VerticalAnchoredCategorySeries;
}(AnchoredCategorySeries));
export { VerticalAnchoredCategorySeries };
