import{slicedToArray as o}from"../../_virtual/_rollupPluginBabelHelpers.esm.js";import{useState as e}from"react";import t from"@mui/icons-material/ContentCopy";import r from"@mui/icons-material/Done";import n from"../../_virtual/index.esm.js";import{jsx as i}from"react/jsx-runtime";function c(n){var c=n.textToCopy,a=e(!1),m=o(a,2),l=m[0],s=m[1];return i("div",{onClick:function(){if(navigator.clipboard&&navigator.clipboard.writeText)navigator.clipboard.writeText(c).then(function(){s(!0),setTimeout(function(){return s(!1)},2e3)}).catch(function(o){console.error("Failed to copy text: ",o)});else{var o=document.createElement("textarea");o.value=c,document.body.appendChild(o),o.select();try{document.execCommand("copy")?(s(!0),setTimeout(function(){return s(!1)},2e3)):console.error("Copy command was unsuccessful")}catch(o){console.error("Unable to copy",o)}document.body.removeChild(o)}},style:{cursor:"pointer"},children:l?i(r,{color:"success"}):i(t,{})})}c.propTypes={textToCopy:n.string};export{c as CopyIcon,c as default};
//# sourceMappingURL=CopyIcon.esm.js.map
