{"version":3,"file":"Redirect_2.DLqDXmSc.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/arvKDDvPv038OWUWHB6V/AqVeCEM4wGnUe6oT00ZY/Redirect_2.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";export function withReferralRedirect(Component){return props=>{const ref=useRef(null);useEffect(()=>{const button=ref.current;if(!button)return;const handleClick=()=>{const path=window.location.pathname;const match=path.match(/\\/invite\\/([a-zA-Z0-9]{3,20})$/);const params=new URLSearchParams(window.location.search);const code=match?match[1]:params.get(\"code\");if(!code){window.location.href=\"https://avici.money\";return;}const ios=/iPhone|iPad/.test(navigator.userAgent);const android=/Android/.test(navigator.userAgent);const referralUrl=\"https://avici.money/invite/\"+code;// Copy to clipboard (works on iOS because user tapped)\nif(navigator.clipboard&&navigator.clipboard.writeText){navigator.clipboard.writeText(referralUrl).catch(()=>{});}// Try opening the app\nwindow.location.href=\"avici://invite/\"+code;// Fallback to store after 1.5s\nsetTimeout(()=>{if(ios){window.location.href=\"https://apps.apple.com/app/avici-internet-finance/id6465962039\";}else if(android){window.location.href=\"https://play.google.com/store/apps/details?id=xyz.avici.apps&referrer=\"+encodeURIComponent(code);}else{window.location.href=\"https://avici.money\";}},1500);};button.addEventListener(\"click\",handleClick);return()=>button.removeEventListener(\"click\",handleClick);},[]);return /*#__PURE__*/_jsx(Component,{...props,ref:ref});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withReferralRedirect\":{\"type\":\"reactHoc\",\"name\":\"withReferralRedirect\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Redirect_2.map"],"mappings":"8IAA+E,SAAgB,EAAqB,EAAU,CAAC,MAAO,IAAO,CAAC,IAAM,EAAIA,EAAO,KAAK,CAG4P,OAH3P,MAAc,CAAC,IAAM,EAAO,EAAI,QAAQ,GAAG,CAAC,EAAO,OAAO,IAAM,MAAgB,CAAqC,IAAM,EAA/B,EAAO,SAAS,SAA0B,MAAM,iCAAiC,CAAO,EAAO,IAAI,gBAAgB,EAAO,SAAS,OAAO,CAAO,EAAK,EAAM,EAAM,GAAG,EAAO,IAAI,OAAO,CAAC,GAAG,CAAC,EAAK,CAAC,EAAO,SAAS,KAAK,sBAAsB,OAAQ,IAAM,EAAI,cAAc,KAAK,EAAU,UAAU,CAAO,EAAQ,UAAU,KAAK,EAAU,UAAU,CAAO,EAAY,8BAA8B,EACvoB,EAAU,WAAW,EAAU,UAAU,WAAW,EAAU,UAAU,UAAU,EAAY,CAAC,UAAU,GAAG,CAC/G,EAAO,SAAS,KAAK,kBAAkB,EACvC,eAAe,CAAI,EAAK,EAAO,SAAS,KAAK,iEAA0E,EAAS,EAAO,SAAS,KAAK,yEAAyE,mBAAmB,EAAK,CAAO,EAAO,SAAS,KAAK,uBAAyB,KAAK,EAAgD,OAA7C,EAAO,iBAAiB,QAAQ,EAAY,KAAW,EAAO,oBAAoB,QAAQ,EAAY,EAAG,EAAE,CAAC,CAAqB,EAAK,EAAU,CAAC,GAAG,EAAU,MAAI,CAAC,uBAH3a,IAAoC"}