Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const require_chunk = require("../../chunk-CKQMccvm.cjs");
const require_components_IconButton_index = require("../IconButton/index.cjs");
let clsx = require("clsx");
clsx = require_chunk.__toESM(clsx);
let lucide_react = require("lucide-react");
let react = require("react");
let react_jsx_runtime = require("react/jsx-runtime");
let react_syntax_highlighter_dist_cjs_styles_prism = require("react-syntax-highlighter/dist/cjs/styles/prism");
let react_syntax_highlighter = require("react-syntax-highlighter");
//#region src/components/CodeBlock/CodeBlock.tsx
const CodeBlock = ({ language, codeString, theme }) => {
	const [copied, setCopied] = (0, react.useState)(false);
	const handleCopy = () => {
		navigator.clipboard.writeText(codeString);
		setCopied(true);
		setTimeout(() => setCopied(false), 1e3);
	};
	return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
		className: "openui-code-block-wrapper",
		children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_IconButton_index.IconButton, {
			onClick: handleCopy,
			variant: "secondary",
			size: "small",
			className: (0, clsx.default)("openui-code-block-copy-button", { "openui-code-block-copy-button-copied": copied }),
			icon: copied ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.CheckCheck, {}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Copy, {})
		}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_syntax_highlighter.Prism, {
			style: theme ?? react_syntax_highlighter_dist_cjs_styles_prism.vscDarkPlus,
			language,
			PreTag: "div",
			className: "openui-code-block-syntax-highlighter",
			children: codeString
		})]
	});
};
//#endregion
exports.CodeBlock = CodeBlock;

//# sourceMappingURL=index.cjs.map