@astrato-io/visualizations 0.6.5 → 0.7.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 (174) hide show
  1. package/README.md +32 -2
  2. package/THIRD_PARTY_NOTICES.md +2 -229
  3. package/VISUALIZATION_DEFINITIONS.md +68 -114
  4. package/chunks/Button-BrGKp9Nm.js +110 -0
  5. package/chunks/DefaultPropsProvider-BsfB7QTn.js +257 -0
  6. package/chunks/FieldTypeIcon-Drs6hSJF.js +22 -0
  7. package/chunks/{LinearProgress-B1FeWaen.js → LinearProgress-VtfFx2vJ.js} +55 -55
  8. package/chunks/MenuOption-ByRqhRdX.js +3934 -0
  9. package/chunks/Title-CO5dP1ma.js +1691 -0
  10. package/chunks/ToggleButton-KOBAimC1.js +112 -0
  11. package/chunks/{app-filter-bar.compiler-BGJ7HAbr.js → app-filter-bar.compiler-TwVTeoj5.js} +10 -10
  12. package/chunks/{bar.compiler-CT0ZbQKc.js → bar.compiler-DuQg8EUb.js} +84 -84
  13. package/chunks/builder-DEDvNq1k.js +201 -0
  14. package/chunks/{color-settings-ZIvgNTq1.js → color-rules-CN7TcGrC.js} +2 -6
  15. package/chunks/color-settings-3VRlf_Vw.js +6 -0
  16. package/chunks/colorManipulator-D8Pjy1pf.js +45 -0
  17. package/chunks/coloring-CncX_JRX.js +278 -0
  18. package/chunks/{definitions-D3OVqmXl.js → definitions-BPJQTx16.js} +490 -382
  19. package/chunks/{escobar-eDjtGpkC.js → escobar-DRhRMYRE.js} +6067 -4742
  20. package/chunks/event-bus-CrLB-Y8z.js +3 -0
  21. package/chunks/extend-preset-CUFNpmPe.js +4398 -0
  22. package/chunks/{filter.compiler-DBsyRBJt.js → filter.compiler-w27dlv0C.js} +12 -12
  23. package/chunks/{filtering-tqjAyJH5.js → filtering-cc7WqWpg.js} +391 -310
  24. package/chunks/{handlers-VTBfIZYZ.js → handlers-TOT-7INo.js} +3241 -3442
  25. package/chunks/icon-picker-styles-CoJmwTRi.js +2246 -0
  26. package/chunks/isEqual-B8loyPsC.js +12 -0
  27. package/chunks/label-format-type-weq1XfcX.js +8 -0
  28. package/chunks/{line.compiler-CzdM5Ld0.js → line.compiler-Ct1WhN2p.js} +27 -27
  29. package/chunks/logger-DpQtYQnX.js +1163 -0
  30. package/chunks/lookup-BWllin0q.js +36 -0
  31. package/chunks/{metadata-BGElBy5Z.js → metadata-WABZrt7Y.js} +1 -1
  32. package/chunks/{number.compiler-G-R7y16P.js → number.compiler-D8TPly-4.js} +13 -13
  33. package/chunks/{operations-CTNUX6Sy.js → operations-Dh4v1Ovt.js} +9314 -9283
  34. package/chunks/{range-CiwTbMig.js → range-Bi-7zT0k.js} +2 -2
  35. package/chunks/registry-KervaxqJ.js +31 -0
  36. package/chunks/render-wrappers-OEmtaM8g.js +2 -0
  37. package/chunks/{registry-CsQQzukD.js → requirements-PAoRaJyb.js} +304 -336
  38. package/chunks/responsive.styles-DSiOGD7u.js +82 -0
  39. package/chunks/{shared-CBvcC5YV.js → shared-Bn4N5QcZ.js} +424 -424
  40. package/chunks/src-77e3mC7i.js +391 -0
  41. package/chunks/standalone-B55oyW6c.js +689 -0
  42. package/chunks/{standalone-C3gg736V.js → standalone-BDhPQtzQ.js} +375 -341
  43. package/chunks/{standalone-BMIbT1b2.js → standalone-BGkmozIb.js} +992 -837
  44. package/chunks/standalone-BMTCb10X.js +179 -0
  45. package/chunks/standalone-BXKRE_Se.js +468 -0
  46. package/chunks/standalone-Bes8srx1.js +354 -0
  47. package/chunks/standalone-BjZp0QMe.js +2 -0
  48. package/chunks/{standalone-JuLF-OoH.js → standalone-BlMIwpEe.js} +634 -519
  49. package/chunks/{standalone-C_rYnZ0N.js → standalone-C8ZAEutO.js} +43 -42
  50. package/chunks/standalone-C8qAelL4.js +2 -0
  51. package/chunks/standalone-CJvIXsQE.js +743 -0
  52. package/chunks/standalone-CLmGb7nn2.js +355 -0
  53. package/chunks/standalone-CM5XcAN5.js +52327 -0
  54. package/chunks/standalone-CXNP6-xD.js +420 -0
  55. package/chunks/{standalone-vzBY6q0I2.js → standalone-D5Q5ngsD.js} +57 -55
  56. package/chunks/standalone-DLlyRIE6.js +287 -0
  57. package/chunks/standalone-DMcI1afI.js +396 -0
  58. package/chunks/{standalone-DC-aUgXC.js → standalone-DN4S1MjT.js} +1111 -1092
  59. package/chunks/standalone-DT0wKji7.js +6 -0
  60. package/chunks/{standalone-0M4HlmDW2.js → standalone-DVTJwsTY.js} +1109 -1035
  61. package/chunks/standalone-DW6NT205.js +518 -0
  62. package/chunks/standalone-DYQIQH4c.js +2095 -0
  63. package/chunks/standalone-D__XCp-h.js +1003 -0
  64. package/chunks/standalone-XTgSsTAa.js +354 -0
  65. package/chunks/{standalone-v1oxfU20.js → standalone-XuGksArp.js} +20 -20
  66. package/chunks/{standalone-BtSHCp2U2.js → standalone-we5D5MIn.js} +173 -168
  67. package/chunks/{table.compiler-tb914oj3.js → table.compiler-DMeeHxb6.js} +29 -29
  68. package/chunks/useFieldName-Cjn9KCVp.js +7 -0
  69. package/chunks/useSlotProps-DLbQp4lc.js +166 -0
  70. package/chunks/{utils-Bg7K-t6K.js → utils-vdmi_2PK.js} +6271 -7804
  71. package/chunks/{view-Bn83C8d9.js → view-BuwQugKb.js} +2717 -3504
  72. package/chunks/{isEqual-BDxAhUo8.js → visualization-filters-Cc4KU-l-.js} +1887 -1946
  73. package/chunks/web-components-DqClFkgO.js +1185 -0
  74. package/chunks/with-html-element-D0uY2zjI.js +7328 -0
  75. package/definitions.js +2 -2
  76. package/docs/operations/astrato-app-filter-bar.md +1 -1
  77. package/docs/operations/bar.md +31 -14
  78. package/docs/operations/combo.md +1 -1
  79. package/docs/operations/date-picker.md +3 -3
  80. package/docs/operations/distribution-gauge.md +13 -13
  81. package/docs/operations/dot.md +13 -13
  82. package/docs/operations/filter.md +1 -1
  83. package/docs/operations/gauge.md +13 -13
  84. package/docs/operations/heatMap.md +13 -13
  85. package/docs/operations/histogram.md +1 -1
  86. package/docs/operations/iframe.md +1 -1
  87. package/docs/operations/image.md +1 -1
  88. package/docs/operations/index.md +3 -3
  89. package/docs/operations/line.md +7 -7
  90. package/docs/operations/number.md +1 -1
  91. package/docs/operations/pie.md +13 -13
  92. package/docs/operations/radar.md +7 -7
  93. package/docs/operations/sankey.md +13 -13
  94. package/docs/operations/scatter.md +13 -13
  95. package/docs/operations/shape.md +1 -1
  96. package/docs/operations/simpleTextObject.md +1 -1
  97. package/docs/operations/slider.md +1 -1
  98. package/docs/operations/table.md +18 -1
  99. package/docs/operations/tree.md +51 -37
  100. package/docs/operations/treemap.md +63 -49
  101. package/docs/operations/waterfall.md +1 -1
  102. package/docs/operations/word-cloud.md +13 -13
  103. package/getters.js +7 -7
  104. package/index.js +3 -1183
  105. package/metadata.js +18 -18
  106. package/operations.js +13 -13
  107. package/package.json +106 -55
  108. package/render.js +10 -0
  109. package/src/charts/bar.d.ts +1 -0
  110. package/src/charts/combo.d.ts +1 -0
  111. package/src/charts/dot.d.ts +1 -0
  112. package/src/charts/gauge-distribution.d.ts +1 -0
  113. package/src/charts/gauge.d.ts +1 -0
  114. package/src/charts/heat-map.d.ts +1 -0
  115. package/src/charts/histogram.d.ts +1 -0
  116. package/src/charts/line.d.ts +1 -0
  117. package/src/charts/pie.d.ts +1 -0
  118. package/src/charts/radar.d.ts +1 -0
  119. package/src/charts/sankey.d.ts +1 -0
  120. package/src/charts/scatter.d.ts +1 -0
  121. package/src/charts/table.d.ts +1 -0
  122. package/src/charts/tree.d.ts +1 -0
  123. package/src/charts/treemap.d.ts +1 -0
  124. package/src/charts/waterfall.d.ts +1 -0
  125. package/src/charts/word-cloud.d.ts +1 -0
  126. package/src/definitions/index.d.ts +1 -1
  127. package/src/definitions/model/definitions/descriptors/descriptor-metadata.d.ts +53 -30
  128. package/src/definitions/model/definitions/index.d.ts +1 -1
  129. package/src/definitions/model/definitions/schema-registry.d.ts +2 -2
  130. package/src/definitions/model/definitions/schemas/object.schema.d.ts +2 -2
  131. package/src/definitions/model/definitions/types/compilation.types.d.ts +10 -0
  132. package/src/definitions/model/definitions/types/index.d.ts +1 -1
  133. package/src/getters/index.d.ts +3 -3
  134. package/src/index.d.ts +1 -1
  135. package/src/objects/app-filter-bar.d.ts +1 -0
  136. package/src/objects/date-picker.d.ts +1 -0
  137. package/src/objects/filter.d.ts +1 -0
  138. package/src/objects/iframe.d.ts +1 -0
  139. package/src/objects/image.d.ts +1 -0
  140. package/src/objects/number.d.ts +1 -0
  141. package/src/objects/shape.d.ts +1 -0
  142. package/src/objects/slider.d.ts +1 -0
  143. package/src/objects/text.d.ts +1 -0
  144. package/src/operations/index.d.ts +3 -3
  145. package/src/registry/create-visualization-registry.d.ts +5 -0
  146. package/src/render/index.d.ts +34 -0
  147. package/src/runtime/index.d.ts +2 -2
  148. package/src/types.d.ts +9 -4
  149. package/src/web-components/index.d.ts +3 -3
  150. package/chunks/ClickAwayListener-BbeNMAvj.js +0 -52
  151. package/chunks/builder-B6dWSIdD.js +0 -12289
  152. package/chunks/coloring-B1XAfg6b.js +0 -664
  153. package/chunks/events-WZut5Ow6.js +0 -4
  154. package/chunks/grouping-type-On4s9Thj.js +0 -3
  155. package/chunks/requirements-DYjZCFyf.js +0 -6
  156. package/chunks/standalone-0ashe9w1.js +0 -411
  157. package/chunks/standalone-B7jax8wa.js +0 -339
  158. package/chunks/standalone-BK0VYU-l.js +0 -463
  159. package/chunks/standalone-BZV5vOwA.js +0 -6
  160. package/chunks/standalone-BhDrWj4p.js +0 -1980
  161. package/chunks/standalone-BvaKdky9.js +0 -344
  162. package/chunks/standalone-BwtM31-f.js +0 -2
  163. package/chunks/standalone-CC1VUjO32.js +0 -299
  164. package/chunks/standalone-CoLrAxRV.js +0 -13198
  165. package/chunks/standalone-DCtRoTWg.js +0 -675
  166. package/chunks/standalone-DUDFTBqL.js +0 -833
  167. package/chunks/standalone-DhZkX9Td.js +0 -2
  168. package/chunks/standalone-DtLElfuM.js +0 -512
  169. package/chunks/standalone-G9Q4Uczu.js +0 -726
  170. package/chunks/standalone-_DeX21JJ.js +0 -383
  171. package/chunks/standalone-gFhKZh8m.js +0 -179
  172. package/chunks/standalone-tDNy-SFH.js +0 -281
  173. package/chunks/ui-DQWtv2iM.js +0 -63551
  174. package/chunks/useFieldName-BvdcoJRl.js +0 -7
