@8btc/xcanvas 0.0.1

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 (121) hide show
  1. package/README.md +70 -0
  2. package/dist/Tableau10-BqnYsPR6.js +9 -0
  3. package/dist/XCanvas-BxdLBkBz.js +27732 -0
  4. package/dist/_commonjs-dynamic-modules-TGKdzP3c.js +6 -0
  5. package/dist/ar-SA-G6X2FPQ2-DjqDLLYL.js +41 -0
  6. package/dist/arc-D1qX5GFf.js +132 -0
  7. package/dist/array-DgktLKBx.js +6 -0
  8. package/dist/az-AZ-76LH7QW2-D7LOsF3_.js +32 -0
  9. package/dist/bg-BG-XCXSNQG7-WI4tFn23.js +36 -0
  10. package/dist/blockDiagram-38ab4fdb-DtemKfEh.js +1811 -0
  11. package/dist/bn-BD-2XOGV67Q-Bugx_8fy.js +36 -0
  12. package/dist/c4Diagram-3d4e48cf-Byd2vU9K.js +2463 -0
  13. package/dist/ca-ES-6MX7JW3Y-6rFwKGsQ.js +39 -0
  14. package/dist/channel-BT_3Ze-Y.js +7 -0
  15. package/dist/chunk-EIO257PC-C7qD7hGu.js +1641 -0
  16. package/dist/classDiagram-70f12bd4-CwfYadk-.js +354 -0
  17. package/dist/classDiagram-v2-f2320105-B28MuM8f.js +284 -0
  18. package/dist/clone-D2FUK8WY.js +8 -0
  19. package/dist/createText-2e5e7dd3-Ca1JfQaJ.js +4914 -0
  20. package/dist/cs-CZ-2BRQDIVT-Dhd8XszK.js +42 -0
  21. package/dist/da-DK-5WZEPLOC-BhL87sSs.js +36 -0
  22. package/dist/de-DE-XR44H4JA-xSrZSV0J.js +39 -0
  23. package/dist/directory-open-01563666-XowynPwH.js +14 -0
  24. package/dist/directory-open-4ed118d0-BwYbu9dw.js +55 -0
  25. package/dist/edges-e0da2a9e-9VbVapWU.js +1840 -0
  26. package/dist/el-GR-BZB4AONW-DQORZ_pY.js +41 -0
  27. package/dist/en-B4ZKOASM-D2BVbEdz.js +39 -0
  28. package/dist/erDiagram-9861fffd-D4S9QDes.js +1318 -0
  29. package/dist/es-ES-U4NZUMDT-C0Q89-0V.js +40 -0
  30. package/dist/eu-ES-A7QVB2H4-BwBW3cEw.js +42 -0
  31. package/dist/fa-IR-HGAKTJCU-DtZ74rm4.js +39 -0
  32. package/dist/fi-FI-Z5N7JZ37-QvQan48z.js +37 -0
  33. package/dist/file-open-002ab408-BNIYSKAV.js +18 -0
  34. package/dist/file-open-7c801643-B_l1UXdI.js +15 -0
  35. package/dist/file-save-3189631c-vzijizFw.js +23 -0
  36. package/dist/file-save-745eba88-B5-wM56X.js +25 -0
  37. package/dist/flowDb-956e92f1-S6T8ppJw.js +1713 -0
  38. package/dist/flowDiagram-66a62f08-C6TTwS5_.js +1264 -0
  39. package/dist/flowDiagram-v2-96b9c2cf-CzfeUNGP.js +24 -0
  40. package/dist/flowchart-elk-definition-4a651766-CRv1kWtk.js +92922 -0
  41. package/dist/fr-FR-RHASNOE6-CZFiweNU.js +40 -0
  42. package/dist/ganttDiagram-c361ad54-CAnfd8Sw.js +3420 -0
  43. package/dist/gitGraphDiagram-72cf32ee-CSGI-xRI.js +1790 -0
  44. package/dist/gl-ES-HMX3MZ6V-Bqv2xL-V.js +41 -0
  45. package/dist/graph-Ct2tKpKj.js +1253 -0
  46. package/dist/he-IL-6SHJWFNN-kso30jhn.js +41 -0
  47. package/dist/hi-IN-IWLTKZ5I-Busk5oaa.js +35 -0
  48. package/dist/hu-HU-A5ZG7DT2-xSR2C2H0.js +38 -0
  49. package/dist/id-ID-SAP4L64H-BQQZYm1L.js +41 -0
  50. package/dist/image-EDRW2JGV-Cx7o2kxD.js +6 -0
  51. package/dist/image-blob-reduce.esm-BKPqMdie.js +2396 -0
  52. package/dist/index-3862675e-B3j3w-v_.js +663 -0
  53. package/dist/index-CLOU2Ikr.js +14364 -0
  54. package/dist/index.css +450 -0
  55. package/dist/index.d.ts +40 -0
  56. package/dist/index.js +7 -0
  57. package/dist/index.umd.cjs +235477 -0
  58. package/dist/infoDiagram-f8f76790-NqA75uBo.js +510 -0
  59. package/dist/init-ZxktEp_H.js +16 -0
  60. package/dist/it-IT-JPQ66NNP-CAMVZrYt.js +42 -0
  61. package/dist/ja-JP-DBVTYXUO-CAX8A_Uj.js +39 -0
  62. package/dist/journeyDiagram-49397b02-By5oBzsZ.js +1182 -0
  63. package/dist/kaa-6HZHGXH3-4-o94cPY.js +32 -0
  64. package/dist/kab-KAB-ZGHBKWFO-CgyjjBvZ.js +39 -0
  65. package/dist/katex-C-jAQc2m.js +14516 -0
  66. package/dist/kk-KZ-P5N5QNE5-BEqZcwLA.js +32 -0
  67. package/dist/km-KH-HSX4SM5Z-DvKDbeH4.js +42 -0
  68. package/dist/ko-KR-MTYHY66A-DKCuAbKE.js +40 -0
  69. package/dist/ku-TR-6OUDTVRD-CNUs4cCe.js +40 -0
  70. package/dist/layout-AJxYKqQV.js +2292 -0
  71. package/dist/line-DJIf5OM8.js +45 -0
  72. package/dist/linear-Cfj4s4vI.js +539 -0
  73. package/dist/lt-LT-XHIRWOB4-gouzGdoW.js +34 -0
  74. package/dist/lv-LV-5QDEKY6T-CTvg1XFv.js +38 -0
  75. package/dist/mindmap-definition-fc14e90a-CBlwH_UF.js +35283 -0
  76. package/dist/mr-IN-CRQNXWMA-QeYm06Kq.js +44 -0
  77. package/dist/my-MM-5M5IBNSE-DG3k9ORf.js +32 -0
  78. package/dist/nb-NO-T6EIAALU-Cj995Nmg.js +41 -0
  79. package/dist/nl-NL-IS3SIHDZ-B-2H7xey.js +39 -0
  80. package/dist/nn-NO-6E72VCQL-DrAwKKTN.js +39 -0
  81. package/dist/oc-FR-POXYY2M6-CeyJD7tq.js +39 -0
  82. package/dist/ordinal-DSZU4PqD.js +76 -0
  83. package/dist/pa-IN-N4M65BXN-DHzi6mjo.js +35 -0
  84. package/dist/path-Cp2qmpkd.js +109 -0
  85. package/dist/percentages-BXMCSKIN-CDYsTuua.js +6 -0
  86. package/dist/pica-CzzcRNRD.js +1702 -0
  87. package/dist/pieDiagram-8a3498a8-DueGoZOh.js +768 -0
  88. package/dist/pl-PL-T2D74RX3-BBNEV2c6.js +40 -0
  89. package/dist/pt-BR-5N22H2LF-D2cTx_F0.js +40 -0
  90. package/dist/pt-PT-UZXXM6DQ-BddvLLsF.js +40 -0
  91. package/dist/quadrantDiagram-120e2f19-Tb6_oGIn.js +1198 -0
  92. package/dist/requirementDiagram-deff3bca-CEeg0ep-.js +1089 -0
  93. package/dist/ro-RO-JPDTUUEW-DynuW50i.js +42 -0
  94. package/dist/roundRect-CjfubgrN.js +152 -0
  95. package/dist/ru-RU-B4JR7IUQ-B5Hecrew.js +40 -0
  96. package/dist/sankeyDiagram-04a897e0-CGTLQ8Gm.js +1172 -0
  97. package/dist/sequenceDiagram-704730f1-CZ72D-Nd.js +3336 -0
  98. package/dist/si-LK-N5RQ5JYF-BGMa93tc.js +32 -0
  99. package/dist/sk-SK-C5VTKIMK-BttCAlBm.js +37 -0
  100. package/dist/sl-SI-NN7IZMDC-DTC59nzG.js +37 -0
  101. package/dist/stateDiagram-587899a1-XISZzz_f.js +451 -0
  102. package/dist/stateDiagram-v2-d93cdb3a-DbCcmzTc.js +319 -0
  103. package/dist/styles-6aaf32cf-CyfdkEib.js +1363 -0
  104. package/dist/styles-9a916d00-zQ92RrTB.js +1483 -0
  105. package/dist/styles-c10674c1-BWmkigmR.js +571 -0
  106. package/dist/subset-shared.chunk-BuFt2PpZ.js +8 -0
  107. package/dist/subset-worker.chunk-CgaFXU4O.js +14 -0
  108. package/dist/sv-SE-XGPEYMSR-BPDlPxC1.js +41 -0
  109. package/dist/svgDrawCommon-08f97a94-CJ0lufOi.js +100 -0
  110. package/dist/ta-IN-2NMHFXQM-CI1ZsNk9.js +40 -0
  111. package/dist/th-TH-HPSO5L25-CUM-w2Qt.js +33 -0
  112. package/dist/timeline-definition-85554ec2-DV6084Gl.js +1210 -0
  113. package/dist/tr-TR-DEFEU3FU-CGpyf_vD.js +38 -0
  114. package/dist/uk-UA-QMV73CPH-Bg15Mv3J.js +37 -0
  115. package/dist/vi-VN-M7AON7JQ-AYmca9so.js +36 -0
  116. package/dist/vite.svg +1 -0
  117. package/dist/xychartDiagram-e933f94c-P1e6EEaH.js +1796 -0
  118. package/dist/zh-CN-LNUGB5OW-Dem2Cc-c.js +41 -0
  119. package/dist/zh-HK-E62DVLB3-BjsDyiLI.js +32 -0
  120. package/dist/zh-TW-RAJ6MFWO-IDAsc9Pz.js +40 -0
  121. package/package.json +52 -0
