react-semaphor 0.1.545 → 0.1.547

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 (159) hide show
  1. package/dist/analytics-protocol/index.js +408 -442
  2. package/dist/assistant-context/index.js +1 -1
  3. package/dist/assistant-protocol/index.js +100 -76
  4. package/dist/brand-studio/index.js +4 -4
  5. package/dist/briefings/index.js +6 -6
  6. package/dist/chunks/{add-to-dashboard-BuAqfA2Y.js → add-to-dashboard-BQRAAnc3.js} +55 -33
  7. package/dist/chunks/{analytics-base-schemas-BFAoRlkU.js → analytics-base-schemas-BKs3flFS.js} +2 -2
  8. package/dist/chunks/applied-constraints-DU-wndZ7.js +47 -0
  9. package/dist/chunks/{assistant-chat-D7sWTypJ.js → assistant-chat-CK84cPAB.js} +2826 -2595
  10. package/dist/chunks/{bookmark-state-CXw7lZ50.js → bookmark-state-Cu-a5ie_.js} +8 -15
  11. package/dist/chunks/comparison-window-caption-C2xF-eWw.js +1433 -0
  12. package/dist/chunks/{context-ClREvqCZ.js → context-BerEBuFR.js} +11 -6
  13. package/dist/chunks/custom-visual-inputs-ChL54gGm.js +295 -0
  14. package/dist/chunks/{dashboard-B1tMju0u.js → dashboard-DCk26-6i.js} +1 -1
  15. package/dist/chunks/{dashboard-briefing-launcher-CePgIu0Z.js → dashboard-briefing-launcher-CQ1eYsGy.js} +1291 -1277
  16. package/dist/chunks/dashboard-controls-BMeZjF7r.js +2307 -0
  17. package/dist/chunks/{dashboard-json-CoYRPqxx.js → dashboard-json-BZqCoanC.js} +5 -5
  18. package/dist/chunks/{document-dashboard-inputs-BesAHZvB.js → document-dashboard-inputs-tYd7ao0o.js} +877 -979
  19. package/dist/chunks/{edit-dashboard-visual-JPtNfJRb.js → edit-dashboard-visual-Bv3MHM_G.js} +2157 -2243
  20. package/dist/chunks/filter-reach-copy-CGWsL_ez.js +3480 -0
  21. package/dist/chunks/{filter-value-text-ff7osJr7.js → filter-value-text-Ddf55Ku1.js} +9 -9
  22. package/dist/chunks/global-date-filter-utils-BhAu8zIM.js +12137 -0
  23. package/dist/chunks/index-CtoK1Lgu.js +586 -0
  24. package/dist/chunks/{index-DRWiuqyd.js → index-DmrLP5Ro.js} +105 -104
  25. package/dist/chunks/list-filter-DsaTbM3J.js +15 -0
  26. package/dist/chunks/matrix-analytical-definition-B9vW-osb.js +717 -0
  27. package/dist/chunks/{matrix-card-DjwWcCo8.js → matrix-card-LiMEipvq.js} +3 -3
  28. package/dist/chunks/{matrix-formatter-DnCyRXJE.js → matrix-formatter-DWEeC0_c.js} +44 -44
  29. package/dist/chunks/{matrix-member-presentation-CQGdVks6.js → matrix-member-presentation-DqzG-UhQ.js} +1 -1
  30. package/dist/chunks/{matrix-operation-contract-8OIO4gob.js → matrix-operation-contract-D6vYkZK4.js} +72 -72
  31. package/dist/chunks/{metric-comparison-DEwi9uc2.js → metric-comparison-zpGw4lD6.js} +2 -2
  32. package/dist/chunks/normalize-dashboard-for-dirty-check-XKgH3GFX.js +119 -0
  33. package/dist/chunks/{pivot-header-presentation-DHcx1XGQ.js → pivot-header-presentation-CQnIDtUv.js} +1 -1
  34. package/dist/chunks/{pivot-result-identity-DJhXXcns.js → pivot-result-identity-C-Q1j1Wb.js} +1 -1
  35. package/dist/chunks/{pivot-result-lifecycle-DM4CyGKs.js → pivot-result-lifecycle-pwq3b7LC.js} +571 -380
  36. package/dist/chunks/{raw-temporal-contract-C51YG48G.js → raw-temporal-contract-WuXA8jBP.js} +1 -1
  37. package/dist/chunks/{raw-temporal-presentation-C3mUgnEx.js → raw-temporal-presentation-DypB7sMX.js} +8 -8
  38. package/dist/chunks/{report-preferences-dialog-DUtuUL_5.js → report-preferences-dialog-DoVyriYC.js} +154 -155
  39. package/dist/chunks/{report-runtime-context-Dq8XyODK.js → report-runtime-context-hWiTCzFV.js} +2 -2
  40. package/dist/chunks/resolve-dashboard-input-context-D0JDUa4h.js +5576 -0
  41. package/dist/chunks/{saved-dashboard-context-LrF_kW0l.js → saved-dashboard-context-BfAH5j4L.js} +34 -34
  42. package/dist/chunks/{selection-reducer-Dj_8xD69.js → selection-reducer-CJzkTZio.js} +15 -15
  43. package/dist/chunks/{semaphor-ready-indicator-BxF96Yhv.js → semaphor-ready-indicator-CRm17oIP.js} +51771 -52574
  44. package/dist/chunks/{shelf-drop-preview-context-CNaM_Gmh.js → shelf-drop-preview-context-vy6P9THz.js} +7 -7
  45. package/dist/chunks/{source-entity-resolution-BYn9giz3.js → source-entity-resolution-BIGRvtbG.js} +13 -13
  46. package/dist/chunks/{switch-uDtPgQlQ.js → switch-CEBOR4n7.js} +3 -3
  47. package/dist/chunks/{table-export-sheet-YzMioA7Y.js → table-export-sheet-4X9mAG3V.js} +1 -1
  48. package/dist/chunks/table-settings-WysCBj62.js +614 -0
  49. package/dist/chunks/{temporal-bucket-D7NBrrtL.js → temporal-bucket-CQOSbv9-.js} +26 -26
  50. package/dist/chunks/{token-types-DBbZVQsm.js → token-types-BMqRmT-C.js} +1 -1
  51. package/dist/chunks/{use-create-flow-overlay-state-CjB7ig1o.js → use-create-flow-overlay-state-Csx_Xjsh.js} +101 -101
  52. package/dist/chunks/{validators-DMHTpf7a.js → validators-C-aOQlTB.js} +713 -658
  53. package/dist/chunks/{relative-date-label-Bk2j94pA.js → zoned-wall-clock-MulfA26h.js} +64 -21
  54. package/dist/dashboard/index.js +2 -2
  55. package/dist/dashboard-authoring/index.js +1895 -1163
  56. package/dist/data-app-sdk/index.js +6 -6
  57. package/dist/data-app-sdk-adapters/index.js +3 -3
  58. package/dist/data-app-sdk-validation/index.js +14 -14
  59. package/dist/format-utils/index.js +133 -133
  60. package/dist/index.js +192 -186
  61. package/dist/layouts/index.js +5 -242
  62. package/dist/report-runtime-context/index.js +2 -2
  63. package/dist/shared/index.js +4 -5
  64. package/dist/style.css +1 -1
  65. package/dist/surfboard/index.js +2 -2
  66. package/dist/types/components/index.d.ts +2 -0
  67. package/dist/types/components/surfboard/arrange-layout-button.d.ts +8 -0
  68. package/dist/types/components/surfboard/filter/types.d.ts +7 -0
  69. package/dist/types/components/surfboard/screen-size-preview-button.d.ts +10 -0
  70. package/dist/types/components/visual/matrix-table/matrix-card-view.d.ts +3 -0
  71. package/dist/types/index.js +6 -6
  72. package/dist/types/lib/charts/table-chart-types.d.ts +4 -0
  73. package/dist/types/lib/charts/types.d.ts +2 -2
  74. package/dist/types/lib/dashboard-inputs/dashboard-filter-mapping-authoring.d.ts +346 -21
  75. package/dist/types/lib/dashboard-inputs/dashboard-filter-value-identity.d.ts +65 -0
  76. package/dist/types/lib/dashboard-inputs/dashboard-input-values.d.ts +6 -0
  77. package/dist/types/lib/dashboard-inputs/filter-settings.d.ts +2 -0
  78. package/dist/types/lib/dashboard-inputs/prepare-loaded-dashboard.d.ts +15 -0
  79. package/dist/types/lib/dashboard-inputs/resolve-selection-input.d.ts +3 -3
  80. package/dist/types/lib/hooks/use-dashboard-card.d.ts +2 -0
  81. package/dist/types/lib/matrix-table/matrix-delivery-policy.d.ts +1 -1
  82. package/dist/types/lib/matrix-table/matrix-editor.d.ts +52 -0
  83. package/dist/types/lib/matrix-table/matrix-runtime-types.d.ts +9 -1
  84. package/dist/types/lib/matrix-table/matrix-runtime.d.ts +5 -1
  85. package/dist/types/lib/query-context/dashboard-filter-mapping-resolution.d.ts +149 -10
  86. package/dist/types/lib/stores/dashboard-store.d.ts +137 -6
  87. package/dist/types/lib/types/common-types.d.ts +8 -0
  88. package/dist/types/lib/types/explorer-types.d.ts +10 -0
  89. package/dist/types/lib/types/semantic-types.d.ts +84 -0
  90. package/dist/types/lib/utils/build-saved-editor-card.d.ts +20 -0
  91. package/dist/types/lib/utils/card-type-change.d.ts +16 -0
  92. package/dist/types/lib/utils/field-availability-context.d.ts +25 -0
  93. package/dist/types/lib/utils/field-placement.d.ts +96 -0
  94. package/dist/types/lib/utils/field-state-calculator.d.ts +161 -0
  95. package/dist/types/lib/utils/qualified-entity-name.d.ts +2 -0
  96. package/dist/types/shared/analytics-protocol/applied-constraints.d.ts +57 -1
  97. package/dist/types/shared/analytics-protocol/field-provenance.d.ts +89 -0
  98. package/dist/types/shared/analytics-protocol/index.d.ts +2 -0
  99. package/dist/types/shared/analytics-protocol/query-policies.d.ts +52 -0
  100. package/dist/types/shared/analytics-protocol/time-window-schema.d.ts +1 -1
  101. package/dist/types/shared/analytics-protocol/time-window.d.ts +40 -1
  102. package/dist/types/shared/assistant-context/saved-dashboard-context.d.ts +4 -1
  103. package/dist/types/shared/assistant-protocol/answer-text.d.ts +20 -0
  104. package/dist/types/shared/assistant-protocol/context.d.ts +29 -29
  105. package/dist/types/shared/assistant-protocol/index.d.ts +1 -0
  106. package/dist/types/shared/assistant-protocol/limits.d.ts +6 -1
  107. package/dist/types/shared/assistant-protocol/parts.d.ts +43 -3
  108. package/dist/types/shared/assistant-protocol/request.d.ts +14 -2
  109. package/dist/types/shared/dashboard-authoring/calculated-field-identity.d.ts +3 -0
  110. package/dist/types/shared/dashboard-authoring/changes/card-query-part.d.ts +487 -0
  111. package/dist/types/shared/dashboard-authoring/changes/card-types.d.ts +34 -0
  112. package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +7886 -0
  113. package/dist/types/shared/dashboard-authoring/changes/diagnostics.d.ts +45 -0
  114. package/dist/types/shared/dashboard-authoring/changes/read-card-query.d.ts +54 -0
  115. package/dist/types/shared/dashboard-authoring/changes/resolve-dashboard-changes.d.ts +96 -0
  116. package/dist/types/shared/dashboard-authoring/click-to-filter-settings.d.ts +3 -3
  117. package/dist/types/shared/dashboard-authoring/column-catalog.d.ts +32 -0
  118. package/dist/types/shared/dashboard-authoring/contracts.d.ts +0 -55
  119. package/dist/types/shared/dashboard-authoring/control-execution-contract.d.ts +24 -14
  120. package/dist/types/shared/dashboard-authoring/dashboard-card-source-index.d.ts +9 -1
  121. package/dist/types/shared/dashboard-authoring/dashboard-filter-automatic-target.d.ts +4 -4
  122. package/dist/types/shared/dashboard-authoring/dashboard-filter-mapping-contract.d.ts +3 -1
  123. package/dist/types/shared/dashboard-authoring/dashboard-filter-mapping-types.d.ts +27 -1
  124. package/dist/types/shared/dashboard-authoring/dashboard-filter-value-compatibility.d.ts +12 -3
  125. package/dist/types/shared/dashboard-authoring/dashboard-input-scope.d.ts +26 -0
  126. package/dist/types/shared/dashboard-authoring/filter-applicability.d.ts +75 -0
  127. package/dist/types/shared/dashboard-authoring/filter-reach-copy.d.ts +18 -0
  128. package/dist/types/shared/dashboard-authoring/filter-reach-preview.d.ts +97 -0
  129. package/dist/types/shared/dashboard-authoring/index.d.ts +22 -2
  130. package/dist/types/shared/dashboard-authoring/operations/apply-dashboard-operations.d.ts +10 -37
  131. package/dist/types/shared/dashboard-authoring/operations/operation-types.d.ts +189 -0
  132. package/dist/types/shared/dashboard-authoring/outline/outline-dashboard.d.ts +101 -0
  133. package/dist/types/shared/dashboard-authoring/outline/outline-filters.d.ts +100 -0
  134. package/dist/types/shared/dashboard-authoring/semantic-auto-join-card.d.ts +22 -0
  135. package/dist/types/shared/dashboard-authoring/validators.d.ts +1 -2
  136. package/dist/types/shared/layouts/engine/grid.d.ts +25 -0
  137. package/dist/types/shared/layouts/engine/index.d.ts +4 -0
  138. package/dist/types/shared/layouts/engine/sheet-layout.d.ts +7 -0
  139. package/dist/types/shared/layouts/engine/types.d.ts +125 -0
  140. package/dist/types/shared/layouts/index.d.ts +1 -2
  141. package/package.json +2 -2
  142. package/dist/chunks/apply-dashboard-operations-CZEMsx8E.js +0 -2080
  143. package/dist/chunks/calendar-day-equality-dvoQp1xW.js +0 -410
  144. package/dist/chunks/comparison-window-caption-D4E6IHPD.js +0 -1624
  145. package/dist/chunks/custom-visual-inputs-DLCD9Y5V.js +0 -329
  146. package/dist/chunks/dashboard-controls-Cq05n3e0.js +0 -2315
  147. package/dist/chunks/dashboard-filter-value-compatibility-CwQ_iSNb.js +0 -108
  148. package/dist/chunks/matrix-analytical-definition-C7Gb0e12.js +0 -117
  149. package/dist/chunks/normalize-dashboard-for-dirty-check-Bk3VYv_q.js +0 -67
  150. package/dist/chunks/numeric-presentation-7X_IrD58.js +0 -5226
  151. package/dist/chunks/resolve-dashboard-input-context-DJ2tICwz.js +0 -9415
  152. package/dist/chunks/stable-serialize-CfqXeiBP.js +0 -6
  153. package/dist/chunks/table-settings-CLZocegs.js +0 -501
  154. package/dist/chunks/use-debounced-dirty-check-BwAbnX_5.js +0 -59
  155. package/dist/chunks/zoned-wall-clock-BkxV9jS2.js +0 -46
  156. package/dist/types/shared/dashboard-authoring/change-compiler.d.ts +0 -7
  157. package/dist/types/shared/dashboard-authoring/layout-compiler.d.ts +0 -2
  158. package/dist/types/shared/layouts/create-frame-layouts.d.ts +0 -27
  159. package/dist/types/shared/layouts/frame-layouts.d.ts +0 -23
