/*
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, markType, INotifyPropertyChanged_$type, PropertyChangedEventArgs, runOn, delegateCombine, typeCast, delegateRemove, fromEn, enumGetBox, fromEnum, Number_$type } from "igniteui-webcomponents-core";
import { RenderingContext } from "igniteui-webcomponents-core";
import { FontInfo } from "igniteui-webcomponents-core";
import { CanvasViewRenderer } from "igniteui-webcomponents-core";
import { Size } from "igniteui-webcomponents-core";
import { NativeUI } from "igniteui-webcomponents-core";
import { FontUtil } from "igniteui-webcomponents-core";
import { List$1 } from "igniteui-webcomponents-core";
import { SRProvider } from "igniteui-webcomponents-core";
import { PropertyEditorPropertyDescriptionCollection } from "./PropertyEditorPropertyDescriptionCollection";
import { InputGroupDisplayType_$type } from "igniteui-webcomponents-inputs";
import { BaseControlTheme_$type } from "igniteui-webcomponents-core";
import { ControlDisplayDensity_$type } from "igniteui-webcomponents-core";
import { Dictionary$2 } from "igniteui-webcomponents-core";
import { Column } from "./Column";
import { FilterFactory } from "igniteui-webcomponents-core";
import { PropertyEditorPropertyDescription } from "./PropertyEditorPropertyDescription";
import { HorizontalPropertyEditorDataSource } from "./HorizontalPropertyEditorDataSource";
import { PropertyEditorDataSource } from "./PropertyEditorDataSource";
import { TextColumn } from "./TextColumn";
import { TemplateColumn } from "./TemplateColumn";
import { Thickness } from "igniteui-webcomponents-core";
import { ColumnWidth } from "./ColumnWidth";
import { PropertyEditorValueType_$type } from "./PropertyEditorValueType";
import { DropDownDataListItem } from "./DropDownDataListItem";
import { PropertyEditorTreeTransformer } from "./PropertyEditorTreeTransformer";
import { BrushUtil } from "igniteui-webcomponents-core";
import { truncate } from "igniteui-webcomponents-core";
/**
 * @hidden
 */
