{"version":3,"file":"AudioPlayer.CgCiAmF2.mjs","names":["useRef","useState","useCallback"],"sources":["https:/framerusercontent.com/modules/j97Fqx3aQ2d5FHf8NtoD/5PLe9k8NXF2zHM9xOv9S/AudioPlayer.js"],"sourcesContent":["// Audio player component with CMS URL connection capability\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useRef,useEffect,useCallback,startTransition}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";/**\n * Audio Player Component with CMS URL support\n *\n * @framerIntrinsicWidth 400\n * @framerIntrinsicHeight 120\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function AudioPlayer(props){const{audioUrl=\"https://framerusercontent.com/assets/8w3IUatLX9a5JVJ6XPCVuHi94.mp3\",title=\"Sample Audio\",artist=\"Unknown Artist\",showTitle=true,showArtist=true,showTime=true,showProgress=true,autoPlay=false,loop=false,volume=.8,backgroundColor=\"#FFFFFF\",primaryColor=\"#000000\",progressColor=\"#000000\",textColor=\"#000000\",titleFont,artistFont,timeFont,borderRadius=12}=props;const audioRef=useRef(null);const progressRef=useRef(null);const[isPlaying,setIsPlaying]=useState(false);const[currentTime,setCurrentTime]=useState(0);const[duration,setDuration]=useState(0);const[isLoading,setIsLoading]=useState(true);const[error,setError]=useState(false);const isStatic=useIsStaticRenderer();// Format time helper\nconst formatTime=useCallback(time=>{if(isNaN(time))return\"0:00\";const minutes=Math.floor(time/60);const seconds=Math.floor(time%60);return`${minutes}:${seconds.toString().padStart(2,\"0\")}`;},[]);// Audio event handlers\nuseEffect(()=>{const audio=audioRef.current;if(!audio||isStatic)return;const handleLoadedMetadata=()=>{startTransition(()=>{setDuration(audio.duration);setIsLoading(false);setError(false);});};const handleTimeUpdate=()=>{startTransition(()=>{setCurrentTime(audio.currentTime);});};const handleEnded=()=>{startTransition(()=>{setIsPlaying(false);setCurrentTime(0);});};const handleError=()=>{startTransition(()=>{setError(true);setIsLoading(false);});};const handleCanPlay=()=>{startTransition(()=>{setIsLoading(false);});};audio.addEventListener(\"loadedmetadata\",handleLoadedMetadata);audio.addEventListener(\"timeupdate\",handleTimeUpdate);audio.addEventListener(\"ended\",handleEnded);audio.addEventListener(\"error\",handleError);audio.addEventListener(\"canplay\",handleCanPlay);return()=>{audio.removeEventListener(\"loadedmetadata\",handleLoadedMetadata);audio.removeEventListener(\"timeupdate\",handleTimeUpdate);audio.removeEventListener(\"ended\",handleEnded);audio.removeEventListener(\"error\",handleError);audio.removeEventListener(\"canplay\",handleCanPlay);};},[audioUrl,isStatic]);// Set volume\nuseEffect(()=>{if(audioRef.current&&!isStatic){audioRef.current.volume=volume;}},[volume,isStatic]);// Play/pause handler\nconst togglePlayPause=useCallback(()=>{if(isStatic||!audioRef.current)return;if(isPlaying){audioRef.current.pause();startTransition(()=>setIsPlaying(false));}else{audioRef.current.play().catch(()=>{startTransition(()=>setError(true));});startTransition(()=>setIsPlaying(true));}},[isPlaying,isStatic]);// Progress bar click handler\nconst handleProgressClick=useCallback(e=>{if(isStatic||!audioRef.current||!progressRef.current)return;const rect=progressRef.current.getBoundingClientRect();const clickX=e.clientX-rect.left;const newTime=clickX/rect.width*duration;audioRef.current.currentTime=newTime;startTransition(()=>setCurrentTime(newTime));},[duration,isStatic]);const progress=duration>0?currentTime/duration*100:0;return /*#__PURE__*/_jsxs(\"div\",{style:{...props.style,position:\"relative\",width:\"100%\",height:\"100%\",backgroundColor,borderRadius,padding:\"16px\",display:\"flex\",flexDirection:\"column\",justifyContent:\"space-between\",boxShadow:\"0 2px 8px rgba(0,0,0,0.1)\",overflow:\"hidden\"},children:[!isStatic&&/*#__PURE__*/_jsx(\"audio\",{ref:audioRef,src:audioUrl,loop:loop,autoPlay:autoPlay,preload:\"metadata\"}),/*#__PURE__*/_jsxs(\"div\",{style:{flex:1,minHeight:0},children:[showTitle&&/*#__PURE__*/_jsx(\"div\",{style:{...titleFont,color:textColor,marginBottom:showArtist?\"4px\":\"0\",overflow:\"hidden\",textOverflow:\"ellipsis\",whiteSpace:\"nowrap\"},children:title}),showArtist&&/*#__PURE__*/_jsx(\"div\",{style:{...artistFont,color:textColor,opacity:.7,overflow:\"hidden\",textOverflow:\"ellipsis\",whiteSpace:\"nowrap\"},children:artist})]}),/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",alignItems:\"center\",gap:\"12px\",marginTop:\"8px\"},children:[/*#__PURE__*/_jsx(\"button\",{onClick:togglePlayPause,disabled:isLoading||error||isStatic,style:{width:\"40px\",height:\"40px\",borderRadius:\"50%\",border:\"none\",backgroundColor:primaryColor,color:backgroundColor,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",cursor:isStatic||isLoading||error?\"default\":\"pointer\",opacity:isLoading||error?.5:1},children:isLoading?/*#__PURE__*/_jsx(\"div\",{style:{width:\"16px\",height:\"16px\",border:`2px solid ${backgroundColor}`,borderTop:\"2px solid transparent\",borderRadius:\"50%\",animation:\"spin 1s linear infinite\"}}):error?\"!\":isPlaying?/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",gap:\"2px\"},children:[/*#__PURE__*/_jsx(\"div\",{style:{width:\"3px\",height:\"12px\",backgroundColor:backgroundColor}}),/*#__PURE__*/_jsx(\"div\",{style:{width:\"3px\",height:\"12px\",backgroundColor:backgroundColor}})]}):/*#__PURE__*/_jsx(\"div\",{style:{width:0,height:0,borderLeft:`8px solid ${backgroundColor}`,borderTop:\"6px solid transparent\",borderBottom:\"6px solid transparent\",marginLeft:\"2px\"}})}),showProgress&&/*#__PURE__*/_jsx(\"div\",{style:{flex:1,display:\"flex\",alignItems:\"center\",gap:\"8px\"},children:/*#__PURE__*/_jsx(\"div\",{ref:progressRef,onClick:handleProgressClick,style:{flex:1,height:\"4px\",backgroundColor:`${progressColor}20`,borderRadius:\"2px\",cursor:isStatic?\"default\":\"pointer\",position:\"relative\",overflow:\"hidden\"},children:/*#__PURE__*/_jsx(\"div\",{style:{width:`${progress}%`,height:\"100%\",backgroundColor:progressColor,borderRadius:\"2px\",transition:\"width 0.1s ease\"}})})}),showTime&&/*#__PURE__*/_jsxs(\"div\",{style:{...timeFont,color:textColor,opacity:.7,minWidth:\"80px\",textAlign:\"right\"},children:[formatTime(currentTime),\" / \",formatTime(duration)]})]}),error&&/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",top:\"50%\",left:\"50%\",transform:\"translate(-50%, -50%)\",color:textColor,opacity:.7,fontSize:\"12px\",textAlign:\"center\"},children:\"Failed to load audio\"})]});}addPropertyControls(AudioPlayer,{audioUrl:{type:ControlType.File,title:\"Audio File\",allowedFileTypes:[\"mp3\",\"wav\",\"ogg\",\"m4a\",\"aac\"]},title:{type:ControlType.String,title:\"Title\",defaultValue:\"Sample Audio\"},artist:{type:ControlType.String,title:\"Artist\",defaultValue:\"Unknown Artist\"},showTitle:{type:ControlType.Boolean,title:\"Show Title\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},showArtist:{type:ControlType.Boolean,title:\"Show Artist\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},showTime:{type:ControlType.Boolean,title:\"Show Time\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},showProgress:{type:ControlType.Boolean,title:\"Show Progress\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},autoPlay:{type:ControlType.Boolean,title:\"Auto Play\",defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\"},loop:{type:ControlType.Boolean,title:\"Loop\",defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\"},volume:{type:ControlType.Number,title:\"Volume\",defaultValue:.8,min:0,max:1,step:.1},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#FFFFFF\"},primaryColor:{type:ControlType.Color,title:\"Primary Color\",defaultValue:\"#000000\"},progressColor:{type:ControlType.Color,title:\"Progress Color\",defaultValue:\"#000000\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},titleFont:{type:ControlType.Font,title:\"Title Font\",defaultValue:{fontSize:\"16px\",variant:\"Semibold\",letterSpacing:\"-0.01em\",lineHeight:\"1.2em\"},controls:\"extended\",defaultFontType:\"sans-serif\"},artistFont:{type:ControlType.Font,title:\"Artist Font\",defaultValue:{fontSize:\"14px\",variant:\"Medium\",letterSpacing:\"-0.01em\",lineHeight:\"1.2em\"},controls:\"extended\",defaultFontType:\"sans-serif\"},timeFont:{type:ControlType.Font,title:\"Time Font\",defaultValue:{fontSize:\"12px\",variant:\"Medium\",letterSpacing:\"0em\",lineHeight:\"1em\"},controls:\"extended\",defaultFontType:\"sans-serif\"},borderRadius:{type:ControlType.Number,title:\"Border Radius\",defaultValue:12,min:0,max:32,step:1,unit:\"px\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"AudioPlayer\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\",\"framerIntrinsicWidth\":\"400\",\"framerIntrinsicHeight\":\"120\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./AudioPlayer.map"],"mappings":"qNASG,SAAwB,EAAY,EAAM,CAAC,GAAK,CAAC,WAAS,qEAAqE,QAAM,eAAe,SAAO,iBAAiB,YAAU,GAAK,aAAW,GAAK,WAAS,GAAK,eAAa,GAAK,WAAS,GAAM,OAAK,GAAM,SAAO,GAAG,kBAAgB,UAAU,eAAa,UAAU,gBAAc,UAAU,YAAU,UAAU,YAAU,aAAW,WAAS,eAAa,IAAI,EAAY,EAASA,EAAO,KAAK,CAAO,EAAYA,EAAO,KAAK,CAAM,CAAC,EAAU,GAAcC,EAAS,GAAM,CAAM,CAAC,EAAY,GAAgBA,EAAS,EAAE,CAAM,CAAC,EAAS,GAAaA,EAAS,EAAE,CAAM,CAAC,EAAU,GAAcA,EAAS,GAAK,CAAM,CAAC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