@astrato-io/visualizations 0.0.0-stage → 0.6.5

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