import { useState as a, useCallback as i } from "react";
const p = (e = 2e3) => {
  const [t, r] = a(null), l = i(
    (o, c) => {
      try {
        navigator.clipboard.writeText(o).then(() => {
          r(c), setTimeout(() => r(null), e);
        }).catch(() => {
          console.error("Failed to copy text to clipboard");
        });
      } catch {
        console.error("Failed to copy text to clipboard");
      }
    },
    [e]
  );
  return {
    copiedField: t,
    copyToClipboard: l,
    isCopied: (o) => t === o
  };
};
export {
  p as default
};
//# sourceMappingURL=useClipboard.js.map
