@astrato-io/visualizations 0.8.0 → 0.10.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 (161) hide show
  1. package/README.md +9 -5
  2. package/THIRD_PARTY_NOTICES.md +403 -325
  3. package/VISUALIZATION_DEFINITIONS.md +319 -32
  4. package/chunks/{Button-BrGKp9Nm.js → Button-CCF851ea.js} +10 -10
  5. package/chunks/CircularProgress-yupH6YWs.js +765 -0
  6. package/chunks/FieldTypeIcon-D_MzsdfY.js +22 -0
  7. package/chunks/LinearProgress-CyFjN4px.js +327 -0
  8. package/chunks/{MenuOption-ByRqhRdX.js → MenuOption-CQpT79AP.js} +1391 -1008
  9. package/chunks/Title-C-p4ZarD.js +1804 -0
  10. package/chunks/_createAggregator-BF4qG9XK.js +50 -0
  11. package/chunks/{app-filter-bar.compiler-TwVTeoj5.js → app-filter-bar.compiler-8fxCo2q7.js} +10 -10
  12. package/chunks/bar-layout-DStC-GNV.js +9 -0
  13. package/chunks/{bar.compiler-DuQg8EUb.js → bar.compiler-CQAu8KL8.js} +102 -84
  14. package/chunks/{builder-DEDvNq1k.js → builder-CScg1TOS.js} +156 -60
  15. package/chunks/color-rules-DYJL4fIW.js +15 -0
  16. package/chunks/color-settings-DJFoFTip.js +5 -0
  17. package/chunks/{coloring-CncX_JRX.js → coloring-9jU3s_-p.js} +41 -41
  18. package/chunks/contains-BK-sRXcB.js +21 -0
  19. package/chunks/createSimplePaletteValueFilter-C4hZpCdn.js +2005 -0
  20. package/chunks/defaults-cyNhn37t.js +3 -0
  21. package/chunks/{definitions-BPJQTx16.js → definitions-C4grxhye.js} +612 -400
  22. package/chunks/{escobar-DRhRMYRE.js → escobar-CjirINHP.js} +5354 -5473
  23. package/chunks/{extend-preset-CUFNpmPe.js → extend-preset-D-l9u_we.js} +974 -909
  24. package/chunks/{filter.compiler-w27dlv0C.js → filter.compiler-lji2Acgn.js} +7 -7
  25. package/chunks/{filtering-cc7WqWpg.js → filtering-C1zakrrX.js} +570 -390
  26. package/chunks/handlers-ZviIUC-j.js +15387 -0
  27. package/chunks/{icon-picker-styles-CoJmwTRi.js → icon-picker-styles-Bj80ZUBK.js} +11 -11
  28. package/chunks/isEqual-Ch9OEye3.js +16 -0
  29. package/chunks/isFocusVisible-CgMP0qkR.js +144 -0
  30. package/chunks/label-format-type-C46pzgx7.js +17 -0
  31. package/chunks/{line.compiler-Ct1WhN2p.js → line.compiler-De5fiKuR.js} +6 -6
  32. package/chunks/{logger-DpQtYQnX.js → logger-CKRjhSHQ.js} +77 -66
  33. package/chunks/map.compiler-CKzorLgK.js +345 -0
  34. package/chunks/{metadata-WABZrt7Y.js → metadata-Bb9pTXrq.js} +1 -1
  35. package/chunks/{number.compiler-D8TPly-4.js → number.compiler-CaTmJkmi.js} +4 -4
  36. package/chunks/operations-DZoY50VX.js +31297 -0
  37. package/chunks/{range-Bi-7zT0k.js → range-D1BTmFMp.js} +2 -2
  38. package/chunks/react-dom-Dgv2azN2.js +368 -0
  39. package/chunks/{render-wrappers-OEmtaM8g.js → render-wrappers-_P3xwu5A.js} +1 -1
  40. package/chunks/{requirements-Dvd8jqYF.js → requirements-NHNrR8Ie.js} +55 -53
  41. package/chunks/responsive.styles-FItb913l.js +93 -0
  42. package/chunks/shared-UitWpq1J.js +1331 -0
  43. package/chunks/standalone-B0U6c3su.js +3638 -0
  44. package/chunks/{standalone-we5D5MIn.js → standalone-BBu90BhK.js} +113 -113
  45. package/chunks/standalone-BEekPuA12.js +357 -0
  46. package/chunks/{standalone-BMTCb10X.js → standalone-BOzHA_d4.js} +41 -41
  47. package/chunks/standalone-BR2JuRIC.js +422 -0
  48. package/chunks/{standalone-BGkmozIb.js → standalone-BapqaniK.js} +619 -619
  49. package/chunks/standalone-Bnnr87pc.js +2009 -0
  50. package/chunks/standalone-BwJqDj2Z.js +396 -0
  51. package/chunks/{standalone-BDhPQtzQ.js → standalone-ByKKqT5L.js} +308 -300
  52. package/chunks/{standalone-vBnBS2YC.js → standalone-CRdDZYeM.js} +1788 -1004
  53. package/chunks/standalone-CRfDOO1x.js +287 -0
  54. package/chunks/{standalone-D5Q5ngsD.js → standalone-CVknVdUC.js} +30 -27
  55. package/chunks/standalone-CbPk8bKn.js +580 -0
  56. package/chunks/{standalone-CJvIXsQE.js → standalone-Ck63MZzj.js} +234 -232
  57. package/chunks/{standalone-CM5XcAN5.js → standalone-DCFY1MAV.js} +8075 -7729
  58. package/chunks/{standalone-DW6NT205.js → standalone-DZDGX3aa.js} +168 -168
  59. package/chunks/standalone-DhfgeJIk.js +1012 -0
  60. package/chunks/{standalone-DT0wKji7.js → standalone-DibjA73M.js} +2 -2
  61. package/chunks/{standalone-XuGksArp.js → standalone-DtBk_iUz.js} +9 -8
  62. package/chunks/standalone-DxBAyqAu.js +772 -0
  63. package/chunks/standalone-KMQPsNsq.js +2 -0
  64. package/chunks/standalone-MBLSvsrY.js +2 -0
  65. package/chunks/standalone-U0WJwFlG.js +354 -0
  66. package/chunks/{standalone-C8ZAEutO.js → standalone-swGs70tD.js} +49 -51
  67. package/chunks/standalone-wgFAVnnm.js +355 -0
  68. package/chunks/standalone-xGV0dqPV.js +689 -0
  69. package/chunks/{table.compiler-DMeeHxb6.js → table.compiler-OWSx5MOq.js} +7 -7
  70. package/chunks/{typeof-CJDtcySz.js → typeof-DCq3QgvY.js} +6 -1
  71. package/chunks/useFieldName-B8iCYyw1.js +7 -0
  72. package/chunks/{utils-vdmi_2PK.js → utils-3Igg6xmO.js} +7668 -12779
  73. package/chunks/{view-BuwQugKb.js → view-DdMLZySj.js} +2430 -2110
  74. package/chunks/{visualization-filters-Cc4KU-l-.js → visualization-filters-CzvFHE6M.js} +5205 -4438
  75. package/chunks/with-html-element-DOfkR3C1.js +16094 -0
  76. package/definitions.js +2 -2
  77. package/docs/operations/astrato-app-filter-bar.md +1 -1
  78. package/docs/operations/bar.md +303 -2
  79. package/docs/operations/combo.md +262 -1
  80. package/docs/operations/date-picker.md +1 -1
  81. package/docs/operations/distribution-gauge.md +1 -1
  82. package/docs/operations/dot.md +148 -1
  83. package/docs/operations/filter.md +1 -1
  84. package/docs/operations/gauge.md +1 -1
  85. package/docs/operations/heatMap.md +1 -1
  86. package/docs/operations/histogram.md +262 -1
  87. package/docs/operations/iframe.md +1 -1
  88. package/docs/operations/image.md +1 -1
  89. package/docs/operations/index.md +8 -8
  90. package/docs/operations/line.md +262 -1
  91. package/docs/operations/number.md +1 -1
  92. package/docs/operations/pie.md +1 -1
  93. package/docs/operations/radar.md +1 -1
  94. package/docs/operations/sankey.md +1 -1
  95. package/docs/operations/scatter.md +148 -1
  96. package/docs/operations/shape.md +1 -1
  97. package/docs/operations/simpleTextObject.md +1 -1
  98. package/docs/operations/slider.md +1 -1
  99. package/docs/operations/table.md +439 -157
  100. package/docs/operations/tree.md +1 -1
  101. package/docs/operations/treemap.md +1 -1
  102. package/docs/operations/waterfall.md +1 -1
  103. package/docs/operations/word-cloud.md +1 -1
  104. package/getters.js +2 -2
  105. package/index.js +523 -469
  106. package/metadata.js +2 -2
  107. package/operations.js +5 -5
  108. package/package.json +74 -68
  109. package/src/definitions/index.d.ts +1 -1
  110. package/src/definitions/model/definitions/available-fields.d.ts +2 -2
  111. package/src/definitions/model/definitions/compilers/compile.d.ts +1 -0
  112. package/src/definitions/model/definitions/data-item-resolution.d.ts +3 -3
  113. package/src/definitions/model/definitions/descriptors/descriptor-metadata.d.ts +535 -349
  114. package/src/definitions/model/definitions/index.d.ts +2 -1
  115. package/src/definitions/model/definitions/schema-registry.d.ts +406 -101
  116. package/src/definitions/model/definitions/schemas/bar.schema.d.ts +10 -8
  117. package/src/definitions/model/definitions/schemas/common.schema.d.ts +33 -32
  118. package/src/definitions/model/definitions/schemas/index.d.ts +1 -0
  119. package/src/definitions/model/definitions/schemas/line.schema.d.ts +10 -10
  120. package/src/definitions/model/definitions/schemas/map.schema.d.ts +590 -0
  121. package/src/definitions/model/definitions/schemas/number.schema.d.ts +4 -4
  122. package/src/definitions/model/definitions/schemas/object.schema.d.ts +38 -38
  123. package/src/definitions/model/definitions/schemas/table.schema.d.ts +61 -61
  124. package/src/definitions/model/definitions/types/compilation.types.d.ts +7 -2
  125. package/src/definitions/model/definitions/types/definition.types.d.ts +2 -2
  126. package/src/definitions/model/definitions/types/index.d.ts +1 -1
  127. package/src/index.d.ts +1 -1
  128. package/src/operations/index.d.ts +1 -1
  129. package/src/types.d.ts +45 -41
  130. package/src/visualization-catalog.d.ts +26 -26
  131. package/chunks/DefaultPropsProvider-BsfB7QTn.js +0 -257
  132. package/chunks/FieldTypeIcon-Drs6hSJF.js +0 -22
  133. package/chunks/LinearProgress-VtfFx2vJ.js +0 -253
  134. package/chunks/Title-CO5dP1ma.js +0 -1691
  135. package/chunks/ToggleButton-KOBAimC1.js +0 -112
  136. package/chunks/color-rules-CN7TcGrC.js +0 -6
  137. package/chunks/color-settings-3VRlf_Vw.js +0 -6
  138. package/chunks/colorManipulator-D8Pjy1pf.js +0 -45
  139. package/chunks/handlers-TOT-7INo.js +0 -12871
  140. package/chunks/isEqual-B8loyPsC.js +0 -12
  141. package/chunks/label-format-type-weq1XfcX.js +0 -8
  142. package/chunks/operations-Dh4v1Ovt.js +0 -26280
  143. package/chunks/responsive.styles-DSiOGD7u.js +0 -82
  144. package/chunks/shared-Bn4N5QcZ.js +0 -1218
  145. package/chunks/standalone-B55oyW6c.js +0 -689
  146. package/chunks/standalone-BXKRE_Se.js +0 -468
  147. package/chunks/standalone-Bes8srx1.js +0 -354
  148. package/chunks/standalone-BjZp0QMe.js +0 -2
  149. package/chunks/standalone-BlMIwpEe.js +0 -1877
  150. package/chunks/standalone-C8qAelL4.js +0 -2
  151. package/chunks/standalone-CLmGb7nn2.js +0 -355
  152. package/chunks/standalone-CXNP6-xD.js +0 -420
  153. package/chunks/standalone-DLlyRIE6.js +0 -287
  154. package/chunks/standalone-DMcI1afI.js +0 -396
  155. package/chunks/standalone-DN4S1MjT.js +0 -3874
  156. package/chunks/standalone-DYQIQH4c.js +0 -2095
  157. package/chunks/standalone-D__XCp-h.js +0 -1003
  158. package/chunks/standalone-XTgSsTAa.js +0 -354
  159. package/chunks/useFieldName-Cjn9KCVp.js +0 -7
  160. package/chunks/useSlotProps-DLbQp4lc.js +0 -166
  161. package/chunks/with-html-element-D0uY2zjI.js +0 -7328
