@diagrammo/dgmo 0.15.1 → 0.17.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 (122) hide show
  1. package/README.md +9 -9
  2. package/dist/advanced.cjs +612 -734
  3. package/dist/advanced.d.cts +42 -36
  4. package/dist/advanced.d.ts +42 -36
  5. package/dist/advanced.js +612 -733
  6. package/dist/auto.cjs +508 -620
  7. package/dist/auto.js +105 -105
  8. package/dist/auto.mjs +508 -620
  9. package/dist/cli.cjs +144 -144
  10. package/dist/editor.cjs +8 -9
  11. package/dist/editor.js +8 -9
  12. package/dist/highlight.cjs +8 -9
  13. package/dist/highlight.js +8 -9
  14. package/dist/index.cjs +497 -608
  15. package/dist/index.js +497 -608
  16. package/dist/internal.cjs +612 -734
  17. package/dist/internal.d.cts +42 -36
  18. package/dist/internal.d.ts +42 -36
  19. package/dist/internal.js +612 -733
  20. package/dist/pert.d.cts +2 -2
  21. package/dist/pert.d.ts +2 -2
  22. package/docs/language-reference.md +97 -84
  23. package/docs/migration-sequence-color-to-tags.md +1 -1
  24. package/gallery/fixtures/area.dgmo +3 -3
  25. package/gallery/fixtures/bar-stacked.dgmo +5 -5
  26. package/gallery/fixtures/boxes-and-lines.dgmo +2 -2
  27. package/gallery/fixtures/c4-full.dgmo +8 -8
  28. package/gallery/fixtures/class-full.dgmo +2 -2
  29. package/gallery/fixtures/doughnut.dgmo +6 -6
  30. package/gallery/fixtures/flowchart-colors.dgmo +3 -3
  31. package/gallery/fixtures/function.dgmo +3 -3
  32. package/gallery/fixtures/gantt-full.dgmo +9 -9
  33. package/gallery/fixtures/gantt.dgmo +7 -7
  34. package/gallery/fixtures/infra-full.dgmo +6 -6
  35. package/gallery/fixtures/infra.dgmo +2 -2
  36. package/gallery/fixtures/kanban.dgmo +9 -9
  37. package/gallery/fixtures/line.dgmo +2 -2
  38. package/gallery/fixtures/multi-line.dgmo +3 -3
  39. package/gallery/fixtures/org-full.dgmo +6 -6
  40. package/gallery/fixtures/quadrant.dgmo +2 -2
  41. package/gallery/fixtures/sankey.dgmo +9 -9
  42. package/gallery/fixtures/scatter.dgmo +3 -3
  43. package/gallery/fixtures/sequence-tags-protocols.dgmo +11 -11
  44. package/gallery/fixtures/sequence-tags.dgmo +10 -10
  45. package/gallery/fixtures/sequence.dgmo +4 -4
  46. package/gallery/fixtures/sitemap-full.dgmo +7 -7
  47. package/gallery/fixtures/slope.dgmo +5 -5
  48. package/gallery/fixtures/spr-eras.dgmo +9 -9
  49. package/gallery/fixtures/timeline.dgmo +3 -3
  50. package/gallery/fixtures/venn.dgmo +3 -3
  51. package/package.json +7 -3
  52. package/src/advanced.ts +0 -1
  53. package/src/auto/index.ts +2 -2
  54. package/src/boxes-and-lines/layout.ts +1 -2
  55. package/src/boxes-and-lines/renderer.ts +5 -1
  56. package/src/c4/parser.ts +2 -2
  57. package/src/c4/renderer.ts +15 -8
  58. package/src/chart.ts +18 -9
  59. package/src/class/parser.ts +8 -7
  60. package/src/class/renderer.ts +17 -6
  61. package/src/cli.ts +8 -8
  62. package/src/completion.ts +14 -17
  63. package/src/cycle/parser.ts +15 -1
  64. package/src/cycle/renderer.ts +6 -3
  65. package/src/d3.ts +88 -49
  66. package/src/diagnostics.ts +20 -0
  67. package/src/echarts.ts +28 -11
  68. package/src/editor/dgmo.grammar +1 -3
  69. package/src/editor/dgmo.grammar.d.ts +1 -1
  70. package/src/editor/dgmo.grammar.js +8 -8
  71. package/src/editor/dgmo.grammar.terms.js +11 -12
  72. package/src/editor/highlight-api.ts +0 -1
  73. package/src/editor/highlight.ts +0 -1
  74. package/src/er/parser.ts +19 -12
  75. package/src/er/renderer.ts +19 -7
  76. package/src/gantt/parser.ts +1 -1
  77. package/src/gantt/renderer.ts +7 -4
  78. package/src/graph/flowchart-parser.ts +18 -84
  79. package/src/graph/flowchart-renderer.ts +6 -8
  80. package/src/graph/layout.ts +0 -2
  81. package/src/graph/state-parser.ts +17 -62
  82. package/src/graph/state-renderer.ts +3 -8
  83. package/src/infra/parser.ts +21 -11
  84. package/src/infra/renderer.ts +8 -6
  85. package/src/journey-map/parser.ts +11 -4
  86. package/src/journey-map/renderer.ts +3 -1
  87. package/src/kanban/parser.ts +11 -7
  88. package/src/kanban/renderer.ts +3 -1
  89. package/src/mindmap/parser.ts +4 -5
  90. package/src/mindmap/renderer.ts +2 -1
  91. package/src/org/parser.ts +3 -3
  92. package/src/org/renderer.ts +4 -3
  93. package/src/pert/analyzer.ts +10 -10
  94. package/src/pert/layout.ts +1 -1
  95. package/src/pert/parser.ts +8 -8
  96. package/src/pert/renderer.ts +7 -2
  97. package/src/pert/types.ts +1 -1
  98. package/src/pyramid/parser.ts +13 -1
  99. package/src/raci/parser.ts +42 -12
  100. package/src/raci/renderer.ts +2 -1
  101. package/src/raci/types.ts +4 -3
  102. package/src/ring/parser.ts +13 -1
  103. package/src/sequence/parser.ts +81 -23
  104. package/src/sequence/participant-inference.ts +18 -181
  105. package/src/sequence/renderer.ts +48 -137
  106. package/src/sitemap/layout.ts +0 -2
  107. package/src/sitemap/parser.ts +12 -38
  108. package/src/sitemap/renderer.ts +13 -13
  109. package/src/sitemap/types.ts +0 -1
  110. package/src/tech-radar/parser.ts +2 -2
  111. package/src/tech-radar/renderer.ts +5 -3
  112. package/src/tech-radar/types.ts +2 -0
  113. package/src/utils/arrows.ts +3 -28
  114. package/src/utils/extract-alias.ts +1 -1
  115. package/src/utils/inline-markdown.ts +1 -1
  116. package/src/utils/legend-d3.ts +12 -6
  117. package/src/utils/legend-layout.ts +1 -1
  118. package/src/utils/legend-types.ts +1 -1
  119. package/src/utils/parsing.ts +64 -35
  120. package/src/utils/tag-groups.ts +98 -18
  121. package/src/utils/time-ticks.ts +1 -1
  122. package/src/wireframe/parser.ts +3 -3
