{"version":3,"file":"Search_Param.CSXLFsph.mjs","names":["useStore","useState"],"sources":["https:/framerusercontent.com/modules/vj7bFUjvEQFgEzNBkdoG/vf3CKm378wlVcBk7IhSU/createStore.js","https:/framer.com/m/framer/store.js@^1.0.0","https:/framerusercontent.com/modules/tywFLTFkpgn8hRF0NeKZ/VR7OcFZwPns1KKQOKVus/Search_Param.js"],"sourcesContent":["import{useState,useEffect}from\"react\";import{Data,useObserveData}from\"framer\";export function createStore(state1){// Use Data so that a Preview reload resets the state\nconst dataStore=Data({state:Object.freeze({...state1})});// Create a set function that updates the state\nconst setDataStore=newState=>{// If the state is an object, make sure we copy it\nif(typeof newState===\"function\"){newState=newState(dataStore.state);}dataStore.state=Object.freeze({...dataStore.state,...newState});};// Store the initial state, copy the object if it's an object\nlet storeState=typeof state1===\"object\"?Object.freeze({...state1}):state1;// Keep a list of all the listeners, in the form of React hook setters\nconst storeSetters=new Set();// Create a set function that updates all the listeners / setters\nconst setStoreState=newState=>{// If the state is an object, make sure we copy it\nif(typeof newState===\"function\"){newState=newState(storeState);}storeState=typeof newState===\"object\"?Object.freeze({...storeState,...newState}):newState;// Update all the listeners / setters with the new value\nstoreSetters.forEach(setter=>setter(storeState));};// Create the actual hook based on everything above\nfunction useStore(){// Create the hook we are going to use as a listener\nconst[state,setState]=useState(storeState);// If we unmount the component using this hook, we need to remove the listener\n// @ts-ignore\nuseEffect(()=>{// But right now, we need to add the listener\nstoreSetters.add(setState);return()=>storeSetters.delete(setState);},[]);// If Data context exists, use Data, otherwise use vanilla React state\nif(useObserveData()===true){useObserveData();return[dataStore.state,setDataStore];}else{// Return the state and a function to update the central store\nreturn[state,setStoreState];}}return useStore;}\nexport const __FramerMetadata__ = {\"exports\":{\"createStore\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./createStore.map","/*\n * createStore (framer/store@1.0.1)\n *\n * Learn More: https://www.framer.com/asset-urls\n */\n\nexport * from \"https://framerusercontent.com/modules/vj7bFUjvEQFgEzNBkdoG/vf3CKm378wlVcBk7IhSU/createStore.js\"\n","import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect}from\"react\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";// Learn more: https://www.framer.com/docs/guides/overrides/\nexport const useStore=createStore({keyword:\"\"});// get parameter 'skey' from url and save it to 'keyword'\nexport function setMode(Component){return props=>{const[store,setStore]=useStore();useEffect(()=>{if(window){var keyword=new URLSearchParams(window.location.search).getAll(\"skey\");if(keyword.length>0){setStore({keyword:keyword[0]});}else{setStore({keyword:\"\"})// default empty\n;}}},[]);return /*#__PURE__*/_jsx(Component,{...props});};}// get stored 'keyword' and set it to 'Search Keyword' component variable\nexport function getMode(Component){return props=>{const[store,setStore]=useStore();useEffect(()=>{const element=document.querySelector('[aria-label=\"count-child\"]');const totalCount=element?element.children.length:0;// Change the text content of the target element\nconst textElement=document.querySelector('[aria-label=\"counter-text\"] p');if(textElement){if(totalCount===0){textElement.textContent=\"0 result\";}else if(totalCount===1){textElement.textContent=\"1 result\";}else{textElement.textContent=`${totalCount} results`;}}},[store.keyword]);const getKeyword=()=>{console.log(\"get keyword \",store.keyword);return store.keyword;};return /*#__PURE__*/_jsx(Component,{...props,searchKeyword:getKeyword()});};}\nexport const __FramerMetadata__ = {\"exports\":{\"setMode\":{\"type\":\"reactHoc\",\"name\":\"setMode\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useStore\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getMode\":{\"type\":\"reactHoc\",\"name\":\"getMode\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Search_Param.map"],"mappings":"gMAA8E,SAAgB,EAAY,EAAO,CACjH,IAAM,EAAU,EAAK,CAAC,MAAM,OAAO,OAAO,CAAC,GAAG,EAAO,CAAC,CAAC,CAAC,CACl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