"use client"
import{useCallback as c,useEffect as l,useRef as p,useState as u}from"react";var b=(e=3e3)=>{let r=p(null),[n,o]=u(!1),i=()=>{r.current&&(clearTimeout(r.current),r.current=null)},a=c(async t=>{i();try{typeof t=="string"?await navigator.clipboard.writeText(t):t instanceof ClipboardItem&&await navigator.clipboard.write([t]),o(!0),Number.isFinite(e)&&e>=0&&(r.current=setTimeout(()=>o(!1),e))}catch(s){console.error("Failed to copy: ",s)}},[e]);return l(()=>()=>i(),[]),[n,a]};export{b as a};
