import { defineComponent as x, createElementBlock as o, openBlock as s, createElementVNode as e, createCommentVNode as f, createVNode as d, unref as l, toDisplayString as a, createBlock as g, Fragment as u, renderList as h, normalizeClass as v } from "vue";
import { ScalarIconXCircle as y, ScalarIconWarning as C, ScalarIconCaretDown as _, ScalarIconCaretRight as w } from "@scalar/icons";
import * as k from "monaco-editor/esm/vs/editor/editor.api.js";
const D = { class: "pointer-events-none absolute right-2 bottom-2 left-2 z-10" }, z = { class: "bg-b-1 shadow-border pointer-events-auto flex flex-col overflow-hidden rounded-lg text-[11px]" }, S = { class: "flex items-center gap-3" }, E = {
  class: "text-c-danger flex items-center gap-1",
  title: "Errors"
}, N = {
  class: "text-c-alert flex items-center gap-1",
  title: "Warnings"
}, $ = { class: "text-c-3" }, L = {
  key: 0,
  class: "max-h-28 overflow-auto border-t"
}, B = ["onClick"], I = { class: "min-w-0 flex-1" }, M = { class: "text-c-1 block truncate" }, V = { class: "text-c-3 block whitespace-nowrap" }, P = {
  key: 1,
  class: "text-c-3 border-t px-2.5 py-2"
}, F = /* @__PURE__ */ x({
  __name: "EditorDiagnosticsPanel",
  props: {
    expanded: { type: Boolean },
    diagnosticCounts: {},
    visibleDiagnostics: {}
  },
  emits: ["toggle", "focusDiagnostic"],
  setup(n, { emit: p }) {
    const c = p, m = (r) => r === k.MarkerSeverity.Error ? "bg-c-danger" : "bg-c-alert";
    return (r, i) => (s(), o("div", D, [
      e("div", z, [
        e("button", {
          class: "bg-b-2/30 hover:bg-b-2/50 flex items-center justify-between px-2.5 py-2 text-left",
          type: "button",
          onClick: i[0] || (i[0] = (t) => c("toggle"))
        }, [
          e("span", S, [
            i[1] || (i[1] = e("span", { class: "text-c-2 font-medium" }, "Problems", -1)),
            e("span", E, [
              d(l(y), { class: "size-3" }),
              e("span", null, a(n.diagnosticCounts.errors), 1)
            ]),
            e("span", N, [
              d(l(C), { class: "size-3" }),
              e("span", null, a(n.diagnosticCounts.warnings), 1)
            ])
          ]),
          e("span", $, [
            n.expanded ? (s(), g(l(_), {
              key: 0,
              class: "size-3"
            })) : (s(), g(l(w), {
              key: 1,
              class: "size-3"
            }))
          ])
        ]),
        n.expanded ? (s(), o(u, { key: 0 }, [
          n.visibleDiagnostics.length ? (s(), o("div", L, [
            (s(!0), o(u, null, h(n.visibleDiagnostics, (t, b) => (s(), o("button", {
              key: `${t.owner}-${t.startLineNumber}-${t.startColumn}-${b}`,
              class: "hover:bg-b-2/40 flex w-full items-start gap-2 px-2.5 py-2 text-left",
              type: "button",
              onClick: (W) => c("focusDiagnostic", t)
            }, [
              e("span", {
                class: v(["mt-0.5 size-1.5 shrink-0 rounded-full", m(t.severity)])
              }, null, 2),
              e("span", I, [
                e("span", M, a(t.message), 1),
                e("span", V, " Ln " + a(t.startLineNumber) + ", Col " + a(t.startColumn), 1)
              ])
            ], 8, B))), 128))
          ])) : (s(), o("div", P, " Errors and warnings from the JSON/YAML language workers will show up here. "))
        ], 64)) : f("", !0)
      ])
    ]));
  }
});
export {
  F as default
};