@@ -0,0 +1,1796 @@
1
+ import { s as setAccDescription, a as getAccDescription, o as getDiagramTitle, p as setDiagramTitle, b as getAccTitle, c as setAccTitle, l as log$1, B as selectSvgElement, e as configureSvgSize, r as clear$1, X as getConfig$1, a8 as cleanAndMerge, Q as defaultConfig$2, R as getThemeVariables$2, i as sanitizeText$2 } from "./index-CLOU2Ikr.js";
2
+ import { a as computeDimensionOfText } from "./createText-2e5e7dd3-Ca1JfQaJ.js";
3
+ import { i as initRange } from "./init-ZxktEp_H.js";
4
+ import { o as ordinal } from "./ordinal-DSZU4PqD.js";
5
+ import { l as linear } from "./linear-Cfj4s4vI.js";
6
+ import { l as line } from "./line-DJIf5OM8.js";
7
+ function range(start, stop, step) {
8
+ start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step;
9
+ var i = -1, n = Math.max(0, Math.ceil((stop - start) / step)) | 0, range2 = new Array(n);
10
+ while (++i < n) {
11
+ range2[i] = start + i * step;
12
+ }
13
+ return range2;
14
+ }
15
+ function band() {
16
+ 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 = 0.5;
17
+ delete scale.unknown;
18
+ function rescale() {
19
+ var n = domain().length, reverse = r1 < r0, start = reverse ? r1 : r0, stop = reverse ? r0 : r1;
20
+ step = (stop - start) / Math.max(1, n - paddingInner + paddingOuter * 2);
21
+ if (round) step = Math.floor(step);
22
+ start += (stop - start - step * (n - paddingInner)) * align;
23
+ bandwidth = step * (1 - paddingInner);
24
+ if (round) start = Math.round(start), bandwidth = Math.round(bandwidth);
25
+ var values = range(n).map(function(i) {
26
+ return start + step * i;
27
+ });
28
+ return ordinalRange(reverse ? values.reverse() : values);
29
+ }
30
+ scale.domain = function(_) {
31
+ return arguments.length ? (domain(_), rescale()) : domain();
32
+ };
33
+ scale.range = function(_) {
34
+ return arguments.length ? ([r0, r1] = _, r0 = +r0, r1 = +r1, rescale()) : [r0, r1];
35
+ };
36
+ scale.rangeRound = function(_) {
37
+ return [r0, r1] = _, r0 = +r0, r1 = +r1, round = true, rescale();
38
+ };
39
+ scale.bandwidth = function() {
40
+ return bandwidth;
41
+ };
42
+ scale.step = function() {
43
+ return step;
44
+ };
45
+ scale.round = function(_) {
46
+ return arguments.length ? (round = !!_, rescale()) : round;
47
+ };
48
+ scale.padding = function(_) {
49
+ return arguments.length ? (paddingInner = Math.min(1, paddingOuter = +_), rescale()) : paddingInner;
50
+ };
51
+ scale.paddingInner = function(_) {
52
+ return arguments.length ? (paddingInner = Math.min(1, _), rescale()) : paddingInner;
53
+ };
54
+ scale.paddingOuter = function(_) {
55
+ return arguments.length ? (paddingOuter = +_, rescale()) : paddingOuter;
56
+ };
57
+ scale.align = function(_) {
58
+ return arguments.length ? (align = Math.max(0, Math.min(1, _)), rescale()) : align;
59
+ };
60
+ scale.copy = function() {
61
+ return band(domain(), [r0, r1]).round(round).paddingInner(paddingInner).paddingOuter(paddingOuter).align(align);
62
+ };
63
+ return initRange.apply(rescale(), arguments);
64
+ }
65
+ var parser = (function() {
66
+ var o = function(k, v, o2, l) {
67
+ for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v)
68
+ ;
69
+ return o2;
70
+ }, $V0 = [1, 10, 12, 14, 16, 18, 19, 21, 23], $V1 = [2, 6], $V2 = [1, 3], $V3 = [1, 5], $V4 = [1, 6], $V5 = [1, 7], $V6 = [1, 5, 10, 12, 14, 16, 18, 19, 21, 23, 34, 35, 36], $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 = [1, 10, 12, 14, 16, 18, 19, 21, 23, 34, 35, 36], $Vo = [1, 10, 12, 14, 16, 18, 19, 21, 23, 24, 26, 27, 28, 34, 35, 36], $Vp = [1, 10, 12, 14, 16, 18, 19, 21, 23, 24, 26, 27, 28, 34, 35, 36, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50], $Vq = [1, 64];
71
+ var parser2 = {
72
+ trace: function trace() {
73
+ },
74
+ yy: {},
75
+ symbols_: { "error": 2, "start": 3, "eol": 4, "XYCHART": 5, "chartConfig": 6, "document": 7, "CHART_ORIENTATION": 8, "statement": 9, "title": 10, "text": 11, "X_AXIS": 12, "parseXAxis": 13, "Y_AXIS": 14, "parseYAxis": 15, "LINE": 16, "plotData": 17, "BAR": 18, "acc_title": 19, "acc_title_value": 20, "acc_descr": 21, "acc_descr_value": 22, "acc_descr_multiline_value": 23, "SQUARE_BRACES_START": 24, "commaSeparatedNumbers": 25, "SQUARE_BRACES_END": 26, "NUMBER_WITH_DECIMAL": 27, "COMMA": 28, "xAxisData": 29, "bandData": 30, "ARROW_DELIMITER": 31, "commaSeparatedTexts": 32, "yAxisData": 33, "NEWLINE": 34, "SEMI": 35, "EOF": 36, "alphaNum": 37, "STR": 38, "MD_STR": 39, "alphaNumToken": 40, "AMP": 41, "NUM": 42, "ALPHA": 43, "PLUS": 44, "EQUALS": 45, "MULT": 46, "DOT": 47, "BRKT": 48, "MINUS": 49, "UNDERSCORE": 50, "$accept": 0, "$end": 1 },
76
+ terminals_: { 2: "error", 5: "XYCHART", 8: "CHART_ORIENTATION", 10: "title", 12: "X_AXIS", 14: "Y_AXIS", 16: "LINE", 18: "BAR", 19: "acc_title", 20: "acc_title_value", 21: "acc_descr", 22: "acc_descr_value", 23: "acc_descr_multiline_value", 24: "SQUARE_BRACES_START", 26: "SQUARE_BRACES_END", 27: "NUMBER_WITH_DECIMAL", 28: "COMMA", 31: "ARROW_DELIMITER", 34: "NEWLINE", 35: "SEMI", 36: "EOF", 38: "STR", 39: "MD_STR", 41: "AMP", 42: "NUM", 43: "ALPHA", 44: "PLUS", 45: "EQUALS", 46: "MULT", 47: "DOT", 48: "BRKT", 49: "MINUS", 50: "UNDERSCORE" },
77
+ productions_: [0, [3, 2], [3, 3], [3, 2], [3, 1], [6, 1], [7, 0], [7, 2], [9, 2], [9, 2], [9, 2], [9, 2], [9, 2], [9, 3], [9, 2], [9, 3], [9, 2], [9, 2], [9, 1], [17, 3], [25, 3], [25, 1], [13, 1], [13, 2], [13, 1], [29, 1], [29, 3], [30, 3], [32, 3], [32, 1], [15, 1], [15, 2], [15, 1], [33, 3], [4, 1], [4, 1], [4, 1], [11, 1], [11, 1], [11, 1], [37, 1], [37, 2], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1]],
78
+ performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
79
+ var $0 = $$.length - 1;
80
+ switch (yystate) {
81
+ case 5:
82
+ yy.setOrientation($$[$0]);
83
+ break;
84
+ case 9:
85
+ yy.setDiagramTitle($$[$0].text.trim());
86
+ break;
87
+ case 12:
88
+ yy.setLineData({ text: "", type: "text" }, $$[$0]);
89
+ break;
90
+ case 13:
91
+ yy.setLineData($$[$0 - 1], $$[$0]);
92
+ break;
93
+ case 14:
94
+ yy.setBarData({ text: "", type: "text" }, $$[$0]);
95
+ break;
96
+ case 15:
97
+ yy.setBarData($$[$0 - 1], $$[$0]);
98
+ break;
99
+ case 16:
100
+ this.$ = $$[$0].trim();
101
+ yy.setAccTitle(this.$);
102
+ break;
103
+ case 17:
104
+ case 18:
105
+ this.$ = $$[$0].trim();
106
+ yy.setAccDescription(this.$);
107
+ break;
108
+ case 19:
109
+ this.$ = $$[$0 - 1];
110
+ break;
111
+ case 20:
112
+ this.$ = [Number($$[$0 - 2]), ...$$[$0]];
113
+ break;
114
+ case 21:
115
+ this.$ = [Number($$[$0])];
116
+ break;
117
+ case 22:
118
+ yy.setXAxisTitle($$[$0]);
119
+ break;
120
+ case 23:
121
+ yy.setXAxisTitle($$[$0 - 1]);
122
+ break;
123
+ case 24:
124
+ yy.setXAxisTitle({ type: "text", text: "" });
125
+ break;
126
+ case 25:
127
+ yy.setXAxisBand($$[$0]);
128
+ break;
129
+ case 26:
130
+ yy.setXAxisRangeData(Number($$[$0 - 2]), Number($$[$0]));
131
+ break;
132
+ case 27:
133
+ this.$ = $$[$0 - 1];
134
+ break;
135
+ case 28:
136
+ this.$ = [$$[$0 - 2], ...$$[$0]];
137
+ break;
138
+ case 29:
139
+ this.$ = [$$[$0]];
140
+ break;
141
+ case 30:
142
+ yy.setYAxisTitle($$[$0]);
143
+ break;
144
+ case 31:
145
+ yy.setYAxisTitle($$[$0 - 1]);
146
+ break;
147
+ case 32:
148
+ yy.setYAxisTitle({ type: "text", text: "" });
149
+ break;
150
+ case 33:
151
+ yy.setYAxisRangeData(Number($$[$0 - 2]), Number($$[$0]));
152
+ break;
153
+ case 37:
154
+ this.$ = { text: $$[$0], type: "text" };
155
+ break;
156
+ case 38:
157
+ this.$ = { text: $$[$0], type: "text" };
158
+ break;
159
+ case 39:
160
+ this.$ = { text: $$[$0], type: "markdown" };
161
+ break;
162
+ case 40:
163
+ this.$ = $$[$0];
164
+ break;
165
+ case 41:
166
+ this.$ = $$[$0 - 1] + "" + $$[$0];
167
+ break;
168
+ }
169
+ },
170
+ table: [o($V0, $V1, { 3: 1, 4: 2, 7: 4, 5: $V2, 34: $V3, 35: $V4, 36: $V5 }), { 1: [3] }, o($V0, $V1, { 4: 2, 7: 4, 3: 8, 5: $V2, 34: $V3, 35: $V4, 36: $V5 }), o($V0, $V1, { 4: 2, 7: 4, 6: 9, 3: 10, 5: $V2, 8: [1, 11], 34: $V3, 35: $V4, 36: $V5 }), { 1: [2, 4], 9: 12, 10: [1, 13], 12: [1, 14], 14: [1, 15], 16: [1, 16], 18: [1, 17], 19: [1, 18], 21: [1, 19], 23: [1, 20] }, o($V6, [2, 34]), o($V6, [2, 35]), o($V6, [2, 36]), { 1: [2, 1] }, o($V0, $V1, { 4: 2, 7: 4, 3: 21, 5: $V2, 34: $V3, 35: $V4, 36: $V5 }), { 1: [2, 3] }, o($V6, [2, 5]), o($V0, [2, 7], { 4: 22, 34: $V3, 35: $V4, 36: $V5 }), { 11: 23, 37: 24, 38: $V7, 39: $V8, 40: 27, 41: $V9, 42: $Va, 43: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi }, { 11: 39, 13: 38, 24: $Vj, 27: $Vk, 29: 40, 30: 41, 37: 24, 38: $V7, 39: $V8, 40: 27, 41: $V9, 42: $Va, 43: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi }, { 11: 45, 15: 44, 27: $Vl, 33: 46, 37: 24, 38: $V7, 39: $V8, 40: 27, 41: $V9, 42: $Va, 43: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi }, { 11: 49, 17: 48, 24: $Vm, 37: 24, 38: $V7, 39: $V8, 40: 27, 41: $V9, 42: $Va, 43: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi }, { 11: 52, 17: 51, 24: $Vm, 37: 24, 38: $V7, 39: $V8, 40: 27, 41: $V9, 42: $Va, 43: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi }, { 20: [1, 53] }, { 22: [1, 54] }, o($Vn, [2, 18]), { 1: [2, 2] }, o($Vn, [2, 8]), o($Vn, [2, 9]), o($Vo, [2, 37], { 40: 55, 41: $V9, 42: $Va, 43: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi }), o($Vo, [2, 38]), o($Vo, [2, 39]), o($Vp, [2, 40]), o($Vp, [2, 42]), o($Vp, [2, 43]), o($Vp, [2, 44]), o($Vp, [2, 45]), o($Vp, [2, 46]), o($Vp, [2, 47]), o($Vp, [2, 48]), o($Vp, [2, 49]), o($Vp, [2, 50]), o($Vp, [2, 51]), o($Vn, [2, 10]), o($Vn, [2, 22], { 30: 41, 29: 56, 24: $Vj, 27: $Vk }), o($Vn, [2, 24]), o($Vn, [2, 25]), { 31: [1, 57] }, { 11: 59, 32: 58, 37: 24, 38: $V7, 39: $V8, 40: 27, 41: $V9, 42: $Va, 43: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi }, o($Vn, [2, 11]), o($Vn, [2, 30], { 33: 60, 27: $Vl }), o($Vn, [2, 32]), { 31: [1, 61] }, o($Vn, [2, 12]), { 17: 62, 24: $Vm }, { 25: 63, 27: $Vq }, o($Vn, [2, 14]), { 17: 65, 24: $Vm }, o($Vn, [2, 16]), o($Vn, [2, 17]), o($Vp, [2, 41]), o($Vn, [2, 23]), { 27: [1, 66] }, { 26: [1, 67] }, { 26: [2, 29], 28: [1, 68] }, o($Vn, [2, 31]), { 27: [1, 69] }, o($Vn, [2, 13]), { 26: [1, 70] }, { 26: [2, 21], 28: [1, 71] }, o($Vn, [2, 15]), o($Vn, [2, 26]), o($Vn, [2, 27]), { 11: 59, 32: 72, 37: 24, 38: $V7, 39: $V8, 40: 27, 41: $V9, 42: $Va, 43: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi }, o($Vn, [2, 33]), o($Vn, [2, 19]), { 25: 73, 27: $Vq }, { 26: [2, 28] }, { 26: [2, 20] }],
171
+ defaultActions: { 8: [2, 1], 10: [2, 3], 21: [2, 2], 72: [2, 28], 73: [2, 20] },
172
+ parseError: function parseError(str, hash) {
173
+ if (hash.recoverable) {
174
+ this.trace(str);
175
+ } else {
176
+ var error = new Error(str);
177
+ error.hash = hash;
178
+ throw error;
179
+ }
180
+ },
181
+ parse: function parse(input) {
182
+ var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, TERROR = 2, EOF = 1;
183
+ var args = lstack.slice.call(arguments, 1);
184
+ var lexer2 = Object.create(this.lexer);
185
+ var sharedState = { yy: {} };
186
+ for (var k in this.yy) {
187
+ if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
188
+ sharedState.yy[k] = this.yy[k];
189
+ }
190
+ }
191
+ lexer2.setInput(input, sharedState.yy);
192
+ sharedState.yy.lexer = lexer2;
193
+ sharedState.yy.parser = this;
194
+ if (typeof lexer2.yylloc == "undefined") {
195
+ lexer2.yylloc = {};
196
+ }
197
+ var yyloc = lexer2.yylloc;
198
+ lstack.push(yyloc);
199
+ var ranges = lexer2.options && lexer2.options.ranges;
200
+ if (typeof sharedState.yy.parseError === "function") {
201
+ this.parseError = sharedState.yy.parseError;
202
+ } else {
203
+ this.parseError = Object.getPrototypeOf(this).parseError;
204
+ }
205
+ function lex() {
206
+ var token;
207
+ token = tstack.pop() || lexer2.lex() || EOF;
208
+ if (typeof token !== "number") {
209
+ if (token instanceof Array) {
210
+ tstack = token;
211
+ token = tstack.pop();
212
+ }
213
+ token = self.symbols_[token] || token;
214
+ }
215
+ return token;
216
+ }
217
+ var symbol, state, action, r, yyval = {}, p, len, newState, expected;
218
+ while (true) {
219
+ state = stack[stack.length - 1];
220
+ if (this.defaultActions[state]) {
221
+ action = this.defaultActions[state];
222
+ } else {
223
+ if (symbol === null || typeof symbol == "undefined") {
224
+ symbol = lex();
225
+ }
226
+ action = table[state] && table[state][symbol];
227
+ }
228
+ if (typeof action === "undefined" || !action.length || !action[0]) {
229
+ var errStr = "";
230
+ expected = [];
231
+ for (p in table[state]) {
232
+ if (this.terminals_[p] && p > TERROR) {
233
+ expected.push("'" + this.terminals_[p] + "'");
234
+ }
235
+ }
236
+ if (lexer2.showPosition) {
237
+ errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
238
+ } else {
239
+ errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
240
+ }
241
+ this.parseError(errStr, {
242
+ text: lexer2.match,
243
+ token: this.terminals_[symbol] || symbol,
244
+ line: lexer2.yylineno,
245
+ loc: yyloc,
246
+ expected
247
+ });
248
+ }
249
+ if (action[0] instanceof Array && action.length > 1) {
250
+ throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
251
+ }
252
+ switch (action[0]) {
253
+ case 1:
254
+ stack.push(symbol);
255
+ vstack.push(lexer2.yytext);
256
+ lstack.push(lexer2.yylloc);
257
+ stack.push(action[1]);
258
+ symbol = null;
259
+ {
260
+ yyleng = lexer2.yyleng;
261
+ yytext = lexer2.yytext;
262
+ yylineno = lexer2.yylineno;
263
+ yyloc = lexer2.yylloc;
264
+ }
265
+ break;
266
+ case 2:
267
+ len = this.productions_[action[1]][1];
268
+ yyval.$ = vstack[vstack.length - len];
269
+ yyval._$ = {
270
+ first_line: lstack[lstack.length - (len || 1)].first_line,
271
+ last_line: lstack[lstack.length - 1].last_line,
272
+ first_column: lstack[lstack.length - (len || 1)].first_column,
273
+ last_column: lstack[lstack.length - 1].last_column
274
+ };
275
+ if (ranges) {
276
+ yyval._$.range = [
277
+ lstack[lstack.length - (len || 1)].range[0],
278
+ lstack[lstack.length - 1].range[1]
279
+ ];
280
+ }
281
+ r = this.performAction.apply(yyval, [
282
+ yytext,
283
+ yyleng,
284
+ yylineno,
285
+ sharedState.yy,
286
+ action[1],
287
+ vstack,
288
+ lstack
289
+ ].concat(args));
290
+ if (typeof r !== "undefined") {
291
+ return r;
292
+ }
293
+ if (len) {
294
+ stack = stack.slice(0, -1 * len * 2);
295
+ vstack = vstack.slice(0, -1 * len);
296
+ lstack = lstack.slice(0, -1 * len);
297
+ }
298
+ stack.push(this.productions_[action[1]][0]);
299
+ vstack.push(yyval.$);
300
+ lstack.push(yyval._$);
301
+ newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
302
+ stack.push(newState);
303
+ break;
304
+ case 3:
305
+ return true;
306
+ }
307
+ }
308
+ return true;
309
+ }
310
+ };
311
+ var lexer = /* @__PURE__ */ (function() {
312
+ var lexer2 = {
313
+ EOF: 1,
314
+ parseError: function parseError(str, hash) {
315
+ if (this.yy.parser) {
316
+ this.yy.parser.parseError(str, hash);
317
+ } else {
318
+ throw new Error(str);
319
+ }
320
+ },
321
+ // resets the lexer, sets new input
322
+ setInput: function(input, yy) {
323
+ this.yy = yy || this.yy || {};
324
+ this._input = input;
325
+ this._more = this._backtrack = this.done = false;
326
+ this.yylineno = this.yyleng = 0;
327
+ this.yytext = this.matched = this.match = "";
328
+ this.conditionStack = ["INITIAL"];
329
+ this.yylloc = {
330
+ first_line: 1,
331
+ first_column: 0,
332
+ last_line: 1,
333
+ last_column: 0
334
+ };
335
+ if (this.options.ranges) {
336
+ this.yylloc.range = [0, 0];
337
+ }
338
+ this.offset = 0;
339
+ return this;
340
+ },
341
+ // consumes and returns one char from the input
342
+ input: function() {
343
+ var ch = this._input[0];
344
+ this.yytext += ch;
345
+ this.yyleng++;
346
+ this.offset++;
347
+ this.match += ch;
348
+ this.matched += ch;
349
+ var lines = ch.match(/(?:\r\n?|\n).*/g);
350
+ if (lines) {
351
+ this.yylineno++;
352
+ this.yylloc.last_line++;
353
+ } else {
354
+ this.yylloc.last_column++;
355
+ }
356
+ if (this.options.ranges) {
357
+ this.yylloc.range[1]++;
358
+ }
359
+ this._input = this._input.slice(1);
360
+ return ch;
361
+ },
362
+ // unshifts one char (or a string) into the input
363
+ unput: function(ch) {
364
+ var len = ch.length;
365
+ var lines = ch.split(/(?:\r\n?|\n)/g);
366
+ this._input = ch + this._input;
367
+ this.yytext = this.yytext.substr(0, this.yytext.length - len);
368
+ this.offset -= len;
369
+ var oldLines = this.match.split(/(?:\r\n?|\n)/g);
370
+ this.match = this.match.substr(0, this.match.length - 1);
371
+ this.matched = this.matched.substr(0, this.matched.length - 1);
372
+ if (lines.length - 1) {
373
+ this.yylineno -= lines.length - 1;
374
+ }
375
+ var r = this.yylloc.range;
376
+ this.yylloc = {
377
+ first_line: this.yylloc.first_line,
378
+ last_line: this.yylineno + 1,
379
+ first_column: this.yylloc.first_column,
380
+ 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
381
+ };
382
+ if (this.options.ranges) {
383
+ this.yylloc.range = [r[0], r[0] + this.yyleng - len];
384
+ }
385
+ this.yyleng = this.yytext.length;
386
+ return this;
387
+ },
388
+ // When called from action, caches matched text and appends it on next action
389
+ more: function() {
390
+ this._more = true;
391
+ return this;
392
+ },
393
+ // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
394
+ reject: function() {
395
+ if (this.options.backtrack_lexer) {
396
+ this._backtrack = true;
397
+ } else {
398
+ 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(), {
399
+ text: "",
400
+ token: null,
401
+ line: this.yylineno
402
+ });
403
+ }
404
+ return this;
405
+ },
406
+ // retain first n characters of the match
407
+ less: function(n) {
408
+ this.unput(this.match.slice(n));
409
+ },
410
+ // displays already matched input, i.e. for error messages
411
+ pastInput: function() {
412
+ var past = this.matched.substr(0, this.matched.length - this.match.length);
413
+ return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
414
+ },
415
+ // displays upcoming input, i.e. for error messages
416
+ upcomingInput: function() {
417
+ var next = this.match;
418
+ if (next.length < 20) {
419
+ next += this._input.substr(0, 20 - next.length);
420
+ }
421
+ return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
422
+ },
423
+ // displays the character position where the lexing error occurred, i.e. for error messages
424
+ showPosition: function() {
425
+ var pre = this.pastInput();
426
+ var c = new Array(pre.length + 1).join("-");
427
+ return pre + this.upcomingInput() + "\n" + c + "^";
428
+ },
429
+ // test the lexed token: return FALSE when not a match, otherwise return token
430
+ test_match: function(match, indexed_rule) {
431
+ var token, lines, backup;
432
+ if (this.options.backtrack_lexer) {
433
+ backup = {
434
+ yylineno: this.yylineno,
435
+ yylloc: {
436
+ first_line: this.yylloc.first_line,
437
+ last_line: this.last_line,
438
+ first_column: this.yylloc.first_column,
439
+ last_column: this.yylloc.last_column
440
+ },
441
+ yytext: this.yytext,
442
+ match: this.match,
443
+ matches: this.matches,
444
+ matched: this.matched,
445
+ yyleng: this.yyleng,
446
+ offset: this.offset,
447
+ _more: this._more,
448
+ _input: this._input,
449
+ yy: this.yy,
450
+ conditionStack: this.conditionStack.slice(0),
451
+ done: this.done
452
+ };
453
+ if (this.options.ranges) {
454
+ backup.yylloc.range = this.yylloc.range.slice(0);
455
+ }
456
+ }
457
+ lines = match[0].match(/(?:\r\n?|\n).*/g);
458
+ if (lines) {
459
+ this.yylineno += lines.length;
460
+ }
461
+ this.yylloc = {
462
+ first_line: this.yylloc.last_line,
463
+ last_line: this.yylineno + 1,
464
+ first_column: this.yylloc.last_column,
465
+ last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length
466
+ };
467
+ this.yytext += match[0];
468
+ this.match += match[0];
469
+ this.matches = match;
470
+ this.yyleng = this.yytext.length;
471
+ if (this.options.ranges) {
472
+ this.yylloc.range = [this.offset, this.offset += this.yyleng];
473
+ }
474
+ this._more = false;
475
+ this._backtrack = false;
476
+ this._input = this._input.slice(match[0].length);
477
+ this.matched += match[0];
478
+ token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
479
+ if (this.done && this._input) {
480
+ this.done = false;
481
+ }
482
+ if (token) {
483
+ return token;
484
+ } else if (this._backtrack) {
485
+ for (var k in backup) {
486
+ this[k] = backup[k];
487
+ }
488
+ return false;
489
+ }
490
+ return false;
491
+ },
492
+ // return next match in input
493
+ next: function() {
494
+ if (this.done) {
495
+ return this.EOF;
496
+ }
497
+ if (!this._input) {
498
+ this.done = true;
499
+ }
500
+ var token, match, tempMatch, index;
501
+ if (!this._more) {
502
+ this.yytext = "";
503
+ this.match = "";
504
+ }
505
+ var rules = this._currentRules();
506
+ for (var i = 0; i < rules.length; i++) {
507
+ tempMatch = this._input.match(this.rules[rules[i]]);
508
+ if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
509
+ match = tempMatch;
510
+ index = i;
511
+ if (this.options.backtrack_lexer) {
512
+ token = this.test_match(tempMatch, rules[i]);
513
+ if (token !== false) {
514
+ return token;
515
+ } else if (this._backtrack) {
516
+ match = false;
517
+ continue;
518
+ } else {
519
+ return false;
520
+ }
521
+ } else if (!this.options.flex) {
522
+ break;
523
+ }
524
+ }
525
+ }
526
+ if (match) {
527
+ token = this.test_match(match, rules[index]);
528
+ if (token !== false) {
529
+ return token;
530
+ }
531
+ return false;
532
+ }
533
+ if (this._input === "") {
534
+ return this.EOF;
535
+ } else {
536
+ return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
537
+ text: "",
538
+ token: null,
539
+ line: this.yylineno
540
+ });
541
+ }
542
+ },
543
+ // return next match that has a token
544
+ lex: function lex() {
545
+ var r = this.next();
546
+ if (r) {
547
+ return r;
548
+ } else {
549
+ return this.lex();
550
+ }
551
+ },
552
+ // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
553
+ begin: function begin(condition) {
554
+ this.conditionStack.push(condition);
555
+ },
556
+ // pop the previously active lexer condition state off the condition stack
557
+ popState: function popState() {
558
+ var n = this.conditionStack.length - 1;
559
+ if (n > 0) {
560
+ return this.conditionStack.pop();
561
+ } else {
562
+ return this.conditionStack[0];
563
+ }
564
+ },
565
+ // produce the lexer rule set which is active for the currently active lexer condition state
566
+ _currentRules: function _currentRules() {
567
+ if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
568
+ return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
569
+ } else {
570
+ return this.conditions["INITIAL"].rules;
571
+ }
572
+ },
573
+ // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
574
+ topState: function topState(n) {
575
+ n = this.conditionStack.length - 1 - Math.abs(n || 0);
576
+ if (n >= 0) {
577
+ return this.conditionStack[n];
578
+ } else {
579
+ return "INITIAL";
580
+ }
581
+ },
582
+ // alias for begin(condition)
583
+ pushState: function pushState(condition) {
584
+ this.begin(condition);
585
+ },
586
+ // return the number of states currently on the stack
587
+ stateStackSize: function stateStackSize() {
588
+ return this.conditionStack.length;
589
+ },
590
+ options: { "case-insensitive": true },
591
+ performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
592
+ switch ($avoiding_name_collisions) {
593
+ case 0:
594
+ break;
595
+ case 1:
596
+ break;
597
+ case 2:
598
+ this.popState();
599
+ return 34;
600
+ case 3:
601
+ this.popState();
602
+ return 34;
603
+ case 4:
604
+ return 34;
605
+ case 5:
606
+ break;
607
+ case 6:
608
+ return 10;
609
+ case 7:
610
+ this.pushState("acc_title");
611
+ return 19;
612
+ case 8:
613
+ this.popState();
614
+ return "acc_title_value";
615
+ case 9:
616
+ this.pushState("acc_descr");
617
+ return 21;
618
+ case 10:
619
+ this.popState();
620
+ return "acc_descr_value";
621
+ case 11:
622
+ this.pushState("acc_descr_multiline");
623
+ break;
624
+ case 12:
625
+ this.popState();
626
+ break;
627
+ case 13:
628
+ return "acc_descr_multiline_value";
629
+ case 14:
630
+ return 5;
631
+ case 15:
632
+ return 8;
633
+ case 16:
634
+ this.pushState("axis_data");
635
+ return "X_AXIS";
636
+ case 17:
637
+ this.pushState("axis_data");
638
+ return "Y_AXIS";
639
+ case 18:
640
+ this.pushState("axis_band_data");
641
+ return 24;
642
+ case 19:
643
+ return 31;
644
+ case 20:
645
+ this.pushState("data");
646
+ return 16;
647
+ case 21:
648
+ this.pushState("data");
649
+ return 18;
650
+ case 22:
651
+ this.pushState("data_inner");
652
+ return 24;
653
+ case 23:
654
+ return 27;
655
+ case 24:
656
+ this.popState();
657
+ return 26;
658
+ case 25:
659
+ this.popState();
660
+ break;
661
+ case 26:
662
+ this.pushState("string");
663
+ break;
664
+ case 27:
665
+ this.popState();
666
+ break;
667
+ case 28:
668
+ return "STR";
669
+ case 29:
670
+ return 24;
671
+ case 30:
672
+ return 26;
673
+ case 31:
674
+ return 43;
675
+ case 32:
676
+ return "COLON";
677
+ case 33:
678
+ return 44;
679
+ case 34:
680
+ return 28;
681
+ case 35:
682
+ return 45;
683
+ case 36:
684
+ return 46;
685
+ case 37:
686
+ return 48;
687
+ case 38:
688
+ return 50;
689
+ case 39:
690
+ return 47;
691
+ case 40:
692
+ return 41;
693
+ case 41:
694
+ return 49;
695
+ case 42:
696
+ return 42;
697
+ case 43:
698
+ break;
699
+ case 44:
700
+ return 35;
701
+ case 45:
702
+ return 36;
703
+ }
704
+ },
705
+ rules: [/^(?:%%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:(\r?\n))/i, /^(?:(\r?\n))/i, /^(?:[\n\r]+)/i, /^(?:%%[^\n]*)/i, /^(?:title\b)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:\{)/i, /^(?:[^\}]*)/i, /^(?:xychart-beta\b)/i, /^(?:(?:vertical|horizontal))/i, /^(?:x-axis\b)/i, /^(?:y-axis\b)/i, /^(?:\[)/i, /^(?:-->)/i, /^(?:line\b)/i, /^(?:bar\b)/i, /^(?:\[)/i, /^(?:[+-]?(?:\d+(?:\.\d+)?|\.\d+))/i, /^(?:\])/i, /^(?:(?:`\) \{ this\.pushState\(md_string\); \}\n<md_string>\(\?:\(\?!`"\)\.\)\+ \{ return MD_STR; \}\n<md_string>\(\?:`))/i, /^(?:["])/i, /^(?:["])/i, /^(?:[^"]*)/i, /^(?:\[)/i, /^(?:\])/i, /^(?:[A-Za-z]+)/i, /^(?::)/i, /^(?:\+)/i, /^(?:,)/i, /^(?:=)/i, /^(?:\*)/i, /^(?:#)/i, /^(?:[\_])/i, /^(?:\.)/i, /^(?:&)/i, /^(?:-)/i, /^(?:[0-9]+)/i, /^(?:\s+)/i, /^(?:;)/i, /^(?:$)/i],
706
+ conditions: { "data_inner": { "rules": [0, 1, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 20, 21, 23, 24, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45], "inclusive": true }, "data": { "rules": [0, 1, 3, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 20, 21, 22, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45], "inclusive": true }, "axis_band_data": { "rules": [0, 1, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 20, 21, 24, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45], "inclusive": true }, "axis_data": { "rules": [0, 1, 2, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 18, 19, 20, 21, 23, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45], "inclusive": true }, "acc_descr_multiline": { "rules": [12, 13], "inclusive": false }, "acc_descr": { "rules": [10], "inclusive": false }, "acc_title": { "rules": [8], "inclusive": false }, "title": { "rules": [], "inclusive": false }, "md_string": { "rules": [], "inclusive": false }, "string": { "rules": [27, 28], "inclusive": false }, "INITIAL": { "rules": [0, 1, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 20, 21, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45], "inclusive": true } }
707
+ };
708
+ return lexer2;
709
+ })();
710
+ parser2.lexer = lexer;
711
+ function Parser() {
712
+ this.yy = {};
713
+ }
714
+ Parser.prototype = parser2;
715
+ parser2.Parser = Parser;
716
+ return new Parser();
717
+ })();
718
+ parser.parser = parser;
719
+ const parser$1 = parser;
720
+ function isBarPlot(data) {
721
+ return data.type === "bar";
722
+ }
723
+ function isBandAxisData(data) {
724
+ return data.type === "band";
725
+ }
726
+ function isLinearAxisData(data) {
727
+ return data.type === "linear";
728
+ }
729
+ class TextDimensionCalculatorWithFont {
730
+ constructor(parentGroup) {
731
+ this.parentGroup = parentGroup;
732
+ }
733
+ getMaxDimension(texts, fontSize) {
734
+ if (!this.parentGroup) {
735
+ return {
736
+ width: texts.reduce((acc, cur) => Math.max(cur.length, acc), 0) * fontSize,
737
+ height: fontSize
738
+ };
739
+ }
740
+ const dimension = {
741
+ width: 0,
742
+ height: 0
743
+ };
744
+ const elem = this.parentGroup.append("g").attr("visibility", "hidden").attr("font-size", fontSize);
745
+ for (const t of texts) {
746
+ const bbox = computeDimensionOfText(elem, 1, t);
747
+ const width = bbox ? bbox.width : t.length * fontSize;
748
+ const height = bbox ? bbox.height : fontSize;
749
+ dimension.width = Math.max(dimension.width, width);
750
+ dimension.height = Math.max(dimension.height, height);
751
+ }
752
+ elem.remove();
753
+ return dimension;
754
+ }
755
+ }
756
+ const BAR_WIDTH_TO_TICK_WIDTH_RATIO = 0.7;
757
+ const MAX_OUTER_PADDING_PERCENT_FOR_WRT_LABEL = 0.2;
758
+ class BaseAxis {
759
+ constructor(axisConfig, title, textDimensionCalculator, axisThemeConfig) {
760
+ this.axisConfig = axisConfig;
761
+ this.title = title;
762
+ this.textDimensionCalculator = textDimensionCalculator;
763
+ this.axisThemeConfig = axisThemeConfig;
764
+ this.boundingRect = { x: 0, y: 0, width: 0, height: 0 };
765
+ this.axisPosition = "left";
766
+ this.showTitle = false;
767
+ this.showLabel = false;
768
+ this.showTick = false;
769
+ this.showAxisLine = false;
770
+ this.outerPadding = 0;
771
+ this.titleTextHeight = 0;
772
+ this.labelTextHeight = 0;
773
+ this.range = [0, 10];
774
+ this.boundingRect = { x: 0, y: 0, width: 0, height: 0 };
775
+ this.axisPosition = "left";
776
+ }
777
+ setRange(range2) {
778
+ this.range = range2;
779
+ if (this.axisPosition === "left" || this.axisPosition === "right") {
780
+ this.boundingRect.height = range2[1] - range2[0];
781
+ } else {
782
+ this.boundingRect.width = range2[1] - range2[0];
783
+ }
784
+ this.recalculateScale();
785
+ }
786
+ getRange() {
787
+ return [this.range[0] + this.outerPadding, this.range[1] - this.outerPadding];
788
+ }
789
+ setAxisPosition(axisPosition) {
790
+ this.axisPosition = axisPosition;
791
+ this.setRange(this.range);
792
+ }
793
+ getTickDistance() {
794
+ const range2 = this.getRange();
795
+ return Math.abs(range2[0] - range2[1]) / this.getTickValues().length;
796
+ }
797
+ getAxisOuterPadding() {
798
+ return this.outerPadding;
799
+ }
800
+ getLabelDimension() {
801
+ return this.textDimensionCalculator.getMaxDimension(
802
+ this.getTickValues().map((tick) => tick.toString()),
803
+ this.axisConfig.labelFontSize
804
+ );
805
+ }
806
+ recalculateOuterPaddingToDrawBar() {
807
+ if (BAR_WIDTH_TO_TICK_WIDTH_RATIO * this.getTickDistance() > this.outerPadding * 2) {
808
+ this.outerPadding = Math.floor(BAR_WIDTH_TO_TICK_WIDTH_RATIO * this.getTickDistance() / 2);
809
+ }
810
+ this.recalculateScale();
811
+ }
812
+ calculateSpaceIfDrawnHorizontally(availableSpace) {
813
+ let availableHeight = availableSpace.height;
814
+ if (this.axisConfig.showAxisLine && availableHeight > this.axisConfig.axisLineWidth) {
815
+ availableHeight -= this.axisConfig.axisLineWidth;
816
+ this.showAxisLine = true;
817
+ }
818
+ if (this.axisConfig.showLabel) {
819
+ const spaceRequired = this.getLabelDimension();
820
+ const maxPadding = MAX_OUTER_PADDING_PERCENT_FOR_WRT_LABEL * availableSpace.width;
821
+ this.outerPadding = Math.min(spaceRequired.width / 2, maxPadding);
822
+ const heightRequired = spaceRequired.height + this.axisConfig.labelPadding * 2;
823
+ this.labelTextHeight = spaceRequired.height;
824
+ if (heightRequired <= availableHeight) {
825
+ availableHeight -= heightRequired;
826
+ this.showLabel = true;
827
+ }
828
+ }
829
+ if (this.axisConfig.showTick && availableHeight >= this.axisConfig.tickLength) {
830
+ this.showTick = true;
831
+ availableHeight -= this.axisConfig.tickLength;
832
+ }
833
+ if (this.axisConfig.showTitle && this.title) {
834
+ const spaceRequired = this.textDimensionCalculator.getMaxDimension(
835
+ [this.title],
836
+ this.axisConfig.titleFontSize
837
+ );
838
+ const heightRequired = spaceRequired.height + this.axisConfig.titlePadding * 2;
839
+ this.titleTextHeight = spaceRequired.height;
840
+ if (heightRequired <= availableHeight) {
841
+ availableHeight -= heightRequired;
842
+ this.showTitle = true;
843
+ }
844
+ }
845
+ this.boundingRect.width = availableSpace.width;
846
+ this.boundingRect.height = availableSpace.height - availableHeight;
847
+ }
848
+ calculateSpaceIfDrawnVertical(availableSpace) {
849
+ let availableWidth = availableSpace.width;
850
+ if (this.axisConfig.showAxisLine && availableWidth > this.axisConfig.axisLineWidth) {
851
+ availableWidth -= this.axisConfig.axisLineWidth;
852
+ this.showAxisLine = true;
853
+ }
854
+ if (this.axisConfig.showLabel) {
855
+ const spaceRequired = this.getLabelDimension();
856
+ const maxPadding = MAX_OUTER_PADDING_PERCENT_FOR_WRT_LABEL * availableSpace.height;
857
+ this.outerPadding = Math.min(spaceRequired.height / 2, maxPadding);
858
+ const widthRequired = spaceRequired.width + this.axisConfig.labelPadding * 2;
859
+ if (widthRequired <= availableWidth) {
860
+ availableWidth -= widthRequired;
861
+ this.showLabel = true;
862
+ }
863
+ }
864
+ if (this.axisConfig.showTick && availableWidth >= this.axisConfig.tickLength) {
865
+ this.showTick = true;
866
+ availableWidth -= this.axisConfig.tickLength;
867
+ }
868
+ if (this.axisConfig.showTitle && this.title) {
869
+ const spaceRequired = this.textDimensionCalculator.getMaxDimension(
870
+ [this.title],
871
+ this.axisConfig.titleFontSize
872
+ );
873
+ const widthRequired = spaceRequired.height + this.axisConfig.titlePadding * 2;
874
+ this.titleTextHeight = spaceRequired.height;
875
+ if (widthRequired <= availableWidth) {
876
+ availableWidth -= widthRequired;
877
+ this.showTitle = true;
878
+ }
879
+ }
880
+ this.boundingRect.width = availableSpace.width - availableWidth;
881
+ this.boundingRect.height = availableSpace.height;
882
+ }
883
+ calculateSpace(availableSpace) {
884
+ if (this.axisPosition === "left" || this.axisPosition === "right") {
885
+ this.calculateSpaceIfDrawnVertical(availableSpace);
886
+ } else {
887
+ this.calculateSpaceIfDrawnHorizontally(availableSpace);
888
+ }
889
+ this.recalculateScale();
890
+ return {
891
+ width: this.boundingRect.width,
892
+ height: this.boundingRect.height
893
+ };
894
+ }
895
+ setBoundingBoxXY(point) {
896
+ this.boundingRect.x = point.x;
897
+ this.boundingRect.y = point.y;
898
+ }
899
+ getDrawableElementsForLeftAxis() {
900
+ const drawableElement = [];
901
+ if (this.showAxisLine) {
902
+ const x = this.boundingRect.x + this.boundingRect.width - this.axisConfig.axisLineWidth / 2;
903
+ drawableElement.push({
904
+ type: "path",
905
+ groupTexts: ["left-axis", "axisl-line"],
906
+ data: [
907
+ {
908
+ path: `M ${x},${this.boundingRect.y} L ${x},${this.boundingRect.y + this.boundingRect.height} `,
909
+ strokeFill: this.axisThemeConfig.axisLineColor,
910
+ strokeWidth: this.axisConfig.axisLineWidth
911
+ }
912
+ ]
913
+ });
914
+ }
915
+ if (this.showLabel) {
916
+ drawableElement.push({
917
+ type: "text",
918
+ groupTexts: ["left-axis", "label"],
919
+ data: this.getTickValues().map((tick) => ({
920
+ text: tick.toString(),
921
+ 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),
922
+ y: this.getScaleValue(tick),
923
+ fill: this.axisThemeConfig.labelColor,
924
+ fontSize: this.axisConfig.labelFontSize,
925
+ rotation: 0,
926
+ verticalPos: "middle",
927
+ horizontalPos: "right"
928
+ }))
929
+ });
930
+ }
931
+ if (this.showTick) {
932
+ const x = this.boundingRect.x + this.boundingRect.width - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0);
933
+ drawableElement.push({
934
+ type: "path",
935
+ groupTexts: ["left-axis", "ticks"],
936
+ data: this.getTickValues().map((tick) => ({
937
+ path: `M ${x},${this.getScaleValue(tick)} L ${x - this.axisConfig.tickLength},${this.getScaleValue(tick)}`,
938
+ strokeFill: this.axisThemeConfig.tickColor,
939
+ strokeWidth: this.axisConfig.tickWidth
940
+ }))
941
+ });
942
+ }
943
+ if (this.showTitle) {
944
+ drawableElement.push({
945
+ type: "text",
946
+ groupTexts: ["left-axis", "title"],
947
+ data: [
948
+ {
949
+ text: this.title,
950
+ x: this.boundingRect.x + this.axisConfig.titlePadding,
951
+ y: this.boundingRect.y + this.boundingRect.height / 2,
952
+ fill: this.axisThemeConfig.titleColor,
953
+ fontSize: this.axisConfig.titleFontSize,
954
+ rotation: 270,
955
+ verticalPos: "top",
956
+ horizontalPos: "center"
957
+ }
958
+ ]
959
+ });
960
+ }
961
+ return drawableElement;
962
+ }
963
+ getDrawableElementsForBottomAxis() {
964
+ const drawableElement = [];
965
+ if (this.showAxisLine) {
966
+ const y = this.boundingRect.y + this.axisConfig.axisLineWidth / 2;
967
+ drawableElement.push({
968
+ type: "path",
969
+ groupTexts: ["bottom-axis", "axis-line"],
970
+ data: [
971
+ {
972
+ path: `M ${this.boundingRect.x},${y} L ${this.boundingRect.x + this.boundingRect.width},${y}`,
973
+ strokeFill: this.axisThemeConfig.axisLineColor,
974
+ strokeWidth: this.axisConfig.axisLineWidth
975
+ }
976
+ ]
977
+ });
978
+ }
979
+ if (this.showLabel) {
980
+ drawableElement.push({
981
+ type: "text",
982
+ groupTexts: ["bottom-axis", "label"],
983
+ data: this.getTickValues().map((tick) => ({
984
+ text: tick.toString(),
985
+ x: this.getScaleValue(tick),
986
+ y: this.boundingRect.y + this.axisConfig.labelPadding + (this.showTick ? this.axisConfig.tickLength : 0) + (this.showAxisLine ? this.axisConfig.axisLineWidth : 0),
987
+ fill: this.axisThemeConfig.labelColor,
988
+ fontSize: this.axisConfig.labelFontSize,
989
+ rotation: 0,
990
+ verticalPos: "top",
991
+ horizontalPos: "center"
992
+ }))
993
+ });
994
+ }
995
+ if (this.showTick) {
996
+ const y = this.boundingRect.y + (this.showAxisLine ? this.axisConfig.axisLineWidth : 0);
997
+ drawableElement.push({
998
+ type: "path",
999
+ groupTexts: ["bottom-axis", "ticks"],
1000
+ data: this.getTickValues().map((tick) => ({
1001
+ path: `M ${this.getScaleValue(tick)},${y} L ${this.getScaleValue(tick)},${y + this.axisConfig.tickLength}`,
1002
+ strokeFill: this.axisThemeConfig.tickColor,
1003
+ strokeWidth: this.axisConfig.tickWidth
1004
+ }))
1005
+ });
1006
+ }
1007
+ if (this.showTitle) {
1008
+ drawableElement.push({
1009
+ type: "text",
1010
+ groupTexts: ["bottom-axis", "title"],
1011
+ data: [
1012
+ {
1013
+ text: this.title,
1014
+ x: this.range[0] + (this.range[1] - this.range[0]) / 2,
1015
+ y: this.boundingRect.y + this.boundingRect.height - this.axisConfig.titlePadding - this.titleTextHeight,
1016
+ fill: this.axisThemeConfig.titleColor,
1017
+ fontSize: this.axisConfig.titleFontSize,
1018
+ rotation: 0,
1019
+ verticalPos: "top",
1020
+ horizontalPos: "center"
1021
+ }
1022
+ ]
1023
+ });
1024
+ }
1025
+ return drawableElement;
1026
+ }
1027
+ getDrawableElementsForTopAxis() {
1028
+ const drawableElement = [];
1029
+ if (this.showAxisLine) {
1030
+ const y = this.boundingRect.y + this.boundingRect.height - this.axisConfig.axisLineWidth / 2;
1031
+ drawableElement.push({
1032
+ type: "path",
1033
+ groupTexts: ["top-axis", "axis-line"],
1034
+ data: [
1035
+ {
1036
+ path: `M ${this.boundingRect.x},${y} L ${this.boundingRect.x + this.boundingRect.width},${y}`,
1037
+ strokeFill: this.axisThemeConfig.axisLineColor,
1038
+ strokeWidth: this.axisConfig.axisLineWidth
1039
+ }
1040
+ ]
1041
+ });
1042
+ }
1043
+ if (this.showLabel) {
1044
+ drawableElement.push({
1045
+ type: "text",
1046
+ groupTexts: ["top-axis", "label"],
1047
+ data: this.getTickValues().map((tick) => ({
1048
+ text: tick.toString(),
1049
+ x: this.getScaleValue(tick),
1050
+ y: this.boundingRect.y + (this.showTitle ? this.titleTextHeight + this.axisConfig.titlePadding * 2 : 0) + this.axisConfig.labelPadding,
1051
+ fill: this.axisThemeConfig.labelColor,
1052
+ fontSize: this.axisConfig.labelFontSize,
1053
+ rotation: 0,
1054
+ verticalPos: "top",
1055
+ horizontalPos: "center"
1056
+ }))
1057
+ });
1058
+ }
1059
+ if (this.showTick) {
1060
+ const y = this.boundingRect.y;
1061
+ drawableElement.push({
1062
+ type: "path",
1063
+ groupTexts: ["top-axis", "ticks"],
1064
+ data: this.getTickValues().map((tick) => ({
1065
+ 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)}`,
1066
+ strokeFill: this.axisThemeConfig.tickColor,
1067
+ strokeWidth: this.axisConfig.tickWidth
1068
+ }))
1069
+ });
1070
+ }
1071
+ if (this.showTitle) {
1072
+ drawableElement.push({
1073
+ type: "text",
1074
+ groupTexts: ["top-axis", "title"],
1075
+ data: [
1076
+ {
1077
+ text: this.title,
1078
+ x: this.boundingRect.x + this.boundingRect.width / 2,
1079
+ y: this.boundingRect.y + this.axisConfig.titlePadding,
1080
+ fill: this.axisThemeConfig.titleColor,
1081
+ fontSize: this.axisConfig.titleFontSize,
1082
+ rotation: 0,
1083
+ verticalPos: "top",
1084
+ horizontalPos: "center"
1085
+ }
1086
+ ]
1087
+ });
1088
+ }
1089
+ return drawableElement;
1090
+ }
1091
+ getDrawableElements() {
1092
+ if (this.axisPosition === "left") {
1093
+ return this.getDrawableElementsForLeftAxis();
1094
+ }
1095
+ if (this.axisPosition === "right") {
1096
+ throw Error("Drawing of right axis is not implemented");
1097
+ }
1098
+ if (this.axisPosition === "bottom") {
1099
+ return this.getDrawableElementsForBottomAxis();
1100
+ }
1101
+ if (this.axisPosition === "top") {
1102
+ return this.getDrawableElementsForTopAxis();
1103
+ }
1104
+ return [];
1105
+ }
1106
+ }
1107
+ class BandAxis extends BaseAxis {
1108
+ constructor(axisConfig, axisThemeConfig, categories, title, textDimensionCalculator) {
1109
+ super(axisConfig, title, textDimensionCalculator, axisThemeConfig);
1110
+ this.categories = categories;
1111
+ this.scale = band().domain(this.categories).range(this.getRange());
1112
+ }
1113
+ setRange(range2) {
1114
+ super.setRange(range2);
1115
+ }
1116
+ recalculateScale() {
1117
+ this.scale = band().domain(this.categories).range(this.getRange()).paddingInner(1).paddingOuter(0).align(0.5);
1118
+ log$1.trace("BandAxis axis final categories, range: ", this.categories, this.getRange());
1119
+ }
1120
+ getTickValues() {
1121
+ return this.categories;
1122
+ }
1123
+ getScaleValue(value) {
1124
+ return this.scale(value) || this.getRange()[0];
1125
+ }
1126
+ }
1127
+ class LinearAxis extends BaseAxis {
1128
+ constructor(axisConfig, axisThemeConfig, domain, title, textDimensionCalculator) {
1129
+ super(axisConfig, title, textDimensionCalculator, axisThemeConfig);
1130
+ this.domain = domain;
1131
+ this.scale = linear().domain(this.domain).range(this.getRange());
1132
+ }
1133
+ getTickValues() {
1134
+ return this.scale.ticks();
1135
+ }
1136
+ recalculateScale() {
1137
+ const domain = [...this.domain];
1138
+ if (this.axisPosition === "left") {
1139
+ domain.reverse();
1140
+ }
1141
+ this.scale = linear().domain(domain).range(this.getRange());
1142
+ }
1143
+ getScaleValue(value) {
1144
+ return this.scale(value);
1145
+ }
1146
+ }
1147
+ function getAxis(data, axisConfig, axisThemeConfig, tmpSVGGroup2) {
1148
+ const textDimensionCalculator = new TextDimensionCalculatorWithFont(tmpSVGGroup2);
1149
+ if (isBandAxisData(data)) {
1150
+ return new BandAxis(
1151
+ axisConfig,
1152
+ axisThemeConfig,
1153
+ data.categories,
1154
+ data.title,
1155
+ textDimensionCalculator
1156
+ );
1157
+ }
1158
+ return new LinearAxis(
1159
+ axisConfig,
1160
+ axisThemeConfig,
1161
+ [data.min, data.max],
1162
+ data.title,
1163
+ textDimensionCalculator
1164
+ );
1165
+ }
1166
+ class ChartTitle {
1167
+ constructor(textDimensionCalculator, chartConfig, chartData, chartThemeConfig) {
1168
+ this.textDimensionCalculator = textDimensionCalculator;
1169
+ this.chartConfig = chartConfig;
1170
+ this.chartData = chartData;
1171
+ this.chartThemeConfig = chartThemeConfig;
1172
+ this.boundingRect = {
1173
+ x: 0,
1174
+ y: 0,
1175
+ width: 0,
1176
+ height: 0
1177
+ };
1178
+ this.showChartTitle = false;
1179
+ }
1180
+ setBoundingBoxXY(point) {
1181
+ this.boundingRect.x = point.x;
1182
+ this.boundingRect.y = point.y;
1183
+ }
1184
+ calculateSpace(availableSpace) {
1185
+ const titleDimension = this.textDimensionCalculator.getMaxDimension(
1186
+ [this.chartData.title],
1187
+ this.chartConfig.titleFontSize
1188
+ );
1189
+ const widthRequired = Math.max(titleDimension.width, availableSpace.width);
1190
+ const heightRequired = titleDimension.height + 2 * this.chartConfig.titlePadding;
1191
+ if (titleDimension.width <= widthRequired && titleDimension.height <= heightRequired && this.chartConfig.showTitle && this.chartData.title) {
1192
+ this.boundingRect.width = widthRequired;
1193
+ this.boundingRect.height = heightRequired;
1194
+ this.showChartTitle = true;
1195
+ }
1196
+ return {
1197
+ width: this.boundingRect.width,
1198
+ height: this.boundingRect.height
1199
+ };
1200
+ }
1201
+ getDrawableElements() {
1202
+ const drawableElem = [];
1203
+ if (this.showChartTitle) {
1204
+ drawableElem.push({
1205
+ groupTexts: ["chart-title"],
1206
+ type: "text",
1207
+ data: [
1208
+ {
1209
+ fontSize: this.chartConfig.titleFontSize,
1210
+ text: this.chartData.title,
1211
+ verticalPos: "middle",
1212
+ horizontalPos: "center",
1213
+ x: this.boundingRect.x + this.boundingRect.width / 2,
1214
+ y: this.boundingRect.y + this.boundingRect.height / 2,
1215
+ fill: this.chartThemeConfig.titleColor,
1216
+ rotation: 0
1217
+ }
1218
+ ]
1219
+ });
1220
+ }
1221
+ return drawableElem;
1222
+ }
1223
+ }
1224
+ function getChartTitleComponent(chartConfig, chartData, chartThemeConfig, tmpSVGGroup2) {
1225
+ const textDimensionCalculator = new TextDimensionCalculatorWithFont(tmpSVGGroup2);
1226
+ return new ChartTitle(textDimensionCalculator, chartConfig, chartData, chartThemeConfig);
1227
+ }
1228
+ class LinePlot {
1229
+ constructor(plotData, xAxis, yAxis, orientation, plotIndex2) {
1230
+ this.plotData = plotData;
1231
+ this.xAxis = xAxis;
1232
+ this.yAxis = yAxis;
1233
+ this.orientation = orientation;
1234
+ this.plotIndex = plotIndex2;
1235
+ }
1236
+ getDrawableElement() {
1237
+ const finalData = this.plotData.data.map((d) => [
1238
+ this.xAxis.getScaleValue(d[0]),
1239
+ this.yAxis.getScaleValue(d[1])
1240
+ ]);
1241
+ let path;
1242
+ if (this.orientation === "horizontal") {
1243
+ path = line().y((d) => d[0]).x((d) => d[1])(finalData);
1244
+ } else {
1245
+ path = line().x((d) => d[0]).y((d) => d[1])(finalData);
1246
+ }
1247
+ if (!path) {
1248
+ return [];
1249
+ }
1250
+ return [
1251
+ {
1252
+ groupTexts: ["plot", `line-plot-${this.plotIndex}`],
1253
+ type: "path",
1254
+ data: [
1255
+ {
1256
+ path,
1257
+ strokeFill: this.plotData.strokeFill,
1258
+ strokeWidth: this.plotData.strokeWidth
1259
+ }
1260
+ ]
1261
+ }
1262
+ ];
1263
+ }
1264
+ }
1265
+ class BarPlot {
1266
+ constructor(barData, boundingRect, xAxis, yAxis, orientation, plotIndex2) {
1267
+ this.barData = barData;
1268
+ this.boundingRect = boundingRect;
1269
+ this.xAxis = xAxis;
1270
+ this.yAxis = yAxis;
1271
+ this.orientation = orientation;
1272
+ this.plotIndex = plotIndex2;
1273
+ }
1274
+ getDrawableElement() {
1275
+ const finalData = this.barData.data.map((d) => [
1276
+ this.xAxis.getScaleValue(d[0]),
1277
+ this.yAxis.getScaleValue(d[1])
1278
+ ]);
1279
+ const barPaddingPercent = 0.05;
1280
+ const barWidth = Math.min(this.xAxis.getAxisOuterPadding() * 2, this.xAxis.getTickDistance()) * (1 - barPaddingPercent);
1281
+ const barWidthHalf = barWidth / 2;
1282
+ if (this.orientation === "horizontal") {
1283
+ return [
1284
+ {
1285
+ groupTexts: ["plot", `bar-plot-${this.plotIndex}`],
1286
+ type: "rect",
1287
+ data: finalData.map((data) => ({
1288
+ x: this.boundingRect.x,
1289
+ y: data[0] - barWidthHalf,
1290
+ height: barWidth,
1291
+ width: data[1] - this.boundingRect.x,
1292
+ fill: this.barData.fill,
1293
+ strokeWidth: 0,
1294
+ strokeFill: this.barData.fill
1295
+ }))
1296
+ }
1297
+ ];
1298
+ }
1299
+ return [
1300
+ {
1301
+ groupTexts: ["plot", `bar-plot-${this.plotIndex}`],
1302
+ type: "rect",
1303
+ data: finalData.map((data) => ({
1304
+ x: data[0] - barWidthHalf,
1305
+ y: data[1],
1306
+ width: barWidth,
1307
+ height: this.boundingRect.y + this.boundingRect.height - data[1],
1308
+ fill: this.barData.fill,
1309
+ strokeWidth: 0,
1310
+ strokeFill: this.barData.fill
1311
+ }))
1312
+ }
1313
+ ];
1314
+ }
1315
+ }
1316
+ class BasePlot {
1317
+ constructor(chartConfig, chartData, chartThemeConfig) {
1318
+ this.chartConfig = chartConfig;
1319
+ this.chartData = chartData;
1320
+ this.chartThemeConfig = chartThemeConfig;
1321
+ this.boundingRect = {
1322
+ x: 0,
1323
+ y: 0,
1324
+ width: 0,
1325
+ height: 0
1326
+ };
1327
+ }
1328
+ setAxes(xAxis, yAxis) {
1329
+ this.xAxis = xAxis;
1330
+ this.yAxis = yAxis;
1331
+ }
1332
+ setBoundingBoxXY(point) {
1333
+ this.boundingRect.x = point.x;
1334
+ this.boundingRect.y = point.y;
1335
+ }
1336
+ calculateSpace(availableSpace) {
1337
+ this.boundingRect.width = availableSpace.width;
1338
+ this.boundingRect.height = availableSpace.height;
1339
+ return {
1340
+ width: this.boundingRect.width,
1341
+ height: this.boundingRect.height
1342
+ };
1343
+ }
1344
+ getDrawableElements() {
1345
+ if (!(this.xAxis && this.yAxis)) {
1346
+ throw Error("Axes must be passed to render Plots");
1347
+ }
1348
+ const drawableElem = [];
1349
+ for (const [i, plot] of this.chartData.plots.entries()) {
1350
+ switch (plot.type) {
1351
+ case "line":
1352
+ {
1353
+ const linePlot = new LinePlot(
1354
+ plot,
1355
+ this.xAxis,
1356
+ this.yAxis,
1357
+ this.chartConfig.chartOrientation,
1358
+ i
1359
+ );
1360
+ drawableElem.push(...linePlot.getDrawableElement());
1361
+ }
1362
+ break;
1363
+ case "bar":
1364
+ {
1365
+ const barPlot = new BarPlot(
1366
+ plot,
1367
+ this.boundingRect,
1368
+ this.xAxis,
1369
+ this.yAxis,
1370
+ this.chartConfig.chartOrientation,
1371
+ i
1372
+ );
1373
+ drawableElem.push(...barPlot.getDrawableElement());
1374
+ }
1375
+ break;
1376
+ }
1377
+ }
1378
+ return drawableElem;
1379
+ }
1380
+ }
1381
+ function getPlotComponent(chartConfig, chartData, chartThemeConfig) {
1382
+ return new BasePlot(chartConfig, chartData, chartThemeConfig);
1383
+ }
1384
+ class Orchestrator {
1385
+ constructor(chartConfig, chartData, chartThemeConfig, tmpSVGGroup2) {
1386
+ this.chartConfig = chartConfig;
1387
+ this.chartData = chartData;
1388
+ this.componentStore = {
1389
+ title: getChartTitleComponent(chartConfig, chartData, chartThemeConfig, tmpSVGGroup2),
1390
+ plot: getPlotComponent(chartConfig, chartData, chartThemeConfig),
1391
+ xAxis: getAxis(
1392
+ chartData.xAxis,
1393
+ chartConfig.xAxis,
1394
+ {
1395
+ titleColor: chartThemeConfig.xAxisTitleColor,
1396
+ labelColor: chartThemeConfig.xAxisLabelColor,
1397
+ tickColor: chartThemeConfig.xAxisTickColor,
1398
+ axisLineColor: chartThemeConfig.xAxisLineColor
1399
+ },
1400
+ tmpSVGGroup2
1401
+ ),
1402
+ yAxis: getAxis(
1403
+ chartData.yAxis,
1404
+ chartConfig.yAxis,
1405
+ {
1406
+ titleColor: chartThemeConfig.yAxisTitleColor,
1407
+ labelColor: chartThemeConfig.yAxisLabelColor,
1408
+ tickColor: chartThemeConfig.yAxisTickColor,
1409
+ axisLineColor: chartThemeConfig.yAxisLineColor
1410
+ },
1411
+ tmpSVGGroup2
1412
+ )
1413
+ };
1414
+ }
1415
+ calculateVerticalSpace() {
1416
+ let availableWidth = this.chartConfig.width;
1417
+ let availableHeight = this.chartConfig.height;
1418
+ let plotX = 0;
1419
+ let plotY = 0;
1420
+ let chartWidth = Math.floor(availableWidth * this.chartConfig.plotReservedSpacePercent / 100);
1421
+ let chartHeight = Math.floor(
1422
+ availableHeight * this.chartConfig.plotReservedSpacePercent / 100
1423
+ );
1424
+ let spaceUsed = this.componentStore.plot.calculateSpace({
1425
+ width: chartWidth,
1426
+ height: chartHeight
1427
+ });
1428
+ availableWidth -= spaceUsed.width;
1429
+ availableHeight -= spaceUsed.height;
1430
+ spaceUsed = this.componentStore.title.calculateSpace({
1431
+ width: this.chartConfig.width,
1432
+ height: availableHeight
1433
+ });
1434
+ plotY = spaceUsed.height;
1435
+ availableHeight -= spaceUsed.height;
1436
+ this.componentStore.xAxis.setAxisPosition("bottom");
1437
+ spaceUsed = this.componentStore.xAxis.calculateSpace({
1438
+ width: availableWidth,
1439
+ height: availableHeight
1440
+ });
1441
+ availableHeight -= spaceUsed.height;
1442
+ this.componentStore.yAxis.setAxisPosition("left");
1443
+ spaceUsed = this.componentStore.yAxis.calculateSpace({
1444
+ width: availableWidth,
1445
+ height: availableHeight
1446
+ });
1447
+ plotX = spaceUsed.width;
1448
+ availableWidth -= spaceUsed.width;
1449
+ if (availableWidth > 0) {
1450
+ chartWidth += availableWidth;
1451
+ availableWidth = 0;
1452
+ }
1453
+ if (availableHeight > 0) {
1454
+ chartHeight += availableHeight;
1455
+ availableHeight = 0;
1456
+ }
1457
+ this.componentStore.plot.calculateSpace({
1458
+ width: chartWidth,
1459
+ height: chartHeight
1460
+ });
1461
+ this.componentStore.plot.setBoundingBoxXY({ x: plotX, y: plotY });
1462
+ this.componentStore.xAxis.setRange([plotX, plotX + chartWidth]);
1463
+ this.componentStore.xAxis.setBoundingBoxXY({ x: plotX, y: plotY + chartHeight });
1464
+ this.componentStore.yAxis.setRange([plotY, plotY + chartHeight]);
1465
+ this.componentStore.yAxis.setBoundingBoxXY({ x: 0, y: plotY });
1466
+ if (this.chartData.plots.some((p) => isBarPlot(p))) {
1467
+ this.componentStore.xAxis.recalculateOuterPaddingToDrawBar();
1468
+ }
1469
+ }
1470
+ calculateHorizontalSpace() {
1471
+ let availableWidth = this.chartConfig.width;
1472
+ let availableHeight = this.chartConfig.height;
1473
+ let titleYEnd = 0;
1474
+ let plotX = 0;
1475
+ let plotY = 0;
1476
+ let chartWidth = Math.floor(availableWidth * this.chartConfig.plotReservedSpacePercent / 100);
1477
+ let chartHeight = Math.floor(
1478
+ availableHeight * this.chartConfig.plotReservedSpacePercent / 100
1479
+ );
1480
+ let spaceUsed = this.componentStore.plot.calculateSpace({
1481
+ width: chartWidth,
1482
+ height: chartHeight
1483
+ });
1484
+ availableWidth -= spaceUsed.width;
1485
+ availableHeight -= spaceUsed.height;
1486
+ spaceUsed = this.componentStore.title.calculateSpace({
1487
+ width: this.chartConfig.width,
1488
+ height: availableHeight
1489
+ });
1490
+ titleYEnd = spaceUsed.height;
1491
+ availableHeight -= spaceUsed.height;
1492
+ this.componentStore.xAxis.setAxisPosition("left");
1493
+ spaceUsed = this.componentStore.xAxis.calculateSpace({
1494
+ width: availableWidth,
1495
+ height: availableHeight
1496
+ });
1497
+ availableWidth -= spaceUsed.width;
1498
+ plotX = spaceUsed.width;
1499
+ this.componentStore.yAxis.setAxisPosition("top");
1500
+ spaceUsed = this.componentStore.yAxis.calculateSpace({
1501
+ width: availableWidth,
1502
+ height: availableHeight
1503
+ });
1504
+ availableHeight -= spaceUsed.height;
1505
+ plotY = titleYEnd + spaceUsed.height;
1506
+ if (availableWidth > 0) {
1507
+ chartWidth += availableWidth;
1508
+ availableWidth = 0;
1509
+ }
1510
+ if (availableHeight > 0) {
1511
+ chartHeight += availableHeight;
1512
+ availableHeight = 0;
1513
+ }
1514
+ this.componentStore.plot.calculateSpace({
1515
+ width: chartWidth,
1516
+ height: chartHeight
1517
+ });
1518
+ this.componentStore.plot.setBoundingBoxXY({ x: plotX, y: plotY });
1519
+ this.componentStore.yAxis.setRange([plotX, plotX + chartWidth]);
1520
+ this.componentStore.yAxis.setBoundingBoxXY({ x: plotX, y: titleYEnd });
1521
+ this.componentStore.xAxis.setRange([plotY, plotY + chartHeight]);
1522
+ this.componentStore.xAxis.setBoundingBoxXY({ x: 0, y: plotY });
1523
+ if (this.chartData.plots.some((p) => isBarPlot(p))) {
1524
+ this.componentStore.xAxis.recalculateOuterPaddingToDrawBar();
1525
+ }
1526
+ }
1527
+ calculateSpace() {
1528
+ if (this.chartConfig.chartOrientation === "horizontal") {
1529
+ this.calculateHorizontalSpace();
1530
+ } else {
1531
+ this.calculateVerticalSpace();
1532
+ }
1533
+ }
1534
+ getDrawableElement() {
1535
+ this.calculateSpace();
1536
+ const drawableElem = [];
1537
+ this.componentStore.plot.setAxes(this.componentStore.xAxis, this.componentStore.yAxis);
1538
+ for (const component of Object.values(this.componentStore)) {
1539
+ drawableElem.push(...component.getDrawableElements());
1540
+ }
1541
+ return drawableElem;
1542
+ }
1543
+ }
1544
+ class XYChartBuilder {
1545
+ static build(config, chartData, chartThemeConfig, tmpSVGGroup2) {
1546
+ const orchestrator = new Orchestrator(config, chartData, chartThemeConfig, tmpSVGGroup2);
1547
+ return orchestrator.getDrawableElement();
1548
+ }
1549
+ }
1550
+ let plotIndex = 0;
1551
+ let tmpSVGGroup;
1552
+ let xyChartConfig = getChartDefaultConfig();
1553
+ let xyChartThemeConfig = getChartDefaultThemeConfig();
1554
+ let xyChartData = getChartDefaultData();
1555
+ let plotColorPalette = xyChartThemeConfig.plotColorPalette.split(",").map((color) => color.trim());
1556
+ let hasSetXAxis = false;
1557
+ let hasSetYAxis = false;
1558
+ function getChartDefaultThemeConfig() {
1559
+ const defaultThemeVariables = getThemeVariables$2();
1560
+ const config = getConfig$1();
1561
+ return cleanAndMerge(defaultThemeVariables.xyChart, config.themeVariables.xyChart);
1562
+ }
1563
+ function getChartDefaultConfig() {
1564
+ const config = getConfig$1();
1565
+ return cleanAndMerge(
1566
+ defaultConfig$2.xyChart,
1567
+ config.xyChart
1568
+ );
1569
+ }
1570
+ function getChartDefaultData() {
1571
+ return {
1572
+ yAxis: {
1573
+ type: "linear",
1574
+ title: "",
1575
+ min: Infinity,
1576
+ max: -Infinity
1577
+ },
1578
+ xAxis: {
1579
+ type: "band",
1580
+ title: "",
1581
+ categories: []
1582
+ },
1583
+ title: "",
1584
+ plots: []
1585
+ };
1586
+ }
1587
+ function textSanitizer(text) {
1588
+ const config = getConfig$1();
1589
+ return sanitizeText$2(text.trim(), config);
1590
+ }
1591
+ function setTmpSVGG(SVGG) {
1592
+ tmpSVGGroup = SVGG;
1593
+ }
1594
+ function setOrientation(orientation) {
1595
+ if (orientation === "horizontal") {
1596
+ xyChartConfig.chartOrientation = "horizontal";
1597
+ } else {
1598
+ xyChartConfig.chartOrientation = "vertical";
1599
+ }
1600
+ }
1601
+ function setXAxisTitle(title) {
1602
+ xyChartData.xAxis.title = textSanitizer(title.text);
1603
+ }
1604
+ function setXAxisRangeData(min, max) {
1605
+ xyChartData.xAxis = { type: "linear", title: xyChartData.xAxis.title, min, max };
1606
+ hasSetXAxis = true;
1607
+ }
1608
+ function setXAxisBand(categories) {
1609
+ xyChartData.xAxis = {
1610
+ type: "band",
1611
+ title: xyChartData.xAxis.title,
1612
+ categories: categories.map((c) => textSanitizer(c.text))
1613
+ };
1614
+ hasSetXAxis = true;
1615
+ }
1616
+ function setYAxisTitle(title) {
1617
+ xyChartData.yAxis.title = textSanitizer(title.text);
1618
+ }
1619
+ function setYAxisRangeData(min, max) {
1620
+ xyChartData.yAxis = { type: "linear", title: xyChartData.yAxis.title, min, max };
1621
+ hasSetYAxis = true;
1622
+ }
1623
+ function setYAxisRangeFromPlotData(data) {
1624
+ const minValue = Math.min(...data);
1625
+ const maxValue = Math.max(...data);
1626
+ const prevMinValue = isLinearAxisData(xyChartData.yAxis) ? xyChartData.yAxis.min : Infinity;
1627
+ const prevMaxValue = isLinearAxisData(xyChartData.yAxis) ? xyChartData.yAxis.max : -Infinity;
1628
+ xyChartData.yAxis = {
1629
+ type: "linear",
1630
+ title: xyChartData.yAxis.title,
1631
+ min: Math.min(prevMinValue, minValue),
1632
+ max: Math.max(prevMaxValue, maxValue)
1633
+ };
1634
+ }
1635
+ function transformDataWithoutCategory(data) {
1636
+ let retData = [];
1637
+ if (data.length === 0) {
1638
+ return retData;
1639
+ }
1640
+ if (!hasSetXAxis) {
1641
+ const prevMinValue = isLinearAxisData(xyChartData.xAxis) ? xyChartData.xAxis.min : Infinity;
1642
+ const prevMaxValue = isLinearAxisData(xyChartData.xAxis) ? xyChartData.xAxis.max : -Infinity;
1643
+ setXAxisRangeData(Math.min(prevMinValue, 1), Math.max(prevMaxValue, data.length));
1644
+ }
1645
+ if (!hasSetYAxis) {
1646
+ setYAxisRangeFromPlotData(data);
1647
+ }
1648
+ if (isBandAxisData(xyChartData.xAxis)) {
1649
+ retData = xyChartData.xAxis.categories.map((c, i) => [c, data[i]]);
1650
+ }
1651
+ if (isLinearAxisData(xyChartData.xAxis)) {
1652
+ const min = xyChartData.xAxis.min;
1653
+ const max = xyChartData.xAxis.max;
1654
+ const step = (max - min + 1) / data.length;
1655
+ const categories = [];
1656
+ for (let i = min; i <= max; i += step) {
1657
+ categories.push(`${i}`);
1658
+ }
1659
+ retData = categories.map((c, i) => [c, data[i]]);
1660
+ }
1661
+ return retData;
1662
+ }
1663
+ function getPlotColorFromPalette(plotIndex2) {
1664
+ return plotColorPalette[plotIndex2 === 0 ? 0 : plotIndex2 % plotColorPalette.length];
1665
+ }
1666
+ function setLineData(title, data) {
1667
+ const plotData = transformDataWithoutCategory(data);
1668
+ xyChartData.plots.push({
1669
+ type: "line",
1670
+ strokeFill: getPlotColorFromPalette(plotIndex),
1671
+ strokeWidth: 2,
1672
+ data: plotData
1673
+ });
1674
+ plotIndex++;
1675
+ }
1676
+ function setBarData(title, data) {
1677
+ const plotData = transformDataWithoutCategory(data);
1678
+ xyChartData.plots.push({
1679
+ type: "bar",
1680
+ fill: getPlotColorFromPalette(plotIndex),
1681
+ data: plotData
1682
+ });
1683
+ plotIndex++;
1684
+ }
1685
+ function getDrawableElem() {
1686
+ if (xyChartData.plots.length === 0) {
1687
+ throw Error("No Plot to render, please provide a plot with some data");
1688
+ }
1689
+ xyChartData.title = getDiagramTitle();
1690
+ return XYChartBuilder.build(xyChartConfig, xyChartData, xyChartThemeConfig, tmpSVGGroup);
1691
+ }
1692
+ function getChartThemeConfig() {
1693
+ return xyChartThemeConfig;
1694
+ }
1695
+ function getChartConfig() {
1696
+ return xyChartConfig;
1697
+ }
1698
+ const clear = function() {
1699
+ clear$1();
1700
+ plotIndex = 0;
1701
+ xyChartConfig = getChartDefaultConfig();
1702
+ xyChartData = getChartDefaultData();
1703
+ xyChartThemeConfig = getChartDefaultThemeConfig();
1704
+ plotColorPalette = xyChartThemeConfig.plotColorPalette.split(",").map((color) => color.trim());
1705
+ hasSetXAxis = false;
1706
+ hasSetYAxis = false;
1707
+ };
1708
+ const db = {
1709
+ getDrawableElem,
1710
+ clear,
1711
+ setAccTitle,
1712
+ getAccTitle,
1713
+ setDiagramTitle,
1714
+ getDiagramTitle,
1715
+ getAccDescription,
1716
+ setAccDescription,
1717
+ setOrientation,
1718
+ setXAxisTitle,
1719
+ setXAxisRangeData,
1720
+ setXAxisBand,
1721
+ setYAxisTitle,
1722
+ setYAxisRangeData,
1723
+ setLineData,
1724
+ setBarData,
1725
+ setTmpSVGG,
1726
+ getChartThemeConfig,
1727
+ getChartConfig
1728
+ };
1729
+ const draw = (txt, id, _version, diagObj) => {
1730
+ const db2 = diagObj.db;
1731
+ const themeConfig = db2.getChartThemeConfig();
1732
+ const chartConfig = db2.getChartConfig();
1733
+ function getDominantBaseLine(horizontalPos) {
1734
+ return horizontalPos === "top" ? "text-before-edge" : "middle";
1735
+ }
1736
+ function getTextAnchor(verticalPos) {
1737
+ return verticalPos === "left" ? "start" : verticalPos === "right" ? "end" : "middle";
1738
+ }
1739
+ function getTextTransformation(data) {
1740
+ return `translate(${data.x}, ${data.y}) rotate(${data.rotation || 0})`;
1741
+ }
1742
+ log$1.debug("Rendering xychart chart\n" + txt);
1743
+ const svg = selectSvgElement(id);
1744
+ const group = svg.append("g").attr("class", "main");
1745
+ const background = group.append("rect").attr("width", chartConfig.width).attr("height", chartConfig.height).attr("class", "background");
1746
+ configureSvgSize(svg, chartConfig.height, chartConfig.width, true);
1747
+ svg.attr("viewBox", `0 0 ${chartConfig.width} ${chartConfig.height}`);
1748
+ background.attr("fill", themeConfig.backgroundColor);
1749
+ db2.setTmpSVGG(svg.append("g").attr("class", "mermaid-tmp-group"));
1750
+ const shapes = db2.getDrawableElem();
1751
+ const groups = {};
1752
+ function getGroup(gList) {
1753
+ let elem = group;
1754
+ let prefix = "";
1755
+ for (const [i] of gList.entries()) {
1756
+ let parent = group;
1757
+ if (i > 0 && groups[prefix]) {
1758
+ parent = groups[prefix];
1759
+ }
1760
+ prefix += gList[i];
1761
+ elem = groups[prefix];
1762
+ if (!elem) {
1763
+ elem = groups[prefix] = parent.append("g").attr("class", gList[i]);
1764
+ }
1765
+ }
1766
+ return elem;
1767
+ }
1768
+ for (const shape of shapes) {
1769
+ if (shape.data.length === 0) {
1770
+ continue;
1771
+ }
1772
+ const shapeGroup = getGroup(shape.groupTexts);
1773
+ switch (shape.type) {
1774
+ case "rect":
1775
+ 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);
1776
+ break;
1777
+ case "text":
1778
+ 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);
1779
+ break;
1780
+ case "path":
1781
+ 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);
1782
+ break;
1783
+ }
1784
+ }
1785
+ };
1786
+ const renderer = {
1787
+ draw
1788
+ };
1789
+ const diagram = {
1790
+ parser: parser$1,
1791
+ db,
1792
+ renderer
1793
+ };
1794
+ export {
1795
+ diagram
1796
+ };