react-semaphor 0.1.541 → 0.1.543

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 (109) hide show
  1. package/dist/analytics-protocol/index.js +75 -75
  2. package/dist/assistant-context/index.js +1 -1
  3. package/dist/brand-studio/index.js +3 -3
  4. package/dist/briefings/index.js +51 -49
  5. package/dist/chunks/apply-dashboard-operations-CG9S7MGt.js +2260 -0
  6. package/dist/chunks/{assistant-chat-D1fDZD6O.js → assistant-chat-BFMRUYoB.js} +12 -12
  7. package/dist/chunks/bookmark-state-CXw7lZ50.js +118 -0
  8. package/dist/chunks/{calendar-day-equality-Bpl15IBo.js → calendar-day-equality-BmJAWduY.js} +180 -207
  9. package/dist/chunks/comparison-window-caption-Bv18samq.js +1618 -0
  10. package/dist/chunks/custom-visual-inputs-DUtpYZOk.js +323 -0
  11. package/dist/chunks/{dashboard-B6IrON_Q.js → dashboard-B9mKTJoy.js} +1 -1
  12. package/dist/chunks/{dashboard-briefing-launcher-DwjFpewq.js → dashboard-briefing-launcher-Bdmry_oG.js} +18 -18
  13. package/dist/chunks/{dashboard-controls-C_BI28ME.js → dashboard-controls-UGpjOM2k.js} +69 -70
  14. package/dist/chunks/{dashboard-filter-value-compatibility-D95O4nd7.js → dashboard-filter-value-compatibility-CwQ_iSNb.js} +2 -2
  15. package/dist/chunks/{dashboard-json-DDY15Trn.js → dashboard-json-DG8dz0eX.js} +4 -4
  16. package/dist/chunks/{document-dashboard-inputs-DP_Op5mu.js → document-dashboard-inputs-OwqCbrVp.js} +2382 -4975
  17. package/dist/chunks/document-sheet-utils-BTb3VZxV.js +3619 -0
  18. package/dist/chunks/{edit-dashboard-visual-CH2dzWW-.js → edit-dashboard-visual-CDpA4y5e.js} +728 -728
  19. package/dist/chunks/{filter-value-text-BhWugPWE.js → filter-value-text-CYsVYPuD.js} +18 -19
  20. package/dist/chunks/{index-DaQlghLY.js → index-l5LclZvs.js} +824 -1351
  21. package/dist/chunks/{matrix-analytical-definition-bcprSe4u.js → matrix-analytical-definition-C7Gb0e12.js} +1 -1
  22. package/dist/chunks/{matrix-card-CJn1hB5V.js → matrix-card-DjwWcCo8.js} +2 -2
  23. package/dist/chunks/{matrix-formatter-DQ8avoIQ.js → matrix-formatter-BnsTX90d.js} +430 -417
  24. package/dist/chunks/{matrix-member-presentation-BNPSDKBG.js → matrix-member-presentation-CQGdVks6.js} +1 -1
  25. package/dist/chunks/{matrix-operation-contract-B8PBF1Gd.js → matrix-operation-contract-8OIO4gob.js} +65 -65
  26. package/dist/chunks/metric-comparison-DEwi9uc2.js +498 -0
  27. package/dist/chunks/numeric-presentation-F_-H6VAw.js +5227 -0
  28. package/dist/chunks/{pivot-header-presentation-MkcKnjn3.js → pivot-header-presentation-DHcx1XGQ.js} +1 -1
  29. package/dist/chunks/{pivot-result-identity-D6hhcRXi.js → pivot-result-identity-DJhXXcns.js} +1 -1
  30. package/dist/chunks/pivot-result-lifecycle-DupbRk-R.js +1155 -0
  31. package/dist/chunks/raw-temporal-presentation-D-azM_98.js +585 -0
  32. package/dist/chunks/{report-preferences-dialog-DpNkFfQO.js → report-preferences-dialog-CPwRwEJx.js} +75 -75
  33. package/dist/chunks/{report-runtime-context-B984Nq1E.js → report-runtime-context-Dq8XyODK.js} +1 -1
  34. package/dist/chunks/{saved-dashboard-context-CJ2WpoMF.js → saved-dashboard-context-BKvMfRfC.js} +233 -206
  35. package/dist/chunks/{selection-reducer-vKIb_jS6.js → selection-reducer-Dj_8xD69.js} +1 -1
  36. package/dist/chunks/{semaphor-ready-indicator-KT598QJq.js → semaphor-ready-indicator-CN2AHm2x.js} +37489 -39476
  37. package/dist/chunks/{shelf-drop-preview-context-BxV3Fl8h.js → shelf-drop-preview-context-BGl_rxcW.js} +6 -6
  38. package/dist/chunks/sort-target-MT1WK1vX.js +29 -0
  39. package/dist/chunks/{source-entity-resolution-CVA1a85c.js → source-entity-resolution-BYn9giz3.js} +1 -1
  40. package/dist/chunks/{switch-DWEWiv1J.js → switch-C3jLxlG0.js} +2 -2
  41. package/dist/chunks/table-export-sheet-BDRXLLdq.js +949 -0
  42. package/dist/chunks/table-settings-CLZocegs.js +501 -0
  43. package/dist/chunks/temporal-bucket-D7NBrrtL.js +2071 -0
  44. package/dist/chunks/{token-types-bxUxXDX2.js → token-types-DBbZVQsm.js} +1 -1
  45. package/dist/chunks/{use-create-flow-overlay-state-DdD12SMY.js → use-create-flow-overlay-state-BnclfB2k.js} +151 -151
  46. package/dist/chunks/{validators-Ej1DdCXa.js → validators-DMHTpf7a.js} +73 -73
  47. package/dist/dashboard/index.js +2 -2
  48. package/dist/dashboard-authoring/index.js +462 -457
  49. package/dist/data-app-sdk/index.js +5 -5
  50. package/dist/data-app-sdk-adapters/index.js +2 -2
  51. package/dist/data-app-sdk-validation/index.js +9 -9
  52. package/dist/format-utils/index.js +346 -241
  53. package/dist/index.js +174 -175
  54. package/dist/report-runtime-context/index.js +1 -1
  55. package/dist/surfboard/index.js +2 -2
  56. package/dist/types/briefings/attachment-outcomes.d.ts +1 -1
  57. package/dist/types/briefings/attachments.d.ts +17 -1
  58. package/dist/types/briefings/index.d.ts +5 -3
  59. package/dist/types/index.js +48 -48
  60. package/dist/types/lib/api/exports-api.d.ts +11 -65
  61. package/dist/types/lib/dashboard-inputs/control-contract-overrides.d.ts +17 -0
  62. package/dist/types/lib/dashboard-viewer/export-table-view.d.ts +2 -0
  63. package/dist/types/lib/hooks/use-dashboard.d.ts +3 -6
  64. package/dist/types/lib/matrix-table/matrix-delivery-policy.d.ts +8 -2
  65. package/dist/types/lib/matrix-table/matrix-delivery.d.ts +8 -6
  66. package/dist/types/lib/query-context/build-dashboard-card-query-contract.d.ts +50 -0
  67. package/dist/types/lib/types/explorer-types.d.ts +6 -0
  68. package/dist/types/shared/analytics-protocol/matrix-definition-contract.d.ts +3 -3
  69. package/dist/types/shared/assistant-context/index.d.ts +1 -1
  70. package/dist/types/shared/assistant-context/saved-dashboard-context.d.ts +23 -6
  71. package/dist/types/shared/dashboard-authoring/card-export-request.d.ts +173 -0
  72. package/dist/types/shared/dashboard-authoring/index.d.ts +1 -0
  73. package/dist/types/shared/dashboard-authoring/matrix-delivery.d.ts +4 -3
  74. package/dist/types/shared/format-utils/exporters/export-cells.d.ts +90 -0
  75. package/dist/types/shared/format-utils/exporters/export-file-format.d.ts +44 -0
  76. package/dist/types/shared/format-utils/exporters/index.d.ts +6 -0
  77. package/dist/types/shared/format-utils/exporters/xlsx-file.d.ts +90 -0
  78. package/dist/types/shared/format-utils/formatters/date-formatter.d.ts +8 -12
  79. package/dist/types/shared/format-utils/formatters/index.d.ts +1 -1
  80. package/dist/types/shared/format-utils/formatters/matrix-formatter.d.ts +2 -0
  81. package/dist/types/shared/format-utils/index.d.ts +2 -0
  82. package/dist/types/shared/format-utils/matrix-continuation.d.ts +55 -9
  83. package/dist/types/shared/format-utils/matrix-export-presentation.d.ts +21 -1
  84. package/dist/types/shared/format-utils/matrix-export-xlsx.d.ts +27 -0
  85. package/dist/types/shared/format-utils/presentation-execution.d.ts +27 -2
  86. package/dist/types/shared/format-utils/raw-temporal.d.ts +8 -0
  87. package/dist/types/shared/format-utils/table-export/index.d.ts +8 -0
  88. package/dist/types/shared/format-utils/table-export/prepare-table-export.d.ts +50 -0
  89. package/dist/types/shared/format-utils/table-export/table-export-formatting.d.ts +47 -0
  90. package/dist/types/shared/format-utils/table-export/table-export-raw-temporal.d.ts +40 -0
  91. package/dist/types/shared/format-utils/table-export/table-export-result.d.ts +31 -0
  92. package/dist/types/shared/format-utils/table-export/table-export-sheet.d.ts +38 -0
  93. package/dist/types/shared/format-utils/temporal-bucket.d.ts +9 -0
  94. package/package.json +2 -1
  95. package/dist/chunks/aggregate-table-row-presentation-B_vQjYR3.js +0 -996
  96. package/dist/chunks/apply-dashboard-operations-C-iahGka.js +0 -402
  97. package/dist/chunks/bookmark-state-k7y5SNGf.js +0 -331
  98. package/dist/chunks/calculated-field-identity-DcBS2NPP.js +0 -2161
  99. package/dist/chunks/canonical-result-keys-CEQefvdO.js +0 -33
  100. package/dist/chunks/common-types-CUf03Htv.js +0 -288
  101. package/dist/chunks/csv-utils-GUfKyT1J.js +0 -56
  102. package/dist/chunks/custom-visual-inputs-BrUOIwln.js +0 -3288
  103. package/dist/chunks/document-sheet-utils-C1eEldxs.js +0 -1076
  104. package/dist/chunks/matrix-definition-DQDI2okF.js +0 -206
  105. package/dist/chunks/metric-comparison-CojWeLqx.js +0 -392
  106. package/dist/chunks/pivot-result-lifecycle-8qCDmpKc.js +0 -804
  107. package/dist/chunks/raw-temporal-D61lr48Y.js +0 -1464
  108. package/dist/chunks/temporal-bucket-D8JF7zKz.js +0 -575
  109. package/dist/chunks/temporal-bucket-contract-DaOajRC7.js +0 -108
