import { s as __toESM } from "./chunk-BNovOVIE.js";
import { _ as Logger } from "./button-Dj4BTre0.js";
import { t as require_react } from "./react-DA-nE2FX.js";
import "./compiler-runtime-CEbnTgxf.js";
import "./react-dom-BWRJ_g_k.js";
import { t as require_jsx_runtime } from "./jsx-runtime-COBk7ree.js";
import "./zod-BWkcDORu.js";
import { n as ErrorBanner } from "./error-banner-CVkfBUT3.js";
import { f as CopyClipboardIcon } from "./extends-vAi97cpa.js";
import "./dist-CCADb07R.js";
import "./dist-Yrfc6L0I.js";
import "./dist-UcOPnRMa.js";
import "./dist-BTyJtnNg.js";
import "./dist-DGAfI2rB.js";
import "./dist-nuW5EDYT.js";
import { t as esm_default } from "./esm-CWp0KQeK.js";
import "./dist-C34oIrQ9.js";
import "./dist-B507mf_I.js";
import "./dist-BvCfQQQE.js";
import "./dist-B4LJpMEg.js";
import "./dist-DJ6zJQZ4.js";
import "./dist-WdPUFc56.js";
import "./dist-t_qL7eB8.js";
import "./dist-CDFZi-QD.js";
import "./dist-Bc5pmZIw.js";
import { n as loadLanguage, t as langs } from "./esm-DjNnlmpf.js";
var import_react = /* @__PURE__ */ __toESM(require_react(), 1), import_jsx_runtime = /* @__PURE__ */ __toESM(require_jsx_runtime(), 1);
const LANGUAGE_MAP = {
  python: "py",
  python3: "py",
  javascript: "js",
  typescript: "ts",
  shell: "sh",
  bash: "sh",
  unknown: "text",
  undefined: "text"
};
function isSupportedLanguage(e) {
  return e ? e in langs : false;
}
var any_language_editor_default = ({ language: e, hideUnsupportedLanguageErrors: d, showCopyButton: f, extensions: p = [], ...m }) => {
  e = LANGUAGE_MAP[e || ""] || e;
  let h = isSupportedLanguage(e);
  h || Logger.warn(`Language ${e} not found in CodeMirror.`);
  let g = (0, import_react.useMemo)(() => isSupportedLanguage(e) ? [loadLanguage(e), ...p].filter(Boolean) : p, [e, p]);
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
    className: "relative w-full group hover-actions-parent",
    children: [
      !h && !d && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorBanner, {
        className: "mb-1 rounded-sm",
        error: `Language ${e} not supported. Supported languages are: ${Object.keys(langs).join(", ")}`
      }),
      f && h && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CopyClipboardIcon, {
        tooltip: false,
        buttonClassName: "absolute top-2 right-2 z-10 hover-action",
        className: "h-4 w-4 text-muted-foreground",
        value: m.value || "",
        toastTitle: "Copied to clipboard"
      }),
      /* @__PURE__ */ (0, import_jsx_runtime.jsx)(esm_default, {
        ...m,
        extensions: g
      })
    ]
  });
};
export {
  LANGUAGE_MAP,
  any_language_editor_default as default
};
