UNPKG

26.3 kBJavaScriptView Raw
1import { S as it, c as U, s as gt, g as dt, z as mt, A as _t, a as vt, b as kt, m as bt, f as xt, l as Y, B as St, j as nt, k as wt, T as At } from "./mermaid-9357f3d0.js";
2import { i as Et } from "./init-f9637058.js";
3import { a as Dt } from "./array-2ff2c7a6.js";
4import { c as z } from "./constant-2fe7eae5.js";
5import { d as lt } from "./arc-b5db4c05.js";
6class ct extends Map {
7 constructor(s, c = It) {
8 if (super(), Object.defineProperties(this, { _intern: { value: /* @__PURE__ */ new Map() }, _key: { value: c } }), s != null)
9 for (const [o, y] of s)
10 this.set(o, y);
11 }
12 get(s) {
13 return super.get(ot(this, s));
14 }
15 has(s) {
16 return super.has(ot(this, s));
17 }
18 set(s, c) {
19 return super.set(Tt(this, s), c);
20 }
21 delete(s) {
22 return super.delete($t(this, s));
23 }
24}
25function ot({ _intern: t, _key: s }, c) {
26 const o = s(c);
27 return t.has(o) ? t.get(o) : c;
28}
29function Tt({ _intern: t, _key: s }, c) {
30 const o = s(c);
31 return t.has(o) ? t.get(o) : (t.set(o, c), c);
32}
33function $t({ _intern: t, _key: s }, c) {
34 const o = s(c);
35 return t.has(o) && (c = t.get(o), t.delete(o)), c;
36}
37function It(t) {
38 return t !== null && typeof t == "object" ? t.valueOf() : t;
39}
40const ht = Symbol("implicit");
41function ut() {
42 var t = new ct(), s = [], c = [], o = ht;
43 function y(u) {
44 let h = t.get(u);
45 if (h === void 0) {
46 if (o !== ht)
47 return o;
48 t.set(u, h = s.push(u) - 1);
49 }
50 return c[h % c.length];
51 }
52 return y.domain = function(u) {
53 if (!arguments.length)
54 return s.slice();
55 s = [], t = new ct();
56 for (const h of u)
57 t.has(h) || t.set(h, s.push(h) - 1);
58 return y;
59 }, y.range = function(u) {
60 return arguments.length ? (c = Array.from(u), y) : c.slice();
61 }, y.unknown = function(u) {
62 return arguments.length ? (o = u, y) : o;
63 }, y.copy = function() {
64 return ut(s, c).unknown(o);
65 }, Et.apply(y, arguments), y;
66}
67function Vt(t, s) {
68 return s < t ? -1 : s > t ? 1 : s >= t ? 0 : NaN;
69}
70function Pt(t) {
71 return t;
72}
73function Ot() {
74 var t = Pt, s = Vt, c = null, o = z(0), y = z(it), u = z(0);
75 function h(l) {
76 var g, m = (l = Dt(l)).length, D, C, x = 0, $ = new Array(m), w = new Array(m), A = +o.apply(this, arguments), N = Math.min(it, Math.max(-it, y.apply(this, arguments) - A)), W, I = Math.min(Math.abs(N) / m, u.apply(this, arguments)), V = I * (N < 0 ? -1 : 1), v;
77 for (g = 0; g < m; ++g)
78 (v = w[$[g] = g] = +t(l[g], g, l)) > 0 && (x += v);
79 for (s != null ? $.sort(function(E, k) {
80 return s(w[E], w[k]);
81 }) : c != null && $.sort(function(E, k) {
82 return c(l[E], l[k]);
83 }), g = 0, C = x ? (N - m * V) / x : 0; g < m; ++g, A = W)
84 D = $[g], v = w[D], W = A + (v > 0 ? v * C : 0) + V, w[D] = {
85 data: l[D],
86 index: g,
87 value: v,
88 startAngle: A,
89 endAngle: W,
90 padAngle: I
91 };
92 return w;
93 }
94 return h.value = function(l) {
95 return arguments.length ? (t = typeof l == "function" ? l : z(+l), h) : t;
96 }, h.sortValues = function(l) {
97 return arguments.length ? (s = l, c = null, h) : s;
98 }, h.sort = function(l) {
99 return arguments.length ? (c = l, s = null, h) : c;
100 }, h.startAngle = function(l) {
101 return arguments.length ? (o = typeof l == "function" ? l : z(+l), h) : o;
102 }, h.endAngle = function(l) {
103 return arguments.length ? (y = typeof l == "function" ? l : z(+l), h) : y;
104 }, h.padAngle = function(l) {
105 return arguments.length ? (u = typeof l == "function" ? l : z(+l), h) : u;
106 }, h;
107}
108var rt = function() {
109 var t = function(k, e, i, a) {
110 for (i = i || {}, a = k.length; a--; i[k[a]] = e)
111 ;
112 return i;
113 }, s = [1, 4], c = [1, 5], o = [1, 6], y = [1, 7], u = [1, 9], h = [1, 11, 13, 15, 17, 19, 20, 26, 27, 28, 29], l = [2, 5], g = [1, 6, 11, 13, 15, 17, 19, 20, 26, 27, 28, 29], m = [26, 27, 28], D = [2, 8], C = [1, 18], x = [1, 19], $ = [1, 20], w = [1, 21], A = [1, 22], N = [1, 23], W = [1, 28], I = [6, 26, 27, 28, 29], V = {
114 trace: function() {
115 },
116 yy: {},
117 symbols_: { error: 2, start: 3, eol: 4, directive: 5, PIE: 6, document: 7, showData: 8, line: 9, statement: 10, txt: 11, value: 12, title: 13, title_value: 14, acc_title: 15, acc_title_value: 16, acc_descr: 17, acc_descr_value: 18, acc_descr_multiline_value: 19, section: 20, openDirective: 21, typeDirective: 22, closeDirective: 23, ":": 24, argDirective: 25, NEWLINE: 26, ";": 27, EOF: 28, open_directive: 29, type_directive: 30, arg_directive: 31, close_directive: 32, $accept: 0, $end: 1 },
118 terminals_: { 2: "error", 6: "PIE", 8: "showData", 11: "txt", 12: "value", 13: "title", 14: "title_value", 15: "acc_title", 16: "acc_title_value", 17: "acc_descr", 18: "acc_descr_value", 19: "acc_descr_multiline_value", 20: "section", 24: ":", 26: "NEWLINE", 27: ";", 28: "EOF", 29: "open_directive", 30: "type_directive", 31: "arg_directive", 32: "close_directive" },
119 productions_: [0, [3, 2], [3, 2], [3, 2], [3, 3], [7, 0], [7, 2], [9, 2], [10, 0], [10, 2], [10, 2], [10, 2], [10, 2], [10, 1], [10, 1], [10, 1], [5, 3], [5, 5], [4, 1], [4, 1], [4, 1], [21, 1], [22, 1], [25, 1], [23, 1]],
120 performAction: function(e, i, a, n, f, r, p) {
121 var d = r.length - 1;
122 switch (f) {
123 case 4:
124 n.setShowData(!0);
125 break;
126 case 7:
127 this.$ = r[d - 1];
128 break;
129 case 9:
130 n.addSection(r[d - 1], n.cleanupValue(r[d]));
131 break;
132 case 10:
133 this.$ = r[d].trim(), n.setDiagramTitle(this.$);
134 break;
135 case 11:
136 this.$ = r[d].trim(), n.setAccTitle(this.$);
137 break;
138 case 12:
139 case 13:
140 this.$ = r[d].trim(), n.setAccDescription(this.$);
141 break;
142 case 14:
143 n.addSection(r[d].substr(8)), this.$ = r[d].substr(8);
144 break;
145 case 21:
146 n.parseDirective("%%{", "open_directive");
147 break;
148 case 22:
149 n.parseDirective(r[d], "type_directive");
150 break;
151 case 23:
152 r[d] = r[d].trim().replace(/'/g, '"'), n.parseDirective(r[d], "arg_directive");
153 break;
154 case 24:
155 n.parseDirective("}%%", "close_directive", "pie");
156 break;
157 }
158 },
159 table: [{ 3: 1, 4: 2, 5: 3, 6: s, 21: 8, 26: c, 27: o, 28: y, 29: u }, { 1: [3] }, { 3: 10, 4: 2, 5: 3, 6: s, 21: 8, 26: c, 27: o, 28: y, 29: u }, { 3: 11, 4: 2, 5: 3, 6: s, 21: 8, 26: c, 27: o, 28: y, 29: u }, t(h, l, { 7: 12, 8: [1, 13] }), t(g, [2, 18]), t(g, [2, 19]), t(g, [2, 20]), { 22: 14, 30: [1, 15] }, { 30: [2, 21] }, { 1: [2, 1] }, { 1: [2, 2] }, t(m, D, { 21: 8, 9: 16, 10: 17, 5: 24, 1: [2, 3], 11: C, 13: x, 15: $, 17: w, 19: A, 20: N, 29: u }), t(h, l, { 7: 25 }), { 23: 26, 24: [1, 27], 32: W }, t([24, 32], [2, 22]), t(h, [2, 6]), { 4: 29, 26: c, 27: o, 28: y }, { 12: [1, 30] }, { 14: [1, 31] }, { 16: [1, 32] }, { 18: [1, 33] }, t(m, [2, 13]), t(m, [2, 14]), t(m, [2, 15]), t(m, D, { 21: 8, 9: 16, 10: 17, 5: 24, 1: [2, 4], 11: C, 13: x, 15: $, 17: w, 19: A, 20: N, 29: u }), t(I, [2, 16]), { 25: 34, 31: [1, 35] }, t(I, [2, 24]), t(h, [2, 7]), t(m, [2, 9]), t(m, [2, 10]), t(m, [2, 11]), t(m, [2, 12]), { 23: 36, 32: W }, { 32: [2, 23] }, t(I, [2, 17])],
160 defaultActions: { 9: [2, 21], 10: [2, 1], 11: [2, 2], 35: [2, 23] },
161 parseError: function(e, i) {
162 if (i.recoverable)
163 this.trace(e);
164 else {
165 var a = new Error(e);
166 throw a.hash = i, a;
167 }
168 },
169 parse: function(e) {
170 var i = this, a = [0], n = [], f = [null], r = [], p = this.table, d = "", F = 0, q = 0, Q = 2, G = 1, ft = r.slice.call(arguments, 1), _ = Object.create(this.lexer), M = { yy: {} };
171 for (var X in this.yy)
172 Object.prototype.hasOwnProperty.call(this.yy, X) && (M.yy[X] = this.yy[X]);
173 _.setInput(e, M.yy), M.yy.lexer = _, M.yy.parser = this, typeof _.yylloc > "u" && (_.yylloc = {});
174 var Z = _.yylloc;
175 r.push(Z);
176 var pt = _.options && _.options.ranges;
177 typeof M.yy.parseError == "function" ? this.parseError = M.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
178 function yt() {
179 var O;
180 return O = n.pop() || _.lex() || G, typeof O != "number" && (O instanceof Array && (n = O, O = n.pop()), O = i.symbols_[O] || O), O;
181 }
182 for (var b, j, S, tt, R = {}, H, P, at, J; ; ) {
183 if (j = a[a.length - 1], this.defaultActions[j] ? S = this.defaultActions[j] : ((b === null || typeof b > "u") && (b = yt()), S = p[j] && p[j][b]), typeof S > "u" || !S.length || !S[0]) {
184 var et = "";
185 J = [];
186 for (H in p[j])
187 this.terminals_[H] && H > Q && J.push("'" + this.terminals_[H] + "'");
188 _.showPosition ? et = "Parse error on line " + (F + 1) + `:
189` + _.showPosition() + `
190Expecting ` + J.join(", ") + ", got '" + (this.terminals_[b] || b) + "'" : et = "Parse error on line " + (F + 1) + ": Unexpected " + (b == G ? "end of input" : "'" + (this.terminals_[b] || b) + "'"), this.parseError(et, {
191 text: _.match,
192 token: this.terminals_[b] || b,
193 line: _.yylineno,
194 loc: Z,
195 expected: J
196 });
197 }
198 if (S[0] instanceof Array && S.length > 1)
199 throw new Error("Parse Error: multiple actions possible at state: " + j + ", token: " + b);
200 switch (S[0]) {
201 case 1:
202 a.push(b), f.push(_.yytext), r.push(_.yylloc), a.push(S[1]), b = null, q = _.yyleng, d = _.yytext, F = _.yylineno, Z = _.yylloc;
203 break;
204 case 2:
205 if (P = this.productions_[S[1]][1], R.$ = f[f.length - P], R._$ = {
206 first_line: r[r.length - (P || 1)].first_line,
207 last_line: r[r.length - 1].last_line,
208 first_column: r[r.length - (P || 1)].first_column,
209 last_column: r[r.length - 1].last_column
210 }, pt && (R._$.range = [
211 r[r.length - (P || 1)].range[0],
212 r[r.length - 1].range[1]
213 ]), tt = this.performAction.apply(R, [
214 d,
215 q,
216 F,
217 M.yy,
218 S[1],
219 f,
220 r
221 ].concat(ft)), typeof tt < "u")
222 return tt;
223 P && (a = a.slice(0, -1 * P * 2), f = f.slice(0, -1 * P), r = r.slice(0, -1 * P)), a.push(this.productions_[S[1]][0]), f.push(R.$), r.push(R._$), at = p[a[a.length - 2]][a[a.length - 1]], a.push(at);
224 break;
225 case 3:
226 return !0;
227 }
228 }
229 return !0;
230 }
231 }, v = function() {
232 var k = {
233 EOF: 1,
234 parseError: function(i, a) {
235 if (this.yy.parser)
236 this.yy.parser.parseError(i, a);
237 else
238 throw new Error(i);
239 },
240 // resets the lexer, sets new input
241 setInput: function(e, i) {
242 return this.yy = i || this.yy || {}, this._input = e, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
243 first_line: 1,
244 first_column: 0,
245 last_line: 1,
246 last_column: 0
247 }, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
248 },
249 // consumes and returns one char from the input
250 input: function() {
251 var e = this._input[0];
252 this.yytext += e, this.yyleng++, this.offset++, this.match += e, this.matched += e;
253 var i = e.match(/(?:\r\n?|\n).*/g);
254 return i ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), e;
255 },
256 // unshifts one char (or a string) into the input
257 unput: function(e) {
258 var i = e.length, a = e.split(/(?:\r\n?|\n)/g);
259 this._input = e + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - i), this.offset -= i;
260 var n = this.match.split(/(?:\r\n?|\n)/g);
261 this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), a.length - 1 && (this.yylineno -= a.length - 1);
262 var f = this.yylloc.range;
263 return this.yylloc = {
264 first_line: this.yylloc.first_line,
265 last_line: this.yylineno + 1,
266 first_column: this.yylloc.first_column,
267 last_column: a ? (a.length === n.length ? this.yylloc.first_column : 0) + n[n.length - a.length].length - a[0].length : this.yylloc.first_column - i
268 }, this.options.ranges && (this.yylloc.range = [f[0], f[0] + this.yyleng - i]), this.yyleng = this.yytext.length, this;
269 },
270 // When called from action, caches matched text and appends it on next action
271 more: function() {
272 return this._more = !0, this;
273 },
274 // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
275 reject: function() {
276 if (this.options.backtrack_lexer)
277 this._backtrack = !0;
278 else
279 return this.parseError("Lexical error on line " + (this.yylineno + 1) + `. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
280` + this.showPosition(), {
281 text: "",
282 token: null,
283 line: this.yylineno
284 });
285 return this;
286 },
287 // retain first n characters of the match
288 less: function(e) {
289 this.unput(this.match.slice(e));
290 },
291 // displays already matched input, i.e. for error messages
292 pastInput: function() {
293 var e = this.matched.substr(0, this.matched.length - this.match.length);
294 return (e.length > 20 ? "..." : "") + e.substr(-20).replace(/\n/g, "");
295 },
296 // displays upcoming input, i.e. for error messages
297 upcomingInput: function() {
298 var e = this.match;
299 return e.length < 20 && (e += this._input.substr(0, 20 - e.length)), (e.substr(0, 20) + (e.length > 20 ? "..." : "")).replace(/\n/g, "");
300 },
301 // displays the character position where the lexing error occurred, i.e. for error messages
302 showPosition: function() {
303 var e = this.pastInput(), i = new Array(e.length + 1).join("-");
304 return e + this.upcomingInput() + `
305` + i + "^";
306 },
307 // test the lexed token: return FALSE when not a match, otherwise return token
308 test_match: function(e, i) {
309 var a, n, f;
310 if (this.options.backtrack_lexer && (f = {
311 yylineno: this.yylineno,
312 yylloc: {
313 first_line: this.yylloc.first_line,
314 last_line: this.last_line,
315 first_column: this.yylloc.first_column,
316 last_column: this.yylloc.last_column
317 },
318 yytext: this.yytext,
319 match: this.match,
320 matches: this.matches,
321 matched: this.matched,
322 yyleng: this.yyleng,
323 offset: this.offset,
324 _more: this._more,
325 _input: this._input,
326 yy: this.yy,
327 conditionStack: this.conditionStack.slice(0),
328 done: this.done
329 }, this.options.ranges && (f.yylloc.range = this.yylloc.range.slice(0))), n = e[0].match(/(?:\r\n?|\n).*/g), n && (this.yylineno += n.length), this.yylloc = {
330 first_line: this.yylloc.last_line,
331 last_line: this.yylineno + 1,
332 first_column: this.yylloc.last_column,
333 last_column: n ? n[n.length - 1].length - n[n.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + e[0].length
334 }, this.yytext += e[0], this.match += e[0], this.matches = e, this.yyleng = this.yytext.length, this.options.ranges && (this.yylloc.range = [this.offset, this.offset += this.yyleng]), this._more = !1, this._backtrack = !1, this._input = this._input.slice(e[0].length), this.matched += e[0], a = this.performAction.call(this, this.yy, this, i, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), a)
335 return a;
336 if (this._backtrack) {
337 for (var r in f)
338 this[r] = f[r];
339 return !1;
340 }
341 return !1;
342 },
343 // return next match in input
344 next: function() {
345 if (this.done)
346 return this.EOF;
347 this._input || (this.done = !0);
348 var e, i, a, n;
349 this._more || (this.yytext = "", this.match = "");
350 for (var f = this._currentRules(), r = 0; r < f.length; r++)
351 if (a = this._input.match(this.rules[f[r]]), a && (!i || a[0].length > i[0].length)) {
352 if (i = a, n = r, this.options.backtrack_lexer) {
353 if (e = this.test_match(a, f[r]), e !== !1)
354 return e;
355 if (this._backtrack) {
356 i = !1;
357 continue;
358 } else
359 return !1;
360 } else if (!this.options.flex)
361 break;
362 }
363 return i ? (e = this.test_match(i, f[n]), e !== !1 ? e : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
364` + this.showPosition(), {
365 text: "",
366 token: null,
367 line: this.yylineno
368 });
369 },
370 // return next match that has a token
371 lex: function() {
372 var i = this.next();
373 return i || this.lex();
374 },
375 // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
376 begin: function(i) {
377 this.conditionStack.push(i);
378 },
379 // pop the previously active lexer condition state off the condition stack
380 popState: function() {
381 var i = this.conditionStack.length - 1;
382 return i > 0 ? this.conditionStack.pop() : this.conditionStack[0];
383 },
384 // produce the lexer rule set which is active for the currently active lexer condition state
385 _currentRules: function() {
386 return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
387 },
388 // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
389 topState: function(i) {
390 return i = this.conditionStack.length - 1 - Math.abs(i || 0), i >= 0 ? this.conditionStack[i] : "INITIAL";
391 },
392 // alias for begin(condition)
393 pushState: function(i) {
394 this.begin(i);
395 },
396 // return the number of states currently on the stack
397 stateStackSize: function() {
398 return this.conditionStack.length;
399 },
400 options: { "case-insensitive": !0 },
401 performAction: function(i, a, n, f) {
402 switch (n) {
403 case 0:
404 return this.begin("open_directive"), 29;
405 case 1:
406 return this.begin("type_directive"), 30;
407 case 2:
408 return this.popState(), this.begin("arg_directive"), 24;
409 case 3:
410 return this.popState(), this.popState(), 32;
411 case 4:
412 return 31;
413 case 5:
414 break;
415 case 6:
416 break;
417 case 7:
418 return 26;
419 case 8:
420 break;
421 case 9:
422 break;
423 case 10:
424 return this.begin("title"), 13;
425 case 11:
426 return this.popState(), "title_value";
427 case 12:
428 return this.begin("acc_title"), 15;
429 case 13:
430 return this.popState(), "acc_title_value";
431 case 14:
432 return this.begin("acc_descr"), 17;
433 case 15:
434 return this.popState(), "acc_descr_value";
435 case 16:
436 this.begin("acc_descr_multiline");
437 break;
438 case 17:
439 this.popState();
440 break;
441 case 18:
442 return "acc_descr_multiline_value";
443 case 19:
444 this.begin("string");
445 break;
446 case 20:
447 this.popState();
448 break;
449 case 21:
450 return "txt";
451 case 22:
452 return 6;
453 case 23:
454 return 8;
455 case 24:
456 return "value";
457 case 25:
458 return 28;
459 }
460 },
461 rules: [/^(?:%%\{)/i, /^(?:((?:(?!\}%%)[^:.])*))/i, /^(?::)/i, /^(?:\}%%)/i, /^(?:((?:(?!\}%%).|\n)*))/i, /^(?:%%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:[\n\r]+)/i, /^(?:%%[^\n]*)/i, /^(?:[\s]+)/i, /^(?:title\b)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:["])/i, /^(?:["])/i, /^(?:[^"]*)/i, /^(?:pie\b)/i, /^(?:showData\b)/i, /^(?::[\s]*[\d]+(?:\.[\d]+)?)/i, /^(?:$)/i],
462 conditions: { acc_descr_multiline: { rules: [17, 18], inclusive: !1 }, acc_descr: { rules: [15], inclusive: !1 }, acc_title: { rules: [13], inclusive: !1 }, close_directive: { rules: [], inclusive: !1 }, arg_directive: { rules: [3, 4], inclusive: !1 }, type_directive: { rules: [2, 3], inclusive: !1 }, open_directive: { rules: [1], inclusive: !1 }, title: { rules: [11], inclusive: !1 }, string: { rules: [20, 21], inclusive: !1 }, INITIAL: { rules: [0, 5, 6, 7, 8, 9, 10, 12, 14, 16, 19, 22, 23, 24, 25], inclusive: !0 } }
463 };
464 return k;
465 }();
466 V.lexer = v;
467 function E() {
468 this.yy = {};
469 }
470 return E.prototype = V, V.Parser = E, new E();
471}();
472rt.parser = rt;
473const Lt = rt;
474let K = {}, st = !1;
475const Nt = function(t, s, c) {
476 bt.parseDirective(this, t, s, c);
477}, Wt = function(t, s) {
478 t = xt.sanitizeText(t, U()), K[t] === void 0 && (K[t] = s, Y.debug("Added new section :", t));
479}, Ct = () => K, Ft = function(t) {
480 st = t;
481}, Mt = function() {
482 return st;
483}, jt = function(t) {
484 return t.substring(0, 1) === ":" && (t = t.substring(1).trim()), Number(t.trim());
485}, zt = function() {
486 K = {}, st = !1, St();
487}, Rt = {
488 parseDirective: Nt,
489 getConfig: () => U().pie,
490 addSection: Wt,
491 getSections: Ct,
492 cleanupValue: jt,
493 clear: zt,
494 setAccTitle: gt,
495 getAccTitle: dt,
496 setDiagramTitle: mt,
497 getDiagramTitle: _t,
498 setShowData: Ft,
499 getShowData: Mt,
500 getAccDescription: vt,
501 setAccDescription: kt
502}, Bt = (t) => `
503 .pieCircle{
504 stroke: ${t.pieStrokeColor};
505 stroke-width : ${t.pieStrokeWidth};
506 opacity : ${t.pieOpacity};
507 }
508 .pieOuterCircle{
509 stroke: ${t.pieOuterStrokeColor};
510 stroke-width: ${t.pieOuterStrokeWidth};
511 fill: none;
512 }
513 .pieTitleText {
514 text-anchor: middle;
515 font-size: ${t.pieTitleTextSize};
516 fill: ${t.pieTitleTextColor};
517 font-family: ${t.fontFamily};
518 }
519 .slice {
520 font-family: ${t.fontFamily};
521 fill: ${t.pieSectionTextColor};
522 font-size:${t.pieSectionTextSize};
523 // fill: white;
524 }
525 .legend text {
526 fill: ${t.pieLegendTextColor};
527 font-family: ${t.fontFamily};
528 font-size: ${t.pieLegendTextSize};
529 }
530`, Yt = Bt;
531let T = U(), L;
532const B = 450, Ut = (t, s, c, o) => {
533 var V;
534 try {
535 T = U(), Y.debug(`Rendering info diagram
536` + t);
537 const v = U().securityLevel;
538 let E;
539 v === "sandbox" && (E = nt("#i" + s));
540 const k = v === "sandbox" ? nt(E.nodes()[0].contentDocument.body) : nt("body"), e = v === "sandbox" ? E.nodes()[0].contentDocument : document;
541 o.db.clear(), o.parser.parse(t), Y.debug("Parsed info diagram");
542 const i = e.getElementById(s);
543 L = i.parentElement.offsetWidth, L === void 0 && (L = 1200), T.useWidth !== void 0 && (L = T.useWidth), T.pie.useWidth !== void 0 && (L = T.pie.useWidth);
544 const a = k.select("#" + s);
545 wt(a, B, L, T.pie.useMaxWidth), i.setAttribute("viewBox", "0 0 " + L + " " + B);
546 var y = 40, u = 18, h = 4, l = Math.min(L, B) / 2 - y, g = a.append("g").attr("transform", "translate(" + L / 2 + "," + B / 2 + ")"), m = o.db.getSections(), D = 0;
547 Object.keys(m).forEach(function(p) {
548 D += m[p];
549 });
550 const n = T.themeVariables;
551 var C = [
552 n.pie1,
553 n.pie2,
554 n.pie3,
555 n.pie4,
556 n.pie5,
557 n.pie6,
558 n.pie7,
559 n.pie8,
560 n.pie9,
561 n.pie10,
562 n.pie11,
563 n.pie12
564 ];
565 const f = ((V = T.pie) == null ? void 0 : V.textPosition) ?? 0.75;
566 let [r] = At(n.pieOuterStrokeWidth);
567 r ?? (r = 2);
568 var x = ut().range(C), $ = Object.entries(m).map(function(p, d) {
569 return {
570 order: d,
571 name: p[0],
572 value: p[1]
573 };
574 }), w = Ot().value(function(p) {
575 return p.value;
576 }).sort(function(p, d) {
577 return p.order - d.order;
578 }), A = w($), N = lt().innerRadius(0).outerRadius(l), W = lt().innerRadius(l * f).outerRadius(l * f);
579 g.append("circle").attr("cx", 0).attr("cy", 0).attr("r", l + r / 2).attr("class", "pieOuterCircle"), g.selectAll("mySlices").data(A).enter().append("path").attr("d", N).attr("fill", function(p) {
580 return x(p.data.name);
581 }).attr("class", "pieCircle"), g.selectAll("mySlices").data(A).enter().append("text").text(function(p) {
582 return (p.data.value / D * 100).toFixed(0) + "%";
583 }).attr("transform", function(p) {
584 return "translate(" + W.centroid(p) + ")";
585 }).style("text-anchor", "middle").attr("class", "slice"), g.append("text").text(o.db.getDiagramTitle()).attr("x", 0).attr("y", -(B - 50) / 2).attr("class", "pieTitleText");
586 var I = g.selectAll(".legend").data(x.domain()).enter().append("g").attr("class", "legend").attr("transform", function(p, d) {
587 const F = u + h, q = F * x.domain().length / 2, Q = 12 * u, G = d * F - q;
588 return "translate(" + Q + "," + G + ")";
589 });
590 I.append("rect").attr("width", u).attr("height", u).style("fill", x).style("stroke", x), I.data(A).append("text").attr("x", u + h).attr("y", u - h).text(function(p) {
591 return o.db.getShowData() || T.showData || T.pie.showData ? p.data.name + " [" + p.data.value + "]" : p.data.name;
592 });
593 } catch (v) {
594 Y.error("Error while rendering info diagram"), Y.error(v);
595 }
596}, qt = {
597 draw: Ut
598}, Xt = {
599 parser: Lt,
600 db: Rt,
601 renderer: qt,
602 styles: Yt
603};
604export {
605 Xt as diagram
606};