"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__, {
    CollectionFieldInterfaceManager: function() {
        return CollectionFieldInterfaceManager;
    }
});
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 CollectionFieldInterfaceManager {
    addFieldInterfaces() {
        let fieldInterfaceClasses = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [];
        const newCollectionFieldInterfaces = fieldInterfaceClasses.reduce((acc, Interface)=>{
            const instance = new Interface(this);
            acc[instance.name] = instance;
            return acc;
        }, {});
        Object.assign(this.collectionFieldInterfaceInstances, newCollectionFieldInterfaces);
    }
    getFieldInterface(name) {
        return this.collectionFieldInterfaceInstances[name];
    }
    getFieldInterfaces(dataSourceType) {
        return Object.values(this.collectionFieldInterfaceInstances).filter((item)=>{
            if (!dataSourceType) return true;
            if (!item.supportDataSourceType && !item.notSupportDataSourceType) return true;
            if (item.supportDataSourceType) {
                var _item_supportDataSourceType;
                return null === (_item_supportDataSourceType = item.supportDataSourceType) || void 0 === _item_supportDataSourceType ? void 0 : _item_supportDataSourceType.includes(dataSourceType);
            }
            if (item.notSupportDataSourceType) {
                var _item_notSupportDataSourceType;
                return !(null === (_item_notSupportDataSourceType = item.notSupportDataSourceType) || void 0 === _item_notSupportDataSourceType ? void 0 : _item_notSupportDataSourceType.includes(dataSourceType));
            }
            return true;
        });
    }
    addFieldInterfaceGroups(groups) {
        Object.assign(this.collectionFieldGroups, groups);
    }
    getFieldInterfaceGroups() {
        return this.collectionFieldGroups;
    }
    getFieldInterfaceGroup(name) {
        return this.collectionFieldGroups[name];
    }
    constructor(fieldInterfaceClasses, fieldInterfaceGroups, dataSourceManager){
        _define_property(this, "dataSourceManager", void 0);
        _define_property(this, "collectionFieldInterfaceInstances", void 0);
        _define_property(this, "collectionFieldGroups", void 0);
        this.dataSourceManager = dataSourceManager;
        this.collectionFieldInterfaceInstances = {};
        this.collectionFieldGroups = {};
        this.addFieldInterfaces(fieldInterfaceClasses);
        this.addFieldInterfaceGroups(fieldInterfaceGroups);
    }
}
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
});
