teodor-new-chat-ui 3.0.100 → 3.0.102

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
@@ -1,5 +1,5 @@
1
1
  import * as f from "react";
2
- import q, { useState as de, useRef as Ke, useCallback as $e, useEffect as ze, useReducer as Dp, useMemo as mn, createContext as yc, useContext as Sc, createElement as ho, useLayoutEffect as Lp } from "react";
2
+ import X, { useState as de, useRef as Ke, useCallback as $e, useEffect as ze, useReducer as Dp, useMemo as mn, createContext as yc, useContext as Sc, createElement as ho, useLayoutEffect as Lp } from "react";
3
3
  import { Square as Fp, Send as Bp, X as Xn, ExternalLink as $p, Download as Hp, Image as Cc, FileText as Ga, Loader as zp, ChevronUp as Sr, ChevronDown as qn, Copy as Ka, Edit as Ya, RotateCcw as ai, Bot as qa, Wrench as Up, User as Wp, ChevronRight as Vp, Check as Ui, Circle as Gp, Edit3 as Tc, Paperclip as Xa, Loader2 as Kp, Plus as Yp, FileSpreadsheet as qp, MessageSquarePlus as Xp, MessageSquare as Jp, Calendar as Zp, Trash2 as Qp, PanelLeft as em, Settings as tm, Server as nm, EyeOff as rm, Eye as om, Layout as sm, MessageCircle as im, Save as am } from "lucide-react";
4
4
  import { Slot as ir, createSlot as tr, createSlottable as lm } from "@radix-ui/react-slot";
5
5
  import { cva as zr } from "class-variance-authority";
