bg-editor 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/dist/umo-editor.js +89809 -7
  2. package/package.json +21 -1
  3. package/dist/_baseUniq-CK68Es8H.js +0 -473
  4. package/dist/arc-cD-4ba7d.js +0 -84
  5. package/dist/architecture-U656AL7Q-jxTBuJdN.js +0 -6
  6. package/dist/architectureDiagram-VXUJARFQ-D3XlpFhb.js +0 -4660
  7. package/dist/blockDiagram-VD42YOAC-BslbvMOG.js +0 -2262
  8. package/dist/c4Diagram-YG6GDRKO-DD3uWYPM.js +0 -1581
  9. package/dist/channel-DjTSKqWx.js +0 -6
  10. package/dist/chunk-4BX2VUAB-lfhsh4gk.js +0 -9
  11. package/dist/chunk-55IACEB6-O42zw0MT.js +0 -9
  12. package/dist/chunk-B4BG7PRW-CAose2Ox.js +0 -1376
  13. package/dist/chunk-DI55MBZ5-DkOlwdzs.js +0 -1371
  14. package/dist/chunk-FMBD7UC4-XviEvZms.js +0 -20
  15. package/dist/chunk-QN33PNHL-CNGSzgpw.js +0 -20
  16. package/dist/chunk-QZHKN3VN-CRgLUJXR.js +0 -16
  17. package/dist/chunk-TZMSLE5B-BkHNUxTN.js +0 -65
  18. package/dist/classDiagram-2ON5EDUG-Cakz_SCw.js +0 -17
  19. package/dist/classDiagram-v2-WZHVMYZB-Cakz_SCw.js +0 -17
  20. package/dist/clone-CIrbb4_D.js +0 -9
  21. package/dist/cose-bilkent-S5V4N54A-EoSlB5N_.js +0 -2606
  22. package/dist/cytoscape.esm-DoU_GB5M.js +0 -18732
  23. package/dist/dagre-6UL2VRFP-BPH1NIvl.js +0 -444
  24. package/dist/defaultLocale-DEnRyJdC.js +0 -172
  25. package/dist/diagram-PSM6KHXK-DCRoLhFv.js +0 -396
  26. package/dist/diagram-QEK2KX5R-2gxFpsCA.js +0 -218
  27. package/dist/diagram-S2PKOQOG-BIPpN2G8.js +0 -143
  28. package/dist/erDiagram-Q2GNP2WA-pfb2dpnp.js +0 -842
  29. package/dist/flowDiagram-NV44I4VS-Dv631-Fh.js +0 -1621
  30. package/dist/ganttDiagram-LVOFAZNH-BOKYXijK.js +0 -2500
  31. package/dist/gitGraph-F6HP7TQM-CRerkbyh.js +0 -6
  32. package/dist/gitGraphDiagram-NY62KEGX-CgO9x7O1.js +0 -700
  33. package/dist/graph-CG-rVaun.js +0 -382
  34. package/dist/index-LPeu-5gp.js +0 -164788
  35. package/dist/info-NVLQJR56-CZcMDuD4.js +0 -6
  36. package/dist/infoDiagram-ER5ION4S-CpfjxDXT.js +0 -25
  37. package/dist/init-Dbt-6wo9.js +0 -17
  38. package/dist/journeyDiagram-XKPGCS4Q-D4m1xk_j.js +0 -837
  39. package/dist/kanban-definition-3W4ZIXB7-GUMW-GDO.js +0 -719
  40. package/dist/layout-C7pGfQvF.js +0 -1416
  41. package/dist/linear-CQdBpz9H.js +0 -260
  42. package/dist/mermaid-parser.core-C3Lk4un7.js +0 -14143
  43. package/dist/min-D7xNMq31.js +0 -39
  44. package/dist/mindmap-definition-VGOIOE7T-GfQh2q9s.js +0 -784
  45. package/dist/ordinal-mgyNSFm_.js +0 -62
  46. package/dist/packet-BFZMPI3H-DughJE3g.js +0 -6
  47. package/dist/pie-7BOR55EZ-B1py7mee.js +0 -6
  48. package/dist/pieDiagram-ADFJNKIX-DENmX4xL.js +0 -162
  49. package/dist/quadrantDiagram-AYHSOK5B-BFVycH-W.js +0 -1023
  50. package/dist/radar-NHE76QYJ-DuTW4rXt.js +0 -6
  51. package/dist/requirementDiagram-UZGBJVZJ-f8rb43Mp.js +0 -851
  52. package/dist/sankeyDiagram-TZEHDZUN-CUN0tZ5p.js +0 -811
  53. package/dist/sequenceDiagram-WL72ISMW-7X4nul9T.js +0 -2512
  54. package/dist/stateDiagram-FKZM4ZOC-CypL793K.js +0 -264
  55. package/dist/stateDiagram-v2-4FDKWEC3-D5vS5FM5.js +0 -17
  56. package/dist/timeline-definition-IT6M3QCI-B_WOoOGO.js +0 -798
  57. package/dist/treemap-KMMF4GRG-BzINyJBJ.js +0 -6
  58. package/dist/xychartDiagram-PRI3JC2R-Llw16NDY.js +0 -1341
