react-semaphor 0.1.459 → 0.1.460

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 (114) hide show
  1. package/dist/analytics-protocol/index.cjs +1 -1
  2. package/dist/analytics-protocol/index.js +32 -32
  3. package/dist/brand-studio/index.cjs +1 -1
  4. package/dist/brand-studio/index.js +4 -4
  5. package/dist/briefings/index.cjs +1 -1
  6. package/dist/briefings/index.js +4 -4
  7. package/dist/chunks/{analyze-result-contract-BbRJ-C06.js → analyze-result-contract-DROq4vgY.js} +1 -1
  8. package/dist/chunks/{analyze-result-contract-LPDNldic.cjs → analyze-result-contract-DSGoFuXQ.cjs} +1 -1
  9. package/dist/chunks/canonical-result-keys-CEQefvdO.js +33 -0
  10. package/dist/chunks/canonical-result-keys-Cb96edol.cjs +1 -0
  11. package/dist/chunks/{common-types-H51FLKB7.js → common-types-BHVKgxRR.js} +1 -1
  12. package/dist/chunks/{common-types-C57kJ59w.cjs → common-types-BcV9PD9D.cjs} +1 -1
  13. package/dist/chunks/{dashboard-briefing-launcher-ClCj98sq.js → dashboard-briefing-launcher-B07JnyCb.js} +60 -61
  14. package/dist/chunks/{dashboard-briefing-launcher-DHtEouuH.cjs → dashboard-briefing-launcher-BCkOKkCv.cjs} +2 -2
  15. package/dist/chunks/{dashboard-controls-VRShl9J0.cjs → dashboard-controls-BpxouYOZ.cjs} +1 -1
  16. package/dist/chunks/{dashboard-controls-B8gsKlxc.js → dashboard-controls-C8OxHQV6.js} +44 -45
  17. package/dist/chunks/dashboard-filter-value-compatibility-KXIyvbhc.js +677 -0
  18. package/dist/chunks/dashboard-filter-value-compatibility-UapptYnn.cjs +1 -0
  19. package/dist/chunks/dashboard-input-contract-BkRFQ7Tq.cjs +1 -0
  20. package/dist/chunks/{dashboard-date-comparison-definition-DC3ekV2S.js → dashboard-input-contract-D5dxTWJ5.js} +41 -25
  21. package/dist/chunks/dashboard-json-Bc-iIwxF.cjs +1 -0
  22. package/dist/chunks/{dashboard-json-i_Auue_K.js → dashboard-json-CecgbGtq.js} +13 -14
  23. package/dist/chunks/{edit-dashboard-visual-B3JF0fe4.js → edit-dashboard-visual-CpJKJaER.js} +880 -894
  24. package/dist/chunks/{edit-dashboard-visual-DWWyT55u.cjs → edit-dashboard-visual-xacUS2i5.cjs} +28 -28
  25. package/dist/chunks/{editor-action-buttons-BTlCsP63.cjs → editor-action-buttons-23Wf8EMx.cjs} +2 -2
  26. package/dist/chunks/{editor-action-buttons-C9x3nGnb.js → editor-action-buttons-DEoieV2G.js} +28 -28
  27. package/dist/chunks/index-B9c22LmC.cjs +1392 -0
  28. package/dist/chunks/{index-BS2-ZZGf.js → index-DDoyXYWM.js} +43665 -41560
  29. package/dist/chunks/{index-BIFLI8ul.js → index-De_7nrwb.js} +10 -10
  30. package/dist/chunks/index-DjjKJPDy.cjs +4 -0
  31. package/dist/chunks/{matrix-result-contract-CofATICL.js → matrix-result-contract-BTpPuHOc.js} +88 -104
  32. package/dist/chunks/matrix-result-contract-ZRNfeIbI.cjs +1 -0
  33. package/dist/chunks/{pivot-header-presentation-B9nXXKlW.cjs → pivot-header-presentation-BijPbP33.cjs} +1 -1
  34. package/dist/chunks/{pivot-header-presentation-D-0jvUwn.js → pivot-header-presentation-DW0gKG8g.js} +2 -2
  35. package/dist/chunks/{pivot-result-identity-Bb4EixVN.cjs → pivot-result-identity-DxHtiKVj.cjs} +1 -1
  36. package/dist/chunks/{pivot-result-identity-DU1v-5Xk.js → pivot-result-identity-Z9tN2tEV.js} +1 -1
  37. package/dist/chunks/{pivot-result-lifecycle-DTLRuDEW.cjs → pivot-result-lifecycle-BXzIlQVu.cjs} +1 -1
  38. package/dist/chunks/{pivot-result-lifecycle-CHWEGU2o.js → pivot-result-lifecycle-g2U-vzQb.js} +7 -7
  39. package/dist/chunks/{raw-temporal-contract-BtjH_G-d.cjs → raw-temporal-contract-DfAvqNMo.cjs} +1 -1
  40. package/dist/chunks/{raw-temporal-contract-CxncLze5.js → raw-temporal-contract-UtAqoOZO.js} +1 -1
  41. package/dist/chunks/{report-preferences-dialog-BDpkcUtz.js → report-preferences-dialog-CZiNX1Ri.js} +6 -6
  42. package/dist/chunks/{report-preferences-dialog-BK0yAJnQ.cjs → report-preferences-dialog-D_N6NXnq.cjs} +1 -1
  43. package/dist/chunks/{report-runtime-context-DqxS4wbi.cjs → report-runtime-context-C0NfLPfc.cjs} +1 -1
  44. package/dist/chunks/{report-runtime-context-SM6YO61_.js → report-runtime-context-CNncA3VD.js} +11 -11
  45. package/dist/chunks/{saved-temporal-bucket-format-CFfWXRl9.cjs → saved-temporal-bucket-format-3QKveR3v.cjs} +1 -1
  46. package/dist/chunks/{saved-temporal-bucket-format-SGAV0ivR.js → saved-temporal-bucket-format-Dd2eixTH.js} +11 -11
  47. package/dist/chunks/switch-DNFbgZz4.cjs +138 -0
  48. package/dist/chunks/{switch-DQR-Va05.js → switch-DSZobe8w.js} +6542 -5189
  49. package/dist/chunks/{temporal-bucket-5UYEotyQ.js → temporal-bucket-C85rmFmC.js} +4 -4
  50. package/dist/chunks/temporal-bucket-authoring-1fZuPAVb.js +653 -0
  51. package/dist/chunks/temporal-bucket-authoring-BK1UhYpD.cjs +1 -0
  52. package/dist/chunks/{temporal-bucket-contract-D5d-xEl3.js → temporal-bucket-contract-DXXNZssK.js} +1 -1
  53. package/dist/chunks/{temporal-bucket-contract-D2-93DGr.cjs → temporal-bucket-contract-xFkvboaw.cjs} +1 -1
  54. package/dist/chunks/{temporal-bucket-DHY1y9lq.cjs → temporal-bucket-pMfghsLX.cjs} +1 -1
  55. package/dist/chunks/{token-types-GbxRUozo.js → token-types-BLxc7UwR.js} +1 -1
  56. package/dist/chunks/{token-types-D7CaaI80.cjs → token-types-BYYO109W.cjs} +1 -1
  57. package/dist/chunks/{update-policy-hednMF-0.js → update-policy-CB8XJIoY.js} +1 -1
  58. package/dist/chunks/{update-policy-BmiOd0PB.cjs → update-policy-DMjjGjQY.cjs} +1 -1
  59. package/dist/chunks/{validators-DEmd8Sin.js → validators-DVd8s3qY.js} +416 -350
  60. package/dist/chunks/validators-dJlwubP4.cjs +1 -0
  61. package/dist/dashboard/index.cjs +1 -1
  62. package/dist/dashboard/index.js +2 -2
  63. package/dist/dashboard-authoring/index.cjs +3 -3
  64. package/dist/dashboard-authoring/index.js +328 -311
  65. package/dist/data-app-builder/index.cjs +1 -1
  66. package/dist/data-app-builder/index.js +2 -2
  67. package/dist/data-app-codegen/index.cjs +1 -1
  68. package/dist/data-app-codegen/index.js +2 -2
  69. package/dist/data-app-codegen-node/index.cjs +1 -1
  70. package/dist/data-app-codegen-node/index.js +3 -3
  71. package/dist/data-app-sdk/index.cjs +1 -1
  72. package/dist/data-app-sdk/index.js +55 -55
  73. package/dist/data-app-sdk-adapters/index.cjs +1 -1
  74. package/dist/data-app-sdk-adapters/index.js +61 -56
  75. package/dist/data-app-sdk-validation/index.cjs +1 -1
  76. package/dist/data-app-sdk-validation/index.js +9 -9
  77. package/dist/format-utils/index.cjs +1 -1
  78. package/dist/format-utils/index.js +15 -15
  79. package/dist/index.cjs +1 -1
  80. package/dist/index.js +154 -155
  81. package/dist/report-runtime-context/index.cjs +1 -1
  82. package/dist/report-runtime-context/index.js +2 -2
  83. package/dist/style.css +1 -1
  84. package/dist/surfboard/index.cjs +1 -1
  85. package/dist/surfboard/index.js +3 -3
  86. package/dist/types/analytics-protocol.d.ts +16 -8
  87. package/dist/types/briefings.d.ts +80 -9
  88. package/dist/types/dashboard-assistant.d.ts +11 -6
  89. package/dist/types/dashboard-authoring.d.ts +242 -15
  90. package/dist/types/dashboard.d.ts +94 -10
  91. package/dist/types/data-app-builder.d.ts +11 -6
  92. package/dist/types/data-app-codegen-node.d.ts +16 -8
  93. package/dist/types/data-app-codegen.d.ts +16 -8
  94. package/dist/types/data-app-sdk-adapters.d.ts +17 -11
  95. package/dist/types/data-app-sdk-validation.d.ts +17 -11
  96. package/dist/types/data-app-sdk.d.ts +17 -11
  97. package/dist/types/index.cjs +1 -1
  98. package/dist/types/index.js +4 -4
  99. package/dist/types/main.d.ts +210 -16
  100. package/dist/types/shared.d.ts +80 -9
  101. package/dist/types/surfboard.d.ts +94 -10
  102. package/dist/types/types.d.ts +94 -10
  103. package/package.json +1 -1
  104. package/dist/chunks/canonical-result-keys-BA0HCP4e.cjs +0 -1
  105. package/dist/chunks/canonical-result-keys-D6avdjpA.js +0 -467
  106. package/dist/chunks/dashboard-date-comparison-definition-Ces4alFm.cjs +0 -1
  107. package/dist/chunks/dashboard-json-BhvPMpZA.cjs +0 -1
  108. package/dist/chunks/index-DHF-2AqS.cjs +0 -1392
  109. package/dist/chunks/index-k8tEp0ys.cjs +0 -4
  110. package/dist/chunks/matrix-result-contract-zamd9euI.cjs +0 -1
  111. package/dist/chunks/switch-f3TuZNLr.cjs +0 -138
  112. package/dist/chunks/temporal-bucket-authoring-K1kE6R_z.js +0 -222
  113. package/dist/chunks/temporal-bucket-authoring-o3Emn05L.cjs +0 -1
  114. package/dist/chunks/validators-BDYprKI9.cjs +0 -1
