"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 ("u" > 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__, {
    createSearchStore: ()=>createSearchStore
});
const replace_breakpoint_utils_cjs_namespaceObject = require("../../../utils/replace-breakpoint-utils.cjs");
const store_cjs_namespaceObject = require("../../common/interface/store.cjs");
const search_layout_cjs_namespaceObject = require("../atomic-search-layout/search-layout.cjs");
function createSearchStore() {
    const store = (0, store_cjs_namespaceObject.createBaseStore)({
        loadingFlags: [],
        iconAssetsPath: '',
        resultList: void 0,
        mobileBreakpoint: replace_breakpoint_utils_cjs_namespaceObject.DEFAULT_MOBILE_BREAKPOINT,
        facets: {},
        numericFacets: {},
        dateFacets: {},
        categoryFacets: {},
        facetElements: [],
        fieldsToInclude: [],
        sortOptions: []
    });
    return {
        ...store,
        unsetLoadingFlag (loadingFlag) {
            (0, store_cjs_namespaceObject.unsetLoadingFlag)(store, loadingFlag);
        },
        setLoadingFlag (loadingFlag) {
            (0, store_cjs_namespaceObject.setLoadingFlag)(store, loadingFlag);
        },
        isMobile () {
            return !window.matchMedia((0, search_layout_cjs_namespaceObject.makeDesktopQuery)(store.state.mobileBreakpoint)).matches;
        },
        registerFacet (facetType, data) {
            (0, store_cjs_namespaceObject.registerFacet)(store, facetType, data);
        },
        getFacetElements () {
            return (0, store_cjs_namespaceObject.getFacetElements)(store);
        },
        waitUntilAppLoaded (callback) {
            (0, store_cjs_namespaceObject.waitUntilAppLoaded)(store, callback);
        },
        getUniqueIDFromEngine (engine) {
            return engine.state.search.response.searchUid;
        },
        hasLoadingFlag (loadingFlag) {
            return -1 !== store.state.loadingFlags.indexOf(loadingFlag);
        },
        getAllFacets () {
            return {
                ...store.state.facets,
                ...store.state.dateFacets,
                ...store.state.categoryFacets,
                ...store.state.numericFacets
            };
        },
        addFieldsToInclude (fields) {
            const currentFields = store.state.fieldsToInclude;
            store.state.fieldsToInclude = [
                ...currentFields,
                ...fields
            ];
        }
    };
}
exports.createSearchStore = __webpack_exports__.createSearchStore;
for(var __rspack_i in __webpack_exports__)if (-1 === [
    "createSearchStore"
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
Object.defineProperty(exports, '__esModule', {
    value: true
});
