/*
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.acf = null;
        _this.acb = null;
        _this.ach = null;
        _this.acd = 0;
        return _this;
    }
    Object.defineProperty(HorizontalAnchoredCategorySeries.prototype, "acg", {
        get: function () {
            var _this = this;
            if (this.acf == null) {
                this.acf = DVContainer.instance.createInstance(IHorizontalAnchoredCategorySeriesInteractionManager_$type, function () { return _this.dr.n; });
            }
            return this.acf;
        },
        enumerable: false,
        configurable: true
    });
    HorizontalAnchoredCategorySeries.prototype.o2 = function () {
        _super.prototype.o2.call(this);
        this.xAxis = null;
        this.yAxis = null;
    };
    HorizontalAnchoredCategorySeries.prototype.ck = function () {
        return 1;
    };
    HorizontalAnchoredCategorySeries.prototype.cl = function () {
        if (this.yAxis != null && this.yAxis.ch) {
            return 4;
        }
        return 3;
    };
    HorizontalAnchoredCategorySeries.prototype.b2 = function () {
        if (this.b3 == 0) {
            return 1;
        }
        else {
            return _super.prototype.b2.call(this);
        }
    };
    HorizontalAnchoredCategorySeries.prototype.yq = function () {
        return this.acb;
    };
    HorizontalAnchoredCategorySeries.prototype.y7 = function () {
        return this.ach;
    };
    HorizontalAnchoredCategorySeries.prototype.wn = function (a) {
        if (this.ys == null || this.ys.n.count == 0 || !this.hasMarkers || !this.xe()) {
            return Rect.empty;
        }
        return this.acg.d$d(this, this.ys.n, a, runOn(this, this.act));
    };
    HorizontalAnchoredCategorySeries.prototype.act = function (a) {
        return this.aat.de(a);
    };
    HorizontalAnchoredCategorySeries.prototype.acl = function (a, b, c) {
        return this.acg.d$c(this, this.y7(), a, b, c);
    };
    HorizontalAnchoredCategorySeries.prototype.aj = function (a) {
        return this.acg.d$a(this, this.ys.f, this.zt(this.cv), this.zu(this.cv), a);
    };
    HorizontalAnchoredCategorySeries.prototype.al = function (a) {
        return this.acg.d$b(this, this.ys.f, this.zt(this.cv), this.zu(this.cv), a);
    };
    HorizontalAnchoredCategorySeries.prototype.gw = function (a, b) {
        if (this.gv(a, b)) {
            return true;
        }
        if (this.xf(a, b)) {
            return true;
        }
        return false;
    };
    HorizontalAnchoredCategorySeries.prototype.getOffsetValue = function () {
        return this.yx.r(this.yq(), this.cv.by, this.cv.bx, this.getEffectiveViewport1(this.cv));
    };
    HorizontalAnchoredCategorySeries.prototype.getCategoryWidth = function () {
        var a = this.getEffectiveViewport1(this.cv);
        return this.yq().getCategorySize(this.cv.by, this.cv.bx, a);
    };
    HorizontalAnchoredCategorySeries.prototype.i5 = function (a, b, c) {
        if (this.db == null) {
            return NaN;
        }
        var d = this.getEffectiveViewport1(this.cv);
        var e = this.yq();
        if (e == null) {
            return NaN;
        }
        var f = new ScalerParams(0, this.db.v4, this.cv.bx, e.ch, d);
        var g = this.yx.r(e, this.db.v4, this.cv.bx, d);
        return this.i7(this.valueColumn, a, e, f, g, runOn(this, this.zr), b, c);
    };
    HorizontalAnchoredCategorySeries.prototype.ka = function (a, b) {
        return this.kb(a, b, this.yq(), runOn(this, this.zr), this.valueColumn);
    };
    HorizontalAnchoredCategorySeries.prototype.j8 = function (a, b) {
        return this.j9(a, b, this.yq(), runOn(this, this.zr), this.valueColumn);
    };
    HorizontalAnchoredCategorySeries.prototype.ip = function (a, b, c, d, e) {
        if (this.valueColumn == null) {
            return Number.POSITIVE_INFINITY;
        }
        return this.iq(a, b, this.yq(), d, e, this.valueColumn.count, runOn(this, this.zr));
    };
    HorizontalAnchoredCategorySeries.prototype.wa = function (a, b, c) {
        if (this.yq() == null || this.y7() == null) {
            return { $type: Point_$type, x: NaN, y: NaN };
        }
        return this.wc(a, b, c, this.yx.r(this.yq(), this.cv.by, this.cv.bx, this.getEffectiveViewport1(this.cv)), this.y7(), this.yq(), null, null, null);
    };
    HorizontalAnchoredCategorySeries.prototype.fetchXAxis = function () {
        return this.acb;
    };
    HorizontalAnchoredCategorySeries.prototype.fetchYAxis = function () {
        return this.ach;
    };
    HorizontalAnchoredCategorySeries.prototype.abp = function (a) {
        this.xAxis = typeCast(CategoryAxisBase.$, a);
    };
    HorizontalAnchoredCategorySeries.prototype.abq = function (a) {
        this.yAxis = typeCast(NumericYAxis.$, a);
    };
    HorizontalAnchoredCategorySeries.prototype.zn = function () {
        return this.ach != null && this.ach.c1();
    };
    HorizontalAnchoredCategorySeries.prototype.acp = function (a) {
        this.acb = a;
    };
    HorizontalAnchoredCategorySeries.prototype.acq = function (a) {
        this.ach = a;
    };
    HorizontalAnchoredCategorySeries.prototype.yk = function (a, b) {
        return this.aaq(a, b, this.acb);
    };
    HorizontalAnchoredCategorySeries.prototype.q7 = function (a, b, c, d) {
        switch (b) {
            case HorizontalAnchoredCategorySeries.$$p[0]:
                this.acp(this.xAxis);
                if (this.aat.c8) {
                    this.aat.c7 = CategoryTrendLineManagerFactory.a(this.aat.c7, this.acb, this.st, this, this.dr);
                }
                break;
            case "TrendLineType":
                var e = EnumUtil.getEnumValue(TrendLineType_$type, d);
                if (e != 0) {
                    this.aat.c7 = CategoryTrendLineManagerFactory.a(this.aat.c7, this.acb, this.st, this, this.dr);
                }
                break;
        }
        _super.prototype.q7.call(this, a, b, c, d);
        switch (b) {
            case HorizontalAnchoredCategorySeries.$$p[0]:
                if (c != d) {
                    this.pc(typeCast(Axis.$, c));
                    this.rf(typeCast(Axis.$, d));
                    this.acp(this.xAxis);
                    this.y1.cw.g(this.id);
                    this.rp(false);
                    this.qj();
                }
                break;
            case HorizontalAnchoredCategorySeries.$$p[1]:
                if (c != d) {
                    this.pc(typeCast(Axis.$, c));
                    this.rf(typeCast(Axis.$, d));
                    this.acq(this.yAxis);
                    if (this.db != null) {
                        this.db.n2();
                    }
                    this.y1.cw.g(this.id);
                    this.zn();
                    this.rp(false);
                    this.qj();
                }
                break;
            case "CategoryMode":
                if (this.xAxis != null) {
                    this.xAxis.ma(true);
                }
                break;
        }
    };
    HorizontalAnchoredCategorySeries.prototype.pb = function (a, b, c, d) {
        _super.prototype.pb.call(this, a, b, c, d);
        if (this.acb != null && typeCast(ISortingAxis_$type, this.acb) !== null) {
            this.acb.i$i();
        }
        switch (a) {
            case 4:
                if (this.acb != null) {
                    this.acb.c1();
                }
                if (this.ach != null && !this.ach.c1()) {
                    this.rp(true);
                }
                break;
            case 1:
                if (this.acb != null) {
                    this.acb.c1();
                }
                if (this.ach != null && !this.ach.c1()) {
                    this.rp(true);
                }
                break;
            case 0:
                if (this.acb != null) {
                    this.acb.c1();
                }
                if (this.ach != null && !this.ach.c1()) {
                    this.rp(true);
                }
                break;
            case 2:
                if (this.abb != null && this.aat.cw.d > 0 && this.ach != null && !this.ach.c1()) {
                    this.rp(true);
                }
                break;
            case 3:
                if (d == this.abb) {
                    if (this.acb != null) {
                        this.acb.c1();
                    }
                    if (this.ach != null && !this.ach.c1()) {
                        this.rp(true);
                    }
                }
                break;
        }
    };
    HorizontalAnchoredCategorySeries.prototype.acj = function (a) {
        if (typeCast(CategoryXAxis.$, a) !== null || a.ce) {
            return true;
        }
        return false;
    };
    HorizontalAnchoredCategorySeries.prototype.ack = function (a) {
        if (typeCast(NumericYAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    Object.defineProperty(HorizontalAnchoredCategorySeries.prototype, "ace", {
        get: function () {
            return this.acd;
        },
        set: function (a) {
            var b = this.ace;
            if (a != b) {
                this.acd = a;
                this.raisePropertyChanged("CategoryMode", enumGetBox(CategoryMode_$type, b), enumGetBox(CategoryMode_$type, this.ace));
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(HorizontalAnchoredCategorySeries.prototype, "useHighMarkerFidelity", {
        get: function () {
            return this.zo;
        },
        enumerable: false,
        configurable: true
    });
    HorizontalAnchoredCategorySeries.$t = markType(HorizontalAnchoredCategorySeries, 'HorizontalAnchoredCategorySeries', AnchoredCategorySeries.$);
    HorizontalAnchoredCategorySeries.$$p = markDep(DependencyProperty, PropertyMetadata, HorizontalAnchoredCategorySeries, 'raisePropertyChanged', ['XAxis::acr', [CategoryAxisBase.$, null], 'YAxis::acs', [NumericYAxis.$, null]]);
    return HorizontalAnchoredCategorySeries;
}(AnchoredCategorySeries));
export { HorizontalAnchoredCategorySeries };