package/dist/internal.js CHANGED
@@ -74,6 +74,9 @@ function nameMergedMessage(args) {
74
74
  function akaRemovedMessage() {
75
75
  return `'aka' is no longer supported \u2014 use the participant name directly`;
76
76
  }
77
+ function participantTypeRemovedMessage(type) {
78
+ return `'${type}' is no longer supported \u2014 drop 'is a ${type}'; the participant renders as the default rectangle`;
79
+ }
77
80
  function tagShorthandRemovedMessage(args) {
78
81
  return `Bare tag shorthand 'tag ${args.name} ${args.alias}' was removed. Use 'tag ${args.name} as ${args.alias}' instead.`;
79
82
  }
@@ -107,7 +110,15 @@ var init_diagnostics = __esm({
107
110
  * participant declaration. Forgiving normalization makes aliasing
108
111
  * unnecessary; the diagnostic directs users to the new syntax.
109
112
  */
110
- AKA_REMOVED: "E_AKA_REMOVED"
113
+ AKA_REMOVED: "E_AKA_REMOVED",
114
+ /**
115
+ * Error: a removed sequence participant-type keyword was used in
116
+ * an `is a X` declaration. The 0.16.0 trim retained only
117
+ * `actor`/`database`/`cache`/`queue`; `service`/`frontend`/
118
+ * `networking`/`gateway`/`external` no longer carry semantic
119
+ * weight and emit this error so users drop the override.
120
+ */
121
+ PARTICIPANT_TYPE_REMOVED: "E_PARTICIPANT_TYPE_REMOVED"
111
122
  };
112
123
  ALIAS_DIAGNOSTIC_CODES = {
113
124
  /** Alias token used before its declaration (strict-ordering rule). */
@@ -138,114 +149,6 @@ var init_diagnostics = __esm({
138
149
  }
139
150
  });
140
151
 
141
- // src/colors.ts
142
- function isRecognizedColorName(name) {
143
- return Object.prototype.hasOwnProperty.call(colorNames, name.toLowerCase());
144
- }
145
- function resolveColor(color, palette) {
146
- if (!color) return null;
147
- if (color.startsWith("#")) return null;
148
- const lower = color.toLowerCase();
149
- if (!isRecognizedColorName(lower)) return null;
150
- if (palette) {
151
- const named = palette.colors[lower];
152
- if (named) return named;
153
- }
154
- return colorNames[lower];
155
- }
156
- function resolveColorWithDiagnostic(color, line12, diagnostics, palette) {
157
- const resolved = resolveColor(color, palette);
158
- if (resolved !== null) return resolved;
159
- const hint = suggest(color, RECOGNIZED_COLOR_NAMES);
160
- const suggestion = hint ? ` ${hint}` : "";
161
- diagnostics.push(
162
- makeDgmoError(
163
- line12,
164
- `Unknown color "${color}". Allowed: ${RECOGNIZED_COLOR_NAMES.join(", ")}.${suggestion}`,
165
- "warning"
166
- )
167
- );
168
- return void 0;
169
- }
170
- var nord, colorNames, RECOGNIZED_COLOR_NAMES, seriesColors;
171
- var init_colors = __esm({
172
- "src/colors.ts"() {
173
- "use strict";
174
- init_diagnostics();
175
- nord = {
176
- // Polar Night (dark)
177
- nord0: "#2e3440",
178
- nord1: "#3b4252",
179
- nord2: "#434c5e",
180
- nord3: "#4c566a",
181
- // Snow Storm (light)
182
- nord4: "#d8dee9",
183
- nord5: "#e5e9f0",
184
- nord6: "#eceff4",
185
- // Frost (accent blues)
186
- nord7: "#8fbcbb",
187
- nord8: "#88c0d0",
188
- nord9: "#81a1c1",
189
- nord10: "#5e81ac",
190
- // Aurora (colors)
191
- nord11: "#bf616a",
192
- // red
193
- nord12: "#d08770",
194
- // orange
195
- nord13: "#ebcb8b",
196
- // yellow
197
- nord14: "#a3be8c",
198
- // green
199
- nord15: "#b48ead"
200
- // purple
201
- };
202
- colorNames = {
203
- red: nord.nord11,
204
- orange: nord.nord12,
205
- yellow: nord.nord13,
206
- green: nord.nord14,
207
- blue: nord.nord10,
208
- purple: nord.nord15,
209
- teal: nord.nord7,
210
- cyan: nord.nord8,
211
- gray: nord.nord3,
212
- black: nord.nord0,
213
- white: nord.nord6
214
- };
215
- RECOGNIZED_COLOR_NAMES = Object.freeze([
216
- "red",
217
- "orange",
218
- "yellow",
219
- "green",
220
- "blue",
221
- "purple",
222
- "teal",
223
- "cyan",
224
- "gray",
225
- "black",
226
- "white"
227
- ]);
228
- seriesColors = [
229
- nord.nord10,
230
- // blue
231
- nord.nord14,
232
- // green
233
- nord.nord13,
234
- // yellow
235
- nord.nord12,
236
- // orange
237
- nord.nord15,
238
- // purple
239
- nord.nord11,
240
- // red
241
- nord.nord7,
242
- // teal
243
- nord.nord8
244
- // light blue
245
- ];
246
- }
247
- });
248
-
249
152
  // src/utils/arrows.ts
250
153
  function validateLabelCharacters(label, lineNumber) {
251
154
  const out = [];
@@ -286,15 +189,6 @@ function parseInArrowLabel(rawLabel, lineNumber) {
286
189
  const diagnostics = validateLabelCharacters(trimmed, lineNumber);
287
190
  return { label: trimmed, diagnostics };
288
191
  }
289
- function matchColorParens(content) {
290
- const m = content.match(/^\(([A-Za-z]+)\)$/);
291
- if (!m) return null;
292
- const candidate = m[1].toLowerCase();
293
- if (RECOGNIZED_COLOR_NAMES.includes(candidate)) {
294
- return candidate;
295
- }
296
- return null;
297
- }
298
192
  function parseArrow(line12) {
299
193
  if (BIDI_SYNC_RE.test(line12) || BIDI_ASYNC_RE.test(line12)) {
300
194
  return {
@@ -333,7 +227,6 @@ var init_arrows = __esm({
333
227
  "src/utils/arrows.ts"() {
334
228
  "use strict";
335
229
  init_diagnostics();
336
- init_colors();
337
230
  ARROW_DIAGNOSTIC_CODES = {
338
231
  /** Active: label contains `->` or `~>` substring (TD-13). */
339
232
  ARROW_SUBSTRING_IN_LABEL: "E_ARROW_SUBSTRING_IN_LABEL",
@@ -695,6 +588,114 @@ var init_time_ticks = __esm({
695
588
  }
696
589
  });
697
590
 
591
+ // src/colors.ts
592
+ function isRecognizedColorName(name) {
593
+ return Object.prototype.hasOwnProperty.call(colorNames, name.toLowerCase());
594
+ }
595
+ function resolveColor(color, palette) {
596
+ if (!color) return null;
597
+ if (color.startsWith("#")) return null;
598
+ const lower = color.toLowerCase();
599
+ if (!isRecognizedColorName(lower)) return null;
600
+ if (palette) {
601
+ const named = palette.colors[lower];
602
+ if (named) return named;
603
+ }
604
+ return colorNames[lower];
605
+ }
606
+ function resolveColorWithDiagnostic(color, line12, diagnostics, palette) {
607
+ const resolved = resolveColor(color, palette);
608
+ if (resolved !== null) return resolved;
609
+ const hint = suggest(color, RECOGNIZED_COLOR_NAMES);
610
+ const suggestion = hint ? ` ${hint}` : "";
611
+ diagnostics.push(
612
+ makeDgmoError(
613
+ line12,
614
+ `Unknown color "${color}". Allowed: ${RECOGNIZED_COLOR_NAMES.join(", ")}.${suggestion}`,
615
+ "warning"
616
+ )
617
+ );
618
+ return void 0;
619
+ }
620
+ var nord, colorNames, RECOGNIZED_COLOR_NAMES, seriesColors;
621
+ var init_colors = __esm({
622
+ "src/colors.ts"() {
623
+ "use strict";
624
+ init_diagnostics();
625
+ nord = {
626
+ // Polar Night (dark)
627
+ nord0: "#2e3440",
628
+ nord1: "#3b4252",
629
+ nord2: "#434c5e",
630
+ nord3: "#4c566a",
631
+ // Snow Storm (light)
632
+ nord4: "#d8dee9",
633
+ nord5: "#e5e9f0",
634
+ nord6: "#eceff4",
635
+ // Frost (accent blues)
636
+ nord7: "#8fbcbb",
637
+ nord8: "#88c0d0",
638
+ nord9: "#81a1c1",
639
+ nord10: "#5e81ac",
640
+ // Aurora (colors)
641
+ nord11: "#bf616a",
642
+ // red
643
+ nord12: "#d08770",
644
+ // orange
645
+ nord13: "#ebcb8b",
646
+ // yellow
647
+ nord14: "#a3be8c",
648
+ // green
649
+ nord15: "#b48ead"
650
+ // purple
651
+ };
652
+ colorNames = {
653
+ red: nord.nord11,
654
+ orange: nord.nord12,
655
+ yellow: nord.nord13,
656
+ green: nord.nord14,
657
+ blue: nord.nord10,
658
+ purple: nord.nord15,
659
+ teal: nord.nord7,
660
+ cyan: nord.nord8,
661
+ gray: nord.nord3,
662
+ black: nord.nord0,
663
+ white: nord.nord6
664
+ };
665
+ RECOGNIZED_COLOR_NAMES = Object.freeze([
666
+ "red",
667
+ "orange",
668
+ "yellow",
669
+ "green",
670
+ "blue",
671
+ "purple",
672
+ "teal",
673
+ "cyan",
674
+ "gray",
675
+ "black",
676
+ "white"
677
+ ]);
678
+ seriesColors = [
679
+ nord.nord10,
680
+ // blue
681
+ nord.nord14,
682
+ // green
683
+ nord.nord13,
684
+ // yellow
685
+ nord.nord12,
686
+ // orange
687
+ nord.nord15,
688
+ // purple
689
+ nord.nord11,
690
+ // red
691
+ nord.nord7,
692
+ // teal
693
+ nord.nord8
694
+ // light blue
695
+ ];
696
+ }
697
+ });
698
+
698
699
  // src/palettes/registry.ts
699
700
  function isValidHex(value) {
700
701
  return /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(value);
@@ -1927,17 +1928,21 @@ function measureIndent(line12) {
1927
1928
  return indent;
1928
1929
  }
1929
1930
  function extractColor(label, palette, diagnostics, line12) {
1930
- const m = label.match(COLOR_SUFFIX_RE);
1931
- if (!m) return { label };
1932
- const colorName = m[1].trim();
1931
+ const lastSpaceIdx = Math.max(
1932
+ label.lastIndexOf(" "),
1933
+ label.lastIndexOf(" ")
1934
+ );
1935
+ if (lastSpaceIdx < 0) return { label };
1936
+ const trailing = label.substring(lastSpaceIdx + 1);
1937
+ if (!RECOGNIZED_COLOR_SET.has(trailing)) return { label };
1933
1938
  let color;
1934
1939
  if (diagnostics && line12 !== void 0) {
1935
- color = resolveColorWithDiagnostic(colorName, line12, diagnostics, palette);
1940
+ color = resolveColorWithDiagnostic(trailing, line12, diagnostics, palette);
1936
1941
  } else {
1937
- color = resolveColor(colorName, palette) ?? void 0;
1942
+ color = resolveColor(trailing, palette) ?? void 0;
1938
1943
  }
1939
1944
  return {
1940
- label: label.substring(0, m.index).trim(),
1945
+ label: label.substring(0, lastSpaceIdx).trimEnd(),
1941
1946
  color
1942
1947
  };
1943
1948
  }
@@ -2070,14 +2075,18 @@ function parseSeriesNames(value, lines, lineIndex, palette, diagnostics) {
2070
2075
  }
2071
2076
  return { series, names, nameColors, nameLineNumbers, newIndex };
2072
2077
  }
2073
- function inferArrowColor(label) {
2074
- const lower = label.toLowerCase();
2075
- if (lower === "yes" || lower === "success" || lower === "ok" || lower === "true")
2076
- return "green";
2077
- if (lower === "no" || lower === "fail" || lower === "error" || lower === "false")
2078
- return "red";
2079
- if (lower === "maybe" || lower === "warning") return "orange";
2080
- return void 0;
2078
+ function peelTrailingColorName(label) {
2079
+ const lastSpaceIdx = Math.max(
2080
+ label.lastIndexOf(" "),
2081
+ label.lastIndexOf(" ")
2082
+ );
2083
+ if (lastSpaceIdx < 0) return { label };
2084
+ const trailing = label.substring(lastSpaceIdx + 1);
2085
+ if (!RECOGNIZED_COLOR_SET.has(trailing)) return { label };
2086
+ return {
2087
+ label: label.substring(0, lastSpaceIdx).trimEnd(),
2088
+ colorName: trailing
2089
+ };
2081
2090
  }
2082
2091
  function parsePipeMetadata(segments, aliasMap = /* @__PURE__ */ new Map(), errorMultiplePipes) {
2083
2092
  if (segments.length > 2) {
@@ -2099,11 +2108,14 @@ function parsePipeMetadata(segments, aliasMap = /* @__PURE__ */ new Map(), error
2099
2108
  }
2100
2109
  return metadata;
2101
2110
  }
2102
- var ALL_CHART_TYPES, PIPE_KEY_VALUE_PREFIX_RE, PIPE_LIKELY_STRUCTURED_TAIL_RE, COLOR_SUFFIX_RE, OPTION_NOCOLON_RE, GLOBAL_BOOLEANS, MULTIPLE_PIPE_ERROR;
2111
+ var RECOGNIZED_COLOR_SET, ALL_CHART_TYPES, PIPE_KEY_VALUE_PREFIX_RE, PIPE_LIKELY_STRUCTURED_TAIL_RE, OPTION_NOCOLON_RE, GLOBAL_BOOLEANS, MULTIPLE_PIPE_ERROR;
2103
2112
  var init_parsing = __esm({
2104
2113
  "src/utils/parsing.ts"() {
2105
2114
  "use strict";
2106
2115
  init_colors();
2116
+ RECOGNIZED_COLOR_SET = new Set(
2117
+ RECOGNIZED_COLOR_NAMES
2118
+ );
2107
2119
  ALL_CHART_TYPES = /* @__PURE__ */ new Set([
2108
2120
  // data charts
2109
2121
  "bar",
@@ -2155,7 +2167,6 @@ var init_parsing = __esm({
2155
2167
  ]);
2156
2168
  PIPE_KEY_VALUE_PREFIX_RE = /^\s*[A-Za-z][A-Za-z0-9_-]*\s*:/;
2157
2169
  PIPE_LIKELY_STRUCTURED_TAIL_RE = /,\s*[A-Za-z][A-Za-z0-9_-]*\s*:/;
2158
- COLOR_SUFFIX_RE = /\(([^)]+)\)\s*$/;
2159
2170
  OPTION_NOCOLON_RE = /^([a-z][a-z0-9-]*)\s+(.+)$/i;
2160
2171
  GLOBAL_BOOLEANS = /* @__PURE__ */ new Set([
2161
2172
  "solid-fill",
@@ -2192,7 +2203,7 @@ function parseTagDeclaration(line12) {
2192
2203
  let restStartIdx = 1;
2193
2204
  let valueStart = tokens.length;
2194
2205
  for (let i = 1; i < tokens.length; i++) {
2195
- if (tokens[i].includes("(")) {
2206
+ if (tokens[i].includes(",")) {
2196
2207
  valueStart = i;
2197
2208
  break;
2198
2209
  }
@@ -2224,13 +2235,29 @@ function parseTagDeclaration(line12) {
2224
2235
  restStartIdx = valueStart;
2225
2236
  }
2226
2237
  } else {
2227
- if (tokens[0][0] === '"' || tokens[0][0] === "'") {
2228
- if (tokens.length > 1 && isAliasToken(tokens[1]) && valueStart > 1) {
2238
+ const isColorWord = (s) => RECOGNIZED_COLOR_NAMES.includes(s);
2239
+ if (valueStart < tokens.length) {
2240
+ const commaTokenIdx = valueStart;
2241
+ const lastBeforeComma = tokens[commaTokenIdx].replace(/,$/, "");
2242
+ const firstValueStart = isColorWord(lastBeforeComma) ? commaTokenIdx - 1 : commaTokenIdx;
2243
+ const prefixEnd = firstValueStart;
2244
+ const aliasCandidate = prefixEnd > 1 ? tokens[prefixEnd - 1] : void 0;
2245
+ if (aliasCandidate && isAliasToken(aliasCandidate) && !isColorWord(aliasCandidate)) {
2246
+ alias = aliasCandidate;
2247
+ legacyForm = "bare-shorthand";
2248
+ name = tokens.slice(0, prefixEnd - 1).map((t) => stripQuotes(t)).join(" ");
2249
+ restStartIdx = prefixEnd;
2250
+ } else {
2251
+ name = tokens.slice(0, prefixEnd).map((t) => stripQuotes(t)).join(" ");
2252
+ restStartIdx = prefixEnd;
2253
+ }
2254
+ } else if (tokens[0][0] === '"' || tokens[0][0] === "'") {
2255
+ if (tokens.length > 1 && isAliasToken(tokens[1]) && !isColorWord(tokens[1])) {
2229
2256
  alias = tokens[1];
2230
2257
  legacyForm = "bare-shorthand";
2231
2258
  restStartIdx = 2;
2232
2259
  }
2233
- } else if (valueStart > 1 && isAliasToken(tokens[valueStart - 1])) {
2260
+ } else if (valueStart > 1 && isAliasToken(tokens[valueStart - 1]) && !isColorWord(tokens[valueStart - 1])) {
2234
2261
  alias = tokens[valueStart - 1];
2235
2262
  legacyForm = "bare-shorthand";
2236
2263
  name = tokens.slice(0, valueStart - 1).map((t) => stripQuotes(t)).join(" ");
@@ -2245,10 +2272,13 @@ function parseTagDeclaration(line12) {
2245
2272
  inlineValues = valueStr.split(",").map((v) => v.trim()).filter(Boolean);
2246
2273
  }
2247
2274
  if (!inlineValues || inlineValues.length === 0) {
2248
- const colorMatch = name.match(/\(([^)]+)\)\s*$/);
2249
- if (colorMatch) {
2250
- colorHint = colorMatch[1];
2251
- name = name.substring(0, colorMatch.index).trim();
2275
+ const lastSpaceIdx = name.lastIndexOf(" ");
2276
+ if (lastSpaceIdx > 0) {
2277
+ const trailing = name.substring(lastSpaceIdx + 1);
2278
+ if (RECOGNIZED_COLOR_NAMES.includes(trailing)) {
2279
+ colorHint = trailing;
2280
+ name = name.substring(0, lastSpaceIdx).trimEnd();
2281
+ }
2252
2282
  }
2253
2283
  }
2254
2284
  return {
@@ -2376,6 +2406,7 @@ var init_tag_groups = __esm({
2376
2406
  "use strict";
2377
2407
  init_parsing();
2378
2408
  init_diagnostics();
2409
+ init_colors();
2379
2410
  TAG_BLOCK_NOCOLON_RE = /^tag\s+/i;
2380
2411
  VALID_TAG_IDENT_RE = /^[A-Za-z_][A-Za-z0-9_-]*$/;
2381
2412
  }
@@ -2649,7 +2680,7 @@ function buildControlsGroupLayout(config, state) {
2649
2680
  }
2650
2681
  function computeLegendLayout(config, state, containerWidth) {
2651
2682
  const { groups, controls: configControls, mode } = config;
2652
- const isExport = mode === "inline";
2683
+ const isExport = mode === "export";
2653
2684
  const activeGroupName = state.activeGroup?.toLowerCase() ?? null;
2654
2685
  if (isExport && !activeGroupName) {
2655
2686
  return {
@@ -2939,7 +2970,10 @@ function renderLegendD3(container, config, state, palette, isDark, callbacks, co
2939
2970
  const width = containerWidth ?? parseFloat(container.attr("width") || "800");
2940
2971
  let currentState = { ...state };
2941
2972
  let currentLayout;
2942
- const legendG = container.append("g").attr("class", "dgmo-legend");
2973
+ const legendG = container.append("g").attr("class", "dgmo-legend").attr("data-legend-title-relation", config.position.titleRelation).attr(
2974
+ "data-legend-capsule-addon-width",
2975
+ String(config.capsulePillAddonWidth ?? 0)
2976
+ );
2943
2977
  function render2() {
2944
2978
  currentLayout = computeLegendLayout(config, currentState, width);
2945
2979
  legendG.selectAll("*").remove();
@@ -3190,81 +3224,7 @@ var init_participant_inference = __esm({
3190
3224
  // Names that would incorrectly match general patterns in later groups
3191
3225
  { pattern: /^KeyDB$/i, type: "cache" },
3192
3226
  // not database (DB$ suffix)
3193
- { pattern: /Webhook/i, type: "external" },
3194
- // not frontend (Web contains)
3195
- { pattern: /^Upstream$/i, type: "external" },
3196
- // not queue (Stream$ suffix)
3197
- { pattern: /^Downstream$/i, type: "external" },
3198
- // not queue (Stream$ suffix)
3199
- // ── 1. Infrastructure overrides ─────────────────────────
3200
- // These names end in -er/-or but are NOT actors
3201
- { pattern: /^.*Router$/i, type: "networking" },
3202
- { pattern: /^.*Scheduler$/i, type: "service" },
3203
- { pattern: /^.*Dispatcher$/i, type: "service" },
3204
- { pattern: /^.*Balancer$/i, type: "networking" },
3205
- { pattern: /^.*Controller$/i, type: "service" },
3206
- { pattern: /^.*Handler$/i, type: "service" },
3207
- { pattern: /^.*Processor$/i, type: "service" },
3208
- { pattern: /^.*Connector$/i, type: "service" },
3209
- { pattern: /^.*Adapter$/i, type: "service" },
3210
- { pattern: /^.*Provider$/i, type: "service" },
3211
- { pattern: /^.*Manager$/i, type: "service" },
3212
- { pattern: /^.*Orchestrator$/i, type: "service" },
3213
- { pattern: /^.*Monitor$/i, type: "service" },
3214
- { pattern: /^.*Resolver$/i, type: "service" },
3215
- { pattern: /^.*Logger$/i, type: "service" },
3216
- { pattern: /^.*Server$/i, type: "service" },
3217
- { pattern: /^.*Broker$/i, type: "queue" },
3218
- { pattern: /^.*Worker$/i, type: "service" },
3219
- { pattern: /^.*Consumer$/i, type: "service" },
3220
- { pattern: /^.*Producer$/i, type: "service" },
3221
- { pattern: /^.*Publisher$/i, type: "service" },
3222
- { pattern: /^.*Subscriber$/i, type: "service" },
3223
- { pattern: /^.*Listener$/i, type: "service" },
3224
- // New -er/-or suffixes that are services, not actors
3225
- { pattern: /^.*Watcher$/i, type: "service" },
3226
- { pattern: /^.*Executor$/i, type: "service" },
3227
- { pattern: /^.*Aggregator$/i, type: "service" },
3228
- { pattern: /^.*Collector$/i, type: "service" },
3229
- { pattern: /^.*Transformer$/i, type: "service" },
3230
- { pattern: /^.*Validator$/i, type: "service" },
3231
- { pattern: /^.*Generator$/i, type: "service" },
3232
- { pattern: /^.*Indexer$/i, type: "service" },
3233
- { pattern: /^.*Crawler$/i, type: "service" },
3234
- { pattern: /^.*Scanner$/i, type: "service" },
3235
- { pattern: /^.*Parser$/i, type: "service" },
3236
- { pattern: /^.*Emitter$/i, type: "service" },
3237
- { pattern: /^.*Exporter$/i, type: "service" },
3238
- { pattern: /^.*Importer$/i, type: "service" },
3239
- { pattern: /^.*Loader$/i, type: "service" },
3240
- { pattern: /^.*Renderer$/i, type: "service" },
3241
- { pattern: /^.*Checker$/i, type: "service" },
3242
- { pattern: /^.*Inspector$/i, type: "service" },
3243
- { pattern: /^.*Encoder$/i, type: "service" },
3244
- { pattern: /^.*Decoder$/i, type: "service" },
3245
- { pattern: /^.*Notifier$/i, type: "service" },
3246
- // ── 2. Networking patterns ──────────────────────────────
3247
- { pattern: /Gateway/i, type: "networking" },
3248
- { pattern: /GW$/i, type: "networking" },
3249
- { pattern: /Proxy/i, type: "networking" },
3250
- { pattern: /LB$/i, type: "networking" },
3251
- { pattern: /LoadBalancer/i, type: "networking" },
3252
- { pattern: /CDN/i, type: "networking" },
3253
- { pattern: /Firewall/i, type: "networking" },
3254
- { pattern: /WAF$/i, type: "networking" },
3255
- { pattern: /DNS/i, type: "networking" },
3256
- { pattern: /Ingress/i, type: "networking" },
3257
- // Named products & patterns
3258
- { pattern: /Nginx/i, type: "networking" },
3259
- { pattern: /Traefik/i, type: "networking" },
3260
- { pattern: /Envoy/i, type: "networking" },
3261
- { pattern: /Istio/i, type: "networking" },
3262
- { pattern: /Kong/i, type: "networking" },
3263
- { pattern: /Akamai/i, type: "networking" },
3264
- { pattern: /Cloudflare/i, type: "networking" },
3265
- { pattern: /Mesh$/i, type: "networking" },
3266
- { pattern: /ServiceMesh/i, type: "networking" },
3267
- // ── 3. Database patterns ────────────────────────────────
3227
+ // ── 1. Database patterns ────────────────────────────────
3268
3228
  { pattern: /DB$/i, type: "database" },
3269
3229
  { pattern: /Database/i, type: "database" },
3270
3230
  { pattern: /Datastore/i, type: "database" },
@@ -3298,16 +3258,15 @@ var init_participant_inference = __esm({
3298
3258
  { pattern: /Milvus/i, type: "database" },
3299
3259
  { pattern: /Presto/i, type: "database" },
3300
3260
  { pattern: /Table$/i, type: "database" },
3301
- // ── 4. Cache patterns ──────────────────────────────────
3261
+ // ── 2. Cache patterns ──────────────────────────────────
3302
3262
  { pattern: /Cache/i, type: "cache" },
3303
3263
  { pattern: /Redis/i, type: "cache" },
3304
3264
  { pattern: /Memcache/i, type: "cache" },
3305
- // CDN already matched by networking above
3306
3265
  // Named products
3307
3266
  { pattern: /Dragonfly/i, type: "cache" },
3308
3267
  { pattern: /Hazelcast/i, type: "cache" },
3309
3268
  { pattern: /Valkey/i, type: "cache" },
3310
- // ── 5. Queue/Messaging patterns ─────────────────────────
3269
+ // ── 3. Queue/Messaging patterns ─────────────────────────
3311
3270
  { pattern: /Queue/i, type: "queue" },
3312
3271
  { pattern: /MQ$/i, type: "queue" },
3313
3272
  { pattern: /SQS/i, type: "queue" },
@@ -3320,6 +3279,7 @@ var init_participant_inference = __esm({
3320
3279
  { pattern: /Stream$/i, type: "queue" },
3321
3280
  { pattern: /SNS/i, type: "queue" },
3322
3281
  { pattern: /PubSub/i, type: "queue" },
3282
+ { pattern: /Broker$/i, type: "queue" },
3323
3283
  // Named products & patterns
3324
3284
  { pattern: /NATS/i, type: "queue" },
3325
3285
  { pattern: /Pulsar/i, type: "queue" },
@@ -3330,7 +3290,7 @@ var init_participant_inference = __esm({
3330
3290
  { pattern: /Sidekiq/i, type: "queue" },
3331
3291
  { pattern: /EventHub/i, type: "queue" },
3332
3292
  { pattern: /Channel$/i, type: "queue" },
3333
- // ── 6. Actor patterns ──────────────────────────────────
3293
+ // ── 4. Actor patterns ──────────────────────────────────
3334
3294
  // Exact matches first
3335
3295
  { pattern: /^Admin$/i, type: "actor" },
3336
3296
  { pattern: /^User$/i, type: "actor" },
@@ -3349,98 +3309,11 @@ var init_participant_inference = __esm({
3349
3309
  { pattern: /^Fan$/i, type: "actor" },
3350
3310
  { pattern: /^Purchaser$/i, type: "actor" },
3351
3311
  { pattern: /^Reviewer$/i, type: "actor" },
3352
- // Suffix rules (after infrastructure overrides filtered above)
3312
+ // Suffix rules
3353
3313
  { pattern: /User$/i, type: "actor" },
3354
3314
  { pattern: /Actor$/i, type: "actor" },
3355
3315
  { pattern: /Analyst$/i, type: "actor" },
3356
- { pattern: /Staff$/i, type: "actor" },
3357
- // ── 7. Frontend patterns ────────────────────────────────
3358
- { pattern: /App$/i, type: "frontend" },
3359
- { pattern: /Application/i, type: "frontend" },
3360
- { pattern: /Mobile/i, type: "frontend" },
3361
- { pattern: /iOS/i, type: "frontend" },
3362
- { pattern: /Android/i, type: "frontend" },
3363
- { pattern: /Web/i, type: "frontend" },
3364
- { pattern: /Browser/i, type: "frontend" },
3365
- { pattern: /Frontend/i, type: "frontend" },
3366
- { pattern: /UI$/i, type: "frontend" },
3367
- { pattern: /Dashboard/i, type: "frontend" },
3368
- { pattern: /CLI$/i, type: "frontend" },
3369
- { pattern: /Terminal/i, type: "frontend" },
3370
- // Frameworks & patterns
3371
- { pattern: /React/i, type: "frontend" },
3372
- { pattern: /^Vue$/i, type: "frontend" },
3373
- { pattern: /Angular/i, type: "frontend" },
3374
- { pattern: /Svelte/i, type: "frontend" },
3375
- { pattern: /NextJS/i, type: "frontend" },
3376
- { pattern: /Nuxt/i, type: "frontend" },
3377
- { pattern: /Remix/i, type: "frontend" },
3378
- { pattern: /Electron/i, type: "frontend" },
3379
- { pattern: /Tauri/i, type: "frontend" },
3380
- { pattern: /Widget$/i, type: "frontend" },
3381
- { pattern: /Portal/i, type: "frontend" },
3382
- { pattern: /Console$/i, type: "frontend" },
3383
- { pattern: /^SPA$/i, type: "frontend" },
3384
- { pattern: /^PWA$/i, type: "frontend" },
3385
- // ── 8. Service patterns ─────────────────────────────────
3386
- { pattern: /Service/i, type: "service" },
3387
- { pattern: /Svc$/i, type: "service" },
3388
- { pattern: /API$/i, type: "service" },
3389
- { pattern: /Lambda/i, type: "service" },
3390
- { pattern: /Function$/i, type: "service" },
3391
- { pattern: /Fn$/i, type: "service" },
3392
- { pattern: /Job$/i, type: "service" },
3393
- { pattern: /Cron/i, type: "service" },
3394
- { pattern: /Microservice/i, type: "service" },
3395
- // Auth
3396
- { pattern: /^Auth$/i, type: "service" },
3397
- { pattern: /^AuthN$/i, type: "service" },
3398
- { pattern: /^AuthZ$/i, type: "service" },
3399
- { pattern: /^SSO$/i, type: "service" },
3400
- { pattern: /OAuth/i, type: "service" },
3401
- { pattern: /^OIDC$/i, type: "service" },
3402
- // SaaS
3403
- { pattern: /Stripe/i, type: "service" },
3404
- { pattern: /Twilio/i, type: "service" },
3405
- { pattern: /SendGrid/i, type: "service" },
3406
- { pattern: /Mailgun/i, type: "service" },
3407
- // Cloud/infra
3408
- { pattern: /^S3$/i, type: "service" },
3409
- { pattern: /^Blob$/i, type: "service" },
3410
- { pattern: /Vercel/i, type: "service" },
3411
- { pattern: /Netlify/i, type: "service" },
3412
- { pattern: /Heroku/i, type: "service" },
3413
- { pattern: /Docker/i, type: "service" },
3414
- { pattern: /Kubernetes/i, type: "service" },
3415
- { pattern: /K8s/i, type: "service" },
3416
- { pattern: /Terraform/i, type: "service" },
3417
- // Security
3418
- { pattern: /Vault/i, type: "service" },
3419
- { pattern: /^HSM$/i, type: "service" },
3420
- { pattern: /KMS/i, type: "service" },
3421
- { pattern: /^IAM$/i, type: "service" },
3422
- // AI/ML
3423
- { pattern: /^LLM$/i, type: "service" },
3424
- { pattern: /GPT/i, type: "service" },
3425
- { pattern: /^Claude$/i, type: "service" },
3426
- { pattern: /Embedding/i, type: "service" },
3427
- { pattern: /Inference/i, type: "service" },
3428
- // Suffixes & patterns
3429
- { pattern: /Pipeline$/i, type: "service" },
3430
- { pattern: /Registry/i, type: "service" },
3431
- { pattern: /Engine$/i, type: "service" },
3432
- { pattern: /Daemon/i, type: "service" },
3433
- // ── 9. External patterns ────────────────────────────────
3434
- { pattern: /External/i, type: "external" },
3435
- { pattern: /Ext$/i, type: "external" },
3436
- { pattern: /ThirdParty/i, type: "external" },
3437
- { pattern: /3P$/i, type: "external" },
3438
- { pattern: /Vendor/i, type: "external" },
3439
- // Named products & patterns
3440
- { pattern: /Callback/i, type: "external" },
3441
- { pattern: /^AWS$/i, type: "external" },
3442
- { pattern: /^GCP$/i, type: "external" },
3443
- { pattern: /Azure/i, type: "external" }
3316
+ { pattern: /Staff$/i, type: "actor" }
3444
3317
  ];
3445
3318
  RULE_COUNT = PARTICIPANT_RULES.length;
3446
3319
  }
@@ -3668,7 +3541,7 @@ function parseSequenceDgmo(content) {
3668
3541
  const pushWarning = (line12, message) => {
3669
3542
  result.diagnostics.push(makeDgmoError(line12, message, "warning"));
3670
3543
  };
3671
- if (!content || !content.trim()) {
3544
+ if (!content?.trim()) {
3672
3545
  return fail(0, "Empty content");
3673
3546
  }
3674
3547
  const lines = content.split("\n");
@@ -3679,7 +3552,7 @@ function parseSequenceDgmo(content) {
3679
3552
  const fl = lines[fi].trim();
3680
3553
  if (!fl || fl.startsWith("//")) continue;
3681
3554
  const parsed = parseFirstLine(fl);
3682
- if (parsed && parsed.chartType === "sequence") {
3555
+ if (parsed?.chartType === "sequence") {
3683
3556
  hasExplicitChart = true;
3684
3557
  firstLineIndex = fi;
3685
3558
  if (parsed.title) {
@@ -3798,7 +3671,7 @@ function parseSequenceDgmo(content) {
3798
3671
  if (groupColor) {
3799
3672
  pushWarning(
3800
3673
  lineNumber,
3801
- `(${groupColor}) color syntax removed from sequence diagrams \u2014 use 'tag:' groups for coloring`
3674
+ `'(${groupColor})' parens-color syntax removed from sequence diagrams \u2014 use 'tag:' groups for coloring`
3802
3675
  );
3803
3676
  }
3804
3677
  contentStarted = true;
@@ -3878,7 +3751,7 @@ function parseSequenceDgmo(content) {
3878
3751
  if (!color) {
3879
3752
  pushError(
3880
3753
  lineNumber,
3881
- `Expected 'Value(color)' in tag group '${currentTagGroup.name}'`
3754
+ `Expected 'Value color' in tag group '${currentTagGroup.name}'`
3882
3755
  );
3883
3756
  continue;
3884
3757
  }
@@ -3902,11 +3775,13 @@ function parseSequenceDgmo(content) {
3902
3775
  blockStack.pop();
3903
3776
  }
3904
3777
  const labelRaw = sectionMatch[1].trim();
3905
- const colorMatch = labelRaw.match(/^(.+?)\(([^)]+)\)$/);
3778
+ const colorMatch = labelRaw.match(
3779
+ /^(.+?)\((red|orange|yellow|green|blue|purple|teal|cyan|gray|black|white)\)$/
3780
+ );
3906
3781
  if (colorMatch) {
3907
3782
  pushWarning(
3908
3783
  lineNumber,
3909
- `(${colorMatch[2].trim()}) color syntax removed from sequence diagrams \u2014 use 'tag:' groups for coloring`
3784
+ `'(${colorMatch[2]})' parens-color syntax removed from sequence diagrams \u2014 use 'tag:' groups for coloring`
3910
3785
  );
3911
3786
  }
3912
3787
  contentStarted = true;
@@ -3992,6 +3867,17 @@ function parseSequenceDgmo(content) {
3992
3867
  const id = isAMatch[1];
3993
3868
  const typeStr = isAMatch[2].toLowerCase();
3994
3869
  let remainder = isAMatch[3]?.trim() || "";
3870
+ if (REMOVED_PARTICIPANT_TYPES.has(typeStr)) {
3871
+ result.diagnostics.push(
3872
+ makeDgmoError(
3873
+ lineNumber,
3874
+ participantTypeRemovedMessage(typeStr),
3875
+ "error",
3876
+ NAME_DIAGNOSTIC_CODES.PARTICIPANT_TYPE_REMOVED
3877
+ )
3878
+ );
3879
+ continue;
3880
+ }
3995
3881
  const participantType = VALID_PARTICIPANT_TYPES.has(
3996
3882
  typeStr
3997
3883
  ) ? typeStr : "default";
@@ -4061,7 +3947,7 @@ function parseSequenceDgmo(content) {
4061
3947
  const color = coloredMatch[2].trim();
4062
3948
  pushError(
4063
3949
  lineNumber,
4064
- `'${id}(${color})' syntax is no longer supported \u2014 use 'tag:' groups for coloring`
3950
+ `'${id}(${color})' parens-color syntax is no longer supported \u2014 use 'tag:' groups for coloring`
4065
3951
  );
4066
3952
  contentStarted = true;
4067
3953
  const key = addParticipant(id, lineNumber, { metadata: colorMeta });
@@ -4292,6 +4178,25 @@ function parseSequenceDgmo(content) {
4292
4178
  }
4293
4179
  continue;
4294
4180
  }
4181
+ const elifMatch = trimmed.match(/^elif\b\s*(.*)$/i);
4182
+ if (elifMatch) {
4183
+ const tailRaw = elifMatch[1].trim();
4184
+ const tail = tailRaw ? " " + tailRaw : "";
4185
+ pushError(
4186
+ lineNumber,
4187
+ `'elif' is not a keyword. Did you mean 'else if${tail}'?`
4188
+ );
4189
+ continue;
4190
+ }
4191
+ const elseLabelMatch = trimmed.match(/^else\s+(.+)$/i);
4192
+ if (elseLabelMatch) {
4193
+ const tail = elseLabelMatch[1].trim();
4194
+ pushError(
4195
+ lineNumber,
4196
+ `'else' does not take a label. Did you mean 'else if ${tail}'?`
4197
+ );
4198
+ continue;
4199
+ }
4295
4200
  {
4296
4201
  const noteParsed = parseNoteLine(
4297
4202
  trimmed,
@@ -4415,7 +4320,7 @@ function looksLikeSequence(content) {
4415
4320
  return ARROW_PATTERN.test(trimmed);
4416
4321
  });
4417
4322
  }
4418
- var KNOWN_SEQ_OPTIONS, KNOWN_SEQ_BOOLEANS, VALID_PARTICIPANT_TYPES, IS_A_PATTERN, POSITION_ONLY_PATTERN, COLORED_PARTICIPANT_PATTERN, GROUP_HEADING_PATTERN, GROUP_HEADING_FALLBACK, LEGACY_GROUP_PATTERN, SECTION_PATTERN, ARROW_PATTERN, NOTE_BARE, NOTE_MULTI;
4323
+ var KNOWN_SEQ_OPTIONS, KNOWN_SEQ_BOOLEANS, VALID_PARTICIPANT_TYPES, REMOVED_PARTICIPANT_TYPES, IS_A_PATTERN, POSITION_ONLY_PATTERN, COLORED_PARTICIPANT_PATTERN, GROUP_HEADING_PATTERN, GROUP_HEADING_FALLBACK, LEGACY_GROUP_PATTERN, SECTION_PATTERN, ARROW_PATTERN, NOTE_BARE, NOTE_MULTI;
4419
4324
  var init_parser = __esm({
4420
4325
  "src/sequence/parser.ts"() {
4421
4326
  "use strict";
@@ -4428,19 +4333,21 @@ var init_parser = __esm({
4428
4333
  KNOWN_SEQ_OPTIONS = /* @__PURE__ */ new Set(["active-tag"]);
4429
4334
  KNOWN_SEQ_BOOLEANS = /* @__PURE__ */ new Set(["activations", "solid-fill", "no-title"]);
4430
4335
  VALID_PARTICIPANT_TYPES = /* @__PURE__ */ new Set([
4431
- "service",
4432
4336
  "database",
4433
4337
  "actor",
4434
4338
  "queue",
4435
- "cache",
4436
- "gateway",
4437
- "external",
4339
+ "cache"
4340
+ ]);
4341
+ REMOVED_PARTICIPANT_TYPES = /* @__PURE__ */ new Set([
4342
+ "service",
4343
+ "frontend",
4438
4344
  "networking",
4439
- "frontend"
4345
+ "gateway",
4346
+ "external"
4440
4347
  ]);
4441
4348
  IS_A_PATTERN = /^([^:]+?)\s+is\s+an?\s+(\w+)(?:\s+(.+))?$/i;
4442
4349
  POSITION_ONLY_PATTERN = /^([^:]+?)\s+position\s+(-?\d+)$/i;
4443
- COLORED_PARTICIPANT_PATTERN = /^(\S+?)\(([^)]+)\)\s*$/;
4350
+ COLORED_PARTICIPANT_PATTERN = /^(\S+?)\((red|orange|yellow|green|blue|purple|teal|cyan|gray|black|white)\)\s*$/;
4444
4351
  GROUP_HEADING_PATTERN = /^\[([^\]|]+?)(?:\(([^)]+)\))?\]\s*(.*)$/;
4445
4352
  GROUP_HEADING_FALLBACK = /^\[([^\]]+)\]\s*(.*)$/;
4446
4353
  LEGACY_GROUP_PATTERN = /^##\s+(.+?)(?:\(([^)]+)\))?\s*$/;
@@ -4509,7 +4416,6 @@ function splitArrows(line12) {
4509
4416
  const arrowEnd = idx + 2;
4510
4417
  let arrowStart;
4511
4418
  let label;
4512
- let color;
4513
4419
  let openingStart = -1;
4514
4420
  for (let i = scanFloor; i < runStart; i++) {
4515
4421
  if (line12[i] !== "-") continue;
@@ -4522,21 +4428,13 @@ function splitArrows(line12) {
4522
4428
  if (openingStart !== -1) {
4523
4429
  let openingEnd = openingStart;
4524
4430
  while (openingEnd < runStart && line12[openingEnd] === "-") openingEnd++;
4525
- const arrowContent = line12.substring(openingEnd, runStart);
4526
- const colorMatch = arrowContent.match(/\(([^)]+)\)\s*$/);
4527
- if (colorMatch) {
4528
- color = colorMatch[1].trim();
4529
- const labelPart = arrowContent.substring(0, colorMatch.index).trim();
4530
- if (labelPart) label = labelPart;
4531
- } else {
4532
- const labelPart = arrowContent.trim();
4533
- if (labelPart) label = labelPart;
4534
- }
4431
+ const labelPart = line12.substring(openingEnd, runStart).trim();
4432
+ if (labelPart) label = labelPart;
4535
4433
  arrowStart = openingStart;
4536
4434
  } else {
4537
4435
  arrowStart = runStart;
4538
4436
  }
4539
- arrowPositions.push({ start: arrowStart, end: arrowEnd, label, color });
4437
+ arrowPositions.push({ start: arrowStart, end: arrowEnd, label });
4540
4438
  searchFrom = arrowEnd;
4541
4439
  scanFloor = arrowEnd;
4542
4440
  }
@@ -4550,11 +4448,7 @@ function splitArrows(line12) {
4550
4448
  if (beforeText || i === 0) {
4551
4449
  segments.push(beforeText);
4552
4450
  }
4553
- let arrowToken = "->";
4554
- if (arrow.label && arrow.color)
4555
- arrowToken = `-${arrow.label}(${arrow.color})->`;
4556
- else if (arrow.label) arrowToken = `-${arrow.label}->`;
4557
- else if (arrow.color) arrowToken = `-(${arrow.color})->`;
4451
+ const arrowToken = arrow.label ? `-${arrow.label}->` : "->";
4558
4452
  segments.push(arrowToken);
4559
4453
  lastIndex = arrow.end;
4560
4454
  }
@@ -4564,45 +4458,14 @@ function splitArrows(line12) {
4564
4458
  }
4565
4459
  return segments;
4566
4460
  }
4567
- function parseArrowToken(token, palette, lineNumber, diagnostics) {
4461
+ function parseArrowToken(token, _palette, lineNumber, diagnostics) {
4568
4462
  if (token === "->") return {};
4569
- const bareParen = token.match(/^-(\([A-Za-z]+\))->$/);
4570
- if (bareParen) {
4571
- const colorName = matchColorParens(bareParen[1]);
4572
- if (colorName) {
4573
- return {
4574
- color: resolveColorWithDiagnostic(
4575
- colorName,
4576
- lineNumber,
4577
- diagnostics,
4578
- palette
4579
- )
4580
- };
4581
- }
4582
- }
4583
- const m = token.match(/^-(.+?)(?:\(([^)]+)\))?->$/);
4463
+ const m = token.match(/^-(.+?)->$/);
4584
4464
  if (m) {
4585
4465
  const rawLabel = m[1] ?? "";
4586
4466
  const labelResult = parseInArrowLabel(rawLabel, lineNumber);
4587
4467
  diagnostics.push(...labelResult.diagnostics);
4588
- const label = labelResult.label;
4589
- let color = m[2] ? resolveColorWithDiagnostic(
4590
- m[2].trim(),
4591
- lineNumber,
4592
- diagnostics,
4593
- palette
4594
- ) : void 0;
4595
- if (label && !color) {
4596
- const inferred = inferArrowColor(label);
4597
- if (inferred)
4598
- color = resolveColorWithDiagnostic(
4599
- inferred,
4600
- lineNumber,
4601
- diagnostics,
4602
- palette
4603
- );
4604
- }
4605
- return { label, color };
4468
+ return { label: labelResult.label };
4606
4469
  }
4607
4470
  return {};
4608
4471
  }
@@ -4668,13 +4531,12 @@ function parseFlowchart(content, palette) {
4668
4531
  result.nodes.push(node);
4669
4532
  return node;
4670
4533
  }
4671
- function addEdge(sourceId, targetId, lineNumber, label, color) {
4534
+ function addEdge(sourceId, targetId, lineNumber, label) {
4672
4535
  const edge = {
4673
4536
  source: sourceId,
4674
4537
  target: targetId,
4675
4538
  lineNumber,
4676
- ...label && { label },
4677
- ...color && { color }
4539
+ ...label && { label }
4678
4540
  };
4679
4541
  result.edges.push(edge);
4680
4542
  }
@@ -4740,13 +4602,7 @@ function parseFlowchart(content, palette) {
4740
4602
  if (pendingArrow !== null) {
4741
4603
  const sourceId = lastNodeId ?? implicitSourceId;
4742
4604
  if (sourceId) {
4743
- addEdge(
4744
- sourceId,
4745
- node.id,
4746
- lineNumber,
4747
- pendingArrow.label,
4748
- pendingArrow.color
4749
- );
4605
+ addEdge(sourceId, node.id, lineNumber, pendingArrow.label);
4750
4606
  }
4751
4607
  pendingArrow = null;
4752
4608
  } else if (lastNodeId === null && implicitSourceId === null) {
@@ -4871,7 +4727,6 @@ var NODE_ID_RE;
4871
4727
  var init_flowchart_parser = __esm({
4872
4728
  "src/graph/flowchart-parser.ts"() {
4873
4729
  "use strict";
4874
- init_colors();
4875
4730
  init_diagnostics();
4876
4731
  init_arrows();
4877
4732
  init_parsing();
@@ -4899,7 +4754,6 @@ function splitArrows2(line12) {
4899
4754
  const arrowEnd = idx + 2;
4900
4755
  let arrowStart;
4901
4756
  let label;
4902
- let color;
4903
4757
  let openingStart = -1;
4904
4758
  for (let i = scanFloor; i < runStart; i++) {
4905
4759
  if (line12[i] !== "-") continue;
@@ -4912,21 +4766,13 @@ function splitArrows2(line12) {
4912
4766
  if (openingStart !== -1) {
4913
4767
  let openingEnd = openingStart;
4914
4768
  while (openingEnd < runStart && line12[openingEnd] === "-") openingEnd++;
4915
- const arrowContent = line12.substring(openingEnd, runStart);
4916
- const colorMatch = arrowContent.match(/\(([^)]+)\)\s*$/);
4917
- if (colorMatch) {
4918
- color = colorMatch[1].trim();
4919
- const labelPart = arrowContent.substring(0, colorMatch.index).trim();
4920
- if (labelPart) label = labelPart;
4921
- } else {
4922
- const labelPart = arrowContent.trim();
4923
- if (labelPart) label = labelPart;
4924
- }
4769
+ const labelPart = line12.substring(openingEnd, runStart).trim();
4770
+ if (labelPart) label = labelPart;
4925
4771
  arrowStart = openingStart;
4926
4772
  } else {
4927
4773
  arrowStart = runStart;
4928
4774
  }
4929
- arrowPositions.push({ start: arrowStart, end: arrowEnd, label, color });
4775
+ arrowPositions.push({ start: arrowStart, end: arrowEnd, label });
4930
4776
  searchFrom = arrowEnd;
4931
4777
  scanFloor = arrowEnd;
4932
4778
  }
@@ -4936,11 +4782,7 @@ function splitArrows2(line12) {
4936
4782
  const arrow = arrowPositions[i];
4937
4783
  const beforeText = line12.substring(lastIndex, arrow.start).trim();
4938
4784
  if (beforeText || i === 0) segments.push(beforeText);
4939
- let arrowToken = "->";
4940
- if (arrow.label && arrow.color)
4941
- arrowToken = `-${arrow.label}(${arrow.color})->`;
4942
- else if (arrow.label) arrowToken = `-${arrow.label}->`;
4943
- else if (arrow.color) arrowToken = `-(${arrow.color})->`;
4785
+ const arrowToken = arrow.label ? `-${arrow.label}->` : "->";
4944
4786
  segments.push(arrowToken);
4945
4787
  lastIndex = arrow.end;
4946
4788
  }
@@ -4948,35 +4790,14 @@ function splitArrows2(line12) {
4948
4790
  if (remaining) segments.push(remaining);
4949
4791
  return segments;
4950
4792
  }
4951
- function parseArrowToken2(token, palette, lineNumber, diagnostics) {
4793
+ function parseArrowToken2(token, _palette, lineNumber, diagnostics) {
4952
4794
  if (token === "->") return {};
4953
- const bareParen = token.match(/^-(\([A-Za-z]+\))->$/);
4954
- if (bareParen) {
4955
- const colorName = matchColorParens(bareParen[1]);
4956
- if (colorName) {
4957
- return {
4958
- color: resolveColorWithDiagnostic(
4959
- colorName,
4960
- lineNumber,
4961
- diagnostics,
4962
- palette
4963
- )
4964
- };
4965
- }
4966
- }
4967
- const m = token.match(/^-(.+?)(?:\(([^)]+)\))?->$/);
4795
+ const m = token.match(/^-(.+?)->$/);
4968
4796
  if (m) {
4969
4797
  const rawLabel = m[1] ?? "";
4970
4798
  const labelResult = parseInArrowLabel(rawLabel, lineNumber);
4971
4799
  diagnostics.push(...labelResult.diagnostics);
4972
- const label = labelResult.label;
4973
- const color = m[2] ? resolveColorWithDiagnostic(
4974
- m[2].trim(),
4975
- lineNumber,
4976
- diagnostics,
4977
- palette
4978
- ) : void 0;
4979
- return { label, color };
4800
+ return { label: labelResult.label };
4980
4801
  }
4981
4802
  return {};
4982
4803
  }
@@ -5067,13 +4888,12 @@ function parseState(content, palette) {
5067
4888
  }
5068
4889
  return node;
5069
4890
  }
5070
- function addEdge(sourceId, targetId, lineNumber, label, color) {
4891
+ function addEdge(sourceId, targetId, lineNumber, label) {
5071
4892
  result.edges.push({
5072
4893
  source: sourceId,
5073
4894
  target: targetId,
5074
4895
  lineNumber,
5075
- ...label && { label },
5076
- ...color && { color }
4896
+ ...label && { label }
5077
4897
  });
5078
4898
  }
5079
4899
  for (let i = 0; i < lines.length; i++) {
@@ -5216,13 +5036,7 @@ function parseState(content, palette) {
5216
5036
  if (pendingArrow !== null) {
5217
5037
  const sourceId = lastNodeId ?? implicitSourceId;
5218
5038
  if (sourceId) {
5219
- addEdge(
5220
- sourceId,
5221
- node.id,
5222
- lineNumber,
5223
- pendingArrow.label,
5224
- pendingArrow.color
5225
- );
5039
+ addEdge(sourceId, node.id, lineNumber, pendingArrow.label);
5226
5040
  }
5227
5041
  pendingArrow = null;
5228
5042
  }
@@ -5275,7 +5089,7 @@ var init_state_parser = __esm({
5275
5089
  init_name_normalize();
5276
5090
  PSEUDOSTATE_ID = "pseudostate:[*]";
5277
5091
  PSEUDOSTATE_LABEL = "[*]";
5278
- GROUP_BRACKET_RE = /^\[([^\]]+)\](?:\(([^)]+)\))?\s*$/;
5092
+ GROUP_BRACKET_RE = /^\[([^\]]+)\](?:\s+(red|orange|yellow|green|blue|purple|teal|cyan|gray|black|white))?\s*$/;
5279
5093
  }
5280
5094
  });
5281
5095
 
@@ -5423,7 +5237,7 @@ function parseClassDiagram(content, palette) {
5423
5237
  if (trimmed.startsWith("//")) continue;
5424
5238
  if (!contentStarted && indent === 0 && i === 0) {
5425
5239
  const firstLine = parseFirstLine(trimmed);
5426
- if (firstLine && firstLine.chartType === "class") {
5240
+ if (firstLine?.chartType === "class") {
5427
5241
  if (firstLine.title) {
5428
5242
  result.title = firstLine.title;
5429
5243
  result.titleLineNumber = lineNumber;
@@ -5654,7 +5468,7 @@ var init_parser2 = __esm({
5654
5468
  init_arrows();
5655
5469
  init_parsing();
5656
5470
  init_name_normalize();
5657
- CLASS_DECL_RE = /^(?:(abstract|interface|enum)\s+)?(?:"([^"]+)"|([A-Z][^":]*?))(?:\s+extends\s+(?:"([^"]+)"|([A-Z][^":]*?)))?(?:\s+implements\s+(?:"([^"]+)"|([A-Z][^":]*?)))?(?:\s+\[(abstract|interface|enum)\])?(?:\s+\(([^)]+)\))?(?:\s+as\s+([A-Za-z][A-Za-z0-9_]{0,11}))?\s*$/;
5471
+ CLASS_DECL_RE = /^(?:(abstract|interface|enum)\s+)?(?:"([^"]+)"|([A-Z][^":]*?))(?:\s+extends\s+(?:"([^"]+)"|([A-Z][^":]*?)))?(?:\s+implements\s+(?:"([^"]+)"|([A-Z][^":]*?)))?(?:\s+\[(abstract|interface|enum)\])?(?:\s+(red|orange|yellow|green|blue|purple|teal|cyan|gray|black|white))?(?:\s+as\s+([A-Za-z][A-Za-z0-9_]{0,11}))?\s*$/;
5658
5472
  INDENT_REL_ARROW_RE = /^(--\|>|\.\.\|>|\*--|o--|\.\.>|->)\s*(?:"([^"]+)"|([A-Za-z][^":]*?))(?:\s+:?\s*(.+))?$/;
5659
5473
  REL_ARROW_RE = /^(?:"([^"]+)"|([A-Z][^":]*?))\s*(--\|>|\.\.\|>|\*--|o--|\.\.>|->)\s*(?:"([^"]+)"|([A-Z][^":]*?))(?:\s+:?\s*(.+))?$/;
5660
5474
  VISIBILITY_RE = /^([+\-#])\s*/;
@@ -5824,7 +5638,7 @@ function parseERDiagram(content, palette) {
5824
5638
  if (trimmed.startsWith("//")) continue;
5825
5639
  if (!firstLineParsed && indent === 0) {
5826
5640
  const firstLineResult = parseFirstLine(trimmed);
5827
- if (firstLineResult && firstLineResult.chartType === "er") {
5641
+ if (firstLineResult?.chartType === "er") {
5828
5642
  firstLineParsed = true;
5829
5643
  if (firstLineResult.title) {
5830
5644
  result.title = firstLineResult.title;
@@ -5861,7 +5675,7 @@ function parseERDiagram(content, palette) {
5861
5675
  result.diagnostics.push(
5862
5676
  makeDgmoError(
5863
5677
  lineNumber,
5864
- `Expected 'Value(color)' in tag group '${currentTagGroup.name}'`,
5678
+ `Expected 'Value color' in tag group '${currentTagGroup.name}'`,
5865
5679
  "warning"
5866
5680
  )
5867
5681
  );
@@ -5973,7 +5787,7 @@ function parseERDiagram(content, palette) {
5973
5787
  if (result.tables.length === 0 && !result.error) {
5974
5788
  const diag = makeDgmoError(
5975
5789
  1,
5976
- 'No tables found. Add table declarations like "users" or "orders (blue)".'
5790
+ 'No tables found. Add table declarations like "users" or "orders blue".'
5977
5791
  );
5978
5792
  result.diagnostics.push(diag);
5979
5793
  result.error = formatDgmoError(diag);
@@ -6059,15 +5873,19 @@ function extractSymbols3(docText) {
6059
5873
  for (const rawLine of docText.split("\n")) {
6060
5874
  const line12 = rawLine.trim();
6061
5875
  if (inMetadata && /^er(\s|$)/i.test(line12)) continue;
6062
- if (inMetadata && OPTION_NOCOLON_RE.test(line12)) continue;
6063
- inMetadata = false;
6064
- if (line12.length === 0) continue;
6065
5876
  if (/^\s/.test(rawLine)) continue;
5877
+ if (line12.length === 0) continue;
6066
5878
  const m = TABLE_DECL_RE.exec(line12);
6067
5879
  if (m) {
6068
5880
  const name = (m[1] ?? m[2] ?? "").trim();
6069
- if (name) entities.push(name);
5881
+ if (name) {
5882
+ inMetadata = false;
5883
+ entities.push(name);
5884
+ continue;
5885
+ }
6070
5886
  }
5887
+ if (inMetadata && OPTION_NOCOLON_RE.test(line12)) continue;
5888
+ inMetadata = false;
6071
5889
  }
6072
5890
  return {
6073
5891
  kind: "er",
@@ -6085,7 +5903,7 @@ var init_parser3 = __esm({
6085
5903
  init_name_normalize();
6086
5904
  init_parsing();
6087
5905
  init_tag_groups();
6088
- TABLE_DECL_RE = /^(?:"([^"]+)"|([a-zA-Z_][^|":(]*?))(?:\s*\(([^)]+)\))?(?:\s*\|(.+))?$/;
5906
+ TABLE_DECL_RE = /^(?:"([^"]+)"|([a-zA-Z_][^|":(]*?))(?:\s+(red|orange|yellow|green|blue|purple|teal|cyan|gray|black|white))?(?:\s*\|(.+))?$/;
6089
5907
  INDENT_REL_RE = /^([1*?])-{1,2}(?:(.+?)-{1,2})?([1*?])\s+(?:"([^"]+)"|([a-zA-Z_][^":]*?))\s*$/;
6090
5908
  CONSTRAINT_MAP = {
6091
5909
  pk: "pk",
@@ -6165,18 +5983,22 @@ function parseChart(content, palette) {
6165
5983
  return fail(lineNumber, msg2);
6166
5984
  }
6167
5985
  }
6168
- const eraMatch = trimmed.match(
6169
- /^era\s+(.+?)\s*->\s*(.+?)(?:\s*\(([^)]+)\))?\s*$/
6170
- );
5986
+ const eraMatch = trimmed.match(/^era\s+(.+?)\s*->\s*(.+?)\s*$/);
6171
5987
  if (eraMatch) {
6172
5988
  const afterArrow = eraMatch[2].trim();
6173
5989
  const spaceIdx2 = afterArrow.indexOf(" ");
6174
5990
  if (spaceIdx2 >= 0) {
5991
+ const lastSpaceIdx = afterArrow.lastIndexOf(" ");
5992
+ const trailing = afterArrow.substring(lastSpaceIdx + 1);
5993
+ const hasColor = RECOGNIZED_COLOR_NAMES.includes(
5994
+ trailing
5995
+ );
5996
+ const labelPart = hasColor ? afterArrow.substring(0, lastSpaceIdx).trimEnd() : afterArrow;
6175
5997
  rawEras.push({
6176
5998
  start: eraMatch[1].trim(),
6177
- afterArrow,
6178
- color: eraMatch[3] ? resolveColorWithDiagnostic(
6179
- eraMatch[3].trim(),
5999
+ afterArrow: labelPart,
6000
+ color: hasColor ? resolveColorWithDiagnostic(
6001
+ trailing,
6180
6002
  lineNumber,
6181
6003
  result.diagnostics,
6182
6004
  palette
@@ -6711,11 +6533,12 @@ function parseExtendedChart(content, palette) {
6711
6533
  return result;
6712
6534
  }
6713
6535
  }
6714
- const categoryMatch = trimmed.match(/^\[(.+?)\](?:\s*\(([^)]+)\))?\s*$/);
6536
+ const categoryMatch = trimmed.match(/^\[(.+?)\](?:\s+(\S+))?\s*$/);
6715
6537
  if (categoryMatch) {
6716
6538
  const catName = categoryMatch[1].trim();
6717
- const catColor = categoryMatch[2] ? resolveColorWithDiagnostic(
6718
- categoryMatch[2].trim(),
6539
+ const rawCatColor = categoryMatch[2]?.trim();
6540
+ const catColor = rawCatColor ? resolveColorWithDiagnostic(
6541
+ rawCatColor,
6719
6542
  lineNumber,
6720
6543
  result.diagnostics,
6721
6544
  palette
@@ -6730,7 +6553,7 @@ function parseExtendedChart(content, palette) {
6730
6553
  continue;
6731
6554
  }
6732
6555
  const arrowMatch = trimmed.match(
6733
- /^(.+?)\s*(->|--)\s*(.+?)\s+(-?[\d,_]+(?:\.[\d]+)?)\s*(?:\(([^)]+)\))?\s*$/
6556
+ /^(.+?)\s*(->|--)\s*(.+?)\s+(-?[\d,_]+(?:\.[\d]+)?)(?:\s+(red|orange|yellow|green|blue|purple|teal|cyan|gray|black|white))?\s*$/
6734
6557
  );
6735
6558
  if (arrowMatch) {
6736
6559
  const [, rawSource, arrow, rawTarget, rawVal, rawLinkColor] = arrowMatch;
@@ -6775,11 +6598,14 @@ function parseExtendedChart(content, palette) {
6775
6598
  }
6776
6599
  if (sankeyStack.length > 0) {
6777
6600
  const valColorMatch = trimmed.match(
6778
- /(-?[\d,_]+(?:\.[\d]+)?)\s*\(([^)]+)\)\s*$/
6601
+ /(-?[\d,_]+(?:\.[\d]+)?)\s+(red|orange|yellow|green|blue|purple|teal|cyan|gray|black|white)\s*$/
6779
6602
  );
6780
- const strippedLine = valColorMatch ? trimmed.replace(/\s*\([^)]+\)\s*$/, "") : trimmed;
6603
+ const strippedLine = valColorMatch ? trimmed.replace(
6604
+ /\s+(red|orange|yellow|green|blue|purple|teal|cyan|gray|black|white)\s*$/,
6605
+ ""
6606
+ ) : trimmed;
6781
6607
  const dataRow2 = parseDataRowValues(strippedLine);
6782
- if (dataRow2 && dataRow2.values.length === 1) {
6608
+ if (dataRow2?.values.length === 1) {
6783
6609
  const source = sankeyStack.at(-1).name;
6784
6610
  const linkColor = valColorMatch?.[2] ? resolveColorWithDiagnostic(
6785
6611
  valColorMatch[2].trim(),
@@ -7011,7 +6837,7 @@ function parseExtendedChart(content, palette) {
7011
6837
  }
7012
6838
  }
7013
6839
  const dataRow = parseDataRowValues(trimmed);
7014
- if (dataRow && dataRow.values.length === 1) {
6840
+ if (dataRow?.values.length === 1) {
7015
6841
  const { label: rawLabel, color: pointColor } = extractColor(
7016
6842
  dataRow.label,
7017
6843
  palette
@@ -9055,7 +8881,7 @@ function parseOrg(content, palette) {
9055
8881
  const pushWarning = (line12, message) => {
9056
8882
  result.diagnostics.push(makeDgmoError(line12, message, "warning"));
9057
8883
  };
9058
- if (!content || !content.trim()) {
8884
+ if (!content?.trim()) {
9059
8885
  return fail(0, "No content provided");
9060
8886
  }
9061
8887
  const lines = content.split("\n");
@@ -9153,7 +8979,7 @@ function parseOrg(content, palette) {
9153
8979
  if (!color) {
9154
8980
  pushError(
9155
8981
  lineNumber,
9156
- `Expected 'Value(color)' in tag group '${currentTagGroup.name}'`
8982
+ `Expected 'Value color' in tag group '${currentTagGroup.name}'`
9157
8983
  );
9158
8984
  continue;
9159
8985
  }
@@ -9352,7 +9178,7 @@ function parseKanban(content, palette) {
9352
9178
  const warn = (line12, message) => {
9353
9179
  result.diagnostics.push(makeDgmoError(line12, message, "warning"));
9354
9180
  };
9355
- if (!content || !content.trim()) {
9181
+ if (!content?.trim()) {
9356
9182
  return fail(0, "No content provided");
9357
9183
  }
9358
9184
  const lines = content.split("\n");
@@ -9444,7 +9270,7 @@ function parseKanban(content, palette) {
9444
9270
  if (!color) {
9445
9271
  warn(
9446
9272
  lineNumber,
9447
- `Expected 'Value(color)' in tag group '${currentTagGroup.name}'`
9273
+ `Expected 'Value color' in tag group '${currentTagGroup.name}'`
9448
9274
  );
9449
9275
  continue;
9450
9276
  }
@@ -9487,8 +9313,9 @@ function parseKanban(content, palette) {
9487
9313
  currentCard = null;
9488
9314
  columnCounter++;
9489
9315
  const colName = columnMatch[1].trim();
9490
- const colColor = columnMatch[2] ? resolveColorWithDiagnostic(
9491
- columnMatch[2].trim(),
9316
+ const rawTrailing = columnMatch[2]?.trim();
9317
+ const colColor = rawTrailing ? resolveColorWithDiagnostic(
9318
+ rawTrailing,
9492
9319
  lineNumber,
9493
9320
  result.diagnostics,
9494
9321
  palette
@@ -9643,7 +9470,7 @@ var init_parser5 = __esm({
9643
9470
  init_tag_groups();
9644
9471
  init_parsing();
9645
9472
  init_name_normalize();
9646
- COLUMN_RE = /^\[(.+?)\](?:\s*\(([^)]+)\))?(?:\s+as\s+([A-Za-z][A-Za-z0-9_]{0,11}))?\s*(?:\|\s*(.+))?$/;
9473
+ COLUMN_RE = /^\[(.+?)\](?:\s+(\S+))?(?:\s+as\s+([A-Za-z][A-Za-z0-9_]{0,11}))?\s*(?:\|\s*(.+))?$/;
9647
9474
  LEGACY_COLUMN_RE = /^==\s+(.+?)\s*(?:\[wip:\s*(\d+)\])?\s*==$/;
9648
9475
  KNOWN_OPTIONS4 = /* @__PURE__ */ new Set(["hide", "active-tag"]);
9649
9476
  KNOWN_BOOLEANS3 = /* @__PURE__ */ new Set([
@@ -9740,7 +9567,7 @@ function parseC4(content, palette) {
9740
9567
  result.error = formatDgmoError(diag);
9741
9568
  return result;
9742
9569
  };
9743
- if (!content || !content.trim()) {
9570
+ if (!content?.trim()) {
9744
9571
  return fail(0, "No content provided");
9745
9572
  }
9746
9573
  const lines = content.split("\n");
@@ -9826,7 +9653,7 @@ function parseC4(content, palette) {
9826
9653
  if (!color) {
9827
9654
  pushError(
9828
9655
  lineNumber,
9829
- `Expected 'Value(color)' in tag group '${currentTagGroup.name}'`
9656
+ `Expected 'Value color' in tag group '${currentTagGroup.name}'`
9830
9657
  );
9831
9658
  continue;
9832
9659
  }
@@ -10422,7 +10249,7 @@ __export(parser_exports7, {
10422
10249
  looksLikeSitemap: () => looksLikeSitemap,
10423
10250
  parseSitemap: () => parseSitemap
10424
10251
  });
10425
- function parseArrowLine(trimmed, palette, lineNumber, diagnostics) {
10252
+ function parseArrowLine(trimmed, _palette, _lineNumber, _diagnostics) {
10426
10253
  const bareMatch = trimmed.match(BARE_ARROW_RE);
10427
10254
  if (bareMatch) {
10428
10255
  const rawTarget = bareMatch[1].trim();
@@ -10435,27 +10262,10 @@ function parseArrowLine(trimmed, palette, lineNumber, diagnostics) {
10435
10262
  const arrowMatch = trimmed.match(ARROW_RE);
10436
10263
  if (arrowMatch) {
10437
10264
  const label = arrowMatch[1]?.trim() || void 0;
10438
- let color = arrowMatch[2] ? resolveColorWithDiagnostic(
10439
- arrowMatch[2].trim(),
10440
- lineNumber,
10441
- diagnostics,
10442
- palette
10443
- ) : void 0;
10444
- if (label && !color) {
10445
- const inferred = inferArrowColor(label);
10446
- if (inferred)
10447
- color = resolveColorWithDiagnostic(
10448
- inferred,
10449
- lineNumber,
10450
- diagnostics,
10451
- palette
10452
- );
10453
- }
10454
- const rawTarget = arrowMatch[3].trim();
10265
+ const rawTarget = arrowMatch[2].trim();
10455
10266
  const groupMatch = rawTarget.match(/^\[(.+)\]$/);
10456
10267
  return {
10457
10268
  label,
10458
- color,
10459
10269
  target: groupMatch ? groupMatch[1].trim() : rawTarget,
10460
10270
  targetIsGroup: !!groupMatch
10461
10271
  };
@@ -10508,7 +10318,7 @@ function parseSitemap(content, palette) {
10508
10318
  const pushWarning = (line12, message) => {
10509
10319
  result.diagnostics.push(makeDgmoError(line12, message, "warning"));
10510
10320
  };
10511
- if (!content || !content.trim()) {
10321
+ if (!content?.trim()) {
10512
10322
  return fail(0, "No content provided");
10513
10323
  }
10514
10324
  const lines = content.split("\n");
@@ -10597,7 +10407,7 @@ function parseSitemap(content, palette) {
10597
10407
  if (!color) {
10598
10408
  pushError(
10599
10409
  lineNumber,
10600
- `Expected 'Value(color)' in tag group '${currentTagGroup.name}'`
10410
+ `Expected 'Value color' in tag group '${currentTagGroup.name}'`
10601
10411
  );
10602
10412
  continue;
10603
10413
  }
@@ -10634,7 +10444,6 @@ function parseSitemap(content, palette) {
10634
10444
  targetLabel: arrowInfo.target,
10635
10445
  targetIsGroup: arrowInfo.targetIsGroup,
10636
10446
  label: arrowInfo.label,
10637
- color: arrowInfo.color,
10638
10447
  lineNumber
10639
10448
  });
10640
10449
  }
@@ -10732,7 +10541,6 @@ function parseSitemap(content, palette) {
10732
10541
  sourceId: arrow.sourceNode.id,
10733
10542
  targetId: aliasHit,
10734
10543
  label: arrow.label,
10735
- color: arrow.color,
10736
10544
  lineNumber: arrow.lineNumber
10737
10545
  });
10738
10546
  continue;
@@ -10752,7 +10560,6 @@ function parseSitemap(content, palette) {
10752
10560
  sourceId: arrow.sourceNode.id,
10753
10561
  targetId: targetContainer.id,
10754
10562
  label: arrow.label,
10755
- color: arrow.color,
10756
10563
  lineNumber: arrow.lineNumber
10757
10564
  });
10758
10565
  } else {
@@ -10769,7 +10576,6 @@ function parseSitemap(content, palette) {
10769
10576
  sourceId: arrow.sourceNode.id,
10770
10577
  targetId: targetNode.id,
10771
10578
  label: arrow.label,
10772
- color: arrow.color,
10773
10579
  lineNumber: arrow.lineNumber
10774
10580
  });
10775
10581
  }
@@ -10859,7 +10665,6 @@ var CONTAINER_RE3, METADATA_RE3, ARROW_RE, BARE_ARROW_RE;
10859
10665
  var init_parser7 = __esm({
10860
10666
  "src/sitemap/parser.ts"() {
10861
10667
  "use strict";
10862
- init_colors();
10863
10668
  init_diagnostics();
10864
10669
  init_name_normalize();
10865
10670
  init_tag_groups();
@@ -10867,7 +10672,7 @@ var init_parser7 = __esm({
10867
10672
  init_description_helpers();
10868
10673
  CONTAINER_RE3 = /^\[([^\]]+)\]\s*(?:\|\s*(.+))?$/;
10869
10674
  METADATA_RE3 = /^([^:]+):\s*(.+)$/;
10870
- ARROW_RE = /^-([^(>][^(>]*?)?\s*(?:\(([^)]+)\))?\s*->\s*(.+)$/;
10675
+ ARROW_RE = /^-([^>][^>]*?)?\s*->\s*(.+)$/;
10871
10676
  BARE_ARROW_RE = /^->\s*(.+)$/;
10872
10677
  }
10873
10678
  });
@@ -11158,13 +10963,18 @@ function parseInfra(content) {
11158
10963
  }
11159
10964
  if (currentTagGroup && indent > 0) {
11160
10965
  const { text: cleanEntry, isDefault } = stripDefaultModifier(trimmed);
11161
- const tvMatch = cleanEntry.match(TAG_VALUE_RE);
11162
- if (tvMatch) {
11163
- const valueName = tvMatch[1].trim();
11164
- const rawColor = tvMatch[2]?.trim();
11165
- if (rawColor) {
11166
- resolveColorWithDiagnostic(rawColor, lineNumber, result.diagnostics);
11167
- }
10966
+ const lastSpaceIdx = cleanEntry.lastIndexOf(" ");
10967
+ let valueName = cleanEntry;
10968
+ let rawColor;
10969
+ if (lastSpaceIdx > 0) {
10970
+ const trailing = cleanEntry.substring(lastSpaceIdx + 1);
10971
+ if (isRecognizedColorName(trailing)) {
10972
+ rawColor = trailing;
10973
+ valueName = cleanEntry.substring(0, lastSpaceIdx).trimEnd();
10974
+ }
10975
+ }
10976
+ const tvMatch = valueName.match(TAG_VALUE_RE);
10977
+ if (tvMatch || /^\w+$/.test(valueName)) {
11168
10978
  currentTagGroup.values.push({
11169
10979
  name: valueName,
11170
10980
  color: rawColor
@@ -11576,9 +11386,9 @@ var init_parser8 = __esm({
11576
11386
  "use strict";
11577
11387
  init_diagnostics();
11578
11388
  init_description_helpers();
11579
- init_colors();
11580
11389
  init_arrows();
11581
11390
  init_parsing();
11391
+ init_colors();
11582
11392
  init_name_normalize();
11583
11393
  init_tag_groups();
11584
11394
  init_types();
@@ -11588,7 +11398,7 @@ var init_parser8 = __esm({
11588
11398
  ASYNC_SIMPLE_CONNECTION_RE = /^~>\s*(.+?)\s*$/;
11589
11399
  DEPRECATED_FANOUT_RE = /\bx(\d+)\s*$/;
11590
11400
  GROUP_RE = /^\[([^\]]+)\]\s*(?:as\s+([A-Za-z][A-Za-z0-9_]{0,11})\s*)?(?:\|\s*(.+))?$/;
11591
- TAG_VALUE_RE = /^(\w[\w\s]*?)(?:\(([^)]+)\))?\s*$/;
11401
+ TAG_VALUE_RE = /^(\w[\w\s]+?)\s*$/;
11592
11402
  COMPONENT_RE = /^(?:"([^"]+)"|([a-zA-Z_][^|":]*?))\s*(\|.*)?$/;
11593
11403
  PIPE_META_RE = /[|,]\s*(\w+)\s*:\s*([^|,]+)/g;
11594
11404
  PROPERTY_RE = /^([\w-]+)\s+(.+)$/;
@@ -13025,7 +12835,7 @@ function parsePert(content, parseOpts = {}) {
13025
12835
  if (!color) {
13026
12836
  warn(
13027
12837
  lineNumber,
13028
- `Expected 'Value(color)' in tag group '${currentTagGroup.name}'`
12838
+ `Expected 'Value color' in tag group '${currentTagGroup.name}'`
13029
12839
  );
13030
12840
  continue;
13031
12841
  }
@@ -13048,7 +12858,7 @@ function parsePert(content, parseOpts = {}) {
13048
12858
  if (!color) {
13049
12859
  warn(
13050
12860
  lineNumber,
13051
- `Expected 'Value(color)' in tag group '${currentTagGroup.name}'`
12861
+ `Expected 'Value color' in tag group '${currentTagGroup.name}'`
13052
12862
  );
13053
12863
  continue;
13054
12864
  }
@@ -13192,7 +13002,7 @@ function parsePert(content, parseOpts = {}) {
13192
13002
  const head = trimmed.slice(0, firstSpace).toLowerCase();
13193
13003
  const value = trimmed.slice(firstSpace + 1).trim();
13194
13004
  const hint = NEAR_DIRECTIVE_HINTS.find((h) => h.stem === head);
13195
- if (hint && hint.matches.test(value)) {
13005
+ if (hint?.matches.test(value)) {
13196
13006
  error(
13197
13007
  lineNumber,
13198
13008
  `Unknown directive '${head}'. Did you mean '${hint.canonical}'?`,
@@ -14499,7 +14309,7 @@ function parseMindmap(content, palette) {
14499
14309
  const pushWarning = (line12, message) => {
14500
14310
  result.diagnostics.push(makeDgmoError(line12, message, "warning"));
14501
14311
  };
14502
- if (!content || !content.trim()) {
14312
+ if (!content?.trim()) {
14503
14313
  return fail(0, "No content provided");
14504
14314
  }
14505
14315
  const lines = content.split("\n");
@@ -14597,7 +14407,7 @@ function parseMindmap(content, palette) {
14597
14407
  if (!color) {
14598
14408
  pushError(
14599
14409
  lineNumber,
14600
- `Expected 'Value(color)' in tag group '${currentTagGroup.name}'`
14410
+ `Expected 'Value color' in tag group '${currentTagGroup.name}'`
14601
14411
  );
14602
14412
  continue;
14603
14413
  }
@@ -14670,7 +14480,7 @@ function parseMindmap(content, palette) {
14670
14480
  const diag = makeDgmoError(1, "No nodes found in mindmap");
14671
14481
  result.diagnostics.push(diag);
14672
14482
  result.error = formatDgmoError(diag);
14673
- } else if (titleRoot && titleRoot.children.length === 0 && result.roots.length === 1 && !result.error) {
14483
+ } else if (titleRoot?.children.length === 0 && result.roots.length === 1 && !result.error) {
14674
14484
  }
14675
14485
  return result;
14676
14486
  }
@@ -15129,7 +14939,7 @@ function parseWireframe(content) {
15129
14939
  const indent = measureIndent(line12);
15130
14940
  if (phase === "header") {
15131
14941
  const firstLineResult = parseFirstLine(trimmed);
15132
- if (firstLineResult && firstLineResult.chartType === "wireframe") {
14942
+ if (firstLineResult?.chartType === "wireframe") {
15133
14943
  title = firstLineResult.title || null;
15134
14944
  titleLineNumber = lineNumber;
15135
14945
  continue;
@@ -15183,7 +14993,7 @@ function parseWireframe(content) {
15183
14993
  } else {
15184
14994
  pushWarning(
15185
14995
  lineNumber,
15186
- `Expected 'Value(color)' in tag group '${currentTagGroup.name}'`
14996
+ `Expected 'Value color' in tag group '${currentTagGroup.name}'`
15187
14997
  );
15188
14998
  }
15189
14999
  continue;
@@ -15424,7 +15234,7 @@ function parseTechRadar(content) {
15424
15234
  const warn = (line12, message) => {
15425
15235
  result.diagnostics.push(makeDgmoError(line12, message, "warning"));
15426
15236
  };
15427
- if (!content || !content.trim()) {
15237
+ if (!content?.trim()) {
15428
15238
  return fail(0, "No content provided");
15429
15239
  }
15430
15240
  function isRingName(name) {
@@ -15461,7 +15271,7 @@ function parseTechRadar(content) {
15461
15271
  if (trimmed.startsWith("//")) continue;
15462
15272
  if (!headerParsed) {
15463
15273
  const firstLine = parseFirstLine(trimmed);
15464
- if (firstLine && firstLine.chartType === "tech-radar") {
15274
+ if (firstLine?.chartType === "tech-radar") {
15465
15275
  result.title = firstLine.title ?? "";
15466
15276
  result.titleLineNumber = lineNumber;
15467
15277
  headerParsed = true;
@@ -15753,7 +15563,7 @@ function parseCycle(content) {
15753
15563
  const indent = measureIndent(raw);
15754
15564
  if (!headerParsed) {
15755
15565
  const firstLineResult = parseFirstLine(trimmed);
15756
- if (firstLineResult && firstLineResult.chartType === "cycle") {
15566
+ if (firstLineResult?.chartType === "cycle") {
15757
15567
  result.title = firstLineResult.title ?? "";
15758
15568
  result.titleLineNumber = lineNum;
15759
15569
  headerParsed = true;
@@ -15800,6 +15610,13 @@ function parseCycle(content) {
15800
15610
  warn(lineNum, "Empty node label.");
15801
15611
  continue;
15802
15612
  }
15613
+ if (!metadata["color"]) {
15614
+ const { label: stripped, colorName: shortcutColor } = peelTrailingColorName(label);
15615
+ if (shortcutColor) {
15616
+ metadata["color"] = shortcutColor;
15617
+ label = stripped;
15618
+ }
15619
+ }
15803
15620
  const color = metadata["color"];
15804
15621
  const spanStr = metadata["span"];
15805
15622
  let span = 1;
@@ -15970,7 +15787,7 @@ function parseJourneyMap(content, palette) {
15970
15787
  const warn = (line12, message) => {
15971
15788
  result.diagnostics.push(makeDgmoError(line12, message, "warning"));
15972
15789
  };
15973
- if (!content || !content.trim()) {
15790
+ if (!content?.trim()) {
15974
15791
  return fail(0, "No content provided");
15975
15792
  }
15976
15793
  const lines = content.split("\n");
@@ -16029,8 +15846,12 @@ function parseJourneyMap(content, palette) {
16029
15846
  const key = part.substring(0, colonIdx).trim().toLowerCase();
16030
15847
  const value = part.substring(colonIdx + 1).trim();
16031
15848
  if (key === "color") {
16032
- const resolved = extractColor(`x(${value})`, palette);
16033
- personaColor = resolved.color;
15849
+ personaColor = resolveColorWithDiagnostic(
15850
+ value,
15851
+ lineNumber,
15852
+ result.diagnostics,
15853
+ palette
15854
+ ) ?? void 0;
16034
15855
  }
16035
15856
  }
16036
15857
  }
@@ -16088,7 +15909,7 @@ function parseJourneyMap(content, palette) {
16088
15909
  if (!color) {
16089
15910
  warn(
16090
15911
  lineNumber,
16091
- `Expected 'Value(color)' in tag group '${currentTagGroup.name}'`
15912
+ `Expected 'Value color' in tag group '${currentTagGroup.name}'`
16092
15913
  );
16093
15914
  continue;
16094
15915
  }
@@ -16331,6 +16152,7 @@ var PHASE_RE, SCORE_RE, ANNOTATION_RE, KNOWN_OPTIONS9, KNOWN_BOOLEANS6;
16331
16152
  var init_parser16 = __esm({
16332
16153
  "src/journey-map/parser.ts"() {
16333
16154
  "use strict";
16155
+ init_colors();
16334
16156
  init_diagnostics();
16335
16157
  init_tag_groups();
16336
16158
  init_parsing();
@@ -16385,7 +16207,7 @@ function parsePyramid(content) {
16385
16207
  const indent = measureIndent(raw);
16386
16208
  if (!headerParsed) {
16387
16209
  const firstLineResult = parseFirstLine(trimmed);
16388
- if (firstLineResult && firstLineResult.chartType === "pyramid") {
16210
+ if (firstLineResult?.chartType === "pyramid") {
16389
16211
  result.title = firstLineResult.title ?? "";
16390
16212
  result.titleLineNumber = lineNum;
16391
16213
  headerParsed = true;
@@ -16429,6 +16251,13 @@ function parsePyramid(content) {
16429
16251
  warn(lineNum, "Empty layer label.");
16430
16252
  continue;
16431
16253
  }
16254
+ if (!color) {
16255
+ const { label: stripped, colorName: shortcutColor } = peelTrailingColorName(label);
16256
+ if (shortcutColor) {
16257
+ color = shortcutColor;
16258
+ label = stripped;
16259
+ }
16260
+ }
16432
16261
  currentLayer = {
16433
16262
  label,
16434
16263
  lineNumber: lineNum,
@@ -16512,7 +16341,7 @@ function parseRing(content) {
16512
16341
  const indent = measureIndent(raw);
16513
16342
  if (!headerParsed) {
16514
16343
  const firstLineResult = parseFirstLine(trimmed);
16515
- if (firstLineResult && firstLineResult.chartType === "ring") {
16344
+ if (firstLineResult?.chartType === "ring") {
16516
16345
  result.title = firstLineResult.title ?? "";
16517
16346
  result.titleLineNumber = lineNum;
16518
16347
  headerParsed = true;
@@ -16592,6 +16421,13 @@ function parseRing(content) {
16592
16421
  warn(lineNum, "Empty layer label.");
16593
16422
  continue;
16594
16423
  }
16424
+ if (!color) {
16425
+ const { label: stripped, colorName: shortcutColor } = peelTrailingColorName(label);
16426
+ if (shortcutColor) {
16427
+ color = shortcutColor;
16428
+ label = stripped;
16429
+ }
16430
+ }
16595
16431
  currentLayer = {
16596
16432
  label,
16597
16433
  lineNumber: lineNum,
@@ -16952,7 +16788,7 @@ function parseRaci(content, palette) {
16952
16788
  const errorAt = (line12, message, code) => {
16953
16789
  result.diagnostics.push(makeDgmoError(line12, message, "error", code));
16954
16790
  };
16955
- if (!content || !content.trim()) {
16791
+ if (!content?.trim()) {
16956
16792
  return fail(0, "No content provided");
16957
16793
  }
16958
16794
  const lines = content.split("\n");
@@ -17086,7 +16922,7 @@ function parseRaci(content, palette) {
17086
16922
  if (next.length > 0 && next[0] !== " " && next[0] !== " ") break;
17087
16923
  const stripped = nextTrim.replace(/,\s*$/, "");
17088
16924
  const segments = stripped.split("|").map((s) => s.trim());
17089
- const roleLabel = segments[0] ?? "";
16925
+ let roleLabel = segments[0] ?? "";
17090
16926
  let roleColor;
17091
16927
  if (segments.length > 1) {
17092
16928
  const meta = parsePipeMetadata(segments);
@@ -17099,6 +16935,18 @@ function parseRaci(content, palette) {
17099
16935
  );
17100
16936
  }
17101
16937
  }
16938
+ if (!roleColor) {
16939
+ const { label: stripLabel, colorName: shortcutColor } = peelTrailingColorName(roleLabel);
16940
+ if (shortcutColor) {
16941
+ roleColor = resolveColorWithDiagnostic(
16942
+ shortcutColor,
16943
+ j + 1,
16944
+ result.diagnostics,
16945
+ palette
16946
+ );
16947
+ roleLabel = stripLabel;
16948
+ }
16949
+ }
17102
16950
  if (roleLabel) getOrAddRole(roleLabel, j + 1, roleColor);
17103
16951
  }
17104
16952
  i = j - 1;
@@ -17157,8 +17005,10 @@ function parseRaci(content, palette) {
17157
17005
  continue;
17158
17006
  }
17159
17007
  let phaseColor;
17160
- if (phaseMatch[2]) {
17161
- const meta = parsePipeMetadata(["", phaseMatch[2]]);
17008
+ const trailingToken = phaseMatch[2];
17009
+ const pipeMeta = phaseMatch[3];
17010
+ if (pipeMeta) {
17011
+ const meta = parsePipeMetadata(["", pipeMeta]);
17162
17012
  if (meta["color"]) {
17163
17013
  phaseColor = resolveColorWithDiagnostic(
17164
17014
  meta["color"],
@@ -17168,6 +17018,17 @@ function parseRaci(content, palette) {
17168
17018
  );
17169
17019
  }
17170
17020
  }
17021
+ if (!phaseColor && trailingToken) {
17022
+ const { colorName } = peelTrailingColorName(`x ${trailingToken}`);
17023
+ if (colorName) {
17024
+ phaseColor = resolveColorWithDiagnostic(
17025
+ colorName,
17026
+ lineNumber,
17027
+ result.diagnostics,
17028
+ palette
17029
+ );
17030
+ }
17031
+ }
17171
17032
  currentPhase = {
17172
17033
  id: normalizeName(display),
17173
17034
  displayName: display,
@@ -17248,7 +17109,7 @@ function parseRaci(content, palette) {
17248
17109
  if (roleId === null) continue;
17249
17110
  if (rolesExplicit) {
17250
17111
  const entry = roleStore.get(roleId);
17251
- if (entry && entry.declaredLine === lineNumber) {
17112
+ if (entry?.declaredLine === lineNumber) {
17252
17113
  const candidates = result.roleDisplayNames.filter(
17253
17114
  (n) => n !== entry.displayName
17254
17115
  );
@@ -17398,7 +17259,7 @@ var init_parser19 = __esm({
17398
17259
  "no-title",
17399
17260
  ...Object.keys(VARIANT_LOCK_DIRECTIVES)
17400
17261
  ]);
17401
- PHASE_RE2 = /^\[(.+?)\]\s*(?:\|\s*(.+))?\s*$/;
17262
+ PHASE_RE2 = /^\[(.+?)\](?:\s+(\S+))?(?:\s*\|\s*(.+))?\s*$/;
17402
17263
  ROLE_ASSIGNMENT_RE = /^([^:]+):\s*(.*)$/;
17403
17264
  }
17404
17265
  });
@@ -19115,7 +18976,7 @@ function containerFill(palette, isDark, nodeColor2) {
19115
18976
  function containerStroke(palette, nodeColor2) {
19116
18977
  return nodeColor2 ?? palette.textMuted;
19117
18978
  }
19118
- function renderOrg(container, parsed, layout, palette, isDark, onClickItem, exportDims, activeTagGroup, hiddenAttributes, ancestorPath) {
18979
+ function renderOrg(container, parsed, layout, palette, isDark, onClickItem, exportDims, activeTagGroup, hiddenAttributes, ancestorPath, exportMode) {
19119
18980
  d3Selection.select(container).selectAll(":not([data-d3-tooltip])").remove();
19120
18981
  const width = exportDims?.width ?? container.clientWidth;
19121
18982
  const height = exportDims?.height ?? container.clientHeight;
@@ -19375,7 +19236,7 @@ function renderOrg(container, parsed, layout, palette, isDark, onClickItem, expo
19375
19236
  }
19376
19237
  ],
19377
19238
  position: { placement: "top-center", titleRelation: "below-title" },
19378
- mode: "fixed"
19239
+ mode: exportMode ? "export" : "preview"
19379
19240
  };
19380
19241
  const singleState = { activeGroup: lg.name };
19381
19242
  const groupG = legendParentBase.append("g").attr("transform", `translate(${lg.x}, ${lg.y})`);
@@ -19395,7 +19256,7 @@ function renderOrg(container, parsed, layout, palette, isDark, onClickItem, expo
19395
19256
  const legendConfig = {
19396
19257
  groups,
19397
19258
  position: { placement: "top-center", titleRelation: "below-title" },
19398
- mode: "fixed",
19259
+ mode: exportMode ? "export" : "preview",
19399
19260
  capsulePillAddonWidth: eyeAddonWidth
19400
19261
  };
19401
19262
  const legendState = { activeGroup: activeTagGroup ?? null };
@@ -19862,7 +19723,6 @@ function layoutSitemap(parsed, hiddenCounts, activeTagGroup, hiddenAttributes, e
19862
19723
  targetId: edge.targetId,
19863
19724
  points,
19864
19725
  label: edge.label,
19865
- color: edge.color,
19866
19726
  lineNumber: edge.lineNumber,
19867
19727
  deferred: deferredSet.has(i) || void 0
19868
19728
  });
@@ -20319,7 +20179,7 @@ function containerFill2(palette, isDark, nodeColor2) {
20319
20179
  function containerStroke2(palette, nodeColor2) {
20320
20180
  return nodeColor2 ?? palette.textMuted;
20321
20181
  }
20322
- function renderSitemap(container, parsed, layout, palette, isDark, onClickItem, exportDims, activeTagGroup, hiddenAttributes) {
20182
+ function renderSitemap(container, parsed, layout, palette, isDark, onClickItem, exportDims, activeTagGroup, hiddenAttributes, exportMode) {
20323
20183
  d3Selection2.select(container).selectAll(":not([data-d3-tooltip])").remove();
20324
20184
  const width = exportDims?.width ?? container.clientWidth;
20325
20185
  const height = exportDims?.height ?? container.clientHeight;
@@ -20350,9 +20210,6 @@ function renderSitemap(container, parsed, layout, palette, isDark, onClickItem,
20350
20210
  const defs = svg.append("defs");
20351
20211
  defs.append("marker").attr("id", "sm-arrow").attr("viewBox", `0 0 ${ARROWHEAD_W} ${ARROWHEAD_H}`).attr("refX", ARROWHEAD_W).attr("refY", ARROWHEAD_H / 2).attr("markerWidth", ARROWHEAD_W).attr("markerHeight", ARROWHEAD_H).attr("orient", "auto").append("polygon").attr("points", `0,0 ${ARROWHEAD_W},${ARROWHEAD_H / 2} 0,${ARROWHEAD_H}`).attr("fill", palette.textMuted);
20352
20212
  const edgeColors = /* @__PURE__ */ new Set();
20353
- for (const edge of layout.edges) {
20354
- if (edge.color) edgeColors.add(edge.color);
20355
- }
20356
20213
  for (const color of edgeColors) {
20357
20214
  const id = `sm-arrow-${color.replace("#", "")}`;
20358
20215
  defs.append("marker").attr("id", id).attr("viewBox", `0 0 ${ARROWHEAD_W} ${ARROWHEAD_H}`).attr("refX", ARROWHEAD_W).attr("refY", ARROWHEAD_H / 2).attr("markerWidth", ARROWHEAD_W).attr("markerHeight", ARROWHEAD_H).attr("orient", "auto").append("polygon").attr("points", `0,0 ${ARROWHEAD_W},${ARROWHEAD_H / 2} 0,${ARROWHEAD_H}`).attr("fill", color);
@@ -20431,8 +20288,8 @@ function renderSitemap(container, parsed, layout, palette, isDark, onClickItem,
20431
20288
  for (const edge of layout.edges) {
20432
20289
  if (edge.points.length < 2) continue;
20433
20290
  const edgeG = contentG.append("g").attr("class", "sitemap-edge-group").attr("data-line-number", String(edge.lineNumber));
20434
- const edgeColor3 = edge.color ?? palette.textMuted;
20435
- const markerId = edge.color ? `sm-arrow-${edge.color.replace("#", "")}` : "sm-arrow";
20291
+ const edgeColor3 = palette.textMuted;
20292
+ const markerId = "sm-arrow";
20436
20293
  const gen = edge.deferred ? lineGeneratorLinear : lineGenerator;
20437
20294
  const pathD = gen(edge.points);
20438
20295
  if (pathD) {
@@ -20513,7 +20370,8 @@ function renderSitemap(container, parsed, layout, palette, isDark, onClickItem,
20513
20370
  isDark,
20514
20371
  activeTagGroup,
20515
20372
  void 0,
20516
- hiddenAttributes
20373
+ hiddenAttributes,
20374
+ exportMode
20517
20375
  );
20518
20376
  }
20519
20377
  if (fixedTitle) {
@@ -20538,11 +20396,12 @@ function renderSitemap(container, parsed, layout, palette, isDark, onClickItem,
20538
20396
  isDark,
20539
20397
  activeTagGroup,
20540
20398
  width,
20541
- hiddenAttributes
20399
+ hiddenAttributes,
20400
+ exportMode
20542
20401
  );
20543
20402
  }
20544
20403
  }
20545
- function renderLegend(parent, legendGroups, palette, isDark, activeTagGroup, fixedWidth, hiddenAttributes) {
20404
+ function renderLegend(parent, legendGroups, palette, isDark, activeTagGroup, fixedWidth, hiddenAttributes, exportMode) {
20546
20405
  if (legendGroups.length === 0) return;
20547
20406
  const groups = legendGroups.map((g) => ({
20548
20407
  name: g.name,
@@ -20553,7 +20412,7 @@ function renderLegend(parent, legendGroups, palette, isDark, activeTagGroup, fix
20553
20412
  const legendConfig = {
20554
20413
  groups,
20555
20414
  position: { placement: "top-center", titleRelation: "below-title" },
20556
- mode: "fixed",
20415
+ mode: exportMode ? "export" : "preview",
20557
20416
  capsulePillAddonWidth: eyeAddonWidth
20558
20417
  };
20559
20418
  const legendState = { activeGroup: activeTagGroup ?? null };
@@ -20938,7 +20797,7 @@ function renderKanban(container, parsed, palette, isDark, options) {
20938
20797
  const legendConfig = {
20939
20798
  groups: parsed.tagGroups,
20940
20799
  position: { placement: "top-center", titleRelation: "inline-with-title" },
20941
- mode: exportDims ? "inline" : "fixed"
20800
+ mode: options?.exportMode ? "export" : "preview"
20942
20801
  };
20943
20802
  const legendState = { activeGroup: activeTagGroup ?? null };
20944
20803
  const legendG = svg.append("g").attr("class", "kanban-legend").attr("transform", `translate(${legendX},${legendY})`);
@@ -21096,7 +20955,8 @@ function renderKanbanForExport(content, theme, palette) {
21096
20955
  const layout = computeLayout(parsed, palette);
21097
20956
  const container = document.createElement("div");
21098
20957
  renderKanban(container, parsed, palette, isDark, {
21099
- exportDims: { width: layout.totalWidth, height: layout.totalHeight }
20958
+ exportDims: { width: layout.totalWidth, height: layout.totalHeight },
20959
+ exportMode: true
21100
20960
  });
21101
20961
  const svgEl = container.querySelector("svg");
21102
20962
  return svgEl?.outerHTML ?? "";
@@ -21635,7 +21495,7 @@ function markerIdForType(type) {
21635
21495
  function isSourceMarker(type) {
21636
21496
  return type === "composes" || type === "aggregates";
21637
21497
  }
21638
- function renderClassDiagram(container, parsed, layout, palette, isDark, onClickItem, exportDims, legendActive) {
21498
+ function renderClassDiagram(container, parsed, layout, palette, isDark, onClickItem, exportDims, legendActive, exportMode) {
21639
21499
  d3Selection4.select(container).selectAll(":not([data-d3-tooltip])").remove();
21640
21500
  const width = exportDims?.width ?? container.clientWidth;
21641
21501
  const height = exportDims?.height ?? container.clientHeight;
@@ -21697,7 +21557,7 @@ function renderClassDiagram(container, parsed, layout, palette, isDark, onClickI
21697
21557
  const legendConfig = {
21698
21558
  groups: legendGroups,
21699
21559
  position: { placement: "top-center", titleRelation: "below-title" },
21700
- mode: "fixed"
21560
+ mode: exportMode ? "export" : "preview"
21701
21561
  };
21702
21562
  const legendState = {
21703
21563
  activeGroup: isLegendExpanded ? LEGEND_GROUP_NAME : null
@@ -21837,10 +21697,22 @@ function renderClassDiagramForExport(content, theme, palette) {
21837
21697
  const exportWidth = layout.width + DIAGRAM_PADDING4 * 2;
21838
21698
  const exportHeight = layout.height + DIAGRAM_PADDING4 * 2 + (parsed.title ? 40 : 0) + legendReserve;
21839
21699
  return runInExportContainer(exportWidth, exportHeight, (container) => {
21840
- renderClassDiagram(container, parsed, layout, palette, isDark, void 0, {
21841
- width: exportWidth,
21842
- height: exportHeight
21843
- });
21700
+ renderClassDiagram(
21701
+ container,
21702
+ parsed,
21703
+ layout,
21704
+ palette,
21705
+ isDark,
21706
+ void 0,
21707
+ {
21708
+ width: exportWidth,
21709
+ height: exportHeight
21710
+ },
21711
+ true,
21712
+ // legendActive for export
21713
+ true
21714
+ // exportMode
21715
+ );
21844
21716
  return extractExportSvg(container, theme);
21845
21717
  });
21846
21718
  }
@@ -22316,7 +22188,7 @@ function drawCardinality(g, point, prevPoint, cardinality, color, useLabels) {
22316
22188
  g.append("line").attr("x1", bx + px * spread).attr("y1", by + py * spread).attr("x2", bx - px * spread).attr("y2", by - py * spread).attr("stroke", color).attr("stroke-width", sw);
22317
22189
  }
22318
22190
  }
22319
- function renderERDiagram(container, parsed, layout, palette, isDark, onClickItem, exportDims, activeTagGroup, semanticColorsActive) {
22191
+ function renderERDiagram(container, parsed, layout, palette, isDark, onClickItem, exportDims, activeTagGroup, semanticColorsActive, exportMode) {
22320
22192
  d3Selection5.select(container).selectAll(":not([data-d3-tooltip])").remove();
22321
22193
  const useSemanticColors = parsed.tagGroups.length === 0 && layout.nodes.every((n) => !n.color);
22322
22194
  const LEGEND_FIXED_GAP4 = 8;
@@ -22472,7 +22344,7 @@ function renderERDiagram(container, parsed, layout, palette, isDark, onClickItem
22472
22344
  const legendConfig = {
22473
22345
  groups: parsed.tagGroups,
22474
22346
  position: { placement: "top-center", titleRelation: "below-title" },
22475
- mode: "fixed"
22347
+ mode: exportMode ? "export" : "preview"
22476
22348
  };
22477
22349
  const legendState = { activeGroup: activeTagGroup ?? null };
22478
22350
  const legendG = svg.append("g").attr("class", "er-tag-legend").attr("transform", `translate(0,${legendY})`);
@@ -22508,7 +22380,7 @@ function renderERDiagram(container, parsed, layout, palette, isDark, onClickItem
22508
22380
  const legendConfig = {
22509
22381
  groups: semanticGroups,
22510
22382
  position: { placement: "top-center", titleRelation: "below-title" },
22511
- mode: "fixed"
22383
+ mode: exportMode ? "export" : "preview"
22512
22384
  };
22513
22385
  const legendState = {
22514
22386
  activeGroup: semanticActive ? "Role" : null
@@ -22541,10 +22413,21 @@ function renderERDiagramForExport(content, theme, palette) {
22541
22413
  container.style.left = "-9999px";
22542
22414
  document.body.appendChild(container);
22543
22415
  try {
22544
- renderERDiagram(container, parsed, layout, palette, isDark, void 0, {
22545
- width: exportWidth,
22546
- height: exportHeight
22547
- });
22416
+ renderERDiagram(
22417
+ container,
22418
+ parsed,
22419
+ layout,
22420
+ palette,
22421
+ isDark,
22422
+ void 0,
22423
+ {
22424
+ width: exportWidth,
22425
+ height: exportHeight
22426
+ },
22427
+ void 0,
22428
+ void 0,
22429
+ true
22430
+ );
22548
22431
  const svgEl = container.querySelector("svg");
22549
22432
  if (!svgEl) return "";
22550
22433
  if (theme === "transparent") {
@@ -22779,7 +22662,8 @@ function renderBoxesAndLines(container, parsed, layout, palette, isDark, options
22779
22662
  hideDescriptions,
22780
22663
  controlsExpanded,
22781
22664
  onToggleDescriptions,
22782
- onToggleControlsExpand
22665
+ onToggleControlsExpand,
22666
+ exportMode = false
22783
22667
  } = options ?? {};
22784
22668
  d3Selection6.select(container).selectAll(":not([data-d3-tooltip])").remove();
22785
22669
  const width = exportDims?.width ?? container.clientWidth;
@@ -23115,7 +22999,7 @@ function renderBoxesAndLines(container, parsed, layout, palette, isDark, options
23115
22999
  const legendConfig = {
23116
23000
  groups: parsed.tagGroups,
23117
23001
  position: { placement: "top-center", titleRelation: "below-title" },
23118
- mode: "fixed",
23002
+ mode: exportMode ? "export" : "preview",
23119
23003
  controlsGroup
23120
23004
  };
23121
23005
  const legendState = {
@@ -23147,7 +23031,8 @@ function renderBoxesAndLinesForExport(container, parsed, layout, palette, isDark
23147
23031
  renderBoxesAndLines(container, parsed, layout, palette, isDark, {
23148
23032
  exportDims: options?.exportDims,
23149
23033
  activeTagGroup: options?.activeTagGroup,
23150
- hiddenTagValues: options?.hiddenTagValues
23034
+ hiddenTagValues: options?.hiddenTagValues,
23035
+ exportMode: options?.exportMode
23151
23036
  });
23152
23037
  }
23153
23038
  var DIAGRAM_PADDING6, NODE_FONT_SIZE, MIN_NODE_FONT_SIZE, EDGE_LABEL_FONT_SIZE4, EDGE_STROKE_WIDTH5, NODE_STROKE_WIDTH5, NODE_RX, COLLAPSE_BAR_HEIGHT3, ARROWHEAD_W2, ARROWHEAD_H2, DESC_FONT_SIZE, DESC_LINE_HEIGHT, MAX_DESC_LINES, CHAR_WIDTH_RATIO2, NODE_TEXT_PADDING, GROUP_RX, GROUP_LABEL_FONT_SIZE, GROUP_LABEL_ZONE, lineGeneratorLR, lineGeneratorTB;
@@ -23606,8 +23491,7 @@ async function layoutBoxesAndLines(parsed, collapseInfo, layoutOptions) {
23606
23491
  const edge = parsed.edges[i];
23607
23492
  if (edgeParallelCounts[i] === 0) continue;
23608
23493
  const elkEdge = edgeById.get(`e${i}`);
23609
- if (!elkEdge || !elkEdge.sections || elkEdge.sections.length === 0)
23610
- continue;
23494
+ if (!elkEdge?.sections || elkEdge.sections.length === 0) continue;
23611
23495
  const container = elkEdge.container ?? "root";
23612
23496
  const off = containerAbs.get(container) ?? { x: 0, y: 0 };
23613
23497
  const s = elkEdge.sections[0];
@@ -24384,7 +24268,7 @@ function renderMindmap(container, parsed, layout, palette, isDark, onClickItem,
24384
24268
  };
24385
24269
  }),
24386
24270
  position: { placement: "top-center", titleRelation: "below-title" },
24387
- mode: "fixed",
24271
+ mode: options?.exportMode ? "export" : "preview",
24388
24272
  controlsGroup: controlsToggles
24389
24273
  };
24390
24274
  const legendState = {
@@ -27187,7 +27071,7 @@ function drawPersonIcon(g, cx, cy, color) {
27187
27071
  g.append("line").attr("x1", cx).attr("y1", bodyBottomY).attr("x2", cx - PERSON_LEG_SPAN).attr("y2", legY).attr("stroke", color).attr("stroke-width", PERSON_SW);
27188
27072
  g.append("line").attr("x1", cx).attr("y1", bodyBottomY).attr("x2", cx + PERSON_LEG_SPAN).attr("y2", legY).attr("stroke", color).attr("stroke-width", PERSON_SW);
27189
27073
  }
27190
- function renderC4Context(container, parsed, layout, palette, isDark, onClickItem, exportDims, activeTagGroup) {
27074
+ function renderC4Context(container, parsed, layout, palette, isDark, onClickItem, exportDims, activeTagGroup, exportMode) {
27191
27075
  d3Selection9.select(container).selectAll(":not([data-d3-tooltip])").remove();
27192
27076
  const width = exportDims?.width ?? container.clientWidth;
27193
27077
  const height = exportDims?.height ?? container.clientHeight;
@@ -27363,7 +27247,8 @@ function renderC4Context(container, parsed, layout, palette, isDark, onClickItem
27363
27247
  palette,
27364
27248
  isDark,
27365
27249
  activeTagGroup,
27366
- fixedLegend ? width : null
27250
+ fixedLegend ? width : null,
27251
+ exportMode
27367
27252
  );
27368
27253
  }
27369
27254
  }
@@ -27718,7 +27603,7 @@ function placeEdgeLabels(labels, edges, obstacleRects) {
27718
27603
  placedRects.push({ x: lbl.x, y: lbl.y, w: lbl.bgW, h: lbl.bgH });
27719
27604
  }
27720
27605
  }
27721
- function renderLegend2(parent, layout, palette, isDark, activeTagGroup, fixedWidth) {
27606
+ function renderLegend2(parent, layout, palette, isDark, activeTagGroup, fixedWidth, exportMode) {
27722
27607
  const groups = layout.legend.map((g) => ({
27723
27608
  name: g.name,
27724
27609
  entries: g.entries.map((e) => ({ value: e.value, color: e.color }))
@@ -27726,7 +27611,7 @@ function renderLegend2(parent, layout, palette, isDark, activeTagGroup, fixedWid
27726
27611
  const legendConfig = {
27727
27612
  groups,
27728
27613
  position: { placement: "top-center", titleRelation: "below-title" },
27729
- mode: "fixed"
27614
+ mode: exportMode ? "export" : "preview"
27730
27615
  };
27731
27616
  const legendState = { activeGroup: activeTagGroup ?? null };
27732
27617
  const containerWidth = fixedWidth ?? layout.width;
@@ -27741,7 +27626,7 @@ function renderLegend2(parent, layout, palette, isDark, activeTagGroup, fixedWid
27741
27626
  );
27742
27627
  parent.selectAll("[data-legend-group]").classed("c4-legend-group", true);
27743
27628
  }
27744
- function renderC4Containers(container, parsed, layout, palette, isDark, onClickItem, exportDims, activeTagGroup) {
27629
+ function renderC4Containers(container, parsed, layout, palette, isDark, onClickItem, exportDims, activeTagGroup, exportMode) {
27745
27630
  d3Selection9.select(container).selectAll(":not([data-d3-tooltip])").remove();
27746
27631
  const width = exportDims?.width ?? container.clientWidth;
27747
27632
  const height = exportDims?.height ?? container.clientHeight;
@@ -27972,7 +27857,8 @@ function renderC4Containers(container, parsed, layout, palette, isDark, onClickI
27972
27857
  palette,
27973
27858
  isDark,
27974
27859
  activeTagGroup,
27975
- fixedLegend ? width : null
27860
+ fixedLegend ? width : null,
27861
+ exportMode
27976
27862
  );
27977
27863
  }
27978
27864
  }
@@ -28040,7 +27926,7 @@ function renderC4ComponentsForExport(content, systemName, containerName, theme,
28040
27926
  document.body.removeChild(el);
28041
27927
  }
28042
27928
  }
28043
- function renderC4Deployment(container, parsed, layout, palette, isDark, onClickItem, exportDims, activeTagGroup) {
27929
+ function renderC4Deployment(container, parsed, layout, palette, isDark, onClickItem, exportDims, activeTagGroup, exportMode) {
28044
27930
  renderC4Containers(
28045
27931
  container,
28046
27932
  parsed,
@@ -28049,7 +27935,8 @@ function renderC4Deployment(container, parsed, layout, palette, isDark, onClickI
28049
27935
  isDark,
28050
27936
  onClickItem,
28051
27937
  exportDims,
28052
- activeTagGroup
27938
+ activeTagGroup,
27939
+ exportMode
28053
27940
  );
28054
27941
  }
28055
27942
  function renderC4DeploymentForExport(content, theme, palette) {
@@ -28230,7 +28117,6 @@ function layoutGraph(graph, options) {
28230
28117
  target: edge.target,
28231
28118
  points: edgeData?.points ?? [],
28232
28119
  label: edge.label,
28233
- color: edge.color,
28234
28120
  lineNumber: edge.lineNumber
28235
28121
  };
28236
28122
  });
@@ -28532,6 +28418,8 @@ function renderNodeShape(g, node, palette, isDark, endTerminalIds, colorOff, sol
28532
28418
  case "document":
28533
28419
  renderDocument(g, node, palette, isDark, colorOff, solid);
28534
28420
  break;
28421
+ default:
28422
+ break;
28535
28423
  }
28536
28424
  }
28537
28425
  function renderFlowchart(container, graph, layout, palette, isDark, onClickItem, exportDims) {
@@ -28554,9 +28442,6 @@ function renderFlowchart(container, graph, layout, palette, isDark, onClickItem,
28554
28442
  const defs = svg.append("defs");
28555
28443
  defs.append("marker").attr("id", "fc-arrow").attr("viewBox", `0 0 ${ARROWHEAD_W3} ${ARROWHEAD_H3}`).attr("refX", ARROWHEAD_W3).attr("refY", ARROWHEAD_H3 / 2).attr("markerWidth", ARROWHEAD_W3).attr("markerHeight", ARROWHEAD_H3).attr("orient", "auto").append("polygon").attr("points", `0,0 ${ARROWHEAD_W3},${ARROWHEAD_H3 / 2} 0,${ARROWHEAD_H3}`).attr("fill", palette.textMuted);
28556
28444
  const edgeColors = /* @__PURE__ */ new Set();
28557
- for (const edge of layout.edges) {
28558
- if (edge.color) edgeColors.add(edge.color);
28559
- }
28560
28445
  for (const color of edgeColors) {
28561
28446
  const id = `fc-arrow-${color.replace("#", "")}`;
28562
28447
  defs.append("marker").attr("id", id).attr("viewBox", `0 0 ${ARROWHEAD_W3} ${ARROWHEAD_H3}`).attr("refX", ARROWHEAD_W3).attr("refY", ARROWHEAD_H3 / 2).attr("markerWidth", ARROWHEAD_W3).attr("markerHeight", ARROWHEAD_H3).attr("orient", "auto").append("polygon").attr("points", `0,0 ${ARROWHEAD_W3},${ARROWHEAD_H3 / 2} 0,${ARROWHEAD_H3}`).attr("fill", color);
@@ -28620,8 +28505,8 @@ function renderFlowchart(container, graph, layout, palette, isDark, onClickItem,
28620
28505
  const edge = layout.edges[ei];
28621
28506
  if (edge.points.length < 2) continue;
28622
28507
  const edgeG = contentG.append("g").attr("class", "fc-edge-group").attr("data-line-number", String(edge.lineNumber));
28623
- const edgeColor3 = edge.color ?? palette.textMuted;
28624
- const markerId = edge.color ? `fc-arrow-${edge.color.replace("#", "")}` : "fc-arrow";
28508
+ const edgeColor3 = palette.textMuted;
28509
+ const markerId = "fc-arrow";
28625
28510
  const pathD = lineGenerator5(edge.points);
28626
28511
  if (pathD) {
28627
28512
  edgeG.append("path").attr("d", pathD).attr("fill", "none").attr("stroke", edgeColor3).attr("stroke-width", EDGE_STROKE_WIDTH8).attr("marker-end", `url(#${markerId})`).attr("class", "fc-edge");
@@ -31105,7 +30990,7 @@ function renderNodes(svg, nodes, palette, isDark, animate, expandedNodeIds, acti
31105
30990
  const badgeText = `${node.computedInstances}x`;
31106
30991
  g.append("text").attr("x", x + node.width - 6).attr("y", y + NODE_HEADER_HEIGHT2 / 2 + META_FONT_SIZE4 * 0.35).attr("text-anchor", "end").attr("font-family", FONT_FAMILY).attr("font-size", META_FONT_SIZE4).attr("fill", textFill).attr("data-instance-node", node.id).style("cursor", "pointer").text(badgeText);
31107
30992
  }
31108
- const showDots = activeGroup != null && activeGroup.toLowerCase() === "capabilities";
30993
+ const showDots = activeGroup?.toLowerCase() === "capabilities";
31109
30994
  const roles = showDots && !node.isEdge ? inferRoles(node.properties) : [];
31110
30995
  if (roles.length > 0) {
31111
30996
  const dotY = isCollapsedGroup ? y + node.height - COLLAPSE_BAR_HEIGHT6 - NODE_PAD_BOTTOM2 / 2 : y + node.height - NODE_PAD_BOTTOM2 / 2;
@@ -31245,7 +31130,7 @@ function computeInfraLegendGroups(nodes, tagGroups, palette, edges) {
31245
31130
  }
31246
31131
  return groups;
31247
31132
  }
31248
- function renderLegend3(rootSvg, legendGroups, totalWidth, legendY, palette, isDark, activeGroup, playback) {
31133
+ function renderLegend3(rootSvg, legendGroups, totalWidth, legendY, palette, isDark, activeGroup, playback, exportMode = false) {
31249
31134
  if (legendGroups.length === 0 && !playback) return;
31250
31135
  const legendG = rootSvg.append("g").attr("transform", `translate(0, ${legendY})`);
31251
31136
  if (activeGroup) {
@@ -31261,7 +31146,7 @@ function renderLegend3(rootSvg, legendGroups, totalWidth, legendY, palette, isDa
31261
31146
  const legendConfig = {
31262
31147
  groups: allGroups,
31263
31148
  position: { placement: "top-center", titleRelation: "below-title" },
31264
- mode: "fixed",
31149
+ mode: exportMode ? "export" : "preview",
31265
31150
  showEmptyGroups: true
31266
31151
  };
31267
31152
  const legendState = { activeGroup };
@@ -31449,7 +31334,8 @@ function renderInfra(container, layout, palette, isDark, title, titleLineNumber,
31449
31334
  palette,
31450
31335
  isDark,
31451
31336
  activeGroup ?? null,
31452
- playback ?? void 0
31337
+ playback ?? void 0,
31338
+ exportMode
31453
31339
  );
31454
31340
  legendSvg.selectAll(".infra-legend-group").style("pointer-events", "auto");
31455
31341
  } else {
@@ -31461,7 +31347,8 @@ function renderInfra(container, layout, palette, isDark, title, titleLineNumber,
31461
31347
  palette,
31462
31348
  isDark,
31463
31349
  activeGroup ?? null,
31464
- playback ?? void 0
31350
+ playback ?? void 0,
31351
+ exportMode
31465
31352
  );
31466
31353
  }
31467
31354
  }
@@ -31903,7 +31790,7 @@ function analyzePert(parsed) {
31903
31790
  for (const e of edges) {
31904
31791
  if (!e.lag || e.lag.amount >= 0) continue;
31905
31792
  const src = activities.find((a) => a.id === e.source);
31906
- if (!src || !src.duration) continue;
31793
+ if (!src?.duration) continue;
31907
31794
  const leadDays = -toDays(e.lag, sprintDays);
31908
31795
  const srcDurDays = toDays(src.duration.m, sprintDays);
31909
31796
  if (e.type === "FS" && leadDays > srcDurDays) {
@@ -32409,7 +32296,7 @@ function buildSummary(input) {
32409
32296
  const anchor = input.anchor ?? null;
32410
32297
  if (parsedActivities.length === 0) return null;
32411
32298
  if (projectMu === null) {
32412
- if (anchor && anchor.kind === "backward") {
32299
+ if (anchor?.kind === "backward") {
32413
32300
  return [
32414
32301
  { text: "Expected duration: ?", level: 0 },
32415
32302
  { text: "P50 latest-safe start: ?", level: 0 },
@@ -32432,13 +32319,13 @@ function buildSummary(input) {
32432
32319
  const sigmaPositive = projectSigma !== null && projectSigma > 0;
32433
32320
  const showMcDetail = mc && sigmaPositive;
32434
32321
  const sigmaParen = showMcDetail ? ` (\xB1 ${roundForCaption(projectSigma)} ${pluralizeUnit(projectSigma, unit)})` : "";
32435
- if (anchor && anchor.kind === "forward") {
32322
+ if (anchor?.kind === "forward") {
32436
32323
  const projectMuDays = projectMu * unitToDays(unit);
32437
32324
  rows.push({
32438
32325
  text: `Expected finish: ${addCalendarDays(anchor.date, projectMuDays)}${sigmaParen}.`,
32439
32326
  level: 0
32440
32327
  });
32441
- } else if (anchor && anchor.kind === "backward") {
32328
+ } else if (anchor?.kind === "backward") {
32442
32329
  const projectMuDays = projectMu * unitToDays(unit);
32443
32330
  rows.push({
32444
32331
  text: `Expected start: ${addCalendarDays(anchor.date, -projectMuDays)}${sigmaParen}.`,
@@ -32457,13 +32344,13 @@ function buildSummary(input) {
32457
32344
  { pct: 80, days: monteCarloResult.p80 },
32458
32345
  { pct: 95, days: monteCarloResult.p95 }
32459
32346
  ];
32460
- if (anchor && anchor.kind === "forward") {
32347
+ if (anchor?.kind === "forward") {
32461
32348
  for (const { pct, days } of percentiles) {
32462
32349
  const offsetDays = roundConservative(days, "forward");
32463
32350
  const date = addCalendarDays(anchor.date, offsetDays);
32464
32351
  rows.push({ text: `P${pct} finish: ${date}.`, level: 1 });
32465
32352
  }
32466
- } else if (anchor && anchor.kind === "backward") {
32353
+ } else if (anchor?.kind === "backward") {
32467
32354
  for (const { pct, days } of percentiles) {
32468
32355
  const offsetDays = roundConservative(days, "backward");
32469
32356
  const date = addCalendarDays(anchor.date, -offsetDays);
@@ -32507,20 +32394,20 @@ function buildProjectSubtitle(input) {
32507
32394
  const sigmaPositive = projectSigma !== null && projectSigma > 0;
32508
32395
  const sigmaParen = sigmaPositive ? ` (\xB1 ${roundForCaption(projectSigma)})` : "";
32509
32396
  if (projectMu === null) {
32510
- if (anchor && anchor.kind === "forward") {
32397
+ if (anchor?.kind === "forward") {
32511
32398
  return `Expected finish: ? \xB7 \u2248 ? ${pluralizeUnit(2, unit)} of work`;
32512
32399
  }
32513
- if (anchor && anchor.kind === "backward") {
32400
+ if (anchor?.kind === "backward") {
32514
32401
  return `Expected start: ? \xB7 \u2248 ? ${pluralizeUnit(2, unit)} lead time`;
32515
32402
  }
32516
32403
  return `\u2248 ? ${pluralizeUnit(2, unit)}`;
32517
32404
  }
32518
32405
  const muStr = `${roundForCaption(projectMu)} ${pluralizeUnit(projectMu, unit)}`;
32519
- if (anchor && anchor.kind === "forward") {
32406
+ if (anchor?.kind === "forward") {
32520
32407
  const projectMuDays = projectMu * unitToDays(unit);
32521
32408
  return `Expected finish: ${addCalendarDays(anchor.date, projectMuDays)} \xB7 \u2248 ${muStr} of work${sigmaParen}`;
32522
32409
  }
32523
- if (anchor && anchor.kind === "backward") {
32410
+ if (anchor?.kind === "backward") {
32524
32411
  const projectMuDays = projectMu * unitToDays(unit);
32525
32412
  return `Expected start: ${addCalendarDays(anchor.date, -projectMuDays)} \xB7 \u2248 ${muStr} lead time${sigmaParen}`;
32526
32413
  }
@@ -32711,7 +32598,7 @@ function computeNodeSizing(resolved) {
32711
32598
  return { activityWidth, milestoneWidth, outerColW, midColW };
32712
32599
  }
32713
32600
  function nodeDimensions(resolved, id, sizing, overrides) {
32714
- if (overrides && overrides[id]) {
32601
+ if (overrides?.[id]) {
32715
32602
  return { width: overrides[id].width, height: overrides[id].height };
32716
32603
  }
32717
32604
  const r = resolved.activities.find((a) => a.activity.id === id);
@@ -33363,7 +33250,8 @@ function renderPert(container, resolved, layout, palette, isDark, options = {})
33363
33250
  x: 0,
33364
33251
  y: tagLegendY,
33365
33252
  width: exportWidth,
33366
- activeGroup: tagLegendActive
33253
+ activeGroup: tagLegendActive,
33254
+ exportMode: options.exportMode
33367
33255
  });
33368
33256
  }
33369
33257
  const root = svg.append("g").attr("transform", `translate(${offsetX}, ${offsetY})`);
@@ -33424,7 +33312,8 @@ function renderPertForExport(content, theme, palette, now) {
33424
33312
  renderPert(container, resolved, layout, palette, isDark, {
33425
33313
  title: hasTitle ? parsed.title : null,
33426
33314
  subtitle: resolved.projectSubtitle,
33427
- exportDims: { width: exportWidth, height: exportHeight }
33315
+ exportDims: { width: exportWidth, height: exportHeight },
33316
+ exportMode: true
33428
33317
  });
33429
33318
  const svgEl = container.querySelector("svg");
33430
33319
  if (!svgEl) return "";
@@ -34511,7 +34400,7 @@ function renderLegendBlock(svg, entries, args) {
34511
34400
  }
34512
34401
  function renderTagLegendRow(svg, resolved, palette, isDark, args) {
34513
34402
  if (resolved.tagGroups.length === 0) return;
34514
- const { x, y, width, activeGroup } = args;
34403
+ const { x, y, width, activeGroup, exportMode } = args;
34515
34404
  const groups = resolved.tagGroups.map((g) => ({
34516
34405
  name: g.name,
34517
34406
  entries: g.entries.map((e) => ({ value: e.value, color: e.color }))
@@ -34522,7 +34411,7 @@ function renderTagLegendRow(svg, resolved, palette, isDark, args) {
34522
34411
  {
34523
34412
  groups,
34524
34413
  position: { placement: "top-center", titleRelation: "below-title" },
34525
- mode: "fixed"
34414
+ mode: exportMode ? "export" : "preview"
34526
34415
  },
34527
34416
  { activeGroup },
34528
34417
  palette,
@@ -35962,7 +35851,8 @@ function renderGantt(container, resolved, palette, isDark, options, exportDims)
35962
35851
  ).attr("display", active ? null : "none");
35963
35852
  }
35964
35853
  drawLegend();
35965
- }
35854
+ },
35855
+ options?.exportMode ?? false
35966
35856
  );
35967
35857
  }
35968
35858
  }
@@ -36751,7 +36641,7 @@ function buildControlsToggles(hasCriticalPath, criticalPathActive, hasDependenci
36751
36641
  }
36752
36642
  return toggles;
36753
36643
  }
36754
- function renderTagLegend(svg, chartG, tagGroups, activeGroupName, chartLeftMargin, chartInnerWidth, legendY, palette, isDark, hasCriticalPath, criticalPathActive, _optionLineNumbers, onToggle, onToggleControlsExpand, currentSwimlaneGroup, onSwimlaneChange, legendViewMode, resolvedTasks, controlsExpanded = false, hasDependencies = false, dependenciesActive = false, onControlsToggle) {
36644
+ function renderTagLegend(svg, chartG, tagGroups, activeGroupName, chartLeftMargin, chartInnerWidth, legendY, palette, isDark, hasCriticalPath, criticalPathActive, _optionLineNumbers, onToggle, onToggleControlsExpand, currentSwimlaneGroup, onSwimlaneChange, legendViewMode, resolvedTasks, controlsExpanded = false, hasDependencies = false, dependenciesActive = false, onControlsToggle, exportMode = false) {
36755
36645
  let visibleGroups;
36756
36646
  if (activeGroupName) {
36757
36647
  const activeGroup = tagGroups.filter(
@@ -36846,7 +36736,7 @@ function renderTagLegend(svg, chartG, tagGroups, activeGroupName, chartLeftMargi
36846
36736
  placement: "top-center",
36847
36737
  titleRelation: "below-title"
36848
36738
  },
36849
- mode: "fixed",
36739
+ mode: exportMode ? "export" : "preview",
36850
36740
  capsulePillAddonWidth: iconReserve,
36851
36741
  controlsGroup: controlsToggles.length > 0 ? { toggles: controlsToggles } : void 0
36852
36742
  };
@@ -36953,7 +36843,7 @@ function renderTagLegend(svg, chartG, tagGroups, activeGroupName, chartLeftMargi
36953
36843
  placement: "top-center",
36954
36844
  titleRelation: "below-title"
36955
36845
  },
36956
- mode: "fixed",
36846
+ mode: exportMode ? "export" : "preview",
36957
36847
  controlsGroup: { toggles: controlsToggles }
36958
36848
  };
36959
36849
  const tagGroupG = legendRow.append("g");
@@ -37836,9 +37726,6 @@ function renderState(container, graph, layout, palette, isDark, onClickItem, exp
37836
37726
  const defs = svg.append("defs");
37837
37727
  defs.append("marker").attr("id", "st-arrow").attr("viewBox", `0 0 ${ARROWHEAD_W5} ${ARROWHEAD_H5}`).attr("refX", ARROWHEAD_W5).attr("refY", ARROWHEAD_H5 / 2).attr("markerWidth", ARROWHEAD_W5).attr("markerHeight", ARROWHEAD_H5).attr("orient", "auto").append("polygon").attr("points", `0,0 ${ARROWHEAD_W5},${ARROWHEAD_H5 / 2} 0,${ARROWHEAD_H5}`).attr("fill", palette.textMuted);
37838
37728
  const edgeColors = /* @__PURE__ */ new Set();
37839
- for (const edge of layout.edges) {
37840
- if (edge.color) edgeColors.add(edge.color);
37841
- }
37842
37729
  for (const color of edgeColors) {
37843
37730
  const id = `st-arrow-${color.replace("#", "")}`;
37844
37731
  defs.append("marker").attr("id", id).attr("viewBox", `0 0 ${ARROWHEAD_W5} ${ARROWHEAD_H5}`).attr("refX", ARROWHEAD_W5).attr("refY", ARROWHEAD_H5 / 2).attr("markerWidth", ARROWHEAD_W5).attr("markerHeight", ARROWHEAD_H5).attr("orient", "auto").append("polygon").attr("points", `0,0 ${ARROWHEAD_W5},${ARROWHEAD_H5 / 2} 0,${ARROWHEAD_H5}`).attr("fill", color);
@@ -37933,8 +37820,8 @@ function renderState(container, graph, layout, palette, isDark, onClickItem, exp
37933
37820
  for (let ei = 0; ei < layout.edges.length; ei++) {
37934
37821
  const edge = layout.edges[ei];
37935
37822
  const edgeG = contentG.append("g").attr("class", "st-edge-group").attr("data-line-number", String(edge.lineNumber));
37936
- const edgeColor3 = edge.color ?? palette.textMuted;
37937
- const markerId = edge.color ? `st-arrow-${edge.color.replace("#", "")}` : "st-arrow";
37823
+ const edgeColor3 = palette.textMuted;
37824
+ const markerId = "st-arrow";
37938
37825
  if (edge.source === edge.target) {
37939
37826
  const node = nodePositionMap.get(edge.source);
37940
37827
  if (node) {
@@ -39023,7 +38910,7 @@ function renderTechRadar(container, parsed, palette, isDark, onClickItem, export
39023
38910
  }
39024
38911
  ],
39025
38912
  position: { placement: "top-center", titleRelation: "below-title" },
39026
- mode: "fixed",
38913
+ mode: options?.exportMode ? "export" : "preview",
39027
38914
  controlsGroup: {
39028
38915
  toggles: [
39029
38916
  {
@@ -39626,7 +39513,7 @@ function getQuadrantLabelPosition(position, cx, cy, maxRadius) {
39626
39513
  };
39627
39514
  }
39628
39515
  }
39629
- function renderTechRadarForExport(container, parsed, palette, isDark, exportDims, viewState) {
39516
+ function renderTechRadarForExport(container, parsed, palette, isDark, exportDims, viewState, exportMode) {
39630
39517
  renderTechRadar(
39631
39518
  container,
39632
39519
  parsed,
@@ -39634,7 +39521,8 @@ function renderTechRadarForExport(container, parsed, palette, isDark, exportDims
39634
39521
  isDark,
39635
39522
  void 0,
39636
39523
  exportDims,
39637
- viewState
39524
+ viewState,
39525
+ { exportMode }
39638
39526
  );
39639
39527
  }
39640
39528
  var BLIP_RADIUS2, BLIP_FONT_SIZE2, RING_LABEL_FONT_SIZE, QUADRANT_LABEL_FONT_SIZE, TITLE_FONT_SIZE3, LISTING_FONT_SIZE, LISTING_HEADER_FONT_SIZE, LISTING_TOP_MARGIN, LISTING_COL_GAP, LISTING_LINE_HEIGHT, LISTING_BLIP_R;
@@ -40014,7 +39902,7 @@ function renderJourneyMap(container, parsed, palette, isDark, options) {
40014
39902
  titleRelation: "inline-with-title"
40015
39903
  },
40016
39904
  titleWidth: 0,
40017
- mode: exportDims ? "inline" : "fixed"
39905
+ mode: options?.exportMode ? "export" : "preview"
40018
39906
  };
40019
39907
  const legendState = { activeGroup: effectiveActiveGroup };
40020
39908
  const legendCallbacks = {
@@ -40727,7 +40615,8 @@ function renderJourneyMapForExport(content, theme, palette) {
40727
40615
  const layout = layoutJourneyMap(parsed, palette, { isDark });
40728
40616
  const container = document.createElement("div");
40729
40617
  renderJourneyMap(container, parsed, palette, isDark, {
40730
- exportDims: { width: layout.totalWidth, height: layout.totalHeight }
40618
+ exportDims: { width: layout.totalWidth, height: layout.totalHeight },
40619
+ exportMode: true
40731
40620
  });
40732
40621
  const svgEl = container.querySelector("svg");
40733
40622
  if (!svgEl) return "";
@@ -41492,7 +41381,7 @@ function renderCycle(container, parsed, palette, isDark, onClickItem, exportDims
41492
41381
  const legendConfig = {
41493
41382
  groups: [],
41494
41383
  position: { placement: "top-center", titleRelation: "below-title" },
41495
- mode: "fixed",
41384
+ mode: renderOptions?.exportMode ? "export" : "preview",
41496
41385
  controlsGroup
41497
41386
  };
41498
41387
  const legendState = {
@@ -41676,7 +41565,7 @@ function renderCycle(container, parsed, palette, isDark, onClickItem, exportDims
41676
41565
  }
41677
41566
  }
41678
41567
  }
41679
- function renderCycleForExport(container, parsed, palette, isDark, exportDims, viewState) {
41568
+ function renderCycleForExport(container, parsed, palette, isDark, exportDims, viewState, exportMode) {
41680
41569
  renderCycle(
41681
41570
  container,
41682
41571
  parsed,
@@ -41684,7 +41573,8 @@ function renderCycleForExport(container, parsed, palette, isDark, exportDims, vi
41684
41573
  isDark,
41685
41574
  void 0,
41686
41575
  exportDims,
41687
- viewState
41576
+ viewState,
41577
+ { exportMode }
41688
41578
  );
41689
41579
  }
41690
41580
  function resolveNodeColor5(color, palette, defaultColor) {
@@ -43314,9 +43204,6 @@ function wrapLabelWords(words) {
43314
43204
  function renderRectParticipant(g, palette, isDark, color, solid) {
43315
43205
  g.append("rect").attr("x", -W / 2).attr("y", 0).attr("width", W).attr("height", H).attr("rx", 2).attr("ry", 2).attr("fill", fill(palette, isDark, color, solid)).attr("stroke", stroke(palette, color)).attr("stroke-width", SW);
43316
43206
  }
43317
- function renderServiceParticipant(g, palette, isDark, color, solid) {
43318
- g.append("rect").attr("x", -W / 2).attr("y", 0).attr("width", W).attr("height", H).attr("rx", SERVICE_BORDER_RADIUS).attr("ry", SERVICE_BORDER_RADIUS).attr("fill", fill(palette, isDark, color, solid)).attr("stroke", stroke(palette, color)).attr("stroke-width", SW);
43319
- }
43320
43207
  function renderActorParticipant(g, palette, color) {
43321
43208
  const headR = 8;
43322
43209
  const cx = 0;
@@ -43371,31 +43258,6 @@ function renderCacheParticipant(g, palette, isDark, color, solid) {
43371
43258
  g.append("line").attr("x1", W / 2).attr("y1", topY).attr("x2", W / 2).attr("y2", topY + bodyH).attr("stroke", s).attr("stroke-width", SW).attr("stroke-dasharray", dash);
43372
43259
  g.append("ellipse").attr("cx", 0).attr("cy", topY).attr("rx", W / 2).attr("ry", ry).attr("fill", f).attr("stroke", s).attr("stroke-width", SW).attr("stroke-dasharray", dash);
43373
43260
  }
43374
- function renderNetworkingParticipant(g, palette, isDark, color, solid) {
43375
- const inset = 16;
43376
- const points = [
43377
- `${-W / 2 + inset},0`,
43378
- `${W / 2 - inset},0`,
43379
- `${W / 2},${H / 2}`,
43380
- `${W / 2 - inset},${H}`,
43381
- `${-W / 2 + inset},${H}`,
43382
- `${-W / 2},${H / 2}`
43383
- ].join(" ");
43384
- g.append("polygon").attr("points", points).attr("fill", fill(palette, isDark, color, solid)).attr("stroke", stroke(palette, color)).attr("stroke-width", SW);
43385
- }
43386
- function renderFrontendParticipant(g, palette, isDark, color, solid) {
43387
- const screenH = H - 10;
43388
- const s = stroke(palette, color);
43389
- g.append("rect").attr("x", -W / 2).attr("y", 0).attr("width", W).attr("height", screenH).attr("rx", 3).attr("ry", 3).attr("fill", fill(palette, isDark, color, solid)).attr("stroke", s).attr("stroke-width", SW);
43390
- g.append("line").attr("x1", 0).attr("y1", screenH).attr("x2", 0).attr("y2", H - 2).attr("stroke", s).attr("stroke-width", SW);
43391
- g.append("line").attr("x1", -14).attr("y1", H - 2).attr("x2", 14).attr("y2", H - 2).attr("stroke", s).attr("stroke-width", SW);
43392
- }
43393
- function renderExternalParticipant(g, palette, isDark, color, solid) {
43394
- g.append("rect").attr("x", -W / 2).attr("y", 0).attr("width", W).attr("height", H).attr("rx", 2).attr("ry", 2).attr("fill", fill(palette, isDark, color, solid)).attr("stroke", stroke(palette, color)).attr("stroke-width", SW).attr("stroke-dasharray", "6 3");
43395
- }
43396
- function renderGatewayParticipant(g, palette, isDark, color, _solid) {
43397
- renderRectParticipant(g, palette, isDark, color);
43398
- }
43399
43261
  function groupMessagesBySection(elements, messages) {
43400
43262
  const groups = [];
43401
43263
  let currentGroup = null;
@@ -44034,7 +43896,7 @@ function renderSequenceDiagram(container, parsed, palette, isDark, _onNavigateTo
44034
43896
  }
44035
43897
  }
44036
43898
  const lastStep = renderSteps[renderSteps.length - 1];
44037
- const lastIsSelfCall = lastStep && lastStep.type === "call" && lastStep.from === lastStep.to;
43899
+ const lastIsSelfCall = lastStep?.type === "call" && lastStep.from === lastStep.to;
44038
43900
  const lastStepTrailing = lastIsSelfCall ? SELF_CALL_HEIGHT + 25 : stepSpacing;
44039
43901
  let contentBottomY = renderSteps.length > 0 ? Math.max(
44040
43902
  stepYPositions[stepYPositions.length - 1] + lastStepTrailing,
@@ -44208,6 +44070,9 @@ function renderSequenceDiagram(container, parsed, palette, isDark, _onNavigateTo
44208
44070
  const FRAME_PADDING_X = 30;
44209
44071
  const FRAME_PADDING_BOTTOM = 15;
44210
44072
  const FRAME_LABEL_HEIGHT = 18;
44073
+ const SELF_ARROW_PROJECTION = ACTIVATION_WIDTH / 2 + SELF_CALL_WIDTH;
44074
+ const SELF_ARROW_FRAME_PAD = 10;
44075
+ const frameRightmostX = Math.max(...Array.from(participantX.values()));
44211
44076
  const collectMsgIndices = (els) => {
44212
44077
  const indices = [];
44213
44078
  for (const el of els) {
@@ -44274,16 +44139,40 @@ function renderSequenceDiagram(container, parsed, palette, isDark, _onNavigateTo
44274
44139
  maxPX = Math.max(maxPX, px);
44275
44140
  }
44276
44141
  }
44277
- const frameX = minPX - FRAME_PADDING_X;
44142
+ let extraLeft = 0;
44143
+ let extraRight = 0;
44144
+ let maxStepIsSelfCall = false;
44145
+ for (const mi of allIndices) {
44146
+ const m = messages[mi];
44147
+ if (m.from === m.to) {
44148
+ const px = participantX.get(m.from);
44149
+ if (px !== void 0) {
44150
+ const flipLeft = px === frameRightmostX;
44151
+ if (flipLeft) {
44152
+ const loopMin = px - SELF_ARROW_PROJECTION;
44153
+ const need = minPX - FRAME_PADDING_X - loopMin + SELF_ARROW_FRAME_PAD;
44154
+ if (need > 0) extraLeft = Math.max(extraLeft, need);
44155
+ } else {
44156
+ const loopMax = px + SELF_ARROW_PROJECTION;
44157
+ const need = loopMax - (maxPX + FRAME_PADDING_X) + SELF_ARROW_FRAME_PAD;
44158
+ if (need > 0) extraRight = Math.max(extraRight, need);
44159
+ }
44160
+ }
44161
+ if (msgToLastStep.get(mi) === maxStep) {
44162
+ maxStepIsSelfCall = true;
44163
+ }
44164
+ }
44165
+ }
44166
+ const frameX = minPX - FRAME_PADDING_X - extraLeft;
44278
44167
  const frameY = stepY(minStep) - FRAME_PADDING_TOP;
44279
- const frameW = maxPX - minPX + FRAME_PADDING_X * 2;
44280
- const frameH = stepY(maxStep) - stepY(minStep) + FRAME_PADDING_TOP + FRAME_PADDING_BOTTOM;
44168
+ const frameW = maxPX - minPX + FRAME_PADDING_X * 2 + extraLeft + extraRight;
44169
+ const frameH = stepY(maxStep) - stepY(minStep) + FRAME_PADDING_TOP + FRAME_PADDING_BOTTOM + (maxStepIsSelfCall ? SELF_CALL_HEIGHT : 0);
44281
44170
  svg.append("rect").attr("x", frameX).attr("y", frameY).attr("width", frameW).attr("height", frameH).attr("fill", "none").attr("stroke", palette.textMuted).attr("stroke-width", 1).attr("stroke-dasharray", "2 3").attr("rx", 3).attr("ry", 3).attr("class", "block-frame").attr("data-block-line", String(el.lineNumber));
44282
44171
  deferredLabels.push({
44283
44172
  x: frameX + 6,
44284
44173
  y: frameY + FRAME_LABEL_HEIGHT - 4,
44285
44174
  text: `${el.type} ${el.label}`,
44286
- bold: true,
44175
+ bold: false,
44287
44176
  italic: false,
44288
44177
  blockLine: el.lineNumber
44289
44178
  });
@@ -44309,7 +44198,7 @@ function renderSequenceDiagram(container, parsed, palette, isDark, _onNavigateTo
44309
44198
  y: dividerY + 14,
44310
44199
  text: `else if ${branchData.label}`,
44311
44200
  bold: false,
44312
- italic: true,
44201
+ italic: false,
44313
44202
  blockLine: branchData.lineNumber
44314
44203
  });
44315
44204
  }
@@ -44336,7 +44225,7 @@ function renderSequenceDiagram(container, parsed, palette, isDark, _onNavigateTo
44336
44225
  y: dividerY + 14,
44337
44226
  text: "else",
44338
44227
  bold: false,
44339
- italic: true,
44228
+ italic: false,
44340
44229
  blockLine: el.elseLineNumber
44341
44230
  });
44342
44231
  }
@@ -44406,7 +44295,7 @@ function renderSequenceDiagram(container, parsed, palette, isDark, _onNavigateTo
44406
44295
  return side === "right" ? px + ACTIVATION_WIDTH / 2 + offset : px - ACTIVATION_WIDTH / 2 + offset;
44407
44296
  };
44408
44297
  const leftmostX = Math.min(...Array.from(participantX.values()));
44409
- const rightmostX = Math.max(...Array.from(participantX.values()));
44298
+ const rightmostX = frameRightmostX;
44410
44299
  const sectionLineX1 = leftmostX - PARTICIPANT_BOX_WIDTH / 2 - 10;
44411
44300
  const sectionLineX2 = rightmostX + PARTICIPANT_BOX_WIDTH / 2 + 10;
44412
44301
  for (const region of sectionRegions) {
@@ -44608,7 +44497,7 @@ function renderSequenceDiagram(container, parsed, palette, isDark, _onNavigateTo
44608
44497
  const legendConfig = {
44609
44498
  groups: resolvedGroups,
44610
44499
  position: { placement: "top-center", titleRelation: "below-title" },
44611
- mode: "fixed"
44500
+ mode: "preview"
44612
44501
  };
44613
44502
  const legendState = {
44614
44503
  activeGroup: activeTagGroup ?? null,
@@ -44665,27 +44554,12 @@ function renderParticipant(svg, participant, cx, cy, palette, isDark, color, tag
44665
44554
  case "database":
44666
44555
  renderDatabaseParticipant(g, palette, isDark, color, solid);
44667
44556
  break;
44668
- case "service":
44669
- renderServiceParticipant(g, palette, isDark, color, solid);
44670
- break;
44671
44557
  case "queue":
44672
44558
  renderQueueParticipant(g, palette, isDark, color, solid);
44673
44559
  break;
44674
44560
  case "cache":
44675
44561
  renderCacheParticipant(g, palette, isDark, color, solid);
44676
44562
  break;
44677
- case "networking":
44678
- renderNetworkingParticipant(g, palette, isDark, color, solid);
44679
- break;
44680
- case "frontend":
44681
- renderFrontendParticipant(g, palette, isDark, color, solid);
44682
- break;
44683
- case "external":
44684
- renderExternalParticipant(g, palette, isDark, color, solid);
44685
- break;
44686
- case "gateway":
44687
- renderGatewayParticipant(g, palette, isDark, color, solid);
44688
- break;
44689
44563
  default:
44690
44564
  renderRectParticipant(g, palette, isDark, color, solid);
44691
44565
  break;
@@ -44713,7 +44587,7 @@ function renderParticipant(svg, participant, cx, cy, palette, isDark, color, tag
44713
44587
  });
44714
44588
  }
44715
44589
  }
44716
- var PARTICIPANT_GAP, PARTICIPANT_BOX_WIDTH, PARTICIPANT_BOX_HEIGHT, TOP_MARGIN, TITLE_HEIGHT8, PARTICIPANT_Y_OFFSET, SERVICE_BORDER_RADIUS, MESSAGE_START_OFFSET, LIFELINE_TAIL, ARROWHEAD_SIZE, NOTE_MAX_W, NOTE_FOLD, NOTE_PAD_H, NOTE_PAD_V, NOTE_FONT_SIZE, NOTE_LINE_H, NOTE_GAP, NOTE_CHAR_W, NOTE_CHARS_PER_LINE, ACTIVATION_WIDTH, SELF_CALL_HEIGHT, SELF_CALL_WIDTH, NOTE_LANE_MAX, LABEL_CHAR_WIDTH, LABEL_MAX_CHARS, fill, stroke, SW, W, H;
44590
+ var PARTICIPANT_GAP, PARTICIPANT_BOX_WIDTH, PARTICIPANT_BOX_HEIGHT, TOP_MARGIN, TITLE_HEIGHT8, PARTICIPANT_Y_OFFSET, MESSAGE_START_OFFSET, LIFELINE_TAIL, ARROWHEAD_SIZE, NOTE_MAX_W, NOTE_FOLD, NOTE_PAD_H, NOTE_PAD_V, NOTE_FONT_SIZE, NOTE_LINE_H, NOTE_GAP, NOTE_CHAR_W, NOTE_CHARS_PER_LINE, ACTIVATION_WIDTH, SELF_CALL_HEIGHT, SELF_CALL_WIDTH, NOTE_LANE_MAX, LABEL_CHAR_WIDTH, LABEL_MAX_CHARS, fill, stroke, SW, W, H;
44717
44591
  var init_renderer19 = __esm({
44718
44592
  "src/sequence/renderer.ts"() {
44719
44593
  "use strict";
@@ -44734,7 +44608,6 @@ var init_renderer19 = __esm({
44734
44608
  TOP_MARGIN = 20;
44735
44609
  TITLE_HEIGHT8 = 30;
44736
44610
  PARTICIPANT_Y_OFFSET = 10;
44737
- SERVICE_BORDER_RADIUS = 10;
44738
44611
  MESSAGE_START_OFFSET = 30;
44739
44612
  LIFELINE_TAIL = 30;
44740
44613
  ARROWHEAD_SIZE = 8;
@@ -44931,7 +44804,7 @@ function parseVisualization(content, palette) {
44931
44804
  const warn = (line12, message) => {
44932
44805
  result.diagnostics.push(makeDgmoError(line12, message, "warning"));
44933
44806
  };
44934
- if (!content || !content.trim()) {
44807
+ if (!content?.trim()) {
44935
44808
  return fail(0, "Empty content");
44936
44809
  }
44937
44810
  const lines = content.split("\n");
@@ -45013,7 +44886,9 @@ function parseVisualization(content, palette) {
45013
44886
  if (currentTimelineTagGroup && indent === 0) {
45014
44887
  currentTimelineTagGroup = null;
45015
44888
  }
45016
- const groupMatch = line12.match(/^\[(.+?)\](?:\s*\(([^)]+)\))?\s*$/);
44889
+ const groupMatch = line12.match(
44890
+ /^\[(.+?)\](?:\s+(red|orange|yellow|green|blue|purple|teal|cyan|gray|black|white))?\s*$/
44891
+ );
45017
44892
  if (groupMatch) {
45018
44893
  if (result.type === "arc") {
45019
44894
  const name = groupMatch[1].trim();
@@ -45055,7 +44930,7 @@ function parseVisualization(content, palette) {
45055
44930
  }
45056
44931
  if (result.type === "arc") {
45057
44932
  const linkMatch = line12.match(
45058
- /^(.+?)\s*->\s*(.+?)(?:\(([^)]+)\))?\s*(?:\s+(-?[\d,_]+(?:\.[\d]+)?))?$/
44933
+ /^(.+?)\s*->\s*(.+?)(?:\s+(red|orange|yellow|green|blue|purple|teal|cyan|gray|black|white))?(?:\s+(-?[\d,_]+(?:\.[\d]+)?))?$/
45059
44934
  );
45060
44935
  if (linkMatch) {
45061
44936
  const source = linkMatch[1].trim();
@@ -45094,7 +44969,7 @@ function parseVisualization(content, palette) {
45094
44969
  } else {
45095
44970
  if (line12.startsWith("//")) continue;
45096
44971
  const eraEntryMatch = line12.match(
45097
- /^(\d{4}(?:-\d{2})?(?:-\d{2}(?: \d{2}:\d{2})?)?)\s*(?:->|\u2013>)\s*(\d{4}(?:-\d{2})?(?:-\d{2}(?: \d{2}:\d{2})?)?)\s+(.+?)(?:\s*\(([^)]+)\))?\s*$/
44972
+ /^(\d{4}(?:-\d{2})?(?:-\d{2}(?: \d{2}:\d{2})?)?)\s*(?:->|\u2013>)\s*(\d{4}(?:-\d{2})?(?:-\d{2}(?: \d{2}:\d{2})?)?)\s+(.+?)(?:\s+(red|orange|yellow|green|blue|purple|teal|cyan|gray|black|white))?\s*$/
45098
44973
  );
45099
44974
  if (eraEntryMatch) {
45100
44975
  const colorAnnotation = eraEntryMatch[4]?.trim() || null;
@@ -45122,7 +44997,7 @@ function parseVisualization(content, palette) {
45122
44997
  } else {
45123
44998
  if (line12.startsWith("//")) continue;
45124
44999
  const markerEntryMatch = line12.match(
45125
- /^(\d{4}(?:-\d{2})?(?:-\d{2}(?: \d{2}:\d{2})?)?)\s+(.+?)(?:\s*\(([^)]+)\))?\s*$/
45000
+ /^(\d{4}(?:-\d{2})?(?:-\d{2}(?: \d{2}:\d{2})?)?)\s+(.+?)(?:\s+(red|orange|yellow|green|blue|purple|teal|cyan|gray|black|white))?\s*$/
45126
45001
  );
45127
45002
  if (markerEntryMatch) {
45128
45003
  const colorAnnotation = markerEntryMatch[3]?.trim() || null;
@@ -45155,7 +45030,7 @@ function parseVisualization(content, palette) {
45155
45030
  continue;
45156
45031
  }
45157
45032
  const eraMatch = line12.match(
45158
- /^era\s+(\d{4}(?:-\d{2})?(?:-\d{2}(?: \d{2}:\d{2})?)?)\s*(?:->|\u2013>)\s*(\d{4}(?:-\d{2})?(?:-\d{2}(?: \d{2}:\d{2})?)?)\s+(.+?)(?:\s*\(([^)]+)\))?\s*$/
45033
+ /^era\s+(\d{4}(?:-\d{2})?(?:-\d{2}(?: \d{2}:\d{2})?)?)\s*(?:->|\u2013>)\s*(\d{4}(?:-\d{2})?(?:-\d{2}(?: \d{2}:\d{2})?)?)\s+(.+?)(?:\s+(red|orange|yellow|green|blue|purple|teal|cyan|gray|black|white))?\s*$/
45159
45034
  );
45160
45035
  if (eraMatch) {
45161
45036
  const colorAnnotation = eraMatch[4]?.trim() || null;
@@ -45174,7 +45049,7 @@ function parseVisualization(content, palette) {
45174
45049
  continue;
45175
45050
  }
45176
45051
  const markerMatch = line12.match(
45177
- /^marker\s+(\d{4}(?:-\d{2})?(?:-\d{2}(?: \d{2}:\d{2})?)?)\s+(.+?)(?:\s*\(([^)]+)\))?\s*$/
45052
+ /^marker\s+(\d{4}(?:-\d{2})?(?:-\d{2}(?: \d{2}:\d{2})?)?)\s+(.+?)(?:\s+(red|orange|yellow|green|blue|purple|teal|cyan|gray|black|white))?\s*$/
45178
45053
  );
45179
45054
  if (markerMatch) {
45180
45055
  const colorAnnotation = markerMatch[3]?.trim() || null;
@@ -45295,13 +45170,11 @@ function parseVisualization(content, palette) {
45295
45170
  }
45296
45171
  }
45297
45172
  if (!/^(solid-fill|no-name|no-value|no-percent|no-title)$/i.test(line12)) {
45298
- const legacyAliasMatch = line12.match(
45299
- /^([^(:]+?)(?:\(([^)]+)\))?\s+alias\s+(\S+)\s*$/i
45300
- );
45173
+ const legacyAliasMatch = line12.match(/^(.+?)\s+alias\s+(\S+)\s*$/i);
45301
45174
  if (legacyAliasMatch) {
45302
- const name = legacyAliasMatch[1].trim();
45303
- const colorName = legacyAliasMatch[2]?.trim() ?? null;
45304
- const aliasToken = legacyAliasMatch[3].trim();
45175
+ const nameWithMaybeColor = legacyAliasMatch[1].trim();
45176
+ const aliasToken = legacyAliasMatch[2].trim();
45177
+ const { label: name, colorName } = peelTrailingColorName(nameWithMaybeColor);
45305
45178
  let color = null;
45306
45179
  if (colorName) {
45307
45180
  color = resolveColorWithDiagnostic(
@@ -45323,11 +45196,12 @@ function parseVisualization(content, palette) {
45323
45196
  continue;
45324
45197
  }
45325
45198
  const setDeclMatch = line12.match(
45326
- /^([^(:]+?)(?:\(([^)]+)\))?(?:\s+as\s+([A-Za-z][A-Za-z0-9_]{0,11}))?\s*$/i
45199
+ /^(.+?)(?:\s+as\s+([A-Za-z][A-Za-z0-9_]{0,11}))?\s*$/i
45327
45200
  );
45328
45201
  if (setDeclMatch) {
45329
- const name = setDeclMatch[1].trim();
45330
- const colorName = setDeclMatch[2]?.trim() ?? null;
45202
+ const nameWithMaybeColor = setDeclMatch[1].trim();
45203
+ const alias = setDeclMatch[2]?.trim() ?? null;
45204
+ const { label: name, colorName } = peelTrailingColorName(nameWithMaybeColor);
45331
45205
  let color = null;
45332
45206
  if (colorName) {
45333
45207
  color = resolveColorWithDiagnostic(
@@ -45337,7 +45211,6 @@ function parseVisualization(content, palette) {
45337
45211
  palette
45338
45212
  ) ?? null;
45339
45213
  }
45340
- const alias = setDeclMatch[3]?.trim() ?? null;
45341
45214
  result.vennSets.push({ name, alias, color, lineNumber });
45342
45215
  continue;
45343
45216
  }
@@ -45383,10 +45256,9 @@ function parseVisualization(content, palette) {
45383
45256
  if (quadrantMatch) {
45384
45257
  const position = quadrantMatch[1].toLowerCase();
45385
45258
  const labelPart = quadrantMatch[2].trim();
45386
- const labelColorMatch = labelPart.match(/^(.+?)\s*\(([^)]+)\)\s*$/);
45387
- const text = labelColorMatch ? labelColorMatch[1].trim() : labelPart;
45388
- const color = labelColorMatch ? resolveColorWithDiagnostic(
45389
- labelColorMatch[2].trim(),
45259
+ const { label: text, colorName } = peelTrailingColorName(labelPart);
45260
+ const color = colorName ? resolveColorWithDiagnostic(
45261
+ colorName,
45390
45262
  lineNumber,
45391
45263
  result.diagnostics,
45392
45264
  palette
@@ -45576,10 +45448,9 @@ function parseVisualization(content, palette) {
45576
45448
  );
45577
45449
  continue;
45578
45450
  }
45579
- const colorMatch = joinedLabel.match(/^(.+?)\(([^)]+)\)\s*$/);
45580
- const labelPart = colorMatch ? colorMatch[1].trim() : joinedLabel;
45581
- const colorPart = colorMatch ? resolveColorWithDiagnostic(
45582
- colorMatch[2].trim(),
45451
+ const { label: labelPart, colorName: colorWord } = peelTrailingColorName(joinedLabel);
45452
+ const colorPart = colorWord ? resolveColorWithDiagnostic(
45453
+ colorWord,
45583
45454
  lineNumber,
45584
45455
  result.diagnostics,
45585
45456
  palette
@@ -46868,7 +46739,7 @@ function makeTimelineHoverHelpers() {
46868
46739
  setTagAttrs
46869
46740
  };
46870
46741
  }
46871
- function renderTimelineTagLegendOverlay(container, parsed, palette, isDark, setup, hovers, onClickItem, exportDims, swimlaneTagGroup, activeTagGroup, onTagStateChange, viewMode) {
46742
+ function renderTimelineTagLegendOverlay(container, parsed, palette, isDark, setup, hovers, onClickItem, exportDims, swimlaneTagGroup, activeTagGroup, onTagStateChange, viewMode, exportMode) {
46872
46743
  if (parsed.timelineTagGroups.length === 0) return;
46873
46744
  const { width, textColor, groupColorMap, solid } = setup;
46874
46745
  const { FADE_OPACITY: FADE_OPACITY3, fadeReset, fadeToTagValue } = hovers;
@@ -46939,7 +46810,7 @@ function renderTimelineTagLegendOverlay(container, parsed, palette, isDark, setu
46939
46810
  const centralConfig = {
46940
46811
  groups: centralGroups,
46941
46812
  position: { placement: "top-center", titleRelation: "below-title" },
46942
- mode: "fixed",
46813
+ mode: exportMode ? "export" : "preview",
46943
46814
  capsulePillAddonWidth: iconAddon
46944
46815
  };
46945
46816
  const centralState = { activeGroup: centralActive };
@@ -46973,7 +46844,7 @@ function renderTimelineTagLegendOverlay(container, parsed, palette, isDark, setu
46973
46844
  const groupKey = groupName.toLowerCase();
46974
46845
  groupEl.attr("data-tag-group", groupKey);
46975
46846
  if (isActive && !viewMode) {
46976
- const isSwimActive = currentSwimlaneGroup != null && currentSwimlaneGroup.toLowerCase() === groupKey;
46847
+ const isSwimActive = currentSwimlaneGroup?.toLowerCase() === groupKey;
46977
46848
  const pillWidth3 = measureLegendText(groupName, LG_PILL_FONT_SIZE) + LG_PILL_PAD;
46978
46849
  const pillXOff = LG_CAPSULE_PAD;
46979
46850
  const iconX = pillXOff + pillWidth3 + 5;
@@ -47783,7 +47654,7 @@ function renderTimelineVertical(container, parsed, palette, isDark, setup, hover
47783
47654
  }
47784
47655
  }
47785
47656
  }
47786
- function renderTimeline(container, parsed, palette, isDark, onClickItem, exportDims, activeTagGroup, swimlaneTagGroup, onTagStateChange, viewMode) {
47657
+ function renderTimeline(container, parsed, palette, isDark, onClickItem, exportDims, activeTagGroup, swimlaneTagGroup, onTagStateChange, viewMode, exportMode) {
47787
47658
  const setup = setupTimeline(
47788
47659
  container,
47789
47660
  parsed,
@@ -47858,7 +47729,8 @@ function renderTimeline(container, parsed, palette, isDark, onClickItem, exportD
47858
47729
  swimlaneTagGroup,
47859
47730
  activeTagGroup,
47860
47731
  onTagStateChange,
47861
- viewMode
47732
+ viewMode,
47733
+ exportMode
47862
47734
  );
47863
47735
  }
47864
47736
  function getRotateFn(mode) {
@@ -49002,6 +48874,7 @@ function finalizeSvgExport(container, theme, palette) {
49002
48874
  return svgHtml;
49003
48875
  }
49004
48876
  async function renderForExport(content, theme, palette, viewState, options) {
48877
+ const exportMode = options?.exportMode ?? false;
49005
48878
  const { parseDgmoChartType: parseDgmoChartType2 } = await Promise.resolve().then(() => (init_dgmo_router(), dgmo_router_exports));
49006
48879
  const detectedType = parseDgmoChartType2(content);
49007
48880
  if (detectedType === "org") {
@@ -49043,7 +48916,9 @@ async function renderForExport(content, theme, palette, viewState, options) {
49043
48916
  void 0,
49044
48917
  { width: exportWidth, height: exportHeight },
49045
48918
  activeTagGroup,
49046
- hiddenAttributes
48919
+ hiddenAttributes,
48920
+ void 0,
48921
+ exportMode
49047
48922
  );
49048
48923
  return finalizeSvgExport(container2, theme, effectivePalette2);
49049
48924
  }
@@ -49085,7 +48960,8 @@ async function renderForExport(content, theme, palette, viewState, options) {
49085
48960
  void 0,
49086
48961
  { width: exportWidth, height: exportHeight },
49087
48962
  activeTagGroup,
49088
- hiddenAttributes
48963
+ hiddenAttributes,
48964
+ exportMode
49089
48965
  );
49090
48966
  return finalizeSvgExport(container2, theme, effectivePalette2);
49091
48967
  }
@@ -49108,7 +48984,8 @@ async function renderForExport(content, theme, palette, viewState, options) {
49108
48984
  currentSwimlaneGroup: viewState?.swim ?? null,
49109
48985
  collapsedLanes: viewState?.cl ? new Set(viewState.cl) : void 0,
49110
48986
  collapsedColumns: viewState?.cc ? new Set(viewState.cc) : void 0,
49111
- compactMeta: viewState?.cm
48987
+ compactMeta: viewState?.cm,
48988
+ exportMode
49112
48989
  });
49113
48990
  return finalizeSvgExport(container2, theme, effectivePalette2);
49114
48991
  }
@@ -49132,7 +49009,9 @@ async function renderForExport(content, theme, palette, viewState, options) {
49132
49009
  effectivePalette2,
49133
49010
  theme === "dark",
49134
49011
  void 0,
49135
- { width: exportWidth, height: exportHeight }
49012
+ { width: exportWidth, height: exportHeight },
49013
+ void 0,
49014
+ exportMode
49136
49015
  );
49137
49016
  return finalizeSvgExport(container2, theme, effectivePalette2);
49138
49017
  }
@@ -49162,7 +49041,8 @@ async function renderForExport(content, theme, palette, viewState, options) {
49162
49041
  erParsed.options["active-tag"],
49163
49042
  viewState?.tag ?? options?.tagGroup
49164
49043
  ),
49165
- viewState?.sem
49044
+ viewState?.sem,
49045
+ exportMode
49166
49046
  );
49167
49047
  return finalizeSvgExport(container2, theme, effectivePalette2);
49168
49048
  }
@@ -49195,7 +49075,8 @@ async function renderForExport(content, theme, palette, viewState, options) {
49195
49075
  {
49196
49076
  exportDims: { width: exportWidth, height: exportHeight },
49197
49077
  activeTagGroup: viewState?.tag ?? options?.tagGroup,
49198
- hiddenTagValues: blHiddenTagValues
49078
+ hiddenTagValues: blHiddenTagValues,
49079
+ exportMode
49199
49080
  }
49200
49081
  );
49201
49082
  return finalizeSvgExport(container2, theme, effectivePalette2);
@@ -49241,7 +49122,7 @@ async function renderForExport(content, theme, palette, viewState, options) {
49241
49122
  void 0,
49242
49123
  hideDescriptions,
49243
49124
  colorByDepth ? null : activeTagGroup,
49244
- colorByDepth ? { colorByDepth: true } : void 0
49125
+ colorByDepth ? { colorByDepth: true, exportMode } : { exportMode }
49245
49126
  );
49246
49127
  return finalizeSvgExport(container2, theme, effectivePalette2);
49247
49128
  }
@@ -49304,7 +49185,8 @@ async function renderForExport(content, theme, palette, viewState, options) {
49304
49185
  c4Parsed.tagGroups,
49305
49186
  c4Parsed.options["active-tag"],
49306
49187
  viewState?.tag ?? options?.tagGroup
49307
- )
49188
+ ),
49189
+ exportMode
49308
49190
  );
49309
49191
  return finalizeSvgExport(container2, theme, effectivePalette2);
49310
49192
  }
@@ -49440,7 +49322,8 @@ async function renderForExport(content, theme, palette, viewState, options) {
49440
49322
  resolved.tagGroups,
49441
49323
  resolved.options.activeTag ?? void 0,
49442
49324
  viewState?.tag ?? options?.tagGroup
49443
- )
49325
+ ),
49326
+ exportMode
49444
49327
  },
49445
49328
  { width: EXPORT_W, height: EXPORT_H }
49446
49329
  );
@@ -49481,7 +49364,8 @@ async function renderForExport(content, theme, palette, viewState, options) {
49481
49364
  effectivePalette2,
49482
49365
  theme === "dark",
49483
49366
  { width: RADAR_EXPORT_W, height: RADAR_EXPORT_H },
49484
- viewState
49367
+ viewState,
49368
+ exportMode
49485
49369
  );
49486
49370
  return finalizeSvgExport(container2, theme, effectivePalette2);
49487
49371
  }
@@ -49501,7 +49385,8 @@ async function renderForExport(content, theme, palette, viewState, options) {
49501
49385
  jmLayout.totalHeight
49502
49386
  );
49503
49387
  renderJourneyMap2(container2, jmParsed, effectivePalette2, theme === "dark", {
49504
- exportDims: { width: jmLayout.totalWidth, height: jmLayout.totalHeight }
49388
+ exportDims: { width: jmLayout.totalWidth, height: jmLayout.totalHeight },
49389
+ exportMode
49505
49390
  });
49506
49391
  return finalizeSvgExport(container2, theme, effectivePalette2);
49507
49392
  }
@@ -49518,7 +49403,8 @@ async function renderForExport(content, theme, palette, viewState, options) {
49518
49403
  effectivePalette2,
49519
49404
  theme === "dark",
49520
49405
  { width: EXPORT_WIDTH, height: EXPORT_HEIGHT },
49521
- viewState
49406
+ viewState,
49407
+ exportMode
49522
49408
  );
49523
49409
  return finalizeSvgExport(container2, theme, effectivePalette2);
49524
49410
  }
@@ -49637,7 +49523,10 @@ async function renderForExport(content, theme, palette, viewState, options) {
49637
49523
  void 0,
49638
49524
  viewState?.tag ?? options?.tagGroup
49639
49525
  ),
49640
- viewState?.swim
49526
+ viewState?.swim,
49527
+ void 0,
49528
+ void 0,
49529
+ exportMode
49641
49530
  );
49642
49531
  } else if (parsed.type === "venn") {
49643
49532
  renderVenn(container, parsed, effectivePalette, isDark, void 0, dims);
@@ -51358,7 +51247,11 @@ init_parser8();
51358
51247
  init_parser2();
51359
51248
  init_parser10();
51360
51249
  init_parsing();
51250
+ init_colors();
51361
51251
  init_chart_types();
51252
+ var RECOGNIZED_COLOR_SET2 = new Set(
51253
+ RECOGNIZED_COLOR_NAMES
51254
+ );
51362
51255
  var extractorRegistry = /* @__PURE__ */ new Map();
51363
51256
  function registerExtractor(kind, fn) {
51364
51257
  extractorRegistry.set(kind, fn);
@@ -51845,20 +51738,7 @@ var CHART_TYPES = [...ALL_CHART_TYPES].filter((t) => t !== "multi-line").map((na
51845
51738
  description: CHART_TYPE_DESCRIPTIONS2[name] ?? name
51846
51739
  }));
51847
51740
  var ENTITY_TYPES = /* @__PURE__ */ new Map([
51848
- [
51849
- "sequence",
51850
- [
51851
- "service",
51852
- "database",
51853
- "actor",
51854
- "queue",
51855
- "cache",
51856
- "gateway",
51857
- "external",
51858
- "networking",
51859
- "frontend"
51860
- ]
51861
- ],
51741
+ ["sequence", ["actor", "database", "queue", "cache"]],
51862
51742
  [
51863
51743
  "c4",
51864
51744
  ["person", "system", "container", "component", "external", "database"]
@@ -52127,8 +52007,8 @@ function extractTagDeclarations(docText) {
52127
52007
  }
52128
52008
  if (currentAlias !== null && raw.length > 0 && (raw[0] === " " || raw[0] === " ")) {
52129
52009
  if (trimmed && !trimmed.startsWith("//")) {
52130
- const colorIdx = trimmed.indexOf("(");
52131
- const value = colorIdx > 0 ? trimmed.substring(0, colorIdx).trim() : trimmed;
52010
+ const lastSpaceIdx = trimmed.lastIndexOf(" ");
52011
+ const value = lastSpaceIdx > 0 && RECOGNIZED_COLOR_SET2.has(trimmed.substring(lastSpaceIdx + 1)) ? trimmed.substring(0, lastSpaceIdx).trim() : trimmed;
52132
52012
  if (value) currentValues.push(value);
52133
52013
  }
52134
52014
  continue;
@@ -52679,7 +52559,6 @@ export {
52679
52559
  looksLikeSitemap,
52680
52560
  looksLikeState,
52681
52561
  makeDgmoError,
52682
- matchColorParens,
52683
52562
  matchesContiguously,
52684
52563
  measurePertAnalysisBlock,
52685
52564
  mix,