@astrato-io/visualizations 0.0.0-stage → 0.6.5

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 (139) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/LICENSE +93 -0
  3. package/README.md +843 -2
  4. package/THIRD_PARTY_NOTICES.md +8477 -0
  5. package/VISUALIZATION_DEFINITIONS.md +2378 -0
  6. package/chunks/ClickAwayListener-BbeNMAvj.js +52 -0
  7. package/chunks/LinearProgress-B1FeWaen.js +253 -0
  8. package/chunks/accessors-DemrDevR.js +128 -0
  9. package/chunks/app-filter-bar.compiler-BGJ7HAbr.js +64 -0
  10. package/chunks/bar.compiler-CT0ZbQKc.js +374 -0
  11. package/chunks/builder-B6dWSIdD.js +12289 -0
  12. package/chunks/color-settings-ZIvgNTq1.js +10 -0
  13. package/chunks/coloring-B1XAfg6b.js +664 -0
  14. package/chunks/debounce-fn-CUixuz45.js +7 -0
  15. package/chunks/definitions-D3OVqmXl.js +2102 -0
  16. package/chunks/escobar-eDjtGpkC.js +34606 -0
  17. package/chunks/events-WZut5Ow6.js +4 -0
  18. package/chunks/extend-BKUkc4_i.js +37 -0
  19. package/chunks/filter.compiler-DBsyRBJt.js +70 -0
  20. package/chunks/filtering-tqjAyJH5.js +1072 -0
  21. package/chunks/grouping-type-On4s9Thj.js +3 -0
  22. package/chunks/handlers-VTBfIZYZ.js +13072 -0
  23. package/chunks/isEqual-BDxAhUo8.js +7514 -0
  24. package/chunks/line.compiler-CzdM5Ld0.js +198 -0
  25. package/chunks/metadata-BGElBy5Z.js +28 -0
  26. package/chunks/number.compiler-G-R7y16P.js +53 -0
  27. package/chunks/operations-CTNUX6Sy.js +26249 -0
  28. package/chunks/range-CiwTbMig.js +22 -0
  29. package/chunks/registry-CsQQzukD.js +920 -0
  30. package/chunks/requirements-DYjZCFyf.js +6 -0
  31. package/chunks/rolldown-runtime-DleVn1XH.js +28 -0
  32. package/chunks/set-coloring-datafield-B3uIS1Pe.js +8 -0
  33. package/chunks/shared-CBvcC5YV.js +1218 -0
  34. package/chunks/src-BOS6SqkZ.js +67 -0
  35. package/chunks/src-D9XogOrc.js +422 -0
  36. package/chunks/standalone-0M4HlmDW2.js +3944 -0
  37. package/chunks/standalone-0ashe9w1.js +411 -0
  38. package/chunks/standalone-B7jax8wa.js +339 -0
  39. package/chunks/standalone-BK0VYU-l.js +463 -0
  40. package/chunks/standalone-BMIbT1b2.js +4619 -0
  41. package/chunks/standalone-BZV5vOwA.js +6 -0
  42. package/chunks/standalone-BhDrWj4p.js +1980 -0
  43. package/chunks/standalone-BtSHCp2U2.js +673 -0
  44. package/chunks/standalone-BvaKdky9.js +344 -0
  45. package/chunks/standalone-BwtM31-f.js +2 -0
  46. package/chunks/standalone-C3gg736V.js +1129 -0
  47. package/chunks/standalone-CC1VUjO32.js +299 -0
  48. package/chunks/standalone-C_rYnZ0N.js +741 -0
  49. package/chunks/standalone-CoLrAxRV.js +13198 -0
  50. package/chunks/standalone-DC-aUgXC.js +3855 -0
  51. package/chunks/standalone-DCtRoTWg.js +675 -0
  52. package/chunks/standalone-DUDFTBqL.js +833 -0
  53. package/chunks/standalone-DhZkX9Td.js +2 -0
  54. package/chunks/standalone-DtLElfuM.js +512 -0
  55. package/chunks/standalone-G9Q4Uczu.js +726 -0
  56. package/chunks/standalone-JuLF-OoH.js +1762 -0
  57. package/chunks/standalone-_DeX21JJ.js +383 -0
  58. package/chunks/standalone-gFhKZh8m.js +179 -0
  59. package/chunks/standalone-tDNy-SFH.js +281 -0
  60. package/chunks/standalone-v1oxfU20.js +68 -0
  61. package/chunks/standalone-vzBY6q0I2.js +140 -0
  62. package/chunks/stroke-dash-UgMEcCS4.js +6 -0
  63. package/chunks/table.compiler-tb914oj3.js +222 -0
  64. package/chunks/typeof-CJDtcySz.js +13 -0
  65. package/chunks/ui-DQWtv2iM.js +63551 -0
  66. package/chunks/url-utils-B17gj_mr.js +5501 -0
  67. package/chunks/useFieldName-BvdcoJRl.js +7 -0
  68. package/chunks/utils-Bg7K-t6K.js +32379 -0
  69. package/chunks/view-Bn83C8d9.js +12466 -0
  70. package/definitions.js +3 -0
  71. package/docs/operations/astrato-app-filter-bar.md +161 -0
  72. package/docs/operations/bar.md +6968 -0
  73. package/docs/operations/combo.md +5804 -0
  74. package/docs/operations/date-picker.md +644 -0
  75. package/docs/operations/distribution-gauge.md +3082 -0
  76. package/docs/operations/dot.md +5570 -0
  77. package/docs/operations/filter.md +1483 -0
  78. package/docs/operations/gauge.md +3316 -0
  79. package/docs/operations/heatMap.md +5944 -0
  80. package/docs/operations/histogram.md +1856 -0
  81. package/docs/operations/iframe.md +56 -0
  82. package/docs/operations/image.md +177 -0
  83. package/docs/operations/index.md +46 -0
  84. package/docs/operations/line.md +6391 -0
  85. package/docs/operations/number.md +3903 -0
  86. package/docs/operations/pie.md +5956 -0
  87. package/docs/operations/radar.md +4566 -0
  88. package/docs/operations/sankey.md +3088 -0
  89. package/docs/operations/scatter.md +5969 -0
  90. package/docs/operations/shape.md +315 -0
  91. package/docs/operations/simpleTextObject.md +699 -0
  92. package/docs/operations/slider.md +220 -0
  93. package/docs/operations/table.md +8800 -0
  94. package/docs/operations/tree.md +2867 -0
  95. package/docs/operations/treemap.md +3527 -0
  96. package/docs/operations/waterfall.md +2928 -0
  97. package/docs/operations/word-cloud.md +3000 -0
  98. package/getters.js +18 -0
  99. package/index.js +1183 -0
  100. package/metadata.js +20 -0
  101. package/operations.js +64 -0
  102. package/package.json +185 -4
  103. package/src/definitions/index.d.ts +2 -0
  104. package/src/definitions/model/definitions/available-fields.d.ts +35 -0
  105. package/src/definitions/model/definitions/compilers/compile.d.ts +7 -0
  106. package/src/definitions/model/definitions/data-item-resolution.d.ts +19 -0
  107. package/src/definitions/model/definitions/descriptors/descriptor-metadata.d.ts +1341 -0
  108. package/src/definitions/model/definitions/descriptors/json-schema.d.ts +2 -0
  109. package/src/definitions/model/definitions/diagnostics.d.ts +5 -0
  110. package/src/definitions/model/definitions/field-suggestions.d.ts +2 -0
  111. package/src/definitions/model/definitions/index.d.ts +23 -0
  112. package/src/definitions/model/definitions/registry/compile.d.ts +2 -0
  113. package/src/definitions/model/definitions/registry/descriptor-registry.d.ts +3 -0
  114. package/src/definitions/model/definitions/schema-registry.d.ts +660 -0
  115. package/src/definitions/model/definitions/schemas/app-filter-bar.schema.d.ts +22 -0
  116. package/src/definitions/model/definitions/schemas/bar.schema.d.ts +73 -0
  117. package/src/definitions/model/definitions/schemas/broad-chart.schema.d.ts +68 -0
  118. package/src/definitions/model/definitions/schemas/common.schema.d.ts +303 -0
  119. package/src/definitions/model/definitions/schemas/filter.schema.d.ts +22 -0
  120. package/src/definitions/model/definitions/schemas/index.d.ts +9 -0
  121. package/src/definitions/model/definitions/schemas/line.schema.d.ts +72 -0
  122. package/src/definitions/model/definitions/schemas/number.schema.d.ts +21 -0
  123. package/src/definitions/model/definitions/schemas/object.schema.d.ts +215 -0
  124. package/src/definitions/model/definitions/schemas/table.schema.d.ts +458 -0
  125. package/src/definitions/model/definitions/types/compilation.types.d.ts +36 -0
  126. package/src/definitions/model/definitions/types/definition.types.d.ts +2 -0
  127. package/src/definitions/model/definitions/types/descriptor.types.d.ts +39 -0
  128. package/src/definitions/model/definitions/types/index.d.ts +3 -0
  129. package/src/definitions/model/definitions/validation.d.ts +3 -0
  130. package/src/getters/index.d.ts +30 -0
  131. package/src/index.d.ts +4 -0
  132. package/src/metadata/index.d.ts +4 -0
  133. package/src/operations/index.d.ts +30 -0
  134. package/src/registry/index.d.ts +6 -0
  135. package/src/runtime/index.d.ts +2 -0
  136. package/src/types.d.ts +307 -0
  137. package/src/visualization-catalog.d.ts +82 -0
  138. package/src/web-components/index.d.ts +12 -0
  139. package/styles.css +2 -0
