{"version":3,"file":"PlayPauseButton.DOZPss9c.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/hP9RIuD0OC9nlNsoKo7K/ZzrvCtGfdTbeFzrJzARm/PlayPauseButton.js"],"sourcesContent":["// GIF Player with play/pause controls\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useRef,useEffect,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * GIF Player with play/pause controls\n *\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function PlayPauseButton(props){const{gifUrl=\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",autoPlay=true,showControls=true,controlsPosition=\"center\",buttonSize=60,buttonColor=\"#FFFFFF\",buttonBackground=\"rgba(0, 0, 0, 0.5)\",borderRadius=8,shadow=false}=props;const[isPlaying,setIsPlaying]=useState(autoPlay);const[staticFrame,setStaticFrame]=useState(\"\");const canvasRef=useRef(null);const imgRef=useRef(null);// Capture first frame when GIF loads\nuseEffect(()=>{if(typeof window===\"undefined\")return;const img=new Image;img.crossOrigin=\"anonymous\";img.onload=()=>{const canvas=canvasRef.current;if(!canvas)return;const ctx=canvas.getContext(\"2d\");if(!ctx)return;canvas.width=img.width;canvas.height=img.height;ctx.drawImage(img,0,0);startTransition(()=>{setStaticFrame(canvas.toDataURL());});};img.src=gifUrl;},[gifUrl]);const togglePlayPause=()=>{startTransition(()=>{setIsPlaying(!isPlaying);});};const getControlsStyle=()=>{const baseStyle={position:\"absolute\",zIndex:10};switch(controlsPosition){case\"top-left\":return{...baseStyle,top:16,left:16};case\"top-right\":return{...baseStyle,top:16,right:16};case\"bottom-left\":return{...baseStyle,bottom:16,left:16};case\"bottom-right\":return{...baseStyle,bottom:16,right:16};case\"center\":default:return{...baseStyle,top:\"50%\",left:\"50%\",transform:\"translate(-50%, -50%)\"};}};return /*#__PURE__*/_jsxs(\"div\",{style:{position:\"relative\",width:\"100%\",height:\"100%\",overflow:\"hidden\",borderRadius,backgroundColor:\"#f0f0f0\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",boxShadow:shadow?\"0 4px 20px rgba(0, 0, 0, 0.15)\":\"none\"},children:[/*#__PURE__*/_jsx(\"canvas\",{ref:canvasRef,style:{display:\"none\"}}),isPlaying?/*#__PURE__*/_jsx(\"img\",{ref:imgRef,src:gifUrl,alt:\"Animated GIF\",style:{width:\"100%\",height:\"100%\",objectFit:\"cover\"}}):/*#__PURE__*/_jsx(\"img\",{src:staticFrame||gifUrl,alt:\"Static frame\",style:{width:\"100%\",height:\"100%\",objectFit:\"cover\"}}),showControls&&!isPlaying&&/*#__PURE__*/_jsx(\"button\",{onClick:togglePlayPause,style:{...getControlsStyle(),width:buttonSize,height:buttonSize,borderRadius:\"50%\",border:\"none\",backgroundColor:buttonBackground,color:buttonColor,cursor:\"pointer\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",transition:\"all 0.2s ease\",opacity:.9},onMouseEnter:e=>{e.currentTarget.style.opacity=\"1\";e.currentTarget.style.transform=controlsPosition===\"center\"?\"translate(-50%, -50%) scale(1.1)\":\"scale(1.1)\";},onMouseLeave:e=>{e.currentTarget.style.opacity=\"0.9\";e.currentTarget.style.transform=controlsPosition===\"center\"?\"translate(-50%, -50%) scale(1)\":\"scale(1)\";},\"aria-label\":isPlaying?\"Pause\":\"Play\",children:isPlaying?// Pause icon\n/*#__PURE__*/_jsx(\"svg\",{width:buttonSize*.4,height:buttonSize*.4,viewBox:\"0 0 24 24\",fill:\"currentColor\",children:/*#__PURE__*/_jsx(\"path\",{d:\"M6 4h4v16H6V4zm8 0h4v16h-4V4z\"})}):// Play icon\n/*#__PURE__*/_jsx(\"svg\",{width:buttonSize*.4,height:buttonSize*.4,viewBox:\"0 0 24 24\",fill:\"currentColor\",style:{marginLeft:2},children:/*#__PURE__*/_jsx(\"path\",{d:\"M8 5v14l11-7z\"})})})]});}addPropertyControls(PlayPauseButton,{gifUrl:{type:ControlType.File,title:\"GIF File\",allowedFileTypes:[\"gif\",\"webp\"]},autoPlay:{type:ControlType.Boolean,title:\"Auto Play\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},showControls:{type:ControlType.Boolean,title:\"Show Controls\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},controlsPosition:{type:ControlType.Enum,title:\"Controls Position\",options:[\"top-left\",\"top-right\",\"bottom-left\",\"bottom-right\",\"center\"],optionTitles:[\"Top Left\",\"Top Right\",\"Bottom Left\",\"Bottom Right\",\"Center\"],defaultValue:\"center\",hidden:({showControls})=>!showControls},buttonSize:{type:ControlType.Number,title:\"Button Size\",defaultValue:60,min:30,max:100,step:5,unit:\"px\",hidden:({showControls})=>!showControls},buttonColor:{type:ControlType.Color,title:\"Button Color\",defaultValue:\"#FFFFFF\",hidden:({showControls})=>!showControls},buttonBackground:{type:ControlType.Color,title:\"Button Background\",defaultValue:\"rgba(0, 0, 0, 0.5)\",hidden:({showControls})=>!showControls},borderRadius:{type:ControlType.Number,title:\"Border Radius\",defaultValue:8,min:0,max:64,step:1,unit:\"px\"},shadow:{type:ControlType.Boolean,title:\"Shadow\",defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"PlayPauseButton\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerSupportedLayoutHeight\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./PlayPauseButton.map"],"mappings":"oNAMG,SAAwB,EAAgB,EAAM,CAAC,GAAK,CAAC,SAAO,sEAAsE,WAAS,GAAK,eAAa,GAAK,mBAAiB,SAAS,aAAW,GAAG,cAAY,UAAU,mBAAiB,qBAAqB,eAAa,EAAE,SAAO,IAAO,EAAW,CAAC,EAAU,GAAcA,EAAS,EAAS,CAAM,CAAC,EAAY,GAAg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