import { linter as y } from "@codemirror/lint";
import d from "../node_modules/.pnpm/@zenuml_core@3.43.3/node_modules/@zenuml/core/dist/zenuml.esm.js";
const x = new d(document.createElement("div"));
async function u(s) {
  const i = [], l = s.state.doc.toString(), t = await x.parse(l);
  if (t?.errorDetails && Array.isArray(t.errorDetails) && t.errorDetails.length > 0) {
    const a = t.errorDetails[0], f = t.errorDetails[t.errorDetails.length - 1], c = a.line - 1, g = a.column, m = f.line - 1, h = f.column, e = l.split(`
`);
    let n = 0;
    if (c >= 0 && c < e.length) {
      for (let r = 0; r < c; r++)
        n += e[r].length + 1;
      n += g;
    }
    let o = 0;
    if (m >= 0 && m < e.length) {
      for (let r = 0; r < m; r++)
        o += e[r].length + 1;
      o += h;
    }
    const D = Math.min(n, o), p = Math.max(n, o) + 1;
    i.push({
      from: D,
      to: p,
      severity: "error",
      message: a.msg || "Syntax error in zenuml diagram"
    });
  }
  return t && !t.pass && (!t.errorDetails || t.errorDetails.length === 0) && i.push({
    from: 0,
    to: l.length,
    severity: "error",
    message: "Syntax error in zenuml diagram"
  }), i;
}
const w = u, E = () => y(async (s) => await u(s));
export {
  w as checkZenuml,
  E as zenumlLinter
};
//# sourceMappingURL=zenuml-linter.js.map