export let PropertyEditorView = /*@__PURE__*/ (() => {
    class PropertyEditorView extends Base {
        constructor() {
            super();
            this.o = null;
            this.n = null;
            this.b = null;
            this.j = null;
            this.m = null;
            this.f = null;
            this.l = null;
            this.c = ((() => {
                let $ret = new FontInfo();
                $ret.n = "Verdana";
                $ret.d = 13;
                $ret.q = "Normal";
                $ret.s = "Normal";
                $ret.o = "Normal";
                return $ret;
            })());
            this.ad = new Size();
            this.d = null;
            this._gridExternal = null;
            this.a = null;
            this.g = false;
            this.k = null;
        }
        y() {
        }
        w(a) {
            if (a == null) {
                this.j = null;
                return;
            }
            this.j = a;
            this.m = this.j.createElement("canvas");
            this.f = new RenderingContext(new CanvasViewRenderer(), this.j.get2DCanvasContext(this.m));
            this.l = this.j.createElement("div");
            this.ab();
            this.j.getPortal(this.j.rootWrapper, "DataGrid", (b) => {
                this._gridExternal = b.componentRef;
                this.a = (this._gridExternal.i);
                this._gridExternal.height = '100%';
                this.b.c9(this.a, null);
                this.aa();
            }, false);
            let b = Math.round(a.rootWrapper.width());
            let c = Math.round(a.rootWrapper.height());
            this.j.rootWrapper.setStyleProperty("position", "relative");
        }
        ab() {
        }
        aa() {
            if (this.j != null) {
            }
        }
        v() {
            let a = this.j.rootWrapper.width();
            let b = this.j.rootWrapper.height();
            this.ad = new Size(1, a, b);
            if (this.b.l != null) {
                this.b.du();
            }
        }
        ac() {
            let a = this.j;
            if (null == a) {
                return;
            }
            let b = a.rootWrapper;
            if (null != b) {
                NativeUI.n(b, this.b.d1);
                NativeUI.j(b, this.b.dx);
            }
        }
        e() {
            return this.c;
        }
        x() {
        }
        z() {
        }
        u() {
            let a = this.b.d2();
            if (a.height > 0) {
                this.j.rootWrapper.setStyleProperty("min-height", a.height + "px");
            }
        }
        h() {
            return this.ad.width;
        }
        i(a) {
            this.d = this.b.ae();
            return FontUtil.measureStringWidth(a, this.d, this.f);
        }
        s(a, b) {
            let cnt_ = a.content;
            let c = cnt_.element.getChildCount() > 0 ? cnt_.element.getChildAt(0) : null;
            let d = false;
            if (c == null) {
                this.j.getPortal(cnt_.element, "InputGroup", (e) => {
                    let contenti_ = cnt_.element.getChildCount() > 0 ? cnt_.element.getChildAt(0) : null;
                    d = true;
                    let inputExternal_ = e.componentRef;
                    let inputInternal_ = (inputExternal_.i);
                    let f = inputInternal_.view.s;
                    cnt_.__int = inputInternal_;
                    inputExternal_.width = '100%';
                    inputExternal_.height = '100%';
                    inputExternal_.style.lineHeight = '0';
                    this.j.getPortal(f, "Input", (g) => {
                        let iExternal_ = g.componentRef;
                        let iInternal_ = (iExternal_.i);
                        inputInternal_.inputs.add(iInternal_);
                        b(inputInternal_, d);
                    }, false);
                }, false);
            }
            else {
                let content_ = c;
                let impl_ = cnt_.__int;
                b(impl_, d);
            }
        }
        r(a, b) {
            let cnt_ = a.content;
            let c = cnt_.element.getChildCount() > 0 ? cnt_.element.getChildAt(0) : null;
            let d = false;
            if (c == null) {
                this.j.getPortal(cnt_.element, "MultiColumnComboBox", (e) => {
                    let contenti_ = cnt_.element.getChildCount() > 0 ? cnt_.element.getChildAt(0) : null;
                    d = true;
                    let inputExternal_ = e.componentRef;
                    let inputInternal_ = (inputExternal_.i);
                    cnt_.__int = inputInternal_;
                    inputExternal_.width = '100%';
                    inputExternal_.height = '100%';
                    inputExternal_.style.lineHeight = '0';
                    b(inputInternal_, d);
                }, false);
            }
            else {
                let content_ = c;
                let impl_ = cnt_.__int;
                b(impl_, d);
            }
        }
        q(a, b) {
            let cnt_ = a.content;
            let c = cnt_.element.getChildCount() > 0 ? cnt_.element.getChildAt(0) : null;
            let d = false;
            if (c == null) {
                this.j.getPortal(cnt_.element, "Checkbox", (e) => {
                    let contenti_ = cnt_.element.getChildCount() > 0 ? cnt_.element.getChildAt(0) : null;
                    d = true;
                    let inputExternal_ = e.componentRef;
                    let inputInternal_ = (inputExternal_.i);
                    cnt_.__int = inputInternal_;
                    inputExternal_.width = '100%';
                    inputExternal_.height = '100%';
                    inputExternal_.style.lineHeight = '0';
                    b(inputInternal_, d);
                }, false);
            }
            else {
                let content_ = c;
                let impl_ = cnt_.__int;
                b(impl_, d);
            }
        }
        t(a, b) {
            if (this.k == null) {
                this.k = this.j.createElement("div");
            }
            b(this.k.getNativeElement());
        }
    }
    PropertyEditorView.$t = /*@__PURE__*/ markType(PropertyEditorView, 'PropertyEditorView');
    return PropertyEditorView;
})();
/**
 * @hidden
 */
