teodor-new-chat-ui 4.3.318 → 4.3.319

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.
package/dist/index.esm.js CHANGED
@@ -2,7 +2,7 @@ var tm = Object.defineProperty;
2
2
  var nm = (e, t, n) => t in e ? tm(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
3
  var cl = (e, t, n) => nm(e, typeof t != "symbol" ? t + "" : t, n);
4
4
  import * as y from "react";
5
- import te, { createContext as ao, useContext as ms, useMemo as Ve, useState as be, useRef as Ke, useCallback as ye, useEffect as kt, useReducer as rm, useLayoutEffect as om, createElement as Oo, memo as sm, useImperativeHandle as im } from "react";
5
+ import te, { createContext as ao, useContext as ms, useMemo as Ke, useState as be, useRef as qe, useCallback as ye, useEffect as kt, useReducer as rm, useLayoutEffect as om, createElement as Oo, memo as sm, useImperativeHandle as im } from "react";
6
6
  import { Square as am, Send as lm, ChevronRight as Xc, Check as aa, Circle as cm, X as vr, ExternalLink as um, Download as dm, Image as fm, FileText as ul, Loader as la, Bot as ni, Wrench as pm, User as hm, Paperclip as Ei, ChevronUp as ca, ChevronDown as gs, ChevronLeft as mm, Copy as dl, Edit as fl, RotateCcw as Ni, Info as gm, Loader2 as Fr, Edit3 as Jc, Plus as xm, FileSpreadsheet as ym, MessageSquarePlus as vm, MessageSquare as wm, Calendar as bm, Trash2 as Sm, Settings as Cm, Server as Tm, EyeOff as km, Eye as Rm, Layout as Im, MessageCircle as Em, Save as Nm } from "lucide-react";
7
7
  import { Slot as Am, createSlot as Tr } from "@radix-ui/react-slot";
8
8
  import { cva as xs } from "class-variance-authority";
@@ -265,17 +265,17 @@ function Om() {
265
265
  }
266
266
  } catch (Z) {
267
267
  if (Z && Re && typeof Z.stack == "string") {
268
- for (var We = Z.stack.split(`
268
+ for (var Ve = Z.stack.split(`
269
269
  `), Pt = Re.stack.split(`
270
- `), yt = We.length - 1, Tt = Pt.length - 1; yt >= 1 && Tt >= 0 && We[yt] !== Pt[Tt]; )
270
+ `), yt = Ve.length - 1, Tt = Pt.length - 1; yt >= 1 && Tt >= 0 && Ve[yt] !== Pt[Tt]; )
271
271
  Tt--;
272
272
  for (; yt >= 1 && Tt >= 0; yt--, Tt--)
273
- if (We[yt] !== Pt[Tt]) {
273
+ if (Ve[yt] !== Pt[Tt]) {
274
274
  if (yt !== 1 || Tt !== 1)
275
275
  do
276
- if (yt--, Tt--, Tt < 0 || We[yt] !== Pt[Tt]) {
276
+ if (yt--, Tt--, Tt < 0 || Ve[yt] !== Pt[Tt]) {
277
277
  var Vt = `
278
- ` + We[yt].replace(" at new ", " at ");
278
+ ` + Ve[yt].replace(" at new ", " at ");
279
279
  return R.displayName && Vt.includes("<anonymous>") && (Vt = Vt.replace("<anonymous>", R.displayName)), typeof R == "function" && re.set(R, Vt), Vt;
280
280
  }
281
281
  while (yt >= 1 && Tt >= 0);
@@ -337,22 +337,22 @@ function Om() {
337
337
  var dt = Function.call.bind(Qe);
338
338
  for (var Xe in R)
339
339
  if (dt(R, Xe)) {
340
- var We = void 0;
340
+ var Ve = void 0;
341
341
  try {
342
342
  if (typeof R[Xe] != "function") {
343
343
  var Pt = Error((Re || "React class") + ": " + ae + " type `" + Xe + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof R[Xe] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
344
344
  throw Pt.name = "Invariant Violation", Pt;
345
345
  }
346
- We = R[Xe](V, Xe, Re, ae, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
346
+ Ve = R[Xe](V, Xe, Re, ae, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
347
347
  } catch (yt) {
348
- We = yt;
348
+ Ve = yt;
349
349
  }
350
- We && !(We instanceof Error) && (he(st), w("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", Re || "React class", ae, Xe, typeof We), he(null)), We instanceof Error && !(We.message in rt) && (rt[We.message] = !0, he(st), w("Failed %s type: %s", ae, We.message), he(null));
350
+ Ve && !(Ve instanceof Error) && (he(st), w("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", Re || "React class", ae, Xe, typeof Ve), he(null)), Ve instanceof Error && !(Ve.message in rt) && (rt[Ve.message] = !0, he(st), w("Failed %s type: %s", ae, Ve.message), he(null));
351
351
  }
352
352
  }
353
353
  }
354
354
  var He = Array.isArray;
355
- function qe(R) {
355
+ function Ge(R) {
356
356
  return He(R);
357
357
  }
358
358
  function et(R) {
@@ -400,7 +400,7 @@ function Om() {
400
400
  function Ct(R, V) {
401
401
  typeof R.ref == "string" && ht.current;
402
402
  }
403
- function Ge(R, V) {
403
+ function We(R, V) {
404
404
  {
405
405
  var ae = function() {
406
406
  xt || (xt = !0, w("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", V));
@@ -423,7 +423,7 @@ function Om() {
423
423
  }
424
424
  }
425
425
  var _e = function(R, V, ae, Re, st, dt, Xe) {
426
- var We = {
426
+ var Ve = {
427
427
  // This tag allows us to uniquely identify this as a React Element
428
428
  $$typeof: t,
429
429
  // Built-in properties that belong on the element
@@ -434,27 +434,27 @@ function Om() {
434
434
  // Record the component responsible for creating this element.
435
435
  _owner: dt
436
436
  };
437
- return We._store = {}, Object.defineProperty(We._store, "validated", {
437
+ return Ve._store = {}, Object.defineProperty(Ve._store, "validated", {
438
438
  configurable: !1,
439
439
  enumerable: !1,
440
440
  writable: !0,
441
441
  value: !1
442
- }), Object.defineProperty(We, "_self", {
442
+ }), Object.defineProperty(Ve, "_self", {
443
443
  configurable: !1,
444
444
  enumerable: !1,
445
445
  writable: !1,
446
446
  value: Re
447
- }), Object.defineProperty(We, "_source", {
447
+ }), Object.defineProperty(Ve, "_source", {
448
448
  configurable: !1,
449
449
  enumerable: !1,
450
450
  writable: !1,
451
451
  value: st
452
- }), Object.freeze && (Object.freeze(We.props), Object.freeze(We)), We;
452
+ }), Object.freeze && (Object.freeze(Ve.props), Object.freeze(Ve)), Ve;
453
453
  };
454
454
  function Ne(R, V, ae, Re, st) {
455
455
  {
456
- var dt, Xe = {}, We = null, Pt = null;
457
- ae !== void 0 && (Et(ae), We = "" + ae), St(V) && (Et(V.key), We = "" + V.key), Nt(V) && (Pt = V.ref, Ct(V, st));
456
+ var dt, Xe = {}, Ve = null, Pt = null;
457
+ ae !== void 0 && (Et(ae), Ve = "" + ae), St(V) && (Et(V.key), Ve = "" + V.key), Nt(V) && (Pt = V.ref, Ct(V, st));
458
458
  for (dt in V)
459
459
  Qe.call(V, dt) && !Ue.hasOwnProperty(dt) && (Xe[dt] = V[dt]);
460
460
  if (R && R.defaultProps) {
@@ -462,11 +462,11 @@ function Om() {
462
462
  for (dt in yt)
463
463
  Xe[dt] === void 0 && (Xe[dt] = yt[dt]);
464
464
  }
465
- if (We || Pt) {
465
+ if (Ve || Pt) {
466
466
  var Tt = typeof R == "function" ? R.displayName || R.name || "Unknown" : R;
467
- We && Ge(Xe, Tt), Pt && zt(Xe, Tt);
467
+ Ve && We(Xe, Tt), Pt && zt(Xe, Tt);
468
468
  }
469
- return _e(R, We, Pt, st, Re, ht.current, Xe);
469
+ return _e(R, Ve, Pt, st, Re, ht.current, Xe);
470
470
  }
471
471
  }
472
472
  var ut = g.ReactCurrentOwner, G = g.ReactDebugCurrentFrame;
@@ -527,7 +527,7 @@ Check the top-level render call using <` + ae + ">.");
527
527
  {
528
528
  if (typeof R != "object")
529
529
  return;
530
- if (qe(R))
530
+ if (Ge(R))
531
531
  for (var ae = 0; ae < R.length; ae++) {
532
532
  var Re = R[ae];
533
533
  Te(Re) && Le(Re, V);
@@ -584,12 +584,12 @@ Check the top-level render call using <` + ae + ">.");
584
584
  {
585
585
  var Xe = j(R);
586
586
  if (!Xe) {
587
- var We = "";
588
- (R === void 0 || typeof R == "object" && R !== null && Object.keys(R).length === 0) && (We += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
587
+ var Ve = "";
588
+ (R === void 0 || typeof R == "object" && R !== null && Object.keys(R).length === 0) && (Ve += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
589
589
  var Pt = L();
590
- Pt ? We += Pt : We += De();
590
+ Pt ? Ve += Pt : Ve += De();
591
591
  var yt;
592
- R === null ? yt = "null" : qe(R) ? yt = "array" : R !== void 0 && R.$$typeof === t ? (yt = "<" + ($(R.type) || "Unknown") + " />", We = " Did you accidentally export a JSX literal instead of a component?") : yt = typeof R, w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", yt, We);
592
+ R === null ? yt = "null" : Ge(R) ? yt = "array" : R !== void 0 && R.$$typeof === t ? (yt = "<" + ($(R.type) || "Unknown") + " />", Ve = " Did you accidentally export a JSX literal instead of a component?") : yt = typeof R, w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", yt, Ve);
593
593
  }
594
594
  var Tt = Ne(R, V, ae, st, dt);
595
595
  if (Tt == null)
@@ -598,7 +598,7 @@ Check the top-level render call using <` + ae + ">.");
598
598
  var Vt = V.children;
599
599
  if (Vt !== void 0)
600
600
  if (Re)
601
- if (qe(Vt)) {
601
+ if (Ge(Vt)) {
602
602
  for (var Dn = 0; Dn < Vt.length; Dn++)
603
603
  ge(Vt[Dn], R);
604
604
  Object.freeze && Object.freeze(Vt);
@@ -3049,7 +3049,7 @@ function Ux(e) {
3049
3049
  return t;
3050
3050
  }
3051
3051
  function Wx(e = {}) {
3052
- const t = Ve(() => _n(e.baseUrl), [e.baseUrl]), n = e.streamPath ?? "/runs/stream", [r, o] = be(e.token ?? null), s = Ke(e.headers ?? {}), i = e.credentials ?? "include", [a, l] = be(!1), [c, d] = be(null), [f, p] = be(""), [h, x] = be(null), [m, v] = be(0), [g, w] = be(!1), b = Ke(null), T = Ke(!0), S = Ke(0), C = Ke(null), k = Ke(null), I = Ke(null), N = Ke(null), j = ye((E) => {
3052
+ const t = Ke(() => _n(e.baseUrl), [e.baseUrl]), n = e.streamPath ?? "/runs/stream", [r, o] = be(e.token ?? null), s = qe(e.headers ?? {}), i = e.credentials ?? "include", [a, l] = be(!1), [c, d] = be(null), [f, p] = be(""), [h, x] = be(null), [m, v] = be(0), [g, w] = be(!1), b = qe(null), T = qe(!0), S = qe(0), C = qe(null), k = qe(null), I = qe(null), N = qe(null), j = ye((E) => {
3053
3053
  o(E);
3054
3054
  }, []), A = ye(() => {
3055
3055
  p(""), x(null), d(null), k.current = null, I.current = null, N.current = null;
@@ -3070,11 +3070,11 @@ function Wx(e = {}) {
3070
3070
  const X = (Me) => {
3071
3071
  var He;
3072
3072
  try {
3073
- const qe = JSON.parse(JSON.stringify(Me));
3074
- return (He = qe == null ? void 0 : qe.payload) != null && He.files_info && Array.isArray(qe.payload.files_info) && (qe.payload.files_info = qe.payload.files_info.map((et) => ({
3073
+ const Ge = JSON.parse(JSON.stringify(Me));
3074
+ return (He = Ge == null ? void 0 : Ge.payload) != null && He.files_info && Array.isArray(Ge.payload.files_info) && (Ge.payload.files_info = Ge.payload.files_info.map((et) => ({
3075
3075
  ...et,
3076
3076
  data: et != null && et.data ? `<base64 ${String(et.data).length} chars>` : et == null ? void 0 : et.data
3077
- }))), qe;
3077
+ }))), Ge;
3078
3078
  } catch {
3079
3079
  return Me;
3080
3080
  }
@@ -3109,14 +3109,14 @@ function Wx(e = {}) {
3109
3109
  _e && (He = { "X-Session-Id": _e });
3110
3110
  } catch {
3111
3111
  }
3112
- const qe = {
3112
+ const Ge = {
3113
3113
  ...Me,
3114
3114
  ...He,
3115
3115
  ...s.current
3116
3116
  }, et = {
3117
3117
  "Content-Type": "application/json",
3118
3118
  Accept: "text/event-stream",
3119
- ...qe
3119
+ ...Ge
3120
3120
  }, ze = await fetch(t + n, {
3121
3121
  method: "POST",
3122
3122
  headers: et,
@@ -3124,7 +3124,7 @@ function Wx(e = {}) {
3124
3124
  signal: J.signal,
3125
3125
  credentials: i
3126
3126
  });
3127
- if (C.current && (C.current.headers = qe), !ze.ok || !ze.body) {
3127
+ if (C.current && (C.current.headers = Ge), !ze.ok || !ze.body) {
3128
3128
  const _e = await ze.text().catch(() => "");
3129
3129
  console.debug(
3130
3130
  "[use-chat] non-OK response",
@@ -3149,7 +3149,7 @@ function Wx(e = {}) {
3149
3149
  typeof window < "u" && bt == null && (bt = requestAnimationFrame(Nt));
3150
3150
  };
3151
3151
  let Ct = Date.now();
3152
- const Ge = setInterval(() => {
3152
+ const We = setInterval(() => {
3153
3153
  var _e;
3154
3154
  if (Date.now() - Ct > 18e5) {
3155
3155
  const Ne = "Stream idle timeout";
@@ -3260,7 +3260,7 @@ function Wx(e = {}) {
3260
3260
  } finally {
3261
3261
  (Qe = tt.releaseLock) == null || Qe.call(tt);
3262
3262
  }
3263
- bt !== null && typeof window < "u" && window.cancelAnimationFrame(bt), clearInterval(Ge);
3263
+ bt !== null && typeof window < "u" && window.cancelAnimationFrame(bt), clearInterval(We);
3264
3264
  }
3265
3265
  } catch (Me) {
3266
3266
  if (Me.name === "AbortError")
@@ -3270,13 +3270,13 @@ function Wx(e = {}) {
3270
3270
  z = "error", P = He, d(He), (rt = _ == null ? void 0 : _.onError) == null || rt.call(_, He), U || ((ce = _ == null ? void 0 : _.onConnectionError) == null || ce.call(_, He), U = !0);
3271
3271
  }
3272
3272
  } finally {
3273
- const Me = S.current, He = k.current, qe = I.current, et = N.current, ze = z ?? (J.signal.aborted ? "aborted" : P ? "error" : "complete");
3273
+ const Me = S.current, He = k.current, Ge = I.current, et = N.current, ze = z ?? (J.signal.aborted ? "aborted" : P ? "error" : "complete");
3274
3274
  try {
3275
3275
  (he = _ == null ? void 0 : _.onClosed) == null || he.call(_, {
3276
3276
  reason: ze,
3277
3277
  lastSeq: Me,
3278
3278
  lastCheckpointId: He,
3279
- lastCheckpointNs: qe,
3279
+ lastCheckpointNs: Ge,
3280
3280
  lastStateHistory: et,
3281
3281
  error: P
3282
3282
  });
@@ -3379,7 +3379,7 @@ function Yx(e, t) {
3379
3379
  }
3380
3380
  }
3381
3381
  function Xx(e = []) {
3382
- const [t, n] = rm(Yx, { ...Gx, messages: e }), r = Ke([]), o = Ke(null), s = Ke(null), i = ye(() => {
3382
+ const [t, n] = rm(Yx, { ...Gx, messages: e }), r = qe([]), o = qe(null), s = qe(null), i = ye(() => {
3383
3383
  o.current !== null && typeof window < "u" && window.cancelAnimationFrame(o.current), s.current !== null && clearTimeout(s.current), o.current = null, s.current = null;
3384
3384
  const d = r.current;
3385
3385
  d.length && (r.current = [], n({ type: "batch", payload: { events: d } }));
@@ -3391,7 +3391,7 @@ function Xx(e = []) {
3391
3391
  kt(() => () => {
3392
3392
  o.current !== null && typeof window < "u" && window.cancelAnimationFrame(o.current), s.current !== null && clearTimeout(s.current), r.current = [];
3393
3393
  }, []);
3394
- const c = Ve(() => ({
3394
+ const c = Ke(() => ({
3395
3395
  reset: (d) => n({ type: "reset", payload: { messages: d } }),
3396
3396
  seed: (d, f) => n({ type: "seed", payload: { messages: d, ...f ?? {} } }),
3397
3397
  prepend: (d) => n({ type: "prepend", payload: { messages: d } }),
@@ -3739,7 +3739,7 @@ function ty({
3739
3739
  onAuthError: l,
3740
3740
  onHeartbeat: c
3741
3741
  }) {
3742
- const d = Ke(null), f = Ke(null), p = Ke(/* @__PURE__ */ new Map()), h = Ke(null), x = Ke(null), m = ye((A) => {
3742
+ const d = qe(null), f = qe(null), p = qe(/* @__PURE__ */ new Map()), h = qe(null), x = qe(null), m = ye((A) => {
3743
3743
  try {
3744
3744
  const M = globalThis.structuredClone;
3745
3745
  if (typeof M == "function")
@@ -3920,7 +3920,7 @@ function ty({
3920
3920
  ), j = ye(() => {
3921
3921
  h.current && (h.current.manualStop = !0), S();
3922
3922
  }, [S]);
3923
- return Ve(
3923
+ return Ke(
3924
3924
  () => ({
3925
3925
  startStream: N,
3926
3926
  stop: j,
@@ -3944,10 +3944,10 @@ function ny({
3944
3944
  onAuthError: i,
3945
3945
  onThreadChange: a
3946
3946
  }) {
3947
- const { api: l, baseUrl: c } = Tu(), d = Ve(() => _n(c), [c]), [f, p] = be([]), [h, x] = be(t), [m, v] = be(!1), [g, w] = be(null), [b, T] = be(!1), [S, C] = be(null), { state: k, seed: I, prepend: N, pushUser: j, onEvent: A } = Xx(), [M, $] = be(!1), [E, F] = be(!1), [_, J] = be(null), [z, P] = be([]), [U, X] = be([]), [fe, ie] = be(!1), Ae = Ve(
3947
+ const { api: l, baseUrl: c } = Tu(), d = Ke(() => _n(c), [c]), [f, p] = be([]), [h, x] = be(t), [m, v] = be(!1), [g, w] = be(null), [b, T] = be(!1), [S, C] = be(null), { state: k, seed: I, prepend: N, pushUser: j, onEvent: A } = Xx(), [M, $] = be(!1), [E, F] = be(!1), [_, J] = be(null), [z, P] = be([]), [U, X] = be([]), [fe, ie] = be(!1), Ae = Ke(
3948
3948
  () => z.flatMap((G) => G.messages ?? []),
3949
3949
  [z]
3950
- ), q = Ve(() => Ux(Ae), [Ae]), B = Ke(h), K = Ke(null), D = Ke(null), W = Ke(null), re = Ke(null), oe = Ke(!1), se = Ke(null), Se = Ke(/* @__PURE__ */ new Map()), nt = Ke(/* @__PURE__ */ new Map());
3950
+ ), q = Ke(() => Ux(Ae), [Ae]), B = qe(h), K = qe(null), D = qe(null), W = qe(null), re = qe(null), oe = qe(!1), se = qe(null), Se = qe(/* @__PURE__ */ new Map()), nt = qe(/* @__PURE__ */ new Map());
3951
3951
  kt(() => {
3952
3952
  B.current = h;
3953
3953
  }, [h]);
@@ -3989,7 +3989,7 @@ function ny({
3989
3989
  [I]
3990
3990
  ), ce = ye((G) => {
3991
3991
  console.log("[ChatSessionProvider] 🎯 Received thread_info:", G.threadId), Qe(G), B.current !== G.threadId && ((G.created ?? !B.current) && (D.current = G.threadId), W.current = G.threadId, console.log("[ChatSessionProvider] thread_info: marking to skip auto-load for new thread"), x(G.threadId));
3992
- }, [Qe]), { startStream: he, stop: Me, isStreaming: He, error: qe, setAuthToken: et } = ty({
3992
+ }, [Qe]), { startStream: he, stop: Me, isStreaming: He, error: Ge, setAuthToken: et } = ty({
3993
3993
  baseUrl: d,
3994
3994
  onThreadInfo: ce,
3995
3995
  onMessageEvent: A,
@@ -4195,7 +4195,7 @@ function ny({
4195
4195
  } catch (G) {
4196
4196
  console.warn("[ChatSessionProvider] Failed to refetch agent after clearing thread:", G);
4197
4197
  }
4198
- }, [I, Me, l]), Ge = ye(
4198
+ }, [I, Me, l]), We = ye(
4199
4199
  async (G, ee, Ce) => {
4200
4200
  const Te = B.current;
4201
4201
  if (!Te)
@@ -4256,7 +4256,7 @@ function ny({
4256
4256
  he(Y);
4257
4257
  },
4258
4258
  [l, ze, j, k, he]
4259
- ), _e = Ve(
4259
+ ), _e = Ke(
4260
4260
  () => ({
4261
4261
  threads: f,
4262
4262
  currentThreadId: h,
@@ -4271,7 +4271,7 @@ function ny({
4271
4271
  }
4272
4272
  }),
4273
4273
  [f, h, m, g, ze, tt, Et, Fe]
4274
- ), Ne = Ve(
4274
+ ), Ne = Ke(
4275
4275
  () => ({
4276
4276
  threadId: h,
4277
4277
  messages: k.messages,
@@ -4295,7 +4295,7 @@ function ny({
4295
4295
  returnToLatest: Nt,
4296
4296
  loadThread: Ue,
4297
4297
  clearThread: Ct,
4298
- respondToInterrupt: Ge,
4298
+ respondToInterrupt: We,
4299
4299
  messagePreviews: q
4300
4300
  }),
4301
4301
  [
@@ -4314,20 +4314,20 @@ function ny({
4314
4314
  bt,
4315
4315
  Nt,
4316
4316
  Ue,
4317
- Ge,
4317
+ We,
4318
4318
  q
4319
4319
  ]
4320
- ), ut = Ve(
4320
+ ), ut = Ke(
4321
4321
  () => ({
4322
4322
  isStreaming: He,
4323
- error: qe,
4323
+ error: Ge,
4324
4324
  connectionState: He ? "connected" : "idle",
4325
4325
  submit: zt,
4326
4326
  send: zt,
4327
4327
  stop: Me,
4328
4328
  setAuthToken: et
4329
4329
  }),
4330
- [He, qe, zt, Me, et]
4330
+ [He, Ge, zt, Me, et]
4331
4331
  );
4332
4332
  return /* @__PURE__ */ u.jsx(Au.Provider, { value: _e, children: /* @__PURE__ */ u.jsx(_u.Provider, { value: Ne, children: /* @__PURE__ */ u.jsx(ju.Provider, { value: ut, children: e }) }) });
4333
4333
  }
@@ -11094,14 +11094,14 @@ const PS = /* @__PURE__ */ it(
11094
11094
  Qe,
11095
11095
  rt
11096
11096
  ]) => {
11097
- const { column: ce, row: he } = oe, { height: Me, width: He } = se, { width: qe } = Se;
11098
- if (Fe === 0 && (D === 0 || qe === 0))
11097
+ const { column: ce, row: he } = oe, { height: Me, width: He } = se, { width: Ge } = Se;
11098
+ if (Fe === 0 && (D === 0 || Ge === 0))
11099
11099
  return Rc;
11100
11100
  if (He === 0) {
11101
11101
  const Nt = Ha(rt, D), St = Nt + Math.max(Fe - 1, 0);
11102
11102
  return _S(Nc(Nt, St, nt));
11103
11103
  }
11104
- const et = Xf(qe, He, ce);
11104
+ const et = Xf(Ge, He, ce);
11105
11105
  let ze, tt;
11106
11106
  Qe ? W === 0 && re === 0 && Fe > 0 ? (ze = 0, tt = Fe - 1) : (ze = et * ss((W + he) / (Me + he)), tt = et * Ic((re + he) / (Me + he)) - 1, tt = Ti(D - 1, Wr(tt, et - 1)), ze = Ti(tt, Wr(0, ze))) : (ze = 0, tt = -1);
11107
11107
  const Et = Nc(ze, tt, nt), { bottom: ht, top: Ue } = Ac(Se, oe, se, Et), xt = Ic(D / et), bt = xt * Me + (xt - 1) * he - ht;
@@ -13713,7 +13713,7 @@ function us({
13713
13713
  allowHtml: n = !1,
13714
13714
  style: r
13715
13715
  }) {
13716
- const o = Ve(() => {
13716
+ const o = Ke(() => {
13717
13717
  try {
13718
13718
  if (!n) {
13719
13719
  const i = e.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, "").replace(/<iframe\b[^<]*(?:(?!<\/iframe>)<[^<]*)*<\/iframe>/gi, "").replace(/javascript:/gi, "").replace(/on\w+\s*=/gi, "");
@@ -13723,7 +13723,7 @@ function us({
13723
13723
  } catch (i) {
13724
13724
  return console.error("[MarkdownContent] parse error", i), `<pre class="font-mono text-xs bg-background/50 rounded border p-2 whitespace-pre-wrap break-words">Error rendering markdown: ${String(i)}</pre>`;
13725
13725
  }
13726
- }, [e, n]), s = Ve(() => {
13726
+ }, [e, n]), s = Ke(() => {
13727
13727
  const i = {
13728
13728
  color: "currentColor",
13729
13729
  ...r
@@ -13904,13 +13904,13 @@ const Bc = sm(function({
13904
13904
  messageParentCheckpointId: j = null,
13905
13905
  attemptMeta: A = null
13906
13906
  }) {
13907
- const [M, $] = be(!1), [E, F] = be("preview"), [_, J] = be(!1), { currentThreadId: z } = ma(), { respondToInterrupt: P } = ga(), U = l === "phone" || l === "half-screen", X = t.role, fe = X === "tool", ie = Ve(() => "type" in t && t.type === "default_message" ? t : null, [t]), Ae = !!ie, q = !(r && X !== "user"), {
13907
+ const [M, $] = be(!1), [E, F] = be("preview"), [_, J] = be(!1), { currentThreadId: z } = ma(), { respondToInterrupt: P } = ga(), U = l === "phone" || l === "half-screen", X = t.role, fe = X === "tool", ie = Ke(() => "type" in t && t.type === "default_message" ? t : null, [t]), Ae = !!ie, q = !(r && X !== "user"), {
13908
13908
  uploadingFiles: B,
13909
13909
  handleFileClick: K,
13910
13910
  fileViewerOpen: D,
13911
13911
  currentFileInfo: W,
13912
13912
  closeFileViewer: re
13913
- } = KC({ allowFileOpen: q, currentThreadId: z }), oe = Ve(() => {
13913
+ } = KC({ allowFileOpen: q, currentThreadId: z }), oe = Ke(() => {
13914
13914
  switch (X) {
13915
13915
  case "user":
13916
13916
  return "text-[hsl(var(--chat-bubble-user-text))]";
@@ -13923,16 +13923,16 @@ const Bc = sm(function({
13923
13923
  default:
13924
13924
  return "text-[hsl(var(--chat-bubble-ai-text))]";
13925
13925
  }
13926
- }, [X]), se = Ve(() => ie ? "" : LC(t.content), [ie, t]), Se = Ve(() => ie ? {} : jp(t), [ie, t]), nt = Ve(
13926
+ }, [X]), se = Ke(() => ie ? "" : LC(t.content), [ie, t]), Se = Ke(() => ie ? {} : jp(t), [ie, t]), nt = Ke(
13927
13927
  () => ie ? [] : t.content.filter((L) => L.type === "image_url"),
13928
13928
  [ie, t]
13929
- ), Fe = Ve(
13929
+ ), Fe = Ke(
13930
13930
  () => ie ? [] : t.content.filter((L) => L.type === "file"),
13931
13931
  [ie, t]
13932
- ), Qe = Ve(
13932
+ ), Qe = Ke(
13933
13933
  () => ie ? [] : t.content.filter((L) => L.type === "interrupt"),
13934
13934
  [ie, t]
13935
- ), rt = (w == null ? void 0 : w.id) ?? (w == null ? void 0 : w.interrupt_id), ce = Po(rt), he = w == null ? void 0 : w.value, Me = Ve(() => ie ? "" : $C(t.content), [ie, t]), He = Ve(() => {
13935
+ ), rt = (w == null ? void 0 : w.id) ?? (w == null ? void 0 : w.interrupt_id), ce = Po(rt), he = w == null ? void 0 : w.value, Me = Ke(() => ie ? "" : $C(t.content), [ie, t]), He = Ke(() => {
13936
13936
  if (ie || !p) return [];
13937
13937
  const ue = t.artifact;
13938
13938
  if (!ue) return [];
@@ -13944,7 +13944,7 @@ const Bc = sm(function({
13944
13944
  ot && Y.push(ot);
13945
13945
  }
13946
13946
  return Y;
13947
- }, [ie, t, p]), qe = ye(async () => {
13947
+ }, [ie, t, p]), Ge = ye(async () => {
13948
13948
  const L = fe ? Me : se;
13949
13949
  async function ue(Y) {
13950
13950
  if (navigator.clipboard && typeof navigator.clipboard.writeText == "function") {
@@ -14205,17 +14205,17 @@ const Bc = sm(function({
14205
14205
  He.length,
14206
14206
  Nt,
14207
14207
  oe
14208
- ]), Ct = Ve(() => ie ? "Assistant" : FC(t), [ie, t]), Ge = Ve(() => ie ? [] : Array.isArray(C) ? C : [], [C, ie]), zt = Ve(() => {
14208
+ ]), Ct = Ke(() => ie ? "Assistant" : FC(t), [ie, t]), We = Ke(() => ie ? [] : Array.isArray(C) ? C : [], [C, ie]), zt = Ke(() => {
14209
14209
  var L;
14210
- return Ge.length ? N && Ge.some((ue) => ue.id === N) ? N : ((L = Ge[0]) == null ? void 0 : L.id) ?? null : null;
14211
- }, [N, Ge]), Ne = Ve(() => !Ge.length || !k ? null : Ge.some((L) => L.id === k) ? k : null, [k, Ge]) ?? zt, ut = X === "user" && Ge.length > 0 && typeof I == "function", G = ye(
14210
+ return We.length ? N && We.some((ue) => ue.id === N) ? N : ((L = We[0]) == null ? void 0 : L.id) ?? null : null;
14211
+ }, [N, We]), Ne = Ke(() => !We.length || !k ? null : We.some((L) => L.id === k) ? k : null, [k, We]) ?? zt, ut = X === "user" && We.length > 0 && typeof I == "function", G = ye(
14212
14212
  (L) => {
14213
14213
  if (!I) return;
14214
14214
  const ue = (L == null ? void 0 : L.id) ?? null, Y = (L == null ? void 0 : L.parentId) ?? j ?? null;
14215
14215
  I(ue, Y);
14216
14216
  },
14217
14217
  [j, I]
14218
- ), ee = Ve(() => Ne ? Ge.findIndex((L) => L.id === Ne) : -1, [Ne, Ge]), Ce = Ve(() => ee < 0 ? null : Ge[ee] ?? null, [ee, Ge]), Te = ye((L) => {
14218
+ ), ee = Ke(() => Ne ? We.findIndex((L) => L.id === Ne) : -1, [Ne, We]), Ce = Ke(() => ee < 0 ? null : We[ee] ?? null, [ee, We]), Te = ye((L) => {
14219
14219
  const ue = [];
14220
14220
  if (L.step !== null && ue.push(`Step ${L.step}`), L.source && ue.push(L.source), !L.createdAt)
14221
14221
  return ue.length ? ue.join(" • ") : L.id.slice(0, 8);
@@ -14230,7 +14230,7 @@ const Bc = sm(function({
14230
14230
  Y = "";
14231
14231
  }
14232
14232
  return `${Y}`;
14233
- }, []), De = Ve(() => {
14233
+ }, []), De = Ke(() => {
14234
14234
  if (!A || A.attemptCount <= 1)
14235
14235
  return null;
14236
14236
  const L = A.attemptCount - A.attemptIndex, ue = A.isLatestAttempt ? `LATEST OF ${A.attemptCount}` : `${L} / ${A.attemptCount}`;
@@ -14299,7 +14299,7 @@ const Bc = sm(function({
14299
14299
  ),
14300
14300
  onClick: () => {
14301
14301
  if (ee <= 0) return;
14302
- const L = Ge[ee - 1];
14302
+ const L = We[ee - 1];
14303
14303
  L && G(L);
14304
14304
  },
14305
14305
  "aria-label": "Previous checkpoint",
@@ -14309,9 +14309,9 @@ const Bc = sm(function({
14309
14309
  ),
14310
14310
  /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2", children: [
14311
14311
  /* @__PURE__ */ u.jsxs("span", { className: "whitespace-nowrap", children: [
14312
- ee + 1,
14312
+ We.length - ee,
14313
14313
  " / ",
14314
- Ge.length
14314
+ We.length
14315
14315
  ] }),
14316
14316
  /* @__PURE__ */ u.jsx("span", { className: "text-muted-foreground", children: Te(Ce) })
14317
14317
  ] }),
@@ -14321,15 +14321,15 @@ const Bc = sm(function({
14321
14321
  type: "button",
14322
14322
  className: ne(
14323
14323
  "flex items-center justify-center rounded border px-1.5 py-1 transition-colors",
14324
- ee < Ge.length - 1 ? "border-border text-foreground hover:bg-muted/60" : "border-border text-muted-foreground cursor-not-allowed"
14324
+ ee < We.length - 1 ? "border-border text-foreground hover:bg-muted/60" : "border-border text-muted-foreground cursor-not-allowed"
14325
14325
  ),
14326
14326
  onClick: () => {
14327
- if (ee >= Ge.length - 1) return;
14328
- const L = Ge[ee + 1];
14327
+ if (ee >= We.length - 1) return;
14328
+ const L = We[ee + 1];
14329
14329
  L && G(L);
14330
14330
  },
14331
14331
  "aria-label": "Next checkpoint",
14332
- disabled: ee >= Ge.length - 1,
14332
+ disabled: ee >= We.length - 1,
14333
14333
  children: /* @__PURE__ */ u.jsx(Xc, { className: "h-3 w-3" })
14334
14334
  }
14335
14335
  )
@@ -14357,7 +14357,7 @@ const Bc = sm(function({
14357
14357
  {
14358
14358
  variant: "ghost",
14359
14359
  size: "sm",
14360
- onClick: () => qe(),
14360
+ onClick: () => Ge(),
14361
14361
  className: ne("h-6 w-6 p-0 hover:bg-foreground/10", oe, U && "h-5 w-5"),
14362
14362
  "aria-label": "Copy message",
14363
14363
  title: "Copy message",
@@ -14451,7 +14451,7 @@ const Bc = sm(function({
14451
14451
  {
14452
14452
  variant: "ghost",
14453
14453
  size: "sm",
14454
- onClick: () => qe(),
14454
+ onClick: () => Ge(),
14455
14455
  className: ne("h-6 w-6 p-0 hover:bg-background/50 text-current", U && "h-5 w-5"),
14456
14456
  children: /* @__PURE__ */ u.jsx(dl, { className: ne(M ? "text-success" : "text-current", U ? "h-3 w-3" : "h-4 w-4") })
14457
14457
  }
@@ -14730,7 +14730,7 @@ const YC = ({
14730
14730
  onSelectCheckpoint: n,
14731
14731
  messagePreviews: r
14732
14732
  }) => {
14733
- const o = e ?? [], s = o.length > 0, i = Ve(() => s ? [...o].reverse() : [], [o, s]), a = t ?? (o.length ? o[o.length - 1].id : null);
14733
+ const o = e ?? [], s = o.length > 0, i = Ke(() => s ? [...o].reverse() : [], [o, s]), a = t ?? (o.length ? o[o.length - 1].id : null);
14734
14734
  return kt(() => {
14735
14735
  console.debug("[TimelineColumn] entries:", o.length);
14736
14736
  }, [o.length]), s ? /* @__PURE__ */ u.jsxs("div", { className: "w-32 flex-shrink-0 flex-col border-r border-border/40 pr-2 flex", children: [
@@ -14833,9 +14833,9 @@ const YC = ({
14833
14833
  messagePreviews: F,
14834
14834
  createSyntheticThinkingMessage: _ = !1
14835
14835
  }, J) => {
14836
- const z = Ke(null), P = Ke(null), U = Ke(!1), [X, fe] = be(!0), ie = Ve(() => w ? e.some((ce) => "type" in ce && ce.type === "default_message" ? !1 : Array.isArray(ce == null ? void 0 : ce.content) && ce.content.some(
14836
+ const z = qe(null), P = qe(null), U = qe(!1), [X, fe] = be(!0), ie = Ke(() => w ? e.some((ce) => "type" in ce && ce.type === "default_message" ? !1 : Array.isArray(ce == null ? void 0 : ce.content) && ce.content.some(
14837
14837
  (he) => he && he.type === "interrupt" && (he.id ?? he.interrupt_id) === w.id
14838
- )) : !1, [w, e]), Ae = Ve(() => {
14838
+ )) : !1, [w, e]), Ae = Ke(() => {
14839
14839
  if (!w || ie)
14840
14840
  return null;
14841
14841
  const ce = w.id && String(w.id).trim() ? String(w.id).trim() : "pending-interrupt";
@@ -14858,7 +14858,7 @@ const YC = ({
14858
14858
  }
14859
14859
  ]
14860
14860
  };
14861
- }, [w, ie]), q = Ve(() => Ae ? [...e, Ae] : e, [e, Ae]), B = Ve(() => !_ || !t ? q : !q.some((he) => he.role === "assistant") && q.length > 0 ? [
14861
+ }, [w, ie]), q = Ke(() => Ae ? [...e, Ae] : e, [e, Ae]), B = Ke(() => !_ || !t ? q : !q.some((he) => he.role === "assistant") && q.length > 0 ? [
14862
14862
  ...q,
14863
14863
  {
14864
14864
  id: "thinking-assistant",
@@ -14866,9 +14866,9 @@ const YC = ({
14866
14866
  content: [],
14867
14867
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
14868
14868
  }
14869
- ] : q, [q, t, _]), K = Ve(() => C ? B : B.filter((ce) => (ce == null ? void 0 : ce.role) !== "tool"), [B, C]), D = ye((ce) => {
14869
+ ] : q, [q, t, _]), K = Ke(() => C ? B : B.filter((ce) => (ce == null ? void 0 : ce.role) !== "tool"), [B, C]), D = ye((ce) => {
14870
14870
  fe(ce), v && v(!ce), g && g(ce);
14871
- }, [v, g]), W = Ve(() => {
14871
+ }, [v, g]), W = Ke(() => {
14872
14872
  if (a)
14873
14873
  return async () => {
14874
14874
  if (!U.current) {
@@ -14880,7 +14880,7 @@ const YC = ({
14880
14880
  }
14881
14881
  }
14882
14882
  };
14883
- }, [a]), re = Ve(() => !x || m ? !1 : X ? "auto" : !1, [X, x, m]), oe = E ?? [], se = oe.length > 0, Se = Ve(() => {
14883
+ }, [a]), re = Ke(() => !x || m ? !1 : X ? "auto" : !1, [X, x, m]), oe = E ?? [], se = oe.length > 0, Se = Ke(() => {
14884
14884
  if (typeof h != "string") return null;
14885
14885
  const ce = h.trim();
14886
14886
  return ce ? {
@@ -14968,24 +14968,24 @@ const YC = ({
14968
14968
  itemContent: (ce, he) => {
14969
14969
  var bt;
14970
14970
  const Me = Hc(he, ce), He = "type" in he && he.type === "default_message";
14971
- let qe = [], et = null, ze = {}, tt = {}, Et = null, ht = null, Ue = null;
14971
+ let Ge = [], et = null, ze = {}, tt = {}, Et = null, ht = null, Ue = null;
14972
14972
  if (!He) {
14973
14973
  const Nt = he, St = Nt.checkpointId ?? null;
14974
14974
  ze = Nt.additionalKwargs ?? {}, tt = Nt.responseMetadata ?? {};
14975
14975
  const Ct = St && I ? I.get(St) ?? null : null;
14976
14976
  Et = typeof ze.step == "number" ? ze.step : typeof tt.step == "number" ? tt.step : (Ct == null ? void 0 : Ct.step) ?? null;
14977
- const Ge = typeof ze.source == "string" ? ze.source : typeof tt.source == "string" ? tt.source : (Ct == null ? void 0 : Ct.source) ?? null;
14978
- ht = Ge ? String(Ge) : null;
14977
+ const We = typeof ze.source == "string" ? ze.source : typeof tt.source == "string" ? tt.source : (Ct == null ? void 0 : Ct.source) ?? null;
14978
+ ht = We ? String(We) : null;
14979
14979
  const zt = Et !== null && ht ? `${Et}:${ht}` : null;
14980
- if (zt && (N != null && N.has(zt)) ? qe = N.get(zt) ?? [] : St && Ct && (qe = [Ct]), et = St ?? ((bt = qe[0]) == null ? void 0 : bt.id) ?? null, Ue = St ? (j == null ? void 0 : j.get(St)) ?? null : null, !Ue && (he == null ? void 0 : he.role) === "user" && (he != null && he.id) && A) {
14980
+ if (zt && (N != null && N.has(zt)) ? Ge = N.get(zt) ?? [] : St && Ct && (Ge = [Ct]), et = St ?? ((bt = Ge[0]) == null ? void 0 : bt.id) ?? null, Ue = St ? (j == null ? void 0 : j.get(St)) ?? null : null, !Ue && (he == null ? void 0 : he.role) === "user" && (he != null && he.id) && A) {
14981
14981
  const _e = A.get(he.id);
14982
14982
  if (_e && _e.length > 0) {
14983
14983
  const Ne = _e[0].checkpointId;
14984
14984
  Ue = (j == null ? void 0 : j.get(Ne)) ?? null, console.log(`[MessageList] Found attempt by user message ID "${he.id}":`, _e.length, "versions");
14985
14985
  }
14986
14986
  }
14987
- if (!Ue && qe.length > 0 && j) {
14988
- const _e = j.get(qe[0].id);
14987
+ if (!Ue && Ge.length > 0 && j) {
14988
+ const _e = j.get(Ge[0].id);
14989
14989
  _e && (Ue = _e);
14990
14990
  }
14991
14991
  if (Ue && Ue.attemptCount > 1 && j) {
@@ -14997,7 +14997,7 @@ const YC = ({
14997
14997
  const ee = I == null ? void 0 : I.get(ut);
14998
14998
  ee && Ne.push(ee);
14999
14999
  }
15000
- Ne.length > 0 && (qe = Ne);
15000
+ Ne.length > 0 && (Ge = Ne);
15001
15001
  }
15002
15002
  }
15003
15003
  if (Ue && Ue.attemptCount > 1 && I && j) {
@@ -15009,10 +15009,10 @@ const YC = ({
15009
15009
  _e.sort((Ne, ut) => {
15010
15010
  const G = Ne.createdAt ? Date.parse(Ne.createdAt) : 0;
15011
15011
  return (ut.createdAt ? Date.parse(ut.createdAt) : 0) - G;
15012
- }), _e.length > 0 && (qe = _e, console.log("[MessageList] Populated checkpointCandidates with all attempts:", {
15012
+ }), _e.length > 0 && (Ge = _e, console.log("[MessageList] Populated checkpointCandidates with all attempts:", {
15013
15013
  messageId: he.id,
15014
15014
  attemptCount: Ue.attemptCount,
15015
- candidateIds: qe.map((Ne) => Ne.id)
15015
+ candidateIds: Ge.map((Ne) => Ne.id)
15016
15016
  }));
15017
15017
  }
15018
15018
  }
@@ -15052,7 +15052,7 @@ const YC = ({
15052
15052
  onInterruptActionEnd: S,
15053
15053
  showToolMessages: C,
15054
15054
  showArtifactPreviews: k,
15055
- checkpointCandidates: qe,
15055
+ checkpointCandidates: Ge,
15056
15056
  activeCheckpointId: M ?? null,
15057
15057
  onSelectCheckpoint: $,
15058
15058
  defaultCheckpointId: et,
@@ -15110,9 +15110,9 @@ function Ii({
15110
15110
  q(!0);
15111
15111
  }, []), K = ye(() => {
15112
15112
  q(!1);
15113
- }, []), D = !!ie || Ae, [W, re] = be(null), [oe, se] = be(""), [Se, nt] = be(null), [Fe, Qe] = be(null), [rt, ce] = be([]), [he, Me] = be(0), [He, qe] = be(0), [et, ze] = be(!1), [tt, Et] = be(null), [ht, Ue] = be(null), [xt, bt] = be(!1), [Nt, St] = be(null), Ct = Ke(!1), [Ge, zt] = be(() => Uc.value), _e = Ke(Ge), Ne = Ke(null), ut = ye((Z) => {
15113
+ }, []), D = !!ie || Ae, [W, re] = be(null), [oe, se] = be(""), [Se, nt] = be(null), [Fe, Qe] = be(null), [rt, ce] = be([]), [he, Me] = be(0), [He, Ge] = be(0), [et, ze] = be(!1), [tt, Et] = be(null), [ht, Ue] = be(null), [xt, bt] = be(!1), [Nt, St] = be(null), Ct = qe(!1), [We, zt] = be(() => Uc.value), _e = qe(We), Ne = qe(null), ut = ye((Z) => {
15114
15114
  Uc.value = Z, zt(Z);
15115
- }, []), [G, ee] = be(!1), Ce = Ke(null), Te = ye(
15115
+ }, []), [G, ee] = be(!1), Ce = qe(null), Te = ye(
15116
15116
  (Z, me) => {
15117
15117
  if (!Z || typeof Z != "object") return null;
15118
15118
  const xe = Z[me];
@@ -15126,7 +15126,7 @@ function Ii({
15126
15126
  return typeof xe == "string" && xe.trim() ? xe : null;
15127
15127
  },
15128
15128
  []
15129
- ), L = Ve(() => {
15129
+ ), L = Ke(() => {
15130
15130
  const Z = (Ye) => {
15131
15131
  if (!Array.isArray(Ye) || Ye.length === 0)
15132
15132
  return null;
@@ -15158,7 +15158,7 @@ function Ii({
15158
15158
  const Qt = Date.parse(Ye.createdAt ?? ""), pr = Date.parse(At.createdAt ?? "");
15159
15159
  return Number.isNaN(Qt) || Number.isNaN(pr) ? 0 : pr - Qt;
15160
15160
  }), me;
15161
- }, [N, Te]), { checkpointMetaById: ue, checkpointIndexByKey: Y, attemptMetaById: Le, userMessageIdToAttempts: ge } = Ve(() => {
15161
+ }, [N, Te]), { checkpointMetaById: ue, checkpointIndexByKey: Y, attemptMetaById: Le, userMessageIdToAttempts: ge } = Ke(() => {
15162
15162
  const Z = /* @__PURE__ */ new Map(), me = /* @__PURE__ */ new Map(), xe = /* @__PURE__ */ new Map();
15163
15163
  for (const at of L) {
15164
15164
  const Bt = at.checkpointId ?? null;
@@ -15205,14 +15205,14 @@ function Ii({
15205
15205
  });
15206
15206
  const At = m0(xe);
15207
15207
  return console.log("[ChatInterface] userMessageIdToAttempts map built with", At.size, "user message IDs with multiple attempts"), { checkpointMetaById: Z, checkpointIndexByKey: me, attemptMetaById: xe, userMessageIdToAttempts: At };
15208
- }, [L, Te, De]), ot = M ?? [], xn = Ke(null), Yn = Ke(null), Mn = ye(() => {
15209
- xn.current && (xn.current.value = ""), Yn.current && (Yn.current.value = ""), Me((Z) => Z + 1), qe((Z) => Z + 1);
15208
+ }, [L, Te, De]), ot = M ?? [], xn = qe(null), Yn = qe(null), Mn = ye(() => {
15209
+ xn.current && (xn.current.value = ""), Yn.current && (Yn.current.value = ""), Me((Z) => Z + 1), Ge((Z) => Z + 1);
15210
15210
  }, []), Qs = ye(
15211
15211
  (Z) => {
15212
15212
  ut(Z);
15213
15213
  },
15214
15214
  [ut]
15215
- ), wo = Ke(!1);
15215
+ ), wo = qe(!1);
15216
15216
  kt(() => {
15217
15217
  wo.current && !E && (ce([]), Mn()), wo.current = E;
15218
15218
  }, [E, Mn]);
@@ -15226,8 +15226,8 @@ function Ii({
15226
15226
  }, []), kt(() => {
15227
15227
  Ct.current = !1;
15228
15228
  }, [P]), kt(() => {
15229
- _e.current = Ge;
15230
- }, [Ge]), kt(() => {
15229
+ _e.current = We;
15230
+ }, [We]), kt(() => {
15231
15231
  if (!W) {
15232
15232
  Ne.current = null;
15233
15233
  return;
@@ -15292,15 +15292,15 @@ function Ii({
15292
15292
  }
15293
15293
  }, ae = te.useCallback(
15294
15294
  (Z, me, xe) => {
15295
- c && (Ne.current = Ge, re(Z), se(me), ut(me), Qe(null), nt({
15295
+ c && (Ne.current = We, re(Z), se(me), ut(me), Qe(null), nt({
15296
15296
  checkpointId: (xe == null ? void 0 : xe.checkpointId) ?? null,
15297
15297
  checkpointNs: (xe == null ? void 0 : xe.checkpointNs) ?? null
15298
15298
  }));
15299
15299
  },
15300
- [Ge, c, ut]
15300
+ [We, c, ut]
15301
15301
  ), Re = te.useCallback(() => {
15302
- re(null), se(""), nt(null), Qe(null), ut(Ne.current ?? Ge), Ne.current = null;
15303
- }, [Ge, ut]), st = ye(
15302
+ re(null), se(""), nt(null), Qe(null), ut(Ne.current ?? We), Ne.current = null;
15303
+ }, [We, ut]), st = ye(
15304
15304
  (Z, me, xe) => {
15305
15305
  ae(Z, me, xe);
15306
15306
  },
@@ -15327,7 +15327,7 @@ function Ii({
15327
15327
  }, [b, J, U, X]), Xe = (Z) => {
15328
15328
  const me = Array.from(Z.target.files || []);
15329
15329
  ce((xe) => [...xe, ...me]), Z.target.value = "";
15330
- }, We = (Z) => {
15330
+ }, Ve = (Z) => {
15331
15331
  ce((me) => {
15332
15332
  const xe = me.filter((Ye, At) => Z !== At);
15333
15333
  return xe.length === 0 && Mn(), xe;
@@ -15499,7 +15499,7 @@ function Ii({
15499
15499
  {
15500
15500
  variant: "ghost",
15501
15501
  size: "sm",
15502
- onClick: () => We(me),
15502
+ onClick: () => Ve(me),
15503
15503
  className: "h-4 w-4 p-0 text-gray-500 dark:text-gray-400 hover:text-red-500 dark:hover:text-red-400",
15504
15504
  "aria-label": `Remove ${Z.name}`,
15505
15505
  children: /* @__PURE__ */ u.jsx(vr, { size: 12 })
@@ -15571,7 +15571,7 @@ function Ii({
15571
15571
  {
15572
15572
  initialValue: oe,
15573
15573
  editingMessageId: W,
15574
- value: Ge,
15574
+ value: We,
15575
15575
  onValueChange: Qs,
15576
15576
  placeholder: W ? "Edit your message..." : t,
15577
15577
  isStreaming: E,
@@ -16167,7 +16167,7 @@ function Kc({
16167
16167
  setCurrentThreadId: h,
16168
16168
  isLoading: x,
16169
16169
  actions: m
16170
- } = ma(), { loadThread: v } = ga(), { createThread: g, deleteThread: w, renameThread: b } = m, [T, S] = be(Array.isArray(f) ? f : []), C = Ke(T.length > 0), k = Ke(null), I = Ke(0), [N, j] = be(null), [A, M] = be(""), [$, E] = be(!1);
16170
+ } = ma(), { loadThread: v } = ga(), { createThread: g, deleteThread: w, renameThread: b } = m, [T, S] = be(Array.isArray(f) ? f : []), C = qe(T.length > 0), k = qe(null), I = qe(0), [N, j] = be(null), [A, M] = be(""), [$, E] = be(!1);
16171
16171
  kt(() => {
16172
16172
  const q = Array.isArray(f) ? f : [];
16173
16173
  if (q.length > 0) {