react-semaphor 0.1.602 → 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 (107) 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-BWF3GYip.js → assistant-chat-B6hNQI1t.js} +146 -146
  9. package/dist/chunks/{bookmark-impact-BF3iRx5a.js → bookmark-impact-Ba2PLcGp.js} +3 -3
  10. package/dist/chunks/{bookmark-state-CBSTdW6q.js → bookmark-state-n7AaNzR_.js} +517 -516
  11. package/dist/chunks/{card-filter-builder-B8XHwMY6.js → card-filter-builder-Y22HizVx.js} +104 -104
  12. package/dist/chunks/{comparison-window-caption-W83qB4V5.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-DG5EIYYB.js → dashboard-BghI99oY.js} +1 -1
  15. package/dist/chunks/{dashboard-briefing-launcher-CBSrhyWZ.js → dashboard-briefing-launcher-DtBAnGiH.js} +103 -103
  16. package/dist/chunks/{dashboard-controls-D6ECO4N1.js → dashboard-controls-CtFXlyjV.js} +53 -53
  17. package/dist/chunks/{dashboard-json-DrJftBSL.js → dashboard-json-DfGBUtCd.js} +5 -5
  18. package/dist/chunks/dates-BnrXF4bb.js +185 -0
  19. package/dist/chunks/{edit-dashboard-visual-BDYAJIbb.js → edit-dashboard-visual-oxt3x1wb.js} +7976 -8184
  20. package/dist/chunks/{filter-line-BXT6y303.js → filter-line-Cy5YYqRL.js} +27 -27
  21. package/dist/chunks/{filter-reach-copy-BukhZmzm.js → filter-reach-copy-CE_ZX147.js} +1590 -1729
  22. package/dist/chunks/{filter-value-text-D3-bf3_b.js → filter-value-text-fWvSDwkl.js} +11 -11
  23. package/dist/chunks/{index-BW0yozjs.js → index-D5rxbtS4.js} +24 -24
  24. package/dist/chunks/{layout-grid-Ds0diMeY.js → layout-grid-9LndRoLa.js} +1 -1
  25. package/dist/chunks/{matrix-analytical-definition-CgQgVeeI.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--DkNCOzd.js → matrix-operation-contract-DPBj69D8.js} +3 -2
  28. package/dist/chunks/{metric-comparison-zMylnIkc.js → metric-comparison-B0FR-Q8I.js} +184 -125
  29. package/dist/chunks/{paintbrush-CX8pao1j.js → paintbrush-58FQYY-y.js} +1 -1
  30. package/dist/chunks/{palette-CuA0HlzF.js → palette-Be62Tkoa.js} +1 -1
  31. package/dist/chunks/{pivot-result-contract-expectations-C8KL7hPx.js → pivot-result-contract-expectations-BYqAmG9n.js} +1236 -1190
  32. package/dist/chunks/{pivot-result-identity-C1AOH1PS.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-CbuVNDGi.js → report-preferences-dialog-uJp9GBTM.js} +219 -205
  35. package/dist/chunks/{report-runtime-context-E7USjN7E.js → report-runtime-context-c77_KF9v.js} +2 -2
  36. package/dist/chunks/{resolve-dashboard-input-context-CULCE_hM.js → resolve-dashboard-input-context-Rtl1ffmE.js} +7115 -6963
  37. package/dist/chunks/{save-BKHlDONy.js → save-C5A0JnEV.js} +1 -1
  38. package/dist/chunks/{saved-dashboard-context-C1WlOx5z.js → saved-dashboard-context-tcyTU8jm.js} +193 -207
  39. package/dist/chunks/selection-filter-compiler-DNijjI5y.js +150 -0
  40. package/dist/chunks/{semaphor-ready-indicator-CBIRcDWs.js → semaphor-ready-indicator-FBvunj6S.js} +35550 -35273
  41. package/dist/chunks/{shelf-drop-preview-context-xR69SMA8.js → shelf-drop-preview-context-QKStrcK9.js} +6 -6
  42. package/dist/chunks/{stored-dashboard-BuM8vnWf.js → stored-dashboard-CHozcAY9.js} +621 -616
  43. package/dist/chunks/{style-sheet-parts-Bt9ZNre8.js → style-sheet-parts-CDCG-8Ej.js} +258 -251
  44. package/dist/chunks/{table-export-sheet-DVljtHkG.js → table-export-sheet-ZFIvs6Sj.js} +1 -1
  45. package/dist/chunks/{token-types-D_xKgyVS.js → token-types-XbM6QByy.js} +1 -1
  46. package/dist/chunks/{upload-Dll_M7XQ.js → upload-H15d7uHK.js} +1 -1
  47. package/dist/chunks/{validators-ClWHpYql.js → validators-Baf3VIf5.js} +3 -3
  48. package/dist/chunks/{variable-draft-CDGGl53R.js → variable-draft-C2y8Jp6Z.js} +3 -3
  49. package/dist/dashboard/index.js +2 -2
  50. package/dist/dashboard-authoring/index.js +2466 -2343
  51. package/dist/format-utils/index.js +205 -204
  52. package/dist/index.js +20 -20
  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/ui-custom/date-range-presets.d.ts +8 -0
  57. package/dist/types/index.js +5 -5
  58. package/dist/types/lib/document/document-edits.d.ts +0 -4
  59. package/dist/types/lib/stores/dashboard-store.d.ts +0 -1
  60. package/dist/types/lib/types/common-types.d.ts +0 -2
  61. package/dist/types/lib/types/explorer-types.d.ts +1 -1
  62. package/dist/types/shared/analytics-protocol/analytics-base-schemas.d.ts +18 -0
  63. package/dist/types/shared/analytics-protocol/analyze-result-types.d.ts +3 -0
  64. package/dist/types/shared/analytics-protocol/comparison-choices.d.ts +92 -0
  65. package/dist/types/shared/analytics-protocol/comparison-placement.d.ts +30 -0
  66. package/dist/types/shared/analytics-protocol/contracts.d.ts +11 -5
  67. package/dist/types/shared/analytics-protocol/date-window.d.ts +105 -0
  68. package/dist/types/shared/analytics-protocol/filter-field-ownership.d.ts +27 -0
  69. package/dist/types/shared/analytics-protocol/fixtures.d.ts +4 -2
  70. package/dist/types/shared/analytics-protocol/index.d.ts +3 -0
  71. package/dist/types/shared/analytics-protocol/metric-comparison.d.ts +93 -11
  72. package/dist/types/shared/assistant-protocol/context.d.ts +16 -16
  73. package/dist/types/shared/dashboard-authoring/calculations/calculated-column.d.ts +1 -1
  74. package/dist/types/shared/dashboard-authoring/card-settings/card-display-write.d.ts +8 -0
  75. package/dist/types/shared/dashboard-authoring/card-settings/card-kinds.d.ts +1 -1
  76. package/dist/types/shared/dashboard-authoring/card-settings/inputs.d.ts +2 -1
  77. package/dist/types/shared/dashboard-authoring/card-settings/resolved.d.ts +0 -3
  78. package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +21 -358
  79. package/dist/types/shared/dashboard-authoring/changes/diagnostics.d.ts +2 -0
  80. package/dist/types/shared/dashboard-authoring/conditional-formatting/schema.d.ts +10 -10
  81. package/dist/types/shared/dashboard-authoring/dashboard-variable-card.d.ts +2 -4
  82. package/dist/types/shared/dashboard-authoring/kpi-date-context.d.ts +2 -0
  83. package/dist/types/shared/dashboard-authoring/kpi-figure.d.ts +18 -0
  84. package/dist/types/shared/dashboard-authoring/measure-calculations/comparison.d.ts +8 -7
  85. package/dist/types/shared/dashboard-authoring/measure-calculations/dates.d.ts +11 -1
  86. package/dist/types/shared/dashboard-authoring/measure-calculations/index.d.ts +2 -2
  87. package/dist/types/shared/dashboard-authoring/measure-calculations/options.d.ts +4 -0
  88. package/dist/types/shared/dashboard-authoring/measure-calculations/read.d.ts +18 -1
  89. package/dist/types/shared/dashboard-authoring/measure-calculations/resolve.d.ts +2 -0
  90. package/dist/types/shared/dashboard-authoring/measure-calculations/schemas.d.ts +46 -88
  91. package/dist/types/shared/dashboard-authoring/operations/calculated-field-operations.d.ts +33 -8
  92. package/dist/types/shared/dashboard-authoring/operations/operation-types.d.ts +0 -2
  93. package/dist/types/shared/dashboard-authoring/outline/outline-filters.d.ts +3 -0
  94. package/dist/types/shared/format-utils/comparison-detail.d.ts +34 -0
  95. package/dist/types/shared/format-utils/index.d.ts +1 -0
  96. package/dist/types/shared/format-utils/partial-period.d.ts +4 -2
  97. package/dist/types/shared/temporal/calendar-periods.d.ts +11 -0
  98. package/dist/types/shared/temporal/index.d.ts +2 -0
  99. package/dist/types/shared/temporal/temporal-text.d.ts +33 -0
  100. package/dist/types/shared/temporal/temporal.d.ts +27 -0
  101. package/dist/types/shared/temporal/zoned-wall-clock.d.ts +4 -3
  102. package/dist/usage-events/index.js +1 -1
  103. package/package.json +3 -2
  104. package/dist/chunks/dates-Bz-qM5px.js +0 -164
  105. package/dist/chunks/matrix-member-presentation-DSBIIudt.js +0 -258
  106. package/dist/chunks/raw-temporal-value-E416F-0L.js +0 -454
  107. package/dist/chunks/selection-filter-compiler-ifT8JCXS.js +0 -131
