@astrato-io/visualizations 0.9.0 → 0.10.1

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 (144) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +7 -3
  3. package/THIRD_PARTY_NOTICES.md +163 -14
  4. package/VISUALIZATION_DEFINITIONS.md +376 -36
  5. package/chunks/{Button-5CxPEACP.js → Button-Dn3rJrYf.js} +4 -4
  6. package/chunks/{CircularProgress-DFS-LQb7.js → CircularProgress-BFeu06Yb.js} +39 -39
  7. package/chunks/FieldTypeIcon-DrMoGpHJ.js +22 -0
  8. package/chunks/{LinearProgress-CjIQfkNA.js → LinearProgress-ClO6GUjN.js} +9 -9
  9. package/chunks/{MenuOption-Cb7B7x6z.js → MenuOption-Czc34u4q.js} +143 -142
  10. package/chunks/{Title-CtFw1bVg.js → Title-BgYnaVTR.js} +22 -22
  11. package/chunks/_createAggregator-BMu9uRax.js +50 -0
  12. package/chunks/{app-filter-bar.compiler-B9775gLJ.js → app-filter-bar.compiler-CVir0wkl.js} +10 -10
  13. package/chunks/bar-layout-C_UgRlVl.js +9 -0
  14. package/chunks/{bar.compiler-B7wlH_Ro.js → bar.compiler-DYuFdi9J.js} +100 -82
  15. package/chunks/{builder-Dxo7D7c6.js → builder-C-TKA-My.js} +70 -37
  16. package/chunks/color-rules-DYJL4fIW.js +15 -0
  17. package/chunks/color-settings-DJFoFTip.js +5 -0
  18. package/chunks/{coloring-B-Wa8D5P.js → coloring-BtnPiQ_o.js} +37 -37
  19. package/chunks/createSimplePaletteValueFilter--zrZxRV9.js +2005 -0
  20. package/chunks/defaults-Dtk7fg3C.js +3 -0
  21. package/chunks/{definitions-DNpzD9tY.js → definitions-CT304NDn.js} +655 -417
  22. package/chunks/{escobar-C4Nm3eJ7.js → escobar-CvEV2ES1.js} +7441 -7127
  23. package/chunks/{extend-preset-BVKFtoe-.js → extend-preset-D9-JP92b.js} +998 -933
  24. package/chunks/{filter.compiler-BlS3zoy_.js → filter.compiler-CXeZznks.js} +7 -7
  25. package/chunks/{filtering-CGuLpg7u.js → filtering-8_bFv-jb.js} +333 -377
  26. package/chunks/handlers-C6CZ0XJA.js +15399 -0
  27. package/chunks/{icon-picker-styles-DYQgVEKG.js → icon-picker-styles-BXiJ1SZS.js} +11 -11
  28. package/chunks/isEqual-D8Ay63xR.js +16 -0
  29. package/chunks/{isFocusVisible-B1_z03UT.js → isFocusVisible-Bu8gGZu5.js} +1 -1
  30. package/chunks/label-format-type-C46pzgx7.js +17 -0
  31. package/chunks/{line.compiler-Bo9i9qag.js → line.compiler-DmHpmQCC.js} +9 -9
  32. package/chunks/{logger-3lng-wOw.js → logger-DdZpR7xZ.js} +79 -72
  33. package/chunks/map.compiler-Q_Y1Pvat.js +343 -0
  34. package/chunks/{metadata-Fmx1swpK.js → metadata-BQm_TXI1.js} +1 -1
  35. package/chunks/{number.compiler-CdLd5aGW.js → number.compiler-DQdg6zTy.js} +7 -7
  36. package/chunks/operations-DKQWuLL7.js +31315 -0
  37. package/chunks/{range-CzO4isKK.js → range-BdhzvYQ_.js} +2 -2
  38. package/chunks/{react-dom-BwZT0N3F.js → react-dom-BGP4tbXV.js} +70 -70
  39. package/chunks/{render-wrappers-CAuvgMxi.js → render-wrappers-BZpyDnJy.js} +1 -1
  40. package/chunks/{requirements-CYpVh65U.js → requirements-e8Fe96ag.js} +60 -58
  41. package/chunks/shared-C_2F90xq.js +1337 -0
  42. package/chunks/standalone-4MsKiqs0.js +355 -0
  43. package/chunks/standalone-B794g9pE.js +1012 -0
  44. package/chunks/{standalone-C6XDHYAM.js → standalone-B8ZSqauS.js} +110 -110
  45. package/chunks/{standalone-5DnapeHH.js → standalone-BA2YXyJS.js} +126 -124
  46. package/chunks/{standalone-CXniic5x.js → standalone-BDrXVxlP.js} +6 -5
  47. package/chunks/{standalone-B6s_xG2u.js → standalone-BE_ONgiG.js} +116 -116
  48. package/chunks/{standalone-CPUiiWNP.js → standalone-BTY3w_JA.js} +37 -37
  49. package/chunks/standalone-BgumbdaJ2.js +357 -0
  50. package/chunks/{standalone-DWPfdP0A.js → standalone-BkbiH-o8.js} +482 -482
  51. package/chunks/standalone-Blh4qejk.js +689 -0
  52. package/chunks/standalone-CXY4FpF7.js +773 -0
  53. package/chunks/{standalone-BvWdpUL3.js → standalone-CY_kjarf.js} +34 -31
  54. package/chunks/{standalone-DuwTOBXH.js → standalone-CaTxAydz.js} +587 -587
  55. package/chunks/{standalone-BDrQMxLi.js → standalone-Cc98Pdr6.js} +1799 -1015
  56. package/chunks/{standalone-DMCwtebn.js → standalone-Cl0TSfqC.js} +125 -125
  57. package/chunks/{standalone-CoQxJ6ov.js → standalone-CsoMmE9T.js} +778 -778
  58. package/chunks/standalone-DH0xTEes.js +2 -0
  59. package/chunks/{standalone-LFVgLhia.js → standalone-DHRalbVO.js} +311 -303
  60. package/chunks/standalone-DNh9NcMa.js +580 -0
  61. package/chunks/standalone-DcnHjNnC.js +2 -0
  62. package/chunks/{standalone-r4ObFvys.js → standalone-DflyWtuR.js} +217 -215
  63. package/chunks/standalone-DrHdGkY7.js +762 -0
  64. package/chunks/standalone-c_rROMtx.js +287 -0
  65. package/chunks/standalone-drcFLeN6.js +6 -0
  66. package/chunks/{standalone-CNkHsynO.js → standalone-wOWRCpdn.js} +54 -56
  67. package/chunks/{standalone-Cu73fzSr.js → standalone-z0o52o5t.js} +5128 -4908
  68. package/chunks/{table.compiler-C1qjqXaT.js → table.compiler-COaHE9VD.js} +18 -18
  69. package/chunks/{useFieldName-mWrD_uk_.js → useFieldName-CdnCWzhd.js} +1 -1
  70. package/chunks/{utils-DYYD4Zzf.js → utils-DganVptf.js} +4758 -4747
  71. package/chunks/{view-7fH6mGmY.js → view-Bzlros43.js} +2021 -1665
  72. package/chunks/{visualization-filters-mVnsnvLP.js → visualization-filters-D7i6oh1Z.js} +3177 -2425
  73. package/chunks/{with-html-element-B0Clt4jY.js → with-html-element-CiIhFEa5.js} +3740 -3547
  74. package/definitions.js +2 -2
  75. package/docs/operations/astrato-app-filter-bar.md +1 -1
  76. package/docs/operations/bar.md +303 -2
  77. package/docs/operations/combo.md +262 -1
  78. package/docs/operations/date-picker.md +1 -1
  79. package/docs/operations/distribution-gauge.md +1 -1
  80. package/docs/operations/dot.md +148 -1
  81. package/docs/operations/filter.md +1 -1
  82. package/docs/operations/gauge.md +1 -1
  83. package/docs/operations/heatMap.md +1 -1
  84. package/docs/operations/histogram.md +262 -1
  85. package/docs/operations/iframe.md +1 -1
  86. package/docs/operations/image.md +1 -1
  87. package/docs/operations/index.md +7 -7
  88. package/docs/operations/line.md +280 -1
  89. package/docs/operations/number.md +1 -1
  90. package/docs/operations/pie.md +1 -1
  91. package/docs/operations/radar.md +1 -1
  92. package/docs/operations/sankey.md +1 -1
  93. package/docs/operations/scatter.md +148 -1
  94. package/docs/operations/shape.md +1 -1
  95. package/docs/operations/simpleTextObject.md +1 -1
  96. package/docs/operations/slider.md +1 -1
  97. package/docs/operations/table.md +374 -157
  98. package/docs/operations/tree.md +1 -1
  99. package/docs/operations/treemap.md +1 -1
  100. package/docs/operations/waterfall.md +1 -1
  101. package/docs/operations/word-cloud.md +1 -1
  102. package/getters.js +2 -2
  103. package/index.js +482 -434
  104. package/metadata.js +2 -2
  105. package/operations.js +5 -5
  106. package/package.json +72 -67
  107. package/src/definitions/index.d.ts +7 -1
  108. package/src/definitions/model/definitions/available-fields.d.ts +2 -2
  109. package/src/definitions/model/definitions/compilers/compile.d.ts +1 -0
  110. package/src/definitions/model/definitions/data-item-resolution.d.ts +3 -3
  111. package/src/definitions/model/definitions/descriptors/descriptor-metadata.d.ts +219 -7
  112. package/src/definitions/model/definitions/index.d.ts +2 -1
  113. package/src/definitions/model/definitions/schema-registry.d.ts +305 -0
  114. package/src/definitions/model/definitions/schemas/bar.schema.d.ts +2 -0
  115. package/src/definitions/model/definitions/schemas/common.schema.d.ts +4 -3
  116. package/src/definitions/model/definitions/schemas/index.d.ts +1 -0
  117. package/src/definitions/model/definitions/schemas/map.schema.d.ts +590 -0
  118. package/src/definitions/model/definitions/types/compilation.types.d.ts +9 -1
  119. package/src/definitions/model/definitions/types/definition.types.d.ts +2 -2
  120. package/src/definitions/model/definitions/types/index.d.ts +1 -1
  121. package/src/index.d.ts +1 -1
  122. package/src/operations/index.d.ts +1 -1
  123. package/src/types.d.ts +17 -13
  124. package/chunks/FieldTypeIcon-pSVQFemC.js +0 -22
  125. package/chunks/ToggleButton-Br9HCPCv.js +0 -150
  126. package/chunks/color-rules-CN7TcGrC.js +0 -6
  127. package/chunks/color-settings-3VRlf_Vw.js +0 -6
  128. package/chunks/handlers-CMbyj5y1.js +0 -12930
  129. package/chunks/isEqual-DBg_b35N.js +0 -12
  130. package/chunks/label-format-type-weq1XfcX.js +0 -8
  131. package/chunks/operations-HSqnCRvv.js +0 -26324
  132. package/chunks/shared-DFoJxjVN.js +0 -1218
  133. package/chunks/standalone-530a5lvf.js +0 -1003
  134. package/chunks/standalone-B4jrf4KE.js +0 -354
  135. package/chunks/standalone-BMoJXGYe.js +0 -2
  136. package/chunks/standalone-BfvGggeM2.js +0 -355
  137. package/chunks/standalone-CMJJIi9v.js +0 -2
  138. package/chunks/standalone-C_Jd4gkj.js +0 -6
  139. package/chunks/standalone-CiaaibTa.js +0 -518
  140. package/chunks/standalone-DBeXQrwH.js +0 -468
  141. package/chunks/standalone-DpSRmAWx.js +0 -287
  142. package/chunks/standalone-kzAhwH19.js +0 -689
  143. package/chunks/standalone-mb7LwEiq.js +0 -3874
  144. /package/chunks/{src-BOS6SqkZ2.js → src-BOS6SqkZ.js} +0 -0
