import { i as d } from "./monaco-importer.js";
import { t as p } from "./monaco-theme.js";
import { Uri as f, languages as a } from "monaco-editor";
import "monaco-editor/esm/vs/editor/standalone/browser/standaloneServices.js";
import "monaco-editor/esm/vs/editor/standalone/common/standaloneTheme.js";
import "monaco-editor/esm/vs/platform/hover/browser/hover.js";
import "monaco-editor/esm/vs/editor/common/languages/supports/tokenization.js";
import "monaco-editor/esm/vs/base/browser/dom.js";
import "monaco-editor/esm/vs/editor/browser/editorDom.js";
import "monaco-editor/esm/vs/editor/browser/controller/mouseTarget.js";
import { a as t } from "./sql-expr-defaults.js";
import { g as l } from "./sql-expr-service-accessors.js";
import { b as n } from "./arcade-defaults.js";
import { a as h } from "./arcade-service-accessors.js";
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
v5.0.0-next.125 */
const k = ["arcade", "arcgis-sql-expression"], i = /* @__PURE__ */ new Set(), g = /* @__PURE__ */ new Map();
function c(e) {
  let r = g.get(e);
  return r || (r = Promise.withResolvers(), g.set(e, r)), r;
}
function u(e) {
  c(e).resolve();
}
function _(e) {
  return k.includes(e) ? c(e).promise : Promise.resolve();
}
function m(e, r) {
  return () => {
    i.has(e) || i.add(e), r();
  };
}
async function $(e) {
  if (i.has(e))
    return;
  (await d()).createModel("", e, f.parse("")).dispose();
}
w();
function w() {
  d().then((e) => {
    ["light", "dark"].forEach((r) => {
      const s = r === "light" ? "vs" : "vs-dark", o = p[`${r}-theme`];
      e.defineTheme(s, {
        base: s,
        inherit: !0,
        rules: [
          { token: "comment.arcgis", foreground: o.comment },
          { token: "constant.arcgis", foreground: o.constant },
          { token: "keyword.arcgis", foreground: o.keyword },
          { token: "identifier.arcgis", foreground: o.identifier },
          { token: "number.arcgis", foreground: o.number },
          { token: "string.arcgis", foreground: o.string },
          { token: "operator.arcgis", foreground: o.operator },
          { token: "predefined.arcgis", foreground: o.predefined },
          { token: "date.arcgis", foreground: o.date }
        ],
        colors: {}
      });
    });
  });
}
a.register({
  id: t.languageId,
  aliases: ["EsiSqlExpression", "sql-expression"],
  extensions: [".sql-expression"],
  mimetypes: ["application/sql-expression"]
});
a.onLanguage(
  t.languageId,
  m(t.languageId, () => {
    l().then((e) => {
      e.setupMode(t), u(t.languageId);
    }).catch((e) => {
      throw e;
    });
  })
);
a.register({
  id: n.languageId,
  aliases: ["Arcade", "arcade"],
  extensions: [".arc"],
  mimetypes: ["application/arcade"]
});
a.onLanguage(
  n.languageId,
  m(n.languageId, () => {
    h().then((e) => {
      e.setupMode(n), u(n.languageId);
    }).catch((e) => {
      throw e;
    });
  })
);
export {
  $ as s,
  _ as w
};
