"use strict";const r=require("react/jsx-runtime"),l=require("react"),q=require("@mui/icons-material/ContentCopy"),I=require("@mui/icons-material/Check"),b=require("@mui/material/IconButton"),M=require("@mui/material/CircularProgress"),a=require("./types.cjs"),d=l.forwardRef(function({children:t,color:s="neutral",emphasis:e,size:o="sm",shape:c="rounded",loading:n=!1,disabled:x,onClick:y,title:f,sx:u,...h},B){const S=a.toMuiColor(s),j=a.toMuiSize(o),p={xs:24,sm:32,md:40,lg:48,xl:56},C={xs:14,sm:18,md:22,lg:26,xl:30};return r.jsx(b,{ref:B,color:S,size:j,disabled:x||n,onClick:y,title:f,sx:{borderRadius:a.toBorderRadius(c),width:p[o],height:p[o],fontSize:C[o],...typeof u=="object"&&!Array.isArray(u)?u:{}},...h,children:n?r.jsx(M,{size:C[o]-4,color:"inherit"}):t})});d.displayName="IconButton";function m({value:i,size:t="sm",label:s}){const[e,o]=l.useState(!1),c=l.useCallback(()=>{navigator.clipboard.writeText(i).then(()=>{o(!0),setTimeout(()=>o(!1),1500)})},[i]),n=t==="xs"?12:t==="sm"?14:t==="md"?16:18;return r.jsx(d,{size:t,color:e?"success":"neutral",onClick:c,"aria-label":s??(e?"Copied":"Copy to clipboard"),title:s??(e?"Copied!":"Copy"),children:e?r.jsx(I,{sx:{fontSize:n}}):r.jsx(q,{sx:{fontSize:n}})})}m.displayName="CopyButton";exports.CopyButton=m;exports.IconButton=d;
