semajsx 0.6.0 → 0.7.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.
Files changed (76) hide show
  1. package/dist/{client-CButR91p.mjs → client-BrupjhG0.mjs} +4 -4
  2. package/dist/{client-CButR91p.mjs.map → client-BrupjhG0.mjs.map} +1 -1
  3. package/dist/{computed-BidG06Lt.mjs → computed-BpjqvQu1.mjs} +2 -2
  4. package/dist/{computed-BidG06Lt.mjs.map → computed-BpjqvQu1.mjs.map} +1 -1
  5. package/dist/document-DsiJO2jG.mjs +5 -0
  6. package/dist/{document-BOJDaiBc.mjs → document-XKyAs62C.mjs} +2 -2
  7. package/dist/{document-BOJDaiBc.mjs.map → document-XKyAs62C.mjs.map} +1 -1
  8. package/dist/dom/index.mjs +3 -3
  9. package/dist/dom/jsx-dev-runtime.d.mts +1 -1
  10. package/dist/dom/jsx-dev-runtime.mjs +2 -2
  11. package/dist/dom/jsx-runtime.d.mts +1 -1
  12. package/dist/dom/jsx-runtime.mjs +2 -2
  13. package/dist/{index-D_FIlSk3.d.mts → index-CmxkYOtR.d.mts} +2 -2
  14. package/dist/{index-D_FIlSk3.d.mts.map → index-CmxkYOtR.d.mts.map} +1 -1
  15. package/dist/index.mjs +4 -4
  16. package/dist/{jsx-runtime-D9ZNjMJ2.mjs → jsx-runtime-BFs1c0xz.mjs} +1 -1
  17. package/dist/jsx-runtime-BFs1c0xz.mjs.map +1 -0
  18. package/dist/{jsx-runtime-tIuFmhTh.d.mts → jsx-runtime-C-TtSL51.d.mts} +9 -4
  19. package/dist/jsx-runtime-C-TtSL51.d.mts.map +1 -0
  20. package/dist/{jsx-runtime-BjCGsceN.mjs → jsx-runtime-kv_6vBiR.mjs} +1 -1
  21. package/dist/{jsx-runtime-BjCGsceN.mjs.map → jsx-runtime-kv_6vBiR.mjs.map} +1 -1
  22. package/dist/{lucide-C5BghhSl.mjs → lucide-Ddt_N9dJ.mjs} +3 -3
  23. package/dist/{lucide-C5BghhSl.mjs.map → lucide-Ddt_N9dJ.mjs.map} +1 -1
  24. package/dist/{resource-CNwiNxJX.d.mts → resource-CX-sVeS_.d.mts} +5 -2
  25. package/dist/resource-CX-sVeS_.d.mts.map +1 -0
  26. package/dist/{resource-DSlXDZZi.mjs → resource-pm7qP-jV.mjs} +2 -2
  27. package/dist/{resource-DSlXDZZi.mjs.map → resource-pm7qP-jV.mjs.map} +1 -1
  28. package/dist/signal/index.mjs +3 -3
  29. package/dist/{signal-BN8vHXDb.mjs → signal-4PgGfydw.mjs} +1 -1
  30. package/dist/{signal-BN8vHXDb.mjs.map → signal-4PgGfydw.mjs.map} +1 -1
  31. package/dist/{src-B4VBiHa8.mjs → src-CAyv9Uf9.mjs} +24 -17
  32. package/dist/src-CAyv9Uf9.mjs.map +1 -0
  33. package/dist/{src-DUpFNNM_.mjs → src-CXY-7FC3.mjs} +4 -4
  34. package/dist/{src-DUpFNNM_.mjs.map → src-CXY-7FC3.mjs.map} +1 -1
  35. package/dist/{src-BqX3sryB.mjs → src-C_aFsFJ3.mjs} +4 -4
  36. package/dist/{src-BqX3sryB.mjs.map → src-C_aFsFJ3.mjs.map} +1 -1
  37. package/dist/{src-DW3tIczg.mjs → src-Cv4rRVzv.mjs} +4 -4
  38. package/dist/{src-DW3tIczg.mjs.map → src-Cv4rRVzv.mjs.map} +1 -1
  39. package/dist/{src-Ds9vl42d.mjs → src-DV9uwtE5.mjs} +2 -2
  40. package/dist/{src-Ds9vl42d.mjs.map → src-DV9uwtE5.mjs.map} +1 -1
  41. package/dist/{src-75qcxwT_.mjs → src-SqJ6k7Xv.mjs} +13 -29
  42. package/dist/src-SqJ6k7Xv.mjs.map +1 -0
  43. package/dist/ssg/index.d.mts +1 -1
  44. package/dist/ssg/index.d.mts.map +1 -1
  45. package/dist/ssg/index.mjs +14 -9
  46. package/dist/ssg/index.mjs.map +1 -1
  47. package/dist/ssg/plugins/docs-theme.d.mts +68 -29
  48. package/dist/ssg/plugins/docs-theme.d.mts.map +1 -1
  49. package/dist/ssg/plugins/docs-theme.mjs +2747 -380
  50. package/dist/ssg/plugins/docs-theme.mjs.map +1 -1
  51. package/dist/ssg/plugins/fonts/MAPLE_MONO_LICENSE.txt +93 -0
  52. package/dist/ssg/plugins/fonts/MapleMono-NF-CN-Regular.woff2 +0 -0
  53. package/dist/ssg/plugins/lucide.d.mts +2 -2
  54. package/dist/ssg/plugins/lucide.mjs +5 -5
  55. package/dist/ssr/client.d.mts +1 -1
  56. package/dist/ssr/client.mjs +5 -5
  57. package/dist/ssr/index.d.mts +1 -1
  58. package/dist/ssr/index.d.mts.map +1 -1
  59. package/dist/ssr/index.mjs +8 -8
  60. package/dist/style/index.mjs +1 -1
  61. package/dist/style/react.mjs +2 -2
  62. package/dist/style/vue.mjs +2 -2
  63. package/dist/terminal/index.mjs +3 -3
  64. package/dist/terminal/jsx-dev-runtime.mjs +2 -2
  65. package/dist/terminal/jsx-runtime.mjs +2 -2
  66. package/dist/{types-BmDIxXiP.d.mts → types-BaS-zTDX.d.mts} +3 -1
  67. package/dist/{types-BmDIxXiP.d.mts.map → types-BaS-zTDX.d.mts.map} +1 -1
  68. package/dist/{utils-DbTAs943.mjs → utils-BrGmTgfG.mjs} +1 -1
  69. package/dist/{utils-DbTAs943.mjs.map → utils-BrGmTgfG.mjs.map} +1 -1
  70. package/package.json +2 -2
  71. package/dist/document-CwHVG_PJ.mjs +0 -5
  72. package/dist/jsx-runtime-D9ZNjMJ2.mjs.map +0 -1
  73. package/dist/jsx-runtime-tIuFmhTh.d.mts.map +0 -1
  74. package/dist/resource-CNwiNxJX.d.mts.map +0 -1
  75. package/dist/src-75qcxwT_.mjs.map +0 -1
  76. package/dist/src-B4VBiHa8.mjs.map +0 -1
@@ -1,16 +1,17 @@
1
- import { d as defineCollection, v as __exportAll } from "../../src-75qcxwT_.mjs";
2
- import { t as signal } from "../../signal-BN8vHXDb.mjs";
3
- import { a as jsxs, i as jsx, v as Fragment } from "../../src-DW3tIczg.mjs";
4
- import "../../src-BqX3sryB.mjs";
5
- import { G as rules, K as classes, M as createTheme, N as defineTokens, U as isStyleToken, W as rule } from "../../src-Ds9vl42d.mjs";
6
- import "../../jsx-runtime-D9ZNjMJ2.mjs";
7
- import "../../src-DUpFNNM_.mjs";
8
- import "../../jsx-runtime-BjCGsceN.mjs";
9
- import { d as island } from "../../resource-DSlXDZZi.mjs";
10
- import "../../src-B4VBiHa8.mjs";
11
- import "../../document-BOJDaiBc.mjs";
12
- import "../../client-CButR91p.mjs";
13
- import { n as Icon, t as lucide } from "../../lucide-C5BghhSl.mjs";
1
+ import { t as signal } from "../../signal-4PgGfydw.mjs";
2
+ import { n as unwrap } from "../../utils-BrGmTgfG.mjs";
3
+ import { a as jsxs, i as jsx, u as context, v as Fragment } from "../../src-Cv4rRVzv.mjs";
4
+ import "../../src-C_aFsFJ3.mjs";
5
+ import { G as rules, K as classes, M as createTheme, N as defineTokens, W as rule } from "../../src-DV9uwtE5.mjs";
6
+ import "../../jsx-runtime-BFs1c0xz.mjs";
7
+ import "../../src-CXY-7FC3.mjs";
8
+ import "../../jsx-runtime-kv_6vBiR.mjs";
9
+ import { d as island } from "../../resource-pm7qP-jV.mjs";
10
+ import "../../src-CAyv9Uf9.mjs";
11
+ import "../../document-XKyAs62C.mjs";
12
+ import "../../client-BrupjhG0.mjs";
13
+ import { d as defineCollection } from "../../src-SqJ6k7Xv.mjs";
14
+ import { n as Icon, t as lucide } from "../../lucide-Ddt_N9dJ.mjs";
14
15
  import { dirname, join } from "path";
15
16
  import { mkdir, writeFile } from "fs/promises";
16
17
  import { z } from "zod";
@@ -19,12 +20,2521 @@ import { dirname as dirname$1, join as join$1 } from "node:path";
19
20
  import { fileURLToPath } from "node:url";
20
21
  import remarkGfm from "remark-gfm";
21
22
 
