teodor-new-chat-ui 4.1.10 → 4.1.12

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 Ip = Object.defineProperty;
2
2
  var Np = (e, t, n) => t in e ? Ip(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
3
  var Ba = (e, t, n) => Np(e, typeof t != "symbol" ? t + "" : t, n);
4
4
  import * as m from "react";
5
- import z, { createContext as Gr, useContext as es, useReducer as Ap, useRef as ut, useCallback as Ue, useEffect as gt, useMemo as pt, useState as pe, createElement as bo, useLayoutEffect as jp } from "react";
5
+ import z, { createContext as Gr, useContext as es, useReducer as Ap, useRef as ut, useCallback as We, useEffect as gt, useMemo as pt, useState as he, createElement as bo, useLayoutEffect as jp } from "react";
6
6
  import { Square as _p, Send as Pp, X as lr, ExternalLink as Op, Download as Mp, Image as Dp, FileText as Ha, Loader as Cc, Bot as Ua, Wrench as Lp, User as Fp, ChevronUp as Nr, ChevronDown as ar, Paperclip as ui, Copy as Wa, Edit as Va, RotateCcw as di, ChevronRight as $p, Check as Wi, Circle as zp, Loader2 as fi, Edit3 as Tc, Plus as Bp, FileSpreadsheet as Hp, MessageSquarePlus as Up, MessageSquare as Wp, Calendar as Vp, Trash2 as Kp, Settings as qp, Server as Gp, EyeOff as Yp, Eye as Xp, Layout as Jp, MessageCircle as Zp, Save as Qp } from "lucide-react";
7
7
  import { Slot as em, createSlot as hr } from "@radix-ui/react-slot";
8
8
  import { cva as ts } from "class-variance-authority";
@@ -163,7 +163,7 @@ function om() {
163
163
  V++;
164
164
  }
165
165
  }
