@diagrammo/dgmo 0.49.0 → 0.50.1

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 (198) hide show
  1. package/.cursorrules +6 -2
  2. package/.github/copilot-instructions.md +6 -2
  3. package/.windsurfrules +6 -2
  4. package/SKILL.md +6 -2
  5. package/dist/advanced.js +557 -195
  6. package/dist/auto.js +129 -119
  7. package/dist/auto.mjs +19496 -12761
  8. package/dist/block.js +145 -48
  9. package/dist/{charts-d3-EW3YQTEA.js → charts-d3-LR6D3D7A.js} +5 -5
  10. package/dist/{chunk-5FGDJIJX.js → chunk-2C56LEML.js} +3 -3
  11. package/dist/{chunk-XJ7J6WOO.js → chunk-2KGXHFYK.js} +4 -4
  12. package/dist/{chunk-T7IKPCMI.js → chunk-3LH5CLP4.js} +3 -3
  13. package/dist/{chunk-ZDUQGL3N.js → chunk-3LKM6FMW.js} +2 -2
  14. package/dist/{chunk-4FIV4K4Z.js → chunk-3NODSS6A.js} +7 -7
  15. package/dist/{chunk-4BD7EVPK.js → chunk-3P2DKJCG.js} +2 -2
  16. package/dist/{chunk-TC3YWBFO.js → chunk-3UIKSPFB.js} +35 -9
  17. package/dist/{chunk-SJEGO2QL.js → chunk-3XGZF2QJ.js} +4 -4
  18. package/dist/chunk-3XPUDB7B.js +420 -0
  19. package/dist/{chunk-O5MQPK7E.js → chunk-3Y2DRD7S.js} +3 -3
  20. package/dist/chunk-3YPY3OXD.js +354 -0
  21. package/dist/{chunk-N4J5KGWG.js → chunk-4MJ7M6YL.js} +8 -8
  22. package/dist/{chunk-JFPY3UJ7.js → chunk-4S52SK6G.js} +8 -8
  23. package/dist/{chunk-ALRHIR6I.js → chunk-5GJYGP5Z.js} +4 -4
  24. package/dist/{chunk-SQDFK5ZQ.js → chunk-5OWVC2A6.js} +3 -3
  25. package/dist/{chunk-7VLUGEMJ.js → chunk-66NVRO4K.js} +4 -4
  26. package/dist/{chunk-ZREZOIGS.js → chunk-66RUL3XF.js} +6 -6
  27. package/dist/{chunk-MJCG5K2O.js → chunk-6BFZKBGD.js} +2 -2
  28. package/dist/{chunk-2WMBWZY2.js → chunk-6HJBFVLO.js} +3 -3
  29. package/dist/{chunk-XCC2RENT.js → chunk-6IAA2QQ2.js} +2 -2
  30. package/dist/{chunk-B57V3DWN.js → chunk-7L3R6I3U.js} +3 -3
  31. package/dist/chunk-7PQYTZMA.js +681 -0
  32. package/dist/{chunk-6SA7FJE4.js → chunk-7QKLIMRZ.js} +10 -10
  33. package/dist/{chunk-YTN572Q2.js → chunk-7TV5Y53Y.js} +2 -2
  34. package/dist/{chunk-6CLKNXVP.js → chunk-BBGDM4NQ.js} +457 -78
  35. package/dist/{chunk-3NFJWFNP.js → chunk-BDXC7MDK.js} +1045 -124
  36. package/dist/{chunk-D5AVQCDN.js → chunk-BH3UYK36.js} +3 -3
  37. package/dist/chunk-BTUTZMPT.js +482 -0
  38. package/dist/{chunk-LVHPTBO3.js → chunk-C2CVAM3U.js} +4 -4
  39. package/dist/{chunk-BCT5G2VN.js → chunk-DFTFPYUD.js} +5 -5
  40. package/dist/{chunk-KV6Y2HE6.js → chunk-DSWVNQVS.js} +4 -4
  41. package/dist/{chunk-4YNP6O47.js → chunk-DZXYF2F5.js} +13 -3
  42. package/dist/{chunk-FUCAB3KQ.js → chunk-EAMEADTV.js} +3 -3
  43. package/dist/chunk-FA6K3FWM.js +940 -0
  44. package/dist/{chunk-HBVD67XG.js → chunk-FJUNPCYI.js} +2 -2
  45. package/dist/{chunk-6VE3VLWM.js → chunk-GBE54KY6.js} +6 -5
  46. package/dist/{chunk-YRVLP7UU.js → chunk-GKC3HILQ.js} +4 -4
  47. package/dist/{chunk-ZXL6MB4R.js → chunk-GL5UZ6NY.js} +3 -3
  48. package/dist/{chunk-GB3YZTAM.js → chunk-H73FP42Q.js} +5 -5
  49. package/dist/{chunk-4UDKKGHH.js → chunk-HEVYAHLW.js} +2 -2
  50. package/dist/{chunk-DDTJ5N7Q.js → chunk-HLJVEAOF.js} +6 -6
  51. package/dist/{chunk-CLR4A2N2.js → chunk-HTMN2Z6U.js} +4 -4
  52. package/dist/{chunk-TLKMTQYL.js → chunk-I2WKW7C7.js} +3 -3
  53. package/dist/{chunk-IUK7AGD4.js → chunk-I7F2A35O.js} +2 -2
  54. package/dist/{chunk-IBC35BTK.js → chunk-IUMPEA64.js} +2 -2
  55. package/dist/{chunk-5XCM7UUW.js → chunk-J6K7RP6P.js} +100 -36
  56. package/dist/{chunk-AJ2PEY7J.js → chunk-JJUOHGX2.js} +2 -2
  57. package/dist/{chunk-CEHZOPGM.js → chunk-KFZYNWWO.js} +2 -2
  58. package/dist/{chunk-4NQ3IKUM.js → chunk-KHEYDLMT.js} +5 -5
  59. package/dist/{chunk-YM2BSPYW.js → chunk-LE4MYMLI.js} +2 -2
  60. package/dist/{chunk-PU3AUQPA.js → chunk-M5RXSRO2.js} +2 -2
  61. package/dist/{chunk-XKTN7CZF.js → chunk-MCZ5LBZD.js} +4 -4
  62. package/dist/{chunk-35BBZDFE.js → chunk-NU3XLTGP.js} +4 -4
  63. package/dist/{chunk-BPIJLRYE.js → chunk-NWED7CYO.js} +3 -3
  64. package/dist/{chunk-YYX3SU6H.js → chunk-OMNGQPEZ.js} +257 -101
  65. package/dist/{chunk-BGJV5ATD.js → chunk-ONA5KPV3.js} +2 -2
  66. package/dist/{chunk-ZNQX6QWH.js → chunk-OTAL43EH.js} +6 -2
  67. package/dist/{chunk-F743CM2N.js → chunk-OTQKUHRS.js} +3 -3
  68. package/dist/{chunk-KUBBJ2CD.js → chunk-P7CE7LXL.js} +6 -6
  69. package/dist/{chunk-UVCXZEGU.js → chunk-PFHVU7UA.js} +2 -2
  70. package/dist/{chunk-5ZZLLBFK.js → chunk-PGEGPSCZ.js} +2 -2
  71. package/dist/chunk-Q4V4XQWV.js +158 -0
  72. package/dist/{chunk-IHLSHCPZ.js → chunk-QJP6PG7F.js} +5 -5
  73. package/dist/{chunk-EYN7VFKL.js → chunk-QROYX7TT.js} +3 -3
  74. package/dist/chunk-QXKWYZNR.js +379 -0
  75. package/dist/{chunk-VC3TR4NL.js → chunk-RZ6YKEUJ.js} +3 -3
  76. package/dist/{chunk-K6HNAY5V.js → chunk-SCHXJTZL.js} +2 -2
  77. package/dist/{chunk-7OVSJI2V.js → chunk-SQLNBA64.js} +3 -3
  78. package/dist/{chunk-65RTDUZH.js → chunk-SXRTRMEE.js} +3 -3
  79. package/dist/{chunk-3BIAFYD2.js → chunk-T4VOVZT5.js} +2 -2
  80. package/dist/{chunk-UWDO3O52.js → chunk-TN35C5KM.js} +2 -2
  81. package/dist/{chunk-IFK3GIUW.js → chunk-TSA237IM.js} +2 -2
  82. package/dist/{chunk-DKEPS5LH.js → chunk-U2HGPLZS.js} +36 -2
  83. package/dist/{chunk-4HVNZ7WF.js → chunk-VBYSIOOY.js} +3 -3
  84. package/dist/{chunk-ZTLWVRNS.js → chunk-VDOOQZUD.js} +2 -2
  85. package/dist/{chunk-RTERS6S5.js → chunk-VUJGMJE6.js} +4 -4
  86. package/dist/{chunk-X2CH42BN.js → chunk-VVW3F3MD.js} +7 -7
  87. package/dist/{chunk-RI4NIMFP.js → chunk-VVZRV54S.js} +75 -35
  88. package/dist/{chunk-LG4TWW4U.js → chunk-WW32K72E.js} +8 -8
  89. package/dist/{chunk-NVT6C2VE.js → chunk-X6EZPSW6.js} +4 -4
  90. package/dist/{chunk-KQAEKMIX.js → chunk-XDXNDSKO.js} +2 -2
  91. package/dist/{chunk-FMKTYMP4.js → chunk-XJLKLU4D.js} +3 -3
  92. package/dist/chunk-Y4RNXEAO.js +952 -0
  93. package/dist/{chunk-26RVGM44.js → chunk-YIA4LEX4.js} +15 -7
  94. package/dist/chunk-YNRDWYZP.js +295 -0
  95. package/dist/{chunk-SGHSY3LU.js → chunk-Z6XJQ6KO.js} +81 -6
  96. package/dist/{chunk-SVDWQGX2.js → chunk-ZAD4HV2G.js} +139 -78
  97. package/dist/cli.cjs +153 -144
  98. package/dist/clock.d.ts +10 -0
  99. package/dist/clock.js +235 -0
  100. package/dist/countdown.d.ts +12 -0
  101. package/dist/countdown.js +450 -0
  102. package/dist/dgmo-router-YTU3ENAX.js +84 -0
  103. package/dist/{dimensions-WSIJXT5Q.js → dimensions-OTBKC5M6.js} +5 -5
  104. package/dist/editor.js +39 -1
  105. package/dist/element.js +131 -121
  106. package/dist/element.mjs +19496 -12761
  107. package/dist/{flowchart-parser-IVZN7CQN.js → flowchart-parser-OE4WHLTF.js} +4 -4
  108. package/dist/{flowchart-renderer-GMI2U3DD.js → flowchart-renderer-GPCSMTOR.js} +6 -6
  109. package/dist/highlight.d.ts +17 -1
  110. package/dist/highlight.js +156 -5
  111. package/dist/index.js +50 -45
  112. package/dist/{layout-HQMBPJVS.js → layout-46366KBT.js} +2 -2
  113. package/dist/{layout-D42XE4RE.js → layout-5BG6DFCU.js} +3 -3
  114. package/dist/{layout-K2ZN3Q42.js → layout-7MZ5NF2N.js} +4 -4
  115. package/dist/{layout-4Z5JM7PT.js → layout-FWODLIMP.js} +4 -4
  116. package/dist/{layout-GZ2CWONU.js → layout-J36454XU.js} +4 -4
  117. package/dist/{layout-S3EK4IYO.js → layout-LD6XTLD6.js} +4 -4
  118. package/dist/{parser-CLMFZWCC.js → parser-36HVKU5U.js} +5 -5
  119. package/dist/{parser-MCJWF5G3.js → parser-4AI5ZN5F.js} +3 -3
  120. package/dist/{parser-DERPY5KC.js → parser-4NO6VZ6S.js} +4 -4
  121. package/dist/parser-4WQQQXCG.js +13 -0
  122. package/dist/{parser-4ROBKVUR.js → parser-5OXGPNBF.js} +5 -5
  123. package/dist/{parser-XWUDFJ7P.js → parser-AGVYTQXV.js} +4 -4
  124. package/dist/{parser-TITK4YW6.js → parser-AXKBDGNO.js} +5 -5
  125. package/dist/parser-B5FVS7O6.js +11 -0
  126. package/dist/parser-CSFUN3CT.js +14 -0
  127. package/dist/parser-CVMEDULU.js +15 -0
  128. package/dist/{parser-KPMN5KKE.js → parser-D5VILGN2.js} +4 -4
  129. package/dist/{parser-IKZFTLOJ.js → parser-DFFEDKHH.js} +3 -3
  130. package/dist/{parser-JD7OQ2E6.js → parser-H3XEPFPV.js} +4 -4
  131. package/dist/{parser-UBGPTIZD.js → parser-HYRTF3DO.js} +3 -3
  132. package/dist/{parser-K647FRI4.js → parser-IBWNAPY4.js} +3 -3
  133. package/dist/{parser-4BKIFG2C.js → parser-IJBMRXMC.js} +5 -5
  134. package/dist/{parser-MBJSBTL5.js → parser-JJR52VAT.js} +5 -5
  135. package/dist/{parser-SMBJO3XN.js → parser-K3XXLMUW.js} +4 -4
  136. package/dist/{parser-OBQG655V.js → parser-KCR2WS3V.js} +4 -4
  137. package/dist/{parser-HVJFTOXL.js → parser-LWKKBNSA.js} +3 -3
  138. package/dist/{parser-ZYC3XGNS.js → parser-MPCE5JBG.js} +4 -4
  139. package/dist/{parser-QJYS7KQQ.js → parser-MTOMTWTD.js} +4 -4
  140. package/dist/{parser-GFSOPDB7.js → parser-O4HIUN6G.js} +4 -4
  141. package/dist/{parser-BL7Z72EY.js → parser-PSA4UBSP.js} +4 -4
  142. package/dist/{parser-TNYX5S7E.js → parser-RV4M6AS2.js} +4 -4
  143. package/dist/parser-RZPVAQVX.js +11 -0
  144. package/dist/{parser-UGA23PYK.js → parser-TGQZJ5OT.js} +4 -4
  145. package/dist/parser-TXND652E.js +13 -0
  146. package/dist/{parser-WISPH7LW.js → parser-VKOJM7KS.js} +4 -4
  147. package/dist/{parser-ZKF5K2H2.js → parser-W4PQUGX3.js} +4 -4
  148. package/dist/{parser-MRBPXXIV.js → parser-WAV5JRPT.js} +4 -4
  149. package/dist/{parser-D6ONJQFR.js → parser-YS7TOS2K.js} +3 -3
  150. package/dist/pert.d.ts +8 -0
  151. package/dist/{renderer-VFUVRNLK.js → renderer-2AZ5HJFK.js} +4 -4
  152. package/dist/{renderer-V3JEMWMM.js → renderer-2QPMJ2DA.js} +6 -6
  153. package/dist/renderer-45PSOL3E.js +19 -0
  154. package/dist/{renderer-BB5PREMY.js → renderer-4ITCHBT7.js} +4 -4
  155. package/dist/{renderer-XEKIRPI6.js → renderer-5DSEWF74.js} +5 -5
  156. package/dist/{renderer-QNHUXCRL.js → renderer-6OKF44KS.js} +9 -9
  157. package/dist/renderer-72LGR2YF.js +14 -0
  158. package/dist/{renderer-YHXPN3GF.js → renderer-7SD6MSBS.js} +7 -7
  159. package/dist/renderer-A5VE5BCI.js +24 -0
  160. package/dist/{renderer-A5VFZQQK.js → renderer-AUW2BE6G.js} +6 -6
  161. package/dist/{renderer-LWGJFT3D.js → renderer-B5TBNZJE.js} +5 -5
  162. package/dist/{renderer-4IUPINAE.js → renderer-BSR2O2H6.js} +7 -7
  163. package/dist/{renderer-DKESNMU5.js → renderer-CYB4LK3G.js} +6 -6
  164. package/dist/{renderer-MFJ7HY2H.js → renderer-FF24KZCI.js} +5 -5
  165. package/dist/{renderer-CGW7QPNA.js → renderer-FPE3J5VZ.js} +7 -7
  166. package/dist/{renderer-6T3KK4S3.js → renderer-FYSVXL7M.js} +7 -7
  167. package/dist/{renderer-THD6V5TL.js → renderer-HDCCZURL.js} +9 -7
  168. package/dist/{renderer-TPIBXNOS.js → renderer-JCCHNECZ.js} +6 -6
  169. package/dist/{renderer-QL5KO6SK.js → renderer-KS7YZJE2.js} +7 -7
  170. package/dist/{renderer-SQ3JUAI7.js → renderer-NGXZTRK6.js} +6 -6
  171. package/dist/{renderer-MJDDU27W.js → renderer-ODUUOPVT.js} +10 -10
  172. package/dist/renderer-PJM35LJN.js +17 -0
  173. package/dist/{renderer-TYXRHMRI.js → renderer-PPIHO5FI.js} +9 -9
  174. package/dist/{renderer-W5RMOURB.js → renderer-PSMMZCKH.js} +6 -6
  175. package/dist/{renderer-UZF3JROD.js → renderer-QAOBLRXV.js} +8 -8
  176. package/dist/{renderer-ROV756WT.js → renderer-R2WNIC2C.js} +5 -5
  177. package/dist/{renderer-VICQ4WNY.js → renderer-SBS3YWU5.js} +5 -5
  178. package/dist/{renderer-6L3NBEY5.js → renderer-UYMQQCJK.js} +6 -6
  179. package/dist/{renderer-radial-MHO2VDXN.js → renderer-radial-F7X5F2VU.js} +6 -6
  180. package/dist/{state-parser-RX3GXOIB.js → state-parser-3REXRK3R.js} +4 -4
  181. package/dist/{state-renderer-AJUKGNWU.js → state-renderer-XYLNRWXR.js} +6 -6
  182. package/docs/ai-integration.md +6 -2
  183. package/docs/language-reference.md +253 -22
  184. package/gallery/fixtures/body.dgmo +17 -0
  185. package/gallery/fixtures/bracket.dgmo +30 -0
  186. package/gallery/fixtures/clock.dgmo +8 -0
  187. package/gallery/fixtures/countdown.dgmo +3 -0
  188. package/gallery/fixtures/goal.dgmo +4 -0
  189. package/package.json +12 -4
  190. package/dist/advanced.d.ts +0 -6162
  191. package/dist/auto.d.ts +0 -54
  192. package/dist/block.d.ts +0 -123
  193. package/dist/dgmo-router-ODKPEJ3P.js +0 -79
  194. package/dist/element.d.ts +0 -62
  195. package/dist/index.d.ts +0 -166
  196. package/dist/parser-667RGSUW.js +0 -13
  197. package/dist/parser-J3P2D6IP.js +0 -13
  198. package/dist/themes-1-CuKpeH.d.ts +0 -908
