teodor-new-chat-ui 4.3.416 → 4.3.418

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 Sg = Object.defineProperty;
2
2
  var Tg = (e, t, n) => t in e ? Sg(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
3
  var Hl = (e, t, n) => Tg(e, typeof t != "symbol" ? t + "" : t, n);
4
4
  import * as h from "react";
5
- import O, { useMemo as et, createContext as Nr, useContext as Ar, useState as he, useRef as We, useCallback as xe, useEffect as at, useReducer as Cg, useLayoutEffect as Eg, createElement as Uo, memo as kg, useImperativeHandle as Rg, forwardRef as Ig, isValidElement as pa } from "react";
5
+ import O, { useMemo as Ze, createContext as Nr, useContext as Ar, useState as he, useRef as We, useCallback as xe, useEffect as at, useReducer as Cg, useLayoutEffect as Eg, createElement as Uo, memo as kg, useImperativeHandle as Rg, forwardRef as Ig, isValidElement as pa } from "react";
6
6
  import { Slot as Ng, createSlot as Tr, createSlottable as Ag } from "@radix-ui/react-slot";
7
7
  import { cva as lo } from "class-variance-authority";
8
8
  import { clsx as jg } from "clsx";
@@ -77,11 +77,6 @@ function Xg(e) {
77
77
  const d = s.get(c.userMessageId) ?? [];
78
78
  d.push(c), s.set(c.userMessageId, d);
79
79
  }
80
- console.log("🔍 [CheckpointIndex] Built checkpoint metadata:"), console.log(` Total checkpoints: ${o.length}`), console.log(` User message groups: ${s.size}`);
81
- for (const [c, d] of s.entries())
82
- console.log(` 📌 User Message "${c}": ${d.length} checkpoint(s)`), d.forEach((p, m) => {
83
- console.log(` [${m}] checkpoint="${p.id}", step=${p.step}, created=${p.createdAt}`);
84
- });
85
80
  for (const c of s.values()) {
86
81
  if (!c.length) continue;
87
82
  c.sort((p, m) => {
@@ -94,11 +89,6 @@ function Xg(e) {
94
89
  m.attemptCount = d, m.attemptIndex = p, m.isLatestAttempt = p === 0;
95
90
  }
96
91
  }
97
- console.log("🔍 [CheckpointIndex] After attempt indexing:");
98
- for (const [c, d] of s.entries())
99
- console.log(` 📌 User Message "${c}": ${d.length} attempt(s)`), d.forEach((p) => {
100
- console.log(` - checkpoint="${p.id}", attemptCount=${p.attemptCount}, attemptIndex=${p.attemptIndex}, isLatest=${p.isLatestAttempt}`);
101
- });
102
92
  return {
103
93
  checkpoints: e,
104
94
  checkpointMetaByCheckpointId: t,
@@ -123,15 +113,15 @@ function Xg(e) {
123
113
  }
124
114
  function Jg(e, t) {
125
115
  if (!e)
126
- return console.log("🔍 [getMessageAttemptInfo] No checkpointId provided, returning defaults"), { attemptCount: 1, attemptIndex: 0 };
116
+ return { attemptCount: 1, attemptIndex: 0 };
127
117
  const n = t.getCheckpoint(e);
128
118
  if (!n || !n.userMessageId)
129
- return console.log(`🔍 [getMessageAttemptInfo] No checkpoint meta or userMessageId for "${e}"`), { attemptCount: 1, attemptIndex: 0 };
119
+ return { attemptCount: 1, attemptIndex: 0 };
130
120
  const r = t.getMessageAttempts(n.userMessageId);
131
121
  if (!r.length)
132
- return console.log(`🔍 [getMessageAttemptInfo] No attempts found for userMessageId "${n.userMessageId}"`), { attemptCount: 1, attemptIndex: 0 };
122
+ return { attemptCount: 1, attemptIndex: 0 };
133
123
  const o = r.findIndex((s) => s.id === e);
134
- return console.log(`🔍 [getMessageAttemptInfo] checkpoint="${e}", userMsg="${n.userMessageId}", attemptCount=${r.length}, attemptIndex=${o}`), {
124
+ return {
135
125
  attemptCount: r.length,
136
126
  attemptIndex: o >= 0 ? o : 0
137
127
  };
@@ -140,7 +130,7 @@ function SI(e, t) {
140
130
  return e ? t.getCheckpoint(e) ?? null : null;
141
131
  }
142
132
  function Zg(e) {
143
- return et(() => Xg(e), [e]);
133
+ return Ze(() => Xg(e), [e]);
144
134
  }
145
135
  function Kr(e) {
146
136
  if (!(!e || typeof e != "object" || Array.isArray(e)))
@@ -190,10 +180,7 @@ function ex(e, t) {
190
180
  ...C,
191
181
  checkpointId: l ?? null
192
182
  }));
193
- return console.log(`🔍 [normalizeSnapshot] Attaching checkpoint ID to ${w.length} messages:`, {
194
- checkpointId: l,
195
- messageIds: w.map((C) => C.id)
196
- }), {
183
+ return {
197
184
  checkpointId: l ?? null,
198
185
  checkpointNs: c ?? null,
199
186
  createdAt: x,
@@ -599,7 +586,7 @@ function ox() {
599
586
  if (Ye(I))
600
587
  return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", He(I)), ot(I);
601
588
  }
602
- var Ze = b.ReactCurrentOwner, bt = {
589
+ var Qe = b.ReactCurrentOwner, bt = {
603
590
  key: !0,
604
591
  ref: !0,
605
592
  __self: !0,
@@ -622,7 +609,7 @@ function ox() {
622
609
  return I.key !== void 0;
623
610
  }
624
611
  function st(I, Q) {
625
- typeof I.ref == "string" && Ze.current;
612
+ typeof I.ref == "string" && Qe.current;
626
613
  }
627
614
  function Nt(I, Q) {
628
615
  {
@@ -690,7 +677,7 @@ function ox() {
690
677
  var Tt = typeof I == "function" ? I.displayName || I.name || "Unknown" : I;
691
678
  Ce && Nt(de, Tt), St && sn(de, Tt);
692
679
  }
693
- return Le(I, Ce, St, ie, Re, Ze.current, de);
680
+ return Le(I, Ce, St, ie, Re, Qe.current, de);
694
681
  }
695
682
  }
696
683
  var Dt = b.ReactCurrentOwner, At = b.ReactDebugCurrentFrame;
@@ -804,7 +791,7 @@ Check the top-level render call using <` + ue + ">.");
804
791
  }
805
792
  }
806
793
  var $e = {};
807
- function Qe(I, Q, ue, Re, ie, me) {
794
+ function et(I, Q, ue, Re, ie, me) {
808
795
  {
809
796
  var de = L(I);
810
797
  if (!de) {
@@ -849,10 +836,10 @@ React keys must be passed directly to JSX without using spread:
849
836
  }
850
837
  }
851
838
  function Ft(I, Q, ue) {
852
- return Qe(I, Q, ue, !0);
839
+ return et(I, Q, ue, !0);
853
840
  }
854
841
  function ua(I, Q, ue) {
855
- return Qe(I, Q, ue, !1);
842
+ return et(I, Q, ue, !1);
856
843
  }
857
844
  var da = ua, Ao = Ft;
858
845
  zr.Fragment = r, zr.jsx = da, zr.jsxs = Ao;
@@ -869,7 +856,7 @@ const TI = ({
869
856
  onHoverStart: s,
870
857
  onHoverEnd: a
871
858
  }) => {
872
- const i = e ?? [], l = i.length > 0, c = et(() => l ? [...i].reverse() : [], [i, l]), d = t ?? (i.length ? i[i.length - 1].id : null);
859
+ const i = e ?? [], l = i.length > 0, c = Ze(() => l ? [...i].reverse() : [], [i, l]), d = t ?? (i.length ? i[i.length - 1].id : null);
873
860
  if (!l)
874
861
  return null;
875
862
  const m = ["w-32 flex-shrink-0 flex-col border-r border-border/40 pr-2 flex bg-white text-gray-900 dark:bg-slate-900 dark:text-slate-100", o].filter(Boolean).join(" ");
@@ -2934,7 +2921,7 @@ function Uv(e) {
2934
2921
  return !!e && typeof e == "object" && e.protocolVersion === "v1" && "data" in e;
2935
2922
  }
2936
2923
  function Wv(e = {}) {
2937
- const t = et(() => Rn(e.baseUrl), [e.baseUrl]), n = e.streamPath ?? "/runs/stream", [r, o] = he(e.token ?? null), s = We(e.headers ?? {}), a = e.credentials ?? "include", [i, l] = he(!1), [c, d] = he(null), [p, m] = he(""), [f, v] = he(null), [g, x] = he(0), [b, w] = he(!1), y = We(null), C = We(!0), S = We(0), T = We(null), E = We(null), N = We(null), M = We(null), L = xe((R) => {
2924
+ const t = Ze(() => Rn(e.baseUrl), [e.baseUrl]), n = e.streamPath ?? "/runs/stream", [r, o] = he(e.token ?? null), s = We(e.headers ?? {}), a = e.credentials ?? "include", [i, l] = he(!1), [c, d] = he(null), [p, m] = he(""), [f, v] = he(null), [g, x] = he(0), [b, w] = he(!1), y = We(null), C = We(!0), S = We(0), T = We(null), E = We(null), N = We(null), M = We(null), L = xe((R) => {
2938
2925
  o(R);
2939
2926
  }, []), H = xe(() => {
2940
2927
  m(""), v(null), d(null), E.current = null, N.current = null, M.current = null;
@@ -3021,7 +3008,7 @@ function Wv(e = {}) {
3021
3008
  }
3022
3009
  w(!0);
3023
3010
  const ot = Ye.body.getReader(), nt = new TextDecoder();
3024
- let Ze = "", bt = [];
3011
+ let Qe = "", bt = [];
3025
3012
  S.current = 0, x(0);
3026
3013
  let gt = 0, pt = null;
3027
3014
  const be = () => {
@@ -3049,18 +3036,18 @@ function Wv(e = {}) {
3049
3036
  }), (B = k == null ? void 0 : k.onOpen) == null || B.call(k, { threadId: Dt, created: At }); ; ) {
3050
3037
  const { value: yt, done: It } = await ot.read();
3051
3038
  if (It) break;
3052
- Ze += nt.decode(yt, { stream: !0 }), Ze.length > sn && (Ze = "", console.warn("Stream buffer reset: exceeded 1MB"));
3039
+ Qe += nt.decode(yt, { stream: !0 }), Qe.length > sn && (Qe = "", console.warn("Stream buffer reset: exceeded 1MB"));
3053
3040
  let ee;
3054
- for (; (ee = Ze.indexOf(`
3041
+ for (; (ee = Qe.indexOf(`
3055
3042
 
3056
3043
  `)) >= 0; ) {
3057
- const Se = Ze.slice(0, ee);
3058
- Ze = Ze.slice(ee + 2);
3044
+ const Se = Qe.slice(0, ee);
3045
+ Qe = Qe.slice(ee + 2);
3059
3046
  const mt = Se.split(/\r?\n/), Te = [];
3060
3047
  for (const $e of mt)
3061
3048
  if (!(!$e || $e.startsWith(":")) && $e.startsWith("data:")) {
3062
- const Qe = $e.slice(5);
3063
- Te.push(Qe.startsWith(" ") ? Qe.slice(1) : Qe);
3049
+ const et = $e.slice(5);
3050
+ Te.push(et.startsWith(" ") ? et.slice(1) : et);
3064
3051
  }
3065
3052
  const Pe = Te.join(`
3066
3053
  `);
@@ -3092,8 +3079,8 @@ function Wv(e = {}) {
3092
3079
  else if (Be.type === "state_history") {
3093
3080
  M.current = Be;
3094
3081
  try {
3095
- const Qe = Vn(Be).latest;
3096
- Qe && (E.current = Qe.checkpointId ?? null, N.current = Qe.checkpointNs ?? null, v(Qe.checkpointId ?? null));
3082
+ const et = Vn(Be).latest;
3083
+ et && (E.current = et.checkpointId ?? null, N.current = et.checkpointNs ?? null, v(et.checkpointId ?? null));
3097
3084
  } catch ($e) {
3098
3085
  console.warn("[use-chat] Failed to hydrate state_history payload", $e);
3099
3086
  }
@@ -3104,7 +3091,7 @@ function Wv(e = {}) {
3104
3091
  console.error("[use-chat] Error in onEvent callback:", $e, "for event:", Be.type);
3105
3092
  }
3106
3093
  if (Be.type === "message.delta") {
3107
- const $e = Be.delta.filter((Qe) => Qe.type === "text").map((Qe) => Qe.text).join("");
3094
+ const $e = Be.delta.filter((et) => et.type === "text").map((et) => et.text).join("");
3108
3095
  $e && e.autoAppendAssistant !== !1 && (bt.push($e), rt());
3109
3096
  } else if (Be.type === "heartbeat") {
3110
3097
  console.debug("[use-chat] heartbeat received");
@@ -3333,7 +3320,7 @@ function qv({
3333
3320
  }
3334
3321
  },
3335
3322
  [e, n, M]
3336
- ), U = et(
3323
+ ), U = Ze(
3337
3324
  () => ({
3338
3325
  createThread: L,
3339
3326
  deleteThread: H,
@@ -3406,7 +3393,7 @@ function Gv({
3406
3393
  initialThreadId: t,
3407
3394
  onError: n,
3408
3395
  onThreadChange: r
3409
- }), w = et(
3396
+ }), w = Ze(
3410
3397
  () => ({
3411
3398
  threads: s,
3412
3399
  currentThreadId: a,
@@ -3786,7 +3773,7 @@ function dw(e = []) {
3786
3773
  at(() => () => {
3787
3774
  o.current !== null && typeof window < "u" && window.cancelAnimationFrame(o.current), s.current !== null && clearTimeout(s.current), r.current = [];
3788
3775
  }, []);
3789
- const c = et(() => ({
3776
+ const c = Ze(() => ({
3790
3777
  reset: (d) => n({ type: "reset", payload: { messages: d } }),
3791
3778
  seed: (d, p) => n({ type: "seed", payload: { messages: d, ...p ?? {} } }),
3792
3779
  prepend: (d) => n({ type: "prepend", payload: { messages: d } }),
@@ -4017,7 +4004,7 @@ function gw({
4017
4004
  isStreaming: c,
4018
4005
  getMessages: d
4019
4006
  }) {
4020
- const [p, m] = he(null), v = et(
4007
+ const [p, m] = he(null), v = Ze(
4021
4008
  () => Vn(p),
4022
4009
  [p]
4023
4010
  ).checkpoints, g = Zg(v), x = g.timeline, [b, w] = he(!1), [y, C] = he(null), [S, T] = he(!1), [E, N] = he(!1), [M, L] = he(!1), [H, V] = he(null), W = We(o), R = We(null), U = We(null), k = We(null), F = We(null), _ = We(!1), A = We(null), q = We(/* @__PURE__ */ new Map());
@@ -4304,10 +4291,10 @@ function vw({
4304
4291
  ), q = xe(
4305
4292
  (K) => _(() => K),
4306
4293
  []
4307
- ), X = et(() => {
4294
+ ), X = Ze(() => {
4308
4295
  const K = c.assemblingId ?? null;
4309
4296
  return K ? { assemblingMessageId: K } : null;
4310
- }, [c.assemblingId]), j = et(
4297
+ }, [c.assemblingId]), j = Ze(
4311
4298
  () => ({
4312
4299
  threadId: l,
4313
4300
  messages: c.messages,
@@ -4368,7 +4355,7 @@ function vw({
4368
4355
  m,
4369
4356
  f
4370
4357
  ]
4371
- ), P = et(
4358
+ ), P = Ze(
4372
4359
  () => ({
4373
4360
  registerClearThread: A,
4374
4361
  registerRespondToInterrupt: q
@@ -4390,7 +4377,7 @@ function ww({
4390
4377
  onConnectionError: l,
4391
4378
  onToolEnd: c
4392
4379
  }) {
4393
- const { api: d, baseUrl: p } = As(), m = et(() => Rn(p), [p]), { stream: f, stop: v, isStreaming: g, error: x, setToken: b } = Wv({ baseUrl: m }), [w, y] = he(!1);
4380
+ const { api: d, baseUrl: p } = As(), m = Ze(() => Rn(p), [p]), { stream: f, stop: v, isStreaming: g, error: x, setToken: b } = Wv({ baseUrl: m }), [w, y] = he(!1);
4394
4381
  return at(() => {
4395
4382
  y(g);
4396
4383
  }, [g]), /* @__PURE__ */ u.jsx(
@@ -4534,7 +4521,7 @@ function bw({
4534
4521
  H(ce);
4535
4522
  },
4536
4523
  [g, f, w, S, H, x]
4537
- ), U = et(
4524
+ ), U = Ze(
4538
4525
  () => ({
4539
4526
  isStreaming: c,
4540
4527
  error: d,
@@ -11324,8 +11311,8 @@ const XT = /* @__PURE__ */ Je(
11324
11311
  const He = jp(qe, Fe, Ke);
11325
11312
  let Ye, ot;
11326
11313
  ge ? Y === 0 && ne === 0 && le > 0 ? (Ye = 0, ot = le - 1) : (Ye = He * gs((Y + ze) / (ke + ze)), ot = He * lu((ne + ze) / (ke + ze)) - 1, ot = Oa(D - 1, Gr(ot, He - 1)), Ye = Oa(ot, Gr(0, Ye))) : (Ye = 0, ot = -1);
11327
- const nt = uu(Ye, ot, ce), { bottom: Ze, top: bt } = du(J, ae, $, nt), gt = lu(D / He), pt = gt * ke + (gt - 1) * ze - Ze;
11328
- return { bottom: Ze, itemHeight: ke, items: nt, itemWidth: Fe, offsetBottom: pt, offsetTop: bt, top: bt };
11314
+ const nt = uu(Ye, ot, ce), { bottom: Qe, top: bt } = du(J, ae, $, nt), gt = lu(D / He), pt = gt * ke + (gt - 1) * ze - Qe;
11315
+ return { bottom: Qe, itemHeight: ke, items: nt, itemWidth: Fe, offsetBottom: pt, offsetTop: bt, top: bt };
11329
11316
  }
11330
11317
  )
11331
11318
  ),
@@ -13745,7 +13732,7 @@ function Ro({
13745
13732
  allowHtml: n = !1,
13746
13733
  style: r
13747
13734
  }) {
13748
- const o = et(() => {
13735
+ const o = Ze(() => {
13749
13736
  try {
13750
13737
  if (!n) {
13751
13738
  const a = e.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, "").replace(/<iframe\b[^<]*(?:(?!<\/iframe>)<[^<]*)*<\/iframe>/gi, "").replace(/javascript:/gi, "").replace(/on\w+\s*=/gi, "");
@@ -13755,7 +13742,7 @@ function Ro({
13755
13742
  } catch (a) {
13756
13743
  return console.error("[MarkdownContent] parse error", a), `<pre class="font-mono text-xs bg-background/50 rounded border p-2 whitespace-pre-wrap break-words">Error rendering markdown: ${String(a)}</pre>`;
13757
13744
  }
13758
- }, [e, n]), s = et(() => {
13745
+ }, [e, n]), s = Ze(() => {
13759
13746
  const a = {
13760
13747
  color: "currentColor",
13761
13748
  ...r
@@ -13899,7 +13886,7 @@ function VC({ artifact: e }) {
13899
13886
  ] });
13900
13887
  }
13901
13888
  function KC({ artifact: e, idx: t = 0 }) {
13902
- const n = et(() => e ? (Array.isArray(e.plots) ? e.plots : []).map((o) => rw(o)).filter((o) => o !== null) : [], [e]);
13889
+ const n = Ze(() => e ? (Array.isArray(e.plots) ? e.plots : []).map((o) => rw(o)).filter((o) => o !== null) : [], [e]);
13903
13890
  return (e == null ? void 0 : e.type) === "research_task_info" ? /* @__PURE__ */ u.jsx(
13904
13891
  VC,
13905
13892
  {
@@ -14033,7 +14020,7 @@ function dh({ data: e }) {
14033
14020
  return Array.isArray(e) ? e.every((n) => n === null || ["string", "number", "boolean"].includes(typeof n)) ? /* @__PURE__ */ u.jsx("div", { className: GC, children: /* @__PURE__ */ u.jsx("ul", { className: "list-disc pl-5", children: e.map((n, r) => /* @__PURE__ */ u.jsx("li", { children: String(n) }, r)) }) }) : /* @__PURE__ */ u.jsx("pre", { className: "font-mono text-xs bg-background/50 rounded border p-2 whitespace-pre-wrap break-words", children: Er(e) }) : /* @__PURE__ */ u.jsx("pre", { className: "font-mono text-xs bg-background/50 rounded border p-2 whitespace-pre-wrap break-words", children: Er(e) });
14034
14021
  }
14035
14022
  function YC({ message: e, isStreaming: t = !1 }) {
14036
- const n = e.name ?? "tool", r = et(() => {
14023
+ const n = e.name ?? "tool", r = Ze(() => {
14037
14024
  const i = e.additionalKwargs ?? {};
14038
14025
  return Array.isArray(i.toolProgress) ? [...i.toolProgress] : [];
14039
14026
  }, [e]), s = r.some(
@@ -14381,7 +14368,7 @@ function eE(e) {
14381
14368
  };
14382
14369
  }
14383
14370
  function tE(e, t) {
14384
- return et(() => {
14371
+ return Ze(() => {
14385
14372
  if (t)
14386
14373
  return {
14387
14374
  contentParts: [],
@@ -14431,13 +14418,13 @@ const jl = kg(function({
14431
14418
  attemptIndex: T = 0,
14432
14419
  onSelectCheckpoint: E
14433
14420
  }) {
14434
- const [N, M] = he(!1), [L, H] = he("preview"), [V, W] = he(!1), { currentThreadId: R } = mo(), { respondToInterrupt: U } = js(), k = l === "phone" || l === "half-screen", F = t.role, _ = F === "tool", A = et(() => "type" in t && t.type === "default_message" ? t : null, [t]), q = !!A, X = !(r && F !== "user"), {
14421
+ const [N, M] = he(!1), [L, H] = he("preview"), [V, W] = he(!1), { currentThreadId: R } = mo(), { respondToInterrupt: U } = js(), k = l === "phone" || l === "half-screen", F = t.role, _ = F === "tool", A = Ze(() => "type" in t && t.type === "default_message" ? t : null, [t]), q = !!A, X = !(r && F !== "user"), {
14435
14422
  uploadingFiles: j,
14436
14423
  handleFileClick: P,
14437
14424
  fileViewerOpen: K,
14438
14425
  currentFileInfo: G,
14439
14426
  closeFileViewer: oe
14440
- } = eE({ allowFileOpen: X, currentThreadId: R }), B = et(() => {
14427
+ } = eE({ allowFileOpen: X, currentThreadId: R }), B = Ze(() => {
14441
14428
  switch (F) {
14442
14429
  case "user":
14443
14430
  return "text-[hsl(var(--chat-bubble-user-text))]";
@@ -14459,7 +14446,7 @@ const jl = kg(function({
14459
14446
  toolMeta: ce,
14460
14447
  toolRaw: le,
14461
14448
  isToolStreaming: ge
14462
- } = D, Ae = (b == null ? void 0 : b.id) ?? (b == null ? void 0 : b.interrupt_id), Ke = Go(Ae), ze = b == null ? void 0 : b.value, ke = et(() => A || !m ? null : t.artifact || null, [A, t, m]), Fe = xe(async () => {
14449
+ } = D, Ae = (b == null ? void 0 : b.id) ?? (b == null ? void 0 : b.interrupt_id), Ke = Go(Ae), ze = b == null ? void 0 : b.value, ke = Ze(() => A || !m ? null : t.artifact || null, [A, t, m]), Fe = xe(async () => {
14463
14450
  const be = _ ? le : J;
14464
14451
  async function rt(st) {
14465
14452
  if (navigator.clipboard && typeof navigator.clipboard.writeText == "function") {
@@ -14554,7 +14541,7 @@ const jl = kg(function({
14554
14541
  "border border-border/60 dark:border-border/40"
14555
14542
  );
14556
14543
  }
14557
- }, [k, q, F]), Ze = xe(async (be) => {
14544
+ }, [k, q, F]), Qe = xe(async (be) => {
14558
14545
  if (w)
14559
14546
  return;
14560
14547
  const rt = Go(
@@ -14588,7 +14575,7 @@ const jl = kg(function({
14588
14575
  } finally {
14589
14576
  C == null || C();
14590
14577
  }
14591
- }, [w, C, y, U]), gt = et(() => A ? "Assistant" : Qv(t), [A, t]), pt = F === "user" && (S ?? 1) > 1 && typeof E == "function";
14578
+ }, [w, C, y, U]), gt = Ze(() => A ? "Assistant" : Qv(t), [A, t]), pt = F === "user" && (S ?? 1) > 1 && typeof E == "function";
14592
14579
  return _ && !p && !ke ? null : q && A ? /* @__PURE__ */ u.jsx("div", { className: te(ot(), f.container), children: /* @__PURE__ */ u.jsxs("div", { className: te(nt(), f.content), children: [
14593
14580
  /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2 mb-2 pb-2 border-b border-current/10", children: [
14594
14581
  /* @__PURE__ */ u.jsx(ma, { className: te("h-4 w-4", B) }),
@@ -14759,7 +14746,7 @@ const jl = kg(function({
14759
14746
  defaultMessage: A,
14760
14747
  handleFileClick: P,
14761
14748
  uploadingFiles: j,
14762
- handleInterruptApprove: Ze,
14749
+ handleInterruptApprove: Qe,
14763
14750
  handleInterruptReject: bt,
14764
14751
  disableInterruptActions: w,
14765
14752
  messageRole: F,
@@ -14889,9 +14876,9 @@ const nE = {
14889
14876
  checkpointIndex: w,
14890
14877
  onSelectCheckpoint: y
14891
14878
  }) {
14892
- const C = fh(t, n), S = "type" in t && t.type === "default_message", E = !!t.__syntheticStreaming, N = w ?? nE, M = !S && "checkpointId" in t ? t.checkpointId ?? null : null, { attemptCount: L, attemptIndex: H } = Jg(
14893
- M,
14894
- N
14879
+ const C = fh(t, n), S = "type" in t && t.type === "default_message", E = !!t.__syntheticStreaming, N = w ?? nE, M = !S && "checkpointId" in t ? t.checkpointId ?? null : null, { attemptCount: L, attemptIndex: H } = Ze(
14880
+ () => Jg(M, N),
14881
+ [M, N]
14895
14882
  );
14896
14883
  return /* @__PURE__ */ u.jsx(
14897
14884
  "div",
@@ -14962,9 +14949,9 @@ const hh = O.forwardRef(({
14962
14949
  onSelectCheckpoint: L,
14963
14950
  createSyntheticThinkingMessage: H = !0
14964
14951
  }, V) => {
14965
- const W = We(null), R = We(null), U = We(!1), k = We(!1), [F, _] = he(!0), A = et(() => w ? e.some(($) => "type" in $ && $.type === "default_message" ? !1 : Array.isArray($ == null ? void 0 : $.content) && $.content.some(
14952
+ const W = We(null), R = We(null), U = We(!1), k = We(!1), [F, _] = he(!0), A = Ze(() => w ? e.some(($) => "type" in $ && $.type === "default_message" ? !1 : Array.isArray($ == null ? void 0 : $.content) && $.content.some(
14966
14953
  (J) => J && J.type === "interrupt" && (J.id ?? J.interrupt_id) === w.id
14967
- )) : !1, [w, e]), q = et(() => {
14954
+ )) : !1, [w, e]), q = Ze(() => {
14968
14955
  if (!w || A)
14969
14956
  return null;
14970
14957
  const $ = w.id && String(w.id).trim() ? String(w.id).trim() : "pending-interrupt";
@@ -14987,7 +14974,7 @@ const hh = O.forwardRef(({
14987
14974
  }
14988
14975
  ]
14989
14976
  };
14990
- }, [w, A]), X = et(() => q ? [...e, q] : e, [e, q]), j = et(() => !H || !t ? X : !X.some((J) => J.role === "assistant") && X.length > 0 ? [
14977
+ }, [w, A]), X = Ze(() => q ? [...e, q] : e, [e, q]), j = Ze(() => !H || !t ? X : !X.some((J) => J.role === "assistant") && X.length > 0 ? [
14991
14978
  ...X,
14992
14979
  {
14993
14980
  id: "thinking-assistant",
@@ -14996,9 +14983,9 @@ const hh = O.forwardRef(({
14996
14983
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
14997
14984
  __syntheticStreaming: !0
14998
14985
  }
14999
- ] : X, [X, t, H]), P = et(() => T ? j : j.filter(($) => ($ == null ? void 0 : $.role) !== "tool"), [j, T]), K = xe(($) => {
14986
+ ] : X, [X, t, H]), P = Ze(() => T ? j : j.filter(($) => ($ == null ? void 0 : $.role) !== "tool"), [j, T]), K = xe(($) => {
15000
14987
  _($), x && x(!$), b && b($);
15001
- }, [x, b]), G = et(() => {
14988
+ }, [x, b]), G = Ze(() => {
15002
14989
  if (i)
15003
14990
  return async () => {
15004
14991
  if (!U.current) {
@@ -15010,7 +14997,7 @@ const hh = O.forwardRef(({
15010
14997
  }
15011
14998
  }
15012
14999
  };
15013
- }, [i]), oe = et(() => !v || g ? !1 : F ? "auto" : !1, [F, v, g]), B = et(() => {
15000
+ }, [i]), oe = Ze(() => !v || g ? !1 : F ? "auto" : !1, [F, v, g]), B = Ze(() => {
15014
15001
  if (typeof f != "string") return null;
15015
15002
  const $ = f.trim();
15016
15003
  return $ ? {
@@ -15165,7 +15152,7 @@ function os({
15165
15152
  K(!0);
15166
15153
  }, []), oe = xe(() => {
15167
15154
  K(!1);
15168
- }, []), B = !!j || P, [D, Y] = he(null), [ne, ae] = he(""), [$, J] = he(null), [ce, le] = he(null), [ge, Ae] = he([]), [Ke, ze] = he(0), [ke, Fe] = he(0), [qe, He] = he(!1), [Ye, ot] = he(null), [nt, Ze] = he(null), [bt, gt] = he(!1), [pt, be] = he(null), rt = We(!1), [st, Nt] = he(() => bu.value), sn = We(st), Le = We(null), Ge = xe((ie) => {
15155
+ }, []), B = !!j || P, [D, Y] = he(null), [ne, ae] = he(""), [$, J] = he(null), [ce, le] = he(null), [ge, Ae] = he([]), [Ke, ze] = he(0), [ke, Fe] = he(0), [qe, He] = he(!1), [Ye, ot] = he(null), [nt, Qe] = he(null), [bt, gt] = he(!1), [pt, be] = he(null), rt = We(!1), [st, Nt] = he(() => bu.value), sn = We(st), Le = We(null), Ge = xe((ie) => {
15169
15156
  bu.value = ie, Nt(ie);
15170
15157
  }, []), [Dt, At] = he(!1), yt = We(null), It = We(null), ee = We(null), Se = xe(() => {
15171
15158
  It.current && (It.current.value = ""), ee.current && (ee.current.value = ""), ze((ie) => ie + 1), Fe((ie) => ie + 1);
@@ -15247,7 +15234,7 @@ function os({
15247
15234
  Be(ie, me, de);
15248
15235
  },
15249
15236
  [Be]
15250
- ), Qe = xe((ie) => {
15237
+ ), et = xe((ie) => {
15251
15238
  let me = null;
15252
15239
  for (let Xe = ie - 1; Xe >= 0; Xe--)
15253
15240
  if (y[Xe].role === "user") {
@@ -15282,7 +15269,7 @@ function os({
15282
15269
  }, da = async (ie) => {
15283
15270
  const me = (ie.target.files || [])[0];
15284
15271
  if (me) {
15285
- ot(null), Ze(null), He(!0);
15272
+ ot(null), Qe(null), He(!0);
15286
15273
  try {
15287
15274
  await k(
15288
15275
  { attachments: [me] },
@@ -15292,7 +15279,7 @@ function os({
15292
15279
  }
15293
15280
  );
15294
15281
  const de = `Uploaded ${me.name} - processing through chat stream`;
15295
- Ze(de);
15282
+ Qe(de);
15296
15283
  } catch (de) {
15297
15284
  const Ce = de instanceof Error ? de.message : "Failed to upload Excel file";
15298
15285
  console.error("Excel upload failed", de), ot(Ce), g == null || g(Ce);
@@ -15362,7 +15349,7 @@ function os({
15362
15349
  enableMessageEditing: c,
15363
15350
  editingMessageId: D,
15364
15351
  onEdit: $e,
15365
- onRegenerate: Qe,
15352
+ onRegenerate: et,
15366
15353
  onCancelEdit: ht,
15367
15354
  emptyMessage: pt ?? void 0,
15368
15355
  isNavigatingCheckpoint: Dt,
@@ -16657,10 +16644,10 @@ function ku({
16657
16644
  }
16658
16645
  },
16659
16646
  [Ye, H, J, F]
16660
- ), nt = et(() => {
16647
+ ), nt = Ze(() => {
16661
16648
  const ee = b ?? [], Se = le.trim().toLowerCase();
16662
16649
  return Se ? y ? ee.filter((mt) => y(mt, Se)) : ee.filter((mt) => `${mt.label} ${mt.secondaryLabel ?? ""}`.toLowerCase().includes(Se)) : ee;
16663
- }, [b, le, y]), Ze = ke === "shared", bt = Ze ? S : q, gt = Ze ? M : N, pt = Ze ? "No shared conversations yet" : "No conversations yet", be = (ee) => {
16650
+ }, [b, le, y]), Qe = ke === "shared", bt = Qe ? S : q, gt = Qe ? M : N, pt = Qe ? "No shared conversations yet" : "No conversations yet", be = (ee) => {
16664
16651
  const Se = ee.sharedAt ? ` • ${At(ee.sharedAt)}` : "";
16665
16652
  return `Shared by ${ee.sharedByUserId}${Se}`;
16666
16653
  }, rt = (ee) => "sharedByUserId" in ee;
@@ -16819,7 +16806,7 @@ function ku({
16819
16806
  showDeleteButton: n,
16820
16807
  formatDate: At,
16821
16808
  getDisplayThreadTitle: It,
16822
- secondaryLine: Ze && rt(ee) ? be(ee) : void 0,
16809
+ secondaryLine: Qe && rt(ee) ? be(ee) : void 0,
16823
16810
  itemClassName: s.threadItem,
16824
16811
  activeItemClassName: s.activeThread
16825
16812
  },
@@ -19098,7 +19085,7 @@ function cI(e) {
19098
19085
  }
19099
19086
  var uI = (e) => {
19100
19087
  var t, n, r, o, s, a, i, l, c, d, p;
19101
- 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: N, style: M, cancelButtonStyle: L, actionButtonStyle: H, className: V = "", descriptionClassName: W = "", duration: R, position: U, gap: k, loadingIcon: F, expandByDefault: _, classNames: A, icons: q, closeButtonAriaLabel: X = "Close toast", pauseWhenPageIsHidden: j } = e, [P, K] = O.useState(null), [G, oe] = O.useState(null), [B, D] = O.useState(!1), [Y, ne] = O.useState(!1), [ae, $] = O.useState(!1), [J, ce] = O.useState(!1), [le, ge] = O.useState(!1), [Ae, Ke] = O.useState(0), [ze, ke] = O.useState(0), Fe = O.useRef(f.duration || R || Nu), qe = O.useRef(null), He = O.useRef(null), Ye = y === 0, ot = y + 1 <= b, nt = f.type, Ze = f.dismissible !== !1, bt = f.className || "", gt = f.descriptionClassName || "", pt = O.useMemo(() => w.findIndex((Te) => Te.toastId === f.id) || 0, [w, f.id]), be = O.useMemo(() => {
19088
+ 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: N, style: M, cancelButtonStyle: L, actionButtonStyle: H, className: V = "", descriptionClassName: W = "", duration: R, position: U, gap: k, loadingIcon: F, expandByDefault: _, classNames: A, icons: q, closeButtonAriaLabel: X = "Close toast", pauseWhenPageIsHidden: j } = e, [P, K] = O.useState(null), [G, oe] = O.useState(null), [B, D] = O.useState(!1), [Y, ne] = O.useState(!1), [ae, $] = O.useState(!1), [J, ce] = O.useState(!1), [le, ge] = O.useState(!1), [Ae, Ke] = O.useState(0), [ze, ke] = O.useState(0), Fe = O.useRef(f.duration || R || Nu), qe = O.useRef(null), He = O.useRef(null), Ye = y === 0, ot = y + 1 <= b, nt = f.type, Qe = f.dismissible !== !1, bt = f.className || "", gt = f.descriptionClassName || "", pt = O.useMemo(() => w.findIndex((Te) => Te.toastId === f.id) || 0, [w, f.id]), be = O.useMemo(() => {
19102
19089
  var Te;
19103
19090
  return (Te = f.closeButton) != null ? Te : N;
19104
19091
  }, [f.closeButton, N]), rt = O.useMemo(() => f.duration || R || Nu, [f.duration, R]), st = O.useRef(0), Nt = O.useRef(0), sn = O.useRef(0), Le = O.useRef(null), [Ge, Dt] = U.split("-"), At = O.useMemo(() => w.reduce((Te, Pe, Ue) => Ue >= pt ? Te : Te + Pe.height, 0), [w, pt]), yt = GR(), It = f.invert || m, ee = nt === "loading";
@@ -19144,34 +19131,34 @@ var uI = (e) => {
19144
19131
  var Te, Pe, Ue;
19145
19132
  return q != null && q.loading ? O.createElement("div", { className: an(A == null ? void 0 : A.loader, (Te = f == null ? void 0 : f.classNames) == null ? void 0 : Te.loader, "sonner-loader"), "data-visible": nt === "loading" }, q.loading) : F ? O.createElement("div", { className: an(A == null ? void 0 : A.loader, (Pe = f == null ? void 0 : f.classNames) == null ? void 0 : Pe.loader, "sonner-loader"), "data-visible": nt === "loading" }, F) : O.createElement(HR, { className: an(A == null ? void 0 : A.loader, (Ue = f == null ? void 0 : f.classNames) == null ? void 0 : Ue.loader), visible: nt === "loading" });
19146
19133
  }
19147
- return O.createElement("li", { tabIndex: 0, ref: He, className: an(V, bt, A == null ? void 0 : A.toast, (t = f == null ? void 0 : f.classNames) == null ? void 0 : t.toast, A == null ? void 0 : A.default, A == null ? void 0 : A[nt], (n = f == null ? void 0 : f.classNames) == null ? void 0 : n[nt]), "data-sonner-toast": "", "data-rich-colors": (r = f.richColors) != null ? r : E, "data-styled": !(f.jsx || f.unstyled || v), "data-mounted": B, "data-promise": !!f.promise, "data-swiped": le, "data-removed": Y, "data-visible": ot, "data-y-position": Ge, "data-x-position": Dt, "data-index": y, "data-front": Ye, "data-swiping": ae, "data-dismissible": Ze, "data-type": nt, "data-invert": It, "data-swipe-out": J, "data-swipe-direction": G, "data-expanded": !!(S || _ && B), style: { "--index": y, "--toasts-before": y, "--z-index": C.length - y, "--offset": `${Y ? Ae : Nt.current}px`, "--initial-height": _ ? "auto" : `${ze}px`, ...M, ...f.style }, onDragEnd: () => {
19134
+ return O.createElement("li", { tabIndex: 0, ref: He, className: an(V, bt, A == null ? void 0 : A.toast, (t = f == null ? void 0 : f.classNames) == null ? void 0 : t.toast, A == null ? void 0 : A.default, A == null ? void 0 : A[nt], (n = f == null ? void 0 : f.classNames) == null ? void 0 : n[nt]), "data-sonner-toast": "", "data-rich-colors": (r = f.richColors) != null ? r : E, "data-styled": !(f.jsx || f.unstyled || v), "data-mounted": B, "data-promise": !!f.promise, "data-swiped": le, "data-removed": Y, "data-visible": ot, "data-y-position": Ge, "data-x-position": Dt, "data-index": y, "data-front": Ye, "data-swiping": ae, "data-dismissible": Qe, "data-type": nt, "data-invert": It, "data-swipe-out": J, "data-swipe-direction": G, "data-expanded": !!(S || _ && B), style: { "--index": y, "--toasts-before": y, "--z-index": C.length - y, "--offset": `${Y ? Ae : Nt.current}px`, "--initial-height": _ ? "auto" : `${ze}px`, ...M, ...f.style }, onDragEnd: () => {
19148
19135
  $(!1), K(null), Le.current = null;
19149
19136
  }, onPointerDown: (Te) => {
19150
- ee || !Ze || (qe.current = /* @__PURE__ */ new Date(), Ke(Nt.current), Te.target.setPointerCapture(Te.pointerId), Te.target.tagName !== "BUTTON" && ($(!0), Le.current = { x: Te.clientX, y: Te.clientY }));
19137
+ ee || !Qe || (qe.current = /* @__PURE__ */ new Date(), Ke(Nt.current), Te.target.setPointerCapture(Te.pointerId), Te.target.tagName !== "BUTTON" && ($(!0), Le.current = { x: Te.clientX, y: Te.clientY }));
19151
19138
  }, onPointerUp: () => {
19152
19139
  var Te, Pe, Ue, Et;
19153
- if (J || !Ze) return;
19140
+ if (J || !Qe) return;
19154
19141
  Le.current = null;
19155
- let Be = Number(((Te = He.current) == null ? void 0 : Te.style.getPropertyValue("--swipe-amount-x").replace("px", "")) || 0), ht = Number(((Pe = He.current) == null ? void 0 : Pe.style.getPropertyValue("--swipe-amount-y").replace("px", "")) || 0), $e = (/* @__PURE__ */ new Date()).getTime() - ((Ue = qe.current) == null ? void 0 : Ue.getTime()), Qe = P === "x" ? Be : ht, Ft = Math.abs(Qe) / $e;
19156
- if (Math.abs(Qe) >= iI || Ft > 0.11) {
19142
+ let Be = Number(((Te = He.current) == null ? void 0 : Te.style.getPropertyValue("--swipe-amount-x").replace("px", "")) || 0), ht = Number(((Pe = He.current) == null ? void 0 : Pe.style.getPropertyValue("--swipe-amount-y").replace("px", "")) || 0), $e = (/* @__PURE__ */ new Date()).getTime() - ((Ue = qe.current) == null ? void 0 : Ue.getTime()), et = P === "x" ? Be : ht, Ft = Math.abs(et) / $e;
19143
+ if (Math.abs(et) >= iI || Ft > 0.11) {
19157
19144
  Ke(Nt.current), (Et = f.onDismiss) == null || Et.call(f, f), oe(P === "x" ? Be > 0 ? "right" : "left" : ht > 0 ? "down" : "up"), Se(), ce(!0), ge(!1);
19158
19145
  return;
19159
19146
  }
19160
19147
  $(!1), K(null);
19161
19148
  }, onPointerMove: (Te) => {
19162
19149
  var Pe, Ue, Et, Be;
19163
- if (!Le.current || !Ze || ((Pe = window.getSelection()) == null ? void 0 : Pe.toString().length) > 0) return;
19164
- let ht = Te.clientY - Le.current.y, $e = Te.clientX - Le.current.x, Qe = (Ue = e.swipeDirections) != null ? Ue : cI(U);
19150
+ if (!Le.current || !Qe || ((Pe = window.getSelection()) == null ? void 0 : Pe.toString().length) > 0) return;
19151
+ let ht = Te.clientY - Le.current.y, $e = Te.clientX - Le.current.x, et = (Ue = e.swipeDirections) != null ? Ue : cI(U);
19165
19152
  !P && (Math.abs($e) > 1 || Math.abs(ht) > 1) && K(Math.abs($e) > Math.abs(ht) ? "x" : "y");
19166
19153
  let Ft = { x: 0, y: 0 };
19167
- P === "y" ? (Qe.includes("top") || Qe.includes("bottom")) && (Qe.includes("top") && ht < 0 || Qe.includes("bottom") && ht > 0) && (Ft.y = ht) : P === "x" && (Qe.includes("left") || Qe.includes("right")) && (Qe.includes("left") && $e < 0 || Qe.includes("right") && $e > 0) && (Ft.x = $e), (Math.abs(Ft.x) > 0 || Math.abs(Ft.y) > 0) && ge(!0), (Et = He.current) == null || Et.style.setProperty("--swipe-amount-x", `${Ft.x}px`), (Be = He.current) == null || Be.style.setProperty("--swipe-amount-y", `${Ft.y}px`);
19168
- } }, be && !f.jsx ? O.createElement("button", { "aria-label": X, "data-disabled": ee, "data-close-button": !0, onClick: ee || !Ze ? () => {
19154
+ P === "y" ? (et.includes("top") || et.includes("bottom")) && (et.includes("top") && ht < 0 || et.includes("bottom") && ht > 0) && (Ft.y = ht) : P === "x" && (et.includes("left") || et.includes("right")) && (et.includes("left") && $e < 0 || et.includes("right") && $e > 0) && (Ft.x = $e), (Math.abs(Ft.x) > 0 || Math.abs(Ft.y) > 0) && ge(!0), (Et = He.current) == null || Et.style.setProperty("--swipe-amount-x", `${Ft.x}px`), (Be = He.current) == null || Be.style.setProperty("--swipe-amount-y", `${Ft.y}px`);
19155
+ } }, be && !f.jsx ? O.createElement("button", { "aria-label": X, "data-disabled": ee, "data-close-button": !0, onClick: ee || !Qe ? () => {
19169
19156
  } : () => {
19170
19157
  var Te;
19171
19158
  Se(), (Te = f.onDismiss) == null || Te.call(f, f);
19172
19159
  }, className: an(A == null ? void 0 : A.closeButton, (o = f == null ? void 0 : f.classNames) == null ? void 0 : o.closeButton) }, (s = q == null ? void 0 : q.close) != null ? s : qR) : null, f.jsx || pa(f.title) ? f.jsx ? f.jsx : typeof f.title == "function" ? f.title() : f.title : O.createElement(O.Fragment, null, nt || f.icon || f.promise ? O.createElement("div", { "data-icon": "", className: an(A == null ? void 0 : A.icon, (a = f == null ? void 0 : f.classNames) == null ? void 0 : a.icon) }, f.promise || f.type === "loading" && !f.icon ? f.icon || mt() : null, f.type !== "loading" ? f.icon || (q == null ? void 0 : q[nt]) || BR(nt) : null) : null, O.createElement("div", { "data-content": "", className: an(A == null ? void 0 : A.content, (i = f == null ? void 0 : f.classNames) == null ? void 0 : i.content) }, O.createElement("div", { "data-title": "", className: an(A == null ? void 0 : A.title, (l = f == null ? void 0 : f.classNames) == null ? void 0 : l.title) }, typeof f.title == "function" ? f.title() : f.title), f.description ? O.createElement("div", { "data-description": "", className: an(W, gt, A == null ? void 0 : A.description, (c = f == null ? void 0 : f.classNames) == null ? void 0 : c.description) }, typeof f.description == "function" ? f.description() : f.description) : null), pa(f.cancel) ? f.cancel : f.cancel && Ho(f.cancel) ? O.createElement("button", { "data-button": !0, "data-cancel": !0, style: f.cancelButtonStyle || L, onClick: (Te) => {
19173
19160
  var Pe, Ue;
19174
- Ho(f.cancel) && Ze && ((Ue = (Pe = f.cancel).onClick) == null || Ue.call(Pe, Te), Se());
19161
+ Ho(f.cancel) && Qe && ((Ue = (Pe = f.cancel).onClick) == null || Ue.call(Pe, Te), Se());
19175
19162
  }, className: an(A == null ? void 0 : A.cancelButton, (d = f == null ? void 0 : f.classNames) == null ? void 0 : d.cancelButton) }, f.cancel.label) : null, pa(f.action) ? f.action : f.action && Ho(f.action) ? O.createElement("button", { "data-button": !0, "data-action": !0, style: f.actionButtonStyle || H, onClick: (Te) => {
19176
19163
  var Pe, Ue;
19177
19164
  Ho(f.action) && ((Ue = (Pe = f.action).onClick) == null || Ue.call(Pe, Te), !Te.defaultPrevented && Se());