@webskill/sdk 0.21.0 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/dist/abnfDiagram-O67JEVCF-DtYFjfqO.js +109 -0
  2. package/dist/agent.d.ts +3 -3
  3. package/dist/agent.js +1012 -130
  4. package/dist/{approval-DwN2o2QG.js → approval-DWQlDPbY.js} +102 -16
  5. package/dist/arc-8U_6NQWm.js +130 -0
  6. package/dist/architecture-7GRP2DOG-RTw1wpAq.js +4 -0
  7. package/dist/architectureDiagram-NJMV4G6O-XmmXrJAK.js +7473 -0
  8. package/dist/array-DQfpQNY8.js +8 -0
  9. package/dist/blockDiagram-BEXU5L5S-D4yjnCD1.js +2582 -0
  10. package/dist/browser.d.ts +444 -48
  11. package/dist/browser.js +1771 -91
  12. package/dist/c4Diagram-YGBWAQC7-BLmA_JSd.js +3668 -0
  13. package/dist/channel-CZxxLrG7.js +9 -0
  14. package/dist/chunk-2Q5K7J3B-Ck03gkFR.js +21 -0
  15. package/dist/chunk-3FUC2YCW-tr6jmbQf.js +530 -0
  16. package/dist/chunk-5DYCD2WN-Bt97YGTd.js +58 -0
  17. package/dist/chunk-5VM5RSS4-BBxa48HL.js +21 -0
  18. package/dist/chunk-6AEJRKK7-JXK89I-O.js +14 -0
  19. package/dist/chunk-742MDFTN-CPmgCGwC.js +466 -0
  20. package/dist/chunk-7INBJB4K-C9jq9o66.js +6552 -0
  21. package/dist/chunk-7M6MHVWA-BrKCWcR1.js +4894 -0
  22. package/dist/chunk-7PRAP22T-BHED6GVs.js +95 -0
  23. package/dist/chunk-DUW6YSOI-DoZj78PO.js +19 -0
  24. package/dist/chunk-FOHPRMQF-Dkbp819z.js +27189 -0
  25. package/dist/chunk-GNY47TPC-Bpvq1T49.js +87 -0
  26. package/dist/chunk-GTNCS2PH-CLmh4I2c.js +686 -0
  27. package/dist/chunk-GWA4HPMP-B6vN3fkL.js +95 -0
  28. package/dist/chunk-J5ZVWO5B-Bi_Pcobw.js +26 -0
  29. package/dist/chunk-JWPE2WC7-D1rC79GS.js +12 -0
  30. package/dist/chunk-LNGE3PJU-D5OIoe3Z.js +2582 -0
  31. package/dist/chunk-MBY4JIJT-C34L7a4f.js +2276 -0
  32. package/dist/chunk-NETBCI7D-Cg84k8N8.js +321 -0
  33. package/dist/chunk-O7XYJQB3-B6K0KOSL.js +8846 -0
  34. package/dist/chunk-UA2S7LBM-DxHM29_K.js +612 -0
  35. package/dist/chunk-WEXAMYUT-Ba6jFWhB.js +33 -0
  36. package/dist/chunk-XXDRQBXY-DPbSy4kg.js +12 -0
  37. package/dist/chunk-Y2CYZVJY-U3QOMqrW.js +15 -0
  38. package/dist/chunk-Z7XXMR3K-oLg1h8F3.js +1038 -0
  39. package/dist/chunk-ZIGJFQKS-DqEFBuHR.js +2215 -0
  40. package/dist/classDiagram-v2-NBCMYWYE-BqnOWIUt.js +3845 -0
  41. package/dist/cose-bilkent-JH36ORCC-C0dTAHVK.js +4270 -0
  42. package/dist/cynefin-OW5HDTMX-B2QvgEQj.js +4 -0
  43. package/dist/cynefinDiagram-VND7K2PF-yAWc6Z3W.js +479 -0
  44. package/dist/cytoscape.esm-C64mRh9B.js +28325 -0
  45. package/dist/dagre-6A5THRUB-D0w2W27v.js +4816 -0
  46. package/dist/defaultLocale-B_EoOkSF.js +249 -0
  47. package/dist/diagram-22UHCM2B-DvgzhUzP.js +6115 -0
  48. package/dist/diagram-3UASUU5V-DWgUB-ef.js +795 -0
  49. package/dist/diagram-ATOU4E4O-P1olqwIs.js +553 -0
  50. package/dist/diagram-CDSNMT55-BUlZuLUe.js +402 -0
  51. package/dist/diagram-MLGK6HIB-6w5qmkGt.js +186 -0
  52. package/dist/diagram-MPIPVDR6-DEFiSo8o.js +289 -0
  53. package/dist/dist-UajCDt3n.js +92 -0
  54. package/dist/ebnfDiagram-ZINNZB2B-CI8liCfR.js +123 -0
  55. package/dist/elk-276RUBZZ-3SvW6OAK.js +90034 -0
  56. package/dist/erDiagram-OPXOYQCR-CPTbKhwP.js +2301 -0
  57. package/dist/eventmodeling-NTZA5JFV-BlyuqGp0.js +4 -0
  58. package/dist/flowDiagram-KWPJA3E3-CcUJ6HbV.js +18 -0
  59. package/dist/ganttDiagram-FUAMR5RP-31UjY0KK.js +3939 -0
  60. package/dist/{toolSource-C9oNuKmr.js → geometry-wx5ZTYzi.js} +162 -12
  61. package/dist/gitGraph-4MIJSDKK-ChdVlrk7.js +4 -0
  62. package/dist/gitGraphDiagram-X574FWY7-DKuxJymB.js +1153 -0
  63. package/dist/governance.d.ts +3 -3
  64. package/dist/graphlib-tk9gQYuN.js +4194 -0
  65. package/dist/{index-B8Tgmpwh.d.ts → index-BiO9_XRk.d.ts} +2 -2
  66. package/dist/{index-CYLt5u4L.d.ts → index-CjwdZQOS.d.ts} +700 -12
  67. package/dist/{index-DHopiH_m.d.ts → index-YPd8ZSEa.d.ts} +156 -9
  68. package/dist/index.d.ts +4 -4
  69. package/dist/index.js +6 -6
  70. package/dist/info-A6RAGUB7-CxRAt9S9.js +4 -0
  71. package/dist/infoDiagram-VRGFBTTK-pRspGfjZ.js +25 -0
  72. package/dist/init-CMOIWdg-.js +16 -0
  73. package/dist/ishikawaDiagram-OU5B5YK6-DKerAPAg.js +975 -0
  74. package/dist/journeyDiagram-ZHPQQLJL-C4MK-YO5.js +1227 -0
  75. package/dist/kanban-definition-PNTS6WVX-BqsZpMXx.js +1244 -0
  76. package/dist/katex-BcRRvyh_.js +26465 -0
  77. package/dist/{kind-DaKqLX2F.js → kind-Dc8x0HWz.js} +54 -7
  78. package/dist/line-LgV8iVMV.js +48 -0
  79. package/dist/linear-BWKR0Tqd.js +393 -0
  80. package/dist/linkedDocument-CIuh_Yp0.js +416 -0
  81. package/dist/mcp.d.ts +2 -2
  82. package/dist/{memoryArtifactStore-D6dLeY55.js → memoryArtifactStore-Bs7glPqm.js} +14 -0
  83. package/dist/mermaid-parser.core-pYR5siSx.js +754 -0
  84. package/dist/mermaid.core-DMtwGCHy.js +1756 -0
  85. package/dist/mindmap-definition-NLK3R4M7-CXbD-myG.js +1312 -0
  86. package/dist/node.d.ts +3 -3
  87. package/dist/node.js +2 -2
  88. package/dist/{openUiLibrary-b0i7F_oZ.js → openUiLibrary-B7j3rLrm.js} +1 -1
  89. package/dist/{openUiSpecLang-CLXJEeRU.js → openUiSpecLang-BSYYnjay.js} +1 -1
  90. package/dist/ordinal-CxA6GHQS.js +84 -0
  91. package/dist/packet-AYTQ26CC-BOm08cxl.js +4 -0
  92. package/dist/path-C27Z2Bjv.js +106 -0
  93. package/dist/pegDiagram-GJSIUBJH-BLGJOewQ.js +115 -0
  94. package/dist/pie-WAS4IAKB-Dvg7glpk.js +4 -0
  95. package/dist/pieDiagram-5QR66LMP-laoaV_PB.js +298 -0
  96. package/dist/quadrantDiagram-O4NWA36T-Db_wFBkT.js +2236 -0
  97. package/dist/radar-RG4KPBEZ-BZDaTu06.js +4 -0
  98. package/dist/railroad-74A4TZTK-C-UhjkOy.js +4 -0
  99. package/dist/railroad-abnf-HS5TGJTU-dUKVA4OS.js +4 -0
  100. package/dist/railroad-ebnf-LZEXJU2U-DzQumk18.js +4 -0
  101. package/dist/railroad-peg-WCYAUIDC-B3vvTWed.js +4 -0
  102. package/dist/railroadDiagram-XR7U4H2S-BY0sTM4X.js +89 -0
  103. package/dist/requirementDiagram-PLB6GJNP-3rkQfEhs.js +2474 -0
  104. package/dist/rough.cjs-AmDd_NQk.js +1395 -0
  105. package/dist/sankeyDiagram-IPEJSGJF-CGAJhyG2.js +3578 -0
  106. package/dist/sequenceDiagram-PO4LG4MO-9FJjFX06.js +5522 -0
  107. package/dist/sizeCapture-INFHLROL-D8PWxdOn.js +56 -0
  108. package/dist/{skillVersionStore-B24Jjjry-BkOk9wI_.d.ts → skillVersionStore-B24Jjjry-BY1H7Krp.d.ts} +1 -1
  109. package/dist/src-NkhI3UMl.js +2653 -0
  110. package/dist/stateDiagram-v2-GCMORJYK-B0O3wc1-.js +2715 -0
  111. package/dist/swimlanes-2SLR337P-D4EOnrpu.js +6637 -0
  112. package/dist/swimlanesDiagram-TC7HE7FX-BUx29EJ9.js +30 -0
  113. package/dist/testing.d.ts +2 -1
  114. package/dist/testing.js +1 -1
  115. package/dist/timeline-definition-EJHVYXUP-CrgiiB4C.js +1513 -0
  116. package/dist/treeView-Q6P3EWNA-C1by-Gzc.js +4 -0
  117. package/dist/treemap-WGGIJYW6-mC2NZ6ad.js +4 -0
  118. package/dist/{types-BvTV_05--BW8zDuEk.d.ts → types-CpDRZ0rA-BM5FI9oN.d.ts} +59 -8
  119. package/dist/ui-react.d.ts +3 -3
  120. package/dist/ui-react.js +3718 -77
  121. package/dist/ui-vue.d.ts +1 -1
  122. package/dist/ui.d.ts +3 -3
  123. package/dist/ui.js +2 -2
  124. package/dist/usecaseDiagram-POWQR4AR-BUt_TQOY.js +14397 -0
  125. package/dist/vennDiagram-UO4OBE2U-CwXr0wjA.js +2808 -0
  126. package/dist/wardley-WFR3VGLG-CVSYjq_S.js +4 -0
  127. package/dist/wardleyDiagram-VNRHLVJA-Cpfd47dQ.js +874 -0
  128. package/dist/{webSkillApi-Cib6G-94.js → webSkillApi-Dy-Zjv0y.js} +1 -1
  129. package/dist/{webskillLitCatalog-W06npwej.js → webskillLitCatalog-D5BCiMCU.js} +1 -1
  130. package/dist/xychartDiagram-PMCCYNJV-e1TeVoc6.js +2704 -0
  131. package/package.json +1 -1
  132. package/dist/linkedDocument-C0gj1sMq.js +0 -245