@@ -0,0 +1,339 @@
1
+ import { o as e, r as t } from "./rolldown-runtime-DleVn1XH.js";
2
+ import { Fa as n, Ja as r, Ks as i, No as a, Sa as o, Si as s, Ta as c, Ys as l, fc as u } from "./isEqual-BDxAhUo8.js";
3
+ import { $t as d, Ei as f, P as p, Yi as m, hn as h, mn as g } from "./utils-Bg7K-t6K.js";
4
+ import { Pm as _, zm as v } from "./handlers-VTBfIZYZ.js";
5
+ import { Ct as y, Ft as b, Jt as x, K as S, M as C, St as w, Tt as ee, Wt as T, X as E, an as te, dn as D, gt as ne, i as O, j as k, rn as A, sn as j } from "./escobar-eDjtGpkC.js";
6
+ import { t as M } from "./coloring-B1XAfg6b.js";
7
+ import { t as re } from "./set-coloring-datafield-B3uIS1Pe.js";
8
+ var ie = /* @__PURE__ */ e(m()), N = {
9
+ outerRadius: .95,
10
+ cornerRadius: 10,
11
+ additionalTextAnchorHeight: 50,
12
+ barMinWidth: 1,
13
+ barMaxWidth: 200,
14
+ minScaleValue: 0,
15
+ maxScaleValue: 100,
16
+ scalePadding: 1,
17
+ backgroundBarOpacity: .2,
18
+ barWidthRadiusPadding: .2,
19
+ maxBarWidthOfRadius: .15,
20
+ gaugeCollectionKey: "Gauge-Collection"
21
+ }, P = (e) => e.gaugeSettings?.barMode ?? !1, F = (e) => e.gaugeSettings?.comparisonMode ?? !1, ae = (e) => {
22
+ let { coloring: t } = e || {};
23
+ return t?.type === l.Categorical || t?.type === l.Single ? y(e, []) : ee(e);
24
+ }, I = (e, t, r) => {
25
+ let i = { ...w(re(e, ae(e)), t, {}) }, o = e.gaugeSettings?.barPadding ?? j.scale.padding;
26
+ i = S(e, i, o);
27
+ let c = e.dimensions.filter(s), l = e.measures.filter(s).filter((e) => e.role === n.GAUGE_VALUE);
28
+ return !c.length && P(e) ? i.onlyMeasures = {
29
+ data: F(e) ? { extract: { field: l.length > 0 ? u(l[0].dataItem) : void 0 } } : l.map((e) => u(e.dataItem)),
30
+ type: te.Band,
31
+ padding: o
32
+ } : F(e) || (i.onlyMeasures = {
33
+ data: { fields: l.map((e) => u(e.dataItem)) },
34
+ include: [0],
35
+ expand: .05
36
+ }), P(e) && (i.barScale = {
37
+ min: N.minScaleValue - N.scalePadding,
38
+ max: N.maxScaleValue + N.scalePadding,
39
+ invert: e.gaugeSettings?.orientation === a.Vertical
40
+ }), {
41
+ ...r,
42
+ scales: i
43
+ };
44
+ }, L = (e, t, r, i, a) => {
45
+ if (!a) return r;
46
+ let o = e.dimensions.filter(s), c = e.measures.filter(s), l = C((e.supportingMeasures ?? []).filter(s)), d = c.filter((e) => e.role === n.GAUGE_VALUE), f = o[0], p = d[0], { targetType: m } = e.gaugeSettings, h = P(e), g = f?.dataItem ?? p.dataItem, _ = [], y = N.minScaleValue;
47
+ if (F(e) ? _.push(...z(e, g, a, l)) : f ? _.push(...R(e, g, a, l)) : _.push(...B(e, a, l)), h) {
48
+ let t = u(p.dataItem), n = {
49
+ field: u(g),
50
+ props: {
51
+ actual: { field: t },
52
+ color: t,
53
+ start: y,
54
+ end: N.maxScaleValue,
55
+ background: !0,
56
+ ...l
57
+ }
58
+ };
59
+ (m === v.Data || m === v.Manual) && (n.props.target = U(e, a)), c.forEach((e) => {
60
+ let t = `measure-${u(e.dataItem)}`;
61
+ n.props[t] = { field: u(e.dataItem) };
62
+ }), _.push(n);
63
+ }
64
+ let b = [{
65
+ key: N.gaugeCollectionKey,
66
+ data: { extract: _ }
67
+ }];
68
+ return {
69
+ ...r,
70
+ collections: b
71
+ };
72
+ }, R = (e, t, r, i) => {
73
+ let a = e.measures.filter(s), o = a.filter((e) => e.role === n.GAUGE_VALUE), c = a.filter((e) => e.role === n.GAUGE_TARGET), l = o[0], d = c[0], { targetType: f } = e.gaugeSettings, p = P(e), m = [], h = u(l.dataItem);
74
+ return p || m.push({
75
+ field: u(t),
76
+ props: {
77
+ actual: { field: h },
78
+ [h]: { field: h },
79
+ color: h,
80
+ ...i
81
+ }
82
+ }), m.push({
83
+ field: u(t),
84
+ props: {
85
+ actual: { field: h },
86
+ start: p ? N.minScaleValue : void 0,
87
+ end: p ? { getValue: V(e, r) } : void 0,
88
+ [h]: { field: h },
89
+ color: h,
90
+ ...i
91
+ }
92
+ }), (f === v.Data || f === v.Manual) && m.forEach((t) => {
93
+ t.props.target = U(e, r), d && f === v.Data && (t.props[u(d.dataItem)] = { field: u(d.dataItem) });
94
+ }), m;
95
+ }, z = (e, t, r, i) => {
96
+ let a = P(e), o = e.measures.filter(s).filter((e) => e.role === n.GAUGE_VALUE), c = o.reduce((e, t) => {
97
+ let n = u(t.dataItem);
98
+ return e[n] = { field: n }, e;
99
+ }, {});
100
+ return o.map((n, o) => {
101
+ let s = u(n.dataItem);
102
+ return {
103
+ field: u(t),
104
+ props: {
105
+ measure: { field: s },
106
+ color: s,
107
+ start: a ? N.minScaleValue : void 0,
108
+ end: a ? { getValue: V(e, r, o) } : void 0,
109
+ ...c,
110
+ ...i
111
+ }
112
+ };
113
+ });
114
+ }, B = (e, t, r) => {
115
+ let i = P(e), a = [];
116
+ return e.measures.filter(s).filter((e) => e.role === n.GAUGE_VALUE).forEach((n) => {
117
+ let o = u(n.dataItem), s = t[0].items[0][o], c = U(e, t, n), l = [];
118
+ l.push({
119
+ field: o,
120
+ props: {
121
+ measureValue: o,
122
+ measure: { field: o },
123
+ actual: { field: o },
124
+ color: o,
125
+ start: i ? N.minScaleValue : void 0,
126
+ end: i && typeof s == "number" && typeof c == "number" ? H(s, c) : void 0,
127
+ [o]: { field: o },
128
+ ...r
129
+ }
130
+ }), l.push({
131
+ field: o,
132
+ props: {
133
+ measureValue: o,
134
+ measure: { field: o },
135
+ actual: { field: o },
136
+ color: o,
137
+ start: i ? N.minScaleValue : void 0,
138
+ end: i ? N.maxScaleValue : void 0,
139
+ background: !0,
140
+ [o]: { field: o },
141
+ ...r
142
+ }
143
+ }), (e.gaugeSettings?.targetType ?? v.Auto) !== v.Auto && l.forEach((e) => {
144
+ e.props.target = c;
145
+ }), a.push(...l);
146
+ }), a;
147
+ }, V = (e, t, r) => {
148
+ let i = e.measures.filter(s), a = i.filter((e) => e.role === n.GAUGE_VALUE), o = i.filter((e) => e.role === n.GAUGE_TARGET), c = a[0], l = o[0];
149
+ return (n, i, o) => {
150
+ let s = a.find((e, t) => t === r), d = s && o[u(s.dataItem)];
151
+ if (typeof d == "number" && d < 0) return N.minScaleValue;
152
+ let f = o[u(c.dataItem)], p;
153
+ if (p = e.gaugeSettings?.targetType === v.Data ? o[u(l?.dataItem)] : U(e, t), !o || typeof f != "number" || typeof p != "number") return N.minScaleValue;
154
+ if (!F(e) || r === void 0) return H(f, p);
155
+ let m = 0, h = 0;
156
+ return a.forEach((e, t) => {
157
+ let n = Math.max(0, o[u(e.dataItem)]);
158
+ m += n, t <= r && (h += n);
159
+ }), h / m * N.maxScaleValue;
160
+ };
161
+ }, H = (e, t) => {
162
+ let n = t ? Math.max(0, e) / t : 1;
163
+ return Math.min(n, 1) * N.maxScaleValue;
164
+ }, U = (e, t, r) => {
165
+ let { targetType: i, targetValue: a } = e.gaugeSettings, o = e.measures.filter(s), c = o.filter((e) => e.role === n.GAUGE_TARGET)[0];
166
+ return i === v.Auto ? t[0].items.map((e) => o.map((t) => e[u(t.dataItem)])).reduce((e, t) => Math.max(...t, e), 0) * (1 + j.scale.padding) : c && i === v.Data ? { field: u(c.dataItem) } : r && i === v.PerMeasure ? r.targetValue ?? 0 : i === v.Manual ? a ?? 0 : 0;
167
+ }, W = /* @__PURE__ */ function(e) {
168
+ return e.Foreground = "foreground", e.Background = "background", e;
169
+ }({}), G = (e, t, n = 0) => `${e}-${t}-${n}`, K = (e) => Math.min(N.maxBarWidthOfRadius, N.outerRadius / e), q = (e, t, r) => {
170
+ let i = e.measures.filter(s).filter((e) => e.role === n.GAUGE_VALUE);
171
+ return (e) => r !== void 0 && e.measure?.source?.field !== u(i[r]?.dataItem) ? !1 : e.background?.value ? t === W.Background : t === W.Foreground;
172
+ }, J = (e, t) => !t || e.coloring?.type === l.Single ? !1 : !F(e) || e.coloring?.type === l.Categorical, Y = (e, t, r, i, a, o, c, l) => {
173
+ let d = r.dimensions.filter(s)[0], f = new M(r, i, t?.[0]?.itemsNotAffectedByFiltering), p = f.getColorDefinition(J(r, d) ? { ref: f.MAIN_FIELD } : {}), m = (e, t) => !F(r) && t === 1 || o && F(r) ? "transparent" : typeof p == "function" ? p(e) : p, h = K(c), g = Number(r.gaugeSettings?.size), _ = Number(r.gaugeSettings?.startAngle), y = isNaN(g) ? 360 : g ?? 360, b = isNaN(_) ? 0 : _ ?? 0, x = b + y, S = b / 180 * Math.PI, C = x / 180 * Math.PI;
174
+ return {
175
+ key: G(D.Pie, o ? W.Background : W.Foreground, a),
176
+ type: D.Pie,
177
+ animations: {
178
+ enabled: !0,
179
+ presetId: "pie-chart"
180
+ },
181
+ data: {
182
+ collection: N.gaugeCollectionKey,
183
+ filter: (t) => {
184
+ if (!d) {
185
+ let e = r.measures.filter(s).filter((e) => e.role === n.GAUGE_VALUE);
186
+ return F(r) || e[a] && t.measure?.source?.field === u(e[a].dataItem);
187
+ }
188
+ return `${t.value}` == `${e[u(d.dataItem)]}`;
189
+ }
190
+ },
191
+ settings: {
192
+ startAngle: S,
193
+ endAngle: C,
194
+ slice: {
195
+ cornerRadius: r.gaugeSettings?.cornerRadius ?? 10,
196
+ outerRadius: N.outerRadius - a * h,
197
+ innerRadius: N.outerRadius - (a + (1 - N.barWidthRadiusPadding)) * h,
198
+ fill: m,
199
+ strokeWidth: .1,
200
+ opacity: o ? N.backgroundBarOpacity : 1,
201
+ arc: (e, t) => {
202
+ if (o) return +(t === 0);
203
+ if (F(r)) return e.datum.measure.value;
204
+ if ((r.gaugeSettings.targetType ?? v.Auto) !== v.Auto) return t === 0 ? e.datum.actual.value : Number(e.datum.target.value) - Number(e.datum.actual.value);
205
+ {
206
+ let n = e.resources.scale("onlyMeasures"), r = Number(n(e.datum.actual.value)) || 0;
207
+ return t === 0 ? r : 1 - r;
208
+ }
209
+ }
210
+ }
211
+ },
212
+ brush: T([""], l, { overwriteOpacity: o ? N.backgroundBarOpacity : null })
213
+ };
214
+ }, X = (e, t, n, r, i, o) => {
215
+ let l = e.dimensions.filter(s)[0], d = new M(e, t, n?.[0]?.itemsNotAffectedByFiltering), f;
216
+ f = r === W.Background && e.gaugeSettings?.backgroundBarColor ? e.gaugeSettings?.backgroundBarColor : d.getColorDefinition(J(e, l) ? { ref: d.MAIN_FIELD } : {}, !e.gaugeSettings?.backgroundBarColor && r === W.Background ? N.backgroundBarOpacity : null);
217
+ let p = l ? u(l.dataItem) : "onlyMeasures", m = !l && !F(e) ? "measureValue" : void 0, h = {
218
+ key: G(D.Box, r, i),
219
+ type: D.Box,
220
+ animations: { enabled: !0 },
221
+ data: {
222
+ collection: N.gaugeCollectionKey,
223
+ filter: q(e, r, i)
224
+ },
225
+ settings: {
226
+ orientation: e.gaugeSettings.orientation ?? a.Horizontal,
227
+ major: {
228
+ scale: p,
229
+ ref: m
230
+ },
231
+ minor: { scale: "barScale" },
232
+ box: {
233
+ minWidthPx: 2,
234
+ fill: f,
235
+ rx: e.gaugeSettings?.barRadius ?? 0
236
+ }
237
+ },
238
+ brush: T([""], o, { disable: { triggers: r === W.Foreground } })
239
+ };
240
+ return e.gaugeSettings?.strokeEnabled ? (h.settings.box.stroke = e.gaugeSettings?.strokeColor || t.colors.brandColors[0], h.settings.box.strokeWidth = e.gaugeSettings?.strokeWidth) : h.settings.box.stroke = c.transparent, h;
241
+ }, oe = (e, t, n, r, i, a) => {
242
+ if (!i) return n;
243
+ let o = [];
244
+ return o = P(e) ? ce(e, t, r, i, a) : se(e, t, r, i, a), {
245
+ ...n,
246
+ components: [...n.components, ...o]
247
+ };
248
+ }, se = (e, t, r, i, a) => {
249
+ let o = e.dimensions.filter(s), c = e.measures.filter(s).filter((e) => e.role === n.GAUGE_VALUE);
250
+ return !o[0] && !F(e) ? c.map((n, r) => [Y(i[0].items[0], i, e, t, r, !0, c.length), Y(i[0].items[0], i, e, t, r, !1, c.length)]).reduce((e, t) => e.concat(t), []) : i[0].items.map((n, r) => [Y(n, i, e, t, r, !0, i[0].items.length, a), Y(n, i, e, t, r, !1, i[0].items.length, a)]).reduce((e, t) => e.concat(t), []);
251
+ }, ce = (e, t, r, i, a) => {
252
+ let o = e.dimensions.filter(s), c = e.measures.filter(s).filter((e) => e.role === n.GAUGE_VALUE), l = o[0], u = [];
253
+ if (F(e)) for (let n = c.length - 1; n >= 0; n--) u.push(X(e, t, i, W.Foreground, n, a));
254
+ else if (l) u = [X(e, t, i, W.Background, void 0, a), X(e, t, i, W.Foreground, void 0, a)];
255
+ else for (let n = c.length - 1; n >= 0; n--) u.push(X(e, t, i, W.Background, n)), u.push(X(e, t, i, W.Foreground, n));
256
+ return u;
257
+ }, le = (e, t, r) => {
258
+ let i = e.dimensions.filter(s), a = e.measures.filter(s).filter((e) => e.role === n.GAUGE_VALUE);
259
+ if (!e.gaugeSettings?.barMode || !i.length && e.gaugeSettings?.comparisonMode) return r;
260
+ let o = [];
261
+ return i.length ? (e.gaugeSettings?.showDimensionLabels !== !1 && i[0] && o.push(Z(!1, t, i[0].formatter, "dimension", void 0, e.gaugeSettings)), !e.gaugeSettings?.comparisonMode && e.gaugeSettings?.showValueLabels !== !1 && a[0] && o.push(Z(!0, t, a[0].formatter, "value", void 0, e.gaugeSettings))) : e.gaugeSettings?.showValueLabels !== !1 && a.forEach((n, r) => {
262
+ o.push(Z(!0, t, n.formatter, String(r), r, e.gaugeSettings));
263
+ }), {
264
+ ...r,
265
+ components: [...r.components, ...o]
266
+ };
267
+ }, Z = (e, t, n, r, i, o) => {
268
+ let s = +!!e, c = {
269
+ type: "bar",
270
+ settings: {
271
+ direction: o?.orientation === a.Vertical ? "up" : "right",
272
+ fontSize: x(o?.labelFontSize),
273
+ fontFamily: t.fonts.general.fontFamily,
274
+ labels: [{
275
+ label: (t) => t.data ? e ? ue(t.data.actual.value, n, t) : `${h(n, t.data?.label)}` : "",
276
+ placements: e ? [{
277
+ position: _.Outside,
278
+ fill: "#000",
279
+ justify: 0
280
+ }, {
281
+ position: _.Inside,
282
+ fill: "#fff",
283
+ justify: s
284
+ }] : [{
285
+ position: _.Inside,
286
+ fill: "#fff",
287
+ justify: s
288
+ }]
289
+ }]
290
+ }
291
+ };
292
+ return {
293
+ type: D.Labels,
294
+ key: `gauge-bar-labels-${r}`,
295
+ layout: { displayOrder: b.Labels },
296
+ settings: { sources: [{
297
+ component: G(D.Box, W.Foreground, i),
298
+ selector: A.Rect,
299
+ strategy: c
300
+ }] },
301
+ animations: {
302
+ enabled: !0,
303
+ presetId: "chart-labels"
304
+ }
305
+ };
306
+ }, ue = (e, t, n) => e === null ? "-" : typeof t != "string" && r(t) ? g(t.format, t)(e, void 0, n.data) : `${h(t, e)}`, Q = (e, t, n, r) => ne(e, t, n, r), de = (e, t, r, i, a) => {
307
+ if (!a) return r;
308
+ let o = e.dimensions.filter(s), c = e.measures.filter(s).filter((e) => e.role === n.GAUGE_VALUE), l = o[0], u = P(e), d = F(e), f = u ? D.Box : D.Pie, p = u && !d ? W.Background : W.Foreground, m = ((u || !l ? c : a[0]?.items) || []).map((e, t) => G(f, p, t));
309
+ return E(e, t, r, {
310
+ filter: (e) => e.filter((e) => m.findIndex((t) => t === e.key) !== -1),
311
+ placement: {
312
+ type: u ? "bounds" : "slice",
313
+ area: "target"
314
+ }
315
+ });
316
+ }, fe = class extends k {
317
+ constructor() {
318
+ super([
319
+ L,
320
+ I,
321
+ oe,
322
+ le,
323
+ Q,
324
+ de
325
+ ]);
326
+ }
327
+ preCompile(e) {
328
+ if (!e.measures.filter(s).filter((e) => e.role === n.GAUGE_VALUE).length) throw Error("Charts w/o measures are not supported ATM.");
329
+ }
330
+ }, pe = f(), $ = d(({ vSpec: e, vTheme: t, data: n, elementSize: r, vizProperties: a }) => {
331
+ let s = p(), [c] = (0, ie.useState)(() => new fe()), l = t || o, u = c.compile(e, l, n, r, a, i.Gauge, s);
332
+ return u ? /* @__PURE__ */ (0, pe.jsx)(O, {
333
+ config: a,
334
+ definition: u,
335
+ size: r,
336
+ vSpec: e
337
+ }) : null;
338
+ }), me = /* @__PURE__ */ t({ GaugeChart: () => $ });
339
+ export { $ as n, me as t };