/*
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 { Base, String_$type, markType } from "./type";
import { ISummaryResult_$type } from "./ISummaryResult";
import { List$1 } from "./List$1";
import { Dictionary$2 } from "./Dictionary$2";
/**
 * @hidden
 */
export let SectionData = /*@__PURE__*/ (() => {
    class SectionData extends Base {
        constructor() {
            super(...arguments);
            this.p = false;
            this.ae = 0;
            this.af = 0;
            this.ad = 0;
            this.e = null;
            this.f = null;
            this.i = null;
            this.j = null;
            this.h = null;
            this.g = null;
            this.aa = 0;
            this.ah = 0;
            this.ag = 0;
            this.u = 0;
            this.d = null;
            this.v = 0;
            this.b = null;
            this.t = -1;
            this.c = null;
            this.a = null;
            this.m = true;
            this.l = null;
        }
        get z() {
            return this.t;
        }
        set z(a) {
            this.t = a;
        }
        get ac() {
            return this.af + this.c.length - this.u;
        }
        get ab() {
            return this.ac + this.d[this.x()] - 1;
        }
        get q() {
            if (!this.r) {
                return false;
            }
            for (let a = 0; a < this.c.length; a++) {
                if (!this.c[a]) {
                    return false;
                }
            }
            return true;
        }
        get r() {
            return this.m;
        }
        set r(a) {
            this.m = a;
        }
        ai(a, b) {
            this.aj(a, b, this.e.length);
        }
        aj(a, b, c) {
            switch (a) {
                case 0:
                    this.c = new Array(1);
                    this.a = new Array(1);
                    break;
                case 1:
                    this.c = new Array(c);
                    this.a = new Array(c);
                    break;
            }
            for (let d = 0; d < this.c.length; d++) {
                this.c[d] = b;
            }
        }
        static s(a) {
            let b = new List$1(Dictionary$2.$.specialize(String_$type, ISummaryResult_$type), 0);
            if (a != null) {
                for (let c = 0; c < a.length; c++) {
                    if (a[c] == null) {
                        continue;
                    }
                    if (b.count == 0) {
                        b.add(new Dictionary$2(String_$type, ISummaryResult_$type, 0));
                    }
                    for (let d = 0; d < b.count; d++) {
                        if (!b._inner[d].containsKey(a[c].propertyName)) {
                            b._inner[d].addItem(a[c].propertyName, a[c]);
                            break;
                        }
                        else if (d == b.count - 1) {
                            b.add(new Dictionary$2(String_$type, ISummaryResult_$type, 0));
                        }
                    }
                }
            }
            return b;
        }
        k(a) {
            if (a >= this.af && a < this.af + this.c.length) {
                return 1;
            }
            if (a >= this.af + this.c.length && a < this.af + this.c.length + this.ah) {
                return 5;
            }
            if (a > this.ad - this.v - this.ag && a <= this.ad - this.v) {
                return 5;
            }
            if (a > this.ad - this.v && a <= this.ad) {
                return 2;
            }
            return 0;
        }
        y(a) {
            let b = -1;
            if (a >= this.af + this.c.length && a < this.af + this.c.length + this.ah) {
                b = a - (this.af + this.c.length);
            }
            if (a > this.ad - this.v - this.ag && a <= this.ad - this.v) {
                b = a - (this.ad - this.v - this.ag + 1);
            }
            return b;
        }
        w() {
            let a = 0;
            if (this.a != null) {
                for (let b = 0; b < this.a.length; b++) {
                    if (this.a[b] != null) {
                        a++;
                    }
                }
            }
            return a;
        }
        x() {
            if (this.a != null) {
                for (let a = 0; a < this.a.length; a++) {
                    if (this.a[a] != null) {
                        return a;
                    }
                }
            }
            return 0;
        }
        n() {
            return this.d[this.d.length - 1] > 0;
        }
        am(a) {
            for (let b = 0; b < this.g.length; b++) {
                if (this.g[b] == null) {
                    continue;
                }
                let c = this.j[b];
                let d = SectionData.s(c);
                for (let e = 0; e < d.count; e++) {
                    let f = new Array(d._inner[e].count);
                    d._inner[e].values.copyTo(f, 0);
                    this.g[b].a[e].summaryResults = f;
                    if (a != null) {
                        a(this.g[b].a[e]);
                    }
                }
            }
        }
        ak(a, b) {
            if (a == null || a.rowType != 5) {
                return;
            }
            if (b < 0 && b >= this.g[a.level - 1].a.length) {
                return;
            }
            this.g[a.level - 1].a[b] = a;
        }
        o() {
            for (let a = 0; a < this.g.length; a++) {
                if (this.g[a] != null) {
                    for (let b = 0; b < this.g[a].a.length; b++) {
                        if (this.g[a].a[b] != null) {
                            return true;
                        }
                    }
                }
            }
            return false;
        }
        an(a, b, c) {
            c.summaryIndex = b;
            this.j[a][b] = c;
            if (this.p && this.l != null) {
                this.l.j[a][b] = c;
            }
        }
        al(a, b) {
            for (let c = a - 1; c >= 0; c--) {
                if (this.h[c] != -1) {
                    this.h[c] += b;
                }
            }
        }
    }
    SectionData.$t = /*@__PURE__*/ markType(SectionData, 'SectionData');
    return SectionData;
})();
//# sourceMappingURL=SectionData.js.map
