"use strict";
var __webpack_require__ = {};
(()=>{
    __webpack_require__.d = (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 = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
})();
(()=>{
    __webpack_require__.r = (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__, {
    mergeIncomingFiltersFromSourceBlocks: ()=>mergeIncomingFiltersFromSourceBlocks,
    getFilterSourceDefaultFilter: ()=>getFilterSourceDefaultFilter
});
const external_utils_js_namespaceObject = require("./utils.js");
function mergeIncomingFiltersFromSourceBlocks(ownFilter, currentBlockUid, dataBlocks) {
    if (!currentBlockUid) return null != ownFilter ? ownFilter : {};
    const sources = dataBlocks.filter((b)=>{
        var _b_filterTargetUids;
        return (null == (_b_filterTargetUids = b.filterTargetUids) ? void 0 : _b_filterTargetUids.length) && b.filterTargetUids.includes(currentBlockUid);
    });
    const sourceFilters = sources.map((b)=>b.defaultFilter).filter((f)=>f && 'object' == typeof f && Object.keys(f).length > 0);
    if (!sourceFilters.length) return null != ownFilter ? ownFilter : {};
    const own = ownFilter && 'object' == typeof ownFilter ? ownFilter : {};
    return (0, external_utils_js_namespaceObject.mergeFilter)([
        ...sourceFilters,
        own
    ], '$and');
}
function getFilterSourceDefaultFilter(dataBlocks, filterSourceUid) {
    var _dataBlocks_find;
    if (!filterSourceUid) return {};
    const f = null == (_dataBlocks_find = dataBlocks.find((b)=>b.uid === filterSourceUid)) ? void 0 : _dataBlocks_find.defaultFilter;
    if (f && 'object' == typeof f && Object.keys(f).length) return f;
    return {};
}
exports.getFilterSourceDefaultFilter = __webpack_exports__.getFilterSourceDefaultFilter;
exports.mergeIncomingFiltersFromSourceBlocks = __webpack_exports__.mergeIncomingFiltersFromSourceBlocks;
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
    "getFilterSourceDefaultFilter",
    "mergeIncomingFiltersFromSourceBlocks"
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
Object.defineProperty(exports, '__esModule', {
    value: true
});
