import{r as a,j as e}from"./@radix-DP6vWzyx.js";import{T as d,v as u,w as m,x}from"./index-QQb7wQEC.js";import{S as f}from"./copy-CaSMXwiU.js";function v({copyText:s,isVisible:o,copyTitle:n}){const r=a.useRef(null),[p,i]=a.useState(!1),l=o?n:"Copy to Clipboard",c=()=>{navigator.clipboard&&(navigator.clipboard.writeText(s),i(!0),setTimeout(()=>{i(!1)},2e3))};return e.jsx(d,{children:e.jsxs(u,{delayDuration:200,children:[e.jsxs(m,{className:`${o?"":"invisible  opacity-0 group-hover/copybutton:opacity-100"}  h-4 w-4 rounded-sm  p-0.25 transition-all
					duration-200 hover:bg-theme-surface-primary active:bg-neutral-300 group-hover/copybutton:visible `,onClick:t=>{t.preventDefault(),c()},ref:r,children:[e.jsx("span",{className:"sr-only",children:"Copy to Clipboard"}),e.jsx(f,{className:`${o?"h-5 w-5":"h-3 w-3"} pointer-events-none  fill-theme-text-tertiary`})]}),e.jsx(x,{onPointerDownOutside:t=>{t.currentTarget===r.current&&t.preventDefault()},className:"z-50 rounded-md bg-theme-text-primary px-3 py-2 text-text-xs text-theme-text-negative shadow-lg",sideOffset:5,children:p?"Copied!":l})]})})}export{v as C};
