@astrato-io/visualizations 0.6.4 → 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 (149) hide show
  1. package/CHANGELOG.md +0 -0
  2. package/THIRD_PARTY_NOTICES.md +94 -4
  3. package/chunks/ClickAwayListener-BbeNMAvj.js +52 -0
  4. package/chunks/{LinearProgress-CUZ0D8_t.js → LinearProgress-B1FeWaen.js} +54 -54
  5. package/chunks/app-filter-bar.compiler-BGJ7HAbr.js +64 -0
  6. package/chunks/bar.compiler-CT0ZbQKc.js +374 -0
  7. package/chunks/{src-Cum_2NLV.js → builder-B6dWSIdD.js} +5779 -5635
  8. package/chunks/{coloring-C16AUZEi.js → coloring-B1XAfg6b.js} +234 -233
  9. package/chunks/{src-BC7cGcJ-.js → definitions-D3OVqmXl.js} +438 -360
  10. package/chunks/{escobar-BGqT1EsE.js → escobar-eDjtGpkC.js} +4645 -4619
  11. package/chunks/filter.compiler-DBsyRBJt.js +70 -0
  12. package/chunks/{filtering-Yq4DEa0t.js → filtering-tqjAyJH5.js} +432 -313
  13. package/chunks/{grouping-type-BX_9Ix5q.js → grouping-type-On4s9Thj.js} +1 -1
  14. package/chunks/handlers-VTBfIZYZ.js +13072 -0
  15. package/chunks/isEqual-BDxAhUo8.js +7514 -0
  16. package/chunks/line.compiler-CzdM5Ld0.js +198 -0
  17. package/chunks/{metadata-CPXdYoln.js → metadata-BGElBy5Z.js} +1 -1
  18. package/chunks/number.compiler-G-R7y16P.js +53 -0
  19. package/chunks/{src-C0LgoUWY.js → operations-CTNUX6Sy.js} +9576 -9432
  20. package/chunks/{range-DrzdfBX4.js → range-CiwTbMig.js} +2 -2
  21. package/chunks/{registry-CExpGJ1N.js → registry-CsQQzukD.js} +153 -153
  22. package/chunks/{requirements-DNhuShLS.js → requirements-DYjZCFyf.js} +1 -1
  23. package/chunks/{shared-CKDL4hx9.js → shared-CBvcC5YV.js} +460 -413
  24. package/chunks/{standalone-D5vnf-9y.js → standalone-0M4HlmDW2.js} +823 -822
  25. package/chunks/standalone-0ashe9w1.js +411 -0
  26. package/chunks/{standalone-C85u7U6I.js → standalone-B7jax8wa.js} +93 -94
  27. package/chunks/standalone-BK0VYU-l.js +463 -0
  28. package/chunks/{standalone-BDCwI6Hn.js → standalone-BMIbT1b2.js} +815 -815
  29. package/chunks/standalone-BZV5vOwA.js +6 -0
  30. package/chunks/standalone-BhDrWj4p.js +1980 -0
  31. package/chunks/{standalone-CNyNHKVx.js → standalone-BtSHCp2U2.js} +97 -98
  32. package/chunks/{standalone-CDQnr6qT.js → standalone-BvaKdky9.js} +95 -96
  33. package/chunks/standalone-BwtM31-f.js +2 -0
  34. package/chunks/{standalone-CY57qwZ-.js → standalone-C3gg736V.js} +153 -153
  35. package/chunks/{standalone-DFPva_ku.js → standalone-CC1VUjO32.js} +60 -60
  36. package/chunks/{standalone-CCNtaJ7s.js → standalone-C_rYnZ0N.js} +41 -41
  37. package/chunks/{standalone-CZynjFG7.js → standalone-CoLrAxRV.js} +3701 -3482
  38. package/chunks/{standalone-jiz0L2Dg.js → standalone-DC-aUgXC.js} +104 -104
  39. package/chunks/standalone-DCtRoTWg.js +675 -0
  40. package/chunks/standalone-DUDFTBqL.js +833 -0
  41. package/chunks/standalone-DhZkX9Td.js +2 -0
  42. package/chunks/{standalone-Dx3MLlrO.js → standalone-DtLElfuM.js} +141 -141
  43. package/chunks/{standalone-BmfMt74U.js → standalone-G9Q4Uczu.js} +192 -192
  44. package/chunks/{standalone-BH5NqDwp.js → standalone-JuLF-OoH.js} +390 -391
  45. package/chunks/standalone-_DeX21JJ.js +383 -0
  46. package/chunks/{standalone-lBm9hQ-q.js → standalone-gFhKZh8m.js} +34 -34
  47. package/chunks/standalone-tDNy-SFH.js +281 -0
  48. package/chunks/{standalone-rJ45Zfl1.js → standalone-v1oxfU20.js} +10 -10
  49. package/chunks/{standalone-BYm1UjLr.js → standalone-vzBY6q0I2.js} +18 -18
  50. package/chunks/table.compiler-tb914oj3.js +222 -0
  51. package/chunks/{ui-D1HQNIBy.js → ui-DQWtv2iM.js} +13485 -3973
  52. package/chunks/{useFieldName-oqQ3bvnO.js → useFieldName-BvdcoJRl.js} +1 -1
  53. package/chunks/{utils-Ba9T0TqC.js → utils-Bg7K-t6K.js} +7306 -6024
  54. package/chunks/{src-DvX5LU9T.js → view-Bn83C8d9.js} +2555 -4831
  55. package/definitions.js +3 -3
  56. package/docs/operations/astrato-app-filter-bar.md +17 -17
  57. package/docs/operations/bar.md +989 -1071
  58. package/docs/operations/combo.md +717 -738
  59. package/docs/operations/date-picker.md +25 -25
  60. package/docs/operations/distribution-gauge.md +471 -607
  61. package/docs/operations/dot.md +787 -879
  62. package/docs/operations/filter.md +139 -163
  63. package/docs/operations/gauge.md +491 -627
  64. package/docs/operations/heatMap.md +834 -916
  65. package/docs/operations/histogram.md +166 -180
  66. package/docs/operations/iframe.md +5 -5
  67. package/docs/operations/image.md +16 -16
  68. package/docs/operations/index.md +12 -12
  69. package/docs/operations/line.md +811 -888
  70. package/docs/operations/number.md +470 -536
  71. package/docs/operations/pie.md +825 -958
  72. package/docs/operations/radar.md +599 -679
  73. package/docs/operations/sankey.md +462 -584
  74. package/docs/operations/scatter.md +823 -929
  75. package/docs/operations/shape.md +34 -34
  76. package/docs/operations/simpleTextObject.md +18 -25
  77. package/docs/operations/slider.md +33 -43
  78. package/docs/operations/table.md +1160 -1150
  79. package/docs/operations/tree.md +354 -361
  80. package/docs/operations/treemap.md +545 -637
  81. package/docs/operations/waterfall.md +369 -379
  82. package/docs/operations/word-cloud.md +512 -583
  83. package/getters.js +3 -3
  84. package/index.js +51 -51
  85. package/metadata.js +3 -3
  86. package/operations.js +7 -7
  87. package/package.json +80 -86
  88. package/src/definitions/index.d.ts +2 -2
  89. package/src/definitions/{shared/lib → model/definitions}/available-fields.d.ts +0 -1
  90. package/src/definitions/{shared/lib/compilers/index.d.ts → model/definitions/compilers/compile.d.ts} +1 -1
  91. package/src/definitions/model/definitions/data-item-resolution.d.ts +19 -0
  92. package/src/definitions/model/definitions/descriptors/descriptor-metadata.d.ts +1341 -0
  93. package/src/definitions/model/definitions/descriptors/json-schema.d.ts +2 -0
  94. package/src/definitions/model/definitions/diagnostics.d.ts +5 -0
  95. package/src/definitions/model/definitions/field-suggestions.d.ts +2 -0
  96. package/src/definitions/model/definitions/index.d.ts +23 -0
  97. package/src/definitions/{shared/lib → model/definitions}/registry/compile.d.ts +1 -1
  98. package/src/definitions/model/definitions/registry/descriptor-registry.d.ts +3 -0
  99. package/src/definitions/model/definitions/schema-registry.d.ts +660 -0
  100. package/src/definitions/{shared/lib → model/definitions}/schemas/broad-chart.schema.d.ts +1 -1
  101. package/src/definitions/{shared/lib → model/definitions}/schemas/common.schema.d.ts +0 -1
  102. package/src/definitions/model/definitions/schemas/index.d.ts +9 -0
  103. package/src/definitions/{shared/lib → model/definitions}/schemas/object.schema.d.ts +6 -6
  104. package/src/definitions/{shared/lib → model/definitions}/types/definition.types.d.ts +1 -1
  105. package/src/definitions/model/definitions/types/index.d.ts +3 -0
  106. package/src/definitions/{shared/lib/registry → model/definitions}/validation.d.ts +1 -1
  107. package/chunks/Radio-Ciu-F4CU.js +0 -957
  108. package/chunks/ToggleButton-BCJc3Jlc.js +0 -153
  109. package/chunks/_baseFlatten-DPXPOrea.js +0 -7076
  110. package/chunks/app-filter-bar.compiler-j_CVoWTa.js +0 -55
  111. package/chunks/bar.compiler-oqaPzIut.js +0 -370
  112. package/chunks/data-item-resolution-1lvYB5ln.js +0 -53
  113. package/chunks/event-bus-KiSiCJrC.js +0 -2683
  114. package/chunks/filter.compiler-CuLtc_02.js +0 -60
  115. package/chunks/gauge-target-type-BkKXAqkX.js +0 -4
  116. package/chunks/interfaces-VUY4_yVO.js +0 -8742
  117. package/chunks/line-settings-DfYTUyPz.js +0 -4
  118. package/chunks/line.compiler-BpA_6Tc7.js +0 -188
  119. package/chunks/number.compiler-DbkWcG4S.js +0 -44
  120. package/chunks/pie-uv42Eqal.js +0 -10
  121. package/chunks/src-Dun_jXtz.js +0 -10295
  122. package/chunks/standalone-87YV_m9n.js +0 -687
  123. package/chunks/standalone-BLVAWLNJ.js +0 -385
  124. package/chunks/standalone-BPomtAVs.js +0 -2
  125. package/chunks/standalone-BXyBcUOQ.js +0 -2
  126. package/chunks/standalone-BllF4rDp.js +0 -383
  127. package/chunks/standalone-BqWyrnZI.js +0 -281
  128. package/chunks/standalone-DQxxNwF8.js +0 -675
  129. package/chunks/standalone-DS9T0FZ-.js +0 -830
  130. package/chunks/standalone-DzixzZAL.js +0 -411
  131. package/chunks/standalone-QJ1kKMnO.js +0 -6
  132. package/chunks/table.compiler-BrXkm4Fz.js +0 -213
  133. package/chunks/toInteger-DVZr-D1j.js +0 -11
  134. package/chunks/treemap-x_zmJoG7.js +0 -23
  135. package/chunks/types-dVVCsDWD.js +0 -4
  136. package/chunks/view-CLqWMV7Z.js +0 -156
  137. package/src/definitions/shared/index.d.ts +0 -5
  138. package/src/definitions/shared/lib/registry/descriptor-registry.d.ts +0 -587
  139. package/src/definitions/shared/lib/registry/index.d.ts +0 -3
  140. package/src/definitions/shared/lib/schemas/index.d.ts +0 -9
  141. package/src/definitions/shared/lib/types/index.d.ts +0 -3
  142. package/src/definitions/{shared/lib → model/definitions}/schemas/app-filter-bar.schema.d.ts +0 -0
  143. package/src/definitions/{shared/lib → model/definitions}/schemas/bar.schema.d.ts +0 -0
  144. package/src/definitions/{shared/lib → model/definitions}/schemas/filter.schema.d.ts +0 -0
  145. package/src/definitions/{shared/lib → model/definitions}/schemas/line.schema.d.ts +0 -0
  146. package/src/definitions/{shared/lib → model/definitions}/schemas/number.schema.d.ts +0 -0
  147. package/src/definitions/{shared/lib → model/definitions}/schemas/table.schema.d.ts +4 -4
  148. /package/src/definitions/{shared/lib → model/definitions}/types/compilation.types.d.ts +0 -0
  149. /package/src/definitions/{shared/lib → model/definitions}/types/descriptor.types.d.ts +0 -0
