@astrato-io/visualizations 0.9.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. package/README.md +8 -4
  2. package/THIRD_PARTY_NOTICES.md +163 -14
  3. package/VISUALIZATION_DEFINITIONS.md +319 -32
  4. package/chunks/{Button-5CxPEACP.js → Button-CCF851ea.js} +4 -4
  5. package/chunks/{CircularProgress-DFS-LQb7.js → CircularProgress-yupH6YWs.js} +39 -39
  6. package/chunks/FieldTypeIcon-D_MzsdfY.js +22 -0
  7. package/chunks/{LinearProgress-CjIQfkNA.js → LinearProgress-CyFjN4px.js} +9 -9
  8. package/chunks/{MenuOption-Cb7B7x6z.js → MenuOption-CQpT79AP.js} +143 -142
  9. package/chunks/{Title-CtFw1bVg.js → Title-C-p4ZarD.js} +22 -22
  10. package/chunks/_createAggregator-BF4qG9XK.js +50 -0
  11. package/chunks/{app-filter-bar.compiler-B9775gLJ.js → app-filter-bar.compiler-8fxCo2q7.js} +10 -10
  12. package/chunks/bar-layout-DStC-GNV.js +9 -0
  13. package/chunks/{bar.compiler-B7wlH_Ro.js → bar.compiler-CQAu8KL8.js} +102 -84
  14. package/chunks/{builder-Dxo7D7c6.js → builder-CScg1TOS.js} +71 -38
  15. package/chunks/color-rules-DYJL4fIW.js +15 -0
  16. package/chunks/color-settings-DJFoFTip.js +5 -0
  17. package/chunks/{coloring-B-Wa8D5P.js → coloring-9jU3s_-p.js} +41 -41
  18. package/chunks/createSimplePaletteValueFilter-C4hZpCdn.js +2005 -0
  19. package/chunks/defaults-cyNhn37t.js +3 -0
  20. package/chunks/{definitions-DNpzD9tY.js → definitions-C4grxhye.js} +613 -401
  21. package/chunks/{escobar-C4Nm3eJ7.js → escobar-CjirINHP.js} +5326 -5079
  22. package/chunks/{extend-preset-BVKFtoe-.js → extend-preset-D-l9u_we.js} +974 -909
  23. package/chunks/{filter.compiler-BlS3zoy_.js → filter.compiler-lji2Acgn.js} +10 -10
  24. package/chunks/{filtering-CGuLpg7u.js → filtering-C1zakrrX.js} +385 -429
  25. package/chunks/handlers-ZviIUC-j.js +15387 -0
  26. package/chunks/{icon-picker-styles-DYQgVEKG.js → icon-picker-styles-Bj80ZUBK.js} +11 -11
  27. package/chunks/isEqual-Ch9OEye3.js +16 -0
  28. package/chunks/{isFocusVisible-B1_z03UT.js → isFocusVisible-CgMP0qkR.js} +1 -1
  29. package/chunks/label-format-type-C46pzgx7.js +17 -0
  30. package/chunks/{line.compiler-Bo9i9qag.js → line.compiler-De5fiKuR.js} +9 -9
  31. package/chunks/{logger-3lng-wOw.js → logger-CKRjhSHQ.js} +71 -64
  32. package/chunks/map.compiler-CKzorLgK.js +345 -0
  33. package/chunks/{metadata-Fmx1swpK.js → metadata-Bb9pTXrq.js} +1 -1
  34. package/chunks/{number.compiler-CdLd5aGW.js → number.compiler-CaTmJkmi.js} +7 -7
  35. package/chunks/operations-DZoY50VX.js +31297 -0
  36. package/chunks/{range-CzO4isKK.js → range-D1BTmFMp.js} +2 -2
  37. package/chunks/{react-dom-BwZT0N3F.js → react-dom-Dgv2azN2.js} +70 -70
  38. package/chunks/{render-wrappers-CAuvgMxi.js → render-wrappers-_P3xwu5A.js} +1 -1
  39. package/chunks/{requirements-CYpVh65U.js → requirements-NHNrR8Ie.js} +59 -57
  40. package/chunks/shared-UitWpq1J.js +1331 -0
  41. package/chunks/{standalone-CoQxJ6ov.js → standalone-B0U6c3su.js} +804 -804
  42. package/chunks/{standalone-C6XDHYAM.js → standalone-BBu90BhK.js} +109 -109
  43. package/chunks/standalone-BEekPuA12.js +357 -0
  44. package/chunks/{standalone-CPUiiWNP.js → standalone-BOzHA_d4.js} +41 -41
  45. package/chunks/standalone-BR2JuRIC.js +422 -0
  46. package/chunks/{standalone-DuwTOBXH.js → standalone-BapqaniK.js} +592 -592
  47. package/chunks/{standalone-DWPfdP0A.js → standalone-Bnnr87pc.js} +523 -523
  48. package/chunks/standalone-BwJqDj2Z.js +396 -0
  49. package/chunks/{standalone-LFVgLhia.js → standalone-ByKKqT5L.js} +266 -258
  50. package/chunks/{standalone-BDrQMxLi.js → standalone-CRdDZYeM.js} +1788 -1004
  51. package/chunks/standalone-CRfDOO1x.js +287 -0
  52. package/chunks/{standalone-BvWdpUL3.js → standalone-CVknVdUC.js} +21 -18
  53. package/chunks/standalone-CbPk8bKn.js +580 -0
  54. package/chunks/{standalone-r4ObFvys.js → standalone-Ck63MZzj.js} +218 -216
  55. package/chunks/{standalone-Cu73fzSr.js → standalone-DCFY1MAV.js} +6040 -5820
  56. package/chunks/{standalone-CiaaibTa.js → standalone-DZDGX3aa.js} +174 -174
  57. package/chunks/standalone-DhfgeJIk.js +1012 -0
  58. package/chunks/standalone-DibjA73M.js +6 -0
  59. package/chunks/{standalone-CXniic5x.js → standalone-DtBk_iUz.js} +6 -5
  60. package/chunks/standalone-DxBAyqAu.js +772 -0
  61. package/chunks/standalone-KMQPsNsq.js +2 -0
  62. package/chunks/standalone-MBLSvsrY.js +2 -0
  63. package/chunks/standalone-U0WJwFlG.js +354 -0
  64. package/chunks/{standalone-CNkHsynO.js → standalone-swGs70tD.js} +54 -56
  65. package/chunks/standalone-wgFAVnnm.js +355 -0
  66. package/chunks/standalone-xGV0dqPV.js +689 -0
  67. package/chunks/{table.compiler-C1qjqXaT.js → table.compiler-OWSx5MOq.js} +4 -4
  68. package/chunks/{useFieldName-mWrD_uk_.js → useFieldName-B8iCYyw1.js} +1 -1
  69. package/chunks/{utils-DYYD4Zzf.js → utils-3Igg6xmO.js} +4740 -4737
  70. package/chunks/{view-7fH6mGmY.js → view-DdMLZySj.js} +1988 -1632
  71. package/chunks/{visualization-filters-mVnsnvLP.js → visualization-filters-CzvFHE6M.js} +3158 -2417
  72. package/chunks/{with-html-element-B0Clt4jY.js → with-html-element-DOfkR3C1.js} +3353 -3160
  73. package/definitions.js +2 -2
  74. package/docs/operations/astrato-app-filter-bar.md +1 -1
  75. package/docs/operations/bar.md +303 -2
  76. package/docs/operations/combo.md +262 -1
  77. package/docs/operations/date-picker.md +1 -1
  78. package/docs/operations/distribution-gauge.md +1 -1
  79. package/docs/operations/dot.md +148 -1
  80. package/docs/operations/filter.md +1 -1
  81. package/docs/operations/gauge.md +1 -1
  82. package/docs/operations/heatMap.md +1 -1
  83. package/docs/operations/histogram.md +262 -1
  84. package/docs/operations/iframe.md +1 -1
  85. package/docs/operations/image.md +1 -1
  86. package/docs/operations/index.md +7 -7
  87. package/docs/operations/line.md +262 -1
  88. package/docs/operations/number.md +1 -1
  89. package/docs/operations/pie.md +1 -1
  90. package/docs/operations/radar.md +1 -1
  91. package/docs/operations/sankey.md +1 -1
  92. package/docs/operations/scatter.md +148 -1
  93. package/docs/operations/shape.md +1 -1
  94. package/docs/operations/simpleTextObject.md +1 -1
  95. package/docs/operations/slider.md +1 -1
  96. package/docs/operations/table.md +374 -157
  97. package/docs/operations/tree.md +1 -1
  98. package/docs/operations/treemap.md +1 -1
  99. package/docs/operations/waterfall.md +1 -1
  100. package/docs/operations/word-cloud.md +1 -1
  101. package/getters.js +2 -2
  102. package/index.js +507 -459
  103. package/metadata.js +2 -2
  104. package/operations.js +5 -5
  105. package/package.json +72 -67
  106. package/src/definitions/index.d.ts +1 -1
  107. package/src/definitions/model/definitions/available-fields.d.ts +2 -2
  108. package/src/definitions/model/definitions/compilers/compile.d.ts +1 -0
  109. package/src/definitions/model/definitions/data-item-resolution.d.ts +3 -3
  110. package/src/definitions/model/definitions/descriptors/descriptor-metadata.d.ts +188 -2
  111. package/src/definitions/model/definitions/index.d.ts +2 -1
  112. package/src/definitions/model/definitions/schema-registry.d.ts +305 -0
  113. package/src/definitions/model/definitions/schemas/bar.schema.d.ts +2 -0
  114. package/src/definitions/model/definitions/schemas/common.schema.d.ts +4 -3
  115. package/src/definitions/model/definitions/schemas/index.d.ts +1 -0
  116. package/src/definitions/model/definitions/schemas/map.schema.d.ts +590 -0
  117. package/src/definitions/model/definitions/types/compilation.types.d.ts +7 -2
  118. package/src/definitions/model/definitions/types/definition.types.d.ts +2 -2
  119. package/src/definitions/model/definitions/types/index.d.ts +1 -1
  120. package/src/index.d.ts +1 -1
  121. package/src/operations/index.d.ts +1 -1
  122. package/src/types.d.ts +45 -41
  123. package/chunks/FieldTypeIcon-pSVQFemC.js +0 -22
  124. package/chunks/ToggleButton-Br9HCPCv.js +0 -150
  125. package/chunks/color-rules-CN7TcGrC.js +0 -6
  126. package/chunks/color-settings-3VRlf_Vw.js +0 -6
  127. package/chunks/handlers-CMbyj5y1.js +0 -12930
  128. package/chunks/isEqual-DBg_b35N.js +0 -12
  129. package/chunks/label-format-type-weq1XfcX.js +0 -8
  130. package/chunks/operations-HSqnCRvv.js +0 -26324
  131. package/chunks/shared-DFoJxjVN.js +0 -1218
  132. package/chunks/standalone-530a5lvf.js +0 -1003
  133. package/chunks/standalone-5DnapeHH.js +0 -420
  134. package/chunks/standalone-B4jrf4KE.js +0 -354
  135. package/chunks/standalone-B6s_xG2u.js +0 -354
  136. package/chunks/standalone-BMoJXGYe.js +0 -2
  137. package/chunks/standalone-BfvGggeM2.js +0 -355
  138. package/chunks/standalone-CMJJIi9v.js +0 -2
  139. package/chunks/standalone-C_Jd4gkj.js +0 -6
  140. package/chunks/standalone-DBeXQrwH.js +0 -468
  141. package/chunks/standalone-DMCwtebn.js +0 -396
  142. package/chunks/standalone-DpSRmAWx.js +0 -287
  143. package/chunks/standalone-kzAhwH19.js +0 -689
  144. package/chunks/standalone-mb7LwEiq.js +0 -3874
  145. /package/chunks/{src-BOS6SqkZ2.js → src-BOS6SqkZ.js} +0 -0
