react-semaphor 0.1.544 → 0.1.545

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 (88) hide show
  1. package/dist/analytics-protocol/index.js +35 -34
  2. package/dist/assistant-context/index.js +1 -1
  3. package/dist/brand-studio/index.js +2 -2
  4. package/dist/briefings/index.js +50 -47
  5. package/dist/chunks/{class-utils-Df1OVOT1.js → _commonjsHelpers-DimLPMtv.js} +124 -98
  6. package/dist/chunks/{apply-dashboard-operations-Bz4n1Lq6.js → apply-dashboard-operations-CZEMsx8E.js} +778 -958
  7. package/dist/chunks/{assistant-chat-BNLkCDml.js → assistant-chat-D7sWTypJ.js} +308 -309
  8. package/dist/chunks/calendar-day-equality-dvoQp1xW.js +410 -0
  9. package/dist/chunks/{comparison-window-caption-BTkrN3W4.js → comparison-window-caption-D4E6IHPD.js} +56 -55
  10. package/dist/chunks/{custom-visual-inputs-DUtpYZOk.js → custom-visual-inputs-DLCD9Y5V.js} +8 -2
  11. package/dist/chunks/{dashboard-g5a4DKWq.js → dashboard-B1tMju0u.js} +1 -1
  12. package/dist/chunks/{dashboard-briefing-launcher-DQ_8O_e2.js → dashboard-briefing-launcher-CePgIu0Z.js} +771 -776
  13. package/dist/chunks/{dashboard-controls-8RyBTQUO.js → dashboard-controls-Cq05n3e0.js} +28 -28
  14. package/dist/chunks/{dashboard-json-7qT9jmfL.js → dashboard-json-CoYRPqxx.js} +3 -3
  15. package/dist/chunks/document-dashboard-inputs-BesAHZvB.js +3112 -0
  16. package/dist/chunks/{edit-dashboard-visual-BfJwnRIZ.js → edit-dashboard-visual-JPtNfJRb.js} +5624 -5615
  17. package/dist/chunks/{filter-value-text-CYsVYPuD.js → filter-value-text-ff7osJr7.js} +1 -1
  18. package/dist/chunks/{index-DkAyQvC6.js → index-DRWiuqyd.js} +378 -333
  19. package/dist/chunks/{matrix-formatter-CxJLkztA.js → matrix-formatter-DnCyRXJE.js} +13 -13
  20. package/dist/chunks/{numeric-presentation-DESvLiu9.js → numeric-presentation-7X_IrD58.js} +2571 -2572
  21. package/dist/chunks/{raw-temporal-presentation-CLiVi90c.js → raw-temporal-presentation-C3mUgnEx.js} +1 -1
  22. package/dist/chunks/{zoned-wall-clock-MulfA26h.js → relative-date-label-Bk2j94pA.js} +21 -64
  23. package/dist/chunks/rendered-file-D8xEuVVx.js +108 -0
  24. package/dist/chunks/{report-preferences-dialog-Df7VpRVW.js → report-preferences-dialog-DUtuUL_5.js} +631 -603
  25. package/dist/chunks/resolve-dashboard-input-context-DJ2tICwz.js +9415 -0
  26. package/dist/chunks/{saved-dashboard-context-B-mQ--nV.js → saved-dashboard-context-LrF_kW0l.js} +183 -211
  27. package/dist/chunks/selection-filter-compiler-BKXmyLrS.js +79 -0
  28. package/dist/chunks/{semaphor-ready-indicator-DDAxk8us.js → semaphor-ready-indicator-BxF96Yhv.js} +45764 -46519
  29. package/dist/chunks/{shelf-drop-preview-context-BSRPwaED.js → shelf-drop-preview-context-CNaM_Gmh.js} +885 -866
  30. package/dist/chunks/{switch-C3jLxlG0.js → switch-uDtPgQlQ.js} +44 -45
  31. package/dist/chunks/{table-export-sheet-CPfGAQ9X.js → table-export-sheet-YzMioA7Y.js} +1 -1
  32. package/dist/chunks/{use-create-flow-overlay-state-BxzFviM-.js → use-create-flow-overlay-state-CjB7ig1o.js} +105 -105
  33. package/dist/chunks/zoned-wall-clock-BkxV9jS2.js +46 -0
  34. package/dist/dashboard/index.js +1 -1
  35. package/dist/dashboard-authoring/index.js +556 -544
  36. package/dist/data-app-sdk/index.js +1 -1
  37. package/dist/format-utils/index.js +163 -152
  38. package/dist/index.js +351 -323
  39. package/dist/style.css +1 -1
  40. package/dist/surfboard/index.js +1 -1
  41. package/dist/types/briefings/attachment-outcomes.d.ts +1 -1
  42. package/dist/types/briefings/attachments.d.ts +33 -6
  43. package/dist/types/briefings/index.d.ts +6 -5
  44. package/dist/types/components/surfboard/filter/types.d.ts +0 -14
  45. package/dist/types/lib/dashboard-inputs/dashboard-filter-mapping-authoring.d.ts +68 -82
  46. package/dist/types/lib/dashboard-inputs/dashboard-input-target-context.d.ts +0 -8
  47. package/dist/types/lib/dashboard-inputs/dashboard-input-values.d.ts +35 -1
  48. package/dist/types/lib/dashboard-inputs/filter-settings.d.ts +199 -0
  49. package/dist/types/lib/dashboard-inputs/resolve-dashboard-input-context.d.ts +7 -2
  50. package/dist/types/lib/dashboard-inputs/resolve-selection-input.d.ts +1 -1
  51. package/dist/types/lib/dashboard-viewer/captured-runtime-values.d.ts +40 -0
  52. package/dist/types/lib/dashboard-viewer/compatibility-input-storage.d.ts +16 -16
  53. package/dist/types/lib/dashboard-viewer/viewer-state.d.ts +11 -9
  54. package/dist/types/lib/download-pdf.d.ts +75 -1
  55. package/dist/types/lib/hooks/use-date-filter.d.ts +5 -0
  56. package/dist/types/lib/hooks/use-text-filter.d.ts +5 -0
  57. package/dist/types/lib/matrix-table/matrix-delivery-policy.d.ts +5 -4
  58. package/dist/types/lib/query-context/assemble-card-query.d.ts +158 -0
  59. package/dist/types/lib/query-context/build-card-query-context.d.ts +3 -3
  60. package/dist/types/lib/query-context/build-dashboard-card-query-contract.d.ts +15 -6
  61. package/dist/types/lib/query-context/build-dashboard-execution-snapshot.d.ts +11 -13
  62. package/dist/types/lib/query-context/compile-dashboard-card-filters.d.ts +22 -12
  63. package/dist/types/lib/stores/dashboard-store.d.ts +39 -55
  64. package/dist/types/lib/stores/editor-store.d.ts +0 -3
  65. package/dist/types/lib/types/common-types.d.ts +21 -6
  66. package/dist/types/shared/assistant-context/saved-dashboard-context.d.ts +4 -11
  67. package/dist/types/shared/dashboard-authoring/control-execution-contract.d.ts +12 -12
  68. package/dist/types/shared/dashboard-authoring/dashboard-filter-mapping-contract.d.ts +7 -0
  69. package/dist/types/shared/dashboard-authoring/dashboard-input-scope.d.ts +92 -0
  70. package/dist/types/shared/dashboard-authoring/filter-model/ad-hoc-filter-values.d.ts +10 -0
  71. package/dist/types/shared/dashboard-authoring/filter-model/filter-definitions.d.ts +29 -0
  72. package/dist/types/shared/dashboard-authoring/filter-model/filter-values.d.ts +58 -0
  73. package/dist/types/shared/dashboard-authoring/filter-model/index.d.ts +7 -0
  74. package/dist/types/shared/dashboard-authoring/filter-model/prototype-document-inputs.d.ts +15 -0
  75. package/dist/types/shared/dashboard-authoring/filter-model/read-dashboard-filter-model.d.ts +78 -0
  76. package/dist/types/shared/dashboard-authoring/filter-model/stored-dashboard.d.ts +18 -0
  77. package/dist/types/shared/dashboard-authoring/filter-model/toolbar-filter-reach.d.ts +23 -0
  78. package/dist/types/shared/dashboard-authoring/index.d.ts +2 -0
  79. package/dist/types/shared/format-utils/exporters/index.d.ts +2 -0
  80. package/dist/types/shared/format-utils/exporters/rendered-file.d.ts +106 -0
  81. package/package.json +2 -2
  82. package/dist/chunks/_commonjsHelpers-BkfeUUK-.js +0 -28
  83. package/dist/chunks/calendar-day-equality-BmJAWduY.js +0 -460
  84. package/dist/chunks/document-dashboard-inputs-BC6p-ESg.js +0 -8087
  85. package/dist/chunks/document-sheet-utils-Duo9uLoH.js +0 -3619
  86. package/dist/chunks/sort-target-MT1WK1vX.js +0 -29
  87. package/dist/types/lib/dashboard-inputs/dashboard-filter-mapping-storage-transition.d.ts +0 -88
  88. package/dist/types/lib/dashboard-inputs/dashboard-input-scope.d.ts +0 -10
