@zombie-mermaid/mermaid-parser 4.1.0 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -324,8 +324,8 @@ function be(e) {
324
324
  }
325
325
  //#endregion
326
326
  //#region packages/mermaid-parser/src/class/parser.ts
327
- var T = "<\\|--|<\\|\\.\\.|\\*--|o--|-->|--\\*|--o|--\\|>|\\.\\.>|\\.\\.\\|>|<--|<\\.\\.?|--", xe = new RegExp(T);
328
- function Se(t) {
327
+ var xe = "<\\|--|<\\|\\.\\.|\\*--|o--|-->|--\\*|--o|--\\|>|\\.\\.>|\\.\\.\\|>|<--|<\\.\\.?|--", Se = new RegExp(xe);
328
+ function Ce(t) {
329
329
  let n = {
330
330
  classes: [],
331
331
  relationships: [],
@@ -349,7 +349,7 @@ function Se(t) {
349
349
  continue;
350
350
  }
351
351
  if (g.startsWith("<<")) throw Error(`Line ${h.line}: Malformed class annotation "${g}" — expected "<<name>>" (e.g. "<<interface>>").`);
352
- E(s, g, h.line);
352
+ T(s, g, h.line);
353
353
  continue;
354
354
  }
355
355
  if (/^click\s+/i.test(g)) {
@@ -394,23 +394,23 @@ function Se(t) {
394
394
  let e = m(x[1], void 0), t = i.get(e), n = x[2], r = n.match(/^<<(\w+)>>$/);
395
395
  if (t && r) t.annotation = r[1];
396
396
  else if (t && n.startsWith("<<")) throw Error(`Line ${h.line}: Malformed class annotation "${n}" — expected "<<name>>" (e.g. "<<interface>>").`);
397
- else t && n && E(t, n, h.line);
397
+ else t && n && T(t, n, h.line);
398
398
  continue;
399
399
  }
400
400
  let S = g.match(/^(\S+?)\s*:\s*(.+)$/);
401
401
  if (S) {
402
402
  let e = S[2];
403
403
  if (!e.match(/<\|--|--|\*--|o--|-->|\.\.>|\.\.\|>/)) {
404
- E(Ce(i, S[1]), e, h.line);
404
+ T(we(i, S[1]), e, h.line);
405
405
  continue;
406
406
  }
407
407
  }
408
- let C = Ee(g);
408
+ let C = De(g);
409
409
  if (C) {
410
410
  C.from = m(C.from, void 0, !1), C.to = m(C.to, void 0, !1), n.relationships.push(C);
411
411
  continue;
412
412
  }
413
- if (xe.test(g)) throw Error(`Line ${h.line}: Malformed class-diagram relationship "${g}". Expected "FROM ARROW TO" (optionally with cardinalities and a ": label"), e.g. "Animal <|-- Dog" or 'A "1" --> "*" B : label'. ARROW must be one of <|--, <|.., *--, o--, -->, --*, --o, --|>, ..>, ..|>, <--, <.., or --.`);
413
+ if (Se.test(g)) throw Error(`Line ${h.line}: Malformed class-diagram relationship "${g}". Expected "FROM ARROW TO" (optionally with cardinalities and a ": label"), e.g. "Animal <|-- Dog" or 'A "1" --> "*" B : label'. ARROW must be one of <|--, <|.., *--, o--, -->, --*, --o, --|>, ..>, ..|>, <--, <.., or --.`);
414
414
  }
415
415
  if (s !== null) throw Error(`Line ${l}: Unclosed class body for "${s.id}" — expected a closing "}" before the diagram ends.`);
416
416
  return n.classes = [...i.values()], n;
@@ -420,15 +420,15 @@ function Se(t) {
420
420
  let e = s.match(/^(.+?)~(\w+)~$/);
421
421
  e && (l = e[1], u = e[2]);
422
422
  }
423
- let d = Ce(i, l);
423
+ let d = we(i, l);
424
424
  return u && (d.label = `${l}<${u}>`), c && n.classAssignments.set(l, c), r && o && o.classIds.push(l), l;
425
425
  }
426
426
  }
