teodor-new-chat-ui 4.3.120 → 4.3.121

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 eg = Object.defineProperty;
2
2
  var tg = (e, t, n) => t in e ? eg(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
3
  var Zl = (e, t, n) => tg(e, typeof t != "symbol" ? t + "" : t, n);
4
4
  import * as v from "react";
5
- import V, { createContext as Fo, useContext as Qs, useReducer as ng, useRef as Re, useCallback as he, useEffect as Tt, useMemo as dt, useState as ve, startTransition as Qo, createElement as ps, useLayoutEffect as rg } from "react";
5
+ import V, { createContext as Fo, useContext as Qs, useReducer as ng, useRef as Re, useCallback as he, useEffect as Tt, useMemo as ut, useState as ve, startTransition as Qo, createElement as ps, useLayoutEffect as rg } from "react";
6
6
  import { Square as og, Send as sg, X as Kr, ExternalLink as ig, Download as ag, Image as lg, FileText as Ql, Loader as Xa, Bot as Fi, Wrench as cg, User as ug, Paperclip as ma, ChevronUp as Ja, ChevronDown as ei, ChevronLeft as dg, ChevronRight as Vu, Copy as ec, Edit as tc, RotateCcw as ga, Check as Za, Circle as fg, Loader2 as ms, Edit3 as Ku, Plus as hg, FileSpreadsheet as pg, MessageSquarePlus as mg, MessageSquare as gg, Calendar as xg, Trash2 as yg, Settings as vg, Server as wg, EyeOff as bg, Eye as Sg, Layout as Cg, MessageCircle as Tg, Save as kg } from "lucide-react";
7
7
  import { Slot as Rg, createSlot as Jr } from "@radix-ui/react-slot";
8
8
  import { cva as ti } from "class-variance-authority";
@@ -51,25 +51,25 @@ function Ag() {
51
51
  function y(R) {
52
52
  if (R === null || typeof R != "object")
53
53
  return null;
54
- var G = g && R[g] || R[x];
55
- return typeof G == "function" ? G : null;
54
+ var q = g && R[g] || R[x];
55
+ return typeof q == "function" ? q : null;
56
56
  }
57
57
  var m = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
58
58
  function w(R) {
59
59
  {
60
- for (var G = arguments.length, ie = new Array(G > 1 ? G - 1 : 0), Se = 1; Se < G; Se++)
60
+ for (var q = arguments.length, ie = new Array(q > 1 ? q - 1 : 0), Se = 1; Se < q; Se++)
61
61
  ie[Se - 1] = arguments[Se];
62
62
  b("error", R, ie);
63
63
  }
64
64
  }
65
- function b(R, G, ie) {
65
+ function b(R, q, ie) {
66
66
  {
67
67
  var Se = m.ReactDebugCurrentFrame, Ye = Se.getStackAddendum();
68
- Ye !== "" && (G += "%s", ie = ie.concat([Ye]));
68
+ Ye !== "" && (q += "%s", ie = ie.concat([Ye]));
69
69
  var mt = ie.map(function(Ve) {
70
70
  return String(Ve);
71
71
  });
72
- mt.unshift("Warning: " + G), Function.prototype.apply.call(console[R], console, mt);
72
+ mt.unshift("Warning: " + q), Function.prototype.apply.call(console[R], console, mt);
73
73
  }
74
74
  }
75
75
  var T = !1, C = !1, S = !1, k = !1, _ = !1, N;
@@ -81,11 +81,11 @@ function Ag() {
81
81
  // with.
82
82
  R.$$typeof === N || R.getModuleId !== void 0));
83
83
  }
84
- function M(R, G, ie) {
84
+ function M(R, q, ie) {
85
85
  var Se = R.displayName;
86
86
  if (Se)
87
87
  return Se;
88
- var Ye = G.displayName || G.name || "";
88
+ var Ye = q.displayName || q.name || "";
89
89
  return Ye !== "" ? ie + "(" + Ye + ")" : ie;
90
90
  }
91
91
  function F(R) {
@@ -115,8 +115,8 @@ function Ag() {
115
115
  if (typeof R == "object")
116
116
  switch (R.$$typeof) {
117
117
  case a:
118
- var G = R;
119
- return F(G) + ".Consumer";
118
+ var q = R;
119
+ return F(q) + ".Consumer";
120
120
  case i:
121
121
  var ie = R;
122
122
  return F(ie._context) + ".Provider";
@@ -199,7 +199,7 @@ function Ag() {
199
199
  }
200
200
  }
201
201
  var Te = m.ReactCurrentDispatcher, ne;
202
- function D(R, G, ie) {
202
+ function D(R, q, ie) {
203
203
  {
204
204
  if (ne === void 0)
205
205
  try {
@@ -217,7 +217,7 @@ function Ag() {
217
217
  var ue = typeof WeakMap == "function" ? WeakMap : Map;
218
218
  se = new ue();
219
219
  }
220
- function le(R, G) {
220
+ function le(R, q) {
221
221
  if (!R || Y)
222
222
  return "";
223
223
  {
@@ -232,7 +232,7 @@ function Ag() {
232
232
  var mt;
233
233
  mt = Te.current, Te.current = null, Z();
234
234
  try {
235
- if (G) {
235
+ if (q) {
236
236
  var Ve = function() {
237
237
  throw Error();
238
238
  };
@@ -288,14 +288,14 @@ function Ag() {
288
288
  var Qt = R ? R.displayName || R.name : "", dn = Qt ? D(Qt) : "";
289
289
  return typeof R == "function" && se.set(R, dn), dn;
290
290
  }
291
- function Me(R, G, ie) {
291
+ function Me(R, q, ie) {
292
292
  return le(R, !1);
293
293
  }
294
294
  function z(R) {
295
- var G = R.prototype;
296
- return !!(G && G.isReactComponent);
295
+ var q = R.prototype;
296
+ return !!(q && q.isReactComponent);
297
297
  }
298
- function be(R, G, ie) {
298
+ function be(R, q, ie) {
299
299
  if (R == null)
300
300
  return "";
301
301
  if (typeof R == "function")
@@ -313,11 +313,11 @@ function Ag() {
313
313
  case l:
314
314
  return Me(R.render);
315
315
  case f:
316
- return be(R.type, G, ie);
316
+ return be(R.type, q, ie);
317
317
  case h: {
318
318
  var Se = R, Ye = Se._payload, mt = Se._init;
319
319
  try {
320
- return be(mt(Ye), G, ie);
320
+ return be(mt(Ye), q, ie);
321
321
  } catch {
322
322
  }
323
323
  }
@@ -325,14 +325,14 @@ function Ag() {
325
325
  return "";
326
326
  }
327
327
  var je = Object.prototype.hasOwnProperty, De = {}, rt = m.ReactDebugCurrentFrame;
328
- function ht(R) {
328
+ function ft(R) {
329
329
  if (R) {
330
- var G = R._owner, ie = be(R.type, R._source, G ? G.type : null);
330
+ var q = R._owner, ie = be(R.type, R._source, q ? q.type : null);
331
331
  rt.setExtraStackFrame(ie);
332
332
  } else
333
333
  rt.setExtraStackFrame(null);
334
334
  }
335
- function Ze(R, G, ie, Se, Ye) {
335
+ function Ze(R, q, ie, Se, Ye) {
336
336
  {
337
337
  var mt = Function.call.bind(je);
338
338
  for (var Ve in R)
@@ -343,11 +343,11 @@ function Ag() {
343
343
  var Dt = Error((Se || "React class") + ": " + ie + " type `" + Ve + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof R[Ve] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
344
344
  throw Dt.name = "Invariant Violation", Dt;
345
345
  }
346
- He = R[Ve](G, Ve, Se, ie, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
346
+ He = R[Ve](q, Ve, Se, ie, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
347
347
  } catch (bt) {
348
348
  He = bt;
349
349
  }
350
- He && !(He instanceof Error) && (ht(Ye), 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).", Se || "React class", ie, Ve, typeof He), ht(null)), He instanceof Error && !(He.message in De) && (De[He.message] = !0, ht(Ye), w("Failed %s type: %s", ie, He.message), ht(null));
350
+ He && !(He instanceof Error) && (ft(Ye), 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).", Se || "React class", ie, Ve, typeof He), ft(null)), He instanceof Error && !(He.message in De) && (De[He.message] = !0, ft(Ye), w("Failed %s type: %s", ie, He.message), ft(null));
351
351
  }
352
352
  }
353
353
  }
@@ -355,9 +355,9 @@ function Ag() {
355
355
  function Qe(R) {
356
356
  return we(R);
357
357
  }
358
- function ct(R) {
358
+ function lt(R) {
359
359
  {
360
- var G = typeof Symbol == "function" && Symbol.toStringTag, ie = G && R[Symbol.toStringTag] || R.constructor.name || "Object";
360
+ var q = typeof Symbol == "function" && Symbol.toStringTag, ie = q && R[Symbol.toStringTag] || R.constructor.name || "Object";
361
361
  return ie;
362
362
  }
363
363
  }
@@ -373,9 +373,9 @@ function Ag() {
373
373
  }
374
374
  function Et(R) {
375
375
  if (at(R))
376
- return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", ct(R)), ot(R);
376
+ return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", lt(R)), ot(R);
377
377
  }
378
- var pt = m.ReactCurrentOwner, gt = {
378
+ var ht = m.ReactCurrentOwner, gt = {
379
379
  key: !0,
380
380
  ref: !0,
381
381
  __self: !0,
@@ -383,27 +383,27 @@ function Ag() {
383
383
  }, Mt, Ct;
384
384
  function Xe(R) {
385
385
  if (je.call(R, "ref")) {
386
- var G = Object.getOwnPropertyDescriptor(R, "ref").get;
387
- if (G && G.isReactWarning)
386
+ var q = Object.getOwnPropertyDescriptor(R, "ref").get;
387
+ if (q && q.isReactWarning)
388
388
  return !1;
389
389
  }
390
390
  return R.ref !== void 0;
391
391
  }
392
392
  function Lt(R) {
393
393
  if (je.call(R, "key")) {
394
- var G = Object.getOwnPropertyDescriptor(R, "key").get;
395
- if (G && G.isReactWarning)
394
+ var q = Object.getOwnPropertyDescriptor(R, "key").get;
395
+ if (q && q.isReactWarning)
396
396
  return !1;
397
397
  }
398
398
  return R.key !== void 0;
399
399
  }
400
- function Xt(R, G) {
401
- typeof R.ref == "string" && pt.current;
400
+ function Xt(R, q) {
401
+ typeof R.ref == "string" && ht.current;
402
402
  }
403
- function qt(R, G) {
403
+ function qt(R, q) {
404
404
  {
405
405
  var ie = function() {
406
- Mt || (Mt = !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)", G));
406
+ Mt || (Mt = !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)", q));
407
407
  };
408
408
  ie.isReactWarning = !0, Object.defineProperty(R, "key", {
409
409
  get: ie,
@@ -411,10 +411,10 @@ function Ag() {
411
411
  });
412
412
  }
413
413
  }
414
- function Jt(R, G) {
414
+ function Jt(R, q) {
415
415
  {
416
416
  var ie = function() {
417
- Ct || (Ct = !0, w("%s: `ref` 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)", G));
417
+ Ct || (Ct = !0, w("%s: `ref` 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)", q));
418
418
  };
419
419
  ie.isReactWarning = !0, Object.defineProperty(R, "ref", {
420
420
  get: ie,
@@ -422,13 +422,13 @@ function Ag() {
422
422
  });
423
423
  }
424
424
  }
425
- var ut = function(R, G, ie, Se, Ye, mt, Ve) {
425
+ var ct = function(R, q, ie, Se, Ye, mt, Ve) {
426
426
  var He = {
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
430
430
  type: R,
431
- key: G,
431
+ key: q,
432
432
  ref: ie,
433
433
  props: Ve,
434
434
  // Record the component responsible for creating this element.
@@ -451,12 +451,12 @@ function Ag() {
451
451
  value: Ye
452
452
  }), Object.freeze && (Object.freeze(He.props), Object.freeze(He)), He;
453
453
  };
454
- function Le(R, G, ie, Se, Ye) {
454
+ function Le(R, q, ie, Se, Ye) {
455
455
  {
456
456
  var mt, Ve = {}, He = null, Dt = null;
457
- ie !== void 0 && (Et(ie), He = "" + ie), Lt(G) && (Et(G.key), He = "" + G.key), Xe(G) && (Dt = G.ref, Xt(G, Ye));
458
- for (mt in G)
459
- je.call(G, mt) && !gt.hasOwnProperty(mt) && (Ve[mt] = G[mt]);
457
+ ie !== void 0 && (Et(ie), He = "" + ie), Lt(q) && (Et(q.key), He = "" + q.key), Xe(q) && (Dt = q.ref, Xt(q, Ye));
458
+ for (mt in q)
459
+ je.call(q, mt) && !gt.hasOwnProperty(mt) && (Ve[mt] = q[mt]);
460
460
  if (R && R.defaultProps) {
461
461
  var bt = R.defaultProps;
462
462
  for (mt in bt)
@@ -466,13 +466,13 @@ function Ag() {
466
466
  var St = typeof R == "function" ? R.displayName || R.name || "Unknown" : R;
467
467
  He && qt(Ve, St), Dt && Jt(Ve, St);
468
468
  }
469
- return ut(R, He, Dt, Ye, Se, pt.current, Ve);
469
+ return ct(R, He, Dt, Ye, Se, ht.current, Ve);
470
470
  }
471
471
  }
472
472
  var Ot = m.ReactCurrentOwner, It = m.ReactDebugCurrentFrame;
473
- function q(R) {
473
+ function G(R) {
474
474
  if (R) {
475
- var G = R._owner, ie = be(R.type, R._source, G ? G.type : null);
475
+ var q = R._owner, ie = be(R.type, R._source, q ? q.type : null);
476
476
  It.setExtraStackFrame(ie);
477
477
  } else
478
478
  It.setExtraStackFrame(null);
@@ -482,7 +482,7 @@ function Ag() {
482
482
  function xe(R) {
483
483
  return typeof R == "object" && R !== null && R.$$typeof === t;
484
484
  }
485
- function lt() {
485
+ function st() {
486
486
  {
487
487
  if (Ot.current) {
488
488
  var R = U(Ot.current.type);
@@ -494,43 +494,43 @@ Check the render method of \`` + R + "`.";
494
494
  return "";
495
495
  }
496
496
  }
497
- function st(R) {
497
+ function pt(R) {
498
498
  return "";
499
499
  }
500
500
  var et = {};
501
501
  function Fe(R) {
502
502
  {
503
- var G = lt();
504
- if (!G) {
503
+ var q = st();
504
+ if (!q) {
505
505
  var ie = typeof R == "string" ? R : R.displayName || R.name;
506
- ie && (G = `
506
+ ie && (q = `
507
507
 
508
508
  Check the top-level render call using <` + ie + ">.");
509
509
  }
510
- return G;
510
+ return q;
511
511
  }
512
512
  }
513
- function nn(R, G) {
513
+ function nn(R, q) {
514
514
  {
515
515
  if (!R._store || R._store.validated || R.key != null)
516
516
  return;
517
517
  R._store.validated = !0;
518
- var ie = Fe(G);
518
+ var ie = Fe(q);
519
519
  if (et[ie])
520
520
  return;
521
521
  et[ie] = !0;
522
522
  var Se = "";
523
- R && R._owner && R._owner !== Ot.current && (Se = " It was passed a child from " + U(R._owner.type) + "."), q(R), w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', ie, Se), q(null);
523
+ R && R._owner && R._owner !== Ot.current && (Se = " It was passed a child from " + U(R._owner.type) + "."), G(R), w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', ie, Se), G(null);
524
524
  }
525
525
  }
526
- function ze(R, G) {
526
+ function ze(R, q) {
527
527
  {
528
528
  if (typeof R != "object")
529
529
  return;
530
530
  if (Qe(R))
531
531
  for (var ie = 0; ie < R.length; ie++) {
532
532
  var Se = R[ie];
533
- xe(Se) && nn(Se, G);
533
+ xe(Se) && nn(Se, q);
534
534
  }
535
535
  else if (xe(R))
536
536
  R._store && (R._store.validated = !0);
@@ -538,64 +538,64 @@ Check the top-level render call using <` + ie + ">.");
538
538
  var Ye = y(R);
539
539
  if (typeof Ye == "function" && Ye !== R.entries)
540
540
  for (var mt = Ye.call(R), Ve; !(Ve = mt.next()).done; )
541
- xe(Ve.value) && nn(Ve.value, G);
541
+ xe(Ve.value) && nn(Ve.value, q);
542
542
  }
543
543
  }
544
544
  }
545
545
  function xt(R) {
546
546
  {
547
- var G = R.type;
548
- if (G == null || typeof G == "string")
547
+ var q = R.type;
548
+ if (q == null || typeof q == "string")
549
549
  return;
550
550
  var ie;
551
- if (typeof G == "function")
552
- ie = G.propTypes;
553
- else if (typeof G == "object" && (G.$$typeof === l || // Note: Memo only checks outer props here.
551
+ if (typeof q == "function")
552
+ ie = q.propTypes;
553
+ else if (typeof q == "object" && (q.$$typeof === l || // Note: Memo only checks outer props here.
554
554
  // Inner props are checked in the reconciler.
555
- G.$$typeof === f))
556
- ie = G.propTypes;
555
+ q.$$typeof === f))
556
+ ie = q.propTypes;
557
557
  else
558
558
  return;
559
559
  if (ie) {
560
- var Se = U(G);
560
+ var Se = U(q);
561
561
  Ze(ie, R.props, "prop", Se, R);
562
- } else if (G.PropTypes !== void 0 && !ke) {
562
+ } else if (q.PropTypes !== void 0 && !ke) {
563
563
  ke = !0;
564
- var Ye = U(G);
564
+ var Ye = U(q);
565
565
  w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", Ye || "Unknown");
566
566
  }
567
- typeof G.getDefaultProps == "function" && !G.getDefaultProps.isReactClassApproved && w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
567
+ typeof q.getDefaultProps == "function" && !q.getDefaultProps.isReactClassApproved && w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
568
568
  }
569
569
  }
570
570
  function In(R) {
571
571
  {
572
- for (var G = Object.keys(R.props), ie = 0; ie < G.length; ie++) {
573
- var Se = G[ie];
572
+ for (var q = Object.keys(R.props), ie = 0; ie < q.length; ie++) {
573
+ var Se = q[ie];
574
574
  if (Se !== "children" && Se !== "key") {
575
- q(R), w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", Se), q(null);
575
+ G(R), w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", Se), G(null);
576
576
  break;
577
577
  }
578
578
  }
579
- R.ref !== null && (q(R), w("Invalid attribute `ref` supplied to `React.Fragment`."), q(null));
579
+ R.ref !== null && (G(R), w("Invalid attribute `ref` supplied to `React.Fragment`."), G(null));
580
580
  }
581
581
  }
582
582
  var Ln = {};
583
- function or(R, G, ie, Se, Ye, mt) {
583
+ function or(R, q, ie, Se, Ye, mt) {
584
584
  {
585
585
  var Ve = A(R);
586
586
  if (!Ve) {
587
587
  var He = "";
588
588
  (R === void 0 || typeof R == "object" && R !== null && Object.keys(R).length === 0) && (He += " 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
- var Dt = st();
590
- Dt ? He += Dt : He += lt();
589
+ var Dt = pt();
590
+ Dt ? He += Dt : He += st();
591
591
  var bt;
592
592
  R === null ? bt = "null" : Qe(R) ? bt = "array" : R !== void 0 && R.$$typeof === t ? (bt = "<" + (U(R.type) || "Unknown") + " />", He = " Did you accidentally export a JSX literal instead of a component?") : bt = 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", bt, He);
593
593
  }
594
- var St = Le(R, G, ie, Ye, mt);
594
+ var St = Le(R, q, ie, Ye, mt);
595
595
  if (St == null)
596
596
  return St;
597
597
  if (Ve) {
598
- var Zt = G.children;
598
+ var Zt = q.children;
599
599
  if (Zt !== void 0)
600
600
  if (Se)
601
601
  if (Qe(Zt)) {
@@ -607,8 +607,8 @@ Check the top-level render call using <` + ie + ">.");
607
607
  else
608
608
  ze(Zt, R);
609
609
  }
610
- if (je.call(G, "key")) {
611
- var dn = U(R), Vt = Object.keys(G).filter(function(de) {
610
+ if (je.call(q, "key")) {
611
+ var dn = U(R), Vt = Object.keys(q).filter(function(de) {
612
612
  return de !== "key";
613
613
  }), X = Vt.length > 0 ? "{key: someKey, " + Vt.join(": ..., ") + ": ...}" : "{key: someKey}";
614
614
  if (!Ln[dn + X]) {
@@ -624,11 +624,11 @@ React keys must be passed directly to JSX without using spread:
624
624
  return R === r ? In(St) : xt(St), St;
625
625
  }
626
626
  }
627
- function sr(R, G, ie) {
628
- return or(R, G, ie, !0);
627
+ function sr(R, q, ie) {
628
+ return or(R, q, ie, !0);
629
629
  }
630
- function wr(R, G, ie) {
631
- return or(R, G, ie, !1);
630
+ function wr(R, q, ie) {
631
+ return or(R, q, ie, !1);
632
632
  }
633
633
  var Jn = wr, zr = sr;
634
634
  mo.Fragment = r, mo.jsx = Jn, mo.jsxs = zr;
@@ -3001,7 +3001,7 @@ function _y(e = []) {
3001
3001
  Tt(() => () => {
3002
3002
  o.current !== null && typeof window < "u" && window.cancelAnimationFrame(o.current), s.current !== null && clearTimeout(s.current), r.current = [];
3003
3003
  }, []);
3004
- const c = dt(() => ({
3004
+ const c = ut(() => ({
3005
3005
  reset: (d) => n({ type: "reset", payload: { messages: d } }),
3006
3006
  seed: (d, f) => n({ type: "seed", payload: { messages: d, ...f ?? {} } }),
3007
3007
  prepend: (d) => n({ type: "prepend", payload: { messages: d } }),
@@ -3335,7 +3335,7 @@ function My(e) {
3335
3335
  return t[t.length - 1] || null;
3336
3336
  }
3337
3337
  function Dy(e = {}) {
3338
- const t = dt(() => er(e.baseUrl), [e.baseUrl]), n = e.streamPath ?? "/runs/stream", [r, o] = ve(e.token ?? null), s = Re(e.headers ?? {}), i = e.credentials ?? "include", [a, l] = ve(!1), [c, d] = ve(null), [f, h] = ve(""), [p, g] = ve(null), [x, y] = ve(0), [m, w] = ve(!1), b = Re(null), T = Re(!0), C = Re(0), S = Re(null), k = Re(null), _ = Re(null), N = Re(null), A = he((P) => {
3338
+ const t = ut(() => er(e.baseUrl), [e.baseUrl]), n = e.streamPath ?? "/runs/stream", [r, o] = ve(e.token ?? null), s = Re(e.headers ?? {}), i = e.credentials ?? "include", [a, l] = ve(!1), [c, d] = ve(null), [f, h] = ve(""), [p, g] = ve(null), [x, y] = ve(0), [m, w] = ve(!1), b = Re(null), T = Re(!0), C = Re(0), S = Re(null), k = Re(null), _ = Re(null), N = Re(null), A = he((P) => {
3339
3339
  o(P);
3340
3340
  }, []), M = he(() => {
3341
3341
  h(""), g(null), d(null), k.current = null, _.current = null, N.current = null;
@@ -3352,14 +3352,14 @@ function Dy(e = {}) {
3352
3352
  threadId: P.threadId ?? null,
3353
3353
  headers: {}
3354
3354
  }, (async () => {
3355
- var ye, Ne, Z, fe, Te, ne, D, Y, se, ue, le, Me, z, be, je, De, rt, ht;
3355
+ var ye, Ne, Z, fe, Te, ne, D, Y, se, ue, le, Me, z, be, je, De, rt, ft;
3356
3356
  const te = (Ze) => {
3357
3357
  var we;
3358
3358
  try {
3359
3359
  const Qe = JSON.parse(JSON.stringify(Ze));
3360
- return (we = Qe == null ? void 0 : Qe.payload) != null && we.files_info && Array.isArray(Qe.payload.files_info) && (Qe.payload.files_info = Qe.payload.files_info.map((ct) => ({
3361
- ...ct,
3362
- data: ct != null && ct.data ? `<base64 ${String(ct.data).length} chars>` : ct == null ? void 0 : ct.data
3360
+ return (we = Qe == null ? void 0 : Qe.payload) != null && we.files_info && Array.isArray(Qe.payload.files_info) && (Qe.payload.files_info = Qe.payload.files_info.map((lt) => ({
3361
+ ...lt,
3362
+ data: lt != null && lt.data ? `<base64 ${String(lt.data).length} chars>` : lt == null ? void 0 : lt.data
3363
3363
  }))), Qe;
3364
3364
  } catch {
3365
3365
  return Ze;
@@ -3378,8 +3378,8 @@ function Dy(e = {}) {
3378
3378
  ke && (It = ((Z = JSON.parse(ke)) == null ? void 0 : Z.apiKey) || null);
3379
3379
  } catch {
3380
3380
  }
3381
- const q = Le || Ot || It || null;
3382
- q && (Ze = { Authorization: `Bearer ${q}` });
3381
+ const G = Le || Ot || It || null;
3382
+ G && (Ze = { Authorization: `Bearer ${G}` });
3383
3383
  }
3384
3384
  } catch {
3385
3385
  }
@@ -3391,44 +3391,44 @@ function Dy(e = {}) {
3391
3391
  let we = {};
3392
3392
  if (typeof window < "u")
3393
3393
  try {
3394
- const ut = (fe = window.localStorage) == null ? void 0 : fe.getItem("authSessionId");
3395
- ut && (we = { "X-Session-Id": ut });
3394
+ const ct = (fe = window.localStorage) == null ? void 0 : fe.getItem("authSessionId");
3395
+ ct && (we = { "X-Session-Id": ct });
3396
3396
  } catch {
3397
3397
  }
3398
3398
  const Qe = {
3399
3399
  ...Ze,
3400
3400
  ...we,
3401
3401
  ...s.current
3402
- }, ct = {
3402
+ }, lt = {
3403
3403
  "Content-Type": "application/json",
3404
3404
  Accept: "text/event-stream",
3405
3405
  ...Qe
3406
3406
  }, at = await fetch(t + n, {
3407
3407
  method: "POST",
3408
- headers: ct,
3408
+ headers: lt,
3409
3409
  body: JSON.stringify(P),
3410
3410
  signal: W.signal,
3411
3411
  credentials: i
3412
3412
  });
3413
3413
  if (S.current && (S.current.headers = Qe), !at.ok || !at.body) {
3414
- const ut = await at.text().catch(() => "");
3414
+ const ct = await at.text().catch(() => "");
3415
3415
  console.debug(
3416
3416
  "[use-chat] non-OK response",
3417
3417
  at.status,
3418
- ut == null ? void 0 : ut.slice(0, 500)
3418
+ ct == null ? void 0 : ct.slice(0, 500)
3419
3419
  );
3420
- const Le = `stream ${at.status}${ut ? ": " + ut : ""}`;
3420
+ const Le = `stream ${at.status}${ct ? ": " + ct : ""}`;
3421
3421
  throw (Te = j == null ? void 0 : j.onConnectionError) == null || Te.call(j, Le), ee = !0, $ = "error", L = Le, new Error(Le);
3422
3422
  }
3423
3423
  w(!0);
3424
3424
  const ot = at.body.getReader(), Et = new TextDecoder();
3425
- let pt = "", gt = [];
3425
+ let ht = "", gt = [];
3426
3426
  C.current = 0, y(0);
3427
3427
  let Mt = 0, Ct = null;
3428
3428
  const Xe = () => {
3429
3429
  if (gt.length) {
3430
- const ut = gt.join("");
3431
- gt = [], T.current && h((Le) => Le + ut);
3430
+ const ct = gt.join("");
3431
+ gt = [], T.current && h((Le) => Le + ct);
3432
3432
  }
3433
3433
  Ct = null;
3434
3434
  }, Lt = () => {
@@ -3436,34 +3436,34 @@ function Dy(e = {}) {
3436
3436
  };
3437
3437
  let Xt = Date.now();
3438
3438
  const qt = setInterval(() => {
3439
- var ut;
3439
+ var ct;
3440
3440
  if (Date.now() - Xt > 6e4) {
3441
3441
  const Le = "Stream idle timeout";
3442
- d(Le), $ = "error", L = Le, W.abort(), (ut = j == null ? void 0 : j.onError) == null || ut.call(j, Le);
3442
+ d(Le), $ = "error", L = Le, W.abort(), (ct = j == null ? void 0 : j.onError) == null || ct.call(j, Le);
3443
3443
  }
3444
3444
  }, 5e3), Jt = 1024 * 1024;
3445
3445
  try {
3446
- const ut = at.headers.get("X-Thread-Id") || at.headers.get("x-thread-id"), Le = at.headers.get("X-Thread-Created") || at.headers.get("x-thread-created"), Ot = ut ?? null, It = String(Le ?? "").toLowerCase() === "true";
3446
+ const ct = at.headers.get("X-Thread-Id") || at.headers.get("x-thread-id"), Le = at.headers.get("X-Thread-Created") || at.headers.get("x-thread-created"), Ot = ct ?? null, It = String(Le ?? "").toLowerCase() === "true";
3447
3447
  for (S.current && !S.current.threadId && (S.current = {
3448
3448
  ...S.current,
3449
3449
  threadId: Ot
3450
3450
  }), (ne = j == null ? void 0 : j.onOpen) == null || ne.call(j, { threadId: Ot, created: It }); ; ) {
3451
- const { value: q, done: ke } = await ot.read();
3451
+ const { value: G, done: ke } = await ot.read();
3452
3452
  if (ke) break;
3453
- pt += Et.decode(q, { stream: !0 }), pt.length > Jt && (pt = "", console.warn("Stream buffer reset: exceeded 1MB"));
3453
+ ht += Et.decode(G, { stream: !0 }), ht.length > Jt && (ht = "", console.warn("Stream buffer reset: exceeded 1MB"));
3454
3454
  let xe;
3455
- for (; (xe = pt.indexOf(`
3455
+ for (; (xe = ht.indexOf(`
3456
3456
 
3457
3457
  `)) >= 0; ) {
3458
- const lt = pt.slice(0, xe);
3459
- pt = pt.slice(xe + 2);
3460
- const st = $y(lt);
3461
- if (!st) continue;
3458
+ const st = ht.slice(0, xe);
3459
+ ht = ht.slice(xe + 2);
3460
+ const pt = $y(st);
3461
+ if (!pt) continue;
3462
3462
  let et;
3463
3463
  try {
3464
- et = JSON.parse(st);
3464
+ et = JSON.parse(pt);
3465
3465
  } catch {
3466
- console.debug("[use-chat] malformed SSE:", st.slice(0, 200));
3466
+ console.debug("[use-chat] malformed SSE:", pt.slice(0, 200));
3467
3467
  continue;
3468
3468
  }
3469
3469
  const Fe = Ly(et) ? et.data : et;
@@ -3532,11 +3532,11 @@ function Dy(e = {}) {
3532
3532
  }
3533
3533
  }
3534
3534
  Xe(), $ === null && !W.signal.aborted && ($ = "complete");
3535
- } catch (ut) {
3536
- if (ut.name === "AbortError")
3535
+ } catch (ct) {
3536
+ if (ct.name === "AbortError")
3537
3537
  $ = $ ?? "aborted";
3538
3538
  else {
3539
- const Le = ut.message || String(ut);
3539
+ const Le = ct.message || String(ct);
3540
3540
  $ = "error", L = Le, d(Le), (be = j == null ? void 0 : j.onError) == null || be.call(j, Le);
3541
3541
  }
3542
3542
  } finally {
@@ -3556,14 +3556,14 @@ function Dy(e = {}) {
3556
3556
  $ = "error", L = we, d(we), (De = j == null ? void 0 : j.onError) == null || De.call(j, we), ee || ((rt = j == null ? void 0 : j.onConnectionError) == null || rt.call(j, we), ee = !0);
3557
3557
  }
3558
3558
  } finally {
3559
- const Ze = C.current, we = k.current, Qe = _.current, ct = N.current, at = $ ?? (W.signal.aborted ? "aborted" : L ? "error" : "complete");
3559
+ const Ze = C.current, we = k.current, Qe = _.current, lt = N.current, at = $ ?? (W.signal.aborted ? "aborted" : L ? "error" : "complete");
3560
3560
  try {
3561
- (ht = j == null ? void 0 : j.onClosed) == null || ht.call(j, {
3561
+ (ft = j == null ? void 0 : j.onClosed) == null || ft.call(j, {
3562
3562
  reason: at,
3563
3563
  lastSeq: Ze,
3564
3564
  lastCheckpointId: we,
3565
3565
  lastCheckpointNs: Qe,
3566
- lastStateHistory: ct,
3566
+ lastStateHistory: lt,
3567
3567
  error: L
3568
3568
  });
3569
3569
  } catch (ot) {
@@ -3787,7 +3787,7 @@ function Fy({
3787
3787
  ), _ = he(() => {
3788
3788
  h.current && (h.current.manualStop = !0), b();
3789
3789
  }, [b]);
3790
- return dt(
3790
+ return ut(
3791
3791
  () => ({
3792
3792
  startStream: k,
3793
3793
  stop: _,
@@ -4057,13 +4057,13 @@ function av({
4057
4057
  onAuthError: a,
4058
4058
  onThreadChange: l
4059
4059
  }) {
4060
- const { api: c, baseUrl: d } = vd(), f = dt(() => er(d), [d]), h = dt(() => {
4060
+ const { api: c, baseUrl: d } = vd(), f = ut(() => er(d), [d]), h = ut(() => {
4061
4061
  try {
4062
4062
  return new URL(d).host;
4063
4063
  } catch {
4064
4064
  return "unknown";
4065
4065
  }
4066
- }, [d]), p = dt(
4066
+ }, [d]), p = ut(
4067
4067
  () => `threadPayload:${Vy}:${h}:`,
4068
4068
  [h]
4069
4069
  ), g = he(
@@ -4092,7 +4092,7 @@ function av({
4092
4092
  qi(h, (I = c.getAuthToken) == null ? void 0 : I.call(c))
4093
4093
  );
4094
4094
  return rs(E);
4095
- }), S = dt(() => Yi(T), [T]), [k, _] = ve(t), [N, A] = ve(!1), [M, F] = ve(!1), [U, P] = ve(null), [B, j] = ve(null), [W, $] = ve(null), [L, ee] = ve([]), te = he(() => {
4095
+ }), S = ut(() => Yi(T), [T]), [k, _] = ve(t), [N, A] = ve(!1), [M, F] = ve(!1), [U, P] = ve(null), [B, j] = ve(null), [W, $] = ve(null), [L, ee] = ve([]), te = he(() => {
4096
4096
  const E = Gi(w);
4097
4097
  Qo(() => {
4098
4098
  C(rs(E));
@@ -4103,13 +4103,13 @@ function av({
4103
4103
  seed: je,
4104
4104
  prepend: De,
4105
4105
  pushUser: rt,
4106
- onEvent: ht,
4106
+ onEvent: ft,
4107
4107
  reset: Ze
4108
4108
  } = _y(), we = Re(k);
4109
4109
  Tt(() => {
4110
4110
  we.current = k;
4111
4111
  }, [k]);
4112
- const Qe = Re(!1), ct = Re([]), at = Re(null), ot = Re(null), Et = Re(/* @__PURE__ */ new Map()), pt = Re(k), gt = Re(!1), Mt = Re(null), Ct = Re(/* @__PURE__ */ new Map()), Xe = Re(/* @__PURE__ */ new Map()), Lt = Re(/* @__PURE__ */ new Map()), Xt = Re(/* @__PURE__ */ new Map()), qt = he(
4112
+ const Qe = Re(!1), lt = Re([]), at = Re(null), ot = Re(null), Et = Re(/* @__PURE__ */ new Map()), ht = Re(k), gt = Re(!1), Mt = Re(null), Ct = Re(/* @__PURE__ */ new Map()), Xe = Re(/* @__PURE__ */ new Map()), Lt = Re(/* @__PURE__ */ new Map()), Xt = Re(/* @__PURE__ */ new Map()), qt = he(
4113
4113
  (E) => {
4114
4114
  if (!E) {
4115
4115
  ee([]);
@@ -4138,7 +4138,7 @@ function av({
4138
4138
  const re = (K = I[ae]) == null ? void 0 : K[0];
4139
4139
  re && E.delete(re);
4140
4140
  }
4141
- }, []), ut = he(
4141
+ }, []), ct = he(
4142
4142
  (E, I, H) => {
4143
4143
  if (!E) return;
4144
4144
  const K = H === "replace" ? [] : Ct.current.get(E) ?? [], ae = H === "replace" ? I : [...I, ...K];
@@ -4211,23 +4211,23 @@ function av({
4211
4211
  K(re);
4212
4212
  } finally {
4213
4213
  Qe.current = !1;
4214
- const re = ct.current.shift();
4214
+ const re = lt.current.shift();
4215
4215
  re && re().catch(() => {
4216
4216
  });
4217
4217
  }
4218
4218
  };
4219
- Qe.current ? ct.current.push(ae) : ae().catch((re) => {
4219
+ Qe.current ? lt.current.push(ae) : ae().catch((re) => {
4220
4220
  K(re);
4221
4221
  });
4222
- }), []), q = Re(S.length), ke = Re(!1);
4222
+ }), []), G = Re(S.length), ke = Re(!1);
4223
4223
  Tt(() => {
4224
- q.current = S.length;
4224
+ G.current = S.length;
4225
4225
  }, [S.length]), Tt(() => {
4226
4226
  const E = z.pendingInterrupt ?? Uy(z.messages);
4227
4227
  jc(W, E) || $(E ?? null);
4228
4228
  }, [W, z.messages, z.pendingInterrupt]);
4229
4229
  const xe = he(async () => {
4230
- const E = q.current > 0;
4230
+ const E = G.current > 0;
4231
4231
  E || A(!0);
4232
4232
  try {
4233
4233
  const I = await c.listThreads();
@@ -4242,7 +4242,7 @@ function av({
4242
4242
  } finally {
4243
4243
  E || A(!1);
4244
4244
  }
4245
- }, [c, i]), lt = Re(!1), st = Re(null), et = Re(null), Fe = Re(""), [nn, ze] = ve("idle"), xt = Re({
4245
+ }, [c, i]), st = Re(!1), pt = Re(null), et = Re(null), Fe = Re(""), [nn, ze] = ve("idle"), xt = Re({
4246
4246
  attempts: 0,
4247
4247
  timer: null,
4248
4248
  reason: null
@@ -4297,7 +4297,7 @@ function av({
4297
4297
  threadId: ae,
4298
4298
  snapshot: bn(E, { cloneMessages: !0 })
4299
4299
  };
4300
- Et.current.set(ae, Yt), pt.current = ae;
4300
+ Et.current.set(ae, Yt), ht.current = ae;
4301
4301
  }
4302
4302
  if (!Ke)
4303
4303
  return;
@@ -4346,7 +4346,7 @@ function av({
4346
4346
  );
4347
4347
  },
4348
4348
  [De, je, $]
4349
- ), G = he(
4349
+ ), q = he(
4350
4350
  (E) => {
4351
4351
  if (E.threadId != null && E.threadId !== we.current)
4352
4352
  return;
@@ -4355,7 +4355,7 @@ function av({
4355
4355
  checkpointId: I.checkpointId ?? null,
4356
4356
  checkpointNs: I.checkpointNs ?? null,
4357
4357
  pendingInterrupt: I.interrupt ?? null
4358
- }), $(I.interrupt ?? null), ne(I.nextCursor ?? null), Ne(!!I.nextCursor), Y(I.checkpointId ?? void 0), ue(I.checkpointNs ?? void 0), Me(I.nextCursorNs ?? void 0), pt.current = E.threadId, qt(E.threadId ?? we.current ?? null);
4358
+ }), $(I.interrupt ?? null), ne(I.nextCursor ?? null), Ne(!!I.nextCursor), Y(I.checkpointId ?? void 0), ue(I.checkpointNs ?? void 0), Me(I.nextCursorNs ?? void 0), ht.current = E.threadId, qt(E.threadId ?? we.current ?? null);
4359
4359
  },
4360
4360
  [je, $, qt]
4361
4361
  ), ie = he((E) => {
@@ -4366,7 +4366,7 @@ function av({
4366
4366
  H.startsWith(I) && Lt.current.delete(H);
4367
4367
  for (const H of Xt.current.keys())
4368
4368
  H.startsWith(I) && Xt.current.delete(H);
4369
- pt.current === E && (pt.current = null);
4369
+ ht.current === E && (ht.current = null);
4370
4370
  }, [y]), Se = he(() => {
4371
4371
  const E = we.current;
4372
4372
  E && ie(E), Ze([]), Ne(!1), fe(!1), ne(null), Y(void 0), ue(void 0), Me(void 0);
@@ -4408,7 +4408,7 @@ function av({
4408
4408
  ), { startStream: Ve, stop: He, isStreaming: Dt, error: bt, setAuthToken: St, replayBufferedEvents: Zt } = Fy({
4409
4409
  baseUrl: f,
4410
4410
  onThreadInfo: mt,
4411
- onMessageEvent: ht,
4411
+ onMessageEvent: ft,
4412
4412
  onUnhandledEvent: (E) => {
4413
4413
  console.warn(`[ChatSessionProvider] Unhandled stream event: ${E.type}`, E);
4414
4414
  },
@@ -4522,7 +4522,7 @@ function av({
4522
4522
  Qt(), xt.current.attempts = 0, ze("idle"), He();
4523
4523
  }, [Qt, ze, He]);
4524
4524
  Tt(() => {
4525
- lt.current = Dt;
4525
+ st.current = Dt;
4526
4526
  }, [Dt]), Tt(() => {
4527
4527
  if (!Nr()) return;
4528
4528
  et.current !== null && (window.clearTimeout(et.current), et.current = null);
@@ -4617,7 +4617,7 @@ function av({
4617
4617
  delete K[E];
4618
4618
  const ae = H.order.filter((Ke) => Ke !== E), re = { byId: K, order: ae };
4619
4619
  return I = Yi(re), re;
4620
- }), I && Jn(I, { immediate: !0 }), ie(E), we.current === E && (ot.current = E, _(null), we.current = null, pt.current = null, Se()), await xe(), P(null);
4620
+ }), I && Jn(I, { immediate: !0 }), ie(E), we.current === E && (ot.current = E, _(null), we.current = null, ht.current = null, Se()), await xe(), P(null);
4621
4621
  } catch (I) {
4622
4622
  throw P(String(I)), I;
4623
4623
  }
@@ -4657,10 +4657,10 @@ function av({
4657
4657
  if (Nt) {
4658
4658
  const Gt = Et.current.get(E);
4659
4659
  if (Gt)
4660
- G(Gt), jt = !0;
4660
+ q(Gt), jt = !0;
4661
4661
  else {
4662
4662
  const Ht = g(E);
4663
- Ht && (Et.current.set(E, Ht), G(Ht), jt = !0);
4663
+ Ht && (Et.current.set(E, Ht), q(Ht), jt = !0);
4664
4664
  }
4665
4665
  }
4666
4666
  const rn = K || !jt || !!I || !!H, Fn = async (Gt) => {
@@ -4670,7 +4670,7 @@ function av({
4670
4670
  { threadId: E, checkpointId: I, checkpointNs: H },
4671
4671
  { force: K }
4672
4672
  ), { latest: fo, checkpoints: ho, snapshots: Hr } = Ps(Ht);
4673
- R(fo, "replace", E), ut(E, ho, "replace"), Le(E, Hr, "replace"), j(null);
4673
+ R(fo, "replace", E), ct(E, ho, "replace"), Le(E, Hr, "replace"), j(null);
4674
4674
  } catch (Ht) {
4675
4675
  throw (!jt || K || Gt) && (i == null || i(String(Ht))), j(String(Ht)), Ht;
4676
4676
  } finally {
@@ -4683,18 +4683,18 @@ function av({
4683
4683
  }, `loadThread-${E}`);
4684
4684
  },
4685
4685
  [
4686
- G,
4686
+ q,
4687
4687
  R,
4688
4688
  It,
4689
4689
  Ot,
4690
4690
  i,
4691
- ut,
4691
+ ct,
4692
4692
  Le
4693
4693
  ]
4694
4694
  ), $n = he(async () => {
4695
4695
  await It(async () => {
4696
4696
  const E = we.current;
4697
- E && ie(E), ot.current = null, _(null), we.current = null, pt.current = null, Se(), Y(void 0), ue(void 0), Me(void 0), ee([]);
4697
+ E && ie(E), ot.current = null, _(null), we.current = null, ht.current = null, Se(), Y(void 0), ue(void 0), Me(void 0), ee([]);
4698
4698
  try {
4699
4699
  localStorage.removeItem("lastThreadId");
4700
4700
  } catch (I) {
@@ -4742,7 +4742,7 @@ function av({
4742
4742
  ne(null), Me(void 0), Ne(!1), j(null);
4743
4743
  return;
4744
4744
  }
4745
- R(K, "prepend", I ?? void 0), I && (ut(I, ae, "prepend"), Le(I, re, "prepend")), j(null);
4745
+ R(K, "prepend", I ?? void 0), I && (ct(I, ae, "prepend"), Le(I, re, "prepend")), j(null);
4746
4746
  } catch (I) {
4747
4747
  throw j(String(I)), I;
4748
4748
  } finally {
@@ -4759,7 +4759,7 @@ function av({
4759
4759
  le,
4760
4760
  Te,
4761
4761
  Z,
4762
- ut,
4762
+ ct,
4763
4763
  Le
4764
4764
  ]
4765
4765
  ), Zo = he(
@@ -4896,7 +4896,7 @@ function av({
4896
4896
  })(), () => {
4897
4897
  }), []), Tt(() => {
4898
4898
  const E = we.current;
4899
- if (!E || pt.current !== E) return;
4899
+ if (!E || ht.current !== E) return;
4900
4900
  z.messages.length && z.messages[z.messages.length - 1];
4901
4901
  const I = bn({
4902
4902
  checkpointId: z.lastCheckpointId ?? null,
@@ -4917,7 +4917,7 @@ function av({
4917
4917
  threadId: E,
4918
4918
  snapshot: I
4919
4919
  };
4920
- Et.current.set(E, We), st.current && window.clearTimeout(st.current), st.current = window.setTimeout(() => {
4920
+ Et.current.set(E, We), pt.current && window.clearTimeout(pt.current), pt.current = window.setTimeout(() => {
4921
4921
  try {
4922
4922
  x(We, 100);
4923
4923
  } catch (Nt) {
@@ -4935,7 +4935,7 @@ function av({
4935
4935
  W,
4936
4936
  x
4937
4937
  ]);
4938
- const Jm = dt(
4938
+ const Jm = ut(
4939
4939
  () => ({
4940
4940
  threads: S,
4941
4941
  currentThreadId: k,
@@ -4964,7 +4964,7 @@ function av({
4964
4964
  te,
4965
4965
  _
4966
4966
  ]
4967
- ), Zm = dt(() => {
4967
+ ), Zm = ut(() => {
4968
4968
  const E = z.lastBranch ?? null, I = z.assemblingId ?? null, H = E || I ? {
4969
4969
  branchLabel: (E == null ? void 0 : E.branchLabel) ?? null,
4970
4970
  lastBranch: E,
@@ -5014,7 +5014,7 @@ function av({
5014
5014
  Zo,
5015
5015
  B,
5016
5016
  L
5017
- ]), Qm = dt(
5017
+ ]), Qm = ut(
5018
5018
  () => ({
5019
5019
  isStreaming: Dt,
5020
5020
  error: bt,
@@ -5433,7 +5433,7 @@ function tt() {
5433
5433
  function yn(e) {
5434
5434
  return ci(tt(), (t) => Ce(e, t));
5435
5435
  }
5436
- function ft(e, t = [], { singleton: n } = { singleton: !0 }) {
5436
+ function dt(e, t = [], { singleton: n } = { singleton: !0 }) {
5437
5437
  return {
5438
5438
  constructor: e,
5439
5439
  dependencies: t,
@@ -5490,7 +5490,7 @@ const wv = {
5490
5490
  3: "error",
5491
5491
  1: "log",
5492
5492
  2: "warn"
5493
- }, bv = () => typeof globalThis > "u" ? window : globalThis, gr = ft(
5493
+ }, bv = () => typeof globalThis > "u" ? window : globalThis, gr = dt(
5494
5494
  () => {
5495
5495
  const e = Q(
5496
5496
  3
@@ -5618,7 +5618,7 @@ function jd(e, t, n) {
5618
5618
  }
5619
5619
  }, [a, t, i]), s;
5620
5620
  }
5621
- const cn = ft(
5621
+ const cn = dt(
5622
5622
  () => {
5623
5623
  const e = tt(), t = tt(), n = Q(0), r = tt(), o = Q(0), s = tt(), i = tt(), a = Q(0), l = Q(0), c = Q(0), d = Q(0), f = tt(), h = tt(), p = Q(!1), g = Q(!1), x = Q(!1);
5624
5624
  return Ce(
@@ -5799,7 +5799,7 @@ function $d(e, t) {
5799
5799
  function Ao(e, t) {
5800
5800
  return !!(e && e[0] === t[0] && e[1] === t[1]);
5801
5801
  }
5802
- const dl = ft(
5802
+ const dl = dt(
5803
5803
  () => ({ recalcInProgress: Q(!1) }),
5804
5804
  [],
5805
5805
  { singleton: !0 }
@@ -5966,7 +5966,7 @@ function Ov(e) {
5966
5966
  const Mv = {
5967
5967
  offsetHeight: "height",
5968
5968
  offsetWidth: "width"
5969
- }, Gn = ft(
5969
+ }, Gn = dt(
5970
5970
  ([{ log: e }, { recalcInProgress: t }]) => {
5971
5971
  const n = tt(), r = tt(), o = ln(r, 0), s = tt(), i = tt(), a = Q(0), l = Q([]), c = Q(void 0), d = Q(void 0), f = Q((C, S) => ur(C, Mv[S])), h = Q(void 0), p = Q(0), g = Rv(), x = ln(
5972
5972
  J(n, Ge(l, e, p), Wn(_v, g), At()),
@@ -6211,7 +6211,7 @@ function Dv(e) {
6211
6211
  }
6212
6212
  );
6213
6213
  }
6214
- const Hd = ft(
6214
+ const Hd = dt(
6215
6215
  ([{ groupIndices: e, sizes: t, totalCount: n }, { headerHeight: r, scrollTop: o }]) => {
6216
6216
  const s = tt(), i = tt(), a = yn(J(s, pe(Dv)));
6217
6217
  return Ce(
@@ -6238,7 +6238,7 @@ const Hd = ft(
6238
6238
  ), { groupCounts: s, topItemsIndexes: i };
6239
6239
  },
6240
6240
  _t(Gn, cn)
6241
- ), xr = ft(
6241
+ ), xr = dt(
6242
6242
  ([{ log: e }]) => {
6243
6243
  const t = Q(!1), n = yn(
6244
6244
  J(
@@ -6258,7 +6258,7 @@ function Ud(e) {
6258
6258
  const t = typeof e == "number" ? { index: e } : e;
6259
6259
  return t.align || (t.align = "start"), (!t.behavior || !Lv) && (t.behavior = "auto"), t.offset || (t.offset = 0), t;
6260
6260
  }
6261
- const Wo = ft(
6261
+ const Wo = dt(
6262
6262
  ([
6263
6263
  { gap: e, listRefresh: t, sizes: n, totalCount: r },
6264
6264
  {
@@ -6340,7 +6340,7 @@ function pl(e, t) {
6340
6340
  const n = t - 1;
6341
6341
  return typeof e == "number" ? e : e.index === "LAST" ? n : e.index;
6342
6342
  }
6343
- const Vo = ft(
6343
+ const Vo = dt(
6344
6344
  ([{ defaultItemSize: e, listRefresh: t, sizes: n }, { scrollTop: r }, { scrollTargetReached: o, scrollToIndex: s }, { didMount: i }]) => {
6345
6345
  const a = Q(!0), l = Q(0), c = Q(!0);
6346
6346
  return Ce(
@@ -6396,7 +6396,7 @@ const jo = "up", bo = "down", Fv = "none", zv = {
6396
6396
  scrollTop: 0,
6397
6397
  viewportHeight: 0
6398
6398
  }
6399
- }, Bv = 0, Ko = ft(([{ footerHeight: e, headerHeight: t, scrollBy: n, scrollContainerState: r, scrollTop: o, viewportHeight: s }]) => {
6399
+ }, Bv = 0, Ko = dt(([{ footerHeight: e, headerHeight: t, scrollBy: n, scrollContainerState: r, scrollTop: o, viewportHeight: s }]) => {
6400
6400
  const i = Q(!1), a = Q(!0), l = tt(), c = tt(), d = Q(4), f = Q(Bv), h = ln(
6401
6401
  J(
6402
6402
  Ia(J(Ae(o), Ar(1), Hn(!0)), J(Ae(o), Ar(1), Hn(!1), Fc(100))),
@@ -6536,7 +6536,7 @@ function Vc(e, t) {
6536
6536
  var n;
6537
6537
  return typeof e == "number" ? e : (n = e[t]) != null ? n : 0;
6538
6538
  }
6539
- const ml = ft(
6539
+ const ml = dt(
6540
6540
  ([{ deviation: e, fixedHeaderHeight: t, headerHeight: n, scrollTop: r, viewportHeight: o }]) => {
6541
6541
  const s = tt(), i = Q(0), a = Q(0), l = Q(0), c = ln(
6542
6542
  J(
@@ -6674,7 +6674,7 @@ function Kc(e, t, n) {
6674
6674
  }
6675
6675
  return s;
6676
6676
  }
6677
- const Dr = ft(
6677
+ const Dr = dt(
6678
6678
  ([
6679
6679
  { data: e, firstItemIndex: t, gap: n, sizes: r, totalCount: o },
6680
6680
  s,
@@ -6849,7 +6849,7 @@ const Dr = ft(
6849
6849
  dl
6850
6850
  ),
6851
6851
  { singleton: !0 }
6852
- ), Kd = ft(
6852
+ ), Kd = dt(
6853
6853
  ([{ fixedFooterHeight: e, fixedHeaderHeight: t, footerHeight: n, headerHeight: r }, { listState: o }]) => {
6854
6854
  const s = tt(), i = ln(
6855
6855
  J(
@@ -6862,7 +6862,7 @@ const Dr = ft(
6862
6862
  },
6863
6863
  _t(cn, Dr),
6864
6864
  { singleton: !0 }
6865
- ), Uv = ft(
6865
+ ), Uv = dt(
6866
6866
  ([{ viewportHeight: e }, { totalListHeight: t }]) => {
6867
6867
  const n = Q(!1), r = ln(
6868
6868
  J(
@@ -6878,7 +6878,7 @@ const Dr = ft(
6878
6878
  },
6879
6879
  _t(cn, Kd),
6880
6880
  { singleton: !0 }
6881
- ), qd = ft(() => ({
6881
+ ), qd = dt(() => ({
6882
6882
  context: Q(null)
6883
6883
  })), Wv = ({
6884
6884
  itemBottom: e,
@@ -6886,7 +6886,7 @@ const Dr = ft(
6886
6886
  locationParams: { align: n, behavior: r, ...o },
6887
6887
  viewportBottom: s,
6888
6888
  viewportTop: i
6889
- }) => t < i ? { ...o, align: n ?? "start", behavior: r } : e > s ? { ...o, align: n ?? "end", behavior: r } : null, Gd = ft(
6889
+ }) => t < i ? { ...o, align: n ?? "start", behavior: r } : e > s ? { ...o, align: n ?? "end", behavior: r } : null, Gd = dt(
6890
6890
  ([
6891
6891
  { gap: e, sizes: t, totalCount: n },
6892
6892
  { fixedFooterHeight: r, fixedHeaderHeight: o, headerHeight: s, scrollingInProgress: i, scrollTop: a, viewportHeight: l },
@@ -6930,7 +6930,7 @@ const Dr = ft(
6930
6930
  function qc(e) {
6931
6931
  return e ? e === "smooth" ? "smooth" : "auto" : !1;
6932
6932
  }
6933
- const Vv = (e, t) => typeof e == "function" ? qc(e(t)) : t && qc(e), Kv = ft(
6933
+ const Vv = (e, t) => typeof e == "function" ? qc(e(t)) : t && qc(e), Kv = dt(
6934
6934
  ([
6935
6935
  { listRefresh: e, totalCount: t, fixedItemSize: n, data: r },
6936
6936
  { atBottomState: o, isAtBottom: s },
@@ -7035,7 +7035,7 @@ const Vv = (e, t) => typeof e == "function" ? qc(e(t)) : t && qc(e), Kv = ft(
7035
7035
  qd,
7036
7036
  Gd
7037
7037
  )
7038
- ), qv = ft(
7038
+ ), qv = dt(
7039
7039
  ([{ data: e, firstItemIndex: t, gap: n, sizes: r }, { initialTopMostItemIndex: o }, { initialItemCount: s, listState: i }, { didMount: a }]) => (Ce(
7040
7040
  J(
7041
7041
  a,
@@ -7048,7 +7048,7 @@ const Vv = (e, t) => typeof e == "function" ? qc(e(t)) : t && qc(e), Kv = ft(
7048
7048
  ), {}),
7049
7049
  _t(Gn, Vo, Dr, xr),
7050
7050
  { singleton: !0 }
7051
- ), Gv = ft(
7051
+ ), Gv = dt(
7052
7052
  ([{ didMount: e }, { scrollTo: t }, { listState: n }]) => {
7053
7053
  const r = Q(0);
7054
7054
  return wt(
@@ -7078,7 +7078,7 @@ const Vv = (e, t) => typeof e == "function" ? qc(e(t)) : t && qc(e), Kv = ft(
7078
7078
  },
7079
7079
  _t(xr, cn, Dr),
7080
7080
  { singleton: !0 }
7081
- ), Yd = ft(
7081
+ ), Yd = dt(
7082
7082
  ([{ scrollVelocity: e }]) => {
7083
7083
  const t = Q(!1), n = tt(), r = Q(!1);
7084
7084
  return Ce(
@@ -7107,7 +7107,7 @@ const Vv = (e, t) => typeof e == "function" ? qc(e(t)) : t && qc(e), Kv = ft(
7107
7107
  },
7108
7108
  _t(Ko),
7109
7109
  { singleton: !0 }
7110
- ), gl = ft(([{ scrollContainerState: e, scrollTo: t }]) => {
7110
+ ), gl = dt(([{ scrollContainerState: e, scrollTo: t }]) => {
7111
7111
  const n = tt(), r = tt(), o = tt(), s = Q(!1), i = Q(void 0);
7112
7112
  return Ce(
7113
7113
  J(
@@ -7139,7 +7139,7 @@ const Vv = (e, t) => typeof e == "function" ? qc(e(t)) : t && qc(e), Kv = ft(
7139
7139
  windowScrollTo: o,
7140
7140
  windowViewportRect: r
7141
7141
  };
7142
- }, _t(cn)), Yv = ft(
7142
+ }, _t(cn)), Yv = dt(
7143
7143
  ([
7144
7144
  { sizeRanges: e, sizes: t },
7145
7145
  { headerHeight: n, scrollTop: r },
@@ -7176,7 +7176,7 @@ const Vv = (e, t) => typeof e == "function" ? qc(e(t)) : t && qc(e), Kv = ft(
7176
7176
  function Xv(e) {
7177
7177
  return { align: "start", index: 0, offset: e.scrollTop };
7178
7178
  }
7179
- const Jv = ft(([{ topItemsIndexes: e }]) => {
7179
+ const Jv = dt(([{ topItemsIndexes: e }]) => {
7180
7180
  const t = Q(0);
7181
7181
  return Ce(
7182
7182
  J(
@@ -7191,7 +7191,7 @@ function Xd(e) {
7191
7191
  let t = !1, n;
7192
7192
  return () => (t || (t = !0, n = e()), n);
7193
7193
  }
7194
- const Zv = Xd(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.test(navigator.userAgent)), Qv = ft(
7194
+ const Zv = Xd(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.test(navigator.userAgent)), Qv = dt(
7195
7195
  ([
7196
7196
  { deviation: e, scrollBy: t, scrollingInProgress: n, scrollTop: r },
7197
7197
  { isAtBottom: o, isScrolling: s, lastJumpDueToItemResize: i, scrollDirection: a },
@@ -7270,7 +7270,7 @@ const Zv = Xd(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
7270
7270
  ), { deviation: e };
7271
7271
  },
7272
7272
  _t(cn, Ko, Dr, Gn, gr, dl)
7273
- ), ew = ft(
7273
+ ), ew = dt(
7274
7274
  ([
7275
7275
  e,
7276
7276
  t,
@@ -7309,7 +7309,7 @@ const Zv = Xd(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
7309
7309
  gr,
7310
7310
  qd
7311
7311
  )
7312
- ), Jd = ft(
7312
+ ), Jd = dt(
7313
7313
  ([
7314
7314
  {
7315
7315
  data: e,
@@ -7540,7 +7540,7 @@ const ea = "-webkit-sticky", Gc = "sticky", xl = Xd(() => {
7540
7540
  function yl(e) {
7541
7541
  return e;
7542
7542
  }
7543
- const rw = /* @__PURE__ */ ft(() => {
7543
+ const rw = /* @__PURE__ */ dt(() => {
7544
7544
  const e = Q((a) => `Item ${a}`), t = Q((a) => `Group ${a}`), n = Q({}), r = Q(yl), o = Q("div"), s = Q(so), i = (a, l = null) => ln(
7545
7545
  J(
7546
7546
  n,
@@ -7566,7 +7566,7 @@ const rw = /* @__PURE__ */ ft(() => {
7566
7566
  ScrollSeekPlaceholder: i("ScrollSeekPlaceholder"),
7567
7567
  TopItemListComponent: i("TopItemList")
7568
7568
  };
7569
- }), ow = /* @__PURE__ */ ft(
7569
+ }), ow = /* @__PURE__ */ dt(
7570
7570
  ([e, t]) => ({ ...e, ...t }),
7571
7571
  _t(Jd, rw)
7572
7572
  ), sw = ({ height: e }) => /* @__PURE__ */ u.jsx("div", { style: { height: e } }), iw = { overflowAnchor: "none", position: xl(), zIndex: 1 }, rf = { overflowAnchor: "none" }, aw = { ...rf, display: "inline-block", height: "100%" }, Yc = /* @__PURE__ */ V.memo(function({ showTopList: e = !1 }) {
@@ -7847,7 +7847,7 @@ const pw = ({ children: e }) => {
7847
7847
  }
7848
7848
  },
7849
7849
  xw
7850
- ), vw = /* @__PURE__ */ of({ useEmitter: vl, useEmitterValue: Oe, usePublisher: Sn }), ww = /* @__PURE__ */ sf({ useEmitter: vl, useEmitterValue: Oe, usePublisher: Sn }), bw = yw, Sw = /* @__PURE__ */ ft(() => {
7850
+ ), vw = /* @__PURE__ */ of({ useEmitter: vl, useEmitterValue: Oe, usePublisher: Sn }), ww = /* @__PURE__ */ sf({ useEmitter: vl, useEmitterValue: Oe, usePublisher: Sn }), bw = yw, Sw = /* @__PURE__ */ dt(() => {
7851
7851
  const e = Q((c) => /* @__PURE__ */ u.jsxs("td", { children: [
7852
7852
  "Item $",
7853
7853
  c
@@ -7917,7 +7917,7 @@ function ss(e, t) {
7917
7917
  function kw(e, t) {
7918
7918
  return e && e.column === t.column && e.row === t.row;
7919
7919
  }
7920
- const Rw = /* @__PURE__ */ ft(
7920
+ const Rw = /* @__PURE__ */ dt(
7921
7921
  ([
7922
7922
  { increaseViewportBy: e, listBoundary: t, overscan: n, visibleRange: r },
7923
7923
  { footerHeight: o, headerHeight: s, scrollBy: i, scrollContainerState: a, scrollTo: l, scrollTop: c, smoothScrollTargetReached: d, viewportHeight: f },
@@ -8017,18 +8017,18 @@ const Rw = /* @__PURE__ */ ft(
8017
8017
  je,
8018
8018
  De
8019
8019
  ]) => {
8020
- const { column: rt, row: ht } = ue, { height: Ze, width: we } = le, { width: Qe } = Me;
8020
+ const { column: rt, row: ft } = ue, { height: Ze, width: we } = le, { width: Qe } = Me;
8021
8021
  if (be === 0 && (D === 0 || Qe === 0))
8022
8022
  return Xc;
8023
8023
  if (we === 0) {
8024
8024
  const Xe = pl(De, D), Lt = Xe + Math.max(be - 1, 0);
8025
8025
  return Tw(Qc(Xe, Lt, z));
8026
8026
  }
8027
- const ct = af(Qe, we, rt);
8027
+ const lt = af(Qe, we, rt);
8028
8028
  let at, ot;
8029
- je ? Y === 0 && se === 0 && be > 0 ? (at = 0, ot = be - 1) : (at = ct * Ls((Y + ht) / (Ze + ht)), ot = ct * Jc((se + ht) / (Ze + ht)) - 1, ot = ta(D - 1, So(ot, ct - 1)), at = ta(ot, So(0, at))) : (at = 0, ot = -1);
8030
- const Et = Qc(at, ot, z), { bottom: pt, top: gt } = eu(Me, ue, le, Et), Mt = Jc(D / ct), Ct = Mt * Ze + (Mt - 1) * ht - pt;
8031
- return { bottom: pt, itemHeight: Ze, items: Et, itemWidth: we, offsetBottom: Ct, offsetTop: gt, top: gt };
8029
+ je ? Y === 0 && se === 0 && be > 0 ? (at = 0, ot = be - 1) : (at = lt * Ls((Y + ft) / (Ze + ft)), ot = lt * Jc((se + ft) / (Ze + ft)) - 1, ot = ta(D - 1, So(ot, lt - 1)), at = ta(ot, So(0, at))) : (at = 0, ot = -1);
8030
+ const Et = Qc(at, ot, z), { bottom: ht, top: gt } = eu(Me, ue, le, Et), Mt = Jc(D / lt), Ct = Mt * Ze + (Mt - 1) * ft - ht;
8031
+ return { bottom: ht, itemHeight: Ze, items: Et, itemWidth: we, offsetBottom: Ct, offsetTop: gt, top: gt };
8032
8032
  }
8033
8033
  )
8034
8034
  ),
@@ -8178,7 +8178,7 @@ function Pa(e, t, n, r) {
8178
8178
  const o = af(e.width, n.width, t.column), s = Ls(r / o), i = s * n.height + So(0, s - 1) * t.row;
8179
8179
  return i > 0 ? i + t.row : i;
8180
8180
  }
8181
- const Ew = /* @__PURE__ */ ft(() => {
8181
+ const Ew = /* @__PURE__ */ dt(() => {
8182
8182
  const e = Q((f) => `Item ${f}`), t = Q({}), n = Q(null), r = Q("virtuoso-grid-item"), o = Q("virtuoso-grid-list"), s = Q(yl), i = Q("div"), a = Q(so), l = (f, h = null) => ln(
8183
8183
  J(
8184
8184
  t,
@@ -8205,7 +8205,7 @@ const Ew = /* @__PURE__ */ ft(() => {
8205
8205
  scrollerRef: a,
8206
8206
  ScrollSeekPlaceholder: l("ScrollSeekPlaceholder", "div")
8207
8207
  };
8208
- }), Iw = /* @__PURE__ */ ft(
8208
+ }), Iw = /* @__PURE__ */ dt(
8209
8209
  ([e, t]) => ({ ...e, ...t }),
8210
8210
  _t(Rw, Ew)
8211
8211
  ), Nw = /* @__PURE__ */ V.memo(function() {
@@ -11667,7 +11667,7 @@ function Hs({
11667
11667
  allowHtml: n = !1,
11668
11668
  style: r
11669
11669
  }) {
11670
- const o = dt(() => {
11670
+ const o = ut(() => {
11671
11671
  try {
11672
11672
  if (!n) {
11673
11673
  const i = e.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, "").replace(/<iframe\b[^<]*(?:(?!<\/iframe>)<[^<]*)*<\/iframe>/gi, "").replace(/javascript:/gi, "").replace(/on\w+\s*=/gi, "");
@@ -11677,7 +11677,7 @@ function Hs({
11677
11677
  } catch (i) {
11678
11678
  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>`;
11679
11679
  }
11680
- }, [e, n]), s = dt(() => {
11680
+ }, [e, n]), s = ut(() => {
11681
11681
  const i = {
11682
11682
  color: "currentColor",
11683
11683
  ...r
@@ -11822,7 +11822,7 @@ const Tu = V.memo(function({
11822
11822
  defaultCheckpointId: _ = null,
11823
11823
  messageParentCheckpointId: N = null
11824
11824
  }) {
11825
- const [A, M] = ve(!1), [F, U] = ve("preview"), [P, B] = ve(!1), { currentThreadId: j } = il(), { respondToInterrupt: W } = al(), $ = l === "phone" || l === "half-screen", L = t.role, ee = L === "tool", te = dt(() => "type" in t && t.type === "default_message" ? t : null, [t]), ye = !!te, Ne = !(r && L !== "user"), {
11825
+ const [A, M] = ve(!1), [F, U] = ve("preview"), [P, B] = ve(!1), { currentThreadId: j } = il(), { respondToInterrupt: W } = al(), $ = l === "phone" || l === "half-screen", L = t.role, ee = L === "tool", te = ut(() => "type" in t && t.type === "default_message" ? t : null, [t]), ye = !!te, Ne = !(r && L !== "user"), {
11826
11826
  uploadingFiles: Z,
11827
11827
  handleFileClick: fe,
11828
11828
  fileViewerOpen: Te,
@@ -11841,27 +11841,27 @@ const Tu = V.memo(function({
11841
11841
  default:
11842
11842
  return "text-[hsl(var(--chat-bubble-ai-text))]";
11843
11843
  }
11844
- }, [L]), se = dt(() => te ? "" : L0(t.content), [te, t]), ue = dt(() => te ? {} : nh(t), [te, t]), le = dt(
11845
- () => te ? [] : t.content.filter((q) => q.type === "image_url"),
11844
+ }, [L]), se = ut(() => te ? "" : L0(t.content), [te, t]), ue = ut(() => te ? {} : nh(t), [te, t]), le = ut(
11845
+ () => te ? [] : t.content.filter((G) => G.type === "image_url"),
11846
11846
  [te, t]
11847
- ), Me = dt(
11848
- () => te ? [] : t.content.filter((q) => q.type === "file"),
11847
+ ), Me = ut(
11848
+ () => te ? [] : t.content.filter((G) => G.type === "file"),
11849
11849
  [te, t]
11850
- ), z = dt(
11851
- () => te ? [] : t.content.filter((q) => q.type === "interrupt"),
11850
+ ), z = ut(
11851
+ () => te ? [] : t.content.filter((G) => G.type === "interrupt"),
11852
11852
  [te, t]
11853
- ), be = (m == null ? void 0 : m.id) ?? (m == null ? void 0 : m.interrupt_id), je = fs(be), De = m == null ? void 0 : m.value, rt = dt(() => te ? "" : $0(t.content), [te, t]), ht = V.useCallback(async () => {
11854
- const q = ee ? rt : se;
11853
+ ), be = (m == null ? void 0 : m.id) ?? (m == null ? void 0 : m.interrupt_id), je = fs(be), De = m == null ? void 0 : m.value, rt = ut(() => te ? "" : $0(t.content), [te, t]), ft = V.useCallback(async () => {
11854
+ const G = ee ? rt : se;
11855
11855
  async function ke(xe) {
11856
11856
  if (navigator.clipboard && typeof navigator.clipboard.writeText == "function") {
11857
11857
  await navigator.clipboard.writeText(xe);
11858
11858
  return;
11859
11859
  }
11860
11860
  if (navigator.clipboard && typeof navigator.clipboard.write == "function" && typeof ClipboardItem < "u") {
11861
- const lt = new Blob([xe], { type: "text/plain" });
11861
+ const st = new Blob([xe], { type: "text/plain" });
11862
11862
  await navigator.clipboard.write([
11863
11863
  new ClipboardItem({
11864
- "text/plain": lt
11864
+ "text/plain": st
11865
11865
  })
11866
11866
  ]);
11867
11867
  return;
@@ -11869,17 +11869,17 @@ const Tu = V.memo(function({
11869
11869
  throw new Error("Clipboard API not supported in this context.");
11870
11870
  }
11871
11871
  try {
11872
- await ke(q), M(!0), setTimeout(() => M(!1), 2e3), y == null || y(q);
11872
+ await ke(G), M(!0), setTimeout(() => M(!1), 2e3), y == null || y(G);
11873
11873
  } catch (xe) {
11874
11874
  console.error("Failed to copy:", xe);
11875
11875
  }
11876
11876
  }, [ee, rt, se, y]), Ze = V.useCallback(() => {
11877
11877
  if (!p) return;
11878
- const q = ee ? rt : se, ke = "type" in t && t.type === "default_message" ? void 0 : {
11878
+ const G = ee ? rt : se, ke = "type" in t && t.type === "default_message" ? void 0 : {
11879
11879
  checkpointId: t.checkpointId ?? null,
11880
11880
  checkpointNs: t.checkpointNs ?? null
11881
11881
  };
11882
- p(t.id, q, ke);
11882
+ p(t.id, G, ke);
11883
11883
  }, [p, t.id, ee, rt, se, t]), we = V.useCallback(() => {
11884
11884
  g == null || g(n);
11885
11885
  }, [g, n]), Qe = V.useCallback(() => {
@@ -11894,26 +11894,26 @@ const Tu = V.memo(function({
11894
11894
  default:
11895
11895
  return /* @__PURE__ */ u.jsx(Fi, { className: ke });
11896
11896
  }
11897
- }, [$, Y, L]), ct = V.useCallback(() => {
11898
- const q = "group relative mb-4 flex w-full";
11897
+ }, [$, Y, L]), lt = V.useCallback(() => {
11898
+ const G = "group relative mb-4 flex w-full";
11899
11899
  switch (L) {
11900
11900
  case "user":
11901
- return oe(q, "justify-end");
11901
+ return oe(G, "justify-end");
11902
11902
  case "assistant":
11903
11903
  case "tool":
11904
11904
  case "system":
11905
- return oe(q, "justify-start");
11905
+ return oe(G, "justify-start");
11906
11906
  default:
11907
- return q;
11907
+ return G;
11908
11908
  }
11909
11909
  }, [L]), at = V.useCallback(() => {
11910
- const q = oe(
11910
+ const G = oe(
11911
11911
  "rounded-lg px-4 py-3 relative min-w-0 max-w-full break-words",
11912
11912
  $ && "px-3 py-2 text-sm"
11913
11913
  );
11914
11914
  if (ye)
11915
11915
  return oe(
11916
- q,
11916
+ G,
11917
11917
  "w-full",
11918
11918
  "bg-[hsl(var(--chat-bubble-ai))] text-[hsl(var(--chat-bubble-ai-text))]",
11919
11919
  "border border-border/60 dark:border-border/40 shadow-sm"
@@ -11921,25 +11921,25 @@ const Tu = V.memo(function({
11921
11921
  switch (L) {
11922
11922
  case "user":
11923
11923
  return oe(
11924
- q,
11924
+ G,
11925
11925
  "w-full md:max-w-[95%]",
11926
11926
  "bg-[hsl(var(--chat-bubble-user))] text-[hsl(var(--chat-bubble-user-text))]",
11927
11927
  "border border-transparent"
11928
11928
  );
11929
11929
  case "assistant":
11930
11930
  return oe(
11931
- q,
11931
+ G,
11932
11932
  "w-full md:max-w-[95%]",
11933
11933
  "bg-[hsl(var(--chat-bubble-ai))] text-[hsl(var(--chat-bubble-ai-text))]",
11934
11934
  "border border-border/60 dark:border-border/40"
11935
11935
  );
11936
11936
  case "tool":
11937
- return oe(q, "w-full md:max-w-[95%] bg-secondary/50 text-secondary-foreground border border-dashed");
11937
+ return oe(G, "w-full md:max-w-[95%] bg-secondary/50 text-secondary-foreground border border-dashed");
11938
11938
  case "system":
11939
- return oe(q, "w-full md:max-w-[85%] bg-accent/40 text-muted-foreground border");
11939
+ return oe(G, "w-full md:max-w-[85%] bg-accent/40 text-muted-foreground border");
11940
11940
  default:
11941
11941
  return oe(
11942
- q,
11942
+ G,
11943
11943
  "w-full md:max-w-[95%]",
11944
11944
  "bg-[hsl(var(--chat-bubble-ai))] text-[hsl(var(--chat-bubble-ai-text))]",
11945
11945
  "border border-border/60 dark:border-border/40"
@@ -11947,7 +11947,7 @@ const Tu = V.memo(function({
11947
11947
  }
11948
11948
  }, [$, ye, L]);
11949
11949
  if (ye && te)
11950
- return /* @__PURE__ */ u.jsx("div", { className: oe(ct(), h.container), children: /* @__PURE__ */ u.jsxs("div", { className: oe(at(), h.content), children: [
11950
+ return /* @__PURE__ */ u.jsx("div", { className: oe(lt(), h.container), children: /* @__PURE__ */ u.jsxs("div", { className: oe(at(), h.content), children: [
11951
11951
  /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2 mb-2 pb-2 border-b border-current/10", children: [
11952
11952
  /* @__PURE__ */ u.jsx(Fi, { className: oe("h-4 w-4", Y) }),
11953
11953
  a && /* @__PURE__ */ u.jsx("span", { className: "font-medium text-sm", children: "Assistant" })
@@ -11960,14 +11960,14 @@ const Tu = V.memo(function({
11960
11960
  }
11961
11961
  )
11962
11962
  ] }) });
11963
- const ot = V.useCallback(async (q) => {
11963
+ const ot = V.useCallback(async (G) => {
11964
11964
  if (w)
11965
11965
  return;
11966
11966
  const ke = fs(
11967
- (q == null ? void 0 : q.id) ?? (q == null ? void 0 : q.interrupt_id)
11967
+ (G == null ? void 0 : G.id) ?? (G == null ? void 0 : G.interrupt_id)
11968
11968
  );
11969
11969
  if (!ke) {
11970
- console.warn("Interrupt part missing id", q);
11970
+ console.warn("Interrupt part missing id", G);
11971
11971
  return;
11972
11972
  }
11973
11973
  try {
@@ -11977,14 +11977,14 @@ const Tu = V.memo(function({
11977
11977
  } finally {
11978
11978
  T == null || T();
11979
11979
  }
11980
- }, [w, T, b, W]), Et = V.useCallback(async (q) => {
11980
+ }, [w, T, b, W]), Et = V.useCallback(async (G) => {
11981
11981
  if (w)
11982
11982
  return;
11983
11983
  const ke = fs(
11984
- (q == null ? void 0 : q.id) ?? (q == null ? void 0 : q.interrupt_id)
11984
+ (G == null ? void 0 : G.id) ?? (G == null ? void 0 : G.interrupt_id)
11985
11985
  );
11986
11986
  if (!ke) {
11987
- console.warn("Interrupt part missing id", q);
11987
+ console.warn("Interrupt part missing id", G);
11988
11988
  return;
11989
11989
  }
11990
11990
  try {
@@ -11994,13 +11994,13 @@ const Tu = V.memo(function({
11994
11994
  } finally {
11995
11995
  T == null || T();
11996
11996
  }
11997
- }, [w, T, b, W]), pt = V.useCallback(({ part: q, i: ke }) => {
11998
- if (q.type === "text") {
11999
- const xe = q.text ?? "", lt = xe.trim(), st = bl(lt);
12000
- return st && L !== "tool" ? /* @__PURE__ */ u.jsx(rh, { data: st }, ke) : L === "user" && c && lt.length > d ? /* @__PURE__ */ u.jsx(
11997
+ }, [w, T, b, W]), ht = V.useCallback(({ part: G, i: ke }) => {
11998
+ if (G.type === "text") {
11999
+ const xe = G.text ?? "", st = xe.trim(), pt = bl(st);
12000
+ return pt && L !== "tool" ? /* @__PURE__ */ u.jsx(rh, { data: pt }, ke) : L === "user" && c && st.length > d ? /* @__PURE__ */ u.jsx(
12001
12001
  U0,
12002
12002
  {
12003
- text: lt,
12003
+ text: st,
12004
12004
  expanded: P,
12005
12005
  onExpandedChange: B,
12006
12006
  previewLength: d,
@@ -12009,8 +12009,8 @@ const Tu = V.memo(function({
12009
12009
  ke
12010
12010
  ) : /* @__PURE__ */ u.jsx(Hs, { content: xe, allowHtml: !1 }, ke);
12011
12011
  }
12012
- if (q.type === "image_url") {
12013
- const xe = q;
12012
+ if (G.type === "image_url") {
12013
+ const xe = G;
12014
12014
  return /* @__PURE__ */ u.jsx("div", { className: "my-2", children: /* @__PURE__ */ u.jsx(
12015
12015
  "img",
12016
12016
  {
@@ -12021,19 +12021,19 @@ const Tu = V.memo(function({
12021
12021
  }
12022
12022
  ) }, ke);
12023
12023
  }
12024
- if (q.type === "file") {
12025
- const xe = q, lt = xe.name || "file";
12024
+ if (G.type === "file") {
12025
+ const xe = G, st = xe.name || "file";
12026
12026
  return /* @__PURE__ */ u.jsxs(
12027
12027
  "a",
12028
12028
  {
12029
12029
  href: xe.url,
12030
- onClick: (st) => fe(st, xe, ke),
12030
+ onClick: (pt) => fe(pt, xe, ke),
12031
12031
  className: `inline-flex items-center gap-2 rounded px-2 py-1 text-xs bg-gray-100 border hover:bg-gray-200
12032
12032
  dark:bg-background/10 dark:border-border/30 dark:hover:bg-background/20`,
12033
12033
  children: [
12034
12034
  Z[ke] ? /* @__PURE__ */ u.jsx(Xa, { className: "h-4 w-4 animate-spin" }) : null,
12035
12035
  /* @__PURE__ */ u.jsxs("span", { className: "truncate max-w-[180px]", children: [
12036
- lt,
12036
+ st,
12037
12037
  Z[ke] ? " (processing)" : ""
12038
12038
  ] })
12039
12039
  ]
@@ -12041,10 +12041,10 @@ const Tu = V.memo(function({
12041
12041
  ke
12042
12042
  );
12043
12043
  }
12044
- if (q.type === "interrupt") {
12045
- const xe = q, lt = fs(
12044
+ if (G.type === "interrupt") {
12045
+ const xe = G, st = fs(
12046
12046
  (xe == null ? void 0 : xe.id) ?? (xe == null ? void 0 : xe.interrupt_id)
12047
- ), st = !!(je && lt && lt === je), et = st ? De ?? (xe == null ? void 0 : xe.value) : xe == null ? void 0 : xe.value, Fe = lt ? { ...xe, id: lt, interrupt_id: lt } : xe;
12047
+ ), pt = !!(je && st && st === je), et = pt ? De ?? (xe == null ? void 0 : xe.value) : xe == null ? void 0 : xe.value, Fe = st ? { ...xe, id: st, interrupt_id: st } : xe;
12048
12048
  return /* @__PURE__ */ u.jsx(
12049
12049
  B0,
12050
12050
  {
@@ -12052,7 +12052,7 @@ const Tu = V.memo(function({
12052
12052
  onApprove: ot,
12053
12053
  onReject: Et,
12054
12054
  disabled: w,
12055
- isActive: st,
12055
+ isActive: pt,
12056
12056
  payload: et
12057
12057
  },
12058
12058
  ke
@@ -12078,10 +12078,10 @@ const Tu = V.memo(function({
12078
12078
  /* @__PURE__ */ u.jsx(ma, { className: "h-4 w-4 text-muted-foreground" }),
12079
12079
  /* @__PURE__ */ u.jsx("span", { className: "text-sm text-muted-foreground", children: "File upload" })
12080
12080
  ] }), []), Mt = V.useCallback(() => {
12081
- const q = se.trim().length > 0 || le.length > 0 || Me.length > 0 || z.length > 0;
12081
+ const G = se.trim().length > 0 || le.length > 0 || Me.length > 0 || z.length > 0;
12082
12082
  if (!ee && Me.length > 0 && !r)
12083
12083
  return gt();
12084
- if (!ee && !q && !r)
12084
+ if (!ee && !G && !r)
12085
12085
  return null;
12086
12086
  if (ee)
12087
12087
  return /* @__PURE__ */ u.jsx(
@@ -12093,7 +12093,7 @@ const Tu = V.memo(function({
12093
12093
  t.id
12094
12094
  );
12095
12095
  if (!ee && !te) {
12096
- const ke = t, xe = /* @__PURE__ */ u.jsx("div", { className: "space-y-2", children: ke.content.map((lt, st) => /* @__PURE__ */ u.jsx(pt, { part: lt, i: st }, st)) });
12096
+ const ke = t, xe = /* @__PURE__ */ u.jsx("div", { className: "space-y-2", children: ke.content.map((st, pt) => /* @__PURE__ */ u.jsx(ht, { part: st, i: pt }, pt)) });
12097
12097
  return r ? /* @__PURE__ */ u.jsxs("div", { "aria-busy": "true", role: "status", children: [
12098
12098
  xe,
12099
12099
  /* @__PURE__ */ u.jsx(z0, { className: Y })
@@ -12109,23 +12109,23 @@ const Tu = V.memo(function({
12109
12109
  F,
12110
12110
  gt,
12111
12111
  Y
12112
- ]), Ct = dt(() => te ? "Assistant" : F0(t), [te, t]), Xe = V.useMemo(() => te ? [] : Array.isArray(C) ? C : [], [C, te]), Lt = V.useMemo(() => {
12113
- var q;
12114
- return Xe.length ? _ && Xe.some((ke) => ke.id === _) ? _ : ((q = Xe[0]) == null ? void 0 : q.id) ?? null : null;
12115
- }, [_, Xe]), qt = V.useMemo(() => !Xe.length || !S ? null : Xe.some((q) => q.id === S) ? S : null, [S, Xe]) ?? Lt, Jt = L === "user" && Xe.length > 0 && typeof k == "function", ut = V.useCallback(
12116
- (q) => {
12112
+ ]), Ct = ut(() => te ? "Assistant" : F0(t), [te, t]), Xe = V.useMemo(() => te ? [] : Array.isArray(C) ? C : [], [C, te]), Lt = V.useMemo(() => {
12113
+ var G;
12114
+ return Xe.length ? _ && Xe.some((ke) => ke.id === _) ? _ : ((G = Xe[0]) == null ? void 0 : G.id) ?? null : null;
12115
+ }, [_, Xe]), qt = V.useMemo(() => !Xe.length || !S ? null : Xe.some((G) => G.id === S) ? S : null, [S, Xe]) ?? Lt, Jt = L === "user" && Xe.length > 0 && typeof k == "function", ct = V.useCallback(
12116
+ (G) => {
12117
12117
  if (!k) return;
12118
- const ke = (q == null ? void 0 : q.id) ?? null, xe = (q == null ? void 0 : q.parentId) ?? N ?? null;
12118
+ const ke = (G == null ? void 0 : G.id) ?? null, xe = (G == null ? void 0 : G.parentId) ?? N ?? null;
12119
12119
  k(ke, xe);
12120
12120
  },
12121
12121
  [N, k]
12122
- ), Le = V.useMemo(() => qt ? Xe.findIndex((q) => q.id === qt) : -1, [qt, Xe]), Ot = V.useMemo(() => Le < 0 ? null : Xe[Le] ?? null, [Le, Xe]), It = V.useCallback((q) => {
12122
+ ), Le = V.useMemo(() => qt ? Xe.findIndex((G) => G.id === qt) : -1, [qt, Xe]), Ot = V.useMemo(() => Le < 0 ? null : Xe[Le] ?? null, [Le, Xe]), It = V.useCallback((G) => {
12123
12123
  const ke = [];
12124
- if (q.step !== null && ke.push(`Step ${q.step}`), q.source && ke.push(q.source), !q.createdAt)
12125
- return ke.length ? ke.join(" • ") : q.id.slice(0, 8);
12124
+ if (G.step !== null && ke.push(`Step ${G.step}`), G.source && ke.push(G.source), !G.createdAt)
12125
+ return ke.length ? ke.join(" • ") : G.id.slice(0, 8);
12126
12126
  let xe = "";
12127
12127
  try {
12128
- const st = new Date(q.createdAt);
12128
+ const st = new Date(G.createdAt);
12129
12129
  Number.isNaN(st.getTime()) || (xe = new Intl.DateTimeFormat(void 0, {
12130
12130
  hour: "2-digit",
12131
12131
  minute: "2-digit"
@@ -12133,11 +12133,10 @@ const Tu = V.memo(function({
12133
12133
  } catch {
12134
12134
  xe = "";
12135
12135
  }
12136
- const lt = ke.length ? ` • ${ke.join(" • ")}` : "";
12137
- return `${xe || q.id.slice(0, 8)}${lt}`;
12136
+ return `${xe}`;
12138
12137
  }, []);
12139
12138
  return ee && !f ? null : /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
12140
- /* @__PURE__ */ u.jsx("div", { className: oe(ct(), h.container), children: /* @__PURE__ */ u.jsxs("div", { className: oe(at(), h.content), children: [
12139
+ /* @__PURE__ */ u.jsx("div", { className: oe(lt(), h.container), children: /* @__PURE__ */ u.jsxs("div", { className: oe(at(), h.content), children: [
12141
12140
  (i || a || ee) && /* @__PURE__ */ u.jsxs(
12142
12141
  "div",
12143
12142
  {
@@ -12164,9 +12163,9 @@ const Tu = V.memo(function({
12164
12163
  role: "button",
12165
12164
  tabIndex: 0,
12166
12165
  "aria-expanded": F === "expanded",
12167
- onClick: () => U((q) => q === "expanded" ? "preview" : "expanded"),
12168
- onKeyDown: (q) => {
12169
- (q.key === "Enter" || q.key === " ") && (q.preventDefault(), U((ke) => ke === "expanded" ? "preview" : "expanded"));
12166
+ onClick: () => U((G) => G === "expanded" ? "preview" : "expanded"),
12167
+ onKeyDown: (G) => {
12168
+ (G.key === "Enter" || G.key === " ") && (G.preventDefault(), U((ke) => ke === "expanded" ? "preview" : "expanded"));
12170
12169
  },
12171
12170
  children: [
12172
12171
  /* @__PURE__ */ u.jsx("span", { children: ue.name ?? "Tool Output" }),
@@ -12188,8 +12187,8 @@ const Tu = V.memo(function({
12188
12187
  ),
12189
12188
  onClick: () => {
12190
12189
  if (Le <= 0) return;
12191
- const q = Xe[Le - 1];
12192
- q && ut(q);
12190
+ const G = Xe[Le - 1];
12191
+ G && ct(G);
12193
12192
  },
12194
12193
  "aria-label": "Previous checkpoint",
12195
12194
  disabled: Le <= 0,
@@ -12214,8 +12213,8 @@ const Tu = V.memo(function({
12214
12213
  ),
12215
12214
  onClick: () => {
12216
12215
  if (Le >= Xe.length - 1) return;
12217
- const q = Xe[Le + 1];
12218
- q && ut(q);
12216
+ const G = Xe[Le + 1];
12217
+ G && ct(G);
12219
12218
  },
12220
12219
  "aria-label": "Next checkpoint",
12221
12220
  disabled: Le >= Xe.length - 1,
@@ -12246,7 +12245,7 @@ const Tu = V.memo(function({
12246
12245
  {
12247
12246
  variant: "ghost",
12248
12247
  size: "sm",
12249
- onClick: () => ht(),
12248
+ onClick: () => ft(),
12250
12249
  className: oe("h-6 w-6 p-0 hover:bg-foreground/10", Y, $ && "h-5 w-5"),
12251
12250
  "aria-label": "Copy message",
12252
12251
  title: "Copy message",
@@ -12307,7 +12306,7 @@ const Tu = V.memo(function({
12307
12306
  {
12308
12307
  variant: "ghost",
12309
12308
  size: "sm",
12310
- onClick: () => ht(),
12309
+ onClick: () => ft(),
12311
12310
  className: oe("h-6 w-6 p-0 hover:bg-background/50 text-current", $ && "h-5 w-5"),
12312
12311
  children: /* @__PURE__ */ u.jsx(ec, { className: oe(A ? "text-success" : "text-current", $ ? "h-3 w-3" : "h-4 w-4") })
12313
12312
  }
@@ -12612,9 +12611,9 @@ const ku = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, V0 = (e) =>
12612
12611
  onSelectCheckpoint: A,
12613
12612
  timelineCheckpoints: M
12614
12613
  }, F) => {
12615
- const U = Re(null), P = Re(null), B = Re(!1), [j, W] = ve(!0), $ = dt(() => w ? e.some((z) => "type" in z && z.type === "default_message" ? !1 : Array.isArray(z == null ? void 0 : z.content) && z.content.some(
12614
+ const U = Re(null), P = Re(null), B = Re(!1), [j, W] = ve(!0), $ = ut(() => w ? e.some((z) => "type" in z && z.type === "default_message" ? !1 : Array.isArray(z == null ? void 0 : z.content) && z.content.some(
12616
12615
  (be) => be && be.type === "interrupt" && (be.id ?? be.interrupt_id) === w.id
12617
- )) : !1, [w, e]), L = dt(() => {
12616
+ )) : !1, [w, e]), L = ut(() => {
12618
12617
  if (!w || $)
12619
12618
  return null;
12620
12619
  const z = w.id && String(w.id).trim() ? String(w.id).trim() : "pending-interrupt";
@@ -12637,7 +12636,7 @@ const ku = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, V0 = (e) =>
12637
12636
  }
12638
12637
  ]
12639
12638
  };
12640
- }, [w, $]), ee = dt(() => L ? [...e, L] : e, [e, L]), te = dt(() => S ? ee : ee.filter((z) => (z == null ? void 0 : z.role) !== "tool"), [ee, S]), ye = dt(() => {
12639
+ }, [w, $]), ee = ut(() => L ? [...e, L] : e, [e, L]), te = ut(() => S ? ee : ee.filter((z) => (z == null ? void 0 : z.role) !== "tool"), [ee, S]), ye = ut(() => {
12641
12640
  const z = /* @__PURE__ */ new Set(), be = [];
12642
12641
  for (let je = te.length - 1; je >= 0; je--) {
12643
12642
  const De = te[je];
@@ -12646,13 +12645,13 @@ const ku = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, V0 = (e) =>
12646
12645
  be.push(De);
12647
12646
  continue;
12648
12647
  }
12649
- const rt = De, ht = V0(rt);
12650
- z.has(ht) || (z.add(ht), be.push(rt));
12648
+ const rt = De, ft = V0(rt);
12649
+ z.has(ft) || (z.add(ft), be.push(rt));
12651
12650
  }
12652
12651
  return be.reverse();
12653
12652
  }, [te]), Ne = he((z) => {
12654
12653
  W(z), y && y(!z), m && m(z);
12655
- }, [y, m]), Z = dt(() => {
12654
+ }, [y, m]), Z = ut(() => {
12656
12655
  if (a)
12657
12656
  return async () => {
12658
12657
  if (!B.current) {
@@ -12664,7 +12663,7 @@ const ku = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, V0 = (e) =>
12664
12663
  }
12665
12664
  }
12666
12665
  };
12667
- }, [a]), fe = dt(() => !g || x ? !1 : j ? "auto" : !1, [j, g, x]), Te = dt(() => M ?? [], [M]), ne = N ?? (Te.length ? Te[Te.length - 1].id : null), D = Te.length > 0, Y = dt(() => {
12666
+ }, [a]), fe = ut(() => !g || x ? !1 : j ? "auto" : !1, [j, g, x]), Te = ut(() => M ?? [], [M]), ne = N ?? (Te.length ? Te[Te.length - 1].id : null), D = Te.length > 0, Y = ut(() => {
12668
12667
  if (typeof p != "string") return null;
12669
12668
  const z = p.trim();
12670
12669
  return z ? {
@@ -12761,16 +12760,16 @@ const ku = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, V0 = (e) =>
12761
12760
  itemContent: (z, be) => {
12762
12761
  var ot;
12763
12762
  const je = ku(be, z), De = "type" in be && be.type === "default_message";
12764
- let rt = [], ht = null, Ze = {}, we = {}, Qe = null, ct = null;
12763
+ let rt = [], ft = null, Ze = {}, we = {}, Qe = null, lt = null;
12765
12764
  if (!De) {
12766
- const Et = be, pt = Et.checkpointId ?? null;
12765
+ const Et = be, ht = Et.checkpointId ?? null;
12767
12766
  Ze = Et.additionalKwargs ?? {}, we = Et.responseMetadata ?? {};
12768
- const gt = pt && k ? k.get(pt) ?? null : null;
12767
+ const gt = ht && k ? k.get(ht) ?? null : null;
12769
12768
  Qe = typeof Ze.step == "number" ? Ze.step : typeof we.step == "number" ? we.step : (gt == null ? void 0 : gt.step) ?? null;
12770
12769
  const Mt = typeof Ze.source == "string" ? Ze.source : typeof we.source == "string" ? we.source : (gt == null ? void 0 : gt.source) ?? null;
12771
- ct = Mt ? String(Mt) : null;
12772
- const Ct = Qe !== null && ct ? `${Qe}:${ct}` : null;
12773
- Ct && (_ != null && _.has(Ct)) ? rt = _.get(Ct) ?? [] : pt && gt && (rt = [gt]), ht = pt ?? ((ot = rt[0]) == null ? void 0 : ot.id) ?? null;
12770
+ lt = Mt ? String(Mt) : null;
12771
+ const Ct = Qe !== null && lt ? `${Qe}:${lt}` : null;
12772
+ Ct && (_ != null && _.has(Ct)) ? rt = _.get(Ct) ?? [] : ht && gt && (rt = [gt]), ft = ht ?? ((ot = rt[0]) == null ? void 0 : ot.id) ?? null;
12774
12773
  }
12775
12774
  const at = (() => {
12776
12775
  if (typeof Ze.parentCheckpointId == "string")
@@ -12810,7 +12809,7 @@ const ku = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, V0 = (e) =>
12810
12809
  checkpointCandidates: rt,
12811
12810
  activeCheckpointId: N ?? null,
12812
12811
  onSelectCheckpoint: A,
12813
- defaultCheckpointId: ht,
12812
+ defaultCheckpointId: ft,
12814
12813
  messageParentCheckpointId: at
12815
12814
  }
12816
12815
  )
@@ -14315,8 +14314,8 @@ var $l = "PopperContent", [cC, uC] = yh($l), Ch = v.forwardRef(
14315
14314
  rC({
14316
14315
  ...U,
14317
14316
  apply: ({ elements: Me, rects: z, availableWidth: be, availableHeight: je }) => {
14318
- const { width: De, height: rt } = z.reference, ht = Me.floating.style;
14319
- ht.setProperty("--radix-popper-available-width", `${be}px`), ht.setProperty("--radix-popper-available-height", `${je}px`), ht.setProperty("--radix-popper-anchor-width", `${De}px`), ht.setProperty("--radix-popper-anchor-height", `${rt}px`);
14317
+ const { width: De, height: rt } = z.reference, ft = Me.floating.style;
14318
+ ft.setProperty("--radix-popper-available-width", `${be}px`), ft.setProperty("--radix-popper-available-height", `${je}px`), ft.setProperty("--radix-popper-anchor-width", `${De}px`), ft.setProperty("--radix-popper-anchor-height", `${rt}px`);
14320
14319
  }
14321
14320
  }),
14322
14321
  T && sC({ element: T, padding: a }),
@@ -15516,9 +15515,9 @@ function pa({
15516
15515
  Z(!0);
15517
15516
  }, []), Te = he(() => {
15518
15517
  Z(!1);
15519
- }, []), ne = !!ye || Ne, [D, Y] = ve(null), [se, ue] = ve(""), [le, Me] = ve(null), [z, be] = ve(null), [je, De] = ve([]), [rt, ht] = ve(0), [Ze, we] = ve(0), [Qe, ct] = ve(!1), [at, ot] = ve(null), [Et, pt] = ve(null), [gt, Mt] = ve(!1), [Ct, Xe] = ve(null), [Lt, Xt] = ve(!1), qt = Re(!1), [Jt, ut] = ve(() => $u.value), Le = Re(Jt), Ot = Re(null), It = he((X) => {
15520
- $u.value = X, ut(X);
15521
- }, []), [q, ke] = ve(!1), xe = he((X) => {
15518
+ }, []), ne = !!ye || Ne, [D, Y] = ve(null), [se, ue] = ve(""), [le, Me] = ve(null), [z, be] = ve(null), [je, De] = ve([]), [rt, ft] = ve(0), [Ze, we] = ve(0), [Qe, lt] = ve(!1), [at, ot] = ve(null), [Et, ht] = ve(null), [gt, Mt] = ve(!1), [Ct, Xe] = ve(null), [Lt, Xt] = ve(!1), qt = Re(!1), [Jt, ct] = ve(() => $u.value), Le = Re(Jt), Ot = Re(null), It = he((X) => {
15519
+ $u.value = X, ct(X);
15520
+ }, []), [G, ke] = ve(!1), xe = he((X) => {
15522
15521
  if (!Array.isArray(X))
15523
15522
  return { text: null, messageId: null };
15524
15523
  for (let ce = X.length - 1; ce >= 0; ce--) {
@@ -15531,21 +15530,21 @@ function pa({
15531
15530
  };
15532
15531
  }
15533
15532
  return { text: null, messageId: null };
15534
- }, []), lt = he(
15533
+ }, []), st = he(
15535
15534
  (X, ce) => {
15536
15535
  if (!X || typeof X != "object") return null;
15537
15536
  const de = X[ce];
15538
15537
  return typeof de == "number" ? de : null;
15539
15538
  },
15540
15539
  []
15541
- ), st = he(
15540
+ ), pt = he(
15542
15541
  (X, ce) => {
15543
15542
  if (!X || typeof X != "object") return null;
15544
15543
  const de = X[ce];
15545
15544
  return typeof de == "string" && de.trim() ? de : null;
15546
15545
  },
15547
15546
  []
15548
- ), et = dt(() => {
15547
+ ), et = ut(() => {
15549
15548
  const X = (Pe) => {
15550
15549
  if (!Array.isArray(Pe) || Pe.length === 0)
15551
15550
  return null;
@@ -15570,19 +15569,19 @@ function pa({
15570
15569
  }
15571
15570
  } : Pe;
15572
15571
  }) : [];
15573
- return ce.some((Pe) => lt(Pe.metadata, "step") !== null) && ce.sort((Pe, yt) => {
15574
- const Je = lt(Pe.metadata, "step"), it = lt(yt.metadata, "step");
15572
+ return ce.some((Pe) => st(Pe.metadata, "step") !== null) && ce.sort((Pe, yt) => {
15573
+ const Je = st(Pe.metadata, "step"), it = st(yt.metadata, "step");
15575
15574
  if (Je !== null || it !== null)
15576
15575
  return (it ?? Number.NEGATIVE_INFINITY) - (Je ?? Number.NEGATIVE_INFINITY);
15577
15576
  const Bt = Date.parse(Pe.createdAt ?? ""), $t = Date.parse(yt.createdAt ?? "");
15578
15577
  return Number.isNaN(Bt) || Number.isNaN($t) ? 0 : $t - Bt;
15579
15578
  }), ce;
15580
- }, [A, lt]), { checkpointMetaById: Fe, checkpointIndexByKey: nn } = dt(() => {
15579
+ }, [A, st]), { checkpointMetaById: Fe, checkpointIndexByKey: nn } = ut(() => {
15581
15580
  const X = /* @__PURE__ */ new Map(), ce = /* @__PURE__ */ new Map();
15582
15581
  for (const de of et) {
15583
15582
  const Pe = de.checkpointId ?? null;
15584
15583
  if (!Pe) continue;
15585
- const yt = lt(de.metadata, "step"), Je = st(de.metadata, "source"), it = {
15584
+ const yt = st(de.metadata, "step"), Je = pt(de.metadata, "source"), it = {
15586
15585
  id: Pe,
15587
15586
  step: yt,
15588
15587
  source: Je,
@@ -15601,27 +15600,27 @@ function pa({
15601
15600
  return (yt.createdAt ?? "").localeCompare(Je);
15602
15601
  });
15603
15602
  return { checkpointMetaById: X, checkpointIndexByKey: ce };
15604
- }, [et, lt, st]), ze = dt(() => {
15603
+ }, [et, st, pt]), ze = ut(() => {
15605
15604
  var Je;
15606
15605
  if (!et.length) return [];
15607
15606
  const X = [...et].reverse(), ce = (it, Bt) => {
15608
15607
  const $t = it.checkpointId ?? null;
15609
15608
  if (!$t) return null;
15610
- const $n = st(it.metadata, "source");
15611
- st(it.metadata, "next");
15612
- const { text: co, messageId: Jo } = xe(it.messages), Br = co && co.replace(/\s+/g, " ").trim() || st(it.metadata, "title") || st(it.metadata, "label") || Bt || $n || "Checkpoint", Zo = Br.length > 60 ? `${Br.slice(0, 57)}…` : Br;
15609
+ const $n = pt(it.metadata, "source");
15610
+ pt(it.metadata, "next");
15611
+ const { text: co, messageId: Jo } = xe(it.messages), Br = co && co.replace(/\s+/g, " ").trim() || pt(it.metadata, "title") || pt(it.metadata, "label") || Bt || $n || "Checkpoint", Zo = Br.length > 60 ? `${Br.slice(0, 57)}…` : Br;
15613
15612
  return {
15614
15613
  id: $t,
15615
15614
  label: Zo,
15616
15615
  messageId: Jo ?? null,
15617
15616
  createdAt: it.createdAt ?? null,
15618
- step: lt(it.metadata, "step"),
15617
+ step: st(it.metadata, "step"),
15619
15618
  source: $n ?? null,
15620
- next: st(it.metadata, "next")
15619
+ next: pt(it.metadata, "next")
15621
15620
  };
15622
15621
  }, de = [], Pe = /* @__PURE__ */ new Set();
15623
15622
  for (const it of X) {
15624
- const Bt = ((Je = st(it.metadata, "source")) == null ? void 0 : Je.toLowerCase()) ?? null;
15623
+ const Bt = ((Je = pt(it.metadata, "source")) == null ? void 0 : Je.toLowerCase()) ?? null;
15625
15624
  if (!(Bt === "input" || Bt === "user_input" || Bt === "user")) continue;
15626
15625
  const $n = ce(it, "User input");
15627
15626
  $n && !Pe.has($n.id) && (de.push($n), Pe.add($n.id));
@@ -15633,15 +15632,15 @@ function pa({
15633
15632
  }
15634
15633
  const yt = et.find((it) => {
15635
15634
  var $t;
15636
- return ((($t = st(it.metadata, "source")) == null ? void 0 : $t.toLowerCase()) ?? null) === "loop";
15635
+ return ((($t = pt(it.metadata, "source")) == null ? void 0 : $t.toLowerCase()) ?? null) === "loop";
15637
15636
  });
15638
15637
  if (yt) {
15639
15638
  const it = ce(yt, "Latest loop");
15640
15639
  it && !Pe.has(it.id) && (de.push(it), Pe.add(it.id));
15641
15640
  }
15642
15641
  return de;
15643
- }, [et, xe, lt, st]), xt = Re(null), In = Re(null), Ln = he(() => {
15644
- xt.current && (xt.current.value = ""), In.current && (In.current.value = ""), ht((X) => X + 1), we((X) => X + 1);
15642
+ }, [et, xe, st, pt]), xt = Re(null), In = Re(null), Ln = he(() => {
15643
+ xt.current && (xt.current.value = ""), In.current && (In.current.value = ""), ft((X) => X + 1), we((X) => X + 1);
15645
15644
  }, []), or = he(
15646
15645
  (X) => {
15647
15646
  It(X);
@@ -15701,7 +15700,7 @@ function pa({
15701
15700
  } catch (ce) {
15702
15701
  return (ce == null ? void 0 : ce.message) || "Invalid message";
15703
15702
  }
15704
- }, G = async (X) => {
15703
+ }, q = async (X) => {
15705
15704
  const ce = X.trim();
15706
15705
  if (!(!ce && je.length === 0)) {
15707
15706
  if (ce) {
@@ -15779,7 +15778,7 @@ function pa({
15779
15778
  }, Dt = async (X) => {
15780
15779
  const ce = (X.target.files || [])[0];
15781
15780
  if (ce) {
15782
- ot(null), pt(null), ct(!0);
15781
+ ot(null), ht(null), lt(!0);
15783
15782
  try {
15784
15783
  await j(
15785
15784
  { attachments: [ce] },
@@ -15789,12 +15788,12 @@ function pa({
15789
15788
  }
15790
15789
  );
15791
15790
  const de = `Uploaded ${ce.name} - processing through chat stream`;
15792
- pt(de);
15791
+ ht(de);
15793
15792
  } catch (de) {
15794
15793
  const Pe = de instanceof Error ? de.message : "Failed to upload Excel file";
15795
15794
  console.error("Excel upload failed", de), ot(Pe), g == null || g(Pe);
15796
15795
  } finally {
15797
- ct(!1), X.target.value = "", Ln();
15796
+ lt(!1), X.target.value = "", Ln();
15798
15797
  }
15799
15798
  }
15800
15799
  }, bt = async (X) => {
@@ -15896,7 +15895,7 @@ function pa({
15896
15895
  onRegenerate: mt,
15897
15896
  onCancelEdit: Se,
15898
15897
  emptyMessage: Ct ?? void 0,
15899
- isNavigatingCheckpoint: q,
15898
+ isNavigatingCheckpoint: G,
15900
15899
  activeInterrupt: ye,
15901
15900
  disableInterruptActions: Ne,
15902
15901
  onInterruptActionStart: fe,
@@ -16037,7 +16036,7 @@ function pa({
16037
16036
  isStreaming: U,
16038
16037
  disabled: ne,
16039
16038
  maxLength: Ns,
16040
- onSend: G,
16039
+ onSend: q,
16041
16040
  onCancelEdit: Se,
16042
16041
  onStop: W,
16043
16042
  allowEmptySend: je.length > 0,