/*
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 { AnchoredCategorySeries } from "./AnchoredCategorySeries";
import { NumericXAxis } from "./NumericXAxis";
import { DependencyProperty } from "igniteui-react-core/ES2015/DependencyProperty";
import { CategoryYAxis } from "./CategoryYAxis";
import { IVerticalAnchoredCategorySeriesInteractionManager_$type } from "./IVerticalAnchoredCategorySeriesInteractionManager";
import { DVContainer } from "igniteui-react-core/ES2015/DVContainer";
import { Type, runOn, typeCast, EnumUtil, markType } from "igniteui-react-core/ES2015/type";
import { Axis } from "./Axis";
import { ScalerParams } from "./ScalerParams";
import { Rect } from "igniteui-react-core/ES2015/Rect";
import { TrendLineType_$type } from "igniteui-react-core/ES2015/TrendLineType";
import { CategoryTrendLineManagerFactory } from "./CategoryTrendLineManagerFactory";
import { PropertyMetadata } from "igniteui-react-core/ES2015/PropertyMetadata";
import { truncate } from "igniteui-react-core/ES2015/number";
export class VerticalAnchoredCategorySeries extends AnchoredCategorySeries {
    constructor() {
        super(...arguments);
        this.pq = null;
    }
    hm() {
        super.hm();
        this.xAxis = null;
        this.yAxis = null;
    }
    get pr() {
        if (this.pq == null) {
            this.pq = DVContainer.instance.createInstance(IVerticalAnchoredCategorySeriesInteractionManager_$type, () => this.b2.n);
        }
        return this.pq;
    }
    get_isVertical() {
        return true;
    }
    mx() {
        return this.yAxis;
    }
    nh() {
        return this.xAxis;
    }
    getOffsetValue() {
        return this.m2.r(this.mx(), this.bi.bs, this.bi.br, this.getEffectiveViewport1(this.bi));
    }
    getCategoryWidth() {
        return this.yAxis.getCategorySize(this.bi.bs, this.bi.br, this.getEffectiveViewport1(this.bi));
    }
    e8(a, b) {
        return this.e9(a, b, this.mx(), runOn(this, this.nw), this.valueColumn);
    }
    fa(a, b) {
        return this.fb(a, b, this.mx(), runOn(this, this.nw), this.valueColumn);
    }
    d5(a, b, c, d, e) {
        if (this.valueColumn == null) {
            return Number.POSITIVE_INFINITY;
        }
        return this.d6(a, b, this.yAxis, d, e, this.valueColumn.count, runOn(this, this.nw));
    }
    bd() {
        if (this.be == 0) {
            return 1;
        }
        else {
            return super.bd();
        }
    }
    ln(a) {
        if (!this.hasMarkers || !this.lu()) {
            return Rect.empty;
        }
        return this.pr.e$b(this, this.my.m, a, runOn(this, this.pz));
    }
    pz(a) {
        return this.op.c5(a);
    }
    df(a, b) {
        if (this.de(a, b)) {
            return true;
        }
        if (this.lv(a, b)) {
            return true;
        }
        return false;
    }
    ej(a, b, c) {
        if (this.bs == null) {
            return NaN;
        }
        let d = this.getEffectiveViewport1(this.bi);
        let e = this.mx();
        let f = new ScalerParams(0, this.bs.mn, this.bi.br, e.b8, d);
        let g = this.m2.r(e, this.bs.mn, this.bi.br, d);
        return this.el(this.valueColumn, a, e, f, g, runOn(this, this.nw), b, c);
    }
    lc(a, b, c) {
        let d = this.mx();
        return this.le(a, b, c, this.m2.r(d, this.bi.bs, this.bi.br, this.getEffectiveViewport1(this.bi)), this.nh(), d, null, null, null);
    }
    fetchXAxis() {
        return this.xAxis;
    }
    fetchYAxis() {
        return this.yAxis;
    }
    o7(a) {
        this.xAxis = typeCast(NumericXAxis.$, a);
    }
    o8(a) {
        this.yAxis = typeCast(CategoryYAxis.$, a);
    }
    ns() {
        return this.xAxis != null && this.xAxis.ck();
    }
    mr(a, b) {
        return this.om(a, b, this.yAxis);
    }
    d7(a) {
        return this.pr.e$a(this, a);
    }
    nw(a) {
        return this.d9(a, this.mx());
    }
    e4(a) {
        return truncate(Math.round(this.d7(a)));
    }
    fl(a) {
        let b = this.e4(a);
        return b >= 0 && this.bz != null && b < this.bz.count ? this.bz.item(b) : null;
    }
    ir(a, b, c, d) {
        super.ir(a, b, c, d);
        switch (b) {
            case VerticalAnchoredCategorySeries.$$p[0]:
                if (c != d) {
                    this.hs(typeCast(Axis.$, c));
                    this.iw(typeCast(Axis.$, d));
                    this.m6.cn.g(this.eq);
                    this.i4(false);
                    this.ib();
                }
                break;
            case VerticalAnchoredCategorySeries.$$p[1]:
                if (c != d) {
                    this.hs(typeCast(Axis.$, c));
                    this.iw(typeCast(Axis.$, d));
                    this.m6.cn.g(this.eq);
                    this.ns();
                    this.i4(false);
                    this.ib();
                }
                break;
            case "TrendLineType":
                let e = EnumUtil.getEnumValue(TrendLineType_$type, d);
                if (e != 0) {
                    this.op.cy = CategoryTrendLineManagerFactory.a(this.op.cy, this.yAxis, this.jo, this, this.b2);
                }
                break;
        }
    }
    pu(a) {
        if (typeCast(CategoryYAxis.$, a) !== null) {
            return true;
        }
        return false;
    }
    pt(a) {
        if (typeCast(NumericXAxis.$, a) !== null) {
            return true;
        }
        return false;
    }
    get useHighMarkerFidelity() {
        return this.nt;
    }
}
VerticalAnchoredCategorySeries.$t = markType(VerticalAnchoredCategorySeries, 'VerticalAnchoredCategorySeries', AnchoredCategorySeries.$);
Type.dep(DependencyProperty, PropertyMetadata, VerticalAnchoredCategorySeries, 'raisePropertyChanged', ['XAxis::px', [NumericXAxis.$, null], 'YAxis::py', [CategoryYAxis.$, null]]);