@@ -0,0 +1,158 @@
1
+ import {
2
+ extractColor,
3
+ measureIndent,
4
+ parseFirstLine,
5
+ tryParseSharedOption
6
+ } from "./chunk-OTAL43EH.js";
7
+ import {
8
+ makeDgmoError,
9
+ makeFail
10
+ } from "./chunk-CXK4DZH3.js";
11
+
12
+ // src/goal/parser.ts
13
+ function parseGoalNumber(token) {
14
+ if (token.includes(",")) return null;
15
+ const n = parseFloat(token.replace(/_/g, ""));
16
+ return Number.isFinite(n) ? n : null;
17
+ }
18
+ function parseGoal(content, palette) {
19
+ const options = {
20
+ noPercent: false,
21
+ noValue: false,
22
+ solidFill: false,
23
+ noTitle: false,
24
+ noAutoColor: false,
25
+ noNote: false
26
+ };
27
+ const result = {
28
+ type: "goal",
29
+ title: null,
30
+ titleLineNumber: null,
31
+ description: null,
32
+ mode: "bar",
33
+ now: 0,
34
+ target: 0,
35
+ hasTarget: false,
36
+ options,
37
+ diagnostics: [],
38
+ error: null
39
+ };
40
+ const fail = makeFail(result);
41
+ const warn = (line, message) => {
42
+ result.diagnostics.push(makeDgmoError(line, message, "warning"));
43
+ };
44
+ const softError = (line, message) => {
45
+ result.diagnostics.push(makeDgmoError(line, message, "error"));
46
+ };
47
+ if (!content?.trim()) return fail(0, "No content provided");
48
+ const lines = content.split("\n");
49
+ let headerParsed = false;
50
+ let sawNow = false;
51
+ const sharedOpts = {};
52
+ for (let i = 0; i < lines.length; i++) {
53
+ const lineNum = i + 1;
54
+ const raw = lines[i];
55
+ const trimmed = raw.trim();
56
+ if (!trimmed || trimmed.startsWith("//")) continue;
57
+ if (!headerParsed) {
58
+ const first = parseFirstLine(trimmed);
59
+ if (first?.chartType !== "goal") {
60
+ return fail(lineNum, 'Expected "goal [Title]" as the first line.');
61
+ }
62
+ if (first.title) {
63
+ const { label, color } = extractColor(
64
+ first.title,
65
+ palette,
66
+ result.diagnostics,
67
+ lineNum
68
+ );
69
+ result.title = label || null;
70
+ if (color !== void 0) result.color = color;
71
+ }
72
+ result.titleLineNumber = lineNum;
73
+ headerParsed = true;
74
+ continue;
75
+ }
76
+ const noteHeader = trimmed.match(/^note(?:\s+(.+))?$/i);
77
+ if (noteHeader && measureIndent(raw) === 0) {
78
+ const body = [];
79
+ if (noteHeader[1]) body.push(noteHeader[1].trim());
80
+ while (i + 1 < lines.length && measureIndent(lines[i + 1]) > 0) {
81
+ body.push(lines[i + 1].trim());
82
+ i++;
83
+ }
84
+ result.description = body.length ? body.join("\n") : null;
85
+ continue;
86
+ }
87
+ if (measureIndent(raw) > 0) {
88
+ warn(
89
+ lineNum,
90
+ `Indented content "${trimmed}" ignored \u2014 goal is a single value.`
91
+ );
92
+ continue;
93
+ }
94
+ const lower = trimmed.toLowerCase();
95
+ if (lower === "thermometer" || lower === "gauge") {
96
+ result.mode = lower;
97
+ continue;
98
+ }
99
+ if (lower === "no-percent") {
100
+ options.noPercent = true;
101
+ continue;
102
+ }
103
+ if (lower === "no-value") {
104
+ options.noValue = true;
105
+ continue;
106
+ }
107
+ if (lower === "no-auto-color") {
108
+ options.noAutoColor = true;
109
+ continue;
110
+ }
111
+ if (lower === "no-note") {
112
+ options.noNote = true;
113
+ continue;
114
+ }
115
+ if (tryParseSharedOption(trimmed, sharedOpts)) {
116
+ if (sharedOpts["solid-fill"] === "on") options.solidFill = true;
117
+ if (sharedOpts["no-title"] === "on") options.noTitle = true;
118
+ continue;
119
+ }
120
+ const kv = trimmed.match(/^(now|target)\s+(.+)$/i);
121
+ if (kv) {
122
+ const key = kv[1].toLowerCase();
123
+ const value = parseGoalNumber(kv[2].trim());
124
+ if (value === null) {
125
+ softError(lineNum, `"${key}" needs a number (got "${kv[2].trim()}").`);
126
+ continue;
127
+ }
128
+ if (key === "now") {
129
+ result.now = value;
130
+ sawNow = true;
131
+ } else {
132
+ if (value <= 0) {
133
+ softError(lineNum, '"target" must be greater than 0.');
134
+ } else {
135
+ result.target = value;
136
+ result.hasTarget = true;
137
+ }
138
+ }
139
+ continue;
140
+ }
141
+ warn(lineNum, `Unrecognized line "${trimmed}".`);
142
+ }
143
+ if (!sawNow) {
144
+ warn(result.titleLineNumber ?? 1, 'Missing "now" value \u2014 treating as 0.');
145
+ }
146
+ if (!result.hasTarget) {
147
+ softError(
148
+ result.titleLineNumber ?? 1,
149
+ 'Missing or invalid "target" \u2014 a goal needs a target > 0.'
150
+ );
151
+ }
152
+ return result;
153
+ }
154
+
155
+ export {
156
+ parseGoal
157
+ };
158
+ //# sourceMappingURL=chunk-Q4V4XQWV.js.map
@@ -25,13 +25,13 @@ import {
25
25
  } from "./chunk-3CIOJ5YJ.js";
