{"version":3,"file":"Shuffle_CMS_Collection_Code_Override.Co-J0Bhz.mjs","names":["useMemo","_jsx","Children","__esmMin","j","pe","init_npm_react_18_3_1","init_jsx_runtime","c","init_framer_BWzg2IRg","useQueryData","getCollectionData","collectionList","_collectionList_props_children","_collectionList_props1","_collectionList_props_children_props_children","_collectionList_props_children_props1","_collectionList_props_children1","_collectionList_props2","queryParent","query","queryData","left","i","propertyControlsById","propertyControlsByName","id","control","childrenFunction","_clpc_props_children","_clpc_props1","clpc","init_CMSLibrary","shuffleArray","array","copy","ShuffleCMSCollectionList","Component","props","items","getCollectionListItems","itemsKey","shuffled","data","children","clChildren","init_Shuffle_CMS_Collection_Code_Override"],"sources":["https:/framerusercontent.com/modules/OPJlnSDokJ2eD9lIXljn/mr2QJ5zw4xvkJ1Vbvzgr/CMSLibrary.js","https:/framerusercontent.com/modules/RAFlXaAtqNdwEjKvEdVE/Jg52GMncSftdXsQtddM9/Shuffle_CMS_Collection_Code_Override.js"],"sourcesContent":["export function getCollectionData(collectionList){var _collectionList_props,_collectionList_props_children_props,_collectionList_props_children,_collectionList_props1,_collectionList_props_children_props_children_props,_collectionList_props_children_props_children,_collectionList_props_children_props1,_collectionList_props_children1,_collectionList_props2,_queryParent_props;let queryParent=null;if(collectionList===null||collectionList===void 0?void 0:(_collectionList_props=collectionList.props)===null||_collectionList_props===void 0?void 0:_collectionList_props.query){queryParent=collectionList;}else if(collectionList===null||collectionList===void 0?void 0:(_collectionList_props1=collectionList.props)===null||_collectionList_props1===void 0?void 0:(_collectionList_props_children=_collectionList_props1.children)===null||_collectionList_props_children===void 0?void 0:(_collectionList_props_children_props=_collectionList_props_children.props)===null||_collectionList_props_children_props===void 0?void 0:_collectionList_props_children_props.query){queryParent=collectionList.props.children;}else if(collectionList===null||collectionList===void 0?void 0:(_collectionList_props2=collectionList.props)===null||_collectionList_props2===void 0?void 0:(_collectionList_props_children1=_collectionList_props2.children)===null||_collectionList_props_children1===void 0?void 0:(_collectionList_props_children_props1=_collectionList_props_children1.props)===null||_collectionList_props_children_props1===void 0?void 0:(_collectionList_props_children_props_children=_collectionList_props_children_props1.children)===null||_collectionList_props_children_props_children===void 0?void 0:(_collectionList_props_children_props_children_props=_collectionList_props_children_props_children.props)===null||_collectionList_props_children_props_children_props===void 0?void 0:_collectionList_props_children_props_children_props.query){queryParent=collectionList.props.children.props.children;}const query=queryParent===null||queryParent===void 0?void 0:(_queryParent_props=queryParent.props)===null||_queryParent_props===void 0?void 0:_queryParent_props.query;let queryData=null;if(query===null||query===void 0?void 0:query.from){if(query.from.data){queryData=query.from.data;}else if(query.from.left){let left=query.from.left;for(let i=0;i<100;i++){if(left.type==\"Collection\"){queryData=left.data;break;}else if(left.left){left=left.left;}else{break;}}}}// Get property controls\nconst propertyControlsById=(queryData===null||queryData===void 0?void 0:queryData.propertyControls)||{};const propertyControlsByName={};for(const id in propertyControlsById){const control=propertyControlsById[id];propertyControlsByName[control.title]={id,...control};}// Get children function\nlet childrenFunction=null;if(collectionList){var _collectionList_props3,_clpc_props,_clpc_props_children_props,_clpc_props_children,_clpc_props1;const clpc=(_collectionList_props3=collectionList.props)===null||_collectionList_props3===void 0?void 0:_collectionList_props3.children;if(typeof clpc==\"function\"){childrenFunction=clpc;}else if(typeof(clpc===null||clpc===void 0?void 0:(_clpc_props=clpc.props)===null||_clpc_props===void 0?void 0:_clpc_props.children)==\"function\"){childrenFunction=clpc.props.children;}else if(typeof(clpc===null||clpc===void 0?void 0:(_clpc_props1=clpc.props)===null||_clpc_props1===void 0?void 0:(_clpc_props_children=_clpc_props1.children)===null||_clpc_props_children===void 0?void 0:(_clpc_props_children_props=_clpc_props_children.props)===null||_clpc_props_children_props===void 0?void 0:_clpc_props_children_props.children)==\"function\"){childrenFunction=clpc.props.children.props.children;}}return{query,queryParent,queryData,propertyControlsById,propertyControlsByName,childrenFunction};}export function addFieldsToSelect(fields,query,propertyControlsByName){const alias=query.alias;const select=Array.isArray(query===null||query===void 0?void 0:query.select)?[...query.select]:[];for(const fieldName of fields){var _propertyControlsByName_fieldName;const fieldId=(_propertyControlsByName_fieldName=propertyControlsByName[fieldName])===null||_propertyControlsByName_fieldName===void 0?void 0:_propertyControlsByName_fieldName.id;if(!fieldId){continue;}let matchFound=false;for(const item of select){if(item.name===fieldId&&item.type===\"Identifier\"&&item.collection===alias){matchFound=true;continue;}}if(matchFound){continue;}select.push({collection:alias,name:fieldId,type:\"Identifier\"});}return select;}\nexport const __FramerMetadata__ = {\"exports\":{\"getCollectionData\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"addFieldsToSelect\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CMSLibrary.map","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":"A,2KAAA,SAAgBW,EAAkBC,EAAe,CAAC,IAA+DC,EAA+BC,EAA2EC,EAA8CC,EAAsCC,EAAgCC,EAA0C,IAAIC,EAAY,KAAQP,GAAiB,MAA4DA,EAAe,OAA2E,MAAOO,EAAYP,EAAwBA,GAAiB,OAAsCE,EAAuBF,EAAe,QAAS,OAA8CC,EAA+BC,EAAuB,WAAY,MAA2FD,EAA+B,OAAyG,MAAOM,EAAYP,EAAe,MAAM,SAAkBA,GAAiB,OAAsCM,EAAuBN,EAAe,QAAS,OAA8CK,EAAgCC,EAAuB,WAAY,OAAuDF,EAAsCC,EAAgC,QAAS,OAA6DF,EAA8CC,EAAsC,WAAY,MAAyHD,EAA8C,OAAuI,QAAOI,EAAYP,EAAe,MAAM,SAAS,MAAM,UAAU,IAAMQ,EAAMD,GAAgF,OAAqE,MAAUE,EAAU,KAAK,GAAGD,GAA0C,KAAK,CAAC,GAAGA,EAAM,KAAK,KAAMC,EAAUD,EAAM,KAAK,UAAW,GAAGA,EAAM,KAAK,KAAK,CAAC,IAAIE,EAAKF,EAAM,KAAK,KAAK,IAAI,IAAIG,EAAE,EAAEA,EAAE,IAAIA,IAAK,GAAGD,EAAK,MAAM,aAAa,CAACD,EAAUC,EAAK,KAAK,KAAM,MAAM,GAAGA,EAAK,KAAMA,EAAKA,EAAK,UAAW,KAAQ,CAAC,CAC54E,IAAME,EAAsBH,GAAsD,kBAAmB,CAAC,EAAQI,EAAuB,CAAC,EAAE,IAAI,IAAMC,KAAMF,EAAq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