react-semaphor 0.1.537 → 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-BPJo-Fnd.js → dashboard-DTDDFQsS.js} +1 -1
  24. package/dist/chunks/{dashboard-briefing-launcher-A2uVpHCp.js → dashboard-briefing-launcher-Bb2QUqOa.js} +764 -740
  25. package/dist/chunks/{dashboard-controls-DxTuVis_.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-ByV0OwSp.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-CHu1L-lo.js → semaphor-ready-indicator-CHHoWhil.js} +65586 -62749
  55. package/dist/chunks/{shelf-drop-preview-context-i-H6DFyU.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-Bj63WwHc.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 +3 -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-B1dEQu98.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-DXPjteCU.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-DO8a0EfJ.js +0 -25004
  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
@@ -1,6 +1,7 @@
1
1
  import { parseValueFormatPreferences as _, isReportPreferenceSource as C } from "../value-format-preferences/index.js";
2
- import { i as k, A as g } from "./validators-DMSH81OM.js";
3
- const M = {
2
+ import { v as g } from "./validators-Ej1DdCXa.js";
3
+ import { i as k } from "./analytics-base-schemas-BFAoRlkU.js";
4
+ const D = {
4
5
  tz: "UTC",
5
6
  weekStart: 1,
6
7
  anchor: "now"
@@ -189,7 +190,7 @@ function h(e, a) {
189
190
  );
190
191
  return r.length || !t || !s ? { ok: !1, issues: r } : { ok: !0, value: { tz: t, weekStart: s } };
191
192
  }
192
- function D(e) {
193
+ function K(e) {
193
194
  if (!o(e))
194
195
  return {
195
196
  ok: !1,
@@ -352,7 +353,7 @@ function P(e) {
352
353
  }
353
354
  };
354
355
  }
355
- function K(e) {
356
+ function U(e) {
356
357
  if (!o(e))
357
358
  return {
358
359
  ok: !1,
@@ -380,8 +381,8 @@ function K(e) {
380
381
  };
381
382
  }
382
383
  export {
383
- M as D,
384
- D as a,
385
- K as b,
384
+ D,
385
+ K as a,
386
+ U as b,
386
387
  O as p
387
388
  };
@@ -0,0 +1,21 @@
1
+ import { c as a } from "./x-4f5U2XwU.js";
2
+ /**
3
+ * @license lucide-react v0.453.0 - ISC
4
+ *
5
+ * This source code is licensed under the ISC license.
6
+ * See the LICENSE file in the root directory of this source tree.
7
+ */
8
+ const t = a("Save", [
9
+ [
10
+ "path",
11
+ {
12
+ d: "M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",
13
+ key: "1c8476"
14
+ }
15
+ ],
16
+ ["path", { d: "M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7", key: "1ydtos" }],
17
+ ["path", { d: "M7 3v4a1 1 0 0 0 1 1h7", key: "t51u73" }]
18
+ ]);
19
+ export {
20
+ t as S
21
+ };
@@ -0,0 +1,566 @@
1
+ var G = Object.defineProperty;
2
+ var Q = (e, t, r) => t in e ? G(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
+ var k = (e, t, r) => Q(e, typeof t != "symbol" ? t + "" : t, r);
4
+ import { c as U, r as K, a as W, l as X, d as Y, f as H, i as ee, b as te, e as T, g as E, h as O, j as re, k as ae } from "./document-dashboard-inputs-D96rlU7S.js";
5
+ import { l as v } from "./common-types-CUf03Htv.js";
6
+ import { f as g, A as L, b as ne, c as se, d as w } from "./context-HD9usB1P.js";
7
+ import { a as ie, T as oe, P as de, o as I, d as P, b as _ } from "./filter-value-text-BhWugPWE.js";
8
+ import { A as le, am as ce } from "./validators-Ej1DdCXa.js";
9
+ import { a as ue } from "./metric-comparison-CojWeLqx.js";
10
+ import { i as fe, n as me, g as he } from "./custom-visual-inputs-BrUOIwln.js";
11
+ import { e as j } from "./document-sheet-utils-C1eEldxs.js";
12
+ import { s as pe } from "./stable-serialize-CfqXeiBP.js";
13
+ import { b as ge } from "./calculated-field-identity-DcBS2NPP.js";
14
+ function be(e) {
15
+ const t = e.qualifiedFieldName || e.name;
16
+ return e.label && e.label !== t ? `${e.label} (field ${t})` : t;
17
+ }
18
+ function Ce(e, t = {}) {
19
+ if (!e) return [];
20
+ const r = R(e, t);
21
+ return r.length === 0 ? [] : e.logicalOperator === "AND" && !e.negate ? r : [B(e, r)];
22
+ }
23
+ function R(e, t) {
24
+ const r = e.groups.flatMap((a) => {
25
+ const n = R(a, t);
26
+ if (n.length === 0) return [];
27
+ const s = B(a, n);
28
+ return [n.length > 1 && !a.negate ? { ...s, text: `(${s.text})` } : s];
29
+ });
30
+ return [...e.conditions.map((a) => Ie(a, t)), ...r];
31
+ }
32
+ function B(e, t) {
33
+ const r = t.map((a) => a.text).join(e.logicalOperator === "OR" ? " or " : " and ");
34
+ return {
35
+ text: e.negate ? `not (${r})` : r,
36
+ omittedValues: t.reduce((a, n) => a + n.omittedValues, 0)
37
+ };
38
+ }
39
+ function Ie(e, t) {
40
+ const r = Array.isArray(e.value) ? e.value : [e.value];
41
+ return ie({
42
+ subject: be(e.field),
43
+ operator: e.operator,
44
+ values: r,
45
+ reading: ye(e),
46
+ relative: le(e.relativeMeta),
47
+ latestValue: e.latestValue,
48
+ shownAs: e.label
49
+ }, t);
50
+ }
51
+ function ye(e) {
52
+ return e.temporalBucket ? { kind: "bucket", bucket: e.temporalBucket } : ce(e.field.dataType) ? oe : de;
53
+ }
54
+ function N(e) {
55
+ if (e.kind === "target") return `a target of ${e.targetValue}`;
56
+ const t = e.kind === "previous_period" ? e.offsetPeriods : e.offsetYears, r = e.kind === "previous_period" ? t && t > 1 ? `the period ${t} periods earlier` : "the previous period" : t && t > 1 ? `the same period ${t} years earlier` : "the same period a year earlier", a = [
57
+ e.alignment === "weekday" ? "aligned by weekday" : void 0,
58
+ e.toDate ? "to date (the same elapsed part of the period)" : void 0
59
+ ].filter(Boolean);
60
+ return a.length ? `${r}, ${a.join(", ")}` : r;
61
+ }
62
+ function xe(e) {
63
+ return (e == null ? void 0 : e.kind) === "field_date" ? `the ${JSON.stringify(e.label)} filter` : "the dashboard date";
64
+ }
65
+ function Se(e, t) {
66
+ const r = t.source === "explicit" ? "set on the measure" : `from the dashboard date comparison on ${xe(t.owner)}`;
67
+ return `${e} is compared with ${N(t.spec)} (${r})`;
68
+ }
69
+ function $(e) {
70
+ const t = pe(e) ?? "undefined";
71
+ return `${D(t, 2654435769).toString(16)}${D(t, 2246822507).toString(16)}`;
72
+ }
73
+ function D(e, t) {
74
+ let r = 3735928559 ^ t, a = 1103547991 ^ t;
75
+ for (let n = 0; n < e.length; n++) {
76
+ const s = e.charCodeAt(n);
77
+ r = Math.imul(r ^ s, 2654435761), a = Math.imul(a ^ s, 1597334677);
78
+ }
79
+ return r = Math.imul(r ^ r >>> 16, 2246822507) ^ Math.imul(a ^ a >>> 13, 3266489909), a = Math.imul(a ^ a >>> 16, 2246822507) ^ Math.imul(r ^ r >>> 13, 3266489909), 4294967296 * (2097151 & a) + (r >>> 0);
80
+ }
81
+ const u = L;
82
+ function ve(e, t, r) {
83
+ var q;
84
+ const a = t !== "pending" && (t == null ? void 0 : t.status) === "ready" ? t : void 0, n = Ve(e, t);
85
+ if (n) {
86
+ const y = t !== "pending" && (t == null ? void 0 : t.status) === "blocked" ? $e(t) : void 0, V = y ? g(y, u.textChars) : void 0;
87
+ return {
88
+ // A card that runs but is not described still changes when it runs differently.
89
+ fingerprint: $(a ? F(a, r.calendar) : { reason: n, message: V }),
90
+ description: { status: "not_described", reason: n, ...V ? { message: V } : {} }
91
+ };
92
+ }
93
+ const s = a, o = s.queryContext, d = qe(s), i = De(s, r), h = Ae(s), l = ke(s), c = o.drillSteps.map((y) => g(
94
+ `${JSON.stringify(y.label)} (then by ${y.toField.label || y.toField.name})`,
95
+ u.textChars
96
+ )), f = (q = s.card.sql) == null ? void 0 : q.trim(), p = f ? Me(s) : [], b = {
97
+ fields: I(d.length, u.cardFields),
98
+ filters: I(i.length, u.cardFilters),
99
+ controls: I(h.length, u.cardControls),
100
+ drillSteps: I(c.length, u.drillSteps),
101
+ sqlParameters: I(p.length, u.sqlParameters),
102
+ comparisons: I(l.length, u.cardFields)
103
+ }, m = Object.fromEntries(Object.entries(b).filter(([, y]) => y > 0));
104
+ return {
105
+ fingerprint: $(F(s, r.calendar)),
106
+ description: {
107
+ status: "described",
108
+ fields: d.slice(0, u.cardFields),
109
+ filters: i.slice(0, u.cardFilters),
110
+ controls: h.slice(0, u.cardControls),
111
+ drillPath: c.slice(0, u.drillSteps),
112
+ ...f ? {
113
+ sql: {
114
+ text: g(f, u.sqlChars),
115
+ parameters: p.slice(0, u.sqlParameters)
116
+ }
117
+ } : {},
118
+ ...l.length ? { comparisons: l.slice(0, u.cardFields) } : {},
119
+ ...Object.keys(m).length ? { omitted: m } : {}
120
+ }
121
+ };
122
+ }
123
+ function Ve(e, t) {
124
+ if (e.type === "matrixTable") return "matrix";
125
+ if (e.type === "custom" || fe(e)) return "custom_visual";
126
+ if (me(e.python ?? "").trim()) return "python";
127
+ if (t === "pending") return "snapshot_pending";
128
+ if ((t == null ? void 0 : t.status) !== "ready") return "snapshot_blocked";
129
+ }
130
+ function $e(e) {
131
+ if (e.message) return e.message;
132
+ const t = e.mappingDispositions.flatMap((r) => r.status === "block" ? [`${r.inputId} (${r.reason})`] : []);
133
+ return t.length ? `dashboard inputs that cannot apply to this card: ${t.join(", ")}` : void 0;
134
+ }
135
+ function F(e, t) {
136
+ return U(e.card, e.queryContext, t).queryInputIdentity;
137
+ }
138
+ const _e = [
139
+ ["row", "rows"],
140
+ ["column", "columns"],
141
+ ["measure", "metrics"],
142
+ ["detail", "details"]
143
+ ];
144
+ function qe(e) {
145
+ const { fields: t } = he({
146
+ type: e.card.type,
147
+ config: e.queryContext.finalConfig
148
+ });
149
+ return _e.flatMap(([r, a]) => t[a].map((n) => {
150
+ const s = n.aggregate, o = n.granularity;
151
+ return {
152
+ role: r,
153
+ label: g(n.label || n.name, u.labelChars),
154
+ name: g(n.name, u.labelChars),
155
+ ...s ? { aggregate: s } : {},
156
+ ...o ? { granularity: o } : {}
157
+ };
158
+ }));
159
+ }
160
+ function ke(e) {
161
+ const t = e.queryContext;
162
+ return (t.finalConfig.metricColumns ?? []).flatMap((r) => {
163
+ const a = ue({
164
+ metricComparison: r.comparison,
165
+ globalDateComparison: t.globalDateComparison
166
+ });
167
+ return a ? [g(Se(we(r.label || r.name), a), u.textChars)] : [];
168
+ });
169
+ }
170
+ function we(e) {
171
+ return JSON.stringify(e);
172
+ }
173
+ function De(e, { calendar: t }) {
174
+ const r = e.queryContext, a = { maxListedValues: u.inputValues, timeZone: t.tz }, n = e.card.inlineFilters ?? [], s = new Set(n.map((l) => l.id)), o = new Map(
175
+ [...r.queryFilterDefinitions, ...n].map((l) => [l.id, l.title])
176
+ ), d = r.cardFilterValues.map((l) => {
177
+ const c = o.get(l.filterId) || l.name, f = l.dateOwner === "global_date" ? `${c} (the dashboard date, on this card's field ${l.name})` : `${c} (field ${l.name})`, p = P(l, f, a);
178
+ return {
179
+ origin: s.has(l.filterId) ? "card_input" : "dashboard_input",
180
+ text: g(p.text, u.textChars),
181
+ ...p.omittedValues ? { omittedValues: p.omittedValues } : {}
182
+ };
183
+ }), i = r.resolvedFilterParts, h = [["card", i.authored], ["drill", i.drill], ["selection", i.selections]].flatMap(([l, c]) => Ce(c, a).map((f) => ({
184
+ origin: l,
185
+ text: g(f.text, u.textChars),
186
+ ...f.omittedValues ? { omittedValues: f.omittedValues } : {}
187
+ })));
188
+ return [...d, ...h];
189
+ }
190
+ function Fe(e) {
191
+ const t = e.queryContext, r = j({
192
+ sql: e.card.sql,
193
+ controlBindings: t.controlBindings
194
+ });
195
+ return [.../* @__PURE__ */ new Set([
196
+ ...t.controlBindings.map((n) => n.controlId),
197
+ ...r.map((n) => n.controlId)
198
+ ])].map((n) => ({
199
+ id: n,
200
+ bindings: t.controlBindings.filter((s) => s.controlId === n),
201
+ sqlParameterIds: r.filter((s) => s.controlId === n).map((s) => s.paramId)
202
+ }));
203
+ }
204
+ function Ae(e) {
205
+ const t = e.queryContext, r = new Map(
206
+ [...t.controlDefinitions, ...t.cardControlDefinitions].map((a) => [a.id, a])
207
+ );
208
+ return Fe(e).map(({ id: a, bindings: n, sqlParameterIds: s }) => {
209
+ var i;
210
+ const o = t.controlValues[a], d = /* @__PURE__ */ new Set([
211
+ ...n.filter((h) => h.target !== "sql_param").map((h) => Te(h, o)),
212
+ ...s.map((h) => `SQL parameter ${h}`)
213
+ ]);
214
+ return {
215
+ label: g(((i = r.get(a)) == null ? void 0 : i.label) || a, u.labelChars),
216
+ valueText: g(
217
+ `${_(o, { maxListedValues: u.inputValues }).text}${d.size ? `; ${[...d].join("; ")}` : ""}`,
218
+ u.textChars
219
+ )
220
+ };
221
+ });
222
+ }
223
+ function Me(e) {
224
+ const t = e.queryContext;
225
+ return j({ sql: e.card.sql, controlBindings: t.controlBindings }).map((r) => ({
226
+ name: g(r.paramId, u.labelChars),
227
+ valueText: g(
228
+ _(t.controlValues[r.controlId], { maxListedValues: u.inputValues }).text,
229
+ u.textChars
230
+ )
231
+ }));
232
+ }
233
+ function Te(e, t) {
234
+ const r = typeof t == "string" || typeof t == "number" || typeof t == "boolean" ? String(t) : void 0;
235
+ switch (e.target) {
236
+ case "sql_param":
237
+ return `SQL parameter ${e.paramId}`;
238
+ case "presentation_currency":
239
+ return "display currency only";
240
+ case "config_aggregation":
241
+ return `sets the aggregation${r && e.mapping[r] ? ` to ${e.mapping[r]}` : ""}`;
242
+ case "config_grain":
243
+ return `sets the time grain${r && e.mapping[r] ? ` to ${e.mapping[r]}` : ""}`;
244
+ case "config_field_selector":
245
+ case "config_metric_selector": {
246
+ const a = r ? e.mapping[r] : void 0, n = e.target === "config_field_selector" ? "field" : "measure";
247
+ if (!a) return `chooses the ${n}`;
248
+ const s = "kind" in a ? `Matrix ${a.id}` : `${a.label || a.name}${"aggregate" in a && a.aggregate ? ` (${a.aggregate})` : ""}`;
249
+ return `chooses the ${n} ${JSON.stringify(s)}`;
250
+ }
251
+ }
252
+ }
253
+ class S extends Error {
254
+ constructor(r, a) {
255
+ super(a);
256
+ k(this, "code");
257
+ this.name = "AssistantContextSourceError", this.code = r;
258
+ }
259
+ }
260
+ const C = L, Ee = "Untitled";
261
+ function Oe(e) {
262
+ var b;
263
+ if (e.surface === "none")
264
+ return A({
265
+ version: w,
266
+ surface: "none",
267
+ otherSheets: [],
268
+ activeInputs: [],
269
+ cards: [],
270
+ timeZone: e.timeZone
271
+ });
272
+ const { dashboard: t, sheetId: r, calendar: a } = e, n = t.sheets ?? [], s = n.find((m) => m.id === r);
273
+ if (r !== null && !s)
274
+ throw new S("sheet_not_found", `sheet ${r} is not on dashboard ${t.id}`);
275
+ const o = n.filter((m) => m.id !== r), d = s ? v(t).filter((m) => m.sheetId === r) : [], i = d.slice(0, C.summaryCards), h = e.selectedCard ? d.find((m) => m.cardId === e.selectedCard.cardId) : void 0, l = ((b = e.selectedCard) == null ? void 0 : b.card) ?? (h == null ? void 0 : h.card);
276
+ if (e.selectedCard && !l)
277
+ throw new S(
278
+ "card_not_on_sheet",
279
+ `card ${e.selectedCard.cardId} is not on sheet ${r}`
280
+ );
281
+ const c = s ? je(e, s, d) : [], f = {
282
+ otherSheets: I(o.length, C.otherSheets),
283
+ activeInputs: I(c.length, C.activeInputs),
284
+ cards: I(d.length, C.summaryCards)
285
+ }, p = Object.fromEntries(Object.entries(f).filter(([, m]) => m > 0));
286
+ return A({
287
+ version: w,
288
+ surface: e.editing ? "editor" : "dashboard",
289
+ dashboard: {
290
+ id: t.id,
291
+ title: x(t.title),
292
+ unsavedEdits: e.unsavedEdits
293
+ },
294
+ ...s ? { sheet: { id: s.id, title: x(s.title) } } : {},
295
+ otherSheets: o.slice(0, C.otherSheets).map((m) => ({ id: m.id, title: x(m.title) })),
296
+ activeInputs: c.slice(0, C.activeInputs),
297
+ cards: i.map((m) => z(m.card)),
298
+ ...l && e.selectedCard ? { selectedCard: Le(l, e.selectedCard.snapshot, a) } : {},
299
+ ...e.editing ? { editing: e.editing } : {},
300
+ ...Object.keys(p).length ? { omitted: p } : {},
301
+ timeZone: a.tz
302
+ });
303
+ }
304
+ function Le(e, t, r) {
305
+ return { ...z(e), ...ve(e, t, { calendar: r }) };
306
+ }
307
+ function A(e) {
308
+ const t = ne(e);
309
+ if (t > C.contextBytes) throw new se(t);
310
+ return e;
311
+ }
312
+ function x(e) {
313
+ return g((e == null ? void 0 : e.trim()) || Ee, C.labelChars);
314
+ }
315
+ function z(e) {
316
+ const t = Pe(e);
317
+ return {
318
+ id: e.id,
319
+ title: x(e.title),
320
+ visualType: e.type,
321
+ ...t ? { source: t } : {}
322
+ };
323
+ }
324
+ function Pe(e) {
325
+ var r;
326
+ const t = ge(e);
327
+ if (t.kind === "config")
328
+ return t.executableSources.length === 1 ? t.executableSources[0] : void 0;
329
+ if (t.kind === "sql") {
330
+ const a = ((r = e.dataSource) == null ? void 0 : r.connectionId) || e.connectionId;
331
+ return a ? { kind: "sql", connectionId: a } : void 0;
332
+ }
333
+ }
334
+ function je(e, t, r) {
335
+ const { dashboard: a } = e, n = t.kind === "document" ? "document" : "dashboard", s = n === "document" ? void 0 : e.transientContexts, { shouldApplyDashboardFilters: o } = K(s), d = (c, f) => W({
336
+ dashboard: a,
337
+ sheetId: t.id,
338
+ card: c,
339
+ sectionId: f,
340
+ runtimeValues: e.runtimeValues,
341
+ transientContexts: s,
342
+ calendar: e.calendar
343
+ }), i = /* @__PURE__ */ new Map(), h = (c) => {
344
+ c.inputs.forEach((f, p) => {
345
+ if (M(f)) return;
346
+ const b = c.resolvedInputs[p], m = i.get(f.id) ?? { input: f };
347
+ !m.resolved && b && Re(b) && (m.resolved = b), i.set(f.id, m);
348
+ });
349
+ };
350
+ h(d(null));
351
+ let l = X(a).filter((c) => {
352
+ var f;
353
+ return !M(c) && !((f = i.get(c.id)) != null && f.resolved);
354
+ });
355
+ for (const c of r) {
356
+ if (l.length === 0) break;
357
+ const f = c.kind === "documentSectionCard" ? c.sectionId : void 0, p = { sheetId: t.id, sheetKind: n, cardId: c.cardId, sectionId: f };
358
+ if (l.some((b) => Y(b, p))) {
359
+ try {
360
+ h(d(c.card, f));
361
+ } catch {
362
+ continue;
363
+ }
364
+ l = l.filter((b) => {
365
+ var m;
366
+ return !((m = i.get(b.id)) != null && m.resolved);
367
+ });
368
+ }
369
+ }
370
+ return [...i.values()].flatMap((c) => {
371
+ if (!c.resolved) return [];
372
+ const f = c.input.kind === "filter" && !o && !H(c.input), p = Be(c, e.calendar.tz, f);
373
+ return p ? [p] : [];
374
+ });
375
+ }
376
+ function M(e) {
377
+ var r;
378
+ const t = (r = e.compatibility) == null ? void 0 : r.source;
379
+ return t === "cardInlineFilter" || t === "cardControl";
380
+ }
381
+ function Re(e) {
382
+ if (e.kind === "filter") return !!e.filterValue;
383
+ const t = e.controlValue;
384
+ return t == null ? !1 : typeof t == "string" ? t.trim().length > 0 : Array.isArray(t) ? t.length > 0 : !0;
385
+ }
386
+ function Be(e, t, r) {
387
+ const { input: a, resolved: n } = e, s = x(a.label), o = {
388
+ inputId: a.id,
389
+ label: s,
390
+ ...a.kind === "filter" && ee(a.filter) ? { globalDate: !0 } : {}
391
+ };
392
+ if (a.runtimeScope === "perCard" || a.runtimeScope === "perDocumentSection")
393
+ return { ...o, value: { kind: "varies" } };
394
+ const d = { maxListedValues: C.inputValues, timeZone: t };
395
+ let i;
396
+ if ((n == null ? void 0 : n.kind) === "filter" && n.filterValue)
397
+ i = P(n.filterValue, s, d);
398
+ else if ((n == null ? void 0 : n.kind) === "control") {
399
+ const l = _(n.controlValue, d);
400
+ i = { text: `${s} is set to ${l.text}`, omittedValues: l.omittedValues };
401
+ }
402
+ if (!i) return;
403
+ const h = (n == null ? void 0 : n.kind) === "filter" ? n.comparisonSelection : void 0;
404
+ return (h == null ? void 0 : h.mode) === "period" && (i = { ...i, text: `${i.text}; compared with ${N(h.spec)}` }), {
405
+ ...o,
406
+ value: {
407
+ kind: "set",
408
+ text: g(i.text, C.textChars),
409
+ ...i.omittedValues ? { omittedValues: i.omittedValues } : {},
410
+ ...r ? { notApplied: "opened_from_another_dashboard" } : {},
411
+ // The resolved value itself, with any date comparison on it and whether
412
+ // the view applies it, so any change counts, shown or not.
413
+ fingerprint: $(
414
+ (n == null ? void 0 : n.kind) === "filter" ? { filter: n.filterValue, comparison: n.comparisonSelection ?? null, notApplied: r } : { control: n == null ? void 0 : n.controlValue }
415
+ )
416
+ }
417
+ };
418
+ }
419
+ function at(e) {
420
+ return Ne(e).context;
421
+ }
422
+ function Ne(e) {
423
+ const { place: t, calendar: r } = e, a = T(e.dashboard), n = E({ dashboard: a, host: {}, calendar: r, materializeInputs: !1 }), s = {
424
+ ...O(
425
+ a,
426
+ { filterValues: n.filterValues, controlOverrides: n.controlOverrides, dashboardInputValues: {} },
427
+ r
428
+ ),
429
+ cardViewState: t.cardViewState ?? {}
430
+ }, o = t.cardId ? Je(a, t.cardId) : void 0, d = o ? J({
431
+ dashboard: a,
432
+ location: o,
433
+ runtimeValues: s,
434
+ semanticExecutionPayload: e.semanticExecutionPayload,
435
+ calendar: r,
436
+ withRequest: !0
437
+ }) : void 0, i = Oe({
438
+ surface: "dashboard",
439
+ dashboard: a,
440
+ // A sheet that does not hold the card is refused by the projection.
441
+ sheetId: t.sheetId ?? (o == null ? void 0 : o.sheetId) ?? n.selectedSheetId,
442
+ unsavedEdits: !1,
443
+ runtimeValues: s,
444
+ transientContexts: void 0,
445
+ ...o && d !== void 0 ? { selectedCard: { cardId: o.cardId, snapshot: d } } : {},
446
+ calendar: r
447
+ });
448
+ return {
449
+ context: i,
450
+ ...i.selectedCard && d !== void 0 ? { cardReplay: ze({ dashboard: a, cardId: i.selectedCard.id, snapshot: d }) } : {}
451
+ };
452
+ }
453
+ function ze(e) {
454
+ const t = e.dashboard ? v(e.dashboard).find((a) => a.cardId === e.cardId) : void 0, r = Z({
455
+ card: e.card ?? (t == null ? void 0 : t.card),
456
+ snapshot: e.snapshot,
457
+ documentSection: (t == null ? void 0 : t.kind) === "documentSectionCard"
458
+ });
459
+ return r.status === "ready" ? { selectedCardRequest: r.request } : {
460
+ selectedCardUnavailable: {
461
+ cardId: e.cardId,
462
+ reason: r.reason,
463
+ ...r.message ? { message: r.message } : {}
464
+ }
465
+ };
466
+ }
467
+ function Je(e, t) {
468
+ const r = v(e).find((a) => a.cardId === t);
469
+ if (!r)
470
+ throw new S("card_not_found", `card ${t} is not on dashboard ${e.id}`);
471
+ return r;
472
+ }
473
+ function J(e) {
474
+ const { dashboard: t, location: r, runtimeValues: a } = e, n = r.kind === "documentSectionCard" ? Ze(t, r) : void 0;
475
+ return re({
476
+ dashboard: t,
477
+ cardId: r.cardId,
478
+ cardOverride: r.card,
479
+ sheetId: r.sheetId,
480
+ transientContexts: e.transientContexts,
481
+ cardViewStates: a.cardViewState,
482
+ viewerTableSettings: void 0,
483
+ filterValues: a.filterValues,
484
+ inlineFilterValuesMap: a.inlineFilterValuesMap,
485
+ dashboardControlValues: a.controlValues,
486
+ cardControlValuesMap: a.cardControlValuesMap,
487
+ dashboardInputValues: a.dashboardInputValues,
488
+ semanticExecutionPayload: e.semanticExecutionPayload,
489
+ calendar: e.calendar,
490
+ ...n ? { documentSection: n } : {},
491
+ ...e.withRequest ? { withRequest: !0 } : {}
492
+ });
493
+ }
494
+ function Z(e) {
495
+ var r;
496
+ const { snapshot: t } = e;
497
+ if (e.documentSection) return { status: "unavailable", reason: "document_section" };
498
+ if (((r = e.card) == null ? void 0 : r.type) === "matrixTable") return { status: "unavailable", reason: "matrix" };
499
+ if (t === "pending") return { status: "unavailable", reason: "pending" };
500
+ if (!t || t.status !== "ready")
501
+ return {
502
+ status: "unavailable",
503
+ reason: "blocked",
504
+ ...t != null && t.message ? { message: t.message } : {}
505
+ };
506
+ if (t.matrix) return { status: "unavailable", reason: "matrix" };
507
+ if (!t.request) return { status: "unavailable", reason: "no_query" };
508
+ try {
509
+ const { connectionId: a, requestPayloadBase: n } = te(t.card, t.request);
510
+ return { status: "ready", request: { cardId: t.card.id, connectionId: a, payload: n } };
511
+ } catch {
512
+ return { status: "unavailable", reason: "no_query" };
513
+ }
514
+ }
515
+ function nt(e) {
516
+ const { calendar: t } = e, r = T(e.dashboard), a = v(r).find((i) => i.cardId === e.cardId);
517
+ if (!a) return { status: "refused", reason: "card_not_found" };
518
+ if (a.kind === "documentSectionCard") return { status: "refused", reason: "document_section" };
519
+ const n = E({ dashboard: r, host: {}, calendar: t, materializeInputs: !1 }), s = {
520
+ ...O(
521
+ r,
522
+ { filterValues: n.filterValues, controlOverrides: n.controlOverrides, dashboardInputValues: {} },
523
+ t
524
+ ),
525
+ cardViewState: {}
526
+ }, o = J({
527
+ dashboard: r,
528
+ location: a,
529
+ runtimeValues: s,
530
+ semanticExecutionPayload: e.semanticExecutionPayload,
531
+ calendar: t,
532
+ withRequest: !0
533
+ });
534
+ if (!o) return { status: "refused", reason: "card_not_found" };
535
+ const d = Z({ card: a.card, snapshot: o, documentSection: !1 });
536
+ return d.status === "ready" ? d : d.reason === "pending" ? { status: "refused", reason: "blocked" } : {
537
+ status: "refused",
538
+ reason: d.reason,
539
+ ...d.message ? { message: d.message } : {}
540
+ };
541
+ }
542
+ function Ze(e, t) {
543
+ var a, n, s;
544
+ const r = (a = e.sheets) == null ? void 0 : a.find((o) => o.id === t.sheetId);
545
+ if ((s = (n = r == null ? void 0 : r.document) == null ? void 0 : n.inputs) != null && s.length && ae(e, t.sheetId).length === 0)
546
+ throw new S(
547
+ "document_inputs_not_built",
548
+ `card ${t.cardId} runs with the document's own inputs on sheet ${t.sheetId}, which only the page builds`
549
+ );
550
+ return {
551
+ sheetId: t.sheetId,
552
+ sectionId: t.sectionId,
553
+ documentFilterValues: [],
554
+ documentControlDefinitions: [],
555
+ documentControlValues: {}
556
+ };
557
+ }
558
+ export {
559
+ S as A,
560
+ ze as a,
561
+ nt as b,
562
+ Z as c,
563
+ at as d,
564
+ Ne as e,
565
+ Oe as p
566
+ };
@@ -1,5 +1,5 @@
1
- import { c } from "./x-CXDkqdur.js";
2
- import { y as h, r as f } from "./matrix-operation-contract-BKupLHXL.js";
1
+ import { c } from "./x-4f5U2XwU.js";
2
+ import { y as h, r as f } from "./matrix-operation-contract-B8PBF1Gd.js";
3
3
  /**
4
4
  * @license lucide-react v0.453.0 - ISC
5
5
  *