@@ -0,0 +1,677 @@
1
+ var O = Object.defineProperty;
2
+ var z = (e, n, i) => n in e ? O(e, n, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[n] = i;
3
+ var w = (e, n, i) => z(e, typeof n != "symbol" ? n + "" : n, i);
4
+ import { af as p, ah as M, j as N, C as E, F as D } from "./validators-DVd8s3qY.js";
5
+ import "./analyze-result-contract-DROq4vgY.js";
6
+ import "../value-format-preferences/index.js";
7
+ function h(e) {
8
+ return !!e && typeof e == "object" && !Array.isArray(e);
9
+ }
10
+ function v(e) {
11
+ return h(e) && typeof e.name == "string";
12
+ }
13
+ function $(e) {
14
+ return !h(e) || e.kind !== "semantic" && e.kind !== "physical" || (e.kind === "semantic" ? [e.datasetId, e.datasetName, e.connectionId] : [e.databaseName, e.schemaName]).some(
15
+ (i) => i !== void 0 && typeof i != "string"
16
+ ) ? !1 : N(
17
+ e
18
+ );
19
+ }
20
+ function x(e, n) {
21
+ var c, d;
22
+ if ((n == null ? void 0 : n.mode) !== "database" && e.type === "dataset" && "domainId" in e && e.domainId) {
23
+ const s = e, a = {
24
+ kind: "semantic",
25
+ domainId: s.domainId,
26
+ datasetId: s.id,
27
+ datasetName: s.name,
28
+ connectionId: s.connectionId || (n == null ? void 0 : n.connectionId),
29
+ label: s.label
30
+ };
31
+ return $(a) ? a : void 0;
32
+ }
33
+ const i = e.connectionId || (n == null ? void 0 : n.connectionId), o = e.type === "dataset" && "table" in e && e.table ? e.table : e.name;
34
+ if (!i || !o)
35
+ return;
36
+ const t = {
37
+ kind: "physical",
38
+ connectionId: i,
39
+ connectionType: e.connectionType || (n == null ? void 0 : n.connectionType),
40
+ tableName: o,
41
+ databaseName: e.database || ((c = n == null ? void 0 : n.dbSelection) == null ? void 0 : c.database),
42
+ schemaName: e.schema || ((d = n == null ? void 0 : n.dbSelection) == null ? void 0 : d.schema),
43
+ dialect: e.dialect
44
+ };
45
+ return $(t) ? t : void 0;
46
+ }
47
+ function S(e, n) {
48
+ var s, a;
49
+ const i = x(e, n);
50
+ if (!i) return;
51
+ const o = e.type === "dataset" && "table" in e && typeof e.table == "string" ? e.table.trim() : void 0, t = i.kind === "physical" ? i.tableName : o, c = e.connectionId || (n == null ? void 0 : n.connectionId), d = t && c ? {
52
+ connectionId: c,
53
+ databaseName: e.database || ((s = n == null ? void 0 : n.dbSelection) == null ? void 0 : s.database),
54
+ schemaName: e.schema || ((a = n == null ? void 0 : n.dbSelection) == null ? void 0 : a.schema),
55
+ tableName: t
56
+ } : void 0;
57
+ return { source: i, ...d ? { executionTable: d } : {} };
58
+ }
59
+ function q(e) {
60
+ const n = h(e.dataSource) ? e.dataSource : void 0;
61
+ if (typeof e.sql == "string" && e.sql.trim()) {
62
+ const d = [], s = Array.isArray(n == null ? void 0 : n.selectedEntities) ? n.selectedEntities : [];
63
+ for (const a of s) {
64
+ if (!v(a)) continue;
65
+ const r = S(a, n);
66
+ r && !d.some(
67
+ (_) => p(
68
+ _.source,
69
+ r.source
70
+ )
71
+ ) && d.push(r);
72
+ }
73
+ return {
74
+ cardId: e.id,
75
+ kind: "sql",
76
+ pinnedCatalogSources: d
77
+ };
78
+ }
79
+ if (!h(e.config))
80
+ return { cardId: e.id, kind: "unconfigured" };
81
+ const i = [], o = h(e.config.matrixIntent) ? e.config.matrixIntent : void 0, t = e.type === "matrixTable" ? (o == null ? void 0 : o.kind) === "matrix" ? o.source : e.config.source : void 0;
82
+ $(t) && i.push(t);
83
+ const c = h(e.config.joinPlan) ? e.config.joinPlan : void 0;
84
+ if (c) {
85
+ const d = Array.isArray(c.joins) ? c.joins : [], s = [c.baseEntity];
86
+ for (const a of d)
87
+ h(a) && s.push(a.source, a.target);
88
+ for (const a of s) {
89
+ if (!v(a)) continue;
90
+ const r = x(a, n);
91
+ r && i.push(r);
92
+ }
93
+ } else if (e.type !== "matrixTable") {
94
+ const d = Array.isArray(n == null ? void 0 : n.selectedEntities) ? n.selectedEntities : [];
95
+ if (d.length === 1 && v(d[0])) {
96
+ const s = x(d[0], n);
97
+ s && i.push(s);
98
+ }
99
+ }
100
+ if (!i.length && !c && e.type !== "matrixTable") {
101
+ const d = e.config.queryBaseSource;
102
+ $(d) && i.push(d);
103
+ }
104
+ return {
105
+ cardId: e.id,
106
+ kind: "config",
107
+ executableSources: M(i)
108
+ };
109
+ }
110
+ function H(e, n) {
111
+ return (e.kind === "config" ? e.executableSources : e.kind === "sql" ? e.pinnedCatalogSources.map((o) => o.source) : []).some(
112
+ (o) => p(o, n)
113
+ );
114
+ }
115
+ function me(e, n) {
116
+ if (e.kind === "config")
117
+ return e.executableSources.find(
118
+ (i) => p(i, n)
119
+ );
120
+ }
121
+ function be(e, n) {
122
+ var i;
123
+ return (i = j(e, n)) == null ? void 0 : i.source;
124
+ }
125
+ function j(e, n) {
126
+ if (e.kind === "sql")
127
+ return e.pinnedCatalogSources.find(
128
+ (i) => p(i.source, n)
129
+ );
130
+ }
131
+ function P(e) {
132
+ const n = /* @__PURE__ */ new Set();
133
+ for (const i of [e.name, e.sourceField]) {
134
+ if (!i) continue;
135
+ const o = E(i);
136
+ if (!o) continue;
137
+ n.add(o);
138
+ const t = o.split("."), c = t[t.length - 1];
139
+ c && n.add(c);
140
+ }
141
+ return n;
142
+ }
143
+ function L(e, n) {
144
+ const i = D(e), o = D(n);
145
+ return i === "unknown" || o === "unknown" ? !1 : (i === "date" || i === "datetime") && (o === "date" || o === "datetime") ? !0 : i === o;
146
+ }
147
+ function U(e, n) {
148
+ if (e.kind !== "field") return !1;
149
+ const i = P(n), o = P(e.field);
150
+ return L(n.dataType, e.field.dataType) && [...o].some((t) => i.has(t));
151
+ }
152
+ function ge(e) {
153
+ const n = e.candidates.filter(
154
+ (i) => U(
155
+ i,
156
+ e.logicalValueField
157
+ )
158
+ );
159
+ return n.length === 1 ? { status: "matched", target: n[0] } : n.length > 1 ? { status: "ambiguous" } : { status: "notApplicable" };
160
+ }
161
+ const V = /\{\{-?\s*filters\s*\|\s*where\s*-?\}\}/i, W = /\{\{-?\s*filters\s*\|\s*and\s*-?\}\}/i, K = /\bwhere\b/i;
162
+ function Y(e) {
163
+ return e != null && e.trim() ? V.test(e) || W.test(e) : !1;
164
+ }
165
+ function he(e) {
166
+ return !(e != null && e.trim()) || Y(e) ? null : K.test(e) ? {
167
+ helper: "{{ filters | and }}",
168
+ description: "For queries with an existing WHERE clause."
169
+ } : {
170
+ helper: "{{ filters | where }}",
171
+ description: "For queries without a WHERE clause."
172
+ };
173
+ }
174
+ function G(e) {
175
+ return (e.field.sourceField || e.field.name).trim() || void 0;
176
+ }
177
+ function pe(e) {
178
+ if (e.inventory.kind !== "sql" || e.target.kind !== "field")
179
+ return { status: "ineligible" };
180
+ const n = j(
181
+ e.inventory,
182
+ e.target.field.source
183
+ ), i = G(e.target);
184
+ if (!n || !i) return { status: "ineligible" };
185
+ if (n.executionTable) {
186
+ const d = [
187
+ n.executionTable.databaseName,
188
+ n.executionTable.schemaName,
189
+ n.executionTable.tableName,
190
+ i
191
+ ].filter(Boolean).join(".");
192
+ return {
193
+ status: "eligible",
194
+ source: n.source,
195
+ executionIdentifier: d
196
+ };
197
+ }
198
+ if (e.inventory.pinnedCatalogSources.length !== 1)
199
+ return { status: "ineligible" };
200
+ const o = E(i), t = (e.candidateTargets || []).filter(
201
+ (d) => E(
202
+ d.field.sourceField || d.field.name
203
+ ) === o
204
+ ), c = [];
205
+ for (const d of t)
206
+ c.some(
207
+ (s) => p(s, d.field.source)
208
+ ) || c.push(d.field.source);
209
+ return c.length > 1 ? { status: "ineligible" } : {
210
+ status: "eligible",
211
+ source: n.source,
212
+ executionIdentifier: i
213
+ };
214
+ }
215
+ class J extends Error {
216
+ constructor(i) {
217
+ super(i.map((o) => o.message).join(" "));
218
+ w(this, "issues");
219
+ this.name = "DashboardFilterMappingContractError", this.issues = i;
220
+ }
221
+ }
222
+ const Q = {
223
+ string: !0,
224
+ number: !0,
225
+ boolean: !0,
226
+ date: !0,
227
+ datetime: !0
228
+ };
229
+ function m(e) {
230
+ return typeof e == "string" && e.trim().length > 0;
231
+ }
232
+ function u(e) {
233
+ return !!e && typeof e == "object" && !Array.isArray(e);
234
+ }
235
+ function y(e) {
236
+ return Array.isArray(e) && e.every((n) => typeof n == "string");
237
+ }
238
+ function X(e) {
239
+ if (!u(e)) return !1;
240
+ switch (e.kind) {
241
+ case "allSheets":
242
+ return e.sheetKinds === void 0 || y(e.sheetKinds) && e.sheetKinds.every(
243
+ (n) => n === "dashboard" || n === "document"
244
+ );
245
+ case "sheets":
246
+ return y(e.sheetIds);
247
+ case "cards":
248
+ return y(e.cardIds);
249
+ case "documentSections":
250
+ return m(e.sheetId) && y(e.sectionIds);
251
+ default:
252
+ return !1;
253
+ }
254
+ }
255
+ function Z(e) {
256
+ return e === "shared" || e === "perSheet" || e === "perCard" || e === "perDocumentSection";
257
+ }
258
+ function ee(e) {
259
+ return u(e) ? m(e.id) && m(e.column) && m(e.dataType) : !1;
260
+ }
261
+ function ne(e, n, i, o) {
262
+ var s;
263
+ if (!u(n)) {
264
+ o.push({
265
+ code: "invalid_option_source",
266
+ path: i,
267
+ message: `${i} must be a semantic or physical option source.`,
268
+ inputId: e
269
+ });
270
+ return;
271
+ }
272
+ const t = n.source, c = [
273
+ ["labelField", n.labelField],
274
+ ["valueField", n.valueField],
275
+ ["searchField", n.searchField]
276
+ ];
277
+ if (!u(t) || t.kind !== "semantic" && t.kind !== "physical" || !N(t) || !u(n.labelField) || !u(n.valueField) || n.searchField !== void 0 && !u(n.searchField) || n.disambiguationFields !== void 0 && (!Array.isArray(n.disambiguationFields) || !n.disambiguationFields.every(u))) {
278
+ o.push({
279
+ code: "invalid_option_source",
280
+ path: i,
281
+ message: `${i} must contain a valid semantic or physical source and field references.`,
282
+ inputId: e
283
+ });
284
+ return;
285
+ }
286
+ for (const [a, r] of c)
287
+ r !== void 0 && u(r) && (!m(r.name) || r.source !== void 0 && !p(
288
+ r.source,
289
+ t
290
+ )) && o.push({
291
+ code: "invalid_option_source",
292
+ path: `${i}.${a}`,
293
+ message: `${i}.${a} must be a named field belonging to the declared option source.`,
294
+ inputId: e
295
+ });
296
+ for (const [a, r] of ((s = n.disambiguationFields) == null ? void 0 : s.entries()) || [])
297
+ (!u(r) || !m(r.name) || r.source !== void 0 && !p(
298
+ r.source,
299
+ t
300
+ )) && o.push({
301
+ code: "invalid_option_source",
302
+ path: `${i}.disambiguationFields[${a}]`,
303
+ message: `${i}.disambiguationFields[${a}] must be a named field belonging to the declared option source.`,
304
+ inputId: e
305
+ });
306
+ const d = n.valueField;
307
+ ["string", "number", "boolean", "date", "datetime"].includes(
308
+ String(d.dataType)
309
+ ) || o.push({
310
+ code: "invalid_option_source",
311
+ path: `${i}.valueField.dataType`,
312
+ message: `${i}.valueField.dataType must be a known option-value datatype.`,
313
+ inputId: e
314
+ });
315
+ }
316
+ function ie(e, n, i, o, t, c) {
317
+ var r;
318
+ if (m(n.bindingId) || t.push({
319
+ code: "invalid_binding_id",
320
+ path: `${i}.bindingId`,
321
+ message: `${i}.bindingId must be an opaque non-empty id.`,
322
+ inputId: e,
323
+ cardId: n.cardId
324
+ }), ((r = n.target) == null ? void 0 : r.kind) !== "field") {
325
+ t.push({
326
+ code: "unsupported_target",
327
+ path: `${i}.target`,
328
+ message: `${i}.target must be one direct field target.`,
329
+ inputId: e,
330
+ cardId: n.cardId,
331
+ bindingId: n.bindingId
332
+ });
333
+ return;
334
+ }
335
+ const d = n.target.field;
336
+ if (!m(d == null ? void 0 : d.name) || !d.source || d.source.kind !== "semantic" && d.source.kind !== "physical" || !N(d.source)) {
337
+ t.push({
338
+ code: "invalid_target_field",
339
+ path: `${i}.target.field`,
340
+ message: `${i}.target.field must have a name and a source-qualified semantic or physical identity.`,
341
+ inputId: e,
342
+ cardId: n.cardId,
343
+ bindingId: n.bindingId
344
+ });
345
+ return;
346
+ }
347
+ if (Object.prototype.hasOwnProperty.call(
348
+ Q,
349
+ d.dataType
350
+ ) || t.push({
351
+ code: "unknown_target_data_type",
352
+ path: `${i}.target.field.dataType`,
353
+ message: `${i}.target.field.dataType must be known.`,
354
+ inputId: e,
355
+ cardId: n.cardId,
356
+ bindingId: n.bindingId
357
+ }), d.sourceField !== void 0 && !m(d.sourceField) && t.push({
358
+ code: "invalid_target_field",
359
+ path: `${i}.target.field.sourceField`,
360
+ message: `${i}.target.field.sourceField must be a non-empty catalog-grounded column when provided.`,
361
+ inputId: e,
362
+ cardId: n.cardId,
363
+ bindingId: n.bindingId
364
+ }), !c) return;
365
+ const s = o.get(n.cardId);
366
+ if (!s) {
367
+ t.push({
368
+ code: "unknown_card",
369
+ path: `${i}.cardId`,
370
+ message: `${i}.cardId '${n.cardId}' does not exist.`,
371
+ inputId: e,
372
+ cardId: n.cardId,
373
+ bindingId: n.bindingId
374
+ });
375
+ return;
376
+ }
377
+ const a = q(s);
378
+ (a.kind === "unconfigured" || !H(a, d.source)) && t.push({
379
+ code: "unavailable_card_source",
380
+ path: `${i}.target.field.source`,
381
+ message: `${i}.target field source is not declared by card '${s.id}'.`,
382
+ inputId: e,
383
+ cardId: s.id,
384
+ bindingId: n.bindingId
385
+ });
386
+ }
387
+ function te(e, n, i, o, t, c) {
388
+ if (n === void 0) return;
389
+ if (!u(n) || n.kind !== "cardMappings" || !Array.isArray(n.cards)) {
390
+ t.push({
391
+ code: "invalid_application",
392
+ path: i,
393
+ message: `${i} must be a cardMappings application with a cards array.`,
394
+ inputId: e
395
+ });
396
+ return;
397
+ }
398
+ const d = /* @__PURE__ */ new Set();
399
+ n.cards.forEach((s, a) => {
400
+ const r = `${i}.cards[${a}]`;
401
+ if (!m(s == null ? void 0 : s.cardId)) {
402
+ t.push({
403
+ code: "unknown_card",
404
+ path: `${r}.cardId`,
405
+ message: `${r}.cardId is required.`,
406
+ inputId: e
407
+ });
408
+ return;
409
+ }
410
+ if (d.has(s.cardId)) {
411
+ t.push({
412
+ code: "duplicate_card_application",
413
+ path: `${r}.cardId`,
414
+ message: `${i} contains more than one entry for card '${s.cardId}'.`,
415
+ inputId: e,
416
+ cardId: s.cardId
417
+ });
418
+ return;
419
+ }
420
+ if (d.add(s.cardId), c && !o.has(s.cardId)) {
421
+ t.push({
422
+ code: "unknown_card",
423
+ path: `${r}.cardId`,
424
+ message: `${r}.cardId '${s.cardId}' does not exist.`,
425
+ inputId: e,
426
+ cardId: s.cardId
427
+ });
428
+ return;
429
+ }
430
+ s.kind === "bound" ? ie(
431
+ e,
432
+ s,
433
+ r,
434
+ o,
435
+ t,
436
+ c
437
+ ) : s.kind !== "excluded" && t.push({
438
+ code: "invalid_application",
439
+ path: r,
440
+ message: `${r}.kind must be 'bound' or 'excluded'.`,
441
+ inputId: e,
442
+ cardId: s.cardId
443
+ });
444
+ });
445
+ }
446
+ function re({
447
+ inputs: e,
448
+ dashboardFilters: n,
449
+ cards: i = [],
450
+ validateCardTargets: o = !1
451
+ }) {
452
+ const t = [], c = new Map(
453
+ (n || []).map((r) => [r.id, r])
454
+ ), d = new Map(
455
+ o ? i.map((r) => [r.id, r]) : []
456
+ ), s = [], a = /* @__PURE__ */ new Map();
457
+ return e != null && !Array.isArray(e) ? (t.push({
458
+ code: "invalid_input",
459
+ path: "dashboard.inputs",
460
+ message: "dashboard.inputs must be an array when present."
461
+ }), { ok: !1, inputs: s, issues: t }) : ((Array.isArray(e) ? e : []).forEach((r, _) => {
462
+ const f = `dashboard.inputs[${_}]`;
463
+ if (!u(r) || r.kind !== "filter" && r.kind !== "control" || !m(r.id) || !m(r.label) || !m(r.variableName) || !X(r.scope) || !Z(r.runtimeScope)) {
464
+ t.push({
465
+ code: "invalid_input",
466
+ path: f,
467
+ message: `${f} must be a complete filter or control Dashboard Input envelope.`,
468
+ inputId: u(r) && typeof r.id == "string" ? r.id : void 0
469
+ });
470
+ return;
471
+ }
472
+ if (r.kind === "control" && !u(r.control)) {
473
+ t.push({
474
+ code: "invalid_input",
475
+ path: `${f}.control`,
476
+ message: `${f}.control must be a control definition.`,
477
+ inputId: r.id
478
+ });
479
+ return;
480
+ }
481
+ const l = r;
482
+ if (l.kind === "control") {
483
+ s.push(l);
484
+ return;
485
+ }
486
+ const F = l.filter, g = l.filterReference, I = F !== void 0, R = !!g;
487
+ if (I && R) {
488
+ t.push({
489
+ code: "both_filter_definitions",
490
+ path: f,
491
+ message: `${f} must contain either filter or filterReference, not both.`,
492
+ inputId: l.id
493
+ });
494
+ return;
495
+ }
496
+ if (!I && !R) {
497
+ t.push({
498
+ code: "missing_filter_definition",
499
+ path: f,
500
+ message: `${f} must contain filter or filterReference.`,
501
+ inputId: l.id
502
+ });
503
+ return;
504
+ }
505
+ if (I && !ee(F)) {
506
+ t.push({
507
+ code: "invalid_input",
508
+ path: `${f}.filter`,
509
+ message: `${f}.filter must be a complete dashboard filter definition.`,
510
+ inputId: l.id
511
+ });
512
+ return;
513
+ }
514
+ let b, k;
515
+ if (I)
516
+ b = F, k = "embedded";
517
+ else {
518
+ if ((g == null ? void 0 : g.kind) !== "dashboardFilter") {
519
+ t.push({
520
+ code: "invalid_filter_reference",
521
+ path: `${f}.filterReference.kind`,
522
+ message: `${f}.filterReference.kind must be 'dashboardFilter'.`,
523
+ inputId: l.id
524
+ });
525
+ return;
526
+ }
527
+ const T = typeof (g == null ? void 0 : g.filterId) == "string" ? g.filterId : void 0;
528
+ if (b = T ? c.get(T) : void 0, k = "dashboardFilter", !b) {
529
+ t.push({
530
+ code: "orphaned_filter_reference",
531
+ path: `${f}.filterReference.filterId`,
532
+ message: `${f}.filterReference cannot resolve dashboard filter '${T || ""}'.`,
533
+ inputId: l.id
534
+ });
535
+ return;
536
+ }
537
+ if (b.kind === "global-date") {
538
+ t.push({
539
+ code: "global_date_reference",
540
+ path: `${f}.filterReference`,
541
+ message: `${f}.filterReference cannot reference the Global Date filter.`,
542
+ inputId: l.id
543
+ });
544
+ return;
545
+ }
546
+ const C = a.get(b.id);
547
+ if (C) {
548
+ t.push({
549
+ code: "duplicate_filter_reference",
550
+ path: `${f}.filterReference.filterId`,
551
+ message: `${f}.filterReference duplicates dashboard filter '${b.id}' already owned by Dashboard Input '${C}'.`,
552
+ inputId: l.id
553
+ });
554
+ return;
555
+ }
556
+ a.set(b.id, l.id);
557
+ }
558
+ if (!b) return;
559
+ if (l.optionSource !== void 0 && ne(
560
+ l.id,
561
+ l.optionSource,
562
+ `${f}.optionSource`,
563
+ t
564
+ ), l.application && b.kind === "global-date") {
565
+ t.push({
566
+ code: "global_date_reference",
567
+ path: `${f}.application`,
568
+ message: `${f}.application cannot map the Global Date filter.`,
569
+ inputId: l.id
570
+ });
571
+ return;
572
+ }
573
+ l.application && l.scope.kind !== "allSheets" && l.scope.kind !== "sheets" && t.push({
574
+ code: "unsupported_mapped_scope",
575
+ path: `${f}.scope`,
576
+ message: `${f}.scope must be allSheets or sheets when cardMappings are present.`,
577
+ inputId: l.id
578
+ }), te(
579
+ l.id,
580
+ l.application,
581
+ `${f}.application`,
582
+ d,
583
+ t,
584
+ o
585
+ );
586
+ const {
587
+ filter: oe,
588
+ filterReference: ae,
589
+ // A reference-backed authored input must shadow the generated
590
+ // dashboard-filter compatibility input. Older writers may have copied
591
+ // the compatibility marker onto the reference; never preserve it.
592
+ compatibility: A,
593
+ ...B
594
+ } = l;
595
+ s.push({
596
+ ...B,
597
+ filter: b,
598
+ ...I && A ? { compatibility: A } : {},
599
+ ...l.optionSource ? {
600
+ optionSource: l.optionSource
601
+ } : {},
602
+ definitionOrigin: k
603
+ });
604
+ }), t.length ? { ok: !1, inputs: s, issues: t } : { ok: !0, inputs: s });
605
+ }
606
+ function Ie(e) {
607
+ const n = re(e);
608
+ if (!n.ok) throw new J(n.issues);
609
+ return n.inputs;
610
+ }
611
+ function ye(e = () => globalThis.crypto.randomUUID()) {
612
+ return e();
613
+ }
614
+ const se = {
615
+ date: /* @__PURE__ */ new Set([
616
+ "between",
617
+ "not between",
618
+ "=",
619
+ "!=",
620
+ ">",
621
+ ">=",
622
+ "<",
623
+ "<=",
624
+ "is null",
625
+ "is not null"
626
+ ]),
627
+ number: /* @__PURE__ */ new Set([
628
+ "between",
629
+ "not between",
630
+ "=",
631
+ "!=",
632
+ ">",
633
+ ">=",
634
+ "<",
635
+ "<=",
636
+ "in",
637
+ "not in",
638
+ "is null",
639
+ "is not null"
640
+ ]),
641
+ string: /* @__PURE__ */ new Set([
642
+ "=",
643
+ "!=",
644
+ "in",
645
+ "not in",
646
+ "like",
647
+ "not like",
648
+ "is null",
649
+ "is not null"
650
+ ]),
651
+ boolean: /* @__PURE__ */ new Set(["=", "!=", "is null", "is not null"])
652
+ };
653
+ function de(e) {
654
+ const n = D(e);
655
+ return n === "number" || n === "boolean" ? n : n === "date" || n === "datetime" ? "date" : "string";
656
+ }
657
+ function $e(e, n) {
658
+ return typeof n != "string" ? !1 : se[de(e)].has(n);
659
+ }
660
+ export {
661
+ J as D,
662
+ be as a,
663
+ q as b,
664
+ j as c,
665
+ H as d,
666
+ U as e,
667
+ me as f,
668
+ he as g,
669
+ Y as h,
670
+ pe as i,
671
+ Ie as j,
672
+ ye as k,
673
+ de as l,
674
+ $e as m,
675
+ re as n,
676
+ ge as r
677
+ };