@@ -5,26 +5,26 @@ var Qt = (e, t, a) => t.has(e) || Yt("Cannot " + a);
5
5
  var B = (e, t, a) => (Qt(e, t, "read from private field"), a ? a.call(e) : t.get(e)), oe = (e, t, a) => t.has(e) ? Yt("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, a), W = (e, t, a, s) => (Qt(e, t, "write to private field"), s ? s.call(e, a) : t.set(e, a), a);
6
6
  import { jsx as d, jsxs as b, Fragment as xe } from "react/jsx-runtime";
7
7
  import { useCallback as G, useRef as te, useMemo as We, useEffect as ve, useState as $, useLayoutEffect as _e, useId as Xs } from "react";
8
- import { u as H, dn as er, ba as tr, bu as ar, ac as sr, dp as rr, dq as nr, ad as Xt, b7 as or, dr as ir, bO as lr, ds as dr, dt as Rt, du as cr, dv as ur, dw as dt, dx as _a, dy as pr, bS as qe, d4 as ea, dz as Oa, af as mr, c_ as Ra, bx as fr, cT as Pt, dA as hr, bZ as Pa, dB as Da, dC as Dt, bP as gr, dD as $a, dE as yr, bR as br, bU as vr, dF as xr, dG as wr, d1 as Nr, d2 as Ir, dH as Sr, d3 as Ar, d9 as Cr, dI as Er, cR as pt, d8 as Tr, dd as kr, bL as ja, b5 as Fa, b8 as Mr, bo as tt, b3 as La, dJ as _r, dK as Or, dL as Rr, dM as Pr, am as Ba, dN as Dr } from "./semaphor-ready-indicator-CBIRcDWs.js";
9
- import { c as Re, B as q, X as He, p as Ua, q as $r, j as Pe, L as we, I as $t, R as jr, e as za, f as qa, h as Va } from "./style-sheet-parts-Bt9ZNre8.js";
8
+ import { u as H, dp as er, ba as tr, bu as ar, ac as sr, dq as rr, dr as nr, ad as Xt, b7 as or, ds as ir, bP as lr, dt as dr, du as Rt, dv as cr, dw as ur, dx as dt, dy as _a, dz as pr, bT as qe, d5 as ea, dA as Oa, af as mr, c$ as Ra, bx as fr, cU as Pt, dB as hr, b_ as Pa, dC as Da, dD as Dt, bQ as gr, dE as $a, dF as yr, bS as br, bV as vr, dG as xr, dH as wr, d2 as Nr, d3 as Ir, dI as Sr, d4 as Ar, da as Cr, dJ as Er, cS as pt, d9 as Tr, de as Mr, bM as ja, b5 as Fa, b8 as kr, bo as tt, b3 as La, dK as _r, dL as Or, dM as Rr, dN as Pr, am as Ba, dO as Dr } from "./semaphor-ready-indicator-FBvunj6S.js";
9
+ import { c as Re, B as q, X as He, p as Ua, q as $r, j as Pe, L as we, I as $t, R as jr, e as za, f as qa, h as Va } from "./style-sheet-parts-CDCG-8Ej.js";
10
10
  import { g as Fr, c as F } from "./pickers-DkqmtnTL.js";
11
- import "./validators-ClWHpYql.js";
12
- import "./matrix-operation-contract--DkNCOzd.js";
13
- import "./analytics-base-schemas-DevrgqQb.js";
11
+ import "./validators-Baf3VIf5.js";
12
+ import "./matrix-operation-contract-DPBj69D8.js";
13
+ import "./analytics-base-schemas-DsUh5Q3C.js";
14
14
  import { DEFAULT_RESOLVED_VALUE_FORMAT_PREFERENCES as Lr } from "../value-format-preferences/index.js";
15
- import { K as Br } from "./bookmark-state-CBSTdW6q.js";
16
- import { n as Ur, o as Ge, c as It, A as ze, d as Za } from "./context-BJoEFgNl.js";
17
- import { p as ta, a as zr, A as Ja } from "./saved-dashboard-context-C1WlOx5z.js";
18
- import { i0 as qr, z as Vr, i1 as aa } from "./resolve-dashboard-input-context-CULCE_hM.js";
19
- import { u as Ka, d as Zr } from "./report-preferences-dialog-CbuVNDGi.js";
20
- import { i as Jr } from "./stored-dashboard-BuM8vnWf.js";
21
- import { w as Kr } from "./selection-filter-compiler-ifT8JCXS.js";
15
+ import { L as Br } from "./bookmark-state-n7AaNzR_.js";
16
+ import { n as Ur, o as Ge, c as It, A as ze, d as Za } from "./context-UCQ7sere.js";
17
+ import { p as ta, a as zr, A as Ja } from "./saved-dashboard-context-tcyTU8jm.js";
18
+ import { ia as qr, q as Vr, ib as aa } from "./resolve-dashboard-input-context-Rtl1ffmE.js";
19
+ import { u as Ka, d as Zr } from "./report-preferences-dialog-uJp9GBTM.js";
20
+ import { i as Jr } from "./stored-dashboard-CHozcAY9.js";
21
+ import { b as Kr } from "./selection-filter-compiler-DNijjI5y.js";
22
22
  import { c as Wa } from "./visual-choice-DDfHfHvY.js";
23
- import { n as Wr, v as Ha, o as Hr, t as Gr, x as jt, l as ce, d as Yr, b as Qr, m as Ft, M as mt, r as Xr, w as en, h as tn, j as an, s as St, f as sn, a as rn } from "./add-to-dashboard-ClhEIFst.js";
23
+ import { n as Wr, v as Ha, o as Hr, t as Gr, x as jt, l as ce, d as Yr, b as Qr, m as Ft, M as mt, r as Xr, w as en, h as tn, j as an, s as St, f as sn, a as rn } from "./add-to-dashboard-CFF-wFU-.js";
24
24
  import { safeParseAsync as nn, lazy as on, unknown as ln, union as dn, string as cn, record as un, object as pn, number as mn, null as fn, never as hn, looseObject as gn, literal as yn, instanceof as bn, enum as vn, discriminatedUnion as xn, custom as wn, boolean as Nn, array as In } from "zod/v4";
25
25
  import { toJSONSchema as Sn } from "zod/v4/core";
26
- import { aV as An, aW as Cn, aX as En, aY as at, aZ as Tn, a_ as sa, a$ as ra, b0 as na, b1 as oa, b2 as ia, b3 as kn, ao as Mn, am as _n } from "./pivot-result-contract-expectations-C8KL7hPx.js";
27
- import { L as la } from "./layout-grid-Ds0diMeY.js";
26
+ import { aY as An, aZ as Cn, a_ as En, a$ as at, b0 as Tn, b1 as sa, b2 as ra, b3 as na, b4 as oa, b5 as ia, b6 as Mn, ap as kn, an as _n } from "./pivot-result-contract-expectations-BYqAmG9n.js";
27
+ import { L as la } from "./layout-grid-9LndRoLa.js";
28
28
  function On(e, t, a) {
29
29
  const s = An(), r = (a == null ? void 0 : a.locale) ?? s.locale ?? Cn, l = En(e, t);
30
30
  if (isNaN(l))
@@ -58,7 +58,7 @@ function On(e, t, a) {
58
58
  }
59
59
  }
60
60
  function Rn(e, t) {
61
- return On(e, kn(e), t);
61
+ return On(e, Mn(e), t);
62
62
  }
63
63
  /**
64
64
  * @license lucide-react v0.453.0 - ISC
@@ -201,22 +201,22 @@ function Bn(e) {
201
201
  }), r = H((n) => n.isVisualEditing), l = tr(), i = ar();
202
202
  return { add: G(
203
203
  async (n, h) => {
204
- var I, M;
204
+ var I, k;
205
205
  const c = H.getState(), m = (I = c.dashboard) == null ? void 0 : I.id, x = c.selectedSheetId;
206
206
  if (!m || !x) throw new Ke(ft);
207
- const C = { title: n.title, type: Wr[h], ...n.card }, w = !zn({ ...C, id: "check" }, n, h), A = { ...C, ...w ? { type: "table" } : {}, id: aa() }, T = { id: aa(), cards: [A], activeCardId: A.id }, k = await i(T, { reuseLoaded: !0 }).catch((L) => {
207
+ const C = { title: n.title, type: Wr[h], ...n.card }, w = !zn({ ...C, id: "check" }, n, h), A = { ...C, ...w ? { type: "table" } : {}, id: aa() }, T = { id: aa(), cards: [A], activeCardId: A.id }, M = await i(T, { reuseLoaded: !0 }).catch((L) => {
208
208
  console.warn("Adding the result without refreshed semantic metadata:", L);
209
209
  }), N = structuredClone(H.getState().semanticExecutionPayload);
210
- sr(N, k);
210
+ sr(N, M);
211
211
  const u = Kr(
212
212
  A.config ?? {},
213
213
  qn(A, x, N, l)
214
214
  ), y = u === (A.config ?? {}) ? T : { ...T, cards: [{ ...A, config: u }] }, f = H.getState();
215
- if (((M = f.dashboard) == null ? void 0 : M.id) !== m || f.selectedSheetId !== x || f.isVisualEditing)
215
+ if (((k = f.dashboard) == null ? void 0 : k.id) !== m || f.selectedSheetId !== x || f.isVisualEditing)
216
216
  throw new Ke(ft);
217
217
  if (!a()) throw new Ke(Un);
218
218
  const { actions: v } = f;
219
- if (v.setIsDashboardEditing(!0), v.addFrame(x, y, { semanticExecutionPayload: k }), !Xa(H.getState().dashboard, y.id))
219
+ if (v.setIsDashboardEditing(!0), v.addFrame(x, y, { semanticExecutionPayload: M }), !Xa(H.getState().dashboard, y.id))
220
220
  throw f.isDashboardEditing || v.setIsDashboardEditing(!1), new Ke(ft);
221
221
  return { frameId: y.id, asTable: w };
222
222
  },
@@ -446,7 +446,7 @@ function to(e) {
446
446
  }
447
447
  const I = y.charCodeAt(f);
448
448
  if (ma(y, f, I)) {
449
- const M = y.charCodeAt(f + 5) === Ae ? f + 6 : f + 5, L = y.slice(M, v);
449
+ const k = y.charCodeAt(f + 5) === Ae ? f + 6 : f + 5, L = y.slice(k, v);
450
450
  if (c === 0 && y.charCodeAt(v + 1) === pa) {
451
451
  t({ id: n, event: m, data: L }), n = void 0, h = "", m = void 0, f = v + 2, v = y.indexOf(`
452
452
  `, f);
@@ -466,10 +466,10 @@ ${L}`, c++;
466
466
  for (; f < y.length; ) {
467
467
  const v = y.indexOf("\r", f), I = y.indexOf(`
468
468
  `, f);
469
- let M = -1;
470
- if (v !== -1 && I !== -1 ? M = v < I ? v : I : v !== -1 ? v === y.length - 1 ? M = -1 : M = v : I !== -1 && (M = I), M === -1)
469
+ let k = -1;
470
+ if (v !== -1 && I !== -1 ? k = v < I ? v : I : v !== -1 ? v === y.length - 1 ? k = -1 : k = v : I !== -1 && (k = I), k === -1)
471
471
  break;
472
- T(y, f, M), f = M + 1, y.charCodeAt(f - 1) === eo && y.charCodeAt(f) === pa && f++;
472
+ T(y, f, k), f = k + 1, y.charCodeAt(f - 1) === eo && y.charCodeAt(f) === pa && f++;
473
473
  }
474
474
  return y.slice(f);
475
475
  }
@@ -501,15 +501,15 @@ ${ue}`, c++;
501
501
  }
502
502
  return;
503
503
  }
504
- const M = y.slice(f, v), L = M.indexOf(":");
504
+ const k = y.slice(f, v), L = k.indexOf(":");
505
505
  if (L === -1) {
506
- k(M, "", M);
506
+ M(k, "", k);
507
507
  return;
508
508
  }
509
- const V = M.slice(0, L), De = M.charCodeAt(L + 1) === Ae ? 2 : 1, $e = M.slice(L + De);
510
- k(V, $e, M);
509
+ const V = k.slice(0, L), De = k.charCodeAt(L + 1) === Ae ? 2 : 1, $e = k.slice(L + De);
510
+ M(V, $e, k);
511
511
  }
512
- function k(y, f, v) {
512
+ function M(y, f, v) {
513
513
  switch (y) {
514
514
  case "event":
515
515
  m = f || void 0;
@@ -1102,7 +1102,7 @@ const Ct = {
1102
1102
  ZodBoolean: "boolean",
1103
1103
  ZodNull: "null"
1104
1104
  };
1105
- function ko(e, t) {
1105
+ function Mo(e, t) {
1106
1106
  const a = e.options instanceof Map ? Array.from(e.options.values()) : e.options;
1107
1107
  if (a.every((s) => s._def.typeName in Ct && (!s._def.checks || !s._def.checks.length))) {
1108
1108
  const s = a.reduce((r, l) => {
@@ -1137,9 +1137,9 @@ function ko(e, t) {
1137
1137
  type: "string",
1138
1138
  enum: a.reduce((s, r) => [...s, ...r._def.values.filter((l) => !s.includes(l))], [])
1139
1139
  };
1140
- return Mo(e, t);
1140
+ return ko(e, t);
1141
1141
  }
1142
- const Mo = (e, t) => {
1142
+ const ko = (e, t) => {
1143
1143
  const a = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map((s, r) => j(s._def, {
1144
1144
  ...t,
1145
1145
  currentPath: [
@@ -1338,7 +1338,7 @@ const qo = (e, t) => j(e.innerType._def, t), Vo = (e, t, a) => {
1338
1338
  return po(e, a);
1339
1339
  case "ZodUnion":
1340
1340
  case "ZodDiscriminatedUnion":
1341
- return ko(e, a);
1341
+ return Mo(e, a);
1342
1342
  case "ZodIntersection":
1343
1343
  return wo(e, a);
1344
1344
  case "ZodTuple":
@@ -1877,7 +1877,7 @@ const o = {
1877
1877
  })
1878
1878
  ]))
1879
1879
  })
1880
- ]), ks = o.object({
1880
+ ]), Ms = o.object({
1881
1881
  type: o.literal("tool-result"),
1882
1882
  toolCallId: o.string(),
1883
1883
  toolName: o.string(),
@@ -1917,13 +1917,13 @@ const o = {
1917
1917
  di,
1918
1918
  ui,
1919
1919
  pi,
1920
- ks,
1920
+ Ms,
1921
1921
  fi
1922
1922
  ]))]),
1923
1923
  providerOptions: O.optional()
1924
1924
  }), vi = o.object({
1925
1925
  role: o.literal("tool"),
1926
- content: o.array(o.union([ks, hi])),
1926
+ content: o.array(o.union([Ms, hi])),
1927
1927
  providerOptions: O.optional()
1928
1928
  });
1929
1929
  o.union([
@@ -2374,10 +2374,10 @@ function Si(e) {
2374
2374
  function de(e) {
2375
2375
  return it(e) || Si(e);
2376
2376
  }
2377
- function kt(e) {
2377
+ function Mt(e) {
2378
2378
  return e.type.split("-").slice(1).join("-");
2379
2379
  }
2380
- function Ms({ lastMessage: e, messageId: t }) {
2380
+ function ks({ lastMessage: e, messageId: t }) {
2381
2381
  const a = (e == null ? void 0 : e.role) === "assistant" ? e : {
2382
2382
  id: t,
2383
2383
  metadata: void 0,
@@ -2391,7 +2391,7 @@ function Ms({ lastMessage: e, messageId: t }) {
2391
2391
  it(i) && l++, i.state === "input-streaming" && (s[i.toolCallId] = {
2392
2392
  text: i.rawInput ?? "",
2393
2393
  index: p,
2394
- toolName: i.type === "dynamic-tool" ? i.toolName : kt(i),
2394
+ toolName: i.type === "dynamic-tool" ? i.toolName : Mt(i),
2395
2395
  dynamic: i.type === "dynamic-tool",
2396
2396
  title: i.title,
2397
2397
  toolMetadata: i.toolMetadata
@@ -2448,15 +2448,15 @@ function Ai({ stream: e, messageMetadataSchema: t, dataPartSchemas: a, runUpdate
2448
2448
  return y;
2449
2449
  }
2450
2450
  function T(u, y) {
2451
- const f = y ?? x().find((M) => it(M) && M.toolCallId === u.toolCallId), v = u, I = f;
2451
+ const f = y ?? x().find((k) => it(k) && k.toolCallId === u.toolCallId), v = u, I = f;
2452
2452
  if (f != null) {
2453
2453
  f.state = u.state, I.input = v.input, I.output = v.output, I.errorText = v.errorText, I.rawInput = v.rawInput, I.preliminary = v.preliminary, u.title !== void 0 && (I.title = u.title), u.toolMetadata !== void 0 && (I.toolMetadata = u.toolMetadata), I.providerExecuted = v.providerExecuted ?? f.providerExecuted;
2454
- const M = v.providerMetadata;
2455
- if (M != null)
2454
+ const k = v.providerMetadata;
2455
+ if (k != null)
2456
2456
  if (u.state === "output-available" || u.state === "output-error") {
2457
2457
  const L = f;
2458
- L.resultProviderMetadata = M;
2459
- } else f.callProviderMetadata = M;
2458
+ L.resultProviderMetadata = k;
2459
+ } else f.callProviderMetadata = k;
2460
2460
  } else c.message.parts.push({
2461
2461
  type: `tool-${u.toolName}`,
2462
2462
  toolCallId: u.toolCallId,
@@ -2473,16 +2473,16 @@ function Ai({ stream: e, messageMetadataSchema: t, dataPartSchemas: a, runUpdate
2473
2473
  ...v.providerMetadata != null && !(u.state === "output-available" || u.state === "output-error") ? { callProviderMetadata: v.providerMetadata } : {}
2474
2474
  });
2475
2475
  }
2476
- function k(u, y) {
2477
- const f = y ?? x().find((M) => M.type === "dynamic-tool" && M.toolCallId === u.toolCallId), v = u, I = f;
2476
+ function M(u, y) {
2477
+ const f = y ?? x().find((k) => k.type === "dynamic-tool" && k.toolCallId === u.toolCallId), v = u, I = f;
2478
2478
  if (f != null) {
2479
2479
  f.state = u.state, I.toolName = u.toolName, I.input = v.input, I.output = v.output, I.errorText = v.errorText, I.rawInput = v.rawInput, I.preliminary = v.preliminary, u.title !== void 0 && (I.title = u.title), u.toolMetadata !== void 0 && (I.toolMetadata = u.toolMetadata), I.providerExecuted = v.providerExecuted ?? f.providerExecuted;
2480
- const M = v.providerMetadata;
2481
- if (M != null)
2480
+ const k = v.providerMetadata;
2481
+ if (k != null)
2482
2482
  if (u.state === "output-available" || u.state === "output-error") {
2483
2483
  const L = f;
2484
- L.resultProviderMetadata = M;
2485
- } else f.callProviderMetadata = M;
2484
+ L.resultProviderMetadata = k;
2485
+ } else f.callProviderMetadata = k;
2486
2486
  } else c.message.parts.push({
2487
2487
  type: "dynamic-tool",
2488
2488
  toolName: u.toolName,
@@ -2620,7 +2620,7 @@ function Ai({ stream: e, messageMetadataSchema: t, dataPartSchemas: a, runUpdate
2620
2620
  dynamic: n.dynamic,
2621
2621
  title: n.title,
2622
2622
  toolMetadata: n.toolMetadata
2623
- }, n.dynamic ? k({
2623
+ }, n.dynamic ? M({
2624
2624
  toolCallId: n.toolCallId,
2625
2625
  toolName: n.toolName,
2626
2626
  state: "input-streaming",
@@ -2650,7 +2650,7 @@ function Ai({ stream: e, messageMetadataSchema: t, dataPartSchemas: a, runUpdate
2650
2650
  });
2651
2651
  u.text += n.inputTextDelta;
2652
2652
  const { value: y } = await wi(u.text);
2653
- u.dynamic ? k({
2653
+ u.dynamic ? M({
2654
2654
  toolCallId: n.toolCallId,
2655
2655
  toolName: u.toolName,
2656
2656
  state: "input-streaming",
@@ -2670,7 +2670,7 @@ function Ai({ stream: e, messageMetadataSchema: t, dataPartSchemas: a, runUpdate
2670
2670
  break;
2671
2671
  }
2672
2672
  case "tool-input-available":
2673
- n.dynamic ? k({
2673
+ n.dynamic ? M({
2674
2674
  toolCallId: n.toolCallId,
2675
2675
  toolName: n.toolName,
2676
2676
  state: "input-available",
@@ -2692,7 +2692,7 @@ function Ai({ stream: e, messageMetadataSchema: t, dataPartSchemas: a, runUpdate
2692
2692
  break;
2693
2693
  case "tool-input-error": {
2694
2694
  const u = x().filter(de).find((y) => y.toolCallId === n.toolCallId);
2695
- (u != null ? u.type === "dynamic-tool" : n.dynamic) ? k({
2695
+ (u != null ? u.type === "dynamic-tool" : n.dynamic) ? M({
2696
2696
  toolCallId: n.toolCallId,
2697
2697
  toolName: n.toolName,
2698
2698
  state: "output-error",
@@ -2742,7 +2742,7 @@ function Ai({ stream: e, messageMetadataSchema: t, dataPartSchemas: a, runUpdate
2742
2742
  }
2743
2743
  case "tool-output-available": {
2744
2744
  const u = w(n.toolCallId);
2745
- u.type === "dynamic-tool" ? k({
2745
+ u.type === "dynamic-tool" ? M({
2746
2746
  toolCallId: n.toolCallId,
2747
2747
  toolName: u.toolName,
2748
2748
  state: "output-available",
@@ -2755,7 +2755,7 @@ function Ai({ stream: e, messageMetadataSchema: t, dataPartSchemas: a, runUpdate
2755
2755
  toolMetadata: n.toolMetadata ?? u.toolMetadata
2756
2756
  }, u) : T({
2757
2757
  toolCallId: n.toolCallId,
2758
- toolName: kt(u),
2758
+ toolName: Mt(u),
2759
2759
  state: "output-available",
2760
2760
  input: u.input,
2761
2761
  output: n.output,
@@ -2769,7 +2769,7 @@ function Ai({ stream: e, messageMetadataSchema: t, dataPartSchemas: a, runUpdate
2769
2769
  }
2770
2770
  case "tool-output-error": {
2771
2771
  const u = w(n.toolCallId);
2772
- u.type === "dynamic-tool" ? k({
2772
+ u.type === "dynamic-tool" ? M({
2773
2773
  toolCallId: n.toolCallId,
2774
2774
  toolName: u.toolName,
2775
2775
  state: "output-error",
@@ -2781,7 +2781,7 @@ function Ai({ stream: e, messageMetadataSchema: t, dataPartSchemas: a, runUpdate
2781
2781
  toolMetadata: n.toolMetadata ?? u.toolMetadata
2782
2782
  }, u) : T({
2783
2783
  toolCallId: n.toolCallId,
2784
- toolName: kt(u),
2784
+ toolName: Mt(u),
2785
2785
  state: "output-error",
2786
2786
  input: u.input,
2787
2787
  rawInput: u.rawInput,
@@ -2804,7 +2804,7 @@ function Ai({ stream: e, messageMetadataSchema: t, dataPartSchemas: a, runUpdate
2804
2804
  break;
2805
2805
  }
2806
2806
  case "start":
2807
- n.messageId != null && (g || p && n.messageId !== c.message.id) && Object.assign(c, Ms({
2807
+ n.messageId != null && (g || p && n.messageId !== c.message.id) && Object.assign(c, ks({
2808
2808
  lastMessage: void 0,
2809
2809
  messageId: n.messageId
2810
2810
  }), { finishReason: void 0 }), n.messageId != null && (c.message.id = n.messageId), await N(n.messageMetadata), (n.messageId != null || n.messageMetadata != null) && m({ updateStatus: !1 });
@@ -2988,7 +2988,7 @@ async function va({ response: e, url: t, fallbackMessage: a }) {
2988
2988
  responseBody: s
2989
2989
  });
2990
2990
  }
2991
- async function ki(e) {
2991
+ async function Mi(e) {
2992
2992
  if (e == null) return [];
2993
2993
  if (!globalThis.FileList || !(e instanceof globalThis.FileList)) throw new Xn({
2994
2994
  functionality: "FileList",
@@ -3010,7 +3010,7 @@ async function ki(e) {
3010
3010
  };
3011
3011
  }));
3012
3012
  }
3013
- function Mi(e, t) {
3013
+ function ki(e, t) {
3014
3014
  const a = e.search(/[?#]/), s = a === -1 ? e : e.slice(0, a), r = a === -1 ? "" : e.slice(a);
3015
3015
  return `${s.endsWith("/") && t.startsWith("/") ? s.slice(0, -1) : s}${t}${r}`;
3016
3016
  }
@@ -3084,7 +3084,7 @@ var _i = class {
3084
3084
  value: e.chatId,
3085
3085
  message: 'Chat IDs must not be "." or ".." when using the default reconnect URL.'
3086
3086
  });
3087
- i = Mi(this.api, `/${encodeURIComponent(e.chatId)}/stream`);
3087
+ i = ki(this.api, `/${encodeURIComponent(e.chatId)}/stream`);
3088
3088
  }
3089
3089
  const p = (l == null ? void 0 : l.headers) !== void 0 ? je(l.headers) : r, g = (l == null ? void 0 : l.credentials) ?? s, n = await (this.fetch ?? globalThis.fetch)(i, {
3090
3090
  method: "GET",
@@ -3123,9 +3123,9 @@ var _i = class {
3123
3123
  if (w == null) {
3124
3124
  w = (C = this.lastMessage) == null ? void 0 : C.id;
3125
3125
  for (let T = this.state.messages.length - 1; T >= 0; T--) {
3126
- const k = this.state.messages[T];
3127
- if (k.role === "assistant" && k.parts.some((N) => de(N) && N.state === "approval-responded")) {
3128
- w = k.id;
3126
+ const M = this.state.messages[T];
3127
+ if (M.role === "assistant" && M.parts.some((N) => de(N) && N.state === "approval-responded")) {
3128
+ w = M.id;
3129
3129
  break;
3130
3130
  }
3131
3131
  }
@@ -3144,7 +3144,7 @@ var _i = class {
3144
3144
  this.pendingMessagePreparations.add(w);
3145
3145
  let A;
3146
3146
  try {
3147
- A = Array.isArray(c.files) ? c.files : await ki(c.files);
3147
+ A = Array.isArray(c.files) ? c.files : await Mi(c.files);
3148
3148
  } finally {
3149
3149
  this.pendingMessagePreparations.delete(w);
3150
3150
  }
@@ -3203,26 +3203,26 @@ var _i = class {
3203
3203
  }, this.clearError = () => {
3204
3204
  this.status === "error" && (this.state.error = void 0, this.setStatus({ status: "ready" }));
3205
3205
  }, this.addToolApprovalResponse = async ({ id: c, approved: m, reason: x, options: C }) => this.jobExecutor.run(async () => {
3206
- const w = this.state.messages, A = (k) => de(k) && k.state === "approval-requested" && k.approval.id === c ? {
3207
- ...k,
3206
+ const w = this.state.messages, A = (M) => de(M) && M.state === "approval-requested" && M.approval.id === c ? {
3207
+ ...M,
3208
3208
  state: "approval-responded",
3209
3209
  approval: {
3210
- ...k.approval,
3210
+ ...M.approval,
3211
3211
  id: c,
3212
3212
  approved: m,
3213
3213
  reason: x
3214
3214
  }
3215
- } : k, T = w.findIndex((k) => k.parts.some((N) => de(N) && N.state === "approval-requested" && N.approval.id === c));
3215
+ } : M, T = w.findIndex((M) => M.parts.some((N) => de(N) && N.state === "approval-requested" && N.approval.id === c));
3216
3216
  if (T !== -1) {
3217
- const k = w[T];
3217
+ const M = w[T];
3218
3218
  this.state.replaceMessage(T, {
3219
- ...k,
3220
- parts: k.parts.map(A)
3221
- }), this.pendingApprovalMessageId = k.id;
3219
+ ...M,
3220
+ parts: M.parts.map(A)
3221
+ }), this.pendingApprovalMessageId = M.id;
3222
3222
  }
3223
3223
  if (this.activeResponse && (this.activeResponse.state.message.parts = this.activeResponse.state.message.parts.map(A)), T !== -1 && this.status !== "streaming" && this.status !== "submitted" && this.sendAutomaticallyWhen) {
3224
- const k = await this.shouldSendAutomatically();
3225
- k && this.runAutomaticRequest(() => {
3224
+ const M = await this.shouldSendAutomatically();
3225
+ M && this.runAutomaticRequest(() => {
3226
3226
  var u;
3227
3227
  const N = T === -1 ? (u = this.lastMessage) == null ? void 0 : u.id : w[T].id;
3228
3228
  return this.makeRequestForToolApproval({
@@ -3230,10 +3230,10 @@ var _i = class {
3230
3230
  messageIndex: T,
3231
3231
  ...C
3232
3232
  });
3233
- }, k);
3233
+ }, M);
3234
3234
  }
3235
3235
  }), this.addToolOutput = async ({ state: c, toolCallId: m, output: x, errorText: C, options: w }) => this.jobExecutor.run(async () => {
3236
- const A = this.state.messages, T = A[A.length - 1], k = (N) => {
3236
+ const A = this.state.messages, T = A[A.length - 1], M = (N) => {
3237
3237
  if (!de(N) || N.toolCallId !== m) return N;
3238
3238
  const { approval: u, ...y } = N, f = (u == null ? void 0 : u.approved) === !0 ? { approval: {
3239
3239
  ...u,
@@ -3257,8 +3257,8 @@ var _i = class {
3257
3257
  };
3258
3258
  if (this.state.replaceMessage(A.length - 1, {
3259
3259
  ...T,
3260
- parts: T.parts.map(k)
3261
- }), this.activeResponse && (this.activeResponse.state.message.parts = this.activeResponse.state.message.parts.map(k)), this.status !== "streaming" && this.status !== "submitted" && this.sendAutomaticallyWhen) {
3260
+ parts: T.parts.map(M)
3261
+ }), this.activeResponse && (this.activeResponse.state.message.parts = this.activeResponse.state.message.parts.map(M)), this.status !== "streaming" && this.status !== "submitted" && this.sendAutomaticallyWhen) {
3262
3262
  const N = await this.shouldSendAutomatically();
3263
3263
  N && this.runAutomaticRequest(() => {
3264
3264
  var u;
@@ -3389,10 +3389,10 @@ var _i = class {
3389
3389
  error: void 0
3390
3390
  });
3391
3391
  const c = this.lastMessage, m = e === "submit-message" && r != null ? this.state.messages.findIndex((f) => f.id === r) : this.state.messages.length - 1, x = m === -1 ? c : this.state.messages[m], C = e === "resume-stream" && (x == null ? void 0 : x.role) === "assistant" && x.parts.some((f) => de(f) && (f.state === "input-streaming" || f.state === "input-available" && f.providerExecuted || f.state === "approval-responded")) ? this.state.snapshot(x) : void 0, w = m !== -1 && m < this.state.messages.length - 1 && (x == null ? void 0 : x.role) === "assistant";
3392
- let A = !1, T = !1, k = !1, N;
3392
+ let A = !1, T = !1, M = !1, N;
3393
3393
  try {
3394
3394
  const f = {
3395
- state: e === "resume-stream" && this.resumableStreamState != null ? this.resumableStreamState : Ms({
3395
+ state: e === "resume-stream" && this.resumableStreamState != null ? this.resumableStreamState : ks({
3396
3396
  lastMessage: e === "resume-stream" ? C : e === "regenerate-message" ? void 0 : this.state.snapshot(x),
3397
3397
  messageId: this.generateId()
3398
3398
  }),
@@ -3413,7 +3413,7 @@ var _i = class {
3413
3413
  trigger: e,
3414
3414
  messageId: r
3415
3415
  });
3416
- const I = (M) => this.jobExecutor.run(() => f.abortController.signal.aborted ? Promise.resolve() : M({
3416
+ const I = (k) => this.jobExecutor.run(() => f.abortController.signal.aborted ? Promise.resolve() : k({
3417
3417
  state: f.state,
3418
3418
  write: ({ updateStatus: L = !0 } = {}) => {
3419
3419
  var V;
@@ -3430,13 +3430,13 @@ var _i = class {
3430
3430
  messageMetadataSchema: this.messageMetadataSchema,
3431
3431
  dataPartSchemas: this.dataPartSchemas,
3432
3432
  runUpdateMessageJob: I,
3433
- onError: (M) => {
3434
- throw M;
3433
+ onError: (k) => {
3434
+ throw k;
3435
3435
  }
3436
3436
  }),
3437
3437
  abortSignal: f.abortController.signal,
3438
- onError: (M) => {
3439
- throw M;
3438
+ onError: (k) => {
3439
+ throw k;
3440
3440
  }
3441
3441
  }), A)
3442
3442
  return g() && (this.setStatus({ status: "ready" }), this.resumableStreamState === f.state && (this.resumableStreamState = void 0)), null;
@@ -3445,7 +3445,7 @@ var _i = class {
3445
3445
  if (A || f.name === "AbortError")
3446
3446
  return A = !0, g() && (this.setStatus({ status: "ready" }), this.resumableStreamState === (N == null ? void 0 : N.state) && (this.resumableStreamState = void 0)), null;
3447
3447
  if (!g()) return null;
3448
- if (k = !0, f instanceof TypeError) {
3448
+ if (M = !0, f instanceof TypeError) {
3449
3449
  const v = f.message.toLowerCase();
3450
3450
  T = v.includes("fetch") || v.includes("network") || v === "load failed";
3451
3451
  }
@@ -3460,14 +3460,14 @@ var _i = class {
3460
3460
  messages: this.state.messages,
3461
3461
  isAbort: A,
3462
3462
  isDisconnect: T,
3463
- isError: k,
3463
+ isError: M,
3464
3464
  finishReason: N.state.finishReason
3465
3465
  }));
3466
3466
  } finally {
3467
3467
  this.activeResponse === N && (this.activeResponse = void 0), n();
3468
3468
  }
3469
3469
  }
3470
- !A && !k && await this.runAutomaticRequest(() => {
3470
+ !A && !M && await this.runAutomaticRequest(() => {
3471
3471
  var f;
3472
3472
  return this.makeRequest({
3473
3473
  trigger: "submit-message",
@@ -3499,18 +3499,18 @@ function $i(e, t) {
3499
3499
  function ji(e) {
3500
3500
  return Array.isArray(e) ? [...e] : e != null && typeof e == "object" && (Object.getPrototypeOf(e) === Object.prototype || Object.getPrototypeOf(e) === null) ? { ...e } : e;
3501
3501
  }
3502
- var re, Be, Ue, Ee, Te, ke, be, Ye, Qe, ka, Fi = (ka = class {
3502
+ var re, Be, Ue, Ee, Te, Me, be, Ye, Qe, Ma, Fi = (Ma = class {
3503
3503
  constructor(e = []) {
3504
3504
  oe(this, re);
3505
3505
  oe(this, Be);
3506
3506
  oe(this, Ue);
3507
3507
  oe(this, Ee);
3508
3508
  oe(this, Te);
3509
- oe(this, ke);
3509
+ oe(this, Me);
3510
3510
  oe(this, be);
3511
3511
  oe(this, Ye);
3512
3512
  oe(this, Qe);
3513
- W(this, Be, "ready"), W(this, Ue, void 0), W(this, Ee, /* @__PURE__ */ new Set()), W(this, Te, /* @__PURE__ */ new Set()), W(this, ke, /* @__PURE__ */ new Set()), this.pushMessage = (t) => {
3513
+ W(this, Be, "ready"), W(this, Ue, void 0), W(this, Ee, /* @__PURE__ */ new Set()), W(this, Te, /* @__PURE__ */ new Set()), W(this, Me, /* @__PURE__ */ new Set()), this.pushMessage = (t) => {
3514
3514
  W(this, re, B(this, re).concat(t)), B(this, be).call(this);
3515
3515
  }, this.popMessage = () => {
3516
3516
  W(this, re, B(this, re).slice(0, -1)), B(this, be).call(this);
@@ -3534,14 +3534,14 @@ var re, Be, Ue, Ee, Te, ke, be, Ye, Qe, ka, Fi = (ka = class {
3534
3534
  };
3535
3535
  }, this["~registerStatusCallback"] = (t) => (B(this, Te).add(t), () => {
3536
3536
  B(this, Te).delete(t);
3537
- }), this["~registerErrorCallback"] = (t) => (B(this, ke).add(t), () => {
3538
- B(this, ke).delete(t);
3537
+ }), this["~registerErrorCallback"] = (t) => (B(this, Me).add(t), () => {
3538
+ B(this, Me).delete(t);
3539
3539
  }), W(this, be, () => {
3540
3540
  B(this, Ee).forEach((t) => t());
3541
3541
  }), W(this, Ye, () => {
3542
3542
  B(this, Te).forEach((t) => t());
3543
3543
  }), W(this, Qe, () => {
3544
- B(this, ke).forEach((t) => t());
3544
+ B(this, Me).forEach((t) => t());
3545
3545
  }), W(this, re, e);
3546
3546
  }
3547
3547
  get status() {
@@ -3562,17 +3562,17 @@ var re, Be, Ue, Ee, Te, ke, be, Ye, Qe, ka, Fi = (ka = class {
3562
3562
  set messages(e) {
3563
3563
  W(this, re, [...e]), B(this, be).call(this);
3564
3564
  }
3565
- }, re = new WeakMap(), Be = new WeakMap(), Ue = new WeakMap(), Ee = new WeakMap(), Te = new WeakMap(), ke = new WeakMap(), be = new WeakMap(), Ye = new WeakMap(), Qe = new WeakMap(), ka), Me, Ma, _s = (Ma = class extends Oi {
3565
+ }, re = new WeakMap(), Be = new WeakMap(), Ue = new WeakMap(), Ee = new WeakMap(), Te = new WeakMap(), Me = new WeakMap(), be = new WeakMap(), Ye = new WeakMap(), Qe = new WeakMap(), Ma), ke, ka, _s = (ka = class extends Oi {
3566
3566
  constructor({ messages: t, ...a }) {
3567
3567
  const s = new Fi(t);
3568
3568
  super({
3569
3569
  ...a,
3570
3570
  state: s
3571
3571
  });
3572
- oe(this, Me);
3573
- this["~registerMessagesCallback"] = (r, l) => B(this, Me)["~registerMessagesCallback"](r, l), this["~registerStatusCallback"] = (r) => B(this, Me)["~registerStatusCallback"](r), this["~registerErrorCallback"] = (r) => B(this, Me)["~registerErrorCallback"](r), W(this, Me, s);
3572
+ oe(this, ke);
3573
+ this["~registerMessagesCallback"] = (r, l) => B(this, ke)["~registerMessagesCallback"](r, l), this["~registerStatusCallback"] = (r) => B(this, ke)["~registerStatusCallback"](r), this["~registerErrorCallback"] = (r) => B(this, ke)["~registerErrorCallback"](r), W(this, ke, s);
3574
3574
  }
3575
- }, Me = new WeakMap(), Ma);
3575
+ }, ke = new WeakMap(), ka);
3576
3576
  const vt = /* @__PURE__ */ new WeakMap();
