/*
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, INotifyPropertyChanged_$type, PropertyChangedEventArgs, enumGetBox, markType, String_$type, typeCast } from "igniteui-webcomponents-core";
import { PropertyEditorValueType_$type } from "./PropertyEditorValueType";
import { ObservableCollection$1 } from "igniteui-webcomponents-core";
import { List$1 } from "igniteui-webcomponents-core";
import { stringEndsWith, stringContains, stringReplace } from "igniteui-webcomponents-core";
import { stringSplit } from "igniteui-webcomponents-core";
/**
 * @hidden
 */
export let PropertyEditorPropertyDescription = /*@__PURE__*/ (() => {
    class PropertyEditorPropertyDescription extends Base {
        constructor() {
            super(...arguments);
            this.u = null;
            this.s = null;
            this.j = 0;
            this.t = null;
            this.l = false;
            this.r = null;
            this.a = null;
            this.b = null;
            this.o = null;
            this.f = null;
            this.h = null;
            this.e = null;
            this.propertyChanged = null;
        }
        get y() {
            return this.u;
        }
        set y(a) {
            let b = this.u;
            this.u = a;
            if (this.u != b) {
                this.z("PropertyPath", b, a);
            }
        }
        get w() {
            return this.s;
        }
        set w(a) {
            let b = this.s;
            this.s = a;
            if (this.s != b) {
                this.z("Label", b, a);
            }
        }
        get k() {
            return this.j;
        }
        set k(a) {
            let b = this.j;
            this.j = a;
            if (this.j != b) {
                this.z("ValueType", enumGetBox(PropertyEditorValueType_$type, b), enumGetBox(PropertyEditorValueType_$type, a));
            }
        }
        get x() {
            return this.t;
        }
        set x(a) {
            let b = this.t;
            this.t = a;
            if (this.t != b) {
                this.z("PropertyDescriptionType", b, a);
            }
        }
        get n() {
            return this.l;
        }
        set n(a) {
            let b = this.l;
            this.l = a;
            if (this.l != b) {
                this.z("ShouldOverrideDefaultEditor", b, a);
            }
        }
        get v() {
            return this.r;
        }
        set v(a) {
            let b = this.r;
            this.r = a;
            if (this.r != b) {
                this.z("ElementDescriptionType", b, a);
            }
        }
        get c() {
            return this.a;
        }
        set c(a) {
            let b = this.a;
            this.a = a;
            if (this.a != b) {
                this.z("DropDownNames", b, a);
            }
        }
        get d() {
            return this.b;
        }
        set d(a) {
            let b = this.b;
            this.b = a;
            if (this.b != b) {
                this.z("DropDownValues", b, a);
            }
        }
        get q() {
            return this.o;
        }
        set q(a) {
            let b = this.o;
            this.o = a;
            if (this.o != b) {
                this.z("PrimitiveValue", b, a);
            }
        }
        get g() {
            return this.f;
        }
        set g(a) {
            let b = this.f;
            this.f = a;
            if (this.f != b) {
                this.z("ComplexValue", b, a);
            }
        }
        get i() {
            return this.h;
        }
        set i(a) {
            let b = this.h;
            this.h = a;
            if (this.h != b) {
                this.z("ComplexValues", b, a);
            }
        }
        z(a, b, c) {
            if (this.propertyChanged != null) {
                this.propertyChanged(this, new PropertyChangedEventArgs(a));
            }
        }
        m(a) {
            let b = false;
            if (a == null) {
                return false;
            }
            if (a.c != null && (this.c == null || !this.n)) {
                this.c = a.c;
            }
            if (a.d != null && (this.d == null || !this.n)) {
                this.d = a.d;
            }
            if (a.v != null && (this.v == null || !this.n)) {
                this.v = a.v;
            }
            if (a.x != null && (this.x == null || !this.n)) {
                this.x = a.x;
            }
            if (a.k != 0 && (this.k == 0 || !this.n)) {
                this.k = a.k;
                b = true;
            }
            return true;
        }
        p(a, b) {
            if (b) {
                return this.e;
            }
            if (this.e != null) {
                return this.e.d(a, false);
            }
            return null;
        }
    }
    PropertyEditorPropertyDescription.$t = /*@__PURE__*/ markType(PropertyEditorPropertyDescription, 'PropertyEditorPropertyDescription', Base.$, [INotifyPropertyChanged_$type]);
    return PropertyEditorPropertyDescription;
})();
/**
 * @hidden
 */
export let PropertyEditorDescriptionObject = /*@__PURE__*/ (() => {
    class PropertyEditorDescriptionObject extends Base {
        constructor() {
            super(...arguments);
            this.b = null;
            this.a = null;
        }
    }
    PropertyEditorDescriptionObject.$t = /*@__PURE__*/ markType(PropertyEditorDescriptionObject, 'PropertyEditorDescriptionObject');
    return PropertyEditorDescriptionObject;
})();
/**
 * @hidden
 */
export let PropertyEditorDescriptionObjectCollection = /*@__PURE__*/ (() => {
    class PropertyEditorDescriptionObjectCollection extends ObservableCollection$1 {
        constructor() {
            super(PropertyEditorDescriptionObject.$, 0);
        }
    }
    PropertyEditorDescriptionObjectCollection.$t = /*@__PURE__*/ markType(PropertyEditorDescriptionObjectCollection, 'PropertyEditorDescriptionObjectCollection', /*@__PURE__*/ ObservableCollection$1.$.specialize(PropertyEditorDescriptionObject.$));
    return PropertyEditorDescriptionObjectCollection;
})();
/**
 * @hidden
 */