@@ -0,0 +1,374 @@
1
+ import { To as e, a as t } from "./isEqual-BDxAhUo8.js";
2
+ import { E as n, M as r, O as i, S as a, T as o, _ as s, b as c, c as l, d as u, f as d, h as f, it as p, k as m, l as h, m as g, n as _, w as v } from "./shared-CBvcC5YV.js";
3
+ import { bd as y, jf as b } from "./handlers-VTBfIZYZ.js";
4
+ import { _ as x, b as S, t as C, u as w, v as T, w as E } from "./operations-CTNUX6Sy.js";
5
+ t();
6
+ var D = (e) => {
7
+ let t = [...e.data.dimensions.map((e, t) => ({
8
+ item: e,
9
+ path: [
10
+ "data",
11
+ "dimensions",
12
+ t,
13
+ "ref"
14
+ ]
15
+ })), ...e.data.measures.map((e, t) => ({
16
+ item: e,
17
+ path: [
18
+ "data",
19
+ "measures",
20
+ t,
21
+ "ref"
22
+ ]
23
+ }))], n = t.map(({ item: e }) => e.ref), r = new Set(n), i = /* @__PURE__ */ new Set(), o = [];
24
+ t.forEach(({ item: e, path: t }) => {
25
+ i.has(e.ref) && o.push(u("duplicate_alias", t, `Reference "${e.ref}" is duplicated.`)), i.add(e.ref);
26
+ }), e.sorting?.forEach((e, t) => {
27
+ r.has(e.by) || o.push(u("unknown_alias", [
28
+ "sorting",
29
+ t,
30
+ "by"
31
+ ], `Reference "${e.by}" does not exist.`, { allowedValues: n }));
32
+ }), o.push(...a(e.presentation?.coloring, e.data.dimensions.map((e) => e.ref), e.data.measures.map((e) => e.ref)));
33
+ let s = e.limiting?.topN?.by;
34
+ return s && !e.data.measures.some((e) => e.ref === s) && o.push(u("unknown_alias", [
35
+ "limiting",
36
+ "topN",
37
+ "by"
38
+ ], `Measure reference "${s}" does not exist.`, { allowedValues: e.data.measures.map((e) => e.ref) })), o;
39
+ }, O = (e) => {
40
+ if (e.type !== "bar") return u("unsupported_visualization", ["baseVSpec", "type"], `Definition type "bar" cannot compile against base vSpec type "${e.type}".`);
41
+ let t = e;
42
+ return t.dimensions.length > 0 || t.measures.length > 0 || (t.supportingMeasures?.length ?? 0) > 0 || Object.keys(t.referencedData).length > 0 ? u("non_fresh_base_vspec", ["baseVSpec"], "Bar visualization definitions can only compile against a fresh base vSpec.") : void 0;
43
+ }, k = {
44
+ formatString: "setDimensionFormatString",
45
+ formatType: "setDimensionFormatType"
46
+ }, A = {
47
+ currency: "setMeasureCurrency",
48
+ currencyIsPrefix: "setMeasureCurrencyIsPrefix",
49
+ formatString: "setMeasureFormatString",
50
+ formatType: "setMeasureFormatType",
51
+ negativeType: "setMeasureNegativeType"
52
+ }, j = (e) => {
53
+ let t = Object.entries(e).find(([, e]) => e.success === !1);
54
+ return t ? {
55
+ id: t[0],
56
+ result: t[1]
57
+ } : void 0;
58
+ }, M = (e, t) => {
59
+ if (!e || typeof e.data != "object" || e.data === null || !("dataItem" in e.data)) return;
60
+ let n = e.data.dataItem;
61
+ if (!(typeof n != "object" || !n || !("internalKey" in n) || typeof n.internalKey != "string" || !("uniqueSignature" in n) || typeof n.uniqueSignature != "string")) return {
62
+ dataItemInternalKey: n.internalKey,
63
+ dataItemUniqueSignature: n.uniqueSignature,
64
+ kind: t
65
+ };
66
+ }, N = async (e, t) => {
67
+ let r = e;
68
+ for (let [e, n] of t.data.dimensions.entries()) {
69
+ let t = `dimension:${n.ref}`, i = await C(r.vSpec, r.availableFields, [{
70
+ id: t,
71
+ name: w.ADD_DIMENSION,
72
+ payload: { key: n.fieldKey }
73
+ }], r.input.variables ?? [], [], r.input.theme), a = j(i.results), o = M(i.results[t], "dimension");
74
+ if (a || !o) return {
75
+ issue: u("operation_failed", [
76
+ "data",
77
+ "dimensions",
78
+ e
79
+ ], a?.result.error ?? "Dimension operation did not return the created data-item identity."),
80
+ success: !1
81
+ };
82
+ r = {
83
+ ...r,
84
+ resolvedRefs: {
85
+ ...r.resolvedRefs,
86
+ [n.ref]: o
87
+ },
88
+ vSpec: i.vSpec
89
+ };
90
+ }
91
+ for (let [i, a] of t.data.measures.entries()) {
92
+ let t = n(a, e.input.availableFields), s = `measure:${a.ref}`, c = await C(r.vSpec, r.availableFields, [{
93
+ id: s,
94
+ name: w.ADD_MEASURE,
95
+ payload: o(a, e.input.availableFields)
96
+ }], r.input.variables ?? [], [], r.input.theme), l = j(c.results), d = M(c.results[s], "measure");
97
+ if (l || !d) return {
98
+ issue: u("operation_failed", [
99
+ "data",
100
+ "measures",
101
+ i
102
+ ], l?.result.error ?? "Measure operation did not return the created data-item identity."),
103
+ success: !1
104
+ };
105
+ r = {
106
+ ...r,
107
+ measureAggregations: {
108
+ ...r.measureAggregations,
109
+ [a.ref]: t
110
+ },
111
+ resolvedRefs: {
112
+ ...r.resolvedRefs,
113
+ [a.ref]: d
114
+ },
115
+ vSpec: c.vSpec
116
+ };
117
+ }
118
+ return {
119
+ state: r,
120
+ success: !0
121
+ };
122
+ }, P = (e) => ({
123
+ dataItemInternalKey: e.dataItemInternalKey,
124
+ dataItemUniqueSignature: e.dataItemUniqueSignature
125
+ }), F = async (e, t) => {
126
+ let n = [];
127
+ return t.data.dimensions.forEach((t, r) => {
128
+ let i = e.resolvedRefs[t.ref];
129
+ t.showNullValues !== void 0 && n.push({
130
+ name: w.UPDATE_DIMENSION,
131
+ payload: {
132
+ ...P(i),
133
+ changes: { showNullValues: t.showNullValues }
134
+ }
135
+ }), t.temporalGrouping && n.push(g("setDimensionTemporalGrouping", i, t.ref, [
136
+ "data",
137
+ "dimensions",
138
+ r
139
+ ], t.temporalGrouping)), t.format?.formatType !== void 0 && n.push(h(k.formatType, i, t.ref, [
140
+ "data",
141
+ "dimensions",
142
+ r
143
+ ], "formatType", t.format.formatType)), t.format?.formatString !== void 0 && n.push(h(k.formatString, i, t.ref, [
144
+ "data",
145
+ "dimensions",
146
+ r
147
+ ], "formatString", t.format.formatString));
148
+ }), t.data.measures.forEach((t, r) => {
149
+ let i = e.resolvedRefs[t.ref];
150
+ [
151
+ "formatType",
152
+ "formatString",
153
+ "currency",
154
+ "currencyIsPrefix",
155
+ "negativeType"
156
+ ].forEach((e) => {
157
+ let a = t.format?.[e];
158
+ a !== void 0 && n.push(h(A[e], i, t.ref, [
159
+ "data",
160
+ "measures",
161
+ r
162
+ ], e, a));
163
+ }), t.dataLabels && n.push({
164
+ name: E.SET_MEASURE_DATA_LABELS_SHOW,
165
+ payload: {
166
+ ...P(i),
167
+ show: t.dataLabels.visible
168
+ }
169
+ }), t.dataLabels?.placements && n.push({
170
+ name: E.SET_MEASURE_DATA_LABEL_BAR_PLACEMENTS,
171
+ payload: {
172
+ ...P(i),
173
+ placements: t.dataLabels.placements.map((e) => ({ position: e }))
174
+ }
175
+ }), t.axis && n.push({
176
+ name: x.CHANGE_MEASURE_AXIS,
177
+ payload: {
178
+ ...P(i),
179
+ secondaryAxis: t.axis === "secondary"
180
+ }
181
+ });
182
+ }), f(e, n, ["data"]);
183
+ }, I = (e, t) => f(e, t.filterGroup ? [{
184
+ id: "filterGroup",
185
+ name: "setStaticFilterGroup",
186
+ payload: c(t.filterGroup)
187
+ }] : [], ["filterGroup"]), L = async (t, n) => {
188
+ if (!n.sorting?.length) return {
189
+ state: t,
190
+ success: !0
191
+ };
192
+ let r = t.vSpec, i = new Map(n.sorting.map((e) => [e.by, e])), a = new Map(Object.entries(t.resolvedRefs).map(([e, t]) => [`${t.dataItemInternalKey}:${t.dataItemUniqueSignature}`, e])), o = r.querySettings?.sortingOrder ?? [], s = n.sorting.map((e) => t.resolvedRefs[e.by]), c = new Set(s.map((e) => `${e.dataItemInternalKey}:${e.dataItemUniqueSignature}`)), l = [...s, ...o.filter((e) => !c.has(`${e.dataItem.internalKey}:${e.dataItem.uniqueSignature}`)).map((e) => ({
193
+ dataItemInternalKey: e.dataItem.internalKey,
194
+ dataItemUniqueSignature: e.dataItem.uniqueSignature,
195
+ kind: e.fieldType === "dimension" ? "dimension" : "measure"
196
+ }))].map((t, n) => {
197
+ let r = a.get(`${t.dataItemInternalKey}:${t.dataItemUniqueSignature}`), s = o.find((e) => e.dataItem.internalKey === t.dataItemInternalKey && e.dataItem.uniqueSignature === t.dataItemUniqueSignature);
198
+ return {
199
+ ...P(t),
200
+ newIndex: n,
201
+ sortDirection: (r ? i.get(r)?.direction : void 0) ?? s?.sortDirection ?? e.Asc
202
+ };
203
+ }), u = await f(t, [{
204
+ name: w.CHANGE_SORT_ORDER_AND_DIRECTION,
205
+ payload: { changeRequests: l }
206
+ }], ["sorting"]);
207
+ if (!u.success) return u;
208
+ let d = n.sorting.map((e) => ({
209
+ name: w.TOGGLE_SORTING_ITEM,
210
+ payload: {
211
+ ...P(t.resolvedRefs[e.by]),
212
+ enabled: e.enabled ?? !0
213
+ }
214
+ }));
215
+ return u = await f(u.state, d, ["sorting"]), u;
216
+ }, R = (e, t) => {
217
+ let n = [], { limiting: r } = t;
218
+ if (r?.queryLimit !== void 0 && n.push({
219
+ name: w.SET_QUERY_LIMIT,
220
+ payload: r.queryLimit
221
+ }), r?.topN) {
222
+ let t = e.resolvedRefs[r.topN.by];
223
+ n.push({
224
+ name: w.ENABLE_TOP_N,
225
+ payload: !0
226
+ }, {
227
+ name: w.SET_TOP_N_NUMBER_OF_VALUES,
228
+ payload: r.topN.count
229
+ }, {
230
+ name: w.SET_TOP_N_SORT_ORDER,
231
+ payload: r.topN.direction
232
+ }, {
233
+ name: w.SET_TOP_N_SHOW_OTHERS,
234
+ payload: r.topN.showOthers ?? !1
235
+ }, {
236
+ name: w.SET_TOP_N_RANK_MEASURE,
237
+ payload: {
238
+ ...P(t),
239
+ ...e.measureAggregations[r.topN.by] ? { aggregation: e.measureAggregations[r.topN.by] } : {}
240
+ }
241
+ });
242
+ }
243
+ return f(e, n, ["limiting"]);
244
+ }, z = (e, t) => {
245
+ let n = [], { presentation: r } = t, i = s(r?.axes);
246
+ if (i) return Promise.resolve({
247
+ issue: i,
248
+ success: !1
249
+ });
250
+ r?.orientation !== void 0 && n.push({
251
+ name: w.SET_BAR_CHART_ORIENTATION,
252
+ payload: r.orientation
253
+ });
254
+ let a = r?.legend;
255
+ a && n.push(...d(e.vSpec, a)), Object.entries(r?.axes ?? {}).forEach(([e, t]) => {
256
+ t.titleVisible !== void 0 && n.push({
257
+ name: w.SET_SHOW_AXIS_TITLE,
258
+ payload: {
259
+ axisName: e,
260
+ showAxisName: t.titleVisible
261
+ }
262
+ }), t.title !== void 0 && n.push({
263
+ name: w.SET_AXIS_TITLE,
264
+ payload: {
265
+ axisName: e,
266
+ axisTitle: t.title
267
+ }
268
+ }), t.labelsVisible !== void 0 && n.push({
269
+ name: w.SET_SHOW_AXIS_LABELS,
270
+ payload: {
271
+ axisName: e,
272
+ showLabels: t.labelsVisible
273
+ }
274
+ }), t.ticksVisible !== void 0 && n.push({
275
+ name: w.SET_SHOW_AXIS_TICKS,
276
+ payload: {
277
+ axisName: e,
278
+ showAxisTicks: t.ticksVisible
279
+ }
280
+ }), t.lineVisible !== void 0 && n.push({
281
+ name: w.SET_SHOW_AXIS_LINE,
282
+ payload: {
283
+ axisName: e,
284
+ showAxisLine: t.lineVisible
285
+ }
286
+ }), n.push(...l(e, t)), "scale" in t && t.scale !== void 0 && n.push({
287
+ name: T.SET_AXIS_SCALE,
288
+ payload: {
289
+ axisName: e,
290
+ scale: t.scale
291
+ }
292
+ });
293
+ });
294
+ let o = r?.axes?.primaryMeasure?.bands;
295
+ return o && n.push({
296
+ name: S.SET_MEASURE_AXIS_BANDS,
297
+ payload: { bands: o }
298
+ }), f(e, n, ["presentation"]);
299
+ }, B = async (e) => {
300
+ let t = y(e);
301
+ if (t) return {
302
+ issues: [{
303
+ code: "invalid_structure",
304
+ message: t,
305
+ path: []
306
+ }],
307
+ success: !1
308
+ };
309
+ let n = p.safeParse(e.definition);
310
+ if (!n.success) return {
311
+ issues: v(n.error, e.definition),
312
+ success: !1
313
+ };
314
+ let a = b.safeParse(e.baseVSpec);
315
+ if (!a.success) return {
316
+ issues: [u("invalid_structure", ["baseVSpec"], "Base bar vSpec is invalid.", { details: { issues: a.error.issues } })],
317
+ success: !1
318
+ };
319
+ let o = a.data, s = O(o);
320
+ if (s) return {
321
+ issues: [s],
322
+ success: !1
323
+ };
324
+ let c = n.data.data.measures.find((e) => e.ref === n.data.limiting?.topN?.by), l = (c ? e.availableFields.find((e) => e.fieldKey === c.fieldKey) : void 0)?.kind === "measure" ? [u("unsupported_feature", [
325
+ "limiting",
326
+ "topN",
327
+ "by"
328
+ ], "Top N ranking by a predefined measure is not supported by the current query builder. Use a raw field or calculation.")] : [], d = [
329
+ ...D(n.data),
330
+ ...i(n.data.data.dimensions, e.availableFields, ["data", "dimensions"], "dimension"),
331
+ ...i(n.data.data.measures, e.availableFields, ["data", "measures"], "measure"),
332
+ ...m(n.data.filterGroup, e.availableFields),
333
+ ...l
334
+ ];
335
+ if (d.length > 0) return {
336
+ issues: d,
337
+ success: !1
338
+ };
339
+ let f = await N({
340
+ availableFields: r(e.availableFields),
341
+ input: e,
342
+ measureAggregations: {},
343
+ resolvedRefs: {},
344
+ vSpec: o
345
+ }, n.data), h = [
346
+ F,
347
+ I,
348
+ L,
349
+ R,
350
+ z,
351
+ (e, t) => _(e, t.presentation?.coloring)
352
+ ];
353
+ for (let e of h) {
354
+ if ("issue" in f) return {
355
+ issues: [f.issue],
356
+ success: !1
357
+ };
358
+ f = await e(f.state, n.data);
359
+ }
360
+ if ("issue" in f) return {
361
+ issues: [f.issue],
362
+ success: !1
363
+ };
364
+ let g = b.safeParse(f.state.vSpec);
365
+ return g.success ? {
366
+ resolvedRefs: f.state.resolvedRefs,
367
+ success: !0,
368
+ vSpec: g.data
369
+ } : {
370
+ issues: [u("invalid_compiled_vspec", [], "Compiled bar vSpec failed final validation.", { details: { issues: g.error.issues } })],
371
+ success: !1
372
+ };
373
+ };
374
+ export { B as compileBarVisualizationDefinition };