3577
3577
  function Li({ chat: e, registration: t }) {
3578
3578
  let a = vt.get(e);
@@ -3656,7 +3656,7 @@ function Bi({ throttle: e, experimental_throttle: t, resume: a = !1, ...s } = {}
3656
3656
  N = !1, y.forEach((v) => v());
3657
3657
  };
3658
3658
  }, [c, r]);
3659
- const { messages: w, status: A, error: T } = x, k = G((N) => {
3659
+ const { messages: w, status: A, error: T } = x, M = G((N) => {
3660
3660
  typeof N == "function" && (N = N(c.messages)), c.messages = N;
3661
3661
  }, [c]);
3662
3662
  return ve(() => {
@@ -3667,7 +3667,7 @@ function Bi({ throttle: e, experimental_throttle: t, resume: a = !1, ...s } = {}
3667
3667
  }, [a, c]), {
3668
3668
  id: c.id,
3669
3669
  messages: w,
3670
- setMessages: k,
3670
+ setMessages: M,
3671
3671
  sendMessage: c.sendMessage,
3672
3672
  regenerate: c.regenerate,
3673
3673
  clearError: c.clearError,
@@ -3697,7 +3697,7 @@ const zt = async (e, t) => {
3697
3697
  r,
3698
3698
  Number.isInteger(l) && l > 0 ? { dailyLimit: l } : {}
3699
3699
  );
3700
- }, Mt = (e) => ["assistant", "recent-conversations", e], Os = (e) => ["assistant", "addable-sources", e];
3700
+ }, kt = (e) => ["assistant", "recent-conversations", e], Os = (e) => ["assistant", "addable-sources", e];
3701
3701
  async function _t(e, t) {
3702
3702
  await e.cancelQueries({ queryKey: t }), await e.invalidateQueries({ queryKey: t });
3703
3703
  }
@@ -3819,7 +3819,7 @@ function el(e) {
3819
3819
  }), [m]);