export let PropertyEditor = /*@__PURE__*/ (() => {
    class PropertyEditor extends Base {
        constructor() {
            super();
            this.s = null;
            this.l = null;
            this.ab = null;
            this.d = null;
            this.ah = false;
            this.c = null;
            this.x = null;
            this.y = null;
            this.ai = false;
            this.af = null;
            this.propertyChanged = null;
            this.al = false;
            this.o = null;
            this.p = new PropertyEditorPropertyDescriptionCollection();
            this.bq = null;
            this.z = 3;
            this.bg = -1;
            this.ac = null;
            this.t = 1;
            this.v = 2;
            this.bo = null;
            this.ap = new Dictionary$2(Column.$, Number_$type, 0);
            this.h = null;
            this.i = null;
            this.f = null;
            this.bm = null;
            this.bp = null;
            this.aj = false;
            this.ak = false;
            this.dv = PropertyEditor.dy;
            this.dw = PropertyEditor.dz;
            this.bk = 0;
            this.bh = -1;
            this.m = null;
            this.d = new FilterFactory();
            let a = new PropertyEditorView();
            a.b = this;
            let b = this.properties;
            b.collectionChanged = delegateCombine(b.collectionChanged, runOn(this, this.dn));
            this.s = a;
            this.s.y();
        }
        get e() {
            if (this.l == null) {
                return null;
            }
            return this.l.actualDataSource;
        }
        get ag() {
            if (this.af == null) {
                this.af = new SRProvider(this.s.j);
                this.af.cb("DataGrid");
            }
            return this.af;
        }
        dn(a, b) {
            if (b.oldItems != null) {
                for (let c of fromEn(b.oldItems)) {
                    if (typeCast(INotifyPropertyChanged_$type, c) !== null) {
                        let d = c;
                        d.propertyChanged = delegateRemove(d.propertyChanged, runOn(this, this.dc));
                    }
                }
            }
            if (b.newItems != null) {
                for (let e of fromEn(b.newItems)) {
                    if (typeCast(INotifyPropertyChanged_$type, e) !== null) {
                        let f = e;
                        f.propertyChanged = delegateCombine(f.propertyChanged, runOn(this, this.dc));
                    }
                }
            }
            this.ao();
            if (this.properties.count > 0 && this.actualProperties != this.properties) {
                this.actualProperties = this.properties;
            }
            if (this.l != null) {
                this.l.rg();
            }
        }
        dc(a, b) {
            if (!this.al) {
                this.ao();
                if (this.l != null) {
                    this.du();
                }
            }
        }
        notifySizeChanged() {
            this.s.v();
        }
        c9(a, b) {
            this.l = a;
            if (null != this.l) {
                this.l.lt = 0;
                this.l.l3 = 0;
                this.l.hc = false;
                this.l.cm = 0;
                this.l.cg = 0;
                let c = this.l;
                c.cellClicked = delegateCombine(c.cellClicked, runOn(this, this.c8));
                if (this.actualProperties != null) {
                    this.l.itemsSource = this.actualProperties;
                    this.ce();
                }
                if (this.actualProperties != null) {
                    this.du();
                }
            }
        }
        destroy() {
            if (this.l != null) {
                let a = this.l;
                a.cellClicked = delegateRemove(a.cellClicked, runOn(this, this.c8));
            }
            if (this.x != null) {
                let b = this.x;
                b.change = delegateRemove(b.change, runOn(this, this.db));
            }
            this.provideContainer(null);
        }
        provideContainer(a) {
            this.s.w(a);
        }
        c8(a, b) {
        }
        dj(a) {
        }
        get actualProperties() {
            return this.o;
        }
        set actualProperties(a) {
            let b = this.o;
            this.o = a;
            if (b != this.o) {
                this.dk("ActualProperties", b, this.o);
            }
        }
        get properties() {
            return this.p;
        }
        set properties(a) {
            let b = this.p;
            this.p = a;
            if (b != this.p) {
                this.dk("Properties", b, this.p);
            }
        }
        get b2() {
            return this.bq;
        }
        set b2(a) {
            let b = this.bq;
            this.bq = a;
            if (b != this.bq) {
                this.dk("FilterPlaceholderText", b, this.bq);
            }
        }
        get aa() {
            return this.z;
        }
        set aa(a) {
            let b = this.z;
            this.z = a;
            if (b != this.z) {
                this.dk("SearchInputType", enumGetBox(InputGroupDisplayType_$type, b), enumGetBox(InputGroupDisplayType_$type, this.z));
            }
        }
        get bl() {
            return this.bg;
        }
        set bl(a) {
            let b = this.bg;
            this.bg = a;
            if (b != this.bg) {
                this.dk("RowHeight", b, this.bg);
            }
        }
        get ad() {
            return this.ac;
        }
        set ad(a) {
            let b = this.ac;
            this.ac = a;
            if (b != this.ac) {
                this.dk("CellTextStyle", b, this.ac);
            }
        }
        ae() {
            if (this.ad == null) {
                return this.s.e();
            }
            return this.ad;
        }
        get u() {
            return this.t;
        }
        set u(a) {
            let b = this.t;
            this.t = a;
            if (b != this.t) {
                this.dk("BaseTheme", enumGetBox(BaseControlTheme_$type, b), enumGetBox(BaseControlTheme_$type, this.t));
            }
        }
        get w() {
            return this.v;
        }
        set w(a) {
            let b = this.v;
            this.v = a;
            if (b != this.v) {
                this.dk("Density", enumGetBox(ControlDisplayDensity_$type, b), enumGetBox(ControlDisplayDensity_$type, this.v));
            }
        }
        dk(a, b, c) {
            if (this.propertyChanged != null) {
                this.propertyChanged(this, new PropertyChangedEventArgs(a));
            }
            this.dp(a, b, c);
        }
        dp(a, b, c) {
            switch (a) {
                case "DescriptionType":
                    if (this.b0 == null) {
                        if (this.properties == null) {
                            this.actualProperties = null;
                        }
                    }
                    if (this.b0 != null) {
                        if (this.m == null) {
                            this.m = new PropertyEditorDataSource();
                        }
                        this.m.l = this.b0;
                    }
                    if (this.properties == null || this.properties.count == 0) {
                        if (this.m.g != null) {
                            this.actualProperties = this.m.g;
                        }
                    }
                    else {
                        if (this.properties != null && this.properties.count > 0) {
                            this.ao();
                        }
                    }
                    break;
                case "ComponentRenderer":
                    if (this.g == null) {
                        this.j = this.k;
                    }
                    else {
                        this.j = this.g.context;
                    }
                    break;
                case "Target": break;
                case "Context":
                    if (this.g == null) {
                        this.j = c;
                    }
                    break;
                case "ActualContext":
                    if (this.j == null) {
                        if (this.properties == null) {
                            this.actualProperties = null;
                        }
                    }
                    if (this.j != null) {
                        if (this.m == null) {
                            this.m = new PropertyEditorDataSource();
                        }
                        this.m.b = this.j;
                    }
                    if (this.properties == null || this.properties.count == 0) {
                        if (this.m.g != null) {
                            this.actualProperties = this.m.g;
                        }
                    }
                    else {
                        if (this.properties != null && this.properties.count > 0) {
                            this.ao();
                        }
                    }
                    break;
                case "Properties":
                    this.actualProperties = this.properties;
                    break;
                case "IsWrappingEnabled":
                    this.du();
                    break;
                case "IsHorizontal":
                    if (this.am) {
                        if (this.actualProperties != null && !(typeCast(HorizontalPropertyEditorDataSource.$, this.actualProperties) !== null)) {
                            this.actualProperties = new HorizontalPropertyEditorDataSource(this.actualProperties);
                        }
                    }
                    else {
                        if (typeCast(HorizontalPropertyEditorDataSource.$, this.actualProperties) !== null) {
                            let d = this.actualProperties;
                            this.actualProperties = d.ae;
                        }
                    }
                    break;
                case "ActualProperties":
                    if (this.am) {
                        if (this.actualProperties != null && !(typeCast(HorizontalPropertyEditorDataSource.$, this.actualProperties) !== null)) {
                            this.actualProperties = new HorizontalPropertyEditorDataSource(this.actualProperties);
                        }
                    }
                    else {
                        if (typeCast(HorizontalPropertyEditorDataSource.$, this.actualProperties) !== null) {
                            let e = this.actualProperties;
                            this.actualProperties = e.ae;
                        }
                    }
                    if (this.l != null) {
                        if (c != null) {
                            this.l.a8.m();
                            this.l.b5.m();
                            this.l.v.clear();
                            this.l.b8.m();
                        }
                        if (this.l.actualDataSource != null) {
                            let f = this.l.actualDataSource;
                            f.schemaChanged = delegateRemove(f.schemaChanged, runOn(this, this.dm));
                        }
                        let g = this.l.itemsSource != this.actualProperties;
                        let h = this.actualProperties;
                        h = this.actualProperties.toArray();
                        this.l.itemsSource = h;
                        this.ce();
                        if (this.l.actualDataSource != null) {
                            let i = this.l.actualDataSource;
                            i.schemaChanged = delegateCombine(i.schemaChanged, runOn(this, this.dm));
                        }
                        if (g) {
                            this.du();
                        }
                    }
                    break;
                case "FilterPlaceholderText":
                    if (this.x != null) {
                        this.x.b8 = this.b2;
                    }
                    break;
                case "SearchInputType":
                    if (this.y != null) {
                        this.y.k = this.aa;
                    }
                    break;
                case "RowHeight":
                    if (this.l != null) {
                        this.l.l1 = this.bl;
                    }
                    break;
                case "CellTextStyle":
                    if (this.l != null) {
                        this.l.fu = this.ad;
                    }
                    break;
                case "BackgroundColor":
                case "TextColor":
                    let j = this.l;
                    if (null != j) {
                        j.v4 = this.d1;
                        j.v2 = this.dx;
                    }
                    this.s.ac();
                    break;
                case "BaseTheme":
                    this.dt();
                    break;
                case "Density":
                    this.ds();
                    break;
            }
        }
        ao() {
            let a = this.al;
            this.al = true;
            let b = false;
            for (let c of fromEnum(this.properties)) {
                let d = c.y;
                if (this.m != null) {
                    let e = this.m.d(d, false);
                    if (e != null) {
                        if (c.m(e)) {
                            b = true;
                        }
                    }
                }
            }
            if (b) {
                this.du();
            }
            else if (this.l != null) {
                this.l.rg();
            }
            this.al = a;
            return b;
        }
        ds() {
            if (this.l != null) {
                this.l.fl = this.w;
            }
            if (this.y != null) {
                this.y.h = this.w;
            }
            this.s.x();
        }
        dt() {
            if (this.y != null) {
                this.y.d = this.u;
            }
            this.s.z();
        }
        dm(a, b) {
            this.ai = true;
            this.ce();
            this.ai = false;
        }
        du() {
            this.ap.clear();
            this.l.actualColumns.clear();
            this.l.h5 = false;
            this.l.l1 = this.bl == -1 ? 38 : this.bl;
            this.l.v2 = this.dx;
            this.l.v3 = this.dx;
            this.l.fl = this.w;
            this.l.w8 = new Thickness(0, 0);
            if (this.ad != null) {
                this.l.fu = this.ad;
            }
            if (this.am) {
                this.cg();
            }
            else {
                let a = new TextColumn();
                a.h4 = "PropertyPath";
                a.dataBinding = delegateCombine(a.dataBinding, runOn(this, this.dd));
                this.l.columns.add(a);
                let b = new TemplateColumn();
                b.h4 = "ValueType";
                b.dataBinding = delegateCombine(b.dataBinding, runOn(this, this.cl));
                b.cellStyleKeyRequested = delegateCombine(b.cellStyleKeyRequested, runOn(this, this.cj));
                b.cellUpdating = delegateCombine(b.cellUpdating, runOn(this, this.ck));
                this.l.columns.add(b);
            }
        }
        cg() {
            if (this.actualProperties == null) {
                return;
            }
            let a = this.actualProperties.ae;
            let b = a.count;
            let c = new List$1(Column.$, 0);
            let d = this.bi(a, b, c, 0x7FFFFFFF);
            for (let e = 0; e < c.count; e++) {
                this.l.columns.add(c._inner[e]);
            }
            this.bk = d;
            let f = this.actualProperties;
            let g = f.count;
            f.clear();
            for (let h = 0; h < this.bk; h++) {
                f.add(new PropertyEditorPropertyDescription());
            }
            if (f.count != g) {
                let i = f.toArray();
                this.l.itemsSource = i;
                this.s.u();
            }
        }
        d2() {
            if (this.am && this.l != null && this.l.itemsSource != null) {
                let a = this.l.k8;
                let b = this.l.itemsSource;
                return new Size(1, 0, b.count * a);
            }
            else {
                return new Size(1, 0, 0);
            }
        }
        bi(a, b, c, d) {
            let e = 0;
            let f = 0;
            let g = 0;
            let h = this.s.h();
            h -= 5;
            if (!this.an) {
                h = 1.7976931348623157E+308;
            }
            let i = 0;
            let j = h;
            for (let k = 0; k < b; k++) {
                let l = a.item(k);
                let m = this.a7(l);
                let n = this.a3(l);
                if ((i + m + n > h && g > 0) || g >= d) {
                    d = Math.max(Math.min(d, g), 2);
                    f++;
                    let o = h - i;
                    if (o < j) {
                        j = o;
                    }
                    i = 0;
                    g = 0;
                }
                let p = this.b5(l);
                if (c.count <= g) {
                    let q = new TextColumn();
                    q.width = ((() => {
                        let $ret = new ColumnWidth();
                        $ret.c = false;
                        $ret.f = m;
                        return $ret;
                    })());
                    q.dataBinding = delegateCombine(q.dataBinding, runOn(this, this.dd));
                    q.il = "PropertyName_" + k;
                    q.h4 = "PropertyName";
                    c.add(q);
                    this.ap.item(q, c.count - 1);
                    g++;
                }
                else {
                    let r = c._inner[g];
                    if (m > r.width.f) {
                        let s = m - r.width.f;
                        r.width = ((() => {
                            let $ret = new ColumnWidth();
                            $ret.c = false;
                            $ret.f = m;
                            return $ret;
                        })());
                        if (s > j) {
                            this.dr(h, c);
                            if (c.count == 0) {
                                return 0;
                            }
                            return this.bi(a, b, c, c.count);
                        }
                        else {
                            j -= s;
                            g++;
                        }
                    }
                    else {
                        m = r.width.f;
                        g++;
                    }
                }
                if (c.count <= g) {
                    let t = new TemplateColumn();
                    t.il = "ValueType_" + k;
                    t.h4 = "ValueType";
                    t.dataBinding = delegateCombine(t.dataBinding, runOn(this, this.cl));
                    t.width = ((() => {
                        let $ret = new ColumnWidth();
                        $ret.c = false;
                        $ret.f = n;
                        return $ret;
                    })());
                    t.cellStyleKeyRequested = delegateCombine(t.cellStyleKeyRequested, runOn(this, this.cj));
                    t.cellUpdating = delegateCombine(t.cellUpdating, runOn(this, this.ck));
                    c.add(t);
                    this.ap.item(t, c.count - 1);
                    g++;
                }
                else {
                    let u = c._inner[g];
                    if (n > u.width.f) {
                        let v = n - u.width.f;
                        u.width = ((() => {
                            let $ret = new ColumnWidth();
                            $ret.c = false;
                            $ret.f = n;
                            return $ret;
                        })());
                        if (v > j) {
                            this.dr(h, c);
                            if (c.count == 0) {
                                return 0;
                            }
                            return this.bi(a, b, c, c.count);
                        }
                        else {
                            j -= v;
                            g++;
                        }
                    }
                    else {
                        n = u.width.f;
                        g++;
                    }
                }
                i += m + n;
            }
            return f + 1;
        }
        dr(a, b) {
            let c = 0;
            for (let d of fromEnum(b)) {
                c += d.width.f;
            }
            while (c > a) {
                if (b.count < 1) {
                    return;
                }
                if (typeCast(TemplateColumn.$, b._inner[b.count - 1]) !== null) {
                    c -= b._inner[b.count - 1].width.f;
                    c -= b._inner[b.count - 2].width.f;
                    b.removeAt(b.count - 1);
                    b.removeAt(b.count - 1);
                }
                else {
                    c -= b._inner[b.count - 1].width.f;
                    b.removeAt(b.count - 1);
                }
            }
        }
        cl(a, b) {
            let c = a;
            let d = this.n(c, b.cellInfo.ej, b.rowObject);
            b.resolvedValue = enumGetBox(PropertyEditorValueType_$type, d != null ? d.k : 0);
        }
        dd(a, b) {
            let c = a;
            let d = this.n(c, b.cellInfo.ej, b.rowObject);
            if (d == null) {
                b.resolvedValue = null;
                return;
            }
            b.resolvedValue = d.w != null ? d.w : d.y;
        }
        a3(a) {
            switch (a.k) {
                case 10: return this.aq(a);
                case 7: return this.ar(a);
                case 4: return this.at(a);
                case 6: return this.as(a);
                case 9: return this.aw(a);
                case 5: return this.ay(a);
                case 14: return this.ax(a);
                case 18: return this.az(a);
                case 3: return this.a0(a);
                case 15: return this.a4(a);
                case 17: return this.a5(a);
                case 16: return this.a8(a);
                case 1: return this.a9(a);
                case 11: return this.ba(a);
                case 13: return this.bb(a);
                case 12: return this.bc(a);
                case 2: return this.bd(a);
                case 8: return this.be(a);
                case 19: return this.bf(a);
                case 0: return this.a6(a);
            }
            return 100;
        }
        bf(a) {
            return this.a6(a);
        }
        a6(a) {
            return 250;
        }
        au(a) {
            return 100;
        }
        be(a) {
            return this.au(a);
        }
        bd(a) {
            return this.a6(a);
        }
        bc(a) {
            return this.a6(a);
        }
        bb(a) {
            return this.a6(a);
        }
        ba(a) {
            return this.a6(a);
        }
        a9(a) {
            return this.a6(a);
        }
        a8(a) {
            return this.au(a);
        }
        a5(a) {
            return this.au(a);
        }
        a4(a) {
            return this.a2(a);
        }
        a2(a) {
            return this.a6(a);
        }
        a0(a) {
            return this.a1(a);
        }
        a1(a) {
            return this.a6(a);
        }
        az(a) {
            return this.au(a);
        }
        ax(a) {
            return this.au(a);
        }
        ay(a) {
            return this.a6(a);
        }
        aw(a) {
            return this.au(a);
        }
        as(a) {
            return this.au(a);
        }
        at(a) {
            return this.a6(a);
        }
        ar(a) {
            return this.av(a);
        }
        av(a) {
            return 50;
        }
        aq(a) {
            return this.au(a);
        }
        a7(a) {
            return this.s.i(this.b5(a)) + 30;
        }
        b5(a) {
            return a.w != null ? a.w : a.y;
        }
        ck(a, b) {
            let c = a;
            let d = this.n(c, b.cellInfo.ej, b.cellInfo.gq);
            let e = d != null ? d.k : 0;
            switch (e) {
                case 10:
                    this.cm(c, b);
                    break;
                case 7:
                    this.cn(c, b);
                    break;
                case 4:
                    this.cp(c, b);
                    break;
                case 6:
                    this.co(c, b);
                    break;
                case 9:
                    this.cq(c, b);
                    break;
                case 5:
                    this.cs(c, b);
                    break;
                case 14:
                    this.cr(c, b);
                    break;
                case 18:
                    this.ct(c, b);
                    break;
                case 3:
                    this.cu(c, b);
                    break;
                case 15:
                    this.cx(c, b);
                    break;
                case 17:
                    this.cy(c, b);
                    break;
                case 16:
                    this.c0(c, b);
                    break;
                case 1:
                    this.c1(c, b);
                    break;
                case 11:
                    this.c2(c, b);
                    break;
                case 13:
                    this.c3(c, b);
                    break;
                case 12:
                    this.c4(c, b);
                    break;
                case 2:
                    this.c5(c, b);
                    break;
                case 8:
                    this.c6(c, b);
                    break;
                case 19:
                    this.c7(c, b);
                    break;
                case 0: break;
            }
        }
        c7(a, b) {
            this.cz(a, b);
        }
        c6(a, b) {
        }
        c5(a, b) {
            this.cz(a, b);
        }
        c4(a, b) {
            this.cz(a, b);
        }
        c3(a, b) {
            this.cz(a, b);
        }
        c2(a, b) {
            this.cz(a, b);
        }
        c1(a, b) {
            this.cz(a, b);
        }
        cz(a, b) {
            this.s.s(b, (c, d) => {
                if (c.k != 2) {
                    c.k = 2;
                }
                if (c.h != 3) {
                    c.h = 3;
                }
                let e = this.n(a, b.cellInfo.ej, b.cellInfo.gq);
                let f = c.inputs._inner[0];
                f.bb = e;
                f.cg = e.q;
                if (d) {
                    f.changing = delegateCombine(f.changing, runOn(this, this.da));
                }
            });
        }
        cw(a, b) {
            this.s.r(b, (c, d) => {
                if (c.density != 3) {
                    c.density = 3;
                }
                let e = this.n(a, b.cellInfo.ej, b.cellInfo.gq);
                if (c.c0 != e) {
                    if (!d) {
                        c.valueChanged = delegateRemove(c.valueChanged, runOn(this, this.ch));
                    }
                    c.c0 = e;
                    c.c1 = null;
                    c.itemsSource = this.b(this.a(e));
                    if (e.q != c.c1) {
                        c.c1 = e.q;
                    }
                    if (!d) {
                        c.valueChanged = delegateCombine(c.valueChanged, runOn(this, this.ch));
                    }
                }
                else {
                    if (e.q != c.c1) {
                        c.c1 = e.q;
                    }
                }
                if (d) {
                    c.valueChanged = delegateCombine(c.valueChanged, runOn(this, this.ch));
                    c.hd = BrushUtil.g(255, 255, 255, 255);
                    c.g = ["Name"];
                    c.columnHeadersVisible = false;
                    c.defaultColumnWidth = ((() => {
                        let $ret = new ColumnWidth();
                        $ret.c = false;
                        $ret.f = this.a3(e);
                        return $ret;
                    })());
                    c.fe = "Name";
                }
            });
        }
        b(a) {
            let b = new List$1(DropDownDataListItem.$, 0);
            for (let c = 0; c < a.length; c++) {
                b.add(((() => {
                    let $ret = new DropDownDataListItem();
                    $ret.Name = a[c];
                    $ret.Value = a[c];
                    return $ret;
                })()));
            }
            return b.toArray();
        }
        a(a) {
            return a.c;
        }
        ch(a, b) {
            let c = a;
            let d = c.c0;
            this.al = true;
            d.q = c.c1;
            this.al = false;
            this.dl(d);
        }
        da(a, b) {
            let c = a;
            let d = c.bb;
            this.al = true;
            d.q = c.cg;
            this.al = false;
            this.dl(d);
        }
        dl(a) {
            if (this.bn != null && this.g != null) {
                let b = this.bo == null;
                this.bo = this.b4();
                if (b) {
                    this.s.t(this.bn, (c) => this.g.loadJsonOverlay(this.bo, (d) => c, (d) => this.bn));
                }
                else {
                    this.s.t(this.bn, (c) => this.g.loadJsonDelta(this.bo, (d) => c, false));
                }
            }
        }
        b4() {
            if (this.actualProperties == null) {
                return null;
            }
            let a = this.actualProperties;
            if (typeCast(HorizontalPropertyEditorDataSource.$, a) !== null) {
                a = a.ae;
            }
            let b = new PropertyEditorTreeTransformer(this.j, this.b0);
            this.cv(a, "", b, this.b0);
            return b.g();
        }
        cv(a, b, c, d) {
            for (let e = 0; e < a.count; e++) {
                let f = a._inner[e];
                if (f.i != null) {
                    for (let g = 0; g < f.i.count; g++) {
                        let h = f.i._inner[g];
                        let i = b + f.y + "[" + g + "]";
                        this.cv(h.a, i, c, h.b);
                    }
                }
                else if (f.g != null) {
                    let j = b + f.y;
                    this.cv(f.g.a, j, c, f.g.b);
                }
                else {
                    c.h(b + f.y, f.q, d);
                }
            }
        }
        c0(a, b) {
        }
        cy(a, b) {
        }
        cx(a, b) {
            this.cw(a, b);
        }
        cu(a, b) {
        }
        ct(a, b) {
        }
        cr(a, b) {
        }
        cs(a, b) {
            this.cz(a, b);
        }
        cq(a, b) {
        }
        co(a, b) {
        }
        cp(a, b) {
            this.cz(a, b);
        }
        cn(a, b) {
            this.s.q(b, (c, d) => {
                if (!c.t) {
                    c.t = true;
                }
                let e = this.n(a, b.cellInfo.ej, b.cellInfo.gq);
                let f = e.q;
                if (f == null) {
                    f = false;
                }
                let g = f;
                c.checked = g;
                c.a5 = e;
                if (d) {
                    c.change = delegateCombine(c.change, runOn(this, this.cf));
                }
            });
        }
        n(a, b, c) {
            if (this.am) {
                let d = this.actualProperties.ae;
                let e = d;
                let f = truncate((this.l.actualColumns.count / 2));
                let g = b * f;
                let h = this.bj(a);
                h = truncate(Math.floor(h / 2)) + g;
                if (h > e.count - 1) {
                    return null;
                }
                return e.item(h);
            }
            else {
                return c;
            }
        }
        bj(a) {
            return this.ap.item(a);
        }
        cf(a, b) {
            let c = a;
            let d = c.a5;
            this.al = true;
            d.q = c.checked;
            this.al = false;
            this.dl(d);
        }
        cm(a, b) {
        }
        cj(a, b) {
            let c = a;
            let d = b;
            if (!this.am) {
                d = this.actualProperties._inner[b.rowNumber];
            }
            let e = this.n(c, b.rowNumber, d);
            let f = e != null ? e.k : 0;
            b.styleKey = "editortype_" + enumGetBox(PropertyEditorValueType_$type, f);
        }
        db(a, b) {
            let c = b.value.toLowerCase();
            this.dj(c);
        }
        dh(a, b, c) {
            if (this.l != null) {
                this.l.rm(a, b, c);
            }
        }
        de() {
            if (this.l != null) {
                this.l.rg();
            }
        }
        df(a, b) {
            if (this.l != null) {
                this.l.ri(a, b);
            }
            ;
        }
        dg(a, b) {
            if (this.l != null) {
                this.l.rj(a, b);
            }
            ;
        }
        get j() {
            return this.h;
        }
        set j(a) {
            let b = this.h;
            this.h = a;
            this.dk("ActualContext", b, this.h);
        }
        get k() {
            return this.i;
        }
        set k(a) {
            let b = this.i;
            this.i = a;
            this.dk("Context", b, this.i);
        }
        get g() {
            return this.f;
        }
        set g(a) {
            let b = this.f;
            this.f = a;
            this.dk("ComponentRenderer", b, this.f);
        }
        get bn() {
            return this.bm;
        }
        set bn(a) {
            let b = this.bm;
            this.bm = a;
            this.dk("Target", b, this.bm);
        }
        get b0() {
            return this.bp;
        }
        set b0(a) {
            let b = this.bp;
            this.bp = a;
            this.dk("DescriptionType", b, this.bp);
        }
        get am() {
            return this.aj;
        }
        set am(a) {
            let b = this.aj;
            this.aj = a;
            this.dk("IsHorizontal", b, this.aj);
        }
        get an() {
            return this.ak;
        }
        set an(a) {
            let b = this.ak;
            this.ak = a;
            this.dk("IsWrappingEnabled", b, this.ak);
        }
        get dx() {
            return this.dv;
        }
        set dx(a) {
            let b = this.dv;
            this.dv = a;
            if (b != this.dv) {
                this.dk("BackgroundColor", b, a);
            }
        }
        get d1() {
            return this.dw;
        }
        set d1(a) {
            let b = this.dw;
            this.dw = a;
            if (b != this.dw) {
                this.dk("TextColor", b, a);
            }
        }
        ce() {
            let a = this.l.actualDataSource;
            if (null != a) {
                if (null == a.actualSchema) {
                    this.bh = -1;
                    return;
                }
                let b = a.actualCount;
                this.bh = b;
            }
            else {
                this.bh = -1;
            }
        }
    }
    PropertyEditor.$t = /*@__PURE__*/ markType(PropertyEditor, 'PropertyEditor', Base.$, [INotifyPropertyChanged_$type]);
    PropertyEditor.d0 = /*@__PURE__*/ BrushUtil.g(255, 24, 29, 31);
    PropertyEditor.cb = "M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z";
    PropertyEditor.dy = /*@__PURE__*/ BrushUtil.g(255, 248, 248, 248);
    PropertyEditor.dz = /*@__PURE__*/ BrushUtil.g(255, 24, 29, 31);
    return PropertyEditor;
})();
//# sourceMappingURL=PropertyEditorView_combined.js.map