26
26
  import {
27
27
  layoutOrg
28
- } from "./chunk-IBC35BTK.js";
28
+ } from "./chunk-IUMPEA64.js";
29
29
  import {
30
30
  ScaleContext
31
31
  } from "./chunk-YYVTBZZC.js";
32
32
  import {
33
33
  renderIntegratedLegend
34
- } from "./chunk-4UDKKGHH.js";
34
+ } from "./chunk-HEVYAHLW.js";
35
35
  import {
36
36
  getMaxLegendReservedHeight
37
37
  } from "./chunk-7UEMZREK.js";
@@ -55,7 +55,7 @@ import {
55
55
  } from "./chunk-5LWQH6QV.js";
56
56
  import {
57
57
  parseOrg
58
- } from "./chunk-F743CM2N.js";
58
+ } from "./chunk-OTQKUHRS.js";
59
59
  import {
60
60
  contrastText,
61
61
  mix,
@@ -65,7 +65,7 @@ import {
65
65
  import {
66
66
  resolveTagColor,
67
67
  tagAttrKey
68
- } from "./chunk-HBVD67XG.js";
68
+ } from "./chunk-FJUNPCYI.js";
69
69
 
70
70
  // src/org/renderer.ts
71
71
  import * as d3Selection from "d3-selection";
@@ -484,4 +484,4 @@ export {
484
484
  renderOrg,
485
485
  renderOrgForExport
486
486
  };
487
- //# sourceMappingURL=chunk-IHLSHCPZ.js.map
487
+ //# sourceMappingURL=chunk-QJP6PG7F.js.map
@@ -11,7 +11,7 @@ import {
11
11
  stripDefaultModifier,
12
12
  tagAttrKey,
13
13
  validateTagGroupNames
14
- } from "./chunk-HBVD67XG.js";
14
+ } from "./chunk-FJUNPCYI.js";
15
15
  import {
16
16
  parseInArrowLabel
17
17
  } from "./chunk-FFUN5D66.js";
