"use strict";
var __webpack_require__ = {};
(()=>{
    __webpack_require__.d = function(exports1, definition) {
        for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
            enumerable: true,
            get: definition[key]
        });
    };
})();
(()=>{
    __webpack_require__.o = function(obj, prop) {
        return Object.prototype.hasOwnProperty.call(obj, prop);
    };
})();
(()=>{
    __webpack_require__.r = function(exports1) {
        if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
            value: 'Module'
        });
        Object.defineProperty(exports1, '__esModule', {
            value: true
        });
    };
})();
var __webpack_exports__ = {};
__webpack_require__.r(__webpack_exports__);
__webpack_require__.d(__webpack_exports__, {
    SchemaSettingsManager: function() {
        return SchemaSettingsManager;
    }
});
function _define_property(obj, key, value) {
    if (key in obj) Object.defineProperty(obj, key, {
        value: value,
        enumerable: true,
        configurable: true,
        writable: true
    });
    else obj[key] = value;
    return obj;
}
class SchemaSettingsManager {
    add() {
        for(var _len = arguments.length, schemaSettingList = new Array(_len), _key = 0; _key < _len; _key++)schemaSettingList[_key] = arguments[_key];
        schemaSettingList.forEach((schemaSetting)=>{
            this.schemaSettings[schemaSetting.name] = schemaSetting;
            if (Array.isArray(this.actionList[schemaSetting.name])) {
                this.actionList[schemaSetting.name].forEach((item)=>{
                    schemaSetting[item.type](item.itemName, item.data);
                });
                this.actionList[schemaSetting.name] = void 0;
            }
        });
    }
    addItem(schemaSettingName, itemName, data) {
        const schemaSetting = this.get(schemaSettingName);
        if (schemaSetting) schemaSetting.add(itemName, data);
        else {
            if (!this.actionList[schemaSettingName]) this.actionList[schemaSettingName] = [];
            this.actionList[schemaSettingName].push({
                type: 'add',
                itemName: itemName,
                data
            });
        }
    }
    get(name) {
        return this.schemaSettings[name];
    }
    getAll() {
        return this.schemaSettings;
    }
    has(name) {
        return !!this.get(name);
    }
    remove(name) {
        delete this.schemaSettings[name];
    }
    removeItem(schemaSettingName, itemName) {
        const schemaSetting = this.get(schemaSettingName);
        if (schemaSetting) schemaSetting.remove(itemName);
        else {
            if (!this.actionList[schemaSettingName]) this.actionList[schemaSettingName] = [];
            this.actionList[schemaSettingName].push({
                type: 'remove',
                itemName: itemName
            });
        }
    }
    constructor(_schemaSettings = [], app){
        _define_property(this, "_schemaSettings", void 0);
        _define_property(this, "app", void 0);
        _define_property(this, "schemaSettings", void 0);
        _define_property(this, "actionList", void 0);
        this._schemaSettings = _schemaSettings;
        this.app = app;
        this.schemaSettings = {};
        this.actionList = {};
        this.app = app;
        this.add(..._schemaSettings);
    }
}
var __webpack_export_target__ = exports;
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
    value: true
});
