/*
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 { HorizontalAnchoredCategorySeries } from "./HorizontalAnchoredCategorySeries";
import { DependencyProperty } from "igniteui-react-core";
import { ConsolidatedItemsPosition_$type } from "./ConsolidatedItemsPosition";
import { runOn, enumGetBox, markType, markDep, fromEnum } from "igniteui-react-core";
import { Pool$1 } from "igniteui-react-core";
import { Rectangle } from "igniteui-react-core";
import { List$1 } from "igniteui-react-core";
import { ScalerParams } from "./ScalerParams";
import { PropertyMetadata } from "igniteui-react-core";
import { isNaN_, isInfinity } from "igniteui-react-core";
import { AnchoredCategorySeriesView } from "./AnchoredCategorySeriesView";
/**
 * @hidden
 */
export let ColumnSeries = /*@__PURE__*/ (() => {
    class ColumnSeries extends HorizontalAnchoredCategorySeries {
        constructor() {
            super();
            this.q0 = null;
            this.qv = 0;
            this.ab = ColumnSeries.$;
            this.qe = 2;
        }
        bf() {
            return new ColumnSeriesView(this);
        }
        i2(a) {
            super.i2(a);
            this.qu = a;
        }
        nt() {
            return 1;
        }
        get_n8() {
            return true;
        }
        preferredCategoryMode(a) {
            return this.qe;
        }
        l4(a) {
            if (this.q0 == null) {
                this.q0 = runOn(this, this.qx);
            }
            let b = this.qh != null ? this.qh : this.yAxis;
            let c = this.qb;
            return this.pg.c$d(this, a, c, b, this.nk, this.ok(this.bi), this.ol(this.bi), this.q0);
        }
        dh(a, b) {
            if (this.dk(a, b)) {
                return true;
            }
            if (this.me(a, b)) {
                return true;
            }
            return false;
        }
        h3(a, b) {
            super.h3(a, b);
            let c = b;
            if (a && c.c7 != null) {
                c.c7.count = 0;
            }
        }
        eg() {
            return this.qb.jz(this.bi.bs, this.bi.br, this.getEffectiveViewport1(this.bi));
        }
        o1(a, b) {
            super.o1(a, b);
            let c = a.f;
            if (!b.q()) {
                return;
            }
            let d = b.bs;
            let e = b.br;
            let f = this.getEffectiveViewport1(b);
            let g = new ScalerParams(0, d, e, this.qh.ca, f);
            g.b = this.eh();
            let h = new ScalerParams(0, d, e, this.qb.ca, f);
            let i = this.qh;
            let j = i.dy(i.km, g);
            let k = this.qb.jz(d, e, f);
            let l = this.qb;
            let m = b;
            if (isNaN_(k) || isInfinity(k)) {
                m.c7.count = 0;
                return;
            }
            this.nr.x(this, this.oc(), this.qb, runOn(this, this.nd), this.ok(b), this.ol(b));
            this.nr.p = this.qy;
            this.nr.q = this.qz;
            this.nr.j = this.qy;
            this.nr.k = this.qz;
            let n = false;
            let o = this.nr.c;
            if (o != null) {
                n = true;
            }
            let p = this.qb.cf;
            let q = p ? this.qb : null;
            let r = this.valueColumn.count;
            let s = this.ok(b);
            let t = 0;
            for (let u = 0; u < c.count; ++u) {
                let v = c._inner[u][0] - 0.5 * k;
                let w = this.qx(c._inner[u]);
                let x = j;
                w = Math.max(w, -100);
                x = Math.min(x, e.bottom + 100);
                let y = Math.abs(x - w);
                if (isInfinity(y)) {
                    continue;
                }
                let z = m.c7.item(t);
                t++;
                z.width = k;
                z.height = y;
                if (n) {
                    this.ox(c, u, r, l, h, b.n);
                }
                if (z.dataContext != null) {
                    let aa = z.dataContext;
                    if (s == 1) {
                        let ab = this.nr.a(r, u)[0];
                        if (ab >= 0 && ab < this.bz.count) {
                            if (q != null && q.i$b != null && q.i$b.count > ab) {
                                ab = q.i$b._inner[ab];
                            }
                            aa.item = this.bz.item(ab);
                        }
                    }
                    else {
                        aa.item = null;
                    }
                }
                this.nr.ae(z, false, false, false, false);
                z.am = this.nr.j;
                z.an = this.nr.k;
                m.dc(z, v, Math.min(x, w));
            }
            m.c7.count = t;
            b.cu(a);
        }
        get qw() {
            return this.qv;
        }
        set qw(a) {
            if (this.qw != a) {
                let b = this.qw;
                this.qv = a;
                this.raisePropertyChanged("ConsolidatedColumnVerticalPosition", enumGetBox(ConsolidatedItemsPosition_$type, b), enumGetBox(ConsolidatedItemsPosition_$type, this.qw));
            }
        }
        qx(a) {
            if (a == null || a.length < 3) {
                return NaN;
            }
            switch (this.qw) {
                case 0: return a[1];
                case 1: return a[2];
                case 2: return (a[1] + a[2]) / 2;
                case 3:
                    let b = (a[1] + a[2]) / 2;
                    if (this.yAxis == null) {
                        return b;
                    }
                    let c = this.yAxis.d1(b, new ScalerParams(1, this.bs.oi, this.bs.oh, this.yAxis.ca));
                    if (c < this.yAxis.km) {
                        return a[2];
                    }
                    else {
                        return a[1];
                    }
                case 4:
                    let d = (a[1] + a[2]) / 2;
                    let e = this.yAxis.d1(d, new ScalerParams(1, this.bs.oi, this.bs.oh, this.yAxis.ca));
                    if (this.yAxis == null) {
                        return d;
                    }
                    if (e < this.yAxis.km) {
                        return a[1];
                    }
                    else {
                        return a[2];
                    }
                default: return (a[1] + a[2]) / 2;
            }
        }
        get useHighMarkerFidelity() {
            return this.of;
        }
    }
    ColumnSeries.$t = /*@__PURE__*/ markType(ColumnSeries, 'ColumnSeries', HorizontalAnchoredCategorySeries.$);
    ColumnSeries.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, ColumnSeries, 'raisePropertyChanged', ['RadiusX:qy:q4', [1, 2], 'RadiusY:qz:q5', [1, 2]]);
    return ColumnSeries;
})();
/**
 * @hidden
 */
