// @bun
var{defineProperty:E,getOwnPropertyNames:I,getOwnPropertyDescriptor:J}=Object,K=Object.prototype.hasOwnProperty;function L(g){return this[g]}var R=(g)=>{var j=(G??=new WeakMap).get(g),v;if(j)return j;if(j=E({},"__esModule",{value:!0}),g&&typeof g==="object"||typeof g==="function"){for(var w of I(g))if(!K.call(j,w))E(j,w,{get:L.bind(g,w),enumerable:!(v=J(g,w))||v.enumerable})}return G.set(g,j),j},G;var M=(g)=>g;function N(g,j){this[g]=M.bind(null,j)}var U=(g,j)=>{for(var v in j)E(g,v,{get:j[v],enumerable:!0,configurable:!0,set:N.bind(j,v)})};var V=(g,j)=>()=>(g&&(j=g(g=0)),j);var W=import.meta.require;function O(g={}){let{timeout:j=1500}=g,v=new Set,w="",B=!1,A=null,D=typeof navigator<"u"&&"clipboard"in navigator,F=(q)=>{for(let z of v)try{z(q)}catch(H){console.error("[useClipboard] Subscriber error:",H)}};return{get text(){return w},get isSupported(){return D},get copied(){return B},copy:async(q)=>{if(!D)try{let z=document.createElement("textarea");if(z.value=q,z.style.position="fixed",z.style.opacity="0",document.body.appendChild(z),z.select(),document.execCommand("copy"),document.body.removeChild(z),w=q,B=!0,F(q),A)clearTimeout(A);return A=setTimeout(()=>{B=!1},j),!0}catch{return!1}try{if(await navigator.clipboard.writeText(q),w=q,B=!0,F(q),A)clearTimeout(A);return A=setTimeout(()=>{B=!1},j),!0}catch{return!1}},read:async()=>{if(!D)return"";try{let q=await navigator.clipboard.readText();return w=q,q}catch{return""}},subscribe:(q)=>{return v.add(q),()=>v.delete(q)}}}async function Y(g){return O().copy(g)}export{O as useClipboard,Y as copyToClipboard};