@@ -0,0 +1,717 @@
1
+ import { r as G } from "./metric-comparison-zpGw4lD6.js";
2
+ import { ab as E, aw as Y, av as V, ax as J, au as X, at as ee, a0 as $, O as j, x as te } from "./validators-C-aOQlTB.js";
3
+ import { b as ne, w as h, z as F } from "./zoned-wall-clock-MulfA26h.js";
4
+ import { z as u } from "zod";
5
+ import { c as ie } from "./analytics-base-schemas-BKs3flFS.js";
6
+ function ae(e, t) {
7
+ return G({ ...e, role: t });
8
+ }
9
+ function Oe(e, t) {
10
+ if (t.id) {
11
+ const n = [];
12
+ e.forEach(
13
+ ({ fields: a }, s) => a.forEach((r, o) => {
14
+ r.id === t.id && n.push({ group: s, index: o });
15
+ })
16
+ );
17
+ const i = t.alias ? n.find(
18
+ ({ group: a, index: s }) => ae(e[a].fields[s], e[a].role) === t.alias
19
+ ) : void 0;
20
+ if (i) return i;
21
+ if (n.length === 1) return n[0];
22
+ }
23
+ for (let n = 0; n < e.length; n += 1) {
24
+ const i = e[n].fields.findIndex(
25
+ (a) => a.name === t.name && a.entityName === t.entityName && (a.alias === t.alias || !t.alias)
26
+ );
27
+ if (i !== -1) return { group: n, index: i };
28
+ }
29
+ }
30
+ function L(e, t) {
31
+ const n = e.split(".").map((o) => o.trim()), i = t.split(".").map((o) => o.trim());
32
+ if (n.length === 0 || i.length === 0 || n.some((o) => !o) || i.some((o) => !o))
33
+ return !1;
34
+ const [a, s] = n.length <= i.length ? [n, i] : [i, n], r = s.length - a.length;
35
+ return a.every((o, c) => o === s[c + r]);
36
+ }
37
+ function se(e, t) {
38
+ const n = e.split("."), i = t.split("."), a = n.pop(), s = i.pop();
39
+ return !!(a && a === s && n.length > 0 && i.length > 0 && L(
40
+ n.join("."),
41
+ i.join(".")
42
+ ));
43
+ }
44
+ function re(e) {
45
+ const t = e.map((i) => i.trim()).filter(Boolean);
46
+ if (t.every(
47
+ (i, a) => t.slice(a + 1).every(
48
+ (s) => L(i, s)
49
+ )
50
+ ))
51
+ return [...t].sort(
52
+ (i, a) => a.split(".").length - i.split(".").length
53
+ )[0];
54
+ }
55
+ function y(e) {
56
+ return typeof e == "object" && e !== null && !Array.isArray(e);
57
+ }
58
+ function P(e) {
59
+ if (typeof e != "string") return "";
60
+ const t = e.split(".").map((n) => n.trim());
61
+ return t.length > 1 && t.every(Boolean) ? t.join(".") : "";
62
+ }
63
+ function N(e) {
64
+ if (typeof e != "string") return "";
65
+ const t = e.split(".").map((n) => n.trim());
66
+ return t.length > 0 && t.every(Boolean) ? t.join(".") : "";
67
+ }
68
+ function g(e) {
69
+ return typeof e == "string" ? e.trim() : "";
70
+ }
71
+ function oe(e, t) {
72
+ return e.every(
73
+ (n, i) => e.slice(i + 1).every((a) => t(n, a))
74
+ );
75
+ }
76
+ function de(e, t) {
77
+ const n = g(e.id), i = g(e.name), a = g(t.entityId), s = g(t.entityName);
78
+ return !i || !a && !s ? !1 : (!a || a === n || a === i) && (!s || s === i);
79
+ }
80
+ function ue(e) {
81
+ const t = y(e.semanticContext) ? e.semanticContext : void 0, n = y(e.fieldMeta) ? e.fieldMeta : void 0, i = g(t == null ? void 0 : t.semanticDomainId), a = Array.isArray(t == null ? void 0 : t.selectedEntities) ? t.selectedEntities.filter(
82
+ (I) => y(I) && I.type === "dataset"
83
+ ) : [];
84
+ if (!!!(i || a.length > 0 || (n == null ? void 0 : n.entityType) === "dataset")) return;
85
+ if (!i)
86
+ return { status: "unresolved", reason: "incomplete_source_identity" };
87
+ const r = g(n == null ? void 0 : n.entityId), o = g(n == null ? void 0 : n.entityName), c = !!(r || o), m = c ? a.filter(
88
+ (I) => de(I, {
89
+ entityId: r,
90
+ entityName: o
91
+ })
92
+ ) : a;
93
+ if (m.length > 1)
94
+ return { status: "unresolved", reason: "incomplete_source_identity" };
95
+ if (c && a.length > 0 && m.length === 0)
96
+ return { status: "unresolved", reason: "divergent_source_identity" };
97
+ const l = m[0], d = g(l == null ? void 0 : l.domainId), f = g(l == null ? void 0 : l.id), p = g(l == null ? void 0 : l.name);
98
+ if (d && d !== i)
99
+ return { status: "unresolved", reason: "divergent_source_identity" };
100
+ const v = f, W = p || o;
101
+ return W ? {
102
+ status: "resolved",
103
+ source: {
104
+ kind: "semantic",
105
+ domainId: i,
106
+ datasetName: W,
107
+ ...v ? { datasetId: v } : {}
108
+ }
109
+ } : { status: "unresolved", reason: "incomplete_source_identity" };
110
+ }
111
+ function ce(e, t) {
112
+ const n = g(e.connectionId), i = y(e.semanticContext) ? e.semanticContext : void 0, a = g(i == null ? void 0 : i.connectionId);
113
+ if (n && a && n !== a)
114
+ return { status: "unresolved", reason: "divergent_source_identity" };
115
+ const s = n || a, r = y(e.fieldMeta) ? e.fieldMeta : void 0, o = t.split(".").slice(0, -1).join("."), c = N(e.qualifiedTableName), m = N(
116
+ r == null ? void 0 : r.qualifiedEntityName
117
+ ), l = [
118
+ c,
119
+ m,
120
+ o
121
+ ].filter(Boolean), d = re(l);
122
+ return !d && l.length > 0 ? { status: "unresolved", reason: "divergent_source_identity" } : !s || !d ? { status: "unresolved", reason: "incomplete_source_identity" } : {
123
+ status: "resolved",
124
+ source: { kind: "physical", connectionId: s, tableName: d }
125
+ };
126
+ }
127
+ function le(e, t) {
128
+ const n = y(e.fieldMeta) ? e.fieldMeta : void 0, i = typeof (n == null ? void 0 : n.qualifiedFieldName) == "string" ? n.qualifiedFieldName.trim() : "", a = P(
129
+ n == null ? void 0 : n.qualifiedFieldName
130
+ ), s = typeof e.column == "string" ? e.column.trim() : "", r = P(s), o = typeof e.qualifiedTableName == "string" ? e.qualifiedTableName.trim() : "", c = N(
131
+ e.qualifiedTableName
132
+ );
133
+ if (i && !a || t && o && !c || s.includes(".") && !r)
134
+ return { status: "unresolved", reason: "incomplete_field_identity" };
135
+ const m = r.split("."), l = r ? m[m.length - 1] : s, d = t && c && l ? `${c}.${l}` : "", f = [
136
+ a,
137
+ r,
138
+ d
139
+ ].filter(Boolean);
140
+ if (!oe(
141
+ f,
142
+ se
143
+ ))
144
+ return { status: "unresolved", reason: "divergent_field_identity" };
145
+ const p = r || a || d;
146
+ return p ? { status: "resolved", qualifiedFieldName: p } : { status: "unresolved", reason: "incomplete_field_identity" };
147
+ }
148
+ function fe(e) {
149
+ if (!y(e))
150
+ return { status: "ineligible", reason: "invalid_input" };
151
+ if (e.kind === "global-date")
152
+ return { status: "eligible", kind: "global_date" };
153
+ const t = E(e.dataType);
154
+ if (t !== "date" && t !== "datetime")
155
+ return { status: "ineligible", reason: "non_date_filter" };
156
+ const n = y(e.fieldMeta) ? e.fieldMeta : void 0, i = E(
157
+ n == null ? void 0 : n.dataType
158
+ );
159
+ if ((n == null ? void 0 : n.dataType) !== void 0 && i !== "date" && i !== "datetime")
160
+ return { status: "ineligible", reason: "non_date_filter" };
161
+ if (e.customFilterPreferences)
162
+ return { status: "ineligible", reason: "custom_filter" };
163
+ if (e.targetColumns !== void 0 && (!Array.isArray(e.targetColumns) || e.targetColumns.length > 0))
164
+ return { status: "ineligible", reason: "multi_target_filter" };
165
+ const a = ue(e), s = le(e, a === void 0);
166
+ if (s.status === "unresolved")
167
+ return { status: "ineligible", reason: s.reason };
168
+ const r = a || ce(e, s.qualifiedFieldName);
169
+ return r.status === "resolved" ? {
170
+ status: "eligible",
171
+ kind: "field_date",
172
+ qualifiedFieldName: s.qualifiedFieldName,
173
+ source: r.source
174
+ } : { status: "ineligible", reason: r.reason };
175
+ }
176
+ function me(e) {
177
+ if (!y(e) || e.kind !== "filter" || !y(e.filter))
178
+ return { status: "ineligible", reason: "invalid_input" };
179
+ const t = fe(
180
+ e.filter
181
+ );
182
+ return t.status === "ineligible" ? t : t.kind === "field_date" && y(e.compatibility) && e.compatibility.source === "cardInlineFilter" ? { status: "ineligible", reason: "card_inline_filter" } : t;
183
+ }
184
+ function Fe(e) {
185
+ return me(e).status === "eligible";
186
+ }
187
+ function we(e) {
188
+ return `compat-filter:${e}`;
189
+ }
190
+ function ke(e) {
191
+ return `compat-control:${e}`;
192
+ }
193
+ function We(e, t) {
194
+ return `compat-inline-filter:${e}:${t}`;
195
+ }
196
+ function $e(e, t) {
197
+ return `compat-card-control:${e}:${t}`;
198
+ }
199
+ function U(e, t) {
200
+ if (e) return e;
201
+ const n = t === void 0 ? "unknown" : E(t);
202
+ return n === "number" || n === "unknown" ? "SUM" : "COUNT";
203
+ }
204
+ function ge(e) {
205
+ const t = e.aggregate === U(e.semanticAggregate, e.dataType);
206
+ return {
207
+ effectiveAggregate: e.aggregate,
208
+ aggregateSource: t ? e.semanticAggregate ? "semantic_model" : "default_sum" : "caller_override"
209
+ };
210
+ }
211
+ function ye(e, t, n) {
212
+ const i = e.effectiveAggregate !== void 0 || e.aggregateSource !== void 0;
213
+ return {
214
+ aggregate: t,
215
+ aggregateOrigin: n,
216
+ ...i ? ge({ aggregate: t, semanticAggregate: e.semanticAggregate, dataType: e.dataType }) : {}
217
+ };
218
+ }
219
+ function je(e, t, n) {
220
+ return { ...e, ...ye(e, t, n) };
221
+ }
222
+ function Pe(e) {
223
+ return e.aggregate ?? e.effectiveAggregate;
224
+ }
225
+ function Re(e) {
226
+ if (!e.aggregate) return !1;
227
+ if (e.aggregateOrigin === "explicit" || e.aggregateSource === "caller_override") return !0;
228
+ if (e.aggregateSource) {
229
+ const t = e.aggregateSource === "default_sum" ? U(void 0, e.dataType) : e.semanticAggregate ?? e.effectiveAggregate;
230
+ return t !== void 0 && e.aggregate !== t;
231
+ }
232
+ return e.aggregateOrigin !== "default";
233
+ }
234
+ const qe = ["label", "labelOrigin", "derivedLabel"];
235
+ function xe(e) {
236
+ return { label: e, labelOrigin: "override", derivedLabel: void 0 };
237
+ }
238
+ function Le(e, t) {
239
+ const { derivedLabel: n, ...i } = e;
240
+ return { ...i, label: t, labelOrigin: "override" };
241
+ }
242
+ function Ue(e, t) {
243
+ return e.labelOrigin === "override" ? {} : { label: t, labelOrigin: "semantic" };
244
+ }
245
+ function ze(e) {
246
+ if (e.groupedDate !== void 0) return { target: e.groupedDate, direction: "asc" };
247
+ if (!(!e.grouped || e.measures.length === 0))
248
+ return { target: e.primaryMeasure ?? e.measures[0], direction: "desc" };
249
+ }
250
+ const Be = /* @__PURE__ */ new Set([
251
+ "contains",
252
+ "startsWith",
253
+ "endsWith",
254
+ "like",
255
+ "not like"
256
+ ]);
257
+ function z(e) {
258
+ return e.includes("%") || e.includes("_");
259
+ }
260
+ function pe(e, t) {
261
+ switch (e) {
262
+ case "contains":
263
+ return { pattern: `%${t}%`, negate: !1 };
264
+ case "startsWith":
265
+ return { pattern: `${t}%`, negate: !1 };
266
+ case "endsWith":
267
+ return { pattern: `%${t}`, negate: !1 };
268
+ case "like":
269
+ return { pattern: t, negate: !1 };
270
+ case "not like":
271
+ return { pattern: t, negate: !0 };
272
+ }
273
+ }
274
+ function he(e) {
275
+ return z(e) ? e : `%${e}%`;
276
+ }
277
+ function Ze(e, t) {
278
+ const { pattern: n, negate: i } = pe(e, t), a = n.length > 2 && n.startsWith("%") && n.endsWith("%") ? n.slice(1, -1) : void 0, s = a !== void 0 && !z(a) ? a : n;
279
+ if (he(s) === n)
280
+ return { operator: i ? "not_contains" : "contains", value: s };
281
+ }
282
+ const M = 864e5, w = {
283
+ second: 1e3,
284
+ minute: 6e4,
285
+ hour: 36e5
286
+ };
287
+ function O(e, t) {
288
+ return {
289
+ ...F(e, t),
290
+ millisecond: (e.getTime() % 1e3 + 1e3) % 1e3
291
+ };
292
+ }
293
+ function b(e, t) {
294
+ return ne(e, t);
295
+ }
296
+ function T(e) {
297
+ const t = new Date(e);
298
+ return {
299
+ year: t.getUTCFullYear(),
300
+ month: t.getUTCMonth() + 1,
301
+ day: t.getUTCDate(),
302
+ hour: t.getUTCHours(),
303
+ minute: t.getUTCMinutes(),
304
+ second: t.getUTCSeconds(),
305
+ millisecond: t.getUTCMilliseconds()
306
+ };
307
+ }
308
+ function B(e, t) {
309
+ const n = /* @__PURE__ */ new Date(0);
310
+ return n.setUTCFullYear(e, t, 0), n.getUTCDate();
311
+ }
312
+ function A(e, t) {
313
+ const n = e.year * 12 + (e.month - 1) + t, i = Math.floor(n / 12), a = n - i * 12 + 1;
314
+ return { ...e, year: i, month: a, day: Math.min(e.day, B(i, a)) };
315
+ }
316
+ function _(e, t, n) {
317
+ if (t === 0) return e;
318
+ switch (n) {
319
+ case "second":
320
+ case "minute":
321
+ case "hour":
322
+ return T(
323
+ h(e) + t * w[n]
324
+ );
325
+ case "day":
326
+ return T(h(e) + t * M);
327
+ case "week":
328
+ return T(h(e) + t * 7 * M);
329
+ case "month":
330
+ return A(e, t);
331
+ case "quarter":
332
+ return A(e, t * 3);
333
+ case "year":
334
+ return A(e, t * 12);
335
+ }
336
+ }
337
+ function be(e) {
338
+ return new Date(
339
+ h({ ...e, hour: 0, minute: 0, second: 0 })
340
+ ).getUTCDay();
341
+ }
342
+ function R(e) {
343
+ var n;
344
+ const t = (n = e.fiscalCalendar) == null ? void 0 : n.yearStartMonth;
345
+ return t && t >= 1 && t <= 12 ? t : 1;
346
+ }
347
+ function _e(e, t, n) {
348
+ const i = { ...e, hour: 0, minute: 0, second: 0, millisecond: 0 };
349
+ switch (t) {
350
+ case "day":
351
+ return i;
352
+ case "week":
353
+ return _(
354
+ i,
355
+ -((be(e) - n.weekStart + 7) % 7),
356
+ "day"
357
+ );
358
+ case "month":
359
+ return { ...i, day: 1 };
360
+ case "quarter": {
361
+ const a = (e.month - R(n) + 12) % 12;
362
+ return A({ ...i, day: 1 }, -(a % 3));
363
+ }
364
+ case "year": {
365
+ const a = R(n);
366
+ return {
367
+ ...i,
368
+ year: e.month >= a ? e.year : e.year - 1,
369
+ month: a,
370
+ day: 1
371
+ };
372
+ }
373
+ }
374
+ }
375
+ function C(e, t, n, i = 0) {
376
+ const a = w[t];
377
+ if (a !== void 0) {
378
+ const o = O(e, n.tz), c = o.millisecond + (t === "second" ? 0 : o.second * 1e3) + (t === "hour" ? o.minute * 6e4 : 0), m = e.getTime() - c + i * a;
379
+ return { start: new Date(m), endExclusive: new Date(m + a) };
380
+ }
381
+ const s = t, r = _(
382
+ _e(O(e, n.tz), s, n),
383
+ i,
384
+ t
385
+ );
386
+ return {
387
+ start: b(r, n.tz),
388
+ endExclusive: b(_(r, 1, t), n.tz)
389
+ };
390
+ }
391
+ function q(e, t, n) {
392
+ return C(e, t, n).start;
393
+ }
394
+ function x(e, t, n) {
395
+ return new Date(C(e, t, n).endExclusive.getTime() - 1);
396
+ }
397
+ function ve(e, t, n, i) {
398
+ return t === 0 ? e : b(
399
+ _(O(e, i.tz), t, n),
400
+ i.tz
401
+ );
402
+ }
403
+ function He(e, t, n) {
404
+ const i = (a) => {
405
+ const { year: s, month: r, day: o } = F(a, n);
406
+ return h({ year: s, month: r, day: o, hour: 0, minute: 0, second: 0 });
407
+ };
408
+ return Math.round((i(t) - i(e)) / M);
409
+ }
410
+ const Ie = /^(\d{4})-(\d{2})-(\d{2})$/;
411
+ function Ke(e, t) {
412
+ const { year: n, month: i, day: a } = F(e, t);
413
+ return `${String(n).padStart(4, "0")}-${String(i).padStart(2, "0")}-${String(a).padStart(2, "0")}`;
414
+ }
415
+ function Z(e) {
416
+ const t = Ie.exec(e);
417
+ if (!t) return null;
418
+ const n = Number(t[1]), i = Number(t[2]), a = Number(t[3]);
419
+ return i < 1 || i > 12 || a < 1 || a > B(n, i) ? null : { year: n, month: i, day: a };
420
+ }
421
+ function Qe(e, t) {
422
+ const n = Z(e);
423
+ if (!n) return null;
424
+ const i = { ...n, hour: 0, minute: 0, second: 0, millisecond: 0 };
425
+ return {
426
+ start: b(i, t),
427
+ endExclusive: b(_(i, 1, "day"), t)
428
+ };
429
+ }
430
+ function Ge(e, t, n) {
431
+ const i = (s) => new Date(C(n, e.unit, t, s).endExclusive.getTime() - 1), a = (s) => C(n, e.unit, t, s).start;
432
+ switch (e.mode) {
433
+ case "last":
434
+ return e.unit === "minute" || e.unit === "hour" ? {
435
+ start: new Date(
436
+ n.getTime() - e.n * w[e.unit]
437
+ ),
438
+ end: n
439
+ } : e.complete ? { start: a(-e.n), end: i(-1) } : { start: ve(n, -e.n, e.unit, t), end: n };
440
+ case "this": {
441
+ if (e.boundary && e.unit === "month") {
442
+ const s = e.boundary === "first_day" ? q(n, "month", t) : x(n, "month", t);
443
+ return {
444
+ start: q(s, "day", t),
445
+ end: x(s, "day", t)
446
+ };
447
+ }
448
+ return { start: a(0), end: e.toDate ? n : i(0) };
449
+ }
450
+ case "previous":
451
+ return { start: a(-1), end: i(-1) };
452
+ case "between":
453
+ return { start: a(e.from), end: i(e.to) };
454
+ }
455
+ }
456
+ function Ye(e) {
457
+ const { operation: t, values: n, temporalPrecision: i } = e;
458
+ if (t !== "=" && t !== "!=" || i === "minute")
459
+ return null;
460
+ const a = Array.isArray(n) ? n : [n];
461
+ if (a.length !== 1 || typeof a[0] != "string") return null;
462
+ const s = a[0].trim();
463
+ return Z(s) ? { operation: t, day: s } : null;
464
+ }
465
+ function Ae(e, t) {
466
+ const n = e.map((i, a) => `${t[a]} ${De(i)}`);
467
+ return u.union(e, {
468
+ errorMap: (i, a) => {
469
+ if (i.code !== u.ZodIssueCode.invalid_union) return { message: a.defaultError };
470
+ const s = i.path.length, r = a.data && typeof a.data == "object" && !Array.isArray(a.data) ? Object.keys(a.data) : [], o = i.unionErrors.map((d, f) => {
471
+ const p = Ce(e[f]);
472
+ return { index: f, issues: d.issues, overlap: p ? r.filter((v) => p.includes(v)).length : 0 };
473
+ }).filter(({ issues: d }) => !d.every((f) => f.code === u.ZodIssueCode.invalid_type && f.path.length === s)).filter(({ overlap: d }) => !r.length || d > 0);
474
+ if (!o.length) {
475
+ const d = r.length ? ` Its keys (${r.join(", ")}) belong to none of them.` : "";
476
+ return { message: `Matches none of: ${n.join("; ")}.${d}` };
477
+ }
478
+ const c = o.reduce(
479
+ (d, f) => f.overlap > d.overlap || f.overlap === d.overlap && f.issues.length < d.issues.length ? f : d
480
+ ), m = c.issues.slice(0, 4).map((d) => {
481
+ const f = d.path.slice(s).join(".");
482
+ return f ? `${d.message} at ${f}` : d.message;
483
+ }), l = c.issues.length > 4 ? ` (and ${c.issues.length - 4} more)` : "";
484
+ return {
485
+ message: `Matches none of: ${n.join("; ")}. Nearest is the ${t[c.index]}: ${m.join("; ")}${l}`
486
+ };
487
+ }
488
+ });
489
+ }
490
+ function Ce(e) {
491
+ let t = e;
492
+ for (; t instanceof u.ZodEffects; ) t = t._def.schema;
493
+ return t instanceof u.ZodObject ? Object.keys(t.shape) : void 0;
494
+ }
495
+ function De(e) {
496
+ let t = e;
497
+ for (; t instanceof u.ZodEffects; ) t = t._def.schema;
498
+ return t instanceof u.ZodObject ? `{ ${Object.entries(t.shape).map(([i, a]) => a.isOptional() ? `${i}?` : i).join(", ")} }` : "";
499
+ }
500
+ function Ve(e = {}) {
501
+ const t = (s) => e.strict ? u.object(s).strict() : u.object(s), n = t({
502
+ kind: u.literal("relative").optional(),
503
+ unit: u.enum(ie),
504
+ value: u.number().finite().int().positive(),
505
+ anchor: u.enum(V).optional(),
506
+ completeness: u.enum(Y).optional()
507
+ }).superRefine((s, r) => {
508
+ const o = J[s.unit];
509
+ s.value > o && r.addIssue({
510
+ code: u.ZodIssueCode.too_big,
511
+ maximum: o,
512
+ inclusive: !0,
513
+ type: "number",
514
+ path: ["value"],
515
+ message: `timeWindow.value must be <= ${o} for unit "${s.unit}".`
516
+ });
517
+ }), i = t({
518
+ kind: u.literal("calendar"),
519
+ unit: u.enum(ee),
520
+ period: u.enum(X),
521
+ toDate: u.boolean().optional()
522
+ }).superRefine((s, r) => {
523
+ s.toDate && s.period !== "this" && r.addIssue({
524
+ code: u.ZodIssueCode.custom,
525
+ path: ["toDate"],
526
+ message: 'timeWindow.toDate is allowed only with period "this".'
527
+ });
528
+ }), a = t({
529
+ kind: u.literal("absolute"),
530
+ start: u.string().min(1),
531
+ end: u.string().min(1)
532
+ }).superRefine((s, r) => {
533
+ const o = $(s.start), c = $(s.end);
534
+ o || r.addIssue({
535
+ code: u.ZodIssueCode.custom,
536
+ path: ["start"],
537
+ message: "timeWindow.start must be a valid ISO date or timestamp."
538
+ }), c || r.addIssue({
539
+ code: u.ZodIssueCode.custom,
540
+ path: ["end"],
541
+ message: "timeWindow.end must be a valid ISO date or timestamp."
542
+ }), o && c && o.getTime() > c.getTime() && r.addIssue({
543
+ code: u.ZodIssueCode.custom,
544
+ path: ["start"],
545
+ message: "timeWindow.start must be before or equal to timeWindow.end."
546
+ });
547
+ });
548
+ return {
549
+ relative: n,
550
+ calendar: i,
551
+ absolute: a,
552
+ timeWindow: Ae([n, i, a], ["relative window", "calendar window", "absolute window"])
553
+ };
554
+ }
555
+ function H(e) {
556
+ const { label: t, ...n } = e;
557
+ return {
558
+ dataset: te(n),
559
+ ...e.kind === "physical" ? { dialect: e.dialect, connectionType: e.connectionType } : {}
560
+ };
561
+ }
562
+ function K(e) {
563
+ const { label: t, source: n, ...i } = e;
564
+ return { ...i, source: n && H(n) };
565
+ }
566
+ function k(e) {
567
+ const {
568
+ label: t,
569
+ format: n,
570
+ description: i,
571
+ tags: a,
572
+ inputs: s,
573
+ ...r
574
+ } = e;
575
+ return {
576
+ ...r,
577
+ inputs: Object.fromEntries(
578
+ Object.entries(s).map(([o, c]) => [
579
+ o,
580
+ { ...c, field: K(c.field) }
581
+ ])
582
+ )
583
+ };
584
+ }
585
+ function S(e) {
586
+ const { derivedField: t, ...n } = e;
587
+ return {
588
+ ...K(n),
589
+ derivedField: t && k(t)
590
+ };
591
+ }
592
+ function D(e) {
593
+ const {
594
+ label: t,
595
+ format: n,
596
+ description: i,
597
+ semanticTemporalPresentation: a,
598
+ derivedField: s,
599
+ calculatedFormula: r,
600
+ ...o
601
+ } = e;
602
+ return {
603
+ ...o,
604
+ semanticTemporalPresentation: a && {
605
+ granularity: a.granularity
606
+ },
607
+ derivedField: s && k(s),
608
+ calculatedFormula: r && {
609
+ ...r,
610
+ inputFields: r.inputFields.map(D)
611
+ }
612
+ };
613
+ }
614
+ function Q(e) {
615
+ return {
616
+ ...e,
617
+ conditions: e.conditions.map(
618
+ ({ label: t, field: n, ...i }) => ({
619
+ ...i,
620
+ field: D(n)
621
+ })
622
+ ),
623
+ groups: e.groups.map(Q)
624
+ };
625
+ }
626
+ function Je(e) {
627
+ return {
628
+ ...e,
629
+ source: H(e.source),
630
+ rows: e.rows.map((t) => ({
631
+ ...t,
632
+ field: S(t.field)
633
+ })),
634
+ columns: e.columns.map((t) => ({
635
+ ...t,
636
+ field: S(t.field)
637
+ })),
638
+ measures: e.measures.map(
639
+ (t) => t.kind === "aggregate" ? { ...t, field: S(t.field) } : {
640
+ ...t,
641
+ definition: k(t.definition)
642
+ }
643
+ ),
644
+ filters: e.filters && Q(e.filters),
645
+ joinPlan: e.joinPlan && {
646
+ ...e.joinPlan,
647
+ // relationshipName participates in governed relationship resolution.
648
+ joins: e.joinPlan.joins.map((t) => ({
649
+ ...t,
650
+ joinKeyGroups: t.joinKeyGroups.map((n) => ({
651
+ ...n,
652
+ keys: n.keys.map((i) => ({
653
+ ...i,
654
+ source: D(i.source),
655
+ target: D(i.target)
656
+ }))
657
+ }))
658
+ }))
659
+ },
660
+ // Sort scopes are keyed overrides, unlike ordered axes/calculation inputs.
661
+ sorts: [...e.sorts].sort((t, n) => {
662
+ const i = j(t), a = j(n);
663
+ return i < a ? -1 : i > a ? 1 : 0;
664
+ })
665
+ };
666
+ }
667
+ export {
668
+ qe as A,
669
+ Ze as B,
670
+ O as C,
671
+ b as D,
672
+ w as E,
673
+ B as F,
674
+ _ as G,
675
+ be as H,
676
+ q as I,
677
+ x as J,
678
+ He as K,
679
+ Ke as L,
680
+ Z as M,
681
+ Qe as N,
682
+ Ge as O,
683
+ Ye as P,
684
+ Ve as Q,
685
+ L as R,
686
+ Be as S,
687
+ re as T,
688
+ k as U,
689
+ se as V,
690
+ Ae as W,
691
+ ae as a,
692
+ de as b,
693
+ me as c,
694
+ we as d,
695
+ ke as e,
696
+ Oe as f,
697
+ Je as g,
698
+ We as h,
699
+ Fe as i,
700
+ $e as j,
701
+ U as k,
702
+ ye as l,
703
+ ge as m,
704
+ Pe as n,
705
+ Re as o,
706
+ C as p,
707
+ xe as q,
708
+ fe as r,
709
+ ve as s,
710
+ Le as t,
711
+ Ue as u,
712
+ ze as v,
713
+ je as w,
714
+ z as x,
715
+ pe as y,
716
+ he as z
717
+ };