{"version":3,"file":"AudioPlayerButton.CzCUiPM7.mjs","names":["useRef","useState","startTransition","useMemo"],"sources":["https:/framerusercontent.com/modules/6bP8kKMcmjyMBZ4dtW9J/NJLpUEXJ1NWYnfq7I1o3/AudioPlayerButton.js"],"sourcesContent":["// User request: keep all existing AudioPlayerButton behavior/controls and compact sizing, while adding squircle-style corner support on the root button (Framer-like squircle 50%) with borderRadius as fallback.\n// Play/Pause Button with Sound\n// Plays a sound on click, toggles icon between play and pause\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useRef,useState,useEffect,useMemo,startTransition}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";/**\n * AudioPlayerButton\n *\n * @framerIntrinsicWidth 180\n * @framerIntrinsicHeight 40\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight fixed\n */export default function AudioPlayerButton(props){const{label,audioFile=\"https://framerusercontent.com/assets/8w3IUatLX9a5JVJ6XPCVuHi94.mp3\",background,textColor,iconColor,borderRadius,font,style}=props;const audioRef=useRef(null);const[playing,setPlaying]=useState(false);const[isHovered,setIsHovered]=useState(false);useEffect(()=>{if(!audioRef.current)return;const audio=audioRef.current;const handleEnded=()=>startTransition(()=>setPlaying(false));audio.addEventListener(\"ended\",handleEnded);return()=>audio.removeEventListener(\"ended\",handleEnded);},[]);useEffect(()=>{if(!audioRef.current)return;if(playing){audioRef.current.play();}else{audioRef.current.pause();audioRef.current.currentTime=0;}},[playing]);function handleClick(){startTransition(()=>setPlaying(p=>!p));}const buttonStyle=useMemo(()=>({...style,position:\"relative\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",gap:4,background:isHovered?\"#DADCE3\":background,color:textColor,border:\"none\",borderRadius,height:40,padding:\"0 16px 0 8px\",cursor:\"pointer\",outline:\"none\",overflow:\"hidden\",transition:\"background 0.2s ease-in-out\",...font,// Non-standard squircle hints for supporting engines; borderRadius remains fallback.\n    cornerShape:\"squircle\",cornerSmoothing:\"0.5\",[\"corner-shape\"]:\"squircle\"}),[style,isHovered,background,textColor,borderRadius,font]);if(RenderTarget.current()===RenderTarget.thumbnail)return null;return /*#__PURE__*/_jsxs(\"button\",{style:buttonStyle,onClick:handleClick,onMouseEnter:()=>startTransition(()=>setIsHovered(true)),onMouseLeave:()=>startTransition(()=>setIsHovered(false)),\"aria-pressed\":playing,type:\"button\",children:[/*#__PURE__*/_jsx(\"span\",{style:{display:\"flex\",alignItems:\"center\"},children:playing?// Pause icon\n/*#__PURE__*/_jsxs(\"svg\",{width:\"20\",height:\"20\",viewBox:\"0 0 20 20\",fill:\"none\",\"aria-label\":\"Pause\",style:{display:\"block\"},children:[/*#__PURE__*/_jsx(\"rect\",{x:\"7\",y:\"4\",width:\"2\",height:\"14\",fill:iconColor}),/*#__PURE__*/_jsx(\"rect\",{x:\"14\",y:\"4\",width:\"2\",height:\"14\",fill:iconColor})]}):// Play icon (stroked outline triangle)\n/*#__PURE__*/_jsx(\"svg\",{xmlns:\"http://www.w3.org/2000/svg\",width:\"24\",height:\"24\",viewBox:\"0 0 24 24\",fill:\"none\",\"aria-label\":\"Play\",style:{display:\"block\"},children:/*#__PURE__*/_jsx(\"path\",{d:\"M8 5.5L18 12L8 18.5Z\",fill:\"none\",stroke:iconColor,strokeWidth:\"2\"})})}),/*#__PURE__*/_jsx(\"span\",{style:{fontWeight:600},children:label}),/*#__PURE__*/_jsx(\"audio\",{ref:audioRef,src:audioFile,preload:\"auto\"})]});}addPropertyControls(AudioPlayerButton,{label:{type:ControlType.String,title:\"Label\",defaultValue:\"Listen Now\"},audioFile:{type:ControlType.File,allowedFileTypes:[\"mp3\",\"wav\",\"ogg\"]},background:{type:ControlType.Color,title:\"Background\",defaultValue:\"#D8D9DF\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#00124D\"},iconColor:{type:ControlType.Color,title:\"Icon Color\",defaultValue:\"#00124D\"},borderRadius:{type:ControlType.Number,title:\"Radius\",defaultValue:100,min:0,max:100},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"14px\",variant:\"SemiBold\",letterSpacing:\"-0.01em\",lineHeight:\"100%\"}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"AudioPlayerButton\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerIntrinsicWidth\":\"180\",\"framerIntrinsicHeight\":\"40\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./AudioPlayerButton.map"],"mappings":"+MAWG,SAAwB,EAAkB,EAAM,CAAC,GAAK,CAAC,QAAM,YAAU,qEAAqE,aAAW,YAAU,YAAU,eAAa,OAAK,SAAO,EAAY,EAASA,EAAO,IAAI,EAAO,CAAC,EAAQ,GAAYC,EAAS,EAAK,EAAO,CAAC,EAAU,GAAcA,EAAS,EAAK,EAAE,MAAc,CAAC,GAAG,CAAC,EAAS,QAAQ,OAAO,IAAM,EAAM,EAAS,QAAc,MAAgBC,MAAoB,EAAW,EAAK,CAAC,EAA8C,OAA5C,EAAM,iBAAiB,QAAQ,CAAW,MAAY,EAAM,oBAAoB,QAAQ,CAAW,CAAE,EAAE,CAAC,CAAC,EAAE,MAAc,CAAK,EAAS,UAAkB,EAAS,EAAS,QAAQ,KAAK,GAAQ,EAAS,QAAQ,MAAM,EAAE,EAAS,QAAQ,YAAY,GAAG,EAAE,CAAC,CAAO,CAAC,EAAE,SAAS,GAAa,CAAC,MAAoB,EAAW,GAAG,CAAC,CAAC,CAAC,CAAE,CAAC,IAAM,EAAYC,OAAa,CAAC,GAAG,EAAM,SAAS,WAAW,QAAQ,OAAO,WAAW,SAAS,eAAe,SAAS,IAAI,EAAE,WAAW,EAAU,UAAU,EAAW,MAAM,EAAU,OAAO,OAAO,eAAa,OAAO,GAAG,QAAQ,eAAe,OAA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