@@ -27,7 +27,7 @@ import {
27
27
  splitNameAndMeta,
28
28
  warnUnknownMetaKeys,
29
29
  withTagAliases
30
- } from "./chunk-ZNQX6QWH.js";
30
+ } from "./chunk-OTAL43EH.js";
31
31
  import {
32
32
  formatDgmoError,
33
33
  makeDgmoError,
@@ -804,4 +804,4 @@ function validateDeploymentRefs(result, knownNames, pushWarning) {
804
804
  export {
805
805
  parseC4
806
806
  };
807
- //# sourceMappingURL=chunk-EYN7VFKL.js.map
807
+ //# sourceMappingURL=chunk-QROYX7TT.js.map
@@ -0,0 +1,379 @@
1
+ import {
2
+ preprocessDescriptionLine
3
+ } from "./chunk-IYULMRBE.js";
4
+ import {
5
+ AUTO_TAG_COLOR_SENTINEL,
6
+ finalizeAutoTagColors,
7
+ matchTagBlockHeading,
8
+ resolveActiveTagGroup,
9
+ stripDefaultModifier,
10
+ tagAttrKey
11
+ } from "./chunk-FJUNPCYI.js";
12
+ import {
13
+ extractColor,
14
+ measureIndent,
15
+ parseFirstLine,
16
+ splitNameAndMeta
17
+ } from "./chunk-OTAL43EH.js";
18
+ import {
19
+ makeDgmoError,
20
+ makeFail
21
+ } from "./chunk-CXK4DZH3.js";
22
+
23
+ // src/bracket/parser.ts
24
+ var BEATS_RE = /^(.+?)\s+beats\s+(.+)$/i;
25
+ var VS_RE = /^(.+?)\s+vs\s+(.+)$/i;
26
+ var SCORE_RE = /\s+(\d+\s*[-–]\s*\d+)$/;
27
+ var HOME_RE = /\s+@\s+(.+)$/;
28
+ var SEED_RE = /^seed\s+(\d+)\s+(.+)$/i;
29
+ var MODE_FLAGS = /* @__PURE__ */ new Set(["single-elim", "double-elim", "seeded"]);
30
+ function splitMatch(body) {
31
+ let rest = body;
32
+ let home = null;
33
+ const hm = rest.match(HOME_RE);
34
+ if (hm) {
35
+ home = hm[1].trim();
36
+ rest = rest.slice(0, hm.index).trimEnd();
37
+ }
38
+ let score = null;
39
+ const sm = rest.match(SCORE_RE);
40
+ if (sm) {
41
+ score = sm[1].replace(/\s+/g, "");
42
+ rest = rest.slice(0, sm.index).trimEnd();
43
+ }
44
+ const m = rest.match(BEATS_RE);
45
+ if (m) return { left: m[1].trim(), right: m[2].trim(), score, home };
46
+ return null;
47
+ }
48
+ function parseBracket(content, palette) {
49
+ const result = {
50
+ type: "bracket",
51
+ title: null,
52
+ titleLineNumber: null,
53
+ mode: "single-elim",
54
+ seeded: false,
55
+ roundNames: [],
56
+ sides: [],
57
+ matches: [],
58
+ seeds: [],
59
+ tagGroups: [],
60
+ competitorMeta: /* @__PURE__ */ new Map(),
61
+ activeTag: null,
62
+ noLegend: false,
63
+ noRounds: false,
64
+ diagnostics: [],
65
+ error: null
66
+ };
67
+ const matches = [];
68
+ const seeds = [];
69
+ const sides = [];
70
+ const sideSeen = /* @__PURE__ */ new Set();
71
+ const tagGroups = [];
72
+ const metaAliasMap = /* @__PURE__ */ new Map();
73
+ const competitorMeta = /* @__PURE__ */ new Map();
74
+ const fail = makeFail(result);
75
+ const warn = (line, message) => {
76
+ result.diagnostics.push(makeDgmoError(line, message, "warning"));
77
+ };
78
+ const softError = (line, message) => {
79
+ result.diagnostics.push(makeDgmoError(line, message, "error"));
80
+ };
81
+ if (!content?.trim()) return fail(0, "No content provided");
82
+ const registry = () => ({
83
+ keys: /* @__PURE__ */ new Set(),
84
+ tagAliases: new Set(metaAliasMap.keys())
85
+ });
86
+ const takeMeta = (rest, lineNum) => {
87
+ const split = splitNameAndMeta(
88
+ rest,
89
+ registry(),
90
+ metaAliasMap,
91
+ palette,
92
+ result.diagnostics,
93
+ lineNum
94
+ );
95
+ if (Object.keys(split.meta).length > 0) {
96
+ const prev = competitorMeta.get(split.name) ?? {};
97
+ competitorMeta.set(split.name, { ...prev, ...split.meta });
98
+ }
99
+ return split.name;
100
+ };
101
+ const lines = content.split("\n");
102
+ let headerParsed = false;
103
+ let currentSide = null;
104
+ let currentTagGroup = null;
105
+ let commentaryTarget = null;
106
+ let commentaryIndent = 0;
107
+ let inRoundsBlock = false;
108
+ const roundDefs = [];
109
+ for (let i = 0; i < lines.length; i++) {
110
+ const lineNum = i + 1;
111
+ const raw = lines[i];
112
+ const trimmed = raw.trim();
113
+ if (!trimmed || trimmed.startsWith("//") || trimmed.startsWith("#")) {
114
+ currentTagGroup = null;
115
+ commentaryTarget = null;
116
+ inRoundsBlock = false;
117
+ continue;
118
+ }
119
+ if (!headerParsed) {
120
+ const first = parseFirstLine(trimmed);
121
+ if (first?.chartType !== "bracket") {
122
+ return fail(lineNum, 'Expected "bracket [Title]" as the first line.');
123
+ }
124
+ if (first.title) {
125
+ const { label } = extractColor(
126
+ first.title,
127
+ palette,
128
+ result.diagnostics,
129
+ lineNum
130
+ );
131
+ result.title = label || null;
132
+ }
133
+ result.titleLineNumber = lineNum;
134
+ headerParsed = true;
135
+ continue;
136
+ }
137
+ const indent = measureIndent(raw);
138
+ if (commentaryTarget && indent > commentaryIndent) {
139
+ commentaryTarget.commentary.push(preprocessDescriptionLine(trimmed));
140
+ continue;
141
+ }
142
+ commentaryTarget = null;
143
+ if (inRoundsBlock) {
144
+ if (indent > 0) {
145
+ const { label, color } = extractColor(
146
+ trimmed,
147
+ palette,
148
+ result.diagnostics,
149
+ lineNum
150
+ );
151
+ if (label)
152
+ roundDefs.push(
153
+ color !== void 0 ? { name: label, color } : { name: label }
154
+ );
155
+ continue;
156
+ }
157
+ inRoundsBlock = false;
158
+ }
159
+ const tagHead = matchTagBlockHeading(trimmed);
160
+ if (tagHead) {
161
+ currentTagGroup = {
162
+ name: tagHead.name,
163
+ ...tagHead.alias !== void 0 && { alias: tagHead.alias },
164
+ entries: [],
165
+ lineNumber: lineNum
166
+ };
167
+ if (tagHead.alias) {
168
+ metaAliasMap.set(tagHead.alias.toLowerCase(), tagAttrKey(tagHead.name));
169
+ }
170
+ metaAliasMap.set(tagAttrKey(tagHead.name), tagAttrKey(tagHead.name));
171
+ tagGroups.push(currentTagGroup);
172
+ continue;
173
+ }
174
+ if (currentTagGroup && indent > 0) {
175
+ const { text: cleanEntry, isDefault } = stripDefaultModifier(trimmed);
176
+ const { label, color } = extractColor(
177
+ cleanEntry,
178
+ palette,
179
+ result.diagnostics,
180
+ lineNum
181
+ );
182
+ if (isDefault || currentTagGroup.entries.length === 0) {
183
+ currentTagGroup.defaultValue = label;
184
+ }
185
+ currentTagGroup.entries.push({
186
+ value: label,
187
+ color: color ?? AUTO_TAG_COLOR_SENTINEL,
188
+ lineNumber: lineNum
189
+ });
190
+ continue;
191
+ }
192
+ currentTagGroup = null;
193
+ if (indent === 0) currentSide = null;
194
+ const lower = trimmed.toLowerCase();
195
+ const roundsM = trimmed.match(/^rounds\b(.*)$/i);
196
+ if (roundsM) {
197
+ const rest = roundsM[1].trim();
198
+ if (rest) {
199
+ for (const name of rest.split(",").map((s) => s.trim()).filter(Boolean))
200
+ roundDefs.push({ name });
201
+ } else {
202
+ inRoundsBlock = true;
203
+ }
204
+ continue;
205
+ }
206
+ if (MODE_FLAGS.has(lower)) {
207
+ if (lower === "seeded") result.seeded = true;
208
+ else result.mode = lower;
209
+ continue;
210
+ }
211
+ if (lower === "no-legend") {
212
+ result.noLegend = true;
213
+ continue;
214
+ }
215
+ if (lower === "no-round" || lower === "no-rounds") {
216
+ result.noRounds = true;
217
+ continue;
218
+ }
219
+ const accentM = trimmed.match(/^accent\s+(.+)$/i);
220
+ if (accentM) {
221
+ const { color } = extractColor(
222
+ `x ${accentM[1].trim()}`,
223
+ palette,
224
+ result.diagnostics,
225
+ lineNum
226
+ );
227
+ if (color !== void 0) result.accentColor = color;
228
+ continue;
229
+ }
230
+ const sideM = trimmed.match(/^\[(.+?)\](.*)$/);
231
+ if (sideM) {
232
+ const label = sideM[1].trim();
233
+ if (MODE_FLAGS.has(label.toLowerCase())) {
234
+ const lk = label.toLowerCase();
235
+ if (lk === "seeded") result.seeded = true;
236
+ else result.mode = lk;
237
+ continue;
238
+ }
239
+ const { label: cleanLabel, color } = extractColor(
240
+ sideM[2].trim() ? `${label} ${sideM[2].trim()}` : label,
241
+ palette,
242
+ result.diagnostics,
243
+ lineNum
244
+ );
245
+ currentSide = cleanLabel;
246
+ if (!sideSeen.has(cleanLabel)) {
247
+ sideSeen.add(cleanLabel);
248
+ sides.push(
249
+ color !== void 0 ? { label: cleanLabel, color } : { label: cleanLabel }
250
+ );
251
+ }
252
+ continue;
253
+ }
254
+ const side = indent > 0 ? currentSide : null;
255
+ const seedM = trimmed.match(SEED_RE);
256
+ if (seedM) {
257
+ const n = parseInt(seedM[1], 10);
258
+ const name = takeMeta(seedM[2].trim(), lineNum);
259
+ result.seeded = true;
260
+ seeds.push({ seed: n, name, side, lineNumber: lineNum });
261
+ continue;
262
+ }
263
+ const decided = splitMatch(trimmed);
264
+ if (decided) {
265
+ if (decided.left === decided.right) {
266
+ softError(
267
+ lineNum,
268
+ `A match can't be "${decided.left}" against itself.`
269
+ );
270
+ continue;
271
+ }
272
+ if (decided.score) {
273
+ const parts = decided.score.split(/[-–]/).map((x) => parseInt(x, 10));
274
+ if (parts.length === 2 && parts[0] < parts[1]) {
275
+ warn(
276
+ lineNum,
277
+ `Score ${decided.score} shows "${decided.left}" losing, but they're on the winning side \u2014 keeping "${decided.left}" as the winner.`
278
+ );
279
+ }
280
+ }
281
+ const match = {
282
+ p1: decided.left,
283
+ p2: decided.right,
284
+ decided: true,
285
+ score: decided.score,
286
+ side,
287
+ home: decided.home,
288
+ commentary: [],
289
+ lineNumber: lineNum
290
+ };
291
+ matches.push(match);
292
+ commentaryTarget = match;
293
+ commentaryIndent = indent;
294
+ continue;
295
+ }
296
+ let vsBody = trimmed;
297
+ let vsHome = null;
298
+ const vhm = vsBody.match(HOME_RE);
299
+ if (vhm && VS_RE.test(vsBody.slice(0, vhm.index))) {
300
+ vsHome = vhm[1].trim();
301
+ vsBody = vsBody.slice(0, vhm.index).trimEnd();
302
+ }
303
+ const pending = vsBody.match(VS_RE);
304
+ if (pending) {
305
+ const a = pending[1].trim();
306
+ const b = pending[2].trim();
307
+ if (a === b) {
308
+ softError(lineNum, `A match can't be "${a}" against itself.`);
309
+ continue;
310
+ }
311
+ const match = {
312
+ p1: a,
313
+ p2: b,
314
+ decided: false,
315
+ score: null,
316
+ side,
317
+ home: vsHome,
318
+ commentary: [],
319
+ lineNumber: lineNum
320
+ };
321
+ matches.push(match);
322
+ commentaryTarget = match;
323
+ commentaryIndent = indent;
324
+ continue;
325
+ }
326
+ const rosterSplit = splitNameAndMeta(
327
+ trimmed,
328
+ registry(),
329
+ metaAliasMap,
330
+ palette,
331
+ result.diagnostics,
332
+ lineNum
333
+ );
334
+ if (Object.keys(rosterSplit.meta).length > 0) {
335
+ const prev = competitorMeta.get(rosterSplit.name) ?? {};
336
+ competitorMeta.set(rosterSplit.name, { ...prev, ...rosterSplit.meta });
337
+ continue;
338
+ }
339
+ warn(lineNum, `Unrecognized line "${trimmed}".`);
340
+ }
341
+ if (result.mode === "double-elim") {
342
+ warn(
343
+ result.titleLineNumber ?? 1,
344
+ "Double-elimination brackets are not yet supported \u2014 rendering the winners\u2019 side only."
345
+ );
346
+ }
347
+ const seedNames = /* @__PURE__ */ new Map();
348
+ for (const s of seeds) {
349
+ const prev = seedNames.get(s.name);
350
+ if (prev !== void 0) {
351
+ softError(
352
+ s.lineNumber,
353
+ `Duplicate competitor "${s.name}" (already seeded on line ${prev}). Rename one \u2014 names are identifiers.`
354
+ );
355
+ } else {
356
+ seedNames.set(s.name, s.lineNumber);
357
+ }
358
+ }
359
+ finalizeAutoTagColors(tagGroups, palette);
360
+ result.sides = sides;
361
+ result.matches = matches;
362
+ result.seeds = seeds;
363
+ result.roundNames = roundDefs;
364
+ result.tagGroups = tagGroups;
365
+ result.competitorMeta = competitorMeta;
366
+ result.activeTag = resolveActiveTagGroup(tagGroups, void 0);
367
+ if (!result.seeded && matches.length === 0) {
368
+ warn(
369
+ result.titleLineNumber ?? 1,
370
+ 'No matches \u2014 add "A beats B" or "A vs B" lines.'
371
+ );
372
+ }
373
+ return result;
374
+ }
375
+
376
+ export {
377
+ parseBracket
378
+ };
379
+ //# sourceMappingURL=chunk-QXKWYZNR.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  renderIntegratedLegend
3
- } from "./chunk-4UDKKGHH.js";
3
+ } from "./chunk-HEVYAHLW.js";
4
4
  import {
5
5
  getMaxLegendReservedHeight
6
6
  } from "./chunk-7UEMZREK.js";