@@ -1,60 +1,57 @@
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 { r as U, a as K, l as W, d as X, f as Y, i as H, b as T, c as ee, e as E, g as O, p as te, h as re, j as ae, k as ne, m as se } from "./document-dashboard-inputs-BC6p-ESg.js";
5
- import { y as oe, al as ie } from "./validators-DMHTpf7a.js";
6
- import "./matrix-operation-contract-8OIO4gob.js";
7
- import "./analytics-base-schemas-BFAoRlkU.js";
8
- import "zod";
9
- import { c as de, e as L, b as le, a as ce } from "./document-sheet-utils-Duo9uLoH.js";
10
- import { v as S } from "./table-settings-CLZocegs.js";
11
- import { f as g, A as P, c as ue, d as fe, e as w } from "./context-ClREvqCZ.js";
12
- import { a as me, T as pe, P as he, o as I, d as R, b as _ } from "./filter-value-text-CYsVYPuD.js";
13
- import { b as ge } from "./metric-comparison-DEwi9uc2.js";
14
- import { n as be, g as Ce, b as Ie } from "./numeric-presentation-DESvLiu9.js";
15
- import { i as ye } from "./custom-visual-inputs-DUtpYZOk.js";
16
- import { s as xe } from "./stable-serialize-CfqXeiBP.js";
17
- function Ve(e) {
1
+ var Z = Object.defineProperty;
2
+ var G = (e, t, r) => t in e ? Z(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
+ var k = (e, t, r) => G(e, typeof t != "symbol" ? t + "" : t, r);
4
+ import { c as Q, e as M, r as U, l as H, d as K, a as W, i as X, b as Y, f as ee } from "./resolve-dashboard-input-context-DJ2tICwz.js";
5
+ import { r as te, p as E, a as re, b as L, c as ae, d as ne, g as se } from "./document-dashboard-inputs-BesAHZvB.js";
6
+ import { v } from "./table-settings-CLZocegs.js";
7
+ import { f as g, A as P, c as oe, d as ie, e as D } from "./context-ClREvqCZ.js";
8
+ import { a as de, T as le, P as ce, o as I, d as O, b as _ } from "./filter-value-text-ff7osJr7.js";
9
+ import { y as ue, al as me } from "./validators-DMHTpf7a.js";
10
+ import { b as fe } from "./metric-comparison-DEwi9uc2.js";
11
+ import { n as pe, g as he, b as ge } from "./numeric-presentation-7X_IrD58.js";
12
+ import { i as be } from "./custom-visual-inputs-DLCD9Y5V.js";
13
+ import { s as Ce } from "./stable-serialize-CfqXeiBP.js";
14
+ function Ie(e) {
18
15
  const t = e.qualifiedFieldName || e.name;
19
16
  return e.label && e.label !== t ? `${e.label} (field ${t})` : t;
20
17
  }
21
- function Se(e, t = {}) {
18
+ function ye(e, t = {}) {
22
19
  if (!e) return [];
23
- const r = j(e, t);
24
- return r.length === 0 ? [] : e.logicalOperator === "AND" && !e.negate ? r : [B(e, r)];
20
+ const r = R(e, t);
21
+ return r.length === 0 ? [] : e.logicalOperator === "AND" && !e.negate ? r : [j(e, r)];
25
22
  }
26
- function j(e, t) {
23
+ function R(e, t) {
27
24
  const r = e.groups.flatMap((a) => {
28
- const n = j(a, t);
25
+ const n = R(a, t);
29
26
  if (n.length === 0) return [];
30
- const s = B(a, n);
27
+ const s = j(a, n);
31
28
  return [n.length > 1 && !a.negate ? { ...s, text: `(${s.text})` } : s];
32
29
  });
33
- return [...e.conditions.map((a) => ve(a, t)), ...r];
30
+ return [...e.conditions.map((a) => xe(a, t)), ...r];
34
31
  }
35
- function B(e, t) {
32
+ function j(e, t) {
36
33
  const r = t.map((a) => a.text).join(e.logicalOperator === "OR" ? " or " : " and ");
37
34
  return {
38
35
  text: e.negate ? `not (${r})` : r,
39
36
  omittedValues: t.reduce((a, n) => a + n.omittedValues, 0)
40
37
  };
41
38
  }
42
- function ve(e, t) {
39
+ function xe(e, t) {
43
40
  const r = Array.isArray(e.value) ? e.value : [e.value];
44
- return me({
45
- subject: Ve(e.field),
41
+ return de({
42
+ subject: Ie(e.field),
46
43
  operator: e.operator,
47
44
  values: r,
48
- reading: $e(e),
49
- relative: oe(e.relativeMeta),
45
+ reading: Se(e),
46
+ relative: ue(e.relativeMeta),
50
47
  latestValue: e.latestValue,
51
48
  shownAs: e.label
52
49
  }, t);
53
50
  }
54
- function $e(e) {
55
- return e.temporalBucket ? { kind: "bucket", bucket: e.temporalBucket } : ie(e.field.dataType) ? pe : he;
51
+ function Se(e) {
52
+ return e.temporalBucket ? { kind: "bucket", bucket: e.temporalBucket } : me(e.field.dataType) ? le : ce;
56
53
  }
57
- function N(e) {
54
+ function B(e) {
58
55
  if (e.kind === "target") return `a target of ${e.targetValue}`;
59
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 = [
60
57
  e.alignment === "weekday" ? "aligned by weekday" : void 0,
@@ -62,18 +59,18 @@ function N(e) {
62
59
  ].filter(Boolean);
63
60
  return a.length ? `${r}, ${a.join(", ")}` : r;
64
61
  }
65
- function _e(e) {
62
+ function ve(e) {
66
63
  return (e == null ? void 0 : e.kind) === "field_date" ? `the ${JSON.stringify(e.label)} filter` : "the dashboard date";
67
64
  }
68
- function qe(e, t) {
69
- const r = t.source === "explicit" ? "set on the measure" : `from the dashboard date comparison on ${_e(t.owner)}`;
70
- return `${e} is compared with ${N(t.spec)} (${r})`;
65
+ function Ve(e, t) {
66
+ const r = t.source === "explicit" ? "set on the measure" : `from the dashboard date comparison on ${ve(t.owner)}`;
67
+ return `${e} is compared with ${B(t.spec)} (${r})`;
71
68
  }
72
69
  function $(e) {
73
- const t = xe(e) ?? "undefined";
74
- return `${D(t, 2654435769).toString(16)}${D(t, 2246822507).toString(16)}`;
70
+ const t = Ce(e) ?? "undefined";
71
+ return `${w(t, 2654435769).toString(16)}${w(t, 2246822507).toString(16)}`;
75
72
  }
76
- function D(e, t) {
73
+ function w(e, t) {
77
74
  let r = 3735928559 ^ t, a = 1103547991 ^ t;
78
75
  for (let n = 0; n < e.length; n++) {
79
76
  const s = e.charCodeAt(n);
@@ -82,27 +79,27 @@ function D(e, t) {
82
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);
83
80
  }
84
81
  const c = P;
85
- function ke(e, t, r) {
82
+ function $e(e, t, r) {
86
83
  var q;
87
- const a = t !== "pending" && (t == null ? void 0 : t.status) === "ready" ? t : void 0, n = we(e, t);
84
+ const a = t !== "pending" && (t == null ? void 0 : t.status) === "ready" ? t : void 0, n = _e(e, t);
88
85
  if (n) {
89
- const y = t !== "pending" && (t == null ? void 0 : t.status) === "blocked" ? De(t) : void 0, v = y ? g(y, c.textChars) : void 0;
86
+ const y = t !== "pending" && (t == null ? void 0 : t.status) === "blocked" ? qe(t) : void 0, V = y ? g(y, c.textChars) : void 0;
90
87
  return {
91
88
  // A card that runs but is not described still changes when it runs differently.
92
- fingerprint: $(a ? F(a, r.calendar) : { reason: n, message: v }),
93
- description: { status: "not_described", reason: n, ...v ? { message: v } : {} }
89
+ fingerprint: $(a ? F(a, r.calendar) : { reason: n, message: V }),
90
+ description: { status: "not_described", reason: n, ...V ? { message: V } : {} }
94
91
  };
95
92
  }
96
- const s = a, i = s.queryContext, u = Ae(s), o = Ee(s, r), m = Le(s), d = Me(s), l = i.drillSteps.map((y) => g(
93
+ const s = a, d = s.queryContext, u = De(s), o = Ae(s, r), f = Me(s), i = we(s), l = d.drillSteps.map((y) => g(
97
94
  `${JSON.stringify(y.label)} (then by ${y.toField.label || y.toField.name})`,
98
95
  c.textChars
99
- )), f = (q = s.card.sql) == null ? void 0 : q.trim(), h = f ? Pe(s) : [], b = {
96
+ )), m = (q = s.card.sql) == null ? void 0 : q.trim(), h = m ? Ee(s) : [], b = {
100
97
  fields: I(u.length, c.cardFields),
101
98
  filters: I(o.length, c.cardFilters),
102
- controls: I(m.length, c.cardControls),
99
+ controls: I(f.length, c.cardControls),
103
100
  drillSteps: I(l.length, c.drillSteps),
104
101
  sqlParameters: I(h.length, c.sqlParameters),
105
- comparisons: I(d.length, c.cardFields)
102
+ comparisons: I(i.length, c.cardFields)
106
103
  }, p = Object.fromEntries(Object.entries(b).filter(([, y]) => y > 0));
107
104
  return {
108
105
  fingerprint: $(F(s, r.calendar)),
@@ -110,88 +107,88 @@ function ke(e, t, r) {
110
107
  status: "described",
111
108
  fields: u.slice(0, c.cardFields),
112
109
  filters: o.slice(0, c.cardFilters),
113
- controls: m.slice(0, c.cardControls),
110
+ controls: f.slice(0, c.cardControls),
114
111
  drillPath: l.slice(0, c.drillSteps),
115
- ...f ? {
112
+ ...m ? {
116
113
  sql: {
117
- text: g(f, c.sqlChars),
114
+ text: g(m, c.sqlChars),
118
115
  parameters: h.slice(0, c.sqlParameters)
119
116
  }
120
117
  } : {},
121
- ...d.length ? { comparisons: d.slice(0, c.cardFields) } : {},
118
+ ...i.length ? { comparisons: i.slice(0, c.cardFields) } : {},
122
119
  ...Object.keys(p).length ? { omitted: p } : {}
123
120
  }
124
121
  };
125
122
  }
126
- function we(e, t) {
123
+ function _e(e, t) {
127
124
  if (e.type === "matrixTable") return "matrix";
128
- if (e.type === "custom" || ye(e)) return "custom_visual";
129
- if (be(e.python ?? "").trim()) return "python";
125
+ if (e.type === "custom" || be(e)) return "custom_visual";
126
+ if (pe(e.python ?? "").trim()) return "python";
130
127
  if (t === "pending") return "snapshot_pending";
131
128
  if ((t == null ? void 0 : t.status) !== "ready") return "snapshot_blocked";
132
129
  }
133
- function De(e) {
130
+ function qe(e) {
134
131
  if (e.message) return e.message;
135
132
  const t = e.mappingDispositions.flatMap((r) => r.status === "block" ? [`${r.inputId} (${r.reason})`] : []);
136
133
  return t.length ? `dashboard inputs that cannot apply to this card: ${t.join(", ")}` : void 0;
137
134
  }
138
135
  function F(e, t) {
139
- return de(e.card, e.queryContext, t).queryInputIdentity;
136
+ return Q(e.card, e.queryContext, t).queryInputIdentity;
140
137
  }
141
- const Fe = [
138
+ const ke = [
142
139
  ["row", "rows"],
143
140
  ["column", "columns"],
144
141
  ["measure", "metrics"],
145
142
  ["detail", "details"]
146
143
  ];
147
- function Ae(e) {
148
- const { fields: t } = Ce({
144
+ function De(e) {
145
+ const { fields: t } = he({
149
146
  type: e.card.type,
150
147
  config: e.queryContext.finalConfig
151
148
  });
152
- return Fe.flatMap(([r, a]) => t[a].map((n) => {
153
- const s = n.aggregate, i = n.granularity;
149
+ return ke.flatMap(([r, a]) => t[a].map((n) => {
150
+ const s = n.aggregate, d = n.granularity;
154
151
  return {
155
152
  role: r,
156
153
  label: g(n.label || n.name, c.labelChars),
157
154
  name: g(n.name, c.labelChars),
158
155
  ...s ? { aggregate: s } : {},
159
- ...i ? { granularity: i } : {}
156
+ ...d ? { granularity: d } : {}
160
157
  };
161
158
  }));
162
159
  }
163
- function Me(e) {
160
+ function we(e) {
164
161
  const t = e.queryContext;
165
162
  return (t.finalConfig.metricColumns ?? []).flatMap((r) => {
166
- const a = ge({
163
+ const a = fe({
167
164
  metricComparison: r.comparison,
168
165
  globalDateComparison: t.globalDateComparison
169
166
  });
170
- return a ? [g(qe(Te(r.label || r.name), a), c.textChars)] : [];
167
+ return a ? [g(Ve(Fe(r.label || r.name), a), c.textChars)] : [];
171
168
  });
172
169
  }
173
- function Te(e) {
170
+ function Fe(e) {
174
171
  return JSON.stringify(e);
175
172
  }
176
- function Ee(e, { calendar: t }) {
177
- const r = e.queryContext, a = { maxListedValues: c.inputValues, timeZone: t.tz }, n = e.card.inlineFilters ?? [], s = new Set(n.map((d) => d.id)), i = new Map(
178
- [...r.queryFilterDefinitions, ...n].map((d) => [d.id, d.title])
179
- ), u = r.cardFilterValues.map((d) => {
180
- const l = i.get(d.filterId) || d.name, f = d.dateOwner === "global_date" ? `${l} (the dashboard date, on this card's field ${d.name})` : `${l} (field ${d.name})`, h = R(d, f, a);
173
+ function Ae(e, { calendar: t }) {
174
+ const r = e.queryContext, a = { maxListedValues: c.inputValues, timeZone: t.tz }, n = e.card.inlineFilters ?? [], s = new Set(n.map((i) => i.id)), d = new Map(
175
+ [...r.queryFilterDefinitions, ...n].map((i) => [i.id, i.title])
176
+ ), u = r.cardFilterValues.map((i) => {
177
+ const l = d.get(i.filterId) || i.name, m = i.dateOwner === "global_date" ? `${l} (the dashboard date, on this card's field ${i.name})` : `${l} (field ${i.name})`, h = O(i, m, a);
181
178
  return {
182
- origin: s.has(d.filterId) ? "card_input" : "dashboard_input",
179
+ origin: s.has(i.filterId) ? "card_input" : "dashboard_input",
183
180
  text: g(h.text, c.textChars),
184
181
  ...h.omittedValues ? { omittedValues: h.omittedValues } : {}
185
182
  };
186
- }), o = r.resolvedFilterParts, m = [["card", o.authored], ["drill", o.drill], ["selection", o.selections]].flatMap(([d, l]) => Se(l, a).map((f) => ({
187
- origin: d,
188
- text: g(f.text, c.textChars),
189
- ...f.omittedValues ? { omittedValues: f.omittedValues } : {}
183
+ }), o = r.resolvedFilterParts, f = [["card", o.authored], ["drill", o.drill], ["selection", o.selections]].flatMap(([i, l]) => ye(l, a).map((m) => ({
184
+ origin: i,
185
+ text: g(m.text, c.textChars),
186
+ ...m.omittedValues ? { omittedValues: m.omittedValues } : {}
190
187
  })));
191
- return [...u, ...m];
188
+ return [...u, ...f];
192
189
  }
193
- function Oe(e) {
194
- const t = e.queryContext, r = L({
190
+ function Te(e) {
191
+ const t = e.queryContext, r = M({
195
192
  sql: e.card.sql,
196
193
  controlBindings: t.controlBindings
197
194
  });
@@ -204,28 +201,28 @@ function Oe(e) {
204
201
  sqlParameterIds: r.filter((s) => s.controlId === n).map((s) => s.paramId)
205
202
  }));
206
203
  }
207
- function Le(e) {
204
+ function Me(e) {
208
205
  const t = e.queryContext, r = new Map(
209
206
  [...t.controlDefinitions, ...t.cardControlDefinitions].map((a) => [a.id, a])
210
207
  );
211
- return Oe(e).map(({ id: a, bindings: n, sqlParameterIds: s }) => {
208
+ return Te(e).map(({ id: a, bindings: n, sqlParameterIds: s }) => {
212
209
  var o;
213
- const i = t.controlValues[a], u = /* @__PURE__ */ new Set([
214
- ...n.filter((m) => m.target !== "sql_param").map((m) => Re(m, i)),
215
- ...s.map((m) => `SQL parameter ${m}`)
210
+ const d = t.controlValues[a], u = /* @__PURE__ */ new Set([
211
+ ...n.filter((f) => f.target !== "sql_param").map((f) => Le(f, d)),
212
+ ...s.map((f) => `SQL parameter ${f}`)
216
213
  ]);
217
214
  return {
218
215
  label: g(((o = r.get(a)) == null ? void 0 : o.label) || a, c.labelChars),
219
216
  valueText: g(
220
- `${_(i, { maxListedValues: c.inputValues }).text}${u.size ? `; ${[...u].join("; ")}` : ""}`,
217
+ `${_(d, { maxListedValues: c.inputValues }).text}${u.size ? `; ${[...u].join("; ")}` : ""}`,
221
218
  c.textChars
222
219
  )
223
220
  };
224
221
  });
225
222
  }
226
- function Pe(e) {
223
+ function Ee(e) {
227
224
  const t = e.queryContext;
228
- return L({ sql: e.card.sql, controlBindings: t.controlBindings }).map((r) => ({
225
+ return M({ sql: e.card.sql, controlBindings: t.controlBindings }).map((r) => ({
229
226
  name: g(r.paramId, c.labelChars),
230
227
  valueText: g(
231
228
  _(t.controlValues[r.controlId], { maxListedValues: c.inputValues }).text,
@@ -233,7 +230,7 @@ function Pe(e) {
233
230
  )
234
231
  }));
235
232
  }
236
- function Re(e, t) {
233
+ function Le(e, t) {
237
234
  const r = typeof t == "string" || typeof t == "number" || typeof t == "boolean" ? String(t) : void 0;
238
235
  switch (e.target) {
239
236
  case "sql_param":
@@ -253,19 +250,19 @@ function Re(e, t) {
253
250
  }
254
251
  }
255
252
  }
256
- class V extends Error {
253
+ class S extends Error {
257
254
  constructor(r, a) {
258
255
  super(a);
259
256
  k(this, "code");
260
257
  this.name = "AssistantContextSourceError", this.code = r;
261
258
  }
262
259
  }
263
- const C = P, je = "Untitled";
264
- function Be(e) {
260
+ const C = P, Pe = "Untitled";
261
+ function Oe(e) {
265
262
  var b;
266
263
  if (e.surface === "none")
267
264
  return A({
268
- version: w,
265
+ version: D,
269
266
  surface: "none",
270
267
  otherSheets: [],
271
268
  activeInputs: [],
@@ -274,20 +271,20 @@ function Be(e) {
274
271
  });
275
272
  const { dashboard: t, sheetId: r, calendar: a } = e, n = t.sheets ?? [], s = n.find((p) => p.id === r);
276
273
  if (r !== null && !s)
277
- throw new V("sheet_not_found", `sheet ${r} is not on dashboard ${t.id}`);
278
- const i = n.filter((p) => p.id !== r), u = s ? S(t).filter((p) => p.sheetId === r) : [], o = u.slice(0, C.summaryCards), m = e.selectedCard ? u.find((p) => p.cardId === e.selectedCard.cardId) : void 0, d = ((b = e.selectedCard) == null ? void 0 : b.card) ?? (m == null ? void 0 : m.card);
279
- if (e.selectedCard && !d)
280
- throw new V(
274
+ throw new S("sheet_not_found", `sheet ${r} is not on dashboard ${t.id}`);
275
+ const d = n.filter((p) => p.id !== r), u = s ? v(t).filter((p) => p.sheetId === r) : [], o = u.slice(0, C.summaryCards), f = e.selectedCard ? u.find((p) => p.cardId === e.selectedCard.cardId) : void 0, i = ((b = e.selectedCard) == null ? void 0 : b.card) ?? (f == null ? void 0 : f.card);
276
+ if (e.selectedCard && !i)
277
+ throw new S(
281
278
  "card_not_on_sheet",
282
279
  `card ${e.selectedCard.cardId} is not on sheet ${r}`
283
280
  );
284
- const l = s ? Je(e, s, u) : [], f = {
285
- otherSheets: I(i.length, C.otherSheets),
281
+ const l = s ? Be(e, s, u) : [], m = {
282
+ otherSheets: I(d.length, C.otherSheets),
286
283
  activeInputs: I(l.length, C.activeInputs),
287
284
  cards: I(u.length, C.summaryCards)
288
- }, h = Object.fromEntries(Object.entries(f).filter(([, p]) => p > 0));
285
+ }, h = Object.fromEntries(Object.entries(m).filter(([, p]) => p > 0));
289
286
  return A({
290
- version: w,
287
+ version: D,
291
288
  surface: e.editing ? "editor" : "dashboard",
292
289
  dashboard: {
293
290
  id: t.id,
@@ -295,28 +292,28 @@ function Be(e) {
295
292
  unsavedEdits: e.unsavedEdits
296
293
  },
297
294
  ...s ? { sheet: { id: s.id, title: x(s.title) } } : {},
298
- otherSheets: i.slice(0, C.otherSheets).map((p) => ({ id: p.id, title: x(p.title) })),
295
+ otherSheets: d.slice(0, C.otherSheets).map((p) => ({ id: p.id, title: x(p.title) })),
299
296
  activeInputs: l.slice(0, C.activeInputs),
300
- cards: o.map((p) => z(p.card)),
301
- ...d && e.selectedCard ? { selectedCard: Ne(d, e.selectedCard.snapshot, a) } : {},
297
+ cards: o.map((p) => N(p.card)),
298
+ ...i && e.selectedCard ? { selectedCard: Re(i, e.selectedCard.snapshot, a) } : {},
302
299
  ...e.editing ? { editing: e.editing } : {},
303
300
  ...Object.keys(h).length ? { omitted: h } : {},
304
301
  timeZone: a.tz
305
302
  });
306
303
  }
307
- function Ne(e, t, r) {
308
- return { ...z(e), ...ke(e, t, { calendar: r }) };
304
+ function Re(e, t, r) {
305
+ return { ...N(e), ...$e(e, t, { calendar: r }) };
309
306
  }
310
307
  function A(e) {
311
- const t = ue(e);
312
- if (t > C.contextBytes) throw new fe(t);
308
+ const t = oe(e);
309
+ if (t > C.contextBytes) throw new ie(t);
313
310
  return e;
314
311
  }
315
312
  function x(e) {
316
- return g((e == null ? void 0 : e.trim()) || je, C.labelChars);
313
+ return g((e == null ? void 0 : e.trim()) || Pe, C.labelChars);
317
314
  }
318
- function z(e) {
319
- const t = ze(e);
315
+ function N(e) {
316
+ const t = je(e);
320
317
  return {
321
318
  id: e.id,
322
319
  title: x(e.title),
@@ -324,9 +321,9 @@ function z(e) {
324
321
  ...t ? { source: t } : {}
325
322
  };
326
323
  }
327
- function ze(e) {
324
+ function je(e) {
328
325
  var r;
329
- const t = Ie(e);
326
+ const t = ge(e);
330
327
  if (t.kind === "config")
331
328
  return t.executableSources.length === 1 ? t.executableSources[0] : void 0;
332
329
  if (t.kind === "sql") {
@@ -334,37 +331,37 @@ function ze(e) {
334
331
  return a ? { kind: "sql", connectionId: a } : void 0;
335
332
  }
336
333
  }
337
- function Je(e, t, r) {
338
- const { dashboard: a } = e, n = t.kind === "document" ? "document" : "dashboard", s = n === "document" ? void 0 : e.transientContexts, { shouldApplyDashboardFilters: i } = U(s), u = (l, f) => K({
334
+ function Be(e, t, r) {
335
+ const { dashboard: a } = e, n = t.kind === "document" ? "document" : "dashboard", s = n === "document" ? void 0 : e.transientContexts, { shouldApplyDashboardFilters: d } = te(s), u = (l, m) => U({
339
336
  dashboard: a,
340
337
  sheetId: t.id,
341
338
  card: l,
342
- sectionId: f,
339
+ sectionId: m,
343
340
  runtimeValues: e.runtimeValues,
344
341
  transientContexts: s,
345
342
  calendar: e.calendar
346
- }), o = /* @__PURE__ */ new Map(), m = (l) => {
347
- l.inputs.forEach((f, h) => {
348
- if (M(f)) return;
349
- const b = l.resolvedInputs[h], p = o.get(f.id) ?? { input: f };
350
- !p.resolved && b && Ze(b) && (p.resolved = b), o.set(f.id, p);
343
+ }), o = /* @__PURE__ */ new Map(), f = (l) => {
344
+ l.inputs.forEach((m, h) => {
345
+ if (T(m)) return;
346
+ const b = l.resolvedInputs[h], p = o.get(m.id) ?? { input: m };
347
+ !p.resolved && b && Ne(b) && (p.resolved = b), o.set(m.id, p);
351
348
  });
352
349
  };
353
- m(u(null));
354
- let d = W(a).filter((l) => {
355
- var f;
356
- return !M(l) && !((f = o.get(l.id)) != null && f.resolved);
350
+ f(u(null));
351
+ let i = H(a).filter((l) => {
352
+ var m;
353
+ return !T(l) && !((m = o.get(l.id)) != null && m.resolved);
357
354
  });
358
355
  for (const l of r) {
359
- if (d.length === 0) break;
360
- const f = l.kind === "documentSectionCard" ? l.sectionId : void 0, h = { sheetId: t.id, sheetKind: n, cardId: l.cardId, sectionId: f };
361
- if (d.some((b) => X(b, h))) {
356
+ if (i.length === 0) break;
357
+ const m = l.kind === "documentSectionCard" ? l.sectionId : void 0, h = { sheetId: t.id, sheetKind: n, cardId: l.cardId, sectionId: m };
358
+ if (i.some((b) => K(b, h))) {
362
359
  try {
363
- m(u(l.card, f));
360
+ f(u(l.card, m));
364
361
  } catch {
365
362
  continue;
366
363
  }
367
- d = d.filter((b) => {
364
+ i = i.filter((b) => {
368
365
  var p;
369
366
  return !((p = o.get(b.id)) != null && p.resolved);
370
367
  });
@@ -372,40 +369,40 @@ function Je(e, t, r) {
372
369
  }
373
370
  return [...o.values()].flatMap((l) => {
374
371
  if (!l.resolved) return [];
375
- const f = l.input.kind === "filter" && !i && !Y(l.input), h = Ge(l, e.calendar.tz, f);
372
+ const m = l.input.kind === "filter" && !d && !W(l.input), h = ze(l, e.calendar.tz, m);
376
373
  return h ? [h] : [];
377
374
  });
378
375
  }
379
- function M(e) {
376
+ function T(e) {
380
377
  var r;
381
378
  const t = (r = e.compatibility) == null ? void 0 : r.source;
382
379
  return t === "cardInlineFilter" || t === "cardControl";
383
380
  }
384
- function Ze(e) {
381
+ function Ne(e) {
385
382
  if (e.kind === "filter") return !!e.filterValue;
386
383
  const t = e.controlValue;
387
384
  return t == null ? !1 : typeof t == "string" ? t.trim().length > 0 : Array.isArray(t) ? t.length > 0 : !0;
388
385
  }
389
- function Ge(e, t, r) {
390
- const { input: a, resolved: n } = e, s = x(a.label), i = {
386
+ function ze(e, t, r) {
387
+ const { input: a, resolved: n } = e, s = x(a.label), d = {
391
388
  inputId: a.id,
392
389
  label: s,
393
- ...a.kind === "filter" && H(a.filter) ? { globalDate: !0 } : {}
390
+ ...a.kind === "filter" && X(a.filter) ? { globalDate: !0 } : {}
394
391
  };
395
392
  if (a.runtimeScope === "perCard" || a.runtimeScope === "perDocumentSection")
396
- return { ...i, value: { kind: "varies" } };
393
+ return { ...d, value: { kind: "varies" } };
397
394
  const u = { maxListedValues: C.inputValues, timeZone: t };
398
395
  let o;
399
396
  if ((n == null ? void 0 : n.kind) === "filter" && n.filterValue)
400
- o = R(n.filterValue, s, u);
397
+ o = O(n.filterValue, s, u);
401
398
  else if ((n == null ? void 0 : n.kind) === "control") {
402
- const d = _(n.controlValue, u);
403
- o = { text: `${s} is set to ${d.text}`, omittedValues: d.omittedValues };
399
+ const i = _(n.controlValue, u);
400
+ o = { text: `${s} is set to ${i.text}`, omittedValues: i.omittedValues };
404
401
  }
405
402
  if (!o) return;
406
- const m = (n == null ? void 0 : n.kind) === "filter" ? n.comparisonSelection : void 0;
407
- return (m == null ? void 0 : m.mode) === "period" && (o = { ...o, text: `${o.text}; compared with ${N(m.spec)}` }), {
408
- ...i,
403
+ const f = (n == null ? void 0 : n.kind) === "filter" ? n.comparisonSelection : void 0;
404
+ return (f == null ? void 0 : f.mode) === "period" && (o = { ...o, text: `${o.text}; compared with ${B(f.spec)}` }), {
405
+ ...d,
409
406
  value: {
410
407
  kind: "set",
411
408
  text: g(o.text, C.textChars),
@@ -419,42 +416,38 @@ function Ge(e, t, r) {
419
416
  }
420
417
  };
421
418
  }
422
- function ft(e) {
423
- return Qe(e).context;
419
+ function st(e) {
420
+ return Je(e).context;
424
421
  }
425
- function Qe(e) {
426
- const { place: t, calendar: r } = e, a = T(e.dashboard), n = E({ dashboard: a, host: {}, calendar: r, materializeInputs: !1 }), s = {
427
- ...O(
428
- a,
429
- { filterValues: n.filterValues, controlOverrides: n.controlOverrides, dashboardInputValues: {} },
430
- r
431
- ),
422
+ function Je(e) {
423
+ const { place: t, calendar: r } = e, a = E(e.dashboard), n = ae({ dashboard: a, host: {}, calendar: r, materializeInputs: !1 }), s = {
424
+ ...L({ dashboard: a, capture: {}, calendar: r }).runtimeValues,
432
425
  cardViewState: t.cardViewState ?? {}
433
- }, i = t.cardId ? Ke(a, t.cardId) : void 0, u = i ? J({
426
+ }, d = t.cardId ? Ge(a, t.cardId) : void 0, u = d ? z({
434
427
  dashboard: a,
435
- location: i,
428
+ location: d,
436
429
  runtimeValues: s,
437
430
  semanticExecutionPayload: e.semanticExecutionPayload,
438
431
  calendar: r,
439
432
  withRequest: !0
440
- }) : void 0, o = Be({
433
+ }) : void 0, o = Oe({
441
434
  surface: "dashboard",
442
435
  dashboard: a,
443
436
  // A sheet that does not hold the card is refused by the projection.
444
- sheetId: t.sheetId ?? (i == null ? void 0 : i.sheetId) ?? n.selectedSheetId,
437
+ sheetId: t.sheetId ?? (d == null ? void 0 : d.sheetId) ?? n.selectedSheetId,
445
438
  unsavedEdits: !1,
446
439
  runtimeValues: s,
447
440
  transientContexts: void 0,
448
- ...i && u !== void 0 ? { selectedCard: { cardId: i.cardId, snapshot: u } } : {},
441
+ ...d && u !== void 0 ? { selectedCard: { cardId: d.cardId, snapshot: u } } : {},
449
442
  calendar: r
450
443
  });
451
444
  return {
452
445
  context: o,
453
- ...o.selectedCard && u !== void 0 ? { cardReplay: Ue({ dashboard: a, cardId: o.selectedCard.id, snapshot: u }) } : {}
446
+ ...o.selectedCard && u !== void 0 ? { cardReplay: Ze({ dashboard: a, cardId: o.selectedCard.id, snapshot: u }) } : {}
454
447
  };
455
448
  }
456
- function Ue(e) {
457
- const t = e.dashboard ? S(e.dashboard).find((a) => a.cardId === e.cardId) : void 0, r = Z({
449
+ function Ze(e) {
450
+ const t = e.dashboard ? v(e.dashboard).find((a) => a.cardId === e.cardId) : void 0, r = J({
458
451
  card: e.card ?? (t == null ? void 0 : t.card),
459
452
  snapshot: e.snapshot,
460
453
  documentSection: (t == null ? void 0 : t.kind) === "documentSectionCard"
@@ -467,14 +460,14 @@ function Ue(e) {
467
460
  }
468
461
  };
469
462
  }
470
- function Ke(e, t) {
471
- const r = S(e).find((a) => a.cardId === t);
463
+ function Ge(e, t) {
464
+ const r = v(e).find((a) => a.cardId === t);
472
465
  if (!r)
473
- throw new V("card_not_found", `card ${t} is not on dashboard ${e.id}`);
466
+ throw new S("card_not_found", `card ${t} is not on dashboard ${e.id}`);
474
467
  return r;
475
468
  }
476
- function J(e) {
477
- const { dashboard: t, location: r, runtimeValues: a } = e, n = r.kind === "documentSectionCard" ? Xe(t, r) : void 0;
469
+ function z(e) {
470
+ const { dashboard: t, location: r, runtimeValues: a } = e, n = r.kind === "documentSectionCard" ? Qe(t, r) : void 0;
478
471
  return ne({
479
472
  dashboard: t,
480
473
  cardId: r.cardId,
@@ -483,7 +476,7 @@ function J(e) {
483
476
  transientContexts: e.transientContexts,
484
477
  cardViewStates: a.cardViewState,
485
478
  viewerTableSettings: void 0,
486
- filterValues: a.filterValues,
479
+ adHocFilterValues: a.adHocFilterValues,
487
480
  inlineFilterValuesMap: a.inlineFilterValuesMap,
488
481
  dashboardControlValues: a.controlValues,
489
482
  cardControlValuesMap: a.cardControlValuesMap,
@@ -494,7 +487,7 @@ function J(e) {
494
487
  ...e.withRequest ? { withRequest: !0 } : {}
495
488
  });
496
489
  }
497
- function Z(e) {
490
+ function J(e) {
498
491
  var r;
499
492
  const { snapshot: t } = e;
500
493
  if (e.documentSection) return { status: "unavailable", reason: "document_section" };
@@ -509,68 +502,47 @@ function Z(e) {
509
502
  if (t.matrix) return { status: "unavailable", reason: "matrix" };
510
503
  if (!t.request) return { status: "unavailable", reason: "no_query" };
511
504
  try {
512
- const { connectionId: a, requestPayloadBase: n } = le(t.card, t.request);
505
+ const { connectionId: a, requestPayloadBase: n } = Y(t.card, t.request);
513
506
  return { status: "ready", request: { cardId: t.card.id, connectionId: a, payload: n } };
514
507
  } catch {
515
508
  return { status: "unavailable", reason: "no_query" };
516
509
  }
517
510
  }
518
- function We(e, t, r) {
519
- const a = E({
520
- dashboard: e,
521
- host: { filterValues: t.filterValues, controlValues: t.controlValues },
522
- calendar: r,
523
- materializeInputs: !1
524
- }), n = t.dashboardInputExecutionSnapshot, s = {
525
- ...O(
526
- e,
527
- {
528
- filterValues: a.filterValues,
529
- controlOverrides: a.controlOverrides,
530
- dashboardInputValues: n ? re({
531
- dashboard: e,
532
- dashboardInputValues: n.dashboardInputValues,
533
- sheetId: n.sheetId,
534
- cardId: n.cardId
535
- }) : {}
536
- },
537
- r
538
- ),
539
- cardViewState: n ? te(n.cardViewState) : {}
540
- }, i = n ? ae(n.transientContexts) : void 0;
541
- return { runtimeValues: s, ...i != null && i.length ? { transientContexts: i } : {} };
542
- }
543
- function mt(e) {
544
- const { calendar: t } = e, r = e.host ?? {}, a = T(
545
- r.controlContract ? ee(ce(e.dashboard), {
511
+ function ot(e) {
512
+ const { calendar: t } = e, r = e.host ?? {}, a = E(
513
+ r.controlContract ? re(ee(e.dashboard), {
546
514
  controlContractOverrides: r.controlContract,
547
515
  cardId: e.cardId
548
516
  }) : e.dashboard
549
- ), n = S(a).find((m) => m.cardId === e.cardId);
517
+ ), n = v(a).find((f) => f.cardId === e.cardId);
550
518
  if (!n) return { status: "refused", reason: "card_not_found" };
551
519
  if (n.kind === "documentSectionCard") return { status: "refused", reason: "document_section" };
552
- const { runtimeValues: s, transientContexts: i } = We(a, r, t), u = J({
520
+ const { runtimeValues: s, transientContexts: d } = L({
521
+ dashboard: a,
522
+ capture: r,
523
+ calendar: t
524
+ }), u = z({
553
525
  dashboard: a,
554
526
  location: n,
555
527
  runtimeValues: s,
556
528
  semanticExecutionPayload: e.semanticExecutionPayload,
557
529
  calendar: t,
558
- transientContexts: i,
530
+ transientContexts: d,
559
531
  withRequest: !0
560
532
  });
561
533
  if (!u) return { status: "refused", reason: "card_not_found" };
562
- const o = Z({ card: n.card, snapshot: u, documentSection: !1 });
534
+ const o = J({ card: n.card, snapshot: u, documentSection: !1 });
563
535
  return o.status === "ready" ? o : o.reason === "pending" ? { status: "refused", reason: "blocked" } : {
564
536
  status: "refused",
565
537
  reason: o.reason,
566
538
  ...o.message ? { message: o.message } : {}
567
539
  };
568
540
  }
569
- function Xe(e, t) {
541
+ function Qe(e, t) {
570
542
  var a, n, s;
571
- const r = (a = e.sheets) == null ? void 0 : a.find((i) => i.id === t.sheetId);
543
+ const r = (a = e.sheets) == null ? void 0 : a.find((d) => d.id === t.sheetId);
572
544
  if ((s = (n = r == null ? void 0 : r.document) == null ? void 0 : n.inputs) != null && s.length && se(e, t.sheetId).length === 0)
573
- throw new V(
545
+ throw new S(
574
546
  "document_inputs_not_built",
575
547
  `card ${t.cardId} runs with the document's own inputs on sheet ${t.sheetId}, which only the page builds`
576
548
  );
@@ -583,11 +555,11 @@ function Xe(e, t) {
583
555
  };
584
556
  }
585
557
  export {
586
- V as A,
587
- Ue as a,
588
- mt as b,
589
- Z as c,
590
- ft as d,
591
- Qe as e,
592
- Be as p
558
+ S as A,
559
+ Ze as a,
560
+ ot as b,
561
+ J as c,
562
+ st as d,
563
+ Je as e,
564
+ Oe as p
593
565
  };