@astrato-io/visualizations 0.0.0-stage → 0.6.4

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 (145) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/LICENSE +93 -0
  3. package/README.md +843 -2
  4. package/THIRD_PARTY_NOTICES.md +8387 -0
  5. package/VISUALIZATION_DEFINITIONS.md +2378 -0
  6. package/chunks/LinearProgress-CUZ0D8_t.js +253 -0
  7. package/chunks/Radio-Ciu-F4CU.js +957 -0
  8. package/chunks/ToggleButton-BCJc3Jlc.js +153 -0
  9. package/chunks/_baseFlatten-DPXPOrea.js +7076 -0
  10. package/chunks/accessors-DemrDevR.js +128 -0
  11. package/chunks/app-filter-bar.compiler-j_CVoWTa.js +55 -0
  12. package/chunks/bar.compiler-oqaPzIut.js +370 -0
  13. package/chunks/color-settings-ZIvgNTq1.js +10 -0
  14. package/chunks/coloring-C16AUZEi.js +663 -0
  15. package/chunks/data-item-resolution-1lvYB5ln.js +53 -0
  16. package/chunks/debounce-fn-CUixuz45.js +7 -0
  17. package/chunks/escobar-BGqT1EsE.js +34580 -0
  18. package/chunks/event-bus-KiSiCJrC.js +2683 -0
  19. package/chunks/events-WZut5Ow6.js +4 -0
  20. package/chunks/extend-BKUkc4_i.js +37 -0
  21. package/chunks/filter.compiler-CuLtc_02.js +60 -0
  22. package/chunks/filtering-Yq4DEa0t.js +953 -0
  23. package/chunks/gauge-target-type-BkKXAqkX.js +4 -0
  24. package/chunks/grouping-type-BX_9Ix5q.js +3 -0
  25. package/chunks/interfaces-VUY4_yVO.js +8742 -0
  26. package/chunks/line-settings-DfYTUyPz.js +4 -0
  27. package/chunks/line.compiler-BpA_6Tc7.js +188 -0
  28. package/chunks/metadata-CPXdYoln.js +28 -0
  29. package/chunks/number.compiler-DbkWcG4S.js +44 -0
  30. package/chunks/pie-uv42Eqal.js +10 -0
  31. package/chunks/range-DrzdfBX4.js +22 -0
  32. package/chunks/registry-CExpGJ1N.js +920 -0
  33. package/chunks/requirements-DNhuShLS.js +6 -0
  34. package/chunks/rolldown-runtime-DleVn1XH.js +28 -0
  35. package/chunks/set-coloring-datafield-B3uIS1Pe.js +8 -0
  36. package/chunks/shared-CKDL4hx9.js +1171 -0
  37. package/chunks/src-BC7cGcJ-.js +2024 -0
  38. package/chunks/src-BOS6SqkZ.js +67 -0
  39. package/chunks/src-C0LgoUWY.js +26105 -0
  40. package/chunks/src-Cum_2NLV.js +12145 -0
  41. package/chunks/src-D9XogOrc.js +422 -0
  42. package/chunks/src-Dun_jXtz.js +10295 -0
  43. package/chunks/src-DvX5LU9T.js +14742 -0
  44. package/chunks/standalone-87YV_m9n.js +687 -0
  45. package/chunks/standalone-BDCwI6Hn.js +4619 -0
  46. package/chunks/standalone-BH5NqDwp.js +1763 -0
  47. package/chunks/standalone-BLVAWLNJ.js +385 -0
  48. package/chunks/standalone-BPomtAVs.js +2 -0
  49. package/chunks/standalone-BXyBcUOQ.js +2 -0
  50. package/chunks/standalone-BYm1UjLr.js +140 -0
  51. package/chunks/standalone-BllF4rDp.js +383 -0
  52. package/chunks/standalone-BmfMt74U.js +726 -0
  53. package/chunks/standalone-BqWyrnZI.js +281 -0
  54. package/chunks/standalone-C85u7U6I.js +340 -0
  55. package/chunks/standalone-CCNtaJ7s.js +741 -0
  56. package/chunks/standalone-CDQnr6qT.js +345 -0
  57. package/chunks/standalone-CNyNHKVx.js +674 -0
  58. package/chunks/standalone-CY57qwZ-.js +1129 -0
  59. package/chunks/standalone-CZynjFG7.js +12979 -0
  60. package/chunks/standalone-D5vnf-9y.js +3943 -0
  61. package/chunks/standalone-DFPva_ku.js +299 -0
  62. package/chunks/standalone-DQxxNwF8.js +675 -0
  63. package/chunks/standalone-DS9T0FZ-.js +830 -0
  64. package/chunks/standalone-Dx3MLlrO.js +512 -0
  65. package/chunks/standalone-DzixzZAL.js +411 -0
  66. package/chunks/standalone-QJ1kKMnO.js +6 -0
  67. package/chunks/standalone-jiz0L2Dg.js +3855 -0
  68. package/chunks/standalone-lBm9hQ-q.js +179 -0
  69. package/chunks/standalone-rJ45Zfl1.js +68 -0
  70. package/chunks/stroke-dash-UgMEcCS4.js +6 -0
  71. package/chunks/table.compiler-BrXkm4Fz.js +213 -0
  72. package/chunks/toInteger-DVZr-D1j.js +11 -0
  73. package/chunks/treemap-x_zmJoG7.js +23 -0
  74. package/chunks/typeof-CJDtcySz.js +13 -0
  75. package/chunks/types-dVVCsDWD.js +4 -0
  76. package/chunks/ui-D1HQNIBy.js +54039 -0
  77. package/chunks/url-utils-B17gj_mr.js +5501 -0
  78. package/chunks/useFieldName-oqQ3bvnO.js +7 -0
  79. package/chunks/utils-Ba9T0TqC.js +31097 -0
  80. package/chunks/view-CLqWMV7Z.js +156 -0
  81. package/definitions.js +3 -0
  82. package/docs/operations/astrato-app-filter-bar.md +161 -0
  83. package/docs/operations/bar.md +7050 -0
  84. package/docs/operations/combo.md +5825 -0
  85. package/docs/operations/date-picker.md +644 -0
  86. package/docs/operations/distribution-gauge.md +3218 -0
  87. package/docs/operations/dot.md +5662 -0
  88. package/docs/operations/filter.md +1507 -0
  89. package/docs/operations/gauge.md +3452 -0
  90. package/docs/operations/heatMap.md +6026 -0
  91. package/docs/operations/histogram.md +1870 -0
  92. package/docs/operations/iframe.md +56 -0
  93. package/docs/operations/image.md +177 -0
  94. package/docs/operations/index.md +46 -0
  95. package/docs/operations/line.md +6468 -0
  96. package/docs/operations/number.md +3969 -0
  97. package/docs/operations/pie.md +6089 -0
  98. package/docs/operations/radar.md +4646 -0
  99. package/docs/operations/sankey.md +3210 -0
  100. package/docs/operations/scatter.md +6075 -0
  101. package/docs/operations/shape.md +315 -0
  102. package/docs/operations/simpleTextObject.md +706 -0
  103. package/docs/operations/slider.md +230 -0
  104. package/docs/operations/table.md +8790 -0
  105. package/docs/operations/tree.md +2874 -0
  106. package/docs/operations/treemap.md +3619 -0
  107. package/docs/operations/waterfall.md +2938 -0
  108. package/docs/operations/word-cloud.md +3071 -0
  109. package/getters.js +18 -0
  110. package/index.js +1183 -0
  111. package/metadata.js +20 -0
  112. package/operations.js +64 -0
  113. package/package.json +191 -4
  114. package/src/definitions/index.d.ts +2 -0
  115. package/src/definitions/shared/index.d.ts +5 -0
  116. package/src/definitions/shared/lib/available-fields.d.ts +36 -0
  117. package/src/definitions/shared/lib/compilers/index.d.ts +7 -0
  118. package/src/definitions/shared/lib/registry/compile.d.ts +2 -0
  119. package/src/definitions/shared/lib/registry/descriptor-registry.d.ts +587 -0
  120. package/src/definitions/shared/lib/registry/index.d.ts +3 -0
  121. package/src/definitions/shared/lib/registry/validation.d.ts +3 -0
  122. package/src/definitions/shared/lib/schemas/app-filter-bar.schema.d.ts +22 -0
  123. package/src/definitions/shared/lib/schemas/bar.schema.d.ts +73 -0
  124. package/src/definitions/shared/lib/schemas/broad-chart.schema.d.ts +68 -0
  125. package/src/definitions/shared/lib/schemas/common.schema.d.ts +304 -0
  126. package/src/definitions/shared/lib/schemas/filter.schema.d.ts +22 -0
  127. package/src/definitions/shared/lib/schemas/index.d.ts +9 -0
  128. package/src/definitions/shared/lib/schemas/line.schema.d.ts +72 -0
  129. package/src/definitions/shared/lib/schemas/number.schema.d.ts +21 -0
  130. package/src/definitions/shared/lib/schemas/object.schema.d.ts +215 -0
  131. package/src/definitions/shared/lib/schemas/table.schema.d.ts +458 -0
  132. package/src/definitions/shared/lib/types/compilation.types.d.ts +36 -0
  133. package/src/definitions/shared/lib/types/definition.types.d.ts +2 -0
  134. package/src/definitions/shared/lib/types/descriptor.types.d.ts +39 -0
  135. package/src/definitions/shared/lib/types/index.d.ts +3 -0
  136. package/src/getters/index.d.ts +30 -0
  137. package/src/index.d.ts +4 -0
  138. package/src/metadata/index.d.ts +4 -0
  139. package/src/operations/index.d.ts +30 -0
  140. package/src/registry/index.d.ts +6 -0
  141. package/src/runtime/index.d.ts +2 -0
  142. package/src/types.d.ts +307 -0
  143. package/src/visualization-catalog.d.ts +82 -0
  144. package/src/web-components/index.d.ts +12 -0
  145. package/styles.css +2 -0
