1 | function dedent(templ) {
|
2 | var values = [];
|
3 | for (var _i = 1; _i < arguments.length; _i++) {
|
4 | values[_i - 1] = arguments[_i];
|
5 | }
|
6 | var strings = Array.from(typeof templ === "string" ? [templ] : templ);
|
7 | strings[strings.length - 1] = strings[strings.length - 1].replace(/\r?\n([\t ]*)$/, "");
|
8 | var indentLengths = strings.reduce(function(arr, str2) {
|
9 | var matches = str2.match(/\n([\t ]+|(?!\s).)/g);
|
10 | if (matches) {
|
11 | return arr.concat(matches.map(function(match) {
|
12 | var _a, _b;
|
13 | return (_b = (_a = match.match(/[\t ]/g)) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
14 | }));
|
15 | }
|
16 | return arr;
|
17 | }, []);
|
18 | if (indentLengths.length) {
|
19 | var pattern_1 = new RegExp("\n[ ]{" + Math.min.apply(Math, indentLengths) + "}", "g");
|
20 | strings = strings.map(function(str2) {
|
21 | return str2.replace(pattern_1, "\n");
|
22 | });
|
23 | }
|
24 | strings[0] = strings[0].replace(/^\r?\n/, "");
|
25 | var string = strings[0];
|
26 | values.forEach(function(value, i) {
|
27 | var endentations = string.match(/(?:^|\n)( *)$/);
|
28 | var endentation = endentations ? endentations[1] : "";
|
29 | var indentedValue = value;
|
30 | if (typeof value === "string" && value.includes("\n")) {
|
31 | indentedValue = String(value).split("\n").map(function(str2, i2) {
|
32 | return i2 === 0 ? str2 : "" + endentation + str2;
|
33 | }).join("\n");
|
34 | }
|
35 | string += indentedValue + strings[i + 1];
|
36 | });
|
37 | return string;
|
38 | }
|
39 | var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
40 | function getDefaultExportFromCjs(x) {
|
41 | return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
42 | }
|
43 | var dayjs_min = { exports: {} };
|
44 | (function(module2, exports2) {
|
45 | !function(t, e) {
|
46 | module2.exports = e();
|
47 | }(commonjsGlobal, function() {
|
48 | var t = 1e3, e = 6e4, n = 36e5, r = "millisecond", i = "second", s = "minute", u = "hour", a = "day", o = "week", c = "month", f = "quarter", h = "year", d = "date", l = "Invalid Date", $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(t2) {
|
49 | var e2 = ["th", "st", "nd", "rd"], n2 = t2 % 100;
|
50 | return "[" + t2 + (e2[(n2 - 20) % 10] || e2[n2] || e2[0]) + "]";
|
51 | } }, m = function(t2, e2, n2) {
|
52 | var r2 = String(t2);
|
53 | return !r2 || r2.length >= e2 ? t2 : "" + Array(e2 + 1 - r2.length).join(n2) + t2;
|
54 | }, v = { s: m, z: function(t2) {
|
55 | var e2 = -t2.utcOffset(), n2 = Math.abs(e2), r2 = Math.floor(n2 / 60), i2 = n2 % 60;
|
56 | return (e2 <= 0 ? "+" : "-") + m(r2, 2, "0") + ":" + m(i2, 2, "0");
|
57 | }, m: function t2(e2, n2) {
|
58 | if (e2.date() < n2.date())
|
59 | return -t2(n2, e2);
|
60 | var r2 = 12 * (n2.year() - e2.year()) + (n2.month() - e2.month()), i2 = e2.clone().add(r2, c), s2 = n2 - i2 < 0, u2 = e2.clone().add(r2 + (s2 ? -1 : 1), c);
|
61 | return +(-(r2 + (n2 - i2) / (s2 ? i2 - u2 : u2 - i2)) || 0);
|
62 | }, a: function(t2) {
|
63 | return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2);
|
64 | }, p: function(t2) {
|
65 | return { M: c, y: h, w: o, d: a, D: d, h: u, m: s, s: i, ms: r, Q: f }[t2] || String(t2 || "").toLowerCase().replace(/s$/, "");
|
66 | }, u: function(t2) {
|
67 | return void 0 === t2;
|
68 | } }, g = "en", D = {};
|
69 | D[g] = M;
|
70 | var p = "$isDayjsObject", S = function(t2) {
|
71 | return t2 instanceof _2 || !(!t2 || !t2[p]);
|
72 | }, w = function t2(e2, n2, r2) {
|
73 | var i2;
|
74 | if (!e2)
|
75 | return g;
|
76 | if ("string" == typeof e2) {
|
77 | var s2 = e2.toLowerCase();
|
78 | D[s2] && (i2 = s2), n2 && (D[s2] = n2, i2 = s2);
|
79 | var u2 = e2.split("-");
|
80 | if (!i2 && u2.length > 1)
|
81 | return t2(u2[0]);
|
82 | } else {
|
83 | var a2 = e2.name;
|
84 | D[a2] = e2, i2 = a2;
|
85 | }
|
86 | return !r2 && i2 && (g = i2), i2 || !r2 && g;
|
87 | }, O = function(t2, e2) {
|
88 | if (S(t2))
|
89 | return t2.clone();
|
90 | var n2 = "object" == typeof e2 ? e2 : {};
|
91 | return n2.date = t2, n2.args = arguments, new _2(n2);
|
92 | }, b = v;
|
93 | b.l = w, b.i = S, b.w = function(t2, e2) {
|
94 | return O(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
|
95 | };
|
96 | var _2 = function() {
|
97 | function M2(t2) {
|
98 | this.$L = w(t2.locale, null, true), this.parse(t2), this.$x = this.$x || t2.x || {}, this[p] = true;
|
99 | }
|
100 | var m2 = M2.prototype;
|
101 | return m2.parse = function(t2) {
|
102 | this.$d = function(t3) {
|
103 | var e2 = t3.date, n2 = t3.utc;
|
104 | if (null === e2)
|
105 | return new Date(NaN);
|
106 | if (b.u(e2))
|
107 | return new Date();
|
108 | if (e2 instanceof Date)
|
109 | return new Date(e2);
|
110 | if ("string" == typeof e2 && !/Z$/i.test(e2)) {
|
111 | var r2 = e2.match($);
|
112 | if (r2) {
|
113 | var i2 = r2[2] - 1 || 0, s2 = (r2[7] || "0").substring(0, 3);
|
114 | return n2 ? new Date(Date.UTC(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2)) : new Date(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2);
|
115 | }
|
116 | }
|
117 | return new Date(e2);
|
118 | }(t2), this.init();
|
119 | }, m2.init = function() {
|
120 | var t2 = this.$d;
|
121 | this.$y = t2.getFullYear(), this.$M = t2.getMonth(), this.$D = t2.getDate(), this.$W = t2.getDay(), this.$H = t2.getHours(), this.$m = t2.getMinutes(), this.$s = t2.getSeconds(), this.$ms = t2.getMilliseconds();
|
122 | }, m2.$utils = function() {
|
123 | return b;
|
124 | }, m2.isValid = function() {
|
125 | return !(this.$d.toString() === l);
|
126 | }, m2.isSame = function(t2, e2) {
|
127 | var n2 = O(t2);
|
128 | return this.startOf(e2) <= n2 && n2 <= this.endOf(e2);
|
129 | }, m2.isAfter = function(t2, e2) {
|
130 | return O(t2) < this.startOf(e2);
|
131 | }, m2.isBefore = function(t2, e2) {
|
132 | return this.endOf(e2) < O(t2);
|
133 | }, m2.$g = function(t2, e2, n2) {
|
134 | return b.u(t2) ? this[e2] : this.set(n2, t2);
|
135 | }, m2.unix = function() {
|
136 | return Math.floor(this.valueOf() / 1e3);
|
137 | }, m2.valueOf = function() {
|
138 | return this.$d.getTime();
|
139 | }, m2.startOf = function(t2, e2) {
|
140 | var n2 = this, r2 = !!b.u(e2) || e2, f2 = b.p(t2), l2 = function(t3, e3) {
|
141 | var i2 = b.w(n2.$u ? Date.UTC(n2.$y, e3, t3) : new Date(n2.$y, e3, t3), n2);
|
142 | return r2 ? i2 : i2.endOf(a);
|
143 | }, $2 = function(t3, e3) {
|
144 | return b.w(n2.toDate()[t3].apply(n2.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2);
|
145 | }, y2 = this.$W, M3 = this.$M, m3 = this.$D, v2 = "set" + (this.$u ? "UTC" : "");
|
146 | switch (f2) {
|
147 | case h:
|
148 | return r2 ? l2(1, 0) : l2(31, 11);
|
149 | case c:
|
150 | return r2 ? l2(1, M3) : l2(0, M3 + 1);
|
151 | case o:
|
152 | var g2 = this.$locale().weekStart || 0, D2 = (y2 < g2 ? y2 + 7 : y2) - g2;
|
153 | return l2(r2 ? m3 - D2 : m3 + (6 - D2), M3);
|
154 | case a:
|
155 | case d:
|
156 | return $2(v2 + "Hours", 0);
|
157 | case u:
|
158 | return $2(v2 + "Minutes", 1);
|
159 | case s:
|
160 | return $2(v2 + "Seconds", 2);
|
161 | case i:
|
162 | return $2(v2 + "Milliseconds", 3);
|
163 | default:
|
164 | return this.clone();
|
165 | }
|
166 | }, m2.endOf = function(t2) {
|
167 | return this.startOf(t2, false);
|
168 | }, m2.$set = function(t2, e2) {
|
169 | var n2, o2 = b.p(t2), f2 = "set" + (this.$u ? "UTC" : ""), l2 = (n2 = {}, n2[a] = f2 + "Date", n2[d] = f2 + "Date", n2[c] = f2 + "Month", n2[h] = f2 + "FullYear", n2[u] = f2 + "Hours", n2[s] = f2 + "Minutes", n2[i] = f2 + "Seconds", n2[r] = f2 + "Milliseconds", n2)[o2], $2 = o2 === a ? this.$D + (e2 - this.$W) : e2;
|
170 | if (o2 === c || o2 === h) {
|
171 | var y2 = this.clone().set(d, 1);
|
172 | y2.$d[l2]($2), y2.init(), this.$d = y2.set(d, Math.min(this.$D, y2.daysInMonth())).$d;
|
173 | } else
|
174 | l2 && this.$d[l2]($2);
|
175 | return this.init(), this;
|
176 | }, m2.set = function(t2, e2) {
|
177 | return this.clone().$set(t2, e2);
|
178 | }, m2.get = function(t2) {
|
179 | return this[b.p(t2)]();
|
180 | }, m2.add = function(r2, f2) {
|
181 | var d2, l2 = this;
|
182 | r2 = Number(r2);
|
183 | var $2 = b.p(f2), y2 = function(t2) {
|
184 | var e2 = O(l2);
|
185 | return b.w(e2.date(e2.date() + Math.round(t2 * r2)), l2);
|
186 | };
|
187 | if ($2 === c)
|
188 | return this.set(c, this.$M + r2);
|
189 | if ($2 === h)
|
190 | return this.set(h, this.$y + r2);
|
191 | if ($2 === a)
|
192 | return y2(1);
|
193 | if ($2 === o)
|
194 | return y2(7);
|
195 | var M3 = (d2 = {}, d2[s] = e, d2[u] = n, d2[i] = t, d2)[$2] || 1, m3 = this.$d.getTime() + r2 * M3;
|
196 | return b.w(m3, this);
|
197 | }, m2.subtract = function(t2, e2) {
|
198 | return this.add(-1 * t2, e2);
|
199 | }, m2.format = function(t2) {
|
200 | var e2 = this, n2 = this.$locale();
|
201 | if (!this.isValid())
|
202 | return n2.invalidDate || l;
|
203 | var r2 = t2 || "YYYY-MM-DDTHH:mm:ssZ", i2 = b.z(this), s2 = this.$H, u2 = this.$m, a2 = this.$M, o2 = n2.weekdays, c2 = n2.months, f2 = n2.meridiem, h2 = function(t3, n3, i3, s3) {
|
204 | return t3 && (t3[n3] || t3(e2, r2)) || i3[n3].slice(0, s3);
|
205 | }, d2 = function(t3) {
|
206 | return b.s(s2 % 12 || 12, t3, "0");
|
207 | }, $2 = f2 || function(t3, e3, n3) {
|
208 | var r3 = t3 < 12 ? "AM" : "PM";
|
209 | return n3 ? r3.toLowerCase() : r3;
|
210 | };
|
211 | return r2.replace(y, function(t3, r3) {
|
212 | return r3 || function(t4) {
|
213 | switch (t4) {
|
214 | case "YY":
|
215 | return String(e2.$y).slice(-2);
|
216 | case "YYYY":
|
217 | return b.s(e2.$y, 4, "0");
|
218 | case "M":
|
219 | return a2 + 1;
|
220 | case "MM":
|
221 | return b.s(a2 + 1, 2, "0");
|
222 | case "MMM":
|
223 | return h2(n2.monthsShort, a2, c2, 3);
|
224 | case "MMMM":
|
225 | return h2(c2, a2);
|
226 | case "D":
|
227 | return e2.$D;
|
228 | case "DD":
|
229 | return b.s(e2.$D, 2, "0");
|
230 | case "d":
|
231 | return String(e2.$W);
|
232 | case "dd":
|
233 | return h2(n2.weekdaysMin, e2.$W, o2, 2);
|
234 | case "ddd":
|
235 | return h2(n2.weekdaysShort, e2.$W, o2, 3);
|
236 | case "dddd":
|
237 | return o2[e2.$W];
|
238 | case "H":
|
239 | return String(s2);
|
240 | case "HH":
|
241 | return b.s(s2, 2, "0");
|
242 | case "h":
|
243 | return d2(1);
|
244 | case "hh":
|
245 | return d2(2);
|
246 | case "a":
|
247 | return $2(s2, u2, true);
|
248 | case "A":
|
249 | return $2(s2, u2, false);
|
250 | case "m":
|
251 | return String(u2);
|
252 | case "mm":
|
253 | return b.s(u2, 2, "0");
|
254 | case "s":
|
255 | return String(e2.$s);
|
256 | case "ss":
|
257 | return b.s(e2.$s, 2, "0");
|
258 | case "SSS":
|
259 | return b.s(e2.$ms, 3, "0");
|
260 | case "Z":
|
261 | return i2;
|
262 | }
|
263 | return null;
|
264 | }(t3) || i2.replace(":", "");
|
265 | });
|
266 | }, m2.utcOffset = function() {
|
267 | return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
|
268 | }, m2.diff = function(r2, d2, l2) {
|
269 | var $2, y2 = this, M3 = b.p(d2), m3 = O(r2), v2 = (m3.utcOffset() - this.utcOffset()) * e, g2 = this - m3, D2 = function() {
|
270 | return b.m(y2, m3);
|
271 | };
|
272 | switch (M3) {
|
273 | case h:
|
274 | $2 = D2() / 12;
|
275 | break;
|
276 | case c:
|
277 | $2 = D2();
|
278 | break;
|
279 | case f:
|
280 | $2 = D2() / 3;
|
281 | break;
|
282 | case o:
|
283 | $2 = (g2 - v2) / 6048e5;
|
284 | break;
|
285 | case a:
|
286 | $2 = (g2 - v2) / 864e5;
|
287 | break;
|
288 | case u:
|
289 | $2 = g2 / n;
|
290 | break;
|
291 | case s:
|
292 | $2 = g2 / e;
|
293 | break;
|
294 | case i:
|
295 | $2 = g2 / t;
|
296 | break;
|
297 | default:
|
298 | $2 = g2;
|
299 | }
|
300 | return l2 ? $2 : b.a($2);
|
301 | }, m2.daysInMonth = function() {
|
302 | return this.endOf(c).$D;
|
303 | }, m2.$locale = function() {
|
304 | return D[this.$L];
|
305 | }, m2.locale = function(t2, e2) {
|
306 | if (!t2)
|
307 | return this.$L;
|
308 | var n2 = this.clone(), r2 = w(t2, e2, true);
|
309 | return r2 && (n2.$L = r2), n2;
|
310 | }, m2.clone = function() {
|
311 | return b.w(this.$d, this);
|
312 | }, m2.toDate = function() {
|
313 | return new Date(this.valueOf());
|
314 | }, m2.toJSON = function() {
|
315 | return this.isValid() ? this.toISOString() : null;
|
316 | }, m2.toISOString = function() {
|
317 | return this.$d.toISOString();
|
318 | }, m2.toString = function() {
|
319 | return this.$d.toUTCString();
|
320 | }, M2;
|
321 | }(), k = _2.prototype;
|
322 | return O.prototype = k, [["$ms", r], ["$s", i], ["$m", s], ["$H", u], ["$W", a], ["$M", c], ["$y", h], ["$D", d]].forEach(function(t2) {
|
323 | k[t2[1]] = function(e2) {
|
324 | return this.$g(e2, t2[0], t2[1]);
|
325 | };
|
326 | }), O.extend = function(t2, e2) {
|
327 | return t2.$i || (t2(e2, _2, O), t2.$i = true), O;
|
328 | }, O.locale = w, O.isDayjs = S, O.unix = function(t2) {
|
329 | return O(1e3 * t2);
|
330 | }, O.en = D[g], O.Ls = D, O.p = {}, O;
|
331 | });
|
332 | })(dayjs_min);
|
333 | var dayjs_minExports = dayjs_min.exports;
|
334 | const dayjs = getDefaultExportFromCjs(dayjs_minExports);
|
335 | const LEVELS = {
|
336 | trace: 0,
|
337 | debug: 1,
|
338 | info: 2,
|
339 | warn: 3,
|
340 | error: 4,
|
341 | fatal: 5
|
342 | };
|
343 | const log$1 = {
|
344 | trace: (..._args) => {
|
345 | },
|
346 | debug: (..._args) => {
|
347 | },
|
348 | info: (..._args) => {
|
349 | },
|
350 | warn: (..._args) => {
|
351 | },
|
352 | error: (..._args) => {
|
353 | },
|
354 | fatal: (..._args) => {
|
355 | }
|
356 | };
|
357 | const setLogLevel$1 = function(level = "fatal") {
|
358 | let numericLevel = LEVELS.fatal;
|
359 | if (typeof level === "string") {
|
360 | level = level.toLowerCase();
|
361 | if (level in LEVELS) {
|
362 | numericLevel = LEVELS[level];
|
363 | }
|
364 | } else if (typeof level === "number") {
|
365 | numericLevel = level;
|
366 | }
|
367 | log$1.trace = () => {
|
368 | };
|
369 | log$1.debug = () => {
|
370 | };
|
371 | log$1.info = () => {
|
372 | };
|
373 | log$1.warn = () => {
|
374 | };
|
375 | log$1.error = () => {
|
376 | };
|
377 | log$1.fatal = () => {
|
378 | };
|
379 | if (numericLevel <= LEVELS.fatal) {
|
380 | log$1.fatal = console.error ? console.error.bind(console, format("FATAL"), "color: orange") : console.log.bind(console, "\x1B[35m", format("FATAL"));
|
381 | }
|
382 | if (numericLevel <= LEVELS.error) {
|
383 | log$1.error = console.error ? console.error.bind(console, format("ERROR"), "color: orange") : console.log.bind(console, "\x1B[31m", format("ERROR"));
|
384 | }
|
385 | if (numericLevel <= LEVELS.warn) {
|
386 | log$1.warn = console.warn ? console.warn.bind(console, format("WARN"), "color: orange") : console.log.bind(console, `\x1B[33m`, format("WARN"));
|
387 | }
|
388 | if (numericLevel <= LEVELS.info) {
|
389 | log$1.info = console.info ? console.info.bind(console, format("INFO"), "color: lightblue") : console.log.bind(console, "\x1B[34m", format("INFO"));
|
390 | }
|
391 | if (numericLevel <= LEVELS.debug) {
|
392 | log$1.debug = console.debug ? console.debug.bind(console, format("DEBUG"), "color: lightgreen") : console.log.bind(console, "\x1B[32m", format("DEBUG"));
|
393 | }
|
394 | if (numericLevel <= LEVELS.trace) {
|
395 | log$1.trace = console.debug ? console.debug.bind(console, format("TRACE"), "color: lightgreen") : console.log.bind(console, "\x1B[32m", format("TRACE"));
|
396 | }
|
397 | };
|
398 | const format = (level) => {
|
399 | const time = dayjs().format("ss.SSS");
|
400 | return `%c${time} : ${level} : `;
|
401 | };
|
402 | var dist = {};
|
403 | (function(exports2) {
|
404 | Object.defineProperty(exports2, "__esModule", { value: true });
|
405 | exports2.sanitizeUrl = exports2.BLANK_URL = void 0;
|
406 | var invalidProtocolRegex = /^([^\w]*)(javascript|data|vbscript)/im;
|
407 | var htmlEntitiesRegex = /&#(\w+)(^\w|;)?/g;
|
408 | var htmlCtrlEntityRegex = /&(newline|tab);/gi;
|
409 | var ctrlCharactersRegex = /[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim;
|
410 | var urlSchemeRegex = /^.+(:|:)/gim;
|
411 | var relativeFirstCharacters = [".", "/"];
|
412 | exports2.BLANK_URL = "about:blank";
|
413 | function isRelativeUrlWithoutProtocol(url) {
|
414 | return relativeFirstCharacters.indexOf(url[0]) > -1;
|
415 | }
|
416 | function decodeHtmlCharacters(str2) {
|
417 | var removedNullByte = str2.replace(ctrlCharactersRegex, "");
|
418 | return removedNullByte.replace(htmlEntitiesRegex, function(match, dec) {
|
419 | return String.fromCharCode(dec);
|
420 | });
|
421 | }
|
422 | function sanitizeUrl(url) {
|
423 | if (!url) {
|
424 | return exports2.BLANK_URL;
|
425 | }
|
426 | var sanitizedUrl = decodeHtmlCharacters(url).replace(htmlCtrlEntityRegex, "").replace(ctrlCharactersRegex, "").trim();
|
427 | if (!sanitizedUrl) {
|
428 | return exports2.BLANK_URL;
|
429 | }
|
430 | if (isRelativeUrlWithoutProtocol(sanitizedUrl)) {
|
431 | return sanitizedUrl;
|
432 | }
|
433 | var urlSchemeParseResults = sanitizedUrl.match(urlSchemeRegex);
|
434 | if (!urlSchemeParseResults) {
|
435 | return sanitizedUrl;
|
436 | }
|
437 | var urlScheme = urlSchemeParseResults[0];
|
438 | if (invalidProtocolRegex.test(urlScheme)) {
|
439 | return exports2.BLANK_URL;
|
440 | }
|
441 | return sanitizedUrl;
|
442 | }
|
443 | exports2.sanitizeUrl = sanitizeUrl;
|
444 | })(dist);
|
445 | var noop$1 = { value: () => {
|
446 | } };
|
447 | function dispatch() {
|
448 | for (var i = 0, n = arguments.length, _2 = {}, t; i < n; ++i) {
|
449 | if (!(t = arguments[i] + "") || t in _2 || /[\s.]/.test(t))
|
450 | throw new Error("illegal type: " + t);
|
451 | _2[t] = [];
|
452 | }
|
453 | return new Dispatch(_2);
|
454 | }
|
455 | function Dispatch(_2) {
|
456 | this._ = _2;
|
457 | }
|
458 | function parseTypenames$1(typenames, types) {
|
459 | return typenames.trim().split(/^|\s+/).map(function(t) {
|
460 | var name = "", i = t.indexOf(".");
|
461 | if (i >= 0)
|
462 | name = t.slice(i + 1), t = t.slice(0, i);
|
463 | if (t && !types.hasOwnProperty(t))
|
464 | throw new Error("unknown type: " + t);
|
465 | return { type: t, name };
|
466 | });
|
467 | }
|
468 | Dispatch.prototype = dispatch.prototype = {
|
469 | constructor: Dispatch,
|
470 | on: function(typename, callback) {
|
471 | var _2 = this._, T = parseTypenames$1(typename + "", _2), t, i = -1, n = T.length;
|
472 | if (arguments.length < 2) {
|
473 | while (++i < n)
|
474 | if ((t = (typename = T[i]).type) && (t = get$1(_2[t], typename.name)))
|
475 | return t;
|
476 | return;
|
477 | }
|
478 | if (callback != null && typeof callback !== "function")
|
479 | throw new Error("invalid callback: " + callback);
|
480 | while (++i < n) {
|
481 | if (t = (typename = T[i]).type)
|
482 | _2[t] = set$2(_2[t], typename.name, callback);
|
483 | else if (callback == null)
|
484 | for (t in _2)
|
485 | _2[t] = set$2(_2[t], typename.name, null);
|
486 | }
|
487 | return this;
|
488 | },
|
489 | copy: function() {
|
490 | var copy = {}, _2 = this._;
|
491 | for (var t in _2)
|
492 | copy[t] = _2[t].slice();
|
493 | return new Dispatch(copy);
|
494 | },
|
495 | call: function(type2, that) {
|
496 | if ((n = arguments.length - 2) > 0)
|
497 | for (var args = new Array(n), i = 0, n, t; i < n; ++i)
|
498 | args[i] = arguments[i + 2];
|
499 | if (!this._.hasOwnProperty(type2))
|
500 | throw new Error("unknown type: " + type2);
|
501 | for (t = this._[type2], i = 0, n = t.length; i < n; ++i)
|
502 | t[i].value.apply(that, args);
|
503 | },
|
504 | apply: function(type2, that, args) {
|
505 | if (!this._.hasOwnProperty(type2))
|
506 | throw new Error("unknown type: " + type2);
|
507 | for (var t = this._[type2], i = 0, n = t.length; i < n; ++i)
|
508 | t[i].value.apply(that, args);
|
509 | }
|
510 | };
|
511 | function get$1(type2, name) {
|
512 | for (var i = 0, n = type2.length, c; i < n; ++i) {
|
513 | if ((c = type2[i]).name === name) {
|
514 | return c.value;
|
515 | }
|
516 | }
|
517 | }
|
518 | function set$2(type2, name, callback) {
|
519 | for (var i = 0, n = type2.length; i < n; ++i) {
|
520 | if (type2[i].name === name) {
|
521 | type2[i] = noop$1, type2 = type2.slice(0, i).concat(type2.slice(i + 1));
|
522 | break;
|
523 | }
|
524 | }
|
525 | if (callback != null)
|
526 | type2.push({ name, value: callback });
|
527 | return type2;
|
528 | }
|
529 | var xhtml = "http://www.w3.org/1999/xhtml";
|
530 | const namespaces = {
|
531 | svg: "http://www.w3.org/2000/svg",
|
532 | xhtml,
|
533 | xlink: "http://www.w3.org/1999/xlink",
|
534 | xml: "http://www.w3.org/XML/1998/namespace",
|
535 | xmlns: "http://www.w3.org/2000/xmlns/"
|
536 | };
|
537 | function namespace(name) {
|
538 | var prefix = name += "", i = prefix.indexOf(":");
|
539 | if (i >= 0 && (prefix = name.slice(0, i)) !== "xmlns")
|
540 | name = name.slice(i + 1);
|
541 | return namespaces.hasOwnProperty(prefix) ? { space: namespaces[prefix], local: name } : name;
|
542 | }
|
543 | function creatorInherit(name) {
|
544 | return function() {
|
545 | var document2 = this.ownerDocument, uri = this.namespaceURI;
|
546 | return uri === xhtml && document2.documentElement.namespaceURI === xhtml ? document2.createElement(name) : document2.createElementNS(uri, name);
|
547 | };
|
548 | }
|
549 | function creatorFixed(fullname) {
|
550 | return function() {
|
551 | return this.ownerDocument.createElementNS(fullname.space, fullname.local);
|
552 | };
|
553 | }
|
554 | function creator(name) {
|
555 | var fullname = namespace(name);
|
556 | return (fullname.local ? creatorFixed : creatorInherit)(fullname);
|
557 | }
|
558 | function none() {
|
559 | }
|
560 | function selector(selector2) {
|
561 | return selector2 == null ? none : function() {
|
562 | return this.querySelector(selector2);
|
563 | };
|
564 | }
|
565 | function selection_select(select) {
|
566 | if (typeof select !== "function")
|
567 | select = selector(select);
|
568 | for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {
|
569 | for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node2, subnode, i = 0; i < n; ++i) {
|
570 | if ((node2 = group[i]) && (subnode = select.call(node2, node2.__data__, i, group))) {
|
571 | if ("__data__" in node2)
|
572 | subnode.__data__ = node2.__data__;
|
573 | subgroup[i] = subnode;
|
574 | }
|
575 | }
|
576 | }
|
577 | return new Selection$1(subgroups, this._parents);
|
578 | }
|
579 | function array(x) {
|
580 | return x == null ? [] : Array.isArray(x) ? x : Array.from(x);
|
581 | }
|
582 | function empty() {
|
583 | return [];
|
584 | }
|
585 | function selectorAll(selector2) {
|
586 | return selector2 == null ? empty : function() {
|
587 | return this.querySelectorAll(selector2);
|
588 | };
|
589 | }
|
590 | function arrayAll(select) {
|
591 | return function() {
|
592 | return array(select.apply(this, arguments));
|
593 | };
|
594 | }
|
595 | function selection_selectAll(select) {
|
596 | if (typeof select === "function")
|
597 | select = arrayAll(select);
|
598 | else
|
599 | select = selectorAll(select);
|
600 | for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {
|
601 | for (var group = groups[j], n = group.length, node2, i = 0; i < n; ++i) {
|
602 | if (node2 = group[i]) {
|
603 | subgroups.push(select.call(node2, node2.__data__, i, group));
|
604 | parents.push(node2);
|
605 | }
|
606 | }
|
607 | }
|
608 | return new Selection$1(subgroups, parents);
|
609 | }
|
610 | function matcher(selector2) {
|
611 | return function() {
|
612 | return this.matches(selector2);
|
613 | };
|
614 | }
|
615 | function childMatcher(selector2) {
|
616 | return function(node2) {
|
617 | return node2.matches(selector2);
|
618 | };
|
619 | }
|
620 | var find = Array.prototype.find;
|
621 | function childFind(match) {
|
622 | return function() {
|
623 | return find.call(this.children, match);
|
624 | };
|
625 | }
|
626 | function childFirst() {
|
627 | return this.firstElementChild;
|
628 | }
|
629 | function selection_selectChild(match) {
|
630 | return this.select(match == null ? childFirst : childFind(typeof match === "function" ? match : childMatcher(match)));
|
631 | }
|
632 | var filter = Array.prototype.filter;
|
633 | function children() {
|
634 | return Array.from(this.children);
|
635 | }
|
636 | function childrenFilter(match) {
|
637 | return function() {
|
638 | return filter.call(this.children, match);
|
639 | };
|
640 | }
|
641 | function selection_selectChildren(match) {
|
642 | return this.selectAll(match == null ? children : childrenFilter(typeof match === "function" ? match : childMatcher(match)));
|
643 | }
|
644 | function selection_filter(match) {
|
645 | if (typeof match !== "function")
|
646 | match = matcher(match);
|
647 | for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {
|
648 | for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node2, i = 0; i < n; ++i) {
|
649 | if ((node2 = group[i]) && match.call(node2, node2.__data__, i, group)) {
|
650 | subgroup.push(node2);
|
651 | }
|
652 | }
|
653 | }
|
654 | return new Selection$1(subgroups, this._parents);
|
655 | }
|
656 | function sparse(update) {
|
657 | return new Array(update.length);
|
658 | }
|
659 | function selection_enter() {
|
660 | return new Selection$1(this._enter || this._groups.map(sparse), this._parents);
|
661 | }
|
662 | function EnterNode(parent, datum2) {
|
663 | this.ownerDocument = parent.ownerDocument;
|
664 | this.namespaceURI = parent.namespaceURI;
|
665 | this._next = null;
|
666 | this._parent = parent;
|
667 | this.__data__ = datum2;
|
668 | }
|
669 | EnterNode.prototype = {
|
670 | constructor: EnterNode,
|
671 | appendChild: function(child) {
|
672 | return this._parent.insertBefore(child, this._next);
|
673 | },
|
674 | insertBefore: function(child, next2) {
|
675 | return this._parent.insertBefore(child, next2);
|
676 | },
|
677 | querySelector: function(selector2) {
|
678 | return this._parent.querySelector(selector2);
|
679 | },
|
680 | querySelectorAll: function(selector2) {
|
681 | return this._parent.querySelectorAll(selector2);
|
682 | }
|
683 | };
|
684 | function constant$2(x) {
|
685 | return function() {
|
686 | return x;
|
687 | };
|
688 | }
|
689 | function bindIndex(parent, group, enter, update, exit, data) {
|
690 | var i = 0, node2, groupLength = group.length, dataLength = data.length;
|
691 | for (; i < dataLength; ++i) {
|
692 | if (node2 = group[i]) {
|
693 | node2.__data__ = data[i];
|
694 | update[i] = node2;
|
695 | } else {
|
696 | enter[i] = new EnterNode(parent, data[i]);
|
697 | }
|
698 | }
|
699 | for (; i < groupLength; ++i) {
|
700 | if (node2 = group[i]) {
|
701 | exit[i] = node2;
|
702 | }
|
703 | }
|
704 | }
|
705 | function bindKey(parent, group, enter, update, exit, data, key) {
|
706 | var i, node2, nodeByKeyValue = new Map(), groupLength = group.length, dataLength = data.length, keyValues = new Array(groupLength), keyValue;
|
707 | for (i = 0; i < groupLength; ++i) {
|
708 | if (node2 = group[i]) {
|
709 | keyValues[i] = keyValue = key.call(node2, node2.__data__, i, group) + "";
|
710 | if (nodeByKeyValue.has(keyValue)) {
|
711 | exit[i] = node2;
|
712 | } else {
|
713 | nodeByKeyValue.set(keyValue, node2);
|
714 | }
|
715 | }
|
716 | }
|
717 | for (i = 0; i < dataLength; ++i) {
|
718 | keyValue = key.call(parent, data[i], i, data) + "";
|
719 | if (node2 = nodeByKeyValue.get(keyValue)) {
|
720 | update[i] = node2;
|
721 | node2.__data__ = data[i];
|
722 | nodeByKeyValue.delete(keyValue);
|
723 | } else {
|
724 | enter[i] = new EnterNode(parent, data[i]);
|
725 | }
|
726 | }
|
727 | for (i = 0; i < groupLength; ++i) {
|
728 | if ((node2 = group[i]) && nodeByKeyValue.get(keyValues[i]) === node2) {
|
729 | exit[i] = node2;
|
730 | }
|
731 | }
|
732 | }
|
733 | function datum(node2) {
|
734 | return node2.__data__;
|
735 | }
|
736 | function selection_data(value, key) {
|
737 | if (!arguments.length)
|
738 | return Array.from(this, datum);
|
739 | var bind = key ? bindKey : bindIndex, parents = this._parents, groups = this._groups;
|
740 | if (typeof value !== "function")
|
741 | value = constant$2(value);
|
742 | for (var m = groups.length, update = new Array(m), enter = new Array(m), exit = new Array(m), j = 0; j < m; ++j) {
|
743 | var parent = parents[j], group = groups[j], groupLength = group.length, data = arraylike(value.call(parent, parent && parent.__data__, j, parents)), dataLength = data.length, enterGroup = enter[j] = new Array(dataLength), updateGroup = update[j] = new Array(dataLength), exitGroup = exit[j] = new Array(groupLength);
|
744 | bind(parent, group, enterGroup, updateGroup, exitGroup, data, key);
|
745 | for (var i0 = 0, i1 = 0, previous, next2; i0 < dataLength; ++i0) {
|
746 | if (previous = enterGroup[i0]) {
|
747 | if (i0 >= i1)
|
748 | i1 = i0 + 1;
|
749 | while (!(next2 = updateGroup[i1]) && ++i1 < dataLength)
|
750 | ;
|
751 | previous._next = next2 || null;
|
752 | }
|
753 | }
|
754 | }
|
755 | update = new Selection$1(update, parents);
|
756 | update._enter = enter;
|
757 | update._exit = exit;
|
758 | return update;
|
759 | }
|
760 | function arraylike(data) {
|
761 | return typeof data === "object" && "length" in data ? data : Array.from(data);
|
762 | }
|
763 | function selection_exit() {
|
764 | return new Selection$1(this._exit || this._groups.map(sparse), this._parents);
|
765 | }
|
766 | function selection_join(onenter, onupdate, onexit) {
|
767 | var enter = this.enter(), update = this, exit = this.exit();
|
768 | if (typeof onenter === "function") {
|
769 | enter = onenter(enter);
|
770 | if (enter)
|
771 | enter = enter.selection();
|
772 | } else {
|
773 | enter = enter.append(onenter + "");
|
774 | }
|
775 | if (onupdate != null) {
|
776 | update = onupdate(update);
|
777 | if (update)
|
778 | update = update.selection();
|
779 | }
|
780 | if (onexit == null)
|
781 | exit.remove();
|
782 | else
|
783 | onexit(exit);
|
784 | return enter && update ? enter.merge(update).order() : update;
|
785 | }
|
786 | function selection_merge(context) {
|
787 | var selection2 = context.selection ? context.selection() : context;
|
788 | for (var groups0 = this._groups, groups1 = selection2._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) {
|
789 | for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge2 = merges[j] = new Array(n), node2, i = 0; i < n; ++i) {
|
790 | if (node2 = group0[i] || group1[i]) {
|
791 | merge2[i] = node2;
|
792 | }
|
793 | }
|
794 | }
|
795 | for (; j < m0; ++j) {
|
796 | merges[j] = groups0[j];
|
797 | }
|
798 | return new Selection$1(merges, this._parents);
|
799 | }
|
800 | function selection_order() {
|
801 | for (var groups = this._groups, j = -1, m = groups.length; ++j < m; ) {
|
802 | for (var group = groups[j], i = group.length - 1, next2 = group[i], node2; --i >= 0; ) {
|
803 | if (node2 = group[i]) {
|
804 | if (next2 && node2.compareDocumentPosition(next2) ^ 4)
|
805 | next2.parentNode.insertBefore(node2, next2);
|
806 | next2 = node2;
|
807 | }
|
808 | }
|
809 | }
|
810 | return this;
|
811 | }
|
812 | function selection_sort(compare) {
|
813 | if (!compare)
|
814 | compare = ascending;
|
815 | function compareNode(a, b) {
|
816 | return a && b ? compare(a.__data__, b.__data__) : !a - !b;
|
817 | }
|
818 | for (var groups = this._groups, m = groups.length, sortgroups = new Array(m), j = 0; j < m; ++j) {
|
819 | for (var group = groups[j], n = group.length, sortgroup = sortgroups[j] = new Array(n), node2, i = 0; i < n; ++i) {
|
820 | if (node2 = group[i]) {
|
821 | sortgroup[i] = node2;
|
822 | }
|
823 | }
|
824 | sortgroup.sort(compareNode);
|
825 | }
|
826 | return new Selection$1(sortgroups, this._parents).order();
|
827 | }
|
828 | function ascending(a, b) {
|
829 | return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
|
830 | }
|
831 | function selection_call() {
|
832 | var callback = arguments[0];
|
833 | arguments[0] = this;
|
834 | callback.apply(null, arguments);
|
835 | return this;
|
836 | }
|
837 | function selection_nodes() {
|
838 | return Array.from(this);
|
839 | }
|
840 | function selection_node() {
|
841 | for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {
|
842 | for (var group = groups[j], i = 0, n = group.length; i < n; ++i) {
|
843 | var node2 = group[i];
|
844 | if (node2)
|
845 | return node2;
|
846 | }
|
847 | }
|
848 | return null;
|
849 | }
|
850 | function selection_size() {
|
851 | let size = 0;
|
852 | for (const node2 of this)
|
853 | ++size;
|
854 | return size;
|
855 | }
|
856 | function selection_empty() {
|
857 | return !this.node();
|
858 | }
|
859 | function selection_each(callback) {
|
860 | for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {
|
861 | for (var group = groups[j], i = 0, n = group.length, node2; i < n; ++i) {
|
862 | if (node2 = group[i])
|
863 | callback.call(node2, node2.__data__, i, group);
|
864 | }
|
865 | }
|
866 | return this;
|
867 | }
|
868 | function attrRemove$1(name) {
|
869 | return function() {
|
870 | this.removeAttribute(name);
|
871 | };
|
872 | }
|
873 | function attrRemoveNS$1(fullname) {
|
874 | return function() {
|
875 | this.removeAttributeNS(fullname.space, fullname.local);
|
876 | };
|
877 | }
|
878 | function attrConstant$1(name, value) {
|
879 | return function() {
|
880 | this.setAttribute(name, value);
|
881 | };
|
882 | }
|
883 | function attrConstantNS$1(fullname, value) {
|
884 | return function() {
|
885 | this.setAttributeNS(fullname.space, fullname.local, value);
|
886 | };
|
887 | }
|
888 | function attrFunction$1(name, value) {
|
889 | return function() {
|
890 | var v = value.apply(this, arguments);
|
891 | if (v == null)
|
892 | this.removeAttribute(name);
|
893 | else
|
894 | this.setAttribute(name, v);
|
895 | };
|
896 | }
|
897 | function attrFunctionNS$1(fullname, value) {
|
898 | return function() {
|
899 | var v = value.apply(this, arguments);
|
900 | if (v == null)
|
901 | this.removeAttributeNS(fullname.space, fullname.local);
|
902 | else
|
903 | this.setAttributeNS(fullname.space, fullname.local, v);
|
904 | };
|
905 | }
|
906 | function selection_attr(name, value) {
|
907 | var fullname = namespace(name);
|
908 | if (arguments.length < 2) {
|
909 | var node2 = this.node();
|
910 | return fullname.local ? node2.getAttributeNS(fullname.space, fullname.local) : node2.getAttribute(fullname);
|
911 | }
|
912 | return this.each((value == null ? fullname.local ? attrRemoveNS$1 : attrRemove$1 : typeof value === "function" ? fullname.local ? attrFunctionNS$1 : attrFunction$1 : fullname.local ? attrConstantNS$1 : attrConstant$1)(fullname, value));
|
913 | }
|
914 | function defaultView(node2) {
|
915 | return node2.ownerDocument && node2.ownerDocument.defaultView || node2.document && node2 || node2.defaultView;
|
916 | }
|
917 | function styleRemove$1(name) {
|
918 | return function() {
|
919 | this.style.removeProperty(name);
|
920 | };
|
921 | }
|
922 | function styleConstant$1(name, value, priority) {
|
923 | return function() {
|
924 | this.style.setProperty(name, value, priority);
|
925 | };
|
926 | }
|
927 | function styleFunction$1(name, value, priority) {
|
928 | return function() {
|
929 | var v = value.apply(this, arguments);
|
930 | if (v == null)
|
931 | this.style.removeProperty(name);
|
932 | else
|
933 | this.style.setProperty(name, v, priority);
|
934 | };
|
935 | }
|
936 | function selection_style(name, value, priority) {
|
937 | return arguments.length > 1 ? this.each((value == null ? styleRemove$1 : typeof value === "function" ? styleFunction$1 : styleConstant$1)(name, value, priority == null ? "" : priority)) : styleValue(this.node(), name);
|
938 | }
|
939 | function styleValue(node2, name) {
|
940 | return node2.style.getPropertyValue(name) || defaultView(node2).getComputedStyle(node2, null).getPropertyValue(name);
|
941 | }
|
942 | function propertyRemove(name) {
|
943 | return function() {
|
944 | delete this[name];
|
945 | };
|
946 | }
|
947 | function propertyConstant(name, value) {
|
948 | return function() {
|
949 | this[name] = value;
|
950 | };
|
951 | }
|
952 | function propertyFunction(name, value) {
|
953 | return function() {
|
954 | var v = value.apply(this, arguments);
|
955 | if (v == null)
|
956 | delete this[name];
|
957 | else
|
958 | this[name] = v;
|
959 | };
|
960 | }
|
961 | function selection_property(name, value) {
|
962 | return arguments.length > 1 ? this.each((value == null ? propertyRemove : typeof value === "function" ? propertyFunction : propertyConstant)(name, value)) : this.node()[name];
|
963 | }
|
964 | function classArray(string) {
|
965 | return string.trim().split(/^|\s+/);
|
966 | }
|
967 | function classList(node2) {
|
968 | return node2.classList || new ClassList(node2);
|
969 | }
|
970 | function ClassList(node2) {
|
971 | this._node = node2;
|
972 | this._names = classArray(node2.getAttribute("class") || "");
|
973 | }
|
974 | ClassList.prototype = {
|
975 | add: function(name) {
|
976 | var i = this._names.indexOf(name);
|
977 | if (i < 0) {
|
978 | this._names.push(name);
|
979 | this._node.setAttribute("class", this._names.join(" "));
|
980 | }
|
981 | },
|
982 | remove: function(name) {
|
983 | var i = this._names.indexOf(name);
|
984 | if (i >= 0) {
|
985 | this._names.splice(i, 1);
|
986 | this._node.setAttribute("class", this._names.join(" "));
|
987 | }
|
988 | },
|
989 | contains: function(name) {
|
990 | return this._names.indexOf(name) >= 0;
|
991 | }
|
992 | };
|
993 | function classedAdd(node2, names) {
|
994 | var list = classList(node2), i = -1, n = names.length;
|
995 | while (++i < n)
|
996 | list.add(names[i]);
|
997 | }
|
998 | function classedRemove(node2, names) {
|
999 | var list = classList(node2), i = -1, n = names.length;
|
1000 | while (++i < n)
|
1001 | list.remove(names[i]);
|
1002 | }
|
1003 | function classedTrue(names) {
|
1004 | return function() {
|
1005 | classedAdd(this, names);
|
1006 | };
|
1007 | }
|
1008 | function classedFalse(names) {
|
1009 | return function() {
|
1010 | classedRemove(this, names);
|
1011 | };
|
1012 | }
|
1013 | function classedFunction(names, value) {
|
1014 | return function() {
|
1015 | (value.apply(this, arguments) ? classedAdd : classedRemove)(this, names);
|
1016 | };
|
1017 | }
|
1018 | function selection_classed(name, value) {
|
1019 | var names = classArray(name + "");
|
1020 | if (arguments.length < 2) {
|
1021 | var list = classList(this.node()), i = -1, n = names.length;
|
1022 | while (++i < n)
|
1023 | if (!list.contains(names[i]))
|
1024 | return false;
|
1025 | return true;
|
1026 | }
|
1027 | return this.each((typeof value === "function" ? classedFunction : value ? classedTrue : classedFalse)(names, value));
|
1028 | }
|
1029 | function textRemove() {
|
1030 | this.textContent = "";
|
1031 | }
|
1032 | function textConstant$1(value) {
|
1033 | return function() {
|
1034 | this.textContent = value;
|
1035 | };
|
1036 | }
|
1037 | function textFunction$1(value) {
|
1038 | return function() {
|
1039 | var v = value.apply(this, arguments);
|
1040 | this.textContent = v == null ? "" : v;
|
1041 | };
|
1042 | }
|
1043 | function selection_text(value) {
|
1044 | return arguments.length ? this.each(value == null ? textRemove : (typeof value === "function" ? textFunction$1 : textConstant$1)(value)) : this.node().textContent;
|
1045 | }
|
1046 | function htmlRemove() {
|
1047 | this.innerHTML = "";
|
1048 | }
|
1049 | function htmlConstant(value) {
|
1050 | return function() {
|
1051 | this.innerHTML = value;
|
1052 | };
|
1053 | }
|
1054 | function htmlFunction(value) {
|
1055 | return function() {
|
1056 | var v = value.apply(this, arguments);
|
1057 | this.innerHTML = v == null ? "" : v;
|
1058 | };
|
1059 | }
|
1060 | function selection_html(value) {
|
1061 | return arguments.length ? this.each(value == null ? htmlRemove : (typeof value === "function" ? htmlFunction : htmlConstant)(value)) : this.node().innerHTML;
|
1062 | }
|
1063 | function raise() {
|
1064 | if (this.nextSibling)
|
1065 | this.parentNode.appendChild(this);
|
1066 | }
|
1067 | function selection_raise() {
|
1068 | return this.each(raise);
|
1069 | }
|
1070 | function lower() {
|
1071 | if (this.previousSibling)
|
1072 | this.parentNode.insertBefore(this, this.parentNode.firstChild);
|
1073 | }
|
1074 | function selection_lower() {
|
1075 | return this.each(lower);
|
1076 | }
|
1077 | function selection_append(name) {
|
1078 | var create2 = typeof name === "function" ? name : creator(name);
|
1079 | return this.select(function() {
|
1080 | return this.appendChild(create2.apply(this, arguments));
|
1081 | });
|
1082 | }
|
1083 | function constantNull() {
|
1084 | return null;
|
1085 | }
|
1086 | function selection_insert(name, before) {
|
1087 | var create2 = typeof name === "function" ? name : creator(name), select = before == null ? constantNull : typeof before === "function" ? before : selector(before);
|
1088 | return this.select(function() {
|
1089 | return this.insertBefore(create2.apply(this, arguments), select.apply(this, arguments) || null);
|
1090 | });
|
1091 | }
|
1092 | function remove() {
|
1093 | var parent = this.parentNode;
|
1094 | if (parent)
|
1095 | parent.removeChild(this);
|
1096 | }
|
1097 | function selection_remove() {
|
1098 | return this.each(remove);
|
1099 | }
|
1100 | function selection_cloneShallow() {
|
1101 | var clone2 = this.cloneNode(false), parent = this.parentNode;
|
1102 | return parent ? parent.insertBefore(clone2, this.nextSibling) : clone2;
|
1103 | }
|
1104 | function selection_cloneDeep() {
|
1105 | var clone2 = this.cloneNode(true), parent = this.parentNode;
|
1106 | return parent ? parent.insertBefore(clone2, this.nextSibling) : clone2;
|
1107 | }
|
1108 | function selection_clone(deep) {
|
1109 | return this.select(deep ? selection_cloneDeep : selection_cloneShallow);
|
1110 | }
|
1111 | function selection_datum(value) {
|
1112 | return arguments.length ? this.property("__data__", value) : this.node().__data__;
|
1113 | }
|
1114 | function contextListener(listener) {
|
1115 | return function(event) {
|
1116 | listener.call(this, event, this.__data__);
|
1117 | };
|
1118 | }
|
1119 | function parseTypenames(typenames) {
|
1120 | return typenames.trim().split(/^|\s+/).map(function(t) {
|
1121 | var name = "", i = t.indexOf(".");
|
1122 | if (i >= 0)
|
1123 | name = t.slice(i + 1), t = t.slice(0, i);
|
1124 | return { type: t, name };
|
1125 | });
|
1126 | }
|
1127 | function onRemove(typename) {
|
1128 | return function() {
|
1129 | var on = this.__on;
|
1130 | if (!on)
|
1131 | return;
|
1132 | for (var j = 0, i = -1, m = on.length, o; j < m; ++j) {
|
1133 | if (o = on[j], (!typename.type || o.type === typename.type) && o.name === typename.name) {
|
1134 | this.removeEventListener(o.type, o.listener, o.options);
|
1135 | } else {
|
1136 | on[++i] = o;
|
1137 | }
|
1138 | }
|
1139 | if (++i)
|
1140 | on.length = i;
|
1141 | else
|
1142 | delete this.__on;
|
1143 | };
|
1144 | }
|
1145 | function onAdd(typename, value, options) {
|
1146 | return function() {
|
1147 | var on = this.__on, o, listener = contextListener(value);
|
1148 | if (on)
|
1149 | for (var j = 0, m = on.length; j < m; ++j) {
|
1150 | if ((o = on[j]).type === typename.type && o.name === typename.name) {
|
1151 | this.removeEventListener(o.type, o.listener, o.options);
|
1152 | this.addEventListener(o.type, o.listener = listener, o.options = options);
|
1153 | o.value = value;
|
1154 | return;
|
1155 | }
|
1156 | }
|
1157 | this.addEventListener(typename.type, listener, options);
|
1158 | o = { type: typename.type, name: typename.name, value, listener, options };
|
1159 | if (!on)
|
1160 | this.__on = [o];
|
1161 | else
|
1162 | on.push(o);
|
1163 | };
|
1164 | }
|
1165 | function selection_on(typename, value, options) {
|
1166 | var typenames = parseTypenames(typename + ""), i, n = typenames.length, t;
|
1167 | if (arguments.length < 2) {
|
1168 | var on = this.node().__on;
|
1169 | if (on)
|
1170 | for (var j = 0, m = on.length, o; j < m; ++j) {
|
1171 | for (i = 0, o = on[j]; i < n; ++i) {
|
1172 | if ((t = typenames[i]).type === o.type && t.name === o.name) {
|
1173 | return o.value;
|
1174 | }
|
1175 | }
|
1176 | }
|
1177 | return;
|
1178 | }
|
1179 | on = value ? onAdd : onRemove;
|
1180 | for (i = 0; i < n; ++i)
|
1181 | this.each(on(typenames[i], value, options));
|
1182 | return this;
|
1183 | }
|
1184 | function dispatchEvent(node2, type2, params) {
|
1185 | var window2 = defaultView(node2), event = window2.CustomEvent;
|
1186 | if (typeof event === "function") {
|
1187 | event = new event(type2, params);
|
1188 | } else {
|
1189 | event = window2.document.createEvent("Event");
|
1190 | if (params)
|
1191 | event.initEvent(type2, params.bubbles, params.cancelable), event.detail = params.detail;
|
1192 | else
|
1193 | event.initEvent(type2, false, false);
|
1194 | }
|
1195 | node2.dispatchEvent(event);
|
1196 | }
|
1197 | function dispatchConstant(type2, params) {
|
1198 | return function() {
|
1199 | return dispatchEvent(this, type2, params);
|
1200 | };
|
1201 | }
|
1202 | function dispatchFunction(type2, params) {
|
1203 | return function() {
|
1204 | return dispatchEvent(this, type2, params.apply(this, arguments));
|
1205 | };
|
1206 | }
|
1207 | function selection_dispatch(type2, params) {
|
1208 | return this.each((typeof params === "function" ? dispatchFunction : dispatchConstant)(type2, params));
|
1209 | }
|
1210 | function* selection_iterator() {
|
1211 | for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {
|
1212 | for (var group = groups[j], i = 0, n = group.length, node2; i < n; ++i) {
|
1213 | if (node2 = group[i])
|
1214 | yield node2;
|
1215 | }
|
1216 | }
|
1217 | }
|
1218 | var root$2 = [null];
|
1219 | function Selection$1(groups, parents) {
|
1220 | this._groups = groups;
|
1221 | this._parents = parents;
|
1222 | }
|
1223 | function selection() {
|
1224 | return new Selection$1([[document.documentElement]], root$2);
|
1225 | }
|
1226 | function selection_selection() {
|
1227 | return this;
|
1228 | }
|
1229 | Selection$1.prototype = selection.prototype = {
|
1230 | constructor: Selection$1,
|
1231 | select: selection_select,
|
1232 | selectAll: selection_selectAll,
|
1233 | selectChild: selection_selectChild,
|
1234 | selectChildren: selection_selectChildren,
|
1235 | filter: selection_filter,
|
1236 | data: selection_data,
|
1237 | enter: selection_enter,
|
1238 | exit: selection_exit,
|
1239 | join: selection_join,
|
1240 | merge: selection_merge,
|
1241 | selection: selection_selection,
|
1242 | order: selection_order,
|
1243 | sort: selection_sort,
|
1244 | call: selection_call,
|
1245 | nodes: selection_nodes,
|
1246 | node: selection_node,
|
1247 | size: selection_size,
|
1248 | empty: selection_empty,
|
1249 | each: selection_each,
|
1250 | attr: selection_attr,
|
1251 | style: selection_style,
|
1252 | property: selection_property,
|
1253 | classed: selection_classed,
|
1254 | text: selection_text,
|
1255 | html: selection_html,
|
1256 | raise: selection_raise,
|
1257 | lower: selection_lower,
|
1258 | append: selection_append,
|
1259 | insert: selection_insert,
|
1260 | remove: selection_remove,
|
1261 | clone: selection_clone,
|
1262 | datum: selection_datum,
|
1263 | on: selection_on,
|
1264 | dispatch: selection_dispatch,
|
1265 | [Symbol.iterator]: selection_iterator
|
1266 | };
|
1267 | function d3select(selector2) {
|
1268 | return typeof selector2 === "string" ? new Selection$1([[document.querySelector(selector2)]], [document.documentElement]) : new Selection$1([[selector2]], root$2);
|
1269 | }
|
1270 | function define(constructor, factory, prototype) {
|
1271 | constructor.prototype = factory.prototype = prototype;
|
1272 | prototype.constructor = constructor;
|
1273 | }
|
1274 | function extend$1(parent, definition) {
|
1275 | var prototype = Object.create(parent.prototype);
|
1276 | for (var key in definition)
|
1277 | prototype[key] = definition[key];
|
1278 | return prototype;
|
1279 | }
|
1280 | function Color$2() {
|
1281 | }
|
1282 | var darker = 0.7;
|
1283 | var brighter = 1 / darker;
|
1284 | var reI = "\\s*([+-]?\\d+)\\s*", reN = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*", reP = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*", reHex = /^#([0-9a-f]{3,8})$/, reRgbInteger = new RegExp(`^rgb\\(${reI},${reI},${reI}\\)$`), reRgbPercent = new RegExp(`^rgb\\(${reP},${reP},${reP}\\)$`), reRgbaInteger = new RegExp(`^rgba\\(${reI},${reI},${reI},${reN}\\)$`), reRgbaPercent = new RegExp(`^rgba\\(${reP},${reP},${reP},${reN}\\)$`), reHslPercent = new RegExp(`^hsl\\(${reN},${reP},${reP}\\)$`), reHslaPercent = new RegExp(`^hsla\\(${reN},${reP},${reP},${reN}\\)$`);
|
1285 | var named = {
|
1286 | aliceblue: 15792383,
|
1287 | antiquewhite: 16444375,
|
1288 | aqua: 65535,
|
1289 | aquamarine: 8388564,
|
1290 | azure: 15794175,
|
1291 | beige: 16119260,
|
1292 | bisque: 16770244,
|
1293 | black: 0,
|
1294 | blanchedalmond: 16772045,
|
1295 | blue: 255,
|
1296 | blueviolet: 9055202,
|
1297 | brown: 10824234,
|
1298 | burlywood: 14596231,
|
1299 | cadetblue: 6266528,
|
1300 | chartreuse: 8388352,
|
1301 | chocolate: 13789470,
|
1302 | coral: 16744272,
|
1303 | cornflowerblue: 6591981,
|
1304 | cornsilk: 16775388,
|
1305 | crimson: 14423100,
|
1306 | cyan: 65535,
|
1307 | darkblue: 139,
|
1308 | darkcyan: 35723,
|
1309 | darkgoldenrod: 12092939,
|
1310 | darkgray: 11119017,
|
1311 | darkgreen: 25600,
|
1312 | darkgrey: 11119017,
|
1313 | darkkhaki: 12433259,
|
1314 | darkmagenta: 9109643,
|
1315 | darkolivegreen: 5597999,
|
1316 | darkorange: 16747520,
|
1317 | darkorchid: 10040012,
|
1318 | darkred: 9109504,
|
1319 | darksalmon: 15308410,
|
1320 | darkseagreen: 9419919,
|
1321 | darkslateblue: 4734347,
|
1322 | darkslategray: 3100495,
|
1323 | darkslategrey: 3100495,
|
1324 | darkturquoise: 52945,
|
1325 | darkviolet: 9699539,
|
1326 | deeppink: 16716947,
|
1327 | deepskyblue: 49151,
|
1328 | dimgray: 6908265,
|
1329 | dimgrey: 6908265,
|
1330 | dodgerblue: 2003199,
|
1331 | firebrick: 11674146,
|
1332 | floralwhite: 16775920,
|
1333 | forestgreen: 2263842,
|
1334 | fuchsia: 16711935,
|
1335 | gainsboro: 14474460,
|
1336 | ghostwhite: 16316671,
|
1337 | gold: 16766720,
|
1338 | goldenrod: 14329120,
|
1339 | gray: 8421504,
|
1340 | green: 32768,
|
1341 | greenyellow: 11403055,
|
1342 | grey: 8421504,
|
1343 | honeydew: 15794160,
|
1344 | hotpink: 16738740,
|
1345 | indianred: 13458524,
|
1346 | indigo: 4915330,
|
1347 | ivory: 16777200,
|
1348 | khaki: 15787660,
|
1349 | lavender: 15132410,
|
1350 | lavenderblush: 16773365,
|
1351 | lawngreen: 8190976,
|
1352 | lemonchiffon: 16775885,
|
1353 | lightblue: 11393254,
|
1354 | lightcoral: 15761536,
|
1355 | lightcyan: 14745599,
|
1356 | lightgoldenrodyellow: 16448210,
|
1357 | lightgray: 13882323,
|
1358 | lightgreen: 9498256,
|
1359 | lightgrey: 13882323,
|
1360 | lightpink: 16758465,
|
1361 | lightsalmon: 16752762,
|
1362 | lightseagreen: 2142890,
|
1363 | lightskyblue: 8900346,
|
1364 | lightslategray: 7833753,
|
1365 | lightslategrey: 7833753,
|
1366 | lightsteelblue: 11584734,
|
1367 | lightyellow: 16777184,
|
1368 | lime: 65280,
|
1369 | limegreen: 3329330,
|
1370 | linen: 16445670,
|
1371 | magenta: 16711935,
|
1372 | maroon: 8388608,
|
1373 | mediumaquamarine: 6737322,
|
1374 | mediumblue: 205,
|
1375 | mediumorchid: 12211667,
|
1376 | mediumpurple: 9662683,
|
1377 | mediumseagreen: 3978097,
|
1378 | mediumslateblue: 8087790,
|
1379 | mediumspringgreen: 64154,
|
1380 | mediumturquoise: 4772300,
|
1381 | mediumvioletred: 13047173,
|
1382 | midnightblue: 1644912,
|
1383 | mintcream: 16121850,
|
1384 | mistyrose: 16770273,
|
1385 | moccasin: 16770229,
|
1386 | navajowhite: 16768685,
|
1387 | navy: 128,
|
1388 | oldlace: 16643558,
|
1389 | olive: 8421376,
|
1390 | olivedrab: 7048739,
|
1391 | orange: 16753920,
|
1392 | orangered: 16729344,
|
1393 | orchid: 14315734,
|
1394 | palegoldenrod: 15657130,
|
1395 | palegreen: 10025880,
|
1396 | paleturquoise: 11529966,
|
1397 | palevioletred: 14381203,
|
1398 | papayawhip: 16773077,
|
1399 | peachpuff: 16767673,
|
1400 | peru: 13468991,
|
1401 | pink: 16761035,
|
1402 | plum: 14524637,
|
1403 | powderblue: 11591910,
|
1404 | purple: 8388736,
|
1405 | rebeccapurple: 6697881,
|
1406 | red: 16711680,
|
1407 | rosybrown: 12357519,
|
1408 | royalblue: 4286945,
|
1409 | saddlebrown: 9127187,
|
1410 | salmon: 16416882,
|
1411 | sandybrown: 16032864,
|
1412 | seagreen: 3050327,
|
1413 | seashell: 16774638,
|
1414 | sienna: 10506797,
|
1415 | silver: 12632256,
|
1416 | skyblue: 8900331,
|
1417 | slateblue: 6970061,
|
1418 | slategray: 7372944,
|
1419 | slategrey: 7372944,
|
1420 | snow: 16775930,
|
1421 | springgreen: 65407,
|
1422 | steelblue: 4620980,
|
1423 | tan: 13808780,
|
1424 | teal: 32896,
|
1425 | thistle: 14204888,
|
1426 | tomato: 16737095,
|
1427 | turquoise: 4251856,
|
1428 | violet: 15631086,
|
1429 | wheat: 16113331,
|
1430 | white: 16777215,
|
1431 | whitesmoke: 16119285,
|
1432 | yellow: 16776960,
|
1433 | yellowgreen: 10145074
|
1434 | };
|
1435 | define(Color$2, color, {
|
1436 | copy(channels2) {
|
1437 | return Object.assign(new this.constructor(), this, channels2);
|
1438 | },
|
1439 | displayable() {
|
1440 | return this.rgb().displayable();
|
1441 | },
|
1442 | hex: color_formatHex,
|
1443 |
|
1444 | formatHex: color_formatHex,
|
1445 | formatHex8: color_formatHex8,
|
1446 | formatHsl: color_formatHsl,
|
1447 | formatRgb: color_formatRgb,
|
1448 | toString: color_formatRgb
|
1449 | });
|
1450 | function color_formatHex() {
|
1451 | return this.rgb().formatHex();
|
1452 | }
|
1453 | function color_formatHex8() {
|
1454 | return this.rgb().formatHex8();
|
1455 | }
|
1456 | function color_formatHsl() {
|
1457 | return hslConvert(this).formatHsl();
|
1458 | }
|
1459 | function color_formatRgb() {
|
1460 | return this.rgb().formatRgb();
|
1461 | }
|
1462 | function color(format2) {
|
1463 | var m, l;
|
1464 | format2 = (format2 + "").trim().toLowerCase();
|
1465 | return (m = reHex.exec(format2)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) : l === 3 ? new Rgb(m >> 8 & 15 | m >> 4 & 240, m >> 4 & 15 | m & 240, (m & 15) << 4 | m & 15, 1) : l === 8 ? rgba$2(m >> 24 & 255, m >> 16 & 255, m >> 8 & 255, (m & 255) / 255) : l === 4 ? rgba$2(m >> 12 & 15 | m >> 8 & 240, m >> 8 & 15 | m >> 4 & 240, m >> 4 & 15 | m & 240, ((m & 15) << 4 | m & 15) / 255) : null) : (m = reRgbInteger.exec(format2)) ? new Rgb(m[1], m[2], m[3], 1) : (m = reRgbPercent.exec(format2)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) : (m = reRgbaInteger.exec(format2)) ? rgba$2(m[1], m[2], m[3], m[4]) : (m = reRgbaPercent.exec(format2)) ? rgba$2(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) : (m = reHslPercent.exec(format2)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) : (m = reHslaPercent.exec(format2)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) : named.hasOwnProperty(format2) ? rgbn(named[format2]) : format2 === "transparent" ? new Rgb(NaN, NaN, NaN, 0) : null;
|
1466 | }
|
1467 | function rgbn(n) {
|
1468 | return new Rgb(n >> 16 & 255, n >> 8 & 255, n & 255, 1);
|
1469 | }
|
1470 | function rgba$2(r, g, b, a) {
|
1471 | if (a <= 0)
|
1472 | r = g = b = NaN;
|
1473 | return new Rgb(r, g, b, a);
|
1474 | }
|
1475 | function rgbConvert(o) {
|
1476 | if (!(o instanceof Color$2))
|
1477 | o = color(o);
|
1478 | if (!o)
|
1479 | return new Rgb();
|
1480 | o = o.rgb();
|
1481 | return new Rgb(o.r, o.g, o.b, o.opacity);
|
1482 | }
|
1483 | function rgb(r, g, b, opacity) {
|
1484 | return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);
|
1485 | }
|
1486 | function Rgb(r, g, b, opacity) {
|
1487 | this.r = +r;
|
1488 | this.g = +g;
|
1489 | this.b = +b;
|
1490 | this.opacity = +opacity;
|
1491 | }
|
1492 | define(Rgb, rgb, extend$1(Color$2, {
|
1493 | brighter(k) {
|
1494 | k = k == null ? brighter : Math.pow(brighter, k);
|
1495 | return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
|
1496 | },
|
1497 | darker(k) {
|
1498 | k = k == null ? darker : Math.pow(darker, k);
|
1499 | return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
|
1500 | },
|
1501 | rgb() {
|
1502 | return this;
|
1503 | },
|
1504 | clamp() {
|
1505 | return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity));
|
1506 | },
|
1507 | displayable() {
|
1508 | return -0.5 <= this.r && this.r < 255.5 && (-0.5 <= this.g && this.g < 255.5) && (-0.5 <= this.b && this.b < 255.5) && (0 <= this.opacity && this.opacity <= 1);
|
1509 | },
|
1510 | hex: rgb_formatHex,
|
1511 |
|
1512 | formatHex: rgb_formatHex,
|
1513 | formatHex8: rgb_formatHex8,
|
1514 | formatRgb: rgb_formatRgb,
|
1515 | toString: rgb_formatRgb
|
1516 | }));
|
1517 | function rgb_formatHex() {
|
1518 | return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`;
|
1519 | }
|
1520 | function rgb_formatHex8() {
|
1521 | return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
|
1522 | }
|
1523 | function rgb_formatRgb() {
|
1524 | const a = clampa(this.opacity);
|
1525 | return `${a === 1 ? "rgb(" : "rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a === 1 ? ")" : `, ${a})`}`;
|
1526 | }
|
1527 | function clampa(opacity) {
|
1528 | return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity));
|
1529 | }
|
1530 | function clampi(value) {
|
1531 | return Math.max(0, Math.min(255, Math.round(value) || 0));
|
1532 | }
|
1533 | function hex(value) {
|
1534 | value = clampi(value);
|
1535 | return (value < 16 ? "0" : "") + value.toString(16);
|
1536 | }
|
1537 | function hsla(h, s, l, a) {
|
1538 | if (a <= 0)
|
1539 | h = s = l = NaN;
|
1540 | else if (l <= 0 || l >= 1)
|
1541 | h = s = NaN;
|
1542 | else if (s <= 0)
|
1543 | h = NaN;
|
1544 | return new Hsl(h, s, l, a);
|
1545 | }
|
1546 | function hslConvert(o) {
|
1547 | if (o instanceof Hsl)
|
1548 | return new Hsl(o.h, o.s, o.l, o.opacity);
|
1549 | if (!(o instanceof Color$2))
|
1550 | o = color(o);
|
1551 | if (!o)
|
1552 | return new Hsl();
|
1553 | if (o instanceof Hsl)
|
1554 | return o;
|
1555 | o = o.rgb();
|
1556 | var r = o.r / 255, g = o.g / 255, b = o.b / 255, min2 = Math.min(r, g, b), max2 = Math.max(r, g, b), h = NaN, s = max2 - min2, l = (max2 + min2) / 2;
|
1557 | if (s) {
|
1558 | if (r === max2)
|
1559 | h = (g - b) / s + (g < b) * 6;
|
1560 | else if (g === max2)
|
1561 | h = (b - r) / s + 2;
|
1562 | else
|
1563 | h = (r - g) / s + 4;
|
1564 | s /= l < 0.5 ? max2 + min2 : 2 - max2 - min2;
|
1565 | h *= 60;
|
1566 | } else {
|
1567 | s = l > 0 && l < 1 ? 0 : h;
|
1568 | }
|
1569 | return new Hsl(h, s, l, o.opacity);
|
1570 | }
|
1571 | function hsl(h, s, l, opacity) {
|
1572 | return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);
|
1573 | }
|
1574 | function Hsl(h, s, l, opacity) {
|
1575 | this.h = +h;
|
1576 | this.s = +s;
|
1577 | this.l = +l;
|
1578 | this.opacity = +opacity;
|
1579 | }
|
1580 | define(Hsl, hsl, extend$1(Color$2, {
|
1581 | brighter(k) {
|
1582 | k = k == null ? brighter : Math.pow(brighter, k);
|
1583 | return new Hsl(this.h, this.s, this.l * k, this.opacity);
|
1584 | },
|
1585 | darker(k) {
|
1586 | k = k == null ? darker : Math.pow(darker, k);
|
1587 | return new Hsl(this.h, this.s, this.l * k, this.opacity);
|
1588 | },
|
1589 | rgb() {
|
1590 | var h = this.h % 360 + (this.h < 0) * 360, s = isNaN(h) || isNaN(this.s) ? 0 : this.s, l = this.l, m2 = l + (l < 0.5 ? l : 1 - l) * s, m1 = 2 * l - m2;
|
1591 | return new Rgb(
|
1592 | hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),
|
1593 | hsl2rgb(h, m1, m2),
|
1594 | hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),
|
1595 | this.opacity
|
1596 | );
|
1597 | },
|
1598 | clamp() {
|
1599 | return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity));
|
1600 | },
|
1601 | displayable() {
|
1602 | return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && (0 <= this.l && this.l <= 1) && (0 <= this.opacity && this.opacity <= 1);
|
1603 | },
|
1604 | formatHsl() {
|
1605 | const a = clampa(this.opacity);
|
1606 | return `${a === 1 ? "hsl(" : "hsla("}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a === 1 ? ")" : `, ${a})`}`;
|
1607 | }
|
1608 | }));
|
1609 | function clamph(value) {
|
1610 | value = (value || 0) % 360;
|
1611 | return value < 0 ? value + 360 : value;
|
1612 | }
|
1613 | function clampt(value) {
|
1614 | return Math.max(0, Math.min(1, value || 0));
|
1615 | }
|
1616 | function hsl2rgb(h, m1, m2) {
|
1617 | return (h < 60 ? m1 + (m2 - m1) * h / 60 : h < 180 ? m2 : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 : m1) * 255;
|
1618 | }
|
1619 | const constant$1 = (x) => () => x;
|
1620 | function linear(a, d) {
|
1621 | return function(t) {
|
1622 | return a + t * d;
|
1623 | };
|
1624 | }
|
1625 | function exponential(a, b, y) {
|
1626 | return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) {
|
1627 | return Math.pow(a + t * b, y);
|
1628 | };
|
1629 | }
|
1630 | function hue(a, b) {
|
1631 | var d = b - a;
|
1632 | return d ? linear(a, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : constant$1(isNaN(a) ? b : a);
|
1633 | }
|
1634 | function gamma(y) {
|
1635 | return (y = +y) === 1 ? nogamma : function(a, b) {
|
1636 | return b - a ? exponential(a, b, y) : constant$1(isNaN(a) ? b : a);
|
1637 | };
|
1638 | }
|
1639 | function nogamma(a, b) {
|
1640 | var d = b - a;
|
1641 | return d ? linear(a, d) : constant$1(isNaN(a) ? b : a);
|
1642 | }
|
1643 | const interpolateRgb = function rgbGamma(y) {
|
1644 | var color2 = gamma(y);
|
1645 | function rgb$1(start2, end) {
|
1646 | var r = color2((start2 = rgb(start2)).r, (end = rgb(end)).r), g = color2(start2.g, end.g), b = color2(start2.b, end.b), opacity = nogamma(start2.opacity, end.opacity);
|
1647 | return function(t) {
|
1648 | start2.r = r(t);
|
1649 | start2.g = g(t);
|
1650 | start2.b = b(t);
|
1651 | start2.opacity = opacity(t);
|
1652 | return start2 + "";
|
1653 | };
|
1654 | }
|
1655 | rgb$1.gamma = rgbGamma;
|
1656 | return rgb$1;
|
1657 | }(1);
|
1658 | function interpolateNumber(a, b) {
|
1659 | return a = +a, b = +b, function(t) {
|
1660 | return a * (1 - t) + b * t;
|
1661 | };
|
1662 | }
|
1663 | var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, reB = new RegExp(reA.source, "g");
|
1664 | function zero(b) {
|
1665 | return function() {
|
1666 | return b;
|
1667 | };
|
1668 | }
|
1669 | function one(b) {
|
1670 | return function(t) {
|
1671 | return b(t) + "";
|
1672 | };
|
1673 | }
|
1674 | function interpolateString(a, b) {
|
1675 | var bi = reA.lastIndex = reB.lastIndex = 0, am, bm, bs, i = -1, s = [], q = [];
|
1676 | a = a + "", b = b + "";
|
1677 | while ((am = reA.exec(a)) && (bm = reB.exec(b))) {
|
1678 | if ((bs = bm.index) > bi) {
|
1679 | bs = b.slice(bi, bs);
|
1680 | if (s[i])
|
1681 | s[i] += bs;
|
1682 | else
|
1683 | s[++i] = bs;
|
1684 | }
|
1685 | if ((am = am[0]) === (bm = bm[0])) {
|
1686 | if (s[i])
|
1687 | s[i] += bm;
|
1688 | else
|
1689 | s[++i] = bm;
|
1690 | } else {
|
1691 | s[++i] = null;
|
1692 | q.push({ i, x: interpolateNumber(am, bm) });
|
1693 | }
|
1694 | bi = reB.lastIndex;
|
1695 | }
|
1696 | if (bi < b.length) {
|
1697 | bs = b.slice(bi);
|
1698 | if (s[i])
|
1699 | s[i] += bs;
|
1700 | else
|
1701 | s[++i] = bs;
|
1702 | }
|
1703 | return s.length < 2 ? q[0] ? one(q[0].x) : zero(b) : (b = q.length, function(t) {
|
1704 | for (var i2 = 0, o; i2 < b; ++i2)
|
1705 | s[(o = q[i2]).i] = o.x(t);
|
1706 | return s.join("");
|
1707 | });
|
1708 | }
|
1709 | var degrees = 180 / Math.PI;
|
1710 | var identity$1 = {
|
1711 | translateX: 0,
|
1712 | translateY: 0,
|
1713 | rotate: 0,
|
1714 | skewX: 0,
|
1715 | scaleX: 1,
|
1716 | scaleY: 1
|
1717 | };
|
1718 | function decompose(a, b, c, d, e, f) {
|
1719 | var scaleX, scaleY, skewX;
|
1720 | if (scaleX = Math.sqrt(a * a + b * b))
|
1721 | a /= scaleX, b /= scaleX;
|
1722 | if (skewX = a * c + b * d)
|
1723 | c -= a * skewX, d -= b * skewX;
|
1724 | if (scaleY = Math.sqrt(c * c + d * d))
|
1725 | c /= scaleY, d /= scaleY, skewX /= scaleY;
|
1726 | if (a * d < b * c)
|
1727 | a = -a, b = -b, skewX = -skewX, scaleX = -scaleX;
|
1728 | return {
|
1729 | translateX: e,
|
1730 | translateY: f,
|
1731 | rotate: Math.atan2(b, a) * degrees,
|
1732 | skewX: Math.atan(skewX) * degrees,
|
1733 | scaleX,
|
1734 | scaleY
|
1735 | };
|
1736 | }
|
1737 | var svgNode;
|
1738 | function parseCss(value) {
|
1739 | const m = new (typeof DOMMatrix === "function" ? DOMMatrix : WebKitCSSMatrix)(value + "");
|
1740 | return m.isIdentity ? identity$1 : decompose(m.a, m.b, m.c, m.d, m.e, m.f);
|
1741 | }
|
1742 | function parseSvg(value) {
|
1743 | if (value == null)
|
1744 | return identity$1;
|
1745 | if (!svgNode)
|
1746 | svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
1747 | svgNode.setAttribute("transform", value);
|
1748 | if (!(value = svgNode.transform.baseVal.consolidate()))
|
1749 | return identity$1;
|
1750 | value = value.matrix;
|
1751 | return decompose(value.a, value.b, value.c, value.d, value.e, value.f);
|
1752 | }
|
1753 | function interpolateTransform(parse2, pxComma, pxParen, degParen) {
|
1754 | function pop(s) {
|
1755 | return s.length ? s.pop() + " " : "";
|
1756 | }
|
1757 | function translate(xa, ya, xb, yb, s, q) {
|
1758 | if (xa !== xb || ya !== yb) {
|
1759 | var i = s.push("translate(", null, pxComma, null, pxParen);
|
1760 | q.push({ i: i - 4, x: interpolateNumber(xa, xb) }, { i: i - 2, x: interpolateNumber(ya, yb) });
|
1761 | } else if (xb || yb) {
|
1762 | s.push("translate(" + xb + pxComma + yb + pxParen);
|
1763 | }
|
1764 | }
|
1765 | function rotate(a, b, s, q) {
|
1766 | if (a !== b) {
|
1767 | if (a - b > 180)
|
1768 | b += 360;
|
1769 | else if (b - a > 180)
|
1770 | a += 360;
|
1771 | q.push({ i: s.push(pop(s) + "rotate(", null, degParen) - 2, x: interpolateNumber(a, b) });
|
1772 | } else if (b) {
|
1773 | s.push(pop(s) + "rotate(" + b + degParen);
|
1774 | }
|
1775 | }
|
1776 | function skewX(a, b, s, q) {
|
1777 | if (a !== b) {
|
1778 | q.push({ i: s.push(pop(s) + "skewX(", null, degParen) - 2, x: interpolateNumber(a, b) });
|
1779 | } else if (b) {
|
1780 | s.push(pop(s) + "skewX(" + b + degParen);
|
1781 | }
|
1782 | }
|
1783 | function scale(xa, ya, xb, yb, s, q) {
|
1784 | if (xa !== xb || ya !== yb) {
|
1785 | var i = s.push(pop(s) + "scale(", null, ",", null, ")");
|
1786 | q.push({ i: i - 4, x: interpolateNumber(xa, xb) }, { i: i - 2, x: interpolateNumber(ya, yb) });
|
1787 | } else if (xb !== 1 || yb !== 1) {
|
1788 | s.push(pop(s) + "scale(" + xb + "," + yb + ")");
|
1789 | }
|
1790 | }
|
1791 | return function(a, b) {
|
1792 | var s = [], q = [];
|
1793 | a = parse2(a), b = parse2(b);
|
1794 | translate(a.translateX, a.translateY, b.translateX, b.translateY, s, q);
|
1795 | rotate(a.rotate, b.rotate, s, q);
|
1796 | skewX(a.skewX, b.skewX, s, q);
|
1797 | scale(a.scaleX, a.scaleY, b.scaleX, b.scaleY, s, q);
|
1798 | a = b = null;
|
1799 | return function(t) {
|
1800 | var i = -1, n = q.length, o;
|
1801 | while (++i < n)
|
1802 | s[(o = q[i]).i] = o.x(t);
|
1803 | return s.join("");
|
1804 | };
|
1805 | };
|
1806 | }
|
1807 | var interpolateTransformCss = interpolateTransform(parseCss, "px, ", "px)", "deg)");
|
1808 | var interpolateTransformSvg = interpolateTransform(parseSvg, ", ", ")", ")");
|
1809 | var frame = 0, timeout$1 = 0, interval = 0, pokeDelay = 1e3, taskHead, taskTail, clockLast = 0, clockNow = 0, clockSkew = 0, clock = typeof performance === "object" && performance.now ? performance : Date, setFrame = typeof window === "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f) {
|
1810 | setTimeout(f, 17);
|
1811 | };
|
1812 | function now() {
|
1813 | return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew);
|
1814 | }
|
1815 | function clearNow() {
|
1816 | clockNow = 0;
|
1817 | }
|
1818 | function Timer() {
|
1819 | this._call = this._time = this._next = null;
|
1820 | }
|
1821 | Timer.prototype = timer.prototype = {
|
1822 | constructor: Timer,
|
1823 | restart: function(callback, delay, time) {
|
1824 | if (typeof callback !== "function")
|
1825 | throw new TypeError("callback is not a function");
|
1826 | time = (time == null ? now() : +time) + (delay == null ? 0 : +delay);
|
1827 | if (!this._next && taskTail !== this) {
|
1828 | if (taskTail)
|
1829 | taskTail._next = this;
|
1830 | else
|
1831 | taskHead = this;
|
1832 | taskTail = this;
|
1833 | }
|
1834 | this._call = callback;
|
1835 | this._time = time;
|
1836 | sleep();
|
1837 | },
|
1838 | stop: function() {
|
1839 | if (this._call) {
|
1840 | this._call = null;
|
1841 | this._time = Infinity;
|
1842 | sleep();
|
1843 | }
|
1844 | }
|
1845 | };
|
1846 | function timer(callback, delay, time) {
|
1847 | var t = new Timer();
|
1848 | t.restart(callback, delay, time);
|
1849 | return t;
|
1850 | }
|
1851 | function timerFlush() {
|
1852 | now();
|
1853 | ++frame;
|
1854 | var t = taskHead, e;
|
1855 | while (t) {
|
1856 | if ((e = clockNow - t._time) >= 0)
|
1857 | t._call.call(void 0, e);
|
1858 | t = t._next;
|
1859 | }
|
1860 | --frame;
|
1861 | }
|
1862 | function wake() {
|
1863 | clockNow = (clockLast = clock.now()) + clockSkew;
|
1864 | frame = timeout$1 = 0;
|
1865 | try {
|
1866 | timerFlush();
|
1867 | } finally {
|
1868 | frame = 0;
|
1869 | nap();
|
1870 | clockNow = 0;
|
1871 | }
|
1872 | }
|
1873 | function poke() {
|
1874 | var now2 = clock.now(), delay = now2 - clockLast;
|
1875 | if (delay > pokeDelay)
|
1876 | clockSkew -= delay, clockLast = now2;
|
1877 | }
|
1878 | function nap() {
|
1879 | var t0, t1 = taskHead, t2, time = Infinity;
|
1880 | while (t1) {
|
1881 | if (t1._call) {
|
1882 | if (time > t1._time)
|
1883 | time = t1._time;
|
1884 | t0 = t1, t1 = t1._next;
|
1885 | } else {
|
1886 | t2 = t1._next, t1._next = null;
|
1887 | t1 = t0 ? t0._next = t2 : taskHead = t2;
|
1888 | }
|
1889 | }
|
1890 | taskTail = t0;
|
1891 | sleep(time);
|
1892 | }
|
1893 | function sleep(time) {
|
1894 | if (frame)
|
1895 | return;
|
1896 | if (timeout$1)
|
1897 | timeout$1 = clearTimeout(timeout$1);
|
1898 | var delay = time - clockNow;
|
1899 | if (delay > 24) {
|
1900 | if (time < Infinity)
|
1901 | timeout$1 = setTimeout(wake, time - clock.now() - clockSkew);
|
1902 | if (interval)
|
1903 | interval = clearInterval(interval);
|
1904 | } else {
|
1905 | if (!interval)
|
1906 | clockLast = clock.now(), interval = setInterval(poke, pokeDelay);
|
1907 | frame = 1, setFrame(wake);
|
1908 | }
|
1909 | }
|
1910 | function timeout(callback, delay, time) {
|
1911 | var t = new Timer();
|
1912 | delay = delay == null ? 0 : +delay;
|
1913 | t.restart((elapsed) => {
|
1914 | t.stop();
|
1915 | callback(elapsed + delay);
|
1916 | }, delay, time);
|
1917 | return t;
|
1918 | }
|
1919 | var emptyOn = dispatch("start", "end", "cancel", "interrupt");
|
1920 | var emptyTween = [];
|
1921 | var CREATED = 0;
|
1922 | var SCHEDULED = 1;
|
1923 | var STARTING = 2;
|
1924 | var STARTED = 3;
|
1925 | var RUNNING = 4;
|
1926 | var ENDING = 5;
|
1927 | var ENDED = 6;
|
1928 | function schedule(node2, name, id2, index, group, timing) {
|
1929 | var schedules = node2.__transition;
|
1930 | if (!schedules)
|
1931 | node2.__transition = {};
|
1932 | else if (id2 in schedules)
|
1933 | return;
|
1934 | create$1(node2, id2, {
|
1935 | name,
|
1936 | index,
|
1937 |
|
1938 | group,
|
1939 |
|
1940 | on: emptyOn,
|
1941 | tween: emptyTween,
|
1942 | time: timing.time,
|
1943 | delay: timing.delay,
|
1944 | duration: timing.duration,
|
1945 | ease: timing.ease,
|
1946 | timer: null,
|
1947 | state: CREATED
|
1948 | });
|
1949 | }
|
1950 | function init$1(node2, id2) {
|
1951 | var schedule2 = get(node2, id2);
|
1952 | if (schedule2.state > CREATED)
|
1953 | throw new Error("too late; already scheduled");
|
1954 | return schedule2;
|
1955 | }
|
1956 | function set$1(node2, id2) {
|
1957 | var schedule2 = get(node2, id2);
|
1958 | if (schedule2.state > STARTED)
|
1959 | throw new Error("too late; already running");
|
1960 | return schedule2;
|
1961 | }
|
1962 | function get(node2, id2) {
|
1963 | var schedule2 = node2.__transition;
|
1964 | if (!schedule2 || !(schedule2 = schedule2[id2]))
|
1965 | throw new Error("transition not found");
|
1966 | return schedule2;
|
1967 | }
|
1968 | function create$1(node2, id2, self2) {
|
1969 | var schedules = node2.__transition, tween;
|
1970 | schedules[id2] = self2;
|
1971 | self2.timer = timer(schedule2, 0, self2.time);
|
1972 | function schedule2(elapsed) {
|
1973 | self2.state = SCHEDULED;
|
1974 | self2.timer.restart(start2, self2.delay, self2.time);
|
1975 | if (self2.delay <= elapsed)
|
1976 | start2(elapsed - self2.delay);
|
1977 | }
|
1978 | function start2(elapsed) {
|
1979 | var i, j, n, o;
|
1980 | if (self2.state !== SCHEDULED)
|
1981 | return stop();
|
1982 | for (i in schedules) {
|
1983 | o = schedules[i];
|
1984 | if (o.name !== self2.name)
|
1985 | continue;
|
1986 | if (o.state === STARTED)
|
1987 | return timeout(start2);
|
1988 | if (o.state === RUNNING) {
|
1989 | o.state = ENDED;
|
1990 | o.timer.stop();
|
1991 | o.on.call("interrupt", node2, node2.__data__, o.index, o.group);
|
1992 | delete schedules[i];
|
1993 | } else if (+i < id2) {
|
1994 | o.state = ENDED;
|
1995 | o.timer.stop();
|
1996 | o.on.call("cancel", node2, node2.__data__, o.index, o.group);
|
1997 | delete schedules[i];
|
1998 | }
|
1999 | }
|
2000 | timeout(function() {
|
2001 | if (self2.state === STARTED) {
|
2002 | self2.state = RUNNING;
|
2003 | self2.timer.restart(tick, self2.delay, self2.time);
|
2004 | tick(elapsed);
|
2005 | }
|
2006 | });
|
2007 | self2.state = STARTING;
|
2008 | self2.on.call("start", node2, node2.__data__, self2.index, self2.group);
|
2009 | if (self2.state !== STARTING)
|
2010 | return;
|
2011 | self2.state = STARTED;
|
2012 | tween = new Array(n = self2.tween.length);
|
2013 | for (i = 0, j = -1; i < n; ++i) {
|
2014 | if (o = self2.tween[i].value.call(node2, node2.__data__, self2.index, self2.group)) {
|
2015 | tween[++j] = o;
|
2016 | }
|
2017 | }
|
2018 | tween.length = j + 1;
|
2019 | }
|
2020 | function tick(elapsed) {
|
2021 | var t = elapsed < self2.duration ? self2.ease.call(null, elapsed / self2.duration) : (self2.timer.restart(stop), self2.state = ENDING, 1), i = -1, n = tween.length;
|
2022 | while (++i < n) {
|
2023 | tween[i].call(node2, t);
|
2024 | }
|
2025 | if (self2.state === ENDING) {
|
2026 | self2.on.call("end", node2, node2.__data__, self2.index, self2.group);
|
2027 | stop();
|
2028 | }
|
2029 | }
|
2030 | function stop() {
|
2031 | self2.state = ENDED;
|
2032 | self2.timer.stop();
|
2033 | delete schedules[id2];
|
2034 | for (var i in schedules)
|
2035 | return;
|
2036 | delete node2.__transition;
|
2037 | }
|
2038 | }
|
2039 | function interrupt(node2, name) {
|
2040 | var schedules = node2.__transition, schedule2, active, empty2 = true, i;
|
2041 | if (!schedules)
|
2042 | return;
|
2043 | name = name == null ? null : name + "";
|
2044 | for (i in schedules) {
|
2045 | if ((schedule2 = schedules[i]).name !== name) {
|
2046 | empty2 = false;
|
2047 | continue;
|
2048 | }
|
2049 | active = schedule2.state > STARTING && schedule2.state < ENDING;
|
2050 | schedule2.state = ENDED;
|
2051 | schedule2.timer.stop();
|
2052 | schedule2.on.call(active ? "interrupt" : "cancel", node2, node2.__data__, schedule2.index, schedule2.group);
|
2053 | delete schedules[i];
|
2054 | }
|
2055 | if (empty2)
|
2056 | delete node2.__transition;
|
2057 | }
|
2058 | function selection_interrupt(name) {
|
2059 | return this.each(function() {
|
2060 | interrupt(this, name);
|
2061 | });
|
2062 | }
|
2063 | function tweenRemove(id2, name) {
|
2064 | var tween0, tween1;
|
2065 | return function() {
|
2066 | var schedule2 = set$1(this, id2), tween = schedule2.tween;
|
2067 | if (tween !== tween0) {
|
2068 | tween1 = tween0 = tween;
|
2069 | for (var i = 0, n = tween1.length; i < n; ++i) {
|
2070 | if (tween1[i].name === name) {
|
2071 | tween1 = tween1.slice();
|
2072 | tween1.splice(i, 1);
|
2073 | break;
|
2074 | }
|
2075 | }
|
2076 | }
|
2077 | schedule2.tween = tween1;
|
2078 | };
|
2079 | }
|
2080 | function tweenFunction(id2, name, value) {
|
2081 | var tween0, tween1;
|
2082 | if (typeof value !== "function")
|
2083 | throw new Error();
|
2084 | return function() {
|
2085 | var schedule2 = set$1(this, id2), tween = schedule2.tween;
|
2086 | if (tween !== tween0) {
|
2087 | tween1 = (tween0 = tween).slice();
|
2088 | for (var t = { name, value }, i = 0, n = tween1.length; i < n; ++i) {
|
2089 | if (tween1[i].name === name) {
|
2090 | tween1[i] = t;
|
2091 | break;
|
2092 | }
|
2093 | }
|
2094 | if (i === n)
|
2095 | tween1.push(t);
|
2096 | }
|
2097 | schedule2.tween = tween1;
|
2098 | };
|
2099 | }
|
2100 | function transition_tween(name, value) {
|
2101 | var id2 = this._id;
|
2102 | name += "";
|
2103 | if (arguments.length < 2) {
|
2104 | var tween = get(this.node(), id2).tween;
|
2105 | for (var i = 0, n = tween.length, t; i < n; ++i) {
|
2106 | if ((t = tween[i]).name === name) {
|
2107 | return t.value;
|
2108 | }
|
2109 | }
|
2110 | return null;
|
2111 | }
|
2112 | return this.each((value == null ? tweenRemove : tweenFunction)(id2, name, value));
|
2113 | }
|
2114 | function tweenValue(transition, name, value) {
|
2115 | var id2 = transition._id;
|
2116 | transition.each(function() {
|
2117 | var schedule2 = set$1(this, id2);
|
2118 | (schedule2.value || (schedule2.value = {}))[name] = value.apply(this, arguments);
|
2119 | });
|
2120 | return function(node2) {
|
2121 | return get(node2, id2).value[name];
|
2122 | };
|
2123 | }
|
2124 | function interpolate(a, b) {
|
2125 | var c;
|
2126 | return (typeof b === "number" ? interpolateNumber : b instanceof color ? interpolateRgb : (c = color(b)) ? (b = c, interpolateRgb) : interpolateString)(a, b);
|
2127 | }
|
2128 | function attrRemove(name) {
|
2129 | return function() {
|
2130 | this.removeAttribute(name);
|
2131 | };
|
2132 | }
|
2133 | function attrRemoveNS(fullname) {
|
2134 | return function() {
|
2135 | this.removeAttributeNS(fullname.space, fullname.local);
|
2136 | };
|
2137 | }
|
2138 | function attrConstant(name, interpolate2, value1) {
|
2139 | var string00, string1 = value1 + "", interpolate0;
|
2140 | return function() {
|
2141 | var string0 = this.getAttribute(name);
|
2142 | return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate2(string00 = string0, value1);
|
2143 | };
|
2144 | }
|
2145 | function attrConstantNS(fullname, interpolate2, value1) {
|
2146 | var string00, string1 = value1 + "", interpolate0;
|
2147 | return function() {
|
2148 | var string0 = this.getAttributeNS(fullname.space, fullname.local);
|
2149 | return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate2(string00 = string0, value1);
|
2150 | };
|
2151 | }
|
2152 | function attrFunction(name, interpolate2, value) {
|
2153 | var string00, string10, interpolate0;
|
2154 | return function() {
|
2155 | var string0, value1 = value(this), string1;
|
2156 | if (value1 == null)
|
2157 | return void this.removeAttribute(name);
|
2158 | string0 = this.getAttribute(name);
|
2159 | string1 = value1 + "";
|
2160 | return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate2(string00 = string0, value1));
|
2161 | };
|
2162 | }
|
2163 | function attrFunctionNS(fullname, interpolate2, value) {
|
2164 | var string00, string10, interpolate0;
|
2165 | return function() {
|
2166 | var string0, value1 = value(this), string1;
|
2167 | if (value1 == null)
|
2168 | return void this.removeAttributeNS(fullname.space, fullname.local);
|
2169 | string0 = this.getAttributeNS(fullname.space, fullname.local);
|
2170 | string1 = value1 + "";
|
2171 | return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate2(string00 = string0, value1));
|
2172 | };
|
2173 | }
|
2174 | function transition_attr(name, value) {
|
2175 | var fullname = namespace(name), i = fullname === "transform" ? interpolateTransformSvg : interpolate;
|
2176 | return this.attrTween(name, typeof value === "function" ? (fullname.local ? attrFunctionNS : attrFunction)(fullname, i, tweenValue(this, "attr." + name, value)) : value == null ? (fullname.local ? attrRemoveNS : attrRemove)(fullname) : (fullname.local ? attrConstantNS : attrConstant)(fullname, i, value));
|
2177 | }
|
2178 | function attrInterpolate(name, i) {
|
2179 | return function(t) {
|
2180 | this.setAttribute(name, i.call(this, t));
|
2181 | };
|
2182 | }
|
2183 | function attrInterpolateNS(fullname, i) {
|
2184 | return function(t) {
|
2185 | this.setAttributeNS(fullname.space, fullname.local, i.call(this, t));
|
2186 | };
|
2187 | }
|
2188 | function attrTweenNS(fullname, value) {
|
2189 | var t0, i0;
|
2190 | function tween() {
|
2191 | var i = value.apply(this, arguments);
|
2192 | if (i !== i0)
|
2193 | t0 = (i0 = i) && attrInterpolateNS(fullname, i);
|
2194 | return t0;
|
2195 | }
|
2196 | tween._value = value;
|
2197 | return tween;
|
2198 | }
|
2199 | function attrTween(name, value) {
|
2200 | var t0, i0;
|
2201 | function tween() {
|
2202 | var i = value.apply(this, arguments);
|
2203 | if (i !== i0)
|
2204 | t0 = (i0 = i) && attrInterpolate(name, i);
|
2205 | return t0;
|
2206 | }
|
2207 | tween._value = value;
|
2208 | return tween;
|
2209 | }
|
2210 | function transition_attrTween(name, value) {
|
2211 | var key = "attr." + name;
|
2212 | if (arguments.length < 2)
|
2213 | return (key = this.tween(key)) && key._value;
|
2214 | if (value == null)
|
2215 | return this.tween(key, null);
|
2216 | if (typeof value !== "function")
|
2217 | throw new Error();
|
2218 | var fullname = namespace(name);
|
2219 | return this.tween(key, (fullname.local ? attrTweenNS : attrTween)(fullname, value));
|
2220 | }
|
2221 | function delayFunction(id2, value) {
|
2222 | return function() {
|
2223 | init$1(this, id2).delay = +value.apply(this, arguments);
|
2224 | };
|
2225 | }
|
2226 | function delayConstant(id2, value) {
|
2227 | return value = +value, function() {
|
2228 | init$1(this, id2).delay = value;
|
2229 | };
|
2230 | }
|
2231 | function transition_delay(value) {
|
2232 | var id2 = this._id;
|
2233 | return arguments.length ? this.each((typeof value === "function" ? delayFunction : delayConstant)(id2, value)) : get(this.node(), id2).delay;
|
2234 | }
|
2235 | function durationFunction(id2, value) {
|
2236 | return function() {
|
2237 | set$1(this, id2).duration = +value.apply(this, arguments);
|
2238 | };
|
2239 | }
|
2240 | function durationConstant(id2, value) {
|
2241 | return value = +value, function() {
|
2242 | set$1(this, id2).duration = value;
|
2243 | };
|
2244 | }
|
2245 | function transition_duration(value) {
|
2246 | var id2 = this._id;
|
2247 | return arguments.length ? this.each((typeof value === "function" ? durationFunction : durationConstant)(id2, value)) : get(this.node(), id2).duration;
|
2248 | }
|
2249 | function easeConstant(id2, value) {
|
2250 | if (typeof value !== "function")
|
2251 | throw new Error();
|
2252 | return function() {
|
2253 | set$1(this, id2).ease = value;
|
2254 | };
|
2255 | }
|
2256 | function transition_ease(value) {
|
2257 | var id2 = this._id;
|
2258 | return arguments.length ? this.each(easeConstant(id2, value)) : get(this.node(), id2).ease;
|
2259 | }
|
2260 | function easeVarying(id2, value) {
|
2261 | return function() {
|
2262 | var v = value.apply(this, arguments);
|
2263 | if (typeof v !== "function")
|
2264 | throw new Error();
|
2265 | set$1(this, id2).ease = v;
|
2266 | };
|
2267 | }
|
2268 | function transition_easeVarying(value) {
|
2269 | if (typeof value !== "function")
|
2270 | throw new Error();
|
2271 | return this.each(easeVarying(this._id, value));
|
2272 | }
|
2273 | function transition_filter(match) {
|
2274 | if (typeof match !== "function")
|
2275 | match = matcher(match);
|
2276 | for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {
|
2277 | for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node2, i = 0; i < n; ++i) {
|
2278 | if ((node2 = group[i]) && match.call(node2, node2.__data__, i, group)) {
|
2279 | subgroup.push(node2);
|
2280 | }
|
2281 | }
|
2282 | }
|
2283 | return new Transition(subgroups, this._parents, this._name, this._id);
|
2284 | }
|
2285 | function transition_merge(transition) {
|
2286 | if (transition._id !== this._id)
|
2287 | throw new Error();
|
2288 | for (var groups0 = this._groups, groups1 = transition._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) {
|
2289 | for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge2 = merges[j] = new Array(n), node2, i = 0; i < n; ++i) {
|
2290 | if (node2 = group0[i] || group1[i]) {
|
2291 | merge2[i] = node2;
|
2292 | }
|
2293 | }
|
2294 | }
|
2295 | for (; j < m0; ++j) {
|
2296 | merges[j] = groups0[j];
|
2297 | }
|
2298 | return new Transition(merges, this._parents, this._name, this._id);
|
2299 | }
|
2300 | function start(name) {
|
2301 | return (name + "").trim().split(/^|\s+/).every(function(t) {
|
2302 | var i = t.indexOf(".");
|
2303 | if (i >= 0)
|
2304 | t = t.slice(0, i);
|
2305 | return !t || t === "start";
|
2306 | });
|
2307 | }
|
2308 | function onFunction(id2, name, listener) {
|
2309 | var on0, on1, sit = start(name) ? init$1 : set$1;
|
2310 | return function() {
|
2311 | var schedule2 = sit(this, id2), on = schedule2.on;
|
2312 | if (on !== on0)
|
2313 | (on1 = (on0 = on).copy()).on(name, listener);
|
2314 | schedule2.on = on1;
|
2315 | };
|
2316 | }
|
2317 | function transition_on(name, listener) {
|
2318 | var id2 = this._id;
|
2319 | return arguments.length < 2 ? get(this.node(), id2).on.on(name) : this.each(onFunction(id2, name, listener));
|
2320 | }
|
2321 | function removeFunction(id2) {
|
2322 | return function() {
|
2323 | var parent = this.parentNode;
|
2324 | for (var i in this.__transition)
|
2325 | if (+i !== id2)
|
2326 | return;
|
2327 | if (parent)
|
2328 | parent.removeChild(this);
|
2329 | };
|
2330 | }
|
2331 | function transition_remove() {
|
2332 | return this.on("end.remove", removeFunction(this._id));
|
2333 | }
|
2334 | function transition_select(select) {
|
2335 | var name = this._name, id2 = this._id;
|
2336 | if (typeof select !== "function")
|
2337 | select = selector(select);
|
2338 | for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {
|
2339 | for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node2, subnode, i = 0; i < n; ++i) {
|
2340 | if ((node2 = group[i]) && (subnode = select.call(node2, node2.__data__, i, group))) {
|
2341 | if ("__data__" in node2)
|
2342 | subnode.__data__ = node2.__data__;
|
2343 | subgroup[i] = subnode;
|
2344 | schedule(subgroup[i], name, id2, i, subgroup, get(node2, id2));
|
2345 | }
|
2346 | }
|
2347 | }
|
2348 | return new Transition(subgroups, this._parents, name, id2);
|
2349 | }
|
2350 | function transition_selectAll(select) {
|
2351 | var name = this._name, id2 = this._id;
|
2352 | if (typeof select !== "function")
|
2353 | select = selectorAll(select);
|
2354 | for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {
|
2355 | for (var group = groups[j], n = group.length, node2, i = 0; i < n; ++i) {
|
2356 | if (node2 = group[i]) {
|
2357 | for (var children2 = select.call(node2, node2.__data__, i, group), child, inherit2 = get(node2, id2), k = 0, l = children2.length; k < l; ++k) {
|
2358 | if (child = children2[k]) {
|
2359 | schedule(child, name, id2, k, children2, inherit2);
|
2360 | }
|
2361 | }
|
2362 | subgroups.push(children2);
|
2363 | parents.push(node2);
|
2364 | }
|
2365 | }
|
2366 | }
|
2367 | return new Transition(subgroups, parents, name, id2);
|
2368 | }
|
2369 | var Selection = selection.prototype.constructor;
|
2370 | function transition_selection() {
|
2371 | return new Selection(this._groups, this._parents);
|
2372 | }
|
2373 | function styleNull(name, interpolate2) {
|
2374 | var string00, string10, interpolate0;
|
2375 | return function() {
|
2376 | var string0 = styleValue(this, name), string1 = (this.style.removeProperty(name), styleValue(this, name));
|
2377 | return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : interpolate0 = interpolate2(string00 = string0, string10 = string1);
|
2378 | };
|
2379 | }
|
2380 | function styleRemove(name) {
|
2381 | return function() {
|
2382 | this.style.removeProperty(name);
|
2383 | };
|
2384 | }
|
2385 | function styleConstant(name, interpolate2, value1) {
|
2386 | var string00, string1 = value1 + "", interpolate0;
|
2387 | return function() {
|
2388 | var string0 = styleValue(this, name);
|
2389 | return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate2(string00 = string0, value1);
|
2390 | };
|
2391 | }
|
2392 | function styleFunction(name, interpolate2, value) {
|
2393 | var string00, string10, interpolate0;
|
2394 | return function() {
|
2395 | var string0 = styleValue(this, name), value1 = value(this), string1 = value1 + "";
|
2396 | if (value1 == null)
|
2397 | string1 = value1 = (this.style.removeProperty(name), styleValue(this, name));
|
2398 | return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate2(string00 = string0, value1));
|
2399 | };
|
2400 | }
|
2401 | function styleMaybeRemove(id2, name) {
|
2402 | var on0, on1, listener0, key = "style." + name, event = "end." + key, remove2;
|
2403 | return function() {
|
2404 | var schedule2 = set$1(this, id2), on = schedule2.on, listener = schedule2.value[key] == null ? remove2 || (remove2 = styleRemove(name)) : void 0;
|
2405 | if (on !== on0 || listener0 !== listener)
|
2406 | (on1 = (on0 = on).copy()).on(event, listener0 = listener);
|
2407 | schedule2.on = on1;
|
2408 | };
|
2409 | }
|
2410 | function transition_style(name, value, priority) {
|
2411 | var i = (name += "") === "transform" ? interpolateTransformCss : interpolate;
|
2412 | return value == null ? this.styleTween(name, styleNull(name, i)).on("end.style." + name, styleRemove(name)) : typeof value === "function" ? this.styleTween(name, styleFunction(name, i, tweenValue(this, "style." + name, value))).each(styleMaybeRemove(this._id, name)) : this.styleTween(name, styleConstant(name, i, value), priority).on("end.style." + name, null);
|
2413 | }
|
2414 | function styleInterpolate(name, i, priority) {
|
2415 | return function(t) {
|
2416 | this.style.setProperty(name, i.call(this, t), priority);
|
2417 | };
|
2418 | }
|
2419 | function styleTween(name, value, priority) {
|
2420 | var t, i0;
|
2421 | function tween() {
|
2422 | var i = value.apply(this, arguments);
|
2423 | if (i !== i0)
|
2424 | t = (i0 = i) && styleInterpolate(name, i, priority);
|
2425 | return t;
|
2426 | }
|
2427 | tween._value = value;
|
2428 | return tween;
|
2429 | }
|
2430 | function transition_styleTween(name, value, priority) {
|
2431 | var key = "style." + (name += "");
|
2432 | if (arguments.length < 2)
|
2433 | return (key = this.tween(key)) && key._value;
|
2434 | if (value == null)
|
2435 | return this.tween(key, null);
|
2436 | if (typeof value !== "function")
|
2437 | throw new Error();
|
2438 | return this.tween(key, styleTween(name, value, priority == null ? "" : priority));
|
2439 | }
|
2440 | function textConstant(value) {
|
2441 | return function() {
|
2442 | this.textContent = value;
|
2443 | };
|
2444 | }
|
2445 | function textFunction(value) {
|
2446 | return function() {
|
2447 | var value1 = value(this);
|
2448 | this.textContent = value1 == null ? "" : value1;
|
2449 | };
|
2450 | }
|
2451 | function transition_text(value) {
|
2452 | return this.tween("text", typeof value === "function" ? textFunction(tweenValue(this, "text", value)) : textConstant(value == null ? "" : value + ""));
|
2453 | }
|
2454 | function textInterpolate(i) {
|
2455 | return function(t) {
|
2456 | this.textContent = i.call(this, t);
|
2457 | };
|
2458 | }
|
2459 | function textTween(value) {
|
2460 | var t0, i0;
|
2461 | function tween() {
|
2462 | var i = value.apply(this, arguments);
|
2463 | if (i !== i0)
|
2464 | t0 = (i0 = i) && textInterpolate(i);
|
2465 | return t0;
|
2466 | }
|
2467 | tween._value = value;
|
2468 | return tween;
|
2469 | }
|
2470 | function transition_textTween(value) {
|
2471 | var key = "text";
|
2472 | if (arguments.length < 1)
|
2473 | return (key = this.tween(key)) && key._value;
|
2474 | if (value == null)
|
2475 | return this.tween(key, null);
|
2476 | if (typeof value !== "function")
|
2477 | throw new Error();
|
2478 | return this.tween(key, textTween(value));
|
2479 | }
|
2480 | function transition_transition() {
|
2481 | var name = this._name, id0 = this._id, id1 = newId();
|
2482 | for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) {
|
2483 | for (var group = groups[j], n = group.length, node2, i = 0; i < n; ++i) {
|
2484 | if (node2 = group[i]) {
|
2485 | var inherit2 = get(node2, id0);
|
2486 | schedule(node2, name, id1, i, group, {
|
2487 | time: inherit2.time + inherit2.delay + inherit2.duration,
|
2488 | delay: 0,
|
2489 | duration: inherit2.duration,
|
2490 | ease: inherit2.ease
|
2491 | });
|
2492 | }
|
2493 | }
|
2494 | }
|
2495 | return new Transition(groups, this._parents, name, id1);
|
2496 | }
|
2497 | function transition_end() {
|
2498 | var on0, on1, that = this, id2 = that._id, size = that.size();
|
2499 | return new Promise(function(resolve, reject) {
|
2500 | var cancel = { value: reject }, end = { value: function() {
|
2501 | if (--size === 0)
|
2502 | resolve();
|
2503 | } };
|
2504 | that.each(function() {
|
2505 | var schedule2 = set$1(this, id2), on = schedule2.on;
|
2506 | if (on !== on0) {
|
2507 | on1 = (on0 = on).copy();
|
2508 | on1._.cancel.push(cancel);
|
2509 | on1._.interrupt.push(cancel);
|
2510 | on1._.end.push(end);
|
2511 | }
|
2512 | schedule2.on = on1;
|
2513 | });
|
2514 | if (size === 0)
|
2515 | resolve();
|
2516 | });
|
2517 | }
|
2518 | var id$m = 0;
|
2519 | function Transition(groups, parents, name, id2) {
|
2520 | this._groups = groups;
|
2521 | this._parents = parents;
|
2522 | this._name = name;
|
2523 | this._id = id2;
|
2524 | }
|
2525 | function newId() {
|
2526 | return ++id$m;
|
2527 | }
|
2528 | var selection_prototype = selection.prototype;
|
2529 | Transition.prototype = {
|
2530 | constructor: Transition,
|
2531 | select: transition_select,
|
2532 | selectAll: transition_selectAll,
|
2533 | selectChild: selection_prototype.selectChild,
|
2534 | selectChildren: selection_prototype.selectChildren,
|
2535 | filter: transition_filter,
|
2536 | merge: transition_merge,
|
2537 | selection: transition_selection,
|
2538 | transition: transition_transition,
|
2539 | call: selection_prototype.call,
|
2540 | nodes: selection_prototype.nodes,
|
2541 | node: selection_prototype.node,
|
2542 | size: selection_prototype.size,
|
2543 | empty: selection_prototype.empty,
|
2544 | each: selection_prototype.each,
|
2545 | on: transition_on,
|
2546 | attr: transition_attr,
|
2547 | attrTween: transition_attrTween,
|
2548 | style: transition_style,
|
2549 | styleTween: transition_styleTween,
|
2550 | text: transition_text,
|
2551 | textTween: transition_textTween,
|
2552 | remove: transition_remove,
|
2553 | tween: transition_tween,
|
2554 | delay: transition_delay,
|
2555 | duration: transition_duration,
|
2556 | ease: transition_ease,
|
2557 | easeVarying: transition_easeVarying,
|
2558 | end: transition_end,
|
2559 | [Symbol.iterator]: selection_prototype[Symbol.iterator]
|
2560 | };
|
2561 | function cubicInOut(t) {
|
2562 | return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2;
|
2563 | }
|
2564 | var defaultTiming = {
|
2565 | time: null,
|
2566 |
|
2567 | delay: 0,
|
2568 | duration: 250,
|
2569 | ease: cubicInOut
|
2570 | };
|
2571 | function inherit(node2, id2) {
|
2572 | var timing;
|
2573 | while (!(timing = node2.__transition) || !(timing = timing[id2])) {
|
2574 | if (!(node2 = node2.parentNode)) {
|
2575 | throw new Error(`transition ${id2} not found`);
|
2576 | }
|
2577 | }
|
2578 | return timing;
|
2579 | }
|
2580 | function selection_transition(name) {
|
2581 | var id2, timing;
|
2582 | if (name instanceof Transition) {
|
2583 | id2 = name._id, name = name._name;
|
2584 | } else {
|
2585 | id2 = newId(), (timing = defaultTiming).time = now(), name = name == null ? null : name + "";
|
2586 | }
|
2587 | for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) {
|
2588 | for (var group = groups[j], n = group.length, node2, i = 0; i < n; ++i) {
|
2589 | if (node2 = group[i]) {
|
2590 | schedule(node2, name, id2, i, group, timing || inherit(node2, id2));
|
2591 | }
|
2592 | }
|
2593 | }
|
2594 | return new Transition(groups, this._parents, name, id2);
|
2595 | }
|
2596 | selection.prototype.interrupt = selection_interrupt;
|
2597 | selection.prototype.transition = selection_transition;
|
2598 | const abs$1 = Math.abs;
|
2599 | const atan2 = Math.atan2;
|
2600 | const cos = Math.cos;
|
2601 | const max = Math.max;
|
2602 | const min = Math.min;
|
2603 | const sin = Math.sin;
|
2604 | const sqrt = Math.sqrt;
|
2605 | const epsilon = 1e-12;
|
2606 | const pi = Math.PI;
|
2607 | const halfPi = pi / 2;
|
2608 | const tau = 2 * pi;
|
2609 | function acos(x) {
|
2610 | return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);
|
2611 | }
|
2612 | function asin(x) {
|
2613 | return x >= 1 ? halfPi : x <= -1 ? -halfPi : Math.asin(x);
|
2614 | }
|
2615 | function Linear(context) {
|
2616 | this._context = context;
|
2617 | }
|
2618 | Linear.prototype = {
|
2619 | areaStart: function() {
|
2620 | this._line = 0;
|
2621 | },
|
2622 | areaEnd: function() {
|
2623 | this._line = NaN;
|
2624 | },
|
2625 | lineStart: function() {
|
2626 | this._point = 0;
|
2627 | },
|
2628 | lineEnd: function() {
|
2629 | if (this._line || this._line !== 0 && this._point === 1)
|
2630 | this._context.closePath();
|
2631 | this._line = 1 - this._line;
|
2632 | },
|
2633 | point: function(x, y) {
|
2634 | x = +x, y = +y;
|
2635 | switch (this._point) {
|
2636 | case 0:
|
2637 | this._point = 1;
|
2638 | this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y);
|
2639 | break;
|
2640 | case 1:
|
2641 | this._point = 2;
|
2642 | default:
|
2643 | this._context.lineTo(x, y);
|
2644 | break;
|
2645 | }
|
2646 | }
|
2647 | };
|
2648 | function curveLinear(context) {
|
2649 | return new Linear(context);
|
2650 | }
|
2651 | class Bump {
|
2652 | constructor(context, x) {
|
2653 | this._context = context;
|
2654 | this._x = x;
|
2655 | }
|
2656 | areaStart() {
|
2657 | this._line = 0;
|
2658 | }
|
2659 | areaEnd() {
|
2660 | this._line = NaN;
|
2661 | }
|
2662 | lineStart() {
|
2663 | this._point = 0;
|
2664 | }
|
2665 | lineEnd() {
|
2666 | if (this._line || this._line !== 0 && this._point === 1)
|
2667 | this._context.closePath();
|
2668 | this._line = 1 - this._line;
|
2669 | }
|
2670 | point(x, y) {
|
2671 | x = +x, y = +y;
|
2672 | switch (this._point) {
|
2673 | case 0: {
|
2674 | this._point = 1;
|
2675 | if (this._line)
|
2676 | this._context.lineTo(x, y);
|
2677 | else
|
2678 | this._context.moveTo(x, y);
|
2679 | break;
|
2680 | }
|
2681 | case 1:
|
2682 | this._point = 2;
|
2683 | default: {
|
2684 | if (this._x)
|
2685 | this._context.bezierCurveTo(this._x0 = (this._x0 + x) / 2, this._y0, this._x0, y, x, y);
|
2686 | else
|
2687 | this._context.bezierCurveTo(this._x0, this._y0 = (this._y0 + y) / 2, x, this._y0, x, y);
|
2688 | break;
|
2689 | }
|
2690 | }
|
2691 | this._x0 = x, this._y0 = y;
|
2692 | }
|
2693 | }
|
2694 | function bumpX(context) {
|
2695 | return new Bump(context, true);
|
2696 | }
|
2697 | function bumpY(context) {
|
2698 | return new Bump(context, false);
|
2699 | }
|
2700 | function noop() {
|
2701 | }
|
2702 | function point$3(that, x, y) {
|
2703 | that._context.bezierCurveTo(
|
2704 | (2 * that._x0 + that._x1) / 3,
|
2705 | (2 * that._y0 + that._y1) / 3,
|
2706 | (that._x0 + 2 * that._x1) / 3,
|
2707 | (that._y0 + 2 * that._y1) / 3,
|
2708 | (that._x0 + 4 * that._x1 + x) / 6,
|
2709 | (that._y0 + 4 * that._y1 + y) / 6
|
2710 | );
|
2711 | }
|
2712 | function Basis(context) {
|
2713 | this._context = context;
|
2714 | }
|
2715 | Basis.prototype = {
|
2716 | areaStart: function() {
|
2717 | this._line = 0;
|
2718 | },
|
2719 | areaEnd: function() {
|
2720 | this._line = NaN;
|
2721 | },
|
2722 | lineStart: function() {
|
2723 | this._x0 = this._x1 = this._y0 = this._y1 = NaN;
|
2724 | this._point = 0;
|
2725 | },
|
2726 | lineEnd: function() {
|
2727 | switch (this._point) {
|
2728 | case 3:
|
2729 | point$3(this, this._x1, this._y1);
|
2730 | case 2:
|
2731 | this._context.lineTo(this._x1, this._y1);
|
2732 | break;
|
2733 | }
|
2734 | if (this._line || this._line !== 0 && this._point === 1)
|
2735 | this._context.closePath();
|
2736 | this._line = 1 - this._line;
|
2737 | },
|
2738 | point: function(x, y) {
|
2739 | x = +x, y = +y;
|
2740 | switch (this._point) {
|
2741 | case 0:
|
2742 | this._point = 1;
|
2743 | this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y);
|
2744 | break;
|
2745 | case 1:
|
2746 | this._point = 2;
|
2747 | break;
|
2748 | case 2:
|
2749 | this._point = 3;
|
2750 | this._context.lineTo((5 * this._x0 + this._x1) / 6, (5 * this._y0 + this._y1) / 6);
|
2751 | default:
|
2752 | point$3(this, x, y);
|
2753 | break;
|
2754 | }
|
2755 | this._x0 = this._x1, this._x1 = x;
|
2756 | this._y0 = this._y1, this._y1 = y;
|
2757 | }
|
2758 | };
|
2759 | function curveBasis(context) {
|
2760 | return new Basis(context);
|
2761 | }
|
2762 | function BasisClosed(context) {
|
2763 | this._context = context;
|
2764 | }
|
2765 | BasisClosed.prototype = {
|
2766 | areaStart: noop,
|
2767 | areaEnd: noop,
|
2768 | lineStart: function() {
|
2769 | this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = NaN;
|
2770 | this._point = 0;
|
2771 | },
|
2772 | lineEnd: function() {
|
2773 | switch (this._point) {
|
2774 | case 1: {
|
2775 | this._context.moveTo(this._x2, this._y2);
|
2776 | this._context.closePath();
|
2777 | break;
|
2778 | }
|
2779 | case 2: {
|
2780 | this._context.moveTo((this._x2 + 2 * this._x3) / 3, (this._y2 + 2 * this._y3) / 3);
|
2781 | this._context.lineTo((this._x3 + 2 * this._x2) / 3, (this._y3 + 2 * this._y2) / 3);
|
2782 | this._context.closePath();
|
2783 | break;
|
2784 | }
|
2785 | case 3: {
|
2786 | this.point(this._x2, this._y2);
|
2787 | this.point(this._x3, this._y3);
|
2788 | this.point(this._x4, this._y4);
|
2789 | break;
|
2790 | }
|
2791 | }
|
2792 | },
|
2793 | point: function(x, y) {
|
2794 | x = +x, y = +y;
|
2795 | switch (this._point) {
|
2796 | case 0:
|
2797 | this._point = 1;
|
2798 | this._x2 = x, this._y2 = y;
|
2799 | break;
|
2800 | case 1:
|
2801 | this._point = 2;
|
2802 | this._x3 = x, this._y3 = y;
|
2803 | break;
|
2804 | case 2:
|
2805 | this._point = 3;
|
2806 | this._x4 = x, this._y4 = y;
|
2807 | this._context.moveTo((this._x0 + 4 * this._x1 + x) / 6, (this._y0 + 4 * this._y1 + y) / 6);
|
2808 | break;
|
2809 | default:
|
2810 | point$3(this, x, y);
|
2811 | break;
|
2812 | }
|
2813 | this._x0 = this._x1, this._x1 = x;
|
2814 | this._y0 = this._y1, this._y1 = y;
|
2815 | }
|
2816 | };
|
2817 | function curveBasisClosed(context) {
|
2818 | return new BasisClosed(context);
|
2819 | }
|
2820 | function BasisOpen(context) {
|
2821 | this._context = context;
|
2822 | }
|
2823 | BasisOpen.prototype = {
|
2824 | areaStart: function() {
|
2825 | this._line = 0;
|
2826 | },
|
2827 | areaEnd: function() {
|
2828 | this._line = NaN;
|
2829 | },
|
2830 | lineStart: function() {
|
2831 | this._x0 = this._x1 = this._y0 = this._y1 = NaN;
|
2832 | this._point = 0;
|
2833 | },
|
2834 | lineEnd: function() {
|
2835 | if (this._line || this._line !== 0 && this._point === 3)
|
2836 | this._context.closePath();
|
2837 | this._line = 1 - this._line;
|
2838 | },
|
2839 | point: function(x, y) {
|
2840 | x = +x, y = +y;
|
2841 | switch (this._point) {
|
2842 | case 0:
|
2843 | this._point = 1;
|
2844 | break;
|
2845 | case 1:
|
2846 | this._point = 2;
|
2847 | break;
|
2848 | case 2:
|
2849 | this._point = 3;
|
2850 | var x0 = (this._x0 + 4 * this._x1 + x) / 6, y0 = (this._y0 + 4 * this._y1 + y) / 6;
|
2851 | this._line ? this._context.lineTo(x0, y0) : this._context.moveTo(x0, y0);
|
2852 | break;
|
2853 | case 3:
|
2854 | this._point = 4;
|
2855 | default:
|
2856 | point$3(this, x, y);
|
2857 | break;
|
2858 | }
|
2859 | this._x0 = this._x1, this._x1 = x;
|
2860 | this._y0 = this._y1, this._y1 = y;
|
2861 | }
|
2862 | };
|
2863 | function curveBasisOpen(context) {
|
2864 | return new BasisOpen(context);
|
2865 | }
|
2866 | function Bundle(context, beta) {
|
2867 | this._basis = new Basis(context);
|
2868 | this._beta = beta;
|
2869 | }
|
2870 | Bundle.prototype = {
|
2871 | lineStart: function() {
|
2872 | this._x = [];
|
2873 | this._y = [];
|
2874 | this._basis.lineStart();
|
2875 | },
|
2876 | lineEnd: function() {
|
2877 | var x = this._x, y = this._y, j = x.length - 1;
|
2878 | if (j > 0) {
|
2879 | var x0 = x[0], y0 = y[0], dx = x[j] - x0, dy = y[j] - y0, i = -1, t;
|
2880 | while (++i <= j) {
|
2881 | t = i / j;
|
2882 | this._basis.point(
|
2883 | this._beta * x[i] + (1 - this._beta) * (x0 + t * dx),
|
2884 | this._beta * y[i] + (1 - this._beta) * (y0 + t * dy)
|
2885 | );
|
2886 | }
|
2887 | }
|
2888 | this._x = this._y = null;
|
2889 | this._basis.lineEnd();
|
2890 | },
|
2891 | point: function(x, y) {
|
2892 | this._x.push(+x);
|
2893 | this._y.push(+y);
|
2894 | }
|
2895 | };
|
2896 | const curveBundle = function custom(beta) {
|
2897 | function bundle(context) {
|
2898 | return beta === 1 ? new Basis(context) : new Bundle(context, beta);
|
2899 | }
|
2900 | bundle.beta = function(beta2) {
|
2901 | return custom(+beta2);
|
2902 | };
|
2903 | return bundle;
|
2904 | }(0.85);
|
2905 | function point$2(that, x, y) {
|
2906 | that._context.bezierCurveTo(
|
2907 | that._x1 + that._k * (that._x2 - that._x0),
|
2908 | that._y1 + that._k * (that._y2 - that._y0),
|
2909 | that._x2 + that._k * (that._x1 - x),
|
2910 | that._y2 + that._k * (that._y1 - y),
|
2911 | that._x2,
|
2912 | that._y2
|
2913 | );
|
2914 | }
|
2915 | function Cardinal(context, tension) {
|
2916 | this._context = context;
|
2917 | this._k = (1 - tension) / 6;
|
2918 | }
|
2919 | Cardinal.prototype = {
|
2920 | areaStart: function() {
|
2921 | this._line = 0;
|
2922 | },
|
2923 | areaEnd: function() {
|
2924 | this._line = NaN;
|
2925 | },
|
2926 | lineStart: function() {
|
2927 | this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN;
|
2928 | this._point = 0;
|
2929 | },
|
2930 | lineEnd: function() {
|
2931 | switch (this._point) {
|
2932 | case 2:
|
2933 | this._context.lineTo(this._x2, this._y2);
|
2934 | break;
|
2935 | case 3:
|
2936 | point$2(this, this._x1, this._y1);
|
2937 | break;
|
2938 | }
|
2939 | if (this._line || this._line !== 0 && this._point === 1)
|
2940 | this._context.closePath();
|
2941 | this._line = 1 - this._line;
|
2942 | },
|
2943 | point: function(x, y) {
|
2944 | x = +x, y = +y;
|
2945 | switch (this._point) {
|
2946 | case 0:
|
2947 | this._point = 1;
|
2948 | this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y);
|
2949 | break;
|
2950 | case 1:
|
2951 | this._point = 2;
|
2952 | this._x1 = x, this._y1 = y;
|
2953 | break;
|
2954 | case 2:
|
2955 | this._point = 3;
|
2956 | default:
|
2957 | point$2(this, x, y);
|
2958 | break;
|
2959 | }
|
2960 | this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
|
2961 | this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
|
2962 | }
|
2963 | };
|
2964 | const curveCardinal = function custom2(tension) {
|
2965 | function cardinal(context) {
|
2966 | return new Cardinal(context, tension);
|
2967 | }
|
2968 | cardinal.tension = function(tension2) {
|
2969 | return custom2(+tension2);
|
2970 | };
|
2971 | return cardinal;
|
2972 | }(0);
|
2973 | function CardinalClosed(context, tension) {
|
2974 | this._context = context;
|
2975 | this._k = (1 - tension) / 6;
|
2976 | }
|
2977 | CardinalClosed.prototype = {
|
2978 | areaStart: noop,
|
2979 | areaEnd: noop,
|
2980 | lineStart: function() {
|
2981 | this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN;
|
2982 | this._point = 0;
|
2983 | },
|
2984 | lineEnd: function() {
|
2985 | switch (this._point) {
|
2986 | case 1: {
|
2987 | this._context.moveTo(this._x3, this._y3);
|
2988 | this._context.closePath();
|
2989 | break;
|
2990 | }
|
2991 | case 2: {
|
2992 | this._context.lineTo(this._x3, this._y3);
|
2993 | this._context.closePath();
|
2994 | break;
|
2995 | }
|
2996 | case 3: {
|
2997 | this.point(this._x3, this._y3);
|
2998 | this.point(this._x4, this._y4);
|
2999 | this.point(this._x5, this._y5);
|
3000 | break;
|
3001 | }
|
3002 | }
|
3003 | },
|
3004 | point: function(x, y) {
|
3005 | x = +x, y = +y;
|
3006 | switch (this._point) {
|
3007 | case 0:
|
3008 | this._point = 1;
|
3009 | this._x3 = x, this._y3 = y;
|
3010 | break;
|
3011 | case 1:
|
3012 | this._point = 2;
|
3013 | this._context.moveTo(this._x4 = x, this._y4 = y);
|
3014 | break;
|
3015 | case 2:
|
3016 | this._point = 3;
|
3017 | this._x5 = x, this._y5 = y;
|
3018 | break;
|
3019 | default:
|
3020 | point$2(this, x, y);
|
3021 | break;
|
3022 | }
|
3023 | this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
|
3024 | this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
|
3025 | }
|
3026 | };
|
3027 | const curveCardinalClosed = function custom3(tension) {
|
3028 | function cardinal(context) {
|
3029 | return new CardinalClosed(context, tension);
|
3030 | }
|
3031 | cardinal.tension = function(tension2) {
|
3032 | return custom3(+tension2);
|
3033 | };
|
3034 | return cardinal;
|
3035 | }(0);
|
3036 | function CardinalOpen(context, tension) {
|
3037 | this._context = context;
|
3038 | this._k = (1 - tension) / 6;
|
3039 | }
|
3040 | CardinalOpen.prototype = {
|
3041 | areaStart: function() {
|
3042 | this._line = 0;
|
3043 | },
|
3044 | areaEnd: function() {
|
3045 | this._line = NaN;
|
3046 | },
|
3047 | lineStart: function() {
|
3048 | this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN;
|
3049 | this._point = 0;
|
3050 | },
|
3051 | lineEnd: function() {
|
3052 | if (this._line || this._line !== 0 && this._point === 3)
|
3053 | this._context.closePath();
|
3054 | this._line = 1 - this._line;
|
3055 | },
|
3056 | point: function(x, y) {
|
3057 | x = +x, y = +y;
|
3058 | switch (this._point) {
|
3059 | case 0:
|
3060 | this._point = 1;
|
3061 | break;
|
3062 | case 1:
|
3063 | this._point = 2;
|
3064 | break;
|
3065 | case 2:
|
3066 | this._point = 3;
|
3067 | this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2);
|
3068 | break;
|
3069 | case 3:
|
3070 | this._point = 4;
|
3071 | default:
|
3072 | point$2(this, x, y);
|
3073 | break;
|
3074 | }
|
3075 | this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
|
3076 | this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
|
3077 | }
|
3078 | };
|
3079 | const curveCardinalOpen = function custom4(tension) {
|
3080 | function cardinal(context) {
|
3081 | return new CardinalOpen(context, tension);
|
3082 | }
|
3083 | cardinal.tension = function(tension2) {
|
3084 | return custom4(+tension2);
|
3085 | };
|
3086 | return cardinal;
|
3087 | }(0);
|
3088 | function point$1(that, x, y) {
|
3089 | var x1 = that._x1, y1 = that._y1, x2 = that._x2, y2 = that._y2;
|
3090 | if (that._l01_a > epsilon) {
|
3091 | var a = 2 * that._l01_2a + 3 * that._l01_a * that._l12_a + that._l12_2a, n = 3 * that._l01_a * (that._l01_a + that._l12_a);
|
3092 | x1 = (x1 * a - that._x0 * that._l12_2a + that._x2 * that._l01_2a) / n;
|
3093 | y1 = (y1 * a - that._y0 * that._l12_2a + that._y2 * that._l01_2a) / n;
|
3094 | }
|
3095 | if (that._l23_a > epsilon) {
|
3096 | var b = 2 * that._l23_2a + 3 * that._l23_a * that._l12_a + that._l12_2a, m = 3 * that._l23_a * (that._l23_a + that._l12_a);
|
3097 | x2 = (x2 * b + that._x1 * that._l23_2a - x * that._l12_2a) / m;
|
3098 | y2 = (y2 * b + that._y1 * that._l23_2a - y * that._l12_2a) / m;
|
3099 | }
|
3100 | that._context.bezierCurveTo(x1, y1, x2, y2, that._x2, that._y2);
|
3101 | }
|
3102 | function CatmullRom(context, alpha) {
|
3103 | this._context = context;
|
3104 | this._alpha = alpha;
|
3105 | }
|
3106 | CatmullRom.prototype = {
|
3107 | areaStart: function() {
|
3108 | this._line = 0;
|
3109 | },
|
3110 | areaEnd: function() {
|
3111 | this._line = NaN;
|
3112 | },
|
3113 | lineStart: function() {
|
3114 | this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN;
|
3115 | this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0;
|
3116 | },
|
3117 | lineEnd: function() {
|
3118 | switch (this._point) {
|
3119 | case 2:
|
3120 | this._context.lineTo(this._x2, this._y2);
|
3121 | break;
|
3122 | case 3:
|
3123 | this.point(this._x2, this._y2);
|
3124 | break;
|
3125 | }
|
3126 | if (this._line || this._line !== 0 && this._point === 1)
|
3127 | this._context.closePath();
|
3128 | this._line = 1 - this._line;
|
3129 | },
|
3130 | point: function(x, y) {
|
3131 | x = +x, y = +y;
|
3132 | if (this._point) {
|
3133 | var x23 = this._x2 - x, y23 = this._y2 - y;
|
3134 | this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));
|
3135 | }
|
3136 | switch (this._point) {
|
3137 | case 0:
|
3138 | this._point = 1;
|
3139 | this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y);
|
3140 | break;
|
3141 | case 1:
|
3142 | this._point = 2;
|
3143 | break;
|
3144 | case 2:
|
3145 | this._point = 3;
|
3146 | default:
|
3147 | point$1(this, x, y);
|
3148 | break;
|
3149 | }
|
3150 | this._l01_a = this._l12_a, this._l12_a = this._l23_a;
|
3151 | this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;
|
3152 | this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
|
3153 | this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
|
3154 | }
|
3155 | };
|
3156 | const curveCatmullRom = function custom5(alpha) {
|
3157 | function catmullRom(context) {
|
3158 | return alpha ? new CatmullRom(context, alpha) : new Cardinal(context, 0);
|
3159 | }
|
3160 | catmullRom.alpha = function(alpha2) {
|
3161 | return custom5(+alpha2);
|
3162 | };
|
3163 | return catmullRom;
|
3164 | }(0.5);
|
3165 | function CatmullRomClosed(context, alpha) {
|
3166 | this._context = context;
|
3167 | this._alpha = alpha;
|
3168 | }
|
3169 | CatmullRomClosed.prototype = {
|
3170 | areaStart: noop,
|
3171 | areaEnd: noop,
|
3172 | lineStart: function() {
|
3173 | this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN;
|
3174 | this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0;
|
3175 | },
|
3176 | lineEnd: function() {
|
3177 | switch (this._point) {
|
3178 | case 1: {
|
3179 | this._context.moveTo(this._x3, this._y3);
|
3180 | this._context.closePath();
|
3181 | break;
|
3182 | }
|
3183 | case 2: {
|
3184 | this._context.lineTo(this._x3, this._y3);
|
3185 | this._context.closePath();
|
3186 | break;
|
3187 | }
|
3188 | case 3: {
|
3189 | this.point(this._x3, this._y3);
|
3190 | this.point(this._x4, this._y4);
|
3191 | this.point(this._x5, this._y5);
|
3192 | break;
|
3193 | }
|
3194 | }
|
3195 | },
|
3196 | point: function(x, y) {
|
3197 | x = +x, y = +y;
|
3198 | if (this._point) {
|
3199 | var x23 = this._x2 - x, y23 = this._y2 - y;
|
3200 | this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));
|
3201 | }
|
3202 | switch (this._point) {
|
3203 | case 0:
|
3204 | this._point = 1;
|
3205 | this._x3 = x, this._y3 = y;
|
3206 | break;
|
3207 | case 1:
|
3208 | this._point = 2;
|
3209 | this._context.moveTo(this._x4 = x, this._y4 = y);
|
3210 | break;
|
3211 | case 2:
|
3212 | this._point = 3;
|
3213 | this._x5 = x, this._y5 = y;
|
3214 | break;
|
3215 | default:
|
3216 | point$1(this, x, y);
|
3217 | break;
|
3218 | }
|
3219 | this._l01_a = this._l12_a, this._l12_a = this._l23_a;
|
3220 | this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;
|
3221 | this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
|
3222 | this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
|
3223 | }
|
3224 | };
|
3225 | const curveCatmullRomClosed = function custom6(alpha) {
|
3226 | function catmullRom(context) {
|
3227 | return alpha ? new CatmullRomClosed(context, alpha) : new CardinalClosed(context, 0);
|
3228 | }
|
3229 | catmullRom.alpha = function(alpha2) {
|
3230 | return custom6(+alpha2);
|
3231 | };
|
3232 | return catmullRom;
|
3233 | }(0.5);
|
3234 | function CatmullRomOpen(context, alpha) {
|
3235 | this._context = context;
|
3236 | this._alpha = alpha;
|
3237 | }
|
3238 | CatmullRomOpen.prototype = {
|
3239 | areaStart: function() {
|
3240 | this._line = 0;
|
3241 | },
|
3242 | areaEnd: function() {
|
3243 | this._line = NaN;
|
3244 | },
|
3245 | lineStart: function() {
|
3246 | this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN;
|
3247 | this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0;
|
3248 | },
|
3249 | lineEnd: function() {
|
3250 | if (this._line || this._line !== 0 && this._point === 3)
|
3251 | this._context.closePath();
|
3252 | this._line = 1 - this._line;
|
3253 | },
|
3254 | point: function(x, y) {
|
3255 | x = +x, y = +y;
|
3256 | if (this._point) {
|
3257 | var x23 = this._x2 - x, y23 = this._y2 - y;
|
3258 | this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));
|
3259 | }
|
3260 | switch (this._point) {
|
3261 | case 0:
|
3262 | this._point = 1;
|
3263 | break;
|
3264 | case 1:
|
3265 | this._point = 2;
|
3266 | break;
|
3267 | case 2:
|
3268 | this._point = 3;
|
3269 | this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2);
|
3270 | break;
|
3271 | case 3:
|
3272 | this._point = 4;
|
3273 | default:
|
3274 | point$1(this, x, y);
|
3275 | break;
|
3276 | }
|
3277 | this._l01_a = this._l12_a, this._l12_a = this._l23_a;
|
3278 | this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;
|
3279 | this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
|
3280 | this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
|
3281 | }
|
3282 | };
|
3283 | const curveCatmullRomOpen = function custom7(alpha) {
|
3284 | function catmullRom(context) {
|
3285 | return alpha ? new CatmullRomOpen(context, alpha) : new CardinalOpen(context, 0);
|
3286 | }
|
3287 | catmullRom.alpha = function(alpha2) {
|
3288 | return custom7(+alpha2);
|
3289 | };
|
3290 | return catmullRom;
|
3291 | }(0.5);
|
3292 | function LinearClosed(context) {
|
3293 | this._context = context;
|
3294 | }
|
3295 | LinearClosed.prototype = {
|
3296 | areaStart: noop,
|
3297 | areaEnd: noop,
|
3298 | lineStart: function() {
|
3299 | this._point = 0;
|
3300 | },
|
3301 | lineEnd: function() {
|
3302 | if (this._point)
|
3303 | this._context.closePath();
|
3304 | },
|
3305 | point: function(x, y) {
|
3306 | x = +x, y = +y;
|
3307 | if (this._point)
|
3308 | this._context.lineTo(x, y);
|
3309 | else
|
3310 | this._point = 1, this._context.moveTo(x, y);
|
3311 | }
|
3312 | };
|
3313 | function curveLinearClosed(context) {
|
3314 | return new LinearClosed(context);
|
3315 | }
|
3316 | function sign(x) {
|
3317 | return x < 0 ? -1 : 1;
|
3318 | }
|
3319 | function slope3(that, x2, y2) {
|
3320 | var h0 = that._x1 - that._x0, h1 = x2 - that._x1, s0 = (that._y1 - that._y0) / (h0 || h1 < 0 && -0), s1 = (y2 - that._y1) / (h1 || h0 < 0 && -0), p = (s0 * h1 + s1 * h0) / (h0 + h1);
|
3321 | return (sign(s0) + sign(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p)) || 0;
|
3322 | }
|
3323 | function slope2(that, t) {
|
3324 | var h = that._x1 - that._x0;
|
3325 | return h ? (3 * (that._y1 - that._y0) / h - t) / 2 : t;
|
3326 | }
|
3327 | function point(that, t0, t1) {
|
3328 | var x0 = that._x0, y0 = that._y0, x1 = that._x1, y1 = that._y1, dx = (x1 - x0) / 3;
|
3329 | that._context.bezierCurveTo(x0 + dx, y0 + dx * t0, x1 - dx, y1 - dx * t1, x1, y1);
|
3330 | }
|
3331 | function MonotoneX(context) {
|
3332 | this._context = context;
|
3333 | }
|
3334 | MonotoneX.prototype = {
|
3335 | areaStart: function() {
|
3336 | this._line = 0;
|
3337 | },
|
3338 | areaEnd: function() {
|
3339 | this._line = NaN;
|
3340 | },
|
3341 | lineStart: function() {
|
3342 | this._x0 = this._x1 = this._y0 = this._y1 = this._t0 = NaN;
|
3343 | this._point = 0;
|
3344 | },
|
3345 | lineEnd: function() {
|
3346 | switch (this._point) {
|
3347 | case 2:
|
3348 | this._context.lineTo(this._x1, this._y1);
|
3349 | break;
|
3350 | case 3:
|
3351 | point(this, this._t0, slope2(this, this._t0));
|
3352 | break;
|
3353 | }
|
3354 | if (this._line || this._line !== 0 && this._point === 1)
|
3355 | this._context.closePath();
|
3356 | this._line = 1 - this._line;
|
3357 | },
|
3358 | point: function(x, y) {
|
3359 | var t1 = NaN;
|
3360 | x = +x, y = +y;
|
3361 | if (x === this._x1 && y === this._y1)
|
3362 | return;
|
3363 | switch (this._point) {
|
3364 | case 0:
|
3365 | this._point = 1;
|
3366 | this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y);
|
3367 | break;
|
3368 | case 1:
|
3369 | this._point = 2;
|
3370 | break;
|
3371 | case 2:
|
3372 | this._point = 3;
|
3373 | point(this, slope2(this, t1 = slope3(this, x, y)), t1);
|
3374 | break;
|
3375 | default:
|
3376 | point(this, this._t0, t1 = slope3(this, x, y));
|
3377 | break;
|
3378 | }
|
3379 | this._x0 = this._x1, this._x1 = x;
|
3380 | this._y0 = this._y1, this._y1 = y;
|
3381 | this._t0 = t1;
|
3382 | }
|
3383 | };
|
3384 | function MonotoneY(context) {
|
3385 | this._context = new ReflectContext(context);
|
3386 | }
|
3387 | (MonotoneY.prototype = Object.create(MonotoneX.prototype)).point = function(x, y) {
|
3388 | MonotoneX.prototype.point.call(this, y, x);
|
3389 | };
|
3390 | function ReflectContext(context) {
|
3391 | this._context = context;
|
3392 | }
|
3393 | ReflectContext.prototype = {
|
3394 | moveTo: function(x, y) {
|
3395 | this._context.moveTo(y, x);
|
3396 | },
|
3397 | closePath: function() {
|
3398 | this._context.closePath();
|
3399 | },
|
3400 | lineTo: function(x, y) {
|
3401 | this._context.lineTo(y, x);
|
3402 | },
|
3403 | bezierCurveTo: function(x1, y1, x2, y2, x, y) {
|
3404 | this._context.bezierCurveTo(y1, x1, y2, x2, y, x);
|
3405 | }
|
3406 | };
|
3407 | function monotoneX(context) {
|
3408 | return new MonotoneX(context);
|
3409 | }
|
3410 | function monotoneY(context) {
|
3411 | return new MonotoneY(context);
|
3412 | }
|
3413 | function Natural(context) {
|
3414 | this._context = context;
|
3415 | }
|
3416 | Natural.prototype = {
|
3417 | areaStart: function() {
|
3418 | this._line = 0;
|
3419 | },
|
3420 | areaEnd: function() {
|
3421 | this._line = NaN;
|
3422 | },
|
3423 | lineStart: function() {
|
3424 | this._x = [];
|
3425 | this._y = [];
|
3426 | },
|
3427 | lineEnd: function() {
|
3428 | var x = this._x, y = this._y, n = x.length;
|
3429 | if (n) {
|
3430 | this._line ? this._context.lineTo(x[0], y[0]) : this._context.moveTo(x[0], y[0]);
|
3431 | if (n === 2) {
|
3432 | this._context.lineTo(x[1], y[1]);
|
3433 | } else {
|
3434 | var px = controlPoints(x), py = controlPoints(y);
|
3435 | for (var i0 = 0, i1 = 1; i1 < n; ++i0, ++i1) {
|
3436 | this._context.bezierCurveTo(px[0][i0], py[0][i0], px[1][i0], py[1][i0], x[i1], y[i1]);
|
3437 | }
|
3438 | }
|
3439 | }
|
3440 | if (this._line || this._line !== 0 && n === 1)
|
3441 | this._context.closePath();
|
3442 | this._line = 1 - this._line;
|
3443 | this._x = this._y = null;
|
3444 | },
|
3445 | point: function(x, y) {
|
3446 | this._x.push(+x);
|
3447 | this._y.push(+y);
|
3448 | }
|
3449 | };
|
3450 | function controlPoints(x) {
|
3451 | var i, n = x.length - 1, m, a = new Array(n), b = new Array(n), r = new Array(n);
|
3452 | a[0] = 0, b[0] = 2, r[0] = x[0] + 2 * x[1];
|
3453 | for (i = 1; i < n - 1; ++i)
|
3454 | a[i] = 1, b[i] = 4, r[i] = 4 * x[i] + 2 * x[i + 1];
|
3455 | a[n - 1] = 2, b[n - 1] = 7, r[n - 1] = 8 * x[n - 1] + x[n];
|
3456 | for (i = 1; i < n; ++i)
|
3457 | m = a[i] / b[i - 1], b[i] -= m, r[i] -= m * r[i - 1];
|
3458 | a[n - 1] = r[n - 1] / b[n - 1];
|
3459 | for (i = n - 2; i >= 0; --i)
|
3460 | a[i] = (r[i] - a[i + 1]) / b[i];
|
3461 | b[n - 1] = (x[n] + a[n - 1]) / 2;
|
3462 | for (i = 0; i < n - 1; ++i)
|
3463 | b[i] = 2 * x[i + 1] - a[i + 1];
|
3464 | return [a, b];
|
3465 | }
|
3466 | function curveNatural(context) {
|
3467 | return new Natural(context);
|
3468 | }
|
3469 | function Step(context, t) {
|
3470 | this._context = context;
|
3471 | this._t = t;
|
3472 | }
|
3473 | Step.prototype = {
|
3474 | areaStart: function() {
|
3475 | this._line = 0;
|
3476 | },
|
3477 | areaEnd: function() {
|
3478 | this._line = NaN;
|
3479 | },
|
3480 | lineStart: function() {
|
3481 | this._x = this._y = NaN;
|
3482 | this._point = 0;
|
3483 | },
|
3484 | lineEnd: function() {
|
3485 | if (0 < this._t && this._t < 1 && this._point === 2)
|
3486 | this._context.lineTo(this._x, this._y);
|
3487 | if (this._line || this._line !== 0 && this._point === 1)
|
3488 | this._context.closePath();
|
3489 | if (this._line >= 0)
|
3490 | this._t = 1 - this._t, this._line = 1 - this._line;
|
3491 | },
|
3492 | point: function(x, y) {
|
3493 | x = +x, y = +y;
|
3494 | switch (this._point) {
|
3495 | case 0:
|
3496 | this._point = 1;
|
3497 | this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y);
|
3498 | break;
|
3499 | case 1:
|
3500 | this._point = 2;
|
3501 | default: {
|
3502 | if (this._t <= 0) {
|
3503 | this._context.lineTo(this._x, y);
|
3504 | this._context.lineTo(x, y);
|
3505 | } else {
|
3506 | var x1 = this._x * (1 - this._t) + x * this._t;
|
3507 | this._context.lineTo(x1, this._y);
|
3508 | this._context.lineTo(x1, y);
|
3509 | }
|
3510 | break;
|
3511 | }
|
3512 | }
|
3513 | this._x = x, this._y = y;
|
3514 | }
|
3515 | };
|
3516 | function curveStep(context) {
|
3517 | return new Step(context, 0.5);
|
3518 | }
|
3519 | function stepBefore(context) {
|
3520 | return new Step(context, 0);
|
3521 | }
|
3522 | function stepAfter(context) {
|
3523 | return new Step(context, 1);
|
3524 | }
|
3525 | function Transform(k, x, y) {
|
3526 | this.k = k;
|
3527 | this.x = x;
|
3528 | this.y = y;
|
3529 | }
|
3530 | Transform.prototype = {
|
3531 | constructor: Transform,
|
3532 | scale: function(k) {
|
3533 | return k === 1 ? this : new Transform(this.k * k, this.x, this.y);
|
3534 | },
|
3535 | translate: function(x, y) {
|
3536 | return x === 0 & y === 0 ? this : new Transform(this.k, this.x + this.k * x, this.y + this.k * y);
|
3537 | },
|
3538 | apply: function(point2) {
|
3539 | return [point2[0] * this.k + this.x, point2[1] * this.k + this.y];
|
3540 | },
|
3541 | applyX: function(x) {
|
3542 | return x * this.k + this.x;
|
3543 | },
|
3544 | applyY: function(y) {
|
3545 | return y * this.k + this.y;
|
3546 | },
|
3547 | invert: function(location) {
|
3548 | return [(location[0] - this.x) / this.k, (location[1] - this.y) / this.k];
|
3549 | },
|
3550 | invertX: function(x) {
|
3551 | return (x - this.x) / this.k;
|
3552 | },
|
3553 | invertY: function(y) {
|
3554 | return (y - this.y) / this.k;
|
3555 | },
|
3556 | rescaleX: function(x) {
|
3557 | return x.copy().domain(x.range().map(this.invertX, this).map(x.invert, x));
|
3558 | },
|
3559 | rescaleY: function(y) {
|
3560 | return y.copy().domain(y.range().map(this.invertY, this).map(y.invert, y));
|
3561 | },
|
3562 | toString: function() {
|
3563 | return "translate(" + this.x + "," + this.y + ") scale(" + this.k + ")";
|
3564 | }
|
3565 | };
|
3566 | Transform.prototype;
|
3567 |
|
3568 | const {
|
3569 | entries,
|
3570 | setPrototypeOf,
|
3571 | isFrozen,
|
3572 | getPrototypeOf,
|
3573 | getOwnPropertyDescriptor
|
3574 | } = Object;
|
3575 | let {
|
3576 | freeze,
|
3577 | seal,
|
3578 | create
|
3579 | } = Object;
|
3580 | let {
|
3581 | apply: apply$1,
|
3582 | construct
|
3583 | } = typeof Reflect !== "undefined" && Reflect;
|
3584 | if (!freeze) {
|
3585 | freeze = function freeze2(x) {
|
3586 | return x;
|
3587 | };
|
3588 | }
|
3589 | if (!seal) {
|
3590 | seal = function seal2(x) {
|
3591 | return x;
|
3592 | };
|
3593 | }
|
3594 | if (!apply$1) {
|
3595 | apply$1 = function apply2(fun, thisValue, args) {
|
3596 | return fun.apply(thisValue, args);
|
3597 | };
|
3598 | }
|
3599 | if (!construct) {
|
3600 | construct = function construct2(Func, args) {
|
3601 | return new Func(...args);
|
3602 | };
|
3603 | }
|
3604 | const arrayForEach = unapply(Array.prototype.forEach);
|
3605 | const arrayPop = unapply(Array.prototype.pop);
|
3606 | const arrayPush = unapply(Array.prototype.push);
|
3607 | const stringToLowerCase = unapply(String.prototype.toLowerCase);
|
3608 | const stringToString = unapply(String.prototype.toString);
|
3609 | const stringMatch = unapply(String.prototype.match);
|
3610 | const stringReplace = unapply(String.prototype.replace);
|
3611 | const stringIndexOf = unapply(String.prototype.indexOf);
|
3612 | const stringTrim = unapply(String.prototype.trim);
|
3613 | const objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty);
|
3614 | const regExpTest = unapply(RegExp.prototype.test);
|
3615 | const typeErrorCreate = unconstruct(TypeError);
|
3616 | function unapply(func) {
|
3617 | return function(thisArg) {
|
3618 | for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
3619 | args[_key - 1] = arguments[_key];
|
3620 | }
|
3621 | return apply$1(func, thisArg, args);
|
3622 | };
|
3623 | }
|
3624 | function unconstruct(func) {
|
3625 | return function() {
|
3626 | for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
3627 | args[_key2] = arguments[_key2];
|
3628 | }
|
3629 | return construct(func, args);
|
3630 | };
|
3631 | }
|
3632 | function addToSet(set2, array2) {
|
3633 | let transformCaseFunc = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : stringToLowerCase;
|
3634 | if (setPrototypeOf) {
|
3635 | setPrototypeOf(set2, null);
|
3636 | }
|
3637 | let l = array2.length;
|
3638 | while (l--) {
|
3639 | let element = array2[l];
|
3640 | if (typeof element === "string") {
|
3641 | const lcElement = transformCaseFunc(element);
|
3642 | if (lcElement !== element) {
|
3643 | if (!isFrozen(array2)) {
|
3644 | array2[l] = lcElement;
|
3645 | }
|
3646 | element = lcElement;
|
3647 | }
|
3648 | }
|
3649 | set2[element] = true;
|
3650 | }
|
3651 | return set2;
|
3652 | }
|
3653 | function cleanArray(array2) {
|
3654 | for (let index = 0; index < array2.length; index++) {
|
3655 | const isPropertyExist = objectHasOwnProperty(array2, index);
|
3656 | if (!isPropertyExist) {
|
3657 | array2[index] = null;
|
3658 | }
|
3659 | }
|
3660 | return array2;
|
3661 | }
|
3662 | function clone(object) {
|
3663 | const newObject = create(null);
|
3664 | for (const [property, value] of entries(object)) {
|
3665 | const isPropertyExist = objectHasOwnProperty(object, property);
|
3666 | if (isPropertyExist) {
|
3667 | if (Array.isArray(value)) {
|
3668 | newObject[property] = cleanArray(value);
|
3669 | } else if (value && typeof value === "object" && value.constructor === Object) {
|
3670 | newObject[property] = clone(value);
|
3671 | } else {
|
3672 | newObject[property] = value;
|
3673 | }
|
3674 | }
|
3675 | }
|
3676 | return newObject;
|
3677 | }
|
3678 | function lookupGetter(object, prop) {
|
3679 | while (object !== null) {
|
3680 | const desc = getOwnPropertyDescriptor(object, prop);
|
3681 | if (desc) {
|
3682 | if (desc.get) {
|
3683 | return unapply(desc.get);
|
3684 | }
|
3685 | if (typeof desc.value === "function") {
|
3686 | return unapply(desc.value);
|
3687 | }
|
3688 | }
|
3689 | object = getPrototypeOf(object);
|
3690 | }
|
3691 | function fallbackValue() {
|
3692 | return null;
|
3693 | }
|
3694 | return fallbackValue;
|
3695 | }
|
3696 | const html$1 = freeze(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "section", "select", "shadow", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]);
|
3697 | const svg$1 = freeze(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]);
|
3698 | const svgFilters = freeze(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]);
|
3699 | const svgDisallowed = freeze(["animate", "color-profile", "cursor", "discard", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]);
|
3700 | const mathMl$1 = freeze(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "mprescripts"]);
|
3701 | const mathMlDisallowed = freeze(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]);
|
3702 | const text = freeze(["#text"]);
|
3703 | const html = freeze(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "pattern", "placeholder", "playsinline", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "xmlns", "slot"]);
|
3704 | const svg = freeze(["accent-height", "accumulate", "additive", "alignment-baseline", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]);
|
3705 | const mathMl = freeze(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]);
|
3706 | const xml = freeze(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]);
|
3707 | const MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm);
|
3708 | const ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm);
|
3709 | const TMPLIT_EXPR = seal(/\${[\w\W]*}/gm);
|
3710 | const DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]/);
|
3711 | const ARIA_ATTR = seal(/^aria-[\-\w]+$/);
|
3712 | const IS_ALLOWED_URI = seal(
|
3713 | /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
|
3714 |
|
3715 | );
|
3716 | const IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
|
3717 | const ATTR_WHITESPACE = seal(
|
3718 | /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
|
3719 |
|
3720 | );
|
3721 | const DOCTYPE_NAME = seal(/^html$/i);
|
3722 | var EXPRESSIONS = Object.freeze({
|
3723 | __proto__: null,
|
3724 | MUSTACHE_EXPR,
|
3725 | ERB_EXPR,
|
3726 | TMPLIT_EXPR,
|
3727 | DATA_ATTR,
|
3728 | ARIA_ATTR,
|
3729 | IS_ALLOWED_URI,
|
3730 | IS_SCRIPT_OR_DATA,
|
3731 | ATTR_WHITESPACE,
|
3732 | DOCTYPE_NAME
|
3733 | });
|
3734 | const getGlobal = function getGlobal2() {
|
3735 | return typeof window === "undefined" ? null : window;
|
3736 | };
|
3737 | const _createTrustedTypesPolicy = function _createTrustedTypesPolicy2(trustedTypes, purifyHostElement) {
|
3738 | if (typeof trustedTypes !== "object" || typeof trustedTypes.createPolicy !== "function") {
|
3739 | return null;
|
3740 | }
|
3741 | let suffix = null;
|
3742 | const ATTR_NAME = "data-tt-policy-suffix";
|
3743 | if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) {
|
3744 | suffix = purifyHostElement.getAttribute(ATTR_NAME);
|
3745 | }
|
3746 | const policyName = "dompurify" + (suffix ? "#" + suffix : "");
|
3747 | try {
|
3748 | return trustedTypes.createPolicy(policyName, {
|
3749 | createHTML(html2) {
|
3750 | return html2;
|
3751 | },
|
3752 | createScriptURL(scriptUrl) {
|
3753 | return scriptUrl;
|
3754 | }
|
3755 | });
|
3756 | } catch (_2) {
|
3757 | console.warn("TrustedTypes policy " + policyName + " could not be created.");
|
3758 | return null;
|
3759 | }
|
3760 | };
|
3761 | function createDOMPurify() {
|
3762 | let window2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal();
|
3763 | const DOMPurify = (root2) => createDOMPurify(root2);
|
3764 | DOMPurify.version = "3.0.9";
|
3765 | DOMPurify.removed = [];
|
3766 | if (!window2 || !window2.document || window2.document.nodeType !== 9) {
|
3767 | DOMPurify.isSupported = false;
|
3768 | return DOMPurify;
|
3769 | }
|
3770 | let {
|
3771 | document: document2
|
3772 | } = window2;
|
3773 | const originalDocument = document2;
|
3774 | const currentScript = originalDocument.currentScript;
|
3775 | const {
|
3776 | DocumentFragment,
|
3777 | HTMLTemplateElement,
|
3778 | Node,
|
3779 | Element,
|
3780 | NodeFilter,
|
3781 | NamedNodeMap = window2.NamedNodeMap || window2.MozNamedAttrMap,
|
3782 | HTMLFormElement,
|
3783 | DOMParser,
|
3784 | trustedTypes
|
3785 | } = window2;
|
3786 | const ElementPrototype = Element.prototype;
|
3787 | const cloneNode = lookupGetter(ElementPrototype, "cloneNode");
|
3788 | const getNextSibling = lookupGetter(ElementPrototype, "nextSibling");
|
3789 | const getChildNodes = lookupGetter(ElementPrototype, "childNodes");
|
3790 | const getParentNode = lookupGetter(ElementPrototype, "parentNode");
|
3791 | if (typeof HTMLTemplateElement === "function") {
|
3792 | const template = document2.createElement("template");
|
3793 | if (template.content && template.content.ownerDocument) {
|
3794 | document2 = template.content.ownerDocument;
|
3795 | }
|
3796 | }
|
3797 | let trustedTypesPolicy;
|
3798 | let emptyHTML = "";
|
3799 | const {
|
3800 | implementation,
|
3801 | createNodeIterator,
|
3802 | createDocumentFragment,
|
3803 | getElementsByTagName
|
3804 | } = document2;
|
3805 | const {
|
3806 | importNode
|
3807 | } = originalDocument;
|
3808 | let hooks = {};
|
3809 | DOMPurify.isSupported = typeof entries === "function" && typeof getParentNode === "function" && implementation && implementation.createHTMLDocument !== void 0;
|
3810 | const {
|
3811 | MUSTACHE_EXPR: MUSTACHE_EXPR2,
|
3812 | ERB_EXPR: ERB_EXPR2,
|
3813 | TMPLIT_EXPR: TMPLIT_EXPR2,
|
3814 | DATA_ATTR: DATA_ATTR2,
|
3815 | ARIA_ATTR: ARIA_ATTR2,
|
3816 | IS_SCRIPT_OR_DATA: IS_SCRIPT_OR_DATA2,
|
3817 | ATTR_WHITESPACE: ATTR_WHITESPACE2
|
3818 | } = EXPRESSIONS;
|
3819 | let {
|
3820 | IS_ALLOWED_URI: IS_ALLOWED_URI$1
|
3821 | } = EXPRESSIONS;
|
3822 | let ALLOWED_TAGS = null;
|
3823 | const DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text]);
|
3824 | let ALLOWED_ATTR = null;
|
3825 | const DEFAULT_ALLOWED_ATTR = addToSet({}, [...html, ...svg, ...mathMl, ...xml]);
|
3826 | let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, {
|
3827 | tagNameCheck: {
|
3828 | writable: true,
|
3829 | configurable: false,
|
3830 | enumerable: true,
|
3831 | value: null
|
3832 | },
|
3833 | attributeNameCheck: {
|
3834 | writable: true,
|
3835 | configurable: false,
|
3836 | enumerable: true,
|
3837 | value: null
|
3838 | },
|
3839 | allowCustomizedBuiltInElements: {
|
3840 | writable: true,
|
3841 | configurable: false,
|
3842 | enumerable: true,
|
3843 | value: false
|
3844 | }
|
3845 | }));
|
3846 | let FORBID_TAGS = null;
|
3847 | let FORBID_ATTR = null;
|
3848 | let ALLOW_ARIA_ATTR = true;
|
3849 | let ALLOW_DATA_ATTR = true;
|
3850 | let ALLOW_UNKNOWN_PROTOCOLS = false;
|
3851 | let ALLOW_SELF_CLOSE_IN_ATTR = true;
|
3852 | let SAFE_FOR_TEMPLATES = false;
|
3853 | let WHOLE_DOCUMENT = false;
|
3854 | let SET_CONFIG = false;
|
3855 | let FORCE_BODY = false;
|
3856 | let RETURN_DOM = false;
|
3857 | let RETURN_DOM_FRAGMENT = false;
|
3858 | let RETURN_TRUSTED_TYPE = false;
|
3859 | let SANITIZE_DOM = true;
|
3860 | let SANITIZE_NAMED_PROPS = false;
|
3861 | const SANITIZE_NAMED_PROPS_PREFIX = "user-content-";
|
3862 | let KEEP_CONTENT = true;
|
3863 | let IN_PLACE = false;
|
3864 | let USE_PROFILES = {};
|
3865 | let FORBID_CONTENTS = null;
|
3866 | const DEFAULT_FORBID_CONTENTS = addToSet({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]);
|
3867 | let DATA_URI_TAGS = null;
|
3868 | const DEFAULT_DATA_URI_TAGS = addToSet({}, ["audio", "video", "img", "source", "image", "track"]);
|
3869 | let URI_SAFE_ATTRIBUTES = null;
|
3870 | const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]);
|
3871 | const MATHML_NAMESPACE = "http://www.w3.org/1998/Math/MathML";
|
3872 | const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
|
3873 | const HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
|
3874 | let NAMESPACE = HTML_NAMESPACE;
|
3875 | let IS_EMPTY_INPUT = false;
|
3876 | let ALLOWED_NAMESPACES = null;
|
3877 | const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);
|
3878 | let PARSER_MEDIA_TYPE = null;
|
3879 | const SUPPORTED_PARSER_MEDIA_TYPES = ["application/xhtml+xml", "text/html"];
|
3880 | const DEFAULT_PARSER_MEDIA_TYPE = "text/html";
|
3881 | let transformCaseFunc = null;
|
3882 | let CONFIG = null;
|
3883 | const formElement = document2.createElement("form");
|
3884 | const isRegexOrFunction = function isRegexOrFunction2(testValue) {
|
3885 | return testValue instanceof RegExp || testValue instanceof Function;
|
3886 | };
|
3887 | const _parseConfig = function _parseConfig2() {
|
3888 | let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
3889 | if (CONFIG && CONFIG === cfg) {
|
3890 | return;
|
3891 | }
|
3892 | if (!cfg || typeof cfg !== "object") {
|
3893 | cfg = {};
|
3894 | }
|
3895 | cfg = clone(cfg);
|
3896 | PARSER_MEDIA_TYPE =
|
3897 | SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE;
|
3898 | transformCaseFunc = PARSER_MEDIA_TYPE === "application/xhtml+xml" ? stringToString : stringToLowerCase;
|
3899 | ALLOWED_TAGS = objectHasOwnProperty(cfg, "ALLOWED_TAGS") ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
|
3900 | ALLOWED_ATTR = objectHasOwnProperty(cfg, "ALLOWED_ATTR") ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
|
3901 | ALLOWED_NAMESPACES = objectHasOwnProperty(cfg, "ALLOWED_NAMESPACES") ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;
|
3902 | URI_SAFE_ATTRIBUTES = objectHasOwnProperty(cfg, "ADD_URI_SAFE_ATTR") ? addToSet(
|
3903 | clone(DEFAULT_URI_SAFE_ATTRIBUTES),
|
3904 |
|
3905 | cfg.ADD_URI_SAFE_ATTR,
|
3906 |
|
3907 | transformCaseFunc
|
3908 |
|
3909 | ) : DEFAULT_URI_SAFE_ATTRIBUTES;
|
3910 | DATA_URI_TAGS = objectHasOwnProperty(cfg, "ADD_DATA_URI_TAGS") ? addToSet(
|
3911 | clone(DEFAULT_DATA_URI_TAGS),
|
3912 |
|
3913 | cfg.ADD_DATA_URI_TAGS,
|
3914 |
|
3915 | transformCaseFunc
|
3916 |
|
3917 | ) : DEFAULT_DATA_URI_TAGS;
|
3918 | FORBID_CONTENTS = objectHasOwnProperty(cfg, "FORBID_CONTENTS") ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
|
3919 | FORBID_TAGS = objectHasOwnProperty(cfg, "FORBID_TAGS") ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : {};
|
3920 | FORBID_ATTR = objectHasOwnProperty(cfg, "FORBID_ATTR") ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : {};
|
3921 | USE_PROFILES = objectHasOwnProperty(cfg, "USE_PROFILES") ? cfg.USE_PROFILES : false;
|
3922 | ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false;
|
3923 | ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false;
|
3924 | ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false;
|
3925 | ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false;
|
3926 | SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false;
|
3927 | WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false;
|
3928 | RETURN_DOM = cfg.RETURN_DOM || false;
|
3929 | RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false;
|
3930 | RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false;
|
3931 | FORCE_BODY = cfg.FORCE_BODY || false;
|
3932 | SANITIZE_DOM = cfg.SANITIZE_DOM !== false;
|
3933 | SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false;
|
3934 | KEEP_CONTENT = cfg.KEEP_CONTENT !== false;
|
3935 | IN_PLACE = cfg.IN_PLACE || false;
|
3936 | IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI;
|
3937 | NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;
|
3938 | CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || {};
|
3939 | if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) {
|
3940 | CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck;
|
3941 | }
|
3942 | if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) {
|
3943 | CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck;
|
3944 | }
|
3945 | if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === "boolean") {
|
3946 | CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements;
|
3947 | }
|
3948 | if (SAFE_FOR_TEMPLATES) {
|
3949 | ALLOW_DATA_ATTR = false;
|
3950 | }
|
3951 | if (RETURN_DOM_FRAGMENT) {
|
3952 | RETURN_DOM = true;
|
3953 | }
|
3954 | if (USE_PROFILES) {
|
3955 | ALLOWED_TAGS = addToSet({}, text);
|
3956 | ALLOWED_ATTR = [];
|
3957 | if (USE_PROFILES.html === true) {
|
3958 | addToSet(ALLOWED_TAGS, html$1);
|
3959 | addToSet(ALLOWED_ATTR, html);
|
3960 | }
|
3961 | if (USE_PROFILES.svg === true) {
|
3962 | addToSet(ALLOWED_TAGS, svg$1);
|
3963 | addToSet(ALLOWED_ATTR, svg);
|
3964 | addToSet(ALLOWED_ATTR, xml);
|
3965 | }
|
3966 | if (USE_PROFILES.svgFilters === true) {
|
3967 | addToSet(ALLOWED_TAGS, svgFilters);
|
3968 | addToSet(ALLOWED_ATTR, svg);
|
3969 | addToSet(ALLOWED_ATTR, xml);
|
3970 | }
|
3971 | if (USE_PROFILES.mathMl === true) {
|
3972 | addToSet(ALLOWED_TAGS, mathMl$1);
|
3973 | addToSet(ALLOWED_ATTR, mathMl);
|
3974 | addToSet(ALLOWED_ATTR, xml);
|
3975 | }
|
3976 | }
|
3977 | if (cfg.ADD_TAGS) {
|
3978 | if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
|
3979 | ALLOWED_TAGS = clone(ALLOWED_TAGS);
|
3980 | }
|
3981 | addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
|
3982 | }
|
3983 | if (cfg.ADD_ATTR) {
|
3984 | if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
|
3985 | ALLOWED_ATTR = clone(ALLOWED_ATTR);
|
3986 | }
|
3987 | addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
|
3988 | }
|
3989 | if (cfg.ADD_URI_SAFE_ATTR) {
|
3990 | addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
|
3991 | }
|
3992 | if (cfg.FORBID_CONTENTS) {
|
3993 | if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
|
3994 | FORBID_CONTENTS = clone(FORBID_CONTENTS);
|
3995 | }
|
3996 | addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
|
3997 | }
|
3998 | if (KEEP_CONTENT) {
|
3999 | ALLOWED_TAGS["#text"] = true;
|
4000 | }
|
4001 | if (WHOLE_DOCUMENT) {
|
4002 | addToSet(ALLOWED_TAGS, ["html", "head", "body"]);
|
4003 | }
|
4004 | if (ALLOWED_TAGS.table) {
|
4005 | addToSet(ALLOWED_TAGS, ["tbody"]);
|
4006 | delete FORBID_TAGS.tbody;
|
4007 | }
|
4008 | if (cfg.TRUSTED_TYPES_POLICY) {
|
4009 | if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== "function") {
|
4010 | throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
|
4011 | }
|
4012 | if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== "function") {
|
4013 | throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
|
4014 | }
|
4015 | trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY;
|
4016 | emptyHTML = trustedTypesPolicy.createHTML("");
|
4017 | } else {
|
4018 | if (trustedTypesPolicy === void 0) {
|
4019 | trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);
|
4020 | }
|
4021 | if (trustedTypesPolicy !== null && typeof emptyHTML === "string") {
|
4022 | emptyHTML = trustedTypesPolicy.createHTML("");
|
4023 | }
|
4024 | }
|
4025 | if (freeze) {
|
4026 | freeze(cfg);
|
4027 | }
|
4028 | CONFIG = cfg;
|
4029 | };
|
4030 | const MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ["mi", "mo", "mn", "ms", "mtext"]);
|
4031 | const HTML_INTEGRATION_POINTS = addToSet({}, ["foreignobject", "desc", "title", "annotation-xml"]);
|
4032 | const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ["title", "style", "font", "a", "script"]);
|
4033 | const ALL_SVG_TAGS = addToSet({}, [...svg$1, ...svgFilters, ...svgDisallowed]);
|
4034 | const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);
|
4035 | const _checkValidNamespace = function _checkValidNamespace2(element) {
|
4036 | let parent = getParentNode(element);
|
4037 | if (!parent || !parent.tagName) {
|
4038 | parent = {
|
4039 | namespaceURI: NAMESPACE,
|
4040 | tagName: "template"
|
4041 | };
|
4042 | }
|
4043 | const tagName = stringToLowerCase(element.tagName);
|
4044 | const parentTagName = stringToLowerCase(parent.tagName);
|
4045 | if (!ALLOWED_NAMESPACES[element.namespaceURI]) {
|
4046 | return false;
|
4047 | }
|
4048 | if (element.namespaceURI === SVG_NAMESPACE) {
|
4049 | if (parent.namespaceURI === HTML_NAMESPACE) {
|
4050 | return tagName === "svg";
|
4051 | }
|
4052 | if (parent.namespaceURI === MATHML_NAMESPACE) {
|
4053 | return tagName === "svg" && (parentTagName === "annotation-xml" || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
|
4054 | }
|
4055 | return Boolean(ALL_SVG_TAGS[tagName]);
|
4056 | }
|
4057 | if (element.namespaceURI === MATHML_NAMESPACE) {
|
4058 | if (parent.namespaceURI === HTML_NAMESPACE) {
|
4059 | return tagName === "math";
|
4060 | }
|
4061 | if (parent.namespaceURI === SVG_NAMESPACE) {
|
4062 | return tagName === "math" && HTML_INTEGRATION_POINTS[parentTagName];
|
4063 | }
|
4064 | return Boolean(ALL_MATHML_TAGS[tagName]);
|
4065 | }
|
4066 | if (element.namespaceURI === HTML_NAMESPACE) {
|
4067 | if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {
|
4068 | return false;
|
4069 | }
|
4070 | if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
|
4071 | return false;
|
4072 | }
|
4073 | return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
|
4074 | }
|
4075 | if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && ALLOWED_NAMESPACES[element.namespaceURI]) {
|
4076 | return true;
|
4077 | }
|
4078 | return false;
|
4079 | };
|
4080 | const _forceRemove = function _forceRemove2(node2) {
|
4081 | arrayPush(DOMPurify.removed, {
|
4082 | element: node2
|
4083 | });
|
4084 | try {
|
4085 | node2.parentNode.removeChild(node2);
|
4086 | } catch (_2) {
|
4087 | node2.remove();
|
4088 | }
|
4089 | };
|
4090 | const _removeAttribute = function _removeAttribute2(name, node2) {
|
4091 | try {
|
4092 | arrayPush(DOMPurify.removed, {
|
4093 | attribute: node2.getAttributeNode(name),
|
4094 | from: node2
|
4095 | });
|
4096 | } catch (_2) {
|
4097 | arrayPush(DOMPurify.removed, {
|
4098 | attribute: null,
|
4099 | from: node2
|
4100 | });
|
4101 | }
|
4102 | node2.removeAttribute(name);
|
4103 | if (name === "is" && !ALLOWED_ATTR[name]) {
|
4104 | if (RETURN_DOM || RETURN_DOM_FRAGMENT) {
|
4105 | try {
|
4106 | _forceRemove(node2);
|
4107 | } catch (_2) {
|
4108 | }
|
4109 | } else {
|
4110 | try {
|
4111 | node2.setAttribute(name, "");
|
4112 | } catch (_2) {
|
4113 | }
|
4114 | }
|
4115 | }
|
4116 | };
|
4117 | const _initDocument = function _initDocument2(dirty) {
|
4118 | let doc = null;
|
4119 | let leadingWhitespace = null;
|
4120 | if (FORCE_BODY) {
|
4121 | dirty = "<remove></remove>" + dirty;
|
4122 | } else {
|
4123 | const matches = stringMatch(dirty, /^[\r\n\t ]+/);
|
4124 | leadingWhitespace = matches && matches[0];
|
4125 | }
|
4126 | if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && NAMESPACE === HTML_NAMESPACE) {
|
4127 | dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + "</body></html>";
|
4128 | }
|
4129 | const dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
|
4130 | if (NAMESPACE === HTML_NAMESPACE) {
|
4131 | try {
|
4132 | doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
|
4133 | } catch (_2) {
|
4134 | }
|
4135 | }
|
4136 | if (!doc || !doc.documentElement) {
|
4137 | doc = implementation.createDocument(NAMESPACE, "template", null);
|
4138 | try {
|
4139 | doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;
|
4140 | } catch (_2) {
|
4141 | }
|
4142 | }
|
4143 | const body = doc.body || doc.documentElement;
|
4144 | if (dirty && leadingWhitespace) {
|
4145 | body.insertBefore(document2.createTextNode(leadingWhitespace), body.childNodes[0] || null);
|
4146 | }
|
4147 | if (NAMESPACE === HTML_NAMESPACE) {
|
4148 | return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? "html" : "body")[0];
|
4149 | }
|
4150 | return WHOLE_DOCUMENT ? doc.documentElement : body;
|
4151 | };
|
4152 | const _createNodeIterator = function _createNodeIterator2(root2) {
|
4153 | return createNodeIterator.call(
|
4154 | root2.ownerDocument || root2,
|
4155 | root2,
|
4156 |
|
4157 | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT,
|
4158 | null
|
4159 | );
|
4160 | };
|
4161 | const _isClobbered = function _isClobbered2(elm) {
|
4162 | return elm instanceof HTMLFormElement && (typeof elm.nodeName !== "string" || typeof elm.textContent !== "string" || typeof elm.removeChild !== "function" || !(elm.attributes instanceof NamedNodeMap) || typeof elm.removeAttribute !== "function" || typeof elm.setAttribute !== "function" || typeof elm.namespaceURI !== "string" || typeof elm.insertBefore !== "function" || typeof elm.hasChildNodes !== "function");
|
4163 | };
|
4164 | const _isNode = function _isNode2(object) {
|
4165 | return typeof Node === "function" && object instanceof Node;
|
4166 | };
|
4167 | const _executeHook = function _executeHook2(entryPoint, currentNode, data) {
|
4168 | if (!hooks[entryPoint]) {
|
4169 | return;
|
4170 | }
|
4171 | arrayForEach(hooks[entryPoint], (hook) => {
|
4172 | hook.call(DOMPurify, currentNode, data, CONFIG);
|
4173 | });
|
4174 | };
|
4175 | const _sanitizeElements = function _sanitizeElements2(currentNode) {
|
4176 | let content = null;
|
4177 | _executeHook("beforeSanitizeElements", currentNode, null);
|
4178 | if (_isClobbered(currentNode)) {
|
4179 | _forceRemove(currentNode);
|
4180 | return true;
|
4181 | }
|
4182 | const tagName = transformCaseFunc(currentNode.nodeName);
|
4183 | _executeHook("uponSanitizeElement", currentNode, {
|
4184 | tagName,
|
4185 | allowedTags: ALLOWED_TAGS
|
4186 | });
|
4187 | if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w]/g, currentNode.innerHTML) && regExpTest(/<[/\w]/g, currentNode.textContent)) {
|
4188 | _forceRemove(currentNode);
|
4189 | return true;
|
4190 | }
|
4191 | if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
|
4192 | if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
|
4193 | if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
|
4194 | return false;
|
4195 | }
|
4196 | if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) {
|
4197 | return false;
|
4198 | }
|
4199 | }
|
4200 | if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
|
4201 | const parentNode = getParentNode(currentNode) || currentNode.parentNode;
|
4202 | const childNodes = getChildNodes(currentNode) || currentNode.childNodes;
|
4203 | if (childNodes && parentNode) {
|
4204 | const childCount = childNodes.length;
|
4205 | for (let i = childCount - 1; i >= 0; --i) {
|
4206 | parentNode.insertBefore(cloneNode(childNodes[i], true), getNextSibling(currentNode));
|
4207 | }
|
4208 | }
|
4209 | }
|
4210 | _forceRemove(currentNode);
|
4211 | return true;
|
4212 | }
|
4213 | if (currentNode instanceof Element && !_checkValidNamespace(currentNode)) {
|
4214 | _forceRemove(currentNode);
|
4215 | return true;
|
4216 | }
|
4217 | if ((tagName === "noscript" || tagName === "noembed" || tagName === "noframes") && regExpTest(/<\/no(script|embed|frames)/i, currentNode.innerHTML)) {
|
4218 | _forceRemove(currentNode);
|
4219 | return true;
|
4220 | }
|
4221 | if (SAFE_FOR_TEMPLATES && currentNode.nodeType === 3) {
|
4222 | content = currentNode.textContent;
|
4223 | arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => {
|
4224 | content = stringReplace(content, expr, " ");
|
4225 | });
|
4226 | if (currentNode.textContent !== content) {
|
4227 | arrayPush(DOMPurify.removed, {
|
4228 | element: currentNode.cloneNode()
|
4229 | });
|
4230 | currentNode.textContent = content;
|
4231 | }
|
4232 | }
|
4233 | _executeHook("afterSanitizeElements", currentNode, null);
|
4234 | return false;
|
4235 | };
|
4236 | const _isValidAttribute = function _isValidAttribute2(lcTag, lcName, value) {
|
4237 | if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && (value in document2 || value in formElement)) {
|
4238 | return false;
|
4239 | }
|
4240 | if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR2, lcName))
|
4241 | ;
|
4242 | else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR2, lcName))
|
4243 | ;
|
4244 | else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
|
4245 | if (
|
4246 |
|
4247 |
|
4248 |
|
4249 | _isBasicCustomElement(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName)) ||
|
4250 |
|
4251 | lcName === "is" && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value))
|
4252 | )
|
4253 | ;
|
4254 | else {
|
4255 | return false;
|
4256 | }
|
4257 | } else if (URI_SAFE_ATTRIBUTES[lcName])
|
4258 | ;
|
4259 | else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE2, "")))
|
4260 | ;
|
4261 | else if ((lcName === "src" || lcName === "xlink:href" || lcName === "href") && lcTag !== "script" && stringIndexOf(value, "data:") === 0 && DATA_URI_TAGS[lcTag])
|
4262 | ;
|
4263 | else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA2, stringReplace(value, ATTR_WHITESPACE2, "")))
|
4264 | ;
|
4265 | else if (value) {
|
4266 | return false;
|
4267 | } else
|
4268 | ;
|
4269 | return true;
|
4270 | };
|
4271 | const _isBasicCustomElement = function _isBasicCustomElement2(tagName) {
|
4272 | return tagName !== "annotation-xml" && tagName.indexOf("-") > 0;
|
4273 | };
|
4274 | const _sanitizeAttributes = function _sanitizeAttributes2(currentNode) {
|
4275 | _executeHook("beforeSanitizeAttributes", currentNode, null);
|
4276 | const {
|
4277 | attributes
|
4278 | } = currentNode;
|
4279 | if (!attributes) {
|
4280 | return;
|
4281 | }
|
4282 | const hookEvent = {
|
4283 | attrName: "",
|
4284 | attrValue: "",
|
4285 | keepAttr: true,
|
4286 | allowedAttributes: ALLOWED_ATTR
|
4287 | };
|
4288 | let l = attributes.length;
|
4289 | while (l--) {
|
4290 | const attr = attributes[l];
|
4291 | const {
|
4292 | name,
|
4293 | namespaceURI,
|
4294 | value: attrValue
|
4295 | } = attr;
|
4296 | const lcName = transformCaseFunc(name);
|
4297 | let value = name === "value" ? attrValue : stringTrim(attrValue);
|
4298 | hookEvent.attrName = lcName;
|
4299 | hookEvent.attrValue = value;
|
4300 | hookEvent.keepAttr = true;
|
4301 | hookEvent.forceKeepAttr = void 0;
|
4302 | _executeHook("uponSanitizeAttribute", currentNode, hookEvent);
|
4303 | value = hookEvent.attrValue;
|
4304 | if (hookEvent.forceKeepAttr) {
|
4305 | continue;
|
4306 | }
|
4307 | _removeAttribute(name, currentNode);
|
4308 | if (!hookEvent.keepAttr) {
|
4309 | continue;
|
4310 | }
|
4311 | if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\/>/i, value)) {
|
4312 | _removeAttribute(name, currentNode);
|
4313 | continue;
|
4314 | }
|
4315 | if (SAFE_FOR_TEMPLATES) {
|
4316 | arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => {
|
4317 | value = stringReplace(value, expr, " ");
|
4318 | });
|
4319 | }
|
4320 | const lcTag = transformCaseFunc(currentNode.nodeName);
|
4321 | if (!_isValidAttribute(lcTag, lcName, value)) {
|
4322 | continue;
|
4323 | }
|
4324 | if (SANITIZE_NAMED_PROPS && (lcName === "id" || lcName === "name")) {
|
4325 | _removeAttribute(name, currentNode);
|
4326 | value = SANITIZE_NAMED_PROPS_PREFIX + value;
|
4327 | }
|
4328 | if (trustedTypesPolicy && typeof trustedTypes === "object" && typeof trustedTypes.getAttributeType === "function") {
|
4329 | if (namespaceURI)
|
4330 | ;
|
4331 | else {
|
4332 | switch (trustedTypes.getAttributeType(lcTag, lcName)) {
|
4333 | case "TrustedHTML": {
|
4334 | value = trustedTypesPolicy.createHTML(value);
|
4335 | break;
|
4336 | }
|
4337 | case "TrustedScriptURL": {
|
4338 | value = trustedTypesPolicy.createScriptURL(value);
|
4339 | break;
|
4340 | }
|
4341 | }
|
4342 | }
|
4343 | }
|
4344 | try {
|
4345 | if (namespaceURI) {
|
4346 | currentNode.setAttributeNS(namespaceURI, name, value);
|
4347 | } else {
|
4348 | currentNode.setAttribute(name, value);
|
4349 | }
|
4350 | arrayPop(DOMPurify.removed);
|
4351 | } catch (_2) {
|
4352 | }
|
4353 | }
|
4354 | _executeHook("afterSanitizeAttributes", currentNode, null);
|
4355 | };
|
4356 | const _sanitizeShadowDOM = function _sanitizeShadowDOM2(fragment) {
|
4357 | let shadowNode = null;
|
4358 | const shadowIterator = _createNodeIterator(fragment);
|
4359 | _executeHook("beforeSanitizeShadowDOM", fragment, null);
|
4360 | while (shadowNode = shadowIterator.nextNode()) {
|
4361 | _executeHook("uponSanitizeShadowNode", shadowNode, null);
|
4362 | if (_sanitizeElements(shadowNode)) {
|
4363 | continue;
|
4364 | }
|
4365 | if (shadowNode.content instanceof DocumentFragment) {
|
4366 | _sanitizeShadowDOM2(shadowNode.content);
|
4367 | }
|
4368 | _sanitizeAttributes(shadowNode);
|
4369 | }
|
4370 | _executeHook("afterSanitizeShadowDOM", fragment, null);
|
4371 | };
|
4372 | DOMPurify.sanitize = function(dirty) {
|
4373 | let cfg = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
4374 | let body = null;
|
4375 | let importedNode = null;
|
4376 | let currentNode = null;
|
4377 | let returnNode = null;
|
4378 | IS_EMPTY_INPUT = !dirty;
|
4379 | if (IS_EMPTY_INPUT) {
|
4380 | dirty = "<!-->";
|
4381 | }
|
4382 | if (typeof dirty !== "string" && !_isNode(dirty)) {
|
4383 | if (typeof dirty.toString === "function") {
|
4384 | dirty = dirty.toString();
|
4385 | if (typeof dirty !== "string") {
|
4386 | throw typeErrorCreate("dirty is not a string, aborting");
|
4387 | }
|
4388 | } else {
|
4389 | throw typeErrorCreate("toString is not a function");
|
4390 | }
|
4391 | }
|
4392 | if (!DOMPurify.isSupported) {
|
4393 | return dirty;
|
4394 | }
|
4395 | if (!SET_CONFIG) {
|
4396 | _parseConfig(cfg);
|
4397 | }
|
4398 | DOMPurify.removed = [];
|
4399 | if (typeof dirty === "string") {
|
4400 | IN_PLACE = false;
|
4401 | }
|
4402 | if (IN_PLACE) {
|
4403 | if (dirty.nodeName) {
|
4404 | const tagName = transformCaseFunc(dirty.nodeName);
|
4405 | if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
|
4406 | throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place");
|
4407 | }
|
4408 | }
|
4409 | } else if (dirty instanceof Node) {
|
4410 | body = _initDocument("<!---->");
|
4411 | importedNode = body.ownerDocument.importNode(dirty, true);
|
4412 | if (importedNode.nodeType === 1 && importedNode.nodeName === "BODY") {
|
4413 | body = importedNode;
|
4414 | } else if (importedNode.nodeName === "HTML") {
|
4415 | body = importedNode;
|
4416 | } else {
|
4417 | body.appendChild(importedNode);
|
4418 | }
|
4419 | } else {
|
4420 | if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT &&
|
4421 | dirty.indexOf("<") === -1) {
|
4422 | return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;
|
4423 | }
|
4424 | body = _initDocument(dirty);
|
4425 | if (!body) {
|
4426 | return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : "";
|
4427 | }
|
4428 | }
|
4429 | if (body && FORCE_BODY) {
|
4430 | _forceRemove(body.firstChild);
|
4431 | }
|
4432 | const nodeIterator = _createNodeIterator(IN_PLACE ? dirty : body);
|
4433 | while (currentNode = nodeIterator.nextNode()) {
|
4434 | if (_sanitizeElements(currentNode)) {
|
4435 | continue;
|
4436 | }
|
4437 | if (currentNode.content instanceof DocumentFragment) {
|
4438 | _sanitizeShadowDOM(currentNode.content);
|
4439 | }
|
4440 | _sanitizeAttributes(currentNode);
|
4441 | }
|
4442 | if (IN_PLACE) {
|
4443 | return dirty;
|
4444 | }
|
4445 | if (RETURN_DOM) {
|
4446 | if (RETURN_DOM_FRAGMENT) {
|
4447 | returnNode = createDocumentFragment.call(body.ownerDocument);
|
4448 | while (body.firstChild) {
|
4449 | returnNode.appendChild(body.firstChild);
|
4450 | }
|
4451 | } else {
|
4452 | returnNode = body;
|
4453 | }
|
4454 | if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) {
|
4455 | returnNode = importNode.call(originalDocument, returnNode, true);
|
4456 | }
|
4457 | return returnNode;
|
4458 | }
|
4459 | let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
|
4460 | if (WHOLE_DOCUMENT && ALLOWED_TAGS["!doctype"] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {
|
4461 | serializedHTML = "<!DOCTYPE " + body.ownerDocument.doctype.name + ">\n" + serializedHTML;
|
4462 | }
|
4463 | if (SAFE_FOR_TEMPLATES) {
|
4464 | arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => {
|
4465 | serializedHTML = stringReplace(serializedHTML, expr, " ");
|
4466 | });
|
4467 | }
|
4468 | return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;
|
4469 | };
|
4470 | DOMPurify.setConfig = function() {
|
4471 | let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
4472 | _parseConfig(cfg);
|
4473 | SET_CONFIG = true;
|
4474 | };
|
4475 | DOMPurify.clearConfig = function() {
|
4476 | CONFIG = null;
|
4477 | SET_CONFIG = false;
|
4478 | };
|
4479 | DOMPurify.isValidAttribute = function(tag, attr, value) {
|
4480 | if (!CONFIG) {
|
4481 | _parseConfig({});
|
4482 | }
|
4483 | const lcTag = transformCaseFunc(tag);
|
4484 | const lcName = transformCaseFunc(attr);
|
4485 | return _isValidAttribute(lcTag, lcName, value);
|
4486 | };
|
4487 | DOMPurify.addHook = function(entryPoint, hookFunction) {
|
4488 | if (typeof hookFunction !== "function") {
|
4489 | return;
|
4490 | }
|
4491 | hooks[entryPoint] = hooks[entryPoint] || [];
|
4492 | arrayPush(hooks[entryPoint], hookFunction);
|
4493 | };
|
4494 | DOMPurify.removeHook = function(entryPoint) {
|
4495 | if (hooks[entryPoint]) {
|
4496 | return arrayPop(hooks[entryPoint]);
|
4497 | }
|
4498 | };
|
4499 | DOMPurify.removeHooks = function(entryPoint) {
|
4500 | if (hooks[entryPoint]) {
|
4501 | hooks[entryPoint] = [];
|
4502 | }
|
4503 | };
|
4504 | DOMPurify.removeAllHooks = function() {
|
4505 | hooks = {};
|
4506 | };
|
4507 | return DOMPurify;
|
4508 | }
|
4509 | var purify = createDOMPurify();
|
4510 | const lineBreakRegex = /<br\s*\/?>/gi;
|
4511 | const getRows = (s) => {
|
4512 | if (!s) {
|
4513 | return [""];
|
4514 | }
|
4515 | const str2 = breakToPlaceholder(s).replace(/\\n/g, "#br#");
|
4516 | return str2.split("#br#");
|
4517 | };
|
4518 | const setupDompurifyHooksIfNotSetup = (() => {
|
4519 | let setup = false;
|
4520 | return () => {
|
4521 | if (!setup) {
|
4522 | setupDompurifyHooks();
|
4523 | setup = true;
|
4524 | }
|
4525 | };
|
4526 | })();
|
4527 | function setupDompurifyHooks() {
|
4528 | const TEMPORARY_ATTRIBUTE = "data-temp-href-target";
|
4529 | purify.addHook("beforeSanitizeAttributes", (node2) => {
|
4530 | if (node2.tagName === "A" && node2.hasAttribute("target")) {
|
4531 | node2.setAttribute(TEMPORARY_ATTRIBUTE, node2.getAttribute("target") || "");
|
4532 | }
|
4533 | });
|
4534 | purify.addHook("afterSanitizeAttributes", (node2) => {
|
4535 | if (node2.tagName === "A" && node2.hasAttribute(TEMPORARY_ATTRIBUTE)) {
|
4536 | node2.setAttribute("target", node2.getAttribute(TEMPORARY_ATTRIBUTE) || "");
|
4537 | node2.removeAttribute(TEMPORARY_ATTRIBUTE);
|
4538 | if (node2.getAttribute("target") === "_blank") {
|
4539 | node2.setAttribute("rel", "noopener");
|
4540 | }
|
4541 | }
|
4542 | });
|
4543 | }
|
4544 | const removeScript = (txt) => {
|
4545 | setupDompurifyHooksIfNotSetup();
|
4546 | const sanitizedText = purify.sanitize(txt);
|
4547 | return sanitizedText;
|
4548 | };
|
4549 | const sanitizeMore = (text2, config2) => {
|
4550 | var _a;
|
4551 | if (((_a = config2.flowchart) == null ? void 0 : _a.htmlLabels) !== false) {
|
4552 | const level = config2.securityLevel;
|
4553 | if (level === "antiscript" || level === "strict") {
|
4554 | text2 = removeScript(text2);
|
4555 | } else if (level !== "loose") {
|
4556 | text2 = breakToPlaceholder(text2);
|
4557 | text2 = text2.replace(/</g, "<").replace(/>/g, ">");
|
4558 | text2 = text2.replace(/=/g, "=");
|
4559 | text2 = placeholderToBreak(text2);
|
4560 | }
|
4561 | }
|
4562 | return text2;
|
4563 | };
|
4564 | const sanitizeText$2 = (text2, config2) => {
|
4565 | if (!text2) {
|
4566 | return text2;
|
4567 | }
|
4568 | if (config2.dompurifyConfig) {
|
4569 | text2 = purify.sanitize(sanitizeMore(text2, config2), config2.dompurifyConfig).toString();
|
4570 | } else {
|
4571 | text2 = purify.sanitize(sanitizeMore(text2, config2), {
|
4572 | FORBID_TAGS: ["style"]
|
4573 | }).toString();
|
4574 | }
|
4575 | return text2;
|
4576 | };
|
4577 | const sanitizeTextOrArray = (a, config2) => {
|
4578 | if (typeof a === "string") {
|
4579 | return sanitizeText$2(a, config2);
|
4580 | }
|
4581 | return a.flat().map((x) => sanitizeText$2(x, config2));
|
4582 | };
|
4583 | const hasBreaks = (text2) => {
|
4584 | return lineBreakRegex.test(text2);
|
4585 | };
|
4586 | const splitBreaks = (text2) => {
|
4587 | return text2.split(lineBreakRegex);
|
4588 | };
|
4589 | const placeholderToBreak = (s) => {
|
4590 | return s.replace(/#br#/g, "<br/>");
|
4591 | };
|
4592 | const breakToPlaceholder = (s) => {
|
4593 | return s.replace(lineBreakRegex, "#br#");
|
4594 | };
|
4595 | const getUrl = (useAbsolute) => {
|
4596 | let url = "";
|
4597 | if (useAbsolute) {
|
4598 | url = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search;
|
4599 | url = url.replaceAll(/\(/g, "\\(");
|
4600 | url = url.replaceAll(/\)/g, "\\)");
|
4601 | }
|
4602 | return url;
|
4603 | };
|
4604 | const evaluate = (val) => val === false || ["false", "null", "0"].includes(String(val).trim().toLowerCase()) ? false : true;
|
4605 | const getMax = function(...values) {
|
4606 | const newValues = values.filter((value) => {
|
4607 | return !isNaN(value);
|
4608 | });
|
4609 | return Math.max(...newValues);
|
4610 | };
|
4611 | const getMin = function(...values) {
|
4612 | const newValues = values.filter((value) => {
|
4613 | return !isNaN(value);
|
4614 | });
|
4615 | return Math.min(...newValues);
|
4616 | };
|
4617 | const parseGenericTypes = function(input) {
|
4618 | const inputSets = input.split(/(,)/);
|
4619 | const output = [];
|
4620 | for (let i = 0; i < inputSets.length; i++) {
|
4621 | let thisSet = inputSets[i];
|
4622 | if (thisSet === "," && i > 0 && i + 1 < inputSets.length) {
|
4623 | const previousSet = inputSets[i - 1];
|
4624 | const nextSet = inputSets[i + 1];
|
4625 | if (shouldCombineSets(previousSet, nextSet)) {
|
4626 | thisSet = previousSet + "," + nextSet;
|
4627 | i++;
|
4628 | output.pop();
|
4629 | }
|
4630 | }
|
4631 | output.push(processSet(thisSet));
|
4632 | }
|
4633 | return output.join("");
|
4634 | };
|
4635 | const countOccurrence = (string, substring) => {
|
4636 | return Math.max(0, string.split(substring).length - 1);
|
4637 | };
|
4638 | const shouldCombineSets = (previousSet, nextSet) => {
|
4639 | const prevCount = countOccurrence(previousSet, "~");
|
4640 | const nextCount = countOccurrence(nextSet, "~");
|
4641 | return prevCount === 1 && nextCount === 1;
|
4642 | };
|
4643 | const processSet = (input) => {
|
4644 | const tildeCount = countOccurrence(input, "~");
|
4645 | let hasStartingTilde = false;
|
4646 | if (tildeCount <= 1) {
|
4647 | return input;
|
4648 | }
|
4649 | if (tildeCount % 2 !== 0 && input.startsWith("~")) {
|
4650 | input = input.substring(1);
|
4651 | hasStartingTilde = true;
|
4652 | }
|
4653 | const chars = [...input];
|
4654 | let first = chars.indexOf("~");
|
4655 | let last = chars.lastIndexOf("~");
|
4656 | while (first !== -1 && last !== -1 && first !== last) {
|
4657 | chars[first] = "<";
|
4658 | chars[last] = ">";
|
4659 | first = chars.indexOf("~");
|
4660 | last = chars.lastIndexOf("~");
|
4661 | }
|
4662 | if (hasStartingTilde) {
|
4663 | chars.unshift("~");
|
4664 | }
|
4665 | return chars.join("");
|
4666 | };
|
4667 | const isMathMLSupported = () => window.MathMLElement !== void 0;
|
4668 | const katexRegex = /\$\$(.*)\$\$/g;
|
4669 | const hasKatex = (text2) => {
|
4670 | var _a;
|
4671 | return (((_a = text2.match(katexRegex)) == null ? void 0 : _a.length) ?? 0) > 0;
|
4672 | };
|
4673 | const calculateMathMLDimensions = async (text2, config2) => {
|
4674 | text2 = await renderKatex(text2, config2);
|
4675 | const divElem = document.createElement("div");
|
4676 | divElem.innerHTML = text2;
|
4677 | divElem.id = "katex-temp";
|
4678 | divElem.style.visibility = "hidden";
|
4679 | divElem.style.position = "absolute";
|
4680 | divElem.style.top = "0";
|
4681 | const body = document.querySelector("body");
|
4682 | body == null ? void 0 : body.insertAdjacentElement("beforeend", divElem);
|
4683 | const dim = { width: divElem.clientWidth, height: divElem.clientHeight };
|
4684 | divElem.remove();
|
4685 | return dim;
|
4686 | };
|
4687 | const renderKatex = async (text2, config2) => {
|
4688 | if (!hasKatex(text2)) {
|
4689 | return text2;
|
4690 | }
|
4691 | if (!isMathMLSupported() && !config2.legacyMathML) {
|
4692 | return text2.replace(katexRegex, "MathML is unsupported in this environment.");
|
4693 | }
|
4694 | const { default: katex } = await import("./katex-ffb0e8f1.js");
|
4695 | return text2.split(lineBreakRegex).map(
|
4696 | (line2) => hasKatex(line2) ? `
|
4697 | <div style="display: flex; align-items: center; justify-content: center; white-space: nowrap;">
|
4698 | ${line2}
|
4699 | </div>
|
4700 | ` : `<div>${line2}</div>`
|
4701 | ).join("").replace(
|
4702 | katexRegex,
|
4703 | (_2, c) => katex.renderToString(c, {
|
4704 | throwOnError: true,
|
4705 | displayMode: true,
|
4706 | output: isMathMLSupported() ? "mathml" : "htmlAndMathml"
|
4707 | }).replace(/\n/g, " ").replace(/<annotation.*<\/annotation>/g, "")
|
4708 | );
|
4709 | };
|
4710 | const common$1 = {
|
4711 | getRows,
|
4712 | sanitizeText: sanitizeText$2,
|
4713 | sanitizeTextOrArray,
|
4714 | hasBreaks,
|
4715 | splitBreaks,
|
4716 | lineBreakRegex,
|
4717 | removeScript,
|
4718 | getUrl,
|
4719 | evaluate,
|
4720 | getMax,
|
4721 | getMin
|
4722 | };
|
4723 | const Channel = {
|
4724 |
|
4725 | min: {
|
4726 | r: 0,
|
4727 | g: 0,
|
4728 | b: 0,
|
4729 | s: 0,
|
4730 | l: 0,
|
4731 | a: 0
|
4732 | },
|
4733 | max: {
|
4734 | r: 255,
|
4735 | g: 255,
|
4736 | b: 255,
|
4737 | h: 360,
|
4738 | s: 100,
|
4739 | l: 100,
|
4740 | a: 1
|
4741 | },
|
4742 | clamp: {
|
4743 | r: (r) => r >= 255 ? 255 : r < 0 ? 0 : r,
|
4744 | g: (g) => g >= 255 ? 255 : g < 0 ? 0 : g,
|
4745 | b: (b) => b >= 255 ? 255 : b < 0 ? 0 : b,
|
4746 | h: (h) => h % 360,
|
4747 | s: (s) => s >= 100 ? 100 : s < 0 ? 0 : s,
|
4748 | l: (l) => l >= 100 ? 100 : l < 0 ? 0 : l,
|
4749 | a: (a) => a >= 1 ? 1 : a < 0 ? 0 : a
|
4750 | },
|
4751 |
|
4752 |
|
4753 | toLinear: (c) => {
|
4754 | const n = c / 255;
|
4755 | return c > 0.03928 ? Math.pow((n + 0.055) / 1.055, 2.4) : n / 12.92;
|
4756 | },
|
4757 |
|
4758 | hue2rgb: (p, q, t) => {
|
4759 | if (t < 0)
|
4760 | t += 1;
|
4761 | if (t > 1)
|
4762 | t -= 1;
|
4763 | if (t < 1 / 6)
|
4764 | return p + (q - p) * 6 * t;
|
4765 | if (t < 1 / 2)
|
4766 | return q;
|
4767 | if (t < 2 / 3)
|
4768 | return p + (q - p) * (2 / 3 - t) * 6;
|
4769 | return p;
|
4770 | },
|
4771 | hsl2rgb: ({ h, s, l }, channel2) => {
|
4772 | if (!s)
|
4773 | return l * 2.55;
|
4774 | h /= 360;
|
4775 | s /= 100;
|
4776 | l /= 100;
|
4777 | const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
4778 | const p = 2 * l - q;
|
4779 | switch (channel2) {
|
4780 | case "r":
|
4781 | return Channel.hue2rgb(p, q, h + 1 / 3) * 255;
|
4782 | case "g":
|
4783 | return Channel.hue2rgb(p, q, h) * 255;
|
4784 | case "b":
|
4785 | return Channel.hue2rgb(p, q, h - 1 / 3) * 255;
|
4786 | }
|
4787 | },
|
4788 | rgb2hsl: ({ r, g, b }, channel2) => {
|
4789 | r /= 255;
|
4790 | g /= 255;
|
4791 | b /= 255;
|
4792 | const max2 = Math.max(r, g, b);
|
4793 | const min2 = Math.min(r, g, b);
|
4794 | const l = (max2 + min2) / 2;
|
4795 | if (channel2 === "l")
|
4796 | return l * 100;
|
4797 | if (max2 === min2)
|
4798 | return 0;
|
4799 | const d = max2 - min2;
|
4800 | const s = l > 0.5 ? d / (2 - max2 - min2) : d / (max2 + min2);
|
4801 | if (channel2 === "s")
|
4802 | return s * 100;
|
4803 | switch (max2) {
|
4804 | case r:
|
4805 | return ((g - b) / d + (g < b ? 6 : 0)) * 60;
|
4806 | case g:
|
4807 | return ((b - r) / d + 2) * 60;
|
4808 | case b:
|
4809 | return ((r - g) / d + 4) * 60;
|
4810 | default:
|
4811 | return -1;
|
4812 | }
|
4813 | }
|
4814 | };
|
4815 | const channel = Channel;
|
4816 | const Lang = {
|
4817 |
|
4818 | clamp: (number, lower2, upper) => {
|
4819 | if (lower2 > upper)
|
4820 | return Math.min(lower2, Math.max(upper, number));
|
4821 | return Math.min(upper, Math.max(lower2, number));
|
4822 | },
|
4823 | round: (number) => {
|
4824 | return Math.round(number * 1e10) / 1e10;
|
4825 | }
|
4826 | };
|
4827 | const lang = Lang;
|
4828 | const Unit = {
|
4829 |
|
4830 | dec2hex: (dec) => {
|
4831 | const hex2 = Math.round(dec).toString(16);
|
4832 | return hex2.length > 1 ? hex2 : `0${hex2}`;
|
4833 | }
|
4834 | };
|
4835 | const unit = Unit;
|
4836 | const Utils = {
|
4837 | channel,
|
4838 | lang,
|
4839 | unit
|
4840 | };
|
4841 | const _ = Utils;
|
4842 | const DEC2HEX = {};
|
4843 | for (let i = 0; i <= 255; i++)
|
4844 | DEC2HEX[i] = _.unit.dec2hex(i);
|
4845 | const TYPE = {
|
4846 | ALL: 0,
|
4847 | RGB: 1,
|
4848 | HSL: 2
|
4849 | };
|
4850 | class Type {
|
4851 | constructor() {
|
4852 | this.type = TYPE.ALL;
|
4853 | }
|
4854 |
|
4855 | get() {
|
4856 | return this.type;
|
4857 | }
|
4858 | set(type2) {
|
4859 | if (this.type && this.type !== type2)
|
4860 | throw new Error("Cannot change both RGB and HSL channels at the same time");
|
4861 | this.type = type2;
|
4862 | }
|
4863 | reset() {
|
4864 | this.type = TYPE.ALL;
|
4865 | }
|
4866 | is(type2) {
|
4867 | return this.type === type2;
|
4868 | }
|
4869 | }
|
4870 | const Type$2 = Type;
|
4871 | class Channels {
|
4872 |
|
4873 | constructor(data, color2) {
|
4874 | this.color = color2;
|
4875 | this.changed = false;
|
4876 | this.data = data;
|
4877 | this.type = new Type$2();
|
4878 | }
|
4879 |
|
4880 | set(data, color2) {
|
4881 | this.color = color2;
|
4882 | this.changed = false;
|
4883 | this.data = data;
|
4884 | this.type.type = TYPE.ALL;
|
4885 | return this;
|
4886 | }
|
4887 |
|
4888 | _ensureHSL() {
|
4889 | const data = this.data;
|
4890 | const { h, s, l } = data;
|
4891 | if (h === void 0)
|
4892 | data.h = _.channel.rgb2hsl(data, "h");
|
4893 | if (s === void 0)
|
4894 | data.s = _.channel.rgb2hsl(data, "s");
|
4895 | if (l === void 0)
|
4896 | data.l = _.channel.rgb2hsl(data, "l");
|
4897 | }
|
4898 | _ensureRGB() {
|
4899 | const data = this.data;
|
4900 | const { r, g, b } = data;
|
4901 | if (r === void 0)
|
4902 | data.r = _.channel.hsl2rgb(data, "r");
|
4903 | if (g === void 0)
|
4904 | data.g = _.channel.hsl2rgb(data, "g");
|
4905 | if (b === void 0)
|
4906 | data.b = _.channel.hsl2rgb(data, "b");
|
4907 | }
|
4908 |
|
4909 | get r() {
|
4910 | const data = this.data;
|
4911 | const r = data.r;
|
4912 | if (!this.type.is(TYPE.HSL) && r !== void 0)
|
4913 | return r;
|
4914 | this._ensureHSL();
|
4915 | return _.channel.hsl2rgb(data, "r");
|
4916 | }
|
4917 | get g() {
|
4918 | const data = this.data;
|
4919 | const g = data.g;
|
4920 | if (!this.type.is(TYPE.HSL) && g !== void 0)
|
4921 | return g;
|
4922 | this._ensureHSL();
|
4923 | return _.channel.hsl2rgb(data, "g");
|
4924 | }
|
4925 | get b() {
|
4926 | const data = this.data;
|
4927 | const b = data.b;
|
4928 | if (!this.type.is(TYPE.HSL) && b !== void 0)
|
4929 | return b;
|
4930 | this._ensureHSL();
|
4931 | return _.channel.hsl2rgb(data, "b");
|
4932 | }
|
4933 | get h() {
|
4934 | const data = this.data;
|
4935 | const h = data.h;
|
4936 | if (!this.type.is(TYPE.RGB) && h !== void 0)
|
4937 | return h;
|
4938 | this._ensureRGB();
|
4939 | return _.channel.rgb2hsl(data, "h");
|
4940 | }
|
4941 | get s() {
|
4942 | const data = this.data;
|
4943 | const s = data.s;
|
4944 | if (!this.type.is(TYPE.RGB) && s !== void 0)
|
4945 | return s;
|
4946 | this._ensureRGB();
|
4947 | return _.channel.rgb2hsl(data, "s");
|
4948 | }
|
4949 | get l() {
|
4950 | const data = this.data;
|
4951 | const l = data.l;
|
4952 | if (!this.type.is(TYPE.RGB) && l !== void 0)
|
4953 | return l;
|
4954 | this._ensureRGB();
|
4955 | return _.channel.rgb2hsl(data, "l");
|
4956 | }
|
4957 | get a() {
|
4958 | return this.data.a;
|
4959 | }
|
4960 |
|
4961 | set r(r) {
|
4962 | this.type.set(TYPE.RGB);
|
4963 | this.changed = true;
|
4964 | this.data.r = r;
|
4965 | }
|
4966 | set g(g) {
|
4967 | this.type.set(TYPE.RGB);
|
4968 | this.changed = true;
|
4969 | this.data.g = g;
|
4970 | }
|
4971 | set b(b) {
|
4972 | this.type.set(TYPE.RGB);
|
4973 | this.changed = true;
|
4974 | this.data.b = b;
|
4975 | }
|
4976 | set h(h) {
|
4977 | this.type.set(TYPE.HSL);
|
4978 | this.changed = true;
|
4979 | this.data.h = h;
|
4980 | }
|
4981 | set s(s) {
|
4982 | this.type.set(TYPE.HSL);
|
4983 | this.changed = true;
|
4984 | this.data.s = s;
|
4985 | }
|
4986 | set l(l) {
|
4987 | this.type.set(TYPE.HSL);
|
4988 | this.changed = true;
|
4989 | this.data.l = l;
|
4990 | }
|
4991 | set a(a) {
|
4992 | this.changed = true;
|
4993 | this.data.a = a;
|
4994 | }
|
4995 | }
|
4996 | const Channels$1 = Channels;
|
4997 | const channels = new Channels$1({ r: 0, g: 0, b: 0, a: 0 }, "transparent");
|
4998 | const ChannelsReusable = channels;
|
4999 | const Hex = {
|
5000 |
|
5001 | re: /^#((?:[a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i,
|
5002 |
|
5003 | parse: (color2) => {
|
5004 | if (color2.charCodeAt(0) !== 35)
|
5005 | return;
|
5006 | const match = color2.match(Hex.re);
|
5007 | if (!match)
|
5008 | return;
|
5009 | const hex2 = match[1];
|
5010 | const dec = parseInt(hex2, 16);
|
5011 | const length2 = hex2.length;
|
5012 | const hasAlpha = length2 % 4 === 0;
|
5013 | const isFullLength = length2 > 4;
|
5014 | const multiplier = isFullLength ? 1 : 17;
|
5015 | const bits = isFullLength ? 8 : 4;
|
5016 | const bitsOffset = hasAlpha ? 0 : -1;
|
5017 | const mask = isFullLength ? 255 : 15;
|
5018 | return ChannelsReusable.set({
|
5019 | r: (dec >> bits * (bitsOffset + 3) & mask) * multiplier,
|
5020 | g: (dec >> bits * (bitsOffset + 2) & mask) * multiplier,
|
5021 | b: (dec >> bits * (bitsOffset + 1) & mask) * multiplier,
|
5022 | a: hasAlpha ? (dec & mask) * multiplier / 255 : 1
|
5023 | }, color2);
|
5024 | },
|
5025 | stringify: (channels2) => {
|
5026 | const { r, g, b, a } = channels2;
|
5027 | if (a < 1) {
|
5028 | return `#${DEC2HEX[Math.round(r)]}${DEC2HEX[Math.round(g)]}${DEC2HEX[Math.round(b)]}${DEC2HEX[Math.round(a * 255)]}`;
|
5029 | } else {
|
5030 | return `#${DEC2HEX[Math.round(r)]}${DEC2HEX[Math.round(g)]}${DEC2HEX[Math.round(b)]}`;
|
5031 | }
|
5032 | }
|
5033 | };
|
5034 | const Hex$1 = Hex;
|
5035 | const HSL = {
|
5036 |
|
5037 | re: /^hsla?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(?:deg|grad|rad|turn)?)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(%)?))?\s*?\)$/i,
|
5038 | hueRe: /^(.+?)(deg|grad|rad|turn)$/i,
|
5039 |
|
5040 | _hue2deg: (hue2) => {
|
5041 | const match = hue2.match(HSL.hueRe);
|
5042 | if (match) {
|
5043 | const [, number, unit2] = match;
|
5044 | switch (unit2) {
|
5045 | case "grad":
|
5046 | return _.channel.clamp.h(parseFloat(number) * 0.9);
|
5047 | case "rad":
|
5048 | return _.channel.clamp.h(parseFloat(number) * 180 / Math.PI);
|
5049 | case "turn":
|
5050 | return _.channel.clamp.h(parseFloat(number) * 360);
|
5051 | }
|
5052 | }
|
5053 | return _.channel.clamp.h(parseFloat(hue2));
|
5054 | },
|
5055 |
|
5056 | parse: (color2) => {
|
5057 | const charCode = color2.charCodeAt(0);
|
5058 | if (charCode !== 104 && charCode !== 72)
|
5059 | return;
|
5060 | const match = color2.match(HSL.re);
|
5061 | if (!match)
|
5062 | return;
|
5063 | const [, h, s, l, a, isAlphaPercentage] = match;
|
5064 | return ChannelsReusable.set({
|
5065 | h: HSL._hue2deg(h),
|
5066 | s: _.channel.clamp.s(parseFloat(s)),
|
5067 | l: _.channel.clamp.l(parseFloat(l)),
|
5068 | a: a ? _.channel.clamp.a(isAlphaPercentage ? parseFloat(a) / 100 : parseFloat(a)) : 1
|
5069 | }, color2);
|
5070 | },
|
5071 | stringify: (channels2) => {
|
5072 | const { h, s, l, a } = channels2;
|
5073 | if (a < 1) {
|
5074 | return `hsla(${_.lang.round(h)}, ${_.lang.round(s)}%, ${_.lang.round(l)}%, ${a})`;
|
5075 | } else {
|
5076 | return `hsl(${_.lang.round(h)}, ${_.lang.round(s)}%, ${_.lang.round(l)}%)`;
|
5077 | }
|
5078 | }
|
5079 | };
|
5080 | const HSL$1 = HSL;
|
5081 | const Keyword = {
|
5082 |
|
5083 | colors: {
|
5084 | aliceblue: "#f0f8ff",
|
5085 | antiquewhite: "#faebd7",
|
5086 | aqua: "#00ffff",
|
5087 | aquamarine: "#7fffd4",
|
5088 | azure: "#f0ffff",
|
5089 | beige: "#f5f5dc",
|
5090 | bisque: "#ffe4c4",
|
5091 | black: "#000000",
|
5092 | blanchedalmond: "#ffebcd",
|
5093 | blue: "#0000ff",
|
5094 | blueviolet: "#8a2be2",
|
5095 | brown: "#a52a2a",
|
5096 | burlywood: "#deb887",
|
5097 | cadetblue: "#5f9ea0",
|
5098 | chartreuse: "#7fff00",
|
5099 | chocolate: "#d2691e",
|
5100 | coral: "#ff7f50",
|
5101 | cornflowerblue: "#6495ed",
|
5102 | cornsilk: "#fff8dc",
|
5103 | crimson: "#dc143c",
|
5104 | cyanaqua: "#00ffff",
|
5105 | darkblue: "#00008b",
|
5106 | darkcyan: "#008b8b",
|
5107 | darkgoldenrod: "#b8860b",
|
5108 | darkgray: "#a9a9a9",
|
5109 | darkgreen: "#006400",
|
5110 | darkgrey: "#a9a9a9",
|
5111 | darkkhaki: "#bdb76b",
|
5112 | darkmagenta: "#8b008b",
|
5113 | darkolivegreen: "#556b2f",
|
5114 | darkorange: "#ff8c00",
|
5115 | darkorchid: "#9932cc",
|
5116 | darkred: "#8b0000",
|
5117 | darksalmon: "#e9967a",
|
5118 | darkseagreen: "#8fbc8f",
|
5119 | darkslateblue: "#483d8b",
|
5120 | darkslategray: "#2f4f4f",
|
5121 | darkslategrey: "#2f4f4f",
|
5122 | darkturquoise: "#00ced1",
|
5123 | darkviolet: "#9400d3",
|
5124 | deeppink: "#ff1493",
|
5125 | deepskyblue: "#00bfff",
|
5126 | dimgray: "#696969",
|
5127 | dimgrey: "#696969",
|
5128 | dodgerblue: "#1e90ff",
|
5129 | firebrick: "#b22222",
|
5130 | floralwhite: "#fffaf0",
|
5131 | forestgreen: "#228b22",
|
5132 | fuchsia: "#ff00ff",
|
5133 | gainsboro: "#dcdcdc",
|
5134 | ghostwhite: "#f8f8ff",
|
5135 | gold: "#ffd700",
|
5136 | goldenrod: "#daa520",
|
5137 | gray: "#808080",
|
5138 | green: "#008000",
|
5139 | greenyellow: "#adff2f",
|
5140 | grey: "#808080",
|
5141 | honeydew: "#f0fff0",
|
5142 | hotpink: "#ff69b4",
|
5143 | indianred: "#cd5c5c",
|
5144 | indigo: "#4b0082",
|
5145 | ivory: "#fffff0",
|
5146 | khaki: "#f0e68c",
|
5147 | lavender: "#e6e6fa",
|
5148 | lavenderblush: "#fff0f5",
|
5149 | lawngreen: "#7cfc00",
|
5150 | lemonchiffon: "#fffacd",
|
5151 | lightblue: "#add8e6",
|
5152 | lightcoral: "#f08080",
|
5153 | lightcyan: "#e0ffff",
|
5154 | lightgoldenrodyellow: "#fafad2",
|
5155 | lightgray: "#d3d3d3",
|
5156 | lightgreen: "#90ee90",
|
5157 | lightgrey: "#d3d3d3",
|
5158 | lightpink: "#ffb6c1",
|
5159 | lightsalmon: "#ffa07a",
|
5160 | lightseagreen: "#20b2aa",
|
5161 | lightskyblue: "#87cefa",
|
5162 | lightslategray: "#778899",
|
5163 | lightslategrey: "#778899",
|
5164 | lightsteelblue: "#b0c4de",
|
5165 | lightyellow: "#ffffe0",
|
5166 | lime: "#00ff00",
|
5167 | limegreen: "#32cd32",
|
5168 | linen: "#faf0e6",
|
5169 | magenta: "#ff00ff",
|
5170 | maroon: "#800000",
|
5171 | mediumaquamarine: "#66cdaa",
|
5172 | mediumblue: "#0000cd",
|
5173 | mediumorchid: "#ba55d3",
|
5174 | mediumpurple: "#9370db",
|
5175 | mediumseagreen: "#3cb371",
|
5176 | mediumslateblue: "#7b68ee",
|
5177 | mediumspringgreen: "#00fa9a",
|
5178 | mediumturquoise: "#48d1cc",
|
5179 | mediumvioletred: "#c71585",
|
5180 | midnightblue: "#191970",
|
5181 | mintcream: "#f5fffa",
|
5182 | mistyrose: "#ffe4e1",
|
5183 | moccasin: "#ffe4b5",
|
5184 | navajowhite: "#ffdead",
|
5185 | navy: "#000080",
|
5186 | oldlace: "#fdf5e6",
|
5187 | olive: "#808000",
|
5188 | olivedrab: "#6b8e23",
|
5189 | orange: "#ffa500",
|
5190 | orangered: "#ff4500",
|
5191 | orchid: "#da70d6",
|
5192 | palegoldenrod: "#eee8aa",
|
5193 | palegreen: "#98fb98",
|
5194 | paleturquoise: "#afeeee",
|
5195 | palevioletred: "#db7093",
|
5196 | papayawhip: "#ffefd5",
|
5197 | peachpuff: "#ffdab9",
|
5198 | peru: "#cd853f",
|
5199 | pink: "#ffc0cb",
|
5200 | plum: "#dda0dd",
|
5201 | powderblue: "#b0e0e6",
|
5202 | purple: "#800080",
|
5203 | rebeccapurple: "#663399",
|
5204 | red: "#ff0000",
|
5205 | rosybrown: "#bc8f8f",
|
5206 | royalblue: "#4169e1",
|
5207 | saddlebrown: "#8b4513",
|
5208 | salmon: "#fa8072",
|
5209 | sandybrown: "#f4a460",
|
5210 | seagreen: "#2e8b57",
|
5211 | seashell: "#fff5ee",
|
5212 | sienna: "#a0522d",
|
5213 | silver: "#c0c0c0",
|
5214 | skyblue: "#87ceeb",
|
5215 | slateblue: "#6a5acd",
|
5216 | slategray: "#708090",
|
5217 | slategrey: "#708090",
|
5218 | snow: "#fffafa",
|
5219 | springgreen: "#00ff7f",
|
5220 | tan: "#d2b48c",
|
5221 | teal: "#008080",
|
5222 | thistle: "#d8bfd8",
|
5223 | transparent: "#00000000",
|
5224 | turquoise: "#40e0d0",
|
5225 | violet: "#ee82ee",
|
5226 | wheat: "#f5deb3",
|
5227 | white: "#ffffff",
|
5228 | whitesmoke: "#f5f5f5",
|
5229 | yellow: "#ffff00",
|
5230 | yellowgreen: "#9acd32"
|
5231 | },
|
5232 |
|
5233 | parse: (color2) => {
|
5234 | color2 = color2.toLowerCase();
|
5235 | const hex2 = Keyword.colors[color2];
|
5236 | if (!hex2)
|
5237 | return;
|
5238 | return Hex$1.parse(hex2);
|
5239 | },
|
5240 | stringify: (channels2) => {
|
5241 | const hex2 = Hex$1.stringify(channels2);
|
5242 | for (const name in Keyword.colors) {
|
5243 | if (Keyword.colors[name] === hex2)
|
5244 | return name;
|
5245 | }
|
5246 | return;
|
5247 | }
|
5248 | };
|
5249 | const Keyword$1 = Keyword;
|
5250 | const RGB = {
|
5251 |
|
5252 | re: /^rgba?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?)))?\s*?\)$/i,
|
5253 |
|
5254 | parse: (color2) => {
|
5255 | const charCode = color2.charCodeAt(0);
|
5256 | if (charCode !== 114 && charCode !== 82)
|
5257 | return;
|
5258 | const match = color2.match(RGB.re);
|
5259 | if (!match)
|
5260 | return;
|
5261 | const [, r, isRedPercentage, g, isGreenPercentage, b, isBluePercentage, a, isAlphaPercentage] = match;
|
5262 | return ChannelsReusable.set({
|
5263 | r: _.channel.clamp.r(isRedPercentage ? parseFloat(r) * 2.55 : parseFloat(r)),
|
5264 | g: _.channel.clamp.g(isGreenPercentage ? parseFloat(g) * 2.55 : parseFloat(g)),
|
5265 | b: _.channel.clamp.b(isBluePercentage ? parseFloat(b) * 2.55 : parseFloat(b)),
|
5266 | a: a ? _.channel.clamp.a(isAlphaPercentage ? parseFloat(a) / 100 : parseFloat(a)) : 1
|
5267 | }, color2);
|
5268 | },
|
5269 | stringify: (channels2) => {
|
5270 | const { r, g, b, a } = channels2;
|
5271 | if (a < 1) {
|
5272 | return `rgba(${_.lang.round(r)}, ${_.lang.round(g)}, ${_.lang.round(b)}, ${_.lang.round(a)})`;
|
5273 | } else {
|
5274 | return `rgb(${_.lang.round(r)}, ${_.lang.round(g)}, ${_.lang.round(b)})`;
|
5275 | }
|
5276 | }
|
5277 | };
|
5278 | const RGB$1 = RGB;
|
5279 | const Color = {
|
5280 |
|
5281 | format: {
|
5282 | keyword: Keyword$1,
|
5283 | hex: Hex$1,
|
5284 | rgb: RGB$1,
|
5285 | rgba: RGB$1,
|
5286 | hsl: HSL$1,
|
5287 | hsla: HSL$1
|
5288 | },
|
5289 |
|
5290 | parse: (color2) => {
|
5291 | if (typeof color2 !== "string")
|
5292 | return color2;
|
5293 | const channels2 = Hex$1.parse(color2) || RGB$1.parse(color2) || HSL$1.parse(color2) || Keyword$1.parse(color2);
|
5294 | if (channels2)
|
5295 | return channels2;
|
5296 | throw new Error(`Unsupported color format: "${color2}"`);
|
5297 | },
|
5298 | stringify: (channels2) => {
|
5299 | if (!channels2.changed && channels2.color)
|
5300 | return channels2.color;
|
5301 | if (channels2.type.is(TYPE.HSL) || channels2.data.r === void 0) {
|
5302 | return HSL$1.stringify(channels2);
|
5303 | } else if (channels2.a < 1 || !Number.isInteger(channels2.r) || !Number.isInteger(channels2.g) || !Number.isInteger(channels2.b)) {
|
5304 | return RGB$1.stringify(channels2);
|
5305 | } else {
|
5306 | return Hex$1.stringify(channels2);
|
5307 | }
|
5308 | }
|
5309 | };
|
5310 | const Color$1 = Color;
|
5311 | const change = (color2, channels2) => {
|
5312 | const ch = Color$1.parse(color2);
|
5313 | for (const c in channels2) {
|
5314 | ch[c] = _.channel.clamp[c](channels2[c]);
|
5315 | }
|
5316 | return Color$1.stringify(ch);
|
5317 | };
|
5318 | const change$1 = change;
|
5319 | const rgba = (r, g, b = 0, a = 1) => {
|
5320 | if (typeof r !== "number")
|
5321 | return change$1(r, { a: g });
|
5322 | const channels2 = ChannelsReusable.set({
|
5323 | r: _.channel.clamp.r(r),
|
5324 | g: _.channel.clamp.g(g),
|
5325 | b: _.channel.clamp.b(b),
|
5326 | a: _.channel.clamp.a(a)
|
5327 | });
|
5328 | return Color$1.stringify(channels2);
|
5329 | };
|
5330 | const rgba$1 = rgba;
|
5331 | const luminance = (color2) => {
|
5332 | const { r, g, b } = Color$1.parse(color2);
|
5333 | const luminance2 = 0.2126 * _.channel.toLinear(r) + 0.7152 * _.channel.toLinear(g) + 0.0722 * _.channel.toLinear(b);
|
5334 | return _.lang.round(luminance2);
|
5335 | };
|
5336 | const luminance$1 = luminance;
|
5337 | const isLight = (color2) => {
|
5338 | return luminance$1(color2) >= 0.5;
|
5339 | };
|
5340 | const isLight$1 = isLight;
|
5341 | const isDark = (color2) => {
|
5342 | return !isLight$1(color2);
|
5343 | };
|
5344 | const isDark$1 = isDark;
|
5345 | const adjustChannel = (color2, channel2, amount) => {
|
5346 | const channels2 = Color$1.parse(color2);
|
5347 | const amountCurrent = channels2[channel2];
|
5348 | const amountNext = _.channel.clamp[channel2](amountCurrent + amount);
|
5349 | if (amountCurrent !== amountNext)
|
5350 | channels2[channel2] = amountNext;
|
5351 | return Color$1.stringify(channels2);
|
5352 | };
|
5353 | const adjustChannel$1 = adjustChannel;
|
5354 | const lighten = (color2, amount) => {
|
5355 | return adjustChannel$1(color2, "l", amount);
|
5356 | };
|
5357 | const lighten$1 = lighten;
|
5358 | const darken = (color2, amount) => {
|
5359 | return adjustChannel$1(color2, "l", -amount);
|
5360 | };
|
5361 | const darken$1 = darken;
|
5362 | const adjust = (color2, channels2) => {
|
5363 | const ch = Color$1.parse(color2);
|
5364 | const changes = {};
|
5365 | for (const c in channels2) {
|
5366 | if (!channels2[c])
|
5367 | continue;
|
5368 | changes[c] = ch[c] + channels2[c];
|
5369 | }
|
5370 | return change$1(color2, changes);
|
5371 | };
|
5372 | const adjust$1 = adjust;
|
5373 | const mix = (color1, color2, weight = 50) => {
|
5374 | const { r: r1, g: g1, b: b1, a: a1 } = Color$1.parse(color1);
|
5375 | const { r: r2, g: g2, b: b2, a: a2 } = Color$1.parse(color2);
|
5376 | const weightScale = weight / 100;
|
5377 | const weightNormalized = weightScale * 2 - 1;
|
5378 | const alphaDelta = a1 - a2;
|
5379 | const weight1combined = weightNormalized * alphaDelta === -1 ? weightNormalized : (weightNormalized + alphaDelta) / (1 + weightNormalized * alphaDelta);
|
5380 | const weight1 = (weight1combined + 1) / 2;
|
5381 | const weight2 = 1 - weight1;
|
5382 | const r = r1 * weight1 + r2 * weight2;
|
5383 | const g = g1 * weight1 + g2 * weight2;
|
5384 | const b = b1 * weight1 + b2 * weight2;
|
5385 | const a = a1 * weightScale + a2 * (1 - weightScale);
|
5386 | return rgba$1(r, g, b, a);
|
5387 | };
|
5388 | const mix$1 = mix;
|
5389 | const invert = (color2, weight = 100) => {
|
5390 | const inverse = Color$1.parse(color2);
|
5391 | inverse.r = 255 - inverse.r;
|
5392 | inverse.g = 255 - inverse.g;
|
5393 | inverse.b = 255 - inverse.b;
|
5394 | return mix$1(inverse, color2, weight);
|
5395 | };
|
5396 | const invert$1 = invert;
|
5397 | const mkBorder = (col, darkMode) => darkMode ? adjust$1(col, { s: -40, l: 10 }) : adjust$1(col, { s: -40, l: -10 });
|
5398 | const oldAttributeBackgroundColorOdd = "#ffffff";
|
5399 | const oldAttributeBackgroundColorEven = "#f2f2f2";
|
5400 | let Theme$4 = class Theme {
|
5401 | constructor() {
|
5402 | this.background = "#f4f4f4";
|
5403 | this.primaryColor = "#fff4dd";
|
5404 | this.noteBkgColor = "#fff5ad";
|
5405 | this.noteTextColor = "#333";
|
5406 | this.THEME_COLOR_LIMIT = 12;
|
5407 | this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif';
|
5408 | this.fontSize = "16px";
|
5409 | }
|
5410 | updateColors() {
|
5411 | var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
5412 | this.primaryTextColor = this.primaryTextColor || (this.darkMode ? "#eee" : "#333");
|
5413 | this.secondaryColor = this.secondaryColor || adjust$1(this.primaryColor, { h: -120 });
|
5414 | this.tertiaryColor = this.tertiaryColor || adjust$1(this.primaryColor, { h: 180, l: 5 });
|
5415 | this.primaryBorderColor = this.primaryBorderColor || mkBorder(this.primaryColor, this.darkMode);
|
5416 | this.secondaryBorderColor = this.secondaryBorderColor || mkBorder(this.secondaryColor, this.darkMode);
|
5417 | this.tertiaryBorderColor = this.tertiaryBorderColor || mkBorder(this.tertiaryColor, this.darkMode);
|
5418 | this.noteBorderColor = this.noteBorderColor || mkBorder(this.noteBkgColor, this.darkMode);
|
5419 | this.noteBkgColor = this.noteBkgColor || "#fff5ad";
|
5420 | this.noteTextColor = this.noteTextColor || "#333";
|
5421 | this.secondaryTextColor = this.secondaryTextColor || invert$1(this.secondaryColor);
|
5422 | this.tertiaryTextColor = this.tertiaryTextColor || invert$1(this.tertiaryColor);
|
5423 | this.lineColor = this.lineColor || invert$1(this.background);
|
5424 | this.arrowheadColor = this.arrowheadColor || invert$1(this.background);
|
5425 | this.textColor = this.textColor || this.primaryTextColor;
|
5426 | this.border2 = this.border2 || this.tertiaryBorderColor;
|
5427 | this.nodeBkg = this.nodeBkg || this.primaryColor;
|
5428 | this.mainBkg = this.mainBkg || this.primaryColor;
|
5429 | this.nodeBorder = this.nodeBorder || this.primaryBorderColor;
|
5430 | this.clusterBkg = this.clusterBkg || this.tertiaryColor;
|
5431 | this.clusterBorder = this.clusterBorder || this.tertiaryBorderColor;
|
5432 | this.defaultLinkColor = this.defaultLinkColor || this.lineColor;
|
5433 | this.titleColor = this.titleColor || this.tertiaryTextColor;
|
5434 | this.edgeLabelBackground = this.edgeLabelBackground || (this.darkMode ? darken$1(this.secondaryColor, 30) : this.secondaryColor);
|
5435 | this.nodeTextColor = this.nodeTextColor || this.primaryTextColor;
|
5436 | this.actorBorder = this.actorBorder || this.primaryBorderColor;
|
5437 | this.actorBkg = this.actorBkg || this.mainBkg;
|
5438 | this.actorTextColor = this.actorTextColor || this.primaryTextColor;
|
5439 | this.actorLineColor = this.actorLineColor || "grey";
|
5440 | this.labelBoxBkgColor = this.labelBoxBkgColor || this.actorBkg;
|
5441 | this.signalColor = this.signalColor || this.textColor;
|
5442 | this.signalTextColor = this.signalTextColor || this.textColor;
|
5443 | this.labelBoxBorderColor = this.labelBoxBorderColor || this.actorBorder;
|
5444 | this.labelTextColor = this.labelTextColor || this.actorTextColor;
|
5445 | this.loopTextColor = this.loopTextColor || this.actorTextColor;
|
5446 | this.activationBorderColor = this.activationBorderColor || darken$1(this.secondaryColor, 10);
|
5447 | this.activationBkgColor = this.activationBkgColor || this.secondaryColor;
|
5448 | this.sequenceNumberColor = this.sequenceNumberColor || invert$1(this.lineColor);
|
5449 | this.sectionBkgColor = this.sectionBkgColor || this.tertiaryColor;
|
5450 | this.altSectionBkgColor = this.altSectionBkgColor || "white";
|
5451 | this.sectionBkgColor = this.sectionBkgColor || this.secondaryColor;
|
5452 | this.sectionBkgColor2 = this.sectionBkgColor2 || this.primaryColor;
|
5453 | this.excludeBkgColor = this.excludeBkgColor || "#eeeeee";
|
5454 | this.taskBorderColor = this.taskBorderColor || this.primaryBorderColor;
|
5455 | this.taskBkgColor = this.taskBkgColor || this.primaryColor;
|
5456 | this.activeTaskBorderColor = this.activeTaskBorderColor || this.primaryColor;
|
5457 | this.activeTaskBkgColor = this.activeTaskBkgColor || lighten$1(this.primaryColor, 23);
|
5458 | this.gridColor = this.gridColor || "lightgrey";
|
5459 | this.doneTaskBkgColor = this.doneTaskBkgColor || "lightgrey";
|
5460 | this.doneTaskBorderColor = this.doneTaskBorderColor || "grey";
|
5461 | this.critBorderColor = this.critBorderColor || "#ff8888";
|
5462 | this.critBkgColor = this.critBkgColor || "red";
|
5463 | this.todayLineColor = this.todayLineColor || "red";
|
5464 | this.taskTextColor = this.taskTextColor || this.textColor;
|
5465 | this.taskTextOutsideColor = this.taskTextOutsideColor || this.textColor;
|
5466 | this.taskTextLightColor = this.taskTextLightColor || this.textColor;
|
5467 | this.taskTextColor = this.taskTextColor || this.primaryTextColor;
|
5468 | this.taskTextDarkColor = this.taskTextDarkColor || this.textColor;
|
5469 | this.taskTextClickableColor = this.taskTextClickableColor || "#003163";
|
5470 | this.personBorder = this.personBorder || this.primaryBorderColor;
|
5471 | this.personBkg = this.personBkg || this.mainBkg;
|
5472 | this.transitionColor = this.transitionColor || this.lineColor;
|
5473 | this.transitionLabelColor = this.transitionLabelColor || this.textColor;
|
5474 | this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor;
|
5475 | this.stateBkg = this.stateBkg || this.mainBkg;
|
5476 | this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg;
|
5477 | this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor;
|
5478 | this.altBackground = this.altBackground || this.tertiaryColor;
|
5479 | this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg;
|
5480 | this.compositeBorder = this.compositeBorder || this.nodeBorder;
|
5481 | this.innerEndBackground = this.nodeBorder;
|
5482 | this.errorBkgColor = this.errorBkgColor || this.tertiaryColor;
|
5483 | this.errorTextColor = this.errorTextColor || this.tertiaryTextColor;
|
5484 | this.transitionColor = this.transitionColor || this.lineColor;
|
5485 | this.specialStateColor = this.lineColor;
|
5486 | this.cScale0 = this.cScale0 || this.primaryColor;
|
5487 | this.cScale1 = this.cScale1 || this.secondaryColor;
|
5488 | this.cScale2 = this.cScale2 || this.tertiaryColor;
|
5489 | this.cScale3 = this.cScale3 || adjust$1(this.primaryColor, { h: 30 });
|
5490 | this.cScale4 = this.cScale4 || adjust$1(this.primaryColor, { h: 60 });
|
5491 | this.cScale5 = this.cScale5 || adjust$1(this.primaryColor, { h: 90 });
|
5492 | this.cScale6 = this.cScale6 || adjust$1(this.primaryColor, { h: 120 });
|
5493 | this.cScale7 = this.cScale7 || adjust$1(this.primaryColor, { h: 150 });
|
5494 | this.cScale8 = this.cScale8 || adjust$1(this.primaryColor, { h: 210, l: 150 });
|
5495 | this.cScale9 = this.cScale9 || adjust$1(this.primaryColor, { h: 270 });
|
5496 | this.cScale10 = this.cScale10 || adjust$1(this.primaryColor, { h: 300 });
|
5497 | this.cScale11 = this.cScale11 || adjust$1(this.primaryColor, { h: 330 });
|
5498 | if (this.darkMode) {
|
5499 | for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
|
5500 | this["cScale" + i] = darken$1(this["cScale" + i], 75);
|
5501 | }
|
5502 | } else {
|
5503 | for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
|
5504 | this["cScale" + i] = darken$1(this["cScale" + i], 25);
|
5505 | }
|
5506 | }
|
5507 | for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
|
5508 | this["cScaleInv" + i] = this["cScaleInv" + i] || invert$1(this["cScale" + i]);
|
5509 | }
|
5510 | for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
|
5511 | if (this.darkMode) {
|
5512 | this["cScalePeer" + i] = this["cScalePeer" + i] || lighten$1(this["cScale" + i], 10);
|
5513 | } else {
|
5514 | this["cScalePeer" + i] = this["cScalePeer" + i] || darken$1(this["cScale" + i], 10);
|
5515 | }
|
5516 | }
|
5517 | this.scaleLabelColor = this.scaleLabelColor || this.labelTextColor;
|
5518 | for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
|
5519 | this["cScaleLabel" + i] = this["cScaleLabel" + i] || this.scaleLabelColor;
|
5520 | }
|
5521 | const multiplier = this.darkMode ? -4 : -1;
|
5522 | for (let i = 0; i < 5; i++) {
|
5523 | this["surface" + i] = this["surface" + i] || adjust$1(this.mainBkg, { h: 180, s: -15, l: multiplier * (5 + i * 3) });
|
5524 | this["surfacePeer" + i] = this["surfacePeer" + i] || adjust$1(this.mainBkg, { h: 180, s: -15, l: multiplier * (8 + i * 3) });
|
5525 | }
|
5526 | this.classText = this.classText || this.textColor;
|
5527 | this.fillType0 = this.fillType0 || this.primaryColor;
|
5528 | this.fillType1 = this.fillType1 || this.secondaryColor;
|
5529 | this.fillType2 = this.fillType2 || adjust$1(this.primaryColor, { h: 64 });
|
5530 | this.fillType3 = this.fillType3 || adjust$1(this.secondaryColor, { h: 64 });
|
5531 | this.fillType4 = this.fillType4 || adjust$1(this.primaryColor, { h: -64 });
|
5532 | this.fillType5 = this.fillType5 || adjust$1(this.secondaryColor, { h: -64 });
|
5533 | this.fillType6 = this.fillType6 || adjust$1(this.primaryColor, { h: 128 });
|
5534 | this.fillType7 = this.fillType7 || adjust$1(this.secondaryColor, { h: 128 });
|
5535 | this.pie1 = this.pie1 || this.primaryColor;
|
5536 | this.pie2 = this.pie2 || this.secondaryColor;
|
5537 | this.pie3 = this.pie3 || this.tertiaryColor;
|
5538 | this.pie4 = this.pie4 || adjust$1(this.primaryColor, { l: -10 });
|
5539 | this.pie5 = this.pie5 || adjust$1(this.secondaryColor, { l: -10 });
|
5540 | this.pie6 = this.pie6 || adjust$1(this.tertiaryColor, { l: -10 });
|
5541 | this.pie7 = this.pie7 || adjust$1(this.primaryColor, { h: 60, l: -10 });
|
5542 | this.pie8 = this.pie8 || adjust$1(this.primaryColor, { h: -60, l: -10 });
|
5543 | this.pie9 = this.pie9 || adjust$1(this.primaryColor, { h: 120, l: 0 });
|
5544 | this.pie10 = this.pie10 || adjust$1(this.primaryColor, { h: 60, l: -20 });
|
5545 | this.pie11 = this.pie11 || adjust$1(this.primaryColor, { h: -60, l: -20 });
|
5546 | this.pie12 = this.pie12 || adjust$1(this.primaryColor, { h: 120, l: -10 });
|
5547 | this.pieTitleTextSize = this.pieTitleTextSize || "25px";
|
5548 | this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor;
|
5549 | this.pieSectionTextSize = this.pieSectionTextSize || "17px";
|
5550 | this.pieSectionTextColor = this.pieSectionTextColor || this.textColor;
|
5551 | this.pieLegendTextSize = this.pieLegendTextSize || "17px";
|
5552 | this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor;
|
5553 | this.pieStrokeColor = this.pieStrokeColor || "black";
|
5554 | this.pieStrokeWidth = this.pieStrokeWidth || "2px";
|
5555 | this.pieOuterStrokeWidth = this.pieOuterStrokeWidth || "2px";
|
5556 | this.pieOuterStrokeColor = this.pieOuterStrokeColor || "black";
|
5557 | this.pieOpacity = this.pieOpacity || "0.7";
|
5558 | this.quadrant1Fill = this.quadrant1Fill || this.primaryColor;
|
5559 | this.quadrant2Fill = this.quadrant2Fill || adjust$1(this.primaryColor, { r: 5, g: 5, b: 5 });
|
5560 | this.quadrant3Fill = this.quadrant3Fill || adjust$1(this.primaryColor, { r: 10, g: 10, b: 10 });
|
5561 | this.quadrant4Fill = this.quadrant4Fill || adjust$1(this.primaryColor, { r: 15, g: 15, b: 15 });
|
5562 | this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor;
|
5563 | this.quadrant2TextFill = this.quadrant2TextFill || adjust$1(this.primaryTextColor, { r: -5, g: -5, b: -5 });
|
5564 | this.quadrant3TextFill = this.quadrant3TextFill || adjust$1(this.primaryTextColor, { r: -10, g: -10, b: -10 });
|
5565 | this.quadrant4TextFill = this.quadrant4TextFill || adjust$1(this.primaryTextColor, { r: -15, g: -15, b: -15 });
|
5566 | this.quadrantPointFill = this.quadrantPointFill || isDark$1(this.quadrant1Fill) ? lighten$1(this.quadrant1Fill) : darken$1(this.quadrant1Fill);
|
5567 | this.quadrantPointTextFill = this.quadrantPointTextFill || this.primaryTextColor;
|
5568 | this.quadrantXAxisTextFill = this.quadrantXAxisTextFill || this.primaryTextColor;
|
5569 | this.quadrantYAxisTextFill = this.quadrantYAxisTextFill || this.primaryTextColor;
|
5570 | this.quadrantInternalBorderStrokeFill = this.quadrantInternalBorderStrokeFill || this.primaryBorderColor;
|
5571 | this.quadrantExternalBorderStrokeFill = this.quadrantExternalBorderStrokeFill || this.primaryBorderColor;
|
5572 | this.quadrantTitleFill = this.quadrantTitleFill || this.primaryTextColor;
|
5573 | this.xyChart = {
|
5574 | backgroundColor: ((_a = this.xyChart) == null ? void 0 : _a.backgroundColor) || this.background,
|
5575 | titleColor: ((_b = this.xyChart) == null ? void 0 : _b.titleColor) || this.primaryTextColor,
|
5576 | xAxisTitleColor: ((_c = this.xyChart) == null ? void 0 : _c.xAxisTitleColor) || this.primaryTextColor,
|
5577 | xAxisLabelColor: ((_d = this.xyChart) == null ? void 0 : _d.xAxisLabelColor) || this.primaryTextColor,
|
5578 | xAxisTickColor: ((_e = this.xyChart) == null ? void 0 : _e.xAxisTickColor) || this.primaryTextColor,
|
5579 | xAxisLineColor: ((_f = this.xyChart) == null ? void 0 : _f.xAxisLineColor) || this.primaryTextColor,
|
5580 | yAxisTitleColor: ((_g = this.xyChart) == null ? void 0 : _g.yAxisTitleColor) || this.primaryTextColor,
|
5581 | yAxisLabelColor: ((_h = this.xyChart) == null ? void 0 : _h.yAxisLabelColor) || this.primaryTextColor,
|
5582 | yAxisTickColor: ((_i = this.xyChart) == null ? void 0 : _i.yAxisTickColor) || this.primaryTextColor,
|
5583 | yAxisLineColor: ((_j = this.xyChart) == null ? void 0 : _j.yAxisLineColor) || this.primaryTextColor,
|
5584 | plotColorPalette: ((_k = this.xyChart) == null ? void 0 : _k.plotColorPalette) || "#FFF4DD,#FFD8B1,#FFA07A,#ECEFF1,#D6DBDF,#C3E0A8,#FFB6A4,#FFD74D,#738FA7,#FFFFF0"
|
5585 | };
|
5586 | this.requirementBackground = this.requirementBackground || this.primaryColor;
|
5587 | this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor;
|
5588 | this.requirementBorderSize = this.requirementBorderSize || "1";
|
5589 | this.requirementTextColor = this.requirementTextColor || this.primaryTextColor;
|
5590 | this.relationColor = this.relationColor || this.lineColor;
|
5591 | this.relationLabelBackground = this.relationLabelBackground || (this.darkMode ? darken$1(this.secondaryColor, 30) : this.secondaryColor);
|
5592 | this.relationLabelColor = this.relationLabelColor || this.actorTextColor;
|
5593 | this.git0 = this.git0 || this.primaryColor;
|
5594 | this.git1 = this.git1 || this.secondaryColor;
|
5595 | this.git2 = this.git2 || this.tertiaryColor;
|
5596 | this.git3 = this.git3 || adjust$1(this.primaryColor, { h: -30 });
|
5597 | this.git4 = this.git4 || adjust$1(this.primaryColor, { h: -60 });
|
5598 | this.git5 = this.git5 || adjust$1(this.primaryColor, { h: -90 });
|
5599 | this.git6 = this.git6 || adjust$1(this.primaryColor, { h: 60 });
|
5600 | this.git7 = this.git7 || adjust$1(this.primaryColor, { h: 120 });
|
5601 | if (this.darkMode) {
|
5602 | this.git0 = lighten$1(this.git0, 25);
|
5603 | this.git1 = lighten$1(this.git1, 25);
|
5604 | this.git2 = lighten$1(this.git2, 25);
|
5605 | this.git3 = lighten$1(this.git3, 25);
|
5606 | this.git4 = lighten$1(this.git4, 25);
|
5607 | this.git5 = lighten$1(this.git5, 25);
|
5608 | this.git6 = lighten$1(this.git6, 25);
|
5609 | this.git7 = lighten$1(this.git7, 25);
|
5610 | } else {
|
5611 | this.git0 = darken$1(this.git0, 25);
|
5612 | this.git1 = darken$1(this.git1, 25);
|
5613 | this.git2 = darken$1(this.git2, 25);
|
5614 | this.git3 = darken$1(this.git3, 25);
|
5615 | this.git4 = darken$1(this.git4, 25);
|
5616 | this.git5 = darken$1(this.git5, 25);
|
5617 | this.git6 = darken$1(this.git6, 25);
|
5618 | this.git7 = darken$1(this.git7, 25);
|
5619 | }
|
5620 | this.gitInv0 = this.gitInv0 || invert$1(this.git0);
|
5621 | this.gitInv1 = this.gitInv1 || invert$1(this.git1);
|
5622 | this.gitInv2 = this.gitInv2 || invert$1(this.git2);
|
5623 | this.gitInv3 = this.gitInv3 || invert$1(this.git3);
|
5624 | this.gitInv4 = this.gitInv4 || invert$1(this.git4);
|
5625 | this.gitInv5 = this.gitInv5 || invert$1(this.git5);
|
5626 | this.gitInv6 = this.gitInv6 || invert$1(this.git6);
|
5627 | this.gitInv7 = this.gitInv7 || invert$1(this.git7);
|
5628 | this.branchLabelColor = this.branchLabelColor || (this.darkMode ? "black" : this.labelTextColor);
|
5629 | this.gitBranchLabel0 = this.gitBranchLabel0 || this.branchLabelColor;
|
5630 | this.gitBranchLabel1 = this.gitBranchLabel1 || this.branchLabelColor;
|
5631 | this.gitBranchLabel2 = this.gitBranchLabel2 || this.branchLabelColor;
|
5632 | this.gitBranchLabel3 = this.gitBranchLabel3 || this.branchLabelColor;
|
5633 | this.gitBranchLabel4 = this.gitBranchLabel4 || this.branchLabelColor;
|
5634 | this.gitBranchLabel5 = this.gitBranchLabel5 || this.branchLabelColor;
|
5635 | this.gitBranchLabel6 = this.gitBranchLabel6 || this.branchLabelColor;
|
5636 | this.gitBranchLabel7 = this.gitBranchLabel7 || this.branchLabelColor;
|
5637 | this.tagLabelColor = this.tagLabelColor || this.primaryTextColor;
|
5638 | this.tagLabelBackground = this.tagLabelBackground || this.primaryColor;
|
5639 | this.tagLabelBorder = this.tagBorder || this.primaryBorderColor;
|
5640 | this.tagLabelFontSize = this.tagLabelFontSize || "10px";
|
5641 | this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor;
|
5642 | this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor;
|
5643 | this.commitLabelFontSize = this.commitLabelFontSize || "10px";
|
5644 | this.attributeBackgroundColorOdd = this.attributeBackgroundColorOdd || oldAttributeBackgroundColorOdd;
|
5645 | this.attributeBackgroundColorEven = this.attributeBackgroundColorEven || oldAttributeBackgroundColorEven;
|
5646 | }
|
5647 | calculate(overrides) {
|
5648 | if (typeof overrides !== "object") {
|
5649 | this.updateColors();
|
5650 | return;
|
5651 | }
|
5652 | const keys = Object.keys(overrides);
|
5653 | keys.forEach((k) => {
|
5654 | this[k] = overrides[k];
|
5655 | });
|
5656 | this.updateColors();
|
5657 | keys.forEach((k) => {
|
5658 | this[k] = overrides[k];
|
5659 | });
|
5660 | }
|
5661 | };
|
5662 | const getThemeVariables$4 = (userOverrides) => {
|
5663 | const theme2 = new Theme$4();
|
5664 | theme2.calculate(userOverrides);
|
5665 | return theme2;
|
5666 | };
|
5667 | let Theme$3 = class Theme2 {
|
5668 | constructor() {
|
5669 | this.background = "#333";
|
5670 | this.primaryColor = "#1f2020";
|
5671 | this.secondaryColor = lighten$1(this.primaryColor, 16);
|
5672 | this.tertiaryColor = adjust$1(this.primaryColor, { h: -160 });
|
5673 | this.primaryBorderColor = invert$1(this.background);
|
5674 | this.secondaryBorderColor = mkBorder(this.secondaryColor, this.darkMode);
|
5675 | this.tertiaryBorderColor = mkBorder(this.tertiaryColor, this.darkMode);
|
5676 | this.primaryTextColor = invert$1(this.primaryColor);
|
5677 | this.secondaryTextColor = invert$1(this.secondaryColor);
|
5678 | this.tertiaryTextColor = invert$1(this.tertiaryColor);
|
5679 | this.lineColor = invert$1(this.background);
|
5680 | this.textColor = invert$1(this.background);
|
5681 | this.mainBkg = "#1f2020";
|
5682 | this.secondBkg = "calculated";
|
5683 | this.mainContrastColor = "lightgrey";
|
5684 | this.darkTextColor = lighten$1(invert$1("#323D47"), 10);
|
5685 | this.lineColor = "calculated";
|
5686 | this.border1 = "#81B1DB";
|
5687 | this.border2 = rgba$1(255, 255, 255, 0.25);
|
5688 | this.arrowheadColor = "calculated";
|
5689 | this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif';
|
5690 | this.fontSize = "16px";
|
5691 | this.labelBackground = "#181818";
|
5692 | this.textColor = "#ccc";
|
5693 | this.THEME_COLOR_LIMIT = 12;
|
5694 | this.nodeBkg = "calculated";
|
5695 | this.nodeBorder = "calculated";
|
5696 | this.clusterBkg = "calculated";
|
5697 | this.clusterBorder = "calculated";
|
5698 | this.defaultLinkColor = "calculated";
|
5699 | this.titleColor = "#F9FFFE";
|
5700 | this.edgeLabelBackground = "calculated";
|
5701 | this.actorBorder = "calculated";
|
5702 | this.actorBkg = "calculated";
|
5703 | this.actorTextColor = "calculated";
|
5704 | this.actorLineColor = "calculated";
|
5705 | this.signalColor = "calculated";
|
5706 | this.signalTextColor = "calculated";
|
5707 | this.labelBoxBkgColor = "calculated";
|
5708 | this.labelBoxBorderColor = "calculated";
|
5709 | this.labelTextColor = "calculated";
|
5710 | this.loopTextColor = "calculated";
|
5711 | this.noteBorderColor = "calculated";
|
5712 | this.noteBkgColor = "#fff5ad";
|
5713 | this.noteTextColor = "calculated";
|
5714 | this.activationBorderColor = "calculated";
|
5715 | this.activationBkgColor = "calculated";
|
5716 | this.sequenceNumberColor = "black";
|
5717 | this.sectionBkgColor = darken$1("#EAE8D9", 30);
|
5718 | this.altSectionBkgColor = "calculated";
|
5719 | this.sectionBkgColor2 = "#EAE8D9";
|
5720 | this.excludeBkgColor = darken$1(this.sectionBkgColor, 10);
|
5721 | this.taskBorderColor = rgba$1(255, 255, 255, 70);
|
5722 | this.taskBkgColor = "calculated";
|
5723 | this.taskTextColor = "calculated";
|
5724 | this.taskTextLightColor = "calculated";
|
5725 | this.taskTextOutsideColor = "calculated";
|
5726 | this.taskTextClickableColor = "#003163";
|
5727 | this.activeTaskBorderColor = rgba$1(255, 255, 255, 50);
|
5728 | this.activeTaskBkgColor = "#81B1DB";
|
5729 | this.gridColor = "calculated";
|
5730 | this.doneTaskBkgColor = "calculated";
|
5731 | this.doneTaskBorderColor = "grey";
|
5732 | this.critBorderColor = "#E83737";
|
5733 | this.critBkgColor = "#E83737";
|
5734 | this.taskTextDarkColor = "calculated";
|
5735 | this.todayLineColor = "#DB5757";
|
5736 | this.personBorder = this.primaryBorderColor;
|
5737 | this.personBkg = this.mainBkg;
|
5738 | this.labelColor = "calculated";
|
5739 | this.errorBkgColor = "#a44141";
|
5740 | this.errorTextColor = "#ddd";
|
5741 | }
|
5742 | updateColors() {
|
5743 | var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
5744 | this.secondBkg = lighten$1(this.mainBkg, 16);
|
5745 | this.lineColor = this.mainContrastColor;
|
5746 | this.arrowheadColor = this.mainContrastColor;
|
5747 | this.nodeBkg = this.mainBkg;
|
5748 | this.nodeBorder = this.border1;
|
5749 | this.clusterBkg = this.secondBkg;
|
5750 | this.clusterBorder = this.border2;
|
5751 | this.defaultLinkColor = this.lineColor;
|
5752 | this.edgeLabelBackground = lighten$1(this.labelBackground, 25);
|
5753 | this.actorBorder = this.border1;
|
5754 | this.actorBkg = this.mainBkg;
|
5755 | this.actorTextColor = this.mainContrastColor;
|
5756 | this.actorLineColor = this.mainContrastColor;
|
5757 | this.signalColor = this.mainContrastColor;
|
5758 | this.signalTextColor = this.mainContrastColor;
|
5759 | this.labelBoxBkgColor = this.actorBkg;
|
5760 | this.labelBoxBorderColor = this.actorBorder;
|
5761 | this.labelTextColor = this.mainContrastColor;
|
5762 | this.loopTextColor = this.mainContrastColor;
|
5763 | this.noteBorderColor = this.secondaryBorderColor;
|
5764 | this.noteBkgColor = this.secondBkg;
|
5765 | this.noteTextColor = this.secondaryTextColor;
|
5766 | this.activationBorderColor = this.border1;
|
5767 | this.activationBkgColor = this.secondBkg;
|
5768 | this.altSectionBkgColor = this.background;
|
5769 | this.taskBkgColor = lighten$1(this.mainBkg, 23);
|
5770 | this.taskTextColor = this.darkTextColor;
|
5771 | this.taskTextLightColor = this.mainContrastColor;
|
5772 | this.taskTextOutsideColor = this.taskTextLightColor;
|
5773 | this.gridColor = this.mainContrastColor;
|
5774 | this.doneTaskBkgColor = this.mainContrastColor;
|
5775 | this.taskTextDarkColor = this.darkTextColor;
|
5776 | this.transitionColor = this.transitionColor || this.lineColor;
|
5777 | this.transitionLabelColor = this.transitionLabelColor || this.textColor;
|
5778 | this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor;
|
5779 | this.stateBkg = this.stateBkg || this.mainBkg;
|
5780 | this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg;
|
5781 | this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor;
|
5782 | this.altBackground = this.altBackground || "#555";
|
5783 | this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg;
|
5784 | this.compositeBorder = this.compositeBorder || this.nodeBorder;
|
5785 | this.innerEndBackground = this.primaryBorderColor;
|
5786 | this.specialStateColor = "#f4f4f4";
|
5787 | this.errorBkgColor = this.errorBkgColor || this.tertiaryColor;
|
5788 | this.errorTextColor = this.errorTextColor || this.tertiaryTextColor;
|
5789 | this.fillType0 = this.primaryColor;
|
5790 | this.fillType1 = this.secondaryColor;
|
5791 | this.fillType2 = adjust$1(this.primaryColor, { h: 64 });
|
5792 | this.fillType3 = adjust$1(this.secondaryColor, { h: 64 });
|
5793 | this.fillType4 = adjust$1(this.primaryColor, { h: -64 });
|
5794 | this.fillType5 = adjust$1(this.secondaryColor, { h: -64 });
|
5795 | this.fillType6 = adjust$1(this.primaryColor, { h: 128 });
|
5796 | this.fillType7 = adjust$1(this.secondaryColor, { h: 128 });
|
5797 | this.cScale1 = this.cScale1 || "#0b0000";
|
5798 | this.cScale2 = this.cScale2 || "#4d1037";
|
5799 | this.cScale3 = this.cScale3 || "#3f5258";
|
5800 | this.cScale4 = this.cScale4 || "#4f2f1b";
|
5801 | this.cScale5 = this.cScale5 || "#6e0a0a";
|
5802 | this.cScale6 = this.cScale6 || "#3b0048";
|
5803 | this.cScale7 = this.cScale7 || "#995a01";
|
5804 | this.cScale8 = this.cScale8 || "#154706";
|
5805 | this.cScale9 = this.cScale9 || "#161722";
|
5806 | this.cScale10 = this.cScale10 || "#00296f";
|
5807 | this.cScale11 = this.cScale11 || "#01629c";
|
5808 | this.cScale12 = this.cScale12 || "#010029";
|
5809 | this.cScale0 = this.cScale0 || this.primaryColor;
|
5810 | this.cScale1 = this.cScale1 || this.secondaryColor;
|
5811 | this.cScale2 = this.cScale2 || this.tertiaryColor;
|
5812 | this.cScale3 = this.cScale3 || adjust$1(this.primaryColor, { h: 30 });
|
5813 | this.cScale4 = this.cScale4 || adjust$1(this.primaryColor, { h: 60 });
|
5814 | this.cScale5 = this.cScale5 || adjust$1(this.primaryColor, { h: 90 });
|
5815 | this.cScale6 = this.cScale6 || adjust$1(this.primaryColor, { h: 120 });
|
5816 | this.cScale7 = this.cScale7 || adjust$1(this.primaryColor, { h: 150 });
|
5817 | this.cScale8 = this.cScale8 || adjust$1(this.primaryColor, { h: 210 });
|
5818 | this.cScale9 = this.cScale9 || adjust$1(this.primaryColor, { h: 270 });
|
5819 | this.cScale10 = this.cScale10 || adjust$1(this.primaryColor, { h: 300 });
|
5820 | this.cScale11 = this.cScale11 || adjust$1(this.primaryColor, { h: 330 });
|
5821 | for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
|
5822 | this["cScaleInv" + i] = this["cScaleInv" + i] || invert$1(this["cScale" + i]);
|
5823 | }
|
5824 | for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
|
5825 | this["cScalePeer" + i] = this["cScalePeer" + i] || lighten$1(this["cScale" + i], 10);
|
5826 | }
|
5827 | for (let i = 0; i < 5; i++) {
|
5828 | this["surface" + i] = this["surface" + i] || adjust$1(this.mainBkg, { h: 30, s: -30, l: -(-10 + i * 4) });
|
5829 | this["surfacePeer" + i] = this["surfacePeer" + i] || adjust$1(this.mainBkg, { h: 30, s: -30, l: -(-7 + i * 4) });
|
5830 | }
|
5831 | this.scaleLabelColor = this.scaleLabelColor || (this.darkMode ? "black" : this.labelTextColor);
|
5832 | for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
|
5833 | this["cScaleLabel" + i] = this["cScaleLabel" + i] || this.scaleLabelColor;
|
5834 | }
|
5835 | for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
|
5836 | this["pie" + i] = this["cScale" + i];
|
5837 | }
|
5838 | this.pieTitleTextSize = this.pieTitleTextSize || "25px";
|
5839 | this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor;
|
5840 | this.pieSectionTextSize = this.pieSectionTextSize || "17px";
|
5841 | this.pieSectionTextColor = this.pieSectionTextColor || this.textColor;
|
5842 | this.pieLegendTextSize = this.pieLegendTextSize || "17px";
|
5843 | this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor;
|
5844 | this.pieStrokeColor = this.pieStrokeColor || "black";
|
5845 | this.pieStrokeWidth = this.pieStrokeWidth || "2px";
|
5846 | this.pieOuterStrokeWidth = this.pieOuterStrokeWidth || "2px";
|
5847 | this.pieOuterStrokeColor = this.pieOuterStrokeColor || "black";
|
5848 | this.pieOpacity = this.pieOpacity || "0.7";
|
5849 | this.quadrant1Fill = this.quadrant1Fill || this.primaryColor;
|
5850 | this.quadrant2Fill = this.quadrant2Fill || adjust$1(this.primaryColor, { r: 5, g: 5, b: 5 });
|
5851 | this.quadrant3Fill = this.quadrant3Fill || adjust$1(this.primaryColor, { r: 10, g: 10, b: 10 });
|
5852 | this.quadrant4Fill = this.quadrant4Fill || adjust$1(this.primaryColor, { r: 15, g: 15, b: 15 });
|
5853 | this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor;
|
5854 | this.quadrant2TextFill = this.quadrant2TextFill || adjust$1(this.primaryTextColor, { r: -5, g: -5, b: -5 });
|
5855 | this.quadrant3TextFill = this.quadrant3TextFill || adjust$1(this.primaryTextColor, { r: -10, g: -10, b: -10 });
|
5856 | this.quadrant4TextFill = this.quadrant4TextFill || adjust$1(this.primaryTextColor, { r: -15, g: -15, b: -15 });
|
5857 | this.quadrantPointFill = this.quadrantPointFill || isDark$1(this.quadrant1Fill) ? lighten$1(this.quadrant1Fill) : darken$1(this.quadrant1Fill);
|
5858 | this.quadrantPointTextFill = this.quadrantPointTextFill || this.primaryTextColor;
|
5859 | this.quadrantXAxisTextFill = this.quadrantXAxisTextFill || this.primaryTextColor;
|
5860 | this.quadrantYAxisTextFill = this.quadrantYAxisTextFill || this.primaryTextColor;
|
5861 | this.quadrantInternalBorderStrokeFill = this.quadrantInternalBorderStrokeFill || this.primaryBorderColor;
|
5862 | this.quadrantExternalBorderStrokeFill = this.quadrantExternalBorderStrokeFill || this.primaryBorderColor;
|
5863 | this.quadrantTitleFill = this.quadrantTitleFill || this.primaryTextColor;
|
5864 | this.xyChart = {
|
5865 | backgroundColor: ((_a = this.xyChart) == null ? void 0 : _a.backgroundColor) || this.background,
|
5866 | titleColor: ((_b = this.xyChart) == null ? void 0 : _b.titleColor) || this.primaryTextColor,
|
5867 | xAxisTitleColor: ((_c = this.xyChart) == null ? void 0 : _c.xAxisTitleColor) || this.primaryTextColor,
|
5868 | xAxisLabelColor: ((_d = this.xyChart) == null ? void 0 : _d.xAxisLabelColor) || this.primaryTextColor,
|
5869 | xAxisTickColor: ((_e = this.xyChart) == null ? void 0 : _e.xAxisTickColor) || this.primaryTextColor,
|
5870 | xAxisLineColor: ((_f = this.xyChart) == null ? void 0 : _f.xAxisLineColor) || this.primaryTextColor,
|
5871 | yAxisTitleColor: ((_g = this.xyChart) == null ? void 0 : _g.yAxisTitleColor) || this.primaryTextColor,
|
5872 | yAxisLabelColor: ((_h = this.xyChart) == null ? void 0 : _h.yAxisLabelColor) || this.primaryTextColor,
|
5873 | yAxisTickColor: ((_i = this.xyChart) == null ? void 0 : _i.yAxisTickColor) || this.primaryTextColor,
|
5874 | yAxisLineColor: ((_j = this.xyChart) == null ? void 0 : _j.yAxisLineColor) || this.primaryTextColor,
|
5875 | plotColorPalette: ((_k = this.xyChart) == null ? void 0 : _k.plotColorPalette) || "#3498db,#2ecc71,#e74c3c,#f1c40f,#bdc3c7,#ffffff,#34495e,#9b59b6,#1abc9c,#e67e22"
|
5876 | };
|
5877 | this.classText = this.primaryTextColor;
|
5878 | this.requirementBackground = this.requirementBackground || this.primaryColor;
|
5879 | this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor;
|
5880 | this.requirementBorderSize = this.requirementBorderSize || "1";
|
5881 | this.requirementTextColor = this.requirementTextColor || this.primaryTextColor;
|
5882 | this.relationColor = this.relationColor || this.lineColor;
|
5883 | this.relationLabelBackground = this.relationLabelBackground || (this.darkMode ? darken$1(this.secondaryColor, 30) : this.secondaryColor);
|
5884 | this.relationLabelColor = this.relationLabelColor || this.actorTextColor;
|
5885 | this.git0 = lighten$1(this.secondaryColor, 20);
|
5886 | this.git1 = lighten$1(this.pie2 || this.secondaryColor, 20);
|
5887 | this.git2 = lighten$1(this.pie3 || this.tertiaryColor, 20);
|
5888 | this.git3 = lighten$1(this.pie4 || adjust$1(this.primaryColor, { h: -30 }), 20);
|
5889 | this.git4 = lighten$1(this.pie5 || adjust$1(this.primaryColor, { h: -60 }), 20);
|
5890 | this.git5 = lighten$1(this.pie6 || adjust$1(this.primaryColor, { h: -90 }), 10);
|
5891 | this.git6 = lighten$1(this.pie7 || adjust$1(this.primaryColor, { h: 60 }), 10);
|
5892 | this.git7 = lighten$1(this.pie8 || adjust$1(this.primaryColor, { h: 120 }), 20);
|
5893 | this.gitInv0 = this.gitInv0 || invert$1(this.git0);
|
5894 | this.gitInv1 = this.gitInv1 || invert$1(this.git1);
|
5895 | this.gitInv2 = this.gitInv2 || invert$1(this.git2);
|
5896 | this.gitInv3 = this.gitInv3 || invert$1(this.git3);
|
5897 | this.gitInv4 = this.gitInv4 || invert$1(this.git4);
|
5898 | this.gitInv5 = this.gitInv5 || invert$1(this.git5);
|
5899 | this.gitInv6 = this.gitInv6 || invert$1(this.git6);
|
5900 | this.gitInv7 = this.gitInv7 || invert$1(this.git7);
|
5901 | this.gitBranchLabel0 = this.gitBranchLabel0 || invert$1(this.labelTextColor);
|
5902 | this.gitBranchLabel1 = this.gitBranchLabel1 || this.labelTextColor;
|
5903 | this.gitBranchLabel2 = this.gitBranchLabel2 || this.labelTextColor;
|
5904 | this.gitBranchLabel3 = this.gitBranchLabel3 || invert$1(this.labelTextColor);
|
5905 | this.gitBranchLabel4 = this.gitBranchLabel4 || this.labelTextColor;
|
5906 | this.gitBranchLabel5 = this.gitBranchLabel5 || this.labelTextColor;
|
5907 | this.gitBranchLabel6 = this.gitBranchLabel6 || this.labelTextColor;
|
5908 | this.gitBranchLabel7 = this.gitBranchLabel7 || this.labelTextColor;
|
5909 | this.tagLabelColor = this.tagLabelColor || this.primaryTextColor;
|
5910 | this.tagLabelBackground = this.tagLabelBackground || this.primaryColor;
|
5911 | this.tagLabelBorder = this.tagBorder || this.primaryBorderColor;
|
5912 | this.tagLabelFontSize = this.tagLabelFontSize || "10px";
|
5913 | this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor;
|
5914 | this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor;
|
5915 | this.commitLabelFontSize = this.commitLabelFontSize || "10px";
|
5916 | this.attributeBackgroundColorOdd = this.attributeBackgroundColorOdd || lighten$1(this.background, 12);
|
5917 | this.attributeBackgroundColorEven = this.attributeBackgroundColorEven || lighten$1(this.background, 2);
|
5918 | }
|
5919 | calculate(overrides) {
|
5920 | if (typeof overrides !== "object") {
|
5921 | this.updateColors();
|
5922 | return;
|
5923 | }
|
5924 | const keys = Object.keys(overrides);
|
5925 | keys.forEach((k) => {
|
5926 | this[k] = overrides[k];
|
5927 | });
|
5928 | this.updateColors();
|
5929 | keys.forEach((k) => {
|
5930 | this[k] = overrides[k];
|
5931 | });
|
5932 | }
|
5933 | };
|
5934 | const getThemeVariables$3 = (userOverrides) => {
|
5935 | const theme2 = new Theme$3();
|
5936 | theme2.calculate(userOverrides);
|
5937 | return theme2;
|
5938 | };
|
5939 | let Theme$2 = class Theme3 {
|
5940 | constructor() {
|
5941 | this.background = "#f4f4f4";
|
5942 | this.primaryColor = "#ECECFF";
|
5943 | this.secondaryColor = adjust$1(this.primaryColor, { h: 120 });
|
5944 | this.secondaryColor = "#ffffde";
|
5945 | this.tertiaryColor = adjust$1(this.primaryColor, { h: -160 });
|
5946 | this.primaryBorderColor = mkBorder(this.primaryColor, this.darkMode);
|
5947 | this.secondaryBorderColor = mkBorder(this.secondaryColor, this.darkMode);
|
5948 | this.tertiaryBorderColor = mkBorder(this.tertiaryColor, this.darkMode);
|
5949 | this.primaryTextColor = invert$1(this.primaryColor);
|
5950 | this.secondaryTextColor = invert$1(this.secondaryColor);
|
5951 | this.tertiaryTextColor = invert$1(this.tertiaryColor);
|
5952 | this.lineColor = invert$1(this.background);
|
5953 | this.textColor = invert$1(this.background);
|
5954 | this.background = "white";
|
5955 | this.mainBkg = "#ECECFF";
|
5956 | this.secondBkg = "#ffffde";
|
5957 | this.lineColor = "#333333";
|
5958 | this.border1 = "#9370DB";
|
5959 | this.border2 = "#aaaa33";
|
5960 | this.arrowheadColor = "#333333";
|
5961 | this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif';
|
5962 | this.fontSize = "16px";
|
5963 | this.labelBackground = "#e8e8e8";
|
5964 | this.textColor = "#333";
|
5965 | this.THEME_COLOR_LIMIT = 12;
|
5966 | this.nodeBkg = "calculated";
|
5967 | this.nodeBorder = "calculated";
|
5968 | this.clusterBkg = "calculated";
|
5969 | this.clusterBorder = "calculated";
|
5970 | this.defaultLinkColor = "calculated";
|
5971 | this.titleColor = "calculated";
|
5972 | this.edgeLabelBackground = "calculated";
|
5973 | this.actorBorder = "calculated";
|
5974 | this.actorBkg = "calculated";
|
5975 | this.actorTextColor = "black";
|
5976 | this.actorLineColor = "grey";
|
5977 | this.signalColor = "calculated";
|
5978 | this.signalTextColor = "calculated";
|
5979 | this.labelBoxBkgColor = "calculated";
|
5980 | this.labelBoxBorderColor = "calculated";
|
5981 | this.labelTextColor = "calculated";
|
5982 | this.loopTextColor = "calculated";
|
5983 | this.noteBorderColor = "calculated";
|
5984 | this.noteBkgColor = "#fff5ad";
|
5985 | this.noteTextColor = "calculated";
|
5986 | this.activationBorderColor = "#666";
|
5987 | this.activationBkgColor = "#f4f4f4";
|
5988 | this.sequenceNumberColor = "white";
|
5989 | this.sectionBkgColor = "calculated";
|
5990 | this.altSectionBkgColor = "calculated";
|
5991 | this.sectionBkgColor2 = "calculated";
|
5992 | this.excludeBkgColor = "#eeeeee";
|
5993 | this.taskBorderColor = "calculated";
|
5994 | this.taskBkgColor = "calculated";
|
5995 | this.taskTextLightColor = "calculated";
|
5996 | this.taskTextColor = this.taskTextLightColor;
|
5997 | this.taskTextDarkColor = "calculated";
|
5998 | this.taskTextOutsideColor = this.taskTextDarkColor;
|
5999 | this.taskTextClickableColor = "calculated";
|
6000 | this.activeTaskBorderColor = "calculated";
|
6001 | this.activeTaskBkgColor = "calculated";
|
6002 | this.gridColor = "calculated";
|
6003 | this.doneTaskBkgColor = "calculated";
|
6004 | this.doneTaskBorderColor = "calculated";
|
6005 | this.critBorderColor = "calculated";
|
6006 | this.critBkgColor = "calculated";
|
6007 | this.todayLineColor = "calculated";
|
6008 | this.sectionBkgColor = rgba$1(102, 102, 255, 0.49);
|
6009 | this.altSectionBkgColor = "white";
|
6010 | this.sectionBkgColor2 = "#fff400";
|
6011 | this.taskBorderColor = "#534fbc";
|
6012 | this.taskBkgColor = "#8a90dd";
|
6013 | this.taskTextLightColor = "white";
|
6014 | this.taskTextColor = "calculated";
|
6015 | this.taskTextDarkColor = "black";
|
6016 | this.taskTextOutsideColor = "calculated";
|
6017 | this.taskTextClickableColor = "#003163";
|
6018 | this.activeTaskBorderColor = "#534fbc";
|
6019 | this.activeTaskBkgColor = "#bfc7ff";
|
6020 | this.gridColor = "lightgrey";
|
6021 | this.doneTaskBkgColor = "lightgrey";
|
6022 | this.doneTaskBorderColor = "grey";
|
6023 | this.critBorderColor = "#ff8888";
|
6024 | this.critBkgColor = "red";
|
6025 | this.todayLineColor = "red";
|
6026 | this.personBorder = this.primaryBorderColor;
|
6027 | this.personBkg = this.mainBkg;
|
6028 | this.labelColor = "black";
|
6029 | this.errorBkgColor = "#552222";
|
6030 | this.errorTextColor = "#552222";
|
6031 | this.updateColors();
|
6032 | }
|
6033 | updateColors() {
|
6034 | var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
6035 | this.cScale0 = this.cScale0 || this.primaryColor;
|
6036 | this.cScale1 = this.cScale1 || this.secondaryColor;
|
6037 | this.cScale2 = this.cScale2 || this.tertiaryColor;
|
6038 | this.cScale3 = this.cScale3 || adjust$1(this.primaryColor, { h: 30 });
|
6039 | this.cScale4 = this.cScale4 || adjust$1(this.primaryColor, { h: 60 });
|
6040 | this.cScale5 = this.cScale5 || adjust$1(this.primaryColor, { h: 90 });
|
6041 | this.cScale6 = this.cScale6 || adjust$1(this.primaryColor, { h: 120 });
|
6042 | this.cScale7 = this.cScale7 || adjust$1(this.primaryColor, { h: 150 });
|
6043 | this.cScale8 = this.cScale8 || adjust$1(this.primaryColor, { h: 210 });
|
6044 | this.cScale9 = this.cScale9 || adjust$1(this.primaryColor, { h: 270 });
|
6045 | this.cScale10 = this.cScale10 || adjust$1(this.primaryColor, { h: 300 });
|
6046 | this.cScale11 = this.cScale11 || adjust$1(this.primaryColor, { h: 330 });
|
6047 | this["cScalePeer1"] = this["cScalePeer1"] || darken$1(this.secondaryColor, 45);
|
6048 | this["cScalePeer2"] = this["cScalePeer2"] || darken$1(this.tertiaryColor, 40);
|
6049 | for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
|
6050 | this["cScale" + i] = darken$1(this["cScale" + i], 10);
|
6051 | this["cScalePeer" + i] = this["cScalePeer" + i] || darken$1(this["cScale" + i], 25);
|
6052 | }
|
6053 | for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
|
6054 | this["cScaleInv" + i] = this["cScaleInv" + i] || adjust$1(this["cScale" + i], { h: 180 });
|
6055 | }
|
6056 | for (let i = 0; i < 5; i++) {
|
6057 | this["surface" + i] = this["surface" + i] || adjust$1(this.mainBkg, { h: 30, l: -(5 + i * 5) });
|
6058 | this["surfacePeer" + i] = this["surfacePeer" + i] || adjust$1(this.mainBkg, { h: 30, l: -(7 + i * 5) });
|
6059 | }
|
6060 | this.scaleLabelColor = this.scaleLabelColor !== "calculated" && this.scaleLabelColor ? this.scaleLabelColor : this.labelTextColor;
|
6061 | if (this.labelTextColor !== "calculated") {
|
6062 | this.cScaleLabel0 = this.cScaleLabel0 || invert$1(this.labelTextColor);
|
6063 | this.cScaleLabel3 = this.cScaleLabel3 || invert$1(this.labelTextColor);
|
6064 | for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
|
6065 | this["cScaleLabel" + i] = this["cScaleLabel" + i] || this.labelTextColor;
|
6066 | }
|
6067 | }
|
6068 | this.nodeBkg = this.mainBkg;
|
6069 | this.nodeBorder = this.border1;
|
6070 | this.clusterBkg = this.secondBkg;
|
6071 | this.clusterBorder = this.border2;
|
6072 | this.defaultLinkColor = this.lineColor;
|
6073 | this.titleColor = this.textColor;
|
6074 | this.edgeLabelBackground = this.labelBackground;
|
6075 | this.actorBorder = lighten$1(this.border1, 23);
|
6076 | this.actorBkg = this.mainBkg;
|
6077 | this.labelBoxBkgColor = this.actorBkg;
|
6078 | this.signalColor = this.textColor;
|
6079 | this.signalTextColor = this.textColor;
|
6080 | this.labelBoxBorderColor = this.actorBorder;
|
6081 | this.labelTextColor = this.actorTextColor;
|
6082 | this.loopTextColor = this.actorTextColor;
|
6083 | this.noteBorderColor = this.border2;
|
6084 | this.noteTextColor = this.actorTextColor;
|
6085 | this.taskTextColor = this.taskTextLightColor;
|
6086 | this.taskTextOutsideColor = this.taskTextDarkColor;
|
6087 | this.transitionColor = this.transitionColor || this.lineColor;
|
6088 | this.transitionLabelColor = this.transitionLabelColor || this.textColor;
|
6089 | this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor;
|
6090 | this.stateBkg = this.stateBkg || this.mainBkg;
|
6091 | this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg;
|
6092 | this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor;
|
6093 | this.altBackground = this.altBackground || "#f0f0f0";
|
6094 | this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg;
|
6095 | this.compositeBorder = this.compositeBorder || this.nodeBorder;
|
6096 | this.innerEndBackground = this.nodeBorder;
|
6097 | this.specialStateColor = this.lineColor;
|
6098 | this.errorBkgColor = this.errorBkgColor || this.tertiaryColor;
|
6099 | this.errorTextColor = this.errorTextColor || this.tertiaryTextColor;
|
6100 | this.transitionColor = this.transitionColor || this.lineColor;
|
6101 | this.classText = this.primaryTextColor;
|
6102 | this.fillType0 = this.primaryColor;
|
6103 | this.fillType1 = this.secondaryColor;
|
6104 | this.fillType2 = adjust$1(this.primaryColor, { h: 64 });
|
6105 | this.fillType3 = adjust$1(this.secondaryColor, { h: 64 });
|
6106 | this.fillType4 = adjust$1(this.primaryColor, { h: -64 });
|
6107 | this.fillType5 = adjust$1(this.secondaryColor, { h: -64 });
|
6108 | this.fillType6 = adjust$1(this.primaryColor, { h: 128 });
|
6109 | this.fillType7 = adjust$1(this.secondaryColor, { h: 128 });
|
6110 | this.pie1 = this.pie1 || this.primaryColor;
|
6111 | this.pie2 = this.pie2 || this.secondaryColor;
|
6112 | this.pie3 = this.pie3 || adjust$1(this.tertiaryColor, { l: -40 });
|
6113 | this.pie4 = this.pie4 || adjust$1(this.primaryColor, { l: -10 });
|
6114 | this.pie5 = this.pie5 || adjust$1(this.secondaryColor, { l: -30 });
|
6115 | this.pie6 = this.pie6 || adjust$1(this.tertiaryColor, { l: -20 });
|
6116 | this.pie7 = this.pie7 || adjust$1(this.primaryColor, { h: 60, l: -20 });
|
6117 | this.pie8 = this.pie8 || adjust$1(this.primaryColor, { h: -60, l: -40 });
|
6118 | this.pie9 = this.pie9 || adjust$1(this.primaryColor, { h: 120, l: -40 });
|
6119 | this.pie10 = this.pie10 || adjust$1(this.primaryColor, { h: 60, l: -40 });
|
6120 | this.pie11 = this.pie11 || adjust$1(this.primaryColor, { h: -90, l: -40 });
|
6121 | this.pie12 = this.pie12 || adjust$1(this.primaryColor, { h: 120, l: -30 });
|
6122 | this.pieTitleTextSize = this.pieTitleTextSize || "25px";
|
6123 | this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor;
|
6124 | this.pieSectionTextSize = this.pieSectionTextSize || "17px";
|
6125 | this.pieSectionTextColor = this.pieSectionTextColor || this.textColor;
|
6126 | this.pieLegendTextSize = this.pieLegendTextSize || "17px";
|
6127 | this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor;
|
6128 | this.pieStrokeColor = this.pieStrokeColor || "black";
|
6129 | this.pieStrokeWidth = this.pieStrokeWidth || "2px";
|
6130 | this.pieOuterStrokeWidth = this.pieOuterStrokeWidth || "2px";
|
6131 | this.pieOuterStrokeColor = this.pieOuterStrokeColor || "black";
|
6132 | this.pieOpacity = this.pieOpacity || "0.7";
|
6133 | this.quadrant1Fill = this.quadrant1Fill || this.primaryColor;
|
6134 | this.quadrant2Fill = this.quadrant2Fill || adjust$1(this.primaryColor, { r: 5, g: 5, b: 5 });
|
6135 | this.quadrant3Fill = this.quadrant3Fill || adjust$1(this.primaryColor, { r: 10, g: 10, b: 10 });
|
6136 | this.quadrant4Fill = this.quadrant4Fill || adjust$1(this.primaryColor, { r: 15, g: 15, b: 15 });
|
6137 | this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor;
|
6138 | this.quadrant2TextFill = this.quadrant2TextFill || adjust$1(this.primaryTextColor, { r: -5, g: -5, b: -5 });
|
6139 | this.quadrant3TextFill = this.quadrant3TextFill || adjust$1(this.primaryTextColor, { r: -10, g: -10, b: -10 });
|
6140 | this.quadrant4TextFill = this.quadrant4TextFill || adjust$1(this.primaryTextColor, { r: -15, g: -15, b: -15 });
|
6141 | this.quadrantPointFill = this.quadrantPointFill || isDark$1(this.quadrant1Fill) ? lighten$1(this.quadrant1Fill) : darken$1(this.quadrant1Fill);
|
6142 | this.quadrantPointTextFill = this.quadrantPointTextFill || this.primaryTextColor;
|
6143 | this.quadrantXAxisTextFill = this.quadrantXAxisTextFill || this.primaryTextColor;
|
6144 | this.quadrantYAxisTextFill = this.quadrantYAxisTextFill || this.primaryTextColor;
|
6145 | this.quadrantInternalBorderStrokeFill = this.quadrantInternalBorderStrokeFill || this.primaryBorderColor;
|
6146 | this.quadrantExternalBorderStrokeFill = this.quadrantExternalBorderStrokeFill || this.primaryBorderColor;
|
6147 | this.quadrantTitleFill = this.quadrantTitleFill || this.primaryTextColor;
|
6148 | this.xyChart = {
|
6149 | backgroundColor: ((_a = this.xyChart) == null ? void 0 : _a.backgroundColor) || this.background,
|
6150 | titleColor: ((_b = this.xyChart) == null ? void 0 : _b.titleColor) || this.primaryTextColor,
|
6151 | xAxisTitleColor: ((_c = this.xyChart) == null ? void 0 : _c.xAxisTitleColor) || this.primaryTextColor,
|
6152 | xAxisLabelColor: ((_d = this.xyChart) == null ? void 0 : _d.xAxisLabelColor) || this.primaryTextColor,
|
6153 | xAxisTickColor: ((_e = this.xyChart) == null ? void 0 : _e.xAxisTickColor) || this.primaryTextColor,
|
6154 | xAxisLineColor: ((_f = this.xyChart) == null ? void 0 : _f.xAxisLineColor) || this.primaryTextColor,
|
6155 | yAxisTitleColor: ((_g = this.xyChart) == null ? void 0 : _g.yAxisTitleColor) || this.primaryTextColor,
|
6156 | yAxisLabelColor: ((_h = this.xyChart) == null ? void 0 : _h.yAxisLabelColor) || this.primaryTextColor,
|
6157 | yAxisTickColor: ((_i = this.xyChart) == null ? void 0 : _i.yAxisTickColor) || this.primaryTextColor,
|
6158 | yAxisLineColor: ((_j = this.xyChart) == null ? void 0 : _j.yAxisLineColor) || this.primaryTextColor,
|
6159 | plotColorPalette: ((_k = this.xyChart) == null ? void 0 : _k.plotColorPalette) || "#ECECFF,#8493A6,#FFC3A0,#DCDDE1,#B8E994,#D1A36F,#C3CDE6,#FFB6C1,#496078,#F8F3E3"
|
6160 | };
|
6161 | this.requirementBackground = this.requirementBackground || this.primaryColor;
|
6162 | this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor;
|
6163 | this.requirementBorderSize = this.requirementBorderSize || "1";
|
6164 | this.requirementTextColor = this.requirementTextColor || this.primaryTextColor;
|
6165 | this.relationColor = this.relationColor || this.lineColor;
|
6166 | this.relationLabelBackground = this.relationLabelBackground || this.labelBackground;
|
6167 | this.relationLabelColor = this.relationLabelColor || this.actorTextColor;
|
6168 | this.git0 = this.git0 || this.primaryColor;
|
6169 | this.git1 = this.git1 || this.secondaryColor;
|
6170 | this.git2 = this.git2 || this.tertiaryColor;
|
6171 | this.git3 = this.git3 || adjust$1(this.primaryColor, { h: -30 });
|
6172 | this.git4 = this.git4 || adjust$1(this.primaryColor, { h: -60 });
|
6173 | this.git5 = this.git5 || adjust$1(this.primaryColor, { h: -90 });
|
6174 | this.git6 = this.git6 || adjust$1(this.primaryColor, { h: 60 });
|
6175 | this.git7 = this.git7 || adjust$1(this.primaryColor, { h: 120 });
|
6176 | if (this.darkMode) {
|
6177 | this.git0 = lighten$1(this.git0, 25);
|
6178 | this.git1 = lighten$1(this.git1, 25);
|
6179 | this.git2 = lighten$1(this.git2, 25);
|
6180 | this.git3 = lighten$1(this.git3, 25);
|
6181 | this.git4 = lighten$1(this.git4, 25);
|
6182 | this.git5 = lighten$1(this.git5, 25);
|
6183 | this.git6 = lighten$1(this.git6, 25);
|
6184 | this.git7 = lighten$1(this.git7, 25);
|
6185 | } else {
|
6186 | this.git0 = darken$1(this.git0, 25);
|
6187 | this.git1 = darken$1(this.git1, 25);
|
6188 | this.git2 = darken$1(this.git2, 25);
|
6189 | this.git3 = darken$1(this.git3, 25);
|
6190 | this.git4 = darken$1(this.git4, 25);
|
6191 | this.git5 = darken$1(this.git5, 25);
|
6192 | this.git6 = darken$1(this.git6, 25);
|
6193 | this.git7 = darken$1(this.git7, 25);
|
6194 | }
|
6195 | this.gitInv0 = this.gitInv0 || darken$1(invert$1(this.git0), 25);
|
6196 | this.gitInv1 = this.gitInv1 || invert$1(this.git1);
|
6197 | this.gitInv2 = this.gitInv2 || invert$1(this.git2);
|
6198 | this.gitInv3 = this.gitInv3 || invert$1(this.git3);
|
6199 | this.gitInv4 = this.gitInv4 || invert$1(this.git4);
|
6200 | this.gitInv5 = this.gitInv5 || invert$1(this.git5);
|
6201 | this.gitInv6 = this.gitInv6 || invert$1(this.git6);
|
6202 | this.gitInv7 = this.gitInv7 || invert$1(this.git7);
|
6203 | this.gitBranchLabel0 = this.gitBranchLabel0 || invert$1(this.labelTextColor);
|
6204 | this.gitBranchLabel1 = this.gitBranchLabel1 || this.labelTextColor;
|
6205 | this.gitBranchLabel2 = this.gitBranchLabel2 || this.labelTextColor;
|
6206 | this.gitBranchLabel3 = this.gitBranchLabel3 || invert$1(this.labelTextColor);
|
6207 | this.gitBranchLabel4 = this.gitBranchLabel4 || this.labelTextColor;
|
6208 | this.gitBranchLabel5 = this.gitBranchLabel5 || this.labelTextColor;
|
6209 | this.gitBranchLabel6 = this.gitBranchLabel6 || this.labelTextColor;
|
6210 | this.gitBranchLabel7 = this.gitBranchLabel7 || this.labelTextColor;
|
6211 | this.tagLabelColor = this.tagLabelColor || this.primaryTextColor;
|
6212 | this.tagLabelBackground = this.tagLabelBackground || this.primaryColor;
|
6213 | this.tagLabelBorder = this.tagBorder || this.primaryBorderColor;
|
6214 | this.tagLabelFontSize = this.tagLabelFontSize || "10px";
|
6215 | this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor;
|
6216 | this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor;
|
6217 | this.commitLabelFontSize = this.commitLabelFontSize || "10px";
|
6218 | this.attributeBackgroundColorOdd = this.attributeBackgroundColorOdd || oldAttributeBackgroundColorOdd;
|
6219 | this.attributeBackgroundColorEven = this.attributeBackgroundColorEven || oldAttributeBackgroundColorEven;
|
6220 | }
|
6221 | calculate(overrides) {
|
6222 | if (typeof overrides !== "object") {
|
6223 | this.updateColors();
|
6224 | return;
|
6225 | }
|
6226 | const keys = Object.keys(overrides);
|
6227 | keys.forEach((k) => {
|
6228 | this[k] = overrides[k];
|
6229 | });
|
6230 | this.updateColors();
|
6231 | keys.forEach((k) => {
|
6232 | this[k] = overrides[k];
|
6233 | });
|
6234 | }
|
6235 | };
|
6236 | const getThemeVariables$2 = (userOverrides) => {
|
6237 | const theme2 = new Theme$2();
|
6238 | theme2.calculate(userOverrides);
|
6239 | return theme2;
|
6240 | };
|
6241 | let Theme$1 = class Theme4 {
|
6242 | constructor() {
|
6243 | this.background = "#f4f4f4";
|
6244 | this.primaryColor = "#cde498";
|
6245 | this.secondaryColor = "#cdffb2";
|
6246 | this.background = "white";
|
6247 | this.mainBkg = "#cde498";
|
6248 | this.secondBkg = "#cdffb2";
|
6249 | this.lineColor = "green";
|
6250 | this.border1 = "#13540c";
|
6251 | this.border2 = "#6eaa49";
|
6252 | this.arrowheadColor = "green";
|
6253 | this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif';
|
6254 | this.fontSize = "16px";
|
6255 | this.tertiaryColor = lighten$1("#cde498", 10);
|
6256 | this.primaryBorderColor = mkBorder(this.primaryColor, this.darkMode);
|
6257 | this.secondaryBorderColor = mkBorder(this.secondaryColor, this.darkMode);
|
6258 | this.tertiaryBorderColor = mkBorder(this.tertiaryColor, this.darkMode);
|
6259 | this.primaryTextColor = invert$1(this.primaryColor);
|
6260 | this.secondaryTextColor = invert$1(this.secondaryColor);
|
6261 | this.tertiaryTextColor = invert$1(this.primaryColor);
|
6262 | this.lineColor = invert$1(this.background);
|
6263 | this.textColor = invert$1(this.background);
|
6264 | this.THEME_COLOR_LIMIT = 12;
|
6265 | this.nodeBkg = "calculated";
|
6266 | this.nodeBorder = "calculated";
|
6267 | this.clusterBkg = "calculated";
|
6268 | this.clusterBorder = "calculated";
|
6269 | this.defaultLinkColor = "calculated";
|
6270 | this.titleColor = "#333";
|
6271 | this.edgeLabelBackground = "#e8e8e8";
|
6272 | this.actorBorder = "calculated";
|
6273 | this.actorBkg = "calculated";
|
6274 | this.actorTextColor = "black";
|
6275 | this.actorLineColor = "grey";
|
6276 | this.signalColor = "#333";
|
6277 | this.signalTextColor = "#333";
|
6278 | this.labelBoxBkgColor = "calculated";
|
6279 | this.labelBoxBorderColor = "#326932";
|
6280 | this.labelTextColor = "calculated";
|
6281 | this.loopTextColor = "calculated";
|
6282 | this.noteBorderColor = "calculated";
|
6283 | this.noteBkgColor = "#fff5ad";
|
6284 | this.noteTextColor = "calculated";
|
6285 | this.activationBorderColor = "#666";
|
6286 | this.activationBkgColor = "#f4f4f4";
|
6287 | this.sequenceNumberColor = "white";
|
6288 | this.sectionBkgColor = "#6eaa49";
|
6289 | this.altSectionBkgColor = "white";
|
6290 | this.sectionBkgColor2 = "#6eaa49";
|
6291 | this.excludeBkgColor = "#eeeeee";
|
6292 | this.taskBorderColor = "calculated";
|
6293 | this.taskBkgColor = "#487e3a";
|
6294 | this.taskTextLightColor = "white";
|
6295 | this.taskTextColor = "calculated";
|
6296 | this.taskTextDarkColor = "black";
|
6297 | this.taskTextOutsideColor = "calculated";
|
6298 | this.taskTextClickableColor = "#003163";
|
6299 | this.activeTaskBorderColor = "calculated";
|
6300 | this.activeTaskBkgColor = "calculated";
|
6301 | this.gridColor = "lightgrey";
|
6302 | this.doneTaskBkgColor = "lightgrey";
|
6303 | this.doneTaskBorderColor = "grey";
|
6304 | this.critBorderColor = "#ff8888";
|
6305 | this.critBkgColor = "red";
|
6306 | this.todayLineColor = "red";
|
6307 | this.personBorder = this.primaryBorderColor;
|
6308 | this.personBkg = this.mainBkg;
|
6309 | this.labelColor = "black";
|
6310 | this.errorBkgColor = "#552222";
|
6311 | this.errorTextColor = "#552222";
|
6312 | }
|
6313 | updateColors() {
|
6314 | var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
6315 | this.actorBorder = darken$1(this.mainBkg, 20);
|
6316 | this.actorBkg = this.mainBkg;
|
6317 | this.labelBoxBkgColor = this.actorBkg;
|
6318 | this.labelTextColor = this.actorTextColor;
|
6319 | this.loopTextColor = this.actorTextColor;
|
6320 | this.noteBorderColor = this.border2;
|
6321 | this.noteTextColor = this.actorTextColor;
|
6322 | this.cScale0 = this.cScale0 || this.primaryColor;
|
6323 | this.cScale1 = this.cScale1 || this.secondaryColor;
|
6324 | this.cScale2 = this.cScale2 || this.tertiaryColor;
|
6325 | this.cScale3 = this.cScale3 || adjust$1(this.primaryColor, { h: 30 });
|
6326 | this.cScale4 = this.cScale4 || adjust$1(this.primaryColor, { h: 60 });
|
6327 | this.cScale5 = this.cScale5 || adjust$1(this.primaryColor, { h: 90 });
|
6328 | this.cScale6 = this.cScale6 || adjust$1(this.primaryColor, { h: 120 });
|
6329 | this.cScale7 = this.cScale7 || adjust$1(this.primaryColor, { h: 150 });
|
6330 | this.cScale8 = this.cScale8 || adjust$1(this.primaryColor, { h: 210 });
|
6331 | this.cScale9 = this.cScale9 || adjust$1(this.primaryColor, { h: 270 });
|
6332 | this.cScale10 = this.cScale10 || adjust$1(this.primaryColor, { h: 300 });
|
6333 | this.cScale11 = this.cScale11 || adjust$1(this.primaryColor, { h: 330 });
|
6334 | this["cScalePeer1"] = this["cScalePeer1"] || darken$1(this.secondaryColor, 45);
|
6335 | this["cScalePeer2"] = this["cScalePeer2"] || darken$1(this.tertiaryColor, 40);
|
6336 | for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
|
6337 | this["cScale" + i] = darken$1(this["cScale" + i], 10);
|
6338 | this["cScalePeer" + i] = this["cScalePeer" + i] || darken$1(this["cScale" + i], 25);
|
6339 | }
|
6340 | for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
|
6341 | this["cScaleInv" + i] = this["cScaleInv" + i] || adjust$1(this["cScale" + i], { h: 180 });
|
6342 | }
|
6343 | this.scaleLabelColor = this.scaleLabelColor !== "calculated" && this.scaleLabelColor ? this.scaleLabelColor : this.labelTextColor;
|
6344 | for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
|
6345 | this["cScaleLabel" + i] = this["cScaleLabel" + i] || this.scaleLabelColor;
|
6346 | }
|
6347 | for (let i = 0; i < 5; i++) {
|
6348 | this["surface" + i] = this["surface" + i] || adjust$1(this.mainBkg, { h: 30, s: -30, l: -(5 + i * 5) });
|
6349 | this["surfacePeer" + i] = this["surfacePeer" + i] || adjust$1(this.mainBkg, { h: 30, s: -30, l: -(8 + i * 5) });
|
6350 | }
|
6351 | this.nodeBkg = this.mainBkg;
|
6352 | this.nodeBorder = this.border1;
|
6353 | this.clusterBkg = this.secondBkg;
|
6354 | this.clusterBorder = this.border2;
|
6355 | this.defaultLinkColor = this.lineColor;
|
6356 | this.taskBorderColor = this.border1;
|
6357 | this.taskTextColor = this.taskTextLightColor;
|
6358 | this.taskTextOutsideColor = this.taskTextDarkColor;
|
6359 | this.activeTaskBorderColor = this.taskBorderColor;
|
6360 | this.activeTaskBkgColor = this.mainBkg;
|
6361 | this.transitionColor = this.transitionColor || this.lineColor;
|
6362 | this.transitionLabelColor = this.transitionLabelColor || this.textColor;
|
6363 | this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor;
|
6364 | this.stateBkg = this.stateBkg || this.mainBkg;
|
6365 | this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg;
|
6366 | this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor;
|
6367 | this.altBackground = this.altBackground || "#f0f0f0";
|
6368 | this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg;
|
6369 | this.compositeBorder = this.compositeBorder || this.nodeBorder;
|
6370 | this.innerEndBackground = this.primaryBorderColor;
|
6371 | this.specialStateColor = this.lineColor;
|
6372 | this.errorBkgColor = this.errorBkgColor || this.tertiaryColor;
|
6373 | this.errorTextColor = this.errorTextColor || this.tertiaryTextColor;
|
6374 | this.transitionColor = this.transitionColor || this.lineColor;
|
6375 | this.classText = this.primaryTextColor;
|
6376 | this.fillType0 = this.primaryColor;
|
6377 | this.fillType1 = this.secondaryColor;
|
6378 | this.fillType2 = adjust$1(this.primaryColor, { h: 64 });
|
6379 | this.fillType3 = adjust$1(this.secondaryColor, { h: 64 });
|
6380 | this.fillType4 = adjust$1(this.primaryColor, { h: -64 });
|
6381 | this.fillType5 = adjust$1(this.secondaryColor, { h: -64 });
|
6382 | this.fillType6 = adjust$1(this.primaryColor, { h: 128 });
|
6383 | this.fillType7 = adjust$1(this.secondaryColor, { h: 128 });
|
6384 | this.pie1 = this.pie1 || this.primaryColor;
|
6385 | this.pie2 = this.pie2 || this.secondaryColor;
|
6386 | this.pie3 = this.pie3 || this.tertiaryColor;
|
6387 | this.pie4 = this.pie4 || adjust$1(this.primaryColor, { l: -30 });
|
6388 | this.pie5 = this.pie5 || adjust$1(this.secondaryColor, { l: -30 });
|
6389 | this.pie6 = this.pie6 || adjust$1(this.tertiaryColor, { h: 40, l: -40 });
|
6390 | this.pie7 = this.pie7 || adjust$1(this.primaryColor, { h: 60, l: -10 });
|
6391 | this.pie8 = this.pie8 || adjust$1(this.primaryColor, { h: -60, l: -10 });
|
6392 | this.pie9 = this.pie9 || adjust$1(this.primaryColor, { h: 120, l: 0 });
|
6393 | this.pie10 = this.pie10 || adjust$1(this.primaryColor, { h: 60, l: -50 });
|
6394 | this.pie11 = this.pie11 || adjust$1(this.primaryColor, { h: -60, l: -50 });
|
6395 | this.pie12 = this.pie12 || adjust$1(this.primaryColor, { h: 120, l: -50 });
|
6396 | this.pieTitleTextSize = this.pieTitleTextSize || "25px";
|
6397 | this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor;
|
6398 | this.pieSectionTextSize = this.pieSectionTextSize || "17px";
|
6399 | this.pieSectionTextColor = this.pieSectionTextColor || this.textColor;
|
6400 | this.pieLegendTextSize = this.pieLegendTextSize || "17px";
|
6401 | this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor;
|
6402 | this.pieStrokeColor = this.pieStrokeColor || "black";
|
6403 | this.pieStrokeWidth = this.pieStrokeWidth || "2px";
|
6404 | this.pieOuterStrokeWidth = this.pieOuterStrokeWidth || "2px";
|
6405 | this.pieOuterStrokeColor = this.pieOuterStrokeColor || "black";
|
6406 | this.pieOpacity = this.pieOpacity || "0.7";
|
6407 | this.quadrant1Fill = this.quadrant1Fill || this.primaryColor;
|
6408 | this.quadrant2Fill = this.quadrant2Fill || adjust$1(this.primaryColor, { r: 5, g: 5, b: 5 });
|
6409 | this.quadrant3Fill = this.quadrant3Fill || adjust$1(this.primaryColor, { r: 10, g: 10, b: 10 });
|
6410 | this.quadrant4Fill = this.quadrant4Fill || adjust$1(this.primaryColor, { r: 15, g: 15, b: 15 });
|
6411 | this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor;
|
6412 | this.quadrant2TextFill = this.quadrant2TextFill || adjust$1(this.primaryTextColor, { r: -5, g: -5, b: -5 });
|
6413 | this.quadrant3TextFill = this.quadrant3TextFill || adjust$1(this.primaryTextColor, { r: -10, g: -10, b: -10 });
|
6414 | this.quadrant4TextFill = this.quadrant4TextFill || adjust$1(this.primaryTextColor, { r: -15, g: -15, b: -15 });
|
6415 | this.quadrantPointFill = this.quadrantPointFill || isDark$1(this.quadrant1Fill) ? lighten$1(this.quadrant1Fill) : darken$1(this.quadrant1Fill);
|
6416 | this.quadrantPointTextFill = this.quadrantPointTextFill || this.primaryTextColor;
|
6417 | this.quadrantXAxisTextFill = this.quadrantXAxisTextFill || this.primaryTextColor;
|
6418 | this.quadrantYAxisTextFill = this.quadrantYAxisTextFill || this.primaryTextColor;
|
6419 | this.quadrantInternalBorderStrokeFill = this.quadrantInternalBorderStrokeFill || this.primaryBorderColor;
|
6420 | this.quadrantExternalBorderStrokeFill = this.quadrantExternalBorderStrokeFill || this.primaryBorderColor;
|
6421 | this.quadrantTitleFill = this.quadrantTitleFill || this.primaryTextColor;
|
6422 | this.xyChart = {
|
6423 | backgroundColor: ((_a = this.xyChart) == null ? void 0 : _a.backgroundColor) || this.background,
|
6424 | titleColor: ((_b = this.xyChart) == null ? void 0 : _b.titleColor) || this.primaryTextColor,
|
6425 | xAxisTitleColor: ((_c = this.xyChart) == null ? void 0 : _c.xAxisTitleColor) || this.primaryTextColor,
|
6426 | xAxisLabelColor: ((_d = this.xyChart) == null ? void 0 : _d.xAxisLabelColor) || this.primaryTextColor,
|
6427 | xAxisTickColor: ((_e = this.xyChart) == null ? void 0 : _e.xAxisTickColor) || this.primaryTextColor,
|
6428 | xAxisLineColor: ((_f = this.xyChart) == null ? void 0 : _f.xAxisLineColor) || this.primaryTextColor,
|
6429 | yAxisTitleColor: ((_g = this.xyChart) == null ? void 0 : _g.yAxisTitleColor) || this.primaryTextColor,
|
6430 | yAxisLabelColor: ((_h = this.xyChart) == null ? void 0 : _h.yAxisLabelColor) || this.primaryTextColor,
|
6431 | yAxisTickColor: ((_i = this.xyChart) == null ? void 0 : _i.yAxisTickColor) || this.primaryTextColor,
|
6432 | yAxisLineColor: ((_j = this.xyChart) == null ? void 0 : _j.yAxisLineColor) || this.primaryTextColor,
|
6433 | plotColorPalette: ((_k = this.xyChart) == null ? void 0 : _k.plotColorPalette) || "#CDE498,#FF6B6B,#A0D2DB,#D7BDE2,#F0F0F0,#FFC3A0,#7FD8BE,#FF9A8B,#FAF3E0,#FFF176"
|
6434 | };
|
6435 | this.requirementBackground = this.requirementBackground || this.primaryColor;
|
6436 | this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor;
|
6437 | this.requirementBorderSize = this.requirementBorderSize || "1";
|
6438 | this.requirementTextColor = this.requirementTextColor || this.primaryTextColor;
|
6439 | this.relationColor = this.relationColor || this.lineColor;
|
6440 | this.relationLabelBackground = this.relationLabelBackground || this.edgeLabelBackground;
|
6441 | this.relationLabelColor = this.relationLabelColor || this.actorTextColor;
|
6442 | this.git0 = this.git0 || this.primaryColor;
|
6443 | this.git1 = this.git1 || this.secondaryColor;
|
6444 | this.git2 = this.git2 || this.tertiaryColor;
|
6445 | this.git3 = this.git3 || adjust$1(this.primaryColor, { h: -30 });
|
6446 | this.git4 = this.git4 || adjust$1(this.primaryColor, { h: -60 });
|
6447 | this.git5 = this.git5 || adjust$1(this.primaryColor, { h: -90 });
|
6448 | this.git6 = this.git6 || adjust$1(this.primaryColor, { h: 60 });
|
6449 | this.git7 = this.git7 || adjust$1(this.primaryColor, { h: 120 });
|
6450 | if (this.darkMode) {
|
6451 | this.git0 = lighten$1(this.git0, 25);
|
6452 | this.git1 = lighten$1(this.git1, 25);
|
6453 | this.git2 = lighten$1(this.git2, 25);
|
6454 | this.git3 = lighten$1(this.git3, 25);
|
6455 | this.git4 = lighten$1(this.git4, 25);
|
6456 | this.git5 = lighten$1(this.git5, 25);
|
6457 | this.git6 = lighten$1(this.git6, 25);
|
6458 | this.git7 = lighten$1(this.git7, 25);
|
6459 | } else {
|
6460 | this.git0 = darken$1(this.git0, 25);
|
6461 | this.git1 = darken$1(this.git1, 25);
|
6462 | this.git2 = darken$1(this.git2, 25);
|
6463 | this.git3 = darken$1(this.git3, 25);
|
6464 | this.git4 = darken$1(this.git4, 25);
|
6465 | this.git5 = darken$1(this.git5, 25);
|
6466 | this.git6 = darken$1(this.git6, 25);
|
6467 | this.git7 = darken$1(this.git7, 25);
|
6468 | }
|
6469 | this.gitInv0 = this.gitInv0 || invert$1(this.git0);
|
6470 | this.gitInv1 = this.gitInv1 || invert$1(this.git1);
|
6471 | this.gitInv2 = this.gitInv2 || invert$1(this.git2);
|
6472 | this.gitInv3 = this.gitInv3 || invert$1(this.git3);
|
6473 | this.gitInv4 = this.gitInv4 || invert$1(this.git4);
|
6474 | this.gitInv5 = this.gitInv5 || invert$1(this.git5);
|
6475 | this.gitInv6 = this.gitInv6 || invert$1(this.git6);
|
6476 | this.gitInv7 = this.gitInv7 || invert$1(this.git7);
|
6477 | this.gitBranchLabel0 = this.gitBranchLabel0 || invert$1(this.labelTextColor);
|
6478 | this.gitBranchLabel1 = this.gitBranchLabel1 || this.labelTextColor;
|
6479 | this.gitBranchLabel2 = this.gitBranchLabel2 || this.labelTextColor;
|
6480 | this.gitBranchLabel3 = this.gitBranchLabel3 || invert$1(this.labelTextColor);
|
6481 | this.gitBranchLabel4 = this.gitBranchLabel4 || this.labelTextColor;
|
6482 | this.gitBranchLabel5 = this.gitBranchLabel5 || this.labelTextColor;
|
6483 | this.gitBranchLabel6 = this.gitBranchLabel6 || this.labelTextColor;
|
6484 | this.gitBranchLabel7 = this.gitBranchLabel7 || this.labelTextColor;
|
6485 | this.tagLabelColor = this.tagLabelColor || this.primaryTextColor;
|
6486 | this.tagLabelBackground = this.tagLabelBackground || this.primaryColor;
|
6487 | this.tagLabelBorder = this.tagBorder || this.primaryBorderColor;
|
6488 | this.tagLabelFontSize = this.tagLabelFontSize || "10px";
|
6489 | this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor;
|
6490 | this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor;
|
6491 | this.commitLabelFontSize = this.commitLabelFontSize || "10px";
|
6492 | this.attributeBackgroundColorOdd = this.attributeBackgroundColorOdd || oldAttributeBackgroundColorOdd;
|
6493 | this.attributeBackgroundColorEven = this.attributeBackgroundColorEven || oldAttributeBackgroundColorEven;
|
6494 | }
|
6495 | calculate(overrides) {
|
6496 | if (typeof overrides !== "object") {
|
6497 | this.updateColors();
|
6498 | return;
|
6499 | }
|
6500 | const keys = Object.keys(overrides);
|
6501 | keys.forEach((k) => {
|
6502 | this[k] = overrides[k];
|
6503 | });
|
6504 | this.updateColors();
|
6505 | keys.forEach((k) => {
|
6506 | this[k] = overrides[k];
|
6507 | });
|
6508 | }
|
6509 | };
|
6510 | const getThemeVariables$1 = (userOverrides) => {
|
6511 | const theme2 = new Theme$1();
|
6512 | theme2.calculate(userOverrides);
|
6513 | return theme2;
|
6514 | };
|
6515 | class Theme5 {
|
6516 | constructor() {
|
6517 | this.primaryColor = "#eee";
|
6518 | this.contrast = "#707070";
|
6519 | this.secondaryColor = lighten$1(this.contrast, 55);
|
6520 | this.background = "#ffffff";
|
6521 | this.tertiaryColor = adjust$1(this.primaryColor, { h: -160 });
|
6522 | this.primaryBorderColor = mkBorder(this.primaryColor, this.darkMode);
|
6523 | this.secondaryBorderColor = mkBorder(this.secondaryColor, this.darkMode);
|
6524 | this.tertiaryBorderColor = mkBorder(this.tertiaryColor, this.darkMode);
|
6525 | this.primaryTextColor = invert$1(this.primaryColor);
|
6526 | this.secondaryTextColor = invert$1(this.secondaryColor);
|
6527 | this.tertiaryTextColor = invert$1(this.tertiaryColor);
|
6528 | this.lineColor = invert$1(this.background);
|
6529 | this.textColor = invert$1(this.background);
|
6530 | this.mainBkg = "#eee";
|
6531 | this.secondBkg = "calculated";
|
6532 | this.lineColor = "#666";
|
6533 | this.border1 = "#999";
|
6534 | this.border2 = "calculated";
|
6535 | this.note = "#ffa";
|
6536 | this.text = "#333";
|
6537 | this.critical = "#d42";
|
6538 | this.done = "#bbb";
|
6539 | this.arrowheadColor = "#333333";
|
6540 | this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif';
|
6541 | this.fontSize = "16px";
|
6542 | this.THEME_COLOR_LIMIT = 12;
|
6543 | this.nodeBkg = "calculated";
|
6544 | this.nodeBorder = "calculated";
|
6545 | this.clusterBkg = "calculated";
|
6546 | this.clusterBorder = "calculated";
|
6547 | this.defaultLinkColor = "calculated";
|
6548 | this.titleColor = "calculated";
|
6549 | this.edgeLabelBackground = "white";
|
6550 | this.actorBorder = "calculated";
|
6551 | this.actorBkg = "calculated";
|
6552 | this.actorTextColor = "calculated";
|
6553 | this.actorLineColor = "calculated";
|
6554 | this.signalColor = "calculated";
|
6555 | this.signalTextColor = "calculated";
|
6556 | this.labelBoxBkgColor = "calculated";
|
6557 | this.labelBoxBorderColor = "calculated";
|
6558 | this.labelTextColor = "calculated";
|
6559 | this.loopTextColor = "calculated";
|
6560 | this.noteBorderColor = "calculated";
|
6561 | this.noteBkgColor = "calculated";
|
6562 | this.noteTextColor = "calculated";
|
6563 | this.activationBorderColor = "#666";
|
6564 | this.activationBkgColor = "#f4f4f4";
|
6565 | this.sequenceNumberColor = "white";
|
6566 | this.sectionBkgColor = "calculated";
|
6567 | this.altSectionBkgColor = "white";
|
6568 | this.sectionBkgColor2 = "calculated";
|
6569 | this.excludeBkgColor = "#eeeeee";
|
6570 | this.taskBorderColor = "calculated";
|
6571 | this.taskBkgColor = "calculated";
|
6572 | this.taskTextLightColor = "white";
|
6573 | this.taskTextColor = "calculated";
|
6574 | this.taskTextDarkColor = "calculated";
|
6575 | this.taskTextOutsideColor = "calculated";
|
6576 | this.taskTextClickableColor = "#003163";
|
6577 | this.activeTaskBorderColor = "calculated";
|
6578 | this.activeTaskBkgColor = "calculated";
|
6579 | this.gridColor = "calculated";
|
6580 | this.doneTaskBkgColor = "calculated";
|
6581 | this.doneTaskBorderColor = "calculated";
|
6582 | this.critBkgColor = "calculated";
|
6583 | this.critBorderColor = "calculated";
|
6584 | this.todayLineColor = "calculated";
|
6585 | this.personBorder = this.primaryBorderColor;
|
6586 | this.personBkg = this.mainBkg;
|
6587 | this.labelColor = "black";
|
6588 | this.errorBkgColor = "#552222";
|
6589 | this.errorTextColor = "#552222";
|
6590 | }
|
6591 | updateColors() {
|
6592 | var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
6593 | this.secondBkg = lighten$1(this.contrast, 55);
|
6594 | this.border2 = this.contrast;
|
6595 | this.actorBorder = lighten$1(this.border1, 23);
|
6596 | this.actorBkg = this.mainBkg;
|
6597 | this.actorTextColor = this.text;
|
6598 | this.actorLineColor = this.lineColor;
|
6599 | this.signalColor = this.text;
|
6600 | this.signalTextColor = this.text;
|
6601 | this.labelBoxBkgColor = this.actorBkg;
|
6602 | this.labelBoxBorderColor = this.actorBorder;
|
6603 | this.labelTextColor = this.text;
|
6604 | this.loopTextColor = this.text;
|
6605 | this.noteBorderColor = "#999";
|
6606 | this.noteBkgColor = "#666";
|
6607 | this.noteTextColor = "#fff";
|
6608 | this.cScale0 = this.cScale0 || "#555";
|
6609 | this.cScale1 = this.cScale1 || "#F4F4F4";
|
6610 | this.cScale2 = this.cScale2 || "#555";
|
6611 | this.cScale3 = this.cScale3 || "#BBB";
|
6612 | this.cScale4 = this.cScale4 || "#777";
|
6613 | this.cScale5 = this.cScale5 || "#999";
|
6614 | this.cScale6 = this.cScale6 || "#DDD";
|
6615 | this.cScale7 = this.cScale7 || "#FFF";
|
6616 | this.cScale8 = this.cScale8 || "#DDD";
|
6617 | this.cScale9 = this.cScale9 || "#BBB";
|
6618 | this.cScale10 = this.cScale10 || "#999";
|
6619 | this.cScale11 = this.cScale11 || "#777";
|
6620 | for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
|
6621 | this["cScaleInv" + i] = this["cScaleInv" + i] || invert$1(this["cScale" + i]);
|
6622 | }
|
6623 | for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
|
6624 | if (this.darkMode) {
|
6625 | this["cScalePeer" + i] = this["cScalePeer" + i] || lighten$1(this["cScale" + i], 10);
|
6626 | } else {
|
6627 | this["cScalePeer" + i] = this["cScalePeer" + i] || darken$1(this["cScale" + i], 10);
|
6628 | }
|
6629 | }
|
6630 | this.scaleLabelColor = this.scaleLabelColor || (this.darkMode ? "black" : this.labelTextColor);
|
6631 | this["cScaleLabel0"] = this["cScaleLabel0"] || this.cScale1;
|
6632 | this["cScaleLabel2"] = this["cScaleLabel2"] || this.cScale1;
|
6633 | for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
|
6634 | this["cScaleLabel" + i] = this["cScaleLabel" + i] || this.scaleLabelColor;
|
6635 | }
|
6636 | for (let i = 0; i < 5; i++) {
|
6637 | this["surface" + i] = this["surface" + i] || adjust$1(this.mainBkg, { l: -(5 + i * 5) });
|
6638 | this["surfacePeer" + i] = this["surfacePeer" + i] || adjust$1(this.mainBkg, { l: -(8 + i * 5) });
|
6639 | }
|
6640 | this.nodeBkg = this.mainBkg;
|
6641 | this.nodeBorder = this.border1;
|
6642 | this.clusterBkg = this.secondBkg;
|
6643 | this.clusterBorder = this.border2;
|
6644 | this.defaultLinkColor = this.lineColor;
|
6645 | this.titleColor = this.text;
|
6646 | this.sectionBkgColor = lighten$1(this.contrast, 30);
|
6647 | this.sectionBkgColor2 = lighten$1(this.contrast, 30);
|
6648 | this.taskBorderColor = darken$1(this.contrast, 10);
|
6649 | this.taskBkgColor = this.contrast;
|
6650 | this.taskTextColor = this.taskTextLightColor;
|
6651 | this.taskTextDarkColor = this.text;
|
6652 | this.taskTextOutsideColor = this.taskTextDarkColor;
|
6653 | this.activeTaskBorderColor = this.taskBorderColor;
|
6654 | this.activeTaskBkgColor = this.mainBkg;
|
6655 | this.gridColor = lighten$1(this.border1, 30);
|
6656 | this.doneTaskBkgColor = this.done;
|
6657 | this.doneTaskBorderColor = this.lineColor;
|
6658 | this.critBkgColor = this.critical;
|
6659 | this.critBorderColor = darken$1(this.critBkgColor, 10);
|
6660 | this.todayLineColor = this.critBkgColor;
|
6661 | this.transitionColor = this.transitionColor || "#000";
|
6662 | this.transitionLabelColor = this.transitionLabelColor || this.textColor;
|
6663 | this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor;
|
6664 | this.stateBkg = this.stateBkg || this.mainBkg;
|
6665 | this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg;
|
6666 | this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor;
|
6667 | this.altBackground = this.altBackground || "#f4f4f4";
|
6668 | this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg;
|
6669 | this.stateBorder = this.stateBorder || "#000";
|
6670 | this.innerEndBackground = this.primaryBorderColor;
|
6671 | this.specialStateColor = "#222";
|
6672 | this.errorBkgColor = this.errorBkgColor || this.tertiaryColor;
|
6673 | this.errorTextColor = this.errorTextColor || this.tertiaryTextColor;
|
6674 | this.classText = this.primaryTextColor;
|
6675 | this.fillType0 = this.primaryColor;
|
6676 | this.fillType1 = this.secondaryColor;
|
6677 | this.fillType2 = adjust$1(this.primaryColor, { h: 64 });
|
6678 | this.fillType3 = adjust$1(this.secondaryColor, { h: 64 });
|
6679 | this.fillType4 = adjust$1(this.primaryColor, { h: -64 });
|
6680 | this.fillType5 = adjust$1(this.secondaryColor, { h: -64 });
|
6681 | this.fillType6 = adjust$1(this.primaryColor, { h: 128 });
|
6682 | this.fillType7 = adjust$1(this.secondaryColor, { h: 128 });
|
6683 | for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
|
6684 | this["pie" + i] = this["cScale" + i];
|
6685 | }
|
6686 | this.pie12 = this.pie0;
|
6687 | this.pieTitleTextSize = this.pieTitleTextSize || "25px";
|
6688 | this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor;
|
6689 | this.pieSectionTextSize = this.pieSectionTextSize || "17px";
|
6690 | this.pieSectionTextColor = this.pieSectionTextColor || this.textColor;
|
6691 | this.pieLegendTextSize = this.pieLegendTextSize || "17px";
|
6692 | this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor;
|
6693 | this.pieStrokeColor = this.pieStrokeColor || "black";
|
6694 | this.pieStrokeWidth = this.pieStrokeWidth || "2px";
|
6695 | this.pieOuterStrokeWidth = this.pieOuterStrokeWidth || "2px";
|
6696 | this.pieOuterStrokeColor = this.pieOuterStrokeColor || "black";
|
6697 | this.pieOpacity = this.pieOpacity || "0.7";
|
6698 | this.quadrant1Fill = this.quadrant1Fill || this.primaryColor;
|
6699 | this.quadrant2Fill = this.quadrant2Fill || adjust$1(this.primaryColor, { r: 5, g: 5, b: 5 });
|
6700 | this.quadrant3Fill = this.quadrant3Fill || adjust$1(this.primaryColor, { r: 10, g: 10, b: 10 });
|
6701 | this.quadrant4Fill = this.quadrant4Fill || adjust$1(this.primaryColor, { r: 15, g: 15, b: 15 });
|
6702 | this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor;
|
6703 | this.quadrant2TextFill = this.quadrant2TextFill || adjust$1(this.primaryTextColor, { r: -5, g: -5, b: -5 });
|
6704 | this.quadrant3TextFill = this.quadrant3TextFill || adjust$1(this.primaryTextColor, { r: -10, g: -10, b: -10 });
|
6705 | this.quadrant4TextFill = this.quadrant4TextFill || adjust$1(this.primaryTextColor, { r: -15, g: -15, b: -15 });
|
6706 | this.quadrantPointFill = this.quadrantPointFill || isDark$1(this.quadrant1Fill) ? lighten$1(this.quadrant1Fill) : darken$1(this.quadrant1Fill);
|
6707 | this.quadrantPointTextFill = this.quadrantPointTextFill || this.primaryTextColor;
|
6708 | this.quadrantXAxisTextFill = this.quadrantXAxisTextFill || this.primaryTextColor;
|
6709 | this.quadrantYAxisTextFill = this.quadrantYAxisTextFill || this.primaryTextColor;
|
6710 | this.quadrantInternalBorderStrokeFill = this.quadrantInternalBorderStrokeFill || this.primaryBorderColor;
|
6711 | this.quadrantExternalBorderStrokeFill = this.quadrantExternalBorderStrokeFill || this.primaryBorderColor;
|
6712 | this.quadrantTitleFill = this.quadrantTitleFill || this.primaryTextColor;
|
6713 | this.xyChart = {
|
6714 | backgroundColor: ((_a = this.xyChart) == null ? void 0 : _a.backgroundColor) || this.background,
|
6715 | titleColor: ((_b = this.xyChart) == null ? void 0 : _b.titleColor) || this.primaryTextColor,
|
6716 | xAxisTitleColor: ((_c = this.xyChart) == null ? void 0 : _c.xAxisTitleColor) || this.primaryTextColor,
|
6717 | xAxisLabelColor: ((_d = this.xyChart) == null ? void 0 : _d.xAxisLabelColor) || this.primaryTextColor,
|
6718 | xAxisTickColor: ((_e = this.xyChart) == null ? void 0 : _e.xAxisTickColor) || this.primaryTextColor,
|
6719 | xAxisLineColor: ((_f = this.xyChart) == null ? void 0 : _f.xAxisLineColor) || this.primaryTextColor,
|
6720 | yAxisTitleColor: ((_g = this.xyChart) == null ? void 0 : _g.yAxisTitleColor) || this.primaryTextColor,
|
6721 | yAxisLabelColor: ((_h = this.xyChart) == null ? void 0 : _h.yAxisLabelColor) || this.primaryTextColor,
|
6722 | yAxisTickColor: ((_i = this.xyChart) == null ? void 0 : _i.yAxisTickColor) || this.primaryTextColor,
|
6723 | yAxisLineColor: ((_j = this.xyChart) == null ? void 0 : _j.yAxisLineColor) || this.primaryTextColor,
|
6724 | plotColorPalette: ((_k = this.xyChart) == null ? void 0 : _k.plotColorPalette) || "#EEE,#6BB8E4,#8ACB88,#C7ACD6,#E8DCC2,#FFB2A8,#FFF380,#7E8D91,#FFD8B1,#FAF3E0"
|
6725 | };
|
6726 | this.requirementBackground = this.requirementBackground || this.primaryColor;
|
6727 | this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor;
|
6728 | this.requirementBorderSize = this.requirementBorderSize || "1";
|
6729 | this.requirementTextColor = this.requirementTextColor || this.primaryTextColor;
|
6730 | this.relationColor = this.relationColor || this.lineColor;
|
6731 | this.relationLabelBackground = this.relationLabelBackground || this.edgeLabelBackground;
|
6732 | this.relationLabelColor = this.relationLabelColor || this.actorTextColor;
|
6733 | this.git0 = darken$1(this.pie1, 25) || this.primaryColor;
|
6734 | this.git1 = this.pie2 || this.secondaryColor;
|
6735 | this.git2 = this.pie3 || this.tertiaryColor;
|
6736 | this.git3 = this.pie4 || adjust$1(this.primaryColor, { h: -30 });
|
6737 | this.git4 = this.pie5 || adjust$1(this.primaryColor, { h: -60 });
|
6738 | this.git5 = this.pie6 || adjust$1(this.primaryColor, { h: -90 });
|
6739 | this.git6 = this.pie7 || adjust$1(this.primaryColor, { h: 60 });
|
6740 | this.git7 = this.pie8 || adjust$1(this.primaryColor, { h: 120 });
|
6741 | this.gitInv0 = this.gitInv0 || invert$1(this.git0);
|
6742 | this.gitInv1 = this.gitInv1 || invert$1(this.git1);
|
6743 | this.gitInv2 = this.gitInv2 || invert$1(this.git2);
|
6744 | this.gitInv3 = this.gitInv3 || invert$1(this.git3);
|
6745 | this.gitInv4 = this.gitInv4 || invert$1(this.git4);
|
6746 | this.gitInv5 = this.gitInv5 || invert$1(this.git5);
|
6747 | this.gitInv6 = this.gitInv6 || invert$1(this.git6);
|
6748 | this.gitInv7 = this.gitInv7 || invert$1(this.git7);
|
6749 | this.branchLabelColor = this.branchLabelColor || this.labelTextColor;
|
6750 | this.gitBranchLabel0 = this.branchLabelColor;
|
6751 | this.gitBranchLabel1 = "white";
|
6752 | this.gitBranchLabel2 = this.branchLabelColor;
|
6753 | this.gitBranchLabel3 = "white";
|
6754 | this.gitBranchLabel4 = this.branchLabelColor;
|
6755 | this.gitBranchLabel5 = this.branchLabelColor;
|
6756 | this.gitBranchLabel6 = this.branchLabelColor;
|
6757 | this.gitBranchLabel7 = this.branchLabelColor;
|
6758 | this.tagLabelColor = this.tagLabelColor || this.primaryTextColor;
|
6759 | this.tagLabelBackground = this.tagLabelBackground || this.primaryColor;
|
6760 | this.tagLabelBorder = this.tagBorder || this.primaryBorderColor;
|
6761 | this.tagLabelFontSize = this.tagLabelFontSize || "10px";
|
6762 | this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor;
|
6763 | this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor;
|
6764 | this.commitLabelFontSize = this.commitLabelFontSize || "10px";
|
6765 | this.attributeBackgroundColorOdd = this.attributeBackgroundColorOdd || oldAttributeBackgroundColorOdd;
|
6766 | this.attributeBackgroundColorEven = this.attributeBackgroundColorEven || oldAttributeBackgroundColorEven;
|
6767 | }
|
6768 | calculate(overrides) {
|
6769 | if (typeof overrides !== "object") {
|
6770 | this.updateColors();
|
6771 | return;
|
6772 | }
|
6773 | const keys = Object.keys(overrides);
|
6774 | keys.forEach((k) => {
|
6775 | this[k] = overrides[k];
|
6776 | });
|
6777 | this.updateColors();
|
6778 | keys.forEach((k) => {
|
6779 | this[k] = overrides[k];
|
6780 | });
|
6781 | }
|
6782 | }
|
6783 | const getThemeVariables = (userOverrides) => {
|
6784 | const theme2 = new Theme5();
|
6785 | theme2.calculate(userOverrides);
|
6786 | return theme2;
|
6787 | };
|
6788 | const theme = {
|
6789 | base: {
|
6790 | getThemeVariables: getThemeVariables$4
|
6791 | },
|
6792 | dark: {
|
6793 | getThemeVariables: getThemeVariables$3
|
6794 | },
|
6795 | default: {
|
6796 | getThemeVariables: getThemeVariables$2
|
6797 | },
|
6798 | forest: {
|
6799 | getThemeVariables: getThemeVariables$1
|
6800 | },
|
6801 | neutral: {
|
6802 | getThemeVariables
|
6803 | }
|
6804 | };
|
6805 | const defaultConfigJson = {
|
6806 | "flowchart": {
|
6807 | "useMaxWidth": true,
|
6808 | "titleTopMargin": 25,
|
6809 | "subGraphTitleMargin": {
|
6810 | "top": 0,
|
6811 | "bottom": 0
|
6812 | },
|
6813 | "diagramPadding": 8,
|
6814 | "htmlLabels": true,
|
6815 | "nodeSpacing": 50,
|
6816 | "rankSpacing": 50,
|
6817 | "curve": "basis",
|
6818 | "padding": 15,
|
6819 | "defaultRenderer": "dagre-wrapper",
|
6820 | "wrappingWidth": 200
|
6821 | },
|
6822 | "sequence": {
|
6823 | "useMaxWidth": true,
|
6824 | "hideUnusedParticipants": false,
|
6825 | "activationWidth": 10,
|
6826 | "diagramMarginX": 50,
|
6827 | "diagramMarginY": 10,
|
6828 | "actorMargin": 50,
|
6829 | "width": 150,
|
6830 | "height": 65,
|
6831 | "boxMargin": 10,
|
6832 | "boxTextMargin": 5,
|
6833 | "noteMargin": 10,
|
6834 | "messageMargin": 35,
|
6835 | "messageAlign": "center",
|
6836 | "mirrorActors": true,
|
6837 | "forceMenus": false,
|
6838 | "bottomMarginAdj": 1,
|
6839 | "rightAngles": false,
|
6840 | "showSequenceNumbers": false,
|
6841 | "actorFontSize": 14,
|
6842 | "actorFontFamily": '"Open Sans", sans-serif',
|
6843 | "actorFontWeight": 400,
|
6844 | "noteFontSize": 14,
|
6845 | "noteFontFamily": '"trebuchet ms", verdana, arial, sans-serif',
|
6846 | "noteFontWeight": 400,
|
6847 | "noteAlign": "center",
|
6848 | "messageFontSize": 16,
|
6849 | "messageFontFamily": '"trebuchet ms", verdana, arial, sans-serif',
|
6850 | "messageFontWeight": 400,
|
6851 | "wrap": false,
|
6852 | "wrapPadding": 10,
|
6853 | "labelBoxWidth": 50,
|
6854 | "labelBoxHeight": 20
|
6855 | },
|
6856 | "gantt": {
|
6857 | "useMaxWidth": true,
|
6858 | "titleTopMargin": 25,
|
6859 | "barHeight": 20,
|
6860 | "barGap": 4,
|
6861 | "topPadding": 50,
|
6862 | "rightPadding": 75,
|
6863 | "leftPadding": 75,
|
6864 | "gridLineStartPadding": 35,
|
6865 | "fontSize": 11,
|
6866 | "sectionFontSize": 11,
|
6867 | "numberSectionStyles": 4,
|
6868 | "axisFormat": "%Y-%m-%d",
|
6869 | "topAxis": false,
|
6870 | "displayMode": "",
|
6871 | "weekday": "sunday"
|
6872 | },
|
6873 | "journey": {
|
6874 | "useMaxWidth": true,
|
6875 | "diagramMarginX": 50,
|
6876 | "diagramMarginY": 10,
|
6877 | "leftMargin": 150,
|
6878 | "width": 150,
|
6879 | "height": 50,
|
6880 | "boxMargin": 10,
|
6881 | "boxTextMargin": 5,
|
6882 | "noteMargin": 10,
|
6883 | "messageMargin": 35,
|
6884 | "messageAlign": "center",
|
6885 | "bottomMarginAdj": 1,
|
6886 | "rightAngles": false,
|
6887 | "taskFontSize": 14,
|
6888 | "taskFontFamily": '"Open Sans", sans-serif',
|
6889 | "taskMargin": 50,
|
6890 | "activationWidth": 10,
|
6891 | "textPlacement": "fo",
|
6892 | "actorColours": [
|
6893 | "#8FBC8F",
|
6894 | "#7CFC00",
|
6895 | "#00FFFF",
|
6896 | "#20B2AA",
|
6897 | "#B0E0E6",
|
6898 | "#FFFFE0"
|
6899 | ],
|
6900 | "sectionFills": [
|
6901 | "#191970",
|
6902 | "#8B008B",
|
6903 | "#4B0082",
|
6904 | "#2F4F4F",
|
6905 | "#800000",
|
6906 | "#8B4513",
|
6907 | "#00008B"
|
6908 | ],
|
6909 | "sectionColours": [
|
6910 | "#fff"
|
6911 | ]
|
6912 | },
|
6913 | "class": {
|
6914 | "useMaxWidth": true,
|
6915 | "titleTopMargin": 25,
|
6916 | "arrowMarkerAbsolute": false,
|
6917 | "dividerMargin": 10,
|
6918 | "padding": 5,
|
6919 | "textHeight": 10,
|
6920 | "defaultRenderer": "dagre-wrapper",
|
6921 | "htmlLabels": false
|
6922 | },
|
6923 | "state": {
|
6924 | "useMaxWidth": true,
|
6925 | "titleTopMargin": 25,
|
6926 | "dividerMargin": 10,
|
6927 | "sizeUnit": 5,
|
6928 | "padding": 8,
|
6929 | "textHeight": 10,
|
6930 | "titleShift": -15,
|
6931 | "noteMargin": 10,
|
6932 | "forkWidth": 70,
|
6933 | "forkHeight": 7,
|
6934 | "miniPadding": 2,
|
6935 | "fontSizeFactor": 5.02,
|
6936 | "fontSize": 24,
|
6937 | "labelHeight": 16,
|
6938 | "edgeLengthFactor": "20",
|
6939 | "compositTitleSize": 35,
|
6940 | "radius": 5,
|
6941 | "defaultRenderer": "dagre-wrapper"
|
6942 | },
|
6943 | "er": {
|
6944 | "useMaxWidth": true,
|
6945 | "titleTopMargin": 25,
|
6946 | "diagramPadding": 20,
|
6947 | "layoutDirection": "TB",
|
6948 | "minEntityWidth": 100,
|
6949 | "minEntityHeight": 75,
|
6950 | "entityPadding": 15,
|
6951 | "stroke": "gray",
|
6952 | "fill": "honeydew",
|
6953 | "fontSize": 12
|
6954 | },
|
6955 | "pie": {
|
6956 | "useMaxWidth": true,
|
6957 | "textPosition": 0.75
|
6958 | },
|
6959 | "quadrantChart": {
|
6960 | "useMaxWidth": true,
|
6961 | "chartWidth": 500,
|
6962 | "chartHeight": 500,
|
6963 | "titleFontSize": 20,
|
6964 | "titlePadding": 10,
|
6965 | "quadrantPadding": 5,
|
6966 | "xAxisLabelPadding": 5,
|
6967 | "yAxisLabelPadding": 5,
|
6968 | "xAxisLabelFontSize": 16,
|
6969 | "yAxisLabelFontSize": 16,
|
6970 | "quadrantLabelFontSize": 16,
|
6971 | "quadrantTextTopPadding": 5,
|
6972 | "pointTextPadding": 5,
|
6973 | "pointLabelFontSize": 12,
|
6974 | "pointRadius": 5,
|
6975 | "xAxisPosition": "top",
|
6976 | "yAxisPosition": "left",
|
6977 | "quadrantInternalBorderStrokeWidth": 1,
|
6978 | "quadrantExternalBorderStrokeWidth": 2
|
6979 | },
|
6980 | "xyChart": {
|
6981 | "useMaxWidth": true,
|
6982 | "width": 700,
|
6983 | "height": 500,
|
6984 | "titleFontSize": 20,
|
6985 | "titlePadding": 10,
|
6986 | "showTitle": true,
|
6987 | "xAxis": {
|
6988 | "$ref": "#/$defs/XYChartAxisConfig",
|
6989 | "showLabel": true,
|
6990 | "labelFontSize": 14,
|
6991 | "labelPadding": 5,
|
6992 | "showTitle": true,
|
6993 | "titleFontSize": 16,
|
6994 | "titlePadding": 5,
|
6995 | "showTick": true,
|
6996 | "tickLength": 5,
|
6997 | "tickWidth": 2,
|
6998 | "showAxisLine": true,
|
6999 | "axisLineWidth": 2
|
7000 | },
|
7001 | "yAxis": {
|
7002 | "$ref": "#/$defs/XYChartAxisConfig",
|
7003 | "showLabel": true,
|
7004 | "labelFontSize": 14,
|
7005 | "labelPadding": 5,
|
7006 | "showTitle": true,
|
7007 | "titleFontSize": 16,
|
7008 | "titlePadding": 5,
|
7009 | "showTick": true,
|
7010 | "tickLength": 5,
|
7011 | "tickWidth": 2,
|
7012 | "showAxisLine": true,
|
7013 | "axisLineWidth": 2
|
7014 | },
|
7015 | "chartOrientation": "vertical",
|
7016 | "plotReservedSpacePercent": 50
|
7017 | },
|
7018 | "requirement": {
|
7019 | "useMaxWidth": true,
|
7020 | "rect_fill": "#f9f9f9",
|
7021 | "text_color": "#333",
|
7022 | "rect_border_size": "0.5px",
|
7023 | "rect_border_color": "#bbb",
|
7024 | "rect_min_width": 200,
|
7025 | "rect_min_height": 200,
|
7026 | "fontSize": 14,
|
7027 | "rect_padding": 10,
|
7028 | "line_height": 20
|
7029 | },
|
7030 | "mindmap": {
|
7031 | "useMaxWidth": true,
|
7032 | "padding": 10,
|
7033 | "maxNodeWidth": 200
|
7034 | },
|
7035 | "timeline": {
|
7036 | "useMaxWidth": true,
|
7037 | "diagramMarginX": 50,
|
7038 | "diagramMarginY": 10,
|
7039 | "leftMargin": 150,
|
7040 | "width": 150,
|
7041 | "height": 50,
|
7042 | "boxMargin": 10,
|
7043 | "boxTextMargin": 5,
|
7044 | "noteMargin": 10,
|
7045 | "messageMargin": 35,
|
7046 | "messageAlign": "center",
|
7047 | "bottomMarginAdj": 1,
|
7048 | "rightAngles": false,
|
7049 | "taskFontSize": 14,
|
7050 | "taskFontFamily": '"Open Sans", sans-serif',
|
7051 | "taskMargin": 50,
|
7052 | "activationWidth": 10,
|
7053 | "textPlacement": "fo",
|
7054 | "actorColours": [
|
7055 | "#8FBC8F",
|
7056 | "#7CFC00",
|
7057 | "#00FFFF",
|
7058 | "#20B2AA",
|
7059 | "#B0E0E6",
|
7060 | "#FFFFE0"
|
7061 | ],
|
7062 | "sectionFills": [
|
7063 | "#191970",
|
7064 | "#8B008B",
|
7065 | "#4B0082",
|
7066 | "#2F4F4F",
|
7067 | "#800000",
|
7068 | "#8B4513",
|
7069 | "#00008B"
|
7070 | ],
|
7071 | "sectionColours": [
|
7072 | "#fff"
|
7073 | ],
|
7074 | "disableMulticolor": false
|
7075 | },
|
7076 | "gitGraph": {
|
7077 | "useMaxWidth": true,
|
7078 | "titleTopMargin": 25,
|
7079 | "diagramPadding": 8,
|
7080 | "nodeLabel": {
|
7081 | "width": 75,
|
7082 | "height": 100,
|
7083 | "x": -25,
|
7084 | "y": 0
|
7085 | },
|
7086 | "mainBranchName": "main",
|
7087 | "mainBranchOrder": 0,
|
7088 | "showCommitLabel": true,
|
7089 | "showBranches": true,
|
7090 | "rotateCommitLabel": true,
|
7091 | "parallelCommits": false,
|
7092 | "arrowMarkerAbsolute": false
|
7093 | },
|
7094 | "c4": {
|
7095 | "useMaxWidth": true,
|
7096 | "diagramMarginX": 50,
|
7097 | "diagramMarginY": 10,
|
7098 | "c4ShapeMargin": 50,
|
7099 | "c4ShapePadding": 20,
|
7100 | "width": 216,
|
7101 | "height": 60,
|
7102 | "boxMargin": 10,
|
7103 | "c4ShapeInRow": 4,
|
7104 | "nextLinePaddingX": 0,
|
7105 | "c4BoundaryInRow": 2,
|
7106 | "personFontSize": 14,
|
7107 | "personFontFamily": '"Open Sans", sans-serif',
|
7108 | "personFontWeight": "normal",
|
7109 | "external_personFontSize": 14,
|
7110 | "external_personFontFamily": '"Open Sans", sans-serif',
|
7111 | "external_personFontWeight": "normal",
|
7112 | "systemFontSize": 14,
|
7113 | "systemFontFamily": '"Open Sans", sans-serif',
|
7114 | "systemFontWeight": "normal",
|
7115 | "external_systemFontSize": 14,
|
7116 | "external_systemFontFamily": '"Open Sans", sans-serif',
|
7117 | "external_systemFontWeight": "normal",
|
7118 | "system_dbFontSize": 14,
|
7119 | "system_dbFontFamily": '"Open Sans", sans-serif',
|
7120 | "system_dbFontWeight": "normal",
|
7121 | "external_system_dbFontSize": 14,
|
7122 | "external_system_dbFontFamily": '"Open Sans", sans-serif',
|
7123 | "external_system_dbFontWeight": "normal",
|
7124 | "system_queueFontSize": 14,
|
7125 | "system_queueFontFamily": '"Open Sans", sans-serif',
|
7126 | "system_queueFontWeight": "normal",
|
7127 | "external_system_queueFontSize": 14,
|
7128 | "external_system_queueFontFamily": '"Open Sans", sans-serif',
|
7129 | "external_system_queueFontWeight": "normal",
|
7130 | "boundaryFontSize": 14,
|
7131 | "boundaryFontFamily": '"Open Sans", sans-serif',
|
7132 | "boundaryFontWeight": "normal",
|
7133 | "messageFontSize": 12,
|
7134 | "messageFontFamily": '"Open Sans", sans-serif',
|
7135 | "messageFontWeight": "normal",
|
7136 | "containerFontSize": 14,
|
7137 | "containerFontFamily": '"Open Sans", sans-serif',
|
7138 | "containerFontWeight": "normal",
|
7139 | "external_containerFontSize": 14,
|
7140 | "external_containerFontFamily": '"Open Sans", sans-serif',
|
7141 | "external_containerFontWeight": "normal",
|
7142 | "container_dbFontSize": 14,
|
7143 | "container_dbFontFamily": '"Open Sans", sans-serif',
|
7144 | "container_dbFontWeight": "normal",
|
7145 | "external_container_dbFontSize": 14,
|
7146 | "external_container_dbFontFamily": '"Open Sans", sans-serif',
|
7147 | "external_container_dbFontWeight": "normal",
|
7148 | "container_queueFontSize": 14,
|
7149 | "container_queueFontFamily": '"Open Sans", sans-serif',
|
7150 | "container_queueFontWeight": "normal",
|
7151 | "external_container_queueFontSize": 14,
|
7152 | "external_container_queueFontFamily": '"Open Sans", sans-serif',
|
7153 | "external_container_queueFontWeight": "normal",
|
7154 | "componentFontSize": 14,
|
7155 | "componentFontFamily": '"Open Sans", sans-serif',
|
7156 | "componentFontWeight": "normal",
|
7157 | "external_componentFontSize": 14,
|
7158 | "external_componentFontFamily": '"Open Sans", sans-serif',
|
7159 | "external_componentFontWeight": "normal",
|
7160 | "component_dbFontSize": 14,
|
7161 | "component_dbFontFamily": '"Open Sans", sans-serif',
|
7162 | "component_dbFontWeight": "normal",
|
7163 | "external_component_dbFontSize": 14,
|
7164 | "external_component_dbFontFamily": '"Open Sans", sans-serif',
|
7165 | "external_component_dbFontWeight": "normal",
|
7166 | "component_queueFontSize": 14,
|
7167 | "component_queueFontFamily": '"Open Sans", sans-serif',
|
7168 | "component_queueFontWeight": "normal",
|
7169 | "external_component_queueFontSize": 14,
|
7170 | "external_component_queueFontFamily": '"Open Sans", sans-serif',
|
7171 | "external_component_queueFontWeight": "normal",
|
7172 | "wrap": true,
|
7173 | "wrapPadding": 10,
|
7174 | "person_bg_color": "#08427B",
|
7175 | "person_border_color": "#073B6F",
|
7176 | "external_person_bg_color": "#686868",
|
7177 | "external_person_border_color": "#8A8A8A",
|
7178 | "system_bg_color": "#1168BD",
|
7179 | "system_border_color": "#3C7FC0",
|
7180 | "system_db_bg_color": "#1168BD",
|
7181 | "system_db_border_color": "#3C7FC0",
|
7182 | "system_queue_bg_color": "#1168BD",
|
7183 | "system_queue_border_color": "#3C7FC0",
|
7184 | "external_system_bg_color": "#999999",
|
7185 | "external_system_border_color": "#8A8A8A",
|
7186 | "external_system_db_bg_color": "#999999",
|
7187 | "external_system_db_border_color": "#8A8A8A",
|
7188 | "external_system_queue_bg_color": "#999999",
|
7189 | "external_system_queue_border_color": "#8A8A8A",
|
7190 | "container_bg_color": "#438DD5",
|
7191 | "container_border_color": "#3C7FC0",
|
7192 | "container_db_bg_color": "#438DD5",
|
7193 | "container_db_border_color": "#3C7FC0",
|
7194 | "container_queue_bg_color": "#438DD5",
|
7195 | "container_queue_border_color": "#3C7FC0",
|
7196 | "external_container_bg_color": "#B3B3B3",
|
7197 | "external_container_border_color": "#A6A6A6",
|
7198 | "external_container_db_bg_color": "#B3B3B3",
|
7199 | "external_container_db_border_color": "#A6A6A6",
|
7200 | "external_container_queue_bg_color": "#B3B3B3",
|
7201 | "external_container_queue_border_color": "#A6A6A6",
|
7202 | "component_bg_color": "#85BBF0",
|
7203 | "component_border_color": "#78A8D8",
|
7204 | "component_db_bg_color": "#85BBF0",
|
7205 | "component_db_border_color": "#78A8D8",
|
7206 | "component_queue_bg_color": "#85BBF0",
|
7207 | "component_queue_border_color": "#78A8D8",
|
7208 | "external_component_bg_color": "#CCCCCC",
|
7209 | "external_component_border_color": "#BFBFBF",
|
7210 | "external_component_db_bg_color": "#CCCCCC",
|
7211 | "external_component_db_border_color": "#BFBFBF",
|
7212 | "external_component_queue_bg_color": "#CCCCCC",
|
7213 | "external_component_queue_border_color": "#BFBFBF"
|
7214 | },
|
7215 | "sankey": {
|
7216 | "useMaxWidth": true,
|
7217 | "width": 600,
|
7218 | "height": 400,
|
7219 | "linkColor": "gradient",
|
7220 | "nodeAlignment": "justify",
|
7221 | "showValues": true,
|
7222 | "prefix": "",
|
7223 | "suffix": ""
|
7224 | },
|
7225 | "block": {
|
7226 | "useMaxWidth": true,
|
7227 | "padding": 8
|
7228 | },
|
7229 | "theme": "default",
|
7230 | "maxTextSize": 5e4,
|
7231 | "maxEdges": 500,
|
7232 | "darkMode": false,
|
7233 | "fontFamily": '"trebuchet ms", verdana, arial, sans-serif;',
|
7234 | "logLevel": 5,
|
7235 | "securityLevel": "strict",
|
7236 | "startOnLoad": true,
|
7237 | "arrowMarkerAbsolute": false,
|
7238 | "secure": [
|
7239 | "secure",
|
7240 | "securityLevel",
|
7241 | "startOnLoad",
|
7242 | "maxTextSize",
|
7243 | "maxEdges"
|
7244 | ],
|
7245 | "legacyMathML": false,
|
7246 | "deterministicIds": false,
|
7247 | "fontSize": 16
|
7248 | };
|
7249 | const config = {
|
7250 | ...defaultConfigJson,
|
7251 |
|
7252 |
|
7253 | deterministicIDSeed: void 0,
|
7254 | themeCSS: void 0,
|
7255 |
|
7256 | themeVariables: theme["default"].getThemeVariables(),
|
7257 | sequence: {
|
7258 | ...defaultConfigJson.sequence,
|
7259 | messageFont: function() {
|
7260 | return {
|
7261 | fontFamily: this.messageFontFamily,
|
7262 | fontSize: this.messageFontSize,
|
7263 | fontWeight: this.messageFontWeight
|
7264 | };
|
7265 | },
|
7266 | noteFont: function() {
|
7267 | return {
|
7268 | fontFamily: this.noteFontFamily,
|
7269 | fontSize: this.noteFontSize,
|
7270 | fontWeight: this.noteFontWeight
|
7271 | };
|
7272 | },
|
7273 | actorFont: function() {
|
7274 | return {
|
7275 | fontFamily: this.actorFontFamily,
|
7276 | fontSize: this.actorFontSize,
|
7277 | fontWeight: this.actorFontWeight
|
7278 | };
|
7279 | }
|
7280 | },
|
7281 | gantt: {
|
7282 | ...defaultConfigJson.gantt,
|
7283 | tickInterval: void 0,
|
7284 | useWidth: void 0
|
7285 |
|
7286 | },
|
7287 | c4: {
|
7288 | ...defaultConfigJson.c4,
|
7289 | useWidth: void 0,
|
7290 | personFont: function() {
|
7291 | return {
|
7292 | fontFamily: this.personFontFamily,
|
7293 | fontSize: this.personFontSize,
|
7294 | fontWeight: this.personFontWeight
|
7295 | };
|
7296 | },
|
7297 | external_personFont: function() {
|
7298 | return {
|
7299 | fontFamily: this.external_personFontFamily,
|
7300 | fontSize: this.external_personFontSize,
|
7301 | fontWeight: this.external_personFontWeight
|
7302 | };
|
7303 | },
|
7304 | systemFont: function() {
|
7305 | return {
|
7306 | fontFamily: this.systemFontFamily,
|
7307 | fontSize: this.systemFontSize,
|
7308 | fontWeight: this.systemFontWeight
|
7309 | };
|
7310 | },
|
7311 | external_systemFont: function() {
|
7312 | return {
|
7313 | fontFamily: this.external_systemFontFamily,
|
7314 | fontSize: this.external_systemFontSize,
|
7315 | fontWeight: this.external_systemFontWeight
|
7316 | };
|
7317 | },
|
7318 | system_dbFont: function() {
|
7319 | return {
|
7320 | fontFamily: this.system_dbFontFamily,
|
7321 | fontSize: this.system_dbFontSize,
|
7322 | fontWeight: this.system_dbFontWeight
|
7323 | };
|
7324 | },
|
7325 | external_system_dbFont: function() {
|
7326 | return {
|
7327 | fontFamily: this.external_system_dbFontFamily,
|
7328 | fontSize: this.external_system_dbFontSize,
|
7329 | fontWeight: this.external_system_dbFontWeight
|
7330 | };
|
7331 | },
|
7332 | system_queueFont: function() {
|
7333 | return {
|
7334 | fontFamily: this.system_queueFontFamily,
|
7335 | fontSize: this.system_queueFontSize,
|
7336 | fontWeight: this.system_queueFontWeight
|
7337 | };
|
7338 | },
|
7339 | external_system_queueFont: function() {
|
7340 | return {
|
7341 | fontFamily: this.external_system_queueFontFamily,
|
7342 | fontSize: this.external_system_queueFontSize,
|
7343 | fontWeight: this.external_system_queueFontWeight
|
7344 | };
|
7345 | },
|
7346 | containerFont: function() {
|
7347 | return {
|
7348 | fontFamily: this.containerFontFamily,
|
7349 | fontSize: this.containerFontSize,
|
7350 | fontWeight: this.containerFontWeight
|
7351 | };
|
7352 | },
|
7353 | external_containerFont: function() {
|
7354 | return {
|
7355 | fontFamily: this.external_containerFontFamily,
|
7356 | fontSize: this.external_containerFontSize,
|
7357 | fontWeight: this.external_containerFontWeight
|
7358 | };
|
7359 | },
|
7360 | container_dbFont: function() {
|
7361 | return {
|
7362 | fontFamily: this.container_dbFontFamily,
|
7363 | fontSize: this.container_dbFontSize,
|
7364 | fontWeight: this.container_dbFontWeight
|
7365 | };
|
7366 | },
|
7367 | external_container_dbFont: function() {
|
7368 | return {
|
7369 | fontFamily: this.external_container_dbFontFamily,
|
7370 | fontSize: this.external_container_dbFontSize,
|
7371 | fontWeight: this.external_container_dbFontWeight
|
7372 | };
|
7373 | },
|
7374 | container_queueFont: function() {
|
7375 | return {
|
7376 | fontFamily: this.container_queueFontFamily,
|
7377 | fontSize: this.container_queueFontSize,
|
7378 | fontWeight: this.container_queueFontWeight
|
7379 | };
|
7380 | },
|
7381 | external_container_queueFont: function() {
|
7382 | return {
|
7383 | fontFamily: this.external_container_queueFontFamily,
|
7384 | fontSize: this.external_container_queueFontSize,
|
7385 | fontWeight: this.external_container_queueFontWeight
|
7386 | };
|
7387 | },
|
7388 | componentFont: function() {
|
7389 | return {
|
7390 | fontFamily: this.componentFontFamily,
|
7391 | fontSize: this.componentFontSize,
|
7392 | fontWeight: this.componentFontWeight
|
7393 | };
|
7394 | },
|
7395 | external_componentFont: function() {
|
7396 | return {
|
7397 | fontFamily: this.external_componentFontFamily,
|
7398 | fontSize: this.external_componentFontSize,
|
7399 | fontWeight: this.external_componentFontWeight
|
7400 | };
|
7401 | },
|
7402 | component_dbFont: function() {
|
7403 | return {
|
7404 | fontFamily: this.component_dbFontFamily,
|
7405 | fontSize: this.component_dbFontSize,
|
7406 | fontWeight: this.component_dbFontWeight
|
7407 | };
|
7408 | },
|
7409 | external_component_dbFont: function() {
|
7410 | return {
|
7411 | fontFamily: this.external_component_dbFontFamily,
|
7412 | fontSize: this.external_component_dbFontSize,
|
7413 | fontWeight: this.external_component_dbFontWeight
|
7414 | };
|
7415 | },
|
7416 | component_queueFont: function() {
|
7417 | return {
|
7418 | fontFamily: this.component_queueFontFamily,
|
7419 | fontSize: this.component_queueFontSize,
|
7420 | fontWeight: this.component_queueFontWeight
|
7421 | };
|
7422 | },
|
7423 | external_component_queueFont: function() {
|
7424 | return {
|
7425 | fontFamily: this.external_component_queueFontFamily,
|
7426 | fontSize: this.external_component_queueFontSize,
|
7427 | fontWeight: this.external_component_queueFontWeight
|
7428 | };
|
7429 | },
|
7430 | boundaryFont: function() {
|
7431 | return {
|
7432 | fontFamily: this.boundaryFontFamily,
|
7433 | fontSize: this.boundaryFontSize,
|
7434 | fontWeight: this.boundaryFontWeight
|
7435 | };
|
7436 | },
|
7437 | messageFont: function() {
|
7438 | return {
|
7439 | fontFamily: this.messageFontFamily,
|
7440 | fontSize: this.messageFontSize,
|
7441 | fontWeight: this.messageFontWeight
|
7442 | };
|
7443 | }
|
7444 | },
|
7445 | pie: {
|
7446 | ...defaultConfigJson.pie,
|
7447 | useWidth: 984
|
7448 | },
|
7449 | xyChart: {
|
7450 | ...defaultConfigJson.xyChart,
|
7451 | useWidth: void 0
|
7452 | },
|
7453 | requirement: {
|
7454 | ...defaultConfigJson.requirement,
|
7455 | useWidth: void 0
|
7456 | },
|
7457 | gitGraph: {
|
7458 | ...defaultConfigJson.gitGraph,
|
7459 |
|
7460 |
|
7461 |
|
7462 | useMaxWidth: false
|
7463 | },
|
7464 | sankey: {
|
7465 | ...defaultConfigJson.sankey,
|
7466 |
|
7467 |
|
7468 | useMaxWidth: false
|
7469 | }
|
7470 | };
|
7471 | const keyify = (obj, prefix = "") => Object.keys(obj).reduce((res, el) => {
|
7472 | if (Array.isArray(obj[el])) {
|
7473 | return res;
|
7474 | } else if (typeof obj[el] === "object" && obj[el] !== null) {
|
7475 | return [...res, prefix + el, ...keyify(obj[el], "")];
|
7476 | }
|
7477 | return [...res, prefix + el];
|
7478 | }, []);
|
7479 | const configKeys = new Set(keyify(config, ""));
|
7480 | const defaultConfig$2 = config;
|
7481 | const sanitizeDirective = (args) => {
|
7482 | log$1.debug("sanitizeDirective called with", args);
|
7483 | if (typeof args !== "object" || args == null) {
|
7484 | return;
|
7485 | }
|
7486 | if (Array.isArray(args)) {
|
7487 | args.forEach((arg) => sanitizeDirective(arg));
|
7488 | return;
|
7489 | }
|
7490 | for (const key of Object.keys(args)) {
|
7491 | log$1.debug("Checking key", key);
|
7492 | if (key.startsWith("__") || key.includes("proto") || key.includes("constr") || !configKeys.has(key) || args[key] == null) {
|
7493 | log$1.debug("sanitize deleting key: ", key);
|
7494 | delete args[key];
|
7495 | continue;
|
7496 | }
|
7497 | if (typeof args[key] === "object") {
|
7498 | log$1.debug("sanitizing object", key);
|
7499 | sanitizeDirective(args[key]);
|
7500 | continue;
|
7501 | }
|
7502 | const cssMatchers = ["themeCSS", "fontFamily", "altFontFamily"];
|
7503 | for (const cssKey of cssMatchers) {
|
7504 | if (key.includes(cssKey)) {
|
7505 | log$1.debug("sanitizing css option", key);
|
7506 | args[key] = sanitizeCss(args[key]);
|
7507 | }
|
7508 | }
|
7509 | }
|
7510 | if (args.themeVariables) {
|
7511 | for (const k of Object.keys(args.themeVariables)) {
|
7512 | const val = args.themeVariables[k];
|
7513 | if ((val == null ? void 0 : val.match) && !val.match(/^[\d "#%(),.;A-Za-z]+$/)) {
|
7514 | args.themeVariables[k] = "";
|
7515 | }
|
7516 | }
|
7517 | }
|
7518 | log$1.debug("After sanitization", args);
|
7519 | };
|
7520 | const sanitizeCss = (str2) => {
|
7521 | let startCnt = 0;
|
7522 | let endCnt = 0;
|
7523 | for (const element of str2) {
|
7524 | if (startCnt < endCnt) {
|
7525 | return "{ /* ERROR: Unbalanced CSS */ }";
|
7526 | }
|
7527 | if (element === "{") {
|
7528 | startCnt++;
|
7529 | } else if (element === "}") {
|
7530 | endCnt++;
|
7531 | }
|
7532 | }
|
7533 | if (startCnt !== endCnt) {
|
7534 | return "{ /* ERROR: Unbalanced CSS */ }";
|
7535 | }
|
7536 | return str2;
|
7537 | };
|
7538 | const frontMatterRegex = /^-{3}\s*[\n\r](.*?)[\n\r]-{3}\s*[\n\r]+/s;
|
7539 | const directiveRegex = /%{2}{\s*(?:(\w+)\s*:|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi;
|
7540 | const anyCommentRegex = /\s*%%.*\n/gm;
|
7541 | class UnknownDiagramError extends Error {
|
7542 | constructor(message) {
|
7543 | super(message);
|
7544 | this.name = "UnknownDiagramError";
|
7545 | }
|
7546 | }
|
7547 | const detectors = {};
|
7548 | const detectType = function(text2, config2) {
|
7549 | text2 = text2.replace(frontMatterRegex, "").replace(directiveRegex, "").replace(anyCommentRegex, "\n");
|
7550 | for (const [key, { detector: detector2 }] of Object.entries(detectors)) {
|
7551 | const diagram2 = detector2(text2, config2);
|
7552 | if (diagram2) {
|
7553 | return key;
|
7554 | }
|
7555 | }
|
7556 | throw new UnknownDiagramError(
|
7557 | `No diagram type detected matching given configuration for text: ${text2}`
|
7558 | );
|
7559 | };
|
7560 | const registerLazyLoadedDiagrams = (...diagrams2) => {
|
7561 | for (const { id: id2, detector: detector2, loader: loader2 } of diagrams2) {
|
7562 | addDetector(id2, detector2, loader2);
|
7563 | }
|
7564 | };
|
7565 | const addDetector = (key, detector2, loader2) => {
|
7566 | if (detectors[key]) {
|
7567 | log$1.error(`Detector with key ${key} already exists`);
|
7568 | } else {
|
7569 | detectors[key] = { detector: detector2, loader: loader2 };
|
7570 | }
|
7571 | log$1.debug(`Detector with key ${key} added${loader2 ? " with loader" : ""}`);
|
7572 | };
|
7573 | const getDiagramLoader = (key) => {
|
7574 | return detectors[key].loader;
|
7575 | };
|
7576 | const assignWithDepth = (dst, src, { depth = 2, clobber = false } = {}) => {
|
7577 | const config2 = { depth, clobber };
|
7578 | if (Array.isArray(src) && !Array.isArray(dst)) {
|
7579 | src.forEach((s) => assignWithDepth(dst, s, config2));
|
7580 | return dst;
|
7581 | } else if (Array.isArray(src) && Array.isArray(dst)) {
|
7582 | src.forEach((s) => {
|
7583 | if (!dst.includes(s)) {
|
7584 | dst.push(s);
|
7585 | }
|
7586 | });
|
7587 | return dst;
|
7588 | }
|
7589 | if (dst === void 0 || depth <= 0) {
|
7590 | if (dst !== void 0 && dst !== null && typeof dst === "object" && typeof src === "object") {
|
7591 | return Object.assign(dst, src);
|
7592 | } else {
|
7593 | return src;
|
7594 | }
|
7595 | }
|
7596 | if (src !== void 0 && typeof dst === "object" && typeof src === "object") {
|
7597 | Object.keys(src).forEach((key) => {
|
7598 | if (typeof src[key] === "object" && (dst[key] === void 0 || typeof dst[key] === "object")) {
|
7599 | if (dst[key] === void 0) {
|
7600 | dst[key] = Array.isArray(src[key]) ? [] : {};
|
7601 | }
|
7602 | dst[key] = assignWithDepth(dst[key], src[key], { depth: depth - 1, clobber });
|
7603 | } else if (clobber || typeof dst[key] !== "object" && typeof src[key] !== "object") {
|
7604 | dst[key] = src[key];
|
7605 | }
|
7606 | });
|
7607 | }
|
7608 | return dst;
|
7609 | };
|
7610 | const assignWithDepth$1 = assignWithDepth;
|
7611 | var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
|
7612 | const freeGlobal$1 = freeGlobal;
|
7613 | var freeSelf = typeof self == "object" && self && self.Object === Object && self;
|
7614 | var root = freeGlobal$1 || freeSelf || Function("return this")();
|
7615 | const root$1 = root;
|
7616 | var Symbol$1 = root$1.Symbol;
|
7617 | const Symbol$2 = Symbol$1;
|
7618 | var objectProto$c = Object.prototype;
|
7619 | var hasOwnProperty$a = objectProto$c.hasOwnProperty;
|
7620 | var nativeObjectToString$1 = objectProto$c.toString;
|
7621 | var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : void 0;
|
7622 | function getRawTag(value) {
|
7623 | var isOwn = hasOwnProperty$a.call(value, symToStringTag$1), tag = value[symToStringTag$1];
|
7624 | try {
|
7625 | value[symToStringTag$1] = void 0;
|
7626 | var unmasked = true;
|
7627 | } catch (e) {
|
7628 | }
|
7629 | var result = nativeObjectToString$1.call(value);
|
7630 | if (unmasked) {
|
7631 | if (isOwn) {
|
7632 | value[symToStringTag$1] = tag;
|
7633 | } else {
|
7634 | delete value[symToStringTag$1];
|
7635 | }
|
7636 | }
|
7637 | return result;
|
7638 | }
|
7639 | var objectProto$b = Object.prototype;
|
7640 | var nativeObjectToString = objectProto$b.toString;
|
7641 | function objectToString(value) {
|
7642 | return nativeObjectToString.call(value);
|
7643 | }
|
7644 | var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
|
7645 | var symToStringTag = Symbol$2 ? Symbol$2.toStringTag : void 0;
|
7646 | function baseGetTag(value) {
|
7647 | if (value == null) {
|
7648 | return value === void 0 ? undefinedTag : nullTag;
|
7649 | }
|
7650 | return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
|
7651 | }
|
7652 | function isObject$1(value) {
|
7653 | var type2 = typeof value;
|
7654 | return value != null && (type2 == "object" || type2 == "function");
|
7655 | }
|
7656 | var asyncTag = "[object AsyncFunction]", funcTag$1 = "[object Function]", genTag = "[object GeneratorFunction]", proxyTag = "[object Proxy]";
|
7657 | function isFunction(value) {
|
7658 | if (!isObject$1(value)) {
|
7659 | return false;
|
7660 | }
|
7661 | var tag = baseGetTag(value);
|
7662 | return tag == funcTag$1 || tag == genTag || tag == asyncTag || tag == proxyTag;
|
7663 | }
|
7664 | var coreJsData = root$1["__core-js_shared__"];
|
7665 | const coreJsData$1 = coreJsData;
|
7666 | var maskSrcKey = function() {
|
7667 | var uid = /[^.]+$/.exec(coreJsData$1 && coreJsData$1.keys && coreJsData$1.keys.IE_PROTO || "");
|
7668 | return uid ? "Symbol(src)_1." + uid : "";
|
7669 | }();
|
7670 | function isMasked(func) {
|
7671 | return !!maskSrcKey && maskSrcKey in func;
|
7672 | }
|
7673 | var funcProto$2 = Function.prototype;
|
7674 | var funcToString$2 = funcProto$2.toString;
|
7675 | function toSource(func) {
|
7676 | if (func != null) {
|
7677 | try {
|
7678 | return funcToString$2.call(func);
|
7679 | } catch (e) {
|
7680 | }
|
7681 | try {
|
7682 | return func + "";
|
7683 | } catch (e) {
|
7684 | }
|
7685 | }
|
7686 | return "";
|
7687 | }
|
7688 | var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
7689 | var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
7690 | var funcProto$1 = Function.prototype, objectProto$a = Object.prototype;
|
7691 | var funcToString$1 = funcProto$1.toString;
|
7692 | var hasOwnProperty$9 = objectProto$a.hasOwnProperty;
|
7693 | var reIsNative = RegExp(
|
7694 | "^" + funcToString$1.call(hasOwnProperty$9).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
7695 | );
|
7696 | function baseIsNative(value) {
|
7697 | if (!isObject$1(value) || isMasked(value)) {
|
7698 | return false;
|
7699 | }
|
7700 | var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
|
7701 | return pattern.test(toSource(value));
|
7702 | }
|
7703 | function getValue(object, key) {
|
7704 | return object == null ? void 0 : object[key];
|
7705 | }
|
7706 | function getNative(object, key) {
|
7707 | var value = getValue(object, key);
|
7708 | return baseIsNative(value) ? value : void 0;
|
7709 | }
|
7710 | var nativeCreate = getNative(Object, "create");
|
7711 | const nativeCreate$1 = nativeCreate;
|
7712 | function hashClear() {
|
7713 | this.__data__ = nativeCreate$1 ? nativeCreate$1(null) : {};
|
7714 | this.size = 0;
|
7715 | }
|
7716 | function hashDelete(key) {
|
7717 | var result = this.has(key) && delete this.__data__[key];
|
7718 | this.size -= result ? 1 : 0;
|
7719 | return result;
|
7720 | }
|
7721 | var HASH_UNDEFINED$1 = "__lodash_hash_undefined__";
|
7722 | var objectProto$9 = Object.prototype;
|
7723 | var hasOwnProperty$8 = objectProto$9.hasOwnProperty;
|
7724 | function hashGet(key) {
|
7725 | var data = this.__data__;
|
7726 | if (nativeCreate$1) {
|
7727 | var result = data[key];
|
7728 | return result === HASH_UNDEFINED$1 ? void 0 : result;
|
7729 | }
|
7730 | return hasOwnProperty$8.call(data, key) ? data[key] : void 0;
|
7731 | }
|
7732 | var objectProto$8 = Object.prototype;
|
7733 | var hasOwnProperty$7 = objectProto$8.hasOwnProperty;
|
7734 | function hashHas(key) {
|
7735 | var data = this.__data__;
|
7736 | return nativeCreate$1 ? data[key] !== void 0 : hasOwnProperty$7.call(data, key);
|
7737 | }
|
7738 | var HASH_UNDEFINED = "__lodash_hash_undefined__";
|
7739 | function hashSet(key, value) {
|
7740 | var data = this.__data__;
|
7741 | this.size += this.has(key) ? 0 : 1;
|
7742 | data[key] = nativeCreate$1 && value === void 0 ? HASH_UNDEFINED : value;
|
7743 | return this;
|
7744 | }
|
7745 | function Hash(entries2) {
|
7746 | var index = -1, length2 = entries2 == null ? 0 : entries2.length;
|
7747 | this.clear();
|
7748 | while (++index < length2) {
|
7749 | var entry = entries2[index];
|
7750 | this.set(entry[0], entry[1]);
|
7751 | }
|
7752 | }
|
7753 | Hash.prototype.clear = hashClear;
|
7754 | Hash.prototype["delete"] = hashDelete;
|
7755 | Hash.prototype.get = hashGet;
|
7756 | Hash.prototype.has = hashHas;
|
7757 | Hash.prototype.set = hashSet;
|
7758 | function listCacheClear() {
|
7759 | this.__data__ = [];
|
7760 | this.size = 0;
|
7761 | }
|
7762 | function eq(value, other) {
|
7763 | return value === other || value !== value && other !== other;
|
7764 | }
|
7765 | function assocIndexOf(array2, key) {
|
7766 | var length2 = array2.length;
|
7767 | while (length2--) {
|
7768 | if (eq(array2[length2][0], key)) {
|
7769 | return length2;
|
7770 | }
|
7771 | }
|
7772 | return -1;
|
7773 | }
|
7774 | var arrayProto = Array.prototype;
|
7775 | var splice = arrayProto.splice;
|
7776 | function listCacheDelete(key) {
|
7777 | var data = this.__data__, index = assocIndexOf(data, key);
|
7778 | if (index < 0) {
|
7779 | return false;
|
7780 | }
|
7781 | var lastIndex = data.length - 1;
|
7782 | if (index == lastIndex) {
|
7783 | data.pop();
|
7784 | } else {
|
7785 | splice.call(data, index, 1);
|
7786 | }
|
7787 | --this.size;
|
7788 | return true;
|
7789 | }
|
7790 | function listCacheGet(key) {
|
7791 | var data = this.__data__, index = assocIndexOf(data, key);
|
7792 | return index < 0 ? void 0 : data[index][1];
|
7793 | }
|
7794 | function listCacheHas(key) {
|
7795 | return assocIndexOf(this.__data__, key) > -1;
|
7796 | }
|
7797 | function listCacheSet(key, value) {
|
7798 | var data = this.__data__, index = assocIndexOf(data, key);
|
7799 | if (index < 0) {
|
7800 | ++this.size;
|
7801 | data.push([key, value]);
|
7802 | } else {
|
7803 | data[index][1] = value;
|
7804 | }
|
7805 | return this;
|
7806 | }
|
7807 | function ListCache(entries2) {
|
7808 | var index = -1, length2 = entries2 == null ? 0 : entries2.length;
|
7809 | this.clear();
|
7810 | while (++index < length2) {
|
7811 | var entry = entries2[index];
|
7812 | this.set(entry[0], entry[1]);
|
7813 | }
|
7814 | }
|
7815 | ListCache.prototype.clear = listCacheClear;
|
7816 | ListCache.prototype["delete"] = listCacheDelete;
|
7817 | ListCache.prototype.get = listCacheGet;
|
7818 | ListCache.prototype.has = listCacheHas;
|
7819 | ListCache.prototype.set = listCacheSet;
|
7820 | var Map$1 = getNative(root$1, "Map");
|
7821 | const Map$2 = Map$1;
|
7822 | function mapCacheClear() {
|
7823 | this.size = 0;
|
7824 | this.__data__ = {
|
7825 | "hash": new Hash(),
|
7826 | "map": new (Map$2 || ListCache)(),
|
7827 | "string": new Hash()
|
7828 | };
|
7829 | }
|
7830 | function isKeyable(value) {
|
7831 | var type2 = typeof value;
|
7832 | return type2 == "string" || type2 == "number" || type2 == "symbol" || type2 == "boolean" ? value !== "__proto__" : value === null;
|
7833 | }
|
7834 | function getMapData(map2, key) {
|
7835 | var data = map2.__data__;
|
7836 | return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
|
7837 | }
|
7838 | function mapCacheDelete(key) {
|
7839 | var result = getMapData(this, key)["delete"](key);
|
7840 | this.size -= result ? 1 : 0;
|
7841 | return result;
|
7842 | }
|
7843 | function mapCacheGet(key) {
|
7844 | return getMapData(this, key).get(key);
|
7845 | }
|
7846 | function mapCacheHas(key) {
|
7847 | return getMapData(this, key).has(key);
|
7848 | }
|
7849 | function mapCacheSet(key, value) {
|
7850 | var data = getMapData(this, key), size = data.size;
|
7851 | data.set(key, value);
|
7852 | this.size += data.size == size ? 0 : 1;
|
7853 | return this;
|
7854 | }
|
7855 | function MapCache(entries2) {
|
7856 | var index = -1, length2 = entries2 == null ? 0 : entries2.length;
|
7857 | this.clear();
|
7858 | while (++index < length2) {
|
7859 | var entry = entries2[index];
|
7860 | this.set(entry[0], entry[1]);
|
7861 | }
|
7862 | }
|
7863 | MapCache.prototype.clear = mapCacheClear;
|
7864 | MapCache.prototype["delete"] = mapCacheDelete;
|
7865 | MapCache.prototype.get = mapCacheGet;
|
7866 | MapCache.prototype.has = mapCacheHas;
|
7867 | MapCache.prototype.set = mapCacheSet;
|
7868 | var FUNC_ERROR_TEXT = "Expected a function";
|
7869 | function memoize(func, resolver) {
|
7870 | if (typeof func != "function" || resolver != null && typeof resolver != "function") {
|
7871 | throw new TypeError(FUNC_ERROR_TEXT);
|
7872 | }
|
7873 | var memoized = function() {
|
7874 | var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
|
7875 | if (cache.has(key)) {
|
7876 | return cache.get(key);
|
7877 | }
|
7878 | var result = func.apply(this, args);
|
7879 | memoized.cache = cache.set(key, result) || cache;
|
7880 | return result;
|
7881 | };
|
7882 | memoized.cache = new (memoize.Cache || MapCache)();
|
7883 | return memoized;
|
7884 | }
|
7885 | memoize.Cache = MapCache;
|
7886 | function stackClear() {
|
7887 | this.__data__ = new ListCache();
|
7888 | this.size = 0;
|
7889 | }
|
7890 | function stackDelete(key) {
|
7891 | var data = this.__data__, result = data["delete"](key);
|
7892 | this.size = data.size;
|
7893 | return result;
|
7894 | }
|
7895 | function stackGet(key) {
|
7896 | return this.__data__.get(key);
|
7897 | }
|
7898 | function stackHas(key) {
|
7899 | return this.__data__.has(key);
|
7900 | }
|
7901 | var LARGE_ARRAY_SIZE = 200;
|
7902 | function stackSet(key, value) {
|
7903 | var data = this.__data__;
|
7904 | if (data instanceof ListCache) {
|
7905 | var pairs2 = data.__data__;
|
7906 | if (!Map$2 || pairs2.length < LARGE_ARRAY_SIZE - 1) {
|
7907 | pairs2.push([key, value]);
|
7908 | this.size = ++data.size;
|
7909 | return this;
|
7910 | }
|
7911 | data = this.__data__ = new MapCache(pairs2);
|
7912 | }
|
7913 | data.set(key, value);
|
7914 | this.size = data.size;
|
7915 | return this;
|
7916 | }
|
7917 | function Stack(entries2) {
|
7918 | var data = this.__data__ = new ListCache(entries2);
|
7919 | this.size = data.size;
|
7920 | }
|
7921 | Stack.prototype.clear = stackClear;
|
7922 | Stack.prototype["delete"] = stackDelete;
|
7923 | Stack.prototype.get = stackGet;
|
7924 | Stack.prototype.has = stackHas;
|
7925 | Stack.prototype.set = stackSet;
|
7926 | var defineProperty = function() {
|
7927 | try {
|
7928 | var func = getNative(Object, "defineProperty");
|
7929 | func({}, "", {});
|
7930 | return func;
|
7931 | } catch (e) {
|
7932 | }
|
7933 | }();
|
7934 | const defineProperty$1 = defineProperty;
|
7935 | function baseAssignValue(object, key, value) {
|
7936 | if (key == "__proto__" && defineProperty$1) {
|
7937 | defineProperty$1(object, key, {
|
7938 | "configurable": true,
|
7939 | "enumerable": true,
|
7940 | "value": value,
|
7941 | "writable": true
|
7942 | });
|
7943 | } else {
|
7944 | object[key] = value;
|
7945 | }
|
7946 | }
|
7947 | function assignMergeValue(object, key, value) {
|
7948 | if (value !== void 0 && !eq(object[key], value) || value === void 0 && !(key in object)) {
|
7949 | baseAssignValue(object, key, value);
|
7950 | }
|
7951 | }
|
7952 | function createBaseFor(fromRight) {
|
7953 | return function(object, iteratee, keysFunc) {
|
7954 | var index = -1, iterable = Object(object), props = keysFunc(object), length2 = props.length;
|
7955 | while (length2--) {
|
7956 | var key = props[fromRight ? length2 : ++index];
|
7957 | if (iteratee(iterable[key], key, iterable) === false) {
|
7958 | break;
|
7959 | }
|
7960 | }
|
7961 | return object;
|
7962 | };
|
7963 | }
|
7964 | var baseFor = createBaseFor();
|
7965 | const baseFor$1 = baseFor;
|
7966 | var freeExports$2 = typeof exports == "object" && exports && !exports.nodeType && exports;
|
7967 | var freeModule$2 = freeExports$2 && typeof module == "object" && module && !module.nodeType && module;
|
7968 | var moduleExports$2 = freeModule$2 && freeModule$2.exports === freeExports$2;
|
7969 | var Buffer$1 = moduleExports$2 ? root$1.Buffer : void 0, allocUnsafe = Buffer$1 ? Buffer$1.allocUnsafe : void 0;
|
7970 | function cloneBuffer(buffer, isDeep) {
|
7971 | if (isDeep) {
|
7972 | return buffer.slice();
|
7973 | }
|
7974 | var length2 = buffer.length, result = allocUnsafe ? allocUnsafe(length2) : new buffer.constructor(length2);
|
7975 | buffer.copy(result);
|
7976 | return result;
|
7977 | }
|
7978 | var Uint8Array$1 = root$1.Uint8Array;
|
7979 | const Uint8Array$2 = Uint8Array$1;
|
7980 | function cloneArrayBuffer(arrayBuffer) {
|
7981 | var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
|
7982 | new Uint8Array$2(result).set(new Uint8Array$2(arrayBuffer));
|
7983 | return result;
|
7984 | }
|
7985 | function cloneTypedArray(typedArray, isDeep) {
|
7986 | var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
|
7987 | return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
|
7988 | }
|
7989 | function copyArray(source, array2) {
|
7990 | var index = -1, length2 = source.length;
|
7991 | array2 || (array2 = Array(length2));
|
7992 | while (++index < length2) {
|
7993 | array2[index] = source[index];
|
7994 | }
|
7995 | return array2;
|
7996 | }
|
7997 | var objectCreate = Object.create;
|
7998 | var baseCreate = function() {
|
7999 | function object() {
|
8000 | }
|
8001 | return function(proto) {
|
8002 | if (!isObject$1(proto)) {
|
8003 | return {};
|
8004 | }
|
8005 | if (objectCreate) {
|
8006 | return objectCreate(proto);
|
8007 | }
|
8008 | object.prototype = proto;
|
8009 | var result = new object();
|
8010 | object.prototype = void 0;
|
8011 | return result;
|
8012 | };
|
8013 | }();
|
8014 | const baseCreate$1 = baseCreate;
|
8015 | function overArg(func, transform) {
|
8016 | return function(arg) {
|
8017 | return func(transform(arg));
|
8018 | };
|
8019 | }
|
8020 | var getPrototype = overArg(Object.getPrototypeOf, Object);
|
8021 | const getPrototype$1 = getPrototype;
|
8022 | var objectProto$7 = Object.prototype;
|
8023 | function isPrototype(value) {
|
8024 | var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto$7;
|
8025 | return value === proto;
|
8026 | }
|
8027 | function initCloneObject(object) {
|
8028 | return typeof object.constructor == "function" && !isPrototype(object) ? baseCreate$1(getPrototype$1(object)) : {};
|
8029 | }
|
8030 | function isObjectLike(value) {
|
8031 | return value != null && typeof value == "object";
|
8032 | }
|
8033 | var argsTag$1 = "[object Arguments]";
|
8034 | function baseIsArguments(value) {
|
8035 | return isObjectLike(value) && baseGetTag(value) == argsTag$1;
|
8036 | }
|
8037 | var objectProto$6 = Object.prototype;
|
8038 | var hasOwnProperty$6 = objectProto$6.hasOwnProperty;
|
8039 | var propertyIsEnumerable = objectProto$6.propertyIsEnumerable;
|
8040 | var isArguments = baseIsArguments(function() {
|
8041 | return arguments;
|
8042 | }()) ? baseIsArguments : function(value) {
|
8043 | return isObjectLike(value) && hasOwnProperty$6.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
|
8044 | };
|
8045 | const isArguments$1 = isArguments;
|
8046 | var isArray = Array.isArray;
|
8047 | const isArray$1 = isArray;
|
8048 | var MAX_SAFE_INTEGER$1 = 9007199254740991;
|
8049 | function isLength(value) {
|
8050 | return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER$1;
|
8051 | }
|
8052 | function isArrayLike(value) {
|
8053 | return value != null && isLength(value.length) && !isFunction(value);
|
8054 | }
|
8055 | function isArrayLikeObject(value) {
|
8056 | return isObjectLike(value) && isArrayLike(value);
|
8057 | }
|
8058 | function stubFalse() {
|
8059 | return false;
|
8060 | }
|
8061 | var freeExports$1 = typeof exports == "object" && exports && !exports.nodeType && exports;
|
8062 | var freeModule$1 = freeExports$1 && typeof module == "object" && module && !module.nodeType && module;
|
8063 | var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
|
8064 | var Buffer = moduleExports$1 ? root$1.Buffer : void 0;
|
8065 | var nativeIsBuffer = Buffer ? Buffer.isBuffer : void 0;
|
8066 | var isBuffer = nativeIsBuffer || stubFalse;
|
8067 | const isBuffer$1 = isBuffer;
|
8068 | var objectTag$2 = "[object Object]";
|
8069 | var funcProto = Function.prototype, objectProto$5 = Object.prototype;
|
8070 | var funcToString = funcProto.toString;
|
8071 | var hasOwnProperty$5 = objectProto$5.hasOwnProperty;
|
8072 | var objectCtorString = funcToString.call(Object);
|
8073 | function isPlainObject(value) {
|
8074 | if (!isObjectLike(value) || baseGetTag(value) != objectTag$2) {
|
8075 | return false;
|
8076 | }
|
8077 | var proto = getPrototype$1(value);
|
8078 | if (proto === null) {
|
8079 | return true;
|
8080 | }
|
8081 | var Ctor = hasOwnProperty$5.call(proto, "constructor") && proto.constructor;
|
8082 | return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
|
8083 | }
|
8084 | var argsTag = "[object Arguments]", arrayTag = "[object Array]", boolTag = "[object Boolean]", dateTag = "[object Date]", errorTag = "[object Error]", funcTag = "[object Function]", mapTag$2 = "[object Map]", numberTag = "[object Number]", objectTag$1 = "[object Object]", regexpTag = "[object RegExp]", setTag$2 = "[object Set]", stringTag = "[object String]", weakMapTag$1 = "[object WeakMap]";
|
8085 | var arrayBufferTag = "[object ArrayBuffer]", dataViewTag$1 = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]";
|
8086 | var typedArrayTags = {};
|
8087 | typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
|
8088 | typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag$1] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag$2] = typedArrayTags[numberTag] = typedArrayTags[objectTag$1] = typedArrayTags[regexpTag] = typedArrayTags[setTag$2] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag$1] = false;
|
8089 | function baseIsTypedArray(value) {
|
8090 | return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
|
8091 | }
|
8092 | function baseUnary(func) {
|
8093 | return function(value) {
|
8094 | return func(value);
|
8095 | };
|
8096 | }
|
8097 | var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
|
8098 | var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
|
8099 | var moduleExports = freeModule && freeModule.exports === freeExports;
|
8100 | var freeProcess = moduleExports && freeGlobal$1.process;
|
8101 | var nodeUtil = function() {
|
8102 | try {
|
8103 | var types = freeModule && freeModule.require && freeModule.require("util").types;
|
8104 | if (types) {
|
8105 | return types;
|
8106 | }
|
8107 | return freeProcess && freeProcess.binding && freeProcess.binding("util");
|
8108 | } catch (e) {
|
8109 | }
|
8110 | }();
|
8111 | const nodeUtil$1 = nodeUtil;
|
8112 | var nodeIsTypedArray = nodeUtil$1 && nodeUtil$1.isTypedArray;
|
8113 | var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
|
8114 | const isTypedArray$1 = isTypedArray;
|
8115 | function safeGet(object, key) {
|
8116 | if (key === "constructor" && typeof object[key] === "function") {
|
8117 | return;
|
8118 | }
|
8119 | if (key == "__proto__") {
|
8120 | return;
|
8121 | }
|
8122 | return object[key];
|
8123 | }
|
8124 | var objectProto$4 = Object.prototype;
|
8125 | var hasOwnProperty$4 = objectProto$4.hasOwnProperty;
|
8126 | function assignValue(object, key, value) {
|
8127 | var objValue = object[key];
|
8128 | if (!(hasOwnProperty$4.call(object, key) && eq(objValue, value)) || value === void 0 && !(key in object)) {
|
8129 | baseAssignValue(object, key, value);
|
8130 | }
|
8131 | }
|
8132 | function copyObject(source, props, object, customizer) {
|
8133 | var isNew = !object;
|
8134 | object || (object = {});
|
8135 | var index = -1, length2 = props.length;
|
8136 | while (++index < length2) {
|
8137 | var key = props[index];
|
8138 | var newValue = customizer ? customizer(object[key], source[key], key, object, source) : void 0;
|
8139 | if (newValue === void 0) {
|
8140 | newValue = source[key];
|
8141 | }
|
8142 | if (isNew) {
|
8143 | baseAssignValue(object, key, newValue);
|
8144 | } else {
|
8145 | assignValue(object, key, newValue);
|
8146 | }
|
8147 | }
|
8148 | return object;
|
8149 | }
|
8150 | function baseTimes(n, iteratee) {
|
8151 | var index = -1, result = Array(n);
|
8152 | while (++index < n) {
|
8153 | result[index] = iteratee(index);
|
8154 | }
|
8155 | return result;
|
8156 | }
|
8157 | var MAX_SAFE_INTEGER = 9007199254740991;
|
8158 | var reIsUint = /^(?:0|[1-9]\d*)$/;
|
8159 | function isIndex(value, length2) {
|
8160 | var type2 = typeof value;
|
8161 | length2 = length2 == null ? MAX_SAFE_INTEGER : length2;
|
8162 | return !!length2 && (type2 == "number" || type2 != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length2);
|
8163 | }
|
8164 | var objectProto$3 = Object.prototype;
|
8165 | var hasOwnProperty$3 = objectProto$3.hasOwnProperty;
|
8166 | function arrayLikeKeys(value, inherited) {
|
8167 | var isArr = isArray$1(value), isArg = !isArr && isArguments$1(value), isBuff = !isArr && !isArg && isBuffer$1(value), isType = !isArr && !isArg && !isBuff && isTypedArray$1(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length2 = result.length;
|
8168 | for (var key in value) {
|
8169 | if ((inherited || hasOwnProperty$3.call(value, key)) && !(skipIndexes &&
|
8170 | (key == "length" ||
|
8171 | isBuff && (key == "offset" || key == "parent") ||
|
8172 | isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") ||
|
8173 | isIndex(key, length2)))) {
|
8174 | result.push(key);
|
8175 | }
|
8176 | }
|
8177 | return result;
|
8178 | }
|
8179 | function nativeKeysIn(object) {
|
8180 | var result = [];
|
8181 | if (object != null) {
|
8182 | for (var key in Object(object)) {
|
8183 | result.push(key);
|
8184 | }
|
8185 | }
|
8186 | return result;
|
8187 | }
|
8188 | var objectProto$2 = Object.prototype;
|
8189 | var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
|
8190 | function baseKeysIn(object) {
|
8191 | if (!isObject$1(object)) {
|
8192 | return nativeKeysIn(object);
|
8193 | }
|
8194 | var isProto = isPrototype(object), result = [];
|
8195 | for (var key in object) {
|
8196 | if (!(key == "constructor" && (isProto || !hasOwnProperty$2.call(object, key)))) {
|
8197 | result.push(key);
|
8198 | }
|
8199 | }
|
8200 | return result;
|
8201 | }
|
8202 | function keysIn(object) {
|
8203 | return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
|
8204 | }
|
8205 | function toPlainObject(value) {
|
8206 | return copyObject(value, keysIn(value));
|
8207 | }
|
8208 | function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
|
8209 | var objValue = safeGet(object, key), srcValue = safeGet(source, key), stacked = stack.get(srcValue);
|
8210 | if (stacked) {
|
8211 | assignMergeValue(object, key, stacked);
|
8212 | return;
|
8213 | }
|
8214 | var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : void 0;
|
8215 | var isCommon = newValue === void 0;
|
8216 | if (isCommon) {
|
8217 | var isArr = isArray$1(srcValue), isBuff = !isArr && isBuffer$1(srcValue), isTyped = !isArr && !isBuff && isTypedArray$1(srcValue);
|
8218 | newValue = srcValue;
|
8219 | if (isArr || isBuff || isTyped) {
|
8220 | if (isArray$1(objValue)) {
|
8221 | newValue = objValue;
|
8222 | } else if (isArrayLikeObject(objValue)) {
|
8223 | newValue = copyArray(objValue);
|
8224 | } else if (isBuff) {
|
8225 | isCommon = false;
|
8226 | newValue = cloneBuffer(srcValue, true);
|
8227 | } else if (isTyped) {
|
8228 | isCommon = false;
|
8229 | newValue = cloneTypedArray(srcValue, true);
|
8230 | } else {
|
8231 | newValue = [];
|
8232 | }
|
8233 | } else if (isPlainObject(srcValue) || isArguments$1(srcValue)) {
|
8234 | newValue = objValue;
|
8235 | if (isArguments$1(objValue)) {
|
8236 | newValue = toPlainObject(objValue);
|
8237 | } else if (!isObject$1(objValue) || isFunction(objValue)) {
|
8238 | newValue = initCloneObject(srcValue);
|
8239 | }
|
8240 | } else {
|
8241 | isCommon = false;
|
8242 | }
|
8243 | }
|
8244 | if (isCommon) {
|
8245 | stack.set(srcValue, newValue);
|
8246 | mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
|
8247 | stack["delete"](srcValue);
|
8248 | }
|
8249 | assignMergeValue(object, key, newValue);
|
8250 | }
|
8251 | function baseMerge(object, source, srcIndex, customizer, stack) {
|
8252 | if (object === source) {
|
8253 | return;
|
8254 | }
|
8255 | baseFor$1(source, function(srcValue, key) {
|
8256 | stack || (stack = new Stack());
|
8257 | if (isObject$1(srcValue)) {
|
8258 | baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
|
8259 | } else {
|
8260 | var newValue = customizer ? customizer(safeGet(object, key), srcValue, key + "", object, source, stack) : void 0;
|
8261 | if (newValue === void 0) {
|
8262 | newValue = srcValue;
|
8263 | }
|
8264 | assignMergeValue(object, key, newValue);
|
8265 | }
|
8266 | }, keysIn);
|
8267 | }
|
8268 | function identity(value) {
|
8269 | return value;
|
8270 | }
|
8271 | function apply(func, thisArg, args) {
|
8272 | switch (args.length) {
|
8273 | case 0:
|
8274 | return func.call(thisArg);
|
8275 | case 1:
|
8276 | return func.call(thisArg, args[0]);
|
8277 | case 2:
|
8278 | return func.call(thisArg, args[0], args[1]);
|
8279 | case 3:
|
8280 | return func.call(thisArg, args[0], args[1], args[2]);
|
8281 | }
|
8282 | return func.apply(thisArg, args);
|
8283 | }
|
8284 | var nativeMax = Math.max;
|
8285 | function overRest(func, start2, transform) {
|
8286 | start2 = nativeMax(start2 === void 0 ? func.length - 1 : start2, 0);
|
8287 | return function() {
|
8288 | var args = arguments, index = -1, length2 = nativeMax(args.length - start2, 0), array2 = Array(length2);
|
8289 | while (++index < length2) {
|
8290 | array2[index] = args[start2 + index];
|
8291 | }
|
8292 | index = -1;
|
8293 | var otherArgs = Array(start2 + 1);
|
8294 | while (++index < start2) {
|
8295 | otherArgs[index] = args[index];
|
8296 | }
|
8297 | otherArgs[start2] = transform(array2);
|
8298 | return apply(func, this, otherArgs);
|
8299 | };
|
8300 | }
|
8301 | function constant(value) {
|
8302 | return function() {
|
8303 | return value;
|
8304 | };
|
8305 | }
|
8306 | var baseSetToString = !defineProperty$1 ? identity : function(func, string) {
|
8307 | return defineProperty$1(func, "toString", {
|
8308 | "configurable": true,
|
8309 | "enumerable": false,
|
8310 | "value": constant(string),
|
8311 | "writable": true
|
8312 | });
|
8313 | };
|
8314 | const baseSetToString$1 = baseSetToString;
|
8315 | var HOT_COUNT = 800, HOT_SPAN = 16;
|
8316 | var nativeNow = Date.now;
|
8317 | function shortOut(func) {
|
8318 | var count = 0, lastCalled = 0;
|
8319 | return function() {
|
8320 | var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
|
8321 | lastCalled = stamp;
|
8322 | if (remaining > 0) {
|
8323 | if (++count >= HOT_COUNT) {
|
8324 | return arguments[0];
|
8325 | }
|
8326 | } else {
|
8327 | count = 0;
|
8328 | }
|
8329 | return func.apply(void 0, arguments);
|
8330 | };
|
8331 | }
|
8332 | var setToString = shortOut(baseSetToString$1);
|
8333 | const setToString$1 = setToString;
|
8334 | function baseRest(func, start2) {
|
8335 | return setToString$1(overRest(func, start2, identity), func + "");
|
8336 | }
|
8337 | function isIterateeCall(value, index, object) {
|
8338 | if (!isObject$1(object)) {
|
8339 | return false;
|
8340 | }
|
8341 | var type2 = typeof index;
|
8342 | if (type2 == "number" ? isArrayLike(object) && isIndex(index, object.length) : type2 == "string" && index in object) {
|
8343 | return eq(object[index], value);
|
8344 | }
|
8345 | return false;
|
8346 | }
|
8347 | function createAssigner(assigner) {
|
8348 | return baseRest(function(object, sources) {
|
8349 | var index = -1, length2 = sources.length, customizer = length2 > 1 ? sources[length2 - 1] : void 0, guard = length2 > 2 ? sources[2] : void 0;
|
8350 | customizer = assigner.length > 3 && typeof customizer == "function" ? (length2--, customizer) : void 0;
|
8351 | if (guard && isIterateeCall(sources[0], sources[1], guard)) {
|
8352 | customizer = length2 < 3 ? void 0 : customizer;
|
8353 | length2 = 1;
|
8354 | }
|
8355 | object = Object(object);
|
8356 | while (++index < length2) {
|
8357 | var source = sources[index];
|
8358 | if (source) {
|
8359 | assigner(object, source, index, customizer);
|
8360 | }
|
8361 | }
|
8362 | return object;
|
8363 | });
|
8364 | }
|
8365 | var merge$1 = createAssigner(function(object, source, srcIndex) {
|
8366 | baseMerge(object, source, srcIndex);
|
8367 | });
|
8368 | const merge$2 = merge$1;
|
8369 | const ZERO_WIDTH_SPACE = "";
|
8370 | const d3CurveTypes = {
|
8371 | curveBasis,
|
8372 | curveBasisClosed,
|
8373 | curveBasisOpen,
|
8374 | curveBumpX: bumpX,
|
8375 | curveBumpY: bumpY,
|
8376 | curveBundle,
|
8377 | curveCardinalClosed,
|
8378 | curveCardinalOpen,
|
8379 | curveCardinal,
|
8380 | curveCatmullRomClosed,
|
8381 | curveCatmullRomOpen,
|
8382 | curveCatmullRom,
|
8383 | curveLinear,
|
8384 | curveLinearClosed,
|
8385 | curveMonotoneX: monotoneX,
|
8386 | curveMonotoneY: monotoneY,
|
8387 | curveNatural,
|
8388 | curveStep,
|
8389 | curveStepAfter: stepAfter,
|
8390 | curveStepBefore: stepBefore
|
8391 | };
|
8392 | const directiveWithoutOpen = /\s*(?:(\w+)(?=:):|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi;
|
8393 | const detectInit = function(text2, config2) {
|
8394 | const inits = detectDirective(text2, /(?:init\b)|(?:initialize\b)/);
|
8395 | let results = {};
|
8396 | if (Array.isArray(inits)) {
|
8397 | const args = inits.map((init2) => init2.args);
|
8398 | sanitizeDirective(args);
|
8399 | results = assignWithDepth$1(results, [...args]);
|
8400 | } else {
|
8401 | results = inits.args;
|
8402 | }
|
8403 | if (!results) {
|
8404 | return;
|
8405 | }
|
8406 | let type2 = detectType(text2, config2);
|
8407 | const prop = "config";
|
8408 | if (results[prop] !== void 0) {
|
8409 | if (type2 === "flowchart-v2") {
|
8410 | type2 = "flowchart";
|
8411 | }
|
8412 | results[type2] = results[prop];
|
8413 | delete results[prop];
|
8414 | }
|
8415 | return results;
|
8416 | };
|
8417 | const detectDirective = function(text2, type2 = null) {
|
8418 | try {
|
8419 | const commentWithoutDirectives = new RegExp(
|
8420 | `[%]{2}(?![{]${directiveWithoutOpen.source})(?=[}][%]{2}).*
|
8421 | `,
|
8422 | "ig"
|
8423 | );
|
8424 | text2 = text2.trim().replace(commentWithoutDirectives, "").replace(/'/gm, '"');
|
8425 | log$1.debug(
|
8426 | `Detecting diagram directive${type2 !== null ? " type:" + type2 : ""} based on the text:${text2}`
|
8427 | );
|
8428 | let match;
|
8429 | const result = [];
|
8430 | while ((match = directiveRegex.exec(text2)) !== null) {
|
8431 | if (match.index === directiveRegex.lastIndex) {
|
8432 | directiveRegex.lastIndex++;
|
8433 | }
|
8434 | if (match && !type2 || type2 && match[1] && match[1].match(type2) || type2 && match[2] && match[2].match(type2)) {
|
8435 | const type22 = match[1] ? match[1] : match[2];
|
8436 | const args = match[3] ? match[3].trim() : match[4] ? JSON.parse(match[4].trim()) : null;
|
8437 | result.push({ type: type22, args });
|
8438 | }
|
8439 | }
|
8440 | if (result.length === 0) {
|
8441 | return { type: text2, args: null };
|
8442 | }
|
8443 | return result.length === 1 ? result[0] : result;
|
8444 | } catch (error) {
|
8445 | log$1.error(
|
8446 | `ERROR: ${error.message} - Unable to parse directive type: '${type2}' based on the text: '${text2}'`
|
8447 | );
|
8448 | return { type: void 0, args: null };
|
8449 | }
|
8450 | };
|
8451 | const removeDirectives = function(text2) {
|
8452 | return text2.replace(directiveRegex, "");
|
8453 | };
|
8454 | const isSubstringInArray = function(str2, arr) {
|
8455 | for (const [i, element] of arr.entries()) {
|
8456 | if (element.match(str2)) {
|
8457 | return i;
|
8458 | }
|
8459 | }
|
8460 | return -1;
|
8461 | };
|
8462 | function interpolateToCurve(interpolate2, defaultCurve) {
|
8463 | if (!interpolate2) {
|
8464 | return defaultCurve;
|
8465 | }
|
8466 | const curveName = `curve${interpolate2.charAt(0).toUpperCase() + interpolate2.slice(1)}`;
|
8467 | return d3CurveTypes[curveName] ?? defaultCurve;
|
8468 | }
|
8469 | function formatUrl(linkStr, config2) {
|
8470 | const url = linkStr.trim();
|
8471 | if (!url) {
|
8472 | return void 0;
|
8473 | }
|
8474 | if (config2.securityLevel !== "loose") {
|
8475 | return dist.sanitizeUrl(url);
|
8476 | }
|
8477 | return url;
|
8478 | }
|
8479 | const runFunc = (functionName, ...params) => {
|
8480 | const arrPaths = functionName.split(".");
|
8481 | const len = arrPaths.length - 1;
|
8482 | const fnName = arrPaths[len];
|
8483 | let obj = window;
|
8484 | for (let i = 0; i < len; i++) {
|
8485 | obj = obj[arrPaths[i]];
|
8486 | if (!obj) {
|
8487 | log$1.error(`Function name: ${functionName} not found in window`);
|
8488 | return;
|
8489 | }
|
8490 | }
|
8491 | obj[fnName](...params);
|
8492 | };
|
8493 | function distance(p1, p2) {
|
8494 | if (!p1 || !p2) {
|
8495 | return 0;
|
8496 | }
|
8497 | return Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2));
|
8498 | }
|
8499 | function traverseEdge(points) {
|
8500 | let prevPoint;
|
8501 | let totalDistance = 0;
|
8502 | points.forEach((point2) => {
|
8503 | totalDistance += distance(point2, prevPoint);
|
8504 | prevPoint = point2;
|
8505 | });
|
8506 | const remainingDistance = totalDistance / 2;
|
8507 | return calculatePoint(points, remainingDistance);
|
8508 | }
|
8509 | function calcLabelPosition(points) {
|
8510 | if (points.length === 1) {
|
8511 | return points[0];
|
8512 | }
|
8513 | return traverseEdge(points);
|
8514 | }
|
8515 | const roundNumber = (num, precision = 2) => {
|
8516 | const factor = Math.pow(10, precision);
|
8517 | return Math.round(num * factor) / factor;
|
8518 | };
|
8519 | const calculatePoint = (points, distanceToTraverse) => {
|
8520 | let prevPoint = void 0;
|
8521 | let remainingDistance = distanceToTraverse;
|
8522 | for (const point2 of points) {
|
8523 | if (prevPoint) {
|
8524 | const vectorDistance = distance(point2, prevPoint);
|
8525 | if (vectorDistance < remainingDistance) {
|
8526 | remainingDistance -= vectorDistance;
|
8527 | } else {
|
8528 | const distanceRatio = remainingDistance / vectorDistance;
|
8529 | if (distanceRatio <= 0) {
|
8530 | return prevPoint;
|
8531 | }
|
8532 | if (distanceRatio >= 1) {
|
8533 | return { x: point2.x, y: point2.y };
|
8534 | }
|
8535 | if (distanceRatio > 0 && distanceRatio < 1) {
|
8536 | return {
|
8537 | x: roundNumber((1 - distanceRatio) * prevPoint.x + distanceRatio * point2.x, 5),
|
8538 | y: roundNumber((1 - distanceRatio) * prevPoint.y + distanceRatio * point2.y, 5)
|
8539 | };
|
8540 | }
|
8541 | }
|
8542 | }
|
8543 | prevPoint = point2;
|
8544 | }
|
8545 | throw new Error("Could not find a suitable point for the given distance");
|
8546 | };
|
8547 | const calcCardinalityPosition = (isRelationTypePresent, points, initialPosition) => {
|
8548 | log$1.info(`our points ${JSON.stringify(points)}`);
|
8549 | if (points[0] !== initialPosition) {
|
8550 | points = points.reverse();
|
8551 | }
|
8552 | const distanceToCardinalityPoint = 25;
|
8553 | const center = calculatePoint(points, distanceToCardinalityPoint);
|
8554 | const d = isRelationTypePresent ? 10 : 5;
|
8555 | const angle = Math.atan2(points[0].y - center.y, points[0].x - center.x);
|
8556 | const cardinalityPosition = { x: 0, y: 0 };
|
8557 | cardinalityPosition.x = Math.sin(angle) * d + (points[0].x + center.x) / 2;
|
8558 | cardinalityPosition.y = -Math.cos(angle) * d + (points[0].y + center.y) / 2;
|
8559 | return cardinalityPosition;
|
8560 | };
|
8561 | function calcTerminalLabelPosition(terminalMarkerSize, position2, _points) {
|
8562 | const points = structuredClone(_points);
|
8563 | log$1.info("our points", points);
|
8564 | if (position2 !== "start_left" && position2 !== "start_right") {
|
8565 | points.reverse();
|
8566 | }
|
8567 | const distanceToCardinalityPoint = 25 + terminalMarkerSize;
|
8568 | const center = calculatePoint(points, distanceToCardinalityPoint);
|
8569 | const d = 10 + terminalMarkerSize * 0.5;
|
8570 | const angle = Math.atan2(points[0].y - center.y, points[0].x - center.x);
|
8571 | const cardinalityPosition = { x: 0, y: 0 };
|
8572 | if (position2 === "start_left") {
|
8573 | cardinalityPosition.x = Math.sin(angle + Math.PI) * d + (points[0].x + center.x) / 2;
|
8574 | cardinalityPosition.y = -Math.cos(angle + Math.PI) * d + (points[0].y + center.y) / 2;
|
8575 | } else if (position2 === "end_right") {
|
8576 | cardinalityPosition.x = Math.sin(angle - Math.PI) * d + (points[0].x + center.x) / 2 - 5;
|
8577 | cardinalityPosition.y = -Math.cos(angle - Math.PI) * d + (points[0].y + center.y) / 2 - 5;
|
8578 | } else if (position2 === "end_left") {
|
8579 | cardinalityPosition.x = Math.sin(angle) * d + (points[0].x + center.x) / 2 - 5;
|
8580 | cardinalityPosition.y = -Math.cos(angle) * d + (points[0].y + center.y) / 2 - 5;
|
8581 | } else {
|
8582 | cardinalityPosition.x = Math.sin(angle) * d + (points[0].x + center.x) / 2;
|
8583 | cardinalityPosition.y = -Math.cos(angle) * d + (points[0].y + center.y) / 2;
|
8584 | }
|
8585 | return cardinalityPosition;
|
8586 | }
|
8587 | function getStylesFromArray(arr) {
|
8588 | let style = "";
|
8589 | let labelStyle = "";
|
8590 | for (const element of arr) {
|
8591 | if (element !== void 0) {
|
8592 | if (element.startsWith("color:") || element.startsWith("text-align:")) {
|
8593 | labelStyle = labelStyle + element + ";";
|
8594 | } else {
|
8595 | style = style + element + ";";
|
8596 | }
|
8597 | }
|
8598 | }
|
8599 | return { style, labelStyle };
|
8600 | }
|
8601 | let cnt = 0;
|
8602 | const generateId = () => {
|
8603 | cnt++;
|
8604 | return "id-" + Math.random().toString(36).substr(2, 12) + "-" + cnt;
|
8605 | };
|
8606 | function makeRandomHex(length2) {
|
8607 | let result = "";
|
8608 | const characters2 = "0123456789abcdef";
|
8609 | const charactersLength = characters2.length;
|
8610 | for (let i = 0; i < length2; i++) {
|
8611 | result += characters2.charAt(Math.floor(Math.random() * charactersLength));
|
8612 | }
|
8613 | return result;
|
8614 | }
|
8615 | const random = (options) => {
|
8616 | return makeRandomHex(options.length);
|
8617 | };
|
8618 | const getTextObj = function() {
|
8619 | return {
|
8620 | x: 0,
|
8621 | y: 0,
|
8622 | fill: void 0,
|
8623 | anchor: "start",
|
8624 | style: "#666",
|
8625 | width: 100,
|
8626 | height: 100,
|
8627 | textMargin: 0,
|
8628 | rx: 0,
|
8629 | ry: 0,
|
8630 | valign: void 0,
|
8631 | text: ""
|
8632 | };
|
8633 | };
|
8634 | const drawSimpleText = function(elem, textData) {
|
8635 | const nText = textData.text.replace(common$1.lineBreakRegex, " ");
|
8636 | const [, _fontSizePx] = parseFontSize(textData.fontSize);
|
8637 | const textElem = elem.append("text");
|
8638 | textElem.attr("x", textData.x);
|
8639 | textElem.attr("y", textData.y);
|
8640 | textElem.style("text-anchor", textData.anchor);
|
8641 | textElem.style("font-family", textData.fontFamily);
|
8642 | textElem.style("font-size", _fontSizePx);
|
8643 | textElem.style("font-weight", textData.fontWeight);
|
8644 | textElem.attr("fill", textData.fill);
|
8645 | if (textData.class !== void 0) {
|
8646 | textElem.attr("class", textData.class);
|
8647 | }
|
8648 | const span = textElem.append("tspan");
|
8649 | span.attr("x", textData.x + textData.textMargin * 2);
|
8650 | span.attr("fill", textData.fill);
|
8651 | span.text(nText);
|
8652 | return textElem;
|
8653 | };
|
8654 | const wrapLabel = memoize(
|
8655 | (label, maxWidth, config2) => {
|
8656 | if (!label) {
|
8657 | return label;
|
8658 | }
|
8659 | config2 = Object.assign(
|
8660 | { fontSize: 12, fontWeight: 400, fontFamily: "Arial", joinWith: "<br/>" },
|
8661 | config2
|
8662 | );
|
8663 | if (common$1.lineBreakRegex.test(label)) {
|
8664 | return label;
|
8665 | }
|
8666 | const words = label.split(" ");
|
8667 | const completedLines = [];
|
8668 | let nextLine = "";
|
8669 | words.forEach((word, index) => {
|
8670 | const wordLength = calculateTextWidth(`${word} `, config2);
|
8671 | const nextLineLength = calculateTextWidth(nextLine, config2);
|
8672 | if (wordLength > maxWidth) {
|
8673 | const { hyphenatedStrings, remainingWord } = breakString(word, maxWidth, "-", config2);
|
8674 | completedLines.push(nextLine, ...hyphenatedStrings);
|
8675 | nextLine = remainingWord;
|
8676 | } else if (nextLineLength + wordLength >= maxWidth) {
|
8677 | completedLines.push(nextLine);
|
8678 | nextLine = word;
|
8679 | } else {
|
8680 | nextLine = [nextLine, word].filter(Boolean).join(" ");
|
8681 | }
|
8682 | const currentWord = index + 1;
|
8683 | const isLastWord = currentWord === words.length;
|
8684 | if (isLastWord) {
|
8685 | completedLines.push(nextLine);
|
8686 | }
|
8687 | });
|
8688 | return completedLines.filter((line2) => line2 !== "").join(config2.joinWith);
|
8689 | },
|
8690 | (label, maxWidth, config2) => `${label}${maxWidth}${config2.fontSize}${config2.fontWeight}${config2.fontFamily}${config2.joinWith}`
|
8691 | );
|
8692 | const breakString = memoize(
|
8693 | (word, maxWidth, hyphenCharacter = "-", config2) => {
|
8694 | config2 = Object.assign(
|
8695 | { fontSize: 12, fontWeight: 400, fontFamily: "Arial", margin: 0 },
|
8696 | config2
|
8697 | );
|
8698 | const characters2 = [...word];
|
8699 | const lines = [];
|
8700 | let currentLine = "";
|
8701 | characters2.forEach((character2, index) => {
|
8702 | const nextLine = `${currentLine}${character2}`;
|
8703 | const lineWidth = calculateTextWidth(nextLine, config2);
|
8704 | if (lineWidth >= maxWidth) {
|
8705 | const currentCharacter = index + 1;
|
8706 | const isLastLine = characters2.length === currentCharacter;
|
8707 | const hyphenatedNextLine = `${nextLine}${hyphenCharacter}`;
|
8708 | lines.push(isLastLine ? nextLine : hyphenatedNextLine);
|
8709 | currentLine = "";
|
8710 | } else {
|
8711 | currentLine = nextLine;
|
8712 | }
|
8713 | });
|
8714 | return { hyphenatedStrings: lines, remainingWord: currentLine };
|
8715 | },
|
8716 | (word, maxWidth, hyphenCharacter = "-", config2) => `${word}${maxWidth}${hyphenCharacter}${config2.fontSize}${config2.fontWeight}${config2.fontFamily}`
|
8717 | );
|
8718 | function calculateTextHeight(text2, config2) {
|
8719 | return calculateTextDimensions(text2, config2).height;
|
8720 | }
|
8721 | function calculateTextWidth(text2, config2) {
|
8722 | return calculateTextDimensions(text2, config2).width;
|
8723 | }
|
8724 | const calculateTextDimensions = memoize(
|
8725 | (text2, config2) => {
|
8726 | const { fontSize = 12, fontFamily = "Arial", fontWeight = 400 } = config2;
|
8727 | if (!text2) {
|
8728 | return { width: 0, height: 0 };
|
8729 | }
|
8730 | const [, _fontSizePx] = parseFontSize(fontSize);
|
8731 | const fontFamilies = ["sans-serif", fontFamily];
|
8732 | const lines = text2.split(common$1.lineBreakRegex);
|
8733 | const dims = [];
|
8734 | const body = d3select("body");
|
8735 | if (!body.remove) {
|
8736 | return { width: 0, height: 0, lineHeight: 0 };
|
8737 | }
|
8738 | const g = body.append("svg");
|
8739 | for (const fontFamily2 of fontFamilies) {
|
8740 | let cHeight = 0;
|
8741 | const dim = { width: 0, height: 0, lineHeight: 0 };
|
8742 | for (const line2 of lines) {
|
8743 | const textObj = getTextObj();
|
8744 | textObj.text = line2 || ZERO_WIDTH_SPACE;
|
8745 | const textElem = drawSimpleText(g, textObj).style("font-size", _fontSizePx).style("font-weight", fontWeight).style("font-family", fontFamily2);
|
8746 | const bBox = (textElem._groups || textElem)[0][0].getBBox();
|
8747 | if (bBox.width === 0 && bBox.height === 0) {
|
8748 | throw new Error("svg element not in render tree");
|
8749 | }
|
8750 | dim.width = Math.round(Math.max(dim.width, bBox.width));
|
8751 | cHeight = Math.round(bBox.height);
|
8752 | dim.height += cHeight;
|
8753 | dim.lineHeight = Math.round(Math.max(dim.lineHeight, cHeight));
|
8754 | }
|
8755 | dims.push(dim);
|
8756 | }
|
8757 | g.remove();
|
8758 | 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;
|
8759 | return dims[index];
|
8760 | },
|
8761 | (text2, config2) => `${text2}${config2.fontSize}${config2.fontWeight}${config2.fontFamily}`
|
8762 | );
|
8763 | class InitIDGenerator {
|
8764 | constructor(deterministic = false, seed) {
|
8765 | this.count = 0;
|
8766 | this.count = seed ? seed.length : 0;
|
8767 | this.next = deterministic ? () => this.count++ : () => Date.now();
|
8768 | }
|
8769 | }
|
8770 | let decoder;
|
8771 | const entityDecode = function(html2) {
|
8772 | decoder = decoder || document.createElement("div");
|
8773 | html2 = escape(html2).replace(/%26/g, "&").replace(/%23/g, "#").replace(/%3B/g, ";");
|
8774 | decoder.innerHTML = html2;
|
8775 | return unescape(decoder.textContent);
|
8776 | };
|
8777 | function isDetailedError(error) {
|
8778 | return "str" in error;
|
8779 | }
|
8780 | const insertTitle = (parent, cssClass, titleTopMargin, title) => {
|
8781 | var _a;
|
8782 | if (!title) {
|
8783 | return;
|
8784 | }
|
8785 | const bounds = (_a = parent.node()) == null ? void 0 : _a.getBBox();
|
8786 | if (!bounds) {
|
8787 | return;
|
8788 | }
|
8789 | parent.append("text").text(title).attr("x", bounds.x + bounds.width / 2).attr("y", -titleTopMargin).attr("class", cssClass);
|
8790 | };
|
8791 | const parseFontSize = (fontSize) => {
|
8792 | if (typeof fontSize === "number") {
|
8793 | return [fontSize, fontSize + "px"];
|
8794 | }
|
8795 | const fontSizeNumber = parseInt(fontSize ?? "", 10);
|
8796 | if (Number.isNaN(fontSizeNumber)) {
|
8797 | return [void 0, void 0];
|
8798 | } else if (fontSize === String(fontSizeNumber)) {
|
8799 | return [fontSizeNumber, fontSize + "px"];
|
8800 | } else {
|
8801 | return [fontSizeNumber, fontSize];
|
8802 | }
|
8803 | };
|
8804 | function cleanAndMerge(defaultData, data) {
|
8805 | return merge$2({}, defaultData, data);
|
8806 | }
|
8807 | const utils = {
|
8808 | assignWithDepth: assignWithDepth$1,
|
8809 | wrapLabel,
|
8810 | calculateTextHeight,
|
8811 | calculateTextWidth,
|
8812 | calculateTextDimensions,
|
8813 | cleanAndMerge,
|
8814 | detectInit,
|
8815 | detectDirective,
|
8816 | isSubstringInArray,
|
8817 | interpolateToCurve,
|
8818 | calcLabelPosition,
|
8819 | calcCardinalityPosition,
|
8820 | calcTerminalLabelPosition,
|
8821 | formatUrl,
|
8822 | getStylesFromArray,
|
8823 | generateId,
|
8824 | random,
|
8825 | runFunc,
|
8826 | entityDecode,
|
8827 | insertTitle,
|
8828 | parseFontSize,
|
8829 | InitIDGenerator
|
8830 | };
|
8831 | const encodeEntities = function(text2) {
|
8832 | let txt = text2;
|
8833 | txt = txt.replace(/style.*:\S*#.*;/g, function(s) {
|
8834 | return s.substring(0, s.length - 1);
|
8835 | });
|
8836 | txt = txt.replace(/classDef.*:\S*#.*;/g, function(s) {
|
8837 | return s.substring(0, s.length - 1);
|
8838 | });
|
8839 | txt = txt.replace(/#\w+;/g, function(s) {
|
8840 | const innerTxt = s.substring(1, s.length - 1);
|
8841 | const isInt = /^\+?\d+$/.test(innerTxt);
|
8842 | if (isInt) {
|
8843 | return "fl°°" + innerTxt + "¶ß";
|
8844 | } else {
|
8845 | return "fl°" + innerTxt + "¶ß";
|
8846 | }
|
8847 | });
|
8848 | return txt;
|
8849 | };
|
8850 | const decodeEntities = function(text2) {
|
8851 | return text2.replace(/fl°°/g, "&#").replace(/fl°/g, "&").replace(/¶ß/g, ";");
|
8852 | };
|
8853 | var COMMENT = "comm";
|
8854 | var RULESET = "rule";
|
8855 | var DECLARATION = "decl";
|
8856 | var IMPORT = "@import";
|
8857 | var KEYFRAMES = "@keyframes";
|
8858 | var LAYER = "@layer";
|
8859 | var abs = Math.abs;
|
8860 | var from = String.fromCharCode;
|
8861 | function trim(value) {
|
8862 | return value.trim();
|
8863 | }
|
8864 | function replace(value, pattern, replacement) {
|
8865 | return value.replace(pattern, replacement);
|
8866 | }
|
8867 | function indexof(value, search, position2) {
|
8868 | return value.indexOf(search, position2);
|
8869 | }
|
8870 | function charat(value, index) {
|
8871 | return value.charCodeAt(index) | 0;
|
8872 | }
|
8873 | function substr(value, begin, end) {
|
8874 | return value.slice(begin, end);
|
8875 | }
|
8876 | function strlen(value) {
|
8877 | return value.length;
|
8878 | }
|
8879 | function sizeof(value) {
|
8880 | return value.length;
|
8881 | }
|
8882 | function append(value, array2) {
|
8883 | return array2.push(value), value;
|
8884 | }
|
8885 | var line = 1;
|
8886 | var column = 1;
|
8887 | var length = 0;
|
8888 | var position = 0;
|
8889 | var character = 0;
|
8890 | var characters = "";
|
8891 | function node(value, root2, parent, type2, props, children2, length2, siblings) {
|
8892 | return { value, root: root2, parent, type: type2, props, children: children2, line, column, length: length2, return: "", siblings };
|
8893 | }
|
8894 | function char() {
|
8895 | return character;
|
8896 | }
|
8897 | function prev() {
|
8898 | character = position > 0 ? charat(characters, --position) : 0;
|
8899 | if (column--, character === 10)
|
8900 | column = 1, line--;
|
8901 | return character;
|
8902 | }
|
8903 | function next() {
|
8904 | character = position < length ? charat(characters, position++) : 0;
|
8905 | if (column++, character === 10)
|
8906 | column = 1, line++;
|
8907 | return character;
|
8908 | }
|
8909 | function peek() {
|
8910 | return charat(characters, position);
|
8911 | }
|
8912 | function caret() {
|
8913 | return position;
|
8914 | }
|
8915 | function slice(begin, end) {
|
8916 | return substr(characters, begin, end);
|
8917 | }
|
8918 | function token(type2) {
|
8919 | switch (type2) {
|
8920 | case 0:
|
8921 | case 9:
|
8922 | case 10:
|
8923 | case 13:
|
8924 | case 32:
|
8925 | return 5;
|
8926 | case 33:
|
8927 | case 43:
|
8928 | case 44:
|
8929 | case 47:
|
8930 | case 62:
|
8931 | case 64:
|
8932 | case 126:
|
8933 | case 59:
|
8934 | case 123:
|
8935 | case 125:
|
8936 | return 4;
|
8937 | case 58:
|
8938 | return 3;
|
8939 | case 34:
|
8940 | case 39:
|
8941 | case 40:
|
8942 | case 91:
|
8943 | return 2;
|
8944 | case 41:
|
8945 | case 93:
|
8946 | return 1;
|
8947 | }
|
8948 | return 0;
|
8949 | }
|
8950 | function alloc(value) {
|
8951 | return line = column = 1, length = strlen(characters = value), position = 0, [];
|
8952 | }
|
8953 | function dealloc(value) {
|
8954 | return characters = "", value;
|
8955 | }
|
8956 | function delimit(type2) {
|
8957 | return trim(slice(position - 1, delimiter(type2 === 91 ? type2 + 2 : type2 === 40 ? type2 + 1 : type2)));
|
8958 | }
|
8959 | function whitespace(type2) {
|
8960 | while (character = peek())
|
8961 | if (character < 33)
|
8962 | next();
|
8963 | else
|
8964 | break;
|
8965 | return token(type2) > 2 || token(character) > 3 ? "" : " ";
|
8966 | }
|
8967 | function escaping(index, count) {
|
8968 | while (--count && next())
|
8969 | if (character < 48 || character > 102 || character > 57 && character < 65 || character > 70 && character < 97)
|
8970 | break;
|
8971 | return slice(index, caret() + (count < 6 && peek() == 32 && next() == 32));
|
8972 | }
|
8973 | function delimiter(type2) {
|
8974 | while (next())
|
8975 | switch (character) {
|
8976 | case type2:
|
8977 | return position;
|
8978 | case 34:
|
8979 | case 39:
|
8980 | if (type2 !== 34 && type2 !== 39)
|
8981 | delimiter(character);
|
8982 | break;
|
8983 | case 40:
|
8984 | if (type2 === 41)
|
8985 | delimiter(type2);
|
8986 | break;
|
8987 | case 92:
|
8988 | next();
|
8989 | break;
|
8990 | }
|
8991 | return position;
|
8992 | }
|
8993 | function commenter(type2, index) {
|
8994 | while (next())
|
8995 | if (type2 + character === 47 + 10)
|
8996 | break;
|
8997 | else if (type2 + character === 42 + 42 && peek() === 47)
|
8998 | break;
|
8999 | return "/*" + slice(index, position - 1) + "*" + from(type2 === 47 ? type2 : next());
|
9000 | }
|
9001 | function identifier(index) {
|
9002 | while (!token(peek()))
|
9003 | next();
|
9004 | return slice(index, position);
|
9005 | }
|
9006 | function compile(value) {
|
9007 | return dealloc(parse$2("", null, null, null, [""], value = alloc(value), 0, [0], value));
|
9008 | }
|
9009 | function parse$2(value, root2, parent, rule, rules, rulesets, pseudo, points, declarations) {
|
9010 | var index = 0;
|
9011 | var offset = 0;
|
9012 | var length2 = pseudo;
|
9013 | var atrule = 0;
|
9014 | var property = 0;
|
9015 | var previous = 0;
|
9016 | var variable = 1;
|
9017 | var scanning = 1;
|
9018 | var ampersand = 1;
|
9019 | var character2 = 0;
|
9020 | var type2 = "";
|
9021 | var props = rules;
|
9022 | var children2 = rulesets;
|
9023 | var reference = rule;
|
9024 | var characters2 = type2;
|
9025 | while (scanning)
|
9026 | switch (previous = character2, character2 = next()) {
|
9027 | case 40:
|
9028 | if (previous != 108 && charat(characters2, length2 - 1) == 58) {
|
9029 | if (indexof(characters2 += replace(delimit(character2), "&", "&\f"), "&\f", abs(index ? points[index - 1] : 0)) != -1)
|
9030 | ampersand = -1;
|
9031 | break;
|
9032 | }
|
9033 | case 34:
|
9034 | case 39:
|
9035 | case 91:
|
9036 | characters2 += delimit(character2);
|
9037 | break;
|
9038 | case 9:
|
9039 | case 10:
|
9040 | case 13:
|
9041 | case 32:
|
9042 | characters2 += whitespace(previous);
|
9043 | break;
|
9044 | case 92:
|
9045 | characters2 += escaping(caret() - 1, 7);
|
9046 | continue;
|
9047 | case 47:
|
9048 | switch (peek()) {
|
9049 | case 42:
|
9050 | case 47:
|
9051 | append(comment(commenter(next(), caret()), root2, parent, declarations), declarations);
|
9052 | break;
|
9053 | default:
|
9054 | characters2 += "/";
|
9055 | }
|
9056 | break;
|
9057 | case 123 * variable:
|
9058 | points[index++] = strlen(characters2) * ampersand;
|
9059 | case 125 * variable:
|
9060 | case 59:
|
9061 | case 0:
|
9062 | switch (character2) {
|
9063 | case 0:
|
9064 | case 125:
|
9065 | scanning = 0;
|
9066 | case 59 + offset:
|
9067 | if (ampersand == -1)
|
9068 | characters2 = replace(characters2, /\f/g, "");
|
9069 | if (property > 0 && strlen(characters2) - length2)
|
9070 | append(property > 32 ? declaration(characters2 + ";", rule, parent, length2 - 1, declarations) : declaration(replace(characters2, " ", "") + ";", rule, parent, length2 - 2, declarations), declarations);
|
9071 | break;
|
9072 | case 59:
|
9073 | characters2 += ";";
|
9074 | default:
|
9075 | append(reference = ruleset(characters2, root2, parent, index, offset, rules, points, type2, props = [], children2 = [], length2, rulesets), rulesets);
|
9076 | if (character2 === 123)
|
9077 | if (offset === 0)
|
9078 | parse$2(characters2, root2, reference, reference, props, rulesets, length2, points, children2);
|
9079 | else
|
9080 | switch (atrule === 99 && charat(characters2, 3) === 110 ? 100 : atrule) {
|
9081 | case 100:
|
9082 | case 108:
|
9083 | case 109:
|
9084 | case 115:
|
9085 | parse$2(value, reference, reference, rule && append(ruleset(value, reference, reference, 0, 0, rules, points, type2, rules, props = [], length2, children2), children2), rules, children2, length2, points, rule ? props : children2);
|
9086 | break;
|
9087 | default:
|
9088 | parse$2(characters2, reference, reference, reference, [""], children2, 0, points, children2);
|
9089 | }
|
9090 | }
|
9091 | index = offset = property = 0, variable = ampersand = 1, type2 = characters2 = "", length2 = pseudo;
|
9092 | break;
|
9093 | case 58:
|
9094 | length2 = 1 + strlen(characters2), property = previous;
|
9095 | default:
|
9096 | if (variable < 1) {
|
9097 | if (character2 == 123)
|
9098 | --variable;
|
9099 | else if (character2 == 125 && variable++ == 0 && prev() == 125)
|
9100 | continue;
|
9101 | }
|
9102 | switch (characters2 += from(character2), character2 * variable) {
|
9103 | case 38:
|
9104 | ampersand = offset > 0 ? 1 : (characters2 += "\f", -1);
|
9105 | break;
|
9106 | case 44:
|
9107 | points[index++] = (strlen(characters2) - 1) * ampersand, ampersand = 1;
|
9108 | break;
|
9109 | case 64:
|
9110 | if (peek() === 45)
|
9111 | characters2 += delimit(next());
|
9112 | atrule = peek(), offset = length2 = strlen(type2 = characters2 += identifier(caret())), character2++;
|
9113 | break;
|
9114 | case 45:
|
9115 | if (previous === 45 && strlen(characters2) == 2)
|
9116 | variable = 0;
|
9117 | }
|
9118 | }
|
9119 | return rulesets;
|
9120 | }
|
9121 | function ruleset(value, root2, parent, index, offset, rules, points, type2, props, children2, length2, siblings) {
|
9122 | var post = offset - 1;
|
9123 | var rule = offset === 0 ? rules : [""];
|
9124 | var size = sizeof(rule);
|
9125 | for (var i = 0, j = 0, k = 0; i < index; ++i)
|
9126 | for (var x = 0, y = substr(value, post + 1, post = abs(j = points[i])), z = value; x < size; ++x)
|
9127 | if (z = trim(j > 0 ? rule[x] + " " + y : replace(y, /&\f/g, rule[x])))
|
9128 | props[k++] = z;
|
9129 | return node(value, root2, parent, offset === 0 ? RULESET : type2, props, children2, length2, siblings);
|
9130 | }
|
9131 | function comment(value, root2, parent, siblings) {
|
9132 | return node(value, root2, parent, COMMENT, from(char()), substr(value, 2, -2), 0, siblings);
|
9133 | }
|
9134 | function declaration(value, root2, parent, length2, siblings) {
|
9135 | return node(value, root2, parent, DECLARATION, substr(value, 0, length2), substr(value, length2 + 1, -1), length2, siblings);
|
9136 | }
|
9137 | function serialize(children2, callback) {
|
9138 | var output = "";
|
9139 | for (var i = 0; i < children2.length; i++)
|
9140 | output += callback(children2[i], i, children2, callback) || "";
|
9141 | return output;
|
9142 | }
|
9143 | function stringify(element, index, children2, callback) {
|
9144 | switch (element.type) {
|
9145 | case LAYER:
|
9146 | if (element.children.length)
|
9147 | break;
|
9148 | case IMPORT:
|
9149 | case DECLARATION:
|
9150 | return element.return = element.return || element.value;
|
9151 | case COMMENT:
|
9152 | return "";
|
9153 | case KEYFRAMES:
|
9154 | return element.return = element.value + "{" + serialize(element.children, callback) + "}";
|
9155 | case RULESET:
|
9156 | if (!strlen(element.value = element.props.join(",")))
|
9157 | return "";
|
9158 | }
|
9159 | return strlen(children2 = serialize(element.children, callback)) ? element.return = element.value + "{" + children2 + "}" : "";
|
9160 | }
|
9161 | const version = "10.9.1";
|
9162 | const defaultConfig$1 = Object.freeze(defaultConfig$2);
|
9163 | let siteConfig = assignWithDepth$1({}, defaultConfig$1);
|
9164 | let configFromInitialize;
|
9165 | let directives = [];
|
9166 | let currentConfig = assignWithDepth$1({}, defaultConfig$1);
|
9167 | const updateCurrentConfig = (siteCfg, _directives) => {
|
9168 | let cfg = assignWithDepth$1({}, siteCfg);
|
9169 | let sumOfDirectives = {};
|
9170 | for (const d of _directives) {
|
9171 | sanitize(d);
|
9172 | sumOfDirectives = assignWithDepth$1(sumOfDirectives, d);
|
9173 | }
|
9174 | cfg = assignWithDepth$1(cfg, sumOfDirectives);
|
9175 | if (sumOfDirectives.theme && sumOfDirectives.theme in theme) {
|
9176 | const tmpConfigFromInitialize = assignWithDepth$1({}, configFromInitialize);
|
9177 | const themeVariables = assignWithDepth$1(
|
9178 | tmpConfigFromInitialize.themeVariables || {},
|
9179 | sumOfDirectives.themeVariables
|
9180 | );
|
9181 | if (cfg.theme && cfg.theme in theme) {
|
9182 | cfg.themeVariables = theme[cfg.theme].getThemeVariables(themeVariables);
|
9183 | }
|
9184 | }
|
9185 | currentConfig = cfg;
|
9186 | checkConfig(currentConfig);
|
9187 | return currentConfig;
|
9188 | };
|
9189 | const setSiteConfig = (conf) => {
|
9190 | siteConfig = assignWithDepth$1({}, defaultConfig$1);
|
9191 | siteConfig = assignWithDepth$1(siteConfig, conf);
|
9192 | if (conf.theme && theme[conf.theme]) {
|
9193 | siteConfig.themeVariables = theme[conf.theme].getThemeVariables(conf.themeVariables);
|
9194 | }
|
9195 | updateCurrentConfig(siteConfig, directives);
|
9196 | return siteConfig;
|
9197 | };
|
9198 | const saveConfigFromInitialize = (conf) => {
|
9199 | configFromInitialize = assignWithDepth$1({}, conf);
|
9200 | };
|
9201 | const updateSiteConfig = (conf) => {
|
9202 | siteConfig = assignWithDepth$1(siteConfig, conf);
|
9203 | updateCurrentConfig(siteConfig, directives);
|
9204 | return siteConfig;
|
9205 | };
|
9206 | const getSiteConfig = () => {
|
9207 | return assignWithDepth$1({}, siteConfig);
|
9208 | };
|
9209 | const setConfig$1 = (conf) => {
|
9210 | checkConfig(conf);
|
9211 | assignWithDepth$1(currentConfig, conf);
|
9212 | return getConfig$1();
|
9213 | };
|
9214 | const getConfig$1 = () => {
|
9215 | return assignWithDepth$1({}, currentConfig);
|
9216 | };
|
9217 | const sanitize = (options) => {
|
9218 | if (!options) {
|
9219 | return;
|
9220 | }
|
9221 | ["secure", ...siteConfig.secure ?? []].forEach((key) => {
|
9222 | if (Object.hasOwn(options, key)) {
|
9223 | log$1.debug(`Denied attempt to modify a secure key ${key}`, options[key]);
|
9224 | delete options[key];
|
9225 | }
|
9226 | });
|
9227 | Object.keys(options).forEach((key) => {
|
9228 | if (key.startsWith("__")) {
|
9229 | delete options[key];
|
9230 | }
|
9231 | });
|
9232 | Object.keys(options).forEach((key) => {
|
9233 | if (typeof options[key] === "string" && (options[key].includes("<") || options[key].includes(">") || options[key].includes("url(data:"))) {
|
9234 | delete options[key];
|
9235 | }
|
9236 | if (typeof options[key] === "object") {
|
9237 | sanitize(options[key]);
|
9238 | }
|
9239 | });
|
9240 | };
|
9241 | const addDirective = (directive) => {
|
9242 | sanitizeDirective(directive);
|
9243 | if (directive.fontFamily && (!directive.themeVariables || !directive.themeVariables.fontFamily)) {
|
9244 | directive.themeVariables = { fontFamily: directive.fontFamily };
|
9245 | }
|
9246 | directives.push(directive);
|
9247 | updateCurrentConfig(siteConfig, directives);
|
9248 | };
|
9249 | const reset = (config2 = siteConfig) => {
|
9250 | directives = [];
|
9251 | updateCurrentConfig(config2, directives);
|
9252 | };
|
9253 | const ConfigWarning = {
|
9254 | LAZY_LOAD_DEPRECATED: "The configuration options lazyLoadedDiagrams and loadExternalDiagramsAtStartup are deprecated. Please use registerExternalDiagrams instead."
|
9255 | };
|
9256 | const issuedWarnings = {};
|
9257 | const issueWarning = (warning) => {
|
9258 | if (issuedWarnings[warning]) {
|
9259 | return;
|
9260 | }
|
9261 | log$1.warn(ConfigWarning[warning]);
|
9262 | issuedWarnings[warning] = true;
|
9263 | };
|
9264 | const checkConfig = (config2) => {
|
9265 | if (!config2) {
|
9266 | return;
|
9267 | }
|
9268 | if (config2.lazyLoadedDiagrams || config2.loadExternalDiagramsAtStartup) {
|
9269 | issueWarning("LAZY_LOAD_DEPRECATED");
|
9270 | }
|
9271 | };
|
9272 | const id$l = "c4";
|
9273 | const detector$l = (txt) => {
|
9274 | return /^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(txt);
|
9275 | };
|
9276 | const loader$m = async () => {
|
9277 | const { diagram: diagram2 } = await import("./c4Diagram-af207393.js");
|
9278 | return { id: id$l, diagram: diagram2 };
|
9279 | };
|
9280 | const plugin$j = {
|
9281 | id: id$l,
|
9282 | detector: detector$l,
|
9283 | loader: loader$m
|
9284 | };
|
9285 | const c4 = plugin$j;
|
9286 | const id$k = "flowchart";
|
9287 | const detector$k = (txt, config2) => {
|
9288 | var _a, _b;
|
9289 | 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") {
|
9290 | return false;
|
9291 | }
|
9292 | return /^\s*graph/.test(txt);
|
9293 | };
|
9294 | const loader$l = async () => {
|
9295 | const { diagram: diagram2 } = await import("./flowDiagram-b5e7ba30.js");
|
9296 | return { id: id$k, diagram: diagram2 };
|
9297 | };
|
9298 | const plugin$i = {
|
9299 | id: id$k,
|
9300 | detector: detector$k,
|
9301 | loader: loader$l
|
9302 | };
|
9303 | const flowchart = plugin$i;
|
9304 | const id$j = "flowchart-v2";
|
9305 | const detector$j = (txt, config2) => {
|
9306 | var _a, _b, _c;
|
9307 | 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") {
|
9308 | return false;
|
9309 | }
|
9310 | if (/^\s*graph/.test(txt) && ((_c = config2 == null ? void 0 : config2.flowchart) == null ? void 0 : _c.defaultRenderer) === "dagre-wrapper") {
|
9311 | return true;
|
9312 | }
|
9313 | return /^\s*flowchart/.test(txt);
|
9314 | };
|
9315 | const loader$k = async () => {
|
9316 | const { diagram: diagram2 } = await import("./flowDiagram-v2-54711e03.js");
|
9317 | return { id: id$j, diagram: diagram2 };
|
9318 | };
|
9319 | const plugin$h = {
|
9320 | id: id$j,
|
9321 | detector: detector$j,
|
9322 | loader: loader$k
|
9323 | };
|
9324 | const flowchartV2 = plugin$h;
|
9325 | const id$i = "er";
|
9326 | const detector$i = (txt) => {
|
9327 | return /^\s*erDiagram/.test(txt);
|
9328 | };
|
9329 | const loader$j = async () => {
|
9330 | const { diagram: diagram2 } = await import("./erDiagram-543717f2.js");
|
9331 | return { id: id$i, diagram: diagram2 };
|
9332 | };
|
9333 | const plugin$g = {
|
9334 | id: id$i,
|
9335 | detector: detector$i,
|
9336 | loader: loader$j
|
9337 | };
|
9338 | const er = plugin$g;
|
9339 | const id$h = "gitGraph";
|
9340 | const detector$h = (txt) => {
|
9341 | return /^\s*gitGraph/.test(txt);
|
9342 | };
|
9343 | const loader$i = async () => {
|
9344 | const { diagram: diagram2 } = await import("./gitGraphDiagram-b9392a12.js");
|
9345 | return { id: id$h, diagram: diagram2 };
|
9346 | };
|
9347 | const plugin$f = {
|
9348 | id: id$h,
|
9349 | detector: detector$h,
|
9350 | loader: loader$i
|
9351 | };
|
9352 | const git = plugin$f;
|
9353 | const id$g = "gantt";
|
9354 | const detector$g = (txt) => {
|
9355 | return /^\s*gantt/.test(txt);
|
9356 | };
|
9357 | const loader$h = async () => {
|
9358 | const { diagram: diagram2 } = await import("./ganttDiagram-12cf43db.js");
|
9359 | return { id: id$g, diagram: diagram2 };
|
9360 | };
|
9361 | const plugin$e = {
|
9362 | id: id$g,
|
9363 | detector: detector$g,
|
9364 | loader: loader$h
|
9365 | };
|
9366 | const gantt = plugin$e;
|
9367 | const id$f = "info";
|
9368 | const detector$f = (txt) => {
|
9369 | return /^\s*info/.test(txt);
|
9370 | };
|
9371 | const loader$g = async () => {
|
9372 | const { diagram: diagram2 } = await import("./infoDiagram-d0d5c9bd.js");
|
9373 | return { id: id$f, diagram: diagram2 };
|
9374 | };
|
9375 | const info = {
|
9376 | id: id$f,
|
9377 | detector: detector$f,
|
9378 | loader: loader$g
|
9379 | };
|
9380 | const id$e = "pie";
|
9381 | const detector$e = (txt) => {
|
9382 | return /^\s*pie/.test(txt);
|
9383 | };
|
9384 | const loader$f = async () => {
|
9385 | const { diagram: diagram2 } = await import("./pieDiagram-e854eaf0.js");
|
9386 | return { id: id$e, diagram: diagram2 };
|
9387 | };
|
9388 | const pie = {
|
9389 | id: id$e,
|
9390 | detector: detector$e,
|
9391 | loader: loader$f
|
9392 | };
|
9393 | const id$d = "quadrantChart";
|
9394 | const detector$d = (txt) => {
|
9395 | return /^\s*quadrantChart/.test(txt);
|
9396 | };
|
9397 | const loader$e = async () => {
|
9398 | const { diagram: diagram2 } = await import("./quadrantDiagram-25a9848b.js");
|
9399 | return { id: id$d, diagram: diagram2 };
|
9400 | };
|
9401 | const plugin$d = {
|
9402 | id: id$d,
|
9403 | detector: detector$d,
|
9404 | loader: loader$e
|
9405 | };
|
9406 | const quadrantChart = plugin$d;
|
9407 | const id$c = "xychart";
|
9408 | const detector$c = (txt) => {
|
9409 | return /^\s*xychart-beta/.test(txt);
|
9410 | };
|
9411 | const loader$d = async () => {
|
9412 | const { diagram: diagram2 } = await import("./xychartDiagram-de2e5521.js");
|
9413 | return { id: id$c, diagram: diagram2 };
|
9414 | };
|
9415 | const plugin$c = {
|
9416 | id: id$c,
|
9417 | detector: detector$c,
|
9418 | loader: loader$d
|
9419 | };
|
9420 | const xychart = plugin$c;
|
9421 | const id$b = "requirement";
|
9422 | const detector$b = (txt) => {
|
9423 | return /^\s*requirement(Diagram)?/.test(txt);
|
9424 | };
|
9425 | const loader$c = async () => {
|
9426 | const { diagram: diagram2 } = await import("./requirementDiagram-a721e157.js");
|
9427 | return { id: id$b, diagram: diagram2 };
|
9428 | };
|
9429 | const plugin$b = {
|
9430 | id: id$b,
|
9431 | detector: detector$b,
|
9432 | loader: loader$c
|
9433 | };
|
9434 | const requirement = plugin$b;
|
9435 | const id$a = "sequence";
|
9436 | const detector$a = (txt) => {
|
9437 | return /^\s*sequenceDiagram/.test(txt);
|
9438 | };
|
9439 | const loader$b = async () => {
|
9440 | const { diagram: diagram2 } = await import("./sequenceDiagram-9813c129.js");
|
9441 | return { id: id$a, diagram: diagram2 };
|
9442 | };
|
9443 | const plugin$a = {
|
9444 | id: id$a,
|
9445 | detector: detector$a,
|
9446 | loader: loader$b
|
9447 | };
|
9448 | const sequence = plugin$a;
|
9449 | const id$9 = "class";
|
9450 | const detector$9 = (txt, config2) => {
|
9451 | var _a;
|
9452 | if (((_a = config2 == null ? void 0 : config2.class) == null ? void 0 : _a.defaultRenderer) === "dagre-wrapper") {
|
9453 | return false;
|
9454 | }
|
9455 | return /^\s*classDiagram/.test(txt);
|
9456 | };
|
9457 | const loader$a = async () => {
|
9458 | const { diagram: diagram2 } = await import("./classDiagram-72b9c71d.js");
|
9459 | return { id: id$9, diagram: diagram2 };
|
9460 | };
|
9461 | const plugin$9 = {
|
9462 | id: id$9,
|
9463 | detector: detector$9,
|
9464 | loader: loader$a
|
9465 | };
|
9466 | const classDiagram = plugin$9;
|
9467 | const id$8 = "classDiagram";
|
9468 | const detector$8 = (txt, config2) => {
|
9469 | var _a;
|
9470 | if (/^\s*classDiagram/.test(txt) && ((_a = config2 == null ? void 0 : config2.class) == null ? void 0 : _a.defaultRenderer) === "dagre-wrapper") {
|
9471 | return true;
|
9472 | }
|
9473 | return /^\s*classDiagram-v2/.test(txt);
|
9474 | };
|
9475 | const loader$9 = async () => {
|
9476 | const { diagram: diagram2 } = await import("./classDiagram-v2-fedb80f6.js");
|
9477 | return { id: id$8, diagram: diagram2 };
|
9478 | };
|
9479 | const plugin$8 = {
|
9480 | id: id$8,
|
9481 | detector: detector$8,
|
9482 | loader: loader$9
|
9483 | };
|
9484 | const classDiagramV2 = plugin$8;
|
9485 | const id$7 = "state";
|
9486 | const detector$7 = (txt, config2) => {
|
9487 | var _a;
|
9488 | if (((_a = config2 == null ? void 0 : config2.state) == null ? void 0 : _a.defaultRenderer) === "dagre-wrapper") {
|
9489 | return false;
|
9490 | }
|
9491 | return /^\s*stateDiagram/.test(txt);
|
9492 | };
|
9493 | const loader$8 = async () => {
|
9494 | const { diagram: diagram2 } = await import("./stateDiagram-5ec31577.js");
|
9495 | return { id: id$7, diagram: diagram2 };
|
9496 | };
|
9497 | const plugin$7 = {
|
9498 | id: id$7,
|
9499 | detector: detector$7,
|
9500 | loader: loader$8
|
9501 | };
|
9502 | const state = plugin$7;
|
9503 | const id$6 = "stateDiagram";
|
9504 | const detector$6 = (txt, config2) => {
|
9505 | var _a;
|
9506 | if (/^\s*stateDiagram-v2/.test(txt)) {
|
9507 | return true;
|
9508 | }
|
9509 | if (/^\s*stateDiagram/.test(txt) && ((_a = config2 == null ? void 0 : config2.state) == null ? void 0 : _a.defaultRenderer) === "dagre-wrapper") {
|
9510 | return true;
|
9511 | }
|
9512 | return false;
|
9513 | };
|
9514 | const loader$7 = async () => {
|
9515 | const { diagram: diagram2 } = await import("./stateDiagram-v2-992e82a1.js");
|
9516 | return { id: id$6, diagram: diagram2 };
|
9517 | };
|
9518 | const plugin$6 = {
|
9519 | id: id$6,
|
9520 | detector: detector$6,
|
9521 | loader: loader$7
|
9522 | };
|
9523 | const stateV2 = plugin$6;
|
9524 | const id$5 = "journey";
|
9525 | const detector$5 = (txt) => {
|
9526 | return /^\s*journey/.test(txt);
|
9527 | };
|
9528 | const loader$6 = async () => {
|
9529 | const { diagram: diagram2 } = await import("./journeyDiagram-b56e6921.js");
|
9530 | return { id: id$5, diagram: diagram2 };
|
9531 | };
|
9532 | const plugin$5 = {
|
9533 | id: id$5,
|
9534 | detector: detector$5,
|
9535 | loader: loader$6
|
9536 | };
|
9537 | const journey = plugin$5;
|
9538 | const d3Attrs = function(d3Elem, attrs) {
|
9539 | for (let attr of attrs) {
|
9540 | d3Elem.attr(attr[0], attr[1]);
|
9541 | }
|
9542 | };
|
9543 | const calculateSvgSizeAttrs = function(height, width, useMaxWidth) {
|
9544 | let attrs = new Map();
|
9545 | if (useMaxWidth) {
|
9546 | attrs.set("width", "100%");
|
9547 | attrs.set("style", `max-width: ${width}px;`);
|
9548 | } else {
|
9549 | attrs.set("height", height);
|
9550 | attrs.set("width", width);
|
9551 | }
|
9552 | return attrs;
|
9553 | };
|
9554 | const configureSvgSize = function(svgElem, height, width, useMaxWidth) {
|
9555 | const attrs = calculateSvgSizeAttrs(height, width, useMaxWidth);
|
9556 | d3Attrs(svgElem, attrs);
|
9557 | };
|
9558 | const setupGraphViewbox$1 = function(graph, svgElem, padding, useMaxWidth) {
|
9559 | const svgBounds = svgElem.node().getBBox();
|
9560 | const sWidth = svgBounds.width;
|
9561 | const sHeight = svgBounds.height;
|
9562 | log$1.info(`SVG bounds: ${sWidth}x${sHeight}`, svgBounds);
|
9563 | let width = 0;
|
9564 | let height = 0;
|
9565 | log$1.info(`Graph bounds: ${width}x${height}`, graph);
|
9566 | width = sWidth + padding * 2;
|
9567 | height = sHeight + padding * 2;
|
9568 | log$1.info(`Calculated bounds: ${width}x${height}`);
|
9569 | configureSvgSize(svgElem, height, width, useMaxWidth);
|
9570 | const vBox = `${svgBounds.x - padding} ${svgBounds.y - padding} ${svgBounds.width + 2 * padding} ${svgBounds.height + 2 * padding}`;
|
9571 | svgElem.attr("viewBox", vBox);
|
9572 | };
|
9573 | const themes = {};
|
9574 | const getStyles = (type2, userStyles, options) => {
|
9575 | let diagramStyles = "";
|
9576 | if (type2 in themes && themes[type2]) {
|
9577 | diagramStyles = themes[type2](options);
|
9578 | } else {
|
9579 | log$1.warn(`No theme found for ${type2}`);
|
9580 | }
|
9581 | return ` & {
|
9582 | font-family: ${options.fontFamily};
|
9583 | font-size: ${options.fontSize};
|
9584 | fill: ${options.textColor}
|
9585 | }
|
9586 |
|
9587 | /* Classes common for multiple diagrams */
|
9588 |
|
9589 | & .error-icon {
|
9590 | fill: ${options.errorBkgColor};
|
9591 | }
|
9592 | & .error-text {
|
9593 | fill: ${options.errorTextColor};
|
9594 | stroke: ${options.errorTextColor};
|
9595 | }
|
9596 |
|
9597 | & .edge-thickness-normal {
|
9598 | stroke-width: 2px;
|
9599 | }
|
9600 | & .edge-thickness-thick {
|
9601 | stroke-width: 3.5px
|
9602 | }
|
9603 | & .edge-pattern-solid {
|
9604 | stroke-dasharray: 0;
|
9605 | }
|
9606 |
|
9607 | & .edge-pattern-dashed{
|
9608 | stroke-dasharray: 3;
|
9609 | }
|
9610 | .edge-pattern-dotted {
|
9611 | stroke-dasharray: 2;
|
9612 | }
|
9613 |
|
9614 | & .marker {
|
9615 | fill: ${options.lineColor};
|
9616 | stroke: ${options.lineColor};
|
9617 | }
|
9618 | & .marker.cross {
|
9619 | stroke: ${options.lineColor};
|
9620 | }
|
9621 |
|
9622 | & svg {
|
9623 | font-family: ${options.fontFamily};
|
9624 | font-size: ${options.fontSize};
|
9625 | }
|
9626 |
|
9627 | ${diagramStyles}
|
9628 |
|
9629 | ${userStyles}
|
9630 | `;
|
9631 | };
|
9632 | const addStylesForDiagram = (type2, diagramTheme) => {
|
9633 | if (diagramTheme !== void 0) {
|
9634 | themes[type2] = diagramTheme;
|
9635 | }
|
9636 | };
|
9637 | const getStyles$1 = getStyles;
|
9638 | let accTitle = "";
|
9639 | let diagramTitle = "";
|
9640 | let accDescription = "";
|
9641 | const sanitizeText$1 = (txt) => sanitizeText$2(txt, getConfig$1());
|
9642 | const clear = () => {
|
9643 | accTitle = "";
|
9644 | accDescription = "";
|
9645 | diagramTitle = "";
|
9646 | };
|
9647 | const setAccTitle = (txt) => {
|
9648 | accTitle = sanitizeText$1(txt).replace(/^\s+/g, "");
|
9649 | };
|
9650 | const getAccTitle = () => accTitle;
|
9651 | const setAccDescription = (txt) => {
|
9652 | accDescription = sanitizeText$1(txt).replace(/\n\s+/g, "\n");
|
9653 | };
|
9654 | const getAccDescription = () => accDescription;
|
9655 | const setDiagramTitle = (txt) => {
|
9656 | diagramTitle = sanitizeText$1(txt);
|
9657 | };
|
9658 | const getDiagramTitle = () => diagramTitle;
|
9659 | const commonDb = Object.freeze( Object.defineProperty({
|
9660 | __proto__: null,
|
9661 | clear,
|
9662 | getAccDescription,
|
9663 | getAccTitle,
|
9664 | getDiagramTitle,
|
9665 | setAccDescription,
|
9666 | setAccTitle,
|
9667 | setDiagramTitle
|
9668 | }, Symbol.toStringTag, { value: "Module" }));
|
9669 | const log = log$1;
|
9670 | const setLogLevel = setLogLevel$1;
|
9671 | const getConfig = getConfig$1;
|
9672 | const setConfig = setConfig$1;
|
9673 | const defaultConfig = defaultConfig$1;
|
9674 | const sanitizeText = (text2) => sanitizeText$2(text2, getConfig());
|
9675 | const setupGraphViewbox = setupGraphViewbox$1;
|
9676 | const getCommonDb = () => {
|
9677 | return commonDb;
|
9678 | };
|
9679 | const diagrams = {};
|
9680 | const registerDiagram = (id2, diagram2, detector2) => {
|
9681 | var _a;
|
9682 | if (diagrams[id2]) {
|
9683 | throw new Error(`Diagram ${id2} already registered.`);
|
9684 | }
|
9685 | diagrams[id2] = diagram2;
|
9686 | if (detector2) {
|
9687 | addDetector(id2, detector2);
|
9688 | }
|
9689 | addStylesForDiagram(id2, diagram2.styles);
|
9690 | (_a = diagram2.injectUtils) == null ? void 0 : _a.call(
|
9691 | diagram2,
|
9692 | log,
|
9693 | setLogLevel,
|
9694 | getConfig,
|
9695 | sanitizeText,
|
9696 | setupGraphViewbox,
|
9697 | getCommonDb(),
|
9698 | () => {
|
9699 | }
|
9700 | );
|
9701 | };
|
9702 | const getDiagram = (name) => {
|
9703 | if (name in diagrams) {
|
9704 | return diagrams[name];
|
9705 | }
|
9706 | throw new DiagramNotFoundError(name);
|
9707 | };
|
9708 | class DiagramNotFoundError extends Error {
|
9709 | constructor(name) {
|
9710 | super(`Diagram ${name} not found.`);
|
9711 | }
|
9712 | }
|
9713 | const selectSvgElement = (id2) => {
|
9714 | var _a;
|
9715 | const { securityLevel } = getConfig();
|
9716 | let root2 = d3select("body");
|
9717 | if (securityLevel === "sandbox") {
|
9718 | const sandboxElement = d3select(`#i${id2}`);
|
9719 | const doc = ((_a = sandboxElement.node()) == null ? void 0 : _a.contentDocument) ?? document;
|
9720 | root2 = d3select(doc.body);
|
9721 | }
|
9722 | const svg2 = root2.select(`#${id2}`);
|
9723 | return svg2;
|
9724 | };
|
9725 | const draw = (_text, id2, version2) => {
|
9726 | log$1.debug("rendering svg for syntax error\n");
|
9727 | const svg2 = selectSvgElement(id2);
|
9728 | const g = svg2.append("g");
|
9729 | svg2.attr("viewBox", "0 0 2412 512");
|
9730 | configureSvgSize(svg2, 100, 512, true);
|
9731 | g.append("path").attr("class", "error-icon").attr(
|
9732 | "d",
|
9733 | "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"
|
9734 | );
|
9735 | g.append("path").attr("class", "error-icon").attr(
|
9736 | "d",
|
9737 | "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"
|
9738 | );
|
9739 | g.append("path").attr("class", "error-icon").attr(
|
9740 | "d",
|
9741 | "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"
|
9742 | );
|
9743 | g.append("path").attr("class", "error-icon").attr(
|
9744 | "d",
|
9745 | "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"
|
9746 | );
|
9747 | g.append("path").attr("class", "error-icon").attr(
|
9748 | "d",
|
9749 | "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"
|
9750 | );
|
9751 | g.append("path").attr("class", "error-icon").attr(
|
9752 | "d",
|
9753 | "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"
|
9754 | );
|
9755 | 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");
|
9756 | 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}`);
|
9757 | };
|
9758 | const renderer = { draw };
|
9759 | const errorRenderer = renderer;
|
9760 | const diagram = {
|
9761 | db: {},
|
9762 | renderer,
|
9763 | parser: {
|
9764 | parser: { yy: {} },
|
9765 | parse: () => {
|
9766 | return;
|
9767 | }
|
9768 | }
|
9769 | };
|
9770 | const errorDiagram = diagram;
|
9771 | const id$4 = "flowchart-elk";
|
9772 | const detector$4 = (txt, config2) => {
|
9773 | var _a;
|
9774 | if (
|
9775 |
|
9776 | /^\s*flowchart-elk/.test(txt) ||
|
9777 | /^\s*flowchart|graph/.test(txt) && ((_a = config2 == null ? void 0 : config2.flowchart) == null ? void 0 : _a.defaultRenderer) === "elk"
|
9778 | ) {
|
9779 | return true;
|
9780 | }
|
9781 | return false;
|
9782 | };
|
9783 | const loader$5 = async () => {
|
9784 | const { diagram: diagram2 } = await import("./flowchart-elk-definition-2d49707c.js");
|
9785 | return { id: id$4, diagram: diagram2 };
|
9786 | };
|
9787 | const plugin$4 = {
|
9788 | id: id$4,
|
9789 | detector: detector$4,
|
9790 | loader: loader$5
|
9791 | };
|
9792 | const flowchartElk = plugin$4;
|
9793 | const id$3 = "timeline";
|
9794 | const detector$3 = (txt) => {
|
9795 | return /^\s*timeline/.test(txt);
|
9796 | };
|
9797 | const loader$4 = async () => {
|
9798 | const { diagram: diagram2 } = await import("./timeline-definition-23ce0e2e.js");
|
9799 | return { id: id$3, diagram: diagram2 };
|
9800 | };
|
9801 | const plugin$3 = {
|
9802 | id: id$3,
|
9803 | detector: detector$3,
|
9804 | loader: loader$4
|
9805 | };
|
9806 | const timeline = plugin$3;
|
9807 | const id$2 = "mindmap";
|
9808 | const detector$2 = (txt) => {
|
9809 | return /^\s*mindmap/.test(txt);
|
9810 | };
|
9811 | const loader$3 = async () => {
|
9812 | const { diagram: diagram2 } = await import("./mindmap-definition-696ddea4.js");
|
9813 | return { id: id$2, diagram: diagram2 };
|
9814 | };
|
9815 | const plugin$2 = {
|
9816 | id: id$2,
|
9817 | detector: detector$2,
|
9818 | loader: loader$3
|
9819 | };
|
9820 | const mindmap = plugin$2;
|
9821 | const id$1 = "sankey";
|
9822 | const detector$1 = (txt) => {
|
9823 | return /^\s*sankey-beta/.test(txt);
|
9824 | };
|
9825 | const loader$2 = async () => {
|
9826 | const { diagram: diagram2 } = await import("./sankeyDiagram-33525efb.js");
|
9827 | return { id: id$1, diagram: diagram2 };
|
9828 | };
|
9829 | const plugin$1 = {
|
9830 | id: id$1,
|
9831 | detector: detector$1,
|
9832 | loader: loader$2
|
9833 | };
|
9834 | const sankey = plugin$1;
|
9835 | const id = "block";
|
9836 | const detector = (txt) => {
|
9837 | return /^\s*block-beta/.test(txt);
|
9838 | };
|
9839 | const loader$1 = async () => {
|
9840 | const { diagram: diagram2 } = await import("./blockDiagram-efe38566.js");
|
9841 | return { id, diagram: diagram2 };
|
9842 | };
|
9843 | const plugin = {
|
9844 | id,
|
9845 | detector,
|
9846 | loader: loader$1
|
9847 | };
|
9848 | const block = plugin;
|
9849 | let hasLoadedDiagrams = false;
|
9850 | const addDiagrams = () => {
|
9851 | if (hasLoadedDiagrams) {
|
9852 | return;
|
9853 | }
|
9854 | hasLoadedDiagrams = true;
|
9855 | registerDiagram("error", errorDiagram, (text2) => {
|
9856 | return text2.toLowerCase().trim() === "error";
|
9857 | });
|
9858 | registerDiagram(
|
9859 | "---",
|
9860 |
|
9861 | {
|
9862 | db: {
|
9863 | clear: () => {
|
9864 | }
|
9865 | },
|
9866 | styles: {},
|
9867 |
|
9868 | renderer: {
|
9869 | draw: () => {
|
9870 | }
|
9871 | },
|
9872 | parser: {
|
9873 | parser: { yy: {} },
|
9874 | parse: () => {
|
9875 | throw new Error(
|
9876 | "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"
|
9877 | );
|
9878 | }
|
9879 | },
|
9880 | init: () => null
|
9881 |
|
9882 | },
|
9883 | (text2) => {
|
9884 | return text2.toLowerCase().trimStart().startsWith("---");
|
9885 | }
|
9886 | );
|
9887 | registerLazyLoadedDiagrams(
|
9888 | c4,
|
9889 | classDiagramV2,
|
9890 | classDiagram,
|
9891 | er,
|
9892 | gantt,
|
9893 | info,
|
9894 | pie,
|
9895 | requirement,
|
9896 | sequence,
|
9897 | flowchartElk,
|
9898 | flowchartV2,
|
9899 | flowchart,
|
9900 | mindmap,
|
9901 | timeline,
|
9902 | git,
|
9903 | stateV2,
|
9904 | state,
|
9905 | journey,
|
9906 | quadrantChart,
|
9907 | sankey,
|
9908 | xychart,
|
9909 | block
|
9910 | );
|
9911 | };
|
9912 | class Diagram {
|
9913 | constructor(text2, metadata = {}) {
|
9914 | this.text = text2;
|
9915 | this.metadata = metadata;
|
9916 | this.type = "graph";
|
9917 | this.text = encodeEntities(text2);
|
9918 | this.text += "\n";
|
9919 | const cnf = getConfig$1();
|
9920 | try {
|
9921 | this.type = detectType(text2, cnf);
|
9922 | } catch (e) {
|
9923 | this.type = "error";
|
9924 | this.detectError = e;
|
9925 | }
|
9926 | const diagram2 = getDiagram(this.type);
|
9927 | log$1.debug("Type " + this.type);
|
9928 | this.db = diagram2.db;
|
9929 | this.renderer = diagram2.renderer;
|
9930 | this.parser = diagram2.parser;
|
9931 | this.parser.parser.yy = this.db;
|
9932 | this.init = diagram2.init;
|
9933 | this.parse();
|
9934 | }
|
9935 | parse() {
|
9936 | var _a, _b, _c, _d, _e;
|
9937 | if (this.detectError) {
|
9938 | throw this.detectError;
|
9939 | }
|
9940 | (_b = (_a = this.db).clear) == null ? void 0 : _b.call(_a);
|
9941 | const config2 = getConfig$1();
|
9942 | (_c = this.init) == null ? void 0 : _c.call(this, config2);
|
9943 | if (this.metadata.title) {
|
9944 | (_e = (_d = this.db).setDiagramTitle) == null ? void 0 : _e.call(_d, this.metadata.title);
|
9945 | }
|
9946 | this.parser.parse(this.text);
|
9947 | }
|
9948 | async render(id2, version2) {
|
9949 | await this.renderer.draw(this.text, id2, version2, this);
|
9950 | }
|
9951 | getParser() {
|
9952 | return this.parser;
|
9953 | }
|
9954 | getType() {
|
9955 | return this.type;
|
9956 | }
|
9957 | }
|
9958 | const getDiagramFromText$1 = async (text2, metadata = {}) => {
|
9959 | const type2 = detectType(text2, getConfig$1());
|
9960 | try {
|
9961 | getDiagram(type2);
|
9962 | } catch (error) {
|
9963 | const loader2 = getDiagramLoader(type2);
|
9964 | if (!loader2) {
|
9965 | throw new UnknownDiagramError(`Diagram ${type2} not found.`);
|
9966 | }
|
9967 | const { id: id2, diagram: diagram2 } = await loader2();
|
9968 | registerDiagram(id2, diagram2);
|
9969 | }
|
9970 | return new Diagram(text2, metadata);
|
9971 | };
|
9972 | let interactionFunctions = [];
|
9973 | const attachFunctions = () => {
|
9974 | interactionFunctions.forEach((f) => {
|
9975 | f();
|
9976 | });
|
9977 | interactionFunctions = [];
|
9978 | };
|
9979 | var nativeKeys = overArg(Object.keys, Object);
|
9980 | const nativeKeys$1 = nativeKeys;
|
9981 | var objectProto$1 = Object.prototype;
|
9982 | var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
|
9983 | function baseKeys(object) {
|
9984 | if (!isPrototype(object)) {
|
9985 | return nativeKeys$1(object);
|
9986 | }
|
9987 | var result = [];
|
9988 | for (var key in Object(object)) {
|
9989 | if (hasOwnProperty$1.call(object, key) && key != "constructor") {
|
9990 | result.push(key);
|
9991 | }
|
9992 | }
|
9993 | return result;
|
9994 | }
|
9995 | var DataView = getNative(root$1, "DataView");
|
9996 | const DataView$1 = DataView;
|
9997 | var Promise$1 = getNative(root$1, "Promise");
|
9998 | const Promise$2 = Promise$1;
|
9999 | var Set$1 = getNative(root$1, "Set");
|
10000 | const Set$2 = Set$1;
|
10001 | var WeakMap = getNative(root$1, "WeakMap");
|
10002 | const WeakMap$1 = WeakMap;
|
10003 | var mapTag$1 = "[object Map]", objectTag = "[object Object]", promiseTag = "[object Promise]", setTag$1 = "[object Set]", weakMapTag = "[object WeakMap]";
|
10004 | var dataViewTag = "[object DataView]";
|
10005 | var dataViewCtorString = toSource(DataView$1), mapCtorString = toSource(Map$2), promiseCtorString = toSource(Promise$2), setCtorString = toSource(Set$2), weakMapCtorString = toSource(WeakMap$1);
|
10006 | var getTag = baseGetTag;
|
10007 | if (DataView$1 && getTag(new DataView$1(new ArrayBuffer(1))) != dataViewTag || Map$2 && getTag(new Map$2()) != mapTag$1 || Promise$2 && getTag(Promise$2.resolve()) != promiseTag || Set$2 && getTag(new Set$2()) != setTag$1 || WeakMap$1 && getTag(new WeakMap$1()) != weakMapTag) {
|
10008 | getTag = function(value) {
|
10009 | var result = baseGetTag(value), Ctor = result == objectTag ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
|
10010 | if (ctorString) {
|
10011 | switch (ctorString) {
|
10012 | case dataViewCtorString:
|
10013 | return dataViewTag;
|
10014 | case mapCtorString:
|
10015 | return mapTag$1;
|
10016 | case promiseCtorString:
|
10017 | return promiseTag;
|
10018 | case setCtorString:
|
10019 | return setTag$1;
|
10020 | case weakMapCtorString:
|
10021 | return weakMapTag;
|
10022 | }
|
10023 | }
|
10024 | return result;
|
10025 | };
|
10026 | }
|
10027 | const getTag$1 = getTag;
|
10028 | var mapTag = "[object Map]", setTag = "[object Set]";
|
10029 | var objectProto = Object.prototype;
|
10030 | var hasOwnProperty = objectProto.hasOwnProperty;
|
10031 | function isEmpty(value) {
|
10032 | if (value == null) {
|
10033 | return true;
|
10034 | }
|
10035 | if (isArrayLike(value) && (isArray$1(value) || typeof value == "string" || typeof value.splice == "function" || isBuffer$1(value) || isTypedArray$1(value) || isArguments$1(value))) {
|
10036 | return !value.length;
|
10037 | }
|
10038 | var tag = getTag$1(value);
|
10039 | if (tag == mapTag || tag == setTag) {
|
10040 | return !value.size;
|
10041 | }
|
10042 | if (isPrototype(value)) {
|
10043 | return !baseKeys(value).length;
|
10044 | }
|
10045 | for (var key in value) {
|
10046 | if (hasOwnProperty.call(value, key)) {
|
10047 | return false;
|
10048 | }
|
10049 | }
|
10050 | return true;
|
10051 | }
|
10052 | const SVG_ROLE = "graphics-document document";
|
10053 | function setA11yDiagramInfo(svg2, diagramType) {
|
10054 | svg2.attr("role", SVG_ROLE);
|
10055 | if (diagramType !== "") {
|
10056 | svg2.attr("aria-roledescription", diagramType);
|
10057 | }
|
10058 | }
|
10059 | function addSVGa11yTitleDescription(svg2, a11yTitle, a11yDesc, baseId) {
|
10060 | if (svg2.insert === void 0) {
|
10061 | return;
|
10062 | }
|
10063 | if (a11yDesc) {
|
10064 | const descId = `chart-desc-${baseId}`;
|
10065 | svg2.attr("aria-describedby", descId);
|
10066 | svg2.insert("desc", ":first-child").attr("id", descId).text(a11yDesc);
|
10067 | }
|
10068 | if (a11yTitle) {
|
10069 | const titleId = `chart-title-${baseId}`;
|
10070 | svg2.attr("aria-labelledby", titleId);
|
10071 | svg2.insert("title", ":first-child").attr("id", titleId).text(a11yTitle);
|
10072 | }
|
10073 | }
|
10074 | const cleanupComments = (text2) => {
|
10075 | return text2.replace(/^\s*%%(?!{)[^\n]+\n?/gm, "").trimStart();
|
10076 | };
|
10077 |
|
10078 | function isNothing(subject) {
|
10079 | return typeof subject === "undefined" || subject === null;
|
10080 | }
|
10081 | function isObject(subject) {
|
10082 | return typeof subject === "object" && subject !== null;
|
10083 | }
|
10084 | function toArray(sequence2) {
|
10085 | if (Array.isArray(sequence2))
|
10086 | return sequence2;
|
10087 | else if (isNothing(sequence2))
|
10088 | return [];
|
10089 | return [sequence2];
|
10090 | }
|
10091 | function extend(target, source) {
|
10092 | var index, length2, key, sourceKeys;
|
10093 | if (source) {
|
10094 | sourceKeys = Object.keys(source);
|
10095 | for (index = 0, length2 = sourceKeys.length; index < length2; index += 1) {
|
10096 | key = sourceKeys[index];
|
10097 | target[key] = source[key];
|
10098 | }
|
10099 | }
|
10100 | return target;
|
10101 | }
|
10102 | function repeat(string, count) {
|
10103 | var result = "", cycle;
|
10104 | for (cycle = 0; cycle < count; cycle += 1) {
|
10105 | result += string;
|
10106 | }
|
10107 | return result;
|
10108 | }
|
10109 | function isNegativeZero(number) {
|
10110 | return number === 0 && Number.NEGATIVE_INFINITY === 1 / number;
|
10111 | }
|
10112 | var isNothing_1 = isNothing;
|
10113 | var isObject_1 = isObject;
|
10114 | var toArray_1 = toArray;
|
10115 | var repeat_1 = repeat;
|
10116 | var isNegativeZero_1 = isNegativeZero;
|
10117 | var extend_1 = extend;
|
10118 | var common = {
|
10119 | isNothing: isNothing_1,
|
10120 | isObject: isObject_1,
|
10121 | toArray: toArray_1,
|
10122 | repeat: repeat_1,
|
10123 | isNegativeZero: isNegativeZero_1,
|
10124 | extend: extend_1
|
10125 | };
|
10126 | function formatError(exception2, compact) {
|
10127 | var where = "", message = exception2.reason || "(unknown reason)";
|
10128 | if (!exception2.mark)
|
10129 | return message;
|
10130 | if (exception2.mark.name) {
|
10131 | where += 'in "' + exception2.mark.name + '" ';
|
10132 | }
|
10133 | where += "(" + (exception2.mark.line + 1) + ":" + (exception2.mark.column + 1) + ")";
|
10134 | if (!compact && exception2.mark.snippet) {
|
10135 | where += "\n\n" + exception2.mark.snippet;
|
10136 | }
|
10137 | return message + " " + where;
|
10138 | }
|
10139 | function YAMLException$1(reason, mark) {
|
10140 | Error.call(this);
|
10141 | this.name = "YAMLException";
|
10142 | this.reason = reason;
|
10143 | this.mark = mark;
|
10144 | this.message = formatError(this, false);
|
10145 | if (Error.captureStackTrace) {
|
10146 | Error.captureStackTrace(this, this.constructor);
|
10147 | } else {
|
10148 | this.stack = new Error().stack || "";
|
10149 | }
|
10150 | }
|
10151 | YAMLException$1.prototype = Object.create(Error.prototype);
|
10152 | YAMLException$1.prototype.constructor = YAMLException$1;
|
10153 | YAMLException$1.prototype.toString = function toString(compact) {
|
10154 | return this.name + ": " + formatError(this, compact);
|
10155 | };
|
10156 | var exception = YAMLException$1;
|
10157 | function getLine(buffer, lineStart, lineEnd, position2, maxLineLength) {
|
10158 | var head = "";
|
10159 | var tail = "";
|
10160 | var maxHalfLength = Math.floor(maxLineLength / 2) - 1;
|
10161 | if (position2 - lineStart > maxHalfLength) {
|
10162 | head = " ... ";
|
10163 | lineStart = position2 - maxHalfLength + head.length;
|
10164 | }
|
10165 | if (lineEnd - position2 > maxHalfLength) {
|
10166 | tail = " ...";
|
10167 | lineEnd = position2 + maxHalfLength - tail.length;
|
10168 | }
|
10169 | return {
|
10170 | str: head + buffer.slice(lineStart, lineEnd).replace(/\t/g, "→") + tail,
|
10171 | pos: position2 - lineStart + head.length
|
10172 |
|
10173 | };
|
10174 | }
|
10175 | function padStart(string, max2) {
|
10176 | return common.repeat(" ", max2 - string.length) + string;
|
10177 | }
|
10178 | function makeSnippet(mark, options) {
|
10179 | options = Object.create(options || null);
|
10180 | if (!mark.buffer)
|
10181 | return null;
|
10182 | if (!options.maxLength)
|
10183 | options.maxLength = 79;
|
10184 | if (typeof options.indent !== "number")
|
10185 | options.indent = 1;
|
10186 | if (typeof options.linesBefore !== "number")
|
10187 | options.linesBefore = 3;
|
10188 | if (typeof options.linesAfter !== "number")
|
10189 | options.linesAfter = 2;
|
10190 | var re = /\r?\n|\r|\0/g;
|
10191 | var lineStarts = [0];
|
10192 | var lineEnds = [];
|
10193 | var match;
|
10194 | var foundLineNo = -1;
|
10195 | while (match = re.exec(mark.buffer)) {
|
10196 | lineEnds.push(match.index);
|
10197 | lineStarts.push(match.index + match[0].length);
|
10198 | if (mark.position <= match.index && foundLineNo < 0) {
|
10199 | foundLineNo = lineStarts.length - 2;
|
10200 | }
|
10201 | }
|
10202 | if (foundLineNo < 0)
|
10203 | foundLineNo = lineStarts.length - 1;
|
10204 | var result = "", i, line2;
|
10205 | var lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length;
|
10206 | var maxLineLength = options.maxLength - (options.indent + lineNoLength + 3);
|
10207 | for (i = 1; i <= options.linesBefore; i++) {
|
10208 | if (foundLineNo - i < 0)
|
10209 | break;
|
10210 | line2 = getLine(
|
10211 | mark.buffer,
|
10212 | lineStarts[foundLineNo - i],
|
10213 | lineEnds[foundLineNo - i],
|
10214 | mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]),
|
10215 | maxLineLength
|
10216 | );
|
10217 | result = common.repeat(" ", options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) + " | " + line2.str + "\n" + result;
|
10218 | }
|
10219 | line2 = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength);
|
10220 | result += common.repeat(" ", options.indent) + padStart((mark.line + 1).toString(), lineNoLength) + " | " + line2.str + "\n";
|
10221 | result += common.repeat("-", options.indent + lineNoLength + 3 + line2.pos) + "^\n";
|
10222 | for (i = 1; i <= options.linesAfter; i++) {
|
10223 | if (foundLineNo + i >= lineEnds.length)
|
10224 | break;
|
10225 | line2 = getLine(
|
10226 | mark.buffer,
|
10227 | lineStarts[foundLineNo + i],
|
10228 | lineEnds[foundLineNo + i],
|
10229 | mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]),
|
10230 | maxLineLength
|
10231 | );
|
10232 | result += common.repeat(" ", options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) + " | " + line2.str + "\n";
|
10233 | }
|
10234 | return result.replace(/\n$/, "");
|
10235 | }
|
10236 | var snippet = makeSnippet;
|
10237 | var TYPE_CONSTRUCTOR_OPTIONS = [
|
10238 | "kind",
|
10239 | "multi",
|
10240 | "resolve",
|
10241 | "construct",
|
10242 | "instanceOf",
|
10243 | "predicate",
|
10244 | "represent",
|
10245 | "representName",
|
10246 | "defaultStyle",
|
10247 | "styleAliases"
|
10248 | ];
|
10249 | var YAML_NODE_KINDS = [
|
10250 | "scalar",
|
10251 | "sequence",
|
10252 | "mapping"
|
10253 | ];
|
10254 | function compileStyleAliases(map2) {
|
10255 | var result = {};
|
10256 | if (map2 !== null) {
|
10257 | Object.keys(map2).forEach(function(style) {
|
10258 | map2[style].forEach(function(alias) {
|
10259 | result[String(alias)] = style;
|
10260 | });
|
10261 | });
|
10262 | }
|
10263 | return result;
|
10264 | }
|
10265 | function Type$1(tag, options) {
|
10266 | options = options || {};
|
10267 | Object.keys(options).forEach(function(name) {
|
10268 | if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
|
10269 | throw new exception('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
|
10270 | }
|
10271 | });
|
10272 | this.options = options;
|
10273 | this.tag = tag;
|
10274 | this.kind = options["kind"] || null;
|
10275 | this.resolve = options["resolve"] || function() {
|
10276 | return true;
|
10277 | };
|
10278 | this.construct = options["construct"] || function(data) {
|
10279 | return data;
|
10280 | };
|
10281 | this.instanceOf = options["instanceOf"] || null;
|
10282 | this.predicate = options["predicate"] || null;
|
10283 | this.represent = options["represent"] || null;
|
10284 | this.representName = options["representName"] || null;
|
10285 | this.defaultStyle = options["defaultStyle"] || null;
|
10286 | this.multi = options["multi"] || false;
|
10287 | this.styleAliases = compileStyleAliases(options["styleAliases"] || null);
|
10288 | if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {
|
10289 | throw new exception('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
|
10290 | }
|
10291 | }
|
10292 | var type = Type$1;
|
10293 | function compileList(schema2, name) {
|
10294 | var result = [];
|
10295 | schema2[name].forEach(function(currentType) {
|
10296 | var newIndex = result.length;
|
10297 | result.forEach(function(previousType, previousIndex) {
|
10298 | if (previousType.tag === currentType.tag && previousType.kind === currentType.kind && previousType.multi === currentType.multi) {
|
10299 | newIndex = previousIndex;
|
10300 | }
|
10301 | });
|
10302 | result[newIndex] = currentType;
|
10303 | });
|
10304 | return result;
|
10305 | }
|
10306 | function compileMap() {
|
10307 | var result = {
|
10308 | scalar: {},
|
10309 | sequence: {},
|
10310 | mapping: {},
|
10311 | fallback: {},
|
10312 | multi: {
|
10313 | scalar: [],
|
10314 | sequence: [],
|
10315 | mapping: [],
|
10316 | fallback: []
|
10317 | }
|
10318 | }, index, length2;
|
10319 | function collectType(type2) {
|
10320 | if (type2.multi) {
|
10321 | result.multi[type2.kind].push(type2);
|
10322 | result.multi["fallback"].push(type2);
|
10323 | } else {
|
10324 | result[type2.kind][type2.tag] = result["fallback"][type2.tag] = type2;
|
10325 | }
|
10326 | }
|
10327 | for (index = 0, length2 = arguments.length; index < length2; index += 1) {
|
10328 | arguments[index].forEach(collectType);
|
10329 | }
|
10330 | return result;
|
10331 | }
|
10332 | function Schema$1(definition) {
|
10333 | return this.extend(definition);
|
10334 | }
|
10335 | Schema$1.prototype.extend = function extend2(definition) {
|
10336 | var implicit = [];
|
10337 | var explicit = [];
|
10338 | if (definition instanceof type) {
|
10339 | explicit.push(definition);
|
10340 | } else if (Array.isArray(definition)) {
|
10341 | explicit = explicit.concat(definition);
|
10342 | } else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) {
|
10343 | if (definition.implicit)
|
10344 | implicit = implicit.concat(definition.implicit);
|
10345 | if (definition.explicit)
|
10346 | explicit = explicit.concat(definition.explicit);
|
10347 | } else {
|
10348 | throw new exception("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");
|
10349 | }
|
10350 | implicit.forEach(function(type$1) {
|
10351 | if (!(type$1 instanceof type)) {
|
10352 | throw new exception("Specified list of YAML types (or a single Type object) contains a non-Type object.");
|
10353 | }
|
10354 | if (type$1.loadKind && type$1.loadKind !== "scalar") {
|
10355 | throw new exception("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");
|
10356 | }
|
10357 | if (type$1.multi) {
|
10358 | throw new exception("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.");
|
10359 | }
|
10360 | });
|
10361 | explicit.forEach(function(type$1) {
|
10362 | if (!(type$1 instanceof type)) {
|
10363 | throw new exception("Specified list of YAML types (or a single Type object) contains a non-Type object.");
|
10364 | }
|
10365 | });
|
10366 | var result = Object.create(Schema$1.prototype);
|
10367 | result.implicit = (this.implicit || []).concat(implicit);
|
10368 | result.explicit = (this.explicit || []).concat(explicit);
|
10369 | result.compiledImplicit = compileList(result, "implicit");
|
10370 | result.compiledExplicit = compileList(result, "explicit");
|
10371 | result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit);
|
10372 | return result;
|
10373 | };
|
10374 | var schema = Schema$1;
|
10375 | var str = new type("tag:yaml.org,2002:str", {
|
10376 | kind: "scalar",
|
10377 | construct: function(data) {
|
10378 | return data !== null ? data : "";
|
10379 | }
|
10380 | });
|
10381 | var seq = new type("tag:yaml.org,2002:seq", {
|
10382 | kind: "sequence",
|
10383 | construct: function(data) {
|
10384 | return data !== null ? data : [];
|
10385 | }
|
10386 | });
|
10387 | var map = new type("tag:yaml.org,2002:map", {
|
10388 | kind: "mapping",
|
10389 | construct: function(data) {
|
10390 | return data !== null ? data : {};
|
10391 | }
|
10392 | });
|
10393 | var failsafe = new schema({
|
10394 | explicit: [
|
10395 | str,
|
10396 | seq,
|
10397 | map
|
10398 | ]
|
10399 | });
|
10400 | function resolveYamlNull(data) {
|
10401 | if (data === null)
|
10402 | return true;
|
10403 | var max2 = data.length;
|
10404 | return max2 === 1 && data === "~" || max2 === 4 && (data === "null" || data === "Null" || data === "NULL");
|
10405 | }
|
10406 | function constructYamlNull() {
|
10407 | return null;
|
10408 | }
|
10409 | function isNull(object) {
|
10410 | return object === null;
|
10411 | }
|
10412 | var _null = new type("tag:yaml.org,2002:null", {
|
10413 | kind: "scalar",
|
10414 | resolve: resolveYamlNull,
|
10415 | construct: constructYamlNull,
|
10416 | predicate: isNull,
|
10417 | represent: {
|
10418 | canonical: function() {
|
10419 | return "~";
|
10420 | },
|
10421 | lowercase: function() {
|
10422 | return "null";
|
10423 | },
|
10424 | uppercase: function() {
|
10425 | return "NULL";
|
10426 | },
|
10427 | camelcase: function() {
|
10428 | return "Null";
|
10429 | },
|
10430 | empty: function() {
|
10431 | return "";
|
10432 | }
|
10433 | },
|
10434 | defaultStyle: "lowercase"
|
10435 | });
|
10436 | function resolveYamlBoolean(data) {
|
10437 | if (data === null)
|
10438 | return false;
|
10439 | var max2 = data.length;
|
10440 | return max2 === 4 && (data === "true" || data === "True" || data === "TRUE") || max2 === 5 && (data === "false" || data === "False" || data === "FALSE");
|
10441 | }
|
10442 | function constructYamlBoolean(data) {
|
10443 | return data === "true" || data === "True" || data === "TRUE";
|
10444 | }
|
10445 | function isBoolean(object) {
|
10446 | return Object.prototype.toString.call(object) === "[object Boolean]";
|
10447 | }
|
10448 | var bool = new type("tag:yaml.org,2002:bool", {
|
10449 | kind: "scalar",
|
10450 | resolve: resolveYamlBoolean,
|
10451 | construct: constructYamlBoolean,
|
10452 | predicate: isBoolean,
|
10453 | represent: {
|
10454 | lowercase: function(object) {
|
10455 | return object ? "true" : "false";
|
10456 | },
|
10457 | uppercase: function(object) {
|
10458 | return object ? "TRUE" : "FALSE";
|
10459 | },
|
10460 | camelcase: function(object) {
|
10461 | return object ? "True" : "False";
|
10462 | }
|
10463 | },
|
10464 | defaultStyle: "lowercase"
|
10465 | });
|
10466 | function isHexCode(c) {
|
10467 | return 48 <= c && c <= 57 || 65 <= c && c <= 70 || 97 <= c && c <= 102;
|
10468 | }
|
10469 | function isOctCode(c) {
|
10470 | return 48 <= c && c <= 55;
|
10471 | }
|
10472 | function isDecCode(c) {
|
10473 | return 48 <= c && c <= 57;
|
10474 | }
|
10475 | function resolveYamlInteger(data) {
|
10476 | if (data === null)
|
10477 | return false;
|
10478 | var max2 = data.length, index = 0, hasDigits = false, ch;
|
10479 | if (!max2)
|
10480 | return false;
|
10481 | ch = data[index];
|
10482 | if (ch === "-" || ch === "+") {
|
10483 | ch = data[++index];
|
10484 | }
|
10485 | if (ch === "0") {
|
10486 | if (index + 1 === max2)
|
10487 | return true;
|
10488 | ch = data[++index];
|
10489 | if (ch === "b") {
|
10490 | index++;
|
10491 | for (; index < max2; index++) {
|
10492 | ch = data[index];
|
10493 | if (ch === "_")
|
10494 | continue;
|
10495 | if (ch !== "0" && ch !== "1")
|
10496 | return false;
|
10497 | hasDigits = true;
|
10498 | }
|
10499 | return hasDigits && ch !== "_";
|
10500 | }
|
10501 | if (ch === "x") {
|
10502 | index++;
|
10503 | for (; index < max2; index++) {
|
10504 | ch = data[index];
|
10505 | if (ch === "_")
|
10506 | continue;
|
10507 | if (!isHexCode(data.charCodeAt(index)))
|
10508 | return false;
|
10509 | hasDigits = true;
|
10510 | }
|
10511 | return hasDigits && ch !== "_";
|
10512 | }
|
10513 | if (ch === "o") {
|
10514 | index++;
|
10515 | for (; index < max2; index++) {
|
10516 | ch = data[index];
|
10517 | if (ch === "_")
|
10518 | continue;
|
10519 | if (!isOctCode(data.charCodeAt(index)))
|
10520 | return false;
|
10521 | hasDigits = true;
|
10522 | }
|
10523 | return hasDigits && ch !== "_";
|
10524 | }
|
10525 | }
|
10526 | if (ch === "_")
|
10527 | return false;
|
10528 | for (; index < max2; index++) {
|
10529 | ch = data[index];
|
10530 | if (ch === "_")
|
10531 | continue;
|
10532 | if (!isDecCode(data.charCodeAt(index))) {
|
10533 | return false;
|
10534 | }
|
10535 | hasDigits = true;
|
10536 | }
|
10537 | if (!hasDigits || ch === "_")
|
10538 | return false;
|
10539 | return true;
|
10540 | }
|
10541 | function constructYamlInteger(data) {
|
10542 | var value = data, sign2 = 1, ch;
|
10543 | if (value.indexOf("_") !== -1) {
|
10544 | value = value.replace(/_/g, "");
|
10545 | }
|
10546 | ch = value[0];
|
10547 | if (ch === "-" || ch === "+") {
|
10548 | if (ch === "-")
|
10549 | sign2 = -1;
|
10550 | value = value.slice(1);
|
10551 | ch = value[0];
|
10552 | }
|
10553 | if (value === "0")
|
10554 | return 0;
|
10555 | if (ch === "0") {
|
10556 | if (value[1] === "b")
|
10557 | return sign2 * parseInt(value.slice(2), 2);
|
10558 | if (value[1] === "x")
|
10559 | return sign2 * parseInt(value.slice(2), 16);
|
10560 | if (value[1] === "o")
|
10561 | return sign2 * parseInt(value.slice(2), 8);
|
10562 | }
|
10563 | return sign2 * parseInt(value, 10);
|
10564 | }
|
10565 | function isInteger(object) {
|
10566 | return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 === 0 && !common.isNegativeZero(object));
|
10567 | }
|
10568 | var int = new type("tag:yaml.org,2002:int", {
|
10569 | kind: "scalar",
|
10570 | resolve: resolveYamlInteger,
|
10571 | construct: constructYamlInteger,
|
10572 | predicate: isInteger,
|
10573 | represent: {
|
10574 | binary: function(obj) {
|
10575 | return obj >= 0 ? "0b" + obj.toString(2) : "-0b" + obj.toString(2).slice(1);
|
10576 | },
|
10577 | octal: function(obj) {
|
10578 | return obj >= 0 ? "0o" + obj.toString(8) : "-0o" + obj.toString(8).slice(1);
|
10579 | },
|
10580 | decimal: function(obj) {
|
10581 | return obj.toString(10);
|
10582 | },
|
10583 |
|
10584 | hexadecimal: function(obj) {
|
10585 | return obj >= 0 ? "0x" + obj.toString(16).toUpperCase() : "-0x" + obj.toString(16).toUpperCase().slice(1);
|
10586 | }
|
10587 | },
|
10588 | defaultStyle: "decimal",
|
10589 | styleAliases: {
|
10590 | binary: [2, "bin"],
|
10591 | octal: [8, "oct"],
|
10592 | decimal: [10, "dec"],
|
10593 | hexadecimal: [16, "hex"]
|
10594 | }
|
10595 | });
|
10596 | var YAML_FLOAT_PATTERN = new RegExp(
|
10597 |
|
10598 | "^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"
|
10599 | );
|
10600 | function resolveYamlFloat(data) {
|
10601 | if (data === null)
|
10602 | return false;
|
10603 | if (!YAML_FLOAT_PATTERN.test(data) ||
|
10604 |
|
10605 | data[data.length - 1] === "_") {
|
10606 | return false;
|
10607 | }
|
10608 | return true;
|
10609 | }
|
10610 | function constructYamlFloat(data) {
|
10611 | var value, sign2;
|
10612 | value = data.replace(/_/g, "").toLowerCase();
|
10613 | sign2 = value[0] === "-" ? -1 : 1;
|
10614 | if ("+-".indexOf(value[0]) >= 0) {
|
10615 | value = value.slice(1);
|
10616 | }
|
10617 | if (value === ".inf") {
|
10618 | return sign2 === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
|
10619 | } else if (value === ".nan") {
|
10620 | return NaN;
|
10621 | }
|
10622 | return sign2 * parseFloat(value, 10);
|
10623 | }
|
10624 | var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
|
10625 | function representYamlFloat(object, style) {
|
10626 | var res;
|
10627 | if (isNaN(object)) {
|
10628 | switch (style) {
|
10629 | case "lowercase":
|
10630 | return ".nan";
|
10631 | case "uppercase":
|
10632 | return ".NAN";
|
10633 | case "camelcase":
|
10634 | return ".NaN";
|
10635 | }
|
10636 | } else if (Number.POSITIVE_INFINITY === object) {
|
10637 | switch (style) {
|
10638 | case "lowercase":
|
10639 | return ".inf";
|
10640 | case "uppercase":
|
10641 | return ".INF";
|
10642 | case "camelcase":
|
10643 | return ".Inf";
|
10644 | }
|
10645 | } else if (Number.NEGATIVE_INFINITY === object) {
|
10646 | switch (style) {
|
10647 | case "lowercase":
|
10648 | return "-.inf";
|
10649 | case "uppercase":
|
10650 | return "-.INF";
|
10651 | case "camelcase":
|
10652 | return "-.Inf";
|
10653 | }
|
10654 | } else if (common.isNegativeZero(object)) {
|
10655 | return "-0.0";
|
10656 | }
|
10657 | res = object.toString(10);
|
10658 | return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace("e", ".e") : res;
|
10659 | }
|
10660 | function isFloat(object) {
|
10661 | return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 !== 0 || common.isNegativeZero(object));
|
10662 | }
|
10663 | var float = new type("tag:yaml.org,2002:float", {
|
10664 | kind: "scalar",
|
10665 | resolve: resolveYamlFloat,
|
10666 | construct: constructYamlFloat,
|
10667 | predicate: isFloat,
|
10668 | represent: representYamlFloat,
|
10669 | defaultStyle: "lowercase"
|
10670 | });
|
10671 | var json = failsafe.extend({
|
10672 | implicit: [
|
10673 | _null,
|
10674 | bool,
|
10675 | int,
|
10676 | float
|
10677 | ]
|
10678 | });
|
10679 | var core = json;
|
10680 | var YAML_DATE_REGEXP = new RegExp(
|
10681 | "^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"
|
10682 | );
|
10683 | var YAML_TIMESTAMP_REGEXP = new RegExp(
|
10684 | "^([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]))?))?$"
|
10685 | );
|
10686 | function resolveYamlTimestamp(data) {
|
10687 | if (data === null)
|
10688 | return false;
|
10689 | if (YAML_DATE_REGEXP.exec(data) !== null)
|
10690 | return true;
|
10691 | if (YAML_TIMESTAMP_REGEXP.exec(data) !== null)
|
10692 | return true;
|
10693 | return false;
|
10694 | }
|
10695 | function constructYamlTimestamp(data) {
|
10696 | var match, year, month, day, hour, minute, second, fraction = 0, delta = null, tz_hour, tz_minute, date;
|
10697 | match = YAML_DATE_REGEXP.exec(data);
|
10698 | if (match === null)
|
10699 | match = YAML_TIMESTAMP_REGEXP.exec(data);
|
10700 | if (match === null)
|
10701 | throw new Error("Date resolve error");
|
10702 | year = +match[1];
|
10703 | month = +match[2] - 1;
|
10704 | day = +match[3];
|
10705 | if (!match[4]) {
|
10706 | return new Date(Date.UTC(year, month, day));
|
10707 | }
|
10708 | hour = +match[4];
|
10709 | minute = +match[5];
|
10710 | second = +match[6];
|
10711 | if (match[7]) {
|
10712 | fraction = match[7].slice(0, 3);
|
10713 | while (fraction.length < 3) {
|
10714 | fraction += "0";
|
10715 | }
|
10716 | fraction = +fraction;
|
10717 | }
|
10718 | if (match[9]) {
|
10719 | tz_hour = +match[10];
|
10720 | tz_minute = +(match[11] || 0);
|
10721 | delta = (tz_hour * 60 + tz_minute) * 6e4;
|
10722 | if (match[9] === "-")
|
10723 | delta = -delta;
|
10724 | }
|
10725 | date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
|
10726 | if (delta)
|
10727 | date.setTime(date.getTime() - delta);
|
10728 | return date;
|
10729 | }
|
10730 | function representYamlTimestamp(object) {
|
10731 | return object.toISOString();
|
10732 | }
|
10733 | var timestamp = new type("tag:yaml.org,2002:timestamp", {
|
10734 | kind: "scalar",
|
10735 | resolve: resolveYamlTimestamp,
|
10736 | construct: constructYamlTimestamp,
|
10737 | instanceOf: Date,
|
10738 | represent: representYamlTimestamp
|
10739 | });
|
10740 | function resolveYamlMerge(data) {
|
10741 | return data === "<<" || data === null;
|
10742 | }
|
10743 | var merge = new type("tag:yaml.org,2002:merge", {
|
10744 | kind: "scalar",
|
10745 | resolve: resolveYamlMerge
|
10746 | });
|
10747 | var BASE64_MAP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";
|
10748 | function resolveYamlBinary(data) {
|
10749 | if (data === null)
|
10750 | return false;
|
10751 | var code, idx, bitlen = 0, max2 = data.length, map2 = BASE64_MAP;
|
10752 | for (idx = 0; idx < max2; idx++) {
|
10753 | code = map2.indexOf(data.charAt(idx));
|
10754 | if (code > 64)
|
10755 | continue;
|
10756 | if (code < 0)
|
10757 | return false;
|
10758 | bitlen += 6;
|
10759 | }
|
10760 | return bitlen % 8 === 0;
|
10761 | }
|
10762 | function constructYamlBinary(data) {
|
10763 | var idx, tailbits, input = data.replace(/[\r\n=]/g, ""), max2 = input.length, map2 = BASE64_MAP, bits = 0, result = [];
|
10764 | for (idx = 0; idx < max2; idx++) {
|
10765 | if (idx % 4 === 0 && idx) {
|
10766 | result.push(bits >> 16 & 255);
|
10767 | result.push(bits >> 8 & 255);
|
10768 | result.push(bits & 255);
|
10769 | }
|
10770 | bits = bits << 6 | map2.indexOf(input.charAt(idx));
|
10771 | }
|
10772 | tailbits = max2 % 4 * 6;
|
10773 | if (tailbits === 0) {
|
10774 | result.push(bits >> 16 & 255);
|
10775 | result.push(bits >> 8 & 255);
|
10776 | result.push(bits & 255);
|
10777 | } else if (tailbits === 18) {
|
10778 | result.push(bits >> 10 & 255);
|
10779 | result.push(bits >> 2 & 255);
|
10780 | } else if (tailbits === 12) {
|
10781 | result.push(bits >> 4 & 255);
|
10782 | }
|
10783 | return new Uint8Array(result);
|
10784 | }
|
10785 | function representYamlBinary(object) {
|
10786 | var result = "", bits = 0, idx, tail, max2 = object.length, map2 = BASE64_MAP;
|
10787 | for (idx = 0; idx < max2; idx++) {
|
10788 | if (idx % 3 === 0 && idx) {
|
10789 | result += map2[bits >> 18 & 63];
|
10790 | result += map2[bits >> 12 & 63];
|
10791 | result += map2[bits >> 6 & 63];
|
10792 | result += map2[bits & 63];
|
10793 | }
|
10794 | bits = (bits << 8) + object[idx];
|
10795 | }
|
10796 | tail = max2 % 3;
|
10797 | if (tail === 0) {
|
10798 | result += map2[bits >> 18 & 63];
|
10799 | result += map2[bits >> 12 & 63];
|
10800 | result += map2[bits >> 6 & 63];
|
10801 | result += map2[bits & 63];
|
10802 | } else if (tail === 2) {
|
10803 | result += map2[bits >> 10 & 63];
|
10804 | result += map2[bits >> 4 & 63];
|
10805 | result += map2[bits << 2 & 63];
|
10806 | result += map2[64];
|
10807 | } else if (tail === 1) {
|
10808 | result += map2[bits >> 2 & 63];
|
10809 | result += map2[bits << 4 & 63];
|
10810 | result += map2[64];
|
10811 | result += map2[64];
|
10812 | }
|
10813 | return result;
|
10814 | }
|
10815 | function isBinary(obj) {
|
10816 | return Object.prototype.toString.call(obj) === "[object Uint8Array]";
|
10817 | }
|
10818 | var binary = new type("tag:yaml.org,2002:binary", {
|
10819 | kind: "scalar",
|
10820 | resolve: resolveYamlBinary,
|
10821 | construct: constructYamlBinary,
|
10822 | predicate: isBinary,
|
10823 | represent: representYamlBinary
|
10824 | });
|
10825 | var _hasOwnProperty$3 = Object.prototype.hasOwnProperty;
|
10826 | var _toString$2 = Object.prototype.toString;
|
10827 | function resolveYamlOmap(data) {
|
10828 | if (data === null)
|
10829 | return true;
|
10830 | var objectKeys = [], index, length2, pair, pairKey, pairHasKey, object = data;
|
10831 | for (index = 0, length2 = object.length; index < length2; index += 1) {
|
10832 | pair = object[index];
|
10833 | pairHasKey = false;
|
10834 | if (_toString$2.call(pair) !== "[object Object]")
|
10835 | return false;
|
10836 | for (pairKey in pair) {
|
10837 | if (_hasOwnProperty$3.call(pair, pairKey)) {
|
10838 | if (!pairHasKey)
|
10839 | pairHasKey = true;
|
10840 | else
|
10841 | return false;
|
10842 | }
|
10843 | }
|
10844 | if (!pairHasKey)
|
10845 | return false;
|
10846 | if (objectKeys.indexOf(pairKey) === -1)
|
10847 | objectKeys.push(pairKey);
|
10848 | else
|
10849 | return false;
|
10850 | }
|
10851 | return true;
|
10852 | }
|
10853 | function constructYamlOmap(data) {
|
10854 | return data !== null ? data : [];
|
10855 | }
|
10856 | var omap = new type("tag:yaml.org,2002:omap", {
|
10857 | kind: "sequence",
|
10858 | resolve: resolveYamlOmap,
|
10859 | construct: constructYamlOmap
|
10860 | });
|
10861 | var _toString$1 = Object.prototype.toString;
|
10862 | function resolveYamlPairs(data) {
|
10863 | if (data === null)
|
10864 | return true;
|
10865 | var index, length2, pair, keys, result, object = data;
|
10866 | result = new Array(object.length);
|
10867 | for (index = 0, length2 = object.length; index < length2; index += 1) {
|
10868 | pair = object[index];
|
10869 | if (_toString$1.call(pair) !== "[object Object]")
|
10870 | return false;
|
10871 | keys = Object.keys(pair);
|
10872 | if (keys.length !== 1)
|
10873 | return false;
|
10874 | result[index] = [keys[0], pair[keys[0]]];
|
10875 | }
|
10876 | return true;
|
10877 | }
|
10878 | function constructYamlPairs(data) {
|
10879 | if (data === null)
|
10880 | return [];
|
10881 | var index, length2, pair, keys, result, object = data;
|
10882 | result = new Array(object.length);
|
10883 | for (index = 0, length2 = object.length; index < length2; index += 1) {
|
10884 | pair = object[index];
|
10885 | keys = Object.keys(pair);
|
10886 | result[index] = [keys[0], pair[keys[0]]];
|
10887 | }
|
10888 | return result;
|
10889 | }
|
10890 | var pairs = new type("tag:yaml.org,2002:pairs", {
|
10891 | kind: "sequence",
|
10892 | resolve: resolveYamlPairs,
|
10893 | construct: constructYamlPairs
|
10894 | });
|
10895 | var _hasOwnProperty$2 = Object.prototype.hasOwnProperty;
|
10896 | function resolveYamlSet(data) {
|
10897 | if (data === null)
|
10898 | return true;
|
10899 | var key, object = data;
|
10900 | for (key in object) {
|
10901 | if (_hasOwnProperty$2.call(object, key)) {
|
10902 | if (object[key] !== null)
|
10903 | return false;
|
10904 | }
|
10905 | }
|
10906 | return true;
|
10907 | }
|
10908 | function constructYamlSet(data) {
|
10909 | return data !== null ? data : {};
|
10910 | }
|
10911 | var set = new type("tag:yaml.org,2002:set", {
|
10912 | kind: "mapping",
|
10913 | resolve: resolveYamlSet,
|
10914 | construct: constructYamlSet
|
10915 | });
|
10916 | var _default = core.extend({
|
10917 | implicit: [
|
10918 | timestamp,
|
10919 | merge
|
10920 | ],
|
10921 | explicit: [
|
10922 | binary,
|
10923 | omap,
|
10924 | pairs,
|
10925 | set
|
10926 | ]
|
10927 | });
|
10928 | var _hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
10929 | var CONTEXT_FLOW_IN = 1;
|
10930 | var CONTEXT_FLOW_OUT = 2;
|
10931 | var CONTEXT_BLOCK_IN = 3;
|
10932 | var CONTEXT_BLOCK_OUT = 4;
|
10933 | var CHOMPING_CLIP = 1;
|
10934 | var CHOMPING_STRIP = 2;
|
10935 | var CHOMPING_KEEP = 3;
|
10936 | var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
|
10937 | var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
|
10938 | var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
|
10939 | var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
|
10940 | var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
|
10941 | function _class(obj) {
|
10942 | return Object.prototype.toString.call(obj);
|
10943 | }
|
10944 | function is_EOL(c) {
|
10945 | return c === 10 || c === 13;
|
10946 | }
|
10947 | function is_WHITE_SPACE(c) {
|
10948 | return c === 9 || c === 32;
|
10949 | }
|
10950 | function is_WS_OR_EOL(c) {
|
10951 | return c === 9 || c === 32 || c === 10 || c === 13;
|
10952 | }
|
10953 | function is_FLOW_INDICATOR(c) {
|
10954 | return c === 44 || c === 91 || c === 93 || c === 123 || c === 125;
|
10955 | }
|
10956 | function fromHexCode(c) {
|
10957 | var lc;
|
10958 | if (48 <= c && c <= 57) {
|
10959 | return c - 48;
|
10960 | }
|
10961 | lc = c | 32;
|
10962 | if (97 <= lc && lc <= 102) {
|
10963 | return lc - 97 + 10;
|
10964 | }
|
10965 | return -1;
|
10966 | }
|
10967 | function escapedHexLen(c) {
|
10968 | if (c === 120) {
|
10969 | return 2;
|
10970 | }
|
10971 | if (c === 117) {
|
10972 | return 4;
|
10973 | }
|
10974 | if (c === 85) {
|
10975 | return 8;
|
10976 | }
|
10977 | return 0;
|
10978 | }
|
10979 | function fromDecimalCode(c) {
|
10980 | if (48 <= c && c <= 57) {
|
10981 | return c - 48;
|
10982 | }
|
10983 | return -1;
|
10984 | }
|
10985 | function simpleEscapeSequence(c) {
|
10986 | 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" : "";
|
10987 | }
|
10988 | function charFromCodepoint(c) {
|
10989 | if (c <= 65535) {
|
10990 | return String.fromCharCode(c);
|
10991 | }
|
10992 | return String.fromCharCode(
|
10993 | (c - 65536 >> 10) + 55296,
|
10994 | (c - 65536 & 1023) + 56320
|
10995 | );
|
10996 | }
|
10997 | var simpleEscapeCheck = new Array(256);
|
10998 | var simpleEscapeMap = new Array(256);
|
10999 | for (var i = 0; i < 256; i++) {
|
11000 | simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
|
11001 | simpleEscapeMap[i] = simpleEscapeSequence(i);
|
11002 | }
|
11003 | function State$1(input, options) {
|
11004 | this.input = input;
|
11005 | this.filename = options["filename"] || null;
|
11006 | this.schema = options["schema"] || _default;
|
11007 | this.onWarning = options["onWarning"] || null;
|
11008 | this.legacy = options["legacy"] || false;
|
11009 | this.json = options["json"] || false;
|
11010 | this.listener = options["listener"] || null;
|
11011 | this.implicitTypes = this.schema.compiledImplicit;
|
11012 | this.typeMap = this.schema.compiledTypeMap;
|
11013 | this.length = input.length;
|
11014 | this.position = 0;
|
11015 | this.line = 0;
|
11016 | this.lineStart = 0;
|
11017 | this.lineIndent = 0;
|
11018 | this.firstTabInLine = -1;
|
11019 | this.documents = [];
|
11020 | }
|
11021 | function generateError(state2, message) {
|
11022 | var mark = {
|
11023 | name: state2.filename,
|
11024 | buffer: state2.input.slice(0, -1),
|
11025 |
|
11026 | position: state2.position,
|
11027 | line: state2.line,
|
11028 | column: state2.position - state2.lineStart
|
11029 | };
|
11030 | mark.snippet = snippet(mark);
|
11031 | return new exception(message, mark);
|
11032 | }
|
11033 | function throwError(state2, message) {
|
11034 | throw generateError(state2, message);
|
11035 | }
|
11036 | function throwWarning(state2, message) {
|
11037 | if (state2.onWarning) {
|
11038 | state2.onWarning.call(null, generateError(state2, message));
|
11039 | }
|
11040 | }
|
11041 | var directiveHandlers = {
|
11042 | YAML: function handleYamlDirective(state2, name, args) {
|
11043 | var match, major, minor;
|
11044 | if (state2.version !== null) {
|
11045 | throwError(state2, "duplication of %YAML directive");
|
11046 | }
|
11047 | if (args.length !== 1) {
|
11048 | throwError(state2, "YAML directive accepts exactly one argument");
|
11049 | }
|
11050 | match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
|
11051 | if (match === null) {
|
11052 | throwError(state2, "ill-formed argument of the YAML directive");
|
11053 | }
|
11054 | major = parseInt(match[1], 10);
|
11055 | minor = parseInt(match[2], 10);
|
11056 | if (major !== 1) {
|
11057 | throwError(state2, "unacceptable YAML version of the document");
|
11058 | }
|
11059 | state2.version = args[0];
|
11060 | state2.checkLineBreaks = minor < 2;
|
11061 | if (minor !== 1 && minor !== 2) {
|
11062 | throwWarning(state2, "unsupported YAML version of the document");
|
11063 | }
|
11064 | },
|
11065 | TAG: function handleTagDirective(state2, name, args) {
|
11066 | var handle, prefix;
|
11067 | if (args.length !== 2) {
|
11068 | throwError(state2, "TAG directive accepts exactly two arguments");
|
11069 | }
|
11070 | handle = args[0];
|
11071 | prefix = args[1];
|
11072 | if (!PATTERN_TAG_HANDLE.test(handle)) {
|
11073 | throwError(state2, "ill-formed tag handle (first argument) of the TAG directive");
|
11074 | }
|
11075 | if (_hasOwnProperty$1.call(state2.tagMap, handle)) {
|
11076 | throwError(state2, 'there is a previously declared suffix for "' + handle + '" tag handle');
|
11077 | }
|
11078 | if (!PATTERN_TAG_URI.test(prefix)) {
|
11079 | throwError(state2, "ill-formed tag prefix (second argument) of the TAG directive");
|
11080 | }
|
11081 | try {
|
11082 | prefix = decodeURIComponent(prefix);
|
11083 | } catch (err) {
|
11084 | throwError(state2, "tag prefix is malformed: " + prefix);
|
11085 | }
|
11086 | state2.tagMap[handle] = prefix;
|
11087 | }
|
11088 | };
|
11089 | function captureSegment(state2, start2, end, checkJson) {
|
11090 | var _position, _length, _character, _result;
|
11091 | if (start2 < end) {
|
11092 | _result = state2.input.slice(start2, end);
|
11093 | if (checkJson) {
|
11094 | for (_position = 0, _length = _result.length; _position < _length; _position += 1) {
|
11095 | _character = _result.charCodeAt(_position);
|
11096 | if (!(_character === 9 || 32 <= _character && _character <= 1114111)) {
|
11097 | throwError(state2, "expected valid JSON character");
|
11098 | }
|
11099 | }
|
11100 | } else if (PATTERN_NON_PRINTABLE.test(_result)) {
|
11101 | throwError(state2, "the stream contains non-printable characters");
|
11102 | }
|
11103 | state2.result += _result;
|
11104 | }
|
11105 | }
|
11106 | function mergeMappings(state2, destination, source, overridableKeys) {
|
11107 | var sourceKeys, key, index, quantity;
|
11108 | if (!common.isObject(source)) {
|
11109 | throwError(state2, "cannot merge mappings; the provided source object is unacceptable");
|
11110 | }
|
11111 | sourceKeys = Object.keys(source);
|
11112 | for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
|
11113 | key = sourceKeys[index];
|
11114 | if (!_hasOwnProperty$1.call(destination, key)) {
|
11115 | destination[key] = source[key];
|
11116 | overridableKeys[key] = true;
|
11117 | }
|
11118 | }
|
11119 | }
|
11120 | function storeMappingPair(state2, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startLineStart, startPos) {
|
11121 | var index, quantity;
|
11122 | if (Array.isArray(keyNode)) {
|
11123 | keyNode = Array.prototype.slice.call(keyNode);
|
11124 | for (index = 0, quantity = keyNode.length; index < quantity; index += 1) {
|
11125 | if (Array.isArray(keyNode[index])) {
|
11126 | throwError(state2, "nested arrays are not supported inside keys");
|
11127 | }
|
11128 | if (typeof keyNode === "object" && _class(keyNode[index]) === "[object Object]") {
|
11129 | keyNode[index] = "[object Object]";
|
11130 | }
|
11131 | }
|
11132 | }
|
11133 | if (typeof keyNode === "object" && _class(keyNode) === "[object Object]") {
|
11134 | keyNode = "[object Object]";
|
11135 | }
|
11136 | keyNode = String(keyNode);
|
11137 | if (_result === null) {
|
11138 | _result = {};
|
11139 | }
|
11140 | if (keyTag === "tag:yaml.org,2002:merge") {
|
11141 | if (Array.isArray(valueNode)) {
|
11142 | for (index = 0, quantity = valueNode.length; index < quantity; index += 1) {
|
11143 | mergeMappings(state2, _result, valueNode[index], overridableKeys);
|
11144 | }
|
11145 | } else {
|
11146 | mergeMappings(state2, _result, valueNode, overridableKeys);
|
11147 | }
|
11148 | } else {
|
11149 | if (!state2.json && !_hasOwnProperty$1.call(overridableKeys, keyNode) && _hasOwnProperty$1.call(_result, keyNode)) {
|
11150 | state2.line = startLine || state2.line;
|
11151 | state2.lineStart = startLineStart || state2.lineStart;
|
11152 | state2.position = startPos || state2.position;
|
11153 | throwError(state2, "duplicated mapping key");
|
11154 | }
|
11155 | if (keyNode === "__proto__") {
|
11156 | Object.defineProperty(_result, keyNode, {
|
11157 | configurable: true,
|
11158 | enumerable: true,
|
11159 | writable: true,
|
11160 | value: valueNode
|
11161 | });
|
11162 | } else {
|
11163 | _result[keyNode] = valueNode;
|
11164 | }
|
11165 | delete overridableKeys[keyNode];
|
11166 | }
|
11167 | return _result;
|
11168 | }
|
11169 | function readLineBreak(state2) {
|
11170 | var ch;
|
11171 | ch = state2.input.charCodeAt(state2.position);
|
11172 | if (ch === 10) {
|
11173 | state2.position++;
|
11174 | } else if (ch === 13) {
|
11175 | state2.position++;
|
11176 | if (state2.input.charCodeAt(state2.position) === 10) {
|
11177 | state2.position++;
|
11178 | }
|
11179 | } else {
|
11180 | throwError(state2, "a line break is expected");
|
11181 | }
|
11182 | state2.line += 1;
|
11183 | state2.lineStart = state2.position;
|
11184 | state2.firstTabInLine = -1;
|
11185 | }
|
11186 | function skipSeparationSpace(state2, allowComments, checkIndent) {
|
11187 | var lineBreaks = 0, ch = state2.input.charCodeAt(state2.position);
|
11188 | while (ch !== 0) {
|
11189 | while (is_WHITE_SPACE(ch)) {
|
11190 | if (ch === 9 && state2.firstTabInLine === -1) {
|
11191 | state2.firstTabInLine = state2.position;
|
11192 | }
|
11193 | ch = state2.input.charCodeAt(++state2.position);
|
11194 | }
|
11195 | if (allowComments && ch === 35) {
|
11196 | do {
|
11197 | ch = state2.input.charCodeAt(++state2.position);
|
11198 | } while (ch !== 10 && ch !== 13 && ch !== 0);
|
11199 | }
|
11200 | if (is_EOL(ch)) {
|
11201 | readLineBreak(state2);
|
11202 | ch = state2.input.charCodeAt(state2.position);
|
11203 | lineBreaks++;
|
11204 | state2.lineIndent = 0;
|
11205 | while (ch === 32) {
|
11206 | state2.lineIndent++;
|
11207 | ch = state2.input.charCodeAt(++state2.position);
|
11208 | }
|
11209 | } else {
|
11210 | break;
|
11211 | }
|
11212 | }
|
11213 | if (checkIndent !== -1 && lineBreaks !== 0 && state2.lineIndent < checkIndent) {
|
11214 | throwWarning(state2, "deficient indentation");
|
11215 | }
|
11216 | return lineBreaks;
|
11217 | }
|
11218 | function testDocumentSeparator(state2) {
|
11219 | var _position = state2.position, ch;
|
11220 | ch = state2.input.charCodeAt(_position);
|
11221 | if ((ch === 45 || ch === 46) && ch === state2.input.charCodeAt(_position + 1) && ch === state2.input.charCodeAt(_position + 2)) {
|
11222 | _position += 3;
|
11223 | ch = state2.input.charCodeAt(_position);
|
11224 | if (ch === 0 || is_WS_OR_EOL(ch)) {
|
11225 | return true;
|
11226 | }
|
11227 | }
|
11228 | return false;
|
11229 | }
|
11230 | function writeFoldedLines(state2, count) {
|
11231 | if (count === 1) {
|
11232 | state2.result += " ";
|
11233 | } else if (count > 1) {
|
11234 | state2.result += common.repeat("\n", count - 1);
|
11235 | }
|
11236 | }
|
11237 | function readPlainScalar(state2, nodeIndent, withinFlowCollection) {
|
11238 | var preceding, following, captureStart, captureEnd, hasPendingContent, _line, _lineStart, _lineIndent, _kind = state2.kind, _result = state2.result, ch;
|
11239 | ch = state2.input.charCodeAt(state2.position);
|
11240 | 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) {
|
11241 | return false;
|
11242 | }
|
11243 | if (ch === 63 || ch === 45) {
|
11244 | following = state2.input.charCodeAt(state2.position + 1);
|
11245 | if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
|
11246 | return false;
|
11247 | }
|
11248 | }
|
11249 | state2.kind = "scalar";
|
11250 | state2.result = "";
|
11251 | captureStart = captureEnd = state2.position;
|
11252 | hasPendingContent = false;
|
11253 | while (ch !== 0) {
|
11254 | if (ch === 58) {
|
11255 | following = state2.input.charCodeAt(state2.position + 1);
|
11256 | if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
|
11257 | break;
|
11258 | }
|
11259 | } else if (ch === 35) {
|
11260 | preceding = state2.input.charCodeAt(state2.position - 1);
|
11261 | if (is_WS_OR_EOL(preceding)) {
|
11262 | break;
|
11263 | }
|
11264 | } else if (state2.position === state2.lineStart && testDocumentSeparator(state2) || withinFlowCollection && is_FLOW_INDICATOR(ch)) {
|
11265 | break;
|
11266 | } else if (is_EOL(ch)) {
|
11267 | _line = state2.line;
|
11268 | _lineStart = state2.lineStart;
|
11269 | _lineIndent = state2.lineIndent;
|
11270 | skipSeparationSpace(state2, false, -1);
|
11271 | if (state2.lineIndent >= nodeIndent) {
|
11272 | hasPendingContent = true;
|
11273 | ch = state2.input.charCodeAt(state2.position);
|
11274 | continue;
|
11275 | } else {
|
11276 | state2.position = captureEnd;
|
11277 | state2.line = _line;
|
11278 | state2.lineStart = _lineStart;
|
11279 | state2.lineIndent = _lineIndent;
|
11280 | break;
|
11281 | }
|
11282 | }
|
11283 | if (hasPendingContent) {
|
11284 | captureSegment(state2, captureStart, captureEnd, false);
|
11285 | writeFoldedLines(state2, state2.line - _line);
|
11286 | captureStart = captureEnd = state2.position;
|
11287 | hasPendingContent = false;
|
11288 | }
|
11289 | if (!is_WHITE_SPACE(ch)) {
|
11290 | captureEnd = state2.position + 1;
|
11291 | }
|
11292 | ch = state2.input.charCodeAt(++state2.position);
|
11293 | }
|
11294 | captureSegment(state2, captureStart, captureEnd, false);
|
11295 | if (state2.result) {
|
11296 | return true;
|
11297 | }
|
11298 | state2.kind = _kind;
|
11299 | state2.result = _result;
|
11300 | return false;
|
11301 | }
|
11302 | function readSingleQuotedScalar(state2, nodeIndent) {
|
11303 | var ch, captureStart, captureEnd;
|
11304 | ch = state2.input.charCodeAt(state2.position);
|
11305 | if (ch !== 39) {
|
11306 | return false;
|
11307 | }
|
11308 | state2.kind = "scalar";
|
11309 | state2.result = "";
|
11310 | state2.position++;
|
11311 | captureStart = captureEnd = state2.position;
|
11312 | while ((ch = state2.input.charCodeAt(state2.position)) !== 0) {
|
11313 | if (ch === 39) {
|
11314 | captureSegment(state2, captureStart, state2.position, true);
|
11315 | ch = state2.input.charCodeAt(++state2.position);
|
11316 | if (ch === 39) {
|
11317 | captureStart = state2.position;
|
11318 | state2.position++;
|
11319 | captureEnd = state2.position;
|
11320 | } else {
|
11321 | return true;
|
11322 | }
|
11323 | } else if (is_EOL(ch)) {
|
11324 | captureSegment(state2, captureStart, captureEnd, true);
|
11325 | writeFoldedLines(state2, skipSeparationSpace(state2, false, nodeIndent));
|
11326 | captureStart = captureEnd = state2.position;
|
11327 | } else if (state2.position === state2.lineStart && testDocumentSeparator(state2)) {
|
11328 | throwError(state2, "unexpected end of the document within a single quoted scalar");
|
11329 | } else {
|
11330 | state2.position++;
|
11331 | captureEnd = state2.position;
|
11332 | }
|
11333 | }
|
11334 | throwError(state2, "unexpected end of the stream within a single quoted scalar");
|
11335 | }
|
11336 | function readDoubleQuotedScalar(state2, nodeIndent) {
|
11337 | var captureStart, captureEnd, hexLength, hexResult, tmp, ch;
|
11338 | ch = state2.input.charCodeAt(state2.position);
|
11339 | if (ch !== 34) {
|
11340 | return false;
|
11341 | }
|
11342 | state2.kind = "scalar";
|
11343 | state2.result = "";
|
11344 | state2.position++;
|
11345 | captureStart = captureEnd = state2.position;
|
11346 | while ((ch = state2.input.charCodeAt(state2.position)) !== 0) {
|
11347 | if (ch === 34) {
|
11348 | captureSegment(state2, captureStart, state2.position, true);
|
11349 | state2.position++;
|
11350 | return true;
|
11351 | } else if (ch === 92) {
|
11352 | captureSegment(state2, captureStart, state2.position, true);
|
11353 | ch = state2.input.charCodeAt(++state2.position);
|
11354 | if (is_EOL(ch)) {
|
11355 | skipSeparationSpace(state2, false, nodeIndent);
|
11356 | } else if (ch < 256 && simpleEscapeCheck[ch]) {
|
11357 | state2.result += simpleEscapeMap[ch];
|
11358 | state2.position++;
|
11359 | } else if ((tmp = escapedHexLen(ch)) > 0) {
|
11360 | hexLength = tmp;
|
11361 | hexResult = 0;
|
11362 | for (; hexLength > 0; hexLength--) {
|
11363 | ch = state2.input.charCodeAt(++state2.position);
|
11364 | if ((tmp = fromHexCode(ch)) >= 0) {
|
11365 | hexResult = (hexResult << 4) + tmp;
|
11366 | } else {
|
11367 | throwError(state2, "expected hexadecimal character");
|
11368 | }
|
11369 | }
|
11370 | state2.result += charFromCodepoint(hexResult);
|
11371 | state2.position++;
|
11372 | } else {
|
11373 | throwError(state2, "unknown escape sequence");
|
11374 | }
|
11375 | captureStart = captureEnd = state2.position;
|
11376 | } else if (is_EOL(ch)) {
|
11377 | captureSegment(state2, captureStart, captureEnd, true);
|
11378 | writeFoldedLines(state2, skipSeparationSpace(state2, false, nodeIndent));
|
11379 | captureStart = captureEnd = state2.position;
|
11380 | } else if (state2.position === state2.lineStart && testDocumentSeparator(state2)) {
|
11381 | throwError(state2, "unexpected end of the document within a double quoted scalar");
|
11382 | } else {
|
11383 | state2.position++;
|
11384 | captureEnd = state2.position;
|
11385 | }
|
11386 | }
|
11387 | throwError(state2, "unexpected end of the stream within a double quoted scalar");
|
11388 | }
|
11389 | function readFlowCollection(state2, nodeIndent) {
|
11390 | 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;
|
11391 | ch = state2.input.charCodeAt(state2.position);
|
11392 | if (ch === 91) {
|
11393 | terminator = 93;
|
11394 | isMapping = false;
|
11395 | _result = [];
|
11396 | } else if (ch === 123) {
|
11397 | terminator = 125;
|
11398 | isMapping = true;
|
11399 | _result = {};
|
11400 | } else {
|
11401 | return false;
|
11402 | }
|
11403 | if (state2.anchor !== null) {
|
11404 | state2.anchorMap[state2.anchor] = _result;
|
11405 | }
|
11406 | ch = state2.input.charCodeAt(++state2.position);
|
11407 | while (ch !== 0) {
|
11408 | skipSeparationSpace(state2, true, nodeIndent);
|
11409 | ch = state2.input.charCodeAt(state2.position);
|
11410 | if (ch === terminator) {
|
11411 | state2.position++;
|
11412 | state2.tag = _tag;
|
11413 | state2.anchor = _anchor;
|
11414 | state2.kind = isMapping ? "mapping" : "sequence";
|
11415 | state2.result = _result;
|
11416 | return true;
|
11417 | } else if (!readNext) {
|
11418 | throwError(state2, "missed comma between flow collection entries");
|
11419 | } else if (ch === 44) {
|
11420 | throwError(state2, "expected the node content, but found ','");
|
11421 | }
|
11422 | keyTag = keyNode = valueNode = null;
|
11423 | isPair = isExplicitPair = false;
|
11424 | if (ch === 63) {
|
11425 | following = state2.input.charCodeAt(state2.position + 1);
|
11426 | if (is_WS_OR_EOL(following)) {
|
11427 | isPair = isExplicitPair = true;
|
11428 | state2.position++;
|
11429 | skipSeparationSpace(state2, true, nodeIndent);
|
11430 | }
|
11431 | }
|
11432 | _line = state2.line;
|
11433 | _lineStart = state2.lineStart;
|
11434 | _pos = state2.position;
|
11435 | composeNode(state2, nodeIndent, CONTEXT_FLOW_IN, false, true);
|
11436 | keyTag = state2.tag;
|
11437 | keyNode = state2.result;
|
11438 | skipSeparationSpace(state2, true, nodeIndent);
|
11439 | ch = state2.input.charCodeAt(state2.position);
|
11440 | if ((isExplicitPair || state2.line === _line) && ch === 58) {
|
11441 | isPair = true;
|
11442 | ch = state2.input.charCodeAt(++state2.position);
|
11443 | skipSeparationSpace(state2, true, nodeIndent);
|
11444 | composeNode(state2, nodeIndent, CONTEXT_FLOW_IN, false, true);
|
11445 | valueNode = state2.result;
|
11446 | }
|
11447 | if (isMapping) {
|
11448 | storeMappingPair(state2, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos);
|
11449 | } else if (isPair) {
|
11450 | _result.push(storeMappingPair(state2, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos));
|
11451 | } else {
|
11452 | _result.push(keyNode);
|
11453 | }
|
11454 | skipSeparationSpace(state2, true, nodeIndent);
|
11455 | ch = state2.input.charCodeAt(state2.position);
|
11456 | if (ch === 44) {
|
11457 | readNext = true;
|
11458 | ch = state2.input.charCodeAt(++state2.position);
|
11459 | } else {
|
11460 | readNext = false;
|
11461 | }
|
11462 | }
|
11463 | throwError(state2, "unexpected end of the stream within a flow collection");
|
11464 | }
|
11465 | function readBlockScalar(state2, nodeIndent) {
|
11466 | var captureStart, folding, chomping = CHOMPING_CLIP, didReadContent = false, detectedIndent = false, textIndent = nodeIndent, emptyLines = 0, atMoreIndented = false, tmp, ch;
|
11467 | ch = state2.input.charCodeAt(state2.position);
|
11468 | if (ch === 124) {
|
11469 | folding = false;
|
11470 | } else if (ch === 62) {
|
11471 | folding = true;
|
11472 | } else {
|
11473 | return false;
|
11474 | }
|
11475 | state2.kind = "scalar";
|
11476 | state2.result = "";
|
11477 | while (ch !== 0) {
|
11478 | ch = state2.input.charCodeAt(++state2.position);
|
11479 | if (ch === 43 || ch === 45) {
|
11480 | if (CHOMPING_CLIP === chomping) {
|
11481 | chomping = ch === 43 ? CHOMPING_KEEP : CHOMPING_STRIP;
|
11482 | } else {
|
11483 | throwError(state2, "repeat of a chomping mode identifier");
|
11484 | }
|
11485 | } else if ((tmp = fromDecimalCode(ch)) >= 0) {
|
11486 | if (tmp === 0) {
|
11487 | throwError(state2, "bad explicit indentation width of a block scalar; it cannot be less than one");
|
11488 | } else if (!detectedIndent) {
|
11489 | textIndent = nodeIndent + tmp - 1;
|
11490 | detectedIndent = true;
|
11491 | } else {
|
11492 | throwError(state2, "repeat of an indentation width identifier");
|
11493 | }
|
11494 | } else {
|
11495 | break;
|
11496 | }
|
11497 | }
|
11498 | if (is_WHITE_SPACE(ch)) {
|
11499 | do {
|
11500 | ch = state2.input.charCodeAt(++state2.position);
|
11501 | } while (is_WHITE_SPACE(ch));
|
11502 | if (ch === 35) {
|
11503 | do {
|
11504 | ch = state2.input.charCodeAt(++state2.position);
|
11505 | } while (!is_EOL(ch) && ch !== 0);
|
11506 | }
|
11507 | }
|
11508 | while (ch !== 0) {
|
11509 | readLineBreak(state2);
|
11510 | state2.lineIndent = 0;
|
11511 | ch = state2.input.charCodeAt(state2.position);
|
11512 | while ((!detectedIndent || state2.lineIndent < textIndent) && ch === 32) {
|
11513 | state2.lineIndent++;
|
11514 | ch = state2.input.charCodeAt(++state2.position);
|
11515 | }
|
11516 | if (!detectedIndent && state2.lineIndent > textIndent) {
|
11517 | textIndent = state2.lineIndent;
|
11518 | }
|
11519 | if (is_EOL(ch)) {
|
11520 | emptyLines++;
|
11521 | continue;
|
11522 | }
|
11523 | if (state2.lineIndent < textIndent) {
|
11524 | if (chomping === CHOMPING_KEEP) {
|
11525 | state2.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
|
11526 | } else if (chomping === CHOMPING_CLIP) {
|
11527 | if (didReadContent) {
|
11528 | state2.result += "\n";
|
11529 | }
|
11530 | }
|
11531 | break;
|
11532 | }
|
11533 | if (folding) {
|
11534 | if (is_WHITE_SPACE(ch)) {
|
11535 | atMoreIndented = true;
|
11536 | state2.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
|
11537 | } else if (atMoreIndented) {
|
11538 | atMoreIndented = false;
|
11539 | state2.result += common.repeat("\n", emptyLines + 1);
|
11540 | } else if (emptyLines === 0) {
|
11541 | if (didReadContent) {
|
11542 | state2.result += " ";
|
11543 | }
|
11544 | } else {
|
11545 | state2.result += common.repeat("\n", emptyLines);
|
11546 | }
|
11547 | } else {
|
11548 | state2.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
|
11549 | }
|
11550 | didReadContent = true;
|
11551 | detectedIndent = true;
|
11552 | emptyLines = 0;
|
11553 | captureStart = state2.position;
|
11554 | while (!is_EOL(ch) && ch !== 0) {
|
11555 | ch = state2.input.charCodeAt(++state2.position);
|
11556 | }
|
11557 | captureSegment(state2, captureStart, state2.position, false);
|
11558 | }
|
11559 | return true;
|
11560 | }
|
11561 | function readBlockSequence(state2, nodeIndent) {
|
11562 | var _line, _tag = state2.tag, _anchor = state2.anchor, _result = [], following, detected = false, ch;
|
11563 | if (state2.firstTabInLine !== -1)
|
11564 | return false;
|
11565 | if (state2.anchor !== null) {
|
11566 | state2.anchorMap[state2.anchor] = _result;
|
11567 | }
|
11568 | ch = state2.input.charCodeAt(state2.position);
|
11569 | while (ch !== 0) {
|
11570 | if (state2.firstTabInLine !== -1) {
|
11571 | state2.position = state2.firstTabInLine;
|
11572 | throwError(state2, "tab characters must not be used in indentation");
|
11573 | }
|
11574 | if (ch !== 45) {
|
11575 | break;
|
11576 | }
|
11577 | following = state2.input.charCodeAt(state2.position + 1);
|
11578 | if (!is_WS_OR_EOL(following)) {
|
11579 | break;
|
11580 | }
|
11581 | detected = true;
|
11582 | state2.position++;
|
11583 | if (skipSeparationSpace(state2, true, -1)) {
|
11584 | if (state2.lineIndent <= nodeIndent) {
|
11585 | _result.push(null);
|
11586 | ch = state2.input.charCodeAt(state2.position);
|
11587 | continue;
|
11588 | }
|
11589 | }
|
11590 | _line = state2.line;
|
11591 | composeNode(state2, nodeIndent, CONTEXT_BLOCK_IN, false, true);
|
11592 | _result.push(state2.result);
|
11593 | skipSeparationSpace(state2, true, -1);
|
11594 | ch = state2.input.charCodeAt(state2.position);
|
11595 | if ((state2.line === _line || state2.lineIndent > nodeIndent) && ch !== 0) {
|
11596 | throwError(state2, "bad indentation of a sequence entry");
|
11597 | } else if (state2.lineIndent < nodeIndent) {
|
11598 | break;
|
11599 | }
|
11600 | }
|
11601 | if (detected) {
|
11602 | state2.tag = _tag;
|
11603 | state2.anchor = _anchor;
|
11604 | state2.kind = "sequence";
|
11605 | state2.result = _result;
|
11606 | return true;
|
11607 | }
|
11608 | return false;
|
11609 | }
|
11610 | function readBlockMapping(state2, nodeIndent, flowIndent) {
|
11611 | 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;
|
11612 | if (state2.firstTabInLine !== -1)
|
11613 | return false;
|
11614 | if (state2.anchor !== null) {
|
11615 | state2.anchorMap[state2.anchor] = _result;
|
11616 | }
|
11617 | ch = state2.input.charCodeAt(state2.position);
|
11618 | while (ch !== 0) {
|
11619 | if (!atExplicitKey && state2.firstTabInLine !== -1) {
|
11620 | state2.position = state2.firstTabInLine;
|
11621 | throwError(state2, "tab characters must not be used in indentation");
|
11622 | }
|
11623 | following = state2.input.charCodeAt(state2.position + 1);
|
11624 | _line = state2.line;
|
11625 | if ((ch === 63 || ch === 58) && is_WS_OR_EOL(following)) {
|
11626 | if (ch === 63) {
|
11627 | if (atExplicitKey) {
|
11628 | storeMappingPair(state2, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
|
11629 | keyTag = keyNode = valueNode = null;
|
11630 | }
|
11631 | detected = true;
|
11632 | atExplicitKey = true;
|
11633 | allowCompact = true;
|
11634 | } else if (atExplicitKey) {
|
11635 | atExplicitKey = false;
|
11636 | allowCompact = true;
|
11637 | } else {
|
11638 | throwError(state2, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line");
|
11639 | }
|
11640 | state2.position += 1;
|
11641 | ch = following;
|
11642 | } else {
|
11643 | _keyLine = state2.line;
|
11644 | _keyLineStart = state2.lineStart;
|
11645 | _keyPos = state2.position;
|
11646 | if (!composeNode(state2, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
|
11647 | break;
|
11648 | }
|
11649 | if (state2.line === _line) {
|
11650 | ch = state2.input.charCodeAt(state2.position);
|
11651 | while (is_WHITE_SPACE(ch)) {
|
11652 | ch = state2.input.charCodeAt(++state2.position);
|
11653 | }
|
11654 | if (ch === 58) {
|
11655 | ch = state2.input.charCodeAt(++state2.position);
|
11656 | if (!is_WS_OR_EOL(ch)) {
|
11657 | throwError(state2, "a whitespace character is expected after the key-value separator within a block mapping");
|
11658 | }
|
11659 | if (atExplicitKey) {
|
11660 | storeMappingPair(state2, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
|
11661 | keyTag = keyNode = valueNode = null;
|
11662 | }
|
11663 | detected = true;
|
11664 | atExplicitKey = false;
|
11665 | allowCompact = false;
|
11666 | keyTag = state2.tag;
|
11667 | keyNode = state2.result;
|
11668 | } else if (detected) {
|
11669 | throwError(state2, "can not read an implicit mapping pair; a colon is missed");
|
11670 | } else {
|
11671 | state2.tag = _tag;
|
11672 | state2.anchor = _anchor;
|
11673 | return true;
|
11674 | }
|
11675 | } else if (detected) {
|
11676 | throwError(state2, "can not read a block mapping entry; a multiline key may not be an implicit key");
|
11677 | } else {
|
11678 | state2.tag = _tag;
|
11679 | state2.anchor = _anchor;
|
11680 | return true;
|
11681 | }
|
11682 | }
|
11683 | if (state2.line === _line || state2.lineIndent > nodeIndent) {
|
11684 | if (atExplicitKey) {
|
11685 | _keyLine = state2.line;
|
11686 | _keyLineStart = state2.lineStart;
|
11687 | _keyPos = state2.position;
|
11688 | }
|
11689 | if (composeNode(state2, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {
|
11690 | if (atExplicitKey) {
|
11691 | keyNode = state2.result;
|
11692 | } else {
|
11693 | valueNode = state2.result;
|
11694 | }
|
11695 | }
|
11696 | if (!atExplicitKey) {
|
11697 | storeMappingPair(state2, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos);
|
11698 | keyTag = keyNode = valueNode = null;
|
11699 | }
|
11700 | skipSeparationSpace(state2, true, -1);
|
11701 | ch = state2.input.charCodeAt(state2.position);
|
11702 | }
|
11703 | if ((state2.line === _line || state2.lineIndent > nodeIndent) && ch !== 0) {
|
11704 | throwError(state2, "bad indentation of a mapping entry");
|
11705 | } else if (state2.lineIndent < nodeIndent) {
|
11706 | break;
|
11707 | }
|
11708 | }
|
11709 | if (atExplicitKey) {
|
11710 | storeMappingPair(state2, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
|
11711 | }
|
11712 | if (detected) {
|
11713 | state2.tag = _tag;
|
11714 | state2.anchor = _anchor;
|
11715 | state2.kind = "mapping";
|
11716 | state2.result = _result;
|
11717 | }
|
11718 | return detected;
|
11719 | }
|
11720 | function readTagProperty(state2) {
|
11721 | var _position, isVerbatim = false, isNamed = false, tagHandle, tagName, ch;
|
11722 | ch = state2.input.charCodeAt(state2.position);
|
11723 | if (ch !== 33)
|
11724 | return false;
|
11725 | if (state2.tag !== null) {
|
11726 | throwError(state2, "duplication of a tag property");
|
11727 | }
|
11728 | ch = state2.input.charCodeAt(++state2.position);
|
11729 | if (ch === 60) {
|
11730 | isVerbatim = true;
|
11731 | ch = state2.input.charCodeAt(++state2.position);
|
11732 | } else if (ch === 33) {
|
11733 | isNamed = true;
|
11734 | tagHandle = "!!";
|
11735 | ch = state2.input.charCodeAt(++state2.position);
|
11736 | } else {
|
11737 | tagHandle = "!";
|
11738 | }
|
11739 | _position = state2.position;
|
11740 | if (isVerbatim) {
|
11741 | do {
|
11742 | ch = state2.input.charCodeAt(++state2.position);
|
11743 | } while (ch !== 0 && ch !== 62);
|
11744 | if (state2.position < state2.length) {
|
11745 | tagName = state2.input.slice(_position, state2.position);
|
11746 | ch = state2.input.charCodeAt(++state2.position);
|
11747 | } else {
|
11748 | throwError(state2, "unexpected end of the stream within a verbatim tag");
|
11749 | }
|
11750 | } else {
|
11751 | while (ch !== 0 && !is_WS_OR_EOL(ch)) {
|
11752 | if (ch === 33) {
|
11753 | if (!isNamed) {
|
11754 | tagHandle = state2.input.slice(_position - 1, state2.position + 1);
|
11755 | if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
|
11756 | throwError(state2, "named tag handle cannot contain such characters");
|
11757 | }
|
11758 | isNamed = true;
|
11759 | _position = state2.position + 1;
|
11760 | } else {
|
11761 | throwError(state2, "tag suffix cannot contain exclamation marks");
|
11762 | }
|
11763 | }
|
11764 | ch = state2.input.charCodeAt(++state2.position);
|
11765 | }
|
11766 | tagName = state2.input.slice(_position, state2.position);
|
11767 | if (PATTERN_FLOW_INDICATORS.test(tagName)) {
|
11768 | throwError(state2, "tag suffix cannot contain flow indicator characters");
|
11769 | }
|
11770 | }
|
11771 | if (tagName && !PATTERN_TAG_URI.test(tagName)) {
|
11772 | throwError(state2, "tag name cannot contain such characters: " + tagName);
|
11773 | }
|
11774 | try {
|
11775 | tagName = decodeURIComponent(tagName);
|
11776 | } catch (err) {
|
11777 | throwError(state2, "tag name is malformed: " + tagName);
|
11778 | }
|
11779 | if (isVerbatim) {
|
11780 | state2.tag = tagName;
|
11781 | } else if (_hasOwnProperty$1.call(state2.tagMap, tagHandle)) {
|
11782 | state2.tag = state2.tagMap[tagHandle] + tagName;
|
11783 | } else if (tagHandle === "!") {
|
11784 | state2.tag = "!" + tagName;
|
11785 | } else if (tagHandle === "!!") {
|
11786 | state2.tag = "tag:yaml.org,2002:" + tagName;
|
11787 | } else {
|
11788 | throwError(state2, 'undeclared tag handle "' + tagHandle + '"');
|
11789 | }
|
11790 | return true;
|
11791 | }
|
11792 | function readAnchorProperty(state2) {
|
11793 | var _position, ch;
|
11794 | ch = state2.input.charCodeAt(state2.position);
|
11795 | if (ch !== 38)
|
11796 | return false;
|
11797 | if (state2.anchor !== null) {
|
11798 | throwError(state2, "duplication of an anchor property");
|
11799 | }
|
11800 | ch = state2.input.charCodeAt(++state2.position);
|
11801 | _position = state2.position;
|
11802 | while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
|
11803 | ch = state2.input.charCodeAt(++state2.position);
|
11804 | }
|
11805 | if (state2.position === _position) {
|
11806 | throwError(state2, "name of an anchor node must contain at least one character");
|
11807 | }
|
11808 | state2.anchor = state2.input.slice(_position, state2.position);
|
11809 | return true;
|
11810 | }
|
11811 | function readAlias(state2) {
|
11812 | var _position, alias, ch;
|
11813 | ch = state2.input.charCodeAt(state2.position);
|
11814 | if (ch !== 42)
|
11815 | return false;
|
11816 | ch = state2.input.charCodeAt(++state2.position);
|
11817 | _position = state2.position;
|
11818 | while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
|
11819 | ch = state2.input.charCodeAt(++state2.position);
|
11820 | }
|
11821 | if (state2.position === _position) {
|
11822 | throwError(state2, "name of an alias node must contain at least one character");
|
11823 | }
|
11824 | alias = state2.input.slice(_position, state2.position);
|
11825 | if (!_hasOwnProperty$1.call(state2.anchorMap, alias)) {
|
11826 | throwError(state2, 'unidentified alias "' + alias + '"');
|
11827 | }
|
11828 | state2.result = state2.anchorMap[alias];
|
11829 | skipSeparationSpace(state2, true, -1);
|
11830 | return true;
|
11831 | }
|
11832 | function composeNode(state2, parentIndent, nodeContext, allowToSeek, allowCompact) {
|
11833 | var allowBlockStyles, allowBlockScalars, allowBlockCollections, indentStatus = 1, atNewLine = false, hasContent = false, typeIndex, typeQuantity, typeList, type2, flowIndent, blockIndent;
|
11834 | if (state2.listener !== null) {
|
11835 | state2.listener("open", state2);
|
11836 | }
|
11837 | state2.tag = null;
|
11838 | state2.anchor = null;
|
11839 | state2.kind = null;
|
11840 | state2.result = null;
|
11841 | allowBlockStyles = allowBlockScalars = allowBlockCollections = CONTEXT_BLOCK_OUT === nodeContext || CONTEXT_BLOCK_IN === nodeContext;
|
11842 | if (allowToSeek) {
|
11843 | if (skipSeparationSpace(state2, true, -1)) {
|
11844 | atNewLine = true;
|
11845 | if (state2.lineIndent > parentIndent) {
|
11846 | indentStatus = 1;
|
11847 | } else if (state2.lineIndent === parentIndent) {
|
11848 | indentStatus = 0;
|
11849 | } else if (state2.lineIndent < parentIndent) {
|
11850 | indentStatus = -1;
|
11851 | }
|
11852 | }
|
11853 | }
|
11854 | if (indentStatus === 1) {
|
11855 | while (readTagProperty(state2) || readAnchorProperty(state2)) {
|
11856 | if (skipSeparationSpace(state2, true, -1)) {
|
11857 | atNewLine = true;
|
11858 | allowBlockCollections = allowBlockStyles;
|
11859 | if (state2.lineIndent > parentIndent) {
|
11860 | indentStatus = 1;
|
11861 | } else if (state2.lineIndent === parentIndent) {
|
11862 | indentStatus = 0;
|
11863 | } else if (state2.lineIndent < parentIndent) {
|
11864 | indentStatus = -1;
|
11865 | }
|
11866 | } else {
|
11867 | allowBlockCollections = false;
|
11868 | }
|
11869 | }
|
11870 | }
|
11871 | if (allowBlockCollections) {
|
11872 | allowBlockCollections = atNewLine || allowCompact;
|
11873 | }
|
11874 | if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) {
|
11875 | if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) {
|
11876 | flowIndent = parentIndent;
|
11877 | } else {
|
11878 | flowIndent = parentIndent + 1;
|
11879 | }
|
11880 | blockIndent = state2.position - state2.lineStart;
|
11881 | if (indentStatus === 1) {
|
11882 | if (allowBlockCollections && (readBlockSequence(state2, blockIndent) || readBlockMapping(state2, blockIndent, flowIndent)) || readFlowCollection(state2, flowIndent)) {
|
11883 | hasContent = true;
|
11884 | } else {
|
11885 | if (allowBlockScalars && readBlockScalar(state2, flowIndent) || readSingleQuotedScalar(state2, flowIndent) || readDoubleQuotedScalar(state2, flowIndent)) {
|
11886 | hasContent = true;
|
11887 | } else if (readAlias(state2)) {
|
11888 | hasContent = true;
|
11889 | if (state2.tag !== null || state2.anchor !== null) {
|
11890 | throwError(state2, "alias node should not have any properties");
|
11891 | }
|
11892 | } else if (readPlainScalar(state2, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
|
11893 | hasContent = true;
|
11894 | if (state2.tag === null) {
|
11895 | state2.tag = "?";
|
11896 | }
|
11897 | }
|
11898 | if (state2.anchor !== null) {
|
11899 | state2.anchorMap[state2.anchor] = state2.result;
|
11900 | }
|
11901 | }
|
11902 | } else if (indentStatus === 0) {
|
11903 | hasContent = allowBlockCollections && readBlockSequence(state2, blockIndent);
|
11904 | }
|
11905 | }
|
11906 | if (state2.tag === null) {
|
11907 | if (state2.anchor !== null) {
|
11908 | state2.anchorMap[state2.anchor] = state2.result;
|
11909 | }
|
11910 | } else if (state2.tag === "?") {
|
11911 | if (state2.result !== null && state2.kind !== "scalar") {
|
11912 | throwError(state2, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + state2.kind + '"');
|
11913 | }
|
11914 | for (typeIndex = 0, typeQuantity = state2.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {
|
11915 | type2 = state2.implicitTypes[typeIndex];
|
11916 | if (type2.resolve(state2.result)) {
|
11917 | state2.result = type2.construct(state2.result);
|
11918 | state2.tag = type2.tag;
|
11919 | if (state2.anchor !== null) {
|
11920 | state2.anchorMap[state2.anchor] = state2.result;
|
11921 | }
|
11922 | break;
|
11923 | }
|
11924 | }
|
11925 | } else if (state2.tag !== "!") {
|
11926 | if (_hasOwnProperty$1.call(state2.typeMap[state2.kind || "fallback"], state2.tag)) {
|
11927 | type2 = state2.typeMap[state2.kind || "fallback"][state2.tag];
|
11928 | } else {
|
11929 | type2 = null;
|
11930 | typeList = state2.typeMap.multi[state2.kind || "fallback"];
|
11931 | for (typeIndex = 0, typeQuantity = typeList.length; typeIndex < typeQuantity; typeIndex += 1) {
|
11932 | if (state2.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) {
|
11933 | type2 = typeList[typeIndex];
|
11934 | break;
|
11935 | }
|
11936 | }
|
11937 | }
|
11938 | if (!type2) {
|
11939 | throwError(state2, "unknown tag !<" + state2.tag + ">");
|
11940 | }
|
11941 | if (state2.result !== null && type2.kind !== state2.kind) {
|
11942 | throwError(state2, "unacceptable node kind for !<" + state2.tag + '> tag; it should be "' + type2.kind + '", not "' + state2.kind + '"');
|
11943 | }
|
11944 | if (!type2.resolve(state2.result, state2.tag)) {
|
11945 | throwError(state2, "cannot resolve a node with !<" + state2.tag + "> explicit tag");
|
11946 | } else {
|
11947 | state2.result = type2.construct(state2.result, state2.tag);
|
11948 | if (state2.anchor !== null) {
|
11949 | state2.anchorMap[state2.anchor] = state2.result;
|
11950 | }
|
11951 | }
|
11952 | }
|
11953 | if (state2.listener !== null) {
|
11954 | state2.listener("close", state2);
|
11955 | }
|
11956 | return state2.tag !== null || state2.anchor !== null || hasContent;
|
11957 | }
|
11958 | function readDocument(state2) {
|
11959 | var documentStart = state2.position, _position, directiveName, directiveArgs, hasDirectives = false, ch;
|
11960 | state2.version = null;
|
11961 | state2.checkLineBreaks = state2.legacy;
|
11962 | state2.tagMap = Object.create(null);
|
11963 | state2.anchorMap = Object.create(null);
|
11964 | while ((ch = state2.input.charCodeAt(state2.position)) !== 0) {
|
11965 | skipSeparationSpace(state2, true, -1);
|
11966 | ch = state2.input.charCodeAt(state2.position);
|
11967 | if (state2.lineIndent > 0 || ch !== 37) {
|
11968 | break;
|
11969 | }
|
11970 | hasDirectives = true;
|
11971 | ch = state2.input.charCodeAt(++state2.position);
|
11972 | _position = state2.position;
|
11973 | while (ch !== 0 && !is_WS_OR_EOL(ch)) {
|
11974 | ch = state2.input.charCodeAt(++state2.position);
|
11975 | }
|
11976 | directiveName = state2.input.slice(_position, state2.position);
|
11977 | directiveArgs = [];
|
11978 | if (directiveName.length < 1) {
|
11979 | throwError(state2, "directive name must not be less than one character in length");
|
11980 | }
|
11981 | while (ch !== 0) {
|
11982 | while (is_WHITE_SPACE(ch)) {
|
11983 | ch = state2.input.charCodeAt(++state2.position);
|
11984 | }
|
11985 | if (ch === 35) {
|
11986 | do {
|
11987 | ch = state2.input.charCodeAt(++state2.position);
|
11988 | } while (ch !== 0 && !is_EOL(ch));
|
11989 | break;
|
11990 | }
|
11991 | if (is_EOL(ch))
|
11992 | break;
|
11993 | _position = state2.position;
|
11994 | while (ch !== 0 && !is_WS_OR_EOL(ch)) {
|
11995 | ch = state2.input.charCodeAt(++state2.position);
|
11996 | }
|
11997 | directiveArgs.push(state2.input.slice(_position, state2.position));
|
11998 | }
|
11999 | if (ch !== 0)
|
12000 | readLineBreak(state2);
|
12001 | if (_hasOwnProperty$1.call(directiveHandlers, directiveName)) {
|
12002 | directiveHandlers[directiveName](state2, directiveName, directiveArgs);
|
12003 | } else {
|
12004 | throwWarning(state2, 'unknown document directive "' + directiveName + '"');
|
12005 | }
|
12006 | }
|
12007 | skipSeparationSpace(state2, true, -1);
|
12008 | if (state2.lineIndent === 0 && state2.input.charCodeAt(state2.position) === 45 && state2.input.charCodeAt(state2.position + 1) === 45 && state2.input.charCodeAt(state2.position + 2) === 45) {
|
12009 | state2.position += 3;
|
12010 | skipSeparationSpace(state2, true, -1);
|
12011 | } else if (hasDirectives) {
|
12012 | throwError(state2, "directives end mark is expected");
|
12013 | }
|
12014 | composeNode(state2, state2.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
|
12015 | skipSeparationSpace(state2, true, -1);
|
12016 | if (state2.checkLineBreaks && PATTERN_NON_ASCII_LINE_BREAKS.test(state2.input.slice(documentStart, state2.position))) {
|
12017 | throwWarning(state2, "non-ASCII line breaks are interpreted as content");
|
12018 | }
|
12019 | state2.documents.push(state2.result);
|
12020 | if (state2.position === state2.lineStart && testDocumentSeparator(state2)) {
|
12021 | if (state2.input.charCodeAt(state2.position) === 46) {
|
12022 | state2.position += 3;
|
12023 | skipSeparationSpace(state2, true, -1);
|
12024 | }
|
12025 | return;
|
12026 | }
|
12027 | if (state2.position < state2.length - 1) {
|
12028 | throwError(state2, "end of the stream or a document separator is expected");
|
12029 | } else {
|
12030 | return;
|
12031 | }
|
12032 | }
|
12033 | function loadDocuments(input, options) {
|
12034 | input = String(input);
|
12035 | options = options || {};
|
12036 | if (input.length !== 0) {
|
12037 | if (input.charCodeAt(input.length - 1) !== 10 && input.charCodeAt(input.length - 1) !== 13) {
|
12038 | input += "\n";
|
12039 | }
|
12040 | if (input.charCodeAt(0) === 65279) {
|
12041 | input = input.slice(1);
|
12042 | }
|
12043 | }
|
12044 | var state2 = new State$1(input, options);
|
12045 | var nullpos = input.indexOf("\0");
|
12046 | if (nullpos !== -1) {
|
12047 | state2.position = nullpos;
|
12048 | throwError(state2, "null byte is not allowed in input");
|
12049 | }
|
12050 | state2.input += "\0";
|
12051 | while (state2.input.charCodeAt(state2.position) === 32) {
|
12052 | state2.lineIndent += 1;
|
12053 | state2.position += 1;
|
12054 | }
|
12055 | while (state2.position < state2.length - 1) {
|
12056 | readDocument(state2);
|
12057 | }
|
12058 | return state2.documents;
|
12059 | }
|
12060 | function loadAll$1(input, iterator, options) {
|
12061 | if (iterator !== null && typeof iterator === "object" && typeof options === "undefined") {
|
12062 | options = iterator;
|
12063 | iterator = null;
|
12064 | }
|
12065 | var documents = loadDocuments(input, options);
|
12066 | if (typeof iterator !== "function") {
|
12067 | return documents;
|
12068 | }
|
12069 | for (var index = 0, length2 = documents.length; index < length2; index += 1) {
|
12070 | iterator(documents[index]);
|
12071 | }
|
12072 | }
|
12073 | function load$1(input, options) {
|
12074 | var documents = loadDocuments(input, options);
|
12075 | if (documents.length === 0) {
|
12076 | return void 0;
|
12077 | } else if (documents.length === 1) {
|
12078 | return documents[0];
|
12079 | }
|
12080 | throw new exception("expected a single document in the stream, but found more");
|
12081 | }
|
12082 | var loadAll_1 = loadAll$1;
|
12083 | var load_1 = load$1;
|
12084 | var loader = {
|
12085 | loadAll: loadAll_1,
|
12086 | load: load_1
|
12087 | };
|
12088 | var JSON_SCHEMA = json;
|
12089 | var load = loader.load;
|
12090 | function extractFrontMatter(text2) {
|
12091 | const matches = text2.match(frontMatterRegex);
|
12092 | if (!matches) {
|
12093 | return {
|
12094 | text: text2,
|
12095 | metadata: {}
|
12096 | };
|
12097 | }
|
12098 | let parsed = load(matches[1], {
|
12099 |
|
12100 |
|
12101 | schema: JSON_SCHEMA
|
12102 | }) ?? {};
|
12103 | parsed = typeof parsed === "object" && !Array.isArray(parsed) ? parsed : {};
|
12104 | const metadata = {};
|
12105 | if (parsed.displayMode) {
|
12106 | metadata.displayMode = parsed.displayMode.toString();
|
12107 | }
|
12108 | if (parsed.title) {
|
12109 | metadata.title = parsed.title.toString();
|
12110 | }
|
12111 | if (parsed.config) {
|
12112 | metadata.config = parsed.config;
|
12113 | }
|
12114 | return {
|
12115 | text: text2.slice(matches[0].length),
|
12116 | metadata
|
12117 | };
|
12118 | }
|
12119 | const cleanupText = (code) => {
|
12120 | return code.replace(/\r\n?/g, "\n").replace(
|
12121 | /<(\w+)([^>]*)>/g,
|
12122 | (match, tag, attributes) => "<" + tag + attributes.replace(/="([^"]*)"/g, "='$1'") + ">"
|
12123 | );
|
12124 | };
|
12125 | const processFrontmatter = (code) => {
|
12126 | const { text: text2, metadata } = extractFrontMatter(code);
|
12127 | const { displayMode, title, config: config2 = {} } = metadata;
|
12128 | if (displayMode) {
|
12129 | if (!config2.gantt) {
|
12130 | config2.gantt = {};
|
12131 | }
|
12132 | config2.gantt.displayMode = displayMode;
|
12133 | }
|
12134 | return { title, config: config2, text: text2 };
|
12135 | };
|
12136 | const processDirectives = (code) => {
|
12137 | const initDirective = utils.detectInit(code) ?? {};
|
12138 | const wrapDirectives = utils.detectDirective(code, "wrap");
|
12139 | if (Array.isArray(wrapDirectives)) {
|
12140 | initDirective.wrap = wrapDirectives.some(({ type: type2 }) => {
|
12141 | });
|
12142 | } else if ((wrapDirectives == null ? void 0 : wrapDirectives.type) === "wrap") {
|
12143 | initDirective.wrap = true;
|
12144 | }
|
12145 | return {
|
12146 | text: removeDirectives(code),
|
12147 | directive: initDirective
|
12148 | };
|
12149 | };
|
12150 | function preprocessDiagram(code) {
|
12151 | const cleanedCode = cleanupText(code);
|
12152 | const frontMatterResult = processFrontmatter(cleanedCode);
|
12153 | const directiveResult = processDirectives(frontMatterResult.text);
|
12154 | const config2 = cleanAndMerge(frontMatterResult.config, directiveResult.directive);
|
12155 | code = cleanupComments(directiveResult.text);
|
12156 | return {
|
12157 | code,
|
12158 | title: frontMatterResult.title,
|
12159 | config: config2
|
12160 | };
|
12161 | }
|
12162 | const MAX_TEXTLENGTH = 5e4;
|
12163 | const MAX_TEXTLENGTH_EXCEEDED_MSG = "graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa";
|
12164 | const SECURITY_LVL_SANDBOX = "sandbox";
|
12165 | const SECURITY_LVL_LOOSE = "loose";
|
12166 | const XMLNS_SVG_STD = "http://www.w3.org/2000/svg";
|
12167 | const XMLNS_XLINK_STD = "http://www.w3.org/1999/xlink";
|
12168 | const XMLNS_XHTML_STD = "http://www.w3.org/1999/xhtml";
|
12169 | const IFRAME_WIDTH = "100%";
|
12170 | const IFRAME_HEIGHT = "100%";
|
12171 | const IFRAME_STYLES = "border:0;margin:0;";
|
12172 | const IFRAME_BODY_STYLE = "margin:0";
|
12173 | const IFRAME_SANDBOX_OPTS = "allow-top-navigation-by-user-activation allow-popups";
|
12174 | const IFRAME_NOT_SUPPORTED_MSG = 'The "iframe" tag is not supported by your browser.';
|
12175 | const DOMPURIFY_TAGS = ["foreignobject"];
|
12176 | const DOMPURIFY_ATTR = ["dominant-baseline"];
|
12177 | function processAndSetConfigs(text2) {
|
12178 | const processed = preprocessDiagram(text2);
|
12179 | reset();
|
12180 | addDirective(processed.config ?? {});
|
12181 | return processed;
|
12182 | }
|
12183 | async function parse$1(text2, parseOptions) {
|
12184 | addDiagrams();
|
12185 | text2 = processAndSetConfigs(text2).code;
|
12186 | try {
|
12187 | await getDiagramFromText(text2);
|
12188 | } catch (error) {
|
12189 | if (parseOptions == null ? void 0 : parseOptions.suppressErrors) {
|
12190 | return false;
|
12191 | }
|
12192 | throw error;
|
12193 | }
|
12194 | return true;
|
12195 | }
|
12196 | const cssImportantStyles = (cssClass, element, cssClasses = []) => {
|
12197 | return `
|
12198 | .${cssClass} ${element} { ${cssClasses.join(" !important; ")} !important; }`;
|
12199 | };
|
12200 | const createCssStyles = (config2, classDefs = {}) => {
|
12201 | var _a;
|
12202 | let cssStyles = "";
|
12203 | if (config2.themeCSS !== void 0) {
|
12204 | cssStyles += `
|
12205 | ${config2.themeCSS}`;
|
12206 | }
|
12207 | if (config2.fontFamily !== void 0) {
|
12208 | cssStyles += `
|
12209 | :root { --mermaid-font-family: ${config2.fontFamily}}`;
|
12210 | }
|
12211 | if (config2.altFontFamily !== void 0) {
|
12212 | cssStyles += `
|
12213 | :root { --mermaid-alt-font-family: ${config2.altFontFamily}}`;
|
12214 | }
|
12215 | if (!isEmpty(classDefs)) {
|
12216 | const htmlLabels = config2.htmlLabels || ((_a = config2.flowchart) == null ? void 0 : _a.htmlLabels);
|
12217 | const cssHtmlElements = ["> *", "span"];
|
12218 | const cssShapeElements = ["rect", "polygon", "ellipse", "circle", "path"];
|
12219 | const cssElements = htmlLabels ? cssHtmlElements : cssShapeElements;
|
12220 | for (const classId in classDefs) {
|
12221 | const styleClassDef = classDefs[classId];
|
12222 | if (!isEmpty(styleClassDef.styles)) {
|
12223 | cssElements.forEach((cssElement) => {
|
12224 | cssStyles += cssImportantStyles(styleClassDef.id, cssElement, styleClassDef.styles);
|
12225 | });
|
12226 | }
|
12227 | if (!isEmpty(styleClassDef.textStyles)) {
|
12228 | cssStyles += cssImportantStyles(styleClassDef.id, "tspan", styleClassDef.textStyles);
|
12229 | }
|
12230 | }
|
12231 | }
|
12232 | return cssStyles;
|
12233 | };
|
12234 | const createUserStyles = (config2, graphType, classDefs, svgId) => {
|
12235 | const userCSSstyles = createCssStyles(config2, classDefs);
|
12236 | const allStyles = getStyles$1(graphType, userCSSstyles, config2.themeVariables);
|
12237 | return serialize(compile(`${svgId}{${allStyles}}`), stringify);
|
12238 | };
|
12239 | const cleanUpSvgCode = (svgCode = "", inSandboxMode, useArrowMarkerUrls) => {
|
12240 | let cleanedUpSvg = svgCode;
|
12241 | if (!useArrowMarkerUrls && !inSandboxMode) {
|
12242 | cleanedUpSvg = cleanedUpSvg.replace(
|
12243 | /marker-end="url\([\d+./:=?A-Za-z-]*?#/g,
|
12244 | 'marker-end="url(#'
|
12245 | );
|
12246 | }
|
12247 | cleanedUpSvg = decodeEntities(cleanedUpSvg);
|
12248 | cleanedUpSvg = cleanedUpSvg.replace(/<br>/g, "<br/>");
|
12249 | return cleanedUpSvg;
|
12250 | };
|
12251 | const putIntoIFrame = (svgCode = "", svgElement) => {
|
12252 | var _a, _b;
|
12253 | 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;
|
12254 | const base64encodedSrc = btoa('<body style="' + IFRAME_BODY_STYLE + '">' + svgCode + "</body>");
|
12255 | return `<iframe style="width:${IFRAME_WIDTH};height:${height};${IFRAME_STYLES}" src="data:text/html;base64,${base64encodedSrc}" sandbox="${IFRAME_SANDBOX_OPTS}">
|
12256 | ${IFRAME_NOT_SUPPORTED_MSG}
|
12257 | </iframe>`;
|
12258 | };
|
12259 | const appendDivSvgG = (parentRoot, id2, enclosingDivId, divStyle, svgXlink) => {
|
12260 | const enclosingDiv = parentRoot.append("div");
|
12261 | enclosingDiv.attr("id", enclosingDivId);
|
12262 | if (divStyle) {
|
12263 | enclosingDiv.attr("style", divStyle);
|
12264 | }
|
12265 | const svgNode2 = enclosingDiv.append("svg").attr("id", id2).attr("width", "100%").attr("xmlns", XMLNS_SVG_STD);
|
12266 | if (svgXlink) {
|
12267 | svgNode2.attr("xmlns:xlink", svgXlink);
|
12268 | }
|
12269 | svgNode2.append("g");
|
12270 | return parentRoot;
|
12271 | };
|
12272 | function sandboxedIframe(parentNode, iFrameId) {
|
12273 | return parentNode.append("iframe").attr("id", iFrameId).attr("style", "width: 100%; height: 100%;").attr("sandbox", "");
|
12274 | }
|
12275 | const removeExistingElements = (doc, id2, divId, iFrameId) => {
|
12276 | var _a, _b, _c;
|
12277 | (_a = doc.getElementById(id2)) == null ? void 0 : _a.remove();
|
12278 | (_b = doc.getElementById(divId)) == null ? void 0 : _b.remove();
|
12279 | (_c = doc.getElementById(iFrameId)) == null ? void 0 : _c.remove();
|
12280 | };
|
12281 | const render$1 = async function(id2, text2, svgContainingElement) {
|
12282 | var _a, _b, _c, _d, _e, _f;
|
12283 | addDiagrams();
|
12284 | const processed = processAndSetConfigs(text2);
|
12285 | text2 = processed.code;
|
12286 | const config2 = getConfig$1();
|
12287 | log$1.debug(config2);
|
12288 | if (text2.length > ((config2 == null ? void 0 : config2.maxTextSize) ?? MAX_TEXTLENGTH)) {
|
12289 | text2 = MAX_TEXTLENGTH_EXCEEDED_MSG;
|
12290 | }
|
12291 | const idSelector = "#" + id2;
|
12292 | const iFrameID = "i" + id2;
|
12293 | const iFrameID_selector = "#" + iFrameID;
|
12294 | const enclosingDivID = "d" + id2;
|
12295 | const enclosingDivID_selector = "#" + enclosingDivID;
|
12296 | let root2 = d3select("body");
|
12297 | const isSandboxed = config2.securityLevel === SECURITY_LVL_SANDBOX;
|
12298 | const isLooseSecurityLevel = config2.securityLevel === SECURITY_LVL_LOOSE;
|
12299 | const fontFamily = config2.fontFamily;
|
12300 | if (svgContainingElement !== void 0) {
|
12301 | if (svgContainingElement) {
|
12302 | svgContainingElement.innerHTML = "";
|
12303 | }
|
12304 | if (isSandboxed) {
|
12305 | const iframe = sandboxedIframe(d3select(svgContainingElement), iFrameID);
|
12306 | root2 = d3select(iframe.nodes()[0].contentDocument.body);
|
12307 | root2.node().style.margin = 0;
|
12308 | } else {
|
12309 | root2 = d3select(svgContainingElement);
|
12310 | }
|
12311 | appendDivSvgG(root2, id2, enclosingDivID, `font-family: ${fontFamily}`, XMLNS_XLINK_STD);
|
12312 | } else {
|
12313 | removeExistingElements(document, id2, enclosingDivID, iFrameID);
|
12314 | if (isSandboxed) {
|
12315 | const iframe = sandboxedIframe(d3select("body"), iFrameID);
|
12316 | root2 = d3select(iframe.nodes()[0].contentDocument.body);
|
12317 | root2.node().style.margin = 0;
|
12318 | } else {
|
12319 | root2 = d3select("body");
|
12320 | }
|
12321 | appendDivSvgG(root2, id2, enclosingDivID);
|
12322 | }
|
12323 | let diag;
|
12324 | let parseEncounteredException;
|
12325 | try {
|
12326 | diag = await getDiagramFromText(text2, { title: processed.title });
|
12327 | } catch (error) {
|
12328 | diag = new Diagram("error");
|
12329 | parseEncounteredException = error;
|
12330 | }
|
12331 | const element = root2.select(enclosingDivID_selector).node();
|
12332 | const diagramType = diag.type;
|
12333 | const svg2 = element.firstChild;
|
12334 | const firstChild = svg2.firstChild;
|
12335 | const diagramClassDefs = (_b = (_a = diag.renderer).getClasses) == null ? void 0 : _b.call(_a, text2, diag);
|
12336 | const rules = createUserStyles(config2, diagramType, diagramClassDefs, idSelector);
|
12337 | const style1 = document.createElement("style");
|
12338 | style1.innerHTML = rules;
|
12339 | svg2.insertBefore(style1, firstChild);
|
12340 | try {
|
12341 | await diag.renderer.draw(text2, id2, version, diag);
|
12342 | } catch (e) {
|
12343 | errorRenderer.draw(text2, id2, version);
|
12344 | throw e;
|
12345 | }
|
12346 | const svgNode2 = root2.select(`${enclosingDivID_selector} svg`);
|
12347 | const a11yTitle = (_d = (_c = diag.db).getAccTitle) == null ? void 0 : _d.call(_c);
|
12348 | const a11yDescr = (_f = (_e = diag.db).getAccDescription) == null ? void 0 : _f.call(_e);
|
12349 | addA11yInfo(diagramType, svgNode2, a11yTitle, a11yDescr);
|
12350 | root2.select(`[id="${id2}"]`).selectAll("foreignobject > *").attr("xmlns", XMLNS_XHTML_STD);
|
12351 | let svgCode = root2.select(enclosingDivID_selector).node().innerHTML;
|
12352 | log$1.debug("config.arrowMarkerAbsolute", config2.arrowMarkerAbsolute);
|
12353 | svgCode = cleanUpSvgCode(svgCode, isSandboxed, evaluate(config2.arrowMarkerAbsolute));
|
12354 | if (isSandboxed) {
|
12355 | const svgEl = root2.select(enclosingDivID_selector + " svg").node();
|
12356 | svgCode = putIntoIFrame(svgCode, svgEl);
|
12357 | } else if (!isLooseSecurityLevel) {
|
12358 | svgCode = purify.sanitize(svgCode, {
|
12359 | ADD_TAGS: DOMPURIFY_TAGS,
|
12360 | ADD_ATTR: DOMPURIFY_ATTR
|
12361 | });
|
12362 | }
|
12363 | attachFunctions();
|
12364 | if (parseEncounteredException) {
|
12365 | throw parseEncounteredException;
|
12366 | }
|
12367 | const tmpElementSelector = isSandboxed ? iFrameID_selector : enclosingDivID_selector;
|
12368 | const node2 = d3select(tmpElementSelector).node();
|
12369 | if (node2 && "remove" in node2) {
|
12370 | node2.remove();
|
12371 | }
|
12372 | return {
|
12373 | svg: svgCode,
|
12374 | bindFunctions: diag.db.bindFunctions
|
12375 | };
|
12376 | };
|
12377 | function initialize$1(options = {}) {
|
12378 | var _a;
|
12379 | if ((options == null ? void 0 : options.fontFamily) && !((_a = options.themeVariables) == null ? void 0 : _a.fontFamily)) {
|
12380 | if (!options.themeVariables) {
|
12381 | options.themeVariables = {};
|
12382 | }
|
12383 | options.themeVariables.fontFamily = options.fontFamily;
|
12384 | }
|
12385 | saveConfigFromInitialize(options);
|
12386 | if ((options == null ? void 0 : options.theme) && options.theme in theme) {
|
12387 | options.themeVariables = theme[options.theme].getThemeVariables(
|
12388 | options.themeVariables
|
12389 | );
|
12390 | } else if (options) {
|
12391 | options.themeVariables = theme.default.getThemeVariables(options.themeVariables);
|
12392 | }
|
12393 | const config2 = typeof options === "object" ? setSiteConfig(options) : getSiteConfig();
|
12394 | setLogLevel$1(config2.logLevel);
|
12395 | addDiagrams();
|
12396 | }
|
12397 | const getDiagramFromText = (text2, metadata = {}) => {
|
12398 | const { code } = preprocessDiagram(text2);
|
12399 | return getDiagramFromText$1(code, metadata);
|
12400 | };
|
12401 | function addA11yInfo(diagramType, svgNode2, a11yTitle, a11yDescr) {
|
12402 | setA11yDiagramInfo(svgNode2, diagramType);
|
12403 | addSVGa11yTitleDescription(svgNode2, a11yTitle, a11yDescr, svgNode2.attr("id"));
|
12404 | }
|
12405 | const mermaidAPI = Object.freeze({
|
12406 | render: render$1,
|
12407 | parse: parse$1,
|
12408 | getDiagramFromText,
|
12409 | initialize: initialize$1,
|
12410 | getConfig: getConfig$1,
|
12411 | setConfig: setConfig$1,
|
12412 | getSiteConfig,
|
12413 | updateSiteConfig,
|
12414 | reset: () => {
|
12415 | reset();
|
12416 | },
|
12417 | globalReset: () => {
|
12418 | reset(defaultConfig$1);
|
12419 | },
|
12420 | defaultConfig: defaultConfig$1
|
12421 | });
|
12422 | setLogLevel$1(getConfig$1().logLevel);
|
12423 | reset(getConfig$1());
|
12424 | const loadRegisteredDiagrams = async () => {
|
12425 | log$1.debug(`Loading registered diagrams`);
|
12426 | const results = await Promise.allSettled(
|
12427 | Object.entries(detectors).map(async ([key, { detector: detector2, loader: loader2 }]) => {
|
12428 | if (loader2) {
|
12429 | try {
|
12430 | getDiagram(key);
|
12431 | } catch (error) {
|
12432 | try {
|
12433 | const { diagram: diagram2, id: id2 } = await loader2();
|
12434 | registerDiagram(id2, diagram2, detector2);
|
12435 | } catch (err) {
|
12436 | log$1.error(`Failed to load external diagram with key ${key}. Removing from detectors.`);
|
12437 | delete detectors[key];
|
12438 | throw err;
|
12439 | }
|
12440 | }
|
12441 | }
|
12442 | })
|
12443 | );
|
12444 | const failed = results.filter((result) => result.status === "rejected");
|
12445 | if (failed.length > 0) {
|
12446 | log$1.error(`Failed to load ${failed.length} external diagrams`);
|
12447 | for (const res of failed) {
|
12448 | log$1.error(res);
|
12449 | }
|
12450 | throw new Error(`Failed to load ${failed.length} external diagrams`);
|
12451 | }
|
12452 | };
|
12453 | const handleError = (error, errors, parseError) => {
|
12454 | log$1.warn(error);
|
12455 | if (isDetailedError(error)) {
|
12456 | if (parseError) {
|
12457 | parseError(error.str, error.hash);
|
12458 | }
|
12459 | errors.push({ ...error, message: error.str, error });
|
12460 | } else {
|
12461 | if (parseError) {
|
12462 | parseError(error);
|
12463 | }
|
12464 | if (error instanceof Error) {
|
12465 | errors.push({
|
12466 | str: error.message,
|
12467 | message: error.message,
|
12468 | hash: error.name,
|
12469 | error
|
12470 | });
|
12471 | }
|
12472 | }
|
12473 | };
|
12474 | const run = async function(options = {
|
12475 | querySelector: ".mermaid"
|
12476 | }) {
|
12477 | try {
|
12478 | await runThrowsErrors(options);
|
12479 | } catch (e) {
|
12480 | if (isDetailedError(e)) {
|
12481 | log$1.error(e.str);
|
12482 | }
|
12483 | if (mermaid.parseError) {
|
12484 | mermaid.parseError(e);
|
12485 | }
|
12486 | if (!options.suppressErrors) {
|
12487 | log$1.error("Use the suppressErrors option to suppress these errors");
|
12488 | throw e;
|
12489 | }
|
12490 | }
|
12491 | };
|
12492 | const runThrowsErrors = async function({ postRenderCallback, querySelector, nodes } = {
|
12493 | querySelector: ".mermaid"
|
12494 | }) {
|
12495 | const conf = mermaidAPI.getConfig();
|
12496 | log$1.debug(`${!postRenderCallback ? "No " : ""}Callback function found`);
|
12497 | let nodesToProcess;
|
12498 | if (nodes) {
|
12499 | nodesToProcess = nodes;
|
12500 | } else if (querySelector) {
|
12501 | nodesToProcess = document.querySelectorAll(querySelector);
|
12502 | } else {
|
12503 | throw new Error("Nodes and querySelector are both undefined");
|
12504 | }
|
12505 | log$1.debug(`Found ${nodesToProcess.length} diagrams`);
|
12506 | if ((conf == null ? void 0 : conf.startOnLoad) !== void 0) {
|
12507 | log$1.debug("Start On Load: " + (conf == null ? void 0 : conf.startOnLoad));
|
12508 | mermaidAPI.updateSiteConfig({ startOnLoad: conf == null ? void 0 : conf.startOnLoad });
|
12509 | }
|
12510 | const idGenerator = new utils.InitIDGenerator(conf.deterministicIds, conf.deterministicIDSeed);
|
12511 | let txt;
|
12512 | const errors = [];
|
12513 | for (const element of Array.from(nodesToProcess)) {
|
12514 | log$1.info("Rendering diagram: " + element.id);
|
12515 | /*! Check if previously processed */
|
12516 | if (element.getAttribute("data-processed")) {
|
12517 | continue;
|
12518 | }
|
12519 | element.setAttribute("data-processed", "true");
|
12520 | const id2 = `mermaid-${idGenerator.next()}`;
|
12521 | txt = element.innerHTML;
|
12522 | txt = dedent(utils.entityDecode(txt)).trim().replace(/<br\s*\/?>/gi, "<br/>");
|
12523 | const init2 = utils.detectInit(txt);
|
12524 | if (init2) {
|
12525 | log$1.debug("Detected early reinit: ", init2);
|
12526 | }
|
12527 | try {
|
12528 | const { svg: svg2, bindFunctions } = await render(id2, txt, element);
|
12529 | element.innerHTML = svg2;
|
12530 | if (postRenderCallback) {
|
12531 | await postRenderCallback(id2);
|
12532 | }
|
12533 | if (bindFunctions) {
|
12534 | bindFunctions(element);
|
12535 | }
|
12536 | } catch (error) {
|
12537 | handleError(error, errors, mermaid.parseError);
|
12538 | }
|
12539 | }
|
12540 | if (errors.length > 0) {
|
12541 | throw errors[0];
|
12542 | }
|
12543 | };
|
12544 | const initialize = function(config2) {
|
12545 | mermaidAPI.initialize(config2);
|
12546 | };
|
12547 | const init = async function(config2, nodes, callback) {
|
12548 | log$1.warn("mermaid.init is deprecated. Please use run instead.");
|
12549 | if (config2) {
|
12550 | initialize(config2);
|
12551 | }
|
12552 | const runOptions = { postRenderCallback: callback, querySelector: ".mermaid" };
|
12553 | if (typeof nodes === "string") {
|
12554 | runOptions.querySelector = nodes;
|
12555 | } else if (nodes) {
|
12556 | if (nodes instanceof HTMLElement) {
|
12557 | runOptions.nodes = [nodes];
|
12558 | } else {
|
12559 | runOptions.nodes = nodes;
|
12560 | }
|
12561 | }
|
12562 | await run(runOptions);
|
12563 | };
|
12564 | const registerExternalDiagrams = async (diagrams2, {
|
12565 | lazyLoad = true
|
12566 | } = {}) => {
|
12567 | registerLazyLoadedDiagrams(...diagrams2);
|
12568 | if (lazyLoad === false) {
|
12569 | await loadRegisteredDiagrams();
|
12570 | }
|
12571 | };
|
12572 | const contentLoaded = function() {
|
12573 | if (mermaid.startOnLoad) {
|
12574 | const { startOnLoad } = mermaidAPI.getConfig();
|
12575 | if (startOnLoad) {
|
12576 | mermaid.run().catch((err) => log$1.error("Mermaid failed to initialize", err));
|
12577 | }
|
12578 | }
|
12579 | };
|
12580 | if (typeof document !== "undefined") {
|
12581 | /*!
|
12582 | * Wait for document loaded before starting the execution
|
12583 | */
|
12584 | window.addEventListener("load", contentLoaded, false);
|
12585 | }
|
12586 | const setParseErrorHandler = function(parseErrorHandler) {
|
12587 | mermaid.parseError = parseErrorHandler;
|
12588 | };
|
12589 | const executionQueue = [];
|
12590 | let executionQueueRunning = false;
|
12591 | const executeQueue = async () => {
|
12592 | if (executionQueueRunning) {
|
12593 | return;
|
12594 | }
|
12595 | executionQueueRunning = true;
|
12596 | while (executionQueue.length > 0) {
|
12597 | const f = executionQueue.shift();
|
12598 | if (f) {
|
12599 | try {
|
12600 | await f();
|
12601 | } catch (e) {
|
12602 | log$1.error("Error executing queue", e);
|
12603 | }
|
12604 | }
|
12605 | }
|
12606 | executionQueueRunning = false;
|
12607 | };
|
12608 | const parse = async (text2, parseOptions) => {
|
12609 | return new Promise((resolve, reject) => {
|
12610 | const performCall = () => new Promise((res, rej) => {
|
12611 | mermaidAPI.parse(text2, parseOptions).then(
|
12612 | (r) => {
|
12613 | res(r);
|
12614 | resolve(r);
|
12615 | },
|
12616 | (e) => {
|
12617 | var _a;
|
12618 | log$1.error("Error parsing", e);
|
12619 | (_a = mermaid.parseError) == null ? void 0 : _a.call(mermaid, e);
|
12620 | rej(e);
|
12621 | reject(e);
|
12622 | }
|
12623 | );
|
12624 | });
|
12625 | executionQueue.push(performCall);
|
12626 | executeQueue().catch(reject);
|
12627 | });
|
12628 | };
|
12629 | const render = (id2, text2, container) => {
|
12630 | return new Promise((resolve, reject) => {
|
12631 | const performCall = () => new Promise((res, rej) => {
|
12632 | mermaidAPI.render(id2, text2, container).then(
|
12633 | (r) => {
|
12634 | res(r);
|
12635 | resolve(r);
|
12636 | },
|
12637 | (e) => {
|
12638 | var _a;
|
12639 | log$1.error("Error parsing", e);
|
12640 | (_a = mermaid.parseError) == null ? void 0 : _a.call(mermaid, e);
|
12641 | rej(e);
|
12642 | reject(e);
|
12643 | }
|
12644 | );
|
12645 | });
|
12646 | executionQueue.push(performCall);
|
12647 | executeQueue().catch(reject);
|
12648 | });
|
12649 | };
|
12650 | const mermaid = {
|
12651 | startOnLoad: true,
|
12652 | mermaidAPI,
|
12653 | parse,
|
12654 | render,
|
12655 | init,
|
12656 | run,
|
12657 | registerExternalDiagrams,
|
12658 | initialize,
|
12659 | parseError: void 0,
|
12660 | contentLoaded,
|
12661 | setParseErrorHandler,
|
12662 | detectType
|
12663 | };
|
12664 | export {
|
12665 | constant$1 as $,
|
12666 | utils as A,
|
12667 | rgba$1 as B,
|
12668 | setDiagramTitle as C,
|
12669 | getDiagramTitle as D,
|
12670 | clear as E,
|
12671 | curveBasis as F,
|
12672 | parseGenericTypes as G,
|
12673 | random as H,
|
12674 | setupGraphViewbox as I,
|
12675 | define as J,
|
12676 | extend$1 as K,
|
12677 | Color$2 as L,
|
12678 | rgbConvert as M,
|
12679 | nogamma as N,
|
12680 | hue as O,
|
12681 | commonjsGlobal as P,
|
12682 | getDefaultExportFromCjs as Q,
|
12683 | Rgb as R,
|
12684 | Selection$1 as S,
|
12685 | dayjs as T,
|
12686 | selectSvgElement as U,
|
12687 | tau as V,
|
12688 | defaultConfig$2 as W,
|
12689 | cleanAndMerge as X,
|
12690 | parseFontSize as Y,
|
12691 | getThemeVariables$2 as Z,
|
12692 | getConfig$1 as _,
|
12693 | getAccDescription as a,
|
12694 | Stack as a$,
|
12695 | interpolateNumber as a0,
|
12696 | color as a1,
|
12697 | interpolateRgb as a2,
|
12698 | interpolateString as a3,
|
12699 | hasKatex as a4,
|
12700 | ZERO_WIDTH_SPACE as a5,
|
12701 | calculateMathMLDimensions as a6,
|
12702 | generateId as a7,
|
12703 | isObject$1 as a8,
|
12704 | setToString$1 as a9,
|
12705 | epsilon as aA,
|
12706 | sqrt as aB,
|
12707 | min as aC,
|
12708 | abs$1 as aD,
|
12709 | atan2 as aE,
|
12710 | asin as aF,
|
12711 | acos as aG,
|
12712 | max as aH,
|
12713 | _ as aI,
|
12714 | Color$1 as aJ,
|
12715 | isObjectLike as aK,
|
12716 | baseGetTag as aL,
|
12717 | Symbol$2 as aM,
|
12718 | arrayLikeKeys as aN,
|
12719 | baseKeys as aO,
|
12720 | memoize as aP,
|
12721 | isArguments$1 as aQ,
|
12722 | copyObject as aR,
|
12723 | getPrototype$1 as aS,
|
12724 | cloneArrayBuffer as aT,
|
12725 | cloneTypedArray as aU,
|
12726 | getTag$1 as aV,
|
12727 | nodeUtil$1 as aW,
|
12728 | copyArray as aX,
|
12729 | isBuffer$1 as aY,
|
12730 | cloneBuffer as aZ,
|
12731 | initCloneObject as a_,
|
12732 | overRest as aa,
|
12733 | root$1 as ab,
|
12734 | baseRest as ac,
|
12735 | isIterateeCall as ad,
|
12736 | keysIn as ae,
|
12737 | eq as af,
|
12738 | isArrayLike as ag,
|
12739 | isArray$1 as ah,
|
12740 | baseFor$1 as ai,
|
12741 | baseAssignValue as aj,
|
12742 | identity as ak,
|
12743 | isIndex as al,
|
12744 | assignValue as am,
|
12745 | baseUnary as an,
|
12746 | constant as ao,
|
12747 | merge$2 as ap,
|
12748 | lineBreakRegex as aq,
|
12749 | defaultConfig as ar,
|
12750 | commonDb as as,
|
12751 | isDark$1 as at,
|
12752 | lighten$1 as au,
|
12753 | darken$1 as av,
|
12754 | pi as aw,
|
12755 | cos as ax,
|
12756 | sin as ay,
|
12757 | halfPi as az,
|
12758 | setAccDescription as b,
|
12759 | MapCache as b0,
|
12760 | Uint8Array$2 as b1,
|
12761 | isTypedArray$1 as b2,
|
12762 | isLength as b3,
|
12763 | Set$2 as b4,
|
12764 | isArrayLikeObject as b5,
|
12765 | isEmpty as b6,
|
12766 | decodeEntities as b7,
|
12767 | dedent as b8,
|
12768 | mermaid as b9,
|
12769 | getConfig as c,
|
12770 | sanitizeText$2 as d,
|
12771 | dist as e,
|
12772 | common$1 as f,
|
12773 | getAccTitle as g,
|
12774 | assignWithDepth$1 as h,
|
12775 | calculateTextWidth as i,
|
12776 | d3select as j,
|
12777 | configureSvgSize as k,
|
12778 | log$1 as l,
|
12779 | calculateTextHeight as m,
|
12780 | curveLinear as n,
|
12781 | getStylesFromArray as o,
|
12782 | evaluate as p,
|
12783 | interpolateToCurve as q,
|
12784 | renderKatex as r,
|
12785 | setAccTitle as s,
|
12786 | setupGraphViewbox$1 as t,
|
12787 | setConfig as u,
|
12788 | root$2 as v,
|
12789 | wrapLabel as w,
|
12790 | array as x,
|
12791 | isPlainObject as y,
|
12792 | isFunction as z
|
12793 | };
|