/*
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 { GridColumnOptionsViewBase } from "./GridColumnOptionsViewBase";
import { Size } from "igniteui-webcomponents-core";
import { GridColumnOptionsUtilities } from "./GridColumnOptionsUtilities";
import { runOn, delegateCombine, markType, delegateRemove } from "igniteui-webcomponents-core";
import { GridColumnOptionsSimpleSectionBase } from "./GridColumnOptionsSimpleSectionBase";
import { ColumnGroupDescription } from "./ColumnGroupDescription";
import { StringComparer } from "igniteui-webcomponents-core";
/**
 * @hidden
 */
export let GridColumnGroupOptionsView = /*@__PURE__*/ (() => {
    class GridColumnGroupOptionsView extends GridColumnOptionsViewBase {
        constructor() {
            super(...arguments);
            this.s = null;
            this.p = null;
            this.r = null;
            this.o = null;
            this.t = null;
            this.q = false;
        }
        get n() {
            return this.b;
        }
        x() {
            if (null == this.p) {
                return;
            }
            this.q = true;
            try {
                let a = this.n.b3;
                if (a) {
                    this.p.svgPath = GridColumnGroupOptionsView.v;
                }
                else {
                    this.p.svgPath = GridColumnGroupOptionsView.u;
                }
            }
            finally {
                this.q = false;
            }
        }
        k() {
            super.k();
            if (null == this.g || null == this.e) {
                return;
            }
            let a = this.e;
            let b = this.n;
            let c = this.g;
            this.r = ((() => { let d = GridColumnOptionsUtilities.g(a, GridColumnGroupOptionsView.u, 1, b.p, b.j, new Size(1, 24, 24), this.o, this.p, this.s, this.t, false, true, false); this.o = d.p6; this.p = d.p7; this.s = d.p8; this.t = d.p9; return d.ret; })());
            let d = this.o;
            d.clicked = delegateCombine(d.clicked, runOn(this, this.w));
            c.append(this.r);
        }
        m() {
            super.m();
            this.x();
            let a = this.n;
            if (null != this.s) {
                this.s.setRawText(this.n.bw);
                let b = this.n.bu;
                GridColumnOptionsUtilities.j(this.s, b, "inline-block");
                if (b) {
                    this.o.s = 1;
                    this.o.fv = "stretch";
                    this.t.setStyleProperty("justify-content", "space-between");
                }
                else {
                    this.o.s = 4;
                    this.o.fv = "center";
                    this.t.setStyleProperty("justify-content", "center");
                }
                this.s.setStyleProperty("font", a.aa.fontString);
            }
            a.bf(this.o);
        }
        w(a, b) {
            if (this.q) {
                return;
            }
            let c = this.n.b3;
            this.n.b3 = !c;
        }
    }
    GridColumnGroupOptionsView.$t = /*@__PURE__*/ markType(GridColumnGroupOptionsView, 'GridColumnGroupOptionsView', GridColumnOptionsViewBase.$);
    GridColumnGroupOptionsView.u = "M9,19v-2h11v2H9z M9,15v-2h11v2H9z M9,11V9h11v2H9z M7,7V5h13v2H7z M4,5h2v2H4V5z";
    GridColumnGroupOptionsView.v = "M16.8,18.3H9.6v-2h5.2l-2-2H9.6v-2h1.2L3.4,4.9l1.4-1.4l15.6,15.6L19,20.5L16.8,18.3z M20.6,14.3h-2.2l-2-2h4.2V14.3  L20.6,14.3z M20.6,10.3h-6.2l-2-2h8.2L20.6,10.3L20.6,10.3L20.6,10.3z M20.6,6.3H10.4l-2-2h12.2L20.6,6.3L20.6,6.3L20.6,6.3z";
    return GridColumnGroupOptionsView;
})();
/**
 * @hidden
 */
export let GridColumnGroupOptions = /*@__PURE__*/ (() => {
    class GridColumnGroupOptions extends GridColumnOptionsSimpleSectionBase {
        constructor() {
            super();
        }
        f() {
            return new GridColumnGroupOptionsView();
        }
        get_by() {
            return "Group Column";
        }
        get by() {
            return this.get_by();
        }
        bq() {
            if (null == this.column) {
                return false;
            }
            if (null == this.c) {
                return false;
            }
            return true;
        }
        bh(a, b) {
            if (null != a) {
                a.groupDescriptionsChanged = delegateRemove(a.groupDescriptionsChanged, runOn(this, this.b4));
            }
            if (null != b) {
                b.groupDescriptionsChanged = delegateCombine(b.groupDescriptionsChanged, runOn(this, this.b4));
            }
        }
        bc(a, b, c) {
            super.bc(a, b, c);
        }
        get b3() {
            let a;
            let b = this.b1(a);
            a = b.p0;
            return a != -1;
        }
        set b3(a) {
            if (a) {
                this.b5();
            }
            else {
                this.b6();
            }
        }
        get b2() {
            return this.e;
        }
        b1(a) {
            let b = this.column;
            return {
                ret: ((() => { let c = GridColumnGroupOptions.b0(b, a); a = c.p1; return c.ret; })()),
                p0: a
            };
        }
        static b0(a, b) {
            if (null != a) {
                let c = a.grid;
                if (null != c) {
                    let d = a.h4;
                    let e = c.a8.i;
                    for (let f = 0; f < e.count; f++) {
                        let g = e.item(f);
                        let h = g.f;
                        if (0 == StringComparer.b.compare(d, h)) {
                            b = f;
                            return {
                                ret: g,
                                p1: b
                            };
                        }
                    }
                }
            }
            b = -1;
            return {
                ret: null,
                p1: b
            };
        }
        b5() {
            let a = this.c;
            let b = this.column;
            if (null != a && null != b) {
                let c = new ColumnGroupDescription(1, b.h4);
                let d = b.e6;
                let e = d != 0 ? GridColumnOptionsUtilities.c(d) : 0;
                c.c = e;
                a.a8.g(c);
                b.e6 = 0;
            }
        }
        b6() {
            let a = this.c;
            let b = this.column;
            if (null != a && null != b) {
                let c;
                let d = ((() => { let e = this.b1(c); c = e.p0; return e.ret; })());
                if (c != -1) {
                    a.a8.d(c);
                }
            }
        }
        b4(a, b) {
            this.b2.m();
        }
    }
    GridColumnGroupOptions.$t = /*@__PURE__*/ markType(GridColumnGroupOptions, 'GridColumnGroupOptions', GridColumnOptionsSimpleSectionBase.$);
    return GridColumnGroupOptions;
})();
//# sourceMappingURL=GridColumnGroupOptionsView_combined.js.map
