{"version":3,"file":"CopyPromptButton.Cu_OcSJ7.mjs","names":["React.useState","React.useRef","React.useMemo","React.useCallback"],"sources":["https:/framerusercontent.com/modules/6Ckli6QXvEr7fFL3k7d6/G4WYI0OAltKMqeYny7cC/CopyPromptButton.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";import{AnimatePresence,motion}from\"framer-motion\";async function copyWithFallback(text){if(typeof window===\"undefined\")return false;try{if(typeof navigator!==\"undefined\"&&navigator.clipboard&&typeof navigator.clipboard.writeText===\"function\"){await navigator.clipboard.writeText(text);return true;}}catch(error){// continue to fallback\n}try{if(typeof document===\"undefined\")return false;const textarea=document.createElement(\"textarea\");textarea.value=text;textarea.setAttribute(\"readonly\",\"\");textarea.style.position=\"fixed\";textarea.style.top=\"-9999px\";textarea.style.left=\"-9999px\";textarea.style.opacity=\"0\";document.body.appendChild(textarea);textarea.focus();textarea.select();textarea.setSelectionRange(0,textarea.value.length);const copied=document.execCommand(\"copy\");document.body.removeChild(textarea);return copied;}catch(error){return false;}}/**\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function CopyPromptButton(props){const{prompt,label,backgroundColor,textColor,hoverBackgroundColor,hoverBorderColor,border,borderRadius,horizontalPadding,verticalPadding,font,iconImage={src:\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",alt:\"Gradient 1 - Blue\"},iconAlt,iconSize,gap,tooltipText,tooltipBackgroundColor,tooltipTextColor,tooltipDuration,style}=props;const[showTooltip,setShowTooltip]=React.useState(false);const hideTooltipTimeoutRef=React.useRef(null);const buttonStyle=React.useMemo(()=>{const borderStyleValue=border?.borderStyle??\"solid\";const borderColorValue=border?.borderColor??\"transparent\";const borderWidthValue=border?.borderWidth??0;const hasPerSideBorderWidths=border?.borderTopWidth!==undefined||border?.borderRightWidth!==undefined||border?.borderBottomWidth!==undefined||border?.borderLeftWidth!==undefined;const resolvedTopWidth=border?.borderTopWidth??borderWidthValue;const resolvedRightWidth=border?.borderRightWidth??borderWidthValue;const resolvedBottomWidth=border?.borderBottomWidth??borderWidthValue;const resolvedLeftWidth=border?.borderLeftWidth??borderWidthValue;const visualBorderWidth=hasPerSideBorderWidths?Math.max(resolvedTopWidth,resolvedRightWidth,resolvedBottomWidth,resolvedLeftWidth):borderWidthValue;const normalHairlineShadow=borderStyleValue===\"solid\"&&visualBorderWidth>0?`inset 0 0 0 ${visualBorderWidth}px ${borderColorValue}`:\"none\";return{position:\"relative\",display:\"inline-flex\",alignItems:\"center\",justifyContent:\"center\",width:\"auto\",minWidth:\"max-content\",minHeight:28,padding:`${verticalPadding}px ${horizontalPadding}px`,boxSizing:\"border-box\",borderRadius,border:0,boxShadow:normalHairlineShadow,backgroundColor,color:textColor,cursor:\"pointer\",outline:\"none\",whiteSpace:\"nowrap\",userSelect:\"none\",WebkitTapHighlightColor:\"transparent\",fontFamily:font?.fontFamily,fontSize:font?.fontSize,fontWeight:font?.fontWeight,lineHeight:font?.lineHeight,letterSpacing:font?.letterSpacing,textAlign:font?.textAlign,fontStyle:font?.fontStyle,...style};},[backgroundColor,border,borderRadius,font,horizontalPadding,style,textColor,verticalPadding]);const handleClick=React.useCallback(async()=>{const wasCopied=await copyWithFallback(prompt||\"\");if(wasCopied){if(typeof window!==\"undefined\"&&hideTooltipTimeoutRef.current!==null){window.clearTimeout(hideTooltipTimeoutRef.current);}React.startTransition(()=>setShowTooltip(true));if(typeof window!==\"undefined\"){hideTooltipTimeoutRef.current=window.setTimeout(()=>{React.startTransition(()=>setShowTooltip(false));},tooltipDuration);}}},[prompt,tooltipDuration]);React.useEffect(()=>{return()=>{if(typeof window!==\"undefined\"&&hideTooltipTimeoutRef.current!==null){window.clearTimeout(hideTooltipTimeoutRef.current);}};},[]);const iconSrc=iconImage?.src;const resolvedIconAlt=iconAlt||iconImage?.alt||\"\";return /*#__PURE__*/_jsxs(\"div\",{style:{position:\"relative\",display:\"inline-flex\"},children:[/*#__PURE__*/_jsxs(motion.button,{type:\"button\",role:\"button\",\"aria-label\":label,onClick:handleClick,whileHover:{backgroundColor:hoverBackgroundColor,boxShadow:`inset 0 0 0 1px ${hoverBorderColor}`,y:-.5},whileTap:{scale:.98,y:0},transition:{duration:.15,ease:\"easeOut\"},style:buttonStyle,children:[iconSrc?/*#__PURE__*/_jsx(\"img\",{src:iconSrc,srcSet:iconImage?.srcSet,alt:resolvedIconAlt,style:{width:iconSize,height:iconSize,minWidth:iconSize,minHeight:iconSize,objectFit:\"contain\",display:\"block\",marginRight:gap}}):null,/*#__PURE__*/_jsx(\"span\",{style:{minWidth:\"max-content\"},children:label})]}),/*#__PURE__*/_jsx(AnimatePresence,{children:showTooltip?/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",left:\"50%\",bottom:\"calc(100% + 8px)\",transform:\"translateX(-50%)\",pointerEvents:\"none\",zIndex:10},children:/*#__PURE__*/_jsx(motion.div,{role:\"status\",\"aria-live\":\"polite\",initial:{opacity:0,y:6,scale:.98},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:4,scale:.98},transition:{duration:.2,ease:\"easeOut\"},style:{backgroundColor:tooltipBackgroundColor,color:tooltipTextColor,borderRadius:\"999px\",padding:\"4px 8px\",fontSize:12,lineHeight:1,whiteSpace:\"nowrap\",boxShadow:\"0 4px 14px rgba(0, 0, 0, 0.18)\"},children:tooltipText||\"Prompt copied\"})}):null})]});}addPropertyControls(CopyPromptButton,{prompt:{type:ControlType.String,title:\"Prompt\",defaultValue:\"Write a concise summary of this page in bullet points.\",displayTextArea:true,placeholder:\"Paste your long AI prompt here…\"},label:{type:ControlType.String,title:\"Label\",defaultValue:\"Copy AI prompt\"},iconImage:{type:ControlType.ResponsiveImage,title:\"Icon\"},iconAlt:{type:ControlType.String,title:\"Icon Alt\",defaultValue:\"\",placeholder:\"Decorative icon\"},iconSize:{type:ControlType.Number,title:\"Icon Size\",defaultValue:16,min:10,max:24,step:1,unit:\"px\"},gap:{type:ControlType.Number,title:\"Gap\",defaultValue:6,min:0,max:16,step:1,unit:\"px\"},tooltipText:{type:ControlType.String,title:\"Tip Label\",defaultValue:\"Prompt copied\",placeholder:\"Prompt copied\"},tooltipBackgroundColor:{type:ControlType.Color,title:\"Tip BG\",defaultValue:\"#000000\"},tooltipTextColor:{type:ControlType.Color,title:\"Tip Text\",defaultValue:\"#FFFFFF\"},tooltipDuration:{type:ControlType.Number,title:\"Tip Time\",defaultValue:1500,min:500,max:4e3,step:100,unit:\"ms\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#000000\"},textColor:{type:ControlType.Color,title:\"Text\",defaultValue:\"#FFFFFF\"},hoverBackgroundColor:{type:ControlType.Color,title:\"Hover BG\",defaultValue:\"#1A1A1A\"},hoverBorderColor:{type:ControlType.Color,title:\"Hover Border\",defaultValue:\"#EEEEEE\"},border:{type:ControlType.Border,title:\"Border\",defaultValue:{borderWidth:0,borderStyle:\"solid\",borderColor:\"#EEEEEE\"}},borderRadius:{type:ControlType.BorderRadius,title:\"Radius\",defaultValue:\"999px\"},horizontalPadding:{type:ControlType.Number,title:\"Pad X\",defaultValue:12,min:6,max:32,step:1,unit:\"px\"},verticalPadding:{type:ControlType.Number,title:\"Pad Y\",defaultValue:6,min:2,max:16,step:1,unit:\"px\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:12,variant:\"Semibold\",letterSpacing:\"-0.01em\",lineHeight:\"1em\",textAlign:\"center\"}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CopyPromptButton\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CopyPromptButton.map"],"mappings":"6RAA2L,eAAe,EAAiB,EA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