@webskill/sdk 0.21.0 → 0.23.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 (135) hide show
  1. package/dist/abnfDiagram-O67JEVCF-DtYFjfqO.js +109 -0
  2. package/dist/agent.d.ts +3 -3
  3. package/dist/agent.js +1174 -169
  4. package/dist/{approval-DwN2o2QG.js → approval-7CuZS3Z4.js} +104 -18
  5. package/dist/arc-8U_6NQWm.js +130 -0
  6. package/dist/architecture-7GRP2DOG-RTw1wpAq.js +4 -0
  7. package/dist/architectureDiagram-NJMV4G6O-XmmXrJAK.js +7473 -0
  8. package/dist/array-DQfpQNY8.js +8 -0
  9. package/dist/blockDiagram-BEXU5L5S-D4yjnCD1.js +2582 -0
  10. package/dist/browser.d.ts +455 -49
  11. package/dist/browser.js +2134 -138
  12. package/dist/c4Diagram-YGBWAQC7-BLmA_JSd.js +3668 -0
  13. package/dist/channel-CZxxLrG7.js +9 -0
  14. package/dist/chunk-2Q5K7J3B-Ck03gkFR.js +21 -0
  15. package/dist/chunk-3FUC2YCW-tr6jmbQf.js +530 -0
  16. package/dist/chunk-5DYCD2WN-Bt97YGTd.js +58 -0
  17. package/dist/chunk-5VM5RSS4-BBxa48HL.js +21 -0
  18. package/dist/chunk-6AEJRKK7-JXK89I-O.js +14 -0
  19. package/dist/chunk-742MDFTN-CPmgCGwC.js +466 -0
  20. package/dist/chunk-7INBJB4K-C9jq9o66.js +6552 -0
  21. package/dist/chunk-7M6MHVWA-BrKCWcR1.js +4894 -0
  22. package/dist/chunk-7PRAP22T-BHED6GVs.js +95 -0
  23. package/dist/chunk-DUW6YSOI-DoZj78PO.js +19 -0
  24. package/dist/chunk-FOHPRMQF-Dkbp819z.js +27189 -0
  25. package/dist/chunk-GNY47TPC-Bpvq1T49.js +87 -0
  26. package/dist/chunk-GTNCS2PH-CLmh4I2c.js +686 -0
  27. package/dist/chunk-GWA4HPMP-B6vN3fkL.js +95 -0
  28. package/dist/chunk-J5ZVWO5B-Bi_Pcobw.js +26 -0
  29. package/dist/chunk-JWPE2WC7-D1rC79GS.js +12 -0
  30. package/dist/chunk-LNGE3PJU-D5OIoe3Z.js +2582 -0
  31. package/dist/chunk-MBY4JIJT-C34L7a4f.js +2276 -0
  32. package/dist/chunk-NETBCI7D-Cg84k8N8.js +321 -0
  33. package/dist/chunk-O7XYJQB3-B6K0KOSL.js +8846 -0
  34. package/dist/chunk-UA2S7LBM-DxHM29_K.js +612 -0
  35. package/dist/chunk-WEXAMYUT-Ba6jFWhB.js +33 -0
  36. package/dist/chunk-XXDRQBXY-DPbSy4kg.js +12 -0
  37. package/dist/chunk-Y2CYZVJY-U3QOMqrW.js +15 -0
  38. package/dist/chunk-Z7XXMR3K-oLg1h8F3.js +1038 -0
  39. package/dist/chunk-ZIGJFQKS-DqEFBuHR.js +2215 -0
  40. package/dist/classDiagram-v2-NBCMYWYE-BqnOWIUt.js +3845 -0
  41. package/dist/cose-bilkent-JH36ORCC-C0dTAHVK.js +4270 -0
  42. package/dist/cynefin-OW5HDTMX-B2QvgEQj.js +4 -0
  43. package/dist/cynefinDiagram-VND7K2PF-yAWc6Z3W.js +479 -0
  44. package/dist/cytoscape.esm-C64mRh9B.js +28325 -0
  45. package/dist/dagre-6A5THRUB-D0w2W27v.js +4816 -0
  46. package/dist/defaultLocale-B_EoOkSF.js +249 -0
  47. package/dist/diagram-22UHCM2B-DvgzhUzP.js +6115 -0
  48. package/dist/diagram-3UASUU5V-DWgUB-ef.js +795 -0
  49. package/dist/diagram-ATOU4E4O-P1olqwIs.js +553 -0
  50. package/dist/diagram-CDSNMT55-BUlZuLUe.js +402 -0
  51. package/dist/diagram-MLGK6HIB-6w5qmkGt.js +186 -0
  52. package/dist/diagram-MPIPVDR6-DEFiSo8o.js +289 -0
  53. package/dist/dist-UajCDt3n.js +92 -0
  54. package/dist/ebnfDiagram-ZINNZB2B-CI8liCfR.js +123 -0
  55. package/dist/elk-276RUBZZ-3SvW6OAK.js +90034 -0
  56. package/dist/erDiagram-OPXOYQCR-CPTbKhwP.js +2301 -0
  57. package/dist/eventmodeling-NTZA5JFV-BlyuqGp0.js +4 -0
  58. package/dist/flowDiagram-KWPJA3E3-CcUJ6HbV.js +18 -0
  59. package/dist/ganttDiagram-FUAMR5RP-31UjY0KK.js +3939 -0
  60. package/dist/{toolSource-C9oNuKmr.js → geometry-CRhuySKV.js} +169 -12
  61. package/dist/gitGraph-4MIJSDKK-ChdVlrk7.js +4 -0
  62. package/dist/gitGraphDiagram-X574FWY7-DKuxJymB.js +1153 -0
  63. package/dist/governance.d.ts +22 -4
  64. package/dist/governance.js +100 -10
  65. package/dist/graphlib-tk9gQYuN.js +4194 -0
  66. package/dist/{index-DHopiH_m.d.ts → index-7No55dRb.d.ts} +161 -11
  67. package/dist/{index-B8Tgmpwh.d.ts → index-ShvCB5I9.d.ts} +2 -2
  68. package/dist/{index-CYLt5u4L.d.ts → index-V76_OFj2.d.ts} +789 -21
  69. package/dist/index.d.ts +4 -4
  70. package/dist/index.js +11 -9
  71. package/dist/info-A6RAGUB7-CxRAt9S9.js +4 -0
  72. package/dist/infoDiagram-VRGFBTTK-pRspGfjZ.js +25 -0
  73. package/dist/init-CMOIWdg-.js +16 -0
  74. package/dist/ishikawaDiagram-OU5B5YK6-DKerAPAg.js +975 -0
  75. package/dist/journeyDiagram-ZHPQQLJL-C4MK-YO5.js +1227 -0
  76. package/dist/kanban-definition-PNTS6WVX-BqsZpMXx.js +1244 -0
  77. package/dist/katex-BcRRvyh_.js +26465 -0
  78. package/dist/{kind-DaKqLX2F.js → kind-Dc8x0HWz.js} +54 -7
  79. package/dist/line-LgV8iVMV.js +48 -0
  80. package/dist/linear-BWKR0Tqd.js +393 -0
  81. package/dist/linkedDocument-CZZOl9cO.js +456 -0
  82. package/dist/mcp.d.ts +2 -2
  83. package/dist/{memoryArtifactStore-D6dLeY55.js → memoryArtifactStore-Bs7glPqm.js} +14 -0
  84. package/dist/mermaid-parser.core-pYR5siSx.js +754 -0
  85. package/dist/mermaid.core-DMtwGCHy.js +1756 -0
  86. package/dist/mindmap-definition-NLK3R4M7-CXbD-myG.js +1312 -0
  87. package/dist/node.d.ts +3 -3
  88. package/dist/node.js +12 -5
  89. package/dist/{openUiLibrary-b0i7F_oZ.js → openUiLibrary-B7j3rLrm.js} +1 -1
  90. package/dist/{openUiSpecLang-CLXJEeRU.js → openUiSpecLang-BSYYnjay.js} +1 -1
  91. package/dist/ordinal-CxA6GHQS.js +84 -0
  92. package/dist/packet-AYTQ26CC-BOm08cxl.js +4 -0
  93. package/dist/path-C27Z2Bjv.js +106 -0
  94. package/dist/{pathSecurity-B1owvJAF.js → pathSecurity-CirkQwWP.js} +12 -1
  95. package/dist/pegDiagram-GJSIUBJH-BLGJOewQ.js +115 -0
  96. package/dist/pie-WAS4IAKB-Dvg7glpk.js +4 -0
  97. package/dist/pieDiagram-5QR66LMP-laoaV_PB.js +298 -0
  98. package/dist/quadrantDiagram-O4NWA36T-Db_wFBkT.js +2236 -0
  99. package/dist/radar-RG4KPBEZ-BZDaTu06.js +4 -0
  100. package/dist/railroad-74A4TZTK-C-UhjkOy.js +4 -0
  101. package/dist/railroad-abnf-HS5TGJTU-dUKVA4OS.js +4 -0
  102. package/dist/railroad-ebnf-LZEXJU2U-DzQumk18.js +4 -0
  103. package/dist/railroad-peg-WCYAUIDC-B3vvTWed.js +4 -0
  104. package/dist/railroadDiagram-XR7U4H2S-BY0sTM4X.js +89 -0
  105. package/dist/requirementDiagram-PLB6GJNP-3rkQfEhs.js +2474 -0
  106. package/dist/rough.cjs-AmDd_NQk.js +1395 -0
  107. package/dist/sankeyDiagram-IPEJSGJF-CGAJhyG2.js +3578 -0
  108. package/dist/sequenceDiagram-PO4LG4MO-9FJjFX06.js +5522 -0
  109. package/dist/sizeCapture-INFHLROL-D8PWxdOn.js +56 -0
  110. package/dist/{skill-CAJMsLod.js → skill-WSUDp6A1.js} +1 -1
  111. package/dist/{skillVersionStore-B24Jjjry-BkOk9wI_.d.ts → skillVersionStore-S4_HJ_Fl-Cvy9LqVu.d.ts} +35 -4
  112. package/dist/src-NkhI3UMl.js +2653 -0
  113. package/dist/stateDiagram-v2-GCMORJYK-B0O3wc1-.js +2715 -0
  114. package/dist/swimlanes-2SLR337P-D4EOnrpu.js +6637 -0
  115. package/dist/swimlanesDiagram-TC7HE7FX-BUx29EJ9.js +30 -0
  116. package/dist/testing.d.ts +2 -1
  117. package/dist/testing.js +1 -1
  118. package/dist/timeline-definition-EJHVYXUP-CrgiiB4C.js +1513 -0
  119. package/dist/treeView-Q6P3EWNA-C1by-Gzc.js +4 -0
  120. package/dist/treemap-WGGIJYW6-mC2NZ6ad.js +4 -0
  121. package/dist/{types-BvTV_05--BW8zDuEk.d.ts → types-CpDRZ0rA-BiZBXGm4.d.ts} +66 -8
  122. package/dist/ui-react.d.ts +3 -3
  123. package/dist/ui-react.js +3746 -96
  124. package/dist/ui-vue.d.ts +1 -1
  125. package/dist/ui.d.ts +3 -3
  126. package/dist/ui.js +2 -2
  127. package/dist/usecaseDiagram-POWQR4AR-BUt_TQOY.js +14397 -0
  128. package/dist/vennDiagram-UO4OBE2U-CwXr0wjA.js +2808 -0
  129. package/dist/wardley-WFR3VGLG-CVSYjq_S.js +4 -0
  130. package/dist/wardleyDiagram-VNRHLVJA-Cpfd47dQ.js +874 -0
  131. package/dist/{webSkillApi-Cib6G-94.js → webSkillApi-D5VMUnrv.js} +2 -2
  132. package/dist/{webskillLitCatalog-W06npwej.js → webskillLitCatalog-D5BCiMCU.js} +1 -1
  133. package/dist/xychartDiagram-PMCCYNJV-e1TeVoc6.js +2704 -0
  134. package/package.json +1 -1
  135. package/dist/linkedDocument-C0gj1sMq.js +0 -245
