"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__, {
    createCommerceStore: ()=>createCommerceStore
});
const commerce_namespaceObject = require("@coveo/headless/commerce");
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("../../search/atomic-search-layout/search-layout.cjs");
function createCommerceStore(type) {
    const store = (0, store_cjs_namespaceObject.createBaseStore)({
        loadingFlags: [],
        iconAssetsPath: '',
        resultList: void 0,
        mobileBreakpoint: replace_breakpoint_utils_cjs_namespaceObject.DEFAULT_MOBILE_BREAKPOINT,
        activeProductChild: void 0
    });
    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;
        },
        getUniqueIDFromEngine (engine) {
            switch(type){
                case 'search':
                    return commerce_namespaceObject.Selectors.Search.responseIdSelector(engine);
                case 'product-listing':
                    return commerce_namespaceObject.Selectors.ProductListing.responseIdSelector(engine);
            }
        }
    };
}
exports.createCommerceStore = __webpack_exports__.createCommerceStore;
for(var __rspack_i in __webpack_exports__)if (-1 === [
    "createCommerceStore"
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
Object.defineProperty(exports, '__esModule', {
    value: true
});
