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