"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const index$1 = require("../_vendor/@codemirror/language/dist-index.cjs");
const index$2 = require("../_vendor/@lezer/highlight/dist-index.cjs");
const index = require("../_vendor/@codemirror/view/dist-index.cjs");
const createSyntaxHighlighting = () => {
  return index$1.syntaxHighlighting(
    index$1.HighlightStyle.define([
      // 🔑 关键字和控制流
      { tag: index$2.tags.keyword, color: "var(--code-syntax-keyword)" },
      // 📝 字面量
      { tag: [index$2.tags.string, index$2.tags.special(index$2.tags.string)], color: "var(--code-syntax-string)" },
      { tag: [index$2.tags.number], color: "var(--code-syntax-number)" },
      { tag: [index$2.tags.bool], color: "var(--code-syntax-boolean)" },
      // 🔧 函数和方法
      {
        tag: [index$2.tags.function(index$2.tags.variableName), index$2.tags.function(index$2.tags.propertyName)],
        color: "var(--code-syntax-function)"
      },
      // 🏷️ 变量和属性
      {
        tag: [index$2.tags.variableName, index$2.tags.definition(index$2.tags.variableName)],
        color: "var(--code-syntax-variable)"
      },
      {
        tag: [index$2.tags.propertyName, index$2.tags.definition(index$2.tags.propertyName)],
        color: "var(--code-syntax-property)"
      },
      // ⚡ 操作符
      { tag: [index$2.tags.operator, index$2.tags.operatorKeyword], color: "var(--code-syntax-operator)" },
      // 💬 注释
      {
        tag: [index$2.tags.comment, index$2.tags.lineComment, index$2.tags.blockComment],
        color: "var(--code-syntax-comment)"
      },
      // 🎯 JSX 标签 - 映射到属性颜色（包括自定义组件）
      { tag: [index$2.tags.tagName], color: "var(--code-syntax-property)" },
      // HTML 标签 <div>
      { tag: [index$2.tags.className, index$2.tags.typeName], color: "var(--code-syntax-property)" },
      // 自定义组件 <MyComponent>
      { tag: [index$2.tags.name], color: "var(--code-syntax-property)" },
      // 通用名称
      // 🎯 特殊标记
      { tag: [index$2.tags.atom, index$2.tags.null], color: "var(--code-syntax-boolean)" },
      // 🔗 链接和引用
      { tag: [index$2.tags.url, index$2.tags.link], color: "var(--code-syntax-string)" },
      // ❌ 错误和无效
      { tag: index$2.tags.invalid, color: "var(--foreground-danger)" },
      // 📊 格式化
      { tag: index$2.tags.strong, fontWeight: "bold" },
      { tag: index$2.tags.emphasis, fontStyle: "italic" },
      { tag: index$2.tags.strikethrough, textDecoration: "line-through" },
      { tag: index$2.tags.heading, fontWeight: "bold", color: "var(--code-syntax-keyword)" }
    ])
  );
};
const codeEditorTheme = ({ isReadOnly, minHeight, maxHeight, rows }) => {
  const computedMinHeight = rows && rows !== -1 ? `${Number(rows + 1) * 1.3}em` : minHeight ?? "200px";
  const computedMaxHeight = maxHeight ?? "100%";
  const customTheme = index.EditorView.theme({
    "&": {
      "--editor-max-height": computedMaxHeight,
      "--editor-min-height": computedMinHeight,
      "--editor-is-readonly": isReadOnly ? "true" : "false",
      "--editor-rows": (rows == null ? void 0 : rows.toString()) ?? "auto"
    }
  });
  return [customTheme, createSyntaxHighlighting()];
};
exports.codeEditorTheme = codeEditorTheme;
//# sourceMappingURL=theme.cjs.map
