react-semaphor 0.1.601 → 0.1.603

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 (123) hide show
  1. package/dist/analytics-protocol/index.js +415 -375
  2. package/dist/assistant-context/index.js +1 -1
  3. package/dist/assistant-protocol/index.js +5 -5
  4. package/dist/brand-studio/index.js +8 -8
  5. package/dist/briefings/index.js +5 -5
  6. package/dist/chunks/{add-to-dashboard-ClhEIFst.js → add-to-dashboard-CFF-wFU-.js} +1 -1
  7. package/dist/chunks/{analytics-base-schemas-DevrgqQb.js → analytics-base-schemas-DsUh5Q3C.js} +14 -12
  8. package/dist/chunks/{assistant-chat-BE0XXzZP.js → assistant-chat-B6hNQI1t.js} +146 -146
  9. package/dist/chunks/{bookmark-impact-DXDAN5AY.js → bookmark-impact-Ba2PLcGp.js} +3 -3
  10. package/dist/chunks/{bookmark-state-BMyB3Tb6.js → bookmark-state-n7AaNzR_.js} +517 -516
  11. package/dist/chunks/{card-filter-builder-CE0-YVN5.js → card-filter-builder-Y22HizVx.js} +474 -474
  12. package/dist/chunks/{comparison-window-caption-Dxj2CHOa.js → comparison-window-caption-Ck2TIbnR.js} +69 -69
  13. package/dist/chunks/{context-BJoEFgNl.js → context-UCQ7sere.js} +1 -1
  14. package/dist/chunks/{dashboard-mJKPFRbb.js → dashboard-BghI99oY.js} +1 -1
  15. package/dist/chunks/{dashboard-briefing-launcher-CntwKyiZ.js → dashboard-briefing-launcher-DtBAnGiH.js} +725 -716
  16. package/dist/chunks/{dashboard-controls-XO089DMg.js → dashboard-controls-CtFXlyjV.js} +53 -53
  17. package/dist/chunks/{dashboard-json-CQRiydUv.js → dashboard-json-DfGBUtCd.js} +5 -5
  18. package/dist/chunks/dates-BnrXF4bb.js +185 -0
  19. package/dist/chunks/{edit-dashboard-visual-f-Dm-BLR.js → edit-dashboard-visual-oxt3x1wb.js} +8081 -8268
  20. package/dist/chunks/{filter-line-CKNMyNTQ.js → filter-line-Cy5YYqRL.js} +27 -27
  21. package/dist/chunks/{filter-reach-copy-B8GGyVuR.js → filter-reach-copy-CE_ZX147.js} +1786 -2214
  22. package/dist/chunks/{filter-value-text-CRtKecI5.js → filter-value-text-fWvSDwkl.js} +11 -11
  23. package/dist/chunks/{index-DoPApnxg.js → index-D5rxbtS4.js} +24 -24
  24. package/dist/chunks/{layout-grid-CiSCZdIr.js → layout-grid-9LndRoLa.js} +1 -1
  25. package/dist/chunks/{matrix-analytical-definition-myf3D3Qx.js → matrix-analytical-definition-CCp48UCw.js} +496 -425
  26. package/dist/chunks/matrix-member-presentation-zNehruXR.js +391 -0
  27. package/dist/chunks/{matrix-operation-contract-C1SuOHLZ.js → matrix-operation-contract-DPBj69D8.js} +518 -514
  28. package/dist/chunks/{metric-comparison-Cm0G893W.js → metric-comparison-B0FR-Q8I.js} +184 -125
  29. package/dist/chunks/{paintbrush-DQIwqlck.js → paintbrush-58FQYY-y.js} +1 -1
  30. package/dist/chunks/{palette-Cun747Rg.js → palette-Be62Tkoa.js} +1 -1
  31. package/dist/chunks/{pivot-result-contract-expectations-C1Dyx8du.js → pivot-result-contract-expectations-BYqAmG9n.js} +1236 -1190
  32. package/dist/chunks/{pivot-result-identity-CBS-ssEp.js → pivot-result-identity-CAP4--iq.js} +1 -1
  33. package/dist/chunks/raw-temporal-value-Dg_MTFF7.js +3778 -0
  34. package/dist/chunks/{report-preferences-dialog-SDZEcG2x.js → report-preferences-dialog-uJp9GBTM.js} +219 -205
  35. package/dist/chunks/{report-runtime-context-BbedQdtc.js → report-runtime-context-c77_KF9v.js} +2 -2
  36. package/dist/chunks/{resolve-dashboard-input-context-DRBS0eRa.js → resolve-dashboard-input-context-Rtl1ffmE.js} +8808 -7291
  37. package/dist/chunks/{save-Dj5bjm7P.js → save-C5A0JnEV.js} +1 -1
  38. package/dist/chunks/{saved-dashboard-context-DWVlJcsa.js → saved-dashboard-context-tcyTU8jm.js} +199 -213
  39. package/dist/chunks/selection-filter-compiler-DNijjI5y.js +150 -0
  40. package/dist/chunks/{semaphor-ready-indicator-OFOoAY-A.js → semaphor-ready-indicator-FBvunj6S.js} +37894 -35726
  41. package/dist/chunks/{shelf-drop-preview-context-2swWypXu.js → shelf-drop-preview-context-QKStrcK9.js} +54 -54
  42. package/dist/chunks/{stored-dashboard-NtOuEX6a.js → stored-dashboard-CHozcAY9.js} +770 -743
  43. package/dist/chunks/{style-sheet-parts-Qv4UcLAo.js → style-sheet-parts-CDCG-8Ej.js} +258 -251
  44. package/dist/chunks/{table-export-sheet-Do7ZB0_F.js → table-export-sheet-ZFIvs6Sj.js} +1 -1
  45. package/dist/chunks/{token-types-Dy_aXO-U.js → token-types-XbM6QByy.js} +1 -1
  46. package/dist/chunks/{upload-Bq-puSVy.js → upload-H15d7uHK.js} +1 -1
  47. package/dist/chunks/{validators-C7DFk3QK.js → validators-Baf3VIf5.js} +5 -5
  48. package/dist/chunks/{variable-draft-Cy03qnEi.js → variable-draft-C2y8Jp6Z.js} +27 -28
  49. package/dist/dashboard/index.js +2 -2
  50. package/dist/dashboard-authoring/index.js +3392 -2761
  51. package/dist/format-utils/index.js +205 -204
  52. package/dist/index.js +73 -75
  53. package/dist/report-runtime-context/index.js +2 -2
  54. package/dist/style.css +1 -1
  55. package/dist/surfboard/index.js +2 -2
  56. package/dist/types/components/dashboard/dashboard-web-component.d.ts +7 -0
  57. package/dist/types/components/ui-custom/date-range-presets.d.ts +8 -0
  58. package/dist/types/index.js +5 -5
  59. package/dist/types/lib/dashboard-inputs/dashboard-input-target-context.d.ts +1 -1
  60. package/dist/types/lib/document/document-edits.d.ts +0 -4
  61. package/dist/types/lib/query-context/assemble-card-query.d.ts +6 -1
  62. package/dist/types/lib/stores/dashboard-store.d.ts +30 -1
  63. package/dist/types/lib/types/common-types.d.ts +0 -2
  64. package/dist/types/lib/types/explorer-types.d.ts +1 -1
  65. package/dist/types/shared/analytics-protocol/aggregate-expression.d.ts +15 -0
  66. package/dist/types/shared/analytics-protocol/analytics-base-schemas.d.ts +18 -0
  67. package/dist/types/shared/analytics-protocol/analyze-result-types.d.ts +3 -0
  68. package/dist/types/shared/analytics-protocol/comparison-choices.d.ts +92 -0
  69. package/dist/types/shared/analytics-protocol/comparison-placement.d.ts +30 -0
  70. package/dist/types/shared/analytics-protocol/contracts.d.ts +11 -5
  71. package/dist/types/shared/analytics-protocol/date-window.d.ts +105 -0
  72. package/dist/types/shared/analytics-protocol/filter-field-ownership.d.ts +27 -0
  73. package/dist/types/shared/analytics-protocol/fixtures.d.ts +4 -2
  74. package/dist/types/shared/analytics-protocol/index.d.ts +3 -0
  75. package/dist/types/shared/analytics-protocol/metric-comparison.d.ts +93 -11
  76. package/dist/types/shared/assistant-protocol/context.d.ts +16 -16
  77. package/dist/types/shared/dashboard-authoring/calculations/calculated-column.d.ts +52 -0
  78. package/dist/types/shared/dashboard-authoring/calculations/definition.d.ts +129 -0
  79. package/dist/types/shared/dashboard-authoring/calculations/resolve-dashboard-field-copies.d.ts +46 -0
  80. package/dist/types/shared/dashboard-authoring/calculations/tokens.d.ts +36 -0
  81. package/dist/types/shared/dashboard-authoring/card-settings/card-display-write.d.ts +8 -0
  82. package/dist/types/shared/dashboard-authoring/card-settings/card-kinds.d.ts +1 -1
  83. package/dist/types/shared/dashboard-authoring/card-settings/inputs.d.ts +2 -1
  84. package/dist/types/shared/dashboard-authoring/card-settings/resolved.d.ts +0 -3
  85. package/dist/types/shared/dashboard-authoring/changes/calculation-change.d.ts +399 -0
  86. package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +165 -360
  87. package/dist/types/shared/dashboard-authoring/changes/diagnostics.d.ts +23 -2
  88. package/dist/types/shared/dashboard-authoring/changes/domain-change.d.ts +143 -266
  89. package/dist/types/shared/dashboard-authoring/changes/read-card-query.d.ts +2 -0
  90. package/dist/types/shared/dashboard-authoring/changes/resolve-dashboard-changes.d.ts +46 -0
  91. package/dist/types/shared/dashboard-authoring/conditional-formatting/schema.d.ts +10 -10
  92. package/dist/types/shared/dashboard-authoring/dashboard-variable-card.d.ts +2 -4
  93. package/dist/types/shared/dashboard-authoring/index.d.ts +7 -1
  94. package/dist/types/shared/dashboard-authoring/kpi-date-context.d.ts +2 -0
  95. package/dist/types/shared/dashboard-authoring/kpi-figure.d.ts +18 -0
  96. package/dist/types/shared/dashboard-authoring/measure-calculations/comparison.d.ts +8 -7
  97. package/dist/types/shared/dashboard-authoring/measure-calculations/dates.d.ts +11 -1
  98. package/dist/types/shared/dashboard-authoring/measure-calculations/index.d.ts +2 -2
  99. package/dist/types/shared/dashboard-authoring/measure-calculations/options.d.ts +4 -0
  100. package/dist/types/shared/dashboard-authoring/measure-calculations/read.d.ts +18 -1
  101. package/dist/types/shared/dashboard-authoring/measure-calculations/resolve.d.ts +2 -0
  102. package/dist/types/shared/dashboard-authoring/measure-calculations/schemas.d.ts +46 -88
  103. package/dist/types/shared/dashboard-authoring/operations/calculated-field-operations.d.ts +158 -0
  104. package/dist/types/shared/dashboard-authoring/operations/card-operations.d.ts +71 -0
  105. package/dist/types/shared/dashboard-authoring/operations/operation-types.d.ts +17 -6
  106. package/dist/types/shared/dashboard-authoring/outline/outline-dashboard.d.ts +21 -0
  107. package/dist/types/shared/dashboard-authoring/outline/outline-filters.d.ts +3 -0
  108. package/dist/types/shared/format-utils/comparison-detail.d.ts +34 -0
  109. package/dist/types/shared/format-utils/index.d.ts +1 -0
  110. package/dist/types/shared/format-utils/partial-period.d.ts +4 -2
  111. package/dist/types/shared/temporal/calendar-periods.d.ts +11 -0
  112. package/dist/types/shared/temporal/index.d.ts +2 -0
  113. package/dist/types/shared/temporal/temporal-text.d.ts +33 -0
  114. package/dist/types/shared/temporal/temporal.d.ts +27 -0
  115. package/dist/types/shared/temporal/zoned-wall-clock.d.ts +4 -3
  116. package/dist/types/shared/usage-events/details.d.ts +2 -2
  117. package/dist/types/shared/usage-events/envelope.d.ts +2 -2
  118. package/dist/usage-events/index.js +1 -1
  119. package/package.json +3 -2
  120. package/dist/chunks/dates-B-Urp5OD.js +0 -164
  121. package/dist/chunks/matrix-member-presentation-g0c_NpDW.js +0 -258
  122. package/dist/chunks/raw-temporal-value-DN_l-Tss.js +0 -454
  123. package/dist/chunks/selection-filter-compiler-DmAr7yqC.js +0 -131