@@ -21,7 +21,7 @@ var Ja;
21
21
  function dm() {
22
22
  if (Ja) return vr;
23
23
  Ja = 1;
24
- var e = q, t = Symbol.for("react.element"), n = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, o = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 };
24
+ var e = X, t = Symbol.for("react.element"), n = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, o = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 };
25
25
  function i(a, c, u) {
26
26
  var d, h = {}, m = null, x = null;
27
27
  u !== void 0 && (m = "" + u), c.key !== void 0 && (m = "" + c.key), c.ref !== void 0 && (x = c.ref);
@@ -44,7 +44,7 @@ var br = {};
44
44
  var Za;
45
45
  function fm() {
46
46
  return Za || (Za = 1, process.env.NODE_ENV !== "production" && function() {
47
- var e = q, t = Symbol.for("react.element"), n = Symbol.for("react.portal"), r = Symbol.for("react.fragment"), o = Symbol.for("react.strict_mode"), s = Symbol.for("react.profiler"), i = Symbol.for("react.provider"), a = Symbol.for("react.context"), c = Symbol.for("react.forward_ref"), u = Symbol.for("react.suspense"), d = Symbol.for("react.suspense_list"), h = Symbol.for("react.memo"), m = Symbol.for("react.lazy"), x = Symbol.for("react.offscreen"), w = Symbol.iterator, g = "@@iterator";
47
+ var e = X, t = Symbol.for("react.element"), n = Symbol.for("react.portal"), r = Symbol.for("react.fragment"), o = Symbol.for("react.strict_mode"), s = Symbol.for("react.profiler"), i = Symbol.for("react.provider"), a = Symbol.for("react.context"), c = Symbol.for("react.forward_ref"), u = Symbol.for("react.suspense"), d = Symbol.for("react.suspense_list"), h = Symbol.for("react.memo"), m = Symbol.for("react.lazy"), x = Symbol.for("react.offscreen"), w = Symbol.iterator, g = "@@iterator";
48
48
  function p(R) {
49
49
  if (R === null || typeof R != "object")
50
50
  return null;
@@ -78,7 +78,7 @@ function fm() {
78
78
  // with.
79
79
  R.$$typeof === N || R.getModuleId !== void 0));
80
80
  }
81
- function F(R, z, ne) {
81
+ function L(R, z, ne) {
82
82
  var be = R.displayName;
83
83
  if (be)
84
84
  return be;
@@ -88,7 +88,7 @@ function fm() {
88
88
  function O(R) {
89
89
  return R.displayName || "Context";
90
90
  }
91
- function L(R) {
91
+ function F(R) {
92
92
  if (R == null)
93
93
  return null;
94
94
  if (typeof R.tag == "number" && b("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof R == "function")
@@ -118,14 +118,14 @@ function fm() {
118
118
  var ne = R;
119
119
  return O(ne._context) + ".Provider";
120
120
  case c:
121
- return F(R, R.render, "ForwardRef");
121
+ return L(R, R.render, "ForwardRef");
122
122
  case h:
123
123
  var be = R.displayName || null;
124
- return be !== null ? be : L(R.type) || "Memo";
124
+ return be !== null ? be : F(R.type) || "Memo";
125
125
  case m: {
126
126
  var Me = R, Fe = Me._payload, ke = Me._init;
127
127
  try {
128
- return L(ke(Fe));
128
+ return F(ke(Fe));
129
129
  } catch {
130
130
  return null;
131
131
  }
@@ -133,13 +133,13 @@ function fm() {
133
133
  }
134
134
  return null;
135
135
  }
136
- var A = Object.assign, X = 0, W, oe, _, M, V, U, Q;
136
+ var A = Object.assign, q = 0, W, oe, _, M, V, U, Q;
137
137
  function B() {
138
138
  }
139
139
  B.__reactDisabledLog = !0;
140
140
  function J() {
141
141
  {
142
- if (X === 0) {
142
+ if (q === 0) {
143
143
  W = console.log, oe = console.info, _ = console.warn, M = console.error, V = console.group, U = console.groupCollapsed, Q = console.groupEnd;
144
144
  var R = {
145
145
  configurable: !0,
@@ -157,12 +157,12 @@ function fm() {
157
157
  groupEnd: R
158
158
  });
159
159
  }
160
- X++;
160
+ q++;
161
161
  }
162
162
  }
163
163
  function ae() {
164
164
  {
165
- if (X--, X === 0) {
165
+ if (q--, q === 0) {
166
166
  var R = {
167
167
  configurable: !0,
168
168
  enumerable: !0,
@@ -192,7 +192,7 @@ function fm() {
192
192
  })
193
193
  });
194
194
  }
195
- X < 0 && b("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
195
+ q < 0 && b("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
196
196
  }
197
197
  }
198
198
  var ge = v.ReactCurrentDispatcher, H;
@@ -482,7 +482,7 @@ function fm() {
482
482
  function Ae() {
483
483
  {
484
484
  if (dn.current) {
485
- var R = L(dn.current.type);
485
+ var R = F(dn.current.type);
486
486
  if (R)
487
487
  return `
488
488
 
@@ -517,7 +517,7 @@ Check the top-level render call using <` + ne + ">.");
517
517
  return;
518
518
  fn[ne] = !0;
519
519
  var be = "";
520
- R && R._owner && R._owner !== dn.current && (be = " It was passed a child from " + L(R._owner.type) + "."), Kt(R), b('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', ne, be), Kt(null);
520
+ R && R._owner && R._owner !== dn.current && (be = " It was passed a child from " + F(R._owner.type) + "."), Kt(R), b('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', ne, be), Kt(null);
521
521
  }
522
522
  }
523
523
  function xr(R, z) {
@@ -554,11 +554,11 @@ Check the top-level render call using <` + ne + ">.");
554
554
  else
555
555
  return;
556
556
  if (ne) {
557
- var be = L(z);
557
+ var be = F(z);
558
558
  qe(ne, R.props, "prop", be, R);
559
559
  } else if (z.PropTypes !== void 0 && !ie) {
560
560
  ie = !0;
561
- var Me = L(z);
561
+ var Me = F(z);
562
562
  b("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", Me || "Unknown");
563
563
  }
564
564
  typeof z.getDefaultProps == "function" && !z.getDefaultProps.isReactClassApproved && b("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
@@ -585,7 +585,7 @@ Check the top-level render call using <` + ne + ">.");
585
585
  var ut = Ye();
586
586
  ut ? Ie += ut : Ie += Ae();
587
587
  var Xe;
588
- R === null ? Xe = "null" : vt(R) ? Xe = "array" : R !== void 0 && R.$$typeof === t ? (Xe = "<" + (L(R.type) || "Unknown") + " />", Ie = " Did you accidentally export a JSX literal instead of a component?") : Xe = typeof R, b("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", Xe, Ie);
588
+ R === null ? Xe = "null" : vt(R) ? Xe = "array" : R !== void 0 && R.$$typeof === t ? (Xe = "<" + (F(R.type) || "Unknown") + " />", Ie = " Did you accidentally export a JSX literal instead of a component?") : Xe = typeof R, b("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", Xe, Ie);
589
589
  }
590
590
  var Qe = mr(R, z, ne, Me, Fe);
591
591
  if (Qe == null)
@@ -1849,15 +1849,15 @@ const Wc = (e) => {
1849
1849
  headers: I,
1850
1850
  withCredentials: N = "same-origin",
1851
1851
  fetchOptions: j
1852
- } = Wc(w), F = t || fetch;
1852
+ } = Wc(w), L = t || fetch;
1853
1853
  C = C ? (C + "").toLowerCase() : "text";
1854
- let O = jg([b, y && y.toAbortSignal()], E), L = null;
1854
+ let O = jg([b, y && y.toAbortSignal()], E), F = null;
1855
1855
  const A = O && O.unsubscribe && (() => {
1856
1856
  O.unsubscribe();
1857
1857
  });
1858
- let X;
1858
+ let q;
1859
1859
  try {
1860
- if (T && u && p !== "get" && p !== "head" && (X = await x(I, v)) !== 0) {
1860
+ if (T && u && p !== "get" && p !== "head" && (q = await x(I, v)) !== 0) {
1861
1861
  let U = new n(g, {
1862
1862
  method: "POST",
1863
1863
  body: v,
@@ -1865,7 +1865,7 @@ const Wc = (e) => {
1865
1865
  }), Q;
1866
1866
  if (k.isFormData(v) && (Q = U.headers.get("content-type")) && I.setContentType(Q), U.body) {
1867
1867
  const [B, J] = ol(
1868
- X,
1868
+ q,
1869
1869
  _o(sl(T))
1870
1870
  );
1871
1871
  v = al(U.body, ll, B, J);
@@ -1881,8 +1881,8 @@ const Wc = (e) => {
1881
1881
  duplex: "half",
1882
1882
  credentials: W ? N : void 0
1883
1883
  };
1884
- L = s && new n(g, oe);
1885
- let _ = await (s ? F(L, j) : F(g, oe));
1884
+ F = s && new n(g, oe);
1885
+ let _ = await (s ? L(F, j) : L(g, oe));
1886
1886
  const M = d && (C === "stream" || C === "response");
1887
1887
  if (d && (S || M && A)) {
1888
1888
  const U = {};
@@ -1909,16 +1909,16 @@ const Wc = (e) => {
1909
1909
  status: _.status,
1910
1910
  statusText: _.statusText,
1911
1911
  config: w,
1912
- request: L
1912
+ request: F
1913
1913
  });
1914
1914
  });
1915
1915
  } catch (W) {
1916
1916
  throw A && A(), W && W.name === "TypeError" && /Load failed|fetch/i.test(W.message) ? Object.assign(
1917
- new Se("Network Error", Se.ERR_NETWORK, w, L),
1917
+ new Se("Network Error", Se.ERR_NETWORK, w, F),
1918
1918
  {
1919
1919
  cause: W.cause || W
1920
1920
  }
1921
- ) : Se.from(W, W && W.code, w, L);
1921
+ ) : Se.from(W, W && W.code, w, F);
1922
1922
  }
1923
1923
  };
1924
1924
  }, Mg = /* @__PURE__ */ new Map(), Vc = (e) => {
@@ -2514,9 +2514,9 @@ function Kg(e = {}) {
2514
2514
  }, []), C = $e(
2515
2515
  (I, N, j) => {
2516
2516
  b.current && (b.current.abort(), b.current = null), a(!0), u(null), e.autoAppendAssistant !== !1 && h("");
2517
- const F = new AbortController();
2518
- return b.current = F, (async () => {
2519
- var A, X, W, oe, _, M;
2517
+ const L = new AbortController();
2518
+ return b.current = L, (async () => {
2519
+ var A, q, W, oe, _, M;
2520
2520
  const O = (() => {
2521
2521
  var V;
2522
2522
  try {
@@ -2524,7 +2524,7 @@ function Kg(e = {}) {
2524
2524
  } catch {
2525
2525
  return !1;
2526
2526
  }
2527
- })(), L = (V) => {
2527
+ })(), F = (V) => {
2528
2528
  var U;
2529
2529
  try {
2530
2530
  const Q = JSON.parse(JSON.stringify(V));
@@ -2545,7 +2545,7 @@ function Kg(e = {}) {
2545
2545
  const ae = window.__AUTH_TOKEN__, ge = ((A = window.localStorage) == null ? void 0 : A.getItem("authToken")) || null;
2546
2546
  let H = null;
2547
2547
  try {
2548
- const K = (X = window.localStorage) == null ? void 0 : X.getItem("chat-settings");
2548
+ const K = (q = window.localStorage) == null ? void 0 : q.getItem("chat-settings");
2549
2549
  K && (H = ((W = JSON.parse(K)) == null ? void 0 : W.apiKey) || null);
2550
2550
  } catch {
2551
2551
  }
@@ -2554,7 +2554,7 @@ function Kg(e = {}) {
2554
2554
  }
2555
2555
  } catch {
2556
2556
  }
2557
- O && console.debug("[use-chat] POST", t + n, L(I));
2557
+ O && console.debug("[use-chat] POST", t + n, F(I));
2558
2558
  const U = await fetch(t + n, {
2559
2559
  method: "POST",
2560
2560
  headers: {
@@ -2564,7 +2564,7 @@ function Kg(e = {}) {
2564
2564
  ...s.current
2565
2565
  },
2566
2566
  body: JSON.stringify(I),
2567
- signal: F.signal
2567
+ signal: L.signal
2568
2568
  });
2569
2569
  if (!U.ok || !U.body) {
2570
2570
  const J = await U.text().catch(() => "");
@@ -2630,7 +2630,7 @@ function Kg(e = {}) {
2630
2630
  } finally {
2631
2631
  a(!1), v(!1), b.current = null;
2632
2632
  }
2633
- })(), { close: () => F.abort() };
2633
+ })(), { close: () => L.abort() };
2634
2634
  },
2635
2635
  [t, r, e.autoAppendAssistant]
2636
2636
  );
@@ -2975,8 +2975,8 @@ function xo({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
2975
2975
  }, [c, x]);
2976
2976
  const p = $e((G) => {
2977
2977
  c.setAuthToken(G);
2978
- }, [c]), { state: v, seed: b, prepend: y, pushUser: E, onEvent: S, reset: T } = Zg(), C = 20, [I, N] = de(!1), [j, F] = de(!1), [O, L] = de(null), [A, X] = de(void 0), [W, oe] = de(void 0), _ = Ke(!1), M = Ke([]), V = $e((G) => {
2979
- G.cursor !== void 0 && L(G.cursor), G.hasMore !== void 0 && N(G.hasMore), G.checkpointId !== void 0 && X(G.checkpointId), G.checkpointNs !== void 0 && oe(G.checkpointNs);
2978
+ }, [c]), { state: v, seed: b, prepend: y, pushUser: E, onEvent: S, reset: T } = Zg(), C = 20, [I, N] = de(!1), [j, L] = de(!1), [O, F] = de(null), [A, q] = de(void 0), [W, oe] = de(void 0), _ = Ke(!1), M = Ke([]), V = $e((G) => {
2979
+ G.cursor !== void 0 && F(G.cursor), G.hasMore !== void 0 && N(G.hasMore), G.checkpointId !== void 0 && q(G.checkpointId), G.checkpointNs !== void 0 && oe(G.checkpointNs);
2980
2980
  }, []), U = $e((G, Z) => {
2981
2981
  const Le = async () => {
2982
2982
  if (_.current) {
@@ -3003,7 +3003,7 @@ function xo({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
3003
3003
  Z === "replace" ? b(Le, {
3004
3004
  checkpointId: (G == null ? void 0 : G.checkpointId) ?? null,
3005
3005
  checkpointNs: (G == null ? void 0 : G.checkpointNs) ?? null
3006
- }) : Z === "prepend" && Le.length ? (console.log("[ChatProvider] Calling prepend with", Le.length, "messages"), y(Le)) : console.log("[ChatProvider] Skipping prepend - empty list or wrong mode"), L((G == null ? void 0 : G.nextCursor) ?? null), N(!!(G != null && G.hasMore)), X((He) => (G == null ? void 0 : G.checkpointId) ?? He ?? void 0), oe((He) => (G == null ? void 0 : G.checkpointNs) ?? He ?? void 0);
3006
+ }) : Z === "prepend" && Le.length ? (console.log("[ChatProvider] Calling prepend with", Le.length, "messages"), y(Le)) : console.log("[ChatProvider] Skipping prepend - empty list or wrong mode"), F((G == null ? void 0 : G.nextCursor) ?? null), N(!!(G != null && G.hasMore)), q((He) => (G == null ? void 0 : G.checkpointId) ?? He ?? void 0), oe((He) => (G == null ? void 0 : G.checkpointNs) ?? He ?? void 0);
3007
3007
  },
3008
3008
  [b, y]
3009
3009
  ), [B, J] = de([]), [ae, ge] = de(null), H = $e(async () => {
@@ -3168,7 +3168,7 @@ function xo({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
3168
3168
  const Z = await c.createThread(G);
3169
3169
  return await H(), await Te(Z.threadId), Z.threadId;
3170
3170
  }, [c, H, Te]), we = $e(async (G) => {
3171
- await c.deleteThread(G), await H(), ae === G && (ge(null), T([]), N(!1), L(null), X(void 0), oe(void 0));
3171
+ await c.deleteThread(G), await H(), ae === G && (ge(null), T([]), N(!1), F(null), q(void 0), oe(void 0));
3172
3172
  }, [c, H, ae, T]), qe = $e(async (G, Z) => {
3173
3173
  await c.updateThread(G, Z), await H();
3174
3174
  }, [c, H]), Et = $e(async (G, Z) => {
@@ -3228,7 +3228,7 @@ function xo({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
3228
3228
  if (j || !I) return;
3229
3229
  const Z = O;
3230
3230
  if (Z) {
3231
- F(!0);
3231
+ L(!0);
3232
3232
  try {
3233
3233
  const Le = await c.getMessages({
3234
3234
  threadId: ae,
@@ -3239,7 +3239,7 @@ function xo({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
3239
3239
  });
3240
3240
  Q(Le, "prepend");
3241
3241
  } finally {
3242
- F(!1);
3242
+ L(!1);
3243
3243
  }
3244
3244
  }
3245
3245
  },
@@ -3349,18 +3349,18 @@ function lx({
3349
3349
  textareaClassName: d = "",
3350
3350
  allowEmptySend: h = !1
3351
3351
  }) {
3352
- const [m, x] = q.useState(e), [w, g] = q.useTransition(), p = q.useRef(null);
3353
- q.useEffect(() => {
3352
+ const [m, x] = X.useState(e), [w, g] = X.useTransition(), p = X.useRef(null);
3353
+ X.useEffect(() => {
3354
3354
  x(e ?? ""), p.current && (p.current.style.height = "auto", p.current.style.height = `${p.current.scrollHeight}px`);
3355
3355
  }, [e, t]);
3356
- const v = q.useCallback(() => {
3356
+ const v = X.useCallback(() => {
3357
3357
  const I = p.current;
3358
3358
  I && (I.style.height = "auto", I.style.height = `${I.scrollHeight}px`);
3359
3359
  }, []);
3360
- q.useEffect(() => {
3360
+ X.useEffect(() => {
3361
3361
  v();
3362
3362
  }, [v]);
3363
- const b = q.useCallback(
3363
+ const b = X.useCallback(
3364
3364
  async (I) => {
3365
3365
  I && I.preventDefault();
3366
3366
  const N = (m ?? "").trim();
@@ -3376,9 +3376,9 @@ function lx({
3376
3376
  });
3377
3377
  },
3378
3378
  [m, i, h]
3379
- ), y = q.useCallback((I) => {
3379
+ ), y = X.useCallback((I) => {
3380
3380
  x(I.target.value), p.current && (p.current.style.height = "auto", p.current.style.height = `${p.current.scrollHeight}px`);
3381
- }, []), E = q.useCallback(
3381
+ }, []), E = X.useCallback(
3382
3382
  (I) => {
3383
3383
  I.key === "Enter" && !I.shiftKey ? (I.preventDefault(), b()) : I.key === "Escape" && t && (I.preventDefault(), a == null || a());
3384
3384
  },
@@ -3428,7 +3428,7 @@ function lx({
3428
3428
  ) })
3429
3429
  ] }) });
3430
3430
  }
3431
- const cx = q.memo(lx), ns = 0, yn = 1, cr = 2, Zc = 4;
3431
+ const cx = X.memo(lx), ns = 0, yn = 1, cr = 2, Zc = 4;
3432
3432
  function bl(e) {
3433
3433
  return () => e;
3434
3434
  }
@@ -3706,10 +3706,10 @@ function Fn(e, t, n) {
3706
3706
  return Xi(e, t, n).callbackRef;
3707
3707
  }
3708
3708
  function Xi(e, t, n) {
3709
- const r = q.useRef(null);
3709
+ const r = X.useRef(null);
3710
3710
  let o = (i) => {
3711
3711
  };
3712
- const s = q.useMemo(() => typeof ResizeObserver < "u" ? new ResizeObserver((i) => {
3712
+ const s = X.useMemo(() => typeof ResizeObserver < "u" ? new ResizeObserver((i) => {
3713
3713
  const a = () => {
3714
3714
  const c = i[0].target;
3715
3715
  c.offsetParent !== null && e(c);
@@ -3721,7 +3721,7 @@ function Xi(e, t, n) {
3721
3721
  }, { callbackRef: o, ref: r };
3722
3722
  }
3723
3723
  function wx(e, t, n, r, o, s, i, a, c) {
3724
- const u = q.useCallback(
3724
+ const u = X.useCallback(
3725
3725
  (d) => {
3726
3726
  const h = yx(d.children, t, a ? "offsetWidth" : "offsetHeight", o);
3727
3727
  let m = d.parentElement;
@@ -3764,7 +3764,7 @@ function Sl(e, t, n) {
3764
3764
  return t !== "normal" && !(t != null && t.endsWith("px")) && n(`${e} was not resolved to pixel value correctly`, t, gt.WARN), t === "normal" ? 0 : parseInt(t ?? "0", 10);
3765
3765
  }
3766
3766
  function tu(e, t, n) {
3767
- const r = q.useRef(null), o = q.useCallback(
3767
+ const r = X.useRef(null), o = X.useCallback(
3768
3768
  (c) => {
3769
3769
  if (!(c != null && c.offsetParent))
3770
3770
  return;
@@ -3785,10 +3785,10 @@ function tu(e, t, n) {
3785
3785
  },
3786
3786
  // eslint-disable-next-line react-hooks/exhaustive-deps
3787
3787
  [e, t]
3788
- ), { callbackRef: s, ref: i } = Xi(o, !0, n), a = q.useCallback(() => {
3788
+ ), { callbackRef: s, ref: i } = Xi(o, !0, n), a = X.useCallback(() => {
3789
3789
  o(i.current);
3790
3790
  }, [o, i]);
3791
- return q.useEffect(() => {
3791
+ return X.useEffect(() => {
3792
3792
  var c;
3793
3793
  if (t) {
3794
3794
  t.addEventListener("scroll", a);
@@ -4177,7 +4177,7 @@ const _x = {
4177
4177
  xe((S) => S.length > 0),
4178
4178
  Re(g, x),
4179
4179
  re(([S, T, C]) => {
4180
- const I = S.reduce((N, j, F) => Ct(N, j, Or(j, T.offsetTree, C) || F), Jn());
4180
+ const I = S.reduce((N, j, L) => Ct(N, j, Or(j, T.offsetTree, C) || L), Jn());
4181
4181
  return {
4182
4182
  ...T,
4183
4183
  groupIndices: S,
@@ -4264,32 +4264,32 @@ const _x = {
4264
4264
  const C = T.groupIndices.length > 0, I = [], N = T.lastSize;
4265
4265
  if (C) {
4266
4266
  const j = Pr(T.sizeTree, 0);
4267
- let F = 0, O = 0;
4268
- for (; F < S; ) {
4269
- const A = T.groupIndices[O], X = T.groupIndices.length === O + 1 ? 1 / 0 : T.groupIndices[O + 1] - A - 1;
4267
+ let L = 0, O = 0;
4268
+ for (; L < S; ) {
4269
+ const A = T.groupIndices[O], q = T.groupIndices.length === O + 1 ? 1 / 0 : T.groupIndices[O + 1] - A - 1;
4270
4270
  I.push({
4271
4271
  endIndex: A,
4272
4272
  size: j,
4273
4273
  startIndex: A
4274
4274
  }), I.push({
4275
- endIndex: A + 1 + X - 1,
4275
+ endIndex: A + 1 + q - 1,
4276
4276
  size: N,
4277
4277
  startIndex: A + 1
4278
- }), O++, F += X + 1;
4278
+ }), O++, L += q + 1;
4279
4279
  }
4280
- const L = Nn(T.sizeTree);
4281
- return F !== S && L.shift(), L.reduce(
4282
- (A, { k: X, v: W }) => {
4280
+ const F = Nn(T.sizeTree);
4281
+ return L !== S && F.shift(), F.reduce(
4282
+ (A, { k: q, v: W }) => {
4283
4283
  let oe = A.ranges;
4284
4284
  return A.prevSize !== 0 && (oe = [
4285
4285
  ...A.ranges,
4286
4286
  {
4287
- endIndex: X + S - 1,
4287
+ endIndex: q + S - 1,
4288
4288
  size: A.prevSize,
4289
4289
  startIndex: A.prevIndex
4290
4290
  }
4291
4291
  ]), {
4292
- prevIndex: X + S,
4292
+ prevIndex: q + S,
4293
4293
  prevSize: W,
4294
4294
  ranges: oe
4295
4295
  };
@@ -4302,10 +4302,10 @@ const _x = {
4302
4302
  ).ranges;
4303
4303
  }
4304
4304
  return Nn(T.sizeTree).reduce(
4305
- (j, { k: F, v: O }) => ({
4306
- prevIndex: F + S,
4305
+ (j, { k: L, v: O }) => ({
4306
+ prevIndex: L + S,
4307
4307
  prevSize: O,
4308
- ranges: [...j.ranges, { endIndex: F + S - 1, size: j.prevSize, startIndex: j.prevIndex }]
4308
+ ranges: [...j.ranges, { endIndex: L + S - 1, size: j.prevSize, startIndex: j.prevIndex }]
4309
4309
  }),
4310
4310
  {
4311
4311
  prevIndex: 0,
@@ -4337,15 +4337,15 @@ const _x = {
4337
4337
  return T;
4338
4338
  let I = Jn();
4339
4339
  const N = Je(p);
4340
- let j = 0, F = 0, O = 0;
4340
+ let j = 0, L = 0, O = 0;
4341
4341
  for (; j < -S; ) {
4342
- O = N[F];
4343
- const L = N[F + 1] - O - 1;
4344
- F++, j += L + 1;
4342
+ O = N[L];
4343
+ const F = N[L + 1] - O - 1;
4344
+ L++, j += F + 1;
4345
4345
  }
4346
- if (I = Nn(T.sizeTree).reduce((L, { k: A, v: X }) => Ct(L, Math.max(0, A + S), X), I), j !== -S) {
4347
- const L = Pr(T.sizeTree, O);
4348
- I = Ct(I, 0, L);
4346
+ if (I = Nn(T.sizeTree).reduce((F, { k: A, v: q }) => Ct(F, Math.max(0, A + S), q), I), j !== -S) {
4347
+ const F = Pr(T.sizeTree, O);
4348
+ I = Ct(I, 0, F);
4349
4349
  const A = Bt(T.sizeTree, -S + 1)[1];
4350
4350
  I = Ct(I, 1, A);
4351
4351
  }
@@ -4355,7 +4355,7 @@ const _x = {
4355
4355
  ...yi(T.offsetTree, 0, I, C)
4356
4356
  };
4357
4357
  } else {
4358
- const I = Nn(T.sizeTree).reduce((N, { k: j, v: F }) => Ct(N, Math.max(0, j + S), F), Jn());
4358
+ const I = Nn(T.sizeTree).reduce((N, { k: j, v: L }) => Ct(N, Math.max(0, j + S), L), Jn());
4359
4359
  return {
4360
4360
  ...T,
4361
4361
  sizeTree: I,
@@ -4473,16 +4473,16 @@ const Kr = _e(
4473
4473
  Re(e, s, o),
4474
4474
  re(
4475
4475
  ([
4476
- [E, S, T, C, I, N, j, F],
4476
+ [E, S, T, C, I, N, j, L],
4477
4477
  O,
4478
- L,
4478
+ F,
4479
4479
  A
4480
4480
  ]) => {
4481
- const X = fu(E), { align: W, behavior: oe, offset: _ } = X, M = C - 1, V = uu(X, S, M);
4481
+ const q = fu(E), { align: W, behavior: oe, offset: _ } = q, M = C - 1, V = uu(q, S, M);
4482
4482
  let U = Or(V, S.offsetTree, O) + N;
4483
- W === "end" ? (U += L + Bt(S.sizeTree, V)[1] - T + A, V === M && (U += j)) : W === "center" ? U += (L + Bt(S.sizeTree, V)[1] - T + A) / 2 : U -= I, _ && (U += _);
4483
+ W === "end" ? (U += F + Bt(S.sizeTree, V)[1] - T + A, V === M && (U += j)) : W === "center" ? U += (F + Bt(S.sizeTree, V)[1] - T + A) / 2 : U -= I, _ && (U += _);
4484
4484
  const Q = (B) => {
4485
- y(), B ? (F("retrying to scroll to", { location: E }, gt.DEBUG), Ce(x, E)) : (Ce(w, !0), F("list did not change, scroll successful", {}, gt.DEBUG));
4485
+ y(), B ? (L("retrying to scroll to", { location: E }, gt.DEBUG), Ce(x, E)) : (Ce(w, !0), L("list did not change, scroll successful", {}, gt.DEBUG));
4486
4486
  };
4487
4487
  if (y(), oe === "smooth") {
4488
4488
  let B = !1;
@@ -4495,7 +4495,7 @@ const Kr = _e(
4495
4495
  p = Lt($(t, Dx(150)), Q);
4496
4496
  return v = setTimeout(() => {
4497
4497
  y();
4498
- }, 1200), Ce(c, !0), F("scrolling from index to", { behavior: oe, index: V, top: U }, gt.DEBUG), { behavior: oe, top: U };
4498
+ }, 1200), Ce(c, !0), L("scrolling from index to", { behavior: oe, index: V, top: U }, gt.DEBUG), { behavior: oe, top: U };
4499
4499
  }
4500
4500
  )
4501
4501
  ),
@@ -4613,18 +4613,18 @@ const Mr = "up", Rr = "down", Lx = "none", Fx = {
4613
4613
  viewportHeight: S
4614
4614
  };
4615
4615
  if (N) {
4616
- let O, L;
4617
- return E > b.state.scrollTop ? (O = "SCROLLED_DOWN", L = b.state.scrollTop - E) : (O = "SIZE_DECREASED", L = b.state.scrollTop - E || b.scrollTopDelta), {
4616
+ let O, F;
4617
+ return E > b.state.scrollTop ? (O = "SCROLLED_DOWN", F = b.state.scrollTop - E) : (O = "SIZE_DECREASED", F = b.state.scrollTop - E || b.scrollTopDelta), {
4618
4618
  atBottom: !0,
4619
4619
  atBottomBecause: O,
4620
- scrollTopDelta: L,
4620
+ scrollTopDelta: F,
4621
4621
  state: j
4622
4622
  };
4623
4623
  }
4624
- let F;
4625
- return j.scrollHeight > b.state.scrollHeight ? F = "SIZE_INCREASED" : S < b.state.viewportHeight ? F = "VIEWPORT_HEIGHT_DECREASING" : E < b.state.scrollTop ? F = "SCROLLING_UPWARDS" : F = "NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM", {
4624
+ let L;
4625
+ return j.scrollHeight > b.state.scrollHeight ? L = "SIZE_INCREASED" : S < b.state.viewportHeight ? L = "VIEWPORT_HEIGHT_DECREASING" : E < b.state.scrollTop ? L = "SCROLLING_UPWARDS" : L = "NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM", {
4626
4626
  atBottom: !1,
4627
- notAtBottomBecause: F,
4627
+ notAtBottomBecause: L,
4628
4628
  state: j
4629
4629
  };
4630
4630
  }, Fx),
@@ -4902,25 +4902,25 @@ const Bn = _e(
4902
4902
  I,
4903
4903
  N,
4904
4904
  j,
4905
- F,
4906
- O,
4907
4905
  L,
4906
+ O,
4907
+ F,
4908
4908
  A,
4909
- X
4909
+ q
4910
4910
  ]) => {
4911
4911
  const W = N, { offsetTree: oe, sizeTree: _ } = W, M = Je(p);
4912
4912
  if (I === 0)
4913
4913
  return { ...Hs, totalCount: I };
4914
4914
  if (T === 0 && C === 0)
4915
- return M === 0 ? { ...Hs, totalCount: I } : pu(M, j, N, L, A, X || []);
4915
+ return M === 0 ? { ...Hs, totalCount: I } : pu(M, j, N, F, A, q || []);
4916
4916
  if (Be(_))
4917
4917
  return M > 0 ? null : bo(
4918
- $x(ea(j, I), W, X),
4918
+ $x(ea(j, I), W, q),
4919
4919
  [],
4920
4920
  I,
4921
4921
  A,
4922
4922
  W,
4923
- L
4923
+ F
4924
4924
  );
4925
4925
  const V = [];
4926
4926
  if (O.length > 0) {
@@ -4929,11 +4929,11 @@ const Bn = _e(
4929
4929
  for (const P of os(_, ae, ge)) {
4930
4930
  const K = P.value, ee = Math.max(P.start, ae), le = Math.min(P.end, ge);
4931
4931
  for (let se = ee; se <= le; se++)
4932
- V.push({ data: X == null ? void 0 : X[se], index: se, offset: H, size: K }), H += K;
4932
+ V.push({ data: q == null ? void 0 : q[se], index: se, offset: H, size: K }), H += K;
4933
4933
  }
4934
4934
  }
4935
- if (!F)
4936
- return bo([], V, I, A, W, L);
4935
+ if (!L)
4936
+ return bo([], V, I, A, W, F);
4937
4937
  const U = O.length > 0 ? O[O.length - 1] + 1 : 0, Q = Nx(oe, T, C, U);
4938
4938
  if (Q.length === 0)
4939
4939
  return null;
@@ -4950,10 +4950,10 @@ const Bn = _e(
4950
4950
  K < U && (P += (U - K) * ee, K = U);
4951
4951
  const le = Math.min(ge.end, B);
4952
4952
  for (let se = K; se <= le && !(P >= C); se++)
4953
- ae.push({ data: X == null ? void 0 : X[se], index: se, offset: P, size: ee }), P += ee + A;
4953
+ ae.push({ data: q == null ? void 0 : q[se], index: se, offset: P, size: ee }), P += ee + A;
4954
4954
  }
4955
4955
  });
4956
- return bo(J, V, I, A, W, L);
4956
+ return bo(J, V, I, A, W, F);
4957
4957
  }
4958
4958
  ),
4959
4959
  //@ts-expect-error filter needs to be fixed
@@ -5087,17 +5087,17 @@ const Bn = _e(
5087
5087
  Re(t, c, n, s, o, r, a),
5088
5088
  Re(e),
5089
5089
  re(([[h, m, x, w, g, p, v, b], y]) => {
5090
- const { align: E, behavior: S, calculateViewLocation: T = zx, done: C, ...I } = h, N = uu(h, m, w - 1), j = Or(N, m.offsetTree, y) + g + p, F = j + Bt(m.sizeTree, N)[1], O = b + p, L = b + x - v, A = T({
5091
- itemBottom: F,
5090
+ const { align: E, behavior: S, calculateViewLocation: T = zx, done: C, ...I } = h, N = uu(h, m, w - 1), j = Or(N, m.offsetTree, y) + g + p, L = j + Bt(m.sizeTree, N)[1], O = b + p, F = b + x - v, A = T({
5091
+ itemBottom: L,
5092
5092
  itemTop: j,
5093
5093
  locationParams: { align: E, behavior: S, ...I },
5094
- viewportBottom: L,
5094
+ viewportBottom: F,
5095
5095
  viewportTop: O
5096
5096
  });
5097
5097
  return A ? C && Lt(
5098
5098
  $(
5099
5099
  i,
5100
- xe((X) => !X),
5100
+ xe((q) => !q),
5101
5101
  // skips the initial publish of false, and the cleanup call.
5102
5102
  // but if scrollingInProgress is true, we skip the initial publish.
5103
5103
  _n(Je(i) ? 1 : 2)
@@ -5144,8 +5144,8 @@ const Ux = (e, t) => typeof e == "function" ? jl(e(t)) : t && jl(e), Wx = _e(
5144
5144
  et($(me(t), _n(1)), c),
5145
5145
  Re(me(w), s, a, h),
5146
5146
  re(([[S, T], C, I, N, j]) => {
5147
- let F = T && N, O = "auto";
5148
- return F && (O = Ux(C, I || j), F = F && !!O), { followOutputBehavior: O, shouldFollow: F, totalCount: S };
5147
+ let L = T && N, O = "auto";
5148
+ return L && (O = Ux(C, I || j), L = L && !!O), { followOutputBehavior: O, shouldFollow: L, totalCount: S };
5149
5149
  }),
5150
5150
  xe(({ shouldFollow: S }) => S)
5151
5151
  ),
@@ -5441,8 +5441,8 @@ const Xx = bu(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
5441
5441
  let N = 0, j = 0;
5442
5442
  for (; N < v; ) {
5443
5443
  N++, C += I;
5444
- let F = b.length === j + 1 ? 1 / 0 : b[j + 1] - b[j] - 1;
5445
- N + F > v && (C -= I, F = v - N + 1), N += F, C += T(F), j++;
5444
+ let L = b.length === j + 1 ? 1 / 0 : b[j + 1] - b[j] - 1;
5445
+ N + L > v && (C -= I, L = v - N + 1), N += L, C += T(L), j++;
5446
5446
  }
5447
5447
  return C;
5448
5448
  }
@@ -5584,9 +5584,9 @@ function Qx(e, t) {
5584
5584
  Object.hasOwn(r, i) || (n[i] = t[i]);
5585
5585
  return n;
5586
5586
  }
5587
- const ro = typeof document < "u" ? q.useLayoutEffect : q.useEffect;
5587
+ const ro = typeof document < "u" ? X.useLayoutEffect : X.useEffect;
5588
5588
  function yu(e, t, n) {
5589
- const r = Object.keys(t.required || {}), o = Object.keys(t.optional || {}), s = Object.keys(t.methods || {}), i = Object.keys(t.events || {}), a = q.createContext({});
5589
+ const r = Object.keys(t.required || {}), o = Object.keys(t.optional || {}), s = Object.keys(t.methods || {}), i = Object.keys(t.events || {}), a = X.createContext({});
5590
5590
  function c(p, v) {
5591
5591
  p.propsReady && Ce(p.propsReady, !1);
5592
5592
  for (const b of r) {
@@ -5609,10 +5609,10 @@ function yu(e, t, n) {
5609
5609
  function d(p) {
5610
5610
  return i.reduce((v, b) => (v[b] = mx(p[t.events[b]]), v), {});
5611
5611
  }
5612
- const h = q.forwardRef((p, v) => {
5613
- const { children: b, ...y } = p, [E] = q.useState(() => rs(xx(e), (C) => {
5612
+ const h = X.forwardRef((p, v) => {
5613
+ const { children: b, ...y } = p, [E] = X.useState(() => rs(xx(e), (C) => {
5614
5614
  c(C, y);
5615
- })), [S] = q.useState(wl(d, E));
5615
+ })), [S] = X.useState(wl(d, E));
5616
5616
  ro(() => {
5617
5617
  for (const C of i)
5618
5618
  C in y && De(S[C], y[C]);
@@ -5621,47 +5621,47 @@ function yu(e, t, n) {
5621
5621
  };
5622
5622
  }, [y, S, E]), ro(() => {
5623
5623
  c(E, y);
5624
- }), q.useImperativeHandle(v, bl(u(E)));
5624
+ }), X.useImperativeHandle(v, bl(u(E)));
5625
5625
  const T = n;
5626
5626
  return /* @__PURE__ */ l.jsx(a.Provider, { value: E, children: n ? /* @__PURE__ */ l.jsx(T, { ...Qx([...r, ...o, ...i], y), children: b }) : b });
5627
5627
  }), m = (p) => {
5628
- const v = q.useContext(a);
5629
- return q.useCallback(
5628
+ const v = X.useContext(a);
5629
+ return X.useCallback(
5630
5630
  (b) => {
5631
5631
  Ce(v[p], b);
5632
5632
  },
5633
5633
  [v, p]
5634
5634
  );
5635
5635
  }, x = (p) => {
5636
- const v = q.useContext(a)[p], b = q.useCallback(
5636
+ const v = X.useContext(a)[p], b = X.useCallback(
5637
5637
  (y) => De(v, y),
5638
5638
  [v]
5639
5639
  );
5640
- return q.useSyncExternalStore(
5640
+ return X.useSyncExternalStore(
5641
5641
  b,
5642
5642
  () => Je(v),
5643
5643
  () => Je(v)
5644
5644
  );
5645
5645
  }, w = (p) => {
5646
- const v = q.useContext(a)[p], [b, y] = q.useState(wl(Je, v));
5646
+ const v = X.useContext(a)[p], [b, y] = X.useState(wl(Je, v));
5647
5647
  return ro(
5648
5648
  () => De(v, (E) => {
5649
5649
  E !== b && y(bl(E));
5650
5650
  }),
5651
5651
  [v, b]
5652
5652
  ), b;
5653
- }, g = q.version.startsWith("18") ? x : w;
5653
+ }, g = X.version.startsWith("18") ? x : w;
5654
5654
  return {
5655
5655
  Component: h,
5656
5656
  useEmitter: (p, v) => {
5657
- const b = q.useContext(a)[p];
5657
+ const b = X.useContext(a)[p];
5658
5658
  ro(() => De(b, v), [v, b]);
5659
5659
  },
5660
5660
  useEmitterValue: g,
5661
5661
  usePublisher: m
5662
5662
  };
5663
5663
  }
5664
- const Su = q.createContext(void 0), Cu = q.createContext(void 0), Tu = typeof document < "u" ? q.useLayoutEffect : q.useEffect;
5664
+ const Su = X.createContext(void 0), Cu = X.createContext(void 0), Tu = typeof document < "u" ? X.useLayoutEffect : X.useEffect;
5665
5665
  function zs(e) {
5666
5666
  return "self" in e;
5667
5667
  }
@@ -5669,7 +5669,7 @@ function ev(e) {
5669
5669
  return "body" in e;
5670
5670
  }
5671
5671
  function Ru(e, t, n, r = ur, o, s) {
5672
- const i = q.useRef(null), a = q.useRef(null), c = q.useRef(null), u = q.useCallback(
5672
+ const i = X.useRef(null), a = X.useRef(null), c = X.useRef(null), u = X.useCallback(
5673
5673
  (m) => {
5674
5674
  let x, w, g;
5675
5675
  const p = m.target;
@@ -5689,7 +5689,7 @@ function Ru(e, t, n, r = ur, o, s) {
5689
5689
  },
5690
5690
  [e, t, s]
5691
5691
  );
5692
- q.useEffect(() => {
5692
+ X.useEffect(() => {
5693
5693
  const m = o || i.current;
5694
5694
  return r(o || i.current), u({ suppressFlushSync: !0, target: m }), m.addEventListener("scroll", u, { passive: !0 }), () => {
5695
5695
  r(null), m.removeEventListener("scroll", u);
@@ -5757,7 +5757,7 @@ const tv = /* @__PURE__ */ _e(() => {
5757
5757
  }), nv = /* @__PURE__ */ _e(
5758
5758
  ([e, t]) => ({ ...e, ...t }),
5759
5759
  We(wu, tv)
5760
- ), rv = ({ height: e }) => /* @__PURE__ */ l.jsx("div", { style: { height: e } }), ov = { overflowAnchor: "none", position: ra(), zIndex: 1 }, Eu = { overflowAnchor: "none" }, sv = { ...Eu, display: "inline-block", height: "100%" }, Al = /* @__PURE__ */ q.memo(function({ showTopList: e = !1 }) {
5760
+ ), rv = ({ height: e }) => /* @__PURE__ */ l.jsx("div", { style: { height: e } }), ov = { overflowAnchor: "none", position: ra(), zIndex: 1 }, Eu = { overflowAnchor: "none" }, sv = { ...Eu, display: "inline-block", height: "100%" }, Al = /* @__PURE__ */ X.memo(function({ showTopList: e = !1 }) {
5761
5761
  const t = ye("listState"), n = kt("sizeRanges"), r = ye("useWindowScroll"), o = ye("customScrollParent"), s = kt("windowScrollContainerState"), i = kt("scrollContainerState"), a = o || r ? s : i, c = ye("itemContent"), u = ye("context"), d = ye("groupContent"), h = ye("trackItemSizes"), m = ye("itemSize"), x = ye("log"), w = kt("gap"), g = ye("horizontalDirection"), { callbackRef: p } = wx(
5762
5762
  n,
5763
5763
  m,
@@ -5768,21 +5768,21 @@ const tv = /* @__PURE__ */ _e(() => {
5768
5768
  o,
5769
5769
  g,
5770
5770
  ye("skipAnimationFrameInResizeObserver")
5771
- ), [v, b] = q.useState(0);
5771
+ ), [v, b] = X.useState(0);
5772
5772
  sa("deviation", (A) => {
5773
5773
  v !== A && b(A);
5774
5774
  });
5775
- const y = ye("EmptyPlaceholder"), E = ye("ScrollSeekPlaceholder") || rv, S = ye("ListComponent"), T = ye("ItemComponent"), C = ye("GroupComponent"), I = ye("computeItemKey"), N = ye("isSeeking"), j = ye("groupIndices").length > 0, F = ye("alignToBottom"), O = ye("initialItemFinalLocationReached"), L = e ? {} : {
5775
+ const y = ye("EmptyPlaceholder"), E = ye("ScrollSeekPlaceholder") || rv, S = ye("ListComponent"), T = ye("ItemComponent"), C = ye("GroupComponent"), I = ye("computeItemKey"), N = ye("isSeeking"), j = ye("groupIndices").length > 0, L = ye("alignToBottom"), O = ye("initialItemFinalLocationReached"), F = e ? {} : {
5776
5776
  boxSizing: "border-box",
5777
5777
  ...g ? {
5778
5778
  display: "inline-block",
5779
5779
  height: "100%",
5780
- marginLeft: v !== 0 ? v : F ? "auto" : 0,
5780
+ marginLeft: v !== 0 ? v : L ? "auto" : 0,
5781
5781
  paddingLeft: t.offsetTop,
5782
5782
  paddingRight: t.offsetBottom,
5783
5783
  whiteSpace: "nowrap"
5784
5784
  } : {
5785
- marginTop: v !== 0 ? v : F ? "auto" : 0,
5785
+ marginTop: v !== 0 ? v : L ? "auto" : 0,
5786
5786
  paddingBottom: t.offsetBottom,
5787
5787
  paddingTop: t.offsetTop
5788
5788
  },
@@ -5794,9 +5794,9 @@ const tv = /* @__PURE__ */ _e(() => {
5794
5794
  ...at(S, u),
5795
5795
  "data-testid": e ? "virtuoso-top-item-list" : "virtuoso-item-list",
5796
5796
  ref: p,
5797
- style: L,
5797
+ style: F,
5798
5798
  children: (e ? t.topItems : t.items).map((A) => {
5799
- const X = A.originalIndex, W = I(X + t.firstItemIndex, A.data, u);
5799
+ const q = A.originalIndex, W = I(q + t.firstItemIndex, A.data, u);
5800
5800
  return N ? /* @__PURE__ */ ho(
5801
5801
  E,
5802
5802
  {
@@ -5811,7 +5811,7 @@ const tv = /* @__PURE__ */ _e(() => {
5811
5811
  C,
5812
5812
  {
5813
5813
  ...at(C, u),
5814
- "data-index": X,
5814
+ "data-index": q,
5815
5815
  "data-item-index": A.index,
5816
5816
  "data-known-size": A.size,
5817
5817
  key: W,
@@ -5823,7 +5823,7 @@ const tv = /* @__PURE__ */ _e(() => {
5823
5823
  {
5824
5824
  ...at(T, u),
5825
5825
  ...cv(T, A.data),
5826
- "data-index": X,
5826
+ "data-index": q,
5827
5827
  "data-item-group-index": A.groupIndex,
5828
5828
  "data-item-index": A.index,
5829
5829
  "data-known-size": A.size,
@@ -5864,9 +5864,9 @@ function at(e, t) {
5864
5864
  function cv(e, t) {
5865
5865
  return { item: typeof e == "string" ? void 0 : t };
5866
5866
  }
5867
- const uv = /* @__PURE__ */ q.memo(function() {
5867
+ const uv = /* @__PURE__ */ X.memo(function() {
5868
5868
  const e = ye("HeaderComponent"), t = kt("headerHeight"), n = ye("HeaderFooterTag"), r = Fn(
5869
- q.useMemo(
5869
+ X.useMemo(
5870
5870
  () => (s) => {
5871
5871
  t(xn(s, "height"));
5872
5872
  },
@@ -5876,9 +5876,9 @@ const uv = /* @__PURE__ */ q.memo(function() {
5876
5876
  ye("skipAnimationFrameInResizeObserver")
5877
5877
  ), o = ye("context");
5878
5878
  return e ? /* @__PURE__ */ l.jsx(n, { ref: r, children: /* @__PURE__ */ l.jsx(e, { ...at(e, o) }) }) : null;
5879
- }), dv = /* @__PURE__ */ q.memo(function() {
5879
+ }), dv = /* @__PURE__ */ X.memo(function() {
5880
5880
  const e = ye("FooterComponent"), t = kt("footerHeight"), n = ye("HeaderFooterTag"), r = Fn(
5881
- q.useMemo(
5881
+ X.useMemo(
5882
5882
  () => (s) => {
5883
5883
  t(xn(s, "height"));
5884
5884
  },
@@ -5890,7 +5890,7 @@ const uv = /* @__PURE__ */ q.memo(function() {
5890
5890
  return e ? /* @__PURE__ */ l.jsx(n, { ref: r, children: /* @__PURE__ */ l.jsx(e, { ...at(e, o) }) }) : null;
5891
5891
  });
5892
5892
  function Iu({ useEmitter: e, useEmitterValue: t, usePublisher: n }) {
5893
- return q.memo(function({ children: r, style: o, context: s, ...i }) {
5893
+ return X.memo(function({ children: r, style: o, context: s, ...i }) {
5894
5894
  const a = n("scrollContainerState"), c = t("ScrollerComponent"), u = n("smoothScrollTargetReached"), d = t("scrollerRef"), h = t("horizontalDirection") || !1, { scrollByCallback: m, scrollerRef: x, scrollToCallback: w } = Ru(
5895
5895
  a,
5896
5896
  u,
@@ -5915,8 +5915,8 @@ function Iu({ useEmitter: e, useEmitterValue: t, usePublisher: n }) {
5915
5915
  });
5916
5916
  }
5917
5917
  function Nu({ useEmitter: e, useEmitterValue: t, usePublisher: n }) {
5918
- return q.memo(function({ children: r, style: o, context: s, ...i }) {
5919
- const a = n("windowScrollContainerState"), c = t("ScrollerComponent"), u = n("smoothScrollTargetReached"), d = t("totalListHeight"), h = t("deviation"), m = t("customScrollParent"), x = q.useRef(null), w = t("scrollerRef"), { scrollByCallback: g, scrollerRef: p, scrollToCallback: v } = Ru(
5918
+ return X.memo(function({ children: r, style: o, context: s, ...i }) {
5919
+ const a = n("windowScrollContainerState"), c = t("ScrollerComponent"), u = n("smoothScrollTargetReached"), d = t("totalListHeight"), h = t("deviation"), m = t("customScrollParent"), x = X.useRef(null), w = t("scrollerRef"), { scrollByCallback: g, scrollerRef: p, scrollToCallback: v } = Ru(
5920
5920
  a,
5921
5921
  u,
5922
5922
  c,
@@ -5942,26 +5942,26 @@ function Nu({ useEmitter: e, useEmitterValue: t, usePublisher: n }) {
5942
5942
  });
5943
5943
  }
5944
5944
  const fv = ({ children: e }) => {
5945
- const t = q.useContext(Su), n = kt("viewportHeight"), r = kt("fixedItemHeight"), o = ye("alignToBottom"), s = ye("horizontalDirection"), i = q.useMemo(
5945
+ const t = X.useContext(Su), n = kt("viewportHeight"), r = kt("fixedItemHeight"), o = ye("alignToBottom"), s = ye("horizontalDirection"), i = X.useMemo(
5946
5946
  () => Qc(n, (c) => xn(c, s ? "width" : "height")),
5947
5947
  [n, s]
5948
5948
  ), a = Fn(i, !0, ye("skipAnimationFrameInResizeObserver"));
5949
- return q.useEffect(() => {
5949
+ return X.useEffect(() => {
5950
5950
  t && (n(t.viewportHeight), r(t.itemHeight));
5951
5951
  }, [t, n, r]), /* @__PURE__ */ l.jsx("div", { "data-viewport-type": "element", ref: a, style: is(o), children: e });
5952
5952
  }, hv = ({ children: e }) => {
5953
- const t = q.useContext(Su), n = kt("windowViewportRect"), r = kt("fixedItemHeight"), o = ye("customScrollParent"), s = tu(
5953
+ const t = X.useContext(Su), n = kt("windowViewportRect"), r = kt("fixedItemHeight"), o = ye("customScrollParent"), s = tu(
5954
5954
  n,
5955
5955
  o,
5956
5956
  ye("skipAnimationFrameInResizeObserver")
5957
5957
  ), i = ye("alignToBottom");
5958
- return q.useEffect(() => {
5958
+ return X.useEffect(() => {
5959
5959
  t && (r(t.itemHeight), n({ offsetTop: 0, visibleHeight: t.viewportHeight, visibleWidth: 100 }));
5960
5960
  }, [t, n, r]), /* @__PURE__ */ l.jsx("div", { "data-viewport-type": "window", ref: s, style: is(i), children: e });
5961
5961
  }, pv = ({ children: e }) => {
5962
5962
  const t = ye("TopItemListComponent") || "div", n = ye("headerHeight"), r = { ...lv, marginTop: `${n}px` }, o = ye("context");
5963
5963
  return /* @__PURE__ */ l.jsx(t, { style: r, ...at(t, o), children: e });
5964
- }, mv = /* @__PURE__ */ q.memo(function(e) {
5964
+ }, mv = /* @__PURE__ */ X.memo(function(e) {
5965
5965
  const t = ye("useWindowScroll"), n = ye("topItemsIndexes").length > 0, r = ye("customScrollParent"), o = ye("context");
5966
5966
  return /* @__PURE__ */ l.jsxs(r || t ? vv : xv, { ...e, context: o, children: [
5967
5967
  n && /* @__PURE__ */ l.jsx(pv, { children: /* @__PURE__ */ l.jsx(Al, { showTopList: !0 }) }),
@@ -6115,7 +6115,7 @@ const Tv = /* @__PURE__ */ _e(
6115
6115
  { customScrollParent: p, useWindowScroll: v, windowScrollContainerState: b, windowScrollTo: y, windowViewportRect: E },
6116
6116
  S
6117
6117
  ]) => {
6118
- const T = Y(0), C = Y(0), I = Y(Pl), N = Y({ height: 0, width: 0 }), j = Y({ height: 0, width: 0 }), F = Ne(), O = Ne(), L = Y(0), A = Y(null), X = Y({ column: 0, row: 0 }), W = Ne(), oe = Ne(), _ = Y(!1), M = Y(0), V = Y(!0), U = Y(!1), Q = Y(!1);
6118
+ const T = Y(0), C = Y(0), I = Y(Pl), N = Y({ height: 0, width: 0 }), j = Y({ height: 0, width: 0 }), L = Ne(), O = Ne(), F = Y(0), A = Y(null), q = Y({ column: 0, row: 0 }), W = Ne(), oe = Ne(), _ = Y(!1), M = Y(0), V = Y(!0), U = Y(!1), Q = Y(!1);
6119
6119
  De(
6120
6120
  $(
6121
6121
  w,
@@ -6132,7 +6132,7 @@ const Tv = /* @__PURE__ */ _e(
6132
6132
  ),
6133
6133
  ([, , , , P]) => {
6134
6134
  Ce(U, !0), Qi(1, () => {
6135
- Ce(F, P);
6135
+ Ce(L, P);
6136
6136
  }), Lt($(u), () => {
6137
6137
  Ce(t, [0, 0]), Ce(V, !0);
6138
6138
  });
@@ -6151,7 +6151,7 @@ const Tv = /* @__PURE__ */ _e(
6151
6151
  xe(([, P]) => P != null)
6152
6152
  ),
6153
6153
  ([, P]) => {
6154
- P && (Ce(N, P.viewport), Ce(j, P.item), Ce(X, P.gap), P.scrollTop > 0 && (Ce(_, !0), Lt($(u, _n(1)), (K) => {
6154
+ P && (Ce(N, P.viewport), Ce(j, P.item), Ce(q, P.gap), P.scrollTop > 0 && (Ce(_, !0), Lt($(u, _n(1)), (K) => {
6155
6155
  Ce(_, !1);
6156
6156
  }), Ce(c, { top: P.scrollTop })));
6157
6157
  }
@@ -6166,7 +6166,7 @@ const Tv = /* @__PURE__ */ _e(
6166
6166
  et(
6167
6167
  me(N, oo),
6168
6168
  me(j, oo),
6169
- me(X, (P, K) => P && P.column === K.column && P.row === K.row),
6169
+ me(q, (P, K) => P && P.column === K.column && P.row === K.row),
6170
6170
  me(u)
6171
6171
  ),
6172
6172
  re(([P, K, ee, le]) => ({
@@ -6182,7 +6182,7 @@ const Tv = /* @__PURE__ */ _e(
6182
6182
  et(
6183
6183
  me(T),
6184
6184
  r,
6185
- me(X, Cv),
6185
+ me(q, Cv),
6186
6186
  me(j, oo),
6187
6187
  me(N, oo),
6188
6188
  me(A),
@@ -6230,7 +6230,7 @@ const Tv = /* @__PURE__ */ _e(
6230
6230
  T
6231
6231
  ), fe(
6232
6232
  $(
6233
- et(N, j, I, X),
6233
+ et(N, j, I, q),
6234
6234
  xe(([P, K, { items: ee }]) => ee.length > 0 && K.height !== 0 && P.height !== 0),
6235
6235
  re(([P, K, { items: ee }, le]) => {
6236
6236
  const { bottom: se, top: Te } = Dl(P, le, K, ee);
@@ -6283,8 +6283,8 @@ const Tv = /* @__PURE__ */ _e(
6283
6283
  );
6284
6284
  fe(ge, x.scrollSeekRangeChanged), fe(
6285
6285
  $(
6286
- F,
6287
- Re(N, j, T, X),
6286
+ L,
6287
+ Re(N, j, T, q),
6288
6288
  re(([P, K, ee, le, se]) => {
6289
6289
  const Te = fu(P), { align: Pe, behavior: je, offset: ce } = Te;
6290
6290
  let pe = Te.index;
@@ -6312,9 +6312,9 @@ const Tv = /* @__PURE__ */ _e(
6312
6312
  customScrollParent: p,
6313
6313
  // input
6314
6314
  data: A,
6315
- deviation: L,
6315
+ deviation: F,
6316
6316
  footerHeight: o,
6317
- gap: X,
6317
+ gap: q,
6318
6318
  headerHeight: s,
6319
6319
  increaseViewportBy: e,
6320
6320
  initialItemCount: C,
@@ -6325,7 +6325,7 @@ const Tv = /* @__PURE__ */ _e(
6325
6325
  scrollContainerState: a,
6326
6326
  scrollHeight: O,
6327
6327
  scrollTo: c,
6328
- scrollToIndex: F,
6328
+ scrollToIndex: L,
6329
6329
  scrollTop: u,
6330
6330
  smoothScrollTargetReached: d,
6331
6331
  totalCount: T,
@@ -6396,9 +6396,9 @@ const Rv = /* @__PURE__ */ _e(() => {
6396
6396
  }), Ev = /* @__PURE__ */ _e(
6397
6397
  ([e, t]) => ({ ...e, ...t }),
6398
6398
  We(Tv, Rv)
6399
- ), Iv = /* @__PURE__ */ q.memo(function() {
6399
+ ), Iv = /* @__PURE__ */ X.memo(function() {
6400
6400
  const e = Ge("gridState"), t = Ge("listClassName"), n = Ge("itemClassName"), r = Ge("itemContent"), o = Ge("computeItemKey"), s = Ge("isSeeking"), i = At("scrollHeight"), a = Ge("ItemComponent"), c = Ge("ListComponent"), u = Ge("ScrollSeekPlaceholder"), d = Ge("context"), h = At("itemDimensions"), m = At("gap"), x = Ge("log"), w = Ge("stateRestoreInProgress"), g = At("reportReadyState"), p = Fn(
6401
- q.useMemo(
6401
+ X.useMemo(
6402
6402
  () => (v) => {
6403
6403
  const b = v.parentElement.parentElement.scrollHeight;
6404
6404
  i(b);
@@ -6451,9 +6451,9 @@ const Rv = /* @__PURE__ */ _e(() => {
6451
6451
  })
6452
6452
  }
6453
6453
  );
6454
- }), Nv = q.memo(function() {
6454
+ }), Nv = X.memo(function() {
6455
6455
  const e = Ge("HeaderComponent"), t = At("headerHeight"), n = Ge("headerFooterTag"), r = Fn(
6456
- q.useMemo(
6456
+ X.useMemo(
6457
6457
  () => (s) => {
6458
6458
  t(xn(s, "height"));
6459
6459
  },
@@ -6463,9 +6463,9 @@ const Rv = /* @__PURE__ */ _e(() => {
6463
6463
  !1
6464
6464
  ), o = Ge("context");
6465
6465
  return e ? /* @__PURE__ */ l.jsx(n, { ref: r, children: /* @__PURE__ */ l.jsx(e, { ...at(e, o) }) }) : null;
6466
- }), jv = q.memo(function() {
6466
+ }), jv = X.memo(function() {
6467
6467
  const e = Ge("FooterComponent"), t = At("footerHeight"), n = Ge("headerFooterTag"), r = Fn(
6468
- q.useMemo(
6468
+ X.useMemo(
6469
6469
  () => (s) => {
6470
6470
  t(xn(s, "height"));
6471
6471
  },
@@ -6476,8 +6476,8 @@ const Rv = /* @__PURE__ */ _e(() => {
6476
6476
  ), o = Ge("context");
6477
6477
  return e ? /* @__PURE__ */ l.jsx(n, { ref: r, children: /* @__PURE__ */ l.jsx(e, { ...at(e, o) }) }) : null;
6478
6478
  }), kv = ({ children: e }) => {
6479
- const t = q.useContext(Cu), n = At("itemDimensions"), r = At("viewportDimensions"), o = Fn(
6480
- q.useMemo(
6479
+ const t = X.useContext(Cu), n = At("itemDimensions"), r = At("viewportDimensions"), o = Fn(
6480
+ X.useMemo(
6481
6481
  () => (s) => {
6482
6482
  r(s.getBoundingClientRect());
6483
6483
  },
@@ -6486,15 +6486,15 @@ const Rv = /* @__PURE__ */ _e(() => {
6486
6486
  !0,
6487
6487
  !1
6488
6488
  );
6489
- return q.useEffect(() => {
6489
+ return X.useEffect(() => {
6490
6490
  t && (r({ height: t.viewportHeight, width: t.viewportWidth }), n({ height: t.itemHeight, width: t.itemWidth }));
6491
6491
  }, [t, r, n]), /* @__PURE__ */ l.jsx("div", { ref: o, style: is(!1), children: e });
6492
6492
  }, Av = ({ children: e }) => {
6493
- const t = q.useContext(Cu), n = At("windowViewportRect"), r = At("itemDimensions"), o = Ge("customScrollParent"), s = tu(n, o, !1);
6494
- return q.useEffect(() => {
6493
+ const t = X.useContext(Cu), n = At("windowViewportRect"), r = At("itemDimensions"), o = Ge("customScrollParent"), s = tu(n, o, !1);
6494
+ return X.useEffect(() => {
6495
6495
  t && (r({ height: t.itemHeight, width: t.itemWidth }), n({ offsetTop: 0, visibleHeight: t.viewportHeight, visibleWidth: t.viewportWidth }));
6496
6496
  }, [t, n, r]), /* @__PURE__ */ l.jsx("div", { ref: s, style: is(!1), children: e });
6497
- }, Pv = /* @__PURE__ */ q.memo(function({ ...e }) {
6497
+ }, Pv = /* @__PURE__ */ X.memo(function({ ...e }) {
6498
6498
  const t = Ge("useWindowScroll"), n = Ge("customScrollParent"), r = n || t ? Ov : _v, o = n || t ? Av : kv, s = Ge("context");
6499
6499
  return /* @__PURE__ */ l.jsx(r, { ...e, ...at(r, s), children: /* @__PURE__ */ l.jsxs(o, { children: [
6500
6500
  /* @__PURE__ */ l.jsx(Nv, {}),
@@ -7163,8 +7163,8 @@ function Gs({
7163
7163
  }), h.current = [];
7164
7164
  };
7165
7165
  }, [i, c, r, a, s]);
7166
- const m = q.useRef(null);
7167
- return q.useEffect(() => {
7166
+ const m = X.useRef(null);
7167
+ return X.useEffect(() => {
7168
7168
  if (!c) return;
7169
7169
  const x = m.current;
7170
7170
  if (!x) return;
@@ -8564,7 +8564,7 @@ function Nw({ className: e }) {
8564
8564
  }
8565
8565
  );
8566
8566
  }
8567
- const jw = q.memo(function({
8567
+ const jw = X.memo(function({
8568
8568
  message: t,
8569
8569
  messageIndex: n,
8570
8570
  isStreamingMessage: r = !1,
@@ -8584,9 +8584,9 @@ const jw = q.memo(function({
8584
8584
  onCancelEdit: v,
8585
8585
  onCopy: b
8586
8586
  }) {
8587
- const [y, E] = de(!1), [S, T] = de(!1), [C, I] = de(!1), [N, j] = de(!1), { currentThreadId: F } = Ki();
8587
+ const [y, E] = de(!1), [S, T] = de(!1), [C, I] = de(!1), [N, j] = de(!1), { currentThreadId: L } = Ki();
8588
8588
  da();
8589
- const [O, L] = de({}), [A, X] = de(!1), [W, oe] = de(null), _ = u === "phone" || u === "half-screen", M = t.role, V = M === "tool", U = q.useMemo(() => {
8589
+ const [O, F] = de({}), [A, q] = de(!1), [W, oe] = de(null), _ = u === "phone" || u === "half-screen", M = t.role, V = M === "tool", U = X.useMemo(() => {
8590
8590
  switch (M) {
8591
8591
  case "user":
8592
8592
  return "text-[hsl(var(--chat-bubble-user-text))]";
@@ -8963,7 +8963,7 @@ const jw = q.memo(function({
8963
8963
  {
8964
8964
  isOpen: A,
8965
8965
  onClose: () => {
8966
- X(!1), oe(null);
8966
+ q(!1), oe(null);
8967
8967
  },
8968
8968
  fileId: W.id,
8969
8969
  fileName: W.name,
@@ -9233,26 +9233,15 @@ function Hw({
9233
9233
  T.current = e.length;
9234
9234
  return;
9235
9235
  }
9236
- if (e.length > O) {
9237
- const L = e[e.length - 1];
9238
- (L == null ? void 0 : L.role) === "user" && w && !E ? y("follow-user-message") : t && w && !E && y("follow-stream");
9239
- } else e.length < O && y("maintain-position");
9240
- T.current = e.length;
9236
+ e.length > O ? (e[e.length - 1], t && w && !E && y("follow-stream")) : e.length < O && y("maintain-position"), T.current = e.length;
9241
9237
  }, [e.length, t, w, g, E]), ze(() => {
9242
9238
  if (b === "none" || !p.current) return;
9243
9239
  requestAnimationFrame(() => {
9244
- var L, A;
9240
+ var F;
9245
9241
  try {
9246
9242
  switch (b) {
9247
- case "follow-user-message":
9248
- (L = p.current) == null || L.scrollToIndex({
9249
- index: Math.max(0, e.length - 1),
9250
- behavior: "auto",
9251
- align: "end"
9252
- });
9253
- break;
9254
9243
  case "follow-stream":
9255
- (A = p.current) == null || A.scrollToIndex({
9244
+ (F = p.current) == null || F.scrollToIndex({
9256
9245
  index: Math.max(0, e.length - 1),
9257
9246
  behavior: "smooth",
9258
9247
  align: "end"
@@ -9261,8 +9250,8 @@ function Hw({
9261
9250
  case "maintain-position":
9262
9251
  break;
9263
9252
  }
9264
- } catch (X) {
9265
- console.warn("Scroll execution failed:", X);
9253
+ } catch (A) {
9254
+ console.warn("Scroll execution failed:", A);
9266
9255
  }
9267
9256
  });
9268
9257
  }, [b, e.length]);
@@ -9271,7 +9260,7 @@ function Hw({
9271
9260
  }, [b]);
9272
9261
  ze(() => {
9273
9262
  if (e.length === 0 || v.current || g) return;
9274
- const L = setTimeout(() => {
9263
+ const F = setTimeout(() => {
9275
9264
  var A;
9276
9265
  if (!E && !t && e.length > 0)
9277
9266
  try {
@@ -9283,7 +9272,7 @@ function Hw({
9283
9272
  } catch {
9284
9273
  }
9285
9274
  }, 150);
9286
- return () => clearTimeout(L);
9275
+ return () => clearTimeout(F);
9287
9276
  }, [e.length, t, E, g]);
9288
9277
  const I = mn(() => {
9289
9278
  if (a)
@@ -9297,7 +9286,7 @@ function Hw({
9297
9286
  }
9298
9287
  }
9299
9288
  };
9300
- }, [a]), j = t && w && !E && !g ? "smooth" : !1, F = {
9289
+ }, [a]), j = t && w && !E && !g ? "smooth" : !1, L = {
9301
9290
  // Prevent scroll anchoring issues
9302
9291
  overflowAnchor: "none",
9303
9292
  // Optimize for scroll performance
@@ -9323,55 +9312,57 @@ function Hw({
9323
9312
  },
9324
9313
  atBottomStateChange: C,
9325
9314
  style: { height: "100%", overscrollBehavior: "contain" },
9326
- computeItemKey: (O, L) => L.id ?? `message-${O}`,
9315
+ computeItemKey: (O, F) => F.id ?? `message-${O}`,
9327
9316
  components: {
9328
- Scroller: q.forwardRef((O, L) => /* @__PURE__ */ l.jsx(
9317
+ Scroller: X.forwardRef((O, F) => /* @__PURE__ */ l.jsx(
9329
9318
  "div",
9330
9319
  {
9331
9320
  ...O,
9332
- ref: L,
9321
+ ref: F,
9333
9322
  style: {
9334
- ...F,
9323
+ ...L,
9335
9324
  ...(O == null ? void 0 : O.style) ?? {}
9336
9325
  }
9337
9326
  }
9338
9327
  ))
9339
9328
  },
9340
- itemContent: (O, L) => /* @__PURE__ */ l.jsx(
9341
- "div",
9342
- {
9343
- className: "mb-4 last:mb-0",
9344
- style: {
9345
- contentVisibility: "auto",
9346
- // If this message is the currently streaming assistant message, reserve a min-height
9347
- // so the container doesn't reflow excessively as HTML is progressively rendered.
9348
- minHeight: t && n === L.id ? 120 : void 0,
9349
- containIntrinsicSize: t && n === L.id ? "auto 120px" : "auto 150px",
9350
- transform: "translateZ(0)",
9351
- isolation: "isolate"
9352
- },
9353
- children: /* @__PURE__ */ l.jsx(
9354
- jw,
9355
- {
9356
- message: L,
9357
- messageIndex: O,
9358
- isStreamingMessage: t && n === L.id,
9359
- streamingDebounceMs: r,
9360
- isEditing: i === L.id,
9361
- showActions: s,
9362
- showTimestamp: !1,
9363
- showAgentName: !0,
9364
- layoutSize: o,
9365
- truncateToolMessages: !1,
9366
- toolMessagePreviewLength: 200,
9367
- onEdit: c,
9368
- onRegenerate: () => u(O),
9369
- onCancelEdit: d
9329
+ itemContent: (O, F) => {
9330
+ const A = F.role === "user" && O === e.length - 1, q = t && n === F.id || A && t;
9331
+ return /* @__PURE__ */ l.jsx(
9332
+ "div",
9333
+ {
9334
+ className: "mb-4 last:mb-0",
9335
+ style: {
9336
+ contentVisibility: "auto",
9337
+ // Reserve space to prevent layout shifts during streaming
9338
+ minHeight: q ? 120 : void 0,
9339
+ containIntrinsicSize: q ? "auto 120px" : "auto 150px",
9340
+ transform: "translateZ(0)",
9341
+ isolation: "isolate"
9370
9342
  },
9371
- L.id ?? `msg-${L.role}-${O}-${L.createdAt ?? ""}`
9372
- )
9373
- }
9374
- )
9343
+ children: /* @__PURE__ */ l.jsx(
9344
+ jw,
9345
+ {
9346
+ message: F,
9347
+ messageIndex: O,
9348
+ isStreamingMessage: t && n === F.id,
9349
+ streamingDebounceMs: r,
9350
+ isEditing: i === F.id,
9351
+ showActions: s,
9352
+ showTimestamp: !1,
9353
+ showAgentName: !0,
9354
+ layoutSize: o,
9355
+ truncateToolMessages: !1,
9356
+ toolMessagePreviewLength: 200,
9357
+ onEdit: c,
9358
+ onRegenerate: () => u(O),
9359
+ onCancelEdit: d
9360
+ },
9361
+ F.id ?? `msg-${F.role}-${O}-${F.createdAt ?? ""}`
9362
+ )
9363
+ }
9364
+ );
9365
+ }
9375
9366
  }
9376
9367
  ) });
9377
9368
  }
@@ -9419,27 +9410,27 @@ function xa(e) {
9419
9410
  t,
9420
9411
  { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
9421
9412
  ), i = (g) => {
9422
- const { scope: p, children: v } = g, b = q.useRef(null), y = q.useRef(/* @__PURE__ */ new Map()).current;
9413
+ const { scope: p, children: v } = g, b = X.useRef(null), y = X.useRef(/* @__PURE__ */ new Map()).current;
9423
9414
  return /* @__PURE__ */ l.jsx(o, { scope: p, itemMap: y, collectionRef: b, children: v });
9424
9415
  };
9425
9416
  i.displayName = t;
9426
- const a = e + "CollectionSlot", c = tr(a), u = q.forwardRef(
9417
+ const a = e + "CollectionSlot", c = tr(a), u = X.forwardRef(
9427
9418
  (g, p) => {
9428
9419
  const { scope: v, children: b } = g, y = s(a, v), E = Ee(p, y.collectionRef);
9429
9420
  return /* @__PURE__ */ l.jsx(c, { ref: E, children: b });
9430
9421
  }
9431
9422
  );
9432
9423
  u.displayName = a;
9433
- const d = e + "CollectionItemSlot", h = "data-radix-collection-item", m = tr(d), x = q.forwardRef(
9424
+ const d = e + "CollectionItemSlot", h = "data-radix-collection-item", m = tr(d), x = X.forwardRef(
9434
9425
  (g, p) => {
9435
- const { scope: v, children: b, ...y } = g, E = q.useRef(null), S = Ee(p, E), T = s(d, v);
9436
- return q.useEffect(() => (T.itemMap.set(E, { ref: E, ...y }), () => void T.itemMap.delete(E))), /* @__PURE__ */ l.jsx(m, { [h]: "", ref: S, children: b });
9426
+ const { scope: v, children: b, ...y } = g, E = X.useRef(null), S = Ee(p, E), T = s(d, v);
9427
+ return X.useEffect(() => (T.itemMap.set(E, { ref: E, ...y }), () => void T.itemMap.delete(E))), /* @__PURE__ */ l.jsx(m, { [h]: "", ref: S, children: b });
9437
9428
  }
9438
9429
  );
9439
9430
  x.displayName = d;
9440
9431
  function w(g) {
9441
9432
  const p = s(e + "CollectionConsumer", g);
9442
- return q.useCallback(() => {
9433
+ return X.useCallback(() => {
9443
9434
  const b = p.collectionRef.current;
9444
9435
  if (!b) return [];
9445
9436
  const y = Array.from(b.querySelectorAll(`[${h}]`));
@@ -9743,12 +9734,12 @@ const oy = (e) => ({
9743
9734
  }, x = wa(o), w = ba(x), g = await i.getDimensions(u), p = x === "y", v = p ? "top" : "left", b = p ? "bottom" : "right", y = p ? "clientHeight" : "clientWidth", E = s.reference[w] + s.reference[x] - m[x] - s.floating[w], S = m[x] - s.reference[x], T = await (i.getOffsetParent == null ? void 0 : i.getOffsetParent(u));
9744
9735
  let C = T ? T[y] : 0;
9745
9736
  (!C || !await (i.isElement == null ? void 0 : i.isElement(T))) && (C = a.floating[y] || s.floating[w]);
9746
- const I = E / 2 - S / 2, N = C / 2 - g[w] / 2 - 1, j = bn(h[v], N), F = bn(h[b], N), O = j, L = C - g[w] - F, A = C / 2 - g[w] / 2 + I, X = Ei(O, A, L), W = !c.arrow && dr(o) != null && A !== X && s.reference[w] / 2 - (A < O ? j : F) - g[w] / 2 < 0, oe = W ? A < O ? A - O : A - L : 0;
9737
+ const I = E / 2 - S / 2, N = C / 2 - g[w] / 2 - 1, j = bn(h[v], N), L = bn(h[b], N), O = j, F = C - g[w] - L, A = C / 2 - g[w] / 2 + I, q = Ei(O, A, F), W = !c.arrow && dr(o) != null && A !== q && s.reference[w] / 2 - (A < O ? j : L) - g[w] / 2 < 0, oe = W ? A < O ? A - O : A - F : 0;
9747
9738
  return {
9748
9739
  [x]: m[x] + oe,
9749
9740
  data: {
9750
- [x]: X,
9751
- centerOffset: A - X - oe,
9741
+ [x]: q,
9742
+ centerOffset: A - q - oe,
9752
9743
  ...W && {
9753
9744
  alignmentOffset: oe
9754
9745
  }
@@ -9792,9 +9783,9 @@ const oy = (e) => ({
9792
9783
  placement: o,
9793
9784
  overflows: N
9794
9785
  }], !N.every((A) => A <= 0)) {
9795
- var F, O;
9796
- const A = (((F = s.flip) == null ? void 0 : F.index) || 0) + 1, X = C[A];
9797
- if (X && (!(h === "alignment" ? b !== Zt(X) : !1) || // We leave the current main axis only if every placement on that axis
9786
+ var L, O;
9787
+ const A = (((L = s.flip) == null ? void 0 : L.index) || 0) + 1, q = C[A];
9788
+ if (q && (!(h === "alignment" ? b !== Zt(q) : !1) || // We leave the current main axis only if every placement on that axis
9798
9789
  // overflows the main axis.
9799
9790
  j.every((_) => Zt(_.placement) === b ? _.overflows[0] > 0 : !0)))
9800
9791
  return {
@@ -9803,15 +9794,15 @@ const oy = (e) => ({
9803
9794
  overflows: j
9804
9795
  },
9805
9796
  reset: {
9806
- placement: X
9797
+ placement: q
9807
9798
  }
9808
9799
  };
9809
9800
  let W = (O = j.filter((oe) => oe.overflows[0] <= 0).sort((oe, _) => oe.overflows[1] - _.overflows[1])[0]) == null ? void 0 : O.placement;
9810
9801
  if (!W)
9811
9802
  switch (x) {
9812
9803
  case "bestFit": {
9813
- var L;
9814
- const oe = (L = j.filter((_) => {
9804
+ var F;
9805
+ const oe = (F = j.filter((_) => {
9815
9806
  if (T) {
9816
9807
  const M = Zt(_.placement);
9817
9808
  return M === b || // Create a bias to the `y` side axis due to horizontal
@@ -9819,7 +9810,7 @@ const oy = (e) => ({
9819
9810
  M === "y";
9820
9811
  }
9821
9812
  return !0;
9822
- }).map((_) => [_.placement, _.overflows.filter((M) => M > 0).reduce((M, V) => M + V, 0)]).sort((_, M) => _[1] - M[1])[0]) == null ? void 0 : L[0];
9813
+ }).map((_) => [_.placement, _.overflows.filter((M) => M > 0).reduce((M, V) => M + V, 0)]).sort((_, M) => _[1] - M[1])[0]) == null ? void 0 : F[0];
9823
9814
  oe && (W = oe);
9824
9815
  break;
9825
9816
  }
@@ -10062,8 +10053,8 @@ const ly = function(e) {
10062
10053
  const b = g - d.top - d.bottom, y = w - d.left - d.right, E = bn(g - d[p], b), S = bn(w - d[v], y), T = !t.middlewareData.shift;
10063
10054
  let C = E, I = S;
10064
10055
  if ((n = t.middlewareData.shift) != null && n.enabled.x && (I = y), (r = t.middlewareData.shift) != null && r.enabled.y && (C = b), T && !m) {
10065
- const j = St(d.left, 0), F = St(d.right, 0), O = St(d.top, 0), L = St(d.bottom, 0);
10066
- x ? I = w - 2 * (j !== 0 || F !== 0 ? j + F : St(d.left, d.right)) : C = g - 2 * (O !== 0 || L !== 0 ? O + L : St(d.top, d.bottom));
10056
+ const j = St(d.left, 0), L = St(d.right, 0), O = St(d.top, 0), F = St(d.bottom, 0);
10057
+ x ? I = w - 2 * (j !== 0 || L !== 0 ? j + L : St(d.left, d.right)) : C = g - 2 * (O !== 0 || F !== 0 ? O + F : St(d.top, d.bottom));
10067
10058
  }
10068
10059
  await c({
10069
10060
  ...t,
@@ -10651,7 +10642,7 @@ function Ky(e) {
10651
10642
  _ !== T.current && (T.current = _, g(_));
10652
10643
  }, []), y = f.useCallback((_) => {
10653
10644
  _ !== C.current && (C.current = _, v(_));
10654
- }, []), E = s || w, S = i || p, T = f.useRef(null), C = f.useRef(null), I = f.useRef(d), N = c != null, j = oi(c), F = oi(o), O = oi(u), L = f.useCallback(() => {
10645
+ }, []), E = s || w, S = i || p, T = f.useRef(null), C = f.useRef(null), I = f.useRef(d), N = c != null, j = oi(c), L = oi(o), O = oi(u), F = f.useCallback(() => {
10655
10646
  if (!T.current || !C.current)
10656
10647
  return;
10657
10648
  const _ = {
@@ -10659,7 +10650,7 @@ function Ky(e) {
10659
10650
  strategy: n,
10660
10651
  middleware: m
10661
10652
  };
10662
- F.current && (_.platform = F.current), Wy(T.current, C.current, _).then((M) => {
10653
+ L.current && (_.platform = L.current), Wy(T.current, C.current, _).then((M) => {
10663
10654
  const V = {
10664
10655
  ...M,
10665
10656
  // The floating element's position may be recomputed while it's closed
@@ -10672,7 +10663,7 @@ function Ky(e) {
10672
10663
  h(V);
10673
10664
  }));
10674
10665
  });
10675
- }, [m, t, n, F, O]);
10666
+ }, [m, t, n, L, O]);
10676
10667
  Io(() => {
10677
10668
  u === !1 && I.current.isPositioned && (I.current.isPositioned = !1, h((_) => ({
10678
10669
  ..._,
@@ -10685,11 +10676,11 @@ function Ky(e) {
10685
10676
  }), []), Io(() => {
10686
10677
  if (E && (T.current = E), S && (C.current = S), E && S) {
10687
10678
  if (j.current)
10688
- return j.current(E, S, L);
10689
- L();
10679
+ return j.current(E, S, F);
10680
+ F();
10690
10681
  }
10691
- }, [E, S, L, j, N]);
10692
- const X = f.useMemo(() => ({
10682
+ }, [E, S, F, j, N]);
10683
+ const q = f.useMemo(() => ({
10693
10684
  reference: T,
10694
10685
  floating: C,
10695
10686
  setReference: b,
@@ -10720,11 +10711,11 @@ function Ky(e) {
10720
10711
  }, [n, a, W.floating, d.x, d.y]);
10721
10712
  return f.useMemo(() => ({
10722
10713
  ...d,
10723
- update: L,
10724
- refs: X,
10714
+ update: F,
10715
+ refs: q,
10725
10716
  elements: W,
10726
10717
  floatingStyles: oe
10727
- }), [d, L, X, W, oe]);
10718
+ }), [d, F, q, W, oe]);
10728
10719
  }
10729
10720
  const Yy = (e) => {
10730
10721
  function t(n) {
@@ -10841,12 +10832,12 @@ var Ra = "PopperContent", [s0, i0] = Od(Ra), Bd = f.forwardRef(
10841
10832
  updatePositionStrategy: x = "optimized",
10842
10833
  onPlaced: w,
10843
10834
  ...g
10844
- } = e, p = Md(Ra, n), [v, b] = f.useState(null), y = Ee(t, (Te) => b(Te)), [E, S] = f.useState(null), T = _d(E), C = (T == null ? void 0 : T.width) ?? 0, I = (T == null ? void 0 : T.height) ?? 0, N = r + (s !== "center" ? "-" + s : ""), j = typeof d == "number" ? d : { top: 0, right: 0, bottom: 0, left: 0, ...d }, F = Array.isArray(u) ? u : [u], O = F.length > 0, L = {
10835
+ } = e, p = Md(Ra, n), [v, b] = f.useState(null), y = Ee(t, (Te) => b(Te)), [E, S] = f.useState(null), T = _d(E), C = (T == null ? void 0 : T.width) ?? 0, I = (T == null ? void 0 : T.height) ?? 0, N = r + (s !== "center" ? "-" + s : ""), j = typeof d == "number" ? d : { top: 0, right: 0, bottom: 0, left: 0, ...d }, L = Array.isArray(u) ? u : [u], O = L.length > 0, F = {
10845
10836
  padding: j,
10846
- boundary: F.filter(l0),
10837
+ boundary: L.filter(l0),
10847
10838
  // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
10848
10839
  altBoundary: O
10849
- }, { refs: A, floatingStyles: X, placement: W, isPositioned: oe, middlewareData: _ } = Ky({
10840
+ }, { refs: A, floatingStyles: q, placement: W, isPositioned: oe, middlewareData: _ } = Ky({
10850
10841
  // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
10851
10842
  strategy: "fixed",
10852
10843
  placement: N,
@@ -10862,11 +10853,11 @@ var Ra = "PopperContent", [s0, i0] = Od(Ra), Bd = f.forwardRef(
10862
10853
  mainAxis: !0,
10863
10854
  crossAxis: !1,
10864
10855
  limiter: h === "partial" ? Jy() : void 0,
10865
- ...L
10856
+ ...F
10866
10857
  }),
10867
- c && Zy({ ...L }),
10858
+ c && Zy({ ...F }),
10868
10859
  Qy({
10869
- ...L,
10860
+ ...F,
10870
10861
  apply: ({ elements: Te, rects: Pe, availableWidth: je, availableHeight: ce }) => {
10871
10862
  const { width: pe, height: he } = Pe.reference, we = Te.floating.style;
10872
10863
  we.setProperty("--radix-popper-available-width", `${je}px`), we.setProperty("--radix-popper-available-height", `${ce}px`), we.setProperty("--radix-popper-anchor-width", `${pe}px`), we.setProperty("--radix-popper-anchor-height", `${he}px`);
@@ -10874,7 +10865,7 @@ var Ra = "PopperContent", [s0, i0] = Od(Ra), Bd = f.forwardRef(
10874
10865
  }),
10875
10866
  E && t0({ element: E, padding: a }),
10876
10867
  c0({ arrowWidth: C, arrowHeight: I }),
10877
- m && e0({ strategy: "referenceHidden", ...L })
10868
+ m && e0({ strategy: "referenceHidden", ...F })
10878
10869
  ]
10879
10870
  }), [M, V] = zd(W), U = st(w);
10880
10871
  rt(() => {
@@ -10889,8 +10880,8 @@ var Ra = "PopperContent", [s0, i0] = Od(Ra), Bd = f.forwardRef(
10889
10880
  ref: A.setFloating,
10890
10881
  "data-radix-popper-content-wrapper": "",
10891
10882
  style: {
10892
- ...X,
10893
- transform: oe ? X.transform : "translate(0, -200%)",
10883
+ ...q,
10884
+ transform: oe ? q.transform : "translate(0, -200%)",
10894
10885
  // keep off the page when measuring
10895
10886
  minWidth: "max-content",
10896
10887
  zIndex: ae,
@@ -11072,10 +11063,10 @@ var m0 = f.forwardRef((e, t) => {
11072
11063
  if (I.target === I.currentTarget && N && !v) {
11073
11064
  const j = new CustomEvent(si, u0);
11074
11065
  if (I.currentTarget.dispatchEvent(j), !j.defaultPrevented) {
11075
- const F = E().filter((W) => W.focusable), O = F.find((W) => W.active), L = F.find((W) => W.id === g), X = [O, L, ...F].filter(
11066
+ const L = E().filter((W) => W.focusable), O = L.find((W) => W.active), F = L.find((W) => W.id === g), q = [O, F, ...L].filter(
11076
11067
  Boolean
11077
11068
  ).map((W) => W.ref.current);
11078
- Yd(X, d);
11069
+ Yd(q, d);
11079
11070
  }
11080
11071
  }
11081
11072
  S.current = !1;
@@ -11284,7 +11275,7 @@ var Pt = "MenuContent", [P0, Pa] = $n(Pt), tf = f.forwardRef(
11284
11275
  onDismiss: x,
11285
11276
  disableOutsideScroll: w,
11286
11277
  ...g
11287
- } = e, p = Hn(Pt, n), v = eo(Pt, n), b = Ss(n), y = Jd(n), E = E0(n), [S, T] = f.useState(null), C = f.useRef(null), I = Ee(t, C, p.onContentChange), N = f.useRef(0), j = f.useRef(""), F = f.useRef(0), O = f.useRef(null), L = f.useRef("right"), A = f.useRef(0), X = w ? fs : f.Fragment, W = w ? { as: M0, allowPinchZoom: !0 } : void 0, oe = (M) => {
11278
+ } = e, p = Hn(Pt, n), v = eo(Pt, n), b = Ss(n), y = Jd(n), E = E0(n), [S, T] = f.useState(null), C = f.useRef(null), I = Ee(t, C, p.onContentChange), N = f.useRef(0), j = f.useRef(""), L = f.useRef(0), O = f.useRef(null), F = f.useRef("right"), A = f.useRef(0), q = w ? fs : f.Fragment, W = w ? { as: M0, allowPinchZoom: !0 } : void 0, oe = (M) => {
11288
11279
  var H, P;
11289
11280
  const V = j.current + M, U = E().filter((K) => !K.disabled), Q = document.activeElement, B = (H = U.find((K) => K.ref.current === Q)) == null ? void 0 : H.textValue, J = U.map((K) => K.textValue), ae = K0(J, V, B), ge = (P = U.find((K) => K.textValue === ae)) == null ? void 0 : P.ref.current;
11290
11281
  (function K(ee) {
@@ -11294,7 +11285,7 @@ var Pt = "MenuContent", [P0, Pa] = $n(Pt), tf = f.forwardRef(
11294
11285
  f.useEffect(() => () => window.clearTimeout(N.current), []), fa();
11295
11286
  const _ = f.useCallback((M) => {
11296
11287
  var U, Q;
11297
- return L.current === ((U = O.current) == null ? void 0 : U.side) && q0(M, (Q = O.current) == null ? void 0 : Q.area);
11288
+ return F.current === ((U = O.current) == null ? void 0 : U.side) && q0(M, (Q = O.current) == null ? void 0 : Q.area);
11298
11289
  }, []);
11299
11290
  return /* @__PURE__ */ l.jsx(
11300
11291
  P0,
@@ -11320,11 +11311,11 @@ var Pt = "MenuContent", [P0, Pa] = $n(Pt), tf = f.forwardRef(
11320
11311
  },
11321
11312
  [_]
11322
11313
  ),
11323
- pointerGraceTimerRef: F,
11314
+ pointerGraceTimerRef: L,
11324
11315
  onPointerGraceIntentChange: f.useCallback((M) => {
11325
11316
  O.current = M;
11326
11317
  }, []),
11327
- children: /* @__PURE__ */ l.jsx(X, { ...W, children: /* @__PURE__ */ l.jsx(
11318
+ children: /* @__PURE__ */ l.jsx(q, { ...W, children: /* @__PURE__ */ l.jsx(
11328
11319
  cs,
11329
11320
  {
11330
11321
  asChild: !0,
@@ -11388,7 +11379,7 @@ var Pt = "MenuContent", [P0, Pa] = $n(Pt), tf = f.forwardRef(
11388
11379
  const V = M.target, U = A.current !== M.clientX;
11389
11380
  if (M.currentTarget.contains(V) && U) {
11390
11381
  const Q = M.clientX > A.current ? "right" : "left";
11391
- L.current = Q, A.current = M.clientX;
11382
+ F.current = Q, A.current = M.clientX;
11392
11383
  }
11393
11384
  })
11394
11385
  )
@@ -12058,10 +12049,10 @@ function No({
12058
12049
  navigateToCheckpoint: I,
12059
12050
  returnToLatest: N,
12060
12051
  hasMoreHistory: j,
12061
- isLoadingHistory: F,
12052
+ isLoadingHistory: L,
12062
12053
  loadOlderMessages: O,
12063
- api: L
12064
- } = Ki(), [A, X] = de(null), [W, oe] = de(""), [_, M] = de(null), [V, U] = de([]), [Q, B] = de(!1), [J, ae] = de(null), [ge, H] = de(null), [P, K] = de(!1), [ee, le] = de(null), [se, Te] = de([]), [Pe, je] = de(null), [ce, pe] = de(null), [he, we] = de(!1), qe = Ke(null), Et = Ke(null), vt = Ke(null), [Vt, G] = de("desktop");
12054
+ api: F
12055
+ } = Ki(), [A, q] = de(null), [W, oe] = de(""), [_, M] = de(null), [V, U] = de([]), [Q, B] = de(!1), [J, ae] = de(null), [ge, H] = de(null), [P, K] = de(!1), [ee, le] = de(null), [se, Te] = de([]), [Pe, je] = de(null), [ce, pe] = de(null), [he, we] = de(!1), qe = Ke(null), Et = Ke(null), vt = Ke(null), [Vt, G] = de("desktop");
12065
12056
  ze(() => {
12066
12057
  const ie = () => {
12067
12058
  const ue = window.innerWidth;
@@ -12101,23 +12092,23 @@ function No({
12101
12092
  S && (je(S), pe(T ?? null));
12102
12093
  }, [S, T]);
12103
12094
  const Z = $e(async () => {
12104
- if (!(!j || F))
12095
+ if (!(!j || L))
12105
12096
  try {
12106
12097
  await O();
12107
12098
  } catch (ie) {
12108
12099
  console.warn("loadOlderMessages failed", ie);
12109
12100
  }
12110
- }, [j, F, O]);
12101
+ }, [j, L, O]);
12111
12102
  ze(() => {
12112
12103
  (async () => {
12113
12104
  try {
12114
- const ue = await L.getAgent("default");
12105
+ const ue = await F.getAgent("default");
12115
12106
  le(ue.uiDefaultMessage || null);
12116
12107
  } catch (ue) {
12117
12108
  console.warn("Failed to fetch default message:", ue), le(null);
12118
12109
  }
12119
12110
  })();
12120
- }, [L]), ze(() => {
12111
+ }, [F]), ze(() => {
12121
12112
  b && !P && (x == null || x(b));
12122
12113
  }, [b, P, x]);
12123
12114
  const Le = (ie) => {
@@ -12152,16 +12143,16 @@ function No({
12152
12143
  checkpointNs: ce ?? T ?? void 0,
12153
12144
  payloadExtras: A ? { edit: !0, originalMessageId: A } : void 0,
12154
12145
  attachments: V
12155
- }), h == null || h(ue), M(null), U([]), X(null), oe("");
12146
+ }), h == null || h(ue), M(null), U([]), q(null), oe("");
12156
12147
  } catch (Ae) {
12157
12148
  const Ye = (Ae == null ? void 0 : Ae.message) || "Failed to send message";
12158
12149
  M(Ye), x == null || x(Ye);
12159
12150
  }
12160
12151
  }
12161
- }, ht = q.useCallback((ie, ue) => {
12162
- u && (X(ie), oe(ue), M(null));
12163
- }, [u]), ct = q.useCallback(() => {
12164
- X(null), oe(""), M(null);
12152
+ }, ht = X.useCallback((ie, ue) => {
12153
+ u && (q(ie), oe(ue), M(null));
12154
+ }, [u]), ct = X.useCallback(() => {
12155
+ q(null), oe(""), M(null);
12165
12156
  }, []), Gt = $e((ie, ue) => {
12166
12157
  ht(ie, ue);
12167
12158
  }, [ht]), nt = $e((ie) => {
@@ -12428,7 +12419,7 @@ var La = "ScrollArea", [Wf, pR] = Ut(La), [$S, Ot] = Wf(La), Vf = f.forwardRef(
12428
12419
  dir: o,
12429
12420
  scrollHideDelay: s = 600,
12430
12421
  ...i
12431
- } = e, [a, c] = f.useState(null), [u, d] = f.useState(null), [h, m] = f.useState(null), [x, w] = f.useState(null), [g, p] = f.useState(null), [v, b] = f.useState(0), [y, E] = f.useState(0), [S, T] = f.useState(!1), [C, I] = f.useState(!1), N = Ee(t, (F) => c(F)), j = xs(o);
12422
+ } = e, [a, c] = f.useState(null), [u, d] = f.useState(null), [h, m] = f.useState(null), [x, w] = f.useState(null), [g, p] = f.useState(null), [v, b] = f.useState(0), [y, E] = f.useState(0), [S, T] = f.useState(!1), [C, I] = f.useState(!1), N = Ee(t, (L) => c(L)), j = xs(o);
12432
12423
  return /* @__PURE__ */ l.jsx(
12433
12424
  $S,
12434
12425
  {
@@ -12753,14 +12744,14 @@ var HS = f.forwardRef((e, t) => {
12753
12744
  } = e, x = Ot(rn, n), [w, g] = f.useState(null), p = Ee(t, (N) => g(N)), v = f.useRef(null), b = f.useRef(""), y = x.viewport, E = r.content - r.viewport, S = st(d), T = st(c), C = Es(h, 10);
12754
12745
  function I(N) {
12755
12746
  if (v.current) {
12756
- const j = N.clientX - v.current.left, F = N.clientY - v.current.top;
12757
- u({ x: j, y: F });
12747
+ const j = N.clientX - v.current.left, L = N.clientY - v.current.top;
12748
+ u({ x: j, y: L });
12758
12749
  }
12759
12750
  }
12760
12751
  return f.useEffect(() => {
12761
12752
  const N = (j) => {
12762
- const F = j.target;
12763
- (w == null ? void 0 : w.contains(F)) && S(j, E);
12753
+ const L = j.target;
12754
+ (w == null ? void 0 : w.contains(L)) && S(j, E);
12764
12755
  };
12765
12756
  return document.addEventListener("wheel", N, { passive: !1 }), () => document.removeEventListener("wheel", N, { passive: !1 });
12766
12757
  }, [y, w, E, S]), f.useEffect(T, [r, T]), or(w, C), or(x.content, C), /* @__PURE__ */ l.jsx(
@@ -12979,7 +12970,7 @@ function _i({
12979
12970
  createThread: g,
12980
12971
  deleteThread: p,
12981
12972
  renameThread: v
12982
- } = Ki(), [b, y] = de(m ?? []), [E, S] = de(!1), [T, C] = de(null), [I, N] = de(null), [j, F] = de(""), [O, L] = de(!1);
12973
+ } = Ki(), [b, y] = de(m ?? []), [E, S] = de(!1), [T, C] = de(null), [I, N] = de(null), [j, L] = de(""), [O, F] = de(!1);
12983
12974
  ze(() => {
12984
12975
  y(m ?? []);
12985
12976
  }, [m]);
@@ -12989,15 +12980,15 @@ function _i({
12989
12980
  } catch (J) {
12990
12981
  console.error("Failed to select thread:", J);
12991
12982
  }
12992
- }, X = async () => {
12983
+ }, q = async () => {
12993
12984
  try {
12994
- L(!0);
12985
+ F(!0);
12995
12986
  const B = await g();
12996
12987
  u == null || u(B), a == null || a(B);
12997
12988
  } catch (B) {
12998
12989
  console.error("Failed to create thread:", B);
12999
12990
  } finally {
13000
- L(!1);
12991
+ F(!1);
13001
12992
  }
13002
12993
  }, W = async (B, J) => {
13003
12994
  if (J.stopPropagation(), !!confirm("Delete this thread?"))
@@ -13007,16 +12998,16 @@ function _i({
13007
12998
  console.error("Failed to delete thread:", ae);
13008
12999
  }
13009
13000
  }, oe = (B, J) => {
13010
- J.stopPropagation(), N(B.threadId), F(B.title || `Thread ${B.threadId.slice(0, 8)}`);
13001
+ J.stopPropagation(), N(B.threadId), L(B.title || `Thread ${B.threadId.slice(0, 8)}`);
13011
13002
  }, _ = async (B) => {
13012
13003
  if (j.trim())
13013
13004
  try {
13014
- await v(B, j.trim()), N(null), F("");
13005
+ await v(B, j.trim()), N(null), L("");
13015
13006
  } catch (J) {
13016
13007
  console.error("Failed to update title:", J);
13017
13008
  }
13018
13009
  }, M = () => {
13019
- N(null), F("");
13010
+ N(null), L("");
13020
13011
  }, V = (B, J) => {
13021
13012
  B.key === "Enter" ? _(J) : B.key === "Escape" && M();
13022
13013
  }, U = (B) => {
@@ -13032,7 +13023,7 @@ function _i({
13032
13023
  t && /* @__PURE__ */ l.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__ */ l.jsx(
13033
13024
  Oe,
13034
13025
  {
13035
- onClick: X,
13026
+ onClick: q,
13036
13027
  disabled: O || E,
13037
13028
  className: s.createButton || "p-2",
13038
13029
  size: "sm",
@@ -13057,7 +13048,7 @@ function _i({
13057
13048
  children: [
13058
13049
  /* @__PURE__ */ l.jsxs("div", { className: "flex items-center justify-between", children: [
13059
13050
  /* @__PURE__ */ l.jsx("div", { className: "flex-1 min-w-0", children: I === B.threadId ? /* @__PURE__ */ l.jsxs("div", { className: "flex items-center gap-2", onClick: (J) => J.stopPropagation(), children: [
13060
- /* @__PURE__ */ l.jsx($r, { value: j, onChange: (J) => F(J.target.value), onKeyDown: (J) => V(J, B.threadId), className: "h-6 text-sm", autoFocus: !0 }),
13051
+ /* @__PURE__ */ l.jsx($r, { value: j, onChange: (J) => L(J.target.value), onKeyDown: (J) => V(J, B.threadId), className: "h-6 text-sm", autoFocus: !0 }),
13061
13052
  /* @__PURE__ */ l.jsx(Oe, { variant: "ghost", size: "sm", onClick: () => _(B.threadId), className: "h-6 w-6 p-0", children: /* @__PURE__ */ l.jsx(Ui, { size: 12 }) }),
13062
13053
  /* @__PURE__ */ l.jsx(Oe, { variant: "ghost", size: "sm", onClick: M, className: "h-6 w-6 p-0", children: /* @__PURE__ */ l.jsx(Xn, { size: 12 }) })
13063
13054
  ] }) : /* @__PURE__ */ l.jsxs(l.Fragment, { children: [
@@ -14399,7 +14390,7 @@ var sT = [" ", "Enter", "ArrowUp", "ArrowDown"], iT = [" ", "Enter"], Dn = "Sele
14399
14390
  defaultProp: a,
14400
14391
  onChange: c,
14401
14392
  caller: Dn
14402
- }), F = f.useRef(null), O = p ? w || !!p.closest("form") : !0, [L, A] = f.useState(/* @__PURE__ */ new Set()), X = Array.from(L).map((W) => W.props.value).join(";");
14393
+ }), L = f.useRef(null), O = p ? w || !!p.closest("form") : !0, [F, A] = f.useState(/* @__PURE__ */ new Set()), q = Array.from(F).map((W) => W.props.value).join(";");
14403
14394
  return /* @__PURE__ */ l.jsx(Ea, { ...g, children: /* @__PURE__ */ l.jsxs(
14404
14395
  lT,
14405
14396
  {
@@ -14417,7 +14408,7 @@ var sT = [" ", "Enter", "ArrowUp", "ArrowDown"], iT = [" ", "Enter"], Dn = "Sele
14417
14408
  open: C,
14418
14409
  onOpenChange: I,
14419
14410
  dir: T,
14420
- triggerPointerDownPosRef: F,
14411
+ triggerPointerDownPosRef: L,
14421
14412
  disabled: m,
14422
14413
  children: [
14423
14414
  /* @__PURE__ */ l.jsx(Ps.Provider, { scope: t, children: /* @__PURE__ */ l.jsx(
@@ -14450,10 +14441,10 @@ var sT = [" ", "Enter", "ArrowUp", "ArrowDown"], iT = [" ", "Enter"], Dn = "Sele
14450
14441
  form: w,
14451
14442
  children: [
14452
14443
  N === void 0 ? /* @__PURE__ */ l.jsx("option", { value: "" }) : null,
14453
- Array.from(L)
14444
+ Array.from(F)
14454
14445
  ]
14455
14446
  },
14456
- X
14447
+ q
14457
14448
  ) : null
14458
14449
  ]
14459
14450
  }
@@ -14568,9 +14559,9 @@ var Dt = 10, [rp, Rn] = pr(Ln), hT = "SelectContentImpl", pT = tr("SelectContent
14568
14559
  avoidCollisions: p,
14569
14560
  //
14570
14561
  ...v
14571
- } = e, b = Tn(Ln, n), [y, E] = f.useState(null), [S, T] = f.useState(null), C = Ee(t, (H) => E(H)), [I, N] = f.useState(null), [j, F] = f.useState(
14562
+ } = e, b = Tn(Ln, n), [y, E] = f.useState(null), [S, T] = f.useState(null), C = Ee(t, (H) => E(H)), [I, N] = f.useState(null), [j, L] = f.useState(
14572
14563
  null
14573
- ), O = _s(n), [L, A] = f.useState(!1), X = f.useRef(!1);
14564
+ ), O = _s(n), [F, A] = f.useState(!1), q = f.useRef(!1);
14574
14565
  f.useEffect(() => {
14575
14566
  if (y) return ha(y);
14576
14567
  }, [y]), fa();
@@ -14586,8 +14577,8 @@ var Dt = 10, [rp, Rn] = pr(Ln), hT = "SelectContentImpl", pT = tr("SelectContent
14586
14577
  [W, I, y]
14587
14578
  );
14588
14579
  f.useEffect(() => {
14589
- L && oe();
14590
- }, [L, oe]);
14580
+ F && oe();
14581
+ }, [F, oe]);
14591
14582
  const { onOpenChange: _, triggerPointerDownPosRef: M } = b;
14592
14583
  f.useEffect(() => {
14593
14584
  if (y) {
@@ -14616,14 +14607,14 @@ var Dt = 10, [rp, Rn] = pr(Ln), hT = "SelectContentImpl", pT = tr("SelectContent
14616
14607
  ee && setTimeout(() => ee.ref.current.focus());
14617
14608
  }), Q = f.useCallback(
14618
14609
  (H, P, K) => {
14619
- const ee = !X.current && !K;
14620
- (b.value !== void 0 && b.value === P || ee) && (N(H), ee && (X.current = !0));
14610
+ const ee = !q.current && !K;
14611
+ (b.value !== void 0 && b.value === P || ee) && (N(H), ee && (q.current = !0));
14621
14612
  },
14622
14613
  [b.value]
14623
14614
  ), B = f.useCallback(() => y == null ? void 0 : y.focus(), [y]), J = f.useCallback(
14624
14615
  (H, P, K) => {
14625
- const ee = !X.current && !K;
14626
- (b.value !== void 0 && b.value === P || ee) && F(H);
14616
+ const ee = !q.current && !K;
14617
+ (b.value !== void 0 && b.value === P || ee) && L(H);
14627
14618
  },
14628
14619
  [b.value]
14629
14620
  ), ae = r === "popper" ? Di : sp, ge = ae === Di ? {
@@ -14652,7 +14643,7 @@ var Dt = 10, [rp, Rn] = pr(Ln), hT = "SelectContentImpl", pT = tr("SelectContent
14652
14643
  focusSelectedItem: oe,
14653
14644
  selectedItemText: j,
14654
14645
  position: r,
14655
- isPositioned: L,
14646
+ isPositioned: F,
14656
14647
  searchRef: V,
14657
14648
  children: /* @__PURE__ */ l.jsx(fs, { as: pT, allowPinchZoom: !0, children: /* @__PURE__ */ l.jsx(
14658
14649
  cs,
@@ -14739,9 +14730,9 @@ var mT = "SelectItemAlignedPosition", sp = f.forwardRef((e, t) => {
14739
14730
  ]);
14740
14731
  a.style.minWidth = Pe + "px", a.style.right = pe + "px";
14741
14732
  }
14742
- const F = m(), O = window.innerHeight - Dt * 2, L = g.scrollHeight, A = window.getComputedStyle(u), X = parseInt(A.borderTopWidth, 10), W = parseInt(A.paddingTop, 10), oe = parseInt(A.borderBottomWidth, 10), _ = parseInt(A.paddingBottom, 10), M = X + W + L + _ + oe, V = Math.min(p.offsetHeight * 5, M), U = window.getComputedStyle(g), Q = parseInt(U.paddingTop, 10), B = parseInt(U.paddingBottom, 10), J = C.top + C.height / 2 - Dt, ae = O - J, ge = p.offsetHeight / 2, H = p.offsetTop + ge, P = X + W + H, K = M - P;
14733
+ const L = m(), O = window.innerHeight - Dt * 2, F = g.scrollHeight, A = window.getComputedStyle(u), q = parseInt(A.borderTopWidth, 10), W = parseInt(A.paddingTop, 10), oe = parseInt(A.borderBottomWidth, 10), _ = parseInt(A.paddingBottom, 10), M = q + W + F + _ + oe, V = Math.min(p.offsetHeight * 5, M), U = window.getComputedStyle(g), Q = parseInt(U.paddingTop, 10), B = parseInt(U.paddingBottom, 10), J = C.top + C.height / 2 - Dt, ae = O - J, ge = p.offsetHeight / 2, H = p.offsetTop + ge, P = q + W + H, K = M - P;
14743
14734
  if (P <= J) {
14744
- const le = F.length > 0 && p === F[F.length - 1].ref.current;
14735
+ const le = L.length > 0 && p === L[L.length - 1].ref.current;
14745
14736
  a.style.bottom = "0px";
14746
14737
  const se = u.clientHeight - g.offsetTop - g.offsetHeight, Te = Math.max(
14747
14738
  ae,
@@ -14750,11 +14741,11 @@ var mT = "SelectItemAlignedPosition", sp = f.forwardRef((e, t) => {
14750
14741
  ), Pe = P + Te;
14751
14742
  a.style.height = Pe + "px";
14752
14743
  } else {
14753
- const le = F.length > 0 && p === F[0].ref.current;
14744
+ const le = L.length > 0 && p === L[0].ref.current;
14754
14745
  a.style.top = "0px";
14755
14746
  const Te = Math.max(
14756
14747
  J,
14757
- X + g.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
14748
+ q + g.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
14758
14749
  (le ? Q : 0) + ge
14759
14750
  ) + K;
14760
14751
  a.style.height = Te + "px", g.scrollTop = P - J + g.offsetTop;
@@ -15661,7 +15652,7 @@ function RR({
15661
15652
  "--chat-sidebar-width": u === "phone" ? "100%" : u === "tablet" ? "280px" : u === "half-screen" ? "240px" : "320px",
15662
15653
  "--chat-message-max-width": u === "phone" ? "95%" : u === "tablet" ? "90%" : u === "half-screen" ? "85%" : "80%",
15663
15654
  "--chat-input-height": u === "phone" ? "120px" : "100px"
15664
- }), c = q.useCallback((u) => {
15655
+ }), c = X.useCallback((u) => {
15665
15656
  var d;
15666
15657
  (d = s.onThreadChange) == null || d.call(s, u);
15667
15658
  }, [s.onThreadChange]);