{"version":3,"file":"Shuffle_CMS_Collection_Code_Override.BAQxF5TH.mjs","names":["j"],"sources":["https:/framerusercontent.com/modules/RAFlXaAtqNdwEjKvEdVE/Jg52GMncSftdXsQtddM9/Shuffle_CMS_Collection_Code_Override.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useMemo,Children}from\"react\";// @ts-ignore – Framer runtime helpers\nimport{useQueryData}from\"framer\";import{getCollectionData}from\"https://framer.com/m/CMSLibrary-09eo.js\";/* --------------------------------- utils ---------------------------------- */function shuffleArray(array){const copy=[...array]// don’t mutate the original\n;for(let i=copy.length-1;i>0;i--){const j=Math.floor(Math.random()*(i+1));[copy[i],copy[j]]=[copy[j],copy[i]];}return copy;}/* ---------------- HOC: ShuffleCMSCollectionList --------------------------- */export function ShuffleCMSCollectionList(Component){return props=>{const items=getCollectionListItems(props);// build a stable signature for the current dataset\nconst itemsKey=items.map(c=>c?.key??\"\").join(\"|\");// shuffle **once** per unique dataset\nconst shuffled=useMemo(()=>{if(!items.length)return items;return shuffleArray(items);},[itemsKey]);return /*#__PURE__*/_jsx(Component,{...props,children:shuffled});};}/* ---------------------- CMS helpers --------------------------------------- */export function getCollectionListItems(props){const{query,childrenFunction}=getCollectionData({props});if(query&&childrenFunction){const data=useQueryData(query);let children=[];const clChildren=childrenFunction(data);if(Array.isArray(clChildren)){children=clChildren;}else if(Array.isArray(clChildren?.props?.children?.[0])){children=clChildren.props.children[0];}else if(Array.isArray(clChildren?.props?.children)){children=clChildren.props.children;}return Children.toArray(children);}return[];}\nexport const __FramerMetadata__ = {\"exports\":{\"getCollectionListItems\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"ShuffleCMSCollectionList\":{\"type\":\"reactHoc\",\"name\":\"ShuffleCMSCollectionList\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Shuffle_CMS_Collection_Code_Override.map"],"mappings":"8UACwL,SAAS,EAAa,EAAM,CAAC,IAAM,EAAK,CAAC,GAAG,CAAM,EACzO,IAAI,IAAI,EAAE,EAAK,OAAO,EAAE,EAAE,EAAE,IAAI,CAAC,IAAMA,EAAE,KAAK,MAAM,KAAK,QAAQ,EAAE,EAAE,GAAG,CAAC,CAAC,EAAK,GAAG,EAAKA,GAAG,CAAC,CAAC,EAAKA,GAAG,EAAK,EAAG,CAAE,QAAO,CAAM,CAAgF,SAAgB,EAAyB,EAAU,CAAC,MAAO,CAAA,GAAO,CAAC,IAAM,EAAM,EAAuB,EAAM,CAClT,EAAS,EAAM,IAAI,GAAG,GAAG,KAAK,GAAG,CAAC,KAAK,IAAI,CAC3C,EAAS,EAAQ,IAAS,EAAM,OAA2B,EAAa,EAAM,CAAhC,EAAmC,CAAC,CAAS,EAAC,CAAC,MAAoB,GAAK,EAAU,CAAC,GAAG,EAAM,SAAS,CAAS,EAAC,AAAE,CAAE,CAAgF,SAAgB,EAAuB,EAAM,CAAC,GAAK,CAAC,QAAM,mBAAiB,CAAC,EAAkB,CAAC,OAAM,EAAC,CAAC,GAAG,GAAO,EAAiB,CAAC,IAAM,EAAK,EAAa,EAAM,CAAK,EAAS,CAAE,EAAO,EAAW,EAAiB,EAAK,CAA4O,MAAxO,OAAM,QAAQ,EAAW,CAAE,EAAS,EAAoB,MAAM,QAAQ,GAAY,OAAO,WAAW,GAAG,CAAE,EAAS,EAAW,MAAM,SAAS,GAAY,MAAM,QAAQ,GAAY,OAAO,SAAS,GAAE,EAAS,EAAW,MAAM,UAAiB,EAAS,QAAQ,EAAS,AAAE,OAAM,CAAE,CAAE,cAJzuB,GAA2C,IAAoC,CAC/E,GAAiC,IAAuE"}