@@ -1,97 +1,83 @@
1
1
  var Z = Object.defineProperty;
2
- var Q = (e, t, a) => t in e ? Z(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a;
3
- var F = (e, t, a) => Q(e, typeof t != "symbol" ? t + "" : t, a);
4
- import { D as S, F as U, G as K, H as W } from "./bookmark-state-BMyB3Tb6.js";
5
- import { s as X, k as Y, n as ee, m as te, o as ae, p as re, q as ne, t as se, u as oe, v as ie, w as j, x as de, y as le, z as ce } from "./resolve-dashboard-input-context-DRBS0eRa.js";
6
- import { c as ue, e as L, b as me, d as fe, p as q, f as he, g as pe, r as _, i as O, j as be, m as ge, k as Ce } from "./stored-dashboard-NtOuEX6a.js";
7
- import { f as g, A as P, c as Ie, d as ye, e as M } from "./context-BJoEFgNl.js";
8
- import { a as ve, T as xe, P as Ve, o as I, d as B, b as w } from "./filter-value-text-CRtKecI5.js";
9
- import { k as Se, a9 as ke } from "./validators-C7DFk3QK.js";
10
- import { b as $e } from "./metric-comparison-Cm0G893W.js";
11
- import { i as qe } from "./matrix-analytical-definition-myf3D3Qx.js";
12
- function _e(e) {
2
+ var G = (e, t, a) => t in e ? Z(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a;
3
+ var F = (e, t, a) => G(e, typeof t != "symbol" ? t + "" : t, a);
4
+ import { D as S, H as Q, I as U, F as K } from "./bookmark-state-n7AaNzR_.js";
5
+ import { s as W, t as X, u as Y, v as ee, w as te, x as ae, y as ne, z as re, A as se, q as oe, B as L, C as ie, D as de, E as le } from "./resolve-dashboard-input-context-Rtl1ffmE.js";
6
+ import { c as ce, e as j, b as ue, d as me, p as $, f as fe, g as he, r as w, i as O, j as pe, m as be, k as ge } from "./stored-dashboard-CHozcAY9.js";
7
+ import { f as g, A as P, c as Ce, d as Ie, e as A } from "./context-UCQ7sere.js";
8
+ import { a as ye, T as ve, P as xe, o as I, d as B, b as D } from "./filter-value-text-fWvSDwkl.js";
9
+ import { k as Ve, a9 as Se } from "./validators-Baf3VIf5.js";
10
+ import { aI as qe, d as ke } from "./pivot-result-contract-expectations-BYqAmG9n.js";
11
+ import { h as $e } from "./metric-comparison-B0FR-Q8I.js";
12
+ import { i as we } from "./matrix-analytical-definition-CCp48UCw.js";
13
+ function De(e) {
13
14
  const t = e.qualifiedFieldName || e.name;
14
15
  return e.label && e.label !== t ? `${e.label} (field ${t})` : t;
15
16
  }
16
- function we(e, t = {}) {
17
+ function _e(e, t = {}) {
17
18
  if (!e) return [];
18
19
  const a = N(e, t);
19
20
  return a.length === 0 ? [] : e.logicalOperator === "AND" && !e.negate ? a : [z(e, a)];
20
21
  }
21
22
  function N(e, t) {
22
- const a = e.groups.flatMap((r) => {
23
- const n = N(r, t);
24
- if (n.length === 0) return [];
25
- const s = z(r, n);
26
- return [n.length > 1 && !r.negate ? { ...s, text: `(${s.text})` } : s];
23
+ const a = e.groups.flatMap((n) => {
24
+ const r = N(n, t);
25
+ if (r.length === 0) return [];
26
+ const s = z(n, r);
27
+ return [r.length > 1 && !n.negate ? { ...s, text: `(${s.text})` } : s];
27
28
  });
28
- return [...e.conditions.map((r) => De(r, t)), ...a];
29
+ return [...e.conditions.map((n) => Fe(n, t)), ...a];
29
30
  }
30
31
  function z(e, t) {
31
- const a = t.map((r) => r.text).join(e.logicalOperator === "OR" ? " or " : " and ");
32
+ const a = t.map((n) => n.text).join(e.logicalOperator === "OR" ? " or " : " and ");
32
33
  return {
33
34
  text: e.negate ? `not (${a})` : a,
34
- omittedValues: t.reduce((r, n) => r + n.omittedValues, 0)
35
+ omittedValues: t.reduce((n, r) => n + r.omittedValues, 0)
35
36
  };
36
37
  }
37
- function De(e, t) {
38
+ function Fe(e, t) {
38
39
  const a = Array.isArray(e.value) ? e.value : [e.value];
39
- return ve({
40
- subject: _e(e.field),
40
+ return ye({
41
+ subject: De(e.field),
41
42
  operator: e.operator,
42
43
  values: a,
43
- reading: Fe(e),
44
- relative: Se(e.relativeMeta),
44
+ reading: Ae(e),
45
+ relative: Ve(e.relativeMeta),
45
46
  latestValue: e.latestValue,
46
47
  shownAs: e.label
47
48
  }, t);
48
49
  }
49
- function Fe(e) {
50
- return e.temporalBucket ? { kind: "bucket", bucket: e.temporalBucket } : ke(e.field.dataType) ? xe : Ve;
50
+ function Ae(e) {
51
+ return e.temporalBucket ? { kind: "bucket", bucket: e.temporalBucket } : Se(e.field.dataType) ? ve : xe;
51
52
  }
52
- function H(e) {
53
- if (e.kind === "target") return `a target of ${e.targetValue}`;
54
- const t = e.kind === "previous_period" ? e.offsetPeriods : e.offsetYears, a = 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", r = [
55
- e.alignment === "weekday" ? "aligned by weekday" : void 0,
56
- e.toDate ? "to date (the same elapsed part of the period)" : void 0
57
- ].filter(Boolean);
58
- return r.length ? `${a}, ${r.join(", ")}` : a;
59
- }
60
- function Me(e) {
61
- return (e == null ? void 0 : e.kind) === "field_date" ? `the ${JSON.stringify(e.label)} filter` : "the dashboard date";
62
- }
63
- function Ae(e, t) {
64
- const a = t.source === "explicit" ? "set on the measure" : `from the dashboard date comparison on ${Me(t.owner)}`;
65
- return `${e} is compared with ${H(t.spec)} (${a})`;
66
- }
67
- function $(e) {
68
- const t = X(e) ?? "undefined";
69
- return `${A(t, 2654435769).toString(16)}${A(t, 2246822507).toString(16)}`;
70
- }
71
- function A(e, t) {
72
- let a = 3735928559 ^ t, r = 1103547991 ^ t;
73
- for (let n = 0; n < e.length; n++) {
74
- const s = e.charCodeAt(n);
75
- a = Math.imul(a ^ s, 2654435761), r = Math.imul(r ^ s, 1597334677);
53
+ function k(e) {
54
+ const t = W(e) ?? "undefined";
55
+ return `${M(t, 2654435769).toString(16)}${M(t, 2246822507).toString(16)}`;
56
+ }
57
+ function M(e, t) {
58
+ let a = 3735928559 ^ t, n = 1103547991 ^ t;
59
+ for (let r = 0; r < e.length; r++) {
60
+ const s = e.charCodeAt(r);
61
+ a = Math.imul(a ^ s, 2654435761), n = Math.imul(n ^ s, 1597334677);
76
62
  }
77
- return a = Math.imul(a ^ a >>> 16, 2246822507) ^ Math.imul(r ^ r >>> 13, 3266489909), r = Math.imul(r ^ r >>> 16, 2246822507) ^ Math.imul(a ^ a >>> 13, 3266489909), 4294967296 * (2097151 & r) + (a >>> 0);
63
+ return a = Math.imul(a ^ a >>> 16, 2246822507) ^ Math.imul(n ^ n >>> 13, 3266489909), n = Math.imul(n ^ n >>> 16, 2246822507) ^ Math.imul(a ^ a >>> 13, 3266489909), 4294967296 * (2097151 & n) + (a >>> 0);
78
64
  }
79
65
  const h = P;
80
- function Re(e, t, a) {
66
+ function Me(e, t, a) {
81
67
  var y;
82
- const r = t !== "pending" && (t == null ? void 0 : t.status) === "ready" ? t : void 0, n = Te(e, t);
83
- if (n) {
84
- const v = t !== "pending" && (t == null ? void 0 : t.status) === "blocked" ? Ee(t) : void 0, k = v ? g(v, h.textChars) : void 0;
68
+ const n = t !== "pending" && (t == null ? void 0 : t.status) === "ready" ? t : void 0, r = Re(e, t);
69
+ if (r) {
70
+ const v = t !== "pending" && (t == null ? void 0 : t.status) === "blocked" ? Te(t) : void 0, q = v ? g(v, h.textChars) : void 0;
85
71
  return {
86
72
  // A card that runs but is not described still changes when it runs differently.
87
- fingerprint: $(r ? R(r, a.calendar) : { reason: n, message: k }),
88
- description: { status: "not_described", reason: n, ...k ? { message: k } : {} }
73
+ fingerprint: k(n ? R(n, a.calendar) : { reason: r, message: q }),
74
+ description: { status: "not_described", reason: r, ...q ? { message: q } : {} }
89
75
  };
90
76
  }
91
- const s = r, l = s.queryContext, m = Le(s), o = Be(s, a), c = ze(s), i = Oe(s), u = l.drillSteps.map((v) => g(
77
+ const s = n, l = s.queryContext, m = Le(s), o = Pe(s, a), c = Ne(s), i = je(s), u = l.drillSteps.map((v) => g(
92
78
  `${JSON.stringify(v.label)} (then by ${v.toField.label || v.toField.name})`,
93
79
  h.textChars
94
- )), d = (y = s.card.sql) == null ? void 0 : y.trim(), b = d ? He(s) : [], f = {
80
+ )), d = (y = s.card.sql) == null ? void 0 : y.trim(), b = d ? ze(s) : [], f = {
95
81
  fields: I(m.length, h.cardFields),
96
82
  filters: I(o.length, h.cardFilters),
97
83
  controls: I(c.length, h.cardControls),
@@ -100,7 +86,7 @@ function Re(e, t, a) {
100
86
  comparisons: I(i.length, h.cardFields)
101
87
  }, p = Object.fromEntries(Object.entries(f).filter(([, v]) => v > 0));
102
88
  return {
103
- fingerprint: $(R(s, a.calendar)),
89
+ fingerprint: k(R(s, a.calendar)),
104
90
  description: {
105
91
  status: "described",
106
92
  fields: m.slice(0, h.cardFields),
@@ -118,119 +104,119 @@ function Re(e, t, a) {
118
104
  }
119
105
  };
120
106
  }
121
- function Te(e, t) {
107
+ function Re(e, t) {
122
108
  if (e.type === "matrixTable") return "matrix";
123
- if (e.type === "custom" || Y(e)) return "custom_visual";
124
- if (ee(e.python ?? "").trim()) return "python";
109
+ if (e.type === "custom" || X(e)) return "custom_visual";
110
+ if (Y(e.python ?? "").trim()) return "python";
125
111
  if (t === "pending") return "snapshot_pending";
126
112
  if ((t == null ? void 0 : t.status) !== "ready") return "snapshot_blocked";
127
113
  }
128
- function Ee(e) {
114
+ function Te(e) {
129
115
  if (e.message) return e.message;
130
116
  const t = e.mappingDispositions.flatMap((a) => a.status === "block" ? [`${a.inputId} (${a.reason})`] : []);
131
117
  return t.length ? `dashboard inputs that cannot apply to this card: ${t.join(", ")}` : void 0;
132
118
  }
133
119
  function R(e, t) {
134
- return ue(e.card, e.queryContext, t).queryInputIdentity;
120
+ return ce(e.card, e.queryContext, t).queryInputIdentity;
135
121
  }
136
- const je = [
122
+ const Ee = [
137
123
  ["row", "rows"],
138
124
  ["column", "columns"],
139
125
  ["measure", "metrics"],
140
126
  ["detail", "details"]
141
127
  ];
142
128
  function Le(e) {
143
- const { fields: t } = te({
129
+ const { fields: t } = ee({
144
130
  type: e.card.type,
145
131
  config: e.queryContext.finalConfig
146
132
  });
147
- return je.flatMap(([a, r]) => t[r].map((n) => {
148
- const s = n.aggregate, l = n.grainMode ?? n.granularity;
133
+ return Ee.flatMap(([a, n]) => t[n].map((r) => {
134
+ const s = r.aggregate, l = r.grainMode ?? r.granularity;
149
135
  return {
150
136
  role: a,
151
- label: g(n.label || n.name, h.labelChars),
152
- name: g(n.name, h.labelChars),
137
+ label: g(r.label || r.name, h.labelChars),
138
+ name: g(r.name, h.labelChars),
153
139
  ...s ? { aggregate: s } : {},
154
140
  ...l ? { granularity: l } : {}
155
141
  };
156
142
  }));
157
143
  }
158
- function Oe(e) {
144
+ function je(e) {
159
145
  const t = e.queryContext;
160
146
  return (t.finalConfig.metricColumns ?? []).flatMap((a) => {
161
- const r = $e({
147
+ const n = $e({
162
148
  metricComparison: a.comparison,
163
149
  globalDateComparison: t.globalDateComparison
164
150
  });
165
- return r ? [g(Ae(Pe(a.label || a.name), r), h.textChars)] : [];
151
+ return n ? [g(qe(Oe(a.label || a.name), n), h.textChars)] : [];
166
152
  });
167
153
  }
168
- function Pe(e) {
154
+ function Oe(e) {
169
155
  return JSON.stringify(e);
170
156
  }
171
- function Be(e, { calendar: t }) {
172
- const a = e.queryContext, r = { maxListedValues: h.inputValues, timeZone: t.tz }, n = ae(e.card), s = new Set(n.map((i) => i.id)), l = new Map(
173
- [...a.queryFilterDefinitions, ...n].map((i) => [i.id, i.title])
157
+ function Pe(e, { calendar: t }) {
158
+ const a = e.queryContext, n = { maxListedValues: h.inputValues, timeZone: t.tz }, r = te(e.card), s = new Set(r.map((i) => i.id)), l = new Map(
159
+ [...a.queryFilterDefinitions, ...r].map((i) => [i.id, i.title])
174
160
  ), m = a.cardFilterValues.map((i) => {
175
- const u = l.get(i.filterId) || i.name, d = i.dateOwner === "global_date" ? `${u} (the dashboard date, on this card's field ${i.name})` : `${u} (field ${i.name})`, b = B(i, d, r);
161
+ const u = l.get(i.filterId) || i.name, d = i.dateOwner === "global_date" ? `${u} (the dashboard date, on this card's field ${i.name})` : `${u} (field ${i.name})`, b = B(i, d, n);
176
162
  return {
177
163
  // A click that reaches the card through relationships is the click it
178
164
  // is, not an input (click relationship reach CR-D15).
179
- origin: qe(i.filterId) ? "selection" : s.has(i.filterId) ? "card_input" : "dashboard_input",
165
+ origin: we(i.filterId) ? "selection" : s.has(i.filterId) ? "card_input" : "dashboard_input",
180
166
  text: g(b.text, h.textChars),
181
167
  ...b.omittedValues ? { omittedValues: b.omittedValues } : {}
182
168
  };
183
- }), o = a.resolvedFilterParts, c = [["card", o.authored], ["drill", o.drill], ["selection", o.selections]].flatMap(([i, u]) => we(u, r).map((d) => ({
169
+ }), o = a.resolvedFilterParts, c = [["card", o.authored], ["drill", o.drill], ["selection", o.selections]].flatMap(([i, u]) => _e(u, n).map((d) => ({
184
170
  origin: i,
185
171
  text: g(d.text, h.textChars),
186
172
  ...d.omittedValues ? { omittedValues: d.omittedValues } : {}
187
173
  })));
188
174
  return [...m, ...c];
189
175
  }
190
- function Ne(e) {
191
- const t = e.queryContext, a = L({
176
+ function Be(e) {
177
+ const t = e.queryContext, a = j({
192
178
  sql: e.card.sql,
193
179
  controlBindings: t.controlBindings
194
180
  });
195
181
  return [.../* @__PURE__ */ new Set([
196
- ...t.controlBindings.map((n) => n.controlId),
197
- ...a.map((n) => n.controlId)
198
- ])].map((n) => ({
199
- id: n,
200
- bindings: t.controlBindings.filter((s) => s.controlId === n),
201
- sqlParameterIds: a.filter((s) => s.controlId === n).map((s) => s.paramId)
182
+ ...t.controlBindings.map((r) => r.controlId),
183
+ ...a.map((r) => r.controlId)
184
+ ])].map((r) => ({
185
+ id: r,
186
+ bindings: t.controlBindings.filter((s) => s.controlId === r),
187
+ sqlParameterIds: a.filter((s) => s.controlId === r).map((s) => s.paramId)
202
188
  }));
203
189
  }
204
- function ze(e) {
190
+ function Ne(e) {
205
191
  const t = e.queryContext, a = new Map(
206
- [...t.controlDefinitions, ...t.cardControlDefinitions].map((r) => [r.id, r])
192
+ [...t.controlDefinitions, ...t.cardControlDefinitions].map((n) => [n.id, n])
207
193
  );
208
- return Ne(e).map(({ id: r, bindings: n, sqlParameterIds: s }) => {
194
+ return Be(e).map(({ id: n, bindings: r, sqlParameterIds: s }) => {
209
195
  var o;
210
- const l = t.controlValues[r], m = /* @__PURE__ */ new Set([
211
- ...n.filter((c) => c.target !== "sql_param").map((c) => Je(c, l)),
196
+ const l = t.controlValues[n], m = /* @__PURE__ */ new Set([
197
+ ...r.filter((c) => c.target !== "sql_param").map((c) => He(c, l)),
212
198
  ...s.map((c) => `SQL parameter ${c}`)
213
199
  ]);
214
200
  return {
215
- label: g(((o = a.get(r)) == null ? void 0 : o.label) || r, h.labelChars),
201
+ label: g(((o = a.get(n)) == null ? void 0 : o.label) || n, h.labelChars),
216
202
  valueText: g(
217
- `${w(l, { maxListedValues: h.inputValues }).text}${m.size ? `; ${[...m].join("; ")}` : ""}`,
203
+ `${D(l, { maxListedValues: h.inputValues }).text}${m.size ? `; ${[...m].join("; ")}` : ""}`,
218
204
  h.textChars
219
205
  )
220
206
  };
221
207
  });
222
208
  }
223
- function He(e) {
209
+ function ze(e) {
224
210
  const t = e.queryContext;
225
- return L({ sql: e.card.sql, controlBindings: t.controlBindings }).map((a) => ({
211
+ return j({ sql: e.card.sql, controlBindings: t.controlBindings }).map((a) => ({
226
212
  name: g(a.paramId, h.labelChars),
227
213
  valueText: g(
228
- w(t.controlValues[a.controlId], { maxListedValues: h.inputValues }).text,
214
+ D(t.controlValues[a.controlId], { maxListedValues: h.inputValues }).text,
229
215
  h.textChars
230
216
  )
231
217
  }));
232
218
  }
233
- function Je(e, t) {
219
+ function He(e, t) {
234
220
  const a = typeof t == "string" || typeof t == "number" || typeof t == "boolean" ? String(t) : void 0;
235
221
  switch (e.target) {
236
222
  case "sql_param":
@@ -243,48 +229,48 @@ function Je(e, t) {
243
229
  return `sets the time grain${a && e.mapping[a] ? ` to ${e.mapping[a]}` : ""}`;
244
230
  case "config_field_selector":
245
231
  case "config_metric_selector": {
246
- const r = a ? e.mapping[a] : void 0, n = e.target === "config_field_selector" ? "field" : "measure";
247
- if (!r) return `chooses the ${n}`;
248
- const s = "kind" in r ? `Matrix ${r.id}` : `${r.label || r.name}${"aggregate" in r && r.aggregate ? ` (${r.aggregate})` : ""}`;
249
- return `chooses the ${n} ${JSON.stringify(s)}`;
232
+ const n = a ? e.mapping[a] : void 0, r = e.target === "config_field_selector" ? "field" : "measure";
233
+ if (!n) return `chooses the ${r}`;
234
+ const s = "kind" in n ? `Matrix ${n.id}` : `${n.label || n.name}${"aggregate" in n && n.aggregate ? ` (${n.aggregate})` : ""}`;
235
+ return `chooses the ${r} ${JSON.stringify(s)}`;
250
236
  }
251
237
  }
252
238
  }
253
239
  class V extends Error {
254
- constructor(a, r) {
255
- super(r);
240
+ constructor(a, n) {
241
+ super(n);
256
242
  F(this, "code");
257
243
  this.name = "AssistantContextSourceError", this.code = a;
258
244
  }
259
245
  }
260
- const C = P, Ge = "Untitled";
246
+ const C = P, Je = "Untitled";
261
247
  function Ze(e) {
262
248
  var f;
263
249
  if (e.surface === "none")
264
250
  return T({
265
- version: M,
251
+ version: A,
266
252
  surface: "none",
267
253
  otherSheets: [],
268
254
  activeInputs: [],
269
255
  cards: [],
270
256
  timeZone: e.timeZone
271
257
  });
272
- const { dashboard: t, sheetId: a, calendar: r } = e, n = t.sheets ?? [], s = n.find((p) => p.id === a);
258
+ const { dashboard: t, sheetId: a, calendar: n } = e, r = t.sheets ?? [], s = r.find((p) => p.id === a);
273
259
  if (a !== null && !s)
274
260
  throw new V("sheet_not_found", `sheet ${a} is not on dashboard ${t.id}`);
275
- const l = n.filter((p) => p.id !== a), m = s ? S(t).filter((p) => p.sheetId === a) : [], o = m.slice(0, C.summaryCards), c = e.selectedCard ? m.find((p) => p.cardId === e.selectedCard.cardId) : void 0, i = ((f = e.selectedCard) == null ? void 0 : f.card) ?? (c == null ? void 0 : c.card);
261
+ const l = r.filter((p) => p.id !== a), m = s ? S(t).filter((p) => p.sheetId === a) : [], o = m.slice(0, C.summaryCards), c = e.selectedCard ? m.find((p) => p.cardId === e.selectedCard.cardId) : void 0, i = ((f = e.selectedCard) == null ? void 0 : f.card) ?? (c == null ? void 0 : c.card);
276
262
  if (e.selectedCard && !i)
277
263
  throw new V(
278
264
  "card_not_on_sheet",
279
265
  `card ${e.selectedCard.cardId} is not on sheet ${a}`
280
266
  );
281
- const u = s ? Ke(e, s, m) : [], d = {
267
+ const u = s ? Ue(e, s, m) : [], d = {
282
268
  otherSheets: I(l.length, C.otherSheets),
283
269
  activeInputs: I(u.length, C.activeInputs),
284
270
  cards: I(m.length, C.summaryCards)
285
271
  }, b = Object.fromEntries(Object.entries(d).filter(([, p]) => p > 0));
286
272
  return T({
287
- version: M,
273
+ version: A,
288
274
  surface: e.editing ? "editor" : "dashboard",
289
275
  dashboard: {
290
276
  id: t.id,
@@ -294,26 +280,26 @@ function Ze(e) {
294
280
  ...s ? { sheet: { id: s.id, title: x(s.title) } } : {},
295
281
  otherSheets: l.slice(0, C.otherSheets).map((p) => ({ id: p.id, title: x(p.title) })),
296
282
  activeInputs: u.slice(0, C.activeInputs),
297
- cards: o.map((p) => J(p.card)),
298
- ...i && e.selectedCard ? { selectedCard: Qe(i, e.selectedCard.snapshot, r) } : {},
283
+ cards: o.map((p) => H(p.card)),
284
+ ...i && e.selectedCard ? { selectedCard: Ge(i, e.selectedCard.snapshot, n) } : {},
299
285
  ...e.editing ? { editing: e.editing } : {},
300
286
  ...Object.keys(b).length ? { omitted: b } : {},
301
- timeZone: r.tz
287
+ timeZone: n.tz
302
288
  });
303
289
  }
304
- function Qe(e, t, a) {
305
- return { ...J(e), ...Re(e, t, { calendar: a }) };
290
+ function Ge(e, t, a) {
291
+ return { ...H(e), ...Me(e, t, { calendar: a }) };
306
292
  }
307
293
  function T(e) {
308
- const t = Ie(e);
309
- if (t > C.contextBytes) throw new ye(t);
294
+ const t = Ce(e);
295
+ if (t > C.contextBytes) throw new Ie(t);
310
296
  return e;
311
297
  }
312
298
  function x(e) {
313
- return g((e == null ? void 0 : e.trim()) || Ge, C.labelChars);
299
+ return g((e == null ? void 0 : e.trim()) || Je, C.labelChars);
314
300
  }
315
- function J(e) {
316
- const t = Ue(e);
301
+ function H(e) {
302
+ const t = Qe(e);
317
303
  return {
318
304
  id: e.id,
319
305
  title: x(e.title),
@@ -321,19 +307,19 @@ function J(e) {
321
307
  ...t ? { source: t } : {}
322
308
  };
323
309
  }
324
- function Ue(e) {
310
+ function Qe(e) {
325
311
  var a;
326
- const t = oe(e);
312
+ const t = se(e);
327
313
  if (t.kind === "config")
328
314
  return t.executableSources.length === 1 ? t.executableSources[0] : void 0;
329
315
  if (t.kind === "sql") {
330
- const r = ((a = e.dataSource) == null ? void 0 : a.connectionId) || e.connectionId;
331
- return r ? { kind: "sql", connectionId: r } : void 0;
316
+ const n = ((a = e.dataSource) == null ? void 0 : a.connectionId) || e.connectionId;
317
+ return n ? { kind: "sql", connectionId: n } : void 0;
332
318
  }
333
319
  }
334
- function Ke(e, t, a) {
335
- const { dashboard: r } = e, n = t.kind === "document" ? "document" : "dashboard", s = n === "document" ? void 0 : e.transientContexts, { shouldApplyDashboardFilters: l } = me(s), m = (u, d) => re({
336
- dashboard: r,
320
+ function Ue(e, t, a) {
321
+ const { dashboard: n } = e, r = t.kind === "document" ? "document" : "dashboard", s = r === "document" ? void 0 : e.transientContexts, { shouldApplyDashboardFilters: l } = ue(s), m = (u, d) => ae({
322
+ dashboard: n,
337
323
  sheetId: t.id,
338
324
  card: u,
339
325
  sectionId: d,
@@ -344,18 +330,18 @@ function Ke(e, t, a) {
344
330
  u.inputs.forEach((d, b) => {
345
331
  if (E(d)) return;
346
332
  const f = u.resolvedInputs[b], p = o.get(d.id) ?? { input: d };
347
- !p.resolved && f && We(f) && (p.resolved = f), o.set(d.id, p);
333
+ !p.resolved && f && Ke(f) && (p.resolved = f), o.set(d.id, p);
348
334
  });
349
335
  };
350
336
  c(m(null));
351
- let i = ne(r).filter((u) => {
337
+ let i = ne(n).filter((u) => {
352
338
  var d;
353
339
  return !E(u) && !((d = o.get(u.id)) != null && d.resolved);
354
340
  });
355
341
  for (const u of a) {
356
342
  if (i.length === 0) break;
357
- const d = u.kind === "documentSectionCard" ? u.sectionId : void 0, b = { sheetId: t.id, sheetKind: n, cardId: u.cardId, sectionId: d };
358
- if (i.some((f) => U(f, b))) {
343
+ const d = u.kind === "documentSectionCard" ? u.sectionId : void 0, b = { sheetId: t.id, sheetKind: r, cardId: u.cardId, sectionId: d };
344
+ if (i.some((f) => Q(f, b))) {
359
345
  try {
360
346
  c(m(u.card, d));
361
347
  } catch {
@@ -369,7 +355,7 @@ function Ke(e, t, a) {
369
355
  }
370
356
  return [...o.values()].flatMap((u) => {
371
357
  if (!u.resolved) return [];
372
- const d = u.input.kind === "filter" && !l && !K(u.input), b = Xe(u, e.calendar.tz, d);
358
+ const d = u.input.kind === "filter" && !l && !U(u.input), b = We(u, e.calendar.tz, d);
373
359
  return b ? [b] : [];
374
360
  });
375
361
  }
@@ -378,30 +364,30 @@ function E(e) {
378
364
  const t = (a = e.compatibility) == null ? void 0 : a.source;
379
365
  return t === "cardInlineFilter" || t === "cardControl";
380
366
  }
381
- function We(e) {
367
+ function Ke(e) {
382
368
  if (e.kind === "filter") return !!e.filterValue;
383
369
  const t = e.controlValue;
384
370
  return t == null ? !1 : typeof t == "string" ? t.trim().length > 0 : Array.isArray(t) ? t.length > 0 : !0;
385
371
  }
386
- function Xe(e, t, a) {
387
- const { input: r, resolved: n } = e, s = x(r.label), l = {
388
- inputId: r.id,
372
+ function We(e, t, a) {
373
+ const { input: n, resolved: r } = e, s = x(n.label), l = {
374
+ inputId: n.id,
389
375
  label: s,
390
- ...r.kind === "filter" && se(r.filter) ? { globalDate: !0 } : {}
376
+ ...n.kind === "filter" && re(n.filter) ? { globalDate: !0 } : {}
391
377
  };
392
- if (r.runtimeScope === "perCard" || r.runtimeScope === "perDocumentSection")
378
+ if (n.runtimeScope === "perCard" || n.runtimeScope === "perDocumentSection")
393
379
  return { ...l, value: { kind: "varies" } };
394
380
  const m = { maxListedValues: C.inputValues, timeZone: t };
395
381
  let o;
396
- if ((n == null ? void 0 : n.kind) === "filter" && n.filterValue)
397
- o = B(n.filterValue, s, m);
398
- else if ((n == null ? void 0 : n.kind) === "control") {
399
- const i = w(n.controlValue, m);
382
+ if ((r == null ? void 0 : r.kind) === "filter" && r.filterValue)
383
+ o = B(r.filterValue, s, m);
384
+ else if ((r == null ? void 0 : r.kind) === "control") {
385
+ const i = D(r.controlValue, m);
400
386
  o = { text: `${s} is set to ${i.text}`, omittedValues: i.omittedValues };
401
387
  }
402
388
  if (!o) return;
403
- const c = (n == null ? void 0 : n.kind) === "filter" ? n.comparisonSelection : void 0;
404
- return (c == null ? void 0 : c.mode) === "period" && (o = { ...o, text: `${o.text}; compared with ${H(c.spec)}` }), {
389
+ const c = (r == null ? void 0 : r.kind) === "filter" ? r.comparisonSelection : void 0;
390
+ return (c == null ? void 0 : c.mode) === "period" && (o = { ...o, text: `${o.text}; compared with ${ke(c.spec).sentence}` }), {
405
391
  ...l,
406
392
  value: {
407
393
  kind: "set",
@@ -410,21 +396,21 @@ function Xe(e, t, a) {
410
396
  ...a ? { notApplied: "opened_from_another_dashboard" } : {},
411
397
  // The resolved value itself, with any date comparison on it and whether
412
398
  // 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: a } : { control: n == null ? void 0 : n.controlValue }
399
+ fingerprint: k(
400
+ (r == null ? void 0 : r.kind) === "filter" ? { filter: r.filterValue, comparison: r.comparisonSelection ?? null, notApplied: a } : { control: r == null ? void 0 : r.controlValue }
415
401
  )
416
402
  }
417
403
  };
418
404
  }
419
405
  function ft(e) {
420
- return Ye(e).context;
406
+ return Xe(e).context;
421
407
  }
422
- function Ye(e) {
423
- const { place: t, calendar: a } = e, r = q(e.dashboard), n = be({ dashboard: r, host: {}, calendar: a, materializeInputs: !1 }), s = {
424
- ..._({ dashboard: r, capture: {}, calendar: a }).runtimeValues,
408
+ function Xe(e) {
409
+ const { place: t, calendar: a } = e, n = $(e.dashboard), r = pe({ dashboard: n, host: {}, calendar: a, materializeInputs: !1 }), s = {
410
+ ...w({ dashboard: n, capture: {}, calendar: a }).runtimeValues,
425
411
  cardViewState: t.cardViewState ?? {}
426
- }, l = t.cardId ? tt(r, t.cardId) : void 0, m = l ? G({
427
- dashboard: r,
412
+ }, l = t.cardId ? et(n, t.cardId) : void 0, m = l ? J({
413
+ dashboard: n,
428
414
  location: l,
429
415
  runtimeValues: s,
430
416
  semanticExecutionPayload: e.semanticExecutionPayload,
@@ -432,9 +418,9 @@ function Ye(e) {
432
418
  withRequest: !0
433
419
  }) : void 0, o = Ze({
434
420
  surface: "dashboard",
435
- dashboard: r,
421
+ dashboard: n,
436
422
  // A sheet that does not hold the card is refused by the projection.
437
- sheetId: t.sheetId ?? (l == null ? void 0 : l.sheetId) ?? n.selectedSheetId,
423
+ sheetId: t.sheetId ?? (l == null ? void 0 : l.sheetId) ?? r.selectedSheetId,
438
424
  unsavedEdits: !1,
439
425
  runtimeValues: s,
440
426
  transientContexts: void 0,
@@ -443,12 +429,12 @@ function Ye(e) {
443
429
  });
444
430
  return {
445
431
  context: o,
446
- openDashboard: r,
447
- ...o.selectedCard && m !== void 0 ? { cardReplay: et({ dashboard: r, cardId: o.selectedCard.id, snapshot: m }) } : {}
432
+ openDashboard: n,
433
+ ...o.selectedCard && m !== void 0 ? { cardReplay: Ye({ dashboard: n, cardId: o.selectedCard.id, snapshot: m }) } : {}
448
434
  };
449
435
  }
450
- function et(e) {
451
- const t = e.dashboard ? S(e.dashboard).find((r) => r.cardId === e.cardId) : void 0, a = D({
436
+ function Ye(e) {
437
+ const t = e.dashboard ? S(e.dashboard).find((n) => n.cardId === e.cardId) : void 0, a = _({
452
438
  card: e.card ?? (t == null ? void 0 : t.card),
453
439
  snapshot: e.snapshot,
454
440
  documentSection: (t == null ? void 0 : t.kind) === "documentSectionCard"
@@ -461,34 +447,34 @@ function et(e) {
461
447
  }
462
448
  };
463
449
  }
464
- function tt(e, t) {
465
- const a = S(e).find((r) => r.cardId === t);
450
+ function et(e, t) {
451
+ const a = S(e).find((n) => n.cardId === t);
466
452
  if (!a)
467
453
  throw new V("card_not_found", `card ${t} is not on dashboard ${e.id}`);
468
454
  return a;
469
455
  }
470
- function G(e) {
471
- const { dashboard: t, location: a, runtimeValues: r } = e, n = a.kind === "documentSectionCard" ? at(t, a) : void 0;
456
+ function J(e) {
457
+ const { dashboard: t, location: a, runtimeValues: n } = e, r = a.kind === "documentSectionCard" ? tt(t, a) : void 0;
472
458
  return O({
473
459
  dashboard: t,
474
460
  cardId: a.cardId,
475
461
  cardOverride: a.card,
476
462
  sheetId: a.sheetId,
477
463
  transientContexts: e.transientContexts,
478
- cardViewStates: r.cardViewState,
464
+ cardViewStates: n.cardViewState,
479
465
  viewerTableSettings: void 0,
480
- adHocFilterValues: r.adHocFilterValues,
481
- inlineFilterValuesMap: r.inlineFilterValuesMap,
482
- dashboardControlValues: r.controlValues,
483
- cardControlValuesMap: r.cardControlValuesMap,
484
- dashboardInputValues: r.dashboardInputValues,
466
+ adHocFilterValues: n.adHocFilterValues,
467
+ inlineFilterValuesMap: n.inlineFilterValuesMap,
468
+ dashboardControlValues: n.controlValues,
469
+ cardControlValuesMap: n.cardControlValuesMap,
470
+ dashboardInputValues: n.dashboardInputValues,
485
471
  semanticExecutionPayload: e.semanticExecutionPayload,
486
472
  calendar: e.calendar,
487
- ...n ? { documentSection: n } : {},
473
+ ...r ? { documentSection: r } : {},
488
474
  ...e.withRequest ? { withRequest: !0 } : {}
489
475
  });
490
476
  }
491
- function D(e) {
477
+ function _(e) {
492
478
  var a;
493
479
  const { snapshot: t } = e;
494
480
  if (e.documentSection) return { status: "unavailable", reason: "document_section" };
@@ -503,28 +489,28 @@ function D(e) {
503
489
  if (t.matrix) return { status: "unavailable", reason: "matrix" };
504
490
  if (!t.request) return { status: "unavailable", reason: "no_query" };
505
491
  try {
506
- const { connectionId: r, requestPayloadBase: n } = fe(t.card, t.request);
507
- return { status: "ready", request: { cardId: t.card.id, connectionId: r, payload: n } };
492
+ const { connectionId: n, requestPayloadBase: r } = me(t.card, t.request);
493
+ return { status: "ready", request: { cardId: t.card.id, connectionId: n, payload: r } };
508
494
  } catch {
509
495
  return { status: "unavailable", reason: "no_query" };
510
496
  }
511
497
  }
512
498
  function ht(e) {
513
- const { calendar: t } = e, a = e.host ?? {}, r = q(
514
- a.controlContract ? he(pe(e.dashboard), {
499
+ const { calendar: t } = e, a = e.host ?? {}, n = $(
500
+ a.controlContract ? fe(he(e.dashboard), {
515
501
  controlContractOverrides: a.controlContract,
516
502
  cardId: e.cardId
517
503
  }) : e.dashboard
518
- ), n = S(r).find((c) => c.cardId === e.cardId);
519
- if (!n) return { status: "refused", reason: "card_not_found" };
520
- if (n.kind === "documentSectionCard") return { status: "refused", reason: "document_section" };
521
- const { runtimeValues: s, transientContexts: l } = _({
522
- dashboard: r,
504
+ ), r = S(n).find((c) => c.cardId === e.cardId);
505
+ if (!r) return { status: "refused", reason: "card_not_found" };
506
+ if (r.kind === "documentSectionCard") return { status: "refused", reason: "document_section" };
507
+ const { runtimeValues: s, transientContexts: l } = w({
508
+ dashboard: n,
523
509
  capture: a,
524
510
  calendar: t
525
- }), m = G({
526
- dashboard: r,
527
- location: n,
511
+ }), m = J({
512
+ dashboard: n,
513
+ location: r,
528
514
  runtimeValues: s,
529
515
  semanticExecutionPayload: e.semanticExecutionPayload,
530
516
  calendar: t,
@@ -532,17 +518,17 @@ function ht(e) {
532
518
  withRequest: !0
533
519
  });
534
520
  if (!m) return { status: "refused", reason: "card_not_found" };
535
- const o = D({ card: n.card, snapshot: m, documentSection: !1 });
521
+ const o = _({ card: r.card, snapshot: m, documentSection: !1 });
536
522
  return o.status === "ready" ? { ...o, renderConfig: m.queryContext.finalConfig } : o.reason === "pending" ? { status: "refused", reason: "blocked" } : {
537
523
  status: "refused",
538
524
  reason: o.reason,
539
525
  ...o.message ? { message: o.message } : {}
540
526
  };
541
527
  }
542
- function at(e, t) {
543
- var r, n, s;
544
- const a = (r = e.sheets) == null ? void 0 : r.find((l) => l.id === t.sheetId);
545
- if ((s = (n = a == null ? void 0 : a.document) == null ? void 0 : n.inputs) != null && s.length && j(e, t.sheetId).length === 0)
528
+ function tt(e, t) {
529
+ var n, r, s;
530
+ const a = (n = e.sheets) == null ? void 0 : n.find((l) => l.id === t.sheetId);
531
+ if ((s = (r = a == null ? void 0 : a.document) == null ? void 0 : r.inputs) != null && s.length && L(e, t.sheetId).length === 0)
546
532
  throw new V(
547
533
  "document_inputs_not_built",
548
534
  `card ${t.cardId} runs with the document's own inputs on sheet ${t.sheetId}, which only the page builds`
@@ -556,9 +542,9 @@ function at(e, t) {
556
542
  };
557
543
  }
558
544
  function pt(e) {
559
- const { calendar: t } = e, a = q(e.dashboard), r = a.variables ?? [], n = r.find((f) => f.name === e.name) ?? r.find((f) => f.id === e.name);
560
- if (!n)
561
- return { status: "refused", reason: "variable_unknown", message: `No variable named ${e.name} on this dashboard.`, available: r.map((f) => f.name) };
545
+ const { calendar: t } = e, a = $(e.dashboard), n = a.variables ?? [], r = n.find((f) => f.name === e.name) ?? n.find((f) => f.id === e.name);
546
+ if (!r)
547
+ return { status: "refused", reason: "variable_unknown", message: `No variable named ${e.name} on this dashboard.`, available: n.map((f) => f.name) };
562
548
  const s = (a.sheets ?? []).find((f) => f.id === e.sheetId);
563
549
  if (!s)
564
550
  return {
@@ -567,13 +553,13 @@ function pt(e) {
567
553
  message: `No sheet ${e.sheetId} on this dashboard; a variable is derived at a tab or a Document.`,
568
554
  available: (a.sheets ?? []).map((f) => f.id)
569
555
  };
570
- const l = W(a, n.id);
571
- if ((l == null ? void 0 : l.kind) !== "variable") return { status: "refused", reason: "broken", message: `${n.name} has no card to run.` };
572
- const m = ie(s) && s.document ? s.document : void 0, o = rt(a, s.id, !!m, e.inputs ?? {}, t);
556
+ const l = K(a, r.id);
557
+ if ((l == null ? void 0 : l.kind) !== "variable") return { status: "refused", reason: "broken", message: `${r.name} has no card to run.` };
558
+ const m = oe(s) && s.document ? s.document : void 0, o = at(a, s.id, !!m, e.inputs ?? {}, t);
573
559
  if (!o.ok) return { status: "refused", reason: "broken", message: o.message };
574
- const { runtimeValues: c, transientContexts: i } = _({ dashboard: a, capture: o.capture, calendar: t }), u = m ? { sheetId: s.id, sectionId: void 0, documentFilterValues: [], documentControlDefinitions: [], documentControlValues: {} } : void 0, d = O({
560
+ const { runtimeValues: c, transientContexts: i } = w({ dashboard: a, capture: o.capture, calendar: t }), u = m ? { sheetId: s.id, sectionId: void 0, documentFilterValues: [], documentControlDefinitions: [], documentControlValues: {} } : void 0, d = O({
575
561
  dashboard: a,
576
- cardId: n.id,
562
+ cardId: r.id,
577
563
  cardOverride: l.card,
578
564
  sheetId: s.id,
579
565
  transientContexts: i,
@@ -590,43 +576,43 @@ function pt(e) {
590
576
  withRequest: !0
591
577
  });
592
578
  if ((d == null ? void 0 : d.status) === "blocked")
593
- return d.reason === "requiredInput" ? { status: "refused", reason: "held", message: `${n.name} waits for ${d.missingRequiredLabels.join(", ")}.`, missingRequired: d.missingRequiredLabels } : { status: "refused", reason: "broken", message: d.message ?? `${n.name} can't run until its filter mapping is resolved.` };
594
- const b = D({ card: l.card, snapshot: d, documentSection: !1 });
595
- return b.status !== "ready" ? { status: "refused", reason: "broken", message: b.message ?? `${n.name} has no query to run.` } : { status: "ready", variable: n, place: m ? "document" : "sheet", request: b.request };
579
+ return d.reason === "requiredInput" ? { status: "refused", reason: "held", message: `${r.name} waits for ${d.missingRequiredLabels.join(", ")}.`, missingRequired: d.missingRequiredLabels } : { status: "refused", reason: "broken", message: d.message ?? `${r.name} can't run until its filter mapping is resolved.` };
580
+ const b = _({ card: l.card, snapshot: d, documentSection: !1 });
581
+ return b.status !== "ready" ? { status: "refused", reason: "broken", message: b.message ?? `${r.name} has no query to run.` } : { status: "ready", variable: r, place: m ? "document" : "sheet", request: b.request };
596
582
  }
597
- function rt(e, t, a, r, n) {
598
- const s = Object.keys(r);
583
+ function at(e, t, a, n, r) {
584
+ const s = Object.keys(n);
599
585
  if (!s.length) return { ok: !0, capture: {} };
600
586
  if (!a) return { ok: !1, message: "Values are given for a Document's inputs; at a tab the variable runs with the saved defaults." };
601
- const l = j(e, t), m = new Map(l.map((i) => [i.variableName, i])), o = s.filter((i) => !m.has(i));
587
+ const l = L(e, t), m = new Map(l.map((i) => [i.variableName, i])), o = s.filter((i) => !m.has(i));
602
588
  if (o.length)
603
589
  return { ok: !1, message: `This Document has no input named ${o.join(", ")}; its inputs are ${[...m.keys()].join(", ") || "none"}.` };
604
- let c = ge(e, { adHocFilterValues: [], controlOverrides: void 0, dashboardInputValues: {} }, n);
605
- for (const [i, u] of Object.entries(r)) {
590
+ let c = be(e, { adHocFilterValues: [], controlOverrides: void 0, dashboardInputValues: {} }, r);
591
+ for (const [i, u] of Object.entries(n)) {
606
592
  const d = m.get(i);
607
593
  let b;
608
594
  if (d.kind === "control")
609
- b = ce(u);
595
+ b = le(u);
610
596
  else {
611
597
  const f = Array.isArray(u) ? u : [u];
612
598
  if (!f.every((y) => typeof y == "string" || typeof y == "number" || typeof y == "boolean"))
613
599
  return { ok: !1, message: `${i} takes a value or a list of values.` };
614
600
  const p = f.every((y) => typeof y == "number") ? f : f.map(String);
615
- b = de(Ce(d.filter, { filterId: d.filter.id, values: p }, n));
601
+ b = ie(ge(d.filter, { filterId: d.filter.id, values: p }, r));
616
602
  }
617
603
  if (!b) return { ok: !1, message: `${i} has no usable value.` };
618
- c = le(c, d, { sheetId: t }, b);
604
+ c = de(c, d, { sheetId: t }, b);
619
605
  }
620
606
  return { ok: !0, capture: { dashboardInputExecutionSnapshot: { mode: "document", sheetId: t, dashboardInputValues: c } } };
621
607
  }
622
608
  export {
623
609
  V as A,
624
- et as a,
610
+ Ye as a,
625
611
  ht as b,
626
612
  pt as c,
627
- D as d,
613
+ _ as d,
628
614
  ft as e,
629
- Ye as f,
630
- G as g,
615
+ Xe as f,
616
+ J as g,
631
617
  Ze as p
632
618
  };