@@ -1,1341 +0,0 @@
1
- import "./style.css";
2
- import { _ as a, s as gi, g as xi, q as Xt, p as di, a as fi, b as pi, l as Nt, H as mi, e as yi, y as bi, E as St, D as Yt, F as Ai, K as wi, i as Ci, aA as Si, R as Wt } from "./index-LPeu-5gp.js";
3
- import { i as _i } from "./init-Dbt-6wo9.js";
4
- import { o as ki } from "./ordinal-mgyNSFm_.js";
5
- import { l as zt } from "./linear-CQdBpz9H.js";
6
- function Ri(e, t, i) {
7
- e = +e, t = +t, i = (n = arguments.length) < 2 ? (t = e, e = 0, 1) : n < 3 ? 1 : +i;
8
- for (var s = -1, n = Math.max(0, Math.ceil((t - e) / i)) | 0, o = new Array(n); ++s < n; )
9
- o[s] = e + s * i;
10
- return o;
11
- }
12
- function yt() {
13
- var e = ki().unknown(void 0), t = e.domain, i = e.range, s = 0, n = 1, o, g, m = !1, p = 0, k = 0, v = 0.5;
14
- delete e.unknown;
15
- function C() {
16
- var b = t().length, E = n < s, D = E ? n : s, P = E ? s : n;
17
- o = (P - D) / Math.max(1, b - p + k * 2), m && (o = Math.floor(o)), D += (P - D - o * (b - p)) * v, g = o * (1 - p), m && (D = Math.round(D), g = Math.round(g));
18
- var I = Ri(b).map(function(y) {
19
- return D + o * y;
20
- });
21
- return i(E ? I.reverse() : I);
22
- }
23
- return e.domain = function(b) {
24
- return arguments.length ? (t(b), C()) : t();
25
- }, e.range = function(b) {
26
- return arguments.length ? ([s, n] = b, s = +s, n = +n, C()) : [s, n];
27
- }, e.rangeRound = function(b) {
28
- return [s, n] = b, s = +s, n = +n, m = !0, C();
29
- }, e.bandwidth = function() {
30
- return g;
31
- }, e.step = function() {
32
- return o;
33
- }, e.round = function(b) {
34
- return arguments.length ? (m = !!b, C()) : m;
35
- }, e.padding = function(b) {
36
- return arguments.length ? (p = Math.min(1, k = +b), C()) : p;
37
- }, e.paddingInner = function(b) {
38
- return arguments.length ? (p = Math.min(1, b), C()) : p;
39
- }, e.paddingOuter = function(b) {
40
- return arguments.length ? (k = +b, C()) : k;
41
- }, e.align = function(b) {
42
- return arguments.length ? (v = Math.max(0, Math.min(1, b)), C()) : v;
43
- }, e.copy = function() {
44
- return yt(t(), [s, n]).round(m).paddingInner(p).paddingOuter(k).align(v);
45
- }, _i.apply(C(), arguments);
46
- }
47
- var bt = function() {
48
- var e = /* @__PURE__ */ a(function(F, h, u, x) {
49
- for (u = u || {}, x = F.length; x--; u[F[x]] = h) ;
50
- return u;
51
- }, "o"), t = [1, 10, 12, 14, 16, 18, 19, 21, 23], i = [2, 6], s = [1, 3], n = [1, 5], o = [1, 6], g = [1, 7], m = [1, 5, 10, 12, 14, 16, 18, 19, 21, 23, 34, 35, 36], p = [1, 25], k = [1, 26], v = [1, 28], C = [1, 29], b = [1, 30], E = [1, 31], D = [1, 32], P = [1, 33], I = [1, 34], y = [1, 35], _ = [1, 36], c = [1, 37], W = [1, 43], z = [1, 42], U = [1, 47], X = [1, 50], l = [1, 10, 12, 14, 16, 18, 19, 21, 23, 34, 35, 36], L = [1, 10, 12, 14, 16, 18, 19, 21, 23, 24, 26, 27, 28, 34, 35, 36], S = [1, 10, 12, 14, 16, 18, 19, 21, 23, 24, 26, 27, 28, 34, 35, 36, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50], R = [1, 64], $ = {
52
- trace: /* @__PURE__ */ a(function() {
53
- }, "trace"),
54
- yy: {},
55
- symbols_: { error: 2, start: 3, eol: 4, XYCHART: 5, chartConfig: 6, document: 7, CHART_ORIENTATION: 8, statement: 9, title: 10, text: 11, X_AXIS: 12, parseXAxis: 13, Y_AXIS: 14, parseYAxis: 15, LINE: 16, plotData: 17, BAR: 18, acc_title: 19, acc_title_value: 20, acc_descr: 21, acc_descr_value: 22, acc_descr_multiline_value: 23, SQUARE_BRACES_START: 24, commaSeparatedNumbers: 25, SQUARE_BRACES_END: 26, NUMBER_WITH_DECIMAL: 27, COMMA: 28, xAxisData: 29, bandData: 30, ARROW_DELIMITER: 31, commaSeparatedTexts: 32, yAxisData: 33, NEWLINE: 34, SEMI: 35, EOF: 36, alphaNum: 37, STR: 38, MD_STR: 39, alphaNumToken: 40, AMP: 41, NUM: 42, ALPHA: 43, PLUS: 44, EQUALS: 45, MULT: 46, DOT: 47, BRKT: 48, MINUS: 49, UNDERSCORE: 50, $accept: 0, $end: 1 },
56
- terminals_: { 2: "error", 5: "XYCHART", 8: "CHART_ORIENTATION", 10: "title", 12: "X_AXIS", 14: "Y_AXIS", 16: "LINE", 18: "BAR", 19: "acc_title", 20: "acc_title_value", 21: "acc_descr", 22: "acc_descr_value", 23: "acc_descr_multiline_value", 24: "SQUARE_BRACES_START", 26: "SQUARE_BRACES_END", 27: "NUMBER_WITH_DECIMAL", 28: "COMMA", 31: "ARROW_DELIMITER", 34: "NEWLINE", 35: "SEMI", 36: "EOF", 38: "STR", 39: "MD_STR", 41: "AMP", 42: "NUM", 43: "ALPHA", 44: "PLUS", 45: "EQUALS", 46: "MULT", 47: "DOT", 48: "BRKT", 49: "MINUS", 50: "UNDERSCORE" },
57
- productions_: [0, [3, 2], [3, 3], [3, 2], [3, 1], [6, 1], [7, 0], [7, 2], [9, 2], [9, 2], [9, 2], [9, 2], [9, 2], [9, 3], [9, 2], [9, 3], [9, 2], [9, 2], [9, 1], [17, 3], [25, 3], [25, 1], [13, 1], [13, 2], [13, 1], [29, 1], [29, 3], [30, 3], [32, 3], [32, 1], [15, 1], [15, 2], [15, 1], [33, 3], [4, 1], [4, 1], [4, 1], [11, 1], [11, 1], [11, 1], [37, 1], [37, 2], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1]],
58
- performAction: /* @__PURE__ */ a(function(h, u, x, d, w, r, at) {
59
- var f = r.length - 1;
60
- switch (w) {
61
- case 5:
62
- d.setOrientation(r[f]);
63
- break;
64
- case 9:
65
- d.setDiagramTitle(r[f].text.trim());
66
- break;
67
- case 12:
68
- d.setLineData({ text: "", type: "text" }, r[f]);
69
- break;
70
- case 13:
71
- d.setLineData(r[f - 1], r[f]);
72
- break;
73
- case 14:
74
- d.setBarData({ text: "", type: "text" }, r[f]);
75
- break;
76
- case 15:
77
- d.setBarData(r[f - 1], r[f]);
78
- break;
79
- case 16:
80
- this.$ = r[f].trim(), d.setAccTitle(this.$);
81
- break;
82
- case 17:
83
- case 18:
84
- this.$ = r[f].trim(), d.setAccDescription(this.$);
85
- break;
86
- case 19:
87
- this.$ = r[f - 1];
88
- break;
89
- case 20:
90
- this.$ = [Number(r[f - 2]), ...r[f]];
91
- break;
92
- case 21:
93
- this.$ = [Number(r[f])];
94
- break;
95
- case 22:
96
- d.setXAxisTitle(r[f]);
97
- break;
98
- case 23:
99
- d.setXAxisTitle(r[f - 1]);
100
- break;
101
- case 24:
102
- d.setXAxisTitle({ type: "text", text: "" });
103
- break;
104
- case 25:
105
- d.setXAxisBand(r[f]);
106
- break;
107
- case 26:
108
- d.setXAxisRangeData(Number(r[f - 2]), Number(r[f]));
109
- break;
110
- case 27:
111
- this.$ = r[f - 1];
112
- break;
113
- case 28:
114
- this.$ = [r[f - 2], ...r[f]];
115
- break;
116
- case 29:
117
- this.$ = [r[f]];
118
- break;
119
- case 30:
120
- d.setYAxisTitle(r[f]);
121
- break;
122
- case 31:
123
- d.setYAxisTitle(r[f - 1]);
124
- break;
125
- case 32:
126
- d.setYAxisTitle({ type: "text", text: "" });
127
- break;
128
- case 33:
129
- d.setYAxisRangeData(Number(r[f - 2]), Number(r[f]));
130
- break;
131
- case 37:
132
- this.$ = { text: r[f], type: "text" };
133
- break;
134
- case 38:
135
- this.$ = { text: r[f], type: "text" };
136
- break;
137
- case 39:
138
- this.$ = { text: r[f], type: "markdown" };
139
- break;
140
- case 40:
141
- this.$ = r[f];
142
- break;
143
- case 41:
144
- this.$ = r[f - 1] + "" + r[f];
145
- break;
146
- }
147
- }, "anonymous"),
148
- table: [e(t, i, { 3: 1, 4: 2, 7: 4, 5: s, 34: n, 35: o, 36: g }), { 1: [3] }, e(t, i, { 4: 2, 7: 4, 3: 8, 5: s, 34: n, 35: o, 36: g }), e(t, i, { 4: 2, 7: 4, 6: 9, 3: 10, 5: s, 8: [1, 11], 34: n, 35: o, 36: g }), { 1: [2, 4], 9: 12, 10: [1, 13], 12: [1, 14], 14: [1, 15], 16: [1, 16], 18: [1, 17], 19: [1, 18], 21: [1, 19], 23: [1, 20] }, e(m, [2, 34]), e(m, [2, 35]), e(m, [2, 36]), { 1: [2, 1] }, e(t, i, { 4: 2, 7: 4, 3: 21, 5: s, 34: n, 35: o, 36: g }), { 1: [2, 3] }, e(m, [2, 5]), e(t, [2, 7], { 4: 22, 34: n, 35: o, 36: g }), { 11: 23, 37: 24, 38: p, 39: k, 40: 27, 41: v, 42: C, 43: b, 44: E, 45: D, 46: P, 47: I, 48: y, 49: _, 50: c }, { 11: 39, 13: 38, 24: W, 27: z, 29: 40, 30: 41, 37: 24, 38: p, 39: k, 40: 27, 41: v, 42: C, 43: b, 44: E, 45: D, 46: P, 47: I, 48: y, 49: _, 50: c }, { 11: 45, 15: 44, 27: U, 33: 46, 37: 24, 38: p, 39: k, 40: 27, 41: v, 42: C, 43: b, 44: E, 45: D, 46: P, 47: I, 48: y, 49: _, 50: c }, { 11: 49, 17: 48, 24: X, 37: 24, 38: p, 39: k, 40: 27, 41: v, 42: C, 43: b, 44: E, 45: D, 46: P, 47: I, 48: y, 49: _, 50: c }, { 11: 52, 17: 51, 24: X, 37: 24, 38: p, 39: k, 40: 27, 41: v, 42: C, 43: b, 44: E, 45: D, 46: P, 47: I, 48: y, 49: _, 50: c }, { 20: [1, 53] }, { 22: [1, 54] }, e(l, [2, 18]), { 1: [2, 2] }, e(l, [2, 8]), e(l, [2, 9]), e(L, [2, 37], { 40: 55, 41: v, 42: C, 43: b, 44: E, 45: D, 46: P, 47: I, 48: y, 49: _, 50: c }), e(L, [2, 38]), e(L, [2, 39]), e(S, [2, 40]), e(S, [2, 42]), e(S, [2, 43]), e(S, [2, 44]), e(S, [2, 45]), e(S, [2, 46]), e(S, [2, 47]), e(S, [2, 48]), e(S, [2, 49]), e(S, [2, 50]), e(S, [2, 51]), e(l, [2, 10]), e(l, [2, 22], { 30: 41, 29: 56, 24: W, 27: z }), e(l, [2, 24]), e(l, [2, 25]), { 31: [1, 57] }, { 11: 59, 32: 58, 37: 24, 38: p, 39: k, 40: 27, 41: v, 42: C, 43: b, 44: E, 45: D, 46: P, 47: I, 48: y, 49: _, 50: c }, e(l, [2, 11]), e(l, [2, 30], { 33: 60, 27: U }), e(l, [2, 32]), { 31: [1, 61] }, e(l, [2, 12]), { 17: 62, 24: X }, { 25: 63, 27: R }, e(l, [2, 14]), { 17: 65, 24: X }, e(l, [2, 16]), e(l, [2, 17]), e(S, [2, 41]), e(l, [2, 23]), { 27: [1, 66] }, { 26: [1, 67] }, { 26: [2, 29], 28: [1, 68] }, e(l, [2, 31]), { 27: [1, 69] }, e(l, [2, 13]), { 26: [1, 70] }, { 26: [2, 21], 28: [1, 71] }, e(l, [2, 15]), e(l, [2, 26]), e(l, [2, 27]), { 11: 59, 32: 72, 37: 24, 38: p, 39: k, 40: 27, 41: v, 42: C, 43: b, 44: E, 45: D, 46: P, 47: I, 48: y, 49: _, 50: c }, e(l, [2, 33]), e(l, [2, 19]), { 25: 73, 27: R }, { 26: [2, 28] }, { 26: [2, 20] }],
149
- defaultActions: { 8: [2, 1], 10: [2, 3], 21: [2, 2], 72: [2, 28], 73: [2, 20] },
150
- parseError: /* @__PURE__ */ a(function(h, u) {
151
- if (u.recoverable)
152
- this.trace(h);
153
- else {
154
- var x = new Error(h);
155
- throw x.hash = u, x;
156
- }
157
- }, "parseError"),
158
- parse: /* @__PURE__ */ a(function(h) {
159
- var u = this, x = [0], d = [], w = [null], r = [], at = this.table, f = "", lt = 0, It = 0, hi = 2, Mt = 1, li = r.slice.call(arguments, 1), T = Object.create(this.lexer), Y = { yy: {} };
160
- for (var dt in this.yy)
161
- Object.prototype.hasOwnProperty.call(this.yy, dt) && (Y.yy[dt] = this.yy[dt]);
162
- T.setInput(h, Y.yy), Y.yy.lexer = T, Y.yy.parser = this, typeof T.yylloc > "u" && (T.yylloc = {});
163
- var ft = T.yylloc;
164
- r.push(ft);
165
- var ci = T.options && T.options.ranges;
166
- typeof Y.yy.parseError == "function" ? this.parseError = Y.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
167
- function ui(V) {
168
- x.length = x.length - 2 * V, w.length = w.length - V, r.length = r.length - V;
169
- }
170
- a(ui, "popStack");
171
- function Vt() {
172
- var V;
173
- return V = d.pop() || T.lex() || Mt, typeof V != "number" && (V instanceof Array && (d = V, V = d.pop()), V = u.symbols_[V] || V), V;
174
- }
175
- a(Vt, "lex");
176
- for (var M, H, B, pt, q = {}, ct, O, Bt, ut; ; ) {
177
- if (H = x[x.length - 1], this.defaultActions[H] ? B = this.defaultActions[H] : ((M === null || typeof M > "u") && (M = Vt()), B = at[H] && at[H][M]), typeof B > "u" || !B.length || !B[0]) {
178
- var mt = "";
179
- ut = [];
180
- for (ct in at[H])
181
- this.terminals_[ct] && ct > hi && ut.push("'" + this.terminals_[ct] + "'");
182
- T.showPosition ? mt = "Parse error on line " + (lt + 1) + `:
183
- ` + T.showPosition() + `
184
- Expecting ` + ut.join(", ") + ", got '" + (this.terminals_[M] || M) + "'" : mt = "Parse error on line " + (lt + 1) + ": Unexpected " + (M == Mt ? "end of input" : "'" + (this.terminals_[M] || M) + "'"), this.parseError(mt, {
185
- text: T.match,
186
- token: this.terminals_[M] || M,
187
- line: T.yylineno,
188
- loc: ft,
189
- expected: ut
190
- });
191
- }
192
- if (B[0] instanceof Array && B.length > 1)
193
- throw new Error("Parse Error: multiple actions possible at state: " + H + ", token: " + M);
194
- switch (B[0]) {
195
- case 1:
196
- x.push(M), w.push(T.yytext), r.push(T.yylloc), x.push(B[1]), M = null, It = T.yyleng, f = T.yytext, lt = T.yylineno, ft = T.yylloc;
197
- break;
198
- case 2:
199
- if (O = this.productions_[B[1]][1], q.$ = w[w.length - O], q._$ = {
200
- first_line: r[r.length - (O || 1)].first_line,
201
- last_line: r[r.length - 1].last_line,
202
- first_column: r[r.length - (O || 1)].first_column,
203
- last_column: r[r.length - 1].last_column
204
- }, ci && (q._$.range = [
205
- r[r.length - (O || 1)].range[0],
206
- r[r.length - 1].range[1]
207
- ]), pt = this.performAction.apply(q, [
208
- f,
209
- It,
210
- lt,
211
- Y.yy,
212
- B[1],
213
- w,
214
- r
215
- ].concat(li)), typeof pt < "u")
216
- return pt;
217
- O && (x = x.slice(0, -1 * O * 2), w = w.slice(0, -1 * O), r = r.slice(0, -1 * O)), x.push(this.productions_[B[1]][0]), w.push(q.$), r.push(q._$), Bt = at[x[x.length - 2]][x[x.length - 1]], x.push(Bt);
218
- break;
219
- case 3:
220
- return !0;
221
- }
222
- }
223
- return !0;
224
- }, "parse")
225
- }, Et = /* @__PURE__ */ function() {
226
- var F = {
227
- EOF: 1,
228
- parseError: /* @__PURE__ */ a(function(u, x) {
229
- if (this.yy.parser)
230
- this.yy.parser.parseError(u, x);
231
- else
232
- throw new Error(u);
233
- }, "parseError"),
234
- // resets the lexer, sets new input
235
- setInput: /* @__PURE__ */ a(function(h, u) {
236
- return this.yy = u || this.yy || {}, this._input = h, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
237
- first_line: 1,
238
- first_column: 0,
239
- last_line: 1,
240
- last_column: 0
241
- }, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
242
- }, "setInput"),
243
- // consumes and returns one char from the input
244
- input: /* @__PURE__ */ a(function() {
245
- var h = this._input[0];
246
- this.yytext += h, this.yyleng++, this.offset++, this.match += h, this.matched += h;
247
- var u = h.match(/(?:\r\n?|\n).*/g);
248
- return u ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), h;
249
- }, "input"),
250
- // unshifts one char (or a string) into the input
251
- unput: /* @__PURE__ */ a(function(h) {
252
- var u = h.length, x = h.split(/(?:\r\n?|\n)/g);
253
- this._input = h + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - u), this.offset -= u;
254
- var d = this.match.split(/(?:\r\n?|\n)/g);
255
- this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), x.length - 1 && (this.yylineno -= x.length - 1);
256
- var w = this.yylloc.range;
257
- return this.yylloc = {
258
- first_line: this.yylloc.first_line,
259
- last_line: this.yylineno + 1,
260
- first_column: this.yylloc.first_column,
261
- last_column: x ? (x.length === d.length ? this.yylloc.first_column : 0) + d[d.length - x.length].length - x[0].length : this.yylloc.first_column - u
262
- }, this.options.ranges && (this.yylloc.range = [w[0], w[0] + this.yyleng - u]), this.yyleng = this.yytext.length, this;
263
- }, "unput"),
264
- // When called from action, caches matched text and appends it on next action
265
- more: /* @__PURE__ */ a(function() {
266
- return this._more = !0, this;
267
- }, "more"),
268
- // 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.
269
- reject: /* @__PURE__ */ a(function() {
270
- if (this.options.backtrack_lexer)
271
- this._backtrack = !0;
272
- else
273
- 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).
274
- ` + this.showPosition(), {
275
- text: "",
276
- token: null,
277
- line: this.yylineno
278
- });
279
- return this;
280
- }, "reject"),
281
- // retain first n characters of the match
282
- less: /* @__PURE__ */ a(function(h) {
283
- this.unput(this.match.slice(h));
284
- }, "less"),
285
- // displays already matched input, i.e. for error messages
286
- pastInput: /* @__PURE__ */ a(function() {
287
- var h = this.matched.substr(0, this.matched.length - this.match.length);
288
- return (h.length > 20 ? "..." : "") + h.substr(-20).replace(/\n/g, "");
289
- }, "pastInput"),
290
- // displays upcoming input, i.e. for error messages
291
- upcomingInput: /* @__PURE__ */ a(function() {
292
- var h = this.match;
293
- return h.length < 20 && (h += this._input.substr(0, 20 - h.length)), (h.substr(0, 20) + (h.length > 20 ? "..." : "")).replace(/\n/g, "");
294
- }, "upcomingInput"),
295
- // displays the character position where the lexing error occurred, i.e. for error messages
296
- showPosition: /* @__PURE__ */ a(function() {
297
- var h = this.pastInput(), u = new Array(h.length + 1).join("-");
298
- return h + this.upcomingInput() + `
299
- ` + u + "^";
300
- }, "showPosition"),
301
- // test the lexed token: return FALSE when not a match, otherwise return token
302
- test_match: /* @__PURE__ */ a(function(h, u) {
303
- var x, d, w;
304
- if (this.options.backtrack_lexer && (w = {
305
- yylineno: this.yylineno,
306
- yylloc: {
307
- first_line: this.yylloc.first_line,
308
- last_line: this.last_line,
309
- first_column: this.yylloc.first_column,
310
- last_column: this.yylloc.last_column
311
- },
312
- yytext: this.yytext,
313
- match: this.match,
314
- matches: this.matches,
315
- matched: this.matched,
316
- yyleng: this.yyleng,
317
- offset: this.offset,
318
- _more: this._more,
319
- _input: this._input,
320
- yy: this.yy,
321
- conditionStack: this.conditionStack.slice(0),
322
- done: this.done
323
- }, this.options.ranges && (w.yylloc.range = this.yylloc.range.slice(0))), d = h[0].match(/(?:\r\n?|\n).*/g), d && (this.yylineno += d.length), this.yylloc = {
324
- first_line: this.yylloc.last_line,
325
- last_line: this.yylineno + 1,
326
- first_column: this.yylloc.last_column,
327
- last_column: d ? d[d.length - 1].length - d[d.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + h[0].length
328
- }, this.yytext += h[0], this.match += h[0], this.matches = h, 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(h[0].length), this.matched += h[0], x = this.performAction.call(this, this.yy, this, u, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), x)
329
- return x;
330
- if (this._backtrack) {
331
- for (var r in w)
332
- this[r] = w[r];
333
- return !1;
334
- }
335
- return !1;
336
- }, "test_match"),
337
- // return next match in input
338
- next: /* @__PURE__ */ a(function() {
339
- if (this.done)
340
- return this.EOF;
341
- this._input || (this.done = !0);
342
- var h, u, x, d;
343
- this._more || (this.yytext = "", this.match = "");
344
- for (var w = this._currentRules(), r = 0; r < w.length; r++)
345
- if (x = this._input.match(this.rules[w[r]]), x && (!u || x[0].length > u[0].length)) {
346
- if (u = x, d = r, this.options.backtrack_lexer) {
347
- if (h = this.test_match(x, w[r]), h !== !1)
348
- return h;
349
- if (this._backtrack) {
350
- u = !1;
351
- continue;
352
- } else
353
- return !1;
354
- } else if (!this.options.flex)
355
- break;
356
- }
357
- return u ? (h = this.test_match(u, w[d]), h !== !1 ? h : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
358
- ` + this.showPosition(), {
359
- text: "",
360
- token: null,
361
- line: this.yylineno
362
- });
363
- }, "next"),
364
- // return next match that has a token
365
- lex: /* @__PURE__ */ a(function() {
366
- var u = this.next();
367
- return u || this.lex();
368
- }, "lex"),
369
- // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
370
- begin: /* @__PURE__ */ a(function(u) {
371
- this.conditionStack.push(u);
372
- }, "begin"),
373
- // pop the previously active lexer condition state off the condition stack
374
- popState: /* @__PURE__ */ a(function() {
375
- var u = this.conditionStack.length - 1;
376
- return u > 0 ? this.conditionStack.pop() : this.conditionStack[0];
377
- }, "popState"),
378
- // produce the lexer rule set which is active for the currently active lexer condition state
379
- _currentRules: /* @__PURE__ */ a(function() {
380
- return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
381
- }, "_currentRules"),
382
- // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
383
- topState: /* @__PURE__ */ a(function(u) {
384
- return u = this.conditionStack.length - 1 - Math.abs(u || 0), u >= 0 ? this.conditionStack[u] : "INITIAL";
385
- }, "topState"),
386
- // alias for begin(condition)
387
- pushState: /* @__PURE__ */ a(function(u) {
388
- this.begin(u);
389
- }, "pushState"),
390
- // return the number of states currently on the stack
391
- stateStackSize: /* @__PURE__ */ a(function() {
392
- return this.conditionStack.length;
393
- }, "stateStackSize"),
394
- options: { "case-insensitive": !0 },
395
- performAction: /* @__PURE__ */ a(function(u, x, d, w) {
396
- switch (d) {
397
- case 0:
398
- break;
399
- case 1:
400
- break;
401
- case 2:
402
- return this.popState(), 34;
403
- case 3:
404
- return this.popState(), 34;
405
- case 4:
406
- return 34;
407
- case 5:
408
- break;
409
- case 6:
410
- return 10;
411
- case 7:
412
- return this.pushState("acc_title"), 19;
413
- case 8:
414
- return this.popState(), "acc_title_value";
415
- case 9:
416
- return this.pushState("acc_descr"), 21;
417
- case 10:
418
- return this.popState(), "acc_descr_value";
419
- case 11:
420
- this.pushState("acc_descr_multiline");
421
- break;
422
- case 12:
423
- this.popState();
424
- break;
425
- case 13:
426
- return "acc_descr_multiline_value";
427
- case 14:
428
- return 5;
429
- case 15:
430
- return 5;
431
- case 16:
432
- return 8;
433
- case 17:
434
- return this.pushState("axis_data"), "X_AXIS";
435
- case 18:
436
- return this.pushState("axis_data"), "Y_AXIS";
437
- case 19:
438
- return this.pushState("axis_band_data"), 24;
439
- case 20:
440
- return 31;
441
- case 21:
442
- return this.pushState("data"), 16;
443
- case 22:
444
- return this.pushState("data"), 18;
445
- case 23:
446
- return this.pushState("data_inner"), 24;
447
- case 24:
448
- return 27;
449
- case 25:
450
- return this.popState(), 26;
451
- case 26:
452
- this.popState();
453
- break;
454
- case 27:
455
- this.pushState("string");
456
- break;
457
- case 28:
458
- this.popState();
459
- break;
460
- case 29:
461
- return "STR";
462
- case 30:
463
- return 24;
464
- case 31:
465
- return 26;
466
- case 32:
467
- return 43;
468
- case 33:
469
- return "COLON";
470
- case 34:
471
- return 44;
472
- case 35:
473
- return 28;
474
- case 36:
475
- return 45;
476
- case 37:
477
- return 46;
478
- case 38:
479
- return 48;
480
- case 39:
481
- return 50;
482
- case 40:
483
- return 47;
484
- case 41:
485
- return 41;
486
- case 42:
487
- return 49;
488
- case 43:
489
- return 42;
490
- case 44:
491
- break;
492
- case 45:
493
- return 35;
494
- case 46:
495
- return 36;
496
- }
497
- }, "anonymous"),
498
- rules: [/^(?:%%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:(\r?\n))/i, /^(?:(\r?\n))/i, /^(?:[\n\r]+)/i, /^(?:%%[^\n]*)/i, /^(?:title\b)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:\{)/i, /^(?:[^\}]*)/i, /^(?:xychart-beta\b)/i, /^(?:xychart\b)/i, /^(?:(?:vertical|horizontal))/i, /^(?:x-axis\b)/i, /^(?:y-axis\b)/i, /^(?:\[)/i, /^(?:-->)/i, /^(?:line\b)/i, /^(?:bar\b)/i, /^(?:\[)/i, /^(?:[+-]?(?:\d+(?:\.\d+)?|\.\d+))/i, /^(?:\])/i, /^(?:(?:`\) \{ this\.pushState\(md_string\); \}\n<md_string>\(\?:\(\?!`"\)\.\)\+ \{ return MD_STR; \}\n<md_string>\(\?:`))/i, /^(?:["])/i, /^(?:["])/i, /^(?:[^"]*)/i, /^(?:\[)/i, /^(?:\])/i, /^(?:[A-Za-z]+)/i, /^(?::)/i, /^(?:\+)/i, /^(?:,)/i, /^(?:=)/i, /^(?:\*)/i, /^(?:#)/i, /^(?:[\_])/i, /^(?:\.)/i, /^(?:&)/i, /^(?:-)/i, /^(?:[0-9]+)/i, /^(?:\s+)/i, /^(?:;)/i, /^(?:$)/i],
499
- conditions: { data_inner: { rules: [0, 1, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 18, 21, 22, 24, 25, 26, 27, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46], inclusive: !0 }, data: { rules: [0, 1, 3, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 18, 21, 22, 23, 26, 27, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46], inclusive: !0 }, axis_band_data: { rules: [0, 1, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 18, 21, 22, 25, 26, 27, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46], inclusive: !0 }, axis_data: { rules: [0, 1, 2, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 18, 19, 20, 21, 22, 24, 26, 27, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46], inclusive: !0 }, acc_descr_multiline: { rules: [12, 13], inclusive: !1 }, acc_descr: { rules: [10], inclusive: !1 }, acc_title: { rules: [8], inclusive: !1 }, title: { rules: [], inclusive: !1 }, md_string: { rules: [], inclusive: !1 }, string: { rules: [28, 29], inclusive: !1 }, INITIAL: { rules: [0, 1, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 18, 21, 22, 26, 27, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46], inclusive: !0 } }
500
- };
501
- return F;
502
- }();
503
- $.lexer = Et;
504
- function N() {
505
- this.yy = {};
506
- }
507
- return a(N, "Parser"), N.prototype = $, $.Parser = N, new N();
508
- }();
509
- bt.parser = bt;
510
- var Ti = bt;
511
- function At(e) {
512
- return e.type === "bar";
513
- }
514
- a(At, "isBarPlot");
515
- function _t(e) {
516
- return e.type === "band";
517
- }
518
- a(_t, "isBandAxisData");
519
- function G(e) {
520
- return e.type === "linear";
521
- }
522
- a(G, "isLinearAxisData");
523
- var j, Ht = (j = class {
524
- constructor(t) {
525
- this.parentGroup = t;
526
- }
527
- getMaxDimension(t, i) {
528
- if (!this.parentGroup)
529
- return {
530
- width: t.reduce((o, g) => Math.max(g.length, o), 0) * i,
531
- height: i
532
- };
533
- const s = {
534
- width: 0,
535
- height: 0
536
- }, n = this.parentGroup.append("g").attr("visibility", "hidden").attr("font-size", i);
537
- for (const o of t) {
538
- const g = Si(n, 1, o), m = g ? g.width : o.length * i, p = g ? g.height : i;
539
- s.width = Math.max(s.width, m), s.height = Math.max(s.height, p);
540
- }
541
- return n.remove(), s;
542
- }
543
- }, a(j, "TextDimensionCalculatorWithFont"), j), Ft = 0.7, Ot = 0.2, Q, Ut = (Q = class {
544
- constructor(t, i, s, n) {
545
- this.axisConfig = t, this.title = i, this.textDimensionCalculator = s, this.axisThemeConfig = n, this.boundingRect = { x: 0, y: 0, width: 0, height: 0 }, this.axisPosition = "left", this.showTitle = !1, this.showLabel = !1, this.showTick = !1, this.showAxisLine = !1, this.outerPadding = 0, this.titleTextHeight = 0, this.labelTextHeight = 0, this.range = [0, 10], this.boundingRect = { x: 0, y: 0, width: 0, height: 0 }, this.axisPosition = "left";
546
- }
547
- setRange(t) {
548
- this.range = t, this.axisPosition === "left" || this.axisPosition === "right" ? this.boundingRect.height = t[1] - t[0] : this.boundingRect.width = t[1] - t[0], this.recalculateScale();
549
- }
550
- getRange() {
551
- return [this.range[0] + this.outerPadding, this.range[1] - this.outerPadding];
552
- }
553
- setAxisPosition(t) {
554
- this.axisPosition = t, this.setRange(this.range);
555
- }
556
- getTickDistance() {
557
- const t = this.getRange();
558
- return Math.abs(t[0] - t[1]) / this.getTickValues().length;
559
- }
560
- getAxisOuterPadding() {
561
- return this.outerPadding;
562
- }
563
- getLabelDimension() {
564
- return this.textDimensionCalculator.getMaxDimension(
565
- this.getTickValues().map((t) => t.toString()),
566
- this.axisConfig.labelFontSize
567
- );
568
- }
569
- recalculateOuterPaddingToDrawBar() {
570
- Ft * this.getTickDistance() > this.outerPadding * 2 && (this.outerPadding = Math.floor(Ft * this.getTickDistance() / 2)), this.recalculateScale();
571
- }
572
- calculateSpaceIfDrawnHorizontally(t) {
573
- let i = t.height;
574
- if (this.axisConfig.showAxisLine && i > this.axisConfig.axisLineWidth && (i -= this.axisConfig.axisLineWidth, this.showAxisLine = !0), this.axisConfig.showLabel) {
575
- const s = this.getLabelDimension(), n = Ot * t.width;
576
- this.outerPadding = Math.min(s.width / 2, n);
577
- const o = s.height + this.axisConfig.labelPadding * 2;
578
- this.labelTextHeight = s.height, o <= i && (i -= o, this.showLabel = !0);
579
- }
580
- if (this.axisConfig.showTick && i >= this.axisConfig.tickLength && (this.showTick = !0, i -= this.axisConfig.tickLength), this.axisConfig.showTitle && this.title) {
581
- const s = this.textDimensionCalculator.getMaxDimension(
582
- [this.title],
583
- this.axisConfig.titleFontSize
584
- ), n = s.height + this.axisConfig.titlePadding * 2;
585
- this.titleTextHeight = s.height, n <= i && (i -= n, this.showTitle = !0);
586
- }
587
- this.boundingRect.width = t.width, this.boundingRect.height = t.height - i;
588
- }
589
- calculateSpaceIfDrawnVertical(t) {
590
- let i = t.width;
591
- if (this.axisConfig.showAxisLine && i > this.axisConfig.axisLineWidth && (i -= this.axisConfig.axisLineWidth, this.showAxisLine = !0), this.axisConfig.showLabel) {
592
- const s = this.getLabelDimension(), n = Ot * t.height;
593
- this.outerPadding = Math.min(s.height / 2, n);
594
- const o = s.width + this.axisConfig.labelPadding * 2;
595
- o <= i && (i -= o, this.showLabel = !0);
596
- }
597
- if (this.axisConfig.showTick && i >= this.axisConfig.tickLength && (this.showTick = !0, i -= this.axisConfig.tickLength), this.axisConfig.showTitle && this.title) {
598
- const s = this.textDimensionCalculator.getMaxDimension(
599
- [this.title],
600
- this.axisConfig.titleFontSize
601
- ), n = s.height + this.axisConfig.titlePadding * 2;
602
- this.titleTextHeight = s.height, n <= i && (i -= n, this.showTitle = !0);
603
- }
604
- this.boundingRect.width = t.width - i, this.boundingRect.height = t.height;
605
- }
606
- calculateSpace(t) {
607
- return this.axisPosition === "left" || this.axisPosition === "right" ? this.calculateSpaceIfDrawnVertical(t) : this.calculateSpaceIfDrawnHorizontally(t), this.recalculateScale(), {
608
- width: this.boundingRect.width,
609
- height: this.boundingRect.height
610
- };
611
- }
612
- setBoundingBoxXY(t) {
613
- this.boundingRect.x = t.x, this.boundingRect.y = t.y;
614
- }
615
- getDrawableElementsForLeftAxis() {
616
- const t = [];
617
- if (this.showAxisLine) {
618
- const i = this.boundingRect.x + this.boundingRect.width - this.axisConfig.axisLineWidth / 2;
619
- t.push({
620
- type: "path",
621
- groupTexts: ["left-axis", "axisl-line"],
622
- data: [
623
- {
624
- path: `M ${i},${this.boundingRect.y} L ${i},${this.boundingRect.y + this.boundingRect.height} `,
625
- strokeFill: this.axisThemeConfig.axisLineColor,
626
- strokeWidth: this.axisConfig.axisLineWidth
627
- }
628
- ]
629
- });
630
- }
631
- if (this.showLabel && t.push({
632
- type: "text",
633
- groupTexts: ["left-axis", "label"],
634
- data: this.getTickValues().map((i) => ({
635
- text: i.toString(),
636
- x: this.boundingRect.x + this.boundingRect.width - (this.showLabel ? this.axisConfig.labelPadding : 0) - (this.showTick ? this.axisConfig.tickLength : 0) - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0),
637
- y: this.getScaleValue(i),
638
- fill: this.axisThemeConfig.labelColor,
639
- fontSize: this.axisConfig.labelFontSize,
640
- rotation: 0,
641
- verticalPos: "middle",
642
- horizontalPos: "right"
643
- }))
644
- }), this.showTick) {
645
- const i = this.boundingRect.x + this.boundingRect.width - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0);
646
- t.push({
647
- type: "path",
648
- groupTexts: ["left-axis", "ticks"],
649
- data: this.getTickValues().map((s) => ({
650
- path: `M ${i},${this.getScaleValue(s)} L ${i - this.axisConfig.tickLength},${this.getScaleValue(s)}`,
651
- strokeFill: this.axisThemeConfig.tickColor,
652
- strokeWidth: this.axisConfig.tickWidth
653
- }))
654
- });
655
- }
656
- return this.showTitle && t.push({
657
- type: "text",
658
- groupTexts: ["left-axis", "title"],
659
- data: [
660
- {
661
- text: this.title,
662
- x: this.boundingRect.x + this.axisConfig.titlePadding,
663
- y: this.boundingRect.y + this.boundingRect.height / 2,
664
- fill: this.axisThemeConfig.titleColor,
665
- fontSize: this.axisConfig.titleFontSize,
666
- rotation: 270,
667
- verticalPos: "top",
668
- horizontalPos: "center"
669
- }
670
- ]
671
- }), t;
672
- }
673
- getDrawableElementsForBottomAxis() {
674
- const t = [];
675
- if (this.showAxisLine) {
676
- const i = this.boundingRect.y + this.axisConfig.axisLineWidth / 2;
677
- t.push({
678
- type: "path",
679
- groupTexts: ["bottom-axis", "axis-line"],
680
- data: [
681
- {
682
- path: `M ${this.boundingRect.x},${i} L ${this.boundingRect.x + this.boundingRect.width},${i}`,
683
- strokeFill: this.axisThemeConfig.axisLineColor,
684
- strokeWidth: this.axisConfig.axisLineWidth
685
- }
686
- ]
687
- });
688
- }
689
- if (this.showLabel && t.push({
690
- type: "text",
691
- groupTexts: ["bottom-axis", "label"],
692
- data: this.getTickValues().map((i) => ({
693
- text: i.toString(),
694
- x: this.getScaleValue(i),
695
- y: this.boundingRect.y + this.axisConfig.labelPadding + (this.showTick ? this.axisConfig.tickLength : 0) + (this.showAxisLine ? this.axisConfig.axisLineWidth : 0),
696
- fill: this.axisThemeConfig.labelColor,
697
- fontSize: this.axisConfig.labelFontSize,
698
- rotation: 0,
699
- verticalPos: "top",
700
- horizontalPos: "center"
701
- }))
702
- }), this.showTick) {
703
- const i = this.boundingRect.y + (this.showAxisLine ? this.axisConfig.axisLineWidth : 0);
704
- t.push({
705
- type: "path",
706
- groupTexts: ["bottom-axis", "ticks"],
707
- data: this.getTickValues().map((s) => ({
708
- path: `M ${this.getScaleValue(s)},${i} L ${this.getScaleValue(s)},${i + this.axisConfig.tickLength}`,
709
- strokeFill: this.axisThemeConfig.tickColor,
710
- strokeWidth: this.axisConfig.tickWidth
711
- }))
712
- });
713
- }
714
- return this.showTitle && t.push({
715
- type: "text",
716
- groupTexts: ["bottom-axis", "title"],
717
- data: [
718
- {
719
- text: this.title,
720
- x: this.range[0] + (this.range[1] - this.range[0]) / 2,
721
- y: this.boundingRect.y + this.boundingRect.height - this.axisConfig.titlePadding - this.titleTextHeight,
722
- fill: this.axisThemeConfig.titleColor,
723
- fontSize: this.axisConfig.titleFontSize,
724
- rotation: 0,
725
- verticalPos: "top",
726
- horizontalPos: "center"
727
- }
728
- ]
729
- }), t;
730
- }
731
- getDrawableElementsForTopAxis() {
732
- const t = [];
733
- if (this.showAxisLine) {
734
- const i = this.boundingRect.y + this.boundingRect.height - this.axisConfig.axisLineWidth / 2;
735
- t.push({
736
- type: "path",
737
- groupTexts: ["top-axis", "axis-line"],
738
- data: [
739
- {
740
- path: `M ${this.boundingRect.x},${i} L ${this.boundingRect.x + this.boundingRect.width},${i}`,
741
- strokeFill: this.axisThemeConfig.axisLineColor,
742
- strokeWidth: this.axisConfig.axisLineWidth
743
- }
744
- ]
745
- });
746
- }
747
- if (this.showLabel && t.push({
748
- type: "text",
749
- groupTexts: ["top-axis", "label"],
750
- data: this.getTickValues().map((i) => ({
751
- text: i.toString(),
752
- x: this.getScaleValue(i),
753
- y: this.boundingRect.y + (this.showTitle ? this.titleTextHeight + this.axisConfig.titlePadding * 2 : 0) + this.axisConfig.labelPadding,
754
- fill: this.axisThemeConfig.labelColor,
755
- fontSize: this.axisConfig.labelFontSize,
756
- rotation: 0,
757
- verticalPos: "top",
758
- horizontalPos: "center"
759
- }))
760
- }), this.showTick) {
761
- const i = this.boundingRect.y;
762
- t.push({
763
- type: "path",
764
- groupTexts: ["top-axis", "ticks"],
765
- data: this.getTickValues().map((s) => ({
766
- path: `M ${this.getScaleValue(s)},${i + this.boundingRect.height - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0)} L ${this.getScaleValue(s)},${i + this.boundingRect.height - this.axisConfig.tickLength - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0)}`,
767
- strokeFill: this.axisThemeConfig.tickColor,
768
- strokeWidth: this.axisConfig.tickWidth
769
- }))
770
- });
771
- }
772
- return this.showTitle && t.push({
773
- type: "text",
774
- groupTexts: ["top-axis", "title"],
775
- data: [
776
- {
777
- text: this.title,
778
- x: this.boundingRect.x + this.boundingRect.width / 2,
779
- y: this.boundingRect.y + this.axisConfig.titlePadding,
780
- fill: this.axisThemeConfig.titleColor,
781
- fontSize: this.axisConfig.titleFontSize,
782
- rotation: 0,
783
- verticalPos: "top",
784
- horizontalPos: "center"
785
- }
786
- ]
787
- }), t;
788
- }
789
- getDrawableElements() {
790
- if (this.axisPosition === "left")
791
- return this.getDrawableElementsForLeftAxis();
792
- if (this.axisPosition === "right")
793
- throw Error("Drawing of right axis is not implemented");
794
- return this.axisPosition === "bottom" ? this.getDrawableElementsForBottomAxis() : this.axisPosition === "top" ? this.getDrawableElementsForTopAxis() : [];
795
- }
796
- }, a(Q, "BaseAxis"), Q), K, Di = (K = class extends Ut {
797
- constructor(t, i, s, n, o) {
798
- super(t, n, o, i), this.categories = s, this.scale = yt().domain(this.categories).range(this.getRange());
799
- }
800
- setRange(t) {
801
- super.setRange(t);
802
- }
803
- recalculateScale() {
804
- this.scale = yt().domain(this.categories).range(this.getRange()).paddingInner(1).paddingOuter(0).align(0.5), Nt.trace("BandAxis axis final categories, range: ", this.categories, this.getRange());
805
- }
806
- getTickValues() {
807
- return this.categories;
808
- }
809
- getScaleValue(t) {
810
- return this.scale(t) ?? this.getRange()[0];
811
- }
812
- }, a(K, "BandAxis"), K), Z, vi = (Z = class extends Ut {
813
- constructor(t, i, s, n, o) {
814
- super(t, n, o, i), this.domain = s, this.scale = zt().domain(this.domain).range(this.getRange());
815
- }
816
- getTickValues() {
817
- return this.scale.ticks();
818
- }
819
- recalculateScale() {
820
- const t = [...this.domain];
821
- this.axisPosition === "left" && t.reverse(), this.scale = zt().domain(t).range(this.getRange());
822
- }
823
- getScaleValue(t) {
824
- return this.scale(t);
825
- }
826
- }, a(Z, "LinearAxis"), Z);
827
- function wt(e, t, i, s) {
828
- const n = new Ht(s);
829
- return _t(e) ? new Di(
830
- t,
831
- i,
832
- e.categories,
833
- e.title,
834
- n
835
- ) : new vi(
836
- t,
837
- i,
838
- [e.min, e.max],
839
- e.title,
840
- n
841
- );
842
- }
843
- a(wt, "getAxis");
844
- var J, Pi = (J = class {
845
- constructor(t, i, s, n) {
846
- this.textDimensionCalculator = t, this.chartConfig = i, this.chartData = s, this.chartThemeConfig = n, this.boundingRect = {
847
- x: 0,
848
- y: 0,
849
- width: 0,
850
- height: 0
851
- }, this.showChartTitle = !1;
852
- }
853
- setBoundingBoxXY(t) {
854
- this.boundingRect.x = t.x, this.boundingRect.y = t.y;
855
- }
856
- calculateSpace(t) {
857
- const i = this.textDimensionCalculator.getMaxDimension(
858
- [this.chartData.title],
859
- this.chartConfig.titleFontSize
860
- ), s = Math.max(i.width, t.width), n = i.height + 2 * this.chartConfig.titlePadding;
861
- return i.width <= s && i.height <= n && this.chartConfig.showTitle && this.chartData.title && (this.boundingRect.width = s, this.boundingRect.height = n, this.showChartTitle = !0), {
862
- width: this.boundingRect.width,
863
- height: this.boundingRect.height
864
- };
865
- }
866
- getDrawableElements() {
867
- const t = [];
868
- return this.showChartTitle && t.push({
869
- groupTexts: ["chart-title"],
870
- type: "text",
871
- data: [
872
- {
873
- fontSize: this.chartConfig.titleFontSize,
874
- text: this.chartData.title,
875
- verticalPos: "middle",
876
- horizontalPos: "center",
877
- x: this.boundingRect.x + this.boundingRect.width / 2,
878
- y: this.boundingRect.y + this.boundingRect.height / 2,
879
- fill: this.chartThemeConfig.titleColor,
880
- rotation: 0
881
- }
882
- ]
883
- }), t;
884
- }
885
- }, a(J, "ChartTitle"), J);
886
- function $t(e, t, i, s) {
887
- const n = new Ht(s);
888
- return new Pi(n, e, t, i);
889
- }
890
- a($t, "getChartTitleComponent");
891
- var tt, Li = (tt = class {
892
- constructor(t, i, s, n, o) {
893
- this.plotData = t, this.xAxis = i, this.yAxis = s, this.orientation = n, this.plotIndex = o;
894
- }
895
- getDrawableElement() {
896
- const t = this.plotData.data.map((s) => [
897
- this.xAxis.getScaleValue(s[0]),
898
- this.yAxis.getScaleValue(s[1])
899
- ]);
900
- let i;
901
- return this.orientation === "horizontal" ? i = Wt().y((s) => s[0]).x((s) => s[1])(t) : i = Wt().x((s) => s[0]).y((s) => s[1])(t), i ? [
902
- {
903
- groupTexts: ["plot", `line-plot-${this.plotIndex}`],
904
- type: "path",
905
- data: [
906
- {
907
- path: i,
908
- strokeFill: this.plotData.strokeFill,
909
- strokeWidth: this.plotData.strokeWidth
910
- }
911
- ]
912
- }
913
- ] : [];
914
- }
915
- }, a(tt, "LinePlot"), tt), it, Ei = (it = class {
916
- constructor(t, i, s, n, o, g) {
917
- this.barData = t, this.boundingRect = i, this.xAxis = s, this.yAxis = n, this.orientation = o, this.plotIndex = g;
918
- }
919
- getDrawableElement() {
920
- const t = this.barData.data.map((o) => [
921
- this.xAxis.getScaleValue(o[0]),
922
- this.yAxis.getScaleValue(o[1])
923
- ]), s = Math.min(this.xAxis.getAxisOuterPadding() * 2, this.xAxis.getTickDistance()) * (1 - 0.05), n = s / 2;
924
- return this.orientation === "horizontal" ? [
925
- {
926
- groupTexts: ["plot", `bar-plot-${this.plotIndex}`],
927
- type: "rect",
928
- data: t.map((o) => ({
929
- x: this.boundingRect.x,
930
- y: o[0] - n,
931
- height: s,
932
- width: o[1] - this.boundingRect.x,
933
- fill: this.barData.fill,
934
- strokeWidth: 0,
935
- strokeFill: this.barData.fill
936
- }))
937
- }
938
- ] : [
939
- {
940
- groupTexts: ["plot", `bar-plot-${this.plotIndex}`],
941
- type: "rect",
942
- data: t.map((o) => ({
943
- x: o[0] - n,
944
- y: o[1],
945
- width: s,
946
- height: this.boundingRect.y + this.boundingRect.height - o[1],
947
- fill: this.barData.fill,
948
- strokeWidth: 0,
949
- strokeFill: this.barData.fill
950
- }))
951
- }
952
- ];
953
- }
954
- }, a(it, "BarPlot"), it), et, Ii = (et = class {
955
- constructor(t, i, s) {
956
- this.chartConfig = t, this.chartData = i, this.chartThemeConfig = s, this.boundingRect = {
957
- x: 0,
958
- y: 0,
959
- width: 0,
960
- height: 0
961
- };
962
- }
963
- setAxes(t, i) {
964
- this.xAxis = t, this.yAxis = i;
965
- }
966
- setBoundingBoxXY(t) {
967
- this.boundingRect.x = t.x, this.boundingRect.y = t.y;
968
- }
969
- calculateSpace(t) {
970
- return this.boundingRect.width = t.width, this.boundingRect.height = t.height, {
971
- width: this.boundingRect.width,
972
- height: this.boundingRect.height
973
- };
974
- }
975
- getDrawableElements() {
976
- if (!(this.xAxis && this.yAxis))
977
- throw Error("Axes must be passed to render Plots");
978
- const t = [];
979
- for (const [i, s] of this.chartData.plots.entries())
980
- switch (s.type) {
981
- case "line":
982
- {
983
- const n = new Li(
984
- s,
985
- this.xAxis,
986
- this.yAxis,
987
- this.chartConfig.chartOrientation,
988
- i
989
- );
990
- t.push(...n.getDrawableElement());
991
- }
992
- break;
993
- case "bar":
994
- {
995
- const n = new Ei(
996
- s,
997
- this.boundingRect,
998
- this.xAxis,
999
- this.yAxis,
1000
- this.chartConfig.chartOrientation,
1001
- i
1002
- );
1003
- t.push(...n.getDrawableElement());
1004
- }
1005
- break;
1006
- }
1007
- return t;
1008
- }
1009
- }, a(et, "BasePlot"), et);
1010
- function qt(e, t, i) {
1011
- return new Ii(e, t, i);
1012
- }
1013
- a(qt, "getPlotComponent");
1014
- var st, Mi = (st = class {
1015
- constructor(t, i, s, n) {
1016
- this.chartConfig = t, this.chartData = i, this.componentStore = {
1017
- title: $t(t, i, s, n),
1018
- plot: qt(t, i, s),
1019
- xAxis: wt(
1020
- i.xAxis,
1021
- t.xAxis,
1022
- {
1023
- titleColor: s.xAxisTitleColor,
1024
- labelColor: s.xAxisLabelColor,
1025
- tickColor: s.xAxisTickColor,
1026
- axisLineColor: s.xAxisLineColor
1027
- },
1028
- n
1029
- ),
1030
- yAxis: wt(
1031
- i.yAxis,
1032
- t.yAxis,
1033
- {
1034
- titleColor: s.yAxisTitleColor,
1035
- labelColor: s.yAxisLabelColor,
1036
- tickColor: s.yAxisTickColor,
1037
- axisLineColor: s.yAxisLineColor
1038
- },
1039
- n
1040
- )
1041
- };
1042
- }
1043
- calculateVerticalSpace() {
1044
- let t = this.chartConfig.width, i = this.chartConfig.height, s = 0, n = 0, o = Math.floor(t * this.chartConfig.plotReservedSpacePercent / 100), g = Math.floor(
1045
- i * this.chartConfig.plotReservedSpacePercent / 100
1046
- ), m = this.componentStore.plot.calculateSpace({
1047
- width: o,
1048
- height: g
1049
- });
1050
- t -= m.width, i -= m.height, m = this.componentStore.title.calculateSpace({
1051
- width: this.chartConfig.width,
1052
- height: i
1053
- }), n = m.height, i -= m.height, this.componentStore.xAxis.setAxisPosition("bottom"), m = this.componentStore.xAxis.calculateSpace({
1054
- width: t,
1055
- height: i
1056
- }), i -= m.height, this.componentStore.yAxis.setAxisPosition("left"), m = this.componentStore.yAxis.calculateSpace({
1057
- width: t,
1058
- height: i
1059
- }), s = m.width, t -= m.width, t > 0 && (o += t, t = 0), i > 0 && (g += i, i = 0), this.componentStore.plot.calculateSpace({
1060
- width: o,
1061
- height: g
1062
- }), this.componentStore.plot.setBoundingBoxXY({ x: s, y: n }), this.componentStore.xAxis.setRange([s, s + o]), this.componentStore.xAxis.setBoundingBoxXY({ x: s, y: n + g }), this.componentStore.yAxis.setRange([n, n + g]), this.componentStore.yAxis.setBoundingBoxXY({ x: 0, y: n }), this.chartData.plots.some((p) => At(p)) && this.componentStore.xAxis.recalculateOuterPaddingToDrawBar();
1063
- }
1064
- calculateHorizontalSpace() {
1065
- let t = this.chartConfig.width, i = this.chartConfig.height, s = 0, n = 0, o = 0, g = Math.floor(t * this.chartConfig.plotReservedSpacePercent / 100), m = Math.floor(
1066
- i * this.chartConfig.plotReservedSpacePercent / 100
1067
- ), p = this.componentStore.plot.calculateSpace({
1068
- width: g,
1069
- height: m
1070
- });
1071
- t -= p.width, i -= p.height, p = this.componentStore.title.calculateSpace({
1072
- width: this.chartConfig.width,
1073
- height: i
1074
- }), s = p.height, i -= p.height, this.componentStore.xAxis.setAxisPosition("left"), p = this.componentStore.xAxis.calculateSpace({
1075
- width: t,
1076
- height: i
1077
- }), t -= p.width, n = p.width, this.componentStore.yAxis.setAxisPosition("top"), p = this.componentStore.yAxis.calculateSpace({
1078
- width: t,
1079
- height: i
1080
- }), i -= p.height, o = s + p.height, t > 0 && (g += t, t = 0), i > 0 && (m += i, i = 0), this.componentStore.plot.calculateSpace({
1081
- width: g,
1082
- height: m
1083
- }), this.componentStore.plot.setBoundingBoxXY({ x: n, y: o }), this.componentStore.yAxis.setRange([n, n + g]), this.componentStore.yAxis.setBoundingBoxXY({ x: n, y: s }), this.componentStore.xAxis.setRange([o, o + m]), this.componentStore.xAxis.setBoundingBoxXY({ x: 0, y: o }), this.chartData.plots.some((k) => At(k)) && this.componentStore.xAxis.recalculateOuterPaddingToDrawBar();
1084
- }
1085
- calculateSpace() {
1086
- this.chartConfig.chartOrientation === "horizontal" ? this.calculateHorizontalSpace() : this.calculateVerticalSpace();
1087
- }
1088
- getDrawableElement() {
1089
- this.calculateSpace();
1090
- const t = [];
1091
- this.componentStore.plot.setAxes(this.componentStore.xAxis, this.componentStore.yAxis);
1092
- for (const i of Object.values(this.componentStore))
1093
- t.push(...i.getDrawableElements());
1094
- return t;
1095
- }
1096
- }, a(st, "Orchestrator"), st), nt, Vi = (nt = class {
1097
- static build(t, i, s, n) {
1098
- return new Mi(t, i, s, n).getDrawableElement();
1099
- }
1100
- }, a(nt, "XYChartBuilder"), nt), rt = 0, Gt, ot = Tt(), ht = Rt(), A = Dt(), Ct = ht.plotColorPalette.split(",").map((e) => e.trim()), gt = !1, kt = !1;
1101
- function Rt() {
1102
- const e = wi(), t = St();
1103
- return Yt(e.xyChart, t.themeVariables.xyChart);
1104
- }
1105
- a(Rt, "getChartDefaultThemeConfig");
1106
- function Tt() {
1107
- const e = St();
1108
- return Yt(
1109
- Ai.xyChart,
1110
- e.xyChart
1111
- );
1112
- }
1113
- a(Tt, "getChartDefaultConfig");
1114
- function Dt() {
1115
- return {
1116
- yAxis: {
1117
- type: "linear",
1118
- title: "",
1119
- min: 1 / 0,
1120
- max: -1 / 0
1121
- },
1122
- xAxis: {
1123
- type: "band",
1124
- title: "",
1125
- categories: []
1126
- },
1127
- title: "",
1128
- plots: []
1129
- };
1130
- }
1131
- a(Dt, "getChartDefaultData");
1132
- function xt(e) {
1133
- const t = St();
1134
- return Ci(e.trim(), t);
1135
- }
1136
- a(xt, "textSanitizer");
1137
- function jt(e) {
1138
- Gt = e;
1139
- }
1140
- a(jt, "setTmpSVGG");
1141
- function Qt(e) {
1142
- e === "horizontal" ? ot.chartOrientation = "horizontal" : ot.chartOrientation = "vertical";
1143
- }
1144
- a(Qt, "setOrientation");
1145
- function Kt(e) {
1146
- A.xAxis.title = xt(e.text);
1147
- }
1148
- a(Kt, "setXAxisTitle");
1149
- function vt(e, t) {
1150
- A.xAxis = { type: "linear", title: A.xAxis.title, min: e, max: t }, gt = !0;
1151
- }
1152
- a(vt, "setXAxisRangeData");
1153
- function Zt(e) {
1154
- A.xAxis = {
1155
- type: "band",
1156
- title: A.xAxis.title,
1157
- categories: e.map((t) => xt(t.text))
1158
- }, gt = !0;
1159
- }
1160
- a(Zt, "setXAxisBand");
1161
- function Jt(e) {
1162
- A.yAxis.title = xt(e.text);
1163
- }
1164
- a(Jt, "setYAxisTitle");
1165
- function ti(e, t) {
1166
- A.yAxis = { type: "linear", title: A.yAxis.title, min: e, max: t }, kt = !0;
1167
- }
1168
- a(ti, "setYAxisRangeData");
1169
- function ii(e) {
1170
- const t = Math.min(...e), i = Math.max(...e), s = G(A.yAxis) ? A.yAxis.min : 1 / 0, n = G(A.yAxis) ? A.yAxis.max : -1 / 0;
1171
- A.yAxis = {
1172
- type: "linear",
1173
- title: A.yAxis.title,
1174
- min: Math.min(s, t),
1175
- max: Math.max(n, i)
1176
- };
1177
- }
1178
- a(ii, "setYAxisRangeFromPlotData");
1179
- function Pt(e) {
1180
- let t = [];
1181
- if (e.length === 0)
1182
- return t;
1183
- if (!gt) {
1184
- const i = G(A.xAxis) ? A.xAxis.min : 1 / 0, s = G(A.xAxis) ? A.xAxis.max : -1 / 0;
1185
- vt(Math.min(i, 1), Math.max(s, e.length));
1186
- }
1187
- if (kt || ii(e), _t(A.xAxis) && (t = A.xAxis.categories.map((i, s) => [i, e[s]])), G(A.xAxis)) {
1188
- const i = A.xAxis.min, s = A.xAxis.max, n = (s - i) / (e.length - 1), o = [];
1189
- for (let g = i; g <= s; g += n)
1190
- o.push(`${g}`);
1191
- t = o.map((g, m) => [g, e[m]]);
1192
- }
1193
- return t;
1194
- }
1195
- a(Pt, "transformDataWithoutCategory");
1196
- function Lt(e) {
1197
- return Ct[e === 0 ? 0 : e % Ct.length];
1198
- }
1199
- a(Lt, "getPlotColorFromPalette");
1200
- function ei(e, t) {
1201
- const i = Pt(t);
1202
- A.plots.push({
1203
- type: "line",
1204
- strokeFill: Lt(rt),
1205
- strokeWidth: 2,
1206
- data: i
1207
- }), rt++;
1208
- }
1209
- a(ei, "setLineData");
1210
- function si(e, t) {
1211
- const i = Pt(t);
1212
- A.plots.push({
1213
- type: "bar",
1214
- fill: Lt(rt),
1215
- data: i
1216
- }), rt++;
1217
- }
1218
- a(si, "setBarData");
1219
- function ni() {
1220
- if (A.plots.length === 0)
1221
- throw Error("No Plot to render, please provide a plot with some data");
1222
- return A.title = Xt(), Vi.build(ot, A, ht, Gt);
1223
- }
1224
- a(ni, "getDrawableElem");
1225
- function ai() {
1226
- return ht;
1227
- }
1228
- a(ai, "getChartThemeConfig");
1229
- function ri() {
1230
- return ot;
1231
- }
1232
- a(ri, "getChartConfig");
1233
- function oi() {
1234
- return A;
1235
- }
1236
- a(oi, "getXYChartData");
1237
- var Bi = /* @__PURE__ */ a(function() {
1238
- bi(), rt = 0, ot = Tt(), A = Dt(), ht = Rt(), Ct = ht.plotColorPalette.split(",").map((e) => e.trim()), gt = !1, kt = !1;
1239
- }, "clear"), Wi = {
1240
- getDrawableElem: ni,
1241
- clear: Bi,
1242
- setAccTitle: pi,
1243
- getAccTitle: fi,
1244
- setDiagramTitle: di,
1245
- getDiagramTitle: Xt,
1246
- getAccDescription: xi,
1247
- setAccDescription: gi,
1248
- setOrientation: Qt,
1249
- setXAxisTitle: Kt,
1250
- setXAxisRangeData: vt,
1251
- setXAxisBand: Zt,
1252
- setYAxisTitle: Jt,
1253
- setYAxisRangeData: ti,
1254
- setLineData: ei,
1255
- setBarData: si,
1256
- setTmpSVGG: jt,
1257
- getChartThemeConfig: ai,
1258
- getChartConfig: ri,
1259
- getXYChartData: oi
1260
- }, zi = /* @__PURE__ */ a((e, t, i, s) => {
1261
- const n = s.db, o = n.getChartThemeConfig(), g = n.getChartConfig(), m = n.getXYChartData().plots[0].data.map((y) => y[1]);
1262
- function p(y) {
1263
- return y === "top" ? "text-before-edge" : "middle";
1264
- }
1265
- a(p, "getDominantBaseLine");
1266
- function k(y) {
1267
- return y === "left" ? "start" : y === "right" ? "end" : "middle";
1268
- }
1269
- a(k, "getTextAnchor");
1270
- function v(y) {
1271
- return `translate(${y.x}, ${y.y}) rotate(${y.rotation || 0})`;
1272
- }
1273
- a(v, "getTextTransformation"), Nt.debug(`Rendering xychart chart
1274
- ` + e);
1275
- const C = mi(t), b = C.append("g").attr("class", "main"), E = b.append("rect").attr("width", g.width).attr("height", g.height).attr("class", "background");
1276
- yi(C, g.height, g.width, !0), C.attr("viewBox", `0 0 ${g.width} ${g.height}`), E.attr("fill", o.backgroundColor), n.setTmpSVGG(C.append("g").attr("class", "mermaid-tmp-group"));
1277
- const D = n.getDrawableElem(), P = {};
1278
- function I(y) {
1279
- let _ = b, c = "";
1280
- for (const [W] of y.entries()) {
1281
- let z = b;
1282
- W > 0 && P[c] && (z = P[c]), c += y[W], _ = P[c], _ || (_ = P[c] = z.append("g").attr("class", y[W]));
1283
- }
1284
- return _;
1285
- }
1286
- a(I, "getGroup");
1287
- for (const y of D) {
1288
- if (y.data.length === 0)
1289
- continue;
1290
- const _ = I(y.groupTexts);
1291
- switch (y.type) {
1292
- case "rect":
1293
- if (_.selectAll("rect").data(y.data).enter().append("rect").attr("x", (c) => c.x).attr("y", (c) => c.y).attr("width", (c) => c.width).attr("height", (c) => c.height).attr("fill", (c) => c.fill).attr("stroke", (c) => c.strokeFill).attr("stroke-width", (c) => c.strokeWidth), g.showDataLabel)
1294
- if (g.chartOrientation === "horizontal") {
1295
- let c = function(l, L) {
1296
- const { data: S, label: R } = l;
1297
- return L * R.length * W <= S.width - 10;
1298
- };
1299
- a(c, "fitsHorizontally");
1300
- const W = 0.7, z = y.data.map((l, L) => ({ data: l, label: m[L].toString() })).filter((l) => l.data.width > 0 && l.data.height > 0), U = z.map((l) => {
1301
- const { data: L } = l;
1302
- let S = L.height * 0.7;
1303
- for (; !c(l, S) && S > 0; )
1304
- S -= 1;
1305
- return S;
1306
- }), X = Math.floor(Math.min(...U));
1307
- _.selectAll("text").data(z).enter().append("text").attr("x", (l) => l.data.x + l.data.width - 10).attr("y", (l) => l.data.y + l.data.height / 2).attr("text-anchor", "end").attr("dominant-baseline", "middle").attr("fill", "black").attr("font-size", `${X}px`).text((l) => l.label);
1308
- } else {
1309
- let c = function(l, L, S) {
1310
- const { data: R, label: $ } = l, N = L * $.length * 0.7, F = R.x + R.width / 2, h = F - N / 2, u = F + N / 2, x = h >= R.x && u <= R.x + R.width, d = R.y + S + L <= R.y + R.height;
1311
- return x && d;
1312
- };
1313
- a(c, "fitsInBar");
1314
- const W = 10, z = y.data.map((l, L) => ({ data: l, label: m[L].toString() })).filter((l) => l.data.width > 0 && l.data.height > 0), U = z.map((l) => {
1315
- const { data: L, label: S } = l;
1316
- let R = L.width / (S.length * 0.7);
1317
- for (; !c(l, R, W) && R > 0; )
1318
- R -= 1;
1319
- return R;
1320
- }), X = Math.floor(Math.min(...U));
1321
- _.selectAll("text").data(z).enter().append("text").attr("x", (l) => l.data.x + l.data.width / 2).attr("y", (l) => l.data.y + W).attr("text-anchor", "middle").attr("dominant-baseline", "hanging").attr("fill", "black").attr("font-size", `${X}px`).text((l) => l.label);
1322
- }
1323
- break;
1324
- case "text":
1325
- _.selectAll("text").data(y.data).enter().append("text").attr("x", 0).attr("y", 0).attr("fill", (c) => c.fill).attr("font-size", (c) => c.fontSize).attr("dominant-baseline", (c) => p(c.verticalPos)).attr("text-anchor", (c) => k(c.horizontalPos)).attr("transform", (c) => v(c)).text((c) => c.text);
1326
- break;
1327
- case "path":
1328
- _.selectAll("path").data(y.data).enter().append("path").attr("d", (c) => c.path).attr("fill", (c) => c.fill ? c.fill : "none").attr("stroke", (c) => c.strokeFill).attr("stroke-width", (c) => c.strokeWidth);
1329
- break;
1330
- }
1331
- }
1332
- }, "draw"), Fi = {
1333
- draw: zi
1334
- }, Ui = {
1335
- parser: Ti,
1336
- db: Wi,
1337
- renderer: Fi
1338
- };
1339
- export {
1340
- Ui as diagram
1341
- };