import { cn as e } from "../../../lib/utils.js";
import { t } from "../../../button-BNOmhdpM.js";
import { useCallback as n, useState as r } from "react";
import { jsx as i, jsxs as a } from "react/jsx-runtime";
import { Check as o, Copy as s } from "lucide-react";
//#region lib/components/ui/atoms/copy-button.tsx
var c = 2e3;
function l({ content: l, onCopy: u, className: d, variant: f = "ghost", size: p = "icon", children: m, ...h }) {
	let [g, _] = r(!1), v = n(async () => {
		await navigator.clipboard.writeText(l), _(!0), setTimeout(() => _(!1), c), u?.();
	}, [l, u]);
	return /* @__PURE__ */ i(t, {
		"aria-label": g ? "Copied" : "Copy to clipboard",
		className: e("size-8", g && "text-green-500", d),
		disabled: g,
		onClick: v,
		size: p,
		type: "button",
		variant: f,
		...h,
		children: m ?? /* @__PURE__ */ a("span", {
			className: "relative flex size-4 items-center justify-center",
			children: [/* @__PURE__ */ i(s, { className: e("absolute size-4 transition-all duration-200", g ? "scale-0 opacity-0" : "scale-100 opacity-100") }), /* @__PURE__ */ i(o, { className: e("absolute size-4 transition-all duration-200", g ? "scale-100 opacity-100" : "scale-0 opacity-0") })]
		})
	});
}
//#endregion
export { l as CopyButton };