@@ -27,7 +27,7 @@ import {
27
27
  import {
28
28
  resolveTagColor,
29
29
  tagAttrKey
30
- } from "./chunk-HBVD67XG.js";
30
+ } from "./chunk-FJUNPCYI.js";
31
31
 
32
32
  // src/block/renderer.ts
33
33
  import * as d3Selection from "d3-selection";
@@ -359,4 +359,4 @@ export {
359
359
  renderBlock,
360
360
  authoredCollapsedIds
361
361
  };
362
- //# sourceMappingURL=chunk-VC3TR4NL.js.map
362
+ //# sourceMappingURL=chunk-RZ6YKEUJ.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  extractColor,
3
3
  measureIndent
4
- } from "./chunk-ZNQX6QWH.js";
4
+ } from "./chunk-OTAL43EH.js";
5
5
  import {
6
6
  makeDgmoError
7
7
  } from "./chunk-CXK4DZH3.js";
@@ -73,4 +73,4 @@ function tryCollectNote(lines, index, indent, palette, diagnostics) {
73
73
  export {
74
74
  tryCollectNote
75
75
  };
76
- //# sourceMappingURL=chunk-K6HNAY5V.js.map
76
+ //# sourceMappingURL=chunk-SCHXJTZL.js.map
@@ -10,7 +10,7 @@ import {
10
10
  tagAttrKey,
11
11
  validateTagGroupNames,
12
12
  validateTagValues
13
- } from "./chunk-HBVD67XG.js";
13
+ } from "./chunk-FJUNPCYI.js";
14
14
  import {
15
15
  normalizeName
16
16
  } from "./chunk-NOTA6TEI.js";
