{"version":3,"file":"DiscPlayer.CANFCTMf.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/RMiyLAFCWNRCl4EJGDCF/7vFoVOLqCdOhQeAstLq2/DiscPlayer.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useEffect,useRef,startTransition}from\"react\";import{motion,useAnimation}from\"framer-motion\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";/**\n * @framerIntrinsicWidth 300\n * @framerIntrinsicHeight 300\n *\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function DiscPlayer(props){const{audioFile=\"https://framerusercontent.com/assets/8w3IUatLX9a5JVJ6XPCVuHi94.mp3\",backgroundColor=\"#FFFFFF\",discColor=\"#333333\",discImage,needleDotColor=\"#FF5588\",style}=props;const isStatic=useIsStaticRenderer();const[isPlaying,setIsPlaying]=useState(false);const audioRef=useRef(null);const discControls=useAnimation();const needleControls=useAnimation();const discRotationRef=useRef(0);useEffect(()=>{if(isStatic)return;if(!audioRef.current){audioRef.current=new Audio(audioFile);audioRef.current.loop=false;audioRef.current.addEventListener(\"ended\",()=>{startTransition(()=>{setIsPlaying(false);});});}else{audioRef.current.src=audioFile;}return()=>{if(audioRef.current){audioRef.current.pause();audioRef.current.src=\"\";}};},[audioFile,isStatic]);const togglePlayback=()=>{if(!audioRef.current)return;setIsPlaying(!isPlaying);};useEffect(()=>{if(isStatic)return;if(!audioRef.current)return;if(isPlaying){audioRef.current.play();needleControls.start({rotate:0,transition:{duration:1.2,ease:[.32,.72,0,1]}});discControls.start({rotate:[discRotationRef.current,discRotationRef.current+360],transition:{duration:3,ease:\"linear\",repeat:Infinity,repeatType:\"loop\"}});}else{audioRef.current.pause();discControls.stop();const currentTime=audioRef.current.currentTime||0;const rotationsPerSecond=1/3;const additionalRotation=currentTime*rotationsPerSecond*360%360;discRotationRef.current=(discRotationRef.current+additionalRotation)%360;discControls.set({rotate:discRotationRef.current});needleControls.start({rotate:15,transition:{duration:.8,ease:[.32,.72,0,1]}});}},[isPlaying,discControls,needleControls,isStatic]);return /*#__PURE__*/_jsx(\"div\",{style:{position:\"relative\",backgroundColor,borderRadius:24,overflow:\"hidden\",display:\"flex\",flexDirection:\"column\",alignItems:\"center\",justifyContent:\"center\",padding:24,...style},children:/*#__PURE__*/_jsxs(\"div\",{style:{position:\"relative\",width:\"80%\",aspectRatio:\"1\",display:\"flex\",justifyContent:\"center\",alignItems:\"center\"},children:[/*#__PURE__*/_jsxs(motion.div,{animate:discControls,initial:{rotate:0},style:{position:\"relative\",width:\"100%\",height:\"100%\",borderRadius:\"50%\",backgroundColor:discColor,display:\"flex\",justifyContent:\"center\",alignItems:\"center\",cursor:\"pointer\",backgroundImage:discImage?`url(${discImage.src})`:\"none\",backgroundSize:\"cover\",backgroundPosition:\"center\"},onClick:togglePlayback,children:[/*#__PURE__*/_jsx(\"div\",{style:{width:\"30%\",height:\"30%\",borderRadius:\"50%\",background:`radial-gradient(circle, #888888 0%, ${discColor} 70%)`,boxShadow:\"inset 0 0 10px rgba(0, 0, 0, 0.5)\"}}),/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",top:0,left:0,width:\"100%\",height:\"100%\",borderRadius:\"50%\",background:\"linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, transparent 50%, transparent 100%)\",pointerEvents:\"none\"}}),Array.from({length:8},(_,i)=>/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",top:\"50%\",left:\"50%\",width:`${85-i*10}%`,height:`${85-i*10}%`,transform:\"translate(-50%, -50%)\",borderRadius:\"50%\",border:\"1px solid rgba(0, 0, 0, 0.2)\"}},i))]}),/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",top:\"10%\",right:\"-5%\",width:\"35%\",height:\"10%\",transformOrigin:\"right center\",zIndex:10},children:/*#__PURE__*/_jsxs(motion.div,{animate:needleControls,initial:{rotate:15},style:{position:\"relative\",width:\"100%\",height:\"100%\",transformOrigin:\"right center\"},children:[/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",right:0,top:\"50%\",transform:\"translateY(-50%)\",width:20,height:20,borderRadius:\"50%\",backgroundColor:\"#888\",boxShadow:\"0 2px 4px rgba(0, 0, 0, 0.3)\"}}),/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",right:10,top:\"50%\",transform:\"translateY(-50%)\",width:\"90%\",height:4,backgroundColor:\"#888\",boxShadow:\"0 2px 4px rgba(0, 0, 0, 0.2)\"}}),/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",left:-5,top:\"50%\",transform:\"translateY(-50%)\",width:12,height:12,borderRadius:\"50%\",backgroundColor:needleDotColor}})]})})]})});}addPropertyControls(DiscPlayer,{audioFile:{type:ControlType.File,title:\"Audio File\",allowedFileTypes:[\"mp3\",\"wav\",\"ogg\"]},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#FFFFFF\"},discColor:{type:ControlType.Color,title:\"Disc Color\",defaultValue:\"#333333\"},needleDotColor:{type:ControlType.Color,title:\"Needle Dot Color\",defaultValue:\"#3680ce\"},discImage:{type:ControlType.ResponsiveImage,title:\"Disc Image\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"DiscPlayer\",\"slots\":[],\"annotations\":{\"framerIntrinsicHeight\":\"300\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerIntrinsicWidth\":\"300\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./DiscPlayer.map"],"mappings":"sQAMG,SAAwB,EAAW,EAAM,CAAC,GAAK,CAAC,YAAU,qEAAqE,kBAAgB,UAAU,YAAU,UAAU,YAAU,iBAAe,UAAU,SAAO,EAAY,EAAS,GAAqB,CAAM,CAAC,EAAU,GAAcA,EAAS,GAAM,CAAO,EAASC,EAAO,KAAK,CAAO,EAAa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