teodor-new-chat-ui 4.0.10 → 4.0.11

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 Np = Object.defineProperty;
2
2
  var Ap = (e, t, n) => t in e ? Np(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
3
  var Ba = (e, t, n) => Ap(e, typeof t != "symbol" ? t + "" : t, n);
4
4
  import * as p from "react";
5
- import H, { createContext as zn, useContext as Bn, useEffect as tt, useReducer as Cc, useState as de, useRef as et, useCallback as $e, useMemo as yt, createElement as go, useLayoutEffect as _p } from "react";
5
+ import H, { createContext as zn, useContext as Bn, useEffect as tt, useReducer as Cc, useState as de, useRef as et, useCallback as $e, useMemo as vt, createElement as go, useLayoutEffect as _p } from "react";
6
6
  import { Square as jp, Send as Pp, X as Qn, ExternalLink as Op, Download as Mp, Image as Dp, FileText as Ha, Loader as Tc, Bot as Ua, Wrench as Lp, User as $p, ChevronUp as Cr, ChevronDown as Zn, Paperclip as ui, Copy as Wa, Edit as Va, RotateCcw as di, ChevronRight as Fp, Check as Wi, Circle as zp, Loader2 as fi, Edit3 as Rc, 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 or } from "@radix-ui/react-slot";
8
8
  import { cva as Jo } from "class-variance-authority";
@@ -74,14 +74,14 @@ function om() {
74
74
  }
75
75
  var R = !1, S = !1, C = !1, E = !1, k = !1, I;
76
76
  I = Symbol.for("react.module.reference");
77
- function A(T) {
77
+ function N(T) {
78
78
  return !!(typeof T == "string" || typeof T == "function" || T === r || T === s || k || T === o || T === u || T === d || E || T === m || R || S || C || typeof T == "object" && T !== null && (T.$$typeof === h || T.$$typeof === f || T.$$typeof === i || T.$$typeof === a || T.$$typeof === c || // This needs to include all possible module reference object
79
79
  // types supported by any Flight configuration anywhere since
80
80
  // we don't know which Flight build this will end up being used
81
81
  // with.
82
82
  T.$$typeof === I || T.getModuleId !== void 0));
83
83
  }
84
- function N(T, W, ne) {
84
+ function A(T, W, ne) {
85
85
  var ye = T.displayName;
86
86
  if (ye)
87
87
  return ye;
@@ -121,7 +121,7 @@ function om() {
121
121
  var ne = T;
122
122
  return z(ne._context) + ".Provider";
123
123
  case c:
124
- return N(T, T.render, "ForwardRef");
124
+ return A(T, T.render, "ForwardRef");
125
125
  case f:
126
126
  var ye = T.displayName || null;
127
127
  return ye !== null ? ye : K(T.type) || "Memo";
@@ -243,29 +243,29 @@ function om() {
243
243
  }), typeof Reflect == "object" && Reflect.construct) {
244
244
  try {
245
245
  Reflect.construct(Oe, []);
246
- } catch (bt) {
247
- ye = bt;
246
+ } catch (yt) {
247
+ ye = yt;
248
248
  }
249
249
  Reflect.construct(T, [], Oe);
250
250
  } else {
251
251
  try {
252
252
  Oe.call();
253
- } catch (bt) {
254
- ye = bt;
253
+ } catch (yt) {
254
+ ye = yt;
255
255
  }
256
256
  T.call(Oe.prototype);
257
257
  }
258
258
  } else {
259
259
  try {
260
260
  throw Error();
261
- } catch (bt) {
262
- ye = bt;
261
+ } catch (yt) {
262
+ ye = yt;
263
263
  }
264
264
  T();
265
265
  }
266
- } catch (bt) {
267
- if (bt && ye && typeof bt.stack == "string") {
268
- for (var Ae = bt.stack.split(`
266
+ } catch (yt) {
267
+ if (yt && ye && typeof yt.stack == "string") {
268
+ for (var Ae = yt.stack.split(`
269
269
  `), xt = ye.stack.split(`
270
270
  `), rt = Ae.length - 1, at = xt.length - 1; rt >= 1 && at >= 0 && Ae[rt] !== xt[at]; )
271
271
  at--;
@@ -582,7 +582,7 @@ Check the top-level render call using <` + ne + ">.");
582
582
  var Rt = {};
583
583
  function Gt(T, W, ne, ye, Be, We) {
584
584
  {
585
- var Oe = A(T);
585
+ var Oe = N(T);
586
586
  if (!Oe) {
587
587
  var Ae = "";
588
588
  (T === void 0 || typeof T == "object" && T !== null && Object.keys(T).length === 0) && (Ae += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
@@ -608,11 +608,11 @@ Check the top-level render call using <` + ne + ">.");
608
608
  xe(Pt, T);
609
609
  }
610
610
  if (Ne.call(W, "key")) {
611
- var Rn = K(T), bt = Object.keys(W).filter(function(Ip) {
611
+ var Rn = K(T), yt = Object.keys(W).filter(function(Ip) {
612
612
  return Ip !== "key";
613
- }), $s = bt.length > 0 ? "{key: someKey, " + bt.join(": ..., ") + ": ...}" : "{key: someKey}";
613
+ }), $s = yt.length > 0 ? "{key: someKey, " + yt.join(": ..., ") + ": ...}" : "{key: someKey}";
614
614
  if (!Rt[Rn + $s]) {
615
- var kp = bt.length > 0 ? "{" + bt.join(": ..., ") + ": ...}" : "{}";
615
+ var kp = yt.length > 0 ? "{" + yt.join(": ..., ") + ": ...}" : "{}";
616
616
  b(`A props object containing a "key" prop is being spread into JSX:
617
617
  let props = %s;
618
618
  <%s {...props} />
@@ -1866,8 +1866,8 @@ const Vc = (e) => {
1866
1866
  responseType: E,
1867
1867
  headers: k,
1868
1868
  withCredentials: I = "same-origin",
1869
- fetchOptions: A
1870
- } = Vc(w), N = t || fetch;
1869
+ fetchOptions: N
1870
+ } = Vc(w), A = t || fetch;
1871
1871
  E = E ? (E + "").toLowerCase() : "text";
1872
1872
  let z = yg([b, y && y.toAbortSignal()], R), K = null;
1873
1873
  const P = z && z.unsubscribe && (() => {
@@ -1891,7 +1891,7 @@ const Vc = (e) => {
1891
1891
  }
1892
1892
  j.isString(I) || (I = I ? "include" : "omit");
1893
1893
  const M = s && "credentials" in n.prototype, X = {
1894
- ...A,
1894
+ ...N,
1895
1895
  signal: z,
1896
1896
  method: g.toUpperCase(),
1897
1897
  headers: k.normalize().toJSON(),
@@ -1900,7 +1900,7 @@ const Vc = (e) => {
1900
1900
  credentials: M ? I : void 0
1901
1901
  };
1902
1902
  K = s && new n(v, X);
1903
- let $ = await (s ? N(K, A) : N(v, X));
1903
+ let $ = await (s ? A(K, N) : A(v, X));
1904
1904
  const _ = d && (E === "stream" || E === "response");
1905
1905
  if (d && (S || _ && P)) {
1906
1906
  const L = {};
@@ -2695,7 +2695,7 @@ function Gg({
2695
2695
  });
2696
2696
  }),
2697
2697
  []
2698
- ), A = $e(async () => {
2698
+ ), N = $e(async () => {
2699
2699
  h(!0);
2700
2700
  try {
2701
2701
  const L = await i.listThreads();
@@ -2705,17 +2705,17 @@ function Gg({
2705
2705
  } finally {
2706
2706
  h(!1);
2707
2707
  }
2708
- }, [i, s]), N = $e(
2708
+ }, [i, s]), A = $e(
2709
2709
  async (L) => {
2710
2710
  const G = await i.createThread(L), Z = typeof G == "string" ? G : G.threadId;
2711
- return await A(), d(Z), Z;
2711
+ return await N(), d(Z), Z;
2712
2712
  },
2713
- [i, A]
2713
+ [i, N]
2714
2714
  ), z = $e(
2715
2715
  async (L) => {
2716
- await i.deleteThread(L), u === L && (d(null), k == null || k.onThreadCleared()), await A();
2716
+ await i.deleteThread(L), u === L && (d(null), k == null || k.onThreadCleared()), await N();
2717
2717
  },
2718
- [i, u, A, k]
2718
+ [i, u, N, k]
2719
2719
  ), K = $e(
2720
2720
  async (L, G) => {
2721
2721
  try {
@@ -2725,10 +2725,10 @@ function Gg({
2725
2725
  )
2726
2726
  );
2727
2727
  } catch (Z) {
2728
- throw await A(), Z;
2728
+ throw await N(), Z;
2729
2729
  }
2730
2730
  },
2731
- [i, A]
2731
+ [i, N]
2732
2732
  ), P = $e(
2733
2733
  async (L, G, Z, le = !1) => {
2734
2734
  await I(async () => {
@@ -2806,7 +2806,7 @@ function Gg({
2806
2806
  let L = !0;
2807
2807
  return (async () => {
2808
2808
  try {
2809
- if (await A(), !L) return;
2809
+ if (await N(), !L) return;
2810
2810
  if (!r && !t)
2811
2811
  try {
2812
2812
  const Z = localStorage.getItem("lastThreadId");
@@ -2828,10 +2828,10 @@ function Gg({
2828
2828
  isLoadingThreads: f,
2829
2829
  isLoadingThread: m,
2830
2830
  setCurrentThreadId: d,
2831
- createThread: N,
2831
+ createThread: A,
2832
2832
  deleteThread: z,
2833
2833
  renameThread: K,
2834
- refreshThreads: A,
2834
+ refreshThreads: N,
2835
2835
  loadThread: P,
2836
2836
  clearCurrentThread: V,
2837
2837
  listCheckpoints: M,
@@ -2932,7 +2932,7 @@ function Zg(e = []) {
2932
2932
  tt(() => () => {
2933
2933
  o.current !== null && typeof window < "u" && window.cancelAnimationFrame(o.current), s.current !== null && clearTimeout(s.current), r.current = [];
2934
2934
  }, []);
2935
- const u = yt(() => ({
2935
+ const u = vt(() => ({
2936
2936
  reset: (d) => n({ type: "reset", payload: { messages: d } }),
2937
2937
  seed: (d, f) => n({ type: "seed", payload: { messages: d, ...f ?? {} } }),
2938
2938
  prepend: (d) => n({ type: "prepend", payload: { messages: d } }),
@@ -3162,7 +3162,10 @@ function ax({
3162
3162
  return { handleEvent: s, reset: i };
3163
3163
  }
3164
3164
  function lx(e = {}) {
3165
- const t = e.baseUrl ?? "/api/chat", n = e.streamPath ?? "/runs/stream", [r, o] = de(e.token ?? null), s = et(e.headers ?? {}), [i, a] = de(!1), [c, u] = de(null), [d, f] = de(""), [h, m] = de(null), [w, v] = de(0), [g, x] = de(!1), b = et(null), y = et(!0), R = et(0), S = $e((I) => {
3165
+ const t = vt(() => {
3166
+ const N = (e.baseUrl ?? "/api/chat").replace(/\/+$/, "");
3167
+ return N.endsWith("/chat") ? N : `${N}/chat`;
3168
+ }, [e.baseUrl]), n = e.streamPath ?? "/runs/stream", [r, o] = de(e.token ?? null), s = et(e.headers ?? {}), [i, a] = de(!1), [c, u] = de(null), [d, f] = de(""), [h, m] = de(null), [w, v] = de(0), [g, x] = de(!1), b = et(null), y = et(!0), R = et(0), S = $e((I) => {
3166
3169
  o(I);
3167
3170
  }, []), C = $e(() => {
3168
3171
  var I;
@@ -3170,7 +3173,7 @@ function lx(e = {}) {
3170
3173
  }, []), E = $e(() => {
3171
3174
  f(""), m(null), u(null);
3172
3175
  }, []), k = $e(
3173
- (I, A, N) => {
3176
+ (I, N, A) => {
3174
3177
  b.current && (b.current.abort(), b.current = null), a(!0), u(null), e.autoAppendAssistant !== !1 && f("");
3175
3178
  const z = new AbortController();
3176
3179
  return b.current = z, (async () => {
@@ -3248,12 +3251,12 @@ function lx(e = {}) {
3248
3251
  var be;
3249
3252
  if (Date.now() - Q > 2e4) {
3250
3253
  const Ne = "Stream idle timeout";
3251
- u(Ne), z.abort(), (be = N == null ? void 0 : N.onError) == null || be.call(N, Ne);
3254
+ u(Ne), z.abort(), (be = A == null ? void 0 : A.onError) == null || be.call(A, Ne);
3252
3255
  }
3253
3256
  }, 5e3), Ue = 1024 * 1024;
3254
3257
  try {
3255
3258
  const be = Z.headers.get("X-Thread-Id") || Z.headers.get("x-thread-id"), Ne = Z.headers.get("X-Thread-Created") || Z.headers.get("x-thread-created"), ze = be ?? null, qe = String(Ne ?? "").toLowerCase() === "true";
3256
- for ((X = N == null ? void 0 : N.onOpen) == null || X.call(N, { threadId: ze, created: qe }); ; ) {
3259
+ for ((X = A == null ? void 0 : A.onOpen) == null || X.call(A, { threadId: ze, created: qe }); ; ) {
3257
3260
  const { value: Me, done: nt } = await le.read();
3258
3261
  if (nt) break;
3259
3262
  ce += me.decode(Me, { stream: !0 }), ce.length > Ue && (ce = "", console.warn("Stream buffer reset: exceeded 1MB"));
@@ -3280,9 +3283,9 @@ function lx(e = {}) {
3280
3283
  console.debug("[use-chat] drop duplicate/out-of-order event", { seq: Re, lastProcessedSeq: O, type: ge.type });
3281
3284
  continue;
3282
3285
  }
3283
- O > 0 && Re > O + 1 && (($ = N == null ? void 0 : N.onGap) == null || $.call(N, { from: O, to: Re })), O = Re, R.current = Re, v(Re);
3286
+ O > 0 && Re > O + 1 && (($ = A == null ? void 0 : A.onGap) == null || $.call(A, { from: O, to: Re })), O = Re, R.current = Re, v(Re);
3284
3287
  }
3285
- if (A == null || A(ge), ge.type === "token" && e.autoAppendAssistant !== !1)
3288
+ if (N == null || N(ge), ge.type === "token" && e.autoAppendAssistant !== !1)
3286
3289
  J.push(ge.content), U();
3287
3290
  else if (ge.type === "message_delta") {
3288
3291
  const De = ge.delta.filter((Ge) => Ge.type === "text").map((Ge) => Ge.text).join("");
@@ -3295,7 +3298,7 @@ function lx(e = {}) {
3295
3298
  } catch (be) {
3296
3299
  if (be.name !== "AbortError") {
3297
3300
  const Ne = be.message || String(be);
3298
- u(Ne), (_ = N == null ? void 0 : N.onError) == null || _.call(N, Ne);
3301
+ u(Ne), (_ = A == null ? void 0 : A.onError) == null || _.call(A, Ne);
3299
3302
  }
3300
3303
  } finally {
3301
3304
  try {
@@ -3309,7 +3312,7 @@ function lx(e = {}) {
3309
3312
  } catch (G) {
3310
3313
  if (G.name !== "AbortError") {
3311
3314
  const Z = G.message || String(G);
3312
- u(Z), (L = N == null ? void 0 : N.onError) == null || L.call(N, Z);
3315
+ u(Z), (L = A == null ? void 0 : A.onError) == null || L.call(A, Z);
3313
3316
  }
3314
3317
  } finally {
3315
3318
  a(!1), x(!1), b.current = null;
@@ -3356,7 +3359,7 @@ function dx({
3356
3359
  const { api: r, baseUrl: o } = Gi(), s = H.useMemo(() => {
3357
3360
  const D = (o ?? "").replace(/\/+$/, "");
3358
3361
  return D ? D.endsWith("/chat") ? D : `${D}/chat` : "/api/chat";
3359
- }, [o]), { currentThreadId: i, setCurrentThreadId: a, isLoadingThread: c } = tu(), u = Ug(), { state: d, dispatch: f, seed: h, prepend: m, pushUser: w, onEvent: v, reset: g } = Zg(), [x, b] = de(!1), [y, R] = de(!1), [S, C] = de(null), [E, k] = de(void 0), [I, A] = de(void 0), N = 20, z = et(i);
3362
+ }, [o]), { currentThreadId: i, setCurrentThreadId: a, isLoadingThread: c } = tu(), u = Ug(), { state: d, dispatch: f, seed: h, prepend: m, pushUser: w, onEvent: v, reset: g } = Zg(), [x, b] = de(!1), [y, R] = de(!1), [S, C] = de(null), [E, k] = de(void 0), [I, N] = de(void 0), A = 20, z = et(i);
3360
3363
  tt(() => {
3361
3364
  z.current = i;
3362
3365
  }, [i]);
@@ -3391,7 +3394,7 @@ function dx({
3391
3394
  U === "replace" ? (console.log("[MessagesProvider] Replacing messages, count:", Q.length), h(Q, {
3392
3395
  checkpointId: (D == null ? void 0 : D.checkpointId) ?? null,
3393
3396
  checkpointNs: (D == null ? void 0 : D.checkpointNs) ?? null
3394
- })) : U === "prepend" && Q.length && (console.log("[MessagesProvider] Prepending messages, count:", Q.length), m(Q)), C((D == null ? void 0 : D.nextCursor) ?? null), b(!!(D != null && D.hasMore)), k((ke) => (D == null ? void 0 : D.checkpointId) ?? ke ?? void 0), A((ke) => (D == null ? void 0 : D.checkpointNs) ?? ke ?? void 0);
3397
+ })) : U === "prepend" && Q.length && (console.log("[MessagesProvider] Prepending messages, count:", Q.length), m(Q)), C((D == null ? void 0 : D.nextCursor) ?? null), b(!!(D != null && D.hasMore)), k((ke) => (D == null ? void 0 : D.checkpointId) ?? ke ?? void 0), N((ke) => (D == null ? void 0 : D.checkpointNs) ?? ke ?? void 0);
3395
3398
  },
3396
3399
  [h, m]
3397
3400
  ), G = $e(
@@ -3432,7 +3435,7 @@ function dx({
3432
3435
  threadId: i,
3433
3436
  checkpointId: E,
3434
3437
  checkpointNs: I,
3435
- limit: (D == null ? void 0 : D.limit) ?? N,
3438
+ limit: (D == null ? void 0 : D.limit) ?? A,
3436
3439
  beforeId: U
3437
3440
  });
3438
3441
  L(Q, "prepend");
@@ -3450,10 +3453,10 @@ function dx({
3450
3453
  x,
3451
3454
  y,
3452
3455
  L,
3453
- N
3456
+ A
3454
3457
  ]
3455
3458
  ), J = $e(() => {
3456
- console.log("[MessagesProvider] Clearing messages"), g([]), b(!1), R(!1), C(null), k(void 0), A(void 0);
3459
+ console.log("[MessagesProvider] Clearing messages"), g([]), b(!1), R(!1), C(null), k(void 0), N(void 0);
3457
3460
  }, [g]), O = $e(
3458
3461
  async (D, U) => {
3459
3462
  var it;
@@ -3572,7 +3575,7 @@ function px({
3572
3575
  }
3573
3576
  const ru = zn(null);
3574
3577
  function mx({ children: e }) {
3575
- const t = Gi(), n = Hg(), r = tu(), o = hx(), s = yt(
3578
+ const t = Gi(), n = Hg(), r = tu(), o = hx(), s = vt(
3576
3579
  () => ({
3577
3580
  // API
3578
3581
  baseUrl: t.baseUrl,
@@ -3710,8 +3713,8 @@ function xx({
3710
3713
  const I = (h ?? "").trim();
3711
3714
  !I && !f || v(() => {
3712
3715
  try {
3713
- const A = i(I);
3714
- A && typeof A.then == "function" ? A.then(() => {
3716
+ const N = i(I);
3717
+ N && typeof N.then == "function" ? N.then(() => {
3715
3718
  m(""), g.current && (g.current.style.height = "auto");
3716
3719
  }).catch(() => {
3717
3720
  }) : (m(""), g.current && (g.current.style.height = "auto"));
@@ -4150,7 +4153,7 @@ function lu(e, t, n) {
4150
4153
  }
4151
4154
  }, [a, t, i]), s;
4152
4155
  }
4153
- const vt = Fe(
4156
+ const wt = Fe(
4154
4157
  () => {
4155
4158
  const e = Pe(), t = Pe(), n = q(0), r = Pe(), o = q(0), s = Pe(), i = Pe(), a = q(0), c = q(0), u = q(0), d = q(0), f = Pe(), h = Pe(), m = q(!1), w = q(!1), v = q(!1);
4156
4159
  return ue(
@@ -4521,7 +4524,7 @@ const Hx = {
4521
4524
  we((S) => S.length > 0),
4522
4525
  Ie(v, m),
4523
4526
  re(([S, C, E]) => {
4524
- const k = S.reduce((I, A, N) => It(I, A, Mr(A, C.offsetTree, E) || N), er());
4527
+ const k = S.reduce((I, N, A) => It(I, N, Mr(N, C.offsetTree, E) || A), er());
4525
4528
  return {
4526
4529
  ...C,
4527
4530
  groupIndices: S,
@@ -4607,22 +4610,22 @@ const Hx = {
4607
4610
  re(([S, C]) => {
4608
4611
  const E = C.groupIndices.length > 0, k = [], I = C.lastSize;
4609
4612
  if (E) {
4610
- const A = Pr(C.sizeTree, 0);
4611
- let N = 0, z = 0;
4612
- for (; N < S; ) {
4613
+ const N = Pr(C.sizeTree, 0);
4614
+ let A = 0, z = 0;
4615
+ for (; A < S; ) {
4613
4616
  const P = C.groupIndices[z], V = C.groupIndices.length === z + 1 ? 1 / 0 : C.groupIndices[z + 1] - P - 1;
4614
4617
  k.push({
4615
4618
  endIndex: P,
4616
- size: A,
4619
+ size: N,
4617
4620
  startIndex: P
4618
4621
  }), k.push({
4619
4622
  endIndex: P + 1 + V - 1,
4620
4623
  size: I,
4621
4624
  startIndex: P + 1
4622
- }), z++, N += V + 1;
4625
+ }), z++, A += V + 1;
4623
4626
  }
4624
4627
  const K = Nn(C.sizeTree);
4625
- return N !== S && K.shift(), K.reduce(
4628
+ return A !== S && K.shift(), K.reduce(
4626
4629
  (P, { k: V, v: M }) => {
4627
4630
  let X = P.ranges;
4628
4631
  return P.prevSize !== 0 && (X = [
@@ -4646,10 +4649,10 @@ const Hx = {
4646
4649
  ).ranges;
4647
4650
  }
4648
4651
  return Nn(C.sizeTree).reduce(
4649
- (A, { k: N, v: z }) => ({
4650
- prevIndex: N + S,
4652
+ (N, { k: A, v: z }) => ({
4653
+ prevIndex: A + S,
4651
4654
  prevSize: z,
4652
- ranges: [...A.ranges, { endIndex: N + S - 1, size: A.prevSize, startIndex: A.prevIndex }]
4655
+ ranges: [...N.ranges, { endIndex: A + S - 1, size: N.prevSize, startIndex: N.prevIndex }]
4653
4656
  }),
4654
4657
  {
4655
4658
  prevIndex: 0,
@@ -4681,13 +4684,13 @@ const Hx = {
4681
4684
  return C;
4682
4685
  let k = er();
4683
4686
  const I = ot(g);
4684
- let A = 0, N = 0, z = 0;
4685
- for (; A < -S; ) {
4686
- z = I[N];
4687
- const K = I[N + 1] - z - 1;
4688
- N++, A += K + 1;
4687
+ let N = 0, A = 0, z = 0;
4688
+ for (; N < -S; ) {
4689
+ z = I[A];
4690
+ const K = I[A + 1] - z - 1;
4691
+ A++, N += K + 1;
4689
4692
  }
4690
- if (k = Nn(C.sizeTree).reduce((K, { k: P, v: V }) => It(K, Math.max(0, P + S), V), k), A !== -S) {
4693
+ if (k = Nn(C.sizeTree).reduce((K, { k: P, v: V }) => It(K, Math.max(0, P + S), V), k), N !== -S) {
4691
4694
  const K = Pr(C.sizeTree, z);
4692
4695
  k = It(k, 0, K);
4693
4696
  const P = Ut(C.sizeTree, -S + 1)[1];
@@ -4699,7 +4702,7 @@ const Hx = {
4699
4702
  ...Ti(C.offsetTree, 0, k, E)
4700
4703
  };
4701
4704
  } else {
4702
- const k = Nn(C.sizeTree).reduce((I, { k: A, v: N }) => It(I, Math.max(0, A + S), N), er());
4705
+ const k = Nn(C.sizeTree).reduce((I, { k: N, v: A }) => It(I, Math.max(0, N + S), A), er());
4703
4706
  return {
4704
4707
  ...C,
4705
4708
  sizeTree: k,
@@ -4769,7 +4772,7 @@ const vu = Fe(
4769
4772
  i
4770
4773
  ), { groupCounts: s, topItemsIndexes: i };
4771
4774
  },
4772
- Xe(rn, vt)
4775
+ Xe(rn, wt)
4773
4776
  ), Sn = Fe(
4774
4777
  ([{ log: e }]) => {
4775
4778
  const t = q(!1), n = Nt(
@@ -4817,16 +4820,16 @@ const Kr = Fe(
4817
4820
  Ie(e, s, o),
4818
4821
  re(
4819
4822
  ([
4820
- [R, S, C, E, k, I, A, N],
4823
+ [R, S, C, E, k, I, N, A],
4821
4824
  z,
4822
4825
  K,
4823
4826
  P
4824
4827
  ]) => {
4825
4828
  const V = wu(R), { align: M, behavior: X, offset: $ } = V, _ = E - 1, F = xu(V, S, _);
4826
4829
  let L = Mr(F, S.offsetTree, z) + I;
4827
- M === "end" ? (L += K + Ut(S.sizeTree, F)[1] - C + P, F === _ && (L += A)) : M === "center" ? L += (K + Ut(S.sizeTree, F)[1] - C + P) / 2 : L -= k, $ && (L += $);
4830
+ M === "end" ? (L += K + Ut(S.sizeTree, F)[1] - C + P, F === _ && (L += N)) : M === "center" ? L += (K + Ut(S.sizeTree, F)[1] - C + P) / 2 : L -= k, $ && (L += $);
4828
4831
  const G = (Z) => {
4829
- y(), Z ? (N("retrying to scroll to", { location: R }, Tt.DEBUG), Ee(m, R)) : (Ee(w, !0), N("list did not change, scroll successful", {}, Tt.DEBUG));
4832
+ y(), Z ? (A("retrying to scroll to", { location: R }, Tt.DEBUG), Ee(m, R)) : (Ee(w, !0), A("list did not change, scroll successful", {}, Tt.DEBUG));
4830
4833
  };
4831
4834
  if (y(), X === "smooth") {
4832
4835
  let Z = !1;
@@ -4839,7 +4842,7 @@ const Kr = Fe(
4839
4842
  g = Ht(B(t, Vx(150)), G);
4840
4843
  return x = setTimeout(() => {
4841
4844
  y();
4842
- }, 1200), Ee(c, !0), N("scrolling from index to", { behavior: X, index: F, top: L }, Tt.DEBUG), { behavior: X, top: L };
4845
+ }, 1200), Ee(c, !0), A("scrolling from index to", { behavior: X, index: F, top: L }, Tt.DEBUG), { behavior: X, top: L };
4843
4846
  }
4844
4847
  )
4845
4848
  ),
@@ -4850,7 +4853,7 @@ const Kr = Fe(
4850
4853
  topListHeight: v
4851
4854
  };
4852
4855
  },
4853
- Xe(rn, vt, yn),
4856
+ Xe(rn, wt, yn),
4854
4857
  { singleton: !0 }
4855
4858
  );
4856
4859
  function Vx(e) {
@@ -4913,7 +4916,7 @@ const qr = Fe(
4913
4916
  scrolledToInitialItem: a
4914
4917
  };
4915
4918
  },
4916
- Xe(rn, vt, Kr, Sn),
4919
+ Xe(rn, wt, Kr, Sn),
4917
4920
  { singleton: !0 }
4918
4921
  );
4919
4922
  function bu(e, t) {
@@ -4951,7 +4954,7 @@ const Dr = "up", Er = "down", Kx = "none", qx = {
4951
4954
  B(
4952
4955
  lt(r, ve(s), ve(t), ve(e), ve(d)),
4953
4956
  Zt((b, [{ scrollHeight: y, scrollTop: R }, S, C, E, k]) => {
4954
- const I = R + S - y > -k, A = {
4957
+ const I = R + S - y > -k, N = {
4955
4958
  scrollHeight: y,
4956
4959
  scrollTop: R,
4957
4960
  viewportHeight: S
@@ -4962,14 +4965,14 @@ const Dr = "up", Er = "down", Kx = "none", qx = {
4962
4965
  atBottom: !0,
4963
4966
  atBottomBecause: z,
4964
4967
  scrollTopDelta: K,
4965
- state: A
4968
+ state: N
4966
4969
  };
4967
4970
  }
4968
- let N;
4969
- return A.scrollHeight > b.state.scrollHeight ? N = "SIZE_INCREASED" : S < b.state.viewportHeight ? N = "VIEWPORT_HEIGHT_DECREASING" : R < b.state.scrollTop ? N = "SCROLLING_UPWARDS" : N = "NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM", {
4971
+ let A;
4972
+ return N.scrollHeight > b.state.scrollHeight ? A = "SIZE_INCREASED" : S < b.state.viewportHeight ? A = "VIEWPORT_HEIGHT_DECREASING" : R < b.state.scrollTop ? A = "SCROLLING_UPWARDS" : A = "NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM", {
4970
4973
  atBottom: !1,
4971
- notAtBottomBecause: N,
4972
- state: A
4974
+ notAtBottomBecause: A,
4975
+ state: N
4973
4976
  };
4974
4977
  }, qx),
4975
4978
  Ye((b, y) => b && b.atBottom === y.atBottom)
@@ -5060,7 +5063,7 @@ const Dr = "up", Er = "down", Kx = "none", qx = {
5060
5063
  scrollDirection: g,
5061
5064
  scrollVelocity: x
5062
5065
  };
5063
- }, Xe(vt)), Mo = "top", Do = "bottom", yl = "none";
5066
+ }, Xe(wt)), Mo = "top", Do = "bottom", yl = "none";
5064
5067
  function Sl(e, t, n) {
5065
5068
  return typeof e == "number" ? n === Dr && t === Mo || n === Er && t === Do ? e : 0 : n === Dr ? t === Mo ? e.main : e.reverse : t === Do ? e.main : e.reverse;
5066
5069
  }
@@ -5119,7 +5122,7 @@ const na = Fe(
5119
5122
  visibleRange: u
5120
5123
  };
5121
5124
  },
5122
- Xe(vt),
5125
+ Xe(wt),
5123
5126
  { singleton: !0 }
5124
5127
  );
5125
5128
  function Yx(e, t, n) {
@@ -5235,8 +5238,8 @@ const Un = Fe(
5235
5238
  e
5236
5239
  ),
5237
5240
  we(([C, E, , k, , , , , , , I]) => {
5238
- const A = I && I.length !== k;
5239
- return C && !E && !A;
5241
+ const N = I && I.length !== k;
5242
+ return C && !E && !N;
5240
5243
  }),
5241
5244
  re(
5242
5245
  ([
@@ -5245,8 +5248,8 @@ const Un = Fe(
5245
5248
  [C, E],
5246
5249
  k,
5247
5250
  I,
5248
- A,
5249
5251
  N,
5252
+ A,
5250
5253
  z,
5251
5254
  K,
5252
5255
  P,
@@ -5256,10 +5259,10 @@ const Un = Fe(
5256
5259
  if (k === 0)
5257
5260
  return { ...qs, totalCount: k };
5258
5261
  if (C === 0 && E === 0)
5259
- return _ === 0 ? { ...qs, totalCount: k } : yu(_, A, I, K, P, V || []);
5262
+ return _ === 0 ? { ...qs, totalCount: k } : yu(_, N, I, K, P, V || []);
5260
5263
  if (Ve($))
5261
5264
  return _ > 0 ? null : yo(
5262
- Yx(ta(A, k), M, V),
5265
+ Yx(ta(N, k), M, V),
5263
5266
  [],
5264
5267
  k,
5265
5268
  P,
@@ -5276,7 +5279,7 @@ const Un = Fe(
5276
5279
  F.push({ data: V == null ? void 0 : V[Q], index: Q, offset: J, size: Y }), J += Y;
5277
5280
  }
5278
5281
  }
5279
- if (!N)
5282
+ if (!A)
5280
5283
  return yo([], F, k, P, M, K);
5281
5284
  const L = z.length > 0 ? z[z.length - 1] + 1 : 0, G = Lx(X, C, E, L);
5282
5285
  if (G.length === 0)
@@ -5392,7 +5395,7 @@ const Un = Fe(
5392
5395
  );
5393
5396
  return ue(ve(i), s), { totalListHeight: i, totalListHeightChanged: s };
5394
5397
  },
5395
- Xe(vt, Un),
5398
+ Xe(wt, Un),
5396
5399
  { singleton: !0 }
5397
5400
  ), Xx = Fe(
5398
5401
  ([{ viewportHeight: e }, { totalListHeight: t }]) => {
@@ -5408,7 +5411,7 @@ const Un = Fe(
5408
5411
  );
5409
5412
  return { alignToBottom: n, paddingTopAddition: r };
5410
5413
  },
5411
- Xe(vt, Su),
5414
+ Xe(wt, Su),
5412
5415
  { singleton: !0 }
5413
5416
  ), Cu = Fe(() => ({
5414
5417
  context: q(null)
@@ -5431,9 +5434,9 @@ const Un = Fe(
5431
5434
  Ie(t, c, n, s, o, r, a),
5432
5435
  Ie(e),
5433
5436
  re(([[f, h, m, w, v, g, x, b], y]) => {
5434
- const { align: R, behavior: S, calculateViewLocation: C = Jx, done: E, ...k } = f, I = xu(f, h, w - 1), A = Mr(I, h.offsetTree, y) + v + g, N = A + Ut(h.sizeTree, I)[1], z = b + g, K = b + m - x, P = C({
5435
- itemBottom: N,
5436
- itemTop: A,
5437
+ const { align: R, behavior: S, calculateViewLocation: C = Jx, done: E, ...k } = f, I = xu(f, h, w - 1), N = Mr(I, h.offsetTree, y) + v + g, A = N + Ut(h.sizeTree, I)[1], z = b + g, K = b + m - x, P = C({
5438
+ itemBottom: A,
5439
+ itemTop: N,
5437
5440
  locationParams: { align: R, behavior: S, ...k },
5438
5441
  viewportBottom: K,
5439
5442
  viewportTop: z
@@ -5456,7 +5459,7 @@ const Un = Fe(
5456
5459
  scrollIntoView: d
5457
5460
  };
5458
5461
  },
5459
- Xe(rn, vt, Kr, Un, yn),
5462
+ Xe(rn, wt, Kr, Un, yn),
5460
5463
  { singleton: !0 }
5461
5464
  );
5462
5465
  function Rl(e) {
@@ -5487,9 +5490,9 @@ const Zx = (e, t) => typeof e == "function" ? Rl(e(t)) : t && Rl(e), Qx = Fe(
5487
5490
  B(
5488
5491
  lt(B(ve(t), On(1)), c),
5489
5492
  Ie(ve(w), s, a, f),
5490
- re(([[S, C], E, k, I, A]) => {
5491
- let N = C && I, z = "auto";
5492
- return N && (z = Zx(E, k || A), N = N && !!z), { followOutputBehavior: z, shouldFollow: N, totalCount: S };
5493
+ re(([[S, C], E, k, I, N]) => {
5494
+ let A = C && I, z = "auto";
5495
+ return A && (z = Zx(E, k || N), A = A && !!z), { followOutputBehavior: z, shouldFollow: A, totalCount: S };
5493
5496
  }),
5494
5497
  we(({ shouldFollow: S }) => S)
5495
5498
  ),
@@ -5543,7 +5546,7 @@ const Zx = (e, t) => typeof e == "function" ? Rl(e(t)) : t && Rl(e), Qx = Fe(
5543
5546
  B(
5544
5547
  lt(B(R, On(1)), c),
5545
5548
  Ie(ve(y), a, f, h),
5546
- re(([[S, C], E, k, I, A]) => C && k && (E == null ? void 0 : E({ context: A, totalCount: S, scrollingInProgress: I }))),
5549
+ re(([[S, C], E, k, I, N]) => C && k && (E == null ? void 0 : E({ context: N, totalCount: S, scrollingInProgress: I }))),
5547
5550
  we((S) => !!S),
5548
5551
  cn(0)
5549
5552
  ),
@@ -5563,7 +5566,7 @@ const Zx = (e, t) => typeof e == "function" ? Rl(e(t)) : t && Rl(e), Qx = Fe(
5563
5566
  qr,
5564
5567
  Sn,
5565
5568
  yn,
5566
- vt,
5569
+ wt,
5567
5570
  Cu,
5568
5571
  Tu
5569
5572
  )
@@ -5608,7 +5611,7 @@ const Zx = (e, t) => typeof e == "function" ? Rl(e(t)) : t && Rl(e), Qx = Fe(
5608
5611
  initialScrollTop: r
5609
5612
  };
5610
5613
  },
5611
- Xe(Sn, vt, Un),
5614
+ Xe(Sn, wt, Un),
5612
5615
  { singleton: !0 }
5613
5616
  ), Ru = Fe(
5614
5617
  ([{ scrollVelocity: e }]) => {
@@ -5671,7 +5674,7 @@ const Zx = (e, t) => typeof e == "function" ? Rl(e(t)) : t && Rl(e), Qx = Fe(
5671
5674
  windowScrollTo: o,
5672
5675
  windowViewportRect: r
5673
5676
  };
5674
- }, Xe(vt)), nv = Fe(
5677
+ }, Xe(wt)), nv = Fe(
5675
5678
  ([
5676
5679
  { sizeRanges: e, sizes: t },
5677
5680
  { headerHeight: n, scrollTop: r },
@@ -5703,7 +5706,7 @@ const Zx = (e, t) => typeof e == "function" ? Rl(e(t)) : t && Rl(e), Qx = Fe(
5703
5706
  restoreStateFrom: d
5704
5707
  };
5705
5708
  },
5706
- Xe(rn, vt, qr, Sn, ra)
5709
+ Xe(rn, wt, qr, Sn, ra)
5707
5710
  );
5708
5711
  function rv(e) {
5709
5712
  return { align: "start", index: 0, offset: e.scrollTop };
@@ -5739,8 +5742,8 @@ const sv = Eu(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
5739
5742
  Zt(
5740
5743
  ([, x, b, y], [{ bottom: R, items: S, offsetBottom: C, totalCount: E }, k]) => {
5741
5744
  const I = R + C;
5742
- let A = 0;
5743
- return b === E && x.length > 0 && S.length > 0 && (S[0].originalIndex === 0 && x[0].originalIndex === 0 || (A = I - y, A !== 0 && (A += k))), [A, S, E, I];
5745
+ let N = 0;
5746
+ return b === E && x.length > 0 && S.length > 0 && (S[0].originalIndex === 0 && x[0].originalIndex === 0 || (N = I - y, N !== 0 && (N += k))), [N, S, E, I];
5744
5747
  },
5745
5748
  [0, [], 0, 0]
5746
5749
  ),
@@ -5782,11 +5785,11 @@ const sv = Eu(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
5782
5785
  {
5783
5786
  let E = 0;
5784
5787
  const k = Pr(R, 0);
5785
- let I = 0, A = 0;
5788
+ let I = 0, N = 0;
5786
5789
  for (; I < x; ) {
5787
5790
  I++, E += k;
5788
- let N = b.length === A + 1 ? 1 / 0 : b[A + 1] - b[A] - 1;
5789
- I + N > x && (E -= k, N = x - I + 1), I += N, E += C(N), A++;
5791
+ let A = b.length === N + 1 ? 1 / 0 : b[N + 1] - b[N] - 1;
5792
+ I + A > x && (E -= k, A = x - I + 1), I += A, E += C(A), N++;
5790
5793
  }
5791
5794
  return E;
5792
5795
  }
@@ -5801,7 +5804,7 @@ const sv = Eu(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
5801
5804
  }
5802
5805
  ), { deviation: e };
5803
5806
  },
5804
- Xe(vt, Gr, Un, rn, yn, Zi)
5807
+ Xe(wt, Gr, Un, rn, yn, Zi)
5805
5808
  ), av = Fe(
5806
5809
  ([
5807
5810
  e,
@@ -5870,7 +5873,7 @@ const sv = Eu(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
5870
5873
  ]) => (ue(R.rangeChanged, I.scrollSeekRangeChanged), ue(
5871
5874
  B(
5872
5875
  I.windowViewportRect,
5873
- re((A) => A.visibleHeight)
5876
+ re((N) => N.visibleHeight)
5874
5877
  ),
5875
5878
  v.viewportHeight
5876
5879
  ), {
@@ -5907,7 +5910,7 @@ const sv = Eu(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
5907
5910
  Xe(
5908
5911
  rn,
5909
5912
  qr,
5910
- vt,
5913
+ wt,
5911
5914
  nv,
5912
5915
  Qx,
5913
5916
  Un,
@@ -6116,17 +6119,17 @@ const uv = /* @__PURE__ */ Fe(() => {
6116
6119
  ia("deviation", (P) => {
6117
6120
  x !== P && b(P);
6118
6121
  });
6119
- const y = Ce("EmptyPlaceholder"), R = Ce("ScrollSeekPlaceholder") || fv, S = Ce("ListComponent"), C = Ce("ItemComponent"), E = Ce("GroupComponent"), k = Ce("computeItemKey"), I = Ce("isSeeking"), A = Ce("groupIndices").length > 0, N = Ce("alignToBottom"), z = Ce("initialItemFinalLocationReached"), K = e ? {} : {
6122
+ const y = Ce("EmptyPlaceholder"), R = Ce("ScrollSeekPlaceholder") || fv, S = Ce("ListComponent"), C = Ce("ItemComponent"), E = Ce("GroupComponent"), k = Ce("computeItemKey"), I = Ce("isSeeking"), N = Ce("groupIndices").length > 0, A = Ce("alignToBottom"), z = Ce("initialItemFinalLocationReached"), K = e ? {} : {
6120
6123
  boxSizing: "border-box",
6121
6124
  ...v ? {
6122
6125
  display: "inline-block",
6123
6126
  height: "100%",
6124
- marginLeft: x !== 0 ? x : N ? "auto" : 0,
6127
+ marginLeft: x !== 0 ? x : A ? "auto" : 0,
6125
6128
  paddingLeft: t.offsetTop,
6126
6129
  paddingRight: t.offsetBottom,
6127
6130
  whiteSpace: "nowrap"
6128
6131
  } : {
6129
- marginTop: x !== 0 ? x : N ? "auto" : 0,
6132
+ marginTop: x !== 0 ? x : A ? "auto" : 0,
6130
6133
  paddingBottom: t.offsetBottom,
6131
6134
  paddingTop: t.offsetTop
6132
6135
  },
@@ -6174,7 +6177,7 @@ const uv = /* @__PURE__ */ Fe(() => {
6174
6177
  key: M,
6175
6178
  style: v ? pv : Pu
6176
6179
  },
6177
- A ? c(P.index, P.groupIndex, P.data, u) : c(P.index, P.data, u)
6180
+ N ? c(P.index, P.groupIndex, P.data, u) : c(P.index, P.data, u)
6178
6181
  );
6179
6182
  })
6180
6183
  }
@@ -6459,7 +6462,7 @@ const Pv = /* @__PURE__ */ Fe(
6459
6462
  { customScrollParent: g, useWindowScroll: x, windowScrollContainerState: b, windowScrollTo: y, windowViewportRect: R },
6460
6463
  S
6461
6464
  ]) => {
6462
- const C = q(0), E = q(0), k = q(Il), I = q({ height: 0, width: 0 }), A = q({ height: 0, width: 0 }), N = Pe(), z = Pe(), K = q(0), P = q(null), V = q({ column: 0, row: 0 }), M = Pe(), X = Pe(), $ = q(!1), _ = q(0), F = q(!0), L = q(!1), G = q(!1);
6465
+ const C = q(0), E = q(0), k = q(Il), I = q({ height: 0, width: 0 }), N = q({ height: 0, width: 0 }), A = Pe(), z = Pe(), K = q(0), P = q(null), V = q({ column: 0, row: 0 }), M = Pe(), X = Pe(), $ = q(!1), _ = q(0), F = q(!0), L = q(!1), G = q(!1);
6463
6466
  He(
6464
6467
  B(
6465
6468
  w,
@@ -6471,12 +6474,12 @@ const Pv = /* @__PURE__ */ Fe(
6471
6474
  }
6472
6475
  ), He(
6473
6476
  B(
6474
- lt(w, F, A, I, _, L),
6477
+ lt(w, F, N, I, _, L),
6475
6478
  we(([O, Y, D, U, , Q]) => O && !Y && D.height !== 0 && U.height !== 0 && !Q)
6476
6479
  ),
6477
6480
  ([, , , , O]) => {
6478
6481
  Ee(L, !0), ea(1, () => {
6479
- Ee(N, O);
6482
+ Ee(A, O);
6480
6483
  }), Ht(B(u), () => {
6481
6484
  Ee(t, [0, 0]), Ee(F, !0);
6482
6485
  });
@@ -6495,7 +6498,7 @@ const Pv = /* @__PURE__ */ Fe(
6495
6498
  we(([, O]) => O != null)
6496
6499
  ),
6497
6500
  ([, O]) => {
6498
- O && (Ee(I, O.viewport), Ee(A, O.item), Ee(V, O.gap), O.scrollTop > 0 && (Ee($, !0), Ht(B(u, On(1)), (Y) => {
6501
+ O && (Ee(I, O.viewport), Ee(N, O.item), Ee(V, O.gap), O.scrollTop > 0 && (Ee($, !0), Ht(B(u, On(1)), (Y) => {
6499
6502
  Ee($, !1);
6500
6503
  }), Ee(c, { top: O.scrollTop })));
6501
6504
  }
@@ -6509,7 +6512,7 @@ const Pv = /* @__PURE__ */ Fe(
6509
6512
  B(
6510
6513
  lt(
6511
6514
  ve(I, ao),
6512
- ve(A, ao),
6515
+ ve(N, ao),
6513
6516
  ve(V, (O, Y) => O && O.column === Y.column && O.row === Y.row),
6514
6517
  ve(u)
6515
6518
  ),
@@ -6527,7 +6530,7 @@ const Pv = /* @__PURE__ */ Fe(
6527
6530
  ve(C),
6528
6531
  r,
6529
6532
  ve(V, jv),
6530
- ve(A, ao),
6533
+ ve(N, ao),
6531
6534
  ve(I, ao),
6532
6535
  ve(P),
6533
6536
  ve(E),
@@ -6574,7 +6577,7 @@ const Pv = /* @__PURE__ */ Fe(
6574
6577
  C
6575
6578
  ), ue(
6576
6579
  B(
6577
- lt(I, A, k, V),
6580
+ lt(I, N, k, V),
6578
6581
  we(([O, Y, { items: D }]) => D.length > 0 && Y.height !== 0 && O.height !== 0),
6579
6582
  re(([O, Y, { items: D }, U]) => {
6580
6583
  const { bottom: Q, top: ke } = jl(O, U, Y, D);
@@ -6627,8 +6630,8 @@ const Pv = /* @__PURE__ */ Fe(
6627
6630
  );
6628
6631
  ue(ce, m.scrollSeekRangeChanged), ue(
6629
6632
  B(
6630
- N,
6631
- Ie(I, A, C, V),
6633
+ A,
6634
+ Ie(I, N, C, V),
6632
6635
  re(([O, Y, D, U, Q]) => {
6633
6636
  const ke = wu(O), { align: Ue, behavior: be, offset: Ne } = ke;
6634
6637
  let ze = ke.index;
@@ -6662,14 +6665,14 @@ const Pv = /* @__PURE__ */ Fe(
6662
6665
  headerHeight: s,
6663
6666
  increaseViewportBy: e,
6664
6667
  initialItemCount: E,
6665
- itemDimensions: A,
6668
+ itemDimensions: N,
6666
6669
  overscan: n,
6667
6670
  restoreStateFrom: X,
6668
6671
  scrollBy: i,
6669
6672
  scrollContainerState: a,
6670
6673
  scrollHeight: z,
6671
6674
  scrollTo: c,
6672
- scrollToIndex: N,
6675
+ scrollToIndex: A,
6673
6676
  scrollTop: u,
6674
6677
  smoothScrollTargetReached: d,
6675
6678
  totalCount: C,
@@ -6694,7 +6697,7 @@ const Pv = /* @__PURE__ */ Fe(
6694
6697
  ...S
6695
6698
  };
6696
6699
  },
6697
- Xe(na, vt, Gr, Ru, Sn, ra, yn)
6700
+ Xe(na, wt, Gr, Ru, Sn, ra, yn)
6698
6701
  );
6699
6702
  function Du(e, t, n) {
6700
6703
  return kr(1, Lo((e + n) / (Lo(t) + n)));
@@ -8866,7 +8869,7 @@ function Ul({
8866
8869
  className: t = "",
8867
8870
  allowHtml: n = !1
8868
8871
  }) {
8869
- const r = yt(() => {
8872
+ const r = vt(() => {
8870
8873
  try {
8871
8874
  if (!n) {
8872
8875
  const o = e.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, "").replace(/<iframe\b[^<]*(?:(?!<\/iframe>)<[^<]*)*<\/iframe>/gi, "").replace(/javascript:/gi, "").replace(/on\w+\s*=/gi, "");
@@ -9040,11 +9043,11 @@ var jw = "DismissableLayer", ki = "dismissableLayer.update", Pw = "dismissableLa
9040
9043
  onDismiss: a,
9041
9044
  ...c
9042
9045
  } = e, u = p.useContext(Zu), [d, f] = p.useState(null), h = (d == null ? void 0 : d.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, m] = p.useState({}), w = _e(t, (E) => f(E)), v = Array.from(u.layers), [g] = [...u.layersWithOutsidePointerEventsDisabled].slice(-1), x = v.indexOf(g), b = d ? v.indexOf(d) : -1, y = u.layersWithOutsidePointerEventsDisabled.size > 0, R = b >= x, S = Lw((E) => {
9043
- const k = E.target, I = [...u.branches].some((A) => A.contains(k));
9046
+ const k = E.target, I = [...u.branches].some((N) => N.contains(k));
9044
9047
  !R || I || (o == null || o(E), i == null || i(E), E.defaultPrevented || a == null || a());
9045
9048
  }, h), C = $w((E) => {
9046
9049
  const k = E.target;
9047
- [...u.branches].some((A) => A.contains(k)) || (s == null || s(E), i == null || i(E), E.defaultPrevented || a == null || a());
9050
+ [...u.branches].some((N) => N.contains(k)) || (s == null || s(E), i == null || i(E), E.defaultPrevented || a == null || a());
9048
9051
  }, h);
9049
9052
  return _w((E) => {
9050
9053
  b === u.layers.size - 1 && (r == null || r(E), !E.defaultPrevented && a && (E.preventDefault(), a()));
@@ -10421,7 +10424,7 @@ const Qb = H.memo(function({
10421
10424
  onCancelEdit: g,
10422
10425
  onCopy: x
10423
10426
  }) {
10424
- const [b, y] = de(!1), [R, S] = de("collapsed"), [C, E] = de(!1), { currentThreadId: k } = Po(), { toast: I } = ha(), [A, N] = de({}), [z, K] = de(!1), [P, V] = de(null), M = c === "phone" || c === "half-screen", X = t.role, $ = X === "tool", _ = !(r && X !== "user"), F = H.useMemo(() => {
10427
+ const [b, y] = de(!1), [R, S] = de("collapsed"), [C, E] = de(!1), { currentThreadId: k } = Po(), { toast: I } = ha(), [N, A] = de({}), [z, K] = de(!1), [P, V] = de(null), M = c === "phone" || c === "half-screen", X = t.role, $ = X === "tool", _ = !(r && X !== "user"), F = H.useMemo(() => {
10425
10428
  switch (X) {
10426
10429
  case "user":
10427
10430
  return "text-[hsl(var(--chat-bubble-user-text))]";
@@ -10434,18 +10437,18 @@ const Qb = H.memo(function({
10434
10437
  default:
10435
10438
  return "text-[hsl(var(--chat-bubble-ai-text))]";
10436
10439
  }
10437
- }, [X]), L = yt(() => Kb(t.content), [t.content]), G = yt(() => qb(t.content), [t.content]), Z = yt(
10440
+ }, [X]), L = vt(() => Kb(t.content), [t.content]), G = vt(() => qb(t.content), [t.content]), Z = vt(
10438
10441
  () => t.content.filter((te) => te.type === "image_url"),
10439
10442
  [t.content]
10440
- ), le = yt(
10443
+ ), le = vt(
10441
10444
  () => t.content.filter((te) => te.type === "file"),
10442
10445
  [t.content]
10443
- ), me = yt(
10446
+ ), me = vt(
10444
10447
  () => t.content.filter((te) => te.type === "interrupt"),
10445
10448
  [t.content]
10446
- ), ce = yt(() => Yb(t.content), [t.content]);
10447
- yt(() => Xb(t.content), [t.content]);
10448
- const J = yt(() => ce.length <= En ? ce : `${ce.slice(0, En)}
10449
+ ), ce = vt(() => Yb(t.content), [t.content]);
10450
+ vt(() => Xb(t.content), [t.content]);
10451
+ const J = vt(() => ce.length <= En ? ce : `${ce.slice(0, En)}
10449
10452
  … [truncated ${ce.length - En} chars]`, [ce]), O = H.useCallback(async (te = "all") => {
10450
10453
  const fe = te === "visible" && $ ? J : $ ? ce : L;
10451
10454
  async function ge(Re) {
@@ -10476,7 +10479,7 @@ const Qb = H.memo(function({
10476
10479
  te.preventDefault();
10477
10480
  return;
10478
10481
  }
10479
- if (A[fe]) {
10482
+ if (N[fe]) {
10480
10483
  te.preventDefault();
10481
10484
  return;
10482
10485
  }
@@ -10489,7 +10492,7 @@ const Qb = H.memo(function({
10489
10492
  return;
10490
10493
  }
10491
10494
  if (ge.startsWith("data:")) {
10492
- te.preventDefault(), N((Je) => ({ ...Je, [fe]: !0 }));
10495
+ te.preventDefault(), A((Je) => ({ ...Je, [fe]: !0 }));
10493
10496
  const De = `${se.name}_${se.size}_${Date.now()}`, Ge = I({ title: "Fetching file...", description: "", open: !0 });
10494
10497
  try {
10495
10498
  const Je = await Rw(k ?? void 0);
@@ -10514,13 +10517,13 @@ const Qb = H.memo(function({
10514
10517
  open: !0
10515
10518
  });
10516
10519
  } finally {
10517
- N((Je) => ({ ...Je, [fe]: !1 }));
10520
+ A((Je) => ({ ...Je, [fe]: !1 }));
10518
10521
  }
10519
10522
  }
10520
10523
  } catch (ge) {
10521
- console.error("File click error:", ge), N((Re) => ({ ...Re, [fe]: !1 }));
10524
+ console.error("File click error:", ge), A((Re) => ({ ...Re, [fe]: !1 }));
10522
10525
  }
10523
- }, [_, A, I, k]), Q = H.useCallback(() => {
10526
+ }, [_, N, I, k]), Q = H.useCallback(() => {
10524
10527
  const se = ee(M ? "h-3 w-3" : "h-4 w-4", "opacity-60 flex-shrink-0", F);
10525
10528
  switch (X) {
10526
10529
  case "user":
@@ -10639,10 +10642,10 @@ const Qb = H.memo(function({
10639
10642
  className: `inline-flex items-center gap-2 rounded px-2 py-1 text-xs bg-gray-100 border hover:bg-gray-200
10640
10643
  dark:bg-background/10 dark:border-border/30 dark:hover:bg-background/20`,
10641
10644
  children: [
10642
- A[se] ? /* @__PURE__ */ l.jsx(Tc, { className: "h-4 w-4 animate-spin" }) : null,
10645
+ N[se] ? /* @__PURE__ */ l.jsx(Tc, { className: "h-4 w-4 animate-spin" }) : null,
10643
10646
  /* @__PURE__ */ l.jsxs("span", { className: "truncate max-w-[180px]", children: [
10644
10647
  ge,
10645
- A[se] ? " (processing)" : ""
10648
+ N[se] ? " (processing)" : ""
10646
10649
  ] })
10647
10650
  ]
10648
10651
  },
@@ -10660,7 +10663,7 @@ const Qb = H.memo(function({
10660
10663
  ) : null;
10661
10664
  }, [
10662
10665
  U,
10663
- A,
10666
+ N,
10664
10667
  Ne,
10665
10668
  ze,
10666
10669
  X,
@@ -10723,7 +10726,7 @@ const Qb = H.memo(function({
10723
10726
  u,
10724
10727
  Me,
10725
10728
  F
10726
- ]), it = yt(() => Jb(t), [t]);
10729
+ ]), it = vt(() => Jb(t), [t]);
10727
10730
  return /* @__PURE__ */ l.jsxs(l.Fragment, { children: [
10728
10731
  /* @__PURE__ */ l.jsx("div", { className: ee(ke(), m.container), children: /* @__PURE__ */ l.jsxs("div", { className: ee(Ue(), m.content), children: [
10729
10732
  (i || a || $) && /* @__PURE__ */ l.jsxs(
@@ -11066,9 +11069,9 @@ const ic = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, Od = H.forwa
11066
11069
  onScrollAway: g,
11067
11070
  onAtBottom: x
11068
11071
  }, b) => {
11069
- const y = et(null), R = et(null), S = et(!1), [C, E] = de(!0), k = $e((N) => {
11070
- E(N), g && g(!N), x && x(N);
11071
- }, [g, x]), I = yt(() => {
11072
+ const y = et(null), R = et(null), S = et(!1), [C, E] = de(!0), k = $e((A) => {
11073
+ E(A), g && g(!A), x && x(A);
11074
+ }, [g, x]), I = vt(() => {
11072
11075
  if (a)
11073
11076
  return async () => {
11074
11077
  if (!S.current) {
@@ -11080,18 +11083,18 @@ const ic = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, Od = H.forwa
11080
11083
  }
11081
11084
  }
11082
11085
  };
11083
- }, [a]), A = yt(() => !w || v ? !1 : C ? "auto" : !1, [C, w, v]);
11086
+ }, [a]), N = vt(() => !w || v ? !1 : C ? "auto" : !1, [C, w, v]);
11084
11087
  return e.length === 0 ? /* @__PURE__ */ l.jsx("div", { className: f, style: h, children: /* @__PURE__ */ l.jsx("div", { className: "flex items-center justify-center py-8 text-muted-foreground text-center max-w-md mx-auto", children: m || "No messages yet. Start a conversation!" }) }) : /* @__PURE__ */ l.jsx("div", { className: f, style: h, children: /* @__PURE__ */ l.jsx(
11085
11088
  Iv,
11086
11089
  {
11087
- ref: (N) => {
11088
- y.current = N;
11090
+ ref: (A) => {
11091
+ y.current = A;
11089
11092
  },
11090
- scrollerRef: (N) => {
11091
- R.current = N instanceof HTMLDivElement ? N : null;
11093
+ scrollerRef: (A) => {
11094
+ R.current = A instanceof HTMLDivElement ? A : null;
11092
11095
  },
11093
11096
  data: e,
11094
- followOutput: A,
11097
+ followOutput: N,
11095
11098
  overscan: 200,
11096
11099
  increaseViewportBy: { top: 100, bottom: 200 },
11097
11100
  defaultItemHeight: 80,
@@ -11102,9 +11105,9 @@ const ic = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, Od = H.forwa
11102
11105
  },
11103
11106
  atBottomStateChange: k,
11104
11107
  style: { height: "100%", overscrollBehavior: "contain" },
11105
- computeItemKey: (N, z) => ic(z, N),
11106
- itemContent: (N, z) => {
11107
- const K = ic(z, N);
11108
+ computeItemKey: (A, z) => ic(z, A),
11109
+ itemContent: (A, z) => {
11110
+ const K = ic(z, A);
11108
11111
  return /* @__PURE__ */ l.jsx(
11109
11112
  "div",
11110
11113
  {
@@ -11118,7 +11121,7 @@ const ic = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, Od = H.forwa
11118
11121
  Qb,
11119
11122
  {
11120
11123
  message: z,
11121
- messageIndex: N,
11124
+ messageIndex: A,
11122
11125
  isStreamingMessage: t && n === z.id,
11123
11126
  streamingDebounceMs: r,
11124
11127
  isEditing: i === z.id,
@@ -11129,7 +11132,7 @@ const ic = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, Od = H.forwa
11129
11132
  truncateToolMessages: !1,
11130
11133
  toolMessagePreviewLength: 200,
11131
11134
  onEdit: c,
11132
- onRegenerate: () => u(N),
11135
+ onRegenerate: () => u(A),
11133
11136
  onCancelEdit: d
11134
11137
  }
11135
11138
  )
@@ -11508,7 +11511,7 @@ const yy = (e) => ({
11508
11511
  }, m = Sa(o), w = ya(m), v = await i.getDimensions(u), g = m === "y", x = g ? "top" : "left", b = g ? "bottom" : "right", y = g ? "clientHeight" : "clientWidth", R = s.reference[w] + s.reference[m] - h[m] - s.floating[w], S = h[m] - s.reference[m], C = await (i.getOffsetParent == null ? void 0 : i.getOffsetParent(u));
11509
11512
  let E = C ? C[y] : 0;
11510
11513
  (!E || !await (i.isElement == null ? void 0 : i.isElement(C))) && (E = a.floating[y] || s.floating[w]);
11511
- const k = R / 2 - S / 2, I = E / 2 - v[w] / 2 - 1, A = vn(f[x], I), N = vn(f[b], I), z = A, K = E - v[w] - N, P = E / 2 - v[w] / 2 + k, V = Ai(z, P, K), M = !c.arrow && fr(o) != null && P !== V && s.reference[w] / 2 - (P < z ? A : N) - v[w] / 2 < 0, X = M ? P < z ? P - z : P - K : 0;
11514
+ const k = R / 2 - S / 2, I = E / 2 - v[w] / 2 - 1, N = vn(f[x], I), A = vn(f[b], I), z = N, K = E - v[w] - A, P = E / 2 - v[w] / 2 + k, V = Ai(z, P, K), M = !c.arrow && fr(o) != null && P !== V && s.reference[w] / 2 - (P < z ? N : A) - v[w] / 2 < 0, X = M ? P < z ? P - z : P - K : 0;
11512
11515
  return {
11513
11516
  [m]: h[m] + X,
11514
11517
  data: {
@@ -11548,35 +11551,35 @@ const yy = (e) => ({
11548
11551
  const x = dn(o), b = Qt(a), y = dn(a) === a, R = await (c.isRTL == null ? void 0 : c.isRTL(u.floating)), S = h || (y || !v ? [Ho(a)] : py(a)), C = w !== "none";
11549
11552
  !h && C && S.push(...vy(a, v, w, R));
11550
11553
  const E = [a, ...S], k = await $r(t, g), I = [];
11551
- let A = ((r = s.flip) == null ? void 0 : r.overflows) || [];
11554
+ let N = ((r = s.flip) == null ? void 0 : r.overflows) || [];
11552
11555
  if (d && I.push(k[x]), f) {
11553
11556
  const P = hy(o, i, R);
11554
11557
  I.push(k[P[0]], k[P[1]]);
11555
11558
  }
11556
- if (A = [...A, {
11559
+ if (N = [...N, {
11557
11560
  placement: o,
11558
11561
  overflows: I
11559
11562
  }], !I.every((P) => P <= 0)) {
11560
- var N, z;
11561
- const P = (((N = s.flip) == null ? void 0 : N.index) || 0) + 1, V = E[P];
11563
+ var A, z;
11564
+ const P = (((A = s.flip) == null ? void 0 : A.index) || 0) + 1, V = E[P];
11562
11565
  if (V && (!(f === "alignment" ? b !== Qt(V) : !1) || // We leave the current main axis only if every placement on that axis
11563
11566
  // overflows the main axis.
11564
- A.every(($) => Qt($.placement) === b ? $.overflows[0] > 0 : !0)))
11567
+ N.every(($) => Qt($.placement) === b ? $.overflows[0] > 0 : !0)))
11565
11568
  return {
11566
11569
  data: {
11567
11570
  index: P,
11568
- overflows: A
11571
+ overflows: N
11569
11572
  },
11570
11573
  reset: {
11571
11574
  placement: V
11572
11575
  }
11573
11576
  };
11574
- let M = (z = A.filter((X) => X.overflows[0] <= 0).sort((X, $) => X.overflows[1] - $.overflows[1])[0]) == null ? void 0 : z.placement;
11577
+ let M = (z = N.filter((X) => X.overflows[0] <= 0).sort((X, $) => X.overflows[1] - $.overflows[1])[0]) == null ? void 0 : z.placement;
11575
11578
  if (!M)
11576
11579
  switch (m) {
11577
11580
  case "bestFit": {
11578
11581
  var K;
11579
- const X = (K = A.filter(($) => {
11582
+ const X = (K = N.filter(($) => {
11580
11583
  if (C) {
11581
11584
  const _ = Qt($.placement);
11582
11585
  return _ === b || // Create a bias to the `y` side axis due to horizontal
@@ -11827,8 +11830,8 @@ const Ry = function(e) {
11827
11830
  const b = v - d.top - d.bottom, y = w - d.left - d.right, R = vn(v - d[g], b), S = vn(w - d[x], y), C = !t.middlewareData.shift;
11828
11831
  let E = R, k = S;
11829
11832
  if ((n = t.middlewareData.shift) != null && n.enabled.x && (k = y), (r = t.middlewareData.shift) != null && r.enabled.y && (E = b), C && !h) {
11830
- const A = kt(d.left, 0), N = kt(d.right, 0), z = kt(d.top, 0), K = kt(d.bottom, 0);
11831
- m ? k = w - 2 * (A !== 0 || N !== 0 ? A + N : kt(d.left, d.right)) : E = v - 2 * (z !== 0 || K !== 0 ? z + K : kt(d.top, d.bottom));
11833
+ const N = kt(d.left, 0), A = kt(d.right, 0), z = kt(d.top, 0), K = kt(d.bottom, 0);
11834
+ m ? k = w - 2 * (N !== 0 || A !== 0 ? N + A : kt(d.left, d.right)) : E = v - 2 * (z !== 0 || K !== 0 ? z + K : kt(d.top, d.bottom));
11832
11835
  }
11833
11836
  await c({
11834
11837
  ...t,
@@ -12414,7 +12417,7 @@ function u0(e) {
12414
12417
  $ !== C.current && (C.current = $, v($));
12415
12418
  }, []), y = p.useCallback(($) => {
12416
12419
  $ !== E.current && (E.current = $, x($));
12417
- }, []), R = s || w, S = i || g, C = p.useRef(null), E = p.useRef(null), k = p.useRef(d), I = c != null, A = ai(c), N = ai(o), z = ai(u), K = p.useCallback(() => {
12420
+ }, []), R = s || w, S = i || g, C = p.useRef(null), E = p.useRef(null), k = p.useRef(d), I = c != null, N = ai(c), A = ai(o), z = ai(u), K = p.useCallback(() => {
12418
12421
  if (!C.current || !E.current)
12419
12422
  return;
12420
12423
  const $ = {
@@ -12422,7 +12425,7 @@ function u0(e) {
12422
12425
  strategy: n,
12423
12426
  middleware: h
12424
12427
  };
12425
- N.current && ($.platform = N.current), a0(C.current, E.current, $).then((_) => {
12428
+ A.current && ($.platform = A.current), a0(C.current, E.current, $).then((_) => {
12426
12429
  const F = {
12427
12430
  ..._,
12428
12431
  // The floating element's position may be recomputed while it's closed
@@ -12435,7 +12438,7 @@ function u0(e) {
12435
12438
  f(F);
12436
12439
  }));
12437
12440
  });
12438
- }, [h, t, n, N, z]);
12441
+ }, [h, t, n, A, z]);
12439
12442
  Ao(() => {
12440
12443
  u === !1 && k.current.isPositioned && (k.current.isPositioned = !1, f(($) => ({
12441
12444
  ...$,
@@ -12447,11 +12450,11 @@ function u0(e) {
12447
12450
  P.current = !1;
12448
12451
  }), []), Ao(() => {
12449
12452
  if (R && (C.current = R), S && (E.current = S), R && S) {
12450
- if (A.current)
12451
- return A.current(R, S, K);
12453
+ if (N.current)
12454
+ return N.current(R, S, K);
12452
12455
  K();
12453
12456
  }
12454
- }, [R, S, K, A, I]);
12457
+ }, [R, S, K, N, I]);
12455
12458
  const V = p.useMemo(() => ({
12456
12459
  reference: C,
12457
12460
  floating: E,
@@ -12604,9 +12607,9 @@ var Ia = "PopperContent", [S0, C0] = Gd(Ia), Qd = p.forwardRef(
12604
12607
  updatePositionStrategy: m = "optimized",
12605
12608
  onPlaced: w,
12606
12609
  ...v
12607
- } = e, g = Yd(Ia, n), [x, b] = p.useState(null), y = _e(t, (ke) => b(ke)), [R, S] = p.useState(null), C = qd(R), E = (C == null ? void 0 : C.width) ?? 0, k = (C == null ? void 0 : C.height) ?? 0, I = r + (s !== "center" ? "-" + s : ""), A = typeof d == "number" ? d : { top: 0, right: 0, bottom: 0, left: 0, ...d }, N = Array.isArray(u) ? u : [u], z = N.length > 0, K = {
12608
- padding: A,
12609
- boundary: N.filter(R0),
12610
+ } = e, g = Yd(Ia, n), [x, b] = p.useState(null), y = _e(t, (ke) => b(ke)), [R, S] = p.useState(null), C = qd(R), E = (C == null ? void 0 : C.width) ?? 0, k = (C == null ? void 0 : C.height) ?? 0, I = r + (s !== "center" ? "-" + s : ""), N = typeof d == "number" ? d : { top: 0, right: 0, bottom: 0, left: 0, ...d }, A = Array.isArray(u) ? u : [u], z = A.length > 0, K = {
12611
+ padding: N,
12612
+ boundary: A.filter(R0),
12610
12613
  // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
12611
12614
  altBoundary: z
12612
12615
  }, { refs: P, floatingStyles: V, placement: M, isPositioned: X, middlewareData: $ } = u0({
@@ -12833,9 +12836,9 @@ var j0 = p.forwardRef((e, t) => {
12833
12836
  onFocus: ae(e.onFocus, (k) => {
12834
12837
  const I = !S.current;
12835
12838
  if (k.target === k.currentTarget && I && !x) {
12836
- const A = new CustomEvent(li, k0);
12837
- if (k.currentTarget.dispatchEvent(A), !A.defaultPrevented) {
12838
- const N = R().filter((M) => M.focusable), z = N.find((M) => M.active), K = N.find((M) => M.id === v), V = [z, K, ...N].filter(
12839
+ const N = new CustomEvent(li, k0);
12840
+ if (k.currentTarget.dispatchEvent(N), !N.defaultPrevented) {
12841
+ const A = R().filter((M) => M.focusable), z = A.find((M) => M.active), K = A.find((M) => M.id === v), V = [z, K, ...A].filter(
12839
12842
  Boolean
12840
12843
  ).map((M) => M.ref.current);
12841
12844
  hf(V, d);
@@ -13047,11 +13050,11 @@ var $t = "MenuContent", [Y0, _a] = Vn($t), bf = p.forwardRef(
13047
13050
  onDismiss: m,
13048
13051
  disableOutsideScroll: w,
13049
13052
  ...v
13050
- } = e, g = Kn($t, n), x = Zr($t, n), b = Ts(n), y = gf(n), R = U0(n), [S, C] = p.useState(null), E = p.useRef(null), k = _e(t, E, g.onContentChange), I = p.useRef(0), A = p.useRef(""), N = p.useRef(0), z = p.useRef(null), K = p.useRef("right"), P = p.useRef(0), V = w ? ps : p.Fragment, M = w ? { as: Z0, allowPinchZoom: !0 } : void 0, X = (_) => {
13053
+ } = e, g = Kn($t, n), x = Zr($t, n), b = Ts(n), y = gf(n), R = U0(n), [S, C] = p.useState(null), E = p.useRef(null), k = _e(t, E, g.onContentChange), I = p.useRef(0), N = p.useRef(""), A = p.useRef(0), z = p.useRef(null), K = p.useRef("right"), P = p.useRef(0), V = w ? ps : p.Fragment, M = w ? { as: Z0, allowPinchZoom: !0 } : void 0, X = (_) => {
13051
13054
  var J, O;
13052
- const F = A.current + _, L = R().filter((Y) => !Y.disabled), G = document.activeElement, Z = (J = L.find((Y) => Y.ref.current === G)) == null ? void 0 : J.textValue, le = L.map((Y) => Y.textValue), me = uS(le, F, Z), ce = (O = L.find((Y) => Y.textValue === me)) == null ? void 0 : O.ref.current;
13055
+ const F = N.current + _, L = R().filter((Y) => !Y.disabled), G = document.activeElement, Z = (J = L.find((Y) => Y.ref.current === G)) == null ? void 0 : J.textValue, le = L.map((Y) => Y.textValue), me = uS(le, F, Z), ce = (O = L.find((Y) => Y.textValue === me)) == null ? void 0 : O.ref.current;
13053
13056
  (function Y(D) {
13054
- A.current = D, window.clearTimeout(I.current), D !== "" && (I.current = window.setTimeout(() => Y(""), 1e3));
13057
+ N.current = D, window.clearTimeout(I.current), D !== "" && (I.current = window.setTimeout(() => Y(""), 1e3));
13055
13058
  })(F), ce && setTimeout(() => ce.focus());
13056
13059
  };
13057
13060
  p.useEffect(() => () => window.clearTimeout(I.current), []), pa();
@@ -13063,7 +13066,7 @@ var $t = "MenuContent", [Y0, _a] = Vn($t), bf = p.forwardRef(
13063
13066
  Y0,
13064
13067
  {
13065
13068
  scope: n,
13066
- searchRef: A,
13069
+ searchRef: N,
13067
13070
  onItemEnter: p.useCallback(
13068
13071
  (_) => {
13069
13072
  $(_) && _.preventDefault();
@@ -13083,7 +13086,7 @@ var $t = "MenuContent", [Y0, _a] = Vn($t), bf = p.forwardRef(
13083
13086
  },
13084
13087
  [$]
13085
13088
  ),
13086
- pointerGraceTimerRef: N,
13089
+ pointerGraceTimerRef: A,
13087
13090
  onPointerGraceIntentChange: p.useCallback((_) => {
13088
13091
  z.current = _;
13089
13092
  }, []),
@@ -13143,7 +13146,7 @@ var $t = "MenuContent", [Y0, _a] = Vn($t), bf = p.forwardRef(
13143
13146
  pf.includes(_.key) && ce.reverse(), lS(ce);
13144
13147
  }),
13145
13148
  onBlur: ae(e.onBlur, (_) => {
13146
- _.currentTarget.contains(_.target) || (window.clearTimeout(I.current), A.current = "");
13149
+ _.currentTarget.contains(_.target) || (window.clearTimeout(I.current), N.current = "");
13147
13150
  }),
13148
13151
  onPointerMove: ae(
13149
13152
  e.onPointerMove,
@@ -13507,7 +13510,7 @@ function Br(e) {
13507
13510
  var hS = xf, pS = Na, mS = wf, gS = bf, xS = Pa, vS = yf, wS = Rs, bS = Cf, yS = Rf, SS = kf, CS = Nf, TS = Af, RS = _f, ES = Pf, kS = Mf, Es = "DropdownMenu", [IS, UT] = on(
13508
13511
  Es,
13509
13512
  [mf]
13510
- ), wt = mf(), [NS, Lf] = IS(Es), $f = (e) => {
13513
+ ), bt = mf(), [NS, Lf] = IS(Es), $f = (e) => {
13511
13514
  const {
13512
13515
  __scopeDropdownMenu: t,
13513
13516
  children: n,
@@ -13516,7 +13519,7 @@ var hS = xf, pS = Na, mS = wf, gS = bf, xS = Pa, vS = yf, wS = Rs, bS = Cf, yS =
13516
13519
  defaultOpen: s,
13517
13520
  onOpenChange: i,
13518
13521
  modal: a = !0
13519
- } = e, c = wt(t), u = p.useRef(null), [d, f] = Mn({
13522
+ } = e, c = bt(t), u = p.useRef(null), [d, f] = Mn({
13520
13523
  prop: o,
13521
13524
  defaultProp: s ?? !1,
13522
13525
  onChange: i,
@@ -13540,7 +13543,7 @@ var hS = xf, pS = Na, mS = wf, gS = bf, xS = Pa, vS = yf, wS = Rs, bS = Cf, yS =
13540
13543
  $f.displayName = Es;
13541
13544
  var Ff = "DropdownMenuTrigger", zf = p.forwardRef(
13542
13545
  (e, t) => {
13543
- const { __scopeDropdownMenu: n, disabled: r = !1, ...o } = e, s = Lf(Ff, n), i = wt(n);
13546
+ const { __scopeDropdownMenu: n, disabled: r = !1, ...o } = e, s = Lf(Ff, n), i = bt(n);
13544
13547
  return /* @__PURE__ */ l.jsx(pS, { asChild: !0, ...i, children: /* @__PURE__ */ l.jsx(
13545
13548
  Se.button,
13546
13549
  {
@@ -13566,13 +13569,13 @@ var Ff = "DropdownMenuTrigger", zf = p.forwardRef(
13566
13569
  );
13567
13570
  zf.displayName = Ff;
13568
13571
  var AS = "DropdownMenuPortal", Bf = (e) => {
13569
- const { __scopeDropdownMenu: t, ...n } = e, r = wt(t);
13572
+ const { __scopeDropdownMenu: t, ...n } = e, r = bt(t);
13570
13573
  return /* @__PURE__ */ l.jsx(mS, { ...r, ...n });
13571
13574
  };
13572
13575
  Bf.displayName = AS;
13573
13576
  var Hf = "DropdownMenuContent", Uf = p.forwardRef(
13574
13577
  (e, t) => {
13575
- const { __scopeDropdownMenu: n, ...r } = e, o = Lf(Hf, n), s = wt(n), i = p.useRef(!1);
13578
+ const { __scopeDropdownMenu: n, ...r } = e, o = Lf(Hf, n), s = bt(n), i = p.useRef(!1);
13576
13579
  return /* @__PURE__ */ l.jsx(
13577
13580
  gS,
13578
13581
  {
@@ -13604,64 +13607,64 @@ var Hf = "DropdownMenuContent", Uf = p.forwardRef(
13604
13607
  Uf.displayName = Hf;
13605
13608
  var _S = "DropdownMenuGroup", jS = p.forwardRef(
13606
13609
  (e, t) => {
13607
- const { __scopeDropdownMenu: n, ...r } = e, o = wt(n);
13610
+ const { __scopeDropdownMenu: n, ...r } = e, o = bt(n);
13608
13611
  return /* @__PURE__ */ l.jsx(xS, { ...o, ...r, ref: t });
13609
13612
  }
13610
13613
  );
13611
13614
  jS.displayName = _S;
13612
13615
  var PS = "DropdownMenuLabel", Wf = p.forwardRef(
13613
13616
  (e, t) => {
13614
- const { __scopeDropdownMenu: n, ...r } = e, o = wt(n);
13617
+ const { __scopeDropdownMenu: n, ...r } = e, o = bt(n);
13615
13618
  return /* @__PURE__ */ l.jsx(vS, { ...o, ...r, ref: t });
13616
13619
  }
13617
13620
  );
13618
13621
  Wf.displayName = PS;
13619
13622
  var OS = "DropdownMenuItem", Vf = p.forwardRef(
13620
13623
  (e, t) => {
13621
- const { __scopeDropdownMenu: n, ...r } = e, o = wt(n);
13624
+ const { __scopeDropdownMenu: n, ...r } = e, o = bt(n);
13622
13625
  return /* @__PURE__ */ l.jsx(wS, { ...o, ...r, ref: t });
13623
13626
  }
13624
13627
  );
13625
13628
  Vf.displayName = OS;
13626
13629
  var MS = "DropdownMenuCheckboxItem", Kf = p.forwardRef((e, t) => {
13627
- const { __scopeDropdownMenu: n, ...r } = e, o = wt(n);
13630
+ const { __scopeDropdownMenu: n, ...r } = e, o = bt(n);
13628
13631
  return /* @__PURE__ */ l.jsx(bS, { ...o, ...r, ref: t });
13629
13632
  });
13630
13633
  Kf.displayName = MS;
13631
13634
  var DS = "DropdownMenuRadioGroup", LS = p.forwardRef((e, t) => {
13632
- const { __scopeDropdownMenu: n, ...r } = e, o = wt(n);
13635
+ const { __scopeDropdownMenu: n, ...r } = e, o = bt(n);
13633
13636
  return /* @__PURE__ */ l.jsx(yS, { ...o, ...r, ref: t });
13634
13637
  });
13635
13638
  LS.displayName = DS;
13636
13639
  var $S = "DropdownMenuRadioItem", qf = p.forwardRef((e, t) => {
13637
- const { __scopeDropdownMenu: n, ...r } = e, o = wt(n);
13640
+ const { __scopeDropdownMenu: n, ...r } = e, o = bt(n);
13638
13641
  return /* @__PURE__ */ l.jsx(SS, { ...o, ...r, ref: t });
13639
13642
  });
13640
13643
  qf.displayName = $S;
13641
13644
  var FS = "DropdownMenuItemIndicator", Gf = p.forwardRef((e, t) => {
13642
- const { __scopeDropdownMenu: n, ...r } = e, o = wt(n);
13645
+ const { __scopeDropdownMenu: n, ...r } = e, o = bt(n);
13643
13646
  return /* @__PURE__ */ l.jsx(CS, { ...o, ...r, ref: t });
13644
13647
  });
13645
13648
  Gf.displayName = FS;
13646
13649
  var zS = "DropdownMenuSeparator", Yf = p.forwardRef((e, t) => {
13647
- const { __scopeDropdownMenu: n, ...r } = e, o = wt(n);
13650
+ const { __scopeDropdownMenu: n, ...r } = e, o = bt(n);
13648
13651
  return /* @__PURE__ */ l.jsx(TS, { ...o, ...r, ref: t });
13649
13652
  });
13650
13653
  Yf.displayName = zS;
13651
13654
  var BS = "DropdownMenuArrow", HS = p.forwardRef(
13652
13655
  (e, t) => {
13653
- const { __scopeDropdownMenu: n, ...r } = e, o = wt(n);
13656
+ const { __scopeDropdownMenu: n, ...r } = e, o = bt(n);
13654
13657
  return /* @__PURE__ */ l.jsx(RS, { ...o, ...r, ref: t });
13655
13658
  }
13656
13659
  );
13657
13660
  HS.displayName = BS;
13658
13661
  var US = "DropdownMenuSubTrigger", Xf = p.forwardRef((e, t) => {
13659
- const { __scopeDropdownMenu: n, ...r } = e, o = wt(n);
13662
+ const { __scopeDropdownMenu: n, ...r } = e, o = bt(n);
13660
13663
  return /* @__PURE__ */ l.jsx(ES, { ...o, ...r, ref: t });
13661
13664
  });
13662
13665
  Xf.displayName = US;
13663
13666
  var WS = "DropdownMenuSubContent", Jf = p.forwardRef((e, t) => {
13664
- const { __scopeDropdownMenu: n, ...r } = e, o = wt(n);
13667
+ const { __scopeDropdownMenu: n, ...r } = e, o = bt(n);
13665
13668
  return /* @__PURE__ */ l.jsx(
13666
13669
  kS,
13667
13670
  {
@@ -13820,8 +13823,8 @@ function ci({
13820
13823
  lastCheckpointNs: E,
13821
13824
  listCheckpoints: k,
13822
13825
  navigateToCheckpoint: I,
13823
- returnToLatest: A,
13824
- hasMoreHistory: N,
13826
+ returnToLatest: N,
13827
+ hasMoreHistory: A,
13825
13828
  isLoadingHistory: z,
13826
13829
  loadOlderMessages: K,
13827
13830
  api: P
@@ -13871,13 +13874,13 @@ function ci({
13871
13874
  C && (nt(C), te(E ?? null));
13872
13875
  }, [C, E]);
13873
13876
  const qn = $e(async () => {
13874
- if (!(!N || z))
13877
+ if (!(!A || z))
13875
13878
  try {
13876
13879
  await K();
13877
13880
  } catch (ie) {
13878
13881
  console.warn("loadOlderMessages failed", ie);
13879
13882
  }
13880
- }, [N, z, K]);
13883
+ }, [A, z, K]);
13881
13884
  tt(() => {
13882
13885
  (async () => {
13883
13886
  if (!P.baseUrl) {
@@ -13985,7 +13988,7 @@ function ci({
13985
13988
  fe(!0);
13986
13989
  try {
13987
13990
  if (!ie) {
13988
- await A(), nt(null), te(null);
13991
+ await N(), nt(null), te(null);
13989
13992
  return;
13990
13993
  }
13991
13994
  const xe = ze.find((Ze) => Ze.checkpointId === ie), je = (xe == null ? void 0 : xe.checkpointNs) ?? null;
@@ -14221,13 +14224,13 @@ var Da = "ScrollArea", [lh, WT] = on(Da), [rC, zt] = lh(Da), ch = p.forwardRef(
14221
14224
  dir: o,
14222
14225
  scrollHideDelay: s = 600,
14223
14226
  ...i
14224
- } = e, [a, c] = p.useState(null), [u, d] = p.useState(null), [f, h] = p.useState(null), [m, w] = p.useState(null), [v, g] = p.useState(null), [x, b] = p.useState(0), [y, R] = p.useState(0), [S, C] = p.useState(!1), [E, k] = p.useState(!1), I = _e(t, (N) => c(N)), A = ws(o);
14227
+ } = e, [a, c] = p.useState(null), [u, d] = p.useState(null), [f, h] = p.useState(null), [m, w] = p.useState(null), [v, g] = p.useState(null), [x, b] = p.useState(0), [y, R] = p.useState(0), [S, C] = p.useState(!1), [E, k] = p.useState(!1), I = _e(t, (A) => c(A)), N = ws(o);
14225
14228
  return /* @__PURE__ */ l.jsx(
14226
14229
  rC,
14227
14230
  {
14228
14231
  scope: n,
14229
14232
  type: r,
14230
- dir: A,
14233
+ dir: N,
14231
14234
  scrollHideDelay: s,
14232
14235
  scrollArea: a,
14233
14236
  viewport: u,
@@ -14247,7 +14250,7 @@ var Da = "ScrollArea", [lh, WT] = on(Da), [rC, zt] = lh(Da), ch = p.forwardRef(
14247
14250
  children: /* @__PURE__ */ l.jsx(
14248
14251
  Se.div,
14249
14252
  {
14250
- dir: A,
14253
+ dir: N,
14251
14254
  ...i,
14252
14255
  ref: I,
14253
14256
  style: {
@@ -14546,14 +14549,14 @@ var oC = p.forwardRef((e, t) => {
14546
14549
  } = e, m = zt(an, n), [w, v] = p.useState(null), g = _e(t, (I) => v(I)), x = p.useRef(null), b = p.useRef(""), y = m.viewport, R = r.content - r.viewport, S = ft(d), C = ft(c), E = Is(f, 10);
14547
14550
  function k(I) {
14548
14551
  if (x.current) {
14549
- const A = I.clientX - x.current.left, N = I.clientY - x.current.top;
14550
- u({ x: A, y: N });
14552
+ const N = I.clientX - x.current.left, A = I.clientY - x.current.top;
14553
+ u({ x: N, y: A });
14551
14554
  }
14552
14555
  }
14553
14556
  return p.useEffect(() => {
14554
- const I = (A) => {
14555
- const N = A.target;
14556
- (w == null ? void 0 : w.contains(N)) && S(A, R);
14557
+ const I = (N) => {
14558
+ const A = N.target;
14559
+ (w == null ? void 0 : w.contains(A)) && S(N, R);
14557
14560
  };
14558
14561
  return document.addEventListener("wheel", I, { passive: !1 }), () => document.removeEventListener("wheel", I, { passive: !1 });
14559
14562
  }, [y, w, R, S]), p.useEffect(C, [r, C]), ar(w, E), ar(m.content, E), /* @__PURE__ */ l.jsx(
@@ -14577,8 +14580,8 @@ var oC = p.forwardRef((e, t) => {
14577
14580
  }),
14578
14581
  onPointerMove: ae(e.onPointerMove, k),
14579
14582
  onPointerUp: ae(e.onPointerUp, (I) => {
14580
- const A = I.target;
14581
- A.hasPointerCapture(I.pointerId) && A.releasePointerCapture(I.pointerId), document.body.style.webkitUserSelect = b.current, m.viewport && (m.viewport.style.scrollBehavior = ""), x.current = null;
14583
+ const N = I.target;
14584
+ N.hasPointerCapture(I.pointerId) && N.releasePointerCapture(I.pointerId), document.body.style.webkitUserSelect = b.current, m.viewport && (m.viewport.style.scrollBehavior = ""), x.current = null;
14582
14585
  })
14583
14586
  }
14584
14587
  )
@@ -14776,13 +14779,13 @@ function wc({
14776
14779
  tt(() => {
14777
14780
  y(h ?? []);
14778
14781
  }, [h]);
14779
- const A = async (_) => {
14782
+ const N = async (_) => {
14780
14783
  try {
14781
14784
  await f(_), a == null || a(_), c == null || c(_);
14782
14785
  } catch (F) {
14783
14786
  console.error("Failed to select thread:", F);
14784
14787
  }
14785
- }, N = async () => {
14788
+ }, A = async () => {
14786
14789
  try {
14787
14790
  I(!0);
14788
14791
  const _ = await w();
@@ -14825,7 +14828,7 @@ function wc({
14825
14828
  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(
14826
14829
  Le,
14827
14830
  {
14828
- onClick: N,
14831
+ onClick: A,
14829
14832
  disabled: k || x,
14830
14833
  className: s.createButton || "p-2",
14831
14834
  size: "sm",
@@ -14848,7 +14851,7 @@ function wc({
14848
14851
  ] }) : b.slice().sort((_, F) => new Date(F.updatedAt || F.createdAt || "").getTime() - new Date(_.updatedAt || _.createdAt || "").getTime()).map((_) => /* @__PURE__ */ l.jsxs(
14849
14852
  "div",
14850
14853
  {
14851
- onClick: () => A(_.threadId),
14854
+ onClick: () => N(_.threadId),
14852
14855
  className: `group relative p-3 rounded-lg cursor-pointer transition-colors border ${(i ?? m) === _.threadId ? `${s.activeThread || "bg-slate-600 border-slate-500"} ` : `${s.threadItem || "bg-slate-700 border-slate-600 hover:bg-slate-600 text-gray-900 dark:text-slate-100"}`} ${s.threadItem || ""} text-gray-900 dark:text-slate-100`,
14853
14856
  children: [
14854
14857
  /* @__PURE__ */ l.jsxs("div", { className: "flex items-center justify-between", children: [
@@ -15182,12 +15185,12 @@ var NC = [" ", "Enter", "ArrowUp", "ArrowDown"], AC = [" ", "Enter"], $n = "Sele
15182
15185
  defaultProp: o ?? !1,
15183
15186
  onChange: s,
15184
15187
  caller: $n
15185
- }), [I, A] = Mn({
15188
+ }), [I, N] = Mn({
15186
15189
  prop: i,
15187
15190
  defaultProp: a,
15188
15191
  onChange: c,
15189
15192
  caller: $n
15190
- }), N = p.useRef(null), z = g ? w || !!g.closest("form") : !0, [K, P] = p.useState(/* @__PURE__ */ new Set()), V = Array.from(K).map((M) => M.props.value).join(";");
15193
+ }), A = p.useRef(null), z = g ? w || !!g.closest("form") : !0, [K, P] = p.useState(/* @__PURE__ */ new Set()), V = Array.from(K).map((M) => M.props.value).join(";");
15191
15194
  return /* @__PURE__ */ l.jsx(rf, { ...v, children: /* @__PURE__ */ l.jsxs(
15192
15195
  jC,
15193
15196
  {
@@ -15201,11 +15204,11 @@ var NC = [" ", "Enter", "ArrowUp", "ArrowDown"], AC = [" ", "Enter"], $n = "Sele
15201
15204
  onValueNodeHasChildrenChange: S,
15202
15205
  contentId: en(),
15203
15206
  value: I,
15204
- onValueChange: A,
15207
+ onValueChange: N,
15205
15208
  open: E,
15206
15209
  onOpenChange: k,
15207
15210
  dir: C,
15208
- triggerPointerDownPosRef: N,
15211
+ triggerPointerDownPosRef: A,
15209
15212
  disabled: h,
15210
15213
  children: [
15211
15214
  /* @__PURE__ */ l.jsx(As.Provider, { scope: t, children: /* @__PURE__ */ l.jsx(
@@ -15233,7 +15236,7 @@ var NC = [" ", "Enter", "ArrowUp", "ArrowDown"], AC = [" ", "Enter"], $n = "Sele
15233
15236
  name: d,
15234
15237
  autoComplete: f,
15235
15238
  value: I,
15236
- onChange: (M) => A(M.target.value),
15239
+ onChange: (M) => N(M.target.value),
15237
15240
  disabled: h,
15238
15241
  form: w,
15239
15242
  children: [
@@ -15356,7 +15359,7 @@ var Bt = 10, [Wh, Tn] = pr(Fn), LC = "SelectContentImpl", $C = or("SelectContent
15356
15359
  avoidCollisions: g,
15357
15360
  //
15358
15361
  ...x
15359
- } = e, b = Cn(Fn, n), [y, R] = p.useState(null), [S, C] = p.useState(null), E = _e(t, (J) => R(J)), [k, I] = p.useState(null), [A, N] = p.useState(
15362
+ } = e, b = Cn(Fn, n), [y, R] = p.useState(null), [S, C] = p.useState(null), E = _e(t, (J) => R(J)), [k, I] = p.useState(null), [N, A] = p.useState(
15360
15363
  null
15361
15364
  ), z = _s(n), [K, P] = p.useState(!1), V = p.useRef(!1);
15362
15365
  p.useEffect(() => {
@@ -15411,7 +15414,7 @@ var Bt = 10, [Wh, Tn] = pr(Fn), LC = "SelectContentImpl", $C = or("SelectContent
15411
15414
  ), Z = p.useCallback(() => y == null ? void 0 : y.focus(), [y]), le = p.useCallback(
15412
15415
  (J, O, Y) => {
15413
15416
  const D = !V.current && !Y;
15414
- (b.value !== void 0 && b.value === O || D) && N(J);
15417
+ (b.value !== void 0 && b.value === O || D) && A(J);
15415
15418
  },
15416
15419
  [b.value]
15417
15420
  ), me = r === "popper" ? Li : Kh, ce = me === Li ? {
@@ -15438,7 +15441,7 @@ var Bt = 10, [Wh, Tn] = pr(Fn), LC = "SelectContentImpl", $C = or("SelectContent
15438
15441
  onItemLeave: Z,
15439
15442
  itemTextRefCallback: le,
15440
15443
  focusSelectedItem: X,
15441
- selectedItemText: A,
15444
+ selectedItemText: N,
15442
15445
  position: r,
15443
15446
  isPositioned: K,
15444
15447
  searchRef: F,
@@ -15508,9 +15511,9 @@ Vh.displayName = LC;
15508
15511
  var FC = "SelectItemAlignedPosition", Kh = p.forwardRef((e, t) => {
15509
15512
  const { __scopeSelect: n, onPlaced: r, ...o } = e, s = Cn(Fn, n), i = Tn(Fn, n), [a, c] = p.useState(null), [u, d] = p.useState(null), f = _e(t, (E) => d(E)), h = _s(n), m = p.useRef(!1), w = p.useRef(!0), { viewport: v, selectedItem: g, selectedItemText: x, focusSelectedItem: b } = i, y = p.useCallback(() => {
15510
15513
  if (s.trigger && s.valueNode && a && u && v && g && x) {
15511
- const E = s.trigger.getBoundingClientRect(), k = u.getBoundingClientRect(), I = s.valueNode.getBoundingClientRect(), A = x.getBoundingClientRect();
15514
+ const E = s.trigger.getBoundingClientRect(), k = u.getBoundingClientRect(), I = s.valueNode.getBoundingClientRect(), N = x.getBoundingClientRect();
15512
15515
  if (s.dir !== "rtl") {
15513
- const U = A.left - k.left, Q = I.left - U, ke = E.left - Q, Ue = E.width + ke, be = Math.max(Ue, k.width), Ne = window.innerWidth - Bt, ze = Di(Q, [
15516
+ const U = N.left - k.left, Q = I.left - U, ke = E.left - Q, Ue = E.width + ke, be = Math.max(Ue, k.width), Ne = window.innerWidth - Bt, ze = Di(Q, [
15514
15517
  Bt,
15515
15518
  // Prevents the content from going off the starting edge of the
15516
15519
  // viewport. It may still go off the ending edge, but this can be
@@ -15521,15 +15524,15 @@ var FC = "SelectItemAlignedPosition", Kh = p.forwardRef((e, t) => {
15521
15524
  ]);
15522
15525
  a.style.minWidth = Ue + "px", a.style.left = ze + "px";
15523
15526
  } else {
15524
- const U = k.right - A.right, Q = window.innerWidth - I.right - U, ke = window.innerWidth - E.right - Q, Ue = E.width + ke, be = Math.max(Ue, k.width), Ne = window.innerWidth - Bt, ze = Di(Q, [
15527
+ const U = k.right - N.right, Q = window.innerWidth - I.right - U, ke = window.innerWidth - E.right - Q, Ue = E.width + ke, be = Math.max(Ue, k.width), Ne = window.innerWidth - Bt, ze = Di(Q, [
15525
15528
  Bt,
15526
15529
  Math.max(Bt, Ne - be)
15527
15530
  ]);
15528
15531
  a.style.minWidth = Ue + "px", a.style.right = ze + "px";
15529
15532
  }
15530
- const N = h(), z = window.innerHeight - Bt * 2, K = v.scrollHeight, P = window.getComputedStyle(u), V = parseInt(P.borderTopWidth, 10), M = parseInt(P.paddingTop, 10), X = parseInt(P.borderBottomWidth, 10), $ = parseInt(P.paddingBottom, 10), _ = V + M + K + $ + X, F = Math.min(g.offsetHeight * 5, _), L = window.getComputedStyle(v), G = parseInt(L.paddingTop, 10), Z = parseInt(L.paddingBottom, 10), le = E.top + E.height / 2 - Bt, me = z - le, ce = g.offsetHeight / 2, J = g.offsetTop + ce, O = V + M + J, Y = _ - O;
15533
+ const A = h(), z = window.innerHeight - Bt * 2, K = v.scrollHeight, P = window.getComputedStyle(u), V = parseInt(P.borderTopWidth, 10), M = parseInt(P.paddingTop, 10), X = parseInt(P.borderBottomWidth, 10), $ = parseInt(P.paddingBottom, 10), _ = V + M + K + $ + X, F = Math.min(g.offsetHeight * 5, _), L = window.getComputedStyle(v), G = parseInt(L.paddingTop, 10), Z = parseInt(L.paddingBottom, 10), le = E.top + E.height / 2 - Bt, me = z - le, ce = g.offsetHeight / 2, J = g.offsetTop + ce, O = V + M + J, Y = _ - O;
15531
15534
  if (O <= le) {
15532
- const U = N.length > 0 && g === N[N.length - 1].ref.current;
15535
+ const U = A.length > 0 && g === A[A.length - 1].ref.current;
15533
15536
  a.style.bottom = "0px";
15534
15537
  const Q = u.clientHeight - v.offsetTop - v.offsetHeight, ke = Math.max(
15535
15538
  me,
@@ -15538,7 +15541,7 @@ var FC = "SelectItemAlignedPosition", Kh = p.forwardRef((e, t) => {
15538
15541
  ), Ue = O + ke;
15539
15542
  a.style.height = Ue + "px";
15540
15543
  } else {
15541
- const U = N.length > 0 && g === N[0].ref.current;
15544
+ const U = A.length > 0 && g === A[0].ref.current;
15542
15545
  a.style.top = "0px";
15543
15546
  const ke = Math.max(
15544
15547
  le,