teodor-new-chat-ui 4.1.77 → 4.1.80

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 xm = Object.defineProperty;
2
2
  var vm = (e, t, n) => t in e ? xm(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
3
  var ml = (e, t, n) => vm(e, typeof t != "symbol" ? t + "" : t, n);
4
4
  import * as g from "react";
5
- import q, { createContext as co, useContext as vs, useReducer as wm, useRef as We, useCallback as Ne, useEffect as ot, useMemo as dt, useState as ye, startTransition as ru, createElement as Mo, useLayoutEffect as ym } from "react";
5
+ import q, { createContext as co, useContext as vs, useReducer as wm, useRef as We, useCallback as Ne, useEffect as st, useMemo as dt, useState as ye, startTransition as ru, createElement as Mo, useLayoutEffect as ym } from "react";
6
6
  import { Square as bm, Send as Sm, X as Cr, ExternalLink as Cm, Download as km, Image as Tm, FileText as gl, Loader as ou, Bot as xl, Wrench as Im, User as Rm, ChevronUp as Wr, ChevronDown as Sr, Paperclip as ji, Copy as vl, Edit as wl, RotateCcw as Pi, ChevronRight as Em, Check as ha, Circle as Nm, Loader2 as Oi, Edit3 as su, Plus as Am, FileSpreadsheet as _m, MessageSquarePlus as jm, MessageSquare as Pm, Calendar as Om, Trash2 as Mm, Settings as Dm, Server as Lm, EyeOff as Fm, Eye as $m, Layout as zm, MessageCircle as Bm, Save as Hm } from "lucide-react";
7
7
  import { Slot as Um, createSlot as Er } from "@radix-ui/react-slot";
8
8
  import { cva as ws } from "class-variance-authority";
@@ -324,13 +324,13 @@ function qm() {
324
324
  }
325
325
  return "";
326
326
  }
327
- var Oe = Object.prototype.hasOwnProperty, $e = {}, st = v.ReactDebugCurrentFrame;
327
+ var Oe = Object.prototype.hasOwnProperty, $e = {}, ot = v.ReactDebugCurrentFrame;
328
328
  function Je(m) {
329
329
  if (m) {
330
330
  var I = m._owner, j = Ue(m.type, m._source, I ? I.type : null);
331
- st.setExtraStackFrame(j);
331
+ ot.setExtraStackFrame(j);
332
332
  } else
333
- st.setExtraStackFrame(null);
333
+ ot.setExtraStackFrame(null);
334
334
  }