@@ -0,0 +1,580 @@
1
+ import { o as e, t } from "./rolldown-runtime-DleVn1XH.js";
2
+ import { Da as n, Fo as r, N as i, Oi as a, Pc as o, Qo as s, Qr as c, hc as l, ic as u, in as d, is as f, oa as p, vc as m } from "./visualization-filters-CzvFHE6M.js";
3
+ import { F as h, N as g, jt as _, s as ee, zr as te } from "./utils-3Igg6xmO.js";
4
+ import { h_ as v } from "./handlers-ZviIUC-j.js";
5
+ import "./logger-CKRjhSHQ.js";
6
+ import { Et as y, I as ne, St as re, Vt as b, Xt as x, bt as S, ct as C, fn as w, i as T, ln as ie, nt as E, tt as D, un as O, vn as k } from "./escobar-CjirINHP.js";
7
+ import { t as ae } from "./coloring-9jU3s_-p.js";
8
+ import { t as oe } from "./set-coloring-datafield-B3uIS1Pe.js";
9
+ import { t as se } from "./_createAggregator-BF4qG9XK.js";
10
+ import { t as A } from "./range-D1BTmFMp.js";
11
+ var j = (e, t, n) => {
12
+ let r = e.dimensions.filter((e) => c(e)), i = e.measures.filter((e) => c(e)), a = o(r[0]?.dataItem), s = o(r[1]?.dataItem), l = {
13
+ key: "defaultCollection",
14
+ data: { extract: [{
15
+ field: a,
16
+ props: {
17
+ score: { field: o(i[0]?.dataItem) },
18
+ attribute: { field: s || a },
19
+ ...s ? { stackedDimension: { field: a } } : {}
20
+ }
21
+ }] }
22
+ };
23
+ return {
24
+ ...n,
25
+ collections: [l]
26
+ };
27
+ }, M = (e, t, n) => {
28
+ let r = {
29
+ key: "defaultCollection",
30
+ data: { extract: e.measures.filter((e) => c(e)).map((e) => {
31
+ let t = o(e.dataItem);
32
+ return {
33
+ field: t,
34
+ props: {
35
+ score: { field: t },
36
+ attribute: e.label,
37
+ color: t,
38
+ label: d(e) || e.label || e.dataItem.name
39
+ },
40
+ getValue: () => e.label
41
+ };
42
+ }) }
43
+ };
44
+ return {
45
+ ...n,
46
+ collections: [r]
47
+ };
48
+ }, N = (e, ...t) => e.dimensions.filter((e) => c(e)).length ? j(e, ...t) : M(e, ...t), P = (e, t, n, r, i, s) => {
49
+ let l = o(e.dimensions.filter((e) => c(e))[1]?.dataItem), u = new ae(e, t, i?.[0]?.itemsNotAffectedByFiltering), d = e.coloring?.color == null && e.coloring?.type === m.Single, f = {
50
+ type: k.Radar,
51
+ key: `${k.Radar}`,
52
+ layout: { displayOrder: b.VisualizationElement },
53
+ data: { collection: "defaultCollection" },
54
+ settings: {
55
+ dimensionAxis: e.dimensionAxis,
56
+ measureAxis: e.measureAxis,
57
+ gridType: e.gridType,
58
+ lineType: e.lineType,
59
+ isDefaultColor: d,
60
+ isSingleDimension: !l,
61
+ scale: "attributes",
62
+ categoricalOpacity: e.coloring?.categoricalColorTransparency ?? a.categoricalColorTransparency,
63
+ pointStyles: e.pointStyles,
64
+ fill: u.getColorDefinition({
65
+ overwriteSources: [u.MAIN_FIELD],
66
+ ref: "color"
67
+ })
68
+ },
69
+ brush: x(F(e), s, { valuePickerMode: s?.valuePickerMode })
70
+ };
71
+ return {
72
+ ...n,
73
+ components: [...n.components, f]
74
+ };
75
+ };
76
+ function F(e) {
77
+ let t = [], n = e.dimensions.filter((e) => c(e));
78
+ return n[0] && t.push(""), n[1] && t.push("attribute"), t;
79
+ }
80
+ var I = (e, t, n) => {
81
+ let r = e.dimensions.filter((e) => c(e)), i = e.measures.filter((e) => c(e)), a = o(r[0]?.dataItem), s = o(r[1]?.dataItem), l = o(i[0]?.dataItem);
82
+ return {
83
+ ...n,
84
+ scales: {
85
+ ...n.scales,
86
+ ...z(e, t, n),
87
+ values: {
88
+ data: { field: l },
89
+ include: [0],
90
+ nice: !0
91
+ },
92
+ attributes: { data: { extract: { field: s || a } } }
93
+ }
94
+ };
95
+ }, L = (e, t, n) => {
96
+ let r = e.measures.filter((e) => c(e));
97
+ return {
98
+ ...n,
99
+ scales: {
100
+ ...n.scales,
101
+ ...B(e, t),
102
+ values: {
103
+ data: { fields: r.map((e) => o(e.dataItem)) },
104
+ include: [0],
105
+ nice: !0
106
+ },
107
+ attributes: {
108
+ type: w.Band,
109
+ data: r.map((e) => d(e) || e.label || e.dataItem.name)
110
+ }
111
+ }
112
+ };
113
+ }, R = (e, ...t) => e.dimensions.filter((e) => c(e)).length ? I(e, ...t) : L(e, ...t);
114
+ function z(e, t, n) {
115
+ let r = o(e.dimensions.filter((e) => c(e))[0]?.dataItem);
116
+ switch (S(n, 0, { color: { field: r } }), e.coloring?.type) {
117
+ case m.Single: return { [m.Single]: {
118
+ data: { extract: { field: r } },
119
+ type: w.CategoricalColor,
120
+ range: [e?.coloring?.color ?? t.colors.brandColors[0]]
121
+ } };
122
+ case m.Categorical: return { [m.Categorical]: y(oe(e, r), t, r, {
123
+ customPalette: e.coloring.customPalette ?? a.customPalette,
124
+ palette: e.coloring.palette,
125
+ sortOrder: e.coloring.sortOrder
126
+ }, n.collections) };
127
+ }
128
+ return {};
129
+ }
130
+ function B(e, t) {
131
+ let n = e.measures.filter((e) => c(e));
132
+ return { [m.Single]: {
133
+ data: { items: n.map((e) => {
134
+ let t = d(e) || e.label || e.dataItem.name;
135
+ return {
136
+ value: o(e.dataItem),
137
+ label: t
138
+ };
139
+ }) },
140
+ type: w.CategoricalColor,
141
+ range: Array(n.length).fill(e?.coloring?.color ?? t.colors.brandColors[0]),
142
+ value: (e) => `${e.datum.value.value}`,
143
+ label: (e) => `${e.datum.value.label}`
144
+ } };
145
+ }
146
+ var V = .9, H = "attributesLines", U = "dataPoint", W = "white", G = "rgba(128, 128, 128, 0.4)", K = { settings: {
147
+ dimensionAxis: {
148
+ showLabel: !0,
149
+ labelColor: null,
150
+ showLine: !0,
151
+ lineColor: null
152
+ },
153
+ measureAxis: {
154
+ showAxis: !0,
155
+ showAxisLabels: !0,
156
+ showAxisTicks: !0,
157
+ axisColor: null,
158
+ axisLabelsColor: null,
159
+ axisTicksColor: null,
160
+ axisTilt: 0,
161
+ rangeLayers: 5,
162
+ showRangeLayersLines: !0,
163
+ rangeLayersLineColor: null,
164
+ stripedBackground: !0,
165
+ useCustomBackgroundColor: !1,
166
+ plainCustomBackgroundColor: null,
167
+ evenCustomBackgroundColor: null,
168
+ oddCustomBackgroundColor: null
169
+ },
170
+ gridType: f.Circles,
171
+ lineType: s.Straight,
172
+ isSingleDimension: !1,
173
+ scale: "attributes",
174
+ pointStyles: {
175
+ size: 6,
176
+ color: null
177
+ },
178
+ categoricalOpacity: .3,
179
+ isDefaultColor: !1
180
+ } }, ce = (e, t, n, r, i, a) => {
181
+ if (!e.dimensionAxis.showLabel) return n;
182
+ let o = {
183
+ type: k.Labels,
184
+ key: "radar-labels",
185
+ animations: { enabled: !1 },
186
+ layout: { displayOrder: b.Labels },
187
+ settings: { sources: [{
188
+ component: `${k.Radar}`,
189
+ selector: `.${H}`,
190
+ strategy: {
191
+ type: "slice",
192
+ settings: {
193
+ fontSize: ie.dataPoint.valueFontSize,
194
+ fontFamily: t.fonts.general.fontFamily,
195
+ labels: [{
196
+ linkData: ({ data: e }) => e,
197
+ label: ({ data: e }) => e.label,
198
+ placements: [{
199
+ position: v.Outside,
200
+ fill: e.dimensionAxis.labelColor ?? void 0
201
+ }]
202
+ }]
203
+ }
204
+ }
205
+ }] },
206
+ brush: x([""], a, { valuePickerMode: a?.valuePickerMode })
207
+ };
208
+ return {
209
+ ...n,
210
+ components: [...n.components, o]
211
+ };
212
+ }, le = /* @__PURE__ */ e((/* @__PURE__ */ t(((e, t) => {
213
+ var n = i(), r = se(), a = Object.prototype.hasOwnProperty;
214
+ t.exports = r(function(e, t, r) {
215
+ a.call(e, r) ? e[r].push(t) : n(e, r, [t]);
216
+ });
217
+ })))());
218
+ function q(e) {
219
+ let { attributesAmount: t, center: n, radius: r } = e, i = Math.PI * 2 / t;
220
+ return (e, t = 1) => ({
221
+ x: n.x + r * Math.sin(i * e) * t,
222
+ y: n.y - r * Math.cos(i * e) * t
223
+ });
224
+ }
225
+ function ue(e, t) {
226
+ return {
227
+ x: e / 2,
228
+ y: t / 2
229
+ };
230
+ }
231
+ function de(e, t) {
232
+ return V * Math.min(e, t) / 2;
233
+ }
234
+ function fe(e) {
235
+ let t = {};
236
+ return e.forEach(({ data: e }) => {
237
+ t[e.attribute.label] || (t[e.attribute.label] = {
238
+ title: e.attribute.label,
239
+ source: e.attribute.source,
240
+ values: []
241
+ });
242
+ let n = e.score.value;
243
+ typeof n == "number" && t[e.attribute.label].values.push({
244
+ label: e.value,
245
+ value: n
246
+ });
247
+ }), t;
248
+ }
249
+ function J(e, t) {
250
+ let n = [], { cp1: r, cp2: i } = pe(e), a = "M ";
251
+ e.forEach(({ x: o, y: c, ...l }, u) => {
252
+ if (a += `${o} ${c} `, t.lineType === s.Curve) {
253
+ let t = (u + 1) % e.length;
254
+ a += `C ${i[u].x} ${i[u].y}, ${r[t].x} ${r[t].y}, `;
255
+ }
256
+ if (!t.isGrid && "tooltip" in l) {
257
+ let { fill: e, pointStyles: r } = t;
258
+ n.push({
259
+ type: O.Circle,
260
+ tag: U,
261
+ cx: o,
262
+ cy: c,
263
+ r: r.size / 2,
264
+ stroke: r.color ?? e,
265
+ strokeWidth: 1,
266
+ fill: r.color ?? e,
267
+ desc: { tooltip: l.tooltip },
268
+ data: l?.data
269
+ });
270
+ }
271
+ }), t.lineType === s.Curve && (a += `${e[0].x} ${e[0].y}`);
272
+ let o, c;
273
+ t.isGrid ? (o = t.lineStroke, c = t.lineStrokeWidth) : (o = me(t.fill), c = 1), n.push({
274
+ type: O.Path,
275
+ d: `${a}Z`,
276
+ stroke: o,
277
+ strokeWidth: c,
278
+ fill: "none",
279
+ tag: t.isGrid ? "gridline" : "dataline"
280
+ });
281
+ let l, u;
282
+ if (t.isGrid) l = t.backgroundColor, u = 1;
283
+ else {
284
+ l = t.fill;
285
+ let { isDefaultColor: e, opacity: n } = t;
286
+ u = e ? .4 : n ?? 1;
287
+ }
288
+ return n.push({
289
+ type: O.Path,
290
+ d: `${a}Z`,
291
+ fill: l,
292
+ opacity: u,
293
+ tag: t.isGrid ? "gridarea" : "dataarea"
294
+ }), n;
295
+ }
296
+ function pe(e) {
297
+ let t = e.length, n = [], r = [];
298
+ for (let i = 0; i < t; i++) {
299
+ let a = e[(i - 1 + t) % t], o = e[i], s = e[(i + 1) % t], c = (s.x - a.x) / 2, l = (s.y - a.y) / 2;
300
+ n.push({
301
+ x: o.x - c / 3,
302
+ y: o.y - l / 3
303
+ }), r.push({
304
+ x: o.x + c / 3,
305
+ y: o.y + l / 3
306
+ });
307
+ }
308
+ return {
309
+ cp1: n,
310
+ cp2: r
311
+ };
312
+ }
313
+ function me(e) {
314
+ return e = e.replace(/^#/, ""), [3, 6].includes(e.length) ? `#${e}` : e.length === 4 ? `#${e.slice(0, 3)}` : `#${e.slice(0, 6)}`;
315
+ }
316
+ var Y = /* @__PURE__ */ e(A());
317
+ function he(e, t, n) {
318
+ let r = [];
319
+ return t.gridType === f.Lines ? r.push(..._e(e, t.measureAxis)) : r.push(...ge({
320
+ center: e.center,
321
+ radius: e.radius,
322
+ domain: e.domain
323
+ }, t.measureAxis)), r.push(...ve(e, t.dimensionAxis, n)), r;
324
+ }
325
+ function ge({ center: e, radius: t, domain: n }, r) {
326
+ let i = Z(r);
327
+ return X(r.rangeLayers, n).reverse().filter((e) => e > 0).map((a, o) => ({
328
+ type: O.Circle,
329
+ cx: e.x,
330
+ cy: e.y,
331
+ r: t * a / n,
332
+ stroke: r.rangeLayersLineColor ?? "#000",
333
+ strokeWidth: r.showRangeLayersLines ? .5 : 0,
334
+ fill: i(o),
335
+ tag: "gridline"
336
+ }));
337
+ }
338
+ function _e({ center: e, radius: t, domain: n, attributesAmount: r }, i) {
339
+ let a = q({
340
+ attributesAmount: r,
341
+ center: e,
342
+ radius: t
343
+ }), o = Z(i), s = [];
344
+ return X(i.rangeLayers, n).reverse().filter((e) => e > 0).forEach((e, t) => {
345
+ let c = (0, Y.default)(r).map((t) => a(t, e / n)), l = {
346
+ isGrid: !0,
347
+ backgroundColor: o(t),
348
+ lineStroke: i.rangeLayersLineColor ?? "#000",
349
+ lineStrokeWidth: +!!i.showRangeLayersLines
350
+ };
351
+ s.push(...J(c, l));
352
+ }), s;
353
+ }
354
+ function ve(e, t, n) {
355
+ let { attributesAmount: r, center: i, radius: a, labels: o } = e, s = q({
356
+ attributesAmount: r,
357
+ center: i,
358
+ radius: a
359
+ }), c = (0, Y.default)(r).map((e) => s(e)), l = [], u = 2 * Math.PI / r, d = 360 / r;
360
+ return c.forEach(({ x: e, y: r }, s) => {
361
+ let c = n[o[s]].source;
362
+ l.push({
363
+ type: O.Line,
364
+ x1: i.x,
365
+ y1: i.y,
366
+ x2: e,
367
+ y2: r,
368
+ stroke: t.lineColor ?? "black",
369
+ strokeWidth: +!!t.showLine
370
+ }), l.push({
371
+ type: O.Rect,
372
+ tag: H,
373
+ data: {
374
+ label: o[s],
375
+ value: o[s],
376
+ ...c ? { source: c } : {}
377
+ },
378
+ desc: {
379
+ slice: {
380
+ start: (s - .5) * u,
381
+ end: (s + .5) * u,
382
+ outerRadius: a,
383
+ offset: {
384
+ x: i.x,
385
+ y: i.y
386
+ }
387
+ },
388
+ tooltip: { ...n[o[s]] }
389
+ },
390
+ x: i.x,
391
+ y: i.y - 20 / 2,
392
+ width: a,
393
+ height: 20,
394
+ fill: "transparent",
395
+ transform: `rotate(${s * d - 90}, ${i.x}, ${i.y})`
396
+ });
397
+ }), l;
398
+ }
399
+ function X(e, t) {
400
+ return (0, Y.default)(e + 1).map((n) => n * t / e);
401
+ }
402
+ function Z(e) {
403
+ return (t) => {
404
+ if (!e.stripedBackground) return e.useCustomBackgroundColor ? e.plainCustomBackgroundColor ?? "white" : W;
405
+ let n = W, r = G;
406
+ return e.useCustomBackgroundColor && (n = e.evenCustomBackgroundColor ?? "white", r = e.oddCustomBackgroundColor ?? "rgba(128, 128, 128, 0.4)"), t % 2 == 1 ? n : r;
407
+ };
408
+ }
409
+ var ye = {
410
+ require: [
411
+ "resolver",
412
+ "chart",
413
+ "renderer"
414
+ ],
415
+ defaultSettings: K,
416
+ render({ data: e }) {
417
+ let { chart: t, resolver: n } = this;
418
+ if (!t || !n) return [];
419
+ let { width: r, height: i } = this.rect, a = ue(r, i), o = de(r, i), s = t.scale("attributes"), c = t.scale("values");
420
+ if (!s || !c) return [];
421
+ let l = s.ticks().length, u = s.domain(), d = c.domain()[1], f = this.settings.settings, { items: p } = n.resolve({
422
+ data: e,
423
+ settings: f
424
+ }), h = f.isSingleDimension ? [p] : Object.values((0, le.default)(p, "data.value")), g = q({
425
+ attributesAmount: l,
426
+ center: a,
427
+ radius: o
428
+ }), _ = [];
429
+ return h.forEach((e) => {
430
+ let n = e[0];
431
+ if (!n) return;
432
+ let r = e.map((e) => {
433
+ let t = u.findIndex((t) => t === e.data.attribute.value), n = e.data.score.value / d;
434
+ return {
435
+ ...g(t, n),
436
+ tooltip: {
437
+ title: e.data.label,
438
+ label: e.data.attribute.label,
439
+ value: e.data.score.value
440
+ },
441
+ data: e.data?.stackedDimension
442
+ };
443
+ }), i = {
444
+ isGrid: !1,
445
+ fill: n.fill,
446
+ isDefaultColor: f.isDefaultColor ?? !1,
447
+ opacity: t.scale(m.Categorical) ? f.categoricalOpacity ?? null : null,
448
+ pointStyles: {
449
+ ...f.pointStyles,
450
+ color: f.pointStyles.color ?? n.fill
451
+ },
452
+ lineType: f.lineType
453
+ };
454
+ _.push(...J(r, i));
455
+ }), [...he({
456
+ center: a,
457
+ domain: d,
458
+ radius: o,
459
+ attributesAmount: l,
460
+ labels: s.labels()
461
+ }, f, fe(p)), ..._];
462
+ }
463
+ };
464
+ function be(e) {
465
+ e.component(k.Radar, ye);
466
+ }
467
+ var xe = (e, t, n) => D(e, t, D(e, t, n, {
468
+ filter: Se,
469
+ placement: {
470
+ type: "bounds",
471
+ area: "target"
472
+ },
473
+ extract: E(e, t, we, $)
474
+ }, "points-tooltip"), {
475
+ filter: Ce,
476
+ placement: {
477
+ type: "slice",
478
+ area: "target"
479
+ },
480
+ extract: E(e, t, Q, $)
481
+ }, "attributes-lines-tooltip");
482
+ function Se(e) {
483
+ let t = e.find((e) => e.tag === U);
484
+ return t ? [t] : [];
485
+ }
486
+ function Ce(e) {
487
+ if (e.find((e) => e.tag === "dataPoint")) return [];
488
+ let t = e.find((e) => e.tag === H);
489
+ return t ? [t] : [];
490
+ }
491
+ var we = (e, t, { formatter: n }, r, i, a, o) => {
492
+ if (t.tag === "dataPoint" && t.desc?.tooltip) {
493
+ let r = e.filter((e) => c(e)), { label: i, value: a } = t.desc.tooltip, s = a;
494
+ return !o && r[0]?.formatter ? s = n(r[0].formatter)(s) : o && (s = n(C(r[0]?.formatter))(s)), [{
495
+ value: s,
496
+ label: i
497
+ }];
498
+ }
499
+ return [];
500
+ }, Q = (e, t, { formatter: n }, r, i, a, o) => {
501
+ if (t.tag === "attributesLines" && t.desc?.tooltip) {
502
+ let r = e.filter((e) => c(e));
503
+ return t.desc.tooltip.values.map(({ label: e, value: t }) => {
504
+ let i = t;
505
+ return !o && r[0]?.formatter ? i = n(r[0].formatter)(i) : o && (i = n(C(r[0]?.formatter))(i)), {
506
+ value: i,
507
+ label: e
508
+ };
509
+ });
510
+ }
511
+ return [];
512
+ };
513
+ function $(e, t) {
514
+ let n = e.filter((e) => c(e));
515
+ if (!n.length) return "";
516
+ if (n.length === 1) return n[0].label ?? "";
517
+ let r = t.desc?.tooltip;
518
+ return typeof r != "object" || !r || !("title" in r) ? "" : typeof r.title == "string" ? r.title : "";
519
+ }
520
+ var Te = (e, t, i) => {
521
+ let a = {
522
+ type: k.Axis,
523
+ key: "radar-axis",
524
+ scale: "values",
525
+ settings: {
526
+ radial: {
527
+ outerRadius: V,
528
+ angle: e.measureAxis.axisTilt * Math.PI / 180
529
+ },
530
+ line: {
531
+ show: e.measureAxis.showAxis,
532
+ stroke: e.measureAxis.axisColor ?? n.mainDarkNavy,
533
+ strokeDasharray: "none"
534
+ },
535
+ labels: {
536
+ show: e.measureAxis.showAxisLabels,
537
+ fill: e.measureAxis.axisLabelsColor ?? n.mainDarkNavy
538
+ },
539
+ ticks: {
540
+ show: e.measureAxis.showAxisTicks,
541
+ stroke: e.measureAxis.axisTicksColor ?? n.mainDarkNavy
542
+ }
543
+ },
544
+ layout: {
545
+ dock: r.Center,
546
+ displayOrder: b.CustomComponent
547
+ }
548
+ };
549
+ return {
550
+ ...i,
551
+ components: [...i.components, a]
552
+ };
553
+ }, Ee = class extends ne {
554
+ constructor() {
555
+ super([
556
+ N,
557
+ R,
558
+ P,
559
+ ce,
560
+ Te,
561
+ xe,
562
+ re
563
+ ]);
564
+ }
565
+ }, De = te(), Oe = new Ee(), ke = [be], Ae = _(({ vSpec: e, vTheme: t, data: n, elementSize: r, vizProperties: i }) => {
566
+ let a = g(), { activeKey: o } = ee(), s = h();
567
+ if (!e || !n || !r || !u(e)) return null;
568
+ let c = {
569
+ ...i,
570
+ valuePickerMode: !!o
571
+ }, d = t || p, f = Oe.compile(e, d, n, r, c, l.Radar, a, s);
572
+ return f ? /* @__PURE__ */ (0, De.jsx)(T, {
573
+ config: c,
574
+ definition: f,
575
+ size: r,
576
+ vSpec: e,
577
+ escobarPlugins: ke
578
+ }) : null;
579
+ });
580
+ export { Ae as RadarChart };