import { unsafeCSS as f } from "lit";
import { FRoot as l, flowElement as u } from "@cldcvr/flow-core";
import * as p from "monaco-editor";
import { property as i } from "lit/decorators.js";
function h() {
  return new Worker("/assets/editor.worker-cc8927cd.js");
}
function g() {
  return new Worker("/assets/json.worker-e09ec1a1.js");
}
function v() {
  return new Worker("/assets/css.worker-1670a170.js");
}
function w() {
  return new Worker("/assets/html.worker-376b1d9b.js");
}
function k() {
  return new Worker("/assets/ts.worker-8830ed35.js");
}
const m = `f-code-editor{font-family:var(--flow-font);box-sizing:border-box;flex-shrink:0;scrollbar-color:var(--color-neutral-default) transparent;scrollbar-width:thin;display:block;min-height:100px;overflow:visible}f-code-editor::-webkit-scrollbar{width:6px;height:6px}f-code-editor::-webkit-scrollbar-track{-webkit-box-shadow:inset 0 0 2px transparent;background-color:transparent}f-code-editor::-webkit-scrollbar-thumb{background-color:var(--color-neutral-default)}f-code-editor [class^=codicon-],f-code-editor [class*=codicon-]{font-family:codicon,Arial,Helvetica,sans-serif!important}f-code-editor .monaco-editor{--vscode-editor-background: var(--color-surface-default);--vscode-editor-foreground: var(--color-text-default);--vscode-editorStickyScroll-background: var(--color-surface-default);--vscode-breadcrumb-background: var(--color-surface-default);--vscode-editorGutter-background: var(--color-surface-default);--vscode-editorMarkerNavigation-background: var(--color-surface-default);--vscode-editorSuggestWidget-foreground: var(--color-text-default)}f-code-editor .mtk1{color:var(--color-text-default)}
`;
var b = Object.defineProperty, y = Object.getOwnPropertyDescriptor, s = (t, e, n, a) => {
  for (var o = a > 1 ? void 0 : a ? y(e, n) : e, c = t.length - 1, d; c >= 0; c--)
    (d = t[c]) && (o = (a ? d(e, n, o) : d(o)) || o);
  return a && o && b(e, n, o), o;
};
let r = class extends l {
  constructor() {
    super(...arguments), this.height = "100%", this.width = "100%", this.settings = {}, this.services = {};
  }
  /**
   * monoco editor never works in shadow dom
   */
  createRenderRoot() {
    return this;
  }
  willUpdate(t) {
    super.willUpdate(t), this.editor && this.editor.dispose();
  }
  updated(t) {
    super.updated(t), this.style.height = this.height, this.style.width = this.width, this.editor = p.editor.create(
      this,
      {
        value: this.code,
        theme: "vs-dark",
        language: this.language,
        automaticLayout: !0,
        autoDetectHighContrast: !1,
        readOnly: !1,
        fontSize: 16,
        padding: {
          top: 16
        },
        minimap: { enabled: !1 },
        dimension: {
          width: this.offsetWidth,
          height: this.offsetHeight
        },
        ...this.settings
      },
      this.services
    );
  }
};
r.styles = [f(m)];
s([
  i({ type: String })
], r.prototype, "code", 2);
s([
  i({ reflect: !0, type: String })
], r.prototype, "language", 2);
s([
  i({ type: String })
], r.prototype, "height", 2);
s([
  i({ type: String })
], r.prototype, "width", 2);
s([
  i({ type: Object })
], r.prototype, "settings", 2);
s([
  i({ type: Object })
], r.prototype, "services", 2);
r = s([
  u("f-code-editor")
], r);
self.MonacoEnvironment = {
  getWorker(t, e) {
    return e === "json" ? new g() : e === "css" || e === "scss" || e === "less" ? new v() : e === "html" || e === "handlebars" || e === "razor" ? new w() : e === "typescript" || e === "javascript" ? new k() : new h();
  }
};
export {
  r as FCodeEditor
};
//# sourceMappingURL=flow-code-editor.es.js.map
