import{c as e,j as t}from"./index-DItyo5Xo.js";import{b as o,c as n}from"./recharts-bmHCCfxU.js";const s=e("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),a=e("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]),r=e("map-pin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);function c({hash:e,prefixLength:r=8,suffixLength:c=6,full:i=!1,className:l,size:p="md"}){const[d,u]=o.useState(!1),[x,h]=o.useState(!1),y=o.useRef(null),m=o.useCallback(t=>{t.preventDefault(),t.stopPropagation(),y.current&&clearTimeout(y.current),function(e){if("undefined"!=typeof window&&(window.isSecureContext||"https:"===window.location.protocol||"localhost"===window.location.hostname)&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText)return navigator.clipboard.writeText(e).catch(()=>{}),!0;try{const t=window.scrollX,o=window.scrollY,n=document.createElement("textarea");n.value=e,n.style.position="fixed",n.style.left="-9999px",n.style.top="-9999px",n.style.opacity="0",n.style.pointerEvents="none",n.setAttribute("readonly",""),document.body.appendChild(n),n.focus({preventScroll:!0}),n.select(),n.setSelectionRange(0,e.length);const s=document.execCommand("copy");return document.body.removeChild(n),window.scrollTo(t,o),s}catch(t){return!1}}(e),u(!0),y.current=setTimeout(()=>u(!1),2e3)},[e]),w=i||e.length<=r+c+3?e:`${e.slice(0,r)}…${e.slice(-c)}`,f={xs:"text-[9px] px-1 py-0.5 gap-0.5",sm:"text-[10px] px-1.5 py-0.5 gap-1",md:"text-xs px-2 py-1 gap-1.5"}[p];return t.jsxs("button",{type:"button",onClick:m,onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),className:n("inline-flex items-center font-mono rounded-md transition-all duration-200","bg-bg-subtle/80 hover:bg-bg-elevated border border-border-subtle hover:border-border-strong","cursor-pointer select-none",f,l),title:`Click to copy: ${e}`,"aria-label":`Copy hash ${e}`,children:[t.jsx("span",{className:n("transition-colors duration-200",d?"text-accent-success":"text-text-secondary"),children:w}),t.jsx("span",{className:n("flex items-center justify-center transition-all duration-200","xs"===p?"w-2.5 h-2.5":"sm"===p?"w-3 h-3":"w-3.5 h-3.5"),children:d?t.jsx(s,{className:n("text-accent-success","xs"===p?"w-2 h-2":"sm"===p?"w-2.5 h-2.5":"w-3 h-3")}):t.jsx(a,{className:n("transition-opacity duration-200",x?"opacity-70":"opacity-40","xs"===p?"w-2 h-2":"sm"===p?"w-2.5 h-2.5":"w-3 h-3")})})]})}export{a as C,c as H,r as M,s as a};