@@ -0,0 +1,1756 @@
1
+ import { n as __name } from "./chunk-Y2CYZVJY-U3QOMqrW.js";
2
+ import { h as setLogLevel, m as log, p as select_default } from "./src-NkhI3UMl.js";
3
+ import { $ as updateSiteConfig, C as getDiagramLoader, E as getSiteConfig, I as reset, J as setSiteConfig, K as setDiagramConfigScope, L as sanitizeCss, N as registerDiagram, P as registerLazyLoadedDiagrams, Q as themes_default, S as getDiagram, T as getEffectiveHtmlLabels, V as saveConfigFromInitialize, W as setConfig, Z as styles_default, _ as frontMatterRegex, b as getConfig, c as configureSvgSize, et as purify, f as defaultConfig_default, g as evaluate, l as cssStyleSheetToString, m as detectors, n as addDirective, p as detectType, r as assignWithDepth_default, t as UnknownDiagramError, u as defaultConfig } from "./chunk-O7XYJQB3-B6K0KOSL.js";
4
+ import { S as isBuffer, a as decodeEntities, f as isDetailedError, g as utils_default, h as removeDirectives, i as cleanAndMerge, o as encodeEntities, v as isTypedArray, x as isArrayLike, y as isArguments } from "./chunk-ZIGJFQKS-DqEFBuHR.js";
5
+ import { t as selectSvgElement } from "./chunk-6AEJRKK7-JXK89I-O.js";
6
+ import { r as registerIconPacks } from "./chunk-742MDFTN-CPmgCGwC.js";
7
+ import { a as dedent } from "./chunk-MBY4JIJT-C34L7a4f.js";
8
+ import "./chunk-7PRAP22T-BHED6GVs.js";
9
+ import "./chunk-7INBJB4K-C9jq9o66.js";
10
+ import "./chunk-5DYCD2WN-Bt97YGTd.js";
11
+ import "./chunk-Z7XXMR3K-oLg1h8F3.js";
12
+ import "./chunk-UA2S7LBM-DxHM29_K.js";
13
+ import { n as registerLayoutLoaders } from "./chunk-GNY47TPC-Bpvq1T49.js";
14
+ import { n as load, t as JSON_SCHEMA } from "./chunk-LNGE3PJU-D5OIoe3Z.js";
15
+
16
+ //#region ../../node_modules/.pnpm/es-toolkit@1.50.0/node_modules/es-toolkit/dist/compat/_internal/isPrototype.mjs
17
+ function isPrototype(value) {
18
+ const constructor = value?.constructor;
19
+ return value === (typeof constructor === "function" ? constructor.prototype : Object.prototype);
20
+ }
21
+
22
+ //#endregion
23
+ //#region ../../node_modules/.pnpm/es-toolkit@1.50.0/node_modules/es-toolkit/dist/compat/predicate/isEmpty.mjs
24
+ /**
25
+ * Checks if a given value is empty.
26
+ *
27
+ * - If the given value is a string, checks if it is an empty string.
28
+ * - If the given value is an array, `Map`, or `Set`, checks if its size is 0.
29
+ * - If the given value is an [array-like object](../predicate/isArrayLike.md), checks if its length is 0.
30
+ * - If the given value is an object, checks if it is an empty object with no properties.
31
+ * - Primitive values (booleans, numbers, or bigints) are considered empty.
32
+ *
33
+ * @param [value] - The value to check.
34
+ * @returns `true` if the value is empty, `false` otherwise.
35
+ *
36
+ * @example
37
+ * isEmpty(); // true
38
+ * isEmpty(null); // true
39
+ * isEmpty(""); // true
40
+ * isEmpty([]); // true
41
+ * isEmpty({}); // true
42
+ * isEmpty(new Map()); // true
43
+ * isEmpty(new Set()); // true
44
+ * isEmpty("hello"); // false
45
+ * isEmpty([1, 2, 3]); // false
46
+ * isEmpty({ a: 1 }); // false
47
+ * isEmpty(new Map([["key", "value"]])); // false
48
+ * isEmpty(new Set([1, 2, 3])); // false
49
+ */
50
+ function isEmpty(value) {
51
+ if (value == null) return true;
52
+ if (isArrayLike(value)) {
53
+ if (typeof value.splice !== "function" && typeof value !== "string" && !isBuffer(value) && !isTypedArray(value) && !isArguments(value)) return false;
54
+ return value.length === 0;
55
+ }
56
+ if (typeof value === "object" || typeof value === "function") {
57
+ if (value instanceof Map || value instanceof Set) return value.size === 0;
58
+ const keys = Object.keys(value);
59
+ if (isPrototype(value)) return keys.filter((x) => x !== "constructor").length === 0;
60
+ return keys.length === 0;
61
+ }
62
+ return true;
63
+ }
64
+
65
+ //#endregion
66
+ //#region ../../node_modules/.pnpm/stylis@4.4.0/node_modules/stylis/src/Enum.js
67
+ var COMMENT = "comm";
68
+ var RULESET = "rule";
69
+ var DECLARATION = "decl";
70
+ var MEDIA = "@media";
71
+ var IMPORT = "@import";
72
+ var SUPPORTS = "@supports";
73
+ var NAMESPACE = "@namespace";
74
+ var KEYFRAMES = "@keyframes";
75
+ var LAYER = "@layer";
76
+ var SCOPE = "@scope";
77
+
78
+ //#endregion
79
+ //#region ../../node_modules/.pnpm/stylis@4.4.0/node_modules/stylis/src/Utility.js
80
+ /**
81
+ * @param {number}
82
+ * @return {number}
83
+ */
84
+ var abs = Math.abs;
85
+ /**
86
+ * @param {number}
87
+ * @return {string}
88
+ */
89
+ var from = String.fromCharCode;
90
+ /**
91
+ * @param {string} value
92
+ * @return {string}
93
+ */
94
+ function trim(value) {
95
+ return value.trim();
96
+ }
97
+ /**
98
+ * @param {string} value
99
+ * @param {(string|RegExp)} pattern
100
+ * @param {string} replacement
101
+ * @return {string}
102
+ */
103
+ function replace(value, pattern, replacement) {
104
+ return value.replace(pattern, replacement);
105
+ }
106
+ /**
107
+ * @param {string} value
108
+ * @param {number} index
109
+ * @return {number}
110
+ */
111
+ function charat(value, index) {
112
+ return value.charCodeAt(index) | 0;
113
+ }
114
+ /**
115
+ * @param {string} value
116
+ * @param {number} begin
117
+ * @param {number} end
118
+ * @return {string}
119
+ */
120
+ function substr(value, begin, end) {
121
+ return value.slice(begin, end);
122
+ }
123
+ /**
124
+ * @param {string} value
125
+ * @return {number}
126
+ */
127
+ function strlen(value) {
128
+ return value.length;
129
+ }
130
+ /**
131
+ * @param {any[]} value
132
+ * @return {number}
133
+ */
134
+ function sizeof(value) {
135
+ return value.length;
136
+ }
137
+ /**
138
+ * @param {any} value
139
+ * @param {any[]} array
140
+ * @return {any}
141
+ */
142
+ function append(value, array) {
143
+ return array.push(value), value;
144
+ }
145
+
146
+ //#endregion
147
+ //#region ../../node_modules/.pnpm/stylis@4.4.0/node_modules/stylis/src/Tokenizer.js
148
+ var line = 1;
149
+ var column = 1;
150
+ var length = 0;
151
+ var position = 0;
152
+ var character = 0;
153
+ var characters = "";
154
+ /**
155
+ * @param {string} value
156
+ * @param {object | null} root
157
+ * @param {object | null} parent
158
+ * @param {string} type
159
+ * @param {string[] | string} props
160
+ * @param {object[] | string} children
161
+ * @param {object[]} siblings
162
+ * @param {number} length
163
+ */
164
+ function node(value, root, parent, type, props, children, length, siblings) {
165
+ return {
166
+ value,
167
+ root,
168
+ parent,
169
+ type,
170
+ props,
171
+ children,
172
+ line,
173
+ column,
174
+ length,
175
+ return: "",
176
+ siblings
177
+ };
178
+ }
179
+ /**
180
+ * @return {number}
181
+ */
182
+ function char() {
183
+ return character;
184
+ }
185
+ /**
186
+ * @return {number}
187
+ */
188
+ function prev() {
189
+ character = position > 0 ? charat(characters, --position) : 0;
190
+ if (column--, character === 10) column = 1, line--;
191
+ return character;
192
+ }
193
+ /**
194
+ * @return {number}
195
+ */
196
+ function next() {
197
+ character = position < length ? charat(characters, position++) : 0;
198
+ if (column++, character === 10) column = 1, line++;
199
+ return character;
200
+ }
201
+ /**
202
+ * @return {number}
203
+ */
204
+ function peek() {
205
+ return charat(characters, position);
206
+ }
207
+ /**
208
+ * @return {number}
209
+ */
210
+ function caret() {
211
+ return position;
212
+ }
213
+ /**
214
+ * @param {number} begin
215
+ * @param {number} end
216
+ * @return {string}
217
+ */
218
+ function slice(begin, end) {
219
+ return substr(characters, begin, end);
220
+ }
221
+ /**
222
+ * @param {number} type
223
+ * @return {number}
224
+ */
225
+ function token(type) {
226
+ switch (type) {
227
+ case 0:
228
+ case 9:
229
+ case 10:
230
+ case 13:
231
+ case 32: return 5;
232
+ case 33:
233
+ case 43:
234
+ case 44:
235
+ case 47:
236
+ case 62:
237
+ case 64:
238
+ case 126:
239
+ case 59:
240
+ case 123:
241
+ case 125: return 4;
242
+ case 58: return 3;
243
+ case 34:
244
+ case 39:
245
+ case 40:
246
+ case 91: return 2;
247
+ case 41:
248
+ case 93: return 1;
249
+ }
250
+ return 0;
251
+ }
252
+ /**
253
+ * @param {string} value
254
+ * @return {any[]}
255
+ */
256
+ function alloc(value) {
257
+ return line = column = 1, length = strlen(characters = value), position = 0, [];
258
+ }
259
+ /**
260
+ * @param {any} value
261
+ * @return {any}
262
+ */
263
+ function dealloc(value) {
264
+ return characters = "", value;
265
+ }
266
+ /**
267
+ * @param {number} type
268
+ * @return {string}
269
+ */
270
+ function delimit(type) {
271
+ return trim(slice(position - 1, delimiter(type === 91 ? type + 2 : type === 40 ? type + 1 : type)));
272
+ }
273
+ /**
274
+ * @param {number} type
275
+ * @return {string}
276
+ */
277
+ function whitespace(type) {
278
+ while (character = peek()) if (character < 33) next();
279
+ else break;
280
+ return token(type) > 2 || token(character) > 3 ? "" : " ";
281
+ }
282
+ /**
283
+ * @param {number} index
284
+ * @param {number} count
285
+ * @return {string}
286
+ */
287
+ function escaping(index, count) {
288
+ while (--count && next()) if (character < 48 || character > 102 || character > 57 && character < 65 || character > 70 && character < 97) break;
289
+ return slice(index, caret() + (count < 6 && peek() == 32 && next() == 32));
290
+ }
291
+ /**
292
+ * @param {number} type
293
+ * @return {number}
294
+ */
295
+ function delimiter(type) {
296
+ while (next()) switch (character) {
297
+ case type: return position;
298
+ case 34:
299
+ case 39:
300
+ if (type !== 34 && type !== 39) delimiter(character);
301
+ break;
302
+ case 40:
303
+ if (type === 41) delimiter(type);
304
+ break;
305
+ case 92:
306
+ next();
307
+ break;
308
+ }
309
+ return position;
310
+ }
311
+ /**
312
+ * @param {number} type
313
+ * @param {number} index
314
+ * @return {number}
315
+ */
316
+ function commenter(type, index) {
317
+ while (next()) if (type + character === 57) break;
318
+ else if (type + character === 84 && peek() === 47) break;
319
+ return "/*" + slice(index, position - 1) + "*" + from(type === 47 ? type : next());
320
+ }
321
+ /**
322
+ * @param {number} index
323
+ * @return {string}
324
+ */
325
+ function identifier(index) {
326
+ while (!token(peek())) next();
327
+ return slice(index, position);
328
+ }
329
+
330
+ //#endregion
331
+ //#region ../../node_modules/.pnpm/stylis@4.4.0/node_modules/stylis/src/Parser.js
332
+ /**
333
+ * @param {string} value
334
+ * @return {object[]}
335
+ */
336
+ function compile(value) {
337
+ return dealloc(parse$1("", null, null, null, [""], value = alloc(value), 0, [0], value));
338
+ }
339
+ /**
340
+ * @param {string} value
341
+ * @param {object} root
342
+ * @param {object?} parent
343
+ * @param {string[]} rule
344
+ * @param {string[]} rules
345
+ * @param {string[]} rulesets
346
+ * @param {number[]} pseudo
347
+ * @param {number[]} points
348
+ * @param {string[]} declarations
349
+ * @return {object}
350
+ */
351
+ function parse$1(value, root, parent, rule, rules, rulesets, pseudo, points, declarations) {
352
+ var index = 0;
353
+ var offset = 0;
354
+ var length = pseudo;
355
+ var atrule = 0;
356
+ var property = 0;
357
+ var previous = 0;
358
+ var variable = 1;
359
+ var scanning = 1;
360
+ var ampersand = 1;
361
+ var parens = 0;
362
+ var character = 0;
363
+ var type = "";
364
+ var props = rules;
365
+ var children = rulesets;
366
+ var reference = rule;
367
+ var characters = type;
368
+ while (scanning) switch (previous = character, character = next()) {
369
+ case 40:
370
+ if (previous != 108 && charat(characters, length - 1) == 58) parens++, characters += "(";
371
+ else characters += delimit(character);
372
+ break;
373
+ case 41:
374
+ parens--, characters += ")";
375
+ break;
376
+ case 34:
377
+ case 39:
378
+ case 91:
379
+ characters += delimit(character);
380
+ break;
381
+ case 9:
382
+ case 10:
383
+ case 13:
384
+ case 32:
385
+ if (parens > 0) {
386
+ characters += from(character);
387
+ break;
388
+ }
389
+ characters += whitespace(previous);
390
+ break;
391
+ case 92:
392
+ characters += escaping(caret() - 1, 7);
393
+ continue;
394
+ case 47:
395
+ switch (peek()) {
396
+ case 42:
397
+ case 47:
398
+ append(comment(commenter(next(), caret()), root, parent, declarations), declarations);
399
+ if ((token(previous || 1) == 5 || token(peek() || 1) == 5) && strlen(characters) && substr(characters, -1, void 0) !== " ") characters += " ";
400
+ break;
401
+ default: characters += "/";
402
+ }
403
+ break;
404
+ case 123 * variable: points[index++] = strlen(characters) * ampersand;
405
+ case 125 * variable:
406
+ case 59:
407
+ case 0:
408
+ if (parens > 0 && character) {
409
+ characters += from(character);
410
+ break;
411
+ }
412
+ switch (character) {
413
+ case 0:
414
+ case 125: scanning = 0;
415
+ case 59 + offset:
416
+ if (ampersand == -1) characters = replace(characters, /\f/g, "");
417
+ if (property > 0 && (strlen(characters) - length || variable === 0)) append(property > 32 ? declaration(characters + ";", rule, parent, length - 1, declarations) : declaration(replace(characters, " ", "") + ";", rule, parent, length - 2, declarations), declarations);
418
+ break;
419
+ case 59: characters += ";";
420
+ default:
421
+ append(reference = ruleset(characters, root, parent, index, offset, rules, points, type, props = [], children = [], length, rulesets), rulesets);
422
+ if (character === 123) if (offset === 0) parse$1(characters, root, reference, reference, props, rulesets, length, points, children);
423
+ else {
424
+ switch (atrule) {
425
+ case 99: if (charat(characters, 3) === 110) break;
426
+ case 108: if (charat(characters, 2) === 97) break;
427
+ default: offset = 0;
428
+ case 100:
429
+ case 109:
430
+ case 115:
431
+ }
432
+ if (offset) parse$1(value, reference, reference, rule && append(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length, children), children), rules, children, length, points, rule ? props : children);
433
+ else parse$1(characters, reference, reference, reference, [""], children, 0, points, children);
434
+ }
435
+ }
436
+ index = offset = property = 0, variable = ampersand = 1, type = characters = "", length = pseudo;
437
+ break;
438
+ case 58: length = 1 + strlen(characters), property = previous;
439
+ default:
440
+ if (variable < 1) {
441
+ if (character == 123) --variable;
442
+ else if (character == 125 && variable++ == 0 && prev() == 125) continue;
443
+ }
444
+ switch (characters += from(character), character * variable) {
445
+ case 38:
446
+ ampersand = offset > 0 ? 1 : (characters += "\f", -1);
447
+ break;
448
+ case 44:
449
+ if (parens > 0) break;
450
+ points[index++] = (strlen(characters) - 1) * ampersand, ampersand = 1;
451
+ break;
452
+ case 64:
453
+ if (peek() === 45) characters += delimit(next());
454
+ atrule = peek(), offset = length = strlen(type = characters += identifier(caret())), character++;
455
+ break;
456
+ case 45: if (previous === 45 && strlen(characters) == 2) variable = 0;
457
+ }
458
+ }
459
+ return rulesets;
460
+ }
461
+ /**
462
+ * @param {string} value
463
+ * @param {object} root
464
+ * @param {object?} parent
465
+ * @param {number} index
466
+ * @param {number} offset
467
+ * @param {string[]} rules
468
+ * @param {number[]} points
469
+ * @param {string} type
470
+ * @param {string[]} props
471
+ * @param {string[]} children
472
+ * @param {number} length
473
+ * @param {object[]} siblings
474
+ * @return {object}
475
+ */
476
+ function ruleset(value, root, parent, index, offset, rules, points, type, props, children, length, siblings) {
477
+ var post = offset - 1;
478
+ var rule = offset === 0 ? rules : [""];
479
+ var size = sizeof(rule);
480
+ for (var i = 0, j = 0, k = 0; i < index; ++i) for (var x = 0, y = substr(value, post + 1, post = abs(j = points[i])), z = value; x < size; ++x) if (z = trim(j > 0 ? rule[x] + " " + y : replace(y, /&\f/g, rule[x]))) props[k++] = z;
481
+ return node(value, root, parent, offset === 0 ? RULESET : type, props, children, length, siblings);
482
+ }
483
+ /**
484
+ * @param {number} value
485
+ * @param {object} root
486
+ * @param {object?} parent
487
+ * @param {object[]} siblings
488
+ * @return {object}
489
+ */
490
+ function comment(value, root, parent, siblings) {
491
+ return node(value, root, parent, COMMENT, from(char()), substr(value, 2, -2), 0, siblings);
492
+ }
493
+ /**
494
+ * @param {string} value
495
+ * @param {object} root
496
+ * @param {object?} parent
497
+ * @param {number} length
498
+ * @param {object[]} siblings
499
+ * @return {object}
500
+ */
501
+ function declaration(value, root, parent, length, siblings) {
502
+ return node(value, root, parent, DECLARATION, substr(value, 0, length), substr(value, length + 1, -1), length, siblings);
503
+ }
504
+
505
+ //#endregion
506
+ //#region ../../node_modules/.pnpm/stylis@4.4.0/node_modules/stylis/src/Serializer.js
507
+ /**
508
+ * @param {object[]} children
509
+ * @param {function} callback
510
+ * @return {string}
511
+ */
512
+ function serialize(children, callback) {
513
+ var output = "";
514
+ for (var i = 0; i < children.length; i++) output += callback(children[i], i, children, callback) || "";
515
+ return output;
516
+ }
517
+ /**
518
+ * @param {object} element
519
+ * @param {number} index
520
+ * @param {object[]} children
521
+ * @param {function} callback
522
+ * @return {string}
523
+ */
524
+ function stringify(element, index, children, callback) {
525
+ switch (element.type) {
526
+ case LAYER: if (element.children.length) break;
527
+ case IMPORT:
528
+ case NAMESPACE:
529
+ case DECLARATION: return element.return = element.return || element.value;
530
+ case COMMENT: return "";
531
+ case KEYFRAMES: return element.return = element.value + "{" + serialize(element.children, callback) + "}";
532
+ case RULESET: if (!strlen(element.value = element.props.join(","))) return "";
533
+ }
534
+ return strlen(children = serialize(element.children, callback)) ? element.return = element.value + "{" + children + "}" : "";
535
+ }
536
+
537
+ //#endregion
538
+ //#region ../../node_modules/.pnpm/stylis@4.4.0/node_modules/stylis/src/Middleware.js
539
+ /**
540
+ * @param {function[]} collection
541
+ * @return {function}
542
+ */
543
+ function middleware(collection) {
544
+ var length = sizeof(collection);
545
+ return function(element, index, children, callback) {
546
+ var output = "";
547
+ for (var i = 0; i < length; i++) output += collection[i](element, index, children, callback) || "";
548
+ return output;
549
+ };
550
+ }
551
+
552
+ //#endregion
553
+ //#region ../../node_modules/.pnpm/mermaid@12.0.0/node_modules/mermaid/dist/mermaid.core.mjs
554
+ var id = "c4";
555
+ var c4Detector_default = {
556
+ id,
557
+ detector: /* @__PURE__ */ __name((txt) => {
558
+ return /^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(txt);
559
+ }, "detector"),
560
+ loader: /* @__PURE__ */ __name(async () => {
561
+ const { diagram: diagram2 } = await import("./c4Diagram-YGBWAQC7-BLmA_JSd.js");
562
+ return {
563
+ id,
564
+ diagram: diagram2
565
+ };
566
+ }, "loader")
567
+ };
568
+ var id2 = "flowchart-v2";
569
+ var flowDetector_v2_default = {
570
+ id: id2,
571
+ detector: /* @__PURE__ */ __name((txt) => /^\s*(graph|flowchart)/.test(txt), "detector"),
572
+ loader: /* @__PURE__ */ __name(async () => {
573
+ const { diagram: diagram2 } = await import("./flowDiagram-KWPJA3E3-CcUJ6HbV.js");
574
+ return {
575
+ id: id2,
576
+ diagram: diagram2
577
+ };
578
+ }, "loader")
579
+ };
580
+ var id3 = "agentflow";
581
+ var afDetector_default = {
582
+ id: id3,
583
+ detector: /* @__PURE__ */ __name((txt) => {
584
+ return /^\s*agentflow-beta\b/.test(txt);
585
+ }, "detector"),
586
+ loader: /* @__PURE__ */ __name(async () => {
587
+ const { diagram: diagram2 } = await import("./diagram-22UHCM2B-DvgzhUzP.js");
588
+ return {
589
+ id: id3,
590
+ diagram: diagram2
591
+ };
592
+ }, "loader")
593
+ };
594
+ var id4 = "swimlane";
595
+ var detector_default = {
596
+ id: id4,
597
+ detector: /* @__PURE__ */ __name((txt) => {
598
+ return /^\s*swimlane-beta\b/.test(txt);
599
+ }, "detector"),
600
+ loader: /* @__PURE__ */ __name(async () => {
601
+ const { diagram: diagram2 } = await import("./swimlanesDiagram-TC7HE7FX-BUx29EJ9.js");
602
+ return {
603
+ id: id4,
604
+ diagram: diagram2
605
+ };
606
+ }, "loader")
607
+ };
608
+ var id5 = "er";
609
+ var erDetector_default = {
610
+ id: id5,
611
+ detector: /* @__PURE__ */ __name((txt) => {
612
+ return /^\s*erDiagram/.test(txt);
613
+ }, "detector"),
614
+ loader: /* @__PURE__ */ __name(async () => {
615
+ const { diagram: diagram2 } = await import("./erDiagram-OPXOYQCR-CPTbKhwP.js");
616
+ return {
617
+ id: id5,
618
+ diagram: diagram2
619
+ };
620
+ }, "loader")
621
+ };
622
+ var id6 = "gitGraph";
623
+ var gitGraphDetector_default = {
624
+ id: id6,
625
+ detector: /* @__PURE__ */ __name((txt) => {
626
+ return /^\s*gitGraph/.test(txt);
627
+ }, "detector"),
628
+ loader: /* @__PURE__ */ __name(async () => {
629
+ const { diagram: diagram2 } = await import("./gitGraphDiagram-X574FWY7-DKuxJymB.js");
630
+ return {
631
+ id: id6,
632
+ diagram: diagram2
633
+ };
634
+ }, "loader")
635
+ };
636
+ var id7 = "gantt";
637
+ var ganttDetector_default = {
638
+ id: id7,
639
+ detector: /* @__PURE__ */ __name((txt) => {
640
+ return /^\s*gantt/.test(txt);
641
+ }, "detector"),
642
+ loader: /* @__PURE__ */ __name(async () => {
643
+ const { diagram: diagram2 } = await import("./ganttDiagram-FUAMR5RP-31UjY0KK.js");
644
+ return {
645
+ id: id7,
646
+ diagram: diagram2
647
+ };
648
+ }, "loader")
649
+ };
650
+ var id8 = "info";
651
+ var info = {
652
+ id: id8,
653
+ detector: /* @__PURE__ */ __name((txt) => {
654
+ return /^\s*info/.test(txt);
655
+ }, "detector"),
656
+ loader: /* @__PURE__ */ __name(async () => {
657
+ const { diagram: diagram2 } = await import("./infoDiagram-VRGFBTTK-pRspGfjZ.js");
658
+ return {
659
+ id: id8,
660
+ diagram: diagram2
661
+ };
662
+ }, "loader")
663
+ };
664
+ var id9 = "pie";
665
+ var pie = {
666
+ id: id9,
667
+ detector: /* @__PURE__ */ __name((txt) => {
668
+ return /^\s*pie/.test(txt);
669
+ }, "detector"),
670
+ loader: /* @__PURE__ */ __name(async () => {
671
+ const { diagram: diagram2 } = await import("./pieDiagram-5QR66LMP-laoaV_PB.js");
672
+ return {
673
+ id: id9,
674
+ diagram: diagram2
675
+ };
676
+ }, "loader")
677
+ };
678
+ var id10 = "quadrantChart";
679
+ var quadrantDetector_default = {
680
+ id: id10,
681
+ detector: /* @__PURE__ */ __name((txt) => {
682
+ return /^\s*quadrantChart/.test(txt);
683
+ }, "detector"),
684
+ loader: /* @__PURE__ */ __name(async () => {
685
+ const { diagram: diagram2 } = await import("./quadrantDiagram-O4NWA36T-Db_wFBkT.js");
686
+ return {
687
+ id: id10,
688
+ diagram: diagram2
689
+ };
690
+ }, "loader")
691
+ };
692
+ var id11 = "xychart";
693
+ var xychartDetector_default = {
694
+ id: id11,
695
+ detector: /* @__PURE__ */ __name((txt) => {
696
+ return /^\s*xychart(-beta)?/.test(txt);
697
+ }, "detector"),
698
+ loader: /* @__PURE__ */ __name(async () => {
699
+ const { diagram: diagram2 } = await import("./xychartDiagram-PMCCYNJV-e1TeVoc6.js");
700
+ return {
701
+ id: id11,
702
+ diagram: diagram2
703
+ };
704
+ }, "loader")
705
+ };
706
+ var id12 = "requirement";
707
+ var requirementDetector_default = {
708
+ id: id12,
709
+ detector: /* @__PURE__ */ __name((txt) => {
710
+ return /^\s*requirement(Diagram)?/.test(txt);
711
+ }, "detector"),
712
+ loader: /* @__PURE__ */ __name(async () => {
713
+ const { diagram: diagram2 } = await import("./requirementDiagram-PLB6GJNP-3rkQfEhs.js");
714
+ return {
715
+ id: id12,
716
+ diagram: diagram2
717
+ };
718
+ }, "loader")
719
+ };
720
+ var id13 = "sequence";
721
+ var sequenceDetector_default = {
722
+ id: id13,
723
+ detector: /* @__PURE__ */ __name((txt) => {
724
+ return /^\s*sequenceDiagram/.test(txt);
725
+ }, "detector"),
726
+ loader: /* @__PURE__ */ __name(async () => {
727
+ const { diagram: diagram2 } = await import("./sequenceDiagram-PO4LG4MO-9FJjFX06.js");
728
+ return {
729
+ id: id13,
730
+ diagram: diagram2
731
+ };
732
+ }, "loader")
733
+ };
734
+ var id14 = "classDiagram";
735
+ var classDetector_V2_default = {
736
+ id: id14,
737
+ detector: /* @__PURE__ */ __name((txt) => /^\s*classDiagram/.test(txt), "detector"),
738
+ loader: /* @__PURE__ */ __name(async () => {
739
+ const { diagram: diagram2 } = await import("./classDiagram-v2-NBCMYWYE-BqnOWIUt.js");
740
+ return {
741
+ id: id14,
742
+ diagram: diagram2
743
+ };
744
+ }, "loader")
745
+ };
746
+ var id15 = "stateDiagram";
747
+ var stateDetector_V2_default = {
748
+ id: id15,
749
+ detector: /* @__PURE__ */ __name((txt) => /^\s*stateDiagram/.test(txt), "detector"),
750
+ loader: /* @__PURE__ */ __name(async () => {
751
+ const { diagram: diagram2 } = await import("./stateDiagram-v2-GCMORJYK-B0O3wc1-.js");
752
+ return {
753
+ id: id15,
754
+ diagram: diagram2
755
+ };
756
+ }, "loader")
757
+ };
758
+ var id16 = "journey";
759
+ var journeyDetector_default = {
760
+ id: id16,
761
+ detector: /* @__PURE__ */ __name((txt) => {
762
+ return /^\s*journey/.test(txt);
763
+ }, "detector"),
764
+ loader: /* @__PURE__ */ __name(async () => {
765
+ const { diagram: diagram2 } = await import("./journeyDiagram-ZHPQQLJL-C4MK-YO5.js");
766
+ return {
767
+ id: id16,
768
+ diagram: diagram2
769
+ };
770
+ }, "loader")
771
+ };
772
+ var renderer = { draw: /* @__PURE__ */ __name((_text, id38, version) => {
773
+ log.debug("rendering svg for syntax error\n");
774
+ const svg = selectSvgElement(id38);
775
+ const g = svg.append("g");
776
+ svg.attr("viewBox", "0 0 2412 512");
777
+ configureSvgSize(svg, 100, 512, true);
778
+ g.append("path").attr("class", "error-icon").attr("d", "m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z");
779
+ g.append("path").attr("class", "error-icon").attr("d", "m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z");
780
+ g.append("path").attr("class", "error-icon").attr("d", "m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z");
781
+ g.append("path").attr("class", "error-icon").attr("d", "m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z");
782
+ g.append("path").attr("class", "error-icon").attr("d", "m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z");
783
+ g.append("path").attr("class", "error-icon").attr("d", "m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z");
784
+ g.append("text").attr("class", "error-text").attr("x", 1440).attr("y", 250).attr("font-size", "150px").style("text-anchor", "middle").text("Syntax error in text");
785
+ g.append("text").attr("class", "error-text").attr("x", 1250).attr("y", 400).attr("font-size", "100px").style("text-anchor", "middle").text(`mermaid version ${version}`);
786
+ }, "draw") };
787
+ var errorRenderer_default = renderer;
788
+ var errorDiagram_default = {
789
+ db: {},
790
+ renderer,
791
+ parser: { parse: /* @__PURE__ */ __name(() => {}, "parse") }
792
+ };
793
+ var id17 = "flowchart-elk";
794
+ var detector_default2 = {
795
+ id: id17,
796
+ detector: /* @__PURE__ */ __name((txt, config = {}) => {
797
+ if (/^\s*flowchart-elk/.test(txt)) {
798
+ config.layout = "elk";
799
+ return true;
800
+ }
801
+ return false;
802
+ }, "detector"),
803
+ loader: /* @__PURE__ */ __name(async () => {
804
+ const { diagram: diagram2 } = await import("./flowDiagram-KWPJA3E3-CcUJ6HbV.js");
805
+ return {
806
+ id: id17,
807
+ diagram: diagram2
808
+ };
809
+ }, "loader")
810
+ };
811
+ var id18 = "timeline";
812
+ var detector_default3 = {
813
+ id: id18,
814
+ detector: /* @__PURE__ */ __name((txt) => {
815
+ return /^\s*timeline/.test(txt);
816
+ }, "detector"),
817
+ loader: /* @__PURE__ */ __name(async () => {
818
+ const { diagram: diagram2 } = await import("./timeline-definition-EJHVYXUP-CrgiiB4C.js");
819
+ return {
820
+ id: id18,
821
+ diagram: diagram2
822
+ };
823
+ }, "loader")
824
+ };
825
+ var id19 = "mindmap";
826
+ var detector_default4 = {
827
+ id: id19,
828
+ detector: /* @__PURE__ */ __name((txt) => {
829
+ return /^\s*mindmap/.test(txt);
830
+ }, "detector"),
831
+ loader: /* @__PURE__ */ __name(async () => {
832
+ const { diagram: diagram2 } = await import("./mindmap-definition-NLK3R4M7-CXbD-myG.js");
833
+ return {
834
+ id: id19,
835
+ diagram: diagram2
836
+ };
837
+ }, "loader")
838
+ };
839
+ var id20 = "kanban";
840
+ var detector_default5 = {
841
+ id: id20,
842
+ detector: /* @__PURE__ */ __name((txt) => {
843
+ return /^\s*kanban/.test(txt);
844
+ }, "detector"),
845
+ loader: /* @__PURE__ */ __name(async () => {
846
+ const { diagram: diagram2 } = await import("./kanban-definition-PNTS6WVX-BqsZpMXx.js");
847
+ return {
848
+ id: id20,
849
+ diagram: diagram2
850
+ };
851
+ }, "loader")
852
+ };
853
+ var id21 = "sankey";
854
+ var sankeyDetector_default = {
855
+ id: id21,
856
+ detector: /* @__PURE__ */ __name((txt) => {
857
+ return /^\s*sankey(-beta)?/.test(txt);
858
+ }, "detector"),
859
+ loader: /* @__PURE__ */ __name(async () => {
860
+ const { diagram: diagram2 } = await import("./sankeyDiagram-IPEJSGJF-CGAJhyG2.js");
861
+ return {
862
+ id: id21,
863
+ diagram: diagram2
864
+ };
865
+ }, "loader")
866
+ };
867
+ var id22 = "packet";
868
+ var packet = {
869
+ id: id22,
870
+ detector: /* @__PURE__ */ __name((txt) => {
871
+ return /^\s*packet(-beta)?/.test(txt);
872
+ }, "detector"),
873
+ loader: /* @__PURE__ */ __name(async () => {
874
+ const { diagram: diagram2 } = await import("./diagram-MLGK6HIB-6w5qmkGt.js");
875
+ return {
876
+ id: id22,
877
+ diagram: diagram2
878
+ };
879
+ }, "loader")
880
+ };
881
+ var id23 = "radar";
882
+ var radar = {
883
+ id: id23,
884
+ detector: /* @__PURE__ */ __name((txt) => {
885
+ return /^\s*radar-beta/.test(txt);
886
+ }, "detector"),
887
+ loader: /* @__PURE__ */ __name(async () => {
888
+ const { diagram: diagram2 } = await import("./diagram-MPIPVDR6-DEFiSo8o.js");
889
+ return {
890
+ id: id23,
891
+ diagram: diagram2
892
+ };
893
+ }, "loader")
894
+ };
895
+ var id24 = "block";
896
+ var blockDetector_default = {
897
+ id: id24,
898
+ detector: /* @__PURE__ */ __name((txt) => {
899
+ return /^\s*block(-beta)?/.test(txt);
900
+ }, "detector"),
901
+ loader: /* @__PURE__ */ __name(async () => {
902
+ const { diagram: diagram2 } = await import("./blockDiagram-BEXU5L5S-D4yjnCD1.js");
903
+ return {
904
+ id: id24,
905
+ diagram: diagram2
906
+ };
907
+ }, "loader")
908
+ };
909
+ var id25 = "treeView";
910
+ var detector_default6 = {
911
+ id: id25,
912
+ detector: /* @__PURE__ */ __name((txt) => {
913
+ return /^\s*treeView-beta/.test(txt);
914
+ }, "detector"),
915
+ loader: /* @__PURE__ */ __name(async () => {
916
+ const { diagram: diagram2 } = await import("./diagram-CDSNMT55-BUlZuLUe.js");
917
+ return {
918
+ id: id25,
919
+ diagram: diagram2
920
+ };
921
+ }, "loader")
922
+ };
923
+ var id26 = "architecture";
924
+ var architectureDetector_default = {
925
+ id: id26,
926
+ detector: /* @__PURE__ */ __name((txt) => {
927
+ return /^\s*architecture/.test(txt);
928
+ }, "detector"),
929
+ loader: /* @__PURE__ */ __name(async () => {
930
+ const { diagram: diagram2 } = await import("./architectureDiagram-NJMV4G6O-XmmXrJAK.js");
931
+ return {
932
+ id: id26,
933
+ diagram: diagram2
934
+ };
935
+ }, "loader")
936
+ };
937
+ var id27 = "eventmodeling";
938
+ var detector_default7 = {
939
+ id: id27,
940
+ detector: /* @__PURE__ */ __name((txt) => {
941
+ return /^\s*eventmodeling/.test(txt);
942
+ }, "detector"),
943
+ loader: /* @__PURE__ */ __name(async () => {
944
+ const { diagram: diagram2 } = await import("./diagram-ATOU4E4O-P1olqwIs.js");
945
+ return {
946
+ id: id27,
947
+ diagram: diagram2
948
+ };
949
+ }, "loader")
950
+ };
951
+ var id28 = "ishikawa";
952
+ var ishikawa = {
953
+ id: id28,
954
+ detector: /* @__PURE__ */ __name((txt) => {
955
+ return /^\s*ishikawa(-beta)?\b/i.test(txt);
956
+ }, "detector"),
957
+ loader: /* @__PURE__ */ __name(async () => {
958
+ const { diagram: diagram2 } = await import("./ishikawaDiagram-OU5B5YK6-DKerAPAg.js");
959
+ return {
960
+ id: id28,
961
+ diagram: diagram2
962
+ };
963
+ }, "loader")
964
+ };
965
+ var id29 = "venn";
966
+ var vennDetector_default = {
967
+ id: id29,
968
+ detector: /* @__PURE__ */ __name((txt) => {
969
+ return /^\s*venn-beta/.test(txt);
970
+ }, "detector"),
971
+ loader: /* @__PURE__ */ __name(async () => {
972
+ const { diagram: diagram2 } = await import("./vennDiagram-UO4OBE2U-CwXr0wjA.js");
973
+ return {
974
+ id: id29,
975
+ diagram: diagram2
976
+ };
977
+ }, "loader")
978
+ };
979
+ var id30 = "treemap";
980
+ var treemap = {
981
+ id: id30,
982
+ detector: /* @__PURE__ */ __name((txt) => {
983
+ return /^\s*treemap/.test(txt);
984
+ }, "detector"),
985
+ loader: /* @__PURE__ */ __name(async () => {
986
+ const { diagram: diagram2 } = await import("./diagram-3UASUU5V-DWgUB-ef.js");
987
+ return {
988
+ id: id30,
989
+ diagram: diagram2
990
+ };
991
+ }, "loader")
992
+ };
993
+ var id31 = "usecase";
994
+ var usecase = {
995
+ id: id31,
996
+ detector: /* @__PURE__ */ __name((txt) => {
997
+ return /^\s*usecase-beta(?:\s|$)/.test(txt);
998
+ }, "detector"),
999
+ loader: /* @__PURE__ */ __name(async () => {
1000
+ const { diagram: diagram2 } = await import("./usecaseDiagram-POWQR4AR-BUt_TQOY.js");
1001
+ return {
1002
+ id: id31,
1003
+ diagram: diagram2
1004
+ };
1005
+ }, "loader")
1006
+ };
1007
+ var id32 = "wardley";
1008
+ var wardleyDetector_default = {
1009
+ id: id32,
1010
+ detector: /* @__PURE__ */ __name((text) => {
1011
+ return /^\s*wardley-beta/i.test(text);
1012
+ }, "detector"),
1013
+ loader: /* @__PURE__ */ __name(async () => {
1014
+ const { diagram: diagram2 } = await import("./wardleyDiagram-VNRHLVJA-Cpfd47dQ.js");
1015
+ return {
1016
+ id: id32,
1017
+ diagram: diagram2
1018
+ };
1019
+ }, "loader")
1020
+ };
1021
+ var id33 = "cynefin";
1022
+ var cynefin = {
1023
+ id: id33,
1024
+ detector: /* @__PURE__ */ __name((txt) => {
1025
+ return /^\s*cynefin-beta(?:[\s:]|$)/.test(txt);
1026
+ }, "detector"),
1027
+ loader: /* @__PURE__ */ __name(async () => {
1028
+ const { diagram: diagram2 } = await import("./cynefinDiagram-VND7K2PF-yAWc6Z3W.js");
1029
+ return {
1030
+ id: id33,
1031
+ diagram: diagram2
1032
+ };
1033
+ }, "loader")
1034
+ };
1035
+ var id34 = "railroad";
1036
+ var railroad = {
1037
+ id: id34,
1038
+ detector: /* @__PURE__ */ __name((txt) => {
1039
+ return /^\s*railroad-beta/i.test(txt);
1040
+ }, "detector"),
1041
+ loader: /* @__PURE__ */ __name(async () => {
1042
+ const { diagram: diagram2 } = await import("./railroadDiagram-XR7U4H2S-BY0sTM4X.js");
1043
+ return {
1044
+ id: id34,
1045
+ diagram: diagram2
1046
+ };
1047
+ }, "loader")
1048
+ };
1049
+ var id35 = "railroadEbnf";
1050
+ var railroadEbnf = {
1051
+ id: id35,
1052
+ detector: /* @__PURE__ */ __name((txt) => {
1053
+ return /^\s*railroad-ebnf-beta/i.test(txt);
1054
+ }, "detector"),
1055
+ loader: /* @__PURE__ */ __name(async () => {
1056
+ const { diagram: diagram2 } = await import("./ebnfDiagram-ZINNZB2B-CI8liCfR.js");
1057
+ return {
1058
+ id: id35,
1059
+ diagram: diagram2
1060
+ };
1061
+ }, "loader")
1062
+ };
1063
+ var id36 = "railroadAbnf";
1064
+ var railroadAbnf = {
1065
+ id: id36,
1066
+ detector: /* @__PURE__ */ __name((txt) => {
1067
+ return /^\s*railroad-abnf-beta/i.test(txt);
1068
+ }, "detector"),
1069
+ loader: /* @__PURE__ */ __name(async () => {
1070
+ const { diagram: diagram2 } = await import("./abnfDiagram-O67JEVCF-DtYFjfqO.js");
1071
+ return {
1072
+ id: id36,
1073
+ diagram: diagram2
1074
+ };
1075
+ }, "loader")
1076
+ };
1077
+ var id37 = "railroadPeg";
1078
+ var railroadPeg = {
1079
+ id: id37,
1080
+ detector: /* @__PURE__ */ __name((txt) => {
1081
+ return /^\s*railroad-peg-beta/i.test(txt);
1082
+ }, "detector"),
1083
+ loader: /* @__PURE__ */ __name(async () => {
1084
+ const { diagram: diagram2 } = await import("./pegDiagram-GJSIUBJH-BLGJOewQ.js");
1085
+ return {
1086
+ id: id37,
1087
+ diagram: diagram2
1088
+ };
1089
+ }, "loader")
1090
+ };
1091
+ var hasLoadedDiagrams = false;
1092
+ var addDiagrams = /* @__PURE__ */ __name(() => {
1093
+ if (hasLoadedDiagrams) return;
1094
+ hasLoadedDiagrams = true;
1095
+ registerDiagram("error", errorDiagram_default, (text) => {
1096
+ return text.toLowerCase().trim() === "error";
1097
+ });
1098
+ registerDiagram("---", {
1099
+ db: { clear: /* @__PURE__ */ __name(() => {}, "clear") },
1100
+ styles: {},
1101
+ renderer: { draw: /* @__PURE__ */ __name(() => {}, "draw") },
1102
+ parser: { parse: /* @__PURE__ */ __name(() => {
1103
+ throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks");
1104
+ }, "parse") },
1105
+ init: /* @__PURE__ */ __name(() => null, "init")
1106
+ }, (text) => {
1107
+ return text.toLowerCase().trimStart().startsWith("---");
1108
+ });
1109
+ registerLazyLoadedDiagrams(detector_default2, detector_default4, architectureDetector_default);
1110
+ registerLazyLoadedDiagrams(afDetector_default, c4Detector_default, detector_default5, classDetector_V2_default, erDetector_default, ganttDetector_default, info, pie, requirementDetector_default, sequenceDetector_default, detector_default, flowDetector_v2_default, detector_default3, gitGraphDetector_default, stateDetector_V2_default, journeyDetector_default, quadrantDetector_default, sankeyDetector_default, packet, xychartDetector_default, blockDetector_default, detector_default7, detector_default6, radar, ishikawa, treemap, railroad, railroadEbnf, railroadAbnf, railroadPeg, vennDetector_default, wardleyDetector_default, cynefin, usecase);
1111
+ }, "addDiagrams");
1112
+ var loadRegisteredDiagrams = /* @__PURE__ */ __name(async () => {
1113
+ log.debug(`Loading registered diagrams`);
1114
+ const failed = (await Promise.allSettled(Object.entries(detectors).map(async ([key, { detector: detector38, loader: loader38 }]) => {
1115
+ if (!loader38) return;
1116
+ try {
1117
+ getDiagram(key);
1118
+ } catch {
1119
+ try {
1120
+ const { diagram: diagram2, id: id38 } = await loader38();
1121
+ registerDiagram(id38, diagram2, detector38);
1122
+ } catch (err) {
1123
+ log.error(`Failed to load external diagram with key ${key}. Removing from detectors.`);
1124
+ delete detectors[key];
1125
+ throw err;
1126
+ }
1127
+ }
1128
+ }))).filter((result) => result.status === "rejected");
1129
+ if (failed.length > 0) {
1130
+ log.error(`Failed to load ${failed.length} external diagrams`);
1131
+ for (const res of failed) log.error(res);
1132
+ throw new Error(`Failed to load ${failed.length} external diagrams`);
1133
+ }
1134
+ }, "loadRegisteredDiagrams");
1135
+ var SVG_ROLE = "graphics-document document";
1136
+ function setA11yDiagramInfo(svg, diagramType) {
1137
+ svg.attr("role", SVG_ROLE);
1138
+ if (diagramType !== "") svg.attr("aria-roledescription", diagramType);
1139
+ }
1140
+ __name(setA11yDiagramInfo, "setA11yDiagramInfo");
1141
+ function addSVGa11yTitleDescription(svg, a11yTitle, a11yDesc, baseId) {
1142
+ if (svg.insert === void 0) return;
1143
+ if (a11yDesc) {
1144
+ const descId = `chart-desc-${baseId}`;
1145
+ svg.attr("aria-describedby", descId);
1146
+ svg.insert("desc", ":first-child").attr("id", descId).text(a11yDesc);
1147
+ }
1148
+ if (a11yTitle) {
1149
+ const titleId = `chart-title-${baseId}`;
1150
+ svg.attr("aria-labelledby", titleId);
1151
+ svg.insert("title", ":first-child").attr("id", titleId).text(a11yTitle);
1152
+ }
1153
+ }
1154
+ __name(addSVGa11yTitleDescription, "addSVGa11yTitleDescription");
1155
+ var Diagram = class _Diagram {
1156
+ constructor(type, text, db, parser, renderer2) {
1157
+ this.type = type;
1158
+ this.text = text;
1159
+ this.db = db;
1160
+ this.parser = parser;
1161
+ this.renderer = renderer2;
1162
+ }
1163
+ static {
1164
+ __name(this, "Diagram");
1165
+ }
1166
+ static async fromText(codeObjectOrText, metadata = {}) {
1167
+ const code = typeof codeObjectOrText === "string" ? {
1168
+ raw: codeObjectOrText,
1169
+ cleaned: codeObjectOrText
1170
+ } : codeObjectOrText;
1171
+ const config = getConfig();
1172
+ const type = detectType(code.cleaned, config);
1173
+ try {
1174
+ getDiagram(type);
1175
+ } catch {
1176
+ const loader38 = getDiagramLoader(type);
1177
+ if (!loader38) throw new UnknownDiagramError(`Diagram ${type} not found.`);
1178
+ const { id: id38, diagram: diagram2 } = await loader38();
1179
+ registerDiagram(id38, diagram2);
1180
+ }
1181
+ const { db, parser, renderer: renderer2, init: init2 } = getDiagram(type);
1182
+ if (parser.parser) parser.parser.yy = db;
1183
+ db.clear?.();
1184
+ init2?.(config);
1185
+ if (metadata.title) db.setDiagramTitle?.(metadata.title);
1186
+ let source = code.cleaned;
1187
+ if (db.preserveCommentsWhenParsing && code.withComments) {
1188
+ const maxTextSize = config.maxTextSize ?? defaultConfig_default.maxTextSize;
1189
+ if (code.withComments.length > maxTextSize) log.warn(`Comment-preserving source exceeds maxTextSize (${code.withComments.length} > ${maxTextSize}); parsing the comment-stripped text instead. Reported source positions will not account for comment lines.`);
1190
+ else source = code.withComments;
1191
+ }
1192
+ const textToParse = encodeEntities(source) + "\n";
1193
+ if (code.frontmatterLineOffset) db.setFrontmatterLineOffset?.(code.frontmatterLineOffset);
1194
+ await parser.parse(textToParse);
1195
+ return new _Diagram(type, textToParse, db, parser, renderer2);
1196
+ }
1197
+ async render(id38, version) {
1198
+ await this.renderer.draw(this.text, id38, version, this);
1199
+ }
1200
+ getParser() {
1201
+ return this.parser;
1202
+ }
1203
+ getType() {
1204
+ return this.type;
1205
+ }
1206
+ };
1207
+ var interactionFunctions = [];
1208
+ var attachFunctions = /* @__PURE__ */ __name(() => {
1209
+ interactionFunctions.forEach((f) => {
1210
+ f();
1211
+ });
1212
+ interactionFunctions = [];
1213
+ }, "attachFunctions");
1214
+ var cleanupComments = /* @__PURE__ */ __name((text) => {
1215
+ return text.replace(/^\s*%%(?!{)[^\n]+\n?/gm, "").trimStart();
1216
+ }, "cleanupComments");
1217
+ function extractFrontMatter(text) {
1218
+ const matches = text.match(frontMatterRegex);
1219
+ if (!matches) return {
1220
+ text,
1221
+ metadata: {}
1222
+ };
1223
+ const indent = matches[1];
1224
+ let parsed = load(indent ? matches[2].split("\n").map((line) => line.startsWith(indent) ? line.slice(indent.length) : line).join("\n") : matches[2], { schema: JSON_SCHEMA }) ?? {};
1225
+ parsed = typeof parsed === "object" && !Array.isArray(parsed) ? parsed : {};
1226
+ const metadata = {};
1227
+ if (parsed.displayMode) metadata.displayMode = parsed.displayMode.toString();
1228
+ if (parsed.title) metadata.title = parsed.title.toString();
1229
+ if (parsed.config) metadata.config = parsed.config;
1230
+ return {
1231
+ text: text.slice(matches[0].length),
1232
+ metadata
1233
+ };
1234
+ }
1235
+ __name(extractFrontMatter, "extractFrontMatter");
1236
+ var cleanupText = /* @__PURE__ */ __name((code) => {
1237
+ return code.replace(/\r\n?/g, "\n").replace(/<(\w+)([^>]*)>/g, (match, tag, attributes) => "<" + tag + attributes.replace(/="([^"]*)"/g, "='$1'") + ">");
1238
+ }, "cleanupText");
1239
+ var processFrontmatter = /* @__PURE__ */ __name((code) => {
1240
+ const { text, metadata } = extractFrontMatter(code);
1241
+ const { displayMode, title, config = {} } = metadata;
1242
+ if (displayMode) {
1243
+ if (!config.gantt) config.gantt = {};
1244
+ config.gantt.displayMode = displayMode;
1245
+ }
1246
+ return {
1247
+ title,
1248
+ config,
1249
+ text
1250
+ };
1251
+ }, "processFrontmatter");
1252
+ var processDirectives = /* @__PURE__ */ __name((code) => {
1253
+ const initDirective = utils_default.detectInit(code) ?? {};
1254
+ const wrapDirectives = utils_default.detectDirective(code, "wrap");
1255
+ if (Array.isArray(wrapDirectives)) initDirective.wrap = wrapDirectives.some(({ type }) => type === "wrap");
1256
+ else if (wrapDirectives?.type === "wrap") initDirective.wrap = true;
1257
+ return {
1258
+ text: removeDirectives(code),
1259
+ directive: initDirective
1260
+ };
1261
+ }, "processDirectives");
1262
+ function preprocessDiagram(code) {
1263
+ const rawCode = code;
1264
+ const normalizedCode = cleanupText(code);
1265
+ const frontMatterResult = processFrontmatter(normalizedCode);
1266
+ const directiveResult = processDirectives(frontMatterResult.text);
1267
+ const config = cleanAndMerge(frontMatterResult.config, directiveResult.directive);
1268
+ const withComments = directiveResult.text;
1269
+ return {
1270
+ code: {
1271
+ raw: rawCode,
1272
+ cleaned: cleanupComments(withComments),
1273
+ withComments,
1274
+ frontmatterLineOffset: normalizedCode.length > frontMatterResult.text.length ? (normalizedCode.substring(0, normalizedCode.length - frontMatterResult.text.length).match(/\n/g) ?? []).length : 0
1275
+ },
1276
+ title: frontMatterResult.title,
1277
+ config
1278
+ };
1279
+ }
1280
+ __name(preprocessDiagram, "preprocessDiagram");
1281
+ function toBase64(str) {
1282
+ const utf8Bytes = new TextEncoder().encode(str);
1283
+ const utf8Str = Array.from(utf8Bytes, (byte) => String.fromCodePoint(byte)).join("");
1284
+ return btoa(utf8Str);
1285
+ }
1286
+ __name(toBase64, "toBase64");
1287
+ var MAX_TEXTLENGTH = 5e4;
1288
+ var MAX_TEXTLENGTH_EXCEEDED_MSG = "graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa";
1289
+ var SECURITY_LVL_SANDBOX = "sandbox";
1290
+ var SECURITY_LVL_LOOSE = "loose";
1291
+ var XMLNS_SVG_STD = "http://www.w3.org/2000/svg";
1292
+ var XMLNS_XLINK_STD = "http://www.w3.org/1999/xlink";
1293
+ var XMLNS_XHTML_STD = "http://www.w3.org/1999/xhtml";
1294
+ var IFRAME_WIDTH = "100%";
1295
+ var IFRAME_HEIGHT = "100%";
1296
+ var IFRAME_STYLES = "border:0;margin:0;";
1297
+ var IFRAME_BODY_STYLE = "margin:0";
1298
+ var IFRAME_SANDBOX_OPTS = "allow-top-navigation-by-user-activation allow-popups";
1299
+ var IFRAME_NOT_SUPPORTED_MSG = "The \"iframe\" tag is not supported by your browser.";
1300
+ var DOMPURIFY_TAGS = ["foreignobject"];
1301
+ var DOMPURIFY_ATTR = ["dominant-baseline"];
1302
+ function processAndSetConfigs(text) {
1303
+ const processed = preprocessDiagram(text);
1304
+ reset();
1305
+ let diagramType;
1306
+ try {
1307
+ diagramType = detectType(processed.code.cleaned, getConfig());
1308
+ } catch {
1309
+ diagramType = void 0;
1310
+ }
1311
+ setDiagramConfigScope(diagramType);
1312
+ addDirective(processed.config ?? {});
1313
+ return processed;
1314
+ }
1315
+ __name(processAndSetConfigs, "processAndSetConfigs");
1316
+ async function parse(text, parseOptions) {
1317
+ addDiagrams();
1318
+ try {
1319
+ const { code, config } = processAndSetConfigs(text);
1320
+ return {
1321
+ diagramType: (await Diagram.fromText(code)).type,
1322
+ config
1323
+ };
1324
+ } catch (error) {
1325
+ if (parseOptions?.suppressErrors) return false;
1326
+ throw error;
1327
+ } finally {
1328
+ setDiagramConfigScope(void 0);
1329
+ }
1330
+ }
1331
+ __name(parse, "parse");
1332
+ var cssImportantStyles = /* @__PURE__ */ __name((cssClass, element, cssClasses = []) => {
1333
+ return `.${cssClass} ${element} ${sanitizeCss(`{ ${cssClasses.join(" !important; ")} !important; }`)}`;
1334
+ }, "cssImportantStyles");
1335
+ var createCssStyles = /* @__PURE__ */ __name((config, classDefs = /* @__PURE__ */ new Map()) => {
1336
+ const cssStyles = new CSSStyleSheet();
1337
+ if (config.fontFamily !== void 0) cssStyles.insertRule(`:root { --mermaid-font-family: ${config.fontFamily}}`, cssStyles.cssRules.length);
1338
+ if (config.altFontFamily !== void 0) cssStyles.insertRule(`:root { --mermaid-alt-font-family: ${config.altFontFamily}}`, cssStyles.cssRules.length);
1339
+ if (classDefs instanceof Map) {
1340
+ const cssElements = getEffectiveHtmlLabels(config) ? ["> *", "span"] : [
1341
+ "rect",
1342
+ "polygon",
1343
+ "ellipse",
1344
+ "circle",
1345
+ "path"
1346
+ ];
1347
+ classDefs.forEach((styleClassDef) => {
1348
+ if (!isEmpty(styleClassDef.styles)) cssElements.forEach((cssElement) => {
1349
+ cssStyles.insertRule(cssImportantStyles(styleClassDef.id, cssElement, styleClassDef.styles), cssStyles.cssRules.length);
1350
+ });
1351
+ if (!isEmpty(styleClassDef.textStyles)) cssStyles.insertRule(cssImportantStyles(styleClassDef.id, "tspan", (styleClassDef?.textStyles || []).map((s) => s.replace("color", "fill"))), cssStyles.cssRules.length);
1352
+ });
1353
+ }
1354
+ let cssString = "";
1355
+ if (config.themeCSS !== void 0) if (typeof cssStyles.replaceSync === "function") {
1356
+ const themeCssStyleSheet = new CSSStyleSheet();
1357
+ themeCssStyleSheet.replaceSync(config.themeCSS);
1358
+ cssString = cssStyleSheetToString(themeCssStyleSheet) + "\n";
1359
+ } else cssString += `${config.themeCSS}
1360
+ `;
1361
+ return cssString + cssStyleSheetToString(cssStyles);
1362
+ }, "createCssStyles");
1363
+ var compileCSS = /* @__PURE__ */ __name((namespace, css) => {
1364
+ return serialize(compile(`${namespace}{${css}}`), middleware([/* @__PURE__ */ __name(function addNamespace(element, _index, _children, _callback) {
1365
+ if (element.type === "rule" && Array.isArray(element.props)) {
1366
+ if (element.parent && element.parent.type === "@keyframes") return;
1367
+ element.props = element.props.map((prop) => {
1368
+ if (prop === namespace && Array.isArray(element.children) && element.children.every((child) => {
1369
+ if (child.type !== "decl") return false;
1370
+ return (/* @__PURE__ */ new Set([
1371
+ "font-family",
1372
+ "font-size",
1373
+ "fill"
1374
+ ])).has(child.props);
1375
+ })) return prop;
1376
+ if (!((prop.startsWith(`${namespace} `) || prop.startsWith(`${namespace}>`)) && !prop.startsWith(`${namespace} ||`))) return `${namespace} ${prop}`;
1377
+ return prop;
1378
+ });
1379
+ } else if (element.type.startsWith("@")) {
1380
+ if (![...[
1381
+ "@media",
1382
+ "@supports",
1383
+ "@layer",
1384
+ "@scope",
1385
+ "@container",
1386
+ "@starting-style"
1387
+ ], "@keyframes"].includes(element.type)) {
1388
+ log.warn(`Removing unsupported at-rule ${element.type} from CSS`);
1389
+ element.type = COMMENT;
1390
+ }
1391
+ }
1392
+ }, "addNamespace"), stringify]));
1393
+ }, "compileCSS");
1394
+ var createUserStyles = /* @__PURE__ */ __name((config, graphType, classDefs, svgId) => {
1395
+ return compileCSS(svgId, styles_default(graphType, createCssStyles(config, classDefs), {
1396
+ ...config.themeVariables,
1397
+ theme: config.theme,
1398
+ look: config.look
1399
+ }, svgId));
1400
+ }, "createUserStyles");
1401
+ var cleanUpSvgCode = /* @__PURE__ */ __name((svgCode = "", inSandboxMode, useArrowMarkerUrls) => {
1402
+ let cleanedUpSvg = svgCode;
1403
+ if (!useArrowMarkerUrls && !inSandboxMode) cleanedUpSvg = cleanedUpSvg.replace(/marker-end="url\([\d+./:=?A-Za-z-]*?#/g, "marker-end=\"url(#");
1404
+ cleanedUpSvg = decodeEntities(cleanedUpSvg);
1405
+ cleanedUpSvg = cleanedUpSvg.replace(/<br>/g, "<br/>");
1406
+ return cleanedUpSvg;
1407
+ }, "cleanUpSvgCode");
1408
+ var putIntoIFrame = /* @__PURE__ */ __name((svgCode = "", svgElement) => {
1409
+ return `<iframe style="width:${IFRAME_WIDTH};height:${svgElement?.viewBox?.baseVal?.height ? svgElement.viewBox.baseVal.height + "px" : IFRAME_HEIGHT};${IFRAME_STYLES}" src="data:text/html;charset=UTF-8;base64,${toBase64(`<body style="${IFRAME_BODY_STYLE}">${svgCode}</body>`)}" sandbox="${IFRAME_SANDBOX_OPTS}">
1410
+ ${IFRAME_NOT_SUPPORTED_MSG}
1411
+ </iframe>`;
1412
+ }, "putIntoIFrame");
1413
+ var appendDivSvgG = /* @__PURE__ */ __name((parentRoot, id38, enclosingDivId, divStyle, svgXlink) => {
1414
+ const enclosingDiv = parentRoot.append("div");
1415
+ enclosingDiv.attr("id", enclosingDivId);
1416
+ if (divStyle) enclosingDiv.attr("style", divStyle);
1417
+ const svgNode = enclosingDiv.append("svg").attr("id", id38).attr("width", "100%").attr("xmlns", XMLNS_SVG_STD);
1418
+ if (svgXlink) svgNode.attr("xmlns:xlink", svgXlink);
1419
+ svgNode.append("g");
1420
+ return parentRoot;
1421
+ }, "appendDivSvgG");
1422
+ function sandboxedIframe(parentNode, iFrameId) {
1423
+ return parentNode.append("iframe").attr("id", iFrameId).attr("style", "width: 100%; height: 100%;").attr("sandbox", "");
1424
+ }
1425
+ __name(sandboxedIframe, "sandboxedIframe");
1426
+ var removeExistingElements = /* @__PURE__ */ __name((doc, id38, divId, iFrameId) => {
1427
+ doc.getElementById(id38)?.remove();
1428
+ doc.getElementById(divId)?.remove();
1429
+ doc.getElementById(iFrameId)?.remove();
1430
+ }, "removeExistingElements");
1431
+ var renderDiagram = /* @__PURE__ */ __name(async function(id38, text, svgContainingElement) {
1432
+ addDiagrams();
1433
+ const processed = processAndSetConfigs(text);
1434
+ let code = processed.code;
1435
+ text = code.cleaned;
1436
+ const config = getConfig();
1437
+ log.debug(config);
1438
+ if (text.length > (config?.maxTextSize ?? MAX_TEXTLENGTH)) {
1439
+ text = MAX_TEXTLENGTH_EXCEEDED_MSG;
1440
+ code = {
1441
+ raw: text,
1442
+ cleaned: text
1443
+ };
1444
+ }
1445
+ const idSelector = `#${id38}`;
1446
+ const iFrameID = "i" + id38;
1447
+ const iFrameID_selector = "#" + iFrameID;
1448
+ const enclosingDivID = "d" + id38;
1449
+ const enclosingDivID_selector = "#" + enclosingDivID;
1450
+ const removeTempElements = /* @__PURE__ */ __name(() => {
1451
+ const node = select_default(isSandboxed ? iFrameID_selector : enclosingDivID_selector).node();
1452
+ if (node && "remove" in node) node.remove();
1453
+ }, "removeTempElements");
1454
+ let root = select_default(document.body);
1455
+ const isSandboxed = config.securityLevel === SECURITY_LVL_SANDBOX;
1456
+ const isLooseSecurityLevel = config.securityLevel === SECURITY_LVL_LOOSE;
1457
+ const fontFamily = config.fontFamily;
1458
+ if (svgContainingElement !== void 0) {
1459
+ if (svgContainingElement) svgContainingElement.innerHTML = "";
1460
+ if (isSandboxed) {
1461
+ root = select_default(sandboxedIframe(select_default(svgContainingElement), iFrameID).nodes()[0].contentDocument.body);
1462
+ root.node().style.margin = "0";
1463
+ } else root = select_default(svgContainingElement);
1464
+ appendDivSvgG(root, id38, enclosingDivID, `font-family: ${fontFamily}`, XMLNS_XLINK_STD);
1465
+ } else {
1466
+ removeExistingElements(document, id38, enclosingDivID, iFrameID);
1467
+ if (isSandboxed) {
1468
+ root = select_default(sandboxedIframe(select_default(document.body), iFrameID).nodes()[0].contentDocument.body);
1469
+ root.node().style.margin = "0";
1470
+ } else root = select_default("body");
1471
+ appendDivSvgG(root, id38, enclosingDivID);
1472
+ }
1473
+ let diag;
1474
+ let parseEncounteredException;
1475
+ try {
1476
+ diag = await Diagram.fromText(code, { title: processed.title });
1477
+ } catch (error) {
1478
+ if (config.suppressErrorRendering) {
1479
+ removeTempElements();
1480
+ throw error;
1481
+ }
1482
+ diag = await Diagram.fromText("error");
1483
+ parseEncounteredException = error;
1484
+ }
1485
+ const element = root.select(enclosingDivID_selector).node();
1486
+ const diagramType = diag.type;
1487
+ const svg = element.firstChild;
1488
+ const firstChild = svg.firstChild;
1489
+ const diagramClassDefs = diag.renderer.getClasses?.(text, diag);
1490
+ const rules = createUserStyles(config, diagramType, diagramClassDefs, idSelector);
1491
+ const style1 = document.createElement("style");
1492
+ style1.innerHTML = rules;
1493
+ svg.insertBefore(style1, firstChild);
1494
+ try {
1495
+ await diag.renderer.draw(text, id38, "12.0.0", diag);
1496
+ } catch (e) {
1497
+ if (config.suppressErrorRendering) removeTempElements();
1498
+ else errorRenderer_default.draw(text, id38, "12.0.0");
1499
+ throw e;
1500
+ }
1501
+ const svgNode = root.select(`${enclosingDivID_selector} svg`);
1502
+ const a11yTitle = diag.db.getAccTitle?.();
1503
+ const a11yDescr = diag.db.getAccDescription?.();
1504
+ addA11yInfo(diagramType, svgNode, a11yTitle, a11yDescr);
1505
+ const svgCode = (/* @__PURE__ */ __name(() => {
1506
+ root.select(`[id="${id38}"]`).selectAll("foreignobject > *").attr("xmlns", XMLNS_XHTML_STD);
1507
+ let code2 = root.select(enclosingDivID_selector).node().innerHTML;
1508
+ log.debug("config.arrowMarkerAbsolute", config.arrowMarkerAbsolute);
1509
+ code2 = cleanUpSvgCode(code2, isSandboxed, evaluate(config.arrowMarkerAbsolute));
1510
+ if (isSandboxed) {
1511
+ const svgEl = root.select(enclosingDivID_selector + " svg").node();
1512
+ code2 = putIntoIFrame(code2, svgEl);
1513
+ } else if (!isLooseSecurityLevel) code2 = purify.sanitize(code2, {
1514
+ ADD_TAGS: DOMPURIFY_TAGS,
1515
+ ADD_ATTR: DOMPURIFY_ATTR,
1516
+ HTML_INTEGRATION_POINTS: { foreignobject: true }
1517
+ });
1518
+ attachFunctions();
1519
+ return code2;
1520
+ }, "serializeSvg"))();
1521
+ if (parseEncounteredException) throw parseEncounteredException;
1522
+ removeTempElements();
1523
+ return {
1524
+ diagramType,
1525
+ svg: svgCode,
1526
+ bindFunctions: diag.db.bindFunctions
1527
+ };
1528
+ }, "renderDiagram");
1529
+ var render = /* @__PURE__ */ __name(async function(id38, text, svgContainingElement) {
1530
+ try {
1531
+ return await renderDiagram(id38, text, svgContainingElement);
1532
+ } finally {
1533
+ setDiagramConfigScope(void 0);
1534
+ }
1535
+ }, "render");
1536
+ function initialize(userOptions = {}) {
1537
+ const options = assignWithDepth_default({}, userOptions);
1538
+ if (options?.fontFamily && !options.themeVariables?.fontFamily) {
1539
+ if (!options.themeVariables) options.themeVariables = {};
1540
+ options.themeVariables.fontFamily = options.fontFamily;
1541
+ }
1542
+ saveConfigFromInitialize(options);
1543
+ const fallbackTheme = defaultConfig.theme;
1544
+ if (options?.theme && Object.hasOwn(themes_default, options.theme)) options.themeVariables = themes_default[options.theme].getThemeVariables(options.themeVariables);
1545
+ else if (options) {
1546
+ if (options.theme != null && options.theme !== "null") options.theme = fallbackTheme;
1547
+ options.themeVariables = themes_default[fallbackTheme].getThemeVariables(options.themeVariables);
1548
+ }
1549
+ setLogLevel((typeof options === "object" ? setSiteConfig(options) : getSiteConfig()).logLevel);
1550
+ addDiagrams();
1551
+ }
1552
+ __name(initialize, "initialize");
1553
+ var getDiagramFromText = /* @__PURE__ */ __name((text, metadata = {}) => {
1554
+ const { code } = preprocessDiagram(text);
1555
+ return Diagram.fromText(code, metadata);
1556
+ }, "getDiagramFromText");
1557
+ function addA11yInfo(diagramType, svgNode, a11yTitle, a11yDescr) {
1558
+ setA11yDiagramInfo(svgNode, diagramType);
1559
+ addSVGa11yTitleDescription(svgNode, a11yTitle, a11yDescr, svgNode.attr("id"));
1560
+ }
1561
+ __name(addA11yInfo, "addA11yInfo");
1562
+ var mermaidAPI = Object.freeze({
1563
+ render,
1564
+ parse,
1565
+ getDiagramFromText,
1566
+ initialize,
1567
+ getConfig,
1568
+ /**
1569
+ * @deprecated This function does nothing. It will be overwritten by the next
1570
+ * call to {@link render} or {@link parse}.
1571
+ */
1572
+ setConfig,
1573
+ getSiteConfig,
1574
+ updateSiteConfig,
1575
+ reset: /* @__PURE__ */ __name(() => {
1576
+ reset();
1577
+ }, "reset"),
1578
+ globalReset: /* @__PURE__ */ __name(() => {
1579
+ reset(defaultConfig);
1580
+ }, "globalReset"),
1581
+ defaultConfig
1582
+ });
1583
+ setLogLevel(getConfig().logLevel);
1584
+ reset(getConfig());
1585
+ var handleError = /* @__PURE__ */ __name((error, errors, parseError) => {
1586
+ log.warn(error);
1587
+ if (isDetailedError(error)) {
1588
+ if (parseError) parseError(error.str, error.hash);
1589
+ errors.push({
1590
+ ...error,
1591
+ message: error.str,
1592
+ error
1593
+ });
1594
+ } else {
1595
+ if (parseError) parseError(error);
1596
+ if (error instanceof Error) errors.push({
1597
+ str: error.message,
1598
+ message: error.message,
1599
+ hash: error.name,
1600
+ error
1601
+ });
1602
+ }
1603
+ }, "handleError");
1604
+ var run = /* @__PURE__ */ __name(async function(options = { querySelector: ".mermaid" }) {
1605
+ try {
1606
+ await runThrowsErrors(options);
1607
+ } catch (e) {
1608
+ if (isDetailedError(e)) log.error(e.str);
1609
+ if (mermaid.parseError) mermaid.parseError(e);
1610
+ if (!options.suppressErrors) {
1611
+ log.error("Use the suppressErrors option to suppress these errors");
1612
+ throw e;
1613
+ }
1614
+ }
1615
+ }, "run");
1616
+ var runThrowsErrors = /* @__PURE__ */ __name(async function({ postRenderCallback, querySelector, nodes } = { querySelector: ".mermaid" }) {
1617
+ const conf = mermaidAPI.getConfig();
1618
+ log.debug(`${!postRenderCallback ? "No " : ""}Callback function found`);
1619
+ let nodesToProcess;
1620
+ if (nodes) nodesToProcess = nodes;
1621
+ else if (querySelector) nodesToProcess = document.querySelectorAll(querySelector);
1622
+ else throw new Error("Nodes and querySelector are both undefined");
1623
+ log.debug(`Found ${nodesToProcess.length} diagrams`);
1624
+ if (conf?.startOnLoad !== void 0) {
1625
+ log.debug("Start On Load: " + conf?.startOnLoad);
1626
+ mermaidAPI.updateSiteConfig({ startOnLoad: conf?.startOnLoad });
1627
+ }
1628
+ const idGenerator = new utils_default.InitIDGenerator(conf.deterministicIds, conf.deterministicIDSeed);
1629
+ let txt;
1630
+ const errors = [];
1631
+ for (const element of Array.from(nodesToProcess)) {
1632
+ log.info("Rendering diagram: " + element.id);
1633
+ if (element.getAttribute("data-processed")) continue;
1634
+ element.setAttribute("data-processed", "true");
1635
+ const id38 = `mermaid-${idGenerator.next()}`;
1636
+ txt = element.innerHTML;
1637
+ txt = dedent(utils_default.entityDecode(txt)).trim().replace(/<br\s*\/?>/gi, "<br/>");
1638
+ const init2 = utils_default.detectInit(txt);
1639
+ if (init2) log.debug("Detected early reinit: ", init2);
1640
+ try {
1641
+ const { svg, bindFunctions } = await render2(id38, txt, element);
1642
+ element.innerHTML = svg;
1643
+ if (postRenderCallback) await postRenderCallback(id38);
1644
+ if (bindFunctions) bindFunctions(element);
1645
+ } catch (error) {
1646
+ handleError(error, errors, mermaid.parseError);
1647
+ }
1648
+ }
1649
+ if (errors.length > 0) throw errors[0];
1650
+ }, "runThrowsErrors");
1651
+ var initialize2 = /* @__PURE__ */ __name(function(config) {
1652
+ mermaidAPI.initialize(config);
1653
+ }, "initialize");
1654
+ var init = /* @__PURE__ */ __name(async function(config, nodes, callback) {
1655
+ log.warn("mermaid.init is deprecated. Please use run instead.");
1656
+ if (config) initialize2(config);
1657
+ const runOptions = {
1658
+ postRenderCallback: callback,
1659
+ querySelector: ".mermaid"
1660
+ };
1661
+ if (typeof nodes === "string") runOptions.querySelector = nodes;
1662
+ else if (nodes) if (nodes instanceof HTMLElement) runOptions.nodes = [nodes];
1663
+ else runOptions.nodes = nodes;
1664
+ await run(runOptions);
1665
+ }, "init");
1666
+ var registerExternalDiagrams = /* @__PURE__ */ __name(async (diagrams, { lazyLoad = true } = {}) => {
1667
+ addDiagrams();
1668
+ registerLazyLoadedDiagrams(...diagrams);
1669
+ if (lazyLoad === false) await loadRegisteredDiagrams();
1670
+ }, "registerExternalDiagrams");
1671
+ var contentLoaded = /* @__PURE__ */ __name(function() {
1672
+ if (mermaid.startOnLoad) {
1673
+ const { startOnLoad } = mermaidAPI.getConfig();
1674
+ if (startOnLoad) mermaid.run().catch((err) => log.error("Mermaid failed to initialize", err));
1675
+ }
1676
+ }, "contentLoaded");
1677
+ if (typeof document !== "undefined") window.addEventListener("load", contentLoaded, false);
1678
+ var setParseErrorHandler = /* @__PURE__ */ __name(function(parseErrorHandler) {
1679
+ mermaid.parseError = parseErrorHandler;
1680
+ }, "setParseErrorHandler");
1681
+ var executionQueue = [];
1682
+ var executionQueueRunning = false;
1683
+ var executeQueue = /* @__PURE__ */ __name(async () => {
1684
+ if (executionQueueRunning) return;
1685
+ executionQueueRunning = true;
1686
+ while (executionQueue.length > 0) {
1687
+ const f = executionQueue.shift();
1688
+ if (f) try {
1689
+ await f();
1690
+ } catch (e) {
1691
+ log.error("Error executing queue", e);
1692
+ }
1693
+ }
1694
+ executionQueueRunning = false;
1695
+ }, "executeQueue");
1696
+ var parse2 = /* @__PURE__ */ __name(async (text, parseOptions) => {
1697
+ return new Promise((resolve, reject) => {
1698
+ const performCall = /* @__PURE__ */ __name(() => new Promise((res, rej) => {
1699
+ mermaidAPI.parse(text, parseOptions).then((r) => {
1700
+ res(r);
1701
+ resolve(r);
1702
+ }, (e) => {
1703
+ log.error("Error parsing", e);
1704
+ mermaid.parseError?.(e);
1705
+ rej(e);
1706
+ reject(e);
1707
+ });
1708
+ }), "performCall");
1709
+ executionQueue.push(performCall);
1710
+ executeQueue().catch(reject);
1711
+ });
1712
+ }, "parse");
1713
+ var render2 = /* @__PURE__ */ __name((id38, text, container) => {
1714
+ return new Promise((resolve, reject) => {
1715
+ const performCall = /* @__PURE__ */ __name(() => new Promise((res, rej) => {
1716
+ mermaidAPI.render(id38, text, container).then((r) => {
1717
+ res(r);
1718
+ resolve(r);
1719
+ }, (e) => {
1720
+ log.error("Error parsing", e);
1721
+ mermaid.parseError?.(e);
1722
+ rej(e);
1723
+ reject(e);
1724
+ });
1725
+ }), "performCall");
1726
+ executionQueue.push(performCall);
1727
+ executeQueue().catch(reject);
1728
+ });
1729
+ }, "render");
1730
+ var mermaid = {
1731
+ startOnLoad: true,
1732
+ mermaidAPI,
1733
+ parse: parse2,
1734
+ render: render2,
1735
+ init,
1736
+ run,
1737
+ registerExternalDiagrams,
1738
+ registerLayoutLoaders,
1739
+ initialize: initialize2,
1740
+ parseError: void 0,
1741
+ contentLoaded,
1742
+ setParseErrorHandler,
1743
+ detectType,
1744
+ registerIconPacks,
1745
+ getRegisteredDiagramsMetadata: /* @__PURE__ */ __name(() => {
1746
+ return Object.keys(detectors).map((id38) => ({ id: id38 }));
1747
+ }, "getRegisteredDiagramsMetadata")
1748
+ };
1749
+ var mermaid_default = mermaid;
1750
+ /*! Check if previously processed */
1751
+ /*!
1752
+ * Wait for document loaded before starting the execution
1753
+ */
1754
+
1755
+ //#endregion
1756
+ export { mermaid_default as default };