/*
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.ur = null;
        _this.un = null;
        _this.ut = null;
        _this.up = 0;
        return _this;
    }
    Object.defineProperty(HorizontalAnchoredCategorySeries.prototype, "us", {
        get: function () {
            var _this = this;
            if (this.ur == null) {
                this.ur = DVContainer.instance.createInstance(IHorizontalAnchoredCategorySeriesInteractionManager_$type, function () { return _this.cn.n; });
            }
            return this.ur;
        },
        enumerable: false,
        configurable: true
    });
    HorizontalAnchoredCategorySeries.prototype.ku = function () {
        _super.prototype.ku.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.rn = function () {
        return this.un;
    };
    HorizontalAnchoredCategorySeries.prototype.r8 = function () {
        return this.ut;
    };
    HorizontalAnchoredCategorySeries.prototype.pw = function (a) {
        if (this.ro == null || this.ro.m.count == 0 || !this.hasMarkers || !this.qe()) {
            return Rect.empty;
        }
        return this.us.d$d(this, this.ro.m, a, runOn(this, this.u5));
    };
    HorizontalAnchoredCategorySeries.prototype.u5 = function (a) {
        return this.tg.c9(a);
    };
    HorizontalAnchoredCategorySeries.prototype.ux = function (a, b, c) {
        return this.us.d$c(this, this.r8(), a, b, c);
    };
    HorizontalAnchoredCategorySeries.prototype.ah = function (a) {
        return this.us.d$a(this, this.ro.f, this.so(this.b0), this.sp(this.b0), a);
    };
    HorizontalAnchoredCategorySeries.prototype.ai = function (a) {
        return this.us.d$b(this, this.ro.f, this.so(this.b0), this.sp(this.b0), a);
    };
    HorizontalAnchoredCategorySeries.prototype.ev = function (a, b) {
        if (this.eu(a, b)) {
            return true;
        }
        if (this.qf(a, b)) {
            return true;
        }
        return false;
    };
    HorizontalAnchoredCategorySeries.prototype.getOffsetValue = function () {
        return this.rt.r(this.rn(), this.b0.bv, this.b0.bu, this.getEffectiveViewport1(this.b0));
    };
    HorizontalAnchoredCategorySeries.prototype.getCategoryWidth = function () {
        var a = this.getEffectiveViewport1(this.b0);
        return this.rn().getCategorySize(this.b0.bv, this.b0.bu, a);
    };
    HorizontalAnchoredCategorySeries.prototype.gj = function (a, b, c) {
        if (this.cd == null) {
            return NaN;
        }
        var d = this.getEffectiveViewport1(this.b0);
        var e = this.rn();
        if (e == null) {
            return NaN;
        }
        var f = new ScalerParams(0, this.cd.sf, this.b0.bu, e.cg, d);
        var g = this.rt.r(e, this.cd.sf, this.b0.bu, d);
        return this.gl(this.valueColumn, a, e, f, g, runOn(this, this.sm), b, c);
    };
    HorizontalAnchoredCategorySeries.prototype.hj = function (a, b) {
        return this.hk(a, b, this.rn(), runOn(this, this.sm), this.valueColumn);
    };
    HorizontalAnchoredCategorySeries.prototype.hh = function (a, b) {
        return this.hi(a, b, this.rn(), runOn(this, this.sm), this.valueColumn);
    };
    HorizontalAnchoredCategorySeries.prototype.f3 = function (a, b, c, d, e) {
        if (this.valueColumn == null) {
            return Number.POSITIVE_INFINITY;
        }
        return this.f4(a, b, this.rn(), d, e, this.valueColumn.count, runOn(this, this.sm));
    };
    HorizontalAnchoredCategorySeries.prototype.pl = function (a, b, c) {
        if (this.rn() == null || this.r8() == null) {
            return { $type: Point_$type, x: NaN, y: NaN };
        }
        return this.pn(a, b, c, this.rt.r(this.rn(), this.b0.bv, this.b0.bu, this.getEffectiveViewport1(this.b0)), this.r8(), this.rn(), null, null, null);
    };
    HorizontalAnchoredCategorySeries.prototype.fetchXAxis = function () {
        return this.un;
    };
    HorizontalAnchoredCategorySeries.prototype.fetchYAxis = function () {
        return this.ut;
    };
    HorizontalAnchoredCategorySeries.prototype.t3 = function (a) {
        this.xAxis = typeCast(CategoryAxisBase.$, a);
    };
    HorizontalAnchoredCategorySeries.prototype.t4 = function (a) {
        this.yAxis = typeCast(NumericYAxis.$, a);
    };
    HorizontalAnchoredCategorySeries.prototype.si = function () {
        return this.ut != null && this.ut.c0();
    };
    HorizontalAnchoredCategorySeries.prototype.u1 = function (a) {
        this.un = a;
    };
    HorizontalAnchoredCategorySeries.prototype.u2 = function (a) {
        this.ut = a;
    };
    HorizontalAnchoredCategorySeries.prototype.rh = function (a, b) {
        return this.td(a, b, this.un);
    };
    HorizontalAnchoredCategorySeries.prototype.l3 = function (a, b, c, d) {
        switch (b) {
            case HorizontalAnchoredCategorySeries.$$p[0]:
                this.u1(this.xAxis);
                if (this.tg.c3) {
                    this.tg.c2 = CategoryTrendLineManagerFactory.a(this.tg.c2, this.un, this.m9, this, this.cn);
                }
                break;
            case "TrendLineType":
                var e = EnumUtil.getEnumValue(TrendLineType_$type, d);
                if (e != 0) {
                    this.tg.c2 = CategoryTrendLineManagerFactory.a(this.tg.c2, this.un, this.m9, this, this.cn);
                }
                break;
        }
        _super.prototype.l3.call(this, a, b, c, d);
        switch (b) {
            case HorizontalAnchoredCategorySeries.$$p[0]:
                if (c != d) {
                    this.k1(typeCast(Axis.$, c));
                    this.l8(typeCast(Axis.$, d));
                    this.u1(this.xAxis);
                    this.rx.cr.g(this.ft);
                    this.mh(false);
                    this.lo();
                }
                break;
            case HorizontalAnchoredCategorySeries.$$p[1]:
                if (c != d) {
                    this.k1(typeCast(Axis.$, c));
                    this.l8(typeCast(Axis.$, d));
                    this.u2(this.yAxis);
                    if (this.cd != null) {
                        this.cd.li();
                    }
                    this.rx.cr.g(this.ft);
                    this.si();
                    this.mh(false);
                    this.lo();
                }
                break;
            case "CategoryMode":
                if (this.xAxis != null) {
                    this.xAxis.l4(true);
                }
                break;
        }
    };
    HorizontalAnchoredCategorySeries.prototype.k0 = function (a, b, c, d) {
        _super.prototype.k0.call(this, a, b, c, d);
        if (this.un != null && typeCast(ISortingAxis_$type, this.un) !== null) {
            this.un.i$i();
        }
        switch (a) {
            case 4:
                if (this.un != null) {
                    this.un.c0();
                }
                if (this.ut != null && !this.ut.c0()) {
                    this.mh(true);
                }
                break;
            case 1:
                if (this.un != null) {
                    this.un.c0();
                }
                if (this.ut != null && !this.ut.c0()) {
                    this.mh(true);
                }
                break;
            case 0:
                if (this.un != null) {
                    this.un.c0();
                }
                if (this.ut != null && !this.ut.c0()) {
                    this.mh(true);
                }
                break;
            case 2:
                if (this.ts != null && this.tg.cr.d > 0 && this.ut != null && !this.ut.c0()) {
                    this.mh(true);
                }
                break;
            case 3:
                if (d == this.ts) {
                    if (this.un != null) {
                        this.un.c0();
                    }
                    if (this.ut != null && !this.ut.c0()) {
                        this.mh(true);
                    }
                }
                break;
        }
    };
    HorizontalAnchoredCategorySeries.prototype.uv = function (a) {
        if (typeCast(CategoryXAxis.$, a) !== null || a.cd) {
            return true;
        }
        return false;
    };
    HorizontalAnchoredCategorySeries.prototype.uw = function (a) {
        if (typeCast(NumericYAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    Object.defineProperty(HorizontalAnchoredCategorySeries.prototype, "uq", {
        get: function () {
            return this.up;
        },
        set: function (a) {
            var b = this.uq;
            if (a != b) {
                this.up = a;
                this.raisePropertyChanged("CategoryMode", enumGetBox(CategoryMode_$type, b), enumGetBox(CategoryMode_$type, this.uq));
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(HorizontalAnchoredCategorySeries.prototype, "useHighMarkerFidelity", {
        get: function () {
            return this.sj;
        },
        enumerable: false,
        configurable: true
    });
    HorizontalAnchoredCategorySeries.$t = markType(HorizontalAnchoredCategorySeries, 'HorizontalAnchoredCategorySeries', AnchoredCategorySeries.$);
    HorizontalAnchoredCategorySeries.$$p = markDep(DependencyProperty, PropertyMetadata, HorizontalAnchoredCategorySeries, 'raisePropertyChanged', ['XAxis::u3', [CategoryAxisBase.$, null], 'YAxis::u4', [NumericYAxis.$, null]]);
    return HorizontalAnchoredCategorySeries;
}(AnchoredCategorySeries));
export { HorizontalAnchoredCategorySeries };