335
335
  function _e(m, I, j, U, ee) {
336
336
  {
@@ -2741,7 +2741,7 @@ function Ox(e = []) {
2741
2741
  }, [i]), l = Ne((d) => {
2742
2742
  r.current.push(d), a();
2743
2743
  }, [a]);
2744
- ot(() => () => {
2744
+ st(() => () => {
2745
2745
  o.current !== null && typeof window < "u" && window.cancelAnimationFrame(o.current), s.current !== null && clearTimeout(s.current), r.current = [];
2746
2746
  }, []);
2747
2747
  const u = dt(() => ({
@@ -3061,14 +3061,14 @@ function Fx(e = {}) {
3061
3061
  if (r)
3062
3062
  ce = { Authorization: `Bearer ${r}` };
3063
3063
  else if (typeof window < "u") {
3064
- const $e = window.__AUTH_TOKEN__, st = ((B = window.localStorage) == null ? void 0 : B.getItem("authToken")) || null;
3064
+ const $e = window.__AUTH_TOKEN__, ot = ((B = window.localStorage) == null ? void 0 : B.getItem("authToken")) || null;
3065
3065
  let Je = null;
3066
3066
  try {
3067
3067
  const pt = (z = window.localStorage) == null ? void 0 : z.getItem("chat-settings");
3068
3068
  pt && (Je = ((H = JSON.parse(pt)) == null ? void 0 : H.apiKey) || null);
3069
3069
  } catch {
3070
3070
  }
3071
- const _e = $e || st || Je || null;
3071
+ const _e = $e || ot || Je || null;
3072
3072
  _e && (ce = { Authorization: `Bearer ${_e}` });
3073
3073
  }
3074
3074
  } catch {
@@ -3123,8 +3123,8 @@ function Fx(e = {}) {
3123
3123
  }
3124
3124
  }, 5e3), Ue = 1024 * 1024;
3125
3125
  try {
3126
- const Oe = we.headers.get("X-Thread-Id") || we.headers.get("x-thread-id"), $e = we.headers.get("X-Thread-Created") || we.headers.get("x-thread-created"), st = Oe ?? null, Je = String($e ?? "").toLowerCase() === "true";
3127
- for ((M = F == null ? void 0 : F.onOpen) == null || M.call(F, { threadId: st, created: Je }); ; ) {
3126
+ const Oe = we.headers.get("X-Thread-Id") || we.headers.get("x-thread-id"), $e = we.headers.get("X-Thread-Created") || we.headers.get("x-thread-created"), ot = Oe ?? null, Je = String($e ?? "").toLowerCase() === "true";
3127
+ for ((M = F == null ? void 0 : F.onOpen) == null || M.call(F, { threadId: ot, created: Je }); ; ) {
3128
3128
  const { value: _e, done: pt } = await Ce.read();
3129
3129
  if (pt) break;
3130
3130
  K += de.decode(_e, { stream: !0 }), K.length > Ue && (K = "", console.warn("Stream buffer reset: exceeded 1MB"));
@@ -3195,7 +3195,7 @@ function Fx(e = {}) {
3195
3195
  },
3196
3196
  [t, n, r, e.autoAppendAssistant]
3197
3197
  );
3198
- return ot(() => () => {
3198
+ return st(() => () => {
3199
3199
  var O;
3200
3200
  T.current = !1, (O = S.current) == null || O.abort();
3201
3201
  }, []), {
@@ -3641,7 +3641,7 @@ function Qx(e) {
3641
3641
  );
3642
3642
  return To(N);
3643
3643
  }), u = dt(() => fi(a), [a]), [d, f] = ye(o), [h, p] = ye(!1), [y, w] = ye(null), x = We(u.length), v = We(!1), b = We(null), S = We(""), T = We(!1), C = We(null);
3644
- ot(() => {
3644
+ st(() => {
3645
3645
  x.current = u.length;
3646
3646
  }, [u.length]);
3647
3647
  const k = Ne(() => {
@@ -3767,12 +3767,12 @@ function Qx(e) {
3767
3767
  },
3768
3768
  [t, A]
3769
3769
  );
3770
- ot(() => {
3770
+ st(() => {
3771
3771
  if (Ar())
3772
3772
  return R(u), () => {
3773
3773
  b.current !== null && (window.clearTimeout(b.current), b.current = null);
3774
3774
  };
3775
- }, [u, R]), ot(() => {
3775
+ }, [u, R]), st(() => {
3776
3776
  var H, M, D;
3777
3777
  const N = (X) => {
3778
3778
  const _ = ui(n, X ?? null);
@@ -3907,20 +3907,16 @@ function tv({
3907
3907
  initialThreadId: t,
3908
3908
  clearAllMessageCaches: b,
3909
3909
  onAuthTokenChange: (m) => S.current(m ?? null)
3910
- });
3911
- ot(() => {
3912
- T.length > 0 && console.log("[ChatSessionProvider] After useThreadList - threads.length:", T.length, "threads:", T);
3913
- }, [T]);
3914
- const [z, H] = ye(!1), [M, D] = ye(null), [X, _] = ye(null), [G, ce] = ye(!1), [we, Ce] = ye(!1), [de, K] = ye([]), [$, Y] = ye([]), J = We([]), [me, oe] = ye(null), {
3910
+ }), [z, H] = ye(!1), [M, D] = ye(null), [X, _] = ye(null), [G, ce] = ye(!1), [we, Ce] = ye(!1), [de, K] = ye([]), [$, Y] = ye([]), J = We([]), [me, oe] = ye(null), {
3915
3911
  state: te,
3916
3912
  dispatch: Xe,
3917
3913
  seed: Ue,
3918
3914
  prepend: Oe,
3919
3915
  pushUser: $e,
3920
- onEvent: st,
3916
+ onEvent: ot,
3921
3917
  reset: Je
3922
3918
  } = Ox(), _e = We(C);
3923
- ot(() => {
3919
+ st(() => {
3924
3920
  _e.current = C;
3925
3921
  }, [C]);
3926
3922
  const pt = We(!1), ne = We([]), ae = We(null), he = We(null), be = We(/* @__PURE__ */ new Map()), pe = We(C), Ie = We({ threadId: null, checkpointId: null, checkpointNs: null }), Ze = Ne((m, I) => new Promise((j, U) => {
@@ -3941,7 +3937,7 @@ function tv({
3941
3937
  U(se);
3942
3938
  });
3943
3939
  }), []);
3944
- ot(() => {
3940
+ st(() => {
3945
3941
  var ee;
3946
3942
  const m = _e.current;
3947
3943
  if (!m) {
@@ -4077,7 +4073,7 @@ function tv({
4077
4073
  J
4078
4074
  ]
4079
4075
  );
4080
- ot(() => {
4076
+ st(() => {
4081
4077
  if (!_e.current || !de.length) return;
4082
4078
  const m = {
4083
4079
  checkpointId: te.lastCheckpointId ?? null,
@@ -4151,17 +4147,17 @@ function tv({
4151
4147
  ), { startStream: hr, stop: In, isStreaming: on, error: Pt, setAuthToken: sn } = Bx({
4152
4148
  baseUrl: d,
4153
4149
  onThreadInfo: zr,
4154
- onMessageEvent: st,
4150
+ onMessageEvent: ot,
4155
4151
  onUnhandledEvent: (m) => {
4156
4152
  console.warn(`[ChatSessionProvider] Unhandled stream event: ${m.type}`, m);
4157
4153
  },
4158
4154
  onSequenceGap: Hn
4159
4155
  });
4160
- ot(() => {
4156
+ st(() => {
4161
4157
  ze.current = on;
4162
- }, [on]), ot(() => {
4158
+ }, [on]), st(() => {
4163
4159
  S.current = (m) => sn(m ?? null);
4164
- }, [sn]), ot(() => {
4160
+ }, [sn]), st(() => {
4165
4161
  var m;
4166
4162
  S.current(((m = l.getAuthToken) == null ? void 0 : m.call(l)) ?? null);
4167
4163
  }, [l]);
@@ -4484,14 +4480,14 @@ function tv({
4484
4480
  (m) => xe(m.interruptId, m.approved, m.value),
4485
4481
  [xe]
4486
4482
  );
4487
- ot(() => {
4483
+ st(() => {
4488
4484
  if (a == null || a(C), C)
4489
4485
  try {
4490
4486
  localStorage.setItem("lastThreadId", C);
4491
4487
  } catch (m) {
4492
4488
  console.warn("[ChatSessionProvider] Failed to persist lastThreadId:", m);
4493
4489
  }
4494
- }, [C, a]), ot(() => ((async () => {
4490
+ }, [C, a]), st(() => ((async () => {
4495
4491
  try {
4496
4492
  if (A().catch((I) => {
4497
4493
  console.error("[ChatSessionProvider] Failed to refresh threads (background):", I), i == null || i(String(I));
@@ -4507,7 +4503,7 @@ function tv({
4507
4503
  console.error("[ChatSessionProvider] Initialization failed:", I), i == null || i(String(I));
4508
4504
  }
4509
4505
  })(), () => {
4510
- }), []), ot(() => {
4506
+ }), []), st(() => {
4511
4507
  const m = _e.current;
4512
4508
  if (!m || pe.current !== m) return;
4513
4509
  const I = {
@@ -7592,14 +7588,14 @@ const yw = /* @__PURE__ */ qe(
7592
7588
  Oe,
7593
7589
  $e
7594
7590
  ]) => {
7595
- const { column: st, row: Je } = me, { height: _e, width: pt } = oe, { width: ne } = te;
7591
+ const { column: ot, row: Je } = me, { height: _e, width: pt } = oe, { width: ne } = te;
7596
7592
  if (Ue === 0 && ($ === 0 || ne === 0))
7597
7593
  return ac;
7598
7594
  if (pt === 0) {
7599
7595
  const ft = Na($e, $), Et = ft + Math.max(Ue - 1, 0);
7600
7596
  return vw(uc(ft, Et, Xe));
7601
7597
  }
7602
- const ae = Td(ne, pt, st);
7598
+ const ae = Td(ne, pt, ot);
7603
7599
  let he, be;
7604
7600
  Oe ? Y === 0 && J === 0 && Ue > 0 ? (he = 0, be = Ue - 1) : (he = ae * os((Y + Je) / (_e + Je)), be = ae * lc((J + Je) / (_e + Je)) - 1, be = vi($ - 1, Gr(be, ae - 1)), he = vi(be, Gr(0, he))) : (he = 0, be = -1);
7605
7601
  const pe = uc(he, be, Xe), { bottom: Ie, top: Ze } = dc(te, me, oe, pe), ze = lc($ / ae), nt = ze * _e + (ze - 1) * Je - Ie;
@@ -7676,8 +7672,8 @@ const yw = /* @__PURE__ */ qe(
7676
7672
  const te = ld($), { align: Xe, behavior: Ue, offset: Oe } = te;
7677
7673
  let $e = te.index;
7678
7674
  $e === "LAST" && ($e = me - 1), $e = Gr(0, $e, vi(me - 1, $e));
7679
- let st = Gi(Y, oe, J, $e);
7680
- return Xe === "end" ? st = cc(st - Y.height + J.height) : Xe === "center" && (st = cc(st - Y.height / 2 + J.height / 2)), Oe && (st += Oe), { behavior: Ue, top: st };
7675
+ let ot = Gi(Y, oe, J, $e);
7676
+ return Xe === "end" ? ot = cc(ot - Y.height + J.height) : Xe === "center" && (ot = cc(ot - Y.height / 2 + J.height / 2)), Oe && (ot += Oe), { behavior: Ue, top: ot };
7681
7677
  })
7682
7678
  ),
7683
7679
  l
@@ -11206,7 +11202,7 @@ function jb({ isOpen: e, onClose: t, fileId: n, fileName: r, mimeType: o }) {
11206
11202
  }
11207
11203
  }
11208
11204
  }, [n]);
11209
- ot(() => {
11205
+ st(() => {
11210
11206
  e && n && h();
11211
11207
  }, [e, n, h]);
11212
11208
  const p = async () => {
@@ -11476,7 +11472,7 @@ function Fc(e) {
11476
11472
  }
11477
11473
  function $b({ className: e }) {
11478
11474
  const [t, n] = ye(0);
11479
- return ot(() => {
11475
+ return st(() => {
11480
11476
  const r = setInterval(() => n((o) => (o + 1) % 4), 500);
11481
11477
  return () => clearInterval(r);
11482
11478
  }, []), /* @__PURE__ */ c.jsxs(
@@ -11687,7 +11683,7 @@ const zb = q.memo(function({
11687
11683
  } catch (ae) {
11688
11684
  console.error("Failed to reject interrupt:", ae);
11689
11685
  }
11690
- }, [A]), st = q.useCallback(({ part: ne, i: ae }) => {
11686
+ }, [A]), ot = q.useCallback(({ part: ne, i: ae }) => {
11691
11687
  if (ne.type === "text") {
11692
11688
  const he = ne.text ?? "", be = he.trim(), pe = Lc(be);
11693
11689
  return pe && M !== "tool" ? /* @__PURE__ */ c.jsx(Bb, { data: pe }, ae) : M === "user" && f && be.length > h ? /* @__PURE__ */ c.jsxs(pc, { open: k, onOpenChange: R, children: [
@@ -11802,7 +11798,7 @@ const zb = q.memo(function({
11802
11798
  }) });
11803
11799
  }
11804
11800
  if (!D) {
11805
- const ae = /* @__PURE__ */ c.jsx("div", { className: "space-y-2", children: t.content.map((he, be) => /* @__PURE__ */ c.jsx(st, { part: he, i: be }, be)) });
11801
+ const ae = /* @__PURE__ */ c.jsx("div", { className: "space-y-2", children: t.content.map((he, be) => /* @__PURE__ */ c.jsx(ot, { part: he, i: be }, be)) });
11806
11802
  return r ? /* @__PURE__ */ c.jsxs("div", { "aria-busy": "true", role: "status", children: [
11807
11803
  ae,
11808
11804
  /* @__PURE__ */ c.jsx($b, { className: _ })
@@ -13732,8 +13728,8 @@ var tl = "PopperContent", [cS, uS] = Ff(tl), Uf = g.forwardRef(
13732
13728
  rS({
13733
13729
  ...V,
13734
13730
  apply: ({ elements: te, rects: Xe, availableWidth: Ue, availableHeight: Oe }) => {
13735
- const { width: $e, height: st } = Xe.reference, Je = te.floating.style;
13736
- Je.setProperty("--radix-popper-available-width", `${Ue}px`), Je.setProperty("--radix-popper-available-height", `${Oe}px`), Je.setProperty("--radix-popper-anchor-width", `${$e}px`), Je.setProperty("--radix-popper-anchor-height", `${st}px`);
13731
+ const { width: $e, height: ot } = Xe.reference, Je = te.floating.style;
13732
+ Je.setProperty("--radix-popper-available-width", `${Ue}px`), Je.setProperty("--radix-popper-available-height", `${Oe}px`), Je.setProperty("--radix-popper-anchor-width", `${$e}px`), Je.setProperty("--radix-popper-anchor-height", `${ot}px`);
13737
13733
  }
13738
13734
  }),
13739
13735
  T && sS({ element: T, padding: a }),
@@ -14921,20 +14917,20 @@ function _i({
14921
14917
  checkpoint: A,
14922
14918
  respondToInterrupt: O,
14923
14919
  metadata: L
14924
- } = Sa(), { isStreaming: F, error: V, submit: N, stop: B } = nv(), z = x ?? w ?? null, H = (A == null ? void 0 : A.id) ?? null, M = (A == null ? void 0 : A.namespace) ?? null, D = (L == null ? void 0 : L.assemblingMessageId) ?? null, [X, _] = ye(null), [G, ce] = ye(""), [we, Ce] = ye(null), [de, K] = ye([]), [$, Y] = ye(0), [J, me] = ye(0), [oe, te] = ye(!1), [Xe, Ue] = ye(null), [Oe, $e] = ye(null), [st, Je] = ye(!1), [_e, pt] = ye(null), [ne, ae] = ye([]), [he, be] = ye(null), [pe, Ie] = ye(null), [Ze, ze] = ye(!1), nt = We(null), ft = We(null), Et = Ne(() => {
14920
+ } = Sa(), { isStreaming: F, error: V, submit: N, stop: B } = nv(), z = x ?? w ?? null, H = (A == null ? void 0 : A.id) ?? null, M = (A == null ? void 0 : A.namespace) ?? null, D = (L == null ? void 0 : L.assemblingMessageId) ?? null, [X, _] = ye(null), [G, ce] = ye(""), [we, Ce] = ye(null), [de, K] = ye([]), [$, Y] = ye(0), [J, me] = ye(0), [oe, te] = ye(!1), [Xe, Ue] = ye(null), [Oe, $e] = ye(null), [ot, Je] = ye(!1), [_e, pt] = ye(null), [ne, ae] = ye([]), [he, be] = ye(null), [pe, Ie] = ye(null), [Ze, ze] = ye(!1), nt = We(null), ft = We(null), Et = Ne(() => {
14925
14921
  nt.current && (nt.current.value = ""), ft.current && (ft.current.value = ""), Y((ie) => ie + 1), me((ie) => ie + 1);
14926
14922
  }, []), Gt = We(!1);
14927
- ot(() => {
14923
+ st(() => {
14928
14924
  Gt.current && !F && (K([]), Et()), Gt.current = F;
14929
14925
  }, [F, Et]);
14930
14926
  const [rn, Hn] = ye("desktop");
14931
- ot(() => {
14927
+ st(() => {
14932
14928
  const ie = () => {
14933
14929
  const xe = window.innerWidth;
14934
14930
  Hn(xe < 640 ? "phone" : xe < 1024 ? "tablet" : "desktop");
14935
14931
  };
14936
14932
  return ie(), window.addEventListener("resize", ie), () => window.removeEventListener("resize", ie);
14937
- }, []), ot(() => {
14933
+ }, []), st(() => {
14938
14934
  if (!z) {
14939
14935
  ae([]), be(null), Ie(null);
14940
14936
  return;
@@ -14948,7 +14944,7 @@ function _i({
14948
14944
  const xe = ie[0], Me = xe ? Yn(xe) : { checkpointId: null, checkpointNs: null };
14949
14945
  be(Me.checkpointId), Ie(Me.checkpointNs);
14950
14946
  }
14951
- }, [he, z, k]), ot(() => {
14947
+ }, [he, z, k]), st(() => {
14952
14948
  H && (be(H), Ie(M ?? null));
14953
14949
  }, [H, M]);
14954
14950
  const zr = Ne(async () => {
@@ -14959,7 +14955,7 @@ function _i({
14959
14955
  console.warn("loadOlder failed", ie);
14960
14956
  }
14961
14957
  }, [b, S, C]);
14962
- ot(() => {
14958
+ st(() => {
14963
14959
  (async () => {
14964
14960
  if (!y.baseUrl) {
14965
14961
  pt(null);
@@ -14972,9 +14968,9 @@ function _i({
14972
14968
  console.warn("Failed to fetch default message:", xe), pt(null);
14973
14969
  }
14974
14970
  })();
14975
- }, [y]), ot(() => {
14976
- V && !st && (p == null || p(V));
14977
- }, [V, st, p]);
14971
+ }, [y]), st(() => {
14972
+ V && !ot && (p == null || p(V));
14973
+ }, [V, ot, p]);
14978
14974
  const hr = (ie) => {
14979
14975
  if (ie.length > Xo)
14980
14976
  return `Message too long (${ie.length}/${Xo} characters)`;
@@ -15087,7 +15083,7 @@ function _i({
15087
15083
  }
15088
15084
  }, Vn = `flex flex-1 w-full flex-col min-h-0 min-w-0 max-h-full overflow-hidden bg-transparent ${e} ${d.container || ""}`, gr = `flex-1 min-h-0 min-w-0 max-h-full w-full overflow-hidden overscroll-contain break-words break-anywhere p-4 bg-transparent ${d.messagesArea || ""}`, xr = `flex-shrink-0 w-full border-t p-4 bg-transparent ${d.inputArea || ""}`;
15089
15085
  return /* @__PURE__ */ c.jsxs("div", { className: Vn, children: [
15090
- !!V && !st && /* @__PURE__ */ c.jsxs("div", { className: "flex-shrink-0 bg-red-50 border border-red-200 text-red-800 px-4 py-2 text-sm flex items-center justify-between", children: [
15086
+ !!V && !ot && /* @__PURE__ */ c.jsxs("div", { className: "flex-shrink-0 bg-red-50 border border-red-200 text-red-800 px-4 py-2 text-sm flex items-center justify-between", children: [
15091
15087
  /* @__PURE__ */ c.jsx("span", { children: V }),
15092
15088
  /* @__PURE__ */ c.jsx(
15093
15089
  Ve,
@@ -15862,20 +15858,14 @@ function Qc({
15862
15858
  currentThreadId: h,
15863
15859
  isLoading: p,
15864
15860
  actions: y
15865
- } = ba(), { loadThread: w } = Sa(), { createThread: x, deleteThread: v, renameThread: b } = y;
15866
- f && f.length > 0 && console.log("[ThreadManager] useThreads() returned ctxThreads.length:", f.length);
15867
- const [S, T] = ye(Array.isArray(f) ? f : []), C = We(S.length > 0), [k, R] = ye(null), [E, A] = ye(""), [O, L] = ye(!1);
15868
- ot(() => {
15861
+ } = ba(), { loadThread: w } = Sa(), { createThread: x, deleteThread: v, renameThread: b } = y, [S, T] = ye(Array.isArray(f) ? f : []), C = We(S.length > 0), [k, R] = ye(null), [E, A] = ye(""), [O, L] = ye(!1);
15862
+ st(() => {
15869
15863
  const _ = Array.isArray(f) ? f : [];
15870
15864
  if (_.length > 0) {
15871
- console.log("[ThreadManager] useEffect sync - setting threads from context, length:", _.length), C.current = !0, T(_);
15872
- return;
15873
- }
15874
- if (p) {
15875
- console.log("[ThreadManager] useEffect - context empty but loading, keeping previous");
15865
+ C.current = !0, T(_);
15876
15866
  return;
15877
15867
  }
15878
- C.current = !1, T(_);
15868
+ p || (C.current = !1, T(_));
15879
15869
  }, [f, p]);
15880
15870
  const F = async (_) => {
15881
15871
  try {
@@ -15922,7 +15912,7 @@ function Qc({
15922
15912
  return "";
15923
15913
  }
15924
15914
  }, X = (_) => _.title || `Thread ${_.threadId.slice(0, 8)}`;
15925
- return S.length > 0 ? console.log("[ThreadManager] Rendering with threads.length:", S.length, "isLoadingThreads:", p) : console.log("[ThreadManager] Rendering with NO threads - isLoadingThreads:", p), /* @__PURE__ */ c.jsxs("div", { className: `flex flex-col h-full ${e} ${s.container || ""}`, children: [
15915
+ return /* @__PURE__ */ c.jsxs("div", { className: `flex flex-col h-full ${e} ${s.container || ""}`, children: [
15926
15916
  t && /* @__PURE__ */ c.jsx("div", { className: s.header || "flex-shrink-0 p-2 border-b bg-slate-800 border-slate-700 text-slate-100 flex justify-end", children: /* @__PURE__ */ c.jsx(
15927
15917
  Ve,
15928
15918
  {
@@ -15946,44 +15936,47 @@ function Qc({
15946
15936
  ] }) : S.length === 0 ? /* @__PURE__ */ c.jsxs("div", { className: "text-center py-8 text-slate-400", children: [
15947
15937
  /* @__PURE__ */ c.jsx(Pm, { className: "w-8 h-8 mx-auto mb-2 opacity-40 text-slate-500" }),
15948
15938
  /* @__PURE__ */ c.jsx("p", { className: "text-sm text-slate-500", children: "No conversations yet" })
15949
- ] }) : S.slice().sort((_, G) => new Date(G.updatedAt || G.createdAt || "").getTime() - new Date(_.updatedAt || _.createdAt || "").getTime()).map((_) => /* @__PURE__ */ c.jsxs(
15950
- "div",
15951
- {
15952
- onClick: () => F(_.threadId),
15953
- className: `group relative p-3 rounded-lg cursor-pointer transition-colors border ${(i ?? h) === _.threadId ? `${s.activeThread || "bg-slate-600 border-slate-500"} ` : `${s.threadItem || "bg-slate-700 border-slate-600 hover:bg-slate-600 text-gray-900 dark:text-slate-100"}`} ${s.threadItem || ""} text-gray-900 dark:text-slate-100`,
15954
- children: [
15955
- /* @__PURE__ */ c.jsxs("div", { className: "flex items-center justify-between", children: [
15956
- /* @__PURE__ */ c.jsx("div", { className: "flex-1 min-w-0", children: k === _.threadId ? /* @__PURE__ */ c.jsxs("div", { className: "flex items-center gap-2", onClick: (G) => G.stopPropagation(), children: [
15957
- /* @__PURE__ */ c.jsx(ps, { value: E, onChange: (G) => A(G.target.value), onKeyDown: (G) => M(G, _.threadId), className: "h-6 text-sm", autoFocus: !0 }),
15958
- /* @__PURE__ */ c.jsx(Ve, { variant: "ghost", size: "sm", onClick: () => z(_.threadId), className: "h-6 w-6 p-0", children: /* @__PURE__ */ c.jsx(ha, { size: 12 }) }),
15959
- /* @__PURE__ */ c.jsx(Ve, { variant: "ghost", size: "sm", onClick: H, className: "h-6 w-6 p-0", children: /* @__PURE__ */ c.jsx(Cr, { size: 12 }) })
15960
- ] }) : /* @__PURE__ */ c.jsxs(c.Fragment, { children: [
15961
- /* @__PURE__ */ c.jsx("div", { className: "font-medium text-sm truncate text-gray-900 dark:text-slate-100", children: X(_) }),
15962
- /* @__PURE__ */ c.jsxs("div", { className: "flex items-center gap-2 text-xs text-gray-500 dark:text-slate-400 mt-1", children: [
15963
- /* @__PURE__ */ c.jsx(Om, { size: 10 }),
15964
- /* @__PURE__ */ c.jsx("span", { children: D(_.updatedAt || _.createdAt) })
15939
+ ] }) : /* @__PURE__ */ c.jsxs(c.Fragment, { children: [
15940
+ S.length > 0 && console.log("[ThreadManager] About to render", S.length, "threads"),
15941
+ S.slice().sort((_, G) => new Date(G.updatedAt || G.createdAt || "").getTime() - new Date(_.updatedAt || _.createdAt || "").getTime()).map((_) => /* @__PURE__ */ c.jsxs(
15942
+ "div",
15943
+ {
15944
+ onClick: () => F(_.threadId),
15945
+ className: `group relative p-3 rounded-lg cursor-pointer transition-colors border ${(i ?? h) === _.threadId ? `${s.activeThread || "bg-slate-600 border-slate-500"} ` : `${s.threadItem || "bg-slate-700 border-slate-600 hover:bg-slate-600 text-gray-900 dark:text-slate-100"}`} ${s.threadItem || ""} text-gray-900 dark:text-slate-100`,
15946
+ children: [
15947
+ /* @__PURE__ */ c.jsxs("div", { className: "flex items-center justify-between", children: [
15948
+ /* @__PURE__ */ c.jsx("div", { className: "flex-1 min-w-0", children: k === _.threadId ? /* @__PURE__ */ c.jsxs("div", { className: "flex items-center gap-2", onClick: (G) => G.stopPropagation(), children: [
15949
+ /* @__PURE__ */ c.jsx(ps, { value: E, onChange: (G) => A(G.target.value), onKeyDown: (G) => M(G, _.threadId), className: "h-6 text-sm", autoFocus: !0 }),
15950
+ /* @__PURE__ */ c.jsx(Ve, { variant: "ghost", size: "sm", onClick: () => z(_.threadId), className: "h-6 w-6 p-0", children: /* @__PURE__ */ c.jsx(ha, { size: 12 }) }),
15951
+ /* @__PURE__ */ c.jsx(Ve, { variant: "ghost", size: "sm", onClick: H, className: "h-6 w-6 p-0", children: /* @__PURE__ */ c.jsx(Cr, { size: 12 }) })
15952
+ ] }) : /* @__PURE__ */ c.jsxs(c.Fragment, { children: [
15953
+ /* @__PURE__ */ c.jsx("div", { className: "font-medium text-sm truncate text-gray-900 dark:text-slate-100", children: X(_) }),
15954
+ /* @__PURE__ */ c.jsxs("div", { className: "flex items-center gap-2 text-xs text-gray-500 dark:text-slate-400 mt-1", children: [
15955
+ /* @__PURE__ */ c.jsx(Om, { size: 10 }),
15956
+ /* @__PURE__ */ c.jsx("span", { children: D(_.updatedAt || _.createdAt) })
15957
+ ] })
15958
+ ] }) }),
15959
+ /* @__PURE__ */ c.jsxs("div", { className: "flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity ml-2", children: [
15960
+ r && k !== _.threadId && /* @__PURE__ */ c.jsx(Ve, { variant: "ghost", size: "sm", onClick: (G) => B(_, G), className: "h-6 w-6 p-0", title: "Edit title", children: /* @__PURE__ */ c.jsx(su, { size: 12 }) }),
15961
+ n && /* @__PURE__ */ c.jsx(
15962
+ Ve,
15963
+ {
15964
+ variant: "ghost",
15965
+ size: "sm",
15966
+ onClick: (G) => N(_.threadId, G),
15967
+ className: "h-6 w-6 p-0 text-red-400 hover:text-red-300 hover:bg-red-900/20",
15968
+ title: "Delete thread",
15969
+ children: /* @__PURE__ */ c.jsx(Mm, { size: 12 })
15970
+ }
15971
+ )
15965
15972
  ] })
15966
- ] }) }),
15967
- /* @__PURE__ */ c.jsxs("div", { className: "flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity ml-2", children: [
15968
- r && k !== _.threadId && /* @__PURE__ */ c.jsx(Ve, { variant: "ghost", size: "sm", onClick: (G) => B(_, G), className: "h-6 w-6 p-0", title: "Edit title", children: /* @__PURE__ */ c.jsx(su, { size: 12 }) }),
15969
- n && /* @__PURE__ */ c.jsx(
15970
- Ve,
15971
- {
15972
- variant: "ghost",
15973
- size: "sm",
15974
- onClick: (G) => N(_.threadId, G),
15975
- className: "h-6 w-6 p-0 text-red-400 hover:text-red-300 hover:bg-red-900/20",
15976
- title: "Delete thread",
15977
- children: /* @__PURE__ */ c.jsx(Mm, { size: 12 })
15978
- }
15979
- )
15980
- ] })
15981
- ] }),
15982
- i === _.threadId && /* @__PURE__ */ c.jsx("div", { className: "absolute left-0 top-1/2 -translate-y-1/2 w-1 h-8 bg-blue-400 rounded-r" })
15983
- ]
15984
- },
15985
- _.threadId
15986
- )) })
15973
+ ] }),
15974
+ i === _.threadId && /* @__PURE__ */ c.jsx("div", { className: "absolute left-0 top-1/2 -translate-y-1/2 w-1 h-8 bg-blue-400 rounded-r" })
15975
+ ]
15976
+ },
15977
+ _.threadId
15978
+ ))
15979
+ ] }) })
15987
15980
  }
15988
15981
  )
15989
15982
  ] });
@@ -17322,10 +17315,10 @@ const Qk = {
17322
17315
  };
17323
17316
  function DT({ settings: e, onSettingsChange: t, className: n = "" }) {
17324
17317
  const [r, o] = ye(!1), [s, i] = ye(!1), [a, l] = ye(e), [u, d] = ye(!1), { toast: f } = Ba();
17325
- ot(() => {
17318
+ st(() => {
17326
17319
  const x = JSON.stringify(a) !== JSON.stringify(e);
17327
17320
  d(x);
17328
- }, [a, e]), ot(() => {
17321
+ }, [a, e]), st(() => {
17329
17322
  l(e);
17330
17323
  }, [e]);
17331
17324
  const h = () => {