teodor-new-chat-ui 4.1.11 → 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";
@@ -136,14 +136,14 @@ function om() {
136
136
  }
137
137
  return null;
138
138
  }
139
- var _ = Object.assign, V = 0, U, q, F, k, W, Y, ue;
139
+ var _ = Object.assign, V = 0, U, q, L, k, W, Y, ue;
140
140
  function re() {
141
141
  }
142
142
  re.__reactDisabledLog = !0;
143
143
  function de() {
144
144
  {
145
145
  if (V === 0) {
146
- U = console.log, q = console.info, F = console.warn, k = console.error, W = console.group, Y = console.groupCollapsed, ue = console.groupEnd;
146
+ U = console.log, q = console.info, L = console.warn, k = console.error, W = console.group, Y = console.groupCollapsed, ue = console.groupEnd;
147
147
  var T = {
148
148
  configurable: !0,
149
149
  enumerable: !0,
@@ -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 = {
@@ -179,7 +179,7 @@ function om() {
179
179
  value: q
180
180
  }),
181
181
  warn: _({}, T, {
182
- value: F
182
+ value: L
183
183
  }),
184
184
  error: _({}, T, {
185
185
  value: k
@@ -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 = {
@@ -380,7 +380,7 @@ function om() {
380
380
  ref: !0,
381
381
  __self: !0,
382
382
  __source: !0
383
- }, Ve, L;
383
+ }, Ve, F;
384
384
  function X(T) {
385
385
  if (Ee.call(T, "ref")) {
386
386
  var H = Object.getOwnPropertyDescriptor(T, "ref").get;
@@ -414,7 +414,7 @@ function om() {
414
414
  function it(T, H) {
415
415
  {
416
416
  var ee = function() {
417
- L || (L = !0, b("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", H));
417
+ F || (F = !0, b("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", H));
418
418
  };
419
419
  ee.isReactWarning = !0, Object.defineProperty(T, "ref", {
420
420
  get: ee,
@@ -1900,32 +1900,32 @@ const Wc = (e) => {
1900
1900
  credentials: U ? j : void 0
1901
1901
  };
1902
1902
  D = s && new n(v, q);
1903
- let F = await (s ? O(D, N) : O(v, q));
1903
+ let L = await (s ? O(D, N) : O(v, q));
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] = F[fe];
1907
+ ["status", "statusText", "headers"].forEach((ge) => {
1908
+ Y[ge] = L[ge];
1909
1909
  });
1910
- const ue = A.toFiniteNumber(F.headers.get("content-length")), [re, de] = S && Qa(
1910
+ const ue = A.toFiniteNumber(L.headers.get("content-length")), [re, de] = S && Qa(
1911
1911
  ue,
1912
1912
  Mo(el(S), !0)
1913
1913
  ) || [];
1914
- F = new r(
1915
- nl(F.body, rl, re, () => {
1914
+ L = new r(
1915
+ nl(L.body, rl, re, () => {
1916
1916
  de && de(), _ && _();
1917
1917
  }),
1918
1918
  Y
1919
1919
  );
1920
1920
  }
1921
1921
  E = E || "text";
1922
- let W = await f[A.findKey(f, E) || "text"](F, w);
1922
+ let W = await f[A.findKey(f, E) || "text"](L, w);
1923
1923
  return !k && _ && _(), await new Promise((Y, ue) => {
1924
1924
  Hc(Y, ue, {
1925
1925
  data: W,
1926
- headers: It.from(F.headers),
1927
- status: F.status,
1928
- statusText: F.statusText,
1926
+ headers: It.from(L.headers),
1927
+ status: L.status,
1928
+ statusText: L.statusText,
1929
1929
  config: w,
1930
1930
  request: D
1931
1931
  });
@@ -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,27 +2896,27 @@ 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();
2910
2910
  return y.current = D, (async () => {
2911
- var V, U, q, F, k, W, Y, ue;
2911
+ var V, U, q, L, k, W, Y, ue;
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;
@@ -2990,8 +2990,8 @@ function Zg(e = {}) {
2990
2990
  }, 5e3), Ye = 1024 * 1024;
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
- for ((F = M == null ? void 0 : M.onOpen) == null || F.call(M, { threadId: Qe, created: je }); ; ) {
2994
- const { value: st, done: at } = await fe.read();
2993
+ for ((L = M == null ? void 0 : M.onOpen) == null || L.call(M, { threadId: Qe, created: je }); ; ) {
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) {
@@ -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,22 +3155,22 @@ 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,
3162
3162
  pushUser: U,
3163
3163
  onEvent: q,
3164
- reset: F
3164
+ reset: L
3165
3165
  } = Vg(), k = ut(p);
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((L, X) => 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 {
3173
- await L(), Ce();
3173
+ await F(), Ce();
3174
3174
  } catch (it) {
3175
3175
  Oe(it);
3176
3176
  } finally {
@@ -3183,55 +3183,47 @@ 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
- const L = await l.listThreads();
3190
- h(L);
3191
- } catch (L) {
3192
- i == null || i(String(L)), console.error("[ChatSessionProvider] Failed to refresh threads:", L);
3189
+ const F = await l.listThreads();
3190
+ h(F);
3191
+ } catch (F) {
3192
+ i == null || i(String(F)), console.error("[ChatSessionProvider] Failed to refresh threads:", F);
3193
3193
  } finally {
3194
3194
  g(!1);
3195
3195
  }
3196
- }, [l, i]);
3197
- Ue(async () => {
3198
- try {
3199
- await fe();
3200
- } catch (L) {
3201
- console.error("[ChatSessionProvider] Failed to refresh threads after stream:", L);
3202
- }
3203
- }, [fe]);
3204
- const ye = ut(!1), B = Ue(
3205
- (L, X) => {
3206
- const Ce = Array.isArray(L == null ? void 0 : L.messages) ? L.messages : [];
3196
+ }, [l, i]), ye = ut(!1), B = We(
3197
+ (F, X) => {
3198
+ const Ce = Array.isArray(F == null ? void 0 : F.messages) ? F.messages : [];
3207
3199
  X === "replace" ? _(Ce, {
3208
- checkpointId: (L == null ? void 0 : L.checkpointId) ?? null,
3209
- checkpointNs: (L == null ? void 0 : L.checkpointNs) ?? null
3210
- }) : X === "prepend" && Ce.length && V(Ce), I((L == null ? void 0 : L.nextCursor) ?? null), R(!!(L != null && L.hasMore)), N((Oe) => (L == null ? void 0 : L.checkpointId) ?? Oe ?? void 0), M((Oe) => (L == null ? void 0 : L.checkpointNs) ?? Oe ?? void 0);
3200
+ checkpointId: (F == null ? void 0 : F.checkpointId) ?? null,
3201
+ checkpointNs: (F == null ? void 0 : F.checkpointNs) ?? null
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(() => {
3214
- F([]), R(!1), C(!1), I(null), N(void 0), M(void 0);
3215
- }, [F]), G = Ue(({ from: L, to: X }) => {
3205
+ ), P = We(() => {
3206
+ L([]), R(!1), C(!1), I(null), N(void 0), M(void 0);
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 (${L} -> ${X}) for thread ${Ce}`
3210
+ `[ChatSessionProvider] Stream sequence gap detected (${F} -> ${X}) for thread ${Ce}`
3219
3211
  );
3220
- }, []), Z = Ue(
3221
- (L) => {
3222
- const X = L.threadId;
3212
+ }, []), Z = We(
3213
+ (F) => {
3214
+ const X = F.threadId;
3223
3215
  console.log("[ChatSessionProvider] 📥 Handling thread_info event:", {
3224
3216
  threadId: X,
3225
- title: L.title,
3226
- created: L.created,
3217
+ title: F.title,
3218
+ created: F.created,
3227
3219
  currentThreads: f.length
3228
3220
  });
3229
3221
  const Ce = {
3230
3222
  threadId: X,
3231
- title: L.title || `Thread ${X.slice(0, 8)}`,
3232
- createdAt: L.createdAt || (/* @__PURE__ */ new Date()).toISOString(),
3233
- updatedAt: L.updatedAt || (/* @__PURE__ */ new Date()).toISOString(),
3234
- messageCount: L.messageCount || 0
3223
+ title: F.title || `Thread ${X.slice(0, 8)}`,
3224
+ createdAt: F.createdAt || (/* @__PURE__ */ new Date()).toISOString(),
3225
+ updatedAt: F.updatedAt || (/* @__PURE__ */ new Date()).toISOString(),
3226
+ messageCount: F.messageCount || 0
3235
3227
  };
3236
3228
  k.current !== X && (!k.current && D.messages.length <= 1 && (re.current = X), w(X)), h((Oe) => {
3237
3229
  const De = Oe.findIndex((it) => it.threadId === X);
@@ -3247,8 +3239,8 @@ function ox({
3247
3239
  baseUrl: d,
3248
3240
  onThreadInfo: Z,
3249
3241
  onMessageEvent: q,
3250
- onUnhandledEvent: (L) => {
3251
- console.warn(`[ChatSessionProvider] Unhandled stream event: ${L.type}`, L);
3242
+ onUnhandledEvent: (F) => {
3243
+ console.warn(`[ChatSessionProvider] Unhandled stream event: ${F.type}`, F);
3252
3244
  },
3253
3245
  onSequenceGap: G
3254
3246
  });
@@ -3256,8 +3248,8 @@ function ox({
3256
3248
  ye.current = Me;
3257
3249
  }, [Me]), gt(() => {
3258
3250
  var Ce;
3259
- const L = l.getAuthToken();
3260
- Ye(L);
3251
+ const F = l.getAuthToken();
3252
+ Ye(F);
3261
3253
  const X = (Ce = l.onTokenChange) == null ? void 0 : Ce.call(l, (Oe) => {
3262
3254
  Ye(Oe);
3263
3255
  });
@@ -3265,52 +3257,52 @@ function ox({
3265
3257
  X == null || X();
3266
3258
  };
3267
3259
  }, [l, Ye]);
3268
- const Ee = Ue(
3269
- async (L) => {
3260
+ const Ee = We(
3261
+ async (F) => {
3270
3262
  const X = `temp-${Date.now()}`, Ce = {
3271
3263
  threadId: X,
3272
- title: L || "New Chat",
3264
+ title: F || "New Chat",
3273
3265
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
3274
3266
  updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
3275
3267
  messageCount: 0
3276
3268
  };
3277
3269
  h((Oe) => [Ce, ...Oe]), w(X);
3278
3270
  try {
3279
- const Oe = await l.createThread(L), De = typeof Oe == "string" ? Oe : Oe.threadId;
3271
+ const Oe = await l.createThread(F), De = typeof Oe == "string" ? Oe : Oe.threadId;
3280
3272
  return h((it) => it.map(
3281
3273
  (At) => At.threadId === X ? { ...At, threadId: De } : At
3282
- )), w(De), setTimeout(() => fe(), 10), De;
3274
+ )), w(De), setTimeout(() => ge(), 10), De;
3283
3275
  } catch (Oe) {
3284
3276
  throw h((De) => De.filter((it) => it.threadId !== X)), w(null), Oe;
3285
3277
  }
3286
3278
  },
3287
- [l, fe]
3288
- ), _e = Ue(
3289
- async (L) => {
3290
- await l.deleteThread(L), k.current === L && (re.current = L, w(null), P()), await fe();
3279
+ [l, ge]
3280
+ ), _e = We(
3281
+ async (F) => {
3282
+ await l.deleteThread(F), k.current === F && (re.current = F, w(null), P()), await ge();
3291
3283
  },
3292
- [l, P, fe]
3293
- ), Qe = Ue(
3294
- async (L, X) => {
3284
+ [l, P, ge]
3285
+ ), Qe = We(
3286
+ async (F, X) => {
3295
3287
  try {
3296
- await l.updateThread(L, X), h((Ce) => Ce.map((Oe) => Oe.threadId === L ? { ...Oe, title: X } : Oe));
3288
+ await l.updateThread(F, X), h((Ce) => Ce.map((Oe) => Oe.threadId === F ? { ...Oe, title: X } : Oe));
3297
3289
  } catch (Ce) {
3298
- throw await fe(), Ce;
3290
+ throw await ge(), Ce;
3299
3291
  }
3300
3292
  },
3301
- [l, fe]
3302
- ), je = Ue(
3303
- async (L, X, Ce, Oe = !1) => {
3293
+ [l, ge]
3294
+ ), je = We(
3295
+ async (F, X, Ce, Oe = !1) => {
3304
3296
  await de(async () => {
3305
- if (re.current === L && !Oe) {
3297
+ if (re.current === F && !Oe) {
3306
3298
  re.current = null;
3307
3299
  return;
3308
3300
  }
3309
- if (!(ue.current === L && !Oe)) {
3310
- w((De) => De === L ? De : L), ue.current = L, b(!0);
3301
+ if (!(ue.current === F && !Oe)) {
3302
+ w((De) => De === F ? De : F), ue.current = F, b(!0);
3311
3303
  try {
3312
3304
  const De = await l.getMessages({
3313
- threadId: L,
3305
+ threadId: F,
3314
3306
  checkpointId: X,
3315
3307
  checkpointNs: Ce
3316
3308
  });
@@ -3321,35 +3313,35 @@ function ox({
3321
3313
  ue.current = null, b(!1);
3322
3314
  }
3323
3315
  }
3324
- }, `loadThread-${L}`);
3316
+ }, `loadThread-${F}`);
3325
3317
  },
3326
3318
  [l, B, de, i]
3327
- ), st = Ue(async () => {
3319
+ ), st = We(async () => {
3328
3320
  await de(async () => {
3329
3321
  k.current && (re.current = k.current), w(null), P(), N(void 0), M(void 0);
3330
3322
  try {
3331
3323
  localStorage.removeItem("lastThreadId");
3332
- } catch (L) {
3333
- console.warn("[ChatSessionProvider] Failed to clear lastThreadId:", L);
3324
+ } catch (F) {
3325
+ console.warn("[ChatSessionProvider] Failed to clear lastThreadId:", F);
3334
3326
  }
3335
3327
  }, "clearCurrentThread");
3336
- }, [P, de]), at = Ue(
3337
- async (L) => {
3338
- const X = await l.listCheckpoints(L);
3339
- return $g(X, L);
3328
+ }, [P, de]), at = We(
3329
+ async (F) => {
3330
+ const X = await l.listCheckpoints(F);
3331
+ return $g(X, F);
3340
3332
  },
3341
3333
  [l]
3342
- ), Q = Ue(
3343
- async (L, X) => {
3334
+ ), Q = We(
3335
+ async (F, X) => {
3344
3336
  if (!k.current) throw new Error("No active thread");
3345
- await je(k.current, L, X ?? void 0, !0);
3337
+ await je(k.current, F, X ?? void 0, !0);
3346
3338
  },
3347
3339
  [je]
3348
- ), ae = Ue(async () => {
3340
+ ), ae = We(async () => {
3349
3341
  if (!k.current) throw new Error("No active thread");
3350
3342
  await je(k.current, void 0, void 0, !0);
3351
- }, [je]), he = Ue(
3352
- async (L) => {
3343
+ }, [je]), fe = We(
3344
+ async (F) => {
3353
3345
  if (!k.current) throw new Error("No active thread");
3354
3346
  if (S || !y) return;
3355
3347
  const X = E;
@@ -3360,7 +3352,7 @@ function ox({
3360
3352
  threadId: k.current,
3361
3353
  checkpointId: j,
3362
3354
  checkpointNs: O,
3363
- limit: (L == null ? void 0 : L.limit) ?? rx,
3355
+ limit: (F == null ? void 0 : F.limit) ?? rx,
3364
3356
  beforeId: X
3365
3357
  });
3366
3358
  B(Ce, "prepend");
@@ -3378,8 +3370,8 @@ function ox({
3378
3370
  E,
3379
3371
  S
3380
3372
  ]
3381
- ), Se = Ue(
3382
- async (L, X) => {
3373
+ ), Se = We(
3374
+ async (F, X) => {
3383
3375
  var bn;
3384
3376
  const Ce = k.current;
3385
3377
  !Ce && !(X != null && X.payloadExtras) && console.warn("[ChatSessionProvider] No thread ID - message will create new thread");
@@ -3387,7 +3379,7 @@ function ox({
3387
3379
  l,
3388
3380
  Oe
3389
3381
  ), At = [...De];
3390
- L && L.trim() && At.push({ type: "text", text: L.trim() });
3382
+ F && F.trim() && At.push({ type: "text", text: F.trim() });
3391
3383
  const tr = {
3392
3384
  id: ((bn = crypto.randomUUID) == null ? void 0 : bn.call(crypto)) || `user-${Date.now()}`,
3393
3385
  role: "user",
@@ -3431,8 +3423,8 @@ function ox({
3431
3423
  U,
3432
3424
  le
3433
3425
  ]
3434
- ), ve = Ue(
3435
- async (L, X, Ce) => {
3426
+ ), ve = We(
3427
+ async (F, X, Ce) => {
3436
3428
  const Oe = k.current;
3437
3429
  if (!Oe)
3438
3430
  throw new Error("No active thread to handle interrupt");
@@ -3440,7 +3432,7 @@ function ox({
3440
3432
  const De = X ? Ce ?? !0 : !1;
3441
3433
  await l.resume({ threadId: Oe, value: De });
3442
3434
  } catch (De) {
3443
- throw console.error(`[ChatSessionProvider] Failed to handle interrupt ${L}:`, De), De;
3435
+ throw console.error(`[ChatSessionProvider] Failed to handle interrupt ${F}:`, De), De;
3444
3436
  }
3445
3437
  },
3446
3438
  [l]
@@ -3449,14 +3441,14 @@ function ox({
3449
3441
  if (a == null || a(p), p)
3450
3442
  try {
3451
3443
  localStorage.setItem("lastThreadId", p);
3452
- } catch (L) {
3453
- console.warn("[ChatSessionProvider] Failed to persist lastThreadId:", L);
3444
+ } catch (F) {
3445
+ console.warn("[ChatSessionProvider] Failed to persist lastThreadId:", F);
3454
3446
  }
3455
3447
  }, [p, a]), gt(() => {
3456
- let L = !0;
3448
+ let F = !0;
3457
3449
  return (async () => {
3458
3450
  try {
3459
- if (await fe(), !L) return;
3451
+ if (await ge(), !F) return;
3460
3452
  if (!r && !t)
3461
3453
  try {
3462
3454
  const Ce = localStorage.getItem("lastThreadId");
@@ -3469,7 +3461,7 @@ function ox({
3469
3461
  console.error("[ChatSessionProvider] Initialization failed:", Ce), i == null || i(String(Ce));
3470
3462
  }
3471
3463
  })(), () => {
3472
- L = !1;
3464
+ F = !1;
3473
3465
  };
3474
3466
  }, []);
3475
3467
  const Ne = pt(
@@ -3482,7 +3474,7 @@ function ox({
3482
3474
  createThread: Ee,
3483
3475
  deleteThread: _e,
3484
3476
  renameThread: Qe,
3485
- refreshThreads: fe,
3477
+ refreshThreads: ge,
3486
3478
  loadThread: je,
3487
3479
  clearCurrentThread: st,
3488
3480
  listCheckpoints: at,
@@ -3499,7 +3491,7 @@ function ox({
3499
3491
  at,
3500
3492
  je,
3501
3493
  Q,
3502
- fe,
3494
+ ge,
3503
3495
  Qe,
3504
3496
  ae,
3505
3497
  f
@@ -3513,7 +3505,7 @@ function ox({
3513
3505
  isLoadingHistory: S,
3514
3506
  send: Se,
3515
3507
  stop: oe,
3516
- loadOlderMessages: he,
3508
+ loadOlderMessages: fe,
3517
3509
  clearMessages: P,
3518
3510
  handleInterrupt: ve
3519
3511
  }),
@@ -3522,7 +3514,7 @@ function ox({
3522
3514
  ve,
3523
3515
  y,
3524
3516
  S,
3525
- he,
3517
+ fe,
3526
3518
  D.assemblingId,
3527
3519
  D.messages,
3528
3520
  Se,
@@ -3930,7 +3922,7 @@ function ze() {
3930
3922
  function Mt(e) {
3931
3923
  return cs(ze(), (t) => ce(e, t));
3932
3924
  }
3933
- function We(e, t = [], { singleton: n } = { singleton: !0 }) {
3925
+ function Ue(e, t = [], { singleton: n } = { singleton: !0 }) {
3934
3926
  return {
3935
3927
  constructor: e,
3936
3928
  dependencies: t,
@@ -3987,7 +3979,7 @@ const xx = {
3987
3979
  3: "error",
3988
3980
  1: "log",
3989
3981
  2: "warn"
3990
- }, vx = () => typeof globalThis > "u" ? window : globalThis, Nn = We(
3982
+ }, vx = () => typeof globalThis > "u" ? window : globalThis, Nn = Ue(
3991
3983
  () => {
3992
3984
  const e = K(
3993
3985
  3
@@ -4115,7 +4107,7 @@ function iu(e, t, n) {
4115
4107
  }
4116
4108
  }, [a, t, i]), s;
4117
4109
  }
4118
- const Tt = We(
4110
+ const Tt = Ue(
4119
4111
  () => {
4120
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);
4121
4113
  return ce(
@@ -4296,7 +4288,7 @@ function fu(e, t) {
4296
4288
  function zr(e, t) {
4297
4289
  return !!(e && e[0] === t[0] && e[1] === t[1]);
4298
4290
  }
4299
- const Zi = We(
4291
+ const Zi = Ue(
4300
4292
  () => ({ recalcInProgress: K(!1) }),
4301
4293
  [],
4302
4294
  { singleton: !0 }
@@ -4463,7 +4455,7 @@ function jx(e) {
4463
4455
  const _x = {
4464
4456
  offsetHeight: "height",
4465
4457
  offsetWidth: "width"
4466
- }, dn = We(
4458
+ }, dn = Ue(
4467
4459
  ([{ log: e }, { recalcInProgress: t }]) => {
4468
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(
4469
4461
  $(n, Pe(l, e, p), sn(Ix, w), tt()),
@@ -4708,7 +4700,7 @@ function Px(e) {
4708
4700
  }
4709
4701
  );
4710
4702
  }
4711
- const gu = We(
4703
+ const gu = Ue(
4712
4704
  ([{ groupIndices: e, sizes: t, totalCount: n }, { headerHeight: r, scrollTop: o }]) => {
4713
4705
  const s = ze(), i = ze(), a = Mt($(s, te(Px)));
4714
4706
  return ce(
@@ -4735,7 +4727,7 @@ const gu = We(
4735
4727
  ), { groupCounts: s, topItemsIndexes: i };
4736
4728
  },
4737
4729
  nt(dn, Tt)
4738
- ), An = We(
4730
+ ), An = Ue(
4739
4731
  ([{ log: e }]) => {
4740
4732
  const t = K(!1), n = Mt(
4741
4733
  $(
@@ -4755,7 +4747,7 @@ function xu(e) {
4755
4747
  const t = typeof e == "number" ? { index: e } : e;
4756
4748
  return t.align || (t.align = "start"), (!t.behavior || !Ox) && (t.behavior = "auto"), t.offset || (t.offset = 0), t;
4757
4749
  }
4758
- const Qr = We(
4750
+ const Qr = Ue(
4759
4751
  ([
4760
4752
  { gap: e, listRefresh: t, sizes: n, totalCount: r },
4761
4753
  {
@@ -4787,9 +4779,9 @@ const Qr = We(
4787
4779
  D,
4788
4780
  _
4789
4781
  ]) => {
4790
- const V = xu(R), { align: U, behavior: q, offset: F } = V, k = E - 1, W = mu(V, S, k);
4782
+ const V = xu(R), { align: U, behavior: q, offset: L } = V, k = E - 1, W = mu(V, S, k);
4791
4783
  let Y = Br(W, S.offsetTree, M) + j;
4792
- U === "end" ? (Y += D + Gt(S.sizeTree, W)[1] - C + _, W === k && (Y += N)) : U === "center" ? Y += (D + Gt(S.sizeTree, W)[1] - C + _) / 2 : Y -= I, F && (Y += F);
4784
+ U === "end" ? (Y += D + Gt(S.sizeTree, W)[1] - C + _, W === k && (Y += N)) : U === "center" ? Y += (D + Gt(S.sizeTree, W)[1] - C + _) / 2 : Y -= I, L && (Y += L);
4793
4785
  const ue = (re) => {
4794
4786
  y(), re ? (O("retrying to scroll to", { location: R }, Nt.DEBUG), Ae(p, R)) : (Ae(w, !0), O("list did not change, scroll successful", {}, Nt.DEBUG));
4795
4787
  };
@@ -4837,7 +4829,7 @@ function ta(e, t) {
4837
4829
  const n = t - 1;
4838
4830
  return typeof e == "number" ? e : e.index === "LAST" ? n : e.index;
4839
4831
  }
4840
- const eo = We(
4832
+ const eo = Ue(
4841
4833
  ([{ defaultItemSize: e, listRefresh: t, sizes: n }, { scrollTop: r }, { scrollTargetReached: o, scrollToIndex: s }, { didMount: i }]) => {
4842
4834
  const a = K(!0), l = K(0), u = K(!0);
4843
4835
  return ce(
@@ -4893,7 +4885,7 @@ const Hr = "up", _r = "down", Dx = "none", Lx = {
4893
4885
  scrollTop: 0,
4894
4886
  viewportHeight: 0
4895
4887
  }
4896
- }, 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 }]) => {
4897
4889
  const i = K(!1), a = K(!0), l = ze(), u = ze(), d = K(4), f = K(Fx), h = St(
4898
4890
  $(
4899
4891
  bi($(we(o), Wn(1), rn(!0)), $(we(o), Wn(1), rn(!1), xl(100))),
@@ -5033,7 +5025,7 @@ function Cl(e, t) {
5033
5025
  var n;
5034
5026
  return typeof e == "number" ? e : (n = e[t]) != null ? n : 0;
5035
5027
  }
5036
- const na = We(
5028
+ const na = Ue(
5037
5029
  ([{ deviation: e, fixedHeaderHeight: t, headerHeight: n, scrollTop: r, viewportHeight: o }]) => {
5038
5030
  const s = ze(), i = K(0), a = K(0), l = K(0), u = St(
5039
5031
  $(
@@ -5171,7 +5163,7 @@ function Tl(e, t, n) {
5171
5163
  }
5172
5164
  return s;
5173
5165
  }
5174
- const Jn = We(
5166
+ const Jn = Ue(
5175
5167
  ([
5176
5168
  { data: e, firstItemIndex: t, gap: n, sizes: r, totalCount: o },
5177
5169
  s,
@@ -5217,12 +5209,12 @@ const Jn = We(
5217
5209
  _,
5218
5210
  V
5219
5211
  ]) => {
5220
- const U = j, { offsetTree: q, sizeTree: F } = U, k = ct(g);
5212
+ const U = j, { offsetTree: q, sizeTree: L } = U, k = ct(g);
5221
5213
  if (I === 0)
5222
5214
  return { ...qs, totalCount: I };
5223
5215
  if (C === 0 && E === 0)
5224
5216
  return k === 0 ? { ...qs, totalCount: I } : wu(k, N, j, D, _, V || []);
5225
- if (Je(F))
5217
+ if (Je(L))
5226
5218
  return k > 0 ? null : Ro(
5227
5219
  $x(ta(N, I), U, V),
5228
5220
  [],
@@ -5233,10 +5225,10 @@ const Jn = We(
5233
5225
  );
5234
5226
  const W = [];
5235
5227
  if (M.length > 0) {
5236
- const fe = M[0], ye = M[M.length - 1];
5228
+ const ge = M[0], ye = M[M.length - 1];
5237
5229
  let B = 0;
5238
- for (const P of us(F, fe, ye)) {
5239
- 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);
5240
5232
  for (let oe = Z; oe <= le; oe++)
5241
5233
  W.push({ data: V == null ? void 0 : V[oe], index: oe, offset: B, size: G }), B += G;
5242
5234
  }
@@ -5246,7 +5238,7 @@ const Jn = We(
5246
5238
  const Y = M.length > 0 ? M[M.length - 1] + 1 : 0, ue = kx(q, C, E, Y);
5247
5239
  if (ue.length === 0)
5248
5240
  return null;
5249
- const re = I - 1, de = cs([], (fe) => {
5241
+ const re = I - 1, de = cs([], (ge) => {
5250
5242
  for (const ye of ue) {
5251
5243
  const B = ye.value;
5252
5244
  let P = B.offset, G = ye.start;
@@ -5259,7 +5251,7 @@ const Jn = We(
5259
5251
  G < Y && (P += (Y - G) * Z, G = Y);
5260
5252
  const le = Math.min(ye.end, re);
5261
5253
  for (let oe = G; oe <= le && !(P >= E); oe++)
5262
- 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 + _;
5263
5255
  }
5264
5256
  });
5265
5257
  return Ro(de, W, I, _, U, D);
@@ -5346,7 +5338,7 @@ const Jn = We(
5346
5338
  Zi
5347
5339
  ),
5348
5340
  { singleton: !0 }
5349
- ), bu = We(
5341
+ ), bu = Ue(
5350
5342
  ([{ fixedFooterHeight: e, fixedHeaderHeight: t, footerHeight: n, headerHeight: r }, { listState: o }]) => {
5351
5343
  const s = ze(), i = St(
5352
5344
  $(
@@ -5359,7 +5351,7 @@ const Jn = We(
5359
5351
  },
5360
5352
  nt(Tt, Jn),
5361
5353
  { singleton: !0 }
5362
- ), zx = We(
5354
+ ), zx = Ue(
5363
5355
  ([{ viewportHeight: e }, { totalListHeight: t }]) => {
5364
5356
  const n = K(!1), r = St(
5365
5357
  $(
@@ -5375,7 +5367,7 @@ const Jn = We(
5375
5367
  },
5376
5368
  nt(Tt, bu),
5377
5369
  { singleton: !0 }
5378
- ), yu = We(() => ({
5370
+ ), yu = Ue(() => ({
5379
5371
  context: K(null)
5380
5372
  })), Bx = ({
5381
5373
  itemBottom: e,
@@ -5383,7 +5375,7 @@ const Jn = We(
5383
5375
  locationParams: { align: n, behavior: r, ...o },
5384
5376
  viewportBottom: s,
5385
5377
  viewportTop: i
5386
- }) => 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(
5387
5379
  ([
5388
5380
  { gap: e, sizes: t, totalCount: n },
5389
5381
  { fixedFooterHeight: r, fixedHeaderHeight: o, headerHeight: s, scrollingInProgress: i, scrollTop: a, viewportHeight: l },
@@ -5427,7 +5419,7 @@ const Jn = We(
5427
5419
  function Rl(e) {
5428
5420
  return e ? e === "smooth" ? "smooth" : "auto" : !1;
5429
5421
  }
5430
- 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(
5431
5423
  ([
5432
5424
  { listRefresh: e, totalCount: t, fixedItemSize: n, data: r },
5433
5425
  { atBottomState: o, isAtBottom: s },
@@ -5532,7 +5524,7 @@ const Hx = (e, t) => typeof e == "function" ? Rl(e(t)) : t && Rl(e), Ux = We(
5532
5524
  yu,
5533
5525
  Su
5534
5526
  )
5535
- ), Wx = We(
5527
+ ), Wx = Ue(
5536
5528
  ([{ data: e, firstItemIndex: t, gap: n, sizes: r }, { initialTopMostItemIndex: o }, { initialItemCount: s, listState: i }, { didMount: a }]) => (ce(
5537
5529
  $(
5538
5530
  a,
@@ -5545,7 +5537,7 @@ const Hx = (e, t) => typeof e == "function" ? Rl(e(t)) : t && Rl(e), Ux = We(
5545
5537
  ), {}),
5546
5538
  nt(dn, eo, Jn, An),
5547
5539
  { singleton: !0 }
5548
- ), Vx = We(
5540
+ ), Vx = Ue(
5549
5541
  ([{ didMount: e }, { scrollTo: t }, { listState: n }]) => {
5550
5542
  const r = K(0);
5551
5543
  return qe(
@@ -5575,7 +5567,7 @@ const Hx = (e, t) => typeof e == "function" ? Rl(e(t)) : t && Rl(e), Ux = We(
5575
5567
  },
5576
5568
  nt(An, Tt, Jn),
5577
5569
  { singleton: !0 }
5578
- ), Cu = We(
5570
+ ), Cu = Ue(
5579
5571
  ([{ scrollVelocity: e }]) => {
5580
5572
  const t = K(!1), n = ze(), r = K(!1);
5581
5573
  return ce(
@@ -5604,7 +5596,7 @@ const Hx = (e, t) => typeof e == "function" ? Rl(e(t)) : t && Rl(e), Ux = We(
5604
5596
  },
5605
5597
  nt(to),
5606
5598
  { singleton: !0 }
5607
- ), ra = We(([{ scrollContainerState: e, scrollTo: t }]) => {
5599
+ ), ra = Ue(([{ scrollContainerState: e, scrollTo: t }]) => {
5608
5600
  const n = ze(), r = ze(), o = ze(), s = K(!1), i = K(void 0);
5609
5601
  return ce(
5610
5602
  $(
@@ -5636,7 +5628,7 @@ const Hx = (e, t) => typeof e == "function" ? Rl(e(t)) : t && Rl(e), Ux = We(
5636
5628
  windowScrollTo: o,
5637
5629
  windowViewportRect: r
5638
5630
  };
5639
- }, nt(Tt)), Kx = We(
5631
+ }, nt(Tt)), Kx = Ue(
5640
5632
  ([
5641
5633
  { sizeRanges: e, sizes: t },
5642
5634
  { headerHeight: n, scrollTop: r },
@@ -5673,7 +5665,7 @@ const Hx = (e, t) => typeof e == "function" ? Rl(e(t)) : t && Rl(e), Ux = We(
5673
5665
  function qx(e) {
5674
5666
  return { align: "start", index: 0, offset: e.scrollTop };
5675
5667
  }
5676
- const Gx = We(([{ topItemsIndexes: e }]) => {
5668
+ const Gx = Ue(([{ topItemsIndexes: e }]) => {
5677
5669
  const t = K(0);
5678
5670
  return ce(
5679
5671
  $(
@@ -5688,7 +5680,7 @@ function Tu(e) {
5688
5680
  let t = !1, n;
5689
5681
  return () => (t || (t = !0, n = e()), n);
5690
5682
  }
5691
- 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(
5692
5684
  ([
5693
5685
  { deviation: e, scrollBy: t, scrollingInProgress: n, scrollTop: r },
5694
5686
  { isAtBottom: o, isScrolling: s, lastJumpDueToItemResize: i, scrollDirection: a },
@@ -5767,7 +5759,7 @@ const Yx = Tu(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
5767
5759
  ), { deviation: e };
5768
5760
  },
5769
5761
  nt(Tt, to, Jn, dn, Nn, Zi)
5770
- ), Jx = We(
5762
+ ), Jx = Ue(
5771
5763
  ([
5772
5764
  e,
5773
5765
  t,
@@ -5806,7 +5798,7 @@ const Yx = Tu(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
5806
5798
  Nn,
5807
5799
  yu
5808
5800
  )
5809
- ), Ru = We(
5801
+ ), Ru = Ue(
5810
5802
  ([
5811
5803
  {
5812
5804
  data: e,
@@ -6037,7 +6029,7 @@ const Ys = "-webkit-sticky", El = "sticky", oa = Tu(() => {
6037
6029
  function sa(e) {
6038
6030
  return e;
6039
6031
  }
6040
- const ev = /* @__PURE__ */ We(() => {
6032
+ const ev = /* @__PURE__ */ Ue(() => {
6041
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(
6042
6034
  $(
6043
6035
  n,
@@ -6063,7 +6055,7 @@ const ev = /* @__PURE__ */ We(() => {
6063
6055
  ScrollSeekPlaceholder: i("ScrollSeekPlaceholder"),
6064
6056
  TopItemListComponent: i("TopItemList")
6065
6057
  };
6066
- }), tv = /* @__PURE__ */ We(
6058
+ }), tv = /* @__PURE__ */ Ue(
6067
6059
  ([e, t]) => ({ ...e, ...t }),
6068
6060
  nt(Ru, ev)
6069
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 }) {
@@ -6344,7 +6336,7 @@ const dv = ({ children: e }) => {
6344
6336
  }
6345
6337
  },
6346
6338
  pv
6347
- ), 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(() => {
6348
6340
  const e = K((u) => /* @__PURE__ */ c.jsxs("td", { children: [
6349
6341
  "Item $",
6350
6342
  u
@@ -6414,7 +6406,7 @@ function fo(e, t) {
6414
6406
  function Sv(e, t) {
6415
6407
  return e && e.column === t.column && e.row === t.row;
6416
6408
  }
6417
- const Cv = /* @__PURE__ */ We(
6409
+ const Cv = /* @__PURE__ */ Ue(
6418
6410
  ([
6419
6411
  { increaseViewportBy: e, listBoundary: t, overscan: n, visibleRange: r },
6420
6412
  { footerHeight: o, headerHeight: s, scrollBy: i, scrollContainerState: a, scrollTo: l, scrollTop: u, smoothScrollTargetReached: d, viewportHeight: f },
@@ -6424,7 +6416,7 @@ const Cv = /* @__PURE__ */ We(
6424
6416
  { customScrollParent: g, useWindowScroll: x, windowScrollContainerState: b, windowScrollTo: y, windowViewportRect: R },
6425
6417
  S
6426
6418
  ]) => {
6427
- const C = K(0), E = K(0), I = K(Il), j = K({ height: 0, width: 0 }), N = K({ height: 0, width: 0 }), O = ze(), M = ze(), D = K(0), _ = K(null), V = K({ column: 0, row: 0 }), U = ze(), q = ze(), F = K(!1), k = K(0), W = K(!0), Y = K(!1), ue = K(!1);
6419
+ const C = K(0), E = K(0), I = K(Il), j = K({ height: 0, width: 0 }), N = K({ height: 0, width: 0 }), O = ze(), M = ze(), D = K(0), _ = K(null), V = K({ column: 0, row: 0 }), U = ze(), q = ze(), L = K(!1), k = K(0), W = K(!0), Y = K(!1), ue = K(!1);
6428
6420
  qe(
6429
6421
  $(
6430
6422
  w,
@@ -6460,8 +6452,8 @@ const Cv = /* @__PURE__ */ We(
6460
6452
  be(([, P]) => P != null)
6461
6453
  ),
6462
6454
  ([, P]) => {
6463
- P && (Ae(j, P.viewport), Ae(N, P.item), Ae(V, P.gap), P.scrollTop > 0 && (Ae(F, !0), qt($(u, Wn(1)), (G) => {
6464
- Ae(F, !1);
6455
+ P && (Ae(j, P.viewport), Ae(N, P.item), Ae(V, P.gap), P.scrollTop > 0 && (Ae(L, !0), qt($(u, Wn(1)), (G) => {
6456
+ Ae(L, !1);
6465
6457
  }), Ae(l, { top: P.scrollTop })));
6466
6458
  }
6467
6459
  ), ce(
@@ -6496,7 +6488,7 @@ const Cv = /* @__PURE__ */ We(
6496
6488
  we(j, fo),
6497
6489
  we(_),
6498
6490
  we(E),
6499
- we(F),
6491
+ we(L),
6500
6492
  we(W),
6501
6493
  we(k)
6502
6494
  ),
@@ -6522,10 +6514,10 @@ const Cv = /* @__PURE__ */ We(
6522
6514
  return yv(jl(X, Ce, Ge));
6523
6515
  }
6524
6516
  const ae = Ou(Q, at, Qe);
6525
- let he, Se;
6526
- 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);
6527
- const ve = jl(he, Se, Ge), { bottom: Ne, top: et } = _l(Me, le, oe, ve), Ve = Nl(P / ae), L = Ve * st + (Ve - 1) * je - Ne;
6528
- return { bottom: Ne, itemHeight: st, items: ve, itemWidth: at, offsetBottom: L, offsetTop: et, top: et };
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;
6520
+ return { bottom: Ne, itemHeight: st, items: ve, itemWidth: at, offsetBottom: F, offsetTop: et, top: et };
6529
6521
  }
6530
6522
  )
6531
6523
  ),
@@ -6570,7 +6562,7 @@ const Cv = /* @__PURE__ */ We(
6570
6562
  te(([[, P]]) => P - 1),
6571
6563
  tt()
6572
6564
  )
6573
- ), fe = Mt(
6565
+ ), ge = Mt(
6574
6566
  $(
6575
6567
  we(I),
6576
6568
  be(({ items: P }) => P.length > 0 && P[0].index === 0),
@@ -6580,7 +6572,7 @@ const Cv = /* @__PURE__ */ We(
6580
6572
  ), ye = Mt(
6581
6573
  $(
6582
6574
  we(I),
6583
- Pe(F),
6575
+ Pe(L),
6584
6576
  be(([{ items: P }, G]) => P.length > 0 && !G),
6585
6577
  te(([{ items: P }]) => ({
6586
6578
  endIndex: P[P.length - 1].index,
@@ -6653,9 +6645,9 @@ const Cv = /* @__PURE__ */ We(
6653
6645
  endReached: de,
6654
6646
  propsReady: v,
6655
6647
  rangeChanged: ye,
6656
- startReached: fe,
6648
+ startReached: ge,
6657
6649
  stateChanged: U,
6658
- stateRestoreInProgress: F,
6650
+ stateRestoreInProgress: L,
6659
6651
  ...S
6660
6652
  };
6661
6653
  },
@@ -6675,7 +6667,7 @@ function Ri(e, t, n, r) {
6675
6667
  const o = Ou(e.width, n.width, t.column), s = zo(r / o), i = s * n.height + Pr(0, s - 1) * t.row;
6676
6668
  return i > 0 ? i + t.row : i;
6677
6669
  }
6678
- const Tv = /* @__PURE__ */ We(() => {
6670
+ const Tv = /* @__PURE__ */ Ue(() => {
6679
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(
6680
6672
  $(
6681
6673
  t,
@@ -6702,7 +6694,7 @@ const Tv = /* @__PURE__ */ We(() => {
6702
6694
  scrollerRef: a,
6703
6695
  ScrollSeekPlaceholder: l("ScrollSeekPlaceholder", "div")
6704
6696
  };
6705
- }), Rv = /* @__PURE__ */ We(
6697
+ }), Rv = /* @__PURE__ */ Ue(
6706
6698
  ([e, t]) => ({ ...e, ...t }),
6707
6699
  nt(Cv, Tv)
6708
6700
  ), Ev = /* @__PURE__ */ z.memo(function() {
@@ -7868,7 +7860,7 @@ class da {
7868
7860
  }
7869
7861
  }
7870
7862
  }
7871
- const ge = {
7863
+ const me = {
7872
7864
  newline: /^(?: *(?:\n|$))+/,
7873
7865
  code: /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,
7874
7866
  fences: /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,
@@ -7885,37 +7877,37 @@ const ge = {
7885
7877
  _paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,
7886
7878
  text: /^[^\n]+/
7887
7879
  };
7888
- ge._label = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
7889
- ge._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
7890
- ge.def = Ze(ge.def).replace("label", ge._label).replace("title", ge._title).getRegex();
7891
- ge.bullet = /(?:[*+-]|\d{1,9}[.)])/;
7892
- ge.listItemStart = Ze(/^( *)(bull) */).replace("bull", ge.bullet).getRegex();
7893
- 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();
7894
- 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";
7895
- ge._comment = /<!--(?!-?>)[\s\S]*?(?:-->|$)/;
7896
- ge.html = Ze(ge.html, "i").replace("comment", ge._comment).replace("tag", ge._tag).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
7897
- 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();
7898
- ge.blockquote = Ze(ge.blockquote).replace("paragraph", ge.paragraph).getRegex();
7899
- ge.normal = { ...ge };
7900
- ge.gfm = {
7901
- ...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,
7902
7894
  table: "^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"
7903
7895
  // Cells
7904
7896
  };
7905
- 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();
7906
- 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();
7907
- ge.pedantic = {
7908
- ...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,
7909
7901
  html: Ze(
7910
7902
  `^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`
7911
- ).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(),
7912
7904
  def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
7913
7905
  heading: /^(#{1,6})(.*)(?:\n+|$)/,
7914
7906
  fences: Bo,
7915
7907
  // fences not supported
7916
7908
  lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
7917
- paragraph: Ze(ge.normal._paragraph).replace("hr", ge.hr).replace("heading", ` *#{1,6} *[^
7918
- ]`).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()
7919
7911
  };
7920
7912
  const ne = {
7921
7913
  escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
@@ -7945,7 +7937,7 @@ ne._punctuation = "!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~";
7945
7937
  ne.punctuation = Ze(ne.punctuation).replace(/punctuation/g, ne._punctuation).getRegex();
7946
7938
  ne.blockSkip = /\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g;
7947
7939
  ne.escapedEmSt = /(?:^|[^\\])(?:\\\\)*\\[*_]/g;
7948
- ne._comment = Ze(ge._comment).replace("(?:-->|$)", "-->").getRegex();
7940
+ ne._comment = Ze(me._comment).replace("(?:-->|$)", "-->").getRegex();
7949
7941
  ne.emStrong.lDelim = Ze(ne.emStrong.lDelim).replace(/punct/g, ne._punctuation).getRegex();
7950
7942
  ne.emStrong.rDelimAst = Ze(ne.emStrong.rDelimAst, "g").replace(/punct/g, ne._punctuation).getRegex();
7951
7943
  ne.emStrong.rDelimUnd = Ze(ne.emStrong.rDelimUnd, "g").replace(/punct/g, ne._punctuation).getRegex();
@@ -7959,8 +7951,8 @@ ne._label = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
7959
7951
  ne._href = /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;
7960
7952
  ne._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;
7961
7953
  ne.link = Ze(ne.link).replace("label", ne._label).replace("href", ne._href).replace("title", ne._title).getRegex();
7962
- ne.reflink = Ze(ne.reflink).replace("label", ne._label).replace("ref", ge._label).getRegex();
7963
- 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();
7964
7956
  ne.reflinkSearch = Ze(ne.reflinkSearch, "g").replace("reflink", ne.reflink).replace("nolink", ne.nolink).getRegex();
7965
7957
  ne.normal = { ...ne };
7966
7958
  ne.pedantic = {
@@ -8013,17 +8005,17 @@ class Tn {
8013
8005
  top: !0
8014
8006
  };
8015
8007
  const n = {
8016
- block: ge.normal,
8008
+ block: me.normal,
8017
8009
  inline: ne.normal
8018
8010
  };
8019
- 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;
8020
8012
  }
8021
8013
  /**
8022
8014
  * Expose Rules
8023
8015
  */
8024
8016
  static get rules() {
8025
8017
  return {
8026
- block: ge,
8018
+ block: me,
8027
8019
  inline: ne
8028
8020
  };
8029
8021
  }
@@ -8659,7 +8651,7 @@ function Gu(e, t) {
8659
8651
  return (n, r, o) => {
8660
8652
  typeof r == "function" && (o = r, r = null);
8661
8653
  const s = { ...r };
8662
- r = { ...me.defaults, ...s };
8654
+ r = { ...pe.defaults, ...s };
8663
8655
  const i = hw(r.silent, r.async, o);
8664
8656
  if (typeof n > "u" || n === null)
8665
8657
  return i(new Error("marked(): input parameter is undefined or null"));
@@ -8677,7 +8669,7 @@ function Gu(e, t) {
8677
8669
  let h;
8678
8670
  if (!f)
8679
8671
  try {
8680
- 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));
8681
8673
  } catch (p) {
8682
8674
  f = p;
8683
8675
  }
@@ -8685,7 +8677,7 @@ function Gu(e, t) {
8685
8677
  };
8686
8678
  if (!a || a.length < 3 || (delete r.highlight, !l.length)) return u();
8687
8679
  let d = 0;
8688
- me.walkTokens(l, function(f) {
8680
+ pe.walkTokens(l, function(f) {
8689
8681
  f.type === "code" && (d++, setTimeout(() => {
8690
8682
  a(f.text, f.lang, function(h, p) {
8691
8683
  if (h)
@@ -8697,11 +8689,11 @@ function Gu(e, t) {
8697
8689
  return;
8698
8690
  }
8699
8691
  if (r.async)
8700
- 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);
8701
8693
  try {
8702
8694
  r.hooks && (n = r.hooks.preprocess(n));
8703
8695
  const a = e(n, r);
8704
- r.walkTokens && me.walkTokens(a, r.walkTokens);
8696
+ r.walkTokens && pe.walkTokens(a, r.walkTokens);
8705
8697
  let l = t(a, r);
8706
8698
  return r.hooks && (l = r.hooks.postprocess(l)), l;
8707
8699
  } catch (a) {
@@ -8709,19 +8701,19 @@ function Gu(e, t) {
8709
8701
  }
8710
8702
  };
8711
8703
  }
8712
- function me(e, t, n) {
8704
+ function pe(e, t, n) {
8713
8705
  return Gu(Tn.lex, Rn.parse)(e, t, n);
8714
8706
  }
8715
- me.options = me.setOptions = function(e) {
8716
- 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;
8717
8709
  };
8718
- me.getDefaults = Hu;
8719
- me.defaults = Zn;
8720
- me.use = function(...e) {
8721
- 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: {} };
8722
8714
  e.forEach((n) => {
8723
8715
  const r = { ...n };
8724
- 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) => {
8725
8717
  if (!o.name)
8726
8718
  throw new Error("extension name required");
8727
8719
  if (o.renderer) {
@@ -8738,7 +8730,7 @@ me.use = function(...e) {
8738
8730
  }
8739
8731
  o.childTokens && (t.childTokens[o.name] = o.childTokens);
8740
8732
  }), r.extensions = t), n.renderer) {
8741
- const o = me.defaults.renderer || new fa();
8733
+ const o = pe.defaults.renderer || new fa();
8742
8734
  for (const s in n.renderer) {
8743
8735
  const i = o[s];
8744
8736
  o[s] = (...a) => {
@@ -8749,7 +8741,7 @@ me.use = function(...e) {
8749
8741
  r.renderer = o;
8750
8742
  }
8751
8743
  if (n.tokenizer) {
8752
- const o = me.defaults.tokenizer || new da();
8744
+ const o = pe.defaults.tokenizer || new da();
8753
8745
  for (const s in n.tokenizer) {
8754
8746
  const i = o[s];
8755
8747
  o[s] = (...a) => {
@@ -8760,11 +8752,11 @@ me.use = function(...e) {
8760
8752
  r.tokenizer = o;
8761
8753
  }
8762
8754
  if (n.hooks) {
8763
- const o = me.defaults.hooks || new Ho();
8755
+ const o = pe.defaults.hooks || new Ho();
8764
8756
  for (const s in n.hooks) {
8765
8757
  const i = o[s];
8766
8758
  Ho.passThroughHooks.has(s) ? o[s] = (a) => {
8767
- if (me.defaults.async)
8759
+ if (pe.defaults.async)
8768
8760
  return Promise.resolve(n.hooks[s].call(o, a)).then((u) => i.call(o, u));
8769
8761
  const l = n.hooks[s].call(o, a);
8770
8762
  return i.call(o, l);
@@ -8776,54 +8768,54 @@ me.use = function(...e) {
8776
8768
  r.hooks = o;
8777
8769
  }
8778
8770
  if (n.walkTokens) {
8779
- const o = me.defaults.walkTokens;
8771
+ const o = pe.defaults.walkTokens;
8780
8772
  r.walkTokens = function(s) {
8781
8773
  let i = [];
8782
8774
  return i.push(n.walkTokens.call(this, s)), o && (i = i.concat(o.call(this, s))), i;
8783
8775
  };
8784
8776
  }
8785
- me.setOptions(r);
8777
+ pe.setOptions(r);
8786
8778
  });
8787
8779
  };
8788
- me.walkTokens = function(e, t) {
8780
+ pe.walkTokens = function(e, t) {
8789
8781
  let n = [];
8790
8782
  for (const r of e)
8791
- switch (n = n.concat(t.call(me, r)), r.type) {
8783
+ switch (n = n.concat(t.call(pe, r)), r.type) {
8792
8784
  case "table": {
8793
8785
  for (const o of r.header)
8794
- n = n.concat(me.walkTokens(o.tokens, t));
8786
+ n = n.concat(pe.walkTokens(o.tokens, t));
8795
8787
  for (const o of r.rows)
8796
8788
  for (const s of o)
8797
- n = n.concat(me.walkTokens(s.tokens, t));
8789
+ n = n.concat(pe.walkTokens(s.tokens, t));
8798
8790
  break;
8799
8791
  }
8800
8792
  case "list": {
8801
- n = n.concat(me.walkTokens(r.items, t));
8793
+ n = n.concat(pe.walkTokens(r.items, t));
8802
8794
  break;
8803
8795
  }
8804
8796
  default:
8805
- me.defaults.extensions && me.defaults.extensions.childTokens && me.defaults.extensions.childTokens[r.type] ? me.defaults.extensions.childTokens[r.type].forEach(function(o) {
8806
- n = n.concat(me.walkTokens(r[o], t));
8807
- }) : 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)));
8808
8800
  }
8809
8801
  return n;
8810
8802
  };
8811
- me.parseInline = Gu(Tn.lexInline, Rn.parseInline);
8812
- me.Parser = Rn;
8813
- me.parser = Rn.parse;
8814
- me.Renderer = fa;
8815
- me.TextRenderer = Ku;
8816
- me.Lexer = Tn;
8817
- me.lexer = Tn.lex;
8818
- me.Tokenizer = da;
8819
- me.Slugger = qu;
8820
- me.Hooks = Ho;
8821
- me.parse = me;
8822
- me.options;
8823
- me.setOptions;
8824
- me.use;
8825
- me.walkTokens;
8826
- 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;
8827
8819
  Rn.parse;
8828
8820
  Tn.lex;
8829
8821
  function Ul({
@@ -8835,9 +8827,9 @@ function Ul({
8835
8827
  try {
8836
8828
  if (!n) {
8837
8829
  const o = e.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, "").replace(/<iframe\b[^<]*(?:(?!<\/iframe>)<[^<]*)*<\/iframe>/gi, "").replace(/javascript:/gi, "").replace(/on\w+\s*=/gi, "");
8838
- return me.parse(o);
8830
+ return pe.parse(o);
8839
8831
  }
8840
- return me.parse(e);
8832
+ return pe.parse(e);
8841
8833
  } catch (o) {
8842
8834
  return console.error("[MarkdownContent] parse error", o), `<pre>Error rendering markdown: ${String(o)}</pre>`;
8843
8835
  }
@@ -9283,7 +9275,7 @@ function ni(e, t) {
9283
9275
  return typeof e == "function" ? e(t) : e && (e.current = t), e;
9284
9276
  }
9285
9277
  function zw(e, t) {
9286
- var n = pe(function() {
9278
+ var n = he(function() {
9287
9279
  return {
9288
9280
  // value
9289
9281
  value: e,
@@ -10090,7 +10082,7 @@ const Ob = m.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c.jsx(
10090
10082
  ));
10091
10083
  Ob.displayName = Ss.displayName;
10092
10084
  function Mb({ isOpen: e, onClose: t, fileId: n, fileName: r, mimeType: o }) {
10093
- 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 () => {
10094
10086
  if (n) {
10095
10087
  i(!0), d(null), l(null);
10096
10088
  try {
@@ -10351,7 +10343,7 @@ function sc(e) {
10351
10343
  return `${e.id}:${t}:${n}`;
10352
10344
  }
10353
10345
  function Hb({ className: e }) {
10354
- const [t, n] = pe(0);
10346
+ const [t, n] = he(0);
10355
10347
  return gt(() => {
10356
10348
  const r = setInterval(() => n((o) => (o + 1) % 4), 500);
10357
10349
  return () => clearInterval(r);
@@ -10386,8 +10378,8 @@ const Ub = z.memo(function({
10386
10378
  onCancelEdit: g,
10387
10379
  onCopy: x
10388
10380
  }) {
10389
- 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", F = t.role, k = F === "tool", W = !(r && F !== "user"), Y = z.useMemo(() => {
10390
- switch (F) {
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(() => {
10382
+ switch (L) {
10391
10383
  case "user":
10392
10384
  return "text-[hsl(var(--chat-bubble-user-text))]";
10393
10385
  case "assistant":
@@ -10399,10 +10391,10 @@ const Ub = z.memo(function({
10399
10391
  default:
10400
10392
  return "text-[hsl(var(--chat-bubble-ai-text))]";
10401
10393
  }
10402
- }, [F]), ue = pt(() => Db(t.content), [t.content]), re = pt(() => Lb(t.content), [t.content]), de = pt(
10394
+ }, [L]), ue = pt(() => Db(t.content), [t.content]), re = pt(() => Lb(t.content), [t.content]), de = pt(
10403
10395
  () => t.content.filter((Q) => Q.type === "image_url"),
10404
10396
  [t.content]
10405
- ), fe = pt(
10397
+ ), ge = pt(
10406
10398
  () => t.content.filter((Q) => Q.type === "file"),
10407
10399
  [t.content]
10408
10400
  ), ye = pt(
@@ -10412,7 +10404,7 @@ const Ub = z.memo(function({
10412
10404
  pt(() => zb(t.content), [t.content]);
10413
10405
  const P = pt(() => B.length <= Dn ? B : `${B.slice(0, Dn)}
10414
10406
  … [truncated ${B.length - Dn} chars]`, [B]), G = z.useCallback(async (Q = "all") => {
10415
- const he = Q === "visible" && k ? P : k ? B : ue;
10407
+ const fe = Q === "visible" && k ? P : k ? B : ue;
10416
10408
  async function Se(ve) {
10417
10409
  try {
10418
10410
  await navigator.clipboard.writeText(ve);
@@ -10426,7 +10418,7 @@ const Ub = z.memo(function({
10426
10418
  }
10427
10419
  }
10428
10420
  try {
10429
- 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);
10430
10422
  } catch (ve) {
10431
10423
  console.error("Failed to copy:", ve);
10432
10424
  }
@@ -10436,12 +10428,12 @@ const Ub = z.memo(function({
10436
10428
  w(t.id, Q);
10437
10429
  }, [w, t.id, k, B, ue]), le = z.useCallback(() => {
10438
10430
  v == null || v(n);
10439
- }, [v, n]), oe = z.useCallback(async (Q, ae, he) => {
10431
+ }, [v, n]), oe = z.useCallback(async (Q, ae, fe) => {
10440
10432
  if (!W) {
10441
10433
  Q.preventDefault();
10442
10434
  return;
10443
10435
  }
10444
- if (O[he]) {
10436
+ if (O[fe]) {
10445
10437
  Q.preventDefault();
10446
10438
  return;
10447
10439
  }
@@ -10454,40 +10446,40 @@ const Ub = z.memo(function({
10454
10446
  return;
10455
10447
  }
10456
10448
  if (Se.startsWith("data:")) {
10457
- Q.preventDefault(), M((Ve) => ({ ...Ve, [he]: !0 }));
10449
+ Q.preventDefault(), M((Ve) => ({ ...Ve, [fe]: !0 }));
10458
10450
  const Ne = `${ae.name}_${ae.size}_${Date.now()}`, et = N({ title: "Fetching file...", description: "", open: !0 });
10459
10451
  try {
10460
10452
  const Ve = await mw(I ?? void 0);
10461
10453
  if (!Ve || !Array.isArray(Ve))
10462
10454
  throw new Error("Invalid file list response");
10463
- const L = 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);
10464
- if (!(L != null && L.id))
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);
10456
+ if (!(F != null && F.id))
10465
10457
  throw new Error(`File "${ae.name}" is not yet available on the server`);
10466
- if (!L.id || !L.filename)
10458
+ if (!F.id || !F.filename)
10467
10459
  throw new Error("Invalid file data received from server");
10468
10460
  U({
10469
- id: L.id,
10470
- name: ae.name || L.filename || `file_${L.id}`,
10471
- mimeType: ae.mimeType || L.mime_type || "application/octet-stream"
10461
+ id: F.id,
10462
+ name: ae.name || F.filename || `file_${F.id}`,
10463
+ mimeType: ae.mimeType || F.mime_type || "application/octet-stream"
10472
10464
  }), _(!0), et.update({ id: et.id, title: "Success", description: `Opened ${ae.name}`, open: !0 });
10473
10465
  } catch (Ve) {
10474
10466
  console.error("Failed to fetch server file:", Ve);
10475
- const L = Ve instanceof Error ? Ve.message : "Unknown error occurred";
10476
- et.update({ id: et.id, title: "Failed", description: L }), N({
10467
+ const F = Ve instanceof Error ? Ve.message : "Unknown error occurred";
10468
+ et.update({ id: et.id, title: "Failed", description: F }), N({
10477
10469
  title: "Failed to fetch file",
10478
- description: L,
10470
+ description: F,
10479
10471
  open: !0
10480
10472
  });
10481
10473
  } finally {
10482
- M((Ve) => ({ ...Ve, [he]: !1 }));
10474
+ M((Ve) => ({ ...Ve, [fe]: !1 }));
10483
10475
  }
10484
10476
  }
10485
10477
  } catch (Se) {
10486
- console.error("File click error:", Se), M((ve) => ({ ...ve, [he]: !1 }));
10478
+ console.error("File click error:", Se), M((ve) => ({ ...ve, [fe]: !1 }));
10487
10479
  }
10488
10480
  }, [W, O, N, I]), Me = z.useCallback(() => {
10489
10481
  const ae = J(q ? "h-3 w-3" : "h-4 w-4", "opacity-60 flex-shrink-0", Y);
10490
- switch (F) {
10482
+ switch (L) {
10491
10483
  case "user":
10492
10484
  return /* @__PURE__ */ c.jsx(Fp, { className: ae });
10493
10485
  case "assistant":
@@ -10497,9 +10489,9 @@ const Ub = z.memo(function({
10497
10489
  default:
10498
10490
  return /* @__PURE__ */ c.jsx(Ua, { className: ae });
10499
10491
  }
10500
- }, [q, Y, F]), Ge = z.useCallback(() => {
10492
+ }, [q, Y, L]), Ge = z.useCallback(() => {
10501
10493
  const Q = "group relative mb-4 flex w-full";
10502
- switch (F) {
10494
+ switch (L) {
10503
10495
  case "user":
10504
10496
  return J(Q, "justify-end");
10505
10497
  case "assistant":
@@ -10509,12 +10501,12 @@ const Ub = z.memo(function({
10509
10501
  default:
10510
10502
  return Q;
10511
10503
  }
10512
- }, [F]), Ye = z.useCallback(() => {
10504
+ }, [L]), Ye = z.useCallback(() => {
10513
10505
  const Q = J(
10514
10506
  "rounded-lg px-4 py-3 relative min-w-0 max-w-full break-words",
10515
10507
  q && "px-3 py-2 text-sm"
10516
10508
  );
10517
- switch (F) {
10509
+ switch (L) {
10518
10510
  case "user":
10519
10511
  return J(
10520
10512
  Q,
@@ -10541,7 +10533,7 @@ const Ub = z.memo(function({
10541
10533
  "border border-border/60 dark:border-border/40"
10542
10534
  );
10543
10535
  }
10544
- }, [q, F]), Ee = z.useCallback(async (Q) => {
10536
+ }, [q, L]), Ee = z.useCallback(async (Q) => {
10545
10537
  try {
10546
10538
  const ae = Q.id || `interrupt-${Date.now()}`;
10547
10539
  await j(ae, !0);
@@ -10557,8 +10549,8 @@ const Ub = z.memo(function({
10557
10549
  }
10558
10550
  }, [j]), Qe = z.useCallback(({ part: Q, i: ae }) => {
10559
10551
  if (Q.type === "text") {
10560
- const he = Q.text ?? "", Se = he.trim(), ve = oc(Se);
10561
- return ve && F !== "tool" ? /* @__PURE__ */ c.jsx(Wb, { data: ve }, ae) : F === "user" && f && Se.length > h ? /* @__PURE__ */ c.jsxs(Ml, { open: C, onOpenChange: E, children: [
10552
+ const fe = Q.text ?? "", Se = fe.trim(), ve = oc(Se);
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: [
10562
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: [
10563
10555
  Se.substring(0, h),
10564
10556
  "..."
@@ -10580,27 +10572,27 @@ const Ub = z.memo(function({
10580
10572
  ] })
10581
10573
  }
10582
10574
  ) })
10583
- ] }, ae) : /* @__PURE__ */ c.jsx(Ul, { content: he, allowHtml: !1 }, ae);
10575
+ ] }, ae) : /* @__PURE__ */ c.jsx(Ul, { content: fe, allowHtml: !1 }, ae);
10584
10576
  }
10585
10577
  if (Q.type === "image_url") {
10586
- const he = Q;
10578
+ const fe = Q;
10587
10579
  return /* @__PURE__ */ c.jsx("div", { className: "my-2", children: /* @__PURE__ */ c.jsx(
10588
10580
  "img",
10589
10581
  {
10590
- src: he.url,
10591
- alt: he.alt ?? "",
10582
+ src: fe.url,
10583
+ alt: fe.alt ?? "",
10592
10584
  loading: "lazy",
10593
10585
  className: "border rounded max-h-[420px] w-auto object-contain"
10594
10586
  }
10595
10587
  ) }, ae);
10596
10588
  }
10597
10589
  if (Q.type === "file") {
10598
- const he = Q, Se = he.name || "file";
10590
+ const fe = Q, Se = fe.name || "file";
10599
10591
  return /* @__PURE__ */ c.jsxs(
10600
10592
  "a",
10601
10593
  {
10602
- href: he.url,
10603
- onClick: (ve) => oe(ve, he, ae),
10594
+ href: fe.url,
10595
+ onClick: (ve) => oe(ve, fe, ae),
10604
10596
  className: `inline-flex items-center gap-2 rounded px-2 py-1 text-xs bg-gray-100 border hover:bg-gray-200
10605
10597
  dark:bg-background/10 dark:border-border/30 dark:hover:bg-background/20`,
10606
10598
  children: [
@@ -10628,7 +10620,7 @@ const Ub = z.memo(function({
10628
10620
  O,
10629
10621
  Ee,
10630
10622
  _e,
10631
- F,
10623
+ L,
10632
10624
  f,
10633
10625
  h,
10634
10626
  C,
@@ -10637,26 +10629,26 @@ const Ub = z.memo(function({
10637
10629
  /* @__PURE__ */ c.jsx(ui, { className: "h-4 w-4 text-muted-foreground" }),
10638
10630
  /* @__PURE__ */ c.jsx("span", { className: "text-sm text-muted-foreground", children: "File upload" })
10639
10631
  ] }), []), st = z.useCallback(() => {
10640
- 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;
10641
10633
  if (!k && !Q && !r)
10642
10634
  return je();
10643
10635
  if (t.model === "reflection") {
10644
- const ae = ue.trim(), he = oc(ae);
10645
- if (he && typeof he == "object")
10646
- 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 });
10647
10639
  }
10648
10640
  if (k && re.name === "get_issues") {
10649
- 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);
10650
10642
  if (Se) return /* @__PURE__ */ c.jsx(Gb, { issues: Se });
10651
10643
  }
10652
10644
  if (k) {
10653
10645
  const ae = Fb(t.content);
10654
10646
  if (ae.length > 0)
10655
- return /* @__PURE__ */ c.jsx("div", { className: "space-y-2", children: ae.map((he, Se) => {
10656
- 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)}
10657
10649
  … [truncated ${ve.length - Dn} chars]` : ve, et = R === "expanded";
10658
10650
  return /* @__PURE__ */ c.jsxs(Ml, { open: et, onOpenChange: (Ve) => S(Ve ? "expanded" : "preview"), children: [
10659
- /* @__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)}` : "") }) }),
10660
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 ? "..." : "") }) }),
10661
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: [
10662
10654
  " ",
@@ -10666,11 +10658,11 @@ const Ub = z.memo(function({
10666
10658
  /* @__PURE__ */ c.jsx(ar, { className: "h-3 w-3 mr-1" }),
10667
10659
  " Show more"
10668
10660
  ] }) }) })
10669
- ] }, he.toolCallId ?? Se);
10661
+ ] }, fe.toolCallId ?? Se);
10670
10662
  }) });
10671
10663
  }
10672
10664
  if (!k) {
10673
- 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)) });
10674
10666
  return r ? /* @__PURE__ */ c.jsxs("div", { "aria-busy": "true", role: "status", children: [
10675
10667
  ae,
10676
10668
  /* @__PURE__ */ c.jsx(Hb, { className: Y })
@@ -10679,7 +10671,7 @@ const Ub = z.memo(function({
10679
10671
  }, [
10680
10672
  ue,
10681
10673
  de.length,
10682
- fe.length,
10674
+ ge.length,
10683
10675
  ye.length,
10684
10676
  r,
10685
10677
  t.model,
@@ -10788,7 +10780,7 @@ const Ub = z.memo(function({
10788
10780
  }
10789
10781
  )
10790
10782
  ] }),
10791
- F === "user" && w && /* @__PURE__ */ c.jsx(
10783
+ L === "user" && w && /* @__PURE__ */ c.jsx(
10792
10784
  He,
10793
10785
  {
10794
10786
  variant: "ghost",
@@ -10799,7 +10791,7 @@ const Ub = z.memo(function({
10799
10791
  children: /* @__PURE__ */ c.jsx(Va, { className: J(Y, q ? "h-3 w-3" : "h-4 w-4") })
10800
10792
  }
10801
10793
  ),
10802
- F === "assistant" && v && /* @__PURE__ */ c.jsx(
10794
+ L === "assistant" && v && /* @__PURE__ */ c.jsx(
10803
10795
  He,
10804
10796
  {
10805
10797
  variant: "ghost",
@@ -10847,7 +10839,7 @@ const Ub = z.memo(function({
10847
10839
  children: /* @__PURE__ */ c.jsx(Wa, { className: J(b ? "text-success" : "text-current", q ? "h-3 w-3" : "h-4 w-4") })
10848
10840
  }
10849
10841
  ),
10850
- F === "user" && w && /* @__PURE__ */ c.jsx(
10842
+ L === "user" && w && /* @__PURE__ */ c.jsx(
10851
10843
  He,
10852
10844
  {
10853
10845
  variant: "ghost",
@@ -10857,7 +10849,7 @@ const Ub = z.memo(function({
10857
10849
  children: /* @__PURE__ */ c.jsx(Va, { className: J("text-current", q ? "h-3 w-3" : "h-4 w-4") })
10858
10850
  }
10859
10851
  ),
10860
- F === "assistant" && v && /* @__PURE__ */ c.jsx(
10852
+ L === "assistant" && v && /* @__PURE__ */ c.jsx(
10861
10853
  He,
10862
10854
  {
10863
10855
  variant: "ghost",
@@ -11033,7 +11025,7 @@ const ic = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, _d = z.forwa
11033
11025
  onScrollAway: g,
11034
11026
  onAtBottom: x
11035
11027
  }, b) => {
11036
- 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) => {
11037
11029
  E(O), g && g(!O), x && x(O);
11038
11030
  }, [g, x]), j = pt(() => {
11039
11031
  if (a)
@@ -11528,7 +11520,7 @@ const dy = (e) => ({
11528
11520
  const _ = (((O = s.flip) == null ? void 0 : O.index) || 0) + 1, V = E[_];
11529
11521
  if (V && (!(f === "alignment" ? b !== an(V) : !1) || // We leave the current main axis only if every placement on that axis
11530
11522
  // overflows the main axis.
11531
- N.every((F) => an(F.placement) === b ? F.overflows[0] > 0 : !0)))
11523
+ N.every((L) => an(L.placement) === b ? L.overflows[0] > 0 : !0)))
11532
11524
  return {
11533
11525
  data: {
11534
11526
  index: _,
@@ -11538,20 +11530,20 @@ const dy = (e) => ({
11538
11530
  placement: V
11539
11531
  }
11540
11532
  };
11541
- let U = (M = N.filter((q) => q.overflows[0] <= 0).sort((q, F) => q.overflows[1] - F.overflows[1])[0]) == null ? void 0 : M.placement;
11533
+ let U = (M = N.filter((q) => q.overflows[0] <= 0).sort((q, L) => q.overflows[1] - L.overflows[1])[0]) == null ? void 0 : M.placement;
11542
11534
  if (!U)
11543
11535
  switch (p) {
11544
11536
  case "bestFit": {
11545
11537
  var D;
11546
- const q = (D = N.filter((F) => {
11538
+ const q = (D = N.filter((L) => {
11547
11539
  if (C) {
11548
- const k = an(F.placement);
11540
+ const k = an(L.placement);
11549
11541
  return k === b || // Create a bias to the `y` side axis due to horizontal
11550
11542
  // reading directions favoring greater width.
11551
11543
  k === "y";
11552
11544
  }
11553
11545
  return !0;
11554
- }).map((F) => [F.placement, F.overflows.filter((k) => k > 0).reduce((k, W) => k + W, 0)]).sort((F, k) => F[1] - k[1])[0]) == null ? void 0 : D[0];
11546
+ }).map((L) => [L.placement, L.overflows.filter((k) => k > 0).reduce((k, W) => k + W, 0)]).sort((L, k) => L[1] - k[1])[0]) == null ? void 0 : D[0];
11555
11547
  q && (U = q);
11556
11548
  break;
11557
11549
  }
@@ -12377,19 +12369,19 @@ function e0(e) {
12377
12369
  isPositioned: !1
12378
12370
  }), [h, p] = m.useState(r);
12379
12371
  qo(h, r) || p(r);
12380
- const [w, v] = m.useState(null), [g, x] = m.useState(null), b = m.useCallback((F) => {
12381
- F !== C.current && (C.current = F, v(F));
12382
- }, []), y = m.useCallback((F) => {
12383
- F !== E.current && (E.current = F, x(F));
12372
+ const [w, v] = m.useState(null), [g, x] = m.useState(null), b = m.useCallback((L) => {
12373
+ L !== C.current && (C.current = L, v(L));
12374
+ }, []), y = m.useCallback((L) => {
12375
+ L !== E.current && (E.current = L, x(L));
12384
12376
  }, []), R = s || w, S = i || g, C = m.useRef(null), E = m.useRef(null), I = m.useRef(d), j = l != null, N = ai(l), O = ai(o), M = ai(u), D = m.useCallback(() => {
12385
12377
  if (!C.current || !E.current)
12386
12378
  return;
12387
- const F = {
12379
+ const L = {
12388
12380
  placement: t,
12389
12381
  strategy: n,
12390
12382
  middleware: h
12391
12383
  };
12392
- O.current && (F.platform = O.current), Jy(C.current, E.current, F).then((k) => {
12384
+ O.current && (L.platform = O.current), Jy(C.current, E.current, L).then((k) => {
12393
12385
  const W = {
12394
12386
  ...k,
12395
12387
  // The floating element's position may be recomputed while it's closed
@@ -12404,8 +12396,8 @@ function e0(e) {
12404
12396
  });
12405
12397
  }, [h, t, n, O, M]);
12406
12398
  Oo(() => {
12407
- u === !1 && I.current.isPositioned && (I.current.isPositioned = !1, f((F) => ({
12408
- ...F,
12399
+ u === !1 && I.current.isPositioned && (I.current.isPositioned = !1, f((L) => ({
12400
+ ...L,
12409
12401
  isPositioned: !1
12410
12402
  })));
12411
12403
  }, [u]);
@@ -12428,16 +12420,16 @@ function e0(e) {
12428
12420
  reference: R,
12429
12421
  floating: S
12430
12422
  }), [R, S]), q = m.useMemo(() => {
12431
- const F = {
12423
+ const L = {
12432
12424
  position: n,
12433
12425
  left: 0,
12434
12426
  top: 0
12435
12427
  };
12436
12428
  if (!U.floating)
12437
- return F;
12429
+ return L;
12438
12430
  const k = gc(U.floating, d.x), W = gc(U.floating, d.y);
12439
12431
  return a ? {
12440
- ...F,
12432
+ ...L,
12441
12433
  transform: "translate(" + k + "px, " + W + "px)",
12442
12434
  ...Ud(U.floating) >= 1.5 && {
12443
12435
  willChange: "transform"
@@ -12576,7 +12568,7 @@ var Ia = "PopperContent", [f0, h0] = Kd(Ia), Jd = m.forwardRef(
12576
12568
  boundary: O.filter(m0),
12577
12569
  // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
12578
12570
  altBoundary: M
12579
- }, { refs: _, floatingStyles: V, placement: U, isPositioned: q, middlewareData: F } = e0({
12571
+ }, { refs: _, floatingStyles: V, placement: U, isPositioned: q, middlewareData: L } = e0({
12580
12572
  // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
12581
12573
  strategy: "fixed",
12582
12574
  placement: j,
@@ -12610,7 +12602,7 @@ var Ia = "PopperContent", [f0, h0] = Kd(Ia), Jd = m.forwardRef(
12610
12602
  xt(() => {
12611
12603
  q && (Y == null || Y());
12612
12604
  }, [q, Y]);
12613
- const ue = (B = F.arrow) == null ? void 0 : B.x, re = (P = F.arrow) == null ? void 0 : P.y, de = ((G = F.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();
12614
12606
  return xt(() => {
12615
12607
  x && ye(window.getComputedStyle(x).zIndex);
12616
12608
  }, [x]), /* @__PURE__ */ c.jsx(
@@ -12623,15 +12615,15 @@ var Ia = "PopperContent", [f0, h0] = Kd(Ia), Jd = m.forwardRef(
12623
12615
  transform: q ? V.transform : "translate(0, -200%)",
12624
12616
  // keep off the page when measuring
12625
12617
  minWidth: "max-content",
12626
- zIndex: fe,
12618
+ zIndex: ge,
12627
12619
  "--radix-popper-transform-origin": [
12628
- (Z = F.transformOrigin) == null ? void 0 : Z.x,
12629
- (le = F.transformOrigin) == null ? void 0 : le.y
12620
+ (Z = L.transformOrigin) == null ? void 0 : Z.x,
12621
+ (le = L.transformOrigin) == null ? void 0 : le.y
12630
12622
  ].join(" "),
12631
12623
  // hide the content if using the hide middleware and should be hidden
12632
12624
  // set visibility to hidden and disable pointer events so the UI behaves
12633
12625
  // as if the PopperContent isn't there at all
12634
- ...((oe = F.hide) == null ? void 0 : oe.referenceHidden) && {
12626
+ ...((oe = L.hide) == null ? void 0 : oe.referenceHidden) && {
12635
12627
  visibility: "hidden",
12636
12628
  pointerEvents: "none"
12637
12629
  }
@@ -13016,13 +13008,13 @@ var Ut = "MenuContent", [$0, ja] = Qn(Ut), vf = m.forwardRef(
13016
13008
  ...v
13017
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) => {
13018
13010
  var B, P;
13019
- 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;
13020
13012
  (function G(Z) {
13021
13013
  N.current = Z, window.clearTimeout(j.current), Z !== "" && (j.current = window.setTimeout(() => G(""), 1e3));
13022
13014
  })(W), ye && setTimeout(() => ye.focus());
13023
13015
  };
13024
13016
  m.useEffect(() => () => window.clearTimeout(j.current), []), pa();
13025
- const F = m.useCallback((k) => {
13017
+ const L = m.useCallback((k) => {
13026
13018
  var Y, ue;
13027
13019
  return D.current === ((Y = M.current) == null ? void 0 : Y.side) && nS(k, (ue = M.current) == null ? void 0 : ue.area);
13028
13020
  }, []);
@@ -13033,22 +13025,22 @@ var Ut = "MenuContent", [$0, ja] = Qn(Ut), vf = m.forwardRef(
13033
13025
  searchRef: N,
13034
13026
  onItemEnter: m.useCallback(
13035
13027
  (k) => {
13036
- F(k) && k.preventDefault();
13028
+ L(k) && k.preventDefault();
13037
13029
  },
13038
- [F]
13030
+ [L]
13039
13031
  ),
13040
13032
  onItemLeave: m.useCallback(
13041
13033
  (k) => {
13042
13034
  var W;
13043
- F(k) || ((W = E.current) == null || W.focus(), C(null));
13035
+ L(k) || ((W = E.current) == null || W.focus(), C(null));
13044
13036
  },
13045
- [F]
13037
+ [L]
13046
13038
  ),
13047
13039
  onTriggerLeave: m.useCallback(
13048
13040
  (k) => {
13049
- F(k) && k.preventDefault();
13041
+ L(k) && k.preventDefault();
13050
13042
  },
13051
- [F]
13043
+ [L]
13052
13044
  ),
13053
13045
  pointerGraceTimerRef: O,
13054
13046
  onPointerGraceIntentChange: m.useCallback((k) => {
@@ -13793,13 +13785,13 @@ function ci({
13793
13785
  streamingAssistantId: M,
13794
13786
  lastCheckpointId: D,
13795
13787
  lastCheckpointNs: _
13796
- } = sx(), [V, U] = pe(null), [q, F] = 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(() => {
13797
13789
  Se.current && (Se.current.value = ""), ve.current && (ve.current.value = ""), de((se) => se + 1), ye((se) => se + 1);
13798
13790
  }, []), Ve = ut(!1);
13799
13791
  gt(() => {
13800
13792
  Ve.current && !N && (ue([]), et()), Ve.current = N;
13801
13793
  }, [N, et]);
13802
- const [L, X] = pe("desktop");
13794
+ const [F, X] = he("desktop");
13803
13795
  gt(() => {
13804
13796
  const se = () => {
13805
13797
  const xe = window.innerWidth;
@@ -13838,7 +13830,7 @@ function ci({
13838
13830
  }, [v, D, _, je, x]), gt(() => {
13839
13831
  D && (st(D), Q(_ ?? null));
13840
13832
  }, [D, _]);
13841
- const Ce = Ue(async () => {
13833
+ const Ce = We(async () => {
13842
13834
  if (!(!S || C))
13843
13835
  try {
13844
13836
  await j();
@@ -13886,19 +13878,19 @@ function ci({
13886
13878
  checkpointNs: at ?? _ ?? void 0,
13887
13879
  payloadExtras: V ? { edit: !0, originalMessageId: V } : void 0,
13888
13880
  attachments: Y
13889
- }), f == null || f(xe), W(null), ue([]), et(), U(null), F("");
13881
+ }), f == null || f(xe), W(null), ue([]), et(), U(null), L("");
13890
13882
  } catch ($e) {
13891
13883
  const rt = ($e == null ? void 0 : $e.message) || "Failed to send message";
13892
13884
  W(rt), p == null || p(rt);
13893
13885
  }
13894
13886
  }
13895
13887
  }, it = z.useCallback((se, xe) => {
13896
- u && (U(se), F(xe), W(null));
13888
+ u && (U(se), L(xe), W(null));
13897
13889
  }, [u]), At = z.useCallback(() => {
13898
- U(null), F(""), W(null);
13899
- }, []), tr = Ue((se, xe) => {
13890
+ U(null), L(""), W(null);
13891
+ }, []), tr = We((se, xe) => {
13900
13892
  it(se, xe);
13901
- }, [it]), Pn = Ue((se) => {
13893
+ }, [it]), Pn = We((se) => {
13902
13894
  const xe = ($e) => {
13903
13895
  const rt = $e.content || [], jt = rt.filter((tn) => tn.type === "text").map((tn) => tn.text).join("");
13904
13896
  if (jt) return jt;
@@ -13950,7 +13942,7 @@ function ci({
13950
13942
  return Number.isNaN(xe) ? se : new Date(xe).toLocaleString();
13951
13943
  }, en = async (se) => {
13952
13944
  if (v) {
13953
- he(!0);
13945
+ fe(!0);
13954
13946
  try {
13955
13947
  if (!se) {
13956
13948
  await y(), st(null), Q(null);
@@ -13959,7 +13951,7 @@ function ci({
13959
13951
  const xe = _e.find((rt) => rt.checkpointId === se), $e = (xe == null ? void 0 : xe.checkpointNs) ?? null;
13960
13952
  await b(se, $e), st(se), Q($e);
13961
13953
  } finally {
13962
- he(!1);
13954
+ fe(!1);
13963
13955
  }
13964
13956
  }
13965
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 || ""}`;
@@ -14015,7 +14007,7 @@ function ci({
14015
14007
  streamingAssistantId: M,
14016
14008
  streamingDebounceMs: typeof s == "number" ? s : o,
14017
14009
  followNewMessages: i,
14018
- layoutSize: L,
14010
+ layoutSize: F,
14019
14011
  enableMessageEditing: u,
14020
14012
  editingMessageId: V,
14021
14013
  onStartReached: () => {
@@ -14091,7 +14083,7 @@ function ci({
14091
14083
  onChange: On,
14092
14084
  className: "hidden"
14093
14085
  },
14094
- fe
14086
+ ge
14095
14087
  ),
14096
14088
  B && /* @__PURE__ */ c.jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
14097
14089
  /* @__PURE__ */ c.jsx(fi, { className: "h-4 w-4 animate-spin" }),
@@ -14740,7 +14732,7 @@ function wc({
14740
14732
  deleteThread: v,
14741
14733
  renameThread: g,
14742
14734
  isLoadingThreads: x
14743
- } = 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);
14744
14736
  gt(() => {
14745
14737
  y(h ?? []);
14746
14738
  }, [h]);
@@ -14788,7 +14780,7 @@ function wc({
14788
14780
  } catch {
14789
14781
  return "";
14790
14782
  }
14791
- }, F = (k) => k.title || `Thread ${k.threadId.slice(0, 8)}`;
14783
+ }, L = (k) => k.title || `Thread ${k.threadId.slice(0, 8)}`;
14792
14784
  return /* @__PURE__ */ c.jsxs("div", { className: `flex flex-col h-full ${e} ${s.container || ""}`, children: [
14793
14785
  t && /* @__PURE__ */ c.jsx("div", { className: s.header || "flex-shrink-0 p-2 border-b bg-slate-800 border-slate-700 text-slate-100 flex justify-end", children: /* @__PURE__ */ c.jsx(
14794
14786
  He,
@@ -14825,7 +14817,7 @@ function wc({
14825
14817
  /* @__PURE__ */ c.jsx(He, { variant: "ghost", size: "sm", onClick: () => _(k.threadId), className: "h-6 w-6 p-0", children: /* @__PURE__ */ c.jsx(Wi, { size: 12 }) }),
14826
14818
  /* @__PURE__ */ c.jsx(He, { variant: "ghost", size: "sm", onClick: V, className: "h-6 w-6 p-0", children: /* @__PURE__ */ c.jsx(lr, { size: 12 }) })
14827
14819
  ] }) : /* @__PURE__ */ c.jsxs(c.Fragment, { children: [
14828
- /* @__PURE__ */ c.jsx("div", { className: "font-medium text-sm truncate text-gray-900 dark:text-slate-100", children: F(k) }),
14820
+ /* @__PURE__ */ c.jsx("div", { className: "font-medium text-sm truncate text-gray-900 dark:text-slate-100", children: L(k) }),
14829
14821
  /* @__PURE__ */ c.jsxs("div", { className: "flex items-center gap-2 text-xs text-gray-500 dark:text-slate-400 mt-1", children: [
14830
14822
  /* @__PURE__ */ c.jsx(Vp, { size: 10 }),
14831
14823
  /* @__PURE__ */ c.jsx("span", { children: q(k.updatedAt || k.createdAt) })
@@ -15206,8 +15198,8 @@ var wC = [" ", "Enter", "ArrowUp", "ArrowDown"], bC = [" ", "Enter"], Gn = "Sele
15206
15198
  }, []),
15207
15199
  onNativeOptionRemove: m.useCallback((U) => {
15208
15200
  _((q) => {
15209
- const F = new Set(q);
15210
- return F.delete(U), F;
15201
+ const L = new Set(q);
15202
+ return L.delete(U), L;
15211
15203
  });
15212
15204
  }, []),
15213
15205
  children: n
@@ -15365,7 +15357,7 @@ var Kt = 10, [Uh, _n] = Cr(Yn), kC = "SelectContentImpl", IC = hr("SelectContent
15365
15357
  m.useEffect(() => {
15366
15358
  D && q();
15367
15359
  }, [D, q]);
15368
- const { onOpenChange: F, triggerPointerDownPosRef: k } = b;
15360
+ const { onOpenChange: L, triggerPointerDownPosRef: k } = b;
15369
15361
  m.useEffect(() => {
15370
15362
  if (y) {
15371
15363
  let B = { x: 0, y: 0 };
@@ -15376,18 +15368,18 @@ var Kt = 10, [Uh, _n] = Cr(Yn), kC = "SelectContentImpl", IC = hr("SelectContent
15376
15368
  y: Math.abs(Math.round(Z.pageY) - (((oe = k.current) == null ? void 0 : oe.y) ?? 0))
15377
15369
  };
15378
15370
  }, G = (Z) => {
15379
- B.x <= 10 && B.y <= 10 ? Z.preventDefault() : y.contains(Z.target) || F(!1), document.removeEventListener("pointermove", P), k.current = null;
15371
+ B.x <= 10 && B.y <= 10 ? Z.preventDefault() : y.contains(Z.target) || L(!1), document.removeEventListener("pointermove", P), k.current = null;
15380
15372
  };
15381
15373
  return k.current !== null && (document.addEventListener("pointermove", P), document.addEventListener("pointerup", G, { capture: !0, once: !0 })), () => {
15382
15374
  document.removeEventListener("pointermove", P), document.removeEventListener("pointerup", G, { capture: !0 });
15383
15375
  };
15384
15376
  }
15385
- }, [y, F, k]), m.useEffect(() => {
15386
- const B = () => F(!1);
15377
+ }, [y, L, k]), m.useEffect(() => {
15378
+ const B = () => L(!1);
15387
15379
  return window.addEventListener("blur", B), window.addEventListener("resize", B), () => {
15388
15380
  window.removeEventListener("blur", B), window.removeEventListener("resize", B);
15389
15381
  };
15390
- }, [F]);
15382
+ }, [L]);
15391
15383
  const [W, Y] = ap((B) => {
15392
15384
  const P = M().filter((le) => !le.disabled), G = P.find((le) => le.ref.current === document.activeElement), Z = lp(P, B, G);
15393
15385
  Z && setTimeout(() => Z.ref.current.focus());
@@ -15403,7 +15395,7 @@ var Kt = 10, [Uh, _n] = Cr(Yn), kC = "SelectContentImpl", IC = hr("SelectContent
15403
15395
  (b.value !== void 0 && b.value === P || Z) && O(B);
15404
15396
  },
15405
15397
  [b.value]
15406
- ), fe = r === "popper" ? Li : Vh, ye = fe === Li ? {
15398
+ ), ge = r === "popper" ? Li : Vh, ye = ge === Li ? {
15407
15399
  side: a,
15408
15400
  sideOffset: l,
15409
15401
  align: u,
@@ -15453,7 +15445,7 @@ var Kt = 10, [Uh, _n] = Cr(Yn), kC = "SelectContentImpl", IC = hr("SelectContent
15453
15445
  onFocusOutside: (B) => B.preventDefault(),
15454
15446
  onDismiss: () => b.onOpenChange(!1),
15455
15447
  children: /* @__PURE__ */ c.jsx(
15456
- fe,
15448
+ ge,
15457
15449
  {
15458
15450
  role: "listbox",
15459
15451
  id: b.contentId,
@@ -15516,12 +15508,12 @@ var NC = "SelectItemAlignedPosition", Vh = m.forwardRef((e, t) => {
15516
15508
  ]);
15517
15509
  a.style.minWidth = Ge + "px", a.style.right = _e + "px";
15518
15510
  }
15519
- 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), F = parseInt(_.paddingBottom, 10), k = V + U + D + F + 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;
15520
15512
  if (P <= de) {
15521
15513
  const le = O.length > 0 && g === O[O.length - 1].ref.current;
15522
15514
  a.style.bottom = "0px";
15523
15515
  const oe = u.clientHeight - v.offsetTop - v.offsetHeight, Me = Math.max(
15524
- fe,
15516
+ ge,
15525
15517
  ye + // viewport might have padding bottom, include it to avoid a scrollable viewport
15526
15518
  (le ? re : 0) + oe + q
15527
15519
  ), Ge = P + Me;
@@ -16188,7 +16180,7 @@ const nT = {
16188
16180
  }
16189
16181
  };
16190
16182
  function $T({ settings: e, onSettingsChange: t, className: n = "" }) {
16191
- 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();
16192
16184
  gt(() => {
16193
16185
  const g = JSON.stringify(a) !== JSON.stringify(e);
16194
16186
  d(g);