23
+ //#region ../mermaid/src/parser/tokenizer.ts
24
+ const KEYWORDS = new Set([
25
+ "graph",
26
+ "flowchart",
27
+ "sequenceDiagram",
28
+ "subgraph",
29
+ "end",
30
+ "direction",
31
+ "participant",
32
+ "actor",
33
+ "as",
34
+ "activate",
35
+ "deactivate",
36
+ "loop",
37
+ "alt",
38
+ "else",
39
+ "opt",
40
+ "par",
41
+ "and",
42
+ "critical",
43
+ "break",
44
+ "Note",
45
+ "over",
46
+ "left",
47
+ "right",
48
+ "of"
49
+ ]);
50
+ const ARROW_PATTERNS = [
51
+ "-->>",
52
+ "--))",
53
+ "->>",
54
+ "-))",
55
+ "x-.-x",
56
+ "o-.-o",
57
+ "<-.->",
58
+ "x==x",
59
+ "o==o",
60
+ "<==>",
61
+ "x--x",
62
+ "o--o",
63
+ "<-->",
64
+ "o-.->",
65
+ "o==>",
66
+ "o-->",
67
+ "-.-o",
68
+ "-.-x",
69
+ "-.->|",
70
+ "-.->",
71
+ "-.-",
72
+ "==o",
73
+ "==x",
74
+ "==>|",
75
+ "==>",
76
+ "===",
77
+ "--o",
78
+ "--x",
79
+ "-->|",
80
+ "-->",
81
+ "---",
82
+ "-x",
83
+ "->",
84
+ "--"
85
+ ];
86
+ function tokenize(input) {
87
+ const tokens = [];
88
+ let pos = 0;
89
+ let line = 1;
90
+ let col = 1;
91
+ while (pos < input.length) {
92
+ const ch = input[pos];
93
+ if (ch === " " || ch === " ") {
94
+ pos++;
95
+ col++;
96
+ continue;
97
+ }
98
+ if (ch === "\n") {
99
+ tokens.push({
100
+ type: "newline",
101
+ value: "\n",
102
+ line,
103
+ column: col
104
+ });
105
+ pos++;
106
+ line++;
107
+ col = 1;
108
+ continue;
109
+ }
110
+ if (ch === "\r") {
111
+ pos++;
112
+ if (pos < input.length && input[pos] === "\n") pos++;
113
+ tokens.push({
114
+ type: "newline",
115
+ value: "\n",
116
+ line,
117
+ column: col
118
+ });
119
+ line++;
120
+ col = 1;
121
+ continue;
122
+ }
123
+ if (ch === "%" && pos + 1 < input.length && input[pos + 1] === "%") {
124
+ const start = pos;
125
+ pos += 2;
126
+ while (pos < input.length && input[pos] !== "\n") pos++;
127
+ tokens.push({
128
+ type: "comment",
129
+ value: input.slice(start, pos),
130
+ line,
131
+ column: col
132
+ });
133
+ col += pos - start;
134
+ continue;
135
+ }
136
+ if (ch === ";") {
137
+ tokens.push({
138
+ type: "semicolon",
139
+ value: ";",
140
+ line,
141
+ column: col
142
+ });
143
+ pos++;
144
+ col++;
145
+ continue;
146
+ }
147
+ if (ch === ":") {
148
+ tokens.push({
149
+ type: "colon",
150
+ value: ":",
151
+ line,
152
+ column: col
153
+ });
154
+ pos++;
155
+ col++;
156
+ continue;
157
+ }
158
+ if (ch === "|") {
159
+ tokens.push({
160
+ type: "pipe",
161
+ value: "|",
162
+ line,
163
+ column: col
164
+ });
165
+ pos++;
166
+ col++;
167
+ continue;
168
+ }
169
+ if (ch === "[") {
170
+ tokens.push({
171
+ type: "openBracket",
172
+ value: "[",
173
+ line,
174
+ column: col
175
+ });
176
+ pos++;
177
+ col++;
178
+ continue;
179
+ }
180
+ if (ch === "]") {
181
+ tokens.push({
182
+ type: "closeBracket",
183
+ value: "]",
184
+ line,
185
+ column: col
186
+ });
187
+ pos++;
188
+ col++;
189
+ continue;
190
+ }
191
+ if (ch === "(") {
192
+ if (pos + 1 < input.length && input[pos + 1] === "(") {
193
+ tokens.push({
194
+ type: "openParen",
195
+ value: "((",
196
+ line,
197
+ column: col
198
+ });
199
+ pos += 2;
200
+ col += 2;
201
+ } else {
202
+ tokens.push({
203
+ type: "openParen",
204
+ value: "(",
205
+ line,
206
+ column: col
207
+ });
208
+ pos++;
209
+ col++;
210
+ }
211
+ continue;
212
+ }
213
+ if (ch === ")") {
214
+ if (pos + 1 < input.length && input[pos + 1] === ")") {
215
+ tokens.push({
216
+ type: "closeParen",
217
+ value: "))",
218
+ line,
219
+ column: col
220
+ });
221
+ pos += 2;
222
+ col += 2;
223
+ } else {
224
+ tokens.push({
225
+ type: "closeParen",
226
+ value: ")",
227
+ line,
228
+ column: col
229
+ });
230
+ pos++;
231
+ col++;
232
+ }
233
+ continue;
234
+ }
235
+ if (ch === "{") {
236
+ tokens.push({
237
+ type: "openBrace",
238
+ value: "{",
239
+ line,
240
+ column: col
241
+ });
242
+ pos++;
243
+ col++;
244
+ continue;
245
+ }
246
+ if (ch === "}") {
247
+ tokens.push({
248
+ type: "closeBrace",
249
+ value: "}",
250
+ line,
251
+ column: col
252
+ });
253
+ pos++;
254
+ col++;
255
+ continue;
256
+ }
257
+ if (ch === "\"" || ch === "'") {
258
+ const quote = ch;
259
+ const startCol = col;
260
+ pos++;
261
+ col++;
262
+ let value = "";
263
+ while (pos < input.length && input[pos] !== quote) {
264
+ if (input[pos] === "\\") {
265
+ pos++;
266
+ col++;
267
+ }
268
+ value += input[pos];
269
+ pos++;
270
+ col++;
271
+ }
272
+ if (pos < input.length) {
273
+ pos++;
274
+ col++;
275
+ }
276
+ tokens.push({
277
+ type: "string",
278
+ value,
279
+ line,
280
+ column: startCol
281
+ });
282
+ continue;
283
+ }
284
+ let matchedArrow = false;
285
+ for (const arrow of ARROW_PATTERNS) if (input.startsWith(arrow, pos)) {
286
+ tokens.push({
287
+ type: "arrow",
288
+ value: arrow,
289
+ line,
290
+ column: col
291
+ });
292
+ pos += arrow.length;
293
+ col += arrow.length;
294
+ matchedArrow = true;
295
+ break;
296
+ }
297
+ if (matchedArrow) continue;
298
+ if (isIdStart(ch)) {
299
+ const startCol = col;
300
+ let value = "";
301
+ while (pos < input.length && isIdPart(input[pos])) {
302
+ value += input[pos];
303
+ pos++;
304
+ col++;
305
+ }
306
+ const type = KEYWORDS.has(value) ? "keyword" : "identifier";
307
+ tokens.push({
308
+ type,
309
+ value,
310
+ line,
311
+ column: startCol
312
+ });
313
+ continue;
314
+ }
315
+ if (ch === ">") {
316
+ tokens.push({
317
+ type: "openBracket",
318
+ value: ">",
319
+ line,
320
+ column: col
321
+ });
322
+ pos++;
323
+ col++;
324
+ continue;
325
+ }
326
+ pos++;
327
+ col++;
328
+ }
329
+ tokens.push({
330
+ type: "eof",
331
+ value: "",
332
+ line,
333
+ column: col
334
+ });
335
+ return tokens;
336
+ }
337
+ function isIdStart(ch) {
338
+ return ch != null && /[a-zA-Z_$0-9]/.test(ch);
339
+ }
340
+ function isIdPart(ch) {
341
+ return ch != null && /[a-zA-Z0-9_$]/.test(ch);
342
+ }
343
+ /** Filter out comments and newlines for easier parsing */
344
+ function filterTokens(tokens) {
345
+ return tokens.filter((t) => t.type !== "comment");
346
+ }
347
+
348
+ //#endregion
349
+ //#region ../mermaid/src/parser/flowchart.ts
350
+ function parseFlowchart(input) {
351
+ const state = {
352
+ tokens: filterTokens(tokenize(input)),
353
+ pos: 0,
354
+ nodes: /* @__PURE__ */ new Map(),
355
+ edges: [],
356
+ subgraphs: [],
357
+ direction: "TD"
358
+ };
359
+ if (!parseHeader(state)) return {
360
+ message: "Expected 'graph' or 'flowchart' keyword",
361
+ line: 1,
362
+ column: 1
363
+ };
364
+ while (!isEof$1(state)) {
365
+ skipNewlines$1(state);
366
+ if (isEof$1(state)) break;
367
+ const token = peek$1(state);
368
+ if (token.type === "keyword" && token.value === "subgraph") {
369
+ const result = parseSubgraph(state);
370
+ if ("message" in result) return result;
371
+ continue;
372
+ }
373
+ if (token.type === "keyword" && token.value === "direction") {
374
+ advance$1(state);
375
+ const dir = peek$1(state);
376
+ if (dir.type === "identifier" || dir.type === "keyword") {
377
+ state.direction = dir.value;
378
+ advance$1(state);
379
+ }
380
+ skipSemicolon(state);
381
+ continue;
382
+ }
383
+ if (token.type === "keyword" && token.value === "end") break;
384
+ const result = parseStatement(state);
385
+ if (result && "message" in result) return result;
386
+ }
387
+ return {
388
+ type: "flowchart",
389
+ direction: state.direction,
390
+ nodes: Array.from(state.nodes.values()),
391
+ edges: state.edges,
392
+ subgraphs: state.subgraphs
393
+ };
394
+ }
395
+ function parseHeader(state) {
396
+ skipNewlines$1(state);
397
+ const token = peek$1(state);
398
+ if (token.type !== "keyword" || token.value !== "graph" && token.value !== "flowchart") return false;
399
+ advance$1(state);
400
+ skipNewlines$1(state);
401
+ const dir = peek$1(state);
402
+ if (dir.type === "identifier" || dir.type === "keyword") {
403
+ const dirVal = dir.value.toUpperCase();
404
+ if ([
405
+ "TB",
406
+ "TD",
407
+ "BT",
408
+ "LR",
409
+ "RL"
410
+ ].includes(dirVal)) {
411
+ state.direction = dirVal;
412
+ advance$1(state);
413
+ }
414
+ }
415
+ skipSemicolon(state);
416
+ return true;
417
+ }
418
+ function parseStatement(state) {
419
+ let currentNode = parseNodeRef(state);
420
+ if (!currentNode) {
421
+ advance$1(state);
422
+ return;
423
+ }
424
+ while (!isEof$1(state) && peek$1(state).type === "arrow") {
425
+ const arrowToken = advance$1(state);
426
+ const { lineStyle, sourceMarker, targetMarker } = parseArrow(arrowToken.value);
427
+ let edgeLabel;
428
+ if (arrowToken.value.endsWith("|")) edgeLabel = parseEdgeLabel(state);
429
+ else if (peek$1(state).type === "pipe") {
430
+ advance$1(state);
431
+ edgeLabel = parseEdgeLabel(state);
432
+ }
433
+ const targetNode = parseNodeRef(state);
434
+ if (!targetNode) return {
435
+ message: "Expected target node after arrow",
436
+ line: arrowToken.line,
437
+ column: arrowToken.column
438
+ };
439
+ state.edges.push({
440
+ source: currentNode,
441
+ target: targetNode,
442
+ lineStyle,
443
+ sourceMarker,
444
+ targetMarker,
445
+ label: edgeLabel
446
+ });
447
+ currentNode = targetNode;
448
+ }
449
+ skipSemicolon(state);
450
+ }
451
+ function parseNodeRef(state) {
452
+ skipNewlines$1(state);
453
+ const token = peek$1(state);
454
+ if (token.type !== "identifier" && token.type !== "keyword") return;
455
+ if (token.type === "keyword" && [
456
+ "subgraph",
457
+ "end",
458
+ "direction"
459
+ ].includes(token.value)) return;
460
+ const id = token.value;
461
+ advance$1(state);
462
+ const next = peek$1(state);
463
+ if (next.type === "openBracket" || next.type === "openParen" || next.type === "openBrace") {
464
+ const shape = parseNodeShape(state, id);
465
+ if (shape) {
466
+ if (!state.nodes.has(id)) state.nodes.set(id, shape);
467
+ return id;
468
+ }
469
+ }
470
+ if (!state.nodes.has(id)) state.nodes.set(id, {
471
+ id,
472
+ label: id,
473
+ shape: "rect"
474
+ });
475
+ return id;
476
+ }
477
+ function parseNodeShape(state, id) {
478
+ const open = peek$1(state);
479
+ if (open.value === "[") {
480
+ advance$1(state);
481
+ const next = peek$1(state);
482
+ if (next.type === "openParen") {
483
+ advance$1(state);
484
+ const label = readUntil(state, "closeParen");
485
+ expect(state, "closeBracket");
486
+ return {
487
+ id,
488
+ label,
489
+ shape: "cylinder"
490
+ };
491
+ }
492
+ if (next.type === "openBracket") {
493
+ advance$1(state);
494
+ const label = readUntil(state, "closeBracket");
495
+ expect(state, "closeBracket");
496
+ return {
497
+ id,
498
+ label,
499
+ shape: "subroutine"
500
+ };
501
+ }
502
+ return {
503
+ id,
504
+ label: readUntil(state, "closeBracket"),
505
+ shape: "rect"
506
+ };
507
+ }
508
+ if (open.value === "(") {
509
+ advance$1(state);
510
+ const next = peek$1(state);
511
+ if (next.type === "openParen" || next.value === "(") {
512
+ advance$1(state);
513
+ const label = readUntil(state, "closeParen");
514
+ if (peek$1(state).type === "closeParen") advance$1(state);
515
+ return {
516
+ id,
517
+ label,
518
+ shape: "double-circle"
519
+ };
520
+ }
521
+ if (next.type === "openBracket") {
522
+ advance$1(state);
523
+ const label = readUntil(state, "closeBracket");
524
+ expect(state, "closeParen");
525
+ return {
526
+ id,
527
+ label,
528
+ shape: "stadium"
529
+ };
530
+ }
531
+ return {
532
+ id,
533
+ label: readUntil(state, "closeParen"),
534
+ shape: "round"
535
+ };
536
+ }
537
+ if (open.value === "((") {
538
+ advance$1(state);
539
+ const label = readUntil(state, "closeParen");
540
+ if (peek$1(state).type === "closeParen") advance$1(state);
541
+ return {
542
+ id,
543
+ label,
544
+ shape: "double-circle"
545
+ };
546
+ }
547
+ if (open.value === "{") {
548
+ advance$1(state);
549
+ if (peek$1(state).type === "openBrace") {
550
+ advance$1(state);
551
+ const label = readUntil(state, "closeBrace");
552
+ expect(state, "closeBrace");
553
+ return {
554
+ id,
555
+ label,
556
+ shape: "hexagon"
557
+ };
558
+ }
559
+ return {
560
+ id,
561
+ label: readUntil(state, "closeBrace"),
562
+ shape: "rhombus"
563
+ };
564
+ }
565
+ if (open.value === ">") {
566
+ advance$1(state);
567
+ return {
568
+ id,
569
+ label: readUntil(state, "closeBracket"),
570
+ shape: "asymmetric"
571
+ };
572
+ }
573
+ }
574
+ function parseEdgeLabel(state) {
575
+ let label = "";
576
+ while (!isEof$1(state) && peek$1(state).type !== "pipe") {
577
+ label += peek$1(state).value;
578
+ advance$1(state);
579
+ }
580
+ if (peek$1(state).type === "pipe") advance$1(state);
581
+ return label.trim();
582
+ }
583
+ function parseSubgraph(state) {
584
+ advance$1(state);
585
+ skipNewlines$1(state);
586
+ let id = "";
587
+ let label = "";
588
+ const next = peek$1(state);
589
+ if (next.type === "identifier" || next.type === "keyword") {
590
+ id = next.value;
591
+ label = id;
592
+ advance$1(state);
593
+ }
594
+ if (peek$1(state).type === "openBracket") {
595
+ advance$1(state);
596
+ label = readUntil(state, "closeBracket");
597
+ }
598
+ skipSemicolon(state);
599
+ skipNewlines$1(state);
600
+ let direction;
601
+ if (peek$1(state).type === "keyword" && peek$1(state).value === "direction") {
602
+ advance$1(state);
603
+ const dir = peek$1(state);
604
+ if (dir.type === "identifier" || dir.type === "keyword") {
605
+ direction = dir.value;
606
+ advance$1(state);
607
+ }
608
+ skipSemicolon(state);
609
+ }
610
+ const nodesBefore = new Set(state.nodes.keys());
611
+ const nodeIds = [];
612
+ while (!isEof$1(state)) {
613
+ skipNewlines$1(state);
614
+ if (isEof$1(state)) break;
615
+ const token = peek$1(state);
616
+ if (token.type === "keyword" && token.value === "end") {
617
+ advance$1(state);
618
+ break;
619
+ }
620
+ const result = parseStatement(state);
621
+ if (result && "message" in result) return result;
622
+ for (const [nodeId] of state.nodes) if (!nodesBefore.has(nodeId) && !nodeIds.includes(nodeId)) nodeIds.push(nodeId);
623
+ }
624
+ state.subgraphs.push({
625
+ id: id || `subgraph_${state.subgraphs.length}`,
626
+ label,
627
+ nodes: nodeIds,
628
+ direction
629
+ });
630
+ return { ok: true };
631
+ }
632
+ function parseArrow(arrow) {
633
+ const raw = arrow.endsWith("|") ? arrow.slice(0, -1) : arrow;
634
+ let sourceMarker = "none";
635
+ let rest = raw;
636
+ if (rest.startsWith("o")) {
637
+ sourceMarker = "dot";
638
+ rest = rest.slice(1);
639
+ } else if (rest.startsWith("x")) {
640
+ sourceMarker = "cross";
641
+ rest = rest.slice(1);
642
+ } else if (rest.startsWith("<")) {
643
+ sourceMarker = "arrow";
644
+ rest = rest.slice(1);
645
+ }
646
+ let targetMarker = "none";
647
+ if (rest.endsWith(">")) {
648
+ targetMarker = "arrow";
649
+ rest = rest.slice(0, -1);
650
+ } else if (rest.endsWith("o")) {
651
+ targetMarker = "dot";
652
+ rest = rest.slice(0, -1);
653
+ } else if (rest.endsWith("x")) {
654
+ targetMarker = "cross";
655
+ rest = rest.slice(0, -1);
656
+ }
657
+ let lineStyle = "solid";
658
+ if (rest.includes("-.") || rest.includes(".-")) lineStyle = "dotted";
659
+ else if (rest.startsWith("==") || rest.startsWith("=")) lineStyle = "thick";
660
+ return {
661
+ lineStyle,
662
+ sourceMarker,
663
+ targetMarker
664
+ };
665
+ }
666
+ function peek$1(state) {
667
+ return state.tokens[state.pos] ?? {
668
+ type: "eof",
669
+ value: "",
670
+ line: 0,
671
+ column: 0
672
+ };
673
+ }
674
+ function advance$1(state) {
675
+ const token = state.tokens[state.pos] ?? {
676
+ type: "eof",
677
+ value: "",
678
+ line: 0,
679
+ column: 0
680
+ };
681
+ if (state.pos < state.tokens.length) state.pos++;
682
+ return token;
683
+ }
684
+ function isEof$1(state) {
685
+ return state.pos >= state.tokens.length || state.tokens[state.pos]?.type === "eof";
686
+ }
687
+ function skipNewlines$1(state) {
688
+ while (!isEof$1(state) && peek$1(state).type === "newline") advance$1(state);
689
+ }
690
+ function skipSemicolon(state) {
691
+ if (!isEof$1(state) && peek$1(state).type === "semicolon") advance$1(state);
692
+ }
693
+ function expect(state, type) {
694
+ if (peek$1(state).type === type) return advance$1(state);
695
+ }
696
+ function readUntil(state, closeType) {
697
+ let value = "";
698
+ while (!isEof$1(state) && peek$1(state).type !== closeType) {
699
+ if (value) value += " ";
700
+ value += peek$1(state).value;
701
+ advance$1(state);
702
+ }
703
+ if (peek$1(state).type === closeType) advance$1(state);
704
+ return value.trim();
705
+ }
706
+
707
+ //#endregion
708
+ //#region ../mermaid/src/parser/sequence.ts
709
+ function parseSequence(input) {
710
+ const state = {
711
+ tokens: filterTokens(tokenize(input)),
712
+ pos: 0,
713
+ participants: /* @__PURE__ */ new Map(),
714
+ messages: [],
715
+ blocks: [],
716
+ notes: []
717
+ };
718
+ skipNewlines(state);
719
+ const header = peek(state);
720
+ if (header.type !== "keyword" || header.value !== "sequenceDiagram") return {
721
+ message: "Expected 'sequenceDiagram' keyword",
722
+ line: header.line,
723
+ column: header.column
724
+ };
725
+ advance(state);
726
+ skipNewlines(state);
727
+ while (!isEof(state)) {
728
+ skipNewlines(state);
729
+ if (isEof(state)) break;
730
+ const token = peek(state);
731
+ if (token.type === "keyword" && (token.value === "participant" || token.value === "actor")) {
732
+ parseParticipant(state, token.value);
733
+ continue;
734
+ }
735
+ if (token.type === "keyword" && (token.value === "activate" || token.value === "deactivate")) {
736
+ advance(state);
737
+ skipNewlines(state);
738
+ if (!isEof(state) && peek(state).type === "identifier") advance(state);
739
+ skipNewlines(state);
740
+ continue;
741
+ }
742
+ if (token.type === "keyword" && token.value === "Note") {
743
+ const result = parseNote(state);
744
+ if (result && "message" in result) return result;
745
+ continue;
746
+ }
747
+ if (token.type === "keyword" && isBlockKeyword(token.value)) {
748
+ const result = parseBlock(state);
749
+ if ("message" in result) return result;
750
+ continue;
751
+ }
752
+ if (token.type === "keyword" && token.value === "end") break;
753
+ if (token.type === "identifier" || token.type === "keyword") {
754
+ const result = parseMessage(state);
755
+ if (result && "message" in result && "line" in result) return result;
756
+ continue;
757
+ }
758
+ advance(state);
759
+ }
760
+ return {
761
+ type: "sequence",
762
+ participants: Array.from(state.participants.values()),
763
+ messages: state.messages,
764
+ blocks: state.blocks,
765
+ notes: state.notes
766
+ };
767
+ }
768
+ function parseParticipant(state, type) {
769
+ advance(state);
770
+ skipNewlines(state);
771
+ const idToken = peek(state);
772
+ if (idToken.type !== "identifier" && idToken.type !== "keyword") return;
773
+ const id = idToken.value;
774
+ advance(state);
775
+ let label = id;
776
+ if (peek(state).type === "keyword" && peek(state).value === "as") {
777
+ advance(state);
778
+ label = readRestOfLine(state);
779
+ }
780
+ state.participants.set(id, {
781
+ id,
782
+ label,
783
+ type
784
+ });
785
+ skipNewlines(state);
786
+ }
787
+ function parseMessage(state) {
788
+ const from = peek(state).value;
789
+ advance(state);
790
+ ensureParticipant(state, from);
791
+ if (peek(state).type !== "arrow") {
792
+ skipToEndOfLine(state);
793
+ return;
794
+ }
795
+ const arrowToken = advance(state);
796
+ const arrow = arrowToType(arrowToken.value);
797
+ const toToken = peek(state);
798
+ if (toToken.type !== "identifier" && toToken.type !== "keyword") return {
799
+ message: `Expected target after arrow at line ${arrowToken.line}`,
800
+ line: arrowToken.line,
801
+ column: arrowToken.column
802
+ };
803
+ const to = toToken.value;
804
+ advance(state);
805
+ ensureParticipant(state, to);
806
+ let text = "";
807
+ if (peek(state).type === "colon") {
808
+ advance(state);
809
+ text = readRestOfLine(state);
810
+ }
811
+ const activate = arrowToken.value.includes("+") || void 0;
812
+ const deactivate = arrowToken.value.includes("-") || void 0;
813
+ state.messages.push({
814
+ from,
815
+ to,
816
+ text,
817
+ arrow,
818
+ activate,
819
+ deactivate
820
+ });
821
+ skipNewlines(state);
822
+ }
823
+ function parseNote(state) {
824
+ advance(state);
825
+ let position;
826
+ const posToken = peek(state);
827
+ if (posToken.value === "left" || posToken.value === "right") {
828
+ const side = posToken.value;
829
+ advance(state);
830
+ if (peek(state).value === "of") advance(state);
831
+ position = `${side} of`;
832
+ } else if (posToken.value === "over") {
833
+ advance(state);
834
+ position = "over";
835
+ } else return {
836
+ message: `Expected note position (left of, right of, over) at line ${posToken.line}`,
837
+ line: posToken.line,
838
+ column: posToken.column
839
+ };
840
+ const participants = [];
841
+ while (!isEof(state) && peek(state).type !== "colon" && peek(state).type !== "newline") {
842
+ const p = peek(state);
843
+ if (p.type === "identifier" || p.type === "keyword") {
844
+ participants.push(p.value);
845
+ ensureParticipant(state, p.value);
846
+ }
847
+ advance(state);
848
+ }
849
+ let text = "";
850
+ if (peek(state).type === "colon") {
851
+ advance(state);
852
+ text = readRestOfLine(state);
853
+ }
854
+ state.notes.push({
855
+ position,
856
+ participants,
857
+ text
858
+ });
859
+ skipNewlines(state);
860
+ }
861
+ function parseBlock(state) {
862
+ const blockType = advance(state).value;
863
+ let label = "";
864
+ if (peek(state).type !== "newline" && !isEof(state)) label = readRestOfLine(state);
865
+ skipNewlines(state);
866
+ const messages = [];
867
+ const sections = [];
868
+ let currentSection;
869
+ while (!isEof(state)) {
870
+ skipNewlines(state);
871
+ if (isEof(state)) break;
872
+ const token = peek(state);
873
+ if (token.type === "keyword" && token.value === "end") {
874
+ advance(state);
875
+ break;
876
+ }
877
+ if (token.type === "keyword" && token.value === "else") {
878
+ advance(state);
879
+ const sectionLabel = readRestOfLine(state);
880
+ if (currentSection) sections.push(currentSection);
881
+ currentSection = {
882
+ label: sectionLabel,
883
+ messages: []
884
+ };
885
+ skipNewlines(state);
886
+ continue;
887
+ }
888
+ if (token.type === "keyword" && token.value === "and") {
889
+ advance(state);
890
+ const sectionLabel = readRestOfLine(state);
891
+ if (currentSection) sections.push(currentSection);
892
+ currentSection = {
893
+ label: sectionLabel,
894
+ messages: []
895
+ };
896
+ skipNewlines(state);
897
+ continue;
898
+ }
899
+ if (token.type === "keyword" && token.value === "Note") {
900
+ parseNote(state);
901
+ continue;
902
+ }
903
+ if (token.type === "identifier" || token.type === "keyword") {
904
+ const beforeLen = state.messages.length;
905
+ parseMessage(state);
906
+ if (state.messages.length > beforeLen) {
907
+ const msg = state.messages.pop();
908
+ if (currentSection) currentSection.messages.push(msg);
909
+ else messages.push(msg);
910
+ }
911
+ continue;
912
+ }
913
+ advance(state);
914
+ }
915
+ if (currentSection) sections.push(currentSection);
916
+ state.blocks.push({
917
+ type: blockType,
918
+ label,
919
+ messages,
920
+ sections: sections.length > 0 ? sections : void 0
921
+ });
922
+ skipNewlines(state);
923
+ return { ok: true };
924
+ }
925
+ function arrowToType(arrow) {
926
+ if (arrow === "->>") return "solid";
927
+ if (arrow === "-->>") return "dotted";
928
+ if (arrow === "-x" || arrow === "-X") return "solidCross";
929
+ if (arrow === "--x" || arrow === "--X") return "dottedCross";
930
+ if (arrow === "-))") return "solidOpen";
931
+ if (arrow === "--))") return "dottedOpen";
932
+ if (arrow === "->") return "solid";
933
+ return "solid";
934
+ }
935
+ function isBlockKeyword(value) {
936
+ return [
937
+ "loop",
938
+ "alt",
939
+ "opt",
940
+ "par",
941
+ "critical",
942
+ "break"
943
+ ].includes(value);
944
+ }
945
+ function ensureParticipant(state, id) {
946
+ if (!state.participants.has(id)) state.participants.set(id, {
947
+ id,
948
+ label: id,
949
+ type: "participant"
950
+ });
951
+ }
952
+ function peek(state) {
953
+ return state.tokens[state.pos] ?? {
954
+ type: "eof",
955
+ value: "",
956
+ line: 0,
957
+ column: 0
958
+ };
959
+ }
960
+ function advance(state) {
961
+ const token = state.tokens[state.pos] ?? {
962
+ type: "eof",
963
+ value: "",
964
+ line: 0,
965
+ column: 0
966
+ };
967
+ if (state.pos < state.tokens.length) state.pos++;
968
+ return token;
969
+ }
970
+ function isEof(state) {
971
+ return state.pos >= state.tokens.length || state.tokens[state.pos]?.type === "eof";
972
+ }
973
+ function skipNewlines(state) {
974
+ while (!isEof(state) && peek(state).type === "newline") advance(state);
975
+ }
976
+ function skipToEndOfLine(state) {
977
+ while (!isEof(state) && peek(state).type !== "newline") advance(state);
978
+ }
979
+ function readRestOfLine(state) {
980
+ let text = "";
981
+ while (!isEof(state) && peek(state).type !== "newline" && peek(state).type !== "semicolon") {
982
+ if (text) text += " ";
983
+ text += peek(state).value;
984
+ advance(state);
985
+ }
986
+ return text.trim();
987
+ }
988
+
989
+ //#endregion
990
+ //#region ../mermaid/src/parser/index.ts
991
+ /**
992
+ * Parse a Mermaid DSL string into a structured diagram IR.
993
+ *
994
+ * Returns a FlowchartDiagram, SequenceDiagram, or ParseError.
995
+ * Check for errors with: `if ("message" in result)`
996
+ */
997
+ function parse(input) {
998
+ const trimmed = input.trim();
999
+ if (trimmed.startsWith("sequenceDiagram")) return parseSequence(trimmed);
1000
+ if (trimmed.startsWith("graph") || trimmed.startsWith("flowchart")) return parseFlowchart(trimmed);
1001
+ return {
1002
+ message: `Unknown diagram type. Expected 'graph', 'flowchart', or 'sequenceDiagram'.`,
1003
+ line: 1,
1004
+ column: 1
1005
+ };
1006
+ }
1007
+
1008
+ //#endregion
1009
+ //#region ../mermaid/src/root.style.ts
1010
+ const c$15 = classes(["svgRoot"]);
1011
+ const svgRoot = rule`${c$15.svgRoot} {
1012
+ width: 100%;
1013
+ height: auto;
1014
+ font-family: inherit;
1015
+ }`;
1016
+
1017
+ //#endregion
1018
+ //#region ../mermaid/src/tokens.ts
1019
+ const tokenDefinition$1 = {
1020
+ nodeFill: "#e8f4f8",
1021
+ nodeStroke: "#23395d",
1022
+ nodeText: "#1d1d1f",
1023
+ nodeRadius: "8",
1024
+ edgeStroke: "#666",
1025
+ edgeWidth: "2",
1026
+ edgeLabelBg: "#fff",
1027
+ edgeLabelText: "#333",
1028
+ arrowFill: "#666",
1029
+ animatedDashArray: "5",
1030
+ animatedDuration: "0.5s",
1031
+ animatedDashOffset: "10",
1032
+ subgraphFill: "#f8f9fa",
1033
+ subgraphStroke: "#ccc",
1034
+ subgraphTitleBg: "#eee",
1035
+ subgraphTitleText: "#333",
1036
+ actorFill: "#e8f4f8",
1037
+ actorStroke: "#23395d",
1038
+ lifelineStroke: "#999",
1039
+ activationFill: "#d4e6f1",
1040
+ messageStroke: "#333",
1041
+ blockFill: "rgba(200,200,200,0.1)",
1042
+ blockStroke: "#aaa",
1043
+ noteBg: "#fffacd",
1044
+ noteStroke: "#e6d800",
1045
+ noteText: "#333",
1046
+ bgColor: "#ffffff",
1047
+ gridDotColor: "rgba(0, 0, 0, 0.1)",
1048
+ gridDotGap: "20",
1049
+ gridDotRadius: "1",
1050
+ fontFamily: "-apple-system, BlinkMacSystemFont, 'Inter', sans-serif",
1051
+ fontSize: "14"
1052
+ };
1053
+ const tokens$1 = defineTokens(tokenDefinition$1);
1054
+ /**
1055
+ * Default mermaid theme — sets CSS custom properties on :root.
1056
+ * Embed its __cssTemplate in an SVG <style> for self-contained rendering.
1057
+ */
1058
+ const defaultTheme = createTheme(tokens$1);
1059
+
1060
+ //#endregion
1061
+ //#region ../mermaid/src/edge.style.ts
1062
+ const c$14 = classes([
1063
+ "edgeLine",
1064
+ "edgeInteraction",
1065
+ "edgeArrow",
1066
+ "edgeDotted",
1067
+ "edgeThick",
1068
+ "edgeAnimated",
1069
+ "edgeLabel",
1070
+ "edgeLabelBg",
1071
+ "arrowHead",
1072
+ "arrowHeadClosed",
1073
+ "dotMarker",
1074
+ "crossMarker"
1075
+ ]);
1076
+ const edgeLine = rule`${c$14.edgeLine} {
1077
+ fill: none;
1078
+ stroke: ${tokens$1.edgeStroke};
1079
+ stroke-width: ${tokens$1.edgeWidth};
1080
+ stroke-linecap: round;
1081
+ stroke-linejoin: round;
1082
+ }`;
1083
+ const edgeInteraction = rule`${c$14.edgeInteraction} {
1084
+ fill: none;
1085
+ stroke-opacity: 0;
1086
+ stroke-width: 20;
1087
+ }`;
1088
+ const edgeDotted = rule`${c$14.edgeDotted} {
1089
+ stroke-dasharray: 6, 4;
1090
+ }`;
1091
+ const edgeAnimated = rule`${c$14.edgeAnimated} {
1092
+ stroke-dasharray: ${tokens$1.animatedDashArray};
1093
+ animation: mmd-dash-flow ${tokens$1.animatedDuration} linear infinite;
1094
+ }`;
1095
+ const edgeAnimatedKeyframes = rule`
1096
+ @keyframes mmd-dash-flow {
1097
+ from {
1098
+ stroke-dashoffset: ${tokens$1.animatedDashOffset};
1099
+ }
1100
+ }
1101
+ `;
1102
+ const edgeThick = rule`${c$14.edgeThick} {
1103
+ stroke-width: 3;
1104
+ }`;
1105
+ const edgeLabel = rule`${c$14.edgeLabel} {
1106
+ fill: ${tokens$1.edgeLabelText};
1107
+ stroke: none;
1108
+ font-family: ${tokens$1.fontFamily};
1109
+ font-size: 12px;
1110
+ text-anchor: middle;
1111
+ dominant-baseline: central;
1112
+ }`;
1113
+ const edgeLabelBg = rule`${c$14.edgeLabelBg} {
1114
+ fill: ${tokens$1.edgeLabelBg};
1115
+ stroke: none;
1116
+ }`;
1117
+ const arrowHead = rule`${c$14.arrowHead} {
1118
+ fill: none;
1119
+ stroke: ${tokens$1.arrowFill};
1120
+ stroke-width: 1;
1121
+ stroke-linecap: round;
1122
+ stroke-linejoin: round;
1123
+ }`;
1124
+ const arrowHeadClosed = rule`${c$14.arrowHeadClosed} {
1125
+ fill: ${tokens$1.arrowFill};
1126
+ stroke: ${tokens$1.arrowFill};
1127
+ stroke-width: 1.5;
1128
+ stroke-linecap: round;
1129
+ stroke-linejoin: round;
1130
+ }`;
1131
+ const dotMarker = rule`${c$14.dotMarker} {
1132
+ fill: ${tokens$1.bgColor};
1133
+ stroke: ${tokens$1.edgeStroke};
1134
+ stroke-width: 1.5;
1135
+ }`;
1136
+ const crossMarker = rule`${c$14.crossMarker} {
1137
+ fill: none;
1138
+ stroke: ${tokens$1.edgeStroke};
1139
+ stroke-width: 2;
1140
+ stroke-linecap: round;
1141
+ }`;
1142
+
1143
+ //#endregion
1144
+ //#region ../mermaid/src/components/defs.tsx
1145
+ /**
1146
+ * Arrow markers follow xyflow conventions:
1147
+ * - viewBox "-10 -10 20 20", tip at origin (0,0)
1148
+ * - refX=0 so the arrow tip aligns with the path endpoint
1149
+ * - markerUnits="strokeWidth" for automatic scaling
1150
+ *
1151
+ * Closed arrow: polyline "-5,-4 0,0 -5,4 -5,-4" (filled triangle)
1152
+ * Open arrow: polyline "-5,-4 0,0 -5,4" (chevron)
1153
+ */
1154
+ const ARROW_CLOSED_POINTS = "-5,-4 0,0 -5,4 -5,-4";
1155
+ const ARROW_OPEN_POINTS = "-5,-4 0,0 -5,4";
1156
+ /** Dot marker radius in marker coordinate space. */
1157
+ const DOT_RADIUS = 4;
1158
+ function Defs() {
1159
+ return /* @__PURE__ */ jsxs("defs", { children: [
1160
+ /* @__PURE__ */ jsx("pattern", {
1161
+ id: "mmd-grid",
1162
+ x: 0,
1163
+ y: 0,
1164
+ width: tokens$1.gridDotGap,
1165
+ height: tokens$1.gridDotGap,
1166
+ patternUnits: "userSpaceOnUse",
1167
+ children: /* @__PURE__ */ jsx("circle", {
1168
+ cx: tokens$1.gridDotGap,
1169
+ cy: tokens$1.gridDotGap,
1170
+ r: tokens$1.gridDotRadius,
1171
+ fill: tokens$1.gridDotColor
1172
+ })
1173
+ }),
1174
+ /* @__PURE__ */ jsx("marker", {
1175
+ id: "mmd-arrow",
1176
+ viewBox: "-10 -10 20 20",
1177
+ refX: 0,
1178
+ refY: 0,
1179
+ markerWidth: 12.5,
1180
+ markerHeight: 12.5,
1181
+ markerUnits: "strokeWidth",
1182
+ orient: "auto-start-reverse",
1183
+ children: /* @__PURE__ */ jsx("polyline", {
1184
+ class: arrowHeadClosed,
1185
+ points: ARROW_CLOSED_POINTS,
1186
+ "stroke-linecap": "round",
1187
+ "stroke-linejoin": "round"
1188
+ })
1189
+ }),
1190
+ /* @__PURE__ */ jsx("marker", {
1191
+ id: "mmd-arrow-filled",
1192
+ viewBox: "-10 -10 20 20",
1193
+ refX: 0,
1194
+ refY: 0,
1195
+ markerWidth: 12.5,
1196
+ markerHeight: 12.5,
1197
+ markerUnits: "strokeWidth",
1198
+ orient: "auto-start-reverse",
1199
+ children: /* @__PURE__ */ jsx("polyline", {
1200
+ class: arrowHeadClosed,
1201
+ points: ARROW_CLOSED_POINTS,
1202
+ "stroke-linecap": "round",
1203
+ "stroke-linejoin": "round"
1204
+ })
1205
+ }),
1206
+ /* @__PURE__ */ jsx("marker", {
1207
+ id: "mmd-arrow-open",
1208
+ viewBox: "-10 -10 20 20",
1209
+ refX: 0,
1210
+ refY: 0,
1211
+ markerWidth: 12.5,
1212
+ markerHeight: 12.5,
1213
+ markerUnits: "strokeWidth",
1214
+ orient: "auto-start-reverse",
1215
+ children: /* @__PURE__ */ jsx("polyline", {
1216
+ class: arrowHead,
1217
+ points: ARROW_OPEN_POINTS,
1218
+ "stroke-linecap": "round",
1219
+ "stroke-linejoin": "round"
1220
+ })
1221
+ }),
1222
+ /* @__PURE__ */ jsx("marker", {
1223
+ id: "mmd-dot",
1224
+ viewBox: "-10 -10 20 20",
1225
+ refX: 0,
1226
+ refY: 0,
1227
+ markerWidth: 8,
1228
+ markerHeight: 8,
1229
+ markerUnits: "strokeWidth",
1230
+ orient: "auto-start-reverse",
1231
+ children: /* @__PURE__ */ jsx("circle", {
1232
+ class: dotMarker,
1233
+ cx: 0,
1234
+ cy: 0,
1235
+ r: DOT_RADIUS
1236
+ })
1237
+ }),
1238
+ /* @__PURE__ */ jsx("marker", {
1239
+ id: "mmd-cross",
1240
+ viewBox: "-10 -10 20 20",
1241
+ refX: 0,
1242
+ refY: 0,
1243
+ markerWidth: 10,
1244
+ markerHeight: 10,
1245
+ markerUnits: "strokeWidth",
1246
+ orient: "auto-start-reverse",
1247
+ children: /* @__PURE__ */ jsx("path", {
1248
+ class: crossMarker,
1249
+ d: "M -4,-4 L 4,4 M -4,4 L 4,-4"
1250
+ })
1251
+ })
1252
+ ] });
1253
+ }
1254
+
1255
+ //#endregion
1256
+ //#region ../mermaid/src/node.style.ts
1257
+ const c$13 = classes([
1258
+ "node",
1259
+ "nodeShape",
1260
+ "nodeRect",
1261
+ "nodeRound",
1262
+ "nodeCircle",
1263
+ "nodeRhombus",
1264
+ "nodeHexagon",
1265
+ "nodeCylinder",
1266
+ "nodeStadium",
1267
+ "nodeLabel"
1268
+ ]);
1269
+ const nodeShape = rule`${c$13.nodeShape} {
1270
+ fill: ${tokens$1.nodeFill};
1271
+ stroke: ${tokens$1.nodeStroke};
1272
+ stroke-width: ${tokens$1.edgeWidth};
1273
+ }`;
1274
+ const nodeShapeHover = rule`${c$13.nodeShape} {
1275
+ transition: filter 0.15s ease;
1276
+ cursor: pointer;
1277
+ }
1278
+ ${c$13.nodeShape}:hover {
1279
+ filter: brightness(0.93);
1280
+ }`;
1281
+ const nodeLabel = rule`${c$13.nodeLabel} {
1282
+ fill: ${tokens$1.nodeText};
1283
+ stroke: none;
1284
+ font-family: ${tokens$1.fontFamily};
1285
+ font-size: ${tokens$1.fontSize}px;
1286
+ text-anchor: middle;
1287
+ dominant-baseline: central;
1288
+ pointer-events: none;
1289
+ }`;
1290
+
1291
+ //#endregion
1292
+ //#region ../mermaid/src/components/nodes/rect.tsx
1293
+ function RectNode(props) {
1294
+ const { node, x, y, width, height } = props.positioned;
1295
+ return /* @__PURE__ */ jsxs("g", {
1296
+ class: [c$13.node, props.class],
1297
+ transform: `translate(${x}, ${y})`,
1298
+ children: [/* @__PURE__ */ jsx("rect", {
1299
+ class: [nodeShape, nodeShapeHover],
1300
+ x: -width / 2,
1301
+ y: -height / 2,
1302
+ width,
1303
+ height,
1304
+ rx: 12
1305
+ }), /* @__PURE__ */ jsx("text", {
1306
+ class: nodeLabel,
1307
+ children: node.label
1308
+ })]
1309
+ });
1310
+ }
1311
+
1312
+ //#endregion
1313
+ //#region ../mermaid/src/components/nodes/round.tsx
1314
+ function RoundNode(props) {
1315
+ const { node, x, y, width, height } = props.positioned;
1316
+ return /* @__PURE__ */ jsxs("g", {
1317
+ class: [c$13.node, props.class],
1318
+ transform: `translate(${x}, ${y})`,
1319
+ children: [/* @__PURE__ */ jsx("rect", {
1320
+ class: [nodeShape, nodeShapeHover],
1321
+ x: -width / 2,
1322
+ y: -height / 2,
1323
+ width,
1324
+ height,
1325
+ rx: height / 2
1326
+ }), /* @__PURE__ */ jsx("text", {
1327
+ class: nodeLabel,
1328
+ children: node.label
1329
+ })]
1330
+ });
1331
+ }
1332
+
1333
+ //#endregion
1334
+ //#region ../mermaid/src/components/nodes/circle.tsx
1335
+ function CircleNode(props) {
1336
+ const { node, x, y, width } = props.positioned;
1337
+ return /* @__PURE__ */ jsxs("g", {
1338
+ class: [c$13.node, props.class],
1339
+ transform: `translate(${x}, ${y})`,
1340
+ children: [/* @__PURE__ */ jsx("circle", {
1341
+ class: [nodeShape, nodeShapeHover],
1342
+ r: width / 2
1343
+ }), /* @__PURE__ */ jsx("text", {
1344
+ class: nodeLabel,
1345
+ children: node.label
1346
+ })]
1347
+ });
1348
+ }
1349
+
1350
+ //#endregion
1351
+ //#region ../mermaid/src/components/nodes/rhombus.tsx
1352
+ function RhombusNode(props) {
1353
+ const { node, x, y, width, height } = props.positioned;
1354
+ const hw = width / 2;
1355
+ const hh = height / 2;
1356
+ return /* @__PURE__ */ jsxs("g", {
1357
+ class: [c$13.node, props.class],
1358
+ transform: `translate(${x}, ${y})`,
1359
+ children: [/* @__PURE__ */ jsx("polygon", {
1360
+ class: [nodeShape, nodeShapeHover],
1361
+ points: `0,${-hh} ${hw},0 0,${hh} ${-hw},0`
1362
+ }), /* @__PURE__ */ jsx("text", {
1363
+ class: nodeLabel,
1364
+ children: node.label
1365
+ })]
1366
+ });
1367
+ }
1368
+
1369
+ //#endregion
1370
+ //#region ../mermaid/src/components/nodes/hexagon.tsx
1371
+ function HexagonNode(props) {
1372
+ const { node, x, y, width, height } = props.positioned;
1373
+ const hw = width / 2;
1374
+ const hh = height / 2;
1375
+ const inset = width * .15;
1376
+ return /* @__PURE__ */ jsxs("g", {
1377
+ class: [c$13.node, props.class],
1378
+ transform: `translate(${x}, ${y})`,
1379
+ children: [/* @__PURE__ */ jsx("polygon", {
1380
+ class: [nodeShape, nodeShapeHover],
1381
+ points: `${-hw + inset},${-hh} ${hw - inset},${-hh} ${hw},0 ${hw - inset},${hh} ${-hw + inset},${hh} ${-hw},0`
1382
+ }), /* @__PURE__ */ jsx("text", {
1383
+ class: nodeLabel,
1384
+ children: node.label
1385
+ })]
1386
+ });
1387
+ }
1388
+
1389
+ //#endregion
1390
+ //#region ../mermaid/src/components/nodes/stadium.tsx
1391
+ function StadiumNode(props) {
1392
+ const { node, x, y, width, height } = props.positioned;
1393
+ return /* @__PURE__ */ jsxs("g", {
1394
+ class: [c$13.node, props.class],
1395
+ transform: `translate(${x}, ${y})`,
1396
+ children: [/* @__PURE__ */ jsx("rect", {
1397
+ class: [nodeShape, nodeShapeHover],
1398
+ x: -width / 2,
1399
+ y: -height / 2,
1400
+ width,
1401
+ height,
1402
+ rx: height / 2,
1403
+ ry: height / 2
1404
+ }), /* @__PURE__ */ jsx("text", {
1405
+ class: nodeLabel,
1406
+ children: node.label
1407
+ })]
1408
+ });
1409
+ }
1410
+
1411
+ //#endregion
1412
+ //#region ../mermaid/src/components/nodes/cylinder.tsx
1413
+ function CylinderNode(props) {
1414
+ const { node, x, y, width, height } = props.positioned;
1415
+ const hw = width / 2;
1416
+ const hh = height / 2;
1417
+ const ry = 8;
1418
+ return /* @__PURE__ */ jsxs("g", {
1419
+ class: [c$13.node, props.class],
1420
+ transform: `translate(${x}, ${y})`,
1421
+ children: [
1422
+ /* @__PURE__ */ jsx("path", {
1423
+ class: [nodeShape, nodeShapeHover],
1424
+ d: `M ${-hw} ${-hh + ry} A ${hw} ${ry} 0 0 1 ${hw} ${-hh + ry} L ${hw} ${hh - ry} A ${hw} ${ry} 0 0 1 ${-hw} ${hh - ry} Z`
1425
+ }),
1426
+ /* @__PURE__ */ jsx("ellipse", {
1427
+ class: nodeShape,
1428
+ cx: 0,
1429
+ cy: -hh + ry,
1430
+ rx: hw,
1431
+ ry
1432
+ }),
1433
+ /* @__PURE__ */ jsx("text", {
1434
+ class: nodeLabel,
1435
+ y: ry / 2,
1436
+ children: node.label
1437
+ })
1438
+ ]
1439
+ });
1440
+ }
1441
+
1442
+ //#endregion
1443
+ //#region ../mermaid/src/components/nodes/subroutine.tsx
1444
+ function SubroutineNode(props) {
1445
+ const { node, x, y, width, height } = props.positioned;
1446
+ const hw = width / 2;
1447
+ const hh = height / 2;
1448
+ const inset = 8;
1449
+ return /* @__PURE__ */ jsxs("g", {
1450
+ class: [c$13.node, props.class],
1451
+ transform: `translate(${x}, ${y})`,
1452
+ children: [
1453
+ /* @__PURE__ */ jsx("rect", {
1454
+ class: [nodeShape, nodeShapeHover],
1455
+ x: -hw,
1456
+ y: -hh,
1457
+ width,
1458
+ height,
1459
+ rx: 0
1460
+ }),
1461
+ /* @__PURE__ */ jsx("line", {
1462
+ class: nodeShape,
1463
+ x1: -hw + inset,
1464
+ y1: -hh,
1465
+ x2: -hw + inset,
1466
+ y2: hh
1467
+ }),
1468
+ /* @__PURE__ */ jsx("line", {
1469
+ class: nodeShape,
1470
+ x1: hw - inset,
1471
+ y1: -hh,
1472
+ x2: hw - inset,
1473
+ y2: hh
1474
+ }),
1475
+ /* @__PURE__ */ jsx("text", {
1476
+ class: nodeLabel,
1477
+ children: node.label
1478
+ })
1479
+ ]
1480
+ });
1481
+ }
1482
+
1483
+ //#endregion
1484
+ //#region ../mermaid/src/components/nodes/asymmetric.tsx
1485
+ function AsymmetricNode(props) {
1486
+ const { node, x, y, width, height } = props.positioned;
1487
+ const hw = width / 2;
1488
+ const hh = height / 2;
1489
+ return /* @__PURE__ */ jsxs("g", {
1490
+ class: [c$13.node, props.class],
1491
+ transform: `translate(${x}, ${y})`,
1492
+ children: [/* @__PURE__ */ jsx("polygon", {
1493
+ class: [nodeShape, nodeShapeHover],
1494
+ points: `${-hw},${-hh} ${hw},${-hh} ${hw},${hh} ${-hw},${hh} ${-hw + 10},0`
1495
+ }), /* @__PURE__ */ jsx("text", {
1496
+ class: nodeLabel,
1497
+ children: node.label
1498
+ })]
1499
+ });
1500
+ }
1501
+
1502
+ //#endregion
1503
+ //#region ../mermaid/src/components/nodes/parallelogram.tsx
1504
+ function ParallelogramNode(props) {
1505
+ const { node, x, y, width, height } = props.positioned;
1506
+ const hw = width / 2;
1507
+ const hh = height / 2;
1508
+ const skew = width * .15;
1509
+ return /* @__PURE__ */ jsxs("g", {
1510
+ class: [c$13.node, props.class],
1511
+ transform: `translate(${x}, ${y})`,
1512
+ children: [/* @__PURE__ */ jsx("polygon", {
1513
+ class: [nodeShape, nodeShapeHover],
1514
+ points: `${-hw + skew},${-hh} ${hw + skew},${-hh} ${hw - skew},${hh} ${-hw - skew},${hh}`
1515
+ }), /* @__PURE__ */ jsx("text", {
1516
+ class: nodeLabel,
1517
+ children: node.label
1518
+ })]
1519
+ });
1520
+ }
1521
+
1522
+ //#endregion
1523
+ //#region ../mermaid/src/components/nodes/trapezoid.tsx
1524
+ function TrapezoidNode(props) {
1525
+ const { node, x, y, width, height } = props.positioned;
1526
+ const hw = width / 2;
1527
+ const hh = height / 2;
1528
+ const inset = width * .15;
1529
+ return /* @__PURE__ */ jsxs("g", {
1530
+ class: [c$13.node, props.class],
1531
+ transform: `translate(${x}, ${y})`,
1532
+ children: [/* @__PURE__ */ jsx("polygon", {
1533
+ class: [nodeShape, nodeShapeHover],
1534
+ points: `${-hw + inset},${-hh} ${hw - inset},${-hh} ${hw},${hh} ${-hw},${hh}`
1535
+ }), /* @__PURE__ */ jsx("text", {
1536
+ class: nodeLabel,
1537
+ children: node.label
1538
+ })]
1539
+ });
1540
+ }
1541
+
1542
+ //#endregion
1543
+ //#region ../mermaid/src/components/nodes/double-circle.tsx
1544
+ function DoubleCircleNode(props) {
1545
+ const { node, x, y, width } = props.positioned;
1546
+ const outerR = width / 2;
1547
+ const innerR = outerR - 4;
1548
+ return /* @__PURE__ */ jsxs("g", {
1549
+ class: [c$13.node, props.class],
1550
+ transform: `translate(${x}, ${y})`,
1551
+ children: [
1552
+ /* @__PURE__ */ jsx("circle", {
1553
+ class: [nodeShape, nodeShapeHover],
1554
+ r: outerR
1555
+ }),
1556
+ /* @__PURE__ */ jsx("circle", {
1557
+ class: nodeShape,
1558
+ r: innerR
1559
+ }),
1560
+ /* @__PURE__ */ jsx("text", {
1561
+ class: nodeLabel,
1562
+ children: node.label
1563
+ })
1564
+ ]
1565
+ });
1566
+ }
1567
+
1568
+ //#endregion
1569
+ //#region ../mermaid/src/components/nodes/index.ts
1570
+ const shapeMap = {
1571
+ rect: RectNode,
1572
+ round: RoundNode,
1573
+ stadium: StadiumNode,
1574
+ circle: CircleNode,
1575
+ rhombus: RhombusNode,
1576
+ hexagon: HexagonNode,
1577
+ cylinder: CylinderNode,
1578
+ subroutine: SubroutineNode,
1579
+ asymmetric: AsymmetricNode,
1580
+ parallelogram: ParallelogramNode,
1581
+ trapezoid: TrapezoidNode,
1582
+ "double-circle": DoubleCircleNode
1583
+ };
1584
+
1585
+ //#endregion
1586
+ //#region ../mermaid/src/components/edge.tsx
1587
+ const LINE_STYLE = {
1588
+ solid: void 0,
1589
+ dotted: edgeDotted,
1590
+ thick: edgeThick
1591
+ };
1592
+ const MARKER_URL = {
1593
+ arrow: "url(#mmd-arrow)",
1594
+ dot: "url(#mmd-dot)",
1595
+ cross: "url(#mmd-cross)",
1596
+ none: void 0
1597
+ };
1598
+ function Edge(props) {
1599
+ const { edge, path, labelPosition, labelSize } = props.positioned;
1600
+ const lineStyle = LINE_STYLE[edge.lineStyle];
1601
+ const markerEnd = MARKER_URL[edge.targetMarker];
1602
+ const markerStart = MARKER_URL[edge.sourceMarker];
1603
+ return /* @__PURE__ */ jsxs("g", {
1604
+ class: props.class,
1605
+ children: [
1606
+ /* @__PURE__ */ jsx("path", {
1607
+ class: [edgeLine, lineStyle],
1608
+ d: path,
1609
+ "marker-start": markerStart,
1610
+ "marker-end": markerEnd
1611
+ }),
1612
+ /* @__PURE__ */ jsx("path", {
1613
+ class: edgeInteraction,
1614
+ d: path
1615
+ }),
1616
+ edge.label && labelPosition && labelSize ? /* @__PURE__ */ jsxs("g", { children: [/* @__PURE__ */ jsx("rect", {
1617
+ class: edgeLabelBg,
1618
+ x: labelPosition.x - labelSize.width / 2 - 4,
1619
+ y: labelPosition.y - labelSize.height / 2 - 2,
1620
+ width: labelSize.width + 8,
1621
+ height: labelSize.height + 4,
1622
+ rx: 4
1623
+ }), /* @__PURE__ */ jsx("text", {
1624
+ class: edgeLabel,
1625
+ x: labelPosition.x,
1626
+ y: labelPosition.y,
1627
+ children: edge.label
1628
+ })] }) : null
1629
+ ]
1630
+ });
1631
+ }
1632
+
1633
+ //#endregion
1634
+ //#region ../mermaid/src/subgraph.style.ts
1635
+ const c$12 = classes(["subgraphBg", "subgraphTitle"]);
1636
+ const subgraphBg = rule`${c$12.subgraphBg} {
1637
+ fill: ${tokens$1.subgraphFill};
1638
+ stroke: ${tokens$1.subgraphStroke};
1639
+ stroke-width: 1;
1640
+ }`;
1641
+ const subgraphTitle = rule`${c$12.subgraphTitle} {
1642
+ fill: ${tokens$1.subgraphTitleText};
1643
+ font-family: ${tokens$1.fontFamily};
1644
+ font-size: 12px;
1645
+ font-weight: 600;
1646
+ }`;
1647
+
1648
+ //#endregion
1649
+ //#region ../mermaid/src/components/subgraph.tsx
1650
+ function SubgraphBox(props) {
1651
+ const { subgraph, x, y, width, height } = props.positioned;
1652
+ return /* @__PURE__ */ jsxs("g", {
1653
+ class: props.class,
1654
+ transform: `translate(${x}, ${y})`,
1655
+ children: [/* @__PURE__ */ jsx("rect", {
1656
+ class: subgraphBg,
1657
+ width,
1658
+ height,
1659
+ rx: 8
1660
+ }), /* @__PURE__ */ jsx("text", {
1661
+ class: subgraphTitle,
1662
+ x: 16,
1663
+ y: 24,
1664
+ children: subgraph.label
1665
+ })]
1666
+ });
1667
+ }
1668
+
1669
+ //#endregion
1670
+ //#region ../mermaid/src/layout/flowchart.ts
1671
+ const DEFAULT_OPTIONS$1 = {
1672
+ nodeSpacing: 60,
1673
+ rankSpacing: 80,
1674
+ nodeWidth: 150,
1675
+ nodeHeight: 50,
1676
+ nodePadding: 16,
1677
+ diagramPadding: 20,
1678
+ edgeRouting: "bezier"
1679
+ };
1680
+ function flowchartLayout(diagram, options) {
1681
+ const opts = {
1682
+ ...DEFAULT_OPTIONS$1,
1683
+ ...options
1684
+ };
1685
+ const { nodes, edges, subgraphs, direction } = diagram;
1686
+ if (nodes.length === 0) return {
1687
+ width: 0,
1688
+ height: 0,
1689
+ viewBox: "0 0 0 0",
1690
+ nodes: [],
1691
+ edges: [],
1692
+ subgraphs: []
1693
+ };
1694
+ const nodeSizes = /* @__PURE__ */ new Map();
1695
+ for (const node of nodes) nodeSizes.set(node.id, measureNode(node, opts));
1696
+ const adj = /* @__PURE__ */ new Map();
1697
+ const safeEdges = [];
1698
+ const visited = /* @__PURE__ */ new Set();
1699
+ const inStack = /* @__PURE__ */ new Set();
1700
+ for (const node of nodes) adj.set(node.id, []);
1701
+ for (const edge of edges) {
1702
+ const targets = adj.get(edge.source);
1703
+ if (targets) targets.push(edge.target);
1704
+ }
1705
+ function dfs(node) {
1706
+ visited.add(node);
1707
+ inStack.add(node);
1708
+ for (const neighbor of adj.get(node) ?? []) if (inStack.has(neighbor)) {
1709
+ const edge = edges.find((e) => e.source === node && e.target === neighbor);
1710
+ if (edge) safeEdges.push({
1711
+ ...edge,
1712
+ source: neighbor,
1713
+ target: node
1714
+ });
1715
+ } else if (!visited.has(neighbor)) dfs(neighbor);
1716
+ inStack.delete(node);
1717
+ }
1718
+ for (const node of nodes) if (!visited.has(node.id)) dfs(node.id);
1719
+ for (const edge of edges) if (!safeEdges.some((e) => e.source === edge.target && e.target === edge.source)) safeEdges.push(edge);
1720
+ const layers = /* @__PURE__ */ new Map();
1721
+ const safeAdj = /* @__PURE__ */ new Map();
1722
+ const inDegree = /* @__PURE__ */ new Map();
1723
+ for (const node of nodes) {
1724
+ safeAdj.set(node.id, []);
1725
+ inDegree.set(node.id, 0);
1726
+ }
1727
+ for (const edge of safeEdges) {
1728
+ safeAdj.get(edge.source)?.push(edge.target);
1729
+ inDegree.set(edge.target, (inDegree.get(edge.target) ?? 0) + 1);
1730
+ }
1731
+ const queue = [];
1732
+ for (const node of nodes) if ((inDegree.get(node.id) ?? 0) === 0) {
1733
+ queue.push(node.id);
1734
+ layers.set(node.id, 0);
1735
+ }
1736
+ while (queue.length > 0) {
1737
+ const current = queue.shift();
1738
+ const currentLayer = layers.get(current) ?? 0;
1739
+ for (const neighbor of safeAdj.get(current) ?? []) {
1740
+ const existingLayer = layers.get(neighbor) ?? -1;
1741
+ layers.set(neighbor, Math.max(existingLayer, currentLayer + 1));
1742
+ inDegree.set(neighbor, (inDegree.get(neighbor) ?? 1) - 1);
1743
+ if (inDegree.get(neighbor) === 0) queue.push(neighbor);
1744
+ }
1745
+ }
1746
+ for (const node of nodes) if (!layers.has(node.id)) layers.set(node.id, 0);
1747
+ const maxLayer = Math.max(...Array.from(layers.values()), 0);
1748
+ const layerGroups = Array.from({ length: maxLayer + 1 }, () => []);
1749
+ for (const node of nodes) layerGroups[layers.get(node.id) ?? 0].push(node.id);
1750
+ for (let pass = 0; pass < 2; pass++) for (let l = 1; l <= maxLayer; l++) {
1751
+ const layer = layerGroups[l];
1752
+ const barycenters = /* @__PURE__ */ new Map();
1753
+ for (const nodeId of layer) {
1754
+ const prevLayer = layerGroups[l - 1];
1755
+ let sum = 0;
1756
+ let count = 0;
1757
+ for (const edge of safeEdges) if (edge.target === nodeId && prevLayer.includes(edge.source)) {
1758
+ sum += prevLayer.indexOf(edge.source);
1759
+ count++;
1760
+ }
1761
+ barycenters.set(nodeId, count > 0 ? sum / count : prevLayer.length / 2);
1762
+ }
1763
+ layer.sort((a, b) => (barycenters.get(a) ?? 0) - (barycenters.get(b) ?? 0));
1764
+ }
1765
+ const isVertical = direction === "TB" || direction === "TD" || direction === "BT";
1766
+ const positions = /* @__PURE__ */ new Map();
1767
+ for (let l = 0; l <= maxLayer; l++) {
1768
+ const layer = layerGroups[l];
1769
+ let offset = -layer.reduce((sum, id) => {
1770
+ const size = nodeSizes.get(id);
1771
+ return sum + (isVertical ? size.width : size.height) + opts.nodeSpacing;
1772
+ }, -opts.nodeSpacing) / 2;
1773
+ for (const nodeId of layer) {
1774
+ const size = nodeSizes.get(nodeId);
1775
+ const primaryDim = isVertical ? size.width : size.height;
1776
+ if (isVertical) positions.set(nodeId, {
1777
+ x: offset + primaryDim / 2,
1778
+ y: l * (opts.nodeHeight + opts.rankSpacing)
1779
+ });
1780
+ else positions.set(nodeId, {
1781
+ x: l * (opts.nodeWidth + opts.rankSpacing),
1782
+ y: offset + primaryDim / 2
1783
+ });
1784
+ offset += primaryDim + opts.nodeSpacing;
1785
+ }
1786
+ }
1787
+ let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
1788
+ for (const [id, pos] of positions) {
1789
+ const size = nodeSizes.get(id);
1790
+ minX = Math.min(minX, pos.x - size.width / 2);
1791
+ minY = Math.min(minY, pos.y - size.height / 2);
1792
+ maxX = Math.max(maxX, pos.x + size.width / 2);
1793
+ maxY = Math.max(maxY, pos.y + size.height / 2);
1794
+ }
1795
+ const offsetX = opts.diagramPadding - minX;
1796
+ const offsetY = opts.diagramPadding - minY;
1797
+ for (const [, pos] of positions) {
1798
+ pos.x += offsetX;
1799
+ pos.y += offsetY;
1800
+ }
1801
+ if (direction === "BT") {
1802
+ const totalHeight = maxY - minY;
1803
+ for (const [, pos] of positions) pos.y = totalHeight - (pos.y - opts.diagramPadding) + opts.diagramPadding;
1804
+ }
1805
+ if (direction === "RL") {
1806
+ const totalWidth = maxX - minX;
1807
+ for (const [, pos] of positions) pos.x = totalWidth - (pos.x - opts.diagramPadding) + opts.diagramPadding;
1808
+ }
1809
+ const positionedNodes = nodes.map((node) => {
1810
+ const pos = positions.get(node.id);
1811
+ const size = nodeSizes.get(node.id);
1812
+ return {
1813
+ node,
1814
+ x: pos.x,
1815
+ y: pos.y,
1816
+ width: size.width,
1817
+ height: size.height
1818
+ };
1819
+ });
1820
+ const positionedEdges = edges.map((edge) => {
1821
+ const sourcePos = positions.get(edge.source);
1822
+ const targetPos = positions.get(edge.target);
1823
+ if (!sourcePos || !targetPos) return {
1824
+ edge,
1825
+ path: "M 0 0"
1826
+ };
1827
+ const result = buildEdgePath(sourcePos, targetPos, nodeSizes.get(edge.source), nodeSizes.get(edge.target), isVertical, opts);
1828
+ let labelPosition;
1829
+ let labelSize;
1830
+ if (edge.label) {
1831
+ labelPosition = result.labelMid;
1832
+ labelSize = measureLabel(edge.label, opts);
1833
+ }
1834
+ return {
1835
+ edge,
1836
+ path: result.path,
1837
+ labelPosition,
1838
+ labelSize
1839
+ };
1840
+ });
1841
+ const positionedSubgraphs = subgraphs.map((sg) => {
1842
+ let sgMinX = Infinity, sgMinY = Infinity, sgMaxX = -Infinity, sgMaxY = -Infinity;
1843
+ for (const nodeId of sg.nodes) {
1844
+ const pos = positions.get(nodeId);
1845
+ const size = nodeSizes.get(nodeId);
1846
+ if (pos && size) {
1847
+ sgMinX = Math.min(sgMinX, pos.x - size.width / 2);
1848
+ sgMinY = Math.min(sgMinY, pos.y - size.height / 2);
1849
+ sgMaxX = Math.max(sgMaxX, pos.x + size.width / 2);
1850
+ sgMaxY = Math.max(sgMaxY, pos.y + size.height / 2);
1851
+ }
1852
+ }
1853
+ const padding = opts.nodePadding;
1854
+ return {
1855
+ subgraph: sg,
1856
+ x: sgMinX - padding,
1857
+ y: sgMinY - padding - 20,
1858
+ width: sgMaxX - sgMinX + padding * 2,
1859
+ height: sgMaxY - sgMinY + padding * 2 + 20
1860
+ };
1861
+ });
1862
+ const diagramWidth = maxX - minX + opts.diagramPadding * 2;
1863
+ const diagramHeight = maxY - minY + opts.diagramPadding * 2;
1864
+ return {
1865
+ width: diagramWidth,
1866
+ height: diagramHeight,
1867
+ viewBox: `0 0 ${diagramWidth} ${diagramHeight}`,
1868
+ nodes: positionedNodes,
1869
+ edges: positionedEdges,
1870
+ subgraphs: positionedSubgraphs
1871
+ };
1872
+ }
1873
+ /** Default curvature factor (matches xyflow) */
1874
+ const DEFAULT_CURVATURE = .25;
1875
+ /**
1876
+ * Calculate control-point offset along the primary axis.
1877
+ * When distance >= 0 (normal flow), the offset is half the distance.
1878
+ * When distance < 0 (backward edge), use a wider curve via sqrt scaling.
1879
+ */
1880
+ function controlOffset(distance, curvature) {
1881
+ if (distance >= 0) return .5 * distance;
1882
+ return curvature * 25 * Math.sqrt(-distance);
1883
+ }
1884
+ /**
1885
+ * Compute the label position on a cubic bezier at t=0.5.
1886
+ * Uses the exact bezier midpoint formula instead of a simple linear midpoint.
1887
+ */
1888
+ function bezierMidpoint(sx, sy, cx1, cy1, cx2, cy2, tx, ty) {
1889
+ return {
1890
+ x: sx * .125 + cx1 * .375 + cx2 * .375 + tx * .125,
1891
+ y: sy * .125 + cy1 * .375 + cy2 * .375 + ty * .125
1892
+ };
1893
+ }
1894
+ function buildEdgePath(source, target, sourceSize, targetSize, isVertical, opts) {
1895
+ let sx, sy, tx, ty;
1896
+ if (isVertical) {
1897
+ sx = source.x;
1898
+ sy = source.y + sourceSize.height / 2;
1899
+ tx = target.x;
1900
+ ty = target.y - targetSize.height / 2;
1901
+ if (source.y > target.y) {
1902
+ sy = source.y - sourceSize.height / 2;
1903
+ ty = target.y + targetSize.height / 2;
1904
+ }
1905
+ } else {
1906
+ sx = source.x + sourceSize.width / 2;
1907
+ sy = source.y;
1908
+ tx = target.x - targetSize.width / 2;
1909
+ ty = target.y;
1910
+ if (source.x > target.x) {
1911
+ sx = source.x - sourceSize.width / 2;
1912
+ tx = target.x + targetSize.width / 2;
1913
+ }
1914
+ }
1915
+ if (opts.edgeRouting === "bezier") if (isVertical) {
1916
+ const offset = controlOffset(ty - sy, DEFAULT_CURVATURE);
1917
+ const cy1 = sy + offset;
1918
+ const cy2 = ty - offset;
1919
+ const mid = bezierMidpoint(sx, sy, sx, cy1, tx, cy2, tx, ty);
1920
+ return {
1921
+ path: `M ${sx} ${sy} C ${sx} ${cy1} ${tx} ${cy2} ${tx} ${ty}`,
1922
+ labelMid: mid
1923
+ };
1924
+ } else {
1925
+ const offset = controlOffset(tx - sx, DEFAULT_CURVATURE);
1926
+ const cx1 = sx + offset;
1927
+ const cx2 = tx - offset;
1928
+ const mid = bezierMidpoint(sx, sy, cx1, sy, cx2, ty, tx, ty);
1929
+ return {
1930
+ path: `M ${sx} ${sy} C ${cx1} ${sy} ${cx2} ${ty} ${tx} ${ty}`,
1931
+ labelMid: mid
1932
+ };
1933
+ }
1934
+ return {
1935
+ path: `M ${sx} ${sy} L ${tx} ${ty}`,
1936
+ labelMid: {
1937
+ x: (sx + tx) / 2,
1938
+ y: (sy + ty) / 2
1939
+ }
1940
+ };
1941
+ }
1942
+ function measureNode(node, opts) {
1943
+ const textSize = (opts.measureText ?? estimateTextSize$1)(node.label, 14);
1944
+ return {
1945
+ width: Math.max(textSize.width + opts.nodePadding * 2, opts.nodeWidth),
1946
+ height: Math.max(textSize.height + opts.nodePadding * 2, opts.nodeHeight)
1947
+ };
1948
+ }
1949
+ function measureLabel(text, opts) {
1950
+ return (opts.measureText ?? estimateTextSize$1)(text, 12);
1951
+ }
1952
+ function estimateTextSize$1(text, fontSize) {
1953
+ const avgCharWidth = fontSize * .6;
1954
+ return {
1955
+ width: text.length * avgCharWidth,
1956
+ height: fontSize * 1.4
1957
+ };
1958
+ }
1959
+
1960
+ //#endregion
1961
+ //#region ../mermaid/src/layout/sequence.ts
1962
+ const DEFAULT_OPTIONS = {
1963
+ nodeSpacing: 200,
1964
+ rankSpacing: 50,
1965
+ nodeWidth: 120,
1966
+ nodeHeight: 40,
1967
+ nodePadding: 16,
1968
+ diagramPadding: 20,
1969
+ edgeRouting: "bezier"
1970
+ };
1971
+ function sequenceLayout(diagram, options) {
1972
+ const opts = {
1973
+ ...DEFAULT_OPTIONS,
1974
+ ...options
1975
+ };
1976
+ const { participants, messages, blocks, notes } = diagram;
1977
+ if (participants.length === 0) return {
1978
+ width: 0,
1979
+ height: 0,
1980
+ viewBox: "0 0 0 0",
1981
+ participants: [],
1982
+ messages: [],
1983
+ lifelines: [],
1984
+ activations: [],
1985
+ blocks: [],
1986
+ notes: []
1987
+ };
1988
+ const participantX = /* @__PURE__ */ new Map();
1989
+ participants.forEach((p, i) => {
1990
+ participantX.set(p.id, opts.diagramPadding + opts.nodeWidth / 2 + i * opts.nodeSpacing);
1991
+ });
1992
+ const headerY = opts.diagramPadding + opts.nodeHeight / 2;
1993
+ const headerBottom = headerY + opts.nodeHeight / 2 + 20;
1994
+ const positionedMessages = messages.map((msg, i) => {
1995
+ return {
1996
+ message: msg,
1997
+ fromX: participantX.get(msg.from) ?? 0,
1998
+ toX: participantX.get(msg.to) ?? 0,
1999
+ y: headerBottom + i * opts.rankSpacing
2000
+ };
2001
+ });
2002
+ const activationStarts = /* @__PURE__ */ new Map();
2003
+ const positionedActivations = [];
2004
+ for (const pmsg of positionedMessages) {
2005
+ const msg = pmsg.message;
2006
+ if (msg.activate) activationStarts.set(msg.to, pmsg.y);
2007
+ if (msg.deactivate) {
2008
+ const startY = activationStarts.get(msg.from);
2009
+ if (startY !== void 0) {
2010
+ const x = participantX.get(msg.from) ?? 0;
2011
+ const participant = participants.find((p) => p.id === msg.from);
2012
+ if (participant) positionedActivations.push({
2013
+ participant,
2014
+ x: x - 7,
2015
+ y: startY,
2016
+ width: 14,
2017
+ height: pmsg.y - startY
2018
+ });
2019
+ activationStarts.delete(msg.from);
2020
+ }
2021
+ }
2022
+ }
2023
+ const lastMsg = positionedMessages[positionedMessages.length - 1];
2024
+ const diagramBottom = (lastMsg ? lastMsg.y : headerBottom) + opts.rankSpacing;
2025
+ const positionedLifelines = participants.map((p) => {
2026
+ return {
2027
+ participant: p,
2028
+ x: participantX.get(p.id) ?? 0,
2029
+ y1: headerY + opts.nodeHeight / 2,
2030
+ y2: diagramBottom
2031
+ };
2032
+ });
2033
+ const positionedBlocks = blocks.map((block) => {
2034
+ const allMsgs = [...block.messages, ...block.sections?.flatMap((s) => s.messages) ?? []];
2035
+ let minX = Infinity;
2036
+ let maxX = -Infinity;
2037
+ for (const msg of allMsgs) {
2038
+ const fromX = participantX.get(msg.from) ?? 0;
2039
+ const toX = participantX.get(msg.to) ?? 0;
2040
+ minX = Math.min(minX, fromX, toX);
2041
+ maxX = Math.max(maxX, fromX, toX);
2042
+ }
2043
+ const msgIndices = allMsgs.map((m) => messages.findIndex((pm) => pm.from === m.from && pm.to === m.to && pm.text === m.text)).filter((i) => i >= 0);
2044
+ const firstBlockMsg = msgIndices.length > 0 ? positionedMessages[Math.min(...msgIndices)] : void 0;
2045
+ const lastBlockMsg = msgIndices.length > 0 ? positionedMessages[Math.max(...msgIndices)] : void 0;
2046
+ const startY = firstBlockMsg ? firstBlockMsg.y - 20 : headerBottom;
2047
+ const endY = lastBlockMsg ? lastBlockMsg.y + 20 : headerBottom + opts.rankSpacing;
2048
+ const padding = opts.nodePadding;
2049
+ return {
2050
+ block,
2051
+ x: minX - padding - opts.nodeWidth / 2,
2052
+ y: startY,
2053
+ width: maxX - minX + opts.nodeWidth + padding * 2,
2054
+ height: endY - startY
2055
+ };
2056
+ });
2057
+ const positionedNotes = notes.map((note, i) => {
2058
+ const xs = note.participants.map((id) => participantX.get(id) ?? 0).filter((x) => x > 0);
2059
+ let x;
2060
+ if (note.position === "left of") x = (xs[0] ?? opts.diagramPadding) - opts.nodeWidth;
2061
+ else if (note.position === "right of") x = (xs[0] ?? opts.diagramPadding) + opts.nodeWidth;
2062
+ else x = xs.length > 0 ? xs.reduce((a, b) => a + b, 0) / xs.length : opts.diagramPadding;
2063
+ const y = headerBottom + (messages.length + i) * opts.rankSpacing * .5;
2064
+ const size = estimateTextSize(note.text, 12);
2065
+ return {
2066
+ note,
2067
+ x,
2068
+ y,
2069
+ width: Math.max(size.width + opts.nodePadding * 2, 80),
2070
+ height: Math.max(size.height + opts.nodePadding, 30)
2071
+ };
2072
+ });
2073
+ const positionedParticipants = participants.map((p) => {
2074
+ const x = participantX.get(p.id) ?? 0;
2075
+ const size = estimateTextSize(p.label, 14);
2076
+ return {
2077
+ participant: p,
2078
+ x,
2079
+ y: headerY,
2080
+ width: Math.max(size.width + opts.nodePadding * 2, opts.nodeWidth),
2081
+ height: opts.nodeHeight
2082
+ };
2083
+ });
2084
+ const diagramWidth = (participants.length - 1) * opts.nodeSpacing + opts.nodeWidth + opts.diagramPadding * 2;
2085
+ const diagramHeight = diagramBottom + opts.diagramPadding;
2086
+ return {
2087
+ width: diagramWidth,
2088
+ height: diagramHeight,
2089
+ viewBox: `0 0 ${diagramWidth} ${diagramHeight}`,
2090
+ participants: positionedParticipants,
2091
+ messages: positionedMessages,
2092
+ lifelines: positionedLifelines,
2093
+ activations: positionedActivations,
2094
+ blocks: positionedBlocks,
2095
+ notes: positionedNotes
2096
+ };
2097
+ }
2098
+ function estimateTextSize(text, fontSize) {
2099
+ const avgCharWidth = fontSize * .6;
2100
+ return {
2101
+ width: text.length * avgCharWidth,
2102
+ height: fontSize * 1.4
2103
+ };
2104
+ }
2105
+
2106
+ //#endregion
2107
+ //#region ../mermaid/src/layout/index.ts
2108
+ const builtinLayout = {
2109
+ flowchart: flowchartLayout,
2110
+ sequence: sequenceLayout
2111
+ };
2112
+
2113
+ //#endregion
2114
+ //#region ../mermaid/src/themes.ts
2115
+ const lightTheme$1 = createTheme(tokens$1);
2116
+ const darkTheme$1 = createTheme(tokens$1, {
2117
+ nodeFill: "#2d3748",
2118
+ nodeStroke: "#63b3ed",
2119
+ nodeText: "#e2e8f0",
2120
+ edgeStroke: "#a0aec0",
2121
+ edgeLabelBg: "#1a202c",
2122
+ edgeLabelText: "#e2e8f0",
2123
+ arrowFill: "#a0aec0",
2124
+ subgraphFill: "#1a202c",
2125
+ subgraphStroke: "#4a5568",
2126
+ subgraphTitleBg: "#2d3748",
2127
+ subgraphTitleText: "#e2e8f0",
2128
+ actorFill: "#2d3748",
2129
+ actorStroke: "#63b3ed",
2130
+ lifelineStroke: "#4a5568",
2131
+ activationFill: "#2d3748",
2132
+ messageStroke: "#a0aec0",
2133
+ blockFill: "rgba(100,100,100,0.15)",
2134
+ blockStroke: "#4a5568",
2135
+ noteBg: "#4a4528",
2136
+ noteStroke: "#b8a900",
2137
+ noteText: "#e2e8f0",
2138
+ bgColor: "#1a202c",
2139
+ gridDotColor: "rgba(255, 255, 255, 0.08)"
2140
+ });
2141
+
2142
+ //#endregion
2143
+ //#region ../mermaid/src/provider.tsx
2144
+ /** @jsxImportSource @semajsx/dom */
2145
+ const MermaidRenderers = context("mermaid-renderers");
2146
+ const MermaidLayout = context("mermaid-layout");
2147
+
2148
+ //#endregion
2149
+ //#region ../mermaid/src/components/label.tsx
2150
+ function Label(props) {
2151
+ return /* @__PURE__ */ jsx("text", {
2152
+ class: [nodeLabel, props.class],
2153
+ x: props.x,
2154
+ y: props.y,
2155
+ children: props.text
2156
+ });
2157
+ }
2158
+
2159
+ //#endregion
2160
+ //#region ../mermaid/src/sequence.style.ts
2161
+ const c$11 = classes([
2162
+ "participantBox",
2163
+ "participantLabel",
2164
+ "lifeline",
2165
+ "activation",
2166
+ "messageLine",
2167
+ "messageDotted",
2168
+ "messageText",
2169
+ "blockBg",
2170
+ "blockLabel",
2171
+ "blockLabelText",
2172
+ "noteBg",
2173
+ "noteText"
2174
+ ]);
2175
+ const participantBox = rule`${c$11.participantBox} {
2176
+ fill: ${tokens$1.actorFill};
2177
+ stroke: ${tokens$1.actorStroke};
2178
+ stroke-width: 2;
2179
+ }`;
2180
+ const participantLabel = rule`${c$11.participantLabel} {
2181
+ fill: ${tokens$1.nodeText};
2182
+ stroke: none;
2183
+ font-family: ${tokens$1.fontFamily};
2184
+ font-size: ${tokens$1.fontSize}px;
2185
+ text-anchor: middle;
2186
+ dominant-baseline: central;
2187
+ }`;
2188
+ const lifeline = rule`${c$11.lifeline} {
2189
+ stroke: ${tokens$1.lifelineStroke};
2190
+ stroke-width: 1;
2191
+ stroke-dasharray: 6, 4;
2192
+ }`;
2193
+ const activation = rule`${c$11.activation} {
2194
+ fill: ${tokens$1.activationFill};
2195
+ stroke: ${tokens$1.actorStroke};
2196
+ stroke-width: 1;
2197
+ }`;
2198
+ const messageLine = rule`${c$11.messageLine} {
2199
+ stroke: ${tokens$1.messageStroke};
2200
+ stroke-width: 1.5;
2201
+ fill: none;
2202
+ }`;
2203
+ const messageDotted = rule`${c$11.messageDotted} {
2204
+ stroke-dasharray: 6, 4;
2205
+ }`;
2206
+ const messageText = rule`${c$11.messageText} {
2207
+ fill: ${tokens$1.nodeText};
2208
+ stroke: none;
2209
+ font-family: ${tokens$1.fontFamily};
2210
+ font-size: 12px;
2211
+ text-anchor: middle;
2212
+ }`;
2213
+ const blockBg = rule`${c$11.blockBg} {
2214
+ fill: ${tokens$1.blockFill};
2215
+ stroke: ${tokens$1.blockStroke};
2216
+ stroke-width: 1;
2217
+ }`;
2218
+ const blockLabel = rule`${c$11.blockLabel} {
2219
+ fill: ${tokens$1.blockStroke};
2220
+ }`;
2221
+ const blockLabelText = rule`${c$11.blockLabelText} {
2222
+ fill: ${tokens$1.nodeText};
2223
+ stroke: none;
2224
+ font-family: ${tokens$1.fontFamily};
2225
+ font-size: 11px;
2226
+ font-weight: 600;
2227
+ }`;
2228
+ const noteBg = rule`${c$11.noteBg} {
2229
+ fill: ${tokens$1.noteBg};
2230
+ stroke: ${tokens$1.noteStroke};
2231
+ stroke-width: 1;
2232
+ }`;
2233
+ const noteText = rule`${c$11.noteText} {
2234
+ fill: ${tokens$1.noteText};
2235
+ stroke: none;
2236
+ font-family: ${tokens$1.fontFamily};
2237
+ font-size: 12px;
2238
+ text-anchor: middle;
2239
+ dominant-baseline: central;
2240
+ }`;
2241
+
2242
+ //#endregion
2243
+ //#region ../mermaid/src/components/sequence/participant.tsx
2244
+ function Participant(props) {
2245
+ const { participant, x, y, width, height } = props;
2246
+ return /* @__PURE__ */ jsxs("g", {
2247
+ class: props.class,
2248
+ transform: `translate(${x}, ${y})`,
2249
+ children: [/* @__PURE__ */ jsx("rect", {
2250
+ class: participantBox,
2251
+ x: -width / 2,
2252
+ y: -height / 2,
2253
+ width,
2254
+ height,
2255
+ rx: 6
2256
+ }), /* @__PURE__ */ jsx("text", {
2257
+ class: participantLabel,
2258
+ children: participant.label
2259
+ })]
2260
+ });
2261
+ }
2262
+
2263
+ //#endregion
2264
+ //#region ../mermaid/src/components/sequence/message.tsx
2265
+ const MARKER = {
2266
+ solid: "url(#mmd-arrow)",
2267
+ dotted: "url(#mmd-arrow)",
2268
+ solidCross: "url(#mmd-cross)",
2269
+ dottedCross: "url(#mmd-cross)",
2270
+ solidOpen: "url(#mmd-arrow-open)",
2271
+ dottedOpen: "url(#mmd-arrow-open)"
2272
+ };
2273
+ function Message(props) {
2274
+ const { message, fromX, toX, y } = props;
2275
+ const isDotted = message.arrow === "dotted" || message.arrow === "dottedCross" || message.arrow === "dottedOpen";
2276
+ const midX = (fromX + toX) / 2;
2277
+ const markerEnd = MARKER[message.arrow];
2278
+ return /* @__PURE__ */ jsxs("g", {
2279
+ class: props.class,
2280
+ children: [/* @__PURE__ */ jsx("line", {
2281
+ class: [messageLine, isDotted ? messageDotted : void 0],
2282
+ x1: fromX,
2283
+ y1: y,
2284
+ x2: toX,
2285
+ y2: y,
2286
+ "marker-end": markerEnd
2287
+ }), /* @__PURE__ */ jsx("text", {
2288
+ class: messageText,
2289
+ x: midX,
2290
+ y: y - 8,
2291
+ children: message.text
2292
+ })]
2293
+ });
2294
+ }
2295
+
2296
+ //#endregion
2297
+ //#region ../mermaid/src/components/sequence/lifeline.tsx
2298
+ function Lifeline(props) {
2299
+ return /* @__PURE__ */ jsx("line", {
2300
+ class: [lifeline, props.class],
2301
+ x1: props.x,
2302
+ y1: props.y1,
2303
+ x2: props.x,
2304
+ y2: props.y2
2305
+ });
2306
+ }
2307
+
2308
+ //#endregion
2309
+ //#region ../mermaid/src/components/sequence/activation.tsx
2310
+ function Activation(props) {
2311
+ return /* @__PURE__ */ jsx("rect", {
2312
+ class: [activation, props.class],
2313
+ x: props.x - props.width / 2,
2314
+ y: props.y,
2315
+ width: props.width,
2316
+ height: props.height
2317
+ });
2318
+ }
2319
+
2320
+ //#endregion
2321
+ //#region ../mermaid/src/components/sequence/block.tsx
2322
+ function Block(props) {
2323
+ const { block, x, y, width, height } = props;
2324
+ return /* @__PURE__ */ jsxs("g", {
2325
+ class: props.class,
2326
+ children: [
2327
+ /* @__PURE__ */ jsx("rect", {
2328
+ class: blockBg,
2329
+ x,
2330
+ y,
2331
+ width,
2332
+ height,
2333
+ rx: 4
2334
+ }),
2335
+ /* @__PURE__ */ jsx("rect", {
2336
+ class: blockLabel,
2337
+ x,
2338
+ y,
2339
+ width: 50,
2340
+ height: 20,
2341
+ rx: 4
2342
+ }),
2343
+ /* @__PURE__ */ jsx("text", {
2344
+ class: blockLabelText,
2345
+ x: x + 5,
2346
+ y: y + 14,
2347
+ children: block.type
2348
+ })
2349
+ ]
2350
+ });
2351
+ }
2352
+
2353
+ //#endregion
2354
+ //#region ../mermaid/src/components/sequence/note.tsx
2355
+ function Note(props) {
2356
+ const { note, x, y, width, height } = props;
2357
+ return /* @__PURE__ */ jsxs("g", {
2358
+ class: props.class,
2359
+ transform: `translate(${x}, ${y})`,
2360
+ children: [/* @__PURE__ */ jsx("rect", {
2361
+ class: noteBg,
2362
+ x: -width / 2,
2363
+ y: -height / 2,
2364
+ width,
2365
+ height,
2366
+ rx: 4
2367
+ }), /* @__PURE__ */ jsx("text", {
2368
+ class: noteText,
2369
+ children: note.text
2370
+ })]
2371
+ });
2372
+ }
2373
+
2374
+ //#endregion
2375
+ //#region ../mermaid/src/components/index.ts
2376
+ const defaultRenderers = {
2377
+ node: shapeMap.rect,
2378
+ edge: Edge,
2379
+ subgraph: SubgraphBox,
2380
+ label: Label,
2381
+ participant: Participant,
2382
+ message: Message,
2383
+ lifeline: Lifeline,
2384
+ activation: Activation,
2385
+ block: Block,
2386
+ note: Note
2387
+ };
2388
+
2389
+ //#endregion
2390
+ //#region ../mermaid/src/flowchart.tsx
2391
+ function Flowchart(props, ctx) {
2392
+ const engine = ctx?.inject(MermaidLayout) ?? builtinLayout;
2393
+ const renderers = ctx?.inject(MermaidRenderers) ?? defaultRenderers;
2394
+ const graphData = unwrap(props.graph);
2395
+ const positioned = engine.flowchart(graphData);
2396
+ return /* @__PURE__ */ jsxs("svg", {
2397
+ class: [svgRoot, props.class],
2398
+ viewBox: positioned.viewBox,
2399
+ xmlns: "http://www.w3.org/2000/svg",
2400
+ children: [
2401
+ /* @__PURE__ */ jsx("style", { children: defaultTheme.__cssTemplate }),
2402
+ /* @__PURE__ */ jsx(Defs, {}),
2403
+ /* @__PURE__ */ jsx("rect", {
2404
+ x: 0,
2405
+ y: 0,
2406
+ width: positioned.width,
2407
+ height: positioned.height,
2408
+ fill: "url(#mmd-grid)"
2409
+ }),
2410
+ positioned.subgraphs.map((s) => {
2411
+ return /* @__PURE__ */ jsx(renderers.subgraph ?? SubgraphBox, { positioned: s });
2412
+ }),
2413
+ positioned.edges.map((e) => {
2414
+ return /* @__PURE__ */ jsx(renderers[`edge:${e.edge.lineStyle}`] ?? renderers.edge ?? Edge, { positioned: e });
2415
+ }),
2416
+ positioned.nodes.map((n) => {
2417
+ return /* @__PURE__ */ jsx(renderers[`node:${n.node.shape}`] ?? renderers.node ?? shapeMap[n.node.shape] ?? shapeMap.rect, { positioned: n });
2418
+ })
2419
+ ]
2420
+ });
2421
+ }
2422
+
2423
+ //#endregion
2424
+ //#region ../mermaid/src/sequence.tsx
2425
+ function Sequence(props, ctx) {
2426
+ const engine = ctx?.inject(MermaidLayout) ?? builtinLayout;
2427
+ const renderers = ctx?.inject(MermaidRenderers) ?? defaultRenderers;
2428
+ const graphData = unwrap(props.graph);
2429
+ const positioned = engine.sequence(graphData);
2430
+ const LifelineComp = renderers.lifeline;
2431
+ const BlockComp = renderers.block;
2432
+ const ActivationComp = renderers.activation;
2433
+ const NoteComp = renderers.note;
2434
+ const MessageComp = renderers.message;
2435
+ const ParticipantComp = renderers.participant;
2436
+ return /* @__PURE__ */ jsxs("svg", {
2437
+ class: [svgRoot, props.class],
2438
+ viewBox: positioned.viewBox,
2439
+ xmlns: "http://www.w3.org/2000/svg",
2440
+ children: [
2441
+ /* @__PURE__ */ jsx("style", { children: defaultTheme.__cssTemplate }),
2442
+ /* @__PURE__ */ jsx(Defs, {}),
2443
+ positioned.lifelines.map((l) => /* @__PURE__ */ jsx(LifelineComp, {
2444
+ participant: l.participant,
2445
+ x: l.x,
2446
+ y1: l.y1,
2447
+ y2: l.y2
2448
+ })),
2449
+ positioned.blocks.map((b) => /* @__PURE__ */ jsx(BlockComp, {
2450
+ block: b.block,
2451
+ x: b.x,
2452
+ y: b.y,
2453
+ width: b.width,
2454
+ height: b.height
2455
+ })),
2456
+ positioned.activations.map((a) => /* @__PURE__ */ jsx(ActivationComp, {
2457
+ participant: a.participant,
2458
+ x: a.x,
2459
+ y: a.y,
2460
+ width: a.width,
2461
+ height: a.height
2462
+ })),
2463
+ positioned.notes.map((n) => /* @__PURE__ */ jsx(NoteComp, {
2464
+ note: n.note,
2465
+ x: n.x,
2466
+ y: n.y,
2467
+ width: n.width,
2468
+ height: n.height
2469
+ })),
2470
+ positioned.messages.map((m) => /* @__PURE__ */ jsx(MessageComp, {
2471
+ message: m.message,
2472
+ fromX: m.fromX,
2473
+ toX: m.toX,
2474
+ y: m.y
2475
+ })),
2476
+ positioned.participants.map((p) => /* @__PURE__ */ jsx(ParticipantComp, {
2477
+ participant: p.participant,
2478
+ x: p.x,
2479
+ y: p.y,
2480
+ width: p.width,
2481
+ height: p.height
2482
+ }))
2483
+ ]
2484
+ });
2485
+ }
2486
+
2487
+ //#endregion
2488
+ //#region ../mermaid/src/mermaid.tsx
2489
+ function Mermaid(props) {
2490
+ const diagram = parse(unwrap(props.code));
2491
+ if ("message" in diagram) {
2492
+ props.onError?.(diagram);
2493
+ return null;
2494
+ }
2495
+ if (diagram.type === "flowchart") return /* @__PURE__ */ jsx(Flowchart, {
2496
+ graph: diagram,
2497
+ class: props.class
2498
+ });
2499
+ if (diagram.type === "sequence") return /* @__PURE__ */ jsx(Sequence, {
2500
+ graph: diagram,
2501
+ class: props.class
2502
+ });
2503
+ return null;
2504
+ }
2505
+
2506
+ //#endregion
2507
+ //#region ../mermaid/src/remark-mermaid.ts
2508
+ function walk(node) {
2509
+ if (!node.children) return;
2510
+ for (let i = 0; i < node.children.length; i++) {
2511
+ const child = node.children[i];
2512
+ if (child.type === "code" && child.lang === "mermaid") node.children[i] = {
2513
+ type: "mdxJsxFlowElement",
2514
+ name: "Mermaid",
2515
+ attributes: [{
2516
+ type: "mdxJsxAttribute",
2517
+ name: "code",
2518
+ value: child.value ?? ""
2519
+ }],
2520
+ children: [],
2521
+ data: { _mdxExplicitJsx: true }
2522
+ };
2523
+ else walk(child);
2524
+ }
2525
+ }
2526
+ function remarkMermaid() {
2527
+ return (tree) => walk(tree);
2528
+ }
2529
+
2530
+ //#endregion
22
2531
  //#region ../ssg/src/plugins/docs-theme/styles.ts
