teodor-new-chat-ui 4.1.2 → 4.1.3

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 $, { createContext as Xr, useContext as ts, useReducer as Ap, useRef as it, useCallback as ze, useEffect as gt, useMemo as pt, useState as me, createElement as yo, useLayoutEffect as jp } from "react";
5
+ import $, { createContext as Xr, useContext as ts, useReducer as Ap, useRef as it, useCallback as ze, useEffect as gt, useMemo as pt, useState as pe, createElement as yo, useLayoutEffect as jp } from "react";
6
6
  import { Square as _p, Send as Pp, X as ur, 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 jr, ChevronDown as cr, 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 mr } from "@radix-ui/react-slot";
8
8
  import { cva as ns } from "class-variance-authority";
@@ -217,7 +217,7 @@ function om() {
217
217
  var se = typeof WeakMap == "function" ? WeakMap : Map;
218
218
  X = new se();
219
219
  }
220
- function ne(T, B) {
220
+ function te(T, B) {
221
221
  if (!T || V)
222
222
  return "";
223
223
  {
@@ -289,7 +289,7 @@ function om() {
289
289
  return typeof T == "function" && X.set(T, Fn), Fn;
290
290
  }
291
291
  function Le(T, B, Q) {
292
- return ne(T, !1);
292
+ return te(T, !1);
293
293
  }
294
294
  function Ge(T) {
295
295
  var B = T.prototype;
@@ -299,7 +299,7 @@ function om() {
299
299
  if (T == null)
300
300
  return "";
301
301
  if (typeof T == "function")
302
- return ne(T, Ge(T));
302
+ return te(T, Ge(T));
303
303
  if (typeof T == "string")
304
304
  return P(T);
305
305
  switch (T) {
@@ -361,7 +361,7 @@ function om() {
361
361
  return Q;
362
362
  }
363
363
  }
364
- function pe(T) {
364
+ function he(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 (pe(T))
375
+ if (he(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 Ie = x.ReactCurrentOwner, Xe = {
@@ -510,7 +510,7 @@ Check the top-level render call using <` + Q + ">.");
510
510
  return B;
511
511
  }
512
512
  }
513
- function ee(T, B) {
513
+ function ne(T, B) {
514
514
  {
515
515
  if (!T._store || T._store.validated || T.key != null)
516
516
  return;
@@ -523,14 +523,14 @@ Check the top-level render call using <` + Q + ">.");
523
523
  T && T._owner && T._owner !== kt.current && (Ce = " It was passed a child from " + D(T._owner.type) + "."), qt(T), b('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', Q, Ce), qt(null);
524
524
  }
525
525
  }
526
- function he(T, B) {
526
+ function xe(T, B) {
527
527
  {
528
528
  if (typeof T != "object")
529
529
  return;
530
530
  if (Z(T))
531
531
  for (var Q = 0; Q < T.length; Q++) {
532
532
  var Ce = T[Q];
533
- Dn(Ce) && ee(Ce, B);
533
+ Dn(Ce) && ne(Ce, B);
534
534
  }
535
535
  else if (Dn(T))
536
536
  T._store && (T._store.validated = !0);
@@ -538,7 +538,7 @@ Check the top-level render call using <` + Q + ">.");
538
538
  var Ve = g(T);
539
539
  if (typeof Ve == "function" && Ve !== T.entries)
540
540
  for (var Je = Ve.call(T), $e; !($e = Je.next()).done; )
541
- Dn($e.value) && ee($e.value, B);
541
+ Dn($e.value) && ne($e.value, B);
542
542
  }
543
543
  }
544
544
  }
@@ -600,12 +600,12 @@ Check the top-level render call using <` + Q + ">.");
600
600
  if (Ce)
601
601
  if (Z($t)) {
602
602
  for (var sr = 0; sr < $t.length; sr++)
603
- he($t[sr], T);
603
+ xe($t[sr], T);
604
604
  Object.freeze && Object.freeze($t);
605
605
  } else
606
606
  b("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
607
607
  else
608
- he($t, T);
608
+ xe($t, T);
609
609
  }
610
610
  if (be.call(B, "key")) {
611
611
  var Fn = D(T), It = Object.keys(B).filter(function(kp) {
@@ -2896,7 +2896,7 @@ function Jg(e) {
2896
2896
  return t[t.length - 1] || null;
2897
2897
  }
2898
2898
  function Zg(e = {}) {
2899
- const t = pt(() => vn(e.baseUrl), [e.baseUrl]), n = e.streamPath ?? "/runs/stream", [r, o] = me(e.token ?? null), s = it(e.headers ?? {}), i = e.credentials ?? "include", [a, l] = me(!1), [u, d] = me(null), [f, h] = me(""), [p, w] = me(null), [v, g] = me(0), [x, b] = me(!1), y = it(null), R = it(!0), S = it(0), C = ze((N) => {
2899
+ const t = pt(() => vn(e.baseUrl), [e.baseUrl]), n = e.streamPath ?? "/runs/stream", [r, o] = pe(e.token ?? null), s = it(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 = it(null), R = it(!0), S = it(0), C = ze((N) => {
2900
2900
  o(N);
2901
2901
  }, []), E = ze(() => {
2902
2902
  var N;
@@ -2977,7 +2977,7 @@ function Zg(e = {}) {
2977
2977
  P = [], R.current && h((je) => je + be);
2978
2978
  }
2979
2979
  X = null;
2980
- }, ne = () => {
2980
+ }, te = () => {
2981
2981
  typeof window < "u" && X == null && (X = requestAnimationFrame(se));
2982
2982
  };
2983
2983
  let Le = Date.now();
@@ -3000,13 +3000,13 @@ function Zg(e = {}) {
3000
3000
  `)) >= 0; ) {
3001
3001
  const ae = z.slice(0, Z);
3002
3002
  z = z.slice(Z + 2);
3003
- const pe = ex(ae);
3004
- if (!pe) continue;
3003
+ const he = ex(ae);
3004
+ if (!he) continue;
3005
3005
  let Se;
3006
3006
  try {
3007
- Se = JSON.parse(pe);
3007
+ Se = JSON.parse(he);
3008
3008
  } catch {
3009
- console.debug("[use-chat] malformed SSE:", pe.slice(0, 200));
3009
+ console.debug("[use-chat] malformed SSE:", he.slice(0, 200));
3010
3010
  continue;
3011
3011
  }
3012
3012
  const ve = Qg(Se) ? Se.data : Se;
@@ -3020,10 +3020,10 @@ function Zg(e = {}) {
3020
3020
  V > 0 && Ie > V + 1 && ((k = M == null ? void 0 : M.onGap) == null || k.call(M, { from: V, to: Ie })), V = Ie, S.current = Ie, g(Ie);
3021
3021
  }
3022
3022
  if (O == null || O(ve), ve.type === "token" && e.autoAppendAssistant !== !1)
3023
- P.push(ve.content), ne();
3023
+ P.push(ve.content), te();
3024
3024
  else if (ve.type === "message_delta") {
3025
3025
  const Xe = ve.delta.filter((Ue) => Ue.type === "text").map((Ue) => Ue.text).join("");
3026
- Xe && e.autoAppendAssistant !== !1 && (P.push(Xe), ne());
3026
+ Xe && e.autoAppendAssistant !== !1 && (P.push(Xe), te());
3027
3027
  } else ve.type === "heartbeat" ? console.debug("[use-chat] heartbeat received") : (X !== null && cancelAnimationFrame(X), se(), ve.type === "checkpoint" ? w(ve.checkpointId) : ve.type === "error" && d(ve.message));
3028
3028
  }
3029
3029
  }
@@ -3155,7 +3155,7 @@ function ox({
3155
3155
  onError: i,
3156
3156
  onThreadChange: a
3157
3157
  }) {
3158
- const { api: l, baseUrl: u } = Jc(), d = pt(() => vn(u), [u]), [f, h] = me([]), [p, w] = me(t), [v, g] = me(!1), [x, b] = me(!1), [y, R] = me(!1), [S, C] = me(!1), [E, I] = me(null), [j, N] = me(void 0), [O, M] = me(void 0), {
3158
+ const { api: l, baseUrl: u } = Jc(), d = pt(() => vn(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), {
3159
3159
  state: D,
3160
3160
  seed: _,
3161
3161
  prepend: W,
@@ -3194,14 +3194,13 @@ function ox({
3194
3194
  g(!1);
3195
3195
  }
3196
3196
  }, [l, i]), z = ze(async () => {
3197
- if (fe.current) {
3198
- fe.current = !1;
3197
+ fe.current && (fe.current = !1, setTimeout(async () => {
3199
3198
  try {
3200
3199
  await ue();
3201
3200
  } catch (G) {
3202
3201
  console.error("[ChatSessionProvider] Failed to refresh threads after stream:", G);
3203
3202
  }
3204
- }
3203
+ }, 100));
3205
3204
  }, [ue]), P = it(!1), V = ze(() => {
3206
3205
  fe.current = !0, P.current || z();
3207
3206
  }, [z]), X = ze(
@@ -3215,7 +3214,7 @@ function ox({
3215
3214
  [W, _]
3216
3215
  ), se = ze(() => {
3217
3216
  L([]), R(!1), C(!1), I(null), N(void 0), M(void 0);
3218
- }, [L]), ne = ze(({ from: G, to: le }) => {
3217
+ }, [L]), te = ze(({ from: G, to: le }) => {
3219
3218
  const Ee = k.current;
3220
3219
  Ee && console.warn(
3221
3220
  `[ChatSessionProvider] Stream sequence gap detected (${G} -> ${le}) for thread ${Ee}`
@@ -3237,7 +3236,7 @@ function ox({
3237
3236
  onUnhandledEvent: (G) => {
3238
3237
  console.warn(`[ChatSessionProvider] Unhandled stream event: ${G.type}`, G);
3239
3238
  },
3240
- onSequenceGap: ne
3239
+ onSequenceGap: te
3241
3240
  });
3242
3241
  gt(() => {
3243
3242
  P.current = be, be || z();
@@ -3306,7 +3305,7 @@ function ox({
3306
3305
  console.warn("[ChatSessionProvider] Failed to clear lastThreadId:", G);
3307
3306
  }
3308
3307
  }, "clearCurrentThread");
3309
- }, [se, Re]), pe = ze(
3308
+ }, [se, Re]), he = ze(
3310
3309
  async (G) => {
3311
3310
  const le = await l.listCheckpoints(G);
3312
3311
  return $g(le, G);
@@ -3383,24 +3382,21 @@ function ox({
3383
3382
  nodeFilter: le == null ? void 0 : le.nodeFilter,
3384
3383
  config: le == null ? void 0 : le.config
3385
3384
  };
3386
- V(), Ge(Er, {
3385
+ Ge(Er, {
3387
3386
  onError: (mn) => {
3388
3387
  console.warn("[ChatSessionProvider] Stream error:", mn);
3389
3388
  },
3390
- onOpen: ({ threadId: mn, created: ee }) => {
3391
- if (!k.current && mn) {
3392
- const he = D.messages.length <= 1;
3393
- he && (oe.current = mn), w(mn), (ee || he) && V();
3394
- }
3389
+ onOpen: ({ threadId: mn, created: ne }) => {
3390
+ !k.current && mn && (D.messages.length <= 1 && (oe.current = mn), w(mn));
3395
3391
  },
3396
- onGap: ne
3392
+ onGap: te
3397
3393
  });
3398
3394
  },
3399
3395
  [
3400
3396
  l,
3401
3397
  o,
3402
3398
  s,
3403
- ne,
3399
+ te,
3404
3400
  V,
3405
3401
  D.lastCheckpointId,
3406
3402
  D.lastCheckpointNs,
@@ -3462,7 +3458,7 @@ function ox({
3462
3458
  refreshThreads: ue,
3463
3459
  loadThread: Z,
3464
3460
  clearCurrentThread: ae,
3465
- listCheckpoints: pe,
3461
+ listCheckpoints: he,
3466
3462
  navigateToCheckpoint: Se,
3467
3463
  returnToLatest: ve
3468
3464
  }),
@@ -3473,7 +3469,7 @@ function ox({
3473
3469
  st,
3474
3470
  x,
3475
3471
  v,
3476
- pe,
3472
+ he,
3477
3473
  Z,
3478
3474
  Se,
3479
3475
  ue,
@@ -3792,7 +3788,7 @@ function ye(e) {
3792
3788
  e(n) && t(n);
3793
3789
  };
3794
3790
  }
3795
- function te(e) {
3791
+ function ee(e) {
3796
3792
  return (t) => ou(t, e);
3797
3793
  }
3798
3794
  function rn(e) {
@@ -4098,13 +4094,13 @@ const Tt = He(
4098
4094
  return ce(
4099
4095
  F(
4100
4096
  e,
4101
- te(({ scrollTop: g }) => g)
4097
+ ee(({ scrollTop: g }) => g)
4102
4098
  ),
4103
4099
  t
4104
4100
  ), ce(
4105
4101
  F(
4106
4102
  e,
4107
- te(({ scrollHeight: g }) => g)
4103
+ ee(({ scrollHeight: g }) => g)
4108
4104
  ),
4109
4105
  i
4110
4106
  ), ce(t, o), {
@@ -4453,7 +4449,7 @@ const _x = {
4453
4449
  current: [],
4454
4450
  prev: []
4455
4451
  }),
4456
- te(({ prev: S }) => S)
4452
+ ee(({ prev: S }) => S)
4457
4453
  ),
4458
4454
  []
4459
4455
  );
@@ -4462,7 +4458,7 @@ const _x = {
4462
4458
  l,
4463
4459
  ye((S) => S.length > 0),
4464
4460
  _e(v, p),
4465
- te(([S, C, E]) => {
4461
+ ee(([S, C, E]) => {
4466
4462
  const I = S.reduce((j, N, O) => Mt(j, N, Ur(N, C.offsetTree, E) || O), dr());
4467
4463
  return {
4468
4464
  ...C,
@@ -4477,7 +4473,7 @@ const _x = {
4477
4473
  r,
4478
4474
  _e(v),
4479
4475
  ye(([S, { lastIndex: C }]) => S < C),
4480
- te(([S, { lastIndex: C, lastSize: E }]) => [
4476
+ ee(([S, { lastIndex: C, lastSize: E }]) => [
4481
4477
  {
4482
4478
  endIndex: C,
4483
4479
  size: E,
@@ -4490,7 +4486,7 @@ const _x = {
4490
4486
  const x = St(
4491
4487
  F(
4492
4488
  u,
4493
- te((S) => S === void 0)
4489
+ ee((S) => S === void 0)
4494
4490
  ),
4495
4491
  !0
4496
4492
  );
@@ -4498,7 +4494,7 @@ const _x = {
4498
4494
  F(
4499
4495
  d,
4500
4496
  ye((S) => S !== void 0 && Ze(ut(v).sizeTree)),
4501
- te((S) => [{ endIndex: 0, size: S, startIndex: 0 }])
4497
+ ee((S) => [{ endIndex: 0, size: S, startIndex: 0 }])
4502
4498
  ),
4503
4499
  n
4504
4500
  );
@@ -4513,7 +4509,7 @@ const _x = {
4513
4509
  }),
4514
4510
  { changed: !1, sizes: w }
4515
4511
  ),
4516
- te((S) => S.changed)
4512
+ ee((S) => S.changed)
4517
4513
  )
4518
4514
  );
4519
4515
  Ke(
@@ -4523,7 +4519,7 @@ const _x = {
4523
4519
  (S, C) => ({ diff: S.prev - C, prev: C }),
4524
4520
  { diff: 0, prev: 0 }
4525
4521
  ),
4526
- te((S) => S.diff)
4522
+ ee((S) => S.diff)
4527
4523
  ),
4528
4524
  (S) => {
4529
4525
  const { groupIndices: C } = ut(v);
@@ -4546,7 +4542,7 @@ const _x = {
4546
4542
  F(
4547
4543
  s,
4548
4544
  _e(v),
4549
- te(([S, C]) => {
4545
+ ee(([S, C]) => {
4550
4546
  const E = C.groupIndices.length > 0, I = [], j = C.lastSize;
4551
4547
  if (E) {
4552
4548
  const N = Br(C.sizeTree, 0);
@@ -4607,7 +4603,7 @@ const _x = {
4607
4603
  F(
4608
4604
  i,
4609
4605
  _e(v, p),
4610
- te(([S, { offsetTree: C }, E]) => {
4606
+ ee(([S, { offsetTree: C }, E]) => {
4611
4607
  const I = -S;
4612
4608
  return Ur(I, C, E);
4613
4609
  })
@@ -4617,7 +4613,7 @@ const _x = {
4617
4613
  F(
4618
4614
  i,
4619
4615
  _e(v, p),
4620
- te(([S, C, E]) => {
4616
+ ee(([S, C, E]) => {
4621
4617
  if (C.groupIndices.length > 0) {
4622
4618
  if (Ze(C.sizeTree))
4623
4619
  return C;
@@ -4687,26 +4683,26 @@ function Px(e) {
4687
4683
  }
4688
4684
  const gu = He(
4689
4685
  ([{ groupIndices: e, sizes: t, totalCount: n }, { headerHeight: r, scrollTop: o }]) => {
4690
- const s = De(), i = De(), a = Dt(F(s, te(Px)));
4686
+ const s = De(), i = De(), a = Dt(F(s, ee(Px)));
4691
4687
  return ce(
4692
4688
  F(
4693
4689
  a,
4694
- te((l) => l.totalCount)
4690
+ ee((l) => l.totalCount)
4695
4691
  ),
4696
4692
  n
4697
4693
  ), ce(
4698
4694
  F(
4699
4695
  a,
4700
- te((l) => l.groupIndices)
4696
+ ee((l) => l.groupIndices)
4701
4697
  ),
4702
4698
  e
4703
4699
  ), ce(
4704
4700
  F(
4705
4701
  ht(o, t, r),
4706
4702
  ye(([l, u]) => fs(u)),
4707
- te(([l, u, d]) => Xt(u.groupOffsetTree, Math.max(l - d, 0), "v")[0]),
4703
+ ee(([l, u, d]) => Xt(u.groupOffsetTree, Math.max(l - d, 0), "v")[0]),
4708
4704
  tt(),
4709
- te((l) => [l])
4705
+ ee((l) => [l])
4710
4706
  ),
4711
4707
  i
4712
4708
  ), { groupCounts: s, topItemsIndexes: i };
@@ -4757,7 +4753,7 @@ const to = He(
4757
4753
  p,
4758
4754
  _e(n, f, r, v, a, i, h),
4759
4755
  _e(e, s, o),
4760
- te(
4756
+ ee(
4761
4757
  ([
4762
4758
  [R, S, C, E, I, j, N, O],
4763
4759
  M,
@@ -4884,7 +4880,7 @@ const Wr = "up", Or = "down", Dx = "none", Lx = {
4884
4880
  ce(
4885
4881
  F(
4886
4882
  ht(we(o), we(f)),
4887
- te(([b, y]) => b <= y),
4883
+ ee(([b, y]) => b <= y),
4888
4884
  tt()
4889
4885
  ),
4890
4886
  a
@@ -4946,14 +4942,14 @@ const Wr = "up", Or = "down", Dx = "none", Lx = {
4946
4942
  { changed: !1, jump: 0, scrollHeight: 0, scrollTop: 0 }
4947
4943
  ),
4948
4944
  ye((b) => b.changed),
4949
- te((b) => b.jump)
4945
+ ee((b) => b.jump)
4950
4946
  ),
4951
4947
  0
4952
4948
  );
4953
4949
  ce(
4954
4950
  F(
4955
4951
  w,
4956
- te((b) => b.atBottom)
4952
+ ee((b) => b.atBottom)
4957
4953
  ),
4958
4954
  i
4959
4955
  ), ce(F(i, xn(50)), l);
@@ -4961,13 +4957,13 @@ const Wr = "up", Or = "down", Dx = "none", Lx = {
4961
4957
  ce(
4962
4958
  F(
4963
4959
  r,
4964
- te(({ scrollTop: b }) => b),
4960
+ ee(({ scrollTop: b }) => b),
4965
4961
  tt(),
4966
4962
  sn(
4967
4963
  (b, y) => ut(p) ? { direction: b.direction, prevScrollTop: y } : { direction: y < b.prevScrollTop ? Wr : Or, prevScrollTop: y },
4968
4964
  { direction: Or, prevScrollTop: 0 }
4969
4965
  ),
4970
- te((b) => b.direction)
4966
+ ee((b) => b.direction)
4971
4967
  ),
4972
4968
  g
4973
4969
  ), ce(F(r, xn(50), rn(Dx)), g);
@@ -4986,7 +4982,7 @@ const Wr = "up", Or = "down", Dx = "none", Lx = {
4986
4982
  _e(h),
4987
4983
  ye(([b, y]) => !!y),
4988
4984
  sn(([b, y], [R]) => [y, R], [0, 0]),
4989
- te(([b, y]) => y - b)
4985
+ ee(([b, y]) => y - b)
4990
4986
  ),
4991
4987
  x
4992
4988
  ), {
@@ -5025,7 +5021,7 @@ const na = He(
5025
5021
  we(e),
5026
5022
  we(a)
5027
5023
  ),
5028
- te(
5024
+ ee(
5029
5025
  ([
5030
5026
  d,
5031
5027
  f,
@@ -5180,7 +5176,7 @@ const er = He(
5180
5176
  const N = j && j.length !== I;
5181
5177
  return C && !E && !N;
5182
5178
  }),
5183
- te(
5179
+ ee(
5184
5180
  ([
5185
5181
  ,
5186
5182
  ,
@@ -5214,8 +5210,8 @@ const er = He(
5214
5210
  let z = 0;
5215
5211
  for (const P of ds(L, Re, ue)) {
5216
5212
  const V = P.value, X = Math.max(P.start, Re), se = Math.min(P.end, ue);
5217
- for (let ne = X; ne <= se; ne++)
5218
- U.push({ data: W == null ? void 0 : W[ne], index: ne, offset: z, size: V }), z += V;
5213
+ for (let te = X; te <= se; te++)
5214
+ U.push({ data: W == null ? void 0 : W[te], index: te, offset: z, size: V }), z += V;
5219
5215
  }
5220
5216
  }
5221
5217
  if (!O)
@@ -5230,13 +5226,13 @@ const er = He(
5230
5226
  const X = z.size;
5231
5227
  if (z.offset < C) {
5232
5228
  V += Math.floor((C - z.offset + _) / (X + _));
5233
- const ne = V - ue.start;
5234
- P += ne * X + ne * _;
5229
+ const te = V - ue.start;
5230
+ P += te * X + te * _;
5235
5231
  }
5236
5232
  V < Y && (P += (Y - V) * X, V = Y);
5237
5233
  const se = Math.min(ue.end, oe);
5238
- for (let ne = V; ne <= se && !(P >= E); ne++)
5239
- Re.push({ data: W == null ? void 0 : W[ne], index: ne, offset: P, size: X }), P += X + _;
5234
+ for (let te = V; te <= se && !(P >= E); te++)
5235
+ Re.push({ data: W == null ? void 0 : W[te], index: te, offset: P, size: X }), P += X + _;
5240
5236
  }
5241
5237
  });
5242
5238
  return Eo(fe, U, I, _, H, D);
@@ -5252,25 +5248,25 @@ const er = He(
5252
5248
  F(
5253
5249
  e,
5254
5250
  ye(Yi),
5255
- te((C) => C == null ? void 0 : C.length)
5251
+ ee((C) => C == null ? void 0 : C.length)
5256
5252
  ),
5257
5253
  o
5258
5254
  ), ce(
5259
5255
  F(
5260
5256
  b,
5261
- te((C) => C.topListHeight)
5257
+ ee((C) => C.topListHeight)
5262
5258
  ),
5263
5259
  f
5264
5260
  ), ce(f, a), ce(
5265
5261
  F(
5266
5262
  b,
5267
- te((C) => [C.top, C.bottom])
5263
+ ee((C) => [C.top, C.bottom])
5268
5264
  ),
5269
5265
  i
5270
5266
  ), ce(
5271
5267
  F(
5272
5268
  b,
5273
- te((C) => C.items)
5269
+ ee((C) => C.items)
5274
5270
  ),
5275
5271
  x
5276
5272
  );
@@ -5280,23 +5276,23 @@ const er = He(
5280
5276
  ye(({ items: C }) => C.length > 0),
5281
5277
  _e(o, e),
5282
5278
  ye(([{ items: C }, E]) => C[C.length - 1].originalIndex === E - 1),
5283
- te(([, C, E]) => [C - 1, E]),
5279
+ ee(([, C, E]) => [C - 1, E]),
5284
5280
  tt(Hr),
5285
- te(([C]) => C)
5281
+ ee(([C]) => C)
5286
5282
  )
5287
5283
  ), R = Dt(
5288
5284
  F(
5289
5285
  b,
5290
5286
  xn(200),
5291
5287
  ye(({ items: C, topItems: E }) => C.length > 0 && C[0].originalIndex === E.length),
5292
- te(({ items: C }) => C[0].index),
5288
+ ee(({ items: C }) => C[0].index),
5293
5289
  tt()
5294
5290
  )
5295
5291
  ), S = Dt(
5296
5292
  F(
5297
5293
  b,
5298
5294
  ye(({ items: C }) => C.length > 0),
5299
- te(({ items: C }) => {
5295
+ ee(({ items: C }) => {
5300
5296
  let E = 0, I = C.length - 1;
5301
5297
  for (; C[E].type === "group" && E < I; )
5302
5298
  E++;
@@ -5328,7 +5324,7 @@ const er = He(
5328
5324
  const s = De(), i = St(
5329
5325
  F(
5330
5326
  ht(n, e, r, t, o),
5331
- te(([a, l, u, d, f]) => a + l + u + d + f.offsetBottom + f.bottom)
5327
+ ee(([a, l, u, d, f]) => a + l + u + d + f.offsetBottom + f.bottom)
5332
5328
  ),
5333
5329
  0
5334
5330
  );
@@ -5342,7 +5338,7 @@ const er = He(
5342
5338
  F(
5343
5339
  ht(n, e, t),
5344
5340
  ye(([o]) => o),
5345
- te(([, o, s]) => Math.max(0, o - s)),
5341
+ ee(([, o, s]) => Math.max(0, o - s)),
5346
5342
  xn(0),
5347
5343
  tt()
5348
5344
  ),
@@ -5372,7 +5368,7 @@ const er = He(
5372
5368
  d,
5373
5369
  _e(t, l, n, s, o, r, a),
5374
5370
  _e(e),
5375
- te(([[f, h, p, w, v, g, x, b], y]) => {
5371
+ ee(([[f, h, p, w, v, g, x, b], y]) => {
5376
5372
  const { align: R, behavior: S, calculateViewLocation: C = Bx, done: E, ...I } = f, j = mu(f, h, w - 1), N = Ur(j, h.offsetTree, y) + v + g, O = N + Xt(h.sizeTree, j)[1], M = b + g, D = b + p - x, _ = C({
5377
5373
  itemBottom: O,
5378
5374
  itemTop: N,
@@ -5429,7 +5425,7 @@ const Hx = (e, t) => typeof e == "function" ? Rl(e(t)) : t && Rl(e), Ux = He(
5429
5425
  F(
5430
5426
  ht(F(we(t), qn(1)), l),
5431
5427
  _e(we(w), s, a, f),
5432
- te(([[S, C], E, I, j, N]) => {
5428
+ ee(([[S, C], E, I, j, N]) => {
5433
5429
  let O = C && j, M = "auto";
5434
5430
  return O && (M = Hx(E, I || N), O = O && !!M), { followOutputBehavior: M, shouldFollow: O, totalCount: S };
5435
5431
  }),
@@ -5473,7 +5469,7 @@ const Hx = (e, t) => typeof e == "function" ? Rl(e(t)) : t && Rl(e), Ux = He(
5473
5469
  bi(
5474
5470
  F(
5475
5471
  we(r),
5476
- te((S) => {
5472
+ ee((S) => {
5477
5473
  var C;
5478
5474
  return (C = S == null ? void 0 : S.length) != null ? C : 0;
5479
5475
  })
@@ -5485,7 +5481,7 @@ const Hx = (e, t) => typeof e == "function" ? Rl(e(t)) : t && Rl(e), Ux = He(
5485
5481
  F(
5486
5482
  ht(F(R, qn(1)), l),
5487
5483
  _e(we(y), a, f, h),
5488
- te(([[S, C], E, I, j, N]) => C && I && (E == null ? void 0 : E({ context: N, totalCount: S, scrollingInProgress: j }))),
5484
+ ee(([[S, C], E, I, j, N]) => C && I && (E == null ? void 0 : E({ context: N, totalCount: S, scrollingInProgress: j }))),
5489
5485
  ye((S) => !!S),
5490
5486
  xn(0)
5491
5487
  ),
@@ -5516,7 +5512,7 @@ const Hx = (e, t) => typeof e == "function" ? Rl(e(t)) : t && Rl(e), Ux = He(
5516
5512
  _e(s),
5517
5513
  ye(([, l]) => l !== 0),
5518
5514
  _e(o, r, t, n, e),
5519
- te(([[, l], u, d, f, h, p = []]) => wu(l, u, d, f, h, p))
5515
+ ee(([[, l], u, d, f, h, p = []]) => wu(l, u, d, f, h, p))
5520
5516
  ),
5521
5517
  i
5522
5518
  ), {}),
@@ -5530,7 +5526,7 @@ const Hx = (e, t) => typeof e == "function" ? Rl(e(t)) : t && Rl(e), Ux = He(
5530
5526
  e,
5531
5527
  _e(r),
5532
5528
  ye(([, o]) => o !== 0),
5533
- te(([, o]) => ({ top: o }))
5529
+ ee(([, o]) => ({ top: o }))
5534
5530
  ),
5535
5531
  (o) => {
5536
5532
  Yt(
@@ -5560,7 +5556,7 @@ const Hx = (e, t) => typeof e == "function" ? Rl(e(t)) : t && Rl(e), Ux = He(
5560
5556
  e,
5561
5557
  _e(r, t, n),
5562
5558
  ye(([o, s]) => !!s),
5563
- te(([o, s, i, a]) => {
5559
+ ee(([o, s, i, a]) => {
5564
5560
  const { enter: l, exit: u } = s;
5565
5561
  if (i) {
5566
5562
  if (u(o, a))
@@ -5586,7 +5582,7 @@ const Hx = (e, t) => typeof e == "function" ? Rl(e(t)) : t && Rl(e), Ux = He(
5586
5582
  return ce(
5587
5583
  F(
5588
5584
  ht(n, r),
5589
- te(([{ scrollHeight: a, scrollTop: l, viewportHeight: u }, { offsetTop: d }]) => ({
5585
+ ee(([{ scrollHeight: a, scrollTop: l, viewportHeight: u }, { offsetTop: d }]) => ({
5590
5586
  scrollHeight: a,
5591
5587
  scrollTop: Math.max(0, l - d),
5592
5588
  viewportHeight: u
@@ -5597,7 +5593,7 @@ const Hx = (e, t) => typeof e == "function" ? Rl(e(t)) : t && Rl(e), Ux = He(
5597
5593
  F(
5598
5594
  t,
5599
5595
  _e(r),
5600
- te(([a, { offsetTop: l }]) => ({
5596
+ ee(([a, { offsetTop: l }]) => ({
5601
5597
  ...a,
5602
5598
  top: a.top + l
5603
5599
  }))
@@ -5631,13 +5627,13 @@ const Hx = (e, t) => typeof e == "function" ? Rl(e(t)) : t && Rl(e), Ux = He(
5631
5627
  const R = Nx(w.sizeTree);
5632
5628
  g && x !== null && b !== null && (v = x.scrollTop - b.offsetTop), v -= y, p({ ranges: R, scrollTop: v });
5633
5629
  }
5634
- ), ce(F(d, ye(Yi), te(qx)), o), ce(
5630
+ ), ce(F(d, ye(Yi), ee(qx)), o), ce(
5635
5631
  F(
5636
5632
  s,
5637
5633
  _e(d),
5638
5634
  ye(([, p]) => p !== void 0),
5639
5635
  tt(),
5640
- te(([, p]) => p.ranges)
5636
+ ee(([, p]) => p.ranges)
5641
5637
  ),
5642
5638
  e
5643
5639
  ), {
@@ -5656,7 +5652,7 @@ const Gx = He(([{ topItemsIndexes: e }]) => {
5656
5652
  F(
5657
5653
  t,
5658
5654
  ye((n) => n >= 0),
5659
- te((n) => Array.from({ length: n }).map((r, o) => o))
5655
+ ee((n) => Array.from({ length: n }).map((r, o) => o))
5660
5656
  ),
5661
5657
  e
5662
5658
  ), { topItemCount: t };
@@ -5689,7 +5685,7 @@ const Yx = Tu(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
5689
5685
  ye(([x]) => x !== 0),
5690
5686
  _e(r, a, n, o, p, w),
5691
5687
  ye(([, x, b, y, , , R]) => !R && !y && x !== 0 && b === Wr),
5692
- te(([[x], , , , , b]) => (b("Upward scrolling compensation", { amount: x }, jt.DEBUG), x))
5688
+ ee(([[x], , , , , b]) => (b("Upward scrolling compensation", { amount: x }, jt.DEBUG), x))
5693
5689
  )
5694
5690
  );
5695
5691
  function g(x) {
@@ -5701,21 +5697,21 @@ const Yx = Tu(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
5701
5697
  F(
5702
5698
  ht(St(s, !1), e, w),
5703
5699
  ye(([x, b, y]) => !x && !y && b !== 0),
5704
- te(([x, b]) => b),
5700
+ ee(([x, b]) => b),
5705
5701
  xn(1)
5706
5702
  ),
5707
5703
  g
5708
5704
  ), ce(
5709
5705
  F(
5710
5706
  f,
5711
- te((x) => ({ top: -x }))
5707
+ ee((x) => ({ top: -x }))
5712
5708
  ),
5713
5709
  t
5714
5710
  ), Ke(
5715
5711
  F(
5716
5712
  u,
5717
5713
  _e(h, d),
5718
- te(([x, { groupIndices: b, lastSize: y, sizeTree: R }, S]) => {
5714
+ ee(([x, { groupIndices: b, lastSize: y, sizeTree: R }, S]) => {
5719
5715
  function C(E) {
5720
5716
  return E * (y + S);
5721
5717
  }
@@ -5812,7 +5808,7 @@ const Yx = Tu(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
5812
5808
  ]) => (ce(R.rangeChanged, j.scrollSeekRangeChanged), ce(
5813
5809
  F(
5814
5810
  j.windowViewportRect,
5815
- te((N) => N.visibleHeight)
5811
+ ee((N) => N.visibleHeight)
5816
5812
  ),
5817
5813
  v.viewportHeight
5818
5814
  ), {
@@ -6018,7 +6014,7 @@ const ev = /* @__PURE__ */ He(() => {
6018
6014
  const e = K((a) => `Item ${a}`), t = K((a) => `Group ${a}`), n = K({}), r = K(sa), o = K("div"), s = K(Sr), i = (a, l = null) => St(
6019
6015
  F(
6020
6016
  n,
6021
- te((u) => u[a]),
6017
+ ee((u) => u[a]),
6022
6018
  tt()
6023
6019
  ),
6024
6020
  l
@@ -6331,7 +6327,7 @@ const dv = ({ children: e }) => {
6331
6327
  ] })), r = K(null), o = K(null), s = K({}), i = K(sa), a = K(Sr), l = (u, d = null) => St(
6332
6328
  F(
6333
6329
  s,
6334
- te((f) => f[u]),
6330
+ ee((f) => f[u]),
6335
6331
  tt()
6336
6332
  ),
6337
6333
  d
@@ -6414,7 +6410,7 @@ const Cv = /* @__PURE__ */ He(
6414
6410
  ), Ke(
6415
6411
  F(
6416
6412
  ht(w, U, N, j, k, Y),
6417
- ye(([P, V, X, se, , ne]) => P && !V && X.height !== 0 && se.height !== 0 && !ne)
6413
+ ye(([P, V, X, se, , te]) => P && !V && X.height !== 0 && se.height !== 0 && !te)
6418
6414
  ),
6419
6415
  ([, , , , P]) => {
6420
6416
  Ae(Y, !0), ea(1, () => {
@@ -6444,7 +6440,7 @@ const Cv = /* @__PURE__ */ He(
6444
6440
  ), ce(
6445
6441
  F(
6446
6442
  j,
6447
- te(({ height: P }) => P)
6443
+ ee(({ height: P }) => P)
6448
6444
  ),
6449
6445
  f
6450
6446
  ), ce(
@@ -6455,7 +6451,7 @@ const Cv = /* @__PURE__ */ He(
6455
6451
  we(W, (P, V) => P && P.column === V.column && P.row === V.row),
6456
6452
  we(u)
6457
6453
  ),
6458
- te(([P, V, X, se]) => ({
6454
+ ee(([P, V, X, se]) => ({
6459
6455
  gap: X,
6460
6456
  item: V,
6461
6457
  scrollTop: se,
@@ -6478,12 +6474,12 @@ const Cv = /* @__PURE__ */ He(
6478
6474
  we(k)
6479
6475
  ),
6480
6476
  ye(([, , , , , , , P]) => !P),
6481
- te(
6477
+ ee(
6482
6478
  ([
6483
6479
  P,
6484
6480
  [V, X],
6485
6481
  se,
6486
- ne,
6482
+ te,
6487
6483
  Le,
6488
6484
  Ge,
6489
6485
  et,
@@ -6491,7 +6487,7 @@ const Cv = /* @__PURE__ */ He(
6491
6487
  be,
6492
6488
  je
6493
6489
  ]) => {
6494
- const { column: Ye, row: Fe } = se, { height: st, width: at } = ne, { width: Z } = Le;
6490
+ const { column: Ye, row: Fe } = se, { height: st, width: at } = te, { width: Z } = Le;
6495
6491
  if (et === 0 && (P === 0 || Z === 0))
6496
6492
  return Il;
6497
6493
  if (at === 0) {
@@ -6499,9 +6495,9 @@ const Cv = /* @__PURE__ */ He(
6499
6495
  return yv(jl(Et, yn, Ge));
6500
6496
  }
6501
6497
  const ae = Ou(Z, at, Ye);
6502
- let pe, Se;
6503
- be ? V === 0 && X === 0 && et > 0 ? (pe = 0, Se = et - 1) : (pe = ae * Bo((V + Fe) / (st + Fe)), Se = ae * Nl((X + Fe) / (st + Fe)) - 1, Se = Xs(P - 1, Mr(Se, ae - 1)), pe = Xs(Se, Mr(0, pe))) : (pe = 0, Se = -1);
6504
- const ve = jl(pe, Se, Ge), { bottom: Ie, top: Xe } = _l(Le, se, ne, ve), Ue = Nl(P / ae), lt = Ue * st + (Ue - 1) * Fe - Ie;
6498
+ let he, Se;
6499
+ be ? V === 0 && X === 0 && et > 0 ? (he = 0, Se = et - 1) : (he = ae * Bo((V + Fe) / (st + Fe)), Se = ae * Nl((X + Fe) / (st + Fe)) - 1, Se = Xs(P - 1, Mr(Se, ae - 1)), he = Xs(Se, Mr(0, he))) : (he = 0, Se = -1);
6500
+ const ve = jl(he, Se, Ge), { bottom: Ie, top: Xe } = _l(Le, se, te, ve), Ue = Nl(P / ae), lt = Ue * st + (Ue - 1) * Fe - Ie;
6505
6501
  return { bottom: Ie, itemHeight: st, items: ve, itemWidth: at, offsetBottom: lt, offsetTop: Xe, top: Xe };
6506
6502
  }
6507
6503
  )
@@ -6511,16 +6507,16 @@ const Cv = /* @__PURE__ */ He(
6511
6507
  F(
6512
6508
  _,
6513
6509
  ye((P) => P !== null),
6514
- te((P) => P.length)
6510
+ ee((P) => P.length)
6515
6511
  ),
6516
6512
  C
6517
6513
  ), ce(
6518
6514
  F(
6519
6515
  ht(j, N, I, W),
6520
6516
  ye(([P, V, { items: X }]) => X.length > 0 && V.height !== 0 && P.height !== 0),
6521
- te(([P, V, { items: X }, se]) => {
6522
- const { bottom: ne, top: Le } = _l(P, se, V, X);
6523
- return [Le, ne];
6517
+ ee(([P, V, { items: X }, se]) => {
6518
+ const { bottom: te, top: Le } = _l(P, se, V, X);
6519
+ return [Le, te];
6524
6520
  }),
6525
6521
  tt(Hr)
6526
6522
  ),
@@ -6531,7 +6527,7 @@ const Cv = /* @__PURE__ */ He(
6531
6527
  F(
6532
6528
  u,
6533
6529
  _e(oe),
6534
- te(([P, V]) => V || P !== 0)
6530
+ ee(([P, V]) => V || P !== 0)
6535
6531
  ),
6536
6532
  oe
6537
6533
  );
@@ -6544,7 +6540,7 @@ const Cv = /* @__PURE__ */ He(
6544
6540
  const se = P.items[P.items.length - 1].index === V - 1;
6545
6541
  return (X || P.bottom > 0 && P.itemHeight > 0 && P.offsetBottom === 0 && P.items.length === V) && se;
6546
6542
  }),
6547
- te(([[, P]]) => P - 1),
6543
+ ee(([[, P]]) => P - 1),
6548
6544
  tt()
6549
6545
  )
6550
6546
  ), Re = Dt(
@@ -6559,7 +6555,7 @@ const Cv = /* @__PURE__ */ He(
6559
6555
  we(I),
6560
6556
  _e(L),
6561
6557
  ye(([{ items: P }, V]) => P.length > 0 && !V),
6562
- te(([{ items: P }]) => ({
6558
+ ee(([{ items: P }]) => ({
6563
6559
  endIndex: P[P.length - 1].index,
6564
6560
  startIndex: P[0].index
6565
6561
  })),
@@ -6571,11 +6567,11 @@ const Cv = /* @__PURE__ */ He(
6571
6567
  F(
6572
6568
  O,
6573
6569
  _e(j, N, C, W),
6574
- te(([P, V, X, se, ne]) => {
6570
+ ee(([P, V, X, se, te]) => {
6575
6571
  const Le = xu(P), { align: Ge, behavior: et, offset: be } = Le;
6576
6572
  let je = Le.index;
6577
6573
  je === "LAST" && (je = se - 1), je = Mr(0, je, Xs(se - 1, je));
6578
- let Ye = Ri(V, ne, X, je);
6574
+ let Ye = Ri(V, te, X, je);
6579
6575
  return Ge === "end" ? Ye = Al(Ye - V.height + X.height) : Ge === "center" && (Ye = Al(Ye - V.height / 2 + X.height / 2)), be && (Ye += be), { behavior: et, top: Ye };
6580
6576
  })
6581
6577
  ),
@@ -6584,14 +6580,14 @@ const Cv = /* @__PURE__ */ He(
6584
6580
  const z = St(
6585
6581
  F(
6586
6582
  I,
6587
- te((P) => P.offsetBottom + P.bottom)
6583
+ ee((P) => P.offsetBottom + P.bottom)
6588
6584
  ),
6589
6585
  0
6590
6586
  );
6591
6587
  return ce(
6592
6588
  F(
6593
6589
  R,
6594
- te((P) => ({ height: P.visibleHeight, width: P.visibleWidth }))
6590
+ ee((P) => ({ height: P.visibleHeight, width: P.visibleWidth }))
6595
6591
  ),
6596
6592
  j
6597
6593
  ), {
@@ -6656,7 +6652,7 @@ const Tv = /* @__PURE__ */ He(() => {
6656
6652
  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(Sr), l = (f, h = null) => St(
6657
6653
  F(
6658
6654
  t,
6659
- te((p) => p[f]),
6655
+ ee((p) => p[f]),
6660
6656
  tt()
6661
6657
  ),
6662
6658
  h
@@ -7845,7 +7841,7 @@ class da {
7845
7841
  }
7846
7842
  }
7847
7843
  }
7848
- const xe = {
7844
+ const ge = {
7849
7845
  newline: /^(?: *(?:\n|$))+/,
7850
7846
  code: /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,
7851
7847
  fences: /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,
@@ -7862,37 +7858,37 @@ const xe = {
7862
7858
  _paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,
7863
7859
  text: /^[^\n]+/
7864
7860
  };
7865
- xe._label = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
7866
- xe._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
7867
- xe.def = Qe(xe.def).replace("label", xe._label).replace("title", xe._title).getRegex();
7868
- xe.bullet = /(?:[*+-]|\d{1,9}[.)])/;
7869
- xe.listItemStart = Qe(/^( *)(bull) */).replace("bull", xe.bullet).getRegex();
7870
- xe.list = Qe(xe.list).replace(/bull/g, xe.bullet).replace("hr", "\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def", "\\n+(?=" + xe.def.source + ")").getRegex();
7871
- xe._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";
7872
- xe._comment = /<!--(?!-?>)[\s\S]*?(?:-->|$)/;
7873
- xe.html = Qe(xe.html, "i").replace("comment", xe._comment).replace("tag", xe._tag).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
7874
- xe.paragraph = Qe(xe._paragraph).replace("hr", xe.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", xe._tag).getRegex();
7875
- xe.blockquote = Qe(xe.blockquote).replace("paragraph", xe.paragraph).getRegex();
7876
- xe.normal = { ...xe };
7877
- xe.gfm = {
7878
- ...xe.normal,
7861
+ ge._label = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
7862
+ ge._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
7863
+ ge.def = Qe(ge.def).replace("label", ge._label).replace("title", ge._title).getRegex();
7864
+ ge.bullet = /(?:[*+-]|\d{1,9}[.)])/;
7865
+ ge.listItemStart = Qe(/^( *)(bull) */).replace("bull", ge.bullet).getRegex();
7866
+ ge.list = Qe(ge.list).replace(/bull/g, ge.bullet).replace("hr", "\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def", "\\n+(?=" + ge.def.source + ")").getRegex();
7867
+ 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";
7868
+ ge._comment = /<!--(?!-?>)[\s\S]*?(?:-->|$)/;
7869
+ ge.html = Qe(ge.html, "i").replace("comment", ge._comment).replace("tag", ge._tag).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
7870
+ ge.paragraph = Qe(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();
7871
+ ge.blockquote = Qe(ge.blockquote).replace("paragraph", ge.paragraph).getRegex();
7872
+ ge.normal = { ...ge };
7873
+ ge.gfm = {
7874
+ ...ge.normal,
7879
7875
  table: "^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"
7880
7876
  // Cells
7881
7877
  };
7882
- xe.gfm.table = Qe(xe.gfm.table).replace("hr", xe.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", xe._tag).getRegex();
7883
- xe.gfm.paragraph = Qe(xe._paragraph).replace("hr", xe.hr).replace("heading", " {0,3}#{1,6} ").replace("|lheading", "").replace("table", xe.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", xe._tag).getRegex();
7884
- xe.pedantic = {
7885
- ...xe.normal,
7878
+ ge.gfm.table = Qe(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();
7879
+ ge.gfm.paragraph = Qe(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();
7880
+ ge.pedantic = {
7881
+ ...ge.normal,
7886
7882
  html: Qe(
7887
7883
  `^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`
7888
- ).replace("comment", xe._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(),
7884
+ ).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(),
7889
7885
  def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
7890
7886
  heading: /^(#{1,6})(.*)(?:\n+|$)/,
7891
7887
  fences: Ho,
7892
7888
  // fences not supported
7893
7889
  lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
7894
- paragraph: Qe(xe.normal._paragraph).replace("hr", xe.hr).replace("heading", ` *#{1,6} *[^
7895
- ]`).replace("lheading", xe.lheading).replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").getRegex()
7890
+ paragraph: Qe(ge.normal._paragraph).replace("hr", ge.hr).replace("heading", ` *#{1,6} *[^
7891
+ ]`).replace("lheading", ge.lheading).replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").getRegex()
7896
7892
  };
7897
7893
  const re = {
7898
7894
  escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
@@ -7922,7 +7918,7 @@ re._punctuation = "!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~";
7922
7918
  re.punctuation = Qe(re.punctuation).replace(/punctuation/g, re._punctuation).getRegex();
7923
7919
  re.blockSkip = /\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g;
7924
7920
  re.escapedEmSt = /(?:^|[^\\])(?:\\\\)*\\[*_]/g;
7925
- re._comment = Qe(xe._comment).replace("(?:-->|$)", "-->").getRegex();
7921
+ re._comment = Qe(ge._comment).replace("(?:-->|$)", "-->").getRegex();
7926
7922
  re.emStrong.lDelim = Qe(re.emStrong.lDelim).replace(/punct/g, re._punctuation).getRegex();
7927
7923
  re.emStrong.rDelimAst = Qe(re.emStrong.rDelimAst, "g").replace(/punct/g, re._punctuation).getRegex();
7928
7924
  re.emStrong.rDelimUnd = Qe(re.emStrong.rDelimUnd, "g").replace(/punct/g, re._punctuation).getRegex();
@@ -7936,8 +7932,8 @@ re._label = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
7936
7932
  re._href = /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;
7937
7933
  re._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;
7938
7934
  re.link = Qe(re.link).replace("label", re._label).replace("href", re._href).replace("title", re._title).getRegex();
7939
- re.reflink = Qe(re.reflink).replace("label", re._label).replace("ref", xe._label).getRegex();
7940
- re.nolink = Qe(re.nolink).replace("ref", xe._label).getRegex();
7935
+ re.reflink = Qe(re.reflink).replace("label", re._label).replace("ref", ge._label).getRegex();
7936
+ re.nolink = Qe(re.nolink).replace("ref", ge._label).getRegex();
7941
7937
  re.reflinkSearch = Qe(re.reflinkSearch, "g").replace("reflink", re.reflink).replace("nolink", re.nolink).getRegex();
7942
7938
  re.normal = { ...re };
7943
7939
  re.pedantic = {
@@ -7990,17 +7986,17 @@ class En {
7990
7986
  top: !0
7991
7987
  };
7992
7988
  const n = {
7993
- block: xe.normal,
7989
+ block: ge.normal,
7994
7990
  inline: re.normal
7995
7991
  };
7996
- this.options.pedantic ? (n.block = xe.pedantic, n.inline = re.pedantic) : this.options.gfm && (n.block = xe.gfm, this.options.breaks ? n.inline = re.breaks : n.inline = re.gfm), this.tokenizer.rules = n;
7992
+ this.options.pedantic ? (n.block = ge.pedantic, n.inline = re.pedantic) : this.options.gfm && (n.block = ge.gfm, this.options.breaks ? n.inline = re.breaks : n.inline = re.gfm), this.tokenizer.rules = n;
7997
7993
  }
7998
7994
  /**
7999
7995
  * Expose Rules
8000
7996
  */
8001
7997
  static get rules() {
8002
7998
  return {
8003
- block: xe,
7999
+ block: ge,
8004
8000
  inline: re
8005
8001
  };
8006
8002
  }
@@ -8636,7 +8632,7 @@ function Gu(e, t) {
8636
8632
  return (n, r, o) => {
8637
8633
  typeof r == "function" && (o = r, r = null);
8638
8634
  const s = { ...r };
8639
- r = { ...ge.defaults, ...s };
8635
+ r = { ...me.defaults, ...s };
8640
8636
  const i = hw(r.silent, r.async, o);
8641
8637
  if (typeof n > "u" || n === null)
8642
8638
  return i(new Error("marked(): input parameter is undefined or null"));
@@ -8654,7 +8650,7 @@ function Gu(e, t) {
8654
8650
  let h;
8655
8651
  if (!f)
8656
8652
  try {
8657
- r.walkTokens && ge.walkTokens(l, r.walkTokens), h = t(l, r), r.hooks && (h = r.hooks.postprocess(h));
8653
+ r.walkTokens && me.walkTokens(l, r.walkTokens), h = t(l, r), r.hooks && (h = r.hooks.postprocess(h));
8658
8654
  } catch (p) {
8659
8655
  f = p;
8660
8656
  }
@@ -8662,7 +8658,7 @@ function Gu(e, t) {
8662
8658
  };
8663
8659
  if (!a || a.length < 3 || (delete r.highlight, !l.length)) return u();
8664
8660
  let d = 0;
8665
- ge.walkTokens(l, function(f) {
8661
+ me.walkTokens(l, function(f) {
8666
8662
  f.type === "code" && (d++, setTimeout(() => {
8667
8663
  a(f.text, f.lang, function(h, p) {
8668
8664
  if (h)
@@ -8674,11 +8670,11 @@ function Gu(e, t) {
8674
8670
  return;
8675
8671
  }
8676
8672
  if (r.async)
8677
- return Promise.resolve(r.hooks ? r.hooks.preprocess(n) : n).then((a) => e(a, r)).then((a) => r.walkTokens ? Promise.all(ge.walkTokens(a, r.walkTokens)).then(() => a) : a).then((a) => t(a, r)).then((a) => r.hooks ? r.hooks.postprocess(a) : a).catch(i);
8673
+ 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);
8678
8674
  try {
8679
8675
  r.hooks && (n = r.hooks.preprocess(n));
8680
8676
  const a = e(n, r);
8681
- r.walkTokens && ge.walkTokens(a, r.walkTokens);
8677
+ r.walkTokens && me.walkTokens(a, r.walkTokens);
8682
8678
  let l = t(a, r);
8683
8679
  return r.hooks && (l = r.hooks.postprocess(l)), l;
8684
8680
  } catch (a) {
@@ -8686,19 +8682,19 @@ function Gu(e, t) {
8686
8682
  }
8687
8683
  };
8688
8684
  }
8689
- function ge(e, t, n) {
8685
+ function me(e, t, n) {
8690
8686
  return Gu(En.lex, kn.parse)(e, t, n);
8691
8687
  }
8692
- ge.options = ge.setOptions = function(e) {
8693
- return ge.defaults = { ...ge.defaults, ...e }, Jv(ge.defaults), ge;
8688
+ me.options = me.setOptions = function(e) {
8689
+ return me.defaults = { ...me.defaults, ...e }, Jv(me.defaults), me;
8694
8690
  };
8695
- ge.getDefaults = Hu;
8696
- ge.defaults = tr;
8697
- ge.use = function(...e) {
8698
- const t = ge.defaults.extensions || { renderers: {}, childTokens: {} };
8691
+ me.getDefaults = Hu;
8692
+ me.defaults = tr;
8693
+ me.use = function(...e) {
8694
+ const t = me.defaults.extensions || { renderers: {}, childTokens: {} };
8699
8695
  e.forEach((n) => {
8700
8696
  const r = { ...n };
8701
- if (r.async = ge.defaults.async || r.async || !1, n.extensions && (n.extensions.forEach((o) => {
8697
+ if (r.async = me.defaults.async || r.async || !1, n.extensions && (n.extensions.forEach((o) => {
8702
8698
  if (!o.name)
8703
8699
  throw new Error("extension name required");
8704
8700
  if (o.renderer) {
@@ -8715,7 +8711,7 @@ ge.use = function(...e) {
8715
8711
  }
8716
8712
  o.childTokens && (t.childTokens[o.name] = o.childTokens);
8717
8713
  }), r.extensions = t), n.renderer) {
8718
- const o = ge.defaults.renderer || new fa();
8714
+ const o = me.defaults.renderer || new fa();
8719
8715
  for (const s in n.renderer) {
8720
8716
  const i = o[s];
8721
8717
  o[s] = (...a) => {
@@ -8726,7 +8722,7 @@ ge.use = function(...e) {
8726
8722
  r.renderer = o;
8727
8723
  }
8728
8724
  if (n.tokenizer) {
8729
- const o = ge.defaults.tokenizer || new da();
8725
+ const o = me.defaults.tokenizer || new da();
8730
8726
  for (const s in n.tokenizer) {
8731
8727
  const i = o[s];
8732
8728
  o[s] = (...a) => {
@@ -8737,11 +8733,11 @@ ge.use = function(...e) {
8737
8733
  r.tokenizer = o;
8738
8734
  }
8739
8735
  if (n.hooks) {
8740
- const o = ge.defaults.hooks || new Uo();
8736
+ const o = me.defaults.hooks || new Uo();
8741
8737
  for (const s in n.hooks) {
8742
8738
  const i = o[s];
8743
8739
  Uo.passThroughHooks.has(s) ? o[s] = (a) => {
8744
- if (ge.defaults.async)
8740
+ if (me.defaults.async)
8745
8741
  return Promise.resolve(n.hooks[s].call(o, a)).then((u) => i.call(o, u));
8746
8742
  const l = n.hooks[s].call(o, a);
8747
8743
  return i.call(o, l);
@@ -8753,54 +8749,54 @@ ge.use = function(...e) {
8753
8749
  r.hooks = o;
8754
8750
  }
8755
8751
  if (n.walkTokens) {
8756
- const o = ge.defaults.walkTokens;
8752
+ const o = me.defaults.walkTokens;
8757
8753
  r.walkTokens = function(s) {
8758
8754
  let i = [];
8759
8755
  return i.push(n.walkTokens.call(this, s)), o && (i = i.concat(o.call(this, s))), i;
8760
8756
  };
8761
8757
  }
8762
- ge.setOptions(r);
8758
+ me.setOptions(r);
8763
8759
  });
8764
8760
  };
8765
- ge.walkTokens = function(e, t) {
8761
+ me.walkTokens = function(e, t) {
8766
8762
  let n = [];
8767
8763
  for (const r of e)
8768
- switch (n = n.concat(t.call(ge, r)), r.type) {
8764
+ switch (n = n.concat(t.call(me, r)), r.type) {
8769
8765
  case "table": {
8770
8766
  for (const o of r.header)
8771
- n = n.concat(ge.walkTokens(o.tokens, t));
8767
+ n = n.concat(me.walkTokens(o.tokens, t));
8772
8768
  for (const o of r.rows)
8773
8769
  for (const s of o)
8774
- n = n.concat(ge.walkTokens(s.tokens, t));
8770
+ n = n.concat(me.walkTokens(s.tokens, t));
8775
8771
  break;
8776
8772
  }
8777
8773
  case "list": {
8778
- n = n.concat(ge.walkTokens(r.items, t));
8774
+ n = n.concat(me.walkTokens(r.items, t));
8779
8775
  break;
8780
8776
  }
8781
8777
  default:
8782
- ge.defaults.extensions && ge.defaults.extensions.childTokens && ge.defaults.extensions.childTokens[r.type] ? ge.defaults.extensions.childTokens[r.type].forEach(function(o) {
8783
- n = n.concat(ge.walkTokens(r[o], t));
8784
- }) : r.tokens && (n = n.concat(ge.walkTokens(r.tokens, t)));
8778
+ me.defaults.extensions && me.defaults.extensions.childTokens && me.defaults.extensions.childTokens[r.type] ? me.defaults.extensions.childTokens[r.type].forEach(function(o) {
8779
+ n = n.concat(me.walkTokens(r[o], t));
8780
+ }) : r.tokens && (n = n.concat(me.walkTokens(r.tokens, t)));
8785
8781
  }
8786
8782
  return n;
8787
8783
  };
8788
- ge.parseInline = Gu(En.lexInline, kn.parseInline);
8789
- ge.Parser = kn;
8790
- ge.parser = kn.parse;
8791
- ge.Renderer = fa;
8792
- ge.TextRenderer = Ku;
8793
- ge.Lexer = En;
8794
- ge.lexer = En.lex;
8795
- ge.Tokenizer = da;
8796
- ge.Slugger = qu;
8797
- ge.Hooks = Uo;
8798
- ge.parse = ge;
8799
- ge.options;
8800
- ge.setOptions;
8801
- ge.use;
8802
- ge.walkTokens;
8803
- ge.parseInline;
8784
+ me.parseInline = Gu(En.lexInline, kn.parseInline);
8785
+ me.Parser = kn;
8786
+ me.parser = kn.parse;
8787
+ me.Renderer = fa;
8788
+ me.TextRenderer = Ku;
8789
+ me.Lexer = En;
8790
+ me.lexer = En.lex;
8791
+ me.Tokenizer = da;
8792
+ me.Slugger = qu;
8793
+ me.Hooks = Uo;
8794
+ me.parse = me;
8795
+ me.options;
8796
+ me.setOptions;
8797
+ me.use;
8798
+ me.walkTokens;
8799
+ me.parseInline;
8804
8800
  kn.parse;
8805
8801
  En.lex;
8806
8802
  function Ul({
@@ -8812,9 +8808,9 @@ function Ul({
8812
8808
  try {
8813
8809
  if (!n) {
8814
8810
  const o = e.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, "").replace(/<iframe\b[^<]*(?:(?!<\/iframe>)<[^<]*)*<\/iframe>/gi, "").replace(/javascript:/gi, "").replace(/on\w+\s*=/gi, "");
8815
- return ge.parse(o);
8811
+ return me.parse(o);
8816
8812
  }
8817
- return ge.parse(e);
8813
+ return me.parse(e);
8818
8814
  } catch (o) {
8819
8815
  return console.error("[MarkdownContent] parse error", o), `<pre>Error rendering markdown: ${String(o)}</pre>`;
8820
8816
  }
@@ -9260,7 +9256,7 @@ function ni(e, t) {
9260
9256
  return typeof e == "function" ? e(t) : e && (e.current = t), e;
9261
9257
  }
9262
9258
  function zw(e, t) {
9263
- var n = me(function() {
9259
+ var n = pe(function() {
9264
9260
  return {
9265
9261
  // value
9266
9262
  value: e,
@@ -10067,7 +10063,7 @@ const Ob = m.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ c.jsx(
10067
10063
  ));
10068
10064
  Ob.displayName = Cs.displayName;
10069
10065
  function Mb({ isOpen: e, onClose: t, fileId: n, fileName: r, mimeType: o }) {
10070
- const [s, i] = me(!1), [a, l] = me(null), [u, d] = me(null), { toast: f } = ha(), h = $.useCallback(async () => {
10066
+ const [s, i] = pe(!1), [a, l] = pe(null), [u, d] = pe(null), { toast: f } = ha(), h = $.useCallback(async () => {
10071
10067
  if (n) {
10072
10068
  i(!0), d(null), l(null);
10073
10069
  try {
@@ -10328,7 +10324,7 @@ function sc(e) {
10328
10324
  return `${e.id}:${t}:${n}`;
10329
10325
  }
10330
10326
  function Hb({ className: e }) {
10331
- const [t, n] = me(0);
10327
+ const [t, n] = pe(0);
10332
10328
  return gt(() => {
10333
10329
  const r = setInterval(() => n((o) => (o + 1) % 4), 500);
10334
10330
  return () => clearInterval(r);
@@ -10363,7 +10359,7 @@ const Ub = $.memo(function({
10363
10359
  onCancelEdit: g,
10364
10360
  onCopy: x
10365
10361
  }) {
10366
- const [b, y] = me(!1), [R, S] = me("collapsed"), [C, E] = me(!1), { currentThreadId: I } = Gi(), { handleInterrupt: j } = tu(), { toast: N } = ha(), [O, M] = me({}), [D, _] = me(!1), [W, H] = me(null), q = l === "phone" || l === "half-screen", L = t.role, k = L === "tool", U = !(r && L !== "user"), Y = $.useMemo(() => {
10362
+ 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), [W, H] = pe(null), q = l === "phone" || l === "half-screen", L = t.role, k = L === "tool", U = !(r && L !== "user"), Y = $.useMemo(() => {
10367
10363
  switch (L) {
10368
10364
  case "user":
10369
10365
  return "text-[hsl(var(--chat-bubble-user-text))]";
@@ -10389,7 +10385,7 @@ const Ub = $.memo(function({
10389
10385
  pt(() => zb(t.content), [t.content]);
10390
10386
  const P = pt(() => z.length <= $n ? z : `${z.slice(0, $n)}
10391
10387
  … [truncated ${z.length - $n} chars]`, [z]), V = $.useCallback(async (Z = "all") => {
10392
- const pe = Z === "visible" && k ? P : k ? z : de;
10388
+ const he = Z === "visible" && k ? P : k ? z : de;
10393
10389
  async function Se(ve) {
10394
10390
  try {
10395
10391
  await navigator.clipboard.writeText(ve);
@@ -10403,7 +10399,7 @@ const Ub = $.memo(function({
10403
10399
  }
10404
10400
  }
10405
10401
  try {
10406
- await Se(pe), y(!0), setTimeout(() => y(!1), 2e3), x == null || x(pe);
10402
+ await Se(he), y(!0), setTimeout(() => y(!1), 2e3), x == null || x(he);
10407
10403
  } catch (ve) {
10408
10404
  console.error("Failed to copy:", ve);
10409
10405
  }
@@ -10413,12 +10409,12 @@ const Ub = $.memo(function({
10413
10409
  w(t.id, Z);
10414
10410
  }, [w, t.id, k, z, de]), se = $.useCallback(() => {
10415
10411
  v == null || v(n);
10416
- }, [v, n]), ne = $.useCallback(async (Z, ae, pe) => {
10412
+ }, [v, n]), te = $.useCallback(async (Z, ae, he) => {
10417
10413
  if (!U) {
10418
10414
  Z.preventDefault();
10419
10415
  return;
10420
10416
  }
10421
- if (O[pe]) {
10417
+ if (O[he]) {
10422
10418
  Z.preventDefault();
10423
10419
  return;
10424
10420
  }
@@ -10431,7 +10427,7 @@ const Ub = $.memo(function({
10431
10427
  return;
10432
10428
  }
10433
10429
  if (Se.startsWith("data:")) {
10434
- Z.preventDefault(), M((Ue) => ({ ...Ue, [pe]: !0 }));
10430
+ Z.preventDefault(), M((Ue) => ({ ...Ue, [he]: !0 }));
10435
10431
  const Ie = `${ae.name}_${ae.size}_${Date.now()}`, Xe = N({ title: "Fetching file...", description: "", open: !0 });
10436
10432
  try {
10437
10433
  const Ue = await mw(I ?? void 0);
@@ -10456,11 +10452,11 @@ const Ub = $.memo(function({
10456
10452
  open: !0
10457
10453
  });
10458
10454
  } finally {
10459
- M((Ue) => ({ ...Ue, [pe]: !1 }));
10455
+ M((Ue) => ({ ...Ue, [he]: !1 }));
10460
10456
  }
10461
10457
  }
10462
10458
  } catch (Se) {
10463
- console.error("File click error:", Se), M((ve) => ({ ...ve, [pe]: !1 }));
10459
+ console.error("File click error:", Se), M((ve) => ({ ...ve, [he]: !1 }));
10464
10460
  }
10465
10461
  }, [U, O, N, I]), Le = $.useCallback(() => {
10466
10462
  const ae = J(q ? "h-3 w-3" : "h-4 w-4", "opacity-60 flex-shrink-0", Y);
@@ -10534,7 +10530,7 @@ const Ub = $.memo(function({
10534
10530
  }
10535
10531
  }, [j]), Ye = $.useCallback(({ part: Z, i: ae }) => {
10536
10532
  if (Z.type === "text") {
10537
- const pe = Z.text ?? "", Se = pe.trim(), ve = oc(Se);
10533
+ const he = Z.text ?? "", Se = he.trim(), ve = oc(Se);
10538
10534
  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: [
10539
10535
  /* @__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: [
10540
10536
  Se.substring(0, h),
@@ -10557,27 +10553,27 @@ const Ub = $.memo(function({
10557
10553
  ] })
10558
10554
  }
10559
10555
  ) })
10560
- ] }, ae) : /* @__PURE__ */ c.jsx(Ul, { content: pe, allowHtml: !1 }, ae);
10556
+ ] }, ae) : /* @__PURE__ */ c.jsx(Ul, { content: he, allowHtml: !1 }, ae);
10561
10557
  }
10562
10558
  if (Z.type === "image_url") {
10563
- const pe = Z;
10559
+ const he = Z;
10564
10560
  return /* @__PURE__ */ c.jsx("div", { className: "my-2", children: /* @__PURE__ */ c.jsx(
10565
10561
  "img",
10566
10562
  {
10567
- src: pe.url,
10568
- alt: pe.alt ?? "",
10563
+ src: he.url,
10564
+ alt: he.alt ?? "",
10569
10565
  loading: "lazy",
10570
10566
  className: "border rounded max-h-[420px] w-auto object-contain"
10571
10567
  }
10572
10568
  ) }, ae);
10573
10569
  }
10574
10570
  if (Z.type === "file") {
10575
- const pe = Z, Se = pe.name || "file";
10571
+ const he = Z, Se = he.name || "file";
10576
10572
  return /* @__PURE__ */ c.jsxs(
10577
10573
  "a",
10578
10574
  {
10579
- href: pe.url,
10580
- onClick: (ve) => ne(ve, pe, ae),
10575
+ href: he.url,
10576
+ onClick: (ve) => te(ve, he, ae),
10581
10577
  className: `inline-flex items-center gap-2 rounded px-2 py-1 text-xs bg-gray-100 border hover:bg-gray-200
10582
10578
  dark:bg-background/10 dark:border-border/30 dark:hover:bg-background/20`,
10583
10579
  children: [
@@ -10601,7 +10597,7 @@ const Ub = $.memo(function({
10601
10597
  ae
10602
10598
  ) : null;
10603
10599
  }, [
10604
- ne,
10600
+ te,
10605
10601
  O,
10606
10602
  be,
10607
10603
  je,
@@ -10618,22 +10614,22 @@ const Ub = $.memo(function({
10618
10614
  if (!k && !Z && !r)
10619
10615
  return Fe();
10620
10616
  if (t.model === "reflection") {
10621
- const ae = de.trim(), pe = oc(ae);
10622
- if (pe && typeof pe == "object")
10623
- return /* @__PURE__ */ c.jsx(qb, { data: pe });
10617
+ const ae = de.trim(), he = oc(ae);
10618
+ if (he && typeof he == "object")
10619
+ return /* @__PURE__ */ c.jsx(qb, { data: he });
10624
10620
  }
10625
10621
  if (k && oe.name === "get_issues") {
10626
- const ae = t.content.find((ve) => ve.type === "tool_end"), pe = (ae == null ? void 0 : ae.output) ?? z, Se = jd(pe);
10622
+ const ae = t.content.find((ve) => ve.type === "tool_end"), he = (ae == null ? void 0 : ae.output) ?? z, Se = jd(he);
10627
10623
  if (Se) return /* @__PURE__ */ c.jsx(Gb, { issues: Se });
10628
10624
  }
10629
10625
  if (k) {
10630
10626
  const ae = Fb(t.content);
10631
10627
  if (ae.length > 0)
10632
- return /* @__PURE__ */ c.jsx("div", { className: "space-y-2", children: ae.map((pe, Se) => {
10633
- const ve = typeof pe.output == "string" ? pe.output : Ni(pe.output), Ie = ve.length > $n ? `${ve.slice(0, $n)}
10628
+ return /* @__PURE__ */ c.jsx("div", { className: "space-y-2", children: ae.map((he, Se) => {
10629
+ const ve = typeof he.output == "string" ? he.output : Ni(he.output), Ie = ve.length > $n ? `${ve.slice(0, $n)}
10634
10630
  … [truncated ${ve.length - $n} chars]` : ve, Xe = R === "expanded";
10635
10631
  return /* @__PURE__ */ c.jsxs(Ml, { open: Xe, onOpenChange: (Ue) => S(Ue ? "expanded" : "preview"), children: [
10636
- /* @__PURE__ */ c.jsx("div", { className: "flex items-center gap-2 text-xs", children: /* @__PURE__ */ c.jsx(Ei, { variant: "outline", children: (pe.name ?? "tool") + (pe.toolCallId ? ` • ${pe.toolCallId.slice(0, 8)}` : "") }) }),
10632
+ /* @__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)}` : "") }) }),
10637
10633
  /* @__PURE__ */ c.jsx("div", { className: "font-mono text-sm mt-1", children: /* @__PURE__ */ c.jsx("pre", { className: "whitespace-pre-wrap break-words", children: Xe ? Ie : Ie.slice(0, d) + (Ie.length > d ? "..." : "") }) }),
10638
10634
  /* @__PURE__ */ c.jsx(Dl, { asChild: !0, children: /* @__PURE__ */ c.jsx(Be, { variant: "ghost", size: "sm", className: "h-6 text-xs", children: Xe ? /* @__PURE__ */ c.jsxs(c.Fragment, { children: [
10639
10635
  " ",
@@ -10643,11 +10639,11 @@ const Ub = $.memo(function({
10643
10639
  /* @__PURE__ */ c.jsx(cr, { className: "h-3 w-3 mr-1" }),
10644
10640
  " Show more"
10645
10641
  ] }) }) })
10646
- ] }, pe.toolCallId ?? Se);
10642
+ ] }, he.toolCallId ?? Se);
10647
10643
  }) });
10648
10644
  }
10649
10645
  if (!k) {
10650
- const ae = /* @__PURE__ */ c.jsx("div", { className: "space-y-2", children: t.content.map((pe, Se) => /* @__PURE__ */ c.jsx(Ye, { part: pe, i: Se }, Se)) });
10646
+ const ae = /* @__PURE__ */ c.jsx("div", { className: "space-y-2", children: t.content.map((he, Se) => /* @__PURE__ */ c.jsx(Ye, { part: he, i: Se }, Se)) });
10651
10647
  return r ? /* @__PURE__ */ c.jsxs("div", { "aria-busy": "true", role: "status", children: [
10652
10648
  ae,
10653
10649
  /* @__PURE__ */ c.jsx(Hb, { className: Y })
@@ -11010,7 +11006,7 @@ const ic = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, _d = $.forwa
11010
11006
  onScrollAway: g,
11011
11007
  onAtBottom: x
11012
11008
  }, b) => {
11013
- const y = it(null), R = it(null), S = it(!1), [C, E] = me(!0), I = ze((O) => {
11009
+ const y = it(null), R = it(null), S = it(!1), [C, E] = pe(!0), I = ze((O) => {
11014
11010
  E(O), g && g(!O), x && x(O);
11015
11011
  }, [g, x]), j = pt(() => {
11016
11012
  if (a)
@@ -12532,7 +12528,7 @@ var Yd = "PopperAnchor", Xd = m.forwardRef(
12532
12528
  Xd.displayName = Yd;
12533
12529
  var Ia = "PopperContent", [f0, h0] = Kd(Ia), Jd = m.forwardRef(
12534
12530
  (e, t) => {
12535
- var z, P, V, X, se, ne;
12531
+ var z, P, V, X, se, te;
12536
12532
  const {
12537
12533
  __scopePopper: n,
12538
12534
  side: r = "bottom",
@@ -12608,7 +12604,7 @@ var Ia = "PopperContent", [f0, h0] = Kd(Ia), Jd = m.forwardRef(
12608
12604
  // hide the content if using the hide middleware and should be hidden
12609
12605
  // set visibility to hidden and disable pointer events so the UI behaves
12610
12606
  // as if the PopperContent isn't there at all
12611
- ...((ne = L.hide) == null ? void 0 : ne.referenceHidden) && {
12607
+ ...((te = L.hide) == null ? void 0 : te.referenceHidden) && {
12612
12608
  visibility: "hidden",
12613
12609
  pointerEvents: "none"
12614
12610
  }
@@ -13770,34 +13766,34 @@ function ci({
13770
13766
  streamingAssistantId: M,
13771
13767
  lastCheckpointId: D,
13772
13768
  lastCheckpointNs: _
13773
- } = sx(), [W, H] = me(null), [q, L] = me(""), [k, U] = me(null), [Y, de] = me([]), [oe, fe] = me(0), [Re, ue] = me(0), [z, P] = me(!1), [V, X] = me(null), [se, ne] = me(null), [Le, Ge] = me(!1), [et, be] = me(null), [je, Ye] = me([]), [Fe, st] = me(null), [at, Z] = me(null), [ae, pe] = me(!1), Se = it(null), ve = it(null), Ie = it(null), Xe = ze(() => {
13774
- Se.current && (Se.current.value = ""), ve.current && (ve.current.value = ""), fe((ee) => ee + 1), ue((ee) => ee + 1);
13769
+ } = sx(), [W, H] = pe(null), [q, L] = pe(""), [k, U] = pe(null), [Y, de] = pe([]), [oe, fe] = pe(0), [Re, ue] = pe(0), [z, P] = pe(!1), [V, X] = pe(null), [se, te] = pe(null), [Le, Ge] = pe(!1), [et, be] = pe(null), [je, Ye] = pe([]), [Fe, st] = pe(null), [at, Z] = pe(null), [ae, he] = pe(!1), Se = it(null), ve = it(null), Ie = it(null), Xe = ze(() => {
13770
+ Se.current && (Se.current.value = ""), ve.current && (ve.current.value = ""), fe((ne) => ne + 1), ue((ne) => ne + 1);
13775
13771
  }, []), Ue = it(!1);
13776
13772
  gt(() => {
13777
13773
  Ue.current && !N && (de([]), Xe()), Ue.current = N;
13778
13774
  }, [N, Xe]);
13779
- const [lt, Et] = me("desktop");
13775
+ const [lt, Et] = pe("desktop");
13780
13776
  gt(() => {
13781
- const ee = () => {
13782
- const he = window.innerWidth;
13783
- Et(he < 640 ? "phone" : he < 1024 ? "tablet" : "desktop");
13777
+ const ne = () => {
13778
+ const xe = window.innerWidth;
13779
+ Et(xe < 640 ? "phone" : xe < 1024 ? "tablet" : "desktop");
13784
13780
  };
13785
- return ee(), window.addEventListener("resize", ee), () => window.removeEventListener("resize", ee);
13781
+ return ne(), window.addEventListener("resize", ne), () => window.removeEventListener("resize", ne);
13786
13782
  }, []), gt(() => {
13787
- let ee = !1;
13783
+ let ne = !1;
13788
13784
  if (!v) {
13789
13785
  Ye([]), st(null), Z(null), Ie.current = null;
13790
13786
  return;
13791
13787
  }
13792
- const he = {
13788
+ const xe = {
13793
13789
  threadId: v,
13794
13790
  checkpointId: D ?? null,
13795
13791
  checkpointNs: _ ?? null
13796
13792
  }, Me = Ie.current;
13797
- if (!(Me && Me.threadId === he.threadId && Me.checkpointId === he.checkpointId && Me.checkpointNs === he.checkpointNs))
13793
+ if (!(Me && Me.threadId === xe.threadId && Me.checkpointId === xe.checkpointId && Me.checkpointNs === xe.checkpointNs))
13798
13794
  return x(v).then((rt) => {
13799
13795
  var co;
13800
- if (ee) return;
13796
+ if (ne) return;
13801
13797
  const _t = ((rt == null ? void 0 : rt.checkpoints) ?? []).slice().sort((gn, T) => new Date(T.createdAt).getTime() - new Date(gn.createdAt).getTime());
13802
13798
  Ye(_t);
13803
13799
  const tn = Fe, kr = tn && _t.some((gn) => gn.checkpointId === tn) ? tn : ((co = _t[0]) == null ? void 0 : co.checkpointId) ?? null;
@@ -13806,11 +13802,11 @@ function ci({
13806
13802
  const gn = _t.find((T) => T.checkpointId === kr);
13807
13803
  lo = (gn == null ? void 0 : gn.checkpointNs) ?? null;
13808
13804
  }
13809
- st(kr), Z(lo), Ie.current = he;
13805
+ st(kr), Z(lo), Ie.current = xe;
13810
13806
  }).catch((rt) => {
13811
- console.error("ChatInterface - listCheckpoints error:", rt), ee || (Ye([]), Ie.current = null);
13807
+ console.error("ChatInterface - listCheckpoints error:", rt), ne || (Ye([]), Ie.current = null);
13812
13808
  }), () => {
13813
- ee = !0;
13809
+ ne = !0;
13814
13810
  };
13815
13811
  }, [v, D, _, Fe, x]), gt(() => {
13816
13812
  D && (st(D), Z(_ ?? null));
@@ -13819,8 +13815,8 @@ function ci({
13819
13815
  if (!(!S || C))
13820
13816
  try {
13821
13817
  await j();
13822
- } catch (ee) {
13823
- console.warn("loadOlderMessages failed", ee);
13818
+ } catch (ne) {
13819
+ console.warn("loadOlderMessages failed", ne);
13824
13820
  }
13825
13821
  }, [S, C, j]);
13826
13822
  gt(() => {
@@ -13830,53 +13826,53 @@ function ci({
13830
13826
  return;
13831
13827
  }
13832
13828
  try {
13833
- const he = await w.getAgent("default");
13834
- be(he.uiDefaultMessage || null);
13835
- } catch (he) {
13836
- console.warn("Failed to fetch default message:", he), be(null);
13829
+ const xe = await w.getAgent("default");
13830
+ be(xe.uiDefaultMessage || null);
13831
+ } catch (xe) {
13832
+ console.warn("Failed to fetch default message:", xe), be(null);
13837
13833
  }
13838
13834
  })();
13839
13835
  }, [w]), gt(() => {
13840
13836
  O && !Le && (p == null || p(O));
13841
13837
  }, [O, Le, p]);
13842
- const G = (ee) => {
13843
- if (ee.length > Oo)
13844
- return `Message too long (${ee.length}/${Oo} characters)`;
13838
+ const G = (ne) => {
13839
+ if (ne.length > Oo)
13840
+ return `Message too long (${ne.length}/${Oo} characters)`;
13845
13841
  try {
13846
- return Jb(ee), null;
13847
- } catch (he) {
13848
- return (he == null ? void 0 : he.message) || "Invalid message";
13849
- }
13850
- }, le = async (ee) => {
13851
- const he = ee.trim();
13852
- if (!(!he && Y.length === 0)) {
13853
- if (he) {
13854
- const Me = G(he);
13842
+ return Jb(ne), null;
13843
+ } catch (xe) {
13844
+ return (xe == null ? void 0 : xe.message) || "Invalid message";
13845
+ }
13846
+ }, le = async (ne) => {
13847
+ const xe = ne.trim();
13848
+ if (!(!xe && Y.length === 0)) {
13849
+ if (xe) {
13850
+ const Me = G(xe);
13855
13851
  if (Me) {
13856
13852
  U(Me);
13857
13853
  return;
13858
13854
  }
13859
13855
  }
13860
13856
  try {
13861
- await E(he || "", {
13857
+ await E(xe || "", {
13862
13858
  checkpointId: Fe ?? D ?? void 0,
13863
13859
  checkpointNs: at ?? _ ?? void 0,
13864
13860
  payloadExtras: W ? { edit: !0, originalMessageId: W } : void 0,
13865
13861
  attachments: Y
13866
- }), f == null || f(he), U(null), de([]), Xe(), H(null), L("");
13862
+ }), f == null || f(xe), U(null), de([]), Xe(), H(null), L("");
13867
13863
  } catch (Me) {
13868
13864
  const rt = (Me == null ? void 0 : Me.message) || "Failed to send message";
13869
13865
  U(rt), p == null || p(rt);
13870
13866
  }
13871
13867
  }
13872
- }, Ee = $.useCallback((ee, he) => {
13873
- u && (H(ee), L(he), U(null));
13868
+ }, Ee = $.useCallback((ne, xe) => {
13869
+ u && (H(ne), L(xe), U(null));
13874
13870
  }, [u]), We = $.useCallback(() => {
13875
13871
  H(null), L(""), U(null);
13876
- }, []), qe = ze((ee, he) => {
13877
- Ee(ee, he);
13878
- }, [Ee]), kt = ze((ee) => {
13879
- const he = (Me) => {
13872
+ }, []), qe = ze((ne, xe) => {
13873
+ Ee(ne, xe);
13874
+ }, [Ee]), kt = ze((ne) => {
13875
+ const xe = (Me) => {
13880
13876
  const rt = Me.content || [], _t = rt.filter((tn) => tn.type === "text").map((tn) => tn.text).join("");
13881
13877
  if (_t) return _t;
13882
13878
  try {
@@ -13885,58 +13881,58 @@ function ci({
13885
13881
  return String(rt);
13886
13882
  }
13887
13883
  };
13888
- for (let Me = ee - 1; Me >= 0; Me--)
13884
+ for (let Me = ne - 1; Me >= 0; Me--)
13889
13885
  if (R[Me].role === "user") {
13890
- const rt = he(R[Me]);
13886
+ const rt = xe(R[Me]);
13891
13887
  rt && E(rt, {
13892
13888
  checkpointId: Fe ?? D ?? void 0,
13893
13889
  checkpointNs: at ?? _ ?? void 0
13894
13890
  });
13895
13891
  break;
13896
13892
  }
13897
- }, [R, E, Fe, at, D, _]), Sn = (ee) => {
13898
- const he = Array.from(ee.target.files || []);
13899
- de((Me) => [...Me, ...he]), ee.target.value = "";
13900
- }, qt = (ee) => {
13901
- de((he) => {
13902
- const Me = he.filter((rt, _t) => ee !== _t);
13893
+ }, [R, E, Fe, at, D, _]), Sn = (ne) => {
13894
+ const xe = Array.from(ne.target.files || []);
13895
+ de((Me) => [...Me, ...xe]), ne.target.value = "";
13896
+ }, qt = (ne) => {
13897
+ de((xe) => {
13898
+ const Me = xe.filter((rt, _t) => ne !== _t);
13903
13899
  return Me.length === 0 && Xe(), Me;
13904
13900
  });
13905
- }, Mn = async (ee) => {
13906
- const he = (ee.target.files || [])[0];
13907
- if (he) {
13908
- X(null), ne(null), P(!0);
13901
+ }, Mn = async (ne) => {
13902
+ const xe = (ne.target.files || [])[0];
13903
+ if (xe) {
13904
+ X(null), te(null), P(!0);
13909
13905
  try {
13910
13906
  await E("", {
13911
13907
  checkpointId: Fe ?? D ?? void 0,
13912
13908
  checkpointNs: at ?? _ ?? void 0,
13913
- attachments: [he]
13909
+ attachments: [xe]
13914
13910
  });
13915
- const Me = `Uploaded ${he.name} - processing through chat stream`;
13916
- ne(Me);
13911
+ const Me = `Uploaded ${xe.name} - processing through chat stream`;
13912
+ te(Me);
13917
13913
  } catch (Me) {
13918
13914
  const rt = Me instanceof Error ? Me.message : "Failed to upload Excel file";
13919
13915
  console.error("Excel upload failed", Me), X(rt), p == null || p(rt);
13920
13916
  } finally {
13921
- P(!1), ee.target.value = "", Xe();
13917
+ P(!1), ne.target.value = "", Xe();
13922
13918
  }
13923
13919
  }
13924
- }, Dn = (ee) => {
13925
- if (!ee) return "Unknown";
13926
- const he = Date.parse(ee);
13927
- return Number.isNaN(he) ? ee : new Date(he).toLocaleString();
13928
- }, or = async (ee) => {
13920
+ }, Dn = (ne) => {
13921
+ if (!ne) return "Unknown";
13922
+ const xe = Date.parse(ne);
13923
+ return Number.isNaN(xe) ? ne : new Date(xe).toLocaleString();
13924
+ }, or = async (ne) => {
13929
13925
  if (v) {
13930
- pe(!0);
13926
+ he(!0);
13931
13927
  try {
13932
- if (!ee) {
13928
+ if (!ne) {
13933
13929
  await y(), st(null), Z(null);
13934
13930
  return;
13935
13931
  }
13936
- const he = je.find((rt) => rt.checkpointId === ee), Me = (he == null ? void 0 : he.checkpointNs) ?? null;
13937
- await b(ee, Me), st(ee), Z(Me);
13932
+ const xe = je.find((rt) => rt.checkpointId === ne), Me = (xe == null ? void 0 : xe.checkpointNs) ?? null;
13933
+ await b(ne, Me), st(ne), Z(Me);
13938
13934
  } finally {
13939
- pe(!1);
13935
+ he(!1);
13940
13936
  }
13941
13937
  }
13942
13938
  }, Er = `flex flex-1 w-full flex-col min-h-0 min-w-0 max-h-full overflow-hidden bg-transparent ${e} ${d.container || ""}`, Ln = `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 || ""}`, mn = `flex-shrink-0 w-full border-t p-4 bg-transparent ${d.inputArea || ""}`;
@@ -13962,16 +13958,16 @@ function ci({
13962
13958
  {
13963
13959
  className: "border border-border rounded px-2 py-1 text-xs bg-card text-foreground focus:outline-none focus:ring-1 focus:ring-ring dark:bg-secondary",
13964
13960
  value: Fe ?? "",
13965
- onChange: (ee) => {
13966
- const he = ee.target.value || null;
13967
- or(he);
13961
+ onChange: (ne) => {
13962
+ const xe = ne.target.value || null;
13963
+ or(xe);
13968
13964
  },
13969
13965
  children: [
13970
13966
  /* @__PURE__ */ c.jsx("option", { value: "", children: "Latest" }),
13971
- je.map((ee) => /* @__PURE__ */ c.jsxs("option", { value: ee.checkpointId, children: [
13972
- Dn(ee.createdAt),
13973
- ee.preview ? ` — ${ee.preview.slice(0, 40)}` : ""
13974
- ] }, ee.checkpointId))
13967
+ je.map((ne) => /* @__PURE__ */ c.jsxs("option", { value: ne.checkpointId, children: [
13968
+ Dn(ne.createdAt),
13969
+ ne.preview ? ` — ${ne.preview.slice(0, 40)}` : ""
13970
+ ] }, ne.checkpointId))
13975
13971
  ]
13976
13972
  }
13977
13973
  )
@@ -14037,26 +14033,26 @@ function ci({
14037
14033
  ref: Se,
14038
14034
  type: "file",
14039
14035
  multiple: !0,
14040
- onChange: (ee) => Sn(ee),
14036
+ onChange: (ne) => Sn(ne),
14041
14037
  className: "hidden"
14042
14038
  },
14043
14039
  oe
14044
14040
  ),
14045
- Y.length > 0 && /* @__PURE__ */ c.jsx("div", { className: "flex flex-wrap gap-2", children: Y.map((ee, he) => /* @__PURE__ */ c.jsxs("div", { className: "flex items-center gap-2 bg-gray-100 dark:bg-gray-800 rounded-lg px-3 py-2 text-sm text-gray-900 dark:text-gray-100", children: [
14041
+ Y.length > 0 && /* @__PURE__ */ c.jsx("div", { className: "flex flex-wrap gap-2", children: Y.map((ne, xe) => /* @__PURE__ */ c.jsxs("div", { className: "flex items-center gap-2 bg-gray-100 dark:bg-gray-800 rounded-lg px-3 py-2 text-sm text-gray-900 dark:text-gray-100", children: [
14046
14042
  /* @__PURE__ */ c.jsx(ui, { size: 14 }),
14047
- /* @__PURE__ */ c.jsx("span", { className: "truncate max-w-[150px]", children: ee.name }),
14043
+ /* @__PURE__ */ c.jsx("span", { className: "truncate max-w-[150px]", children: ne.name }),
14048
14044
  /* @__PURE__ */ c.jsx(
14049
14045
  Be,
14050
14046
  {
14051
14047
  variant: "ghost",
14052
14048
  size: "sm",
14053
- onClick: () => qt(he),
14049
+ onClick: () => qt(xe),
14054
14050
  className: "h-4 w-4 p-0 text-gray-500 dark:text-gray-400 hover:text-red-500 dark:hover:text-red-400",
14055
- "aria-label": `Remove ${ee.name}`,
14051
+ "aria-label": `Remove ${ne.name}`,
14056
14052
  children: /* @__PURE__ */ c.jsx(ur, { size: 12 })
14057
14053
  }
14058
14054
  )
14059
- ] }, he)) })
14055
+ ] }, xe)) })
14060
14056
  ] }),
14061
14057
  l && /* @__PURE__ */ c.jsxs(c.Fragment, { children: [
14062
14058
  /* @__PURE__ */ c.jsx(
@@ -14095,8 +14091,8 @@ function ci({
14095
14091
  ) }),
14096
14092
  /* @__PURE__ */ c.jsxs(sh, { align: "start", sideOffset: 6, className: "w-52", children: [
14097
14093
  a && /* @__PURE__ */ c.jsxs(Mi, { onClick: () => {
14098
- var ee;
14099
- return (ee = Se.current) == null ? void 0 : ee.click();
14094
+ var ne;
14095
+ return (ne = Se.current) == null ? void 0 : ne.click();
14100
14096
  }, className: "cursor-pointer", children: [
14101
14097
  /* @__PURE__ */ c.jsx(ui, { className: "h-4 w-4 mr-2" }),
14102
14098
  " Attach files or images"
@@ -14105,8 +14101,8 @@ function ci({
14105
14101
  Mi,
14106
14102
  {
14107
14103
  onClick: () => {
14108
- var ee;
14109
- z || (ee = ve.current) == null || ee.click();
14104
+ var ne;
14105
+ z || (ne = ve.current) == null || ne.click();
14110
14106
  },
14111
14107
  className: `cursor-pointer ${z ? "opacity-60 pointer-events-none" : ""}`,
14112
14108
  children: [
@@ -14717,7 +14713,7 @@ function wc({
14717
14713
  deleteThread: v,
14718
14714
  renameThread: g,
14719
14715
  isLoadingThreads: x
14720
- } = Gi(), [b, y] = me(h ?? []), [R, S] = me(null), [C, E] = me(""), [I, j] = me(!1);
14716
+ } = Gi(), [b, y] = pe(h ?? []), [R, S] = pe(null), [C, E] = pe(""), [I, j] = pe(!1);
14721
14717
  gt(() => {
14722
14718
  y(h ?? []);
14723
14719
  }, [h]);
@@ -15330,9 +15326,9 @@ var Gt = 10, [Uh, On] = Rr(Zn), kC = "SelectContentImpl", IC = mr("SelectContent
15330
15326
  }, [y]), pa();
15331
15327
  const H = m.useCallback(
15332
15328
  (z) => {
15333
- const [P, ...V] = M().map((ne) => ne.ref.current), [X] = V.slice(-1), se = document.activeElement;
15334
- for (const ne of z)
15335
- if (ne === se || (ne == null || ne.scrollIntoView({ block: "nearest" }), ne === P && S && (S.scrollTop = 0), ne === X && S && (S.scrollTop = S.scrollHeight), ne == null || ne.focus(), document.activeElement !== se)) return;
15329
+ const [P, ...V] = M().map((te) => te.ref.current), [X] = V.slice(-1), se = document.activeElement;
15330
+ for (const te of z)
15331
+ if (te === se || (te == null || te.scrollIntoView({ block: "nearest" }), te === P && S && (S.scrollTop = 0), te === X && S && (S.scrollTop = S.scrollHeight), te == null || te.focus(), document.activeElement !== se)) return;
15336
15332
  },
15337
15333
  [M, S]
15338
15334
  ), q = m.useCallback(
@@ -15347,10 +15343,10 @@ var Gt = 10, [Uh, On] = Rr(Zn), kC = "SelectContentImpl", IC = mr("SelectContent
15347
15343
  if (y) {
15348
15344
  let z = { x: 0, y: 0 };
15349
15345
  const P = (X) => {
15350
- var se, ne;
15346
+ var se, te;
15351
15347
  z = {
15352
15348
  x: Math.abs(Math.round(X.pageX) - (((se = k.current) == null ? void 0 : se.x) ?? 0)),
15353
- y: Math.abs(Math.round(X.pageY) - (((ne = k.current) == null ? void 0 : ne.y) ?? 0))
15349
+ y: Math.abs(Math.round(X.pageY) - (((te = k.current) == null ? void 0 : te.y) ?? 0))
15354
15350
  };
15355
15351
  }, V = (X) => {
15356
15352
  z.x <= 10 && z.y <= 10 ? X.preventDefault() : y.contains(X.target) || L(!1), document.removeEventListener("pointermove", P), k.current = null;
@@ -15454,8 +15450,8 @@ var Gt = 10, [Uh, On] = Rr(Zn), kC = "SelectContentImpl", IC = mr("SelectContent
15454
15450
  if (z.key === "Tab" && z.preventDefault(), !P && z.key.length === 1 && Y(z.key), ["ArrowUp", "ArrowDown", "Home", "End"].includes(z.key)) {
15455
15451
  let X = M().filter((se) => !se.disabled).map((se) => se.ref.current);
15456
15452
  if (["ArrowUp", "End"].includes(z.key) && (X = X.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(z.key)) {
15457
- const se = z.target, ne = X.indexOf(se);
15458
- X = X.slice(ne + 1);
15453
+ const se = z.target, te = X.indexOf(se);
15454
+ X = X.slice(te + 1);
15459
15455
  }
15460
15456
  setTimeout(() => H(X)), z.preventDefault();
15461
15457
  }
@@ -15476,7 +15472,7 @@ var NC = "SelectItemAlignedPosition", Vh = m.forwardRef((e, t) => {
15476
15472
  if (s.trigger && s.valueNode && a && u && v && g && x) {
15477
15473
  const E = s.trigger.getBoundingClientRect(), I = u.getBoundingClientRect(), j = s.valueNode.getBoundingClientRect(), N = x.getBoundingClientRect();
15478
15474
  if (s.dir !== "rtl") {
15479
- const se = N.left - I.left, ne = j.left - se, Le = E.left - ne, Ge = E.width + Le, et = Math.max(Ge, I.width), be = window.innerWidth - Gt, je = Di(ne, [
15475
+ const se = N.left - I.left, te = j.left - se, Le = E.left - te, Ge = E.width + Le, et = Math.max(Ge, I.width), be = window.innerWidth - Gt, je = Di(te, [
15480
15476
  Gt,
15481
15477
  // Prevents the content from going off the starting edge of the
15482
15478
  // viewport. It may still go off the ending edge, but this can be
@@ -15487,7 +15483,7 @@ var NC = "SelectItemAlignedPosition", Vh = m.forwardRef((e, t) => {
15487
15483
  ]);
15488
15484
  a.style.minWidth = Ge + "px", a.style.left = je + "px";
15489
15485
  } else {
15490
- const se = I.right - N.right, ne = window.innerWidth - j.right - se, Le = window.innerWidth - E.right - ne, Ge = E.width + Le, et = Math.max(Ge, I.width), be = window.innerWidth - Gt, je = Di(ne, [
15486
+ const se = I.right - N.right, te = window.innerWidth - j.right - se, Le = window.innerWidth - E.right - te, Ge = E.width + Le, et = Math.max(Ge, I.width), be = window.innerWidth - Gt, je = Di(te, [
15491
15487
  Gt,
15492
15488
  Math.max(Gt, be - et)
15493
15489
  ]);
@@ -15497,10 +15493,10 @@ var NC = "SelectItemAlignedPosition", Vh = m.forwardRef((e, t) => {
15497
15493
  if (P <= fe) {
15498
15494
  const se = O.length > 0 && g === O[O.length - 1].ref.current;
15499
15495
  a.style.bottom = "0px";
15500
- const ne = u.clientHeight - v.offsetTop - v.offsetHeight, Le = Math.max(
15496
+ const te = u.clientHeight - v.offsetTop - v.offsetHeight, Le = Math.max(
15501
15497
  Re,
15502
15498
  ue + // viewport might have padding bottom, include it to avoid a scrollable viewport
15503
- (se ? oe : 0) + ne + q
15499
+ (se ? oe : 0) + te + q
15504
15500
  ), Ge = P + Le;
15505
15501
  a.style.height = Ge + "px";
15506
15502
  } else {
@@ -16165,7 +16161,7 @@ const nT = {
16165
16161
  }
16166
16162
  };
16167
16163
  function $T({ settings: e, onSettingsChange: t, className: n = "" }) {
16168
- const [r, o] = me(!1), [s, i] = me(!1), [a, l] = me(e), [u, d] = me(!1), { toast: f } = ha();
16164
+ const [r, o] = pe(!1), [s, i] = pe(!1), [a, l] = pe(e), [u, d] = pe(!1), { toast: f } = ha();
16169
16165
  gt(() => {
16170
16166
  const g = JSON.stringify(a) !== JSON.stringify(e);
16171
16167
  d(g);