react-semaphor 0.1.577 → 0.1.579

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 (35) hide show
  1. package/dist/assistant-context/index.js +1 -1
  2. package/dist/assistant-protocol/index.js +69 -66
  3. package/dist/briefings/index.js +1 -1
  4. package/dist/chunks/{add-to-dashboard-B6Ah8Lub.js → add-to-dashboard-DQFuDA5R.js} +50 -46
  5. package/dist/chunks/{assistant-chat-B_tmsxEK.js → assistant-chat-DBuKmREJ.js} +421 -421
  6. package/dist/chunks/{bookmark-impact-DUWw3wlA.js → bookmark-impact-MH4Dr-Ya.js} +1 -1
  7. package/dist/chunks/{card-filter-builder-CwnMUZU2.js → card-filter-builder-B9vtXVIZ.js} +3 -3
  8. package/dist/chunks/{context-R31TSL5V.js → context-BTLBjQNh.js} +99 -83
  9. package/dist/chunks/{dashboard-BcIIBCTP.js → dashboard-C4fyqxvV.js} +1 -1
  10. package/dist/chunks/{dashboard-briefing-launcher-BBpECqg2.js → dashboard-briefing-launcher-A9CLFv0s.js} +7 -7
  11. package/dist/chunks/{dashboard-controls-CONzvjmO.js → dashboard-controls-oKDW-835.js} +7 -7
  12. package/dist/chunks/{dashboard-json-BF2chEVd.js → dashboard-json-Bej2NBkS.js} +1 -1
  13. package/dist/chunks/{dates-DlYMDaF2.js → dates-BhL-mimk.js} +5 -5
  14. package/dist/chunks/{edit-dashboard-visual-Bf-RcbuD.js → edit-dashboard-visual-BFsCY2GP.js} +8 -8
  15. package/dist/chunks/{filter-reach-copy-BTAXnbwQ.js → filter-reach-copy-Xus3MfSo.js} +3 -3
  16. package/dist/chunks/{index-8BxDk8EP.js → index-CwlaI-UP.js} +2 -2
  17. package/dist/chunks/{report-preferences-dialog-RN4g9PEN.js → report-preferences-dialog-CcekIvkV.js} +7 -7
  18. package/dist/chunks/{resolve-dashboard-input-context-DBFuNhZo.js → resolve-dashboard-input-context-DoZHMivF.js} +1 -1
  19. package/dist/chunks/{saved-dashboard-context-AChHk4tw.js → saved-dashboard-context-LiDPCJ3r.js} +3 -3
  20. package/dist/chunks/{semaphor-ready-indicator-DtivanBy.js → semaphor-ready-indicator-cAOfbBuc.js} +5 -5
  21. package/dist/chunks/{shelf-drop-preview-context-BTjYxbHC.js → shelf-drop-preview-context-CwoYR7v1.js} +2 -2
  22. package/dist/chunks/{stored-dashboard-rpLzf4mk.js → stored-dashboard-CjnPEWO-.js} +2 -2
  23. package/dist/chunks/{variable-draft-DPSMDwqt.js → variable-draft-T4EOBvcu.js} +2 -2
  24. package/dist/dashboard/index.js +1 -1
  25. package/dist/dashboard-authoring/index.js +10 -10
  26. package/dist/index.js +12 -12
  27. package/dist/surfboard/index.js +1 -1
  28. package/dist/types/shared/assistant-protocol/answer-text.d.ts +5 -1
  29. package/dist/types/shared/assistant-protocol/context.d.ts +2 -1
  30. package/dist/types/shared/assistant-protocol/parts.d.ts +2 -1
  31. package/dist/types/shared/usage-events/catalog.d.ts +5 -3
  32. package/dist/types/shared/usage-events/details.d.ts +66 -0
  33. package/dist/types/shared/usage-events/envelope.d.ts +5 -5
  34. package/dist/usage-events/index.js +154 -115
  35. package/package.json +1 -1
