{"version":3,"file":"ClickSound.Bf7Vy8br.mjs","names":["useRef","__esmMin","init_npm_react_18_3_1","c","init_jsx_runtime","ce","de","withClickSound","ref","getVideo","el","observer","entry","video","handleClick","props","turnOn","Component","init_ClickSound"],"sources":["https:/framerusercontent.com/modules/l01VE24nTKUCiSx3gPNz/ew8Jyjqsp9NnQNuUzibd/ClickSound.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";export function withClickSound(Component){return props=>{const ref=useRef(null);const getVideo=()=>ref.current?.querySelector(\"video\");// Mute automatically when the video scrolls out of view\nuseEffect(()=>{const el=ref.current;if(!el)return;const observer=new IntersectionObserver(([entry])=>{const video=getVideo();if(video&&!entry.isIntersecting)video.muted=true;});observer.observe(el);return()=>observer.disconnect();},[]);const handleClick=e=>{props.onClick?.(e);const video=getVideo();if(!video)return;const turnOn=video.muted;// Only one video with sound at a time\ndocument.querySelectorAll(\"video\").forEach(v=>v.muted=true);if(turnOn){video.muted=false;video.volume=1;video.play().catch(()=>{});}};return /*#__PURE__*/_jsx(Component,{...props,ref:ref,onClick:handleClick});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withClickSound\":{\"type\":\"reactHoc\",\"name\":\"withClickSound\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ClickSound.map"],"mappings":"A,yHAA+E,SAAgBO,EAAe,EAAU,CAAC,MAAO,IAAO,CAAC,IAAMC,EAAIR,EAAO,IAAI,EAAQS,MAAaD,EAAI,SAAS,cAAc,OAAO,EACpNH,MAAc,CAAC,IAAMK,EAAGF,EAAI,QAAQ,GAAG,CAACE,EAAG,OAAO,IAAMC,EAAS,IAAI,sBAAsB,CAACC,KAAS,CAAC,IAAMC,EAAMJ,EAAS,EAAKI,GAAO,CAACD,EAAM,iBAAe,EAAM,MAAM,GAAK,CAAC,EAAuB,OAArBD,EAAS,QAAQD,CAAE,MAAYC,EAAS,WAAW,CAAE,EAAE,CAAC,CAAC,EAAE,IAAMG,EAAY,GAAG,CAACC,EAAM,UAAU,CAAC,EAAE,IAAMF,EAAMJ,EAAS,EAAE,GAAG,CAACI,EAAM,OAAO,IAAMG,EAAOH,EAAM,MAChV,SAAS,iBAAiB,OAAO,CAAC,CAAC,QAAQ,GAAG,EAAE,MAAM,EAAI,EAAKG,IAAQ,EAAM,MAAM,GAAM,EAAM,OAAO,EAAEH,EAAM,KAAK,CAAC,CAAC,UAAU,CAAC,CAAC,EAAG,EAAE,MAAoB,gBAAKI,EAAU,CAAC,GAAGF,EAAU,MAAI,QAAQD,CAAW,CAAC,CAAE,CAAE,C"}