teodor-new-chat-ui 4.3.432 → 4.3.434

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 Ig = Object.defineProperty;
2
2
  var Ng = (e, t, n) => t in e ? Ig(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
3
  var Ul = (e, t, n) => Ng(e, typeof t != "symbol" ? t + "" : t, n);
4
4
  import * as h from "react";
5
- import M, { useMemo as Ze, createContext as Pr, useContext as Mr, useState as fe, useRef as $e, useCallback as me, useEffect as nt, useReducer as Ag, useLayoutEffect as jg, createElement as Yo, memo as _g, useImperativeHandle as Pg, forwardRef as Mg, isValidElement as ma } from "react";
5
+ import M, { useMemo as Ze, createContext as Pr, useContext as Mr, useState as fe, useRef as $e, useCallback as me, useEffect as tt, useReducer as Ag, useLayoutEffect as jg, createElement as Yo, memo as _g, useImperativeHandle as Pg, forwardRef as Mg, isValidElement as ma } from "react";
6
6
  import { Slot as Og, createSlot as Rr, createSlottable as Dg } from "@radix-ui/react-slot";
7
7
  import { cva as mo } from "class-variance-authority";
8
8
  import { clsx as Lg } from "clsx";
@@ -172,9 +172,16 @@ function Yn(e) {
172
172
  function ix(e, t) {
173
173
  var y;
174
174
  if (!e) return null;
175
- const r = (Array.isArray((y = e.values) == null ? void 0 : y.messages) ? e.values.messages : []).filter(
176
- (C) => !!(C && typeof C == "object" && typeof C.role == "string")
177
- ), o = er(e.metadata) ?? {}, s = Yl(e.config), a = er(e.parent_config ?? e.parentConfig), i = Yl(a), l = Gn(s, ["checkpoint_id", "checkpointId"]), c = Gn(s, ["checkpoint_ns", "checkpointNs"]), d = Gn(i, ["checkpoint_id", "checkpointId"]), p = Gn(i, ["checkpoint_id", "checkpointId"]) ?? null, m = Gn(i, ["checkpoint_ns", "checkpointNs"]) ?? null, f = er(e.config), v = Array.isArray(e.tasks) ? e.tasks.map((C) => ({ ...C })) : e.tasks ?? null, g = Array.isArray(e.next) ? [...e.next] : e.next ?? null, x = typeof e.created_at == "string" && e.created_at.trim() ? e.created_at : typeof e.createdAt == "string" && e.createdAt.trim() ? e.createdAt : new Date(Date.now() - t).toISOString(), b = {
175
+ const r = (Array.isArray((y = e.values) == null ? void 0 : y.messages) ? e.values.messages : []).filter((C) => !!(C && typeof C == "object" && typeof C.role == "string")).map((C) => typeof C.content == "string" ? {
176
+ ...C,
177
+ content: [{
178
+ type: "text",
179
+ text: C.content
180
+ }]
181
+ } : Array.isArray(C.content) ? C : {
182
+ ...C,
183
+ content: []
184
+ }), o = er(e.metadata) ?? {}, s = Yl(e.config), a = er(e.parent_config ?? e.parentConfig), i = Yl(a), l = Gn(s, ["checkpoint_id", "checkpointId"]), c = Gn(s, ["checkpoint_ns", "checkpointNs"]), d = Gn(i, ["checkpoint_id", "checkpointId"]), p = Gn(i, ["checkpoint_id", "checkpointId"]) ?? null, m = Gn(i, ["checkpoint_ns", "checkpointNs"]) ?? null, f = er(e.config), v = Array.isArray(e.tasks) ? e.tasks.map((C) => ({ ...C })) : e.tasks ?? null, g = Array.isArray(e.next) ? [...e.next] : e.next ?? null, x = typeof e.created_at == "string" && e.created_at.trim() ? e.created_at : typeof e.createdAt == "string" && e.createdAt.trim() ? e.createdAt : new Date(Date.now() - t).toISOString(), b = {
178
185
  ...o,
179
186
  step: ax(o, ["step"]) ?? 0,
180
187
  source: Gn(o, ["source"]) ?? null
@@ -480,18 +487,18 @@ function dx() {
480
487
  if (Wt && ke && typeof Wt.stack == "string") {
481
488
  for (var ue = Wt.stack.split(`
482
489
  `), Re = ke.stack.split(`
483
- `), Me = ue.length - 1, tt = Re.length - 1; Me >= 1 && tt >= 0 && ue[Me] !== Re[tt]; )
484
- tt--;
485
- for (; Me >= 1 && tt >= 0; Me--, tt--)
486
- if (ue[Me] !== Re[tt]) {
487
- if (Me !== 1 || tt !== 1)
490
+ `), Me = ue.length - 1, nt = Re.length - 1; Me >= 1 && nt >= 0 && ue[Me] !== Re[nt]; )
491
+ nt--;
492
+ for (; Me >= 1 && nt >= 0; Me--, nt--)
493
+ if (ue[Me] !== Re[nt]) {
494
+ if (Me !== 1 || nt !== 1)
488
495
  do
489
- if (Me--, tt--, tt < 0 || ue[Me] !== Re[tt]) {
496
+ if (Me--, nt--, nt < 0 || ue[Me] !== Re[nt]) {
490
497
  var xt = `
491
498
  ` + ue[Me].replace(" at new ", " at ");
492
499
  return I.displayName && xt.includes("<anonymous>") && (xt = xt.replace("<anonymous>", I.displayName)), typeof I == "function" && J.set(I, xt), xt;
493
500
  }
494
- while (Me >= 1 && tt >= 0);
501
+ while (Me >= 1 && nt >= 0);
495
502
  break;
496
503
  }
497
504
  }
@@ -610,7 +617,7 @@ function dx() {
610
617
  }
611
618
  return I.key !== void 0;
612
619
  }
613
- function pt(I, Z) {
620
+ function dt(I, Z) {
614
621
  typeof I.ref == "string" && We.current;
615
622
  }
616
623
  function bt(I, Z) {
@@ -667,7 +674,7 @@ function dx() {
667
674
  function Ce(I, Z, de, ke, Je) {
668
675
  {
669
676
  var ot, se = {}, ue = null, Re = null;
670
- de !== void 0 && (Le(de), ue = "" + de), wt(Z) && (Le(Z.key), ue = "" + Z.key), _t(Z) && (Re = Z.ref, pt(Z, Je));
677
+ de !== void 0 && (Le(de), ue = "" + de), wt(Z) && (Le(Z.key), ue = "" + Z.key), _t(Z) && (Re = Z.ref, dt(Z, Je));
671
678
  for (ot in Z)
672
679
  ge.call(Z, ot) && !vt.hasOwnProperty(ot) && (se[ot] = Z[ot]);
673
680
  if (I && I.defaultProps) {
@@ -676,8 +683,8 @@ function dx() {
676
683
  se[ot] === void 0 && (se[ot] = Me[ot]);
677
684
  }
678
685
  if (ue || Re) {
679
- var tt = typeof I == "function" ? I.displayName || I.name || "Unknown" : I;
680
- ue && bt(se, tt), Re && kt(se, tt);
686
+ var nt = typeof I == "function" ? I.displayName || I.name || "Unknown" : I;
687
+ ue && bt(se, nt), Re && kt(se, nt);
681
688
  }
682
689
  return Pt(I, ue, Re, Je, ke, We.current, se);
683
690
  }
@@ -804,9 +811,9 @@ Check the top-level render call using <` + de + ">.");
804
811
  var Me;
805
812
  I === null ? Me = "null" : Et(I) ? Me = "array" : I !== void 0 && I.$$typeof === t ? (Me = "<" + (L(I.type) || "Unknown") + " />", ue = " Did you accidentally export a JSX literal instead of a component?") : Me = typeof I, w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", Me, ue);
806
813
  }
807
- var tt = Ce(I, Z, de, Je, ot);
808
- if (tt == null)
809
- return tt;
814
+ var nt = Ce(I, Z, de, Je, ot);
815
+ if (nt == null)
816
+ return nt;
810
817
  if (se) {
811
818
  var xt = Z.children;
812
819
  if (xt !== void 0)
@@ -834,7 +841,7 @@ React keys must be passed directly to JSX without using spread:
834
841
  <%s key={someKey} {...props} />`, ha, qn, kg, qn), Ot[qn + ha] = !0;
835
842
  }
836
843
  }
837
- return I === r ? At(tt) : It(tt), tt;
844
+ return I === r ? At(nt) : It(nt), nt;
838
845
  }
839
846
  }
840
847
  function gt(I, Z, de) {
@@ -3114,15 +3121,15 @@ function ew(e = {}) {
3114
3121
  const vt = We.body.getReader(), Mt = new TextDecoder();
3115
3122
  let ut = "", _t = [];
3116
3123
  E.current = 0, x(0);
3117
- let wt = 0, pt = null;
3124
+ let wt = 0, dt = null;
3118
3125
  const bt = () => {
3119
3126
  if (_t.length) {
3120
3127
  const Ee = _t.join("");
3121
3128
  _t = [], T.current && m((qe) => qe + Ee);
3122
3129
  }
3123
- pt = null;
3130
+ dt = null;
3124
3131
  }, kt = () => {
3125
- typeof window < "u" && pt == null && (pt = requestAnimationFrame(bt));
3132
+ typeof window < "u" && dt == null && (dt = requestAnimationFrame(bt));
3126
3133
  };
3127
3134
  let Pt = Date.now();
3128
3135
  const Ce = setInterval(() => {
@@ -3234,7 +3241,7 @@ function ew(e = {}) {
3234
3241
  } catch (et) {
3235
3242
  console.warn("[use-chat] heartbeat callback failed", et);
3236
3243
  }
3237
- } else if (pt !== null && cancelAnimationFrame(pt), bt(), Ae.type === "checkpoint")
3244
+ } else if (dt !== null && cancelAnimationFrame(dt), bt(), Ae.type === "checkpoint")
3238
3245
  v(Ae.checkpointId);
3239
3246
  else if (Ae.type === "error") {
3240
3247
  const et = Ae;
@@ -3265,7 +3272,7 @@ function ew(e = {}) {
3265
3272
  } finally {
3266
3273
  (De = vt.releaseLock) == null || De.call(vt);
3267
3274
  }
3268
- pt !== null && typeof window < "u" && window.cancelAnimationFrame(pt), clearInterval(Ce);
3275
+ dt !== null && typeof window < "u" && window.cancelAnimationFrame(dt), clearInterval(Ce);
3269
3276
  }
3270
3277
  } catch (Ke) {
3271
3278
  if (Ke.name === "AbortError")
@@ -3294,7 +3301,7 @@ function ew(e = {}) {
3294
3301
  },
3295
3302
  [t, n, r, e.autoAppendAssistant]
3296
3303
  );
3297
- return nt(() => () => {
3304
+ return tt(() => () => {
3298
3305
  var $;
3299
3306
  T.current = !1, ($ = S.current) == null || $.abort();
3300
3307
  }, []), {
@@ -3362,7 +3369,7 @@ function rw({
3362
3369
  onCurrentThreadDeleted: o
3363
3370
  }) {
3364
3371
  const [s, a] = fe([]), [i, l] = fe(t), [c, d] = fe(!1), [p, m] = fe(null), [f, v] = fe([]), [g, x] = fe(!1), [, b] = fe(null), [w, y] = fe(null), [C, S] = fe(!1), T = $e(i), E = $e(/* @__PURE__ */ new Map());
3365
- nt(() => {
3372
+ tt(() => {
3366
3373
  T.current = i;
3367
3374
  }, [i]);
3368
3375
  const R = me(async () => {
@@ -3388,11 +3395,11 @@ function rw({
3388
3395
  x(!1);
3389
3396
  }
3390
3397
  }, [e, n]);
3391
- nt(() => {
3398
+ tt(() => {
3392
3399
  R();
3393
- }, [R]), nt(() => {
3400
+ }, [R]), tt(() => {
3394
3401
  P();
3395
- }, [P]), nt(() => {
3402
+ }, [P]), tt(() => {
3396
3403
  r == null || r(i);
3397
3404
  }, [i, r]);
3398
3405
  const D = me(
@@ -3815,7 +3822,7 @@ function gw(e = []) {
3815
3822
  }, [a]), l = me((d) => {
3816
3823
  r.current.push(d), i();
3817
3824
  }, [i]);
3818
- nt(() => () => {
3825
+ tt(() => () => {
3819
3826
  o.current !== null && typeof window < "u" && window.cancelAnimationFrame(o.current), s.current !== null && clearTimeout(s.current), r.current = [];
3820
3827
  }, []);
3821
3828
  const c = Ze(() => ({
@@ -4053,7 +4060,7 @@ function yw({
4053
4060
  () => Yn(p),
4054
4061
  [p]
4055
4062
  ).checkpoints, g = sx(v), x = g.timeline, [b, w] = fe(!1), [y, C] = fe(null), [S, T] = fe(!1), [E, R] = fe(!1), [P, D] = fe(!1), [B, z] = fe(null), L = $e(o), N = $e(null), V = $e(null), W = $e(null), $ = $e(null), j = $e(!1), k = $e(null), K = $e(/* @__PURE__ */ new Map());
4056
- nt(() => {
4063
+ tt(() => {
4057
4064
  L.current = o;
4058
4065
  }, [o]);
4059
4066
  const G = me(
@@ -4207,7 +4214,7 @@ function yw({
4207
4214
  }).catch(() => {
4208
4215
  });
4209
4216
  }, [e, y, r, n, G]);
4210
- nt(() => {
4217
+ tt(() => {
4211
4218
  if (!l || !o || S || c)
4212
4219
  return;
4213
4220
  if (V.current === o) {
@@ -4327,7 +4334,7 @@ function Tw({
4327
4334
  throw new Error("respondToInterrupt is not ready");
4328
4335
  }
4329
4336
  );
4330
- nt(() => {
4337
+ tt(() => {
4331
4338
  l || (d([], {}), N());
4332
4339
  }, [l, d, N]);
4333
4340
  const k = me(
@@ -4453,7 +4460,7 @@ function Rw({
4453
4460
  onToolEnd: c
4454
4461
  }) {
4455
4462
  const { api: d, baseUrl: p } = Ms(), m = Ze(() => An(p), [p]), { stream: f, stop: v, isStreaming: g, error: x, setToken: b } = ew({ baseUrl: m }), [w, y] = fe(!1);
4456
- return nt(() => {
4463
+ return tt(() => {
4457
4464
  y(g);
4458
4465
  }, [g]), /* @__PURE__ */ u.jsx(
4459
4466
  ow,
@@ -4531,7 +4538,7 @@ function Iw({
4531
4538
  },
4532
4539
  [i, D, r, o, s]
4533
4540
  ), z = $e(g);
4534
- nt(() => {
4541
+ tt(() => {
4535
4542
  z.current = g;
4536
4543
  }, [g]);
4537
4544
  const L = me(
@@ -4549,7 +4556,7 @@ function Iw({
4549
4556
  },
4550
4557
  [f, B]
4551
4558
  );
4552
- nt(() => {
4559
+ tt(() => {
4553
4560
  R(L);
4554
4561
  }, [L, R]);
4555
4562
  const N = me(async () => {
@@ -4560,7 +4567,7 @@ function Iw({
4560
4567
  console.warn("[StreamingProvider] Failed to refetch agent after clearing thread:", $);
4561
4568
  }
4562
4569
  }, [t, C, m, l]);
4563
- nt(() => {
4570
+ tt(() => {
4564
4571
  E(N);
4565
4572
  }, [N, E]);
4566
4573
  const V = me(
@@ -4685,7 +4692,7 @@ function Jr({
4685
4692
  }
4686
4693
  function qr(e) {
4687
4694
  const t = $e(e);
4688
- return nt(() => {
4695
+ return tt(() => {
4689
4696
  t.current = e;
4690
4697
  }, [e]), me((...n) => {
4691
4698
  const r = t.current;
@@ -8677,7 +8684,7 @@ function Xs(e, t) {
8677
8684
  function YS(e, t) {
8678
8685
  return t(e);
8679
8686
  }
8680
- function ft(...e) {
8687
+ function pt(...e) {
8681
8688
  return e;
8682
8689
  }
8683
8690
  function rt(e, t) {
@@ -8712,7 +8719,7 @@ function Qc(e) {
8712
8719
  function cp(e, t) {
8713
8720
  return e === t;
8714
8721
  }
8715
- function dt(e = cp) {
8722
+ function ft(e = cp) {
8716
8723
  let t;
8717
8724
  return (n) => (r) => {
8718
8725
  e(t, r) || (t = r, n(r));
@@ -8877,7 +8884,7 @@ function Ct(...e) {
8877
8884
  };
8878
8885
  }
8879
8886
  function Ie(e, t = cp) {
8880
- return Q(e, dt(t));
8887
+ return Q(e, ft(t));
8881
8888
  }
8882
8889
  function ii(...e) {
8883
8890
  return function(t, n) {
@@ -9374,12 +9381,12 @@ const mT = {
9374
9381
  }, Rn = Qe(
9375
9382
  ([{ log: e }, { recalcInProgress: t }]) => {
9376
9383
  const n = Ve(), r = Ve(), o = Ft(r, 0), s = Ve(), a = Ve(), i = oe(0), l = oe([]), c = oe(void 0), d = oe(void 0), p = oe((S, T) => $n(S, mT[T])), m = oe(void 0), f = oe(0), v = aT(), g = Ft(
9377
- Q(n, Be(l, e, f), Tn(dT, v), dt()),
9384
+ Q(n, Be(l, e, f), Tn(dT, v), ft()),
9378
9385
  v
9379
9386
  ), x = Ft(
9380
9387
  Q(
9381
9388
  l,
9382
- dt(),
9389
+ ft(),
9383
9390
  Tn((S, T) => ({ current: T, prev: S.current }), {
9384
9391
  current: [],
9385
9392
  prev: []
@@ -9604,7 +9611,7 @@ const mT = {
9604
9611
  unshiftWith: s
9605
9612
  };
9606
9613
  },
9607
- ft(Un, fl),
9614
+ pt(Un, fl),
9608
9615
  { singleton: !0 }
9609
9616
  );
9610
9617
  function gT(e) {
@@ -9636,27 +9643,27 @@ const bp = Qe(
9636
9643
  Ct(o, t, r),
9637
9644
  Ne(([l, c]) => Zs(c)),
9638
9645
  pe(([l, c, d]) => mn(c.groupOffsetTree, Math.max(l - d, 0), "v")[0]),
9639
- dt(),
9646
+ ft(),
9640
9647
  pe((l) => [l])
9641
9648
  ),
9642
9649
  a
9643
9650
  ), { groupCounts: s, topItemsIndexes: a };
9644
9651
  },
9645
- ft(Rn, Ut)
9652
+ pt(Rn, Ut)
9646
9653
  ), Wn = Qe(
9647
9654
  ([{ log: e }]) => {
9648
9655
  const t = oe(!1), n = tn(
9649
9656
  Q(
9650
9657
  t,
9651
9658
  Ne((r) => r),
9652
- dt()
9659
+ ft()
9653
9660
  )
9654
9661
  );
9655
9662
  return rt(t, (r) => {
9656
9663
  r && yt(e)("props updated", {}, Yt.DEBUG);
9657
9664
  }), { didMount: n, propsReady: t };
9658
9665
  },
9659
- ft(Un),
9666
+ pt(Un),
9660
9667
  { singleton: !0 }
9661
9668
  ), xT = typeof document < "u" && "scrollBehavior" in document.documentElement.style;
9662
9669
  function yp(e) {
@@ -9723,7 +9730,7 @@ const No = Qe(
9723
9730
  topListHeight: g
9724
9731
  };
9725
9732
  },
9726
- ft(Rn, Ut, Un),
9733
+ pt(Rn, Ut, Un),
9727
9734
  { singleton: !0 }
9728
9735
  );
9729
9736
  function vT(e) {
@@ -9786,7 +9793,7 @@ const Ao = Qe(
9786
9793
  scrolledToInitialItem: i
9787
9794
  };
9788
9795
  },
9789
- ft(Rn, Ut, No, Wn),
9796
+ pt(Rn, Ut, No, Wn),
9790
9797
  { singleton: !0 }
9791
9798
  );
9792
9799
  function Sp(e, t) {
@@ -9805,18 +9812,18 @@ const po = "up", Zr = "down", wT = "none", bT = {
9805
9812
  const a = oe(!1), i = oe(!0), l = Ve(), c = Ve(), d = oe(4), p = oe(yT), m = Ft(
9806
9813
  Q(
9807
9814
  ii(Q(Ie(o), ir(1), bn(!0)), Q(Ie(o), ir(1), bn(!1), Qc(100))),
9808
- dt()
9815
+ ft()
9809
9816
  ),
9810
9817
  !1
9811
9818
  ), f = Ft(
9812
- Q(ii(Q(n, bn(!0)), Q(n, bn(!1), Qc(200))), dt()),
9819
+ Q(ii(Q(n, bn(!0)), Q(n, bn(!1), Qc(200))), ft()),
9813
9820
  !1
9814
9821
  );
9815
9822
  be(
9816
9823
  Q(
9817
9824
  Ct(Ie(o), Ie(p)),
9818
9825
  pe(([w, y]) => w <= y),
9819
- dt()
9826
+ ft()
9820
9827
  ),
9821
9828
  i
9822
9829
  ), be(Q(i, Nn(50)), c);
@@ -9845,7 +9852,7 @@ const po = "up", Zr = "down", wT = "none", bT = {
9845
9852
  state: D
9846
9853
  };
9847
9854
  }, bT),
9848
- dt((w, y) => w && w.atBottom === y.atBottom)
9855
+ ft((w, y) => w && w.atBottom === y.atBottom)
9849
9856
  )
9850
9857
  ), g = Ft(
9851
9858
  Q(
@@ -9893,7 +9900,7 @@ const po = "up", Zr = "down", wT = "none", bT = {
9893
9900
  Q(
9894
9901
  r,
9895
9902
  pe(({ scrollTop: w }) => w),
9896
- dt(),
9903
+ ft(),
9897
9904
  Tn(
9898
9905
  (w, y) => yt(f) ? { direction: w.direction, prevScrollTop: y } : { direction: y < w.prevScrollTop ? po : Zr, prevScrollTop: y },
9899
9906
  { direction: Zr, prevScrollTop: 0 }
@@ -9933,7 +9940,7 @@ const po = "up", Zr = "down", wT = "none", bT = {
9933
9940
  scrollDirection: x,
9934
9941
  scrollVelocity: b
9935
9942
  };
9936
- }, ft(Ut)), vs = "top", ws = "bottom", ru = "none";
9943
+ }, pt(Ut)), vs = "top", ws = "bottom", ru = "none";
9937
9944
  function ou(e, t, n) {
9938
9945
  return typeof e == "number" ? n === po && t === vs || n === Zr && t === ws ? e : 0 : n === po ? t === vs ? e.main : e.reverse : t === ws ? e.main : e.reverse;
9939
9946
  }
@@ -9978,7 +9985,7 @@ const gl = Qe(
9978
9985
  }
9979
9986
  ),
9980
9987
  Ne((d) => d != null),
9981
- dt(uo)
9988
+ ft(uo)
9982
9989
  ),
9983
9990
  [0, 0]
9984
9991
  );
@@ -9992,7 +9999,7 @@ const gl = Qe(
9992
9999
  visibleRange: c
9993
10000
  };
9994
10001
  },
9995
- ft(Ut),
10002
+ pt(Ut),
9996
10003
  { singleton: !0 }
9997
10004
  );
9998
10005
  function ST(e, t, n) {
@@ -10175,7 +10182,7 @@ const mr = Qe(
10175
10182
  ),
10176
10183
  //@ts-expect-error filter needs to be fixed
10177
10184
  Ne((T) => T !== null),
10178
- dt()
10185
+ ft()
10179
10186
  ),
10180
10187
  Ma
10181
10188
  );
@@ -10212,7 +10219,7 @@ const mr = Qe(
10212
10219
  Be(o, e),
10213
10220
  Ne(([{ items: T }, E]) => T[T.length - 1].originalIndex === E - 1),
10214
10221
  pe(([, T, E]) => [T - 1, E]),
10215
- dt(uo),
10222
+ ft(uo),
10216
10223
  pe(([T]) => T)
10217
10224
  )
10218
10225
  ), C = tn(
@@ -10221,7 +10228,7 @@ const mr = Qe(
10221
10228
  Nn(200),
10222
10229
  Ne(({ items: T, topItems: E }) => T.length > 0 && T[0].originalIndex === E.length),
10223
10230
  pe(({ items: T }) => T[0].index),
10224
- dt()
10231
+ ft()
10225
10232
  )
10226
10233
  ), S = tn(
10227
10234
  Q(
@@ -10238,12 +10245,12 @@ const mr = Qe(
10238
10245
  startIndex: T[E].index
10239
10246
  };
10240
10247
  }),
10241
- dt(gp)
10248
+ ft(gp)
10242
10249
  )
10243
10250
  );
10244
10251
  return { endReached: y, initialItemCount: x, itemsRendered: b, listState: w, rangeChanged: S, startReached: C, topItemsIndexes: g, ...m };
10245
10252
  },
10246
- ft(
10253
+ pt(
10247
10254
  Rn,
10248
10255
  bp,
10249
10256
  gl,
@@ -10265,7 +10272,7 @@ const mr = Qe(
10265
10272
  );
10266
10273
  return be(Ie(a), s), { totalListHeight: a, totalListHeightChanged: s };
10267
10274
  },
10268
- ft(Ut, mr),
10275
+ pt(Ut, mr),
10269
10276
  { singleton: !0 }
10270
10277
  ), TT = Qe(
10271
10278
  ([{ viewportHeight: e }, { totalListHeight: t }]) => {
@@ -10275,13 +10282,13 @@ const mr = Qe(
10275
10282
  Ne(([o]) => o),
10276
10283
  pe(([, o, s]) => Math.max(0, o - s)),
10277
10284
  Nn(0),
10278
- dt()
10285
+ ft()
10279
10286
  ),
10280
10287
  0
10281
10288
  );
10282
10289
  return { alignToBottom: n, paddingTopAddition: r };
10283
10290
  },
10284
- ft(Ut, Cp),
10291
+ pt(Ut, Cp),
10285
10292
  { singleton: !0 }
10286
10293
  ), Ep = Qe(() => ({
10287
10294
  context: oe(null)
@@ -10329,7 +10336,7 @@ const mr = Qe(
10329
10336
  scrollIntoView: d
10330
10337
  };
10331
10338
  },
10332
- ft(Rn, Ut, No, mr, Un),
10339
+ pt(Rn, Ut, No, mr, Un),
10333
10340
  { singleton: !0 }
10334
10341
  );
10335
10342
  function iu(e) {
@@ -10429,7 +10436,7 @@ const ET = (e, t) => typeof e == "function" ? iu(e(t)) : t && iu(e), kT = Qe(
10429
10436
  }
10430
10437
  ), { autoscrollToBottom: g, followOutput: v, scrollIntoViewOnChange: y };
10431
10438
  },
10432
- ft(
10439
+ pt(
10433
10440
  Rn,
10434
10441
  jo,
10435
10442
  No,
@@ -10451,7 +10458,7 @@ const ET = (e, t) => typeof e == "function" ? iu(e(t)) : t && iu(e), kT = Qe(
10451
10458
  ),
10452
10459
  a
10453
10460
  ), {}),
10454
- ft(Rn, Ao, mr, Wn),
10461
+ pt(Rn, Ao, mr, Wn),
10455
10462
  { singleton: !0 }
10456
10463
  ), IT = Qe(
10457
10464
  ([{ didMount: e }, { scrollTo: t }, { listState: n }]) => {
@@ -10481,7 +10488,7 @@ const ET = (e, t) => typeof e == "function" ? iu(e(t)) : t && iu(e), kT = Qe(
10481
10488
  initialScrollTop: r
10482
10489
  };
10483
10490
  },
10484
- ft(Wn, Ut, mr),
10491
+ pt(Wn, Ut, mr),
10485
10492
  { singleton: !0 }
10486
10493
  ), Rp = Qe(
10487
10494
  ([{ scrollVelocity: e }]) => {
@@ -10500,7 +10507,7 @@ const ET = (e, t) => typeof e == "function" ? iu(e(t)) : t && iu(e), kT = Qe(
10500
10507
  return !0;
10501
10508
  return a;
10502
10509
  }),
10503
- dt()
10510
+ ft()
10504
10511
  ),
10505
10512
  t
10506
10513
  ), rt(
@@ -10510,7 +10517,7 @@ const ET = (e, t) => typeof e == "function" ? iu(e(t)) : t && iu(e), kT = Qe(
10510
10517
  }
10511
10518
  ), { isSeeking: t, scrollSeekConfiguration: r, scrollSeekRangeChanged: n, scrollVelocity: e };
10512
10519
  },
10513
- ft(jo),
10520
+ pt(jo),
10514
10521
  { singleton: !0 }
10515
10522
  ), xl = Qe(([{ scrollContainerState: e, scrollTo: t }]) => {
10516
10523
  const n = Ve(), r = Ve(), o = Ve(), s = oe(!1), a = oe(void 0);
@@ -10544,7 +10551,7 @@ const ET = (e, t) => typeof e == "function" ? iu(e(t)) : t && iu(e), kT = Qe(
10544
10551
  windowScrollTo: o,
10545
10552
  windowViewportRect: r
10546
10553
  };
10547
- }, ft(Ut)), NT = Qe(
10554
+ }, pt(Ut)), NT = Qe(
10548
10555
  ([
10549
10556
  { sizeRanges: e, sizes: t },
10550
10557
  { headerHeight: n, scrollTop: r },
@@ -10567,7 +10574,7 @@ const ET = (e, t) => typeof e == "function" ? iu(e(t)) : t && iu(e), kT = Qe(
10567
10574
  s,
10568
10575
  Be(d),
10569
10576
  Ne(([, f]) => f !== void 0),
10570
- dt(),
10577
+ ft(),
10571
10578
  pe(([, f]) => f.ranges)
10572
10579
  ),
10573
10580
  e
@@ -10576,7 +10583,7 @@ const ET = (e, t) => typeof e == "function" ? iu(e(t)) : t && iu(e), kT = Qe(
10576
10583
  restoreStateFrom: d
10577
10584
  };
10578
10585
  },
10579
- ft(Rn, Ut, Ao, Wn, xl)
10586
+ pt(Rn, Ut, Ao, Wn, xl)
10580
10587
  );
10581
10588
  function AT(e) {
10582
10589
  return { align: "start", index: 0, offset: e.scrollTop };
@@ -10591,7 +10598,7 @@ const jT = Qe(([{ topItemsIndexes: e }]) => {
10591
10598
  ),
10592
10599
  e
10593
10600
  ), { topItemCount: t };
10594
- }, ft(mr));
10601
+ }, pt(mr));
10595
10602
  function Ip(e) {
10596
10603
  let t = !1, n;
10597
10604
  return () => (t || (t = !0, n = e()), n);
@@ -10674,7 +10681,7 @@ const _T = Ip(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
10674
10681
  }
10675
10682
  ), { deviation: e };
10676
10683
  },
10677
- ft(Ut, jo, mr, Rn, Un, fl)
10684
+ pt(Ut, jo, mr, Rn, Un, fl)
10678
10685
  ), MT = Qe(
10679
10686
  ([
10680
10687
  e,
@@ -10701,7 +10708,7 @@ const _T = Ip(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
10701
10708
  ...c,
10702
10709
  ...d
10703
10710
  }),
10704
- ft(
10711
+ pt(
10705
10712
  gl,
10706
10713
  RT,
10707
10714
  Wn,
@@ -10777,7 +10784,7 @@ const _T = Ip(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
10777
10784
  sizes: l,
10778
10785
  ...x
10779
10786
  }),
10780
- ft(
10787
+ pt(
10781
10788
  Rn,
10782
10789
  Ao,
10783
10790
  Ut,
@@ -10950,7 +10957,7 @@ const LT = /* @__PURE__ */ Qe(() => {
10950
10957
  Q(
10951
10958
  n,
10952
10959
  pe((c) => c[i]),
10953
- dt()
10960
+ ft()
10954
10961
  ),
10955
10962
  l
10956
10963
  );
@@ -10973,7 +10980,7 @@ const LT = /* @__PURE__ */ Qe(() => {
10973
10980
  };
10974
10981
  }), $T = /* @__PURE__ */ Qe(
10975
10982
  ([e, t]) => ({ ...e, ...t }),
10976
- ft(Np, LT)
10983
+ pt(Np, LT)
10977
10984
  ), FT = ({ height: e }) => /* @__PURE__ */ u.jsx("div", { style: { height: e } }), BT = { overflowAnchor: "none", position: vl(), zIndex: 1 }, Op = { overflowAnchor: "none" }, zT = { ...Op, display: "inline-block", height: "100%" }, cu = /* @__PURE__ */ M.memo(function({ showTopList: e = !1 }) {
10978
10985
  const t = _e("listState"), n = on("sizeRanges"), r = _e("useWindowScroll"), o = _e("customScrollParent"), s = on("windowScrollContainerState"), a = on("scrollContainerState"), i = o || r ? s : a, l = _e("itemContent"), c = _e("context"), d = _e("groupContent"), p = _e("trackItemSizes"), m = _e("itemSize"), f = _e("log"), v = on("gap"), g = _e("horizontalDirection"), { callbackRef: x } = nT(
10979
10986
  n,
@@ -11263,7 +11270,7 @@ const GT = ({ children: e }) => {
11263
11270
  Q(
11264
11271
  s,
11265
11272
  pe((p) => p[c]),
11266
- dt()
11273
+ ft()
11267
11274
  ),
11268
11275
  d
11269
11276
  );
@@ -11288,7 +11295,7 @@ const GT = ({ children: e }) => {
11288
11295
  GroupComponent: l("Group", "tr")
11289
11296
  };
11290
11297
  });
11291
- ft(Np, nC);
11298
+ pt(Np, nC);
11292
11299
  vl();
11293
11300
  const uu = {
11294
11301
  bottom: 0,
@@ -11453,7 +11460,7 @@ const aC = /* @__PURE__ */ Qe(
11453
11460
  const { bottom: F, top: te } = hu(O, le, Y, J);
11454
11461
  return [te, F];
11455
11462
  }),
11456
- dt(uo)
11463
+ ft(uo)
11457
11464
  ),
11458
11465
  t
11459
11466
  );
@@ -11476,14 +11483,14 @@ const aC = /* @__PURE__ */ Qe(
11476
11483
  return (J || O.bottom > 0 && O.itemHeight > 0 && O.offsetBottom === 0 && O.items.length === Y) && le;
11477
11484
  }),
11478
11485
  pe(([[, O]]) => O - 1),
11479
- dt()
11486
+ ft()
11480
11487
  )
11481
11488
  ), X = tn(
11482
11489
  Q(
11483
11490
  Ie(R),
11484
11491
  Ne(({ items: O }) => O.length > 0 && O[0].index === 0),
11485
11492
  bn(0),
11486
- dt()
11493
+ ft()
11487
11494
  )
11488
11495
  ), re = tn(
11489
11496
  Q(
@@ -11494,7 +11501,7 @@ const aC = /* @__PURE__ */ Qe(
11494
11501
  endIndex: O[O.length - 1].index,
11495
11502
  startIndex: O[0].index
11496
11503
  })),
11497
- dt(gp),
11504
+ ft(gp),
11498
11505
  Nn(0)
11499
11506
  )
11500
11507
  );
@@ -11567,7 +11574,7 @@ const aC = /* @__PURE__ */ Qe(
11567
11574
  ...S
11568
11575
  };
11569
11576
  },
11570
- ft(gl, Ut, jo, Rp, Wn, xl, Un)
11577
+ pt(gl, Ut, jo, Rp, Wn, xl, Un)
11571
11578
  );
11572
11579
  function $p(e, t, n) {
11573
11580
  return Qr(1, bs((e + n) / (bs(t) + n)));
@@ -11588,7 +11595,7 @@ const iC = /* @__PURE__ */ Qe(() => {
11588
11595
  Q(
11589
11596
  t,
11590
11597
  pe((f) => f[p]),
11591
- dt()
11598
+ ft()
11592
11599
  ),
11593
11600
  m
11594
11601
  ), c = oe(!1), d = oe(!1);
@@ -11612,7 +11619,7 @@ const iC = /* @__PURE__ */ Qe(() => {
11612
11619
  };
11613
11620
  }), lC = /* @__PURE__ */ Qe(
11614
11621
  ([e, t]) => ({ ...e, ...t }),
11615
- ft(aC, iC)
11622
+ pt(aC, iC)
11616
11623
  ), cC = /* @__PURE__ */ M.memo(function() {
11617
11624
  const e = mt("gridState"), t = mt("listClassName"), n = mt("itemClassName"), r = mt("itemContent"), o = mt("computeItemKey"), s = mt("isSeeking"), a = sn("scrollHeight"), i = mt("ItemComponent"), l = mt("ListComponent"), c = mt("ScrollSeekPlaceholder"), d = mt("context"), p = sn("itemDimensions"), m = sn("gap"), f = mt("log"), v = mt("stateRestoreInProgress"), g = sn("reportReadyState"), x = hr(
11618
11625
  M.useMemo(
@@ -12204,7 +12211,7 @@ function DC({ isOpen: e, onClose: t, fileId: n, fileName: r, mimeType: o }) {
12204
12211
  }
12205
12212
  }
12206
12213
  }, [n]);
12207
- nt(() => {
12214
+ tt(() => {
12208
12215
  e && n && m();
12209
12216
  }, [e, n, m]);
12210
12217
  const f = async () => {
@@ -13942,7 +13949,7 @@ function eE({ preview: e, idx: t }) {
13942
13949
  }
13943
13950
  function tE({ artifact: e }) {
13944
13951
  const [t, n] = fe("bg-yellow-500/20 text-yellow-700 dark:text-yellow-300"), [r, o] = fe(/* @__PURE__ */ u.jsx(ga, { className: "w-4 h-4" })), [s, a] = fe("Processing");
13945
- return nt(() => {
13952
+ return tt(() => {
13946
13953
  switch (e.status || "processing") {
13947
13954
  case "completed":
13948
13955
  n("bg-green-500/20 text-green-700 dark:text-green-300"), o(/* @__PURE__ */ u.jsx(Wg, { className: "w-4 h-4" })), a("Completed");
@@ -14226,7 +14233,7 @@ function iE({ message: e, viewMode: t, isStreaming: n = !1 }) {
14226
14233
  }
14227
14234
  function lE({ className: e }) {
14228
14235
  const [t, n] = fe(0);
14229
- return nt(() => {
14236
+ return tt(() => {
14230
14237
  const r = setInterval(() => n((o) => (o + 1) % 4), 500);
14231
14238
  return () => clearInterval(r);
14232
14239
  }, []), /* @__PURE__ */ u.jsxs(
@@ -14680,9 +14687,9 @@ const _l = _g(function({
14680
14687
  } finally {
14681
14688
  C == null || C();
14682
14689
  }
14683
- }, [w, C, y, W]), ut = Ze(() => K ? "Assistant" : cw(t), [K, t]), _t = j === "user" && (S ?? 1) > 1 && typeof E == "function", wt = (R == null ? void 0 : R.length) ?? 0, pt = wt > 0 && T < wt - 1 ? R[T + 1] : void 0, bt = wt > 0 && T > 0 ? R[T - 1] : void 0, kt = me(() => {
14684
- !pt || !E || E(pt.id, void 0, !!pt.isLatestAttempt);
14685
- }, [pt, E]), Pt = me(() => {
14690
+ }, [w, C, y, W]), ut = Ze(() => K ? "Assistant" : cw(t), [K, t]), _t = j === "user" && (S ?? 1) > 1 && typeof E == "function", wt = (R == null ? void 0 : R.length) ?? 0, dt = wt > 0 && T < wt - 1 ? R[T + 1] : void 0, bt = wt > 0 && T > 0 ? R[T - 1] : void 0, kt = me(() => {
14691
+ !dt || !E || E(dt.id, void 0, !!dt.isLatestAttempt);
14692
+ }, [dt, E]), Pt = me(() => {
14686
14693
  !bt || !E || E(bt.id, void 0, !!bt.isLatestAttempt);
14687
14694
  }, [bt, E]);
14688
14695
  return k && !p && !st ? null : G && K ? /* @__PURE__ */ u.jsx("div", { className: ee(Le(), f.container), children: /* @__PURE__ */ u.jsxs("div", { className: ee(We(), f.content), children: [
@@ -15104,14 +15111,14 @@ const bh = M.forwardRef(({
15104
15111
  }, [i]), re = Ze(() => !v || g ? !1 : $ ? "auto" : !1, [$, v, g]), U = Ze(() => {
15105
15112
  if (typeof f != "string") return null;
15106
15113
  const F = f.trim();
15107
- return F ? {
15114
+ return !F || _ && _.length > 0 ? null : {
15108
15115
  id: "default-message",
15109
15116
  role: "assistant",
15110
15117
  type: "default_message",
15111
15118
  content: F,
15112
15119
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
15113
- } : null;
15114
- }, [f]), O = ["flex h-full flex-col md:flex-row", p].filter(Boolean).join(" "), Y = () => U ? /* @__PURE__ */ u.jsx("div", { className: "p-6 h-full overflow-y-auto", children: /* @__PURE__ */ u.jsx("div", { className: "w-full max-w-full", children: /* @__PURE__ */ u.jsx(
15120
+ };
15121
+ }, [f, _]), O = ["flex h-full flex-col md:flex-row", p].filter(Boolean).join(" "), Y = () => U ? /* @__PURE__ */ u.jsx("div", { className: "p-6 h-full overflow-y-auto", children: /* @__PURE__ */ u.jsx("div", { className: "w-full max-w-full", children: /* @__PURE__ */ u.jsx(
15115
15122
  _l,
15116
15123
  {
15117
15124
  message: U,
@@ -15130,7 +15137,7 @@ const bh = M.forwardRef(({
15130
15137
  showArtifactPreviews: E
15131
15138
  }
15132
15139
  ) }) }) : /* @__PURE__ */ u.jsx("div", { className: "flex h-full items-center justify-center py-8 text-center text-muted-foreground", children: f ?? "No messages yet. Start a conversation!" }), J = _.length, le = J > 0;
15133
- return nt(() => {
15140
+ return tt(() => {
15134
15141
  var F, te;
15135
15142
  if (J === 0) {
15136
15143
  W.current = !1;
@@ -15249,14 +15256,14 @@ function to({
15249
15256
  metadata: B,
15250
15257
  checkpointIndex: z
15251
15258
  } = Os(), { isStreaming: L, error: N, connectionState: V, submit: W, stop: $ } = Nw(), j = w ?? b ?? null, k = (R == null ? void 0 : R.id) ?? null, K = (R == null ? void 0 : R.namespace) ?? null, [G, A] = fe(null), _ = (B == null ? void 0 : B.assemblingMessageId) ?? (L && G ? G : null), q = D, [X, re] = fe(!1);
15252
- nt(() => {
15259
+ tt(() => {
15253
15260
  q || re(!1);
15254
15261
  }, [q]);
15255
15262
  const U = me(() => {
15256
15263
  re(!0);
15257
15264
  }, []), O = me(() => {
15258
15265
  re(!1);
15259
- }, []), Y = !!q || X, [J, le] = fe(null), [F, te] = fe(""), [ce, ie] = fe(null), [ge, Te] = fe(null), [je, De] = fe([]), [He, st] = fe(0), [Et, Ke] = fe(0), [Ue, Ye] = fe(!1), [Le, We] = fe(null), [vt, Mt] = fe(null), [ut, _t] = fe(!1), [wt, pt] = fe(null), bt = $e(!1), [kt, Pt] = fe(() => Tu.value), Ce = $e(kt), Ge = $e(null), Ee = me((se) => {
15266
+ }, []), Y = !!q || X, [J, le] = fe(null), [F, te] = fe(""), [ce, ie] = fe(null), [ge, Te] = fe(null), [je, De] = fe([]), [He, st] = fe(0), [Et, Ke] = fe(0), [Ue, Ye] = fe(!1), [Le, We] = fe(null), [vt, Mt] = fe(null), [ut, _t] = fe(!1), [wt, dt] = fe(null), bt = $e(!1), [kt, Pt] = fe(() => Tu.value), Ce = $e(kt), Ge = $e(null), Ee = me((se) => {
15260
15267
  Tu.value = se, Pt(se);
15261
15268
  }, []), [qe, zt] = fe(!1), ne = $e(null), we = $e(null), at = $e(null), xe = me(() => {
15262
15269
  we.current && (we.current.value = ""), at.current && (at.current.value = ""), st((se) => se + 1), Ke((se) => se + 1);
@@ -15266,42 +15273,44 @@ function to({
15266
15273
  },
15267
15274
  [Ee]
15268
15275
  ), Xe = $e(!1);
15269
- nt(() => {
15276
+ tt(() => {
15270
15277
  Xe.current && !L && (De([]), xe()), Xe.current = L;
15271
- }, [L, xe]), nt(() => {
15278
+ }, [L, xe]), tt(() => {
15272
15279
  L || A(null);
15273
15280
  }, [L]);
15274
15281
  const [Rt, It] = fe("desktop");
15275
- nt(() => {
15282
+ tt(() => {
15276
15283
  const se = () => {
15277
15284
  const ue = window.innerWidth;
15278
15285
  It(ue < 640 ? "phone" : ue < 1024 ? "tablet" : "desktop");
15279
15286
  };
15280
15287
  return se(), window.addEventListener("resize", se), () => window.removeEventListener("resize", se);
15281
- }, []), nt(() => {
15288
+ }, []), tt(() => {
15282
15289
  bt.current = !1;
15283
- }, [j]), nt(() => {
15290
+ }, [j]), tt(() => {
15284
15291
  Ce.current = kt;
15285
- }, [kt]), nt(() => {
15292
+ }, [kt]), tt(() => {
15286
15293
  if (!J) {
15287
15294
  Ge.current = null;
15288
15295
  return;
15289
15296
  }
15290
15297
  Ge.current === null && (Ge.current = Ce.current), Ee(F ?? "");
15291
- }, [F, J, Ee]), nt(() => {
15298
+ }, [F, J, Ee]), tt(() => {
15292
15299
  (async () => {
15293
15300
  if (!x.baseUrl) {
15294
- pt(null);
15301
+ dt(null);
15295
15302
  return;
15296
15303
  }
15297
15304
  try {
15298
15305
  const Re = (await x.getAgent("default")).uiDefaultMessage || "";
15299
- pt(Re || null);
15306
+ dt(Re || null);
15300
15307
  } catch (ue) {
15301
- console.warn("Failed to fetch default message:", ue), pt(null);
15308
+ console.warn("Failed to fetch default message:", ue), dt(null);
15302
15309
  }
15303
15310
  })();
15304
- }, [x.baseUrl]), nt(() => {
15311
+ }, [x.baseUrl]), tt(() => {
15312
+ y && y.length > 0 && dt(null);
15313
+ }, [y.length]), tt(() => {
15305
15314
  N && !ut && (g == null || g(N));
15306
15315
  }, [N, ut, g]);
15307
15316
  const At = async (se) => {
@@ -15309,7 +15318,7 @@ function to({
15309
15318
  if (!ue && je.length === 0) return;
15310
15319
  const Re = J;
15311
15320
  try {
15312
- const Me = J ? (ce == null ? void 0 : ce.checkpointId) ?? k ?? void 0 : k ?? void 0, tt = J ? (ce == null ? void 0 : ce.checkpointNs) ?? K ?? void 0 : K ?? void 0;
15321
+ const Me = J ? (ce == null ? void 0 : ce.checkpointId) ?? k ?? void 0 : k ?? void 0, nt = J ? (ce == null ? void 0 : ce.checkpointNs) ?? K ?? void 0 : K ?? void 0;
15313
15322
  await W(
15314
15323
  {
15315
15324
  text: ue || "",
@@ -15317,14 +15326,14 @@ function to({
15317
15326
  },
15318
15327
  {
15319
15328
  checkpointId: Me,
15320
- checkpointNs: tt,
15329
+ checkpointNs: nt,
15321
15330
  edit: !!J,
15322
15331
  originalMessageId: J ?? void 0
15323
15332
  }
15324
15333
  ), f == null || f(ue), Re && A(Re), Ee(""), Te(null), De([]), xe(), le(null), te(""), ie(null);
15325
15334
  } catch (Me) {
15326
- const tt = (Me == null ? void 0 : Me.message) || "Failed to send message";
15327
- Te(tt), g == null || g(tt);
15335
+ const nt = (Me == null ? void 0 : Me.message) || "Failed to send message";
15336
+ Te(nt), g == null || g(nt);
15328
15337
  }
15329
15338
  }, Ot = M.useCallback(
15330
15339
  (se, ue, Re) => {
@@ -15349,15 +15358,15 @@ function to({
15349
15358
  break;
15350
15359
  }
15351
15360
  if (!ue) return;
15352
- const Re = Array.isArray(ue.content) ? ue.content : [], tt = Re.filter((xt) => (xt == null ? void 0 : xt.type) === "text").map((xt) => xt.text).join("") || (() => {
15361
+ const Re = Array.isArray(ue.content) ? ue.content : [], nt = Re.filter((xt) => (xt == null ? void 0 : xt.type) === "text").map((xt) => xt.text).join("") || (() => {
15353
15362
  try {
15354
15363
  return JSON.stringify(Re, null, 2);
15355
15364
  } catch {
15356
15365
  return String(Re);
15357
15366
  }
15358
15367
  })();
15359
- tt && W(
15360
- { text: tt },
15368
+ nt && W(
15369
+ { text: nt },
15361
15370
  {
15362
15371
  checkpointId: k ?? void 0,
15363
15372
  checkpointNs: K ?? void 0,
@@ -15370,7 +15379,7 @@ function to({
15370
15379
  De((Re) => [...Re, ...ue]), se.target.value = "";
15371
15380
  }, nn = (se) => {
15372
15381
  De((ue) => {
15373
- const Re = ue.filter((Me, tt) => se !== tt);
15382
+ const Re = ue.filter((Me, nt) => se !== nt);
15374
15383
  return Re.length === 0 && xe(), Re;
15375
15384
  });
15376
15385
  }, I = async (se) => {
@@ -16683,7 +16692,7 @@ function rk({
16683
16692
  defaultView: e
16684
16693
  } = {}) {
16685
16694
  const [t, n] = fe(() => nk() ?? e ?? "default");
16686
- nt(() => {
16695
+ tt(() => {
16687
16696
  if (!(typeof window > "u"))
16688
16697
  try {
16689
16698
  window.localStorage.setItem(Jh, t);
@@ -16758,14 +16767,14 @@ function gi({
16758
16767
  const we = ne.sharedAt ? ` • ${Ee(ne.sharedAt)}` : "";
16759
16768
  return `Shared by ${ne.sharedByUserId}${we}`;
16760
16769
  }, wt = (ne) => "sharedByUserId" in ne;
16761
- nt(() => {
16770
+ tt(() => {
16762
16771
  const ne = Array.isArray(C) ? C : [];
16763
16772
  if (ne.length > 0) {
16764
16773
  A.current = !0, G(ne);
16765
16774
  return;
16766
16775
  }
16767
16776
  R || (A.current = !1, G(ne));
16768
- }, [C, R]), nt(() => {
16777
+ }, [C, R]), tt(() => {
16769
16778
  if (!_.current) return;
16770
16779
  const ne = _.current.querySelector(
16771
16780
  "[data-radix-scroll-area-viewport]"
@@ -16780,7 +16789,7 @@ function gi({
16780
16789
  we !== null && cancelAnimationFrame(we), at !== null && cancelAnimationFrame(at);
16781
16790
  };
16782
16791
  }, [K]);
16783
- const pt = async (ne) => {
16792
+ const dt = async (ne) => {
16784
16793
  try {
16785
16794
  E(ne), await j(ne), i == null || i(ne), l == null || l(ne);
16786
16795
  } catch (we) {
@@ -16902,7 +16911,7 @@ function gi({
16902
16911
  isActive: k === ne.threadId,
16903
16912
  editingThreadId: X,
16904
16913
  editingTitle: U,
16905
- onSelect: pt,
16914
+ onSelect: dt,
16906
16915
  onStartEditing: Pt,
16907
16916
  onEditingTitleChange: (we) => O(we),
16908
16917
  onSaveEditing: Ce,
@@ -19339,7 +19348,7 @@ var yI = (e) => {
19339
19348
  let { invert: m, toast: f, unstyled: v, interacting: g, setHeights: x, visibleToasts: b, heights: w, index: y, toasts: C, expanded: S, removeToast: T, defaultRichColors: E, closeButton: R, style: P, cancelButtonStyle: D, actionButtonStyle: B, className: z = "", descriptionClassName: L = "", duration: N, position: V, gap: W, loadingIcon: $, expandByDefault: j, classNames: k, icons: K, closeButtonAriaLabel: G = "Close toast", pauseWhenPageIsHidden: A } = e, [_, q] = M.useState(null), [X, re] = M.useState(null), [U, O] = M.useState(!1), [Y, J] = M.useState(!1), [le, F] = M.useState(!1), [te, ce] = M.useState(!1), [ie, ge] = M.useState(!1), [Te, je] = M.useState(0), [De, He] = M.useState(0), st = M.useRef(f.duration || N || ju), Et = M.useRef(null), Ke = M.useRef(null), Ue = y === 0, Ye = y + 1 <= b, Le = f.type, We = f.dismissible !== !1, vt = f.className || "", Mt = f.descriptionClassName || "", ut = M.useMemo(() => w.findIndex((xe) => xe.toastId === f.id) || 0, [w, f.id]), _t = M.useMemo(() => {
19340
19349
  var xe;
19341
19350
  return (xe = f.closeButton) != null ? xe : R;
19342
- }, [f.closeButton, R]), wt = M.useMemo(() => f.duration || N || ju, [f.duration, N]), pt = M.useRef(0), bt = M.useRef(0), kt = M.useRef(0), Pt = M.useRef(null), [Ce, Ge] = V.split("-"), Ee = M.useMemo(() => w.reduce((xe, Fe, Xe) => Xe >= ut ? xe : xe + Fe.height, 0), [w, ut]), qe = sI(), zt = f.invert || m, ne = Le === "loading";
19351
+ }, [f.closeButton, R]), wt = M.useMemo(() => f.duration || N || ju, [f.duration, N]), dt = M.useRef(0), bt = M.useRef(0), kt = M.useRef(0), Pt = M.useRef(null), [Ce, Ge] = V.split("-"), Ee = M.useMemo(() => w.reduce((xe, Fe, Xe) => Xe >= ut ? xe : xe + Fe.height, 0), [w, ut]), qe = sI(), zt = f.invert || m, ne = Le === "loading";
19343
19352
  bt.current = M.useMemo(() => ut * W + Ee, [ut, Ee]), M.useEffect(() => {
19344
19353
  st.current = wt;
19345
19354
  }, [wt]), M.useEffect(() => {
@@ -19366,12 +19375,12 @@ var yI = (e) => {
19366
19375
  if (f.promise && Le === "loading" || f.duration === 1 / 0 || f.type === "loading") return;
19367
19376
  let xe;
19368
19377
  return S || g || A && qe ? (() => {
19369
- if (kt.current < pt.current) {
19370
- let Fe = (/* @__PURE__ */ new Date()).getTime() - pt.current;
19378
+ if (kt.current < dt.current) {
19379
+ let Fe = (/* @__PURE__ */ new Date()).getTime() - dt.current;
19371
19380
  st.current = st.current - Fe;
19372
19381
  }
19373
19382
  kt.current = (/* @__PURE__ */ new Date()).getTime();
19374
- })() : st.current !== 1 / 0 && (pt.current = (/* @__PURE__ */ new Date()).getTime(), xe = setTimeout(() => {
19383
+ })() : st.current !== 1 / 0 && (dt.current = (/* @__PURE__ */ new Date()).getTime(), xe = setTimeout(() => {
19375
19384
  var Fe;
19376
19385
  (Fe = f.onAutoClose) == null || Fe.call(f, f), we();
19377
19386
  }, st.current)), () => clearTimeout(xe);