export let PropertyEditorPropertyDescriptionCollection = /*@__PURE__*/ (() => {
    class PropertyEditorPropertyDescriptionCollection extends ObservableCollection$1 {
        constructor() {
            super(PropertyEditorPropertyDescription.$, 0);
        }
    }
    PropertyEditorPropertyDescriptionCollection.$t = /*@__PURE__*/ markType(PropertyEditorPropertyDescriptionCollection, 'PropertyEditorPropertyDescriptionCollection', /*@__PURE__*/ ObservableCollection$1.$.specialize(PropertyEditorPropertyDescription.$));
    return PropertyEditorPropertyDescriptionCollection;
})();
/**
 * @hidden
 */
export let PropertyEditorDataSource = /*@__PURE__*/ (() => {
    class PropertyEditorDataSource extends Base {
        constructor() {
            super(...arguments);
            this.i = null;
            this.a = null;
            this.f = null;
            this.propertyChanged = null;
        }
        get l() {
            return this.i;
        }
        set l(a) {
            let b = this.i;
            this.i = a;
            this.n("DescriptionType", b, this.i);
        }
        get b() {
            return this.a;
        }
        set b(a) {
            let b = this.a;
            this.a = a;
            this.n("Context", b, this.a);
        }
        get g() {
            return this.f;
        }
        set g(a) {
            let b = this.f;
            this.f = a;
            this.n("Data", b, this.f);
        }
        n(a, b, c) {
            if (this.propertyChanged != null) {
                this.propertyChanged(this, new PropertyChangedEventArgs(a));
            }
            this.o(a, b, c);
        }
        o(a, b, c) {
            switch (a) {
                case "DescriptionType":
                    this.p();
                    break;
                case "Context":
                    this.p();
                    break;
            }
        }
        e(a) {
            let b = new PropertyEditorPropertyDescription();
            b.y = a.propertyName;
            b.k = this.h(a);
            b.x = a.specificExternalType != null ? a.specificExternalType : a.specificType;
            if (a.knownType == 9) {
                b.v = a.collectionElementType;
                b.e = ((() => {
                    let $ret = new PropertyEditorDataSource();
                    $ret.b = this.a;
                    $ret.l = b.v;
                    return $ret;
                })());
            }
            if (b.k == 8) {
                b.e = ((() => {
                    let $ret = new PropertyEditorDataSource();
                    $ret.b = this.a;
                    $ret.l = b.x;
                    return $ret;
                })());
            }
            if (b.k == 15) {
                b.c = this.a.b(this.l, b.y);
                b.d = b.d;
            }
            return b;
        }
        h(a) {
            switch (a.knownType) {
                case 10: return 10;
                case 7: return 7;
                case 4: return 4;
                case 6: return 6;
                case 9: return 9;
                case 5: return 5;
                case 16: return 14;
                case 20: return 18;
                case 15: return 0;
                case 3: return 3;
                case 19: return 17;
                case 8:
                    if (a.specificExternalType == "string") {
                        return 15;
                    }
                    return 8;
                case 13: return 0;
                case 18: return 0;
                case 1: return 1;
                case 11: return 11;
                case 14: return 13;
                case 12: return 12;
                case 2: return 2;
                case 21: return 19;
                case 17: return 0;
                case 0: return 0;
            }
            return 0;
        }
        p() {
            let a = new PropertyEditorPropertyDescriptionCollection();
            if (this.l != null && this.b != null) {
                let b = this.b.a(this.l);
                if (b == null) {
                    return;
                }
                for (let c = 0; c < b.length; c++) {
                    if (stringEndsWith(b[c], "@names")) {
                        continue;
                    }
                    let d = this.b.d(this.l, b[c]);
                    let e = this.e(d);
                    if (e.k == 0) {
                        continue;
                    }
                    a.add(e);
                }
            }
            this.g = a;
        }
        d(a, b) {
            if (a == null) {
                return null;
            }
            let c = stringSplit(a, ['.', '['], 0);
            let d = new List$1(String_$type, 1, c);
            let e = null;
            let f = null;
            let g = null;
            while (d.count > 0) {
                let h = d._inner[0];
                d.removeAt(0);
                let i = false;
                if (stringContains(h, "]")) {
                    h = stringReplace(h, "]", "");
                    i = true;
                    if (stringContains(h, "as")) {
                        let j = h.indexOf("as");
                        g = h.substr(0, j).trim();
                        f = h.substr(j + 2).trim();
                    }
                    if (f != null && f != this.l) {
                        let k = this.c();
                        k.l = f;
                        e = k;
                        continue;
                    }
                }
                if (b) {
                    i = true;
                }
                if (e != null && typeCast(PropertyEditorPropertyDescription.$, e) !== null) {
                    let l = e.p(h, i);
                    if (l == null) {
                        return null;
                    }
                    e = l;
                }
                else {
                    if (e != null) {
                        let m = e;
                        let n = m.d(h, i);
                        if (n == null) {
                            return null;
                        }
                        e = n;
                    }
                    else {
                        if (this.g == null) {
                            return null;
                        }
                        for (let o = 0; o < this.g.count; o++) {
                            if (Base.equalsStatic(this.g._inner[o].y, h)) {
                                e = this.g._inner[o];
                                break;
                            }
                        }
                        if (e == null) {
                            return null;
                        }
                    }
                }
            }
            return typeCast(PropertyEditorPropertyDescription.$, e);
        }
        c() {
            return ((() => {
                let $ret = new PropertyEditorDataSource();
                $ret.b = this.b;
                $ret.l = this.l;
                return $ret;
            })());
        }
    }
    PropertyEditorDataSource.$t = /*@__PURE__*/ markType(PropertyEditorDataSource, 'PropertyEditorDataSource', Base.$, [INotifyPropertyChanged_$type]);
    return PropertyEditorDataSource;
})();
//# sourceMappingURL=PropertyEditorPropertyDescription_combined.js.map
