/*
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 * as tslib_1 from "tslib";
import { AnchoredCategorySeries } from "./AnchoredCategorySeries";
import { IHorizontalAnchoredCategorySeriesInteractionManager_$type } from "./IHorizontalAnchoredCategorySeriesInteractionManager";
import { DVContainer } from "igniteui-react-core/ES5/DVContainer";
import { Type, runOn, Point_$type, typeCast, EnumUtil, enumGetBox, markType } from "igniteui-react-core/ES5/type";
import { CategoryAxisBase } from "./CategoryAxisBase";
import { DependencyProperty } from "igniteui-react-core/ES5/DependencyProperty";
import { NumericYAxis } from "./NumericYAxis";
import { CategoryMode_$type } from "./CategoryMode";
import { Rect } from "igniteui-react-core/ES5/Rect";
import { ScalerParams } from "./ScalerParams";
import { Axis } from "./Axis";
import { TrendLineType_$type } from "igniteui-react-core/ES5/TrendLineType";
import { CategoryTrendLineManagerFactory } from "./CategoryTrendLineManagerFactory";
import { ISortingAxis_$type } from "./ISortingAxis";
import { CategoryXAxis } from "./CategoryXAxis";
import { PropertyMetadata } from "igniteui-react-core/ES5/PropertyMetadata";
var HorizontalAnchoredCategorySeries = /** @class */ (function (_super) {
    tslib_1.__extends(HorizontalAnchoredCategorySeries, _super);
    function HorizontalAnchoredCategorySeries() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.pr = null;
        _this.pn = null;
        _this.pt = null;
        _this.pp = 0;
        return _this;
    }
    Object.defineProperty(HorizontalAnchoredCategorySeries.prototype, "ps", {
        get: function () {
            var _this = this;
            if (this.pr == null) {
                this.pr = DVContainer.instance.createInstance(IHorizontalAnchoredCategorySeriesInteractionManager_$type, function () { return _this.b2.n; });
            }
            return this.pr;
        },
        enumerable: true,
        configurable: true
    });
    HorizontalAnchoredCategorySeries.prototype.hj = function () {
        _super.prototype.hj.call(this);
        this.xAxis = null;
        this.yAxis = null;
    };
    HorizontalAnchoredCategorySeries.prototype.bd = function () {
        if (this.be == 0) {
            return 1;
        }
        else {
            return _super.prototype.bd.call(this);
        }
    };
    HorizontalAnchoredCategorySeries.prototype.mu = function () {
        return this.pn;
    };
    HorizontalAnchoredCategorySeries.prototype.ne = function () {
        return this.pt;
    };
    HorizontalAnchoredCategorySeries.prototype.lk = function (a) {
        if (this.mv == null || this.mv.m.count == 0 || !this.hasMarkers || !this.lr()) {
            return Rect.empty;
        }
        return this.ps.d$d(this, this.mv.m, a, runOn(this, this.p5));
    };
    HorizontalAnchoredCategorySeries.prototype.p5 = function (a) {
        return this.on.c3(a);
    };
    HorizontalAnchoredCategorySeries.prototype.px = function (a, b, c) {
        return this.ps.d$c(this, this.ne(), a, b, c);
    };
    HorizontalAnchoredCategorySeries.prototype.ah = function (a) {
        return this.ps.d$a(this, this.mv.f, this.nv(this.bi), this.nw(this.bi), a);
    };
    HorizontalAnchoredCategorySeries.prototype.ai = function (a) {
        return this.ps.d$b(this, this.mv.f, this.nv(this.bi), this.nw(this.bi), a);
    };
    HorizontalAnchoredCategorySeries.prototype.de = function (a, b) {
        if (this.dd(a, b)) {
            return true;
        }
        if (this.ls(a, b)) {
            return true;
        }
        return false;
    };
    HorizontalAnchoredCategorySeries.prototype.getOffsetValue = function () {
        return this.mz.r(this.mu(), this.bi.bq, this.bi.bp, this.getEffectiveViewport1(this.bi));
    };
    HorizontalAnchoredCategorySeries.prototype.getCategoryWidth = function () {
        var a = this.getEffectiveViewport1(this.bi);
        return this.mu().getCategorySize(this.bi.bq, this.bi.bp, a);
    };
    HorizontalAnchoredCategorySeries.prototype.eh = function (a, b, c) {
        if (this.bs == null) {
            return NaN;
        }
        var d = this.getEffectiveViewport1(this.bi);
        var e = this.mu();
        var f = new ScalerParams(0, this.bs.mk, this.bi.bp, e.b8, d);
        var g = this.mz.r(e, this.bs.mk, this.bi.bp, d);
        return this.ej(this.valueColumn, a, e, f, g, runOn(this, this.nt), b, c);
    };
    HorizontalAnchoredCategorySeries.prototype.e8 = function (a, b) {
        return this.e9(a, b, this.mu(), runOn(this, this.nt), this.valueColumn);
    };
    HorizontalAnchoredCategorySeries.prototype.e6 = function (a, b) {
        return this.e7(a, b, this.mu(), runOn(this, this.nt), this.valueColumn);
    };
    HorizontalAnchoredCategorySeries.prototype.d4 = function (a, b, c, d, e) {
        if (this.valueColumn == null) {
            return Number.POSITIVE_INFINITY;
        }
        return this.d5(a, b, this.mu(), d, e, this.valueColumn.count, runOn(this, this.nt));
    };
    HorizontalAnchoredCategorySeries.prototype.k9 = function (a, b, c) {
        if (this.mu() == null || this.ne() == null) {
            return { $type: Point_$type, x: NaN, y: NaN };
        }
        return this.lb(a, b, c, this.mz.r(this.mu(), this.bi.bq, this.bi.bp, this.getEffectiveViewport1(this.bi)), this.ne(), this.mu(), null, null, null);
    };
    HorizontalAnchoredCategorySeries.prototype.fetchXAxis = function () {
        return this.pn;
    };
    HorizontalAnchoredCategorySeries.prototype.fetchYAxis = function () {
        return this.pt;
    };
    HorizontalAnchoredCategorySeries.prototype.o5 = function (a) {
        this.xAxis = typeCast(CategoryAxisBase.$, a);
    };
    HorizontalAnchoredCategorySeries.prototype.o6 = function (a) {
        this.yAxis = typeCast(NumericYAxis.$, a);
    };
    HorizontalAnchoredCategorySeries.prototype.np = function () {
        return this.pt != null && this.pt.ck();
    };
    HorizontalAnchoredCategorySeries.prototype.p1 = function (a) {
        this.pn = a;
    };
    HorizontalAnchoredCategorySeries.prototype.p2 = function (a) {
        this.pt = a;
    };
    HorizontalAnchoredCategorySeries.prototype.mo = function (a, b) {
        return this.ok(a, b, this.pn);
    };
    HorizontalAnchoredCategorySeries.prototype.io = function (a, b, c, d) {
        switch (b) {
            case HorizontalAnchoredCategorySeries.$$p[0]:
                this.p1(this.xAxis);
                if (this.on.cx) {
                    this.on.cw = CategoryTrendLineManagerFactory.a(this.on.cw, this.pn, this.jl, this, this.b2);
                }
                break;
            case "TrendLineType":
                var e = EnumUtil.getEnumValue(TrendLineType_$type, d);
                if (e != 0) {
                    this.on.cw = CategoryTrendLineManagerFactory.a(this.on.cw, this.pn, this.jl, this, this.b2);
                }
                break;
        }
        _super.prototype.io.call(this, a, b, c, d);
        switch (b) {
            case HorizontalAnchoredCategorySeries.$$p[0]:
                if (c != d) {
                    this.hp(typeCast(Axis.$, c));
                    this.it(typeCast(Axis.$, d));
                    this.p1(this.xAxis);
                    this.m3.cl.g(this.eo);
                    this.i1(false);
                    this.h8();
                }
                break;
            case HorizontalAnchoredCategorySeries.$$p[1]:
                if (c != d) {
                    this.hp(typeCast(Axis.$, c));
                    this.it(typeCast(Axis.$, d));
                    this.p2(this.yAxis);
                    this.m3.cl.g(this.eo);
                    this.np();
                    this.i1(false);
                    this.h8();
                }
                break;
            case "CategoryMode":
                if (this.xAxis != null) {
                    this.xAxis.kf(true);
                }
                break;
        }
    };
    HorizontalAnchoredCategorySeries.prototype.ho = function (a, b, c, d) {
        _super.prototype.ho.call(this, a, b, c, d);
        if (this.pn != null && typeCast(ISortingAxis_$type, this.pn) !== null) {
            this.pn.i$i();
        }
        switch (a) {
            case 4:
                if (this.pn != null) {
                    this.pn.ck();
                }
                if (this.pt != null && !this.pt.ck()) {
                    this.i1(true);
                }
                break;
            case 1:
                if (this.pn != null) {
                    this.pn.ck();
                }
                if (this.pt != null && !this.pt.ck()) {
                    this.i1(true);
                }
                break;
            case 0:
                if (this.pn != null) {
                    this.pn.ck();
                }
                if (this.pt != null && !this.pt.ck()) {
                    this.i1(true);
                }
                break;
            case 2:
                if (this.oy != null && this.on.cl.d > 0 && this.pt != null && !this.pt.ck()) {
                    this.i1(true);
                }
                break;
            case 3:
                if (d == this.oy) {
                    if (this.pn != null) {
                        this.pn.ck();
                    }
                    if (this.pt != null && !this.pt.ck()) {
                        this.i1(true);
                    }
                }
                break;
        }
    };
    HorizontalAnchoredCategorySeries.prototype.pv = function (a) {
        if (typeCast(CategoryXAxis.$, a) !== null || a.b5) {
            return true;
        }
        return false;
    };
    HorizontalAnchoredCategorySeries.prototype.pw = function (a) {
        if (typeCast(NumericYAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    Object.defineProperty(HorizontalAnchoredCategorySeries.prototype, "pq", {
        get: function () {
            return this.pp;
        },
        set: function (a) {
            var b = this.pq;
            if (a != b) {
                this.pp = a;
                this.raisePropertyChanged("CategoryMode", enumGetBox(CategoryMode_$type, b), enumGetBox(CategoryMode_$type, this.pq));
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(HorizontalAnchoredCategorySeries.prototype, "useHighMarkerFidelity", {
        get: function () {
            return this.nq;
        },
        enumerable: true,
        configurable: true
    });
    HorizontalAnchoredCategorySeries.$t = markType(HorizontalAnchoredCategorySeries, 'HorizontalAnchoredCategorySeries', AnchoredCategorySeries.$);
    return HorizontalAnchoredCategorySeries;
}(AnchoredCategorySeries));
export { HorizontalAnchoredCategorySeries };
Type.dep(DependencyProperty, PropertyMetadata, HorizontalAnchoredCategorySeries, 'raisePropertyChanged', ['XAxis::p3', [CategoryAxisBase.$, null], 'YAxis::p4', [NumericYAxis.$, null]]);
/*<BeginStatics Name="Infragistics.Controls.Charts.HorizontalAnchoredCategorySeries" />*/
/*<EndStatics Name="Infragistics.Controls.Charts.HorizontalAnchoredCategorySeries" />*/