export let ColumnSeriesView = /*@__PURE__*/ (() => {
    class ColumnSeriesView extends AnchoredCategorySeriesView {
        constructor(a) {
            super(a);
            this.c6 = null;
            this.c8 = null;
            this.dd = new Rectangle();
            this.c7 = null;
            this.c6 = a;
            this.c7 = ((() => {
                let $ret = new Pool$1(Rectangle.$);
                $ret.create = runOn(this, this.de);
                $ret.activate = runOn(this, this.c9);
                $ret.disactivate = runOn(this, this.db);
                $ret.destroy = runOn(this, this.da);
                return $ret;
            })());
        }
        ap() {
            super.ap();
            this.c8 = new List$1(Rectangle.$, 0);
            if (!this.n) {
                this.e.eu = 4;
                this.e.bj = 1;
            }
        }
        de() {
            let a = new Rectangle();
            this.c8.add(a);
            a._visibility = 1;
            return a;
        }
        c9(a) {
            a._visibility = 0;
        }
        db(a) {
            a._visibility = 1;
        }
        da(a) {
            this.c8.remove(a);
        }
        dc(a, b, c) {
            if (!this.isDirty) {
                this.an();
            }
            a.o = c;
            a.n = b;
        }
        z(a) {
            return this.c8._inner[a];
        }
        y(a) {
            let b = this.c8._inner[a];
            this.dd._visibility = b._visibility;
            this.dd.n = b.n;
            this.dd.o = b.o;
            this.dd.width = b.width;
            this.dd.height = b.height;
            let c = this.bm(a);
            this.dd._fill = c;
            this.dd._stroke = c;
            this.dd.ac = this.e.ey + 3;
            return this.dd;
        }
        a3(a, b) {
            super.a3(a, b);
            if (a.d) {
                for (let c = 0; c < this.c8.count; c++) {
                    let d = this.x(c, b);
                    this.ba(d, c, b);
                    a.v(d);
                }
            }
        }
        ai(a) {
            super.ai(a);
            let b = 0;
            let c = new List$1(Rectangle.$, 0);
            for (let d of fromEnum(this.c7.a)) {
                c.add(d);
            }
            c.aa((e, f) => {
                if (e.n < f.n) {
                    return -1;
                }
                else if (e.n > f.n) {
                    return 1;
                }
                else {
                    return 0;
                }
            });
            for (let e of fromEnum(c)) {
                this.e.a2.exportRectangleData(a, e, "column" + b, ["Main", "Fill"]);
            }
            b++;
        }
    }
    ColumnSeriesView.$t = /*@__PURE__*/ markType(ColumnSeriesView, 'ColumnSeriesView', AnchoredCategorySeriesView.$);
    return ColumnSeriesView;
})();
//# sourceMappingURL=ColumnSeries_combined.js.map
