import { e as p, j as i } from "./index-CAib4NKw.js";
import { lazy as h, useState as g, Suspense as w } from "react";
import { useTheme as f } from "@mui/material";
import { L as k } from "./LoadingCover-Dr9hDTku.js";
const b = {
  $schema: "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
  name: "wandelscript",
  patterns: [
    {
      include: "#keywords"
    },
    {
      include: "#strings"
    },
    {
      include: "#comments"
    },
    {
      include: "#functions"
    }
  ],
  repository: {
    keywords: {
      patterns: [
        {
          name: "keyword.control.flow.wandelscript",
          match: "\\b(move|via|to|interrupt|def|False|True|for|if|else|elif|while|return|switch|activate|deactivate|print|and|or|not)\\b"
        }
      ]
    },
    strings: {
      name: "string.quoted.double.wandelscript",
      begin: '"',
      end: '"',
      patterns: [
        {
          name: "constant.character.escape.wandelscript",
          match: "\\\\."
        }
      ]
    },
    comments: {
      patterns: [
        {
          begin: "#",
          beginCaptures: {
            0: { name: "punctuation.definition.comment.wandelscript" }
          },
          end: "$",
          name: "comment.line.number-sign.wandelscript"
        }
      ]
    },
    functions: {
      patterns: [
        {
          match: "[a-zA-Z_-]+\\(",
          name: "entity.name.function.wandelscript"
        }
      ]
    }
  },
  scopeName: "source.wandelscript"
}, v = h(() => import("@monaco-editor/react"));
let s = null;
async function T() {
  if (!s) {
    const [{ createHighlighter: e }, { shikiToMonaco: n }] = await Promise.all([
      import("shiki"),
      import("@shikijs/monaco")
    ]);
    s = {
      shiki: await e({
        // Our textmate grammar doesn't quite conform to the expected type
        // here; I'm not sure what the missing properties mean exactly
        langs: [b],
        themes: ["dark-plus", "light-plus"]
      }),
      shikiToMonaco: n
    };
  }
  return s;
}
const j = p(
  (e) => {
    const n = f(), [o, l] = g("dark-plus"), r = n.palette.mode === "dark" ? "dark-plus" : "light-plus";
    async function u(t) {
      var c, m;
      t.languages.register({ id: "wandelscript" }), t.languages.setLanguageConfiguration("wandelscript", {
        comments: {
          lineComment: "#"
        },
        brackets: [
          ["(", ")"],
          ["[", "]"]
        ],
        autoClosingPairs: [
          { open: "[", close: "]" },
          { open: "(", close: ")" }
        ],
        surroundingPairs: [
          { open: "[", close: "]" },
          { open: "(", close: ")" }
        ]
      });
      const { shiki: a, shikiToMonaco: d } = await T();
      d(a, t), t.editor.defineTheme(
        r,
        ((m = (c = n.componentsExt) == null ? void 0 : c.WandelscriptEditor) == null ? void 0 : m.monacoTheme) ?? {
          base: n.palette.mode === "dark" ? "vs-dark" : "vs",
          inherit: !0,
          rules: [],
          colors: {}
        }
      ), e.monacoSetup && e.monacoSetup(t), l(r);
    }
    return /* @__PURE__ */ i.jsx(w, { fallback: /* @__PURE__ */ i.jsx(k, {}), children: /* @__PURE__ */ i.jsx(
      v,
      {
        value: e.code,
        onMount: (t, a) => {
          u(a);
        },
        onChange: e.onChange,
        defaultLanguage: "wandelscript",
        theme: o,
        options: {
          minimap: { enabled: !1 },
          wordWrap: "on",
          automaticLayout: !0,
          ...e.monacoOptions
        }
      }
    ) });
  }
);
export {
  j as W
};
//# sourceMappingURL=WandelscriptEditor-DnJvITTA.js.map
