/*
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 { IHorizontalAnchoredCategorySeriesInteractionManager_$type } from "./IHorizontalAnchoredCategorySeriesInteractionManager";
import { DVContainer } from "igniteui-angular-core";
import { runOn, Point_$type, typeCast, EnumUtil, enumGetBox, markType, markDep } from "igniteui-angular-core";
import { CategoryAxisBase } from "./CategoryAxisBase";
import { DependencyProperty } from "igniteui-angular-core";
import { NumericYAxis } from "./NumericYAxis";
import { CategoryMode_$type } from "./CategoryMode";
import { Axis } from "./Axis";
import { Rect } from "igniteui-angular-core";
import { ScalerParams } from "./ScalerParams";
import { TrendLineType_$type } from "igniteui-angular-core";
import { CategoryTrendLineManagerFactory } from "./CategoryTrendLineManagerFactory";
import { ISortingAxis_$type } from "./ISortingAxis";
import { CategoryXAxis } from "./CategoryXAxis";
import { PropertyMetadata } from "igniteui-angular-core";
/**
 * @hidden
 */
var HorizontalAnchoredCategorySeries = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(HorizontalAnchoredCategorySeries, _super);
    function HorizontalAnchoredCategorySeries() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.uw = null;
        _this.us = null;
        _this.uy = null;
        _this.uu = 0;
        return _this;
    }
    Object.defineProperty(HorizontalAnchoredCategorySeries.prototype, "ux", {
        get: function () {
            var _this = this;
            if (this.uw == null) {
                this.uw = DVContainer.instance.createInstance(IHorizontalAnchoredCategorySeriesInteractionManager_$type, function () { return _this.cn.n; });
            }
            return this.uw;
        },
        enumerable: false,
        configurable: true
    });
    HorizontalAnchoredCategorySeries.prototype.kx = function () {
        _super.prototype.kx.call(this);
        this.xAxis = null;
        this.yAxis = null;
    };
    HorizontalAnchoredCategorySeries.prototype.bv = function () {
        return 1;
    };
    HorizontalAnchoredCategorySeries.prototype.bw = function () {
        if (this.yAxis != null && this.yAxis.cg) {
            return 4;
        }
        return 3;
    };
    HorizontalAnchoredCategorySeries.prototype.bp = function () {
        if (this.bq == 0) {
            return 1;
        }
        else {
            return _super.prototype.bp.call(this);
        }
    };
    HorizontalAnchoredCategorySeries.prototype.rs = function () {
        return this.us;
    };
    HorizontalAnchoredCategorySeries.prototype.sd = function () {
        return this.uy;
    };
    HorizontalAnchoredCategorySeries.prototype.p1 = function (a) {
        if (this.rt == null || this.rt.m.count == 0 || !this.hasMarkers || !this.qj()) {
            return Rect.empty;
        }
        return this.ux.d$d(this, this.rt.m, a, runOn(this, this.va));
    };
    HorizontalAnchoredCategorySeries.prototype.va = function (a) {
        return this.tl.c9(a);
    };
    HorizontalAnchoredCategorySeries.prototype.u2 = function (a, b, c) {
        return this.ux.d$c(this, this.sd(), a, b, c);
    };
    HorizontalAnchoredCategorySeries.prototype.ah = function (a) {
        return this.ux.d$a(this, this.rt.f, this.st(this.b0), this.su(this.b0), a);
    };
    HorizontalAnchoredCategorySeries.prototype.ai = function (a) {
        return this.ux.d$b(this, this.rt.f, this.st(this.b0), this.su(this.b0), a);
    };
    HorizontalAnchoredCategorySeries.prototype.ex = function (a, b) {
        if (this.ew(a, b)) {
            return true;
        }
        if (this.qk(a, b)) {
            return true;
        }
        return false;
    };
    HorizontalAnchoredCategorySeries.prototype.getOffsetValue = function () {
        return this.ry.r(this.rs(), this.b0.bv, this.b0.bu, this.getEffectiveViewport1(this.b0));
    };
    HorizontalAnchoredCategorySeries.prototype.getCategoryWidth = function () {
        var a = this.getEffectiveViewport1(this.b0);
        return this.rs().getCategorySize(this.b0.bv, this.b0.bu, a);
    };
    HorizontalAnchoredCategorySeries.prototype.gl = function (a, b, c) {
        if (this.cd == null) {
            return NaN;
        }
        var d = this.getEffectiveViewport1(this.b0);
        var e = this.rs();
        if (e == null) {
            return NaN;
        }
        var f = new ScalerParams(0, this.cd.s9, this.b0.bu, e.cg, d);
        var g = this.ry.r(e, this.cd.s9, this.b0.bu, d);
        return this.gn(this.valueColumn, a, e, f, g, runOn(this, this.sr), b, c);
    };
    HorizontalAnchoredCategorySeries.prototype.hl = function (a, b) {
        return this.hm(a, b, this.rs(), runOn(this, this.sr), this.valueColumn);
    };
    HorizontalAnchoredCategorySeries.prototype.hj = function (a, b) {
        return this.hk(a, b, this.rs(), runOn(this, this.sr), this.valueColumn);
    };
    HorizontalAnchoredCategorySeries.prototype.f5 = function (a, b, c, d, e) {
        if (this.valueColumn == null) {
            return Number.POSITIVE_INFINITY;
        }
        return this.f6(a, b, this.rs(), d, e, this.valueColumn.count, runOn(this, this.sr));
    };
    HorizontalAnchoredCategorySeries.prototype.pq = function (a, b, c) {
        if (this.rs() == null || this.sd() == null) {
            return { $type: Point_$type, x: NaN, y: NaN };
        }
        return this.ps(a, b, c, this.ry.r(this.rs(), this.b0.bv, this.b0.bu, this.getEffectiveViewport1(this.b0)), this.sd(), this.rs(), null, null, null);
    };
    HorizontalAnchoredCategorySeries.prototype.fetchXAxis = function () {
        return this.us;
    };
    HorizontalAnchoredCategorySeries.prototype.fetchYAxis = function () {
        return this.uy;
    };
    HorizontalAnchoredCategorySeries.prototype.t8 = function (a) {
        this.xAxis = typeCast(CategoryAxisBase.$, a);
    };
    HorizontalAnchoredCategorySeries.prototype.t9 = function (a) {
        this.yAxis = typeCast(NumericYAxis.$, a);
    };
    HorizontalAnchoredCategorySeries.prototype.sn = function () {
        return this.uy != null && this.uy.c0();
    };
    HorizontalAnchoredCategorySeries.prototype.u6 = function (a) {
        this.us = a;
    };
    HorizontalAnchoredCategorySeries.prototype.u7 = function (a) {
        this.uy = a;
    };
    HorizontalAnchoredCategorySeries.prototype.rm = function (a, b) {
        return this.ti(a, b, this.us);
    };
    HorizontalAnchoredCategorySeries.prototype.l7 = function (a, b, c, d) {
        switch (b) {
            case HorizontalAnchoredCategorySeries.$$p[0]:
                this.u6(this.xAxis);
                if (this.tl.c3) {
                    this.tl.c2 = CategoryTrendLineManagerFactory.a(this.tl.c2, this.us, this.nd, this, this.cn);
                }
                break;
            case "TrendLineType":
                var e = EnumUtil.getEnumValue(TrendLineType_$type, d);
                if (e != 0) {
                    this.tl.c2 = CategoryTrendLineManagerFactory.a(this.tl.c2, this.us, this.nd, this, this.cn);
                }
                break;
        }
        _super.prototype.l7.call(this, a, b, c, d);
        switch (b) {
            case HorizontalAnchoredCategorySeries.$$p[0]:
                if (c != d) {
                    this.k4(typeCast(Axis.$, c));
                    this.mc(typeCast(Axis.$, d));
                    this.u6(this.xAxis);
                    this.r2.cr.g(this.fv);
                    this.ml(false);
                    this.ls();
                }
                break;
            case HorizontalAnchoredCategorySeries.$$p[1]:
                if (c != d) {
                    this.k4(typeCast(Axis.$, c));
                    this.mc(typeCast(Axis.$, d));
                    this.u7(this.yAxis);
                    if (this.cd != null) {
                        this.cd.l5();
                    }
                    this.r2.cr.g(this.fv);
                    this.sn();
                    this.ml(false);
                    this.ls();
                }
                break;
            case "CategoryMode":
                if (this.xAxis != null) {
                    this.xAxis.l4(true);
                }
                break;
        }
    };
    HorizontalAnchoredCategorySeries.prototype.k3 = function (a, b, c, d) {
        _super.prototype.k3.call(this, a, b, c, d);
        if (this.us != null && typeCast(ISortingAxis_$type, this.us) !== null) {
            this.us.i$i();
        }
        switch (a) {
            case 4:
                if (this.us != null) {
                    this.us.c0();
                }
                if (this.uy != null && !this.uy.c0()) {
                    this.ml(true);
                }
                break;
            case 1:
                if (this.us != null) {
                    this.us.c0();
                }
                if (this.uy != null && !this.uy.c0()) {
                    this.ml(true);
                }
                break;
            case 0:
                if (this.us != null) {
                    this.us.c0();
                }
                if (this.uy != null && !this.uy.c0()) {
                    this.ml(true);
                }
                break;
            case 2:
                if (this.tx != null && this.tl.cr.d > 0 && this.uy != null && !this.uy.c0()) {
                    this.ml(true);
                }
                break;
            case 3:
                if (d == this.tx) {
                    if (this.us != null) {
                        this.us.c0();
                    }
                    if (this.uy != null && !this.uy.c0()) {
                        this.ml(true);
                    }
                }
                break;
        }
    };
    HorizontalAnchoredCategorySeries.prototype.u0 = function (a) {
        if (typeCast(CategoryXAxis.$, a) !== null || a.cd) {
            return true;
        }
        return false;
    };
    HorizontalAnchoredCategorySeries.prototype.u1 = function (a) {
        if (typeCast(NumericYAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    Object.defineProperty(HorizontalAnchoredCategorySeries.prototype, "uv", {
        get: function () {
            return this.uu;
        },
        set: function (a) {
            var b = this.uv;
            if (a != b) {
                this.uu = a;
                this.raisePropertyChanged("CategoryMode", enumGetBox(CategoryMode_$type, b), enumGetBox(CategoryMode_$type, this.uv));
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(HorizontalAnchoredCategorySeries.prototype, "useHighMarkerFidelity", {
        get: function () {
            return this.so;
        },
        enumerable: false,
        configurable: true
    });
    HorizontalAnchoredCategorySeries.$t = markType(HorizontalAnchoredCategorySeries, 'HorizontalAnchoredCategorySeries', AnchoredCategorySeries.$);
    HorizontalAnchoredCategorySeries.$$p = markDep(DependencyProperty, PropertyMetadata, HorizontalAnchoredCategorySeries, 'raisePropertyChanged', ['XAxis::u8', [CategoryAxisBase.$, null], 'YAxis::u9', [NumericYAxis.$, null]]);
    return HorizontalAnchoredCategorySeries;
}(AnchoredCategorySeries));
export { HorizontalAnchoredCategorySeries };
