import{aJ as a}from"./app-k0jcl5PQ.js";function d(){const[t,e]=a.useState(null),o=a.useCallback(async r=>{try{return await c(r),e(r),!0}catch(n){return console.warn("Copy failed",n),e(null),!1}},[]);return{copiedText:t,copyToClipboard:o}}function c(t){if(navigator.clipboard)return navigator.clipboard.writeText(t);const e=document.createElement("span");e.textContent=t,e.style.whiteSpace="pre",document.body.appendChild(e);const o=window.getSelection();if(!o)return Promise.reject();const r=window.document.createRange();o.removeAllRanges(),r.selectNode(e),o.addRange(r);try{window.document.execCommand("copy")}catch{return Promise.reject()}return o.removeAllRanges(),window.document.body.removeChild(e),Promise.resolve()}export{d as u};
//# sourceMappingURL=BZa85bFL.chunk.js.map
