{"version":3,"file":"CustomCursor.Ccom121d.mjs","names":["useRef","useCallback"],"sources":["https:/framerusercontent.com/modules/MCPYtSAqopgbYGdtgYDC/w2cyJVGpbnHhO1NDBf5E/CustomCursor.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,useCallback,useEffect,useRef}from\"react\";const PATHNAME_TO_IMAGE_MAP={\"/thegirl\":\"https://framerusercontent.com/images/Gl6NLh209vLtBNJOT63RyepY.png\",\"/thetree\":\"https://framerusercontent.com/images/wOfI8CbygYzPV1uxUq9OCUliHMU.png\",\"/thehand\":\"https://framerusercontent.com/images/kAowH8Qz184NNpEVQV9Xf2s3wnM.png\",\"/thelamb\":\"https://framerusercontent.com/images/RdJVkevmXRtxYI7Yeq7Xn7GldD8.png\"};export function withCustomCursor(Component){return props=>{return /*#__PURE__*/_jsx(Component,{...props,style:{...props.style,cursor:\"pointer\"}});};}export function withShareCurrentUrl(Component){return /*#__PURE__*/forwardRef(function WithShareCurrentUrl(props,ref){const lastTriggerAtRef=useRef(0);const cachedFileRef=useRef(null);const cachedImageUrlRef=useRef(null);const prefetchPromiseRef=useRef(null);const resolvePathnameData=useCallback(()=>{if(typeof window===\"undefined\")return null;const rawPathname=window.location?.pathname??\"\";const normalizedPathname=rawPathname.length>1&&rawPathname.endsWith(\"/\")?rawPathname.slice(0,-1):rawPathname;const imageUrl=PATHNAME_TO_IMAGE_MAP[normalizedPathname];if(!imageUrl)return null;const pageName=normalizedPathname.replace(/^\\/+/,\"\").split(\"/\")[0]||\"card\";return{imageUrl,fileName:`${pageName}-card.png`};},[]);const prefetchShareFile=useCallback(async()=>{if(typeof window===\"undefined\"||typeof navigator===\"undefined\"||typeof document===\"undefined\"){return;}const pathnameData=resolvePathnameData();if(!pathnameData)return;const currentImageUrl=pathnameData.imageUrl;if(cachedFileRef.current&&cachedImageUrlRef.current===currentImageUrl){return;}if(cachedFileRef.current&&cachedImageUrlRef.current!==currentImageUrl){cachedFileRef.current=null;cachedImageUrlRef.current=null;prefetchPromiseRef.current=null;}if(prefetchPromiseRef.current){await prefetchPromiseRef.current;if(cachedFileRef.current&&cachedImageUrlRef.current===currentImageUrl){return;}}const promise=(async()=>{try{const response=await fetch(currentImageUrl);if(!response.ok)return;const blob=await response.blob();const contentType=blob.type||response.headers.get(\"content-type\")||\"image/png\";cachedFileRef.current=new File([blob],pathnameData.fileName,{type:contentType});cachedImageUrlRef.current=currentImageUrl;}catch{// No-op: sharing will fall back to URL/copy if prefetch fails.\n}finally{prefetchPromiseRef.current=null;}})();prefetchPromiseRef.current=promise;await promise;},[resolvePathnameData]);const copyUrlFallback=useCallback(async url=>{if(typeof window===\"undefined\"||typeof navigator===\"undefined\")return;if(!url)return;if(navigator.clipboard&&typeof navigator.clipboard.writeText===\"function\"){try{await navigator.clipboard.writeText(url);if(typeof window.alert===\"function\")window.alert(\"Link copied\");return;}catch{// Fall back to legacy copy below.\n}}if(typeof document!==\"undefined\"&&document.body){const textArea=document.createElement(\"textarea\");textArea.value=url;textArea.setAttribute(\"readonly\",\"\");textArea.style.position=\"absolute\";textArea.style.left=\"-9999px\";document.body.appendChild(textArea);textArea.select();try{document.execCommand(\"copy\");if(typeof window.alert===\"function\")window.alert(\"Link copied\");}catch{// No-op when blocked.\n}finally{document.body.removeChild(textArea);}}},[]);const shareCurrentUrl=useCallback(async()=>{if(typeof window===\"undefined\"||typeof navigator===\"undefined\"||typeof document===\"undefined\"){return;}const url=window.location?.href??\"\";const title=document.title??\"\";try{if(typeof navigator.share===\"function\"){await navigator.share({title,text:\"Share your card.\",url});return;}}catch(error){if(error?.name===\"AbortError\")return;}await copyUrlFallback(url);},[copyUrlFallback]);const shareImageThenFallback=useCallback(async()=>{if(typeof window===\"undefined\"||typeof navigator===\"undefined\"||typeof document===\"undefined\"){return;}const title=document.title||\"Rachel Gore\";const pathnameData=resolvePathnameData();const currentImageUrl=pathnameData?.imageUrl??null;let cachedFile=currentImageUrl&&cachedImageUrlRef.current===currentImageUrl&&cachedFileRef.current?cachedFileRef.current:null;if(!cachedFile&&currentImageUrl){await prefetchShareFile();if(cachedImageUrlRef.current===currentImageUrl){cachedFile=cachedFileRef.current;}}try{if(cachedFile&&typeof navigator.share===\"function\"){const navigatorWithCanShare=navigator;if(typeof navigatorWithCanShare.canShare===\"function\"&&navigatorWithCanShare.canShare({files:[cachedFile]})){await navigator.share({files:[cachedFile],title,text:\"Share your card.\"});return;}}}catch(error){if(error?.name===\"AbortError\")return;}await shareCurrentUrl();},[prefetchShareFile,resolvePathnameData,shareCurrentUrl]);useEffect(()=>{void prefetchShareFile();},[prefetchShareFile]);const triggerOnce=useCallback(async()=>{const now=Date.now();if(now-lastTriggerAtRef.current<700)return;lastTriggerAtRef.current=now;await shareImageThenFallback();},[shareImageThenFallback]);const handleClick=useCallback(async event=>{if(event?.preventDefault)event.preventDefault();if(typeof props.onClick===\"function\")props.onClick(event);await triggerOnce();},[props,triggerOnce]);const handleTap=useCallback(async(event,info)=>{if(event?.preventDefault)event.preventDefault();if(typeof props.onTap===\"function\")props.onTap(event,info);await triggerOnce();},[props,triggerOnce]);const handlePointerDown=useCallback(event=>{if(typeof props.onPointerDown===\"function\"){props.onPointerDown(event);}void prefetchShareFile();},[prefetchShareFile,props]);const handleMouseDown=useCallback(event=>{if(typeof props.onMouseDown===\"function\"){props.onMouseDown(event);}void prefetchShareFile();},[prefetchShareFile,props]);const handleTouchStart=useCallback(event=>{if(typeof props.onTouchStart===\"function\"){props.onTouchStart(event);}void prefetchShareFile();},[prefetchShareFile,props]);return /*#__PURE__*/_jsx(Component,{ref:ref,...props,onClick:handleClick,onTap:handleTap,onPointerDown:handlePointerDown,onMouseDown:handleMouseDown,onTouchStart:handleTouchStart,style:{...props.style}});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withShareCurrentUrl\":{\"type\":\"reactHoc\",\"name\":\"withShareCurrentUrl\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withCustomCursor\":{\"type\":\"reactHoc\",\"name\":\"withCustomC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