import { useUiTranslation as e } from "../../../../i18n/useUiTranslation.js";
import { HighlightCode as t } from "../../highlight/HighlightCode.js";
import { MarkdownMermaidBlock as n } from "./MarkdownMermaidBlock.js";
import { Suspense as r, lazy as i, useDeferredValue as a, useMemo as o } from "react";
import { jsx as s } from "react/jsx-runtime";
//#region src/atomic/molecules/markdown/components/MarkdownCodeBlock.tsx
var c = i(async () => ({ default: (await import("./MarkdownShikiCodeBlock.js")).MarkdownShikiCodeBlock })), l = ({ code: i, language: l, badgeLabel: u }) => {
	let { t: d } = e(), f = a(o(() => i.replace(/\s+$/, ""), [i])), p = "plaintext";
	if (l != null) {
		let e = l.trim().toLowerCase();
		e !== "" && (p = e);
	}
	let m = p === "mermaid", h = p;
	m && (h = "plaintext");
	let g = "CODE", _ = u?.trim();
	if (_ != null && _ !== "") g = _;
	else if (l != null) {
		let e = l.trim();
		e !== "" && (g = e.toUpperCase());
	}
	return m ? /* @__PURE__ */ s(n, { code: f }) : /* @__PURE__ */ s(r, {
		fallback: /* @__PURE__ */ s(t, {
			badgeLabel: g,
			copyCode: f,
			fallbackCodeText: f,
			placeholderText: d("markdown.code.loadingHighlight")
		}),
		children: /* @__PURE__ */ s(c, {
			badgeLabel: g,
			code: f,
			language: h
		})
	});
};
//#endregion
export { l as MarkdownCodeBlock };

//# sourceMappingURL=MarkdownCodeBlock.js.map