@@ -25,7 +25,7 @@ import {
25
25
  tryParseSharedOption,
26
26
  warnUnknownMetaKeys,
27
27
  withTagAliases
28
- } from "./chunk-ZNQX6QWH.js";
28
+ } from "./chunk-OTAL43EH.js";
29
29
  import {
30
30
  formatDgmoError,
31
31
  makeDgmoError,
@@ -519,4 +519,4 @@ export {
519
519
  looksLikeSitemap,
520
520
  parseSitemap
521
521
  };
522
- //# sourceMappingURL=chunk-7OVSJI2V.js.map
522
+ //# sourceMappingURL=chunk-SQLNBA64.js.map
@@ -10,7 +10,7 @@ import {
10
10
  tagAttrKey,
11
11
  validateTagGroupNames,
12
12
  validateTagValues
13
- } from "./chunk-HBVD67XG.js";
13
+ } from "./chunk-FJUNPCYI.js";
14
14
  import {
15
15
  MINDMAP_REGISTRY,
16
16
  OPTION_NOCOLON_RE,
@@ -21,7 +21,7 @@ import {
21
21
  tryParseSharedOption,
22
22
  warnUnknownMetaKeys,
23
23
  withTagAliases
24
- } from "./chunk-ZNQX6QWH.js";
24
+ } from "./chunk-OTAL43EH.js";
25
25
  import {
26
26
  formatDgmoError,
27
27
  makeDgmoError,
@@ -313,4 +313,4 @@ function findMetadataParent(indent, indentStack) {
313
313
  export {
314
314
  parseMindmap
315
315
  };
316
- //# sourceMappingURL=chunk-65RTDUZH.js.map
316
+ //# sourceMappingURL=chunk-SXRTRMEE.js.map
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-YYVTBZZC.js";
8
8
  import {
9
9
  renderIntegratedLegend
10
- } from "./chunk-4UDKKGHH.js";
10
+ } from "./chunk-HEVYAHLW.js";
11
11
  import {
12
12
  getMaxLegendReservedHeight
13
13
  } from "./chunk-7UEMZREK.js";
@@ -1601,4 +1601,4 @@ export {
1601
1601
  renderTechRadar,
1602
1602
  renderTechRadarForExport
1603
1603
  };
1604
- //# sourceMappingURL=chunk-3BIAFYD2.js.map
1604
+ //# sourceMappingURL=chunk-T4VOVZT5.js.map