@@ -0,0 +1,2704 @@
1
+ import { n as __name } from "./chunk-Y2CYZVJY-U3QOMqrW.js";
2
+ import { m as log } from "./src-NkhI3UMl.js";
3
+ import { D as getThemeVariables3, H as setAccDescription, U as setAccTitle, a as clear, b as getConfig, c as configureSvgSize, f as defaultConfig_default, q as setDiagramTitle, v as getAccDescription, w as getDiagramTitle, y as getAccTitle, z as sanitizeText } from "./chunk-O7XYJQB3-B6K0KOSL.js";
4
+ import { t as linear } from "./linear-BWKR0Tqd.js";
5
+ import { t as ordinal } from "./ordinal-CxA6GHQS.js";
6
+ import { t as initRange } from "./init-CMOIWdg-.js";
7
+ import { i as cleanAndMerge } from "./chunk-ZIGJFQKS-DqEFBuHR.js";
8
+ import { t as line_default } from "./line-LgV8iVMV.js";
9
+ import { t as selectSvgElement } from "./chunk-6AEJRKK7-JXK89I-O.js";
10
+ import "./chunk-742MDFTN-CPmgCGwC.js";
11
+ import { t as computeDimensionOfText } from "./chunk-MBY4JIJT-C34L7a4f.js";
12
+
13
+ //#region ../../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/range.js
14
+ function range(start, stop, step) {
15
+ start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step;
16
+ var i = -1, n = Math.max(0, Math.ceil((stop - start) / step)) | 0, range = new Array(n);
17
+ while (++i < n) range[i] = start + i * step;
18
+ return range;
19
+ }
20
+
21
+ //#endregion
22
+ //#region ../../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/band.js
23
+ function band() {
24
+ var scale = ordinal().unknown(void 0), domain = scale.domain, ordinalRange = scale.range, r0 = 0, r1 = 1, step, bandwidth, round = false, paddingInner = 0, paddingOuter = 0, align = .5;
25
+ delete scale.unknown;
26
+ function rescale() {
27
+ var n = domain().length, reverse = r1 < r0, start = reverse ? r1 : r0, stop = reverse ? r0 : r1;
28
+ step = (stop - start) / Math.max(1, n - paddingInner + paddingOuter * 2);
29
+ if (round) step = Math.floor(step);
30
+ start += (stop - start - step * (n - paddingInner)) * align;
31
+ bandwidth = step * (1 - paddingInner);
32
+ if (round) start = Math.round(start), bandwidth = Math.round(bandwidth);
33
+ var values = range(n).map(function(i) {
34
+ return start + step * i;
35
+ });
36
+ return ordinalRange(reverse ? values.reverse() : values);
37
+ }
38
+ scale.domain = function(_) {
39
+ return arguments.length ? (domain(_), rescale()) : domain();
40
+ };
41
+ scale.range = function(_) {
42
+ return arguments.length ? ([r0, r1] = _, r0 = +r0, r1 = +r1, rescale()) : [r0, r1];
43
+ };
44
+ scale.rangeRound = function(_) {
45
+ return [r0, r1] = _, r0 = +r0, r1 = +r1, round = true, rescale();
46
+ };
47
+ scale.bandwidth = function() {
48
+ return bandwidth;
49
+ };
50
+ scale.step = function() {
51
+ return step;
52
+ };
53
+ scale.round = function(_) {
54
+ return arguments.length ? (round = !!_, rescale()) : round;
55
+ };
56
+ scale.padding = function(_) {
57
+ return arguments.length ? (paddingInner = Math.min(1, paddingOuter = +_), rescale()) : paddingInner;
58
+ };
59
+ scale.paddingInner = function(_) {
60
+ return arguments.length ? (paddingInner = Math.min(1, _), rescale()) : paddingInner;
61
+ };
62
+ scale.paddingOuter = function(_) {
63
+ return arguments.length ? (paddingOuter = +_, rescale()) : paddingOuter;
64
+ };
65
+ scale.align = function(_) {
66
+ return arguments.length ? (align = Math.max(0, Math.min(1, _)), rescale()) : align;
67
+ };
68
+ scale.copy = function() {
69
+ return band(domain(), [r0, r1]).round(round).paddingInner(paddingInner).paddingOuter(paddingOuter).align(align);
70
+ };
71
+ return initRange.apply(rescale(), arguments);
72
+ }
73
+
74
+ //#endregion
75
+ //#region ../../node_modules/.pnpm/mermaid@12.0.0/node_modules/mermaid/dist/chunks/mermaid.core/xychartDiagram-PMCCYNJV.mjs
76
+ var parser = (function() {
77
+ var o = /* @__PURE__ */ __name(function(k, v, o2, l) {
78
+ for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v);
79
+ return o2;
80
+ }, "o"), $V0 = [
81
+ 1,
82
+ 10,
83
+ 12,
84
+ 14,
85
+ 16,
86
+ 18,
87
+ 19,
88
+ 21,
89
+ 23
90
+ ], $V1 = [2, 6], $V2 = [1, 3], $V3 = [1, 5], $V4 = [1, 6], $V5 = [1, 7], $V6 = [
91
+ 1,
92
+ 5,
93
+ 10,
94
+ 12,
95
+ 14,
96
+ 16,
97
+ 18,
98
+ 19,
99
+ 21,
100
+ 23,
101
+ 36,
102
+ 37,
103
+ 38
104
+ ], $V7 = [1, 25], $V8 = [1, 26], $V9 = [1, 28], $Va = [1, 29], $Vb = [1, 30], $Vc = [1, 31], $Vd = [1, 32], $Ve = [1, 33], $Vf = [1, 34], $Vg = [1, 35], $Vh = [1, 36], $Vi = [1, 37], $Vj = [1, 43], $Vk = [1, 42], $Vl = [1, 47], $Vm = [1, 50], $Vn = [
105
+ 1,
106
+ 10,
107
+ 12,
108
+ 14,
109
+ 16,
110
+ 18,
111
+ 19,
112
+ 21,
113
+ 23,
114
+ 36,
115
+ 37,
116
+ 38
117
+ ], $Vo = [
118
+ 1,
119
+ 10,
120
+ 12,
121
+ 14,
122
+ 16,
123
+ 18,
124
+ 19,
125
+ 21,
126
+ 23,
127
+ 24,
128
+ 26,
129
+ 28,
130
+ 29,
131
+ 36,
132
+ 37,
133
+ 38
134
+ ], $Vp = [
135
+ 1,
136
+ 10,
137
+ 12,
138
+ 14,
139
+ 16,
140
+ 18,
141
+ 19,
142
+ 21,
143
+ 23,
144
+ 24,
145
+ 26,
146
+ 28,
147
+ 29,
148
+ 36,
149
+ 37,
150
+ 38,
151
+ 42,
152
+ 43,
153
+ 44,
154
+ 45,
155
+ 46,
156
+ 47,
157
+ 48,
158
+ 49,
159
+ 50,
160
+ 51
161
+ ], $Vq = [1, 65], $Vr = [26, 28];
162
+ var parser2 = {
163
+ trace: /* @__PURE__ */ __name(function trace() {}, "trace"),
164
+ yy: {},
165
+ symbols_: {
166
+ "error": 2,
167
+ "start": 3,
168
+ "eol": 4,
169
+ "XYCHART": 5,
170
+ "chartConfig": 6,
171
+ "document": 7,
172
+ "CHART_ORIENTATION": 8,
173
+ "statement": 9,
174
+ "title": 10,
175
+ "text": 11,
176
+ "X_AXIS": 12,
177
+ "parseXAxis": 13,
178
+ "Y_AXIS": 14,
179
+ "parseYAxis": 15,
180
+ "LINE": 16,
181
+ "plotData": 17,
182
+ "BAR": 18,
183
+ "acc_title": 19,
184
+ "acc_title_value": 20,
185
+ "acc_descr": 21,
186
+ "acc_descr_value": 22,
187
+ "acc_descr_multiline_value": 23,
188
+ "SQUARE_BRACES_START": 24,
189
+ "dataPoints": 25,
190
+ "SQUARE_BRACES_END": 26,
191
+ "dataPoint": 27,
192
+ "COMMA": 28,
193
+ "NUMBER_WITH_DECIMAL": 29,
194
+ "STR": 30,
195
+ "xAxisData": 31,
196
+ "bandData": 32,
197
+ "ARROW_DELIMITER": 33,
198
+ "commaSeparatedTexts": 34,
199
+ "yAxisData": 35,
200
+ "NEWLINE": 36,
201
+ "SEMI": 37,
202
+ "EOF": 38,
203
+ "alphaNum": 39,
204
+ "MD_STR": 40,
205
+ "alphaNumToken": 41,
206
+ "AMP": 42,
207
+ "NUM": 43,
208
+ "ALPHA": 44,
209
+ "PLUS": 45,
210
+ "EQUALS": 46,
211
+ "MULT": 47,
212
+ "DOT": 48,
213
+ "BRKT": 49,
214
+ "MINUS": 50,
215
+ "UNDERSCORE": 51,
216
+ "$accept": 0,
217
+ "$end": 1
218
+ },
219
+ terminals_: {
220
+ 2: "error",
221
+ 5: "XYCHART",
222
+ 8: "CHART_ORIENTATION",
223
+ 10: "title",
224
+ 12: "X_AXIS",
225
+ 14: "Y_AXIS",
226
+ 16: "LINE",
227
+ 18: "BAR",
228
+ 19: "acc_title",
229
+ 20: "acc_title_value",
230
+ 21: "acc_descr",
231
+ 22: "acc_descr_value",
232
+ 23: "acc_descr_multiline_value",
233
+ 24: "SQUARE_BRACES_START",
234
+ 26: "SQUARE_BRACES_END",
235
+ 28: "COMMA",
236
+ 29: "NUMBER_WITH_DECIMAL",
237
+ 30: "STR",
238
+ 33: "ARROW_DELIMITER",
239
+ 36: "NEWLINE",
240
+ 37: "SEMI",
241
+ 38: "EOF",
242
+ 40: "MD_STR",
243
+ 42: "AMP",
244
+ 43: "NUM",
245
+ 44: "ALPHA",
246
+ 45: "PLUS",
247
+ 46: "EQUALS",
248
+ 47: "MULT",
249
+ 48: "DOT",
250
+ 49: "BRKT",
251
+ 50: "MINUS",
252
+ 51: "UNDERSCORE"
253
+ },
254
+ productions_: [
255
+ 0,
256
+ [3, 2],
257
+ [3, 3],
258
+ [3, 2],
259
+ [3, 1],
260
+ [6, 1],
261
+ [7, 0],
262
+ [7, 2],
263
+ [9, 2],
264
+ [9, 2],
265
+ [9, 2],
266
+ [9, 2],
267
+ [9, 2],
268
+ [9, 3],
269
+ [9, 2],
270
+ [9, 3],
271
+ [9, 2],
272
+ [9, 2],
273
+ [9, 1],
274
+ [17, 3],
275
+ [25, 3],
276
+ [25, 1],
277
+ [27, 2],
278
+ [27, 1],
279
+ [13, 1],
280
+ [13, 2],
281
+ [13, 1],
282
+ [31, 1],
283
+ [31, 3],
284
+ [32, 3],
285
+ [34, 3],
286
+ [34, 1],
287
+ [15, 1],
288
+ [15, 2],
289
+ [15, 1],
290
+ [35, 3],
291
+ [4, 1],
292
+ [4, 1],
293
+ [4, 1],
294
+ [11, 1],
295
+ [11, 1],
296
+ [11, 1],
297
+ [39, 1],
298
+ [39, 2],
299
+ [41, 1],
300
+ [41, 1],
301
+ [41, 1],
302
+ [41, 1],
303
+ [41, 1],
304
+ [41, 1],
305
+ [41, 1],
306
+ [41, 1],
307
+ [41, 1],
308
+ [41, 1]
309
+ ],
310
+ performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
311
+ var $0 = $$.length - 1;
312
+ switch (yystate) {
313
+ case 5:
314
+ yy.setOrientation($$[$0]);
315
+ break;
316
+ case 9:
317
+ yy.setDiagramTitle($$[$0].text.trim());
318
+ break;
319
+ case 12:
320
+ yy.setLineData({
321
+ text: "",
322
+ type: "text"
323
+ }, $$[$0]);
324
+ break;
325
+ case 13:
326
+ yy.setLineData($$[$0 - 1], $$[$0]);
327
+ break;
328
+ case 14:
329
+ yy.setBarData({
330
+ text: "",
331
+ type: "text"
332
+ }, $$[$0]);
333
+ break;
334
+ case 15:
335
+ yy.setBarData($$[$0 - 1], $$[$0]);
336
+ break;
337
+ case 16:
338
+ this.$ = $$[$0].trim();
339
+ yy.setAccTitle(this.$);
340
+ break;
341
+ case 17:
342
+ case 18:
343
+ this.$ = $$[$0].trim();
344
+ yy.setAccDescription(this.$);
345
+ break;
346
+ case 19:
347
+ this.$ = $$[$0 - 1];
348
+ break;
349
+ case 20:
350
+ case 30:
351
+ this.$ = [$$[$0 - 2], ...$$[$0]];
352
+ break;
353
+ case 21:
354
+ case 31:
355
+ this.$ = [$$[$0]];
356
+ break;
357
+ case 22:
358
+ this.$ = {
359
+ value: Number($$[$0 - 1]),
360
+ label: $$[$0]
361
+ };
362
+ break;
363
+ case 23:
364
+ this.$ = {
365
+ value: Number($$[$0]),
366
+ label: ""
367
+ };
368
+ break;
369
+ case 24:
370
+ yy.setXAxisTitle($$[$0]);
371
+ break;
372
+ case 25:
373
+ yy.setXAxisTitle($$[$0 - 1]);
374
+ break;
375
+ case 26:
376
+ yy.setXAxisTitle({
377
+ type: "text",
378
+ text: ""
379
+ });
380
+ break;
381
+ case 27:
382
+ yy.setXAxisBand($$[$0]);
383
+ break;
384
+ case 28:
385
+ yy.setXAxisRangeData(Number($$[$0 - 2]), Number($$[$0]));
386
+ break;
387
+ case 29:
388
+ this.$ = $$[$0 - 1];
389
+ break;
390
+ case 32:
391
+ yy.setYAxisTitle($$[$0]);
392
+ break;
393
+ case 33:
394
+ yy.setYAxisTitle($$[$0 - 1]);
395
+ break;
396
+ case 34:
397
+ yy.setYAxisTitle({
398
+ type: "text",
399
+ text: ""
400
+ });
401
+ break;
402
+ case 35:
403
+ yy.setYAxisRangeData(Number($$[$0 - 2]), Number($$[$0]));
404
+ break;
405
+ case 39:
406
+ this.$ = {
407
+ text: $$[$0],
408
+ type: "text"
409
+ };
410
+ break;
411
+ case 40:
412
+ this.$ = {
413
+ text: $$[$0],
414
+ type: "text"
415
+ };
416
+ break;
417
+ case 41:
418
+ this.$ = {
419
+ text: $$[$0],
420
+ type: "markdown"
421
+ };
422
+ break;
423
+ case 42:
424
+ this.$ = $$[$0];
425
+ break;
426
+ case 43:
427
+ this.$ = $$[$0 - 1] + "" + $$[$0];
428
+ break;
429
+ }
430
+ }, "anonymous"),
431
+ table: [
432
+ o($V0, $V1, {
433
+ 3: 1,
434
+ 4: 2,
435
+ 7: 4,
436
+ 5: $V2,
437
+ 36: $V3,
438
+ 37: $V4,
439
+ 38: $V5
440
+ }),
441
+ { 1: [3] },
442
+ o($V0, $V1, {
443
+ 4: 2,
444
+ 7: 4,
445
+ 3: 8,
446
+ 5: $V2,
447
+ 36: $V3,
448
+ 37: $V4,
449
+ 38: $V5
450
+ }),
451
+ o($V0, $V1, {
452
+ 4: 2,
453
+ 7: 4,
454
+ 6: 9,
455
+ 3: 10,
456
+ 5: $V2,
457
+ 8: [1, 11],
458
+ 36: $V3,
459
+ 37: $V4,
460
+ 38: $V5
461
+ }),
462
+ {
463
+ 1: [2, 4],
464
+ 9: 12,
465
+ 10: [1, 13],
466
+ 12: [1, 14],
467
+ 14: [1, 15],
468
+ 16: [1, 16],
469
+ 18: [1, 17],
470
+ 19: [1, 18],
471
+ 21: [1, 19],
472
+ 23: [1, 20]
473
+ },
474
+ o($V6, [2, 36]),
475
+ o($V6, [2, 37]),
476
+ o($V6, [2, 38]),
477
+ { 1: [2, 1] },
478
+ o($V0, $V1, {
479
+ 4: 2,
480
+ 7: 4,
481
+ 3: 21,
482
+ 5: $V2,
483
+ 36: $V3,
484
+ 37: $V4,
485
+ 38: $V5
486
+ }),
487
+ { 1: [2, 3] },
488
+ o($V6, [2, 5]),
489
+ o($V0, [2, 7], {
490
+ 4: 22,
491
+ 36: $V3,
492
+ 37: $V4,
493
+ 38: $V5
494
+ }),
495
+ {
496
+ 11: 23,
497
+ 30: $V7,
498
+ 39: 24,
499
+ 40: $V8,
500
+ 41: 27,
501
+ 42: $V9,
502
+ 43: $Va,
503
+ 44: $Vb,
504
+ 45: $Vc,
505
+ 46: $Vd,
506
+ 47: $Ve,
507
+ 48: $Vf,
508
+ 49: $Vg,
509
+ 50: $Vh,
510
+ 51: $Vi
511
+ },
512
+ {
513
+ 11: 39,
514
+ 13: 38,
515
+ 24: $Vj,
516
+ 29: $Vk,
517
+ 30: $V7,
518
+ 31: 40,
519
+ 32: 41,
520
+ 39: 24,
521
+ 40: $V8,
522
+ 41: 27,
523
+ 42: $V9,
524
+ 43: $Va,
525
+ 44: $Vb,
526
+ 45: $Vc,
527
+ 46: $Vd,
528
+ 47: $Ve,
529
+ 48: $Vf,
530
+ 49: $Vg,
531
+ 50: $Vh,
532
+ 51: $Vi
533
+ },
534
+ {
535
+ 11: 45,
536
+ 15: 44,
537
+ 29: $Vl,
538
+ 30: $V7,
539
+ 35: 46,
540
+ 39: 24,
541
+ 40: $V8,
542
+ 41: 27,
543
+ 42: $V9,
544
+ 43: $Va,
545
+ 44: $Vb,
546
+ 45: $Vc,
547
+ 46: $Vd,
548
+ 47: $Ve,
549
+ 48: $Vf,
550
+ 49: $Vg,
551
+ 50: $Vh,
552
+ 51: $Vi
553
+ },
554
+ {
555
+ 11: 49,
556
+ 17: 48,
557
+ 24: $Vm,
558
+ 30: $V7,
559
+ 39: 24,
560
+ 40: $V8,
561
+ 41: 27,
562
+ 42: $V9,
563
+ 43: $Va,
564
+ 44: $Vb,
565
+ 45: $Vc,
566
+ 46: $Vd,
567
+ 47: $Ve,
568
+ 48: $Vf,
569
+ 49: $Vg,
570
+ 50: $Vh,
571
+ 51: $Vi
572
+ },
573
+ {
574
+ 11: 52,
575
+ 17: 51,
576
+ 24: $Vm,
577
+ 30: $V7,
578
+ 39: 24,
579
+ 40: $V8,
580
+ 41: 27,
581
+ 42: $V9,
582
+ 43: $Va,
583
+ 44: $Vb,
584
+ 45: $Vc,
585
+ 46: $Vd,
586
+ 47: $Ve,
587
+ 48: $Vf,
588
+ 49: $Vg,
589
+ 50: $Vh,
590
+ 51: $Vi
591
+ },
592
+ { 20: [1, 53] },
593
+ { 22: [1, 54] },
594
+ o($Vn, [2, 18]),
595
+ { 1: [2, 2] },
596
+ o($Vn, [2, 8]),
597
+ o($Vn, [2, 9]),
598
+ o($Vo, [2, 39], {
599
+ 41: 55,
600
+ 42: $V9,
601
+ 43: $Va,
602
+ 44: $Vb,
603
+ 45: $Vc,
604
+ 46: $Vd,
605
+ 47: $Ve,
606
+ 48: $Vf,
607
+ 49: $Vg,
608
+ 50: $Vh,
609
+ 51: $Vi
610
+ }),
611
+ o($Vo, [2, 40]),
612
+ o($Vo, [2, 41]),
613
+ o($Vp, [2, 42]),
614
+ o($Vp, [2, 44]),
615
+ o($Vp, [2, 45]),
616
+ o($Vp, [2, 46]),
617
+ o($Vp, [2, 47]),
618
+ o($Vp, [2, 48]),
619
+ o($Vp, [2, 49]),
620
+ o($Vp, [2, 50]),
621
+ o($Vp, [2, 51]),
622
+ o($Vp, [2, 52]),
623
+ o($Vp, [2, 53]),
624
+ o($Vn, [2, 10]),
625
+ o($Vn, [2, 24], {
626
+ 32: 41,
627
+ 31: 56,
628
+ 24: $Vj,
629
+ 29: $Vk
630
+ }),
631
+ o($Vn, [2, 26]),
632
+ o($Vn, [2, 27]),
633
+ { 33: [1, 57] },
634
+ {
635
+ 11: 59,
636
+ 30: $V7,
637
+ 34: 58,
638
+ 39: 24,
639
+ 40: $V8,
640
+ 41: 27,
641
+ 42: $V9,
642
+ 43: $Va,
643
+ 44: $Vb,
644
+ 45: $Vc,
645
+ 46: $Vd,
646
+ 47: $Ve,
647
+ 48: $Vf,
648
+ 49: $Vg,
649
+ 50: $Vh,
650
+ 51: $Vi
651
+ },
652
+ o($Vn, [2, 11]),
653
+ o($Vn, [2, 32], {
654
+ 35: 60,
655
+ 29: $Vl
656
+ }),
657
+ o($Vn, [2, 34]),
658
+ { 33: [1, 61] },
659
+ o($Vn, [2, 12]),
660
+ {
661
+ 17: 62,
662
+ 24: $Vm
663
+ },
664
+ {
665
+ 25: 63,
666
+ 27: 64,
667
+ 29: $Vq
668
+ },
669
+ o($Vn, [2, 14]),
670
+ {
671
+ 17: 66,
672
+ 24: $Vm
673
+ },
674
+ o($Vn, [2, 16]),
675
+ o($Vn, [2, 17]),
676
+ o($Vp, [2, 43]),
677
+ o($Vn, [2, 25]),
678
+ { 29: [1, 67] },
679
+ { 26: [1, 68] },
680
+ {
681
+ 26: [2, 31],
682
+ 28: [1, 69]
683
+ },
684
+ o($Vn, [2, 33]),
685
+ { 29: [1, 70] },
686
+ o($Vn, [2, 13]),
687
+ { 26: [1, 71] },
688
+ {
689
+ 26: [2, 21],
690
+ 28: [1, 72]
691
+ },
692
+ o($Vr, [2, 23], { 30: [1, 73] }),
693
+ o($Vn, [2, 15]),
694
+ o($Vn, [2, 28]),
695
+ o($Vn, [2, 29]),
696
+ {
697
+ 11: 59,
698
+ 30: $V7,
699
+ 34: 74,
700
+ 39: 24,
701
+ 40: $V8,
702
+ 41: 27,
703
+ 42: $V9,
704
+ 43: $Va,
705
+ 44: $Vb,
706
+ 45: $Vc,
707
+ 46: $Vd,
708
+ 47: $Ve,
709
+ 48: $Vf,
710
+ 49: $Vg,
711
+ 50: $Vh,
712
+ 51: $Vi
713
+ },
714
+ o($Vn, [2, 35]),
715
+ o($Vn, [2, 19]),
716
+ {
717
+ 25: 75,
718
+ 27: 64,
719
+ 29: $Vq
720
+ },
721
+ o($Vr, [2, 22]),
722
+ { 26: [2, 30] },
723
+ { 26: [2, 20] }
724
+ ],
725
+ defaultActions: {
726
+ 8: [2, 1],
727
+ 10: [2, 3],
728
+ 21: [2, 2],
729
+ 74: [2, 30],
730
+ 75: [2, 20]
731
+ },
732
+ parseError: /* @__PURE__ */ __name(function parseError(str, hash) {
733
+ if (hash.recoverable) this.trace(str);
734
+ else {
735
+ var error = new Error(str);
736
+ error.hash = hash;
737
+ throw error;
738
+ }
739
+ }, "parseError"),
740
+ parse: /* @__PURE__ */ __name(function parse(input) {
741
+ var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
742
+ var args = lstack.slice.call(arguments, 1);
743
+ var lexer2 = Object.create(this.lexer);
744
+ var sharedState = { yy: {} };
745
+ for (var k in this.yy) if (Object.prototype.hasOwnProperty.call(this.yy, k)) sharedState.yy[k] = this.yy[k];
746
+ lexer2.setInput(input, sharedState.yy);
747
+ sharedState.yy.lexer = lexer2;
748
+ sharedState.yy.parser = this;
749
+ if (typeof lexer2.yylloc == "undefined") lexer2.yylloc = {};
750
+ var yyloc = lexer2.yylloc;
751
+ lstack.push(yyloc);
752
+ var ranges = lexer2.options && lexer2.options.ranges;
753
+ if (typeof sharedState.yy.parseError === "function") this.parseError = sharedState.yy.parseError;
754
+ else this.parseError = Object.getPrototypeOf(this).parseError;
755
+ function popStack(n) {
756
+ stack.length = stack.length - 2 * n;
757
+ vstack.length = vstack.length - n;
758
+ lstack.length = lstack.length - n;
759
+ }
760
+ __name(popStack, "popStack");
761
+ function lex() {
762
+ var token = tstack.pop() || lexer2.lex() || EOF;
763
+ if (typeof token !== "number") {
764
+ if (token instanceof Array) {
765
+ tstack = token;
766
+ token = tstack.pop();
767
+ }
768
+ token = self.symbols_[token] || token;
769
+ }
770
+ return token;
771
+ }
772
+ __name(lex, "lex");
773
+ var symbol, preErrorSymbol, state, action, r, yyval = {}, p, len, newState, expected;
774
+ while (true) {
775
+ state = stack[stack.length - 1];
776
+ if (this.defaultActions[state]) action = this.defaultActions[state];
777
+ else {
778
+ if (symbol === null || typeof symbol == "undefined") symbol = lex();
779
+ action = table[state] && table[state][symbol];
780
+ }
781
+ if (typeof action === "undefined" || !action.length || !action[0]) {
782
+ var errStr = "";
783
+ expected = [];
784
+ for (p in table[state]) if (this.terminals_[p] && p > TERROR) expected.push("'" + this.terminals_[p] + "'");
785
+ if (lexer2.showPosition) errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
786
+ else errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
787
+ this.parseError(errStr, {
788
+ text: lexer2.match,
789
+ token: this.terminals_[symbol] || symbol,
790
+ line: lexer2.yylineno,
791
+ loc: yyloc,
792
+ expected
793
+ });
794
+ }
795
+ if (action[0] instanceof Array && action.length > 1) throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
796
+ switch (action[0]) {
797
+ case 1:
798
+ stack.push(symbol);
799
+ vstack.push(lexer2.yytext);
800
+ lstack.push(lexer2.yylloc);
801
+ stack.push(action[1]);
802
+ symbol = null;
803
+ if (!preErrorSymbol) {
804
+ yyleng = lexer2.yyleng;
805
+ yytext = lexer2.yytext;
806
+ yylineno = lexer2.yylineno;
807
+ yyloc = lexer2.yylloc;
808
+ if (recovering > 0) recovering--;
809
+ } else {
810
+ symbol = preErrorSymbol;
811
+ preErrorSymbol = null;
812
+ }
813
+ break;
814
+ case 2:
815
+ len = this.productions_[action[1]][1];
816
+ yyval.$ = vstack[vstack.length - len];
817
+ yyval._$ = {
818
+ first_line: lstack[lstack.length - (len || 1)].first_line,
819
+ last_line: lstack[lstack.length - 1].last_line,
820
+ first_column: lstack[lstack.length - (len || 1)].first_column,
821
+ last_column: lstack[lstack.length - 1].last_column
822
+ };
823
+ if (ranges) yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]];
824
+ r = this.performAction.apply(yyval, [
825
+ yytext,
826
+ yyleng,
827
+ yylineno,
828
+ sharedState.yy,
829
+ action[1],
830
+ vstack,
831
+ lstack
832
+ ].concat(args));
833
+ if (typeof r !== "undefined") return r;
834
+ if (len) {
835
+ stack = stack.slice(0, -1 * len * 2);
836
+ vstack = vstack.slice(0, -1 * len);
837
+ lstack = lstack.slice(0, -1 * len);
838
+ }
839
+ stack.push(this.productions_[action[1]][0]);
840
+ vstack.push(yyval.$);
841
+ lstack.push(yyval._$);
842
+ newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
843
+ stack.push(newState);
844
+ break;
845
+ case 3: return true;
846
+ }
847
+ }
848
+ return true;
849
+ }, "parse")
850
+ };
851
+ parser2.lexer = /* @__PURE__ */ (function() {
852
+ return {
853
+ EOF: 1,
854
+ parseError: /* @__PURE__ */ __name(function parseError(str, hash) {
855
+ if (this.yy.parser) this.yy.parser.parseError(str, hash);
856
+ else throw new Error(str);
857
+ }, "parseError"),
858
+ setInput: /* @__PURE__ */ __name(function(input, yy) {
859
+ this.yy = yy || this.yy || {};
860
+ this._input = input;
861
+ this._more = this._backtrack = this.done = false;
862
+ this.yylineno = this.yyleng = 0;
863
+ this.yytext = this.matched = this.match = "";
864
+ this.conditionStack = ["INITIAL"];
865
+ this.yylloc = {
866
+ first_line: 1,
867
+ first_column: 0,
868
+ last_line: 1,
869
+ last_column: 0
870
+ };
871
+ if (this.options.ranges) this.yylloc.range = [0, 0];
872
+ this.offset = 0;
873
+ return this;
874
+ }, "setInput"),
875
+ input: /* @__PURE__ */ __name(function() {
876
+ var ch = this._input[0];
877
+ this.yytext += ch;
878
+ this.yyleng++;
879
+ this.offset++;
880
+ this.match += ch;
881
+ this.matched += ch;
882
+ if (ch.match(/(?:\r\n?|\n).*/g)) {
883
+ this.yylineno++;
884
+ this.yylloc.last_line++;
885
+ } else this.yylloc.last_column++;
886
+ if (this.options.ranges) this.yylloc.range[1]++;
887
+ this._input = this._input.slice(1);
888
+ return ch;
889
+ }, "input"),
890
+ unput: /* @__PURE__ */ __name(function(ch) {
891
+ var len = ch.length;
892
+ var lines = ch.split(/(?:\r\n?|\n)/g);
893
+ this._input = ch + this._input;
894
+ this.yytext = this.yytext.substr(0, this.yytext.length - len);
895
+ this.offset -= len;
896
+ var oldLines = this.match.split(/(?:\r\n?|\n)/g);
897
+ this.match = this.match.substr(0, this.match.length - 1);
898
+ this.matched = this.matched.substr(0, this.matched.length - 1);
899
+ if (lines.length - 1) this.yylineno -= lines.length - 1;
900
+ var r = this.yylloc.range;
901
+ this.yylloc = {
902
+ first_line: this.yylloc.first_line,
903
+ last_line: this.yylineno + 1,
904
+ first_column: this.yylloc.first_column,
905
+ last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len
906
+ };
907
+ if (this.options.ranges) this.yylloc.range = [r[0], r[0] + this.yyleng - len];
908
+ this.yyleng = this.yytext.length;
909
+ return this;
910
+ }, "unput"),
911
+ more: /* @__PURE__ */ __name(function() {
912
+ this._more = true;
913
+ return this;
914
+ }, "more"),
915
+ reject: /* @__PURE__ */ __name(function() {
916
+ if (this.options.backtrack_lexer) this._backtrack = true;
917
+ else 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).\n" + this.showPosition(), {
918
+ text: "",
919
+ token: null,
920
+ line: this.yylineno
921
+ });
922
+ return this;
923
+ }, "reject"),
924
+ less: /* @__PURE__ */ __name(function(n) {
925
+ this.unput(this.match.slice(n));
926
+ }, "less"),
927
+ pastInput: /* @__PURE__ */ __name(function() {
928
+ var past = this.matched.substr(0, this.matched.length - this.match.length);
929
+ return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
930
+ }, "pastInput"),
931
+ upcomingInput: /* @__PURE__ */ __name(function() {
932
+ var next = this.match;
933
+ if (next.length < 20) next += this._input.substr(0, 20 - next.length);
934
+ return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
935
+ }, "upcomingInput"),
936
+ showPosition: /* @__PURE__ */ __name(function() {
937
+ var pre = this.pastInput();
938
+ var c = new Array(pre.length + 1).join("-");
939
+ return pre + this.upcomingInput() + "\n" + c + "^";
940
+ }, "showPosition"),
941
+ test_match: /* @__PURE__ */ __name(function(match, indexed_rule) {
942
+ var token, lines, backup;
943
+ if (this.options.backtrack_lexer) {
944
+ backup = {
945
+ yylineno: this.yylineno,
946
+ yylloc: {
947
+ first_line: this.yylloc.first_line,
948
+ last_line: this.last_line,
949
+ first_column: this.yylloc.first_column,
950
+ last_column: this.yylloc.last_column
951
+ },
952
+ yytext: this.yytext,
953
+ match: this.match,
954
+ matches: this.matches,
955
+ matched: this.matched,
956
+ yyleng: this.yyleng,
957
+ offset: this.offset,
958
+ _more: this._more,
959
+ _input: this._input,
960
+ yy: this.yy,
961
+ conditionStack: this.conditionStack.slice(0),
962
+ done: this.done
963
+ };
964
+ if (this.options.ranges) backup.yylloc.range = this.yylloc.range.slice(0);
965
+ }
966
+ lines = match[0].match(/(?:\r\n?|\n).*/g);
967
+ if (lines) this.yylineno += lines.length;
968
+ this.yylloc = {
969
+ first_line: this.yylloc.last_line,
970
+ last_line: this.yylineno + 1,
971
+ first_column: this.yylloc.last_column,
972
+ last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length
973
+ };
974
+ this.yytext += match[0];
975
+ this.match += match[0];
976
+ this.matches = match;
977
+ this.yyleng = this.yytext.length;
978
+ if (this.options.ranges) this.yylloc.range = [this.offset, this.offset += this.yyleng];
979
+ this._more = false;
980
+ this._backtrack = false;
981
+ this._input = this._input.slice(match[0].length);
982
+ this.matched += match[0];
983
+ token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
984
+ if (this.done && this._input) this.done = false;
985
+ if (token) return token;
986
+ else if (this._backtrack) {
987
+ for (var k in backup) this[k] = backup[k];
988
+ return false;
989
+ }
990
+ return false;
991
+ }, "test_match"),
992
+ next: /* @__PURE__ */ __name(function() {
993
+ if (this.done) return this.EOF;
994
+ if (!this._input) this.done = true;
995
+ var token, match, tempMatch, index;
996
+ if (!this._more) {
997
+ this.yytext = "";
998
+ this.match = "";
999
+ }
1000
+ var rules = this._currentRules();
1001
+ for (var i = 0; i < rules.length; i++) {
1002
+ tempMatch = this._input.match(this.rules[rules[i]]);
1003
+ if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
1004
+ match = tempMatch;
1005
+ index = i;
1006
+ if (this.options.backtrack_lexer) {
1007
+ token = this.test_match(tempMatch, rules[i]);
1008
+ if (token !== false) return token;
1009
+ else if (this._backtrack) {
1010
+ match = false;
1011
+ continue;
1012
+ } else return false;
1013
+ } else if (!this.options.flex) break;
1014
+ }
1015
+ }
1016
+ if (match) {
1017
+ token = this.test_match(match, rules[index]);
1018
+ if (token !== false) return token;
1019
+ return false;
1020
+ }
1021
+ if (this._input === "") return this.EOF;
1022
+ else return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
1023
+ text: "",
1024
+ token: null,
1025
+ line: this.yylineno
1026
+ });
1027
+ }, "next"),
1028
+ lex: /* @__PURE__ */ __name(function lex() {
1029
+ var r = this.next();
1030
+ if (r) return r;
1031
+ else return this.lex();
1032
+ }, "lex"),
1033
+ begin: /* @__PURE__ */ __name(function begin(condition) {
1034
+ this.conditionStack.push(condition);
1035
+ }, "begin"),
1036
+ popState: /* @__PURE__ */ __name(function popState() {
1037
+ if (this.conditionStack.length - 1 > 0) return this.conditionStack.pop();
1038
+ else return this.conditionStack[0];
1039
+ }, "popState"),
1040
+ _currentRules: /* @__PURE__ */ __name(function _currentRules() {
1041
+ if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
1042
+ else return this.conditions["INITIAL"].rules;
1043
+ }, "_currentRules"),
1044
+ topState: /* @__PURE__ */ __name(function topState(n) {
1045
+ n = this.conditionStack.length - 1 - Math.abs(n || 0);
1046
+ if (n >= 0) return this.conditionStack[n];
1047
+ else return "INITIAL";
1048
+ }, "topState"),
1049
+ pushState: /* @__PURE__ */ __name(function pushState(condition) {
1050
+ this.begin(condition);
1051
+ }, "pushState"),
1052
+ stateStackSize: /* @__PURE__ */ __name(function stateStackSize() {
1053
+ return this.conditionStack.length;
1054
+ }, "stateStackSize"),
1055
+ options: { "case-insensitive": true },
1056
+ performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
1057
+ switch ($avoiding_name_collisions) {
1058
+ case 0: break;
1059
+ case 1: break;
1060
+ case 2:
1061
+ this.popState();
1062
+ return 36;
1063
+ case 3:
1064
+ this.popState();
1065
+ return 36;
1066
+ case 4: return 36;
1067
+ case 5: break;
1068
+ case 6: return 10;
1069
+ case 7:
1070
+ this.pushState("acc_title");
1071
+ return 19;
1072
+ case 8:
1073
+ this.popState();
1074
+ return "acc_title_value";
1075
+ case 9:
1076
+ this.pushState("acc_descr");
1077
+ return 21;
1078
+ case 10:
1079
+ this.popState();
1080
+ return "acc_descr_value";
1081
+ case 11:
1082
+ this.pushState("acc_descr_multiline");
1083
+ break;
1084
+ case 12:
1085
+ this.popState();
1086
+ break;
1087
+ case 13: return "acc_descr_multiline_value";
1088
+ case 14: return 5;
1089
+ case 15: return 5;
1090
+ case 16: return 8;
1091
+ case 17:
1092
+ this.pushState("axis_data");
1093
+ return "X_AXIS";
1094
+ case 18:
1095
+ this.pushState("axis_data");
1096
+ return "Y_AXIS";
1097
+ case 19:
1098
+ this.pushState("axis_band_data");
1099
+ return 24;
1100
+ case 20: return 33;
1101
+ case 21:
1102
+ this.pushState("data");
1103
+ return 16;
1104
+ case 22:
1105
+ this.pushState("data");
1106
+ return 18;
1107
+ case 23:
1108
+ this.pushState("data_inner");
1109
+ return 24;
1110
+ case 24: return 29;
1111
+ case 25:
1112
+ this.popState();
1113
+ return 26;
1114
+ case 26:
1115
+ this.popState();
1116
+ break;
1117
+ case 27:
1118
+ this.pushState("string");
1119
+ break;
1120
+ case 28:
1121
+ this.popState();
1122
+ break;
1123
+ case 29: return "STR";
1124
+ case 30: return 24;
1125
+ case 31: return 26;
1126
+ case 32: return 44;
1127
+ case 33: return "COLON";
1128
+ case 34: return 45;
1129
+ case 35: return 28;
1130
+ case 36: return 46;
1131
+ case 37: return 47;
1132
+ case 38: return 49;
1133
+ case 39: return 51;
1134
+ case 40: return 48;
1135
+ case 41: return 42;
1136
+ case 42: return 50;
1137
+ case 43: return 43;
1138
+ case 44: break;
1139
+ case 45: return 37;
1140
+ case 46: return 38;
1141
+ }
1142
+ }, "anonymous"),
1143
+ rules: [
1144
+ /^(?:%%(?!\{)[^\n]*)/i,
1145
+ /^(?:[^\}]%%[^\n]*)/i,
1146
+ /^(?:(\r?\n))/i,
1147
+ /^(?:(\r?\n))/i,
1148
+ /^(?:[\n\r]+)/i,
1149
+ /^(?:%%[^\n]*)/i,
1150
+ /^(?:title\b)/i,
1151
+ /^(?:accTitle\s*:\s*)/i,
1152
+ /^(?:(?!\n||)*[^\n]*)/i,
1153
+ /^(?:accDescr\s*:\s*)/i,
1154
+ /^(?:(?!\n||)*[^\n]*)/i,
1155
+ /^(?:accDescr\s*\{\s*)/i,
1156
+ /^(?:\})/i,
1157
+ /^(?:[^\}]*)/i,
1158
+ /^(?:xychart-beta\b)/i,
1159
+ /^(?:xychart\b)/i,
1160
+ /^(?:(?:vertical|horizontal))/i,
1161
+ /^(?:x-axis\b)/i,
1162
+ /^(?:y-axis\b)/i,
1163
+ /^(?:\[)/i,
1164
+ /^(?:-->)/i,
1165
+ /^(?:line\b)/i,
1166
+ /^(?:bar\b)/i,
1167
+ /^(?:\[)/i,
1168
+ /^(?:[+-]?(?:\d+(?:\.\d+)?|\.\d+))/i,
1169
+ /^(?:\])/i,
1170
+ /^(?:(?:`\) \{ this\.pushState\(md_string\); \}\n<md_string>\(\?:\(\?!`"\)\.\)\+ \{ return MD_STR; \}\n<md_string>\(\?:`))/i,
1171
+ /^(?:["])/i,
1172
+ /^(?:["])/i,
1173
+ /^(?:[^"]*)/i,
1174
+ /^(?:\[)/i,
1175
+ /^(?:\])/i,
1176
+ /^(?:[A-Za-z]+)/i,
1177
+ /^(?::)/i,
1178
+ /^(?:\+)/i,
1179
+ /^(?:,)/i,
1180
+ /^(?:=)/i,
1181
+ /^(?:\*)/i,
1182
+ /^(?:#)/i,
1183
+ /^(?:[\_])/i,
1184
+ /^(?:\.)/i,
1185
+ /^(?:&)/i,
1186
+ /^(?:-)/i,
1187
+ /^(?:[0-9]+)/i,
1188
+ /^(?:\s+)/i,
1189
+ /^(?:;)/i,
1190
+ /^(?:$)/i
1191
+ ],
1192
+ conditions: {
1193
+ "data_inner": {
1194
+ "rules": [
1195
+ 0,
1196
+ 1,
1197
+ 4,
1198
+ 5,
1199
+ 6,
1200
+ 7,
1201
+ 9,
1202
+ 11,
1203
+ 14,
1204
+ 15,
1205
+ 16,
1206
+ 17,
1207
+ 18,
1208
+ 21,
1209
+ 22,
1210
+ 24,
1211
+ 25,
1212
+ 26,
1213
+ 27,
1214
+ 30,
1215
+ 31,
1216
+ 32,
1217
+ 33,
1218
+ 34,
1219
+ 35,
1220
+ 36,
1221
+ 37,
1222
+ 38,
1223
+ 39,
1224
+ 40,
1225
+ 41,
1226
+ 42,
1227
+ 43,
1228
+ 44,
1229
+ 45,
1230
+ 46
1231
+ ],
1232
+ "inclusive": true
1233
+ },
1234
+ "data": {
1235
+ "rules": [
1236
+ 0,
1237
+ 1,
1238
+ 3,
1239
+ 4,
1240
+ 5,
1241
+ 6,
1242
+ 7,
1243
+ 9,
1244
+ 11,
1245
+ 14,
1246
+ 15,
1247
+ 16,
1248
+ 17,
1249
+ 18,
1250
+ 21,
1251
+ 22,
1252
+ 23,
1253
+ 26,
1254
+ 27,
1255
+ 30,
1256
+ 31,
1257
+ 32,
1258
+ 33,
1259
+ 34,
1260
+ 35,
1261
+ 36,
1262
+ 37,
1263
+ 38,
1264
+ 39,
1265
+ 40,
1266
+ 41,
1267
+ 42,
1268
+ 43,
1269
+ 44,
1270
+ 45,
1271
+ 46
1272
+ ],
1273
+ "inclusive": true
1274
+ },
1275
+ "axis_band_data": {
1276
+ "rules": [
1277
+ 0,
1278
+ 1,
1279
+ 4,
1280
+ 5,
1281
+ 6,
1282
+ 7,
1283
+ 9,
1284
+ 11,
1285
+ 14,
1286
+ 15,
1287
+ 16,
1288
+ 17,
1289
+ 18,
1290
+ 21,
1291
+ 22,
1292
+ 25,
1293
+ 26,
1294
+ 27,
1295
+ 30,
1296
+ 31,
1297
+ 32,
1298
+ 33,
1299
+ 34,
1300
+ 35,
1301
+ 36,
1302
+ 37,
1303
+ 38,
1304
+ 39,
1305
+ 40,
1306
+ 41,
1307
+ 42,
1308
+ 43,
1309
+ 44,
1310
+ 45,
1311
+ 46
1312
+ ],
1313
+ "inclusive": true
1314
+ },
1315
+ "axis_data": {
1316
+ "rules": [
1317
+ 0,
1318
+ 1,
1319
+ 2,
1320
+ 4,
1321
+ 5,
1322
+ 6,
1323
+ 7,
1324
+ 9,
1325
+ 11,
1326
+ 14,
1327
+ 15,
1328
+ 16,
1329
+ 17,
1330
+ 18,
1331
+ 19,
1332
+ 20,
1333
+ 21,
1334
+ 22,
1335
+ 24,
1336
+ 26,
1337
+ 27,
1338
+ 30,
1339
+ 31,
1340
+ 32,
1341
+ 33,
1342
+ 34,
1343
+ 35,
1344
+ 36,
1345
+ 37,
1346
+ 38,
1347
+ 39,
1348
+ 40,
1349
+ 41,
1350
+ 42,
1351
+ 43,
1352
+ 44,
1353
+ 45,
1354
+ 46
1355
+ ],
1356
+ "inclusive": true
1357
+ },
1358
+ "acc_descr_multiline": {
1359
+ "rules": [12, 13],
1360
+ "inclusive": false
1361
+ },
1362
+ "acc_descr": {
1363
+ "rules": [10],
1364
+ "inclusive": false
1365
+ },
1366
+ "acc_title": {
1367
+ "rules": [8],
1368
+ "inclusive": false
1369
+ },
1370
+ "title": {
1371
+ "rules": [],
1372
+ "inclusive": false
1373
+ },
1374
+ "md_string": {
1375
+ "rules": [],
1376
+ "inclusive": false
1377
+ },
1378
+ "string": {
1379
+ "rules": [28, 29],
1380
+ "inclusive": false
1381
+ },
1382
+ "INITIAL": {
1383
+ "rules": [
1384
+ 0,
1385
+ 1,
1386
+ 4,
1387
+ 5,
1388
+ 6,
1389
+ 7,
1390
+ 9,
1391
+ 11,
1392
+ 14,
1393
+ 15,
1394
+ 16,
1395
+ 17,
1396
+ 18,
1397
+ 21,
1398
+ 22,
1399
+ 26,
1400
+ 27,
1401
+ 30,
1402
+ 31,
1403
+ 32,
1404
+ 33,
1405
+ 34,
1406
+ 35,
1407
+ 36,
1408
+ 37,
1409
+ 38,
1410
+ 39,
1411
+ 40,
1412
+ 41,
1413
+ 42,
1414
+ 43,
1415
+ 44,
1416
+ 45,
1417
+ 46
1418
+ ],
1419
+ "inclusive": true
1420
+ }
1421
+ }
1422
+ };
1423
+ })();
1424
+ function Parser() {
1425
+ this.yy = {};
1426
+ }
1427
+ __name(Parser, "Parser");
1428
+ Parser.prototype = parser2;
1429
+ parser2.Parser = Parser;
1430
+ return new Parser();
1431
+ })();
1432
+ parser.parser = parser;
1433
+ var xychart_default = parser;
1434
+ function isBarPlot(data) {
1435
+ return data.type === "bar";
1436
+ }
1437
+ __name(isBarPlot, "isBarPlot");
1438
+ function isBandAxisData(data) {
1439
+ return data.type === "band";
1440
+ }
1441
+ __name(isBandAxisData, "isBandAxisData");
1442
+ function isLinearAxisData(data) {
1443
+ return data.type === "linear";
1444
+ }
1445
+ __name(isLinearAxisData, "isLinearAxisData");
1446
+ var TextDimensionCalculatorWithFont = class {
1447
+ constructor(parentGroup) {
1448
+ this.parentGroup = parentGroup;
1449
+ }
1450
+ static {
1451
+ __name(this, "TextDimensionCalculatorWithFont");
1452
+ }
1453
+ getMaxDimension(texts, fontSize) {
1454
+ if (!this.parentGroup) return {
1455
+ width: texts.reduce((acc, cur) => Math.max(cur.length, acc), 0) * fontSize,
1456
+ height: fontSize
1457
+ };
1458
+ const dimension = {
1459
+ width: 0,
1460
+ height: 0
1461
+ };
1462
+ const elem = this.parentGroup.append("g").attr("visibility", "hidden").attr("font-size", fontSize);
1463
+ for (const t of texts) {
1464
+ const bbox = computeDimensionOfText(elem, 1, t);
1465
+ const width = bbox ? bbox.width : t.length * fontSize;
1466
+ const height = bbox ? bbox.height : fontSize;
1467
+ dimension.width = Math.max(dimension.width, width);
1468
+ dimension.height = Math.max(dimension.height, height);
1469
+ }
1470
+ elem.remove();
1471
+ return dimension;
1472
+ }
1473
+ };
1474
+ var BAR_WIDTH_TO_TICK_WIDTH_RATIO = .7;
1475
+ var MAX_OUTER_PADDING_PERCENT_FOR_WRT_LABEL = .2;
1476
+ var BaseAxis = class {
1477
+ constructor(axisConfig, title, textDimensionCalculator, axisThemeConfig) {
1478
+ this.axisConfig = axisConfig;
1479
+ this.title = title;
1480
+ this.textDimensionCalculator = textDimensionCalculator;
1481
+ this.axisThemeConfig = axisThemeConfig;
1482
+ this.boundingRect = {
1483
+ x: 0,
1484
+ y: 0,
1485
+ width: 0,
1486
+ height: 0
1487
+ };
1488
+ this.axisPosition = "left";
1489
+ this.showTitle = false;
1490
+ this.showLabel = false;
1491
+ this.showTick = false;
1492
+ this.showAxisLine = false;
1493
+ this.outerPadding = 0;
1494
+ this.titleTextHeight = 0;
1495
+ this.labelTextHeight = 0;
1496
+ this.normalizedLabelRotationInRad = 0;
1497
+ this.range = [0, 10];
1498
+ this.boundingRect = {
1499
+ x: 0,
1500
+ y: 0,
1501
+ width: 0,
1502
+ height: 0
1503
+ };
1504
+ this.axisPosition = "left";
1505
+ this.normalizedLabelRotationInRad = this.axisConfig.labelRotation >= -90 && this.axisConfig.labelRotation <= 90 ? this.axisConfig.labelRotation * Math.PI / 180 : 0;
1506
+ }
1507
+ static {
1508
+ __name(this, "BaseAxis");
1509
+ }
1510
+ setRange(range) {
1511
+ this.range = range;
1512
+ if (this.axisPosition === "left" || this.axisPosition === "right") this.boundingRect.height = range[1] - range[0];
1513
+ else this.boundingRect.width = range[1] - range[0];
1514
+ this.recalculateScale();
1515
+ }
1516
+ getRange() {
1517
+ return [this.range[0] + this.outerPadding, this.range[1] - this.outerPadding];
1518
+ }
1519
+ setAxisPosition(axisPosition) {
1520
+ this.axisPosition = axisPosition;
1521
+ this.setRange(this.range);
1522
+ }
1523
+ getTickDistance() {
1524
+ const range = this.getRange();
1525
+ return Math.abs(range[0] - range[1]) / this.getTickValues().length;
1526
+ }
1527
+ getAxisOuterPadding() {
1528
+ return this.outerPadding;
1529
+ }
1530
+ getLabelDimension() {
1531
+ return this.textDimensionCalculator.getMaxDimension(this.getTickValues().map((tick) => tick.toString()), this.axisConfig.labelFontSize);
1532
+ }
1533
+ recalculateOuterPaddingToDrawBar() {
1534
+ if (BAR_WIDTH_TO_TICK_WIDTH_RATIO * this.getTickDistance() > this.outerPadding * 2) this.outerPadding = Math.floor(BAR_WIDTH_TO_TICK_WIDTH_RATIO * this.getTickDistance() / 2);
1535
+ this.recalculateScale();
1536
+ }
1537
+ calculateSpaceIfDrawnHorizontally(availableSpace) {
1538
+ let availableHeight = availableSpace.height;
1539
+ if (this.axisConfig.showAxisLine && availableHeight > this.axisConfig.axisLineWidth) {
1540
+ availableHeight -= this.axisConfig.axisLineWidth;
1541
+ this.showAxisLine = true;
1542
+ }
1543
+ if (this.axisConfig.showLabel) {
1544
+ const spaceRequired = this.getLabelDimension();
1545
+ const maxPadding = MAX_OUTER_PADDING_PERCENT_FOR_WRT_LABEL * availableSpace.width;
1546
+ this.outerPadding = Math.min(spaceRequired.width / 2, maxPadding);
1547
+ let heightRequired = spaceRequired.height;
1548
+ if (this.axisPosition === "bottom" && this.normalizedLabelRotationInRad !== 0) heightRequired = Math.max(heightRequired, Math.abs(Math.sin(this.normalizedLabelRotationInRad) * spaceRequired.width) + Math.abs(Math.cos(this.normalizedLabelRotationInRad) * spaceRequired.height));
1549
+ heightRequired += this.axisConfig.labelPadding * 2;
1550
+ this.labelTextHeight = spaceRequired.height;
1551
+ if (heightRequired <= availableHeight) {
1552
+ availableHeight -= heightRequired;
1553
+ this.showLabel = true;
1554
+ }
1555
+ }
1556
+ if (this.axisConfig.showTick && availableHeight >= this.axisConfig.tickLength) {
1557
+ this.showTick = true;
1558
+ availableHeight -= this.axisConfig.tickLength;
1559
+ }
1560
+ if (this.axisConfig.showTitle && this.title) {
1561
+ const spaceRequired = this.textDimensionCalculator.getMaxDimension([this.title], this.axisConfig.titleFontSize);
1562
+ const heightRequired = spaceRequired.height + this.axisConfig.titlePadding * 2;
1563
+ this.titleTextHeight = spaceRequired.height;
1564
+ if (heightRequired <= availableHeight) {
1565
+ availableHeight -= heightRequired;
1566
+ this.showTitle = true;
1567
+ }
1568
+ }
1569
+ this.boundingRect.width = availableSpace.width;
1570
+ this.boundingRect.height = availableSpace.height - availableHeight;
1571
+ }
1572
+ calculateSpaceIfDrawnVertical(availableSpace) {
1573
+ let availableWidth = availableSpace.width;
1574
+ if (this.axisConfig.showAxisLine && availableWidth > this.axisConfig.axisLineWidth) {
1575
+ availableWidth -= this.axisConfig.axisLineWidth;
1576
+ this.showAxisLine = true;
1577
+ }
1578
+ if (this.axisConfig.showLabel) {
1579
+ const spaceRequired = this.getLabelDimension();
1580
+ const maxPadding = MAX_OUTER_PADDING_PERCENT_FOR_WRT_LABEL * availableSpace.height;
1581
+ this.outerPadding = Math.min(spaceRequired.height / 2, maxPadding);
1582
+ const widthRequired = spaceRequired.width + this.axisConfig.labelPadding * 2;
1583
+ if (widthRequired <= availableWidth) {
1584
+ availableWidth -= widthRequired;
1585
+ this.showLabel = true;
1586
+ }
1587
+ }
1588
+ if (this.axisConfig.showTick && availableWidth >= this.axisConfig.tickLength) {
1589
+ this.showTick = true;
1590
+ availableWidth -= this.axisConfig.tickLength;
1591
+ }
1592
+ if (this.axisConfig.showTitle && this.title) {
1593
+ const spaceRequired = this.textDimensionCalculator.getMaxDimension([this.title], this.axisConfig.titleFontSize);
1594
+ const widthRequired = spaceRequired.height + this.axisConfig.titlePadding * 2;
1595
+ this.titleTextHeight = spaceRequired.height;
1596
+ if (widthRequired <= availableWidth) {
1597
+ availableWidth -= widthRequired;
1598
+ this.showTitle = true;
1599
+ }
1600
+ }
1601
+ this.boundingRect.width = availableSpace.width - availableWidth;
1602
+ this.boundingRect.height = availableSpace.height;
1603
+ }
1604
+ calculateSpace(availableSpace) {
1605
+ if (this.axisPosition === "left" || this.axisPosition === "right") this.calculateSpaceIfDrawnVertical(availableSpace);
1606
+ else this.calculateSpaceIfDrawnHorizontally(availableSpace);
1607
+ this.recalculateScale();
1608
+ return {
1609
+ width: this.boundingRect.width,
1610
+ height: this.boundingRect.height
1611
+ };
1612
+ }
1613
+ setBoundingBoxXY(point) {
1614
+ this.boundingRect.x = point.x;
1615
+ this.boundingRect.y = point.y;
1616
+ }
1617
+ calculateOffsetByRotation(reference) {
1618
+ const rotation = this.normalizedLabelRotationInRad;
1619
+ if (rotation === 0) return 0;
1620
+ return Math.sin(rotation) * this.getLabelDimension()[reference] / 2;
1621
+ }
1622
+ getDrawableElementsForLeftAxis() {
1623
+ const drawableElement = [];
1624
+ if (this.showAxisLine) {
1625
+ const x = this.boundingRect.x + this.boundingRect.width - this.axisConfig.axisLineWidth / 2;
1626
+ drawableElement.push({
1627
+ type: "path",
1628
+ groupTexts: ["left-axis", "axisl-line"],
1629
+ data: [{
1630
+ path: `M ${x},${this.boundingRect.y} L ${x},${this.boundingRect.y + this.boundingRect.height} `,
1631
+ strokeFill: this.axisThemeConfig.axisLineColor,
1632
+ strokeWidth: this.axisConfig.axisLineWidth
1633
+ }]
1634
+ });
1635
+ }
1636
+ if (this.showLabel) drawableElement.push({
1637
+ type: "text",
1638
+ groupTexts: ["left-axis", "label"],
1639
+ data: this.getTickValues().map((tick) => ({
1640
+ text: tick.toString(),
1641
+ 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),
1642
+ y: this.getScaleValue(tick),
1643
+ fill: this.axisThemeConfig.labelColor,
1644
+ fontSize: this.axisConfig.labelFontSize,
1645
+ rotation: 0,
1646
+ verticalPos: "middle",
1647
+ horizontalPos: "right"
1648
+ }))
1649
+ });
1650
+ if (this.showTick) {
1651
+ const x = this.boundingRect.x + this.boundingRect.width - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0);
1652
+ drawableElement.push({
1653
+ type: "path",
1654
+ groupTexts: ["left-axis", "ticks"],
1655
+ data: this.getTickValues().map((tick) => ({
1656
+ path: `M ${x},${this.getScaleValue(tick)} L ${x - this.axisConfig.tickLength},${this.getScaleValue(tick)}`,
1657
+ strokeFill: this.axisThemeConfig.tickColor,
1658
+ strokeWidth: this.axisConfig.tickWidth
1659
+ }))
1660
+ });
1661
+ }
1662
+ if (this.showTitle) drawableElement.push({
1663
+ type: "text",
1664
+ groupTexts: ["left-axis", "title"],
1665
+ data: [{
1666
+ text: this.title,
1667
+ x: this.boundingRect.x + this.axisConfig.titlePadding,
1668
+ y: this.boundingRect.y + this.boundingRect.height / 2,
1669
+ fill: this.axisThemeConfig.titleColor,
1670
+ fontSize: this.axisConfig.titleFontSize,
1671
+ rotation: 270,
1672
+ verticalPos: "top",
1673
+ horizontalPos: "center"
1674
+ }]
1675
+ });
1676
+ return drawableElement;
1677
+ }
1678
+ getDrawableElementsForBottomAxis() {
1679
+ const drawableElement = [];
1680
+ if (this.showAxisLine) {
1681
+ const y = this.boundingRect.y + this.axisConfig.axisLineWidth / 2;
1682
+ drawableElement.push({
1683
+ type: "path",
1684
+ groupTexts: ["bottom-axis", "axis-line"],
1685
+ data: [{
1686
+ path: `M ${this.boundingRect.x},${y} L ${this.boundingRect.x + this.boundingRect.width},${y}`,
1687
+ strokeFill: this.axisThemeConfig.axisLineColor,
1688
+ strokeWidth: this.axisConfig.axisLineWidth
1689
+ }]
1690
+ });
1691
+ }
1692
+ if (this.showLabel) drawableElement.push({
1693
+ type: "text",
1694
+ groupTexts: ["bottom-axis", "label"],
1695
+ data: this.getTickValues().map((tick) => ({
1696
+ text: tick.toString(),
1697
+ x: this.getScaleValue(tick) + this.calculateOffsetByRotation("height"),
1698
+ y: this.boundingRect.y + this.axisConfig.labelPadding + (this.showTick ? this.axisConfig.tickLength : 0) + (this.showAxisLine ? this.axisConfig.axisLineWidth : 0) + Math.abs(this.calculateOffsetByRotation("width")),
1699
+ fill: this.axisThemeConfig.labelColor,
1700
+ fontSize: this.axisConfig.labelFontSize,
1701
+ rotation: this.normalizedLabelRotationInRad * 180 / Math.PI,
1702
+ verticalPos: "top",
1703
+ horizontalPos: "center"
1704
+ }))
1705
+ });
1706
+ if (this.showTick) {
1707
+ const y = this.boundingRect.y + (this.showAxisLine ? this.axisConfig.axisLineWidth : 0);
1708
+ drawableElement.push({
1709
+ type: "path",
1710
+ groupTexts: ["bottom-axis", "ticks"],
1711
+ data: this.getTickValues().map((tick) => ({
1712
+ path: `M ${this.getScaleValue(tick)},${y} L ${this.getScaleValue(tick)},${y + this.axisConfig.tickLength}`,
1713
+ strokeFill: this.axisThemeConfig.tickColor,
1714
+ strokeWidth: this.axisConfig.tickWidth
1715
+ }))
1716
+ });
1717
+ }
1718
+ if (this.showTitle) drawableElement.push({
1719
+ type: "text",
1720
+ groupTexts: ["bottom-axis", "title"],
1721
+ data: [{
1722
+ text: this.title,
1723
+ x: this.range[0] + (this.range[1] - this.range[0]) / 2,
1724
+ y: this.boundingRect.y + this.boundingRect.height - this.axisConfig.titlePadding - this.titleTextHeight,
1725
+ fill: this.axisThemeConfig.titleColor,
1726
+ fontSize: this.axisConfig.titleFontSize,
1727
+ rotation: 0,
1728
+ verticalPos: "top",
1729
+ horizontalPos: "center"
1730
+ }]
1731
+ });
1732
+ return drawableElement;
1733
+ }
1734
+ getDrawableElementsForTopAxis() {
1735
+ const drawableElement = [];
1736
+ if (this.showAxisLine) {
1737
+ const y = this.boundingRect.y + this.boundingRect.height - this.axisConfig.axisLineWidth / 2;
1738
+ drawableElement.push({
1739
+ type: "path",
1740
+ groupTexts: ["top-axis", "axis-line"],
1741
+ data: [{
1742
+ path: `M ${this.boundingRect.x},${y} L ${this.boundingRect.x + this.boundingRect.width},${y}`,
1743
+ strokeFill: this.axisThemeConfig.axisLineColor,
1744
+ strokeWidth: this.axisConfig.axisLineWidth
1745
+ }]
1746
+ });
1747
+ }
1748
+ if (this.showLabel) drawableElement.push({
1749
+ type: "text",
1750
+ groupTexts: ["top-axis", "label"],
1751
+ data: this.getTickValues().map((tick) => ({
1752
+ text: tick.toString(),
1753
+ x: this.getScaleValue(tick),
1754
+ y: this.boundingRect.y + (this.showTitle ? this.titleTextHeight + this.axisConfig.titlePadding * 2 : 0) + this.axisConfig.labelPadding,
1755
+ fill: this.axisThemeConfig.labelColor,
1756
+ fontSize: this.axisConfig.labelFontSize,
1757
+ rotation: 0,
1758
+ verticalPos: "top",
1759
+ horizontalPos: "center"
1760
+ }))
1761
+ });
1762
+ if (this.showTick) {
1763
+ const y = this.boundingRect.y;
1764
+ drawableElement.push({
1765
+ type: "path",
1766
+ groupTexts: ["top-axis", "ticks"],
1767
+ data: this.getTickValues().map((tick) => ({
1768
+ path: `M ${this.getScaleValue(tick)},${y + this.boundingRect.height - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0)} L ${this.getScaleValue(tick)},${y + this.boundingRect.height - this.axisConfig.tickLength - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0)}`,
1769
+ strokeFill: this.axisThemeConfig.tickColor,
1770
+ strokeWidth: this.axisConfig.tickWidth
1771
+ }))
1772
+ });
1773
+ }
1774
+ if (this.showTitle) drawableElement.push({
1775
+ type: "text",
1776
+ groupTexts: ["top-axis", "title"],
1777
+ data: [{
1778
+ text: this.title,
1779
+ x: this.boundingRect.x + this.boundingRect.width / 2,
1780
+ y: this.boundingRect.y + this.axisConfig.titlePadding,
1781
+ fill: this.axisThemeConfig.titleColor,
1782
+ fontSize: this.axisConfig.titleFontSize,
1783
+ rotation: 0,
1784
+ verticalPos: "top",
1785
+ horizontalPos: "center"
1786
+ }]
1787
+ });
1788
+ return drawableElement;
1789
+ }
1790
+ getDrawableElements() {
1791
+ if (this.axisPosition === "left") return this.getDrawableElementsForLeftAxis();
1792
+ if (this.axisPosition === "right") throw Error("Drawing of right axis is not implemented");
1793
+ if (this.axisPosition === "bottom") return this.getDrawableElementsForBottomAxis();
1794
+ if (this.axisPosition === "top") return this.getDrawableElementsForTopAxis();
1795
+ return [];
1796
+ }
1797
+ };
1798
+ var BandAxis = class extends BaseAxis {
1799
+ static {
1800
+ __name(this, "BandAxis");
1801
+ }
1802
+ constructor(axisConfig, axisThemeConfig, categories, title, textDimensionCalculator) {
1803
+ super(axisConfig, title, textDimensionCalculator, axisThemeConfig);
1804
+ this.categories = categories;
1805
+ this.scale = band().domain(this.categories).range(this.getRange());
1806
+ }
1807
+ setRange(range) {
1808
+ super.setRange(range);
1809
+ }
1810
+ recalculateScale() {
1811
+ this.scale = band().domain(this.categories).range(this.getRange()).paddingInner(1).paddingOuter(0).align(.5);
1812
+ log.trace("BandAxis axis final categories, range: ", this.categories, this.getRange());
1813
+ }
1814
+ getTickValues() {
1815
+ return this.categories;
1816
+ }
1817
+ getScaleValue(value) {
1818
+ return this.scale(value) ?? this.getRange()[0];
1819
+ }
1820
+ };
1821
+ var LinearAxis = class extends BaseAxis {
1822
+ static {
1823
+ __name(this, "LinearAxis");
1824
+ }
1825
+ constructor(axisConfig, axisThemeConfig, domain, title, textDimensionCalculator) {
1826
+ super(axisConfig, title, textDimensionCalculator, axisThemeConfig);
1827
+ this.domain = domain;
1828
+ this.scale = linear().domain(this.domain).range(this.getRange());
1829
+ }
1830
+ getTickValues() {
1831
+ return this.scale.ticks();
1832
+ }
1833
+ recalculateScale() {
1834
+ const domain = [...this.domain];
1835
+ if (this.axisPosition === "left") domain.reverse();
1836
+ this.scale = linear().domain(domain).range(this.getRange());
1837
+ }
1838
+ getScaleValue(value) {
1839
+ return this.scale(value);
1840
+ }
1841
+ };
1842
+ function getAxis(data, axisConfig, axisThemeConfig, tmpSVGGroup2) {
1843
+ const textDimensionCalculator = new TextDimensionCalculatorWithFont(tmpSVGGroup2);
1844
+ if (isBandAxisData(data)) return new BandAxis(axisConfig, axisThemeConfig, data.categories, data.title, textDimensionCalculator);
1845
+ return new LinearAxis(axisConfig, axisThemeConfig, [data.min, data.max], data.title, textDimensionCalculator);
1846
+ }
1847
+ __name(getAxis, "getAxis");
1848
+ var ChartTitle = class {
1849
+ constructor(textDimensionCalculator, chartConfig, chartData, chartThemeConfig) {
1850
+ this.textDimensionCalculator = textDimensionCalculator;
1851
+ this.chartConfig = chartConfig;
1852
+ this.chartData = chartData;
1853
+ this.chartThemeConfig = chartThemeConfig;
1854
+ this.boundingRect = {
1855
+ x: 0,
1856
+ y: 0,
1857
+ width: 0,
1858
+ height: 0
1859
+ };
1860
+ this.showChartTitle = false;
1861
+ }
1862
+ static {
1863
+ __name(this, "ChartTitle");
1864
+ }
1865
+ setBoundingBoxXY(point) {
1866
+ this.boundingRect.x = point.x;
1867
+ this.boundingRect.y = point.y;
1868
+ }
1869
+ calculateSpace(availableSpace) {
1870
+ const titleDimension = this.textDimensionCalculator.getMaxDimension([this.chartData.title], this.chartConfig.titleFontSize);
1871
+ const widthRequired = Math.max(titleDimension.width, availableSpace.width);
1872
+ const heightRequired = titleDimension.height + 2 * this.chartConfig.titlePadding;
1873
+ if (titleDimension.width <= widthRequired && titleDimension.height <= heightRequired && this.chartConfig.showTitle && this.chartData.title) {
1874
+ this.boundingRect.width = widthRequired;
1875
+ this.boundingRect.height = heightRequired;
1876
+ this.showChartTitle = true;
1877
+ }
1878
+ return {
1879
+ width: this.boundingRect.width,
1880
+ height: this.boundingRect.height
1881
+ };
1882
+ }
1883
+ getDrawableElements() {
1884
+ const drawableElem = [];
1885
+ if (this.showChartTitle) drawableElem.push({
1886
+ groupTexts: ["chart-title"],
1887
+ type: "text",
1888
+ data: [{
1889
+ fontSize: this.chartConfig.titleFontSize,
1890
+ text: this.chartData.title,
1891
+ verticalPos: "middle",
1892
+ horizontalPos: "center",
1893
+ x: this.boundingRect.x + this.boundingRect.width / 2,
1894
+ y: this.boundingRect.y + this.boundingRect.height / 2,
1895
+ fill: this.chartThemeConfig.titleColor,
1896
+ rotation: 0
1897
+ }]
1898
+ });
1899
+ return drawableElem;
1900
+ }
1901
+ };
1902
+ function getChartTitleComponent(chartConfig, chartData, chartThemeConfig, tmpSVGGroup2) {
1903
+ return new ChartTitle(new TextDimensionCalculatorWithFont(tmpSVGGroup2), chartConfig, chartData, chartThemeConfig);
1904
+ }
1905
+ __name(getChartTitleComponent, "getChartTitleComponent");
1906
+ var LEGEND_MARKER_TO_FONT_RATIO = .75;
1907
+ var LEGEND_ITEM_SPACING_TO_FONT_RATIO = .5;
1908
+ var LEGEND_MARKER_SPACING_TO_FONT_RATIO = .35;
1909
+ function getLegendLayout(fontSize) {
1910
+ return {
1911
+ fontSize,
1912
+ markerSize: fontSize * LEGEND_MARKER_TO_FONT_RATIO,
1913
+ markerSpacing: fontSize * LEGEND_MARKER_SPACING_TO_FONT_RATIO,
1914
+ itemSpacing: fontSize * LEGEND_ITEM_SPACING_TO_FONT_RATIO
1915
+ };
1916
+ }
1917
+ __name(getLegendLayout, "getLegendLayout");
1918
+ var ChartLegend = class {
1919
+ constructor(textDimensionCalculator, chartConfig, chartData, chartThemeConfig) {
1920
+ this.textDimensionCalculator = textDimensionCalculator;
1921
+ this.chartConfig = chartConfig;
1922
+ this.chartData = chartData;
1923
+ this.chartThemeConfig = chartThemeConfig;
1924
+ this.boundingRect = {
1925
+ x: 0,
1926
+ y: 0,
1927
+ width: 0,
1928
+ height: 0
1929
+ };
1930
+ this.visiblePlots = [];
1931
+ }
1932
+ static {
1933
+ __name(this, "ChartLegend");
1934
+ }
1935
+ setBoundingBoxXY(point) {
1936
+ this.boundingRect.x = point.x;
1937
+ this.boundingRect.y = point.y;
1938
+ }
1939
+ calculateSpace(availableSpace) {
1940
+ this.visiblePlots = this.chartConfig.showLegend ? this.chartData.plots.filter((plot) => plot.title) : [];
1941
+ if (this.visiblePlots.length === 0) {
1942
+ this.boundingRect.width = 0;
1943
+ this.boundingRect.height = 0;
1944
+ return {
1945
+ width: 0,
1946
+ height: 0
1947
+ };
1948
+ }
1949
+ const { fontSize, markerSize, markerSpacing, itemSpacing } = getLegendLayout(this.chartConfig.legendFontSize);
1950
+ const textDimension = this.textDimensionCalculator.getMaxDimension(this.visiblePlots.map((plot) => plot.title), fontSize);
1951
+ const widthRequired = this.chartConfig.legendPadding * 2 + markerSize + markerSpacing + textDimension.width;
1952
+ const heightRequired = this.chartConfig.legendPadding * 2 + this.visiblePlots.length * fontSize + (this.visiblePlots.length - 1) * itemSpacing;
1953
+ if (widthRequired <= availableSpace.width && heightRequired <= availableSpace.height) {
1954
+ this.boundingRect.width = widthRequired;
1955
+ this.boundingRect.height = heightRequired;
1956
+ } else {
1957
+ this.visiblePlots = [];
1958
+ this.boundingRect.width = 0;
1959
+ this.boundingRect.height = 0;
1960
+ }
1961
+ return {
1962
+ width: this.boundingRect.width,
1963
+ height: this.boundingRect.height
1964
+ };
1965
+ }
1966
+ getDrawableElements() {
1967
+ if (this.visiblePlots.length === 0) return [];
1968
+ const { fontSize, markerSize, markerSpacing, itemSpacing } = getLegendLayout(this.chartConfig.legendFontSize);
1969
+ const rowHeight = fontSize + itemSpacing;
1970
+ const startX = this.boundingRect.x + this.chartConfig.legendPadding;
1971
+ const startY = this.boundingRect.y + this.chartConfig.legendPadding;
1972
+ const barMarkers = [];
1973
+ const lineMarkers = [];
1974
+ for (const [index, plot] of this.visiblePlots.entries()) if (isBarPlot(plot)) barMarkers.push({
1975
+ x: startX,
1976
+ y: startY + index * rowHeight,
1977
+ width: markerSize,
1978
+ height: markerSize,
1979
+ fill: plot.fill,
1980
+ strokeFill: plot.fill,
1981
+ strokeWidth: 0
1982
+ });
1983
+ else {
1984
+ const markerY = startY + index * rowHeight + markerSize / 2;
1985
+ lineMarkers.push({
1986
+ path: `M ${startX},${markerY} L ${startX + markerSize},${markerY}`,
1987
+ strokeFill: plot.strokeFill,
1988
+ strokeWidth: plot.strokeWidth
1989
+ });
1990
+ }
1991
+ return [
1992
+ {
1993
+ groupTexts: ["legend", "markers"],
1994
+ type: "rect",
1995
+ data: barMarkers
1996
+ },
1997
+ {
1998
+ groupTexts: ["legend", "markers"],
1999
+ type: "path",
2000
+ data: lineMarkers
2001
+ },
2002
+ {
2003
+ groupTexts: ["legend", "label"],
2004
+ type: "text",
2005
+ data: this.visiblePlots.map((plot, index) => ({
2006
+ text: plot.title,
2007
+ x: startX + markerSize + markerSpacing,
2008
+ y: startY + index * rowHeight + markerSize / 2,
2009
+ fill: this.chartThemeConfig.legendTextColor,
2010
+ fontSize,
2011
+ rotation: 0,
2012
+ verticalPos: "middle",
2013
+ horizontalPos: "left"
2014
+ }))
2015
+ }
2016
+ ];
2017
+ }
2018
+ };
2019
+ function getChartLegendComponent(chartConfig, chartData, chartThemeConfig, tmpSVGGroup2) {
2020
+ return new ChartLegend(new TextDimensionCalculatorWithFont(tmpSVGGroup2), chartConfig, chartData, chartThemeConfig);
2021
+ }
2022
+ __name(getChartLegendComponent, "getChartLegendComponent");
2023
+ var LinePlot = class {
2024
+ constructor(plotData, xAxis, yAxis, orientation, plotIndex2) {
2025
+ this.plotData = plotData;
2026
+ this.xAxis = xAxis;
2027
+ this.yAxis = yAxis;
2028
+ this.orientation = orientation;
2029
+ this.plotIndex = plotIndex2;
2030
+ }
2031
+ static {
2032
+ __name(this, "LinePlot");
2033
+ }
2034
+ getDrawableElement() {
2035
+ const finalData = this.plotData.data.map((d) => [this.xAxis.getScaleValue(d[0]), this.yAxis.getScaleValue(d[1])]);
2036
+ let path;
2037
+ if (this.orientation === "horizontal") path = line_default().y((d) => d[0]).x((d) => d[1])(finalData);
2038
+ else path = line_default().x((d) => d[0]).y((d) => d[1])(finalData);
2039
+ if (!path) return [];
2040
+ const elements = [{
2041
+ groupTexts: ["plot", `line-plot-${this.plotIndex}`],
2042
+ type: "path",
2043
+ data: [{
2044
+ path,
2045
+ strokeFill: this.plotData.strokeFill,
2046
+ strokeWidth: this.plotData.strokeWidth
2047
+ }]
2048
+ }];
2049
+ if (this.plotData.pointLabels && this.plotData.pointLabels.length > 0) {
2050
+ const labelOffset = 10;
2051
+ const fontSize = 12;
2052
+ const textData = [];
2053
+ for (const [i, [px, py]] of finalData.entries()) {
2054
+ const label = this.plotData.pointLabels[i];
2055
+ if (!label) continue;
2056
+ if (this.orientation === "horizontal") textData.push({
2057
+ x: py + labelOffset,
2058
+ y: px,
2059
+ text: label,
2060
+ fill: this.plotData.strokeFill,
2061
+ verticalPos: "middle",
2062
+ horizontalPos: "left",
2063
+ fontSize,
2064
+ rotation: 0
2065
+ });
2066
+ else textData.push({
2067
+ x: px,
2068
+ y: py - labelOffset,
2069
+ text: label,
2070
+ fill: this.plotData.strokeFill,
2071
+ verticalPos: "middle",
2072
+ horizontalPos: "center",
2073
+ fontSize,
2074
+ rotation: 0
2075
+ });
2076
+ }
2077
+ if (textData.length > 0) elements.push({
2078
+ groupTexts: [
2079
+ "plot",
2080
+ `line-plot-${this.plotIndex}`,
2081
+ "labels"
2082
+ ],
2083
+ type: "text",
2084
+ data: textData
2085
+ });
2086
+ }
2087
+ return elements;
2088
+ }
2089
+ };
2090
+ var BarPlot = class {
2091
+ constructor(barData, boundingRect, xAxis, yAxis, orientation, plotIndex2) {
2092
+ this.barData = barData;
2093
+ this.boundingRect = boundingRect;
2094
+ this.xAxis = xAxis;
2095
+ this.yAxis = yAxis;
2096
+ this.orientation = orientation;
2097
+ this.plotIndex = plotIndex2;
2098
+ }
2099
+ static {
2100
+ __name(this, "BarPlot");
2101
+ }
2102
+ getDrawableElement() {
2103
+ const finalData = this.barData.data.map((d) => [this.xAxis.getScaleValue(d[0]), this.yAxis.getScaleValue(d[1])]);
2104
+ const barWidth = Math.min(this.xAxis.getAxisOuterPadding() * 2, this.xAxis.getTickDistance()) * .95;
2105
+ const barWidthHalf = barWidth / 2;
2106
+ if (this.orientation === "horizontal") return [{
2107
+ groupTexts: ["plot", `bar-plot-${this.plotIndex}`],
2108
+ type: "rect",
2109
+ data: finalData.map((data) => ({
2110
+ x: this.boundingRect.x,
2111
+ y: data[0] - barWidthHalf,
2112
+ height: barWidth,
2113
+ width: data[1] - this.boundingRect.x,
2114
+ fill: this.barData.fill,
2115
+ strokeWidth: 0,
2116
+ strokeFill: this.barData.fill
2117
+ }))
2118
+ }];
2119
+ return [{
2120
+ groupTexts: ["plot", `bar-plot-${this.plotIndex}`],
2121
+ type: "rect",
2122
+ data: finalData.map((data) => ({
2123
+ x: data[0] - barWidthHalf,
2124
+ y: data[1],
2125
+ width: barWidth,
2126
+ height: this.boundingRect.y + this.boundingRect.height - data[1],
2127
+ fill: this.barData.fill,
2128
+ strokeWidth: 0,
2129
+ strokeFill: this.barData.fill
2130
+ }))
2131
+ }];
2132
+ }
2133
+ };
2134
+ var BasePlot = class {
2135
+ constructor(chartConfig, chartData, chartThemeConfig) {
2136
+ this.chartConfig = chartConfig;
2137
+ this.chartData = chartData;
2138
+ this.chartThemeConfig = chartThemeConfig;
2139
+ this.boundingRect = {
2140
+ x: 0,
2141
+ y: 0,
2142
+ width: 0,
2143
+ height: 0
2144
+ };
2145
+ }
2146
+ static {
2147
+ __name(this, "BasePlot");
2148
+ }
2149
+ setAxes(xAxis, yAxis) {
2150
+ this.xAxis = xAxis;
2151
+ this.yAxis = yAxis;
2152
+ }
2153
+ setBoundingBoxXY(point) {
2154
+ this.boundingRect.x = point.x;
2155
+ this.boundingRect.y = point.y;
2156
+ }
2157
+ calculateSpace(availableSpace) {
2158
+ this.boundingRect.width = availableSpace.width;
2159
+ this.boundingRect.height = availableSpace.height;
2160
+ return {
2161
+ width: this.boundingRect.width,
2162
+ height: this.boundingRect.height
2163
+ };
2164
+ }
2165
+ getDrawableElements() {
2166
+ if (!(this.xAxis && this.yAxis)) throw Error("Axes must be passed to render Plots");
2167
+ const drawableElem = [];
2168
+ for (const [i, plot] of this.chartData.plots.entries()) switch (plot.type) {
2169
+ case "line":
2170
+ {
2171
+ const linePlot = new LinePlot(plot, this.xAxis, this.yAxis, this.chartConfig.chartOrientation, i);
2172
+ drawableElem.push(...linePlot.getDrawableElement());
2173
+ }
2174
+ break;
2175
+ case "bar":
2176
+ {
2177
+ const barPlot = new BarPlot(plot, this.boundingRect, this.xAxis, this.yAxis, this.chartConfig.chartOrientation, i);
2178
+ drawableElem.push(...barPlot.getDrawableElement());
2179
+ }
2180
+ break;
2181
+ }
2182
+ return drawableElem;
2183
+ }
2184
+ };
2185
+ function getPlotComponent(chartConfig, chartData, chartThemeConfig) {
2186
+ return new BasePlot(chartConfig, chartData, chartThemeConfig);
2187
+ }
2188
+ __name(getPlotComponent, "getPlotComponent");
2189
+ var Orchestrator = class {
2190
+ constructor(chartConfig, chartData, chartThemeConfig, tmpSVGGroup2) {
2191
+ this.chartConfig = chartConfig;
2192
+ this.chartData = chartData;
2193
+ this.componentStore = {
2194
+ title: getChartTitleComponent(chartConfig, chartData, chartThemeConfig, tmpSVGGroup2),
2195
+ plot: getPlotComponent(chartConfig, chartData, chartThemeConfig),
2196
+ legend: getChartLegendComponent(chartConfig, chartData, chartThemeConfig, tmpSVGGroup2),
2197
+ xAxis: getAxis(chartData.xAxis, chartConfig.xAxis, {
2198
+ titleColor: chartThemeConfig.xAxisTitleColor,
2199
+ labelColor: chartThemeConfig.xAxisLabelColor,
2200
+ tickColor: chartThemeConfig.xAxisTickColor,
2201
+ axisLineColor: chartThemeConfig.xAxisLineColor
2202
+ }, tmpSVGGroup2),
2203
+ yAxis: getAxis(chartData.yAxis, chartConfig.yAxis, {
2204
+ titleColor: chartThemeConfig.yAxisTitleColor,
2205
+ labelColor: chartThemeConfig.yAxisLabelColor,
2206
+ tickColor: chartThemeConfig.yAxisTickColor,
2207
+ axisLineColor: chartThemeConfig.yAxisLineColor
2208
+ }, tmpSVGGroup2)
2209
+ };
2210
+ }
2211
+ static {
2212
+ __name(this, "Orchestrator");
2213
+ }
2214
+ calculateVerticalSpace() {
2215
+ let availableWidth = this.chartConfig.width;
2216
+ let availableHeight = this.chartConfig.height;
2217
+ let plotX = 0;
2218
+ let plotY = 0;
2219
+ let legendSpace = {
2220
+ width: 0,
2221
+ height: 0
2222
+ };
2223
+ let chartWidth = Math.floor(availableWidth * this.chartConfig.plotReservedSpacePercent / 100);
2224
+ let chartHeight = Math.floor(availableHeight * this.chartConfig.plotReservedSpacePercent / 100);
2225
+ let spaceUsed = this.componentStore.plot.calculateSpace({
2226
+ width: chartWidth,
2227
+ height: chartHeight
2228
+ });
2229
+ availableWidth -= spaceUsed.width;
2230
+ availableHeight -= spaceUsed.height;
2231
+ spaceUsed = this.componentStore.title.calculateSpace({
2232
+ width: this.chartConfig.width,
2233
+ height: availableHeight
2234
+ });
2235
+ plotY = spaceUsed.height;
2236
+ availableHeight -= spaceUsed.height;
2237
+ this.componentStore.xAxis.setAxisPosition("bottom");
2238
+ spaceUsed = this.componentStore.xAxis.calculateSpace({
2239
+ width: availableWidth,
2240
+ height: availableHeight
2241
+ });
2242
+ availableHeight -= spaceUsed.height;
2243
+ this.componentStore.yAxis.setAxisPosition("left");
2244
+ spaceUsed = this.componentStore.yAxis.calculateSpace({
2245
+ width: availableWidth,
2246
+ height: availableHeight
2247
+ });
2248
+ plotX = spaceUsed.width;
2249
+ availableWidth -= spaceUsed.width;
2250
+ legendSpace = this.componentStore.legend.calculateSpace({
2251
+ width: availableWidth,
2252
+ height: chartHeight
2253
+ });
2254
+ availableWidth -= legendSpace.width;
2255
+ if (availableWidth > 0) {
2256
+ chartWidth += availableWidth;
2257
+ availableWidth = 0;
2258
+ }
2259
+ if (availableHeight > 0) {
2260
+ chartHeight += availableHeight;
2261
+ availableHeight = 0;
2262
+ }
2263
+ this.componentStore.plot.calculateSpace({
2264
+ width: chartWidth,
2265
+ height: chartHeight
2266
+ });
2267
+ this.componentStore.plot.setBoundingBoxXY({
2268
+ x: plotX,
2269
+ y: plotY
2270
+ });
2271
+ this.componentStore.legend.setBoundingBoxXY({
2272
+ x: plotX + chartWidth,
2273
+ y: plotY + Math.max((chartHeight - legendSpace.height) / 2, 0)
2274
+ });
2275
+ this.componentStore.xAxis.setRange([plotX, plotX + chartWidth]);
2276
+ this.componentStore.xAxis.setBoundingBoxXY({
2277
+ x: plotX,
2278
+ y: plotY + chartHeight
2279
+ });
2280
+ this.componentStore.yAxis.setRange([plotY, plotY + chartHeight]);
2281
+ this.componentStore.yAxis.setBoundingBoxXY({
2282
+ x: 0,
2283
+ y: plotY
2284
+ });
2285
+ if (this.chartData.plots.some((p) => isBarPlot(p))) this.componentStore.xAxis.recalculateOuterPaddingToDrawBar();
2286
+ }
2287
+ calculateHorizontalSpace() {
2288
+ let availableWidth = this.chartConfig.width;
2289
+ let availableHeight = this.chartConfig.height;
2290
+ let titleYEnd = 0;
2291
+ let plotX = 0;
2292
+ let plotY = 0;
2293
+ let legendSpace = {
2294
+ width: 0,
2295
+ height: 0
2296
+ };
2297
+ let chartWidth = Math.floor(availableWidth * this.chartConfig.plotReservedSpacePercent / 100);
2298
+ let chartHeight = Math.floor(availableHeight * this.chartConfig.plotReservedSpacePercent / 100);
2299
+ let spaceUsed = this.componentStore.plot.calculateSpace({
2300
+ width: chartWidth,
2301
+ height: chartHeight
2302
+ });
2303
+ availableWidth -= spaceUsed.width;
2304
+ availableHeight -= spaceUsed.height;
2305
+ spaceUsed = this.componentStore.title.calculateSpace({
2306
+ width: this.chartConfig.width,
2307
+ height: availableHeight
2308
+ });
2309
+ titleYEnd = spaceUsed.height;
2310
+ availableHeight -= spaceUsed.height;
2311
+ this.componentStore.xAxis.setAxisPosition("left");
2312
+ spaceUsed = this.componentStore.xAxis.calculateSpace({
2313
+ width: availableWidth,
2314
+ height: availableHeight
2315
+ });
2316
+ availableWidth -= spaceUsed.width;
2317
+ plotX = spaceUsed.width;
2318
+ this.componentStore.yAxis.setAxisPosition("top");
2319
+ spaceUsed = this.componentStore.yAxis.calculateSpace({
2320
+ width: availableWidth,
2321
+ height: availableHeight
2322
+ });
2323
+ availableHeight -= spaceUsed.height;
2324
+ plotY = titleYEnd + spaceUsed.height;
2325
+ legendSpace = this.componentStore.legend.calculateSpace({
2326
+ width: availableWidth,
2327
+ height: chartHeight
2328
+ });
2329
+ availableWidth -= legendSpace.width;
2330
+ if (availableWidth > 0) {
2331
+ chartWidth += availableWidth;
2332
+ availableWidth = 0;
2333
+ }
2334
+ if (availableHeight > 0) {
2335
+ chartHeight += availableHeight;
2336
+ availableHeight = 0;
2337
+ }
2338
+ this.componentStore.plot.calculateSpace({
2339
+ width: chartWidth,
2340
+ height: chartHeight
2341
+ });
2342
+ this.componentStore.plot.setBoundingBoxXY({
2343
+ x: plotX,
2344
+ y: plotY
2345
+ });
2346
+ this.componentStore.legend.setBoundingBoxXY({
2347
+ x: plotX + chartWidth,
2348
+ y: plotY + Math.max((chartHeight - legendSpace.height) / 2, 0)
2349
+ });
2350
+ this.componentStore.yAxis.setRange([plotX, plotX + chartWidth]);
2351
+ this.componentStore.yAxis.setBoundingBoxXY({
2352
+ x: plotX,
2353
+ y: titleYEnd
2354
+ });
2355
+ this.componentStore.xAxis.setRange([plotY, plotY + chartHeight]);
2356
+ this.componentStore.xAxis.setBoundingBoxXY({
2357
+ x: 0,
2358
+ y: plotY
2359
+ });
2360
+ if (this.chartData.plots.some((p) => isBarPlot(p))) this.componentStore.xAxis.recalculateOuterPaddingToDrawBar();
2361
+ }
2362
+ calculateSpace() {
2363
+ if (this.chartConfig.chartOrientation === "horizontal") this.calculateHorizontalSpace();
2364
+ else this.calculateVerticalSpace();
2365
+ }
2366
+ getDrawableElement() {
2367
+ this.calculateSpace();
2368
+ const drawableElem = [];
2369
+ this.componentStore.plot.setAxes(this.componentStore.xAxis, this.componentStore.yAxis);
2370
+ for (const component of Object.values(this.componentStore)) drawableElem.push(...component.getDrawableElements());
2371
+ return drawableElem;
2372
+ }
2373
+ };
2374
+ var XYChartBuilder = class {
2375
+ static {
2376
+ __name(this, "XYChartBuilder");
2377
+ }
2378
+ static build(config, chartData, chartThemeConfig, tmpSVGGroup2) {
2379
+ return new Orchestrator(config, chartData, chartThemeConfig, tmpSVGGroup2).getDrawableElement();
2380
+ }
2381
+ };
2382
+ var plotIndex = 0;
2383
+ var tmpSVGGroup;
2384
+ var xyChartConfig = getChartDefaultConfig();
2385
+ var xyChartThemeConfig = getChartDefaultThemeConfig();
2386
+ var xyChartData = getChartDefaultData();
2387
+ var plotColorPalette = xyChartThemeConfig.plotColorPalette.split(",").map((color) => color.trim());
2388
+ var hasSetXAxis = false;
2389
+ var hasSetYAxis = false;
2390
+ function getChartDefaultThemeConfig() {
2391
+ const defaultThemeVariables = getThemeVariables3();
2392
+ const config = getConfig();
2393
+ return cleanAndMerge(defaultThemeVariables.xyChart, config.themeVariables.xyChart);
2394
+ }
2395
+ __name(getChartDefaultThemeConfig, "getChartDefaultThemeConfig");
2396
+ function getChartDefaultConfig() {
2397
+ const config = getConfig();
2398
+ return cleanAndMerge(defaultConfig_default.xyChart, config.xyChart);
2399
+ }
2400
+ __name(getChartDefaultConfig, "getChartDefaultConfig");
2401
+ function getChartDefaultData() {
2402
+ return {
2403
+ yAxis: {
2404
+ type: "linear",
2405
+ title: "",
2406
+ min: Infinity,
2407
+ max: -Infinity
2408
+ },
2409
+ xAxis: {
2410
+ type: "band",
2411
+ title: "",
2412
+ categories: []
2413
+ },
2414
+ title: "",
2415
+ plots: []
2416
+ };
2417
+ }
2418
+ __name(getChartDefaultData, "getChartDefaultData");
2419
+ function textSanitizer(text) {
2420
+ const config = getConfig();
2421
+ return sanitizeText(text.trim(), config);
2422
+ }
2423
+ __name(textSanitizer, "textSanitizer");
2424
+ function setTmpSVGG(SVGG) {
2425
+ tmpSVGGroup = SVGG;
2426
+ }
2427
+ __name(setTmpSVGG, "setTmpSVGG");
2428
+ function setOrientation(orientation) {
2429
+ if (orientation === "horizontal") xyChartConfig.chartOrientation = "horizontal";
2430
+ else xyChartConfig.chartOrientation = "vertical";
2431
+ }
2432
+ __name(setOrientation, "setOrientation");
2433
+ function setXAxisTitle(title) {
2434
+ xyChartData.xAxis.title = textSanitizer(title.text);
2435
+ }
2436
+ __name(setXAxisTitle, "setXAxisTitle");
2437
+ function setXAxisRangeData(min, max) {
2438
+ xyChartData.xAxis = {
2439
+ type: "linear",
2440
+ title: xyChartData.xAxis.title,
2441
+ min,
2442
+ max
2443
+ };
2444
+ hasSetXAxis = true;
2445
+ }
2446
+ __name(setXAxisRangeData, "setXAxisRangeData");
2447
+ function setXAxisBand(categories) {
2448
+ xyChartData.xAxis = {
2449
+ type: "band",
2450
+ title: xyChartData.xAxis.title,
2451
+ categories: categories.map((c) => textSanitizer(c.text))
2452
+ };
2453
+ hasSetXAxis = true;
2454
+ }
2455
+ __name(setXAxisBand, "setXAxisBand");
2456
+ function setYAxisTitle(title) {
2457
+ xyChartData.yAxis.title = textSanitizer(title.text);
2458
+ }
2459
+ __name(setYAxisTitle, "setYAxisTitle");
2460
+ function setYAxisRangeData(min, max) {
2461
+ xyChartData.yAxis = {
2462
+ type: "linear",
2463
+ title: xyChartData.yAxis.title,
2464
+ min,
2465
+ max
2466
+ };
2467
+ hasSetYAxis = true;
2468
+ }
2469
+ __name(setYAxisRangeData, "setYAxisRangeData");
2470
+ function setYAxisRangeFromPlotData(data) {
2471
+ const minValue = Math.min(...data);
2472
+ const maxValue = Math.max(...data);
2473
+ const prevMinValue = isLinearAxisData(xyChartData.yAxis) ? xyChartData.yAxis.min : Infinity;
2474
+ const prevMaxValue = isLinearAxisData(xyChartData.yAxis) ? xyChartData.yAxis.max : -Infinity;
2475
+ xyChartData.yAxis = {
2476
+ type: "linear",
2477
+ title: xyChartData.yAxis.title,
2478
+ min: Math.min(prevMinValue, minValue),
2479
+ max: Math.max(prevMaxValue, maxValue)
2480
+ };
2481
+ }
2482
+ __name(setYAxisRangeFromPlotData, "setYAxisRangeFromPlotData");
2483
+ function transformDataWithoutCategory(data) {
2484
+ let retData = [];
2485
+ if (data.length === 0) return retData;
2486
+ if (!hasSetXAxis) {
2487
+ const prevMinValue = isLinearAxisData(xyChartData.xAxis) ? xyChartData.xAxis.min : Infinity;
2488
+ const prevMaxValue = isLinearAxisData(xyChartData.xAxis) ? xyChartData.xAxis.max : -Infinity;
2489
+ setXAxisRangeData(Math.min(prevMinValue, 1), Math.max(prevMaxValue, data.length));
2490
+ }
2491
+ if (isBandAxisData(xyChartData.xAxis) && data.length > xyChartData.xAxis.categories.length) data = data.slice(0, xyChartData.xAxis.categories.length);
2492
+ if (!hasSetYAxis) setYAxisRangeFromPlotData(data);
2493
+ if (isBandAxisData(xyChartData.xAxis)) retData = xyChartData.xAxis.categories.map((c, i) => [c, data[i]]);
2494
+ if (isLinearAxisData(xyChartData.xAxis)) {
2495
+ const min = xyChartData.xAxis.min;
2496
+ const max = xyChartData.xAxis.max;
2497
+ if (data.length === 1) retData = [[`${min}`, data[0]]];
2498
+ else {
2499
+ const step = (max - min) / (data.length - 1);
2500
+ retData = data.map((datum, index) => [`${min + index * step}`, datum]);
2501
+ }
2502
+ }
2503
+ return retData;
2504
+ }
2505
+ __name(transformDataWithoutCategory, "transformDataWithoutCategory");
2506
+ function getPlotColorFromPalette(plotIndex2) {
2507
+ return plotColorPalette[plotIndex2 === 0 ? 0 : plotIndex2 % plotColorPalette.length];
2508
+ }
2509
+ __name(getPlotColorFromPalette, "getPlotColorFromPalette");
2510
+ function setLineData(title, data) {
2511
+ const values = data.map((d) => d.value);
2512
+ const labels = data.map((d) => d.label ? textSanitizer(d.label) : "");
2513
+ const plotData = transformDataWithoutCategory(values);
2514
+ const hasAnyLabel = labels.some((l) => l !== "");
2515
+ xyChartData.plots.push({
2516
+ type: "line",
2517
+ title: textSanitizer(title.text),
2518
+ strokeFill: getPlotColorFromPalette(plotIndex),
2519
+ strokeWidth: 2,
2520
+ data: plotData,
2521
+ ...hasAnyLabel ? { pointLabels: labels } : {}
2522
+ });
2523
+ plotIndex++;
2524
+ }
2525
+ __name(setLineData, "setLineData");
2526
+ function setBarData(title, data) {
2527
+ const plotData = transformDataWithoutCategory(data.map((d) => d.value));
2528
+ xyChartData.plots.push({
2529
+ type: "bar",
2530
+ title: textSanitizer(title.text),
2531
+ fill: getPlotColorFromPalette(plotIndex),
2532
+ data: plotData
2533
+ });
2534
+ plotIndex++;
2535
+ }
2536
+ __name(setBarData, "setBarData");
2537
+ function getDrawableElem() {
2538
+ if (xyChartData.plots.length === 0) throw Error("No Plot to render, please provide a plot with some data");
2539
+ xyChartData.title = getDiagramTitle();
2540
+ return XYChartBuilder.build(xyChartConfig, xyChartData, xyChartThemeConfig, tmpSVGGroup);
2541
+ }
2542
+ __name(getDrawableElem, "getDrawableElem");
2543
+ function getChartThemeConfig() {
2544
+ return xyChartThemeConfig;
2545
+ }
2546
+ __name(getChartThemeConfig, "getChartThemeConfig");
2547
+ function getChartConfig() {
2548
+ return xyChartConfig;
2549
+ }
2550
+ __name(getChartConfig, "getChartConfig");
2551
+ function getXYChartData() {
2552
+ return xyChartData;
2553
+ }
2554
+ __name(getXYChartData, "getXYChartData");
2555
+ var diagram = {
2556
+ parser: xychart_default,
2557
+ db: {
2558
+ getDrawableElem,
2559
+ clear: /* @__PURE__ */ __name(function() {
2560
+ clear();
2561
+ plotIndex = 0;
2562
+ xyChartConfig = getChartDefaultConfig();
2563
+ xyChartData = getChartDefaultData();
2564
+ xyChartThemeConfig = getChartDefaultThemeConfig();
2565
+ plotColorPalette = xyChartThemeConfig.plotColorPalette.split(",").map((color) => color.trim());
2566
+ hasSetXAxis = false;
2567
+ hasSetYAxis = false;
2568
+ }, "clear"),
2569
+ setAccTitle,
2570
+ getAccTitle,
2571
+ setDiagramTitle,
2572
+ getDiagramTitle,
2573
+ getAccDescription,
2574
+ setAccDescription,
2575
+ setOrientation,
2576
+ setXAxisTitle,
2577
+ setXAxisRangeData,
2578
+ setXAxisBand,
2579
+ setYAxisTitle,
2580
+ setYAxisRangeData,
2581
+ setLineData,
2582
+ setBarData,
2583
+ setTmpSVGG,
2584
+ getChartThemeConfig,
2585
+ getChartConfig,
2586
+ getXYChartData
2587
+ },
2588
+ renderer: { draw: /* @__PURE__ */ __name((txt, id, _version, diagObj) => {
2589
+ const db = diagObj.db;
2590
+ const themeConfig = db.getChartThemeConfig();
2591
+ const chartConfig = db.getChartConfig();
2592
+ const labelData = db.getXYChartData().plots[0].data.map((data) => data[1]);
2593
+ function getDominantBaseLine(horizontalPos) {
2594
+ return horizontalPos === "top" ? "text-before-edge" : "middle";
2595
+ }
2596
+ __name(getDominantBaseLine, "getDominantBaseLine");
2597
+ function getTextAnchor(verticalPos) {
2598
+ return verticalPos === "left" ? "start" : verticalPos === "right" ? "end" : "middle";
2599
+ }
2600
+ __name(getTextAnchor, "getTextAnchor");
2601
+ function getTextTransformation(data) {
2602
+ return `translate(${data.x}, ${data.y}) rotate(${data.rotation || 0})`;
2603
+ }
2604
+ __name(getTextTransformation, "getTextTransformation");
2605
+ log.debug("Rendering xychart chart\n" + txt);
2606
+ const svg = selectSvgElement(id);
2607
+ const group = svg.append("g").attr("class", "main");
2608
+ const background = group.append("rect").attr("width", chartConfig.width).attr("height", chartConfig.height).attr("class", "background");
2609
+ configureSvgSize(svg, chartConfig.height, chartConfig.width, true);
2610
+ svg.attr("viewBox", `0 0 ${chartConfig.width} ${chartConfig.height}`);
2611
+ background.attr("fill", themeConfig.backgroundColor);
2612
+ db.setTmpSVGG(svg.append("g").attr("class", "mermaid-tmp-group"));
2613
+ const shapes = db.getDrawableElem();
2614
+ const groups = {};
2615
+ function getGroup(gList) {
2616
+ let elem = group;
2617
+ let prefix = "";
2618
+ for (const [i] of gList.entries()) {
2619
+ let parent = group;
2620
+ if (i > 0 && groups[prefix]) parent = groups[prefix];
2621
+ prefix += gList[i];
2622
+ elem = groups[prefix];
2623
+ if (!elem) elem = groups[prefix] = parent.append("g").attr("class", gList[i]);
2624
+ }
2625
+ return elem;
2626
+ }
2627
+ __name(getGroup, "getGroup");
2628
+ for (const shape of shapes) {
2629
+ if (shape.data.length === 0) continue;
2630
+ const shapeGroup = getGroup(shape.groupTexts);
2631
+ switch (shape.type) {
2632
+ case "rect":
2633
+ shapeGroup.selectAll("rect").data(shape.data).enter().append("rect").attr("x", (data) => data.x).attr("y", (data) => data.y).attr("width", (data) => data.width).attr("height", (data) => data.height).attr("fill", (data) => data.fill).attr("stroke", (data) => data.strokeFill).attr("stroke-width", (data) => data.strokeWidth);
2634
+ if (chartConfig.showDataLabel) {
2635
+ const showDataLabelOutsideBar = chartConfig.showDataLabelOutsideBar;
2636
+ if (chartConfig.chartOrientation === "horizontal") {
2637
+ let fitsHorizontally2 = function(item, fontSize) {
2638
+ const { data, label } = item;
2639
+ return fontSize * label.length * charWidthFactor <= data.width - rightMargin;
2640
+ };
2641
+ __name(fitsHorizontally2, "fitsHorizontally");
2642
+ const charWidthFactor = .7;
2643
+ const rightMargin = 10;
2644
+ const validItems = shape.data.map((d, i) => ({
2645
+ data: d,
2646
+ label: labelData[i].toString()
2647
+ })).filter((item) => item.data.width > 0 && item.data.height > 0);
2648
+ const candidateFontSizes = validItems.map((item) => {
2649
+ const { data } = item;
2650
+ let fontSize = data.height * .7;
2651
+ while (!fitsHorizontally2(item, fontSize) && fontSize > 0) fontSize -= 1;
2652
+ return fontSize;
2653
+ });
2654
+ const uniformFontSize = Math.floor(Math.min(...candidateFontSizes));
2655
+ const determineLabelXPosition = /* @__PURE__ */ __name((item) => {
2656
+ if (showDataLabelOutsideBar) return item.data.x + item.data.width + rightMargin;
2657
+ else return item.data.x + item.data.width - rightMargin;
2658
+ }, "determineLabelXPosition");
2659
+ shapeGroup.selectAll("text").data(validItems).enter().append("text").attr("x", determineLabelXPosition).attr("y", (item) => item.data.y + item.data.height / 2).attr("text-anchor", showDataLabelOutsideBar ? "start" : "end").attr("dominant-baseline", "middle").attr("fill", themeConfig.dataLabelColor).attr("font-size", `${uniformFontSize}px`).text((item) => item.label);
2660
+ } else {
2661
+ let fitsInBar2 = function(item, fontSize, yOffset2) {
2662
+ const { data, label } = item;
2663
+ const textWidth = fontSize * label.length * .7;
2664
+ const centerX = data.x + data.width / 2;
2665
+ const leftEdge = centerX - textWidth / 2;
2666
+ const rightEdge = centerX + textWidth / 2;
2667
+ const horizontalFits = leftEdge >= data.x && rightEdge <= data.x + data.width;
2668
+ const verticalFits = data.y + yOffset2 + fontSize <= data.y + data.height;
2669
+ return horizontalFits && verticalFits;
2670
+ };
2671
+ __name(fitsInBar2, "fitsInBar");
2672
+ const yOffset = 10;
2673
+ const validItems = shape.data.map((d, i) => ({
2674
+ data: d,
2675
+ label: labelData[i].toString()
2676
+ })).filter((item) => item.data.width > 0 && item.data.height > 0);
2677
+ const candidateFontSizes = validItems.map((item) => {
2678
+ const { data, label } = item;
2679
+ let fontSize = data.width / (label.length * .7);
2680
+ while (!fitsInBar2(item, fontSize, yOffset) && fontSize > 0) fontSize -= 1;
2681
+ return fontSize;
2682
+ });
2683
+ const uniformFontSize = Math.floor(Math.min(...candidateFontSizes));
2684
+ const determineLabelYPosition = /* @__PURE__ */ __name((item) => {
2685
+ if (showDataLabelOutsideBar) return item.data.y - yOffset;
2686
+ else return item.data.y + yOffset;
2687
+ }, "determineLabelYPosition");
2688
+ shapeGroup.selectAll("text").data(validItems).enter().append("text").attr("x", (item) => item.data.x + item.data.width / 2).attr("y", determineLabelYPosition).attr("text-anchor", "middle").attr("dominant-baseline", showDataLabelOutsideBar ? "auto" : "hanging").attr("fill", themeConfig.dataLabelColor).attr("font-size", `${uniformFontSize}px`).text((item) => item.label);
2689
+ }
2690
+ }
2691
+ break;
2692
+ case "text":
2693
+ shapeGroup.selectAll("text").data(shape.data).enter().append("text").attr("x", 0).attr("y", 0).attr("fill", (data) => data.fill).attr("font-size", (data) => data.fontSize).attr("dominant-baseline", (data) => getDominantBaseLine(data.verticalPos)).attr("text-anchor", (data) => getTextAnchor(data.horizontalPos)).attr("transform", (data) => getTextTransformation(data)).text((data) => data.text);
2694
+ break;
2695
+ case "path":
2696
+ shapeGroup.selectAll("path").data(shape.data).enter().append("path").attr("d", (data) => data.path).attr("fill", (data) => data.fill ? data.fill : "none").attr("stroke", (data) => data.strokeFill).attr("stroke-width", (data) => data.strokeWidth);
2697
+ break;
2698
+ }
2699
+ }
2700
+ }, "draw") }
2701
+ };
2702
+
2703
+ //#endregion
2704
+ export { diagram };