@@ -1,1218 +0,0 @@
1
- import { Mo as e, Oo as t, Ro as n, Xa as r, Za as i, jo as a, r as o, vc as s, xo as c, zo as l } from "./visualization-filters-mVnsnvLP.js";
2
- import { $f as u, Bd as d, Fm as ee, Gd as f, Hp as te, If as p, Jd as ne, Kd as re, Om as m, Qf as ie, Sm as ae, Ud as h, Yd as oe, Zf as se, dp as ce, em as le, im as ue, jm as de, lp as fe, rp as pe, sm as me, uf as g, um as he, up as ge, wf as _e, ym as ve } from "./handlers-CMbyj5y1.js";
3
- import { T as ye, d as be, t as xe, y as _ } from "./operations-HSqnCRvv.js";
4
- import { z as v } from "zod";
5
- var y = s(), Se = v.object({
6
- orientation: v.enum(["horizontal", "vertical"]).optional(),
7
- selectionMode: v.enum([
8
- "inherit",
9
- "auto",
10
- "manual"
11
- ]).optional(),
12
- enableAddingNewFilters: v.boolean().optional(),
13
- enableAssociativeFilter: v.boolean().optional(),
14
- showClearAll: v.boolean().optional(),
15
- showChartBreakdown: v.boolean().optional(),
16
- selectableFieldKeys: v.array(v.string()).optional()
17
- }).strict(), Ce = v.object({
18
- settings: Se.optional(),
19
- type: v.literal("astrato-app-filter-bar"),
20
- version: v.literal(1)
21
- }).strict(), b = (e) => e, x = v.string().trim().min(1).max(100), S = v.string().min(1).refine((e) => e.trim().length > 0, "Field key cannot be blank."), we = b(ae.shape.dataType), Te = b(ve.shape.formatType), Ee = v.object({
22
- distinct: v.boolean().optional(),
23
- name: v.string().trim().min(1),
24
- resultType: v.string().optional()
25
- }).strict(), De = v.object({
26
- aggregations: v.array(Ee).default([]),
27
- dataType: we,
28
- fieldKey: S,
29
- isManualData: v.boolean().optional(),
30
- kind: v.literal("field").default("field"),
31
- name: v.string().min(1),
32
- view: v.string().min(1)
33
- }).strict(), C = v.object({
34
- description: v.string().optional(),
35
- id: v.string().min(1).optional(),
36
- key: S,
37
- name: v.string().min(1),
38
- views: v.array(v.string()).optional()
39
- }).passthrough(), Oe = C.extend({
40
- dimension: v.record(v.string(), v.unknown()),
41
- type: v.literal("dimension")
42
- }), ke = C.extend({
43
- measure: v.object({ aggregation: v.string().min(1) }).passthrough(),
44
- type: v.literal("measure")
45
- }), Ae = C.extend({
46
- calculation: v.record(v.string(), v.unknown()),
47
- type: v.literal("calculation")
48
- }), je = v.object({
49
- fieldKey: S,
50
- item: Oe,
51
- kind: v.literal("dimension"),
52
- name: v.string().min(1)
53
- }).strict(), Me = v.object({
54
- fieldKey: S,
55
- item: ke,
56
- kind: v.literal("measure"),
57
- name: v.string().min(1)
58
- }).strict(), Ne = v.object({
59
- fieldKey: S,
60
- item: Ae,
61
- kind: v.literal("calculation"),
62
- name: v.string().min(1)
63
- }).strict(), w = v.union([
64
- De,
65
- je,
66
- Me,
67
- Ne
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
- }), Pe = v.object({
75
- currency: v.string().min(1).optional(),
76
- currencyIsPrefix: v.boolean().optional(),
77
- formatString: v.string().optional(),
78
- formatType: Te.optional(),
79
- negativeType: b(ve.shape.negativeType.unwrap()).optional()
80
- }).strict(), Fe = v.discriminatedUnion("mode", [v.object({
81
- dateLevel: b(v.enum(y.DateLevel)).describe("Year-aware bucket, such as month over time."),
82
- mode: v.literal("level")
83
- }).strict(), v.object({
84
- datePart: b(v.enum(y.DatePart)).describe("Date part, such as month of year."),
85
- mode: v.literal("part")
86
- }).strict()]), T = v.object({
87
- fieldKey: S,
88
- format: Pe.pick({
89
- formatString: !0,
90
- formatType: !0
91
- }).optional(),
92
- ref: x,
93
- showNullValues: v.boolean().optional(),
94
- temporalGrouping: Fe.describe("Groups a date dimension. Applied before format; format must then suit the grouping.").optional()
95
- }).strict(), Ie = v.object({
96
- placements: v.array(b(v.enum(de))).min(1).optional(),
97
- visible: v.boolean()
98
- }).strict(), E = v.object({
99
- aggregation: v.string().trim().min(1).describe("Required for a raw field measure; omit for a predefined measure or calculation.").optional(),
100
- dataLabels: Ie.optional(),
101
- fieldKey: S,
102
- format: Pe.optional(),
103
- ref: x
104
- }).strict(), Le = v.object({
105
- fieldKey: S,
106
- operator: b(v.enum(pe)),
107
- value: v.string()
108
- }).strict(), Re = v.object({
109
- fieldKey: S,
110
- operator: b(v.enum(u)),
111
- valueFrom: v.string(),
112
- valueTo: v.string()
113
- }).strict(), ze = v.object({
114
- fieldKey: S,
115
- operator: b(v.enum(se)),
116
- values: v.array(v.string()).min(1)
117
- }).strict(), Be = v.object({
118
- fieldKey: S,
119
- operator: b(v.enum(ie))
120
- }).strict(), Ve = v.union([
121
- Le,
122
- Re,
123
- ze,
124
- Be
125
- ]), D = v.lazy(() => v.object({
126
- filters: v.array(v.union([Ve, D])),
127
- operator: v.enum(["and", "or"])
128
- }).strict()), O = v.object({
129
- by: x,
130
- direction: b(le.shape.sortDirection),
131
- enabled: v.boolean().optional()
132
- }).strict(), He = v.object({
133
- by: x,
134
- count: v.number().int().positive(),
135
- direction: b(le.shape.sortDirection),
136
- showOthers: v.boolean().optional()
137
- }).strict(), Ue = v.object({
138
- queryLimit: v.number().int().positive().optional(),
139
- topN: He.optional()
140
- }).strict(), We = v.object({
141
- position: b(he.shape.position).optional(),
142
- title: v.string().optional(),
143
- visible: v.boolean().optional()
144
- }).strict(), k = v.object({
145
- labelsVisible: v.boolean().optional(),
146
- lineVisible: v.boolean().optional(),
147
- ticksVisible: v.boolean().optional(),
148
- title: v.string().optional(),
149
- titleVisible: v.boolean().optional()
150
- }).strict(), Ge = v.union([v.object({
151
- max: v.number().optional(),
152
- min: v.number().optional().describe("Must be less than max when both are set")
153
- }).strict(), v.object({ startsAtZero: v.boolean() }).strict()]).describe("Fix min, max or both, or set startsAtZero on an axis fitted to the data"), Ke = v.array(te).optional().describe("Shaded ranges drawn across the plot between two primary measure axis values"), qe = fe({}), Je = fe({ dimension: x.describe(`Alias of a dimension in data.dimensions. ${ce}`) }), Ye = ge({ measure: x.describe("Alias of the measure in data.measures whose value is compared") }), Xe = "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.", Ze = v.array(Ye).min(1).describe("Colors bound to measure thresholds, eg. red when sales is below 100. The first matching rule wins."), A = (e) => v.object({
154
- overwrites: v.array(e.requiresOverwriteDimension ? Je : qe).min(1).describe(Xe).optional(),
155
- ...e.rules ? { rules: Ze.optional() } : {}
156
- }).strict(), Qe = {
157
- inverted: v.boolean().optional().describe("Reverse the direction of the axis values, eg. to put rank 1 at the top"),
158
- range: Ge.optional()
159
- }, $e = { bands: Ke }, j = { scale: b(v.enum(ee)).optional() };
160
- k.extend({
161
- ...Qe,
162
- ...$e,
163
- ...j
164
- }).strict();
165
- var M = ({ logScale: e = !1, primaryMeasureBands: t = !1, rangedMeasureAxes: n = [] } = {}) => {
166
- let r = (t, r) => k.extend({
167
- ...n.includes(t) ? Qe : {},
168
- ...r ? $e : {},
169
- ...e ? j : {}
170
- }).strict();
171
- return v.object({
172
- dimension: k.optional(),
173
- primaryMeasure: r("primaryMeasure", t).optional(),
174
- secondaryMeasure: r("secondaryMeasure", !1).optional()
175
- }).strict();
176
- };
177
- M();
178
- var et = v.object({
179
- axes: M({
180
- logScale: !0,
181
- primaryMeasureBands: !0,
182
- rangedMeasureAxes: ["primaryMeasure", "secondaryMeasure"]
183
- }).optional(),
184
- legend: We.optional(),
185
- orientation: b(v.enum(i)).optional()
186
- }).strict(), tt = E.extend({ axis: v.enum(["primary", "secondary"]).optional() }), nt = v.object({
187
- data: v.object({
188
- dimensions: v.array(T).min(1),
189
- measures: v.array(tt).min(1)
190
- }).strict(),
191
- filterGroup: D.optional(),
192
- limiting: Ue.optional(),
193
- presentation: et.extend({ coloring: A({ rules: !0 }).optional() }).optional(),
194
- sorting: v.array(O).optional(),
195
- type: v.literal("bar"),
196
- version: v.literal(1)
197
- }).strict(), N = v.object({ visible: v.boolean() }).strict(), rt = (e, t) => v.array(e).min(t.min).max(t.max), P = (e, t) => {
198
- let n = {};
199
- if (t.dimensions.max > 0) {
200
- let e = rt(T, t.dimensions);
201
- n.dimensions = t.dimensions.min === 0 ? e.optional() : e;
202
- }
203
- if (t.measures.max > 0) {
204
- let e = t.dataLabels ? E.omit({ dataLabels: !0 }).extend({ dataLabels: N.optional() }) : E.omit({ dataLabels: !0 }), r = t.comboSeriesTypes ? e.extend({ seriesType: v.enum([
205
- "bar",
206
- "line",
207
- "point"
208
- ]).optional() }) : e, i = rt(t.measureAxis ? r.extend({ axis: v.enum(["primary", "secondary"]).optional() }) : r, t.measures);
209
- n.measures = t.measures.min === 0 ? i.optional() : i;
210
- }
211
- let r = {};
212
- if (t.axes) {
213
- let e = M({
214
- logScale: t.measureAxisScale,
215
- primaryMeasureBands: t.measureAxisBands,
216
- rangedMeasureAxes: t.rangedMeasureAxes
217
- });
218
- r.axes = (t.secondaryDimensionAxis ? e.extend({ secondaryDimension: k.optional() }) : e).optional();
219
- }
220
- t.conditionalColoring && (r.coloring = A(t.conditionalColoring).optional()), t.dataLabels && (r.dataLabels = N.optional()), t.gaugeDisplayMode && (r.displayMode = v.enum(["bar", "radial"]).optional()), t.legend && (r.legend = We.optional()), t.orientation && (r.orientation = b(v.enum(i)).optional()), t.treeLayout && (r.layout = v.object({
221
- compact: v.boolean().optional(),
222
- direction: v.enum([
223
- "bottom",
224
- "left",
225
- "right",
226
- "top"
227
- ]).optional(),
228
- forceAutoFit: v.boolean().optional(),
229
- initialExpandedLevels: v.number().int().min(0).optional()
230
- }).strict().optional());
231
- let a = {
232
- data: v.object(n).strict(),
233
- filterGroup: D.optional(),
234
- type: v.literal(e),
235
- version: v.literal(1)
236
- };
237
- return t.queryLimit && (a.limiting = v.object({ queryLimit: v.number().int().positive().optional() }).strict().optional()), Object.keys(r).length > 0 && (a.presentation = v.object(r).strict().optional()), t.sorting && (a.sorting = v.array(O).optional()), v.object(a).strict().superRefine((n, r) => {
238
- let i = n.data, a = t.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 = t.conditionalColoring?.minDimensions ?? 0;
245
- n.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
- }), t.validateDefinition?.(n, r);
250
- });
251
- }, it = P("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
- }), at = P("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
- }), ot = P("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
- }), st = P("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
- }), ct = P("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
- }), lt = P("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
- }), ut = P("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
- }), dt = P("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
- }), ft = P("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
- }), pt = P("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
- }), mt = P("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
- }), ht = P("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
- }), gt = P("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
- }), _t = P("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
- }), vt = v.enum(["dropdown", "listbox"]), yt = v.object({
477
- mode: vt.optional(),
478
- quickSelect: v.boolean().optional(),
479
- responsive: v.boolean().optional(),
480
- searchable: v.boolean().optional(),
481
- showProgressBar: v.boolean().optional()
482
- }).strict(), bt = v.object({
483
- data: v.object({ field: T.omit({
484
- format: !0,
485
- showNullValues: !0,
486
- temporalGrouping: !0
487
- }) }).strict(),
488
- presentation: yt.optional(),
489
- type: v.literal("filter"),
490
- version: v.literal(1)
491
- }).strict(), xt = E.omit({ dataLabels: !0 }).extend({
492
- axis: v.enum(["primary", "secondary"]).optional(),
493
- dataPointShape: b(me.shape.dataPointShape)
494
- }), St = v.object({
495
- density: ue.optional(),
496
- visible: v.boolean()
497
- }).strict(), Ct = et.extend({
498
- coloring: A({ rules: !1 }).optional(),
499
- dataLabels: St.optional()
500
- }), wt = v.object({
501
- data: v.object({
502
- dimensions: v.array(T).min(1),
503
- measures: v.array(xt).min(1)
504
- }).strict(),
505
- filterGroup: D.optional(),
506
- limiting: v.object({ queryLimit: v.number().int().positive().optional() }).strict().optional(),
507
- presentation: Ct.optional(),
508
- sorting: v.array(O).optional(),
509
- type: v.literal("line"),
510
- version: v.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
- }), Tt = v.object({
529
- data: v.object({ measure: E.omit({ dataLabels: !0 }) }).strict(),
530
- filterGroup: D.optional(),
531
- type: v.literal("number"),
532
- version: v.literal(1)
533
- }).strict(), Et = b(_e.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()), Dt = v.object({
543
- data: v.object({ field: T.omit({
544
- format: !0,
545
- showNullValues: !0,
546
- temporalGrouping: !0
547
- }) }).strict(),
548
- settings: Et.optional(),
549
- type: v.literal("date-picker"),
550
- version: v.literal(1)
551
- }).strict(), Ot = v.object({
552
- settings: v.object({ url: v.string().url().nullable() }).strict(),
553
- type: v.literal("iframe"),
554
- version: v.literal(1)
555
- }).strict(), kt = v.object({
556
- settings: b(v.object({
557
- blur: g.shape.blur.optional(),
558
- fit: g.shape.image.unwrap().shape.imageFit.optional(),
559
- opacity: g.shape.opacity.optional(),
560
- saturation: g.shape.saturation.optional(),
561
- shadow: g.shape.shadow.optional(),
562
- source: be.optional()
563
- }).strict()),
564
- type: v.literal("image"),
565
- version: v.literal(1)
566
- }).strict(), At = v.object({
567
- settings: b(oe.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: v.literal("shape"),
583
- version: v.literal(1)
584
- }).strict(), F = ne.shape.simpleTextObjectSettings, jt = v.object({
585
- settings: b(v.object({
586
- align: F.shape.align.optional(),
587
- content: v.string().optional(),
588
- fontFamily: F.shape.fontFamily.optional(),
589
- fontSize: F.shape.fontSize.optional(),
590
- position: F.shape.position.optional(),
591
- representation: F.shape.representation.optional(),
592
- responsive: F.shape.responsive.optional(),
593
- textColor: F.shape.textColor.optional(),
594
- wordWrap: F.shape.wordWrap.optional()
595
- }).strict()),
596
- type: v.literal("simpleTextObject"),
597
- version: v.literal(1)
598
- }).strict(), Mt = v.object({
599
- settings: b(v.object({
600
- customLabel: p.shape.commonSettings.shape.customLabel.optional(),
601
- hideLabel: p.shape.commonSettings.shape.hideLabel.optional(),
602
- inputType: p.shape.type.optional(),
603
- placeholder: p.shape.commonSettings.shape.placeholder.optional(),
604
- responsive: p.shape.commonSettings.shape.responsive.optional(),
605
- variableId: p.shape.commonSettings.shape.variableId.optional()
606
- }).strict()),
607
- type: v.literal("atomic-input"),
608
- version: v.literal(1)
609
- }).strict(), Nt = v.object({
610
- data: v.object({ field: T.omit({
611
- format: !0,
612
- showNullValues: !0,
613
- temporalGrouping: !0
614
- }) }).strict(),
615
- settings: b(re.pick({
616
- layout: !0,
617
- quickSelect: !0,
618
- range: !0,
619
- step: !0
620
- }).partial()).optional(),
621
- type: v.literal("slider"),
622
- version: v.literal(1)
623
- }).strict(), Pt = T.extend({ role: v.literal("dimension") }), I = E.omit({ dataLabels: !0 }), Ft = I.extend({ role: v.literal("measure") }), It = v.object({
624
- columns: v.array(v.discriminatedUnion("role", [Pt, Ft])).min(1),
625
- structure: v.literal("normal").optional()
626
- }).strict(), Lt = v.object({
627
- dimensions: v.array(T).min(1),
628
- measures: v.array(I).min(1),
629
- structure: v.literal("expandable")
630
- }).strict(), Rt = v.object({
631
- columnDimensions: v.array(T).min(1),
632
- measures: v.array(I).min(1),
633
- rowDimensions: v.array(T).min(1),
634
- structure: v.literal("pivot")
635
- }).strict(), zt = v.union([
636
- It,
637
- Lt,
638
- Rt
639
- ]), Bt = v.object({
640
- applyTo: d.shape.applyTo,
641
- enabled: d.shape.enabled,
642
- showRecordsCount: d.shape.showRecordsCount,
643
- style: v.object({
644
- backgroundColor: f.shape.backgroundColor.optional(),
645
- fontColor: f.shape.fontColor.optional(),
646
- fontStyle: h.optional(),
647
- position: f.shape.position.optional(),
648
- responsiveHeight: f.shape.responsive
649
- }).strict().optional()
650
- }).strict(), Vt = v.object({
651
- background: v.object({
652
- color: m.optional(),
653
- evenColor: m.optional(),
654
- oddColor: m.optional(),
655
- type: v.enum([
656
- "none",
657
- "single",
658
- "zebra"
659
- ])
660
- }).strict().optional(),
661
- body: v.object({
662
- fontColor: m.optional(),
663
- fontFamily: v.string().trim().min(1).optional(),
664
- fontSize: v.number().positive().optional(),
665
- fontStyle: h.optional(),
666
- horizontalAlign: v.enum([
667
- "auto",
668
- "center",
669
- "left",
670
- "right"
671
- ]).optional(),
672
- verticalAlign: v.enum([
673
- "auto",
674
- "bottom",
675
- "middle",
676
- "top"
677
- ]).optional()
678
- }).strict().optional(),
679
- borders: v.object({
680
- color: m.optional(),
681
- dividerColor: m.optional(),
682
- dividers: v.enum([
683
- "all",
684
- "auto",
685
- "horizontal",
686
- "none",
687
- "vertical"
688
- ]).optional(),
689
- enabled: v.boolean(),
690
- lineStyle: v.enum([
691
- "dashed",
692
- "dotted",
693
- "line"
694
- ]).optional(),
695
- radius: v.number().nonnegative().optional(),
696
- strokeWidth: v.number().nonnegative().optional()
697
- }).strict().optional(),
698
- header: v.object({
699
- backgroundColor: m.optional(),
700
- borderColor: m.optional(),
701
- fontColor: m.optional(),
702
- fontFamily: v.string().trim().min(1).optional(),
703
- fontSize: v.number().positive().optional(),
704
- fontStyle: h.optional(),
705
- responsiveHeight: v.boolean().optional()
706
- }).strict().optional(),
707
- highlight: v.object({
708
- backgroundColor: m.optional(),
709
- mode: v.enum([
710
- "column",
711
- "none",
712
- "row",
713
- "row-and-column"
714
- ]),
715
- textColor: m.optional()
716
- }).strict().optional(),
717
- layout: v.object({
718
- columnWidthBehavior: v.enum(["responsive", "static"]).optional(),
719
- rowHeight: v.number().positive().optional()
720
- }).strict().optional()
721
- }).strict(), Ht = v.object({
722
- data: zt,
723
- filterGroup: D.optional(),
724
- limiting: v.object({ queryLimit: v.number().int().positive().optional() }).strict().optional(),
725
- presentation: Vt.optional(),
726
- sorting: v.array(O).optional(),
727
- totals: Bt.optional(),
728
- type: v.literal("table"),
729
- version: v.literal(1)
730
- }).strict(), L = (e) => typeof e == "object" && !!e && !Array.isArray(e), Ut = (e) => {
731
- let t = e.fieldKey ?? e.key;
732
- return typeof t == "string" ? t : void 0;
733
- }, Wt = (e) => {
734
- if (Array.isArray(e)) return e;
735
- if (!L(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
- }, Gt = (e, t) => {
747
- let n = e.type;
748
- if (!(n === "dimension" && L(e.dimension) || n === "measure" && L(e.measure) || n === "calculation" && L(e.calculation))) return;
749
- let r = w.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
- }, Kt = (e, t) => {
758
- if (!L(e)) throw Error(`Available field at index ${t} must be an object.`);
759
- let n = w.safeParse(e);
760
- if (n.success) return n.data;
761
- let r = Gt(e, t);
762
- if (r) return r;
763
- let i = Array.isArray(e.aggregations) ? e.aggregations : Array.isArray(e.aggregators) ? e.aggregators : [], a = w.safeParse({
764
- aggregations: i.map((e) => L(e) ? {
765
- distinct: e.distinct,
766
- name: e.name ?? e.funcName,
767
- resultType: e.resultType
768
- } : e),
769
- dataType: e.dataType,
770
- fieldKey: Ut(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
- }, qt = (e) => {
779
- let t = Wt(e).map(Kt), 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
- }, Jt = (e) => e.kind === "field" ? [...new Set(e.aggregations.flatMap((e) => [e.name, ...e.distinct ? [`${e.name}_DISTINCT`] : []]))] : [], Yt = (e, t) => e.kind === "field" || t === "dimension" && e.kind === "dimension" || t === "measure" && (e.kind === "measure" || e.kind === "calculation"), Xt = (e) => {
786
- if (e.kind !== "dimension") return e.kind;
787
- }, R = (e) => ({
788
- ...t(e.item),
789
- id: e.item.id ?? e.fieldKey
790
- }), z = (t) => t.map((t) => t.kind === "dimension" ? e(R(t)) : t.kind === "measure" || t.kind === "calculation" ? a(R(t)) : {
791
- aggregators: n(t.aggregations.map((e) => ({
792
- distinct: e.distinct ?? !1,
793
- name: e.name,
794
- resultType: e.resultType
795
- }))),
796
- dataType: t.dataType,
797
- isManualData: t.isManualData,
798
- key: t.fieldKey,
799
- name: t.name,
800
- view: t.view,
801
- views: [t.view]
802
- }), B = (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
- }, Zt = (e, t) => [...t].sort((t, n) => B(e, n.fieldKey) - B(e, t.fieldKey) || t.fieldKey.localeCompare(n.fieldKey)).slice(0, 5).map((e) => e.fieldKey), Qt = [
807
- y.FieldType.DATE,
808
- y.FieldType.TIME,
809
- y.FieldType.TIMESTAMP,
810
- y.FieldType.TIMESTAMP_TZ
811
- ], V = (e, t, n, r) => ({
812
- ...r ? { allowedValues: r } : {},
813
- code: e,
814
- message: n,
815
- path: t
816
- }), H = (e) => Jt(e).filter((e) => !!l(e)), U = (e, t) => {
817
- let n = t.find((t) => t.fieldKey === e.fieldKey);
818
- return n?.kind === "field" ? H(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 : U(e, t);
822
- }, en = (e, t, n = {}) => {
823
- let r = t.find((t) => t.fieldKey === e.fieldKey), i = r ? Xt(r) : void 0, a = U(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 [V("unknown_field_key", [...n, "fieldKey"], `Field key "${e.fieldKey}" is not available.`, Zt(e.fieldKey, t))];
833
- if (!Yt(i, r)) return [V("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, Qt, "a temporally grouped dimension") : [];
835
- if (i.kind !== "field") return e.aggregation === void 0 ? [] : [V("invalid_aggregation", [...n, "aggregation"], `Aggregation must be omitted for semantic ${i.kind} "${e.fieldKey}".`)];
836
- let a = H(i);
837
- return e.aggregation ? a.some((t) => t.toLocaleUpperCase() === e.aggregation?.toLocaleUpperCase()) ? [] : [V("invalid_aggregation", [...n, "aggregation"], `Aggregation "${e.aggregation}" is not available for field key "${e.fieldKey}".`, a)] : [V("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) ? [] : [V("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
- }, q = (e, t) => t.reduce((e, t) => typeof e == "object" && e && Object.prototype.hasOwnProperty.call(e, t) ? e[t] : void 0, e), an = (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 ? an(e[0]) : void 0);
862
- return t.every((e) => e !== void 0) ? [...new Set(t.flat())] : void 0;
863
- }, on = (e) => e.filter((e) => typeof e != "symbol"), sn = (e, t, n = []) => {
864
- 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 && q(t, [...n, ...on(e.path)]) !== void 0, i = (e, a) => {
865
- let o = [...a, ...on(e.path)];
866
- if (e.code === "unrecognized_keys") return e.keys.map((r) => {
867
- let i = [
868
- ...n,
869
- ...o,
870
- r
871
- ];
872
- return {
873
- code: "invalid_structure",
874
- path: i,
875
- message: `${G(i)}: Unrecognized key.`,
876
- details: {
877
- received: q(t, [...o, r]),
878
- zodCode: e.code
879
- }
880
- };
881
- });
882
- let s = [...n, ...o], c = q(t, o), l = an(e), u = {
883
- received: c,
884
- zodCode: e.code
885
- }, d = l ? `Unsupported value ${K(c)}. Allowed values: ${l.map(K).join(", ")}.` : `${e.message}. Received: ${K(c)}.`;
886
- if (e.code === "invalid_union" && !l && e.errors.length > 0) {
887
- 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"));
888
- if (s.length === 1) return s[0].flatMap((e) => i(e, o));
889
- let c = e.errors.map((e) => e.flatMap((e) => i(e, o)));
890
- 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(" ")}`;
891
- }
892
- return [{
893
- code: "invalid_structure",
894
- path: s,
895
- message: `${G(s)}: ${d}`,
896
- details: u,
897
- ...l ? { allowedValues: l } : {}
898
- }];
899
- };
900
- return e.issues.flatMap((e) => i(e, []));
901
- };
902
- o();
903
- var cn = (e, t) => {
904
- let n = "legend" in e && !!e.legend, i = t.position !== void 0 || t.title !== void 0, a = [];
905
- return t.visible !== void 0 && (t.visible || i || n) ? a.push({
906
- name: "setLegendEnabled",
907
- payload: t.visible
908
- }) : t.visible === void 0 && i && !n && a.push({
909
- name: "setLegendEnabled",
910
- payload: !0
911
- }), t.position === void 0 ? (t.visible === !0 || i && !n) && a.push({
912
- name: "setLegendPosition",
913
- payload: r.Right
914
- }) : a.push({
915
- name: "setLegendPosition",
916
- payload: t.position
917
- }), t.title !== void 0 && a.push({
918
- name: "setLegendTitle",
919
- payload: t.title
920
- }), a;
921
- }, J = (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
- ...Y(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
- }), Y = (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(J("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: z(e.availableFields),
977
- input: e,
978
- resolvedRefs: {},
979
- vSpec: t
980
- }), mn = (e, t, n, r, i) => ({
981
- name: e,
982
- payload: {
983
- ...Y(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
- } : {}, X = (e) => ({
999
- filters: e.filters.map((e) => "filters" in e ? X(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) ? [] : [J("unknown_alias", [
1006
- "sorting",
1007
- n,
1008
- "by"
1009
- ], `Reference "${e.by}" does not exist.`, { allowedValues: t })]), Z = ["presentation", "coloring"], _n = (e, t, n) => [...(e?.overwrites ?? []).flatMap(({ dimension: e }, n) => e === void 0 || t.includes(e) ? [] : [J("unknown_alias", [
1010
- ...Z,
1011
- "overwrites",
1012
- n,
1013
- "dimension"
1014
- ], `Dimension reference "${e}" does not exist.`, { allowedValues: t })]), ...(e?.rules ?? []).flatMap(({ measure: e }, t) => n.includes(e) ? [] : [J("unknown_alias", [
1015
- ...Z,
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: [J("invalid_compiled_vspec", [], "Compiled vSpec failed final validation.", { details: { issues: n.error.issues } })],
1027
- success: !1
1028
- };
1029
- }, Q = (e) => "startsAtZero" in e ? {} : e, yn = (e) => {
1030
- let { max: t, min: n } = Q(e);
1031
- return n !== void 0 && t !== void 0 ? c.MinMax : n === void 0 ? t === void 0 ? c.Auto : c.Max : c.Min;
1032
- }, bn = (e) => {
1033
- for (let [t, n] of Object.entries(e ?? {})) {
1034
- let { max: e, min: r } = n?.range ? Q(n.range) : {};
1035
- if (r !== void 0 && e !== void 0 && r >= e) return J("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: _.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: _.SET_AXIS_RANGE_OPTION,
1056
- payload: {
1057
- axisName: e,
1058
- axisRangeOption: yn(r)
1059
- }
1060
- });
1061
- let { max: t, min: i } = Q(r);
1062
- i !== void 0 && n.push({
1063
- name: _.SET_AXIS_RANGE_MIN,
1064
- payload: {
1065
- axisName: e,
1066
- minValue: i
1067
- }
1068
- }), t !== void 0 && n.push({
1069
- name: _.SET_AXIS_RANGE_MAX,
1070
- payload: {
1071
- axisName: e,
1072
- maxValue: t
1073
- }
1074
- }), "startsAtZero" in r && n.push({
1075
- name: _.SET_AXIS_STARTS_AT_ZERO,
1076
- payload: {
1077
- axisName: e,
1078
- startsAtZero: r.startsAtZero
1079
- }
1080
- });
1081
- }
1082
- return n;
1083
- }, Sn = (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 xe(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 = Sn(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.", d = s ? `Cannot apply ${K(s.received)} to ${s.kind} ${K(s.ref)}` : "Operation failed";
1106
- return {
1107
- issue: J("operation_failed", c, `${G(c)}: ${d} (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
- }, Cn = (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
- }, wn = async (e, t, n, r, i, a) => {
1128
- let o = `${n}:${t.ref}`, s = await xe(e.vSpec, e.availableFields, [{
1129
- id: o,
1130
- name: r,
1131
- payload: i
1132
- }], e.input.variables ?? [], [], e.input.theme), c = Sn(s.results), l = Cn(s.results[o], n);
1133
- return c || !l ? {
1134
- issue: J("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
- }, Tn = (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
- }, En = (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), Dn = (e, t, n, r) => $(e, t.flatMap((t) => t.showNullValues === void 0 ? [] : [{
1163
- name: n,
1164
- payload: {
1165
- ...Y(e.resolvedRefs[t.ref]),
1166
- changes: { showNullValues: t.showNullValues }
1167
- }
1168
- }]), r), On = (e, t) => t ? $(e, [{
1169
- id: "filterGroup",
1170
- name: "setStaticFilterGroup",
1171
- payload: X(t)
1172
- }], ["filterGroup"]) : Promise.resolve({
1173
- state: e,
1174
- success: !0
1175
- }), kn = (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
- ...Y(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
- ...Y(e.resolvedRefs[t.by]),
1199
- enabled: t.enabled ?? !0
1200
- }
1201
- }))], ["sorting"]);
1202
- }, An = (e, t) => {
1203
- let n = [];
1204
- return t?.overwrites && n.push({
1205
- name: ye.SET_COLORING_OVERWRITES,
1206
- payload: { overwrites: t.overwrites.map(({ dimension: t, ...n }) => t === void 0 ? n : {
1207
- ...n,
1208
- dimension: Y(e.resolvedRefs[t])
1209
- }) }
1210
- }), t?.rules && n.push({
1211
- name: ye.SET_COLORING_RULES,
1212
- payload: { rules: t.rules.map(({ measure: t, ...n }) => ({
1213
- ...n,
1214
- measure: Y(e.resolvedRefs[t])
1215
- })) }
1216
- }), $(e, n, Z);
1217
- };
1218
- export { ht as $, rn as A, Nt as B, dn as C, $t as D, en as E, Mt as F, it as G, Tt as H, Dt as I, ut as J, dt as K, Ot as L, qt as M, z as N, W as O, Ht as P, lt as Q, kt as R, _n as S, sn as T, wt as U, jt as V, bt as W, st as X, ct as Y, ft as Z, bn as _, Tn as a, nt as at, X as b, xn as c, J as d, ot as et, cn as f, vn as g, $ as h, On as i, _t as it, nn as j, tn as k, ln as l, mn as m, An as n, mt as nt, kn as o, w as ot, un as p, at as q, Dn as r, gt as rt, En as s, Ce as st, wn as t, pt as tt, pn as u, fn as v, G as w, gn as x, Y as y, At as z };