@umami/shiso 1.11.0 → 1.13.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 (148) hide show
  1. package/bin/shiso.mjs +20 -1
  2. package/dist/chunks/App.js +412 -51
  3. package/dist/chunks/abnfDiagram-VCTEODGH.js +109 -0
  4. package/dist/chunks/arc.js +130 -0
  5. package/dist/chunks/architecture-7GRP2DOG.js +4 -0
  6. package/dist/chunks/architectureDiagram-5GKGNRK7.js +7466 -0
  7. package/dist/chunks/array.js +8 -0
  8. package/dist/chunks/blockDiagram-I7D4REHJ.js +2546 -0
  9. package/dist/chunks/c4Diagram-7LVT6UL2.js +3654 -0
  10. package/dist/chunks/channel.js +9 -0
  11. package/dist/chunks/chunk-2Q5K7J3B.js +21 -0
  12. package/dist/chunks/chunk-4HAMMTFA.js +6106 -0
  13. package/dist/chunks/chunk-5VM5RSS4.js +21 -0
  14. package/dist/chunks/chunk-75Z2AOVW.js +2185 -0
  15. package/dist/chunks/chunk-DU6HZSFF.js +8729 -0
  16. package/dist/chunks/chunk-F27PBJKO.js +95 -0
  17. package/dist/chunks/chunk-FOHPRMQF.js +27162 -0
  18. package/dist/chunks/chunk-GMAD6QVW.js +2369 -0
  19. package/dist/chunks/chunk-GVQU2GXP.js +58 -0
  20. package/dist/chunks/chunk-IMKFNOWR.js +2593 -0
  21. package/dist/chunks/chunk-JWPE2WC7.js +12 -0
  22. package/dist/chunks/chunk-L3NEJ4N5.js +420 -0
  23. package/dist/chunks/chunk-OSK3NFVY.js +1029 -0
  24. package/dist/chunks/chunk-P2QGCYS3.js +95 -0
  25. package/dist/chunks/chunk-POPQ4Y6H.js +33 -0
  26. package/dist/chunks/chunk-PWAF6VOD.js +467 -0
  27. package/dist/chunks/chunk-SHT3W25Y.js +4813 -0
  28. package/dist/chunks/chunk-SVP7TREG.js +686 -0
  29. package/dist/chunks/chunk-TICWLB2K.js +3800 -0
  30. package/dist/chunks/chunk-XXDRQBXY.js +12 -0
  31. package/dist/chunks/chunk-Y2CYZVJY.js +15 -0
  32. package/dist/chunks/classDiagram-ZZMXUADV.js +33 -0
  33. package/dist/chunks/classDiagram-v2-VYDZK3BY.js +33 -0
  34. package/dist/chunks/cose-bilkent-JH36ORCC.js +4268 -0
  35. package/dist/chunks/cynefin-OW5HDTMX.js +4 -0
  36. package/dist/chunks/cynefinDiagram-5FMLGOSQ.js +482 -0
  37. package/dist/chunks/cytoscape.esm.js +28282 -0
  38. package/dist/chunks/dagre-GXQ25YYZ.js +583 -0
  39. package/dist/chunks/dagre.js +4235 -0
  40. package/dist/chunks/defaultLocale.js +246 -0
  41. package/dist/chunks/diagram-S7CK7UJ4.js +402 -0
  42. package/dist/chunks/diagram-UQ7AKVKN.js +291 -0
  43. package/dist/chunks/diagram-VSXAHHWV.js +553 -0
  44. package/dist/chunks/diagram-VX7I27RA.js +798 -0
  45. package/dist/chunks/diagram-Z3DM3KII.js +186 -0
  46. package/dist/chunks/dist.js +92 -0
  47. package/dist/chunks/docs.js +989 -93
  48. package/dist/chunks/ebnfDiagram-PWID7BFC.js +123 -0
  49. package/dist/chunks/erDiagram-RLTQ6QDP.js +2295 -0
  50. package/dist/chunks/eventmodeling-NTZA5JFV.js +4 -0
  51. package/dist/chunks/flowDiagram-HODETNUW.js +17 -0
  52. package/dist/chunks/ganttDiagram-EL5Y4UJY.js +3928 -0
  53. package/dist/chunks/gitGraph-4MIJSDKK.js +4 -0
  54. package/dist/chunks/gitGraphDiagram-WWUBYQGX.js +1153 -0
  55. package/dist/chunks/graphlib.js +4194 -0
  56. package/dist/chunks/info-A6RAGUB7.js +4 -0
  57. package/dist/chunks/infoDiagram-27XIBGKW.js +25 -0
  58. package/dist/chunks/init.js +14 -0
  59. package/dist/chunks/ishikawaDiagram-5VMMS53U.js +971 -0
  60. package/dist/chunks/journeyDiagram-3NMN7TZE.js +1226 -0
  61. package/dist/chunks/kanban-definition-UXKFOSKX.js +1241 -0
  62. package/dist/chunks/katex.js +26463 -0
  63. package/dist/chunks/line.js +48 -0
  64. package/dist/chunks/linear.js +391 -0
  65. package/dist/chunks/mermaid-parser.core.js +754 -0
  66. package/dist/chunks/mermaid.core.js +4898 -0
  67. package/dist/chunks/mindmap-definition-YA3MSWOX.js +1309 -0
  68. package/dist/chunks/ordinal.js +84 -0
  69. package/dist/chunks/packet-AYTQ26CC.js +4 -0
  70. package/dist/chunks/path.js +106 -0
  71. package/dist/chunks/pegDiagram-XKGWAZYB.js +115 -0
  72. package/dist/chunks/pie-WAS4IAKB.js +4 -0
  73. package/dist/chunks/pieDiagram-E7YTZNPT.js +297 -0
  74. package/dist/chunks/quadrantDiagram-AXDQQJYC.js +2234 -0
  75. package/dist/chunks/radar-RG4KPBEZ.js +4 -0
  76. package/dist/chunks/railroad-74A4TZTK.js +4 -0
  77. package/dist/chunks/railroad-abnf-HS5TGJTU.js +4 -0
  78. package/dist/chunks/railroad-ebnf-LZEXJU2U.js +4 -0
  79. package/dist/chunks/railroad-peg-WCYAUIDC.js +4 -0
  80. package/dist/chunks/railroadDiagram-O6MQD6OU.js +89 -0
  81. package/dist/chunks/requirementDiagram-BXWQKSXE.js +2464 -0
  82. package/dist/chunks/rough.esm.js +1396 -0
  83. package/dist/chunks/sankeyDiagram-P5KCCOFB.js +1308 -0
  84. package/dist/chunks/sequenceDiagram-WJ2MYXX4.js +5445 -0
  85. package/dist/chunks/sizeCapture-INFHLROL.js +56 -0
  86. package/dist/chunks/src.js +2653 -0
  87. package/dist/chunks/stateDiagram-D77RDMKH.js +368 -0
  88. package/dist/chunks/stateDiagram-v2-MP3YSRHH.js +33 -0
  89. package/dist/chunks/swimlanes-42K2YHIH.js +6925 -0
  90. package/dist/chunks/swimlanesDiagram-VR7AAH4N.js +32 -0
  91. package/dist/chunks/timeline-definition-24CTP7MA.js +1507 -0
  92. package/dist/chunks/treeView-Q6P3EWNA.js +4 -0
  93. package/dist/chunks/treemap-WGGIJYW6.js +4 -0
  94. package/dist/chunks/vennDiagram-4TSXK5OY.js +2803 -0
  95. package/dist/chunks/wardley-WFR3VGLG.js +4 -0
  96. package/dist/chunks/wardleyDiagram-VM6X3IG4.js +877 -0
  97. package/dist/chunks/xychartDiagram-S5SC5T6Z.js +2698 -0
  98. package/dist/components.js +2 -2
  99. package/dist/entry-client.js +2 -2
  100. package/dist/entry-server.js +31 -3
  101. package/docs.schema.json +90 -0
  102. package/mdx.config.ts +13 -97
  103. package/package.json +6 -4
  104. package/scripts/build-runtime.mjs +1 -0
  105. package/scripts/check-content.mjs +358 -0
  106. package/scripts/expand-navigation-globs.mjs +277 -0
  107. package/scripts/expand-openapi-navigation.mjs +94 -0
  108. package/scripts/generate-openapi.mjs +117 -0
  109. package/scripts/generate-search-index.mjs +31 -1
  110. package/scripts/lib/openapi.mjs +653 -0
  111. package/scripts/load-docs-config.mjs +52 -6
  112. package/scripts/load-shiso-config.mjs +45 -3
  113. package/scripts/prerender.mjs +83 -3
  114. package/scripts/vite-docs-config.mjs +27 -6
  115. package/src/App.tsx +0 -1
  116. package/src/components/CodeBlock.tsx +108 -8
  117. package/src/components/DocContent.tsx +18 -0
  118. package/src/components/Docs.tsx +45 -17
  119. package/src/components/OpenApiOperation.tsx +205 -0
  120. package/src/components/SideNav.tsx +13 -2
  121. package/src/components/docs/Changelog.tsx +163 -0
  122. package/src/components/docs/CodeGroup.tsx +6 -2
  123. package/src/components/docs/Mermaid.tsx +164 -0
  124. package/src/components/docs/Panel.tsx +23 -0
  125. package/src/components/docs/ParamField.tsx +17 -5
  126. package/src/components/docs/PropertiesTable.tsx +2 -2
  127. package/src/components/docs/ResponseField.tsx +17 -5
  128. package/src/components/docs/Tiles.tsx +59 -0
  129. package/src/components/docs/Tree.tsx +359 -0
  130. package/src/components/docs/Update.tsx +72 -0
  131. package/src/components/docs/index.ts +7 -0
  132. package/src/components/docs/panel-context.tsx +25 -0
  133. package/src/components/docs/styles.ts +49 -0
  134. package/src/components/icons/index.ts +4 -0
  135. package/src/entry-server.tsx +50 -0
  136. package/src/lib/code-blocks.ts +18 -0
  137. package/src/lib/code-meta.ts +87 -0
  138. package/src/lib/docs-config.ts +4 -1
  139. package/src/lib/openapi.generated.ts +4 -0
  140. package/src/lib/openapi.ts +63 -0
  141. package/src/lib/rehype-shiki.ts +213 -0
  142. package/src/lib/site-model.ts +2 -0
  143. package/src/lib/types.ts +116 -2
  144. package/src/styles/global.css +63 -73
  145. package/types/components.d.ts +79 -0
  146. package/types/config.d.ts +11 -4
  147. package/vite.config.ts +49 -3
  148. package/CHANGELOG.md +0 -171