@@ -0,0 +1,1331 @@
1
+ import { As as e, Fo as t, Io as n, Ss as r, _s as i, ks as a, ll as o, r as s, us as c, vs as l, xs as u } from "./visualization-filters-CzvFHE6M.js";
2
+ import { Ah as d, Gg as ee, Hh as te, Ih as ne, Im as re, Jg as ie, Jm as f, Lg as ae, Mh as oe, Qp as p, Sm as m, Uh as se, Vg as ce, Wh as le, dh as ue, f_ as h, fh as de, gh as g, h_ as fe, hh as pe, im as me, jh as he, lh as ge, mh as _e, o_ as ve, oh as ye, om as be, ph as xe, r_ as Se, rh as Ce, rm as _, sh as we, sm as Te, th as Ee, tm as v, xg as De, y_ as Oe } from "./handlers-ZviIUC-j.js";
3
+ import { T as ke, d as Ae, t as je, y } from "./operations-DZoY50VX.js";
4
+ import { z as b } from "zod";
5
+ var x = o(), Me = 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(), Ne = b.object({
18
+ settings: Me.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."), Pe = S(ve.shape.dataType), Fe = S(Se.shape.formatType), Ie = b.object({
22
+ distinct: b.boolean().optional(),
23
+ name: b.string().trim().min(1),
24
+ resultType: b.string().optional()
25
+ }).strict(), Le = b.object({
26
+ aggregations: b.array(Ie).default([]),
27
+ dataType: Pe,
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(), Re = T.extend({
40
+ dimension: b.record(b.string(), b.unknown()),
41
+ type: b.literal("dimension")
42
+ }), ze = T.extend({
43
+ measure: b.object({ aggregation: b.string().min(1) }).passthrough(),
44
+ type: b.literal("measure")
45
+ }), Be = T.extend({
46
+ calculation: b.record(b.string(), b.unknown()),
47
+ type: b.literal("calculation")
48
+ }), Ve = b.object({
49
+ fieldKey: w,
50
+ item: Re,
51
+ kind: b.literal("dimension"),
52
+ name: b.string().min(1)
53
+ }).strict(), He = b.object({
54
+ fieldKey: w,
55
+ item: ze,
56
+ kind: b.literal("measure"),
57
+ name: b.string().min(1)
58
+ }).strict(), Ue = b.object({
59
+ fieldKey: w,
60
+ item: Be,
61
+ kind: b.literal("calculation"),
62
+ name: b.string().min(1)
63
+ }).strict(), E = b.union([
64
+ Le,
65
+ Ve,
66
+ He,
67
+ Ue
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
+ }), We = b.object({
75
+ currency: b.string().min(1).optional(),
76
+ currencyIsPrefix: b.boolean().optional(),
77
+ formatString: b.string().optional(),
78
+ formatType: Fe.optional(),
79
+ negativeType: S(Se.shape.negativeType.unwrap()).optional()
80
+ }).strict(), Ge = 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: We.pick({
89
+ formatString: !0,
90
+ formatType: !0
91
+ }).optional(),
92
+ ref: C,
93
+ showNullValues: b.boolean().optional(),
94
+ temporalGrouping: Ge.describe("Groups a date dimension. Applied before format; format must then suit the grouping.").optional()
95
+ }).strict(), Ke = b.object({
96
+ placements: b.array(S(b.enum(fe))).min(1).describe("Positions tried in order. Inside labels sit at the end of the bar.").optional(),
97
+ textColor: h.describe("Label text color in every placement. Omit to keep the automatic contrast color.").optional(),
98
+ visible: b.boolean()
99
+ }).strict(), O = b.object({
100
+ aggregation: b.string().trim().min(1).describe("Required for a raw field measure; omit for a predefined measure or calculation.").optional(),
101
+ dataLabels: Ke.optional(),
102
+ fieldKey: w,
103
+ format: We.optional(),
104
+ ref: C
105
+ }).strict(), qe = b.object({
106
+ fieldKey: w,
107
+ operator: S(b.enum(ne)),
108
+ value: b.string()
109
+ }).strict(), Je = b.object({
110
+ fieldKey: w,
111
+ operator: S(b.enum(oe)),
112
+ valueFrom: b.string(),
113
+ valueTo: b.string()
114
+ }).strict(), Ye = b.object({
115
+ fieldKey: w,
116
+ operator: S(b.enum(d)),
117
+ values: b.array(b.string()).min(1)
118
+ }).strict(), Xe = b.object({
119
+ fieldKey: w,
120
+ operator: S(b.enum(he))
121
+ }).strict(), Ze = b.union([
122
+ qe,
123
+ Je,
124
+ Ye,
125
+ Xe
126
+ ]), k = b.lazy(() => b.object({
127
+ filters: b.array(b.union([Ze, k])),
128
+ operator: b.enum(["and", "or"])
129
+ }).strict()), A = b.object({
130
+ by: C,
131
+ direction: S(ae.shape.sortDirection),
132
+ enabled: b.boolean().optional()
133
+ }).strict(), Qe = b.object({
134
+ by: C,
135
+ count: b.number().int().positive(),
136
+ direction: S(ae.shape.sortDirection),
137
+ showOthers: b.boolean().optional()
138
+ }).strict(), $e = b.object({
139
+ queryLimit: b.number().int().positive().optional(),
140
+ topN: Qe.optional()
141
+ }).strict(), et = b.object({
142
+ position: S(ie.shape.position).optional(),
143
+ title: b.string().optional(),
144
+ visible: b.boolean().optional()
145
+ }).strict(), j = b.object({
146
+ labelsVisible: b.boolean().optional(),
147
+ lineVisible: b.boolean().optional(),
148
+ ticksVisible: b.boolean().optional(),
149
+ title: b.string().optional(),
150
+ titleVisible: b.boolean().optional()
151
+ }).strict(), tt = b.union([b.object({
152
+ max: b.number().optional(),
153
+ min: b.number().optional().describe("Must be less than max when both are set")
154
+ }).strict(), b.object({ startsAtZero: b.boolean() }).strict()]).describe("Fix min, max or both, or set startsAtZero on an axis fitted to the data"), nt = b.array(De).optional().describe("Shaded ranges drawn across the plot between two primary measure axis values"), rt = te({}), it = te({ dimension: C.describe(`Alias of a dimension in data.dimensions. ${le}`) }), at = se({ measure: C.describe("Alias of the measure in data.measures whose value is compared") }), ot = "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.", st = b.array(at).min(1).describe("Colors bound to measure thresholds, eg. red when sales is below 100. The first matching rule wins."), M = (e) => b.object({
155
+ overwrites: b.array(e.requiresOverwriteDimension ? it : rt).min(1).describe(ot).optional(),
156
+ ...e.rules ? { rules: st.optional() } : {}
157
+ }).strict(), ct = {
158
+ inverted: b.boolean().optional().describe("Reverse the direction of the axis values, eg. to put rank 1 at the top"),
159
+ range: tt.optional()
160
+ }, lt = { bands: nt }, ut = { scale: S(b.enum(Oe)).optional() };
161
+ j.extend({
162
+ ...ct,
163
+ ...lt,
164
+ ...ut
165
+ }).strict();
166
+ var N = ({ logScale: e = !1, primaryMeasureBands: t = !1, rangedMeasureAxes: n = [] } = {}) => {
167
+ let r = (t, r) => j.extend({
168
+ ...n.includes(t) ? ct : {},
169
+ ...r ? lt : {},
170
+ ...e ? ut : {}
171
+ }).strict();
172
+ return b.object({
173
+ dimension: j.optional(),
174
+ primaryMeasure: r("primaryMeasure", t).optional(),
175
+ secondaryMeasure: r("secondaryMeasure", !1).optional()
176
+ }).strict();
177
+ };
178
+ N();
179
+ var dt = b.object({
180
+ axes: N({
181
+ logScale: !0,
182
+ primaryMeasureBands: !0,
183
+ rangedMeasureAxes: ["primaryMeasure", "secondaryMeasure"]
184
+ }).optional(),
185
+ legend: et.optional(),
186
+ orientation: S(b.enum(n)).optional()
187
+ }).strict(), ft = S(b.enum([i.Groups, i.Stacked])).describe("How several measures, or a series dimension, share a category: \"groups\" side by side, \"stacked\" into one bar. Ignored for one dimension with one measure. Defaults to groups for several measures on one dimension, otherwise stacked."), pt = O.extend({ axis: b.enum(["primary", "secondary"]).optional() }), mt = b.object({
188
+ data: b.object({
189
+ dimensions: b.array(D).min(1),
190
+ measures: b.array(pt).min(1)
191
+ }).strict(),
192
+ filterGroup: k.optional(),
193
+ limiting: $e.optional(),
194
+ presentation: dt.extend({
195
+ coloring: M({ rules: !0 }).optional(),
196
+ layout: ft.optional()
197
+ }).optional(),
198
+ sorting: b.array(A).optional(),
199
+ type: b.literal("bar"),
200
+ version: b.literal(1)
201
+ }).strict(), ht = b.object({ visible: b.boolean() }).strict(), gt = (e, t) => b.array(e).min(t.min).max(t.max), P = (e, t) => {
202
+ let r = {};
203
+ if (t.dimensions.max > 0) {
204
+ let e = gt(D, t.dimensions);
205
+ r.dimensions = t.dimensions.min === 0 ? e.optional() : e;
206
+ }
207
+ if (t.measures.max > 0) {
208
+ let e = t.dataLabels ? O.omit({ dataLabels: !0 }).extend({ dataLabels: ht.optional() }) : O.omit({ dataLabels: !0 }), n = t.comboSeriesTypes ? e.extend({ seriesType: b.enum([
209
+ "bar",
210
+ "line",
211
+ "point"
212
+ ]).optional() }) : e, i = gt(t.measureAxis ? n.extend({ axis: b.enum(["primary", "secondary"]).optional() }) : n, t.measures);
213
+ r.measures = t.measures.min === 0 ? i.optional() : i;
214
+ }
215
+ let i = {};
216
+ if (t.axes) {
217
+ let e = N({
218
+ logScale: t.measureAxisScale,
219
+ primaryMeasureBands: t.measureAxisBands,
220
+ rangedMeasureAxes: t.rangedMeasureAxes
221
+ });
222
+ i.axes = (t.secondaryDimensionAxis ? e.extend({ secondaryDimension: j.optional() }) : e).optional();
223
+ }
224
+ t.conditionalColoring && (i.coloring = M(t.conditionalColoring).optional()), t.dataLabels && (i.dataLabels = ht.optional()), t.gaugeDisplayMode && (i.displayMode = b.enum(["bar", "radial"]).optional()), t.legend && (i.legend = et.optional()), t.orientation && (i.orientation = S(b.enum(n)).optional()), t.treeLayout && (i.layout = b.object({
225
+ compact: b.boolean().optional(),
226
+ direction: b.enum([
227
+ "bottom",
228
+ "left",
229
+ "right",
230
+ "top"
231
+ ]).optional(),
232
+ forceAutoFit: b.boolean().optional(),
233
+ initialExpandedLevels: b.number().int().min(0).optional()
234
+ }).strict().optional());
235
+ let a = {
236
+ data: b.object(r).strict(),
237
+ filterGroup: k.optional(),
238
+ type: b.literal(e),
239
+ version: b.literal(1)
240
+ };
241
+ return t.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()), t.sorting && (a.sorting = b.array(A).optional()), b.object(a).strict().superRefine((n, r) => {
242
+ let i = n.data, a = t.validateCounts?.(i.dimensions?.length ?? 0, i.measures?.length ?? 0);
243
+ a && r.addIssue({
244
+ code: "custom",
245
+ message: a,
246
+ path: ["data"]
247
+ });
248
+ let o = t.conditionalColoring?.minDimensions ?? 0;
249
+ n.presentation?.coloring && (i.dimensions?.length ?? 0) < o && r.addIssue({
250
+ code: "custom",
251
+ message: `${e} value colors require at least ${o} dimensions.`,
252
+ path: ["presentation", "coloring"]
253
+ }), t.validateDefinition?.(n, r);
254
+ });
255
+ }, _t = P("combo", {
256
+ axes: !0,
257
+ comboSeriesTypes: !0,
258
+ dataLabels: !0,
259
+ dimensions: {
260
+ min: 1,
261
+ max: 1
262
+ },
263
+ legend: !0,
264
+ measureAxis: !0,
265
+ measureAxisBands: !0,
266
+ measureAxisScale: !0,
267
+ measures: {
268
+ min: 1,
269
+ max: 10
270
+ },
271
+ orientation: !0,
272
+ queryLimit: !0,
273
+ sorting: !0,
274
+ rangedMeasureAxes: ["primaryMeasure", "secondaryMeasure"],
275
+ validateDefinition: (e, t) => {
276
+ let n = e.data.measures ?? [];
277
+ n.forEach((e, n) => {
278
+ e.dataLabels?.visible && e.seriesType !== "bar" && t.addIssue({
279
+ code: "custom",
280
+ message: "Combo data labels are supported only for bar series.",
281
+ path: [
282
+ "data",
283
+ "measures",
284
+ n,
285
+ "dataLabels"
286
+ ]
287
+ });
288
+ }), e.presentation?.dataLabels?.visible && !n.some((e) => e.seriesType === "bar") && t.addIssue({
289
+ code: "custom",
290
+ message: "Visible combo data labels require at least one bar series.",
291
+ path: ["presentation", "dataLabels"]
292
+ }), new Set(n.filter((e) => e.seriesType === "bar" && e.axis).map((e) => e.axis)).size > 1 && n.forEach((e, n) => {
293
+ e.seriesType === "bar" && e.axis && t.addIssue({
294
+ code: "custom",
295
+ message: "Combo bar series share one measure axis, so every bar measure must name the same axis.",
296
+ path: [
297
+ "data",
298
+ "measures",
299
+ n,
300
+ "axis"
301
+ ]
302
+ });
303
+ });
304
+ }
305
+ }), vt = P("dot", {
306
+ conditionalColoring: { rules: !0 },
307
+ axes: !0,
308
+ dimensions: {
309
+ min: 2,
310
+ max: 2
311
+ },
312
+ legend: !0,
313
+ measures: {
314
+ min: 1,
315
+ max: 1
316
+ },
317
+ orientation: !0,
318
+ rangedMeasureAxes: ["primaryMeasure"]
319
+ }), yt = P("scatter", {
320
+ conditionalColoring: { rules: !0 },
321
+ axes: !0,
322
+ dimensions: {
323
+ min: 1,
324
+ max: 2
325
+ },
326
+ legend: !0,
327
+ measures: {
328
+ min: 2,
329
+ max: 3
330
+ },
331
+ queryLimit: !0,
332
+ rangedMeasureAxes: ["primaryMeasure", "secondaryMeasure"],
333
+ sorting: !0
334
+ }), bt = P("histogram", {
335
+ axes: !0,
336
+ dimensions: {
337
+ min: 1,
338
+ max: 1
339
+ },
340
+ legend: !0,
341
+ measureAxisBands: !0,
342
+ measures: {
343
+ min: 0,
344
+ max: 0
345
+ },
346
+ orientation: !0,
347
+ rangedMeasureAxes: ["primaryMeasure"]
348
+ }), xt = P("heatMap", {
349
+ conditionalColoring: { rules: !0 },
350
+ axes: !0,
351
+ dimensions: {
352
+ min: 2,
353
+ max: 2
354
+ },
355
+ legend: !0,
356
+ measures: {
357
+ min: 1,
358
+ max: 2
359
+ },
360
+ queryLimit: !0,
361
+ secondaryDimensionAxis: !0,
362
+ sorting: !0
363
+ }), St = P("radar", {
364
+ conditionalColoring: {
365
+ minDimensions: 2,
366
+ rules: !1
367
+ },
368
+ dimensions: {
369
+ min: 0,
370
+ max: 2
371
+ },
372
+ legend: !0,
373
+ measures: {
374
+ min: 1,
375
+ max: 5
376
+ },
377
+ validateCounts: (e, t) => {
378
+ if (e === 0 && t < 2) return "Radar charts without dimensions require at least two measures.";
379
+ if (e > 0 && t > 1) return "Radar charts with dimensions support exactly one measure.";
380
+ }
381
+ }), Ct = P("gauge", {
382
+ conditionalColoring: { rules: !0 },
383
+ dimensions: {
384
+ min: 0,
385
+ max: 1
386
+ },
387
+ gaugeDisplayMode: !0,
388
+ legend: !0,
389
+ measures: {
390
+ min: 1,
391
+ max: 20
392
+ },
393
+ validateCounts: (e, t) => e === 1 && t > 2 ? "Gauge charts with a dimension support at most two measures." : void 0
394
+ }), wt = P("distribution-gauge", {
395
+ conditionalColoring: { rules: !0 },
396
+ dimensions: {
397
+ min: 0,
398
+ max: 1
399
+ },
400
+ gaugeDisplayMode: !0,
401
+ legend: !0,
402
+ measures: {
403
+ min: 1,
404
+ max: 20
405
+ }
406
+ }), Tt = P("pie", {
407
+ conditionalColoring: { rules: !0 },
408
+ dimensions: {
409
+ min: 1,
410
+ max: 1
411
+ },
412
+ legend: !0,
413
+ measures: {
414
+ min: 1,
415
+ max: 2
416
+ },
417
+ queryLimit: !0,
418
+ sorting: !0
419
+ }), Et = P("tree", {
420
+ dimensions: {
421
+ min: 0,
422
+ max: 10
423
+ },
424
+ measures: {
425
+ min: 0,
426
+ max: 100
427
+ },
428
+ queryLimit: !0,
429
+ sorting: !0,
430
+ treeLayout: !0,
431
+ 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
432
+ }), Dt = P("treemap", {
433
+ conditionalColoring: { rules: !0 },
434
+ dimensions: {
435
+ min: 1,
436
+ max: 10
437
+ },
438
+ legend: !0,
439
+ measures: {
440
+ min: 1,
441
+ max: 1
442
+ }
443
+ }), Ot = P("sankey", {
444
+ conditionalColoring: {
445
+ requiresOverwriteDimension: !0,
446
+ rules: !0
447
+ },
448
+ dimensions: {
449
+ min: 2,
450
+ max: 15
451
+ },
452
+ measures: {
453
+ min: 1,
454
+ max: 1
455
+ }
456
+ }), kt = P("waterfall", {
457
+ axes: !0,
458
+ dataLabels: !0,
459
+ dimensions: {
460
+ min: 0,
461
+ max: 0
462
+ },
463
+ measureAxisBands: !0,
464
+ measures: {
465
+ min: 1,
466
+ max: 100
467
+ },
468
+ orientation: !0,
469
+ rangedMeasureAxes: ["primaryMeasure"]
470
+ }), At = P("word-cloud", {
471
+ conditionalColoring: { rules: !0 },
472
+ dimensions: {
473
+ min: 1,
474
+ max: 1
475
+ },
476
+ measures: {
477
+ min: 1,
478
+ max: 1
479
+ }
480
+ }), jt = b.enum(["dropdown", "listbox"]), Mt = b.object({
481
+ mode: jt.optional(),
482
+ quickSelect: b.boolean().optional(),
483
+ responsive: b.boolean().optional(),
484
+ searchable: b.boolean().optional(),
485
+ showProgressBar: b.boolean().optional()
486
+ }).strict(), Nt = b.object({
487
+ data: b.object({ field: D.omit({
488
+ format: !0,
489
+ showNullValues: !0,
490
+ temporalGrouping: !0
491
+ }) }).strict(),
492
+ presentation: Mt.optional(),
493
+ type: b.literal("filter"),
494
+ version: b.literal(1)
495
+ }).strict(), Pt = O.omit({ dataLabels: !0 }).extend({
496
+ axis: b.enum(["primary", "secondary"]).optional(),
497
+ dataPointShape: S(ee.shape.dataPointShape)
498
+ }), Ft = b.object({
499
+ density: ce.optional(),
500
+ visible: b.boolean()
501
+ }).strict(), It = dt.extend({
502
+ coloring: M({ rules: !1 }).optional(),
503
+ dataLabels: Ft.optional()
504
+ }), Lt = b.object({
505
+ data: b.object({
506
+ dimensions: b.array(D).min(1),
507
+ measures: b.array(Pt).min(1)
508
+ }).strict(),
509
+ filterGroup: k.optional(),
510
+ limiting: b.object({ queryLimit: b.number().int().positive().optional() }).strict().optional(),
511
+ presentation: It.optional(),
512
+ sorting: b.array(A).optional(),
513
+ type: b.literal("line"),
514
+ version: b.literal(1)
515
+ }).strict().superRefine((e, t) => {
516
+ e.presentation?.coloring && e.data.dimensions.length < 2 && t.addIssue({
517
+ code: "custom",
518
+ message: "Line value colors require at least two dimensions.",
519
+ path: ["presentation", "coloring"]
520
+ }), e.presentation?.dataLabels?.visible && e.data.measures.forEach((e, n) => {
521
+ e.dataPointShape || t.addIssue({
522
+ code: "custom",
523
+ message: "Visible line data labels require a data-point shape for every measure.",
524
+ path: [
525
+ "data",
526
+ "measures",
527
+ n,
528
+ "dataPointShape"
529
+ ]
530
+ });
531
+ });
532
+ }), Rt = D.pick({
533
+ fieldKey: !0,
534
+ ref: !0
535
+ }), zt = O.pick({
536
+ aggregation: !0,
537
+ fieldKey: !0,
538
+ ref: !0
539
+ }), Bt = zt.extend({ role: b.enum([
540
+ "geo",
541
+ "secondGeo",
542
+ "thirdGeo",
543
+ "fourthGeo",
544
+ "size",
545
+ "measure"
546
+ ]) }), F = b.enum([
547
+ "latLng",
548
+ "geoPoint",
549
+ "geoHash"
550
+ ]), I = b.object({
551
+ name: b.string().trim().min(1).optional(),
552
+ ref: C.describe("Reference unique among all layers and data items; resolvedRefs returns it as { kind: \"layer\", id }."),
553
+ visible: b.boolean().optional()
554
+ }), Vt = b.object({
555
+ dimensions: b.array(Rt).length(1),
556
+ measures: b.array(Bt).min(1),
557
+ supportingMeasures: b.array(zt).optional()
558
+ }).strict(), L = I.extend({
559
+ data: Vt,
560
+ filterGroup: k.optional()
561
+ }), Ht = Ce.partial().strict(), R = b.object({
562
+ color: h.optional(),
563
+ opacity: xe
564
+ }).strict(), Ut = I.extend({
565
+ type: b.literal("map"),
566
+ presentation: S(ge.pick({
567
+ mapType: !0,
568
+ opacity: !0,
569
+ apiKey: !0,
570
+ mapLanguage: !0,
571
+ politicalView: !0
572
+ }).extend({
573
+ layerType: b.enum([
574
+ "default",
575
+ "humanitarian",
576
+ "cycle"
577
+ ]),
578
+ layerStyle: b.enum([
579
+ "default",
580
+ "greyscale",
581
+ "black",
582
+ "dark"
583
+ ])
584
+ }).partial().strict()).optional()
585
+ }).strict(), Wt = I.extend({
586
+ type: b.literal("image"),
587
+ image: we.shape.image.strict(),
588
+ position: we.shape.position.strict(),
589
+ opacity: xe
590
+ }).strict(), Gt = L.extend({
591
+ type: b.literal("point"),
592
+ locationType: F,
593
+ presentation: S(R.extend({
594
+ shape: pe.shape.shape,
595
+ sizing: Ht.optional(),
596
+ labelsVisible: b.boolean().optional()
597
+ }).strict()).optional()
598
+ }).strict(), Kt = L.extend({
599
+ type: b.literal("shape"),
600
+ presentation: S(R.extend({
601
+ strokeEnabled: g.shape.strokeEnabled,
602
+ strokeColor: g.shape.strokeColor,
603
+ strokeWidth: g.shape.strokeWidth,
604
+ labelsVisible: b.boolean().optional()
605
+ }).strict()).optional()
606
+ }).strict(), qt = L.extend({
607
+ type: b.literal("heatMap"),
608
+ locationType: F,
609
+ presentation: S(b.object({
610
+ heat: ye.pick({
611
+ radius: !0,
612
+ maxZoom: !0,
613
+ blur: !0,
614
+ changeHeatWhenZooming: !0
615
+ }).partial().strict().optional(),
616
+ value: de.partial().strict().optional()
617
+ }).strict()).optional()
618
+ }).strict(), Jt = L.extend({
619
+ type: b.literal("pointConnection"),
620
+ data: Vt.extend({ dimensions: b.array(Rt).length(2) }).strict(),
621
+ locationType: F,
622
+ secondLocationType: F,
623
+ presentation: S(R.extend({
624
+ sizing: Ht.optional(),
625
+ useGeodesicLines: b.boolean().optional(),
626
+ lineStyle: _e.shape.lineStyle.optional(),
627
+ arrow: Ee.partial().strict().optional()
628
+ }).strict()).optional()
629
+ }).strict(), Yt = b.discriminatedUnion("type", [
630
+ Ut,
631
+ Wt,
632
+ Gt,
633
+ Kt,
634
+ qt,
635
+ Jt
636
+ ]), Xt = b.object({
637
+ type: b.literal("map"),
638
+ version: b.literal(1),
639
+ layers: b.array(Yt).min(1).describe("Layers in stacking order, topmost first. Include a map layer explicitly when a basemap is wanted."),
640
+ view: S(ue.partial().strict()).optional()
641
+ }).strict(), Zt = b.object({
642
+ data: b.object({ measure: O.omit({ dataLabels: !0 }) }).strict(),
643
+ filterGroup: k.optional(),
644
+ type: b.literal("number"),
645
+ version: b.literal(1)
646
+ }).strict(), Qt = S(re.pick({
647
+ endDateLabel: !0,
648
+ pickerState: !0,
649
+ pickerType: !0,
650
+ quickSelect: !0,
651
+ responsive: !0,
652
+ startDateLabel: !0,
653
+ timePickerVisibility: !0,
654
+ weekStart: !0
655
+ }).partial()), $t = b.object({
656
+ data: b.object({ field: D.omit({
657
+ format: !0,
658
+ showNullValues: !0,
659
+ temporalGrouping: !0
660
+ }) }).strict(),
661
+ settings: Qt.optional(),
662
+ type: b.literal("date-picker"),
663
+ version: b.literal(1)
664
+ }).strict(), en = b.object({
665
+ settings: b.object({ url: b.string().url().nullable() }).strict(),
666
+ type: b.literal("iframe"),
667
+ version: b.literal(1)
668
+ }).strict(), tn = b.object({
669
+ settings: S(b.object({
670
+ blur: m.shape.blur.optional(),
671
+ fit: m.shape.image.unwrap().shape.imageFit.optional(),
672
+ opacity: m.shape.opacity.optional(),
673
+ saturation: m.shape.saturation.optional(),
674
+ shadow: m.shape.shadow.optional(),
675
+ source: Ae.optional()
676
+ }).strict()),
677
+ type: b.literal("image"),
678
+ version: b.literal(1)
679
+ }).strict(), nn = b.object({
680
+ settings: S(Te.pick({
681
+ backgroundColor: !0,
682
+ backgroundType: !0,
683
+ borderEnabled: !0,
684
+ borderRadius: !0,
685
+ heightBasedSize: !0,
686
+ imageFit: !0,
687
+ imageURL: !0,
688
+ lineThickness: !0,
689
+ preserveAspectRatio: !0,
690
+ rotate: !0,
691
+ scale: !0,
692
+ shape: !0,
693
+ strokeColor: !0
694
+ }).partial().strict()),
695
+ type: b.literal("shape"),
696
+ version: b.literal(1)
697
+ }).strict(), z = be.shape.simpleTextObjectSettings, rn = b.object({
698
+ settings: S(b.object({
699
+ align: z.shape.align.optional(),
700
+ content: b.string().optional(),
701
+ fontFamily: z.shape.fontFamily.optional(),
702
+ fontSize: z.shape.fontSize.optional(),
703
+ position: z.shape.position.optional(),
704
+ representation: z.shape.representation.optional(),
705
+ responsive: z.shape.responsive.optional(),
706
+ textColor: z.shape.textColor.optional(),
707
+ wordWrap: z.shape.wordWrap.optional()
708
+ }).strict()),
709
+ type: b.literal("simpleTextObject"),
710
+ version: b.literal(1)
711
+ }).strict(), an = b.object({
712
+ settings: S(b.object({
713
+ customLabel: f.shape.commonSettings.shape.customLabel.optional(),
714
+ hideLabel: f.shape.commonSettings.shape.hideLabel.optional(),
715
+ inputType: f.shape.type.optional(),
716
+ placeholder: f.shape.commonSettings.shape.placeholder.optional(),
717
+ responsive: f.shape.commonSettings.shape.responsive.optional(),
718
+ variableId: f.shape.commonSettings.shape.variableId.optional()
719
+ }).strict()),
720
+ type: b.literal("atomic-input"),
721
+ version: b.literal(1)
722
+ }).strict(), on = b.object({
723
+ data: b.object({ field: D.omit({
724
+ format: !0,
725
+ showNullValues: !0,
726
+ temporalGrouping: !0
727
+ }) }).strict(),
728
+ settings: S(me.pick({
729
+ layout: !0,
730
+ quickSelect: !0,
731
+ range: !0,
732
+ step: !0
733
+ }).partial()).optional(),
734
+ type: b.literal("slider"),
735
+ version: b.literal(1)
736
+ }).strict(), sn = D.extend({ role: b.literal("dimension") }), B = O.omit({ dataLabels: !0 }), cn = B.extend({ role: b.literal("measure") }), ln = b.object({
737
+ columns: b.array(b.discriminatedUnion("role", [sn, cn])).min(1),
738
+ structure: b.literal("normal").optional()
739
+ }).strict(), un = b.object({
740
+ dimensions: b.array(D).min(1),
741
+ measures: b.array(B).min(1),
742
+ structure: b.literal("expandable")
743
+ }).strict(), dn = b.object({
744
+ columnDimensions: b.array(D).min(1),
745
+ measures: b.array(B).min(1),
746
+ rowDimensions: b.array(D).min(1),
747
+ structure: b.literal("pivot")
748
+ }).strict(), fn = b.union([
749
+ ln,
750
+ un,
751
+ dn
752
+ ]), pn = b.object({
753
+ applyTo: p.shape.applyTo,
754
+ enabled: p.shape.enabled,
755
+ showRecordsCount: p.shape.showRecordsCount,
756
+ style: b.object({
757
+ backgroundColor: _.shape.backgroundColor.optional(),
758
+ fontColor: _.shape.fontColor.optional(),
759
+ fontStyle: v.optional(),
760
+ position: _.shape.position.optional(),
761
+ responsiveHeight: _.shape.responsive
762
+ }).strict().optional()
763
+ }).strict(), mn = b.object({
764
+ background: b.object({
765
+ color: h.optional(),
766
+ evenColor: h.optional(),
767
+ oddColor: h.optional(),
768
+ type: b.enum([
769
+ "none",
770
+ "single",
771
+ "zebra"
772
+ ])
773
+ }).strict().optional(),
774
+ body: b.object({
775
+ fontColor: h.optional(),
776
+ fontFamily: b.string().trim().min(1).optional(),
777
+ fontSize: b.number().positive().optional(),
778
+ fontStyle: v.optional(),
779
+ horizontalAlign: b.enum([
780
+ "auto",
781
+ "center",
782
+ "left",
783
+ "right"
784
+ ]).optional(),
785
+ verticalAlign: b.enum([
786
+ "auto",
787
+ "bottom",
788
+ "middle",
789
+ "top"
790
+ ]).optional()
791
+ }).strict().optional(),
792
+ borders: b.object({
793
+ color: h.optional(),
794
+ dividerColor: h.optional(),
795
+ dividers: b.enum([
796
+ "all",
797
+ "auto",
798
+ "horizontal",
799
+ "none",
800
+ "vertical"
801
+ ]).optional(),
802
+ enabled: b.boolean(),
803
+ lineStyle: b.enum([
804
+ "dashed",
805
+ "dotted",
806
+ "line"
807
+ ]).optional(),
808
+ radius: b.number().nonnegative().optional(),
809
+ strokeWidth: b.number().nonnegative().optional()
810
+ }).strict().optional(),
811
+ header: b.object({
812
+ backgroundColor: h.optional(),
813
+ borderColor: h.optional(),
814
+ fontColor: h.optional(),
815
+ fontFamily: b.string().trim().min(1).optional(),
816
+ fontSize: b.number().positive().optional(),
817
+ fontStyle: v.optional(),
818
+ responsiveHeight: b.boolean().optional()
819
+ }).strict().optional(),
820
+ highlight: b.object({
821
+ backgroundColor: h.optional(),
822
+ mode: b.enum([
823
+ "column",
824
+ "none",
825
+ "row",
826
+ "row-and-column"
827
+ ]),
828
+ textColor: h.optional()
829
+ }).strict().optional(),
830
+ layout: b.object({
831
+ columnWidthBehavior: b.enum(["responsive", "static"]).optional(),
832
+ rowHeight: b.number().positive().optional()
833
+ }).strict().optional()
834
+ }).strict(), hn = b.object({
835
+ data: fn,
836
+ filterGroup: k.optional(),
837
+ limiting: b.object({ queryLimit: b.number().int().positive().optional() }).strict().optional(),
838
+ presentation: mn.optional(),
839
+ sorting: b.array(A).optional(),
840
+ totals: pn.optional(),
841
+ type: b.literal("table"),
842
+ version: b.literal(1)
843
+ }).strict(), V = (e) => typeof e == "object" && !!e && !Array.isArray(e), gn = (e) => {
844
+ let t = e.fieldKey ?? e.key;
845
+ return typeof t == "string" ? t : void 0;
846
+ }, _n = (e) => {
847
+ if (Array.isArray(e)) return e;
848
+ if (!V(e)) throw Error("Available field metadata must be an array or an object.");
849
+ return [
850
+ "fields",
851
+ "dimensions",
852
+ "measures"
853
+ ].flatMap((t) => {
854
+ let n = e[t];
855
+ if (n === void 0) return [];
856
+ if (!Array.isArray(n)) throw Error(`Available field metadata "${t}" must be an array.`);
857
+ return n;
858
+ });
859
+ }, vn = (e, t) => {
860
+ let n = e.type;
861
+ if (!(n === "dimension" && V(e.dimension) || n === "measure" && V(e.measure) || n === "calculation" && V(e.calculation))) return;
862
+ let r = E.safeParse({
863
+ fieldKey: e.key,
864
+ item: e,
865
+ kind: n,
866
+ name: e.name
867
+ });
868
+ if (!r.success) throw Error(`Invalid available semantic item at index ${t}: ${r.error.message}`);
869
+ return r.data;
870
+ }, yn = (e, t) => {
871
+ if (!V(e)) throw Error(`Available field at index ${t} must be an object.`);
872
+ let n = E.safeParse(e);
873
+ if (n.success) return n.data;
874
+ let r = vn(e, t);
875
+ if (r) return r;
876
+ let i = Array.isArray(e.aggregations) ? e.aggregations : Array.isArray(e.aggregators) ? e.aggregators : [], a = E.safeParse({
877
+ aggregations: i.map((e) => V(e) ? {
878
+ distinct: e.distinct,
879
+ name: e.name ?? e.funcName,
880
+ resultType: e.resultType
881
+ } : e),
882
+ dataType: e.dataType,
883
+ fieldKey: gn(e),
884
+ isManualData: e.isManualData,
885
+ kind: "field",
886
+ name: e.name,
887
+ view: e.view
888
+ });
889
+ if (!a.success) throw Error(`Invalid available field at index ${t}: ${a.error.message}`);
890
+ return a.data;
891
+ }, bn = (e) => {
892
+ let t = _n(e).map(yn), n = /* @__PURE__ */ new Map();
893
+ return t.forEach((e, t) => {
894
+ let r = n.get(e.fieldKey);
895
+ if (r !== void 0) throw Error(`Duplicate available field key "${e.fieldKey}" at indexes ${r} and ${t}.`);
896
+ n.set(e.fieldKey, t);
897
+ }), t;
898
+ }, xn = (e) => e.kind === "field" ? [...new Set(e.aggregations.flatMap((e) => [e.name, ...e.distinct ? [`${e.name}_DISTINCT`] : []]))] : [], Sn = (e, t) => e.kind === "field" || t === "dimension" && e.kind === "dimension" || t === "measure" && (e.kind === "measure" || e.kind === "calculation"), Cn = (e) => {
899
+ if (e.kind !== "dimension") return e.kind;
900
+ }, wn = (e) => ({
901
+ ...l(e.item),
902
+ id: e.item.id ?? e.fieldKey
903
+ }), Tn = (e) => e.map((e) => e.kind === "dimension" ? r(wn(e)) : e.kind === "measure" || e.kind === "calculation" ? u(wn(e)) : {
904
+ aggregators: a(e.aggregations.map((e) => ({
905
+ distinct: e.distinct ?? !1,
906
+ name: e.name,
907
+ resultType: e.resultType
908
+ }))),
909
+ dataType: e.dataType,
910
+ isManualData: e.isManualData,
911
+ key: e.fieldKey,
912
+ name: e.name,
913
+ view: e.view,
914
+ views: [e.view]
915
+ }), En = (e, t) => {
916
+ let n = Math.min(e.length, t.length), r = 0;
917
+ for (; r < n && e[r].toLocaleLowerCase() === t[r].toLocaleLowerCase();) r += 1;
918
+ return r;
919
+ }, Dn = (e, t) => [...t].sort((t, n) => En(e, n.fieldKey) - En(e, t.fieldKey) || t.fieldKey.localeCompare(n.fieldKey)).slice(0, 5).map((e) => e.fieldKey), On = [
920
+ x.FieldType.DATE,
921
+ x.FieldType.TIME,
922
+ x.FieldType.TIMESTAMP,
923
+ x.FieldType.TIMESTAMP_TZ
924
+ ], H = (e, t, n, r) => ({
925
+ ...r ? { allowedValues: r } : {},
926
+ code: e,
927
+ message: n,
928
+ path: t
929
+ }), kn = (t) => xn(t).filter((t) => !!e(t)), An = (e, t) => {
930
+ let n = t.find((t) => t.fieldKey === e.fieldKey);
931
+ return n?.kind === "field" ? kn(n).find((t) => t.toLocaleUpperCase() === e.aggregation?.toLocaleUpperCase()) : void 0;
932
+ }, jn = (e, t) => {
933
+ let n = t.find((t) => t.fieldKey === e.fieldKey);
934
+ return n?.kind === "measure" ? n.item.measure.aggregation : An(e, t);
935
+ }, Mn = (e, t, n = {}) => {
936
+ let r = t.find((t) => t.fieldKey === e.fieldKey), i = r ? Cn(r) : void 0, a = An(e, t);
937
+ return {
938
+ ...n,
939
+ key: e.fieldKey,
940
+ ...i ? { sourceKind: i } : {},
941
+ ...a ? { aggregation: a } : {}
942
+ };
943
+ }, U = (e, t, n, r) => {
944
+ let i = t.find((t) => t.fieldKey === e.fieldKey);
945
+ if (!i) return [H("unknown_field_key", [...n, "fieldKey"], `Field key "${e.fieldKey}" is not available.`, Dn(e.fieldKey, t))];
946
+ if (!Sn(i, r)) return [H("invalid_field_role", [...n, "fieldKey"], `Available item "${e.fieldKey}" of kind "${i.kind}" cannot be used as a ${r}.`)];
947
+ if (r !== "measure") return e.temporalGrouping ? Pn(e, t, n, On, "a temporally grouped dimension") : [];
948
+ if (i.kind !== "field") return e.aggregation === void 0 ? [] : [H("invalid_aggregation", [...n, "aggregation"], `Aggregation must be omitted for semantic ${i.kind} "${e.fieldKey}".`)];
949
+ let a = kn(i);
950
+ 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)];
951
+ }, Nn = (e, t, n, r) => e.flatMap((e, i) => U(e, t, [...n, i], r)), Pn = (e, t, n, r, i) => {
952
+ let a = t.find((t) => t.fieldKey === e.fieldKey);
953
+ 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])];
954
+ }, Fn = (e, t, n = ["filterGroup"]) => e ? e.filters.flatMap((e, r) => {
955
+ let i = [
956
+ ...n,
957
+ "filters",
958
+ r
959
+ ];
960
+ return "filters" in e ? Fn(e, t, i) : U({
961
+ fieldKey: e.fieldKey,
962
+ ref: `filter:${r}`
963
+ }, t, i, "dimension");
964
+ }) : [], W = (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", G = (e) => {
965
+ if (typeof e == "number" && !Number.isFinite(e)) return String(e);
966
+ try {
967
+ return JSON.stringify(e) ?? String(e);
968
+ } catch {
969
+ return String(e);
970
+ }
971
+ }, K = (e, t) => t.reduce((e, t) => typeof e == "object" && e && Object.prototype.hasOwnProperty.call(e, t) ? e[t] : void 0, e), In = (e) => {
972
+ if (e.code === "invalid_value") return e.values;
973
+ if (e.code !== "invalid_union" || e.errors.length === 0) return;
974
+ let t = e.errors.map((e) => e.length === 1 && e[0].path.length === 0 ? In(e[0]) : void 0);
975
+ return t.every((e) => e !== void 0) ? [...new Set(t.flat())] : void 0;
976
+ }, Ln = (e) => e.filter((e) => typeof e != "symbol"), Rn = (e, t, n = []) => {
977
+ let r = (e, n) => e.code === "invalid_union" && e.path.length === 0 ? e.errors.length > 0 && e.errors.every((e) => e.some((e) => r(e, n))) : e.code === "invalid_value" && e.path.length === 1 && K(t, [...n, ...Ln(e.path)]) !== void 0, i = (e, a) => {
978
+ let o = [...a, ...Ln(e.path)];
979
+ if (e.code === "unrecognized_keys") return e.keys.map((r) => {
980
+ let i = [
981
+ ...n,
982
+ ...o,
983
+ r
984
+ ];
985
+ return {
986
+ code: "invalid_structure",
987
+ path: i,
988
+ message: `${W(i)}: Unrecognized key.`,
989
+ details: {
990
+ received: K(t, [...o, r]),
991
+ zodCode: e.code
992
+ }
993
+ };
994
+ });
995
+ let s = [...n, ...o], c = K(t, o), l = In(e), u = {
996
+ received: c,
997
+ zodCode: e.code
998
+ }, d = l ? `Unsupported value ${G(c)}. Allowed values: ${l.map(G).join(", ")}.` : `${e.message}. Received: ${G(c)}.`;
999
+ if (e.code === "invalid_union" && !l && e.errors.length > 0) {
1000
+ let t = e.errors, n = t.filter((e) => !e.some((e) => r(e, o))), a = n.length > 0 ? n : t, s = a.length === 1 ? a : a.filter((e) => !e.some((e) => e.code === "unrecognized_keys"));
1001
+ if (s.length === 1) return s[0].flatMap((e) => i(e, o));
1002
+ let c = e.errors.map((e) => e.flatMap((e) => i(e, o)));
1003
+ u.alternatives = c, d = `Value does not match any allowed shape. ${c.map((e, t) => `Alternative ${t + 1}: ${e.map((e) => e.message).join(" ")}`).join(" ")}`;
1004
+ }
1005
+ return [{
1006
+ code: "invalid_structure",
1007
+ path: s,
1008
+ message: `${W(s)}: ${d}`,
1009
+ details: u,
1010
+ ...l ? { allowedValues: l } : {}
1011
+ }];
1012
+ };
1013
+ return e.issues.flatMap((e) => i(e, []));
1014
+ };
1015
+ s();
1016
+ var zn = (e, n) => {
1017
+ let r = "legend" in e && !!e.legend, i = n.position !== void 0 || n.title !== void 0, a = [];
1018
+ return n.visible !== void 0 && (n.visible || i || r) ? a.push({
1019
+ name: "setLegendEnabled",
1020
+ payload: n.visible
1021
+ }) : n.visible === void 0 && i && !r && a.push({
1022
+ name: "setLegendEnabled",
1023
+ payload: !0
1024
+ }), n.position === void 0 ? (n.visible === !0 || i && !r) && a.push({
1025
+ name: "setLegendPosition",
1026
+ payload: t.Right
1027
+ }) : a.push({
1028
+ name: "setLegendPosition",
1029
+ payload: n.position
1030
+ }), n.title !== void 0 && a.push({
1031
+ name: "setLegendTitle",
1032
+ payload: n.title
1033
+ }), a;
1034
+ }, q = (e, t, n, r = {}) => ({
1035
+ code: e,
1036
+ message: n,
1037
+ path: t,
1038
+ ...r
1039
+ }), Bn = (e, t, n, r, i, a) => ({
1040
+ name: e,
1041
+ payload: {
1042
+ ...J(t),
1043
+ [i]: a
1044
+ },
1045
+ definitionContext: {
1046
+ path: [
1047
+ ...r,
1048
+ "format",
1049
+ i
1050
+ ],
1051
+ received: a,
1052
+ ref: n,
1053
+ kind: t.kind
1054
+ }
1055
+ }), Vn = (e, t, n, r, i, a, o) => ({
1056
+ name: e,
1057
+ payload: {
1058
+ name: t,
1059
+ [i]: a
1060
+ },
1061
+ definitionContext: {
1062
+ path: [
1063
+ ...r,
1064
+ "format",
1065
+ i
1066
+ ],
1067
+ received: a,
1068
+ ref: n,
1069
+ kind: o
1070
+ }
1071
+ }), J = (e) => ({
1072
+ dataItemInternalKey: e.dataItemInternalKey,
1073
+ dataItemUniqueSignature: e.dataItemUniqueSignature
1074
+ }), Hn = (e) => {
1075
+ let t = [], n = /* @__PURE__ */ new Set();
1076
+ return e.forEach(({ items: e, path: r }) => {
1077
+ e.forEach((e, i) => {
1078
+ n.has(e.ref) && t.push(q("duplicate_alias", [
1079
+ ...r,
1080
+ i,
1081
+ "ref"
1082
+ ], `Reference "${e.ref}" is duplicated.`)), n.add(e.ref);
1083
+ });
1084
+ }), t;
1085
+ }, Un = (e, t) => {
1086
+ let n = e, r = n.referencedData;
1087
+ return t.every((e) => !Array.isArray(n[e]) || n[e].length === 0) && (typeof r != "object" || !r || Object.keys(r).length === 0);
1088
+ }, Wn = (e, t) => ({
1089
+ availableFields: Tn(e.availableFields),
1090
+ input: e,
1091
+ resolvedRefs: {},
1092
+ vSpec: t
1093
+ }), Y = (e, t, n, r, i) => ({
1094
+ name: e,
1095
+ payload: {
1096
+ ...J(t),
1097
+ ...i
1098
+ },
1099
+ definitionContext: {
1100
+ path: [...r, "temporalGrouping"],
1101
+ received: i,
1102
+ ref: n,
1103
+ kind: t.kind
1104
+ }
1105
+ }), Gn = (e) => "value" in e ? { value: e.value } : "values" in e ? {
1106
+ secondValue: e.values.join(","),
1107
+ value: ","
1108
+ } : "valueFrom" in e ? {
1109
+ valueFrom: e.valueFrom,
1110
+ valueTo: e.valueTo
1111
+ } : {}, X = (e) => ({
1112
+ filters: e.filters.map((e) => "filters" in e ? X(e) : {
1113
+ fieldKey: e.fieldKey,
1114
+ operator: e.operator,
1115
+ values: Gn(e)
1116
+ }),
1117
+ operator: e.operator
1118
+ }), Kn = (e, t) => (e ?? []).flatMap((e, n) => t.includes(e.by) ? [] : [q("unknown_alias", [
1119
+ "sorting",
1120
+ n,
1121
+ "by"
1122
+ ], `Reference "${e.by}" does not exist.`, { allowedValues: t })]), Z = ["presentation", "coloring"], qn = (e, t, n) => [...(e?.overwrites ?? []).flatMap(({ dimension: e }, n) => e === void 0 || t.includes(e) ? [] : [q("unknown_alias", [
1123
+ ...Z,
1124
+ "overwrites",
1125
+ n,
1126
+ "dimension"
1127
+ ], `Dimension reference "${e}" does not exist.`, { allowedValues: t })]), ...(e?.rules ?? []).flatMap(({ measure: e }, t) => n.includes(e) ? [] : [q("unknown_alias", [
1128
+ ...Z,
1129
+ "rules",
1130
+ t,
1131
+ "measure"
1132
+ ], `Measure reference "${e}" does not exist.`, { allowedValues: n })])], Jn = (e, t) => {
1133
+ let n = t.safeParse(e.vSpec);
1134
+ return n.success ? {
1135
+ resolvedRefs: e.resolvedRefs,
1136
+ success: !0,
1137
+ vSpec: n.data
1138
+ } : {
1139
+ issues: [q("invalid_compiled_vspec", [], "Compiled vSpec failed final validation.", { details: { issues: n.error.issues } })],
1140
+ success: !1
1141
+ };
1142
+ }, Q = (e) => "startsAtZero" in e ? {} : e, Yn = (e) => {
1143
+ let { max: t, min: n } = Q(e);
1144
+ return n !== void 0 && t !== void 0 ? c.MinMax : n === void 0 ? t === void 0 ? c.Auto : c.Max : c.Min;
1145
+ }, Xn = (e) => {
1146
+ for (let [t, n] of Object.entries(e ?? {})) {
1147
+ let { max: e, min: r } = n?.range ? Q(n.range) : {};
1148
+ if (r !== void 0 && e !== void 0 && r >= e) return q("invalid_structure", [
1149
+ "presentation",
1150
+ "axes",
1151
+ t,
1152
+ "range",
1153
+ "min"
1154
+ ], `Axis range min (${r}) must be less than max (${e}).`);
1155
+ }
1156
+ }, Zn = (e, t) => {
1157
+ let n = [];
1158
+ t.inverted !== void 0 && n.push({
1159
+ name: y.SET_INVERT_AXIS,
1160
+ payload: {
1161
+ axisName: e,
1162
+ invertAxis: t.inverted
1163
+ }
1164
+ });
1165
+ let { range: r } = t;
1166
+ if (r) {
1167
+ n.push({
1168
+ name: y.SET_AXIS_RANGE_OPTION,
1169
+ payload: {
1170
+ axisName: e,
1171
+ axisRangeOption: Yn(r)
1172
+ }
1173
+ });
1174
+ let { max: t, min: i } = Q(r);
1175
+ i !== void 0 && n.push({
1176
+ name: y.SET_AXIS_RANGE_MIN,
1177
+ payload: {
1178
+ axisName: e,
1179
+ minValue: i
1180
+ }
1181
+ }), t !== void 0 && n.push({
1182
+ name: y.SET_AXIS_RANGE_MAX,
1183
+ payload: {
1184
+ axisName: e,
1185
+ maxValue: t
1186
+ }
1187
+ }), "startsAtZero" in r && n.push({
1188
+ name: y.SET_AXIS_STARTS_AT_ZERO,
1189
+ payload: {
1190
+ axisName: e,
1191
+ startsAtZero: r.startsAtZero
1192
+ }
1193
+ });
1194
+ }
1195
+ return n;
1196
+ }, Qn = (e) => {
1197
+ let t = Object.entries(e).find(([, e]) => e.success === !1);
1198
+ return t ? {
1199
+ id: t[0],
1200
+ result: t[1]
1201
+ } : void 0;
1202
+ }, $ = async (e, t, n) => {
1203
+ let r = t.map((e, t) => ({
1204
+ ...e,
1205
+ id: e.id ?? `definition:${t}`
1206
+ })), i = await je(e.vSpec, e.availableFields, r.map(({ id: e, name: t, payload: n }) => ({
1207
+ id: e,
1208
+ name: t,
1209
+ payload: n
1210
+ })), e.input.variables ?? [], [], e.input.theme), a = Qn(i.results);
1211
+ if (!a) return {
1212
+ state: {
1213
+ ...e,
1214
+ vSpec: i.vSpec
1215
+ },
1216
+ success: !0
1217
+ };
1218
+ 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 ${G(s.received)} to ${s.kind} ${G(s.ref)}` : "Operation failed";
1219
+ return {
1220
+ issue: q("operation_failed", c, `${W(c)}: ${d} (operation "${l}"): ${u}`, { details: {
1221
+ error: a.result.error,
1222
+ operationId: a.id,
1223
+ operationName: l,
1224
+ ...s ? {
1225
+ received: s.received,
1226
+ ref: s.ref,
1227
+ role: s.kind
1228
+ } : {}
1229
+ } }),
1230
+ success: !1
1231
+ };
1232
+ }, $n = (e, t) => {
1233
+ if (!e || typeof e.data != "object" || e.data === null || !("dataItem" in e.data)) return;
1234
+ let n = e.data.dataItem;
1235
+ if (!(typeof n != "object" || !n || !("internalKey" in n) || typeof n.internalKey != "string" || !("uniqueSignature" in n) || typeof n.uniqueSignature != "string")) return {
1236
+ dataItemInternalKey: n.internalKey,
1237
+ dataItemUniqueSignature: n.uniqueSignature,
1238
+ kind: t
1239
+ };
1240
+ }, er = async (e, t, n, r, i, a) => {
1241
+ let o = `${n}:${t.ref}`, s = await je(e.vSpec, e.availableFields, [{
1242
+ id: o,
1243
+ name: r,
1244
+ payload: i
1245
+ }], e.input.variables ?? [], [], e.input.theme), c = Qn(s.results), l = $n(s.results[o], n);
1246
+ return c || !l ? {
1247
+ issue: q("operation_failed", a, c?.result.error ?? `${n} operation did not return the created data-item identity.`),
1248
+ success: !1
1249
+ } : {
1250
+ state: {
1251
+ ...e,
1252
+ resolvedRefs: {
1253
+ ...e.resolvedRefs,
1254
+ [t.ref]: l
1255
+ },
1256
+ vSpec: s.vSpec
1257
+ },
1258
+ success: !0
1259
+ };
1260
+ }, tr = (e, t, n, r) => {
1261
+ let i = [
1262
+ "formatType",
1263
+ "formatString",
1264
+ "currency",
1265
+ "currencyIsPrefix",
1266
+ "negativeType"
1267
+ ];
1268
+ return $(e, t.flatMap((t, a) => {
1269
+ let o = e.resolvedRefs[t.ref];
1270
+ return i.flatMap((e) => {
1271
+ let i = t.format?.[e], s = n[e];
1272
+ return i !== void 0 && s ? [Bn(s, o, t.ref, t.path ?? [...r, a], e, i)] : [];
1273
+ });
1274
+ }), r);
1275
+ }, nr = (e, t, n, r) => $(e, t.flatMap((t, i) => t.temporalGrouping ? [Y(n, e.resolvedRefs[t.ref], t.ref, t.path ?? [...r, i], t.temporalGrouping)] : []), r), rr = (e, t, n, r) => $(e, t.flatMap((t) => t.showNullValues === void 0 ? [] : [{
1276
+ name: n,
1277
+ payload: {
1278
+ ...J(e.resolvedRefs[t.ref]),
1279
+ changes: { showNullValues: t.showNullValues }
1280
+ }
1281
+ }]), r), ir = (e, t) => t ? $(e, [{
1282
+ id: "filterGroup",
1283
+ name: "setStaticFilterGroup",
1284
+ payload: X(t)
1285
+ }], ["filterGroup"]) : Promise.resolve({
1286
+ state: e,
1287
+ success: !0
1288
+ }), ar = (e, t, n, r) => {
1289
+ if (!t?.length) return Promise.resolve({
1290
+ state: e,
1291
+ success: !0
1292
+ });
1293
+ 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}`));
1294
+ return $(e, [{
1295
+ name: n,
1296
+ payload: { changeRequests: [...s, ...i.filter((e) => !c.has(`${e.dataItem.internalKey}:${e.dataItem.uniqueSignature}`)).map((e) => ({
1297
+ dataItemInternalKey: e.dataItem.internalKey,
1298
+ dataItemUniqueSignature: e.dataItem.uniqueSignature,
1299
+ kind: "dimension"
1300
+ }))].map((e, t) => {
1301
+ let n = `${e.dataItemInternalKey}:${e.dataItemUniqueSignature}`, r = o.get(n), s = i.find((e) => `${e.dataItem.internalKey}:${e.dataItem.uniqueSignature}` === n);
1302
+ return {
1303
+ ...J(e),
1304
+ newIndex: t,
1305
+ sortDirection: (r ? a.get(r)?.direction : void 0) ?? s?.sortDirection ?? "asc"
1306
+ };
1307
+ }) }
1308
+ }, ...t.map((t) => ({
1309
+ name: r,
1310
+ payload: {
1311
+ ...J(e.resolvedRefs[t.by]),
1312
+ enabled: t.enabled ?? !0
1313
+ }
1314
+ }))], ["sorting"]);
1315
+ }, or = (e, t) => {
1316
+ let n = [];
1317
+ return t?.overwrites && n.push({
1318
+ name: ke.SET_COLORING_OVERWRITES,
1319
+ payload: { overwrites: t.overwrites.map(({ dimension: t, ...n }) => t === void 0 ? n : {
1320
+ ...n,
1321
+ dimension: J(e.resolvedRefs[t])
1322
+ }) }
1323
+ }), t?.rules && n.push({
1324
+ name: ke.SET_COLORING_RULES,
1325
+ payload: { rules: t.rules.map(({ measure: t, ...n }) => ({
1326
+ ...n,
1327
+ measure: J(e.resolvedRefs[t])
1328
+ })) }
1329
+ }), $(e, n, Z);
1330
+ };
1331
+ export { St as $, Fn as A, on as B, Hn as C, jn as D, Mn as E, an as F, Nt as G, Zt as H, $t as I, vt as J, _t as K, en as L, bn as M, Tn as N, U as O, hn as P, Tt as Q, tn as R, qn as S, Rn as T, Xt as U, rn as V, Lt as W, xt as X, Ct as Y, bt as Z, Xn as _, tr as a, At as at, X as b, Zn as c, Ne as ct, q as d, Ot as et, zn as f, Jn as g, $ as h, ir as i, kt as it, Pn as j, Nn as k, Bn as l, Y as m, or as n, Et as nt, ar as o, mt as ot, Vn as p, wt as q, rr as r, Dt as rt, nr as s, E as st, er as t, yt as tt, Wn as u, Un as v, W as w, Kn as x, J as y, nn as z };