@@ -5,7 +5,7 @@ var Kt = (e, t, a) => t.has(e) || Jt("Cannot " + a);
5
5
  var L = (e, t, a) => (Kt(e, t, "read from private field"), a ? a.call(e) : t.get(e)), ne = (e, t, a) => t.has(e) ? Jt("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, a), K = (e, t, a, s) => (Kt(e, t, "write to private field"), s ? s.call(e, a) : t.set(e, a), a);
6
6
  import { jsx as d, jsxs as v, Fragment as Me } from "react/jsx-runtime";
7
7
  import { useCallback as H, useRef as te, useMemo as Je, useEffect as be, useState as $, useLayoutEffect as ke, useId as Ys } from "react";
8
- import { u as W, di as Qs, b3 as Xs, bn as er, a5 as tr, dj as ar, dk as sr, a6 as Wt, b0 as rr, dl as nr, c0 as or, dm as ir, dn as _t, dp as lr, dq as dr, dr as lt, ds as Ea, dt as cr, bW as Ye, ci as Ht, du as Ta, a8 as ur, cc as Ma, bq as pr, c5 as Ot, bV as ka, dv as _a, dw as Oa, cD as mr, dx as Ra, dy as fr, cF as hr, bw as gr, dz as yr, dA as br, cf as vr, cg as xr, dB as wr, ch as Nr, cn as Ir, dC as Sr, c2 as ut, cm as Ar, cr as Cr, c4 as Pa, a_ as Da, b1 as Er, bh as tt, aY as $a, dD as Tr, dE as Mr, dF as kr, dG as _r, af as ja, dH as Or } from "./semaphor-ready-indicator-DtivanBy.js";
8
+ import { u as W, di as Qs, b3 as Xs, bn as er, a5 as tr, dj as ar, dk as sr, a6 as Wt, b0 as rr, dl as nr, c0 as or, dm as ir, dn as _t, dp as lr, dq as dr, dr as lt, ds as Ea, dt as cr, bW as Ye, ci as Ht, du as Ta, a8 as ur, cc as Ma, bq as pr, c5 as Ot, bV as ka, dv as _a, dw as Oa, cD as mr, dx as Ra, dy as fr, cF as hr, bw as gr, dz as yr, dA as br, cf as vr, cg as xr, dB as wr, ch as Nr, cn as Ir, dC as Sr, c2 as ut, cm as Ar, cr as Cr, c4 as Pa, a_ as Da, b1 as Er, bh as tt, aY as $a, dD as Tr, dE as Mr, dF as kr, dG as _r, af as ja, dH as Or } from "./semaphor-ready-indicator-cAOfbBuc.js";
9
9
  import { c as Re, B as Z, X as Ke, p as Fa, q as Rr, j as ze, L as _e, I as La, R as Pr, e as Ba, f as Ua, h as za } from "./style-sheet-parts-C7qGZuH1.js";
10
10
  import { g as Dr, c as B } from "./pickers-DkqmtnTL.js";
11
11
  import "./validators-B8fpdinG.js";
@@ -13,20 +13,20 @@ import "./matrix-operation-contract-DCVinw1o.js";
13
13
  import "./analytics-base-schemas-BaIQrEzX.js";
14
14
  import { DEFAULT_RESOLVED_VALUE_FORMAT_PREFERENCES as $r } from "../value-format-preferences/index.js";
15
15
  import { J as jr } from "./bookmark-state-BEl_G9vr.js";
16
- import { l as Fr, m as We, c as wt, A as Ue, d as qa } from "./context-R31TSL5V.js";
17
- import { p as Gt, a as Lr, A as Va } from "./saved-dashboard-context-AChHk4tw.js";
18
- import { fL as Br, o as Ur, fM as Yt } from "./resolve-dashboard-input-context-DBFuNhZo.js";
19
- import { u as Za, i as zr } from "./report-preferences-dialog-RN4g9PEN.js";
20
- import { m as qr } from "./stored-dashboard-rpLzf4mk.js";
16
+ import { n as Fr, o as We, c as wt, A as Ue, d as qa } from "./context-BTLBjQNh.js";
17
+ import { p as Gt, a as Lr, A as Va } from "./saved-dashboard-context-LiDPCJ3r.js";
18
+ import { fL as Br, o as Ur, fM as Yt } from "./resolve-dashboard-input-context-DoZHMivF.js";
19
+ import { u as Za, i as zr } from "./report-preferences-dialog-CcekIvkV.js";
20
+ import { m as qr } from "./stored-dashboard-CjnPEWO-.js";
21
21
  import { w as Vr, c as Ja } from "./visual-choice-JiJ-_3bi.js";
22
- import { m as Zr, v as Ka, t as Jr, r as Wa, k as de, d as Kr, b as Wr, l as Rt, o as Hr, w as Gr, h as Yr, s as Nt, f as Qr, a as Xr } from "./add-to-dashboard-B6Ah8Lub.js";
23
- import { safeParseAsync as en, lazy as tn, unknown as an, union as sn, string as rn, record as nn, object as on, number as ln, null as dn, never as cn, looseObject as un, literal as pn, instanceof as mn, enum as fn, discriminatedUnion as hn, custom as gn, boolean as yn, array as bn } from "zod/v4";
24
- import { toJSONSchema as vn } from "zod/v4/core";
25
- import { aI as xn, aJ as wn, aK as Nn, aL as at, aM as In, aN as Qt, aO as Xt, aP as ea, aQ as ta, aR as aa, aS as Sn, ad as An, ab as Cn } from "./temporal-input-presentation-CqbJjIuu.js";
26
- import { L as En } from "./list-filter-C1-uTgjR.js";
22
+ import { n as Zr, v as Ka, t as Jr, u as Wa, l as de, d as Kr, b as Wr, m as Rt, p as Hr, w as Gr, h as Yr, j as Qr, s as Nt, f as Xr, a as en } from "./add-to-dashboard-DQFuDA5R.js";
23
+ import { safeParseAsync as tn, lazy as an, unknown as sn, union as rn, string as nn, record as on, object as ln, number as dn, null as cn, never as un, looseObject as pn, literal as mn, instanceof as fn, enum as hn, discriminatedUnion as gn, custom as yn, boolean as bn, array as vn } from "zod/v4";
24
+ import { toJSONSchema as xn } from "zod/v4/core";
25
+ import { aI as wn, aJ as Nn, aK as In, aL as at, aM as Sn, aN as Qt, aO as Xt, aP as ea, aQ as ta, aR as aa, aS as An, ad as Cn, ab as En } from "./temporal-input-presentation-CqbJjIuu.js";
26
+ import { L as Tn } from "./list-filter-C1-uTgjR.js";
27
27
  import { L as sa } from "./layout-grid-8rR-LPTk.js";
28
- function Tn(e, t, a) {
29
- const s = xn(), r = (a == null ? void 0 : a.locale) ?? s.locale ?? wn, l = Nn(e, t);
28
+ function Mn(e, t, a) {
29
+ const s = wn(), r = (a == null ? void 0 : a.locale) ?? s.locale ?? Nn, l = In(e, t);
30
30
  if (isNaN(l))
31
31
  throw new RangeError("Invalid time value");
32
32
  const i = Object.assign({}, a, {
@@ -35,7 +35,7 @@ function Tn(e, t, a) {
35
35
  });
36
36
  let m, g;
37
37
  l > 0 ? (m = at(t), g = at(e)) : (m = at(e), g = at(t));
38
- const o = In((a == null ? void 0 : a.roundingMethod) ?? "round"), h = g.getTime() - m.getTime(), u = h / aa, p = Qt(g) - Qt(m), x = (h - p) / aa, C = a == null ? void 0 : a.unit;
38
+ const o = Sn((a == null ? void 0 : a.roundingMethod) ?? "round"), h = g.getTime() - m.getTime(), u = h / aa, p = Qt(g) - Qt(m), x = (h - p) / aa, C = a == null ? void 0 : a.unit;
39
39
  let w;
40
40
  if (C ? w = C : u < 1 ? w = "second" : u < 60 ? w = "minute" : u < Xt ? w = "hour" : x < ea ? w = "day" : x < ta ? w = "month" : w = "year", w === "second") {
41
41
  const A = o(h / 1e3);
@@ -57,8 +57,8 @@ function Tn(e, t, a) {
57
57
  return r.formatDistance("xYears", A, i);
58
58
  }
59
59
  }
60
- function Mn(e, t) {
61
- return Tn(e, Sn(e), t);
60
+ function kn(e, t) {
61
+ return Mn(e, An(e), t);
62
62
  }
63
63
  /**
64
64
  * @license lucide-react v0.453.0 - ISC
@@ -66,7 +66,7 @@ function Mn(e, t) {
66
66
  * This source code is licensed under the ISC license.
67
67
  * See the LICENSE file in the root directory of this source tree.
68
68
  */
69
- const kn = Re("AppWindow", [
69
+ const _n = Re("AppWindow", [
70
70
  ["rect", { x: "2", y: "4", width: "20", height: "16", rx: "2", key: "izxlao" }],
71
71
  ["path", { d: "M10 4v4", key: "pp8u80" }],
72
72
  ["path", { d: "M2 8h20", key: "d11cs7" }],
@@ -78,7 +78,7 @@ const kn = Re("AppWindow", [
78
78
  * This source code is licensed under the ISC license.
79
79
  * See the LICENSE file in the root directory of this source tree.
80
80
  */
81
- const _n = Re("CornerDownLeft", [
81
+ const On = Re("CornerDownLeft", [
82
82
  ["polyline", { points: "9 10 4 15 9 20", key: "r3jprv" }],
83
83
  ["path", { d: "M20 4v7a4 4 0 0 1-4 4H4", key: "6o5b7l" }]
84
84
  ]);
@@ -88,7 +88,7 @@ const _n = Re("CornerDownLeft", [
88
88
  * This source code is licensed under the ISC license.
89
89
  * See the LICENSE file in the root directory of this source tree.
90
90
  */
91
- const On = Re("GitMerge", [
91
+ const Rn = Re("GitMerge", [
92
92
  ["circle", { cx: "18", cy: "18", r: "3", key: "1xkwt0" }],
93
93
  ["circle", { cx: "6", cy: "6", r: "3", key: "1lh9wr" }],
94
94
  ["path", { d: "M6 21V9a9 9 0 0 0 9 9", key: "7kw0sc" }]
@@ -99,7 +99,7 @@ const On = Re("GitMerge", [
99
99
  * This source code is licensed under the ISC license.
100
100
  * See the LICENSE file in the root directory of this source tree.
101
101
  */
102
- const Rn = Re("ListTree", [
102
+ const Pn = Re("ListTree", [
103
103
  ["path", { d: "M21 12h-8", key: "1bmf0i" }],
104
104
  ["path", { d: "M21 6H8", key: "1pqkrb" }],
105
105
  ["path", { d: "M21 18h-8", key: "1tm79t" }],
@@ -112,7 +112,7 @@ const Rn = Re("ListTree", [
112
112
  * This source code is licensed under the ISC license.
113
113
  * See the LICENSE file in the root directory of this source tree.
114
114
  */
115
- const Pn = Re("PanelLeft", [
115
+ const Dn = Re("PanelLeft", [
116
116
  ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
117
117
  ["path", { d: "M9 3v18", key: "fh3hqa" }]
118
118
  ]);
@@ -132,7 +132,7 @@ const Ha = Re("PanelRight", [
132
132
  * This source code is licensed under the ISC license.
133
133
  * See the LICENSE file in the root directory of this source tree.
134
134
  */
135
- const Dn = Re("Route", [
135
+ const $n = Re("Route", [
136
136
  ["circle", { cx: "6", cy: "19", r: "3", key: "1kj8tv" }],
137
137
  ["path", { d: "M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15", key: "1d8sl" }],
138
138
  ["circle", { cx: "18", cy: "5", r: "3", key: "gq8acd" }]
@@ -142,7 +142,7 @@ class Ga extends Error {
142
142
  super("The dashboard is still loading."), this.name = "AssistantContextNotReadyError";
143
143
  }
144
144
  }
145
- function $n(e = "dashboard") {
145
+ function jn(e = "dashboard") {
146
146
  let t;
147
147
  return e === "none" ? () => {
148
148
  const a = Br();
@@ -193,7 +193,7 @@ function $n(e = "dashboard") {
193
193
  function ra(e, t) {
194
194
  return e.length === t.length && e.every((a, s) => Object.is(a, t[s]));
195
195
  }
196
- function jn(e) {
196
+ function Fn(e) {
197
197
  const { canChange: t, canChangeNow: a } = Za(e.surface === "dashboard"), s = W((o) => {
198
198
  var u, p;
199
199
  const h = (p = (u = o.dashboard) == null ? void 0 : u.sheets) == null ? void 0 : p.find((x) => x.id === o.selectedSheetId);
@@ -204,17 +204,17 @@ function jn(e) {
204
204
  var I, M;
205
205
  const u = W.getState(), p = (I = u.dashboard) == null ? void 0 : I.id, x = u.selectedSheetId;
206
206
  if (!p || !x) throw new Ze(pt);
207
- const C = { title: o.title, type: Zr[h], ...o.card }, w = !Ln({ ...C, id: "check" }, o, h), A = { ...C, ...w ? { type: "table" } : {}, id: Yt() }, k = { id: Yt(), cards: [A], activeCardId: A.id }, T = await i(k, { reuseLoaded: !0 }).catch((F) => {
207
+ const C = { title: o.title, type: Zr[h], ...o.card }, w = !Bn({ ...C, id: "check" }, o, h), A = { ...C, ...w ? { type: "table" } : {}, id: Yt() }, k = { id: Yt(), cards: [A], activeCardId: A.id }, T = await i(k, { reuseLoaded: !0 }).catch((F) => {
208
208
  console.warn("Adding the result without refreshed semantic metadata:", F);
209
209
  }), N = structuredClone(W.getState().semanticExecutionPayload);
210
210
  tr(N, T);
211
211
  const c = Vr(
212
212
  A.config ?? {},
213
- Bn(A, x, N, l)
213
+ Un(A, x, N, l)
214
214
  ), y = c === (A.config ?? {}) ? k : { ...k, cards: [{ ...A, config: c }] }, f = W.getState();
215
215
  if (((M = f.dashboard) == null ? void 0 : M.id) !== p || f.selectedSheetId !== x || f.isVisualEditing)
216
216
  throw new Ze(pt);
217
- if (!a()) throw new Ze(Fn);
217
+ if (!a()) throw new Ze(Ln);
218
218
  const { actions: b } = f;
219
219
  if (b.setIsDashboardEditing(!0), b.addFrame(x, y, { semanticExecutionPayload: T }), !Ya(W.getState().dashboard, y.id))
220
220
  throw f.isDashboardEditing || b.setIsDashboardEditing(!1), new Ze(pt);
@@ -223,8 +223,8 @@ function jn(e) {
223
223
  [a, i, l]
224
224
  ), available: t && s && !r };
225
225
  }
226
- const pt = "The dashboard changed while this was being added. Try again.", Fn = "Changes to this dashboard can't be saved here, so the card wasn't added.";
227
- function Ln(e, t, a) {
226
+ const pt = "The dashboard changed while this was being added. Try again.", Ln = "Changes to this dashboard can't be saved here, so the card wasn't added.";
227
+ function Bn(e, t, a) {
228
228
  if (a !== "line" && a !== "bar" && a !== "stackedBar") return !0;
229
229
  const s = Ja(Ka(t), a);
230
230
  if (!s.ok) return !1;
@@ -243,7 +243,7 @@ function Ya(e, t) {
243
243
  return (r = s.frames) == null ? void 0 : r.some((l) => l.id === t);
244
244
  }));
245
245
  }
246
- function Bn(e, t, a, s) {
246
+ function Un(e, t, a, s) {
247
247
  var i;
248
248
  const r = sr(W.getState()), l = qr({
249
249
  ...r,
@@ -258,7 +258,7 @@ function Bn(e, t, a, s) {
258
258
  (m) => m.dateOwner !== "global_date"
259
259
  );
260
260
  }
261
- const Qa = "vercel.ai.error", Un = Symbol.for(Qa);
261
+ const Qa = "vercel.ai.error", zn = Symbol.for(Qa);
262
262
  var G = class Xa extends Error {
263
263
  /**
264
264
  * Creates an AI SDK Error.
@@ -269,7 +269,7 @@ var G = class Xa extends Error {
269
269
  * @param {unknown} [params.cause] - The underlying cause of the error.
270
270
  */
271
271
  constructor({ name: t, message: a, cause: s }) {
272
- super(a), this[Un] = !0, this.name = t, this.cause = s;
272
+ super(a), this[zn] = !0, this.name = t, this.cause = s;
273
273
  }
274
274
  /**
275
275
  * Checks if the given error is an AI SDK Error.
@@ -284,26 +284,26 @@ var G = class Xa extends Error {
284
284
  return t != null && typeof t == "object" && s in t && typeof t[s] == "boolean" && t[s] === !0;
285
285
  }
286
286
  };
287
- const es = "AI_APICallError", ts = `vercel.ai.error.${es}`, zn = Symbol.for(ts);
288
- var qn = class extends G {
287
+ const es = "AI_APICallError", ts = `vercel.ai.error.${es}`, qn = Symbol.for(ts);
288
+ var Vn = class extends G {
289
289
  constructor({ message: e, url: t, requestBodyValues: a, statusCode: s, responseHeaders: r, responseBody: l, cause: i, isRetryable: m = s != null && (s === 408 || s === 409 || s === 429 || s >= 500), data: g }) {
290
290
  super({
291
291
  name: es,
292
292
  message: e,
293
293
  cause: i
294
- }), this[zn] = !0, this.url = t, this.requestBodyValues = a, this.statusCode = s, this.responseHeaders = r, this.responseBody = l, this.isRetryable = m, this.data = g;
294
+ }), this[qn] = !0, this.url = t, this.requestBodyValues = a, this.statusCode = s, this.responseHeaders = r, this.responseBody = l, this.isRetryable = m, this.data = g;
295
295
  }
296
296
  static isInstance(e) {
297
297
  return G.hasMarker(e, ts);
298
298
  }
299
299
  };
300
- const as = "AI_EmptyResponseBodyError", ss = `vercel.ai.error.${as}`, Vn = Symbol.for(ss);
300
+ const as = "AI_EmptyResponseBodyError", ss = `vercel.ai.error.${as}`, Zn = Symbol.for(ss);
301
301
  var na = class extends G {
302
302
  constructor({ message: e = "Empty response body" } = {}) {
303
303
  super({
304
304
  name: as,
305
305
  message: e
306
- }), this[Vn] = !0;
306
+ }), this[Zn] = !0;
307
307
  }
308
308
  static isInstance(e) {
309
309
  return G.hasMarker(e, ss);
@@ -312,20 +312,20 @@ var na = class extends G {
312
312
  function rs(e) {
313
313
  return e == null ? "unknown error" : typeof e == "string" ? e : e instanceof Error ? e.toString() : JSON.stringify(e);
314
314
  }
315
- const ns = "AI_InvalidArgumentError", os = `vercel.ai.error.${ns}`, Zn = Symbol.for(os);
316
- var Jn = class extends G {
315
+ const ns = "AI_InvalidArgumentError", os = `vercel.ai.error.${ns}`, Jn = Symbol.for(os);
316
+ var Kn = class extends G {
317
317
  constructor({ message: t, cause: a, argument: s }) {
318
318
  super({
319
319
  name: ns,
320
320
  message: t,
321
321
  cause: a
322
- }), this[Zn] = !0, this.argument = s;
322
+ }), this[Jn] = !0, this.argument = s;
323
323
  }
324
324
  static isInstance(t) {
325
325
  return G.hasMarker(t, os);
326
326
  }
327
327
  };
328
- const is = "AI_JSONParseError", ls = `vercel.ai.error.${is}`, Kn = Symbol.for(ls);
328
+ const is = "AI_JSONParseError", ls = `vercel.ai.error.${is}`, Wn = Symbol.for(ls);
329
329
  var oa = class extends G {
330
330
  constructor({ text: e, cause: t }) {
331
331
  super({
@@ -333,13 +333,13 @@ var oa = class extends G {
333
333
  message: `JSON parsing failed: Text: ${e}.
334
334
  Error message: ${rs(t)}`,
335
335
  cause: t
336
- }), this[Kn] = !0, this.text = e;
336
+ }), this[Wn] = !0, this.text = e;
337
337
  }
338
338
  static isInstance(e) {
339
339
  return G.hasMarker(e, ls);
340
340
  }
341
341
  };
342
- const ds = "AI_TypeValidationError", cs = `vercel.ai.error.${ds}`, Wn = Symbol.for(cs);
342
+ const ds = "AI_TypeValidationError", cs = `vercel.ai.error.${ds}`, Hn = Symbol.for(cs);
343
343
  var ot = class It extends G {
344
344
  constructor({ value: t, cause: a, context: s }) {
345
345
  let r = "Type validation failed";
@@ -353,7 +353,7 @@ var ot = class It extends G {
353
353
  message: `${r}: Value: ${JSON.stringify(t)}.
354
354
  Error message: ${rs(a)}`,
355
355
  cause: a
356
- }), this[Wn] = !0, this.value = t, this.context = s;
356
+ }), this[Hn] = !0, this.value = t, this.context = s;
357
357
  }
358
358
  static isInstance(t) {
359
359
  return G.hasMarker(t, cs);
@@ -378,13 +378,13 @@ Error message: ${rs(a)}`,
378
378
  });
379
379
  }
380
380
  };
381
- const us = "AI_UnsupportedFunctionalityError", ps = `vercel.ai.error.${us}`, Hn = Symbol.for(ps);
382
- var Gn = class extends G {
381
+ const us = "AI_UnsupportedFunctionalityError", ps = `vercel.ai.error.${us}`, Gn = Symbol.for(ps);
382
+ var Yn = class extends G {
383
383
  constructor({ functionality: e, message: t = `'${e}' functionality not supported.` }) {
384
384
  super({
385
385
  name: us,
386
386
  message: t
387
- }), this[Hn] = !0, this.functionality = e;
387
+ }), this[Gn] = !0, this.functionality = e;
388
388
  }
389
389
  static isInstance(e) {
390
390
  return G.hasMarker(e, ps);
@@ -395,10 +395,10 @@ class mt extends Error {
395
395
  super(t), this.name = "ParseError", this.type = a.type, this.field = a.field, this.value = a.value, this.line = a.line;
396
396
  }
397
397
  }
398
- const ia = 10, Yn = 13, Ie = 32;
398
+ const ia = 10, Qn = 13, Ie = 32;
399
399
  function ft(e) {
400
400
  }
401
- function Qn(e) {
401
+ function Xn(e) {
402
402
  if (typeof e == "function")
403
403
  throw new TypeError(
404
404
  "`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?"
@@ -469,7 +469,7 @@ ${F}`, u++;
469
469
  let M = -1;
470
470
  if (b !== -1 && I !== -1 ? M = b < I ? b : I : b !== -1 ? b === y.length - 1 ? M = -1 : M = b : I !== -1 && (M = I), M === -1)
471
471
  break;
472
- k(y, f, M), f = M + 1, y.charCodeAt(f - 1) === Yn && y.charCodeAt(f) === ia && f++;
472
+ k(y, f, M), f = M + 1, y.charCodeAt(f - 1) === Qn && y.charCodeAt(f) === ia && f++;
473
473
  }
474
474
  return y.slice(f);
475
475
  }
@@ -562,12 +562,12 @@ function la(e, t, a) {
562
562
  function da(e, t, a) {
563
563
  return a === 101 && e.charCodeAt(t + 1) === 118 && e.charCodeAt(t + 2) === 101 && e.charCodeAt(t + 3) === 110 && e.charCodeAt(t + 4) === 116 && e.charCodeAt(t + 5) === 58;
564
564
  }
565
- class Xn extends TransformStream {
565
+ class eo extends TransformStream {
566
566
  constructor({ onError: t, onRetry: a, onComment: s, maxBufferSize: r } = {}) {
567
567
  let l;
568
568
  super({
569
569
  start(i) {
570
- l = Qn({
570
+ l = Xn({
571
571
  onEvent: (m) => {
572
572
  i.enqueue(m);
573
573
  },
@@ -605,22 +605,22 @@ const Y = ({ prefix: e, size: t = 16, alphabet: a = "0123456789ABCDEFGHIJKLMNOPQ
605
605
  return i.join("");
606
606
  };
607
607
  if (e == null) return r;
608
- if (a.includes(s)) throw new Jn({
608
+ if (a.includes(s)) throw new Kn({
609
609
  argument: "separator",
610
610
  message: `The separator "${s}" must not be part of the alphabet "${a}".`
611
611
  });
612
612
  return () => `${e}${s}${r()}`;
613
- }, eo = Y();
614
- function to(e) {
613
+ }, to = Y();
614
+ function ao(e) {
615
615
  var t;
616
616
  return ((t = globalThis.Buffer) == null ? void 0 : t.isBuffer(e)) ?? !1;
617
617
  }
618
- const ao = /"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/, so = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;
618
+ const so = /"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/, ro = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;
619
619
  function ca(e) {
620
620
  const t = JSON.parse(e);
621
- return t === null || typeof t != "object" || ao.test(e) === !1 && so.test(e) === !1 ? t : ro(t);
621
+ return t === null || typeof t != "object" || so.test(e) === !1 && ro.test(e) === !1 ? t : no(t);
622
622
  }
623
- function ro(e) {
623
+ function no(e) {
624
624
  let t = [e];
625
625
  for (; t.length; ) {
626
626
  const a = t;
@@ -636,7 +636,7 @@ function ro(e) {
636
636
  }
637
637
  return e;
638
638
  }
639
- function no(e) {
639
+ function oo(e) {
640
640
  const { stackTraceLimit: t } = Error;
641
641
  try {
642
642
  Error.stackTraceLimit = 0;
@@ -664,7 +664,7 @@ function Pt(e) {
664
664
  function he(e) {
665
665
  return typeof e == "boolean" ? e : Pt(e);
666
666
  }
667
- const oo = Symbol("Let zodToJsonSchema decide on which parser to use"), ua = {
667
+ const io = Symbol("Let zodToJsonSchema decide on which parser to use"), ua = {
668
668
  name: void 0,
669
669
  $refStrategy: "root",
670
670
  basePath: ["#"],
@@ -684,7 +684,7 @@ const oo = Symbol("Let zodToJsonSchema decide on which parser to use"), ua = {
684
684
  emailStrategy: "format:email",
685
685
  base64Strategy: "contentEncoding:base64",
686
686
  nameStrategy: "ref"
687
- }, io = (e) => typeof e == "string" ? {
687
+ }, lo = (e) => typeof e == "string" ? {
688
688
  ...ua,
689
689
  name: e
690
690
  } : {
@@ -694,7 +694,7 @@ const oo = Symbol("Let zodToJsonSchema decide on which parser to use"), ua = {
694
694
  function se() {
695
695
  return {};
696
696
  }
697
- function lo(e, t) {
697
+ function co(e, t) {
698
698
  var s, r, l;
699
699
  const a = { type: "array" };
700
700
  return (s = e.type) != null && s._def && ((l = (r = e.type) == null ? void 0 : r._def) == null ? void 0 : l.typeName) !== "ZodAny" && (a.items = j(e.type._def, {
@@ -702,7 +702,7 @@ function lo(e, t) {
702
702
  currentPath: [...t.currentPath, "items"]
703
703
  })), e.minLength && (a.minItems = e.minLength.value), e.maxLength && (a.maxItems = e.maxLength.value), e.exactLength && (a.minItems = e.exactLength.value, a.maxItems = e.exactLength.value), a;
704
704
  }
705
- function co(e) {
705
+ function uo(e) {
706
706
  const t = {
707
707
  type: "integer",
708
708
  format: "int64"
@@ -720,13 +720,13 @@ function co(e) {
720
720
  }
721
721
  return t;
722
722
  }
723
- function uo() {
723
+ function po() {
724
724
  return { type: "boolean" };
725
725
  }
726
726
  function ms(e, t) {
727
727
  return j(e.type._def, t);
728
728
  }
729
- const po = (e, t) => j(e.innerType._def, t);
729
+ const mo = (e, t) => j(e.innerType._def, t);
730
730
  function fs(e, t, a) {
731
731
  const s = a ?? t.dateStrategy;
732
732
  if (Array.isArray(s)) return { anyOf: s.map((r) => fs(e, t, r)) };
@@ -743,10 +743,10 @@ function fs(e, t, a) {
743
743
  format: "date"
744
744
  };
745
745
  case "integer":
746
- return mo(e);
746
+ return fo(e);
747
747
  }
748
748
  }
749
- const mo = (e) => {
749
+ const fo = (e) => {
750
750
  const t = {
751
751
  type: "integer",
752
752
  format: "unix-time"
@@ -760,23 +760,23 @@ const mo = (e) => {
760
760
  }
761
761
  return t;
762
762
  };
763
- function fo(e, t) {
763
+ function ho(e, t) {
764
764
  return {
765
765
  ...j(e.innerType._def, t),
766
766
  default: e.defaultValue()
767
767
  };
768
768
  }
769
- function ho(e, t) {
769
+ function go(e, t) {
770
770
  return t.effectStrategy === "input" ? j(e.schema._def, t) : se();
771
771
  }
772
- function go(e) {
772
+ function yo(e) {
773
773
  return {
774
774
  type: "string",
775
775
  enum: Array.from(e.values)
776
776
  };
777
777
  }
778
- const yo = (e) => "type" in e && e.type === "string" ? !1 : "allOf" in e;
779
- function bo(e, t) {
778
+ const bo = (e) => "type" in e && e.type === "string" ? !1 : "allOf" in e;
779
+ function vo(e, t) {
780
780
  const a = [j(e.left._def, {
781
781
  ...t,
782
782
  currentPath: [
@@ -793,7 +793,7 @@ function bo(e, t) {
793
793
  ]
794
794
  })].filter((r) => !!r), s = [];
795
795
  return a.forEach((r) => {
796
- if (yo(r)) s.push(...r.allOf);
796
+ if (bo(r)) s.push(...r.allOf);
797
797
  else {
798
798
  let l = r;
799
799
  if ("additionalProperties" in r && r.additionalProperties === !1) {
@@ -804,7 +804,7 @@ function bo(e, t) {
804
804
  }
805
805
  }), s.length ? { allOf: s } : void 0;
806
806
  }
807
- function vo(e) {
807
+ function xo(e) {
808
808
  const t = typeof e.value;
809
809
  return t !== "bigint" && t !== "number" && t !== "boolean" && t !== "string" ? { type: Array.isArray(e.value) ? "array" : "object" } : {
810
810
  type: t === "bigint" ? "integer" : t,
@@ -950,13 +950,13 @@ function hs(e, t) {
950
950
  return a;
951
951
  }
952
952
  function gt(e, t) {
953
- return t.patternStrategy === "escape" ? wo(e) : e;
953
+ return t.patternStrategy === "escape" ? No(e) : e;
954
954
  }
955
- const xo = /* @__PURE__ */ new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
956
- function wo(e) {
955
+ const wo = /* @__PURE__ */ new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
956
+ function No(e) {
957
957
  let t = "";
958
958
  for (let a = 0; a < e.length; a++)
959
- xo.has(e[a]) || (t += "\\"), t += e[a];
959
+ wo.has(e[a]) || (t += "\\"), t += e[a];
960
960
  return t;
961
961
  }
962
962
  function ie(e, t, a, s) {
@@ -1054,7 +1054,7 @@ function gs(e, t) {
1054
1054
  }
1055
1055
  return a;
1056
1056
  }
1057
- function No(e, t) {
1057
+ function Io(e, t) {
1058
1058
  return t.mapStrategy === "record" ? gs(e, t) : {
1059
1059
  type: "array",
1060
1060
  maxItems: 125,
@@ -1082,17 +1082,17 @@ function No(e, t) {
1082
1082
  }
1083
1083
  };
1084
1084
  }
1085
- function Io(e) {
1085
+ function So(e) {
1086
1086
  const t = e.values, a = Object.keys(e.values).filter((r) => typeof t[t[r]] != "number").map((r) => t[r]), s = Array.from(new Set(a.map((r) => typeof r)));
1087
1087
  return {
1088
1088
  type: s.length === 1 ? s[0] === "string" ? "string" : "number" : ["string", "number"],
1089
1089
  enum: a
1090
1090
  };
1091
1091
  }
1092
- function So() {
1092
+ function Ao() {
1093
1093
  return { not: se() };
1094
1094
  }
1095
- function Ao() {
1095
+ function Co() {
1096
1096
  return { type: "null" };
1097
1097
  }
1098
1098
  const St = {
@@ -1102,7 +1102,7 @@ const St = {
1102
1102
  ZodBoolean: "boolean",
1103
1103
  ZodNull: "null"
1104
1104
  };
1105
- function Co(e, t) {
1105
+ function Eo(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 St && (!s._def.checks || !s._def.checks.length))) {
1108
1108
  const s = a.reduce((r, l) => {
@@ -1137,9 +1137,9 @@ function Co(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 Eo(e, t);
1140
+ return To(e, t);
1141
1141
  }
1142
- const Eo = (e, t) => {
1142
+ const To = (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: [
@@ -1150,7 +1150,7 @@ const Eo = (e, t) => {
1150
1150
  })).filter((s) => !!s && (!t.strictUnions || typeof s == "object" && Object.keys(s).length > 0));
1151
1151
  return a.length ? { anyOf: a } : void 0;
1152
1152
  };
1153
- function To(e, t) {
1153
+ function Mo(e, t) {
1154
1154
  if ([
1155
1155
  "ZodString",
1156
1156
  "ZodNumber",
@@ -1168,7 +1168,7 @@ function To(e, t) {
1168
1168
  });
1169
1169
  return a && { anyOf: [a, { type: "null" }] };
1170
1170
  }
1171
- function Mo(e) {
1171
+ function ko(e) {
1172
1172
  const t = { type: "number" };
1173
1173
  if (!e.checks) return t;
1174
1174
  for (const a of e.checks) switch (a.kind) {
@@ -1186,7 +1186,7 @@ function Mo(e) {
1186
1186
  }
1187
1187
  return t;
1188
1188
  }
1189
- function ko(e, t) {
1189
+ function _o(e, t) {
1190
1190
  const a = {
1191
1191
  type: "object",
1192
1192
  properties: {}
@@ -1194,7 +1194,7 @@ function ko(e, t) {
1194
1194
  for (const i in r) {
1195
1195
  let m = r[i];
1196
1196
  if (m === void 0 || m._def === void 0) continue;
1197
- const g = Oo(m), o = j(m._def, {
1197
+ const g = Ro(m), o = j(m._def, {
1198
1198
  ...t,
1199
1199
  currentPath: [
1200
1200
  ...t.currentPath,
@@ -1210,10 +1210,10 @@ function ko(e, t) {
1210
1210
  o !== void 0 && (a.properties[i] = o, g || s.push(i));
1211
1211
  }
1212
1212
  s.length && (a.required = s);
1213
- const l = _o(e, t);
1213
+ const l = Oo(e, t);
1214
1214
  return l !== void 0 && (a.additionalProperties = l), a;
1215
1215
  }
1216
- function _o(e, t) {
1216
+ function Oo(e, t) {
1217
1217
  if (e.catchall._def.typeName !== "ZodNever") return j(e.catchall._def, {
1218
1218
  ...t,
1219
1219
  currentPath: [...t.currentPath, "additionalProperties"]
@@ -1227,14 +1227,14 @@ function _o(e, t) {
1227
1227
  return t.removeAdditionalStrategy === "strict" ? t.allowedAdditionalProperties : t.rejectedAdditionalProperties;
1228
1228
  }
1229
1229
  }
1230
- function Oo(e) {
1230
+ function Ro(e) {
1231
1231
  try {
1232
1232
  return e.isOptional();
1233
1233
  } catch {
1234
1234
  return !0;
1235
1235
  }
1236
1236
  }
1237
- const Ro = (e, t) => {
1237
+ const Po = (e, t) => {
1238
1238
  var s;
1239
1239
  if (t.currentPath.toString() === ((s = t.propertyPath) == null ? void 0 : s.toString())) return j(e.innerType._def, t);
1240
1240
  const a = j(e.innerType._def, {
@@ -1246,7 +1246,7 @@ const Ro = (e, t) => {
1246
1246
  ]
1247
1247
  });
1248
1248
  return a ? { anyOf: [{ not: se() }, a] } : se();
1249
- }, Po = (e, t) => {
1249
+ }, Do = (e, t) => {
1250
1250
  if (t.pipeStrategy === "input") return j(e.in._def, t);
1251
1251
  if (t.pipeStrategy === "output") return j(e.out._def, t);
1252
1252
  const a = j(e.in._def, {
@@ -1266,10 +1266,10 @@ const Ro = (e, t) => {
1266
1266
  ]
1267
1267
  })].filter((s) => s !== void 0) };
1268
1268
  };
1269
- function Do(e, t) {
1269
+ function $o(e, t) {
1270
1270
  return j(e.type._def, t);
1271
1271
  }
1272
- function $o(e, t) {
1272
+ function jo(e, t) {
1273
1273
  const a = {
1274
1274
  type: "array",
1275
1275
  uniqueItems: !0,
@@ -1280,7 +1280,7 @@ function $o(e, t) {
1280
1280
  };
1281
1281
  return e.minSize && (a.minItems = e.minSize.value), e.maxSize && (a.maxItems = e.maxSize.value), a;
1282
1282
  }
1283
- function jo(e, t) {
1283
+ function Fo(e, t) {
1284
1284
  return e.rest ? {
1285
1285
  type: "array",
1286
1286
  minItems: e.items.length,
@@ -1310,78 +1310,78 @@ function jo(e, t) {
1310
1310
  })).reduce((a, s) => s === void 0 ? a : [...a, s], [])
1311
1311
  };
1312
1312
  }
1313
- function Fo() {
1313
+ function Lo() {
1314
1314
  return { not: se() };
1315
1315
  }
1316
- function Lo() {
1316
+ function Bo() {
1317
1317
  return se();
1318
1318
  }
1319
- const Bo = (e, t) => j(e.innerType._def, t), Uo = (e, t, a) => {
1319
+ const Uo = (e, t) => j(e.innerType._def, t), zo = (e, t, a) => {
1320
1320
  switch (t) {
1321
1321
  case "ZodString":
1322
1322
  return hs(e, a);
1323
1323
  case "ZodNumber":
1324
- return Mo(e);
1324
+ return ko(e);
1325
1325
  case "ZodObject":
1326
- return ko(e, a);
1326
+ return _o(e, a);
1327
1327
  case "ZodBigInt":
1328
- return co(e);
1328
+ return uo(e);
1329
1329
  case "ZodBoolean":
1330
- return uo();
1330
+ return po();
1331
1331
  case "ZodDate":
1332
1332
  return fs(e, a);
1333
1333
  case "ZodUndefined":
1334
- return Fo();
1334
+ return Lo();
1335
1335
  case "ZodNull":
1336
- return Ao();
1336
+ return Co();
1337
1337
  case "ZodArray":
1338
- return lo(e, a);
1338
+ return co(e, a);
1339
1339
  case "ZodUnion":
1340
1340
  case "ZodDiscriminatedUnion":
1341
- return Co(e, a);
1341
+ return Eo(e, a);
1342
1342
  case "ZodIntersection":
1343
- return bo(e, a);
1343
+ return vo(e, a);
1344
1344
  case "ZodTuple":
1345
- return jo(e, a);
1345
+ return Fo(e, a);
1346
1346
  case "ZodRecord":
1347
1347
  return gs(e, a);
1348
1348
  case "ZodLiteral":
1349
- return vo(e);
1349
+ return xo(e);
1350
1350
  case "ZodEnum":
1351
- return go(e);
1351
+ return yo(e);
1352
1352
  case "ZodNativeEnum":
1353
- return Io(e);
1353
+ return So(e);
1354
1354
  case "ZodNullable":
1355
- return To(e, a);
1355
+ return Mo(e, a);
1356
1356
  case "ZodOptional":
1357
- return Ro(e, a);
1357
+ return Po(e, a);
1358
1358
  case "ZodMap":
1359
- return No(e, a);
1359
+ return Io(e, a);
1360
1360
  case "ZodSet":
1361
- return $o(e, a);
1361
+ return jo(e, a);
1362
1362
  case "ZodLazy":
1363
1363
  return () => e.getter()._def;
1364
1364
  case "ZodPromise":
1365
- return Do(e, a);
1365
+ return $o(e, a);
1366
1366
  case "ZodNaN":
1367
1367
  case "ZodNever":
1368
- return So();
1368
+ return Ao();
1369
1369
  case "ZodEffects":
1370
- return ho(e, a);
1370
+ return go(e, a);
1371
1371
  case "ZodAny":
1372
1372
  return se();
1373
1373
  case "ZodUnknown":
1374
- return Lo();
1374
+ return Bo();
1375
1375
  case "ZodDefault":
1376
- return fo(e, a);
1376
+ return ho(e, a);
1377
1377
  case "ZodBranded":
1378
1378
  return ms(e, a);
1379
1379
  case "ZodReadonly":
1380
- return Bo(e, a);
1380
+ return Uo(e, a);
1381
1381
  case "ZodCatch":
1382
- return po(e, a);
1382
+ return mo(e, a);
1383
1383
  case "ZodPipeline":
1384
- return Po(e, a);
1384
+ return Do(e, a);
1385
1385
  case "ZodFunction":
1386
1386
  case "ZodVoid":
1387
1387
  case "ZodSymbol":
@@ -1390,7 +1390,7 @@ const Bo = (e, t) => j(e.innerType._def, t), Uo = (e, t, a) => {
1390
1390
  return /* @__PURE__ */ ((s) => {
1391
1391
  })();
1392
1392
  }
1393
- }, zo = (e, t) => {
1393
+ }, qo = (e, t) => {
1394
1394
  let a = 0;
1395
1395
  for (; a < e.length && a < t.length && e[a] === t[a]; a++) ;
1396
1396
  return [(e.length - a).toString(), ...t.slice(a)].join("/");
@@ -1400,10 +1400,10 @@ function j(e, t, a = !1) {
1400
1400
  const s = t.seen.get(e);
1401
1401
  if (t.override) {
1402
1402
  const g = (m = t.override) == null ? void 0 : m.call(t, e, t, s, a);
1403
- if (g !== oo) return g;
1403
+ if (g !== io) return g;
1404
1404
  }
1405
1405
  if (s && !a) {
1406
- const g = qo(s, t);
1406
+ const g = Vo(s, t);
1407
1407
  if (g !== void 0) return g;
1408
1408
  }
1409
1409
  const r = {
@@ -1412,25 +1412,25 @@ function j(e, t, a = !1) {
1412
1412
  jsonSchema: void 0
1413
1413
  };
1414
1414
  t.seen.set(e, r);
1415
- const l = Uo(e, e.typeName, t), i = typeof l == "function" ? j(l(), t) : l;
1416
- if (i && Vo(e, t, i), t.postProcess) {
1415
+ const l = zo(e, e.typeName, t), i = typeof l == "function" ? j(l(), t) : l;
1416
+ if (i && Zo(e, t, i), t.postProcess) {
1417
1417
  const g = t.postProcess(i, e, t);
1418
1418
  return r.jsonSchema = i, g;
1419
1419
  }
1420
1420
  return r.jsonSchema = i, i;
1421
1421
  }
1422
- const qo = (e, t) => {
1422
+ const Vo = (e, t) => {
1423
1423
  switch (t.$refStrategy) {
1424
1424
  case "root":
1425
1425
  return { $ref: e.path.join("/") };
1426
1426
  case "relative":
1427
- return { $ref: zo(t.currentPath, e.path) };
1427
+ return { $ref: qo(t.currentPath, e.path) };
1428
1428
  case "none":
1429
1429
  case "seen":
1430
1430
  return e.path.length < t.currentPath.length && e.path.every((a, s) => t.currentPath[s] === a) ? (console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`), se()) : t.$refStrategy === "seen" ? se() : void 0;
1431
1431
  }
1432
- }, Vo = (e, t, a) => (e.description && (a.description = e.description), a), Zo = (e) => {
1433
- const t = io(e), a = t.name !== void 0 ? [
1432
+ }, Zo = (e, t, a) => (e.description && (a.description = e.description), a), Jo = (e) => {
1433
+ const t = lo(e), a = t.name !== void 0 ? [
1434
1434
  ...t.basePath,
1435
1435
  t.definitionPath,
1436
1436
  t.name
@@ -1449,8 +1449,8 @@ const qo = (e, t) => {
1449
1449
  jsonSchema: void 0
1450
1450
  }]))
1451
1451
  };
1452
- }, Jo = (e, t) => {
1453
- const a = Zo(t);
1452
+ }, Ko = (e, t) => {
1453
+ const a = Jo(t);
1454
1454
  let s = typeof t == "object" && t.definitions ? Object.entries(t.definitions).reduce((g, [o, h]) => ({
1455
1455
  ...g,
1456
1456
  [o]: j(h._def, {
@@ -1487,7 +1487,7 @@ const qo = (e, t) => {
1487
1487
  };
1488
1488
  return m.$schema = "http://json-schema.org/draft-07/schema#", m;
1489
1489
  }, At = Symbol.for("vercel.ai.schema");
1490
- function Ko(e) {
1490
+ function Wo(e) {
1491
1491
  let t;
1492
1492
  return () => (t == null && (t = e()), t);
1493
1493
  }
@@ -1501,19 +1501,19 @@ function dt(e, { validate: t } = {}) {
1501
1501
  validate: t
1502
1502
  };
1503
1503
  }
1504
- function Wo(e) {
1504
+ function Ho(e) {
1505
1505
  return typeof e == "object" && e !== null && At in e && e[At] === !0 && "jsonSchema" in e && "validate" in e;
1506
1506
  }
1507
- function Ho(e) {
1507
+ function Go(e) {
1508
1508
  return e == null ? dt({
1509
1509
  type: "object",
1510
1510
  properties: {},
1511
1511
  additionalProperties: !1
1512
- }) : Wo(e) ? e : "~standard" in e ? e["~standard"].vendor === "zod" ? ys(e) : Go(e) : e();
1512
+ }) : Ho(e) ? e : "~standard" in e ? e["~standard"].vendor === "zod" ? ys(e) : Yo(e) : e();
1513
1513
  }
1514
- function Go(e) {
1514
+ function Yo(e) {
1515
1515
  return dt(() => {
1516
- if (!Yo(e)) throw new Error(`Standard schema vendor '${e["~standard"].vendor}' does not support JSON Schema conversion.`);
1516
+ if (!Qo(e)) throw new Error(`Standard schema vendor '${e["~standard"].vendor}' does not support JSON Schema conversion.`);
1517
1517
  return Pt(e["~standard"].jsonSchema.input({ target: "draft-07" }));
1518
1518
  }, { validate: async (t) => {
1519
1519
  const a = await e["~standard"].validate(t);
@@ -1529,11 +1529,11 @@ function Go(e) {
1529
1529
  };
1530
1530
  } });
1531
1531
  }
1532
- function Yo(e) {
1532
+ function Qo(e) {
1533
1533
  return e["~standard"].jsonSchema != null;
1534
1534
  }
1535
- function Qo(e, t) {
1536
- return dt(() => Jo(e, { $refStrategy: "none" }), { validate: async (a) => {
1535
+ function Xo(e, t) {
1536
+ return dt(() => Ko(e, { $refStrategy: "none" }), { validate: async (a) => {
1537
1537
  const s = await e.safeParseAsync(a);
1538
1538
  return s.success ? {
1539
1539
  success: !0,
@@ -1544,13 +1544,13 @@ function Qo(e, t) {
1544
1544
  };
1545
1545
  } });
1546
1546
  }
1547
- function Xo(e, t) {
1548
- return dt(() => Pt(vn(e, {
1547
+ function ei(e, t) {
1548
+ return dt(() => Pt(xn(e, {
1549
1549
  target: "draft-7",
1550
1550
  io: "input",
1551
1551
  reused: "inline"
1552
1552
  })), { validate: async (a) => {
1553
- const s = await en(e, a);
1553
+ const s = await tn(e, a);
1554
1554
  return s.success ? {
1555
1555
  success: !0,
1556
1556
  value: s.data
@@ -1560,11 +1560,11 @@ function Xo(e, t) {
1560
1560
  };
1561
1561
  } });
1562
1562
  }
1563
- function ei(e) {
1563
+ function ti(e) {
1564
1564
  return "_zod" in e;
1565
1565
  }
1566
1566
  function ys(e, t) {
1567
- return ei(e) ? Xo(e) : Qo(e);
1567
+ return ti(e) ? ei(e) : Xo(e);
1568
1568
  }
1569
1569
  async function ma({ value: e, schema: t, context: a }) {
1570
1570
  const s = await bs({
@@ -1580,7 +1580,7 @@ async function ma({ value: e, schema: t, context: a }) {
1580
1580
  return s.value;
1581
1581
  }
1582
1582
  async function bs({ value: e, schema: t, context: a }) {
1583
- const s = Ho(t);
1583
+ const s = Go(t);
1584
1584
  try {
1585
1585
  if (s.validate == null) return {
1586
1586
  success: !0,
@@ -1615,7 +1615,7 @@ async function bs({ value: e, schema: t, context: a }) {
1615
1615
  }
1616
1616
  async function Ct({ text: e, schema: t }) {
1617
1617
  try {
1618
- const a = no(e);
1618
+ const a = oo(e);
1619
1619
  return t == null ? {
1620
1620
  success: !0,
1621
1621
  value: a,
@@ -1635,8 +1635,8 @@ async function Ct({ text: e, schema: t }) {
1635
1635
  };
1636
1636
  }
1637
1637
  }
1638
- function ti({ stream: e, schema: t }) {
1639
- return e.pipeThrough(new TextDecoderStream()).pipeThrough(new Xn()).pipeThrough(new TransformStream({ async transform({ data: a }, s) {
1638
+ function ai({ stream: e, schema: t }) {
1639
+ return e.pipeThrough(new TextDecoderStream()).pipeThrough(new eo()).pipeThrough(new TransformStream({ async transform({ data: a }, s) {
1640
1640
  a !== "[DONE]" && s.enqueue(await Ct({
1641
1641
  text: a,
1642
1642
  schema: t
@@ -1647,25 +1647,25 @@ async function je(e) {
1647
1647
  return typeof e == "function" && (e = e()), e;
1648
1648
  }
1649
1649
  new TextDecoder();
1650
- const vs = "AI_InvalidArgumentError", xs = `vercel.ai.error.${vs}`, ai = Symbol.for(xs);
1650
+ const vs = "AI_InvalidArgumentError", xs = `vercel.ai.error.${vs}`, si = Symbol.for(xs);
1651
1651
  var nt = class extends G {
1652
1652
  constructor({ parameter: e, value: t, message: a }) {
1653
1653
  super({
1654
1654
  name: vs,
1655
1655
  message: `Invalid argument for parameter ${e}: ${a}`
1656
- }), this[ai] = !0, this.parameter = e, this.value = t;
1656
+ }), this[si] = !0, this.parameter = e, this.value = t;
1657
1657
  }
1658
1658
  static isInstance(e) {
1659
1659
  return G.hasMarker(e, xs);
1660
1660
  }
1661
1661
  };
1662
- const ws = "AI_UIMessageStreamError", Ns = `vercel.ai.error.${ws}`, si = Symbol.for(Ns);
1662
+ const ws = "AI_UIMessageStreamError", Ns = `vercel.ai.error.${ws}`, ri = Symbol.for(Ns);
1663
1663
  var Se = class extends G {
1664
1664
  constructor({ chunkType: e, chunkId: t, message: a }) {
1665
1665
  super({
1666
1666
  name: ws,
1667
1667
  message: a
1668
- }), this[si] = !0, this.chunkType = e, this.chunkId = t;
1668
+ }), this[ri] = !0, this.chunkType = e, this.chunkId = t;
1669
1669
  }
1670
1670
  static isInstance(e) {
1671
1671
  return G.hasMarker(e, Ns);
@@ -1686,23 +1686,23 @@ function Is(e, t) {
1686
1686
  return a;
1687
1687
  }
1688
1688
  const n = {
1689
- array: bn,
1690
- boolean: yn,
1691
- custom: gn,
1692
- discriminatedUnion: hn,
1693
- enum: fn,
1694
- instanceof: mn,
1695
- lazy: tn,
1696
- literal: pn,
1697
- looseObject: un,
1698
- never: cn,
1699
- null: dn,
1700
- number: ln,
1701
- object: on,
1702
- record: nn,
1703
- string: rn,
1704
- union: sn,
1705
- unknown: an
1689
+ array: vn,
1690
+ boolean: bn,
1691
+ custom: yn,
1692
+ discriminatedUnion: gn,
1693
+ enum: hn,
1694
+ instanceof: fn,
1695
+ lazy: an,
1696
+ literal: mn,
1697
+ looseObject: pn,
1698
+ never: un,
1699
+ null: cn,
1700
+ number: dn,
1701
+ object: ln,
1702
+ record: on,
1703
+ string: nn,
1704
+ union: rn,
1705
+ unknown: sn
1706
1706
  }, Oe = n.lazy(() => n.union([
1707
1707
  n.null(),
1708
1708
  n.string(),
@@ -1714,12 +1714,12 @@ const n = {
1714
1714
  n.string(),
1715
1715
  n.instanceof(Uint8Array),
1716
1716
  n.instanceof(ArrayBuffer),
1717
- n.custom(to, { message: "Must be a Buffer" })
1717
+ n.custom(ao, { message: "Must be a Buffer" })
1718
1718
  ]), Dt = n.record(n.string(), n.string()), Ss = n.object({
1719
1719
  type: n.literal("text"),
1720
1720
  text: n.string(),
1721
1721
  providerOptions: O.optional()
1722
- }), ri = n.object({
1722
+ }), ni = n.object({
1723
1723
  type: n.literal("image"),
1724
1724
  image: n.union([
1725
1725
  Qe,
@@ -1745,7 +1745,7 @@ const n = {
1745
1745
  type: n.literal("text"),
1746
1746
  text: n.string()
1747
1747
  })
1748
- ]), ni = n.discriminatedUnion("type", [n.object({
1748
+ ]), oi = n.discriminatedUnion("type", [n.object({
1749
1749
  type: n.literal("data"),
1750
1750
  data: Qe
1751
1751
  }), n.object({
@@ -1762,31 +1762,31 @@ const n = {
1762
1762
  filename: n.string().optional(),
1763
1763
  mediaType: n.string(),
1764
1764
  providerOptions: O.optional()
1765
- }), oi = n.object({
1765
+ }), ii = n.object({
1766
1766
  type: n.literal("reasoning"),
1767
1767
  text: n.string(),
1768
1768
  providerOptions: O.optional()
1769
- }), ii = n.object({
1769
+ }), li = n.object({
1770
1770
  type: n.literal("custom"),
1771
1771
  kind: n.string().transform((e) => e),
1772
1772
  providerOptions: O.optional()
1773
- }), li = n.object({
1773
+ }), di = n.object({
1774
1774
  type: n.literal("reasoning-file"),
1775
1775
  data: n.union([
1776
- ni,
1776
+ oi,
1777
1777
  Qe,
1778
1778
  n.instanceof(URL)
1779
1779
  ]),
1780
1780
  mediaType: n.string(),
1781
1781
  providerOptions: O.optional()
1782
- }), di = n.object({
1782
+ }), ci = n.object({
1783
1783
  type: n.literal("tool-call"),
1784
1784
  toolCallId: n.string(),
1785
1785
  toolName: n.string(),
1786
1786
  input: n.unknown(),
1787
1787
  providerOptions: O.optional(),
1788
1788
  providerExecuted: n.boolean().optional()
1789
- }), ci = n.discriminatedUnion("type", [
1789
+ }), ui = n.discriminatedUnion("type", [
1790
1790
  n.object({
1791
1791
  type: n.literal("text"),
1792
1792
  value: n.string(),
@@ -1881,9 +1881,9 @@ const n = {
1881
1881
  type: n.literal("tool-result"),
1882
1882
  toolCallId: n.string(),
1883
1883
  toolName: n.string(),
1884
- output: ci,
1884
+ output: ui,
1885
1885
  providerOptions: O.optional()
1886
- }), ui = n.object({
1886
+ }), pi = n.object({
1887
1887
  type: n.literal("tool-approval-request"),
1888
1888
  approvalId: n.string(),
1889
1889
  toolCallId: n.string(),
@@ -1891,48 +1891,48 @@ const n = {
1891
1891
  isAutomatic: n.boolean().optional(),
1892
1892
  signature: n.string().optional(),
1893
1893
  inputSchemaInput: n.unknown().optional()
1894
- }), pi = n.object({
1894
+ }), mi = n.object({
1895
1895
  type: n.literal("tool-approval-response"),
1896
1896
  approvalId: n.string(),
1897
1897
  approved: n.boolean(),
1898
1898
  reason: n.string().optional()
1899
- }), mi = n.object({
1899
+ }), fi = n.object({
1900
1900
  role: n.literal("system"),
1901
1901
  content: n.string(),
1902
1902
  providerOptions: O.optional()
1903
- }), fi = n.object({
1903
+ }), hi = n.object({
1904
1904
  role: n.literal("user"),
1905
1905
  content: n.union([n.string(), n.array(n.union([
1906
1906
  Ss,
1907
- ri,
1907
+ ni,
1908
1908
  Cs
1909
1909
  ]))]),
1910
1910
  providerOptions: O.optional()
1911
- }), hi = n.object({
1911
+ }), gi = n.object({
1912
1912
  role: n.literal("assistant"),
1913
1913
  content: n.union([n.string(), n.array(n.union([
1914
1914
  Ss,
1915
- ii,
1916
- Cs,
1917
- oi,
1918
1915
  li,
1916
+ Cs,
1917
+ ii,
1919
1918
  di,
1919
+ ci,
1920
1920
  Es,
1921
- ui
1921
+ pi
1922
1922
  ]))]),
1923
1923
  providerOptions: O.optional()
1924
- }), gi = n.object({
1924
+ }), yi = n.object({
1925
1925
  role: n.literal("tool"),
1926
- content: n.array(n.union([Es, pi])),
1926
+ content: n.array(n.union([Es, mi])),
1927
1927
  providerOptions: O.optional()
1928
1928
  });
1929
1929
  n.union([
1930
- mi,
1931
1930
  fi,
1932
1931
  hi,
1933
- gi
1932
+ gi,
1933
+ yi
1934
1934
  ]);
1935
- function yi(e) {
1935
+ function bi(e) {
1936
1936
  const t = ["ROOT"];
1937
1937
  let a = -1, s = null, r = 0;
1938
1938
  function l(h) {
@@ -2133,7 +2133,7 @@ function yi(e) {
2133
2133
  }
2134
2134
  return o;
2135
2135
  }
2136
- async function bi(e) {
2136
+ async function vi(e) {
2137
2137
  if (e === void 0) return {
2138
2138
  value: void 0,
2139
2139
  state: "undefined-input"
@@ -2142,7 +2142,7 @@ async function bi(e) {
2142
2142
  return t.success ? {
2143
2143
  value: t.value,
2144
2144
  state: "successful-parse"
2145
- } : (t = await Ct({ text: yi(e) }), t.success ? {
2145
+ } : (t = await Ct({ text: bi(e) }), t.success ? {
2146
2146
  value: t.value,
2147
2147
  state: "repaired-parse"
2148
2148
  } : {
@@ -2176,7 +2176,7 @@ Y({
2176
2176
  });
2177
2177
  }
2178
2178
  });
2179
- const Ve = n.record(n.string(), Oe.optional()), vi = Ko(() => ys(n.union([
2179
+ const Ve = n.record(n.string(), Oe.optional()), xi = Wo(() => ys(n.union([
2180
2180
  n.looseObject({
2181
2181
  type: n.literal("text-start"),
2182
2182
  id: n.string(),
@@ -2359,7 +2359,7 @@ const Ve = n.record(n.string(), Oe.optional()), vi = Ko(() => ys(n.union([
2359
2359
  messageMetadata: n.unknown()
2360
2360
  })
2361
2361
  ])));
2362
- function xi(e) {
2362
+ function wi(e) {
2363
2363
  return e.type.startsWith("data-");
2364
2364
  }
2365
2365
  function Fe() {
@@ -2368,11 +2368,11 @@ function Fe() {
2368
2368
  function it(e) {
2369
2369
  return e.type.startsWith("tool-");
2370
2370
  }
2371
- function wi(e) {
2371
+ function Ni(e) {
2372
2372
  return e.type === "dynamic-tool";
2373
2373
  }
2374
2374
  function le(e) {
2375
- return it(e) || wi(e);
2375
+ return it(e) || Ni(e);
2376
2376
  }
2377
2377
  function Et(e) {
2378
2378
  return e.type.split("-").slice(1).join("-");
@@ -2404,7 +2404,7 @@ function Ts({ lastMessage: e, messageId: t }) {
2404
2404
  partialToolCalls: s
2405
2405
  };
2406
2406
  }
2407
- function Ni({ stream: e, messageMetadataSchema: t, dataPartSchemas: a, runUpdateMessageJob: s, onError: r, onToolCall: l, onData: i, resetStateOnMessageIdChange: m = !1, resetStateOnFirstMessageStart: g = !1 }) {
2407
+ function Ii({ stream: e, messageMetadataSchema: t, dataPartSchemas: a, runUpdateMessageJob: s, onError: r, onToolCall: l, onData: i, resetStateOnMessageIdChange: m = !1, resetStateOnFirstMessageStart: g = !1 }) {
2408
2408
  return e.pipeThrough(new TransformStream({ async transform(o, h) {
2409
2409
  await s(async ({ state: u, write: p }) => {
2410
2410
  function x() {
@@ -2649,7 +2649,7 @@ function Ni({ stream: e, messageMetadataSchema: t, dataPartSchemas: a, runUpdate
2649
2649
  message: `Received tool-input-delta for missing tool call with ID "${o.toolCallId}". Ensure a "tool-input-start" chunk is sent before any "tool-input-delta" chunks.`
2650
2650
  });
2651
2651
  c.text += o.inputTextDelta;
2652
- const { value: y } = await bi(c.text);
2652
+ const { value: y } = await vi(c.text);
2653
2653
  c.dynamic ? T({
2654
2654
  toolCallId: o.toolCallId,
2655
2655
  toolName: c.toolName,
@@ -2819,7 +2819,7 @@ function Ni({ stream: e, messageMetadataSchema: t, dataPartSchemas: a, runUpdate
2819
2819
  r == null || r(new Error(o.errorText));
2820
2820
  break;
2821
2821
  default:
2822
- if (xi(o)) {
2822
+ if (wi(o)) {
2823
2823
  if ((a == null ? void 0 : a[o.type]) != null) {
2824
2824
  const f = u.message.parts.findIndex((I) => "id" in I && "data" in I && I.id === o.id && I.type === o.type), b = f >= 0 ? f : u.message.parts.length;
2825
2825
  await ma({
@@ -2845,7 +2845,7 @@ function Ni({ stream: e, messageMetadataSchema: t, dataPartSchemas: a, runUpdate
2845
2845
  });
2846
2846
  } }));
2847
2847
  }
2848
- async function Ii({ stream: e, onError: t, abortSignal: a }) {
2848
+ async function Si({ stream: e, onError: t, abortSignal: a }) {
2849
2849
  const s = e.getReader(), r = () => {
2850
2850
  s.cancel().catch(() => {
2851
2851
  });
@@ -2862,7 +2862,7 @@ async function Ii({ stream: e, onError: t, abortSignal: a }) {
2862
2862
  a == null || a.removeEventListener("abort", r), s.releaseLock();
2863
2863
  }
2864
2864
  }
2865
- function Si() {
2865
+ function Ai() {
2866
2866
  let e, t;
2867
2867
  return {
2868
2868
  promise: new Promise((a, s) => {
@@ -2907,7 +2907,7 @@ Y({
2907
2907
  prefix: "aiobj",
2908
2908
  size: 24
2909
2909
  });
2910
- var Ai = class {
2910
+ var Ci = class {
2911
2911
  constructor() {
2912
2912
  this.queue = [], this.isProcessing = !1, this.idleWaiters = [];
2913
2913
  }
@@ -2980,7 +2980,7 @@ Y({
2980
2980
  });
2981
2981
  async function fa({ response: e, url: t, fallbackMessage: a }) {
2982
2982
  const s = await e.text();
2983
- return new qn({
2983
+ return new Vn({
2984
2984
  message: s || a,
2985
2985
  url: t,
2986
2986
  requestBodyValues: void 0,
@@ -2988,9 +2988,9 @@ async function fa({ response: e, url: t, fallbackMessage: a }) {
2988
2988
  responseBody: s
2989
2989
  });
2990
2990
  }
2991
- async function Ci(e) {
2991
+ async function Ei(e) {
2992
2992
  if (e == null) return [];
2993
- if (!globalThis.FileList || !(e instanceof globalThis.FileList)) throw new Gn({
2993
+ if (!globalThis.FileList || !(e instanceof globalThis.FileList)) throw new Yn({
2994
2994
  functionality: "FileList",
2995
2995
  message: "FileList is not supported in the current environment"
2996
2996
  });
@@ -3010,11 +3010,11 @@ async function Ci(e) {
3010
3010
  };
3011
3011
  }));
3012
3012
  }
3013
- function Ei(e, t) {
3013
+ function Ti(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
  }
3017
- var Ti = class {
3017
+ var Mi = class {
3018
3018
  constructor({ api: e = "/api/chat", credentials: t, headers: a, body: s, fetch: r, prepareSendMessagesRequest: l, prepareReconnectToStreamRequest: i }) {
3019
3019
  this.api = e, this.credentials = t, this.headers = a, this.body = s, this.fetch = r, this.prepareSendMessagesRequest = l, this.prepareReconnectToStreamRequest = i;
3020
3020
  }
@@ -3084,7 +3084,7 @@ var Ti = 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 = Ei(this.api, `/${encodeURIComponent(e.chatId)}/stream`);
3087
+ i = Ti(this.api, `/${encodeURIComponent(e.chatId)}/stream`);
3088
3088
  }
3089
3089
  const m = (l == null ? void 0 : l.headers) !== void 0 ? $e(l.headers) : r, g = (l == null ? void 0 : l.credentials) ?? s, o = await (this.fetch ?? globalThis.fetch)(i, {
3090
3090
  method: "GET",
@@ -3101,22 +3101,22 @@ var Ti = class {
3101
3101
  if (!o.body) throw new na({ message: "The response body is empty." });
3102
3102
  return this.processResponseStream(o.body);
3103
3103
  }
3104
- }, $t = class extends Ti {
3104
+ }, $t = class extends Mi {
3105
3105
  constructor(e = {}) {
3106
3106
  super(e);
3107
3107
  }
3108
3108
  processResponseStream(e) {
3109
- return ti({
3109
+ return ai({
3110
3110
  stream: e,
3111
- schema: vi
3111
+ schema: xi
3112
3112
  }).pipeThrough(new TransformStream({ async transform(t, a) {
3113
3113
  if (!t.success) throw t.error;
3114
3114
  a.enqueue(t.value);
3115
3115
  } }));
3116
3116
  }
3117
- }, Mi = class {
3118
- constructor({ generateId: e = eo, id: t = e(), transport: a = new $t(), messageMetadataSchema: s, dataPartSchemas: r, state: l, onError: i, onToolCall: m, onFinish: g, onData: o, sendAutomaticallyWhen: h }) {
3119
- this.pendingMessagePreparations = /* @__PURE__ */ new Set(), this.activeResponse = void 0, this.activeResumeRequest = void 0, this.resumableStreamState = void 0, this.jobExecutor = new Ai(), this.activeStopCount = 0, this.stopGeneration = 0, this.sendMessage = async (u, p) => {
3117
+ }, ki = class {
3118
+ constructor({ generateId: e = to, id: t = e(), transport: a = new $t(), messageMetadataSchema: s, dataPartSchemas: r, state: l, onError: i, onToolCall: m, onFinish: g, onData: o, sendAutomaticallyWhen: h }) {
3119
+ this.pendingMessagePreparations = /* @__PURE__ */ new Set(), this.activeResponse = void 0, this.activeResumeRequest = void 0, this.resumableStreamState = void 0, this.jobExecutor = new Ci(), this.activeStopCount = 0, this.stopGeneration = 0, this.sendMessage = async (u, p) => {
3120
3120
  var C;
3121
3121
  if (u == null) {
3122
3122
  let w = this.pendingApprovalMessageId;
@@ -3144,7 +3144,7 @@ var Ti = class {
3144
3144
  this.pendingMessagePreparations.add(w);
3145
3145
  let A;
3146
3146
  try {
3147
- A = Array.isArray(u.files) ? u.files : await Ci(u.files);
3147
+ A = Array.isArray(u.files) ? u.files : await Ei(u.files);
3148
3148
  } finally {
3149
3149
  this.pendingMessagePreparations.delete(w);
3150
3150
  }
@@ -3332,7 +3332,7 @@ var Ti = class {
3332
3332
  }), s && this.status === "error" && this.pendingApprovalMessageId == null && (this.pendingApprovalMessageId = ((r = this.state.messages[t]) == null ? void 0 : r.id) ?? e);
3333
3333
  }
3334
3334
  async makeRequest(e) {
3335
- const t = Si();
3335
+ const t = Ai();
3336
3336
  try {
3337
3337
  await this.makeRequestImpl({
3338
3338
  ...e,
@@ -3420,8 +3420,8 @@ var Ti = class {
3420
3420
  f.abortController.signal.aborted || (F && this.setStatus({ status: "streaming" }), w ? this.state.replaceMessage(p, f.state.message) : f.state.message.id === ((V = this.lastMessage) == null ? void 0 : V.id) ? this.state.replaceMessage(this.state.messages.length - 1, f.state.message) : this.state.pushMessage(f.state.message));
3421
3421
  }
3422
3422
  }));
3423
- if (await Ii({
3424
- stream: Ni({
3423
+ if (await Si({
3424
+ stream: Ii({
3425
3425
  stream: b,
3426
3426
  resetStateOnMessageIdChange: e === "resume-stream",
3427
3427
  resetStateOnFirstMessageStart: e === "resume-stream" && this.transport.resumeStreamIsReplay,
@@ -3479,7 +3479,7 @@ var Ti = class {
3479
3479
  });
3480
3480
  }
3481
3481
  };
3482
- function ki(e, t) {
3482
+ function _i(e, t) {
3483
3483
  if (typeof e != "function")
3484
3484
  throw new TypeError(`Expected the first argument to be a \`function\`, got \`${typeof e}\`.`);
3485
3485
  let a, s = 0;
@@ -3491,15 +3491,15 @@ function ki(e, t) {
3491
3491
  }, g);
3492
3492
  };
3493
3493
  }
3494
- var _i = ki;
3495
- const Oi = /* @__PURE__ */ Dr(_i);
3496
- function Ri(e, t) {
3497
- return t != null ? Oi(e, t) : e;
3494
+ var Oi = _i;
3495
+ const Ri = /* @__PURE__ */ Dr(Oi);
3496
+ function Pi(e, t) {
3497
+ return t != null ? Ri(e, t) : e;
3498
3498
  }
3499
- function Pi(e) {
3499
+ function Di(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 ae, Le, Be, Ae, Ce, Ee, ye, He, Ge, Aa, Di = (Aa = class {
3502
+ var ae, Le, Be, Ae, Ce, Ee, ye, He, Ge, Aa, $i = (Aa = class {
3503
3503
  constructor(e = []) {
3504
3504
  ne(this, ae);
3505
3505
  ne(this, Le);
@@ -3526,9 +3526,9 @@ var ae, Le, Be, Ae, Ce, Ee, ye, He, Ge, Aa, Di = (Aa = class {
3526
3526
  ...a,
3527
3527
  parts: a.parts.map((r) => ({ ...r }))
3528
3528
  };
3529
- return "metadata" in a && (s.metadata = Pi(a.metadata)), s;
3529
+ return "metadata" in a && (s.metadata = Di(a.metadata)), s;
3530
3530
  }, this["~registerMessagesCallback"] = (t, a) => {
3531
- const s = a ? Ri(t, a) : t;
3531
+ const s = a ? Pi(t, a) : t;
3532
3532
  return L(this, Ae).add(s), () => {
3533
3533
  L(this, Ae).delete(s);
3534
3534
  };
@@ -3562,9 +3562,9 @@ var ae, Le, Be, Ae, Ce, Ee, ye, He, Ge, Aa, Di = (Aa = class {
3562
3562
  set messages(e) {
3563
3563
  K(this, ae, [...e]), L(this, ye).call(this);
3564
3564
  }
3565
- }, ae = new WeakMap(), Le = new WeakMap(), Be = new WeakMap(), Ae = new WeakMap(), Ce = new WeakMap(), Ee = new WeakMap(), ye = new WeakMap(), He = new WeakMap(), Ge = new WeakMap(), Aa), Te, Ca, Ms = (Ca = class extends Mi {
3565
+ }, ae = new WeakMap(), Le = new WeakMap(), Be = new WeakMap(), Ae = new WeakMap(), Ce = new WeakMap(), Ee = new WeakMap(), ye = new WeakMap(), He = new WeakMap(), Ge = new WeakMap(), Aa), Te, Ca, Ms = (Ca = class extends ki {
3566
3566
  constructor({ messages: t, ...a }) {
3567
- const s = new Di(t);
3567
+ const s = new $i(t);
3568
3568
  super({
3569
3569
  ...a,
3570
3570
  state: s
@@ -3574,7 +3574,7 @@ var ae, Le, Be, Ae, Ce, Ee, ye, He, Ge, Aa, Di = (Aa = class {
3574
3574
  }
3575
3575
  }, Te = new WeakMap(), Ca);
3576
3576
  const yt = /* @__PURE__ */ new WeakMap();
3577
- function $i({ chat: e, registration: t }) {
3577
+ function ji({ chat: e, registration: t }) {
3578
3578
  let a = yt.get(e);
3579
3579
  a == null && (a = /* @__PURE__ */ new Set(), yt.set(e, a));
3580
3580
  const s = a.size === 0;
@@ -3593,7 +3593,7 @@ function st(e) {
3593
3593
  function ha(e, t) {
3594
3594
  return e.chat === t.chat && e.messages === t.messages && e.status === t.status && e.error === t.error;
3595
3595
  }
3596
- function ji({ throttle: e, experimental_throttle: t, resume: a = !1, ...s } = {}) {
3596
+ function Fi({ throttle: e, experimental_throttle: t, resume: a = !1, ...s } = {}) {
3597
3597
  const r = e ?? t, l = te({}), i = te({});
3598
3598
  "chat" in s || (i.current = {
3599
3599
  onToolCall: s.onToolCall,
@@ -3660,7 +3660,7 @@ function ji({ throttle: e, experimental_throttle: t, resume: a = !1, ...s } = {}
3660
3660
  typeof N == "function" && (N = N(u.messages)), u.messages = N;
3661
3661
  }, [u]);
3662
3662
  return be(() => {
3663
- if (a) return $i({
3663
+ if (a) return ji({
3664
3664
  chat: u,
3665
3665
  registration: l.current
3666
3666
  });
@@ -3701,17 +3701,17 @@ const jt = async (e, t) => {
3701
3701
  async function Mt(e, t) {
3702
3702
  await e.cancelQueries({ queryKey: t }), await e.invalidateQueries({ queryKey: t });
3703
3703
  }
3704
- async function Fi(e, t) {
3704
+ async function Li(e, t) {
3705
3705
  return (await Ft(e, "sources", t)).sources;
3706
3706
  }
3707
- async function Li(e, t) {
3707
+ async function Bi(e, t) {
3708
3708
  return (await Ft(e, "conversations", t)).conversations;
3709
3709
  }
3710
3710
  function ga(e, t, a, s = {}) {
3711
3711
  const r = s.toolCalls ? "?include=toolCalls" : "";
3712
3712
  return Ft(e, `conversations/${encodeURIComponent(t)}${r}`, a);
3713
3713
  }
3714
- async function Bi(e, t) {
3714
+ async function Ui(e, t) {
3715
3715
  try {
3716
3716
  await jt(`${e.apiServiceUrl}/v1/assistant/conversations/${encodeURIComponent(t)}`, {
3717
3717
  method: "DELETE",
@@ -3722,7 +3722,7 @@ async function Bi(e, t) {
3722
3722
  throw a;
3723
3723
  }
3724
3724
  }
3725
- async function Ui(e, t, a, s) {
3725
+ async function zi(e, t, a, s) {
3726
3726
  const r = { ...a ? { links: a } : {}, ...s ? { conversationId: s } : {} };
3727
3727
  let l;
3728
3728
  try {
@@ -3744,7 +3744,7 @@ async function Ft(e, t, a) {
3744
3744
  ...a ? { signal: a } : {}
3745
3745
  })).json();
3746
3746
  }
3747
- async function zi(e, t, a) {
3747
+ async function qi(e, t, a) {
3748
3748
  const s = { conversationId: a }, r = await fetch(
3749
3749
  `${e.apiServiceUrl}/v1/assistant/proposals/${encodeURIComponent(t)}/dismiss`,
3750
3750
  {
@@ -3758,12 +3758,12 @@ async function zi(e, t, a) {
3758
3758
  });
3759
3759
  return (l == null ? void 0 : l.code) === "already_applied" && Array.isArray(l.links) ? { ok: !1, links: l.links } : { ok: !1, ...typeof (l == null ? void 0 : l.code) == "string" ? { code: l.code } : {} };
3760
3760
  }
3761
- const qi = {}, Vi = {}, Zi = "Not now couldn’t be saved. Try again.", ya = "We couldn’t tell whether they were added. Click again to check.", ba = "They’re still being added. Click again in a moment to check.", Ji = "something went wrong while applying it.";
3761
+ const Vi = {}, Zi = {}, Ji = "Not now couldn’t be saved. Try again.", ya = "We couldn’t tell whether they were added. Click again to check.", ba = "They’re still being added. Click again in a moment to check.", Ki = "something went wrong while applying it.";
3762
3762
  function ge(e, t, a, s) {
3763
3763
  return { ...e, [t]: { ...e[t], [a]: s } };
3764
3764
  }
3765
- const Ki = "Could not open this conversation. Try again.", Wi = "A field you tagged is no longer on this card. Remove it and ask again.";
3766
- function Hi(e) {
3765
+ const Wi = "Could not open this conversation. Try again.", Hi = "A field you tagged is no longer on this card. Remove it and ask again.";
3766
+ function Gi(e) {
3767
3767
  const t = te(e);
3768
3768
  ke(() => {
3769
3769
  t.current = e;
@@ -3802,7 +3802,7 @@ function Hi(e) {
3802
3802
  { stillWanted: () => a.current === E }
3803
3803
  ) : U;
3804
3804
  } catch (fe) {
3805
- console.warn("The change could not be applied:", fe), Q = { ok: !1, reason: "refused", message: Ji };
3805
+ console.warn("The change could not be applied:", fe), Q = { ok: !1, reason: "refused", message: Ki };
3806
3806
  }
3807
3807
  if (Q.ok && E.appliedAfter.set(_.proposalId, Q.after), !Q.ok && Q.reason === "dropped") return;
3808
3808
  const we = Q.ok ? { status: "applied" } : { status: "refused", reason: Q.reason, message: Q.message };
@@ -3814,7 +3814,7 @@ function Hi(e) {
3814
3814
  ke(() => (a.current = p, () => {
3815
3815
  a.current === p && (a.current = void 0);
3816
3816
  }), [p]);
3817
- const { messages: C, status: w, error: A } = ji({ chat: p.chat });
3817
+ const { messages: C, status: w, error: A } = Fi({ chat: p.chat });
3818
3818
  be(() => () => void p.chat.stop(), [p]);
3819
3819
  const [k, T] = $(), [N, c] = $([]), y = te(void 0), [f, b] = $(!1);
3820
3820
  be(() => () => {
@@ -3833,12 +3833,12 @@ function Hi(e) {
3833
3833
  try {
3834
3834
  D = t.current.readContext();
3835
3835
  } catch (fe) {
3836
- return T(el(fe)), fe instanceof Va && t.current.onStaleFocus(), "not_sent";
3836
+ return T(tl(fe)), fe instanceof Va && t.current.onStaleFocus(), "not_sent";
3837
3837
  }
3838
3838
  if (Jr(D.context, E).length)
3839
- return T(Wi), "not_sent";
3839
+ return T(Hi), "not_sent";
3840
3840
  const q = {
3841
- turnId: tl(),
3841
+ turnId: al(),
3842
3842
  context: D.context,
3843
3843
  addedSources: N,
3844
3844
  ...D.cardReplay ?? {},
@@ -3849,7 +3849,7 @@ function Hi(e) {
3849
3849
  T(void 0);
3850
3850
  const re = (U = D.context.selectedCard) == null ? void 0 : U.id;
3851
3851
  re && (p.aboutCardId = re);
3852
- const J = Gi(D.context, ((we = (Q = t.current).canChangeOpenDashboard) == null ? void 0 : we.call(Q)) ?? !1);
3852
+ const J = Yi(D.context, ((we = (Q = t.current).canChangeOpenDashboard) == null ? void 0 : we.call(Q)) ?? !1);
3853
3853
  return p.answerBase = J, p.proposals.clear(), p.appliedAfter.clear(), p.chat.sendMessage(
3854
3854
  { text: _, ...E.length ? { metadata: { taggedFields: E } } : {} },
3855
3855
  { body: J ? { ...q, openDashboard: J } : q }
@@ -3875,7 +3875,7 @@ function Hi(e) {
3875
3875
  const _ = p.chat.id, D = (J = l[_]) == null ? void 0 : J[R];
3876
3876
  if ((D == null ? void 0 : D.status) !== "offered") return;
3877
3877
  i((U) => ge(U, _, R, { status: "adding", ...E ? { links: E } : {} }));
3878
- const q = await Ui(u.connection(), R, E, p.conversationId).catch((U) => (console.warn("The relationships could not be added:", U), { ok: !1, unknown: !0 })), re = q.ok ? { status: "added", links: q.links } : "unknown" in q ? { status: "offered", notice: ya, uncertain: !0 } : q.code === "apply_in_progress" ? { status: "offered", notice: ba, uncertain: !0 } : { status: "refused", message: Wa(q.code) };
3878
+ const q = await zi(u.connection(), R, E, p.conversationId).catch((U) => (console.warn("The relationships could not be added:", U), { ok: !1, unknown: !0 })), re = q.ok ? { status: "added", links: q.links } : "unknown" in q ? { status: "offered", notice: ya, uncertain: !0 } : q.code === "apply_in_progress" ? { status: "offered", notice: ba, uncertain: !0 } : { status: "refused", message: Wa(q.code) };
3879
3879
  i((U) => ge(U, _, R, re));
3880
3880
  },
3881
3881
  [p, u, l]
@@ -3886,7 +3886,7 @@ function Hi(e) {
3886
3886
  if ((_ == null ? void 0 : _.status) !== "offered" || _.uncertain) return;
3887
3887
  const D = p.conversationId;
3888
3888
  i((U) => ge(U, E, R, { status: "dismissing" }));
3889
- const q = D ? await zi(u.connection(), R, D).catch((U) => (console.warn("Not now could not be saved:", U), { ok: !1, code: void 0 })) : { ok: !1, code: void 0 }, re = q.ok ? { status: "dismissed" } : "links" in q ? { status: "added", links: q.links } : q.code === "apply_in_progress" ? { status: "offered", notice: ba, uncertain: !0 } : q.code === "apply_outcome_unknown" ? { status: "offered", notice: ya, uncertain: !0 } : { status: "offered", notice: Zi };
3889
+ const q = D ? await qi(u.connection(), R, D).catch((U) => (console.warn("Not now could not be saved:", U), { ok: !1, code: void 0 })) : { ok: !1, code: void 0 }, re = q.ok ? { status: "dismissed" } : "links" in q ? { status: "added", links: q.links } : q.code === "apply_in_progress" ? { status: "offered", notice: ba, uncertain: !0 } : q.code === "apply_outcome_unknown" ? { status: "offered", notice: ya, uncertain: !0 } : { status: "offered", notice: Ji };
3890
3890
  i((U) => ge(U, E, R, re));
3891
3891
  },
3892
3892
  [p, u, l]
@@ -3916,7 +3916,7 @@ function Hi(e) {
3916
3916
  return E.signal.aborted ? "not_opened" : (x(bt(u, D)), c(D.addedSources), D.allows && h(D.allows), "opened");
3917
3917
  } catch (D) {
3918
3918
  return E.signal.aborted || T(
3919
- D instanceof qe && D.code !== "model_unavailable" ? D.message : Ki
3919
+ D instanceof qe && D.code !== "model_unavailable" ? D.message : Wi
3920
3920
  ), "not_opened";
3921
3921
  } finally {
3922
3922
  y.current === E && (y.current = void 0, b(!1));
@@ -3933,10 +3933,10 @@ function Hi(e) {
3933
3933
  /** Answering, or applying an answer's change to the dashboard. */
3934
3934
  busy: vt(w) || m.chatId === p.chat.id && m.count > 0,
3935
3935
  /** Where this session's proposals stand on the dashboard; none for a reopened conversation. */
3936
- proposalStates: s[p.chat.id] ?? qi,
3936
+ proposalStates: s[p.chat.id] ?? Vi,
3937
3937
  undoProposal: V,
3938
3938
  /** Where this session's proposed relationships stand; none for a reopened conversation. */
3939
- modelChangeStates: l[p.chat.id] ?? Vi,
3939
+ modelChangeStates: l[p.chat.id] ?? Zi,
3940
3940
  addModelChange: Pe,
3941
3941
  dismissModelChange: De,
3942
3942
  /** A stored conversation is loading; sending waits. */
@@ -3949,7 +3949,7 @@ function Hi(e) {
3949
3949
  /** The stored conversation to copy, with its tool calls when asked for and allowed (AJ-D10, AJ-D11). */
3950
3950
  readForCopy: (R) => p.conversationId ? ga(u.connection(), p.conversationId, void 0, { toolCalls: R }) : Promise.reject(new Error("Nothing to copy yet.")),
3951
3951
  /** What went wrong with the last send, in plain words; never a raw error. */
3952
- failure: A ? Xi(A) : void 0,
3952
+ failure: A ? el(A) : void 0,
3953
3953
  notice: k,
3954
3954
  clearNotice: () => T(void 0),
3955
3955
  send: M,
@@ -3960,7 +3960,7 @@ function Hi(e) {
3960
3960
  open: ue
3961
3961
  };
3962
3962
  }
3963
- function Gi(e, t) {
3963
+ function Yi(e, t) {
3964
3964
  var s;
3965
3965
  if (!t || e.surface !== "dashboard") return;
3966
3966
  const a = W.getState().dashboard;
@@ -3998,7 +3998,7 @@ function bt(e, t) {
3998
3998
  });
3999
3999
  return a.chat = new Ms({
4000
4000
  transport: s,
4001
- ...t ? { messages: Yi(t) } : {},
4001
+ ...t ? { messages: Qi(t) } : {},
4002
4002
  onData: (r) => {
4003
4003
  r.type === "data-conversation" ? (a.conversationId = r.data.conversationId, r.data.allows && e.onAllows(r.data.allows)) : r.type === "data-proposal" ? e.onProposal(a, r.data) : r.type === "data-proposal_operations" ? e.onProposalOperations(a, r.data) : r.type === "data-model_change" && e.onModelChange(a, r.data);
4004
4004
  },
@@ -4006,7 +4006,7 @@ function bt(e, t) {
4006
4006
  onError: (r) => e.onFailed(r)
4007
4007
  }), a;
4008
4008
  }
4009
- function Yi(e) {
4009
+ function Qi(e) {
4010
4010
  return e.turns.flatMap((t) => {
4011
4011
  var r;
4012
4012
  const a = Kr(t.outcome), s = [...t.parts, ...a ? [a] : []].map(Wr);
@@ -4024,17 +4024,17 @@ function Yi(e) {
4024
4024
  function vt(e) {
4025
4025
  return e === "submitted" || e === "streaming";
4026
4026
  }
4027
- const Qi = new Set(Object.values(We));
4028
- function Xi(e) {
4029
- return e instanceof qe || Qi.has(e.message) ? e.message : We.model_unavailable;
4030
- }
4027
+ const Xi = new Set(Object.values(We));
4031
4028
  function el(e) {
4029
+ return e instanceof qe || Xi.has(e.message) ? e.message : We.model_unavailable;
4030
+ }
4031
+ function tl(e) {
4032
4032
  return e instanceof qa ? e.message : e instanceof Ga ? "The dashboard is still loading. Try again in a moment." : e instanceof Va ? We.context_invalid : We.model_unavailable;
4033
4033
  }
4034
4034
  function _s(e) {
4035
4035
  return ((e == null ? void 0 : e.parts) ?? []).map((t) => t.type === "text" ? t.text : "").join("").trim();
4036
4036
  }
4037
- function tl() {
4037
+ function al() {
4038
4038
  var e, t;
4039
4039
  return ((t = (e = globalThis.crypto) == null ? void 0 : e.randomUUID) == null ? void 0 : t.call(e)) ?? `turn-${Date.now()}-${Math.random().toString(36).slice(2)}`;
4040
4040
  }
@@ -4051,7 +4051,7 @@ function Lt() {
4051
4051
  return rr() ?? $r;
4052
4052
  }
4053
4053
  function Ds(e, t) {
4054
- return Cn({
4054
+ return En({
4055
4055
  metadata: e,
4056
4056
  locale: t.locale,
4057
4057
  styles: { dateStyle: t.dateStyle, dateTime: t.dateTime }
@@ -4064,7 +4064,7 @@ function Bt(e, t, a) {
4064
4064
  if (e == null) return "";
4065
4065
  if (t.temporalBucket && typeof e == "string")
4066
4066
  try {
4067
- return An({
4067
+ return Cn({
4068
4068
  value: e,
4069
4069
  metadata: t.temporalBucket,
4070
4070
  format: Ds(t.temporalBucket, a).format
@@ -4072,21 +4072,21 @@ function Bt(e, t, a) {
4072
4072
  } catch {
4073
4073
  return String(e);
4074
4074
  }
4075
- return typeof e == "number" ? al(a.locale).format(e) : typeof e == "object" ? JSON.stringify(e) : String(e);
4075
+ return typeof e == "number" ? sl(a.locale).format(e) : typeof e == "object" ? JSON.stringify(e) : String(e);
4076
4076
  }
4077
4077
  const xa = /* @__PURE__ */ new Map();
4078
- function al(e) {
4078
+ function sl(e) {
4079
4079
  let t = xa.get(e);
4080
4080
  return t || (t = new Intl.NumberFormat(e, { maximumFractionDigits: 2 }), xa.set(e, t)), t;
4081
4081
  }
4082
4082
  function wa(e, t) {
4083
4083
  return e === t ? 0 : e == null ? 1 : t == null ? -1 : typeof e == "number" && typeof t == "number" ? e - t : String(e).localeCompare(String(t), void 0, { numeric: !0 });
4084
4084
  }
4085
- function sl(e, t, a, s) {
4085
+ function rl(e, t, a, s) {
4086
4086
  var p;
4087
4087
  if (t.kind !== "line" && t.kind !== "bar" && t.kind !== "stackedBar") return null;
4088
4088
  const r = new Map(e.columns.map((x) => [x.key, x])), { x: l, y: i = [], series: m } = t.encodings, g = l ? r.get(l) : void 0, o = i.map((x) => r.get(x)), h = m ? r.get(m) : void 0;
4089
- if (!g || o.length === 0 || !nl(o) || m && !h) return null;
4089
+ if (!g || o.length === 0 || !ol(o) || m && !h) return null;
4090
4090
  const u = { id: `assistant-artifact-${e.artifactId}`, title: e.title, type: t.kind };
4091
4091
  try {
4092
4092
  const x = nr({
@@ -4101,7 +4101,7 @@ function sl(e, t, a, s) {
4101
4101
  ...h ? { seriesKey: h.key } : {},
4102
4102
  valueKeys: h ? [o[0].key] : o.map((w) => w.key)
4103
4103
  },
4104
- temporalPresentation: rl([g, ...h ? [h] : []], g.key, a)
4104
+ temporalPresentation: nl([g, ...h ? [h] : []], g.key, a)
4105
4105
  });
4106
4106
  if (!x) return null;
4107
4107
  const C = ((p = x.data) == null ? void 0 : p.datasets) ?? [];
@@ -4122,7 +4122,7 @@ function sl(e, t, a, s) {
4122
4122
  return null;
4123
4123
  }
4124
4124
  }
4125
- function rl(e, t, a) {
4125
+ function nl(e, t, a) {
4126
4126
  const s = /* @__PURE__ */ new Map();
4127
4127
  for (const r of e)
4128
4128
  r.temporalBucket && s.set(r.key, {
@@ -4134,7 +4134,7 @@ function rl(e, t, a) {
4134
4134
  if (s.size !== 0)
4135
4135
  return { byColumnKey: s, byFieldId: /* @__PURE__ */ new Map(), byFieldRole: /* @__PURE__ */ new Map(), pivotSeriesByColumnKey: /* @__PURE__ */ new Map(), axisColumnKey: t };
4136
4136
  }
4137
- function nl(e) {
4137
+ function ol(e) {
4138
4138
  return e.every((t) => t !== void 0);
4139
4139
  }
4140
4140
  function Ut({
@@ -4161,13 +4161,13 @@ function Ut({
4161
4161
  r ? /* @__PURE__ */ d("div", { className: "border-l border-border pl-3", children: t }) : null
4162
4162
  ] });
4163
4163
  }
4164
- const ol = 10, il = 15;
4165
- function ll({
4164
+ const il = 10, ll = 15;
4165
+ function dl({
4166
4166
  artifact: e,
4167
4167
  onExpand: t,
4168
4168
  onAdd: a
4169
4169
  }) {
4170
- const { kind: s, setKind: r, visual: l, chart: i, shown: m } = $s(e, e.visual.kind), g = dl(e, m, a), o = e.records.length <= il ? e.records : e.records.slice(0, ol);
4170
+ const { kind: s, setKind: r, visual: l, chart: i, shown: m } = $s(e, e.visual.kind), g = cl(e, m, a), o = e.records.length <= ll ? e.records : e.records.slice(0, il);
4171
4171
  return /* @__PURE__ */ v("div", { className: "space-y-1.5", "data-testid": "assistant-artifact", "data-artifact-id": e.artifactId, "data-kind": m, children: [
4172
4172
  /* @__PURE__ */ v("div", { className: "flex items-center justify-between gap-2", children: [
4173
4173
  /* @__PURE__ */ d("h4", { className: "min-w-0 truncate text-[12.5px] font-semibold text-foreground", children: e.title }),
@@ -4187,7 +4187,7 @@ function ll({
4187
4187
  g.note
4188
4188
  ] });
4189
4189
  }
4190
- function dl(e, t, a) {
4190
+ function cl(e, t, a) {
4191
4191
  const [s, r] = $({ status: "idle" }), l = W(
4192
4192
  (m) => s.status === "added" ? Ya(m.dashboard, s.frameId) : !1
4193
4193
  );
@@ -4198,7 +4198,7 @@ function dl(e, t, a) {
4198
4198
  /* @__PURE__ */ d(ze, { className: "h-3.5 w-3.5" }),
4199
4199
  "Added"
4200
4200
  ] }),
4201
- note: cl(s.asTable, e.origin.kind === "sql")
4201
+ note: ul(s.asTable, e.origin.kind === "sql")
4202
4202
  };
4203
4203
  if (!a.available) return { action: null, note: null };
4204
4204
  const i = s.status === "adding";
@@ -4229,15 +4229,15 @@ function dl(e, t, a) {
4229
4229
  note: s.status === "failed" ? /* @__PURE__ */ d("p", { role: "alert", className: "text-[11.5px] text-destructive", children: s.message }) : null
4230
4230
  };
4231
4231
  }
4232
- function cl(e, t) {
4232
+ function ul(e, t) {
4233
4233
  const a = [
4234
4234
  ...e ? ["Added as a table: as this chart, the dashboard would read its columns differently. Pick its chart in the editor."] : [],
4235
4235
  ...t ? ["Its values stay as they ran; edit the card to follow filters."] : []
4236
4236
  ];
4237
4237
  return a.length ? /* @__PURE__ */ d("p", { role: "status", className: "text-[11.5px] text-muted-foreground", children: a.join(" ") }) : null;
4238
4238
  }
4239
- function ul({ artifact: e, onClose: t }) {
4240
- const { kind: a, setKind: s, visual: r, chart: l, shown: i } = $s(e, "table"), [m, g] = $(), o = Je(() => fl(e.records, m), [e.records, m]);
4239
+ function pl({ artifact: e, onClose: t }) {
4240
+ const { kind: a, setKind: s, visual: r, chart: l, shown: i } = $s(e, "table"), [m, g] = $(), o = Je(() => hl(e.records, m), [e.records, m]);
4241
4241
  return /* @__PURE__ */ v(
4242
4242
  "section",
4243
4243
  {
@@ -4284,18 +4284,18 @@ function ul({ artifact: e, onClose: t }) {
4284
4284
  );
4285
4285
  }
4286
4286
  function $s(e, t) {
4287
- const [a, s] = $(t), r = Je(() => pl(e, a), [e, a]), l = ir(), i = Lt(), m = Je(
4288
- () => sl(e, r, i, l),
4287
+ const [a, s] = $(t), r = Je(() => ml(e, a), [e, a]), l = ir(), i = Lt(), m = Je(
4288
+ () => rl(e, r, i, l),
4289
4289
  [e, r, i, l]
4290
4290
  ), g = r.kind === "table" || r.kind !== "number" && !m ? "table" : r.kind;
4291
4291
  return { kind: a, setKind: s, visual: r, chart: m, shown: g };
4292
4292
  }
4293
- function pl(e, t) {
4293
+ function ml(e, t) {
4294
4294
  if (t === e.visual.kind) return e.visual;
4295
4295
  const a = Ja(Ka(e), t);
4296
4296
  return a.ok ? a.visual : { kind: "table", encodings: {} };
4297
4297
  }
4298
- const ml = {
4298
+ const fl = {
4299
4299
  table: { label: "Table", icon: Rr },
4300
4300
  bar: { label: "Bar chart", icon: Fa },
4301
4301
  stackedBar: { label: "Stacked bar chart", icon: dr },
@@ -4308,7 +4308,7 @@ function js({
4308
4308
  onChange: a
4309
4309
  }) {
4310
4310
  return e.length < 2 ? null : /* @__PURE__ */ d("div", { role: "group", "aria-label": "Show as", className: "flex items-center rounded-control border border-border p-px", children: e.map((s) => {
4311
- const { label: r, icon: l } = ml[s], i = s === t;
4311
+ const { label: r, icon: l } = fl[s], i = s === t;
4312
4312
  return /* @__PURE__ */ d(
4313
4313
  "button",
4314
4314
  {
@@ -4401,7 +4401,7 @@ function rt({ term: e, value: t }) {
4401
4401
  /* @__PURE__ */ d("dd", { className: "min-w-0 break-words", children: t })
4402
4402
  ] });
4403
4403
  }
4404
- function fl(e, t) {
4404
+ function hl(e, t) {
4405
4405
  if (!t) return e;
4406
4406
  const a = t.direction === "asc" ? 1 : -1;
4407
4407
  return [...e].sort((s, r) => {
@@ -4409,7 +4409,7 @@ function fl(e, t) {
4409
4409
  return l == null || i === null || i === void 0 ? wa(l, i) : wa(l, i) * a;
4410
4410
  });
4411
4411
  }
4412
- function hl({ trace: e, stageIds: t }) {
4412
+ function gl({ trace: e, stageIds: t }) {
4413
4413
  const a = ((e == null ? void 0 : e.spans) ?? []).filter(
4414
4414
  (s) => s.kind === "step" && t.includes(s.stageId)
4415
4415
  );
@@ -4418,13 +4418,13 @@ function hl({ trace: e, stageIds: t }) {
4418
4418
  function pe(e) {
4419
4419
  return e < 1e3 ? `${Math.round(e)} ms` : `${(e / 1e3).toFixed(1)}s`;
4420
4420
  }
4421
- function gl({ trace: e }) {
4421
+ function yl({ trace: e }) {
4422
4422
  return /* @__PURE__ */ v(Me, { children: [
4423
4423
  " · ",
4424
4424
  pe(e.totalMs)
4425
4425
  ] });
4426
4426
  }
4427
- function yl({ trace: e, stages: t }) {
4427
+ function bl({ trace: e, stages: t }) {
4428
4428
  const a = (i) => e.spans.filter((m) => m.kind === i).reduce((m, g) => m + g.durationMs, 0), { input: s, cachedInput: r, output: l } = e.tokens;
4429
4429
  return /* @__PURE__ */ v("div", { className: "space-y-1.5 border-t border-border pt-2", "data-testid": "assistant-trace", children: [
4430
4430
  /* @__PURE__ */ v("div", { className: "space-y-0.5 text-[11px] tabular-nums text-muted-foreground", children: [
@@ -4447,15 +4447,15 @@ function yl({ trace: e, stages: t }) {
4447
4447
  e.model
4448
4448
  ] })
4449
4449
  ] }),
4450
- /* @__PURE__ */ d(Ut, { label: "Timeline", children: /* @__PURE__ */ d(vl, { trace: e, stages: t }) })
4450
+ /* @__PURE__ */ d(Ut, { label: "Timeline", children: /* @__PURE__ */ d(xl, { trace: e, stages: t }) })
4451
4451
  ] });
4452
4452
  }
4453
- const bl = {
4453
+ const vl = {
4454
4454
  check: "bg-amber-400/80",
4455
4455
  model: "bg-primary/70",
4456
4456
  step: "bg-muted-foreground/50"
4457
4457
  };
4458
- function vl({ trace: e, stages: t }) {
4458
+ function xl({ trace: e, stages: t }) {
4459
4459
  const a = new Map(t.map((l) => [l.stageId, l.label])), s = Math.max(e.totalMs, 1), r = e.spans.flatMap(
4460
4460
  (l) => l.kind === "model" && l.firstOutputMs !== void 0 ? [l.firstOutputMs] : []
4461
4461
  );
@@ -4465,7 +4465,7 @@ function vl({ trace: e, stages: t }) {
4465
4465
  /* @__PURE__ */ d("span", { className: "relative h-2 rounded-[2px] bg-muted", children: /* @__PURE__ */ d(
4466
4466
  "span",
4467
4467
  {
4468
- className: B("absolute top-0 h-2 rounded-[2px]", bl[l.kind]),
4468
+ className: B("absolute top-0 h-2 rounded-[2px]", vl[l.kind]),
4469
4469
  style: {
4470
4470
  left: `${l.startMs / s * 100}%`,
4471
4471
  width: `${Math.max(l.durationMs / s * 100, 0.8)}%`
@@ -4504,14 +4504,14 @@ function Xe({
4504
4504
  s ? /* @__PURE__ */ d("div", { className: "space-y-2", children: s }) : null
4505
4505
  ] });
4506
4506
  }
4507
- function xl({
4507
+ function wl({
4508
4508
  question: e,
4509
4509
  options: t,
4510
4510
  multiple: a,
4511
4511
  onPick: s
4512
4512
  }) {
4513
4513
  const r = Ys();
4514
- return a ? /* @__PURE__ */ d(wl, { questionId: r, question: e, options: t, onPick: s }) : /* @__PURE__ */ d(Xe, { title: /* @__PURE__ */ d("span", { id: r, children: e }), testId: "assistant-question", children: s ? /* @__PURE__ */ v("div", { role: "group", "aria-labelledby": r, className: "space-y-1.5", "data-testid": "assistant-choices", children: [
4514
+ return a ? /* @__PURE__ */ d(Nl, { questionId: r, question: e, options: t, onPick: s }) : /* @__PURE__ */ d(Xe, { title: /* @__PURE__ */ d("span", { id: r, children: e }), testId: "assistant-question", children: s ? /* @__PURE__ */ v("div", { role: "group", "aria-labelledby": r, className: "space-y-1.5", "data-testid": "assistant-choices", children: [
4515
4515
  t.map((l, i) => /* @__PURE__ */ v(
4516
4516
  "button",
4517
4517
  {
@@ -4531,7 +4531,7 @@ function xl({
4531
4531
  /* @__PURE__ */ d("span", { className: "block text-[13px] font-medium leading-[1.45] text-foreground", children: l.label }),
4532
4532
  l.description ? /* @__PURE__ */ d("span", { className: "block text-[12px] leading-[1.45] text-muted-foreground", children: l.description }) : null
4533
4533
  ] }),
4534
- /* @__PURE__ */ d(_n, { "aria-hidden": "true", className: "mt-1 h-3.5 w-3.5 shrink-0 text-muted-foreground opacity-0 group-hover:opacity-100" })
4534
+ /* @__PURE__ */ d(On, { "aria-hidden": "true", className: "mt-1 h-3.5 w-3.5 shrink-0 text-muted-foreground opacity-0 group-hover:opacity-100" })
4535
4535
  ]
4536
4536
  },
4537
4537
  l.optionId
@@ -4539,7 +4539,7 @@ function xl({
4539
4539
  /* @__PURE__ */ d(zs, { onPick: s })
4540
4540
  ] }) : null });
4541
4541
  }
4542
- function wl({
4542
+ function Nl({
4543
4543
  questionId: e,
4544
4544
  question: t,
4545
4545
  options: a,
@@ -4602,7 +4602,7 @@ function wl({
4602
4602
  className: "mt-0.5 h-7 shrink-0 gap-1 px-2.5",
4603
4603
  disabled: m.length === 0,
4604
4604
  onClick: () => {
4605
- s(Nl(m)) && l(/* @__PURE__ */ new Set());
4605
+ s(Il(m)) && l(/* @__PURE__ */ new Set());
4606
4606
  },
4607
4607
  children: [
4608
4608
  /* @__PURE__ */ d(lt, { className: "h-3 w-3" }),
@@ -4615,7 +4615,7 @@ function wl({
4615
4615
  }
4616
4616
  );
4617
4617
  }
4618
- function Nl(e) {
4618
+ function Il(e) {
4619
4619
  return e.length === 1 ? e[0].label : e.map((t) => `• ${t.label}`).join(`
4620
4620
  `);
4621
4621
  }
@@ -4685,7 +4685,7 @@ function qs({ field: e, onRemove: t }) {
4685
4685
  }
4686
4686
  );
4687
4687
  }
4688
- function Il({
4688
+ function Sl({
4689
4689
  fields: e,
4690
4690
  active: t,
4691
4691
  onPick: a
@@ -4722,14 +4722,14 @@ function Il({
4722
4722
  }
4723
4723
  );
4724
4724
  }
4725
- const Sl = "You’ve changed the dashboard since. Undo in the toolbar goes back to before editing.";
4726
- function Al({
4725
+ const Al = "You’ve changed the dashboard since. Undo in the toolbar goes back to before editing.";
4726
+ function Cl({
4727
4727
  proposal: e,
4728
4728
  state: t,
4729
4729
  onUndo: a,
4730
4730
  onAskAgain: s
4731
4731
  }) {
4732
- const r = W((h) => ur(h, e.proposalId)), l = W((h) => h.isVisualEditing), i = El(t, r), m = i.kind === "undone" || i.kind === "refused", g = !m && i.kind !== "settled", o = i.kind === "changed_since" ? Sl : i.kind === "undone" ? "Undone." : i.kind === "refused" ? i.message : void 0;
4732
+ const r = W((h) => ur(h, e.proposalId)), l = W((h) => h.isVisualEditing), i = Tl(t, r), m = i.kind === "undone" || i.kind === "refused", g = !m && i.kind !== "settled", o = i.kind === "changed_since" ? Al : i.kind === "undone" ? "Undone." : i.kind === "refused" ? i.message : void 0;
4733
4733
  return /* @__PURE__ */ v(
4734
4734
  Xe,
4735
4735
  {
@@ -4761,7 +4761,7 @@ function Al({
4761
4761
  ] }) : null,
4762
4762
  children: [
4763
4763
  /* @__PURE__ */ d("ul", { className: "space-y-1", children: e.changes.filter((h) => h.sentence).map((h, u) => {
4764
- const p = Ml(h.op);
4764
+ const p = kl(h.op);
4765
4765
  return /* @__PURE__ */ v("li", { className: "flex items-start gap-1.5", children: [
4766
4766
  /* @__PURE__ */ d(p, { className: "mt-[3px] h-3 w-3 shrink-0 text-muted-foreground" }),
4767
4767
  /* @__PURE__ */ d("span", { className: B("min-w-0 flex-1 text-[12px] leading-[1.55]", m ? "text-muted-foreground" : "text-foreground"), children: h.sentence })
@@ -4782,13 +4782,13 @@ function Al({
4782
4782
  }
4783
4783
  );
4784
4784
  }
4785
- function Cl({ refusal: e }) {
4785
+ function El({ refusal: e }) {
4786
4786
  return /* @__PURE__ */ d(Xe, { icon: Ma, title: "Not added", testId: "assistant-proposal-refused", "data-refusal-code": e.code, children: /* @__PURE__ */ v("p", { className: "flex items-start gap-1.5 text-[12px] leading-[1.55] text-foreground", children: [
4787
4787
  /* @__PURE__ */ d(Ot, { "aria-hidden": "true", className: "mt-[3px] h-3 w-3 shrink-0 text-amber-500" }),
4788
4788
  /* @__PURE__ */ d("span", { className: "min-w-0", children: e.message })
4789
4789
  ] }) });
4790
4790
  }
4791
- function El(e, t) {
4791
+ function Tl(e, t) {
4792
4792
  if (!e) return { kind: "settled" };
4793
4793
  switch (e.status) {
4794
4794
  case "applying":
@@ -4796,18 +4796,18 @@ function El(e, t) {
4796
4796
  case "undone":
4797
4797
  return { kind: "undone" };
4798
4798
  case "refused":
4799
- return { kind: "refused", message: Tl(e) };
4799
+ return { kind: "refused", message: Ml(e) };
4800
4800
  case "applied":
4801
4801
  return t === "undoable" ? { kind: "undoable" } : t === "older" ? { kind: "older" } : t === "changed_since" ? { kind: "changed_since" } : { kind: "settled" };
4802
4802
  }
4803
4803
  }
4804
- function Tl(e) {
4804
+ function Ml(e) {
4805
4805
  return e.reason === "refused" ? `Not applied: ${e.message}` : e.message;
4806
4806
  }
4807
- function Ml(e) {
4808
- return e.startsWith("filter.") ? En : e === "card.add" ? Ye : e === "card.remove" ? ka : _a;
4807
+ function kl(e) {
4808
+ return e.startsWith("filter.") ? Tn : e === "card.add" ? Ye : e === "card.remove" ? ka : _a;
4809
4809
  }
4810
- function kl({
4810
+ function _l({
4811
4811
  change: e,
4812
4812
  state: t,
4813
4813
  busy: a,
@@ -4818,18 +4818,18 @@ function kl({
4818
4818
  var N, c, y;
4819
4819
  const i = e.links ?? [], m = ((N = e.outcome) == null ? void 0 : N.status) === "applied" ? { status: "added", links: e.outcome.links } : ((c = e.outcome) == null ? void 0 : c.status) === "dismissed" ? { status: "dismissed" } : ((y = e.outcome) == null ? void 0 : y.status) === "refused" ? { status: "refused", message: Wa(e.outcome.code) } : void 0;
4820
4820
  t = m && (!t || t.status === "offered") ? m : t;
4821
- const g = (t == null ? void 0 : t.status) ?? "settled", o = g === "offered" || g === "adding" || g === "dismissing", h = g === "adding" || g === "dismissing", u = i.length > 1, [p, x] = $(() => i.map((f, b) => b)), C = (t == null ? void 0 : t.status) === "adding" ? t.links ?? p : p, w = (t == null ? void 0 : t.status) === "added" ? t.links : void 0, A = i.length > 0 ? C.length : 1, k = w ? Rl(w) : void 0, T = k ? k.added + k.existing > 0 : !1;
4821
+ const g = (t == null ? void 0 : t.status) ?? "settled", o = g === "offered" || g === "adding" || g === "dismissing", h = g === "adding" || g === "dismissing", u = i.length > 1, [p, x] = $(() => i.map((f, b) => b)), C = (t == null ? void 0 : t.status) === "adding" ? t.links ?? p : p, w = (t == null ? void 0 : t.status) === "added" ? t.links : void 0, A = i.length > 0 ? C.length : 1, k = w ? Pl(w) : void 0, T = k ? k.added + k.existing > 0 : !1;
4822
4822
  return /* @__PURE__ */ v(
4823
4823
  Xe,
4824
4824
  {
4825
- icon: On,
4825
+ icon: Rn,
4826
4826
  title: i.length > 1 ? "Data model changes" : "Data model change",
4827
4827
  testId: "assistant-model-change",
4828
4828
  "data-model-change-state": g,
4829
4829
  action: g === "adding" ? /* @__PURE__ */ d(Na, { icon: /* @__PURE__ */ d(_e, { className: "h-3 w-3 animate-spin" }), children: "Adding" }) : k ? /* @__PURE__ */ d(Na, { icon: T ? /* @__PURE__ */ d(ze, { className: "h-3 w-3" }) : /* @__PURE__ */ d(Ot, { className: "h-3 w-3 text-amber-500" }), children: T ? k.refused > 0 ? "Partly added" : "Added" : "Not added" }) : null,
4830
4830
  children: [
4831
4831
  i.length > 0 ? /* @__PURE__ */ d("ul", { className: "space-y-1.5", children: i.map((f, b) => /* @__PURE__ */ d(
4832
- _l,
4832
+ Ol,
4833
4833
  {
4834
4834
  link: f,
4835
4835
  domainLabel: e.domainLabel,
@@ -4889,7 +4889,7 @@ function kl({
4889
4889
  (t == null ? void 0 : t.status) === "offered" && t.notice ? /* @__PURE__ */ d("p", { className: "text-[11.5px] leading-[1.5] text-muted-foreground", children: t.notice }) : null
4890
4890
  ] }) : null,
4891
4891
  g === "dismissed" || g === "refused" || k ? /* @__PURE__ */ v("div", { className: "flex flex-wrap items-center justify-between gap-2 border-t border-border pt-2", children: [
4892
- /* @__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." : Pl(k, i.length, e.domainLabel) }),
4892
+ /* @__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." : Dl(k, i.length, e.domainLabel) }),
4893
4893
  T && e.nextStep && l ? /* @__PURE__ */ v(Z, { size: "xs", className: "h-[26px] gap-1 px-2 text-[11.5px]", disabled: a, onClick: () => l(e.nextStep), children: [
4894
4894
  e.nextStep,
4895
4895
  /* @__PURE__ */ d(Oa, { className: "h-3 w-3" })
@@ -4899,7 +4899,7 @@ function kl({
4899
4899
  }
4900
4900
  );
4901
4901
  }
4902
- function _l({
4902
+ function Ol({
4903
4903
  link: e,
4904
4904
  domainLabel: t,
4905
4905
  tick: a,
@@ -4924,21 +4924,21 @@ function _l({
4924
4924
  /* @__PURE__ */ d(Oa, { className: "h-3 w-3 text-muted-foreground", "aria-hidden": "true" }),
4925
4925
  e.to.label
4926
4926
  ] }),
4927
- /* @__PURE__ */ d("span", { className: "block text-[11.5px] text-muted-foreground", children: (s == null ? void 0 : s.status) === "existing" ? "Already in the model" : (s == null ? void 0 : s.status) === "refused" ? `Not added: ${Hr(s.reasons, t)}` : l ? "Left out" : Ol(e) })
4927
+ /* @__PURE__ */ d("span", { className: "block text-[11.5px] text-muted-foreground", children: (s == null ? void 0 : s.status) === "existing" ? "Already in the model" : (s == null ? void 0 : s.status) === "refused" ? `Not added: ${Hr(s.reasons, t)}` : l ? "Left out" : Rl(e) })
4928
4928
  ] })
4929
4929
  ] });
4930
4930
  }
4931
- function Ol(e) {
4931
+ function Rl(e) {
4932
4932
  const t = e.cardinality === "one_to_one" ? "one to one" : "many to one";
4933
4933
  return `${e.from.fields.join(", ")} to ${e.to.fields.join(", ")} · ${t}${e.defaultJoinType === "INNER" ? " · only matching rows" : ""}`;
4934
4934
  }
4935
- function Rl(e) {
4935
+ function Pl(e) {
4936
4936
  const t = { added: 0, existing: 0, refused: 0, leftOut: 0 };
4937
4937
  for (const a of e)
4938
4938
  a.status === "added" ? t.added += 1 : a.status === "existing" ? t.existing += 1 : a.status === "refused" ? t.refused += 1 : t.leftOut += 1;
4939
4939
  return t;
4940
4940
  }
4941
- function Pl(e, t, a) {
4941
+ function Dl(e, t, a) {
4942
4942
  const s = "Open dashboards pick them up within a minute.";
4943
4943
  if (e.existing === 0 && e.refused === 0)
4944
4944
  return e.added === Math.max(t, 1) ? `Added to ${a}. ${s}` : `${e.added} added to ${a}. ${s}`;
@@ -4956,7 +4956,7 @@ function Na({ icon: e, children: t }) {
4956
4956
  ] });
4957
4957
  }
4958
4958
  const Ia = 4;
4959
- function Dl({
4959
+ function $l({
4960
4960
  messages: e,
4961
4961
  status: t,
4962
4962
  failure: a,
@@ -4964,9 +4964,9 @@ function Dl({
4964
4964
  onAdd: r,
4965
4965
  onPick: l,
4966
4966
  onAskAgain: i,
4967
- proposalStates: m = $l,
4967
+ proposalStates: m = jl,
4968
4968
  onUndoProposal: g,
4969
- modelChangeStates: o = jl,
4969
+ modelChangeStates: o = Fl,
4970
4970
  onAddModelChange: h,
4971
4971
  onDismissModelChange: u
4972
4972
  }) {
@@ -4975,8 +4975,8 @@ function Dl({
4975
4975
  e.map(
4976
4976
  (C, w) => {
4977
4977
  var A;
4978
- return C.role === "user" ? /* @__PURE__ */ d(Ll, { message: C }, C.id) : /* @__PURE__ */ d(
4979
- Bl,
4978
+ return C.role === "user" ? /* @__PURE__ */ d(Bl, { message: C }, C.id) : /* @__PURE__ */ d(
4979
+ Ul,
4980
4980
  {
4981
4981
  message: C,
4982
4982
  live: p && C === x,
@@ -5000,19 +5000,19 @@ function Dl({
5000
5000
  a ? /* @__PURE__ */ d("p", { role: "alert", className: "text-[12.5px] leading-[1.6] text-destructive", children: a }) : null
5001
5001
  ] });
5002
5002
  }
5003
- const $l = {}, jl = {};
5004
- function Fl(e) {
5003
+ const jl = {}, Fl = {};
5004
+ function Ll(e) {
5005
5005
  return e.parts.map((t) => t.type === "text" ? t.text : "").join("");
5006
5006
  }
5007
- function Ll({ message: e }) {
5007
+ function Bl({ message: e }) {
5008
5008
  var s;
5009
- const t = Fl(e), a = ((s = e.metadata) == null ? void 0 : s.taggedFields) ?? [];
5009
+ const t = Ll(e), a = ((s = e.metadata) == null ? void 0 : s.taggedFields) ?? [];
5010
5010
  return /* @__PURE__ */ d("div", { className: "flex justify-end", "data-message-id": e.id, children: /* @__PURE__ */ v("div", { className: "max-w-[88%] whitespace-pre-wrap break-words rounded-card bg-muted px-2.5 py-1.5 text-[13px] leading-[1.55] text-foreground", children: [
5011
5011
  a.map((r) => /* @__PURE__ */ d("span", { className: "mr-1", children: /* @__PURE__ */ d(qs, { field: r }) }, `${r.role}:${r.name}:${r.aggregate ?? ""}:${r.granularity ?? ""}`)),
5012
5012
  t
5013
5013
  ] }) });
5014
5014
  }
5015
- function Bl({
5015
+ function Ul({
5016
5016
  message: e,
5017
5017
  live: t,
5018
5018
  onExpand: a,
@@ -5028,13 +5028,13 @@ function Bl({
5028
5028
  onAskAgain: p
5029
5029
  }) {
5030
5030
  var N;
5031
- const x = e.parts.find(zl), C = (N = e.parts.find(ql)) == null ? void 0 : N.data, w = e.parts.filter(Vl).map((c) => c.data), A = Gr(e.parts, Ul), k = e.parts.filter(
5031
+ const x = e.parts.find(ql), C = (N = e.parts.find(Vl)) == null ? void 0 : N.data, w = e.parts.filter(Zl).map((c) => c.data), A = Gr(e.parts, zl), k = e.parts.filter(
5032
5032
  (c) => c.type === "text" ? !A.has(c) : c.type.startsWith("data-") && Yr(c.type.slice(5))
5033
5033
  ), T = t ? [...w].reverse().find((c) => c.state === "live") : void 0;
5034
5034
  return /* @__PURE__ */ v("div", { className: "space-y-2", "data-testid": "assistant-answer", "data-message-id": e.id, children: [
5035
5035
  k.map(
5036
- (c, y) => c.type === "text" ? /* @__PURE__ */ d(Ql, { text: c.text }, y) : c.type === "data-refusal" ? /* @__PURE__ */ d("p", { className: "text-[12.5px] leading-[1.6] text-muted-foreground", children: c.data.message }, y) : c.type === "data-artifact" ? /* @__PURE__ */ d(
5037
- ll,
5036
+ (c, y) => c.type === "text" ? /* @__PURE__ */ d(Xl, { text: c.text }, y) : c.type === "data-refusal" ? /* @__PURE__ */ d("p", { className: "text-[12.5px] leading-[1.6] text-muted-foreground", children: c.data.message }, y) : c.type === "data-artifact" ? /* @__PURE__ */ d(
5037
+ dl,
5038
5038
  {
5039
5039
  artifact: c.data.artifact,
5040
5040
  onExpand: a,
@@ -5042,7 +5042,7 @@ function Bl({
5042
5042
  },
5043
5043
  y
5044
5044
  ) : c.type === "data-proposal" ? /* @__PURE__ */ d(
5045
- Al,
5045
+ Cl,
5046
5046
  {
5047
5047
  proposal: c.data,
5048
5048
  state: l[c.data.proposalId],
@@ -5050,8 +5050,8 @@ function Bl({
5050
5050
  onAskAgain: p
5051
5051
  },
5052
5052
  y
5053
- ) : c.type === "data-proposal_refused" ? /* @__PURE__ */ d(Cl, { refusal: c.data }, y) : c.type === "data-model_change" ? /* @__PURE__ */ d(
5054
- kl,
5053
+ ) : c.type === "data-proposal_refused" ? /* @__PURE__ */ d(El, { refusal: c.data }, y) : c.type === "data-model_change" ? /* @__PURE__ */ d(
5054
+ _l,
5055
5055
  {
5056
5056
  change: c.data,
5057
5057
  state: m[c.data.proposalId],
@@ -5062,7 +5062,7 @@ function Bl({
5062
5062
  },
5063
5063
  y
5064
5064
  ) : c.type === "data-clarify" ? /* @__PURE__ */ d(
5065
- xl,
5065
+ wl,
5066
5066
  {
5067
5067
  question: c.data.question,
5068
5068
  options: c.data.options,
@@ -5073,26 +5073,26 @@ function Bl({
5073
5073
  ) : null
5074
5074
  ),
5075
5075
  t ? /* @__PURE__ */ d(Js, { step: T }) : null,
5076
- !t && (w.length > 0 || x || C) ? /* @__PURE__ */ d(Wl, { stages: w, using: x == null ? void 0 : x.data, trace: C }) : null
5076
+ !t && (w.length > 0 || x || C) ? /* @__PURE__ */ d(Hl, { stages: w, using: x == null ? void 0 : x.data, trace: C }) : null
5077
5077
  ] });
5078
5078
  }
5079
- function Ul(e) {
5080
- return e.type === "text" ? "text" : e.type === "data-stage" && !e.data.change ? "step" : "other";
5081
- }
5082
5079
  function zl(e) {
5083
- return e.type === "data-using";
5080
+ return e.type === "text" ? Qr(e.text) : e.type === "data-stage" && !e.data.change ? "step" : "other";
5084
5081
  }
5085
5082
  function ql(e) {
5086
- return e.type === "data-trace";
5083
+ return e.type === "data-using";
5087
5084
  }
5088
5085
  function Vl(e) {
5086
+ return e.type === "data-trace";
5087
+ }
5088
+ function Zl(e) {
5089
5089
  return e.type === "data-stage";
5090
5090
  }
5091
- function Zl({ items: e, notes: t }) {
5092
- const a = e.map(Kl), s = a.slice(0, Ia), r = a.slice(Ia);
5091
+ function Jl({ items: e, notes: t }) {
5092
+ const a = e.map(Wl), s = a.slice(0, Ia), r = a.slice(Ia);
5093
5093
  return /* @__PURE__ */ v("div", { className: "space-y-0.5", "data-testid": "assistant-using", children: [
5094
5094
  /* @__PURE__ */ v("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "What this answer used", children: [
5095
- s.map((l, i) => /* @__PURE__ */ d(Jl, { children: l }, i)),
5095
+ s.map((l, i) => /* @__PURE__ */ d(Kl, { children: l }, i)),
5096
5096
  r.length ? /* @__PURE__ */ v(Ba, { children: [
5097
5097
  /* @__PURE__ */ d(Ua, { asChild: !0, children: /* @__PURE__ */ v("button", { type: "button", "aria-label": `${r.length} more`, className: Vs, children: [
5098
5098
  "+",
@@ -5105,10 +5105,10 @@ function Zl({ items: e, notes: t }) {
5105
5105
  ] });
5106
5106
  }
5107
5107
  const Vs = "inline-flex h-5 min-w-0 max-w-full items-center truncate whitespace-nowrap rounded-control border border-border bg-muted/50 px-1.5 text-[11px] text-muted-foreground";
5108
- function Jl({ children: e }) {
5108
+ function Kl({ children: e }) {
5109
5109
  return /* @__PURE__ */ d("span", { className: Vs, title: e, children: e });
5110
5110
  }
5111
- function Kl(e) {
5111
+ function Wl(e) {
5112
5112
  switch (e.kind) {
5113
5113
  case "card":
5114
5114
  return e.change ? `${e.title} ${e.change}` : e.title;
@@ -5124,12 +5124,12 @@ function Kl(e) {
5124
5124
  return e.label;
5125
5125
  }
5126
5126
  }
5127
- function Wl({
5127
+ function Hl({
5128
5128
  stages: e,
5129
5129
  using: t,
5130
5130
  trace: a
5131
5131
  }) {
5132
- const s = Hl(e), r = e.length ? `${e.length} ${e.length === 1 ? "step" : "steps"}` : "Details";
5132
+ const s = Gl(e), r = e.length ? `${e.length} ${e.length === 1 ? "step" : "steps"}` : "Details";
5133
5133
  return /* @__PURE__ */ d(
5134
5134
  Ut,
5135
5135
  {
@@ -5137,27 +5137,27 @@ function Wl({
5137
5137
  chevron: !1,
5138
5138
  label: /* @__PURE__ */ v(Me, { children: [
5139
5139
  r,
5140
- a ? /* @__PURE__ */ d(gl, { trace: a }) : null
5140
+ a ? /* @__PURE__ */ d(yl, { trace: a }) : null
5141
5141
  ] }),
5142
5142
  children: /* @__PURE__ */ v("div", { className: "space-y-2", children: [
5143
5143
  s.length ? /* @__PURE__ */ d("ul", { className: "space-y-1", "aria-label": "Steps", children: s.map(({ stage: l, ids: i }) => (
5144
5144
  // Top-aligned: the icon sits on the first line when a label wraps.
5145
5145
  /* @__PURE__ */ v("li", { className: "flex items-start gap-1.5 text-[12px] leading-[1.5] text-muted-foreground", children: [
5146
- /* @__PURE__ */ d("span", { className: "mt-[3px] shrink-0", children: /* @__PURE__ */ d(Gl, { stage: l }) }),
5146
+ /* @__PURE__ */ d("span", { className: "mt-[3px] shrink-0", children: /* @__PURE__ */ d(Yl, { stage: l }) }),
5147
5147
  /* @__PURE__ */ v("span", { className: B("min-w-0 flex-1", l.state === "skipped" && "line-through opacity-70"), children: [
5148
5148
  l.label,
5149
5149
  i.length > 1 ? ` (${i.length})` : ""
5150
5150
  ] }),
5151
- /* @__PURE__ */ d(hl, { trace: a, stageIds: i })
5151
+ /* @__PURE__ */ d(gl, { trace: a, stageIds: i })
5152
5152
  ] }, l.stageId)
5153
5153
  )) }) : null,
5154
- t ? /* @__PURE__ */ d(Zl, { items: t.items, notes: t.notes }) : null,
5155
- a ? /* @__PURE__ */ d(yl, { trace: a, stages: e }) : null
5154
+ t ? /* @__PURE__ */ d(Jl, { items: t.items, notes: t.notes }) : null,
5155
+ a ? /* @__PURE__ */ d(bl, { trace: a, stages: e }) : null
5156
5156
  ] })
5157
5157
  }
5158
5158
  );
5159
5159
  }
5160
- function Hl(e) {
5160
+ function Gl(e) {
5161
5161
  const t = [];
5162
5162
  for (const a of e) {
5163
5163
  const s = t.at(-1);
@@ -5171,9 +5171,9 @@ const Zs = {
5171
5171
  analyze: Fa,
5172
5172
  sql: fr,
5173
5173
  change: _a,
5174
- retry: Dn
5174
+ retry: $n
5175
5175
  };
5176
- function Gl({ stage: e }) {
5176
+ function Yl({ stage: e }) {
5177
5177
  if (e.activity) {
5178
5178
  const t = Zs[e.activity];
5179
5179
  return /* @__PURE__ */ d(t, { className: "h-3 w-3", "aria-hidden": "true" });
@@ -5184,11 +5184,11 @@ function Js({ step: e }) {
5184
5184
  const t = (e == null ? void 0 : e.label) ?? "Thinking", a = e != null && e.activity ? Zs[e.activity] : void 0;
5185
5185
  return /* @__PURE__ */ d("div", { className: "flex h-5 min-w-0 items-center", "data-testid": "assistant-working-line", children: /* @__PURE__ */ v("p", { role: "status", "aria-label": t, className: "flex min-w-0 items-center gap-1.5 text-[12px] text-muted-foreground", children: [
5186
5186
  a ? /* @__PURE__ */ d(a, { className: "h-3 w-3 shrink-0", "aria-hidden": "true" }) : null,
5187
- /* @__PURE__ */ d("span", { className: B("min-w-0 truncate", Yl), children: t })
5187
+ /* @__PURE__ */ d("span", { className: B("min-w-0 truncate", Ql), children: t })
5188
5188
  ] }) });
5189
5189
  }
5190
- const Yl = "motion-safe:bg-[linear-gradient(90deg,hsl(var(--semaphor-muted-foreground))_40%,hsl(var(--semaphor-foreground))_50%,hsl(var(--semaphor-muted-foreground))_60%)] motion-safe:bg-[length:200%_100%] motion-safe:bg-clip-text motion-safe:text-transparent motion-safe:animate-assistant-shimmer";
5191
- function Ql({ text: e }) {
5190
+ const Ql = "motion-safe:bg-[linear-gradient(90deg,hsl(var(--semaphor-muted-foreground))_40%,hsl(var(--semaphor-foreground))_50%,hsl(var(--semaphor-muted-foreground))_60%)] motion-safe:bg-[length:200%_100%] motion-safe:bg-clip-text motion-safe:text-transparent motion-safe:animate-assistant-shimmer";
5191
+ function Xl({ text: e }) {
5192
5192
  return /* @__PURE__ */ d("div", { className: "break-words text-[13px] leading-[1.6] text-foreground", children: /* @__PURE__ */ d(
5193
5193
  yr,
5194
5194
  {
@@ -5211,13 +5211,13 @@ function Ql({ text: e }) {
5211
5211
  }
5212
5212
  ) });
5213
5213
  }
5214
- const Xl = [
5214
+ const ed = [
5215
5215
  { layout: "docked-right", label: "Dock right", short: "Right", icon: Ha },
5216
- { layout: "docked-left", label: "Dock left", short: "Left", icon: Pn },
5217
- { layout: "centered", label: "Centered", short: "Center", icon: kn },
5216
+ { layout: "docked-left", label: "Dock left", short: "Left", icon: Dn },
5217
+ { layout: "centered", label: "Centered", short: "Center", icon: _n },
5218
5218
  { layout: "full-page", label: "Full page", short: "Full", icon: Sr }
5219
5219
  ];
5220
- function ed({
5220
+ function td({
5221
5221
  layout: e,
5222
5222
  onLayout: t,
5223
5223
  allows: a,
@@ -5254,7 +5254,7 @@ function ed({
5254
5254
  /* @__PURE__ */ v(Nr, { align: "end", className: "w-64", children: [
5255
5255
  e && t ? /* @__PURE__ */ v(Me, { children: [
5256
5256
  /* @__PURE__ */ d(Ir, { className: "text-[11px] font-medium text-muted-foreground", children: "Layout" }),
5257
- /* @__PURE__ */ d("div", { className: "grid grid-cols-4 gap-1 px-1 pb-1", role: "group", "aria-label": "Layout", children: Xl.map((h) => {
5257
+ /* @__PURE__ */ d("div", { className: "grid grid-cols-4 gap-1 px-1 pb-1", role: "group", "aria-label": "Layout", children: ed.map((h) => {
5258
5258
  const u = h.layout === e;
5259
5259
  return /* @__PURE__ */ v(
5260
5260
  ut,
@@ -5283,14 +5283,14 @@ function ed({
5283
5283
  "Copy conversation"
5284
5284
  ] }),
5285
5285
  a != null && a.toolCalls ? /* @__PURE__ */ v(ut, { className: "text-[12.5px]", disabled: !s, onSelect: () => g("tool_calls"), children: [
5286
- /* @__PURE__ */ d(Rn, { className: "mr-2 h-3.5 w-3.5 text-muted-foreground" }),
5286
+ /* @__PURE__ */ d(Pn, { className: "mr-2 h-3.5 w-3.5 text-muted-foreground" }),
5287
5287
  "Copy with tool calls"
5288
5288
  ] }) : null
5289
5289
  ] })
5290
5290
  ] })
5291
5291
  ] });
5292
5292
  }
5293
- function td(e) {
5293
+ function ad(e) {
5294
5294
  const t = typeof navigator > "u" ? void 0 : navigator.clipboard;
5295
5295
  if (!t) return Promise.reject(new Error("No clipboard here."));
5296
5296
  if (typeof ClipboardItem < "u" && typeof t.write == "function") {
@@ -5299,7 +5299,7 @@ function td(e) {
5299
5299
  }
5300
5300
  return e.then((a) => t.writeText(a));
5301
5301
  }
5302
- function ad({
5302
+ function sd({
5303
5303
  instanceId: e,
5304
5304
  connection: t,
5305
5305
  currentId: a,
@@ -5311,7 +5311,7 @@ function ad({
5311
5311
  var T;
5312
5312
  const m = Pa({
5313
5313
  queryKey: Tt(e),
5314
- queryFn: ({ signal: N }) => Li(t(), N),
5314
+ queryFn: ({ signal: N }) => Bi(t(), N),
5315
5315
  staleTime: 0,
5316
5316
  // A failed read says so at once, whichever client the host mounted.
5317
5317
  retry: !1
@@ -5322,7 +5322,7 @@ function ad({
5322
5322
  }, k = async (N) => {
5323
5323
  C(void 0), p((c) => new Set(c).add(N)), r(N);
5324
5324
  try {
5325
- await Bi(t(), N);
5325
+ await Ui(t(), N);
5326
5326
  } catch (c) {
5327
5327
  p((y) => {
5328
5328
  const f = new Set(y);
@@ -5359,7 +5359,7 @@ function ad({
5359
5359
  /* @__PURE__ */ d("span", { className: "truncate text-[12.5px] text-foreground", children: N.title }),
5360
5360
  o === N.conversationId ? /* @__PURE__ */ d(_e, { className: "h-3 w-3 shrink-0 animate-spin text-muted-foreground", "aria-label": "Opening" }) : null
5361
5361
  ] }),
5362
- /* @__PURE__ */ d("span", { className: "text-[11px] text-muted-foreground", children: Mn(new Date(N.lastActivityAt), { addSuffix: !0 }) })
5362
+ /* @__PURE__ */ d("span", { className: "text-[11px] text-muted-foreground", children: kn(new Date(N.lastActivityAt), { addSuffix: !0 }) })
5363
5363
  ]
5364
5364
  }
5365
5365
  ),
@@ -5383,17 +5383,17 @@ function ad({
5383
5383
  ] })
5384
5384
  ] });
5385
5385
  }
5386
- const sd = 8;
5386
+ const rd = 8;
5387
5387
  function Ks(e, t, a) {
5388
5388
  return Pa({
5389
5389
  queryKey: ks(e),
5390
- queryFn: ({ signal: s }) => Fi(t(), s),
5390
+ queryFn: ({ signal: s }) => Li(t(), s),
5391
5391
  enabled: a,
5392
5392
  // A failed read says so at once, whichever client the host mounted.
5393
5393
  retry: !1
5394
5394
  });
5395
5395
  }
5396
- function rd({
5396
+ function nd({
5397
5397
  instanceId: e,
5398
5398
  connection: t,
5399
5399
  added: a,
@@ -5433,7 +5433,7 @@ function rd({
5433
5433
  );
5434
5434
  }) });
5435
5435
  }
5436
- function nd({
5436
+ function od({
5437
5437
  instanceId: e,
5438
5438
  connection: t,
5439
5439
  added: a,
@@ -5466,7 +5466,7 @@ function nd({
5466
5466
  /* @__PURE__ */ d(_e, { className: "h-3 w-3 animate-spin" }),
5467
5467
  "Loading"
5468
5468
  ] }) : o.isError ? /* @__PURE__ */ d("p", { className: "px-1.5 py-1 text-[12px] text-muted-foreground", children: "Could not load sources." }) : u.length === 0 ? /* @__PURE__ */ d("p", { className: "px-1.5 py-1 text-[12px] text-muted-foreground", children: "Nothing more to add." }) : /* @__PURE__ */ v(Me, { children: [
5469
- u.length > sd ? /* @__PURE__ */ d(
5469
+ u.length > rd ? /* @__PURE__ */ d(
5470
5470
  "input",
5471
5471
  {
5472
5472
  "aria-label": "Search sources",
@@ -5477,7 +5477,7 @@ function nd({
5477
5477
  }
5478
5478
  ) : null,
5479
5479
  /* @__PURE__ */ d(
5480
- od,
5480
+ id,
5481
5481
  {
5482
5482
  entries: x,
5483
5483
  onPick: (C) => {
@@ -5490,7 +5490,7 @@ function nd({
5490
5490
  }
5491
5491
  );
5492
5492
  }
5493
- function od({ entries: e, onPick: t }) {
5493
+ function id({ entries: e, onPick: t }) {
5494
5494
  const a = /* @__PURE__ */ new Map();
5495
5495
  for (const s of e) {
5496
5496
  const r = s.group === "connections" ? "Connections" : s.domainLabel ?? "Datasets";
@@ -5512,7 +5512,7 @@ function od({ entries: e, onPick: t }) {
5512
5512
  ))
5513
5513
  ] }, s)) });
5514
5514
  }
5515
- function id(e) {
5515
+ function ld(e) {
5516
5516
  const [t, a] = $([]), s = e ? t.filter((i) => i.cardId === e).map((i) => i.field) : [], r = s.length >= Ue.taggedFields, l = (i) => !!e && !r && !s.some((m) => Nt(m, i));
5517
5517
  return {
5518
5518
  shown: s,
@@ -5536,14 +5536,14 @@ function Ws(e, t) {
5536
5536
  const a = /(?:^|\s)@([^\s@]*)$/.exec(e.slice(0, t));
5537
5537
  return a ? a[1] : void 0;
5538
5538
  }
5539
- function ld(e, t) {
5539
+ function dd(e, t) {
5540
5540
  const a = Ws(e, t);
5541
5541
  if (a === void 0) return { text: e, caret: t };
5542
5542
  const s = t - a.length - 1;
5543
5543
  return { text: e.slice(0, s) + e.slice(t), caret: s };
5544
5544
  }
5545
- const dd = [], cd = { withRequest: !0 };
5546
- function qd({
5545
+ const cd = [], ud = { withRequest: !0 };
5546
+ function Vd({
5547
5547
  instance: e,
5548
5548
  surface: t = "dashboard",
5549
5549
  placement: a
@@ -5554,13 +5554,13 @@ function qd({
5554
5554
  var P;
5555
5555
  return l && S.dashboard ? (P = jr(S.dashboard, l.cardId)) == null ? void 0 : P.card : void 0;
5556
5556
  }
5557
- ), x = fd(s), C = te(void 0), [w] = $(() => $n(t)), [A, k] = $([]), T = H(
5557
+ ), x = hd(s), C = te(void 0), [w] = $(() => jn(t)), [A, k] = $([]), T = H(
5558
5558
  (S) => {
5559
5559
  C.current = S;
5560
- const P = ud(
5560
+ const P = pd(
5561
5561
  () => w({ focus: e.store.getState().focus, snapshot: S, editing: Hs(s) })
5562
5562
  );
5563
- k((X) => pd(X, P) ? X : P);
5563
+ k((X) => md(X, P) ? X : P);
5564
5564
  },
5565
5565
  [e, w, s]
5566
5566
  ), N = Da(), c = () => {
@@ -5569,10 +5569,10 @@ function qd({
5569
5569
  apiServiceUrl: (S = r.tokenProps) == null ? void 0 : S.apiServiceUrl,
5570
5570
  accessToken: (P = r.authToken) == null ? void 0 : P.accessToken
5571
5571
  };
5572
- }, y = jn({ surface: t }), { canChangeNow: f } = Za(t === "dashboard"), b = zr(f), I = Hi({
5572
+ }, y = Fn({ surface: t }), { canChangeNow: f } = Za(t === "dashboard"), b = zr(f), I = Gi({
5573
5573
  canChangeOpenDashboard: f,
5574
5574
  applyProposal: b,
5575
- readContext: () => w({ focus: e.store.getState().focus, snapshot: C.current, editing: hd(s) }),
5575
+ readContext: () => w({ focus: e.store.getState().focus, snapshot: C.current, editing: gd(s) }),
5576
5576
  connection: c,
5577
5577
  onStaleFocus: e.clearFocus,
5578
5578
  onTurnFinished: () => void Mt(N, Tt(e.id)),
@@ -5593,14 +5593,14 @@ function qd({
5593
5593
  const { focus: S, beside: P } = e.store.getState();
5594
5594
  S && Pe.current(S.cardId, { beside: P });
5595
5595
  }, [m, e]);
5596
- const De = (x == null ? void 0 : x.id) ?? (p == null ? void 0 : p.id), z = id(De), ce = De ? A : [], [ve, xe] = $(), me = ve ? z.available(ce).filter((S) => S.label.toLowerCase().includes(ve.query.toLowerCase())) : [], ue = ve && me.length ? { ...ve, active: Math.min(ve.active, me.length - 1) } : void 0, R = te(void 0);
5596
+ const De = (x == null ? void 0 : x.id) ?? (p == null ? void 0 : p.id), z = ld(De), ce = De ? A : [], [ve, xe] = $(), me = ve ? z.available(ce).filter((S) => S.label.toLowerCase().includes(ve.query.toLowerCase())) : [], ue = ve && me.length ? { ...ve, active: Math.min(ve.active, me.length - 1) } : void 0, R = te(void 0);
5597
5597
  ke(() => {
5598
5598
  var S;
5599
5599
  R.current !== void 0 && ((S = V.current) == null || S.setSelectionRange(R.current, R.current), R.current = void 0);
5600
5600
  }, [M]);
5601
5601
  const E = (S) => {
5602
5602
  z.add(S);
5603
- const P = V.current, X = ld(M, (P == null ? void 0 : P.selectionStart) ?? M.length);
5603
+ const P = V.current, X = dd(M, (P == null ? void 0 : P.selectionStart) ?? M.length);
5604
5604
  X.text !== M && (R.current = X.caret, F(X.text)), xe(void 0), P == null || P.focus();
5605
5605
  }, _ = (S) => {
5606
5606
  S == null || S.preventDefault(), I.send(M, z.shown) === "sent" && (F(""), z.clear());
@@ -5634,7 +5634,7 @@ function qd({
5634
5634
  return;
5635
5635
  }
5636
5636
  S.key === "Enter" && !S.shiftKey && !S.nativeEvent.isComposing && _(S);
5637
- }, J = I.messages.length === 0, [U, Q] = $(), we = (U == null ? void 0 : U.sessionKey) === I.sessionKey ? md(I.messages, U.artifactId) : void 0, fe = (S) => {
5637
+ }, J = I.messages.length === 0, [U, Q] = $(), we = (U == null ? void 0 : U.sessionKey) === I.sessionKey ? fd(I.messages, U.artifactId) : void 0, fe = (S) => {
5638
5638
  Q((P) => ({ sessionKey: I.sessionKey, artifactId: S, opened: ((P == null ? void 0 : P.opened) ?? 0) + 1 })), e.leaveBeside(), o !== "full-page" && e.setLayout("full-page");
5639
5639
  }, Ne = h === "full-page", zt = /* @__PURE__ */ d(
5640
5640
  Z,
@@ -5663,13 +5663,13 @@ function qd({
5663
5663
  children: /* @__PURE__ */ d(Ke, { className: "h-3.5 w-3.5" })
5664
5664
  }
5665
5665
  ), qt = /* @__PURE__ */ d(
5666
- ed,
5666
+ td,
5667
5667
  {
5668
5668
  ...s ? {} : { layout: o, onLayout: e.setLayout },
5669
5669
  allows: I.allows,
5670
5670
  canCopy: !!I.conversationId && !I.busy && !I.loading,
5671
- onCopy: (S) => td(
5672
- I.readForCopy(S).then((P) => Qr(P, { assistantName: e.assistantName, toolCalls: S }))
5671
+ onCopy: (S) => ad(
5672
+ I.readForCopy(S).then((P) => Xr(P, { assistantName: e.assistantName, toolCalls: S }))
5673
5673
  )
5674
5674
  }
5675
5675
  ), et = J && Ne && !I.loading, Gs = /* @__PURE__ */ v("footer", { className: B("shrink-0 space-y-2", et ? "px-0" : "p-3"), children: [
@@ -5699,7 +5699,7 @@ function qd({
5699
5699
  )
5700
5700
  ] }) : null,
5701
5701
  /* @__PURE__ */ d(
5702
- rd,
5702
+ nd,
5703
5703
  {
5704
5704
  instanceId: e.id,
5705
5705
  connection: c,
@@ -5709,7 +5709,7 @@ function qd({
5709
5709
  ),
5710
5710
  I.notice ? /* @__PURE__ */ d("p", { role: "alert", className: "text-[12px] leading-[1.5] text-destructive", children: I.notice }) : null,
5711
5711
  /* @__PURE__ */ v("form", { onSubmit: _, className: "relative rounded-control border border-input bg-background focus-within:border-ring", children: [
5712
- ue ? /* @__PURE__ */ d(Il, { fields: me, active: ue.active, onPick: E }) : null,
5712
+ ue ? /* @__PURE__ */ d(Sl, { fields: me, active: ue.active, onPick: E }) : null,
5713
5713
  z.shown.length ? (
5714
5714
  // The tagged fields sit in the question itself, before its words.
5715
5715
  /* @__PURE__ */ d("div", { className: "flex flex-wrap gap-1 px-2.5 pt-2", "data-testid": "assistant-question-tags", children: z.shown.map((S) => /* @__PURE__ */ d(qs, { field: S, onRemove: () => z.remove(S) }, `${S.role}:${S.name}:${S.aggregate ?? ""}:${S.granularity ?? ""}`)) })
@@ -5736,7 +5736,7 @@ function qd({
5736
5736
  /* @__PURE__ */ v("div", { className: "flex items-end justify-between gap-2 px-1.5 pb-1.5", children: [
5737
5737
  /* @__PURE__ */ v("div", { className: "flex items-center gap-0.5", children: [
5738
5738
  /* @__PURE__ */ d(
5739
- nd,
5739
+ od,
5740
5740
  {
5741
5741
  instanceId: e.id,
5742
5742
  connection: c,
@@ -5794,7 +5794,7 @@ function qd({
5794
5794
  // Full page stacks on a narrow screen: the sidebar's title row becomes a top bar.
5795
5795
  /* @__PURE__ */ v("div", { className: B("relative flex h-full min-h-0 w-full", Ne && "flex-col md:flex-row"), children: [
5796
5796
  Ne ? /* @__PURE__ */ d(
5797
- ad,
5797
+ sd,
5798
5798
  {
5799
5799
  instanceId: e.id,
5800
5800
  connection: c,
@@ -5877,7 +5877,7 @@ function qd({
5877
5877
  et ? /* @__PURE__ */ d("h3", { className: "mb-3 text-center text-[17px] font-semibold text-foreground", children: "What would you like to know?" }) : (
5878
5878
  // A replaced session starts its own scroll: a new one at the top, an opened one at its end.
5879
5879
  /* @__PURE__ */ d(
5880
- bd,
5880
+ vd,
5881
5881
  {
5882
5882
  conversation: I,
5883
5883
  empty: J,
@@ -5904,22 +5904,22 @@ function qd({
5904
5904
  ] }),
5905
5905
  Ne && U && we ? (
5906
5906
  // Beside the conversation; on a narrow screen, where the page stacks, it covers it.
5907
- /* @__PURE__ */ d("aside", { className: "absolute inset-0 z-20 h-full bg-background md:static md:w-[min(560px,45%)] md:shrink-0 md:border-l md:border-border", children: /* @__PURE__ */ d(ul, { artifact: we, onClose: () => Q(void 0) }, U.opened) })
5907
+ /* @__PURE__ */ d("aside", { className: "absolute inset-0 z-20 h-full bg-background md:static md:w-[min(560px,45%)] md:shrink-0 md:border-l md:border-border", children: /* @__PURE__ */ d(pl, { artifact: we, onClose: () => Q(void 0) }, U.opened) })
5908
5908
  ) : null
5909
5909
  ] })
5910
5910
  );
5911
5911
  }
5912
- function ud(e) {
5912
+ function pd(e) {
5913
5913
  try {
5914
- return Xr(e().context);
5914
+ return en(e().context);
5915
5915
  } catch {
5916
5916
  return [];
5917
5917
  }
5918
5918
  }
5919
- function pd(e, t) {
5919
+ function md(e, t) {
5920
5920
  return e.length === t.length && e.every((a, s) => Nt(a, t[s]) && a.label === t[s].label);
5921
5921
  }
5922
- function md(e, t) {
5922
+ function fd(e, t) {
5923
5923
  for (const a of e)
5924
5924
  for (const s of a.parts)
5925
5925
  if (s.type === "data-artifact" && s.data.artifact.artifactId === t) return s.data.artifact;
@@ -5929,16 +5929,16 @@ function Sa({
5929
5929
  draft: t,
5930
5930
  onSnapshot: a
5931
5931
  }) {
5932
- const s = Or(e, dd, void 0, cd);
5932
+ const s = Or(e, cd, void 0, ud);
5933
5933
  return ke(() => {
5934
5934
  a({ cardId: e.id, draft: t, card: e, snapshot: s });
5935
5935
  }, [e, t, s, a]), null;
5936
5936
  }
5937
- function fd(e) {
5937
+ function hd(e) {
5938
5938
  const t = W((s) => s.isVisualEditing), a = ja((s) => s.card);
5939
5939
  return !e && t ? a : void 0;
5940
5940
  }
5941
- function hd(e) {
5941
+ function gd(e) {
5942
5942
  if (!(e || !W.getState().isVisualEditing))
5943
5943
  return $a(), Hs(e);
5944
5944
  }
@@ -5947,7 +5947,7 @@ function Hs(e) {
5947
5947
  const t = ja.getState();
5948
5948
  return { card: t.card, mode: t.isDevMode ? "sql" : "visual" };
5949
5949
  }
5950
- function gd(e) {
5950
+ function yd(e) {
5951
5951
  const t = e.getBoundingClientRect().top;
5952
5952
  for (const a of e.querySelectorAll("[data-message-id]")) {
5953
5953
  const s = a.getBoundingClientRect();
@@ -5956,7 +5956,7 @@ function gd(e) {
5956
5956
  return { id: a.dataset.messageId, into: r };
5957
5957
  }
5958
5958
  }
5959
- function yd(e, t) {
5959
+ function bd(e, t) {
5960
5960
  const a = Array.from(e.querySelectorAll("[data-message-id]")).find(
5961
5961
  (r) => r.dataset.messageId === t.id
5962
5962
  );
@@ -5964,7 +5964,7 @@ function yd(e, t) {
5964
5964
  const s = a.getBoundingClientRect();
5965
5965
  e.scrollTop += s.top + t.into * s.height - e.getBoundingClientRect().top;
5966
5966
  }
5967
- function bd({
5967
+ function vd({
5968
5968
  conversation: e,
5969
5969
  empty: t,
5970
5970
  layout: a,
@@ -5976,7 +5976,7 @@ function bd({
5976
5976
  const m = te(null), [g, o] = $(!0), h = te(void 0), u = te(a);
5977
5977
  ke(() => {
5978
5978
  const w = m.current;
5979
- !w || u.current === a || (u.current = a, g ? w.scrollTop = w.scrollHeight : h.current && yd(w, h.current));
5979
+ !w || u.current === a || (u.current = a, g ? w.scrollTop = w.scrollHeight : h.current && bd(w, h.current));
5980
5980
  }, [a, g]);
5981
5981
  const p = e.messages.at(-1), x = Je(
5982
5982
  () => `${e.messages.length}:${(p == null ? void 0 : p.parts.length) ?? 0}:${e.status}:${e.failure ?? ""}`,
@@ -5996,10 +5996,10 @@ function bd({
5996
5996
  "data-testid": "assistant-transcript",
5997
5997
  onScroll: (w) => {
5998
5998
  const A = w.currentTarget;
5999
- o(A.scrollHeight - A.scrollTop - A.clientHeight < 24), h.current = gd(A);
5999
+ o(A.scrollHeight - A.scrollTop - A.clientHeight < 24), h.current = yd(A);
6000
6000
  },
6001
6001
  children: t ? null : /* @__PURE__ */ d(
6002
- Dl,
6002
+ $l,
6003
6003
  {
6004
6004
  messages: e.messages,
6005
6005
  status: e.status,
@@ -6034,5 +6034,5 @@ function bd({
6034
6034
  ] });
6035
6035
  }
6036
6036
  export {
6037
- qd as default
6037
+ Vd as default
6038
6038
  };