3820
3820
  const { messages: C, status: w, error: A } = Bi({ chat: m.chat });
3821
3821
  ve(() => () => void m.chat.stop(), [m]);
3822
- const [T, k] = $(), [N, u] = $([]), y = te(void 0), [f, v] = $(!1);
3822
+ const [T, M] = $(), [N, u] = $([]), y = te(void 0), [f, v] = $(!1);
3823
3823
  ve(() => () => {
3824
3824
  var R;
3825
3825
  return (R = y.current) == null ? void 0 : R.abort();
@@ -3827,7 +3827,7 @@ function el(e) {
3827
3827
  const I = G(() => {
3828
3828
  var R;
3829
3829
  (R = y.current) == null || R.abort(), y.current = void 0, v(!1);
3830
- }, []), M = G(
3830
+ }, []), k = G(
3831
3831
  (R, E = []) => {
3832
3832
  var J, K, se;
3833
3833
  const _ = R.trim();
@@ -3836,10 +3836,10 @@ function el(e) {
3836
3836
  try {
3837
3837
  D = t.current.readContext();
3838
3838
  } catch (he) {
3839
- return k(nl(he)), he instanceof Ja && t.current.onStaleFocus(), "not_sent";
3839
+ return M(nl(he)), he instanceof Ja && t.current.onStaleFocus(), "not_sent";
3840
3840
  }
3841
3841
  if (Gr(D.context, E).length)
3842
- return k(Xi), "not_sent";
3842
+ return M(Xi), "not_sent";
3843
3843
  const Z = {
3844
3844
  turnId: ol(),
3845
3845
  context: D.context,
@@ -3848,8 +3848,8 @@ function el(e) {
3848
3848
  ...E.length ? { taggedFields: E } : {}
3849
3849
  };
3850
3850
  if (It({ ...Z, message: _ }) > ze.requestBytes)
3851
- return k(new Za(It(Z)).message), "not_sent";
3852
- k(void 0);
3851
+ return M(new Za(It(Z)).message), "not_sent";
3852
+ M(void 0);
3853
3853
  const ae = (J = D.context.selectedCard) == null ? void 0 : J.id;
3854
3854
  ae && (m.aboutCardId = ae);
3855
3855
  const U = tl(D.context, ((se = (K = t.current).canChangeOpenDashboard) == null ? void 0 : se.call(K)) ?? !1);
@@ -3863,9 +3863,9 @@ function el(e) {
3863
3863
  (R) => {
3864
3864
  var _;
3865
3865
  const E = m.chat.messages.find((D) => D.id === R && D.role === "user");
3866
- return E ? M(Rs(E), ((_ = E.metadata) == null ? void 0 : _.taggedFields) ?? []) : "not_sent";
3866
+ return E ? k(Rs(E), ((_ = E.metadata) == null ? void 0 : _.taggedFields) ?? []) : "not_sent";
3867
3867
  },
3868
- [m, M]
3868
+ [m, k]
3869
3869
  ), V = G(
3870
3870
  (R) => {
3871
3871
  const E = H.getState().actions.undoProposal(R);
@@ -3899,7 +3899,7 @@ function el(e) {
3899
3899
  },
3900
3900
  [m, c, l]
3901
3901
  ), z = G(() => void m.chat.stop(), [m]), ue = G(() => {
3902
- I(), k(void 0), x(xt(c)), u([]);
3902
+ I(), M(void 0), x(xt(c)), u([]);
3903
3903
  }, [I, c]), Ne = G(
3904
3904
  (R, E) => {
3905
3905
  E.beside && m.aboutCardId !== R && ue();
@@ -3918,12 +3918,12 @@ function el(e) {
3918
3918
  return I(), "opened";
3919
3919
  (_ = y.current) == null || _.abort();
3920
3920
  const E = new AbortController();
3921
- y.current = E, v(!0), k(void 0);
3921
+ y.current = E, v(!0), M(void 0);
3922
3922
  try {
3923
3923
  const D = await wa(c.connection(), R, E.signal);
3924
3924
  return E.signal.aborted ? "not_opened" : (x(xt(c, D)), u(D.addedSources), D.allows && h(D.allows), "opened");
3925
3925
  } catch (D) {
3926
- return E.signal.aborted || k(
3926
+ return E.signal.aborted || M(
3927
3927
  D instanceof Ve && D.code !== "model_unavailable" ? D.message : Qi
3928
3928
  ), "not_opened";
3929
3929
  } finally {
@@ -3959,8 +3959,8 @@ function el(e) {
3959
3959
  /** What went wrong with the last send, in plain words; never a raw error. */
3960
3960
  failure: A ? rl(A) : void 0,
3961
3961
  notice: T,
3962
- clearNotice: () => k(void 0),
3963
- send: M,
3962
+ clearNotice: () => M(void 0),
3963
+ send: k,
3964
3964
  askAgain: L,
3965
3965
  stop: z,
3966
3966
  startNew: ue,
@@ -4072,7 +4072,7 @@ function Zt(e, t, a) {
4072
4072
  if (e == null) return "";
4073
4073
  if (t.temporalBucket && typeof e == "string")
4074
4074
  try {
4075
- return Mn({
4075
+ return kn({
4076
4076
  value: e,
4077
4077
  metadata: t.temporalBucket,
4078
4078
  format: js(t.temporalBucket, a).format
@@ -4730,14 +4730,14 @@ function Tl({
4730
4730
  }
4731
4731
  );
4732
4732
  }
4733
- const kl = "You’ve changed the dashboard since. Undo in the toolbar goes back to before editing.";
4734
- function Ml({
4733
+ const Ml = "You’ve changed the dashboard since. Undo in the toolbar goes back to before editing.";
4734
+ function kl({
4735
4735
  proposal: e,
4736
4736
  state: t,
4737
4737
  onUndo: a,
4738
4738
  onAskAgain: s
4739
4739
  }) {
4740
- const r = H((h) => mr(h, e.proposalId)), l = H((h) => h.isVisualEditing), i = Ol(t, r), p = i.kind === "undone" || i.kind === "refused", g = !p && i.kind !== "settled", n = i.kind === "changed_since" ? kl : i.kind === "undone" ? "Undone." : i.kind === "refused" ? i.message : void 0;
4740
+ const r = H((h) => mr(h, e.proposalId)), l = H((h) => h.isVisualEditing), i = Ol(t, r), p = i.kind === "undone" || i.kind === "refused", g = !p && i.kind !== "settled", n = i.kind === "changed_since" ? Ml : i.kind === "undone" ? "Undone." : i.kind === "refused" ? i.message : void 0;
4741
4741
  return /* @__PURE__ */ b(
4742
4742
  Ze,
4743
4743
  {
@@ -4822,7 +4822,7 @@ function $l({ change: e, state: t, busy: a, onAdd: s, onDismiss: r, onNextStep:
4822
4822
  var N, u, y;
4823
4823
  const i = e.links ?? [], p = ((N = e.outcome) == null ? void 0 : N.status) === "applied" ? { status: "added", links: e.outcome.links } : ((u = e.outcome) == null ? void 0 : u.status) === "dismissed" ? { status: "dismissed" } : ((y = e.outcome) == null ? void 0 : y.status) === "refused" ? { status: "refused", message: jt(e.outcome.code) } : void 0;
4824
4824
  t = p && (!t || t.status === "offered") ? p : t;
4825
- const g = (t == null ? void 0 : t.status) ?? "settled", n = g === "offered" || g === "adding" || g === "dismissing", h = g === "adding" || g === "dismissing", c = i.length > 1, [m, x] = $(() => i.map((f, v) => v)), C = (t == null ? void 0 : t.status) === "adding" ? t.links ?? m : m, w = (t == null ? void 0 : t.status) === "added" ? t.links : void 0, A = i.length > 0 ? C.length : 1, T = w ? Bl(w) : void 0, k = T ? T.added + T.existing > 0 : !1;
4825
+ const g = (t == null ? void 0 : t.status) ?? "settled", n = g === "offered" || g === "adding" || g === "dismissing", h = g === "adding" || g === "dismissing", c = i.length > 1, [m, x] = $(() => i.map((f, v) => v)), C = (t == null ? void 0 : t.status) === "adding" ? t.links ?? m : m, w = (t == null ? void 0 : t.status) === "added" ? t.links : void 0, A = i.length > 0 ? C.length : 1, T = w ? Bl(w) : void 0, M = T ? T.added + T.existing > 0 : !1;
4826
4826
  return /* @__PURE__ */ b(
4827
4827
  Ze,
4828
4828
  {
@@ -4830,7 +4830,7 @@ function $l({ change: e, state: t, busy: a, onAdd: s, onDismiss: r, onNextStep:
4830
4830
  title: i.length > 1 ? "Data model changes" : "Data model change",
4831
4831
  testId: "assistant-model-change",
4832
4832
  "data-model-change-state": g,
4833
- action: g === "adding" ? /* @__PURE__ */ d(lt, { icon: /* @__PURE__ */ d(we, { className: "h-3 w-3 animate-spin" }), children: "Adding" }) : T ? /* @__PURE__ */ d(lt, { icon: k ? /* @__PURE__ */ d(Pe, { className: "h-3 w-3" }) : /* @__PURE__ */ d(Pt, { className: "h-3 w-3 text-amber-500" }), children: k ? T.refused > 0 ? "Partly added" : "Added" : "Not added" }) : null,
4833
+ action: g === "adding" ? /* @__PURE__ */ d(lt, { icon: /* @__PURE__ */ d(we, { className: "h-3 w-3 animate-spin" }), children: "Adding" }) : T ? /* @__PURE__ */ d(lt, { icon: M ? /* @__PURE__ */ d(Pe, { className: "h-3 w-3" }) : /* @__PURE__ */ d(Pt, { className: "h-3 w-3 text-amber-500" }), children: M ? T.refused > 0 ? "Partly added" : "Added" : "Not added" }) : null,
4834
4834
  children: [
4835
4835
  i.length > 0 ? /* @__PURE__ */ d("ul", { className: "space-y-1.5", children: i.map((f, v) => /* @__PURE__ */ d(
4836
4836
  Fl,
@@ -4840,7 +4840,7 @@ function $l({ change: e, state: t, busy: a, onAdd: s, onDismiss: r, onNextStep:
4840
4840
  tick: n && c ? {
4841
4841
  checked: C.includes(v),
4842
4842
  disabled: h || a,
4843
- onChange: (I) => x((M) => I ? [...M, v].sort((L, V) => L - V) : M.filter((L) => L !== v))
4843
+ onChange: (I) => x((k) => I ? [...k, v].sort((L, V) => L - V) : k.filter((L) => L !== v))
4844
4844
  } : void 0,
4845
4845
  outcome: w == null ? void 0 : w[v],
4846
4846
  muted: g === "dismissed"
@@ -4894,7 +4894,7 @@ function $l({ change: e, state: t, busy: a, onAdd: s, onDismiss: r, onNextStep:
4894
4894
  ] }) : null,
4895
4895
  g === "dismissed" || g === "refused" || T ? /* @__PURE__ */ b("div", { className: "flex flex-wrap items-center justify-between gap-2 border-t border-border pt-2", children: [
4896
4896
  /* @__PURE__ */ d("span", { className: "text-[11.5px] leading-[1.5] text-muted-foreground", children: (t == null ? void 0 : t.status) === "refused" ? t.message : g === "dismissed" ? "Not added." : Ul(T, i.length, e.domainLabel) }),
4897
- k && e.nextStep && l ? /* @__PURE__ */ b(q, { size: "xs", className: "h-[26px] gap-1 px-2 text-[11.5px]", disabled: a, onClick: () => l(e.nextStep), children: [
4897
+ M && e.nextStep && l ? /* @__PURE__ */ b(q, { size: "xs", className: "h-[26px] gap-1 px-2 text-[11.5px]", disabled: a, onClick: () => l(e.nextStep), children: [
4898
4898
  e.nextStep,
4899
4899
  /* @__PURE__ */ d(Dt, { className: "h-3 w-3" })
4900
4900
  ] }) : null
@@ -5107,7 +5107,7 @@ function Kl({
5107
5107
  var N;
5108
5108
  const x = e.parts.find(Hl), C = (N = e.parts.find(Gl)) == null ? void 0 : N.data, w = e.parts.filter(Yl).map((u) => u.data), A = en(e.parts, Wl), T = e.parts.filter(
5109
5109
  (u) => u.type === "text" ? !A.has(u) : u.type.startsWith("data-") && tn(u.type.slice(5))
5110
- ), k = t ? [...w].reverse().find((u) => u.state === "live") : void 0;
5110
+ ), M = t ? [...w].reverse().find((u) => u.state === "live") : void 0;
5111
5111
  return /* @__PURE__ */ b("div", { className: "space-y-2", "data-testid": "assistant-answer", "data-message-id": e.id, children: [
5112
5112
  T.map(
5113
5113
  (u, y) => u.type === "text" ? /* @__PURE__ */ d(nd, { text: u.text }, y) : u.type === "data-refusal" ? /* @__PURE__ */ d("p", { className: "text-[12.5px] leading-[1.6] text-muted-foreground", children: u.data.message }, y) : u.type === "data-artifact" ? /* @__PURE__ */ d(
@@ -5119,7 +5119,7 @@ function Kl({
5119
5119
  },
5120
5120
  y
5121
5121
  ) : u.type === "data-proposal" ? /* @__PURE__ */ d(
5122
- Ml,
5122
+ kl,
5123
5123
  {
5124
5124
  proposal: u.data,
5125
5125
  state: l[u.data.proposalId],
@@ -5149,7 +5149,7 @@ function Kl({
5149
5149
  y
5150
5150
  ) : null
5151
5151
  ),
5152
- t ? /* @__PURE__ */ d(Ws, { step: k }) : null,
5152
+ t ? /* @__PURE__ */ d(Ws, { step: M }) : null,
5153
5153
  !t && (w.length > 0 || x || C) ? /* @__PURE__ */ d(td, { stages: w, using: x == null ? void 0 : x.data, trace: C }) : null
5154
5154
  ] });
5155
5155
  }
@@ -5356,7 +5356,7 @@ function id({
5356
5356
  /* @__PURE__ */ d(Tr, {})
5357
5357
  ] }) : null,
5358
5358
  /* @__PURE__ */ b(pt, { className: "text-[12.5px]", disabled: !s, onSelect: () => g("conversation"), children: [
5359
- /* @__PURE__ */ d(kr, { className: "mr-2 h-3.5 w-3.5 text-muted-foreground" }),
5359
+ /* @__PURE__ */ d(Mr, { className: "mr-2 h-3.5 w-3.5 text-muted-foreground" }),
5360
5360
  "Copy conversation"
5361
5361
  ] }),
5362
5362
  a != null && a.toolCalls ? /* @__PURE__ */ b(pt, { className: "text-[12.5px]", disabled: !s, onSelect: () => g("tool_calls"), children: [
@@ -5385,17 +5385,17 @@ function dd({
5385
5385
  answeringId: l,
5386
5386
  header: i
5387
5387
  }) {
5388
- var k;
5388
+ var M;
5389
5389
  const p = ja({
5390
- queryKey: Mt(e),
5390
+ queryKey: kt(e),
5391
5391
  queryFn: ({ signal: N }) => zi(t(), N),
5392
5392
  staleTime: 0,
5393
5393
  // A failed read says so at once, whichever client the host mounted.
5394
5394
  retry: !1
5395
- }), g = Fa(), [n, h] = $(), [c, m] = $(() => /* @__PURE__ */ new Set()), [x, C] = $(), w = (k = p.data) == null ? void 0 : k.filter((N) => !c.has(N.conversationId)), A = async (N) => {
5395
+ }), g = Fa(), [n, h] = $(), [c, m] = $(() => /* @__PURE__ */ new Set()), [x, C] = $(), w = (M = p.data) == null ? void 0 : M.filter((N) => !c.has(N.conversationId)), A = async (N) => {
5396
5396
  h(N);
5397
5397
  const u = await s(N);
5398
- h((y) => y === N ? void 0 : y), u === "not_opened" && _t(g, Mt(e));
5398
+ h((y) => y === N ? void 0 : y), u === "not_opened" && _t(g, kt(e));
5399
5399
  }, T = async (N) => {
5400
5400
  C(void 0), m((u) => new Set(u).add(N)), r(N);
5401
5401
  try {
@@ -5626,12 +5626,12 @@ function Gd({
5626
5626
  placement: a
5627
5627
  }) {
5628
5628
  var Ht, Gt;
5629
- const s = t === "none", r = Mr(), l = tt(e.store, (S) => S.focus), i = tt(e.store, (S) => S.isOpen), p = tt(e.store, (S) => S.askCount), g = tt(e.store, (S) => S.layout), n = s ? "full-page" : g, h = a ?? n, c = h === "beside-card", m = H(
5629
+ const s = t === "none", r = kr(), l = tt(e.store, (S) => S.focus), i = tt(e.store, (S) => S.isOpen), p = tt(e.store, (S) => S.askCount), g = tt(e.store, (S) => S.layout), n = s ? "full-page" : g, h = a ?? n, c = h === "beside-card", m = H(
5630
5630
  (S) => {
5631
5631
  var P;
5632
5632
  return l && S.dashboard ? (P = Br(S.dashboard, l.cardId)) == null ? void 0 : P.card : void 0;
5633
5633
  }
5634
- ), x = wd(s), C = te(void 0), [w] = $(() => Ln(t)), [A, T] = $([]), k = G(
5634
+ ), x = wd(s), C = te(void 0), [w] = $(() => Ln(t)), [A, T] = $([]), M = G(
5635
5635
  (S) => {
5636
5636
  C.current = S;
5637
5637
  const P = bd(
@@ -5652,13 +5652,13 @@ function Gd({
5652
5652
  readContext: () => w({ focus: e.store.getState().focus, snapshot: C.current, editing: Nd(s) }),
5653
5653
  connection: u,
5654
5654
  onStaleFocus: e.clearFocus,
5655
- onTurnFinished: () => void _t(N, Mt(e.id)),
5655
+ onTurnFinished: () => void _t(N, kt(e.id)),
5656
5656
  // A refused context may name an added source the caller can no longer add:
5657
5657
  // reading the catalog again marks it (D3c-10).
5658
5658
  onFailed: (S) => {
5659
5659
  S instanceof Ve && S.code === "context_invalid" && _t(N, Os(e.id));
5660
5660
  }
5661
- }), [M, L] = $(""), V = te(null);
5661
+ }), [k, L] = $(""), V = te(null);
5662
5662
  ve(() => {
5663
5663
  var S;
5664
5664
  (i || s) && ((S = V.current) == null || S.focus());
@@ -5674,13 +5674,13 @@ function Gd({
5674
5674
  _e(() => {
5675
5675
  var S;
5676
5676
  R.current !== void 0 && ((S = V.current) == null || S.setSelectionRange(R.current, R.current), R.current = void 0);
5677
- }, [M]);
5677
+ }, [k]);
5678
5678
  const E = (S) => {
5679
5679
  z.add(S);
5680
- const P = V.current, X = hd(M, (P == null ? void 0 : P.selectionStart) ?? M.length);
5681
- X.text !== M && (R.current = X.caret, L(X.text)), Ie(void 0), P == null || P.focus();
5680
+ const P = V.current, X = hd(k, (P == null ? void 0 : P.selectionStart) ?? k.length);
5681
+ X.text !== k && (R.current = X.caret, L(X.text)), Ie(void 0), P == null || P.focus();
5682
5682
  }, _ = (S) => {
5683
- S == null || S.preventDefault(), I.send(M, z.shown) === "sent" && (L(""), z.clear());
5683
+ S == null || S.preventDefault(), I.send(k, z.shown) === "sent" && (L(""), z.clear());
5684
5684
  }, D = (S) => {
5685
5685
  var X;
5686
5686
  const P = I.send(S) === "sent";
@@ -5706,7 +5706,7 @@ function Gd({
5706
5706
  S.preventDefault(), Ie(void 0);
5707
5707
  return;
5708
5708
  }
5709
- if (S.key === "Backspace" && !M && z.shown.length) {
5709
+ if (S.key === "Backspace" && !k && z.shown.length) {
5710
5710
  z.remove(z.shown[z.shown.length - 1]);
5711
5711
  return;
5712
5712
  }
@@ -5797,7 +5797,7 @@ function Gd({
5797
5797
  ref: V,
5798
5798
  "aria-label": "Message",
5799
5799
  placeholder: x ? "Ask about this visual" : m ? "Ask about this card" : s ? "Ask about your data" : "Ask about this dashboard",
5800
- value: M,
5800
+ value: k,
5801
5801
  maxLength: ze.messageChars,
5802
5802
  rows: 2,
5803
5803
  onChange: (S) => {
@@ -5860,7 +5860,7 @@ function Gd({
5860
5860
  className: "h-7 w-7 shrink-0 p-0",
5861
5861
  "aria-label": "Send",
5862
5862
  title: "Send",
5863
- disabled: !M.trim() || I.loading,
5863
+ disabled: !k.trim() || I.loading,
5864
5864
  children: /* @__PURE__ */ d(dt, { className: "h-3.5 w-3.5" })
5865
5865
  }
5866
5866
  )
@@ -5973,8 +5973,8 @@ function Gd({
5973
5973
  ),
5974
5974
  x ? (
5975
5975
  // The draft runs as the editor's preview does: its authority and inline values.
5976
- /* @__PURE__ */ d(Rr, { children: /* @__PURE__ */ d(Ta, { card: x, draft: !0, onSnapshot: k }, `draft:${x.id}`) })
5977
- ) : m ? /* @__PURE__ */ d(Ta, { card: m, draft: !1, onSnapshot: k }, m.id) : null
5976
+ /* @__PURE__ */ d(Rr, { children: /* @__PURE__ */ d(Ta, { card: x, draft: !0, onSnapshot: M }, `draft:${x.id}`) })
5977
+ ) : m ? /* @__PURE__ */ d(Ta, { card: m, draft: !1, onSnapshot: M }, m.id) : null
5978
5978
  ]
5979
5979
  }
5980
5980
  )