import{r as i,F as E,j as e,c as s,D as S,E as T}from"./index-BOwCLZTK.js";const k={standard:"w-3 h-3",compact:"w-2.5 h-2.5",responsive:"w-2.5 h-2.5 sm:w-3 sm:h-3"};function $({children:a,copyValue:g,copy:n=!1,size:r="standard",className:u,title:f,color:x,truncate:l}){const[d,m]=i.useState(!1),[w,y]=i.useState(!1),p=i.useRef(null),o=g??(typeof a=="string"?a:""),C=k[r],h=(()=>{if(!l||typeof a!="string")return a;const t=a,[c,j]=l===!0?[6,4]:l;return t.length<=c+j+3?t:`${t.slice(0,c)}…${t.slice(-j)}`})(),N=i.useCallback(async t=>{if(!n)return;t.preventDefault(),t.stopPropagation(),p.current&&clearTimeout(p.current);const c=await E(o);m(!0),p.current=setTimeout(()=>m(!1),2e3),c||console.warn("Copy may have failed for:",o.slice(0,16)+"...")},[n,o]),v=r==="compact"?"data-box-compact":r==="responsive"?"data-box-responsive":"",b=n?f||`Click to copy: ${o}`:f;return n?e.jsxs("button",{type:"button",onClick:N,onMouseEnter:()=>y(!0),onMouseLeave:()=>y(!1),className:s("data-box interactive",v,"cursor-pointer select-none gap-1","hover-bg",x,u),title:b,"aria-label":`Copy ${o}`,children:[e.jsx("span",{className:s("transition-colors duration-200",d?"text-sys-green":""),children:h}),e.jsx("span",{className:s("flex items-center justify-center",r==="compact"?"w-3 h-3":"w-3.5 h-3.5"),children:d?e.jsx(S,{className:s("text-sys-green",C)}):e.jsx(T,{className:s("transition-opacity duration-200",w?"opacity-70":"opacity-40",C)})})]}):e.jsx("span",{className:s("data-box",v,x,u),title:b,children:h})}export{$ as D};
