{"version":3,"file":"ReturnToFirstRootButton.CFoLPCsZ.mjs","names":["__legacyOverrideHOC_DataObserverContext","_jsx"],"sources":["https:/framerusercontent.com/modules/xFqcXLUft50ZrSngkQ4i/iqQGOVwtUJkpd4noBfom/ReturnToFirstRootButton.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";export const returnToFirstRootButton=()=>{return{onClick:event=>{event.preventDefault();// Only run on client side\nif(typeof window===\"undefined\")return;const currentPath=window.location.pathname;// Method 1: Try to detect user from current URL first\nlet userSection=null;let userHome=null;// Check if we're currently in a user section\nif(currentPath.includes(\"/user/\")){const pathSegments=currentPath.split(\"/\");const userIndex=pathSegments.indexOf(\"user\");if(userIndex!==-1&&pathSegments[userIndex+1]){userSection=pathSegments[userIndex+1];userHome=`/user/${userSection}/home`;}}else if(currentPath.startsWith(\"/main/\")){userHome=\"/main/home\";}else if(currentPath.startsWith(\"/daniel-abayomi/\")){userHome=\"/daniel-abayomi/home\";}// Method 2: Check session storage for previously stored user\nif(!userHome&&typeof sessionStorage!==\"undefined\"){const storedUser=sessionStorage.getItem(\"currentUser\");if(storedUser){userHome=storedUser;}}// Method 3: Check document referrer to see where they came from\nif(!userHome&&document.referrer){const referrerUrl=new URL(document.referrer);const referrerPath=referrerUrl.pathname;if(referrerPath.includes(\"/user/\")){const pathSegments=referrerPath.split(\"/\");const userIndex=pathSegments.indexOf(\"user\");if(userIndex!==-1&&pathSegments[userIndex+1]){userSection=pathSegments[userIndex+1];userHome=`/user/${userSection}/home`;}}else if(referrerPath.startsWith(\"/main/\")){userHome=\"/main/home\";}else if(referrerPath.startsWith(\"/daniel-abayomi/\")){userHome=\"/daniel-abayomi/home\";}}// Method 4: Default fallback - could ask user or default to main\nif(!userHome){userHome=\"/main/home\"// Default fallback\n;}// Store for future use\nif(typeof sessionStorage!==\"undefined\"&&userHome){sessionStorage.setItem(\"currentUser\",userHome);}// Navigate to user's home\nwindow.location.href=userHome;}};};import{useContext as __legacyOverrideHOC_useContext}from\"react\";import{DataObserverContext as __legacyOverrideHOC_DataObserverContext}from\"framer\";export function withreturnToFirstRootButton(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...returnToFirstRootButton(props)});};}withreturnToFirstRootButton.displayName=\"returnToFirstRootButton\";\nexport const __FramerMetadata__ = {\"exports\":{\"withreturnToFirstRootButton\":{\"type\":\"reactHoc\",\"name\":\"withreturnToFirstRootButton\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"returnToFirstRootButton\":{\"type\":\"override\",\"name\":\"returnToFirstRootButton\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ReturnToFirstRootButton.map"],"mappings":"yRASsL,SAAgB,EAA4B,EAAE,CAAC,MAAO,KAAQ,EAA+BA,EAAwC,CAAQC,EAAK,EAAE,CAAC,GAAG,EAAM,GAAG,EAAwB,EAAM,CAAC,CAAC,yBAT5U,IASwD,IAAmF,CAT9H,OAAmC,CAAC,QAAQ,GAAO,CAC3G,GAD4G,EAAM,gBAAgB,CACxH,IAAS,OAAY,OAAO,IAAM,EAAY,EAAO,SAAS,SACpE,EAAY,KAAS,EAAS,KAClC,GAAG,EAAY,SAAS,SAAS,CAAC,CAAC,IAAM,EAAa,EAAY,MAAM,IAAI,CAAO,EAAU,EAAa,QAAQ,OAAO,CAAI,IAAY,IAAI,EAAa,EAAU,KAAI,EAAY,EAAa,EAAU,GAAG,EAAS,SAAS,EAAY,aAAiB,EAAY,WAAW,SAAS,CAAE,EAAS,aAAsB,EAAY,WAAW,mBAAmB,GAAE,EAAS,wBACnX,GAAG,CAAC,GAAU,OAAO,eAAiB,IAAY,CAAC,IAAM,EAAW,eAAe,QAAQ,cAAc,CAAI,IAAY,EAAS,GAClI,GAAG,CAAC,GAAU,SAAS,SAAS,CAA8C,IAAM,EAAjC,IAAI,IAAI,SAAS,SAAS,CAAgC,SAAS,GAAG,EAAa,SA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