import { jsx } from "react/jsx-runtime";
import { markdown, markdownLanguage } from "@codemirror/lang-markdown";
import { python } from "@codemirror/lang-python";
import { StreamLanguage } from "@codemirror/language";
import { yaml } from "@codemirror/legacy-modes/mode/yaml";
import ReactCodeMirror from "@uiw/react-codemirror";
import { useTheme } from "../Theme/UI.js";
import "../Theme/themeUtils.js";
import "../Theme/themes.js";
const langs = {
  markdown: () => markdown({ base: markdownLanguage }),
  python,
  yaml: () => StreamLanguage.define(yaml)
};
const CodeMirrorEditor = ({ syntax, ...props }) => {
  const {
    themeSettings: { themeIsDark }
  } = useTheme();
  return /* @__PURE__ */ jsx(
    ReactCodeMirror,
    {
      extensions: [langs[syntax]()],
      theme: themeIsDark ? "dark" : "light",
      ...props
    }
  );
};
export {
  CodeMirrorEditor as default
};
