{"version":3,"file":"SoundEffectPlayer.D9DWjFb4.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/R75CwIoEu7YggerNLnHP/2M3U1JVzVzs8klDzjLMt/SoundEffectPlayer.js"],"sourcesContent":["// Sound Effect Trigger\n// Plays a sound when the component is activated (e.g. on hover, tap, or via state change)\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";/**\n * Sound Effect Trigger\n *\n * @framerIntrinsicWidth 40\n * @framerIntrinsicHeight 40\n *\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function SoundEffectPlayer(props){const{soundFile=\"https://framerusercontent.com/assets/8w3IUatLX9a5JVJ6XPCVuHi94.mp3\",volume,playOn,loop,duration=1,startTime=0,delay=1,style}=props// ADDED delay = 1\n;const audioRef=useRef(null);useEffect(()=>{if(!audioRef.current)return;audioRef.current.volume=volume;audioRef.current.loop=loop;},[volume,loop]);// Play on mount\nuseEffect(()=>{if(playOn===\"mount\"&&audioRef.current){audioRef.current.currentTime=startTime||0;audioRef.current.play();if(duration<60){setTimeout(()=>{if(audioRef.current)audioRef.current.pause();},duration*1e3);}}},[playOn,soundFile,duration,startTime]);// Play on hover/tap\nfunction triggerPlay(){if(audioRef.current){audioRef.current.currentTime=startTime||0;audioRef.current.play();if(duration<60){setTimeout(()=>{if(audioRef.current)audioRef.current.pause();},duration*1e3);}}}// Add a 1s delay to prevent rapid re-triggering on hover\nconst lastPlayRef=useRef(0);function triggerPlayWithDelay(){const now=Date.now();if(now-lastPlayRef.current<delay*1e3)return;// CHANGED to use delay prop\nlastPlayRef.current=now;triggerPlay();}// Hide in thumbnail/canvas\nif(RenderTarget.current()===RenderTarget.thumbnail||RenderTarget.current()===RenderTarget.canvas){return null;}return /*#__PURE__*/_jsx(\"div\",{style:{...style,width:\"100%\",height:\"100%\",position:\"relative\",background:\"transparent\"},onMouseEnter:playOn===\"hover\"?triggerPlayWithDelay:undefined,onClick:playOn===\"tap\"?triggerPlay:undefined,tabIndex:-1,\"aria-hidden\":\"true\",children:/*#__PURE__*/_jsx(\"audio\",{ref:audioRef,src:soundFile,preload:\"auto\"})});}addPropertyControls(SoundEffectPlayer,{soundFile:{type:ControlType.File,allowedFileTypes:[\"mp3\",\"wav\",\"ogg\"],title:\"Sound File\"},volume:{type:ControlType.Number,title:\"Volume\",min:0,max:1,step:.01,defaultValue:1},playOn:{type:ControlType.Enum,title:\"Play On\",options:[\"mount\",\"hover\",\"tap\"],optionTitles:[\"Mount\",\"Hover\",\"Tap\"],defaultValue:\"hover\",displaySegmentedControl:true},loop:{type:ControlType.Boolean,title:\"Loop\",defaultValue:false,enabledTitle:\"Yes\",disabledTitle:\"No\"},duration:{type:ControlType.Number,title:\"Duration (s)\",min:.05,max:60,step:.01,defaultValue:1},startTime:{type:ControlType.Number,title:\"Start Time (s)\",min:0,max:1e3,step:.01,defaultValue:0},delay:{type:ControlType.Number,title:\"Delay (s)\",min:0,max:10,step:.01,defaultValue:1}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"SoundEffectPlayer\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"fixed\",\"framerIntrinsicWidth\":\"40\",\"framerContractVersion\":\"1\",\"framerIntrinsicHeight\":\"40\",\"framerSupportedLayoutWidth\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./SoundEffectPlayer.map"],"mappings":"wLAUG,SAAwB,EAAkB,EAAM,CAAC,GAAK,CAAC,YAAU,qEAAqE,SAAO,SAAO,OAAK,WAAS,EAAE,YAAU,EAAE,QAAM,EAAE,SAAO,EAC3L,EAASA,EAAO,IAAI,EAAE,MAAc,CAAK,EAAS,UAAe,EAAS,QAAQ,OAAO,EAAO,EAAS,QAAQ,KAAK,EAAK,EAAE,CAAC,EAAO,CAAI,CAAC,EACjJ,MAAc,CAAI,IAAS,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