@@ -0,0 +1,1003 @@
1
+ import { o as e, r as t } from "./rolldown-runtime-DleVn1XH.js";
2
+ import { Ds as n, Gs as r, Hi as i, Jt as a, Qi as o, Us as s, Vo as c, Xa as l, Za as u, Zo as d, _c as f, an as p, as as m, dc as h, dr as g, en as _, eo as v, fa as y, fr as b, hn as x, lr as S, mr as ee, or as te, ur as ne, ws as C, zi as re, zr as w } from "./visualization-filters-Cc4KU-l-.js";
3
+ import { Ei as ie, F as ae, N as oe, Xt as se, d as ce, o as le, ri as ue } from "./utils-vdmi_2PK.js";
4
+ import { Nm as de, km as T } from "./handlers-TOT-7INo.js";
5
+ import { r as E } from "./label-format-type-weq1XfcX.js";
6
+ import { s as fe } from "./logger-DpQtYQnX.js";
7
+ import { B as pe, Bt as D, Dt as me, Et as he, F as ge, Ft as _e, G as ve, Gt as ye, I as be, It as xe, L as Se, Lt as Ce, Mt as we, Pt as Te, Rt as Ee, St as De, Ut as Oe, Wt as O, Xt as k, Y as ke, Yt as Ae, Z as je, _n as A, an as j, at as Me, cn as M, dn as Ne, dt as Pe, et as Fe, fn as N, i as Ie, in as P, it as F, kt as Le, ln as Re, lt as ze, mn as Be, mt as Ve, n as He, nt as Ue, on as I, ot as We, pn as Ge, q as Ke, qt as L, sn as R, st as z, tt as B, un as V, vn as H, vt as U, xt as qe, zt as Je } from "./escobar-DRhRMYRE.js";
8
+ import { _ as W } from "./MenuOption-ByRqhRdX.js";
9
+ import { t as Ye } from "./coloring-CncX_JRX.js";
10
+ import { t as Xe } from "./set-coloring-datafield-B3uIS1Pe.js";
11
+ var Ze = /* @__PURE__ */ e(ie()), Qe = (e, t, n) => {
12
+ let r = e.dimensions.filter((e) => w(e)), i = e.measures.filter((e) => w(e)), a = {
13
+ showAxisTooltip: e?.axes?.dimension?.showAxisTooltip,
14
+ formatter: r[0]?.formatter || {
15
+ type: "string",
16
+ format: ""
17
+ },
18
+ scale: j(e),
19
+ key: `${we.Dimension}-${e.orientation ?? u.Vertical}`,
20
+ settings: { direction: Te(e) }
21
+ }, o = i[0], [s, c] = Ce([a, {
22
+ showAxisTooltip: e?.axes?.primaryMeasure?.showAxisTooltip,
23
+ formatter: o?.formatter,
24
+ scale: I(e, o),
25
+ key: `${we.Measure}-${e.orientation ?? u.Vertical}`,
26
+ settings: {
27
+ direction: xe(e),
28
+ labelDock: _e(R(e), o?.secondaryAxis)
29
+ }
30
+ }]);
31
+ return {
32
+ ...n,
33
+ components: [...n.components ?? [], ...s],
34
+ interactions: [...n.interactions ?? [], ...c]
35
+ };
36
+ }, $e = fe(), et = (e, t, n) => {
37
+ let r = g(e, t), i = ne(n);
38
+ return r.includes(i) || (i = r[0]), {
39
+ grouped: i === b.Groups,
40
+ stacked: i === b.Stacked,
41
+ offset: i === b.Offset,
42
+ single: i === b.Bars,
43
+ pyramid: i === b.Pyramid
44
+ };
45
+ }, tt = (e, t) => {
46
+ let n = [
47
+ T.Inside,
48
+ T.Outside,
49
+ T.Opposite
50
+ ];
51
+ return t && (n = [T.Inside]), (e || [
52
+ {
53
+ position: T.Inside,
54
+ justify: 1
55
+ },
56
+ {
57
+ position: T.Outside,
58
+ justify: 0
59
+ },
60
+ {
61
+ position: T.Opposite,
62
+ justify: 0
63
+ }
64
+ ]).map((e) => ({
65
+ ...e,
66
+ possible: n.includes(e.position)
67
+ }));
68
+ }, G = (e) => {
69
+ let t = e.measures.filter((e) => w(e)), r = e.dimensions.filter((e) => w(e)), i = t.length > 1, a = r.length > 1, o = t.length > 0 && r.length === 0, { grouped: s, stacked: c, pyramid: l, offset: u } = et(r.length, t.length, e.barSettings), d = {
70
+ ...e.barSettings.offset,
71
+ enabled: u
72
+ }, f = s ? e.barSettings.groupPadding : e.barSettings.barPadding, p = e.barSettings.barPadding, m = e.coloring?.type !== n.Gradient && e.barSettings.translucentBars, h = _(e.barSettings.barRadius, 0);
73
+ return {
74
+ isMeasureOnly: o,
75
+ isMultiMeasure: i,
76
+ isMultiDimension: a,
77
+ stacked: c,
78
+ pyramid: l,
79
+ stackedOffset: e.barSettings.stackedOffset,
80
+ offset: d,
81
+ barRadius: h,
82
+ grouped: s,
83
+ barPadding: f ?? Be.scale.padding,
84
+ groupPadding: p ?? Be.scale.padding,
85
+ translucentBars: m,
86
+ roundAllEdges: e.barSettings.roundAllEdges,
87
+ useCustomBoxRounding: !!h,
88
+ ignoreOutOfBounds: e.barSettings.ignoreOutOfBounds
89
+ };
90
+ }, nt = (e, t) => {
91
+ let [, r] = e.dimensions.filter((e) => w(e)), i = G(e);
92
+ return e.coloring?.type === n.Categorical ? i.isMultiDimension ? s(r?.dataItem) : me(e, t) : Le(e);
93
+ }, rt = (e) => {
94
+ let { stacked: t } = G(e);
95
+ if (t && "barSettings" in e && e.barSettings?.stackedOffset === E.Expand) {
96
+ let t = e.measures.map((e) => ({
97
+ ...e,
98
+ formatter: {
99
+ type: "excel-format",
100
+ format: { formatType: v.Percentage1Decimal }
101
+ }
102
+ }));
103
+ return {
104
+ ...e,
105
+ measures: t
106
+ };
107
+ }
108
+ return { ...e };
109
+ }, it = (e, t) => {
110
+ if (t.min && t.max) {
111
+ let n = t.min(), r = t.max(), i = e.data.start?.value, a = e.data.end?.value;
112
+ return i < n && a < n || i > r && a > r;
113
+ }
114
+ return !1;
115
+ }, at = (e) => {
116
+ let t = R(e);
117
+ return (h(e) ? e.measures.filter((e) => w(e) && !e.secondaryAxis) : []).length > 0 ? t ? M.XAxisScale : M.YAxisScale : t ? M.X2AxisScale : M.Y2AxisScale;
118
+ }, K = (e) => {
119
+ if (typeof e == "number") return e;
120
+ if (e && typeof e == "object" && "value" in e && typeof e.value == "number") return e.value;
121
+ }, ot = (e) => {
122
+ if (typeof e == "string" || typeof e == "number") return e;
123
+ if (e && typeof e == "object" && "value" in e) {
124
+ let t = e.value;
125
+ return typeof t == "string" || typeof t == "number" ? t : void 0;
126
+ }
127
+ }, q = (e) => String(ot(e.stackKey) ?? ot(e.value)), J = (e, t) => {
128
+ let n = K(e.start), r = K(e.end);
129
+ return typeof n == "number" && typeof r == "number" ? r - n : t ? K(e[t]) : void 0;
130
+ }, st = (e, t, n, r, i, a, o, s) => {
131
+ let u = e.dimensions.filter((e) => w(e)), { stacked: d, isMeasureOnly: p } = G(e), m = e;
132
+ d && !p && (m = rt(e), m.measures = m.measures.filter((e) => e.secondaryAxis !== !0)), n = Oe(m, t, n, r, i, a, o, s);
133
+ let h = [], g = [];
134
+ if (!u.length && "axes" in e) {
135
+ let n = e.axes?.dimension || {};
136
+ if (!n.disabled) {
137
+ let r;
138
+ if (r = R(e) ? e.axes?.dimension?.secondaryAxis ? l.Right : l.Left : e.axes?.dimension?.secondaryAxis ? l.Top : l.Bottom, h.push(O("onlyMeasures", n, {
139
+ ...t.axis.measure,
140
+ ...t.fonts
141
+ }, r)), n.showAxisName) {
142
+ let i = ee(e.dimensions, e.enableAlternate, a?.isPrintMode);
143
+ g.push(ye([{ dataItem: {
144
+ internalKey: "Measures",
145
+ uniqueSignature: c(),
146
+ name: "Measures",
147
+ schema: "",
148
+ view: "",
149
+ type: f.Dimension,
150
+ dataType: $e.FieldType.FLOAT
151
+ } }], i, r, {
152
+ ...t.axis.measure,
153
+ ...t.fonts
154
+ }, void 0, void 0, n?.titleFontSize));
155
+ }
156
+ }
157
+ }
158
+ return {
159
+ ...n,
160
+ components: [
161
+ ...n.components,
162
+ ...h,
163
+ ...g
164
+ ]
165
+ };
166
+ }, ct = .2, lt = (e, t) => ({ data: n }) => {
167
+ let r = /* @__PURE__ */ new Map();
168
+ return (n.items || []).forEach((e) => {
169
+ if (!e || typeof e != "object") return;
170
+ let n = e, i = J(n, t);
171
+ if (typeof i == "number") {
172
+ let e = q(n);
173
+ r.set(e, (r.get(e) || 0) + i);
174
+ }
175
+ }), (r.size ? [...r.values()].some((t) => e ? t < 0 : t > 0) : (n.fields || []).some((t) => e ? t.min() < 0 : t.max() > 0)) ? ct : 0;
176
+ }, ut = (e, t, n, i, o, c, l) => {
177
+ let u = e.dimensions.filter((e) => w(e)), d = e.measures.filter((e) => w(e)), f = G(e), m = nt(e, l), h = u[0], g = u.length, _ = d.length, v = !1, y = {};
178
+ if (h && "axes" in e && e?.axes?.dimension?.continuousAxis) {
179
+ let e = r(h?.dataItem), t = !!h.datePart, n = a(e) || p(e);
180
+ v = !t && n;
181
+ }
182
+ let b = v ? N.Linear : N.Band;
183
+ if (y = he(Xe(e, m), t, y, n.collections, l), y = ke(e, y, n.collections, v), f.grouped) {
184
+ let e, t;
185
+ f.isMultiDimension ? (e = s(u[1]?.dataItem), t = { extract: { field: e } }) : f.isMultiMeasure && (e = "measures", t = d.map((e) => s(e.dataItem))), y[e] = {
186
+ data: t,
187
+ type: b,
188
+ min: 0,
189
+ max: 1,
190
+ padding: f.groupPadding
191
+ };
192
+ }
193
+ if (f.stacked || f.offset?.enabled && g === 1 && _ === 1) {
194
+ let t = d[0].secondaryAxis ? e.axes?.secondaryMeasure : e.axes?.primaryMeasure, n = ve(t);
195
+ y[I(e, d[0])] = {
196
+ invert: Ke(!R(e), t),
197
+ data: { collection: M.Collection },
198
+ ...n,
199
+ ...f.stacked && e.barSettings.showTotal && n.type !== N.Log ? {
200
+ expandMin: lt(!0, s(d[0]?.dataItem)),
201
+ expandMax: lt(!1, s(d[0]?.dataItem))
202
+ } : {}
203
+ };
204
+ }
205
+ return f.isMeasureOnly && (y.onlyMeasures = {
206
+ data: { items: d.map((e) => {
207
+ let t = x(e) || e.label || e.dataItem.name;
208
+ return {
209
+ value: s(e.dataItem),
210
+ label: t
211
+ };
212
+ }) },
213
+ padding: f.barPadding,
214
+ type: b,
215
+ value: (e) => `${e.datum.value.value}`,
216
+ label: (e) => `${e.datum.value.label}`
217
+ }, f.stacked && (y[I(e, d[0])].data = { collection: "collection-no-dimension" }, y.onlyMeasures.data = { items: [{
218
+ value: "measures",
219
+ label: "measures"
220
+ }] })), e.type === C.Bar && d.forEach((t) => {
221
+ let n = t.secondaryAxis ? e.axes?.secondaryMeasure : e.axes?.primaryMeasure;
222
+ if (n?.axisRange || n?.scale === de.Log) return;
223
+ let r = y[I(e, t)];
224
+ r && (r.include = [0]);
225
+ }), {
226
+ ...n,
227
+ scales: y
228
+ };
229
+ }, dt = { outOfRangeTitle: "axis out range" }, Y = {
230
+ StackTotal: "stackTotal",
231
+ StackTotalLabel: "stackTotalLabel",
232
+ Ratio: "ratio"
233
+ }, X = { Share: "share" }, ft = (e, t, r, i, a, o, c) => {
234
+ let l = e.dimensions.filter((e) => w(e)), u = G(e), d = e.measures.filter(w), f = be((e.supportingMeasures ?? []).filter((e) => w(e))), [p, m] = l, h = d[0], g = s(p?.dataItem), _ = s(m?.dataItem), y = s(h?.dataItem), b = { [X.Share]: {
235
+ type: "excel-format",
236
+ format: { formatType: v.Percentage1Decimal }
237
+ } };
238
+ if (d?.forEach((e, t) => {
239
+ b[`measure-${t}`] = e.formatter || {
240
+ type: "excel-format",
241
+ format: { formatType: v.None }
242
+ };
243
+ }), u.isMeasureOnly) {
244
+ let e = [];
245
+ d.forEach((t) => {
246
+ let n = s(t.dataItem);
247
+ e.push({
248
+ field: n,
249
+ props: {
250
+ stackKey: "measures",
251
+ [n]: { field: n },
252
+ ...f,
253
+ series: n,
254
+ [k.property]: L(t),
255
+ start: 0,
256
+ color: n,
257
+ end: { field: n },
258
+ secondaryAxis: t.secondaryAxis,
259
+ isMultipleMeasures: u.isMultiMeasure
260
+ }
261
+ });
262
+ });
263
+ let t = {
264
+ key: "collection-no-dimension",
265
+ data: {
266
+ extract: e,
267
+ filter: (e) => (e[k.property].source = {
268
+ field: k.field,
269
+ key: k.sourceKey
270
+ }, !0)
271
+ }
272
+ };
273
+ return u.stacked && (t.data.stack = {
274
+ stackKey: (e) => `${e.stackKey.value}`,
275
+ value: (e) => e.end.value,
276
+ offset: E.Diverging
277
+ }), {
278
+ ...r,
279
+ collections: [t],
280
+ formatters: b
281
+ };
282
+ }
283
+ let x = {
284
+ key: "collection",
285
+ data: { extract: [] }
286
+ };
287
+ if (u.isMultiMeasure) {
288
+ let e = d.reduce((e, t) => {
289
+ let n = s(t.dataItem);
290
+ return e[n] = { field: n }, e;
291
+ }, {});
292
+ x.data.extract = d.map((t) => {
293
+ let n = s(t.dataItem);
294
+ return {
295
+ field: g,
296
+ props: {
297
+ end: { field: n },
298
+ series: n,
299
+ color: n,
300
+ ...e,
301
+ ...f,
302
+ start: 0,
303
+ secondaryAxis: t.secondaryAxis,
304
+ isMultipleMeasures: u.isMultiMeasure,
305
+ [k.property]: L(t)
306
+ }
307
+ };
308
+ }), x.data.filter = (e) => (e[k.property].source = {
309
+ field: k.field,
310
+ key: k.sourceKey
311
+ }, !0);
312
+ } else {
313
+ let t = nt(e, c), r = "coloring" in e && e.coloring?.type === n.Single;
314
+ x.data.extract.push({
315
+ field: g,
316
+ props: {
317
+ ...u.isMultiDimension && { series: { field: _ } },
318
+ start: 0,
319
+ end: { field: y },
320
+ color: r ? y : { field: t },
321
+ [y]: { field: y },
322
+ ...f,
323
+ secondaryAxis: h.secondaryAxis,
324
+ isMultipleMeasures: u.isMultiMeasure
325
+ }
326
+ });
327
+ }
328
+ if (u.stacked && "barSettings" in e) x.data.stack = {
329
+ stackKey: (e) => `${e.value}`,
330
+ value: (e) => e.end.value,
331
+ offset: e.barSettings?.stackedOffset || E.Diverging
332
+ };
333
+ else if (u.offset?.enabled) {
334
+ let e = u.offset?.totalLabel ?? "Total";
335
+ x.data.stack = {
336
+ stackKey: u.offset?.showTotal ? (t) => +(t.value === e) : () => 0,
337
+ value: (e) => e.end.value
338
+ };
339
+ }
340
+ return {
341
+ ...r,
342
+ collections: [x],
343
+ formatters: b
344
+ };
345
+ }, pt = (e, t) => t || e.colors.brandColors[0], mt = (e, t, n, r) => {
346
+ let i = e.dimensions.filter((e) => w(e)), a = e.measures.filter((e) => w(e));
347
+ if (!i?.[0] || !r.offset?.enabled || !r.offset?.showLine) return null;
348
+ let o = j(e), s = I(e, a[0]), c = {
349
+ scale: o,
350
+ fn: n.scales[o]?.type === N.Linear ? void 0 : (e) => {
351
+ let t = e.scale;
352
+ return t(e.datum.value) + t.bandwidth();
353
+ }
354
+ }, l = {
355
+ scale: o,
356
+ fn: (e, t) => e.data.items[t + 1] ? e.scale(e.data.items[t + 1].value) : 1
357
+ }, d = {
358
+ scale: s,
359
+ ref: "end"
360
+ }, f = e.orientation === u.Horizontal ? {
361
+ y0: c,
362
+ y1: l,
363
+ x0: d,
364
+ x1: d
365
+ } : {
366
+ y0: d,
367
+ y1: d,
368
+ x0: c,
369
+ x1: l
370
+ };
371
+ return {
372
+ key: "bar-bridge",
373
+ type: H.LineCoord,
374
+ data: { collection: "collection" },
375
+ settings: {
376
+ ...f,
377
+ show: (e, t) => !!e.data.items[t + 1],
378
+ stroke: r.offset.lineColor ?? t.axis.dimension.lineColor,
379
+ strokeWidth: 1,
380
+ strokeDasharray: "2 2",
381
+ opacity: 1
382
+ },
383
+ animations: {
384
+ enabled: !0,
385
+ presetId: "simple-opacity"
386
+ }
387
+ };
388
+ }, ht = (e, t) => (n) => {
389
+ if (typeof n.datum.end.value != "number") return null;
390
+ let r = new W(typeof t == "function" ? t(n) : t), i = [{
391
+ color: r.rgb(),
392
+ opacity: 1,
393
+ offset: +(n.datum.end.value < 0)
394
+ }, {
395
+ color: r.rgb(),
396
+ opacity: .65,
397
+ offset: n.datum.end.value < 0 ? 0 : 1
398
+ }];
399
+ return n.datum.end.value < 0 && i.reverse(), {
400
+ type: "gradient",
401
+ degree: R(e) ? 0 : 90,
402
+ stops: i
403
+ };
404
+ }, gt = (e, t, r, i, a, o) => {
405
+ let c = e.dimensions.filter((e) => w(e)), l = e.measures.filter((e) => w(e)), u = G(e), f = { scale: j(e) };
406
+ u.isMeasureOnly && (f = {
407
+ scale: "onlyMeasures",
408
+ ref: u.stacked ? "stackKey" : "series"
409
+ });
410
+ let p = new Ye(e, t, a?.[0]?.itemsNotAffectedByFiltering), m = c.reduce((e, t) => (e[s(t.dataItem)] = !0, e), {}), h = l.reduce((r, i, a) => {
411
+ if (u.stacked && a !== 0) return r;
412
+ let c = { collection: M.Collection };
413
+ if (u.isMeasureOnly && (c = {
414
+ collection: "collection-no-dimension",
415
+ filter: (e) => u.stacked || e?.source?.field === s(i.dataItem)
416
+ }), u.grouped) {
417
+ let e = s(i.dataItem);
418
+ c = {
419
+ ...c,
420
+ filter: (t) => t.series?.source?.field ? m[t.series?.source?.field] : t.series?.value === e
421
+ };
422
+ }
423
+ let l = { overwriteSources: [p.MAIN_FIELD, "series"] };
424
+ (e.coloring?.type === n.Categorical || e.coloring?.type === n.Gradient) && (l.ref = "color");
425
+ let d = p.getColorDefinition(l);
426
+ u?.translucentBars && (d = ht(e, d));
427
+ let h = {
428
+ scale: I(e, i),
429
+ ref: "end"
430
+ }, g = bt(e, t, f, h, d);
431
+ return [...r, yt(e, i, g, c, o)];
432
+ }, []);
433
+ if (d(e)) {
434
+ let n = mt(e, t, r, u);
435
+ n && h.push(n);
436
+ }
437
+ return {
438
+ ...r,
439
+ components: [...r.components, ...h]
440
+ };
441
+ }, _t = (e) => {
442
+ let t = [], n = e.dimensions.filter((e) => w(e)), r = e.measures.filter((e) => w(e));
443
+ return n.length || t.push(k.property), n?.[0] && t.push(""), n?.[1] && t.push("series"), r.length > 1 && t.push(k.property), t;
444
+ }, vt = (e) => {
445
+ let t, n = G(e), r = e.measures.filter((e) => w(e));
446
+ if (n.stacked && r.length > 0) {
447
+ let e = s(r[0].dataItem);
448
+ t = function() {
449
+ let t = {}, r = {}, i = {}, a = (e) => {
450
+ let t = e.end?.value;
451
+ return typeof t == "number" ? t : void 0;
452
+ }, o = this.data.items;
453
+ o.forEach((n) => {
454
+ let o = q(n), s = J(n, e);
455
+ if (r[o] || (r[o] = {
456
+ positive: void 0,
457
+ negative: void 0
458
+ }), i[o] || (i[o] = {
459
+ highest: void 0,
460
+ lowest: void 0
461
+ }), typeof s == "number") {
462
+ t[o] = (t[o] || 0) + s, s > 0 ? r[o].positive = n : s < 0 && (r[o].negative = n);
463
+ let e = a(n);
464
+ if (typeof e == "number") {
465
+ let { highest: t, lowest: r } = i[o];
466
+ (!t || e > a(t)) && (i[o].highest = n), (!r || e < a(r)) && (i[o].lowest = n);
467
+ }
468
+ }
469
+ }), o.forEach((a) => {
470
+ let o = q(a), s = t[o] || 0, c = (s >= 0 ? i[o].highest : i[o].lowest) ?? (s >= 0 ? r[o].positive : r[o].negative);
471
+ if (a[Y.StackTotal] = { value: s }, a[Y.StackTotalLabel] = { value: +(c === a) }, n.isMultiDimension) {
472
+ let t = J(a, e), n = typeof t == "number" && s !== 0 ? t / s : 0;
473
+ a[Y.Ratio] = { value: Number.isFinite(n) ? n : 0 };
474
+ }
475
+ });
476
+ };
477
+ }
478
+ return t;
479
+ }, yt = (e, t, n, r, i) => {
480
+ let a = vt(e), o = G(e), s = o.stacked && (o.isMultiDimension || o.isMultiMeasure), c = Ae(_t(e), i, { valuePickerMode: i?.valuePickerMode }, s ? A.AndSubset : void 0);
481
+ return {
482
+ type: H.Box,
483
+ layout: { displayOrder: D.VisualizationElement },
484
+ key: U(e, t, C.Bar),
485
+ data: r,
486
+ settings: n,
487
+ animations: {
488
+ enabled: !0,
489
+ presetId: "bar-chart"
490
+ },
491
+ beforeRender: a,
492
+ brush: c
493
+ };
494
+ }, bt = (e, t, n, r, a) => {
495
+ let o = e.dimensions.filter((e) => w(e)), c = e.measures.filter((e) => w(e)), [, l] = o, d = G(e), f = {
496
+ orientation: e.orientation ?? u.Vertical,
497
+ major: n,
498
+ minor: r,
499
+ box: {
500
+ minWidthPx: 2,
501
+ ref: "",
502
+ rx: _(d.barRadius, 0),
503
+ fill: a,
504
+ stacked: d.stacked,
505
+ grouped: d.grouped,
506
+ boxPadding: d.barPadding,
507
+ groupPadding: d.groupPadding,
508
+ itemsInStackCount: c?.length,
509
+ roundAllEdges: d.roundAllEdges ?? !1,
510
+ useCustomBoxRounding: d.useCustomBoxRounding ?? !1,
511
+ ignoreOutOfBounds: d.ignoreOutOfBounds ?? !1
512
+ }
513
+ };
514
+ if (e.barSettings?.strokeEnabled ? (f.box.stroke = pt(t, e.barSettings?.strokeColor), f.box.strokeWidth = e.barSettings?.strokeWidth) : f.box.stroke = i.transparent, !d.isMeasureOnly && d.grouped && !e?.axes?.dimension?.continuousAxis) {
515
+ let t = d.isMultiDimension ? s(l?.dataItem) : "measures";
516
+ f.major.fn = (n) => {
517
+ let r = n.resources.scale(j(e)), i = n.resources.scale(t), a = r.bandwidth(), o = i.bandwidth();
518
+ return Number(r(n.datum.value)) + .5 * a - .5 * (1 / o - 1) * o * a + a * Number(i(n.datum.series.value));
519
+ }, f.box.width = (e) => e.resources.scale(t).bandwidth();
520
+ }
521
+ return f;
522
+ }, xt = (e, t) => {
523
+ let n = R(e), r = e.measures.filter(w), i;
524
+ if (S(e)) {
525
+ let n = e.dimensions.filter(w)[1], a = s(n.dataItem), o = t?.[0]?.items ?? [];
526
+ i = [...new Set(o.map((e) => e[a]))].map((e) => ({
527
+ measure: r[0],
528
+ seriesValue: e
529
+ }));
530
+ } else i = r.map((e) => ({
531
+ measure: e,
532
+ seriesValue: s(e.dataItem)
533
+ }));
534
+ return i.slice(0, 2).map(({ measure: t, seriesValue: r }, i) => {
535
+ let a = i === +!!e.barSettings.swapSides, o = n === a ? 0 : .5;
536
+ return {
537
+ measure: t,
538
+ seriesValue: r,
539
+ scale: n ? i === 0 ? M.XAxisScale : M.X2AxisScale : i === 0 ? M.YAxisScale : M.Y2AxisScale,
540
+ region: {
541
+ direction: n ? "horizontal" : "vertical",
542
+ start: o,
543
+ end: o + .5,
544
+ dock: n ? "bottom" : "left"
545
+ }
546
+ };
547
+ });
548
+ }, St = (e, t) => {
549
+ let n = ve(t, !1, !1);
550
+ return {
551
+ ...n,
552
+ data: { collection: M.Collection },
553
+ formatter: e.measure.formatter,
554
+ type: N.Linear,
555
+ invert: e.region.start === 0,
556
+ min: 0,
557
+ max: n.max ?? (({ data: t }) => (t.items ?? []).reduce((t, n) => {
558
+ let r = n;
559
+ if (r.series?.value !== e.seriesValue) return t;
560
+ let i = r.end?.value;
561
+ return typeof i != "number" || !Number.isFinite(i) ? t : Math.max(t, i);
562
+ }, 0) || 1),
563
+ expandMin: 0,
564
+ expandMax: 0
565
+ };
566
+ }, Ct = new W(Re.fontLight), wt = new W(Re.fontDark), Tt = (e) => {
567
+ switch (!0) {
568
+ case e.grouped: return "grouped";
569
+ case e.stacked: return "stacked";
570
+ default: return "normal";
571
+ }
572
+ }, Et = (e, t, n, r, i, a) => {
573
+ let c = G(e), l = e.dimensions.filter(w), u = e.measures.filter(w), d = u[0], f = c.stacked && l.length > 1 && u.length === 1;
574
+ if (!d?.dataLabels?.show) return n;
575
+ let p = s(d.dataItem), m = new W(t.fonts.general.color), h = ({ node: e }) => {
576
+ let t = e.attrs, n = t?.fill && t.fill !== "transparent", r = n && t.fill?.type === "gradient" ? t.fill?.stops?.[0]?.color : t?.fill;
577
+ return new W(n ? r : "#ffffff").betterContrast(m, Ct, wt).rgb();
578
+ }, g = [], _ = d.dataLabels.displayParts?.includes(o.Value), v = d.dataLabels.displayParts?.includes(o.Ratio);
579
+ (_ || !d.dataLabels.displayParts && c.stackedOffset !== E.Expand) && g.push({
580
+ id({ node: e }) {
581
+ return `${e.data._ID}::value`;
582
+ },
583
+ linkData({ node: e }) {
584
+ return e.data;
585
+ },
586
+ fill: h,
587
+ label({ node: e, formatter: t }) {
588
+ return t("measure-0")(e.data[p].value, void 0, e.data);
589
+ },
590
+ hideEllipsed: !0
591
+ }), (v || !d.dataLabels.displayParts && c.stackedOffset === E.Expand) && g.push({
592
+ id({ node: e }) {
593
+ return `${e.data._ID}::ratio`;
594
+ },
595
+ linkData({ node: e }) {
596
+ return e.data;
597
+ },
598
+ fill: h,
599
+ label({ node: e, formatter: t }) {
600
+ return t(X.Share)(e.data[Y.Ratio].value);
601
+ },
602
+ hideEllipsed: !0
603
+ });
604
+ let y = {
605
+ key: "bar-labels-stacked-0",
606
+ type: H.Labels,
607
+ layout: { displayOrder: D.Labels },
608
+ settings: { sources: [{
609
+ component: U(e, e.measures.filter(w)?.[0], C.Bar),
610
+ selector: V.Rect,
611
+ strategy: {
612
+ type: "rows",
613
+ settings: {
614
+ justify: .5,
615
+ align: .5,
616
+ fontSize: P(d.dataLabels?.size),
617
+ fontFamily: t.fonts.general.fontFamily,
618
+ labels: g
619
+ }
620
+ }
621
+ }] },
622
+ ...a?.disable?.brushing ? {} : { brush: { consume: [{
623
+ context: Ne.Selection,
624
+ data: ["", "series"],
625
+ mode: f ? A.AndSubset : A.And,
626
+ style: { inactive: { opacity: .3 } }
627
+ }] } },
628
+ animations: {
629
+ presetId: "simple-opacity",
630
+ enabled: !0
631
+ }
632
+ };
633
+ return {
634
+ ...n,
635
+ components: [...n.components, y]
636
+ };
637
+ }, Dt = (e, t, n, r, i) => {
638
+ let a = G(e), o = R(e), s = ({ data: e, scale: t }, n) => {
639
+ if (!e) return null;
640
+ let r = n ? t(n) : void 0, i = e.end.value > e.start.value, a = r ? Number(r(e.end.value)) > Number(r(e.start.value)) : o === i;
641
+ return o ? a ? "right" : "left" : a ? "down" : "up";
642
+ }, c = [], l = e.measures.filter(w), u = S(e);
643
+ return (a.pyramid ? xt(e, i) : e.measures.map((e) => ({
644
+ measure: e,
645
+ region: void 0,
646
+ scale: void 0
647
+ }))).forEach(({ measure: n, region: r, scale: i }, d) => {
648
+ if (n.dataLabels?.show) {
649
+ let f = l.indexOf(n), p = U(e, a.stacked ? e.measures.filter(w)?.[0] : n, C.Bar), m = Tt(a), h = tt(n.dataLabels.barLabelPlacements, a.stacked).filter((e) => e.possible).map((e) => ({
650
+ position: e.position,
651
+ justify: e.justify,
652
+ overflow: [T.Outside, T.Opposite].includes(e.position),
653
+ fill: e.position === T.Inside ? "#fff" : "#242424"
654
+ }));
655
+ n.dataLabels?.showBackdrop && !a.stacked && (h = h.map((e) => Se(e, t, o, n.dataLabels?.backdropColor))), c.push({
656
+ key: `bar-labels-${m}-${d}`,
657
+ type: H.Labels,
658
+ layout: {
659
+ displayOrder: D.Labels,
660
+ ...r && { region: r }
661
+ },
662
+ settings: { sources: [{
663
+ component: u && d === 1 ? `${p}-second` : p,
664
+ selector: V.Rect,
665
+ strategy: {
666
+ type: "bar",
667
+ settings: {
668
+ direction: (e) => s(e, i),
669
+ fontSize: P(n.dataLabels?.size),
670
+ fontFamily: t.fonts.general.fontFamily,
671
+ labels: [{
672
+ label: pe(n, f >= 0 ? `measure-${f}` : void 0),
673
+ placements: h
674
+ }]
675
+ }
676
+ }
677
+ }] },
678
+ animations: {
679
+ enabled: !0,
680
+ presetId: "chart-labels"
681
+ }
682
+ });
683
+ }
684
+ }), {
685
+ ...n,
686
+ components: [...n.components, ...c]
687
+ };
688
+ }, Ot = (e, t, n, r, i, a) => {
689
+ let o = G(e);
690
+ return o.isMultiDimension && o.stacked ? Et(e, t, n, r, i, a) : Dt(e, t, n, r, i);
691
+ }, kt = (e) => {
692
+ let t = e.measures.filter(w), n = t[t.length - 1];
693
+ return !!n?.formatter && te(n.formatter);
694
+ }, At = (e, t) => {
695
+ let n = t.data[Y.StackTotal]?.value;
696
+ return typeof n == "number" ? n : e.measures.filter(w).reduce((e, n) => {
697
+ let r = t.data[s(n.dataItem)]?.value;
698
+ return e + (typeof r == "number" ? r : 0);
699
+ }, 0) || void 0;
700
+ }, jt = (e) => ({ node: t }) => {
701
+ let n = At(e, t);
702
+ if (typeof n != "number") return null;
703
+ let r = n >= 0;
704
+ return R(e) ? r ? "right" : "left" : r ? "up" : "down";
705
+ }, Mt = (e, t, n) => {
706
+ if (t.data[Y.StackTotalLabel]) return Math.round(t.data[Y.StackTotalLabel].value) === 1;
707
+ let r = t.data.end?.value;
708
+ if (typeof r != "number" || e.barSettings.stackedOffset === E.Expand) return !1;
709
+ if (t.data[Y.StackTotal]) return Math.round(r) === Math.round(n);
710
+ let i = [...e.measures.filter(w)].reverse().find((e) => {
711
+ let r = t.data[s(e.dataItem)]?.value;
712
+ return typeof r == "number" && (n >= 0 ? r > 0 : r < 0);
713
+ });
714
+ return t.data.series?.value === s(i?.dataItem);
715
+ }, Nt = (e, t) => {
716
+ if (!e.barSettings.showTotal || !G(e).stacked) return;
717
+ let n = e.measures.filter(w), r = n[0], i = n.length - 1;
718
+ if (!(!r || i < 0)) return {
719
+ key: "bar-labels-stacked-total",
720
+ type: H.Labels,
721
+ layout: { displayOrder: D.Labels },
722
+ settings: { sources: [{
723
+ component: U(e, r, C.Bar),
724
+ selector: V.Rect,
725
+ strategy: {
726
+ type: "bar",
727
+ settings: {
728
+ direction: jt(e),
729
+ fontSize: P(r.dataLabels?.size),
730
+ fontFamily: t.fonts.general.fontFamily,
731
+ labels: [{
732
+ label({ node: t, formatter: n }) {
733
+ let r = At(e, t);
734
+ if (r === void 0 || !Mt(e, t, r)) return "";
735
+ if (e.barSettings.stackedOffset === E.Expand) {
736
+ let t = r < 0 ? -1 : 1;
737
+ return kt(e) ? n(X.Share)(t) : String(t);
738
+ }
739
+ return n(`measure-${i}`)(r);
740
+ },
741
+ placements: [{
742
+ position: T.Outside,
743
+ fill: "#242424",
744
+ justify: 0,
745
+ overflow: !0
746
+ }]
747
+ }]
748
+ }
749
+ }
750
+ }] },
751
+ animations: {
752
+ enabled: !0,
753
+ presetId: "chart-labels"
754
+ }
755
+ };
756
+ }, Pt = (e, t, n) => {
757
+ let r = Nt(e, t);
758
+ return r ? {
759
+ ...n,
760
+ components: [...n.components, r]
761
+ } : n;
762
+ }, Ft = (e, t, n, r, i) => {
763
+ let a = e.measures.filter((e) => w(e)), o = G(e), s = S(e), c = a.flatMap((t) => {
764
+ let n = U(e, t, C.Bar);
765
+ return s ? [n, `${n}-second`] : [n];
766
+ }), l = It(e), u = o.grouped && o.isMultiMeasure ? Me(e, i) : void 0, d = B(e, t, We, l, i && i[0] ? i[0].sum : void 0, u);
767
+ if (o.stacked) {
768
+ let n = Me(e, i), r = o?.stackedOffset === E.Expand, a = o.isMultiDimension ? Rt(n, r) : zt(n, r);
769
+ d = B(rt(e), t, a, l);
770
+ }
771
+ return o.isMeasureOnly && (d = B(e, t, Bt, l)), Fe(e, t, n, {
772
+ filter: (e) => e.filter((e) => c.findIndex((t) => t === e.key) !== -1),
773
+ placement: {
774
+ type: "bounds",
775
+ area: "target"
776
+ },
777
+ extract: d
778
+ }, `tooltip-${H.Box}`);
779
+ }, It = (e) => (t, n, r) => [Lt(e, n, r), Ue(t, n, r)].filter((e) => e?.length > 0).join("\n"), Lt = (e, t, n) => {
780
+ let r = at(e);
781
+ return it(t, n.scale(r)) ? dt.outOfRangeTitle : "";
782
+ }, Z = (e, t, n, r, i) => {
783
+ let a = i && !y(e.formatter) ? z(e.formatter) : e.formatter;
784
+ return r.formatter(a)(t, void 0, n.data);
785
+ }, Rt = (e, t = !1) => (n, r, i, a, o, c, l, u) => {
786
+ let d = n.filter((e) => w(e)), f = F(i), p = d.filter((e) => !f.has(s(e.dataItem))), m = d.map((e) => {
787
+ let t = s(e.dataItem), n = Object.keys(r.data).find((t) => r.data[t]?.source?.field === s(e.dataItem)), a;
788
+ if (r.data.end?.value !== void 0 && r.data.start?.value !== void 0 && !f.has(t)) a = r.data.end.value - r.data.start.value;
789
+ else if (n) a = r.data[n].value;
790
+ else return {
791
+ label: "",
792
+ value: ""
793
+ };
794
+ let o = x(e), c = a;
795
+ return (e.formatter || u) && (c = Z(e, a, r, i, u)), {
796
+ label: o || e.label || e.dataItem.name || "",
797
+ value: c
798
+ };
799
+ });
800
+ if (!l && e && e[r?.data?.value]) {
801
+ let n, a = p[0]?.formatter?.format?.formatType;
802
+ t && Vt(a) ? n = "100%" : (n = e[r?.data?.value], !u && p[0]?.formatter ? n = i.formatter(p[0].formatter)(e[r?.data?.value]) : u && (n = i.formatter(z(p[0]?.formatter))(e[r?.data?.value]))), m.push({
803
+ label: "Total",
804
+ value: n
805
+ });
806
+ }
807
+ return m;
808
+ }, zt = (e, t = !1) => (n, r, i, a, o, c, l, u) => {
809
+ let d = n.filter((e) => w(e)), f = F(i), p = d.filter((e) => !f.has(s(e.dataItem))), m = p.reduce((e, t) => e + Number(r.data[s(t.dataItem)]?.value ?? 0), 0), h = d.map((e) => {
810
+ let n = r.data.end?.value !== void 0 && r.data.start?.value !== void 0, a = s(e.dataItem), o = f.has(a), c = r.data.series?.value?.toString() === a, l;
811
+ if (n && c && !o) l = r.data.end.value - r.data.start.value;
812
+ else {
813
+ let e = Object.keys(r.data).find((e) => r.data[e]?.source?.field === a);
814
+ l = e ? r.data[e]?.value : void 0, t && !o && typeof l == "number" && m !== 0 && (l /= m);
815
+ }
816
+ if (l === void 0) return {
817
+ label: "",
818
+ value: ""
819
+ };
820
+ let d = x(e), h = l;
821
+ return (e.formatter || u) && (h = Z(e, l, r, i, u)), {
822
+ label: d || e.label || e.dataItem.name || "",
823
+ value: h,
824
+ ...p.length > 1 && c && !o && { isHighlighted: !0 }
825
+ };
826
+ });
827
+ if (!l && e && e[r?.data?.value] !== void 0) {
828
+ let n = p[p.length - 1], a, o = n?.formatter?.format?.formatType;
829
+ t && Vt(o) ? a = "100%" : (a = e[r?.data?.value], !u && n?.formatter ? a = i.formatter(n.formatter)(e[r?.data?.value]) : u && (a = i.formatter(z(n?.formatter))(e[r?.data?.value]))), h.push({
830
+ label: "Total",
831
+ value: a
832
+ });
833
+ }
834
+ return h;
835
+ }, Bt = (e, t, n) => {
836
+ let r = e.filter((e) => w(e)), i = F(n), a = t.data.series?.value?.toString(), o = a ? t.data[a]?.value : void 0, c = r.find((e) => s(e.dataItem) === a), l = x(c) || c?.label || c?.dataItem?.name, u = [];
837
+ return l && o !== void 0 && u.push({
838
+ label: l,
839
+ value: c?.formatter && n ? Z(c, o, t, n) : o
840
+ }), r.filter((e) => i.has(s(e.dataItem))).forEach((e) => {
841
+ let r = s(e.dataItem), i = Object.keys(t.data).find((e) => t.data[e]?.source?.field === r), a = i ? t.data[i]?.value : void 0;
842
+ if (a === void 0) return;
843
+ let o = x(e) || e.label || e.dataItem.name || "";
844
+ u.push({
845
+ label: o,
846
+ value: e.formatter && n ? Z(e, a, t, n) : a
847
+ });
848
+ }), u;
849
+ }, Vt = (e) => e === v.PercentageNoDecimal || e === v.Percentage1Decimal || e === v.Percentage2Decimal, Ht = (e, t, n) => {
850
+ let r = e.barSettings?.offset?.enabled ?? !1, i = e.dimensions.filter((e) => w(e)), a = e.measures.filter((e) => w(e));
851
+ return i.length === 1 && a.length === 1 && !r ? je(e, t, n) : n;
852
+ }, Ut = (e, t, r, i, a, o) => {
853
+ if (!G(e).pyramid) return r;
854
+ let c = xt(e, a);
855
+ if (!c.length) return r;
856
+ let u = new Set(c.map(({ measure: e }) => s(e.dataItem))), d = j(e), p = e.axes?.primaryMeasure ?? {}, m = c[0].region.direction === "horizontal" ? l.Bottom : l.Left, h = {
857
+ ...t.axis.measure,
858
+ ...t.fonts
859
+ }, g = o?.disable?.interactions ?? !1, _ = { ...r.scales }, v = [...r.interactions ?? []];
860
+ c.forEach((e) => {
861
+ _[e.scale] = St(e, p);
862
+ });
863
+ let y = r.components.flatMap((t) => {
864
+ if (t.type === Ge.CategoricalLegend && (t.scale === n.PerEachMeasure || t.scale === n.Single)) return [{
865
+ ...t,
866
+ settings: {
867
+ ...t.settings,
868
+ item: {
869
+ ...t.settings.item,
870
+ show: ({ datum: e }) => u.has(String(e.value))
871
+ }
872
+ }
873
+ }];
874
+ if (t.type === H.Axis && t.scale !== d || t.type === H.Text && t.dataItemType === f.Measure) return [];
875
+ if (t.type === H.Box) {
876
+ let n = c.filter(({ measure: n }) => U(e, n, C.Bar) === t.key);
877
+ if (!t.settings) return [];
878
+ let r = t.settings;
879
+ return n.map((e, n) => ({
880
+ ...t,
881
+ key: n === 0 ? t.key : `${t.key}-second`,
882
+ layout: {
883
+ ...t.layout,
884
+ region: e.region
885
+ },
886
+ data: {
887
+ collection: "collection",
888
+ filter: (t) => t.series?.value === e.seriesValue
889
+ },
890
+ settings: {
891
+ ...r,
892
+ minor: {
893
+ scale: e.scale,
894
+ ref: "end"
895
+ }
896
+ }
897
+ }));
898
+ }
899
+ if (t.type === H.AxisTooltip && t.scale !== d) return c.map((e, n) => {
900
+ let [r, i] = Ee(n === 0 ? t.key : `${t.key}-second`, e.scale, e.measure.formatter, {
901
+ ...t.settings,
902
+ labelDock: m
903
+ });
904
+ return n > 0 && v.push(i), {
905
+ ...r,
906
+ layout: {
907
+ ...r.layout,
908
+ region: e.region
909
+ }
910
+ };
911
+ });
912
+ if (t.type === H.Grid) {
913
+ let e = m === l.Bottom ? "x" : "y";
914
+ if (t[e]?.scale && t[e]?.scale !== d) return c.map((n, r) => ({
915
+ ...t,
916
+ key: `${t.key ?? "pyramid-grid"}-${r}`,
917
+ layout: {
918
+ ...t.layout,
919
+ region: n.region
920
+ },
921
+ [e]: { scale: n.scale }
922
+ }));
923
+ }
924
+ return [t];
925
+ });
926
+ return p.disabled || (c.forEach((e, t) => {
927
+ let n = O(e.scale, p, h, m, e.measure.formatter, o, g);
928
+ n.settings = {
929
+ ...n.settings,
930
+ align: m
931
+ }, y.push({
932
+ ...n,
933
+ layout: {
934
+ ...n.layout,
935
+ region: e.region,
936
+ dock: t === 0 ? m : `@axis.${c[0].scale}`
937
+ }
938
+ });
939
+ }), p.showAxisName !== !1 && c.forEach((e, t) => {
940
+ let n = ye([e.measure], !1, m, h, p.colors?.title, p.axisTitle, p.titleFontSize, `pyramid-${t}`);
941
+ y.push({
942
+ ...n,
943
+ layout: {
944
+ ...n.layout,
945
+ region: e.region,
946
+ dock: t === 0 ? m : "@text-pyramid-0"
947
+ }
948
+ });
949
+ })), {
950
+ ...r,
951
+ scales: _,
952
+ components: y,
953
+ interactions: v
954
+ };
955
+ }, Q = class extends ge {
956
+ constructor() {
957
+ super([
958
+ ft,
959
+ ut,
960
+ st,
961
+ De,
962
+ qe,
963
+ Pe,
964
+ gt,
965
+ Ot,
966
+ Pt,
967
+ ze,
968
+ Ht,
969
+ Ft,
970
+ Qe,
971
+ Je,
972
+ Ut,
973
+ Ve
974
+ ]);
975
+ }
976
+ preCompile(e) {
977
+ let t = e, { stacked: n } = G(t);
978
+ n && (t.measures = t.measures.map((e) => ({
979
+ ...e,
980
+ secondaryAxis: !1
981
+ })));
982
+ }
983
+ }, Wt = ue(), $ = se(({ vSpec: e, vTheme: t, data: n, elementSize: r, vizProperties: i }) => {
984
+ let a = oe(), [o] = (0, Ze.useState)(() => new Q()), s = ce(), { activeKey: c } = le(), l = ae(), u = He();
985
+ if (!e || !n || !r || !d(e) && !m(e)) return null;
986
+ let f = {
987
+ ...i,
988
+ valuePickerMode: !!c
989
+ }, p = t || re, h = o.compile(e, p, n, r, {
990
+ ...f,
991
+ onRenderDone: s
992
+ }, C.Bar, a, l, u);
993
+ return h ? /* @__PURE__ */ (0, Wt.jsx)(Ie, {
994
+ config: f,
995
+ definition: h,
996
+ size: r,
997
+ vSpec: e
998
+ }) : null;
999
+ }), Gt = /* @__PURE__ */ t({
1000
+ BarChart: () => $,
1001
+ BarChartCompiler: () => Q
1002
+ });
1003
+ export { $ as n, Q as r, Gt as t };