zombie-mermaid 2.2.6 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +336 -862
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -83
- package/dist/index.d.ts +10 -83
- package/dist/index.js +132 -238
- package/dist/index.js.map +1 -1
- package/package.json +16 -16
- package/src/__tests__/ascii-package-boundary.test.ts +9 -5
- package/src/__tests__/nested-subgraph-edge-container-offset.test.ts +151 -0
- package/src/__tests__/workspace-package-boundaries.test.ts +28 -6
- package/src/index.ts +12 -215
- package/src/diagram-registry.ts +0 -340
package/dist/cli.js
CHANGED
|
@@ -1,28 +1,26 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { createRequire as
|
|
3
|
-
import { extname as
|
|
4
|
-
import {
|
|
5
|
-
import { access as
|
|
6
|
-
import { diagramColorsToAsciiTheme as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var je = 3e3;
|
|
14
|
-
var ne = {
|
|
2
|
+
import { createRequire as U } from "node:module";
|
|
3
|
+
import { extname as V, format as H, parse as G } from "node:path";
|
|
4
|
+
import { THEMES as B, escapeXml as q, isDirection as j, isWideChar as K } from "@zombie-mermaid/core";
|
|
5
|
+
import { access as J, readFile as Z, writeFile as Q } from "node:fs/promises";
|
|
6
|
+
import { diagramColorsToAsciiTheme as ee, renderMermaidASCII as O } from "@zombie-mermaid/ascii-renderer";
|
|
7
|
+
import { renderMermaidSVG as z } from "@zombie-mermaid/svg-renderer";
|
|
8
|
+
import { createServer as te } from "node:http";
|
|
9
|
+
import { StdioServerTransport as ne } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
10
|
+
import { createMcpServer as re } from "@zombie-mermaid/mcp";
|
|
11
|
+
var oe = 3e3;
|
|
12
|
+
var W = {
|
|
15
13
|
".svg": "svg",
|
|
16
14
|
".txt": "ascii",
|
|
17
15
|
".html": "html",
|
|
18
16
|
".htm": "html",
|
|
19
17
|
".png": "png"
|
|
20
18
|
};
|
|
21
|
-
function
|
|
19
|
+
function ie(e) {
|
|
22
20
|
if (!(e === void 0 || e === "-"))
|
|
23
|
-
return
|
|
21
|
+
return W[V(e).toLowerCase()];
|
|
24
22
|
}
|
|
25
|
-
var
|
|
23
|
+
var v = {
|
|
26
24
|
svg: {
|
|
27
25
|
flag: "--svg",
|
|
28
26
|
ext: ".svg",
|
|
@@ -44,724 +42,200 @@ var C = {
|
|
|
44
42
|
display: "PNG",
|
|
45
43
|
label: "the PNG rasterization"
|
|
46
44
|
}
|
|
47
|
-
}, A = Object.keys(
|
|
48
|
-
function
|
|
49
|
-
const
|
|
50
|
-
return
|
|
51
|
-
dir:
|
|
52
|
-
name:
|
|
53
|
-
ext:
|
|
45
|
+
}, A = Object.keys(v);
|
|
46
|
+
function ae(e, n) {
|
|
47
|
+
const t = G(e);
|
|
48
|
+
return H({
|
|
49
|
+
dir: t.dir,
|
|
50
|
+
name: t.name,
|
|
51
|
+
ext: n
|
|
54
52
|
});
|
|
55
53
|
}
|
|
56
|
-
function
|
|
57
|
-
const [
|
|
58
|
-
if (
|
|
59
|
-
if (
|
|
60
|
-
if (
|
|
61
|
-
if (
|
|
62
|
-
if (
|
|
63
|
-
if (
|
|
64
|
-
if (
|
|
65
|
-
throw new Error(`Unknown command: ${
|
|
54
|
+
function se(e) {
|
|
55
|
+
const [n, ...t] = e;
|
|
56
|
+
if (n === void 0) return { command: "help" };
|
|
57
|
+
if (n === "--help" || n === "-h") return { command: "help" };
|
|
58
|
+
if (n === "--version" || n === "-v") return { command: "version" };
|
|
59
|
+
if (n === "themes") return { command: "themes" };
|
|
60
|
+
if (n === "render") return le(t);
|
|
61
|
+
if (n === "web") return me(t);
|
|
62
|
+
if (n === "mcp") return { command: "mcp" };
|
|
63
|
+
throw new Error(`Unknown command: ${n}`);
|
|
66
64
|
}
|
|
67
|
-
function
|
|
68
|
-
const r = e[
|
|
69
|
-
if (
|
|
70
|
-
if (!/^\d+$/.test(r)) throw new Error(`${
|
|
65
|
+
function P(e, n, t) {
|
|
66
|
+
const r = e[n + 1];
|
|
67
|
+
if (n + 1 >= e.length || r === void 0) throw new Error(`${t} requires a numeric value`);
|
|
68
|
+
if (!/^\d+$/.test(r)) throw new Error(`${t} requires a non-negative integer, got: "${r}"`);
|
|
71
69
|
return Number(r);
|
|
72
70
|
}
|
|
73
|
-
function
|
|
74
|
-
const r = e[
|
|
75
|
-
if (
|
|
71
|
+
function de(e, n, t) {
|
|
72
|
+
const r = e[n + 1];
|
|
73
|
+
if (n + 1 >= e.length || r === void 0) throw new Error(`${t} requires a value ("auto" or a positive integer)`);
|
|
76
74
|
if (r === "auto") return "auto";
|
|
77
|
-
const
|
|
78
|
-
if (!/^\d+$/.test(r) ||
|
|
79
|
-
return
|
|
75
|
+
const s = Number(r);
|
|
76
|
+
if (!/^\d+$/.test(r) || s === 0 || !Number.isSafeInteger(s)) throw new Error(`${t} requires "auto" or a positive integer, got: "${r}"`);
|
|
77
|
+
return s;
|
|
80
78
|
}
|
|
81
|
-
function
|
|
82
|
-
const r = e[
|
|
83
|
-
if (
|
|
84
|
-
const
|
|
85
|
-
if (!
|
|
86
|
-
return
|
|
79
|
+
function ce(e, n, t) {
|
|
80
|
+
const r = e[n + 1];
|
|
81
|
+
if (n + 1 >= e.length || r === void 0) throw new Error(`${t} requires a value (one of TD, TB, BT, LR, RL)`);
|
|
82
|
+
const s = r.toUpperCase();
|
|
83
|
+
if (!j(s)) throw new Error(`${t} requires one of TD, TB, BT, LR, RL, got: "${r}"`);
|
|
84
|
+
return s;
|
|
87
85
|
}
|
|
88
|
-
function
|
|
89
|
-
let
|
|
90
|
-
for (;
|
|
91
|
-
const
|
|
92
|
-
if (
|
|
93
|
-
if (
|
|
94
|
-
|
|
95
|
-
else if (
|
|
96
|
-
r = !0,
|
|
97
|
-
else if (
|
|
98
|
-
|
|
99
|
-
else if (
|
|
100
|
-
|
|
101
|
-
else if (
|
|
102
|
-
|
|
103
|
-
else if (
|
|
104
|
-
if (
|
|
105
|
-
|
|
106
|
-
} else if (
|
|
107
|
-
|
|
108
|
-
else if (
|
|
109
|
-
if (
|
|
110
|
-
|
|
111
|
-
} else if (
|
|
112
|
-
|
|
113
|
-
else if (
|
|
114
|
-
|
|
115
|
-
else if (
|
|
116
|
-
|
|
117
|
-
else if (
|
|
118
|
-
|
|
119
|
-
else if (
|
|
120
|
-
|
|
121
|
-
else if (
|
|
122
|
-
|
|
123
|
-
else if (
|
|
124
|
-
|
|
125
|
-
else if (!
|
|
126
|
-
if (
|
|
127
|
-
if (
|
|
128
|
-
|
|
129
|
-
} else throw new Error(`Unknown flag: ${
|
|
130
|
-
}
|
|
131
|
-
const
|
|
86
|
+
function le(e) {
|
|
87
|
+
let n, t = !1, r = !1, s = !1, m = !1, c = !1, d, E = !1, S, k, g, C, T = !1, b = !1, a, u, i = 0;
|
|
88
|
+
for (; i < e.length; ) {
|
|
89
|
+
const o = e[i];
|
|
90
|
+
if (o === void 0) throw new Error(`parseArgs: index ${i} out of range while parsing arguments`);
|
|
91
|
+
if (o === "--ascii")
|
|
92
|
+
t = !0, i++;
|
|
93
|
+
else if (o === "--svg")
|
|
94
|
+
r = !0, i++;
|
|
95
|
+
else if (o === "--resolve-colors")
|
|
96
|
+
s = !0, i++;
|
|
97
|
+
else if (o === "--html")
|
|
98
|
+
m = !0, i++;
|
|
99
|
+
else if (o === "--png")
|
|
100
|
+
c = !0, i++;
|
|
101
|
+
else if (o === "-o" || o === "--output") {
|
|
102
|
+
if (i + 1 >= e.length) throw new Error("-o requires a file path (or - for stdout)");
|
|
103
|
+
d = e[i + 1], i += 2;
|
|
104
|
+
} else if (o === "-f" || o === "--force")
|
|
105
|
+
E = !0, i++;
|
|
106
|
+
else if (o === "--theme") {
|
|
107
|
+
if (i + 1 >= e.length) throw new Error("--theme requires a theme name");
|
|
108
|
+
S = e[i + 1], i += 2;
|
|
109
|
+
} else if (o === "-x" || o === "--paddingX")
|
|
110
|
+
k = P(e, i, o), i += 2;
|
|
111
|
+
else if (o === "-y" || o === "--paddingY")
|
|
112
|
+
g = P(e, i, o), i += 2;
|
|
113
|
+
else if (o === "-p" || o === "--borderPadding")
|
|
114
|
+
C = P(e, i, o), i += 2;
|
|
115
|
+
else if (o === "--coords")
|
|
116
|
+
T = !0, i++;
|
|
117
|
+
else if (o === "--hyperlinks")
|
|
118
|
+
b = !0, i++;
|
|
119
|
+
else if (o === "-w" || o === "--max-width")
|
|
120
|
+
a = de(e, i, o), i += 2;
|
|
121
|
+
else if (o === "--direction")
|
|
122
|
+
u = ce(e, i, o), i += 2;
|
|
123
|
+
else if (!o.startsWith("-") || o === "-") {
|
|
124
|
+
if (o === "-") throw new Error("Unexpected argument: - (use -o - to write output to stdout; omit the input file to read stdin)");
|
|
125
|
+
if (n !== void 0) throw new Error(`Unexpected argument: ${o} (input file already set to "${n}")`);
|
|
126
|
+
n = o, i++;
|
|
127
|
+
} else throw new Error(`Unknown flag: ${o}`);
|
|
128
|
+
}
|
|
129
|
+
const h = {
|
|
132
130
|
svg: r,
|
|
133
|
-
html:
|
|
134
|
-
png:
|
|
135
|
-
},
|
|
136
|
-
if (
|
|
137
|
-
const [
|
|
138
|
-
throw new Error(`${
|
|
139
|
-
}
|
|
140
|
-
const
|
|
141
|
-
if (
|
|
142
|
-
const
|
|
143
|
-
if (
|
|
144
|
-
const
|
|
145
|
-
throw new Error(`-o ${
|
|
131
|
+
html: m,
|
|
132
|
+
png: c
|
|
133
|
+
}, w = A.filter((o) => h[o]);
|
|
134
|
+
if (w.length > 1) {
|
|
135
|
+
const [o, l] = w;
|
|
136
|
+
throw new Error(`${v[o].flag} and ${v[l].flag} cannot both be set — they would write different content to the same output path. Run the command twice with different -o paths for each.`);
|
|
137
|
+
}
|
|
138
|
+
const p = ie(d);
|
|
139
|
+
if (p !== void 0 && p !== "ascii") {
|
|
140
|
+
const o = A.find((l) => l !== p && h[l]);
|
|
141
|
+
if (o !== void 0) {
|
|
142
|
+
const l = v[p], x = v[o];
|
|
143
|
+
throw new Error(`-o ${d} has ${l.article} ${l.ext} extension, but ${x.flag} output would be written to it. Use a ${x.ext} path (or -o - for stdout) for ${x.label}.`);
|
|
146
144
|
}
|
|
147
|
-
|
|
148
|
-
} else if (
|
|
149
|
-
const
|
|
150
|
-
if (
|
|
151
|
-
const
|
|
152
|
-
throw new Error(`-o ${
|
|
145
|
+
p === "svg" ? r = !0 : p === "html" ? m = !0 : c = !0;
|
|
146
|
+
} else if (p === "ascii") {
|
|
147
|
+
const o = A.find((l) => h[l]);
|
|
148
|
+
if (o !== void 0) {
|
|
149
|
+
const l = v[o];
|
|
150
|
+
throw new Error(`-o ${d} has a .txt extension, but ${l.flag} output would be written to it. Use a ${l.ext} path (or -o - for stdout) instead.`);
|
|
153
151
|
}
|
|
154
|
-
|
|
152
|
+
t = !0;
|
|
155
153
|
}
|
|
156
|
-
if (!
|
|
157
|
-
if (
|
|
158
|
-
const
|
|
159
|
-
throw new Error(`Cannot infer an output format from "${
|
|
154
|
+
if (!t && !r && !m && !c) {
|
|
155
|
+
if (d !== void 0 && d !== "-") {
|
|
156
|
+
const o = Object.keys(W).join(", ");
|
|
157
|
+
throw new Error(`Cannot infer an output format from "${d}" — pass --ascii, --svg, --html, or --png, or use a recognised extension (${o})`);
|
|
160
158
|
}
|
|
161
159
|
throw new Error("Specify --ascii, --svg, --html, and/or --png (or -o <path> with a .svg/.txt/.html/.png extension)");
|
|
162
160
|
}
|
|
163
|
-
const
|
|
161
|
+
const y = {
|
|
164
162
|
svg: r,
|
|
165
|
-
html:
|
|
166
|
-
png:
|
|
167
|
-
},
|
|
168
|
-
if (
|
|
169
|
-
const
|
|
170
|
-
throw new Error(`-o - would send both ASCII and ${
|
|
171
|
-
}
|
|
172
|
-
if (
|
|
173
|
-
const { flag:
|
|
174
|
-
if (
|
|
175
|
-
|
|
176
|
-
}
|
|
177
|
-
if (
|
|
178
|
-
if (
|
|
179
|
-
if (
|
|
163
|
+
html: m,
|
|
164
|
+
png: c
|
|
165
|
+
}, f = A.find((o) => y[o]);
|
|
166
|
+
if (d === "-" && t && f !== void 0) {
|
|
167
|
+
const o = v[f].display;
|
|
168
|
+
throw new Error(`-o - would send both ASCII and ${o} to stdout; drop --ascii, or write the ${o} to a file path`);
|
|
169
|
+
}
|
|
170
|
+
if (f !== void 0 && d === void 0) {
|
|
171
|
+
const { flag: o, ext: l } = v[f];
|
|
172
|
+
if (n === void 0) throw new Error(`${o} needs -o <path> (or -o - for stdout) when reading from stdin — there is no input file name to derive an output name from`);
|
|
173
|
+
d = ae(n, l);
|
|
174
|
+
}
|
|
175
|
+
if (a !== void 0 && !t) throw new Error("-w/--max-width requires --ascii");
|
|
176
|
+
if (b && !t) throw new Error("--hyperlinks requires --ascii");
|
|
177
|
+
if (s && !r) throw new Error("--resolve-colors requires --svg");
|
|
180
178
|
return {
|
|
181
179
|
command: "render",
|
|
182
|
-
input:
|
|
183
|
-
ascii:
|
|
180
|
+
input: n,
|
|
181
|
+
ascii: t,
|
|
184
182
|
svg: r,
|
|
185
|
-
resolveColors:
|
|
186
|
-
html:
|
|
187
|
-
png:
|
|
188
|
-
output:
|
|
189
|
-
force:
|
|
190
|
-
theme:
|
|
191
|
-
paddingX:
|
|
192
|
-
paddingY:
|
|
193
|
-
borderPadding:
|
|
194
|
-
coords:
|
|
195
|
-
hyperlinks:
|
|
196
|
-
maxWidth:
|
|
197
|
-
direction:
|
|
183
|
+
resolveColors: s,
|
|
184
|
+
html: m,
|
|
185
|
+
png: c,
|
|
186
|
+
output: d,
|
|
187
|
+
force: E,
|
|
188
|
+
theme: S,
|
|
189
|
+
paddingX: k,
|
|
190
|
+
paddingY: g,
|
|
191
|
+
borderPadding: C,
|
|
192
|
+
coords: T,
|
|
193
|
+
hyperlinks: b,
|
|
194
|
+
maxWidth: a,
|
|
195
|
+
direction: u
|
|
198
196
|
};
|
|
199
197
|
}
|
|
200
|
-
function
|
|
201
|
-
let
|
|
202
|
-
for (;
|
|
203
|
-
const r = e[
|
|
204
|
-
if (r === void 0) throw new Error(`parseArgs: index ${
|
|
198
|
+
function me(e) {
|
|
199
|
+
let n = oe, t = 0;
|
|
200
|
+
for (; t < e.length; ) {
|
|
201
|
+
const r = e[t];
|
|
202
|
+
if (r === void 0) throw new Error(`parseArgs: index ${t} out of range while parsing arguments`);
|
|
205
203
|
if (r === "--port")
|
|
206
|
-
|
|
204
|
+
n = P(e, t, r), t += 2;
|
|
207
205
|
else throw new Error(`Unknown flag: ${r}`);
|
|
208
206
|
}
|
|
209
207
|
return {
|
|
210
208
|
command: "web",
|
|
211
|
-
port:
|
|
209
|
+
port: n
|
|
212
210
|
};
|
|
213
211
|
}
|
|
214
|
-
var
|
|
215
|
-
function
|
|
216
|
-
return
|
|
212
|
+
var ue = /\p{Mn}|\p{Me}/u;
|
|
213
|
+
function pe(e) {
|
|
214
|
+
return ue.test(e);
|
|
217
215
|
}
|
|
218
|
-
var
|
|
219
|
-
function
|
|
220
|
-
const
|
|
221
|
-
for (const { segment:
|
|
222
|
-
return
|
|
216
|
+
var he = new Intl.Segmenter(void 0, { granularity: "grapheme" }), fe = "️";
|
|
217
|
+
function ge(e) {
|
|
218
|
+
const n = [];
|
|
219
|
+
for (const { segment: t } of he.segment(e)) n.push(t);
|
|
220
|
+
return n;
|
|
223
221
|
}
|
|
224
|
-
function
|
|
225
|
-
if (e.includes(
|
|
226
|
-
let
|
|
222
|
+
function ve(e) {
|
|
223
|
+
if (e.includes(fe)) return 2;
|
|
224
|
+
let n = !1, t = !1;
|
|
227
225
|
for (const r of e)
|
|
228
|
-
|
|
229
|
-
return
|
|
230
|
-
}
|
|
231
|
-
function lt(e) {
|
|
232
|
-
let t = 0;
|
|
233
|
-
for (const n of st(e)) t += ct(n);
|
|
234
|
-
return t;
|
|
235
|
-
}
|
|
236
|
-
var dt = /\x1b\]8;[^\x07\x1b]*(?:\x1b\\|\x07)/g;
|
|
237
|
-
function ut(e) {
|
|
238
|
-
return e.replace(dt, "");
|
|
239
|
-
}
|
|
240
|
-
function Y(e) {
|
|
241
|
-
const t = e.trim();
|
|
242
|
-
return t.length >= 2 && (t[0] === '"' && t[t.length - 1] === '"' || t[0] === "'" && t[t.length - 1] === "'") ? t.slice(1, -1) : t;
|
|
243
|
-
}
|
|
244
|
-
var mt = '"graph <dir>"/"flowchart <dir>" (dir: TD, TB, LR, BT, RL), "stateDiagram-v2", "sequenceDiagram", "classDiagram", "erDiagram", "xychart-beta"';
|
|
245
|
-
function ht(e) {
|
|
246
|
-
const t = e.trim().toLowerCase();
|
|
247
|
-
if (/^sequence/.test(t)) return "sequenceDiagram";
|
|
248
|
-
if (/^class/.test(t)) return "classDiagram";
|
|
249
|
-
if (/^er/.test(t)) return "erDiagram";
|
|
250
|
-
if (/^xychart/.test(t)) return "xychart-beta";
|
|
251
|
-
if (/^state/.test(t)) return "stateDiagram-v2";
|
|
252
|
-
}
|
|
253
|
-
var ft = /^(?:[\w-]+@)?<?(?:-{2,}|={2,}|-\.+-?|~{3,})/;
|
|
254
|
-
function pt(e) {
|
|
255
|
-
const t = [];
|
|
256
|
-
for (const n of e) n.forEach((r, o) => {
|
|
257
|
-
if (o === 0 && t.length > 0 && ft.test(r.text)) {
|
|
258
|
-
const l = t[t.length - 1];
|
|
259
|
-
t[t.length - 1] = {
|
|
260
|
-
text: `${l.text} ${r.text}`,
|
|
261
|
-
line: l.line
|
|
262
|
-
};
|
|
263
|
-
} else t.push(r);
|
|
264
|
-
});
|
|
265
|
-
return t;
|
|
266
|
-
}
|
|
267
|
-
function gt(e) {
|
|
268
|
-
const t = fe(e.split(`
|
|
269
|
-
`).map((l) => l.trim())), n = pt(ye(e));
|
|
270
|
-
if (n.length === 0) throw new Error("Empty mermaid diagram");
|
|
271
|
-
const r = n[0], o = /^stateDiagram(-v2)?\s*$/i.test(r.text) ? wt(n) : vt(n);
|
|
272
|
-
return o.initConfig = t, o;
|
|
273
|
-
}
|
|
274
|
-
function vt(e) {
|
|
275
|
-
const t = e[0];
|
|
276
|
-
if (t === void 0)
|
|
277
|
-
throw new Error("parseFlowchart called with no lines");
|
|
278
|
-
const n = t.text, r = n.match(/^(?:graph|flowchart)\s+(TD|TB|LR|BT|RL)\s*$/i);
|
|
279
|
-
if (!r) {
|
|
280
|
-
const u = n.match(/^(?:graph|flowchart)\b\s*(.*)$/i);
|
|
281
|
-
if (u) {
|
|
282
|
-
const h = u[1].trim();
|
|
283
|
-
throw new Error(h.length > 0 ? `Line ${t.line}: Invalid direction "${h}" in header "${n}". Expected one of: TD, TB, LR, BT, RL.` : `Line ${t.line}: Missing direction in header "${n}". Expected e.g. "graph TD" or "flowchart LR" — one of: TD, TB, LR, BT, RL.`);
|
|
284
|
-
}
|
|
285
|
-
const a = ht(n), v = a && a.toLowerCase() !== n.trim().toLowerCase() ? ` Did you mean "${a}"?` : "";
|
|
286
|
-
throw new Error(`Line ${t.line}: Invalid mermaid header: "${n}".${v} Supported headers: ${mt}.`);
|
|
287
|
-
}
|
|
288
|
-
const o = {
|
|
289
|
-
direction: B(r[1]),
|
|
290
|
-
nodes: /* @__PURE__ */ new Map(),
|
|
291
|
-
edges: [],
|
|
292
|
-
subgraphs: [],
|
|
293
|
-
classDefs: /* @__PURE__ */ new Map(),
|
|
294
|
-
classAssignments: /* @__PURE__ */ new Map(),
|
|
295
|
-
nodeStyles: /* @__PURE__ */ new Map(),
|
|
296
|
-
linkStyles: /* @__PURE__ */ new Map(),
|
|
297
|
-
interactions: /* @__PURE__ */ new Map()
|
|
298
|
-
}, l = [];
|
|
299
|
-
for (let u = 1; u < e.length; u++) {
|
|
300
|
-
const a = e[u].text;
|
|
301
|
-
if (Ee(a, o) || Se(a, o) || xe(a, o)) continue;
|
|
302
|
-
if (/^click\s+/i.test(a)) {
|
|
303
|
-
Tt(a, o);
|
|
304
|
-
continue;
|
|
305
|
-
}
|
|
306
|
-
if (re(a, o)) continue;
|
|
307
|
-
const v = a.match(/^linkStyle\s+(default|[\d,\s]+)\s+(.+)$/);
|
|
308
|
-
if (v) {
|
|
309
|
-
const m = v[1].trim(), g = Z(v[2]);
|
|
310
|
-
if (m === "default") o.linkStyles.set("default", {
|
|
311
|
-
...o.linkStyles.get("default"),
|
|
312
|
-
...g
|
|
313
|
-
});
|
|
314
|
-
else {
|
|
315
|
-
const w = m.split(",").map((d) => parseInt(d.trim(), 10));
|
|
316
|
-
for (const d of w) isNaN(d) || o.linkStyles.set(d, {
|
|
317
|
-
...o.linkStyles.get(d),
|
|
318
|
-
...g
|
|
319
|
-
});
|
|
320
|
-
}
|
|
321
|
-
continue;
|
|
322
|
-
}
|
|
323
|
-
const h = a.match(/^direction\s+(TD|TB|LR|BT|RL)\s*$/i);
|
|
324
|
-
if (h && l.length > 0) {
|
|
325
|
-
l[l.length - 1].direction = B(h[1]);
|
|
326
|
-
continue;
|
|
327
|
-
}
|
|
328
|
-
const p = a.match(/^subgraph\s+(.+)$/);
|
|
329
|
-
if (p) {
|
|
330
|
-
const m = p[1].trim(), g = m.match(/^([^\s[]+)\s*\[(.+)\]$/);
|
|
331
|
-
let w, d;
|
|
332
|
-
g ? (w = g[1], d = k(Y(g[2]))) : (d = k(Y(m)), w = d.replace(/\s+/g, "_").replace(/[^\p{L}\p{N}_-]/gu, ""));
|
|
333
|
-
const c = {
|
|
334
|
-
id: w,
|
|
335
|
-
label: d,
|
|
336
|
-
nodeIds: [],
|
|
337
|
-
children: []
|
|
338
|
-
};
|
|
339
|
-
l.push(c);
|
|
340
|
-
continue;
|
|
341
|
-
}
|
|
342
|
-
if (a === "end") {
|
|
343
|
-
const m = l.pop();
|
|
344
|
-
m && (l.length > 0 ? l[l.length - 1].children.push(m) : o.subgraphs.push(m));
|
|
345
|
-
continue;
|
|
346
|
-
}
|
|
347
|
-
$t(a, o, l);
|
|
348
|
-
}
|
|
349
|
-
return o;
|
|
226
|
+
K(r) && (n = !0), pe(r) || (t = !0);
|
|
227
|
+
return n ? 2 : t ? 1 : 0;
|
|
350
228
|
}
|
|
351
|
-
function
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
edges: [],
|
|
356
|
-
subgraphs: [],
|
|
357
|
-
classDefs: /* @__PURE__ */ new Map(),
|
|
358
|
-
classAssignments: /* @__PURE__ */ new Map(),
|
|
359
|
-
nodeStyles: /* @__PURE__ */ new Map(),
|
|
360
|
-
linkStyles: /* @__PURE__ */ new Map(),
|
|
361
|
-
interactions: /* @__PURE__ */ new Map()
|
|
362
|
-
}, n = [], r = /* @__PURE__ */ new Set();
|
|
363
|
-
let o = 0, l = 0;
|
|
364
|
-
for (let u = 1; u < e.length; u++) {
|
|
365
|
-
const a = e[u].text, v = a.match(/^direction\s+(TD|TB|LR|BT|RL)\s*$/i);
|
|
366
|
-
if (v) {
|
|
367
|
-
n.length > 0 ? n[n.length - 1].direction = B(v[1]) : t.direction = B(v[1]);
|
|
368
|
-
continue;
|
|
369
|
-
}
|
|
370
|
-
const h = a.match(/^linkStyle\s+(default|[\d,\s]+)\s+(.+)$/);
|
|
371
|
-
if (h) {
|
|
372
|
-
const d = h[1].trim(), c = Z(h[2]);
|
|
373
|
-
if (d === "default") t.linkStyles.set("default", {
|
|
374
|
-
...t.linkStyles.get("default"),
|
|
375
|
-
...c
|
|
376
|
-
});
|
|
377
|
-
else {
|
|
378
|
-
const f = d.split(",").map((s) => parseInt(s.trim(), 10));
|
|
379
|
-
for (const s of f) isNaN(s) || t.linkStyles.set(s, {
|
|
380
|
-
...t.linkStyles.get(s),
|
|
381
|
-
...c
|
|
382
|
-
});
|
|
383
|
-
}
|
|
384
|
-
continue;
|
|
385
|
-
}
|
|
386
|
-
if (re(a, t)) continue;
|
|
387
|
-
const p = a.match(/^state\s+(?:"([^"]+)"\s+as\s+)?([\w\p{L}]+)\s*\{$/u);
|
|
388
|
-
if (p) {
|
|
389
|
-
const d = p[1] ?? p[2], c = p[2], f = {
|
|
390
|
-
id: c,
|
|
391
|
-
label: d,
|
|
392
|
-
nodeIds: [],
|
|
393
|
-
children: []
|
|
394
|
-
};
|
|
395
|
-
n.push(f), r.add(c), t.nodes.delete(c);
|
|
396
|
-
continue;
|
|
397
|
-
}
|
|
398
|
-
if (a === "}") {
|
|
399
|
-
const d = n.pop();
|
|
400
|
-
d && (n.length > 0 ? n[n.length - 1].children.push(d) : t.subgraphs.push(d));
|
|
401
|
-
continue;
|
|
402
|
-
}
|
|
403
|
-
const m = a.match(/^state\s+"([^"]+)"\s+as\s+([\w\p{L}]+)\s*$/u);
|
|
404
|
-
if (m) {
|
|
405
|
-
const d = k(m[1]), c = m[2];
|
|
406
|
-
L(t, n, {
|
|
407
|
-
id: c,
|
|
408
|
-
label: d,
|
|
409
|
-
shape: "rounded"
|
|
410
|
-
});
|
|
411
|
-
continue;
|
|
412
|
-
}
|
|
413
|
-
const g = a.match(/^(\[\*\]|[\w\p{L}-]+)\s*(?:([\w-]+)@)?-->\s*(\[\*\]|[\w\p{L}-]+)(?:\s*:\s*(.+))?$/u);
|
|
414
|
-
if (g) {
|
|
415
|
-
let d = g[1];
|
|
416
|
-
const c = g[2];
|
|
417
|
-
let f = g[3];
|
|
418
|
-
const s = g[4]?.trim(), y = s ? k(s) : void 0;
|
|
419
|
-
d === "[*]" ? (o++, d = `_start${o > 1 ? o : ""}`, L(t, n, {
|
|
420
|
-
id: d,
|
|
421
|
-
label: "",
|
|
422
|
-
shape: "state-start"
|
|
423
|
-
})) : r.has(d) || q(t, n, d), f === "[*]" ? (l++, f = `_end${l > 1 ? l : ""}`, L(t, n, {
|
|
424
|
-
id: f,
|
|
425
|
-
label: "",
|
|
426
|
-
shape: "state-end"
|
|
427
|
-
})) : r.has(f) || q(t, n, f), t.edges.push({
|
|
428
|
-
source: d,
|
|
429
|
-
target: f,
|
|
430
|
-
label: y,
|
|
431
|
-
style: "solid",
|
|
432
|
-
hasArrowStart: !1,
|
|
433
|
-
hasArrowEnd: !0,
|
|
434
|
-
...c !== void 0 ? { id: c } : {}
|
|
435
|
-
});
|
|
436
|
-
continue;
|
|
437
|
-
}
|
|
438
|
-
const w = a.match(/^([\w\p{L}-]+)\s*:\s*(.+)$/u);
|
|
439
|
-
if (w) {
|
|
440
|
-
const d = w[1];
|
|
441
|
-
L(t, n, {
|
|
442
|
-
id: d,
|
|
443
|
-
label: k(w[2].trim()),
|
|
444
|
-
shape: "rounded"
|
|
445
|
-
});
|
|
446
|
-
continue;
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
return t;
|
|
450
|
-
}
|
|
451
|
-
function L(e, t, n) {
|
|
452
|
-
if (e.nodes.has(n.id) || e.nodes.set(n.id, n), t.length > 0) {
|
|
453
|
-
const r = t[t.length - 1];
|
|
454
|
-
r.nodeIds.includes(n.id) || r.nodeIds.push(n.id);
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
function q(e, t, n) {
|
|
458
|
-
if (!e.nodes.has(n)) L(e, t, {
|
|
459
|
-
id: n,
|
|
460
|
-
label: n,
|
|
461
|
-
shape: "rounded"
|
|
462
|
-
});
|
|
463
|
-
else if (t.length > 0) {
|
|
464
|
-
const r = t[t.length - 1];
|
|
465
|
-
r.nodeIds.includes(n) || r.nodeIds.push(n);
|
|
466
|
-
}
|
|
229
|
+
function we(e) {
|
|
230
|
+
let n = 0;
|
|
231
|
+
for (const t of ge(e)) n += ve(t);
|
|
232
|
+
return n;
|
|
467
233
|
}
|
|
468
|
-
var
|
|
469
|
-
function
|
|
470
|
-
|
|
471
|
-
if (e === "x") return "cross";
|
|
234
|
+
var be = /\x1b\]8;[^\x07\x1b]*(?:\x1b\\|\x07)/g;
|
|
235
|
+
function ye(e) {
|
|
236
|
+
return e.replace(be, "");
|
|
472
237
|
}
|
|
473
|
-
var
|
|
474
|
-
{
|
|
475
|
-
regex: /^([\w\p{L}-]+)\(\(\(((?:"[^"]*"|(?!\)\)\)).)+)\)\)\)/u,
|
|
476
|
-
shape: "doublecircle"
|
|
477
|
-
},
|
|
478
|
-
{
|
|
479
|
-
regex: /^([\w\p{L}-]+)\(\[((?:"[^"]*"|(?!\]\)).)+)\]\)/u,
|
|
480
|
-
shape: "stadium"
|
|
481
|
-
},
|
|
482
|
-
{
|
|
483
|
-
regex: /^([\w\p{L}-]+)\(\(((?:"[^"]*"|(?!\)\)).)+)\)\)/u,
|
|
484
|
-
shape: "circle"
|
|
485
|
-
},
|
|
486
|
-
{
|
|
487
|
-
regex: /^([\w\p{L}-]+)\[\[((?:"[^"]*"|(?!\]\]).)+)\]\]/u,
|
|
488
|
-
shape: "subroutine"
|
|
489
|
-
},
|
|
490
|
-
{
|
|
491
|
-
regex: /^([\w\p{L}-]+)\[\(((?:"[^"]*"|(?!\)\]).)+)\)\]/u,
|
|
492
|
-
shape: "cylinder"
|
|
493
|
-
},
|
|
494
|
-
{
|
|
495
|
-
regex: /^([\w\p{L}-]+)\[\/((?:"[^"]*"|(?![\\/]\]).)+)([\\/])\]/u,
|
|
496
|
-
shape: (e) => e === "\\" ? "trapezoid" : "parallelogram"
|
|
497
|
-
},
|
|
498
|
-
{
|
|
499
|
-
regex: /^([\w\p{L}-]+)\[\\((?:"[^"]*"|(?![\\/]\]).)+)([\\/])\]/u,
|
|
500
|
-
shape: (e) => e === "/" ? "trapezoid-alt" : "parallelogram-alt"
|
|
501
|
-
},
|
|
502
|
-
{
|
|
503
|
-
regex: /^([\w\p{L}-]+)>((?:"[^"]*"|(?!\]).)+)\]/u,
|
|
504
|
-
shape: "asymmetric"
|
|
505
|
-
},
|
|
506
|
-
{
|
|
507
|
-
regex: /^([\w\p{L}-]+)\{\{((?:"[^"]*"|(?!\}\}).)+)\}\}/u,
|
|
508
|
-
shape: "hexagon"
|
|
509
|
-
},
|
|
510
|
-
{
|
|
511
|
-
regex: /^([\w\p{L}-]+)\[((?:"[^"]*"|(?!\]).)+)\]/u,
|
|
512
|
-
shape: "rectangle"
|
|
513
|
-
},
|
|
514
|
-
{
|
|
515
|
-
regex: /^([\w\p{L}-]+)\(((?:"[^"]*"|(?!\)).)+)\)/u,
|
|
516
|
-
shape: "rounded"
|
|
517
|
-
},
|
|
518
|
-
{
|
|
519
|
-
regex: /^([\w\p{L}-]+)\{((?:"[^"]*"|(?!\}).)+)\}/u,
|
|
520
|
-
shape: "diamond"
|
|
521
|
-
}
|
|
522
|
-
], xt = /^([\w\p{L}]+(?:-[\w\p{L}]+)*)/u, kt = /^([\w\p{L}-]+)(?=@\{)/u;
|
|
523
|
-
function Mt(e) {
|
|
524
|
-
if (e.shape) return $e(e.shape) ?? "rectangle";
|
|
525
|
-
if (e.icon !== void 0 || e.img !== void 0) switch (e.form?.toLowerCase()) {
|
|
526
|
-
case "circle":
|
|
527
|
-
return "circle";
|
|
528
|
-
case "rounded":
|
|
529
|
-
return "rounded";
|
|
530
|
-
default:
|
|
531
|
-
return "rectangle";
|
|
532
|
-
}
|
|
533
|
-
return "rectangle";
|
|
534
|
-
}
|
|
535
|
-
function Ct(e, t) {
|
|
536
|
-
return t.label !== void 0 && t.label.length > 0 ? t.label : t.icon ? t.icon : t.img ? t.img : e;
|
|
537
|
-
}
|
|
538
|
-
function Tt(e, t) {
|
|
539
|
-
ue(e, t.interactions);
|
|
540
|
-
}
|
|
541
|
-
var Lt = /^([\w-]+)(?=@\{)/;
|
|
542
|
-
function re(e, t) {
|
|
543
|
-
const n = e.match(Lt);
|
|
544
|
-
if (!n || !t.edges.some((o) => o.id === n[1])) return !1;
|
|
545
|
-
const r = ee(e.slice(n[1].length));
|
|
546
|
-
return r ? (At(t, n[1], te(r.body)), !0) : !1;
|
|
547
|
-
}
|
|
548
|
-
function At(e, t, n) {
|
|
549
|
-
for (const r of e.edges)
|
|
550
|
-
r.id === t && (n.animate !== void 0 && (r.animate = n.animate.toLowerCase() !== "false"), n.animation !== void 0 && (r.animate = !0));
|
|
551
|
-
}
|
|
552
|
-
var It = /^:::([\w][\w-]*)/, Rt = /^([\w\p{L}-]+):::([\w][\w-]*)/u;
|
|
553
|
-
function $t(e, t, n) {
|
|
554
|
-
let r = e.trim();
|
|
555
|
-
const o = H(r, t, n);
|
|
556
|
-
if (!o || o.ids.length === 0) return;
|
|
557
|
-
r = o.remaining.trim();
|
|
558
|
-
let l = o.ids;
|
|
559
|
-
for (; r.length > 0; ) {
|
|
560
|
-
let u, a, v, h, p, m, g;
|
|
561
|
-
const w = r.match(/^([\w-]+)@(?=[-=<~ox])/);
|
|
562
|
-
w && (g = w[1], r = r.slice(w[0].length));
|
|
563
|
-
const d = r.match(bt), c = d?.[2], f = d?.[1], s = d?.[3];
|
|
564
|
-
if (d && c !== void 0 && !(f === void 0 && s === void 0 && yt.has(c))) {
|
|
565
|
-
u = f !== void 0, p = I(f);
|
|
566
|
-
const b = d[4]?.trim();
|
|
567
|
-
h = b ? k(b) : void 0, r = r.slice(d[0].length).trim(), a = Dt(c), v = s !== void 0, m = I(s);
|
|
568
|
-
} else {
|
|
569
|
-
const b = r.match(St);
|
|
570
|
-
if (!b) break;
|
|
571
|
-
u = !!b[1], p = I(b[1]);
|
|
572
|
-
const S = b[3].trim();
|
|
573
|
-
h = S ? k(S) : void 0;
|
|
574
|
-
const M = b[2], x = b[4];
|
|
575
|
-
r = r.slice(b[0].length).trim(), a = Bt(M, x), m = I(x.slice(-1)), v = x.endsWith(">") || m !== void 0;
|
|
576
|
-
}
|
|
577
|
-
const y = H(r, t, n);
|
|
578
|
-
if (!y || y.ids.length === 0) break;
|
|
579
|
-
r = y.remaining.trim();
|
|
580
|
-
for (const b of l) for (const S of y.ids) t.edges.push({
|
|
581
|
-
source: b,
|
|
582
|
-
target: S,
|
|
583
|
-
label: h,
|
|
584
|
-
style: a,
|
|
585
|
-
hasArrowStart: u,
|
|
586
|
-
hasArrowEnd: v,
|
|
587
|
-
...p !== void 0 ? { startMarker: p } : {},
|
|
588
|
-
...m !== void 0 ? { endMarker: m } : {},
|
|
589
|
-
...g !== void 0 ? { id: g } : {}
|
|
590
|
-
});
|
|
591
|
-
l = y.ids;
|
|
592
|
-
}
|
|
593
|
-
}
|
|
594
|
-
function H(e, t, n) {
|
|
595
|
-
const r = V(e, t, n);
|
|
596
|
-
if (!r) return null;
|
|
597
|
-
const o = [r.id];
|
|
598
|
-
let l = r.remaining.trim();
|
|
599
|
-
for (; l.startsWith("&"); ) {
|
|
600
|
-
l = l.slice(1).trim();
|
|
601
|
-
const u = V(l, t, n);
|
|
602
|
-
if (!u) break;
|
|
603
|
-
o.push(u.id), l = u.remaining.trim();
|
|
604
|
-
}
|
|
605
|
-
return {
|
|
606
|
-
ids: o,
|
|
607
|
-
remaining: l
|
|
608
|
-
};
|
|
609
|
-
}
|
|
610
|
-
function V(e, t, n) {
|
|
611
|
-
let r = null, o = e, l;
|
|
612
|
-
const u = o.match(Rt);
|
|
613
|
-
u && (l = u[2], o = u[1] + o.slice(u[0].length));
|
|
614
|
-
const a = o.match(kt);
|
|
615
|
-
if (a) {
|
|
616
|
-
const h = a[1], p = ee(o.slice(h.length));
|
|
617
|
-
if (p) {
|
|
618
|
-
const m = te(p.body);
|
|
619
|
-
P(t, n, {
|
|
620
|
-
id: h,
|
|
621
|
-
label: k(Ct(h, m)),
|
|
622
|
-
shape: Mt(m)
|
|
623
|
-
}), r = h, o = o.slice(h.length + p.length);
|
|
624
|
-
}
|
|
625
|
-
}
|
|
626
|
-
if (r === null) for (const { regex: h, shape: p } of Et) {
|
|
627
|
-
const m = o.match(h);
|
|
628
|
-
if (m) {
|
|
629
|
-
r = m[1];
|
|
630
|
-
const g = k(m[2]), w = typeof p == "function" ? p(m[3] ?? "") : p;
|
|
631
|
-
P(t, n, {
|
|
632
|
-
id: r,
|
|
633
|
-
label: g,
|
|
634
|
-
shape: w
|
|
635
|
-
}), o = o.slice(m[0].length);
|
|
636
|
-
break;
|
|
637
|
-
}
|
|
638
|
-
}
|
|
639
|
-
if (r === null) {
|
|
640
|
-
const h = o.match(xt);
|
|
641
|
-
h && (r = h[1], t.nodes.has(r) || P(t, n, {
|
|
642
|
-
id: r,
|
|
643
|
-
label: r,
|
|
644
|
-
shape: "rectangle"
|
|
645
|
-
}), o = o.slice(h[0].length));
|
|
646
|
-
}
|
|
647
|
-
if (r === null) return null;
|
|
648
|
-
l && t.classAssignments.set(r, l);
|
|
649
|
-
const v = o.match(It);
|
|
650
|
-
return v && (t.classAssignments.set(r, v[1]), o = o.slice(v[0].length)), {
|
|
651
|
-
id: r,
|
|
652
|
-
remaining: o
|
|
653
|
-
};
|
|
654
|
-
}
|
|
655
|
-
function P(e, t, n) {
|
|
656
|
-
e.nodes.has(n.id) || e.nodes.set(n.id, n), zt(t, n.id);
|
|
657
|
-
}
|
|
658
|
-
function zt(e, t) {
|
|
659
|
-
if (e.length > 0) {
|
|
660
|
-
const n = e[e.length - 1];
|
|
661
|
-
n.nodeIds.includes(t) || n.nodeIds.push(t);
|
|
662
|
-
}
|
|
663
|
-
}
|
|
664
|
-
function Dt(e) {
|
|
665
|
-
return e.startsWith("~") ? "invisible" : e.includes(".") ? "dotted" : e.startsWith("=") ? "thick" : "solid";
|
|
666
|
-
}
|
|
667
|
-
function Bt(e, t) {
|
|
668
|
-
return e.includes(".") || t.includes(".") ? "dotted" : e.startsWith("=") || t.startsWith("=") ? "thick" : "solid";
|
|
669
|
-
}
|
|
670
|
-
var Pt = {
|
|
671
|
-
type: "xychart",
|
|
672
|
-
parse: Re,
|
|
673
|
-
layoutForSvg: _e,
|
|
674
|
-
renderSvg(e, t, n) {
|
|
675
|
-
const r = n.interactivity !== void 0 ? n.interactivity === "full" : n.interactive ?? !1;
|
|
676
|
-
return Xe(e, t.colors, t.font, t.transparent, r, t.embedSource, t.title, t.decorative, t.emit);
|
|
677
|
-
}
|
|
678
|
-
}, _t = {
|
|
679
|
-
type: "sequence",
|
|
680
|
-
parse: Ie,
|
|
681
|
-
layoutForSvg: Pe,
|
|
682
|
-
renderSvg(e, t) {
|
|
683
|
-
return Ge(e, t.colors, t.font, t.transparent, t.fontSizes, t.embedSource, t.title, t.decorative, t.emit);
|
|
684
|
-
}
|
|
685
|
-
};
|
|
686
|
-
function oe(e) {
|
|
687
|
-
return (e.interactivity ?? "static") !== "none";
|
|
688
|
-
}
|
|
689
|
-
function Nt(e) {
|
|
690
|
-
return (e.interactivity ?? "static") === "full";
|
|
691
|
-
}
|
|
692
|
-
var Ot = {
|
|
693
|
-
type: "class",
|
|
694
|
-
parse: Le,
|
|
695
|
-
layoutForSvg: ze,
|
|
696
|
-
renderSvg(e, t, n) {
|
|
697
|
-
return Ne(e, t.colors, t.font, t.transparent, t.fontSizes, t.embedSource, t.title, t.decorative, oe(n), t.emit);
|
|
698
|
-
}
|
|
699
|
-
}, Gt = {
|
|
700
|
-
type: "er",
|
|
701
|
-
parse: Ae,
|
|
702
|
-
layoutForSvg(e, t) {
|
|
703
|
-
return De(Q(e, t.direction), t);
|
|
704
|
-
},
|
|
705
|
-
renderSvg(e, t) {
|
|
706
|
-
return Oe(e, t.colors, t.font, t.transparent, t.fontSizes, t.embedSource, t.title, t.decorative, t.emit);
|
|
707
|
-
}
|
|
708
|
-
}, Ft = {
|
|
709
|
-
type: "flowchart",
|
|
710
|
-
parse: (e, t) => gt(t),
|
|
711
|
-
layoutForSvg(e, t) {
|
|
712
|
-
const n = Q(e, t.direction);
|
|
713
|
-
return {
|
|
714
|
-
graph: Be(n, t),
|
|
715
|
-
curve: t.curve ?? e.initConfig?.curve ?? "linear"
|
|
716
|
-
};
|
|
717
|
-
},
|
|
718
|
-
renderSvg(e, t, n) {
|
|
719
|
-
return Fe(e.graph, t.colors, t.font, t.transparent, t.fontSizes, e.curve, t.embedSource, Nt(n), oe(n), t.title, t.decorative, t.emit);
|
|
720
|
-
}
|
|
721
|
-
}, Xt = {
|
|
722
|
-
xychart: Pt,
|
|
723
|
-
er: Gt,
|
|
724
|
-
sequence: _t,
|
|
725
|
-
class: Ot,
|
|
726
|
-
flowchart: Ft
|
|
727
|
-
};
|
|
728
|
-
function ie(e) {
|
|
729
|
-
return {
|
|
730
|
-
bg: e.bg ?? U.bg,
|
|
731
|
-
fg: e.fg ?? U.fg,
|
|
732
|
-
line: e.line,
|
|
733
|
-
accent: e.accent,
|
|
734
|
-
muted: e.muted,
|
|
735
|
-
surface: e.surface,
|
|
736
|
-
border: e.border
|
|
737
|
-
};
|
|
738
|
-
}
|
|
739
|
-
function Wt(e) {
|
|
740
|
-
return {
|
|
741
|
-
nonce: e.nonce,
|
|
742
|
-
styleAttribute: e.styleAttribute
|
|
743
|
-
};
|
|
744
|
-
}
|
|
745
|
-
function D(e, t = {}) {
|
|
746
|
-
const n = Ut(e, t);
|
|
747
|
-
return t.resolveColors ? We(n, ie(t)) : n;
|
|
748
|
-
}
|
|
749
|
-
function Ut(e, t) {
|
|
750
|
-
const n = Ye(e), r = ie(t), o = t.font ?? "Inter";
|
|
751
|
-
we(ge(o));
|
|
752
|
-
const l = t.transparent ?? !1, u = Ue(t.fontSizes), a = me(n), v = t.embedSource ? e : void 0, h = t.title, p = t.decorative, m = Wt(t), g = be(n), w = Xt[a], d = w.parse(g, n), c = w.layoutForSvg(d, t), f = {
|
|
753
|
-
colors: r,
|
|
754
|
-
font: o,
|
|
755
|
-
transparent: l,
|
|
756
|
-
fontSizes: u,
|
|
757
|
-
embedSource: v,
|
|
758
|
-
title: h,
|
|
759
|
-
decorative: p,
|
|
760
|
-
emit: m
|
|
761
|
-
};
|
|
762
|
-
return w.renderSvg(c, f, t);
|
|
763
|
-
}
|
|
764
|
-
var Yt = `// @ts-check
|
|
238
|
+
var xe = `// @ts-check
|
|
765
239
|
/// <reference lib="dom" />
|
|
766
240
|
// ============================================================================
|
|
767
241
|
// Client script for the CLI's self-contained HTML viewer (\`render --html\`).
|
|
@@ -1053,7 +527,7 @@ var Yt = `// @ts-check
|
|
|
1053
527
|
fit()
|
|
1054
528
|
stage.focus({ preventScroll: true })
|
|
1055
529
|
})()
|
|
1056
|
-
`,
|
|
530
|
+
`, Ee = `
|
|
1057
531
|
:root {
|
|
1058
532
|
color-scheme: light dark;
|
|
1059
533
|
--bg: #f4f4f5;
|
|
@@ -1160,16 +634,16 @@ var Yt = `// @ts-check
|
|
|
1160
634
|
#diagram { position: static; transform: none !important; }
|
|
1161
635
|
}
|
|
1162
636
|
`.trim();
|
|
1163
|
-
function
|
|
1164
|
-
const
|
|
637
|
+
function Se(e) {
|
|
638
|
+
const n = e.title?.trim() || "Mermaid diagram";
|
|
1165
639
|
return `<!doctype html>
|
|
1166
640
|
<html lang="en">
|
|
1167
641
|
<head>
|
|
1168
642
|
<meta charset="utf-8" />
|
|
1169
643
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
1170
|
-
<title>${
|
|
644
|
+
<title>${q(n)}</title>
|
|
1171
645
|
<style>
|
|
1172
|
-
${
|
|
646
|
+
${Ee}
|
|
1173
647
|
</style>
|
|
1174
648
|
</head>
|
|
1175
649
|
<body>
|
|
@@ -1187,206 +661,206 @@ ${e.svg}
|
|
|
1187
661
|
<button id="theme" type="button" aria-pressed="false" aria-label="Switch to dark mode (T)">Dark</button>
|
|
1188
662
|
</div>
|
|
1189
663
|
<script>
|
|
1190
|
-
${
|
|
664
|
+
${xe}
|
|
1191
665
|
<\/script>
|
|
1192
666
|
</body>
|
|
1193
667
|
</html>
|
|
1194
668
|
`;
|
|
1195
669
|
}
|
|
1196
|
-
async function
|
|
1197
|
-
let
|
|
670
|
+
async function ke(e) {
|
|
671
|
+
let n;
|
|
1198
672
|
try {
|
|
1199
|
-
|
|
1200
|
-
} catch (
|
|
1201
|
-
const r =
|
|
673
|
+
n = await import("@resvg/resvg-js");
|
|
674
|
+
} catch (t) {
|
|
675
|
+
const r = t instanceof Error ? t.message : String(t);
|
|
1202
676
|
throw new Error(`--png requires the optional dependency "@resvg/resvg-js", which is not installed (it may have failed to build for this platform, or the install ran with --no-optional). Install it with \`pnpm add @resvg/resvg-js\` (or the npm/yarn equivalent) and try again.
|
|
1203
677
|
${r}`);
|
|
1204
678
|
}
|
|
1205
|
-
return (await
|
|
679
|
+
return (await n.renderAsync(e)).asPng();
|
|
1206
680
|
}
|
|
1207
|
-
var
|
|
1208
|
-
function
|
|
681
|
+
var Ce = 80, $ = 1, L = 1, R = 0, Te = /\x1b\[[0-9;]*m/g;
|
|
682
|
+
function D(e) {
|
|
1209
683
|
return e.split(`
|
|
1210
|
-
`).reduce((
|
|
684
|
+
`).reduce((n, t) => Math.max(n, we(ye(t.replace(Te, "")))), 0);
|
|
1211
685
|
}
|
|
1212
|
-
function
|
|
1213
|
-
return e !== "auto" ? e : process.stdout.columns ??
|
|
686
|
+
function Ae(e) {
|
|
687
|
+
return e !== "auto" ? e : process.stdout.columns ?? Ce;
|
|
1214
688
|
}
|
|
1215
|
-
async function
|
|
1216
|
-
const
|
|
1217
|
-
let
|
|
1218
|
-
if (e.input !== void 0)
|
|
1219
|
-
else if (
|
|
689
|
+
async function Ie(e, n, t, r) {
|
|
690
|
+
const s = n ?? process.stdout, m = r ?? process.stderr;
|
|
691
|
+
let c;
|
|
692
|
+
if (e.input !== void 0) c = await Z(e.input, "utf-8");
|
|
693
|
+
else if (t !== void 0) c = t;
|
|
1220
694
|
else {
|
|
1221
695
|
if (process.stdin.isTTY) throw new Error("No input file specified and stdin is a terminal. Pipe a diagram or pass a file path.");
|
|
1222
|
-
|
|
696
|
+
c = await Pe();
|
|
1223
697
|
}
|
|
1224
|
-
if (
|
|
1225
|
-
let
|
|
1226
|
-
if (e.theme !== void 0 && (
|
|
1227
|
-
const
|
|
1228
|
-
throw new Error(`Unknown theme: "${e.theme}". Available themes: ${
|
|
698
|
+
if (c = c.trim(), c.length === 0) throw new Error("Empty input — provide a Mermaid diagram via file or stdin");
|
|
699
|
+
let d;
|
|
700
|
+
if (e.theme !== void 0 && (d = B[e.theme], d === void 0)) {
|
|
701
|
+
const a = Object.keys(B).join(", ");
|
|
702
|
+
throw new Error(`Unknown theme: "${e.theme}". Available themes: ${a}`);
|
|
1229
703
|
}
|
|
1230
|
-
const
|
|
1231
|
-
for (const
|
|
1232
|
-
m,
|
|
704
|
+
const E = e.svg && e.output === "-", S = e.html && e.output === "-", k = e.png && e.output === "-", g = e.ascii && !e.svg && !e.html && !e.png && e.output !== void 0 && e.output !== "-" ? e.output : void 0, C = e.svg && !E ? e.output : void 0, T = e.html && !S ? e.output : void 0, b = e.png && !k ? e.output : void 0;
|
|
705
|
+
for (const a of [
|
|
1233
706
|
g,
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
707
|
+
C,
|
|
708
|
+
T,
|
|
709
|
+
b
|
|
710
|
+
]) a !== void 0 && await Me(a, e.force);
|
|
1237
711
|
if (e.ascii) {
|
|
1238
|
-
const
|
|
712
|
+
const a = d && g === void 0 ? {
|
|
1239
713
|
colorMode: "auto",
|
|
1240
|
-
theme:
|
|
714
|
+
theme: ee(d)
|
|
1241
715
|
} : { colorMode: "none" };
|
|
1242
|
-
e.paddingX !== void 0 && (
|
|
1243
|
-
let
|
|
716
|
+
e.paddingX !== void 0 && (a.paddingX = e.paddingX), e.paddingY !== void 0 && (a.paddingY = e.paddingY), e.borderPadding !== void 0 && (a.boxBorderPadding = e.borderPadding), e.coords && (a.showCoords = !0), e.direction !== void 0 && (a.direction = e.direction), e.hyperlinks && g === void 0 && (a.hyperlinks = !0);
|
|
717
|
+
let u = O(c, a);
|
|
1244
718
|
if (e.maxWidth !== void 0) {
|
|
1245
|
-
const
|
|
1246
|
-
let
|
|
1247
|
-
if (
|
|
1248
|
-
const
|
|
1249
|
-
if (
|
|
1250
|
-
const
|
|
1251
|
-
...
|
|
1252
|
-
paddingX:
|
|
1253
|
-
paddingY:
|
|
1254
|
-
boxBorderPadding:
|
|
1255
|
-
}),
|
|
1256
|
-
|
|
719
|
+
const i = Ae(e.maxWidth);
|
|
720
|
+
let h = D(u), w = !1;
|
|
721
|
+
if (h > i) {
|
|
722
|
+
const p = a.paddingX ?? 5, y = a.paddingY ?? 5, f = a.boxBorderPadding ?? 1, o = Math.min(p, $), l = Math.min(y, L), x = Math.min(f, R);
|
|
723
|
+
if (o < p || l < y || x < f) {
|
|
724
|
+
const _ = O(c, {
|
|
725
|
+
...a,
|
|
726
|
+
paddingX: o,
|
|
727
|
+
paddingY: l,
|
|
728
|
+
boxBorderPadding: x
|
|
729
|
+
}), N = D(_);
|
|
730
|
+
N < h && (u = _, h = N, w = !0);
|
|
1257
731
|
}
|
|
1258
732
|
}
|
|
1259
|
-
if (
|
|
1260
|
-
const
|
|
1261
|
-
|
|
733
|
+
if (h > i) {
|
|
734
|
+
const p = e.maxWidth === "auto" ? "detected terminal width" : "--max-width", y = w ? `Compact spacing (-x ${$} -y ${L} -p ${R}) was already applied automatically. ` : "", f = w ? "Try a narrower direction (LR vs TD), shorter labels, or widen your terminal." : "Try -x/-y/-p for tighter spacing, a narrower direction (LR vs TD), or widen your terminal.";
|
|
735
|
+
m.write(`Warning: ASCII output is ${h} columns wide, exceeding ${p} of ${i}. ${y}zombie-mermaid does not reflow diagram structure to fit (no label wrapping or direction-flip cascade — see https://github.com/dfadler/zombie-mermaid/issues/335). ${f}
|
|
1262
736
|
`);
|
|
1263
|
-
} else
|
|
737
|
+
} else w && m.write(`Note: ASCII output exceeded ${i} columns at the requested spacing; applied compact spacing automatically (-x ${$} -y ${L} -p ${R}) to fit.
|
|
1264
738
|
`);
|
|
1265
739
|
}
|
|
1266
|
-
await
|
|
1267
|
-
`,
|
|
740
|
+
await M(I(g === void 0, g), u + `
|
|
741
|
+
`, s, e.force);
|
|
1268
742
|
}
|
|
1269
743
|
if (e.svg) {
|
|
1270
|
-
const
|
|
1271
|
-
...
|
|
744
|
+
const a = {
|
|
745
|
+
...d,
|
|
1272
746
|
resolveColors: e.resolveColors
|
|
1273
747
|
};
|
|
1274
|
-
e.direction !== void 0 && (
|
|
1275
|
-
const
|
|
1276
|
-
await
|
|
748
|
+
e.direction !== void 0 && (a.direction = e.direction);
|
|
749
|
+
const u = z(c, a);
|
|
750
|
+
await M(I(E, C), u, s, e.force);
|
|
1277
751
|
}
|
|
1278
752
|
if (e.html) {
|
|
1279
|
-
const
|
|
1280
|
-
svg:
|
|
1281
|
-
title:
|
|
753
|
+
const a = z(c, d ?? {}), u = e.input ? G(e.input).name : void 0, i = Se({
|
|
754
|
+
svg: a,
|
|
755
|
+
title: u
|
|
1282
756
|
});
|
|
1283
|
-
await
|
|
757
|
+
await M(I(S, T), i, s, e.force);
|
|
1284
758
|
}
|
|
1285
759
|
if (e.png) {
|
|
1286
|
-
const
|
|
1287
|
-
...
|
|
760
|
+
const a = {
|
|
761
|
+
...d,
|
|
1288
762
|
resolveColors: !0
|
|
1289
763
|
};
|
|
1290
|
-
e.direction !== void 0 && (
|
|
1291
|
-
const
|
|
1292
|
-
await
|
|
764
|
+
e.direction !== void 0 && (a.direction = e.direction);
|
|
765
|
+
const u = z(c, a), i = await ke(u);
|
|
766
|
+
await M(I(k, b), i, s, e.force);
|
|
1293
767
|
}
|
|
1294
768
|
}
|
|
1295
|
-
function
|
|
1296
|
-
return e ? { kind: "stdout" } :
|
|
769
|
+
function I(e, n) {
|
|
770
|
+
return e ? { kind: "stdout" } : n !== void 0 ? {
|
|
1297
771
|
kind: "file",
|
|
1298
|
-
path:
|
|
772
|
+
path: n
|
|
1299
773
|
} : { kind: "skip" };
|
|
1300
774
|
}
|
|
1301
|
-
async function
|
|
775
|
+
async function M(e, n, t, r) {
|
|
1302
776
|
switch (e.kind) {
|
|
1303
777
|
case "stdout":
|
|
1304
|
-
|
|
778
|
+
t.write(n);
|
|
1305
779
|
break;
|
|
1306
780
|
case "file":
|
|
1307
|
-
await
|
|
781
|
+
await ze(e.path, n, r);
|
|
1308
782
|
}
|
|
1309
783
|
}
|
|
1310
|
-
function
|
|
784
|
+
function X(e) {
|
|
1311
785
|
return /* @__PURE__ */ new Error(`Refusing to overwrite existing file "${e}" — pass --force to replace it`);
|
|
1312
786
|
}
|
|
1313
|
-
async function
|
|
1314
|
-
if (
|
|
1315
|
-
let
|
|
787
|
+
async function Me(e, n) {
|
|
788
|
+
if (n) return;
|
|
789
|
+
let t = !0;
|
|
1316
790
|
try {
|
|
1317
|
-
await
|
|
791
|
+
await J(e);
|
|
1318
792
|
} catch {
|
|
1319
|
-
|
|
793
|
+
t = !1;
|
|
1320
794
|
}
|
|
1321
|
-
if (
|
|
795
|
+
if (t) throw X(e);
|
|
1322
796
|
}
|
|
1323
|
-
async function
|
|
797
|
+
async function ze(e, n, t) {
|
|
1324
798
|
try {
|
|
1325
|
-
await
|
|
799
|
+
await Q(e, n, {
|
|
1326
800
|
encoding: "utf-8",
|
|
1327
|
-
flag:
|
|
801
|
+
flag: t ? "w" : "wx"
|
|
1328
802
|
});
|
|
1329
803
|
} catch (r) {
|
|
1330
|
-
throw !
|
|
804
|
+
throw !t && r instanceof Error && "code" in r && r.code === "EEXIST" ? X(e) : r;
|
|
1331
805
|
}
|
|
1332
806
|
}
|
|
1333
|
-
async function
|
|
1334
|
-
const e = [],
|
|
1335
|
-
return
|
|
1336
|
-
|
|
807
|
+
async function Pe() {
|
|
808
|
+
const e = [], n = process.stdin;
|
|
809
|
+
return n.setEncoding("utf-8"), new Promise((t, r) => {
|
|
810
|
+
n.on("data", (s) => e.push(s)), n.on("end", () => t(e.join(""))), n.on("error", r);
|
|
1337
811
|
});
|
|
1338
812
|
}
|
|
1339
|
-
var
|
|
1340
|
-
function
|
|
1341
|
-
return new Promise((
|
|
813
|
+
var $e = 1e6;
|
|
814
|
+
function Le(e) {
|
|
815
|
+
return new Promise((n, t) => {
|
|
1342
816
|
const r = [];
|
|
1343
|
-
let
|
|
1344
|
-
e.on("data", (
|
|
1345
|
-
if (
|
|
1346
|
-
|
|
817
|
+
let s = 0;
|
|
818
|
+
e.on("data", (m) => {
|
|
819
|
+
if (s += m.length, s > $e) {
|
|
820
|
+
t(/* @__PURE__ */ new Error("Request body too large")), e.destroy();
|
|
1347
821
|
return;
|
|
1348
822
|
}
|
|
1349
|
-
r.push(
|
|
1350
|
-
}), e.on("end", () =>
|
|
823
|
+
r.push(m);
|
|
824
|
+
}), e.on("end", () => n(Buffer.concat(r).toString("utf-8"))), e.on("error", t);
|
|
1351
825
|
});
|
|
1352
826
|
}
|
|
1353
|
-
function
|
|
827
|
+
function Y(e) {
|
|
1354
828
|
return typeof e == "object" && e !== null;
|
|
1355
829
|
}
|
|
1356
|
-
function
|
|
1357
|
-
let
|
|
830
|
+
function Re(e) {
|
|
831
|
+
let n;
|
|
1358
832
|
try {
|
|
1359
|
-
|
|
833
|
+
n = JSON.parse(e);
|
|
1360
834
|
} catch {
|
|
1361
835
|
throw new Error("Invalid JSON in request body");
|
|
1362
836
|
}
|
|
1363
|
-
if (!
|
|
1364
|
-
const
|
|
1365
|
-
if (typeof
|
|
837
|
+
if (!Y(n)) throw new Error("Request body must be a JSON object");
|
|
838
|
+
const t = n.source;
|
|
839
|
+
if (typeof t != "string" || t.trim().length === 0) throw new Error('Provide Mermaid source as a non-empty "source" string');
|
|
1366
840
|
return {
|
|
1367
|
-
source:
|
|
1368
|
-
format:
|
|
841
|
+
source: t,
|
|
842
|
+
format: n.format === "svg" ? "svg" : "ascii"
|
|
1369
843
|
};
|
|
1370
844
|
}
|
|
1371
|
-
function
|
|
1372
|
-
const r = JSON.stringify(
|
|
1373
|
-
e.writeHead(
|
|
845
|
+
function F(e, n, t) {
|
|
846
|
+
const r = JSON.stringify(t);
|
|
847
|
+
e.writeHead(n, {
|
|
1374
848
|
"Content-Type": "application/json; charset=utf-8",
|
|
1375
849
|
"Content-Length": Buffer.byteLength(r)
|
|
1376
850
|
}), e.end(r);
|
|
1377
851
|
}
|
|
1378
|
-
async function
|
|
852
|
+
async function Be(e, n) {
|
|
1379
853
|
try {
|
|
1380
|
-
const { source:
|
|
1381
|
-
|
|
1382
|
-
output: r === "svg" ?
|
|
854
|
+
const { source: t, format: r } = Re(await Le(e));
|
|
855
|
+
F(n, 200, {
|
|
856
|
+
output: r === "svg" ? z(t) : O(t),
|
|
1383
857
|
format: r
|
|
1384
858
|
});
|
|
1385
|
-
} catch (
|
|
1386
|
-
|
|
859
|
+
} catch (t) {
|
|
860
|
+
F(n, 400, { error: t instanceof Error ? t.message : String(t) });
|
|
1387
861
|
}
|
|
1388
862
|
}
|
|
1389
|
-
var
|
|
863
|
+
var Oe = `<!doctype html>
|
|
1390
864
|
<html lang="en">
|
|
1391
865
|
<head>
|
|
1392
866
|
<meta charset="utf-8" />
|
|
@@ -1452,84 +926,84 @@ var sn = `<!doctype html>
|
|
|
1452
926
|
</body>
|
|
1453
927
|
</html>
|
|
1454
928
|
`;
|
|
1455
|
-
function
|
|
1456
|
-
return
|
|
1457
|
-
const
|
|
1458
|
-
if (e.method === "GET" && (
|
|
1459
|
-
|
|
929
|
+
function _e() {
|
|
930
|
+
return te((e, n) => {
|
|
931
|
+
const t = (e.url ?? "/").split("?")[0];
|
|
932
|
+
if (e.method === "GET" && (t === "/" || t === "")) {
|
|
933
|
+
n.writeHead(200, { "Content-Type": "text/html; charset=utf-8" }), n.end(Oe);
|
|
1460
934
|
return;
|
|
1461
935
|
}
|
|
1462
|
-
if (e.method === "POST" &&
|
|
1463
|
-
|
|
936
|
+
if (e.method === "POST" && t === "/render") {
|
|
937
|
+
Be(e, n);
|
|
1464
938
|
return;
|
|
1465
939
|
}
|
|
1466
|
-
|
|
940
|
+
n.writeHead(404, { "Content-Type": "text/plain; charset=utf-8" }), n.end("Not found");
|
|
1467
941
|
});
|
|
1468
942
|
}
|
|
1469
|
-
function
|
|
1470
|
-
return new Promise((
|
|
1471
|
-
const r =
|
|
1472
|
-
r.once("error",
|
|
1473
|
-
r.removeListener("error",
|
|
943
|
+
function Ne(e) {
|
|
944
|
+
return new Promise((n, t) => {
|
|
945
|
+
const r = _e();
|
|
946
|
+
r.once("error", t), r.listen(e, "127.0.0.1", () => {
|
|
947
|
+
r.removeListener("error", t), n(r);
|
|
1474
948
|
});
|
|
1475
949
|
});
|
|
1476
950
|
}
|
|
1477
|
-
async function
|
|
1478
|
-
const
|
|
1479
|
-
return
|
|
951
|
+
async function De(e, n = console.log) {
|
|
952
|
+
const t = await Ne(e.port), r = t.address();
|
|
953
|
+
return n(`zombie-mermaid web running at http://localhost:${Y(r) && typeof r.port == "number" ? r.port : e.port}`), t;
|
|
1480
954
|
}
|
|
1481
|
-
async function
|
|
1482
|
-
const
|
|
1483
|
-
return await
|
|
955
|
+
async function Fe(e = (n) => console.error(n)) {
|
|
956
|
+
const n = re(), t = new ne();
|
|
957
|
+
return await n.connect(t), e("zombie-mermaid MCP server running on stdio (experimental — feedback welcome: https://github.com/dfadler/zombie-mermaid/issues)"), n;
|
|
1484
958
|
}
|
|
1485
|
-
function
|
|
1486
|
-
const e =
|
|
959
|
+
function Ge() {
|
|
960
|
+
const e = U(import.meta.url)("../package.json");
|
|
1487
961
|
return typeof e == "object" && e !== null && "version" in e && typeof e.version == "string" ? e.version : "unknown";
|
|
1488
962
|
}
|
|
1489
|
-
var
|
|
1490
|
-
async function
|
|
963
|
+
var We = Ge();
|
|
964
|
+
async function Xe() {
|
|
1491
965
|
const e = process.argv.slice(2);
|
|
1492
|
-
let
|
|
966
|
+
let n;
|
|
1493
967
|
try {
|
|
1494
|
-
|
|
1495
|
-
} catch (
|
|
1496
|
-
console.error(`Error: ${
|
|
968
|
+
n = se(e);
|
|
969
|
+
} catch (t) {
|
|
970
|
+
console.error(`Error: ${t instanceof Error ? t.message : String(t)}`), process.exit(1);
|
|
1497
971
|
}
|
|
1498
|
-
switch (
|
|
972
|
+
switch (n.command) {
|
|
1499
973
|
case "help":
|
|
1500
|
-
|
|
974
|
+
Ye();
|
|
1501
975
|
break;
|
|
1502
976
|
case "version":
|
|
1503
|
-
console.log(`zombie-mermaid ${
|
|
977
|
+
console.log(`zombie-mermaid ${We}`);
|
|
1504
978
|
break;
|
|
1505
979
|
case "themes":
|
|
1506
980
|
console.log(`Available themes:
|
|
1507
981
|
`);
|
|
1508
|
-
for (const
|
|
982
|
+
for (const t of Object.keys(B)) console.log(` ${t}`);
|
|
1509
983
|
break;
|
|
1510
984
|
case "render":
|
|
1511
985
|
try {
|
|
1512
|
-
await
|
|
1513
|
-
} catch (
|
|
1514
|
-
console.error(`Error: ${
|
|
986
|
+
await Ie(n);
|
|
987
|
+
} catch (t) {
|
|
988
|
+
console.error(`Error: ${t instanceof Error ? t.message : String(t)}`), process.exit(1);
|
|
1515
989
|
}
|
|
1516
990
|
break;
|
|
1517
991
|
case "web":
|
|
1518
992
|
try {
|
|
1519
|
-
await
|
|
1520
|
-
} catch (
|
|
1521
|
-
console.error(`Error: ${
|
|
993
|
+
await De(n);
|
|
994
|
+
} catch (t) {
|
|
995
|
+
console.error(`Error: ${t instanceof Error ? t.message : String(t)}`), process.exit(1);
|
|
1522
996
|
}
|
|
1523
997
|
break;
|
|
1524
998
|
case "mcp":
|
|
1525
999
|
try {
|
|
1526
|
-
await
|
|
1527
|
-
} catch (
|
|
1528
|
-
console.error(`Error: ${
|
|
1000
|
+
await Fe();
|
|
1001
|
+
} catch (t) {
|
|
1002
|
+
console.error(`Error: ${t instanceof Error ? t.message : String(t)}`), process.exit(1);
|
|
1529
1003
|
}
|
|
1530
1004
|
}
|
|
1531
1005
|
}
|
|
1532
|
-
function
|
|
1006
|
+
function Ye() {
|
|
1533
1007
|
console.log(`
|
|
1534
1008
|
zombie-mermaid — render Mermaid diagrams from the command line
|
|
1535
1009
|
|
|
@@ -1603,7 +1077,7 @@ Options:
|
|
|
1603
1077
|
-v, --version Show version
|
|
1604
1078
|
`.trim());
|
|
1605
1079
|
}
|
|
1606
|
-
|
|
1080
|
+
Xe();
|
|
1607
1081
|
export {
|
|
1608
|
-
|
|
1082
|
+
Xe as main
|
|
1609
1083
|
};
|