1 | import { dedent } from "ts-dedent";
|
2 | import dayjs from "dayjs";
|
3 | import { sanitizeUrl } from "@braintree/sanitize-url";
|
4 | import { select, curveBasis, curveBasisClosed, curveBasisOpen, curveBumpX, curveBumpY, curveBundle, curveCardinalClosed, curveCardinalOpen, curveCardinal, curveCatmullRomClosed, curveCatmullRomOpen, curveCatmullRom, curveLinear, curveLinearClosed, curveMonotoneX, curveMonotoneY, curveNatural, curveStep, curveStepAfter, curveStepBefore } from "d3";
|
5 | import DOMPurify from "dompurify";
|
6 | import { adjust, invert, darken, lighten, isDark, rgba } from "khroma";
|
7 | import memoize from "lodash-es/memoize.js";
|
8 | import merge$1 from "lodash-es/merge.js";
|
9 | import { serialize, compile, stringify } from "stylis";
|
10 | import isEmpty from "lodash-es/isEmpty.js";
|
11 | const LEVELS = {
|
12 | trace: 0,
|
13 | debug: 1,
|
14 | info: 2,
|
15 | warn: 3,
|
16 | error: 4,
|
17 | fatal: 5
|
18 | };
|
19 | const log$1 = {
|
20 | trace: (..._args) => {
|
21 | },
|
22 | debug: (..._args) => {
|
23 | },
|
24 | info: (..._args) => {
|
25 | },
|
26 | warn: (..._args) => {
|
27 | },
|
28 | error: (..._args) => {
|
29 | },
|
30 | fatal: (..._args) => {
|
31 | }
|
32 | };
|
33 | const setLogLevel$1 = function(level = "fatal") {
|
34 | let numericLevel = LEVELS.fatal;
|
35 | if (typeof level === "string") {
|
36 | level = level.toLowerCase();
|
37 | if (level in LEVELS) {
|
38 | numericLevel = LEVELS[level];
|
39 | }
|
40 | } else if (typeof level === "number") {
|
41 | numericLevel = level;
|
42 | }
|
43 | log$1.trace = () => {
|
44 | };
|
45 | log$1.debug = () => {
|
46 | };
|
47 | log$1.info = () => {
|
48 | };
|
49 | log$1.warn = () => {
|
50 | };
|
51 | log$1.error = () => {
|
52 | };
|
53 | log$1.fatal = () => {
|
54 | };
|
55 | if (numericLevel <= LEVELS.fatal) {
|
56 | log$1.fatal = console.error ? console.error.bind(console, format("FATAL"), "color: orange") : console.log.bind(console, "\x1B[35m", format("FATAL"));
|
57 | }
|
58 | if (numericLevel <= LEVELS.error) {
|
59 | log$1.error = console.error ? console.error.bind(console, format("ERROR"), "color: orange") : console.log.bind(console, "\x1B[31m", format("ERROR"));
|
60 | }
|
61 | if (numericLevel <= LEVELS.warn) {
|
62 | log$1.warn = console.warn ? console.warn.bind(console, format("WARN"), "color: orange") : console.log.bind(console, `\x1B[33m`, format("WARN"));
|
63 | }
|
64 | if (numericLevel <= LEVELS.info) {
|
65 | log$1.info = console.info ? console.info.bind(console, format("INFO"), "color: lightblue") : console.log.bind(console, "\x1B[34m", format("INFO"));
|
66 | }
|
67 | if (numericLevel <= LEVELS.debug) {
|
68 | log$1.debug = console.debug ? console.debug.bind(console, format("DEBUG"), "color: lightgreen") : console.log.bind(console, "\x1B[32m", format("DEBUG"));
|
69 | }
|
70 | if (numericLevel <= LEVELS.trace) {
|
71 | log$1.trace = console.debug ? console.debug.bind(console, format("TRACE"), "color: lightgreen") : console.log.bind(console, "\x1B[32m", format("TRACE"));
|
72 | }
|
73 | };
|
74 | const format = (level) => {
|
75 | const time = dayjs().format("ss.SSS");
|
76 | return `%c${time} : ${level} : `;
|
77 | };
|
78 | const lineBreakRegex = /<br\s*\/?>/gi;
|
79 | const getRows = (s) => {
|
80 | if (!s) {
|
81 | return [""];
|
82 | }
|
83 | const str2 = breakToPlaceholder(s).replace(/\\n/g, "#br#");
|
84 | return str2.split("#br#");
|
85 | };
|
86 | const setupDompurifyHooksIfNotSetup = (() => {
|
87 | let setup = false;
|
88 | return () => {
|
89 | if (!setup) {
|
90 | setupDompurifyHooks();
|
91 | setup = true;
|
92 | }
|
93 | };
|
94 | })();
|
95 | function setupDompurifyHooks() {
|
96 | const TEMPORARY_ATTRIBUTE = "data-temp-href-target";
|
97 | DOMPurify.addHook("beforeSanitizeAttributes", (node) => {
|
98 | if (node.tagName === "A" && node.hasAttribute("target")) {
|
99 | node.setAttribute(TEMPORARY_ATTRIBUTE, node.getAttribute("target") || "");
|
100 | }
|
101 | });
|
102 | DOMPurify.addHook("afterSanitizeAttributes", (node) => {
|
103 | if (node.tagName === "A" && node.hasAttribute(TEMPORARY_ATTRIBUTE)) {
|
104 | node.setAttribute("target", node.getAttribute(TEMPORARY_ATTRIBUTE) || "");
|
105 | node.removeAttribute(TEMPORARY_ATTRIBUTE);
|
106 | if (node.getAttribute("target") === "_blank") {
|
107 | node.setAttribute("rel", "noopener");
|
108 | }
|
109 | }
|
110 | });
|
111 | }
|
112 | const removeScript = (txt) => {
|
113 | setupDompurifyHooksIfNotSetup();
|
114 | const sanitizedText = DOMPurify.sanitize(txt);
|
115 | return sanitizedText;
|
116 | };
|
117 | const sanitizeMore = (text, config2) => {
|
118 | var _a;
|
119 | if (((_a = config2.flowchart) == null ? void 0 : _a.htmlLabels) !== false) {
|
120 | const level = config2.securityLevel;
|
121 | if (level === "antiscript" || level === "strict") {
|
122 | text = removeScript(text);
|
123 | } else if (level !== "loose") {
|
124 | text = breakToPlaceholder(text);
|
125 | text = text.replace(/</g, "<").replace(/>/g, ">");
|
126 | text = text.replace(/=/g, "=");
|
127 | text = placeholderToBreak(text);
|
128 | }
|
129 | }
|
130 | return text;
|
131 | };
|
132 | const sanitizeText$2 = (text, config2) => {
|
133 | if (!text) {
|
134 | return text;
|
135 | }
|
136 | if (config2.dompurifyConfig) {
|
137 | text = DOMPurify.sanitize(sanitizeMore(text, config2), config2.dompurifyConfig).toString();
|
138 | } else {
|
139 | text = DOMPurify.sanitize(sanitizeMore(text, config2), {
|
140 | FORBID_TAGS: ["style"]
|
141 | }).toString();
|
142 | }
|
143 | return text;
|
144 | };
|
145 | const sanitizeTextOrArray = (a, config2) => {
|
146 | if (typeof a === "string") {
|
147 | return sanitizeText$2(a, config2);
|
148 | }
|
149 | return a.flat().map((x) => sanitizeText$2(x, config2));
|
150 | };
|
151 | const hasBreaks = (text) => {
|
152 | return lineBreakRegex.test(text);
|
153 | };
|
154 | const splitBreaks = (text) => {
|
155 | return text.split(lineBreakRegex);
|
156 | };
|
157 | const placeholderToBreak = (s) => {
|
158 | return s.replace(/#br#/g, "<br/>");
|
159 | };
|
160 | const breakToPlaceholder = (s) => {
|
161 | return s.replace(lineBreakRegex, "#br#");
|
162 | };
|
163 | const getUrl = (useAbsolute) => {
|
164 | let url = "";
|
165 | if (useAbsolute) {
|
166 | url = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search;
|
167 | url = url.replaceAll(/\(/g, "\\(");
|
168 | url = url.replaceAll(/\)/g, "\\)");
|
169 | }
|
170 | return url;
|
171 | };
|
172 | const evaluate = (val) => val === false || ["false", "null", "0"].includes(String(val).trim().toLowerCase()) ? false : true;
|
173 | const getMax = function(...values) {
|
174 | const newValues = values.filter((value) => {
|
175 | return !isNaN(value);
|
176 | });
|
177 | return Math.max(...newValues);
|
178 | };
|
179 | const getMin = function(...values) {
|
180 | const newValues = values.filter((value) => {
|
181 | return !isNaN(value);
|
182 | });
|
183 | return Math.min(...newValues);
|
184 | };
|
185 | const parseGenericTypes = function(input) {
|
186 | const inputSets = input.split(/(,)/);
|
187 | const output = [];
|
188 | for (let i = 0; i < inputSets.length; i++) {
|
189 | let thisSet = inputSets[i];
|
190 | if (thisSet === "," && i > 0 && i + 1 < inputSets.length) {
|
191 | const previousSet = inputSets[i - 1];
|
192 | const nextSet = inputSets[i + 1];
|
193 | if (shouldCombineSets(previousSet, nextSet)) {
|
194 | thisSet = previousSet + "," + nextSet;
|
195 | i++;
|
196 | output.pop();
|
197 | }
|
198 | }
|
199 | output.push(processSet(thisSet));
|
200 | }
|
201 | return output.join("");
|
202 | };
|
203 | const countOccurrence = (string, substring) => {
|
204 | return Math.max(0, string.split(substring).length - 1);
|
205 | };
|
206 | const shouldCombineSets = (previousSet, nextSet) => {
|
207 | const prevCount = countOccurrence(previousSet, "~");
|
208 | const nextCount = countOccurrence(nextSet, "~");
|
209 | return prevCount === 1 && nextCount === 1;
|
210 | };
|
211 | const processSet = (input) => {
|
212 | const tildeCount = countOccurrence(input, "~");
|
213 | let hasStartingTilde = false;
|
214 | if (tildeCount <= 1) {
|
215 | return input;
|
216 | }
|
217 | if (tildeCount % 2 !== 0 && input.startsWith("~")) {
|
218 | input = input.substring(1);
|
219 | hasStartingTilde = true;
|
220 | }
|
221 | const chars = [...input];
|
222 | let first = chars.indexOf("~");
|
223 | let last = chars.lastIndexOf("~");
|
224 | while (first !== -1 && last !== -1 && first !== last) {
|
225 | chars[first] = "<";
|
226 | chars[last] = ">";
|
227 | first = chars.indexOf("~");
|
228 | last = chars.lastIndexOf("~");
|
229 | }
|
230 | if (hasStartingTilde) {
|
231 | chars.unshift("~");
|
232 | }
|
233 | return chars.join("");
|
234 | };
|
235 | const isMathMLSupported = () => window.MathMLElement !== void 0;
|
236 | const katexRegex = /\$\$(.*)\$\$/g;
|
237 | const hasKatex = (text) => {
|
238 | var _a;
|
239 | return (((_a = text.match(katexRegex)) == null ? void 0 : _a.length) ?? 0) > 0;
|
240 | };
|
241 | const calculateMathMLDimensions = async (text, config2) => {
|
242 | text = await renderKatex(text, config2);
|
243 | const divElem = document.createElement("div");
|
244 | divElem.innerHTML = text;
|
245 | divElem.id = "katex-temp";
|
246 | divElem.style.visibility = "hidden";
|
247 | divElem.style.position = "absolute";
|
248 | divElem.style.top = "0";
|
249 | const body = document.querySelector("body");
|
250 | body == null ? void 0 : body.insertAdjacentElement("beforeend", divElem);
|
251 | const dim = { width: divElem.clientWidth, height: divElem.clientHeight };
|
252 | divElem.remove();
|
253 | return dim;
|
254 | };
|
255 | const renderKatex = async (text, config2) => {
|
256 | if (!hasKatex(text)) {
|
257 | return text;
|
258 | }
|
259 | if (!isMathMLSupported() && !config2.legacyMathML) {
|
260 | return text.replace(katexRegex, "MathML is unsupported in this environment.");
|
261 | }
|
262 | const { default: katex } = await import("katex");
|
263 | return text.split(lineBreakRegex).map(
|
264 | (line) => hasKatex(line) ? `
|
265 | <div style="display: flex; align-items: center; justify-content: center; white-space: nowrap;">
|
266 | ${line}
|
267 | </div>
|
268 | ` : `<div>${line}</div>`
|
269 | ).join("").replace(
|
270 | katexRegex,
|
271 | (_, c) => katex.renderToString(c, {
|
272 | throwOnError: true,
|
273 | displayMode: true,
|
274 | output: isMathMLSupported() ? "mathml" : "htmlAndMathml"
|
275 | }).replace(/\n/g, " ").replace(/<annotation.*<\/annotation>/g, "")
|
276 | );
|
277 | };
|
278 | const common$1 = {
|
279 | getRows,
|
280 | sanitizeText: sanitizeText$2,
|
281 | sanitizeTextOrArray,
|
282 | hasBreaks,
|
283 | splitBreaks,
|
284 | lineBreakRegex,
|
285 | removeScript,
|
286 | getUrl,
|
287 | evaluate,
|
288 | getMax,
|
289 | getMin
|
290 | };
|
291 | const mkBorder = (col, darkMode) => darkMode ? adjust(col, { s: -40, l: 10 }) : adjust(col, { s: -40, l: -10 });
|
292 | const oldAttributeBackgroundColorOdd = "#ffffff";
|
293 | const oldAttributeBackgroundColorEven = "#f2f2f2";
|
294 | let Theme$4 = class Theme {
|
295 | constructor() {
|
296 | this.background = "#f4f4f4";
|
297 | this.primaryColor = "#fff4dd";
|
298 | this.noteBkgColor = "#fff5ad";
|
299 | this.noteTextColor = "#333";
|
300 | this.THEME_COLOR_LIMIT = 12;
|
301 | this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif';
|
302 | this.fontSize = "16px";
|
303 | }
|
304 | updateColors() {
|
305 | var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
306 | this.primaryTextColor = this.primaryTextColor || (this.darkMode ? "#eee" : "#333");
|
307 | this.secondaryColor = this.secondaryColor || adjust(this.primaryColor, { h: -120 });
|
308 | this.tertiaryColor = this.tertiaryColor || adjust(this.primaryColor, { h: 180, l: 5 });
|
309 | this.primaryBorderColor = this.primaryBorderColor || mkBorder(this.primaryColor, this.darkMode);
|
310 | this.secondaryBorderColor = this.secondaryBorderColor || mkBorder(this.secondaryColor, this.darkMode);
|
311 | this.tertiaryBorderColor = this.tertiaryBorderColor || mkBorder(this.tertiaryColor, this.darkMode);
|
312 | this.noteBorderColor = this.noteBorderColor || mkBorder(this.noteBkgColor, this.darkMode);
|
313 | this.noteBkgColor = this.noteBkgColor || "#fff5ad";
|
314 | this.noteTextColor = this.noteTextColor || "#333";
|
315 | this.secondaryTextColor = this.secondaryTextColor || invert(this.secondaryColor);
|
316 | this.tertiaryTextColor = this.tertiaryTextColor || invert(this.tertiaryColor);
|
317 | this.lineColor = this.lineColor || invert(this.background);
|
318 | this.arrowheadColor = this.arrowheadColor || invert(this.background);
|
319 | this.textColor = this.textColor || this.primaryTextColor;
|
320 | this.border2 = this.border2 || this.tertiaryBorderColor;
|
321 | this.nodeBkg = this.nodeBkg || this.primaryColor;
|
322 | this.mainBkg = this.mainBkg || this.primaryColor;
|
323 | this.nodeBorder = this.nodeBorder || this.primaryBorderColor;
|
324 | this.clusterBkg = this.clusterBkg || this.tertiaryColor;
|
325 | this.clusterBorder = this.clusterBorder || this.tertiaryBorderColor;
|
326 | this.defaultLinkColor = this.defaultLinkColor || this.lineColor;
|
327 | this.titleColor = this.titleColor || this.tertiaryTextColor;
|
328 | this.edgeLabelBackground = this.edgeLabelBackground || (this.darkMode ? darken(this.secondaryColor, 30) : this.secondaryColor);
|
329 | this.nodeTextColor = this.nodeTextColor || this.primaryTextColor;
|
330 | this.actorBorder = this.actorBorder || this.primaryBorderColor;
|
331 | this.actorBkg = this.actorBkg || this.mainBkg;
|
332 | this.actorTextColor = this.actorTextColor || this.primaryTextColor;
|
333 | this.actorLineColor = this.actorLineColor || "grey";
|
334 | this.labelBoxBkgColor = this.labelBoxBkgColor || this.actorBkg;
|
335 | this.signalColor = this.signalColor || this.textColor;
|
336 | this.signalTextColor = this.signalTextColor || this.textColor;
|
337 | this.labelBoxBorderColor = this.labelBoxBorderColor || this.actorBorder;
|
338 | this.labelTextColor = this.labelTextColor || this.actorTextColor;
|
339 | this.loopTextColor = this.loopTextColor || this.actorTextColor;
|
340 | this.activationBorderColor = this.activationBorderColor || darken(this.secondaryColor, 10);
|
341 | this.activationBkgColor = this.activationBkgColor || this.secondaryColor;
|
342 | this.sequenceNumberColor = this.sequenceNumberColor || invert(this.lineColor);
|
343 | this.sectionBkgColor = this.sectionBkgColor || this.tertiaryColor;
|
344 | this.altSectionBkgColor = this.altSectionBkgColor || "white";
|
345 | this.sectionBkgColor = this.sectionBkgColor || this.secondaryColor;
|
346 | this.sectionBkgColor2 = this.sectionBkgColor2 || this.primaryColor;
|
347 | this.excludeBkgColor = this.excludeBkgColor || "#eeeeee";
|
348 | this.taskBorderColor = this.taskBorderColor || this.primaryBorderColor;
|
349 | this.taskBkgColor = this.taskBkgColor || this.primaryColor;
|
350 | this.activeTaskBorderColor = this.activeTaskBorderColor || this.primaryColor;
|
351 | this.activeTaskBkgColor = this.activeTaskBkgColor || lighten(this.primaryColor, 23);
|
352 | this.gridColor = this.gridColor || "lightgrey";
|
353 | this.doneTaskBkgColor = this.doneTaskBkgColor || "lightgrey";
|
354 | this.doneTaskBorderColor = this.doneTaskBorderColor || "grey";
|
355 | this.critBorderColor = this.critBorderColor || "#ff8888";
|
356 | this.critBkgColor = this.critBkgColor || "red";
|
357 | this.todayLineColor = this.todayLineColor || "red";
|
358 | this.taskTextColor = this.taskTextColor || this.textColor;
|
359 | this.taskTextOutsideColor = this.taskTextOutsideColor || this.textColor;
|
360 | this.taskTextLightColor = this.taskTextLightColor || this.textColor;
|
361 | this.taskTextColor = this.taskTextColor || this.primaryTextColor;
|
362 | this.taskTextDarkColor = this.taskTextDarkColor || this.textColor;
|
363 | this.taskTextClickableColor = this.taskTextClickableColor || "#003163";
|
364 | this.personBorder = this.personBorder || this.primaryBorderColor;
|
365 | this.personBkg = this.personBkg || this.mainBkg;
|
366 | this.transitionColor = this.transitionColor || this.lineColor;
|
367 | this.transitionLabelColor = this.transitionLabelColor || this.textColor;
|
368 | this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor;
|
369 | this.stateBkg = this.stateBkg || this.mainBkg;
|
370 | this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg;
|
371 | this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor;
|
372 | this.altBackground = this.altBackground || this.tertiaryColor;
|
373 | this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg;
|
374 | this.compositeBorder = this.compositeBorder || this.nodeBorder;
|
375 | this.innerEndBackground = this.nodeBorder;
|
376 | this.errorBkgColor = this.errorBkgColor || this.tertiaryColor;
|
377 | this.errorTextColor = this.errorTextColor || this.tertiaryTextColor;
|
378 | this.transitionColor = this.transitionColor || this.lineColor;
|
379 | this.specialStateColor = this.lineColor;
|
380 | this.cScale0 = this.cScale0 || this.primaryColor;
|
381 | this.cScale1 = this.cScale1 || this.secondaryColor;
|
382 | this.cScale2 = this.cScale2 || this.tertiaryColor;
|
383 | this.cScale3 = this.cScale3 || adjust(this.primaryColor, { h: 30 });
|
384 | this.cScale4 = this.cScale4 || adjust(this.primaryColor, { h: 60 });
|
385 | this.cScale5 = this.cScale5 || adjust(this.primaryColor, { h: 90 });
|
386 | this.cScale6 = this.cScale6 || adjust(this.primaryColor, { h: 120 });
|
387 | this.cScale7 = this.cScale7 || adjust(this.primaryColor, { h: 150 });
|
388 | this.cScale8 = this.cScale8 || adjust(this.primaryColor, { h: 210, l: 150 });
|
389 | this.cScale9 = this.cScale9 || adjust(this.primaryColor, { h: 270 });
|
390 | this.cScale10 = this.cScale10 || adjust(this.primaryColor, { h: 300 });
|
391 | this.cScale11 = this.cScale11 || adjust(this.primaryColor, { h: 330 });
|
392 | if (this.darkMode) {
|
393 | for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
|
394 | this["cScale" + i] = darken(this["cScale" + i], 75);
|
395 | }
|
396 | } else {
|
397 | for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
|
398 | this["cScale" + i] = darken(this["cScale" + i], 25);
|
399 | }
|
400 | }
|
401 | for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
|
402 | this["cScaleInv" + i] = this["cScaleInv" + i] || invert(this["cScale" + i]);
|
403 | }
|
404 | for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
|
405 | if (this.darkMode) {
|
406 | this["cScalePeer" + i] = this["cScalePeer" + i] || lighten(this["cScale" + i], 10);
|
407 | } else {
|
408 | this["cScalePeer" + i] = this["cScalePeer" + i] || darken(this["cScale" + i], 10);
|
409 | }
|
410 | }
|
411 | this.scaleLabelColor = this.scaleLabelColor || this.labelTextColor;
|
412 | for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
|
413 | this["cScaleLabel" + i] = this["cScaleLabel" + i] || this.scaleLabelColor;
|
414 | }
|
415 | const multiplier = this.darkMode ? -4 : -1;
|
416 | for (let i = 0; i < 5; i++) {
|
417 | this["surface" + i] = this["surface" + i] || adjust(this.mainBkg, { h: 180, s: -15, l: multiplier * (5 + i * 3) });
|
418 | this["surfacePeer" + i] = this["surfacePeer" + i] || adjust(this.mainBkg, { h: 180, s: -15, l: multiplier * (8 + i * 3) });
|
419 | }
|
420 | this.classText = this.classText || this.textColor;
|
421 | this.fillType0 = this.fillType0 || this.primaryColor;
|
422 | this.fillType1 = this.fillType1 || this.secondaryColor;
|
423 | this.fillType2 = this.fillType2 || adjust(this.primaryColor, { h: 64 });
|
424 | this.fillType3 = this.fillType3 || adjust(this.secondaryColor, { h: 64 });
|
425 | this.fillType4 = this.fillType4 || adjust(this.primaryColor, { h: -64 });
|
426 | this.fillType5 = this.fillType5 || adjust(this.secondaryColor, { h: -64 });
|
427 | this.fillType6 = this.fillType6 || adjust(this.primaryColor, { h: 128 });
|
428 | this.fillType7 = this.fillType7 || adjust(this.secondaryColor, { h: 128 });
|
429 | this.pie1 = this.pie1 || this.primaryColor;
|
430 | this.pie2 = this.pie2 || this.secondaryColor;
|
431 | this.pie3 = this.pie3 || this.tertiaryColor;
|
432 | this.pie4 = this.pie4 || adjust(this.primaryColor, { l: -10 });
|
433 | this.pie5 = this.pie5 || adjust(this.secondaryColor, { l: -10 });
|
434 | this.pie6 = this.pie6 || adjust(this.tertiaryColor, { l: -10 });
|
435 | this.pie7 = this.pie7 || adjust(this.primaryColor, { h: 60, l: -10 });
|
436 | this.pie8 = this.pie8 || adjust(this.primaryColor, { h: -60, l: -10 });
|
437 | this.pie9 = this.pie9 || adjust(this.primaryColor, { h: 120, l: 0 });
|
438 | this.pie10 = this.pie10 || adjust(this.primaryColor, { h: 60, l: -20 });
|
439 | this.pie11 = this.pie11 || adjust(this.primaryColor, { h: -60, l: -20 });
|
440 | this.pie12 = this.pie12 || adjust(this.primaryColor, { h: 120, l: -10 });
|
441 | this.pieTitleTextSize = this.pieTitleTextSize || "25px";
|
442 | this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor;
|
443 | this.pieSectionTextSize = this.pieSectionTextSize || "17px";
|
444 | this.pieSectionTextColor = this.pieSectionTextColor || this.textColor;
|
445 | this.pieLegendTextSize = this.pieLegendTextSize || "17px";
|
446 | this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor;
|
447 | this.pieStrokeColor = this.pieStrokeColor || "black";
|
448 | this.pieStrokeWidth = this.pieStrokeWidth || "2px";
|
449 | this.pieOuterStrokeWidth = this.pieOuterStrokeWidth || "2px";
|
450 | this.pieOuterStrokeColor = this.pieOuterStrokeColor || "black";
|
451 | this.pieOpacity = this.pieOpacity || "0.7";
|
452 | this.quadrant1Fill = this.quadrant1Fill || this.primaryColor;
|
453 | this.quadrant2Fill = this.quadrant2Fill || adjust(this.primaryColor, { r: 5, g: 5, b: 5 });
|
454 | this.quadrant3Fill = this.quadrant3Fill || adjust(this.primaryColor, { r: 10, g: 10, b: 10 });
|
455 | this.quadrant4Fill = this.quadrant4Fill || adjust(this.primaryColor, { r: 15, g: 15, b: 15 });
|
456 | this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor;
|
457 | this.quadrant2TextFill = this.quadrant2TextFill || adjust(this.primaryTextColor, { r: -5, g: -5, b: -5 });
|
458 | this.quadrant3TextFill = this.quadrant3TextFill || adjust(this.primaryTextColor, { r: -10, g: -10, b: -10 });
|
459 | this.quadrant4TextFill = this.quadrant4TextFill || adjust(this.primaryTextColor, { r: -15, g: -15, b: -15 });
|
460 | this.quadrantPointFill = this.quadrantPointFill || isDark(this.quadrant1Fill) ? lighten(this.quadrant1Fill) : darken(this.quadrant1Fill);
|
461 | this.quadrantPointTextFill = this.quadrantPointTextFill || this.primaryTextColor;
|
462 | this.quadrantXAxisTextFill = this.quadrantXAxisTextFill || this.primaryTextColor;
|
463 | this.quadrantYAxisTextFill = this.quadrantYAxisTextFill || this.primaryTextColor;
|
464 | this.quadrantInternalBorderStrokeFill = this.quadrantInternalBorderStrokeFill || this.primaryBorderColor;
|
465 | this.quadrantExternalBorderStrokeFill = this.quadrantExternalBorderStrokeFill || this.primaryBorderColor;
|
466 | this.quadrantTitleFill = this.quadrantTitleFill || this.primaryTextColor;
|
467 | this.xyChart = {
|
468 | backgroundColor: ((_a = this.xyChart) == null ? void 0 : _a.backgroundColor) || this.background,
|
469 | titleColor: ((_b = this.xyChart) == null ? void 0 : _b.titleColor) || this.primaryTextColor,
|
470 | xAxisTitleColor: ((_c = this.xyChart) == null ? void 0 : _c.xAxisTitleColor) || this.primaryTextColor,
|
471 | xAxisLabelColor: ((_d = this.xyChart) == null ? void 0 : _d.xAxisLabelColor) || this.primaryTextColor,
|
472 | xAxisTickColor: ((_e = this.xyChart) == null ? void 0 : _e.xAxisTickColor) || this.primaryTextColor,
|
473 | xAxisLineColor: ((_f = this.xyChart) == null ? void 0 : _f.xAxisLineColor) || this.primaryTextColor,
|
474 | yAxisTitleColor: ((_g = this.xyChart) == null ? void 0 : _g.yAxisTitleColor) || this.primaryTextColor,
|
475 | yAxisLabelColor: ((_h = this.xyChart) == null ? void 0 : _h.yAxisLabelColor) || this.primaryTextColor,
|
476 | yAxisTickColor: ((_i = this.xyChart) == null ? void 0 : _i.yAxisTickColor) || this.primaryTextColor,
|
477 | yAxisLineColor: ((_j = this.xyChart) == null ? void 0 : _j.yAxisLineColor) || this.primaryTextColor,
|
478 | plotColorPalette: ((_k = this.xyChart) == null ? void 0 : _k.plotColorPalette) || "#FFF4DD,#FFD8B1,#FFA07A,#ECEFF1,#D6DBDF,#C3E0A8,#FFB6A4,#FFD74D,#738FA7,#FFFFF0"
|
479 | };
|
480 | this.requirementBackground = this.requirementBackground || this.primaryColor;
|
481 | this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor;
|
482 | this.requirementBorderSize = this.requirementBorderSize || "1";
|
483 | this.requirementTextColor = this.requirementTextColor || this.primaryTextColor;
|
484 | this.relationColor = this.relationColor || this.lineColor;
|
485 | this.relationLabelBackground = this.relationLabelBackground || (this.darkMode ? darken(this.secondaryColor, 30) : this.secondaryColor);
|
486 | this.relationLabelColor = this.relationLabelColor || this.actorTextColor;
|
487 | this.git0 = this.git0 || this.primaryColor;
|
488 | this.git1 = this.git1 || this.secondaryColor;
|
489 | this.git2 = this.git2 || this.tertiaryColor;
|
490 | this.git3 = this.git3 || adjust(this.primaryColor, { h: -30 });
|
491 | this.git4 = this.git4 || adjust(this.primaryColor, { h: -60 });
|
492 | this.git5 = this.git5 || adjust(this.primaryColor, { h: -90 });
|
493 | this.git6 = this.git6 || adjust(this.primaryColor, { h: 60 });
|
494 | this.git7 = this.git7 || adjust(this.primaryColor, { h: 120 });
|
495 | if (this.darkMode) {
|
496 | this.git0 = lighten(this.git0, 25);
|
497 | this.git1 = lighten(this.git1, 25);
|
498 | this.git2 = lighten(this.git2, 25);
|
499 | this.git3 = lighten(this.git3, 25);
|
500 | this.git4 = lighten(this.git4, 25);
|
501 | this.git5 = lighten(this.git5, 25);
|
502 | this.git6 = lighten(this.git6, 25);
|
503 | this.git7 = lighten(this.git7, 25);
|
504 | } else {
|
505 | this.git0 = darken(this.git0, 25);
|
506 | this.git1 = darken(this.git1, 25);
|
507 | this.git2 = darken(this.git2, 25);
|
508 | this.git3 = darken(this.git3, 25);
|
509 | this.git4 = darken(this.git4, 25);
|
510 | this.git5 = darken(this.git5, 25);
|
511 | this.git6 = darken(this.git6, 25);
|
512 | this.git7 = darken(this.git7, 25);
|
513 | }
|
514 | this.gitInv0 = this.gitInv0 || invert(this.git0);
|
515 | this.gitInv1 = this.gitInv1 || invert(this.git1);
|
516 | this.gitInv2 = this.gitInv2 || invert(this.git2);
|
517 | this.gitInv3 = this.gitInv3 || invert(this.git3);
|
518 | this.gitInv4 = this.gitInv4 || invert(this.git4);
|
519 | this.gitInv5 = this.gitInv5 || invert(this.git5);
|
520 | this.gitInv6 = this.gitInv6 || invert(this.git6);
|
521 | this.gitInv7 = this.gitInv7 || invert(this.git7);
|
522 | this.branchLabelColor = this.branchLabelColor || (this.darkMode ? "black" : this.labelTextColor);
|
523 | this.gitBranchLabel0 = this.gitBranchLabel0 || this.branchLabelColor;
|
524 | this.gitBranchLabel1 = this.gitBranchLabel1 || this.branchLabelColor;
|
525 | this.gitBranchLabel2 = this.gitBranchLabel2 || this.branchLabelColor;
|
526 | this.gitBranchLabel3 = this.gitBranchLabel3 || this.branchLabelColor;
|
527 | this.gitBranchLabel4 = this.gitBranchLabel4 || this.branchLabelColor;
|
528 | this.gitBranchLabel5 = this.gitBranchLabel5 || this.branchLabelColor;
|
529 | this.gitBranchLabel6 = this.gitBranchLabel6 || this.branchLabelColor;
|
530 | this.gitBranchLabel7 = this.gitBranchLabel7 || this.branchLabelColor;
|
531 | this.tagLabelColor = this.tagLabelColor || this.primaryTextColor;
|
532 | this.tagLabelBackground = this.tagLabelBackground || this.primaryColor;
|
533 | this.tagLabelBorder = this.tagBorder || this.primaryBorderColor;
|
534 | this.tagLabelFontSize = this.tagLabelFontSize || "10px";
|
535 | this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor;
|
536 | this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor;
|
537 | this.commitLabelFontSize = this.commitLabelFontSize || "10px";
|
538 | this.attributeBackgroundColorOdd = this.attributeBackgroundColorOdd || oldAttributeBackgroundColorOdd;
|
539 | this.attributeBackgroundColorEven = this.attributeBackgroundColorEven || oldAttributeBackgroundColorEven;
|
540 | }
|
541 | calculate(overrides) {
|
542 | if (typeof overrides !== "object") {
|
543 | this.updateColors();
|
544 | return;
|
545 | }
|
546 | const keys = Object.keys(overrides);
|
547 | keys.forEach((k) => {
|
548 | this[k] = overrides[k];
|
549 | });
|
550 | this.updateColors();
|
551 | keys.forEach((k) => {
|
552 | this[k] = overrides[k];
|
553 | });
|
554 | }
|
555 | };
|
556 | const getThemeVariables$4 = (userOverrides) => {
|
557 | const theme2 = new Theme$4();
|
558 | theme2.calculate(userOverrides);
|
559 | return theme2;
|
560 | };
|
561 | let Theme$3 = class Theme2 {
|
562 | constructor() {
|
563 | this.background = "#333";
|
564 | this.primaryColor = "#1f2020";
|
565 | this.secondaryColor = lighten(this.primaryColor, 16);
|
566 | this.tertiaryColor = adjust(this.primaryColor, { h: -160 });
|
567 | this.primaryBorderColor = invert(this.background);
|
568 | this.secondaryBorderColor = mkBorder(this.secondaryColor, this.darkMode);
|
569 | this.tertiaryBorderColor = mkBorder(this.tertiaryColor, this.darkMode);
|
570 | this.primaryTextColor = invert(this.primaryColor);
|
571 | this.secondaryTextColor = invert(this.secondaryColor);
|
572 | this.tertiaryTextColor = invert(this.tertiaryColor);
|
573 | this.lineColor = invert(this.background);
|
574 | this.textColor = invert(this.background);
|
575 | this.mainBkg = "#1f2020";
|
576 | this.secondBkg = "calculated";
|
577 | this.mainContrastColor = "lightgrey";
|
578 | this.darkTextColor = lighten(invert("#323D47"), 10);
|
579 | this.lineColor = "calculated";
|
580 | this.border1 = "#81B1DB";
|
581 | this.border2 = rgba(255, 255, 255, 0.25);
|
582 | this.arrowheadColor = "calculated";
|
583 | this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif';
|
584 | this.fontSize = "16px";
|
585 | this.labelBackground = "#181818";
|
586 | this.textColor = "#ccc";
|
587 | this.THEME_COLOR_LIMIT = 12;
|
588 | this.nodeBkg = "calculated";
|
589 | this.nodeBorder = "calculated";
|
590 | this.clusterBkg = "calculated";
|
591 | this.clusterBorder = "calculated";
|
592 | this.defaultLinkColor = "calculated";
|
593 | this.titleColor = "#F9FFFE";
|
594 | this.edgeLabelBackground = "calculated";
|
595 | this.actorBorder = "calculated";
|
596 | this.actorBkg = "calculated";
|
597 | this.actorTextColor = "calculated";
|
598 | this.actorLineColor = "calculated";
|
599 | this.signalColor = "calculated";
|
600 | this.signalTextColor = "calculated";
|
601 | this.labelBoxBkgColor = "calculated";
|
602 | this.labelBoxBorderColor = "calculated";
|
603 | this.labelTextColor = "calculated";
|
604 | this.loopTextColor = "calculated";
|
605 | this.noteBorderColor = "calculated";
|
606 | this.noteBkgColor = "#fff5ad";
|
607 | this.noteTextColor = "calculated";
|
608 | this.activationBorderColor = "calculated";
|
609 | this.activationBkgColor = "calculated";
|
610 | this.sequenceNumberColor = "black";
|
611 | this.sectionBkgColor = darken("#EAE8D9", 30);
|
612 | this.altSectionBkgColor = "calculated";
|
613 | this.sectionBkgColor2 = "#EAE8D9";
|
614 | this.excludeBkgColor = darken(this.sectionBkgColor, 10);
|
615 | this.taskBorderColor = rgba(255, 255, 255, 70);
|
616 | this.taskBkgColor = "calculated";
|
617 | this.taskTextColor = "calculated";
|
618 | this.taskTextLightColor = "calculated";
|
619 | this.taskTextOutsideColor = "calculated";
|
620 | this.taskTextClickableColor = "#003163";
|
621 | this.activeTaskBorderColor = rgba(255, 255, 255, 50);
|
622 | this.activeTaskBkgColor = "#81B1DB";
|
623 | this.gridColor = "calculated";
|
624 | this.doneTaskBkgColor = "calculated";
|
625 | this.doneTaskBorderColor = "grey";
|
626 | this.critBorderColor = "#E83737";
|
627 | this.critBkgColor = "#E83737";
|
628 | this.taskTextDarkColor = "calculated";
|
629 | this.todayLineColor = "#DB5757";
|
630 | this.personBorder = this.primaryBorderColor;
|
631 | this.personBkg = this.mainBkg;
|
632 | this.labelColor = "calculated";
|
633 | this.errorBkgColor = "#a44141";
|
634 | this.errorTextColor = "#ddd";
|
635 | }
|
636 | updateColors() {
|
637 | var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
638 | this.secondBkg = lighten(this.mainBkg, 16);
|
639 | this.lineColor = this.mainContrastColor;
|
640 | this.arrowheadColor = this.mainContrastColor;
|
641 | this.nodeBkg = this.mainBkg;
|
642 | this.nodeBorder = this.border1;
|
643 | this.clusterBkg = this.secondBkg;
|
644 | this.clusterBorder = this.border2;
|
645 | this.defaultLinkColor = this.lineColor;
|
646 | this.edgeLabelBackground = lighten(this.labelBackground, 25);
|
647 | this.actorBorder = this.border1;
|
648 | this.actorBkg = this.mainBkg;
|
649 | this.actorTextColor = this.mainContrastColor;
|
650 | this.actorLineColor = this.mainContrastColor;
|
651 | this.signalColor = this.mainContrastColor;
|
652 | this.signalTextColor = this.mainContrastColor;
|
653 | this.labelBoxBkgColor = this.actorBkg;
|
654 | this.labelBoxBorderColor = this.actorBorder;
|
655 | this.labelTextColor = this.mainContrastColor;
|
656 | this.loopTextColor = this.mainContrastColor;
|
657 | this.noteBorderColor = this.secondaryBorderColor;
|
658 | this.noteBkgColor = this.secondBkg;
|
659 | this.noteTextColor = this.secondaryTextColor;
|
660 | this.activationBorderColor = this.border1;
|
661 | this.activationBkgColor = this.secondBkg;
|
662 | this.altSectionBkgColor = this.background;
|
663 | this.taskBkgColor = lighten(this.mainBkg, 23);
|
664 | this.taskTextColor = this.darkTextColor;
|
665 | this.taskTextLightColor = this.mainContrastColor;
|
666 | this.taskTextOutsideColor = this.taskTextLightColor;
|
667 | this.gridColor = this.mainContrastColor;
|
668 | this.doneTaskBkgColor = this.mainContrastColor;
|
669 | this.taskTextDarkColor = this.darkTextColor;
|
670 | this.transitionColor = this.transitionColor || this.lineColor;
|
671 | this.transitionLabelColor = this.transitionLabelColor || this.textColor;
|
672 | this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor;
|
673 | this.stateBkg = this.stateBkg || this.mainBkg;
|
674 | this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg;
|
675 | this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor;
|
676 | this.altBackground = this.altBackground || "#555";
|
677 | this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg;
|
678 | this.compositeBorder = this.compositeBorder || this.nodeBorder;
|
679 | this.innerEndBackground = this.primaryBorderColor;
|
680 | this.specialStateColor = "#f4f4f4";
|
681 | this.errorBkgColor = this.errorBkgColor || this.tertiaryColor;
|
682 | this.errorTextColor = this.errorTextColor || this.tertiaryTextColor;
|
683 | this.fillType0 = this.primaryColor;
|
684 | this.fillType1 = this.secondaryColor;
|
685 | this.fillType2 = adjust(this.primaryColor, { h: 64 });
|
686 | this.fillType3 = adjust(this.secondaryColor, { h: 64 });
|
687 | this.fillType4 = adjust(this.primaryColor, { h: -64 });
|
688 | this.fillType5 = adjust(this.secondaryColor, { h: -64 });
|
689 | this.fillType6 = adjust(this.primaryColor, { h: 128 });
|
690 | this.fillType7 = adjust(this.secondaryColor, { h: 128 });
|
691 | this.cScale1 = this.cScale1 || "#0b0000";
|
692 | this.cScale2 = this.cScale2 || "#4d1037";
|
693 | this.cScale3 = this.cScale3 || "#3f5258";
|
694 | this.cScale4 = this.cScale4 || "#4f2f1b";
|
695 | this.cScale5 = this.cScale5 || "#6e0a0a";
|
696 | this.cScale6 = this.cScale6 || "#3b0048";
|
697 | this.cScale7 = this.cScale7 || "#995a01";
|
698 | this.cScale8 = this.cScale8 || "#154706";
|
699 | this.cScale9 = this.cScale9 || "#161722";
|
700 | this.cScale10 = this.cScale10 || "#00296f";
|
701 | this.cScale11 = this.cScale11 || "#01629c";
|
702 | this.cScale12 = this.cScale12 || "#010029";
|
703 | this.cScale0 = this.cScale0 || this.primaryColor;
|
704 | this.cScale1 = this.cScale1 || this.secondaryColor;
|
705 | this.cScale2 = this.cScale2 || this.tertiaryColor;
|
706 | this.cScale3 = this.cScale3 || adjust(this.primaryColor, { h: 30 });
|
707 | this.cScale4 = this.cScale4 || adjust(this.primaryColor, { h: 60 });
|
708 | this.cScale5 = this.cScale5 || adjust(this.primaryColor, { h: 90 });
|
709 | this.cScale6 = this.cScale6 || adjust(this.primaryColor, { h: 120 });
|
710 | this.cScale7 = this.cScale7 || adjust(this.primaryColor, { h: 150 });
|
711 | this.cScale8 = this.cScale8 || adjust(this.primaryColor, { h: 210 });
|
712 | this.cScale9 = this.cScale9 || adjust(this.primaryColor, { h: 270 });
|
713 | this.cScale10 = this.cScale10 || adjust(this.primaryColor, { h: 300 });
|
714 | this.cScale11 = this.cScale11 || adjust(this.primaryColor, { h: 330 });
|
715 | for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
|
716 | this["cScaleInv" + i] = this["cScaleInv" + i] || invert(this["cScale" + i]);
|
717 | }
|
718 | for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
|
719 | this["cScalePeer" + i] = this["cScalePeer" + i] || lighten(this["cScale" + i], 10);
|
720 | }
|
721 | for (let i = 0; i < 5; i++) {
|
722 | this["surface" + i] = this["surface" + i] || adjust(this.mainBkg, { h: 30, s: -30, l: -(-10 + i * 4) });
|
723 | this["surfacePeer" + i] = this["surfacePeer" + i] || adjust(this.mainBkg, { h: 30, s: -30, l: -(-7 + i * 4) });
|
724 | }
|
725 | this.scaleLabelColor = this.scaleLabelColor || (this.darkMode ? "black" : this.labelTextColor);
|
726 | for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
|
727 | this["cScaleLabel" + i] = this["cScaleLabel" + i] || this.scaleLabelColor;
|
728 | }
|
729 | for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
|
730 | this["pie" + i] = this["cScale" + i];
|
731 | }
|
732 | this.pieTitleTextSize = this.pieTitleTextSize || "25px";
|
733 | this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor;
|
734 | this.pieSectionTextSize = this.pieSectionTextSize || "17px";
|
735 | this.pieSectionTextColor = this.pieSectionTextColor || this.textColor;
|
736 | this.pieLegendTextSize = this.pieLegendTextSize || "17px";
|
737 | this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor;
|
738 | this.pieStrokeColor = this.pieStrokeColor || "black";
|
739 | this.pieStrokeWidth = this.pieStrokeWidth || "2px";
|
740 | this.pieOuterStrokeWidth = this.pieOuterStrokeWidth || "2px";
|
741 | this.pieOuterStrokeColor = this.pieOuterStrokeColor || "black";
|
742 | this.pieOpacity = this.pieOpacity || "0.7";
|
743 | this.quadrant1Fill = this.quadrant1Fill || this.primaryColor;
|
744 | this.quadrant2Fill = this.quadrant2Fill || adjust(this.primaryColor, { r: 5, g: 5, b: 5 });
|
745 | this.quadrant3Fill = this.quadrant3Fill || adjust(this.primaryColor, { r: 10, g: 10, b: 10 });
|
746 | this.quadrant4Fill = this.quadrant4Fill || adjust(this.primaryColor, { r: 15, g: 15, b: 15 });
|
747 | this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor;
|
748 | this.quadrant2TextFill = this.quadrant2TextFill || adjust(this.primaryTextColor, { r: -5, g: -5, b: -5 });
|
749 | this.quadrant3TextFill = this.quadrant3TextFill || adjust(this.primaryTextColor, { r: -10, g: -10, b: -10 });
|
750 | this.quadrant4TextFill = this.quadrant4TextFill || adjust(this.primaryTextColor, { r: -15, g: -15, b: -15 });
|
751 | this.quadrantPointFill = this.quadrantPointFill || isDark(this.quadrant1Fill) ? lighten(this.quadrant1Fill) : darken(this.quadrant1Fill);
|
752 | this.quadrantPointTextFill = this.quadrantPointTextFill || this.primaryTextColor;
|
753 | this.quadrantXAxisTextFill = this.quadrantXAxisTextFill || this.primaryTextColor;
|
754 | this.quadrantYAxisTextFill = this.quadrantYAxisTextFill || this.primaryTextColor;
|
755 | this.quadrantInternalBorderStrokeFill = this.quadrantInternalBorderStrokeFill || this.primaryBorderColor;
|
756 | this.quadrantExternalBorderStrokeFill = this.quadrantExternalBorderStrokeFill || this.primaryBorderColor;
|
757 | this.quadrantTitleFill = this.quadrantTitleFill || this.primaryTextColor;
|
758 | this.xyChart = {
|
759 | backgroundColor: ((_a = this.xyChart) == null ? void 0 : _a.backgroundColor) || this.background,
|
760 | titleColor: ((_b = this.xyChart) == null ? void 0 : _b.titleColor) || this.primaryTextColor,
|
761 | xAxisTitleColor: ((_c = this.xyChart) == null ? void 0 : _c.xAxisTitleColor) || this.primaryTextColor,
|
762 | xAxisLabelColor: ((_d = this.xyChart) == null ? void 0 : _d.xAxisLabelColor) || this.primaryTextColor,
|
763 | xAxisTickColor: ((_e = this.xyChart) == null ? void 0 : _e.xAxisTickColor) || this.primaryTextColor,
|
764 | xAxisLineColor: ((_f = this.xyChart) == null ? void 0 : _f.xAxisLineColor) || this.primaryTextColor,
|
765 | yAxisTitleColor: ((_g = this.xyChart) == null ? void 0 : _g.yAxisTitleColor) || this.primaryTextColor,
|
766 | yAxisLabelColor: ((_h = this.xyChart) == null ? void 0 : _h.yAxisLabelColor) || this.primaryTextColor,
|
767 | yAxisTickColor: ((_i = this.xyChart) == null ? void 0 : _i.yAxisTickColor) || this.primaryTextColor,
|
768 | yAxisLineColor: ((_j = this.xyChart) == null ? void 0 : _j.yAxisLineColor) || this.primaryTextColor,
|
769 | plotColorPalette: ((_k = this.xyChart) == null ? void 0 : _k.plotColorPalette) || "#3498db,#2ecc71,#e74c3c,#f1c40f,#bdc3c7,#ffffff,#34495e,#9b59b6,#1abc9c,#e67e22"
|
770 | };
|
771 | this.classText = this.primaryTextColor;
|
772 | this.requirementBackground = this.requirementBackground || this.primaryColor;
|
773 | this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor;
|
774 | this.requirementBorderSize = this.requirementBorderSize || "1";
|
775 | this.requirementTextColor = this.requirementTextColor || this.primaryTextColor;
|
776 | this.relationColor = this.relationColor || this.lineColor;
|
777 | this.relationLabelBackground = this.relationLabelBackground || (this.darkMode ? darken(this.secondaryColor, 30) : this.secondaryColor);
|
778 | this.relationLabelColor = this.relationLabelColor || this.actorTextColor;
|
779 | this.git0 = lighten(this.secondaryColor, 20);
|
780 | this.git1 = lighten(this.pie2 || this.secondaryColor, 20);
|
781 | this.git2 = lighten(this.pie3 || this.tertiaryColor, 20);
|
782 | this.git3 = lighten(this.pie4 || adjust(this.primaryColor, { h: -30 }), 20);
|
783 | this.git4 = lighten(this.pie5 || adjust(this.primaryColor, { h: -60 }), 20);
|
784 | this.git5 = lighten(this.pie6 || adjust(this.primaryColor, { h: -90 }), 10);
|
785 | this.git6 = lighten(this.pie7 || adjust(this.primaryColor, { h: 60 }), 10);
|
786 | this.git7 = lighten(this.pie8 || adjust(this.primaryColor, { h: 120 }), 20);
|
787 | this.gitInv0 = this.gitInv0 || invert(this.git0);
|
788 | this.gitInv1 = this.gitInv1 || invert(this.git1);
|
789 | this.gitInv2 = this.gitInv2 || invert(this.git2);
|
790 | this.gitInv3 = this.gitInv3 || invert(this.git3);
|
791 | this.gitInv4 = this.gitInv4 || invert(this.git4);
|
792 | this.gitInv5 = this.gitInv5 || invert(this.git5);
|
793 | this.gitInv6 = this.gitInv6 || invert(this.git6);
|
794 | this.gitInv7 = this.gitInv7 || invert(this.git7);
|
795 | this.gitBranchLabel0 = this.gitBranchLabel0 || invert(this.labelTextColor);
|
796 | this.gitBranchLabel1 = this.gitBranchLabel1 || this.labelTextColor;
|
797 | this.gitBranchLabel2 = this.gitBranchLabel2 || this.labelTextColor;
|
798 | this.gitBranchLabel3 = this.gitBranchLabel3 || invert(this.labelTextColor);
|
799 | this.gitBranchLabel4 = this.gitBranchLabel4 || this.labelTextColor;
|
800 | this.gitBranchLabel5 = this.gitBranchLabel5 || this.labelTextColor;
|
801 | this.gitBranchLabel6 = this.gitBranchLabel6 || this.labelTextColor;
|
802 | this.gitBranchLabel7 = this.gitBranchLabel7 || this.labelTextColor;
|
803 | this.tagLabelColor = this.tagLabelColor || this.primaryTextColor;
|
804 | this.tagLabelBackground = this.tagLabelBackground || this.primaryColor;
|
805 | this.tagLabelBorder = this.tagBorder || this.primaryBorderColor;
|
806 | this.tagLabelFontSize = this.tagLabelFontSize || "10px";
|
807 | this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor;
|
808 | this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor;
|
809 | this.commitLabelFontSize = this.commitLabelFontSize || "10px";
|
810 | this.attributeBackgroundColorOdd = this.attributeBackgroundColorOdd || lighten(this.background, 12);
|
811 | this.attributeBackgroundColorEven = this.attributeBackgroundColorEven || lighten(this.background, 2);
|
812 | }
|
813 | calculate(overrides) {
|
814 | if (typeof overrides !== "object") {
|
815 | this.updateColors();
|
816 | return;
|
817 | }
|
818 | const keys = Object.keys(overrides);
|
819 | keys.forEach((k) => {
|
820 | this[k] = overrides[k];
|
821 | });
|
822 | this.updateColors();
|
823 | keys.forEach((k) => {
|
824 | this[k] = overrides[k];
|
825 | });
|
826 | }
|
827 | };
|
828 | const getThemeVariables$3 = (userOverrides) => {
|
829 | const theme2 = new Theme$3();
|
830 | theme2.calculate(userOverrides);
|
831 | return theme2;
|
832 | };
|
833 | let Theme$2 = class Theme3 {
|
834 | constructor() {
|
835 | this.background = "#f4f4f4";
|
836 | this.primaryColor = "#ECECFF";
|
837 | this.secondaryColor = adjust(this.primaryColor, { h: 120 });
|
838 | this.secondaryColor = "#ffffde";
|
839 | this.tertiaryColor = adjust(this.primaryColor, { h: -160 });
|
840 | this.primaryBorderColor = mkBorder(this.primaryColor, this.darkMode);
|
841 | this.secondaryBorderColor = mkBorder(this.secondaryColor, this.darkMode);
|
842 | this.tertiaryBorderColor = mkBorder(this.tertiaryColor, this.darkMode);
|
843 | this.primaryTextColor = invert(this.primaryColor);
|
844 | this.secondaryTextColor = invert(this.secondaryColor);
|
845 | this.tertiaryTextColor = invert(this.tertiaryColor);
|
846 | this.lineColor = invert(this.background);
|
847 | this.textColor = invert(this.background);
|
848 | this.background = "white";
|
849 | this.mainBkg = "#ECECFF";
|
850 | this.secondBkg = "#ffffde";
|
851 | this.lineColor = "#333333";
|
852 | this.border1 = "#9370DB";
|
853 | this.border2 = "#aaaa33";
|
854 | this.arrowheadColor = "#333333";
|
855 | this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif';
|
856 | this.fontSize = "16px";
|
857 | this.labelBackground = "#e8e8e8";
|
858 | this.textColor = "#333";
|
859 | this.THEME_COLOR_LIMIT = 12;
|
860 | this.nodeBkg = "calculated";
|
861 | this.nodeBorder = "calculated";
|
862 | this.clusterBkg = "calculated";
|
863 | this.clusterBorder = "calculated";
|
864 | this.defaultLinkColor = "calculated";
|
865 | this.titleColor = "calculated";
|
866 | this.edgeLabelBackground = "calculated";
|
867 | this.actorBorder = "calculated";
|
868 | this.actorBkg = "calculated";
|
869 | this.actorTextColor = "black";
|
870 | this.actorLineColor = "grey";
|
871 | this.signalColor = "calculated";
|
872 | this.signalTextColor = "calculated";
|
873 | this.labelBoxBkgColor = "calculated";
|
874 | this.labelBoxBorderColor = "calculated";
|
875 | this.labelTextColor = "calculated";
|
876 | this.loopTextColor = "calculated";
|
877 | this.noteBorderColor = "calculated";
|
878 | this.noteBkgColor = "#fff5ad";
|
879 | this.noteTextColor = "calculated";
|
880 | this.activationBorderColor = "#666";
|
881 | this.activationBkgColor = "#f4f4f4";
|
882 | this.sequenceNumberColor = "white";
|
883 | this.sectionBkgColor = "calculated";
|
884 | this.altSectionBkgColor = "calculated";
|
885 | this.sectionBkgColor2 = "calculated";
|
886 | this.excludeBkgColor = "#eeeeee";
|
887 | this.taskBorderColor = "calculated";
|
888 | this.taskBkgColor = "calculated";
|
889 | this.taskTextLightColor = "calculated";
|
890 | this.taskTextColor = this.taskTextLightColor;
|
891 | this.taskTextDarkColor = "calculated";
|
892 | this.taskTextOutsideColor = this.taskTextDarkColor;
|
893 | this.taskTextClickableColor = "calculated";
|
894 | this.activeTaskBorderColor = "calculated";
|
895 | this.activeTaskBkgColor = "calculated";
|
896 | this.gridColor = "calculated";
|
897 | this.doneTaskBkgColor = "calculated";
|
898 | this.doneTaskBorderColor = "calculated";
|
899 | this.critBorderColor = "calculated";
|
900 | this.critBkgColor = "calculated";
|
901 | this.todayLineColor = "calculated";
|
902 | this.sectionBkgColor = rgba(102, 102, 255, 0.49);
|
903 | this.altSectionBkgColor = "white";
|
904 | this.sectionBkgColor2 = "#fff400";
|
905 | this.taskBorderColor = "#534fbc";
|
906 | this.taskBkgColor = "#8a90dd";
|
907 | this.taskTextLightColor = "white";
|
908 | this.taskTextColor = "calculated";
|
909 | this.taskTextDarkColor = "black";
|
910 | this.taskTextOutsideColor = "calculated";
|
911 | this.taskTextClickableColor = "#003163";
|
912 | this.activeTaskBorderColor = "#534fbc";
|
913 | this.activeTaskBkgColor = "#bfc7ff";
|
914 | this.gridColor = "lightgrey";
|
915 | this.doneTaskBkgColor = "lightgrey";
|
916 | this.doneTaskBorderColor = "grey";
|
917 | this.critBorderColor = "#ff8888";
|
918 | this.critBkgColor = "red";
|
919 | this.todayLineColor = "red";
|
920 | this.personBorder = this.primaryBorderColor;
|
921 | this.personBkg = this.mainBkg;
|
922 | this.labelColor = "black";
|
923 | this.errorBkgColor = "#552222";
|
924 | this.errorTextColor = "#552222";
|
925 | this.updateColors();
|
926 | }
|
927 | updateColors() {
|
928 | var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
929 | this.cScale0 = this.cScale0 || this.primaryColor;
|
930 | this.cScale1 = this.cScale1 || this.secondaryColor;
|
931 | this.cScale2 = this.cScale2 || this.tertiaryColor;
|
932 | this.cScale3 = this.cScale3 || adjust(this.primaryColor, { h: 30 });
|
933 | this.cScale4 = this.cScale4 || adjust(this.primaryColor, { h: 60 });
|
934 | this.cScale5 = this.cScale5 || adjust(this.primaryColor, { h: 90 });
|
935 | this.cScale6 = this.cScale6 || adjust(this.primaryColor, { h: 120 });
|
936 | this.cScale7 = this.cScale7 || adjust(this.primaryColor, { h: 150 });
|
937 | this.cScale8 = this.cScale8 || adjust(this.primaryColor, { h: 210 });
|
938 | this.cScale9 = this.cScale9 || adjust(this.primaryColor, { h: 270 });
|
939 | this.cScale10 = this.cScale10 || adjust(this.primaryColor, { h: 300 });
|
940 | this.cScale11 = this.cScale11 || adjust(this.primaryColor, { h: 330 });
|
941 | this["cScalePeer1"] = this["cScalePeer1"] || darken(this.secondaryColor, 45);
|
942 | this["cScalePeer2"] = this["cScalePeer2"] || darken(this.tertiaryColor, 40);
|
943 | for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
|
944 | this["cScale" + i] = darken(this["cScale" + i], 10);
|
945 | this["cScalePeer" + i] = this["cScalePeer" + i] || darken(this["cScale" + i], 25);
|
946 | }
|
947 | for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
|
948 | this["cScaleInv" + i] = this["cScaleInv" + i] || adjust(this["cScale" + i], { h: 180 });
|
949 | }
|
950 | for (let i = 0; i < 5; i++) {
|
951 | this["surface" + i] = this["surface" + i] || adjust(this.mainBkg, { h: 30, l: -(5 + i * 5) });
|
952 | this["surfacePeer" + i] = this["surfacePeer" + i] || adjust(this.mainBkg, { h: 30, l: -(7 + i * 5) });
|
953 | }
|
954 | this.scaleLabelColor = this.scaleLabelColor !== "calculated" && this.scaleLabelColor ? this.scaleLabelColor : this.labelTextColor;
|
955 | if (this.labelTextColor !== "calculated") {
|
956 | this.cScaleLabel0 = this.cScaleLabel0 || invert(this.labelTextColor);
|
957 | this.cScaleLabel3 = this.cScaleLabel3 || invert(this.labelTextColor);
|
958 | for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
|
959 | this["cScaleLabel" + i] = this["cScaleLabel" + i] || this.labelTextColor;
|
960 | }
|
961 | }
|
962 | this.nodeBkg = this.mainBkg;
|
963 | this.nodeBorder = this.border1;
|
964 | this.clusterBkg = this.secondBkg;
|
965 | this.clusterBorder = this.border2;
|
966 | this.defaultLinkColor = this.lineColor;
|
967 | this.titleColor = this.textColor;
|
968 | this.edgeLabelBackground = this.labelBackground;
|
969 | this.actorBorder = lighten(this.border1, 23);
|
970 | this.actorBkg = this.mainBkg;
|
971 | this.labelBoxBkgColor = this.actorBkg;
|
972 | this.signalColor = this.textColor;
|
973 | this.signalTextColor = this.textColor;
|
974 | this.labelBoxBorderColor = this.actorBorder;
|
975 | this.labelTextColor = this.actorTextColor;
|
976 | this.loopTextColor = this.actorTextColor;
|
977 | this.noteBorderColor = this.border2;
|
978 | this.noteTextColor = this.actorTextColor;
|
979 | this.taskTextColor = this.taskTextLightColor;
|
980 | this.taskTextOutsideColor = this.taskTextDarkColor;
|
981 | this.transitionColor = this.transitionColor || this.lineColor;
|
982 | this.transitionLabelColor = this.transitionLabelColor || this.textColor;
|
983 | this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor;
|
984 | this.stateBkg = this.stateBkg || this.mainBkg;
|
985 | this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg;
|
986 | this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor;
|
987 | this.altBackground = this.altBackground || "#f0f0f0";
|
988 | this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg;
|
989 | this.compositeBorder = this.compositeBorder || this.nodeBorder;
|
990 | this.innerEndBackground = this.nodeBorder;
|
991 | this.specialStateColor = this.lineColor;
|
992 | this.errorBkgColor = this.errorBkgColor || this.tertiaryColor;
|
993 | this.errorTextColor = this.errorTextColor || this.tertiaryTextColor;
|
994 | this.transitionColor = this.transitionColor || this.lineColor;
|
995 | this.classText = this.primaryTextColor;
|
996 | this.fillType0 = this.primaryColor;
|
997 | this.fillType1 = this.secondaryColor;
|
998 | this.fillType2 = adjust(this.primaryColor, { h: 64 });
|
999 | this.fillType3 = adjust(this.secondaryColor, { h: 64 });
|
1000 | this.fillType4 = adjust(this.primaryColor, { h: -64 });
|
1001 | this.fillType5 = adjust(this.secondaryColor, { h: -64 });
|
1002 | this.fillType6 = adjust(this.primaryColor, { h: 128 });
|
1003 | this.fillType7 = adjust(this.secondaryColor, { h: 128 });
|
1004 | this.pie1 = this.pie1 || this.primaryColor;
|
1005 | this.pie2 = this.pie2 || this.secondaryColor;
|
1006 | this.pie3 = this.pie3 || adjust(this.tertiaryColor, { l: -40 });
|
1007 | this.pie4 = this.pie4 || adjust(this.primaryColor, { l: -10 });
|
1008 | this.pie5 = this.pie5 || adjust(this.secondaryColor, { l: -30 });
|
1009 | this.pie6 = this.pie6 || adjust(this.tertiaryColor, { l: -20 });
|
1010 | this.pie7 = this.pie7 || adjust(this.primaryColor, { h: 60, l: -20 });
|
1011 | this.pie8 = this.pie8 || adjust(this.primaryColor, { h: -60, l: -40 });
|
1012 | this.pie9 = this.pie9 || adjust(this.primaryColor, { h: 120, l: -40 });
|
1013 | this.pie10 = this.pie10 || adjust(this.primaryColor, { h: 60, l: -40 });
|
1014 | this.pie11 = this.pie11 || adjust(this.primaryColor, { h: -90, l: -40 });
|
1015 | this.pie12 = this.pie12 || adjust(this.primaryColor, { h: 120, l: -30 });
|
1016 | this.pieTitleTextSize = this.pieTitleTextSize || "25px";
|
1017 | this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor;
|
1018 | this.pieSectionTextSize = this.pieSectionTextSize || "17px";
|
1019 | this.pieSectionTextColor = this.pieSectionTextColor || this.textColor;
|
1020 | this.pieLegendTextSize = this.pieLegendTextSize || "17px";
|
1021 | this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor;
|
1022 | this.pieStrokeColor = this.pieStrokeColor || "black";
|
1023 | this.pieStrokeWidth = this.pieStrokeWidth || "2px";
|
1024 | this.pieOuterStrokeWidth = this.pieOuterStrokeWidth || "2px";
|
1025 | this.pieOuterStrokeColor = this.pieOuterStrokeColor || "black";
|
1026 | this.pieOpacity = this.pieOpacity || "0.7";
|
1027 | this.quadrant1Fill = this.quadrant1Fill || this.primaryColor;
|
1028 | this.quadrant2Fill = this.quadrant2Fill || adjust(this.primaryColor, { r: 5, g: 5, b: 5 });
|
1029 | this.quadrant3Fill = this.quadrant3Fill || adjust(this.primaryColor, { r: 10, g: 10, b: 10 });
|
1030 | this.quadrant4Fill = this.quadrant4Fill || adjust(this.primaryColor, { r: 15, g: 15, b: 15 });
|
1031 | this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor;
|
1032 | this.quadrant2TextFill = this.quadrant2TextFill || adjust(this.primaryTextColor, { r: -5, g: -5, b: -5 });
|
1033 | this.quadrant3TextFill = this.quadrant3TextFill || adjust(this.primaryTextColor, { r: -10, g: -10, b: -10 });
|
1034 | this.quadrant4TextFill = this.quadrant4TextFill || adjust(this.primaryTextColor, { r: -15, g: -15, b: -15 });
|
1035 | this.quadrantPointFill = this.quadrantPointFill || isDark(this.quadrant1Fill) ? lighten(this.quadrant1Fill) : darken(this.quadrant1Fill);
|
1036 | this.quadrantPointTextFill = this.quadrantPointTextFill || this.primaryTextColor;
|
1037 | this.quadrantXAxisTextFill = this.quadrantXAxisTextFill || this.primaryTextColor;
|
1038 | this.quadrantYAxisTextFill = this.quadrantYAxisTextFill || this.primaryTextColor;
|
1039 | this.quadrantInternalBorderStrokeFill = this.quadrantInternalBorderStrokeFill || this.primaryBorderColor;
|
1040 | this.quadrantExternalBorderStrokeFill = this.quadrantExternalBorderStrokeFill || this.primaryBorderColor;
|
1041 | this.quadrantTitleFill = this.quadrantTitleFill || this.primaryTextColor;
|
1042 | this.xyChart = {
|
1043 | backgroundColor: ((_a = this.xyChart) == null ? void 0 : _a.backgroundColor) || this.background,
|
1044 | titleColor: ((_b = this.xyChart) == null ? void 0 : _b.titleColor) || this.primaryTextColor,
|
1045 | xAxisTitleColor: ((_c = this.xyChart) == null ? void 0 : _c.xAxisTitleColor) || this.primaryTextColor,
|
1046 | xAxisLabelColor: ((_d = this.xyChart) == null ? void 0 : _d.xAxisLabelColor) || this.primaryTextColor,
|
1047 | xAxisTickColor: ((_e = this.xyChart) == null ? void 0 : _e.xAxisTickColor) || this.primaryTextColor,
|
1048 | xAxisLineColor: ((_f = this.xyChart) == null ? void 0 : _f.xAxisLineColor) || this.primaryTextColor,
|
1049 | yAxisTitleColor: ((_g = this.xyChart) == null ? void 0 : _g.yAxisTitleColor) || this.primaryTextColor,
|
1050 | yAxisLabelColor: ((_h = this.xyChart) == null ? void 0 : _h.yAxisLabelColor) || this.primaryTextColor,
|
1051 | yAxisTickColor: ((_i = this.xyChart) == null ? void 0 : _i.yAxisTickColor) || this.primaryTextColor,
|
1052 | yAxisLineColor: ((_j = this.xyChart) == null ? void 0 : _j.yAxisLineColor) || this.primaryTextColor,
|
1053 | plotColorPalette: ((_k = this.xyChart) == null ? void 0 : _k.plotColorPalette) || "#ECECFF,#8493A6,#FFC3A0,#DCDDE1,#B8E994,#D1A36F,#C3CDE6,#FFB6C1,#496078,#F8F3E3"
|
1054 | };
|
1055 | this.requirementBackground = this.requirementBackground || this.primaryColor;
|
1056 | this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor;
|
1057 | this.requirementBorderSize = this.requirementBorderSize || "1";
|
1058 | this.requirementTextColor = this.requirementTextColor || this.primaryTextColor;
|
1059 | this.relationColor = this.relationColor || this.lineColor;
|
1060 | this.relationLabelBackground = this.relationLabelBackground || this.labelBackground;
|
1061 | this.relationLabelColor = this.relationLabelColor || this.actorTextColor;
|
1062 | this.git0 = this.git0 || this.primaryColor;
|
1063 | this.git1 = this.git1 || this.secondaryColor;
|
1064 | this.git2 = this.git2 || this.tertiaryColor;
|
1065 | this.git3 = this.git3 || adjust(this.primaryColor, { h: -30 });
|
1066 | this.git4 = this.git4 || adjust(this.primaryColor, { h: -60 });
|
1067 | this.git5 = this.git5 || adjust(this.primaryColor, { h: -90 });
|
1068 | this.git6 = this.git6 || adjust(this.primaryColor, { h: 60 });
|
1069 | this.git7 = this.git7 || adjust(this.primaryColor, { h: 120 });
|
1070 | if (this.darkMode) {
|
1071 | this.git0 = lighten(this.git0, 25);
|
1072 | this.git1 = lighten(this.git1, 25);
|
1073 | this.git2 = lighten(this.git2, 25);
|
1074 | this.git3 = lighten(this.git3, 25);
|
1075 | this.git4 = lighten(this.git4, 25);
|
1076 | this.git5 = lighten(this.git5, 25);
|
1077 | this.git6 = lighten(this.git6, 25);
|
1078 | this.git7 = lighten(this.git7, 25);
|
1079 | } else {
|
1080 | this.git0 = darken(this.git0, 25);
|
1081 | this.git1 = darken(this.git1, 25);
|
1082 | this.git2 = darken(this.git2, 25);
|
1083 | this.git3 = darken(this.git3, 25);
|
1084 | this.git4 = darken(this.git4, 25);
|
1085 | this.git5 = darken(this.git5, 25);
|
1086 | this.git6 = darken(this.git6, 25);
|
1087 | this.git7 = darken(this.git7, 25);
|
1088 | }
|
1089 | this.gitInv0 = this.gitInv0 || darken(invert(this.git0), 25);
|
1090 | this.gitInv1 = this.gitInv1 || invert(this.git1);
|
1091 | this.gitInv2 = this.gitInv2 || invert(this.git2);
|
1092 | this.gitInv3 = this.gitInv3 || invert(this.git3);
|
1093 | this.gitInv4 = this.gitInv4 || invert(this.git4);
|
1094 | this.gitInv5 = this.gitInv5 || invert(this.git5);
|
1095 | this.gitInv6 = this.gitInv6 || invert(this.git6);
|
1096 | this.gitInv7 = this.gitInv7 || invert(this.git7);
|
1097 | this.gitBranchLabel0 = this.gitBranchLabel0 || invert(this.labelTextColor);
|
1098 | this.gitBranchLabel1 = this.gitBranchLabel1 || this.labelTextColor;
|
1099 | this.gitBranchLabel2 = this.gitBranchLabel2 || this.labelTextColor;
|
1100 | this.gitBranchLabel3 = this.gitBranchLabel3 || invert(this.labelTextColor);
|
1101 | this.gitBranchLabel4 = this.gitBranchLabel4 || this.labelTextColor;
|
1102 | this.gitBranchLabel5 = this.gitBranchLabel5 || this.labelTextColor;
|
1103 | this.gitBranchLabel6 = this.gitBranchLabel6 || this.labelTextColor;
|
1104 | this.gitBranchLabel7 = this.gitBranchLabel7 || this.labelTextColor;
|
1105 | this.tagLabelColor = this.tagLabelColor || this.primaryTextColor;
|
1106 | this.tagLabelBackground = this.tagLabelBackground || this.primaryColor;
|
1107 | this.tagLabelBorder = this.tagBorder || this.primaryBorderColor;
|
1108 | this.tagLabelFontSize = this.tagLabelFontSize || "10px";
|
1109 | this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor;
|
1110 | this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor;
|
1111 | this.commitLabelFontSize = this.commitLabelFontSize || "10px";
|
1112 | this.attributeBackgroundColorOdd = this.attributeBackgroundColorOdd || oldAttributeBackgroundColorOdd;
|
1113 | this.attributeBackgroundColorEven = this.attributeBackgroundColorEven || oldAttributeBackgroundColorEven;
|
1114 | }
|
1115 | calculate(overrides) {
|
1116 | if (typeof overrides !== "object") {
|
1117 | this.updateColors();
|
1118 | return;
|
1119 | }
|
1120 | const keys = Object.keys(overrides);
|
1121 | keys.forEach((k) => {
|
1122 | this[k] = overrides[k];
|
1123 | });
|
1124 | this.updateColors();
|
1125 | keys.forEach((k) => {
|
1126 | this[k] = overrides[k];
|
1127 | });
|
1128 | }
|
1129 | };
|
1130 | const getThemeVariables$2 = (userOverrides) => {
|
1131 | const theme2 = new Theme$2();
|
1132 | theme2.calculate(userOverrides);
|
1133 | return theme2;
|
1134 | };
|
1135 | let Theme$1 = class Theme4 {
|
1136 | constructor() {
|
1137 | this.background = "#f4f4f4";
|
1138 | this.primaryColor = "#cde498";
|
1139 | this.secondaryColor = "#cdffb2";
|
1140 | this.background = "white";
|
1141 | this.mainBkg = "#cde498";
|
1142 | this.secondBkg = "#cdffb2";
|
1143 | this.lineColor = "green";
|
1144 | this.border1 = "#13540c";
|
1145 | this.border2 = "#6eaa49";
|
1146 | this.arrowheadColor = "green";
|
1147 | this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif';
|
1148 | this.fontSize = "16px";
|
1149 | this.tertiaryColor = lighten("#cde498", 10);
|
1150 | this.primaryBorderColor = mkBorder(this.primaryColor, this.darkMode);
|
1151 | this.secondaryBorderColor = mkBorder(this.secondaryColor, this.darkMode);
|
1152 | this.tertiaryBorderColor = mkBorder(this.tertiaryColor, this.darkMode);
|
1153 | this.primaryTextColor = invert(this.primaryColor);
|
1154 | this.secondaryTextColor = invert(this.secondaryColor);
|
1155 | this.tertiaryTextColor = invert(this.primaryColor);
|
1156 | this.lineColor = invert(this.background);
|
1157 | this.textColor = invert(this.background);
|
1158 | this.THEME_COLOR_LIMIT = 12;
|
1159 | this.nodeBkg = "calculated";
|
1160 | this.nodeBorder = "calculated";
|
1161 | this.clusterBkg = "calculated";
|
1162 | this.clusterBorder = "calculated";
|
1163 | this.defaultLinkColor = "calculated";
|
1164 | this.titleColor = "#333";
|
1165 | this.edgeLabelBackground = "#e8e8e8";
|
1166 | this.actorBorder = "calculated";
|
1167 | this.actorBkg = "calculated";
|
1168 | this.actorTextColor = "black";
|
1169 | this.actorLineColor = "grey";
|
1170 | this.signalColor = "#333";
|
1171 | this.signalTextColor = "#333";
|
1172 | this.labelBoxBkgColor = "calculated";
|
1173 | this.labelBoxBorderColor = "#326932";
|
1174 | this.labelTextColor = "calculated";
|
1175 | this.loopTextColor = "calculated";
|
1176 | this.noteBorderColor = "calculated";
|
1177 | this.noteBkgColor = "#fff5ad";
|
1178 | this.noteTextColor = "calculated";
|
1179 | this.activationBorderColor = "#666";
|
1180 | this.activationBkgColor = "#f4f4f4";
|
1181 | this.sequenceNumberColor = "white";
|
1182 | this.sectionBkgColor = "#6eaa49";
|
1183 | this.altSectionBkgColor = "white";
|
1184 | this.sectionBkgColor2 = "#6eaa49";
|
1185 | this.excludeBkgColor = "#eeeeee";
|
1186 | this.taskBorderColor = "calculated";
|
1187 | this.taskBkgColor = "#487e3a";
|
1188 | this.taskTextLightColor = "white";
|
1189 | this.taskTextColor = "calculated";
|
1190 | this.taskTextDarkColor = "black";
|
1191 | this.taskTextOutsideColor = "calculated";
|
1192 | this.taskTextClickableColor = "#003163";
|
1193 | this.activeTaskBorderColor = "calculated";
|
1194 | this.activeTaskBkgColor = "calculated";
|
1195 | this.gridColor = "lightgrey";
|
1196 | this.doneTaskBkgColor = "lightgrey";
|
1197 | this.doneTaskBorderColor = "grey";
|
1198 | this.critBorderColor = "#ff8888";
|
1199 | this.critBkgColor = "red";
|
1200 | this.todayLineColor = "red";
|
1201 | this.personBorder = this.primaryBorderColor;
|
1202 | this.personBkg = this.mainBkg;
|
1203 | this.labelColor = "black";
|
1204 | this.errorBkgColor = "#552222";
|
1205 | this.errorTextColor = "#552222";
|
1206 | }
|
1207 | updateColors() {
|
1208 | var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
1209 | this.actorBorder = darken(this.mainBkg, 20);
|
1210 | this.actorBkg = this.mainBkg;
|
1211 | this.labelBoxBkgColor = this.actorBkg;
|
1212 | this.labelTextColor = this.actorTextColor;
|
1213 | this.loopTextColor = this.actorTextColor;
|
1214 | this.noteBorderColor = this.border2;
|
1215 | this.noteTextColor = this.actorTextColor;
|
1216 | this.cScale0 = this.cScale0 || this.primaryColor;
|
1217 | this.cScale1 = this.cScale1 || this.secondaryColor;
|
1218 | this.cScale2 = this.cScale2 || this.tertiaryColor;
|
1219 | this.cScale3 = this.cScale3 || adjust(this.primaryColor, { h: 30 });
|
1220 | this.cScale4 = this.cScale4 || adjust(this.primaryColor, { h: 60 });
|
1221 | this.cScale5 = this.cScale5 || adjust(this.primaryColor, { h: 90 });
|
1222 | this.cScale6 = this.cScale6 || adjust(this.primaryColor, { h: 120 });
|
1223 | this.cScale7 = this.cScale7 || adjust(this.primaryColor, { h: 150 });
|
1224 | this.cScale8 = this.cScale8 || adjust(this.primaryColor, { h: 210 });
|
1225 | this.cScale9 = this.cScale9 || adjust(this.primaryColor, { h: 270 });
|
1226 | this.cScale10 = this.cScale10 || adjust(this.primaryColor, { h: 300 });
|
1227 | this.cScale11 = this.cScale11 || adjust(this.primaryColor, { h: 330 });
|
1228 | this["cScalePeer1"] = this["cScalePeer1"] || darken(this.secondaryColor, 45);
|
1229 | this["cScalePeer2"] = this["cScalePeer2"] || darken(this.tertiaryColor, 40);
|
1230 | for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
|
1231 | this["cScale" + i] = darken(this["cScale" + i], 10);
|
1232 | this["cScalePeer" + i] = this["cScalePeer" + i] || darken(this["cScale" + i], 25);
|
1233 | }
|
1234 | for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
|
1235 | this["cScaleInv" + i] = this["cScaleInv" + i] || adjust(this["cScale" + i], { h: 180 });
|
1236 | }
|
1237 | this.scaleLabelColor = this.scaleLabelColor !== "calculated" && this.scaleLabelColor ? this.scaleLabelColor : this.labelTextColor;
|
1238 | for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
|
1239 | this["cScaleLabel" + i] = this["cScaleLabel" + i] || this.scaleLabelColor;
|
1240 | }
|
1241 | for (let i = 0; i < 5; i++) {
|
1242 | this["surface" + i] = this["surface" + i] || adjust(this.mainBkg, { h: 30, s: -30, l: -(5 + i * 5) });
|
1243 | this["surfacePeer" + i] = this["surfacePeer" + i] || adjust(this.mainBkg, { h: 30, s: -30, l: -(8 + i * 5) });
|
1244 | }
|
1245 | this.nodeBkg = this.mainBkg;
|
1246 | this.nodeBorder = this.border1;
|
1247 | this.clusterBkg = this.secondBkg;
|
1248 | this.clusterBorder = this.border2;
|
1249 | this.defaultLinkColor = this.lineColor;
|
1250 | this.taskBorderColor = this.border1;
|
1251 | this.taskTextColor = this.taskTextLightColor;
|
1252 | this.taskTextOutsideColor = this.taskTextDarkColor;
|
1253 | this.activeTaskBorderColor = this.taskBorderColor;
|
1254 | this.activeTaskBkgColor = this.mainBkg;
|
1255 | this.transitionColor = this.transitionColor || this.lineColor;
|
1256 | this.transitionLabelColor = this.transitionLabelColor || this.textColor;
|
1257 | this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor;
|
1258 | this.stateBkg = this.stateBkg || this.mainBkg;
|
1259 | this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg;
|
1260 | this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor;
|
1261 | this.altBackground = this.altBackground || "#f0f0f0";
|
1262 | this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg;
|
1263 | this.compositeBorder = this.compositeBorder || this.nodeBorder;
|
1264 | this.innerEndBackground = this.primaryBorderColor;
|
1265 | this.specialStateColor = this.lineColor;
|
1266 | this.errorBkgColor = this.errorBkgColor || this.tertiaryColor;
|
1267 | this.errorTextColor = this.errorTextColor || this.tertiaryTextColor;
|
1268 | this.transitionColor = this.transitionColor || this.lineColor;
|
1269 | this.classText = this.primaryTextColor;
|
1270 | this.fillType0 = this.primaryColor;
|
1271 | this.fillType1 = this.secondaryColor;
|
1272 | this.fillType2 = adjust(this.primaryColor, { h: 64 });
|
1273 | this.fillType3 = adjust(this.secondaryColor, { h: 64 });
|
1274 | this.fillType4 = adjust(this.primaryColor, { h: -64 });
|
1275 | this.fillType5 = adjust(this.secondaryColor, { h: -64 });
|
1276 | this.fillType6 = adjust(this.primaryColor, { h: 128 });
|
1277 | this.fillType7 = adjust(this.secondaryColor, { h: 128 });
|
1278 | this.pie1 = this.pie1 || this.primaryColor;
|
1279 | this.pie2 = this.pie2 || this.secondaryColor;
|
1280 | this.pie3 = this.pie3 || this.tertiaryColor;
|
1281 | this.pie4 = this.pie4 || adjust(this.primaryColor, { l: -30 });
|
1282 | this.pie5 = this.pie5 || adjust(this.secondaryColor, { l: -30 });
|
1283 | this.pie6 = this.pie6 || adjust(this.tertiaryColor, { h: 40, l: -40 });
|
1284 | this.pie7 = this.pie7 || adjust(this.primaryColor, { h: 60, l: -10 });
|
1285 | this.pie8 = this.pie8 || adjust(this.primaryColor, { h: -60, l: -10 });
|
1286 | this.pie9 = this.pie9 || adjust(this.primaryColor, { h: 120, l: 0 });
|
1287 | this.pie10 = this.pie10 || adjust(this.primaryColor, { h: 60, l: -50 });
|
1288 | this.pie11 = this.pie11 || adjust(this.primaryColor, { h: -60, l: -50 });
|
1289 | this.pie12 = this.pie12 || adjust(this.primaryColor, { h: 120, l: -50 });
|
1290 | this.pieTitleTextSize = this.pieTitleTextSize || "25px";
|
1291 | this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor;
|
1292 | this.pieSectionTextSize = this.pieSectionTextSize || "17px";
|
1293 | this.pieSectionTextColor = this.pieSectionTextColor || this.textColor;
|
1294 | this.pieLegendTextSize = this.pieLegendTextSize || "17px";
|
1295 | this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor;
|
1296 | this.pieStrokeColor = this.pieStrokeColor || "black";
|
1297 | this.pieStrokeWidth = this.pieStrokeWidth || "2px";
|
1298 | this.pieOuterStrokeWidth = this.pieOuterStrokeWidth || "2px";
|
1299 | this.pieOuterStrokeColor = this.pieOuterStrokeColor || "black";
|
1300 | this.pieOpacity = this.pieOpacity || "0.7";
|
1301 | this.quadrant1Fill = this.quadrant1Fill || this.primaryColor;
|
1302 | this.quadrant2Fill = this.quadrant2Fill || adjust(this.primaryColor, { r: 5, g: 5, b: 5 });
|
1303 | this.quadrant3Fill = this.quadrant3Fill || adjust(this.primaryColor, { r: 10, g: 10, b: 10 });
|
1304 | this.quadrant4Fill = this.quadrant4Fill || adjust(this.primaryColor, { r: 15, g: 15, b: 15 });
|
1305 | this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor;
|
1306 | this.quadrant2TextFill = this.quadrant2TextFill || adjust(this.primaryTextColor, { r: -5, g: -5, b: -5 });
|
1307 | this.quadrant3TextFill = this.quadrant3TextFill || adjust(this.primaryTextColor, { r: -10, g: -10, b: -10 });
|
1308 | this.quadrant4TextFill = this.quadrant4TextFill || adjust(this.primaryTextColor, { r: -15, g: -15, b: -15 });
|
1309 | this.quadrantPointFill = this.quadrantPointFill || isDark(this.quadrant1Fill) ? lighten(this.quadrant1Fill) : darken(this.quadrant1Fill);
|
1310 | this.quadrantPointTextFill = this.quadrantPointTextFill || this.primaryTextColor;
|
1311 | this.quadrantXAxisTextFill = this.quadrantXAxisTextFill || this.primaryTextColor;
|
1312 | this.quadrantYAxisTextFill = this.quadrantYAxisTextFill || this.primaryTextColor;
|
1313 | this.quadrantInternalBorderStrokeFill = this.quadrantInternalBorderStrokeFill || this.primaryBorderColor;
|
1314 | this.quadrantExternalBorderStrokeFill = this.quadrantExternalBorderStrokeFill || this.primaryBorderColor;
|
1315 | this.quadrantTitleFill = this.quadrantTitleFill || this.primaryTextColor;
|
1316 | this.xyChart = {
|
1317 | backgroundColor: ((_a = this.xyChart) == null ? void 0 : _a.backgroundColor) || this.background,
|
1318 | titleColor: ((_b = this.xyChart) == null ? void 0 : _b.titleColor) || this.primaryTextColor,
|
1319 | xAxisTitleColor: ((_c = this.xyChart) == null ? void 0 : _c.xAxisTitleColor) || this.primaryTextColor,
|
1320 | xAxisLabelColor: ((_d = this.xyChart) == null ? void 0 : _d.xAxisLabelColor) || this.primaryTextColor,
|
1321 | xAxisTickColor: ((_e = this.xyChart) == null ? void 0 : _e.xAxisTickColor) || this.primaryTextColor,
|
1322 | xAxisLineColor: ((_f = this.xyChart) == null ? void 0 : _f.xAxisLineColor) || this.primaryTextColor,
|
1323 | yAxisTitleColor: ((_g = this.xyChart) == null ? void 0 : _g.yAxisTitleColor) || this.primaryTextColor,
|
1324 | yAxisLabelColor: ((_h = this.xyChart) == null ? void 0 : _h.yAxisLabelColor) || this.primaryTextColor,
|
1325 | yAxisTickColor: ((_i = this.xyChart) == null ? void 0 : _i.yAxisTickColor) || this.primaryTextColor,
|
1326 | yAxisLineColor: ((_j = this.xyChart) == null ? void 0 : _j.yAxisLineColor) || this.primaryTextColor,
|
1327 | plotColorPalette: ((_k = this.xyChart) == null ? void 0 : _k.plotColorPalette) || "#CDE498,#FF6B6B,#A0D2DB,#D7BDE2,#F0F0F0,#FFC3A0,#7FD8BE,#FF9A8B,#FAF3E0,#FFF176"
|
1328 | };
|
1329 | this.requirementBackground = this.requirementBackground || this.primaryColor;
|
1330 | this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor;
|
1331 | this.requirementBorderSize = this.requirementBorderSize || "1";
|
1332 | this.requirementTextColor = this.requirementTextColor || this.primaryTextColor;
|
1333 | this.relationColor = this.relationColor || this.lineColor;
|
1334 | this.relationLabelBackground = this.relationLabelBackground || this.edgeLabelBackground;
|
1335 | this.relationLabelColor = this.relationLabelColor || this.actorTextColor;
|
1336 | this.git0 = this.git0 || this.primaryColor;
|
1337 | this.git1 = this.git1 || this.secondaryColor;
|
1338 | this.git2 = this.git2 || this.tertiaryColor;
|
1339 | this.git3 = this.git3 || adjust(this.primaryColor, { h: -30 });
|
1340 | this.git4 = this.git4 || adjust(this.primaryColor, { h: -60 });
|
1341 | this.git5 = this.git5 || adjust(this.primaryColor, { h: -90 });
|
1342 | this.git6 = this.git6 || adjust(this.primaryColor, { h: 60 });
|
1343 | this.git7 = this.git7 || adjust(this.primaryColor, { h: 120 });
|
1344 | if (this.darkMode) {
|
1345 | this.git0 = lighten(this.git0, 25);
|
1346 | this.git1 = lighten(this.git1, 25);
|
1347 | this.git2 = lighten(this.git2, 25);
|
1348 | this.git3 = lighten(this.git3, 25);
|
1349 | this.git4 = lighten(this.git4, 25);
|
1350 | this.git5 = lighten(this.git5, 25);
|
1351 | this.git6 = lighten(this.git6, 25);
|
1352 | this.git7 = lighten(this.git7, 25);
|
1353 | } else {
|
1354 | this.git0 = darken(this.git0, 25);
|
1355 | this.git1 = darken(this.git1, 25);
|
1356 | this.git2 = darken(this.git2, 25);
|
1357 | this.git3 = darken(this.git3, 25);
|
1358 | this.git4 = darken(this.git4, 25);
|
1359 | this.git5 = darken(this.git5, 25);
|
1360 | this.git6 = darken(this.git6, 25);
|
1361 | this.git7 = darken(this.git7, 25);
|
1362 | }
|
1363 | this.gitInv0 = this.gitInv0 || invert(this.git0);
|
1364 | this.gitInv1 = this.gitInv1 || invert(this.git1);
|
1365 | this.gitInv2 = this.gitInv2 || invert(this.git2);
|
1366 | this.gitInv3 = this.gitInv3 || invert(this.git3);
|
1367 | this.gitInv4 = this.gitInv4 || invert(this.git4);
|
1368 | this.gitInv5 = this.gitInv5 || invert(this.git5);
|
1369 | this.gitInv6 = this.gitInv6 || invert(this.git6);
|
1370 | this.gitInv7 = this.gitInv7 || invert(this.git7);
|
1371 | this.gitBranchLabel0 = this.gitBranchLabel0 || invert(this.labelTextColor);
|
1372 | this.gitBranchLabel1 = this.gitBranchLabel1 || this.labelTextColor;
|
1373 | this.gitBranchLabel2 = this.gitBranchLabel2 || this.labelTextColor;
|
1374 | this.gitBranchLabel3 = this.gitBranchLabel3 || invert(this.labelTextColor);
|
1375 | this.gitBranchLabel4 = this.gitBranchLabel4 || this.labelTextColor;
|
1376 | this.gitBranchLabel5 = this.gitBranchLabel5 || this.labelTextColor;
|
1377 | this.gitBranchLabel6 = this.gitBranchLabel6 || this.labelTextColor;
|
1378 | this.gitBranchLabel7 = this.gitBranchLabel7 || this.labelTextColor;
|
1379 | this.tagLabelColor = this.tagLabelColor || this.primaryTextColor;
|
1380 | this.tagLabelBackground = this.tagLabelBackground || this.primaryColor;
|
1381 | this.tagLabelBorder = this.tagBorder || this.primaryBorderColor;
|
1382 | this.tagLabelFontSize = this.tagLabelFontSize || "10px";
|
1383 | this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor;
|
1384 | this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor;
|
1385 | this.commitLabelFontSize = this.commitLabelFontSize || "10px";
|
1386 | this.attributeBackgroundColorOdd = this.attributeBackgroundColorOdd || oldAttributeBackgroundColorOdd;
|
1387 | this.attributeBackgroundColorEven = this.attributeBackgroundColorEven || oldAttributeBackgroundColorEven;
|
1388 | }
|
1389 | calculate(overrides) {
|
1390 | if (typeof overrides !== "object") {
|
1391 | this.updateColors();
|
1392 | return;
|
1393 | }
|
1394 | const keys = Object.keys(overrides);
|
1395 | keys.forEach((k) => {
|
1396 | this[k] = overrides[k];
|
1397 | });
|
1398 | this.updateColors();
|
1399 | keys.forEach((k) => {
|
1400 | this[k] = overrides[k];
|
1401 | });
|
1402 | }
|
1403 | };
|
1404 | const getThemeVariables$1 = (userOverrides) => {
|
1405 | const theme2 = new Theme$1();
|
1406 | theme2.calculate(userOverrides);
|
1407 | return theme2;
|
1408 | };
|
1409 | class Theme5 {
|
1410 | constructor() {
|
1411 | this.primaryColor = "#eee";
|
1412 | this.contrast = "#707070";
|
1413 | this.secondaryColor = lighten(this.contrast, 55);
|
1414 | this.background = "#ffffff";
|
1415 | this.tertiaryColor = adjust(this.primaryColor, { h: -160 });
|
1416 | this.primaryBorderColor = mkBorder(this.primaryColor, this.darkMode);
|
1417 | this.secondaryBorderColor = mkBorder(this.secondaryColor, this.darkMode);
|
1418 | this.tertiaryBorderColor = mkBorder(this.tertiaryColor, this.darkMode);
|
1419 | this.primaryTextColor = invert(this.primaryColor);
|
1420 | this.secondaryTextColor = invert(this.secondaryColor);
|
1421 | this.tertiaryTextColor = invert(this.tertiaryColor);
|
1422 | this.lineColor = invert(this.background);
|
1423 | this.textColor = invert(this.background);
|
1424 | this.mainBkg = "#eee";
|
1425 | this.secondBkg = "calculated";
|
1426 | this.lineColor = "#666";
|
1427 | this.border1 = "#999";
|
1428 | this.border2 = "calculated";
|
1429 | this.note = "#ffa";
|
1430 | this.text = "#333";
|
1431 | this.critical = "#d42";
|
1432 | this.done = "#bbb";
|
1433 | this.arrowheadColor = "#333333";
|
1434 | this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif';
|
1435 | this.fontSize = "16px";
|
1436 | this.THEME_COLOR_LIMIT = 12;
|
1437 | this.nodeBkg = "calculated";
|
1438 | this.nodeBorder = "calculated";
|
1439 | this.clusterBkg = "calculated";
|
1440 | this.clusterBorder = "calculated";
|
1441 | this.defaultLinkColor = "calculated";
|
1442 | this.titleColor = "calculated";
|
1443 | this.edgeLabelBackground = "white";
|
1444 | this.actorBorder = "calculated";
|
1445 | this.actorBkg = "calculated";
|
1446 | this.actorTextColor = "calculated";
|
1447 | this.actorLineColor = "calculated";
|
1448 | this.signalColor = "calculated";
|
1449 | this.signalTextColor = "calculated";
|
1450 | this.labelBoxBkgColor = "calculated";
|
1451 | this.labelBoxBorderColor = "calculated";
|
1452 | this.labelTextColor = "calculated";
|
1453 | this.loopTextColor = "calculated";
|
1454 | this.noteBorderColor = "calculated";
|
1455 | this.noteBkgColor = "calculated";
|
1456 | this.noteTextColor = "calculated";
|
1457 | this.activationBorderColor = "#666";
|
1458 | this.activationBkgColor = "#f4f4f4";
|
1459 | this.sequenceNumberColor = "white";
|
1460 | this.sectionBkgColor = "calculated";
|
1461 | this.altSectionBkgColor = "white";
|
1462 | this.sectionBkgColor2 = "calculated";
|
1463 | this.excludeBkgColor = "#eeeeee";
|
1464 | this.taskBorderColor = "calculated";
|
1465 | this.taskBkgColor = "calculated";
|
1466 | this.taskTextLightColor = "white";
|
1467 | this.taskTextColor = "calculated";
|
1468 | this.taskTextDarkColor = "calculated";
|
1469 | this.taskTextOutsideColor = "calculated";
|
1470 | this.taskTextClickableColor = "#003163";
|
1471 | this.activeTaskBorderColor = "calculated";
|
1472 | this.activeTaskBkgColor = "calculated";
|
1473 | this.gridColor = "calculated";
|
1474 | this.doneTaskBkgColor = "calculated";
|
1475 | this.doneTaskBorderColor = "calculated";
|
1476 | this.critBkgColor = "calculated";
|
1477 | this.critBorderColor = "calculated";
|
1478 | this.todayLineColor = "calculated";
|
1479 | this.personBorder = this.primaryBorderColor;
|
1480 | this.personBkg = this.mainBkg;
|
1481 | this.labelColor = "black";
|
1482 | this.errorBkgColor = "#552222";
|
1483 | this.errorTextColor = "#552222";
|
1484 | }
|
1485 | updateColors() {
|
1486 | var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
1487 | this.secondBkg = lighten(this.contrast, 55);
|
1488 | this.border2 = this.contrast;
|
1489 | this.actorBorder = lighten(this.border1, 23);
|
1490 | this.actorBkg = this.mainBkg;
|
1491 | this.actorTextColor = this.text;
|
1492 | this.actorLineColor = this.lineColor;
|
1493 | this.signalColor = this.text;
|
1494 | this.signalTextColor = this.text;
|
1495 | this.labelBoxBkgColor = this.actorBkg;
|
1496 | this.labelBoxBorderColor = this.actorBorder;
|
1497 | this.labelTextColor = this.text;
|
1498 | this.loopTextColor = this.text;
|
1499 | this.noteBorderColor = "#999";
|
1500 | this.noteBkgColor = "#666";
|
1501 | this.noteTextColor = "#fff";
|
1502 | this.cScale0 = this.cScale0 || "#555";
|
1503 | this.cScale1 = this.cScale1 || "#F4F4F4";
|
1504 | this.cScale2 = this.cScale2 || "#555";
|
1505 | this.cScale3 = this.cScale3 || "#BBB";
|
1506 | this.cScale4 = this.cScale4 || "#777";
|
1507 | this.cScale5 = this.cScale5 || "#999";
|
1508 | this.cScale6 = this.cScale6 || "#DDD";
|
1509 | this.cScale7 = this.cScale7 || "#FFF";
|
1510 | this.cScale8 = this.cScale8 || "#DDD";
|
1511 | this.cScale9 = this.cScale9 || "#BBB";
|
1512 | this.cScale10 = this.cScale10 || "#999";
|
1513 | this.cScale11 = this.cScale11 || "#777";
|
1514 | for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
|
1515 | this["cScaleInv" + i] = this["cScaleInv" + i] || invert(this["cScale" + i]);
|
1516 | }
|
1517 | for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
|
1518 | if (this.darkMode) {
|
1519 | this["cScalePeer" + i] = this["cScalePeer" + i] || lighten(this["cScale" + i], 10);
|
1520 | } else {
|
1521 | this["cScalePeer" + i] = this["cScalePeer" + i] || darken(this["cScale" + i], 10);
|
1522 | }
|
1523 | }
|
1524 | this.scaleLabelColor = this.scaleLabelColor || (this.darkMode ? "black" : this.labelTextColor);
|
1525 | this["cScaleLabel0"] = this["cScaleLabel0"] || this.cScale1;
|
1526 | this["cScaleLabel2"] = this["cScaleLabel2"] || this.cScale1;
|
1527 | for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
|
1528 | this["cScaleLabel" + i] = this["cScaleLabel" + i] || this.scaleLabelColor;
|
1529 | }
|
1530 | for (let i = 0; i < 5; i++) {
|
1531 | this["surface" + i] = this["surface" + i] || adjust(this.mainBkg, { l: -(5 + i * 5) });
|
1532 | this["surfacePeer" + i] = this["surfacePeer" + i] || adjust(this.mainBkg, { l: -(8 + i * 5) });
|
1533 | }
|
1534 | this.nodeBkg = this.mainBkg;
|
1535 | this.nodeBorder = this.border1;
|
1536 | this.clusterBkg = this.secondBkg;
|
1537 | this.clusterBorder = this.border2;
|
1538 | this.defaultLinkColor = this.lineColor;
|
1539 | this.titleColor = this.text;
|
1540 | this.sectionBkgColor = lighten(this.contrast, 30);
|
1541 | this.sectionBkgColor2 = lighten(this.contrast, 30);
|
1542 | this.taskBorderColor = darken(this.contrast, 10);
|
1543 | this.taskBkgColor = this.contrast;
|
1544 | this.taskTextColor = this.taskTextLightColor;
|
1545 | this.taskTextDarkColor = this.text;
|
1546 | this.taskTextOutsideColor = this.taskTextDarkColor;
|
1547 | this.activeTaskBorderColor = this.taskBorderColor;
|
1548 | this.activeTaskBkgColor = this.mainBkg;
|
1549 | this.gridColor = lighten(this.border1, 30);
|
1550 | this.doneTaskBkgColor = this.done;
|
1551 | this.doneTaskBorderColor = this.lineColor;
|
1552 | this.critBkgColor = this.critical;
|
1553 | this.critBorderColor = darken(this.critBkgColor, 10);
|
1554 | this.todayLineColor = this.critBkgColor;
|
1555 | this.transitionColor = this.transitionColor || "#000";
|
1556 | this.transitionLabelColor = this.transitionLabelColor || this.textColor;
|
1557 | this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor;
|
1558 | this.stateBkg = this.stateBkg || this.mainBkg;
|
1559 | this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg;
|
1560 | this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor;
|
1561 | this.altBackground = this.altBackground || "#f4f4f4";
|
1562 | this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg;
|
1563 | this.stateBorder = this.stateBorder || "#000";
|
1564 | this.innerEndBackground = this.primaryBorderColor;
|
1565 | this.specialStateColor = "#222";
|
1566 | this.errorBkgColor = this.errorBkgColor || this.tertiaryColor;
|
1567 | this.errorTextColor = this.errorTextColor || this.tertiaryTextColor;
|
1568 | this.classText = this.primaryTextColor;
|
1569 | this.fillType0 = this.primaryColor;
|
1570 | this.fillType1 = this.secondaryColor;
|
1571 | this.fillType2 = adjust(this.primaryColor, { h: 64 });
|
1572 | this.fillType3 = adjust(this.secondaryColor, { h: 64 });
|
1573 | this.fillType4 = adjust(this.primaryColor, { h: -64 });
|
1574 | this.fillType5 = adjust(this.secondaryColor, { h: -64 });
|
1575 | this.fillType6 = adjust(this.primaryColor, { h: 128 });
|
1576 | this.fillType7 = adjust(this.secondaryColor, { h: 128 });
|
1577 | for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
|
1578 | this["pie" + i] = this["cScale" + i];
|
1579 | }
|
1580 | this.pie12 = this.pie0;
|
1581 | this.pieTitleTextSize = this.pieTitleTextSize || "25px";
|
1582 | this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor;
|
1583 | this.pieSectionTextSize = this.pieSectionTextSize || "17px";
|
1584 | this.pieSectionTextColor = this.pieSectionTextColor || this.textColor;
|
1585 | this.pieLegendTextSize = this.pieLegendTextSize || "17px";
|
1586 | this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor;
|
1587 | this.pieStrokeColor = this.pieStrokeColor || "black";
|
1588 | this.pieStrokeWidth = this.pieStrokeWidth || "2px";
|
1589 | this.pieOuterStrokeWidth = this.pieOuterStrokeWidth || "2px";
|
1590 | this.pieOuterStrokeColor = this.pieOuterStrokeColor || "black";
|
1591 | this.pieOpacity = this.pieOpacity || "0.7";
|
1592 | this.quadrant1Fill = this.quadrant1Fill || this.primaryColor;
|
1593 | this.quadrant2Fill = this.quadrant2Fill || adjust(this.primaryColor, { r: 5, g: 5, b: 5 });
|
1594 | this.quadrant3Fill = this.quadrant3Fill || adjust(this.primaryColor, { r: 10, g: 10, b: 10 });
|
1595 | this.quadrant4Fill = this.quadrant4Fill || adjust(this.primaryColor, { r: 15, g: 15, b: 15 });
|
1596 | this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor;
|
1597 | this.quadrant2TextFill = this.quadrant2TextFill || adjust(this.primaryTextColor, { r: -5, g: -5, b: -5 });
|
1598 | this.quadrant3TextFill = this.quadrant3TextFill || adjust(this.primaryTextColor, { r: -10, g: -10, b: -10 });
|
1599 | this.quadrant4TextFill = this.quadrant4TextFill || adjust(this.primaryTextColor, { r: -15, g: -15, b: -15 });
|
1600 | this.quadrantPointFill = this.quadrantPointFill || isDark(this.quadrant1Fill) ? lighten(this.quadrant1Fill) : darken(this.quadrant1Fill);
|
1601 | this.quadrantPointTextFill = this.quadrantPointTextFill || this.primaryTextColor;
|
1602 | this.quadrantXAxisTextFill = this.quadrantXAxisTextFill || this.primaryTextColor;
|
1603 | this.quadrantYAxisTextFill = this.quadrantYAxisTextFill || this.primaryTextColor;
|
1604 | this.quadrantInternalBorderStrokeFill = this.quadrantInternalBorderStrokeFill || this.primaryBorderColor;
|
1605 | this.quadrantExternalBorderStrokeFill = this.quadrantExternalBorderStrokeFill || this.primaryBorderColor;
|
1606 | this.quadrantTitleFill = this.quadrantTitleFill || this.primaryTextColor;
|
1607 | this.xyChart = {
|
1608 | backgroundColor: ((_a = this.xyChart) == null ? void 0 : _a.backgroundColor) || this.background,
|
1609 | titleColor: ((_b = this.xyChart) == null ? void 0 : _b.titleColor) || this.primaryTextColor,
|
1610 | xAxisTitleColor: ((_c = this.xyChart) == null ? void 0 : _c.xAxisTitleColor) || this.primaryTextColor,
|
1611 | xAxisLabelColor: ((_d = this.xyChart) == null ? void 0 : _d.xAxisLabelColor) || this.primaryTextColor,
|
1612 | xAxisTickColor: ((_e = this.xyChart) == null ? void 0 : _e.xAxisTickColor) || this.primaryTextColor,
|
1613 | xAxisLineColor: ((_f = this.xyChart) == null ? void 0 : _f.xAxisLineColor) || this.primaryTextColor,
|
1614 | yAxisTitleColor: ((_g = this.xyChart) == null ? void 0 : _g.yAxisTitleColor) || this.primaryTextColor,
|
1615 | yAxisLabelColor: ((_h = this.xyChart) == null ? void 0 : _h.yAxisLabelColor) || this.primaryTextColor,
|
1616 | yAxisTickColor: ((_i = this.xyChart) == null ? void 0 : _i.yAxisTickColor) || this.primaryTextColor,
|
1617 | yAxisLineColor: ((_j = this.xyChart) == null ? void 0 : _j.yAxisLineColor) || this.primaryTextColor,
|
1618 | plotColorPalette: ((_k = this.xyChart) == null ? void 0 : _k.plotColorPalette) || "#EEE,#6BB8E4,#8ACB88,#C7ACD6,#E8DCC2,#FFB2A8,#FFF380,#7E8D91,#FFD8B1,#FAF3E0"
|
1619 | };
|
1620 | this.requirementBackground = this.requirementBackground || this.primaryColor;
|
1621 | this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor;
|
1622 | this.requirementBorderSize = this.requirementBorderSize || "1";
|
1623 | this.requirementTextColor = this.requirementTextColor || this.primaryTextColor;
|
1624 | this.relationColor = this.relationColor || this.lineColor;
|
1625 | this.relationLabelBackground = this.relationLabelBackground || this.edgeLabelBackground;
|
1626 | this.relationLabelColor = this.relationLabelColor || this.actorTextColor;
|
1627 | this.git0 = darken(this.pie1, 25) || this.primaryColor;
|
1628 | this.git1 = this.pie2 || this.secondaryColor;
|
1629 | this.git2 = this.pie3 || this.tertiaryColor;
|
1630 | this.git3 = this.pie4 || adjust(this.primaryColor, { h: -30 });
|
1631 | this.git4 = this.pie5 || adjust(this.primaryColor, { h: -60 });
|
1632 | this.git5 = this.pie6 || adjust(this.primaryColor, { h: -90 });
|
1633 | this.git6 = this.pie7 || adjust(this.primaryColor, { h: 60 });
|
1634 | this.git7 = this.pie8 || adjust(this.primaryColor, { h: 120 });
|
1635 | this.gitInv0 = this.gitInv0 || invert(this.git0);
|
1636 | this.gitInv1 = this.gitInv1 || invert(this.git1);
|
1637 | this.gitInv2 = this.gitInv2 || invert(this.git2);
|
1638 | this.gitInv3 = this.gitInv3 || invert(this.git3);
|
1639 | this.gitInv4 = this.gitInv4 || invert(this.git4);
|
1640 | this.gitInv5 = this.gitInv5 || invert(this.git5);
|
1641 | this.gitInv6 = this.gitInv6 || invert(this.git6);
|
1642 | this.gitInv7 = this.gitInv7 || invert(this.git7);
|
1643 | this.branchLabelColor = this.branchLabelColor || this.labelTextColor;
|
1644 | this.gitBranchLabel0 = this.branchLabelColor;
|
1645 | this.gitBranchLabel1 = "white";
|
1646 | this.gitBranchLabel2 = this.branchLabelColor;
|
1647 | this.gitBranchLabel3 = "white";
|
1648 | this.gitBranchLabel4 = this.branchLabelColor;
|
1649 | this.gitBranchLabel5 = this.branchLabelColor;
|
1650 | this.gitBranchLabel6 = this.branchLabelColor;
|
1651 | this.gitBranchLabel7 = this.branchLabelColor;
|
1652 | this.tagLabelColor = this.tagLabelColor || this.primaryTextColor;
|
1653 | this.tagLabelBackground = this.tagLabelBackground || this.primaryColor;
|
1654 | this.tagLabelBorder = this.tagBorder || this.primaryBorderColor;
|
1655 | this.tagLabelFontSize = this.tagLabelFontSize || "10px";
|
1656 | this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor;
|
1657 | this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor;
|
1658 | this.commitLabelFontSize = this.commitLabelFontSize || "10px";
|
1659 | this.attributeBackgroundColorOdd = this.attributeBackgroundColorOdd || oldAttributeBackgroundColorOdd;
|
1660 | this.attributeBackgroundColorEven = this.attributeBackgroundColorEven || oldAttributeBackgroundColorEven;
|
1661 | }
|
1662 | calculate(overrides) {
|
1663 | if (typeof overrides !== "object") {
|
1664 | this.updateColors();
|
1665 | return;
|
1666 | }
|
1667 | const keys = Object.keys(overrides);
|
1668 | keys.forEach((k) => {
|
1669 | this[k] = overrides[k];
|
1670 | });
|
1671 | this.updateColors();
|
1672 | keys.forEach((k) => {
|
1673 | this[k] = overrides[k];
|
1674 | });
|
1675 | }
|
1676 | }
|
1677 | const getThemeVariables = (userOverrides) => {
|
1678 | const theme2 = new Theme5();
|
1679 | theme2.calculate(userOverrides);
|
1680 | return theme2;
|
1681 | };
|
1682 | const theme = {
|
1683 | base: {
|
1684 | getThemeVariables: getThemeVariables$4
|
1685 | },
|
1686 | dark: {
|
1687 | getThemeVariables: getThemeVariables$3
|
1688 | },
|
1689 | default: {
|
1690 | getThemeVariables: getThemeVariables$2
|
1691 | },
|
1692 | forest: {
|
1693 | getThemeVariables: getThemeVariables$1
|
1694 | },
|
1695 | neutral: {
|
1696 | getThemeVariables
|
1697 | }
|
1698 | };
|
1699 | const defaultConfigJson = {
|
1700 | "flowchart": {
|
1701 | "useMaxWidth": true,
|
1702 | "titleTopMargin": 25,
|
1703 | "subGraphTitleMargin": {
|
1704 | "top": 0,
|
1705 | "bottom": 0
|
1706 | },
|
1707 | "diagramPadding": 8,
|
1708 | "htmlLabels": true,
|
1709 | "nodeSpacing": 50,
|
1710 | "rankSpacing": 50,
|
1711 | "curve": "basis",
|
1712 | "padding": 15,
|
1713 | "defaultRenderer": "dagre-wrapper",
|
1714 | "wrappingWidth": 200
|
1715 | },
|
1716 | "sequence": {
|
1717 | "useMaxWidth": true,
|
1718 | "hideUnusedParticipants": false,
|
1719 | "activationWidth": 10,
|
1720 | "diagramMarginX": 50,
|
1721 | "diagramMarginY": 10,
|
1722 | "actorMargin": 50,
|
1723 | "width": 150,
|
1724 | "height": 65,
|
1725 | "boxMargin": 10,
|
1726 | "boxTextMargin": 5,
|
1727 | "noteMargin": 10,
|
1728 | "messageMargin": 35,
|
1729 | "messageAlign": "center",
|
1730 | "mirrorActors": true,
|
1731 | "forceMenus": false,
|
1732 | "bottomMarginAdj": 1,
|
1733 | "rightAngles": false,
|
1734 | "showSequenceNumbers": false,
|
1735 | "actorFontSize": 14,
|
1736 | "actorFontFamily": '"Open Sans", sans-serif',
|
1737 | "actorFontWeight": 400,
|
1738 | "noteFontSize": 14,
|
1739 | "noteFontFamily": '"trebuchet ms", verdana, arial, sans-serif',
|
1740 | "noteFontWeight": 400,
|
1741 | "noteAlign": "center",
|
1742 | "messageFontSize": 16,
|
1743 | "messageFontFamily": '"trebuchet ms", verdana, arial, sans-serif',
|
1744 | "messageFontWeight": 400,
|
1745 | "wrap": false,
|
1746 | "wrapPadding": 10,
|
1747 | "labelBoxWidth": 50,
|
1748 | "labelBoxHeight": 20
|
1749 | },
|
1750 | "gantt": {
|
1751 | "useMaxWidth": true,
|
1752 | "titleTopMargin": 25,
|
1753 | "barHeight": 20,
|
1754 | "barGap": 4,
|
1755 | "topPadding": 50,
|
1756 | "rightPadding": 75,
|
1757 | "leftPadding": 75,
|
1758 | "gridLineStartPadding": 35,
|
1759 | "fontSize": 11,
|
1760 | "sectionFontSize": 11,
|
1761 | "numberSectionStyles": 4,
|
1762 | "axisFormat": "%Y-%m-%d",
|
1763 | "topAxis": false,
|
1764 | "displayMode": "",
|
1765 | "weekday": "sunday"
|
1766 | },
|
1767 | "journey": {
|
1768 | "useMaxWidth": true,
|
1769 | "diagramMarginX": 50,
|
1770 | "diagramMarginY": 10,
|
1771 | "leftMargin": 150,
|
1772 | "width": 150,
|
1773 | "height": 50,
|
1774 | "boxMargin": 10,
|
1775 | "boxTextMargin": 5,
|
1776 | "noteMargin": 10,
|
1777 | "messageMargin": 35,
|
1778 | "messageAlign": "center",
|
1779 | "bottomMarginAdj": 1,
|
1780 | "rightAngles": false,
|
1781 | "taskFontSize": 14,
|
1782 | "taskFontFamily": '"Open Sans", sans-serif',
|
1783 | "taskMargin": 50,
|
1784 | "activationWidth": 10,
|
1785 | "textPlacement": "fo",
|
1786 | "actorColours": [
|
1787 | "#8FBC8F",
|
1788 | "#7CFC00",
|
1789 | "#00FFFF",
|
1790 | "#20B2AA",
|
1791 | "#B0E0E6",
|
1792 | "#FFFFE0"
|
1793 | ],
|
1794 | "sectionFills": [
|
1795 | "#191970",
|
1796 | "#8B008B",
|
1797 | "#4B0082",
|
1798 | "#2F4F4F",
|
1799 | "#800000",
|
1800 | "#8B4513",
|
1801 | "#00008B"
|
1802 | ],
|
1803 | "sectionColours": [
|
1804 | "#fff"
|
1805 | ]
|
1806 | },
|
1807 | "class": {
|
1808 | "useMaxWidth": true,
|
1809 | "titleTopMargin": 25,
|
1810 | "arrowMarkerAbsolute": false,
|
1811 | "dividerMargin": 10,
|
1812 | "padding": 5,
|
1813 | "textHeight": 10,
|
1814 | "defaultRenderer": "dagre-wrapper",
|
1815 | "htmlLabels": false
|
1816 | },
|
1817 | "state": {
|
1818 | "useMaxWidth": true,
|
1819 | "titleTopMargin": 25,
|
1820 | "dividerMargin": 10,
|
1821 | "sizeUnit": 5,
|
1822 | "padding": 8,
|
1823 | "textHeight": 10,
|
1824 | "titleShift": -15,
|
1825 | "noteMargin": 10,
|
1826 | "forkWidth": 70,
|
1827 | "forkHeight": 7,
|
1828 | "miniPadding": 2,
|
1829 | "fontSizeFactor": 5.02,
|
1830 | "fontSize": 24,
|
1831 | "labelHeight": 16,
|
1832 | "edgeLengthFactor": "20",
|
1833 | "compositTitleSize": 35,
|
1834 | "radius": 5,
|
1835 | "defaultRenderer": "dagre-wrapper"
|
1836 | },
|
1837 | "er": {
|
1838 | "useMaxWidth": true,
|
1839 | "titleTopMargin": 25,
|
1840 | "diagramPadding": 20,
|
1841 | "layoutDirection": "TB",
|
1842 | "minEntityWidth": 100,
|
1843 | "minEntityHeight": 75,
|
1844 | "entityPadding": 15,
|
1845 | "stroke": "gray",
|
1846 | "fill": "honeydew",
|
1847 | "fontSize": 12
|
1848 | },
|
1849 | "pie": {
|
1850 | "useMaxWidth": true,
|
1851 | "textPosition": 0.75
|
1852 | },
|
1853 | "quadrantChart": {
|
1854 | "useMaxWidth": true,
|
1855 | "chartWidth": 500,
|
1856 | "chartHeight": 500,
|
1857 | "titleFontSize": 20,
|
1858 | "titlePadding": 10,
|
1859 | "quadrantPadding": 5,
|
1860 | "xAxisLabelPadding": 5,
|
1861 | "yAxisLabelPadding": 5,
|
1862 | "xAxisLabelFontSize": 16,
|
1863 | "yAxisLabelFontSize": 16,
|
1864 | "quadrantLabelFontSize": 16,
|
1865 | "quadrantTextTopPadding": 5,
|
1866 | "pointTextPadding": 5,
|
1867 | "pointLabelFontSize": 12,
|
1868 | "pointRadius": 5,
|
1869 | "xAxisPosition": "top",
|
1870 | "yAxisPosition": "left",
|
1871 | "quadrantInternalBorderStrokeWidth": 1,
|
1872 | "quadrantExternalBorderStrokeWidth": 2
|
1873 | },
|
1874 | "xyChart": {
|
1875 | "useMaxWidth": true,
|
1876 | "width": 700,
|
1877 | "height": 500,
|
1878 | "titleFontSize": 20,
|
1879 | "titlePadding": 10,
|
1880 | "showTitle": true,
|
1881 | "xAxis": {
|
1882 | "$ref": "#/$defs/XYChartAxisConfig",
|
1883 | "showLabel": true,
|
1884 | "labelFontSize": 14,
|
1885 | "labelPadding": 5,
|
1886 | "showTitle": true,
|
1887 | "titleFontSize": 16,
|
1888 | "titlePadding": 5,
|
1889 | "showTick": true,
|
1890 | "tickLength": 5,
|
1891 | "tickWidth": 2,
|
1892 | "showAxisLine": true,
|
1893 | "axisLineWidth": 2
|
1894 | },
|
1895 | "yAxis": {
|
1896 | "$ref": "#/$defs/XYChartAxisConfig",
|
1897 | "showLabel": true,
|
1898 | "labelFontSize": 14,
|
1899 | "labelPadding": 5,
|
1900 | "showTitle": true,
|
1901 | "titleFontSize": 16,
|
1902 | "titlePadding": 5,
|
1903 | "showTick": true,
|
1904 | "tickLength": 5,
|
1905 | "tickWidth": 2,
|
1906 | "showAxisLine": true,
|
1907 | "axisLineWidth": 2
|
1908 | },
|
1909 | "chartOrientation": "vertical",
|
1910 | "plotReservedSpacePercent": 50
|
1911 | },
|
1912 | "requirement": {
|
1913 | "useMaxWidth": true,
|
1914 | "rect_fill": "#f9f9f9",
|
1915 | "text_color": "#333",
|
1916 | "rect_border_size": "0.5px",
|
1917 | "rect_border_color": "#bbb",
|
1918 | "rect_min_width": 200,
|
1919 | "rect_min_height": 200,
|
1920 | "fontSize": 14,
|
1921 | "rect_padding": 10,
|
1922 | "line_height": 20
|
1923 | },
|
1924 | "mindmap": {
|
1925 | "useMaxWidth": true,
|
1926 | "padding": 10,
|
1927 | "maxNodeWidth": 200
|
1928 | },
|
1929 | "timeline": {
|
1930 | "useMaxWidth": true,
|
1931 | "diagramMarginX": 50,
|
1932 | "diagramMarginY": 10,
|
1933 | "leftMargin": 150,
|
1934 | "width": 150,
|
1935 | "height": 50,
|
1936 | "boxMargin": 10,
|
1937 | "boxTextMargin": 5,
|
1938 | "noteMargin": 10,
|
1939 | "messageMargin": 35,
|
1940 | "messageAlign": "center",
|
1941 | "bottomMarginAdj": 1,
|
1942 | "rightAngles": false,
|
1943 | "taskFontSize": 14,
|
1944 | "taskFontFamily": '"Open Sans", sans-serif',
|
1945 | "taskMargin": 50,
|
1946 | "activationWidth": 10,
|
1947 | "textPlacement": "fo",
|
1948 | "actorColours": [
|
1949 | "#8FBC8F",
|
1950 | "#7CFC00",
|
1951 | "#00FFFF",
|
1952 | "#20B2AA",
|
1953 | "#B0E0E6",
|
1954 | "#FFFFE0"
|
1955 | ],
|
1956 | "sectionFills": [
|
1957 | "#191970",
|
1958 | "#8B008B",
|
1959 | "#4B0082",
|
1960 | "#2F4F4F",
|
1961 | "#800000",
|
1962 | "#8B4513",
|
1963 | "#00008B"
|
1964 | ],
|
1965 | "sectionColours": [
|
1966 | "#fff"
|
1967 | ],
|
1968 | "disableMulticolor": false
|
1969 | },
|
1970 | "gitGraph": {
|
1971 | "useMaxWidth": true,
|
1972 | "titleTopMargin": 25,
|
1973 | "diagramPadding": 8,
|
1974 | "nodeLabel": {
|
1975 | "width": 75,
|
1976 | "height": 100,
|
1977 | "x": -25,
|
1978 | "y": 0
|
1979 | },
|
1980 | "mainBranchName": "main",
|
1981 | "mainBranchOrder": 0,
|
1982 | "showCommitLabel": true,
|
1983 | "showBranches": true,
|
1984 | "rotateCommitLabel": true,
|
1985 | "parallelCommits": false,
|
1986 | "arrowMarkerAbsolute": false
|
1987 | },
|
1988 | "c4": {
|
1989 | "useMaxWidth": true,
|
1990 | "diagramMarginX": 50,
|
1991 | "diagramMarginY": 10,
|
1992 | "c4ShapeMargin": 50,
|
1993 | "c4ShapePadding": 20,
|
1994 | "width": 216,
|
1995 | "height": 60,
|
1996 | "boxMargin": 10,
|
1997 | "c4ShapeInRow": 4,
|
1998 | "nextLinePaddingX": 0,
|
1999 | "c4BoundaryInRow": 2,
|
2000 | "personFontSize": 14,
|
2001 | "personFontFamily": '"Open Sans", sans-serif',
|
2002 | "personFontWeight": "normal",
|
2003 | "external_personFontSize": 14,
|
2004 | "external_personFontFamily": '"Open Sans", sans-serif',
|
2005 | "external_personFontWeight": "normal",
|
2006 | "systemFontSize": 14,
|
2007 | "systemFontFamily": '"Open Sans", sans-serif',
|
2008 | "systemFontWeight": "normal",
|
2009 | "external_systemFontSize": 14,
|
2010 | "external_systemFontFamily": '"Open Sans", sans-serif',
|
2011 | "external_systemFontWeight": "normal",
|
2012 | "system_dbFontSize": 14,
|
2013 | "system_dbFontFamily": '"Open Sans", sans-serif',
|
2014 | "system_dbFontWeight": "normal",
|
2015 | "external_system_dbFontSize": 14,
|
2016 | "external_system_dbFontFamily": '"Open Sans", sans-serif',
|
2017 | "external_system_dbFontWeight": "normal",
|
2018 | "system_queueFontSize": 14,
|
2019 | "system_queueFontFamily": '"Open Sans", sans-serif',
|
2020 | "system_queueFontWeight": "normal",
|
2021 | "external_system_queueFontSize": 14,
|
2022 | "external_system_queueFontFamily": '"Open Sans", sans-serif',
|
2023 | "external_system_queueFontWeight": "normal",
|
2024 | "boundaryFontSize": 14,
|
2025 | "boundaryFontFamily": '"Open Sans", sans-serif',
|
2026 | "boundaryFontWeight": "normal",
|
2027 | "messageFontSize": 12,
|
2028 | "messageFontFamily": '"Open Sans", sans-serif',
|
2029 | "messageFontWeight": "normal",
|
2030 | "containerFontSize": 14,
|
2031 | "containerFontFamily": '"Open Sans", sans-serif',
|
2032 | "containerFontWeight": "normal",
|
2033 | "external_containerFontSize": 14,
|
2034 | "external_containerFontFamily": '"Open Sans", sans-serif',
|
2035 | "external_containerFontWeight": "normal",
|
2036 | "container_dbFontSize": 14,
|
2037 | "container_dbFontFamily": '"Open Sans", sans-serif',
|
2038 | "container_dbFontWeight": "normal",
|
2039 | "external_container_dbFontSize": 14,
|
2040 | "external_container_dbFontFamily": '"Open Sans", sans-serif',
|
2041 | "external_container_dbFontWeight": "normal",
|
2042 | "container_queueFontSize": 14,
|
2043 | "container_queueFontFamily": '"Open Sans", sans-serif',
|
2044 | "container_queueFontWeight": "normal",
|
2045 | "external_container_queueFontSize": 14,
|
2046 | "external_container_queueFontFamily": '"Open Sans", sans-serif',
|
2047 | "external_container_queueFontWeight": "normal",
|
2048 | "componentFontSize": 14,
|
2049 | "componentFontFamily": '"Open Sans", sans-serif',
|
2050 | "componentFontWeight": "normal",
|
2051 | "external_componentFontSize": 14,
|
2052 | "external_componentFontFamily": '"Open Sans", sans-serif',
|
2053 | "external_componentFontWeight": "normal",
|
2054 | "component_dbFontSize": 14,
|
2055 | "component_dbFontFamily": '"Open Sans", sans-serif',
|
2056 | "component_dbFontWeight": "normal",
|
2057 | "external_component_dbFontSize": 14,
|
2058 | "external_component_dbFontFamily": '"Open Sans", sans-serif',
|
2059 | "external_component_dbFontWeight": "normal",
|
2060 | "component_queueFontSize": 14,
|
2061 | "component_queueFontFamily": '"Open Sans", sans-serif',
|
2062 | "component_queueFontWeight": "normal",
|
2063 | "external_component_queueFontSize": 14,
|
2064 | "external_component_queueFontFamily": '"Open Sans", sans-serif',
|
2065 | "external_component_queueFontWeight": "normal",
|
2066 | "wrap": true,
|
2067 | "wrapPadding": 10,
|
2068 | "person_bg_color": "#08427B",
|
2069 | "person_border_color": "#073B6F",
|
2070 | "external_person_bg_color": "#686868",
|
2071 | "external_person_border_color": "#8A8A8A",
|
2072 | "system_bg_color": "#1168BD",
|
2073 | "system_border_color": "#3C7FC0",
|
2074 | "system_db_bg_color": "#1168BD",
|
2075 | "system_db_border_color": "#3C7FC0",
|
2076 | "system_queue_bg_color": "#1168BD",
|
2077 | "system_queue_border_color": "#3C7FC0",
|
2078 | "external_system_bg_color": "#999999",
|
2079 | "external_system_border_color": "#8A8A8A",
|
2080 | "external_system_db_bg_color": "#999999",
|
2081 | "external_system_db_border_color": "#8A8A8A",
|
2082 | "external_system_queue_bg_color": "#999999",
|
2083 | "external_system_queue_border_color": "#8A8A8A",
|
2084 | "container_bg_color": "#438DD5",
|
2085 | "container_border_color": "#3C7FC0",
|
2086 | "container_db_bg_color": "#438DD5",
|
2087 | "container_db_border_color": "#3C7FC0",
|
2088 | "container_queue_bg_color": "#438DD5",
|
2089 | "container_queue_border_color": "#3C7FC0",
|
2090 | "external_container_bg_color": "#B3B3B3",
|
2091 | "external_container_border_color": "#A6A6A6",
|
2092 | "external_container_db_bg_color": "#B3B3B3",
|
2093 | "external_container_db_border_color": "#A6A6A6",
|
2094 | "external_container_queue_bg_color": "#B3B3B3",
|
2095 | "external_container_queue_border_color": "#A6A6A6",
|
2096 | "component_bg_color": "#85BBF0",
|
2097 | "component_border_color": "#78A8D8",
|
2098 | "component_db_bg_color": "#85BBF0",
|
2099 | "component_db_border_color": "#78A8D8",
|
2100 | "component_queue_bg_color": "#85BBF0",
|
2101 | "component_queue_border_color": "#78A8D8",
|
2102 | "external_component_bg_color": "#CCCCCC",
|
2103 | "external_component_border_color": "#BFBFBF",
|
2104 | "external_component_db_bg_color": "#CCCCCC",
|
2105 | "external_component_db_border_color": "#BFBFBF",
|
2106 | "external_component_queue_bg_color": "#CCCCCC",
|
2107 | "external_component_queue_border_color": "#BFBFBF"
|
2108 | },
|
2109 | "sankey": {
|
2110 | "useMaxWidth": true,
|
2111 | "width": 600,
|
2112 | "height": 400,
|
2113 | "linkColor": "gradient",
|
2114 | "nodeAlignment": "justify",
|
2115 | "showValues": true,
|
2116 | "prefix": "",
|
2117 | "suffix": ""
|
2118 | },
|
2119 | "block": {
|
2120 | "useMaxWidth": true,
|
2121 | "padding": 8
|
2122 | },
|
2123 | "theme": "default",
|
2124 | "maxTextSize": 5e4,
|
2125 | "maxEdges": 500,
|
2126 | "darkMode": false,
|
2127 | "fontFamily": '"trebuchet ms", verdana, arial, sans-serif;',
|
2128 | "logLevel": 5,
|
2129 | "securityLevel": "strict",
|
2130 | "startOnLoad": true,
|
2131 | "arrowMarkerAbsolute": false,
|
2132 | "secure": [
|
2133 | "secure",
|
2134 | "securityLevel",
|
2135 | "startOnLoad",
|
2136 | "maxTextSize",
|
2137 | "maxEdges"
|
2138 | ],
|
2139 | "legacyMathML": false,
|
2140 | "deterministicIds": false,
|
2141 | "fontSize": 16
|
2142 | };
|
2143 | const config = {
|
2144 | ...defaultConfigJson,
|
2145 |
|
2146 |
|
2147 | deterministicIDSeed: void 0,
|
2148 | themeCSS: void 0,
|
2149 |
|
2150 | themeVariables: theme["default"].getThemeVariables(),
|
2151 | sequence: {
|
2152 | ...defaultConfigJson.sequence,
|
2153 | messageFont: function() {
|
2154 | return {
|
2155 | fontFamily: this.messageFontFamily,
|
2156 | fontSize: this.messageFontSize,
|
2157 | fontWeight: this.messageFontWeight
|
2158 | };
|
2159 | },
|
2160 | noteFont: function() {
|
2161 | return {
|
2162 | fontFamily: this.noteFontFamily,
|
2163 | fontSize: this.noteFontSize,
|
2164 | fontWeight: this.noteFontWeight
|
2165 | };
|
2166 | },
|
2167 | actorFont: function() {
|
2168 | return {
|
2169 | fontFamily: this.actorFontFamily,
|
2170 | fontSize: this.actorFontSize,
|
2171 | fontWeight: this.actorFontWeight
|
2172 | };
|
2173 | }
|
2174 | },
|
2175 | gantt: {
|
2176 | ...defaultConfigJson.gantt,
|
2177 | tickInterval: void 0,
|
2178 | useWidth: void 0
|
2179 |
|
2180 | },
|
2181 | c4: {
|
2182 | ...defaultConfigJson.c4,
|
2183 | useWidth: void 0,
|
2184 | personFont: function() {
|
2185 | return {
|
2186 | fontFamily: this.personFontFamily,
|
2187 | fontSize: this.personFontSize,
|
2188 | fontWeight: this.personFontWeight
|
2189 | };
|
2190 | },
|
2191 | external_personFont: function() {
|
2192 | return {
|
2193 | fontFamily: this.external_personFontFamily,
|
2194 | fontSize: this.external_personFontSize,
|
2195 | fontWeight: this.external_personFontWeight
|
2196 | };
|
2197 | },
|
2198 | systemFont: function() {
|
2199 | return {
|
2200 | fontFamily: this.systemFontFamily,
|
2201 | fontSize: this.systemFontSize,
|
2202 | fontWeight: this.systemFontWeight
|
2203 | };
|
2204 | },
|
2205 | external_systemFont: function() {
|
2206 | return {
|
2207 | fontFamily: this.external_systemFontFamily,
|
2208 | fontSize: this.external_systemFontSize,
|
2209 | fontWeight: this.external_systemFontWeight
|
2210 | };
|
2211 | },
|
2212 | system_dbFont: function() {
|
2213 | return {
|
2214 | fontFamily: this.system_dbFontFamily,
|
2215 | fontSize: this.system_dbFontSize,
|
2216 | fontWeight: this.system_dbFontWeight
|
2217 | };
|
2218 | },
|
2219 | external_system_dbFont: function() {
|
2220 | return {
|
2221 | fontFamily: this.external_system_dbFontFamily,
|
2222 | fontSize: this.external_system_dbFontSize,
|
2223 | fontWeight: this.external_system_dbFontWeight
|
2224 | };
|
2225 | },
|
2226 | system_queueFont: function() {
|
2227 | return {
|
2228 | fontFamily: this.system_queueFontFamily,
|
2229 | fontSize: this.system_queueFontSize,
|
2230 | fontWeight: this.system_queueFontWeight
|
2231 | };
|
2232 | },
|
2233 | external_system_queueFont: function() {
|
2234 | return {
|
2235 | fontFamily: this.external_system_queueFontFamily,
|
2236 | fontSize: this.external_system_queueFontSize,
|
2237 | fontWeight: this.external_system_queueFontWeight
|
2238 | };
|
2239 | },
|
2240 | containerFont: function() {
|
2241 | return {
|
2242 | fontFamily: this.containerFontFamily,
|
2243 | fontSize: this.containerFontSize,
|
2244 | fontWeight: this.containerFontWeight
|
2245 | };
|
2246 | },
|
2247 | external_containerFont: function() {
|
2248 | return {
|
2249 | fontFamily: this.external_containerFontFamily,
|
2250 | fontSize: this.external_containerFontSize,
|
2251 | fontWeight: this.external_containerFontWeight
|
2252 | };
|
2253 | },
|
2254 | container_dbFont: function() {
|
2255 | return {
|
2256 | fontFamily: this.container_dbFontFamily,
|
2257 | fontSize: this.container_dbFontSize,
|
2258 | fontWeight: this.container_dbFontWeight
|
2259 | };
|
2260 | },
|
2261 | external_container_dbFont: function() {
|
2262 | return {
|
2263 | fontFamily: this.external_container_dbFontFamily,
|
2264 | fontSize: this.external_container_dbFontSize,
|
2265 | fontWeight: this.external_container_dbFontWeight
|
2266 | };
|
2267 | },
|
2268 | container_queueFont: function() {
|
2269 | return {
|
2270 | fontFamily: this.container_queueFontFamily,
|
2271 | fontSize: this.container_queueFontSize,
|
2272 | fontWeight: this.container_queueFontWeight
|
2273 | };
|
2274 | },
|
2275 | external_container_queueFont: function() {
|
2276 | return {
|
2277 | fontFamily: this.external_container_queueFontFamily,
|
2278 | fontSize: this.external_container_queueFontSize,
|
2279 | fontWeight: this.external_container_queueFontWeight
|
2280 | };
|
2281 | },
|
2282 | componentFont: function() {
|
2283 | return {
|
2284 | fontFamily: this.componentFontFamily,
|
2285 | fontSize: this.componentFontSize,
|
2286 | fontWeight: this.componentFontWeight
|
2287 | };
|
2288 | },
|
2289 | external_componentFont: function() {
|
2290 | return {
|
2291 | fontFamily: this.external_componentFontFamily,
|
2292 | fontSize: this.external_componentFontSize,
|
2293 | fontWeight: this.external_componentFontWeight
|
2294 | };
|
2295 | },
|
2296 | component_dbFont: function() {
|
2297 | return {
|
2298 | fontFamily: this.component_dbFontFamily,
|
2299 | fontSize: this.component_dbFontSize,
|
2300 | fontWeight: this.component_dbFontWeight
|
2301 | };
|
2302 | },
|
2303 | external_component_dbFont: function() {
|
2304 | return {
|
2305 | fontFamily: this.external_component_dbFontFamily,
|
2306 | fontSize: this.external_component_dbFontSize,
|
2307 | fontWeight: this.external_component_dbFontWeight
|
2308 | };
|
2309 | },
|
2310 | component_queueFont: function() {
|
2311 | return {
|
2312 | fontFamily: this.component_queueFontFamily,
|
2313 | fontSize: this.component_queueFontSize,
|
2314 | fontWeight: this.component_queueFontWeight
|
2315 | };
|
2316 | },
|
2317 | external_component_queueFont: function() {
|
2318 | return {
|
2319 | fontFamily: this.external_component_queueFontFamily,
|
2320 | fontSize: this.external_component_queueFontSize,
|
2321 | fontWeight: this.external_component_queueFontWeight
|
2322 | };
|
2323 | },
|
2324 | boundaryFont: function() {
|
2325 | return {
|
2326 | fontFamily: this.boundaryFontFamily,
|
2327 | fontSize: this.boundaryFontSize,
|
2328 | fontWeight: this.boundaryFontWeight
|
2329 | };
|
2330 | },
|
2331 | messageFont: function() {
|
2332 | return {
|
2333 | fontFamily: this.messageFontFamily,
|
2334 | fontSize: this.messageFontSize,
|
2335 | fontWeight: this.messageFontWeight
|
2336 | };
|
2337 | }
|
2338 | },
|
2339 | pie: {
|
2340 | ...defaultConfigJson.pie,
|
2341 | useWidth: 984
|
2342 | },
|
2343 | xyChart: {
|
2344 | ...defaultConfigJson.xyChart,
|
2345 | useWidth: void 0
|
2346 | },
|
2347 | requirement: {
|
2348 | ...defaultConfigJson.requirement,
|
2349 | useWidth: void 0
|
2350 | },
|
2351 | gitGraph: {
|
2352 | ...defaultConfigJson.gitGraph,
|
2353 |
|
2354 |
|
2355 |
|
2356 | useMaxWidth: false
|
2357 | },
|
2358 | sankey: {
|
2359 | ...defaultConfigJson.sankey,
|
2360 |
|
2361 |
|
2362 | useMaxWidth: false
|
2363 | }
|
2364 | };
|
2365 | const keyify = (obj, prefix = "") => Object.keys(obj).reduce((res, el) => {
|
2366 | if (Array.isArray(obj[el])) {
|
2367 | return res;
|
2368 | } else if (typeof obj[el] === "object" && obj[el] !== null) {
|
2369 | return [...res, prefix + el, ...keyify(obj[el], "")];
|
2370 | }
|
2371 | return [...res, prefix + el];
|
2372 | }, []);
|
2373 | const configKeys = new Set(keyify(config, ""));
|
2374 | const defaultConfig$2 = config;
|
2375 | const sanitizeDirective = (args) => {
|
2376 | log$1.debug("sanitizeDirective called with", args);
|
2377 | if (typeof args !== "object" || args == null) {
|
2378 | return;
|
2379 | }
|
2380 | if (Array.isArray(args)) {
|
2381 | args.forEach((arg) => sanitizeDirective(arg));
|
2382 | return;
|
2383 | }
|
2384 | for (const key of Object.keys(args)) {
|
2385 | log$1.debug("Checking key", key);
|
2386 | if (key.startsWith("__") || key.includes("proto") || key.includes("constr") || !configKeys.has(key) || args[key] == null) {
|
2387 | log$1.debug("sanitize deleting key: ", key);
|
2388 | delete args[key];
|
2389 | continue;
|
2390 | }
|
2391 | if (typeof args[key] === "object") {
|
2392 | log$1.debug("sanitizing object", key);
|
2393 | sanitizeDirective(args[key]);
|
2394 | continue;
|
2395 | }
|
2396 | const cssMatchers = ["themeCSS", "fontFamily", "altFontFamily"];
|
2397 | for (const cssKey of cssMatchers) {
|
2398 | if (key.includes(cssKey)) {
|
2399 | log$1.debug("sanitizing css option", key);
|
2400 | args[key] = sanitizeCss(args[key]);
|
2401 | }
|
2402 | }
|
2403 | }
|
2404 | if (args.themeVariables) {
|
2405 | for (const k of Object.keys(args.themeVariables)) {
|
2406 | const val = args.themeVariables[k];
|
2407 | if ((val == null ? void 0 : val.match) && !val.match(/^[\d "#%(),.;A-Za-z]+$/)) {
|
2408 | args.themeVariables[k] = "";
|
2409 | }
|
2410 | }
|
2411 | }
|
2412 | log$1.debug("After sanitization", args);
|
2413 | };
|
2414 | const sanitizeCss = (str2) => {
|
2415 | let startCnt = 0;
|
2416 | let endCnt = 0;
|
2417 | for (const element of str2) {
|
2418 | if (startCnt < endCnt) {
|
2419 | return "{ /* ERROR: Unbalanced CSS */ }";
|
2420 | }
|
2421 | if (element === "{") {
|
2422 | startCnt++;
|
2423 | } else if (element === "}") {
|
2424 | endCnt++;
|
2425 | }
|
2426 | }
|
2427 | if (startCnt !== endCnt) {
|
2428 | return "{ /* ERROR: Unbalanced CSS */ }";
|
2429 | }
|
2430 | return str2;
|
2431 | };
|
2432 | const frontMatterRegex = /^-{3}\s*[\n\r](.*?)[\n\r]-{3}\s*[\n\r]+/s;
|
2433 | const directiveRegex = /%{2}{\s*(?:(\w+)\s*:|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi;
|
2434 | const anyCommentRegex = /\s*%%.*\n/gm;
|
2435 | class UnknownDiagramError extends Error {
|
2436 | constructor(message) {
|
2437 | super(message);
|
2438 | this.name = "UnknownDiagramError";
|
2439 | }
|
2440 | }
|
2441 | const detectors = {};
|
2442 | const detectType = function(text, config2) {
|
2443 | text = text.replace(frontMatterRegex, "").replace(directiveRegex, "").replace(anyCommentRegex, "\n");
|
2444 | for (const [key, { detector: detector2 }] of Object.entries(detectors)) {
|
2445 | const diagram2 = detector2(text, config2);
|
2446 | if (diagram2) {
|
2447 | return key;
|
2448 | }
|
2449 | }
|
2450 | throw new UnknownDiagramError(
|
2451 | `No diagram type detected matching given configuration for text: ${text}`
|
2452 | );
|
2453 | };
|
2454 | const registerLazyLoadedDiagrams = (...diagrams2) => {
|
2455 | for (const { id: id2, detector: detector2, loader: loader2 } of diagrams2) {
|
2456 | addDetector(id2, detector2, loader2);
|
2457 | }
|
2458 | };
|
2459 | const addDetector = (key, detector2, loader2) => {
|
2460 | if (detectors[key]) {
|
2461 | log$1.error(`Detector with key ${key} already exists`);
|
2462 | } else {
|
2463 | detectors[key] = { detector: detector2, loader: loader2 };
|
2464 | }
|
2465 | log$1.debug(`Detector with key ${key} added${loader2 ? " with loader" : ""}`);
|
2466 | };
|
2467 | const getDiagramLoader = (key) => {
|
2468 | return detectors[key].loader;
|
2469 | };
|
2470 | const assignWithDepth = (dst, src, { depth = 2, clobber = false } = {}) => {
|
2471 | const config2 = { depth, clobber };
|
2472 | if (Array.isArray(src) && !Array.isArray(dst)) {
|
2473 | src.forEach((s) => assignWithDepth(dst, s, config2));
|
2474 | return dst;
|
2475 | } else if (Array.isArray(src) && Array.isArray(dst)) {
|
2476 | src.forEach((s) => {
|
2477 | if (!dst.includes(s)) {
|
2478 | dst.push(s);
|
2479 | }
|
2480 | });
|
2481 | return dst;
|
2482 | }
|
2483 | if (dst === void 0 || depth <= 0) {
|
2484 | if (dst !== void 0 && dst !== null && typeof dst === "object" && typeof src === "object") {
|
2485 | return Object.assign(dst, src);
|
2486 | } else {
|
2487 | return src;
|
2488 | }
|
2489 | }
|
2490 | if (src !== void 0 && typeof dst === "object" && typeof src === "object") {
|
2491 | Object.keys(src).forEach((key) => {
|
2492 | if (typeof src[key] === "object" && (dst[key] === void 0 || typeof dst[key] === "object")) {
|
2493 | if (dst[key] === void 0) {
|
2494 | dst[key] = Array.isArray(src[key]) ? [] : {};
|
2495 | }
|
2496 | dst[key] = assignWithDepth(dst[key], src[key], { depth: depth - 1, clobber });
|
2497 | } else if (clobber || typeof dst[key] !== "object" && typeof src[key] !== "object") {
|
2498 | dst[key] = src[key];
|
2499 | }
|
2500 | });
|
2501 | }
|
2502 | return dst;
|
2503 | };
|
2504 | const assignWithDepth$1 = assignWithDepth;
|
2505 | const ZERO_WIDTH_SPACE = "";
|
2506 | const d3CurveTypes = {
|
2507 | curveBasis,
|
2508 | curveBasisClosed,
|
2509 | curveBasisOpen,
|
2510 | curveBumpX,
|
2511 | curveBumpY,
|
2512 | curveBundle,
|
2513 | curveCardinalClosed,
|
2514 | curveCardinalOpen,
|
2515 | curveCardinal,
|
2516 | curveCatmullRomClosed,
|
2517 | curveCatmullRomOpen,
|
2518 | curveCatmullRom,
|
2519 | curveLinear,
|
2520 | curveLinearClosed,
|
2521 | curveMonotoneX,
|
2522 | curveMonotoneY,
|
2523 | curveNatural,
|
2524 | curveStep,
|
2525 | curveStepAfter,
|
2526 | curveStepBefore
|
2527 | };
|
2528 | const directiveWithoutOpen = /\s*(?:(\w+)(?=:):|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi;
|
2529 | const detectInit = function(text, config2) {
|
2530 | const inits = detectDirective(text, /(?:init\b)|(?:initialize\b)/);
|
2531 | let results = {};
|
2532 | if (Array.isArray(inits)) {
|
2533 | const args = inits.map((init2) => init2.args);
|
2534 | sanitizeDirective(args);
|
2535 | results = assignWithDepth$1(results, [...args]);
|
2536 | } else {
|
2537 | results = inits.args;
|
2538 | }
|
2539 | if (!results) {
|
2540 | return;
|
2541 | }
|
2542 | let type2 = detectType(text, config2);
|
2543 | const prop = "config";
|
2544 | if (results[prop] !== void 0) {
|
2545 | if (type2 === "flowchart-v2") {
|
2546 | type2 = "flowchart";
|
2547 | }
|
2548 | results[type2] = results[prop];
|
2549 | delete results[prop];
|
2550 | }
|
2551 | return results;
|
2552 | };
|
2553 | const detectDirective = function(text, type2 = null) {
|
2554 | try {
|
2555 | const commentWithoutDirectives = new RegExp(
|
2556 | `[%]{2}(?![{]${directiveWithoutOpen.source})(?=[}][%]{2}).*
|
2557 | `,
|
2558 | "ig"
|
2559 | );
|
2560 | text = text.trim().replace(commentWithoutDirectives, "").replace(/'/gm, '"');
|
2561 | log$1.debug(
|
2562 | `Detecting diagram directive${type2 !== null ? " type:" + type2 : ""} based on the text:${text}`
|
2563 | );
|
2564 | let match;
|
2565 | const result = [];
|
2566 | while ((match = directiveRegex.exec(text)) !== null) {
|
2567 | if (match.index === directiveRegex.lastIndex) {
|
2568 | directiveRegex.lastIndex++;
|
2569 | }
|
2570 | if (match && !type2 || type2 && match[1] && match[1].match(type2) || type2 && match[2] && match[2].match(type2)) {
|
2571 | const type22 = match[1] ? match[1] : match[2];
|
2572 | const args = match[3] ? match[3].trim() : match[4] ? JSON.parse(match[4].trim()) : null;
|
2573 | result.push({ type: type22, args });
|
2574 | }
|
2575 | }
|
2576 | if (result.length === 0) {
|
2577 | return { type: text, args: null };
|
2578 | }
|
2579 | return result.length === 1 ? result[0] : result;
|
2580 | } catch (error) {
|
2581 | log$1.error(
|
2582 | `ERROR: ${error.message} - Unable to parse directive type: '${type2}' based on the text: '${text}'`
|
2583 | );
|
2584 | return { type: void 0, args: null };
|
2585 | }
|
2586 | };
|
2587 | const removeDirectives = function(text) {
|
2588 | return text.replace(directiveRegex, "");
|
2589 | };
|
2590 | const isSubstringInArray = function(str2, arr) {
|
2591 | for (const [i, element] of arr.entries()) {
|
2592 | if (element.match(str2)) {
|
2593 | return i;
|
2594 | }
|
2595 | }
|
2596 | return -1;
|
2597 | };
|
2598 | function interpolateToCurve(interpolate, defaultCurve) {
|
2599 | if (!interpolate) {
|
2600 | return defaultCurve;
|
2601 | }
|
2602 | const curveName = `curve${interpolate.charAt(0).toUpperCase() + interpolate.slice(1)}`;
|
2603 | return d3CurveTypes[curveName] ?? defaultCurve;
|
2604 | }
|
2605 | function formatUrl(linkStr, config2) {
|
2606 | const url = linkStr.trim();
|
2607 | if (!url) {
|
2608 | return void 0;
|
2609 | }
|
2610 | if (config2.securityLevel !== "loose") {
|
2611 | return sanitizeUrl(url);
|
2612 | }
|
2613 | return url;
|
2614 | }
|
2615 | const runFunc = (functionName, ...params) => {
|
2616 | const arrPaths = functionName.split(".");
|
2617 | const len = arrPaths.length - 1;
|
2618 | const fnName = arrPaths[len];
|
2619 | let obj = window;
|
2620 | for (let i = 0; i < len; i++) {
|
2621 | obj = obj[arrPaths[i]];
|
2622 | if (!obj) {
|
2623 | log$1.error(`Function name: ${functionName} not found in window`);
|
2624 | return;
|
2625 | }
|
2626 | }
|
2627 | obj[fnName](...params);
|
2628 | };
|
2629 | function distance(p1, p2) {
|
2630 | if (!p1 || !p2) {
|
2631 | return 0;
|
2632 | }
|
2633 | return Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2));
|
2634 | }
|
2635 | function traverseEdge(points) {
|
2636 | let prevPoint;
|
2637 | let totalDistance = 0;
|
2638 | points.forEach((point) => {
|
2639 | totalDistance += distance(point, prevPoint);
|
2640 | prevPoint = point;
|
2641 | });
|
2642 | const remainingDistance = totalDistance / 2;
|
2643 | return calculatePoint(points, remainingDistance);
|
2644 | }
|
2645 | function calcLabelPosition(points) {
|
2646 | if (points.length === 1) {
|
2647 | return points[0];
|
2648 | }
|
2649 | return traverseEdge(points);
|
2650 | }
|
2651 | const roundNumber = (num, precision = 2) => {
|
2652 | const factor = Math.pow(10, precision);
|
2653 | return Math.round(num * factor) / factor;
|
2654 | };
|
2655 | const calculatePoint = (points, distanceToTraverse) => {
|
2656 | let prevPoint = void 0;
|
2657 | let remainingDistance = distanceToTraverse;
|
2658 | for (const point of points) {
|
2659 | if (prevPoint) {
|
2660 | const vectorDistance = distance(point, prevPoint);
|
2661 | if (vectorDistance < remainingDistance) {
|
2662 | remainingDistance -= vectorDistance;
|
2663 | } else {
|
2664 | const distanceRatio = remainingDistance / vectorDistance;
|
2665 | if (distanceRatio <= 0) {
|
2666 | return prevPoint;
|
2667 | }
|
2668 | if (distanceRatio >= 1) {
|
2669 | return { x: point.x, y: point.y };
|
2670 | }
|
2671 | if (distanceRatio > 0 && distanceRatio < 1) {
|
2672 | return {
|
2673 | x: roundNumber((1 - distanceRatio) * prevPoint.x + distanceRatio * point.x, 5),
|
2674 | y: roundNumber((1 - distanceRatio) * prevPoint.y + distanceRatio * point.y, 5)
|
2675 | };
|
2676 | }
|
2677 | }
|
2678 | }
|
2679 | prevPoint = point;
|
2680 | }
|
2681 | throw new Error("Could not find a suitable point for the given distance");
|
2682 | };
|
2683 | const calcCardinalityPosition = (isRelationTypePresent, points, initialPosition) => {
|
2684 | log$1.info(`our points ${JSON.stringify(points)}`);
|
2685 | if (points[0] !== initialPosition) {
|
2686 | points = points.reverse();
|
2687 | }
|
2688 | const distanceToCardinalityPoint = 25;
|
2689 | const center = calculatePoint(points, distanceToCardinalityPoint);
|
2690 | const d = isRelationTypePresent ? 10 : 5;
|
2691 | const angle = Math.atan2(points[0].y - center.y, points[0].x - center.x);
|
2692 | const cardinalityPosition = { x: 0, y: 0 };
|
2693 | cardinalityPosition.x = Math.sin(angle) * d + (points[0].x + center.x) / 2;
|
2694 | cardinalityPosition.y = -Math.cos(angle) * d + (points[0].y + center.y) / 2;
|
2695 | return cardinalityPosition;
|
2696 | };
|
2697 | function calcTerminalLabelPosition(terminalMarkerSize, position, _points) {
|
2698 | const points = structuredClone(_points);
|
2699 | log$1.info("our points", points);
|
2700 | if (position !== "start_left" && position !== "start_right") {
|
2701 | points.reverse();
|
2702 | }
|
2703 | const distanceToCardinalityPoint = 25 + terminalMarkerSize;
|
2704 | const center = calculatePoint(points, distanceToCardinalityPoint);
|
2705 | const d = 10 + terminalMarkerSize * 0.5;
|
2706 | const angle = Math.atan2(points[0].y - center.y, points[0].x - center.x);
|
2707 | const cardinalityPosition = { x: 0, y: 0 };
|
2708 | if (position === "start_left") {
|
2709 | cardinalityPosition.x = Math.sin(angle + Math.PI) * d + (points[0].x + center.x) / 2;
|
2710 | cardinalityPosition.y = -Math.cos(angle + Math.PI) * d + (points[0].y + center.y) / 2;
|
2711 | } else if (position === "end_right") {
|
2712 | cardinalityPosition.x = Math.sin(angle - Math.PI) * d + (points[0].x + center.x) / 2 - 5;
|
2713 | cardinalityPosition.y = -Math.cos(angle - Math.PI) * d + (points[0].y + center.y) / 2 - 5;
|
2714 | } else if (position === "end_left") {
|
2715 | cardinalityPosition.x = Math.sin(angle) * d + (points[0].x + center.x) / 2 - 5;
|
2716 | cardinalityPosition.y = -Math.cos(angle) * d + (points[0].y + center.y) / 2 - 5;
|
2717 | } else {
|
2718 | cardinalityPosition.x = Math.sin(angle) * d + (points[0].x + center.x) / 2;
|
2719 | cardinalityPosition.y = -Math.cos(angle) * d + (points[0].y + center.y) / 2;
|
2720 | }
|
2721 | return cardinalityPosition;
|
2722 | }
|
2723 | function getStylesFromArray(arr) {
|
2724 | let style = "";
|
2725 | let labelStyle = "";
|
2726 | for (const element of arr) {
|
2727 | if (element !== void 0) {
|
2728 | if (element.startsWith("color:") || element.startsWith("text-align:")) {
|
2729 | labelStyle = labelStyle + element + ";";
|
2730 | } else {
|
2731 | style = style + element + ";";
|
2732 | }
|
2733 | }
|
2734 | }
|
2735 | return { style, labelStyle };
|
2736 | }
|
2737 | let cnt = 0;
|
2738 | const generateId = () => {
|
2739 | cnt++;
|
2740 | return "id-" + Math.random().toString(36).substr(2, 12) + "-" + cnt;
|
2741 | };
|
2742 | function makeRandomHex(length) {
|
2743 | let result = "";
|
2744 | const characters = "0123456789abcdef";
|
2745 | const charactersLength = characters.length;
|
2746 | for (let i = 0; i < length; i++) {
|
2747 | result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
2748 | }
|
2749 | return result;
|
2750 | }
|
2751 | const random = (options) => {
|
2752 | return makeRandomHex(options.length);
|
2753 | };
|
2754 | const getTextObj = function() {
|
2755 | return {
|
2756 | x: 0,
|
2757 | y: 0,
|
2758 | fill: void 0,
|
2759 | anchor: "start",
|
2760 | style: "#666",
|
2761 | width: 100,
|
2762 | height: 100,
|
2763 | textMargin: 0,
|
2764 | rx: 0,
|
2765 | ry: 0,
|
2766 | valign: void 0,
|
2767 | text: ""
|
2768 | };
|
2769 | };
|
2770 | const drawSimpleText = function(elem, textData) {
|
2771 | const nText = textData.text.replace(common$1.lineBreakRegex, " ");
|
2772 | const [, _fontSizePx] = parseFontSize(textData.fontSize);
|
2773 | const textElem = elem.append("text");
|
2774 | textElem.attr("x", textData.x);
|
2775 | textElem.attr("y", textData.y);
|
2776 | textElem.style("text-anchor", textData.anchor);
|
2777 | textElem.style("font-family", textData.fontFamily);
|
2778 | textElem.style("font-size", _fontSizePx);
|
2779 | textElem.style("font-weight", textData.fontWeight);
|
2780 | textElem.attr("fill", textData.fill);
|
2781 | if (textData.class !== void 0) {
|
2782 | textElem.attr("class", textData.class);
|
2783 | }
|
2784 | const span = textElem.append("tspan");
|
2785 | span.attr("x", textData.x + textData.textMargin * 2);
|
2786 | span.attr("fill", textData.fill);
|
2787 | span.text(nText);
|
2788 | return textElem;
|
2789 | };
|
2790 | const wrapLabel = memoize(
|
2791 | (label, maxWidth, config2) => {
|
2792 | if (!label) {
|
2793 | return label;
|
2794 | }
|
2795 | config2 = Object.assign(
|
2796 | { fontSize: 12, fontWeight: 400, fontFamily: "Arial", joinWith: "<br/>" },
|
2797 | config2
|
2798 | );
|
2799 | if (common$1.lineBreakRegex.test(label)) {
|
2800 | return label;
|
2801 | }
|
2802 | const words = label.split(" ");
|
2803 | const completedLines = [];
|
2804 | let nextLine = "";
|
2805 | words.forEach((word, index) => {
|
2806 | const wordLength = calculateTextWidth(`${word} `, config2);
|
2807 | const nextLineLength = calculateTextWidth(nextLine, config2);
|
2808 | if (wordLength > maxWidth) {
|
2809 | const { hyphenatedStrings, remainingWord } = breakString(word, maxWidth, "-", config2);
|
2810 | completedLines.push(nextLine, ...hyphenatedStrings);
|
2811 | nextLine = remainingWord;
|
2812 | } else if (nextLineLength + wordLength >= maxWidth) {
|
2813 | completedLines.push(nextLine);
|
2814 | nextLine = word;
|
2815 | } else {
|
2816 | nextLine = [nextLine, word].filter(Boolean).join(" ");
|
2817 | }
|
2818 | const currentWord = index + 1;
|
2819 | const isLastWord = currentWord === words.length;
|
2820 | if (isLastWord) {
|
2821 | completedLines.push(nextLine);
|
2822 | }
|
2823 | });
|
2824 | return completedLines.filter((line) => line !== "").join(config2.joinWith);
|
2825 | },
|
2826 | (label, maxWidth, config2) => `${label}${maxWidth}${config2.fontSize}${config2.fontWeight}${config2.fontFamily}${config2.joinWith}`
|
2827 | );
|
2828 | const breakString = memoize(
|
2829 | (word, maxWidth, hyphenCharacter = "-", config2) => {
|
2830 | config2 = Object.assign(
|
2831 | { fontSize: 12, fontWeight: 400, fontFamily: "Arial", margin: 0 },
|
2832 | config2
|
2833 | );
|
2834 | const characters = [...word];
|
2835 | const lines = [];
|
2836 | let currentLine = "";
|
2837 | characters.forEach((character, index) => {
|
2838 | const nextLine = `${currentLine}${character}`;
|
2839 | const lineWidth = calculateTextWidth(nextLine, config2);
|
2840 | if (lineWidth >= maxWidth) {
|
2841 | const currentCharacter = index + 1;
|
2842 | const isLastLine = characters.length === currentCharacter;
|
2843 | const hyphenatedNextLine = `${nextLine}${hyphenCharacter}`;
|
2844 | lines.push(isLastLine ? nextLine : hyphenatedNextLine);
|
2845 | currentLine = "";
|
2846 | } else {
|
2847 | currentLine = nextLine;
|
2848 | }
|
2849 | });
|
2850 | return { hyphenatedStrings: lines, remainingWord: currentLine };
|
2851 | },
|
2852 | (word, maxWidth, hyphenCharacter = "-", config2) => `${word}${maxWidth}${hyphenCharacter}${config2.fontSize}${config2.fontWeight}${config2.fontFamily}`
|
2853 | );
|
2854 | function calculateTextHeight(text, config2) {
|
2855 | return calculateTextDimensions(text, config2).height;
|
2856 | }
|
2857 | function calculateTextWidth(text, config2) {
|
2858 | return calculateTextDimensions(text, config2).width;
|
2859 | }
|
2860 | const calculateTextDimensions = memoize(
|
2861 | (text, config2) => {
|
2862 | const { fontSize = 12, fontFamily = "Arial", fontWeight = 400 } = config2;
|
2863 | if (!text) {
|
2864 | return { width: 0, height: 0 };
|
2865 | }
|
2866 | const [, _fontSizePx] = parseFontSize(fontSize);
|
2867 | const fontFamilies = ["sans-serif", fontFamily];
|
2868 | const lines = text.split(common$1.lineBreakRegex);
|
2869 | const dims = [];
|
2870 | const body = select("body");
|
2871 | if (!body.remove) {
|
2872 | return { width: 0, height: 0, lineHeight: 0 };
|
2873 | }
|
2874 | const g = body.append("svg");
|
2875 | for (const fontFamily2 of fontFamilies) {
|
2876 | let cHeight = 0;
|
2877 | const dim = { width: 0, height: 0, lineHeight: 0 };
|
2878 | for (const line of lines) {
|
2879 | const textObj = getTextObj();
|
2880 | textObj.text = line || ZERO_WIDTH_SPACE;
|
2881 | const textElem = drawSimpleText(g, textObj).style("font-size", _fontSizePx).style("font-weight", fontWeight).style("font-family", fontFamily2);
|
2882 | const bBox = (textElem._groups || textElem)[0][0].getBBox();
|
2883 | if (bBox.width === 0 && bBox.height === 0) {
|
2884 | throw new Error("svg element not in render tree");
|
2885 | }
|
2886 | dim.width = Math.round(Math.max(dim.width, bBox.width));
|
2887 | cHeight = Math.round(bBox.height);
|
2888 | dim.height += cHeight;
|
2889 | dim.lineHeight = Math.round(Math.max(dim.lineHeight, cHeight));
|
2890 | }
|
2891 | dims.push(dim);
|
2892 | }
|
2893 | g.remove();
|
2894 | const index = isNaN(dims[1].height) || isNaN(dims[1].width) || isNaN(dims[1].lineHeight) || dims[0].height > dims[1].height && dims[0].width > dims[1].width && dims[0].lineHeight > dims[1].lineHeight ? 0 : 1;
|
2895 | return dims[index];
|
2896 | },
|
2897 | (text, config2) => `${text}${config2.fontSize}${config2.fontWeight}${config2.fontFamily}`
|
2898 | );
|
2899 | class InitIDGenerator {
|
2900 | constructor(deterministic = false, seed) {
|
2901 | this.count = 0;
|
2902 | this.count = seed ? seed.length : 0;
|
2903 | this.next = deterministic ? () => this.count++ : () => Date.now();
|
2904 | }
|
2905 | }
|
2906 | let decoder;
|
2907 | const entityDecode = function(html) {
|
2908 | decoder = decoder || document.createElement("div");
|
2909 | html = escape(html).replace(/%26/g, "&").replace(/%23/g, "#").replace(/%3B/g, ";");
|
2910 | decoder.innerHTML = html;
|
2911 | return unescape(decoder.textContent);
|
2912 | };
|
2913 | function isDetailedError(error) {
|
2914 | return "str" in error;
|
2915 | }
|
2916 | const insertTitle = (parent, cssClass, titleTopMargin, title) => {
|
2917 | var _a;
|
2918 | if (!title) {
|
2919 | return;
|
2920 | }
|
2921 | const bounds = (_a = parent.node()) == null ? void 0 : _a.getBBox();
|
2922 | if (!bounds) {
|
2923 | return;
|
2924 | }
|
2925 | parent.append("text").text(title).attr("x", bounds.x + bounds.width / 2).attr("y", -titleTopMargin).attr("class", cssClass);
|
2926 | };
|
2927 | const parseFontSize = (fontSize) => {
|
2928 | if (typeof fontSize === "number") {
|
2929 | return [fontSize, fontSize + "px"];
|
2930 | }
|
2931 | const fontSizeNumber = parseInt(fontSize ?? "", 10);
|
2932 | if (Number.isNaN(fontSizeNumber)) {
|
2933 | return [void 0, void 0];
|
2934 | } else if (fontSize === String(fontSizeNumber)) {
|
2935 | return [fontSizeNumber, fontSize + "px"];
|
2936 | } else {
|
2937 | return [fontSizeNumber, fontSize];
|
2938 | }
|
2939 | };
|
2940 | function cleanAndMerge(defaultData, data) {
|
2941 | return merge$1({}, defaultData, data);
|
2942 | }
|
2943 | const utils = {
|
2944 | assignWithDepth: assignWithDepth$1,
|
2945 | wrapLabel,
|
2946 | calculateTextHeight,
|
2947 | calculateTextWidth,
|
2948 | calculateTextDimensions,
|
2949 | cleanAndMerge,
|
2950 | detectInit,
|
2951 | detectDirective,
|
2952 | isSubstringInArray,
|
2953 | interpolateToCurve,
|
2954 | calcLabelPosition,
|
2955 | calcCardinalityPosition,
|
2956 | calcTerminalLabelPosition,
|
2957 | formatUrl,
|
2958 | getStylesFromArray,
|
2959 | generateId,
|
2960 | random,
|
2961 | runFunc,
|
2962 | entityDecode,
|
2963 | insertTitle,
|
2964 | parseFontSize,
|
2965 | InitIDGenerator
|
2966 | };
|
2967 | const encodeEntities = function(text) {
|
2968 | let txt = text;
|
2969 | txt = txt.replace(/style.*:\S*#.*;/g, function(s) {
|
2970 | return s.substring(0, s.length - 1);
|
2971 | });
|
2972 | txt = txt.replace(/classDef.*:\S*#.*;/g, function(s) {
|
2973 | return s.substring(0, s.length - 1);
|
2974 | });
|
2975 | txt = txt.replace(/#\w+;/g, function(s) {
|
2976 | const innerTxt = s.substring(1, s.length - 1);
|
2977 | const isInt = /^\+?\d+$/.test(innerTxt);
|
2978 | if (isInt) {
|
2979 | return "fl°°" + innerTxt + "¶ß";
|
2980 | } else {
|
2981 | return "fl°" + innerTxt + "¶ß";
|
2982 | }
|
2983 | });
|
2984 | return txt;
|
2985 | };
|
2986 | const decodeEntities = function(text) {
|
2987 | return text.replace(/fl°°/g, "&#").replace(/fl°/g, "&").replace(/¶ß/g, ";");
|
2988 | };
|
2989 | const version = "10.9.1";
|
2990 | const defaultConfig$1 = Object.freeze(defaultConfig$2);
|
2991 | let siteConfig = assignWithDepth$1({}, defaultConfig$1);
|
2992 | let configFromInitialize;
|
2993 | let directives = [];
|
2994 | let currentConfig = assignWithDepth$1({}, defaultConfig$1);
|
2995 | const updateCurrentConfig = (siteCfg, _directives) => {
|
2996 | let cfg = assignWithDepth$1({}, siteCfg);
|
2997 | let sumOfDirectives = {};
|
2998 | for (const d of _directives) {
|
2999 | sanitize(d);
|
3000 | sumOfDirectives = assignWithDepth$1(sumOfDirectives, d);
|
3001 | }
|
3002 | cfg = assignWithDepth$1(cfg, sumOfDirectives);
|
3003 | if (sumOfDirectives.theme && sumOfDirectives.theme in theme) {
|
3004 | const tmpConfigFromInitialize = assignWithDepth$1({}, configFromInitialize);
|
3005 | const themeVariables = assignWithDepth$1(
|
3006 | tmpConfigFromInitialize.themeVariables || {},
|
3007 | sumOfDirectives.themeVariables
|
3008 | );
|
3009 | if (cfg.theme && cfg.theme in theme) {
|
3010 | cfg.themeVariables = theme[cfg.theme].getThemeVariables(themeVariables);
|
3011 | }
|
3012 | }
|
3013 | currentConfig = cfg;
|
3014 | checkConfig(currentConfig);
|
3015 | return currentConfig;
|
3016 | };
|
3017 | const setSiteConfig = (conf) => {
|
3018 | siteConfig = assignWithDepth$1({}, defaultConfig$1);
|
3019 | siteConfig = assignWithDepth$1(siteConfig, conf);
|
3020 | if (conf.theme && theme[conf.theme]) {
|
3021 | siteConfig.themeVariables = theme[conf.theme].getThemeVariables(conf.themeVariables);
|
3022 | }
|
3023 | updateCurrentConfig(siteConfig, directives);
|
3024 | return siteConfig;
|
3025 | };
|
3026 | const saveConfigFromInitialize = (conf) => {
|
3027 | configFromInitialize = assignWithDepth$1({}, conf);
|
3028 | };
|
3029 | const updateSiteConfig = (conf) => {
|
3030 | siteConfig = assignWithDepth$1(siteConfig, conf);
|
3031 | updateCurrentConfig(siteConfig, directives);
|
3032 | return siteConfig;
|
3033 | };
|
3034 | const getSiteConfig = () => {
|
3035 | return assignWithDepth$1({}, siteConfig);
|
3036 | };
|
3037 | const setConfig$1 = (conf) => {
|
3038 | checkConfig(conf);
|
3039 | assignWithDepth$1(currentConfig, conf);
|
3040 | return getConfig$1();
|
3041 | };
|
3042 | const getConfig$1 = () => {
|
3043 | return assignWithDepth$1({}, currentConfig);
|
3044 | };
|
3045 | const sanitize = (options) => {
|
3046 | if (!options) {
|
3047 | return;
|
3048 | }
|
3049 | ["secure", ...siteConfig.secure ?? []].forEach((key) => {
|
3050 | if (Object.hasOwn(options, key)) {
|
3051 | log$1.debug(`Denied attempt to modify a secure key ${key}`, options[key]);
|
3052 | delete options[key];
|
3053 | }
|
3054 | });
|
3055 | Object.keys(options).forEach((key) => {
|
3056 | if (key.startsWith("__")) {
|
3057 | delete options[key];
|
3058 | }
|
3059 | });
|
3060 | Object.keys(options).forEach((key) => {
|
3061 | if (typeof options[key] === "string" && (options[key].includes("<") || options[key].includes(">") || options[key].includes("url(data:"))) {
|
3062 | delete options[key];
|
3063 | }
|
3064 | if (typeof options[key] === "object") {
|
3065 | sanitize(options[key]);
|
3066 | }
|
3067 | });
|
3068 | };
|
3069 | const addDirective = (directive) => {
|
3070 | sanitizeDirective(directive);
|
3071 | if (directive.fontFamily && (!directive.themeVariables || !directive.themeVariables.fontFamily)) {
|
3072 | directive.themeVariables = { fontFamily: directive.fontFamily };
|
3073 | }
|
3074 | directives.push(directive);
|
3075 | updateCurrentConfig(siteConfig, directives);
|
3076 | };
|
3077 | const reset = (config2 = siteConfig) => {
|
3078 | directives = [];
|
3079 | updateCurrentConfig(config2, directives);
|
3080 | };
|
3081 | const ConfigWarning = {
|
3082 | LAZY_LOAD_DEPRECATED: "The configuration options lazyLoadedDiagrams and loadExternalDiagramsAtStartup are deprecated. Please use registerExternalDiagrams instead."
|
3083 | };
|
3084 | const issuedWarnings = {};
|
3085 | const issueWarning = (warning) => {
|
3086 | if (issuedWarnings[warning]) {
|
3087 | return;
|
3088 | }
|
3089 | log$1.warn(ConfigWarning[warning]);
|
3090 | issuedWarnings[warning] = true;
|
3091 | };
|
3092 | const checkConfig = (config2) => {
|
3093 | if (!config2) {
|
3094 | return;
|
3095 | }
|
3096 | if (config2.lazyLoadedDiagrams || config2.loadExternalDiagramsAtStartup) {
|
3097 | issueWarning("LAZY_LOAD_DEPRECATED");
|
3098 | }
|
3099 | };
|
3100 | const id$l = "c4";
|
3101 | const detector$l = (txt) => {
|
3102 | return /^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(txt);
|
3103 | };
|
3104 | const loader$m = async () => {
|
3105 | const { diagram: diagram2 } = await import("./c4Diagram-ae766693.js");
|
3106 | return { id: id$l, diagram: diagram2 };
|
3107 | };
|
3108 | const plugin$j = {
|
3109 | id: id$l,
|
3110 | detector: detector$l,
|
3111 | loader: loader$m
|
3112 | };
|
3113 | const c4 = plugin$j;
|
3114 | const id$k = "flowchart";
|
3115 | const detector$k = (txt, config2) => {
|
3116 | var _a, _b;
|
3117 | if (((_a = config2 == null ? void 0 : config2.flowchart) == null ? void 0 : _a.defaultRenderer) === "dagre-wrapper" || ((_b = config2 == null ? void 0 : config2.flowchart) == null ? void 0 : _b.defaultRenderer) === "elk") {
|
3118 | return false;
|
3119 | }
|
3120 | return /^\s*graph/.test(txt);
|
3121 | };
|
3122 | const loader$l = async () => {
|
3123 | const { diagram: diagram2 } = await import("./flowDiagram-b222e15a.js");
|
3124 | return { id: id$k, diagram: diagram2 };
|
3125 | };
|
3126 | const plugin$i = {
|
3127 | id: id$k,
|
3128 | detector: detector$k,
|
3129 | loader: loader$l
|
3130 | };
|
3131 | const flowchart = plugin$i;
|
3132 | const id$j = "flowchart-v2";
|
3133 | const detector$j = (txt, config2) => {
|
3134 | var _a, _b, _c;
|
3135 | if (((_a = config2 == null ? void 0 : config2.flowchart) == null ? void 0 : _a.defaultRenderer) === "dagre-d3" || ((_b = config2 == null ? void 0 : config2.flowchart) == null ? void 0 : _b.defaultRenderer) === "elk") {
|
3136 | return false;
|
3137 | }
|
3138 | if (/^\s*graph/.test(txt) && ((_c = config2 == null ? void 0 : config2.flowchart) == null ? void 0 : _c.defaultRenderer) === "dagre-wrapper") {
|
3139 | return true;
|
3140 | }
|
3141 | return /^\s*flowchart/.test(txt);
|
3142 | };
|
3143 | const loader$k = async () => {
|
3144 | const { diagram: diagram2 } = await import("./flowDiagram-v2-13329dc7.js");
|
3145 | return { id: id$j, diagram: diagram2 };
|
3146 | };
|
3147 | const plugin$h = {
|
3148 | id: id$j,
|
3149 | detector: detector$j,
|
3150 | loader: loader$k
|
3151 | };
|
3152 | const flowchartV2 = plugin$h;
|
3153 | const id$i = "er";
|
3154 | const detector$i = (txt) => {
|
3155 | return /^\s*erDiagram/.test(txt);
|
3156 | };
|
3157 | const loader$j = async () => {
|
3158 | const { diagram: diagram2 } = await import("./erDiagram-09d1c15f.js");
|
3159 | return { id: id$i, diagram: diagram2 };
|
3160 | };
|
3161 | const plugin$g = {
|
3162 | id: id$i,
|
3163 | detector: detector$i,
|
3164 | loader: loader$j
|
3165 | };
|
3166 | const er = plugin$g;
|
3167 | const id$h = "gitGraph";
|
3168 | const detector$h = (txt) => {
|
3169 | return /^\s*gitGraph/.test(txt);
|
3170 | };
|
3171 | const loader$i = async () => {
|
3172 | const { diagram: diagram2 } = await import("./gitGraphDiagram-942e62fe.js");
|
3173 | return { id: id$h, diagram: diagram2 };
|
3174 | };
|
3175 | const plugin$f = {
|
3176 | id: id$h,
|
3177 | detector: detector$h,
|
3178 | loader: loader$i
|
3179 | };
|
3180 | const git = plugin$f;
|
3181 | const id$g = "gantt";
|
3182 | const detector$g = (txt) => {
|
3183 | return /^\s*gantt/.test(txt);
|
3184 | };
|
3185 | const loader$h = async () => {
|
3186 | const { diagram: diagram2 } = await import("./ganttDiagram-b62c793e.js");
|
3187 | return { id: id$g, diagram: diagram2 };
|
3188 | };
|
3189 | const plugin$e = {
|
3190 | id: id$g,
|
3191 | detector: detector$g,
|
3192 | loader: loader$h
|
3193 | };
|
3194 | const gantt = plugin$e;
|
3195 | const id$f = "info";
|
3196 | const detector$f = (txt) => {
|
3197 | return /^\s*info/.test(txt);
|
3198 | };
|
3199 | const loader$g = async () => {
|
3200 | const { diagram: diagram2 } = await import("./infoDiagram-94cd232f.js");
|
3201 | return { id: id$f, diagram: diagram2 };
|
3202 | };
|
3203 | const info = {
|
3204 | id: id$f,
|
3205 | detector: detector$f,
|
3206 | loader: loader$g
|
3207 | };
|
3208 | const id$e = "pie";
|
3209 | const detector$e = (txt) => {
|
3210 | return /^\s*pie/.test(txt);
|
3211 | };
|
3212 | const loader$f = async () => {
|
3213 | const { diagram: diagram2 } = await import("./pieDiagram-bb1d19e5.js");
|
3214 | return { id: id$e, diagram: diagram2 };
|
3215 | };
|
3216 | const pie = {
|
3217 | id: id$e,
|
3218 | detector: detector$e,
|
3219 | loader: loader$f
|
3220 | };
|
3221 | const id$d = "quadrantChart";
|
3222 | const detector$d = (txt) => {
|
3223 | return /^\s*quadrantChart/.test(txt);
|
3224 | };
|
3225 | const loader$e = async () => {
|
3226 | const { diagram: diagram2 } = await import("./quadrantDiagram-c759a472.js");
|
3227 | return { id: id$d, diagram: diagram2 };
|
3228 | };
|
3229 | const plugin$d = {
|
3230 | id: id$d,
|
3231 | detector: detector$d,
|
3232 | loader: loader$e
|
3233 | };
|
3234 | const quadrantChart = plugin$d;
|
3235 | const id$c = "xychart";
|
3236 | const detector$c = (txt) => {
|
3237 | return /^\s*xychart-beta/.test(txt);
|
3238 | };
|
3239 | const loader$d = async () => {
|
3240 | const { diagram: diagram2 } = await import("./xychartDiagram-f11f50a6.js");
|
3241 | return { id: id$c, diagram: diagram2 };
|
3242 | };
|
3243 | const plugin$c = {
|
3244 | id: id$c,
|
3245 | detector: detector$c,
|
3246 | loader: loader$d
|
3247 | };
|
3248 | const xychart = plugin$c;
|
3249 | const id$b = "requirement";
|
3250 | const detector$b = (txt) => {
|
3251 | return /^\s*requirement(Diagram)?/.test(txt);
|
3252 | };
|
3253 | const loader$c = async () => {
|
3254 | const { diagram: diagram2 } = await import("./requirementDiagram-87253d64.js");
|
3255 | return { id: id$b, diagram: diagram2 };
|
3256 | };
|
3257 | const plugin$b = {
|
3258 | id: id$b,
|
3259 | detector: detector$b,
|
3260 | loader: loader$c
|
3261 | };
|
3262 | const requirement = plugin$b;
|
3263 | const id$a = "sequence";
|
3264 | const detector$a = (txt) => {
|
3265 | return /^\s*sequenceDiagram/.test(txt);
|
3266 | };
|
3267 | const loader$b = async () => {
|
3268 | const { diagram: diagram2 } = await import("./sequenceDiagram-6894f283.js");
|
3269 | return { id: id$a, diagram: diagram2 };
|
3270 | };
|
3271 | const plugin$a = {
|
3272 | id: id$a,
|
3273 | detector: detector$a,
|
3274 | loader: loader$b
|
3275 | };
|
3276 | const sequence = plugin$a;
|
3277 | const id$9 = "class";
|
3278 | const detector$9 = (txt, config2) => {
|
3279 | var _a;
|
3280 | if (((_a = config2 == null ? void 0 : config2.class) == null ? void 0 : _a.defaultRenderer) === "dagre-wrapper") {
|
3281 | return false;
|
3282 | }
|
3283 | return /^\s*classDiagram/.test(txt);
|
3284 | };
|
3285 | const loader$a = async () => {
|
3286 | const { diagram: diagram2 } = await import("./classDiagram-fb54d2a0.js");
|
3287 | return { id: id$9, diagram: diagram2 };
|
3288 | };
|
3289 | const plugin$9 = {
|
3290 | id: id$9,
|
3291 | detector: detector$9,
|
3292 | loader: loader$a
|
3293 | };
|
3294 | const classDiagram = plugin$9;
|
3295 | const id$8 = "classDiagram";
|
3296 | const detector$8 = (txt, config2) => {
|
3297 | var _a;
|
3298 | if (/^\s*classDiagram/.test(txt) && ((_a = config2 == null ? void 0 : config2.class) == null ? void 0 : _a.defaultRenderer) === "dagre-wrapper") {
|
3299 | return true;
|
3300 | }
|
3301 | return /^\s*classDiagram-v2/.test(txt);
|
3302 | };
|
3303 | const loader$9 = async () => {
|
3304 | const { diagram: diagram2 } = await import("./classDiagram-v2-a2b738ad.js");
|
3305 | return { id: id$8, diagram: diagram2 };
|
3306 | };
|
3307 | const plugin$8 = {
|
3308 | id: id$8,
|
3309 | detector: detector$8,
|
3310 | loader: loader$9
|
3311 | };
|
3312 | const classDiagramV2 = plugin$8;
|
3313 | const id$7 = "state";
|
3314 | const detector$7 = (txt, config2) => {
|
3315 | var _a;
|
3316 | if (((_a = config2 == null ? void 0 : config2.state) == null ? void 0 : _a.defaultRenderer) === "dagre-wrapper") {
|
3317 | return false;
|
3318 | }
|
3319 | return /^\s*stateDiagram/.test(txt);
|
3320 | };
|
3321 | const loader$8 = async () => {
|
3322 | const { diagram: diagram2 } = await import("./stateDiagram-5dee940d.js");
|
3323 | return { id: id$7, diagram: diagram2 };
|
3324 | };
|
3325 | const plugin$7 = {
|
3326 | id: id$7,
|
3327 | detector: detector$7,
|
3328 | loader: loader$8
|
3329 | };
|
3330 | const state = plugin$7;
|
3331 | const id$6 = "stateDiagram";
|
3332 | const detector$6 = (txt, config2) => {
|
3333 | var _a;
|
3334 | if (/^\s*stateDiagram-v2/.test(txt)) {
|
3335 | return true;
|
3336 | }
|
3337 | if (/^\s*stateDiagram/.test(txt) && ((_a = config2 == null ? void 0 : config2.state) == null ? void 0 : _a.defaultRenderer) === "dagre-wrapper") {
|
3338 | return true;
|
3339 | }
|
3340 | return false;
|
3341 | };
|
3342 | const loader$7 = async () => {
|
3343 | const { diagram: diagram2 } = await import("./stateDiagram-v2-1992cada.js");
|
3344 | return { id: id$6, diagram: diagram2 };
|
3345 | };
|
3346 | const plugin$6 = {
|
3347 | id: id$6,
|
3348 | detector: detector$6,
|
3349 | loader: loader$7
|
3350 | };
|
3351 | const stateV2 = plugin$6;
|
3352 | const id$5 = "journey";
|
3353 | const detector$5 = (txt) => {
|
3354 | return /^\s*journey/.test(txt);
|
3355 | };
|
3356 | const loader$6 = async () => {
|
3357 | const { diagram: diagram2 } = await import("./journeyDiagram-6625b456.js");
|
3358 | return { id: id$5, diagram: diagram2 };
|
3359 | };
|
3360 | const plugin$5 = {
|
3361 | id: id$5,
|
3362 | detector: detector$5,
|
3363 | loader: loader$6
|
3364 | };
|
3365 | const journey = plugin$5;
|
3366 | const d3Attrs = function(d3Elem, attrs) {
|
3367 | for (let attr of attrs) {
|
3368 | d3Elem.attr(attr[0], attr[1]);
|
3369 | }
|
3370 | };
|
3371 | const calculateSvgSizeAttrs = function(height, width, useMaxWidth) {
|
3372 | let attrs = new Map();
|
3373 | if (useMaxWidth) {
|
3374 | attrs.set("width", "100%");
|
3375 | attrs.set("style", `max-width: ${width}px;`);
|
3376 | } else {
|
3377 | attrs.set("height", height);
|
3378 | attrs.set("width", width);
|
3379 | }
|
3380 | return attrs;
|
3381 | };
|
3382 | const configureSvgSize = function(svgElem, height, width, useMaxWidth) {
|
3383 | const attrs = calculateSvgSizeAttrs(height, width, useMaxWidth);
|
3384 | d3Attrs(svgElem, attrs);
|
3385 | };
|
3386 | const setupGraphViewbox$1 = function(graph, svgElem, padding, useMaxWidth) {
|
3387 | const svgBounds = svgElem.node().getBBox();
|
3388 | const sWidth = svgBounds.width;
|
3389 | const sHeight = svgBounds.height;
|
3390 | log$1.info(`SVG bounds: ${sWidth}x${sHeight}`, svgBounds);
|
3391 | let width = 0;
|
3392 | let height = 0;
|
3393 | log$1.info(`Graph bounds: ${width}x${height}`, graph);
|
3394 | width = sWidth + padding * 2;
|
3395 | height = sHeight + padding * 2;
|
3396 | log$1.info(`Calculated bounds: ${width}x${height}`);
|
3397 | configureSvgSize(svgElem, height, width, useMaxWidth);
|
3398 | const vBox = `${svgBounds.x - padding} ${svgBounds.y - padding} ${svgBounds.width + 2 * padding} ${svgBounds.height + 2 * padding}`;
|
3399 | svgElem.attr("viewBox", vBox);
|
3400 | };
|
3401 | const themes = {};
|
3402 | const getStyles = (type2, userStyles, options) => {
|
3403 | let diagramStyles = "";
|
3404 | if (type2 in themes && themes[type2]) {
|
3405 | diagramStyles = themes[type2](options);
|
3406 | } else {
|
3407 | log$1.warn(`No theme found for ${type2}`);
|
3408 | }
|
3409 | return ` & {
|
3410 | font-family: ${options.fontFamily};
|
3411 | font-size: ${options.fontSize};
|
3412 | fill: ${options.textColor}
|
3413 | }
|
3414 |
|
3415 | /* Classes common for multiple diagrams */
|
3416 |
|
3417 | & .error-icon {
|
3418 | fill: ${options.errorBkgColor};
|
3419 | }
|
3420 | & .error-text {
|
3421 | fill: ${options.errorTextColor};
|
3422 | stroke: ${options.errorTextColor};
|
3423 | }
|
3424 |
|
3425 | & .edge-thickness-normal {
|
3426 | stroke-width: 2px;
|
3427 | }
|
3428 | & .edge-thickness-thick {
|
3429 | stroke-width: 3.5px
|
3430 | }
|
3431 | & .edge-pattern-solid {
|
3432 | stroke-dasharray: 0;
|
3433 | }
|
3434 |
|
3435 | & .edge-pattern-dashed{
|
3436 | stroke-dasharray: 3;
|
3437 | }
|
3438 | .edge-pattern-dotted {
|
3439 | stroke-dasharray: 2;
|
3440 | }
|
3441 |
|
3442 | & .marker {
|
3443 | fill: ${options.lineColor};
|
3444 | stroke: ${options.lineColor};
|
3445 | }
|
3446 | & .marker.cross {
|
3447 | stroke: ${options.lineColor};
|
3448 | }
|
3449 |
|
3450 | & svg {
|
3451 | font-family: ${options.fontFamily};
|
3452 | font-size: ${options.fontSize};
|
3453 | }
|
3454 |
|
3455 | ${diagramStyles}
|
3456 |
|
3457 | ${userStyles}
|
3458 | `;
|
3459 | };
|
3460 | const addStylesForDiagram = (type2, diagramTheme) => {
|
3461 | if (diagramTheme !== void 0) {
|
3462 | themes[type2] = diagramTheme;
|
3463 | }
|
3464 | };
|
3465 | const getStyles$1 = getStyles;
|
3466 | let accTitle = "";
|
3467 | let diagramTitle = "";
|
3468 | let accDescription = "";
|
3469 | const sanitizeText$1 = (txt) => sanitizeText$2(txt, getConfig$1());
|
3470 | const clear = () => {
|
3471 | accTitle = "";
|
3472 | accDescription = "";
|
3473 | diagramTitle = "";
|
3474 | };
|
3475 | const setAccTitle = (txt) => {
|
3476 | accTitle = sanitizeText$1(txt).replace(/^\s+/g, "");
|
3477 | };
|
3478 | const getAccTitle = () => accTitle;
|
3479 | const setAccDescription = (txt) => {
|
3480 | accDescription = sanitizeText$1(txt).replace(/\n\s+/g, "\n");
|
3481 | };
|
3482 | const getAccDescription = () => accDescription;
|
3483 | const setDiagramTitle = (txt) => {
|
3484 | diagramTitle = sanitizeText$1(txt);
|
3485 | };
|
3486 | const getDiagramTitle = () => diagramTitle;
|
3487 | const commonDb = Object.freeze( Object.defineProperty({
|
3488 | __proto__: null,
|
3489 | clear,
|
3490 | getAccDescription,
|
3491 | getAccTitle,
|
3492 | getDiagramTitle,
|
3493 | setAccDescription,
|
3494 | setAccTitle,
|
3495 | setDiagramTitle
|
3496 | }, Symbol.toStringTag, { value: "Module" }));
|
3497 | const log = log$1;
|
3498 | const setLogLevel = setLogLevel$1;
|
3499 | const getConfig = getConfig$1;
|
3500 | const setConfig = setConfig$1;
|
3501 | const defaultConfig = defaultConfig$1;
|
3502 | const sanitizeText = (text) => sanitizeText$2(text, getConfig());
|
3503 | const setupGraphViewbox = setupGraphViewbox$1;
|
3504 | const getCommonDb = () => {
|
3505 | return commonDb;
|
3506 | };
|
3507 | const diagrams = {};
|
3508 | const registerDiagram = (id2, diagram2, detector2) => {
|
3509 | var _a;
|
3510 | if (diagrams[id2]) {
|
3511 | throw new Error(`Diagram ${id2} already registered.`);
|
3512 | }
|
3513 | diagrams[id2] = diagram2;
|
3514 | if (detector2) {
|
3515 | addDetector(id2, detector2);
|
3516 | }
|
3517 | addStylesForDiagram(id2, diagram2.styles);
|
3518 | (_a = diagram2.injectUtils) == null ? void 0 : _a.call(
|
3519 | diagram2,
|
3520 | log,
|
3521 | setLogLevel,
|
3522 | getConfig,
|
3523 | sanitizeText,
|
3524 | setupGraphViewbox,
|
3525 | getCommonDb(),
|
3526 | () => {
|
3527 | }
|
3528 | );
|
3529 | };
|
3530 | const getDiagram = (name) => {
|
3531 | if (name in diagrams) {
|
3532 | return diagrams[name];
|
3533 | }
|
3534 | throw new DiagramNotFoundError(name);
|
3535 | };
|
3536 | class DiagramNotFoundError extends Error {
|
3537 | constructor(name) {
|
3538 | super(`Diagram ${name} not found.`);
|
3539 | }
|
3540 | }
|
3541 | const selectSvgElement = (id2) => {
|
3542 | var _a;
|
3543 | const { securityLevel } = getConfig();
|
3544 | let root = select("body");
|
3545 | if (securityLevel === "sandbox") {
|
3546 | const sandboxElement = select(`#i${id2}`);
|
3547 | const doc = ((_a = sandboxElement.node()) == null ? void 0 : _a.contentDocument) ?? document;
|
3548 | root = select(doc.body);
|
3549 | }
|
3550 | const svg = root.select(`#${id2}`);
|
3551 | return svg;
|
3552 | };
|
3553 | const draw = (_text, id2, version2) => {
|
3554 | log$1.debug("rendering svg for syntax error\n");
|
3555 | const svg = selectSvgElement(id2);
|
3556 | const g = svg.append("g");
|
3557 | svg.attr("viewBox", "0 0 2412 512");
|
3558 | configureSvgSize(svg, 100, 512, true);
|
3559 | g.append("path").attr("class", "error-icon").attr(
|
3560 | "d",
|
3561 | "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"
|
3562 | );
|
3563 | g.append("path").attr("class", "error-icon").attr(
|
3564 | "d",
|
3565 | "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"
|
3566 | );
|
3567 | g.append("path").attr("class", "error-icon").attr(
|
3568 | "d",
|
3569 | "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"
|
3570 | );
|
3571 | g.append("path").attr("class", "error-icon").attr(
|
3572 | "d",
|
3573 | "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"
|
3574 | );
|
3575 | g.append("path").attr("class", "error-icon").attr(
|
3576 | "d",
|
3577 | "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"
|
3578 | );
|
3579 | g.append("path").attr("class", "error-icon").attr(
|
3580 | "d",
|
3581 | "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"
|
3582 | );
|
3583 | 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");
|
3584 | g.append("text").attr("class", "error-text").attr("x", 1250).attr("y", 400).attr("font-size", "100px").style("text-anchor", "middle").text(`mermaid version ${version2}`);
|
3585 | };
|
3586 | const renderer = { draw };
|
3587 | const errorRenderer = renderer;
|
3588 | const diagram = {
|
3589 | db: {},
|
3590 | renderer,
|
3591 | parser: {
|
3592 | parser: { yy: {} },
|
3593 | parse: () => {
|
3594 | return;
|
3595 | }
|
3596 | }
|
3597 | };
|
3598 | const errorDiagram = diagram;
|
3599 | const id$4 = "flowchart-elk";
|
3600 | const detector$4 = (txt, config2) => {
|
3601 | var _a;
|
3602 | if (
|
3603 |
|
3604 | /^\s*flowchart-elk/.test(txt) ||
|
3605 | /^\s*flowchart|graph/.test(txt) && ((_a = config2 == null ? void 0 : config2.flowchart) == null ? void 0 : _a.defaultRenderer) === "elk"
|
3606 | ) {
|
3607 | return true;
|
3608 | }
|
3609 | return false;
|
3610 | };
|
3611 | const loader$5 = async () => {
|
3612 | const { diagram: diagram2 } = await import("./flowchart-elk-definition-ae0efee6.js");
|
3613 | return { id: id$4, diagram: diagram2 };
|
3614 | };
|
3615 | const plugin$4 = {
|
3616 | id: id$4,
|
3617 | detector: detector$4,
|
3618 | loader: loader$5
|
3619 | };
|
3620 | const flowchartElk = plugin$4;
|
3621 | const id$3 = "timeline";
|
3622 | const detector$3 = (txt) => {
|
3623 | return /^\s*timeline/.test(txt);
|
3624 | };
|
3625 | const loader$4 = async () => {
|
3626 | const { diagram: diagram2 } = await import("./timeline-definition-bf702344.js");
|
3627 | return { id: id$3, diagram: diagram2 };
|
3628 | };
|
3629 | const plugin$3 = {
|
3630 | id: id$3,
|
3631 | detector: detector$3,
|
3632 | loader: loader$4
|
3633 | };
|
3634 | const timeline = plugin$3;
|
3635 | const id$2 = "mindmap";
|
3636 | const detector$2 = (txt) => {
|
3637 | return /^\s*mindmap/.test(txt);
|
3638 | };
|
3639 | const loader$3 = async () => {
|
3640 | const { diagram: diagram2 } = await import("./mindmap-definition-307c710a.js");
|
3641 | return { id: id$2, diagram: diagram2 };
|
3642 | };
|
3643 | const plugin$2 = {
|
3644 | id: id$2,
|
3645 | detector: detector$2,
|
3646 | loader: loader$3
|
3647 | };
|
3648 | const mindmap = plugin$2;
|
3649 | const id$1 = "sankey";
|
3650 | const detector$1 = (txt) => {
|
3651 | return /^\s*sankey-beta/.test(txt);
|
3652 | };
|
3653 | const loader$2 = async () => {
|
3654 | const { diagram: diagram2 } = await import("./sankeyDiagram-707fac0f.js");
|
3655 | return { id: id$1, diagram: diagram2 };
|
3656 | };
|
3657 | const plugin$1 = {
|
3658 | id: id$1,
|
3659 | detector: detector$1,
|
3660 | loader: loader$2
|
3661 | };
|
3662 | const sankey = plugin$1;
|
3663 | const id = "block";
|
3664 | const detector = (txt) => {
|
3665 | return /^\s*block-beta/.test(txt);
|
3666 | };
|
3667 | const loader$1 = async () => {
|
3668 | const { diagram: diagram2 } = await import("./blockDiagram-9f4a6865.js");
|
3669 | return { id, diagram: diagram2 };
|
3670 | };
|
3671 | const plugin = {
|
3672 | id,
|
3673 | detector,
|
3674 | loader: loader$1
|
3675 | };
|
3676 | const block = plugin;
|
3677 | let hasLoadedDiagrams = false;
|
3678 | const addDiagrams = () => {
|
3679 | if (hasLoadedDiagrams) {
|
3680 | return;
|
3681 | }
|
3682 | hasLoadedDiagrams = true;
|
3683 | registerDiagram("error", errorDiagram, (text) => {
|
3684 | return text.toLowerCase().trim() === "error";
|
3685 | });
|
3686 | registerDiagram(
|
3687 | "---",
|
3688 |
|
3689 | {
|
3690 | db: {
|
3691 | clear: () => {
|
3692 | }
|
3693 | },
|
3694 | styles: {},
|
3695 |
|
3696 | renderer: {
|
3697 | draw: () => {
|
3698 | }
|
3699 | },
|
3700 | parser: {
|
3701 | parser: { yy: {} },
|
3702 | parse: () => {
|
3703 | throw new Error(
|
3704 | "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"
|
3705 | );
|
3706 | }
|
3707 | },
|
3708 | init: () => null
|
3709 |
|
3710 | },
|
3711 | (text) => {
|
3712 | return text.toLowerCase().trimStart().startsWith("---");
|
3713 | }
|
3714 | );
|
3715 | registerLazyLoadedDiagrams(
|
3716 | c4,
|
3717 | classDiagramV2,
|
3718 | classDiagram,
|
3719 | er,
|
3720 | gantt,
|
3721 | info,
|
3722 | pie,
|
3723 | requirement,
|
3724 | sequence,
|
3725 | flowchartElk,
|
3726 | flowchartV2,
|
3727 | flowchart,
|
3728 | mindmap,
|
3729 | timeline,
|
3730 | git,
|
3731 | stateV2,
|
3732 | state,
|
3733 | journey,
|
3734 | quadrantChart,
|
3735 | sankey,
|
3736 | xychart,
|
3737 | block
|
3738 | );
|
3739 | };
|
3740 | class Diagram {
|
3741 | constructor(text, metadata = {}) {
|
3742 | this.text = text;
|
3743 | this.metadata = metadata;
|
3744 | this.type = "graph";
|
3745 | this.text = encodeEntities(text);
|
3746 | this.text += "\n";
|
3747 | const cnf = getConfig$1();
|
3748 | try {
|
3749 | this.type = detectType(text, cnf);
|
3750 | } catch (e) {
|
3751 | this.type = "error";
|
3752 | this.detectError = e;
|
3753 | }
|
3754 | const diagram2 = getDiagram(this.type);
|
3755 | log$1.debug("Type " + this.type);
|
3756 | this.db = diagram2.db;
|
3757 | this.renderer = diagram2.renderer;
|
3758 | this.parser = diagram2.parser;
|
3759 | this.parser.parser.yy = this.db;
|
3760 | this.init = diagram2.init;
|
3761 | this.parse();
|
3762 | }
|
3763 | parse() {
|
3764 | var _a, _b, _c, _d, _e;
|
3765 | if (this.detectError) {
|
3766 | throw this.detectError;
|
3767 | }
|
3768 | (_b = (_a = this.db).clear) == null ? void 0 : _b.call(_a);
|
3769 | const config2 = getConfig$1();
|
3770 | (_c = this.init) == null ? void 0 : _c.call(this, config2);
|
3771 | if (this.metadata.title) {
|
3772 | (_e = (_d = this.db).setDiagramTitle) == null ? void 0 : _e.call(_d, this.metadata.title);
|
3773 | }
|
3774 | this.parser.parse(this.text);
|
3775 | }
|
3776 | async render(id2, version2) {
|
3777 | await this.renderer.draw(this.text, id2, version2, this);
|
3778 | }
|
3779 | getParser() {
|
3780 | return this.parser;
|
3781 | }
|
3782 | getType() {
|
3783 | return this.type;
|
3784 | }
|
3785 | }
|
3786 | const getDiagramFromText$1 = async (text, metadata = {}) => {
|
3787 | const type2 = detectType(text, getConfig$1());
|
3788 | try {
|
3789 | getDiagram(type2);
|
3790 | } catch (error) {
|
3791 | const loader2 = getDiagramLoader(type2);
|
3792 | if (!loader2) {
|
3793 | throw new UnknownDiagramError(`Diagram ${type2} not found.`);
|
3794 | }
|
3795 | const { id: id2, diagram: diagram2 } = await loader2();
|
3796 | registerDiagram(id2, diagram2);
|
3797 | }
|
3798 | return new Diagram(text, metadata);
|
3799 | };
|
3800 | let interactionFunctions = [];
|
3801 | const attachFunctions = () => {
|
3802 | interactionFunctions.forEach((f) => {
|
3803 | f();
|
3804 | });
|
3805 | interactionFunctions = [];
|
3806 | };
|
3807 | const SVG_ROLE = "graphics-document document";
|
3808 | function setA11yDiagramInfo(svg, diagramType) {
|
3809 | svg.attr("role", SVG_ROLE);
|
3810 | if (diagramType !== "") {
|
3811 | svg.attr("aria-roledescription", diagramType);
|
3812 | }
|
3813 | }
|
3814 | function addSVGa11yTitleDescription(svg, a11yTitle, a11yDesc, baseId) {
|
3815 | if (svg.insert === void 0) {
|
3816 | return;
|
3817 | }
|
3818 | if (a11yDesc) {
|
3819 | const descId = `chart-desc-${baseId}`;
|
3820 | svg.attr("aria-describedby", descId);
|
3821 | svg.insert("desc", ":first-child").attr("id", descId).text(a11yDesc);
|
3822 | }
|
3823 | if (a11yTitle) {
|
3824 | const titleId = `chart-title-${baseId}`;
|
3825 | svg.attr("aria-labelledby", titleId);
|
3826 | svg.insert("title", ":first-child").attr("id", titleId).text(a11yTitle);
|
3827 | }
|
3828 | }
|
3829 | const cleanupComments = (text) => {
|
3830 | return text.replace(/^\s*%%(?!{)[^\n]+\n?/gm, "").trimStart();
|
3831 | };
|
3832 |
|
3833 | function isNothing(subject) {
|
3834 | return typeof subject === "undefined" || subject === null;
|
3835 | }
|
3836 | function isObject(subject) {
|
3837 | return typeof subject === "object" && subject !== null;
|
3838 | }
|
3839 | function toArray(sequence2) {
|
3840 | if (Array.isArray(sequence2))
|
3841 | return sequence2;
|
3842 | else if (isNothing(sequence2))
|
3843 | return [];
|
3844 | return [sequence2];
|
3845 | }
|
3846 | function extend(target, source) {
|
3847 | var index, length, key, sourceKeys;
|
3848 | if (source) {
|
3849 | sourceKeys = Object.keys(source);
|
3850 | for (index = 0, length = sourceKeys.length; index < length; index += 1) {
|
3851 | key = sourceKeys[index];
|
3852 | target[key] = source[key];
|
3853 | }
|
3854 | }
|
3855 | return target;
|
3856 | }
|
3857 | function repeat(string, count) {
|
3858 | var result = "", cycle;
|
3859 | for (cycle = 0; cycle < count; cycle += 1) {
|
3860 | result += string;
|
3861 | }
|
3862 | return result;
|
3863 | }
|
3864 | function isNegativeZero(number) {
|
3865 | return number === 0 && Number.NEGATIVE_INFINITY === 1 / number;
|
3866 | }
|
3867 | var isNothing_1 = isNothing;
|
3868 | var isObject_1 = isObject;
|
3869 | var toArray_1 = toArray;
|
3870 | var repeat_1 = repeat;
|
3871 | var isNegativeZero_1 = isNegativeZero;
|
3872 | var extend_1 = extend;
|
3873 | var common = {
|
3874 | isNothing: isNothing_1,
|
3875 | isObject: isObject_1,
|
3876 | toArray: toArray_1,
|
3877 | repeat: repeat_1,
|
3878 | isNegativeZero: isNegativeZero_1,
|
3879 | extend: extend_1
|
3880 | };
|
3881 | function formatError(exception2, compact) {
|
3882 | var where = "", message = exception2.reason || "(unknown reason)";
|
3883 | if (!exception2.mark)
|
3884 | return message;
|
3885 | if (exception2.mark.name) {
|
3886 | where += 'in "' + exception2.mark.name + '" ';
|
3887 | }
|
3888 | where += "(" + (exception2.mark.line + 1) + ":" + (exception2.mark.column + 1) + ")";
|
3889 | if (!compact && exception2.mark.snippet) {
|
3890 | where += "\n\n" + exception2.mark.snippet;
|
3891 | }
|
3892 | return message + " " + where;
|
3893 | }
|
3894 | function YAMLException$1(reason, mark) {
|
3895 | Error.call(this);
|
3896 | this.name = "YAMLException";
|
3897 | this.reason = reason;
|
3898 | this.mark = mark;
|
3899 | this.message = formatError(this, false);
|
3900 | if (Error.captureStackTrace) {
|
3901 | Error.captureStackTrace(this, this.constructor);
|
3902 | } else {
|
3903 | this.stack = new Error().stack || "";
|
3904 | }
|
3905 | }
|
3906 | YAMLException$1.prototype = Object.create(Error.prototype);
|
3907 | YAMLException$1.prototype.constructor = YAMLException$1;
|
3908 | YAMLException$1.prototype.toString = function toString(compact) {
|
3909 | return this.name + ": " + formatError(this, compact);
|
3910 | };
|
3911 | var exception = YAMLException$1;
|
3912 | function getLine(buffer, lineStart, lineEnd, position, maxLineLength) {
|
3913 | var head = "";
|
3914 | var tail = "";
|
3915 | var maxHalfLength = Math.floor(maxLineLength / 2) - 1;
|
3916 | if (position - lineStart > maxHalfLength) {
|
3917 | head = " ... ";
|
3918 | lineStart = position - maxHalfLength + head.length;
|
3919 | }
|
3920 | if (lineEnd - position > maxHalfLength) {
|
3921 | tail = " ...";
|
3922 | lineEnd = position + maxHalfLength - tail.length;
|
3923 | }
|
3924 | return {
|
3925 | str: head + buffer.slice(lineStart, lineEnd).replace(/\t/g, "→") + tail,
|
3926 | pos: position - lineStart + head.length
|
3927 |
|
3928 | };
|
3929 | }
|
3930 | function padStart(string, max) {
|
3931 | return common.repeat(" ", max - string.length) + string;
|
3932 | }
|
3933 | function makeSnippet(mark, options) {
|
3934 | options = Object.create(options || null);
|
3935 | if (!mark.buffer)
|
3936 | return null;
|
3937 | if (!options.maxLength)
|
3938 | options.maxLength = 79;
|
3939 | if (typeof options.indent !== "number")
|
3940 | options.indent = 1;
|
3941 | if (typeof options.linesBefore !== "number")
|
3942 | options.linesBefore = 3;
|
3943 | if (typeof options.linesAfter !== "number")
|
3944 | options.linesAfter = 2;
|
3945 | var re = /\r?\n|\r|\0/g;
|
3946 | var lineStarts = [0];
|
3947 | var lineEnds = [];
|
3948 | var match;
|
3949 | var foundLineNo = -1;
|
3950 | while (match = re.exec(mark.buffer)) {
|
3951 | lineEnds.push(match.index);
|
3952 | lineStarts.push(match.index + match[0].length);
|
3953 | if (mark.position <= match.index && foundLineNo < 0) {
|
3954 | foundLineNo = lineStarts.length - 2;
|
3955 | }
|
3956 | }
|
3957 | if (foundLineNo < 0)
|
3958 | foundLineNo = lineStarts.length - 1;
|
3959 | var result = "", i, line;
|
3960 | var lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length;
|
3961 | var maxLineLength = options.maxLength - (options.indent + lineNoLength + 3);
|
3962 | for (i = 1; i <= options.linesBefore; i++) {
|
3963 | if (foundLineNo - i < 0)
|
3964 | break;
|
3965 | line = getLine(
|
3966 | mark.buffer,
|
3967 | lineStarts[foundLineNo - i],
|
3968 | lineEnds[foundLineNo - i],
|
3969 | mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]),
|
3970 | maxLineLength
|
3971 | );
|
3972 | result = common.repeat(" ", options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) + " | " + line.str + "\n" + result;
|
3973 | }
|
3974 | line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength);
|
3975 | result += common.repeat(" ", options.indent) + padStart((mark.line + 1).toString(), lineNoLength) + " | " + line.str + "\n";
|
3976 | result += common.repeat("-", options.indent + lineNoLength + 3 + line.pos) + "^\n";
|
3977 | for (i = 1; i <= options.linesAfter; i++) {
|
3978 | if (foundLineNo + i >= lineEnds.length)
|
3979 | break;
|
3980 | line = getLine(
|
3981 | mark.buffer,
|
3982 | lineStarts[foundLineNo + i],
|
3983 | lineEnds[foundLineNo + i],
|
3984 | mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]),
|
3985 | maxLineLength
|
3986 | );
|
3987 | result += common.repeat(" ", options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) + " | " + line.str + "\n";
|
3988 | }
|
3989 | return result.replace(/\n$/, "");
|
3990 | }
|
3991 | var snippet = makeSnippet;
|
3992 | var TYPE_CONSTRUCTOR_OPTIONS = [
|
3993 | "kind",
|
3994 | "multi",
|
3995 | "resolve",
|
3996 | "construct",
|
3997 | "instanceOf",
|
3998 | "predicate",
|
3999 | "represent",
|
4000 | "representName",
|
4001 | "defaultStyle",
|
4002 | "styleAliases"
|
4003 | ];
|
4004 | var YAML_NODE_KINDS = [
|
4005 | "scalar",
|
4006 | "sequence",
|
4007 | "mapping"
|
4008 | ];
|
4009 | function compileStyleAliases(map2) {
|
4010 | var result = {};
|
4011 | if (map2 !== null) {
|
4012 | Object.keys(map2).forEach(function(style) {
|
4013 | map2[style].forEach(function(alias) {
|
4014 | result[String(alias)] = style;
|
4015 | });
|
4016 | });
|
4017 | }
|
4018 | return result;
|
4019 | }
|
4020 | function Type$1(tag, options) {
|
4021 | options = options || {};
|
4022 | Object.keys(options).forEach(function(name) {
|
4023 | if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
|
4024 | throw new exception('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
|
4025 | }
|
4026 | });
|
4027 | this.options = options;
|
4028 | this.tag = tag;
|
4029 | this.kind = options["kind"] || null;
|
4030 | this.resolve = options["resolve"] || function() {
|
4031 | return true;
|
4032 | };
|
4033 | this.construct = options["construct"] || function(data) {
|
4034 | return data;
|
4035 | };
|
4036 | this.instanceOf = options["instanceOf"] || null;
|
4037 | this.predicate = options["predicate"] || null;
|
4038 | this.represent = options["represent"] || null;
|
4039 | this.representName = options["representName"] || null;
|
4040 | this.defaultStyle = options["defaultStyle"] || null;
|
4041 | this.multi = options["multi"] || false;
|
4042 | this.styleAliases = compileStyleAliases(options["styleAliases"] || null);
|
4043 | if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {
|
4044 | throw new exception('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
|
4045 | }
|
4046 | }
|
4047 | var type = Type$1;
|
4048 | function compileList(schema2, name) {
|
4049 | var result = [];
|
4050 | schema2[name].forEach(function(currentType) {
|
4051 | var newIndex = result.length;
|
4052 | result.forEach(function(previousType, previousIndex) {
|
4053 | if (previousType.tag === currentType.tag && previousType.kind === currentType.kind && previousType.multi === currentType.multi) {
|
4054 | newIndex = previousIndex;
|
4055 | }
|
4056 | });
|
4057 | result[newIndex] = currentType;
|
4058 | });
|
4059 | return result;
|
4060 | }
|
4061 | function compileMap() {
|
4062 | var result = {
|
4063 | scalar: {},
|
4064 | sequence: {},
|
4065 | mapping: {},
|
4066 | fallback: {},
|
4067 | multi: {
|
4068 | scalar: [],
|
4069 | sequence: [],
|
4070 | mapping: [],
|
4071 | fallback: []
|
4072 | }
|
4073 | }, index, length;
|
4074 | function collectType(type2) {
|
4075 | if (type2.multi) {
|
4076 | result.multi[type2.kind].push(type2);
|
4077 | result.multi["fallback"].push(type2);
|
4078 | } else {
|
4079 | result[type2.kind][type2.tag] = result["fallback"][type2.tag] = type2;
|
4080 | }
|
4081 | }
|
4082 | for (index = 0, length = arguments.length; index < length; index += 1) {
|
4083 | arguments[index].forEach(collectType);
|
4084 | }
|
4085 | return result;
|
4086 | }
|
4087 | function Schema$1(definition) {
|
4088 | return this.extend(definition);
|
4089 | }
|
4090 | Schema$1.prototype.extend = function extend2(definition) {
|
4091 | var implicit = [];
|
4092 | var explicit = [];
|
4093 | if (definition instanceof type) {
|
4094 | explicit.push(definition);
|
4095 | } else if (Array.isArray(definition)) {
|
4096 | explicit = explicit.concat(definition);
|
4097 | } else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) {
|
4098 | if (definition.implicit)
|
4099 | implicit = implicit.concat(definition.implicit);
|
4100 | if (definition.explicit)
|
4101 | explicit = explicit.concat(definition.explicit);
|
4102 | } else {
|
4103 | throw new exception("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");
|
4104 | }
|
4105 | implicit.forEach(function(type$1) {
|
4106 | if (!(type$1 instanceof type)) {
|
4107 | throw new exception("Specified list of YAML types (or a single Type object) contains a non-Type object.");
|
4108 | }
|
4109 | if (type$1.loadKind && type$1.loadKind !== "scalar") {
|
4110 | throw new exception("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");
|
4111 | }
|
4112 | if (type$1.multi) {
|
4113 | throw new exception("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.");
|
4114 | }
|
4115 | });
|
4116 | explicit.forEach(function(type$1) {
|
4117 | if (!(type$1 instanceof type)) {
|
4118 | throw new exception("Specified list of YAML types (or a single Type object) contains a non-Type object.");
|
4119 | }
|
4120 | });
|
4121 | var result = Object.create(Schema$1.prototype);
|
4122 | result.implicit = (this.implicit || []).concat(implicit);
|
4123 | result.explicit = (this.explicit || []).concat(explicit);
|
4124 | result.compiledImplicit = compileList(result, "implicit");
|
4125 | result.compiledExplicit = compileList(result, "explicit");
|
4126 | result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit);
|
4127 | return result;
|
4128 | };
|
4129 | var schema = Schema$1;
|
4130 | var str = new type("tag:yaml.org,2002:str", {
|
4131 | kind: "scalar",
|
4132 | construct: function(data) {
|
4133 | return data !== null ? data : "";
|
4134 | }
|
4135 | });
|
4136 | var seq = new type("tag:yaml.org,2002:seq", {
|
4137 | kind: "sequence",
|
4138 | construct: function(data) {
|
4139 | return data !== null ? data : [];
|
4140 | }
|
4141 | });
|
4142 | var map = new type("tag:yaml.org,2002:map", {
|
4143 | kind: "mapping",
|
4144 | construct: function(data) {
|
4145 | return data !== null ? data : {};
|
4146 | }
|
4147 | });
|
4148 | var failsafe = new schema({
|
4149 | explicit: [
|
4150 | str,
|
4151 | seq,
|
4152 | map
|
4153 | ]
|
4154 | });
|
4155 | function resolveYamlNull(data) {
|
4156 | if (data === null)
|
4157 | return true;
|
4158 | var max = data.length;
|
4159 | return max === 1 && data === "~" || max === 4 && (data === "null" || data === "Null" || data === "NULL");
|
4160 | }
|
4161 | function constructYamlNull() {
|
4162 | return null;
|
4163 | }
|
4164 | function isNull(object) {
|
4165 | return object === null;
|
4166 | }
|
4167 | var _null = new type("tag:yaml.org,2002:null", {
|
4168 | kind: "scalar",
|
4169 | resolve: resolveYamlNull,
|
4170 | construct: constructYamlNull,
|
4171 | predicate: isNull,
|
4172 | represent: {
|
4173 | canonical: function() {
|
4174 | return "~";
|
4175 | },
|
4176 | lowercase: function() {
|
4177 | return "null";
|
4178 | },
|
4179 | uppercase: function() {
|
4180 | return "NULL";
|
4181 | },
|
4182 | camelcase: function() {
|
4183 | return "Null";
|
4184 | },
|
4185 | empty: function() {
|
4186 | return "";
|
4187 | }
|
4188 | },
|
4189 | defaultStyle: "lowercase"
|
4190 | });
|
4191 | function resolveYamlBoolean(data) {
|
4192 | if (data === null)
|
4193 | return false;
|
4194 | var max = data.length;
|
4195 | return max === 4 && (data === "true" || data === "True" || data === "TRUE") || max === 5 && (data === "false" || data === "False" || data === "FALSE");
|
4196 | }
|
4197 | function constructYamlBoolean(data) {
|
4198 | return data === "true" || data === "True" || data === "TRUE";
|
4199 | }
|
4200 | function isBoolean(object) {
|
4201 | return Object.prototype.toString.call(object) === "[object Boolean]";
|
4202 | }
|
4203 | var bool = new type("tag:yaml.org,2002:bool", {
|
4204 | kind: "scalar",
|
4205 | resolve: resolveYamlBoolean,
|
4206 | construct: constructYamlBoolean,
|
4207 | predicate: isBoolean,
|
4208 | represent: {
|
4209 | lowercase: function(object) {
|
4210 | return object ? "true" : "false";
|
4211 | },
|
4212 | uppercase: function(object) {
|
4213 | return object ? "TRUE" : "FALSE";
|
4214 | },
|
4215 | camelcase: function(object) {
|
4216 | return object ? "True" : "False";
|
4217 | }
|
4218 | },
|
4219 | defaultStyle: "lowercase"
|
4220 | });
|
4221 | function isHexCode(c) {
|
4222 | return 48 <= c && c <= 57 || 65 <= c && c <= 70 || 97 <= c && c <= 102;
|
4223 | }
|
4224 | function isOctCode(c) {
|
4225 | return 48 <= c && c <= 55;
|
4226 | }
|
4227 | function isDecCode(c) {
|
4228 | return 48 <= c && c <= 57;
|
4229 | }
|
4230 | function resolveYamlInteger(data) {
|
4231 | if (data === null)
|
4232 | return false;
|
4233 | var max = data.length, index = 0, hasDigits = false, ch;
|
4234 | if (!max)
|
4235 | return false;
|
4236 | ch = data[index];
|
4237 | if (ch === "-" || ch === "+") {
|
4238 | ch = data[++index];
|
4239 | }
|
4240 | if (ch === "0") {
|
4241 | if (index + 1 === max)
|
4242 | return true;
|
4243 | ch = data[++index];
|
4244 | if (ch === "b") {
|
4245 | index++;
|
4246 | for (; index < max; index++) {
|
4247 | ch = data[index];
|
4248 | if (ch === "_")
|
4249 | continue;
|
4250 | if (ch !== "0" && ch !== "1")
|
4251 | return false;
|
4252 | hasDigits = true;
|
4253 | }
|
4254 | return hasDigits && ch !== "_";
|
4255 | }
|
4256 | if (ch === "x") {
|
4257 | index++;
|
4258 | for (; index < max; index++) {
|
4259 | ch = data[index];
|
4260 | if (ch === "_")
|
4261 | continue;
|
4262 | if (!isHexCode(data.charCodeAt(index)))
|
4263 | return false;
|
4264 | hasDigits = true;
|
4265 | }
|
4266 | return hasDigits && ch !== "_";
|
4267 | }
|
4268 | if (ch === "o") {
|
4269 | index++;
|
4270 | for (; index < max; index++) {
|
4271 | ch = data[index];
|
4272 | if (ch === "_")
|
4273 | continue;
|
4274 | if (!isOctCode(data.charCodeAt(index)))
|
4275 | return false;
|
4276 | hasDigits = true;
|
4277 | }
|
4278 | return hasDigits && ch !== "_";
|
4279 | }
|
4280 | }
|
4281 | if (ch === "_")
|
4282 | return false;
|
4283 | for (; index < max; index++) {
|
4284 | ch = data[index];
|
4285 | if (ch === "_")
|
4286 | continue;
|
4287 | if (!isDecCode(data.charCodeAt(index))) {
|
4288 | return false;
|
4289 | }
|
4290 | hasDigits = true;
|
4291 | }
|
4292 | if (!hasDigits || ch === "_")
|
4293 | return false;
|
4294 | return true;
|
4295 | }
|
4296 | function constructYamlInteger(data) {
|
4297 | var value = data, sign = 1, ch;
|
4298 | if (value.indexOf("_") !== -1) {
|
4299 | value = value.replace(/_/g, "");
|
4300 | }
|
4301 | ch = value[0];
|
4302 | if (ch === "-" || ch === "+") {
|
4303 | if (ch === "-")
|
4304 | sign = -1;
|
4305 | value = value.slice(1);
|
4306 | ch = value[0];
|
4307 | }
|
4308 | if (value === "0")
|
4309 | return 0;
|
4310 | if (ch === "0") {
|
4311 | if (value[1] === "b")
|
4312 | return sign * parseInt(value.slice(2), 2);
|
4313 | if (value[1] === "x")
|
4314 | return sign * parseInt(value.slice(2), 16);
|
4315 | if (value[1] === "o")
|
4316 | return sign * parseInt(value.slice(2), 8);
|
4317 | }
|
4318 | return sign * parseInt(value, 10);
|
4319 | }
|
4320 | function isInteger(object) {
|
4321 | return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 === 0 && !common.isNegativeZero(object));
|
4322 | }
|
4323 | var int = new type("tag:yaml.org,2002:int", {
|
4324 | kind: "scalar",
|
4325 | resolve: resolveYamlInteger,
|
4326 | construct: constructYamlInteger,
|
4327 | predicate: isInteger,
|
4328 | represent: {
|
4329 | binary: function(obj) {
|
4330 | return obj >= 0 ? "0b" + obj.toString(2) : "-0b" + obj.toString(2).slice(1);
|
4331 | },
|
4332 | octal: function(obj) {
|
4333 | return obj >= 0 ? "0o" + obj.toString(8) : "-0o" + obj.toString(8).slice(1);
|
4334 | },
|
4335 | decimal: function(obj) {
|
4336 | return obj.toString(10);
|
4337 | },
|
4338 |
|
4339 | hexadecimal: function(obj) {
|
4340 | return obj >= 0 ? "0x" + obj.toString(16).toUpperCase() : "-0x" + obj.toString(16).toUpperCase().slice(1);
|
4341 | }
|
4342 | },
|
4343 | defaultStyle: "decimal",
|
4344 | styleAliases: {
|
4345 | binary: [2, "bin"],
|
4346 | octal: [8, "oct"],
|
4347 | decimal: [10, "dec"],
|
4348 | hexadecimal: [16, "hex"]
|
4349 | }
|
4350 | });
|
4351 | var YAML_FLOAT_PATTERN = new RegExp(
|
4352 |
|
4353 | "^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"
|
4354 | );
|
4355 | function resolveYamlFloat(data) {
|
4356 | if (data === null)
|
4357 | return false;
|
4358 | if (!YAML_FLOAT_PATTERN.test(data) ||
|
4359 |
|
4360 | data[data.length - 1] === "_") {
|
4361 | return false;
|
4362 | }
|
4363 | return true;
|
4364 | }
|
4365 | function constructYamlFloat(data) {
|
4366 | var value, sign;
|
4367 | value = data.replace(/_/g, "").toLowerCase();
|
4368 | sign = value[0] === "-" ? -1 : 1;
|
4369 | if ("+-".indexOf(value[0]) >= 0) {
|
4370 | value = value.slice(1);
|
4371 | }
|
4372 | if (value === ".inf") {
|
4373 | return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
|
4374 | } else if (value === ".nan") {
|
4375 | return NaN;
|
4376 | }
|
4377 | return sign * parseFloat(value, 10);
|
4378 | }
|
4379 | var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
|
4380 | function representYamlFloat(object, style) {
|
4381 | var res;
|
4382 | if (isNaN(object)) {
|
4383 | switch (style) {
|
4384 | case "lowercase":
|
4385 | return ".nan";
|
4386 | case "uppercase":
|
4387 | return ".NAN";
|
4388 | case "camelcase":
|
4389 | return ".NaN";
|
4390 | }
|
4391 | } else if (Number.POSITIVE_INFINITY === object) {
|
4392 | switch (style) {
|
4393 | case "lowercase":
|
4394 | return ".inf";
|
4395 | case "uppercase":
|
4396 | return ".INF";
|
4397 | case "camelcase":
|
4398 | return ".Inf";
|
4399 | }
|
4400 | } else if (Number.NEGATIVE_INFINITY === object) {
|
4401 | switch (style) {
|
4402 | case "lowercase":
|
4403 | return "-.inf";
|
4404 | case "uppercase":
|
4405 | return "-.INF";
|
4406 | case "camelcase":
|
4407 | return "-.Inf";
|
4408 | }
|
4409 | } else if (common.isNegativeZero(object)) {
|
4410 | return "-0.0";
|
4411 | }
|
4412 | res = object.toString(10);
|
4413 | return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace("e", ".e") : res;
|
4414 | }
|
4415 | function isFloat(object) {
|
4416 | return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 !== 0 || common.isNegativeZero(object));
|
4417 | }
|
4418 | var float = new type("tag:yaml.org,2002:float", {
|
4419 | kind: "scalar",
|
4420 | resolve: resolveYamlFloat,
|
4421 | construct: constructYamlFloat,
|
4422 | predicate: isFloat,
|
4423 | represent: representYamlFloat,
|
4424 | defaultStyle: "lowercase"
|
4425 | });
|
4426 | var json = failsafe.extend({
|
4427 | implicit: [
|
4428 | _null,
|
4429 | bool,
|
4430 | int,
|
4431 | float
|
4432 | ]
|
4433 | });
|
4434 | var core = json;
|
4435 | var YAML_DATE_REGEXP = new RegExp(
|
4436 | "^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"
|
4437 | );
|
4438 | var YAML_TIMESTAMP_REGEXP = new RegExp(
|
4439 | "^([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]))?))?$"
|
4440 | );
|
4441 | function resolveYamlTimestamp(data) {
|
4442 | if (data === null)
|
4443 | return false;
|
4444 | if (YAML_DATE_REGEXP.exec(data) !== null)
|
4445 | return true;
|
4446 | if (YAML_TIMESTAMP_REGEXP.exec(data) !== null)
|
4447 | return true;
|
4448 | return false;
|
4449 | }
|
4450 | function constructYamlTimestamp(data) {
|
4451 | var match, year, month, day, hour, minute, second, fraction = 0, delta = null, tz_hour, tz_minute, date;
|
4452 | match = YAML_DATE_REGEXP.exec(data);
|
4453 | if (match === null)
|
4454 | match = YAML_TIMESTAMP_REGEXP.exec(data);
|
4455 | if (match === null)
|
4456 | throw new Error("Date resolve error");
|
4457 | year = +match[1];
|
4458 | month = +match[2] - 1;
|
4459 | day = +match[3];
|
4460 | if (!match[4]) {
|
4461 | return new Date(Date.UTC(year, month, day));
|
4462 | }
|
4463 | hour = +match[4];
|
4464 | minute = +match[5];
|
4465 | second = +match[6];
|
4466 | if (match[7]) {
|
4467 | fraction = match[7].slice(0, 3);
|
4468 | while (fraction.length < 3) {
|
4469 | fraction += "0";
|
4470 | }
|
4471 | fraction = +fraction;
|
4472 | }
|
4473 | if (match[9]) {
|
4474 | tz_hour = +match[10];
|
4475 | tz_minute = +(match[11] || 0);
|
4476 | delta = (tz_hour * 60 + tz_minute) * 6e4;
|
4477 | if (match[9] === "-")
|
4478 | delta = -delta;
|
4479 | }
|
4480 | date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
|
4481 | if (delta)
|
4482 | date.setTime(date.getTime() - delta);
|
4483 | return date;
|
4484 | }
|
4485 | function representYamlTimestamp(object) {
|
4486 | return object.toISOString();
|
4487 | }
|
4488 | var timestamp = new type("tag:yaml.org,2002:timestamp", {
|
4489 | kind: "scalar",
|
4490 | resolve: resolveYamlTimestamp,
|
4491 | construct: constructYamlTimestamp,
|
4492 | instanceOf: Date,
|
4493 | represent: representYamlTimestamp
|
4494 | });
|
4495 | function resolveYamlMerge(data) {
|
4496 | return data === "<<" || data === null;
|
4497 | }
|
4498 | var merge = new type("tag:yaml.org,2002:merge", {
|
4499 | kind: "scalar",
|
4500 | resolve: resolveYamlMerge
|
4501 | });
|
4502 | var BASE64_MAP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";
|
4503 | function resolveYamlBinary(data) {
|
4504 | if (data === null)
|
4505 | return false;
|
4506 | var code, idx, bitlen = 0, max = data.length, map2 = BASE64_MAP;
|
4507 | for (idx = 0; idx < max; idx++) {
|
4508 | code = map2.indexOf(data.charAt(idx));
|
4509 | if (code > 64)
|
4510 | continue;
|
4511 | if (code < 0)
|
4512 | return false;
|
4513 | bitlen += 6;
|
4514 | }
|
4515 | return bitlen % 8 === 0;
|
4516 | }
|
4517 | function constructYamlBinary(data) {
|
4518 | var idx, tailbits, input = data.replace(/[\r\n=]/g, ""), max = input.length, map2 = BASE64_MAP, bits = 0, result = [];
|
4519 | for (idx = 0; idx < max; idx++) {
|
4520 | if (idx % 4 === 0 && idx) {
|
4521 | result.push(bits >> 16 & 255);
|
4522 | result.push(bits >> 8 & 255);
|
4523 | result.push(bits & 255);
|
4524 | }
|
4525 | bits = bits << 6 | map2.indexOf(input.charAt(idx));
|
4526 | }
|
4527 | tailbits = max % 4 * 6;
|
4528 | if (tailbits === 0) {
|
4529 | result.push(bits >> 16 & 255);
|
4530 | result.push(bits >> 8 & 255);
|
4531 | result.push(bits & 255);
|
4532 | } else if (tailbits === 18) {
|
4533 | result.push(bits >> 10 & 255);
|
4534 | result.push(bits >> 2 & 255);
|
4535 | } else if (tailbits === 12) {
|
4536 | result.push(bits >> 4 & 255);
|
4537 | }
|
4538 | return new Uint8Array(result);
|
4539 | }
|
4540 | function representYamlBinary(object) {
|
4541 | var result = "", bits = 0, idx, tail, max = object.length, map2 = BASE64_MAP;
|
4542 | for (idx = 0; idx < max; idx++) {
|
4543 | if (idx % 3 === 0 && idx) {
|
4544 | result += map2[bits >> 18 & 63];
|
4545 | result += map2[bits >> 12 & 63];
|
4546 | result += map2[bits >> 6 & 63];
|
4547 | result += map2[bits & 63];
|
4548 | }
|
4549 | bits = (bits << 8) + object[idx];
|
4550 | }
|
4551 | tail = max % 3;
|
4552 | if (tail === 0) {
|
4553 | result += map2[bits >> 18 & 63];
|
4554 | result += map2[bits >> 12 & 63];
|
4555 | result += map2[bits >> 6 & 63];
|
4556 | result += map2[bits & 63];
|
4557 | } else if (tail === 2) {
|
4558 | result += map2[bits >> 10 & 63];
|
4559 | result += map2[bits >> 4 & 63];
|
4560 | result += map2[bits << 2 & 63];
|
4561 | result += map2[64];
|
4562 | } else if (tail === 1) {
|
4563 | result += map2[bits >> 2 & 63];
|
4564 | result += map2[bits << 4 & 63];
|
4565 | result += map2[64];
|
4566 | result += map2[64];
|
4567 | }
|
4568 | return result;
|
4569 | }
|
4570 | function isBinary(obj) {
|
4571 | return Object.prototype.toString.call(obj) === "[object Uint8Array]";
|
4572 | }
|
4573 | var binary = new type("tag:yaml.org,2002:binary", {
|
4574 | kind: "scalar",
|
4575 | resolve: resolveYamlBinary,
|
4576 | construct: constructYamlBinary,
|
4577 | predicate: isBinary,
|
4578 | represent: representYamlBinary
|
4579 | });
|
4580 | var _hasOwnProperty$3 = Object.prototype.hasOwnProperty;
|
4581 | var _toString$2 = Object.prototype.toString;
|
4582 | function resolveYamlOmap(data) {
|
4583 | if (data === null)
|
4584 | return true;
|
4585 | var objectKeys = [], index, length, pair, pairKey, pairHasKey, object = data;
|
4586 | for (index = 0, length = object.length; index < length; index += 1) {
|
4587 | pair = object[index];
|
4588 | pairHasKey = false;
|
4589 | if (_toString$2.call(pair) !== "[object Object]")
|
4590 | return false;
|
4591 | for (pairKey in pair) {
|
4592 | if (_hasOwnProperty$3.call(pair, pairKey)) {
|
4593 | if (!pairHasKey)
|
4594 | pairHasKey = true;
|
4595 | else
|
4596 | return false;
|
4597 | }
|
4598 | }
|
4599 | if (!pairHasKey)
|
4600 | return false;
|
4601 | if (objectKeys.indexOf(pairKey) === -1)
|
4602 | objectKeys.push(pairKey);
|
4603 | else
|
4604 | return false;
|
4605 | }
|
4606 | return true;
|
4607 | }
|
4608 | function constructYamlOmap(data) {
|
4609 | return data !== null ? data : [];
|
4610 | }
|
4611 | var omap = new type("tag:yaml.org,2002:omap", {
|
4612 | kind: "sequence",
|
4613 | resolve: resolveYamlOmap,
|
4614 | construct: constructYamlOmap
|
4615 | });
|
4616 | var _toString$1 = Object.prototype.toString;
|
4617 | function resolveYamlPairs(data) {
|
4618 | if (data === null)
|
4619 | return true;
|
4620 | var index, length, pair, keys, result, object = data;
|
4621 | result = new Array(object.length);
|
4622 | for (index = 0, length = object.length; index < length; index += 1) {
|
4623 | pair = object[index];
|
4624 | if (_toString$1.call(pair) !== "[object Object]")
|
4625 | return false;
|
4626 | keys = Object.keys(pair);
|
4627 | if (keys.length !== 1)
|
4628 | return false;
|
4629 | result[index] = [keys[0], pair[keys[0]]];
|
4630 | }
|
4631 | return true;
|
4632 | }
|
4633 | function constructYamlPairs(data) {
|
4634 | if (data === null)
|
4635 | return [];
|
4636 | var index, length, pair, keys, result, object = data;
|
4637 | result = new Array(object.length);
|
4638 | for (index = 0, length = object.length; index < length; index += 1) {
|
4639 | pair = object[index];
|
4640 | keys = Object.keys(pair);
|
4641 | result[index] = [keys[0], pair[keys[0]]];
|
4642 | }
|
4643 | return result;
|
4644 | }
|
4645 | var pairs = new type("tag:yaml.org,2002:pairs", {
|
4646 | kind: "sequence",
|
4647 | resolve: resolveYamlPairs,
|
4648 | construct: constructYamlPairs
|
4649 | });
|
4650 | var _hasOwnProperty$2 = Object.prototype.hasOwnProperty;
|
4651 | function resolveYamlSet(data) {
|
4652 | if (data === null)
|
4653 | return true;
|
4654 | var key, object = data;
|
4655 | for (key in object) {
|
4656 | if (_hasOwnProperty$2.call(object, key)) {
|
4657 | if (object[key] !== null)
|
4658 | return false;
|
4659 | }
|
4660 | }
|
4661 | return true;
|
4662 | }
|
4663 | function constructYamlSet(data) {
|
4664 | return data !== null ? data : {};
|
4665 | }
|
4666 | var set = new type("tag:yaml.org,2002:set", {
|
4667 | kind: "mapping",
|
4668 | resolve: resolveYamlSet,
|
4669 | construct: constructYamlSet
|
4670 | });
|
4671 | var _default = core.extend({
|
4672 | implicit: [
|
4673 | timestamp,
|
4674 | merge
|
4675 | ],
|
4676 | explicit: [
|
4677 | binary,
|
4678 | omap,
|
4679 | pairs,
|
4680 | set
|
4681 | ]
|
4682 | });
|
4683 | var _hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
4684 | var CONTEXT_FLOW_IN = 1;
|
4685 | var CONTEXT_FLOW_OUT = 2;
|
4686 | var CONTEXT_BLOCK_IN = 3;
|
4687 | var CONTEXT_BLOCK_OUT = 4;
|
4688 | var CHOMPING_CLIP = 1;
|
4689 | var CHOMPING_STRIP = 2;
|
4690 | var CHOMPING_KEEP = 3;
|
4691 | var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
|
4692 | var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
|
4693 | var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
|
4694 | var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
|
4695 | var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
|
4696 | function _class(obj) {
|
4697 | return Object.prototype.toString.call(obj);
|
4698 | }
|
4699 | function is_EOL(c) {
|
4700 | return c === 10 || c === 13;
|
4701 | }
|
4702 | function is_WHITE_SPACE(c) {
|
4703 | return c === 9 || c === 32;
|
4704 | }
|
4705 | function is_WS_OR_EOL(c) {
|
4706 | return c === 9 || c === 32 || c === 10 || c === 13;
|
4707 | }
|
4708 | function is_FLOW_INDICATOR(c) {
|
4709 | return c === 44 || c === 91 || c === 93 || c === 123 || c === 125;
|
4710 | }
|
4711 | function fromHexCode(c) {
|
4712 | var lc;
|
4713 | if (48 <= c && c <= 57) {
|
4714 | return c - 48;
|
4715 | }
|
4716 | lc = c | 32;
|
4717 | if (97 <= lc && lc <= 102) {
|
4718 | return lc - 97 + 10;
|
4719 | }
|
4720 | return -1;
|
4721 | }
|
4722 | function escapedHexLen(c) {
|
4723 | if (c === 120) {
|
4724 | return 2;
|
4725 | }
|
4726 | if (c === 117) {
|
4727 | return 4;
|
4728 | }
|
4729 | if (c === 85) {
|
4730 | return 8;
|
4731 | }
|
4732 | return 0;
|
4733 | }
|
4734 | function fromDecimalCode(c) {
|
4735 | if (48 <= c && c <= 57) {
|
4736 | return c - 48;
|
4737 | }
|
4738 | return -1;
|
4739 | }
|
4740 | function simpleEscapeSequence(c) {
|
4741 | return c === 48 ? "\0" : c === 97 ? "\x07" : c === 98 ? "\b" : c === 116 ? " " : c === 9 ? " " : c === 110 ? "\n" : c === 118 ? "\v" : c === 102 ? "\f" : c === 114 ? "\r" : c === 101 ? "\x1B" : c === 32 ? " " : c === 34 ? '"' : c === 47 ? "/" : c === 92 ? "\\" : c === 78 ? "
" : c === 95 ? " " : c === 76 ? "\u2028" : c === 80 ? "\u2029" : "";
|
4742 | }
|
4743 | function charFromCodepoint(c) {
|
4744 | if (c <= 65535) {
|
4745 | return String.fromCharCode(c);
|
4746 | }
|
4747 | return String.fromCharCode(
|
4748 | (c - 65536 >> 10) + 55296,
|
4749 | (c - 65536 & 1023) + 56320
|
4750 | );
|
4751 | }
|
4752 | var simpleEscapeCheck = new Array(256);
|
4753 | var simpleEscapeMap = new Array(256);
|
4754 | for (var i = 0; i < 256; i++) {
|
4755 | simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
|
4756 | simpleEscapeMap[i] = simpleEscapeSequence(i);
|
4757 | }
|
4758 | function State$1(input, options) {
|
4759 | this.input = input;
|
4760 | this.filename = options["filename"] || null;
|
4761 | this.schema = options["schema"] || _default;
|
4762 | this.onWarning = options["onWarning"] || null;
|
4763 | this.legacy = options["legacy"] || false;
|
4764 | this.json = options["json"] || false;
|
4765 | this.listener = options["listener"] || null;
|
4766 | this.implicitTypes = this.schema.compiledImplicit;
|
4767 | this.typeMap = this.schema.compiledTypeMap;
|
4768 | this.length = input.length;
|
4769 | this.position = 0;
|
4770 | this.line = 0;
|
4771 | this.lineStart = 0;
|
4772 | this.lineIndent = 0;
|
4773 | this.firstTabInLine = -1;
|
4774 | this.documents = [];
|
4775 | }
|
4776 | function generateError(state2, message) {
|
4777 | var mark = {
|
4778 | name: state2.filename,
|
4779 | buffer: state2.input.slice(0, -1),
|
4780 |
|
4781 | position: state2.position,
|
4782 | line: state2.line,
|
4783 | column: state2.position - state2.lineStart
|
4784 | };
|
4785 | mark.snippet = snippet(mark);
|
4786 | return new exception(message, mark);
|
4787 | }
|
4788 | function throwError(state2, message) {
|
4789 | throw generateError(state2, message);
|
4790 | }
|
4791 | function throwWarning(state2, message) {
|
4792 | if (state2.onWarning) {
|
4793 | state2.onWarning.call(null, generateError(state2, message));
|
4794 | }
|
4795 | }
|
4796 | var directiveHandlers = {
|
4797 | YAML: function handleYamlDirective(state2, name, args) {
|
4798 | var match, major, minor;
|
4799 | if (state2.version !== null) {
|
4800 | throwError(state2, "duplication of %YAML directive");
|
4801 | }
|
4802 | if (args.length !== 1) {
|
4803 | throwError(state2, "YAML directive accepts exactly one argument");
|
4804 | }
|
4805 | match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
|
4806 | if (match === null) {
|
4807 | throwError(state2, "ill-formed argument of the YAML directive");
|
4808 | }
|
4809 | major = parseInt(match[1], 10);
|
4810 | minor = parseInt(match[2], 10);
|
4811 | if (major !== 1) {
|
4812 | throwError(state2, "unacceptable YAML version of the document");
|
4813 | }
|
4814 | state2.version = args[0];
|
4815 | state2.checkLineBreaks = minor < 2;
|
4816 | if (minor !== 1 && minor !== 2) {
|
4817 | throwWarning(state2, "unsupported YAML version of the document");
|
4818 | }
|
4819 | },
|
4820 | TAG: function handleTagDirective(state2, name, args) {
|
4821 | var handle, prefix;
|
4822 | if (args.length !== 2) {
|
4823 | throwError(state2, "TAG directive accepts exactly two arguments");
|
4824 | }
|
4825 | handle = args[0];
|
4826 | prefix = args[1];
|
4827 | if (!PATTERN_TAG_HANDLE.test(handle)) {
|
4828 | throwError(state2, "ill-formed tag handle (first argument) of the TAG directive");
|
4829 | }
|
4830 | if (_hasOwnProperty$1.call(state2.tagMap, handle)) {
|
4831 | throwError(state2, 'there is a previously declared suffix for "' + handle + '" tag handle');
|
4832 | }
|
4833 | if (!PATTERN_TAG_URI.test(prefix)) {
|
4834 | throwError(state2, "ill-formed tag prefix (second argument) of the TAG directive");
|
4835 | }
|
4836 | try {
|
4837 | prefix = decodeURIComponent(prefix);
|
4838 | } catch (err) {
|
4839 | throwError(state2, "tag prefix is malformed: " + prefix);
|
4840 | }
|
4841 | state2.tagMap[handle] = prefix;
|
4842 | }
|
4843 | };
|
4844 | function captureSegment(state2, start, end, checkJson) {
|
4845 | var _position, _length, _character, _result;
|
4846 | if (start < end) {
|
4847 | _result = state2.input.slice(start, end);
|
4848 | if (checkJson) {
|
4849 | for (_position = 0, _length = _result.length; _position < _length; _position += 1) {
|
4850 | _character = _result.charCodeAt(_position);
|
4851 | if (!(_character === 9 || 32 <= _character && _character <= 1114111)) {
|
4852 | throwError(state2, "expected valid JSON character");
|
4853 | }
|
4854 | }
|
4855 | } else if (PATTERN_NON_PRINTABLE.test(_result)) {
|
4856 | throwError(state2, "the stream contains non-printable characters");
|
4857 | }
|
4858 | state2.result += _result;
|
4859 | }
|
4860 | }
|
4861 | function mergeMappings(state2, destination, source, overridableKeys) {
|
4862 | var sourceKeys, key, index, quantity;
|
4863 | if (!common.isObject(source)) {
|
4864 | throwError(state2, "cannot merge mappings; the provided source object is unacceptable");
|
4865 | }
|
4866 | sourceKeys = Object.keys(source);
|
4867 | for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
|
4868 | key = sourceKeys[index];
|
4869 | if (!_hasOwnProperty$1.call(destination, key)) {
|
4870 | destination[key] = source[key];
|
4871 | overridableKeys[key] = true;
|
4872 | }
|
4873 | }
|
4874 | }
|
4875 | function storeMappingPair(state2, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startLineStart, startPos) {
|
4876 | var index, quantity;
|
4877 | if (Array.isArray(keyNode)) {
|
4878 | keyNode = Array.prototype.slice.call(keyNode);
|
4879 | for (index = 0, quantity = keyNode.length; index < quantity; index += 1) {
|
4880 | if (Array.isArray(keyNode[index])) {
|
4881 | throwError(state2, "nested arrays are not supported inside keys");
|
4882 | }
|
4883 | if (typeof keyNode === "object" && _class(keyNode[index]) === "[object Object]") {
|
4884 | keyNode[index] = "[object Object]";
|
4885 | }
|
4886 | }
|
4887 | }
|
4888 | if (typeof keyNode === "object" && _class(keyNode) === "[object Object]") {
|
4889 | keyNode = "[object Object]";
|
4890 | }
|
4891 | keyNode = String(keyNode);
|
4892 | if (_result === null) {
|
4893 | _result = {};
|
4894 | }
|
4895 | if (keyTag === "tag:yaml.org,2002:merge") {
|
4896 | if (Array.isArray(valueNode)) {
|
4897 | for (index = 0, quantity = valueNode.length; index < quantity; index += 1) {
|
4898 | mergeMappings(state2, _result, valueNode[index], overridableKeys);
|
4899 | }
|
4900 | } else {
|
4901 | mergeMappings(state2, _result, valueNode, overridableKeys);
|
4902 | }
|
4903 | } else {
|
4904 | if (!state2.json && !_hasOwnProperty$1.call(overridableKeys, keyNode) && _hasOwnProperty$1.call(_result, keyNode)) {
|
4905 | state2.line = startLine || state2.line;
|
4906 | state2.lineStart = startLineStart || state2.lineStart;
|
4907 | state2.position = startPos || state2.position;
|
4908 | throwError(state2, "duplicated mapping key");
|
4909 | }
|
4910 | if (keyNode === "__proto__") {
|
4911 | Object.defineProperty(_result, keyNode, {
|
4912 | configurable: true,
|
4913 | enumerable: true,
|
4914 | writable: true,
|
4915 | value: valueNode
|
4916 | });
|
4917 | } else {
|
4918 | _result[keyNode] = valueNode;
|
4919 | }
|
4920 | delete overridableKeys[keyNode];
|
4921 | }
|
4922 | return _result;
|
4923 | }
|
4924 | function readLineBreak(state2) {
|
4925 | var ch;
|
4926 | ch = state2.input.charCodeAt(state2.position);
|
4927 | if (ch === 10) {
|
4928 | state2.position++;
|
4929 | } else if (ch === 13) {
|
4930 | state2.position++;
|
4931 | if (state2.input.charCodeAt(state2.position) === 10) {
|
4932 | state2.position++;
|
4933 | }
|
4934 | } else {
|
4935 | throwError(state2, "a line break is expected");
|
4936 | }
|
4937 | state2.line += 1;
|
4938 | state2.lineStart = state2.position;
|
4939 | state2.firstTabInLine = -1;
|
4940 | }
|
4941 | function skipSeparationSpace(state2, allowComments, checkIndent) {
|
4942 | var lineBreaks = 0, ch = state2.input.charCodeAt(state2.position);
|
4943 | while (ch !== 0) {
|
4944 | while (is_WHITE_SPACE(ch)) {
|
4945 | if (ch === 9 && state2.firstTabInLine === -1) {
|
4946 | state2.firstTabInLine = state2.position;
|
4947 | }
|
4948 | ch = state2.input.charCodeAt(++state2.position);
|
4949 | }
|
4950 | if (allowComments && ch === 35) {
|
4951 | do {
|
4952 | ch = state2.input.charCodeAt(++state2.position);
|
4953 | } while (ch !== 10 && ch !== 13 && ch !== 0);
|
4954 | }
|
4955 | if (is_EOL(ch)) {
|
4956 | readLineBreak(state2);
|
4957 | ch = state2.input.charCodeAt(state2.position);
|
4958 | lineBreaks++;
|
4959 | state2.lineIndent = 0;
|
4960 | while (ch === 32) {
|
4961 | state2.lineIndent++;
|
4962 | ch = state2.input.charCodeAt(++state2.position);
|
4963 | }
|
4964 | } else {
|
4965 | break;
|
4966 | }
|
4967 | }
|
4968 | if (checkIndent !== -1 && lineBreaks !== 0 && state2.lineIndent < checkIndent) {
|
4969 | throwWarning(state2, "deficient indentation");
|
4970 | }
|
4971 | return lineBreaks;
|
4972 | }
|
4973 | function testDocumentSeparator(state2) {
|
4974 | var _position = state2.position, ch;
|
4975 | ch = state2.input.charCodeAt(_position);
|
4976 | if ((ch === 45 || ch === 46) && ch === state2.input.charCodeAt(_position + 1) && ch === state2.input.charCodeAt(_position + 2)) {
|
4977 | _position += 3;
|
4978 | ch = state2.input.charCodeAt(_position);
|
4979 | if (ch === 0 || is_WS_OR_EOL(ch)) {
|
4980 | return true;
|
4981 | }
|
4982 | }
|
4983 | return false;
|
4984 | }
|
4985 | function writeFoldedLines(state2, count) {
|
4986 | if (count === 1) {
|
4987 | state2.result += " ";
|
4988 | } else if (count > 1) {
|
4989 | state2.result += common.repeat("\n", count - 1);
|
4990 | }
|
4991 | }
|
4992 | function readPlainScalar(state2, nodeIndent, withinFlowCollection) {
|
4993 | var preceding, following, captureStart, captureEnd, hasPendingContent, _line, _lineStart, _lineIndent, _kind = state2.kind, _result = state2.result, ch;
|
4994 | ch = state2.input.charCodeAt(state2.position);
|
4995 | if (is_WS_OR_EOL(ch) || is_FLOW_INDICATOR(ch) || ch === 35 || ch === 38 || ch === 42 || ch === 33 || ch === 124 || ch === 62 || ch === 39 || ch === 34 || ch === 37 || ch === 64 || ch === 96) {
|
4996 | return false;
|
4997 | }
|
4998 | if (ch === 63 || ch === 45) {
|
4999 | following = state2.input.charCodeAt(state2.position + 1);
|
5000 | if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
|
5001 | return false;
|
5002 | }
|
5003 | }
|
5004 | state2.kind = "scalar";
|
5005 | state2.result = "";
|
5006 | captureStart = captureEnd = state2.position;
|
5007 | hasPendingContent = false;
|
5008 | while (ch !== 0) {
|
5009 | if (ch === 58) {
|
5010 | following = state2.input.charCodeAt(state2.position + 1);
|
5011 | if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
|
5012 | break;
|
5013 | }
|
5014 | } else if (ch === 35) {
|
5015 | preceding = state2.input.charCodeAt(state2.position - 1);
|
5016 | if (is_WS_OR_EOL(preceding)) {
|
5017 | break;
|
5018 | }
|
5019 | } else if (state2.position === state2.lineStart && testDocumentSeparator(state2) || withinFlowCollection && is_FLOW_INDICATOR(ch)) {
|
5020 | break;
|
5021 | } else if (is_EOL(ch)) {
|
5022 | _line = state2.line;
|
5023 | _lineStart = state2.lineStart;
|
5024 | _lineIndent = state2.lineIndent;
|
5025 | skipSeparationSpace(state2, false, -1);
|
5026 | if (state2.lineIndent >= nodeIndent) {
|
5027 | hasPendingContent = true;
|
5028 | ch = state2.input.charCodeAt(state2.position);
|
5029 | continue;
|
5030 | } else {
|
5031 | state2.position = captureEnd;
|
5032 | state2.line = _line;
|
5033 | state2.lineStart = _lineStart;
|
5034 | state2.lineIndent = _lineIndent;
|
5035 | break;
|
5036 | }
|
5037 | }
|
5038 | if (hasPendingContent) {
|
5039 | captureSegment(state2, captureStart, captureEnd, false);
|
5040 | writeFoldedLines(state2, state2.line - _line);
|
5041 | captureStart = captureEnd = state2.position;
|
5042 | hasPendingContent = false;
|
5043 | }
|
5044 | if (!is_WHITE_SPACE(ch)) {
|
5045 | captureEnd = state2.position + 1;
|
5046 | }
|
5047 | ch = state2.input.charCodeAt(++state2.position);
|
5048 | }
|
5049 | captureSegment(state2, captureStart, captureEnd, false);
|
5050 | if (state2.result) {
|
5051 | return true;
|
5052 | }
|
5053 | state2.kind = _kind;
|
5054 | state2.result = _result;
|
5055 | return false;
|
5056 | }
|
5057 | function readSingleQuotedScalar(state2, nodeIndent) {
|
5058 | var ch, captureStart, captureEnd;
|
5059 | ch = state2.input.charCodeAt(state2.position);
|
5060 | if (ch !== 39) {
|
5061 | return false;
|
5062 | }
|
5063 | state2.kind = "scalar";
|
5064 | state2.result = "";
|
5065 | state2.position++;
|
5066 | captureStart = captureEnd = state2.position;
|
5067 | while ((ch = state2.input.charCodeAt(state2.position)) !== 0) {
|
5068 | if (ch === 39) {
|
5069 | captureSegment(state2, captureStart, state2.position, true);
|
5070 | ch = state2.input.charCodeAt(++state2.position);
|
5071 | if (ch === 39) {
|
5072 | captureStart = state2.position;
|
5073 | state2.position++;
|
5074 | captureEnd = state2.position;
|
5075 | } else {
|
5076 | return true;
|
5077 | }
|
5078 | } else if (is_EOL(ch)) {
|
5079 | captureSegment(state2, captureStart, captureEnd, true);
|
5080 | writeFoldedLines(state2, skipSeparationSpace(state2, false, nodeIndent));
|
5081 | captureStart = captureEnd = state2.position;
|
5082 | } else if (state2.position === state2.lineStart && testDocumentSeparator(state2)) {
|
5083 | throwError(state2, "unexpected end of the document within a single quoted scalar");
|
5084 | } else {
|
5085 | state2.position++;
|
5086 | captureEnd = state2.position;
|
5087 | }
|
5088 | }
|
5089 | throwError(state2, "unexpected end of the stream within a single quoted scalar");
|
5090 | }
|
5091 | function readDoubleQuotedScalar(state2, nodeIndent) {
|
5092 | var captureStart, captureEnd, hexLength, hexResult, tmp, ch;
|
5093 | ch = state2.input.charCodeAt(state2.position);
|
5094 | if (ch !== 34) {
|
5095 | return false;
|
5096 | }
|
5097 | state2.kind = "scalar";
|
5098 | state2.result = "";
|
5099 | state2.position++;
|
5100 | captureStart = captureEnd = state2.position;
|
5101 | while ((ch = state2.input.charCodeAt(state2.position)) !== 0) {
|
5102 | if (ch === 34) {
|
5103 | captureSegment(state2, captureStart, state2.position, true);
|
5104 | state2.position++;
|
5105 | return true;
|
5106 | } else if (ch === 92) {
|
5107 | captureSegment(state2, captureStart, state2.position, true);
|
5108 | ch = state2.input.charCodeAt(++state2.position);
|
5109 | if (is_EOL(ch)) {
|
5110 | skipSeparationSpace(state2, false, nodeIndent);
|
5111 | } else if (ch < 256 && simpleEscapeCheck[ch]) {
|
5112 | state2.result += simpleEscapeMap[ch];
|
5113 | state2.position++;
|
5114 | } else if ((tmp = escapedHexLen(ch)) > 0) {
|
5115 | hexLength = tmp;
|
5116 | hexResult = 0;
|
5117 | for (; hexLength > 0; hexLength--) {
|
5118 | ch = state2.input.charCodeAt(++state2.position);
|
5119 | if ((tmp = fromHexCode(ch)) >= 0) {
|
5120 | hexResult = (hexResult << 4) + tmp;
|
5121 | } else {
|
5122 | throwError(state2, "expected hexadecimal character");
|
5123 | }
|
5124 | }
|
5125 | state2.result += charFromCodepoint(hexResult);
|
5126 | state2.position++;
|
5127 | } else {
|
5128 | throwError(state2, "unknown escape sequence");
|
5129 | }
|
5130 | captureStart = captureEnd = state2.position;
|
5131 | } else if (is_EOL(ch)) {
|
5132 | captureSegment(state2, captureStart, captureEnd, true);
|
5133 | writeFoldedLines(state2, skipSeparationSpace(state2, false, nodeIndent));
|
5134 | captureStart = captureEnd = state2.position;
|
5135 | } else if (state2.position === state2.lineStart && testDocumentSeparator(state2)) {
|
5136 | throwError(state2, "unexpected end of the document within a double quoted scalar");
|
5137 | } else {
|
5138 | state2.position++;
|
5139 | captureEnd = state2.position;
|
5140 | }
|
5141 | }
|
5142 | throwError(state2, "unexpected end of the stream within a double quoted scalar");
|
5143 | }
|
5144 | function readFlowCollection(state2, nodeIndent) {
|
5145 | var readNext = true, _line, _lineStart, _pos, _tag = state2.tag, _result, _anchor = state2.anchor, following, terminator, isPair, isExplicitPair, isMapping, overridableKeys = Object.create(null), keyNode, keyTag, valueNode, ch;
|
5146 | ch = state2.input.charCodeAt(state2.position);
|
5147 | if (ch === 91) {
|
5148 | terminator = 93;
|
5149 | isMapping = false;
|
5150 | _result = [];
|
5151 | } else if (ch === 123) {
|
5152 | terminator = 125;
|
5153 | isMapping = true;
|
5154 | _result = {};
|
5155 | } else {
|
5156 | return false;
|
5157 | }
|
5158 | if (state2.anchor !== null) {
|
5159 | state2.anchorMap[state2.anchor] = _result;
|
5160 | }
|
5161 | ch = state2.input.charCodeAt(++state2.position);
|
5162 | while (ch !== 0) {
|
5163 | skipSeparationSpace(state2, true, nodeIndent);
|
5164 | ch = state2.input.charCodeAt(state2.position);
|
5165 | if (ch === terminator) {
|
5166 | state2.position++;
|
5167 | state2.tag = _tag;
|
5168 | state2.anchor = _anchor;
|
5169 | state2.kind = isMapping ? "mapping" : "sequence";
|
5170 | state2.result = _result;
|
5171 | return true;
|
5172 | } else if (!readNext) {
|
5173 | throwError(state2, "missed comma between flow collection entries");
|
5174 | } else if (ch === 44) {
|
5175 | throwError(state2, "expected the node content, but found ','");
|
5176 | }
|
5177 | keyTag = keyNode = valueNode = null;
|
5178 | isPair = isExplicitPair = false;
|
5179 | if (ch === 63) {
|
5180 | following = state2.input.charCodeAt(state2.position + 1);
|
5181 | if (is_WS_OR_EOL(following)) {
|
5182 | isPair = isExplicitPair = true;
|
5183 | state2.position++;
|
5184 | skipSeparationSpace(state2, true, nodeIndent);
|
5185 | }
|
5186 | }
|
5187 | _line = state2.line;
|
5188 | _lineStart = state2.lineStart;
|
5189 | _pos = state2.position;
|
5190 | composeNode(state2, nodeIndent, CONTEXT_FLOW_IN, false, true);
|
5191 | keyTag = state2.tag;
|
5192 | keyNode = state2.result;
|
5193 | skipSeparationSpace(state2, true, nodeIndent);
|
5194 | ch = state2.input.charCodeAt(state2.position);
|
5195 | if ((isExplicitPair || state2.line === _line) && ch === 58) {
|
5196 | isPair = true;
|
5197 | ch = state2.input.charCodeAt(++state2.position);
|
5198 | skipSeparationSpace(state2, true, nodeIndent);
|
5199 | composeNode(state2, nodeIndent, CONTEXT_FLOW_IN, false, true);
|
5200 | valueNode = state2.result;
|
5201 | }
|
5202 | if (isMapping) {
|
5203 | storeMappingPair(state2, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos);
|
5204 | } else if (isPair) {
|
5205 | _result.push(storeMappingPair(state2, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos));
|
5206 | } else {
|
5207 | _result.push(keyNode);
|
5208 | }
|
5209 | skipSeparationSpace(state2, true, nodeIndent);
|
5210 | ch = state2.input.charCodeAt(state2.position);
|
5211 | if (ch === 44) {
|
5212 | readNext = true;
|
5213 | ch = state2.input.charCodeAt(++state2.position);
|
5214 | } else {
|
5215 | readNext = false;
|
5216 | }
|
5217 | }
|
5218 | throwError(state2, "unexpected end of the stream within a flow collection");
|
5219 | }
|
5220 | function readBlockScalar(state2, nodeIndent) {
|
5221 | var captureStart, folding, chomping = CHOMPING_CLIP, didReadContent = false, detectedIndent = false, textIndent = nodeIndent, emptyLines = 0, atMoreIndented = false, tmp, ch;
|
5222 | ch = state2.input.charCodeAt(state2.position);
|
5223 | if (ch === 124) {
|
5224 | folding = false;
|
5225 | } else if (ch === 62) {
|
5226 | folding = true;
|
5227 | } else {
|
5228 | return false;
|
5229 | }
|
5230 | state2.kind = "scalar";
|
5231 | state2.result = "";
|
5232 | while (ch !== 0) {
|
5233 | ch = state2.input.charCodeAt(++state2.position);
|
5234 | if (ch === 43 || ch === 45) {
|
5235 | if (CHOMPING_CLIP === chomping) {
|
5236 | chomping = ch === 43 ? CHOMPING_KEEP : CHOMPING_STRIP;
|
5237 | } else {
|
5238 | throwError(state2, "repeat of a chomping mode identifier");
|
5239 | }
|
5240 | } else if ((tmp = fromDecimalCode(ch)) >= 0) {
|
5241 | if (tmp === 0) {
|
5242 | throwError(state2, "bad explicit indentation width of a block scalar; it cannot be less than one");
|
5243 | } else if (!detectedIndent) {
|
5244 | textIndent = nodeIndent + tmp - 1;
|
5245 | detectedIndent = true;
|
5246 | } else {
|
5247 | throwError(state2, "repeat of an indentation width identifier");
|
5248 | }
|
5249 | } else {
|
5250 | break;
|
5251 | }
|
5252 | }
|
5253 | if (is_WHITE_SPACE(ch)) {
|
5254 | do {
|
5255 | ch = state2.input.charCodeAt(++state2.position);
|
5256 | } while (is_WHITE_SPACE(ch));
|
5257 | if (ch === 35) {
|
5258 | do {
|
5259 | ch = state2.input.charCodeAt(++state2.position);
|
5260 | } while (!is_EOL(ch) && ch !== 0);
|
5261 | }
|
5262 | }
|
5263 | while (ch !== 0) {
|
5264 | readLineBreak(state2);
|
5265 | state2.lineIndent = 0;
|
5266 | ch = state2.input.charCodeAt(state2.position);
|
5267 | while ((!detectedIndent || state2.lineIndent < textIndent) && ch === 32) {
|
5268 | state2.lineIndent++;
|
5269 | ch = state2.input.charCodeAt(++state2.position);
|
5270 | }
|
5271 | if (!detectedIndent && state2.lineIndent > textIndent) {
|
5272 | textIndent = state2.lineIndent;
|
5273 | }
|
5274 | if (is_EOL(ch)) {
|
5275 | emptyLines++;
|
5276 | continue;
|
5277 | }
|
5278 | if (state2.lineIndent < textIndent) {
|
5279 | if (chomping === CHOMPING_KEEP) {
|
5280 | state2.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
|
5281 | } else if (chomping === CHOMPING_CLIP) {
|
5282 | if (didReadContent) {
|
5283 | state2.result += "\n";
|
5284 | }
|
5285 | }
|
5286 | break;
|
5287 | }
|
5288 | if (folding) {
|
5289 | if (is_WHITE_SPACE(ch)) {
|
5290 | atMoreIndented = true;
|
5291 | state2.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
|
5292 | } else if (atMoreIndented) {
|
5293 | atMoreIndented = false;
|
5294 | state2.result += common.repeat("\n", emptyLines + 1);
|
5295 | } else if (emptyLines === 0) {
|
5296 | if (didReadContent) {
|
5297 | state2.result += " ";
|
5298 | }
|
5299 | } else {
|
5300 | state2.result += common.repeat("\n", emptyLines);
|
5301 | }
|
5302 | } else {
|
5303 | state2.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
|
5304 | }
|
5305 | didReadContent = true;
|
5306 | detectedIndent = true;
|
5307 | emptyLines = 0;
|
5308 | captureStart = state2.position;
|
5309 | while (!is_EOL(ch) && ch !== 0) {
|
5310 | ch = state2.input.charCodeAt(++state2.position);
|
5311 | }
|
5312 | captureSegment(state2, captureStart, state2.position, false);
|
5313 | }
|
5314 | return true;
|
5315 | }
|
5316 | function readBlockSequence(state2, nodeIndent) {
|
5317 | var _line, _tag = state2.tag, _anchor = state2.anchor, _result = [], following, detected = false, ch;
|
5318 | if (state2.firstTabInLine !== -1)
|
5319 | return false;
|
5320 | if (state2.anchor !== null) {
|
5321 | state2.anchorMap[state2.anchor] = _result;
|
5322 | }
|
5323 | ch = state2.input.charCodeAt(state2.position);
|
5324 | while (ch !== 0) {
|
5325 | if (state2.firstTabInLine !== -1) {
|
5326 | state2.position = state2.firstTabInLine;
|
5327 | throwError(state2, "tab characters must not be used in indentation");
|
5328 | }
|
5329 | if (ch !== 45) {
|
5330 | break;
|
5331 | }
|
5332 | following = state2.input.charCodeAt(state2.position + 1);
|
5333 | if (!is_WS_OR_EOL(following)) {
|
5334 | break;
|
5335 | }
|
5336 | detected = true;
|
5337 | state2.position++;
|
5338 | if (skipSeparationSpace(state2, true, -1)) {
|
5339 | if (state2.lineIndent <= nodeIndent) {
|
5340 | _result.push(null);
|
5341 | ch = state2.input.charCodeAt(state2.position);
|
5342 | continue;
|
5343 | }
|
5344 | }
|
5345 | _line = state2.line;
|
5346 | composeNode(state2, nodeIndent, CONTEXT_BLOCK_IN, false, true);
|
5347 | _result.push(state2.result);
|
5348 | skipSeparationSpace(state2, true, -1);
|
5349 | ch = state2.input.charCodeAt(state2.position);
|
5350 | if ((state2.line === _line || state2.lineIndent > nodeIndent) && ch !== 0) {
|
5351 | throwError(state2, "bad indentation of a sequence entry");
|
5352 | } else if (state2.lineIndent < nodeIndent) {
|
5353 | break;
|
5354 | }
|
5355 | }
|
5356 | if (detected) {
|
5357 | state2.tag = _tag;
|
5358 | state2.anchor = _anchor;
|
5359 | state2.kind = "sequence";
|
5360 | state2.result = _result;
|
5361 | return true;
|
5362 | }
|
5363 | return false;
|
5364 | }
|
5365 | function readBlockMapping(state2, nodeIndent, flowIndent) {
|
5366 | var following, allowCompact, _line, _keyLine, _keyLineStart, _keyPos, _tag = state2.tag, _anchor = state2.anchor, _result = {}, overridableKeys = Object.create(null), keyTag = null, keyNode = null, valueNode = null, atExplicitKey = false, detected = false, ch;
|
5367 | if (state2.firstTabInLine !== -1)
|
5368 | return false;
|
5369 | if (state2.anchor !== null) {
|
5370 | state2.anchorMap[state2.anchor] = _result;
|
5371 | }
|
5372 | ch = state2.input.charCodeAt(state2.position);
|
5373 | while (ch !== 0) {
|
5374 | if (!atExplicitKey && state2.firstTabInLine !== -1) {
|
5375 | state2.position = state2.firstTabInLine;
|
5376 | throwError(state2, "tab characters must not be used in indentation");
|
5377 | }
|
5378 | following = state2.input.charCodeAt(state2.position + 1);
|
5379 | _line = state2.line;
|
5380 | if ((ch === 63 || ch === 58) && is_WS_OR_EOL(following)) {
|
5381 | if (ch === 63) {
|
5382 | if (atExplicitKey) {
|
5383 | storeMappingPair(state2, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
|
5384 | keyTag = keyNode = valueNode = null;
|
5385 | }
|
5386 | detected = true;
|
5387 | atExplicitKey = true;
|
5388 | allowCompact = true;
|
5389 | } else if (atExplicitKey) {
|
5390 | atExplicitKey = false;
|
5391 | allowCompact = true;
|
5392 | } else {
|
5393 | throwError(state2, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line");
|
5394 | }
|
5395 | state2.position += 1;
|
5396 | ch = following;
|
5397 | } else {
|
5398 | _keyLine = state2.line;
|
5399 | _keyLineStart = state2.lineStart;
|
5400 | _keyPos = state2.position;
|
5401 | if (!composeNode(state2, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
|
5402 | break;
|
5403 | }
|
5404 | if (state2.line === _line) {
|
5405 | ch = state2.input.charCodeAt(state2.position);
|
5406 | while (is_WHITE_SPACE(ch)) {
|
5407 | ch = state2.input.charCodeAt(++state2.position);
|
5408 | }
|
5409 | if (ch === 58) {
|
5410 | ch = state2.input.charCodeAt(++state2.position);
|
5411 | if (!is_WS_OR_EOL(ch)) {
|
5412 | throwError(state2, "a whitespace character is expected after the key-value separator within a block mapping");
|
5413 | }
|
5414 | if (atExplicitKey) {
|
5415 | storeMappingPair(state2, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
|
5416 | keyTag = keyNode = valueNode = null;
|
5417 | }
|
5418 | detected = true;
|
5419 | atExplicitKey = false;
|
5420 | allowCompact = false;
|
5421 | keyTag = state2.tag;
|
5422 | keyNode = state2.result;
|
5423 | } else if (detected) {
|
5424 | throwError(state2, "can not read an implicit mapping pair; a colon is missed");
|
5425 | } else {
|
5426 | state2.tag = _tag;
|
5427 | state2.anchor = _anchor;
|
5428 | return true;
|
5429 | }
|
5430 | } else if (detected) {
|
5431 | throwError(state2, "can not read a block mapping entry; a multiline key may not be an implicit key");
|
5432 | } else {
|
5433 | state2.tag = _tag;
|
5434 | state2.anchor = _anchor;
|
5435 | return true;
|
5436 | }
|
5437 | }
|
5438 | if (state2.line === _line || state2.lineIndent > nodeIndent) {
|
5439 | if (atExplicitKey) {
|
5440 | _keyLine = state2.line;
|
5441 | _keyLineStart = state2.lineStart;
|
5442 | _keyPos = state2.position;
|
5443 | }
|
5444 | if (composeNode(state2, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {
|
5445 | if (atExplicitKey) {
|
5446 | keyNode = state2.result;
|
5447 | } else {
|
5448 | valueNode = state2.result;
|
5449 | }
|
5450 | }
|
5451 | if (!atExplicitKey) {
|
5452 | storeMappingPair(state2, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos);
|
5453 | keyTag = keyNode = valueNode = null;
|
5454 | }
|
5455 | skipSeparationSpace(state2, true, -1);
|
5456 | ch = state2.input.charCodeAt(state2.position);
|
5457 | }
|
5458 | if ((state2.line === _line || state2.lineIndent > nodeIndent) && ch !== 0) {
|
5459 | throwError(state2, "bad indentation of a mapping entry");
|
5460 | } else if (state2.lineIndent < nodeIndent) {
|
5461 | break;
|
5462 | }
|
5463 | }
|
5464 | if (atExplicitKey) {
|
5465 | storeMappingPair(state2, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
|
5466 | }
|
5467 | if (detected) {
|
5468 | state2.tag = _tag;
|
5469 | state2.anchor = _anchor;
|
5470 | state2.kind = "mapping";
|
5471 | state2.result = _result;
|
5472 | }
|
5473 | return detected;
|
5474 | }
|
5475 | function readTagProperty(state2) {
|
5476 | var _position, isVerbatim = false, isNamed = false, tagHandle, tagName, ch;
|
5477 | ch = state2.input.charCodeAt(state2.position);
|
5478 | if (ch !== 33)
|
5479 | return false;
|
5480 | if (state2.tag !== null) {
|
5481 | throwError(state2, "duplication of a tag property");
|
5482 | }
|
5483 | ch = state2.input.charCodeAt(++state2.position);
|
5484 | if (ch === 60) {
|
5485 | isVerbatim = true;
|
5486 | ch = state2.input.charCodeAt(++state2.position);
|
5487 | } else if (ch === 33) {
|
5488 | isNamed = true;
|
5489 | tagHandle = "!!";
|
5490 | ch = state2.input.charCodeAt(++state2.position);
|
5491 | } else {
|
5492 | tagHandle = "!";
|
5493 | }
|
5494 | _position = state2.position;
|
5495 | if (isVerbatim) {
|
5496 | do {
|
5497 | ch = state2.input.charCodeAt(++state2.position);
|
5498 | } while (ch !== 0 && ch !== 62);
|
5499 | if (state2.position < state2.length) {
|
5500 | tagName = state2.input.slice(_position, state2.position);
|
5501 | ch = state2.input.charCodeAt(++state2.position);
|
5502 | } else {
|
5503 | throwError(state2, "unexpected end of the stream within a verbatim tag");
|
5504 | }
|
5505 | } else {
|
5506 | while (ch !== 0 && !is_WS_OR_EOL(ch)) {
|
5507 | if (ch === 33) {
|
5508 | if (!isNamed) {
|
5509 | tagHandle = state2.input.slice(_position - 1, state2.position + 1);
|
5510 | if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
|
5511 | throwError(state2, "named tag handle cannot contain such characters");
|
5512 | }
|
5513 | isNamed = true;
|
5514 | _position = state2.position + 1;
|
5515 | } else {
|
5516 | throwError(state2, "tag suffix cannot contain exclamation marks");
|
5517 | }
|
5518 | }
|
5519 | ch = state2.input.charCodeAt(++state2.position);
|
5520 | }
|
5521 | tagName = state2.input.slice(_position, state2.position);
|
5522 | if (PATTERN_FLOW_INDICATORS.test(tagName)) {
|
5523 | throwError(state2, "tag suffix cannot contain flow indicator characters");
|
5524 | }
|
5525 | }
|
5526 | if (tagName && !PATTERN_TAG_URI.test(tagName)) {
|
5527 | throwError(state2, "tag name cannot contain such characters: " + tagName);
|
5528 | }
|
5529 | try {
|
5530 | tagName = decodeURIComponent(tagName);
|
5531 | } catch (err) {
|
5532 | throwError(state2, "tag name is malformed: " + tagName);
|
5533 | }
|
5534 | if (isVerbatim) {
|
5535 | state2.tag = tagName;
|
5536 | } else if (_hasOwnProperty$1.call(state2.tagMap, tagHandle)) {
|
5537 | state2.tag = state2.tagMap[tagHandle] + tagName;
|
5538 | } else if (tagHandle === "!") {
|
5539 | state2.tag = "!" + tagName;
|
5540 | } else if (tagHandle === "!!") {
|
5541 | state2.tag = "tag:yaml.org,2002:" + tagName;
|
5542 | } else {
|
5543 | throwError(state2, 'undeclared tag handle "' + tagHandle + '"');
|
5544 | }
|
5545 | return true;
|
5546 | }
|
5547 | function readAnchorProperty(state2) {
|
5548 | var _position, ch;
|
5549 | ch = state2.input.charCodeAt(state2.position);
|
5550 | if (ch !== 38)
|
5551 | return false;
|
5552 | if (state2.anchor !== null) {
|
5553 | throwError(state2, "duplication of an anchor property");
|
5554 | }
|
5555 | ch = state2.input.charCodeAt(++state2.position);
|
5556 | _position = state2.position;
|
5557 | while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
|
5558 | ch = state2.input.charCodeAt(++state2.position);
|
5559 | }
|
5560 | if (state2.position === _position) {
|
5561 | throwError(state2, "name of an anchor node must contain at least one character");
|
5562 | }
|
5563 | state2.anchor = state2.input.slice(_position, state2.position);
|
5564 | return true;
|
5565 | }
|
5566 | function readAlias(state2) {
|
5567 | var _position, alias, ch;
|
5568 | ch = state2.input.charCodeAt(state2.position);
|
5569 | if (ch !== 42)
|
5570 | return false;
|
5571 | ch = state2.input.charCodeAt(++state2.position);
|
5572 | _position = state2.position;
|
5573 | while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
|
5574 | ch = state2.input.charCodeAt(++state2.position);
|
5575 | }
|
5576 | if (state2.position === _position) {
|
5577 | throwError(state2, "name of an alias node must contain at least one character");
|
5578 | }
|
5579 | alias = state2.input.slice(_position, state2.position);
|
5580 | if (!_hasOwnProperty$1.call(state2.anchorMap, alias)) {
|
5581 | throwError(state2, 'unidentified alias "' + alias + '"');
|
5582 | }
|
5583 | state2.result = state2.anchorMap[alias];
|
5584 | skipSeparationSpace(state2, true, -1);
|
5585 | return true;
|
5586 | }
|
5587 | function composeNode(state2, parentIndent, nodeContext, allowToSeek, allowCompact) {
|
5588 | var allowBlockStyles, allowBlockScalars, allowBlockCollections, indentStatus = 1, atNewLine = false, hasContent = false, typeIndex, typeQuantity, typeList, type2, flowIndent, blockIndent;
|
5589 | if (state2.listener !== null) {
|
5590 | state2.listener("open", state2);
|
5591 | }
|
5592 | state2.tag = null;
|
5593 | state2.anchor = null;
|
5594 | state2.kind = null;
|
5595 | state2.result = null;
|
5596 | allowBlockStyles = allowBlockScalars = allowBlockCollections = CONTEXT_BLOCK_OUT === nodeContext || CONTEXT_BLOCK_IN === nodeContext;
|
5597 | if (allowToSeek) {
|
5598 | if (skipSeparationSpace(state2, true, -1)) {
|
5599 | atNewLine = true;
|
5600 | if (state2.lineIndent > parentIndent) {
|
5601 | indentStatus = 1;
|
5602 | } else if (state2.lineIndent === parentIndent) {
|
5603 | indentStatus = 0;
|
5604 | } else if (state2.lineIndent < parentIndent) {
|
5605 | indentStatus = -1;
|
5606 | }
|
5607 | }
|
5608 | }
|
5609 | if (indentStatus === 1) {
|
5610 | while (readTagProperty(state2) || readAnchorProperty(state2)) {
|
5611 | if (skipSeparationSpace(state2, true, -1)) {
|
5612 | atNewLine = true;
|
5613 | allowBlockCollections = allowBlockStyles;
|
5614 | if (state2.lineIndent > parentIndent) {
|
5615 | indentStatus = 1;
|
5616 | } else if (state2.lineIndent === parentIndent) {
|
5617 | indentStatus = 0;
|
5618 | } else if (state2.lineIndent < parentIndent) {
|
5619 | indentStatus = -1;
|
5620 | }
|
5621 | } else {
|
5622 | allowBlockCollections = false;
|
5623 | }
|
5624 | }
|
5625 | }
|
5626 | if (allowBlockCollections) {
|
5627 | allowBlockCollections = atNewLine || allowCompact;
|
5628 | }
|
5629 | if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) {
|
5630 | if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) {
|
5631 | flowIndent = parentIndent;
|
5632 | } else {
|
5633 | flowIndent = parentIndent + 1;
|
5634 | }
|
5635 | blockIndent = state2.position - state2.lineStart;
|
5636 | if (indentStatus === 1) {
|
5637 | if (allowBlockCollections && (readBlockSequence(state2, blockIndent) || readBlockMapping(state2, blockIndent, flowIndent)) || readFlowCollection(state2, flowIndent)) {
|
5638 | hasContent = true;
|
5639 | } else {
|
5640 | if (allowBlockScalars && readBlockScalar(state2, flowIndent) || readSingleQuotedScalar(state2, flowIndent) || readDoubleQuotedScalar(state2, flowIndent)) {
|
5641 | hasContent = true;
|
5642 | } else if (readAlias(state2)) {
|
5643 | hasContent = true;
|
5644 | if (state2.tag !== null || state2.anchor !== null) {
|
5645 | throwError(state2, "alias node should not have any properties");
|
5646 | }
|
5647 | } else if (readPlainScalar(state2, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
|
5648 | hasContent = true;
|
5649 | if (state2.tag === null) {
|
5650 | state2.tag = "?";
|
5651 | }
|
5652 | }
|
5653 | if (state2.anchor !== null) {
|
5654 | state2.anchorMap[state2.anchor] = state2.result;
|
5655 | }
|
5656 | }
|
5657 | } else if (indentStatus === 0) {
|
5658 | hasContent = allowBlockCollections && readBlockSequence(state2, blockIndent);
|
5659 | }
|
5660 | }
|
5661 | if (state2.tag === null) {
|
5662 | if (state2.anchor !== null) {
|
5663 | state2.anchorMap[state2.anchor] = state2.result;
|
5664 | }
|
5665 | } else if (state2.tag === "?") {
|
5666 | if (state2.result !== null && state2.kind !== "scalar") {
|
5667 | throwError(state2, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + state2.kind + '"');
|
5668 | }
|
5669 | for (typeIndex = 0, typeQuantity = state2.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {
|
5670 | type2 = state2.implicitTypes[typeIndex];
|
5671 | if (type2.resolve(state2.result)) {
|
5672 | state2.result = type2.construct(state2.result);
|
5673 | state2.tag = type2.tag;
|
5674 | if (state2.anchor !== null) {
|
5675 | state2.anchorMap[state2.anchor] = state2.result;
|
5676 | }
|
5677 | break;
|
5678 | }
|
5679 | }
|
5680 | } else if (state2.tag !== "!") {
|
5681 | if (_hasOwnProperty$1.call(state2.typeMap[state2.kind || "fallback"], state2.tag)) {
|
5682 | type2 = state2.typeMap[state2.kind || "fallback"][state2.tag];
|
5683 | } else {
|
5684 | type2 = null;
|
5685 | typeList = state2.typeMap.multi[state2.kind || "fallback"];
|
5686 | for (typeIndex = 0, typeQuantity = typeList.length; typeIndex < typeQuantity; typeIndex += 1) {
|
5687 | if (state2.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) {
|
5688 | type2 = typeList[typeIndex];
|
5689 | break;
|
5690 | }
|
5691 | }
|
5692 | }
|
5693 | if (!type2) {
|
5694 | throwError(state2, "unknown tag !<" + state2.tag + ">");
|
5695 | }
|
5696 | if (state2.result !== null && type2.kind !== state2.kind) {
|
5697 | throwError(state2, "unacceptable node kind for !<" + state2.tag + '> tag; it should be "' + type2.kind + '", not "' + state2.kind + '"');
|
5698 | }
|
5699 | if (!type2.resolve(state2.result, state2.tag)) {
|
5700 | throwError(state2, "cannot resolve a node with !<" + state2.tag + "> explicit tag");
|
5701 | } else {
|
5702 | state2.result = type2.construct(state2.result, state2.tag);
|
5703 | if (state2.anchor !== null) {
|
5704 | state2.anchorMap[state2.anchor] = state2.result;
|
5705 | }
|
5706 | }
|
5707 | }
|
5708 | if (state2.listener !== null) {
|
5709 | state2.listener("close", state2);
|
5710 | }
|
5711 | return state2.tag !== null || state2.anchor !== null || hasContent;
|
5712 | }
|
5713 | function readDocument(state2) {
|
5714 | var documentStart = state2.position, _position, directiveName, directiveArgs, hasDirectives = false, ch;
|
5715 | state2.version = null;
|
5716 | state2.checkLineBreaks = state2.legacy;
|
5717 | state2.tagMap = Object.create(null);
|
5718 | state2.anchorMap = Object.create(null);
|
5719 | while ((ch = state2.input.charCodeAt(state2.position)) !== 0) {
|
5720 | skipSeparationSpace(state2, true, -1);
|
5721 | ch = state2.input.charCodeAt(state2.position);
|
5722 | if (state2.lineIndent > 0 || ch !== 37) {
|
5723 | break;
|
5724 | }
|
5725 | hasDirectives = true;
|
5726 | ch = state2.input.charCodeAt(++state2.position);
|
5727 | _position = state2.position;
|
5728 | while (ch !== 0 && !is_WS_OR_EOL(ch)) {
|
5729 | ch = state2.input.charCodeAt(++state2.position);
|
5730 | }
|
5731 | directiveName = state2.input.slice(_position, state2.position);
|
5732 | directiveArgs = [];
|
5733 | if (directiveName.length < 1) {
|
5734 | throwError(state2, "directive name must not be less than one character in length");
|
5735 | }
|
5736 | while (ch !== 0) {
|
5737 | while (is_WHITE_SPACE(ch)) {
|
5738 | ch = state2.input.charCodeAt(++state2.position);
|
5739 | }
|
5740 | if (ch === 35) {
|
5741 | do {
|
5742 | ch = state2.input.charCodeAt(++state2.position);
|
5743 | } while (ch !== 0 && !is_EOL(ch));
|
5744 | break;
|
5745 | }
|
5746 | if (is_EOL(ch))
|
5747 | break;
|
5748 | _position = state2.position;
|
5749 | while (ch !== 0 && !is_WS_OR_EOL(ch)) {
|
5750 | ch = state2.input.charCodeAt(++state2.position);
|
5751 | }
|
5752 | directiveArgs.push(state2.input.slice(_position, state2.position));
|
5753 | }
|
5754 | if (ch !== 0)
|
5755 | readLineBreak(state2);
|
5756 | if (_hasOwnProperty$1.call(directiveHandlers, directiveName)) {
|
5757 | directiveHandlers[directiveName](state2, directiveName, directiveArgs);
|
5758 | } else {
|
5759 | throwWarning(state2, 'unknown document directive "' + directiveName + '"');
|
5760 | }
|
5761 | }
|
5762 | skipSeparationSpace(state2, true, -1);
|
5763 | if (state2.lineIndent === 0 && state2.input.charCodeAt(state2.position) === 45 && state2.input.charCodeAt(state2.position + 1) === 45 && state2.input.charCodeAt(state2.position + 2) === 45) {
|
5764 | state2.position += 3;
|
5765 | skipSeparationSpace(state2, true, -1);
|
5766 | } else if (hasDirectives) {
|
5767 | throwError(state2, "directives end mark is expected");
|
5768 | }
|
5769 | composeNode(state2, state2.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
|
5770 | skipSeparationSpace(state2, true, -1);
|
5771 | if (state2.checkLineBreaks && PATTERN_NON_ASCII_LINE_BREAKS.test(state2.input.slice(documentStart, state2.position))) {
|
5772 | throwWarning(state2, "non-ASCII line breaks are interpreted as content");
|
5773 | }
|
5774 | state2.documents.push(state2.result);
|
5775 | if (state2.position === state2.lineStart && testDocumentSeparator(state2)) {
|
5776 | if (state2.input.charCodeAt(state2.position) === 46) {
|
5777 | state2.position += 3;
|
5778 | skipSeparationSpace(state2, true, -1);
|
5779 | }
|
5780 | return;
|
5781 | }
|
5782 | if (state2.position < state2.length - 1) {
|
5783 | throwError(state2, "end of the stream or a document separator is expected");
|
5784 | } else {
|
5785 | return;
|
5786 | }
|
5787 | }
|
5788 | function loadDocuments(input, options) {
|
5789 | input = String(input);
|
5790 | options = options || {};
|
5791 | if (input.length !== 0) {
|
5792 | if (input.charCodeAt(input.length - 1) !== 10 && input.charCodeAt(input.length - 1) !== 13) {
|
5793 | input += "\n";
|
5794 | }
|
5795 | if (input.charCodeAt(0) === 65279) {
|
5796 | input = input.slice(1);
|
5797 | }
|
5798 | }
|
5799 | var state2 = new State$1(input, options);
|
5800 | var nullpos = input.indexOf("\0");
|
5801 | if (nullpos !== -1) {
|
5802 | state2.position = nullpos;
|
5803 | throwError(state2, "null byte is not allowed in input");
|
5804 | }
|
5805 | state2.input += "\0";
|
5806 | while (state2.input.charCodeAt(state2.position) === 32) {
|
5807 | state2.lineIndent += 1;
|
5808 | state2.position += 1;
|
5809 | }
|
5810 | while (state2.position < state2.length - 1) {
|
5811 | readDocument(state2);
|
5812 | }
|
5813 | return state2.documents;
|
5814 | }
|
5815 | function loadAll$1(input, iterator, options) {
|
5816 | if (iterator !== null && typeof iterator === "object" && typeof options === "undefined") {
|
5817 | options = iterator;
|
5818 | iterator = null;
|
5819 | }
|
5820 | var documents = loadDocuments(input, options);
|
5821 | if (typeof iterator !== "function") {
|
5822 | return documents;
|
5823 | }
|
5824 | for (var index = 0, length = documents.length; index < length; index += 1) {
|
5825 | iterator(documents[index]);
|
5826 | }
|
5827 | }
|
5828 | function load$1(input, options) {
|
5829 | var documents = loadDocuments(input, options);
|
5830 | if (documents.length === 0) {
|
5831 | return void 0;
|
5832 | } else if (documents.length === 1) {
|
5833 | return documents[0];
|
5834 | }
|
5835 | throw new exception("expected a single document in the stream, but found more");
|
5836 | }
|
5837 | var loadAll_1 = loadAll$1;
|
5838 | var load_1 = load$1;
|
5839 | var loader = {
|
5840 | loadAll: loadAll_1,
|
5841 | load: load_1
|
5842 | };
|
5843 | var JSON_SCHEMA = json;
|
5844 | var load = loader.load;
|
5845 | function extractFrontMatter(text) {
|
5846 | const matches = text.match(frontMatterRegex);
|
5847 | if (!matches) {
|
5848 | return {
|
5849 | text,
|
5850 | metadata: {}
|
5851 | };
|
5852 | }
|
5853 | let parsed = load(matches[1], {
|
5854 |
|
5855 |
|
5856 | schema: JSON_SCHEMA
|
5857 | }) ?? {};
|
5858 | parsed = typeof parsed === "object" && !Array.isArray(parsed) ? parsed : {};
|
5859 | const metadata = {};
|
5860 | if (parsed.displayMode) {
|
5861 | metadata.displayMode = parsed.displayMode.toString();
|
5862 | }
|
5863 | if (parsed.title) {
|
5864 | metadata.title = parsed.title.toString();
|
5865 | }
|
5866 | if (parsed.config) {
|
5867 | metadata.config = parsed.config;
|
5868 | }
|
5869 | return {
|
5870 | text: text.slice(matches[0].length),
|
5871 | metadata
|
5872 | };
|
5873 | }
|
5874 | const cleanupText = (code) => {
|
5875 | return code.replace(/\r\n?/g, "\n").replace(
|
5876 | /<(\w+)([^>]*)>/g,
|
5877 | (match, tag, attributes) => "<" + tag + attributes.replace(/="([^"]*)"/g, "='$1'") + ">"
|
5878 | );
|
5879 | };
|
5880 | const processFrontmatter = (code) => {
|
5881 | const { text, metadata } = extractFrontMatter(code);
|
5882 | const { displayMode, title, config: config2 = {} } = metadata;
|
5883 | if (displayMode) {
|
5884 | if (!config2.gantt) {
|
5885 | config2.gantt = {};
|
5886 | }
|
5887 | config2.gantt.displayMode = displayMode;
|
5888 | }
|
5889 | return { title, config: config2, text };
|
5890 | };
|
5891 | const processDirectives = (code) => {
|
5892 | const initDirective = utils.detectInit(code) ?? {};
|
5893 | const wrapDirectives = utils.detectDirective(code, "wrap");
|
5894 | if (Array.isArray(wrapDirectives)) {
|
5895 | initDirective.wrap = wrapDirectives.some(({ type: type2 }) => {
|
5896 | });
|
5897 | } else if ((wrapDirectives == null ? void 0 : wrapDirectives.type) === "wrap") {
|
5898 | initDirective.wrap = true;
|
5899 | }
|
5900 | return {
|
5901 | text: removeDirectives(code),
|
5902 | directive: initDirective
|
5903 | };
|
5904 | };
|
5905 | function preprocessDiagram(code) {
|
5906 | const cleanedCode = cleanupText(code);
|
5907 | const frontMatterResult = processFrontmatter(cleanedCode);
|
5908 | const directiveResult = processDirectives(frontMatterResult.text);
|
5909 | const config2 = cleanAndMerge(frontMatterResult.config, directiveResult.directive);
|
5910 | code = cleanupComments(directiveResult.text);
|
5911 | return {
|
5912 | code,
|
5913 | title: frontMatterResult.title,
|
5914 | config: config2
|
5915 | };
|
5916 | }
|
5917 | const MAX_TEXTLENGTH = 5e4;
|
5918 | const MAX_TEXTLENGTH_EXCEEDED_MSG = "graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa";
|
5919 | const SECURITY_LVL_SANDBOX = "sandbox";
|
5920 | const SECURITY_LVL_LOOSE = "loose";
|
5921 | const XMLNS_SVG_STD = "http://www.w3.org/2000/svg";
|
5922 | const XMLNS_XLINK_STD = "http://www.w3.org/1999/xlink";
|
5923 | const XMLNS_XHTML_STD = "http://www.w3.org/1999/xhtml";
|
5924 | const IFRAME_WIDTH = "100%";
|
5925 | const IFRAME_HEIGHT = "100%";
|
5926 | const IFRAME_STYLES = "border:0;margin:0;";
|
5927 | const IFRAME_BODY_STYLE = "margin:0";
|
5928 | const IFRAME_SANDBOX_OPTS = "allow-top-navigation-by-user-activation allow-popups";
|
5929 | const IFRAME_NOT_SUPPORTED_MSG = 'The "iframe" tag is not supported by your browser.';
|
5930 | const DOMPURIFY_TAGS = ["foreignobject"];
|
5931 | const DOMPURIFY_ATTR = ["dominant-baseline"];
|
5932 | function processAndSetConfigs(text) {
|
5933 | const processed = preprocessDiagram(text);
|
5934 | reset();
|
5935 | addDirective(processed.config ?? {});
|
5936 | return processed;
|
5937 | }
|
5938 | async function parse$1(text, parseOptions) {
|
5939 | addDiagrams();
|
5940 | text = processAndSetConfigs(text).code;
|
5941 | try {
|
5942 | await getDiagramFromText(text);
|
5943 | } catch (error) {
|
5944 | if (parseOptions == null ? void 0 : parseOptions.suppressErrors) {
|
5945 | return false;
|
5946 | }
|
5947 | throw error;
|
5948 | }
|
5949 | return true;
|
5950 | }
|
5951 | const cssImportantStyles = (cssClass, element, cssClasses = []) => {
|
5952 | return `
|
5953 | .${cssClass} ${element} { ${cssClasses.join(" !important; ")} !important; }`;
|
5954 | };
|
5955 | const createCssStyles = (config2, classDefs = {}) => {
|
5956 | var _a;
|
5957 | let cssStyles = "";
|
5958 | if (config2.themeCSS !== void 0) {
|
5959 | cssStyles += `
|
5960 | ${config2.themeCSS}`;
|
5961 | }
|
5962 | if (config2.fontFamily !== void 0) {
|
5963 | cssStyles += `
|
5964 | :root { --mermaid-font-family: ${config2.fontFamily}}`;
|
5965 | }
|
5966 | if (config2.altFontFamily !== void 0) {
|
5967 | cssStyles += `
|
5968 | :root { --mermaid-alt-font-family: ${config2.altFontFamily}}`;
|
5969 | }
|
5970 | if (!isEmpty(classDefs)) {
|
5971 | const htmlLabels = config2.htmlLabels || ((_a = config2.flowchart) == null ? void 0 : _a.htmlLabels);
|
5972 | const cssHtmlElements = ["> *", "span"];
|
5973 | const cssShapeElements = ["rect", "polygon", "ellipse", "circle", "path"];
|
5974 | const cssElements = htmlLabels ? cssHtmlElements : cssShapeElements;
|
5975 | for (const classId in classDefs) {
|
5976 | const styleClassDef = classDefs[classId];
|
5977 | if (!isEmpty(styleClassDef.styles)) {
|
5978 | cssElements.forEach((cssElement) => {
|
5979 | cssStyles += cssImportantStyles(styleClassDef.id, cssElement, styleClassDef.styles);
|
5980 | });
|
5981 | }
|
5982 | if (!isEmpty(styleClassDef.textStyles)) {
|
5983 | cssStyles += cssImportantStyles(styleClassDef.id, "tspan", styleClassDef.textStyles);
|
5984 | }
|
5985 | }
|
5986 | }
|
5987 | return cssStyles;
|
5988 | };
|
5989 | const createUserStyles = (config2, graphType, classDefs, svgId) => {
|
5990 | const userCSSstyles = createCssStyles(config2, classDefs);
|
5991 | const allStyles = getStyles$1(graphType, userCSSstyles, config2.themeVariables);
|
5992 | return serialize(compile(`${svgId}{${allStyles}}`), stringify);
|
5993 | };
|
5994 | const cleanUpSvgCode = (svgCode = "", inSandboxMode, useArrowMarkerUrls) => {
|
5995 | let cleanedUpSvg = svgCode;
|
5996 | if (!useArrowMarkerUrls && !inSandboxMode) {
|
5997 | cleanedUpSvg = cleanedUpSvg.replace(
|
5998 | /marker-end="url\([\d+./:=?A-Za-z-]*?#/g,
|
5999 | 'marker-end="url(#'
|
6000 | );
|
6001 | }
|
6002 | cleanedUpSvg = decodeEntities(cleanedUpSvg);
|
6003 | cleanedUpSvg = cleanedUpSvg.replace(/<br>/g, "<br/>");
|
6004 | return cleanedUpSvg;
|
6005 | };
|
6006 | const putIntoIFrame = (svgCode = "", svgElement) => {
|
6007 | var _a, _b;
|
6008 | const height = ((_b = (_a = svgElement == null ? void 0 : svgElement.viewBox) == null ? void 0 : _a.baseVal) == null ? void 0 : _b.height) ? svgElement.viewBox.baseVal.height + "px" : IFRAME_HEIGHT;
|
6009 | const base64encodedSrc = btoa('<body style="' + IFRAME_BODY_STYLE + '">' + svgCode + "</body>");
|
6010 | return `<iframe style="width:${IFRAME_WIDTH};height:${height};${IFRAME_STYLES}" src="data:text/html;base64,${base64encodedSrc}" sandbox="${IFRAME_SANDBOX_OPTS}">
|
6011 | ${IFRAME_NOT_SUPPORTED_MSG}
|
6012 | </iframe>`;
|
6013 | };
|
6014 | const appendDivSvgG = (parentRoot, id2, enclosingDivId, divStyle, svgXlink) => {
|
6015 | const enclosingDiv = parentRoot.append("div");
|
6016 | enclosingDiv.attr("id", enclosingDivId);
|
6017 | if (divStyle) {
|
6018 | enclosingDiv.attr("style", divStyle);
|
6019 | }
|
6020 | const svgNode = enclosingDiv.append("svg").attr("id", id2).attr("width", "100%").attr("xmlns", XMLNS_SVG_STD);
|
6021 | if (svgXlink) {
|
6022 | svgNode.attr("xmlns:xlink", svgXlink);
|
6023 | }
|
6024 | svgNode.append("g");
|
6025 | return parentRoot;
|
6026 | };
|
6027 | function sandboxedIframe(parentNode, iFrameId) {
|
6028 | return parentNode.append("iframe").attr("id", iFrameId).attr("style", "width: 100%; height: 100%;").attr("sandbox", "");
|
6029 | }
|
6030 | const removeExistingElements = (doc, id2, divId, iFrameId) => {
|
6031 | var _a, _b, _c;
|
6032 | (_a = doc.getElementById(id2)) == null ? void 0 : _a.remove();
|
6033 | (_b = doc.getElementById(divId)) == null ? void 0 : _b.remove();
|
6034 | (_c = doc.getElementById(iFrameId)) == null ? void 0 : _c.remove();
|
6035 | };
|
6036 | const render$1 = async function(id2, text, svgContainingElement) {
|
6037 | var _a, _b, _c, _d, _e, _f;
|
6038 | addDiagrams();
|
6039 | const processed = processAndSetConfigs(text);
|
6040 | text = processed.code;
|
6041 | const config2 = getConfig$1();
|
6042 | log$1.debug(config2);
|
6043 | if (text.length > ((config2 == null ? void 0 : config2.maxTextSize) ?? MAX_TEXTLENGTH)) {
|
6044 | text = MAX_TEXTLENGTH_EXCEEDED_MSG;
|
6045 | }
|
6046 | const idSelector = "#" + id2;
|
6047 | const iFrameID = "i" + id2;
|
6048 | const iFrameID_selector = "#" + iFrameID;
|
6049 | const enclosingDivID = "d" + id2;
|
6050 | const enclosingDivID_selector = "#" + enclosingDivID;
|
6051 | let root = select("body");
|
6052 | const isSandboxed = config2.securityLevel === SECURITY_LVL_SANDBOX;
|
6053 | const isLooseSecurityLevel = config2.securityLevel === SECURITY_LVL_LOOSE;
|
6054 | const fontFamily = config2.fontFamily;
|
6055 | if (svgContainingElement !== void 0) {
|
6056 | if (svgContainingElement) {
|
6057 | svgContainingElement.innerHTML = "";
|
6058 | }
|
6059 | if (isSandboxed) {
|
6060 | const iframe = sandboxedIframe(select(svgContainingElement), iFrameID);
|
6061 | root = select(iframe.nodes()[0].contentDocument.body);
|
6062 | root.node().style.margin = 0;
|
6063 | } else {
|
6064 | root = select(svgContainingElement);
|
6065 | }
|
6066 | appendDivSvgG(root, id2, enclosingDivID, `font-family: ${fontFamily}`, XMLNS_XLINK_STD);
|
6067 | } else {
|
6068 | removeExistingElements(document, id2, enclosingDivID, iFrameID);
|
6069 | if (isSandboxed) {
|
6070 | const iframe = sandboxedIframe(select("body"), iFrameID);
|
6071 | root = select(iframe.nodes()[0].contentDocument.body);
|
6072 | root.node().style.margin = 0;
|
6073 | } else {
|
6074 | root = select("body");
|
6075 | }
|
6076 | appendDivSvgG(root, id2, enclosingDivID);
|
6077 | }
|
6078 | let diag;
|
6079 | let parseEncounteredException;
|
6080 | try {
|
6081 | diag = await getDiagramFromText(text, { title: processed.title });
|
6082 | } catch (error) {
|
6083 | diag = new Diagram("error");
|
6084 | parseEncounteredException = error;
|
6085 | }
|
6086 | const element = root.select(enclosingDivID_selector).node();
|
6087 | const diagramType = diag.type;
|
6088 | const svg = element.firstChild;
|
6089 | const firstChild = svg.firstChild;
|
6090 | const diagramClassDefs = (_b = (_a = diag.renderer).getClasses) == null ? void 0 : _b.call(_a, text, diag);
|
6091 | const rules = createUserStyles(config2, diagramType, diagramClassDefs, idSelector);
|
6092 | const style1 = document.createElement("style");
|
6093 | style1.innerHTML = rules;
|
6094 | svg.insertBefore(style1, firstChild);
|
6095 | try {
|
6096 | await diag.renderer.draw(text, id2, version, diag);
|
6097 | } catch (e) {
|
6098 | errorRenderer.draw(text, id2, version);
|
6099 | throw e;
|
6100 | }
|
6101 | const svgNode = root.select(`${enclosingDivID_selector} svg`);
|
6102 | const a11yTitle = (_d = (_c = diag.db).getAccTitle) == null ? void 0 : _d.call(_c);
|
6103 | const a11yDescr = (_f = (_e = diag.db).getAccDescription) == null ? void 0 : _f.call(_e);
|
6104 | addA11yInfo(diagramType, svgNode, a11yTitle, a11yDescr);
|
6105 | root.select(`[id="${id2}"]`).selectAll("foreignobject > *").attr("xmlns", XMLNS_XHTML_STD);
|
6106 | let svgCode = root.select(enclosingDivID_selector).node().innerHTML;
|
6107 | log$1.debug("config.arrowMarkerAbsolute", config2.arrowMarkerAbsolute);
|
6108 | svgCode = cleanUpSvgCode(svgCode, isSandboxed, evaluate(config2.arrowMarkerAbsolute));
|
6109 | if (isSandboxed) {
|
6110 | const svgEl = root.select(enclosingDivID_selector + " svg").node();
|
6111 | svgCode = putIntoIFrame(svgCode, svgEl);
|
6112 | } else if (!isLooseSecurityLevel) {
|
6113 | svgCode = DOMPurify.sanitize(svgCode, {
|
6114 | ADD_TAGS: DOMPURIFY_TAGS,
|
6115 | ADD_ATTR: DOMPURIFY_ATTR
|
6116 | });
|
6117 | }
|
6118 | attachFunctions();
|
6119 | if (parseEncounteredException) {
|
6120 | throw parseEncounteredException;
|
6121 | }
|
6122 | const tmpElementSelector = isSandboxed ? iFrameID_selector : enclosingDivID_selector;
|
6123 | const node = select(tmpElementSelector).node();
|
6124 | if (node && "remove" in node) {
|
6125 | node.remove();
|
6126 | }
|
6127 | return {
|
6128 | svg: svgCode,
|
6129 | bindFunctions: diag.db.bindFunctions
|
6130 | };
|
6131 | };
|
6132 | function initialize$1(options = {}) {
|
6133 | var _a;
|
6134 | if ((options == null ? void 0 : options.fontFamily) && !((_a = options.themeVariables) == null ? void 0 : _a.fontFamily)) {
|
6135 | if (!options.themeVariables) {
|
6136 | options.themeVariables = {};
|
6137 | }
|
6138 | options.themeVariables.fontFamily = options.fontFamily;
|
6139 | }
|
6140 | saveConfigFromInitialize(options);
|
6141 | if ((options == null ? void 0 : options.theme) && options.theme in theme) {
|
6142 | options.themeVariables = theme[options.theme].getThemeVariables(
|
6143 | options.themeVariables
|
6144 | );
|
6145 | } else if (options) {
|
6146 | options.themeVariables = theme.default.getThemeVariables(options.themeVariables);
|
6147 | }
|
6148 | const config2 = typeof options === "object" ? setSiteConfig(options) : getSiteConfig();
|
6149 | setLogLevel$1(config2.logLevel);
|
6150 | addDiagrams();
|
6151 | }
|
6152 | const getDiagramFromText = (text, metadata = {}) => {
|
6153 | const { code } = preprocessDiagram(text);
|
6154 | return getDiagramFromText$1(code, metadata);
|
6155 | };
|
6156 | function addA11yInfo(diagramType, svgNode, a11yTitle, a11yDescr) {
|
6157 | setA11yDiagramInfo(svgNode, diagramType);
|
6158 | addSVGa11yTitleDescription(svgNode, a11yTitle, a11yDescr, svgNode.attr("id"));
|
6159 | }
|
6160 | const mermaidAPI = Object.freeze({
|
6161 | render: render$1,
|
6162 | parse: parse$1,
|
6163 | getDiagramFromText,
|
6164 | initialize: initialize$1,
|
6165 | getConfig: getConfig$1,
|
6166 | setConfig: setConfig$1,
|
6167 | getSiteConfig,
|
6168 | updateSiteConfig,
|
6169 | reset: () => {
|
6170 | reset();
|
6171 | },
|
6172 | globalReset: () => {
|
6173 | reset(defaultConfig$1);
|
6174 | },
|
6175 | defaultConfig: defaultConfig$1
|
6176 | });
|
6177 | setLogLevel$1(getConfig$1().logLevel);
|
6178 | reset(getConfig$1());
|
6179 | const loadRegisteredDiagrams = async () => {
|
6180 | log$1.debug(`Loading registered diagrams`);
|
6181 | const results = await Promise.allSettled(
|
6182 | Object.entries(detectors).map(async ([key, { detector: detector2, loader: loader2 }]) => {
|
6183 | if (loader2) {
|
6184 | try {
|
6185 | getDiagram(key);
|
6186 | } catch (error) {
|
6187 | try {
|
6188 | const { diagram: diagram2, id: id2 } = await loader2();
|
6189 | registerDiagram(id2, diagram2, detector2);
|
6190 | } catch (err) {
|
6191 | log$1.error(`Failed to load external diagram with key ${key}. Removing from detectors.`);
|
6192 | delete detectors[key];
|
6193 | throw err;
|
6194 | }
|
6195 | }
|
6196 | }
|
6197 | })
|
6198 | );
|
6199 | const failed = results.filter((result) => result.status === "rejected");
|
6200 | if (failed.length > 0) {
|
6201 | log$1.error(`Failed to load ${failed.length} external diagrams`);
|
6202 | for (const res of failed) {
|
6203 | log$1.error(res);
|
6204 | }
|
6205 | throw new Error(`Failed to load ${failed.length} external diagrams`);
|
6206 | }
|
6207 | };
|
6208 | const handleError = (error, errors, parseError) => {
|
6209 | log$1.warn(error);
|
6210 | if (isDetailedError(error)) {
|
6211 | if (parseError) {
|
6212 | parseError(error.str, error.hash);
|
6213 | }
|
6214 | errors.push({ ...error, message: error.str, error });
|
6215 | } else {
|
6216 | if (parseError) {
|
6217 | parseError(error);
|
6218 | }
|
6219 | if (error instanceof Error) {
|
6220 | errors.push({
|
6221 | str: error.message,
|
6222 | message: error.message,
|
6223 | hash: error.name,
|
6224 | error
|
6225 | });
|
6226 | }
|
6227 | }
|
6228 | };
|
6229 | const run = async function(options = {
|
6230 | querySelector: ".mermaid"
|
6231 | }) {
|
6232 | try {
|
6233 | await runThrowsErrors(options);
|
6234 | } catch (e) {
|
6235 | if (isDetailedError(e)) {
|
6236 | log$1.error(e.str);
|
6237 | }
|
6238 | if (mermaid.parseError) {
|
6239 | mermaid.parseError(e);
|
6240 | }
|
6241 | if (!options.suppressErrors) {
|
6242 | log$1.error("Use the suppressErrors option to suppress these errors");
|
6243 | throw e;
|
6244 | }
|
6245 | }
|
6246 | };
|
6247 | const runThrowsErrors = async function({ postRenderCallback, querySelector, nodes } = {
|
6248 | querySelector: ".mermaid"
|
6249 | }) {
|
6250 | const conf = mermaidAPI.getConfig();
|
6251 | log$1.debug(`${!postRenderCallback ? "No " : ""}Callback function found`);
|
6252 | let nodesToProcess;
|
6253 | if (nodes) {
|
6254 | nodesToProcess = nodes;
|
6255 | } else if (querySelector) {
|
6256 | nodesToProcess = document.querySelectorAll(querySelector);
|
6257 | } else {
|
6258 | throw new Error("Nodes and querySelector are both undefined");
|
6259 | }
|
6260 | log$1.debug(`Found ${nodesToProcess.length} diagrams`);
|
6261 | if ((conf == null ? void 0 : conf.startOnLoad) !== void 0) {
|
6262 | log$1.debug("Start On Load: " + (conf == null ? void 0 : conf.startOnLoad));
|
6263 | mermaidAPI.updateSiteConfig({ startOnLoad: conf == null ? void 0 : conf.startOnLoad });
|
6264 | }
|
6265 | const idGenerator = new utils.InitIDGenerator(conf.deterministicIds, conf.deterministicIDSeed);
|
6266 | let txt;
|
6267 | const errors = [];
|
6268 | for (const element of Array.from(nodesToProcess)) {
|
6269 | log$1.info("Rendering diagram: " + element.id);
|
6270 | /*! Check if previously processed */
|
6271 | if (element.getAttribute("data-processed")) {
|
6272 | continue;
|
6273 | }
|
6274 | element.setAttribute("data-processed", "true");
|
6275 | const id2 = `mermaid-${idGenerator.next()}`;
|
6276 | txt = element.innerHTML;
|
6277 | txt = dedent(utils.entityDecode(txt)).trim().replace(/<br\s*\/?>/gi, "<br/>");
|
6278 | const init2 = utils.detectInit(txt);
|
6279 | if (init2) {
|
6280 | log$1.debug("Detected early reinit: ", init2);
|
6281 | }
|
6282 | try {
|
6283 | const { svg, bindFunctions } = await render(id2, txt, element);
|
6284 | element.innerHTML = svg;
|
6285 | if (postRenderCallback) {
|
6286 | await postRenderCallback(id2);
|
6287 | }
|
6288 | if (bindFunctions) {
|
6289 | bindFunctions(element);
|
6290 | }
|
6291 | } catch (error) {
|
6292 | handleError(error, errors, mermaid.parseError);
|
6293 | }
|
6294 | }
|
6295 | if (errors.length > 0) {
|
6296 | throw errors[0];
|
6297 | }
|
6298 | };
|
6299 | const initialize = function(config2) {
|
6300 | mermaidAPI.initialize(config2);
|
6301 | };
|
6302 | const init = async function(config2, nodes, callback) {
|
6303 | log$1.warn("mermaid.init is deprecated. Please use run instead.");
|
6304 | if (config2) {
|
6305 | initialize(config2);
|
6306 | }
|
6307 | const runOptions = { postRenderCallback: callback, querySelector: ".mermaid" };
|
6308 | if (typeof nodes === "string") {
|
6309 | runOptions.querySelector = nodes;
|
6310 | } else if (nodes) {
|
6311 | if (nodes instanceof HTMLElement) {
|
6312 | runOptions.nodes = [nodes];
|
6313 | } else {
|
6314 | runOptions.nodes = nodes;
|
6315 | }
|
6316 | }
|
6317 | await run(runOptions);
|
6318 | };
|
6319 | const registerExternalDiagrams = async (diagrams2, {
|
6320 | lazyLoad = true
|
6321 | } = {}) => {
|
6322 | registerLazyLoadedDiagrams(...diagrams2);
|
6323 | if (lazyLoad === false) {
|
6324 | await loadRegisteredDiagrams();
|
6325 | }
|
6326 | };
|
6327 | const contentLoaded = function() {
|
6328 | if (mermaid.startOnLoad) {
|
6329 | const { startOnLoad } = mermaidAPI.getConfig();
|
6330 | if (startOnLoad) {
|
6331 | mermaid.run().catch((err) => log$1.error("Mermaid failed to initialize", err));
|
6332 | }
|
6333 | }
|
6334 | };
|
6335 | if (typeof document !== "undefined") {
|
6336 | /*!
|
6337 | * Wait for document loaded before starting the execution
|
6338 | */
|
6339 | window.addEventListener("load", contentLoaded, false);
|
6340 | }
|
6341 | const setParseErrorHandler = function(parseErrorHandler) {
|
6342 | mermaid.parseError = parseErrorHandler;
|
6343 | };
|
6344 | const executionQueue = [];
|
6345 | let executionQueueRunning = false;
|
6346 | const executeQueue = async () => {
|
6347 | if (executionQueueRunning) {
|
6348 | return;
|
6349 | }
|
6350 | executionQueueRunning = true;
|
6351 | while (executionQueue.length > 0) {
|
6352 | const f = executionQueue.shift();
|
6353 | if (f) {
|
6354 | try {
|
6355 | await f();
|
6356 | } catch (e) {
|
6357 | log$1.error("Error executing queue", e);
|
6358 | }
|
6359 | }
|
6360 | }
|
6361 | executionQueueRunning = false;
|
6362 | };
|
6363 | const parse = async (text, parseOptions) => {
|
6364 | return new Promise((resolve, reject) => {
|
6365 | const performCall = () => new Promise((res, rej) => {
|
6366 | mermaidAPI.parse(text, parseOptions).then(
|
6367 | (r) => {
|
6368 | res(r);
|
6369 | resolve(r);
|
6370 | },
|
6371 | (e) => {
|
6372 | var _a;
|
6373 | log$1.error("Error parsing", e);
|
6374 | (_a = mermaid.parseError) == null ? void 0 : _a.call(mermaid, e);
|
6375 | rej(e);
|
6376 | reject(e);
|
6377 | }
|
6378 | );
|
6379 | });
|
6380 | executionQueue.push(performCall);
|
6381 | executeQueue().catch(reject);
|
6382 | });
|
6383 | };
|
6384 | const render = (id2, text, container) => {
|
6385 | return new Promise((resolve, reject) => {
|
6386 | const performCall = () => new Promise((res, rej) => {
|
6387 | mermaidAPI.render(id2, text, container).then(
|
6388 | (r) => {
|
6389 | res(r);
|
6390 | resolve(r);
|
6391 | },
|
6392 | (e) => {
|
6393 | var _a;
|
6394 | log$1.error("Error parsing", e);
|
6395 | (_a = mermaid.parseError) == null ? void 0 : _a.call(mermaid, e);
|
6396 | rej(e);
|
6397 | reject(e);
|
6398 | }
|
6399 | );
|
6400 | });
|
6401 | executionQueue.push(performCall);
|
6402 | executeQueue().catch(reject);
|
6403 | });
|
6404 | };
|
6405 | const mermaid = {
|
6406 | startOnLoad: true,
|
6407 | mermaidAPI,
|
6408 | parse,
|
6409 | render,
|
6410 | init,
|
6411 | run,
|
6412 | registerExternalDiagrams,
|
6413 | initialize,
|
6414 | parseError: void 0,
|
6415 | contentLoaded,
|
6416 | setParseErrorHandler,
|
6417 | detectType
|
6418 | };
|
6419 | export {
|
6420 | selectSvgElement as A,
|
6421 | defaultConfig$2 as B,
|
6422 | cleanAndMerge as C,
|
6423 | parseFontSize as D,
|
6424 | getThemeVariables$2 as E,
|
6425 | getConfig$1 as F,
|
6426 | hasKatex as G,
|
6427 | calculateMathMLDimensions as H,
|
6428 | generateId as I,
|
6429 | lineBreakRegex as J,
|
6430 | defaultConfig as K,
|
6431 | commonDb as L,
|
6432 | decodeEntities as M,
|
6433 | mermaid as N,
|
6434 | ZERO_WIDTH_SPACE as Z,
|
6435 | getAccDescription as a,
|
6436 | setAccDescription as b,
|
6437 | getConfig as c,
|
6438 | sanitizeText$2 as d,
|
6439 | common$1 as e,
|
6440 | assignWithDepth$1 as f,
|
6441 | getAccTitle as g,
|
6442 | calculateTextWidth as h,
|
6443 | configureSvgSize as i,
|
6444 | calculateTextHeight as j,
|
6445 | getStylesFromArray as k,
|
6446 | log$1 as l,
|
6447 | evaluate as m,
|
6448 | interpolateToCurve as n,
|
6449 | setupGraphViewbox$1 as o,
|
6450 | setConfig as p,
|
6451 | setDiagramTitle as q,
|
6452 | renderKatex as r,
|
6453 | setAccTitle as s,
|
6454 | getDiagramTitle as t,
|
6455 | utils as u,
|
6456 | clear as v,
|
6457 | wrapLabel as w,
|
6458 | parseGenericTypes as x,
|
6459 | random as y,
|
6460 | setupGraphViewbox as z
|
6461 | };
|