react-semaphor 0.1.536 → 0.1.538

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 (173) hide show
  1. package/dist/analytics-protocol/index.js +352 -341
  2. package/dist/assistant-context/index.js +10 -0
  3. package/dist/assistant-protocol/index.js +104 -0
  4. package/dist/brand-studio/index.js +35 -31
  5. package/dist/briefings/index.js +46 -45
  6. package/dist/chunks/_commonjsHelpers-BkfeUUK-.js +28 -0
  7. package/dist/chunks/add-to-dashboard-CxtTfISD.js +56 -0
  8. package/dist/chunks/aggregate-table-row-presentation-Qgpv6_G8.js +979 -0
  9. package/dist/chunks/analytics-base-schemas-BFAoRlkU.js +472 -0
  10. package/dist/chunks/apply-dashboard-operations-C-iahGka.js +402 -0
  11. package/dist/chunks/assistant-chat-BAqUIFp5.js +7966 -0
  12. package/dist/chunks/availability-Bp5Gfu1I.js +44 -0
  13. package/dist/chunks/{bookmark-state-B-I9BDD0.js → bookmark-state-k7y5SNGf.js} +9 -9
  14. package/dist/chunks/{braces-8TRlDwDw.js → braces-o9UiRQes.js} +1 -1
  15. package/dist/chunks/calculated-field-identity-DcBS2NPP.js +2161 -0
  16. package/dist/chunks/calendar-day-equality-Bpl15IBo.js +487 -0
  17. package/dist/chunks/class-utils-Df1OVOT1.js +2315 -0
  18. package/dist/chunks/{field-dependencies-CpRUwr9J.js → common-types-CUf03Htv.js} +65 -58
  19. package/dist/chunks/context-HD9usB1P.js +349 -0
  20. package/dist/chunks/conversation-sQiWYUOb.js +16 -0
  21. package/dist/chunks/csv-utils-GUfKyT1J.js +56 -0
  22. package/dist/chunks/custom-visual-inputs-BrUOIwln.js +3288 -0
  23. package/dist/chunks/{dashboard-BTDY_I5L.js → dashboard-DTDDFQsS.js} +1 -1
  24. package/dist/chunks/{dashboard-briefing-launcher-DV_rlhT2.js → dashboard-briefing-launcher-Bb2QUqOa.js} +764 -740
  25. package/dist/chunks/{dashboard-controls-B4LxN5dr.js → dashboard-controls-FpONU8QV.js} +683 -686
  26. package/dist/chunks/{common-types-g7yS12Cg.js → dashboard-filter-value-compatibility-D95O4nd7.js} +18 -24
  27. package/dist/chunks/dashboard-json-DazPhBU_.js +69 -0
  28. package/dist/chunks/document-dashboard-inputs-D96rlU7S.js +10678 -0
  29. package/dist/chunks/document-sheet-utils-C1eEldxs.js +1076 -0
  30. package/dist/chunks/{edit-dashboard-visual-L5zsle6X.js → edit-dashboard-visual-CIhZodVH.js} +4744 -4746
  31. package/dist/chunks/editor-draft-sync-BN5qYHPF.js +15 -0
  32. package/dist/chunks/filter-value-text-BhWugPWE.js +163 -0
  33. package/dist/chunks/index-CqMiAkay.js +3164 -0
  34. package/dist/chunks/index-CuHybtft.js +51 -0
  35. package/dist/chunks/layout-grid-Bgzth8vd.js +16 -0
  36. package/dist/chunks/{matrix-analytical-definition-CgBTD6H8.js → matrix-analytical-definition-bcprSe4u.js} +1 -1
  37. package/dist/chunks/{matrix-card-CAdizkUl.js → matrix-card-CJn1hB5V.js} +13 -12
  38. package/dist/chunks/matrix-definition-DQDI2okF.js +206 -0
  39. package/dist/chunks/{matrix-formatter-DJCk8Znf.js → matrix-formatter-Bgw32tb3.js} +648 -457
  40. package/dist/chunks/matrix-member-presentation-BNPSDKBG.js +105 -0
  41. package/dist/chunks/{matrix-operation-contract-BKupLHXL.js → matrix-operation-contract-B8PBF1Gd.js} +134 -133
  42. package/dist/chunks/{metric-comparison-BKHyvnAy.js → metric-comparison-CojWeLqx.js} +1 -1
  43. package/dist/chunks/{palette-Cp1hqZtm.js → palette-D10o_yYX.js} +1 -1
  44. package/dist/chunks/pivot-header-presentation-MkcKnjn3.js +42 -0
  45. package/dist/chunks/{pivot-result-identity-Bs4tLtLo.js → pivot-result-identity-D6hhcRXi.js} +1 -1
  46. package/dist/chunks/pivot-result-lifecycle-8qCDmpKc.js +804 -0
  47. package/dist/chunks/raw-temporal-D61lr48Y.js +1464 -0
  48. package/dist/chunks/{raw-temporal-contract-mLFS-9wk.js → raw-temporal-contract-C51YG48G.js} +1 -1
  49. package/dist/chunks/report-preferences-dialog-BCGs4-AE.js +1808 -0
  50. package/dist/chunks/{report-runtime-context-CG_I0PPW.js → report-runtime-context-B984Nq1E.js} +8 -7
  51. package/dist/chunks/save-CfJpQQ68.js +21 -0
  52. package/dist/chunks/saved-dashboard-context-BrTkjcod.js +566 -0
  53. package/dist/chunks/{selection-reducer-CiDEtmAq.js → selection-reducer-vKIb_jS6.js} +2 -2
  54. package/dist/chunks/{semaphor-ready-indicator-3TXTZgw-.js → semaphor-ready-indicator-CHHoWhil.js} +65657 -62814
  55. package/dist/chunks/{shelf-drop-preview-context-CBCs9rjz.js → shelf-drop-preview-context-EsayECEC.js} +199 -196
  56. package/dist/chunks/{source-entity-resolution-C-oNyYMp.js → source-entity-resolution-CVA1a85c.js} +8 -8
  57. package/dist/chunks/switch-CvItuC1Q.js +8199 -0
  58. package/dist/chunks/{temporal-bucket-DlFuhCnT.js → temporal-bucket-D8JF7zKz.js} +86 -71
  59. package/dist/chunks/{temporal-bucket-contract-D2OuaVZ7.js → temporal-bucket-contract-DaOajRC7.js} +1 -1
  60. package/dist/chunks/{token-types-DtSJOUjh.js → token-types-bxUxXDX2.js} +1 -1
  61. package/dist/chunks/{upload-CAIpsti1.js → upload-BFX7apKV.js} +1 -1
  62. package/dist/chunks/{use-create-flow-overlay-state-Bk-SBnaY.js → use-create-flow-overlay-state-BqA92GkX.js} +331 -339
  63. package/dist/chunks/{validators-DMSH81OM.js → validators-Ej1DdCXa.js} +1050 -1510
  64. package/dist/chunks/visual-choice-JiJ-_3bi.js +204 -0
  65. package/dist/chunks/x-4f5U2XwU.js +100 -0
  66. package/dist/chunks/{zoned-wall-clock-1qlWCE20.js → zoned-wall-clock-MulfA26h.js} +2 -2
  67. package/dist/dashboard/index.js +2 -2
  68. package/dist/dashboard-authoring/index.js +823 -661
  69. package/dist/data-app-sdk/index.js +32 -30
  70. package/dist/data-app-sdk-adapters/index.js +23 -22
  71. package/dist/data-app-sdk-validation/index.js +23 -22
  72. package/dist/format-utils/index.js +173 -168
  73. package/dist/index.js +267 -258
  74. package/dist/layouts/index.js +236 -24
  75. package/dist/report-runtime-context/index.js +2 -2
  76. package/dist/style.css +1 -1
  77. package/dist/surfboard/index.js +2 -2
  78. package/dist/types/assistant-context.d.ts +2 -0
  79. package/dist/types/assistant-protocol.d.ts +2 -0
  80. package/dist/types/components/assistant/assistant-entry-points.d.ts +18 -0
  81. package/dist/types/components/assistant/assistant-provider.d.ts +19 -0
  82. package/dist/types/components/assistant/assistant-store.d.ts +52 -0
  83. package/dist/types/components/assistant/use-assistant.d.ts +38 -0
  84. package/dist/types/components/index.d.ts +5 -1
  85. package/dist/types/components/surfboard/filter/types.d.ts +5 -2
  86. package/dist/types/index.js +50 -51
  87. package/dist/types/lib/api/invalidate-token.d.ts +7 -0
  88. package/dist/types/lib/charts/cartesian-fields.d.ts +64 -0
  89. package/dist/types/lib/charts/types.d.ts +7 -0
  90. package/dist/types/lib/dashboard-inputs/dashboard-filter-mapping-storage-transition.d.ts +14 -2
  91. package/dist/types/lib/dashboard-inputs/dashboard-input-target-context.d.ts +5 -6
  92. package/dist/types/lib/dashboard-inputs/dashboard-input-values.d.ts +8 -3
  93. package/dist/types/lib/dashboard-inputs/resolve-dashboard-input-context.d.ts +11 -6
  94. package/dist/types/lib/dashboard-pagination/dashboard-card-pagination.d.ts +7 -0
  95. package/dist/types/lib/dashboard-viewer/compatibility-input-storage.d.ts +79 -0
  96. package/dist/types/lib/dashboard-viewer/viewer-state.d.ts +3 -2
  97. package/dist/types/lib/document/document-table-data-policy.d.ts +15 -0
  98. package/dist/types/lib/filter-values/filter-mode.d.ts +22 -0
  99. package/dist/types/lib/hooks/use-calendar-context.d.ts +5 -0
  100. package/dist/types/lib/hooks/use-text-filter.d.ts +7 -0
  101. package/dist/types/lib/print/print-inputs.d.ts +4 -2
  102. package/dist/types/lib/query-context/build-card-query-context.d.ts +12 -4
  103. package/dist/types/lib/query-context/build-dashboard-execution-snapshot.d.ts +93 -0
  104. package/dist/types/lib/query-context/card-server-request.d.ts +72 -0
  105. package/dist/types/lib/query-context/compile-dashboard-card-filters.d.ts +7 -0
  106. package/dist/types/lib/query-context/describe-card-execution-snapshot.d.ts +56 -0
  107. package/dist/types/lib/query-context/document-section-card-query.d.ts +45 -0
  108. package/dist/types/lib/query-context/resolve-runtime-card-filters.d.ts +17 -2
  109. package/dist/types/lib/stores/dashboard-store.d.ts +34 -11
  110. package/dist/types/lib/stores/editor-store.d.ts +4 -2
  111. package/dist/types/lib/types/token-types.d.ts +11 -0
  112. package/dist/types/lib/utils/card-type-change.d.ts +30 -0
  113. package/dist/types/lib/utils/comparison-window-caption.d.ts +12 -0
  114. package/dist/types/lib/utils/filter-default-value-utils.d.ts +13 -2
  115. package/dist/types/shared/analytics-protocol/applied-constraints.d.ts +74 -0
  116. package/dist/types/shared/analytics-protocol/contracts.d.ts +5 -0
  117. package/dist/types/shared/analytics-protocol/filter-field-ownership.d.ts +43 -0
  118. package/dist/types/shared/analytics-protocol/index.d.ts +3 -0
  119. package/dist/types/shared/analytics-protocol/matrix-window-contract.d.ts +1 -1
  120. package/dist/types/shared/analytics-protocol/visual-choice.d.ts +75 -0
  121. package/dist/types/shared/assistant-context/index.d.ts +9 -0
  122. package/dist/types/shared/assistant-context/project-context.d.ts +55 -0
  123. package/dist/types/shared/assistant-context/saved-dashboard-context.d.ts +130 -0
  124. package/dist/types/shared/assistant-protocol/add-to-dashboard.d.ts +17 -0
  125. package/dist/types/shared/assistant-protocol/artifact.d.ts +63 -0
  126. package/dist/types/shared/assistant-protocol/availability.d.ts +39 -0
  127. package/dist/types/shared/assistant-protocol/context.d.ts +952 -0
  128. package/dist/types/shared/assistant-protocol/conversation.d.ts +38 -0
  129. package/dist/types/shared/assistant-protocol/index.d.ts +16 -0
  130. package/dist/types/shared/assistant-protocol/limits.d.ts +53 -0
  131. package/dist/types/shared/assistant-protocol/parts.d.ts +131 -0
  132. package/dist/types/shared/assistant-protocol/request.d.ts +77 -0
  133. package/dist/types/shared/assistant-protocol/sources.d.ts +27 -0
  134. package/dist/types/shared/assistant-protocol/token-config.d.ts +32 -0
  135. package/dist/types/shared/assistant-protocol/transcript.d.ts +40 -0
  136. package/dist/types/shared/dashboard-authoring/card-query-request.d.ts +112 -0
  137. package/dist/types/shared/dashboard-authoring/control-execution-contract.d.ts +1794 -0
  138. package/dist/types/shared/dashboard-authoring/index.d.ts +5 -0
  139. package/dist/types/shared/dashboard-authoring/new-card.d.ts +10 -0
  140. package/dist/types/shared/dashboard-authoring/operations/apply-dashboard-operations.d.ts +40 -0
  141. package/dist/types/shared/dashboard-authoring/resolved-primary-date-field-validation.d.ts +16 -0
  142. package/dist/types/shared/format-utils/filter-detail.d.ts +70 -0
  143. package/dist/types/shared/format-utils/filter-value-text.d.ts +15 -0
  144. package/dist/types/shared/format-utils/index.d.ts +3 -0
  145. package/dist/types/shared/format-utils/raw-temporal.d.ts +7 -0
  146. package/dist/types/shared/format-utils/temporal-bucket.d.ts +7 -0
  147. package/dist/types/shared/layouts/frame-layouts.d.ts +23 -0
  148. package/dist/types/shared/layouts/index.d.ts +1 -0
  149. package/package.json +12 -2
  150. package/dist/chunks/calculated-field-identity-BptYhyOP.js +0 -1326
  151. package/dist/chunks/calendar-day-equality-BRjN1S9h.js +0 -383
  152. package/dist/chunks/card-config-utils-BOM1dxCk.js +0 -1150
  153. package/dist/chunks/constants-DNWVy8Y3.js +0 -9
  154. package/dist/chunks/dashboard-json-Ccjo0Dzw.js +0 -65
  155. package/dist/chunks/field-aggregations-CoLzYHeL.js +0 -1229
  156. package/dist/chunks/index-DTcTAGGM.js +0 -4101
  157. package/dist/chunks/matrix-continuation-C4sRcjZU.js +0 -72
  158. package/dist/chunks/matrix-control-sources-DTqcA2_L.js +0 -636
  159. package/dist/chunks/matrix-definition-D9iShKZI.js +0 -87
  160. package/dist/chunks/matrix-member-presentation-Ct8GuxHt.js +0 -209
  161. package/dist/chunks/numeric-presentation-CWu3gunq.js +0 -537
  162. package/dist/chunks/pivot-header-presentation-CHs2GFrM.js +0 -753
  163. package/dist/chunks/pivot-result-lifecycle-DQz_gjGu.js +0 -789
  164. package/dist/chunks/raw-temporal-iMXRK-Qz.js +0 -930
  165. package/dist/chunks/report-preferences-dialog-CW8VEIDx.js +0 -1623
  166. package/dist/chunks/save-kO6cIaob.js +0 -34
  167. package/dist/chunks/semantic-format-DiqYeKwU.js +0 -192
  168. package/dist/chunks/switch-CKB-kUaC.js +0 -25003
  169. package/dist/chunks/temporal-input-presentation-BD7YNUzu.js +0 -195
  170. package/dist/chunks/x-CXDkqdur.js +0 -149
  171. package/dist/types/lib/class-utils.d.ts +0 -2
  172. package/dist/types/lib/document/document-input-runtime.d.ts +0 -26
  173. package/dist/types/lib/utils.d.ts +0 -51
@@ -0,0 +1,402 @@
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
+ };