@@ -0,0 +1,1171 @@
1
+ import { No as e, Po as t, Ss as n, ds as r, gs as i, hs as a, is as o } from "./interfaces-VUY4_yVO.js";
2
+ import { On as s, Rn as c, Un as l, Vt as u, Xt as d, an as ee, pn as te, qt as ne, yn as re } from "./event-bus-KiSiCJrC.js";
3
+ import { $u as f, Ju as p, Md as ie, Wd as m, Xf as ae, Zu as h, _f as g, af as oe, df as se, ed as ce, nd as le, of as ue, rd as de, sf as fe, vd as _, vf as pe, yf as me } from "./src-Dun_jXtz.js";
4
+ import { T as he, d as ge, t as v, y } from "./src-C0LgoUWY.js";
5
+ import { z as b } from "zod";
6
+ var x = r(), S = (e) => e, C = b.string().trim().min(1).max(100), w = b.string().min(1).refine((e) => e.trim().length > 0, "Field key cannot be blank."), _e = S(re.shape.dataType), ve = S(te.shape.formatType), ye = b.object({
7
+ distinct: b.boolean().optional(),
8
+ name: b.string().trim().min(1),
9
+ resultType: b.string().optional()
10
+ }).strict(), be = b.object({
11
+ aggregations: b.array(ye).default([]),
12
+ dataType: _e,
13
+ fieldKey: w,
14
+ isManualData: b.boolean().optional(),
15
+ kind: b.literal("field").default("field"),
16
+ name: b.string().min(1),
17
+ schema: b.string().min(1),
18
+ view: b.string().min(1)
19
+ }).strict(), T = b.object({
20
+ description: b.string().optional(),
21
+ id: b.string().min(1).optional(),
22
+ key: w,
23
+ name: b.string().min(1),
24
+ views: b.array(b.string()).optional()
25
+ }).passthrough(), xe = T.extend({
26
+ dimension: b.record(b.string(), b.unknown()),
27
+ type: b.literal("dimension")
28
+ }), Se = T.extend({
29
+ measure: b.object({ aggregation: b.string().min(1) }).passthrough(),
30
+ type: b.literal("measure")
31
+ }), Ce = T.extend({
32
+ calculation: b.record(b.string(), b.unknown()),
33
+ type: b.literal("calculation")
34
+ }), we = b.object({
35
+ fieldKey: w,
36
+ item: xe,
37
+ kind: b.literal("dimension"),
38
+ name: b.string().min(1)
39
+ }).strict(), Te = b.object({
40
+ fieldKey: w,
41
+ item: Se,
42
+ kind: b.literal("measure"),
43
+ name: b.string().min(1)
44
+ }).strict(), Ee = b.object({
45
+ fieldKey: w,
46
+ item: Ce,
47
+ kind: b.literal("calculation"),
48
+ name: b.string().min(1)
49
+ }).strict(), E = b.union([
50
+ be,
51
+ we,
52
+ Te,
53
+ Ee
54
+ ]).superRefine((e, t) => {
55
+ e.kind !== "field" && e.item.key !== e.fieldKey && t.addIssue({
56
+ code: "custom",
57
+ message: "Semantic item key must match fieldKey.",
58
+ path: ["item", "key"]
59
+ });
60
+ }), D = b.object({
61
+ currency: b.string().min(1).optional(),
62
+ currencyIsPrefix: b.boolean().optional(),
63
+ formatString: b.string().optional(),
64
+ formatType: ve.optional(),
65
+ negativeType: S(te.shape.negativeType.unwrap()).optional()
66
+ }).strict(), De = b.discriminatedUnion("mode", [b.object({
67
+ dateLevel: S(b.enum(x.DateLevel)).describe("Year-aware bucket, such as month over time."),
68
+ mode: b.literal("level")
69
+ }).strict(), b.object({
70
+ datePart: S(b.enum(x.DatePart)).describe("Date part, such as month of year."),
71
+ mode: b.literal("part")
72
+ }).strict()]), O = b.object({
73
+ fieldKey: w,
74
+ format: D.pick({
75
+ formatString: !0,
76
+ formatType: !0
77
+ }).optional(),
78
+ ref: C,
79
+ showNullValues: b.boolean().optional(),
80
+ temporalGrouping: De.describe("Groups a date dimension. Applied before format; format must then suit the grouping.").optional()
81
+ }).strict(), Oe = b.object({
82
+ placements: b.array(S(b.enum(c))).min(1).optional(),
83
+ visible: b.boolean()
84
+ }).strict(), k = b.object({
85
+ aggregation: b.string().trim().min(1).describe("Required for a raw field measure; omit for a predefined measure or calculation.").optional(),
86
+ dataLabels: Oe.optional(),
87
+ fieldKey: w,
88
+ format: D.optional(),
89
+ ref: C
90
+ }).strict(), ke = b.object({
91
+ fieldKey: w,
92
+ operator: S(b.enum(se)),
93
+ value: b.string()
94
+ }).strict(), Ae = b.object({
95
+ fieldKey: w,
96
+ operator: S(b.enum(fe)),
97
+ valueFrom: b.string(),
98
+ valueTo: b.string()
99
+ }).strict(), je = b.object({
100
+ fieldKey: w,
101
+ operator: S(b.enum(oe)),
102
+ values: b.array(b.string()).min(1)
103
+ }).strict(), Me = b.object({
104
+ fieldKey: w,
105
+ operator: S(b.enum(ue))
106
+ }).strict(), Ne = b.union([
107
+ ke,
108
+ Ae,
109
+ je,
110
+ Me
111
+ ]), A = b.lazy(() => b.object({
112
+ filters: b.array(b.union([Ne, A])),
113
+ operator: b.enum(["and", "or"])
114
+ }).strict()), j = b.object({
115
+ by: C,
116
+ direction: S(u.shape.sortDirection),
117
+ enabled: b.boolean().optional()
118
+ }).strict(), Pe = b.object({
119
+ by: C,
120
+ count: b.number().int().positive(),
121
+ direction: S(u.shape.sortDirection),
122
+ showOthers: b.boolean().optional()
123
+ }).strict(), Fe = b.object({
124
+ queryLimit: b.number().int().positive().optional(),
125
+ topN: Pe.optional()
126
+ }).strict(), M = b.object({
127
+ position: S(ee.shape.position).optional(),
128
+ title: b.string().optional(),
129
+ visible: b.boolean().optional()
130
+ }).strict(), N = b.object({
131
+ labelsVisible: b.boolean().optional(),
132
+ lineVisible: b.boolean().optional(),
133
+ ticksVisible: b.boolean().optional(),
134
+ title: b.string().optional(),
135
+ titleVisible: b.boolean().optional()
136
+ }).strict(), Ie = b.union([b.object({
137
+ max: b.number().optional(),
138
+ min: b.number().optional().describe("Must be less than max when both are set")
139
+ }).strict(), b.object({ startsAtZero: b.boolean() }).strict()]).describe("Fix min, max or both, or set startsAtZero on an axis fitted to the data"), Le = b.array(ae).optional().describe("Shaded ranges drawn across the plot between two primary measure axis values"), Re = g({}), ze = g({ dimension: C.describe(`Alias of a dimension in data.dimensions. ${me}`) }), Be = pe({ measure: C.describe("Alias of the measure in data.measures whose value is compared") }), Ve = "Colors bound to dimension values, eg. \"Happy\" is dark teal. The first matching entry wins, ahead of rules and the palette. For ordered bands, add one entry per band with colors taken along a ramp.", He = b.array(Be).min(1).describe("Colors bound to measure thresholds, eg. red when sales is below 100. The first matching rule wins."), P = (e) => b.object({
140
+ overwrites: b.array(e.requiresOverwriteDimension ? ze : Re).min(1).describe(Ve).optional(),
141
+ ...e.rules ? { rules: He.optional() } : {}
142
+ }).strict(), F = {
143
+ inverted: b.boolean().optional().describe("Reverse the direction of the axis values, eg. to put rank 1 at the top"),
144
+ range: Ie.optional()
145
+ }, I = { bands: Le }, L = { scale: S(b.enum(l)).optional() };
146
+ N.extend({
147
+ ...F,
148
+ ...I,
149
+ ...L
150
+ }).strict();
151
+ var R = ({ logScale: e = !1, primaryMeasureBands: t = !1, rangedMeasureAxes: n = [] } = {}) => {
152
+ let r = (t, r) => N.extend({
153
+ ...n.includes(t) ? F : {},
154
+ ...r ? I : {},
155
+ ...e ? L : {}
156
+ }).strict();
157
+ return b.object({
158
+ dimension: N.optional(),
159
+ primaryMeasure: r("primaryMeasure", t).optional(),
160
+ secondaryMeasure: r("secondaryMeasure", !1).optional()
161
+ }).strict();
162
+ };
163
+ R();
164
+ var z = b.object({
165
+ axes: R({
166
+ logScale: !0,
167
+ primaryMeasureBands: !0,
168
+ rangedMeasureAxes: ["primaryMeasure", "secondaryMeasure"]
169
+ }).optional(),
170
+ legend: M.optional(),
171
+ orientation: S(b.enum(t)).optional()
172
+ }).strict(), Ue = k.extend({ axis: b.enum(["primary", "secondary"]).optional() }), We = b.object({
173
+ data: b.object({
174
+ dimensions: b.array(O).min(1),
175
+ measures: b.array(Ue).min(1)
176
+ }).strict(),
177
+ filterGroup: A.optional(),
178
+ limiting: Fe.optional(),
179
+ presentation: z.extend({ coloring: P({ rules: !0 }).optional() }).optional(),
180
+ sorting: b.array(j).optional(),
181
+ type: b.literal("bar"),
182
+ version: b.literal(1)
183
+ }).strict(), B = b.object({ visible: b.boolean() }).strict(), V = (e, t) => b.array(e).min(t.min).max(t.max), H = (e, n) => {
184
+ let r = {};
185
+ if (n.dimensions.max > 0) {
186
+ let e = V(O, n.dimensions);
187
+ r.dimensions = n.dimensions.min === 0 ? e.optional() : e;
188
+ }
189
+ if (n.measures.max > 0) {
190
+ let e = n.dataLabels ? k.omit({ dataLabels: !0 }).extend({ dataLabels: B.optional() }) : k.omit({ dataLabels: !0 }), t = n.comboSeriesTypes ? e.extend({ seriesType: b.enum([
191
+ "bar",
192
+ "line",
193
+ "point"
194
+ ]).optional() }) : e, i = V(n.measureAxis ? t.extend({ axis: b.enum(["primary", "secondary"]).optional() }) : t, n.measures);
195
+ r.measures = n.measures.min === 0 ? i.optional() : i;
196
+ }
197
+ let i = {};
198
+ if (n.axes) {
199
+ let e = R({
200
+ logScale: n.measureAxisScale,
201
+ primaryMeasureBands: n.measureAxisBands,
202
+ rangedMeasureAxes: n.rangedMeasureAxes
203
+ });
204
+ i.axes = (n.secondaryDimensionAxis ? e.extend({ secondaryDimension: N.optional() }) : e).optional();
205
+ }
206
+ n.conditionalColoring && (i.coloring = P(n.conditionalColoring).optional()), n.dataLabels && (i.dataLabels = B.optional()), n.gaugeDisplayMode && (i.displayMode = b.enum(["bar", "radial"]).optional()), n.legend && (i.legend = M.optional()), n.orientation && (i.orientation = S(b.enum(t)).optional()), n.treeLayout && (i.layout = b.object({
207
+ compact: b.boolean().optional(),
208
+ direction: b.enum([
209
+ "bottom",
210
+ "left",
211
+ "right",
212
+ "top"
213
+ ]).optional(),
214
+ forceAutoFit: b.boolean().optional(),
215
+ initialExpandedLevels: b.number().int().min(0).optional()
216
+ }).strict().optional());
217
+ let a = {
218
+ data: b.object(r).strict(),
219
+ filterGroup: A.optional(),
220
+ type: b.literal(e),
221
+ version: b.literal(1)
222
+ };
223
+ return n.queryLimit && (a.limiting = b.object({ queryLimit: b.number().int().positive().optional() }).strict().optional()), Object.keys(i).length > 0 && (a.presentation = b.object(i).strict().optional()), n.sorting && (a.sorting = b.array(j).optional()), b.object(a).strict().superRefine((t, r) => {
224
+ let i = t.data, a = n.validateCounts?.(i.dimensions?.length ?? 0, i.measures?.length ?? 0);
225
+ a && r.addIssue({
226
+ code: "custom",
227
+ message: a,
228
+ path: ["data"]
229
+ });
230
+ let o = n.conditionalColoring?.minDimensions ?? 0;
231
+ t.presentation?.coloring && (i.dimensions?.length ?? 0) < o && r.addIssue({
232
+ code: "custom",
233
+ message: `${e} value colors require at least ${o} dimensions.`,
234
+ path: ["presentation", "coloring"]
235
+ }), n.validateDefinition?.(t, r);
236
+ });
237
+ }, Ge = H("combo", {
238
+ axes: !0,
239
+ comboSeriesTypes: !0,
240
+ dataLabels: !0,
241
+ dimensions: {
242
+ min: 1,
243
+ max: 1
244
+ },
245
+ legend: !0,
246
+ measureAxis: !0,
247
+ measureAxisBands: !0,
248
+ measureAxisScale: !0,
249
+ measures: {
250
+ min: 1,
251
+ max: 10
252
+ },
253
+ orientation: !0,
254
+ queryLimit: !0,
255
+ sorting: !0,
256
+ rangedMeasureAxes: ["primaryMeasure", "secondaryMeasure"],
257
+ validateDefinition: (e, t) => {
258
+ let n = e.data.measures ?? [];
259
+ n.forEach((e, n) => {
260
+ e.dataLabels?.visible && e.seriesType !== "bar" && t.addIssue({
261
+ code: "custom",
262
+ message: "Combo data labels are supported only for bar series.",
263
+ path: [
264
+ "data",
265
+ "measures",
266
+ n,
267
+ "dataLabels"
268
+ ]
269
+ });
270
+ }), e.presentation?.dataLabels?.visible && !n.some((e) => e.seriesType === "bar") && t.addIssue({
271
+ code: "custom",
272
+ message: "Visible combo data labels require at least one bar series.",
273
+ path: ["presentation", "dataLabels"]
274
+ }), new Set(n.filter((e) => e.seriesType === "bar" && e.axis).map((e) => e.axis)).size > 1 && n.forEach((e, n) => {
275
+ e.seriesType === "bar" && e.axis && t.addIssue({
276
+ code: "custom",
277
+ message: "Combo bar series share one measure axis, so every bar measure must name the same axis.",
278
+ path: [
279
+ "data",
280
+ "measures",
281
+ n,
282
+ "axis"
283
+ ]
284
+ });
285
+ });
286
+ }
287
+ }), Ke = H("dot", {
288
+ conditionalColoring: { rules: !0 },
289
+ axes: !0,
290
+ dimensions: {
291
+ min: 2,
292
+ max: 2
293
+ },
294
+ legend: !0,
295
+ measures: {
296
+ min: 1,
297
+ max: 1
298
+ },
299
+ orientation: !0,
300
+ rangedMeasureAxes: ["primaryMeasure"]
301
+ }), qe = H("scatter", {
302
+ conditionalColoring: { rules: !0 },
303
+ axes: !0,
304
+ dimensions: {
305
+ min: 1,
306
+ max: 2
307
+ },
308
+ legend: !0,
309
+ measures: {
310
+ min: 2,
311
+ max: 3
312
+ },
313
+ queryLimit: !0,
314
+ rangedMeasureAxes: ["primaryMeasure", "secondaryMeasure"],
315
+ sorting: !0
316
+ }), Je = H("histogram", {
317
+ axes: !0,
318
+ dimensions: {
319
+ min: 1,
320
+ max: 1
321
+ },
322
+ legend: !0,
323
+ measureAxisBands: !0,
324
+ measures: {
325
+ min: 0,
326
+ max: 0
327
+ },
328
+ orientation: !0,
329
+ rangedMeasureAxes: ["primaryMeasure"]
330
+ }), Ye = H("heatMap", {
331
+ conditionalColoring: { rules: !0 },
332
+ axes: !0,
333
+ dimensions: {
334
+ min: 2,
335
+ max: 2
336
+ },
337
+ legend: !0,
338
+ measures: {
339
+ min: 1,
340
+ max: 2
341
+ },
342
+ queryLimit: !0,
343
+ secondaryDimensionAxis: !0,
344
+ sorting: !0
345
+ }), Xe = H("radar", {
346
+ conditionalColoring: {
347
+ minDimensions: 2,
348
+ rules: !1
349
+ },
350
+ dimensions: {
351
+ min: 0,
352
+ max: 2
353
+ },
354
+ legend: !0,
355
+ measures: {
356
+ min: 1,
357
+ max: 5
358
+ },
359
+ validateCounts: (e, t) => {
360
+ if (e === 0 && t < 2) return "Radar charts without dimensions require at least two measures.";
361
+ if (e > 0 && t > 1) return "Radar charts with dimensions support exactly one measure.";
362
+ }
363
+ }), Ze = H("gauge", {
364
+ conditionalColoring: { rules: !0 },
365
+ dimensions: {
366
+ min: 0,
367
+ max: 1
368
+ },
369
+ gaugeDisplayMode: !0,
370
+ legend: !0,
371
+ measures: {
372
+ min: 1,
373
+ max: 20
374
+ },
375
+ validateCounts: (e, t) => e === 1 && t > 2 ? "Gauge charts with a dimension support at most two measures." : void 0
376
+ }), Qe = H("distribution-gauge", {
377
+ conditionalColoring: { rules: !0 },
378
+ dimensions: {
379
+ min: 0,
380
+ max: 1
381
+ },
382
+ gaugeDisplayMode: !0,
383
+ legend: !0,
384
+ measures: {
385
+ min: 1,
386
+ max: 20
387
+ }
388
+ }), $e = H("pie", {
389
+ conditionalColoring: { rules: !0 },
390
+ dimensions: {
391
+ min: 1,
392
+ max: 1
393
+ },
394
+ legend: !0,
395
+ measures: {
396
+ min: 1,
397
+ max: 2
398
+ },
399
+ queryLimit: !0,
400
+ sorting: !0
401
+ }), et = H("tree", {
402
+ dimensions: {
403
+ min: 0,
404
+ max: 10
405
+ },
406
+ measures: {
407
+ min: 0,
408
+ max: 100
409
+ },
410
+ queryLimit: !0,
411
+ sorting: !0,
412
+ treeLayout: !0,
413
+ validateCounts: (e, t) => e + t === 0 ? "Tree charts require at least one dimension or measure." : e > 0 && t > 1 ? "Tree charts with dimensions support at most one measure." : void 0
414
+ }), tt = H("treemap", {
415
+ conditionalColoring: { rules: !0 },
416
+ dimensions: {
417
+ min: 1,
418
+ max: 10
419
+ },
420
+ legend: !0,
421
+ measures: {
422
+ min: 1,
423
+ max: 1
424
+ }
425
+ }), nt = H("sankey", {
426
+ conditionalColoring: {
427
+ requiresOverwriteDimension: !0,
428
+ rules: !0
429
+ },
430
+ dimensions: {
431
+ min: 2,
432
+ max: 15
433
+ },
434
+ measures: {
435
+ min: 1,
436
+ max: 1
437
+ }
438
+ }), rt = H("waterfall", {
439
+ axes: !0,
440
+ dataLabels: !0,
441
+ dimensions: {
442
+ min: 0,
443
+ max: 0
444
+ },
445
+ measureAxisBands: !0,
446
+ measures: {
447
+ min: 1,
448
+ max: 100
449
+ },
450
+ orientation: !0,
451
+ rangedMeasureAxes: ["primaryMeasure"]
452
+ }), it = H("word-cloud", {
453
+ conditionalColoring: { rules: !0 },
454
+ dimensions: {
455
+ min: 1,
456
+ max: 1
457
+ },
458
+ measures: {
459
+ min: 1,
460
+ max: 1
461
+ }
462
+ }), at = b.enum(["dropdown", "listbox"]), ot = b.object({
463
+ mode: at.optional(),
464
+ quickSelect: b.boolean().optional(),
465
+ responsive: b.boolean().optional(),
466
+ searchable: b.boolean().optional(),
467
+ showProgressBar: b.boolean().optional()
468
+ }).strict(), st = b.object({
469
+ data: b.object({ field: O.omit({
470
+ format: !0,
471
+ showNullValues: !0,
472
+ temporalGrouping: !0
473
+ }) }).strict(),
474
+ presentation: ot.optional(),
475
+ type: b.literal("filter"),
476
+ version: b.literal(1)
477
+ }).strict(), ct = b.object({
478
+ orientation: b.enum(["horizontal", "vertical"]).optional(),
479
+ selectionMode: b.enum([
480
+ "inherit",
481
+ "auto",
482
+ "manual"
483
+ ]).optional(),
484
+ enableAddingNewFilters: b.boolean().optional(),
485
+ enableAssociativeFilter: b.boolean().optional(),
486
+ showClearAll: b.boolean().optional(),
487
+ showChartBreakdown: b.boolean().optional(),
488
+ selectableFieldKeys: b.array(b.string()).optional()
489
+ }).strict(), lt = b.object({
490
+ settings: ct.optional(),
491
+ type: b.literal("astrato-app-filter-bar"),
492
+ version: b.literal(1)
493
+ }).strict(), ut = k.omit({ dataLabels: !0 }).extend({
494
+ axis: b.enum(["primary", "secondary"]).optional(),
495
+ dataPointShape: S(d.shape.dataPointShape)
496
+ }), dt = b.object({
497
+ density: ne.optional(),
498
+ visible: b.boolean()
499
+ }).strict(), ft = z.extend({
500
+ coloring: P({ rules: !1 }).optional(),
501
+ dataLabels: dt.optional()
502
+ }), pt = b.object({
503
+ data: b.object({
504
+ dimensions: b.array(O).min(1),
505
+ measures: b.array(ut).min(1)
506
+ }).strict(),
507
+ filterGroup: A.optional(),
508
+ limiting: b.object({ queryLimit: b.number().int().positive().optional() }).strict().optional(),
509
+ presentation: ft.optional(),
510
+ sorting: b.array(j).optional(),
511
+ type: b.literal("line"),
512
+ version: b.literal(1)
513
+ }).strict().superRefine((e, t) => {
514
+ e.presentation?.coloring && e.data.dimensions.length < 2 && t.addIssue({
515
+ code: "custom",
516
+ message: "Line value colors require at least two dimensions.",
517
+ path: ["presentation", "coloring"]
518
+ }), e.presentation?.dataLabels?.visible && e.data.measures.forEach((e, n) => {
519
+ e.dataPointShape || t.addIssue({
520
+ code: "custom",
521
+ message: "Visible line data labels require a data-point shape for every measure.",
522
+ path: [
523
+ "data",
524
+ "measures",
525
+ n,
526
+ "dataPointShape"
527
+ ]
528
+ });
529
+ });
530
+ }), mt = b.object({
531
+ data: b.object({ measure: k.omit({ dataLabels: !0 }) }).strict(),
532
+ filterGroup: A.optional(),
533
+ type: b.literal("number"),
534
+ version: b.literal(1)
535
+ }).strict(), ht = S(ie.pick({
536
+ endDateLabel: !0,
537
+ pickerState: !0,
538
+ pickerType: !0,
539
+ quickSelect: !0,
540
+ responsive: !0,
541
+ startDateLabel: !0,
542
+ timePickerVisibility: !0,
543
+ weekStart: !0
544
+ }).partial()), gt = b.object({
545
+ data: b.object({ field: O.omit({
546
+ format: !0,
547
+ showNullValues: !0,
548
+ temporalGrouping: !0
549
+ }) }).strict(),
550
+ settings: ht.optional(),
551
+ type: b.literal("date-picker"),
552
+ version: b.literal(1)
553
+ }).strict(), _t = b.object({
554
+ settings: b.object({ url: b.string().url().nullable() }).strict(),
555
+ type: b.literal("iframe"),
556
+ version: b.literal(1)
557
+ }).strict(), vt = b.object({
558
+ settings: S(b.object({
559
+ blur: _.shape.blur.optional(),
560
+ fit: _.shape.image.unwrap().shape.imageFit.optional(),
561
+ opacity: _.shape.opacity.optional(),
562
+ saturation: _.shape.saturation.optional(),
563
+ shadow: _.shape.shadow.optional(),
564
+ source: ge.optional()
565
+ }).strict()),
566
+ type: b.literal("image"),
567
+ version: b.literal(1)
568
+ }).strict(), yt = b.object({
569
+ settings: S(de.pick({
570
+ backgroundColor: !0,
571
+ backgroundType: !0,
572
+ borderEnabled: !0,
573
+ borderRadius: !0,
574
+ heightBasedSize: !0,
575
+ imageFit: !0,
576
+ imageURL: !0,
577
+ lineThickness: !0,
578
+ preserveAspectRatio: !0,
579
+ rotate: !0,
580
+ scale: !0,
581
+ shape: !0,
582
+ strokeColor: !0
583
+ }).partial().strict()),
584
+ type: b.literal("shape"),
585
+ version: b.literal(1)
586
+ }).strict(), U = le.shape.simpleTextObjectSettings, bt = b.object({
587
+ settings: S(b.object({
588
+ align: U.shape.align.optional(),
589
+ content: b.string().optional(),
590
+ fontFamily: U.shape.fontFamily.optional(),
591
+ fontSize: U.shape.fontSize.optional(),
592
+ position: U.shape.position.optional(),
593
+ representation: U.shape.representation.optional(),
594
+ responsive: U.shape.responsive.optional(),
595
+ textColor: U.shape.textColor.optional(),
596
+ wordWrap: U.shape.wordWrap.optional()
597
+ }).strict()),
598
+ type: b.literal("simpleTextObject"),
599
+ version: b.literal(1)
600
+ }).strict(), xt = b.object({
601
+ settings: S(b.object({
602
+ customLabel: m.shape.commonSettings.shape.customLabel.optional(),
603
+ hideLabel: m.shape.commonSettings.shape.hideLabel.optional(),
604
+ inputType: m.shape.type.optional(),
605
+ placeholder: m.shape.commonSettings.shape.placeholder.optional(),
606
+ responsive: m.shape.commonSettings.shape.responsive.optional(),
607
+ variableId: m.shape.commonSettings.shape.variableId.optional()
608
+ }).strict()),
609
+ type: b.literal("atomic-input"),
610
+ version: b.literal(1)
611
+ }).strict(), St = b.object({
612
+ data: b.object({ field: O.omit({
613
+ format: !0,
614
+ showNullValues: !0,
615
+ temporalGrouping: !0
616
+ }) }).strict(),
617
+ settings: S(ce.pick({
618
+ layout: !0,
619
+ quickSelect: !0,
620
+ range: !0,
621
+ step: !0
622
+ }).partial()).optional(),
623
+ type: b.literal("slider"),
624
+ version: b.literal(1)
625
+ }).strict(), Ct = O.extend({ role: b.literal("dimension") }), W = k.omit({ dataLabels: !0 }), wt = W.extend({ role: b.literal("measure") }), Tt = b.object({
626
+ columns: b.array(b.discriminatedUnion("role", [Ct, wt])).min(1),
627
+ structure: b.literal("normal").optional()
628
+ }).strict(), Et = b.object({
629
+ dimensions: b.array(O).min(1),
630
+ measures: b.array(W).min(1),
631
+ structure: b.literal("expandable")
632
+ }).strict(), Dt = b.object({
633
+ columnDimensions: b.array(O).min(1),
634
+ measures: b.array(W).min(1),
635
+ rowDimensions: b.array(O).min(1),
636
+ structure: b.literal("pivot")
637
+ }).strict(), Ot = b.union([
638
+ Tt,
639
+ Et,
640
+ Dt
641
+ ]), kt = b.object({
642
+ applyTo: p.shape.applyTo,
643
+ enabled: p.shape.enabled,
644
+ showRecordsCount: p.shape.showRecordsCount,
645
+ style: b.object({
646
+ backgroundColor: f.shape.backgroundColor.optional(),
647
+ fontColor: f.shape.fontColor.optional(),
648
+ fontStyle: h.optional(),
649
+ position: f.shape.position.optional(),
650
+ responsiveHeight: f.shape.responsive
651
+ }).strict().optional()
652
+ }).strict(), At = b.object({
653
+ background: b.object({
654
+ color: s.optional(),
655
+ evenColor: s.optional(),
656
+ oddColor: s.optional(),
657
+ type: b.enum([
658
+ "none",
659
+ "single",
660
+ "zebra"
661
+ ])
662
+ }).strict().optional(),
663
+ body: b.object({
664
+ fontColor: s.optional(),
665
+ fontFamily: b.string().trim().min(1).optional(),
666
+ fontSize: b.number().positive().optional(),
667
+ fontStyle: h.optional(),
668
+ horizontalAlign: b.enum([
669
+ "auto",
670
+ "center",
671
+ "left",
672
+ "right"
673
+ ]).optional(),
674
+ verticalAlign: b.enum([
675
+ "auto",
676
+ "bottom",
677
+ "middle",
678
+ "top"
679
+ ]).optional()
680
+ }).strict().optional(),
681
+ borders: b.object({
682
+ color: s.optional(),
683
+ dividerColor: s.optional(),
684
+ dividers: b.enum([
685
+ "all",
686
+ "auto",
687
+ "horizontal",
688
+ "none",
689
+ "vertical"
690
+ ]).optional(),
691
+ enabled: b.boolean(),
692
+ lineStyle: b.enum([
693
+ "dashed",
694
+ "dotted",
695
+ "line"
696
+ ]).optional(),
697
+ radius: b.number().nonnegative().optional(),
698
+ strokeWidth: b.number().nonnegative().optional()
699
+ }).strict().optional(),
700
+ header: b.object({
701
+ backgroundColor: s.optional(),
702
+ borderColor: s.optional(),
703
+ fontColor: s.optional(),
704
+ fontFamily: b.string().trim().min(1).optional(),
705
+ fontSize: b.number().positive().optional(),
706
+ fontStyle: h.optional(),
707
+ responsiveHeight: b.boolean().optional()
708
+ }).strict().optional(),
709
+ highlight: b.object({
710
+ backgroundColor: s.optional(),
711
+ mode: b.enum([
712
+ "column",
713
+ "none",
714
+ "row",
715
+ "row-and-column"
716
+ ]),
717
+ textColor: s.optional()
718
+ }).strict().optional(),
719
+ layout: b.object({
720
+ columnWidthBehavior: b.enum(["responsive", "static"]).optional(),
721
+ rowHeight: b.number().positive().optional()
722
+ }).strict().optional()
723
+ }).strict(), jt = b.object({
724
+ data: Ot,
725
+ filterGroup: A.optional(),
726
+ limiting: b.object({ queryLimit: b.number().int().positive().optional() }).strict().optional(),
727
+ presentation: At.optional(),
728
+ sorting: b.array(j).optional(),
729
+ totals: kt.optional(),
730
+ type: b.literal("table"),
731
+ version: b.literal(1)
732
+ }).strict(), G = (e) => typeof e == "object" && !!e && !Array.isArray(e), Mt = (e) => {
733
+ let t = e.fieldKey ?? e.key;
734
+ return typeof t == "string" ? t : void 0;
735
+ }, Nt = (e) => {
736
+ if (Array.isArray(e)) return e;
737
+ if (!G(e)) throw Error("Available field metadata must be an array or an object.");
738
+ return [
739
+ "fields",
740
+ "dimensions",
741
+ "measures"
742
+ ].flatMap((t) => {
743
+ let n = e[t];
744
+ if (n === void 0) return [];
745
+ if (!Array.isArray(n)) throw Error(`Available field metadata "${t}" must be an array.`);
746
+ return n;
747
+ });
748
+ }, Pt = (e, t) => {
749
+ let n = e.type;
750
+ if (!(n === "dimension" && G(e.dimension) || n === "measure" && G(e.measure) || n === "calculation" && G(e.calculation))) return;
751
+ let r = E.safeParse({
752
+ fieldKey: e.key,
753
+ item: e,
754
+ kind: n,
755
+ name: e.name
756
+ });
757
+ if (!r.success) throw Error(`Invalid available semantic item at index ${t}: ${r.error.message}`);
758
+ return r.data;
759
+ }, Ft = (e, t) => {
760
+ if (!G(e)) throw Error(`Available field at index ${t} must be an object.`);
761
+ let n = E.safeParse(e);
762
+ if (n.success) return n.data;
763
+ let r = Pt(e, t);
764
+ if (r) return r;
765
+ let i = Array.isArray(e.aggregations) ? e.aggregations : Array.isArray(e.aggregators) ? e.aggregators : [], a = E.safeParse({
766
+ aggregations: i.map((e) => G(e) ? {
767
+ distinct: e.distinct,
768
+ name: e.name ?? e.funcName,
769
+ resultType: e.resultType
770
+ } : e),
771
+ dataType: e.dataType,
772
+ fieldKey: Mt(e),
773
+ isManualData: e.isManualData,
774
+ kind: "field",
775
+ name: e.name,
776
+ schema: e.schema,
777
+ view: e.view
778
+ });
779
+ if (!a.success) throw Error(`Invalid available field at index ${t}: ${a.error.message}`);
780
+ return a.data;
781
+ }, It = (e) => {
782
+ let t = Nt(e).map(Ft), n = /* @__PURE__ */ new Map();
783
+ return t.forEach((e, t) => {
784
+ let r = n.get(e.fieldKey);
785
+ if (r !== void 0) throw Error(`Duplicate available field key "${e.fieldKey}" at indexes ${r} and ${t}.`);
786
+ n.set(e.fieldKey, t);
787
+ }), t;
788
+ }, Lt = (e) => e.kind === "field" ? [...new Set(e.aggregations.flatMap((e) => [e.name, ...e.distinct ? [`${e.name}_DISTINCT`] : []]))] : [], Rt = (e, t) => e.kind === "field" || t === "dimension" && e.kind === "dimension" || t === "measure" && (e.kind === "measure" || e.kind === "calculation"), zt = (e) => {
789
+ if (e.kind !== "dimension") return e.kind;
790
+ }, Bt = (e) => ({
791
+ ...structuredClone(e.item),
792
+ id: e.item.id ?? e.fieldKey
793
+ }), Vt = (e) => e.map((e) => e.kind === "dimension" ? i(Bt(e)) : e.kind === "measure" || e.kind === "calculation" ? a(Bt(e)) : {
794
+ aggregators: n(e.aggregations.map((e) => ({
795
+ distinct: e.distinct ?? !1,
796
+ name: e.name,
797
+ resultType: e.resultType
798
+ }))),
799
+ dataType: e.dataType,
800
+ isManualData: e.isManualData,
801
+ key: e.fieldKey,
802
+ name: e.name,
803
+ schema: e.schema,
804
+ view: e.view,
805
+ views: [e.view]
806
+ }), K = (e) => e.reduce((e, t) => typeof t == "number" ? `${e}[${t}]` : /^[A-Za-z_$][\w$]*$/.test(t) ? e ? `${e}.${t}` : t : `${e}[${JSON.stringify(t)}]`, "") || "definition", q = (e) => {
807
+ if (typeof e == "number" && !Number.isFinite(e)) return String(e);
808
+ try {
809
+ return JSON.stringify(e) ?? String(e);
810
+ } catch {
811
+ return String(e);
812
+ }
813
+ }, Ht = (e, t) => t.reduce((e, t) => typeof e == "object" && e && Object.prototype.hasOwnProperty.call(e, t) ? e[t] : void 0, e), Ut = (e) => {
814
+ if (e.code === "invalid_value") return e.values;
815
+ if (e.code !== "invalid_union" || e.errors.length === 0) return;
816
+ let t = e.errors.map((e) => e.length === 1 && e[0].path.length === 0 ? Ut(e[0]) : void 0);
817
+ return t.every((e) => e !== void 0) ? [...new Set(t.flat())] : void 0;
818
+ }, Wt = (e, t, n = []) => {
819
+ let r = (e, i) => {
820
+ let a = [...i, ...e.path.filter((e) => typeof e != "symbol")];
821
+ if (e.code === "unrecognized_keys") return e.keys.map((r) => {
822
+ let i = [
823
+ ...n,
824
+ ...a,
825
+ r
826
+ ];
827
+ return {
828
+ code: "invalid_structure",
829
+ path: i,
830
+ message: `${K(i)}: Unrecognized key.`,
831
+ details: {
832
+ received: Ht(t, [...a, r]),
833
+ zodCode: e.code
834
+ }
835
+ };
836
+ });
837
+ let o = [...n, ...a], s = Ht(t, a), c = Ut(e), l = {
838
+ received: s,
839
+ zodCode: e.code
840
+ }, u = c ? `Unsupported value ${q(s)}. Allowed values: ${c.map(q).join(", ")}.` : `${e.message}. Received: ${q(s)}.`;
841
+ if (e.code === "invalid_union" && !c && e.errors.length > 0) {
842
+ let t = e.errors.filter((e) => !e.some((e) => e.code === "unrecognized_keys"));
843
+ if (t.length === 1) return t[0].flatMap((e) => r(e, a));
844
+ let n = e.errors.map((e) => e.flatMap((e) => r(e, a)));
845
+ l.alternatives = n, u = `Value does not match any allowed shape. ${n.map((e, t) => `Alternative ${t + 1}: ${e.map((e) => e.message).join(" ")}`).join(" ")}`;
846
+ }
847
+ return [{
848
+ code: "invalid_structure",
849
+ path: o,
850
+ message: `${K(o)}: ${u}`,
851
+ details: l,
852
+ ...c ? { allowedValues: c } : {}
853
+ }];
854
+ };
855
+ return e.issues.flatMap((e) => r(e, []));
856
+ }, Gt = (t, n) => {
857
+ let r = "legend" in t && !!t.legend, i = n.position !== void 0 || n.title !== void 0, a = [];
858
+ return n.visible !== void 0 && (n.visible || i || r) ? a.push({
859
+ name: "setLegendEnabled",
860
+ payload: n.visible
861
+ }) : n.visible === void 0 && i && !r && a.push({
862
+ name: "setLegendEnabled",
863
+ payload: !0
864
+ }), n.position === void 0 ? (n.visible === !0 || i && !r) && a.push({
865
+ name: "setLegendPosition",
866
+ payload: e.Right
867
+ }) : a.push({
868
+ name: "setLegendPosition",
869
+ payload: n.position
870
+ }), n.title !== void 0 && a.push({
871
+ name: "setLegendTitle",
872
+ payload: n.title
873
+ }), a;
874
+ }, J = (e, t, n, r = {}) => ({
875
+ code: e,
876
+ message: n,
877
+ path: t,
878
+ ...r
879
+ }), Kt = (e) => {
880
+ let t = Object.entries(e).find(([, e]) => e.success === !1);
881
+ return t ? {
882
+ id: t[0],
883
+ result: t[1]
884
+ } : void 0;
885
+ }, Y = async (e, t, n) => {
886
+ let r = t.map((e, t) => ({
887
+ ...e,
888
+ id: e.id ?? `definition:${t}`
889
+ })), i = await v(e.vSpec, e.availableFields, r.map(({ id: e, name: t, payload: n }) => ({
890
+ id: e,
891
+ name: t,
892
+ payload: n
893
+ })), e.input.variables ?? [], [], e.input.theme), a = Kt(i.results);
894
+ if (!a) return {
895
+ state: {
896
+ ...e,
897
+ vSpec: i.vSpec
898
+ },
899
+ success: !0
900
+ };
901
+ let o = r.find((e) => e.id === a.id), s = o?.definitionContext, c = s?.path ?? n, l = o?.name ?? a.id, u = a.result.error ?? "Operation failed.", d = s ? `Cannot apply ${q(s.received)} to ${s.kind} ${q(s.ref)}` : "Operation failed";
902
+ return {
903
+ issue: J("operation_failed", c, `${K(c)}: ${d} (operation "${l}"): ${u}`, { details: {
904
+ error: a.result.error,
905
+ operationId: a.id,
906
+ operationName: l,
907
+ ...s ? {
908
+ received: s.received,
909
+ ref: s.ref,
910
+ role: s.kind
911
+ } : {}
912
+ } }),
913
+ success: !1
914
+ };
915
+ }, qt = (e, t, n, r, i, a) => ({
916
+ name: e,
917
+ payload: {
918
+ ...X(t),
919
+ [i]: a
920
+ },
921
+ definitionContext: {
922
+ path: [
923
+ ...r,
924
+ "format",
925
+ i
926
+ ],
927
+ received: a,
928
+ ref: n,
929
+ kind: t.kind
930
+ }
931
+ }), Jt = (e, t, n, r, i, a, o) => ({
932
+ name: e,
933
+ payload: {
934
+ name: t,
935
+ [i]: a
936
+ },
937
+ definitionContext: {
938
+ path: [
939
+ ...r,
940
+ "format",
941
+ i
942
+ ],
943
+ received: a,
944
+ ref: n,
945
+ kind: o
946
+ }
947
+ }), Yt = (e, t) => {
948
+ if (!e || typeof e.data != "object" || e.data === null || !("dataItem" in e.data)) return;
949
+ let n = e.data.dataItem;
950
+ if (!(typeof n != "object" || !n || !("internalKey" in n) || typeof n.internalKey != "string" || !("uniqueSignature" in n) || typeof n.uniqueSignature != "string")) return {
951
+ dataItemInternalKey: n.internalKey,
952
+ dataItemUniqueSignature: n.uniqueSignature,
953
+ kind: t
954
+ };
955
+ }, X = (e) => ({
956
+ dataItemInternalKey: e.dataItemInternalKey,
957
+ dataItemUniqueSignature: e.dataItemUniqueSignature
958
+ }), Xt = (e) => {
959
+ let t = [], n = /* @__PURE__ */ new Set();
960
+ return e.forEach(({ items: e, path: r }) => {
961
+ e.forEach((e, i) => {
962
+ n.has(e.ref) && t.push(J("duplicate_alias", [
963
+ ...r,
964
+ i,
965
+ "ref"
966
+ ], `Reference "${e.ref}" is duplicated.`)), n.add(e.ref);
967
+ });
968
+ }), t;
969
+ }, Zt = (e, t) => {
970
+ let n = e, r = n.referencedData;
971
+ return t.every((e) => !Array.isArray(n[e]) || n[e].length === 0) && (typeof r != "object" || !r || Object.keys(r).length === 0);
972
+ }, Qt = (e, t) => ({
973
+ availableFields: Vt(e.availableFields),
974
+ input: e,
975
+ resolvedRefs: {},
976
+ vSpec: t
977
+ }), $t = async (e, t, n, r, i, a) => {
978
+ let o = `${n}:${t.ref}`, s = await v(e.vSpec, e.availableFields, [{
979
+ id: o,
980
+ name: r,
981
+ payload: i
982
+ }], e.input.variables ?? [], [], e.input.theme), c = Kt(s.results), l = Yt(s.results[o], n);
983
+ return c || !l ? {
984
+ issue: J("operation_failed", a, c?.result.error ?? `${n} operation did not return the created data-item identity.`),
985
+ success: !1
986
+ } : {
987
+ state: {
988
+ ...e,
989
+ resolvedRefs: {
990
+ ...e.resolvedRefs,
991
+ [t.ref]: l
992
+ },
993
+ vSpec: s.vSpec
994
+ },
995
+ success: !0
996
+ };
997
+ }, en = (e, t, n, r) => {
998
+ let i = [
999
+ "formatType",
1000
+ "formatString",
1001
+ "currency",
1002
+ "currencyIsPrefix",
1003
+ "negativeType"
1004
+ ];
1005
+ return Y(e, t.flatMap((t, a) => {
1006
+ let o = e.resolvedRefs[t.ref];
1007
+ return i.flatMap((e) => {
1008
+ let i = t.format?.[e], s = n[e];
1009
+ return i !== void 0 && s ? [qt(s, o, t.ref, t.path ?? [...r, a], e, i)] : [];
1010
+ });
1011
+ }), r);
1012
+ }, tn = (e, t, n, r, i) => ({
1013
+ name: e,
1014
+ payload: {
1015
+ ...X(t),
1016
+ ...i
1017
+ },
1018
+ definitionContext: {
1019
+ path: [...r, "temporalGrouping"],
1020
+ received: i,
1021
+ ref: n,
1022
+ kind: t.kind
1023
+ }
1024
+ }), nn = (e, t, n, r) => Y(e, t.flatMap((t, i) => t.temporalGrouping ? [tn(n, e.resolvedRefs[t.ref], t.ref, t.path ?? [...r, i], t.temporalGrouping)] : []), r), rn = (e, t, n, r) => Y(e, t.flatMap((t) => t.showNullValues === void 0 ? [] : [{
1025
+ name: n,
1026
+ payload: {
1027
+ ...X(e.resolvedRefs[t.ref]),
1028
+ changes: { showNullValues: t.showNullValues }
1029
+ }
1030
+ }]), r), an = (e) => "value" in e ? { value: e.value } : "values" in e ? {
1031
+ secondValue: e.values.join(","),
1032
+ value: ","
1033
+ } : "valueFrom" in e ? {
1034
+ valueFrom: e.valueFrom,
1035
+ valueTo: e.valueTo
1036
+ } : {}, Z = (e) => ({
1037
+ filters: e.filters.map((e) => "filters" in e ? Z(e) : {
1038
+ fieldKey: e.fieldKey,
1039
+ operator: e.operator,
1040
+ values: an(e)
1041
+ }),
1042
+ operator: e.operator
1043
+ }), on = (e, t) => t ? Y(e, [{
1044
+ id: "filterGroup",
1045
+ name: "setStaticFilterGroup",
1046
+ payload: Z(t)
1047
+ }], ["filterGroup"]) : Promise.resolve({
1048
+ state: e,
1049
+ success: !0
1050
+ }), sn = (e, t, n, r) => {
1051
+ if (!t?.length) return Promise.resolve({
1052
+ state: e,
1053
+ success: !0
1054
+ });
1055
+ let i = e.vSpec.querySettings?.sortingOrder ?? [], a = new Map(t.map((e) => [e.by, e])), o = new Map(Object.entries(e.resolvedRefs).map(([e, t]) => [`${t.dataItemInternalKey}:${t.dataItemUniqueSignature}`, e])), s = t.map((t) => e.resolvedRefs[t.by]), c = new Set(s.map((e) => `${e.dataItemInternalKey}:${e.dataItemUniqueSignature}`));
1056
+ return Y(e, [{
1057
+ name: n,
1058
+ payload: { changeRequests: [...s, ...i.filter((e) => !c.has(`${e.dataItem.internalKey}:${e.dataItem.uniqueSignature}`)).map((e) => ({
1059
+ dataItemInternalKey: e.dataItem.internalKey,
1060
+ dataItemUniqueSignature: e.dataItem.uniqueSignature,
1061
+ kind: "dimension"
1062
+ }))].map((e, t) => {
1063
+ let n = `${e.dataItemInternalKey}:${e.dataItemUniqueSignature}`, r = o.get(n), s = i.find((e) => `${e.dataItem.internalKey}:${e.dataItem.uniqueSignature}` === n);
1064
+ return {
1065
+ ...X(e),
1066
+ newIndex: t,
1067
+ sortDirection: (r ? a.get(r)?.direction : void 0) ?? s?.sortDirection ?? "asc"
1068
+ };
1069
+ }) }
1070
+ }, ...t.map((t) => ({
1071
+ name: r,
1072
+ payload: {
1073
+ ...X(e.resolvedRefs[t.by]),
1074
+ enabled: t.enabled ?? !0
1075
+ }
1076
+ }))], ["sorting"]);
1077
+ }, cn = (e, t) => (e ?? []).flatMap((e, n) => t.includes(e.by) ? [] : [J("unknown_alias", [
1078
+ "sorting",
1079
+ n,
1080
+ "by"
1081
+ ], `Reference "${e.by}" does not exist.`, { allowedValues: t })]), Q = ["presentation", "coloring"], ln = (e, t, n) => [...(e?.overwrites ?? []).flatMap(({ dimension: e }, n) => e === void 0 || t.includes(e) ? [] : [J("unknown_alias", [
1082
+ ...Q,
1083
+ "overwrites",
1084
+ n,
1085
+ "dimension"
1086
+ ], `Dimension reference "${e}" does not exist.`, { allowedValues: t })]), ...(e?.rules ?? []).flatMap(({ measure: e }, t) => n.includes(e) ? [] : [J("unknown_alias", [
1087
+ ...Q,
1088
+ "rules",
1089
+ t,
1090
+ "measure"
1091
+ ], `Measure reference "${e}" does not exist.`, { allowedValues: n })])], un = (e, t) => {
1092
+ let n = [];
1093
+ return t?.overwrites && n.push({
1094
+ name: he.SET_COLORING_OVERWRITES,
1095
+ payload: { overwrites: t.overwrites.map(({ dimension: t, ...n }) => t === void 0 ? n : {
1096
+ ...n,
1097
+ dimension: X(e.resolvedRefs[t])
1098
+ }) }
1099
+ }), t?.rules && n.push({
1100
+ name: he.SET_COLORING_RULES,
1101
+ payload: { rules: t.rules.map(({ measure: t, ...n }) => ({
1102
+ ...n,
1103
+ measure: X(e.resolvedRefs[t])
1104
+ })) }
1105
+ }), Y(e, n, Q);
1106
+ }, dn = (e, t) => {
1107
+ let n = t.safeParse(e.vSpec);
1108
+ return n.success ? {
1109
+ resolvedRefs: e.resolvedRefs,
1110
+ success: !0,
1111
+ vSpec: n.data
1112
+ } : {
1113
+ issues: [J("invalid_compiled_vspec", [], "Compiled vSpec failed final validation.", { details: { issues: n.error.issues } })],
1114
+ success: !1
1115
+ };
1116
+ }, $ = (e) => "startsAtZero" in e ? {} : e, fn = (e) => {
1117
+ let { max: t, min: n } = $(e);
1118
+ return n !== void 0 && t !== void 0 ? o.MinMax : n === void 0 ? t === void 0 ? o.Auto : o.Max : o.Min;
1119
+ }, pn = (e) => {
1120
+ for (let [t, n] of Object.entries(e ?? {})) {
1121
+ let { max: e, min: r } = n?.range ? $(n.range) : {};
1122
+ if (r !== void 0 && e !== void 0 && r >= e) return J("invalid_structure", [
1123
+ "presentation",
1124
+ "axes",
1125
+ t,
1126
+ "range",
1127
+ "min"
1128
+ ], `Axis range min (${r}) must be less than max (${e}).`);
1129
+ }
1130
+ }, mn = (e, t) => {
1131
+ let n = [];
1132
+ t.inverted !== void 0 && n.push({
1133
+ name: y.SET_INVERT_AXIS,
1134
+ payload: {
1135
+ axisName: e,
1136
+ invertAxis: t.inverted
1137
+ }
1138
+ });
1139
+ let { range: r } = t;
1140
+ if (r) {
1141
+ n.push({
1142
+ name: y.SET_AXIS_RANGE_OPTION,
1143
+ payload: {
1144
+ axisName: e,
1145
+ axisRangeOption: fn(r)
1146
+ }
1147
+ });
1148
+ let { max: t, min: i } = $(r);
1149
+ i !== void 0 && n.push({
1150
+ name: y.SET_AXIS_RANGE_MIN,
1151
+ payload: {
1152
+ axisName: e,
1153
+ minValue: i
1154
+ }
1155
+ }), t !== void 0 && n.push({
1156
+ name: y.SET_AXIS_RANGE_MAX,
1157
+ payload: {
1158
+ axisName: e,
1159
+ maxValue: t
1160
+ }
1161
+ }), "startsAtZero" in r && n.push({
1162
+ name: y.SET_AXIS_STARTS_AT_ZERO,
1163
+ payload: {
1164
+ axisName: e,
1165
+ startsAtZero: r.startsAtZero
1166
+ }
1167
+ });
1168
+ }
1169
+ return n;
1170
+ };
1171
+ export { tt as $, jt as A, lt as B, Xt as C, zt as D, Lt as E, yt as F, Ze as G, Ge as H, St as I, $e as J, Ye as K, bt as L, gt as M, _t as N, Rt as O, vt as P, et as Q, mt as R, ln as S, It as T, Qe as U, st as V, Ke as W, nt as X, Xe as Y, qe as Z, pn as _, en as a, Z as b, mn as c, J as d, rt as et, Gt as f, dn as g, Y as h, on as i, xt as j, Vt as k, qt as l, tn as m, un as n, We as nt, sn as o, Jt as p, Je as q, rn as r, E as rt, nn as s, $t as t, it as tt, Qt as u, Zt as v, Wt as w, cn as x, X as y, pt as z };