166
- function fe() {
166
+ function ge() {
167
167
  {
168
168
  if (V--, V === 0) {
169
169
  var T = {
@@ -283,7 +283,7 @@ function om() {
283
283
  }
284
284
  }
285
285
  } finally {
286
- G = !1, ye.current = Xe, fe(), Error.prepareStackTrace = Ke;
286
+ G = !1, ye.current = Xe, ge(), Error.prepareStackTrace = Ke;
287
287
  }
288
288
  var rr = T ? T.displayName || T.name : "", Mn = rr ? P(rr) : "";
289
289
  return typeof T == "function" && Z.set(T, Mn), Mn;
@@ -361,7 +361,7 @@ function om() {
361
361
  return ee;
362
362
  }
363
363
  }
364
- function he(T) {
364
+ function fe(T) {
365
365
  try {
366
366
  return Se(T), !1;
367
367
  } catch {
@@ -372,7 +372,7 @@ function om() {
372
372
  return "" + T;
373
373
  }
374
374
  function ve(T) {
375
- if (he(T))
375
+ if (fe(T))
376
376
  return b("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", ae(T)), Se(T);
377
377
  }
378
378
  var Ne = x.ReactCurrentOwner, et = {
@@ -381,7 +381,7 @@ function om() {
381
381
  __self: !0,
382
382
  __source: !0
383
383
  }, Ve, F;
384
- function J(T) {
384
+ function X(T) {
385
385
  if (Ee.call(T, "ref")) {
386
386
  var H = Object.getOwnPropertyDescriptor(T, "ref").get;
387
387
  if (H && H.isReactWarning)
@@ -454,7 +454,7 @@ function om() {
454
454
  function tr(T, H, ee, Te, Ke) {
455
455
  {
456
456
  var Xe, Be = {}, Le = null, Ct = null;
457
- ee !== void 0 && (ve(ee), Le = "" + ee), Ce(H) && (ve(H.key), Le = "" + H.key), J(H) && (Ct = H.ref, Oe(H, Ke));
457
+ ee !== void 0 && (ve(ee), Le = "" + ee), Ce(H) && (ve(H.key), Le = "" + H.key), X(H) && (Ct = H.ref, Oe(H, Ke));
458
458
  for (Xe in H)
459
459
  Ee.call(H, Xe) && !et.hasOwnProperty(Xe) && (Be[Xe] = H[Xe]);
460
460
  if (T && T.defaultProps) {
@@ -1904,8 +1904,8 @@ const Wc = (e) => {
1904
1904
  const k = d && (E === "stream" || E === "response");
1905
1905
  if (d && (S || k && _)) {
1906
1906
  const Y = {};
1907
- ["status", "statusText", "headers"].forEach((fe) => {
1908
- Y[fe] = L[fe];
1907
+ ["status", "statusText", "headers"].forEach((ge) => {
1908
+ Y[ge] = L[ge];
1909
1909
  });
1910
1910
  const ue = A.toFiniteNumber(L.headers.get("content-length")), [re, de] = S && Qa(
1911
1911
  ue,
@@ -2677,13 +2677,13 @@ function Wg(e, t) {
2677
2677
  }
2678
2678
  }
2679
2679
  function Vg(e = []) {
2680
- const [t, n] = Ap(Wg, { ...Ug, messages: e }), r = ut([]), o = ut(null), s = ut(null), i = Ue(() => {
2680
+ const [t, n] = Ap(Wg, { ...Ug, messages: e }), r = ut([]), o = ut(null), s = ut(null), i = We(() => {
2681
2681
  o.current !== null && typeof window < "u" && window.cancelAnimationFrame(o.current), s.current !== null && clearTimeout(s.current), o.current = null, s.current = null;
2682
2682
  const d = r.current;
2683
2683
  d.length && (r.current = [], n({ type: "batch", payload: { events: d } }));
2684
- }, []), a = Ue(() => {
2684
+ }, []), a = We(() => {
2685
2685
  typeof window < "u" && typeof window.requestAnimationFrame == "function" ? o.current === null && (o.current = window.requestAnimationFrame(() => i())) : s.current === null && (s.current = setTimeout(i, 8));
2686
- }, [i]), l = Ue((d) => {
2686
+ }, [i]), l = We((d) => {
2687
2687
  r.current.push(d), a();
2688
2688
  }, [a]);
2689
2689
  gt(() => () => {
@@ -2896,14 +2896,14 @@ function Jg(e) {
2896
2896
  return t[t.length - 1] || null;
2897
2897
  }
2898
2898
  function Zg(e = {}) {
2899
- const t = pt(() => xn(e.baseUrl), [e.baseUrl]), n = e.streamPath ?? "/runs/stream", [r, o] = pe(e.token ?? null), s = ut(e.headers ?? {}), i = e.credentials ?? "include", [a, l] = pe(!1), [u, d] = pe(null), [f, h] = pe(""), [p, w] = pe(null), [v, g] = pe(0), [x, b] = pe(!1), y = ut(null), R = ut(!0), S = ut(0), C = Ue((N) => {
2899
+ const t = pt(() => xn(e.baseUrl), [e.baseUrl]), n = e.streamPath ?? "/runs/stream", [r, o] = he(e.token ?? null), s = ut(e.headers ?? {}), i = e.credentials ?? "include", [a, l] = he(!1), [u, d] = he(null), [f, h] = he(""), [p, w] = he(null), [v, g] = he(0), [x, b] = he(!1), y = ut(null), R = ut(!0), S = ut(0), C = We((N) => {
2900
2900
  o(N);
2901
- }, []), E = Ue(() => {
2901
+ }, []), E = We(() => {
2902
2902
  var N;
2903
2903
  (N = y.current) == null || N.abort(), y.current = null, l(!1), b(!1), S.current = 0, g(0);
2904
- }, []), I = Ue(() => {
2904
+ }, []), I = We(() => {
2905
2905
  h(""), w(null), d(null);
2906
- }, []), j = Ue(
2906
+ }, []), j = We(
2907
2907
  (N, O, M) => {
2908
2908
  y.current && (y.current.abort(), y.current = null), l(!0), d(null), e.autoAppendAssistant !== !1 && h("");
2909
2909
  const D = new AbortController();
@@ -2912,11 +2912,11 @@ function Zg(e = {}) {
2912
2912
  const _ = (re) => {
2913
2913
  var de;
2914
2914
  try {
2915
- const fe = JSON.parse(JSON.stringify(re));
2916
- return (de = fe == null ? void 0 : fe.payload) != null && de.files_info && Array.isArray(fe.payload.files_info) && (fe.payload.files_info = fe.payload.files_info.map((ye) => ({
2915
+ const ge = JSON.parse(JSON.stringify(re));
2916
+ return (de = ge == null ? void 0 : ge.payload) != null && de.files_info && Array.isArray(ge.payload.files_info) && (ge.payload.files_info = ge.payload.files_info.map((ye) => ({
2917
2917
  ...ye,
2918
2918
  data: ye != null && ye.data ? `<base64 ${String(ye.data).length} chars>` : ye == null ? void 0 : ye.data
2919
- }))), fe;
2919
+ }))), ge;
2920
2920
  } catch {
2921
2921
  return re;
2922
2922
  }
@@ -2967,7 +2967,7 @@ function Zg(e = {}) {
2967
2967
  );
2968
2968
  }
2969
2969
  b(!0);
2970
- const fe = de.body.getReader(), ye = new TextDecoder();
2970
+ const ge = de.body.getReader(), ye = new TextDecoder();
2971
2971
  let B = "", P = [];
2972
2972
  S.current = 0, g(0);
2973
2973
  let G = 0, Z = null;
@@ -2991,7 +2991,7 @@ function Zg(e = {}) {
2991
2991
  try {
2992
2992
  const Ee = de.headers.get("X-Thread-Id") || de.headers.get("x-thread-id"), _e = de.headers.get("X-Thread-Created") || de.headers.get("x-thread-created"), Qe = Ee ?? null, je = String(_e ?? "").toLowerCase() === "true";
2993
2993
  for ((L = M == null ? void 0 : M.onOpen) == null || L.call(M, { threadId: Qe, created: je }); ; ) {
2994
- const { value: st, done: at } = await fe.read();
2994
+ const { value: st, done: at } = await ge.read();
2995
2995
  if (at) break;
2996
2996
  B += ye.decode(st, { stream: !0 }), B.length > Ye && (B = "", console.warn("Stream buffer reset: exceeded 1MB"));
2997
2997
  let Q;
@@ -3000,13 +3000,13 @@ function Zg(e = {}) {
3000
3000
  `)) >= 0; ) {
3001
3001
  const ae = B.slice(0, Q);
3002
3002
  B = B.slice(Q + 2);
3003
- const he = ex(ae);
3004
- if (!he) continue;
3003
+ const fe = ex(ae);
3004
+ if (!fe) continue;
3005
3005
  let Se;
3006
3006
  try {
3007
- Se = JSON.parse(he);
3007
+ Se = JSON.parse(fe);
3008
3008
  } catch {
3009
- console.debug("[use-chat] malformed SSE:", he.slice(0, 200));
3009
+ console.debug("[use-chat] malformed SSE:", fe.slice(0, 200));
3010
3010
  continue;
3011
3011
  }
3012
3012
  const ve = Qg(Se) ? Se.data : Se;
@@ -3035,10 +3035,10 @@ function Zg(e = {}) {
3035
3035
  }
3036
3036
  } finally {
3037
3037
  try {
3038
- await fe.cancel();
3038
+ await ge.cancel();
3039
3039
  } catch {
3040
3040
  } finally {
3041
- (Y = fe.releaseLock) == null || Y.call(fe);
3041
+ (Y = ge.releaseLock) == null || Y.call(ge);
3042
3042
  }
3043
3043
  Z !== null && typeof window < "u" && window.cancelAnimationFrame(Z), clearInterval(Ge), l(!1), b(!1), y.current = null, S.current = 0, g(0);
3044
3044
  }
@@ -3090,7 +3090,7 @@ function tx({
3090
3090
  onUnhandledEvent: r,
3091
3091
  onSequenceGap: o
3092
3092
  }) {
3093
- const s = ut(null), i = Ue(
3093
+ const s = ut(null), i = We(
3094
3094
  (p) => {
3095
3095
  const w = p.seq ?? null;
3096
3096
  if (w !== null) {
@@ -3103,7 +3103,7 @@ function tx({
3103
3103
  s.current = w;
3104
3104
  }
3105
3105
  if (p.type === "thread_info") {
3106
- t(p);
3106
+ console.log("[useChatStreamingService] 🎯 Received thread_info event:", p), t(p);
3107
3107
  return;
3108
3108
  }
3109
3109
  if (Hg(p)) {
@@ -3116,7 +3116,7 @@ function tx({
3116
3116
  ), { stream: a, stop: l, isStreaming: u, error: d, setToken: f } = Zg({
3117
3117
  baseUrl: e,
3118
3118
  token: null
3119
- }), h = Ue(
3119
+ }), h = We(
3120
3120
  (p, w) => {
3121
3121
  s.current = null, a(
3122
3122
  p,
@@ -3155,7 +3155,7 @@ function ox({
3155
3155
  onError: i,
3156
3156
  onThreadChange: a
3157
3157
  }) {
3158
- const { api: l, baseUrl: u } = Jc(), d = pt(() => xn(u), [u]), [f, h] = pe([]), [p, w] = pe(t), [v, g] = pe(!1), [x, b] = pe(!1), [y, R] = pe(!1), [S, C] = pe(!1), [E, I] = pe(null), [j, N] = pe(void 0), [O, M] = pe(void 0), {
3158
+ const { api: l, baseUrl: u } = Jc(), d = pt(() => xn(u), [u]), [f, h] = he([]), [p, w] = he(t), [v, g] = he(!1), [x, b] = he(!1), [y, R] = he(!1), [S, C] = he(!1), [E, I] = he(null), [j, N] = he(void 0), [O, M] = he(void 0), {
3159
3159
  state: D,
3160
3160
  seed: _,
3161
3161
  prepend: V,
@@ -3166,7 +3166,7 @@ function ox({
3166
3166
  gt(() => {
3167
3167
  k.current = p;
3168
3168
  }, [p]);
3169
- const W = ut(!1), Y = ut([]), ue = ut(null), re = ut(null), de = Ue((F, J) => new Promise((Ce, Oe) => {
3169
+ const W = ut(!1), Y = ut([]), ue = ut(null), re = ut(null), de = We((F, X) => new Promise((Ce, Oe) => {
3170
3170
  const De = async () => {
3171
3171
  W.current = !0;
3172
3172
  try {
@@ -3183,7 +3183,7 @@ function ox({
3183
3183
  W.current ? Y.current.push(De) : De().catch((it) => {
3184
3184
  Oe(it);
3185
3185
  });
3186
- }), []), fe = Ue(async () => {
3186
+ }), []), ge = We(async () => {
3187
3187
  g(!0);
3188
3188
  try {
3189
3189
  const F = await l.listThreads();
@@ -3193,46 +3193,45 @@ function ox({
3193
3193
  } finally {
3194
3194
  g(!1);
3195
3195
  }
3196
- }, [l, i]);
3197
- Ue(async () => {
3198
- try {
3199
- await fe();
3200
- } catch (F) {
3201
- console.error("[ChatSessionProvider] Failed to refresh threads after stream:", F);
3202
- }
3203
- }, [fe]);
3204
- const ye = ut(!1), B = Ue(
3205
- (F, J) => {
3196
+ }, [l, i]), ye = ut(!1), B = We(
3197
+ (F, X) => {
3206
3198
  const Ce = Array.isArray(F == null ? void 0 : F.messages) ? F.messages : [];
3207
- J === "replace" ? _(Ce, {
3199
+ X === "replace" ? _(Ce, {
3208
3200
  checkpointId: (F == null ? void 0 : F.checkpointId) ?? null,
3209
3201
  checkpointNs: (F == null ? void 0 : F.checkpointNs) ?? null
3210
- }) : J === "prepend" && Ce.length && V(Ce), I((F == null ? void 0 : F.nextCursor) ?? null), R(!!(F != null && F.hasMore)), N((Oe) => (F == null ? void 0 : F.checkpointId) ?? Oe ?? void 0), M((Oe) => (F == null ? void 0 : F.checkpointNs) ?? Oe ?? void 0);
3202
+ }) : X === "prepend" && Ce.length && V(Ce), I((F == null ? void 0 : F.nextCursor) ?? null), R(!!(F != null && F.hasMore)), N((Oe) => (F == null ? void 0 : F.checkpointId) ?? Oe ?? void 0), M((Oe) => (F == null ? void 0 : F.checkpointNs) ?? Oe ?? void 0);
3211
3203
  },
3212
3204
  [V, _]
3213
- ), P = Ue(() => {
3205
+ ), P = We(() => {
3214
3206
  L([]), R(!1), C(!1), I(null), N(void 0), M(void 0);
3215
- }, [L]), G = Ue(({ from: F, to: J }) => {
3207
+ }, [L]), G = We(({ from: F, to: X }) => {
3216
3208
  const Ce = k.current;
3217
3209
  Ce && console.warn(
3218
- `[ChatSessionProvider] Stream sequence gap detected (${F} -> ${J}) for thread ${Ce}`
3210
+ `[ChatSessionProvider] Stream sequence gap detected (${F} -> ${X}) for thread ${Ce}`
3219
3211
  );
3220
- }, []), Z = Ue(
3212
+ }, []), Z = We(
3221
3213
  (F) => {
3222
- const J = F.threadId, Ce = {
3223
- threadId: J,
3224
- title: F.title || `Thread ${J.slice(0, 8)}`,
3214
+ const X = F.threadId;
3215
+ console.log("[ChatSessionProvider] 📥 Handling thread_info event:", {
3216
+ threadId: X,
3217
+ title: F.title,
3218
+ created: F.created,
3219
+ currentThreads: f.length
3220
+ });
3221
+ const Ce = {
3222
+ threadId: X,
3223
+ title: F.title || `Thread ${X.slice(0, 8)}`,
3225
3224
  createdAt: F.createdAt || (/* @__PURE__ */ new Date()).toISOString(),
3226
3225
  updatedAt: F.updatedAt || (/* @__PURE__ */ new Date()).toISOString(),
3227
3226
  messageCount: F.messageCount || 0
3228
3227
  };
3229
- k.current !== J && (!k.current && D.messages.length <= 1 && (re.current = J), w(J)), h((Oe) => {
3230
- const De = Oe.findIndex((it) => it.threadId === J);
3228
+ k.current !== X && (!k.current && D.messages.length <= 1 && (re.current = X), w(X)), h((Oe) => {
3229
+ const De = Oe.findIndex((it) => it.threadId === X);
3231
3230
  if (De >= 0) {
3232
3231
  const it = [...Oe];
3233
- return it[De] = Ce, it;
3232
+ return it[De] = Ce, console.log("[ChatSessionProvider] ✏️ Updated existing thread at index:", De), it;
3234
3233
  } else
3235
- return [Ce, ...Oe];
3234
+ return console.log("[ChatSessionProvider] ➕ Added new thread to list"), [Ce, ...Oe];
3236
3235
  });
3237
3236
  },
3238
3237
  [D.messages.length]
@@ -3251,49 +3250,49 @@ function ox({
3251
3250
  var Ce;
3252
3251
  const F = l.getAuthToken();
3253
3252
  Ye(F);
3254
- const J = (Ce = l.onTokenChange) == null ? void 0 : Ce.call(l, (Oe) => {
3253
+ const X = (Ce = l.onTokenChange) == null ? void 0 : Ce.call(l, (Oe) => {
3255
3254
  Ye(Oe);
3256
3255
  });
3257
3256
  return () => {
3258
- J == null || J();
3257
+ X == null || X();
3259
3258
  };
3260
3259
  }, [l, Ye]);
3261
- const Ee = Ue(
3260
+ const Ee = We(
3262
3261
  async (F) => {
3263
- const J = `temp-${Date.now()}`, Ce = {
3264
- threadId: J,
3262
+ const X = `temp-${Date.now()}`, Ce = {
3263
+ threadId: X,
3265
3264
  title: F || "New Chat",
3266
3265
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
3267
3266
  updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
3268
3267
  messageCount: 0
3269
3268
  };
3270
- h((Oe) => [Ce, ...Oe]), w(J);
3269
+ h((Oe) => [Ce, ...Oe]), w(X);
3271
3270
  try {
3272
3271
  const Oe = await l.createThread(F), De = typeof Oe == "string" ? Oe : Oe.threadId;
3273
3272
  return h((it) => it.map(
3274
- (At) => At.threadId === J ? { ...At, threadId: De } : At
3275
- )), w(De), setTimeout(() => fe(), 10), De;
3273
+ (At) => At.threadId === X ? { ...At, threadId: De } : At
3274
+ )), w(De), setTimeout(() => ge(), 10), De;
3276
3275
  } catch (Oe) {
3277
- throw h((De) => De.filter((it) => it.threadId !== J)), w(null), Oe;
3276
+ throw h((De) => De.filter((it) => it.threadId !== X)), w(null), Oe;
3278
3277
  }
3279
3278
  },
3280
- [l, fe]
3281
- ), _e = Ue(
3279
+ [l, ge]
3280
+ ), _e = We(
3282
3281
  async (F) => {
3283
- await l.deleteThread(F), k.current === F && (re.current = F, w(null), P()), await fe();
3282
+ await l.deleteThread(F), k.current === F && (re.current = F, w(null), P()), await ge();
3284
3283
  },
3285
- [l, P, fe]
3286
- ), Qe = Ue(
3287
- async (F, J) => {
3284
+ [l, P, ge]
3285
+ ), Qe = We(
3286
+ async (F, X) => {
3288
3287
  try {
3289
- await l.updateThread(F, J), h((Ce) => Ce.map((Oe) => Oe.threadId === F ? { ...Oe, title: J } : Oe));
3288
+ await l.updateThread(F, X), h((Ce) => Ce.map((Oe) => Oe.threadId === F ? { ...Oe, title: X } : Oe));
3290
3289
  } catch (Ce) {
3291
- throw await fe(), Ce;
3290
+ throw await ge(), Ce;
3292
3291
  }
3293
3292
  },
3294
- [l, fe]
3295
- ), je = Ue(
3296
- async (F, J, Ce, Oe = !1) => {
3293
+ [l, ge]
3294
+ ), je = We(
3295
+ async (F, X, Ce, Oe = !1) => {
3297
3296
  await de(async () => {
3298
3297
  if (re.current === F && !Oe) {
3299
3298
  re.current = null;
@@ -3304,7 +3303,7 @@ function ox({
3304
3303
  try {
3305
3304
  const De = await l.getMessages({
3306
3305
  threadId: F,
3307
- checkpointId: J,
3306
+ checkpointId: X,
3308
3307
  checkpointNs: Ce
3309
3308
  });
3310
3309
  B(De, "replace"), N((De == null ? void 0 : De.checkpointId) ?? void 0), M((De == null ? void 0 : De.checkpointNs) ?? void 0);
@@ -3317,7 +3316,7 @@ function ox({
3317
3316
  }, `loadThread-${F}`);
3318
3317
  },
3319
3318
  [l, B, de, i]
3320
- ), st = Ue(async () => {
3319
+ ), st = We(async () => {
3321
3320
  await de(async () => {
3322
3321
  k.current && (re.current = k.current), w(null), P(), N(void 0), M(void 0);
3323
3322
  try {
@@ -3326,27 +3325,27 @@ function ox({
3326
3325
  console.warn("[ChatSessionProvider] Failed to clear lastThreadId:", F);
3327
3326
  }
3328
3327
  }, "clearCurrentThread");
3329
- }, [P, de]), at = Ue(
3328
+ }, [P, de]), at = We(
3330
3329
  async (F) => {
3331
- const J = await l.listCheckpoints(F);
3332
- return $g(J, F);
3330
+ const X = await l.listCheckpoints(F);
3331
+ return $g(X, F);
3333
3332
  },
3334
3333
  [l]
3335
- ), Q = Ue(
3336
- async (F, J) => {
3334
+ ), Q = We(
3335
+ async (F, X) => {
3337
3336
  if (!k.current) throw new Error("No active thread");
3338
- await je(k.current, F, J ?? void 0, !0);
3337
+ await je(k.current, F, X ?? void 0, !0);
3339
3338
  },
3340
3339
  [je]
3341
- ), ae = Ue(async () => {
3340
+ ), ae = We(async () => {
3342
3341
  if (!k.current) throw new Error("No active thread");
3343
3342
  await je(k.current, void 0, void 0, !0);
3344
- }, [je]), he = Ue(
3343
+ }, [je]), fe = We(
3345
3344
  async (F) => {
3346
3345
  if (!k.current) throw new Error("No active thread");
3347
3346
  if (S || !y) return;
3348
- const J = E;
3349
- if (J) {
3347
+ const X = E;
3348
+ if (X) {
3350
3349
  C(!0);
3351
3350
  try {
3352
3351
  const Ce = await l.getMessages({
@@ -3354,7 +3353,7 @@ function ox({
3354
3353
  checkpointId: j,
3355
3354
  checkpointNs: O,
3356
3355
  limit: (F == null ? void 0 : F.limit) ?? rx,
3357
- beforeId: J
3356
+ beforeId: X
3358
3357
  });
3359
3358
  B(Ce, "prepend");
3360
3359
  } finally {
@@ -3371,12 +3370,12 @@ function ox({
3371
3370
  E,
3372
3371
  S
3373
3372
  ]
3374
- ), Se = Ue(
3375
- async (F, J) => {
3373
+ ), Se = We(
3374
+ async (F, X) => {
3376
3375
  var bn;
3377
3376
  const Ce = k.current;
3378
- !Ce && !(J != null && J.payloadExtras) && console.warn("[ChatSessionProvider] No thread ID - message will create new thread");
3379
- const Oe = (J == null ? void 0 : J.attachments) || [], { contentParts: De, filesInfo: it } = await Bg(
3377
+ !Ce && !(X != null && X.payloadExtras) && console.warn("[ChatSessionProvider] No thread ID - message will create new thread");
3378
+ const Oe = (X == null ? void 0 : X.attachments) || [], { contentParts: De, filesInfo: it } = await Bg(
3380
3379
  l,
3381
3380
  Oe
3382
3381
  ), At = [...De];
@@ -3386,11 +3385,11 @@ function ox({
3386
3385
  role: "user",
3387
3386
  content: At,
3388
3387
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
3389
- checkpointId: (J == null ? void 0 : J.checkpointId) ?? D.lastCheckpointId ?? void 0,
3390
- checkpointNs: (J == null ? void 0 : J.checkpointNs) ?? D.lastCheckpointNs ?? void 0
3388
+ checkpointId: (X == null ? void 0 : X.checkpointId) ?? D.lastCheckpointId ?? void 0,
3389
+ checkpointNs: (X == null ? void 0 : X.checkpointNs) ?? D.lastCheckpointNs ?? void 0
3391
3390
  };
3392
3391
  U(tr);
3393
- const Pn = { ...tr, content: At }, nr = { ...(J == null ? void 0 : J.payloadExtras) ?? {} }, Qt = Oe.length > 0, On = {
3392
+ const Pn = { ...tr, content: At }, nr = { ...(X == null ? void 0 : X.payloadExtras) ?? {} }, Qt = Oe.length > 0, On = {
3394
3393
  ...Ce ? { threadId: Ce } : {},
3395
3394
  payload: {
3396
3395
  messages: [Pn],
@@ -3398,10 +3397,10 @@ function ox({
3398
3397
  ...o && Qt && s ? { active_agent: s } : {},
3399
3398
  ...nr
3400
3399
  },
3401
- checkpointId: (J == null ? void 0 : J.checkpointId) ?? D.lastCheckpointId ?? void 0,
3402
- checkpointNs: (J == null ? void 0 : J.checkpointNs) ?? D.lastCheckpointNs ?? void 0,
3403
- nodeFilter: J == null ? void 0 : J.nodeFilter,
3404
- config: J == null ? void 0 : J.config
3400
+ checkpointId: (X == null ? void 0 : X.checkpointId) ?? D.lastCheckpointId ?? void 0,
3401
+ checkpointNs: (X == null ? void 0 : X.checkpointNs) ?? D.lastCheckpointNs ?? void 0,
3402
+ nodeFilter: X == null ? void 0 : X.nodeFilter,
3403
+ config: X == null ? void 0 : X.config
3405
3404
  };
3406
3405
  le(On, {
3407
3406
  onError: (en) => {
@@ -3424,13 +3423,13 @@ function ox({
3424
3423
  U,
3425
3424
  le
3426
3425
  ]
3427
- ), ve = Ue(
3428
- async (F, J, Ce) => {
3426
+ ), ve = We(
3427
+ async (F, X, Ce) => {
3429
3428
  const Oe = k.current;
3430
3429
  if (!Oe)
3431
3430
  throw new Error("No active thread to handle interrupt");
3432
3431
  try {
3433
- const De = J ? Ce ?? !0 : !1;
3432
+ const De = X ? Ce ?? !0 : !1;
3434
3433
  await l.resume({ threadId: Oe, value: De });
3435
3434
  } catch (De) {
3436
3435
  throw console.error(`[ChatSessionProvider] Failed to handle interrupt ${F}:`, De), De;
@@ -3449,7 +3448,7 @@ function ox({
3449
3448
  let F = !0;
3450
3449
  return (async () => {
3451
3450
  try {
3452
- if (await fe(), !F) return;
3451
+ if (await ge(), !F) return;
3453
3452
  if (!r && !t)
3454
3453
  try {
3455
3454
  const Ce = localStorage.getItem("lastThreadId");
@@ -3475,7 +3474,7 @@ function ox({
3475
3474
  createThread: Ee,
3476
3475
  deleteThread: _e,
3477
3476
  renameThread: Qe,
3478
- refreshThreads: fe,
3477
+ refreshThreads: ge,
3479
3478
  loadThread: je,
3480
3479
  clearCurrentThread: st,
3481
3480
  listCheckpoints: at,
@@ -3492,7 +3491,7 @@ function ox({
3492
3491
  at,
3493
3492
  je,
3494
3493
  Q,
3495
- fe,
3494
+ ge,
3496
3495
  Qe,
3497
3496
  ae,
3498
3497
  f
@@ -3506,7 +3505,7 @@ function ox({
3506
3505
  isLoadingHistory: S,
3507
3506
  send: Se,
3508
3507
  stop: oe,
3509
- loadOlderMessages: he,
3508
+ loadOlderMessages: fe,
3510
3509
  clearMessages: P,
3511
3510
  handleInterrupt: ve
3512
3511
  }),
@@ -3515,7 +3514,7 @@ function ox({
3515
3514
  ve,
3516
3515
  y,
3517
3516
  S,
3518
- he,
3517
+ fe,
3519
3518
  D.assemblingId,
3520
3519
  D.messages,
3521
3520
  Se,
@@ -3582,7 +3581,7 @@ function Vs({
3582
3581
  }
3583
3582
  ) });
3584
3583
  }
3585
- function X(...e) {
3584
+ function J(...e) {
3586
3585
  return nm(tm(e));
3587
3586
  }
3588
3587
  const ix = ts(
@@ -3615,7 +3614,7 @@ const ix = ts(
3615
3614
  return /* @__PURE__ */ c.jsx(
3616
3615
  i,
3617
3616
  {
3618
- className: X(ix({ variant: t, size: n, className: e })),
3617
+ className: J(ix({ variant: t, size: n, className: e })),
3619
3618
  ref: s,
3620
3619
  ...o
3621
3620
  }
@@ -3627,7 +3626,7 @@ const nu = m.forwardRef(
3627
3626
  ({ className: e, ...t }, n) => /* @__PURE__ */ c.jsx(
3628
3627
  "textarea",
3629
3628
  {
3630
- className: X(
3629
+ className: J(
3631
3630
  "flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
3632
3631
  e
3633
3632
  ),
@@ -3923,7 +3922,7 @@ function ze() {
3923
3922
  function Mt(e) {
3924
3923
  return cs(ze(), (t) => ce(e, t));
3925
3924
  }
3926
- function We(e, t = [], { singleton: n } = { singleton: !0 }) {
3925
+ function Ue(e, t = [], { singleton: n } = { singleton: !0 }) {
3927
3926
  return {
3928
3927
  constructor: e,
3929
3928
  dependencies: t,
@@ -3980,7 +3979,7 @@ const xx = {
3980
3979
  3: "error",
3981
3980
  1: "log",
3982
3981
  2: "warn"
3983
- }, vx = () => typeof globalThis > "u" ? window : globalThis, Nn = We(
3982
+ }, vx = () => typeof globalThis > "u" ? window : globalThis, Nn = Ue(
3984
3983
  () => {
3985
3984
  const e = K(
3986
3985
  3
@@ -4108,7 +4107,7 @@ function iu(e, t, n) {
4108
4107
  }
4109
4108
  }, [a, t, i]), s;
4110
4109
  }
4111
- const Tt = We(
4110
+ const Tt = Ue(
4112
4111
  () => {
4113
4112
  const e = ze(), t = ze(), n = K(0), r = ze(), o = K(0), s = ze(), i = ze(), a = K(0), l = K(0), u = K(0), d = K(0), f = ze(), h = ze(), p = K(!1), w = K(!1), v = K(!1);
4114
4113
  return ce(
@@ -4289,7 +4288,7 @@ function fu(e, t) {
4289
4288
  function zr(e, t) {
4290
4289
  return !!(e && e[0] === t[0] && e[1] === t[1]);
4291
4290
  }
4292
- const Zi = We(
4291
+ const Zi = Ue(
4293
4292
  () => ({ recalcInProgress: K(!1) }),
4294
4293
  [],
4295
4294
  { singleton: !0 }
@@ -4456,7 +4455,7 @@ function jx(e) {
4456
4455
  const _x = {
4457
4456
  offsetHeight: "height",
4458
4457
  offsetWidth: "width"
4459
- }, dn = We(
4458
+ }, dn = Ue(
4460
4459
  ([{ log: e }, { recalcInProgress: t }]) => {
4461
4460
  const n = ze(), r = ze(), o = St(r, 0), s = ze(), i = ze(), a = K(0), l = K([]), u = K(void 0), d = K(void 0), f = K((S, C) => Cn(S, _x[C])), h = K(void 0), p = K(0), w = Cx(), v = St(
4462
4461
  $(n, Pe(l, e, p), sn(Ix, w), tt()),
@@ -4701,7 +4700,7 @@ function Px(e) {
4701
4700
  }
4702
4701
  );
4703
4702
  }
4704
- const gu = We(
4703
+ const gu = Ue(
4705
4704
  ([{ groupIndices: e, sizes: t, totalCount: n }, { headerHeight: r, scrollTop: o }]) => {
4706
4705
  const s = ze(), i = ze(), a = Mt($(s, te(Px)));
4707
4706
  return ce(
@@ -4728,7 +4727,7 @@ const gu = We(
4728
4727
  ), { groupCounts: s, topItemsIndexes: i };
4729
4728
  },
4730
4729
  nt(dn, Tt)
4731
- ), An = We(
4730
+ ), An = Ue(
4732
4731
  ([{ log: e }]) => {
4733
4732
  const t = K(!1), n = Mt(
4734
4733
  $(
@@ -4748,7 +4747,7 @@ function xu(e) {
4748
4747
  const t = typeof e == "number" ? { index: e } : e;
4749
4748
  return t.align || (t.align = "start"), (!t.behavior || !Ox) && (t.behavior = "auto"), t.offset || (t.offset = 0), t;
4750
4749
  }
4751
- const Qr = We(
4750
+ const Qr = Ue(
4752
4751
  ([
4753
4752
  { gap: e, listRefresh: t, sizes: n, totalCount: r },
4754
4753
  {
@@ -4830,7 +4829,7 @@ function ta(e, t) {
4830
4829
  const n = t - 1;
4831
4830
  return typeof e == "number" ? e : e.index === "LAST" ? n : e.index;
4832
4831
  }
4833
- const eo = We(
4832
+ const eo = Ue(
4834
4833
  ([{ defaultItemSize: e, listRefresh: t, sizes: n }, { scrollTop: r }, { scrollTargetReached: o, scrollToIndex: s }, { didMount: i }]) => {
4835
4834
  const a = K(!0), l = K(0), u = K(!0);
4836
4835
  return ce(
@@ -4886,7 +4885,7 @@ const Hr = "up", _r = "down", Dx = "none", Lx = {
4886
4885
  scrollTop: 0,
4887
4886
  viewportHeight: 0
4888
4887
  }
4889
- }, Fx = 0, to = We(([{ footerHeight: e, headerHeight: t, scrollBy: n, scrollContainerState: r, scrollTop: o, viewportHeight: s }]) => {
4888
+ }, Fx = 0, to = Ue(([{ footerHeight: e, headerHeight: t, scrollBy: n, scrollContainerState: r, scrollTop: o, viewportHeight: s }]) => {
4890
4889
  const i = K(!1), a = K(!0), l = ze(), u = ze(), d = K(4), f = K(Fx), h = St(
4891
4890
  $(
4892
4891
  bi($(we(o), Wn(1), rn(!0)), $(we(o), Wn(1), rn(!1), xl(100))),
@@ -5026,7 +5025,7 @@ function Cl(e, t) {
5026
5025
  var n;
5027
5026
  return typeof e == "number" ? e : (n = e[t]) != null ? n : 0;
5028
5027
  }
5029
- const na = We(
5028
+ const na = Ue(
5030
5029
  ([{ deviation: e, fixedHeaderHeight: t, headerHeight: n, scrollTop: r, viewportHeight: o }]) => {
5031
5030
  const s = ze(), i = K(0), a = K(0), l = K(0), u = St(
5032
5031
  $(
@@ -5164,7 +5163,7 @@ function Tl(e, t, n) {
5164
5163
  }
5165
5164
  return s;
5166
5165
  }
5167
- const Jn = We(
5166
+ const Jn = Ue(
5168
5167
  ([
5169
5168
  { data: e, firstItemIndex: t, gap: n, sizes: r, totalCount: o },
5170
5169
  s,
@@ -5226,10 +5225,10 @@ const Jn = We(
5226
5225
  );
5227
5226
  const W = [];
5228
5227
  if (M.length > 0) {
5229
- const fe = M[0], ye = M[M.length - 1];
5228
+ const ge = M[0], ye = M[M.length - 1];
5230
5229
  let B = 0;
5231
- for (const P of us(L, fe, ye)) {
5232
- const G = P.value, Z = Math.max(P.start, fe), le = Math.min(P.end, ye);
5230
+ for (const P of us(L, ge, ye)) {
5231
+ const G = P.value, Z = Math.max(P.start, ge), le = Math.min(P.end, ye);
5233
5232
  for (let oe = Z; oe <= le; oe++)
5234
5233
  W.push({ data: V == null ? void 0 : V[oe], index: oe, offset: B, size: G }), B += G;
5235
5234
  }
@@ -5239,7 +5238,7 @@ const Jn = We(
5239
5238
  const Y = M.length > 0 ? M[M.length - 1] + 1 : 0, ue = kx(q, C, E, Y);
5240
5239
  if (ue.length === 0)
5241
5240
  return null;
5242
- const re = I - 1, de = cs([], (fe) => {
5241
+ const re = I - 1, de = cs([], (ge) => {
5243
5242
  for (const ye of ue) {
5244
5243
  const B = ye.value;
5245
5244
  let P = B.offset, G = ye.start;
@@ -5252,7 +5251,7 @@ const Jn = We(
5252
5251
  G < Y && (P += (Y - G) * Z, G = Y);
5253
5252
  const le = Math.min(ye.end, re);
5254
5253
  for (let oe = G; oe <= le && !(P >= E); oe++)
5255
- fe.push({ data: V == null ? void 0 : V[oe], index: oe, offset: P, size: Z }), P += Z + _;
5254
+ ge.push({ data: V == null ? void 0 : V[oe], index: oe, offset: P, size: Z }), P += Z + _;
5256
5255
  }
5257
5256
  });
5258
5257
  return Ro(de, W, I, _, U, D);
@@ -5339,7 +5338,7 @@ const Jn = We(
5339
5338
  Zi
5340
5339
  ),
5341
5340
  { singleton: !0 }
5342
- ), bu = We(
5341
+ ), bu = Ue(
5343
5342
  ([{ fixedFooterHeight: e, fixedHeaderHeight: t, footerHeight: n, headerHeight: r }, { listState: o }]) => {
5344
5343
  const s = ze(), i = St(
5345
5344
  $(
@@ -5352,7 +5351,7 @@ const Jn = We(
5352
5351
  },
5353
5352
  nt(Tt, Jn),
5354
5353
  { singleton: !0 }
5355
- ), zx = We(
5354
+ ), zx = Ue(
5356
5355
  ([{ viewportHeight: e }, { totalListHeight: t }]) => {
5357
5356
  const n = K(!1), r = St(
5358
5357
  $(
@@ -5368,7 +5367,7 @@ const Jn = We(
5368
5367
  },
5369
5368
  nt(Tt, bu),
5370
5369
  { singleton: !0 }
5371
- ), yu = We(() => ({
5370
+ ), yu = Ue(() => ({
5372
5371
  context: K(null)
5373
5372
  })), Bx = ({
5374
5373
  itemBottom: e,
@@ -5376,7 +5375,7 @@ const Jn = We(
5376
5375
  locationParams: { align: n, behavior: r, ...o },
5377
5376
  viewportBottom: s,
5378
5377
  viewportTop: i
5379
- }) => t < i ? { ...o, align: n ?? "start", behavior: r } : e > s ? { ...o, align: n ?? "end", behavior: r } : null, Su = We(
5378
+ }) => t < i ? { ...o, align: n ?? "start", behavior: r } : e > s ? { ...o, align: n ?? "end", behavior: r } : null, Su = Ue(
5380
5379
  ([
5381
5380
  { gap: e, sizes: t, totalCount: n },
5382
5381
  { fixedFooterHeight: r, fixedHeaderHeight: o, headerHeight: s, scrollingInProgress: i, scrollTop: a, viewportHeight: l },
@@ -5420,7 +5419,7 @@ const Jn = We(
5420
5419
  function Rl(e) {
5421
5420
  return e ? e === "smooth" ? "smooth" : "auto" : !1;
5422
5421
  }
5423
- const Hx = (e, t) => typeof e == "function" ? Rl(e(t)) : t && Rl(e), Ux = We(
5422
+ const Hx = (e, t) => typeof e == "function" ? Rl(e(t)) : t && Rl(e), Ux = Ue(
5424
5423
  ([
5425
5424
  { listRefresh: e, totalCount: t, fixedItemSize: n, data: r },
5426
5425
  { atBottomState: o, isAtBottom: s },
@@ -5525,7 +5524,7 @@ const Hx = (e, t) => typeof e == "function" ? Rl(e(t)) : t && Rl(e), Ux = We(
5525
5524
  yu,
5526
5525
  Su
5527
5526
  )
5528
- ), Wx = We(
5527
+ ), Wx = Ue(
5529
5528
  ([{ data: e, firstItemIndex: t, gap: n, sizes: r }, { initialTopMostItemIndex: o }, { initialItemCount: s, listState: i }, { didMount: a }]) => (ce(
5530
5529
  $(
5531
5530
  a,
@@ -5538,7 +5537,7 @@ const Hx = (e, t) => typeof e == "function" ? Rl(e(t)) : t && Rl(e), Ux = We(
5538
5537
  ), {}),
5539
5538
  nt(dn, eo, Jn, An),
5540
5539
  { singleton: !0 }
5541
- ), Vx = We(
5540
+ ), Vx = Ue(
5542
5541
  ([{ didMount: e }, { scrollTo: t }, { listState: n }]) => {
5543
5542
  const r = K(0);
5544
5543
  return qe(
@@ -5568,7 +5567,7 @@ const Hx = (e, t) => typeof e == "function" ? Rl(e(t)) : t && Rl(e), Ux = We(
5568
5567
  },
5569
5568
  nt(An, Tt, Jn),
5570
5569
  { singleton: !0 }
5571
- ), Cu = We(
5570
+ ), Cu = Ue(
5572
5571
  ([{ scrollVelocity: e }]) => {
5573
5572
  const t = K(!1), n = ze(), r = K(!1);
5574
5573
  return ce(
@@ -5597,7 +5596,7 @@ const Hx = (e, t) => typeof e == "function" ? Rl(e(t)) : t && Rl(e), Ux = We(
5597
5596
  },
5598
5597
  nt(to),
5599
5598
  { singleton: !0 }
5600
- ), ra = We(([{ scrollContainerState: e, scrollTo: t }]) => {
5599
+ ), ra = Ue(([{ scrollContainerState: e, scrollTo: t }]) => {
5601
5600
  const n = ze(), r = ze(), o = ze(), s = K(!1), i = K(void 0);
5602
5601
  return ce(
5603
5602
  $(
@@ -5629,7 +5628,7 @@ const Hx = (e, t) => typeof e == "function" ? Rl(e(t)) : t && Rl(e), Ux = We(
5629
5628
  windowScrollTo: o,
5630
5629
  windowViewportRect: r
5631
5630
  };
5632
- }, nt(Tt)), Kx = We(
5631
+ }, nt(Tt)), Kx = Ue(
5633
5632
  ([
5634
5633
  { sizeRanges: e, sizes: t },
5635
5634
  { headerHeight: n, scrollTop: r },
@@ -5666,7 +5665,7 @@ const Hx = (e, t) => typeof e == "function" ? Rl(e(t)) : t && Rl(e), Ux = We(
5666
5665
  function qx(e) {
5667
5666
  return { align: "start", index: 0, offset: e.scrollTop };
5668
5667
  }
5669
- const Gx = We(([{ topItemsIndexes: e }]) => {
5668
+ const Gx = Ue(([{ topItemsIndexes: e }]) => {
5670
5669
  const t = K(0);
5671
5670
  return ce(
5672
5671
  $(
@@ -5681,7 +5680,7 @@ function Tu(e) {
5681
5680
  let t = !1, n;
5682
5681
  return () => (t || (t = !0, n = e()), n);
5683
5682
  }
5684
- const Yx = Tu(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.test(navigator.userAgent)), Xx = We(
5683
+ const Yx = Tu(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.test(navigator.userAgent)), Xx = Ue(
5685
5684
  ([
5686
5685
  { deviation: e, scrollBy: t, scrollingInProgress: n, scrollTop: r },
5687
5686
  { isAtBottom: o, isScrolling: s, lastJumpDueToItemResize: i, scrollDirection: a },
@@ -5760,7 +5759,7 @@ const Yx = Tu(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
5760
5759
  ), { deviation: e };
5761
5760
  },
5762
5761
  nt(Tt, to, Jn, dn, Nn, Zi)
5763
- ), Jx = We(
5762
+ ), Jx = Ue(
5764
5763
  ([
5765
5764
  e,
5766
5765
  t,
@@ -5799,7 +5798,7 @@ const Yx = Tu(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
5799
5798
  Nn,
5800
5799
  yu
5801
5800
  )
5802
- ), Ru = We(
5801
+ ), Ru = Ue(
5803
5802
  ([
5804
5803
  {
5805
5804
  data: e,
@@ -6030,7 +6029,7 @@ const Ys = "-webkit-sticky", El = "sticky", oa = Tu(() => {
6030
6029
  function sa(e) {
6031
6030
  return e;
6032
6031
  }
6033
- const ev = /* @__PURE__ */ We(() => {
6032
+ const ev = /* @__PURE__ */ Ue(() => {
6034
6033
  const e = K((a) => `Item ${a}`), t = K((a) => `Group ${a}`), n = K({}), r = K(sa), o = K("div"), s = K(br), i = (a, l = null) => St(
6035
6034
  $(
6036
6035
  n,
@@ -6056,7 +6055,7 @@ const ev = /* @__PURE__ */ We(() => {
6056
6055
  ScrollSeekPlaceholder: i("ScrollSeekPlaceholder"),
6057
6056
  TopItemListComponent: i("TopItemList")
6058
6057
  };
6059
- }), tv = /* @__PURE__ */ We(
6058
+ }), tv = /* @__PURE__ */ Ue(
6060
6059
  ([e, t]) => ({ ...e, ...t }),
6061
6060
  nt(Ru, ev)
6062
6061
  ), nv = ({ height: e }) => /* @__PURE__ */ c.jsx("div", { style: { height: e } }), rv = { overflowAnchor: "none", position: oa(), zIndex: 1 }, ju = { overflowAnchor: "none" }, ov = { ...ju, display: "inline-block", height: "100%" }, kl = /* @__PURE__ */ z.memo(function({ showTopList: e = !1 }) {
@@ -6337,7 +6336,7 @@ const dv = ({ children: e }) => {
6337
6336
  }
6338
6337
  },
6339
6338
  pv
6340
- ), gv = /* @__PURE__ */ _u({ useEmitter: ia, useEmitterValue: ke, usePublisher: Bt }), xv = /* @__PURE__ */ Pu({ useEmitter: ia, useEmitterValue: ke, usePublisher: Bt }), vv = mv, wv = /* @__PURE__ */ We(() => {
6339
+ ), gv = /* @__PURE__ */ _u({ useEmitter: ia, useEmitterValue: ke, usePublisher: Bt }), xv = /* @__PURE__ */ Pu({ useEmitter: ia, useEmitterValue: ke, usePublisher: Bt }), vv = mv, wv = /* @__PURE__ */ Ue(() => {
6341
6340
  const e = K((u) => /* @__PURE__ */ c.jsxs("td", { children: [
6342
6341
  "Item $",
6343
6342
  u
@@ -6407,7 +6406,7 @@ function fo(e, t) {
6407
6406
  function Sv(e, t) {
6408
6407
  return e && e.column === t.column && e.row === t.row;
6409
6408
  }
6410
- const Cv = /* @__PURE__ */ We(
6409
+ const Cv = /* @__PURE__ */ Ue(
6411
6410
  ([
6412
6411
  { increaseViewportBy: e, listBoundary: t, overscan: n, visibleRange: r },
6413
6412
  { footerHeight: o, headerHeight: s, scrollBy: i, scrollContainerState: a, scrollTo: l, scrollTop: u, smoothScrollTargetReached: d, viewportHeight: f },
@@ -6511,13 +6510,13 @@ const Cv = /* @__PURE__ */ We(
6511
6510
  if (Ye === 0 && (P === 0 || Q === 0))
6512
6511
  return Il;
6513
6512
  if (at === 0) {
6514
- const J = ta(_e, P), Ce = J + Math.max(Ye - 1, 0);
6515
- return yv(jl(J, Ce, Ge));
6513
+ const X = ta(_e, P), Ce = X + Math.max(Ye - 1, 0);
6514
+ return yv(jl(X, Ce, Ge));
6516
6515
  }
6517
6516
  const ae = Ou(Q, at, Qe);
6518
- let he, Se;
6519
- Ee ? G === 0 && Z === 0 && Ye > 0 ? (he = 0, Se = Ye - 1) : (he = ae * zo((G + je) / (st + je)), Se = ae * Nl((Z + je) / (st + je)) - 1, Se = Xs(P - 1, Pr(Se, ae - 1)), he = Xs(Se, Pr(0, he))) : (he = 0, Se = -1);
6520
- const ve = jl(he, Se, Ge), { bottom: Ne, top: et } = _l(Me, le, oe, ve), Ve = Nl(P / ae), F = Ve * st + (Ve - 1) * je - Ne;
6517
+ let fe, Se;
6518
+ Ee ? G === 0 && Z === 0 && Ye > 0 ? (fe = 0, Se = Ye - 1) : (fe = ae * zo((G + je) / (st + je)), Se = ae * Nl((Z + je) / (st + je)) - 1, Se = Xs(P - 1, Pr(Se, ae - 1)), fe = Xs(Se, Pr(0, fe))) : (fe = 0, Se = -1);
6519
+ const ve = jl(fe, Se, Ge), { bottom: Ne, top: et } = _l(Me, le, oe, ve), Ve = Nl(P / ae), F = Ve * st + (Ve - 1) * je - Ne;
6521
6520
  return { bottom: Ne, itemHeight: st, items: ve, itemWidth: at, offsetBottom: F, offsetTop: et, top: et };
6522
6521
  }
6523
6522
  )
@@ -6563,7 +6562,7 @@ const Cv = /* @__PURE__ */ We(
6563
6562
  te(([[, P]]) => P - 1),
6564
6563
  tt()
6565
6564
  )
6566
- ), fe = Mt(
6565
+ ), ge = Mt(
6567
6566
  $(
6568
6567
  we(I),
6569
6568
  be(({ items: P }) => P.length > 0 && P[0].index === 0),
@@ -6646,7 +6645,7 @@ const Cv = /* @__PURE__ */ We(
6646
6645
  endReached: de,
6647
6646
  propsReady: v,
6648
6647
  rangeChanged: ye,
6649
- startReached: fe,
6648
+ startReached: ge,
6650
6649
  stateChanged: U,
6651
6650
  stateRestoreInProgress: L,
6652
6651
  ...S
@@ -6668,7 +6667,7 @@ function Ri(e, t, n, r) {
6668
6667
  const o = Ou(e.width, n.width, t.column), s = zo(r / o), i = s * n.height + Pr(0, s - 1) * t.row;
6669
6668
  return i > 0 ? i + t.row : i;
6670
6669
  }
6671
- const Tv = /* @__PURE__ */ We(() => {
6670
+ const Tv = /* @__PURE__ */ Ue(() => {
6672
6671
  const e = K((f) => `Item ${f}`), t = K({}), n = K(null), r = K("virtuoso-grid-item"), o = K("virtuoso-grid-list"), s = K(sa), i = K("div"), a = K(br), l = (f, h = null) => St(
6673
6672
  $(
6674
6673
  t,
@@ -6695,7 +6694,7 @@ const Tv = /* @__PURE__ */ We(() => {
6695
6694
  scrollerRef: a,
6696
6695
  ScrollSeekPlaceholder: l("ScrollSeekPlaceholder", "div")
6697
6696
  };
6698
- }), Rv = /* @__PURE__ */ We(
6697
+ }), Rv = /* @__PURE__ */ Ue(
6699
6698
  ([e, t]) => ({ ...e, ...t }),
6700
6699
  nt(Cv, Tv)
6701
6700
  ), Ev = /* @__PURE__ */ z.memo(function() {
@@ -6869,7 +6868,7 @@ const Ov = ts(
6869
6868
  }
6870
6869
  );
6871
6870
  function Ei({ className: e, variant: t, ...n }) {
6872
- return /* @__PURE__ */ c.jsx("div", { className: X(Ov({ variant: t }), e), ...n });
6871
+ return /* @__PURE__ */ c.jsx("div", { className: J(Ov({ variant: t }), e), ...n });
6873
6872
  }
6874
6873
  function ie(e, t, { checkForDefaultPrevented: n = !0 } = {}) {
6875
6874
  return function(o) {
@@ -7221,7 +7220,7 @@ const Ml = Xv, Dl = $u, Or = m.forwardRef(({ className: e, ...t }, n) => /* @__P
7221
7220
  "div",
7222
7221
  {
7223
7222
  ref: n,
7224
- className: X(
7223
+ className: J(
7225
7224
  "rounded-lg border bg-card text-card-foreground shadow-sm",
7226
7225
  e
7227
7226
  ),
@@ -7233,7 +7232,7 @@ const Mr = m.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c.jsx(
7233
7232
  "div",
7234
7233
  {
7235
7234
  ref: n,
7236
- className: X("flex flex-col space-y-1.5 p-6", e),
7235
+ className: J("flex flex-col space-y-1.5 p-6", e),
7237
7236
  ...t
7238
7237
  }
7239
7238
  ));
@@ -7242,7 +7241,7 @@ const Dr = m.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c.jsx(
7242
7241
  "h3",
7243
7242
  {
7244
7243
  ref: n,
7245
- className: X(
7244
+ className: J(
7246
7245
  "text-2xl font-semibold leading-none tracking-tight",
7247
7246
  e
7248
7247
  ),
@@ -7254,18 +7253,18 @@ const zu = m.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c.jsx(
7254
7253
  "p",
7255
7254
  {
7256
7255
  ref: n,
7257
- className: X("text-sm text-muted-foreground", e),
7256
+ className: J("text-sm text-muted-foreground", e),
7258
7257
  ...t
7259
7258
  }
7260
7259
  ));
7261
7260
  zu.displayName = "CardDescription";
7262
- const Eo = m.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c.jsx("div", { ref: n, className: X("p-6 pt-0", e), ...t }));
7261
+ const Eo = m.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c.jsx("div", { ref: n, className: J("p-6 pt-0", e), ...t }));
7263
7262
  Eo.displayName = "CardContent";
7264
7263
  const Bu = m.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c.jsx(
7265
7264
  "div",
7266
7265
  {
7267
7266
  ref: n,
7268
- className: X("flex items-center p-6 pt-0", e),
7267
+ className: J("flex items-center p-6 pt-0", e),
7269
7268
  ...t
7270
7269
  }
7271
7270
  ));
@@ -7861,7 +7860,7 @@ class da {
7861
7860
  }
7862
7861
  }
7863
7862
  }
7864
- const ge = {
7863
+ const me = {
7865
7864
  newline: /^(?: *(?:\n|$))+/,
7866
7865
  code: /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,
7867
7866
  fences: /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,
@@ -7878,37 +7877,37 @@ const ge = {
7878
7877
  _paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,
7879
7878
  text: /^[^\n]+/
7880
7879
  };
7881
- ge._label = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
7882
- ge._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
7883
- ge.def = Ze(ge.def).replace("label", ge._label).replace("title", ge._title).getRegex();
7884
- ge.bullet = /(?:[*+-]|\d{1,9}[.)])/;
7885
- ge.listItemStart = Ze(/^( *)(bull) */).replace("bull", ge.bullet).getRegex();
7886
- ge.list = Ze(ge.list).replace(/bull/g, ge.bullet).replace("hr", "\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def", "\\n+(?=" + ge.def.source + ")").getRegex();
7887
- ge._tag = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";
7888
- ge._comment = /<!--(?!-?>)[\s\S]*?(?:-->|$)/;
7889
- ge.html = Ze(ge.html, "i").replace("comment", ge._comment).replace("tag", ge._tag).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
7890
- ge.paragraph = Ze(ge._paragraph).replace("hr", ge.hr).replace("heading", " {0,3}#{1,6} ").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", ge._tag).getRegex();
7891
- ge.blockquote = Ze(ge.blockquote).replace("paragraph", ge.paragraph).getRegex();
7892
- ge.normal = { ...ge };
7893
- ge.gfm = {
7894
- ...ge.normal,
7880
+ me._label = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
7881
+ me._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
7882
+ me.def = Ze(me.def).replace("label", me._label).replace("title", me._title).getRegex();
7883
+ me.bullet = /(?:[*+-]|\d{1,9}[.)])/;
7884
+ me.listItemStart = Ze(/^( *)(bull) */).replace("bull", me.bullet).getRegex();
7885
+ me.list = Ze(me.list).replace(/bull/g, me.bullet).replace("hr", "\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def", "\\n+(?=" + me.def.source + ")").getRegex();
7886
+ me._tag = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";
7887
+ me._comment = /<!--(?!-?>)[\s\S]*?(?:-->|$)/;
7888
+ me.html = Ze(me.html, "i").replace("comment", me._comment).replace("tag", me._tag).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
7889
+ me.paragraph = Ze(me._paragraph).replace("hr", me.hr).replace("heading", " {0,3}#{1,6} ").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", me._tag).getRegex();
7890
+ me.blockquote = Ze(me.blockquote).replace("paragraph", me.paragraph).getRegex();
7891
+ me.normal = { ...me };
7892
+ me.gfm = {
7893
+ ...me.normal,
7895
7894
  table: "^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"
7896
7895
  // Cells
7897
7896
  };
7898
- ge.gfm.table = Ze(ge.gfm.table).replace("hr", ge.hr).replace("heading", " {0,3}#{1,6} ").replace("blockquote", " {0,3}>").replace("code", " {4}[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", ge._tag).getRegex();
7899
- ge.gfm.paragraph = Ze(ge._paragraph).replace("hr", ge.hr).replace("heading", " {0,3}#{1,6} ").replace("|lheading", "").replace("table", ge.gfm.table).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", ge._tag).getRegex();
7900
- ge.pedantic = {
7901
- ...ge.normal,
7897
+ me.gfm.table = Ze(me.gfm.table).replace("hr", me.hr).replace("heading", " {0,3}#{1,6} ").replace("blockquote", " {0,3}>").replace("code", " {4}[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", me._tag).getRegex();
7898
+ me.gfm.paragraph = Ze(me._paragraph).replace("hr", me.hr).replace("heading", " {0,3}#{1,6} ").replace("|lheading", "").replace("table", me.gfm.table).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", me._tag).getRegex();
7899
+ me.pedantic = {
7900
+ ...me.normal,
7902
7901
  html: Ze(
7903
7902
  `^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`
7904
- ).replace("comment", ge._comment).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),
7903
+ ).replace("comment", me._comment).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),
7905
7904
  def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
7906
7905
  heading: /^(#{1,6})(.*)(?:\n+|$)/,
7907
7906
  fences: Bo,
7908
7907
  // fences not supported
7909
7908
  lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
7910
- paragraph: Ze(ge.normal._paragraph).replace("hr", ge.hr).replace("heading", ` *#{1,6} *[^
7911
- ]`).replace("lheading", ge.lheading).replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").getRegex()
7909
+ paragraph: Ze(me.normal._paragraph).replace("hr", me.hr).replace("heading", ` *#{1,6} *[^
7910
+ ]`).replace("lheading", me.lheading).replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").getRegex()
7912
7911
  };
7913
7912
  const ne = {
7914
7913
  escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
@@ -7938,7 +7937,7 @@ ne._punctuation = "!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~";
7938
7937
  ne.punctuation = Ze(ne.punctuation).replace(/punctuation/g, ne._punctuation).getRegex();
7939
7938
  ne.blockSkip = /\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g;
7940
7939
  ne.escapedEmSt = /(?:^|[^\\])(?:\\\\)*\\[*_]/g;
7941
- ne._comment = Ze(ge._comment).replace("(?:-->|$)", "-->").getRegex();
7940
+ ne._comment = Ze(me._comment).replace("(?:-->|$)", "-->").getRegex();
7942
7941
  ne.emStrong.lDelim = Ze(ne.emStrong.lDelim).replace(/punct/g, ne._punctuation).getRegex();
7943
7942
  ne.emStrong.rDelimAst = Ze(ne.emStrong.rDelimAst, "g").replace(/punct/g, ne._punctuation).getRegex();
7944
7943
  ne.emStrong.rDelimUnd = Ze(ne.emStrong.rDelimUnd, "g").replace(/punct/g, ne._punctuation).getRegex();
@@ -7952,8 +7951,8 @@ ne._label = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
7952
7951
  ne._href = /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;
7953
7952
  ne._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;
7954
7953
  ne.link = Ze(ne.link).replace("label", ne._label).replace("href", ne._href).replace("title", ne._title).getRegex();
7955
- ne.reflink = Ze(ne.reflink).replace("label", ne._label).replace("ref", ge._label).getRegex();
7956
- ne.nolink = Ze(ne.nolink).replace("ref", ge._label).getRegex();
7954
+ ne.reflink = Ze(ne.reflink).replace("label", ne._label).replace("ref", me._label).getRegex();
7955
+ ne.nolink = Ze(ne.nolink).replace("ref", me._label).getRegex();
7957
7956
  ne.reflinkSearch = Ze(ne.reflinkSearch, "g").replace("reflink", ne.reflink).replace("nolink", ne.nolink).getRegex();
7958
7957
  ne.normal = { ...ne };
7959
7958
  ne.pedantic = {
@@ -8006,17 +8005,17 @@ class Tn {
8006
8005
  top: !0
8007
8006
  };
8008
8007
  const n = {
8009
- block: ge.normal,
8008
+ block: me.normal,
8010
8009
  inline: ne.normal
8011
8010
  };
8012
- this.options.pedantic ? (n.block = ge.pedantic, n.inline = ne.pedantic) : this.options.gfm && (n.block = ge.gfm, this.options.breaks ? n.inline = ne.breaks : n.inline = ne.gfm), this.tokenizer.rules = n;
8011
+ this.options.pedantic ? (n.block = me.pedantic, n.inline = ne.pedantic) : this.options.gfm && (n.block = me.gfm, this.options.breaks ? n.inline = ne.breaks : n.inline = ne.gfm), this.tokenizer.rules = n;
8013
8012
  }
8014
8013
  /**
8015
8014
  * Expose Rules
8016
8015
  */
8017
8016
  static get rules() {
8018
8017
  return {
8019
- block: ge,
8018
+ block: me,
8020
8019
  inline: ne
8021
8020
  };
8022
8021
  }
@@ -8652,7 +8651,7 @@ function Gu(e, t) {
8652
8651
  return (n, r, o) => {
8653
8652
  typeof r == "function" && (o = r, r = null);
8654
8653
  const s = { ...r };
8655
- r = { ...me.defaults, ...s };
8654
+ r = { ...pe.defaults, ...s };
8656
8655
  const i = hw(r.silent, r.async, o);
8657
8656
  if (typeof n > "u" || n === null)
8658
8657
  return i(new Error("marked(): input parameter is undefined or null"));
@@ -8670,7 +8669,7 @@ function Gu(e, t) {
8670
8669
  let h;
8671
8670
  if (!f)
8672
8671
  try {
8673
- r.walkTokens && me.walkTokens(l, r.walkTokens), h = t(l, r), r.hooks && (h = r.hooks.postprocess(h));
8672
+ r.walkTokens && pe.walkTokens(l, r.walkTokens), h = t(l, r), r.hooks && (h = r.hooks.postprocess(h));
8674
8673
  } catch (p) {
8675
8674
  f = p;
8676
8675
  }
@@ -8678,7 +8677,7 @@ function Gu(e, t) {
8678
8677
  };
8679
8678
  if (!a || a.length < 3 || (delete r.highlight, !l.length)) return u();
8680
8679
  let d = 0;
8681
- me.walkTokens(l, function(f) {
8680
+ pe.walkTokens(l, function(f) {
8682
8681
  f.type === "code" && (d++, setTimeout(() => {
8683
8682
  a(f.text, f.lang, function(h, p) {
8684
8683
  if (h)
@@ -8690,11 +8689,11 @@ function Gu(e, t) {
8690
8689
  return;
8691
8690
  }
8692
8691
  if (r.async)
8693
- return Promise.resolve(r.hooks ? r.hooks.preprocess(n) : n).then((a) => e(a, r)).then((a) => r.walkTokens ? Promise.all(me.walkTokens(a, r.walkTokens)).then(() => a) : a).then((a) => t(a, r)).then((a) => r.hooks ? r.hooks.postprocess(a) : a).catch(i);
8692
+ return Promise.resolve(r.hooks ? r.hooks.preprocess(n) : n).then((a) => e(a, r)).then((a) => r.walkTokens ? Promise.all(pe.walkTokens(a, r.walkTokens)).then(() => a) : a).then((a) => t(a, r)).then((a) => r.hooks ? r.hooks.postprocess(a) : a).catch(i);
8694
8693
  try {
8695
8694
  r.hooks && (n = r.hooks.preprocess(n));
8696
8695
  const a = e(n, r);
8697
- r.walkTokens && me.walkTokens(a, r.walkTokens);
8696
+ r.walkTokens && pe.walkTokens(a, r.walkTokens);
8698
8697
  let l = t(a, r);
8699
8698
  return r.hooks && (l = r.hooks.postprocess(l)), l;
8700
8699
  } catch (a) {
@@ -8702,19 +8701,19 @@ function Gu(e, t) {
8702
8701
  }
8703
8702
  };
8704
8703
  }
8705
- function me(e, t, n) {
8704
+ function pe(e, t, n) {
8706
8705
  return Gu(Tn.lex, Rn.parse)(e, t, n);
8707
8706
  }
8708
- me.options = me.setOptions = function(e) {
8709
- return me.defaults = { ...me.defaults, ...e }, Jv(me.defaults), me;
8707
+ pe.options = pe.setOptions = function(e) {
8708
+ return pe.defaults = { ...pe.defaults, ...e }, Jv(pe.defaults), pe;
8710
8709
  };
8711
- me.getDefaults = Hu;
8712
- me.defaults = Zn;
8713
- me.use = function(...e) {
8714
- const t = me.defaults.extensions || { renderers: {}, childTokens: {} };
8710
+ pe.getDefaults = Hu;
8711
+ pe.defaults = Zn;
8712
+ pe.use = function(...e) {
8713
+ const t = pe.defaults.extensions || { renderers: {}, childTokens: {} };
8715
8714
  e.forEach((n) => {
8716
8715
  const r = { ...n };
8717
- if (r.async = me.defaults.async || r.async || !1, n.extensions && (n.extensions.forEach((o) => {
8716
+ if (r.async = pe.defaults.async || r.async || !1, n.extensions && (n.extensions.forEach((o) => {
8718
8717
  if (!o.name)
8719
8718
  throw new Error("extension name required");
8720
8719
  if (o.renderer) {
@@ -8731,7 +8730,7 @@ me.use = function(...e) {
8731
8730
  }
8732
8731
  o.childTokens && (t.childTokens[o.name] = o.childTokens);
8733
8732
  }), r.extensions = t), n.renderer) {
8734
- const o = me.defaults.renderer || new fa();
8733
+ const o = pe.defaults.renderer || new fa();
8735
8734
  for (const s in n.renderer) {
8736
8735
  const i = o[s];
8737
8736
  o[s] = (...a) => {
@@ -8742,7 +8741,7 @@ me.use = function(...e) {
8742
8741
  r.renderer = o;
8743
8742
  }
8744
8743
  if (n.tokenizer) {
8745
- const o = me.defaults.tokenizer || new da();
8744
+ const o = pe.defaults.tokenizer || new da();
8746
8745
  for (const s in n.tokenizer) {
8747
8746
  const i = o[s];
8748
8747
  o[s] = (...a) => {
@@ -8753,11 +8752,11 @@ me.use = function(...e) {
8753
8752
  r.tokenizer = o;
8754
8753
  }
8755
8754
  if (n.hooks) {
8756
- const o = me.defaults.hooks || new Ho();
8755
+ const o = pe.defaults.hooks || new Ho();
8757
8756
  for (const s in n.hooks) {
8758
8757
  const i = o[s];
8759
8758
  Ho.passThroughHooks.has(s) ? o[s] = (a) => {
8760
- if (me.defaults.async)
8759
+ if (pe.defaults.async)
8761
8760
  return Promise.resolve(n.hooks[s].call(o, a)).then((u) => i.call(o, u));
8762
8761
  const l = n.hooks[s].call(o, a);
8763
8762
  return i.call(o, l);
@@ -8769,54 +8768,54 @@ me.use = function(...e) {
8769
8768
  r.hooks = o;
8770
8769
  }
8771
8770
  if (n.walkTokens) {
8772
- const o = me.defaults.walkTokens;
8771
+ const o = pe.defaults.walkTokens;
8773
8772
  r.walkTokens = function(s) {
8774
8773
  let i = [];
8775
8774
  return i.push(n.walkTokens.call(this, s)), o && (i = i.concat(o.call(this, s))), i;
8776
8775
  };
8777
8776
  }
8778
- me.setOptions(r);
8777
+ pe.setOptions(r);
8779
8778
  });
8780
8779
  };
8781
- me.walkTokens = function(e, t) {
8780
+ pe.walkTokens = function(e, t) {
8782
8781
  let n = [];
8783
8782
  for (const r of e)
8784
- switch (n = n.concat(t.call(me, r)), r.type) {
8783
+ switch (n = n.concat(t.call(pe, r)), r.type) {
8785
8784
  case "table": {
8786
8785
  for (const o of r.header)
8787
- n = n.concat(me.walkTokens(o.tokens, t));
8786
+ n = n.concat(pe.walkTokens(o.tokens, t));
8788
8787
  for (const o of r.rows)
8789
8788
  for (const s of o)
8790
- n = n.concat(me.walkTokens(s.tokens, t));
8789
+ n = n.concat(pe.walkTokens(s.tokens, t));
8791
8790
  break;
8792
8791
  }
8793
8792
  case "list": {
8794
- n = n.concat(me.walkTokens(r.items, t));
8793
+ n = n.concat(pe.walkTokens(r.items, t));
8795
8794
  break;
8796
8795
  }
8797
8796
  default:
8798
- me.defaults.extensions && me.defaults.extensions.childTokens && me.defaults.extensions.childTokens[r.type] ? me.defaults.extensions.childTokens[r.type].forEach(function(o) {
8799
- n = n.concat(me.walkTokens(r[o], t));
8800
- }) : r.tokens && (n = n.concat(me.walkTokens(r.tokens, t)));
8797
+ pe.defaults.extensions && pe.defaults.extensions.childTokens && pe.defaults.extensions.childTokens[r.type] ? pe.defaults.extensions.childTokens[r.type].forEach(function(o) {
8798
+ n = n.concat(pe.walkTokens(r[o], t));
8799
+ }) : r.tokens && (n = n.concat(pe.walkTokens(r.tokens, t)));
8801
8800
  }
8802
8801
  return n;
8803
8802
  };
8804
- me.parseInline = Gu(Tn.lexInline, Rn.parseInline);
8805
- me.Parser = Rn;
8806
- me.parser = Rn.parse;
8807
- me.Renderer = fa;
8808
- me.TextRenderer = Ku;
8809
- me.Lexer = Tn;
8810
- me.lexer = Tn.lex;
8811
- me.Tokenizer = da;
8812
- me.Slugger = qu;
8813
- me.Hooks = Ho;
8814
- me.parse = me;
8815
- me.options;
8816
- me.setOptions;
8817
- me.use;
8818
- me.walkTokens;
8819
- me.parseInline;
8803
+ pe.parseInline = Gu(Tn.lexInline, Rn.parseInline);
8804
+ pe.Parser = Rn;
8805
+ pe.parser = Rn.parse;
8806
+ pe.Renderer = fa;
8807
+ pe.TextRenderer = Ku;
8808
+ pe.Lexer = Tn;
8809
+ pe.lexer = Tn.lex;
8810
+ pe.Tokenizer = da;
8811
+ pe.Slugger = qu;
8812
+ pe.Hooks = Ho;
8813
+ pe.parse = pe;
8814
+ pe.options;
8815
+ pe.setOptions;
8816
+ pe.use;
8817
+ pe.walkTokens;
8818
+ pe.parseInline;
8820
8819
  Rn.parse;
8821
8820
  Tn.lex;
8822
8821
  function Ul({
@@ -8828,9 +8827,9 @@ function Ul({
8828
8827
  try {
8829
8828
  if (!n) {
8830
8829
  const o = e.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, "").replace(/<iframe\b[^<]*(?:(?!<\/iframe>)<[^<]*)*<\/iframe>/gi, "").replace(/javascript:/gi, "").replace(/on\w+\s*=/gi, "");
8831
- return me.parse(o);
8830
+ return pe.parse(o);
8832
8831
  }
8833
- return me.parse(e);
8832
+ return pe.parse(e);
8834
8833
  } catch (o) {
8835
8834
  return console.error("[MarkdownContent] parse error", o), `<pre>Error rendering markdown: ${String(o)}</pre>`;
8836
8835
  }
@@ -8838,7 +8837,7 @@ function Ul({
8838
8837
  return /* @__PURE__ */ c.jsx(
8839
8838
  "div",
8840
8839
  {
8841
- className: X("markdown prose max-w-none break-words dark:prose-invert", t),
8840
+ className: J("markdown prose max-w-none break-words dark:prose-invert", t),
8842
8841
  dangerouslySetInnerHTML: { __html: r }
8843
8842
  }
8844
8843
  );
@@ -9276,7 +9275,7 @@ function ni(e, t) {
9276
9275
  return typeof e == "function" ? e(t) : e && (e.current = t), e;
9277
9276
  }
9278
9277
  function zw(e, t) {
9279
- var n = pe(function() {
9278
+ var n = he(function() {
9280
9279
  return {
9281
9280
  // value
9282
9281
  value: e,
@@ -9999,7 +9998,7 @@ const _b = Cd, Pb = Td, Ed = m.forwardRef(({ className: e, ...t }, n) => /* @__P
9999
9998
  bs,
10000
9999
  {
10001
10000
  ref: n,
10002
- className: X(
10001
+ className: J(
10003
10002
  "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
10004
10003
  e
10005
10004
  ),
@@ -10029,7 +10028,7 @@ const kd = m.forwardRef(({ className: e, children: t, ...n }, r) => {
10029
10028
  ys,
10030
10029
  {
10031
10030
  ref: r,
10032
- className: X(
10031
+ className: J(
10033
10032
  "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
10034
10033
  e
10035
10034
  ),
@@ -10053,7 +10052,7 @@ const Id = ({
10053
10052
  }) => /* @__PURE__ */ c.jsx(
10054
10053
  "div",
10055
10054
  {
10056
- className: X(
10055
+ className: J(
10057
10056
  "flex flex-col space-y-1.5 text-center sm:text-left",
10058
10057
  e
10059
10058
  ),
@@ -10065,7 +10064,7 @@ const Nd = m.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c.jsx(
10065
10064
  Bn,
10066
10065
  {
10067
10066
  ref: n,
10068
- className: X(
10067
+ className: J(
10069
10068
  "text-lg font-semibold leading-none tracking-tight",
10070
10069
  e
10071
10070
  ),
@@ -10077,13 +10076,13 @@ const Ob = m.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c.jsx(
10077
10076
  Ss,
10078
10077
  {
10079
10078
  ref: n,
10080
- className: X("text-sm text-muted-foreground", e),
10079
+ className: J("text-sm text-muted-foreground", e),
10081
10080
  ...t
10082
10081
  }
10083
10082
  ));
10084
10083
  Ob.displayName = Ss.displayName;
10085
10084
  function Mb({ isOpen: e, onClose: t, fileId: n, fileName: r, mimeType: o }) {
10086
- const [s, i] = pe(!1), [a, l] = pe(null), [u, d] = pe(null), { toast: f } = ha(), h = z.useCallback(async () => {
10085
+ const [s, i] = he(!1), [a, l] = he(null), [u, d] = he(null), { toast: f } = ha(), h = z.useCallback(async () => {
10087
10086
  if (n) {
10088
10087
  i(!0), d(null), l(null);
10089
10088
  try {
@@ -10344,7 +10343,7 @@ function sc(e) {
10344
10343
  return `${e.id}:${t}:${n}`;
10345
10344
  }
10346
10345
  function Hb({ className: e }) {
10347
- const [t, n] = pe(0);
10346
+ const [t, n] = he(0);
10348
10347
  return gt(() => {
10349
10348
  const r = setInterval(() => n((o) => (o + 1) % 4), 500);
10350
10349
  return () => clearInterval(r);
@@ -10352,7 +10351,7 @@ function Hb({ className: e }) {
10352
10351
  "span",
10353
10352
  {
10354
10353
  "aria-live": "polite",
10355
- className: X("inline-block text-xs opacity-70 ml-1", e),
10354
+ className: J("inline-block text-xs opacity-70 ml-1", e),
10356
10355
  children: [
10357
10356
  "Is thinking",
10358
10357
  ".".repeat(t)
@@ -10379,7 +10378,7 @@ const Ub = z.memo(function({
10379
10378
  onCancelEdit: g,
10380
10379
  onCopy: x
10381
10380
  }) {
10382
- const [b, y] = pe(!1), [R, S] = pe("collapsed"), [C, E] = pe(!1), { currentThreadId: I } = Gi(), { handleInterrupt: j } = tu(), { toast: N } = ha(), [O, M] = pe({}), [D, _] = pe(!1), [V, U] = pe(null), q = l === "phone" || l === "half-screen", L = t.role, k = L === "tool", W = !(r && L !== "user"), Y = z.useMemo(() => {
10381
+ const [b, y] = he(!1), [R, S] = he("collapsed"), [C, E] = he(!1), { currentThreadId: I } = Gi(), { handleInterrupt: j } = tu(), { toast: N } = ha(), [O, M] = he({}), [D, _] = he(!1), [V, U] = he(null), q = l === "phone" || l === "half-screen", L = t.role, k = L === "tool", W = !(r && L !== "user"), Y = z.useMemo(() => {
10383
10382
  switch (L) {
10384
10383
  case "user":
10385
10384
  return "text-[hsl(var(--chat-bubble-user-text))]";
@@ -10395,7 +10394,7 @@ const Ub = z.memo(function({
10395
10394
  }, [L]), ue = pt(() => Db(t.content), [t.content]), re = pt(() => Lb(t.content), [t.content]), de = pt(
10396
10395
  () => t.content.filter((Q) => Q.type === "image_url"),
10397
10396
  [t.content]
10398
- ), fe = pt(
10397
+ ), ge = pt(
10399
10398
  () => t.content.filter((Q) => Q.type === "file"),
10400
10399
  [t.content]
10401
10400
  ), ye = pt(
@@ -10405,7 +10404,7 @@ const Ub = z.memo(function({
10405
10404
  pt(() => zb(t.content), [t.content]);
10406
10405
  const P = pt(() => B.length <= Dn ? B : `${B.slice(0, Dn)}
10407
10406
  … [truncated ${B.length - Dn} chars]`, [B]), G = z.useCallback(async (Q = "all") => {
10408
- const he = Q === "visible" && k ? P : k ? B : ue;
10407
+ const fe = Q === "visible" && k ? P : k ? B : ue;
10409
10408
  async function Se(ve) {
10410
10409
  try {
10411
10410
  await navigator.clipboard.writeText(ve);
@@ -10419,7 +10418,7 @@ const Ub = z.memo(function({
10419
10418
  }
10420
10419
  }
10421
10420
  try {
10422
- await Se(he), y(!0), setTimeout(() => y(!1), 2e3), x == null || x(he);
10421
+ await Se(fe), y(!0), setTimeout(() => y(!1), 2e3), x == null || x(fe);
10423
10422
  } catch (ve) {
10424
10423
  console.error("Failed to copy:", ve);
10425
10424
  }
@@ -10429,12 +10428,12 @@ const Ub = z.memo(function({
10429
10428
  w(t.id, Q);
10430
10429
  }, [w, t.id, k, B, ue]), le = z.useCallback(() => {
10431
10430
  v == null || v(n);
10432
- }, [v, n]), oe = z.useCallback(async (Q, ae, he) => {
10431
+ }, [v, n]), oe = z.useCallback(async (Q, ae, fe) => {
10433
10432
  if (!W) {
10434
10433
  Q.preventDefault();
10435
10434
  return;
10436
10435
  }
10437
- if (O[he]) {
10436
+ if (O[fe]) {
10438
10437
  Q.preventDefault();
10439
10438
  return;
10440
10439
  }
@@ -10447,13 +10446,13 @@ const Ub = z.memo(function({
10447
10446
  return;
10448
10447
  }
10449
10448
  if (Se.startsWith("data:")) {
10450
- Q.preventDefault(), M((Ve) => ({ ...Ve, [he]: !0 }));
10449
+ Q.preventDefault(), M((Ve) => ({ ...Ve, [fe]: !0 }));
10451
10450
  const Ne = `${ae.name}_${ae.size}_${Date.now()}`, et = N({ title: "Fetching file...", description: "", open: !0 });
10452
10451
  try {
10453
10452
  const Ve = await mw(I ?? void 0);
10454
10453
  if (!Ve || !Array.isArray(Ve))
10455
10454
  throw new Error("Invalid file list response");
10456
- const F = Ve.find((J) => !J || typeof J != "object" || !((J.filename ?? "") === (ae.name ?? "")) ? !1 : typeof ae.size == "number" && typeof J.size == "number" ? J.size === ae.size : !0);
10455
+ const F = Ve.find((X) => !X || typeof X != "object" || !((X.filename ?? "") === (ae.name ?? "")) ? !1 : typeof ae.size == "number" && typeof X.size == "number" ? X.size === ae.size : !0);
10457
10456
  if (!(F != null && F.id))
10458
10457
  throw new Error(`File "${ae.name}" is not yet available on the server`);
10459
10458
  if (!F.id || !F.filename)
@@ -10472,14 +10471,14 @@ const Ub = z.memo(function({
10472
10471
  open: !0
10473
10472
  });
10474
10473
  } finally {
10475
- M((Ve) => ({ ...Ve, [he]: !1 }));
10474
+ M((Ve) => ({ ...Ve, [fe]: !1 }));
10476
10475
  }
10477
10476
  }
10478
10477
  } catch (Se) {
10479
- console.error("File click error:", Se), M((ve) => ({ ...ve, [he]: !1 }));
10478
+ console.error("File click error:", Se), M((ve) => ({ ...ve, [fe]: !1 }));
10480
10479
  }
10481
10480
  }, [W, O, N, I]), Me = z.useCallback(() => {
10482
- const ae = X(q ? "h-3 w-3" : "h-4 w-4", "opacity-60 flex-shrink-0", Y);
10481
+ const ae = J(q ? "h-3 w-3" : "h-4 w-4", "opacity-60 flex-shrink-0", Y);
10483
10482
  switch (L) {
10484
10483
  case "user":
10485
10484
  return /* @__PURE__ */ c.jsx(Fp, { className: ae });
@@ -10494,40 +10493,40 @@ const Ub = z.memo(function({
10494
10493
  const Q = "group relative mb-4 flex w-full";
10495
10494
  switch (L) {
10496
10495
  case "user":
10497
- return X(Q, "justify-end");
10496
+ return J(Q, "justify-end");
10498
10497
  case "assistant":
10499
10498
  case "tool":
10500
10499
  case "system":
10501
- return X(Q, "justify-start");
10500
+ return J(Q, "justify-start");
10502
10501
  default:
10503
10502
  return Q;
10504
10503
  }
10505
10504
  }, [L]), Ye = z.useCallback(() => {
10506
- const Q = X(
10505
+ const Q = J(
10507
10506
  "rounded-lg px-4 py-3 relative min-w-0 max-w-full break-words",
10508
10507
  q && "px-3 py-2 text-sm"
10509
10508
  );
10510
10509
  switch (L) {
10511
10510
  case "user":
10512
- return X(
10511
+ return J(
10513
10512
  Q,
10514
10513
  "w-full md:max-w-[95%]",
10515
10514
  "bg-[hsl(var(--chat-bubble-user))] text-[hsl(var(--chat-bubble-user-text))]",
10516
10515
  "border border-transparent"
10517
10516
  );
10518
10517
  case "assistant":
10519
- return X(
10518
+ return J(
10520
10519
  Q,
10521
10520
  "w-full md:max-w-[95%]",
10522
10521
  "bg-[hsl(var(--chat-bubble-ai))] text-[hsl(var(--chat-bubble-ai-text))]",
10523
10522
  "border border-border/60 dark:border-border/40"
10524
10523
  );
10525
10524
  case "tool":
10526
- return X(Q, "w-full md:max-w-[95%] bg-secondary/50 text-secondary-foreground border border-dashed");
10525
+ return J(Q, "w-full md:max-w-[95%] bg-secondary/50 text-secondary-foreground border border-dashed");
10527
10526
  case "system":
10528
- return X(Q, "w-full md:max-w-[85%] bg-accent/40 text-muted-foreground border");
10527
+ return J(Q, "w-full md:max-w-[85%] bg-accent/40 text-muted-foreground border");
10529
10528
  default:
10530
- return X(
10529
+ return J(
10531
10530
  Q,
10532
10531
  "w-full md:max-w-[95%]",
10533
10532
  "bg-[hsl(var(--chat-bubble-ai))] text-[hsl(var(--chat-bubble-ai-text))]",
@@ -10550,9 +10549,9 @@ const Ub = z.memo(function({
10550
10549
  }
10551
10550
  }, [j]), Qe = z.useCallback(({ part: Q, i: ae }) => {
10552
10551
  if (Q.type === "text") {
10553
- const he = Q.text ?? "", Se = he.trim(), ve = oc(Se);
10552
+ const fe = Q.text ?? "", Se = fe.trim(), ve = oc(Se);
10554
10553
  return ve && L !== "tool" ? /* @__PURE__ */ c.jsx(Wb, { data: ve }, ae) : L === "user" && f && Se.length > h ? /* @__PURE__ */ c.jsxs(Ml, { open: C, onOpenChange: E, children: [
10555
- /* @__PURE__ */ c.jsx("div", { className: X("text-sm text-[hsl(var(--chat-bubble-user-text))]", q && "text-xs"), children: C ? /* @__PURE__ */ c.jsx(Ul, { content: Se, allowHtml: !1 }) : /* @__PURE__ */ c.jsxs("pre", { className: X("font-sans whitespace-pre-wrap break-words bg-transparent p-0 m-0 text-[hsl(var(--chat-bubble-user-text))]", q && "text-xs"), children: [
10554
+ /* @__PURE__ */ c.jsx("div", { className: J("text-sm text-[hsl(var(--chat-bubble-user-text))]", q && "text-xs"), children: C ? /* @__PURE__ */ c.jsx(Ul, { content: Se, allowHtml: !1 }) : /* @__PURE__ */ c.jsxs("pre", { className: J("font-sans whitespace-pre-wrap break-words bg-transparent p-0 m-0 text-[hsl(var(--chat-bubble-user-text))]", q && "text-xs"), children: [
10556
10555
  Se.substring(0, h),
10557
10556
  "..."
10558
10557
  ] }) }),
@@ -10573,27 +10572,27 @@ const Ub = z.memo(function({
10573
10572
  ] })
10574
10573
  }
10575
10574
  ) })
10576
- ] }, ae) : /* @__PURE__ */ c.jsx(Ul, { content: he, allowHtml: !1 }, ae);
10575
+ ] }, ae) : /* @__PURE__ */ c.jsx(Ul, { content: fe, allowHtml: !1 }, ae);
10577
10576
  }
10578
10577
  if (Q.type === "image_url") {
10579
- const he = Q;
10578
+ const fe = Q;
10580
10579
  return /* @__PURE__ */ c.jsx("div", { className: "my-2", children: /* @__PURE__ */ c.jsx(
10581
10580
  "img",
10582
10581
  {
10583
- src: he.url,
10584
- alt: he.alt ?? "",
10582
+ src: fe.url,
10583
+ alt: fe.alt ?? "",
10585
10584
  loading: "lazy",
10586
10585
  className: "border rounded max-h-[420px] w-auto object-contain"
10587
10586
  }
10588
10587
  ) }, ae);
10589
10588
  }
10590
10589
  if (Q.type === "file") {
10591
- const he = Q, Se = he.name || "file";
10590
+ const fe = Q, Se = fe.name || "file";
10592
10591
  return /* @__PURE__ */ c.jsxs(
10593
10592
  "a",
10594
10593
  {
10595
- href: he.url,
10596
- onClick: (ve) => oe(ve, he, ae),
10594
+ href: fe.url,
10595
+ onClick: (ve) => oe(ve, fe, ae),
10597
10596
  className: `inline-flex items-center gap-2 rounded px-2 py-1 text-xs bg-gray-100 border hover:bg-gray-200
10598
10597
  dark:bg-background/10 dark:border-border/30 dark:hover:bg-background/20`,
10599
10598
  children: [
@@ -10630,26 +10629,26 @@ const Ub = z.memo(function({
10630
10629
  /* @__PURE__ */ c.jsx(ui, { className: "h-4 w-4 text-muted-foreground" }),
10631
10630
  /* @__PURE__ */ c.jsx("span", { className: "text-sm text-muted-foreground", children: "File upload" })
10632
10631
  ] }), []), st = z.useCallback(() => {
10633
- const Q = ue.trim().length > 0 || de.length > 0 || fe.length > 0 || ye.length > 0;
10632
+ const Q = ue.trim().length > 0 || de.length > 0 || ge.length > 0 || ye.length > 0;
10634
10633
  if (!k && !Q && !r)
10635
10634
  return je();
10636
10635
  if (t.model === "reflection") {
10637
- const ae = ue.trim(), he = oc(ae);
10638
- if (he && typeof he == "object")
10639
- return /* @__PURE__ */ c.jsx(qb, { data: he });
10636
+ const ae = ue.trim(), fe = oc(ae);
10637
+ if (fe && typeof fe == "object")
10638
+ return /* @__PURE__ */ c.jsx(qb, { data: fe });
10640
10639
  }
10641
10640
  if (k && re.name === "get_issues") {
10642
- const ae = t.content.find((ve) => ve.type === "tool_end"), he = (ae == null ? void 0 : ae.output) ?? B, Se = jd(he);
10641
+ const ae = t.content.find((ve) => ve.type === "tool_end"), fe = (ae == null ? void 0 : ae.output) ?? B, Se = jd(fe);
10643
10642
  if (Se) return /* @__PURE__ */ c.jsx(Gb, { issues: Se });
10644
10643
  }
10645
10644
  if (k) {
10646
10645
  const ae = Fb(t.content);
10647
10646
  if (ae.length > 0)
10648
- return /* @__PURE__ */ c.jsx("div", { className: "space-y-2", children: ae.map((he, Se) => {
10649
- const ve = typeof he.output == "string" ? he.output : Ni(he.output), Ne = ve.length > Dn ? `${ve.slice(0, Dn)}
10647
+ return /* @__PURE__ */ c.jsx("div", { className: "space-y-2", children: ae.map((fe, Se) => {
10648
+ const ve = typeof fe.output == "string" ? fe.output : Ni(fe.output), Ne = ve.length > Dn ? `${ve.slice(0, Dn)}
10650
10649
  … [truncated ${ve.length - Dn} chars]` : ve, et = R === "expanded";
10651
10650
  return /* @__PURE__ */ c.jsxs(Ml, { open: et, onOpenChange: (Ve) => S(Ve ? "expanded" : "preview"), children: [
10652
- /* @__PURE__ */ c.jsx("div", { className: "flex items-center gap-2 text-xs", children: /* @__PURE__ */ c.jsx(Ei, { variant: "outline", children: (he.name ?? "tool") + (he.toolCallId ? ` • ${he.toolCallId.slice(0, 8)}` : "") }) }),
10651
+ /* @__PURE__ */ c.jsx("div", { className: "flex items-center gap-2 text-xs", children: /* @__PURE__ */ c.jsx(Ei, { variant: "outline", children: (fe.name ?? "tool") + (fe.toolCallId ? ` • ${fe.toolCallId.slice(0, 8)}` : "") }) }),
10653
10652
  /* @__PURE__ */ c.jsx("div", { className: "font-mono text-sm mt-1", children: /* @__PURE__ */ c.jsx("pre", { className: "whitespace-pre-wrap break-words", children: et ? Ne : Ne.slice(0, d) + (Ne.length > d ? "..." : "") }) }),
10654
10653
  /* @__PURE__ */ c.jsx(Dl, { asChild: !0, children: /* @__PURE__ */ c.jsx(He, { variant: "ghost", size: "sm", className: "h-6 text-xs", children: et ? /* @__PURE__ */ c.jsxs(c.Fragment, { children: [
10655
10654
  " ",
@@ -10659,11 +10658,11 @@ const Ub = z.memo(function({
10659
10658
  /* @__PURE__ */ c.jsx(ar, { className: "h-3 w-3 mr-1" }),
10660
10659
  " Show more"
10661
10660
  ] }) }) })
10662
- ] }, he.toolCallId ?? Se);
10661
+ ] }, fe.toolCallId ?? Se);
10663
10662
  }) });
10664
10663
  }
10665
10664
  if (!k) {
10666
- const ae = /* @__PURE__ */ c.jsx("div", { className: "space-y-2", children: t.content.map((he, Se) => /* @__PURE__ */ c.jsx(Qe, { part: he, i: Se }, Se)) });
10665
+ const ae = /* @__PURE__ */ c.jsx("div", { className: "space-y-2", children: t.content.map((fe, Se) => /* @__PURE__ */ c.jsx(Qe, { part: fe, i: Se }, Se)) });
10667
10666
  return r ? /* @__PURE__ */ c.jsxs("div", { "aria-busy": "true", role: "status", children: [
10668
10667
  ae,
10669
10668
  /* @__PURE__ */ c.jsx(Hb, { className: Y })
@@ -10672,7 +10671,7 @@ const Ub = z.memo(function({
10672
10671
  }, [
10673
10672
  ue,
10674
10673
  de.length,
10675
- fe.length,
10674
+ ge.length,
10676
10675
  ye.length,
10677
10676
  r,
10678
10677
  t.model,
@@ -10685,11 +10684,11 @@ const Ub = z.memo(function({
10685
10684
  Y
10686
10685
  ]), at = pt(() => Bb(t), [t]);
10687
10686
  return /* @__PURE__ */ c.jsxs(c.Fragment, { children: [
10688
- /* @__PURE__ */ c.jsx("div", { className: X(Ge(), p.container), children: /* @__PURE__ */ c.jsxs("div", { className: X(Ye(), p.content), children: [
10687
+ /* @__PURE__ */ c.jsx("div", { className: J(Ge(), p.container), children: /* @__PURE__ */ c.jsxs("div", { className: J(Ye(), p.content), children: [
10689
10688
  (i || a || k) && /* @__PURE__ */ c.jsxs(
10690
10689
  "div",
10691
10690
  {
10692
- className: X(
10691
+ className: J(
10693
10692
  "flex items-center justify-between mb-2 pb-2 border-b border-current/10",
10694
10693
  q && "mb-1 pb-1",
10695
10694
  Y,
@@ -10698,12 +10697,12 @@ const Ub = z.memo(function({
10698
10697
  children: [
10699
10698
  /* @__PURE__ */ c.jsxs("div", { className: "flex items-center gap-2", children: [
10700
10699
  Me(),
10701
- a && at && /* @__PURE__ */ c.jsx("span", { className: X("font-medium", q ? "text-xs" : "text-sm"), children: at }),
10700
+ a && at && /* @__PURE__ */ c.jsx("span", { className: J("font-medium", q ? "text-xs" : "text-sm"), children: at }),
10702
10701
  k && re.name && /* @__PURE__ */ c.jsxs(
10703
10702
  Ei,
10704
10703
  {
10705
10704
  variant: "outline",
10706
- className: X(
10705
+ className: J(
10707
10706
  "text-xs flex items-center gap-1 cursor-pointer",
10708
10707
  Y,
10709
10708
  "border border-current/40",
@@ -10727,7 +10726,7 @@ const Ub = z.memo(function({
10727
10726
  {
10728
10727
  variant: "ghost",
10729
10728
  size: "sm",
10730
- className: X("h-6 px-1", Y, "hover:bg-foreground/10"),
10729
+ className: J("h-6 px-1", Y, "hover:bg-foreground/10"),
10731
10730
  onClick: () => S((Q) => Q === "collapsed" ? "preview" : "collapsed"),
10732
10731
  children: /* @__PURE__ */ c.jsxs("span", { className: "text-xs flex items-center gap-1", children: [
10733
10732
  "Tool Output ",
@@ -10740,7 +10739,7 @@ const Ub = z.memo(function({
10740
10739
  i && t.createdAt && /* @__PURE__ */ c.jsx(
10741
10740
  "time",
10742
10741
  {
10743
- className: X("text-xs opacity-60", Y, q && "text-xs"),
10742
+ className: J("text-xs opacity-60", Y, q && "text-xs"),
10744
10743
  dateTime: new Date(t.createdAt).toISOString(),
10745
10744
  title: new Date(t.createdAt).toLocaleString(),
10746
10745
  children: new Intl.DateTimeFormat(void 0, { hour: "2-digit", minute: "2-digit" }).format(new Date(t.createdAt))
@@ -10749,7 +10748,7 @@ const Ub = z.memo(function({
10749
10748
  s && !o && /* @__PURE__ */ c.jsxs(
10750
10749
  "div",
10751
10750
  {
10752
- className: X(
10751
+ className: J(
10753
10752
  "opacity-0 group-hover:opacity-100 transition-opacity",
10754
10753
  "flex items-center gap-1",
10755
10754
  p.actions
@@ -10762,10 +10761,10 @@ const Ub = z.memo(function({
10762
10761
  variant: "ghost",
10763
10762
  size: "sm",
10764
10763
  onClick: () => G(k ? "visible" : "all"),
10765
- className: X("h-6 w-6 p-0 hover:bg-foreground/10", Y, q && "h-5 w-5"),
10764
+ className: J("h-6 w-6 p-0 hover:bg-foreground/10", Y, q && "h-5 w-5"),
10766
10765
  "aria-label": k ? "Copy visible" : "Copy message",
10767
10766
  title: k ? "Copy visible portion" : "Copy message",
10768
- children: /* @__PURE__ */ c.jsx(Wa, { className: X(b ? "text-success" : Y, q ? "h-3 w-3" : "h-4 w-4") })
10767
+ children: /* @__PURE__ */ c.jsx(Wa, { className: J(b ? "text-success" : Y, q ? "h-3 w-3" : "h-4 w-4") })
10769
10768
  }
10770
10769
  ),
10771
10770
  k && /* @__PURE__ */ c.jsx(
@@ -10774,7 +10773,7 @@ const Ub = z.memo(function({
10774
10773
  variant: "ghost",
10775
10774
  size: "sm",
10776
10775
  onClick: () => G("all"),
10777
- className: X("h-6 px-1 text-xs hover:bg-foreground/10", Y),
10776
+ className: J("h-6 px-1 text-xs hover:bg-foreground/10", Y),
10778
10777
  "aria-label": "Copy all (may be large)",
10779
10778
  title: "Copy all (may be large)",
10780
10779
  children: "all"
@@ -10787,9 +10786,9 @@ const Ub = z.memo(function({
10787
10786
  variant: "ghost",
10788
10787
  size: "sm",
10789
10788
  onClick: Z,
10790
- className: X("h-6 w-6 p-0 hover:bg-foreground/10", Y, q && "h-5 w-5"),
10789
+ className: J("h-6 w-6 p-0 hover:bg-foreground/10", Y, q && "h-5 w-5"),
10791
10790
  "aria-label": "Edit message",
10792
- children: /* @__PURE__ */ c.jsx(Va, { className: X(Y, q ? "h-3 w-3" : "h-4 w-4") })
10791
+ children: /* @__PURE__ */ c.jsx(Va, { className: J(Y, q ? "h-3 w-3" : "h-4 w-4") })
10793
10792
  }
10794
10793
  ),
10795
10794
  L === "assistant" && v && /* @__PURE__ */ c.jsx(
@@ -10798,9 +10797,9 @@ const Ub = z.memo(function({
10798
10797
  variant: "ghost",
10799
10798
  size: "sm",
10800
10799
  onClick: le,
10801
- className: X("h-6 w-6 p-0 hover:bg-foreground/10", Y, q && "h-5 w-5"),
10800
+ className: J("h-6 w-6 p-0 hover:bg-foreground/10", Y, q && "h-5 w-5"),
10802
10801
  "aria-label": "Regenerate response",
10803
- children: /* @__PURE__ */ c.jsx(di, { className: X(Y, q ? "h-3 w-3" : "h-4 w-4") })
10802
+ children: /* @__PURE__ */ c.jsx(di, { className: J(Y, q ? "h-3 w-3" : "h-4 w-4") })
10804
10803
  }
10805
10804
  )
10806
10805
  ]
@@ -10811,7 +10810,7 @@ const Ub = z.memo(function({
10811
10810
  }
10812
10811
  ),
10813
10812
  /* @__PURE__ */ c.jsx("div", { className: "relative", children: st() }),
10814
- k && R === "expanded" && (re.toolCallId || re.name) && /* @__PURE__ */ c.jsxs("div", { className: X("mt-2 pt-2 border-t border-current/10 text-xs opacity-60", q && "text-xs"), children: [
10813
+ k && R === "expanded" && (re.toolCallId || re.name) && /* @__PURE__ */ c.jsxs("div", { className: J("mt-2 pt-2 border-t border-current/10 text-xs opacity-60", q && "text-xs"), children: [
10815
10814
  re.name && /* @__PURE__ */ c.jsxs("div", { children: [
10816
10815
  "Function: ",
10817
10816
  re.name
@@ -10824,7 +10823,7 @@ const Ub = z.memo(function({
10824
10823
  !(i || a || k) && s && !o && /* @__PURE__ */ c.jsxs(
10825
10824
  "div",
10826
10825
  {
10827
- className: X(
10826
+ className: J(
10828
10827
  "absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity",
10829
10828
  "flex items-center gap-1",
10830
10829
  p.actions
@@ -10836,8 +10835,8 @@ const Ub = z.memo(function({
10836
10835
  variant: "ghost",
10837
10836
  size: "sm",
10838
10837
  onClick: () => G(),
10839
- className: X("h-6 w-6 p-0 hover:bg-background/50 text-current", q && "h-5 w-5"),
10840
- children: /* @__PURE__ */ c.jsx(Wa, { className: X(b ? "text-success" : "text-current", q ? "h-3 w-3" : "h-4 w-4") })
10838
+ className: J("h-6 w-6 p-0 hover:bg-background/50 text-current", q && "h-5 w-5"),
10839
+ children: /* @__PURE__ */ c.jsx(Wa, { className: J(b ? "text-success" : "text-current", q ? "h-3 w-3" : "h-4 w-4") })
10841
10840
  }
10842
10841
  ),
10843
10842
  L === "user" && w && /* @__PURE__ */ c.jsx(
@@ -10846,8 +10845,8 @@ const Ub = z.memo(function({
10846
10845
  variant: "ghost",
10847
10846
  size: "sm",
10848
10847
  onClick: Z,
10849
- className: X("h-6 w-6 p-0 hover:bg-background/50 text-current", q && "h-5 w-5"),
10850
- children: /* @__PURE__ */ c.jsx(Va, { className: X("text-current", q ? "h-3 w-3" : "h-4 w-4") })
10848
+ className: J("h-6 w-6 p-0 hover:bg-background/50 text-current", q && "h-5 w-5"),
10849
+ children: /* @__PURE__ */ c.jsx(Va, { className: J("text-current", q ? "h-3 w-3" : "h-4 w-4") })
10851
10850
  }
10852
10851
  ),
10853
10852
  L === "assistant" && v && /* @__PURE__ */ c.jsx(
@@ -10856,8 +10855,8 @@ const Ub = z.memo(function({
10856
10855
  variant: "ghost",
10857
10856
  size: "sm",
10858
10857
  onClick: le,
10859
- className: X("h-6 w-6 p-0 hover:bg-background/50 text-current", q && "h-5 w-5"),
10860
- children: /* @__PURE__ */ c.jsx(di, { className: X("text-current", q ? "h-3 w-3" : "h-4 w-4") })
10858
+ className: J("h-6 w-6 p-0 hover:bg-background/50 text-current", q && "h-5 w-5"),
10859
+ children: /* @__PURE__ */ c.jsx(di, { className: J("text-current", q ? "h-3 w-3" : "h-4 w-4") })
10861
10860
  }
10862
10861
  )
10863
10862
  ]
@@ -11026,7 +11025,7 @@ const ic = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, _d = z.forwa
11026
11025
  onScrollAway: g,
11027
11026
  onAtBottom: x
11028
11027
  }, b) => {
11029
- const y = ut(null), R = ut(null), S = ut(!1), [C, E] = pe(!0), I = Ue((O) => {
11028
+ const y = ut(null), R = ut(null), S = ut(!1), [C, E] = he(!0), I = We((O) => {
11030
11029
  E(O), g && g(!O), x && x(O);
11031
11030
  }, [g, x]), j = pt(() => {
11032
11031
  if (a)
@@ -12603,7 +12602,7 @@ var Ia = "PopperContent", [f0, h0] = Kd(Ia), Jd = m.forwardRef(
12603
12602
  xt(() => {
12604
12603
  q && (Y == null || Y());
12605
12604
  }, [q, Y]);
12606
- const ue = (B = L.arrow) == null ? void 0 : B.x, re = (P = L.arrow) == null ? void 0 : P.y, de = ((G = L.arrow) == null ? void 0 : G.centerOffset) !== 0, [fe, ye] = m.useState();
12605
+ const ue = (B = L.arrow) == null ? void 0 : B.x, re = (P = L.arrow) == null ? void 0 : P.y, de = ((G = L.arrow) == null ? void 0 : G.centerOffset) !== 0, [ge, ye] = m.useState();
12607
12606
  return xt(() => {
12608
12607
  x && ye(window.getComputedStyle(x).zIndex);
12609
12608
  }, [x]), /* @__PURE__ */ c.jsx(
@@ -12616,7 +12615,7 @@ var Ia = "PopperContent", [f0, h0] = Kd(Ia), Jd = m.forwardRef(
12616
12615
  transform: q ? V.transform : "translate(0, -200%)",
12617
12616
  // keep off the page when measuring
12618
12617
  minWidth: "max-content",
12619
- zIndex: fe,
12618
+ zIndex: ge,
12620
12619
  "--radix-popper-transform-origin": [
12621
12620
  (Z = L.transformOrigin) == null ? void 0 : Z.x,
12622
12621
  (le = L.transformOrigin) == null ? void 0 : le.y
@@ -13009,7 +13008,7 @@ var Ut = "MenuContent", [$0, ja] = Qn(Ut), vf = m.forwardRef(
13009
13008
  ...v
13010
13009
  } = e, g = er(Ut, n), x = so(Ut, n), b = Is(n), y = pf(n), R = P0(n), [S, C] = m.useState(null), E = m.useRef(null), I = Fe(t, E, g.onContentChange), j = m.useRef(0), N = m.useRef(""), O = m.useRef(0), M = m.useRef(null), D = m.useRef("right"), _ = m.useRef(0), V = w ? vs : m.Fragment, U = w ? { as: H0, allowPinchZoom: !0 } : void 0, q = (k) => {
13011
13010
  var B, P;
13012
- const W = N.current + k, Y = R().filter((G) => !G.disabled), ue = document.activeElement, re = (B = Y.find((G) => G.ref.current === ue)) == null ? void 0 : B.textValue, de = Y.map((G) => G.textValue), fe = eS(de, W, re), ye = (P = Y.find((G) => G.textValue === fe)) == null ? void 0 : P.ref.current;
13011
+ const W = N.current + k, Y = R().filter((G) => !G.disabled), ue = document.activeElement, re = (B = Y.find((G) => G.ref.current === ue)) == null ? void 0 : B.textValue, de = Y.map((G) => G.textValue), ge = eS(de, W, re), ye = (P = Y.find((G) => G.textValue === ge)) == null ? void 0 : P.ref.current;
13013
13012
  (function G(Z) {
13014
13013
  N.current = Z, window.clearTimeout(j.current), Z !== "" && (j.current = window.setTimeout(() => G(""), 1e3));
13015
13014
  })(W), ye && setTimeout(() => ye.focus());
@@ -13645,7 +13644,7 @@ const FS = MS, $S = DS, zS = m.forwardRef(({ className: e, inset: t, children: n
13645
13644
  rh,
13646
13645
  {
13647
13646
  ref: o,
13648
- className: X(
13647
+ className: J(
13649
13648
  "flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",
13650
13649
  t && "pl-8",
13651
13650
  e
@@ -13662,7 +13661,7 @@ const BS = m.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c.jsx(
13662
13661
  oh,
13663
13662
  {
13664
13663
  ref: n,
13665
- className: X(
13664
+ className: J(
13666
13665
  "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
13667
13666
  e
13668
13667
  ),
@@ -13675,7 +13674,7 @@ const sh = m.forwardRef(({ className: e, sideOffset: t = 4, ...n }, r) => /* @__
13675
13674
  {
13676
13675
  ref: r,
13677
13676
  sideOffset: t,
13678
- className: X(
13677
+ className: J(
13679
13678
  "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
13680
13679
  e
13681
13680
  ),
@@ -13687,7 +13686,7 @@ const Mi = m.forwardRef(({ className: e, inset: t, ...n }, r) => /* @__PURE__ */
13687
13686
  Zf,
13688
13687
  {
13689
13688
  ref: r,
13690
- className: X(
13689
+ className: J(
13691
13690
  "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
13692
13691
  t && "pl-8",
13693
13692
  e
@@ -13700,7 +13699,7 @@ const HS = m.forwardRef(({ className: e, children: t, checked: n, ...r }, o) =>
13700
13699
  Qf,
13701
13700
  {
13702
13701
  ref: o,
13703
- className: X(
13702
+ className: J(
13704
13703
  "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
13705
13704
  e
13706
13705
  ),
@@ -13717,7 +13716,7 @@ const US = m.forwardRef(({ className: e, children: t, ...n }, r) => /* @__PURE__
13717
13716
  eh,
13718
13717
  {
13719
13718
  ref: r,
13720
- className: X(
13719
+ className: J(
13721
13720
  "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
13722
13721
  e
13723
13722
  ),
@@ -13733,7 +13732,7 @@ const WS = m.forwardRef(({ className: e, inset: t, ...n }, r) => /* @__PURE__ */
13733
13732
  Jf,
13734
13733
  {
13735
13734
  ref: r,
13736
- className: X(
13735
+ className: J(
13737
13736
  "px-2 py-1.5 text-sm font-semibold",
13738
13737
  t && "pl-8",
13739
13738
  e
@@ -13746,7 +13745,7 @@ const VS = m.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c.jsx(
13746
13745
  nh,
13747
13746
  {
13748
13747
  ref: n,
13749
- className: X("-mx-1 my-1 h-px bg-muted", e),
13748
+ className: J("-mx-1 my-1 h-px bg-muted", e),
13750
13749
  ...t
13751
13750
  }
13752
13751
  ));
@@ -13786,17 +13785,17 @@ function ci({
13786
13785
  streamingAssistantId: M,
13787
13786
  lastCheckpointId: D,
13788
13787
  lastCheckpointNs: _
13789
- } = sx(), [V, U] = pe(null), [q, L] = pe(""), [k, W] = pe(null), [Y, ue] = pe([]), [re, de] = pe(0), [fe, ye] = pe(0), [B, P] = pe(!1), [G, Z] = pe(null), [le, oe] = pe(null), [Me, Ge] = pe(!1), [Ye, Ee] = pe(null), [_e, Qe] = pe([]), [je, st] = pe(null), [at, Q] = pe(null), [ae, he] = pe(!1), Se = ut(null), ve = ut(null), Ne = ut(null), et = Ue(() => {
13788
+ } = sx(), [V, U] = he(null), [q, L] = he(""), [k, W] = he(null), [Y, ue] = he([]), [re, de] = he(0), [ge, ye] = he(0), [B, P] = he(!1), [G, Z] = he(null), [le, oe] = he(null), [Me, Ge] = he(!1), [Ye, Ee] = he(null), [_e, Qe] = he([]), [je, st] = he(null), [at, Q] = he(null), [ae, fe] = he(!1), Se = ut(null), ve = ut(null), Ne = ut(null), et = We(() => {
13790
13789
  Se.current && (Se.current.value = ""), ve.current && (ve.current.value = ""), de((se) => se + 1), ye((se) => se + 1);
13791
13790
  }, []), Ve = ut(!1);
13792
13791
  gt(() => {
13793
13792
  Ve.current && !N && (ue([]), et()), Ve.current = N;
13794
13793
  }, [N, et]);
13795
- const [F, J] = pe("desktop");
13794
+ const [F, X] = he("desktop");
13796
13795
  gt(() => {
13797
13796
  const se = () => {
13798
13797
  const xe = window.innerWidth;
13799
- J(xe < 640 ? "phone" : xe < 1024 ? "tablet" : "desktop");
13798
+ X(xe < 640 ? "phone" : xe < 1024 ? "tablet" : "desktop");
13800
13799
  };
13801
13800
  return se(), window.addEventListener("resize", se), () => window.removeEventListener("resize", se);
13802
13801
  }, []), gt(() => {
@@ -13831,7 +13830,7 @@ function ci({
13831
13830
  }, [v, D, _, je, x]), gt(() => {
13832
13831
  D && (st(D), Q(_ ?? null));
13833
13832
  }, [D, _]);
13834
- const Ce = Ue(async () => {
13833
+ const Ce = We(async () => {
13835
13834
  if (!(!S || C))
13836
13835
  try {
13837
13836
  await j();
@@ -13889,9 +13888,9 @@ function ci({
13889
13888
  u && (U(se), L(xe), W(null));
13890
13889
  }, [u]), At = z.useCallback(() => {
13891
13890
  U(null), L(""), W(null);
13892
- }, []), tr = Ue((se, xe) => {
13891
+ }, []), tr = We((se, xe) => {
13893
13892
  it(se, xe);
13894
- }, [it]), Pn = Ue((se) => {
13893
+ }, [it]), Pn = We((se) => {
13895
13894
  const xe = ($e) => {
13896
13895
  const rt = $e.content || [], jt = rt.filter((tn) => tn.type === "text").map((tn) => tn.text).join("");
13897
13896
  if (jt) return jt;
@@ -13943,7 +13942,7 @@ function ci({
13943
13942
  return Number.isNaN(xe) ? se : new Date(xe).toLocaleString();
13944
13943
  }, en = async (se) => {
13945
13944
  if (v) {
13946
- he(!0);
13945
+ fe(!0);
13947
13946
  try {
13948
13947
  if (!se) {
13949
13948
  await y(), st(null), Q(null);
@@ -13952,7 +13951,7 @@ function ci({
13952
13951
  const xe = _e.find((rt) => rt.checkpointId === se), $e = (xe == null ? void 0 : xe.checkpointNs) ?? null;
13953
13952
  await b(se, $e), st(se), Q($e);
13954
13953
  } finally {
13955
- he(!1);
13954
+ fe(!1);
13956
13955
  }
13957
13956
  }
13958
13957
  }, io = `flex flex-1 w-full flex-col min-h-0 min-w-0 max-h-full overflow-hidden bg-transparent ${e} ${d.container || ""}`, Tr = `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 || ""}`, Ls = `flex-shrink-0 w-full border-t p-4 bg-transparent ${d.inputArea || ""}`;
@@ -14084,7 +14083,7 @@ function ci({
14084
14083
  onChange: On,
14085
14084
  className: "hidden"
14086
14085
  },
14087
- fe
14086
+ ge
14088
14087
  ),
14089
14088
  B && /* @__PURE__ */ c.jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
14090
14089
  /* @__PURE__ */ c.jsx(fi, { className: "h-4 w-4 animate-spin" }),
@@ -14158,7 +14157,7 @@ const Xo = m.forwardRef(
14158
14157
  "input",
14159
14158
  {
14160
14159
  type: t,
14161
- className: X(
14160
+ className: J(
14162
14161
  "flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
14163
14162
  e
14164
14163
  ),
@@ -14686,7 +14685,7 @@ const wh = m.forwardRef(({ className: e, children: t, ...n }, r) => /* @__PURE__
14686
14685
  vh,
14687
14686
  {
14688
14687
  ref: r,
14689
- className: X("relative overflow-hidden", e),
14688
+ className: J("relative overflow-hidden", e),
14690
14689
  ...n,
14691
14690
  children: [
14692
14691
  /* @__PURE__ */ c.jsx(rC, { className: "h-full w-full rounded-[inherit] overflow-auto", children: t }),
@@ -14701,7 +14700,7 @@ const bh = m.forwardRef(({ className: e, orientation: t = "vertical", ...n }, r)
14701
14700
  {
14702
14701
  ref: r,
14703
14702
  orientation: t,
14704
- className: X(
14703
+ className: J(
14705
14704
  "flex touch-none select-none transition-colors",
14706
14705
  t === "vertical" && "h-full w-2.5 border-l border-l-transparent p-[1px]",
14707
14706
  t === "horizontal" && "h-2.5 flex-col border-t border-t-transparent p-[1px]",
@@ -14733,7 +14732,7 @@ function wc({
14733
14732
  deleteThread: v,
14734
14733
  renameThread: g,
14735
14734
  isLoadingThreads: x
14736
- } = Gi(), [b, y] = pe(h ?? []), [R, S] = pe(null), [C, E] = pe(""), [I, j] = pe(!1);
14735
+ } = Gi(), [b, y] = he(h ?? []), [R, S] = he(null), [C, E] = he(""), [I, j] = he(!1);
14737
14736
  gt(() => {
14738
14737
  y(h ?? []);
14739
14738
  }, [h]);
@@ -14971,7 +14970,7 @@ const dC = ts(
14971
14970
  Eh,
14972
14971
  {
14973
14972
  ref: n,
14974
- className: X(dC(), e),
14973
+ className: J(dC(), e),
14975
14974
  ...t
14976
14975
  }
14977
14976
  ));
@@ -15100,7 +15099,7 @@ var Ph = Ih, gC = Ah;
15100
15099
  const Sn = m.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c.jsx(
15101
15100
  Ph,
15102
15101
  {
15103
- className: X(
15102
+ className: J(
15104
15103
  "peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",
15105
15104
  e
15106
15105
  ),
@@ -15109,7 +15108,7 @@ const Sn = m.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c.jsx(
15109
15108
  children: /* @__PURE__ */ c.jsx(
15110
15109
  gC,
15111
15110
  {
15112
- className: X(
15111
+ className: J(
15113
15112
  "pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0"
15114
15113
  )
15115
15114
  }
@@ -15396,7 +15395,7 @@ var Kt = 10, [Uh, _n] = Cr(Yn), kC = "SelectContentImpl", IC = hr("SelectContent
15396
15395
  (b.value !== void 0 && b.value === P || Z) && O(B);
15397
15396
  },
15398
15397
  [b.value]
15399
- ), fe = r === "popper" ? Li : Vh, ye = fe === Li ? {
15398
+ ), ge = r === "popper" ? Li : Vh, ye = ge === Li ? {
15400
15399
  side: a,
15401
15400
  sideOffset: l,
15402
15401
  align: u,
@@ -15446,7 +15445,7 @@ var Kt = 10, [Uh, _n] = Cr(Yn), kC = "SelectContentImpl", IC = hr("SelectContent
15446
15445
  onFocusOutside: (B) => B.preventDefault(),
15447
15446
  onDismiss: () => b.onOpenChange(!1),
15448
15447
  children: /* @__PURE__ */ c.jsx(
15449
- fe,
15448
+ ge,
15450
15449
  {
15451
15450
  role: "listbox",
15452
15451
  id: b.contentId,
@@ -15509,12 +15508,12 @@ var NC = "SelectItemAlignedPosition", Vh = m.forwardRef((e, t) => {
15509
15508
  ]);
15510
15509
  a.style.minWidth = Ge + "px", a.style.right = _e + "px";
15511
15510
  }
15512
- const O = h(), M = window.innerHeight - Kt * 2, D = v.scrollHeight, _ = window.getComputedStyle(u), V = parseInt(_.borderTopWidth, 10), U = parseInt(_.paddingTop, 10), q = parseInt(_.borderBottomWidth, 10), L = parseInt(_.paddingBottom, 10), k = V + U + D + L + q, W = Math.min(g.offsetHeight * 5, k), Y = window.getComputedStyle(v), ue = parseInt(Y.paddingTop, 10), re = parseInt(Y.paddingBottom, 10), de = E.top + E.height / 2 - Kt, fe = M - de, ye = g.offsetHeight / 2, B = g.offsetTop + ye, P = V + U + B, G = k - P;
15511
+ const O = h(), M = window.innerHeight - Kt * 2, D = v.scrollHeight, _ = window.getComputedStyle(u), V = parseInt(_.borderTopWidth, 10), U = parseInt(_.paddingTop, 10), q = parseInt(_.borderBottomWidth, 10), L = parseInt(_.paddingBottom, 10), k = V + U + D + L + q, W = Math.min(g.offsetHeight * 5, k), Y = window.getComputedStyle(v), ue = parseInt(Y.paddingTop, 10), re = parseInt(Y.paddingBottom, 10), de = E.top + E.height / 2 - Kt, ge = M - de, ye = g.offsetHeight / 2, B = g.offsetTop + ye, P = V + U + B, G = k - P;
15513
15512
  if (P <= de) {
15514
15513
  const le = O.length > 0 && g === O[O.length - 1].ref.current;
15515
15514
  a.style.bottom = "0px";
15516
15515
  const oe = u.clientHeight - v.offsetTop - v.offsetHeight, Me = Math.max(
15517
- fe,
15516
+ ge,
15518
15517
  ye + // viewport might have padding bottom, include it to avoid a scrollable viewport
15519
15518
  (le ? re : 0) + oe + q
15520
15519
  ), Ge = P + Me;
@@ -15949,7 +15948,7 @@ const bc = zC, yc = BC, Hi = m.forwardRef(({ className: e, children: t, ...n },
15949
15948
  cp,
15950
15949
  {
15951
15950
  ref: r,
15952
- className: X(
15951
+ className: J(
15953
15952
  "flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
15954
15953
  e
15955
15954
  ),
@@ -15965,7 +15964,7 @@ const gp = m.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c.jsx(
15965
15964
  hp,
15966
15965
  {
15967
15966
  ref: n,
15968
- className: X(
15967
+ className: J(
15969
15968
  "flex cursor-default items-center justify-center py-1",
15970
15969
  e
15971
15970
  ),
@@ -15978,7 +15977,7 @@ const xp = m.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c.jsx(
15978
15977
  pp,
15979
15978
  {
15980
15979
  ref: n,
15981
- className: X(
15980
+ className: J(
15982
15981
  "flex cursor-default items-center justify-center py-1",
15983
15982
  e
15984
15983
  ),
@@ -15991,7 +15990,7 @@ const Ui = m.forwardRef(({ className: e, children: t, position: n = "popper", ..
15991
15990
  up,
15992
15991
  {
15993
15992
  ref: o,
15994
- className: X(
15993
+ className: J(
15995
15994
  "relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
15996
15995
  n === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
15997
15996
  e
@@ -16003,7 +16002,7 @@ const Ui = m.forwardRef(({ className: e, children: t, position: n = "popper", ..
16003
16002
  /* @__PURE__ */ c.jsx(
16004
16003
  WC,
16005
16004
  {
16006
- className: X(
16005
+ className: J(
16007
16006
  "p-1",
16008
16007
  n === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
16009
16008
  ),
@@ -16019,7 +16018,7 @@ const qC = m.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c.jsx(
16019
16018
  dp,
16020
16019
  {
16021
16020
  ref: n,
16022
- className: X("py-1.5 pl-8 pr-2 text-sm font-semibold", e),
16021
+ className: J("py-1.5 pl-8 pr-2 text-sm font-semibold", e),
16023
16022
  ...t
16024
16023
  }
16025
16024
  ));
@@ -16028,7 +16027,7 @@ const Ln = m.forwardRef(({ className: e, children: t, ...n }, r) => /* @__PURE__
16028
16027
  fp,
16029
16028
  {
16030
16029
  ref: r,
16031
- className: X(
16030
+ className: J(
16032
16031
  "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
16033
16032
  e
16034
16033
  ),
@@ -16044,7 +16043,7 @@ const GC = m.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c.jsx(
16044
16043
  mp,
16045
16044
  {
16046
16045
  ref: n,
16047
- className: X("-mx-1 my-1 h-px bg-muted", e),
16046
+ className: J("-mx-1 my-1 h-px bg-muted", e),
16048
16047
  ...t
16049
16048
  }
16050
16049
  ));
@@ -16073,7 +16072,7 @@ const bp = m.forwardRef(
16073
16072
  ref: o,
16074
16073
  decorative: n,
16075
16074
  orientation: t,
16076
- className: X(
16075
+ className: J(
16077
16076
  "shrink-0 bg-border",
16078
16077
  t === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
16079
16078
  e
@@ -16086,7 +16085,7 @@ bp.displayName = wp.displayName;
16086
16085
  const ZC = Cd, QC = jb, eT = Td, yp = m.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c.jsx(
16087
16086
  bs,
16088
16087
  {
16089
- className: X(
16088
+ className: J(
16090
16089
  "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
16091
16090
  e
16092
16091
  ),
@@ -16116,7 +16115,7 @@ const tT = ts(
16116
16115
  ys,
16117
16116
  {
16118
16117
  ref: o,
16119
- className: X(tT({ side: e }), t),
16118
+ className: J(tT({ side: e }), t),
16120
16119
  ...r,
16121
16120
  children: [
16122
16121
  n,
@@ -16135,7 +16134,7 @@ const Cp = ({
16135
16134
  }) => /* @__PURE__ */ c.jsx(
16136
16135
  "div",
16137
16136
  {
16138
- className: X(
16137
+ className: J(
16139
16138
  "flex flex-col space-y-2 text-center sm:text-left",
16140
16139
  e
16141
16140
  ),
@@ -16147,7 +16146,7 @@ const Tp = m.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c.jsx(
16147
16146
  Bn,
16148
16147
  {
16149
16148
  ref: n,
16150
- className: X("text-lg font-semibold text-foreground", e),
16149
+ className: J("text-lg font-semibold text-foreground", e),
16151
16150
  ...t
16152
16151
  }
16153
16152
  ));
@@ -16156,7 +16155,7 @@ const Rp = m.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c.jsx(
16156
16155
  Ss,
16157
16156
  {
16158
16157
  ref: n,
16159
- className: X("text-sm text-muted-foreground", e),
16158
+ className: J("text-sm text-muted-foreground", e),
16160
16159
  ...t
16161
16160
  }
16162
16161
  ));
@@ -16181,7 +16180,7 @@ const nT = {
16181
16180
  }
16182
16181
  };
16183
16182
  function $T({ settings: e, onSettingsChange: t, className: n = "" }) {
16184
- const [r, o] = pe(!1), [s, i] = pe(!1), [a, l] = pe(e), [u, d] = pe(!1), { toast: f } = ha();
16183
+ const [r, o] = he(!1), [s, i] = he(!1), [a, l] = he(e), [u, d] = he(!1), { toast: f } = ha();
16185
16184
  gt(() => {
16186
16185
  const g = JSON.stringify(a) !== JSON.stringify(e);
16187
16186
  d(g);