@@ -0,0 +1,4898 @@
1
+ import { n as __name } from "./chunk-Y2CYZVJY.js";
2
+ import { h as setLogLevel, m as log, p as select_default } from "./src.js";
3
+ import { $ as purify, C as getDiagramLoader, E as getSiteConfig, I as reset, L as sanitizeCss, N as registerDiagram, P as registerLazyLoadedDiagrams, Q as updateSiteConfig, S as getDiagram, T as getEffectiveHtmlLabels, V as saveConfigFromInitialize, W as setConfig, X as styles_default, Z as themes_default, _ as frontMatterRegex, b as getConfig, c as configureSvgSize, g as evaluate, l as cssStyleSheetToString, m as detectors, n as addDirective, p as detectType, q as setSiteConfig, r as assignWithDepth_default, s as common_default, t as UnknownDiagramError, u as defaultConfig, x as getConfig2 } from "./chunk-DU6HZSFF.js";
4
+ import { S as isBuffer, a as decodeEntities, d as interpolateToCurve, 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-75Z2AOVW.js";
5
+ import { r as registerIconPacks } from "./chunk-PWAF6VOD.js";
6
+ import { i as dedent } from "./chunk-GMAD6QVW.js";
7
+ import "./chunk-P2QGCYS3.js";
8
+ import { a as labelHelper } from "./chunk-4HAMMTFA.js";
9
+ import { i as positionNode, n as getSubGraphTitleMargins, r as insertNode, t as clear } from "./chunk-GVQU2GXP.js";
10
+ import { a as insertEdgeLabel, c as positionEdgeLabel, i as insertEdge, l as terminalLabels, n as edgeLabels, r as hasEdgeLabel, s as markers_default, t as clear$1 } from "./chunk-OSK3NFVY.js";
11
+ import { t as Graph } from "./graphlib.js";
12
+ import { n as insertCluster, t as clear$2 } from "./chunk-L3NEJ4N5.js";
13
+
14
+ //#region ../../node_modules/.pnpm/mermaid@11.17.2/node_modules/mermaid/dist/chunks/mermaid.core/chunk-CLGD4ZFX.mjs
15
+ var selectSvgElement = /* @__PURE__ */ __name((id) => {
16
+ const { securityLevel } = getConfig2();
17
+ let root = select_default("body");
18
+ if (securityLevel === "sandbox") {
19
+ const doc = select_default(`#i${id}`).node()?.contentDocument ?? document;
20
+ root = select_default(doc.body);
21
+ }
22
+ return root.select(`#${id}`);
23
+ }, "selectSvgElement");
24
+
25
+ //#endregion
26
+ //#region ../../node_modules/.pnpm/es-toolkit@1.52.0/node_modules/es-toolkit/dist/compat/_internal/isPrototype.mjs
27
+ function isPrototype(value) {
28
+ const constructor = value?.constructor;
29
+ return value === (typeof constructor === "function" ? constructor.prototype : Object.prototype);
30
+ }
31
+
32
+ //#endregion
33
+ //#region ../../node_modules/.pnpm/es-toolkit@1.52.0/node_modules/es-toolkit/dist/compat/predicate/isEmpty.mjs
34
+ /**
35
+ * Checks if a given value is empty.
36
+ *
37
+ * - If the given value is a string, checks if it is an empty string.
38
+ * - If the given value is an array, `Map`, or `Set`, checks if its size is 0.
39
+ * - If the given value is an [array-like object](../predicate/isArrayLike.md), checks if its length is 0.
40
+ * - If the given value is an object, checks if it is an empty object with no properties.
41
+ * - Primitive values (booleans, numbers, or bigints) are considered empty.
42
+ *
43
+ * @param [value] - The value to check.
44
+ * @returns `true` if the value is empty, `false` otherwise.
45
+ *
46
+ * @example
47
+ * isEmpty(); // true
48
+ * isEmpty(null); // true
49
+ * isEmpty(""); // true
50
+ * isEmpty([]); // true
51
+ * isEmpty({}); // true
52
+ * isEmpty(new Map()); // true
53
+ * isEmpty(new Set()); // true
54
+ * isEmpty("hello"); // false
55
+ * isEmpty([1, 2, 3]); // false
56
+ * isEmpty({ a: 1 }); // false
57
+ * isEmpty(new Map([["key", "value"]])); // false
58
+ * isEmpty(new Set([1, 2, 3])); // false
59
+ */
60
+ function isEmpty(value) {
61
+ if (value == null) return true;
62
+ if (isArrayLike(value)) {
63
+ if (typeof value.splice !== "function" && typeof value !== "string" && !isBuffer(value) && !isTypedArray(value) && !isArguments(value)) return false;
64
+ return value.length === 0;
65
+ }
66
+ if (typeof value === "object" || typeof value === "function") {
67
+ if (value instanceof Map || value instanceof Set) return value.size === 0;
68
+ const keys = Object.keys(value);
69
+ if (isPrototype(value)) return keys.filter((x) => x !== "constructor").length === 0;
70
+ return keys.length === 0;
71
+ }
72
+ return true;
73
+ }
74
+
75
+ //#endregion
76
+ //#region ../../node_modules/.pnpm/mermaid@11.17.2/node_modules/mermaid/dist/chunks/mermaid.core/chunk-TLUHSLCS.mjs
77
+ var internalHelpers = {
78
+ common: common_default,
79
+ getConfig,
80
+ insertCluster,
81
+ insertEdge,
82
+ insertEdgeLabel,
83
+ insertMarkers: markers_default,
84
+ insertNode,
85
+ interpolateToCurve,
86
+ labelHelper,
87
+ log,
88
+ positionEdgeLabel
89
+ };
90
+ var layoutAlgorithms = {};
91
+ var registerLayoutLoaders = /* @__PURE__ */ __name((loaders) => {
92
+ for (const loader of loaders) layoutAlgorithms[loader.name] = loader;
93
+ }, "registerLayoutLoaders");
94
+ (/* @__PURE__ */ __name(() => {
95
+ registerLayoutLoaders([
96
+ {
97
+ name: "dagre",
98
+ loader: /* @__PURE__ */ __name(async () => await import("./dagre-GXQ25YYZ.js"), "loader")
99
+ },
100
+ {
101
+ name: "swimlane",
102
+ loader: /* @__PURE__ */ __name(async () => await import("./swimlanes-42K2YHIH.js"), "loader")
103
+ },
104
+ ...[{
105
+ name: "cose-bilkent",
106
+ loader: /* @__PURE__ */ __name(async () => await import("./cose-bilkent-JH36ORCC.js"), "loader")
107
+ }]
108
+ ]);
109
+ }, "registerDefaultLayoutLoaders"))();
110
+ var render$1 = /* @__PURE__ */ __name(async (data4Layout, svg) => {
111
+ if (!(data4Layout.layoutAlgorithm in layoutAlgorithms)) throw new Error(`Unknown layout algorithm: ${data4Layout.layoutAlgorithm}`);
112
+ if (data4Layout.diagramId) for (const node of data4Layout.nodes) {
113
+ const originalDomId = node.domId || node.id;
114
+ node.domId = `${data4Layout.diagramId}-${originalDomId}`;
115
+ }
116
+ const layoutDefinition = layoutAlgorithms[data4Layout.layoutAlgorithm];
117
+ const layoutRenderer = await layoutDefinition.loader();
118
+ const { theme, themeVariables } = data4Layout.config;
119
+ const { useGradient, gradientStart, gradientStop } = themeVariables;
120
+ const svgId = svg.attr("id");
121
+ svg.append("defs").append("filter").attr("id", `${svgId}-drop-shadow`).attr("height", "130%").attr("width", "130%").append("feDropShadow").attr("dx", "4").attr("dy", "4").attr("stdDeviation", 0).attr("flood-opacity", "0.06").attr("flood-color", `${theme?.includes("dark") ? "#FFFFFF" : "#000000"}`);
122
+ svg.append("defs").append("filter").attr("id", `${svgId}-drop-shadow-small`).attr("height", "150%").attr("width", "150%").append("feDropShadow").attr("dx", "2").attr("dy", "2").attr("stdDeviation", 0).attr("flood-opacity", "0.06").attr("flood-color", `${theme?.includes("dark") ? "#FFFFFF" : "#000000"}`);
123
+ if (useGradient) {
124
+ const gradient = svg.append("linearGradient").attr("id", svg.attr("id") + "-gradient").attr("gradientUnits", "objectBoundingBox").attr("x1", "0%").attr("y1", "0%").attr("x2", "100%").attr("y2", "0%");
125
+ gradient.append("svg:stop").attr("offset", "0%").attr("stop-color", gradientStart).attr("stop-opacity", 1);
126
+ gradient.append("svg:stop").attr("offset", "100%").attr("stop-color", gradientStop).attr("stop-opacity", 1);
127
+ }
128
+ return layoutRenderer.render(data4Layout, svg, internalHelpers, { algorithm: layoutDefinition.algorithm });
129
+ }, "render");
130
+ var getRegisteredLayoutAlgorithm = /* @__PURE__ */ __name((algorithm = "", { fallback = "dagre" } = {}) => {
131
+ if (algorithm in layoutAlgorithms) return algorithm;
132
+ if (fallback in layoutAlgorithms) {
133
+ log.warn(`Layout algorithm ${algorithm} is not registered. Using ${fallback} as fallback.`);
134
+ return fallback;
135
+ }
136
+ throw new Error(`Both layout algorithms ${algorithm} and ${fallback} are not registered.`);
137
+ }, "getRegisteredLayoutAlgorithm");
138
+
139
+ //#endregion
140
+ //#region ../../node_modules/.pnpm/mermaid@11.17.2/node_modules/mermaid/dist/chunks/mermaid.core/chunk-2E4U76K2.mjs
141
+ function createLayoutElementGroups(element, { edgePathsClass = "edges edgePaths" } = {}) {
142
+ const rootGroups = element.insert("g").attr("class", "root");
143
+ return {
144
+ clusters: rootGroups.insert("g").attr("class", "clusters"),
145
+ edgePaths: rootGroups.insert("g").attr("class", edgePathsClass),
146
+ edgeLabels: rootGroups.insert("g").attr("class", "edgeLabels"),
147
+ nodes: rootGroups.insert("g").attr("class", "nodes"),
148
+ rootGroups
149
+ };
150
+ }
151
+ __name(createLayoutElementGroups, "createLayoutElementGroups");
152
+ async function measureGroupLabel(nodesGroup, node) {
153
+ if (node.label) {
154
+ const { shapeSvg, bbox } = await labelHelper(nodesGroup, node);
155
+ node.labelBBox = {
156
+ width: bbox.width,
157
+ height: bbox.height
158
+ };
159
+ shapeSvg.remove();
160
+ } else node.labelBBox = {
161
+ width: 0,
162
+ height: 0
163
+ };
164
+ }
165
+ __name(measureGroupLabel, "measureGroupLabel");
166
+ async function insertMeasuredNode(nodesGroup, node, renderOptions) {
167
+ const childNodeEl = await insertNode(nodesGroup, node, renderOptions);
168
+ const boundingBox = childNodeEl.node()?.getBBox() ?? {
169
+ width: 0,
170
+ height: 0
171
+ };
172
+ node.width = boundingBox.width;
173
+ node.height = boundingBox.height;
174
+ return childNodeEl;
175
+ }
176
+ __name(insertMeasuredNode, "insertMeasuredNode");
177
+ async function createGraphWithElements(element, data4Layout) {
178
+ const graph = new Graph({
179
+ multigraph: true,
180
+ compound: true
181
+ });
182
+ const edgesToProcess = [...data4Layout.edges];
183
+ const config = getConfig2();
184
+ const groups = createLayoutElementGroups(element);
185
+ const { edgeLabels: edgeLabels2, nodes: nodesGroup } = groups;
186
+ const nodeElements = /* @__PURE__ */ new Map();
187
+ const hasDom = element.node() != null;
188
+ await Promise.all(data4Layout.nodes.map(async (node) => {
189
+ if (node.isGroup) {
190
+ if (hasDom) await measureGroupLabel(nodesGroup, node);
191
+ graph.setNode(node.id, { ...node });
192
+ } else {
193
+ if (hasDom) {
194
+ const childNodeEl = await insertMeasuredNode(nodesGroup, node, {
195
+ config,
196
+ dir: node.dir
197
+ });
198
+ nodeElements.set(node.id, childNodeEl);
199
+ }
200
+ graph.setNode(node.id, { ...node });
201
+ }
202
+ }));
203
+ for (const edge of edgesToProcess) {
204
+ if (hasDom && hasEdgeLabel(edge)) await insertEdgeLabel(edgeLabels2, edge);
205
+ graph.setEdge(edge.start, edge.end, { ...edge }, edge.id);
206
+ if (!data4Layout.edges.some((existingEdge) => existingEdge.id === edge.id)) data4Layout.edges.push(edge);
207
+ }
208
+ if (globalThis.mermaidCaptureSizes) {
209
+ const { captureNodeSizes } = await import("./sizeCapture-INFHLROL.js");
210
+ captureNodeSizes(element, data4Layout);
211
+ }
212
+ return {
213
+ graph,
214
+ groups,
215
+ nodeElements
216
+ };
217
+ }
218
+ __name(createGraphWithElements, "createGraphWithElements");
219
+ var clusterDb = /* @__PURE__ */ new Map();
220
+ var descendants = /* @__PURE__ */ new Map();
221
+ var parents = /* @__PURE__ */ new Map();
222
+ var clear4 = /* @__PURE__ */ __name(() => {
223
+ descendants.clear();
224
+ parents.clear();
225
+ clusterDb.clear();
226
+ }, "clear");
227
+ var isDescendant = /* @__PURE__ */ __name((id, ancestorId) => {
228
+ const ancestorDescendants = descendants.get(ancestorId) || [];
229
+ log.trace("In isDescendant", ancestorId, " ", id, " = ", ancestorDescendants.includes(id));
230
+ return ancestorDescendants.includes(id);
231
+ }, "isDescendant");
232
+ var edgeInCluster = /* @__PURE__ */ __name((edge, clusterId) => {
233
+ const clusterDescendants = descendants.get(clusterId) || [];
234
+ log.info("Descendants of ", clusterId, " is ", clusterDescendants);
235
+ log.info("Edge is ", edge);
236
+ if (edge.v === clusterId || edge.w === clusterId) return false;
237
+ if (!clusterDescendants) {
238
+ log.debug("Tilt, ", clusterId, ",not in descendants");
239
+ return false;
240
+ }
241
+ return clusterDescendants.includes(edge.v) || isDescendant(edge.v, clusterId) || isDescendant(edge.w, clusterId) || clusterDescendants.includes(edge.w);
242
+ }, "edgeInCluster");
243
+ var copy = /* @__PURE__ */ __name((clusterId, graph, newGraph, rootId) => {
244
+ log.debug("Copying children of ", clusterId, "root", rootId, "data", graph.node(clusterId), rootId);
245
+ const nodes = graph.children(clusterId) || [];
246
+ if (clusterId !== rootId) nodes.push(clusterId);
247
+ log.debug("Copying (nodes) clusterId", clusterId, "nodes", nodes);
248
+ nodes.forEach((node) => {
249
+ if (graph.children(node).length > 0) copy(node, graph, newGraph, rootId);
250
+ else {
251
+ const data = graph.node(node);
252
+ log.info("cp ", node, " to ", rootId, " with parent ", clusterId);
253
+ newGraph.setNode(node, data);
254
+ if (rootId !== graph.parent(node)) {
255
+ log.debug("Setting parent", node, graph.parent(node));
256
+ newGraph.setParent(node, graph.parent(node));
257
+ }
258
+ if (clusterId !== rootId && node !== clusterId) {
259
+ log.debug("Setting parent", node, clusterId);
260
+ newGraph.setParent(node, clusterId);
261
+ } else {
262
+ log.info("In copy ", clusterId, "root", rootId, "data", graph.node(clusterId), rootId);
263
+ log.debug("Not Setting parent for node=", node, "cluster!==rootId", clusterId !== rootId, "node!==clusterId", node !== clusterId);
264
+ }
265
+ const edges = graph.edges(node);
266
+ log.debug("Copying Edges", edges);
267
+ edges.forEach((edge) => {
268
+ log.info("Edge", edge);
269
+ const data2 = graph.edge(edge.v, edge.w, edge.name);
270
+ log.info("Edge data", data2, rootId);
271
+ try {
272
+ if (edgeInCluster(edge, rootId)) {
273
+ log.info("Copying as ", edge.v, edge.w, data2, edge.name);
274
+ newGraph.setEdge(edge.v, edge.w, data2, edge.name);
275
+ log.info("newGraph edges ", newGraph.edges(), newGraph.edge(newGraph.edges()[0]));
276
+ } else log.info("Skipping copy of edge ", edge.v, "-->", edge.w, " rootId: ", rootId, " clusterId:", clusterId);
277
+ } catch (e) {
278
+ log.error(e);
279
+ }
280
+ });
281
+ }
282
+ log.debug("Removing node", node);
283
+ graph.removeNode(node);
284
+ });
285
+ }, "copy");
286
+ var extractDescendants = /* @__PURE__ */ __name((id, graph) => {
287
+ const children = graph.children(id);
288
+ let res = [...children];
289
+ for (const child of children) {
290
+ parents.set(child, id);
291
+ res = [...res, ...extractDescendants(child, graph)];
292
+ }
293
+ return res;
294
+ }, "extractDescendants");
295
+ var findCommonEdges = /* @__PURE__ */ __name((graph, id1, id2) => {
296
+ const edges1 = graph.edges().filter((edge) => edge.v === id1 || edge.w === id1);
297
+ const edges2 = graph.edges().filter((edge) => edge.v === id2 || edge.w === id2);
298
+ const edges1Prim = edges1.map((edge) => {
299
+ return {
300
+ v: edge.v === id1 ? id2 : edge.v,
301
+ w: edge.w === id1 ? id1 : edge.w
302
+ };
303
+ });
304
+ const edges2Prim = edges2.map((edge) => {
305
+ return {
306
+ v: edge.v,
307
+ w: edge.w
308
+ };
309
+ });
310
+ return edges1Prim.filter((edgeIn1) => {
311
+ return edges2Prim.some((edge) => edgeIn1.v === edge.v && edgeIn1.w === edge.w);
312
+ });
313
+ }, "findCommonEdges");
314
+ var findNonClusterChild = /* @__PURE__ */ __name((id, graph, clusterId) => {
315
+ const children = graph.children(id);
316
+ log.trace("Searching children of id ", id, children);
317
+ if (children.length < 1) return id;
318
+ let reserve;
319
+ for (const child of children) {
320
+ const _id = findNonClusterChild(child, graph, clusterId);
321
+ const commonEdges = findCommonEdges(graph, clusterId, _id);
322
+ if (_id) if (commonEdges.length > 0) reserve = _id;
323
+ else return _id;
324
+ }
325
+ return reserve;
326
+ }, "findNonClusterChild");
327
+ var getAnchorId = /* @__PURE__ */ __name((id) => {
328
+ if (!clusterDb.has(id)) return id;
329
+ if (!clusterDb.get(id).externalConnections) return id;
330
+ if (clusterDb.has(id)) return clusterDb.get(id).id;
331
+ return id;
332
+ }, "getAnchorId");
333
+ var adjustClustersAndEdges = /* @__PURE__ */ __name((graph, depth) => {
334
+ if (!graph || depth > 10) {
335
+ log.debug("Opting out, no graph ");
336
+ return;
337
+ } else log.debug("Opting in, graph ");
338
+ graph.nodes().forEach(function(id) {
339
+ if (graph.children(id).length > 0) {
340
+ log.debug("Cluster identified", id, " Replacement id in edges: ", findNonClusterChild(id, graph, id));
341
+ descendants.set(id, extractDescendants(id, graph));
342
+ clusterDb.set(id, {
343
+ id: findNonClusterChild(id, graph, id),
344
+ clusterData: graph.node(id)
345
+ });
346
+ }
347
+ });
348
+ graph.nodes().forEach(function(id) {
349
+ const children = graph.children(id);
350
+ const edges = graph.edges();
351
+ if (children.length > 0) {
352
+ log.debug("Cluster identified", id, descendants);
353
+ edges.forEach((edge) => {
354
+ if (isDescendant(edge.v, id) ^ isDescendant(edge.w, id)) {
355
+ log.debug("Edge: ", edge, " leaves cluster ", id);
356
+ log.debug("Descendants of XXX ", id, ": ", descendants.get(id));
357
+ clusterDb.get(id).externalConnections = true;
358
+ }
359
+ });
360
+ } else log.debug("Not a cluster ", id, descendants);
361
+ });
362
+ for (let id of clusterDb.keys()) {
363
+ const nonClusterChild = clusterDb.get(id).id;
364
+ const parent = graph.parent(nonClusterChild);
365
+ if (parent !== id && clusterDb.has(parent) && !clusterDb.get(parent).externalConnections) clusterDb.get(id).id = parent;
366
+ const hasDirectOutgoingEdge = graph.edges().some((edge) => edge.v === id);
367
+ if (nonClusterChild && clusterDb.get(id)?.externalConnections && hasDirectOutgoingEdge && isNodeInExtractableCluster(graph, nonClusterChild, id)) {
368
+ const safeAnchor = findSafeAnchorNode(graph, id, graph.parent(nonClusterChild));
369
+ if (safeAnchor) clusterDb.get(id).id = safeAnchor;
370
+ }
371
+ }
372
+ graph.edges().forEach(function(e) {
373
+ const edge = graph.edge(e);
374
+ log.debug("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(e));
375
+ log.debug("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(graph.edge(e)));
376
+ let v = e.v;
377
+ let w = e.w;
378
+ log.debug("Fix XXX", clusterDb, "ids:", e.v, e.w, "Translating: ", clusterDb.get(e.v), " --- ", clusterDb.get(e.w));
379
+ if (clusterDb.get(e.v) || clusterDb.get(e.w)) {
380
+ log.debug("Fixing and trying - removing XXX", e.v, e.w, e.name);
381
+ v = getAnchorId(e.v);
382
+ w = getAnchorId(e.w);
383
+ graph.removeEdge(e.v, e.w, e.name);
384
+ if (v !== e.v) {
385
+ const parent = graph.parent(v);
386
+ clusterDb.get(parent).externalConnections = true;
387
+ edge.fromCluster = e.v;
388
+ }
389
+ if (w !== e.w) {
390
+ const parent = graph.parent(w);
391
+ clusterDb.get(parent).externalConnections = true;
392
+ edge.toCluster = e.w;
393
+ }
394
+ log.debug("Fix Replacing with XXX", v, w, e.name);
395
+ graph.setEdge(v, w, edge, e.name);
396
+ }
397
+ });
398
+ extractor(graph, 0);
399
+ log.trace(clusterDb);
400
+ }, "adjustClustersAndEdges");
401
+ var extractor = /* @__PURE__ */ __name((graph, depth) => {
402
+ if (depth > 10) {
403
+ log.error("Bailing out");
404
+ return;
405
+ }
406
+ let nodes = graph.nodes();
407
+ let hasChildren = false;
408
+ for (const node of nodes) {
409
+ const children = graph.children(node);
410
+ hasChildren = hasChildren || children.length > 0;
411
+ }
412
+ if (!hasChildren) {
413
+ log.debug("Done, no node has children", graph.nodes());
414
+ return;
415
+ }
416
+ log.debug("Nodes = ", nodes, depth);
417
+ for (const node of nodes) {
418
+ log.debug("Extracting node", node, clusterDb, clusterDb.has(node) && !clusterDb.get(node).externalConnections, !graph.parent(node), graph.node(node), graph.children("D"), " Depth ", depth);
419
+ if (!clusterDb.has(node)) log.debug("Not a cluster", node, depth);
420
+ else if (!clusterDb.get(node).externalConnections && graph.children(node) && graph.children(node).length > 0) {
421
+ log.debug("Cluster without external connections, without a parent and with children", node, depth);
422
+ let dir = graph.graph().rankdir === "TB" ? "LR" : "TB";
423
+ if (clusterDb.get(node)?.clusterData?.dir) {
424
+ dir = clusterDb.get(node).clusterData.dir;
425
+ log.debug("Fixing dir", clusterDb.get(node).clusterData.dir, dir);
426
+ }
427
+ const clusterGraph = new Graph({
428
+ multigraph: true,
429
+ compound: true
430
+ }).setGraph({
431
+ rankdir: dir,
432
+ nodesep: 50,
433
+ ranksep: 50,
434
+ marginx: 8,
435
+ marginy: 8
436
+ }).setDefaultEdgeLabel(function() {
437
+ return {};
438
+ });
439
+ copy(node, graph, clusterGraph, node);
440
+ graph.setNode(node, {
441
+ clusterNode: true,
442
+ id: node,
443
+ clusterData: clusterDb.get(node).clusterData,
444
+ label: clusterDb.get(node).label,
445
+ graph: clusterGraph
446
+ });
447
+ } else {
448
+ log.debug("Cluster ** ", node, " **not meeting the criteria !externalConnections:", !clusterDb.get(node).externalConnections, " no parent: ", !graph.parent(node), " children ", graph.children(node) && graph.children(node).length > 0, graph.children("D"), depth);
449
+ log.debug(clusterDb);
450
+ }
451
+ }
452
+ nodes = graph.nodes();
453
+ log.debug("New list of nodes", nodes);
454
+ for (const node of nodes) {
455
+ const data = graph.node(node);
456
+ log.debug(" Now next level", node, data);
457
+ if (data?.clusterNode) extractor(data.graph, depth + 1);
458
+ }
459
+ }, "extractor");
460
+ var sorter = /* @__PURE__ */ __name((graph, nodes) => {
461
+ if (nodes.length === 0) return [];
462
+ let result = Object.assign([], nodes);
463
+ nodes.forEach((node) => {
464
+ const sorted = sorter(graph, graph.children(node));
465
+ result = [...result, ...sorted];
466
+ });
467
+ return result;
468
+ }, "sorter");
469
+ var sortNodesByHierarchy = /* @__PURE__ */ __name((graph) => sorter(graph, graph.children()), "sortNodesByHierarchy");
470
+ var isNodeInExtractableCluster = /* @__PURE__ */ __name((graph, node, rootId) => {
471
+ let parent = graph.parent(node);
472
+ while (parent && parent !== rootId) {
473
+ const cluster = clusterDb.get(parent);
474
+ if (cluster && !cluster.externalConnections) return true;
475
+ parent = graph.parent(parent);
476
+ }
477
+ return false;
478
+ }, "isNodeInExtractableCluster");
479
+ var findSafeAnchorNode = /* @__PURE__ */ __name((graph, clusterId, excludedCluster) => {
480
+ const children = graph.children(clusterId) ?? [];
481
+ for (const child of children) {
482
+ if (child === excludedCluster || isDescendant(child, excludedCluster)) continue;
483
+ const candidate = findNonClusterChild(child, graph, clusterId);
484
+ if (!candidate) continue;
485
+ if (!isNodeInExtractableCluster(graph, candidate, clusterId)) return candidate;
486
+ }
487
+ return null;
488
+ }, "findSafeAnchorNode");
489
+ function createCommonLayoutRenderer({ prepareLayout, measureLayout, runLayoutCore, paintLayout, afterPaint, paintOptions }) {
490
+ const measureLayoutFn = measureLayout ?? defaultMeasureLayout;
491
+ return /* @__PURE__ */ __name(async function render(data4Layout, svg, helpers, options) {
492
+ const element = svg.select("g");
493
+ (helpers?.insertMarkers ?? markers_default)(element, data4Layout.markers, data4Layout.type, data4Layout.diagramId);
494
+ clearLayoutRenderState();
495
+ const renderContext = {
496
+ element,
497
+ helpers,
498
+ options
499
+ };
500
+ renderContext.preparedLayout = await prepareLayout?.(data4Layout, renderContext);
501
+ const measure = await measureLayoutFn(data4Layout, renderContext);
502
+ const coreResult = await runLayoutCore(data4Layout, renderContext);
503
+ const paintContext = {
504
+ ...renderContext,
505
+ measure
506
+ };
507
+ if (paintLayout) await paintLayout(data4Layout, paintContext, coreResult);
508
+ else await paintLayoutData(data4Layout, paintContext, paintOptions);
509
+ await afterPaint?.(data4Layout, paintContext, coreResult);
510
+ }, "render");
511
+ }
512
+ __name(createCommonLayoutRenderer, "createCommonLayoutRenderer");
513
+ function clearLayoutRenderState() {
514
+ clear();
515
+ clear$1();
516
+ clear$2();
517
+ clear4();
518
+ }
519
+ __name(clearLayoutRenderState, "clearLayoutRenderState");
520
+ async function defaultMeasureLayout(data4Layout, { element }) {
521
+ return await createGraphWithElements(element, data4Layout);
522
+ }
523
+ __name(defaultMeasureLayout, "defaultMeasureLayout");
524
+ async function paintLayoutData(data4Layout, context, options = {}) {
525
+ const { measure } = context;
526
+ const { groups } = measure;
527
+ for (const node of options.getNodes?.(data4Layout, context) ?? data4Layout.nodes) {
528
+ if (options.skipNode?.(node, context)) continue;
529
+ await paintLayoutNode(groups, node, context, options);
530
+ }
531
+ const nodeById = buildNodeLookup(data4Layout.nodes);
532
+ for (const edge of data4Layout.edges) {
533
+ if (shouldSkipPaintEdge(edge, options)) continue;
534
+ await paintLayoutEdge(groups, edge, nodeById, data4Layout, options, context);
535
+ }
536
+ }
537
+ __name(paintLayoutData, "paintLayoutData");
538
+ async function paintLayoutNode(groups, node, context, options) {
539
+ if (node.clusterNode) positionNode(node);
540
+ else if (shouldPaintAsCluster(node, context, options)) await insertCluster(groups.clusters, node);
541
+ else positionNode(node);
542
+ }
543
+ __name(paintLayoutNode, "paintLayoutNode");
544
+ function shouldPaintAsCluster(node, context, options) {
545
+ return node.isGroup === true && (options.isCluster?.(node, context) ?? true);
546
+ }
547
+ __name(shouldPaintAsCluster, "shouldPaintAsCluster");
548
+ function buildNodeLookup(nodes) {
549
+ const nodeById = /* @__PURE__ */ new Map();
550
+ for (const node of nodes) if (node?.id) nodeById.set(node.id, node);
551
+ return nodeById;
552
+ }
553
+ __name(buildNodeLookup, "buildNodeLookup");
554
+ function shouldSkipPaintEdge(edge, options) {
555
+ return edge.isLayoutOnly || Boolean(options.skipEdge?.(edge));
556
+ }
557
+ __name(shouldSkipPaintEdge, "shouldSkipPaintEdge");
558
+ async function paintLayoutEdge(groups, edge, nodeById, data4Layout, options, context) {
559
+ const paths = insertEdge(groups.edgePaths, { ...edge }, options.clusterDb ?? /* @__PURE__ */ new Map(), data4Layout.type, getRenderedNode(edge.start, edge, nodeById, context, options), getRenderedNode(edge.end, edge, nodeById, context, options), data4Layout.diagramId, shouldSkipIntersect(edge, options));
560
+ if (hasEdgeLabel(edge)) {
561
+ if (!edgeLabels.has(edge.id)) await insertEdgeLabel(groups.edgeLabels, edge);
562
+ positionRenderedEdgeLabel(edge, paths);
563
+ }
564
+ }
565
+ __name(paintLayoutEdge, "paintLayoutEdge");
566
+ function getRenderedNode(id, edge, nodeById, context, options) {
567
+ return options.getEdgeNode?.(id, edge, context) ?? (id ? nodeById.get(id) ?? {} : {});
568
+ }
569
+ __name(getRenderedNode, "getRenderedNode");
570
+ function shouldSkipIntersect(edge, options) {
571
+ return typeof options.skipIntersect === "function" ? options.skipIntersect(edge) : options.skipIntersect ?? false;
572
+ }
573
+ __name(shouldSkipIntersect, "shouldSkipIntersect");
574
+ function positionRenderedEdgeLabel(edge, paths) {
575
+ const path = paths?.updatedPath ?? paths?.originalPath;
576
+ const siteConfig = getConfig();
577
+ const { subGraphTitleTotalMargin } = getSubGraphTitleMargins({ flowchart: siteConfig.flowchart ?? {} });
578
+ if (edge.label) {
579
+ const el = edgeLabels.get(edge.id);
580
+ let x = edge.x;
581
+ let y = edge.y;
582
+ if (path) {
583
+ const pos = utils_default.calcLabelPosition(path);
584
+ log.debug("Moving label " + edge.label + " from (", x, ",", y, ") to (", pos.x, ",", pos.y, ") abc88");
585
+ if (paths?.updatedPath) {
586
+ x = pos.x;
587
+ y = pos.y;
588
+ }
589
+ }
590
+ el.attr("transform", `translate(${x}, ${y + subGraphTitleTotalMargin / 2})`);
591
+ }
592
+ if (edge?.startLabelLeft) {
593
+ const el = terminalLabels.get(edge.id).startLeft;
594
+ let x = edge?.x;
595
+ let y = edge?.y;
596
+ if (path) {
597
+ const pos = utils_default.calcTerminalLabelPosition(edge.arrowTypeStart ? 10 : 0, "start_left", path);
598
+ x = pos.x;
599
+ y = pos.y;
600
+ }
601
+ el.attr("transform", `translate(${x}, ${y})`);
602
+ }
603
+ if (edge.startLabelRight) {
604
+ const el = terminalLabels.get(edge.id).startRight;
605
+ let x = edge.x;
606
+ let y = edge.y;
607
+ if (path) {
608
+ const pos = utils_default.calcTerminalLabelPosition(edge.arrowTypeStart ? 10 : 0, "start_right", path);
609
+ x = pos.x;
610
+ y = pos.y;
611
+ }
612
+ el.attr("transform", `translate(${x}, ${y})`);
613
+ }
614
+ if (edge.endLabelLeft) {
615
+ const el = terminalLabels.get(edge.id).endLeft;
616
+ let x = edge.x;
617
+ let y = edge.y;
618
+ if (path) {
619
+ const pos = utils_default.calcTerminalLabelPosition(edge.arrowTypeEnd ? 10 : 0, "end_left", path);
620
+ x = pos.x;
621
+ y = pos.y;
622
+ }
623
+ el.attr("transform", `translate(${x}, ${y})`);
624
+ }
625
+ if (edge.endLabelRight) {
626
+ const el = terminalLabels.get(edge.id).endRight;
627
+ let x = edge.x;
628
+ let y = edge.y;
629
+ if (path) {
630
+ const pos = utils_default.calcTerminalLabelPosition(edge.arrowTypeEnd ? 10 : 0, "end_right", path);
631
+ x = pos.x;
632
+ y = pos.y;
633
+ }
634
+ el.attr("transform", `translate(${x}, ${y})`);
635
+ }
636
+ }
637
+ __name(positionRenderedEdgeLabel, "positionRenderedEdgeLabel");
638
+
639
+ //#endregion
640
+ //#region ../../node_modules/.pnpm/mermaid@11.17.2/node_modules/mermaid/dist/chunks/mermaid.core/chunk-LNGE3PJU.mjs
641
+ function getDefaultExportFromCjs(x) {
642
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
643
+ }
644
+ __name(getDefaultExportFromCjs, "getDefaultExportFromCjs");
645
+ var jsYaml = {};
646
+ var loader = {};
647
+ var common = {};
648
+ var hasRequiredCommon;
649
+ function requireCommon() {
650
+ if (hasRequiredCommon) return common;
651
+ hasRequiredCommon = 1;
652
+ function isNothing(subject) {
653
+ return typeof subject === "undefined" || subject === null;
654
+ }
655
+ __name(isNothing, "isNothing");
656
+ function isObject(subject) {
657
+ return typeof subject === "object" && subject !== null;
658
+ }
659
+ __name(isObject, "isObject");
660
+ function toArray(sequence) {
661
+ if (Array.isArray(sequence)) return sequence;
662
+ else if (isNothing(sequence)) return [];
663
+ return [sequence];
664
+ }
665
+ __name(toArray, "toArray");
666
+ function extend(target, source) {
667
+ if (source) {
668
+ const sourceKeys = Object.keys(source);
669
+ for (let index = 0, length = sourceKeys.length; index < length; index += 1) {
670
+ const key = sourceKeys[index];
671
+ target[key] = source[key];
672
+ }
673
+ }
674
+ return target;
675
+ }
676
+ __name(extend, "extend");
677
+ function repeat(string, count) {
678
+ let result = "";
679
+ for (let cycle = 0; cycle < count; cycle += 1) result += string;
680
+ return result;
681
+ }
682
+ __name(repeat, "repeat");
683
+ function isNegativeZero(number) {
684
+ return number === 0 && Number.NEGATIVE_INFINITY === 1 / number;
685
+ }
686
+ __name(isNegativeZero, "isNegativeZero");
687
+ common.isNothing = isNothing;
688
+ common.isObject = isObject;
689
+ common.toArray = toArray;
690
+ common.repeat = repeat;
691
+ common.isNegativeZero = isNegativeZero;
692
+ common.extend = extend;
693
+ return common;
694
+ }
695
+ __name(requireCommon, "requireCommon");
696
+ var exception;
697
+ var hasRequiredException;
698
+ function requireException() {
699
+ if (hasRequiredException) return exception;
700
+ hasRequiredException = 1;
701
+ function formatError(exception2, compact) {
702
+ let where = "";
703
+ const message = exception2.reason || "(unknown reason)";
704
+ if (!exception2.mark) return message;
705
+ if (exception2.mark.name) where += "in \"" + exception2.mark.name + "\" ";
706
+ where += "(" + (exception2.mark.line + 1) + ":" + (exception2.mark.column + 1) + ")";
707
+ if (!compact && exception2.mark.snippet) where += "\n\n" + exception2.mark.snippet;
708
+ return message + " " + where;
709
+ }
710
+ __name(formatError, "formatError");
711
+ function YAMLException2(reason, mark) {
712
+ Error.call(this);
713
+ this.name = "YAMLException";
714
+ this.reason = reason;
715
+ this.mark = mark;
716
+ this.message = formatError(this, false);
717
+ if (Error.captureStackTrace) Error.captureStackTrace(this, this.constructor);
718
+ else this.stack = (/* @__PURE__ */ new Error()).stack || "";
719
+ }
720
+ __name(YAMLException2, "YAMLException2");
721
+ YAMLException2.prototype = Object.create(Error.prototype);
722
+ YAMLException2.prototype.constructor = YAMLException2;
723
+ YAMLException2.prototype.toString = /* @__PURE__ */ __name(function toString(compact) {
724
+ return this.name + ": " + formatError(this, compact);
725
+ }, "toString");
726
+ exception = YAMLException2;
727
+ return exception;
728
+ }
729
+ __name(requireException, "requireException");
730
+ var snippet;
731
+ var hasRequiredSnippet;
732
+ function requireSnippet() {
733
+ if (hasRequiredSnippet) return snippet;
734
+ hasRequiredSnippet = 1;
735
+ const common2 = requireCommon();
736
+ function getLine(buffer, lineStart, lineEnd, position, maxLineLength) {
737
+ let head = "";
738
+ let tail = "";
739
+ const maxHalfLength = Math.floor(maxLineLength / 2) - 1;
740
+ if (position - lineStart > maxHalfLength) {
741
+ head = " ... ";
742
+ lineStart = position - maxHalfLength + head.length;
743
+ }
744
+ if (lineEnd - position > maxHalfLength) {
745
+ tail = " ...";
746
+ lineEnd = position + maxHalfLength - tail.length;
747
+ }
748
+ return {
749
+ str: head + buffer.slice(lineStart, lineEnd).replace(/\t/g, "→") + tail,
750
+ pos: position - lineStart + head.length
751
+ };
752
+ }
753
+ __name(getLine, "getLine");
754
+ function padStart(string, max) {
755
+ return common2.repeat(" ", max - string.length) + string;
756
+ }
757
+ __name(padStart, "padStart");
758
+ function makeSnippet(mark, options) {
759
+ options = Object.create(options || null);
760
+ if (!mark.buffer) return null;
761
+ if (!options.maxLength) options.maxLength = 79;
762
+ if (typeof options.indent !== "number") options.indent = 1;
763
+ if (typeof options.linesBefore !== "number") options.linesBefore = 3;
764
+ if (typeof options.linesAfter !== "number") options.linesAfter = 2;
765
+ const re = /\r?\n|\r|\0/g;
766
+ const lineStarts = [0];
767
+ const lineEnds = [];
768
+ let match;
769
+ let foundLineNo = -1;
770
+ while (match = re.exec(mark.buffer)) {
771
+ lineEnds.push(match.index);
772
+ lineStarts.push(match.index + match[0].length);
773
+ if (mark.position <= match.index && foundLineNo < 0) foundLineNo = lineStarts.length - 2;
774
+ }
775
+ if (foundLineNo < 0) foundLineNo = lineStarts.length - 1;
776
+ let result = "";
777
+ const lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length;
778
+ const maxLineLength = options.maxLength - (options.indent + lineNoLength + 3);
779
+ for (let i = 1; i <= options.linesBefore; i++) {
780
+ if (foundLineNo - i < 0) break;
781
+ const line2 = getLine(mark.buffer, lineStarts[foundLineNo - i], lineEnds[foundLineNo - i], mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]), maxLineLength);
782
+ result = common2.repeat(" ", options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) + " | " + line2.str + "\n" + result;
783
+ }
784
+ const line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength);
785
+ result += common2.repeat(" ", options.indent) + padStart((mark.line + 1).toString(), lineNoLength) + " | " + line.str + "\n";
786
+ result += common2.repeat("-", options.indent + lineNoLength + 3 + line.pos) + "^\n";
787
+ for (let i = 1; i <= options.linesAfter; i++) {
788
+ if (foundLineNo + i >= lineEnds.length) break;
789
+ const line2 = getLine(mark.buffer, lineStarts[foundLineNo + i], lineEnds[foundLineNo + i], mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]), maxLineLength);
790
+ result += common2.repeat(" ", options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) + " | " + line2.str + "\n";
791
+ }
792
+ return result.replace(/\n$/, "");
793
+ }
794
+ __name(makeSnippet, "makeSnippet");
795
+ snippet = makeSnippet;
796
+ return snippet;
797
+ }
798
+ __name(requireSnippet, "requireSnippet");
799
+ var type;
800
+ var hasRequiredType;
801
+ function requireType() {
802
+ if (hasRequiredType) return type;
803
+ hasRequiredType = 1;
804
+ const YAMLException2 = requireException();
805
+ const TYPE_CONSTRUCTOR_OPTIONS = [
806
+ "kind",
807
+ "multi",
808
+ "resolve",
809
+ "construct",
810
+ "instanceOf",
811
+ "predicate",
812
+ "represent",
813
+ "representName",
814
+ "defaultStyle",
815
+ "styleAliases"
816
+ ];
817
+ const YAML_NODE_KINDS = [
818
+ "scalar",
819
+ "sequence",
820
+ "mapping"
821
+ ];
822
+ function compileStyleAliases(map2) {
823
+ const result = {};
824
+ if (map2 !== null) Object.keys(map2).forEach(function(style) {
825
+ map2[style].forEach(function(alias) {
826
+ result[String(alias)] = style;
827
+ });
828
+ });
829
+ return result;
830
+ }
831
+ __name(compileStyleAliases, "compileStyleAliases");
832
+ function Type2(tag, options) {
833
+ options = options || {};
834
+ Object.keys(options).forEach(function(name) {
835
+ if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) throw new YAMLException2("Unknown option \"" + name + "\" is met in definition of \"" + tag + "\" YAML type.");
836
+ });
837
+ this.options = options;
838
+ this.tag = tag;
839
+ this.kind = options["kind"] || null;
840
+ this.resolve = options["resolve"] || function() {
841
+ return true;
842
+ };
843
+ this.construct = options["construct"] || function(data) {
844
+ return data;
845
+ };
846
+ this.instanceOf = options["instanceOf"] || null;
847
+ this.predicate = options["predicate"] || null;
848
+ this.represent = options["represent"] || null;
849
+ this.representName = options["representName"] || null;
850
+ this.defaultStyle = options["defaultStyle"] || null;
851
+ this.multi = options["multi"] || false;
852
+ this.styleAliases = compileStyleAliases(options["styleAliases"] || null);
853
+ if (YAML_NODE_KINDS.indexOf(this.kind) === -1) throw new YAMLException2("Unknown kind \"" + this.kind + "\" is specified for \"" + tag + "\" YAML type.");
854
+ }
855
+ __name(Type2, "Type2");
856
+ type = Type2;
857
+ return type;
858
+ }
859
+ __name(requireType, "requireType");
860
+ var schema;
861
+ var hasRequiredSchema;
862
+ function requireSchema() {
863
+ if (hasRequiredSchema) return schema;
864
+ hasRequiredSchema = 1;
865
+ const YAMLException2 = requireException();
866
+ const Type2 = requireType();
867
+ function compileList(schema2, name) {
868
+ const result = [];
869
+ schema2[name].forEach(function(currentType) {
870
+ let newIndex = result.length;
871
+ result.forEach(function(previousType, previousIndex) {
872
+ if (previousType.tag === currentType.tag && previousType.kind === currentType.kind && previousType.multi === currentType.multi) newIndex = previousIndex;
873
+ });
874
+ result[newIndex] = currentType;
875
+ });
876
+ return result;
877
+ }
878
+ __name(compileList, "compileList");
879
+ function compileMap() {
880
+ const result = {
881
+ scalar: {},
882
+ sequence: {},
883
+ mapping: {},
884
+ fallback: {},
885
+ multi: {
886
+ scalar: [],
887
+ sequence: [],
888
+ mapping: [],
889
+ fallback: []
890
+ }
891
+ };
892
+ function collectType(type2) {
893
+ if (type2.multi) {
894
+ result.multi[type2.kind].push(type2);
895
+ result.multi["fallback"].push(type2);
896
+ } else result[type2.kind][type2.tag] = result["fallback"][type2.tag] = type2;
897
+ }
898
+ __name(collectType, "collectType");
899
+ for (let index = 0, length = arguments.length; index < length; index += 1) arguments[index].forEach(collectType);
900
+ return result;
901
+ }
902
+ __name(compileMap, "compileMap");
903
+ function Schema2(definition) {
904
+ return this.extend(definition);
905
+ }
906
+ __name(Schema2, "Schema2");
907
+ Schema2.prototype.extend = /* @__PURE__ */ __name(function extend(definition) {
908
+ let implicit = [];
909
+ let explicit = [];
910
+ if (definition instanceof Type2) explicit.push(definition);
911
+ else if (Array.isArray(definition)) explicit = explicit.concat(definition);
912
+ else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) {
913
+ if (definition.implicit) implicit = implicit.concat(definition.implicit);
914
+ if (definition.explicit) explicit = explicit.concat(definition.explicit);
915
+ } else throw new YAMLException2("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");
916
+ implicit.forEach(function(type2) {
917
+ if (!(type2 instanceof Type2)) throw new YAMLException2("Specified list of YAML types (or a single Type object) contains a non-Type object.");
918
+ if (type2.loadKind && type2.loadKind !== "scalar") throw new YAMLException2("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");
919
+ if (type2.multi) throw new YAMLException2("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.");
920
+ });
921
+ explicit.forEach(function(type2) {
922
+ if (!(type2 instanceof Type2)) throw new YAMLException2("Specified list of YAML types (or a single Type object) contains a non-Type object.");
923
+ });
924
+ const result = Object.create(Schema2.prototype);
925
+ result.implicit = (this.implicit || []).concat(implicit);
926
+ result.explicit = (this.explicit || []).concat(explicit);
927
+ result.compiledImplicit = compileList(result, "implicit");
928
+ result.compiledExplicit = compileList(result, "explicit");
929
+ result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit);
930
+ return result;
931
+ }, "extend");
932
+ schema = Schema2;
933
+ return schema;
934
+ }
935
+ __name(requireSchema, "requireSchema");
936
+ var str;
937
+ var hasRequiredStr;
938
+ function requireStr() {
939
+ if (hasRequiredStr) return str;
940
+ hasRequiredStr = 1;
941
+ str = new (requireType())("tag:yaml.org,2002:str", {
942
+ kind: "scalar",
943
+ construct: /* @__PURE__ */ __name(function(data) {
944
+ return data !== null ? data : "";
945
+ }, "construct")
946
+ });
947
+ return str;
948
+ }
949
+ __name(requireStr, "requireStr");
950
+ var seq;
951
+ var hasRequiredSeq;
952
+ function requireSeq() {
953
+ if (hasRequiredSeq) return seq;
954
+ hasRequiredSeq = 1;
955
+ seq = new (requireType())("tag:yaml.org,2002:seq", {
956
+ kind: "sequence",
957
+ construct: /* @__PURE__ */ __name(function(data) {
958
+ return data !== null ? data : [];
959
+ }, "construct")
960
+ });
961
+ return seq;
962
+ }
963
+ __name(requireSeq, "requireSeq");
964
+ var map;
965
+ var hasRequiredMap;
966
+ function requireMap() {
967
+ if (hasRequiredMap) return map;
968
+ hasRequiredMap = 1;
969
+ map = new (requireType())("tag:yaml.org,2002:map", {
970
+ kind: "mapping",
971
+ construct: /* @__PURE__ */ __name(function(data) {
972
+ return data !== null ? data : {};
973
+ }, "construct")
974
+ });
975
+ return map;
976
+ }
977
+ __name(requireMap, "requireMap");
978
+ var failsafe;
979
+ var hasRequiredFailsafe;
980
+ function requireFailsafe() {
981
+ if (hasRequiredFailsafe) return failsafe;
982
+ hasRequiredFailsafe = 1;
983
+ failsafe = new (requireSchema())({ explicit: [
984
+ requireStr(),
985
+ requireSeq(),
986
+ requireMap()
987
+ ] });
988
+ return failsafe;
989
+ }
990
+ __name(requireFailsafe, "requireFailsafe");
991
+ var _null;
992
+ var hasRequired_null;
993
+ function require_null() {
994
+ if (hasRequired_null) return _null;
995
+ hasRequired_null = 1;
996
+ const Type2 = requireType();
997
+ function resolveYamlNull(data) {
998
+ if (data === null) return true;
999
+ const max = data.length;
1000
+ return max === 1 && data === "~" || max === 4 && (data === "null" || data === "Null" || data === "NULL");
1001
+ }
1002
+ __name(resolveYamlNull, "resolveYamlNull");
1003
+ function constructYamlNull() {
1004
+ return null;
1005
+ }
1006
+ __name(constructYamlNull, "constructYamlNull");
1007
+ function isNull(object) {
1008
+ return object === null;
1009
+ }
1010
+ __name(isNull, "isNull");
1011
+ _null = new Type2("tag:yaml.org,2002:null", {
1012
+ kind: "scalar",
1013
+ resolve: resolveYamlNull,
1014
+ construct: constructYamlNull,
1015
+ predicate: isNull,
1016
+ represent: {
1017
+ canonical: /* @__PURE__ */ __name(function() {
1018
+ return "~";
1019
+ }, "canonical"),
1020
+ lowercase: /* @__PURE__ */ __name(function() {
1021
+ return "null";
1022
+ }, "lowercase"),
1023
+ uppercase: /* @__PURE__ */ __name(function() {
1024
+ return "NULL";
1025
+ }, "uppercase"),
1026
+ camelcase: /* @__PURE__ */ __name(function() {
1027
+ return "Null";
1028
+ }, "camelcase"),
1029
+ empty: /* @__PURE__ */ __name(function() {
1030
+ return "";
1031
+ }, "empty")
1032
+ },
1033
+ defaultStyle: "lowercase"
1034
+ });
1035
+ return _null;
1036
+ }
1037
+ __name(require_null, "require_null");
1038
+ var bool;
1039
+ var hasRequiredBool;
1040
+ function requireBool() {
1041
+ if (hasRequiredBool) return bool;
1042
+ hasRequiredBool = 1;
1043
+ const Type2 = requireType();
1044
+ function resolveYamlBoolean(data) {
1045
+ if (data === null) return false;
1046
+ const max = data.length;
1047
+ return max === 4 && (data === "true" || data === "True" || data === "TRUE") || max === 5 && (data === "false" || data === "False" || data === "FALSE");
1048
+ }
1049
+ __name(resolveYamlBoolean, "resolveYamlBoolean");
1050
+ function constructYamlBoolean(data) {
1051
+ return data === "true" || data === "True" || data === "TRUE";
1052
+ }
1053
+ __name(constructYamlBoolean, "constructYamlBoolean");
1054
+ function isBoolean(object) {
1055
+ return Object.prototype.toString.call(object) === "[object Boolean]";
1056
+ }
1057
+ __name(isBoolean, "isBoolean");
1058
+ bool = new Type2("tag:yaml.org,2002:bool", {
1059
+ kind: "scalar",
1060
+ resolve: resolveYamlBoolean,
1061
+ construct: constructYamlBoolean,
1062
+ predicate: isBoolean,
1063
+ represent: {
1064
+ lowercase: /* @__PURE__ */ __name(function(object) {
1065
+ return object ? "true" : "false";
1066
+ }, "lowercase"),
1067
+ uppercase: /* @__PURE__ */ __name(function(object) {
1068
+ return object ? "TRUE" : "FALSE";
1069
+ }, "uppercase"),
1070
+ camelcase: /* @__PURE__ */ __name(function(object) {
1071
+ return object ? "True" : "False";
1072
+ }, "camelcase")
1073
+ },
1074
+ defaultStyle: "lowercase"
1075
+ });
1076
+ return bool;
1077
+ }
1078
+ __name(requireBool, "requireBool");
1079
+ var int;
1080
+ var hasRequiredInt;
1081
+ function requireInt() {
1082
+ if (hasRequiredInt) return int;
1083
+ hasRequiredInt = 1;
1084
+ const common2 = requireCommon();
1085
+ const Type2 = requireType();
1086
+ function isHexCode(c) {
1087
+ return c >= 48 && c <= 57 || c >= 65 && c <= 70 || c >= 97 && c <= 102;
1088
+ }
1089
+ __name(isHexCode, "isHexCode");
1090
+ function isOctCode(c) {
1091
+ return c >= 48 && c <= 55;
1092
+ }
1093
+ __name(isOctCode, "isOctCode");
1094
+ function isDecCode(c) {
1095
+ return c >= 48 && c <= 57;
1096
+ }
1097
+ __name(isDecCode, "isDecCode");
1098
+ function resolveYamlInteger(data) {
1099
+ if (data === null) return false;
1100
+ const max = data.length;
1101
+ let index = 0;
1102
+ let hasDigits = false;
1103
+ if (!max) return false;
1104
+ let ch = data[index];
1105
+ if (ch === "-" || ch === "+") ch = data[++index];
1106
+ if (ch === "0") {
1107
+ if (index + 1 === max) return true;
1108
+ ch = data[++index];
1109
+ if (ch === "b") {
1110
+ index++;
1111
+ for (; index < max; index++) {
1112
+ ch = data[index];
1113
+ if (ch !== "0" && ch !== "1") return false;
1114
+ hasDigits = true;
1115
+ }
1116
+ return hasDigits && isFinite(parseYamlInteger(data));
1117
+ }
1118
+ if (ch === "x") {
1119
+ index++;
1120
+ for (; index < max; index++) {
1121
+ if (!isHexCode(data.charCodeAt(index))) return false;
1122
+ hasDigits = true;
1123
+ }
1124
+ return hasDigits && isFinite(parseYamlInteger(data));
1125
+ }
1126
+ if (ch === "o") {
1127
+ index++;
1128
+ for (; index < max; index++) {
1129
+ if (!isOctCode(data.charCodeAt(index))) return false;
1130
+ hasDigits = true;
1131
+ }
1132
+ return hasDigits && isFinite(parseYamlInteger(data));
1133
+ }
1134
+ }
1135
+ for (; index < max; index++) {
1136
+ if (!isDecCode(data.charCodeAt(index))) return false;
1137
+ hasDigits = true;
1138
+ }
1139
+ if (!hasDigits) return false;
1140
+ return isFinite(parseYamlInteger(data));
1141
+ }
1142
+ __name(resolveYamlInteger, "resolveYamlInteger");
1143
+ function parseYamlInteger(data) {
1144
+ let value = data;
1145
+ let sign = 1;
1146
+ let ch = value[0];
1147
+ if (ch === "-" || ch === "+") {
1148
+ if (ch === "-") sign = -1;
1149
+ value = value.slice(1);
1150
+ ch = value[0];
1151
+ }
1152
+ if (value === "0") return 0;
1153
+ if (ch === "0") {
1154
+ if (value[1] === "b") return sign * parseInt(value.slice(2), 2);
1155
+ if (value[1] === "x") return sign * parseInt(value.slice(2), 16);
1156
+ if (value[1] === "o") return sign * parseInt(value.slice(2), 8);
1157
+ }
1158
+ return sign * parseInt(value, 10);
1159
+ }
1160
+ __name(parseYamlInteger, "parseYamlInteger");
1161
+ function constructYamlInteger(data) {
1162
+ return parseYamlInteger(data);
1163
+ }
1164
+ __name(constructYamlInteger, "constructYamlInteger");
1165
+ function isInteger(object) {
1166
+ return Object.prototype.toString.call(object) === "[object Number]" && object % 1 === 0 && !common2.isNegativeZero(object);
1167
+ }
1168
+ __name(isInteger, "isInteger");
1169
+ int = new Type2("tag:yaml.org,2002:int", {
1170
+ kind: "scalar",
1171
+ resolve: resolveYamlInteger,
1172
+ construct: constructYamlInteger,
1173
+ predicate: isInteger,
1174
+ represent: {
1175
+ binary: /* @__PURE__ */ __name(function(obj) {
1176
+ return obj >= 0 ? "0b" + obj.toString(2) : "-0b" + obj.toString(2).slice(1);
1177
+ }, "binary"),
1178
+ octal: /* @__PURE__ */ __name(function(obj) {
1179
+ return obj >= 0 ? "0o" + obj.toString(8) : "-0o" + obj.toString(8).slice(1);
1180
+ }, "octal"),
1181
+ decimal: /* @__PURE__ */ __name(function(obj) {
1182
+ return obj.toString(10);
1183
+ }, "decimal"),
1184
+ hexadecimal: /* @__PURE__ */ __name(function(obj) {
1185
+ return obj >= 0 ? "0x" + obj.toString(16).toUpperCase() : "-0x" + obj.toString(16).toUpperCase().slice(1);
1186
+ }, "hexadecimal")
1187
+ },
1188
+ defaultStyle: "decimal",
1189
+ styleAliases: {
1190
+ binary: [2, "bin"],
1191
+ octal: [8, "oct"],
1192
+ decimal: [10, "dec"],
1193
+ hexadecimal: [16, "hex"]
1194
+ }
1195
+ });
1196
+ return int;
1197
+ }
1198
+ __name(requireInt, "requireInt");
1199
+ var float;
1200
+ var hasRequiredFloat;
1201
+ function requireFloat() {
1202
+ if (hasRequiredFloat) return float;
1203
+ hasRequiredFloat = 1;
1204
+ const common2 = requireCommon();
1205
+ const Type2 = requireType();
1206
+ const YAML_FLOAT_PATTERN = /* @__PURE__ */ new RegExp("^(?:[-+]?(?:[0-9]+)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");
1207
+ const YAML_FLOAT_SPECIAL_PATTERN = /* @__PURE__ */ new RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");
1208
+ function resolveYamlFloat(data) {
1209
+ if (data === null) return false;
1210
+ if (!YAML_FLOAT_PATTERN.test(data)) return false;
1211
+ if (isFinite(parseFloat(data, 10))) return true;
1212
+ return YAML_FLOAT_SPECIAL_PATTERN.test(data);
1213
+ }
1214
+ __name(resolveYamlFloat, "resolveYamlFloat");
1215
+ function constructYamlFloat(data) {
1216
+ let value = data.toLowerCase();
1217
+ const sign = value[0] === "-" ? -1 : 1;
1218
+ if ("+-".indexOf(value[0]) >= 0) value = value.slice(1);
1219
+ if (value === ".inf") return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
1220
+ else if (value === ".nan") return NaN;
1221
+ return sign * parseFloat(value, 10);
1222
+ }
1223
+ __name(constructYamlFloat, "constructYamlFloat");
1224
+ const SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
1225
+ function representYamlFloat(object, style) {
1226
+ if (isNaN(object)) switch (style) {
1227
+ case "lowercase": return ".nan";
1228
+ case "uppercase": return ".NAN";
1229
+ case "camelcase": return ".NaN";
1230
+ }
1231
+ else if (Number.POSITIVE_INFINITY === object) switch (style) {
1232
+ case "lowercase": return ".inf";
1233
+ case "uppercase": return ".INF";
1234
+ case "camelcase": return ".Inf";
1235
+ }
1236
+ else if (Number.NEGATIVE_INFINITY === object) switch (style) {
1237
+ case "lowercase": return "-.inf";
1238
+ case "uppercase": return "-.INF";
1239
+ case "camelcase": return "-.Inf";
1240
+ }
1241
+ else if (common2.isNegativeZero(object)) return "-0.0";
1242
+ const res = object.toString(10);
1243
+ return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace("e", ".e") : res;
1244
+ }
1245
+ __name(representYamlFloat, "representYamlFloat");
1246
+ function isFloat(object) {
1247
+ return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 !== 0 || common2.isNegativeZero(object));
1248
+ }
1249
+ __name(isFloat, "isFloat");
1250
+ float = new Type2("tag:yaml.org,2002:float", {
1251
+ kind: "scalar",
1252
+ resolve: resolveYamlFloat,
1253
+ construct: constructYamlFloat,
1254
+ predicate: isFloat,
1255
+ represent: representYamlFloat,
1256
+ defaultStyle: "lowercase"
1257
+ });
1258
+ return float;
1259
+ }
1260
+ __name(requireFloat, "requireFloat");
1261
+ var json;
1262
+ var hasRequiredJson;
1263
+ function requireJson() {
1264
+ if (hasRequiredJson) return json;
1265
+ hasRequiredJson = 1;
1266
+ json = requireFailsafe().extend({ implicit: [
1267
+ require_null(),
1268
+ requireBool(),
1269
+ requireInt(),
1270
+ requireFloat()
1271
+ ] });
1272
+ return json;
1273
+ }
1274
+ __name(requireJson, "requireJson");
1275
+ var core;
1276
+ var hasRequiredCore;
1277
+ function requireCore() {
1278
+ if (hasRequiredCore) return core;
1279
+ hasRequiredCore = 1;
1280
+ core = requireJson();
1281
+ return core;
1282
+ }
1283
+ __name(requireCore, "requireCore");
1284
+ var timestamp;
1285
+ var hasRequiredTimestamp;
1286
+ function requireTimestamp() {
1287
+ if (hasRequiredTimestamp) return timestamp;
1288
+ hasRequiredTimestamp = 1;
1289
+ const Type2 = requireType();
1290
+ const YAML_DATE_REGEXP = /* @__PURE__ */ new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$");
1291
+ const YAML_TIMESTAMP_REGEXP = /* @__PURE__ */ new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");
1292
+ function resolveYamlTimestamp(data) {
1293
+ if (data === null) return false;
1294
+ if (YAML_DATE_REGEXP.exec(data) !== null) return true;
1295
+ if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true;
1296
+ return false;
1297
+ }
1298
+ __name(resolveYamlTimestamp, "resolveYamlTimestamp");
1299
+ function constructYamlTimestamp(data) {
1300
+ let fraction = 0;
1301
+ let delta = null;
1302
+ let match = YAML_DATE_REGEXP.exec(data);
1303
+ if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data);
1304
+ if (match === null) throw new Error("Date resolve error");
1305
+ const year = +match[1];
1306
+ const month = +match[2] - 1;
1307
+ const day = +match[3];
1308
+ if (!match[4]) return new Date(Date.UTC(year, month, day));
1309
+ const hour = +match[4];
1310
+ const minute = +match[5];
1311
+ const second = +match[6];
1312
+ if (match[7]) {
1313
+ fraction = match[7].slice(0, 3);
1314
+ while (fraction.length < 3) fraction += "0";
1315
+ fraction = +fraction;
1316
+ }
1317
+ if (match[9]) {
1318
+ const tzHour = +match[10];
1319
+ const tzMinute = +(match[11] || 0);
1320
+ delta = (tzHour * 60 + tzMinute) * 6e4;
1321
+ if (match[9] === "-") delta = -delta;
1322
+ }
1323
+ const date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
1324
+ if (delta) date.setTime(date.getTime() - delta);
1325
+ return date;
1326
+ }
1327
+ __name(constructYamlTimestamp, "constructYamlTimestamp");
1328
+ function representYamlTimestamp(object) {
1329
+ return object.toISOString();
1330
+ }
1331
+ __name(representYamlTimestamp, "representYamlTimestamp");
1332
+ timestamp = new Type2("tag:yaml.org,2002:timestamp", {
1333
+ kind: "scalar",
1334
+ resolve: resolveYamlTimestamp,
1335
+ construct: constructYamlTimestamp,
1336
+ instanceOf: Date,
1337
+ represent: representYamlTimestamp
1338
+ });
1339
+ return timestamp;
1340
+ }
1341
+ __name(requireTimestamp, "requireTimestamp");
1342
+ var merge;
1343
+ var hasRequiredMerge;
1344
+ function requireMerge() {
1345
+ if (hasRequiredMerge) return merge;
1346
+ hasRequiredMerge = 1;
1347
+ const Type2 = requireType();
1348
+ function resolveYamlMerge(data) {
1349
+ return data === "<<" || data === null;
1350
+ }
1351
+ __name(resolveYamlMerge, "resolveYamlMerge");
1352
+ merge = new Type2("tag:yaml.org,2002:merge", {
1353
+ kind: "scalar",
1354
+ resolve: resolveYamlMerge
1355
+ });
1356
+ return merge;
1357
+ }
1358
+ __name(requireMerge, "requireMerge");
1359
+ var binary;
1360
+ var hasRequiredBinary;
1361
+ function requireBinary() {
1362
+ if (hasRequiredBinary) return binary;
1363
+ hasRequiredBinary = 1;
1364
+ const Type2 = requireType();
1365
+ const BASE64_MAP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";
1366
+ function resolveYamlBinary(data) {
1367
+ if (data === null) return false;
1368
+ let bitlen = 0;
1369
+ const max = data.length;
1370
+ const map2 = BASE64_MAP;
1371
+ for (let idx = 0; idx < max; idx++) {
1372
+ const code = map2.indexOf(data.charAt(idx));
1373
+ if (code > 64) continue;
1374
+ if (code < 0) return false;
1375
+ bitlen += 6;
1376
+ }
1377
+ return bitlen % 8 === 0;
1378
+ }
1379
+ __name(resolveYamlBinary, "resolveYamlBinary");
1380
+ function constructYamlBinary(data) {
1381
+ const input = data.replace(/[\r\n=]/g, "");
1382
+ const max = input.length;
1383
+ const map2 = BASE64_MAP;
1384
+ let bits = 0;
1385
+ const result = [];
1386
+ for (let idx = 0; idx < max; idx++) {
1387
+ if (idx % 4 === 0 && idx) {
1388
+ result.push(bits >> 16 & 255);
1389
+ result.push(bits >> 8 & 255);
1390
+ result.push(bits & 255);
1391
+ }
1392
+ bits = bits << 6 | map2.indexOf(input.charAt(idx));
1393
+ }
1394
+ const tailbits = max % 4 * 6;
1395
+ if (tailbits === 0) {
1396
+ result.push(bits >> 16 & 255);
1397
+ result.push(bits >> 8 & 255);
1398
+ result.push(bits & 255);
1399
+ } else if (tailbits === 18) {
1400
+ result.push(bits >> 10 & 255);
1401
+ result.push(bits >> 2 & 255);
1402
+ } else if (tailbits === 12) result.push(bits >> 4 & 255);
1403
+ return new Uint8Array(result);
1404
+ }
1405
+ __name(constructYamlBinary, "constructYamlBinary");
1406
+ function representYamlBinary(object) {
1407
+ let result = "";
1408
+ let bits = 0;
1409
+ const max = object.length;
1410
+ const map2 = BASE64_MAP;
1411
+ for (let idx = 0; idx < max; idx++) {
1412
+ if (idx % 3 === 0 && idx) {
1413
+ result += map2[bits >> 18 & 63];
1414
+ result += map2[bits >> 12 & 63];
1415
+ result += map2[bits >> 6 & 63];
1416
+ result += map2[bits & 63];
1417
+ }
1418
+ bits = (bits << 8) + object[idx];
1419
+ }
1420
+ const tail = max % 3;
1421
+ if (tail === 0) {
1422
+ result += map2[bits >> 18 & 63];
1423
+ result += map2[bits >> 12 & 63];
1424
+ result += map2[bits >> 6 & 63];
1425
+ result += map2[bits & 63];
1426
+ } else if (tail === 2) {
1427
+ result += map2[bits >> 10 & 63];
1428
+ result += map2[bits >> 4 & 63];
1429
+ result += map2[bits << 2 & 63];
1430
+ result += map2[64];
1431
+ } else if (tail === 1) {
1432
+ result += map2[bits >> 2 & 63];
1433
+ result += map2[bits << 4 & 63];
1434
+ result += map2[64];
1435
+ result += map2[64];
1436
+ }
1437
+ return result;
1438
+ }
1439
+ __name(representYamlBinary, "representYamlBinary");
1440
+ function isBinary(obj) {
1441
+ return Object.prototype.toString.call(obj) === "[object Uint8Array]";
1442
+ }
1443
+ __name(isBinary, "isBinary");
1444
+ binary = new Type2("tag:yaml.org,2002:binary", {
1445
+ kind: "scalar",
1446
+ resolve: resolveYamlBinary,
1447
+ construct: constructYamlBinary,
1448
+ predicate: isBinary,
1449
+ represent: representYamlBinary
1450
+ });
1451
+ return binary;
1452
+ }
1453
+ __name(requireBinary, "requireBinary");
1454
+ var omap;
1455
+ var hasRequiredOmap;
1456
+ function requireOmap() {
1457
+ if (hasRequiredOmap) return omap;
1458
+ hasRequiredOmap = 1;
1459
+ const Type2 = requireType();
1460
+ const _hasOwnProperty = Object.prototype.hasOwnProperty;
1461
+ const _toString = Object.prototype.toString;
1462
+ function resolveYamlOmap(data) {
1463
+ if (data === null) return true;
1464
+ const objectKeys = [];
1465
+ const object = data;
1466
+ for (let index = 0, length = object.length; index < length; index += 1) {
1467
+ const pair = object[index];
1468
+ let pairHasKey = false;
1469
+ if (_toString.call(pair) !== "[object Object]") return false;
1470
+ let pairKey;
1471
+ for (pairKey in pair) if (_hasOwnProperty.call(pair, pairKey)) if (!pairHasKey) pairHasKey = true;
1472
+ else return false;
1473
+ if (!pairHasKey) return false;
1474
+ if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey);
1475
+ else return false;
1476
+ }
1477
+ return true;
1478
+ }
1479
+ __name(resolveYamlOmap, "resolveYamlOmap");
1480
+ function constructYamlOmap(data) {
1481
+ return data !== null ? data : [];
1482
+ }
1483
+ __name(constructYamlOmap, "constructYamlOmap");
1484
+ omap = new Type2("tag:yaml.org,2002:omap", {
1485
+ kind: "sequence",
1486
+ resolve: resolveYamlOmap,
1487
+ construct: constructYamlOmap
1488
+ });
1489
+ return omap;
1490
+ }
1491
+ __name(requireOmap, "requireOmap");
1492
+ var pairs;
1493
+ var hasRequiredPairs;
1494
+ function requirePairs() {
1495
+ if (hasRequiredPairs) return pairs;
1496
+ hasRequiredPairs = 1;
1497
+ const Type2 = requireType();
1498
+ const _toString = Object.prototype.toString;
1499
+ function resolveYamlPairs(data) {
1500
+ if (data === null) return true;
1501
+ const object = data;
1502
+ const result = new Array(object.length);
1503
+ for (let index = 0, length = object.length; index < length; index += 1) {
1504
+ const pair = object[index];
1505
+ if (_toString.call(pair) !== "[object Object]") return false;
1506
+ const keys = Object.keys(pair);
1507
+ if (keys.length !== 1) return false;
1508
+ result[index] = [keys[0], pair[keys[0]]];
1509
+ }
1510
+ return true;
1511
+ }
1512
+ __name(resolveYamlPairs, "resolveYamlPairs");
1513
+ function constructYamlPairs(data) {
1514
+ if (data === null) return [];
1515
+ const object = data;
1516
+ const result = new Array(object.length);
1517
+ for (let index = 0, length = object.length; index < length; index += 1) {
1518
+ const pair = object[index];
1519
+ const keys = Object.keys(pair);
1520
+ result[index] = [keys[0], pair[keys[0]]];
1521
+ }
1522
+ return result;
1523
+ }
1524
+ __name(constructYamlPairs, "constructYamlPairs");
1525
+ pairs = new Type2("tag:yaml.org,2002:pairs", {
1526
+ kind: "sequence",
1527
+ resolve: resolveYamlPairs,
1528
+ construct: constructYamlPairs
1529
+ });
1530
+ return pairs;
1531
+ }
1532
+ __name(requirePairs, "requirePairs");
1533
+ var set;
1534
+ var hasRequiredSet;
1535
+ function requireSet() {
1536
+ if (hasRequiredSet) return set;
1537
+ hasRequiredSet = 1;
1538
+ const Type2 = requireType();
1539
+ const _hasOwnProperty = Object.prototype.hasOwnProperty;
1540
+ function resolveYamlSet(data) {
1541
+ if (data === null) return true;
1542
+ const object = data;
1543
+ for (const key in object) if (_hasOwnProperty.call(object, key)) {
1544
+ if (object[key] !== null) return false;
1545
+ }
1546
+ return true;
1547
+ }
1548
+ __name(resolveYamlSet, "resolveYamlSet");
1549
+ function constructYamlSet(data) {
1550
+ return data !== null ? data : {};
1551
+ }
1552
+ __name(constructYamlSet, "constructYamlSet");
1553
+ set = new Type2("tag:yaml.org,2002:set", {
1554
+ kind: "mapping",
1555
+ resolve: resolveYamlSet,
1556
+ construct: constructYamlSet
1557
+ });
1558
+ return set;
1559
+ }
1560
+ __name(requireSet, "requireSet");
1561
+ var _default;
1562
+ var hasRequired_default;
1563
+ function require_default() {
1564
+ if (hasRequired_default) return _default;
1565
+ hasRequired_default = 1;
1566
+ _default = requireCore().extend({
1567
+ implicit: [requireTimestamp(), requireMerge()],
1568
+ explicit: [
1569
+ requireBinary(),
1570
+ requireOmap(),
1571
+ requirePairs(),
1572
+ requireSet()
1573
+ ]
1574
+ });
1575
+ return _default;
1576
+ }
1577
+ __name(require_default, "require_default");
1578
+ var hasRequiredLoader;
1579
+ function requireLoader() {
1580
+ if (hasRequiredLoader) return loader;
1581
+ hasRequiredLoader = 1;
1582
+ const common2 = requireCommon();
1583
+ const YAMLException2 = requireException();
1584
+ const makeSnippet = requireSnippet();
1585
+ const DEFAULT_SCHEMA2 = require_default();
1586
+ const _hasOwnProperty = Object.prototype.hasOwnProperty;
1587
+ const CONTEXT_FLOW_IN = 1;
1588
+ const CONTEXT_FLOW_OUT = 2;
1589
+ const CONTEXT_BLOCK_IN = 3;
1590
+ const CONTEXT_BLOCK_OUT = 4;
1591
+ const CHOMPING_CLIP = 1;
1592
+ const CHOMPING_STRIP = 2;
1593
+ const CHOMPING_KEEP = 3;
1594
+ const PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
1595
+ const PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
1596
+ const PATTERN_FLOW_INDICATORS = /[,\[\]{}]/;
1597
+ const PATTERN_TAG_HANDLE = /^(?:!|!!|![0-9A-Za-z-]+!)$/;
1598
+ const PATTERN_TAG_URI = /^(?:!|[^,\[\]{}])(?:%[0-9a-f]{2}|[0-9a-z\-#;/?:@&=+$,_.!~*'()\[\]])*$/i;
1599
+ function _class(obj) {
1600
+ return Object.prototype.toString.call(obj);
1601
+ }
1602
+ __name(_class, "_class");
1603
+ function isEol(c) {
1604
+ return c === 10 || c === 13;
1605
+ }
1606
+ __name(isEol, "isEol");
1607
+ function isWhiteSpace(c) {
1608
+ return c === 9 || c === 32;
1609
+ }
1610
+ __name(isWhiteSpace, "isWhiteSpace");
1611
+ function isWsOrEol(c) {
1612
+ return c === 9 || c === 32 || c === 10 || c === 13;
1613
+ }
1614
+ __name(isWsOrEol, "isWsOrEol");
1615
+ function isFlowIndicator(c) {
1616
+ return c === 44 || c === 91 || c === 93 || c === 123 || c === 125;
1617
+ }
1618
+ __name(isFlowIndicator, "isFlowIndicator");
1619
+ function fromHexCode(c) {
1620
+ if (c >= 48 && c <= 57) return c - 48;
1621
+ const lc = c | 32;
1622
+ if (lc >= 97 && lc <= 102) return lc - 97 + 10;
1623
+ return -1;
1624
+ }
1625
+ __name(fromHexCode, "fromHexCode");
1626
+ function escapedHexLen(c) {
1627
+ if (c === 120) return 2;
1628
+ if (c === 117) return 4;
1629
+ if (c === 85) return 8;
1630
+ return 0;
1631
+ }
1632
+ __name(escapedHexLen, "escapedHexLen");
1633
+ function fromDecimalCode(c) {
1634
+ if (c >= 48 && c <= 57) return c - 48;
1635
+ return -1;
1636
+ }
1637
+ __name(fromDecimalCode, "fromDecimalCode");
1638
+ function simpleEscapeSequence(c) {
1639
+ switch (c) {
1640
+ case 48: return "\0";
1641
+ case 97: return "\x07";
1642
+ case 98: return "\b";
1643
+ case 116: return " ";
1644
+ case 9: return " ";
1645
+ case 110: return "\n";
1646
+ case 118: return "\v";
1647
+ case 102: return "\f";
1648
+ case 114: return "\r";
1649
+ case 101: return "\x1B";
1650
+ case 32: return " ";
1651
+ case 34: return "\"";
1652
+ case 47: return "/";
1653
+ case 92: return "\\";
1654
+ case 78: return "…";
1655
+ case 95: return "\xA0";
1656
+ case 76: return "\u2028";
1657
+ case 80: return "\u2029";
1658
+ default: return "";
1659
+ }
1660
+ }
1661
+ __name(simpleEscapeSequence, "simpleEscapeSequence");
1662
+ function charFromCodepoint(c) {
1663
+ if (c <= 65535) return String.fromCharCode(c);
1664
+ return String.fromCharCode((c - 65536 >> 10) + 55296, (c - 65536 & 1023) + 56320);
1665
+ }
1666
+ __name(charFromCodepoint, "charFromCodepoint");
1667
+ function setProperty(object, key, value) {
1668
+ if (key === "__proto__") Object.defineProperty(object, key, {
1669
+ configurable: true,
1670
+ enumerable: true,
1671
+ writable: true,
1672
+ value
1673
+ });
1674
+ else object[key] = value;
1675
+ }
1676
+ __name(setProperty, "setProperty");
1677
+ const simpleEscapeCheck = new Array(256);
1678
+ const simpleEscapeMap = new Array(256);
1679
+ for (let i = 0; i < 256; i++) {
1680
+ simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
1681
+ simpleEscapeMap[i] = simpleEscapeSequence(i);
1682
+ }
1683
+ function State(input, options) {
1684
+ this.input = input;
1685
+ this.filename = options["filename"] || null;
1686
+ this.schema = options["schema"] || DEFAULT_SCHEMA2;
1687
+ this.onWarning = options["onWarning"] || null;
1688
+ this.legacy = options["legacy"] || false;
1689
+ this.json = options["json"] || false;
1690
+ this.listener = options["listener"] || null;
1691
+ this.maxDepth = typeof options["maxDepth"] === "number" ? options["maxDepth"] : 100;
1692
+ this.maxTotalMergeKeys = typeof options["maxTotalMergeKeys"] === "number" ? options["maxTotalMergeKeys"] : 1e4;
1693
+ this.implicitTypes = this.schema.compiledImplicit;
1694
+ this.typeMap = this.schema.compiledTypeMap;
1695
+ this.length = input.length;
1696
+ this.position = 0;
1697
+ this.line = 0;
1698
+ this.lineStart = 0;
1699
+ this.lineIndent = 0;
1700
+ this.depth = 0;
1701
+ this.totalMergeKeys = 0;
1702
+ this.firstTabInLine = -1;
1703
+ this.documents = [];
1704
+ this.anchorMapTransactions = [];
1705
+ }
1706
+ __name(State, "State");
1707
+ function generateError(state, message) {
1708
+ const mark = {
1709
+ name: state.filename,
1710
+ buffer: state.input.slice(0, -1),
1711
+ position: state.position,
1712
+ line: state.line,
1713
+ column: state.position - state.lineStart
1714
+ };
1715
+ mark.snippet = makeSnippet(mark);
1716
+ return new YAMLException2(message, mark);
1717
+ }
1718
+ __name(generateError, "generateError");
1719
+ function throwError(state, message) {
1720
+ throw generateError(state, message);
1721
+ }
1722
+ __name(throwError, "throwError");
1723
+ function throwWarning(state, message) {
1724
+ if (state.onWarning) state.onWarning.call(null, generateError(state, message));
1725
+ }
1726
+ __name(throwWarning, "throwWarning");
1727
+ function storeAnchor(state, name, value) {
1728
+ const transactions = state.anchorMapTransactions;
1729
+ if (transactions.length !== 0) {
1730
+ const transaction = transactions[transactions.length - 1];
1731
+ if (!_hasOwnProperty.call(transaction, name)) transaction[name] = {
1732
+ existed: _hasOwnProperty.call(state.anchorMap, name),
1733
+ value: state.anchorMap[name]
1734
+ };
1735
+ }
1736
+ state.anchorMap[name] = value;
1737
+ }
1738
+ __name(storeAnchor, "storeAnchor");
1739
+ function beginAnchorTransaction(state) {
1740
+ state.anchorMapTransactions.push(/* @__PURE__ */ Object.create(null));
1741
+ }
1742
+ __name(beginAnchorTransaction, "beginAnchorTransaction");
1743
+ function commitAnchorTransaction(state) {
1744
+ const transaction = state.anchorMapTransactions.pop();
1745
+ const transactions = state.anchorMapTransactions;
1746
+ if (transactions.length === 0) return;
1747
+ const parent = transactions[transactions.length - 1];
1748
+ const names = Object.keys(transaction);
1749
+ for (let index = 0, length = names.length; index < length; index += 1) {
1750
+ const name = names[index];
1751
+ if (!_hasOwnProperty.call(parent, name)) parent[name] = transaction[name];
1752
+ }
1753
+ }
1754
+ __name(commitAnchorTransaction, "commitAnchorTransaction");
1755
+ function rollbackAnchorTransaction(state) {
1756
+ const transaction = state.anchorMapTransactions.pop();
1757
+ const names = Object.keys(transaction);
1758
+ for (let index = names.length - 1; index >= 0; index -= 1) {
1759
+ const entry = transaction[names[index]];
1760
+ if (entry.existed) state.anchorMap[names[index]] = entry.value;
1761
+ else delete state.anchorMap[names[index]];
1762
+ }
1763
+ }
1764
+ __name(rollbackAnchorTransaction, "rollbackAnchorTransaction");
1765
+ function snapshotState(state) {
1766
+ return {
1767
+ position: state.position,
1768
+ line: state.line,
1769
+ lineStart: state.lineStart,
1770
+ lineIndent: state.lineIndent,
1771
+ firstTabInLine: state.firstTabInLine,
1772
+ tag: state.tag,
1773
+ anchor: state.anchor,
1774
+ kind: state.kind,
1775
+ result: state.result
1776
+ };
1777
+ }
1778
+ __name(snapshotState, "snapshotState");
1779
+ function restoreState(state, snapshot) {
1780
+ state.position = snapshot.position;
1781
+ state.line = snapshot.line;
1782
+ state.lineStart = snapshot.lineStart;
1783
+ state.lineIndent = snapshot.lineIndent;
1784
+ state.firstTabInLine = snapshot.firstTabInLine;
1785
+ state.tag = snapshot.tag;
1786
+ state.anchor = snapshot.anchor;
1787
+ state.kind = snapshot.kind;
1788
+ state.result = snapshot.result;
1789
+ }
1790
+ __name(restoreState, "restoreState");
1791
+ const directiveHandlers = {
1792
+ YAML: /* @__PURE__ */ __name(function handleYamlDirective(state, name, args) {
1793
+ if (state.version !== null) throwError(state, "duplication of %YAML directive");
1794
+ if (args.length !== 1) throwError(state, "YAML directive accepts exactly one argument");
1795
+ const match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
1796
+ if (match === null) throwError(state, "ill-formed argument of the YAML directive");
1797
+ const major = parseInt(match[1], 10);
1798
+ const minor = parseInt(match[2], 10);
1799
+ if (major !== 1) throwError(state, "unacceptable YAML version of the document");
1800
+ state.version = args[0];
1801
+ state.checkLineBreaks = minor < 2;
1802
+ if (minor !== 1 && minor !== 2) throwWarning(state, "unsupported YAML version of the document");
1803
+ }, "handleYamlDirective"),
1804
+ TAG: /* @__PURE__ */ __name(function handleTagDirective(state, name, args) {
1805
+ let prefix;
1806
+ if (args.length !== 2) throwError(state, "TAG directive accepts exactly two arguments");
1807
+ const handle = args[0];
1808
+ prefix = args[1];
1809
+ if (!PATTERN_TAG_HANDLE.test(handle)) throwError(state, "ill-formed tag handle (first argument) of the TAG directive");
1810
+ if (_hasOwnProperty.call(state.tagMap, handle)) throwError(state, "there is a previously declared suffix for \"" + handle + "\" tag handle");
1811
+ if (!PATTERN_TAG_URI.test(prefix)) throwError(state, "ill-formed tag prefix (second argument) of the TAG directive");
1812
+ try {
1813
+ prefix = decodeURIComponent(prefix);
1814
+ } catch (err) {
1815
+ throwError(state, "tag prefix is malformed: " + prefix);
1816
+ }
1817
+ state.tagMap[handle] = prefix;
1818
+ }, "handleTagDirective")
1819
+ };
1820
+ function captureSegment(state, start, end, checkJson) {
1821
+ if (start < end) {
1822
+ const _result = state.input.slice(start, end);
1823
+ if (checkJson) for (let _position = 0, _length = _result.length; _position < _length; _position += 1) {
1824
+ const _character = _result.charCodeAt(_position);
1825
+ if (!(_character === 9 || _character >= 32 && _character <= 1114111)) throwError(state, "expected valid JSON character");
1826
+ }
1827
+ else if (PATTERN_NON_PRINTABLE.test(_result)) throwError(state, "the stream contains non-printable characters");
1828
+ state.result += _result;
1829
+ }
1830
+ }
1831
+ __name(captureSegment, "captureSegment");
1832
+ function mergeMappings(state, destination, source, overridableKeys) {
1833
+ if (!common2.isObject(source)) throwError(state, "cannot merge mappings; the provided source object is unacceptable");
1834
+ const sourceKeys = Object.keys(source);
1835
+ for (let index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
1836
+ const key = sourceKeys[index];
1837
+ if (state.maxTotalMergeKeys !== -1 && ++state.totalMergeKeys > state.maxTotalMergeKeys) throwError(state, "merge keys exceeded maxTotalMergeKeys (" + state.maxTotalMergeKeys + ")");
1838
+ if (!_hasOwnProperty.call(destination, key)) {
1839
+ setProperty(destination, key, source[key]);
1840
+ overridableKeys[key] = true;
1841
+ }
1842
+ }
1843
+ }
1844
+ __name(mergeMappings, "mergeMappings");
1845
+ function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startLineStart, startPos) {
1846
+ if (Array.isArray(keyNode)) {
1847
+ keyNode = Array.prototype.slice.call(keyNode);
1848
+ for (let index = 0, quantity = keyNode.length; index < quantity; index += 1) {
1849
+ if (Array.isArray(keyNode[index])) throwError(state, "nested arrays are not supported inside keys");
1850
+ if (typeof keyNode === "object" && _class(keyNode[index]) === "[object Object]") keyNode[index] = "[object Object]";
1851
+ }
1852
+ }
1853
+ if (typeof keyNode === "object" && _class(keyNode) === "[object Object]") keyNode = "[object Object]";
1854
+ keyNode = String(keyNode);
1855
+ if (_result === null) _result = {};
1856
+ if (keyTag === "tag:yaml.org,2002:merge") if (Array.isArray(valueNode)) for (let index = 0, quantity = valueNode.length; index < quantity; index += 1) mergeMappings(state, _result, valueNode[index], overridableKeys);
1857
+ else mergeMappings(state, _result, valueNode, overridableKeys);
1858
+ else {
1859
+ if (!state.json && !_hasOwnProperty.call(overridableKeys, keyNode) && _hasOwnProperty.call(_result, keyNode)) {
1860
+ state.line = startLine || state.line;
1861
+ state.lineStart = startLineStart || state.lineStart;
1862
+ state.position = startPos || state.position;
1863
+ throwError(state, "duplicated mapping key");
1864
+ }
1865
+ setProperty(_result, keyNode, valueNode);
1866
+ delete overridableKeys[keyNode];
1867
+ }
1868
+ return _result;
1869
+ }
1870
+ __name(storeMappingPair, "storeMappingPair");
1871
+ function readLineBreak(state) {
1872
+ const ch = state.input.charCodeAt(state.position);
1873
+ if (ch === 10) state.position++;
1874
+ else if (ch === 13) {
1875
+ state.position++;
1876
+ if (state.input.charCodeAt(state.position) === 10) state.position++;
1877
+ } else throwError(state, "a line break is expected");
1878
+ state.line += 1;
1879
+ state.lineStart = state.position;
1880
+ state.firstTabInLine = -1;
1881
+ }
1882
+ __name(readLineBreak, "readLineBreak");
1883
+ function skipSeparationSpace(state, allowComments, checkIndent) {
1884
+ let lineBreaks = 0;
1885
+ let ch = state.input.charCodeAt(state.position);
1886
+ while (ch !== 0) {
1887
+ while (isWhiteSpace(ch)) {
1888
+ if (ch === 9 && state.firstTabInLine === -1) state.firstTabInLine = state.position;
1889
+ ch = state.input.charCodeAt(++state.position);
1890
+ }
1891
+ if (allowComments && ch === 35) do
1892
+ ch = state.input.charCodeAt(++state.position);
1893
+ while (ch !== 10 && ch !== 13 && ch !== 0);
1894
+ if (isEol(ch)) {
1895
+ readLineBreak(state);
1896
+ ch = state.input.charCodeAt(state.position);
1897
+ lineBreaks++;
1898
+ state.lineIndent = 0;
1899
+ while (ch === 32) {
1900
+ state.lineIndent++;
1901
+ ch = state.input.charCodeAt(++state.position);
1902
+ }
1903
+ } else break;
1904
+ }
1905
+ if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) throwWarning(state, "deficient indentation");
1906
+ return lineBreaks;
1907
+ }
1908
+ __name(skipSeparationSpace, "skipSeparationSpace");
1909
+ function testDocumentSeparator(state) {
1910
+ let _position = state.position;
1911
+ let ch = state.input.charCodeAt(_position);
1912
+ if ((ch === 45 || ch === 46) && ch === state.input.charCodeAt(_position + 1) && ch === state.input.charCodeAt(_position + 2)) {
1913
+ _position += 3;
1914
+ ch = state.input.charCodeAt(_position);
1915
+ if (ch === 0 || isWsOrEol(ch)) return true;
1916
+ }
1917
+ return false;
1918
+ }
1919
+ __name(testDocumentSeparator, "testDocumentSeparator");
1920
+ function writeFoldedLines(state, count) {
1921
+ if (count === 1) state.result += " ";
1922
+ else if (count > 1) state.result += common2.repeat("\n", count - 1);
1923
+ }
1924
+ __name(writeFoldedLines, "writeFoldedLines");
1925
+ function readPlainScalar(state, nodeIndent, withinFlowCollection) {
1926
+ let captureStart;
1927
+ let captureEnd;
1928
+ let hasPendingContent;
1929
+ let _line;
1930
+ let _lineStart;
1931
+ let _lineIndent;
1932
+ const _kind = state.kind;
1933
+ const _result = state.result;
1934
+ let ch = state.input.charCodeAt(state.position);
1935
+ if (isWsOrEol(ch) || isFlowIndicator(ch) || ch === 35 || ch === 38 || ch === 42 || ch === 33 || ch === 124 || ch === 62 || ch === 39 || ch === 34 || ch === 37 || ch === 64 || ch === 96) return false;
1936
+ if (ch === 63 || ch === 45) {
1937
+ const following = state.input.charCodeAt(state.position + 1);
1938
+ if (isWsOrEol(following) || withinFlowCollection && isFlowIndicator(following)) return false;
1939
+ }
1940
+ state.kind = "scalar";
1941
+ state.result = "";
1942
+ captureStart = captureEnd = state.position;
1943
+ hasPendingContent = false;
1944
+ while (ch !== 0) {
1945
+ if (ch === 58) {
1946
+ const following = state.input.charCodeAt(state.position + 1);
1947
+ if (isWsOrEol(following) || withinFlowCollection && isFlowIndicator(following)) break;
1948
+ } else if (ch === 35) {
1949
+ if (isWsOrEol(state.input.charCodeAt(state.position - 1))) break;
1950
+ } else if (state.position === state.lineStart && testDocumentSeparator(state) || withinFlowCollection && isFlowIndicator(ch)) break;
1951
+ else if (isEol(ch)) {
1952
+ _line = state.line;
1953
+ _lineStart = state.lineStart;
1954
+ _lineIndent = state.lineIndent;
1955
+ skipSeparationSpace(state, false, -1);
1956
+ if (state.lineIndent >= nodeIndent) {
1957
+ hasPendingContent = true;
1958
+ ch = state.input.charCodeAt(state.position);
1959
+ continue;
1960
+ } else {
1961
+ state.position = captureEnd;
1962
+ state.line = _line;
1963
+ state.lineStart = _lineStart;
1964
+ state.lineIndent = _lineIndent;
1965
+ break;
1966
+ }
1967
+ }
1968
+ if (hasPendingContent) {
1969
+ captureSegment(state, captureStart, captureEnd, false);
1970
+ writeFoldedLines(state, state.line - _line);
1971
+ captureStart = captureEnd = state.position;
1972
+ hasPendingContent = false;
1973
+ }
1974
+ if (!isWhiteSpace(ch)) captureEnd = state.position + 1;
1975
+ ch = state.input.charCodeAt(++state.position);
1976
+ }
1977
+ captureSegment(state, captureStart, captureEnd, false);
1978
+ if (state.result) return true;
1979
+ state.kind = _kind;
1980
+ state.result = _result;
1981
+ return false;
1982
+ }
1983
+ __name(readPlainScalar, "readPlainScalar");
1984
+ function readSingleQuotedScalar(state, nodeIndent) {
1985
+ let captureStart;
1986
+ let captureEnd;
1987
+ let ch = state.input.charCodeAt(state.position);
1988
+ if (ch !== 39) return false;
1989
+ state.kind = "scalar";
1990
+ state.result = "";
1991
+ state.position++;
1992
+ captureStart = captureEnd = state.position;
1993
+ while ((ch = state.input.charCodeAt(state.position)) !== 0) if (ch === 39) {
1994
+ captureSegment(state, captureStart, state.position, true);
1995
+ ch = state.input.charCodeAt(++state.position);
1996
+ if (ch === 39) {
1997
+ captureStart = state.position;
1998
+ state.position++;
1999
+ captureEnd = state.position;
2000
+ } else return true;
2001
+ } else if (isEol(ch)) {
2002
+ captureSegment(state, captureStart, captureEnd, true);
2003
+ writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
2004
+ captureStart = captureEnd = state.position;
2005
+ } else if (state.position === state.lineStart && testDocumentSeparator(state)) throwError(state, "unexpected end of the document within a single quoted scalar");
2006
+ else {
2007
+ state.position++;
2008
+ if (!isWhiteSpace(ch)) captureEnd = state.position;
2009
+ }
2010
+ throwError(state, "unexpected end of the stream within a single quoted scalar");
2011
+ }
2012
+ __name(readSingleQuotedScalar, "readSingleQuotedScalar");
2013
+ function readDoubleQuotedScalar(state, nodeIndent) {
2014
+ let captureStart;
2015
+ let captureEnd;
2016
+ let tmp;
2017
+ let ch = state.input.charCodeAt(state.position);
2018
+ if (ch !== 34) return false;
2019
+ state.kind = "scalar";
2020
+ state.result = "";
2021
+ state.position++;
2022
+ captureStart = captureEnd = state.position;
2023
+ while ((ch = state.input.charCodeAt(state.position)) !== 0) if (ch === 34) {
2024
+ captureSegment(state, captureStart, state.position, true);
2025
+ state.position++;
2026
+ return true;
2027
+ } else if (ch === 92) {
2028
+ captureSegment(state, captureStart, state.position, true);
2029
+ ch = state.input.charCodeAt(++state.position);
2030
+ if (isEol(ch)) skipSeparationSpace(state, false, nodeIndent);
2031
+ else if (ch < 256 && simpleEscapeCheck[ch]) {
2032
+ state.result += simpleEscapeMap[ch];
2033
+ state.position++;
2034
+ } else if ((tmp = escapedHexLen(ch)) > 0) {
2035
+ let hexLength = tmp;
2036
+ let hexResult = 0;
2037
+ for (; hexLength > 0; hexLength--) {
2038
+ ch = state.input.charCodeAt(++state.position);
2039
+ if ((tmp = fromHexCode(ch)) >= 0) hexResult = (hexResult << 4) + tmp;
2040
+ else throwError(state, "expected hexadecimal character");
2041
+ }
2042
+ state.result += charFromCodepoint(hexResult);
2043
+ state.position++;
2044
+ } else throwError(state, "unknown escape sequence");
2045
+ captureStart = captureEnd = state.position;
2046
+ } else if (isEol(ch)) {
2047
+ captureSegment(state, captureStart, captureEnd, true);
2048
+ writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
2049
+ captureStart = captureEnd = state.position;
2050
+ } else if (state.position === state.lineStart && testDocumentSeparator(state)) throwError(state, "unexpected end of the document within a double quoted scalar");
2051
+ else {
2052
+ state.position++;
2053
+ if (!isWhiteSpace(ch)) captureEnd = state.position;
2054
+ }
2055
+ throwError(state, "unexpected end of the stream within a double quoted scalar");
2056
+ }
2057
+ __name(readDoubleQuotedScalar, "readDoubleQuotedScalar");
2058
+ function readFlowCollection(state, nodeIndent) {
2059
+ let readNext = true;
2060
+ let _line;
2061
+ let _lineStart;
2062
+ let _pos;
2063
+ const _tag = state.tag;
2064
+ let _result;
2065
+ const _anchor = state.anchor;
2066
+ let terminator;
2067
+ let isPair;
2068
+ let isExplicitPair;
2069
+ let isMapping;
2070
+ const overridableKeys = /* @__PURE__ */ Object.create(null);
2071
+ let keyNode;
2072
+ let keyTag;
2073
+ let valueNode;
2074
+ let ch = state.input.charCodeAt(state.position);
2075
+ if (ch === 91) {
2076
+ terminator = 93;
2077
+ isMapping = false;
2078
+ _result = [];
2079
+ } else if (ch === 123) {
2080
+ terminator = 125;
2081
+ isMapping = true;
2082
+ _result = {};
2083
+ } else return false;
2084
+ if (state.anchor !== null) storeAnchor(state, state.anchor, _result);
2085
+ ch = state.input.charCodeAt(++state.position);
2086
+ while (ch !== 0) {
2087
+ skipSeparationSpace(state, true, nodeIndent);
2088
+ ch = state.input.charCodeAt(state.position);
2089
+ if (ch === terminator) {
2090
+ state.position++;
2091
+ state.tag = _tag;
2092
+ state.anchor = _anchor;
2093
+ state.kind = isMapping ? "mapping" : "sequence";
2094
+ state.result = _result;
2095
+ return true;
2096
+ } else if (!readNext) throwError(state, "missed comma between flow collection entries");
2097
+ else if (ch === 44) throwError(state, "expected the node content, but found ','");
2098
+ keyTag = keyNode = valueNode = null;
2099
+ isPair = isExplicitPair = false;
2100
+ if (ch === 63) {
2101
+ if (isWsOrEol(state.input.charCodeAt(state.position + 1))) {
2102
+ isPair = isExplicitPair = true;
2103
+ state.position++;
2104
+ skipSeparationSpace(state, true, nodeIndent);
2105
+ }
2106
+ }
2107
+ _line = state.line;
2108
+ _lineStart = state.lineStart;
2109
+ _pos = state.position;
2110
+ composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
2111
+ keyTag = state.tag;
2112
+ keyNode = state.result;
2113
+ skipSeparationSpace(state, true, nodeIndent);
2114
+ ch = state.input.charCodeAt(state.position);
2115
+ if ((isExplicitPair || state.line === _line) && ch === 58) {
2116
+ isPair = true;
2117
+ ch = state.input.charCodeAt(++state.position);
2118
+ skipSeparationSpace(state, true, nodeIndent);
2119
+ composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
2120
+ valueNode = state.result;
2121
+ }
2122
+ if (isMapping) storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos);
2123
+ else if (isPair) _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos));
2124
+ else _result.push(keyNode);
2125
+ skipSeparationSpace(state, true, nodeIndent);
2126
+ ch = state.input.charCodeAt(state.position);
2127
+ if (ch === 44) {
2128
+ readNext = true;
2129
+ ch = state.input.charCodeAt(++state.position);
2130
+ } else readNext = false;
2131
+ }
2132
+ throwError(state, "unexpected end of the stream within a flow collection");
2133
+ }
2134
+ __name(readFlowCollection, "readFlowCollection");
2135
+ function readBlockScalar(state, nodeIndent) {
2136
+ let folding;
2137
+ let chomping = CHOMPING_CLIP;
2138
+ let didReadContent = false;
2139
+ let detectedIndent = false;
2140
+ let textIndent = nodeIndent;
2141
+ let emptyLines = 0;
2142
+ let atMoreIndented = false;
2143
+ let tmp;
2144
+ let ch = state.input.charCodeAt(state.position);
2145
+ if (ch === 124) folding = false;
2146
+ else if (ch === 62) folding = true;
2147
+ else return false;
2148
+ state.kind = "scalar";
2149
+ state.result = "";
2150
+ while (ch !== 0) {
2151
+ ch = state.input.charCodeAt(++state.position);
2152
+ if (ch === 43 || ch === 45) if (CHOMPING_CLIP === chomping) chomping = ch === 43 ? CHOMPING_KEEP : CHOMPING_STRIP;
2153
+ else throwError(state, "repeat of a chomping mode identifier");
2154
+ else if ((tmp = fromDecimalCode(ch)) >= 0) if (tmp === 0) throwError(state, "bad explicit indentation width of a block scalar; it cannot be less than one");
2155
+ else if (!detectedIndent) {
2156
+ textIndent = nodeIndent + tmp - 1;
2157
+ detectedIndent = true;
2158
+ } else throwError(state, "repeat of an indentation width identifier");
2159
+ else break;
2160
+ }
2161
+ if (isWhiteSpace(ch)) {
2162
+ do
2163
+ ch = state.input.charCodeAt(++state.position);
2164
+ while (isWhiteSpace(ch));
2165
+ if (ch === 35) do
2166
+ ch = state.input.charCodeAt(++state.position);
2167
+ while (!isEol(ch) && ch !== 0);
2168
+ }
2169
+ while (ch !== 0) {
2170
+ readLineBreak(state);
2171
+ state.lineIndent = 0;
2172
+ ch = state.input.charCodeAt(state.position);
2173
+ while ((!detectedIndent || state.lineIndent < textIndent) && ch === 32) {
2174
+ state.lineIndent++;
2175
+ ch = state.input.charCodeAt(++state.position);
2176
+ }
2177
+ if (!detectedIndent && state.lineIndent > textIndent) textIndent = state.lineIndent;
2178
+ if (isEol(ch)) {
2179
+ emptyLines++;
2180
+ continue;
2181
+ }
2182
+ if (!detectedIndent && textIndent === 0) throwError(state, "missing indentation for block scalar");
2183
+ if (state.lineIndent < textIndent) {
2184
+ if (chomping === CHOMPING_KEEP) state.result += common2.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
2185
+ else if (chomping === CHOMPING_CLIP) {
2186
+ if (didReadContent) state.result += "\n";
2187
+ }
2188
+ break;
2189
+ }
2190
+ if (folding) if (isWhiteSpace(ch)) {
2191
+ atMoreIndented = true;
2192
+ state.result += common2.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
2193
+ } else if (atMoreIndented) {
2194
+ atMoreIndented = false;
2195
+ state.result += common2.repeat("\n", emptyLines + 1);
2196
+ } else if (emptyLines === 0) {
2197
+ if (didReadContent) state.result += " ";
2198
+ } else state.result += common2.repeat("\n", emptyLines);
2199
+ else state.result += common2.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
2200
+ didReadContent = true;
2201
+ detectedIndent = true;
2202
+ emptyLines = 0;
2203
+ const captureStart = state.position;
2204
+ while (!isEol(ch) && ch !== 0) ch = state.input.charCodeAt(++state.position);
2205
+ captureSegment(state, captureStart, state.position, false);
2206
+ }
2207
+ return true;
2208
+ }
2209
+ __name(readBlockScalar, "readBlockScalar");
2210
+ function readBlockSequence(state, nodeIndent) {
2211
+ const _tag = state.tag;
2212
+ const _anchor = state.anchor;
2213
+ const _result = [];
2214
+ let detected = false;
2215
+ if (state.firstTabInLine !== -1) return false;
2216
+ if (state.anchor !== null) storeAnchor(state, state.anchor, _result);
2217
+ let ch = state.input.charCodeAt(state.position);
2218
+ while (ch !== 0) {
2219
+ if (state.firstTabInLine !== -1) {
2220
+ state.position = state.firstTabInLine;
2221
+ throwError(state, "tab characters must not be used in indentation");
2222
+ }
2223
+ if (ch !== 45) break;
2224
+ if (!isWsOrEol(state.input.charCodeAt(state.position + 1))) break;
2225
+ detected = true;
2226
+ state.position++;
2227
+ if (skipSeparationSpace(state, true, -1)) {
2228
+ if (state.lineIndent <= nodeIndent) {
2229
+ _result.push(null);
2230
+ ch = state.input.charCodeAt(state.position);
2231
+ continue;
2232
+ }
2233
+ }
2234
+ const _line = state.line;
2235
+ composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);
2236
+ _result.push(state.result);
2237
+ skipSeparationSpace(state, true, -1);
2238
+ ch = state.input.charCodeAt(state.position);
2239
+ if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) throwError(state, "bad indentation of a sequence entry");
2240
+ else if (state.lineIndent < nodeIndent) break;
2241
+ }
2242
+ if (detected) {
2243
+ state.tag = _tag;
2244
+ state.anchor = _anchor;
2245
+ state.kind = "sequence";
2246
+ state.result = _result;
2247
+ return true;
2248
+ }
2249
+ return false;
2250
+ }
2251
+ __name(readBlockSequence, "readBlockSequence");
2252
+ function readBlockMapping(state, nodeIndent, flowIndent) {
2253
+ let allowCompact;
2254
+ let _keyLine;
2255
+ let _keyLineStart;
2256
+ let _keyPos;
2257
+ const _tag = state.tag;
2258
+ const _anchor = state.anchor;
2259
+ const _result = {};
2260
+ const overridableKeys = /* @__PURE__ */ Object.create(null);
2261
+ let keyTag = null;
2262
+ let keyNode = null;
2263
+ let valueNode = null;
2264
+ let atExplicitKey = false;
2265
+ let detected = false;
2266
+ if (state.firstTabInLine !== -1) return false;
2267
+ if (state.anchor !== null) storeAnchor(state, state.anchor, _result);
2268
+ let ch = state.input.charCodeAt(state.position);
2269
+ while (ch !== 0) {
2270
+ if (!atExplicitKey && state.firstTabInLine !== -1) {
2271
+ state.position = state.firstTabInLine;
2272
+ throwError(state, "tab characters must not be used in indentation");
2273
+ }
2274
+ const following = state.input.charCodeAt(state.position + 1);
2275
+ const _line = state.line;
2276
+ if ((ch === 63 || ch === 58) && isWsOrEol(following)) {
2277
+ if (ch === 63) {
2278
+ if (atExplicitKey) {
2279
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
2280
+ keyTag = keyNode = valueNode = null;
2281
+ }
2282
+ detected = true;
2283
+ atExplicitKey = true;
2284
+ allowCompact = true;
2285
+ } else if (atExplicitKey) {
2286
+ atExplicitKey = false;
2287
+ allowCompact = true;
2288
+ } else throwError(state, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line");
2289
+ state.position += 1;
2290
+ ch = following;
2291
+ } else {
2292
+ _keyLine = state.line;
2293
+ _keyLineStart = state.lineStart;
2294
+ _keyPos = state.position;
2295
+ if (!composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) break;
2296
+ if (state.line === _line) {
2297
+ ch = state.input.charCodeAt(state.position);
2298
+ while (isWhiteSpace(ch)) ch = state.input.charCodeAt(++state.position);
2299
+ if (ch === 58) {
2300
+ ch = state.input.charCodeAt(++state.position);
2301
+ if (!isWsOrEol(ch)) throwError(state, "a whitespace character is expected after the key-value separator within a block mapping");
2302
+ if (atExplicitKey) {
2303
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
2304
+ keyTag = keyNode = valueNode = null;
2305
+ }
2306
+ detected = true;
2307
+ atExplicitKey = false;
2308
+ allowCompact = false;
2309
+ keyTag = state.tag;
2310
+ keyNode = state.result;
2311
+ } else if (detected) throwError(state, "can not read an implicit mapping pair; a colon is missed");
2312
+ else {
2313
+ state.tag = _tag;
2314
+ state.anchor = _anchor;
2315
+ return true;
2316
+ }
2317
+ } else if (detected) throwError(state, "can not read a block mapping entry; a multiline key may not be an implicit key");
2318
+ else {
2319
+ state.tag = _tag;
2320
+ state.anchor = _anchor;
2321
+ return true;
2322
+ }
2323
+ }
2324
+ if (state.line === _line || state.lineIndent > nodeIndent) {
2325
+ if (atExplicitKey) {
2326
+ _keyLine = state.line;
2327
+ _keyLineStart = state.lineStart;
2328
+ _keyPos = state.position;
2329
+ }
2330
+ if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) if (atExplicitKey) keyNode = state.result;
2331
+ else valueNode = state.result;
2332
+ if (!atExplicitKey) {
2333
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos);
2334
+ keyTag = keyNode = valueNode = null;
2335
+ }
2336
+ skipSeparationSpace(state, true, -1);
2337
+ ch = state.input.charCodeAt(state.position);
2338
+ }
2339
+ if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) throwError(state, "bad indentation of a mapping entry");
2340
+ else if (state.lineIndent < nodeIndent) break;
2341
+ }
2342
+ if (atExplicitKey) storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
2343
+ if (detected) {
2344
+ state.tag = _tag;
2345
+ state.anchor = _anchor;
2346
+ state.kind = "mapping";
2347
+ state.result = _result;
2348
+ }
2349
+ return detected;
2350
+ }
2351
+ __name(readBlockMapping, "readBlockMapping");
2352
+ function readTagProperty(state) {
2353
+ let isVerbatim = false;
2354
+ let isNamed = false;
2355
+ let tagHandle;
2356
+ let tagName;
2357
+ let ch = state.input.charCodeAt(state.position);
2358
+ if (ch !== 33) return false;
2359
+ if (state.tag !== null) throwError(state, "duplication of a tag property");
2360
+ ch = state.input.charCodeAt(++state.position);
2361
+ if (ch === 60) {
2362
+ isVerbatim = true;
2363
+ ch = state.input.charCodeAt(++state.position);
2364
+ } else if (ch === 33) {
2365
+ isNamed = true;
2366
+ tagHandle = "!!";
2367
+ ch = state.input.charCodeAt(++state.position);
2368
+ } else tagHandle = "!";
2369
+ let _position = state.position;
2370
+ if (isVerbatim) {
2371
+ do
2372
+ ch = state.input.charCodeAt(++state.position);
2373
+ while (ch !== 0 && ch !== 62);
2374
+ if (state.position < state.length) {
2375
+ tagName = state.input.slice(_position, state.position);
2376
+ ch = state.input.charCodeAt(++state.position);
2377
+ } else throwError(state, "unexpected end of the stream within a verbatim tag");
2378
+ } else {
2379
+ while (ch !== 0 && !isWsOrEol(ch)) {
2380
+ if (ch === 33) if (!isNamed) {
2381
+ tagHandle = state.input.slice(_position - 1, state.position + 1);
2382
+ if (!PATTERN_TAG_HANDLE.test(tagHandle)) throwError(state, "named tag handle cannot contain such characters");
2383
+ isNamed = true;
2384
+ _position = state.position + 1;
2385
+ } else throwError(state, "tag suffix cannot contain exclamation marks");
2386
+ ch = state.input.charCodeAt(++state.position);
2387
+ }
2388
+ tagName = state.input.slice(_position, state.position);
2389
+ if (PATTERN_FLOW_INDICATORS.test(tagName)) throwError(state, "tag suffix cannot contain flow indicator characters");
2390
+ }
2391
+ if (tagName && !PATTERN_TAG_URI.test(tagName)) throwError(state, "tag name cannot contain such characters: " + tagName);
2392
+ try {
2393
+ tagName = decodeURIComponent(tagName);
2394
+ } catch (err) {
2395
+ throwError(state, "tag name is malformed: " + tagName);
2396
+ }
2397
+ if (isVerbatim) state.tag = tagName;
2398
+ else if (_hasOwnProperty.call(state.tagMap, tagHandle)) state.tag = state.tagMap[tagHandle] + tagName;
2399
+ else if (tagHandle === "!") state.tag = "!" + tagName;
2400
+ else if (tagHandle === "!!") state.tag = "tag:yaml.org,2002:" + tagName;
2401
+ else throwError(state, "undeclared tag handle \"" + tagHandle + "\"");
2402
+ return true;
2403
+ }
2404
+ __name(readTagProperty, "readTagProperty");
2405
+ function readAnchorProperty(state) {
2406
+ let ch = state.input.charCodeAt(state.position);
2407
+ if (ch !== 38) return false;
2408
+ if (state.anchor !== null) throwError(state, "duplication of an anchor property");
2409
+ ch = state.input.charCodeAt(++state.position);
2410
+ const _position = state.position;
2411
+ while (ch !== 0 && !isWsOrEol(ch) && !isFlowIndicator(ch)) ch = state.input.charCodeAt(++state.position);
2412
+ if (state.position === _position) throwError(state, "name of an anchor node must contain at least one character");
2413
+ state.anchor = state.input.slice(_position, state.position);
2414
+ return true;
2415
+ }
2416
+ __name(readAnchorProperty, "readAnchorProperty");
2417
+ function readAlias(state) {
2418
+ let ch = state.input.charCodeAt(state.position);
2419
+ if (ch !== 42) return false;
2420
+ ch = state.input.charCodeAt(++state.position);
2421
+ const _position = state.position;
2422
+ while (ch !== 0 && !isWsOrEol(ch) && !isFlowIndicator(ch)) ch = state.input.charCodeAt(++state.position);
2423
+ if (state.position === _position) throwError(state, "name of an alias node must contain at least one character");
2424
+ const alias = state.input.slice(_position, state.position);
2425
+ if (!_hasOwnProperty.call(state.anchorMap, alias)) throwError(state, "unidentified alias \"" + alias + "\"");
2426
+ state.result = state.anchorMap[alias];
2427
+ skipSeparationSpace(state, true, -1);
2428
+ return true;
2429
+ }
2430
+ __name(readAlias, "readAlias");
2431
+ function tryReadBlockMappingFromProperty(state, propertyStart, nodeIndent, flowIndent) {
2432
+ const fallbackState = snapshotState(state);
2433
+ beginAnchorTransaction(state);
2434
+ restoreState(state, propertyStart);
2435
+ state.tag = null;
2436
+ state.anchor = null;
2437
+ state.kind = null;
2438
+ state.result = null;
2439
+ if (readBlockMapping(state, nodeIndent, flowIndent) && state.kind === "mapping") {
2440
+ commitAnchorTransaction(state);
2441
+ return true;
2442
+ }
2443
+ rollbackAnchorTransaction(state);
2444
+ restoreState(state, fallbackState);
2445
+ return false;
2446
+ }
2447
+ __name(tryReadBlockMappingFromProperty, "tryReadBlockMappingFromProperty");
2448
+ function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) {
2449
+ let allowBlockScalars;
2450
+ let allowBlockCollections;
2451
+ let indentStatus = 1;
2452
+ let atNewLine = false;
2453
+ let hasContent = false;
2454
+ let propertyStart = null;
2455
+ let type2;
2456
+ let flowIndent;
2457
+ let blockIndent;
2458
+ if (state.depth >= state.maxDepth) throwError(state, "nesting exceeded maxDepth (" + state.maxDepth + ")");
2459
+ state.depth += 1;
2460
+ if (state.listener !== null) state.listener("open", state);
2461
+ state.tag = null;
2462
+ state.anchor = null;
2463
+ state.kind = null;
2464
+ state.result = null;
2465
+ const allowBlockStyles = allowBlockScalars = allowBlockCollections = CONTEXT_BLOCK_OUT === nodeContext || CONTEXT_BLOCK_IN === nodeContext;
2466
+ if (allowToSeek) {
2467
+ if (skipSeparationSpace(state, true, -1)) {
2468
+ atNewLine = true;
2469
+ if (state.lineIndent > parentIndent) indentStatus = 1;
2470
+ else if (state.lineIndent === parentIndent) indentStatus = 0;
2471
+ else if (state.lineIndent < parentIndent) indentStatus = -1;
2472
+ }
2473
+ }
2474
+ if (indentStatus === 1) while (true) {
2475
+ const ch = state.input.charCodeAt(state.position);
2476
+ const propertyState = snapshotState(state);
2477
+ if (atNewLine && (ch === 33 && state.tag !== null || ch === 38 && state.anchor !== null)) break;
2478
+ if (!readTagProperty(state) && !readAnchorProperty(state)) break;
2479
+ if (propertyStart === null) propertyStart = propertyState;
2480
+ if (skipSeparationSpace(state, true, -1)) {
2481
+ atNewLine = true;
2482
+ allowBlockCollections = allowBlockStyles;
2483
+ if (state.lineIndent > parentIndent) indentStatus = 1;
2484
+ else if (state.lineIndent === parentIndent) indentStatus = 0;
2485
+ else if (state.lineIndent < parentIndent) indentStatus = -1;
2486
+ } else allowBlockCollections = false;
2487
+ }
2488
+ if (allowBlockCollections) allowBlockCollections = atNewLine || allowCompact;
2489
+ if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) {
2490
+ if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) flowIndent = parentIndent;
2491
+ else flowIndent = parentIndent + 1;
2492
+ blockIndent = state.position - state.lineStart;
2493
+ if (indentStatus === 1) if (allowBlockCollections && (readBlockSequence(state, blockIndent) || readBlockMapping(state, blockIndent, flowIndent)) || readFlowCollection(state, flowIndent)) hasContent = true;
2494
+ else {
2495
+ const ch = state.input.charCodeAt(state.position);
2496
+ if (propertyStart !== null && allowBlockStyles && !allowBlockCollections && ch !== 124 && ch !== 62 && tryReadBlockMappingFromProperty(state, propertyStart, propertyStart.position - propertyStart.lineStart, flowIndent)) hasContent = true;
2497
+ else if (allowBlockScalars && readBlockScalar(state, flowIndent) || readSingleQuotedScalar(state, flowIndent) || readDoubleQuotedScalar(state, flowIndent)) hasContent = true;
2498
+ else if (readAlias(state)) {
2499
+ hasContent = true;
2500
+ if (state.tag !== null || state.anchor !== null) throwError(state, "alias node should not have any properties");
2501
+ } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
2502
+ hasContent = true;
2503
+ if (state.tag === null) state.tag = "?";
2504
+ }
2505
+ if (state.anchor !== null) storeAnchor(state, state.anchor, state.result);
2506
+ }
2507
+ else if (indentStatus === 0) hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);
2508
+ }
2509
+ if (state.tag === null) {
2510
+ if (state.anchor !== null) storeAnchor(state, state.anchor, state.result);
2511
+ } else if (state.tag === "?") {
2512
+ if (state.result !== null && state.kind !== "scalar") throwError(state, "unacceptable node kind for !<?> tag; it should be \"scalar\", not \"" + state.kind + "\"");
2513
+ for (let typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {
2514
+ type2 = state.implicitTypes[typeIndex];
2515
+ if (type2.resolve(state.result)) {
2516
+ state.result = type2.construct(state.result);
2517
+ state.tag = type2.tag;
2518
+ if (state.anchor !== null) storeAnchor(state, state.anchor, state.result);
2519
+ break;
2520
+ }
2521
+ }
2522
+ } else if (state.tag !== "!") {
2523
+ if (_hasOwnProperty.call(state.typeMap[state.kind || "fallback"], state.tag)) type2 = state.typeMap[state.kind || "fallback"][state.tag];
2524
+ else {
2525
+ type2 = null;
2526
+ const typeList = state.typeMap.multi[state.kind || "fallback"];
2527
+ for (let typeIndex = 0, typeQuantity = typeList.length; typeIndex < typeQuantity; typeIndex += 1) if (state.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) {
2528
+ type2 = typeList[typeIndex];
2529
+ break;
2530
+ }
2531
+ }
2532
+ if (!type2) throwError(state, "unknown tag !<" + state.tag + ">");
2533
+ if (state.result !== null && type2.kind !== state.kind) throwError(state, "unacceptable node kind for !<" + state.tag + "> tag; it should be \"" + type2.kind + "\", not \"" + state.kind + "\"");
2534
+ if (!type2.resolve(state.result, state.tag)) throwError(state, "cannot resolve a node with !<" + state.tag + "> explicit tag");
2535
+ else {
2536
+ state.result = type2.construct(state.result, state.tag);
2537
+ if (state.anchor !== null) storeAnchor(state, state.anchor, state.result);
2538
+ }
2539
+ }
2540
+ if (state.listener !== null) state.listener("close", state);
2541
+ state.depth -= 1;
2542
+ return state.tag !== null || state.anchor !== null || hasContent;
2543
+ }
2544
+ __name(composeNode, "composeNode");
2545
+ function readDocument(state) {
2546
+ const documentStart = state.position;
2547
+ let hasDirectives = false;
2548
+ let ch;
2549
+ state.version = null;
2550
+ state.checkLineBreaks = state.legacy;
2551
+ state.tagMap = /* @__PURE__ */ Object.create(null);
2552
+ state.anchorMap = /* @__PURE__ */ Object.create(null);
2553
+ while ((ch = state.input.charCodeAt(state.position)) !== 0) {
2554
+ skipSeparationSpace(state, true, -1);
2555
+ ch = state.input.charCodeAt(state.position);
2556
+ if (state.lineIndent > 0 || ch !== 37) break;
2557
+ hasDirectives = true;
2558
+ ch = state.input.charCodeAt(++state.position);
2559
+ let _position = state.position;
2560
+ while (ch !== 0 && !isWsOrEol(ch)) ch = state.input.charCodeAt(++state.position);
2561
+ const directiveName = state.input.slice(_position, state.position);
2562
+ const directiveArgs = [];
2563
+ if (directiveName.length < 1) throwError(state, "directive name must not be less than one character in length");
2564
+ while (ch !== 0) {
2565
+ while (isWhiteSpace(ch)) ch = state.input.charCodeAt(++state.position);
2566
+ if (ch === 35) {
2567
+ do
2568
+ ch = state.input.charCodeAt(++state.position);
2569
+ while (ch !== 0 && !isEol(ch));
2570
+ break;
2571
+ }
2572
+ if (isEol(ch)) break;
2573
+ _position = state.position;
2574
+ while (ch !== 0 && !isWsOrEol(ch)) ch = state.input.charCodeAt(++state.position);
2575
+ directiveArgs.push(state.input.slice(_position, state.position));
2576
+ }
2577
+ if (ch !== 0) readLineBreak(state);
2578
+ if (_hasOwnProperty.call(directiveHandlers, directiveName)) directiveHandlers[directiveName](state, directiveName, directiveArgs);
2579
+ else throwWarning(state, "unknown document directive \"" + directiveName + "\"");
2580
+ }
2581
+ skipSeparationSpace(state, true, -1);
2582
+ if (state.lineIndent === 0 && state.input.charCodeAt(state.position) === 45 && state.input.charCodeAt(state.position + 1) === 45 && state.input.charCodeAt(state.position + 2) === 45) {
2583
+ state.position += 3;
2584
+ skipSeparationSpace(state, true, -1);
2585
+ } else if (hasDirectives) throwError(state, "directives end mark is expected");
2586
+ composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
2587
+ skipSeparationSpace(state, true, -1);
2588
+ if (state.checkLineBreaks && PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) throwWarning(state, "non-ASCII line breaks are interpreted as content");
2589
+ state.documents.push(state.result);
2590
+ if (state.position === state.lineStart && testDocumentSeparator(state)) {
2591
+ if (state.input.charCodeAt(state.position) === 46) {
2592
+ state.position += 3;
2593
+ skipSeparationSpace(state, true, -1);
2594
+ }
2595
+ return;
2596
+ }
2597
+ if (state.position < state.length - 1) throwError(state, "end of the stream or a document separator is expected");
2598
+ }
2599
+ __name(readDocument, "readDocument");
2600
+ function loadDocuments(input, options) {
2601
+ input = String(input);
2602
+ options = options || {};
2603
+ if (input.length !== 0) {
2604
+ if (input.charCodeAt(input.length - 1) !== 10 && input.charCodeAt(input.length - 1) !== 13) input += "\n";
2605
+ if (input.charCodeAt(0) === 65279) input = input.slice(1);
2606
+ }
2607
+ const state = new State(input, options);
2608
+ const nullpos = input.indexOf("\0");
2609
+ if (nullpos !== -1) {
2610
+ state.position = nullpos;
2611
+ throwError(state, "null byte is not allowed in input");
2612
+ }
2613
+ state.input += "\0";
2614
+ while (state.input.charCodeAt(state.position) === 32) {
2615
+ state.lineIndent += 1;
2616
+ state.position += 1;
2617
+ }
2618
+ while (state.position < state.length - 1) readDocument(state);
2619
+ return state.documents;
2620
+ }
2621
+ __name(loadDocuments, "loadDocuments");
2622
+ function loadAll2(input, iterator, options) {
2623
+ if (iterator !== null && typeof iterator === "object" && typeof options === "undefined") {
2624
+ options = iterator;
2625
+ iterator = null;
2626
+ }
2627
+ const documents = loadDocuments(input, options);
2628
+ if (typeof iterator !== "function") return documents;
2629
+ for (let index = 0, length = documents.length; index < length; index += 1) iterator(documents[index]);
2630
+ }
2631
+ __name(loadAll2, "loadAll2");
2632
+ function load2(input, options) {
2633
+ const documents = loadDocuments(input, options);
2634
+ if (documents.length === 0) return;
2635
+ else if (documents.length === 1) return documents[0];
2636
+ throw new YAMLException2("expected a single document in the stream, but found more");
2637
+ }
2638
+ __name(load2, "load2");
2639
+ loader.loadAll = loadAll2;
2640
+ loader.load = load2;
2641
+ return loader;
2642
+ }
2643
+ __name(requireLoader, "requireLoader");
2644
+ var dumper = {};
2645
+ var hasRequiredDumper;
2646
+ function requireDumper() {
2647
+ if (hasRequiredDumper) return dumper;
2648
+ hasRequiredDumper = 1;
2649
+ const common2 = requireCommon();
2650
+ const YAMLException2 = requireException();
2651
+ const DEFAULT_SCHEMA2 = require_default();
2652
+ const _toString = Object.prototype.toString;
2653
+ const _hasOwnProperty = Object.prototype.hasOwnProperty;
2654
+ const CHAR_BOM = 65279;
2655
+ const CHAR_TAB = 9;
2656
+ const CHAR_LINE_FEED = 10;
2657
+ const CHAR_CARRIAGE_RETURN = 13;
2658
+ const CHAR_SPACE = 32;
2659
+ const CHAR_EXCLAMATION = 33;
2660
+ const CHAR_DOUBLE_QUOTE = 34;
2661
+ const CHAR_SHARP = 35;
2662
+ const CHAR_PERCENT = 37;
2663
+ const CHAR_AMPERSAND = 38;
2664
+ const CHAR_SINGLE_QUOTE = 39;
2665
+ const CHAR_ASTERISK = 42;
2666
+ const CHAR_COMMA = 44;
2667
+ const CHAR_MINUS = 45;
2668
+ const CHAR_COLON = 58;
2669
+ const CHAR_EQUALS = 61;
2670
+ const CHAR_GREATER_THAN = 62;
2671
+ const CHAR_QUESTION = 63;
2672
+ const CHAR_COMMERCIAL_AT = 64;
2673
+ const CHAR_LEFT_SQUARE_BRACKET = 91;
2674
+ const CHAR_RIGHT_SQUARE_BRACKET = 93;
2675
+ const CHAR_GRAVE_ACCENT = 96;
2676
+ const CHAR_LEFT_CURLY_BRACKET = 123;
2677
+ const CHAR_VERTICAL_LINE = 124;
2678
+ const CHAR_RIGHT_CURLY_BRACKET = 125;
2679
+ const ESCAPE_SEQUENCES = {};
2680
+ ESCAPE_SEQUENCES[0] = "\\0";
2681
+ ESCAPE_SEQUENCES[7] = "\\a";
2682
+ ESCAPE_SEQUENCES[8] = "\\b";
2683
+ ESCAPE_SEQUENCES[9] = "\\t";
2684
+ ESCAPE_SEQUENCES[10] = "\\n";
2685
+ ESCAPE_SEQUENCES[11] = "\\v";
2686
+ ESCAPE_SEQUENCES[12] = "\\f";
2687
+ ESCAPE_SEQUENCES[13] = "\\r";
2688
+ ESCAPE_SEQUENCES[27] = "\\e";
2689
+ ESCAPE_SEQUENCES[34] = "\\\"";
2690
+ ESCAPE_SEQUENCES[92] = "\\\\";
2691
+ ESCAPE_SEQUENCES[133] = "\\N";
2692
+ ESCAPE_SEQUENCES[160] = "\\_";
2693
+ ESCAPE_SEQUENCES[8232] = "\\L";
2694
+ ESCAPE_SEQUENCES[8233] = "\\P";
2695
+ const DEPRECATED_BOOLEANS_SYNTAX = [
2696
+ "y",
2697
+ "Y",
2698
+ "yes",
2699
+ "Yes",
2700
+ "YES",
2701
+ "on",
2702
+ "On",
2703
+ "ON",
2704
+ "n",
2705
+ "N",
2706
+ "no",
2707
+ "No",
2708
+ "NO",
2709
+ "off",
2710
+ "Off",
2711
+ "OFF"
2712
+ ];
2713
+ const DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;
2714
+ function compileStyleMap(schema2, map2) {
2715
+ if (map2 === null) return {};
2716
+ const result = {};
2717
+ const keys = Object.keys(map2);
2718
+ for (let index = 0, length = keys.length; index < length; index += 1) {
2719
+ let tag = keys[index];
2720
+ let style = String(map2[tag]);
2721
+ if (tag.slice(0, 2) === "!!") tag = "tag:yaml.org,2002:" + tag.slice(2);
2722
+ const type2 = schema2.compiledTypeMap["fallback"][tag];
2723
+ if (type2 && _hasOwnProperty.call(type2.styleAliases, style)) style = type2.styleAliases[style];
2724
+ result[tag] = style;
2725
+ }
2726
+ return result;
2727
+ }
2728
+ __name(compileStyleMap, "compileStyleMap");
2729
+ function encodeHex(character) {
2730
+ let handle;
2731
+ let length;
2732
+ const string = character.toString(16).toUpperCase();
2733
+ if (character <= 255) {
2734
+ handle = "x";
2735
+ length = 2;
2736
+ } else if (character <= 65535) {
2737
+ handle = "u";
2738
+ length = 4;
2739
+ } else if (character <= 4294967295) {
2740
+ handle = "U";
2741
+ length = 8;
2742
+ } else throw new YAMLException2("code point within a string may not be greater than 0xFFFFFFFF");
2743
+ return "\\" + handle + common2.repeat("0", length - string.length) + string;
2744
+ }
2745
+ __name(encodeHex, "encodeHex");
2746
+ const QUOTING_TYPE_SINGLE = 1;
2747
+ const QUOTING_TYPE_DOUBLE = 2;
2748
+ function State(options) {
2749
+ this.schema = options["schema"] || DEFAULT_SCHEMA2;
2750
+ this.indent = Math.max(1, options["indent"] || 2);
2751
+ this.noArrayIndent = options["noArrayIndent"] || false;
2752
+ this.skipInvalid = options["skipInvalid"] || false;
2753
+ this.flowLevel = common2.isNothing(options["flowLevel"]) ? -1 : options["flowLevel"];
2754
+ this.styleMap = compileStyleMap(this.schema, options["styles"] || null);
2755
+ this.sortKeys = options["sortKeys"] || false;
2756
+ this.lineWidth = options["lineWidth"] || 80;
2757
+ this.noRefs = options["noRefs"] || false;
2758
+ this.noCompatMode = options["noCompatMode"] || false;
2759
+ this.condenseFlow = options["condenseFlow"] || false;
2760
+ this.quotingType = options["quotingType"] === "\"" ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE;
2761
+ this.forceQuotes = options["forceQuotes"] || false;
2762
+ this.replacer = typeof options["replacer"] === "function" ? options["replacer"] : null;
2763
+ this.implicitTypes = this.schema.compiledImplicit;
2764
+ this.explicitTypes = this.schema.compiledExplicit;
2765
+ this.tag = null;
2766
+ this.result = "";
2767
+ this.duplicates = [];
2768
+ this.usedDuplicates = null;
2769
+ }
2770
+ __name(State, "State");
2771
+ function indentString(string, spaces) {
2772
+ const ind = common2.repeat(" ", spaces);
2773
+ let position = 0;
2774
+ let result = "";
2775
+ const length = string.length;
2776
+ while (position < length) {
2777
+ let line;
2778
+ const next = string.indexOf("\n", position);
2779
+ if (next === -1) {
2780
+ line = string.slice(position);
2781
+ position = length;
2782
+ } else {
2783
+ line = string.slice(position, next + 1);
2784
+ position = next + 1;
2785
+ }
2786
+ if (line.length && line !== "\n") result += ind;
2787
+ result += line;
2788
+ }
2789
+ return result;
2790
+ }
2791
+ __name(indentString, "indentString");
2792
+ function generateNextLine(state, level) {
2793
+ return "\n" + common2.repeat(" ", state.indent * level);
2794
+ }
2795
+ __name(generateNextLine, "generateNextLine");
2796
+ function testImplicitResolving(state, str2) {
2797
+ for (let index = 0, length = state.implicitTypes.length; index < length; index += 1) if (state.implicitTypes[index].resolve(str2)) return true;
2798
+ return false;
2799
+ }
2800
+ __name(testImplicitResolving, "testImplicitResolving");
2801
+ function isWhitespace(c) {
2802
+ return c === CHAR_SPACE || c === CHAR_TAB;
2803
+ }
2804
+ __name(isWhitespace, "isWhitespace");
2805
+ function isPrintable(c) {
2806
+ return c >= 32 && c <= 126 || c >= 161 && c <= 55295 && c !== 8232 && c !== 8233 || c >= 57344 && c <= 65533 && c !== CHAR_BOM || c >= 65536 && c <= 1114111;
2807
+ }
2808
+ __name(isPrintable, "isPrintable");
2809
+ function isNsCharOrWhitespace(c) {
2810
+ return isPrintable(c) && c !== CHAR_BOM && c !== CHAR_CARRIAGE_RETURN && c !== CHAR_LINE_FEED;
2811
+ }
2812
+ __name(isNsCharOrWhitespace, "isNsCharOrWhitespace");
2813
+ function isPlainSafe(c, prev, inblock) {
2814
+ const cIsNsCharOrWhitespace = isNsCharOrWhitespace(c);
2815
+ const cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c);
2816
+ return (inblock ? cIsNsCharOrWhitespace : cIsNsCharOrWhitespace && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET) && c !== CHAR_SHARP && !(prev === CHAR_COLON && !cIsNsChar) || isNsCharOrWhitespace(prev) && !isWhitespace(prev) && c === CHAR_SHARP || prev === CHAR_COLON && cIsNsChar;
2817
+ }
2818
+ __name(isPlainSafe, "isPlainSafe");
2819
+ function isPlainSafeFirst(c) {
2820
+ return isPrintable(c) && c !== CHAR_BOM && !isWhitespace(c) && c !== CHAR_MINUS && c !== CHAR_QUESTION && c !== CHAR_COLON && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET && c !== CHAR_SHARP && c !== CHAR_AMPERSAND && c !== CHAR_ASTERISK && c !== CHAR_EXCLAMATION && c !== CHAR_VERTICAL_LINE && c !== CHAR_EQUALS && c !== CHAR_GREATER_THAN && c !== CHAR_SINGLE_QUOTE && c !== CHAR_DOUBLE_QUOTE && c !== CHAR_PERCENT && c !== CHAR_COMMERCIAL_AT && c !== CHAR_GRAVE_ACCENT;
2821
+ }
2822
+ __name(isPlainSafeFirst, "isPlainSafeFirst");
2823
+ function isPlainSafeLast(c) {
2824
+ return !isWhitespace(c) && c !== CHAR_COLON;
2825
+ }
2826
+ __name(isPlainSafeLast, "isPlainSafeLast");
2827
+ function codePointAt(string, pos) {
2828
+ const first = string.charCodeAt(pos);
2829
+ let second;
2830
+ if (first >= 55296 && first <= 56319 && pos + 1 < string.length) {
2831
+ second = string.charCodeAt(pos + 1);
2832
+ if (second >= 56320 && second <= 57343) return (first - 55296) * 1024 + second - 56320 + 65536;
2833
+ }
2834
+ return first;
2835
+ }
2836
+ __name(codePointAt, "codePointAt");
2837
+ function needIndentIndicator(string) {
2838
+ return /^\n* /.test(string);
2839
+ }
2840
+ __name(needIndentIndicator, "needIndentIndicator");
2841
+ const STYLE_PLAIN = 1;
2842
+ const STYLE_SINGLE = 2;
2843
+ const STYLE_LITERAL = 3;
2844
+ const STYLE_FOLDED = 4;
2845
+ const STYLE_DOUBLE = 5;
2846
+ function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType, quotingType, forceQuotes, inblock) {
2847
+ let i;
2848
+ let char = 0;
2849
+ let prevChar = null;
2850
+ let hasLineBreak = false;
2851
+ let hasFoldableLine = false;
2852
+ const shouldTrackWidth = lineWidth !== -1;
2853
+ let previousLineBreak = -1;
2854
+ let plain = isPlainSafeFirst(codePointAt(string, 0)) && isPlainSafeLast(codePointAt(string, string.length - 1));
2855
+ if (singleLineOnly || forceQuotes) for (i = 0; i < string.length; char >= 65536 ? i += 2 : i++) {
2856
+ char = codePointAt(string, i);
2857
+ if (!isPrintable(char)) return STYLE_DOUBLE;
2858
+ plain = plain && isPlainSafe(char, prevChar, inblock);
2859
+ prevChar = char;
2860
+ }
2861
+ else {
2862
+ for (i = 0; i < string.length; char >= 65536 ? i += 2 : i++) {
2863
+ char = codePointAt(string, i);
2864
+ if (char === CHAR_LINE_FEED) {
2865
+ hasLineBreak = true;
2866
+ if (shouldTrackWidth) {
2867
+ hasFoldableLine = hasFoldableLine || i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ";
2868
+ previousLineBreak = i;
2869
+ }
2870
+ } else if (!isPrintable(char)) return STYLE_DOUBLE;
2871
+ plain = plain && isPlainSafe(char, prevChar, inblock);
2872
+ prevChar = char;
2873
+ }
2874
+ hasFoldableLine = hasFoldableLine || shouldTrackWidth && i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ";
2875
+ }
2876
+ if (!hasLineBreak && !hasFoldableLine) {
2877
+ if (plain && !forceQuotes && !testAmbiguousType(string)) return STYLE_PLAIN;
2878
+ return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
2879
+ }
2880
+ if (indentPerLevel > 9 && needIndentIndicator(string)) return STYLE_DOUBLE;
2881
+ if (!forceQuotes) return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL;
2882
+ return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
2883
+ }
2884
+ __name(chooseScalarStyle, "chooseScalarStyle");
2885
+ function writeScalar(state, string, level, iskey, inblock) {
2886
+ state.dump = (function() {
2887
+ if (string.length === 0) return state.quotingType === QUOTING_TYPE_DOUBLE ? "\"\"" : "''";
2888
+ if (!state.noCompatMode) {
2889
+ if (DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1 || DEPRECATED_BASE60_SYNTAX.test(string)) return state.quotingType === QUOTING_TYPE_DOUBLE ? "\"" + string + "\"" : "'" + string + "'";
2890
+ }
2891
+ const indent = state.indent * Math.max(1, level);
2892
+ const lineWidth = state.lineWidth === -1 ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);
2893
+ const singleLineOnly = iskey || state.flowLevel > -1 && level >= state.flowLevel;
2894
+ function testAmbiguity(string2) {
2895
+ return testImplicitResolving(state, string2);
2896
+ }
2897
+ __name(testAmbiguity, "testAmbiguity");
2898
+ switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, testAmbiguity, state.quotingType, state.forceQuotes && !iskey, inblock)) {
2899
+ case STYLE_PLAIN: return string;
2900
+ case STYLE_SINGLE: return "'" + string.replace(/'/g, "''") + "'";
2901
+ case STYLE_LITERAL: return "|" + blockHeader(string, state.indent) + dropEndingNewline(indentString(string, indent));
2902
+ case STYLE_FOLDED: return ">" + blockHeader(string, state.indent) + dropEndingNewline(indentString(foldString(string, lineWidth), indent));
2903
+ case STYLE_DOUBLE: return "\"" + escapeString(string) + "\"";
2904
+ default: throw new YAMLException2("impossible error: invalid scalar style");
2905
+ }
2906
+ })();
2907
+ }
2908
+ __name(writeScalar, "writeScalar");
2909
+ function blockHeader(string, indentPerLevel) {
2910
+ const indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : "";
2911
+ const clip = string[string.length - 1] === "\n";
2912
+ return indentIndicator + (clip && (string[string.length - 2] === "\n" || string === "\n") ? "+" : clip ? "" : "-") + "\n";
2913
+ }
2914
+ __name(blockHeader, "blockHeader");
2915
+ function dropEndingNewline(string) {
2916
+ return string[string.length - 1] === "\n" ? string.slice(0, -1) : string;
2917
+ }
2918
+ __name(dropEndingNewline, "dropEndingNewline");
2919
+ function foldString(string, width) {
2920
+ const lineRe = /(\n+)([^\n]*)/g;
2921
+ let result = (function() {
2922
+ let nextLF = string.indexOf("\n");
2923
+ nextLF = nextLF !== -1 ? nextLF : string.length;
2924
+ lineRe.lastIndex = nextLF;
2925
+ return foldLine(string.slice(0, nextLF), width);
2926
+ })();
2927
+ let prevMoreIndented = string[0] === "\n" || string[0] === " ";
2928
+ let moreIndented;
2929
+ let match;
2930
+ while (match = lineRe.exec(string)) {
2931
+ const prefix = match[1];
2932
+ const line = match[2];
2933
+ moreIndented = line[0] === " ";
2934
+ result += prefix + (!prevMoreIndented && !moreIndented && line !== "" ? "\n" : "") + foldLine(line, width);
2935
+ prevMoreIndented = moreIndented;
2936
+ }
2937
+ return result;
2938
+ }
2939
+ __name(foldString, "foldString");
2940
+ function foldLine(line, width) {
2941
+ if (line === "" || line[0] === " ") return line;
2942
+ const breakRe = / [^ ]/g;
2943
+ let match;
2944
+ let start = 0;
2945
+ let end;
2946
+ let curr = 0;
2947
+ let next = 0;
2948
+ let result = "";
2949
+ while (match = breakRe.exec(line)) {
2950
+ next = match.index;
2951
+ if (next - start > width) {
2952
+ end = curr > start ? curr : next;
2953
+ result += "\n" + line.slice(start, end);
2954
+ start = end + 1;
2955
+ }
2956
+ curr = next;
2957
+ }
2958
+ result += "\n";
2959
+ if (line.length - start > width && curr > start) result += line.slice(start, curr) + "\n" + line.slice(curr + 1);
2960
+ else result += line.slice(start);
2961
+ return result.slice(1);
2962
+ }
2963
+ __name(foldLine, "foldLine");
2964
+ function escapeString(string) {
2965
+ let result = "";
2966
+ let char = 0;
2967
+ for (let i = 0; i < string.length; char >= 65536 ? i += 2 : i++) {
2968
+ char = codePointAt(string, i);
2969
+ const escapeSeq = ESCAPE_SEQUENCES[char];
2970
+ if (!escapeSeq && isPrintable(char)) {
2971
+ result += string[i];
2972
+ if (char >= 65536) result += string[i + 1];
2973
+ } else result += escapeSeq || encodeHex(char);
2974
+ }
2975
+ return result;
2976
+ }
2977
+ __name(escapeString, "escapeString");
2978
+ function writeFlowSequence(state, level, object) {
2979
+ let _result = "";
2980
+ const _tag = state.tag;
2981
+ for (let index = 0, length = object.length; index < length; index += 1) {
2982
+ let value = object[index];
2983
+ if (state.replacer) value = state.replacer.call(object, String(index), value);
2984
+ if (writeNode(state, level, value, false, false) || typeof value === "undefined" && writeNode(state, level, null, false, false)) {
2985
+ if (_result !== "") _result += "," + (!state.condenseFlow ? " " : "");
2986
+ _result += state.dump;
2987
+ }
2988
+ }
2989
+ state.tag = _tag;
2990
+ state.dump = "[" + _result + "]";
2991
+ }
2992
+ __name(writeFlowSequence, "writeFlowSequence");
2993
+ function writeBlockSequence(state, level, object, compact) {
2994
+ let _result = "";
2995
+ const _tag = state.tag;
2996
+ for (let index = 0, length = object.length; index < length; index += 1) {
2997
+ let value = object[index];
2998
+ if (state.replacer) value = state.replacer.call(object, String(index), value);
2999
+ if (writeNode(state, level + 1, value, true, true, false, true) || typeof value === "undefined" && writeNode(state, level + 1, null, true, true, false, true)) {
3000
+ if (!compact || _result !== "") _result += generateNextLine(state, level);
3001
+ if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) _result += "-";
3002
+ else _result += "- ";
3003
+ _result += state.dump;
3004
+ }
3005
+ }
3006
+ state.tag = _tag;
3007
+ state.dump = _result || "[]";
3008
+ }
3009
+ __name(writeBlockSequence, "writeBlockSequence");
3010
+ function writeFlowMapping(state, level, object) {
3011
+ let _result = "";
3012
+ const _tag = state.tag;
3013
+ const objectKeyList = Object.keys(object);
3014
+ for (let index = 0, length = objectKeyList.length; index < length; index += 1) {
3015
+ let pairBuffer = "";
3016
+ if (_result !== "") pairBuffer += ", ";
3017
+ if (state.condenseFlow) pairBuffer += "\"";
3018
+ const objectKey = objectKeyList[index];
3019
+ let objectValue = object[objectKey];
3020
+ if (state.replacer) objectValue = state.replacer.call(object, objectKey, objectValue);
3021
+ if (!writeNode(state, level, objectKey, false, false)) continue;
3022
+ if (state.dump.length > 1024) pairBuffer += "? ";
3023
+ pairBuffer += state.dump + (state.condenseFlow ? "\"" : "") + ":" + (state.condenseFlow ? "" : " ");
3024
+ if (!writeNode(state, level, objectValue, false, false)) continue;
3025
+ pairBuffer += state.dump;
3026
+ _result += pairBuffer;
3027
+ }
3028
+ state.tag = _tag;
3029
+ state.dump = "{" + _result + "}";
3030
+ }
3031
+ __name(writeFlowMapping, "writeFlowMapping");
3032
+ function writeBlockMapping(state, level, object, compact) {
3033
+ let _result = "";
3034
+ const _tag = state.tag;
3035
+ const objectKeyList = Object.keys(object);
3036
+ if (state.sortKeys === true) objectKeyList.sort();
3037
+ else if (typeof state.sortKeys === "function") objectKeyList.sort(state.sortKeys);
3038
+ else if (state.sortKeys) throw new YAMLException2("sortKeys must be a boolean or a function");
3039
+ for (let index = 0, length = objectKeyList.length; index < length; index += 1) {
3040
+ let pairBuffer = "";
3041
+ if (!compact || _result !== "") pairBuffer += generateNextLine(state, level);
3042
+ const objectKey = objectKeyList[index];
3043
+ let objectValue = object[objectKey];
3044
+ if (state.replacer) objectValue = state.replacer.call(object, objectKey, objectValue);
3045
+ if (!writeNode(state, level + 1, objectKey, true, true, true)) continue;
3046
+ const explicitPair = state.tag !== null && state.tag !== "?" || state.dump && state.dump.length > 1024;
3047
+ if (explicitPair) if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) pairBuffer += "?";
3048
+ else pairBuffer += "? ";
3049
+ pairBuffer += state.dump;
3050
+ if (explicitPair) pairBuffer += generateNextLine(state, level);
3051
+ if (!writeNode(state, level + 1, objectValue, true, explicitPair)) continue;
3052
+ if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) pairBuffer += ":";
3053
+ else pairBuffer += ": ";
3054
+ pairBuffer += state.dump;
3055
+ _result += pairBuffer;
3056
+ }
3057
+ state.tag = _tag;
3058
+ state.dump = _result || "{}";
3059
+ }
3060
+ __name(writeBlockMapping, "writeBlockMapping");
3061
+ function detectType(state, object, explicit) {
3062
+ const typeList = explicit ? state.explicitTypes : state.implicitTypes;
3063
+ for (let index = 0, length = typeList.length; index < length; index += 1) {
3064
+ const type2 = typeList[index];
3065
+ if ((type2.instanceOf || type2.predicate) && (!type2.instanceOf || typeof object === "object" && object instanceof type2.instanceOf) && (!type2.predicate || type2.predicate(object))) {
3066
+ if (explicit) if (type2.multi && type2.representName) state.tag = type2.representName(object);
3067
+ else state.tag = type2.tag;
3068
+ else state.tag = "?";
3069
+ if (type2.represent) {
3070
+ const style = state.styleMap[type2.tag] || type2.defaultStyle;
3071
+ let _result;
3072
+ if (_toString.call(type2.represent) === "[object Function]") _result = type2.represent(object, style);
3073
+ else if (_hasOwnProperty.call(type2.represent, style)) _result = type2.represent[style](object, style);
3074
+ else throw new YAMLException2("!<" + type2.tag + "> tag resolver accepts not \"" + style + "\" style");
3075
+ state.dump = _result;
3076
+ }
3077
+ return true;
3078
+ }
3079
+ }
3080
+ return false;
3081
+ }
3082
+ __name(detectType, "detectType");
3083
+ function writeNode(state, level, object, block, compact, iskey, isblockseq) {
3084
+ state.tag = null;
3085
+ state.dump = object;
3086
+ if (!detectType(state, object, false)) detectType(state, object, true);
3087
+ const type2 = _toString.call(state.dump);
3088
+ const inblock = block;
3089
+ if (block) block = state.flowLevel < 0 || state.flowLevel > level;
3090
+ const objectOrArray = type2 === "[object Object]" || type2 === "[object Array]";
3091
+ let duplicateIndex;
3092
+ let duplicate;
3093
+ if (objectOrArray) {
3094
+ duplicateIndex = state.duplicates.indexOf(object);
3095
+ duplicate = duplicateIndex !== -1;
3096
+ }
3097
+ if (state.tag !== null && state.tag !== "?" || duplicate || state.indent !== 2 && level > 0) compact = false;
3098
+ if (duplicate && state.usedDuplicates[duplicateIndex]) state.dump = "*ref_" + duplicateIndex;
3099
+ else {
3100
+ if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) state.usedDuplicates[duplicateIndex] = true;
3101
+ if (type2 === "[object Object]") if (block && Object.keys(state.dump).length !== 0) {
3102
+ writeBlockMapping(state, level, state.dump, compact);
3103
+ if (duplicate) state.dump = "&ref_" + duplicateIndex + state.dump;
3104
+ } else {
3105
+ writeFlowMapping(state, level, state.dump);
3106
+ if (duplicate) state.dump = "&ref_" + duplicateIndex + " " + state.dump;
3107
+ }
3108
+ else if (type2 === "[object Array]") if (block && state.dump.length !== 0) {
3109
+ if (state.noArrayIndent && !isblockseq && level > 0) writeBlockSequence(state, level - 1, state.dump, compact);
3110
+ else writeBlockSequence(state, level, state.dump, compact);
3111
+ if (duplicate) state.dump = "&ref_" + duplicateIndex + state.dump;
3112
+ } else {
3113
+ writeFlowSequence(state, level, state.dump);
3114
+ if (duplicate) state.dump = "&ref_" + duplicateIndex + " " + state.dump;
3115
+ }
3116
+ else if (type2 === "[object String]") {
3117
+ if (state.tag !== "?") writeScalar(state, state.dump, level, iskey, inblock);
3118
+ } else if (type2 === "[object Undefined]") return false;
3119
+ else {
3120
+ if (state.skipInvalid) return false;
3121
+ throw new YAMLException2("unacceptable kind of an object to dump " + type2);
3122
+ }
3123
+ if (state.tag !== null && state.tag !== "?") {
3124
+ let tagStr = encodeURI(state.tag[0] === "!" ? state.tag.slice(1) : state.tag).replace(/!/g, "%21");
3125
+ if (state.tag[0] === "!") tagStr = "!" + tagStr;
3126
+ else if (tagStr.slice(0, 18) === "tag:yaml.org,2002:") tagStr = "!!" + tagStr.slice(18);
3127
+ else tagStr = "!<" + tagStr + ">";
3128
+ state.dump = tagStr + " " + state.dump;
3129
+ }
3130
+ }
3131
+ return true;
3132
+ }
3133
+ __name(writeNode, "writeNode");
3134
+ function getDuplicateReferences(object, state) {
3135
+ const objects = [];
3136
+ const duplicatesIndexes = [];
3137
+ inspectNode(object, objects, duplicatesIndexes);
3138
+ const length = duplicatesIndexes.length;
3139
+ for (let index = 0; index < length; index += 1) state.duplicates.push(objects[duplicatesIndexes[index]]);
3140
+ state.usedDuplicates = new Array(length);
3141
+ }
3142
+ __name(getDuplicateReferences, "getDuplicateReferences");
3143
+ function inspectNode(object, objects, duplicatesIndexes) {
3144
+ if (object !== null && typeof object === "object") {
3145
+ const index = objects.indexOf(object);
3146
+ if (index !== -1) {
3147
+ if (duplicatesIndexes.indexOf(index) === -1) duplicatesIndexes.push(index);
3148
+ } else {
3149
+ objects.push(object);
3150
+ if (Array.isArray(object)) for (let i = 0, length = object.length; i < length; i += 1) inspectNode(object[i], objects, duplicatesIndexes);
3151
+ else {
3152
+ const objectKeyList = Object.keys(object);
3153
+ for (let i = 0, length = objectKeyList.length; i < length; i += 1) inspectNode(object[objectKeyList[i]], objects, duplicatesIndexes);
3154
+ }
3155
+ }
3156
+ }
3157
+ }
3158
+ __name(inspectNode, "inspectNode");
3159
+ function dump2(input, options) {
3160
+ options = options || {};
3161
+ const state = new State(options);
3162
+ if (!state.noRefs) getDuplicateReferences(input, state);
3163
+ let value = input;
3164
+ if (state.replacer) value = state.replacer.call({ "": value }, "", value);
3165
+ if (writeNode(state, 0, value, true, true)) return state.dump + "\n";
3166
+ return "";
3167
+ }
3168
+ __name(dump2, "dump2");
3169
+ dumper.dump = dump2;
3170
+ return dumper;
3171
+ }
3172
+ __name(requireDumper, "requireDumper");
3173
+ var hasRequiredJsYaml;
3174
+ function requireJsYaml() {
3175
+ if (hasRequiredJsYaml) return jsYaml;
3176
+ hasRequiredJsYaml = 1;
3177
+ const loader2 = requireLoader();
3178
+ const dumper2 = requireDumper();
3179
+ function renamed(from, to) {
3180
+ return function() {
3181
+ throw new Error("Function yaml." + from + " is removed in js-yaml 4. Use yaml." + to + " instead, which is now safe by default.");
3182
+ };
3183
+ }
3184
+ __name(renamed, "renamed");
3185
+ jsYaml.Type = requireType();
3186
+ jsYaml.Schema = requireSchema();
3187
+ jsYaml.FAILSAFE_SCHEMA = requireFailsafe();
3188
+ jsYaml.JSON_SCHEMA = requireJson();
3189
+ jsYaml.CORE_SCHEMA = requireCore();
3190
+ jsYaml.DEFAULT_SCHEMA = require_default();
3191
+ jsYaml.load = loader2.load;
3192
+ jsYaml.loadAll = loader2.loadAll;
3193
+ jsYaml.dump = dumper2.dump;
3194
+ jsYaml.YAMLException = requireException();
3195
+ jsYaml.types = {
3196
+ binary: requireBinary(),
3197
+ float: requireFloat(),
3198
+ map: requireMap(),
3199
+ null: require_null(),
3200
+ pairs: requirePairs(),
3201
+ set: requireSet(),
3202
+ timestamp: requireTimestamp(),
3203
+ bool: requireBool(),
3204
+ int: requireInt(),
3205
+ merge: requireMerge(),
3206
+ omap: requireOmap(),
3207
+ seq: requireSeq(),
3208
+ str: requireStr()
3209
+ };
3210
+ jsYaml.safeLoad = renamed("safeLoad", "load");
3211
+ jsYaml.safeLoadAll = renamed("safeLoadAll", "loadAll");
3212
+ jsYaml.safeDump = renamed("safeDump", "dump");
3213
+ return jsYaml;
3214
+ }
3215
+ __name(requireJsYaml, "requireJsYaml");
3216
+ var { Type, Schema, FAILSAFE_SCHEMA, JSON_SCHEMA, CORE_SCHEMA, DEFAULT_SCHEMA, load, loadAll, dump, YAMLException, types, safeLoad, safeLoadAll, safeDump } = /* @__PURE__ */ getDefaultExportFromCjs(requireJsYaml());
3217
+
3218
+ //#endregion
3219
+ //#region ../../node_modules/.pnpm/stylis@4.4.0/node_modules/stylis/src/Enum.js
3220
+ var COMMENT = "comm";
3221
+ var RULESET = "rule";
3222
+ var DECLARATION = "decl";
3223
+ var MEDIA = "@media";
3224
+ var IMPORT = "@import";
3225
+ var SUPPORTS = "@supports";
3226
+ var NAMESPACE = "@namespace";
3227
+ var KEYFRAMES = "@keyframes";
3228
+ var LAYER = "@layer";
3229
+ var SCOPE = "@scope";
3230
+
3231
+ //#endregion
3232
+ //#region ../../node_modules/.pnpm/stylis@4.4.0/node_modules/stylis/src/Utility.js
3233
+ /**
3234
+ * @param {number}
3235
+ * @return {number}
3236
+ */
3237
+ var abs = Math.abs;
3238
+ /**
3239
+ * @param {number}
3240
+ * @return {string}
3241
+ */
3242
+ var from = String.fromCharCode;
3243
+ /**
3244
+ * @param {string} value
3245
+ * @return {string}
3246
+ */
3247
+ function trim(value) {
3248
+ return value.trim();
3249
+ }
3250
+ /**
3251
+ * @param {string} value
3252
+ * @param {(string|RegExp)} pattern
3253
+ * @param {string} replacement
3254
+ * @return {string}
3255
+ */
3256
+ function replace(value, pattern, replacement) {
3257
+ return value.replace(pattern, replacement);
3258
+ }
3259
+ /**
3260
+ * @param {string} value
3261
+ * @param {number} index
3262
+ * @return {number}
3263
+ */
3264
+ function charat(value, index) {
3265
+ return value.charCodeAt(index) | 0;
3266
+ }
3267
+ /**
3268
+ * @param {string} value
3269
+ * @param {number} begin
3270
+ * @param {number} end
3271
+ * @return {string}
3272
+ */
3273
+ function substr(value, begin, end) {
3274
+ return value.slice(begin, end);
3275
+ }
3276
+ /**
3277
+ * @param {string} value
3278
+ * @return {number}
3279
+ */
3280
+ function strlen(value) {
3281
+ return value.length;
3282
+ }
3283
+ /**
3284
+ * @param {any[]} value
3285
+ * @return {number}
3286
+ */
3287
+ function sizeof(value) {
3288
+ return value.length;
3289
+ }
3290
+ /**
3291
+ * @param {any} value
3292
+ * @param {any[]} array
3293
+ * @return {any}
3294
+ */
3295
+ function append(value, array) {
3296
+ return array.push(value), value;
3297
+ }
3298
+
3299
+ //#endregion
3300
+ //#region ../../node_modules/.pnpm/stylis@4.4.0/node_modules/stylis/src/Tokenizer.js
3301
+ var line = 1;
3302
+ var column = 1;
3303
+ var length = 0;
3304
+ var position = 0;
3305
+ var character = 0;
3306
+ var characters = "";
3307
+ /**
3308
+ * @param {string} value
3309
+ * @param {object | null} root
3310
+ * @param {object | null} parent
3311
+ * @param {string} type
3312
+ * @param {string[] | string} props
3313
+ * @param {object[] | string} children
3314
+ * @param {object[]} siblings
3315
+ * @param {number} length
3316
+ */
3317
+ function node(value, root, parent, type, props, children, length, siblings) {
3318
+ return {
3319
+ value,
3320
+ root,
3321
+ parent,
3322
+ type,
3323
+ props,
3324
+ children,
3325
+ line,
3326
+ column,
3327
+ length,
3328
+ return: "",
3329
+ siblings
3330
+ };
3331
+ }
3332
+ /**
3333
+ * @return {number}
3334
+ */
3335
+ function char() {
3336
+ return character;
3337
+ }
3338
+ /**
3339
+ * @return {number}
3340
+ */
3341
+ function prev() {
3342
+ character = position > 0 ? charat(characters, --position) : 0;
3343
+ if (column--, character === 10) column = 1, line--;
3344
+ return character;
3345
+ }
3346
+ /**
3347
+ * @return {number}
3348
+ */
3349
+ function next() {
3350
+ character = position < length ? charat(characters, position++) : 0;
3351
+ if (column++, character === 10) column = 1, line++;
3352
+ return character;
3353
+ }
3354
+ /**
3355
+ * @return {number}
3356
+ */
3357
+ function peek() {
3358
+ return charat(characters, position);
3359
+ }
3360
+ /**
3361
+ * @return {number}
3362
+ */
3363
+ function caret() {
3364
+ return position;
3365
+ }
3366
+ /**
3367
+ * @param {number} begin
3368
+ * @param {number} end
3369
+ * @return {string}
3370
+ */
3371
+ function slice(begin, end) {
3372
+ return substr(characters, begin, end);
3373
+ }
3374
+ /**
3375
+ * @param {number} type
3376
+ * @return {number}
3377
+ */
3378
+ function token(type) {
3379
+ switch (type) {
3380
+ case 0:
3381
+ case 9:
3382
+ case 10:
3383
+ case 13:
3384
+ case 32: return 5;
3385
+ case 33:
3386
+ case 43:
3387
+ case 44:
3388
+ case 47:
3389
+ case 62:
3390
+ case 64:
3391
+ case 126:
3392
+ case 59:
3393
+ case 123:
3394
+ case 125: return 4;
3395
+ case 58: return 3;
3396
+ case 34:
3397
+ case 39:
3398
+ case 40:
3399
+ case 91: return 2;
3400
+ case 41:
3401
+ case 93: return 1;
3402
+ }
3403
+ return 0;
3404
+ }
3405
+ /**
3406
+ * @param {string} value
3407
+ * @return {any[]}
3408
+ */
3409
+ function alloc(value) {
3410
+ return line = column = 1, length = strlen(characters = value), position = 0, [];
3411
+ }
3412
+ /**
3413
+ * @param {any} value
3414
+ * @return {any}
3415
+ */
3416
+ function dealloc(value) {
3417
+ return characters = "", value;
3418
+ }
3419
+ /**
3420
+ * @param {number} type
3421
+ * @return {string}
3422
+ */
3423
+ function delimit(type) {
3424
+ return trim(slice(position - 1, delimiter(type === 91 ? type + 2 : type === 40 ? type + 1 : type)));
3425
+ }
3426
+ /**
3427
+ * @param {number} type
3428
+ * @return {string}
3429
+ */
3430
+ function whitespace(type) {
3431
+ while (character = peek()) if (character < 33) next();
3432
+ else break;
3433
+ return token(type) > 2 || token(character) > 3 ? "" : " ";
3434
+ }
3435
+ /**
3436
+ * @param {number} index
3437
+ * @param {number} count
3438
+ * @return {string}
3439
+ */
3440
+ function escaping(index, count) {
3441
+ while (--count && next()) if (character < 48 || character > 102 || character > 57 && character < 65 || character > 70 && character < 97) break;
3442
+ return slice(index, caret() + (count < 6 && peek() == 32 && next() == 32));
3443
+ }
3444
+ /**
3445
+ * @param {number} type
3446
+ * @return {number}
3447
+ */
3448
+ function delimiter(type) {
3449
+ while (next()) switch (character) {
3450
+ case type: return position;
3451
+ case 34:
3452
+ case 39:
3453
+ if (type !== 34 && type !== 39) delimiter(character);
3454
+ break;
3455
+ case 40:
3456
+ if (type === 41) delimiter(type);
3457
+ break;
3458
+ case 92:
3459
+ next();
3460
+ break;
3461
+ }
3462
+ return position;
3463
+ }
3464
+ /**
3465
+ * @param {number} type
3466
+ * @param {number} index
3467
+ * @return {number}
3468
+ */
3469
+ function commenter(type, index) {
3470
+ while (next()) if (type + character === 57) break;
3471
+ else if (type + character === 84 && peek() === 47) break;
3472
+ return "/*" + slice(index, position - 1) + "*" + from(type === 47 ? type : next());
3473
+ }
3474
+ /**
3475
+ * @param {number} index
3476
+ * @return {string}
3477
+ */
3478
+ function identifier(index) {
3479
+ while (!token(peek())) next();
3480
+ return slice(index, position);
3481
+ }
3482
+
3483
+ //#endregion
3484
+ //#region ../../node_modules/.pnpm/stylis@4.4.0/node_modules/stylis/src/Parser.js
3485
+ /**
3486
+ * @param {string} value
3487
+ * @return {object[]}
3488
+ */
3489
+ function compile(value) {
3490
+ return dealloc(parse$1("", null, null, null, [""], value = alloc(value), 0, [0], value));
3491
+ }
3492
+ /**
3493
+ * @param {string} value
3494
+ * @param {object} root
3495
+ * @param {object?} parent
3496
+ * @param {string[]} rule
3497
+ * @param {string[]} rules
3498
+ * @param {string[]} rulesets
3499
+ * @param {number[]} pseudo
3500
+ * @param {number[]} points
3501
+ * @param {string[]} declarations
3502
+ * @return {object}
3503
+ */
3504
+ function parse$1(value, root, parent, rule, rules, rulesets, pseudo, points, declarations) {
3505
+ var index = 0;
3506
+ var offset = 0;
3507
+ var length = pseudo;
3508
+ var atrule = 0;
3509
+ var property = 0;
3510
+ var previous = 0;
3511
+ var variable = 1;
3512
+ var scanning = 1;
3513
+ var ampersand = 1;
3514
+ var parens = 0;
3515
+ var character = 0;
3516
+ var type = "";
3517
+ var props = rules;
3518
+ var children = rulesets;
3519
+ var reference = rule;
3520
+ var characters = type;
3521
+ while (scanning) switch (previous = character, character = next()) {
3522
+ case 40:
3523
+ if (previous != 108 && charat(characters, length - 1) == 58) parens++, characters += "(";
3524
+ else characters += delimit(character);
3525
+ break;
3526
+ case 41:
3527
+ parens--, characters += ")";
3528
+ break;
3529
+ case 34:
3530
+ case 39:
3531
+ case 91:
3532
+ characters += delimit(character);
3533
+ break;
3534
+ case 9:
3535
+ case 10:
3536
+ case 13:
3537
+ case 32:
3538
+ if (parens > 0) {
3539
+ characters += from(character);
3540
+ break;
3541
+ }
3542
+ characters += whitespace(previous);
3543
+ break;
3544
+ case 92:
3545
+ characters += escaping(caret() - 1, 7);
3546
+ continue;
3547
+ case 47:
3548
+ switch (peek()) {
3549
+ case 42:
3550
+ case 47:
3551
+ append(comment(commenter(next(), caret()), root, parent, declarations), declarations);
3552
+ if ((token(previous || 1) == 5 || token(peek() || 1) == 5) && strlen(characters) && substr(characters, -1, void 0) !== " ") characters += " ";
3553
+ break;
3554
+ default: characters += "/";
3555
+ }
3556
+ break;
3557
+ case 123 * variable: points[index++] = strlen(characters) * ampersand;
3558
+ case 125 * variable:
3559
+ case 59:
3560
+ case 0:
3561
+ if (parens > 0 && character) {
3562
+ characters += from(character);
3563
+ break;
3564
+ }
3565
+ switch (character) {
3566
+ case 0:
3567
+ case 125: scanning = 0;
3568
+ case 59 + offset:
3569
+ if (ampersand == -1) characters = replace(characters, /\f/g, "");
3570
+ 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);
3571
+ break;
3572
+ case 59: characters += ";";
3573
+ default:
3574
+ append(reference = ruleset(characters, root, parent, index, offset, rules, points, type, props = [], children = [], length, rulesets), rulesets);
3575
+ if (character === 123) if (offset === 0) parse$1(characters, root, reference, reference, props, rulesets, length, points, children);
3576
+ else {
3577
+ switch (atrule) {
3578
+ case 99: if (charat(characters, 3) === 110) break;
3579
+ case 108: if (charat(characters, 2) === 97) break;
3580
+ default: offset = 0;
3581
+ case 100:
3582
+ case 109:
3583
+ case 115:
3584
+ }
3585
+ 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);
3586
+ else parse$1(characters, reference, reference, reference, [""], children, 0, points, children);
3587
+ }
3588
+ }
3589
+ index = offset = property = 0, variable = ampersand = 1, type = characters = "", length = pseudo;
3590
+ break;
3591
+ case 58: length = 1 + strlen(characters), property = previous;
3592
+ default:
3593
+ if (variable < 1) {
3594
+ if (character == 123) --variable;
3595
+ else if (character == 125 && variable++ == 0 && prev() == 125) continue;
3596
+ }
3597
+ switch (characters += from(character), character * variable) {
3598
+ case 38:
3599
+ ampersand = offset > 0 ? 1 : (characters += "\f", -1);
3600
+ break;
3601
+ case 44:
3602
+ if (parens > 0) break;
3603
+ points[index++] = (strlen(characters) - 1) * ampersand, ampersand = 1;
3604
+ break;
3605
+ case 64:
3606
+ if (peek() === 45) characters += delimit(next());
3607
+ atrule = peek(), offset = length = strlen(type = characters += identifier(caret())), character++;
3608
+ break;
3609
+ case 45: if (previous === 45 && strlen(characters) == 2) variable = 0;
3610
+ }
3611
+ }
3612
+ return rulesets;
3613
+ }
3614
+ /**
3615
+ * @param {string} value
3616
+ * @param {object} root
3617
+ * @param {object?} parent
3618
+ * @param {number} index
3619
+ * @param {number} offset
3620
+ * @param {string[]} rules
3621
+ * @param {number[]} points
3622
+ * @param {string} type
3623
+ * @param {string[]} props
3624
+ * @param {string[]} children
3625
+ * @param {number} length
3626
+ * @param {object[]} siblings
3627
+ * @return {object}
3628
+ */
3629
+ function ruleset(value, root, parent, index, offset, rules, points, type, props, children, length, siblings) {
3630
+ var post = offset - 1;
3631
+ var rule = offset === 0 ? rules : [""];
3632
+ var size = sizeof(rule);
3633
+ 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;
3634
+ return node(value, root, parent, offset === 0 ? RULESET : type, props, children, length, siblings);
3635
+ }
3636
+ /**
3637
+ * @param {number} value
3638
+ * @param {object} root
3639
+ * @param {object?} parent
3640
+ * @param {object[]} siblings
3641
+ * @return {object}
3642
+ */
3643
+ function comment(value, root, parent, siblings) {
3644
+ return node(value, root, parent, COMMENT, from(char()), substr(value, 2, -2), 0, siblings);
3645
+ }
3646
+ /**
3647
+ * @param {string} value
3648
+ * @param {object} root
3649
+ * @param {object?} parent
3650
+ * @param {number} length
3651
+ * @param {object[]} siblings
3652
+ * @return {object}
3653
+ */
3654
+ function declaration(value, root, parent, length, siblings) {
3655
+ return node(value, root, parent, DECLARATION, substr(value, 0, length), substr(value, length + 1, -1), length, siblings);
3656
+ }
3657
+
3658
+ //#endregion
3659
+ //#region ../../node_modules/.pnpm/stylis@4.4.0/node_modules/stylis/src/Serializer.js
3660
+ /**
3661
+ * @param {object[]} children
3662
+ * @param {function} callback
3663
+ * @return {string}
3664
+ */
3665
+ function serialize(children, callback) {
3666
+ var output = "";
3667
+ for (var i = 0; i < children.length; i++) output += callback(children[i], i, children, callback) || "";
3668
+ return output;
3669
+ }
3670
+ /**
3671
+ * @param {object} element
3672
+ * @param {number} index
3673
+ * @param {object[]} children
3674
+ * @param {function} callback
3675
+ * @return {string}
3676
+ */
3677
+ function stringify(element, index, children, callback) {
3678
+ switch (element.type) {
3679
+ case LAYER: if (element.children.length) break;
3680
+ case IMPORT:
3681
+ case NAMESPACE:
3682
+ case DECLARATION: return element.return = element.return || element.value;
3683
+ case COMMENT: return "";
3684
+ case KEYFRAMES: return element.return = element.value + "{" + serialize(element.children, callback) + "}";
3685
+ case RULESET: if (!strlen(element.value = element.props.join(","))) return "";
3686
+ }
3687
+ return strlen(children = serialize(element.children, callback)) ? element.return = element.value + "{" + children + "}" : "";
3688
+ }
3689
+
3690
+ //#endregion
3691
+ //#region ../../node_modules/.pnpm/stylis@4.4.0/node_modules/stylis/src/Middleware.js
3692
+ /**
3693
+ * @param {function[]} collection
3694
+ * @return {function}
3695
+ */
3696
+ function middleware(collection) {
3697
+ var length = sizeof(collection);
3698
+ return function(element, index, children, callback) {
3699
+ var output = "";
3700
+ for (var i = 0; i < length; i++) output += collection[i](element, index, children, callback) || "";
3701
+ return output;
3702
+ };
3703
+ }
3704
+
3705
+ //#endregion
3706
+ //#region ../../node_modules/.pnpm/mermaid@11.17.2/node_modules/mermaid/dist/mermaid.core.mjs
3707
+ var id = "c4";
3708
+ var c4Detector_default = {
3709
+ id,
3710
+ detector: /* @__PURE__ */ __name((txt) => {
3711
+ return /^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(txt);
3712
+ }, "detector"),
3713
+ loader: /* @__PURE__ */ __name(async () => {
3714
+ const { diagram: diagram2 } = await import("./c4Diagram-7LVT6UL2.js");
3715
+ return {
3716
+ id,
3717
+ diagram: diagram2
3718
+ };
3719
+ }, "loader")
3720
+ };
3721
+ var id2 = "flowchart";
3722
+ var flowDetector_default = {
3723
+ id: id2,
3724
+ detector: /* @__PURE__ */ __name((txt, config) => {
3725
+ if (config?.flowchart?.defaultRenderer === "dagre-wrapper" || config?.flowchart?.defaultRenderer === "elk") return false;
3726
+ return /^\s*graph/.test(txt);
3727
+ }, "detector"),
3728
+ loader: /* @__PURE__ */ __name(async () => {
3729
+ const { diagram: diagram2 } = await import("./flowDiagram-HODETNUW.js");
3730
+ return {
3731
+ id: id2,
3732
+ diagram: diagram2
3733
+ };
3734
+ }, "loader")
3735
+ };
3736
+ var id3 = "flowchart-v2";
3737
+ var flowDetector_v2_default = {
3738
+ id: id3,
3739
+ detector: /* @__PURE__ */ __name((txt, config) => {
3740
+ if (config?.flowchart?.defaultRenderer === "dagre-d3") return false;
3741
+ if (config?.flowchart?.defaultRenderer === "elk") config.layout = "elk";
3742
+ if (/^\s*graph/.test(txt) && config?.flowchart?.defaultRenderer === "dagre-wrapper") return true;
3743
+ return /^\s*flowchart/.test(txt);
3744
+ }, "detector"),
3745
+ loader: /* @__PURE__ */ __name(async () => {
3746
+ const { diagram: diagram2 } = await import("./flowDiagram-HODETNUW.js");
3747
+ return {
3748
+ id: id3,
3749
+ diagram: diagram2
3750
+ };
3751
+ }, "loader")
3752
+ };
3753
+ var id4 = "swimlane";
3754
+ var detector_default = {
3755
+ id: id4,
3756
+ detector: /* @__PURE__ */ __name((txt) => {
3757
+ return /^\s*swimlane-beta\b/.test(txt);
3758
+ }, "detector"),
3759
+ loader: /* @__PURE__ */ __name(async () => {
3760
+ const { diagram: diagram2 } = await import("./swimlanesDiagram-VR7AAH4N.js");
3761
+ return {
3762
+ id: id4,
3763
+ diagram: diagram2
3764
+ };
3765
+ }, "loader")
3766
+ };
3767
+ var id5 = "er";
3768
+ var erDetector_default = {
3769
+ id: id5,
3770
+ detector: /* @__PURE__ */ __name((txt) => {
3771
+ return /^\s*erDiagram/.test(txt);
3772
+ }, "detector"),
3773
+ loader: /* @__PURE__ */ __name(async () => {
3774
+ const { diagram: diagram2 } = await import("./erDiagram-RLTQ6QDP.js");
3775
+ return {
3776
+ id: id5,
3777
+ diagram: diagram2
3778
+ };
3779
+ }, "loader")
3780
+ };
3781
+ var id6 = "gitGraph";
3782
+ var gitGraphDetector_default = {
3783
+ id: id6,
3784
+ detector: /* @__PURE__ */ __name((txt) => {
3785
+ return /^\s*gitGraph/.test(txt);
3786
+ }, "detector"),
3787
+ loader: /* @__PURE__ */ __name(async () => {
3788
+ const { diagram: diagram2 } = await import("./gitGraphDiagram-WWUBYQGX.js");
3789
+ return {
3790
+ id: id6,
3791
+ diagram: diagram2
3792
+ };
3793
+ }, "loader")
3794
+ };
3795
+ var id7 = "gantt";
3796
+ var ganttDetector_default = {
3797
+ id: id7,
3798
+ detector: /* @__PURE__ */ __name((txt) => {
3799
+ return /^\s*gantt/.test(txt);
3800
+ }, "detector"),
3801
+ loader: /* @__PURE__ */ __name(async () => {
3802
+ const { diagram: diagram2 } = await import("./ganttDiagram-EL5Y4UJY.js");
3803
+ return {
3804
+ id: id7,
3805
+ diagram: diagram2
3806
+ };
3807
+ }, "loader")
3808
+ };
3809
+ var id8 = "info";
3810
+ var info = {
3811
+ id: id8,
3812
+ detector: /* @__PURE__ */ __name((txt) => {
3813
+ return /^\s*info/.test(txt);
3814
+ }, "detector"),
3815
+ loader: /* @__PURE__ */ __name(async () => {
3816
+ const { diagram: diagram2 } = await import("./infoDiagram-27XIBGKW.js");
3817
+ return {
3818
+ id: id8,
3819
+ diagram: diagram2
3820
+ };
3821
+ }, "loader")
3822
+ };
3823
+ var id9 = "pie";
3824
+ var pie = {
3825
+ id: id9,
3826
+ detector: /* @__PURE__ */ __name((txt) => {
3827
+ return /^\s*pie/.test(txt);
3828
+ }, "detector"),
3829
+ loader: /* @__PURE__ */ __name(async () => {
3830
+ const { diagram: diagram2 } = await import("./pieDiagram-E7YTZNPT.js");
3831
+ return {
3832
+ id: id9,
3833
+ diagram: diagram2
3834
+ };
3835
+ }, "loader")
3836
+ };
3837
+ var id10 = "quadrantChart";
3838
+ var quadrantDetector_default = {
3839
+ id: id10,
3840
+ detector: /* @__PURE__ */ __name((txt) => {
3841
+ return /^\s*quadrantChart/.test(txt);
3842
+ }, "detector"),
3843
+ loader: /* @__PURE__ */ __name(async () => {
3844
+ const { diagram: diagram2 } = await import("./quadrantDiagram-AXDQQJYC.js");
3845
+ return {
3846
+ id: id10,
3847
+ diagram: diagram2
3848
+ };
3849
+ }, "loader")
3850
+ };
3851
+ var id11 = "xychart";
3852
+ var xychartDetector_default = {
3853
+ id: id11,
3854
+ detector: /* @__PURE__ */ __name((txt) => {
3855
+ return /^\s*xychart(-beta)?/.test(txt);
3856
+ }, "detector"),
3857
+ loader: /* @__PURE__ */ __name(async () => {
3858
+ const { diagram: diagram2 } = await import("./xychartDiagram-S5SC5T6Z.js");
3859
+ return {
3860
+ id: id11,
3861
+ diagram: diagram2
3862
+ };
3863
+ }, "loader")
3864
+ };
3865
+ var id12 = "requirement";
3866
+ var requirementDetector_default = {
3867
+ id: id12,
3868
+ detector: /* @__PURE__ */ __name((txt) => {
3869
+ return /^\s*requirement(Diagram)?/.test(txt);
3870
+ }, "detector"),
3871
+ loader: /* @__PURE__ */ __name(async () => {
3872
+ const { diagram: diagram2 } = await import("./requirementDiagram-BXWQKSXE.js");
3873
+ return {
3874
+ id: id12,
3875
+ diagram: diagram2
3876
+ };
3877
+ }, "loader")
3878
+ };
3879
+ var id13 = "sequence";
3880
+ var sequenceDetector_default = {
3881
+ id: id13,
3882
+ detector: /* @__PURE__ */ __name((txt) => {
3883
+ return /^\s*sequenceDiagram/.test(txt);
3884
+ }, "detector"),
3885
+ loader: /* @__PURE__ */ __name(async () => {
3886
+ const { diagram: diagram2 } = await import("./sequenceDiagram-WJ2MYXX4.js");
3887
+ return {
3888
+ id: id13,
3889
+ diagram: diagram2
3890
+ };
3891
+ }, "loader")
3892
+ };
3893
+ var id14 = "class";
3894
+ var classDetector_default = {
3895
+ id: id14,
3896
+ detector: /* @__PURE__ */ __name((txt, config) => {
3897
+ if (config?.class?.defaultRenderer === "dagre-wrapper") return false;
3898
+ return /^\s*classDiagram/.test(txt);
3899
+ }, "detector"),
3900
+ loader: /* @__PURE__ */ __name(async () => {
3901
+ const { diagram: diagram2 } = await import("./classDiagram-ZZMXUADV.js");
3902
+ return {
3903
+ id: id14,
3904
+ diagram: diagram2
3905
+ };
3906
+ }, "loader")
3907
+ };
3908
+ var id15 = "classDiagram";
3909
+ var classDetector_V2_default = {
3910
+ id: id15,
3911
+ detector: /* @__PURE__ */ __name((txt, config) => {
3912
+ if (/^\s*classDiagram/.test(txt) && config?.class?.defaultRenderer === "dagre-wrapper") return true;
3913
+ return /^\s*classDiagram-v2/.test(txt);
3914
+ }, "detector"),
3915
+ loader: /* @__PURE__ */ __name(async () => {
3916
+ const { diagram: diagram2 } = await import("./classDiagram-v2-VYDZK3BY.js");
3917
+ return {
3918
+ id: id15,
3919
+ diagram: diagram2
3920
+ };
3921
+ }, "loader")
3922
+ };
3923
+ var id16 = "state";
3924
+ var stateDetector_default = {
3925
+ id: id16,
3926
+ detector: /* @__PURE__ */ __name((txt, config) => {
3927
+ if (config?.state?.defaultRenderer === "dagre-wrapper") return false;
3928
+ return /^\s*stateDiagram/.test(txt);
3929
+ }, "detector"),
3930
+ loader: /* @__PURE__ */ __name(async () => {
3931
+ const { diagram: diagram2 } = await import("./stateDiagram-D77RDMKH.js");
3932
+ return {
3933
+ id: id16,
3934
+ diagram: diagram2
3935
+ };
3936
+ }, "loader")
3937
+ };
3938
+ var id17 = "stateDiagram";
3939
+ var stateDetector_V2_default = {
3940
+ id: id17,
3941
+ detector: /* @__PURE__ */ __name((txt, config) => {
3942
+ if (/^\s*stateDiagram-v2/.test(txt)) return true;
3943
+ if (/^\s*stateDiagram/.test(txt) && config?.state?.defaultRenderer === "dagre-wrapper") return true;
3944
+ return false;
3945
+ }, "detector"),
3946
+ loader: /* @__PURE__ */ __name(async () => {
3947
+ const { diagram: diagram2 } = await import("./stateDiagram-v2-MP3YSRHH.js");
3948
+ return {
3949
+ id: id17,
3950
+ diagram: diagram2
3951
+ };
3952
+ }, "loader")
3953
+ };
3954
+ var id18 = "journey";
3955
+ var journeyDetector_default = {
3956
+ id: id18,
3957
+ detector: /* @__PURE__ */ __name((txt) => {
3958
+ return /^\s*journey/.test(txt);
3959
+ }, "detector"),
3960
+ loader: /* @__PURE__ */ __name(async () => {
3961
+ const { diagram: diagram2 } = await import("./journeyDiagram-3NMN7TZE.js");
3962
+ return {
3963
+ id: id18,
3964
+ diagram: diagram2
3965
+ };
3966
+ }, "loader")
3967
+ };
3968
+ var renderer = { draw: /* @__PURE__ */ __name((_text, id39, version) => {
3969
+ log.debug("rendering svg for syntax error\n");
3970
+ const svg = selectSvgElement(id39);
3971
+ const g = svg.append("g");
3972
+ svg.attr("viewBox", "0 0 2412 512");
3973
+ configureSvgSize(svg, 100, 512, true);
3974
+ 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");
3975
+ 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");
3976
+ 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");
3977
+ 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");
3978
+ 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");
3979
+ 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");
3980
+ 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");
3981
+ 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}`);
3982
+ }, "draw") };
3983
+ var errorRenderer_default = renderer;
3984
+ var errorDiagram_default = {
3985
+ db: {},
3986
+ renderer,
3987
+ parser: { parse: /* @__PURE__ */ __name(() => {}, "parse") }
3988
+ };
3989
+ var id19 = "flowchart-elk";
3990
+ var detector_default2 = {
3991
+ id: id19,
3992
+ detector: /* @__PURE__ */ __name((txt, config = {}) => {
3993
+ if (/^\s*flowchart-elk/.test(txt) || /^\s*(flowchart|graph)/.test(txt) && config?.flowchart?.defaultRenderer === "elk") {
3994
+ config.layout = "elk";
3995
+ return true;
3996
+ }
3997
+ return false;
3998
+ }, "detector"),
3999
+ loader: /* @__PURE__ */ __name(async () => {
4000
+ const { diagram: diagram2 } = await import("./flowDiagram-HODETNUW.js");
4001
+ return {
4002
+ id: id19,
4003
+ diagram: diagram2
4004
+ };
4005
+ }, "loader")
4006
+ };
4007
+ var id20 = "timeline";
4008
+ var detector_default3 = {
4009
+ id: id20,
4010
+ detector: /* @__PURE__ */ __name((txt) => {
4011
+ return /^\s*timeline/.test(txt);
4012
+ }, "detector"),
4013
+ loader: /* @__PURE__ */ __name(async () => {
4014
+ const { diagram: diagram2 } = await import("./timeline-definition-24CTP7MA.js");
4015
+ return {
4016
+ id: id20,
4017
+ diagram: diagram2
4018
+ };
4019
+ }, "loader")
4020
+ };
4021
+ var id21 = "mindmap";
4022
+ var detector_default4 = {
4023
+ id: id21,
4024
+ detector: /* @__PURE__ */ __name((txt) => {
4025
+ return /^\s*mindmap/.test(txt);
4026
+ }, "detector"),
4027
+ loader: /* @__PURE__ */ __name(async () => {
4028
+ const { diagram: diagram2 } = await import("./mindmap-definition-YA3MSWOX.js");
4029
+ return {
4030
+ id: id21,
4031
+ diagram: diagram2
4032
+ };
4033
+ }, "loader")
4034
+ };
4035
+ var id22 = "kanban";
4036
+ var detector_default5 = {
4037
+ id: id22,
4038
+ detector: /* @__PURE__ */ __name((txt) => {
4039
+ return /^\s*kanban/.test(txt);
4040
+ }, "detector"),
4041
+ loader: /* @__PURE__ */ __name(async () => {
4042
+ const { diagram: diagram2 } = await import("./kanban-definition-UXKFOSKX.js");
4043
+ return {
4044
+ id: id22,
4045
+ diagram: diagram2
4046
+ };
4047
+ }, "loader")
4048
+ };
4049
+ var id23 = "sankey";
4050
+ var sankeyDetector_default = {
4051
+ id: id23,
4052
+ detector: /* @__PURE__ */ __name((txt) => {
4053
+ return /^\s*sankey(-beta)?/.test(txt);
4054
+ }, "detector"),
4055
+ loader: /* @__PURE__ */ __name(async () => {
4056
+ const { diagram: diagram2 } = await import("./sankeyDiagram-P5KCCOFB.js");
4057
+ return {
4058
+ id: id23,
4059
+ diagram: diagram2
4060
+ };
4061
+ }, "loader")
4062
+ };
4063
+ var id24 = "packet";
4064
+ var packet = {
4065
+ id: id24,
4066
+ detector: /* @__PURE__ */ __name((txt) => {
4067
+ return /^\s*packet(-beta)?/.test(txt);
4068
+ }, "detector"),
4069
+ loader: /* @__PURE__ */ __name(async () => {
4070
+ const { diagram: diagram2 } = await import("./diagram-Z3DM3KII.js");
4071
+ return {
4072
+ id: id24,
4073
+ diagram: diagram2
4074
+ };
4075
+ }, "loader")
4076
+ };
4077
+ var id25 = "radar";
4078
+ var radar = {
4079
+ id: id25,
4080
+ detector: /* @__PURE__ */ __name((txt) => {
4081
+ return /^\s*radar-beta/.test(txt);
4082
+ }, "detector"),
4083
+ loader: /* @__PURE__ */ __name(async () => {
4084
+ const { diagram: diagram2 } = await import("./diagram-UQ7AKVKN.js");
4085
+ return {
4086
+ id: id25,
4087
+ diagram: diagram2
4088
+ };
4089
+ }, "loader")
4090
+ };
4091
+ var id26 = "block";
4092
+ var blockDetector_default = {
4093
+ id: id26,
4094
+ detector: /* @__PURE__ */ __name((txt) => {
4095
+ return /^\s*block(-beta)?/.test(txt);
4096
+ }, "detector"),
4097
+ loader: /* @__PURE__ */ __name(async () => {
4098
+ const { diagram: diagram2 } = await import("./blockDiagram-I7D4REHJ.js");
4099
+ return {
4100
+ id: id26,
4101
+ diagram: diagram2
4102
+ };
4103
+ }, "loader")
4104
+ };
4105
+ var id27 = "treeView";
4106
+ var detector_default6 = {
4107
+ id: id27,
4108
+ detector: /* @__PURE__ */ __name((txt) => {
4109
+ return /^\s*treeView-beta/.test(txt);
4110
+ }, "detector"),
4111
+ loader: /* @__PURE__ */ __name(async () => {
4112
+ const { diagram: diagram2 } = await import("./diagram-S7CK7UJ4.js");
4113
+ return {
4114
+ id: id27,
4115
+ diagram: diagram2
4116
+ };
4117
+ }, "loader")
4118
+ };
4119
+ var id28 = "architecture";
4120
+ var architectureDetector_default = {
4121
+ id: id28,
4122
+ detector: /* @__PURE__ */ __name((txt) => {
4123
+ return /^\s*architecture/.test(txt);
4124
+ }, "detector"),
4125
+ loader: /* @__PURE__ */ __name(async () => {
4126
+ const { diagram: diagram2 } = await import("./architectureDiagram-5GKGNRK7.js");
4127
+ return {
4128
+ id: id28,
4129
+ diagram: diagram2
4130
+ };
4131
+ }, "loader")
4132
+ };
4133
+ var id29 = "eventmodeling";
4134
+ var detector_default7 = {
4135
+ id: id29,
4136
+ detector: /* @__PURE__ */ __name((txt) => {
4137
+ return /^\s*eventmodeling/.test(txt);
4138
+ }, "detector"),
4139
+ loader: /* @__PURE__ */ __name(async () => {
4140
+ const { diagram: diagram2 } = await import("./diagram-VSXAHHWV.js");
4141
+ return {
4142
+ id: id29,
4143
+ diagram: diagram2
4144
+ };
4145
+ }, "loader")
4146
+ };
4147
+ var id30 = "ishikawa";
4148
+ var ishikawa = {
4149
+ id: id30,
4150
+ detector: /* @__PURE__ */ __name((txt) => {
4151
+ return /^\s*ishikawa(-beta)?\b/i.test(txt);
4152
+ }, "detector"),
4153
+ loader: /* @__PURE__ */ __name(async () => {
4154
+ const { diagram: diagram2 } = await import("./ishikawaDiagram-5VMMS53U.js");
4155
+ return {
4156
+ id: id30,
4157
+ diagram: diagram2
4158
+ };
4159
+ }, "loader")
4160
+ };
4161
+ var id31 = "venn";
4162
+ var vennDetector_default = {
4163
+ id: id31,
4164
+ detector: /* @__PURE__ */ __name((txt) => {
4165
+ return /^\s*venn-beta/.test(txt);
4166
+ }, "detector"),
4167
+ loader: /* @__PURE__ */ __name(async () => {
4168
+ const { diagram: diagram2 } = await import("./vennDiagram-4TSXK5OY.js");
4169
+ return {
4170
+ id: id31,
4171
+ diagram: diagram2
4172
+ };
4173
+ }, "loader")
4174
+ };
4175
+ var id32 = "treemap";
4176
+ var treemap = {
4177
+ id: id32,
4178
+ detector: /* @__PURE__ */ __name((txt) => {
4179
+ return /^\s*treemap/.test(txt);
4180
+ }, "detector"),
4181
+ loader: /* @__PURE__ */ __name(async () => {
4182
+ const { diagram: diagram2 } = await import("./diagram-VX7I27RA.js");
4183
+ return {
4184
+ id: id32,
4185
+ diagram: diagram2
4186
+ };
4187
+ }, "loader")
4188
+ };
4189
+ var id33 = "wardley";
4190
+ var wardleyDetector_default = {
4191
+ id: id33,
4192
+ detector: /* @__PURE__ */ __name((text) => {
4193
+ return /^\s*wardley-beta/i.test(text);
4194
+ }, "detector"),
4195
+ loader: /* @__PURE__ */ __name(async () => {
4196
+ const { diagram: diagram2 } = await import("./wardleyDiagram-VM6X3IG4.js");
4197
+ return {
4198
+ id: id33,
4199
+ diagram: diagram2
4200
+ };
4201
+ }, "loader")
4202
+ };
4203
+ var id34 = "cynefin";
4204
+ var cynefin = {
4205
+ id: id34,
4206
+ detector: /* @__PURE__ */ __name((txt) => {
4207
+ return /^\s*cynefin-beta(?:[\s:]|$)/.test(txt);
4208
+ }, "detector"),
4209
+ loader: /* @__PURE__ */ __name(async () => {
4210
+ const { diagram: diagram2 } = await import("./cynefinDiagram-5FMLGOSQ.js");
4211
+ return {
4212
+ id: id34,
4213
+ diagram: diagram2
4214
+ };
4215
+ }, "loader")
4216
+ };
4217
+ var id35 = "railroad";
4218
+ var railroad = {
4219
+ id: id35,
4220
+ detector: /* @__PURE__ */ __name((txt) => {
4221
+ return /^\s*railroad-beta/i.test(txt);
4222
+ }, "detector"),
4223
+ loader: /* @__PURE__ */ __name(async () => {
4224
+ const { diagram: diagram2 } = await import("./railroadDiagram-O6MQD6OU.js");
4225
+ return {
4226
+ id: id35,
4227
+ diagram: diagram2
4228
+ };
4229
+ }, "loader")
4230
+ };
4231
+ var id36 = "railroadEbnf";
4232
+ var railroadEbnf = {
4233
+ id: id36,
4234
+ detector: /* @__PURE__ */ __name((txt) => {
4235
+ return /^\s*railroad-ebnf-beta/i.test(txt);
4236
+ }, "detector"),
4237
+ loader: /* @__PURE__ */ __name(async () => {
4238
+ const { diagram: diagram2 } = await import("./ebnfDiagram-PWID7BFC.js");
4239
+ return {
4240
+ id: id36,
4241
+ diagram: diagram2
4242
+ };
4243
+ }, "loader")
4244
+ };
4245
+ var id37 = "railroadAbnf";
4246
+ var railroadAbnf = {
4247
+ id: id37,
4248
+ detector: /* @__PURE__ */ __name((txt) => {
4249
+ return /^\s*railroad-abnf-beta/i.test(txt);
4250
+ }, "detector"),
4251
+ loader: /* @__PURE__ */ __name(async () => {
4252
+ const { diagram: diagram2 } = await import("./abnfDiagram-VCTEODGH.js");
4253
+ return {
4254
+ id: id37,
4255
+ diagram: diagram2
4256
+ };
4257
+ }, "loader")
4258
+ };
4259
+ var id38 = "railroadPeg";
4260
+ var railroadPeg = {
4261
+ id: id38,
4262
+ detector: /* @__PURE__ */ __name((txt) => {
4263
+ return /^\s*railroad-peg-beta/i.test(txt);
4264
+ }, "detector"),
4265
+ loader: /* @__PURE__ */ __name(async () => {
4266
+ const { diagram: diagram2 } = await import("./pegDiagram-XKGWAZYB.js");
4267
+ return {
4268
+ id: id38,
4269
+ diagram: diagram2
4270
+ };
4271
+ }, "loader")
4272
+ };
4273
+ var hasLoadedDiagrams = false;
4274
+ var addDiagrams = /* @__PURE__ */ __name(() => {
4275
+ if (hasLoadedDiagrams) return;
4276
+ hasLoadedDiagrams = true;
4277
+ registerDiagram("error", errorDiagram_default, (text) => {
4278
+ return text.toLowerCase().trim() === "error";
4279
+ });
4280
+ registerDiagram("---", {
4281
+ db: { clear: /* @__PURE__ */ __name(() => {}, "clear") },
4282
+ styles: {},
4283
+ renderer: { draw: /* @__PURE__ */ __name(() => {}, "draw") },
4284
+ parser: { parse: /* @__PURE__ */ __name(() => {
4285
+ 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");
4286
+ }, "parse") },
4287
+ init: /* @__PURE__ */ __name(() => null, "init")
4288
+ }, (text) => {
4289
+ return text.toLowerCase().trimStart().startsWith("---");
4290
+ });
4291
+ registerLazyLoadedDiagrams(detector_default2, detector_default4, architectureDetector_default);
4292
+ registerLazyLoadedDiagrams(c4Detector_default, detector_default5, classDetector_V2_default, classDetector_default, erDetector_default, ganttDetector_default, info, pie, requirementDetector_default, sequenceDetector_default, detector_default, flowDetector_v2_default, flowDetector_default, detector_default3, gitGraphDetector_default, stateDetector_V2_default, stateDetector_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);
4293
+ }, "addDiagrams");
4294
+ var loadRegisteredDiagrams = /* @__PURE__ */ __name(async () => {
4295
+ log.debug(`Loading registered diagrams`);
4296
+ const failed = (await Promise.allSettled(Object.entries(detectors).map(async ([key, { detector: detector39, loader: loader39 }]) => {
4297
+ if (!loader39) return;
4298
+ try {
4299
+ getDiagram(key);
4300
+ } catch {
4301
+ try {
4302
+ const { diagram: diagram2, id: id39 } = await loader39();
4303
+ registerDiagram(id39, diagram2, detector39);
4304
+ } catch (err) {
4305
+ log.error(`Failed to load external diagram with key ${key}. Removing from detectors.`);
4306
+ delete detectors[key];
4307
+ throw err;
4308
+ }
4309
+ }
4310
+ }))).filter((result) => result.status === "rejected");
4311
+ if (failed.length > 0) {
4312
+ log.error(`Failed to load ${failed.length} external diagrams`);
4313
+ for (const res of failed) log.error(res);
4314
+ throw new Error(`Failed to load ${failed.length} external diagrams`);
4315
+ }
4316
+ }, "loadRegisteredDiagrams");
4317
+ var SVG_ROLE = "graphics-document document";
4318
+ function setA11yDiagramInfo(svg, diagramType) {
4319
+ svg.attr("role", SVG_ROLE);
4320
+ if (diagramType !== "") svg.attr("aria-roledescription", diagramType);
4321
+ }
4322
+ __name(setA11yDiagramInfo, "setA11yDiagramInfo");
4323
+ function addSVGa11yTitleDescription(svg, a11yTitle, a11yDesc, baseId) {
4324
+ if (svg.insert === void 0) return;
4325
+ if (a11yDesc) {
4326
+ const descId = `chart-desc-${baseId}`;
4327
+ svg.attr("aria-describedby", descId);
4328
+ svg.insert("desc", ":first-child").attr("id", descId).text(a11yDesc);
4329
+ }
4330
+ if (a11yTitle) {
4331
+ const titleId = `chart-title-${baseId}`;
4332
+ svg.attr("aria-labelledby", titleId);
4333
+ svg.insert("title", ":first-child").attr("id", titleId).text(a11yTitle);
4334
+ }
4335
+ }
4336
+ __name(addSVGa11yTitleDescription, "addSVGa11yTitleDescription");
4337
+ var Diagram = class _Diagram {
4338
+ constructor(type, text, db, parser, renderer2) {
4339
+ this.type = type;
4340
+ this.text = text;
4341
+ this.db = db;
4342
+ this.parser = parser;
4343
+ this.renderer = renderer2;
4344
+ }
4345
+ static {
4346
+ __name(this, "Diagram");
4347
+ }
4348
+ static async fromText(text, metadata = {}) {
4349
+ const config = getConfig();
4350
+ const type = detectType(text, config);
4351
+ text = encodeEntities(text) + "\n";
4352
+ try {
4353
+ getDiagram(type);
4354
+ } catch {
4355
+ const loader39 = getDiagramLoader(type);
4356
+ if (!loader39) throw new UnknownDiagramError(`Diagram ${type} not found.`);
4357
+ const { id: id39, diagram: diagram2 } = await loader39();
4358
+ registerDiagram(id39, diagram2);
4359
+ }
4360
+ const { db, parser, renderer: renderer2, init: init2 } = getDiagram(type);
4361
+ if (parser.parser) parser.parser.yy = db;
4362
+ db.clear?.();
4363
+ init2?.(config);
4364
+ if (metadata.title) db.setDiagramTitle?.(metadata.title);
4365
+ await parser.parse(text);
4366
+ return new _Diagram(type, text, db, parser, renderer2);
4367
+ }
4368
+ async render(id39, version) {
4369
+ await this.renderer.draw(this.text, id39, version, this);
4370
+ }
4371
+ getParser() {
4372
+ return this.parser;
4373
+ }
4374
+ getType() {
4375
+ return this.type;
4376
+ }
4377
+ };
4378
+ var interactionFunctions = [];
4379
+ var attachFunctions = /* @__PURE__ */ __name(() => {
4380
+ interactionFunctions.forEach((f) => {
4381
+ f();
4382
+ });
4383
+ interactionFunctions = [];
4384
+ }, "attachFunctions");
4385
+ var cleanupComments = /* @__PURE__ */ __name((text) => {
4386
+ return text.replace(/^\s*%%(?!{)[^\n]+\n?/gm, "").trimStart();
4387
+ }, "cleanupComments");
4388
+ function extractFrontMatter(text) {
4389
+ const matches = text.match(frontMatterRegex);
4390
+ if (!matches) return {
4391
+ text,
4392
+ metadata: {}
4393
+ };
4394
+ const indent = matches[1];
4395
+ const yamlBody = indent ? matches[2].split("\n").map((line) => line.startsWith(indent) ? line.slice(indent.length) : line).join("\n") : matches[2];
4396
+ let parsed = load(yamlBody, { schema: JSON_SCHEMA }) ?? {};
4397
+ parsed = typeof parsed === "object" && !Array.isArray(parsed) ? parsed : {};
4398
+ const metadata = {};
4399
+ if (parsed.displayMode) metadata.displayMode = parsed.displayMode.toString();
4400
+ if (parsed.title) metadata.title = parsed.title.toString();
4401
+ if (parsed.config) metadata.config = parsed.config;
4402
+ return {
4403
+ text: text.slice(matches[0].length),
4404
+ metadata
4405
+ };
4406
+ }
4407
+ __name(extractFrontMatter, "extractFrontMatter");
4408
+ var cleanupText = /* @__PURE__ */ __name((code) => {
4409
+ return code.replace(/\r\n?/g, "\n").replace(/<(\w+)([^>]*)>/g, (match, tag, attributes) => "<" + tag + attributes.replace(/="([^"]*)"/g, "='$1'") + ">");
4410
+ }, "cleanupText");
4411
+ var processFrontmatter = /* @__PURE__ */ __name((code) => {
4412
+ const { text, metadata } = extractFrontMatter(code);
4413
+ const { displayMode, title, config = {} } = metadata;
4414
+ if (displayMode) {
4415
+ if (!config.gantt) config.gantt = {};
4416
+ config.gantt.displayMode = displayMode;
4417
+ }
4418
+ return {
4419
+ title,
4420
+ config,
4421
+ text
4422
+ };
4423
+ }, "processFrontmatter");
4424
+ var processDirectives = /* @__PURE__ */ __name((code) => {
4425
+ const initDirective = utils_default.detectInit(code) ?? {};
4426
+ const wrapDirectives = utils_default.detectDirective(code, "wrap");
4427
+ if (Array.isArray(wrapDirectives)) initDirective.wrap = wrapDirectives.some(({ type }) => type === "wrap");
4428
+ else if (wrapDirectives?.type === "wrap") initDirective.wrap = true;
4429
+ return {
4430
+ text: removeDirectives(code),
4431
+ directive: initDirective
4432
+ };
4433
+ }, "processDirectives");
4434
+ function preprocessDiagram(code) {
4435
+ const frontMatterResult = processFrontmatter(cleanupText(code));
4436
+ const directiveResult = processDirectives(frontMatterResult.text);
4437
+ const config = cleanAndMerge(frontMatterResult.config, directiveResult.directive);
4438
+ code = cleanupComments(directiveResult.text);
4439
+ return {
4440
+ code,
4441
+ title: frontMatterResult.title,
4442
+ config
4443
+ };
4444
+ }
4445
+ __name(preprocessDiagram, "preprocessDiagram");
4446
+ function toBase64(str) {
4447
+ const utf8Bytes = new TextEncoder().encode(str);
4448
+ const utf8Str = Array.from(utf8Bytes, (byte) => String.fromCodePoint(byte)).join("");
4449
+ return btoa(utf8Str);
4450
+ }
4451
+ __name(toBase64, "toBase64");
4452
+ var MAX_TEXTLENGTH = 5e4;
4453
+ var MAX_TEXTLENGTH_EXCEEDED_MSG = "graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa";
4454
+ var SECURITY_LVL_SANDBOX = "sandbox";
4455
+ var SECURITY_LVL_LOOSE = "loose";
4456
+ var XMLNS_SVG_STD = "http://www.w3.org/2000/svg";
4457
+ var XMLNS_XLINK_STD = "http://www.w3.org/1999/xlink";
4458
+ var XMLNS_XHTML_STD = "http://www.w3.org/1999/xhtml";
4459
+ var IFRAME_WIDTH = "100%";
4460
+ var IFRAME_HEIGHT = "100%";
4461
+ var IFRAME_STYLES = "border:0;margin:0;";
4462
+ var IFRAME_BODY_STYLE = "margin:0";
4463
+ var IFRAME_SANDBOX_OPTS = "allow-top-navigation-by-user-activation allow-popups";
4464
+ var IFRAME_NOT_SUPPORTED_MSG = "The \"iframe\" tag is not supported by your browser.";
4465
+ var DOMPURIFY_TAGS = ["foreignobject"];
4466
+ var DOMPURIFY_ATTR = ["dominant-baseline"];
4467
+ function processAndSetConfigs(text) {
4468
+ const processed = preprocessDiagram(text);
4469
+ reset();
4470
+ addDirective(processed.config ?? {});
4471
+ return processed;
4472
+ }
4473
+ __name(processAndSetConfigs, "processAndSetConfigs");
4474
+ async function parse(text, parseOptions) {
4475
+ addDiagrams();
4476
+ try {
4477
+ const { code, config } = processAndSetConfigs(text);
4478
+ return {
4479
+ diagramType: (await getDiagramFromText(code)).type,
4480
+ config
4481
+ };
4482
+ } catch (error) {
4483
+ if (parseOptions?.suppressErrors) return false;
4484
+ throw error;
4485
+ }
4486
+ }
4487
+ __name(parse, "parse");
4488
+ var cssImportantStyles = /* @__PURE__ */ __name((cssClass, element, cssClasses = []) => {
4489
+ return `.${cssClass} ${element} ${sanitizeCss(`{ ${cssClasses.join(" !important; ")} !important; }`)}`;
4490
+ }, "cssImportantStyles");
4491
+ var createCssStyles = /* @__PURE__ */ __name((config, classDefs = /* @__PURE__ */ new Map()) => {
4492
+ const cssStyles = new CSSStyleSheet();
4493
+ if (config.fontFamily !== void 0) cssStyles.insertRule(`:root { --mermaid-font-family: ${config.fontFamily}}`, cssStyles.cssRules.length);
4494
+ if (config.altFontFamily !== void 0) cssStyles.insertRule(`:root { --mermaid-alt-font-family: ${config.altFontFamily}}`, cssStyles.cssRules.length);
4495
+ if (classDefs instanceof Map) {
4496
+ const cssElements = getEffectiveHtmlLabels(config) ? ["> *", "span"] : [
4497
+ "rect",
4498
+ "polygon",
4499
+ "ellipse",
4500
+ "circle",
4501
+ "path"
4502
+ ];
4503
+ classDefs.forEach((styleClassDef) => {
4504
+ if (!isEmpty(styleClassDef.styles)) cssElements.forEach((cssElement) => {
4505
+ cssStyles.insertRule(cssImportantStyles(styleClassDef.id, cssElement, styleClassDef.styles), cssStyles.cssRules.length);
4506
+ });
4507
+ if (!isEmpty(styleClassDef.textStyles)) cssStyles.insertRule(cssImportantStyles(styleClassDef.id, "tspan", (styleClassDef?.textStyles || []).map((s) => s.replace("color", "fill"))), cssStyles.cssRules.length);
4508
+ });
4509
+ }
4510
+ let cssString = "";
4511
+ if (config.themeCSS !== void 0) if (typeof cssStyles.replaceSync === "function") {
4512
+ const themeCssStyleSheet = new CSSStyleSheet();
4513
+ themeCssStyleSheet.replaceSync(config.themeCSS);
4514
+ cssString = cssStyleSheetToString(themeCssStyleSheet) + "\n";
4515
+ } else cssString += `${config.themeCSS}
4516
+ `;
4517
+ return cssString + cssStyleSheetToString(cssStyles);
4518
+ }, "createCssStyles");
4519
+ var compileCSS = /* @__PURE__ */ __name((namespace, css) => {
4520
+ return serialize(compile(`${namespace}{${css}}`), middleware([/* @__PURE__ */ __name(function addNamespace(element, _index, _children, _callback) {
4521
+ if (element.type === "rule" && Array.isArray(element.props)) {
4522
+ if (element.parent && element.parent.type === "@keyframes") return;
4523
+ element.props = element.props.map((prop) => {
4524
+ if (prop === namespace && Array.isArray(element.children) && element.children.every((child) => {
4525
+ if (child.type !== "decl") return false;
4526
+ return (/* @__PURE__ */ new Set([
4527
+ "font-family",
4528
+ "font-size",
4529
+ "fill"
4530
+ ])).has(child.props);
4531
+ })) return prop;
4532
+ if (!((prop.startsWith(`${namespace} `) || prop.startsWith(`${namespace}>`)) && !prop.startsWith(`${namespace} ||`))) return `${namespace} ${prop}`;
4533
+ return prop;
4534
+ });
4535
+ } else if (element.type.startsWith("@")) {
4536
+ if (![...[
4537
+ "@media",
4538
+ "@supports",
4539
+ "@layer",
4540
+ "@scope",
4541
+ "@container",
4542
+ "@starting-style"
4543
+ ], "@keyframes"].includes(element.type)) {
4544
+ log.warn(`Removing unsupported at-rule ${element.type} from CSS`);
4545
+ element.type = COMMENT;
4546
+ }
4547
+ }
4548
+ }, "addNamespace"), stringify]));
4549
+ }, "compileCSS");
4550
+ var createUserStyles = /* @__PURE__ */ __name((config, graphType, classDefs, svgId) => {
4551
+ const userCSSstyles = createCssStyles(config, classDefs);
4552
+ return compileCSS(svgId, styles_default(graphType, userCSSstyles, {
4553
+ ...config.themeVariables,
4554
+ theme: config.theme,
4555
+ look: config.look
4556
+ }, svgId));
4557
+ }, "createUserStyles");
4558
+ var cleanUpSvgCode = /* @__PURE__ */ __name((svgCode = "", inSandboxMode, useArrowMarkerUrls) => {
4559
+ let cleanedUpSvg = svgCode;
4560
+ if (!useArrowMarkerUrls && !inSandboxMode) cleanedUpSvg = cleanedUpSvg.replace(/marker-end="url\([\d+./:=?A-Za-z-]*?#/g, "marker-end=\"url(#");
4561
+ cleanedUpSvg = decodeEntities(cleanedUpSvg);
4562
+ cleanedUpSvg = cleanedUpSvg.replace(/<br>/g, "<br/>");
4563
+ return cleanedUpSvg;
4564
+ }, "cleanUpSvgCode");
4565
+ var putIntoIFrame = /* @__PURE__ */ __name((svgCode = "", svgElement) => {
4566
+ 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}">
4567
+ ${IFRAME_NOT_SUPPORTED_MSG}
4568
+ </iframe>`;
4569
+ }, "putIntoIFrame");
4570
+ var appendDivSvgG = /* @__PURE__ */ __name((parentRoot, id39, enclosingDivId, divStyle, svgXlink) => {
4571
+ const enclosingDiv = parentRoot.append("div");
4572
+ enclosingDiv.attr("id", enclosingDivId);
4573
+ if (divStyle) enclosingDiv.attr("style", divStyle);
4574
+ const svgNode = enclosingDiv.append("svg").attr("id", id39).attr("width", "100%").attr("xmlns", XMLNS_SVG_STD);
4575
+ if (svgXlink) svgNode.attr("xmlns:xlink", svgXlink);
4576
+ svgNode.append("g");
4577
+ return parentRoot;
4578
+ }, "appendDivSvgG");
4579
+ function sandboxedIframe(parentNode, iFrameId) {
4580
+ return parentNode.append("iframe").attr("id", iFrameId).attr("style", "width: 100%; height: 100%;").attr("sandbox", "");
4581
+ }
4582
+ __name(sandboxedIframe, "sandboxedIframe");
4583
+ var removeExistingElements = /* @__PURE__ */ __name((doc, id39, divId, iFrameId) => {
4584
+ doc.getElementById(id39)?.remove();
4585
+ doc.getElementById(divId)?.remove();
4586
+ doc.getElementById(iFrameId)?.remove();
4587
+ }, "removeExistingElements");
4588
+ var render = /* @__PURE__ */ __name(async function(id39, text, svgContainingElement) {
4589
+ addDiagrams();
4590
+ const processed = processAndSetConfigs(text);
4591
+ text = processed.code;
4592
+ const config = getConfig();
4593
+ log.debug(config);
4594
+ if (text.length > (config?.maxTextSize ?? MAX_TEXTLENGTH)) text = MAX_TEXTLENGTH_EXCEEDED_MSG;
4595
+ const idSelector = `#${id39}`;
4596
+ const iFrameID = "i" + id39;
4597
+ const iFrameID_selector = "#" + iFrameID;
4598
+ const enclosingDivID = "d" + id39;
4599
+ const enclosingDivID_selector = "#" + enclosingDivID;
4600
+ const removeTempElements = /* @__PURE__ */ __name(() => {
4601
+ const node = select_default(isSandboxed ? iFrameID_selector : enclosingDivID_selector).node();
4602
+ if (node && "remove" in node) node.remove();
4603
+ }, "removeTempElements");
4604
+ let root = select_default(document.body);
4605
+ const isSandboxed = config.securityLevel === SECURITY_LVL_SANDBOX;
4606
+ const isLooseSecurityLevel = config.securityLevel === SECURITY_LVL_LOOSE;
4607
+ const fontFamily = config.fontFamily;
4608
+ if (svgContainingElement !== void 0) {
4609
+ if (svgContainingElement) svgContainingElement.innerHTML = "";
4610
+ if (isSandboxed) {
4611
+ const iframe = sandboxedIframe(select_default(svgContainingElement), iFrameID);
4612
+ root = select_default(iframe.nodes()[0].contentDocument.body);
4613
+ root.node().style.margin = "0";
4614
+ } else root = select_default(svgContainingElement);
4615
+ appendDivSvgG(root, id39, enclosingDivID, `font-family: ${fontFamily}`, XMLNS_XLINK_STD);
4616
+ } else {
4617
+ removeExistingElements(document, id39, enclosingDivID, iFrameID);
4618
+ if (isSandboxed) {
4619
+ const iframe = sandboxedIframe(select_default(document.body), iFrameID);
4620
+ root = select_default(iframe.nodes()[0].contentDocument.body);
4621
+ root.node().style.margin = "0";
4622
+ } else root = select_default("body");
4623
+ appendDivSvgG(root, id39, enclosingDivID);
4624
+ }
4625
+ let diag;
4626
+ let parseEncounteredException;
4627
+ try {
4628
+ diag = await Diagram.fromText(text, { title: processed.title });
4629
+ } catch (error) {
4630
+ if (config.suppressErrorRendering) {
4631
+ removeTempElements();
4632
+ throw error;
4633
+ }
4634
+ diag = await Diagram.fromText("error");
4635
+ parseEncounteredException = error;
4636
+ }
4637
+ const element = root.select(enclosingDivID_selector).node();
4638
+ const diagramType = diag.type;
4639
+ const svg = element.firstChild;
4640
+ const firstChild = svg.firstChild;
4641
+ const diagramClassDefs = diag.renderer.getClasses?.(text, diag);
4642
+ const rules = createUserStyles(config, diagramType, diagramClassDefs, idSelector);
4643
+ const style1 = document.createElement("style");
4644
+ style1.innerHTML = rules;
4645
+ svg.insertBefore(style1, firstChild);
4646
+ try {
4647
+ await diag.renderer.draw(text, id39, "11.17.2", diag);
4648
+ } catch (e) {
4649
+ if (config.suppressErrorRendering) removeTempElements();
4650
+ else errorRenderer_default.draw(text, id39, "11.17.2");
4651
+ throw e;
4652
+ }
4653
+ const svgNode = root.select(`${enclosingDivID_selector} svg`);
4654
+ const a11yTitle = diag.db.getAccTitle?.();
4655
+ const a11yDescr = diag.db.getAccDescription?.();
4656
+ addA11yInfo(diagramType, svgNode, a11yTitle, a11yDescr);
4657
+ const svgCode = (/* @__PURE__ */ __name(() => {
4658
+ root.select(`[id="${id39}"]`).selectAll("foreignobject > *").attr("xmlns", XMLNS_XHTML_STD);
4659
+ let code = root.select(enclosingDivID_selector).node().innerHTML;
4660
+ log.debug("config.arrowMarkerAbsolute", config.arrowMarkerAbsolute);
4661
+ code = cleanUpSvgCode(code, isSandboxed, evaluate(config.arrowMarkerAbsolute));
4662
+ if (isSandboxed) {
4663
+ const svgEl = root.select(enclosingDivID_selector + " svg").node();
4664
+ code = putIntoIFrame(code, svgEl);
4665
+ } else if (!isLooseSecurityLevel) code = purify.sanitize(code, {
4666
+ ADD_TAGS: DOMPURIFY_TAGS,
4667
+ ADD_ATTR: DOMPURIFY_ATTR,
4668
+ HTML_INTEGRATION_POINTS: { foreignobject: true }
4669
+ });
4670
+ attachFunctions();
4671
+ return code;
4672
+ }, "serializeSvg"))();
4673
+ if (parseEncounteredException) throw parseEncounteredException;
4674
+ removeTempElements();
4675
+ return {
4676
+ diagramType,
4677
+ svg: svgCode,
4678
+ bindFunctions: diag.db.bindFunctions
4679
+ };
4680
+ }, "render");
4681
+ function initialize(userOptions = {}) {
4682
+ const options = assignWithDepth_default({}, userOptions);
4683
+ if (options?.fontFamily && !options.themeVariables?.fontFamily) {
4684
+ if (!options.themeVariables) options.themeVariables = {};
4685
+ options.themeVariables.fontFamily = options.fontFamily;
4686
+ }
4687
+ saveConfigFromInitialize(options);
4688
+ if (options?.theme && options.theme in themes_default) options.themeVariables = themes_default[options.theme].getThemeVariables(options.themeVariables);
4689
+ else if (options) options.themeVariables = themes_default.default.getThemeVariables(options.themeVariables);
4690
+ const config = typeof options === "object" ? setSiteConfig(options) : getSiteConfig();
4691
+ setLogLevel(config.logLevel);
4692
+ addDiagrams();
4693
+ }
4694
+ __name(initialize, "initialize");
4695
+ var getDiagramFromText = /* @__PURE__ */ __name((text, metadata = {}) => {
4696
+ const { code } = preprocessDiagram(text);
4697
+ return Diagram.fromText(code, metadata);
4698
+ }, "getDiagramFromText");
4699
+ function addA11yInfo(diagramType, svgNode, a11yTitle, a11yDescr) {
4700
+ setA11yDiagramInfo(svgNode, diagramType);
4701
+ addSVGa11yTitleDescription(svgNode, a11yTitle, a11yDescr, svgNode.attr("id"));
4702
+ }
4703
+ __name(addA11yInfo, "addA11yInfo");
4704
+ var mermaidAPI = Object.freeze({
4705
+ render,
4706
+ parse,
4707
+ getDiagramFromText,
4708
+ initialize,
4709
+ getConfig,
4710
+ /**
4711
+ * @deprecated This function does nothing. It will be overwritten by the next
4712
+ * call to {@link render} or {@link parse}.
4713
+ */
4714
+ setConfig,
4715
+ getSiteConfig,
4716
+ updateSiteConfig,
4717
+ reset: /* @__PURE__ */ __name(() => {
4718
+ reset();
4719
+ }, "reset"),
4720
+ globalReset: /* @__PURE__ */ __name(() => {
4721
+ reset(defaultConfig);
4722
+ }, "globalReset"),
4723
+ defaultConfig
4724
+ });
4725
+ setLogLevel(getConfig().logLevel);
4726
+ reset(getConfig());
4727
+ var handleError = /* @__PURE__ */ __name((error, errors, parseError) => {
4728
+ log.warn(error);
4729
+ if (isDetailedError(error)) {
4730
+ if (parseError) parseError(error.str, error.hash);
4731
+ errors.push({
4732
+ ...error,
4733
+ message: error.str,
4734
+ error
4735
+ });
4736
+ } else {
4737
+ if (parseError) parseError(error);
4738
+ if (error instanceof Error) errors.push({
4739
+ str: error.message,
4740
+ message: error.message,
4741
+ hash: error.name,
4742
+ error
4743
+ });
4744
+ }
4745
+ }, "handleError");
4746
+ var run = /* @__PURE__ */ __name(async function(options = { querySelector: ".mermaid" }) {
4747
+ try {
4748
+ await runThrowsErrors(options);
4749
+ } catch (e) {
4750
+ if (isDetailedError(e)) log.error(e.str);
4751
+ if (mermaid.parseError) mermaid.parseError(e);
4752
+ if (!options.suppressErrors) {
4753
+ log.error("Use the suppressErrors option to suppress these errors");
4754
+ throw e;
4755
+ }
4756
+ }
4757
+ }, "run");
4758
+ var runThrowsErrors = /* @__PURE__ */ __name(async function({ postRenderCallback, querySelector, nodes } = { querySelector: ".mermaid" }) {
4759
+ const conf = mermaidAPI.getConfig();
4760
+ log.debug(`${!postRenderCallback ? "No " : ""}Callback function found`);
4761
+ let nodesToProcess;
4762
+ if (nodes) nodesToProcess = nodes;
4763
+ else if (querySelector) nodesToProcess = document.querySelectorAll(querySelector);
4764
+ else throw new Error("Nodes and querySelector are both undefined");
4765
+ log.debug(`Found ${nodesToProcess.length} diagrams`);
4766
+ if (conf?.startOnLoad !== void 0) {
4767
+ log.debug("Start On Load: " + conf?.startOnLoad);
4768
+ mermaidAPI.updateSiteConfig({ startOnLoad: conf?.startOnLoad });
4769
+ }
4770
+ const idGenerator = new utils_default.InitIDGenerator(conf.deterministicIds, conf.deterministicIDSeed);
4771
+ let txt;
4772
+ const errors = [];
4773
+ for (const element of Array.from(nodesToProcess)) {
4774
+ log.info("Rendering diagram: " + element.id);
4775
+ if (element.getAttribute("data-processed")) continue;
4776
+ element.setAttribute("data-processed", "true");
4777
+ const id39 = `mermaid-${idGenerator.next()}`;
4778
+ txt = element.innerHTML;
4779
+ txt = dedent(utils_default.entityDecode(txt)).trim().replace(/<br\s*\/?>/gi, "<br/>");
4780
+ const init2 = utils_default.detectInit(txt);
4781
+ if (init2) log.debug("Detected early reinit: ", init2);
4782
+ try {
4783
+ const { svg, bindFunctions } = await render2(id39, txt, element);
4784
+ element.innerHTML = svg;
4785
+ if (postRenderCallback) await postRenderCallback(id39);
4786
+ if (bindFunctions) bindFunctions(element);
4787
+ } catch (error) {
4788
+ handleError(error, errors, mermaid.parseError);
4789
+ }
4790
+ }
4791
+ if (errors.length > 0) throw errors[0];
4792
+ }, "runThrowsErrors");
4793
+ var initialize2 = /* @__PURE__ */ __name(function(config) {
4794
+ mermaidAPI.initialize(config);
4795
+ }, "initialize");
4796
+ var init = /* @__PURE__ */ __name(async function(config, nodes, callback) {
4797
+ log.warn("mermaid.init is deprecated. Please use run instead.");
4798
+ if (config) initialize2(config);
4799
+ const runOptions = {
4800
+ postRenderCallback: callback,
4801
+ querySelector: ".mermaid"
4802
+ };
4803
+ if (typeof nodes === "string") runOptions.querySelector = nodes;
4804
+ else if (nodes) if (nodes instanceof HTMLElement) runOptions.nodes = [nodes];
4805
+ else runOptions.nodes = nodes;
4806
+ await run(runOptions);
4807
+ }, "init");
4808
+ var registerExternalDiagrams = /* @__PURE__ */ __name(async (diagrams, { lazyLoad = true } = {}) => {
4809
+ addDiagrams();
4810
+ registerLazyLoadedDiagrams(...diagrams);
4811
+ if (lazyLoad === false) await loadRegisteredDiagrams();
4812
+ }, "registerExternalDiagrams");
4813
+ var contentLoaded = /* @__PURE__ */ __name(function() {
4814
+ if (mermaid.startOnLoad) {
4815
+ const { startOnLoad } = mermaidAPI.getConfig();
4816
+ if (startOnLoad) mermaid.run().catch((err) => log.error("Mermaid failed to initialize", err));
4817
+ }
4818
+ }, "contentLoaded");
4819
+ if (typeof document !== "undefined") window.addEventListener("load", contentLoaded, false);
4820
+ var setParseErrorHandler = /* @__PURE__ */ __name(function(parseErrorHandler) {
4821
+ mermaid.parseError = parseErrorHandler;
4822
+ }, "setParseErrorHandler");
4823
+ var executionQueue = [];
4824
+ var executionQueueRunning = false;
4825
+ var executeQueue = /* @__PURE__ */ __name(async () => {
4826
+ if (executionQueueRunning) return;
4827
+ executionQueueRunning = true;
4828
+ while (executionQueue.length > 0) {
4829
+ const f = executionQueue.shift();
4830
+ if (f) try {
4831
+ await f();
4832
+ } catch (e) {
4833
+ log.error("Error executing queue", e);
4834
+ }
4835
+ }
4836
+ executionQueueRunning = false;
4837
+ }, "executeQueue");
4838
+ var parse2 = /* @__PURE__ */ __name(async (text, parseOptions) => {
4839
+ return new Promise((resolve, reject) => {
4840
+ const performCall = /* @__PURE__ */ __name(() => new Promise((res, rej) => {
4841
+ mermaidAPI.parse(text, parseOptions).then((r) => {
4842
+ res(r);
4843
+ resolve(r);
4844
+ }, (e) => {
4845
+ log.error("Error parsing", e);
4846
+ mermaid.parseError?.(e);
4847
+ rej(e);
4848
+ reject(e);
4849
+ });
4850
+ }), "performCall");
4851
+ executionQueue.push(performCall);
4852
+ executeQueue().catch(reject);
4853
+ });
4854
+ }, "parse");
4855
+ var render2 = /* @__PURE__ */ __name((id39, text, container) => {
4856
+ return new Promise((resolve, reject) => {
4857
+ const performCall = /* @__PURE__ */ __name(() => new Promise((res, rej) => {
4858
+ mermaidAPI.render(id39, text, container).then((r) => {
4859
+ res(r);
4860
+ resolve(r);
4861
+ }, (e) => {
4862
+ log.error("Error parsing", e);
4863
+ mermaid.parseError?.(e);
4864
+ rej(e);
4865
+ reject(e);
4866
+ });
4867
+ }), "performCall");
4868
+ executionQueue.push(performCall);
4869
+ executeQueue().catch(reject);
4870
+ });
4871
+ }, "render");
4872
+ var mermaid = {
4873
+ startOnLoad: true,
4874
+ mermaidAPI,
4875
+ parse: parse2,
4876
+ render: render2,
4877
+ init,
4878
+ run,
4879
+ registerExternalDiagrams,
4880
+ registerLayoutLoaders,
4881
+ initialize: initialize2,
4882
+ parseError: void 0,
4883
+ contentLoaded,
4884
+ setParseErrorHandler,
4885
+ detectType,
4886
+ registerIconPacks,
4887
+ getRegisteredDiagramsMetadata: /* @__PURE__ */ __name(() => {
4888
+ return Object.keys(detectors).map((id39) => ({ id: id39 }));
4889
+ }, "getRegisteredDiagramsMetadata")
4890
+ };
4891
+ var mermaid_default = mermaid;
4892
+ /*! Check if previously processed */
4893
+ /*!
4894
+ * Wait for document loaded before starting the execution
4895
+ */
4896
+
4897
+ //#endregion
4898
+ export { createCommonLayoutRenderer as a, insertMeasuredNode as c, render$1 as d, mermaid_default as default, selectSvgElement as f, clusterDb as i, sortNodesByHierarchy as l, load as n, createLayoutElementGroups as o, adjustClustersAndEdges as r, findNonClusterChild as s, JSON_SCHEMA as t, getRegisteredLayoutAlgorithm as u };