23
2532
  /**
24
2533
  * Apple-inspired theme CSS for the docs-theme plugin.
25
2534
  *
26
2535
  * All class names are prefixed with `dt-` to avoid collisions.
27
- * Component styles (Card, Callout, Badge) come from @semajsx/ui via componentCSS.
2536
+ * Component styles (Card, Callout, Badge) from @semajsx/ui are collected automatically
2537
+ * by the SSR renderer from StyleTokens.
28
2538
  * This file contains layout, navigation, hero, typography, animations, and responsive styles.
29
2539
  */
30
2540
  const THEME_CSS = `
@@ -1019,26 +3529,20 @@ const tokens = defineTokens(tokenDefinition);
1019
3529
  * Five semantic variants: info, warning, success, error, tip
1020
3530
  * Matching the docs site callout design.
1021
3531
  */
1022
- var callout_style_exports = /* @__PURE__ */ __exportAll({
1023
- content: () => content$1,
1024
- icon: () => icon$2,
1025
- root: () => root$11,
1026
- title: () => title$1
1027
- });
1028
- const c$11 = classes([
3532
+ const c$10 = classes([
1029
3533
  "root",
1030
3534
  "title",
1031
3535
  "icon",
1032
3536
  "content"
1033
3537
  ]);
1034
- const root$11 = rule`${c$11.root} {
3538
+ const root$10 = rule`${c$10.root} {
1035
3539
  padding: 1.25rem 1.5rem;
1036
3540
  margin: 1.5rem 0;
1037
3541
  border-radius: 14px;
1038
3542
  border: 0.5px solid rgba(0, 0, 0, 0.04);
1039
3543
  font-family: ${tokens.fonts.base};
1040
3544
  }`;
1041
- const title$1 = rule`${c$11.title} {
3545
+ const title$1 = rule`${c$10.title} {
1042
3546
  font-weight: ${tokens.fontWeights.semibold};
1043
3547
  font-size: 0.9375rem;
1044
3548
  margin: 0 0 0.5rem;
@@ -1047,7 +3551,7 @@ const title$1 = rule`${c$11.title} {
1047
3551
  gap: ${tokens.space.sm};
1048
3552
  letter-spacing: -0.005em;
1049
3553
  }`;
1050
- const icon$2 = rule`${c$11.icon} {
3554
+ const icon$2 = rule`${c$10.icon} {
1051
3555
  width: 18px;
1052
3556
  height: 18px;
1053
3557
  display: inline-flex;
@@ -1055,7 +3559,7 @@ const icon$2 = rule`${c$11.icon} {
1055
3559
  justify-content: center;
1056
3560
  flex-shrink: 0;
1057
3561
  }`;
1058
- const content$1 = rule`${c$11.content} {
3562
+ const content$1 = rule`${c$10.content} {
1059
3563
  color: ${tokens.colors.text};
1060
3564
  font-size: 0.9375rem;
1061
3565
  line-height: ${tokens.lineHeights.normal};
@@ -1159,7 +3663,7 @@ function Callout(props) {
1159
3663
  const config = calloutConfig[props.type ?? "info"];
1160
3664
  const IconComponent = config.icon;
1161
3665
  return /* @__PURE__ */ jsxs("div", {
1162
- class: [root$11, props.class],
3666
+ class: [root$10, props.class],
1163
3667
  style: `background: ${config.bg}`,
1164
3668
  role: "note",
1165
3669
  children: [props.title && /* @__PURE__ */ jsxs("div", {
@@ -1183,9 +3687,8 @@ function Callout(props) {
1183
3687
  *
1184
3688
  * Pill-shaped labels with semantic color variants.
1185
3689
  */
1186
- var badge_style_exports = /* @__PURE__ */ __exportAll({ root: () => root$10 });
1187
- const c$10 = classes(["root"]);
1188
- const root$10 = rule`${c$10.root} {
3690
+ const c$9 = classes(["root"]);
3691
+ const root$9 = rule`${c$9.root} {
1189
3692
  display: inline-flex;
1190
3693
  align-items: center;
1191
3694
  font-size: 0.6875rem;
@@ -1230,7 +3733,7 @@ const badgeColors = {
1230
3733
  function Badge(props) {
1231
3734
  const config = badgeColors[props.color ?? "default"];
1232
3735
  return /* @__PURE__ */ jsx("span", {
1233
- class: [root$10, props.class],
3736
+ class: [root$9, props.class],
1234
3737
  style: `background: ${config.bg}; color: ${config.fg}`,
1235
3738
  children: props.children
1236
3739
  });
@@ -1245,19 +3748,7 @@ function Badge(props) {
1245
3748
  * - feature: Large card with icon, heading, description
1246
3749
  * - link: Smaller clickable card for navigation
1247
3750
  */
1248
- var card_style_exports = /* @__PURE__ */ __exportAll({
1249
- desc: () => desc,
1250
- descLink: () => descLink,
1251
- feature: () => feature,
1252
- featureStates: () => featureStates,
1253
- heading: () => heading,
1254
- headingLink: () => headingLink,
1255
- icon: () => icon$1,
1256
- link: () => link,
1257
- linkStates: () => linkStates,
1258
- root: () => root$9
1259
- });
1260
- const c$9 = classes([
3751
+ const c$8 = classes([
1261
3752
  "root",
1262
3753
  "feature",
1263
3754
  "link",
@@ -1265,22 +3756,22 @@ const c$9 = classes([
1265
3756
  "heading",
1266
3757
  "desc"
1267
3758
  ]);
1268
- const root$9 = rule`${c$9.root} {
3759
+ const root$8 = rule`${c$8.root} {
1269
3760
  background: white;
1270
3761
  border: 0.5px solid rgba(0, 0, 0, 0.06);
1271
3762
  font-family: ${tokens.fonts.base};
1272
3763
  transition: all 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
1273
3764
  }`;
1274
- const feature = rule`${c$9.feature} {
3765
+ const feature = rule`${c$8.feature} {
1275
3766
  border-radius: ${tokens.radii.xl};
1276
3767
  padding: 2.5rem;
1277
3768
  box-shadow: ${tokens.shadows.md};
1278
3769
  }`;
1279
- const featureStates = rule`${c$9.feature}:hover {
3770
+ const featureStates = rule`${c$8.feature}:hover {
1280
3771
  transform: translateY(-4px) scale(1.01);
1281
3772
  box-shadow: ${tokens.shadows.lg};
1282
3773
  }`;
1283
- const link = rule`${c$9.link} {
3774
+ const link = rule`${c$8.link} {
1284
3775
  display: block;
1285
3776
  border-radius: ${tokens.radii.lg};
1286
3777
  padding: 1.75rem;
@@ -1288,12 +3779,12 @@ const link = rule`${c$9.link} {
1288
3779
  text-decoration: none;
1289
3780
  cursor: pointer;
1290
3781
  }`;
1291
- const linkStates = rules(rule`${c$9.link}:hover {
3782
+ const linkStates = rules(rule`${c$8.link}:hover {
1292
3783
  border-color: rgba(0, 113, 227, 0.3);
1293
3784
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
1294
3785
  transform: translateY(-2px);
1295
3786
  }`);
1296
- const icon$1 = rule`${c$9.icon} {
3787
+ const icon$1 = rule`${c$8.icon} {
1297
3788
  font-size: 2rem;
1298
3789
  width: 48px;
1299
3790
  height: 48px;
@@ -1304,24 +3795,24 @@ const icon$1 = rule`${c$9.icon} {
1304
3795
  border-radius: ${tokens.radii.md};
1305
3796
  margin-bottom: 1.25rem;
1306
3797
  }`;
1307
- const heading = rule`${c$9.heading} {
3798
+ const heading = rule`${c$8.heading} {
1308
3799
  font-size: 1.375rem;
1309
3800
  font-weight: ${tokens.fontWeights.semibold};
1310
3801
  color: ${tokens.colors.text};
1311
3802
  margin: 0 0 0.5rem;
1312
3803
  letter-spacing: -0.01em;
1313
3804
  }`;
1314
- const headingLink = rule`${c$9.link} ${c$9.heading} {
3805
+ const headingLink = rule`${c$8.link} ${c$8.heading} {
1315
3806
  font-size: ${tokens.fontSizes.lg};
1316
3807
  margin-bottom: 0.25rem;
1317
3808
  }`;
1318
- const desc = rule`${c$9.desc} {
3809
+ const desc = rule`${c$8.desc} {
1319
3810
  color: ${tokens.colors.textMuted};
1320
3811
  line-height: ${tokens.lineHeights.normal};
1321
3812
  font-size: 0.9375rem;
1322
3813
  margin: 0;
1323
3814
  }`;
1324
- const descLink = rule`${c$9.link} ${c$9.desc} {
3815
+ const descLink = rule`${c$8.link} ${c$8.desc} {
1325
3816
  font-size: ${tokens.fontSizes.sm};
1326
3817
  line-height: 1.5;
1327
3818
  }`;
@@ -1348,7 +3839,7 @@ function Card(props) {
1348
3839
  if (variant === "link") return /* @__PURE__ */ jsx("a", {
1349
3840
  href: props.href,
1350
3841
  class: [
1351
- root$9,
3842
+ root$8,
1352
3843
  link,
1353
3844
  linkStates,
1354
3845
  props.class
@@ -1358,7 +3849,7 @@ function Card(props) {
1358
3849
  });
1359
3850
  return /* @__PURE__ */ jsx("div", {
1360
3851
  class: [
1361
- root$9,
3852
+ root$8,
1362
3853
  feature,
1363
3854
  featureStates,
1364
3855
  props.class
@@ -1375,26 +3866,18 @@ function Card(props) {
1375
3866
  *
1376
3867
  * A tab bar with active indicator and content panels.
1377
3868
  */
1378
- var tabs_style_exports = /* @__PURE__ */ __exportAll({
1379
- active: () => active,
1380
- list: () => list,
1381
- panel: () => panel,
1382
- root: () => root$8,
1383
- trigger: () => trigger,
1384
- triggerStates: () => triggerStates
1385
- });
1386
- const c$8 = classes([
3869
+ const c$7 = classes([
1387
3870
  "root",
1388
3871
  "list",
1389
3872
  "trigger",
1390
3873
  "active",
1391
3874
  "panel"
1392
3875
  ]);
1393
- const root$8 = rule`${c$8.root} {
3876
+ const root$7 = rule`${c$7.root} {
1394
3877
  margin: 1.5rem 0;
1395
3878
  font-family: ${tokens.fonts.base};
1396
3879
  }`;
1397
- const list = rule`${c$8.list} {
3880
+ const list = rule`${c$7.list} {
1398
3881
  display: flex;
1399
3882
  gap: 0;
1400
3883
  border-bottom: 1px solid ${tokens.colors.border};
@@ -1402,7 +3885,7 @@ const list = rule`${c$8.list} {
1402
3885
  overflow-x: auto;
1403
3886
  -webkit-overflow-scrolling: touch;
1404
3887
  }`;
1405
- const trigger = rule`${c$8.trigger} {
3888
+ const trigger = rule`${c$7.trigger} {
1406
3889
  padding: 0.625rem 1rem;
1407
3890
  font-size: ${tokens.fontSizes.sm};
1408
3891
  font-weight: ${tokens.fontWeights.medium};
@@ -1416,17 +3899,17 @@ const trigger = rule`${c$8.trigger} {
1416
3899
  transition: color ${tokens.transitions.fast}, border-color ${tokens.transitions.fast};
1417
3900
  margin-bottom: -1px;
1418
3901
  }`;
1419
- const triggerStates = rules(rule`${c$8.trigger}:hover {
3902
+ const triggerStates = rules(rule`${c$7.trigger}:hover {
1420
3903
  color: ${tokens.colors.text};
1421
- }`, rule`${c$8.trigger}:focus-visible {
3904
+ }`, rule`${c$7.trigger}:focus-visible {
1422
3905
  outline: 2px solid ${tokens.colors.primary};
1423
3906
  outline-offset: -2px;
1424
3907
  }`);
1425
- const active = rule`${c$8.active} {
3908
+ const active = rule`${c$7.active} {
1426
3909
  color: ${tokens.colors.primary};
1427
3910
  border-bottom-color: ${tokens.colors.primary};
1428
3911
  }`;
1429
- const panel = rule`${c$8.panel} {
3912
+ const panel = rule`${c$7.panel} {
1430
3913
  padding: 1rem 0;
1431
3914
  }`;
1432
3915
 
@@ -1448,7 +3931,7 @@ function Tabs(props) {
1448
3931
  const active = signal(props.defaultValue);
1449
3932
  _ssrDefaultTab = props.defaultValue;
1450
3933
  return /* @__PURE__ */ jsx("div", {
1451
- class: [root$8, props.class],
3934
+ class: [root$7, props.class],
1452
3935
  "data-tabs": active,
1453
3936
  onClick: (e) => {
1454
3937
  const tab = e.target.closest("[role=tab]");
@@ -1506,15 +3989,7 @@ function TabPanel(props) {
1506
3989
  *
1507
3990
  * Numbered step indicators for tutorials and guides.
1508
3991
  */
1509
- var steps_style_exports = /* @__PURE__ */ __exportAll({
1510
- body: () => body,
1511
- content: () => content,
1512
- item: () => item,
1513
- number: () => number,
1514
- root: () => root$7,
1515
- title: () => title
1516
- });
1517
- const c$7 = classes([
3992
+ const c$6 = classes([
1518
3993
  "root",
1519
3994
  "item",
1520
3995
  "number",
@@ -1522,20 +3997,20 @@ const c$7 = classes([
1522
3997
  "title",
1523
3998
  "body"
1524
3999
  ]);
1525
- const root$7 = rule`${c$7.root} {
4000
+ const root$6 = rule`${c$6.root} {
1526
4001
  display: flex;
1527
4002
  flex-direction: column;
1528
4003
  gap: 0;
1529
4004
  margin: 1.5rem 0;
1530
4005
  font-family: ${tokens.fonts.base};
1531
4006
  }`;
1532
- const item = rule`${c$7.item} {
4007
+ const item = rule`${c$6.item} {
1533
4008
  display: flex;
1534
4009
  gap: 1rem;
1535
4010
  padding: 1.25rem 0;
1536
4011
  border-bottom: 0.5px solid ${tokens.colors.border};
1537
4012
  }`;
1538
- const number = rule`${c$7.number} {
4013
+ const number = rule`${c$6.number} {
1539
4014
  flex-shrink: 0;
1540
4015
  width: 28px;
1541
4016
  height: 28px;
@@ -1549,18 +4024,18 @@ const number = rule`${c$7.number} {
1549
4024
  justify-content: center;
1550
4025
  margin-top: 0.125rem;
1551
4026
  }`;
1552
- const content = rule`${c$7.content} {
4027
+ const content = rule`${c$6.content} {
1553
4028
  flex: 1;
1554
4029
  min-width: 0;
1555
4030
  }`;
1556
- const title = rule`${c$7.title} {
4031
+ const title = rule`${c$6.title} {
1557
4032
  font-size: ${tokens.fontSizes.md};
1558
4033
  font-weight: ${tokens.fontWeights.semibold};
1559
4034
  color: ${tokens.colors.text};
1560
4035
  margin: 0 0 0.375rem;
1561
4036
  letter-spacing: -0.005em;
1562
4037
  }`;
1563
- const body = rule`${c$7.body} {
4038
+ const body = rule`${c$6.body} {
1564
4039
  color: ${tokens.colors.textMuted};
1565
4040
  font-size: ${tokens.fontSizes.sm};
1566
4041
  line-height: ${tokens.lineHeights.normal};
@@ -1570,7 +4045,7 @@ const body = rule`${c$7.body} {
1570
4045
  //#region ../ui/src/components/steps/steps.tsx
1571
4046
  function Steps(props) {
1572
4047
  return /* @__PURE__ */ jsx("div", {
1573
- class: [root$7, props.class],
4048
+ class: [root$6, props.class],
1574
4049
  children: props.children
1575
4050
  });
1576
4051
  }
@@ -1650,6 +4125,38 @@ const darkTheme = createTheme(tokens, {
1650
4125
  }
1651
4126
  });
1652
4127
 
4128
+ //#endregion
4129
+ //#region ../ui/src/theme/provider.tsx
4130
+ /** @jsxImportSource @semajsx/dom */
4131
+ /**
4132
+ * ThemeProvider component
4133
+ *
4134
+ * Wraps the application to provide theme context and inject CSS custom properties.
4135
+ * Components can access theme tokens via ctx.inject(ThemeContext).
4136
+ *
4137
+ * @example
4138
+ * ```tsx
4139
+ * import { ThemeProvider } from "@semajsx/ui/theme";
4140
+ *
4141
+ * function App() {
4142
+ * return (
4143
+ * <ThemeProvider>
4144
+ * <Button>Themed button</Button>
4145
+ * </ThemeProvider>
4146
+ * );
4147
+ * }
4148
+ *
4149
+ * // With dark theme
4150
+ * <ThemeProvider theme="dark">
4151
+ * <App />
4152
+ * </ThemeProvider>
4153
+ * ```
4154
+ */
4155
+ /**
4156
+ * Context for passing theme tokens through the component tree
4157
+ */
4158
+ const ThemeContext = context("semajsx-theme");
4159
+
1653
4160
  //#endregion
1654
4161
  //#region ../ui/src/components/button/button.style.ts
1655
4162
  /**
@@ -1658,23 +4165,7 @@ const darkTheme = createTheme(tokens, {
1658
4165
  * All styles reference theme tokens via CSS custom properties,
1659
4166
  * so they respond to theme changes automatically.
1660
4167
  */
1661
- var button_style_exports = /* @__PURE__ */ __exportAll({
1662
- danger: () => danger,
1663
- dangerStates: () => dangerStates,
1664
- ghost: () => ghost,
1665
- ghostStates: () => ghostStates,
1666
- icon: () => icon,
1667
- lg: () => lg$2,
1668
- md: () => md$2,
1669
- outline: () => outline,
1670
- outlineStates: () => outlineStates,
1671
- root: () => root$6,
1672
- rootStates: () => rootStates$1,
1673
- sm: () => sm$2,
1674
- solid: () => solid,
1675
- solidStates: () => solidStates
1676
- });
1677
- const c$6 = classes([
4168
+ const c$5 = classes([
1678
4169
  "root",
1679
4170
  "solid",
1680
4171
  "outline",
@@ -1685,7 +4176,7 @@ const c$6 = classes([
1685
4176
  "danger",
1686
4177
  "icon"
1687
4178
  ]);
1688
- const root$6 = rule`${c$6.root} {
4179
+ const root$5 = rule`${c$5.root} {
1689
4180
  display: inline-flex;
1690
4181
  align-items: center;
1691
4182
  justify-content: center;
@@ -1700,155 +4191,121 @@ const root$6 = rule`${c$6.root} {
1700
4191
  user-select: none;
1701
4192
  transition: all ${tokens.transitions.normal};
1702
4193
  }`;
1703
- const rootStates$1 = rules(rule`${c$6.root}:focus-visible {
4194
+ const rootStates$1 = rules(rule`${c$5.root}:focus-visible {
1704
4195
  outline: 2px solid ${tokens.colors.primary};
1705
4196
  outline-offset: 2px;
1706
- }`, rule`${c$6.root}:disabled {
4197
+ }`, rule`${c$5.root}:disabled {
1707
4198
  opacity: 0.5;
1708
4199
  cursor: not-allowed;
1709
4200
  pointer-events: none;
1710
4201
  }`);
1711
- const solid = rule`${c$6.solid} {
4202
+ const solid = rule`${c$5.solid} {
1712
4203
  background: ${tokens.colors.primary};
1713
4204
  color: ${tokens.colors.onPrimary};
1714
4205
  border-color: ${tokens.colors.primary};
1715
4206
  }`;
1716
- const solidStates = rules(rule`${c$6.solid}:hover:not(:disabled) {
4207
+ const solidStates = rules(rule`${c$5.solid}:hover:not(:disabled) {
1717
4208
  background: ${tokens.colors.primaryHover};
1718
4209
  border-color: ${tokens.colors.primaryHover};
1719
4210
  transform: scale(1.02);
1720
4211
  box-shadow: ${tokens.shadows.primaryGlow};
1721
- }`, rule`${c$6.solid}:active:not(:disabled) {
4212
+ }`, rule`${c$5.solid}:active:not(:disabled) {
1722
4213
  background: ${tokens.colors.primaryActive};
1723
4214
  border-color: ${tokens.colors.primaryActive};
1724
4215
  transform: scale(0.98);
1725
4216
  box-shadow: none;
1726
4217
  }`);
1727
- const outline = rule`${c$6.outline} {
4218
+ const outline = rule`${c$5.outline} {
1728
4219
  background: transparent;
1729
4220
  color: ${tokens.colors.primary};
1730
4221
  border-color: ${tokens.colors.primary};
1731
4222
  }`;
1732
- const outlineStates = rules(rule`${c$6.outline}:hover:not(:disabled) {
4223
+ const outlineStates = rules(rule`${c$5.outline}:hover:not(:disabled) {
1733
4224
  background: ${tokens.colors.primary};
1734
4225
  color: ${tokens.colors.onPrimary};
1735
4226
  transform: scale(1.02);
1736
- }`, rule`${c$6.outline}:active:not(:disabled) {
4227
+ }`, rule`${c$5.outline}:active:not(:disabled) {
1737
4228
  background: ${tokens.colors.primaryActive};
1738
4229
  color: ${tokens.colors.onPrimary};
1739
4230
  transform: scale(0.98);
1740
4231
  }`);
1741
- const ghost = rule`${c$6.ghost} {
4232
+ const ghost = rule`${c$5.ghost} {
1742
4233
  background: transparent;
1743
4234
  color: ${tokens.colors.text};
1744
4235
  border-color: transparent;
1745
4236
  }`;
1746
- const ghostStates = rules(rule`${c$6.ghost}:hover:not(:disabled) {
4237
+ const ghostStates = rules(rule`${c$5.ghost}:hover:not(:disabled) {
1747
4238
  background: ${tokens.colors.surface};
1748
- }`, rule`${c$6.ghost}:active:not(:disabled) {
4239
+ }`, rule`${c$5.ghost}:active:not(:disabled) {
1749
4240
  background: ${tokens.colors.border};
1750
4241
  }`);
1751
- const danger = rule`${c$6.danger} {
4242
+ const danger = rule`${c$5.danger} {
1752
4243
  background: ${tokens.colors.danger};
1753
4244
  color: ${tokens.colors.onDanger};
1754
4245
  border-color: ${tokens.colors.danger};
1755
4246
  }`;
1756
- const dangerStates = rules(rule`${c$6.danger}:hover:not(:disabled) {
4247
+ const dangerStates = rules(rule`${c$5.danger}:hover:not(:disabled) {
1757
4248
  background: ${tokens.colors.dangerHover};
1758
4249
  border-color: ${tokens.colors.dangerHover};
1759
4250
  transform: scale(1.02);
1760
- }`, rule`${c$6.danger}:focus-visible {
4251
+ }`, rule`${c$5.danger}:focus-visible {
1761
4252
  outline-color: ${tokens.colors.danger};
1762
4253
  }`);
1763
- const sm$2 = rule`${c$6.sm} {
4254
+ const sm$2 = rule`${c$5.sm} {
1764
4255
  padding: ${tokens.space.sm} ${tokens.space.lg};
1765
4256
  font-size: ${tokens.fontSizes.sm};
1766
4257
  }`;
1767
- const md$2 = rule`${c$6.md} {
4258
+ const md$2 = rule`${c$5.md} {
1768
4259
  padding: ${tokens.space.md} ${tokens.space.xl};
1769
4260
  font-size: ${tokens.fontSizes.md};
1770
4261
  }`;
1771
- const lg$2 = rule`${c$6.lg} {
4262
+ const lg$2 = rule`${c$5.lg} {
1772
4263
  padding: 0.875rem 1.75rem;
1773
4264
  font-size: ${tokens.fontSizes.lg};
1774
4265
  }`;
1775
- const icon = rule`${c$6.icon} {
4266
+ const icon = rule`${c$5.icon} {
1776
4267
  display: inline-flex;
1777
4268
  flex-shrink: 0;
1778
4269
  }`;
1779
4270
 
1780
4271
  //#endregion
1781
- //#region ../ui/src/components/code-block/code-block.style.ts
1782
- /**
1783
- * CodeBlock component styles
1784
- *
1785
- * Dark-themed code display with optional language header.
1786
- */
1787
- var code_block_style_exports = /* @__PURE__ */ __exportAll({
1788
- header: () => header,
1789
- inline: () => inline,
1790
- lang: () => lang,
1791
- pre: () => pre,
1792
- root: () => root$5
1793
- });
1794
- const c$5 = classes([
1795
- "root",
1796
- "header",
1797
- "lang",
1798
- "pre",
1799
- "inline"
1800
- ]);
1801
- const root$5 = rule`${c$5.root} {
1802
- margin: 1.5rem 0;
1803
- border-radius: ${tokens.radii.md};
1804
- overflow: hidden;
1805
- border: 0.5px solid rgba(0, 0, 0, 0.1);
1806
- font-family: ${tokens.fonts.mono};
1807
- }`;
1808
- const header = rule`${c$5.header} {
1809
- background: #161617;
1810
- padding: 0.5rem 1.25rem;
1811
- display: flex;
1812
- justify-content: space-between;
1813
- align-items: center;
1814
- }`;
1815
- const lang = rule`${c$5.lang} {
1816
- color: #86868b;
1817
- font-size: 0.6875rem;
1818
- text-transform: uppercase;
1819
- font-weight: ${tokens.fontWeights.semibold};
1820
- letter-spacing: 0.04em;
1821
- font-family: ${tokens.fonts.mono};
1822
- }`;
1823
- const pre = rule`${c$5.pre} {
1824
- background: #1d1d1f;
1825
- color: #e5e5ea;
1826
- padding: 1.25rem 1.5rem;
1827
- overflow-x: auto;
1828
- margin: 0;
1829
- font-size: ${tokens.fontSizes.sm};
1830
- line-height: 1.65;
1831
- font-family: ${tokens.fonts.mono};
1832
- }`;
1833
- const inline = rule`${c$5.inline} {
1834
- background: rgba(0, 0, 0, 0.04);
1835
- padding: 0.15rem 0.4rem;
1836
- border-radius: 5px;
1837
- font-size: 0.875em;
1838
- border: 0.5px solid rgba(0, 0, 0, 0.06);
1839
- font-family: ${tokens.fonts.mono};
1840
- }`;
4272
+ //#region ../ui/src/components/button/button.tsx
4273
+ const variantStyles = {
4274
+ solid: [solid, solidStates],
4275
+ outline: [outline, outlineStates],
4276
+ ghost: [ghost, ghostStates]
4277
+ };
4278
+ const sizeStyles$2 = {
4279
+ sm: sm$2,
4280
+ md: md$2,
4281
+ lg: lg$2
4282
+ };
4283
+ function Button(props) {
4284
+ const variant = props.variant ?? "solid";
4285
+ const size = props.size ?? "md";
4286
+ const color = props.color ?? "default";
4287
+ return /* @__PURE__ */ jsx("button", {
4288
+ type: props.type ?? "button",
4289
+ disabled: props.disabled,
4290
+ class: [
4291
+ root$5,
4292
+ rootStates$1,
4293
+ ...variantStyles[variant],
4294
+ sizeStyles$2[size],
4295
+ color === "danger" && [danger, dangerStates],
4296
+ props.class
4297
+ ],
4298
+ onClick: props.onClick,
4299
+ "aria-label": props["aria-label"],
4300
+ children: props.children
4301
+ });
4302
+ }
1841
4303
 
1842
4304
  //#endregion
1843
4305
  //#region ../ui/src/components/separator/separator.style.ts
1844
4306
  /**
1845
4307
  * Separator component styles
1846
4308
  */
1847
- var separator_style_exports = /* @__PURE__ */ __exportAll({
1848
- horizontal: () => horizontal,
1849
- root: () => root$4,
1850
- vertical: () => vertical
1851
- });
1852
4309
  const c$4 = classes(["root", "vertical"]);
1853
4310
  const root$4 = rule`${c$4.root} {
1854
4311
  border: none;
@@ -1867,20 +4324,28 @@ const vertical = rule`${c$4.vertical} {
1867
4324
  margin: 0 ${tokens.space.lg};
1868
4325
  }`;
1869
4326
 
4327
+ //#endregion
4328
+ //#region ../ui/src/components/separator/separator.tsx
4329
+ function Separator(props) {
4330
+ const orientation = props.orientation ?? "horizontal";
4331
+ return /* @__PURE__ */ jsx("div", {
4332
+ role: "separator",
4333
+ "aria-orientation": orientation,
4334
+ class: [
4335
+ root$4,
4336
+ horizontal,
4337
+ orientation === "vertical" && vertical,
4338
+ props.class
4339
+ ],
4340
+ style: props.style
4341
+ });
4342
+ }
4343
+
1870
4344
  //#endregion
1871
4345
  //#region ../ui/src/components/input/input.style.ts
1872
4346
  /**
1873
4347
  * Input component styles
1874
4348
  */
1875
- var input_style_exports = /* @__PURE__ */ __exportAll({
1876
- label: () => label$1,
1877
- lg: () => lg$1,
1878
- md: () => md$1,
1879
- root: () => root$3,
1880
- rootStates: () => rootStates,
1881
- sm: () => sm$1,
1882
- wrapper: () => wrapper
1883
- });
1884
4349
  const c$3 = classes([
1885
4350
  "root",
1886
4351
  "wrapper",
@@ -1937,19 +4402,47 @@ const lg$1 = rule`${c$3.lg} {
1937
4402
  font-size: ${tokens.fontSizes.lg};
1938
4403
  }`;
1939
4404
 
4405
+ //#endregion
4406
+ //#region ../ui/src/components/input/input.tsx
4407
+ const sizeStyles$1 = {
4408
+ sm: sm$1,
4409
+ md: md$1,
4410
+ lg: lg$1
4411
+ };
4412
+ function Input(props) {
4413
+ const size = props.size ?? "md";
4414
+ const inputId = props.id ?? props.name;
4415
+ const input = /* @__PURE__ */ jsx("input", {
4416
+ type: props.type ?? "text",
4417
+ id: inputId,
4418
+ name: props.name,
4419
+ placeholder: props.placeholder,
4420
+ value: props.value,
4421
+ disabled: props.disabled,
4422
+ readOnly: props.readOnly,
4423
+ class: [
4424
+ root$3,
4425
+ rootStates,
4426
+ sizeStyles$1[size],
4427
+ props.class
4428
+ ]
4429
+ });
4430
+ if (props.label) return /* @__PURE__ */ jsxs("div", {
4431
+ class: wrapper,
4432
+ children: [/* @__PURE__ */ jsx("label", {
4433
+ class: label$1,
4434
+ for: inputId,
4435
+ children: props.label
4436
+ }), input]
4437
+ });
4438
+ return input;
4439
+ }
4440
+
1940
4441
  //#endregion
1941
4442
  //#region ../ui/src/components/avatar/avatar.style.ts
1942
4443
  /**
1943
4444
  * Avatar component styles
1944
4445
  */
1945
- var avatar_style_exports = /* @__PURE__ */ __exportAll({
1946
- fallback: () => fallback,
1947
- image: () => image,
1948
- lg: () => lg,
1949
- md: () => md,
1950
- root: () => root$2,
1951
- sm: () => sm
1952
- });
1953
4446
  const c$2 = classes([
1954
4447
  "root",
1955
4448
  "image",
@@ -1997,12 +4490,39 @@ const lg = rule`${c$2.lg} {
1997
4490
  font-size: ${tokens.fontSizes.md};
1998
4491
  }`;
1999
4492
 
4493
+ //#endregion
4494
+ //#region ../ui/src/components/avatar/avatar.tsx
4495
+ const sizeStyles = {
4496
+ sm,
4497
+ md,
4498
+ lg
4499
+ };
4500
+ function Avatar(props) {
4501
+ const size = props.size ?? "md";
4502
+ return /* @__PURE__ */ jsx("div", {
4503
+ class: [
4504
+ root$2,
4505
+ sizeStyles[size],
4506
+ props.class
4507
+ ],
4508
+ role: "img",
4509
+ "aria-label": props.alt ?? props.initials ?? "Avatar",
4510
+ children: props.src ? /* @__PURE__ */ jsx("img", {
4511
+ class: image,
4512
+ src: props.src,
4513
+ alt: props.alt ?? ""
4514
+ }) : /* @__PURE__ */ jsx("span", {
4515
+ class: fallback,
4516
+ children: props.initials ?? "?"
4517
+ })
4518
+ });
4519
+ }
4520
+
2000
4521
  //#endregion
2001
4522
  //#region ../ui/src/components/kbd/kbd.style.ts
2002
4523
  /**
2003
4524
  * Kbd (keyboard) component styles
2004
4525
  */
2005
- var kbd_style_exports = /* @__PURE__ */ __exportAll({ root: () => root$1 });
2006
4526
  const c$1 = classes(["root"]);
2007
4527
  const root$1 = rule`${c$1.root} {
2008
4528
  display: inline-flex;
@@ -2024,20 +4544,20 @@ const root$1 = rule`${c$1.root} {
2024
4544
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
2025
4545
  }`;
2026
4546
 
4547
+ //#endregion
4548
+ //#region ../ui/src/components/kbd/kbd.tsx
4549
+ function Kbd(props) {
4550
+ return /* @__PURE__ */ jsx("kbd", {
4551
+ class: [root$1, props.class],
4552
+ children: props.children
4553
+ });
4554
+ }
4555
+
2027
4556
  //#endregion
2028
4557
  //#region ../ui/src/components/switch/switch.style.ts
2029
4558
  /**
2030
4559
  * Switch component styles
2031
4560
  */
2032
- var switch_style_exports = /* @__PURE__ */ __exportAll({
2033
- label: () => label,
2034
- root: () => root,
2035
- rootDisabled: () => rootDisabled,
2036
- thumb: () => thumb,
2037
- thumbOn: () => thumbOn,
2038
- track: () => track,
2039
- trackOn: () => trackOn
2040
- });
2041
4561
  const c = classes([
2042
4562
  "root",
2043
4563
  "track",
@@ -2091,165 +4611,6 @@ const label = rule`${c.label} {
2091
4611
  letter-spacing: -0.005em;
2092
4612
  }`;
2093
4613
 
2094
- //#endregion
2095
- //#region ../ui/src/css.ts
2096
- /**
2097
- * Pre-collected CSS for SSG/SSR usage
2098
- *
2099
- * Since @semajsx/style's inject() requires a DOM, this module provides
2100
- * all component CSS as a static string for server-side rendering.
2101
- *
2102
- * @example
2103
- * ```tsx
2104
- * import { componentCSS } from "@semajsx/ui/css";
2105
- *
2106
- * // Include in a <style> tag for SSG output
2107
- * <style>{componentCSS}</style>
2108
- * ```
2109
- */
2110
- function collectCSS(styles) {
2111
- return Object.values(styles).filter((v) => isStyleToken(v)).map((t) => t.__cssTemplate).join("\n");
2112
- }
2113
- /** All @semajsx/ui component CSS (theme variables + component rules) */
2114
- const componentCSS = [
2115
- lightTheme.__cssTemplate,
2116
- collectCSS(button_style_exports),
2117
- collectCSS(card_style_exports),
2118
- collectCSS(callout_style_exports),
2119
- collectCSS(badge_style_exports),
2120
- collectCSS(code_block_style_exports),
2121
- collectCSS(tabs_style_exports),
2122
- collectCSS(steps_style_exports),
2123
- collectCSS(separator_style_exports),
2124
- collectCSS(input_style_exports),
2125
- collectCSS(avatar_style_exports),
2126
- collectCSS(kbd_style_exports),
2127
- collectCSS(switch_style_exports)
2128
- ].join("\n");
2129
-
2130
- //#endregion
2131
- //#region ../ui/src/components/button/button.tsx
2132
- const variantStyles = {
2133
- solid: [solid, solidStates],
2134
- outline: [outline, outlineStates],
2135
- ghost: [ghost, ghostStates]
2136
- };
2137
- const sizeStyles$2 = {
2138
- sm: sm$2,
2139
- md: md$2,
2140
- lg: lg$2
2141
- };
2142
- function Button(props) {
2143
- const variant = props.variant ?? "solid";
2144
- const size = props.size ?? "md";
2145
- const color = props.color ?? "default";
2146
- return /* @__PURE__ */ jsx("button", {
2147
- type: props.type ?? "button",
2148
- disabled: props.disabled,
2149
- class: [
2150
- root$6,
2151
- rootStates$1,
2152
- ...variantStyles[variant],
2153
- sizeStyles$2[size],
2154
- color === "danger" && [danger, dangerStates],
2155
- props.class
2156
- ],
2157
- onClick: props.onClick,
2158
- "aria-label": props["aria-label"],
2159
- children: props.children
2160
- });
2161
- }
2162
-
2163
- //#endregion
2164
- //#region ../ui/src/components/separator/separator.tsx
2165
- function Separator(props) {
2166
- const orientation = props.orientation ?? "horizontal";
2167
- return /* @__PURE__ */ jsx("div", {
2168
- role: "separator",
2169
- "aria-orientation": orientation,
2170
- class: [
2171
- root$4,
2172
- horizontal,
2173
- orientation === "vertical" && vertical,
2174
- props.class
2175
- ],
2176
- style: props.style
2177
- });
2178
- }
2179
-
2180
- //#endregion
2181
- //#region ../ui/src/components/input/input.tsx
2182
- const sizeStyles$1 = {
2183
- sm: sm$1,
2184
- md: md$1,
2185
- lg: lg$1
2186
- };
2187
- function Input(props) {
2188
- const size = props.size ?? "md";
2189
- const inputId = props.id ?? props.name;
2190
- const input = /* @__PURE__ */ jsx("input", {
2191
- type: props.type ?? "text",
2192
- id: inputId,
2193
- name: props.name,
2194
- placeholder: props.placeholder,
2195
- value: props.value,
2196
- disabled: props.disabled,
2197
- readOnly: props.readOnly,
2198
- class: [
2199
- root$3,
2200
- rootStates,
2201
- sizeStyles$1[size],
2202
- props.class
2203
- ]
2204
- });
2205
- if (props.label) return /* @__PURE__ */ jsxs("div", {
2206
- class: wrapper,
2207
- children: [/* @__PURE__ */ jsx("label", {
2208
- class: label$1,
2209
- for: inputId,
2210
- children: props.label
2211
- }), input]
2212
- });
2213
- return input;
2214
- }
2215
-
2216
- //#endregion
2217
- //#region ../ui/src/components/avatar/avatar.tsx
2218
- const sizeStyles = {
2219
- sm,
2220
- md,
2221
- lg
2222
- };
2223
- function Avatar(props) {
2224
- const size = props.size ?? "md";
2225
- return /* @__PURE__ */ jsx("div", {
2226
- class: [
2227
- root$2,
2228
- sizeStyles[size],
2229
- props.class
2230
- ],
2231
- role: "img",
2232
- "aria-label": props.alt ?? props.initials ?? "Avatar",
2233
- children: props.src ? /* @__PURE__ */ jsx("img", {
2234
- class: image,
2235
- src: props.src,
2236
- alt: props.alt ?? ""
2237
- }) : /* @__PURE__ */ jsx("span", {
2238
- class: fallback,
2239
- children: props.initials ?? "?"
2240
- })
2241
- });
2242
- }
2243
-
2244
- //#endregion
2245
- //#region ../ui/src/components/kbd/kbd.tsx
2246
- function Kbd(props) {
2247
- return /* @__PURE__ */ jsx("kbd", {
2248
- class: [root$1, props.class],
2249
- children: props.children
2250
- });
2251
- }
2252
-
2253
4614
  //#endregion
2254
4615
  //#region ../ui/src/components/switch/switch.tsx
2255
4616
  function Switch(props) {
@@ -2344,7 +4705,7 @@ const DIFFICULTY_LABELS = {
2344
4705
  };
2345
4706
  function createComponents(options) {
2346
4707
  function Document(props) {
2347
- const { children, title, scripts, css } = props;
4708
+ const { children, title, scripts, css, styles } = props;
2348
4709
  const defaultTitle = options.title;
2349
4710
  const pageTitle = title ?? defaultTitle;
2350
4711
  const desc = options.description ?? "";
@@ -2385,7 +4746,8 @@ function createComponents(options) {
2385
4746
  css?.map((href) => /* @__PURE__ */ jsx("link", {
2386
4747
  rel: "stylesheet",
2387
4748
  href
2388
- }, href))
4749
+ }, href)),
4750
+ styles && styles.length > 0 && /* @__PURE__ */ jsx("style", { children: styles.join("\n") })
2389
4751
  ] }), /* @__PURE__ */ jsxs("body", { children: [children, scripts] })]
2390
4752
  });
2391
4753
  }
@@ -2395,7 +4757,7 @@ function createComponents(options) {
2395
4757
  return /* @__PURE__ */ jsxs("div", {
2396
4758
  class: "dt-root",
2397
4759
  children: [
2398
- /* @__PURE__ */ jsx("style", { children: componentCSS }),
4760
+ /* @__PURE__ */ jsx("style", { children: lightTheme.__cssTemplate }),
2399
4761
  /* @__PURE__ */ jsx("style", { children: THEME_CSS }),
2400
4762
  /* @__PURE__ */ jsx("nav", {
2401
4763
  class: "dt-glass-nav",
@@ -3463,6 +5825,7 @@ function docsTheme(options) {
3463
5825
  Avatar,
3464
5826
  Kbd,
3465
5827
  Switch,
5828
+ Mermaid,
3466
5829
  ...options.mdx?.components
3467
5830
  };
3468
5831
  return {
@@ -3470,7 +5833,11 @@ function docsTheme(options) {
3470
5833
  collections,
3471
5834
  routes,
3472
5835
  mdx: {
3473
- remarkPlugins: [remarkGfm, ...options.mdx?.remarkPlugins ?? []],
5836
+ remarkPlugins: [
5837
+ remarkGfm,
5838
+ remarkMermaid,
5839
+ ...options.mdx?.remarkPlugins ?? []
5840
+ ],
3474
5841
  rehypePlugins: options.mdx?.rehypePlugins,
3475
5842
  components: mdxComponents
3476
5843
  }
@@ -3515,5 +5882,5 @@ function docsTheme(options) {
3515
5882
  }
3516
5883
 
3517
5884
  //#endregion
3518
- export { Avatar, Badge, Button, Callout, Card, CodeBlock, ComponentPreview, Input, Kbd, Separator, Step, Steps, Switch, Tab, TabList, TabPanel, Tabs, docsTheme };
5885
+ export { Avatar, Badge, Button, Callout, Card, CodeBlock, ComponentPreview, Input, Kbd, Mermaid, Separator, Step, Steps, Switch, Tab, TabList, TabPanel, Tabs, docsTheme, remarkMermaid };
3519
5886
  //# sourceMappingURL=docs-theme.mjs.map