react-semaphor 0.1.540 → 0.1.542

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 (118) 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 +50 -45
  5. package/dist/chunks/apply-dashboard-operations-Btbp2-6v.js +2260 -0
  6. package/dist/chunks/{assistant-chat-ya7xopaC.js → assistant-chat-oHF5lTjA.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-ChIyd_-L.js +1618 -0
  10. package/dist/chunks/custom-visual-inputs-DUtpYZOk.js +323 -0
  11. package/dist/chunks/{dashboard-briefing-launcher-DJI-zfEq.js → dashboard-briefing-launcher-B-cm719R.js} +18 -18
  12. package/dist/chunks/{dashboard-controls-Dh7HqoKy.js → dashboard-controls-CIn22Qgp.js} +69 -70
  13. package/dist/chunks/{dashboard-filter-value-compatibility-D95O4nd7.js → dashboard-filter-value-compatibility-CwQ_iSNb.js} +2 -2
  14. package/dist/chunks/{dashboard-json-BnmlB71h.js → dashboard-json-ZUYsIExq.js} +4 -4
  15. package/dist/chunks/{dashboard-B6Bithfl.js → dashboard-s5WJBcK8.js} +1 -1
  16. package/dist/chunks/{document-dashboard-inputs-BrYYlRVo.js → document-dashboard-inputs-C6MJVyoI.js} +2357 -4948
  17. package/dist/chunks/document-sheet-utils-BsZUnHRl.js +3619 -0
  18. package/dist/chunks/{edit-dashboard-visual-CydOkSko.js → edit-dashboard-visual-DLdereA7.js} +728 -728
  19. package/dist/chunks/{filter-value-text-BhWugPWE.js → filter-value-text-CYsVYPuD.js} +18 -19
  20. package/dist/chunks/index-CV5rHq5D.js +2673 -0
  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-BSAqPpHt.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-BBlAfBA0.js +1155 -0
  31. package/dist/chunks/raw-temporal-presentation-CZ2r0Vb_.js +585 -0
  32. package/dist/chunks/{report-preferences-dialog-neMDolLg.js → report-preferences-dialog-MRUWpMcJ.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-CCrLpfSQ.js → saved-dashboard-context-DjPqgFly.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--4DWtVBu.js → semaphor-ready-indicator-BWSpRsPj.js} +38555 -40449
  37. package/dist/chunks/{shelf-drop-preview-context-CpdB5ois.js → shelf-drop-preview-context-CQbFLm3q.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-BHSnuZHd.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-8g6Zhphh.js → use-create-flow-overlay-state-BJDNqdOh.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 +399 -380
  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 -238
  53. package/dist/index.js +174 -175
  54. package/dist/pdf-export-policy/index.js +20 -10
  55. package/dist/report-runtime-context/index.js +1 -1
  56. package/dist/surfboard/index.js +2 -2
  57. package/dist/types/briefings/attachment-outcomes.d.ts +23 -0
  58. package/dist/types/briefings/attachments.d.ts +17 -1
  59. package/dist/types/briefings/index.d.ts +6 -3
  60. package/dist/types/index.js +48 -48
  61. package/dist/types/lib/api/exports-api.d.ts +11 -65
  62. package/dist/types/lib/dashboard-inputs/control-contract-overrides.d.ts +17 -0
  63. package/dist/types/lib/dashboard-viewer/export-table-view.d.ts +2 -0
  64. package/dist/types/lib/hooks/use-dashboard-card.d.ts +2 -0
  65. package/dist/types/lib/hooks/use-dashboard.d.ts +3 -6
  66. package/dist/types/lib/matrix-table/matrix-delivery-policy.d.ts +8 -2
  67. package/dist/types/lib/matrix-table/matrix-delivery.d.ts +8 -6
  68. package/dist/types/lib/query-context/build-dashboard-card-query-contract.d.ts +50 -0
  69. package/dist/types/lib/query-context/card-server-request.d.ts +5 -1
  70. package/dist/types/lib/types/common-types.d.ts +7 -0
  71. package/dist/types/lib/types/explorer-types.d.ts +8 -2
  72. package/dist/types/shared/analytics-protocol/matrix-definition-contract.d.ts +3 -3
  73. package/dist/types/shared/assistant-context/index.d.ts +1 -1
  74. package/dist/types/shared/assistant-context/saved-dashboard-context.d.ts +23 -6
  75. package/dist/types/shared/dashboard-authoring/card-export-request.d.ts +173 -0
  76. package/dist/types/shared/dashboard-authoring/card-query-request.d.ts +20 -0
  77. package/dist/types/shared/dashboard-authoring/index.d.ts +1 -0
  78. package/dist/types/shared/dashboard-authoring/matrix-delivery.d.ts +4 -3
  79. package/dist/types/shared/format-utils/attachment-filter-line.d.ts +14 -0
  80. package/dist/types/shared/format-utils/exporters/export-cells.d.ts +90 -0
  81. package/dist/types/shared/format-utils/exporters/export-file-format.d.ts +44 -0
  82. package/dist/types/shared/format-utils/exporters/index.d.ts +6 -0
  83. package/dist/types/shared/format-utils/exporters/xlsx-file.d.ts +90 -0
  84. package/dist/types/shared/format-utils/filter-line.d.ts +7 -0
  85. package/dist/types/shared/format-utils/formatters/date-formatter.d.ts +8 -12
  86. package/dist/types/shared/format-utils/formatters/index.d.ts +1 -1
  87. package/dist/types/shared/format-utils/formatters/matrix-formatter.d.ts +2 -0
  88. package/dist/types/shared/format-utils/index.d.ts +3 -0
  89. package/dist/types/shared/format-utils/matrix-continuation.d.ts +55 -9
  90. package/dist/types/shared/format-utils/matrix-export-presentation.d.ts +21 -1
  91. package/dist/types/shared/format-utils/matrix-export-xlsx.d.ts +27 -0
  92. package/dist/types/shared/format-utils/pdf-export-policy.d.ts +9 -0
  93. package/dist/types/shared/format-utils/presentation-execution.d.ts +27 -2
  94. package/dist/types/shared/format-utils/raw-temporal.d.ts +8 -0
  95. package/dist/types/shared/format-utils/table-export/index.d.ts +8 -0
  96. package/dist/types/shared/format-utils/table-export/prepare-table-export.d.ts +50 -0
  97. package/dist/types/shared/format-utils/table-export/table-export-formatting.d.ts +47 -0
  98. package/dist/types/shared/format-utils/table-export/table-export-raw-temporal.d.ts +40 -0
  99. package/dist/types/shared/format-utils/table-export/table-export-result.d.ts +31 -0
  100. package/dist/types/shared/format-utils/table-export/table-export-sheet.d.ts +38 -0
  101. package/dist/types/shared/format-utils/temporal-bucket.d.ts +9 -0
  102. package/package.json +2 -1
  103. package/dist/chunks/aggregate-table-row-presentation-BjK9YfMI.js +0 -979
  104. package/dist/chunks/apply-dashboard-operations-C-iahGka.js +0 -402
  105. package/dist/chunks/bookmark-state-k7y5SNGf.js +0 -331
  106. package/dist/chunks/calculated-field-identity-DcBS2NPP.js +0 -2161
  107. package/dist/chunks/canonical-result-keys-CEQefvdO.js +0 -33
  108. package/dist/chunks/common-types-CUf03Htv.js +0 -288
  109. package/dist/chunks/csv-utils-GUfKyT1J.js +0 -56
  110. package/dist/chunks/custom-visual-inputs-BrUOIwln.js +0 -3288
  111. package/dist/chunks/document-sheet-utils-C1eEldxs.js +0 -1076
  112. package/dist/chunks/index-CqMiAkay.js +0 -3164
  113. package/dist/chunks/matrix-definition-DQDI2okF.js +0 -206
  114. package/dist/chunks/metric-comparison-CojWeLqx.js +0 -392
  115. package/dist/chunks/pivot-result-lifecycle-8qCDmpKc.js +0 -804
  116. package/dist/chunks/raw-temporal-D61lr48Y.js +0 -1464
  117. package/dist/chunks/temporal-bucket-D8JF7zKz.js +0 -575
  118. package/dist/chunks/temporal-bucket-contract-DaOajRC7.js +0 -108
@@ -1,402 +0,0 @@
1
- import { e as b, t as R } from "./document-sheet-utils-C1eEldxs.js";
2
- import { f as C, e as w } from "./validators-Ej1DdCXa.js";
3
- import { duplicateLayoutItem as E, addToLayout as _ } from "../layouts/index.js";
4
- const M = (e, t) => {
5
- const r = {};
6
- if (e === null || t === null)
7
- return t;
8
- const s = /* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(t)]);
9
- for (const a of s) {
10
- if (!(a in e) && a in t) {
11
- r[a] = t[a];
12
- continue;
13
- }
14
- if (a in e && !(a in t)) {
15
- r[a] = void 0;
16
- continue;
17
- }
18
- const n = e[a], o = t[a];
19
- if (!g(n, o))
20
- if (Array.isArray(n) && Array.isArray(o))
21
- r[a] = o;
22
- else if (A(n) && A(o)) {
23
- const d = M(n, o);
24
- Object.keys(d).length > 0 && (r[a] = d);
25
- } else
26
- r[a] = o;
27
- }
28
- return r;
29
- }, g = (e, t) => {
30
- if (e === t) return !0;
31
- if (e && t && typeof e == "object" && typeof t == "object") {
32
- if (Array.isArray(e) && Array.isArray(t))
33
- return e.length !== t.length ? !1 : e.every((a, n) => g(a, t[n]));
34
- const r = Object.keys(e), s = Object.keys(t);
35
- return r.length !== s.length ? !1 : r.every((a) => g(e[a], t[a]));
36
- }
37
- return !1;
38
- }, A = (e) => e !== null && typeof e == "object" && !Array.isArray(e), m = (e) => {
39
- if (e === null || typeof e != "object")
40
- return e;
41
- if (e instanceof Date)
42
- return new Date(e);
43
- if (e instanceof RegExp)
44
- return new RegExp(e);
45
- if (Array.isArray(e))
46
- return e.map((r) => m(r));
47
- const t = {};
48
- for (const r in e)
49
- Object.prototype.hasOwnProperty.call(e, r) && (t[r] = m(e[r]));
50
- return t;
51
- }, I = { kind: "allSheets" }, u = (e, t) => (t == null ? void 0 : t[e]) ?? e;
52
- function k(e, t) {
53
- switch (e.kind) {
54
- case "cards":
55
- return {
56
- kind: "cards",
57
- cardIds: e.cardIds.map((r) => u(r, t.cardIds))
58
- };
59
- case "sheets":
60
- return {
61
- kind: "sheets",
62
- sheetIds: e.sheetIds.map((r) => u(r, t.sheetIds))
63
- };
64
- case "documentSections":
65
- return {
66
- ...e,
67
- sheetId: u(e.sheetId, t.sheetIds),
68
- sectionIds: e.sectionIds.map((r) => u(r, t.sectionIds))
69
- };
70
- default:
71
- return e;
72
- }
73
- }
74
- function x(e, t) {
75
- return {
76
- ...e,
77
- targets: k(e.targets, t),
78
- cardMappings: e.cardMappings.map((r) => ({
79
- ...r,
80
- cardId: u(r.cardId, t.cardIds)
81
- }))
82
- };
83
- }
84
- function z(e, t) {
85
- return {
86
- ...e.targets !== void 0 ? { targets: e.targets && k(e.targets, t) } : {},
87
- ...e.cardMappings !== void 0 ? {
88
- cardMappings: e.cardMappings && e.cardMappings.map((r) => ({
89
- ...r,
90
- cardId: u(r.cardId, t.cardIds)
91
- }))
92
- } : {}
93
- };
94
- }
95
- function V(e, t) {
96
- return t ? {
97
- ...e,
98
- targets: t.targets === void 0 ? e.targets : t.targets ?? I,
99
- cardMappings: t.cardMappings === void 0 ? e.cardMappings : t.cardMappings ?? []
100
- } : e;
101
- }
102
- const f = (e, t) => JSON.stringify(e) === JSON.stringify(t);
103
- function X(e, t) {
104
- const r = {};
105
- return f(e.targets, t.targets) || (r.targets = f(e.targets, I) ? null : e.targets), f(e.cardMappings, t.cardMappings) || (r.cardMappings = e.cardMappings.length ? e.cardMappings : null), Object.keys(r).length ? r : void 0;
106
- }
107
- function Q(e, t) {
108
- return {
109
- ...e,
110
- targets: (t == null ? void 0 : t.targets) ?? I,
111
- cardMappings: (t == null ? void 0 : t.cardMappings) ?? []
112
- };
113
- }
114
- function Z(e) {
115
- const t = Object.values(e.linkedInteractionTargetOverrides ?? {});
116
- if (!t.length) return;
117
- const r = {};
118
- if (t.some(
119
- (n) => n.applyToCardIds !== void 0
120
- )) {
121
- const n = t.flatMap(
122
- (o) => Array.isArray(o.applyToCardIds) ? [o.applyToCardIds] : []
123
- );
124
- r.targets = n.length === t.length ? { kind: "cards", cardIds: [...new Set(n.flat())] } : null;
125
- }
126
- const a = t.filter((n) => !Array.isArray(n.applyToCardIds));
127
- if (a.some((n) => n.excludeCardIds !== void 0)) {
128
- const n = [
129
- ...new Set(a.flatMap((o) => o.excludeCardIds ?? []))
130
- ].filter(
131
- (o) => a.every((d) => {
132
- var i;
133
- return (i = d.excludeCardIds) == null ? void 0 : i.includes(o);
134
- })
135
- );
136
- r.cardMappings = n.length ? n.map(
137
- (o) => ({ kind: "excluded", cardId: o })
138
- ) : null;
139
- }
140
- return Object.keys(r).length ? r : void 0;
141
- }
142
- function D(e, t) {
143
- var a;
144
- const r = (a = e.controlBindings) == null ? void 0 : a.map((n) => ({
145
- ...n,
146
- controlId: t.get(n.controlId) ?? n.controlId
147
- })), s = b(e).flatMap(
148
- ({ paramId: n, controlId: o }) => {
149
- var i;
150
- const d = t.get(o);
151
- return !d || d === o || (i = e.controlBindings) != null && i.some(
152
- (c) => c.target === "sql_param" && c.paramId === n
153
- ) ? [] : [{ target: "sql_param", paramId: n, controlId: d }];
154
- }
155
- );
156
- return s.length ? [...r ?? [], ...s] : r;
157
- }
158
- function T(e, t) {
159
- var a, n;
160
- const r = e.source === "dashboardInputAlias" ? ((a = t.inputAliases) == null ? void 0 : a[e.variableName]) ?? e : e, s = e.source === "dashboardInputAlias" && r !== e ? { ...r, export: e.export ?? "label" } : r;
161
- return s.source === "dashboardInput" ? {
162
- ...s,
163
- inputId: ((n = t.inputIds) == null ? void 0 : n[s.inputId]) ?? s.inputId
164
- } : s;
165
- }
166
- function q(e, t) {
167
- var a;
168
- const r = {};
169
- for (const n of [
170
- "cardIds",
171
- "sheetIds",
172
- "inputIds",
173
- "controlIds",
174
- "filterIds"
175
- ]) {
176
- const o = { ...t[n] };
177
- for (const [d, i] of Object.entries((e == null ? void 0 : e[n]) ?? {}))
178
- o[d] = ((a = t[n]) == null ? void 0 : a[i]) ?? i;
179
- Object.keys(o).length && (r[n] = o);
180
- }
181
- const s = { ...t.inputAliases };
182
- for (const [n, o] of Object.entries((e == null ? void 0 : e.inputAliases) ?? {}))
183
- s[n] = T(o, t);
184
- return Object.keys(s).length && (r.inputAliases = s), r;
185
- }
186
- function v(e, t) {
187
- var a, n, o, d;
188
- const r = m(e);
189
- r.controlBindings = D(
190
- e,
191
- new Map(Object.entries(t.controlIds ?? {}))
192
- );
193
- for (const i of r.controls ?? [])
194
- i.id = ((a = t.controlIds) == null ? void 0 : a[i.id]) ?? i.id;
195
- for (const i of r.inlineFilters ?? [])
196
- i.id = ((n = t.filterIds) == null ? void 0 : n[i.id]) ?? i.id;
197
- const s = (i) => {
198
- var h, y, O;
199
- if (!i || typeof i != "object") return;
200
- if (Array.isArray(i)) {
201
- i.forEach(s);
202
- return;
203
- }
204
- const c = i;
205
- if (c.type === "variable" && c.ref && typeof c.ref == "object") {
206
- const l = c.ref;
207
- c.ref = l.source === "input" ? { ...l, inputId: ((h = t.inputIds) == null ? void 0 : h[l.inputId]) ?? l.inputId } : T(l, t);
208
- }
209
- if (typeof c.entityId == "string") {
210
- const l = c.entityId;
211
- c.fieldScope === "card" && (c.entityId = ((y = t.cardIds) == null ? void 0 : y[l]) ?? l), c.fieldScope === "sheet" && (c.entityId = ((O = t.sheetIds) == null ? void 0 : O[l]) ?? l);
212
- }
213
- for (const [l, F] of Object.entries(c))
214
- l !== "linkedReferenceOverrides" && s(F);
215
- };
216
- s(r), r.clickToFilter && (r.clickToFilter = x(r.clickToFilter, t));
217
- for (const i of Object.values(
218
- ((o = r.customCardPreferences) == null ? void 0 : o.dataInputCardIds) ?? {}
219
- ))
220
- i.cardId = ((d = t.cardIds) == null ? void 0 : d[i.cardId]) ?? i.cardId;
221
- return r;
222
- }
223
- const ee = [
224
- "lg",
225
- "md",
226
- "sm",
227
- "xs",
228
- "xxs"
229
- ], te = 15, j = /\{\{-?\s*filters\s*\|\s*where\s*-?\}\}/i, N = /\{\{-?\s*filters\s*\|\s*and\s*-?\}\}/i, P = /\bwhere\b/i;
230
- function S(e) {
231
- return e != null && e.trim() ? j.test(e) || N.test(e) : !1;
232
- }
233
- function re(e) {
234
- return !(e != null && e.trim()) || S(e) ? null : P.test(e) ? {
235
- helper: "{{ filters | and }}",
236
- description: "For queries with an existing WHERE clause."
237
- } : {
238
- helper: "{{ filters | where }}",
239
- description: "For queries without a WHERE clause."
240
- };
241
- }
242
- function L(e, t, r) {
243
- if (C(
244
- w(t),
245
- e.aggregateOrigin
246
- ))
247
- return { aggregate: void 0, aggregateOrigin: void 0 };
248
- const s = r === "selection" && e.role === "metric" ? t.aggregate : void 0;
249
- return {
250
- aggregate: e.aggregate ?? s,
251
- aggregateOrigin: e.aggregate ? e.aggregateOrigin : s ? t.aggregateOrigin : void 0
252
- };
253
- }
254
- function B(e, t, r) {
255
- var s, a, n, o, d, i;
256
- if (r === "domain")
257
- return {
258
- filters: (s = t.parameters) == null ? void 0 : s.filters,
259
- windowTransform: (a = e.parameters) == null ? void 0 : a.windowTransform
260
- };
261
- if (!(!e.parameters && !t.parameters))
262
- return {
263
- filters: ((n = e.parameters) == null ? void 0 : n.filters) ?? ((o = t.parameters) == null ? void 0 : o.filters),
264
- windowTransform: ((d = e.parameters) == null ? void 0 : d.windowTransform) ?? ((i = t.parameters) == null ? void 0 : i.windowTransform)
265
- };
266
- }
267
- function ne(e, t, r) {
268
- const s = e;
269
- return {
270
- id: e.id,
271
- role: e.role,
272
- // Result-column names belong to the selection's consumer (for example,
273
- // range bounds). They do not identify or redefine the catalog calculation.
274
- ...r === "selection" && e.alias ? { alias: e.alias } : {},
275
- granularity: e.granularity ?? t.granularity,
276
- dateFormat: e.dateFormat,
277
- customFormat: e.customFormat,
278
- semanticTemporalPresentation: t.semanticTemporalPresentation || e.semanticTemporalPresentation,
279
- ...L(e, t, r),
280
- ...e.role === "metric" ? {
281
- aliasTemplate: s.aliasTemplate,
282
- valueAliases: s.valueAliases,
283
- comparison: s.comparison,
284
- comparisonPolarity: s.comparisonPolarity,
285
- parameters: B(
286
- s,
287
- t,
288
- "domain"
289
- )
290
- } : {},
291
- ...H(e)
292
- };
293
- }
294
- function H(e) {
295
- const t = {
296
- ...e.labelOrigin === "override" ? { label: e.label, labelOrigin: e.labelOrigin } : {},
297
- ...e.formatOrigin === "override" ? { format: e.format, formatOrigin: e.formatOrigin } : {}
298
- };
299
- switch (e.role) {
300
- case "pivotby":
301
- return {
302
- ...t,
303
- memberOrder: e.memberOrder
304
- };
305
- case "sortby":
306
- return {
307
- ...t,
308
- direction: e.direction
309
- };
310
- case "detail":
311
- return {
312
- ...t,
313
- ...e.dateFormat !== void 0 ? { dateFormat: e.dateFormat } : {},
314
- ...e.customFormat !== void 0 ? { customFormat: e.customFormat } : {}
315
- };
316
- default:
317
- return t;
318
- }
319
- }
320
- const W = "table";
321
- function ae({ preferences: e, ...t }) {
322
- return {
323
- ...t,
324
- type: W,
325
- preferences: e ?? { onClickFilter: [{ columnIndex: 0, expression: "" }] },
326
- sql: "",
327
- data: []
328
- };
329
- }
330
- function se(e, t) {
331
- let r = e;
332
- for (const [s, a] of t.entries()) {
333
- const n = G(r, a);
334
- if (!n.ok)
335
- return { ok: !1, failedAt: { index: s, op: a.op, ...n.failure } };
336
- r = n.dashboard;
337
- }
338
- return { ok: !0, dashboard: r };
339
- }
340
- function G(e, t) {
341
- const r = e.sheets ?? [], s = r.findIndex((i) => i.id === t.sheetId), a = r[s];
342
- if (!a)
343
- return p("sheet_not_found", `No sheet ${t.sheetId} on this dashboard.`);
344
- if (R(a))
345
- return p("sheet_not_a_grid", "This sheet is a document: add to it through the document.");
346
- const { frame: n } = t;
347
- if (r.some((i) => (i.frames ?? []).some((c) => c.id === n.id)))
348
- return p("frame_id_taken", `A frame with id ${n.id} is already on this dashboard.`);
349
- const o = t.placement ?? "end", d = {
350
- ...a,
351
- frames: U(a.frames ?? [], n, o),
352
- layouts: J(a, n, o)
353
- };
354
- return {
355
- ok: !0,
356
- dashboard: {
357
- ...e,
358
- sheets: r.map((i, c) => c === s ? d : i)
359
- }
360
- };
361
- }
362
- function U(e, t, r) {
363
- if (r === "start") return [t, ...e];
364
- if (r === "end") return [...e, t];
365
- const s = e.findIndex((a) => a.id === r.beside);
366
- return s < 0 ? [...e, t] : [...e.slice(0, s + 1), t, ...e.slice(s + 1)];
367
- }
368
- function J(e, t, r) {
369
- return (typeof r == "object" ? E({ sourceId: r.beside, duplicatedId: t.id, layouts: e.layouts }) : void 0) ?? _({
370
- id: t.id,
371
- layouts: e.layouts,
372
- x: 0,
373
- y: r === "start" ? 0 : 1 / 0,
374
- frame: t
375
- });
376
- }
377
- function p(e, t) {
378
- return { ok: !1, failure: { code: e, message: t } };
379
- }
380
- export {
381
- te as D,
382
- W as N,
383
- ee as a,
384
- q as b,
385
- m as c,
386
- v as d,
387
- z as e,
388
- V as f,
389
- re as g,
390
- S as h,
391
- X as i,
392
- L as j,
393
- B as k,
394
- ne as l,
395
- H as m,
396
- Z as n,
397
- ae as o,
398
- se as p,
399
- M as q,
400
- x as r,
401
- Q as s
402
- };