{"version":3,"file":"SoundFX.B2L4qCiK.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/QTis99gEhnNg8OCVhv5e/tWv8sK0CnaA6cgKzGHq1/SoundFX.js"],"sourcesContent":["// Global sound effects for SYME Studio V2.\n// Ported from the working ClickSound component in SYME Studio V1 — the sound URLs are\n// hard-coded there, which is why it works without any setup. The earlier V2 attempt used\n// File/URL property controls that were left empty, so there was no audio source at all.\n//\n// Covers: hover on any link or button, click on any link or button, and a whoosh when\n// navigating to another page. Ambient background music is available but off by default.\n//\n// Browsers block audio until the user interacts with the page, so nothing plays until\n// the first click, tap or keypress.\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";const CLICK_SOUND=\"https://assets.codepen.io/7558/shutter-fx-001.mp3\";const HOVER_SOUND=\"https://assets.codepen.io/7558/click-reverb-001.mp3\";const SWITCH_SOUND=\"https://assets.codepen.io/7558/whoosh-fx-001.mp3\";/**\n * Sound FX\n *\n * Place one instance on each page. Renders nothing on the published site.\n *\n * @framerIntrinsicWidth 40\n * @framerIntrinsicHeight 40\n *\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function SoundFX(props){const{clickVolume=.3,hoverVolume=.15,switchVolume=.3,ambientUrl=\"\",ambientVolume=.15,enableAmbient=false,enabled=true,style}=props;const isStatic=useIsStaticRenderer();const ambientRef=useRef(null);const ambientStarted=useRef(false);// Ambient music — starts on the first user interaction, then fades in\nuseEffect(()=>{if(isStatic||!enabled)return;if(!enableAmbient||!ambientUrl)return;const audio=new Audio(ambientUrl);audio.loop=true;audio.volume=0;audio.preload=\"auto\";ambientRef.current=audio;const fadeIn=target=>{let v=0;const interval=setInterval(()=>{v+=.005;if(v>=target){audio.volume=target;clearInterval(interval);}else{audio.volume=v;}},100);};const startAmbient=()=>{if(ambientStarted.current)return;ambientStarted.current=true;audio.play().then(()=>fadeIn(ambientVolume)).catch(()=>{});document.removeEventListener(\"click\",startAmbient);document.removeEventListener(\"keydown\",startAmbient);document.removeEventListener(\"touchstart\",startAmbient);};document.addEventListener(\"click\",startAmbient);document.addEventListener(\"keydown\",startAmbient);document.addEventListener(\"touchstart\",startAmbient);return()=>{document.removeEventListener(\"click\",startAmbient);document.removeEventListener(\"keydown\",startAmbient);document.removeEventListener(\"touchstart\",startAmbient);if(ambientRef.current){ambientRef.current.pause();ambientRef.current=null;}};},[isStatic,enabled,enableAmbient,ambientUrl,ambientVolume]);// Hover / click / page-switch sounds\nuseEffect(()=>{if(isStatic||!enabled)return;if(typeof document===\"undefined\")return;const SELECTOR='a, button, [role=\"button\"], [data-framer-component-type]';const play=(url,vol)=>{try{const a=new Audio(url);a.volume=Math.min(1,Math.max(0,vol));a.play().catch(()=>{});}catch(_){}};let lastHovered=null;const handleClick=e=>{const t=e.target;if(t?.closest?.(SELECTOR))play(CLICK_SOUND,clickVolume);};const handleOver=e=>{const t=e.target;const el=t?.closest?.(SELECTOR);if(el&&el!==lastHovered){lastHovered=el;play(HOVER_SOUND,hoverVolume);}};const handleOut=e=>{const t=e.target;if(t?.closest?.(SELECTOR)===lastHovered)lastHovered=null;};const handleNav=e=>{const t=e.target;const link=t?.closest?.(\"a\");if(link?.href&&!link.target&&!link.href.startsWith(\"mailto\")){play(SWITCH_SOUND,switchVolume);}};const handlePop=()=>play(SWITCH_SOUND,switchVolume);document.addEventListener(\"click\",handleClick,true);document.addEventListener(\"mouseover\",handleOver,true);document.addEventListener(\"mouseout\",handleOut,true);document.addEventListener(\"click\",handleNav,true);window.addEventListener(\"popstate\",handlePop);return()=>{document.removeEventListener(\"click\",handleClick,true);document.removeEventListener(\"mouseover\",handleOver,true);document.removeEventListener(\"mouseout\",handleOut,true);document.removeEventListener(\"click\",handleNav,true);window.removeEventListener(\"popstate\",handlePop);};},[isStatic,enabled,clickVolume,hoverVolume,switchVolume]);// Dashed marker on the canvas so the layer is findable; hidden once published\nif(isStatic){return /*#__PURE__*/_jsx(\"div\",{style:{...style,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",border:\"1px dashed rgba(0,0,0,0.3)\",borderRadius:8,fontSize:10,fontFamily:\"sans-serif\",color:\"rgba(0,0,0,0.5)\",textAlign:\"center\",lineHeight:1.2},children:\"Sound FX\"});}return /*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",width:1,height:1,opacity:0,pointerEvents:\"none\"},\"aria-hidden\":\"true\"});}addPropertyControls(SoundFX,{enabled:{type:ControlType.Boolean,title:\"Enabled\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},hoverVolume:{type:ControlType.Number,title:\"Hover Vol\",defaultValue:.15,min:0,max:1,step:.05,displayStepper:true},clickVolume:{type:ControlType.Number,title:\"Click Vol\",defaultValue:.3,min:0,max:1,step:.05,displayStepper:true},switchVolume:{type:ControlType.Number,title:\"Switch Vol\",defaultValue:.3,min:0,max:1,step:.05,displayStepper:true},enableAmbient:{type:ControlType.Boolean,title:\"Ambient\",defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\"},ambientUrl:{type:ControlType.String,title:\"Ambient URL\",defaultValue:\"\",placeholder:\"https://...mp3\",hidden:p=>!p.enableAmbient},ambientVolume:{type:ControlType.Number,title:\"Ambient Vol\",defaultValue:.15,min:0,max:1,step:.01,displayStepper:true,hidden:p=>!p.enableAmbient}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"SoundFX\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"fixed\",\"framerIntrinsicHeight\":\"40\",\"framerIntrinsicWidth\":\"40\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./SoundFX.map"],"mappings":"uMAoBG,SAAwB,EAAQ,EAAM,CAAC,GAAK,CAAC,cAAY,GAAG,cAAY,IAAI,eAAa,GAAG,aAAW,GAAG,gBAA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