teodor-new-chat-ui 4.3.433 → 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";
@@ -487,18 +487,18 @@ function dx() {
487
487
  if (Wt && ke && typeof Wt.stack == "string") {
488
488
  for (var ue = Wt.stack.split(`
489
489
  `), Re = ke.stack.split(`
490
- `), Me = ue.length - 1, tt = Re.length - 1; Me >= 1 && tt >= 0 && ue[Me] !== Re[tt]; )
491
- tt--;
492
- for (; Me >= 1 && tt >= 0; Me--, tt--)
493
- if (ue[Me] !== Re[tt]) {
494
- 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)
495
495
  do
496
- if (Me--, tt--, tt < 0 || ue[Me] !== Re[tt]) {
496
+ if (Me--, nt--, nt < 0 || ue[Me] !== Re[nt]) {
497
497
  var xt = `
498
498
  ` + ue[Me].replace(" at new ", " at ");
499
499
  return I.displayName && xt.includes("<anonymous>") && (xt = xt.replace("<anonymous>", I.displayName)), typeof I == "function" && J.set(I, xt), xt;
500
500
  }
501
- while (Me >= 1 && tt >= 0);
501
+ while (Me >= 1 && nt >= 0);
502
502
  break;
503
503
  }
504
504
  }
@@ -617,7 +617,7 @@ function dx() {
617
617
  }
618
618
  return I.key !== void 0;
619
619
  }
620
- function pt(I, Z) {
620
+ function dt(I, Z) {
621
621
  typeof I.ref == "string" && We.current;
622
622
  }
623
623
  function bt(I, Z) {
@@ -674,7 +674,7 @@ function dx() {
674
674
  function Ce(I, Z, de, ke, Je) {
675
675
  {
676
676
  var ot, se = {}, ue = null, Re = null;
677
- 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));
678
678
  for (ot in Z)
679
679
  ge.call(Z, ot) && !vt.hasOwnProperty(ot) && (se[ot] = Z[ot]);
680
680
  if (I && I.defaultProps) {
@@ -683,8 +683,8 @@ function dx() {
683
683
  se[ot] === void 0 && (se[ot] = Me[ot]);
684
684
  }
685
685
  if (ue || Re) {
686
- var tt = typeof I == "function" ? I.displayName || I.name || "Unknown" : I;
687
- 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);
688
688
  }
689
689
  return Pt(I, ue, Re, Je, ke, We.current, se);
690
690
  }
@@ -811,9 +811,9 @@ Check the top-level render call using <` + de + ">.");
811
811
  var Me;
812
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);
813
813
  }
814
- var tt = Ce(I, Z, de, Je, ot);
815
- if (tt == null)
816
- return tt;
814
+ var nt = Ce(I, Z, de, Je, ot);
815
+ if (nt == null)
816
+ return nt;
817
817
  if (se) {
818
818
  var xt = Z.children;
819
819
  if (xt !== void 0)
@@ -841,7 +841,7 @@ React keys must be passed directly to JSX without using spread:
841
841
  <%s key={someKey} {...props} />`, ha, qn, kg, qn), Ot[qn + ha] = !0;
842
842
  }
843
843
  }
844
- return I === r ? At(tt) : It(tt), tt;
844
+ return I === r ? At(nt) : It(nt), nt;
845
845
  }
846
846
  }