427
- function E(e, t, n) {
428
- let r = Te(t, n);
427
+ function T(e, t, n) {
428
+ let r = Ee(t, n);
429
429
  r && (r.isMethod ? e.methods.push(r.member) : e.attributes.push(r.member));
430
430
  }
431
- function Ce(e, t) {
431
+ function we(e, t) {
432
432
  let n = e.get(t);
433
433
  return n || (n = {
434
434
  id: t,
@@ -437,11 +437,11 @@ function Ce(e, t) {
437
437
  methods: []
438
438
  }, e.set(t, n)), n;
439
439
  }
440
- function D(e, t) {
440
+ function E(e, t) {
441
441
  return Math.max(0, e.split(t).length - 1);
442
442
  }
443
- function we(e) {
444
- let t = D(e, "~");
443
+ function Te(e) {
444
+ let t = E(e, "~");
445
445
  if (t <= 1) return e;
446
446
  let n = e, r = !1;
447
447
  t % 2 != 0 && n.startsWith("~") && (n = n.slice(1), r = !0);
@@ -449,26 +449,26 @@ function we(e) {
449
449
  for (; a !== -1 && o !== -1 && a !== o;) i[a] = "<", i[o] = ">", a = i.indexOf("~"), o = i.lastIndexOf("~");
450
450
  return r && i.unshift("~"), i.join("");
451
451
  }
452
- function O(e) {
452
+ function D(e) {
453
453
  let t = e.split(/(,)/), n = [];
454
454
  for (let e = 0; e < t.length; e++) {
455
455
  let r = t[e];
456
456
  if (r === "," && e > 0 && e + 1 < t.length) {
457
457
  let i = t[e - 1], a = t[e + 1];
458
- D(i, "~") === 1 && D(a, "~") === 1 && (r = `${i},${a}`, e++, n.pop());
458
+ E(i, "~") === 1 && E(a, "~") === 1 && (r = `${i},${a}`, e++, n.pop());
459
459
  }
460
- n.push(we(r));
460
+ n.push(Te(r));
461
461
  }
462
462
  return n.join("");
463
463
  }
464
- function Te(e, t) {
464
+ function Ee(e, t) {
465
465
  let n = e.trim().replace(/;$/, "");
466
466
  if (!n) return null;
467
467
  let r = "", i = n, a = i[0];
468
468
  if ((a === "+" || a === "-" || a === "#" || a === "~") && (r = a, i = i.slice(1).trim()), i.includes("(") && !i.includes(")")) throw Error(`Line ${t}: Malformed class member "${n}" — unclosed "(" in a method signature. Expected e.g. "+eat() void" or "+eat(Food f) void".`);
469
469
  let o = i.match(/^(.+?)\(([^)]*)\)(?:\s*(.+))?$/);
470
470
  if (o) {
471
- let e = O(o[1].trim()), t = o[2]?.trim(), n = t ? O(t) : void 0, a = o[3]?.trim(), s = a ? O(a) : void 0, c = e.endsWith("$") || i.includes("$"), l = e.endsWith("*") || i.includes("*");
471
+ let e = D(o[1].trim()), t = o[2]?.trim(), n = t ? D(t) : void 0, a = o[3]?.trim(), s = a ? D(a) : void 0, c = e.endsWith("$") || i.includes("$"), l = e.endsWith("*") || i.includes("*");
472
472
  return {
473
473
  member: {
474
474
  visibility: r,
@@ -482,7 +482,7 @@ function Te(e, t) {
482
482
  isMethod: !0
483
483
  };
484
484
  }
485
- let s = O(i), c = s.endsWith("$"), l = s.endsWith("*");
485
+ let s = D(i), c = s.endsWith("$"), l = s.endsWith("*");
486
486
  return {
487
487
  member: {
488
488
  visibility: r,
@@ -495,10 +495,10 @@ function Te(e, t) {
495
495
  isMethod: !1
496
496
  };
497
497
  }
498
- function Ee(e) {
499
- let t = e.match(RegExp(`^(\\S+?)\\s+(?:"([^"]*?)"\\s+)?(${T})\\s+(?:"([^"]*?)"\\s+)?(\\S+?)(?::::([\\w][\\w-]*))?(?:\\s*:\\s*(.+))?$`));
498
+ function De(e) {
499
+ let t = e.match(RegExp(`^(\\S+?)\\s+(?:"([^"]*?)"\\s+)?(${xe})\\s+(?:"([^"]*?)"\\s+)?(\\S+?)(?::::([\\w][\\w-]*))?(?:\\s*:\\s*(.+))?$`));
500
500
  if (!t) return null;
501
- let n = t[1], i = t[2], a = i ? r(i) : void 0, o = t[3].trim(), s = t[4], c = s ? r(s) : void 0, l = t[6] ? `${t[5]}:::${t[6]}` : t[5], u = t[7]?.trim(), d = u ? r(u) : void 0, f = De(o);
501
+ let n = t[1], i = t[2], a = i ? r(i) : void 0, o = t[3].trim(), s = t[4], c = s ? r(s) : void 0, l = t[6] ? `${t[5]}:::${t[6]}` : t[5], u = t[7]?.trim(), d = u ? r(u) : void 0, f = Oe(o);
502
502
  return f ? {
503
503
  from: n,
504
504
  to: l,
@@ -509,7 +509,7 @@ function Ee(e) {
509
509
  toCardinality: c
510
510
  } : null;
511
511
  }
512
- function De(e) {
512
+ function Oe(e) {
513
513
  switch (e.trim()) {
514
514
  case "<|--": return {
515
515
  type: "inheritance",
@@ -568,12 +568,12 @@ function De(e) {
568
568
  }
569
569
  //#endregion
570
570
  //#region packages/mermaid-parser/src/class/format.ts
571
- function Oe(e) {
571
+ function ke(e) {
572
572
  return `${e.visibility ? `${e.visibility} ` : ""}${e.isMethod ? `${e.name}(${e.params || ""})` : e.name}${e.type ? `: ${e.type}` : ""}`;
573
573
  }
574
574
  //#endregion
575
575
  //#region packages/mermaid-parser/src/er/parser.ts
576
- function ke(e) {
576
+ function Ae(e) {
577
577
  let t = {
578
578
  entities: [],
579
579
  relationships: []
@@ -585,7 +585,7 @@ function ke(e) {
585
585
  i = null;
586
586
  continue;
587
587
  }
588
- let e = A(s);
588
+ let e = je(s);
589
589
  e && i.attributes.push(e);
590
590
  continue;
591
591
  }
@@ -596,23 +596,23 @@ function ke(e) {
596
596
  }
597
597
  let u = s.match(/^(\S+?)(?:\[(.+)\])?\s*\{(.*)$/);
598
598
  if (u) {
599
- let e = u[1], t = u[2], a = k(n, e, t === void 0 ? void 0 : r(t.trim().replace(/^["']|["']$/g, ""))), o = u[3].trim(), s = o.endsWith("}"), c = s ? o.slice(0, -1).trim() : o;
599
+ let e = u[1], t = u[2], a = O(n, e, t === void 0 ? void 0 : r(t.trim().replace(/^["']|["']$/g, ""))), o = u[3].trim(), s = o.endsWith("}"), c = s ? o.slice(0, -1).trim() : o;
600
600
  for (let e of c.split(";").map((e) => e.trim()).filter(Boolean)) {
601
- let t = A(e);
601
+ let t = je(e);
602
602
  t && a.attributes.push(t);
603
603
  }
604
604
  s || (i = a);
605
605
  continue;
606
606
  }
607
- let d = Ae(s, o.line);
607
+ let d = Me(s, o.line);
608
608
  if (d) {
609
- k(n, d.entity1), k(n, d.entity2), t.relationships.push(d);
609
+ O(n, d.entity1), O(n, d.entity2), t.relationships.push(d);
610
610
  continue;
611
611
  }
612
612
  }
613
613
  return t.entities = [...n.values()], t;
614
614
  }
615
- function k(e, t, n) {
615
+ function O(e, t, n) {
616
616
  let r = e.get(t);
617
617
  return r ? n !== void 0 && (r.label = n) : (r = {
618
618
  id: t,
@@ -620,7 +620,7 @@ function k(e, t, n) {
620
620
  attributes: []
621
621
  }, e.set(t, r)), r;
622
622
  }
623
- function A(e) {
623
+ function je(e) {
624
624
  let t = e.match(/^(\S+)\s+(\S+)(?:\s+(.+))?$/);
625
625
  if (!t) return null;
626
626
  let n = t[1], i = t[2], a = t[3]?.trim() ?? "", o = [], s, c = a.match(/"([^"]*)"/);
@@ -637,10 +637,10 @@ function A(e) {
637
637
  comment: s
638
638
  };
639
639
  }
640
- function Ae(e, t) {
640
+ function Me(e, t) {
641
641
  let n = e.match(/^(\S+)\s+(\S*(?:--|\.\.)\S*)\s+(\S+)\s*(?::\s*(.*))?$/);
642
642
  if (!n) return null;
643
- let i = n[1], a = n[2], o = n[3], s = n[4] !== void 0, c = n[4]?.trim() ?? "", l = a.match(/^([|o}{]*)(--|\.\.?)([|o}{]*)$/), u = l ? je(l[1]) : null, d = l ? Me(l[3]) : null;
643
+ let i = n[1], a = n[2], o = n[3], s = n[4] !== void 0, c = n[4]?.trim() ?? "", l = a.match(/^([|o}{]*)(--|\.\.?)([|o}{]*)$/), u = l ? Ne(l[1]) : null, d = l ? Pe(l[3]) : null;
644
644
  if (!u || !d) throw Error(`Line ${t}: Invalid ER relationship cardinality "${a}" in "${e}". Left side must be one of ||, |o, }|, }o; right side must be one of ||, o|, |{, o{ (e.g. "||--o{").`);
645
645
  if (!s || c.length === 0) throw Error(`Line ${t}: ER relationship "${i} ${a} ${o}" is missing a ": label" — expected e.g. "${i} ${a} ${o} : label".`);
646
646
  return {
@@ -652,36 +652,36 @@ function Ae(e, t) {
652
652
  identifying: l[2] === "--"
653
653
  };
654
654
  }
655
- function je(e) {
655
+ function Ne(e) {
656
656
  return e === "||" ? "one" : e === "|o" ? "zero-one" : e === "}|" ? "many" : e === "}o" ? "zero-many" : null;
657
657
  }
658
- function Me(e) {
658
+ function Pe(e) {
659
659
  return e === "||" ? "one" : e === "o|" ? "zero-one" : e === "|{" ? "many" : e === "o{" ? "zero-many" : null;
660
660
  }
661
661
  //#endregion
662
662
  //#region packages/mermaid-parser/src/sequence/box-color.ts
663
- var Ne = new Set("aliceblue antiquewhite aqua aquamarine azure beige bisque black blanchedalmond blue blueviolet brown burlywood cadetblue chartreuse chocolate coral cornflowerblue cornsilk crimson cyan darkblue darkcyan darkgoldenrod darkgray darkgreen darkgrey darkkhaki darkmagenta darkolivegreen darkorange darkorchid darkred darksalmon darkseagreen darkslateblue darkslategray darkslategrey darkturquoise darkviolet deeppink deepskyblue dimgray dimgrey dodgerblue firebrick floralwhite forestgreen fuchsia gainsboro ghostwhite gold goldenrod gray green greenyellow grey honeydew hotpink indianred indigo ivory khaki lavender lavenderblush lawngreen lemonchiffon lightblue lightcoral lightcyan lightgoldenrodyellow lightgray lightgreen lightgrey lightpink lightsalmon lightseagreen lightskyblue lightslategray lightslategrey lightsteelblue lightyellow lime limegreen linen magenta maroon mediumaquamarine mediumblue mediumorchid mediumpurple mediumseagreen mediumslateblue mediumspringgreen mediumturquoise mediumvioletred midnightblue mintcream mistyrose moccasin navajowhite navy oldlace olive olivedrab orange orangered orchid palegoldenrod palegreen paleturquoise palevioletred papayawhip peachpuff peru pink plum powderblue purple rebeccapurple red rosybrown royalblue saddlebrown salmon sandybrown seagreen seashell sienna silver skyblue slateblue slategray slategrey snow springgreen steelblue tan teal thistle tomato turquoise violet wheat white whitesmoke yellow yellowgreen".split(" ")), Pe = /^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i, Fe = /^(?:rgba?|hsla?)\(\s*[\d.%]+(?:[\s,/]+[\d.%]+){2,3}\s*\)$/i;
664
- function j(e) {
665
- return Ne.has(e.toLowerCase()) || Pe.test(e) || Fe.test(e);
663
+ var Fe = new Set("aliceblue antiquewhite aqua aquamarine azure beige bisque black blanchedalmond blue blueviolet brown burlywood cadetblue chartreuse chocolate coral cornflowerblue cornsilk crimson cyan darkblue darkcyan darkgoldenrod darkgray darkgreen darkgrey darkkhaki darkmagenta darkolivegreen darkorange darkorchid darkred darksalmon darkseagreen darkslateblue darkslategray darkslategrey darkturquoise darkviolet deeppink deepskyblue dimgray dimgrey dodgerblue firebrick floralwhite forestgreen fuchsia gainsboro ghostwhite gold goldenrod gray green greenyellow grey honeydew hotpink indianred indigo ivory khaki lavender lavenderblush lawngreen lemonchiffon lightblue lightcoral lightcyan lightgoldenrodyellow lightgray lightgreen lightgrey lightpink lightsalmon lightseagreen lightskyblue lightslategray lightslategrey lightsteelblue lightyellow lime limegreen linen magenta maroon mediumaquamarine mediumblue mediumorchid mediumpurple mediumseagreen mediumslateblue mediumspringgreen mediumturquoise mediumvioletred midnightblue mintcream mistyrose moccasin navajowhite navy oldlace olive olivedrab orange orangered orchid palegoldenrod palegreen paleturquoise palevioletred papayawhip peachpuff peru pink plum powderblue purple rebeccapurple red rosybrown royalblue saddlebrown salmon sandybrown seagreen seashell sienna silver skyblue slateblue slategray slategrey snow springgreen steelblue tan teal thistle tomato turquoise violet wheat white whitesmoke yellow yellowgreen".split(" ")), Ie = /^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i, Le = /^(?:rgba?|hsla?)\(\s*[\d.%]+(?:[\s,/]+[\d.%]+){2,3}\s*\)$/i;
664
+ function k(e) {
665
+ return Fe.has(e.toLowerCase()) || Ie.test(e) || Le.test(e);
666
666
  }
667
- function M(e) {
667
+ function Re(e) {
668
668
  let t = e.trim(), n = t.match(/^((?:rgba?|hsla?)\s*\([^)]*\)|#[0-9a-fA-F]+|\S+)?(.*)$/), r = n?.[1] ?? "", i = n?.[2]?.trim() ?? "";
669
- return r.toLowerCase() === "transparent" ? { label: i } : r !== "" && j(r) ? {
669
+ return r.toLowerCase() === "transparent" ? { label: i } : r !== "" && k(r) ? {
670
670
  color: r,
671
671
  label: i
672
672
  } : { label: t };
673
673
  }
674
674
  //#endregion
675
675
  //#region packages/mermaid-parser/src/sequence/parser.ts
676
- function N(e) {
676
+ function A(e) {
677
677
  return e === "loop" || e === "alt" || e === "opt" || e === "par" || e === "critical" || e === "break" || e === "rect";
678
678
  }
679
- function P(e) {
680
- if (!N(e)) throw Error(`Invalid block type: "${e}"`);
679
+ function j(e) {
680
+ if (!A(e)) throw Error(`Invalid block type: "${e}"`);
681
681
  return e;
682
682
  }
683
- var Ie = /^(.+?)\s*(<<->>|<<-->>|--?>?>)\s*([+-]?)(.+?)\s*:\s*(.+)$/, Le = /^(.+?)\s*(<<->>|<<-->>|--?>?>|--?[)x]|--?>>|--?>)\s*([+-]?)(.+?)\s*:\s*(.+)$/;
684
- function F(e) {
683
+ var ze = /^(.+?)\s*(<<->>|<<-->>|--?>?>)\s*([+-]?)(.+?)\s*:\s*(.+)$/, Be = /^(.+?)\s*(<<->>|<<-->>|--?>?>|--?[)x]|--?>>|--?>)\s*([+-]?)(.+?)\s*:\s*(.+)$/;
684
+ function M(e) {
685
685
  let t = {
686
686
  actors: [],
687
687
  messages: [],
@@ -701,7 +701,7 @@ function F(e) {
701
701
  let f = e[d], p = f.text, m = p.match(/^box(?:\s+(.*))?$/);
702
702
  if (m) {
703
703
  if (n.open !== void 0) throw Error(`Line ${f.line}: Sequence diagram: a box cannot be nested inside another box — close the open box with "end" first`);
704
- let { color: e, label: o } = M(m[1] ?? ""), c = {
704
+ let { color: e, label: o } = Re(m[1] ?? ""), c = {
705
705
  label: r(o),
706
706
  actorIds: []
707
707
  };
@@ -716,13 +716,13 @@ function F(e) {
716
716
  id: i,
717
717
  label: r(h[3]?.trim() ?? i),
718
718
  type: e
719
- }), R(t, n, i, f.line), l = i;
719
+ }), F(t, n, i, f.line), l = i;
720
720
  continue;
721
721
  }
722
722
  let g = p.match(/^destroy\s+(.+)$/);
723
723
  if (g) {
724
724
  let e = g[1].trim();
725
- L(t, o, n, e, f.line), u = e;
725
+ P(t, o, n, e, f.line), u = e;
726
726
  continue;
727
727
  }
728
728
  let _ = p.match(/^autonumber(?:\s+(off|\d+(?:\.\d{1,2})?)(?:\s+(\d+(?:\.\d{1,2})?))?)?$/);
@@ -738,13 +738,13 @@ function F(e) {
738
738
  id: i,
739
739
  label: s,
740
740
  type: e
741
- })), R(t, n, i, f.line);
741
+ })), F(t, n, i, f.line);
742
742
  continue;
743
743
  }
744
744
  let y = p.match(/^Note\s+(left of|right of|over)\s+([^:]+):\s*(.+)$/i);
745
745
  if (y) {
746
746
  let e = y[1].toLowerCase(), i = y[2].trim(), a = r(y[3].trim()), s = i.split(",").map((e) => e.trim());
747
- for (let e of s) L(t, o, n, e, f.line);
747
+ for (let e of s) P(t, o, n, e, f.line);
748
748
  let c = "over";
749
749
  e === "left of" ? c = "left" : e === "right of" && (c = "right"), t.notes.push({
750
750
  actorIds: s,
@@ -756,7 +756,7 @@ function F(e) {
756
756
  }
757
757
  let b = p.match(/^(loop|alt|opt|par|critical|break|rect)\s*(.*)$/);
758
758
  if (b) {
759
- let e = P(b[1]), n = b[2]?.trim() ?? "", i = r(n);
759
+ let e = j(b[1]), n = b[2]?.trim() ?? "", i = r(n);
760
760
  s.push({
761
761
  type: e,
762
762
  label: i,
@@ -794,26 +794,26 @@ function F(e) {
794
794
  let S = p.match(/^(activate|deactivate)\s+(.+)$/);
795
795
  if (S) {
796
796
  let e = S[2].trim();
797
- L(t, o, n, e, f.line), t.activations.push({
797
+ P(t, o, n, e, f.line), t.activations.push({
798
798
  actorId: e,
799
799
  kind: S[1] === "activate" ? "start" : "end",
800
800
  afterIndex: t.messages.length - 1
801
801
  });
802
802
  continue;
803
803
  }
804
- let C = p.match(Ie) ?? p.match(Le);
804
+ let C = p.match(ze) ?? p.match(Be);
805
805
  if (C) {
806
806
  let e = C[2], r = C[4][0];
807
807
  if (r === ">" || r === ")") throw Error(`Line ${f.line}: Malformed sequence-diagram arrow in "${p}" — "${e}${r}" is not a recognized arrow. Expected one of: ->, -->, ->>, -->>, -x, --x, -), --), <<->>, <<-->>.`);
808
- Re(t, o, n, c, C[1], C[2], C[3], C[4], C[5], f.line);
808
+ Ve(t, o, n, c, C[1], C[2], C[3], C[4], C[5], f.line);
809
809
  let i = t.messages.length - 1, a = t.messages[i];
810
810
  if (l !== void 0) {
811
811
  if (a.to !== l) throw Error(`Line ${f.line}: The created participant ${l} does not have an associated creating message after its declaration. Please check the sequence diagram.`);
812
- I(t, l).createdAt = i, l = void 0;
812
+ N(t, l).createdAt = i, l = void 0;
813
813
  }
814
814
  if (u !== void 0) {
815
815
  if (a.from !== u && a.to !== u) throw Error(`Line ${f.line}: The destroyed participant ${u} does not have an associated destroying message after its declaration. Please check the sequence diagram.`);
816
- I(t, u).destroyedAt = i, u = void 0;
816
+ N(t, u).destroyedAt = i, u = void 0;
817
817
  }
818
818
  continue;
819
819
  }
@@ -828,21 +828,21 @@ function F(e) {
828
828
  }
829
829
  return t;
830
830
  }
831
- function I(e, t) {
831
+ function N(e, t) {
832
832
  let n = e.actors.find((e) => e.id === t);
833
833
  if (n === void 0)
834
834
  /* v8 ignore next */
835
835
  throw Error(`Sequence diagram: unknown actor "${t}"`);
836
836
  return n;
837
837
  }
838
- function L(e, t, n, r, i) {
838
+ function P(e, t, n, r, i) {
839
839
  t.has(r) || (t.add(r), e.actors.push({
840
840
  id: r,
841
841
  label: r,
842
842
  type: "participant"
843
- })), R(e, n, r, i);
843
+ })), F(e, n, r, i);
844
844
  }
845
- function R(e, t, n, r) {
845
+ function F(e, t, n, r) {
846
846
  let i = t.open;
847
847
  if (i === void 0) return;
848
848
  let a = t.membership.get(n);
@@ -854,8 +854,8 @@ function R(e, t, n, r) {
854
854
  t.membership.set(n, i), e.boxes[i].actorIds.push(n);
855
855
  }
856
856
  }
857
- function Re(e, t, n, i, a, o, s, c, l, u) {
858
- L(e, t, n, a, u), L(e, t, n, c, u);
857
+ function Ve(e, t, n, i, a, o, s, c, l, u) {
858
+ P(e, t, n, a, u), P(e, t, n, c, u);
859
859
  let d = o === "<<->>" || o === "<<-->>", f = d ? o === "<<-->>" ? "dashed" : "solid" : o.startsWith("--") ? "dashed" : "solid", p = o.includes(">>") || o.includes("x") ? "filled" : "open", m = o.includes("x"), h = {
860
860
  from: a,
861
861
  to: c,
@@ -867,14 +867,14 @@ function Re(e, t, n, i, a, o, s, c, l, u) {
867
867
  }
868
868
  //#endregion
869
869
  //#region packages/mermaid-parser/src/sequence/activation-check.ts
870
- function z(e, t) {
870
+ function He(e, t) {
871
871
  if (t < 0) return "before the first message";
872
872
  let n = e.messages[t];
873
873
  if (!n) return "at an unresolved position";
874
874
  let r = n.label ? `: ${n.label}` : "";
875
875
  return `after message ${t + 1} ("${n.from} -> ${n.to}${r}")`;
876
876
  }
877
- function B(e) {
877
+ function I(e) {
878
878
  let t = /* @__PURE__ */ new Map();
879
879
  for (let n of e.activations) {
880
880
  let e = t.get(n.afterIndex) ?? [];
@@ -911,13 +911,13 @@ function B(e) {
911
911
  n.pop() === void 0 && a.push({
912
912
  code: "UNMATCHED_DEACTIVATION",
913
913
  actorId: t.actorId,
914
- message: `"deactivate ${t.actorId}" ${z(e, t.afterIndex)} has no matching "activate ${t.actorId}" open at that point.`
914
+ message: `"deactivate ${t.actorId}" ${He(e, t.afterIndex)} has no matching "activate ${t.actorId}" open at that point.`
915
915
  });
916
916
  }
917
917
  for (let [t, n] of i) for (let r of n) a.push({
918
918
  code: "DANGLING_ACTIVATION",
919
919
  actorId: t,
920
- message: `"activate ${t}" opened ${z(e, r)} is never closed with a matching "deactivate ${t}".`
920
+ message: `"activate ${t}" opened ${He(e, r)} is never closed with a matching "deactivate ${t}".`
921
921
  });
922
922
  return {
923
923
  ok: a.length === 0,
@@ -926,10 +926,10 @@ function B(e) {
926
926
  }
927
927
  //#endregion
928
928
  //#region packages/mermaid-parser/src/sequence/activation-fix.ts
929
- function ze(e) {
929
+ function Ue(e) {
930
930
  let n = t(e);
931
931
  if (n !== "sequence") throw Error(`fixActivationBalance only supports sequence diagrams (source must start with "sequenceDiagram"); detected diagram type: "${n}".`);
932
- let r = B(F(o(e)));
932
+ let r = I(M(o(e)));
933
933
  if (r.ok) return {
934
934
  ok: !0,
935
935
  originalDiagram: e,
@@ -948,7 +948,7 @@ function ze(e) {
948
948
  }
949
949
  //#endregion
950
950
  //#region packages/mermaid-parser/src/xychart/parser.ts
951
- function Be(e) {
951
+ function We(e) {
952
952
  let t = {}, n = {}, r = [], i, a = !1;
953
953
  for (let o of e) {
954
954
  let e = o.text;
@@ -963,7 +963,7 @@ function Be(e) {
963
963
  }
964
964
  let c = e.match(/^x-axis\s+(?:"([^"]*)"\s*)?\[([^\]]+)\]/);
965
965
  if (c) {
966
- c[1] && (t.title = c[1]), t.categories = Ve(c[2]).map((e) => He(e.trim()));
966
+ c[1] && (t.title = c[1]), t.categories = Ge(c[2]).map((e) => Ke(e.trim()));
967
967
  continue;
968
968
  }
969
969
  let l = e.match(/^x-axis\s+(?:"([^"]*)"\s+)?(-?\d+(?:\.\d+)?)\s*-->\s*(-?\d+(?:\.\d+)?)/);
@@ -991,7 +991,7 @@ function Be(e) {
991
991
  if (f) {
992
992
  r.push({
993
993
  type: "bar",
994
- data: V(f[1], "bar", e, o.line)
994
+ data: L(f[1], "bar", e, o.line)
995
995
  });
996
996
  continue;
997
997
  }
@@ -999,12 +999,12 @@ function Be(e) {
999
999
  if (p) {
1000
1000
  r.push({
1001
1001
  type: "line",
1002
- data: V(p[1], "line", e, o.line)
1002
+ data: L(p[1], "line", e, o.line)
1003
1003
  });
1004
1004
  continue;
1005
1005
  }
1006
1006
  let m = e.match(/^(x-axis|y-axis|bar|line|title)\b/i);
1007
- if (m) throw We(m[1].toLowerCase(), e, o.line);
1007
+ if (m) throw Je(m[1].toLowerCase(), e, o.line);
1008
1008
  }
1009
1009
  if (!n.range && r.length > 0) {
1010
1010
  let e = r.flatMap((e) => e.data), t = Math.min(...e), i = Math.max(...e), a = i - t || 1;
@@ -1024,36 +1024,36 @@ function Be(e) {
1024
1024
  series: r
1025
1025
  };
1026
1026
  }
1027
- function Ve(e) {
1027
+ function Ge(e) {
1028
1028
  let t = [], n = "", r = !1;
1029
1029
  for (let i of e) i === "\"" ? (r = !r, n += i) : i === "," && !r ? (t.push(n), n = "") : n += i;
1030
1030
  return t.push(n), t;
1031
1031
  }
1032
- function He(e) {
1032
+ function Ke(e) {
1033
1033
  return e.length >= 2 && e.startsWith("\"") && e.endsWith("\"") ? e.slice(1, -1) : e;
1034
1034
  }
1035
- function V(e, t, n, r) {
1035
+ function L(e, t, n, r) {
1036
1036
  return e.split(",").map((e, i) => {
1037
1037
  let a = e.trim(), o = parseFloat(a);
1038
1038
  if (a.length === 0 || Number.isNaN(o)) throw Error(`Line ${r}: Invalid numeric value ${JSON.stringify(a)} at position ${i + 1} in "${n}". Every value in a ${t} [...] list must be a number.`);
1039
1039
  return o;
1040
1040
  });
1041
1041
  }
1042
- var Ue = {
1042
+ var qe = {
1043
1043
  "x-axis": "x-axis [A, B, C] (categories) or x-axis 0 --> 100 (numeric range), either optionally preceded by a quoted title",
1044
1044
  "y-axis": "y-axis 0 --> 100 (numeric range) or y-axis \"Title\" (title only), optionally preceded by a quoted title before a range",
1045
1045
  bar: "bar [10, 20, 30] — a comma-separated numeric array in square brackets",
1046
1046
  line: "line [10, 20, 30] — a comma-separated numeric array in square brackets",
1047
1047
  title: "title \"Chart Title\" — a double-quoted string"
1048
1048
  };
1049
- function We(e, t, n) {
1050
- let r = Ue[e] ?? e;
1049
+ function Je(e, t, n) {
1050
+ let r = qe[e] ?? e;
1051
1051
  return /* @__PURE__ */ Error(`Line ${n}: Malformed xychart-beta "${e}" directive: "${t}". Expected: ${r}.`);
1052
1052
  }
1053
1053
  //#endregion
1054
1054
  //#region packages/mermaid-parser/src/xychart/colors.ts
1055
- var H = "#3b82f6";
1056
- function U(e) {
1055
+ var R = "#3b82f6";
1056
+ function z(e) {
1057
1057
  let t = e.replace("#", ""), n = parseInt(t.substring(0, 2), 16) / 255, r = parseInt(t.substring(2, 4), 16) / 255, i = parseInt(t.substring(4, 6), 16) / 255, a = Math.max(n, r, i), o = Math.min(n, r, i), s = (a + o) / 2;
1058
1058
  if (a === o) return [
1059
1059
  0,
@@ -1067,26 +1067,186 @@ function U(e) {
1067
1067
  s * 100
1068
1068
  ];
1069
1069
  }
1070
- function Ge(e, t, n) {
1070
+ function Ye(e, t, n) {
1071
1071
  let r = t / 100, i = n / 100, a = (1 - Math.abs(2 * i - 1)) * r, o = a * (1 - Math.abs(e / 60 % 2 - 1)), s = i - a / 2, c, l, u;
1072
1072
  e < 60 ? (c = a, l = o, u = 0) : e < 120 ? (c = o, l = a, u = 0) : e < 180 ? (c = 0, l = a, u = o) : e < 240 ? (c = 0, l = o, u = a) : e < 300 ? (c = o, l = 0, u = a) : (c = a, l = 0, u = o);
1073
1073
  let d = (e) => Math.round((e + s) * 255).toString(16).padStart(2, "0");
1074
1074
  return `#${d(c)}${d(l)}${d(u)}`;
1075
1075
  }
1076
- function W(e) {
1076
+ function B(e) {
1077
1077
  return /^#[0-9a-fA-F]{6}$/.test(e);
1078
1078
  }
1079
- function G(e) {
1080
- return U(e)[2] < 50;
1079
+ function V(e) {
1080
+ return z(e)[2] < 50;
1081
1081
  }
1082
- function Ke(e, t, n) {
1082
+ function Xe(e, t, n) {
1083
1083
  if (e === 0) return t;
1084
- let r = W(t) ? t : H, i = n && W(n) ? n : void 0, [a, o] = U(r), s = Math.max(55, Math.min(85, o)), c = Math.ceil(e / 2), l = e % 2 == 1, u = i && G(i) ? !l : l, d = u ? Math.max(25, 48 - c * 13) : Math.min(78, 55 + c * 11);
1085
- return Ge(((a + (u ? -8 : -12) * c) % 360 + 360) % 360, s, d);
1084
+ let r = B(t) ? t : R, i = n && B(n) ? n : void 0, [a, o] = z(r), s = Math.max(55, Math.min(85, o)), c = Math.ceil(e / 2), l = e % 2 == 1, u = i && V(i) ? !l : l, d = u ? Math.max(25, 48 - c * 13) : Math.min(78, 55 + c * 11);
1085
+ return Ye(((a + (u ? -8 : -12) * c) % 360 + 360) % 360, s, d);
1086
+ }
1087
+ //#endregion
1088
+ //#region packages/mermaid-parser/src/pie/parser.ts
1089
+ var Ze = [
1090
+ [null, /[\t ]+/y],
1091
+ ["SHOW_DATA", /showData(?:(?=%%)|(?!\S))/y],
1092
+ ["PIE", /pie(?:(?=%%)|(?!\S))/y],
1093
+ ["COLON", /:/y],
1094
+ ["NUMBER", /-?[0-9]+\.[0-9]+(?!\.)|-?(?:0|[1-9][0-9]*)(?!\.)/y],
1095
+ ["ACC_DESCR", /[\t ]*accDescr(?:[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)|\s*\{[^}]*\})/y],
1096
+ ["ACC_TITLE", /[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/y],
1097
+ ["TITLE", /[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/y],
1098
+ ["STRING", /"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'/y],
1099
+ ["NEWLINE", /\n/y],
1100
+ [null, /[\t ]*%%[^\n\r]*/y]
1101
+ ], Qe = /%{2}{\s*(?:(\w+)\s*:|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi, $e = /accDescr(?:[\t ]*:([^\n\r]*)|\s*\{([^}]*)\})/, et = /accTitle[\t ]*:([^\n\r]*)/, tt = /title([\t ][^\n\r]*|)/, nt = "A pie chart is `pie [showData] [title <text>]` followed by lines of `\"Label\" : value` (label quoted with \" or '), `title <text>`, `accTitle: <text>`, or `accDescr: <text>`.";
1102
+ function rt(e) {
1103
+ return e.replace(/\r\n?/g, "\n").replace(/<(\w+)([^>]*)>/g, (e, t, n) => "<" + t + n.replace(/="([^"]*)"/g, "='$1'") + ">").replace(Qe, (e) => e.replace(/[^\n]/g, ""));
1104
+ }
1105
+ function it(e) {
1106
+ let t = 0;
1107
+ for (let n of e) n === "\n" && t++;
1108
+ return t;
1109
+ }
1110
+ function H(e, t, n) {
1111
+ /* v8 ignore next -- every caller passes a line inside `lines` */
1112
+ let r = (e[t - 1] ?? "").trim();
1113
+ return /* @__PURE__ */ Error(`Line ${t}: ${n} in "${r}". ${nt}`);
1114
+ }
1115
+ function at(e, t, n) {
1116
+ let r = e[t];
1117
+ return r === "\"" || r === "'" ? `Unterminated quoted label (missing closing ${r})` : n?.kind === "COLON" ? "Invalid slice value — expected a number like 42 or 42.5 after \":\"" : n === void 0 || n.kind === "NEWLINE" || n.kind === "PIE" || n.kind === "SHOW_DATA" ? "Unrecognized statement — slice labels must be quoted, e.g. \"Dogs\" : 42" : `Unexpected text ${JSON.stringify(e.slice(t).split("\n")[0])}`;
1118
+ }
1119
+ function ot(e, t) {
1120
+ let n = [], r = 0, i = 1;
1121
+ for (; r < e.length;) {
1122
+ let a = !1;
1123
+ for (let [t, o] of Ze) {
1124
+ o.lastIndex = r;
1125
+ let s = o.exec(e);
1126
+ if (s === null || s[0].length === 0) continue;
1127
+ let c = s[0];
1128
+ t !== null && n.push({
1129
+ kind: t,
1130
+ text: c,
1131
+ line: i
1132
+ }), i += it(c), r += c.length, a = !0;
1133
+ break;
1134
+ }
1135
+ if (!a) throw H(t, i, at(e, r, n.at(-1)));
1136
+ }
1137
+ return n;
1138
+ }
1139
+ function st(e) {
1140
+ let t = "";
1141
+ for (let n = 1; n < e.length - 1; n++) {
1142
+ let r = e.charAt(n);
1143
+ if (r !== "\\") {
1144
+ t += r;
1145
+ continue;
1146
+ }
1147
+ let i = e.charAt(++n);
1148
+ switch (i) {
1149
+ case "b":
1150
+ t += "\b";
1151
+ break;
1152
+ case "f":
1153
+ t += "\f";
1154
+ break;
1155
+ case "n":
1156
+ t += "\n";
1157
+ break;
1158
+ case "r":
1159
+ t += "\r";
1160
+ break;
1161
+ case "t":
1162
+ t += " ";
1163
+ break;
1164
+ case "v":
1165
+ t += "\v";
1166
+ break;
1167
+ case "0":
1168
+ t += "\0";
1169
+ break;
1170
+ default: t += i;
1171
+ }
1172
+ }
1173
+ return t;
1174
+ }
1175
+ function ct(e, t) {
1176
+ let n = (e === "ACC_DESCR" ? $e : e === "ACC_TITLE" ? et : tt).exec(t);
1177
+ return n?.[1] === void 0 ? (n?.[2] ?? "").replace(/^\s*/gm, "").replace(/\s+$/gm, "").replace(/[\t ]{2,}/gm, " ").replace(/[\n\r]{2,}/gm, "\n") : n[1].trim().replace(/[\t ]{2,}/gm, " ");
1178
+ }
1179
+ var U = {
1180
+ NEWLINE: "end of line",
1181
+ PIE: "\"pie\"",
1182
+ SHOW_DATA: "\"showData\"",
1183
+ COLON: "\":\"",
1184
+ NUMBER: "number",
1185
+ STRING: "quoted label",
1186
+ TITLE: "title",
1187
+ ACC_TITLE: "accTitle",
1188
+ ACC_DESCR: "accDescr"
1189
+ };
1190
+ function lt(e) {
1191
+ let t = rt(e), n = t.split("\n"), r = ot(t, n), i = 0, a = (e, t) => {
1192
+ if (e === void 0) return H(n, n.length, `Unexpected end of input — expected ${t}`);
1193
+ let r = `Unexpected ${U[e.kind]} — expected ${t}`;
1194
+ return e.kind === "SHOW_DATA" ? r += "; showData is only allowed directly after \"pie\" on the header line" : e.kind === "PIE" && (r += "; the \"pie\" header may only appear once"), H(n, e.line, r);
1195
+ }, o = (e) => {
1196
+ let t = r[i];
1197
+ if (t !== void 0 && t.kind !== "NEWLINE") throw a(t, `end of line after ${e}`);
1198
+ };
1199
+ for (; r[i]?.kind === "NEWLINE";) i++;
1200
+ if (r[i]?.kind !== "PIE") throw a(r[i], "the \"pie\" header");
1201
+ i++;
1202
+ let s = !1;
1203
+ r[i]?.kind === "SHOW_DATA" && (s = !0, i++);
1204
+ let c = "", l = "", u = "", d = [];
1205
+ for (; i < r.length;) {
1206
+ let e = r[i];
1207
+ switch (e.kind) {
1208
+ case "NEWLINE":
1209
+ i++;
1210
+ break;
1211
+ case "TITLE":
1212
+ case "ACC_TITLE":
1213
+ case "ACC_DESCR": {
1214
+ let t = ct(e.kind, e.text);
1215
+ e.kind === "TITLE" ? c = t : e.kind === "ACC_TITLE" ? l = t : u = t, i++, o(U[e.kind]);
1216
+ break;
1217
+ }
1218
+ case "STRING": {
1219
+ if (i++, r[i]?.kind !== "COLON") throw a(r[i], "\":\" after the slice label");
1220
+ i++;
1221
+ let t = r[i];
1222
+ if (t?.kind !== "NUMBER") throw a(t, "a number after \":\"");
1223
+ i++, o("the slice value"), d.push({
1224
+ label: st(e.text),
1225
+ value: Number(t.text),
1226
+ line: e.line
1227
+ });
1228
+ break;
1229
+ }
1230
+ default: throw a(e, "a quoted slice label, title, accTitle, or accDescr");
1231
+ }
1232
+ }
1233
+ let f = [], p = /* @__PURE__ */ new Set();
1234
+ for (let { label: e, value: t, line: n } of d) {
1235
+ if (t < 0) throw Error(`Line ${n}: "${e}" has invalid value: ${t}. Negative values are not allowed in pie charts. All slice values must be >= 0.`);
1236
+ p.has(e) || (p.add(e), f.push({
1237
+ label: e,
1238
+ value: t === 0 ? 0 : t
1239
+ }));
1240
+ }
1241
+ let m = {
1242
+ showData: s,
1243
+ slices: f
1244
+ };
1245
+ return c && (m.title = c), l && (m.accTitle = l), u && (m.accDescr = u), m;
1086
1246
  }
1087
1247
  //#endregion
1088
1248
  //#region packages/mermaid-parser/src/expanded-shapes.ts
1089
- var K = {
1249
+ var W = {
1090
1250
  rect: "rectangle",
1091
1251
  rectangle: "rectangle",
1092
1252
  proc: "rectangle",
@@ -1212,28 +1372,28 @@ var K = {
1212
1372
  text: "text",
1213
1373
  anchor: "anchor"
1214
1374
  };
1215
- function q(e) {
1216
- return K[e.trim().toLowerCase()];
1375
+ function G(e) {
1376
+ return W[e.trim().toLowerCase()];
1217
1377
  }
1218
- function qe() {
1219
- return Object.keys(K).sort();
1378
+ function ut() {
1379
+ return Object.keys(W).sort();
1220
1380
  }
1221
- function J(e) {
1381
+ function K(e) {
1222
1382
  let t = {};
1223
- for (let n of Je(e, ",")) {
1383
+ for (let n of dt(e, ",")) {
1224
1384
  let e = n.trim();
1225
1385
  if (e.length === 0) continue;
1226
- let r = Ye(e, ":");
1386
+ let r = ft(e, ":");
1227
1387
  if (r === -1) {
1228
- t.shape ??= Xe(e);
1388
+ t.shape ??= q(e);
1229
1389
  continue;
1230
1390
  }
1231
- let i = e.slice(0, r).trim().toLowerCase(), a = Xe(e.slice(r + 1).trim());
1391
+ let i = e.slice(0, r).trim().toLowerCase(), a = q(e.slice(r + 1).trim());
1232
1392
  i.length > 0 && (t[i] = a);
1233
1393
  }
1234
1394
  return t;
1235
1395
  }
1236
- function Je(e, t) {
1396
+ function dt(e, t) {
1237
1397
  let n = [], r = "", i = null;
1238
1398
  for (let a of e) {
1239
1399
  if (i !== null) {
@@ -1252,7 +1412,7 @@ function Je(e, t) {
1252
1412
  }
1253
1413
  return n.push(r), n;
1254
1414
  }
1255
- function Ye(e, t) {
1415
+ function ft(e, t) {
1256
1416
  let n = null;
1257
1417
  for (let r = 0; r < e.length; r++) {
1258
1418
  let i = e[r];
@@ -1268,10 +1428,10 @@ function Ye(e, t) {
1268
1428
  }
1269
1429
  return -1;
1270
1430
  }
1271
- function Xe(e) {
1431
+ function q(e) {
1272
1432
  return e.length >= 2 && (e.startsWith("\"") && e.endsWith("\"") || e.startsWith("'") && e.endsWith("'")) ? e.slice(1, -1) : e;
1273
1433
  }
1274
- function Y(e) {
1434
+ function J(e) {
1275
1435
  if (!e.startsWith("@{")) return;
1276
1436
  let t = 0, n = null;
1277
1437
  for (let r = 1; r < e.length; r++) {
@@ -1296,24 +1456,25 @@ function Y(e) {
1296
1456
  }
1297
1457
  //#endregion
1298
1458
  //#region packages/mermaid-parser/src/flowchart-parser.ts
1299
- function Ze(e) {
1459
+ function pt(e) {
1300
1460
  let t = e.trim();
1301
1461
  return t.length >= 2 && (t[0] === "\"" && t[t.length - 1] === "\"" || t[0] === "'" && t[t.length - 1] === "'") ? t.slice(1, -1) : t;
1302
1462
  }
1303
- var Qe = "\"graph <dir>\"/\"flowchart <dir>\" (dir: TD, TB, LR, BT, RL), \"stateDiagram-v2\", \"sequenceDiagram\", \"classDiagram\", \"erDiagram\", \"xychart-beta\", \"C4Context\"/\"C4Container\"/\"C4Component\"/\"C4Dynamic\"/\"C4Deployment\", \"architecture-beta\"";
1304
- function $e(e) {
1463
+ var mt = "\"graph <dir>\"/\"flowchart <dir>\" (dir: TD, TB, LR, BT, RL), \"stateDiagram-v2\", \"sequenceDiagram\", \"classDiagram\", \"erDiagram\", \"xychart-beta\", \"C4Context\"/\"C4Container\"/\"C4Component\"/\"C4Dynamic\"/\"C4Deployment\", \"architecture-beta\", \"pie\"";
1464
+ function ht(e) {
1305
1465
  let t = e.trim().toLowerCase();
1306
1466
  if (/^sequence/.test(t)) return "sequenceDiagram";
1307
1467
  if (/^class/.test(t)) return "classDiagram";
1308
1468
  if (/^er/.test(t)) return "erDiagram";
1309
1469
  if (/^xychart/.test(t)) return "xychart-beta";
1310
1470
  if (/^state/.test(t)) return "stateDiagram-v2";
1471
+ if (/^pie/.test(t)) return "pie";
1311
1472
  }
1312
- var et = /^(?:[\w-]+@)?<?(?:-{2,}|={2,}|-\.+-?|~{3,})/;
1313
- function tt(e) {
1473
+ var gt = /^(?:[\w-]+@)?<?(?:-{2,}|={2,}|-\.+-?|~{3,})/;
1474
+ function _t(e) {
1314
1475
  let t = [];
1315
1476
  for (let n of e) n.forEach((e, n) => {
1316
- if (n === 0 && t.length > 0 && et.test(e.text)) {
1477
+ if (n === 0 && t.length > 0 && gt.test(e.text)) {
1317
1478
  let n = t[t.length - 1];
1318
1479
  t[t.length - 1] = {
1319
1480
  text: `${n.text} ${e.text}`,
@@ -1323,13 +1484,13 @@ function tt(e) {
1323
1484
  });
1324
1485
  return t;
1325
1486
  }
1326
- function nt(e) {
1327
- let t = n(e.split("\n").map((e) => e.trim())), r = tt(s(e));
1487
+ function vt(e) {
1488
+ let t = n(e.split("\n").map((e) => e.trim())), r = _t(s(e));
1328
1489
  if (r.length === 0) throw Error("Empty mermaid diagram");
1329
- let i = r[0], a = /^stateDiagram(-v2)?\s*$/i.test(i.text) ? it(r) : rt(r);
1490
+ let i = r[0], a = /^stateDiagram(-v2)?\s*$/i.test(i.text) ? bt(r) : yt(r);
1330
1491
  return a.initConfig = t, a;
1331
1492
  }
1332
- function rt(e) {
1493
+ function yt(e) {
1333
1494
  let t = e[0];
1334
1495
  if (t === void 0)
1335
1496
  /* v8 ignore next */
@@ -1341,8 +1502,8 @@ function rt(e) {
1341
1502
  let r = e[1].trim();
1342
1503
  throw Error(r.length > 0 ? `Line ${t.line}: Invalid direction "${r}" in header "${n}". Expected one of: TD, TB, LR, BT, RL.` : `Line ${t.line}: Missing direction in header "${n}". Expected e.g. "graph TD" or "flowchart LR" — one of: TD, TB, LR, BT, RL.`);
1343
1504
  }
1344
- let r = $e(n), i = r && r.toLowerCase() !== n.trim().toLowerCase() ? ` Did you mean "${r}"?` : "";
1345
- throw Error(`Line ${t.line}: Invalid mermaid header: "${n}".${i} Supported headers: ${Qe}.`);
1505
+ let r = ht(n), i = r && r.toLowerCase() !== n.trim().toLowerCase() ? ` Did you mean "${r}"?` : "";
1506
+ throw Error(`Line ${t.line}: Invalid mermaid header: "${n}".${i} Supported headers: ${mt}.`);
1346
1507
  }
1347
1508
  let o = {
1348
1509
  direction: l(a[1]),
@@ -1359,10 +1520,10 @@ function rt(e) {
1359
1520
  let n = e[t].text;
1360
1521
  if (d(n, o) || u(n, o) || p(n, o)) continue;
1361
1522
  if (/^click\s+/i.test(n)) {
1362
- mt(n, o);
1523
+ At(n, o);
1363
1524
  continue;
1364
1525
  }
1365
- if (gt(n, o)) continue;
1526
+ if (Q(n, o)) continue;
1366
1527
  let a = n.match(/^linkStyle\s+(default|[\d,\s]+)\s+(.+)$/);
1367
1528
  if (a) {
1368
1529
  let e = a[1].trim(), t = i(a[2]);
@@ -1387,7 +1548,7 @@ function rt(e) {
1387
1548
  let f = n.match(/^subgraph\s+(.+)$/);
1388
1549
  if (f) {
1389
1550
  let e = f[1].trim(), t = e.match(/^([^\s[]+)\s*\[(.+)\]$/), n, i;
1390
- t ? (n = t[1], i = r(Ze(t[2]))) : (i = r(Ze(e)), n = i.replace(/\s+/g, "_").replace(/[^\p{L}\p{N}_-]/gu, ""));
1551
+ t ? (n = t[1], i = r(pt(t[2]))) : (i = r(pt(e)), n = i.replace(/\s+/g, "_").replace(/[^\p{L}\p{N}_-]/gu, ""));
1391
1552
  let a = {
1392
1553
  id: n,
1393
1554
  label: i,
@@ -1402,11 +1563,11 @@ function rt(e) {
1402
1563
  e && (s.length > 0 ? s[s.length - 1].children.push(e) : o.subgraphs.push(e));
1403
1564
  continue;
1404
1565
  }
1405
- bt(n, o, s);
1566
+ Ft(n, o, s);
1406
1567
  }
1407
1568
  return o;
1408
1569
  }
1409
- function it(e) {
1570
+ function bt(e) {
1410
1571
  let t = {
1411
1572
  direction: "TD",
1412
1573
  nodes: /* @__PURE__ */ new Map(),
@@ -1442,7 +1603,7 @@ function it(e) {
1442
1603
  }
1443
1604
  continue;
1444
1605
  }
1445
- if (gt(f, t)) continue;
1606
+ if (Q(f, t)) continue;
1446
1607
  let g = f.match(/^state\s+(?:"([^"]+)"\s+as\s+)?([\w\p{L}]+)\s*\{$/u);
1447
1608
  if (g) {
1448
1609
  let e = g[1] ?? g[2], r = g[2], i = {
@@ -1462,21 +1623,21 @@ function it(e) {
1462
1623
  let _ = f.match(/^state\s+"([^"]+)"\s+as\s+([\w\p{L}]+)\s*$/u);
1463
1624
  if (_) {
1464
1625
  let e = r(_[1]), i = _[2];
1465
- at(t, n, i, e);
1626
+ xt(t, n, i, e);
1466
1627
  continue;
1467
1628
  }
1468
1629
  let v = f.match(/^(\[\*\]|[\w\p{L}-]+)(?::::([\w][\w-]*))?\s*(?:([\w-]+)@)?-->\s*(\[\*\]|[\w\p{L}-]+)(?::::([\w][\w-]*))?(?:\s*:\s*(.+))?$/u);
1469
1630
  if (v) {
1470
1631
  let e = v[1], i = v[2], c = v[3], l = v[4], u = v[5], d = v[6]?.trim(), f = d ? r(d) : void 0;
1471
- e === "[*]" ? (o++, e = `_start${o > 1 ? o : ""}`, X(t, n, {
1632
+ e === "[*]" ? (o++, e = `_start${o > 1 ? o : ""}`, Y(t, n, {
1472
1633
  id: e,
1473
1634
  label: "",
1474
1635
  shape: "state-start"
1475
- })) : a.has(e) || Z(t, n, e), l === "[*]" ? (s++, l = `_end${s > 1 ? s : ""}`, X(t, n, {
1636
+ })) : a.has(e) || X(t, n, e), l === "[*]" ? (s++, l = `_end${s > 1 ? s : ""}`, Y(t, n, {
1476
1637
  id: l,
1477
1638
  label: "",
1478
1639
  shape: "state-end"
1479
- })) : a.has(l) || Z(t, n, l), i !== void 0 && t.classAssignments.set(e, i), u !== void 0 && t.classAssignments.set(l, u), t.edges.push({
1640
+ })) : a.has(l) || X(t, n, l), i !== void 0 && t.classAssignments.set(e, i), u !== void 0 && t.classAssignments.set(l, u), t.edges.push({
1480
1641
  source: e,
1481
1642
  target: l,
1482
1643
  label: f,
@@ -1490,35 +1651,35 @@ function it(e) {
1490
1651
  let y = f.match(/^([\w\p{L}-]+):::([\w][\w-]*)\s*$/u);
1491
1652
  if (y) {
1492
1653
  let e = y[1];
1493
- a.has(e) || Z(t, n, e), t.classAssignments.set(e, y[2]);
1654
+ a.has(e) || X(t, n, e), t.classAssignments.set(e, y[2]);
1494
1655
  continue;
1495
1656
  }
1496
1657
  let b = f.match(/^([\w\p{L}-]+)\s*:\s*(.+)$/u);
1497
1658
  if (b) {
1498
1659
  let e = b[1];
1499
- at(t, n, e, r(b[2].trim()));
1660
+ xt(t, n, e, r(b[2].trim()));
1500
1661
  continue;
1501
1662
  }
1502
1663
  }
1503
- for (let e of t.classAssignments.keys()) !t.nodes.has(e) && !a.has(e) && Z(t, [], e);
1664
+ for (let e of t.classAssignments.keys()) !t.nodes.has(e) && !a.has(e) && X(t, [], e);
1504
1665
  return t;
1505
1666
  }
1506
- function at(e, t, n, r) {
1667
+ function xt(e, t, n, r) {
1507
1668
  let i = e.nodes.get(n);
1508
- i && (i.label = r), X(e, t, {
1669
+ i && (i.label = r), Y(e, t, {
1509
1670
  id: n,
1510
1671
  label: r,
1511
1672
  shape: "rounded"
1512
1673
  });
1513
1674
  }
1514
- function X(e, t, n) {
1675
+ function Y(e, t, n) {
1515
1676
  if (e.nodes.has(n.id) || e.nodes.set(n.id, n), t.length > 0) {
1516
1677
  let e = t[t.length - 1];
1517
1678
  e.nodeIds.includes(n.id) || e.nodeIds.push(n.id);
1518
1679
  }
1519
1680
  }
1520
- function Z(e, t, n) {
1521
- if (!e.nodes.has(n)) X(e, t, {
1681
+ function X(e, t, n) {
1682
+ if (!e.nodes.has(n)) Y(e, t, {
1522
1683
  id: n,
1523
1684
  label: n,
1524
1685
  shape: "rounded"
@@ -1528,12 +1689,12 @@ function Z(e, t, n) {
1528
1689
  e.nodeIds.includes(n) || e.nodeIds.push(n);
1529
1690
  }
1530
1691
  }
1531
- var ot = /^(<|o|x)?(-{2,}|={2,}|-\.+-|~{3,})(>|o|x)?(?:\|([^|]*)\|)?/, st = /* @__PURE__ */ new Set(["--", "=="]);
1532
- function Q(e) {
1692
+ var St = /^(<|o|x)?(-{2,}|={2,}|-\.+-|~{3,})(>|o|x)?(?:\s*\|([^|]*)\|)?/, Ct = /* @__PURE__ */ new Set(["--", "=="]);
1693
+ function Z(e) {
1533
1694
  if (e === "o") return "circle";
1534
1695
  if (e === "x") return "cross";
1535
1696
  }
1536
- var ct = /^(<|o|x)?(--|-\.|==)\s+(.+?)\s+(-{2,}[>ox]|={2,}[>ox]|\.+-[>ox]|-{3,}|={3,}|-\.+-)/, lt = [
1697
+ var wt = /^(<|o|x)?(--|-\.|==)\s+(.+?)\s+(-{2,}[>ox]|={2,}[>ox]|\.+-[>ox]|-{3,}|={3,}|-\.+-)/, Tt = [
1537
1698
  {
1538
1699
  regex: /^([\w\p{L}-]+)\(\(\(((?:"[^"]*"|(?!\)\)\)).)+)\)\)\)/u,
1539
1700
  shape: "doublecircle"
@@ -1582,9 +1743,9 @@ var ct = /^(<|o|x)?(--|-\.|==)\s+(.+?)\s+(-{2,}[>ox]|={2,}[>ox]|\.+-[>ox]|-{3,}|
1582
1743
  regex: /^([\w\p{L}-]+)\{((?:"[^"]*"|(?!\}).)+)\}/u,
1583
1744
  shape: "diamond"
1584
1745
  }
1585
- ], ut = /^([\w\p{L}]+(?:-[\w\p{L}]+)*)/u, dt = /^([\w\p{L}-]+)(?=@\{)/u;
1586
- function ft(e) {
1587
- if (e.shape) return q(e.shape) ?? "rectangle";
1746
+ ], Et = /^([\w\p{L}]+(?:-[\w\p{L}]+)*)/u, Dt = /^([\w\p{L}-]+)(?=@\{)/u;
1747
+ function Ot(e) {
1748
+ if (e.shape) return G(e.shape) ?? "rectangle";
1588
1749
  if (e.icon !== void 0 || e.img !== void 0) switch (e.form?.toLowerCase()) {
1589
1750
  case "circle": return "circle";
1590
1751
  case "rounded": return "rounded";
@@ -1592,46 +1753,46 @@ function ft(e) {
1592
1753
  }
1593
1754
  return "rectangle";
1594
1755
  }
1595
- function pt(e, t) {
1756
+ function kt(e, t) {
1596
1757
  return t.label !== void 0 && t.label.length > 0 ? t.label : t.icon ? t.icon : t.img ? t.img : e;
1597
1758
  }
1598
- function mt(t, n) {
1759
+ function At(t, n) {
1599
1760
  e(t, n.interactions);
1600
1761
  }
1601
- var ht = /^([\w-]+)(?=@\{)/;
1602
- function gt(e, t) {
1603
- let n = e.match(ht);
1762
+ var jt = /^([\w-]+)(?=@\{)/;
1763
+ function Q(e, t) {
1764
+ let n = e.match(jt);
1604
1765
  if (!n || !t.edges.some((e) => e.id === n[1])) return !1;
1605
- let r = Y(e.slice(n[1].length));
1606
- return r ? (_t(t, n[1], J(r.body)), !0) : !1;
1766
+ let r = J(e.slice(n[1].length));
1767
+ return r ? (Mt(t, n[1], K(r.body)), !0) : !1;
1607
1768
  }
1608
- function _t(e, t, n) {
1769
+ function Mt(e, t, n) {
1609
1770
  for (let r of e.edges) r.id === t && (n.animate !== void 0 && (r.animate = n.animate.toLowerCase() !== "false"), n.animation !== void 0 && (r.animate = !0));
1610
1771
  }
1611
- var vt = /^:::([\w][\w-]*)/, yt = /^([\w\p{L}-]+):::([\w][\w-]*)/u;
1612
- function bt(e, t, n) {
1613
- let i = e.trim(), a = xt(i, t, n);
1772
+ var Nt = /^:::([\w][\w-]*)/, Pt = /^([\w\p{L}-]+):::([\w][\w-]*)/u;
1773
+ function Ft(e, t, n) {
1774
+ let i = e.trim(), a = It(i, t, n);
1614
1775
  if (!a || a.ids.length === 0) return;
1615
1776
  i = a.remaining.trim();
1616
1777
  let o = a.ids;
1617
1778
  for (; i.length > 0;) {
1618
1779
  let e, a, s, c, l, u, d, f = i.match(/^([\w-]+)@(?=[-=<~ox])/);
1619
1780
  f && (d = f[1], i = i.slice(f[0].length));
1620
- let p = i.match(ot), m = p?.[2], h = p?.[1], g = p?.[3];
1621
- if (p && m !== void 0 && !(h === void 0 && g === void 0 && st.has(m))) {
1622
- e = h !== void 0, l = Q(h);
1781
+ let p = i.match(St), m = p?.[2], h = p?.[1], g = p?.[3];
1782
+ if (p && m !== void 0 && !(h === void 0 && g === void 0 && Ct.has(m))) {
1783
+ e = h !== void 0, l = Z(h);
1623
1784
  let t = p[4]?.trim();
1624
- c = t ? r(t) : void 0, i = i.slice(p[0].length).trim(), a = Tt(m), s = g !== void 0, u = Q(g);
1785
+ c = t ? r(t) : void 0, i = i.slice(p[0].length).trim(), a = Bt(m), s = g !== void 0, u = Z(g);
1625
1786
  } else {
1626
- let t = i.match(ct);
1787
+ let t = i.match(wt);
1627
1788
  if (!t) break;
1628
- e = !!t[1], l = Q(t[1]);
1789
+ e = !!t[1], l = Z(t[1]);
1629
1790
  let n = t[3].trim();
1630
1791
  c = n ? r(n) : void 0;
1631
1792
  let o = t[2], d = t[4];
1632
- i = i.slice(t[0].length).trim(), a = Et(o, d), u = Q(d.slice(-1)), s = d.endsWith(">") || u !== void 0;
1793
+ i = i.slice(t[0].length).trim(), a = Vt(o, d), u = Z(d.slice(-1)), s = d.endsWith(">") || u !== void 0;
1633
1794
  }
1634
- let _ = xt(i, t, n);
1795
+ let _ = It(i, t, n);
1635
1796
  if (!_ || _.ids.length === 0) break;
1636
1797
  i = _.remaining.trim();
1637
1798
  for (let n of o) for (let r of _.ids) t.edges.push({
@@ -1648,13 +1809,13 @@ function bt(e, t, n) {
1648
1809
  o = _.ids;
1649
1810
  }
1650
1811
  }
1651
- function xt(e, t, n) {
1652
- let r = St(e, t, n);
1812
+ function It(e, t, n) {
1813
+ let r = Lt(e, t, n);
1653
1814
  if (!r) return null;
1654
1815
  let i = [r.id], a = r.remaining.trim();
1655
1816
  for (; a.startsWith("&");) {
1656
1817
  a = a.slice(1).trim();
1657
- let e = St(a, t, n);
1818
+ let e = Lt(a, t, n);
1658
1819
  if (!e) break;
1659
1820
  i.push(e.id), a = e.remaining.trim();
1660
1821
  }
@@ -1663,22 +1824,22 @@ function xt(e, t, n) {
1663
1824
  remaining: a
1664
1825
  };
1665
1826
  }
1666
- function St(e, t, n) {
1667
- let i = null, a = e, o, s = a.match(yt);
1827
+ function Lt(e, t, n) {
1828
+ let i = null, a = e, o, s = a.match(Pt);
1668
1829
  s && (o = s[2], a = s[1] + a.slice(s[0].length));
1669
- let c = a.match(dt);
1830
+ let c = a.match(Dt);
1670
1831
  if (c) {
1671
- let e = c[1], o = Y(a.slice(e.length));
1832
+ let e = c[1], o = J(a.slice(e.length));
1672
1833
  if (o) {
1673
- let s = J(o.body);
1834
+ let s = K(o.body);
1674
1835
  $(t, n, {
1675
1836
  id: e,
1676
- label: r(pt(e, s)),
1677
- shape: ft(s)
1837
+ label: r(kt(e, s)),
1838
+ shape: Ot(s)
1678
1839
  }), i = e, a = a.slice(e.length + o.length);
1679
1840
  }
1680
1841
  }
1681
- if (i === null) for (let { regex: e, shape: o } of lt) {
1842
+ if (i === null) for (let { regex: e, shape: o } of Tt) {
1682
1843
  let s = a.match(e);
1683
1844
  if (s) {
1684
1845
  i = s[1];
@@ -1692,8 +1853,8 @@ function St(e, t, n) {
1692
1853
  }
1693
1854
  }
1694
1855
  if (i === null) {
1695
- let e = a.match(ut);
1696
- e && (i = e[1], t.nodes.has(i) ? Ct(t, n, i) || wt(n, i) : $(t, n, {
1856
+ let e = a.match(Et);
1857
+ e && (i = e[1], t.nodes.has(i) ? Rt(t, n, i) || zt(n, i) : $(t, n, {
1697
1858
  id: i,
1698
1859
  label: i,
1699
1860
  shape: "rectangle"
@@ -1701,32 +1862,32 @@ function St(e, t, n) {
1701
1862
  }
1702
1863
  if (i === null) return null;
1703
1864
  o && t.classAssignments.set(i, o);
1704
- let l = a.match(vt);
1865
+ let l = a.match(Nt);
1705
1866
  return l && (t.classAssignments.set(i, l[1]), a = a.slice(l[0].length)), {
1706
1867
  id: i,
1707
1868
  remaining: a
1708
1869
  };
1709
1870
  }
1710
1871
  function $(e, t, n) {
1711
- e.nodes.has(n.id) || e.nodes.set(n.id, n), wt(t, n.id);
1872
+ e.nodes.has(n.id) || e.nodes.set(n.id, n), zt(t, n.id);
1712
1873
  }
1713
- function Ct(e, t, n) {
1874
+ function Rt(e, t, n) {
1714
1875
  let r = (e) => e.nodeIds.includes(n) || e.children.some(r);
1715
1876
  return e.subgraphs.some(r) || t.some(r);
1716
1877
  }
1717
- function wt(e, t) {
1878
+ function zt(e, t) {
1718
1879
  if (e.length > 0) {
1719
1880
  let n = e[e.length - 1];
1720
1881
  n.nodeIds.includes(t) || n.nodeIds.push(t);
1721
1882
  }
1722
1883
  }
1723
- function Tt(e) {
1884
+ function Bt(e) {
1724
1885
  return e.startsWith("~") ? "invisible" : e.includes(".") ? "dotted" : e.startsWith("=") ? "thick" : "solid";
1725
1886
  }
1726
- function Et(e, t) {
1887
+ function Vt(e, t) {
1727
1888
  return e.includes(".") || t.includes(".") ? "dotted" : e.startsWith("=") || t.startsWith("=") ? "thick" : "solid";
1728
1889
  }
1729
1890
  //#endregion
1730
- export { H as CHART_ACCENT_FALLBACK, ne as architectureToGraph, ve as c4BoundaryTypeLine, be as c4Placement, ye as c4RelLabelLines, _e as c4TypeLine, B as checkActivationBalance, ze as fixActivationBalance, Oe as formatClassMember, Ke as getSeriesColor, N as isBlockType, j as isCssColor, G as isDarkBackground, W as isValidHex, qe as knownShapeNames, Y as matchExpandedBlock, x as parseArchitecture, M as parseBoxHeader, me as parseC4Diagram, Se as parseClassDiagram, ke as parseErDiagram, J as parseExpandedMeta, O as parseGenericTypes, nt as parseMermaid, F as parseSequenceDiagram, Be as parseXYChart, q as resolveShapeName, P as toBlockType, c as toDirection, he as wrapC4Text };
1891
+ export { R as CHART_ACCENT_FALLBACK, ne as architectureToGraph, ve as c4BoundaryTypeLine, be as c4Placement, ye as c4RelLabelLines, _e as c4TypeLine, I as checkActivationBalance, Ue as fixActivationBalance, ke as formatClassMember, Xe as getSeriesColor, A as isBlockType, k as isCssColor, V as isDarkBackground, B as isValidHex, ut as knownShapeNames, J as matchExpandedBlock, x as parseArchitecture, Re as parseBoxHeader, me as parseC4Diagram, Ce as parseClassDiagram, Ae as parseErDiagram, K as parseExpandedMeta, D as parseGenericTypes, vt as parseMermaid, lt as parsePieChart, M as parseSequenceDiagram, We as parseXYChart, G as resolveShapeName, j as toBlockType, c as toDirection, he as wrapC4Text };
1731
1892
 
1732
1893
  //# sourceMappingURL=index.js.map