@@ -0,0 +1,501 @@
1
+ import { k as R } from "./validators-DMHTpf7a.js";
2
+ import { z as u } from "zod";
3
+ const F = 8, T = 6, I = Object.freeze([]);
4
+ function j(e) {
5
+ switch (e.type) {
6
+ case "table":
7
+ case "chart":
8
+ return e.card ? [e.card] : I;
9
+ case "kpi":
10
+ return Array.isArray(e.cards) ? e.cards : I;
11
+ default:
12
+ return I;
13
+ }
14
+ }
15
+ function ne(e, t) {
16
+ switch (e.type) {
17
+ case "table":
18
+ case "chart": {
19
+ if (!e.card) return e;
20
+ const r = t(e.card);
21
+ return r === e.card ? e : { ...e, card: r };
22
+ }
23
+ case "kpi": {
24
+ if (!Array.isArray(e.cards)) return e;
25
+ const r = e.cards.map(t);
26
+ return r.every((a, n) => a === e.cards[n]) ? e : { ...e, cards: r };
27
+ }
28
+ default:
29
+ return e;
30
+ }
31
+ }
32
+ function O(e) {
33
+ var r;
34
+ const t = [];
35
+ for (const a of e.sheets || []) {
36
+ const n = a.id;
37
+ for (const i of a.cards || [])
38
+ t.push({ kind: "sheetCard", sheetId: n, cardId: i.id, card: i });
39
+ for (const i of a.frames || [])
40
+ for (const s of i.cards || [])
41
+ t.push({
42
+ kind: "frameCard",
43
+ sheetId: n,
44
+ frameId: i.id,
45
+ cardId: s.id,
46
+ card: s
47
+ });
48
+ for (const i of ((r = a.document) == null ? void 0 : r.sections) || [])
49
+ for (const s of j(i))
50
+ t.push({
51
+ kind: "documentSectionCard",
52
+ sheetId: n,
53
+ sectionId: i.id,
54
+ cardId: s.id,
55
+ card: s
56
+ });
57
+ }
58
+ return t;
59
+ }
60
+ function S(e) {
61
+ return !!e && typeof e == "object" && !Array.isArray(e);
62
+ }
63
+ function ie(e) {
64
+ if (!S(e))
65
+ return [{ path: "", message: "must be an object." }];
66
+ const t = [];
67
+ e.title !== void 0 && typeof e.title != "string" && t.push({ path: "title", message: "must be a string." });
68
+ const r = e.cards;
69
+ if (!Array.isArray(r))
70
+ t.push({ path: "cards", message: "must be an array of KPI cards." });
71
+ else {
72
+ (r.length < 1 || r.length > F) && t.push({
73
+ path: "cards",
74
+ message: `must hold 1 to ${F} KPI cards.`
75
+ });
76
+ const n = /* @__PURE__ */ new Set();
77
+ r.forEach((i, s) => {
78
+ if (!S(i)) {
79
+ t.push({ path: `cards[${s}]`, message: "must be a card." });
80
+ return;
81
+ }
82
+ typeof i.id != "string" || !i.id ? t.push({
83
+ path: `cards[${s}].id`,
84
+ message: "must be a non-empty string."
85
+ }) : n.has(i.id) ? t.push({
86
+ path: `cards[${s}].id`,
87
+ message: `duplicates card id '${i.id}'.`
88
+ }) : n.add(i.id), i.type !== "kpi" && t.push({ path: `cards[${s}].type`, message: "must be 'kpi'." });
89
+ });
90
+ }
91
+ const a = e.kpi;
92
+ return S(a) ? (a.layout !== "tiles" && a.layout !== "lines" ? t.push({
93
+ path: "kpi.layout",
94
+ message: "must be 'tiles' or 'lines'."
95
+ }) : a.layout === "tiles" && Array.isArray(r) && r.length > T && t.push({
96
+ path: "kpi.layout",
97
+ message: `must be 'lines' for more than ${T} KPI cards.`
98
+ }), a.columns !== void 0 && a.columns !== 1 && a.columns !== 2 && t.push({ path: "kpi.columns", message: "must be 1 or 2." })) : t.push({ path: "kpi", message: "must be an object." }), t;
99
+ }
100
+ const B = ["new", "edit", "delete", "create", "update", "remove"];
101
+ function M(e, t) {
102
+ return (e.sheets || []).flatMap(
103
+ (r) => O({ sheets: [r] }).filter(t).map((a) => ({
104
+ card: a.card,
105
+ sheet: r,
106
+ ...a.kind === "frameCard" && { frameId: a.frameId },
107
+ ...a.kind === "documentSectionCard" && {
108
+ sectionId: a.sectionId
109
+ }
110
+ }))
111
+ );
112
+ }
113
+ function m(e) {
114
+ return M(e, (t) => t.kind !== "documentSectionCard");
115
+ }
116
+ function se(e) {
117
+ return [
118
+ ...m(e),
119
+ ...M(e, (t) => t.kind === "documentSectionCard")
120
+ ];
121
+ }
122
+ function oe(e) {
123
+ return m(e).map((t) => t.card);
124
+ }
125
+ function de(e, t, r) {
126
+ return r && t === r ? !0 : !O(e).some(
127
+ (a) => a.cardId === t
128
+ );
129
+ }
130
+ function ce(e) {
131
+ return !e || e.trim().length === 0 ? { isValid: !1, error: "Card ID cannot be empty" } : e.length < 3 ? { isValid: !1, error: "Card ID must be at least 3 characters" } : e.length > 50 ? { isValid: !1, error: "Card ID must be less than 50 characters" } : /^[a-zA-Z0-9-_]+$/.test(e) ? /^[a-zA-Z0-9]/.test(e) ? B.includes(e.toLowerCase()) ? {
132
+ isValid: !1,
133
+ error: `"${e}" is a reserved keyword and cannot be used`
134
+ } : { isValid: !0 } : {
135
+ isValid: !1,
136
+ error: "Card ID must start with a letter or number"
137
+ } : {
138
+ isValid: !1,
139
+ error: "Card ID can only contain letters, numbers, hyphens, and underscores"
140
+ };
141
+ }
142
+ function ue(e, t) {
143
+ var r;
144
+ return (r = P(e, t)) == null ? void 0 : r.card;
145
+ }
146
+ function P(e, t) {
147
+ for (const r of m(e))
148
+ if (r.card.id === t)
149
+ return r;
150
+ }
151
+ function le(e, t) {
152
+ for (const r of e.sheets || [])
153
+ for (const a of r.frames || [])
154
+ for (const n of a.cards || [])
155
+ if (n.id === t)
156
+ return { card: n, sheet: r };
157
+ }
158
+ const h = {
159
+ includeMetricFilterDatasets: !0,
160
+ preferQualifiedIdentity: !1
161
+ };
162
+ function q(e) {
163
+ if (!e) return;
164
+ if (e.kind === "semantic")
165
+ return { entityName: e.datasetName, entityId: e.datasetId, label: e.label };
166
+ const t = [e.databaseName, e.schemaName, e.tableName].filter((r) => !!(r && r.trim())).join(".");
167
+ return {
168
+ entityName: e.tableName,
169
+ qualifiedEntityName: t.includes(".") ? t : void 0,
170
+ label: e.label
171
+ };
172
+ }
173
+ function z(e) {
174
+ var r;
175
+ const t = q(e.source);
176
+ return t ? `${(r = e.source) == null ? void 0 : r.kind}:${t.qualifiedEntityName || t.entityName}` : "";
177
+ }
178
+ function K(e) {
179
+ return [
180
+ e.id,
181
+ e.qualifiedEntityName,
182
+ e.entityId,
183
+ e.entityName,
184
+ e.qualifiedFieldName,
185
+ e.name,
186
+ // Source-only fields from different datasets can otherwise share a key
187
+ // and the second dataset would be silently dropped.
188
+ z(e)
189
+ ].join("|");
190
+ }
191
+ function U(e) {
192
+ return [e.entityName, e.qualifiedEntityName || "", e.entityId || ""].join("|");
193
+ }
194
+ function fe(e) {
195
+ return e.entityName || e.qualifiedEntityName || "";
196
+ }
197
+ function Q(e) {
198
+ var t, r;
199
+ return !!(e.expression || e.derivedField || (r = (t = e.calculatedFormula) == null ? void 0 : t.inputFields) != null && r.length);
200
+ }
201
+ function G(e) {
202
+ return R(e) ? !0 : e.entityName || e.qualifiedEntityName ? !1 : !e.source || Q(e);
203
+ }
204
+ function g(e, t) {
205
+ const r = U(t);
206
+ e.found.has(r) || e.found.set(r, t);
207
+ }
208
+ function p(e, t) {
209
+ var l, v, k;
210
+ if (!e) return;
211
+ const r = K(e);
212
+ if (t.visitedFields.has(r)) return;
213
+ t.visitedFields.add(r);
214
+ const a = G(e);
215
+ if (!a) {
216
+ const f = !e.entityName && !e.qualifiedEntityName ? q(e.source) : void 0;
217
+ g(
218
+ t,
219
+ f || {
220
+ // May be empty for qualified-only metadata; identity then comes from
221
+ // `qualifiedEntityName` (see `identityFor` and the calculator).
222
+ entityName: e.entityName || "",
223
+ entityId: e.entityId,
224
+ qualifiedEntityName: e.qualifiedEntityName,
225
+ label: e.source && e.source.kind === "semantic" ? e.source.label : void 0
226
+ }
227
+ );
228
+ }
229
+ t.includeMetricFilterDatasets && "parameters" in e && ((l = e.parameters) != null && l.filters) && E(e.parameters.filters, t);
230
+ const n = (v = e.calculatedFormula) == null ? void 0 : v.inputFields, i = !!(n && n.length > 0);
231
+ i && n.forEach((f) => p(f, t));
232
+ let s = !1, o = !1;
233
+ const d = i || (k = e.derivedField) == null ? void 0 : k.inputs;
234
+ if (d && Object.keys(d).length > 0)
235
+ for (const f of Object.values(d)) {
236
+ const c = f.field.source;
237
+ if (!c) {
238
+ i || (o = !0);
239
+ continue;
240
+ }
241
+ if (c.kind === "sql") {
242
+ o = !0;
243
+ continue;
244
+ }
245
+ if (c.kind === "semantic")
246
+ g(t, {
247
+ entityName: c.datasetName,
248
+ entityId: c.datasetId,
249
+ label: c.label
250
+ });
251
+ else {
252
+ const D = [c.databaseName, c.schemaName, c.tableName].filter((w) => !!(w && w.trim())).join(".");
253
+ g(t, {
254
+ entityName: c.tableName,
255
+ qualifiedEntityName: D.includes(".") ? D : void 0,
256
+ label: c.label
257
+ });
258
+ }
259
+ s = !0;
260
+ }
261
+ o && (t.complete = !1), a && !i && !s && (t.complete = !1);
262
+ }
263
+ function E(e, t) {
264
+ if (e && !t.visitedGroups.has(e.id)) {
265
+ t.visitedGroups.add(e.id);
266
+ for (const r of e.conditions || [])
267
+ p(r.field, t);
268
+ for (const r of e.groups || [])
269
+ E(r, t);
270
+ }
271
+ }
272
+ function b(e, t = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set()) {
273
+ return {
274
+ found: /* @__PURE__ */ new Map(),
275
+ complete: !0,
276
+ visitedFields: t,
277
+ visitedGroups: r,
278
+ includeMetricFilterDatasets: e
279
+ };
280
+ }
281
+ function N(e, t) {
282
+ var a;
283
+ const r = (a = e.qualifiedEntityName) != null && a.includes(".") ? e.qualifiedEntityName : void 0;
284
+ return t === "qualifiedOnly" ? r : t === "preferQualified" ? r || e.entityName || void 0 : e.entityName || void 0;
285
+ }
286
+ function me(e) {
287
+ const t = b(!1);
288
+ return p(e, t), { datasets: Array.from(t.found.values()), complete: t.complete };
289
+ }
290
+ function V(e, t, r = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), n = h) {
291
+ const i = { ...h, ...n }, s = b(i.includeMetricFilterDatasets, r, a);
292
+ p(e, s), s.found.forEach((o) => {
293
+ const d = N(o, i.preferQualifiedIdentity ? "preferQualified" : "name");
294
+ d && t.add(d);
295
+ });
296
+ }
297
+ function pe(e, t) {
298
+ V(e, t, /* @__PURE__ */ new Set(), /* @__PURE__ */ new Set(), {
299
+ preferQualifiedIdentity: !0
300
+ });
301
+ }
302
+ function ye(e, t, r = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set()) {
303
+ const n = b(!0, r, a);
304
+ p(e, n), n.found.forEach((i) => {
305
+ const s = N(i, "qualifiedOnly");
306
+ s && t.add(s);
307
+ });
308
+ }
309
+ function he(e, t, r = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set()) {
310
+ V(e, t, r, a, {
311
+ includeMetricFilterDatasets: !1
312
+ });
313
+ }
314
+ function be(e, t, r = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), n = h) {
315
+ const i = { ...h, ...n }, s = b(i.includeMetricFilterDatasets, r, a);
316
+ E(e, s), s.found.forEach((o) => {
317
+ const d = N(o, i.preferQualifiedIdentity ? "preferQualified" : "name");
318
+ d && t.add(d);
319
+ });
320
+ }
321
+ function Ie(e, t) {
322
+ return t != null && t[e] ? t[e] : (e.includes(".") ? e.slice(e.lastIndexOf(".") + 1) : e).replace(/[_-]+/g, " ").replace(/([a-z])([A-Z])/g, "$1 $2").replace(/\s+/g, " ").trim().replace(/\b\w/g, (a) => a.toUpperCase());
323
+ }
324
+ const Se = {
325
+ database: null,
326
+ schema: null,
327
+ table: null
328
+ }, ge = "__card_default__", L = {
329
+ bookmarksPerViewerPerDashboard: 20,
330
+ bookmarkNameMaxChars: 100,
331
+ columnLabelMaxChars: 120,
332
+ tableSettingsMaxBytes: 65536,
333
+ rememberedTableSettingsMaxBytes: 262144,
334
+ bookmarkStateMaxBytes: 65536
335
+ }, W = 1;
336
+ function Ce(e) {
337
+ return new TextEncoder().encode(JSON.stringify(e ?? null)).length;
338
+ }
339
+ function J(e) {
340
+ const t = encodeURIComponent;
341
+ switch (e.kind) {
342
+ case "dimension":
343
+ return `dim:${e.role}:${t(e.fieldId)}`;
344
+ case "metric":
345
+ return `metric:${t(e.metricId)}:${t(
346
+ e.metricAlias
347
+ )}`;
348
+ case "result":
349
+ return `result:${t(e.key)}`;
350
+ }
351
+ }
352
+ function y(e) {
353
+ if (e)
354
+ try {
355
+ return decodeURIComponent(e);
356
+ } catch {
357
+ return;
358
+ }
359
+ }
360
+ function Y(e) {
361
+ if (typeof e != "string") return;
362
+ const t = e.split(":");
363
+ let r;
364
+ if (t[0] === "dim" && t.length === 3) {
365
+ const a = t[1], n = y(t[2]);
366
+ (a === "detail" || a === "groupby") && n && (r = { kind: "dimension", role: a, fieldId: n });
367
+ } else if (t[0] === "metric" && t.length === 3) {
368
+ const a = y(t[1]), n = y(t[2]);
369
+ a && n && (r = { kind: "metric", metricId: a, metricAlias: n });
370
+ } else if (t[0] === "result" && t.length === 2) {
371
+ const a = y(t[1]);
372
+ a && (r = { kind: "result", key: a });
373
+ }
374
+ return r && J(r) === e ? r : void 0;
375
+ }
376
+ function C(e) {
377
+ return typeof e == "string" && Y(e) !== void 0;
378
+ }
379
+ const A = u.array(u.string()).max(2e3), Z = u.object({
380
+ order: A.optional(),
381
+ hidden: A.optional(),
382
+ labels: u.record(u.string(), u.string().max(L.columnLabelMaxChars)).optional(),
383
+ sort: u.array(
384
+ u.object({
385
+ columnId: u.string(),
386
+ direction: u.enum(["asc", "desc"])
387
+ }).strict()
388
+ ).max(2e3).optional()
389
+ }).strict();
390
+ function _(e) {
391
+ const t = /* @__PURE__ */ new Set(), r = [];
392
+ for (const a of e)
393
+ !C(a) || t.has(a) || (t.add(a), r.push(a));
394
+ return r;
395
+ }
396
+ function $(e) {
397
+ if (!e) return;
398
+ const t = e.order ? _(e.order) : void 0, r = e.hidden ? _(e.hidden) : void 0, a = Object.entries(e.labels ?? {}).flatMap(
399
+ ([o, d]) => {
400
+ const l = typeof d == "string" ? d.trim() : "";
401
+ return C(o) && l ? [
402
+ [
403
+ o,
404
+ l.slice(0, L.columnLabelMaxChars)
405
+ ]
406
+ ] : [];
407
+ }
408
+ ), n = /* @__PURE__ */ new Set(), i = e.sort ? e.sort.filter((o) => !C(o.columnId) || n.has(o.columnId) ? !1 : (n.add(o.columnId), !0)) : void 0, s = {};
409
+ return t != null && t.length && (s.order = t), r != null && r.length && (s.hidden = r), a.length && (s.labels = Object.fromEntries(a)), i && (s.sort = i.map(({ columnId: o, direction: d }) => ({
410
+ columnId: o,
411
+ direction: d
412
+ }))), Object.keys(s).length ? s : void 0;
413
+ }
414
+ function X(e) {
415
+ return $(e) === void 0;
416
+ }
417
+ function H(e, t) {
418
+ if (t !== W)
419
+ return {
420
+ ok: !1,
421
+ error: `Unsupported table settings version ${t}.`
422
+ };
423
+ const r = Z.safeParse(e);
424
+ return r.success ? {
425
+ ok: !0,
426
+ value: $(r.data) ?? {}
427
+ } : { ok: !1, error: "Table settings are invalid." };
428
+ }
429
+ function Ee(e, t, r) {
430
+ if (!e || typeof e != "object" || Array.isArray(e)) return {};
431
+ const a = {};
432
+ for (const [n, i] of Object.entries(
433
+ e
434
+ )) {
435
+ if (!r.has(n)) continue;
436
+ const s = H(i, t);
437
+ s.ok && !X(s.value) && (a[n] = s.value);
438
+ }
439
+ return a;
440
+ }
441
+ const ee = /* @__PURE__ */ new Set([
442
+ "table",
443
+ "detailTable"
444
+ ]);
445
+ function x(e) {
446
+ return ee.has(e.type);
447
+ }
448
+ function te(e) {
449
+ var t, r;
450
+ return x(e) && ((r = (t = e.preferences) == null ? void 0 : t.tablePrefs) == null ? void 0 : r.allowViewerColumnCustomization) !== !1;
451
+ }
452
+ function Ne(e) {
453
+ return new Set(
454
+ m(e).filter(({ card: t }) => x(t)).map(({ card: t }) => t.id)
455
+ );
456
+ }
457
+ function ve(e) {
458
+ return new Set(
459
+ m(e).filter(({ card: t }) => te(t)).map(({ card: t }) => t.id)
460
+ );
461
+ }
462
+ export {
463
+ P as A,
464
+ ue as B,
465
+ ge as C,
466
+ F as D,
467
+ Se as E,
468
+ oe as F,
469
+ m as G,
470
+ se as H,
471
+ de as I,
472
+ ce as J,
473
+ le as K,
474
+ L as V,
475
+ fe as a,
476
+ pe as b,
477
+ V as c,
478
+ q as d,
479
+ ye as e,
480
+ he as f,
481
+ be as g,
482
+ Ie as h,
483
+ W as i,
484
+ X as j,
485
+ H as k,
486
+ Ee as l,
487
+ Ce as m,
488
+ $ as n,
489
+ x as o,
490
+ Y as p,
491
+ te as q,
492
+ me as r,
493
+ Ne as s,
494
+ J as t,
495
+ ve as u,
496
+ O as v,
497
+ T as w,
498
+ j as x,
499
+ ne as y,
500
+ ie as z
501
+ };