847
847
  function gt(I, Z, de) {
@@ -3121,15 +3121,15 @@ function ew(e = {}) {
3121
3121
  const vt = We.body.getReader(), Mt = new TextDecoder();
3122
3122
  let ut = "", _t = [];
3123
3123
  E.current = 0, x(0);
3124
- let wt = 0, pt = null;
3124
+ let wt = 0, dt = null;
3125
3125
  const bt = () => {
3126
3126
  if (_t.length) {
3127
3127
  const Ee = _t.join("");
3128
3128
  _t = [], T.current && m((qe) => qe + Ee);
3129
3129
  }
3130
- pt = null;
3130
+ dt = null;
3131
3131
  }, kt = () => {
3132
- typeof window < "u" && pt == null && (pt = requestAnimationFrame(bt));
3132
+ typeof window < "u" && dt == null && (dt = requestAnimationFrame(bt));
3133
3133
  };
3134
3134
  let Pt = Date.now();
3135
3135
  const Ce = setInterval(() => {
@@ -3241,7 +3241,7 @@ function ew(e = {}) {
3241
3241
  } catch (et) {
3242
3242
  console.warn("[use-chat] heartbeat callback failed", et);
3243
3243
  }
3244
- } else if (pt !== null && cancelAnimationFrame(pt), bt(), Ae.type === "checkpoint")
3244
+ } else if (dt !== null && cancelAnimationFrame(dt), bt(), Ae.type === "checkpoint")
3245
3245
  v(Ae.checkpointId);
3246
3246
  else if (Ae.type === "error") {
3247
3247
  const et = Ae;
@@ -3272,7 +3272,7 @@ function ew(e = {}) {
3272
3272
  } finally {
3273
3273
  (De = vt.releaseLock) == null || De.call(vt);
3274
3274
  }
3275
- pt !== null && typeof window < "u" && window.cancelAnimationFrame(pt), clearInterval(Ce);
3275
+ dt !== null && typeof window < "u" && window.cancelAnimationFrame(dt), clearInterval(Ce);
3276
3276
  }
3277
3277
  } catch (Ke) {
3278
3278
  if (Ke.name === "AbortError")
@@ -3301,7 +3301,7 @@ function ew(e = {}) {
3301
3301
  },
3302
3302
  [t, n, r, e.autoAppendAssistant]
3303
3303
  );
3304
- return nt(() => () => {
3304
+ return tt(() => () => {
3305
3305
  var $;
3306
3306
  T.current = !1, ($ = S.current) == null || $.abort();
3307
3307
  }, []), {
@@ -3369,7 +3369,7 @@ function rw({
3369
3369
  onCurrentThreadDeleted: o
3370
3370
  }) {
3371
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());
3372
- nt(() => {
3372
+ tt(() => {
3373
3373
  T.current = i;
3374
3374
  }, [i]);
3375
3375
  const R = me(async () => {
@@ -3395,11 +3395,11 @@ function rw({
3395
3395
  x(!1);
3396
3396
  }
3397
3397
  }, [e, n]);
3398
- nt(() => {
3398
+ tt(() => {
3399
3399
  R();
3400
- }, [R]), nt(() => {
3400
+ }, [R]), tt(() => {
3401
3401
  P();
3402
- }, [P]), nt(() => {
3402
+ }, [P]), tt(() => {
3403
3403
  r == null || r(i);
3404
3404
  }, [i, r]);
3405
3405
  const D = me(
@@ -3822,7 +3822,7 @@ function gw(e = []) {
3822
3822
  }, [a]), l = me((d) => {
3823
3823
  r.current.push(d), i();
3824
3824
  }, [i]);
3825
- nt(() => () => {
3825
+ tt(() => () => {
3826
3826
  o.current !== null && typeof window < "u" && window.cancelAnimationFrame(o.current), s.current !== null && clearTimeout(s.current), r.current = [];
3827
3827
  }, []);
3828
3828
  const c = Ze(() => ({
@@ -4060,7 +4060,7 @@ function yw({
4060
4060
  () => Yn(p),
4061
4061
  [p]
4062
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());
4063
- nt(() => {
4063
+ tt(() => {
4064
4064
  L.current = o;
4065
4065
  }, [o]);
4066
4066
  const G = me(
@@ -4214,7 +4214,7 @@ function yw({
4214
4214
  }).catch(() => {
4215
4215
  });
4216
4216
  }, [e, y, r, n, G]);
4217
- nt(() => {
4217
+ tt(() => {
4218
4218
  if (!l || !o || S || c)
4219
4219
  return;
4220
4220
  if (V.current === o) {
@@ -4334,7 +4334,7 @@ function Tw({
4334
4334
  throw new Error("respondToInterrupt is not ready");
4335
4335
  }
4336
4336
  );
4337
- nt(() => {
4337
+ tt(() => {
4338
4338
  l || (d([], {}), N());
4339
4339
  }, [l, d, N]);
4340
4340
  const k = me(
@@ -4460,7 +4460,7 @@ function Rw({
4460
4460
  onToolEnd: c
4461
4461
  }) {
4462
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);
4463
- return nt(() => {
4463
+ return tt(() => {
4464
4464
  y(g);
4465
4465
  }, [g]), /* @__PURE__ */ u.jsx(
4466
4466
  ow,
@@ -4538,7 +4538,7 @@ function Iw({
4538
4538
  },
4539
4539
  [i, D, r, o, s]
4540
4540
  ), z = $e(g);
4541
- nt(() => {
4541
+ tt(() => {
4542
4542
  z.current = g;
4543
4543
  }, [g]);
4544
4544
  const L = me(
@@ -4556,7 +4556,7 @@ function Iw({
4556
4556
  },
4557
4557
  [f, B]
4558
4558
  );
4559
- nt(() => {
4559
+ tt(() => {
4560
4560
  R(L);
4561
4561
  }, [L, R]);
4562
4562
  const N = me(async () => {
@@ -4567,7 +4567,7 @@ function Iw({
4567
4567
  console.warn("[StreamingProvider] Failed to refetch agent after clearing thread:", $);
4568
4568
  }
4569
4569
  }, [t, C, m, l]);
4570
- nt(() => {
4570
+ tt(() => {
4571
4571
  E(N);
4572
4572
  }, [N, E]);
4573
4573
  const V = me(
@@ -4692,7 +4692,7 @@ function Jr({
4692
4692
  }
4693
4693
  function qr(e) {
4694
4694
  const t = $e(e);
4695
- return nt(() => {
4695
+ return tt(() => {
4696
4696
  t.current = e;
4697
4697
  }, [e]), me((...n) => {
4698
4698
  const r = t.current;
@@ -8684,7 +8684,7 @@ function Xs(e, t) {
8684
8684
  function YS(e, t) {
8685
8685
  return t(e);
8686
8686
  }
8687
- function ft(...e) {
8687
+ function pt(...e) {
8688
8688
  return e;
8689
8689
  }
8690
8690
  function rt(e, t) {
@@ -8719,7 +8719,7 @@ function Qc(e) {
8719
8719
  function cp(e, t) {
8720
8720
  return e === t;
8721
8721
  }
8722
- function dt(e = cp) {
8722
+ function ft(e = cp) {
8723
8723
  let t;
8724
8724
  return (n) => (r) => {
8725
8725
  e(t, r) || (t = r, n(r));
@@ -8884,7 +8884,7 @@ function Ct(...e) {
8884
8884
  };
8885
8885
  }
8886
8886
  function Ie(e, t = cp) {
8887
- return Q(e, dt(t));
8887
+ return Q(e, ft(t));
8888
8888
  }
8889
8889
  function ii(...e) {
8890
8890
  return function(t, n) {
@@ -9381,12 +9381,12 @@ const mT = {
9381
9381
  }, Rn = Qe(
9382
9382
  ([{ log: e }, { recalcInProgress: t }]) => {
9383
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(
9384
- Q(n, Be(l, e, f), Tn(dT, v), dt()),
9384
+ Q(n, Be(l, e, f), Tn(dT, v), ft()),
9385
9385
  v
9386
9386
  ), x = Ft(
9387
9387
  Q(
9388
9388
  l,
9389
- dt(),
9389
+ ft(),
9390
9390
  Tn((S, T) => ({ current: T, prev: S.current }), {
9391
9391
  current: [],
9392
9392
  prev: []
@@ -9611,7 +9611,7 @@ const mT = {
9611
9611
  unshiftWith: s
9612
9612
  };
9613
9613
  },
9614
- ft(Un, fl),
9614
+ pt(Un, fl),
9615
9615
  { singleton: !0 }
9616
9616
  );
9617
9617
  function gT(e) {
@@ -9643,27 +9643,27 @@ const bp = Qe(
9643
9643
  Ct(o, t, r),
9644
9644
  Ne(([l, c]) => Zs(c)),
9645
9645
  pe(([l, c, d]) => mn(c.groupOffsetTree, Math.max(l - d, 0), "v")[0]),
9646
- dt(),
9646
+ ft(),
9647
9647
  pe((l) => [l])
9648
9648
  ),
9649
9649
  a
9650
9650
  ), { groupCounts: s, topItemsIndexes: a };
9651
9651
  },
9652
- ft(Rn, Ut)
9652
+ pt(Rn, Ut)
9653
9653
  ), Wn = Qe(
9654
9654
  ([{ log: e }]) => {
9655
9655
  const t = oe(!1), n = tn(
9656
9656
  Q(
9657
9657
  t,
9658
9658
  Ne((r) => r),
9659
- dt()
9659
+ ft()
9660
9660
  )
9661
9661
  );
9662
9662
  return rt(t, (r) => {
9663
9663
  r && yt(e)("props updated", {}, Yt.DEBUG);
9664
9664
  }), { didMount: n, propsReady: t };
9665
9665
  },
9666
- ft(Un),
9666
+ pt(Un),
9667
9667
  { singleton: !0 }
9668
9668
  ), xT = typeof document < "u" && "scrollBehavior" in document.documentElement.style;
9669
9669
  function yp(e) {
@@ -9730,7 +9730,7 @@ const No = Qe(
9730
9730
  topListHeight: g
9731
9731
  };
9732
9732
  },
9733
- ft(Rn, Ut, Un),
9733
+ pt(Rn, Ut, Un),
9734
9734
  { singleton: !0 }
9735
9735
  );
9736
9736
  function vT(e) {
@@ -9793,7 +9793,7 @@ const Ao = Qe(
9793
9793
  scrolledToInitialItem: i
9794
9794
  };
9795
9795
  },
9796
- ft(Rn, Ut, No, Wn),
9796
+ pt(Rn, Ut, No, Wn),
9797
9797
  { singleton: !0 }
9798
9798
  );
9799
9799
  function Sp(e, t) {
@@ -9812,18 +9812,18 @@ const po = "up", Zr = "down", wT = "none", bT = {
9812
9812
  const a = oe(!1), i = oe(!0), l = Ve(), c = Ve(), d = oe(4), p = oe(yT), m = Ft(
9813
9813
  Q(
9814
9814
  ii(Q(Ie(o), ir(1), bn(!0)), Q(Ie(o), ir(1), bn(!1), Qc(100))),
9815
- dt()
9815
+ ft()
9816
9816
  ),
9817
9817
  !1
9818
9818
  ), f = Ft(
9819
- 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()),
9820
9820
  !1
9821
9821
  );
9822
9822
  be(
9823
9823
  Q(
9824
9824
  Ct(Ie(o), Ie(p)),
9825
9825
  pe(([w, y]) => w <= y),
9826
- dt()
9826
+ ft()
9827
9827
  ),
9828
9828
  i
9829
9829
  ), be(Q(i, Nn(50)), c);
@@ -9852,7 +9852,7 @@ const po = "up", Zr = "down", wT = "none", bT = {
9852
9852
  state: D
9853
9853
  };
9854
9854
  }, bT),
9855
- dt((w, y) => w && w.atBottom === y.atBottom)
9855
+ ft((w, y) => w && w.atBottom === y.atBottom)
9856
9856
  )
9857
9857
  ), g = Ft(
9858
9858
  Q(
@@ -9900,7 +9900,7 @@ const po = "up", Zr = "down", wT = "none", bT = {
9900
9900
  Q(
9901
9901
  r,
9902
9902
  pe(({ scrollTop: w }) => w),
9903
- dt(),
9903
+ ft(),
9904
9904
  Tn(
9905
9905
  (w, y) => yt(f) ? { direction: w.direction, prevScrollTop: y } : { direction: y < w.prevScrollTop ? po : Zr, prevScrollTop: y },
9906
9906
  { direction: Zr, prevScrollTop: 0 }
@@ -9940,7 +9940,7 @@ const po = "up", Zr = "down", wT = "none", bT = {
9940
9940
  scrollDirection: x,
9941
9941
  scrollVelocity: b
9942
9942
  };
9943
- }, ft(Ut)), vs = "top", ws = "bottom", ru = "none";
9943
+ }, pt(Ut)), vs = "top", ws = "bottom", ru = "none";
9944
9944
  function ou(e, t, n) {
9945
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;
9946
9946
  }
@@ -9985,7 +9985,7 @@ const gl = Qe(
9985
9985
  }
9986
9986
  ),
9987
9987
  Ne((d) => d != null),
9988
- dt(uo)
9988
+ ft(uo)
9989
9989
  ),
9990
9990
  [0, 0]
9991
9991
  );
@@ -9999,7 +9999,7 @@ const gl = Qe(
9999
9999
  visibleRange: c
10000
10000
  };
10001
10001
  },
10002
- ft(Ut),
10002
+ pt(Ut),
10003
10003
  { singleton: !0 }
10004
10004
  );
10005
10005
  function ST(e, t, n) {
@@ -10182,7 +10182,7 @@ const mr = Qe(
10182
10182
  ),
10183
10183
  //@ts-expect-error filter needs to be fixed
10184
10184
  Ne((T) => T !== null),
10185
- dt()
10185
+ ft()
10186
10186
  ),
10187
10187
  Ma
10188
10188
  );
@@ -10219,7 +10219,7 @@ const mr = Qe(
10219
10219
  Be(o, e),
10220
10220
  Ne(([{ items: T }, E]) => T[T.length - 1].originalIndex === E - 1),
10221
10221
  pe(([, T, E]) => [T - 1, E]),
10222
- dt(uo),
10222
+ ft(uo),
10223
10223
  pe(([T]) => T)
10224
10224
  )
10225
10225
  ), C = tn(
@@ -10228,7 +10228,7 @@ const mr = Qe(
10228
10228
  Nn(200),
10229
10229
  Ne(({ items: T, topItems: E }) => T.length > 0 && T[0].originalIndex === E.length),
10230
10230
  pe(({ items: T }) => T[0].index),
10231
- dt()
10231
+ ft()
10232
10232
  )
10233
10233
  ), S = tn(
10234
10234
  Q(
@@ -10245,12 +10245,12 @@ const mr = Qe(
10245
10245
  startIndex: T[E].index
10246
10246
  };
10247
10247
  }),
10248
- dt(gp)
10248
+ ft(gp)
10249
10249
  )
10250
10250
  );
10251
10251
  return { endReached: y, initialItemCount: x, itemsRendered: b, listState: w, rangeChanged: S, startReached: C, topItemsIndexes: g, ...m };
10252
10252
  },
10253
- ft(
10253
+ pt(
10254
10254
  Rn,
10255
10255
  bp,
10256
10256
  gl,
@@ -10272,7 +10272,7 @@ const mr = Qe(
10272
10272
  );
10273
10273
  return be(Ie(a), s), { totalListHeight: a, totalListHeightChanged: s };
10274
10274
  },
10275
- ft(Ut, mr),
10275
+ pt(Ut, mr),
10276
10276
  { singleton: !0 }
10277
10277
  ), TT = Qe(
10278
10278
  ([{ viewportHeight: e }, { totalListHeight: t }]) => {
@@ -10282,13 +10282,13 @@ const mr = Qe(
10282
10282
  Ne(([o]) => o),
10283
10283
  pe(([, o, s]) => Math.max(0, o - s)),
10284
10284
  Nn(0),
10285
- dt()
10285
+ ft()
10286
10286
  ),
10287
10287
  0
10288
10288
  );
10289
10289
  return { alignToBottom: n, paddingTopAddition: r };
10290
10290
  },
10291
- ft(Ut, Cp),
10291
+ pt(Ut, Cp),
10292
10292
  { singleton: !0 }
10293
10293
  ), Ep = Qe(() => ({
10294
10294
  context: oe(null)
@@ -10336,7 +10336,7 @@ const mr = Qe(
10336
10336
  scrollIntoView: d
10337
10337
  };
10338
10338
  },
10339
- ft(Rn, Ut, No, mr, Un),
10339
+ pt(Rn, Ut, No, mr, Un),
10340
10340
  { singleton: !0 }
10341
10341
  );
10342
10342
  function iu(e) {
@@ -10436,7 +10436,7 @@ const ET = (e, t) => typeof e == "function" ? iu(e(t)) : t && iu(e), kT = Qe(
10436
10436
  }
10437
10437
  ), { autoscrollToBottom: g, followOutput: v, scrollIntoViewOnChange: y };
10438
10438
  },
10439
- ft(
10439
+ pt(
10440
10440
  Rn,
10441
10441
  jo,
10442
10442
  No,
@@ -10458,7 +10458,7 @@ const ET = (e, t) => typeof e == "function" ? iu(e(t)) : t && iu(e), kT = Qe(
10458
10458
  ),
10459
10459
  a
10460
10460
  ), {}),
10461
- ft(Rn, Ao, mr, Wn),
10461
+ pt(Rn, Ao, mr, Wn),
10462
10462
  { singleton: !0 }
10463
10463
  ), IT = Qe(
10464
10464
  ([{ didMount: e }, { scrollTo: t }, { listState: n }]) => {
@@ -10488,7 +10488,7 @@ const ET = (e, t) => typeof e == "function" ? iu(e(t)) : t && iu(e), kT = Qe(
10488
10488
  initialScrollTop: r
10489
10489
  };
10490
10490
  },
10491
- ft(Wn, Ut, mr),
10491
+ pt(Wn, Ut, mr),
10492
10492
  { singleton: !0 }
10493
10493
  ), Rp = Qe(
10494
10494
  ([{ scrollVelocity: e }]) => {
@@ -10507,7 +10507,7 @@ const ET = (e, t) => typeof e == "function" ? iu(e(t)) : t && iu(e), kT = Qe(
10507
10507
  return !0;
10508
10508
  return a;
10509
10509
  }),
10510
- dt()
10510
+ ft()
10511
10511
  ),
10512
10512
  t
10513
10513
  ), rt(
@@ -10517,7 +10517,7 @@ const ET = (e, t) => typeof e == "function" ? iu(e(t)) : t && iu(e), kT = Qe(
10517
10517
  }
10518
10518
  ), { isSeeking: t, scrollSeekConfiguration: r, scrollSeekRangeChanged: n, scrollVelocity: e };
10519
10519
  },
10520
- ft(jo),
10520
+ pt(jo),
10521
10521
  { singleton: !0 }
10522
10522
  ), xl = Qe(([{ scrollContainerState: e, scrollTo: t }]) => {
10523
10523
  const n = Ve(), r = Ve(), o = Ve(), s = oe(!1), a = oe(void 0);
@@ -10551,7 +10551,7 @@ const ET = (e, t) => typeof e == "function" ? iu(e(t)) : t && iu(e), kT = Qe(
10551
10551
  windowScrollTo: o,
10552
10552
  windowViewportRect: r
10553
10553
  };
10554
- }, ft(Ut)), NT = Qe(
10554
+ }, pt(Ut)), NT = Qe(
10555
10555
  ([
10556
10556
  { sizeRanges: e, sizes: t },
10557
10557
  { headerHeight: n, scrollTop: r },
@@ -10574,7 +10574,7 @@ const ET = (e, t) => typeof e == "function" ? iu(e(t)) : t && iu(e), kT = Qe(
10574
10574
  s,
10575
10575
  Be(d),
10576
10576
  Ne(([, f]) => f !== void 0),
10577
- dt(),
10577
+ ft(),
10578
10578
  pe(([, f]) => f.ranges)
10579
10579
  ),
10580
10580
  e
@@ -10583,7 +10583,7 @@ const ET = (e, t) => typeof e == "function" ? iu(e(t)) : t && iu(e), kT = Qe(
10583
10583
  restoreStateFrom: d
10584
10584
  };
10585
10585
  },
10586
- ft(Rn, Ut, Ao, Wn, xl)
10586
+ pt(Rn, Ut, Ao, Wn, xl)
10587
10587
  );
10588
10588
  function AT(e) {
10589
10589
  return { align: "start", index: 0, offset: e.scrollTop };
@@ -10598,7 +10598,7 @@ const jT = Qe(([{ topItemsIndexes: e }]) => {
10598
10598
  ),
10599
10599
  e
10600
10600
  ), { topItemCount: t };
10601
- }, ft(mr));
10601
+ }, pt(mr));
10602
10602
  function Ip(e) {
10603
10603
  let t = !1, n;
10604
10604
  return () => (t || (t = !0, n = e()), n);
@@ -10681,7 +10681,7 @@ const _T = Ip(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
10681
10681
  }
10682
10682
  ), { deviation: e };
10683
10683
  },
10684
- ft(Ut, jo, mr, Rn, Un, fl)
10684
+ pt(Ut, jo, mr, Rn, Un, fl)
10685
10685
  ), MT = Qe(
10686
10686
  ([
10687
10687
  e,
@@ -10708,7 +10708,7 @@ const _T = Ip(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
10708
10708
  ...c,
10709
10709
  ...d
10710
10710
  }),
10711
- ft(
10711
+ pt(
10712
10712
  gl,
10713
10713
  RT,
10714
10714
  Wn,
@@ -10784,7 +10784,7 @@ const _T = Ip(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
10784
10784
  sizes: l,
10785
10785
  ...x
10786
10786
  }),
10787
- ft(
10787
+ pt(
10788
10788
  Rn,
10789
10789
  Ao,
10790
10790
  Ut,
@@ -10957,7 +10957,7 @@ const LT = /* @__PURE__ */ Qe(() => {
10957
10957
  Q(
10958
10958
  n,
10959
10959
  pe((c) => c[i]),
10960
- dt()
10960
+ ft()
10961
10961
  ),
10962
10962
  l
10963
10963
  );
@@ -10980,7 +10980,7 @@ const LT = /* @__PURE__ */ Qe(() => {
10980
10980
  };
10981
10981
  }), $T = /* @__PURE__ */ Qe(
10982
10982
  ([e, t]) => ({ ...e, ...t }),
10983
- ft(Np, LT)
10983
+ pt(Np, LT)
10984
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 }) {
10985
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(
10986
10986
  n,
@@ -11270,7 +11270,7 @@ const GT = ({ children: e }) => {
11270
11270
  Q(
11271
11271
  s,
11272
11272
  pe((p) => p[c]),
11273
- dt()
11273
+ ft()
11274
11274
  ),
11275
11275
  d
11276
11276
  );
@@ -11295,7 +11295,7 @@ const GT = ({ children: e }) => {
11295
11295
  GroupComponent: l("Group", "tr")
11296
11296
  };
11297
11297
  });
11298
- ft(Np, nC);
11298
+ pt(Np, nC);
11299
11299
  vl();
11300
11300
  const uu = {
11301
11301
  bottom: 0,
@@ -11460,7 +11460,7 @@ const aC = /* @__PURE__ */ Qe(
11460
11460
  const { bottom: F, top: te } = hu(O, le, Y, J);
11461
11461
  return [te, F];
11462
11462
  }),
11463
- dt(uo)
11463
+ ft(uo)
11464
11464
  ),
11465
11465
  t
11466
11466
  );
@@ -11483,14 +11483,14 @@ const aC = /* @__PURE__ */ Qe(
11483
11483
  return (J || O.bottom > 0 && O.itemHeight > 0 && O.offsetBottom === 0 && O.items.length === Y) && le;
11484
11484
  }),
11485
11485
  pe(([[, O]]) => O - 1),
11486
- dt()
11486
+ ft()
11487
11487
  )
11488
11488
  ), X = tn(
11489
11489
  Q(
11490
11490
  Ie(R),
11491
11491
  Ne(({ items: O }) => O.length > 0 && O[0].index === 0),
11492
11492
  bn(0),
11493
- dt()
11493
+ ft()
11494
11494
  )
11495
11495
  ), re = tn(
11496
11496
  Q(
@@ -11501,7 +11501,7 @@ const aC = /* @__PURE__ */ Qe(
11501
11501
  endIndex: O[O.length - 1].index,
11502
11502
  startIndex: O[0].index
11503
11503
  })),
11504
- dt(gp),
11504
+ ft(gp),
11505
11505
  Nn(0)
11506
11506
  )
11507
11507
  );
@@ -11574,7 +11574,7 @@ const aC = /* @__PURE__ */ Qe(
11574
11574
  ...S
11575
11575
  };
11576
11576
  },
11577
- ft(gl, Ut, jo, Rp, Wn, xl, Un)
11577
+ pt(gl, Ut, jo, Rp, Wn, xl, Un)
11578
11578
  );
11579
11579
  function $p(e, t, n) {
11580
11580
  return Qr(1, bs((e + n) / (bs(t) + n)));
@@ -11595,7 +11595,7 @@ const iC = /* @__PURE__ */ Qe(() => {
11595
11595
  Q(
11596
11596
  t,
11597
11597
  pe((f) => f[p]),
11598
- dt()
11598
+ ft()
11599
11599
  ),
11600
11600
  m
11601
11601
  ), c = oe(!1), d = oe(!1);
@@ -11619,7 +11619,7 @@ const iC = /* @__PURE__ */ Qe(() => {
11619
11619
  };
11620
11620
  }), lC = /* @__PURE__ */ Qe(
11621
11621
  ([e, t]) => ({ ...e, ...t }),
11622
- ft(aC, iC)
11622
+ pt(aC, iC)
11623
11623
  ), cC = /* @__PURE__ */ M.memo(function() {
11624
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(
11625
11625
  M.useMemo(
@@ -12211,7 +12211,7 @@ function DC({ isOpen: e, onClose: t, fileId: n, fileName: r, mimeType: o }) {
12211
12211
  }
12212
12212
  }
12213
12213
  }, [n]);
12214
- nt(() => {
12214
+ tt(() => {
12215
12215
  e && n && m();
12216
12216
  }, [e, n, m]);
12217
12217
  const f = async () => {
@@ -13949,7 +13949,7 @@ function eE({ preview: e, idx: t }) {
13949
13949
  }
13950
13950
  function tE({ artifact: e }) {
13951
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");
13952
- return nt(() => {
13952
+ return tt(() => {
13953
13953
  switch (e.status || "processing") {
13954
13954
  case "completed":
13955
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");
@@ -14233,7 +14233,7 @@ function iE({ message: e, viewMode: t, isStreaming: n = !1 }) {
14233
14233
  }
14234
14234
  function lE({ className: e }) {
14235
14235
  const [t, n] = fe(0);
14236
- return nt(() => {
14236
+ return tt(() => {
14237
14237
  const r = setInterval(() => n((o) => (o + 1) % 4), 500);
14238
14238
  return () => clearInterval(r);
14239
14239
  }, []), /* @__PURE__ */ u.jsxs(
@@ -14687,9 +14687,9 @@ const _l = _g(function({
14687
14687
  } finally {
14688
14688
  C == null || C();
14689
14689
  }
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, pt = wt > 0 && T < wt - 1 ? R[T + 1] : void 0, bt = wt > 0 && T > 0 ? R[T - 1] : void 0, kt = me(() => {
14691
- !pt || !E || E(pt.id, void 0, !!pt.isLatestAttempt);
14692
- }, [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(() => {
14693
14693
  !bt || !E || E(bt.id, void 0, !!bt.isLatestAttempt);
14694
14694
  }, [bt, E]);
14695
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: [
@@ -15111,14 +15111,14 @@ const bh = M.forwardRef(({
15111
15111
  }, [i]), re = Ze(() => !v || g ? !1 : $ ? "auto" : !1, [$, v, g]), U = Ze(() => {
15112
15112
  if (typeof f != "string") return null;
15113
15113
  const F = f.trim();
15114
- return F ? {
15114
+ return !F || _ && _.length > 0 ? null : {
15115
15115
  id: "default-message",
15116
15116
  role: "assistant",
15117
15117
  type: "default_message",
15118
15118
  content: F,
15119
15119
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
15120
- } : null;
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(
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(
15122
15122
  _l,
15123
15123
  {
15124
15124
  message: U,
@@ -15137,7 +15137,7 @@ const bh = M.forwardRef(({
15137
15137
  showArtifactPreviews: E
15138
15138
  }
15139
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;
15140
- return nt(() => {
15140
+ return tt(() => {
15141
15141
  var F, te;
15142
15142
  if (J === 0) {
15143
15143
  W.current = !1;
@@ -15256,14 +15256,14 @@ function to({
15256
15256
  metadata: B,
15257
15257
  checkpointIndex: z
15258
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);
15259
- nt(() => {
15259
+ tt(() => {
15260
15260
  q || re(!1);
15261
15261
  }, [q]);
15262
15262
  const U = me(() => {
15263
15263
  re(!0);
15264
15264
  }, []), O = me(() => {
15265
15265
  re(!1);
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, 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) => {
15267
15267
  Tu.value = se, Pt(se);
15268
15268
  }, []), [qe, zt] = fe(!1), ne = $e(null), we = $e(null), at = $e(null), xe = me(() => {
15269
15269
  we.current && (we.current.value = ""), at.current && (at.current.value = ""), st((se) => se + 1), Ke((se) => se + 1);
@@ -15273,42 +15273,44 @@ function to({
15273
15273
  },
15274
15274
  [Ee]
15275
15275
  ), Xe = $e(!1);
15276
- nt(() => {
15276
+ tt(() => {
15277
15277
  Xe.current && !L && (De([]), xe()), Xe.current = L;
15278
- }, [L, xe]), nt(() => {
15278
+ }, [L, xe]), tt(() => {
15279
15279
  L || A(null);
15280
15280
  }, [L]);
15281
15281
  const [Rt, It] = fe("desktop");
15282
- nt(() => {
15282
+ tt(() => {
15283
15283
  const se = () => {
15284
15284
  const ue = window.innerWidth;
15285
15285
  It(ue < 640 ? "phone" : ue < 1024 ? "tablet" : "desktop");
15286
15286
  };
15287
15287
  return se(), window.addEventListener("resize", se), () => window.removeEventListener("resize", se);
15288
- }, []), nt(() => {
15288
+ }, []), tt(() => {
15289
15289
  bt.current = !1;
15290
- }, [j]), nt(() => {
15290
+ }, [j]), tt(() => {
15291
15291
  Ce.current = kt;
15292
- }, [kt]), nt(() => {
15292
+ }, [kt]), tt(() => {
15293
15293
  if (!J) {
15294
15294
  Ge.current = null;
15295
15295
  return;
15296
15296
  }
15297
15297
  Ge.current === null && (Ge.current = Ce.current), Ee(F ?? "");
15298
- }, [F, J, Ee]), nt(() => {
15298
+ }, [F, J, Ee]), tt(() => {
15299
15299
  (async () => {
15300
15300
  if (!x.baseUrl) {
15301
- pt(null);
15301
+ dt(null);
15302
15302
  return;
15303
15303
  }
15304
15304
  try {
15305
15305
  const Re = (await x.getAgent("default")).uiDefaultMessage || "";
15306
- pt(Re || null);
15306
+ dt(Re || null);
15307
15307
  } catch (ue) {
15308
- console.warn("Failed to fetch default message:", ue), pt(null);
15308
+ console.warn("Failed to fetch default message:", ue), dt(null);
15309
15309
  }
15310
15310
  })();
15311
- }, [x.baseUrl]), nt(() => {
15311
+ }, [x.baseUrl]), tt(() => {
15312
+ y && y.length > 0 && dt(null);
15313
+ }, [y.length]), tt(() => {
15312
15314
  N && !ut && (g == null || g(N));
15313
15315
  }, [N, ut, g]);
15314
15316
  const At = async (se) => {
@@ -15316,7 +15318,7 @@ function to({
15316
15318
  if (!ue && je.length === 0) return;
15317
15319
  const Re = J;
15318
15320
  try {
15319
- 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;
15320
15322
  await W(
15321
15323
  {
15322
15324
  text: ue || "",
@@ -15324,14 +15326,14 @@ function to({
15324
15326
  },
15325
15327
  {
15326
15328
  checkpointId: Me,
15327
- checkpointNs: tt,
15329
+ checkpointNs: nt,
15328
15330
  edit: !!J,
15329
15331
  originalMessageId: J ?? void 0
15330
15332
  }
15331
15333
  ), f == null || f(ue), Re && A(Re), Ee(""), Te(null), De([]), xe(), le(null), te(""), ie(null);
15332
15334
  } catch (Me) {
15333
- const tt = (Me == null ? void 0 : Me.message) || "Failed to send message";
15334
- 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);
15335
15337
  }
15336
15338
  }, Ot = M.useCallback(
15337
15339
  (se, ue, Re) => {
@@ -15356,15 +15358,15 @@ function to({
15356
15358
  break;
15357
15359
  }
15358
15360
  if (!ue) return;
15359
- 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("") || (() => {
15360
15362
  try {
15361
15363
  return JSON.stringify(Re, null, 2);
15362
15364
  } catch {
15363
15365
  return String(Re);
15364
15366
  }
15365
15367
  })();
15366
- tt && W(
15367
- { text: tt },
15368
+ nt && W(
15369
+ { text: nt },
15368
15370
  {
15369
15371
  checkpointId: k ?? void 0,
15370
15372
  checkpointNs: K ?? void 0,
@@ -15377,7 +15379,7 @@ function to({
15377
15379
  De((Re) => [...Re, ...ue]), se.target.value = "";
15378
15380
  }, nn = (se) => {
15379
15381
  De((ue) => {
15380
- const Re = ue.filter((Me, tt) => se !== tt);
15382
+ const Re = ue.filter((Me, nt) => se !== nt);
15381
15383
  return Re.length === 0 && xe(), Re;
15382
15384
  });
15383
15385
  }, I = async (se) => {
@@ -16690,7 +16692,7 @@ function rk({
16690
16692
  defaultView: e
16691
16693
  } = {}) {
16692
16694
  const [t, n] = fe(() => nk() ?? e ?? "default");
16693
- nt(() => {
16695
+ tt(() => {
16694
16696
  if (!(typeof window > "u"))
16695
16697
  try {
16696
16698
  window.localStorage.setItem(Jh, t);
@@ -16765,14 +16767,14 @@ function gi({
16765
16767
  const we = ne.sharedAt ? ` • ${Ee(ne.sharedAt)}` : "";
16766
16768
  return `Shared by ${ne.sharedByUserId}${we}`;
16767
16769
  }, wt = (ne) => "sharedByUserId" in ne;
16768
- nt(() => {
16770
+ tt(() => {
16769
16771
  const ne = Array.isArray(C) ? C : [];
16770
16772
  if (ne.length > 0) {
16771
16773
  A.current = !0, G(ne);
16772
16774
  return;
16773
16775
  }
16774
16776
  R || (A.current = !1, G(ne));
16775
- }, [C, R]), nt(() => {
16777
+ }, [C, R]), tt(() => {
16776
16778
  if (!_.current) return;
16777
16779
  const ne = _.current.querySelector(
16778
16780
  "[data-radix-scroll-area-viewport]"
@@ -16787,7 +16789,7 @@ function gi({
16787
16789
  we !== null && cancelAnimationFrame(we), at !== null && cancelAnimationFrame(at);
16788
16790
  };
16789
16791
  }, [K]);
16790
- const pt = async (ne) => {
16792
+ const dt = async (ne) => {
16791
16793
  try {
16792
16794
  E(ne), await j(ne), i == null || i(ne), l == null || l(ne);
16793
16795
  } catch (we) {
@@ -16909,7 +16911,7 @@ function gi({
16909
16911
  isActive: k === ne.threadId,
16910
16912
  editingThreadId: X,
16911
16913
  editingTitle: U,
16912
- onSelect: pt,
16914
+ onSelect: dt,
16913
16915
  onStartEditing: Pt,
16914
16916
  onEditingTitleChange: (we) => O(we),
16915
16917
  onSaveEditing: Ce,
@@ -19346,7 +19348,7 @@ var yI = (e) => {
19346
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(() => {
19347
19349
  var xe;
19348
19350
  return (xe = f.closeButton) != null ? xe : R;
19349
- }, [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";
19350
19352
  bt.current = M.useMemo(() => ut * W + Ee, [ut, Ee]), M.useEffect(() => {
19351
19353
  st.current = wt;
19352
19354
  }, [wt]), M.useEffect(() => {
@@ -19373,12 +19375,12 @@ var yI = (e) => {
19373
19375
  if (f.promise && Le === "loading" || f.duration === 1 / 0 || f.type === "loading") return;
19374
19376
  let xe;
19375
19377
  return S || g || A && qe ? (() => {
19376
- if (kt.current < pt.current) {
19377
- let Fe = (/* @__PURE__ */ new Date()).getTime() - pt.current;
19378
+ if (kt.current < dt.current) {
19379
+ let Fe = (/* @__PURE__ */ new Date()).getTime() - dt.current;
19378
19380
  st.current = st.current - Fe;
19379
19381
  }
19380
19382
  kt.current = (/* @__PURE__ */ new Date()).getTime();
19381
- })() : 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(() => {
19382
19384
  var Fe;
19383
19385
  (Fe = f.onAutoClose) == null || Fe.call(f, f), we();
19384
19386
  }, st.current)), () => clearTimeout(xe);