import { jsxs as z, jsx as w } from "react/jsx-runtime";
import O, { useEffect as M, createContext as le, useState as $, useRef as oe, useContext as ae, memo as Se } from "react";
import { loader as ye, useMonaco as Ne, Editor as Re } from "@monaco-editor/react";
import { lspSubject as we, LspActions as E, hasAttributesString as ge, FileFolderType as ie, SourceCodeDescriptor as xe, HTTP_HANDLERS_TAB_PATH as ke } from "@ws-ui/shared";
import { MonacoLanguageClient as Le } from "monaco-languageclient";
import { mergeServices as We, initServices as Fe } from "monaco-languageclient/vscode/services";
import Ze, { initUserConfiguration as je } from "@codingame/monaco-vscode-configuration-service-override";
import Xe from "@codingame/monaco-vscode-languages-service-override";
import Ee from "@codingame/monaco-vscode-textmate-service-override";
import "@codingame/monaco-vscode-theme-defaults-default-extension";
import Ke from "@codingame/monaco-vscode-editor-service-override";
import Be from "@codingame/monaco-vscode-theme-service-override";
import * as l from "monaco-editor";
import { Selection as Te, KeyMod as G, KeyCode as J, editor as ce, Range as Oe, Uri as De, CancellationTokenSource as Ge } from "monaco-editor";
import { Logger as Je } from "monaco-languageclient/tools";
import { CloseAction as Me, ErrorAction as Pe } from "vscode-languageclient";
import { WebSocketMessageReader as Ve, WebSocketMessageWriter as Ye, toSocket as He } from "vscode-ws-jsonrpc";
import { TextDocumentSaveReason as ze, DocumentDiagnosticRequest as $e, WillSaveTextDocumentNotification as _e, DidSaveTextDocumentNotification as Ue, WillCreateFilesRequest as qe, WillRenameFilesRequest as Qe, WillDeleteFilesRequest as et, DidCreateFilesNotification as tt, DidRenameFilesNotification as nt, DidDeleteFilesNotification as it, SemanticTokensRegistrationType as ot } from "vscode-languageserver-protocol";
import { StandaloneServices as rt, ICodeEditorService as st } from "vscode/services";
import { KeybindingsRegistry as te } from "vscode/monaco";
import "@codingame/monaco-vscode-standalone-languages";
import "@codingame/monaco-vscode-standalone-html-language-features";
import "@codingame/monaco-vscode-standalone-css-language-features";
import "@codingame/monaco-vscode-standalone-json-language-features";
import "@codingame/monaco-vscode-standalone-typescript-language-features";
import "@codingame/monaco-vscode-css-default-extension";
import "@codingame/monaco-vscode-json-default-extension";
import "@codingame/monaco-vscode-html-default-extension";
import "@codingame/monaco-vscode-javascript-default-extension";
import { registerExtension as lt } from "vscode/extensions";
const at = () => Ze(), gt = () => Ke(
  () => Promise.resolve(void 0)
), ct = () => {
  const t = Be(), e = t.themeService.ctor.prototype;
  return e.defineTheme = () => {
  }, t;
}, ut = `{
  "workbench.colorTheme": "Default Dark+",
  "workbench.iconTheme": "vs-seti",
  "editor.autoClosingBrackets": "languageDefined",
  "editor.autoClosingQuotes": "languageDefined",
  "editor.scrollBeyondLastLine": true,
  "editor.mouseWheelZoom": true,
  "editor.wordBasedSuggestions": false,
  "editor.acceptSuggestionOnEnter": "on",
  "editor.foldingHighlight": false,
  "editor.bracketPairColorization.enabled": false,
  "editor.fontSize": 12,
  "files.autoSave": "off",
  "editor.experimental.asyncTokenization": true,
  "editor.semanticHighlighting.enabled": true,
  "workbench.colorCustomizations": {
    "editor.background": "#313131"
  },
  "editor.semanticTokenColorCustomizations": {
    "[Default Light+]": {
      "enabled": true,
      "rules": {
        "*:4d": {
          "foreground": "#000000",
          "bold": false,
          "italic": false,
          "underline": false,
          "strikethrough": false
        },
        "method:4d": { "foreground": "#000088", "bold": true, "italic": true },
        "method.defaultLibrary:4d": {
          "foreground": "#068c00",
          "italic": false
        },
        "method.plugin:4d": { "foreground": "#000000" },
        "property:4d": { "foreground": "#a0806b" },
        "function:4d": { "foreground": "#5f8e5e", "italic": true },
        "parameter:4d": { "foreground": "#000b76", "bold": true },
        "variable.interprocess:4d": { "foreground": "#ff0088" },
        "variable.process:4d": { "foreground": "#0000ff" },
        "variable.local:4d": { "foreground": "#0031ff" },
        "keyword:4d": { "foreground": "#034d00", "bold": true },
        "table:4d": { "foreground": "#532300" },
        "field:4d": { "foreground": "#323232" },
        "comment:4d": { "foreground": "#535353" },
        "type:4d": { "foreground": "#068c00", "bold": true },
        "constant:4d": { "foreground": "#4d004d", "underline": true },
        "string:4d": { "foreground": "#000000" },
        "error:4d": { "foreground": "#ff0000", "bold": true, "italic": true }
      }
    },
    "[Default Dark+]": {
      "enabled": true,
      "rules": {
        "*:4d": {
          "foreground": "#FFFFFF",
          "bold": false,
          "italic": false,
          "underline": false,
          "strikethrough": false
        },
        "method:4d": { "foreground": "#1B79F3", "bold": true, "italic": true },
        "method.defaultLibrary:4d": {
          "foreground": "#59BB00",
          "italic": false
        },
        "method.plugin:4d": { "foreground": "#BFBFBF" },
        "property:4d": { "foreground": "#A0806B" },
        "function:4d": { "foreground": "#4EC36E", "italic": true },
        "parameter:4d": { "foreground": "#0C70FF", "bold": true },
        "variable.interprocess:4d": { "foreground": "#FF0088" },
        "variable.process:4d": { "foreground": "#53B0EB" },
        "variable.local:4d": { "foreground": "#18B3F1" },
        "keyword:4d": { "foreground": "#D0D0D0", "bold": true },
        "table:4d": { "foreground": "#CF5600" },
        "field:4d": { "foreground": "#9C6765" },
        "comment:4d": { "foreground": "#8F8F8F" },
        "type:4d": { "foreground": "#068C00", "bold": true },
        "constant:4d": { "foreground": "#FA647F", "underline": true },
        "string:4d": { "foreground": "#FFFFFF" },
        "error:4d": { "foreground": "#ff0000", "bold": true, "italic": true }
      }
    }
  }
}
`, dt = () => je(ut), It = async (t) => {
  var o;
  const e = t.serviceConfig ?? {};
  e.debugLogging = ((o = t.logger) == null ? void 0 : o.isEnabled()) === !0 && (e.debugLogging === !0 || t.logger.isDebugEnabled() === !0), await dt(), e.userServices = e.userServices ?? {};
  const n = e.userServices.configurationService ?? void 0, i = e.workspaceConfig ?? void 0;
  if (n === void 0) {
    if (i)
      throw new Error(
        "You provided a workspaceConfig without using the configurationServiceOverride"
      );
    const r = {
      // @see https://github.com/CodinGame/monaco-vscode-api#monaco-standalone-services
      ...at(),
      ...ct(),
      ...Ee(),
      ...Xe(),
      ...gt()
    };
    We(r, e.userServices);
  }
  return i || (e.workspaceConfig = {
    workspaceProvider: {
      trusted: !0,
      workspace: {
        workspaceUri: l.Uri.file("/workspace")
      },
      async open() {
        return !1;
      }
    }
  }), e;
};
class Ct extends Ve {
  constructor(e, n) {
    super(e), this.onMessage = n;
  }
  readMessage(e) {
    this.onMessage && this.onMessage();
    const [, n] = e.split(`\r
\r
`);
    if (this.state === "initial")
      this.events.splice(0, 0, { message: n });
    else if (this.state === "listening") {
      const i = JSON.parse(n);
      this.callback(i);
    }
  }
}
class mt extends Ye {
  constructor(e, n) {
    super(e), this.onSend = n;
  }
  async write(e) {
    try {
      const n = JSON.stringify(e);
      this.socket.send(n), this.onSend && this.onSend();
    } catch (n) {
      this.errorCount++, this.fireError(n, e, this.errorCount);
    }
  }
}
function j(t, e = !0) {
  const n = `/PACKAGE/Project/Sources/${t}`;
  return e ? `file://${n}` : n;
}
function ue(t, e = 0) {
  setTimeout(t, e);
}
function ft(t, e) {
  const n = new Te(
    e.startLineNumber,
    e.startColumn,
    e.endLineNumber || e.startLineNumber,
    e.endColumn || e.startColumn
  );
  ue(() => {
    t.setSelection(n), t.revealRangeInCenter(n), t.focus();
  });
}
function pt(t, e, n = 0) {
  n > 0 && (e = n + e), ue(() => {
    t.setPosition({ lineNumber: e, column: 1 }), t.revealLineInCenter(e), t.focus();
  });
}
function Nn(t, e, n) {
  const o = t.getModel();
  if (o && e) {
    const r = o.getLineCount();
    for (let s = 1; s <= r; s++) {
      const p = o.getLineContent(s);
      if (new RegExp(`(?:Function|function) ${n}`).test(p))
        return s;
    }
  }
  return 0;
}
const At = {
  provideCompletionItems: async (t, e) => {
    const n = t.getWordUntilPosition(e);
    return {
      suggestions: [
        {
          label: "var",
          kind: l.languages.CompletionItemKind.Snippet,
          range: new l.Range(
            e.lineNumber,
            n.startColumn,
            e.lineNumber,
            n.endColumn
          ),
          insertText: ["var ${1:var_name} : ${2:var_type}"].join(`
`),
          insertTextRules: l.languages.CompletionItemInsertTextRule.InsertAsSnippet
        },
        {
          label: "While",
          kind: l.languages.CompletionItemKind.Snippet,
          range: new l.Range(
            e.lineNumber,
            n.startColumn,
            e.lineNumber,
            n.endColumn
          ),
          insertText: [
            "While(${1:expression})",
            "	${2:body}",
            "End while"
          ].join(`
`),
          insertTextRules: l.languages.CompletionItemInsertTextRule.InsertAsSnippet
        },
        {
          label: "Case of",
          kind: l.languages.CompletionItemKind.Snippet,
          range: new l.Range(
            e.lineNumber,
            n.startColumn,
            e.lineNumber,
            n.endColumn
          ),
          insertText: [
            "Case of",
            "	:(${1:boolean_expression})",
            "		${2:body}",
            "End case"
          ].join(`
`),
          insertTextRules: l.languages.CompletionItemInsertTextRule.InsertAsSnippet
        },
        {
          label: "Else",
          kind: l.languages.CompletionItemKind.Snippet,
          range: new l.Range(
            e.lineNumber,
            n.startColumn,
            e.lineNumber,
            n.endColumn
          ),
          insertText: ["Else", "	"].join(`
`),
          insertTextRules: l.languages.CompletionItemInsertTextRule.InsertAsSnippet
        },
        {
          label: "If",
          kind: l.languages.CompletionItemKind.Snippet,
          range: new l.Range(
            e.lineNumber,
            n.startColumn,
            e.lineNumber,
            n.endColumn
          ),
          insertText: ["If (${1:expression})", "	${5:body}", "End if"].join(
            `
`
          ),
          insertTextRules: l.languages.CompletionItemInsertTextRule.InsertAsSnippet
        },
        {
          label: "For",
          kind: l.languages.CompletionItemKind.Snippet,
          range: new l.Range(
            e.lineNumber,
            n.startColumn,
            e.lineNumber,
            n.endColumn
          ),
          insertText: [
            "For(${1:counter};${2:start};${3:end}${4:;increment})",
            "	${5:body}",
            "End for"
          ].join(`
`),
          insertTextRules: l.languages.CompletionItemInsertTextRule.InsertAsSnippet
        },
        {
          label: "Function",
          kind: l.languages.CompletionItemKind.Snippet,
          range: new l.Range(
            e.lineNumber,
            n.startColumn,
            e.lineNumber,
            n.endColumn
          ),
          insertText: [
            "Function ${1:function_name}(${2:params}) -> ${3:var_name} : ${4:var_type}",
            "	${5:body}"
          ].join(`
`),
          insertTextRules: l.languages.CompletionItemInsertTextRule.InsertAsSnippet
        }
      ]
    };
  }
}, bt = {
  provideCompletionItems: async (t, e) => {
    const n = t.getWordUntilPosition(e);
    return {
      suggestions: [
        {
          label: "var",
          kind: l.languages.CompletionItemKind.Snippet,
          range: new l.Range(
            e.lineNumber,
            n.startColumn,
            e.lineNumber,
            n.endColumn
          ),
          insertText: ["var ${1:var_name} : ${2:var_type}"].join(`
`),
          insertTextRules: l.languages.CompletionItemInsertTextRule.InsertAsSnippet
        },
        {
          label: "while",
          kind: l.languages.CompletionItemKind.Snippet,
          range: new l.Range(
            e.lineNumber,
            n.startColumn,
            e.lineNumber,
            n.endColumn
          ),
          insertText: ["while(${1:expression})", "	${2:body}", "end"].join(
            `
`
          ),
          insertTextRules: l.languages.CompletionItemInsertTextRule.InsertAsSnippet
        },
        {
          label: "switch",
          kind: l.languages.CompletionItemKind.Snippet,
          range: new l.Range(
            e.lineNumber,
            n.startColumn,
            e.lineNumber,
            n.endColumn
          ),
          insertText: [
            "switch",
            "	:(${1:boolean_expression})",
            "		${2:body}",
            "end"
          ].join(`
`),
          insertTextRules: l.languages.CompletionItemInsertTextRule.InsertAsSnippet
        },
        {
          label: "else",
          kind: l.languages.CompletionItemKind.Snippet,
          range: new l.Range(
            e.lineNumber,
            n.startColumn,
            e.lineNumber,
            n.endColumn
          ),
          insertText: ["else", "	"].join(`
`),
          insertTextRules: l.languages.CompletionItemInsertTextRule.InsertAsSnippet
        },
        {
          label: "if",
          kind: l.languages.CompletionItemKind.Snippet,
          range: new l.Range(
            e.lineNumber,
            n.startColumn,
            e.lineNumber,
            n.endColumn
          ),
          insertText: ["if (${1:expression})", "	${5:body}", "end"].join(
            `
`
          ),
          insertTextRules: l.languages.CompletionItemInsertTextRule.InsertAsSnippet
        },
        {
          label: "for",
          kind: l.languages.CompletionItemKind.Snippet,
          range: new l.Range(
            e.lineNumber,
            n.startColumn,
            e.lineNumber,
            n.endColumn
          ),
          insertText: [
            "for(${1:counter},${2:start},${3:end}${4:,increment})",
            "	${5:body}",
            "end"
          ].join(`
`),
          insertTextRules: l.languages.CompletionItemInsertTextRule.InsertAsSnippet
        },
        {
          label: "function",
          kind: l.languages.CompletionItemKind.Snippet,
          range: new l.Range(
            e.lineNumber,
            n.startColumn,
            e.lineNumber,
            n.endColumn
          ),
          insertText: [
            "function ${1:function_name}(${2:params}) -> ${3:var_name} : ${4:var_type}",
            "	${5:body}"
          ].join(`
`),
          insertTextRules: l.languages.CompletionItemInsertTextRule.InsertAsSnippet
        }
      ]
    };
  }
}, ht = [
  // zoom in
  {
    keybinding: G.CtrlCmd | J.NumpadAdd,
    command: "editor.action.fontZoomIn"
  },
  {
    keybinding: G.CtrlCmd | J.Equal,
    command: "editor.action.fontZoomIn"
  },
  // zoom out
  {
    keybinding: G.CtrlCmd | J.NumpadSubtract,
    command: "editor.action.fontZoomOut"
  },
  {
    keybinding: G.CtrlCmd | J.Minus,
    command: "editor.action.fontZoomOut"
  },
  // zoom reset
  {
    keybinding: G.CtrlCmd | J.Numpad0,
    command: "editor.action.fontZoomReset"
  },
  {
    keybinding: G.CtrlCmd | J.Digit0,
    command: "editor.action.fontZoomReset"
  }
], vt = ({ defaultZoom: t }) => (M(() => {
  t !== void 0 && ce.EditorZoom.setZoomLevel(t);
}, []), null);
ye.config({
  monaco: l
  // paths: {
  //   vs: import.meta.env.VITE_MONACO_EDITOR_CDN,
  // },
});
var H = /* @__PURE__ */ ((t) => (t[t.NotSet = -1] = "NotSet", t[t.None = 0] = "None", t[t.Italic = 1] = "Italic", t[t.Bold = 2] = "Bold", t[t.Underline = 4] = "Underline", t[t.Strikethrough = 8] = "Strikethrough", t))(H || {}), de = /* @__PURE__ */ ((t) => (t[t.None = 0] = "None", t[t.DefaultForeground = 1] = "DefaultForeground", t[t.DefaultBackground = 2] = "DefaultBackground", t))(de || {}), Ie = /* @__PURE__ */ ((t) => (t[t.Other = 0] = "Other", t[t.Comment = 1] = "Comment", t[t.String = 2] = "String", t[t.RegEx = 3] = "RegEx", t))(Ie || {});
class V {
  static getLanguageId(e) {
    return (e & 255) >>> 0;
  }
  static getTokenType(e) {
    return (e & 768) >>> 8;
  }
  static containsBalancedBrackets(e) {
    return (e & 1024) !== 0;
  }
  static getFontStyle(e) {
    return (e & 30720) >>> 11;
  }
  static getForeground(e) {
    return (e & 16744448) >>> 15;
  }
  static getBackground(e) {
    return (e & 4278190080) >>> 24;
  }
  static getClassNameFromMetadata(e) {
    let i = "mtk" + this.getForeground(e);
    const o = this.getFontStyle(e);
    return o & 1 && (i += " mtki"), o & 2 && (i += " mtkb"), o & 4 && (i += " mtku"), o & 8 && (i += " mtks"), i;
  }
  static getInlineStyleFromMetadata(e, n) {
    const i = this.getForeground(e), o = this.getFontStyle(e);
    let r = `color: ${n[i]};`;
    o & 1 && (r += "font-style: italic;"), o & 2 && (r += "font-weight: bold;");
    let s = "";
    return o & 4 && (s += " underline"), o & 8 && (s += " line-through"), s && (r += `text-decoration:${s};`), r;
  }
  static getPresentationFromMetadata(e) {
    const n = this.getForeground(e), i = this.getFontStyle(e);
    return {
      foreground: n,
      italic: !!(i & 1),
      bold: !!(i & 2),
      underline: !!(i & 4),
      strikethrough: !!(i & 8)
    };
  }
}
function St(t, e, n, i) {
  const o = n.tokens.data, r = t.getLanguageId();
  let s = 0, p = 0;
  const m = i.lineNumber - 1, h = i.column - 1;
  for (let C = 0; C < o.length; C += 5) {
    const A = o[C], f = o[C + 1], x = o[C + 2], R = o[C + 3], S = o[C + 4], y = s + A, b = A === 0 ? p + f : f;
    if (m === y && b <= h && h < b + x) {
      const d = n.legend.tokenTypes[R] || "not in legend (ignored)", F = [];
      let a = S;
      for (let P = 0; a > 0 && P < n.legend.tokenModifiers.length; P++)
        a & 1 && F.push(n.legend.tokenModifiers[P]), a = a >> 1;
      a > 0 && F.push("not in legend (ignored)");
      const g = new Oe(
        y + 1,
        b + 1,
        y + 1,
        b + 1 + x
      ), k = {}, L = e.getColorTheme().tokenColorMap, v = e.getColorTheme().getTokenStyleMetadata(
        d,
        F,
        r,
        !0,
        k
      );
      let _;
      return v && (_ = {
        languageId: void 0,
        tokenType: Ie.Other,
        bold: v == null ? void 0 : v.bold,
        italic: v == null ? void 0 : v.italic,
        underline: v == null ? void 0 : v.underline,
        strikethrough: v == null ? void 0 : v.strikethrough,
        foreground: L[(v == null ? void 0 : v.foreground) || de.None],
        background: void 0
      }), { type: d, modifiers: F, range: g, metadata: _, definitions: k };
    }
    s = y, p = b;
  }
  return null;
}
function yt(t, e, n) {
  let i = null;
  for (let o = 1; o < n; o++)
    i = e.tokenizeLine(
      t.getLineContent(o),
      i
    ).ruleStack;
  return i;
}
function Nt(t, e, n) {
  const i = t.getColorTheme().tokenColorMap, o = V.getLanguageId(n), r = V.getTokenType(n), s = V.getFontStyle(n), p = V.getForeground(n), m = V.getBackground(n);
  return {
    languageId: e.languageIdCodec.decodeLanguageId(o),
    tokenType: r,
    bold: s & H.Bold ? !0 : void 0,
    italic: s & H.Italic ? !0 : void 0,
    underline: s & H.Underline ? !0 : void 0,
    strikethrough: s & H.Strikethrough ? !0 : void 0,
    foreground: i[p],
    background: i[m]
  };
}
function Rt(t, e, n) {
  const i = n.lineNumber, o = t, r = o._tokenizationTextModelPart.grammarTokens._tokenizer.tokenizationSupport._actual._grammar, s = yt(t, r, i), p = r.tokenizeLine(
    t.getLineContent(i),
    s
  ), m = r.tokenizeLine2(
    t.getLineContent(i),
    s
  );
  let h = 0;
  for (let A = p.tokens.length - 1; A >= 0; A--) {
    const f = p.tokens[A];
    if (n.column - 1 >= f.startIndex) {
      h = A;
      break;
    }
  }
  let C = 0;
  for (let A = m.tokens.length >>> 1; A >= 0; A--)
    if (n.column - 1 >= m.tokens[A << 1]) {
      C = A;
      break;
    }
  return {
    token: p.tokens[h],
    metadata: Nt(
      e,
      o._languageService,
      m.tokens[(C << 1) + 1]
    )
  };
}
const Ce = le(void 0), Rn = ({
  children: t,
  url: e,
  qodly: n,
  defaultZoom: i,
  openHandler: o,
  language: r = "4d",
  defaultInited: s = !1
}) => {
  const p = Ne(), [m, h] = $(s), [C, A] = $(null), f = oe(), x = oe(0);
  M(() => {
    e && p && R();
  }, [e, p]);
  const R = async () => {
    if (!p) return;
    const I = new Je({
      enabled: process.env.NODE_ENV === "development",
      debugEnabled: process.env.NODE_ENV === "development"
    }), c = await It({
      logger: I
    });
    await Fe({
      caller: "Qodly Code Editor",
      logger: I,
      serviceConfig: c
    }), o && rt.get(st).registerCodeEditorOpenHandler(o), p.languages.registerCompletionItemProvider(
      r,
      n ? bt : At
    );
    const u = te.getDefaultKeybindings.bind(te);
    te.getDefaultKeybindings = () => u().filter(
      (Z) => ![
        "workbench.action.files.saveAs",
        "workbench.action.files.save"
      ].includes(Z.command)
    ), ce.addKeybindingRules(ht), p.languages.registerFoldingRangeProvider(r, {
      provideFoldingRanges: function(N) {
        const Z = [], X = /\\\s*$/;
        for (let W = 1, D = N.getLineCount(); W <= D; W++) {
          const U = N.getLineContent(W);
          if (X.exec(U)) {
            let K = W + 1;
            for (; K <= D; ) {
              const ee = N.getLineContent(K);
              if (X.exec(ee) == null)
                break;
              K++;
            }
            K > W && (Z.push({
              start: W,
              end: K,
              kind: p.languages.FoldingRangeKind.Region
            }), W = K);
          }
        }
        return Z;
      }
    }), S();
  }, S = () => {
    A(null);
    let I;
    try {
      I = new WebSocket(localStorage.LSP_SERVER || e);
    } catch {
      A(new Event("INVALID_URL"));
      return;
    }
    I.onopen = y, I.onclose = b, I.onerror = d, x.current = 0;
  }, y = async function() {
    const I = He(this), c = new Ct(I), u = new mt(I), N = new Le({
      name: "4D Language Client",
      clientOptions: {
        workspaceFolder: {
          uri: De.parse("file:///PACKAGE")
        },
        // use a language id as a document selector
        documentSelector: [{ scheme: "file", language: r }],
        // disable the default error handler
        errorHandler: {
          error: () => ({ action: Pe.Continue }),
          closed: () => ({ action: Me.DoNotRestart })
        }
      },
      // create a language client connection from the JSON RPC connection on demand
      connectionProvider: {
        get: () => Promise.resolve({
          reader: c,
          writer: u
        })
      }
    });
    f.current = N;
    const Z = N.sendRequest.bind(N);
    f.current.sendRequest = function(X, W, D) {
      return typeof X == "object" && X.method === "textDocument/diagnostic" && /file:\/\/\/PACKAGE\/Project\/Sources\/Methods\/__Debugger_.*/.test(
        W.textDocument.uri
      ) ? Promise.resolve() : Z(X, W, D);
    }, c.onClose(() => {
      N.stop(), x.current < 3 ? setTimeout(() => {
        x.current++, S();
      }, 1e3) : A(new Event("WEBSOCKET_CLOSED"));
    }), N.needsStart() && await N.start(), h(!0);
  }, b = () => {
  }, d = (I) => {
    A(I);
  };
  M(() => {
    const I = we.subscribe(({ action: c, payload: u }) => {
      switch (c) {
        case E.WILL_SAVE:
          L(u.filePath);
          break;
        case E.DID_SAVE:
          T(u.filePath, u.content);
          break;
        case E.WILL_CREATE:
          v(u.filePath);
          break;
        case E.DID_CREATE:
          be(u.filePath);
          break;
        case E.WILL_RENAME:
          _(u.oldPath, u.newPath);
          break;
        case E.DID_RENAME:
          he(u.oldPath, u.newPath);
          break;
        case E.WILL_DELETE:
          P(u.filePath);
          break;
        case E.DID_DELETE:
          ve(u.filePath);
          break;
        case E.DIAGNOSTIC_REFRESH:
          k(u.filePath);
          break;
      }
    });
    return () => I.unsubscribe();
  }, []);
  const F = (I) => {
    var c, u;
    return (u = (c = f.current) == null ? void 0 : c._features) == null ? void 0 : u.find(
      (N) => {
        var Z;
        return ((Z = N._registrationType) == null ? void 0 : Z.method) === I;
      }
    );
  }, a = (I) => {
    const c = [], u = F(I);
    if (u)
      for (const [, N] of u._registrations)
        N.provider && c.push(N.provider);
    return c;
  }, g = async (I, c, u) => {
    var Z, X, W;
    const N = a(
      ot.method
    );
    if (N[0]) {
      const D = new Ge(), U = await Promise.resolve(
        N[0].full.provideDocumentSemanticTokens(
          c,
          D.token
        )
      ), Q = I, K = U ? St(
        c,
        Q._themeService,
        {
          tokens: U,
          legend: (W = (X = (Z = f.current) == null ? void 0 : Z._capabilities) == null ? void 0 : X.semanticTokensProvider) == null ? void 0 : W.legend
        },
        u
      ) : null, ee = Rt(
        c,
        Q._themeService,
        u
      );
      return {
        semanticTokenInfo: K,
        textmateTokenInfo: ee
      };
    }
    return null;
  }, k = (I) => {
    if (f.current) {
      const c = a(
        $e.method
      );
      for (const u of c)
        u.onDidChangeDiagnosticsEmitter.fire();
    }
  }, L = (I, c = ze.Manual) => {
    var u;
    (u = f.current) == null || u.sendNotification(_e.type, {
      textDocument: {
        uri: j(I)
      },
      reason: c
    });
  }, T = (I, c) => {
    var u;
    (u = f.current) == null || u.sendNotification(Ue.type, {
      textDocument: {
        uri: j(I)
      },
      text: c
    });
  }, v = (I) => {
    var c;
    (c = f.current) == null || c.sendRequest(qe.type, {
      files: [
        {
          uri: j(I)
        }
      ]
    });
  }, _ = (I, c) => {
    var u;
    (u = f.current) == null || u.sendRequest(Qe.type, {
      files: [
        {
          oldUri: j(I),
          newUri: j(c)
        }
      ]
    });
  }, P = (I) => {
    var c;
    (c = f.current) == null || c.sendRequest(et.type, {
      files: [
        {
          uri: j(I)
        }
      ]
    });
  }, be = (I) => {
    var c;
    (c = f.current) == null || c.sendNotification(tt.type, {
      files: [
        {
          uri: j(I)
        }
      ]
    });
  }, he = (I, c) => {
    var u;
    (u = f.current) == null || u.sendNotification(nt.type, {
      files: [
        {
          oldUri: j(I),
          newUri: j(c)
        }
      ]
    });
  }, ve = (I) => {
    var c;
    (c = f.current) == null || c.sendNotification(it.type, {
      files: [
        {
          uri: j(I)
        }
      ]
    });
  };
  return /* @__PURE__ */ z(
    Ce.Provider,
    {
      value: {
        inited: m || !!C,
        clientRef: f,
        lastError: C,
        reload: S,
        getTokenAtPosition: g
      },
      children: [
        t,
        /* @__PURE__ */ w(vt, { defaultZoom: i })
      ]
    }
  );
};
function wn() {
  const t = ae(Ce);
  if (t === void 0)
    throw new Error("useLSP must be used within an LSPContext");
  return t;
}
const me = le(
  void 0
), xn = Se(({ children: t }) => {
  const [e, n] = $(null);
  return /* @__PURE__ */ w(
    me.Provider,
    {
      value: {
        editor: e,
        setEditor: n
      },
      children: t
    }
  );
});
function wt() {
  const t = ae(me), e = $(null);
  if (t === void 0) {
    const [n, i] = e;
    return {
      editor: n,
      setEditor: i
    };
  }
  return t;
}
const xt = {
  provideCompletionItems: (t, e) => {
    const n = t.getWordUntilPosition(e);
    return {
      suggestions: [
        {
          label: "device:xs",
          kind: l.languages.CompletionItemKind.Snippet,
          documentation: "Media query for phone device",
          range: new l.Range(
            e.lineNumber,
            n.startColumn,
            e.lineNumber,
            n.endColumn
          ),
          insertText: [
            "@media screen and (max-width: ${1:365px}) {",
            "  self {",
            "    ${2:background-color}:${3:red};",
            "  }",
            "}"
          ].join(`
`),
          insertTextRules: l.languages.CompletionItemInsertTextRule.InsertAsSnippet
        }
      ]
    };
  }
}, kt = "#/definitions/Condition", Lt = { Base: { type: "object", properties: { id: { type: "string" }, name: { type: "string" } }, required: ["id"] }, Condition: { oneOf: [{ $ref: "#/definitions/Datasource" }, { $ref: "#/definitions/Privilege" }, { $ref: "#/definitions/Combination" }, { $ref: "#/definitions/CurrentState" }, { $ref: "#/definitions/ParentState" }, { $ref: "#/definitions/Reference" }] }, Datasource: { allOf: [{ $ref: "#/definitions/Base" }], properties: { type: { const: "datasource" }, path: { type: "string" }, value: { type: ["number", "string", "boolean", "object", "array", "null"] }, valueType: { enum: ["datasource", "hardCoded"] }, dataType: { enum: ["string", "number", "date", "boolean", "array", "object"] }, op: { enum: ["eq", "neq", "regex", "in", "nin", "gt", "gte", "lt", "lte"] } }, required: ["name", "type", "path", "value", "op"] }, Privilege: { allOf: [{ $ref: "#/definitions/Base" }], properties: { type: { const: "privilege" }, value: { type: "string" }, valueType: { enum: ["datasource", "hardCoded"] }, op: { enum: ["eq", "neq", "regex"] } }, required: ["name", "type", "value", "op"] }, Combination: { allOf: [{ $ref: "#/definitions/Base" }], properties: { type: { const: "combination" }, op: { enum: ["and", "or"] }, conditions: { type: "array", items: { $ref: "#/definitions/Condition" } } }, required: ["type", "conditions", "op"] }, CurrentState: { allOf: [{ $ref: "#/definitions/Base" }], properties: { type: { const: "currentState" }, value: { type: "string" }, valueType: { enum: ["datasource", "hardCoded"] }, dataType: { enum: ["string", "number", "date", "boolean", "array", "object"] }, op: { enum: ["eq", "neq", "regex"] } }, required: ["name", "type", "value", "op"] }, ParentState: { allOf: [{ $ref: "#/definitions/Base" }], properties: { type: { const: "parentState" }, value: { type: "string" }, valueType: { enum: ["datasource", "hardCoded"] }, dataType: { enum: ["string", "number", "date", "boolean", "array", "object"] }, op: { enum: ["eq", "neq", "regex"] } }, required: ["name", "type", "value", "op"] }, Reference: { allOf: [{ $ref: "#/definitions/Base" }], properties: { type: { const: "reference" }, ref: { type: "string" } }, required: ["type", "ref"] } }, Wt = {
  $ref: kt,
  definitions: Lt
}, Ft = "array", Zt = { type: "object", properties: { class: { type: "string" }, method: { type: "string" }, regexPattern: { type: "string" }, verbs: { type: "string" } } }, jt = {
  type: Ft,
  items: Zt
};
function Xt(t, e) {
  const n = document.createElement("style");
  n.dataset.id = e, n.textContent = t, document.head.append(n);
}
function Et(t) {
  return Array.from(document.styleSheets).find(
    (e) => e.ownerNode.getAttribute("data-id") === t
  );
}
function Kt(t, e) {
  const n = [];
  let i = [];
  const o = [], r = (a, g, k, L) => {
    n.push({
      startLineNumber: a,
      endLineNumber: k,
      startColumn: g,
      endColumn: L
    }), h(), m();
  }, s = (a) => {
    o.indexOf(a) < 0 && o.push(a);
  }, p = (a) => {
    const g = o.indexOf(a);
    g < 0 || o.splice(g, 1);
  }, m = () => {
    for (const a of o)
      try {
        a(i);
      } catch (g) {
        console.error(g);
      }
  }, h = () => {
    const a = t.getModel();
    a && (i = Tt(
      n.map((g) => [
        a.getOffsetAt({
          lineNumber: g.startLineNumber,
          column: g.startColumn
        }),
        a.getOffsetAt({
          lineNumber: g.endLineNumber,
          column: g.endColumn
        })
      ]),
      /*mergeJoins*/
      !0
    ), i.length > 0 && (i[0][0] <= 0 && (i[0][0] = Number.NEGATIVE_INFINITY), i[i.length - 1][1] >= a.getValueLength() && (i[i.length - 1][1] = Number.POSITIVE_INFINITY)));
  }, C = (a) => {
    const g = {
      isDeletion: !1,
      isAddition: !1,
      isReplacement: !1
    };
    return a.text === "" ? g.isDeletion = !0 : a.range.startLineNumber === a.range.endLineNumber && a.range.startColumn === a.range.endColumn ? g.isAddition = !0 : g.isReplacement = !0, g;
  }, A = t.onDidChangeModel((a) => {
    h(), d();
  }), f = t.onDidChangeModelContent((a) => {
    if (!a.isUndoing)
      for (const g of a.changes) {
        const k = C(g);
        if (k.isReplacement || k.isDeletion || k.isAddition) {
          const L = n.some(
            (v) => g.range.startLineNumber >= v.startLineNumber && g.range.endLineNumber <= v.endLineNumber && g.range.startColumn >= v.startColumn && g.range.endColumn <= v.endColumn
          ), T = !L && e && g.range.startLineNumber === 1 && g.range.startColumn === 1 && !ge(g.text);
          if (L || T) {
            const v = t.getModel();
            if (v) {
              v.undo();
              return;
            }
          }
        }
      }
  }), x = () => {
    A.dispose(), f.dispose();
  };
  let R = [], S = `
    .idoc-readonly-mark {
      cursor: not-allowed;
      z-index: 1;
    }
  `;
  if (S) {
    const a = "monaco-read-only";
    Et(a) || Xt(S, a), S = null;
  }
  const y = () => {
    s(d), d();
  }, b = () => {
    p(d), R = t.deltaDecorations(R, []);
  }, d = () => {
    const a = t.getModel();
    a && (R = t.deltaDecorations(
      R,
      i.map(F(a))
    ));
  }, F = (a) => (g) => {
    const k = a.getPositionAt(g[0]), L = a.getPositionAt(g[1]);
    return {
      range: new l.Range(
        k.lineNumber,
        k.column,
        L.lineNumber,
        L.column
      ),
      options: {
        className: "idoc-readonly-mark"
      }
    };
  };
  return {
    get buffer() {
      return i;
    },
    exclude: r,
    attach: s,
    detach: p,
    dispose: x,
    show: y,
    hide: b
  };
}
function Bt(t, e, n) {
  let i = !1;
  const o = (b) => b[1] < b[0] ? (i = !0, [[b[1], b[0]]]) : [[...b]], r = (b) => i ? b.map((d) => d[1] > d[0] ? p(d) : d).reverse() : b;
  let s;
  const p = (b) => (s = b[1], b[1] = b[0], b[0] = s, b), m = o(t);
  let h, C, A, f, x, R, S, y;
  A = m[0];
  for (C of e)
    for (S = C[0], y = C[1], f = 0; f < m.length; f++) {
      if (A = m[f], x = A[0], R = A[1], x < S)
        R < S ? h = [A] : R <= y ? h = [[x, S - 1]] : h = [
          [x, S - 1],
          [y + 1, R]
        ];
      else if (x <= y)
        if (S === Number.NEGATIVE_INFINITY) {
          const b = y + 1;
          h = n === 0 ? [] : [[b, R > b ? R : b]];
        } else y === Number.POSITIVE_INFINITY ? h = n === 0 ? [] : [[S - 1, S - 1]] : R <= y ? h = n < 0 ? [[S - 1, S - 1]] : n > 0 ? [[y + 1, y + 1]] : [] : h = [[y + 1, R]];
      else
        h = [A];
      if (m.splice(f, 1, ...h), m.length === 1 && m[0][1] < S) return r(m);
    }
  return r(m);
}
function Tt(t, e) {
  if (t.length < 2) return t;
  const n = [];
  let i = null, o, r;
  t = t.map(
    (s) => (s[1] < s[0] && (o = s[1], s[1] = s[0], s[1] = o), s)
  ).sort((s, p) => s[0] - p[0]), n.push(t[0]);
  for (let s = 1; s < t.length; s++)
    i = n[n.length - 1], r = t[s], i[1] === r[0] && !e || (i[1] === r[0] - 1 && e ? (i[1] = r[1], n.splice(n.length - 1, 1, i)) : i[1] < r[0] ? n.push(r) : i[1] < r[1] && (i[1] = r[1], n.splice(n.length - 1, 1, i)));
  return n;
}
function Y(t, e) {
  return e.bind(t);
}
class Ot {
  constructor(e, n) {
    var i;
    this.disposables = [], this.prefer = 1, this.lastPrefer = 1, this.onCursor = Y(
      this,
      function(o) {
        if (o.source === "api") return;
        const r = this.getApprovedSelections();
        r.length !== 0 && this.editor.setSelections(r);
      }
    ), this.onRectangleSelectionStart = Y(this, function({ event: o }) {
      o.middleButton && (this.lastPrefer = this.prefer, this.prefer = 0, window.addEventListener("pointerup", this.onRectangleSelectionStop));
    }), this.onRectangleSelectionStop = Y(this, function() {
      this.prefer = this.lastPrefer, window.removeEventListener("pointerup", this.onRectangleSelectionStop);
    }), this.onKey = Y(this, function(o) {
      const r = o.keyCode, s = l.KeyCode;
      if (o.altKey || s.F1 <= r && r <= s.F19 || o.ctrlKey && r !== s.Backspace) return;
      if (r === s.UpArrow || r === s.LeftArrow || r === s.Home || r === s.PageUp) {
        this.prefer = -1;
        return;
      }
      if (r === s.DownArrow || r === s.RightArrow || r === s.End || r === s.PageDown) {
        this.prefer = 1;
        return;
      }
      const p = this.getSelections(), m = this.intervals.buffer;
      let h;
      if (r === s.Delete)
        h = (C) => C[0] === C[1] && m.find((A) => C[1] + 1 === A[0]) != null;
      else if (r === s.Backspace)
        h = (C) => C[0] === C[1] && m.find((A) => A[1] + 1 === C[0]) != null;
      else
        return;
      p.findIndex(h) !== -1 && (o.stopPropagation(), o.preventDefault());
    }), this.getOffsetAt = Y(this, function(o) {
      let r;
      for (let s = 0; s < this.intervals.buffer.length; s++)
        if (r = this.intervals.buffer[s], o <= r[1])
          return r[0] - o < o - r[1] ? r[0] : r[1];
    }), this.editor = e, this.intervals = Kt(e, n), (i = this.editor.getModel()) == null || i.setEOL(l.editor.EndOfLineSequence.LF);
  }
  enable() {
    this.disposables.push(
      this.editor.onDidChangeCursorPosition(this.onCursor),
      this.editor.onKeyDown(this.onKey),
      this.editor.onMouseDown(this.onRectangleSelectionStart)
    ), this.intervals.show();
  }
  dispose() {
    for (const e of this.disposables) e.dispose();
    this.disposables.splice(0);
  }
  exclude(e, n, i, o) {
    arguments.length === 1 ? this.intervals.exclude(e, 0, e, Number.MAX_SAFE_INTEGER) : this.intervals.exclude(e, n, i, o);
  }
  getApprovedSelections() {
    const e = this.editor.getModel();
    return this.getSelections().map(
      (i) => Bt(
        i,
        this.intervals.buffer,
        this.prefer
      )
    ).flat().map((i) => {
      const o = e.getPositionAt(i[0]), r = e.getPositionAt(i[1]);
      return new l.Selection(
        o.lineNumber,
        o.column,
        r.lineNumber,
        r.column
      );
    });
  }
  getSelections() {
    const e = this.editor.getModel();
    return (this.editor.getSelections() || []).map((n) => [
      e.getOffsetAt({
        lineNumber: n.selectionStartLineNumber,
        column: n.selectionStartColumn
      }),
      e.getOffsetAt({
        lineNumber: n.positionLineNumber,
        column: n.positionColumn
      })
    ]);
  }
}
const Dt = new RegExp("^[	s]+(exposed|Function)", "i"), Gt = ({
  lineNumber: t,
  editor: e,
  type: n,
  source: i
}) => {
  var h;
  const o = n === ie.METHOD || n === ie.DEBUGGER && ((h = i == null ? void 0 : i.codeDescriptorInfo) == null ? void 0 : h.type) === xe.METHOD;
  if (t === 1)
    return o ? "" : "1";
  const r = e == null ? void 0 : e.getModel(), s = (r == null ? void 0 : r.getLinesContent()) || [], p = Array(s.length).fill("-");
  let m = o ? 0 : 1;
  for (let C = 1; C < s.length; C++)
    (C === 1 ? "" : s[C - 1]).endsWith("\\") || (m += 1, p[C] = m.toString());
  return p[t - 1];
}, re = () => /* @__PURE__ */ w("div", { className: "absolute inset-0 animate-pulse", children: /* @__PURE__ */ w("div", { className: "w-full space-y-4 px-4 py-1", children: /* @__PURE__ */ z("div", { className: "space-y-2", children: [
  /* @__PURE__ */ w("div", { className: "h-3 w-3/4 rounded bg-grey-200" }),
  /* @__PURE__ */ w("div", { className: "h-3 rounded bg-grey-200" }),
  /* @__PURE__ */ w("div", { className: "h-3 w-5/6 rounded bg-grey-200" }),
  /* @__PURE__ */ w("div", { className: "h-3 rounded bg-grey-200" }),
  /* @__PURE__ */ w("div", { className: "h-3 rounded bg-grey-200" })
] }) }) }), ne = ["fd-dark"], kn = ({
  path: t,
  initialValue: e,
  type: n,
  language: i,
  onChange: o,
  options: r = {},
  extra: s = {},
  lspProps: p,
  theme: m = ne[0],
  ...h
}) => {
  const { initialLineInfo: C, initialSelectionInfo: A } = s, { editor: f, setEditor: x } = wt(), { inited: R } = p;
  function S(d) {
    i === "css" && d.languages.registerCompletionItemProvider("css", xt), i === "json" && d.languages.json && d.languages.json.jsonDefaults.setDiagnosticsOptions({
      validate: !0,
      schemas: [
        {
          uri: "condition-schema.json",
          fileMatch: ["*.condition.json"],
          schema: Wt
        },
        {
          uri: "handlers-schema.json",
          fileMatch: [ke],
          schema: jt
        }
      ]
    });
  }
  function y(d, F) {
    x(d);
    const a = d.getModel();
    if (a && (a.updateOptions({ insertSpaces: !1 }), d.onKeyUp(() => {
      var k;
      const g = (k = d.getPosition()) == null ? void 0 : k.lineNumber;
      if (g) {
        const L = a.getLineFirstNonWhitespaceColumn(g), T = a.getLineLength(g), v = a.getLineContent(g);
        Dt.test(v) && d.executeEdits("edit-handler", [
          {
            range: new F.Range(
              g,
              0,
              g,
              T
            ),
            text: v.substr(
              L - 1,
              T - L
            )
          }
        ]);
      }
    })), n === ie.METHOD && ge(e)) {
      const g = new Ot(d, !0);
      g.exclude(1, 1, 1, Number.POSITIVE_INFINITY), g.enable();
    }
  }
  M(() => {
    if (!f) return;
    const { line: d, offset: F } = C || {};
    d && pt(f, d, F);
  }, [C, f]), M(() => {
    if (!f) return;
    const { selection: d } = A || {};
    d && ft(f, d);
  }, [A, f]);
  const b = (d) => ne.includes(d) ? d : ne[0];
  return R ? /* @__PURE__ */ w(
    Re,
    {
      options: {
        readOnly: !0,
        fontSize: 12,
        "semanticHighlighting.enabled": !0,
        padding: { top: 10 },
        lineNumbers: i === "4d" ? (d) => Gt({
          lineNumber: d,
          editor: f,
          type: n,
          source: s == null ? void 0 : s.source
        }) : void 0,
        scrollBeyondLastLine: !1,
        ...r
      },
      path: j(t),
      value: e,
      theme: b(m),
      onChange: (d) => o && o(d || ""),
      language: i,
      beforeMount: S,
      onMount: y,
      loading: /* @__PURE__ */ w(re, {}),
      ...h
    }
  ) : /* @__PURE__ */ w("div", { className: "relative flex-1 w-full", children: /* @__PURE__ */ w(re, {}) });
};
var fe = {
  color: void 0,
  size: void 0,
  className: void 0,
  style: void 0,
  attr: void 0
}, se = O.createContext && O.createContext(fe), B = function() {
  return B = Object.assign || function(t) {
    for (var e, n = 1, i = arguments.length; n < i; n++) {
      e = arguments[n];
      for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
    }
    return t;
  }, B.apply(this, arguments);
}, Jt = function(t, e) {
  var n = {};
  for (var i in t) Object.prototype.hasOwnProperty.call(t, i) && e.indexOf(i) < 0 && (n[i] = t[i]);
  if (t != null && typeof Object.getOwnPropertySymbols == "function") for (var o = 0, i = Object.getOwnPropertySymbols(t); o < i.length; o++)
    e.indexOf(i[o]) < 0 && Object.prototype.propertyIsEnumerable.call(t, i[o]) && (n[i[o]] = t[i[o]]);
  return n;
};
function pe(t) {
  return t && t.map(function(e, n) {
    return O.createElement(e.tag, B({
      key: n
    }, e.attr), pe(e.child));
  });
}
function Ae(t) {
  return function(e) {
    return O.createElement(Mt, B({
      attr: B({}, t.attr)
    }, e), pe(t.child));
  };
}
function Mt(t) {
  var e = function(n) {
    var i = t.attr, o = t.size, r = t.title, s = Jt(t, ["attr", "size", "title"]), p = o || n.size || "1em", m;
    return n.className && (m = n.className), t.className && (m = (m ? m + " " : "") + t.className), O.createElement("svg", B({
      stroke: "currentColor",
      fill: "currentColor",
      strokeWidth: "0"
    }, n.attr, i, s, {
      className: m,
      style: B(B({
        color: t.color || n.color
      }, n.style), t.style),
      height: p,
      width: p,
      xmlns: "http://www.w3.org/2000/svg"
    }), r && O.createElement("title", null, r), t.children);
  };
  return se !== void 0 ? O.createElement(se.Consumer, null, function(n) {
    return e(n);
  }) : e(fe);
}
function Pt(t) {
  return Ae({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { d: "M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 10.5858L9.17157 7.75736L7.75736 9.17157L10.5858 12L7.75736 14.8284L9.17157 16.2426L12 13.4142L14.8284 16.2426L16.2426 14.8284L13.4142 12L16.2426 9.17157L14.8284 7.75736L12 10.5858Z" } }] })(t);
}
function Vt(t) {
  return Ae({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M449.07 399.08L278.64 82.58c-12.08-22.44-44.26-22.44-56.35 0L51.87 399.08A32 32 0 0080 446.25h340.89a32 32 0 0028.18-47.17zm-198.6-1.83a20 20 0 1120-20 20 20 0 01-20 20zm21.72-201.15l-5.74 122a16 16 0 01-32 0l-5.74-121.95a21.73 21.73 0 0121.5-22.69h.21a21.74 21.74 0 0121.73 22.7z" } }] })(t);
}
const Ln = ({
  lspProps: { lastError: t, reload: e }
}) => {
  const [n, i] = $(!1), o = () => {
    e();
  }, r = () => {
    i(!1);
  };
  return M(() => {
    i(!!t);
  }, [t]), n ? /* @__PURE__ */ z("div", { className: "flex items-center border-b border-fd-gray-darker bg-grey-800 px-2 py-1.5 text-xs text-grey-50", children: [
    /* @__PURE__ */ z("span", { className: "flex flex-1 justify-center gap-1", children: [
      /* @__PURE__ */ w(Vt, { className: "h-4 w-4 text-yellow-600" }),
      /* @__PURE__ */ z("span", { children: [
        "LSP not loaded.",
        " ",
        /* @__PURE__ */ w(
          "button",
          {
            className: "text-primary-dark underline",
            onClick: o,
            children: "Reload?"
          }
        )
      ] })
    ] }),
    /* @__PURE__ */ w("button", { className: "focus:outline-none", children: /* @__PURE__ */ w(
      Pt,
      {
        className: "h-4 w-4 text-white",
        onClick: r
      }
    ) })
  ] }) : null;
}, Yt = {
  name: "4d",
  displayName: "%displayName%",
  description: "%description%",
  version: "1.0.0",
  publisher: "vscode",
  engines: { vscode: "0.10.x" },
  categories: ["Programming Languages"],
  contributes: {
    languages: [
      {
        id: "4d",
        aliases: ["4D", "4d"],
        extensions: [".4dm", ".4qs"],
        configuration: "./language-configuration.json"
      }
    ],
    grammars: [
      {
        language: "4d",
        scopeName: "source.4dm",
        path: "./syntaxes/4d.tmLanguage.json"
      }
    ]
  }
}, { registerFileUrl: q, whenReady: Wn } = lt(Yt, void 0, {
  system: !0
});
q(
  "./syntaxes/4d.tmLanguage.json",
  new URL("data:application/json;base64,ewogICJuYW1lIjogIjREIiwKICAic2NvcGVOYW1lIjogInNvdXJjZS40ZG0iLAogICJwYXR0ZXJucyI6IFsKICAgIHsKICAgICAgImluY2x1ZGUiOiAiI3N0YXRlbWVudHMiCiAgICB9CiAgXSwKICAicmVwb3NpdG9yeSI6IHsKICAgICJzdGF0ZW1lbnRzIjogewogICAgICAicGF0dGVybnMiOiBbCiAgICAgICAgewogICAgICAgICAgImluY2x1ZGUiOiAiI2NvbW1lbnQiCiAgICAgICAgfQogICAgICBdCiAgICB9LAogICAgImNvbW1lbnQiOiB7CiAgICAgICJwYXR0ZXJucyI6IFsKICAgICAgICB7CiAgICAgICAgICAibmFtZSI6ICJjb21tZW50LmJsb2NrLjRkIiwKICAgICAgICAgICJiZWdpbiI6ICIoL1xcKikoPzpcXHMqKChAKWludGVybmFsKSg/PVxcc3woXFwqLykpKT8iLAogICAgICAgICAgImJlZ2luQ2FwdHVyZXMiOiB7CiAgICAgICAgICAgICIxIjogewogICAgICAgICAgICAgICJuYW1lIjogInB1bmN0dWF0aW9uLmRlZmluaXRpb24uY29tbWVudC40ZCIKICAgICAgICAgICAgfSwKICAgICAgICAgICAgIjIiOiB7CiAgICAgICAgICAgICAgIm5hbWUiOiAic3RvcmFnZS50eXBlLmludGVybmFsZGVjbGFyYXRpb24uNGQiCiAgICAgICAgICAgIH0sCiAgICAgICAgICAgICIzIjogewogICAgICAgICAgICAgICJuYW1lIjogInB1bmN0dWF0aW9uLmRlY29yYXRvci5pbnRlcm5hbGRlY2xhcmF0aW9uLjRkIgogICAgICAgICAgICB9CiAgICAgICAgICB9LAogICAgICAgICAgImVuZCI6ICJcXCovIiwKICAgICAgICAgICJlbmRDYXB0dXJlcyI6IHsKICAgICAgICAgICAgIjAiOiB7CiAgICAgICAgICAgICAgIm5hbWUiOiAicHVuY3R1YXRpb24uZGVmaW5pdGlvbi5jb21tZW50LjRkIgogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAiYmVnaW4iOiAiKF5bIFxcdF0rKT8oKC8vKSg/OlxccyooKEApaW50ZXJuYWwpKD89XFxzfCQpKT8pIiwKICAgICAgICAgICJiZWdpbkNhcHR1cmVzIjogewogICAgICAgICAgICAiMSI6IHsKICAgICAgICAgICAgICAibmFtZSI6ICJwdW5jdHVhdGlvbi53aGl0ZXNwYWNlLmNvbW1lbnQubGVhZGluZy40ZCIKICAgICAgICAgICAgfSwKICAgICAgICAgICAgIjIiOiB7CiAgICAgICAgICAgICAgIm5hbWUiOiAiY29tbWVudC5saW5lLmRvdWJsZS1zbGFzaC40ZCIKICAgICAgICAgICAgfSwKICAgICAgICAgICAgIjMiOiB7CiAgICAgICAgICAgICAgIm5hbWUiOiAicHVuY3R1YXRpb24uZGVmaW5pdGlvbi5jb21tZW50LjRkIgogICAgICAgICAgICB9LAogICAgICAgICAgICAiNCI6IHsKICAgICAgICAgICAgICAibmFtZSI6ICJzdG9yYWdlLnR5cGUuaW50ZXJuYWxkZWNsYXJhdGlvbi40ZCIKICAgICAgICAgICAgfSwKICAgICAgICAgICAgIjUiOiB7CiAgICAgICAgICAgICAgIm5hbWUiOiAicHVuY3R1YXRpb24uZGVjb3JhdG9yLmludGVybmFsZGVjbGFyYXRpb24uNGQiCiAgICAgICAgICAgIH0KICAgICAgICAgIH0sCiAgICAgICAgICAiZW5kIjogIig/PSQpIiwKICAgICAgICAgICJjb250ZW50TmFtZSI6ICJjb21tZW50LmxpbmUuZG91YmxlLXNsYXNoLjRkIgogICAgICAgIH0KICAgICAgXQogICAgfQogIH0KfQo=", import.meta.url).toString(),
  { mimeType: "application/json", size: 1592 }
);
q(
  "./language-configuration.json",
  new URL("data:application/json;base64,ewogICJjb21tZW50cyI6IHsKICAgICJsaW5lQ29tbWVudCI6ICIvLyIsCiAgICAiYmxvY2tDb21tZW50IjogWyIvKioiLCAiKiovIl0KICB9LAogIC8vIHN5bWJvbHMgdXNlZCBhcyBicmFja2V0cwogICJicmFja2V0cyI6IFsKICAgIFsieyIsICJ9Il0sCiAgICBbIigiLCAiKSJdLAogICAgWyJbIiwgIl0iXQogIF0sCiAgLy8gc3ltYm9scyB0aGF0IGFyZSBhdXRvIGNsb3NlZCB3aGVuIHR5cGluZwogIC8vIHN5bWJvbHMgdGhhdCB0aGF0IGNhbiBiZSB1c2VkIHRvIHN1cnJvdW5kIGEgc2VsZWN0aW9uCiAgInN1cnJvdW5kaW5nUGFpcnMiOiBbCiAgICBbInsiLCAifSJdLAogICAgWyJbIiwgIl0iXSwKICAgIFsiKCIsICIpIl0sCiAgICBbIlwiIiwgIlwiIl0sCiAgICBbIiciLCAiJyJdCiAgXSwKICAiYXV0b0Nsb3NpbmdQYWlycyI6IFsKICAgIHsKICAgICAgIm9wZW4iOiAiKCIsCiAgICAgICJjbG9zZSI6ICIpIgogICAgfSwKICAgIHsgIm9wZW4iOiAieyIsICJjbG9zZSI6ICJ9IiB9LAogICAgeyAib3BlbiI6ICJbIiwgImNsb3NlIjogIl0iIH0sCiAgICB7ICJvcGVuIjogIiciLCAiY2xvc2UiOiAiJyIsICJub3RJbiI6IFsic3RyaW5nIiwgImNvbW1lbnQiXSB9LAogICAgeyAib3BlbiI6ICJcIiIsICJjbG9zZSI6ICJcIiIsICJub3RJbiI6IFsic3RyaW5nIl0gfSwKICAgIHsgIm9wZW4iOiAiYCIsICJjbG9zZSI6ICJgIiwgIm5vdEluIjogWyJzdHJpbmciLCAiY29tbWVudCJdIH0sCiAgICB7ICJvcGVuIjogIi8qKiIsICJjbG9zZSI6ICIgKiovIiwgIm5vdEluIjogWyJzdHJpbmciXSB9CiAgXSwKICAiYXV0b0Nsb3NlQmVmb3JlIjogIjs6Liw9fV0pPmAgXG5cdCIsCiAgIndvcmRQYXR0ZXJuIjogIigtP1xcZCpcXC5cXGRcXHcqKXwoW15cXGBcXH5cXCFcXEBcXCNcXCVcXF5cXCZcXCpcXChcXClcXC1cXD1cXCtcXFtcXHtcXF1cXH1cXFxcXFx8XFw7XFw6XFwnXFxcIlxcLFxcLlxcPFxcPlxcL1xcP1xcclxcblxcdFxcZlxcdiBdKyl8KD88PVthLXpBLVpdKSA/KD89W2EtekEtWl0pIiwKICAiaW5kZW50YXRpb25SdWxlcyI6IHsKICAgICJpbmNyZWFzZUluZGVudFBhdHRlcm4iOiB7CiAgICAgICJwYXR0ZXJuIjogIiheKD8hW15cXHNdKSpcXHMqKGNsYXNzIGNvbnN0cnVjdG9yKSl8KF4oPyFbXlxcc10pKlxccyooZXhwb3NlZHxsb2NhbHxcXHMqKXsxfVxccypmdW5jdGlvbnsxfVxccypcXHcpfCheKD8hW15cXHNdKSpcXHMqKElmfEVsc2V8Rm9yfEZvciBlYWNofFdoaWxlfEJlZ2luIFNRTHxDYXNlIG9mfFVzZXxSZXBlYXR8OiAqXFwoLiopKS4qJCIsCiAgICAgICJmbGFncyI6ICJpIgogICAgfSwKICAgICJkZWNyZWFzZUluZGVudFBhdHRlcm4iOiB7CiAgICAgICJwYXR0ZXJuIjogIiheKD8hW15cXHNdKSpcXHMqKGV4cG9zZWR8bG9jYWx8XFxzKil7MX1cXHMqZnVuY3Rpb257MX1cXHMqXFx3KXwoRW5kIElmfEVuZCBGb3J8RWxzZXxFbmQgZm9yIGVhY2h8RW5kIFdoaWxlfEVuZCBTUUx8RW5kIGNhc2V8RW5kIHVzZXxVbnRpbHw6ICpcXCguKikuKiQiLAogICAgICAiZmxhZ3MiOiAiaSIKICAgIH0KICB9LAogICJvbkVudGVyUnVsZXMiOiBbCiAgICB7CiAgICAgICJiZWZvcmVUZXh0IjogewogICAgICAgICJwYXR0ZXJuIjogIl5leHBvc2VkIiwKICAgICAgICAiZmxhZ3MiOiAiaSIKICAgICAgfSwKICAgICAgImFjdGlvbiI6IHsgImluZGVudCI6ICJpbmRlbnQiLCAiaW5kZW50QWN0aW9uIjogMSB9CiAgICB9CiAgXQp9Cg==", import.meta.url).toString(),
  { mimeType: "application/json", size: 1723 }
);
q(
  "package.json",
  new URL("data:application/json;base64,ewogICJuYW1lIjogIjRkIiwKICAiZGlzcGxheU5hbWUiOiAiJWRpc3BsYXlOYW1lJSIsCiAgImRlc2NyaXB0aW9uIjogIiVkZXNjcmlwdGlvbiUiLAogICJ2ZXJzaW9uIjogIjEuMC4wIiwKICAicHVibGlzaGVyIjogInZzY29kZSIsCiAgImxpY2Vuc2UiOiAiTUlUIiwKICAiZW5naW5lcyI6IHsKICAgICJ2c2NvZGUiOiAiMC4xMC54IgogIH0sCiAgInNjcmlwdHMiOiB7CiAgICAidXBkYXRlLWdyYW1tYXIiOiAibm9kZSAuLi9ub2RlX21vZHVsZXMvdnNjb2RlLWdyYW1tYXItdXBkYXRlci9iaW4gbWljcm9zb2Z0L3ZzY29kZS00ZCBncmFtbWFycy80ZC5jc29uIC4vc3ludGF4ZXMvNGQudG1MYW5ndWFnZS5qc29uIgogIH0sCiAgImNhdGVnb3JpZXMiOiBbCiAgICAiUHJvZ3JhbW1pbmcgTGFuZ3VhZ2VzIgogIF0sCiAgImNvbnRyaWJ1dGVzIjogewogICAgImxhbmd1YWdlcyI6IFsKICAgICAgewogICAgICAgICJpZCI6ICI0ZCIsCiAgICAgICAgImFsaWFzZXMiOiBbCiAgICAgICAgICAiNEQiLAogICAgICAgICAgIjRkIgogICAgICAgIF0sCiAgICAgICAgImV4dGVuc2lvbnMiOiBbCiAgICAgICAgICAiLjRkbSIsCiAgICAgICAgICAiLjRxcyIKICAgICAgICBdLAogICAgICAgICJjb25maWd1cmF0aW9uIjogIi4vbGFuZ3VhZ2UtY29uZmlndXJhdGlvbi5qc29uIgogICAgICB9CiAgICBdLAogICAgImdyYW1tYXJzIjogWwogICAgICB7CiAgICAgICAgImxhbmd1YWdlIjogIjRkIiwKICAgICAgICAic2NvcGVOYW1lIjogInNvdXJjZS40ZG0iLAogICAgICAgICJwYXRoIjogIi4vc3ludGF4ZXMvNGQudG1MYW5ndWFnZS5qc29uIgogICAgICB9CiAgICBdCiAgfSwKICAicmVwb3NpdG9yeSI6IHsKICAgICJ0eXBlIjogImdpdCIsCiAgICAidXJsIjogImh0dHBzOi8vZ2l0aHViLmNvbS9taWNyb3NvZnQvdnNjb2RlLmdpdCIKICB9Cn0K", import.meta.url).toString(),
  { mimeType: "application/json", size: 1006 }
);
q(
  "package.nls.json",
  new URL("data:application/json;base64,ewogICJkaXNwbGF5TmFtZSI6ICI0RCBMYW5ndWFnZSBCYXNpY3MiLAogICJkZXNjcmlwdGlvbiI6ICJQcm92aWRlcyBzeW50YXggaGlnaGxpZ2h0aW5nIGFuZCBicmFja2V0IG1hdGNoaW5nIGZvciA0RE0gYW5kIDRRUyBmaWxlcy4iCn0K", import.meta.url).toString(),
  { mimeType: "application/json", size: 135 }
);
export {
  Ln as Alerts,
  kn as CodeEditor,
  xn as CodeEditorProvider,
  Gt as FdLineNumbers,
  Rn as LSPProvider,
  ne as SUPPORTED_THEMES,
  ue as _await,
  It as configureServices,
  j as getFileSystemPath,
  Nn as getFunctionOffset,
  dt as initMonacoUserConfiguration,
  pt as jumpToLine,
  ft as jumpToSelection,
  wt as useCodeEditor,
  wn as useLSP
};
//# sourceMappingURL=index.es.js.map
