teodor-new-chat-ui 3.0.188 → 3.0.189

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 vp = Object.defineProperty;
2
2
  var wp = (e, t, n) => t in e ? vp(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
3
  var Oa = (e, t, n) => wp(e, typeof t != "symbol" ? t + "" : t, n);
4
4
  import * as p from "react";
5
- import B, { useState as me, useRef as rt, useCallback as Ye, useEffect as ct, useReducer as bp, useMemo as Yt, createContext as yp, useContext as Sp, createElement as co, useLayoutEffect as Cp } from "react";
5
+ import B, { useState as me, useRef as rt, useCallback as Ye, useEffect as pt, useReducer as bp, useMemo as Ut, createContext as yp, useContext as Sp, createElement as co, useLayoutEffect as Cp } from "react";
6
6
  import { Square as Tp, Send as Rp, X as rr, ExternalLink as kp, Download as Ep, Image as Ip, FileText as Ma, Loader as gc, Bot as Da, Wrench as Np, User as Ap, Paperclip as ni, ChevronUp as kr, ChevronDown as nr, Copy as La, Edit as $a, RotateCcw as ri, ChevronRight as _p, Check as Mi, Circle as jp, Edit3 as xc, Loader2 as Pp, Plus as Op, FileSpreadsheet as Mp, MessageSquarePlus as Dp, MessageSquare as Lp, Calendar as $p, Trash2 as Fp, Settings as zp, Server as Bp, EyeOff as Hp, Eye as Up, Layout as Wp, MessageCircle as Vp, Save as Kp } from "lucide-react";
7
7
  import { Slot as qp, createSlot as lr } from "@radix-ui/react-slot";
8
8
  import { cva as qo } from "class-variance-authority";
@@ -72,16 +72,16 @@ function Jp() {
72
72
  Ge.unshift("Warning: " + U), Function.prototype.apply.call(console[T], console, Ge);
73
73
  }
74
74
  }
75
- var R = !1, S = !1, C = !1, k = !1, E = !1, N;
76
- N = Symbol.for("react.module.reference");
75
+ var R = !1, S = !1, C = !1, k = !1, E = !1, I;
76
+ I = Symbol.for("react.module.reference");
77
77
  function _(T) {
78
78
  return !!(typeof T == "string" || typeof T == "function" || T === r || T === s || E || T === o || T === u || T === d || k || 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
- T.$$typeof === N || T.getModuleId !== void 0));
82
+ T.$$typeof === I || T.getModuleId !== void 0));
83
83
  }
84
- function I(T, U, ne) {
84
+ function N(T, U, ne) {
85
85
  var Se = T.displayName;
86
86
  if (Se)
87
87
  return Se;
@@ -121,7 +121,7 @@ function Jp() {
121
121
  var ne = T;
122
122
  return F(ne._context) + ".Provider";
123
123
  case c:
124
- return I(T, T.render, "ForwardRef");
124
+ return N(T, T.render, "ForwardRef");
125
125
  case f:
126
126
  var Se = T.displayName || null;
127
127
  return Se !== null ? Se : V(T.type) || "Memo";
@@ -332,7 +332,7 @@ function Jp() {
332
332
  } else
333
333
  Ze.setExtraStackFrame(null);
334
334
  }
335
- function dt(T, U, ne, Se, Ve) {
335
+ function ut(T, U, ne, Se, Ve) {
336
336
  {
337
337
  var Ge = Function.call.bind(ke);
338
338
  for (var ze in T)
@@ -351,9 +351,9 @@ function Jp() {
351
351
  }
352
352
  }
353
353
  }
354
- var ft = Array.isArray;
354
+ var dt = Array.isArray;
355
355
  function ce(T) {
356
- return ft(T);
356
+ return dt(T);
357
357
  }
358
358
  function ue(T) {
359
359
  {
@@ -469,7 +469,7 @@ function Jp() {
469
469
  return xt(T, Oe, St, Ve, Se, Ue.current, ze);
470
470
  }
471
471
  }
472
- var ht = x.ReactCurrentOwner, Rt = x.ReactDebugCurrentFrame;
472
+ var ft = x.ReactCurrentOwner, Rt = x.ReactDebugCurrentFrame;
473
473
  function te(T) {
474
474
  if (T) {
475
475
  var U = T._owner, ne = ve(T.type, T._source, U ? U.type : null);
@@ -484,8 +484,8 @@ function Jp() {
484
484
  }
485
485
  function Fe() {
486
486
  {
487
- if (ht.current) {
488
- var T = V(ht.current.type);
487
+ if (ft.current) {
488
+ var T = V(ft.current.type);
489
489
  if (T)
490
490
  return `
491
491
 
@@ -520,7 +520,7 @@ Check the top-level render call using <` + ne + ">.");
520
520
  return;
521
521
  _t[ne] = !0;
522
522
  var Se = "";
523
- T && T._owner && T._owner !== ht.current && (Se = " It was passed a child from " + V(T._owner.type) + "."), te(T), w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', ne, Se), te(null);
523
+ T && T._owner && T._owner !== ft.current && (Se = " It was passed a child from " + V(T._owner.type) + "."), te(T), w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', ne, Se), te(null);
524
524
  }
525
525
  }
526
526
  function yr(T, U) {
@@ -558,7 +558,7 @@ Check the top-level render call using <` + ne + ">.");
558
558
  return;
559
559
  if (ne) {
560
560
  var Se = V(U);
561
- dt(ne, T.props, "prop", Se, T);
561
+ ut(ne, T.props, "prop", Se, T);
562
562
  } else if (U.PropTypes !== void 0 && !pe) {
563
563
  pe = !0;
564
564
  var Ve = V(U);
@@ -1865,9 +1865,9 @@ const Lc = (e) => {
1865
1865
  onUploadProgress: C,
1866
1866
  responseType: k,
1867
1867
  headers: E,
1868
- withCredentials: N = "same-origin",
1868
+ withCredentials: I = "same-origin",
1869
1869
  fetchOptions: _
1870
- } = Lc(b), I = t || fetch;
1870
+ } = Lc(b), N = t || fetch;
1871
1871
  k = k ? (k + "").toLowerCase() : "text";
1872
1872
  let F = pg([w, y && y.toAbortSignal()], R), V = null;
1873
1873
  const P = F && F.unsubscribe && (() => {
@@ -1889,7 +1889,7 @@ const Lc = (e) => {
1889
1889
  x = Ya(J.body, Xa, M, Z);
1890
1890
  }
1891
1891
  }
1892
- A.isString(N) || (N = N ? "include" : "omit");
1892
+ A.isString(I) || (I = I ? "include" : "omit");
1893
1893
  const W = s && "credentials" in n.prototype, K = {
1894
1894
  ..._,
1895
1895
  signal: F,
@@ -1897,10 +1897,10 @@ const Lc = (e) => {
1897
1897
  headers: E.normalize().toJSON(),
1898
1898
  body: x,
1899
1899
  duplex: "half",
1900
- credentials: W ? N : void 0
1900
+ credentials: W ? I : void 0
1901
1901
  };
1902
1902
  V = s && new n(v, K);
1903
- let D = await (s ? I(V, _) : I(v, K));
1903
+ let D = await (s ? N(V, _) : N(v, K));
1904
1904
  const O = d && (k === "stream" || k === "response");
1905
1905
  if (d && (S || O && P)) {
1906
1906
  const J = {};
@@ -2398,29 +2398,29 @@ function sl(e) {
2398
2398
  function Eg(e) {
2399
2399
  return ui.add(e), () => ui.delete(e);
2400
2400
  }
2401
- const Kt = it.create({
2401
+ const qt = it.create({
2402
2402
  // Only set baseURL when configured — do NOT fall back to localhost. Falling back causes
2403
2403
  // noisy network requests to the frontend Dev server when the backend isn't configured.
2404
2404
  ...ol ? { baseURL: ol } : {},
2405
2405
  timeout: 3e4,
2406
2406
  withCredentials: !0
2407
2407
  });
2408
- Kt.interceptors.request.use((e) => (No && (e.headers.Authorization = `Bearer ${No}`), e));
2409
- Kt.interceptors.response.use(
2408
+ qt.interceptors.request.use((e) => (No && (e.headers.Authorization = `Bearer ${No}`), e));
2409
+ qt.interceptors.response.use(
2410
2410
  (e) => e,
2411
2411
  (e) => Promise.reject(e)
2412
2412
  );
2413
2413
  async function Ht(e, t) {
2414
- return Kt.defaults.baseURL ? (await Kt.get(e, t)).data : Promise.reject(new Error("API base URL is not configured"));
2414
+ return qt.defaults.baseURL ? (await qt.get(e, t)).data : Promise.reject(new Error("API base URL is not configured"));
2415
2415
  }
2416
2416
  async function Ig(e, t, n) {
2417
- return Kt.defaults.baseURL ? (await Kt.post(e, t, n)).data : Promise.reject(new Error("API base URL is not configured"));
2417
+ return qt.defaults.baseURL ? (await qt.post(e, t, n)).data : Promise.reject(new Error("API base URL is not configured"));
2418
2418
  }
2419
2419
  async function Ng(e, t, n) {
2420
- return Kt.defaults.baseURL ? (await Kt.put(e, t, n)).data : Promise.reject(new Error("API base URL is not configured"));
2420
+ return qt.defaults.baseURL ? (await qt.put(e, t, n)).data : Promise.reject(new Error("API base URL is not configured"));
2421
2421
  }
2422
2422
  async function Ag(e, t) {
2423
- return Kt.defaults.baseURL ? (await Kt.delete(e, t)).data : Promise.reject(new Error("API base URL is not configured"));
2423
+ return qt.defaults.baseURL ? (await qt.delete(e, t)).data : Promise.reject(new Error("API base URL is not configured"));
2424
2424
  }
2425
2425
  function zt(e) {
2426
2426
  return e && typeof e == "object" && "data" in e ? e.data : e;
@@ -2428,11 +2428,11 @@ function zt(e) {
2428
2428
  class _g {
2429
2429
  // ---- Configuration ----
2430
2430
  get baseUrl() {
2431
- const t = Kt.defaults.baseURL || "";
2431
+ const t = qt.defaults.baseURL || "";
2432
2432
  return String(t).replace(/\/+$|^\s+|\s+$/g, "");
2433
2433
  }
2434
2434
  updateConfig(t) {
2435
- t.baseUrl && (Kt.defaults.baseURL = String(t.baseUrl).replace(/\/+$/g, "")), t.authToken !== void 0 && sl(t.authToken);
2435
+ t.baseUrl && (qt.defaults.baseURL = String(t.baseUrl).replace(/\/+$/g, "")), t.authToken !== void 0 && sl(t.authToken);
2436
2436
  }
2437
2437
  // ---- Token Management ----
2438
2438
  getAuthToken() {
@@ -2521,15 +2521,15 @@ class _g {
2521
2521
  }
2522
2522
  const zn = new _g();
2523
2523
  function jg(e = {}) {
2524
- const t = e.baseUrl ?? "/api/chat", n = e.streamPath ?? "/runs/stream", [r, o] = me(e.token ?? null), s = rt(e.headers ?? {}), [i, a] = me(!1), [c, u] = me(null), [d, f] = me(""), [h, m] = me(null), [b, v] = me(0), [g, x] = me(!1), w = rt(null), y = rt(!0), R = rt(0), S = Ye((N) => {
2525
- o(N);
2524
+ const t = e.baseUrl ?? "/api/chat", n = e.streamPath ?? "/runs/stream", [r, o] = me(e.token ?? null), s = rt(e.headers ?? {}), [i, a] = me(!1), [c, u] = me(null), [d, f] = me(""), [h, m] = me(null), [b, v] = me(0), [g, x] = me(!1), w = rt(null), y = rt(!0), R = rt(0), S = Ye((I) => {
2525
+ o(I);
2526
2526
  }, []), C = Ye(() => {
2527
- var N;
2528
- (N = w.current) == null || N.abort(), w.current = null, a(!1), x(!1);
2527
+ var I;
2528
+ (I = w.current) == null || I.abort(), w.current = null, a(!1), x(!1);
2529
2529
  }, []), k = Ye(() => {
2530
2530
  f(""), m(null), u(null);
2531
2531
  }, []), E = Ye(
2532
- (N, _, I) => {
2532
+ (I, _, N) => {
2533
2533
  w.current && (w.current.abort(), w.current = null), a(!0), u(null), e.autoAppendAssistant !== !1 && f("");
2534
2534
  const F = new AbortController();
2535
2535
  return w.current = F, (async () => {
@@ -2555,8 +2555,8 @@ function jg(e = {}) {
2555
2555
  const ke = window.__AUTH_TOKEN__, Be = ((P = window.localStorage) == null ? void 0 : P.getItem("authToken")) || null;
2556
2556
  let Ze = null;
2557
2557
  try {
2558
- const dt = (G = window.localStorage) == null ? void 0 : G.getItem("chat-settings");
2559
- dt && (Ze = ((W = JSON.parse(dt)) == null ? void 0 : W.apiKey) || null);
2558
+ const ut = (G = window.localStorage) == null ? void 0 : G.getItem("chat-settings");
2559
+ ut && (Ze = ((W = JSON.parse(ut)) == null ? void 0 : W.apiKey) || null);
2560
2560
  } catch {
2561
2561
  }
2562
2562
  const qe = ke || Be || Ze || null;
@@ -2567,7 +2567,7 @@ function jg(e = {}) {
2567
2567
  console.debug(
2568
2568
  "[use-chat] POST",
2569
2569
  t + n,
2570
- V(N)
2570
+ V(I)
2571
2571
  );
2572
2572
  const M = await fetch(t + n, {
2573
2573
  method: "POST",
@@ -2577,7 +2577,7 @@ function jg(e = {}) {
2577
2577
  ...ee,
2578
2578
  ...s.current
2579
2579
  },
2580
- body: JSON.stringify(N),
2580
+ body: JSON.stringify(I),
2581
2581
  signal: F.signal
2582
2582
  });
2583
2583
  if (!M.ok || !M.body) {
@@ -2607,21 +2607,21 @@ function jg(e = {}) {
2607
2607
  var ve;
2608
2608
  if (Date.now() - oe > 2e4) {
2609
2609
  const ke = "Stream idle timeout";
2610
- u(ke), F.abort(), (ve = I == null ? void 0 : I.onError) == null || ve.call(I, ke);
2610
+ u(ke), F.abort(), (ve = N == null ? void 0 : N.onError) == null || ve.call(N, ke);
2611
2611
  }
2612
2612
  }, 5e3), De = 1024 * 1024;
2613
2613
  try {
2614
2614
  const ve = M.headers.get("X-Thread-Id") || M.headers.get("x-thread-id"), ke = M.headers.get("X-Thread-Created") || M.headers.get("x-thread-created"), Be = ve ?? null, Ze = String(ke ?? "").toLowerCase() === "true";
2615
- for ((K = I == null ? void 0 : I.onOpen) == null || K.call(I, { threadId: Be, created: Ze }); ; ) {
2616
- const { value: qe, done: dt } = await Z.read();
2617
- if (dt) break;
2615
+ for ((K = N == null ? void 0 : N.onOpen) == null || K.call(N, { threadId: Be, created: Ze }); ; ) {
2616
+ const { value: qe, done: ut } = await Z.read();
2617
+ if (ut) break;
2618
2618
  fe += Re.decode(qe, { stream: !0 }), fe.length > De && (fe = "", console.warn("Stream buffer reset: exceeded 1MB"));
2619
- let ft;
2620
- for (; (ft = fe.indexOf(`
2619
+ let dt;
2620
+ for (; (dt = fe.indexOf(`
2621
2621
 
2622
2622
  `)) >= 0; ) {
2623
- const ce = fe.slice(0, ft);
2624
- fe = fe.slice(ft + 2);
2623
+ const ce = fe.slice(0, dt);
2624
+ fe = fe.slice(dt + 2);
2625
2625
  const ue = Og(ce);
2626
2626
  if (!ue) continue;
2627
2627
  let he;
@@ -2636,7 +2636,7 @@ function jg(e = {}) {
2636
2636
  const Pe = ye.seq;
2637
2637
  if (Pe !== void 0) {
2638
2638
  if (Pe <= j) continue;
2639
- j > 0 && Pe > j + 1 && ((D = I == null ? void 0 : I.onGap) == null || D.call(I, { from: j, to: Pe })), j = Pe, R.current = Pe, v(Pe);
2639
+ j > 0 && Pe > j + 1 && ((D = N == null ? void 0 : N.onGap) == null || D.call(N, { from: j, to: Pe })), j = Pe, R.current = Pe, v(Pe);
2640
2640
  }
2641
2641
  if (ye.type === "token" && e.autoAppendAssistant !== !1)
2642
2642
  L.push(ye.content), le();
@@ -2651,7 +2651,7 @@ function jg(e = {}) {
2651
2651
  } catch (ve) {
2652
2652
  if (ve.name !== "AbortError") {
2653
2653
  const ke = ve.message || String(ve);
2654
- u(ke), (O = I == null ? void 0 : I.onError) == null || O.call(I, ke);
2654
+ u(ke), (O = N == null ? void 0 : N.onError) == null || O.call(N, ke);
2655
2655
  }
2656
2656
  } finally {
2657
2657
  try {
@@ -2665,7 +2665,7 @@ function jg(e = {}) {
2665
2665
  } catch (ee) {
2666
2666
  if (ee.name !== "AbortError") {
2667
2667
  const M = ee.message || String(ee);
2668
- u(M), (J = I == null ? void 0 : I.onError) == null || J.call(I, M);
2668
+ u(M), (J = N == null ? void 0 : N.onError) == null || J.call(N, M);
2669
2669
  }
2670
2670
  } finally {
2671
2671
  a(!1), x(!1), w.current = null;
@@ -2674,9 +2674,9 @@ function jg(e = {}) {
2674
2674
  },
2675
2675
  [t, n, r, e.autoAppendAssistant]
2676
2676
  );
2677
- return ct(() => () => {
2678
- var N;
2679
- y.current = !1, (N = w.current) == null || N.abort();
2677
+ return pt(() => () => {
2678
+ var I;
2679
+ y.current = !1, (I = w.current) == null || I.abort();
2680
2680
  }, []), {
2681
2681
  isStreaming: i,
2682
2682
  error: c,
@@ -2780,10 +2780,10 @@ function Lg(e = []) {
2780
2780
  }, [i]), c = Ye((d) => {
2781
2781
  r.current.push(d), a();
2782
2782
  }, [a]);
2783
- ct(() => () => {
2783
+ pt(() => () => {
2784
2784
  o.current !== null && typeof window < "u" && window.cancelAnimationFrame(o.current), s.current !== null && clearTimeout(s.current), r.current = [];
2785
2785
  }, []);
2786
- const u = Yt(() => ({
2786
+ const u = Ut(() => ({
2787
2787
  reset: (d) => n({ type: "reset", payload: { messages: d } }),
2788
2788
  seed: (d, f) => n({ type: "seed", payload: { messages: d, ...f ?? {} } }),
2789
2789
  prepend: (d) => n({ type: "prepend", payload: { messages: d } }),
@@ -2975,7 +2975,7 @@ async function Vg(e, t = [], n, r, o, s) {
2975
2975
  const Wc = yp(null);
2976
2976
  function Ms({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialThreadId: o = null, autoLoadInitial: s = !0, disableAutoRestore: i = !1, enableFileAgentRouting: a = !1, fileAgentId: c = "invoice_reader" }) {
2977
2977
  const u = zn;
2978
- ct(() => {
2978
+ pt(() => {
2979
2979
  t && u.updateConfig({
2980
2980
  baseUrl: t.baseUrl,
2981
2981
  authToken: t.apiKey
@@ -2990,7 +2990,7 @@ function Ms({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
2990
2990
  // Ensure the path matches the chat endpoint
2991
2991
  streamPath: "/chat/runs/stream"
2992
2992
  }), [v, g] = me(() => typeof u.getAuthToken == "function" ? u.getAuthToken() : null);
2993
- ct(() => {
2993
+ pt(() => {
2994
2994
  b(typeof u.getAuthToken == "function" ? u.getAuthToken() : null);
2995
2995
  const $ = u.onTokenChange((Y) => {
2996
2996
  g(Y), b(Y);
@@ -3001,7 +3001,7 @@ function Ms({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
3001
3001
  }, [u, b]);
3002
3002
  const x = Ye(($) => {
3003
3003
  u.setAuthToken($);
3004
- }, [u]), { state: w, seed: y, prepend: R, pushUser: S, onEvent: C, reset: k } = Lg(), E = 20, [N, _] = me(!1), [I, F] = me(!1), [V, P] = me(null), [G, W] = me(void 0), [K, D] = me(void 0), O = rt(!1), ie = rt([]), J = rt(null), ee = Ye(($) => {
3004
+ }, [u]), { state: w, seed: y, prepend: R, pushUser: S, onEvent: C, reset: k } = Lg(), E = 20, [I, _] = me(!1), [N, F] = me(!1), [V, P] = me(null), [G, W] = me(void 0), [K, D] = me(void 0), O = rt(!1), ie = rt([]), J = rt(null), ee = Ye(($) => {
3005
3005
  $.cursor !== void 0 && P($.cursor), $.hasMore !== void 0 && _($.hasMore), $.checkpointId !== void 0 && W($.checkpointId), $.checkpointNs !== void 0 && D($.checkpointNs);
3006
3006
  }, []), M = Ye(($, Y) => new Promise((Ae, tt) => {
3007
3007
  const Ne = async () => {
@@ -3049,36 +3049,36 @@ function Ms({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
3049
3049
  "/api/v2/chat/health"
3050
3050
  ], Lt = async (xt) => {
3051
3051
  try {
3052
- const At = new AbortController(), ht = setTimeout(() => At.abort(), tt), Rt = await fetch(xt, { method: "GET", signal: At.signal });
3053
- return clearTimeout(ht), Rt.ok;
3052
+ const At = new AbortController(), ft = setTimeout(() => At.abort(), tt), Rt = await fetch(xt, { method: "GET", signal: At.signal });
3053
+ return clearTimeout(ft), Rt.ok;
3054
3054
  } catch {
3055
3055
  return !1;
3056
3056
  }
3057
3057
  }, _n = async (xt) => {
3058
3058
  try {
3059
- const At = new AbortController(), ht = setTimeout(() => At.abort(), tt), Rt = await fetch(xt, { method: "HEAD", signal: At.signal });
3060
- return clearTimeout(ht), Rt.ok;
3059
+ const At = new AbortController(), ft = setTimeout(() => At.abort(), tt), Rt = await fetch(xt, { method: "HEAD", signal: At.signal });
3060
+ return clearTimeout(ft), Rt.ok;
3061
3061
  } catch {
3062
3062
  return !1;
3063
3063
  }
3064
3064
  };
3065
3065
  for (let xt = 0; xt < Y; xt++) {
3066
3066
  console.debug(`[ChatProvider] health-check attempt ${xt + 1}/${Y}`);
3067
- for (const ht of at) {
3068
- let Rt = ht;
3069
- Ne.endsWith("/api") && ht.startsWith("/api") && (Rt = ht.replace(/^\/api/, "") || "/");
3067
+ for (const ft of at) {
3068
+ let Rt = ft;
3069
+ Ne.endsWith("/api") && ft.startsWith("/api") && (Rt = ft.replace(/^\/api/, "") || "/");
3070
3070
  const te = Rt === "/" ? Ne + "/" : Ne + Rt;
3071
- if (console.debug(`[ChatProvider] checking ${te}`), await Lt(te) || ht === "/" && await _n(Ne + "/"))
3071
+ if (console.debug(`[ChatProvider] checking ${te}`), await Lt(te) || ft === "/" && await _n(Ne + "/"))
3072
3072
  return le(!0), !0;
3073
3073
  }
3074
3074
  const At = Ae * Math.pow(2, xt);
3075
- await new Promise((ht) => setTimeout(ht, At));
3075
+ await new Promise((ft) => setTimeout(ft, At));
3076
3076
  }
3077
3077
  return le(!1), !1;
3078
3078
  },
3079
3079
  [u.baseUrl]
3080
3080
  );
3081
- ct(() => {
3081
+ pt(() => {
3082
3082
  let $ = !0;
3083
3083
  if (!u.baseUrl) {
3084
3084
  console.debug("[ChatProvider] skipping initial refreshThreads: api.baseUrl not configured");
@@ -3095,11 +3095,11 @@ function Ms({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
3095
3095
  })(), () => {
3096
3096
  $ = !1;
3097
3097
  };
3098
- }, [H, u.baseUrl, oe]), ct(() => {
3098
+ }, [H, u.baseUrl, oe]), pt(() => {
3099
3099
  r == null || r(L);
3100
3100
  }, [L, r]);
3101
3101
  const $e = rt(null);
3102
- ct(() => {
3102
+ pt(() => {
3103
3103
  if (o && s) {
3104
3104
  if (!u.baseUrl) {
3105
3105
  console.debug("[ChatProvider] skipping initial load: api.baseUrl not configured");
@@ -3175,10 +3175,10 @@ function Ms({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
3175
3175
  }, [u, L, Z, M, ee]), qe = Ye(async () => {
3176
3176
  if (!L) throw new Error("No active thread");
3177
3177
  await ke(L);
3178
- }, [L, ke]), dt = rt(!1);
3179
- ct(() => {
3180
- const $ = dt.current;
3181
- dt.current = d, $ && !d && L && M(async () => {
3178
+ }, [L, ke]), ut = rt(!1);
3179
+ pt(() => {
3180
+ const $ = ut.current;
3181
+ ut.current = d, $ && !d && L && M(async () => {
3182
3182
  try {
3183
3183
  await H();
3184
3184
  } catch (Y) {
@@ -3186,7 +3186,7 @@ function Ms({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
3186
3186
  }
3187
3187
  }, "postStreamingRefresh");
3188
3188
  }, [d, L, u, Z, H, M]);
3189
- const ft = Ye(async () => {
3189
+ const dt = Ye(async () => {
3190
3190
  console.log("[ChatProvider] 🔄 clearCurrentThread called"), console.log("[ChatProvider] 📊 Before clear - currentThreadId:", L), console.log("[ChatProvider] 📊 Before clear - messages count:", w.messages.length), L && (J.current = L, console.log(`[ChatProvider] 🚫 Suppressing next auto-load for thread: ${L}`)), await M(() => (console.log("[ChatProvider] 🚀 Executing atomic clear operation"), j(null), k([]), ee({
3191
3191
  cursor: null,
3192
3192
  hasMore: !1,
@@ -3194,10 +3194,10 @@ function Ms({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
3194
3194
  checkpointNs: void 0
3195
3195
  }), typeof window < "u" && localStorage.removeItem("currentThreadId"), console.log("[ChatProvider] ✅ Atomic clear operation completed"), Promise.resolve()), "clearCurrentThread"), console.log("[ChatProvider] 📊 After clear - currentThreadId should be null");
3196
3196
  }, [k, ee, L, w.messages.length, M]), ce = Ye(async ($) => {
3197
- ft();
3197
+ dt();
3198
3198
  const Y = await u.createThread($);
3199
3199
  return await H(), await ke(Y.threadId), Y.threadId;
3200
- }, [u, H, ke, ft]), ue = Ye(async ($) => {
3200
+ }, [u, H, ke, dt]), ue = Ye(async ($) => {
3201
3201
  await u.deleteThread($), await H(), L === $ && (j(null), k([]), _(!1), P(null), W(void 0), D(void 0));
3202
3202
  }, [u, H, L, k]), he = Ye(async ($, Y) => {
3203
3203
  await u.updateThread($, Y), await H();
@@ -3221,7 +3221,7 @@ function Ms({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
3221
3221
  const _n = {
3222
3222
  ...Lt,
3223
3223
  content: at
3224
- }, xt = { ...(Y == null ? void 0 : Y.payloadExtras) ?? {} }, At = !!xt.edit, ht = xt.originalMessageId, Rt = typeof ht == "string" ? ht : void 0, te = Ae && Ae.length > 0, pe = {
3224
+ }, xt = { ...(Y == null ? void 0 : Y.payloadExtras) ?? {} }, At = !!xt.edit, ft = xt.originalMessageId, Rt = typeof ft == "string" ? ft : void 0, te = Ae && Ae.length > 0, pe = {
3225
3225
  ...L ? { threadId: L } : {},
3226
3226
  payload: {
3227
3227
  messages: [_n],
@@ -3253,7 +3253,7 @@ function Ms({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
3253
3253
  }, [L, S, h, C, w.lastCheckpointId, w.lastCheckpointNs, u, t == null ? void 0 : t.uploadPath, H, j, a, c, w.messages.length]), Pe = Ye(
3254
3254
  async ($) => {
3255
3255
  if (!L) throw new Error("No active thread");
3256
- if (I || !N) return;
3256
+ if (N || !I) return;
3257
3257
  const Y = V;
3258
3258
  if (Y) {
3259
3259
  F(!0);
@@ -3271,7 +3271,7 @@ function Ms({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
3271
3271
  }
3272
3272
  }
3273
3273
  },
3274
- [u, L, G, K, V, N, I, Z, E]
3274
+ [u, L, G, K, V, I, N, Z, E]
3275
3275
  ), Ue = {
3276
3276
  baseUrl: u.baseUrl,
3277
3277
  token: v,
@@ -3286,8 +3286,8 @@ function Ms({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
3286
3286
  lastCheckpointId: w.lastCheckpointId,
3287
3287
  lastCheckpointNs: w.lastCheckpointNs,
3288
3288
  streamingAssistantId: w.assemblingId,
3289
- hasMoreHistory: N,
3290
- isLoadingHistory: I,
3289
+ hasMoreHistory: I,
3290
+ isLoadingHistory: N,
3291
3291
  loadOlderMessages: Pe,
3292
3292
  historyPageSize: E,
3293
3293
  listCheckpoints: Be,
@@ -3298,7 +3298,7 @@ function Ms({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
3298
3298
  deleteThread: ue,
3299
3299
  renameThread: he,
3300
3300
  loadThread: ke,
3301
- clearCurrentThread: ft,
3301
+ clearCurrentThread: dt,
3302
3302
  send: ye,
3303
3303
  stop: m
3304
3304
  };
@@ -3392,10 +3392,10 @@ function qg({
3392
3392
  const w = B.useCallback(
3393
3393
  async (E) => {
3394
3394
  E && E.preventDefault();
3395
- const N = (h ?? "").trim();
3396
- !N && !f || v(() => {
3395
+ const I = (h ?? "").trim();
3396
+ !I && !f || v(() => {
3397
3397
  try {
3398
- const _ = i(N);
3398
+ const _ = i(I);
3399
3399
  _ && typeof _.then == "function" ? _.then(() => {
3400
3400
  m(""), g.current && (g.current.style.height = "auto");
3401
3401
  }).catch(() => {
@@ -3668,7 +3668,7 @@ function nx(e) {
3668
3668
  };
3669
3669
  return n(e);
3670
3670
  }
3671
- function ut(...e) {
3671
+ function ct(...e) {
3672
3672
  const t = Le(), n = new Array(e.length);
3673
3673
  let r = 0;
3674
3674
  const o = Math.pow(2, e.length) - 1;
@@ -3906,7 +3906,7 @@ function Jt(e, t, n = "k") {
3906
3906
  return Jt(e.l, t, n);
3907
3907
  }
3908
3908
  function Pt(e, t, n) {
3909
- return Xe(e) ? Qc(t, n, 1) : t === e.k ? pt(e, { k: t, v: n }) : t < e.k ? fl(pt(e, { l: Pt(e.l, t, n) })) : fl(pt(e, { r: Pt(e.r, t, n) }));
3909
+ return Xe(e) ? Qc(t, n, 1) : t === e.k ? ht(e, { k: t, v: n }) : t < e.k ? fl(ht(e, { l: Pt(e.l, t, n) })) : fl(ht(e, { r: Pt(e.r, t, n) }));
3910
3910
  }
3911
3911
  function or() {
3912
3912
  return jr;
@@ -3927,9 +3927,9 @@ function fi(e, t) {
3927
3927
  return r;
3928
3928
  {
3929
3929
  const [s, i] = Zc(r);
3930
- return po(pt(e, { k: s, l: Jc(r), v: i }));
3930
+ return po(ht(e, { k: s, l: Jc(r), v: i }));
3931
3931
  }
3932
- } else return t < n ? po(pt(e, { l: fi(r, t) })) : po(pt(e, { r: fi(o, t) }));
3932
+ } else return t < n ? po(ht(e, { l: fi(r, t) })) : po(ht(e, { r: fi(o, t) }));
3933
3933
  }
3934
3934
  function Dn(e) {
3935
3935
  return Xe(e) ? [] : [...Dn(e.l), { k: e.k, v: e.v }, ...Dn(e.r)];
@@ -3947,12 +3947,12 @@ function po(e) {
3947
3947
  return e;
3948
3948
  if (n > r.lvl + 1) {
3949
3949
  if (Ds(t))
3950
- return eu(pt(e, { lvl: n - 1 }));
3950
+ return eu(ht(e, { lvl: n - 1 }));
3951
3951
  if (!Xe(t) && !Xe(t.r))
3952
- return pt(t.r, {
3953
- l: pt(t, { r: t.r.l }),
3952
+ return ht(t.r, {
3953
+ l: ht(t, { r: t.r.l }),
3954
3954
  lvl: n,
3955
- r: pt(e, {
3955
+ r: ht(e, {
3956
3956
  l: t.r.r,
3957
3957
  lvl: n - 1
3958
3958
  })
@@ -3960,22 +3960,22 @@ function po(e) {
3960
3960
  throw new Error("Unexpected empty nodes");
3961
3961
  } else {
3962
3962
  if (Ds(e))
3963
- return pi(pt(e, { lvl: n - 1 }));
3963
+ return pi(ht(e, { lvl: n - 1 }));
3964
3964
  if (!Xe(r) && !Xe(r.l)) {
3965
3965
  const o = r.l, s = Ds(o) ? r.lvl - 1 : r.lvl;
3966
- return pt(o, {
3967
- l: pt(e, {
3966
+ return ht(o, {
3967
+ l: ht(e, {
3968
3968
  lvl: n - 1,
3969
3969
  r: o.l
3970
3970
  }),
3971
3971
  lvl: o.lvl + 1,
3972
- r: pi(pt(r, { l: o.r, lvl: s }))
3972
+ r: pi(ht(r, { l: o.r, lvl: s }))
3973
3973
  });
3974
3974
  } else
3975
3975
  throw new Error("Unexpected empty nodes");
3976
3976
  }
3977
3977
  }
3978
- function pt(e, t) {
3978
+ function ht(e, t) {
3979
3979
  return Qc(
3980
3980
  t.k !== void 0 ? t.k : e.k,
3981
3981
  t.v !== void 0 ? t.v : e.v,
@@ -3985,7 +3985,7 @@ function pt(e, t) {
3985
3985
  );
3986
3986
  }
3987
3987
  function Jc(e) {
3988
- return Xe(e.r) ? e.l : po(pt(e, { r: Jc(e.r) }));
3988
+ return Xe(e.r) ? e.l : po(ht(e, { r: Jc(e.r) }));
3989
3989
  }
3990
3990
  function Ds(e) {
3991
3991
  return Xe(e) || e.lvl > e.r.lvl;
@@ -4001,11 +4001,11 @@ function fl(e) {
4001
4001
  }
4002
4002
  function eu(e) {
4003
4003
  const { l: t } = e;
4004
- return !Xe(t) && t.lvl === e.lvl ? pt(t, { r: pt(e, { l: t.r }) }) : e;
4004
+ return !Xe(t) && t.lvl === e.lvl ? ht(t, { r: ht(e, { l: t.r }) }) : e;
4005
4005
  }
4006
4006
  function pi(e) {
4007
4007
  const { lvl: t, r: n } = e;
4008
- return !Xe(n) && !Xe(n.r) && n.lvl === t && n.r.lvl === t ? pt(n, { l: pt(e, { r: n.l }), lvl: t + 1 }) : e;
4008
+ return !Xe(n) && !Xe(n.r) && n.lvl === t && n.r.lvl === t ? ht(n, { l: ht(e, { r: n.l }), lvl: t + 1 }) : e;
4009
4009
  }
4010
4010
  function ax(e) {
4011
4011
  return Xc(e, ({ k: t, v: n }) => ({ index: t, value: n }));
@@ -4206,7 +4206,7 @@ const vx = {
4206
4206
  be((S) => S.length > 0),
4207
4207
  _e(v, m),
4208
4208
  re(([S, C, k]) => {
4209
- const E = S.reduce((N, _, I) => Pt(N, _, Mr(_, C.offsetTree, k) || I), or());
4209
+ const E = S.reduce((I, _, N) => Pt(I, _, Mr(_, C.offsetTree, k) || N), or());
4210
4210
  return {
4211
4211
  ...C,
4212
4212
  groupIndices: S,
@@ -4290,11 +4290,11 @@ const vx = {
4290
4290
  s,
4291
4291
  _e(v),
4292
4292
  re(([S, C]) => {
4293
- const k = C.groupIndices.length > 0, E = [], N = C.lastSize;
4293
+ const k = C.groupIndices.length > 0, E = [], I = C.lastSize;
4294
4294
  if (k) {
4295
4295
  const _ = Pr(C.sizeTree, 0);
4296
- let I = 0, F = 0;
4297
- for (; I < S; ) {
4296
+ let N = 0, F = 0;
4297
+ for (; N < S; ) {
4298
4298
  const P = C.groupIndices[F], G = C.groupIndices.length === F + 1 ? 1 / 0 : C.groupIndices[F + 1] - P - 1;
4299
4299
  E.push({
4300
4300
  endIndex: P,
@@ -4302,12 +4302,12 @@ const vx = {
4302
4302
  startIndex: P
4303
4303
  }), E.push({
4304
4304
  endIndex: P + 1 + G - 1,
4305
- size: N,
4305
+ size: I,
4306
4306
  startIndex: P + 1
4307
- }), F++, I += G + 1;
4307
+ }), F++, N += G + 1;
4308
4308
  }
4309
4309
  const V = Dn(C.sizeTree);
4310
- return I !== S && V.shift(), V.reduce(
4310
+ return N !== S && V.shift(), V.reduce(
4311
4311
  (P, { k: G, v: W }) => {
4312
4312
  let K = P.ranges;
4313
4313
  return P.prevSize !== 0 && (K = [
@@ -4331,14 +4331,14 @@ const vx = {
4331
4331
  ).ranges;
4332
4332
  }
4333
4333
  return Dn(C.sizeTree).reduce(
4334
- (_, { k: I, v: F }) => ({
4335
- prevIndex: I + S,
4334
+ (_, { k: N, v: F }) => ({
4335
+ prevIndex: N + S,
4336
4336
  prevSize: F,
4337
- ranges: [..._.ranges, { endIndex: I + S - 1, size: _.prevSize, startIndex: _.prevIndex }]
4337
+ ranges: [..._.ranges, { endIndex: N + S - 1, size: _.prevSize, startIndex: _.prevIndex }]
4338
4338
  }),
4339
4339
  {
4340
4340
  prevIndex: 0,
4341
- prevSize: N,
4341
+ prevSize: I,
4342
4342
  ranges: []
4343
4343
  }
4344
4344
  ).ranges;
@@ -4365,12 +4365,12 @@ const vx = {
4365
4365
  if (Xe(C.sizeTree))
4366
4366
  return C;
4367
4367
  let E = or();
4368
- const N = st(g);
4369
- let _ = 0, I = 0, F = 0;
4368
+ const I = st(g);
4369
+ let _ = 0, N = 0, F = 0;
4370
4370
  for (; _ < -S; ) {
4371
- F = N[I];
4372
- const V = N[I + 1] - F - 1;
4373
- I++, _ += V + 1;
4371
+ F = I[N];
4372
+ const V = I[N + 1] - F - 1;
4373
+ N++, _ += V + 1;
4374
4374
  }
4375
4375
  if (E = Dn(C.sizeTree).reduce((V, { k: P, v: G }) => Pt(V, Math.max(0, P + S), G), E), _ !== -S) {
4376
4376
  const V = Pr(C.sizeTree, F);
@@ -4384,7 +4384,7 @@ const vx = {
4384
4384
  ...mi(C.offsetTree, 0, E, k)
4385
4385
  };
4386
4386
  } else {
4387
- const E = Dn(C.sizeTree).reduce((N, { k: _, v: I }) => Pt(N, Math.max(0, _ + S), I), or());
4387
+ const E = Dn(C.sizeTree).reduce((I, { k: _, v: N }) => Pt(I, Math.max(0, _ + S), N), or());
4388
4388
  return {
4389
4389
  ...C,
4390
4390
  sizeTree: E,
@@ -4445,7 +4445,7 @@ const su = He(
4445
4445
  e
4446
4446
  ), de(
4447
4447
  z(
4448
- ut(o, t, r),
4448
+ ct(o, t, r),
4449
4449
  be(([c, u]) => rs(u)),
4450
4450
  re(([c, u, d]) => Jt(u.groupOffsetTree, Math.max(c - d, 0), "v")[0]),
4451
4451
  Qe(),
@@ -4502,16 +4502,16 @@ const Kr = He(
4502
4502
  _e(e, s, o),
4503
4503
  re(
4504
4504
  ([
4505
- [R, S, C, k, E, N, _, I],
4505
+ [R, S, C, k, E, I, _, N],
4506
4506
  F,
4507
4507
  V,
4508
4508
  P
4509
4509
  ]) => {
4510
4510
  const G = iu(R), { align: W, behavior: K, offset: D } = G, O = k - 1, ie = ou(G, S, O);
4511
- let J = Mr(ie, S.offsetTree, F) + N;
4511
+ let J = Mr(ie, S.offsetTree, F) + I;
4512
4512
  W === "end" ? (J += V + Jt(S.sizeTree, ie)[1] - C + P, ie === O && (J += _)) : W === "center" ? J += (V + Jt(S.sizeTree, ie)[1] - C + P) / 2 : J -= E, D && (J += D);
4513
4513
  const ee = (M) => {
4514
- y(), M ? (I("retrying to scroll to", { location: R }, Nt.DEBUG), Ie(m, R)) : (Ie(b, !0), I("list did not change, scroll successful", {}, Nt.DEBUG));
4514
+ y(), M ? (N("retrying to scroll to", { location: R }, Nt.DEBUG), Ie(m, R)) : (Ie(b, !0), N("list did not change, scroll successful", {}, Nt.DEBUG));
4515
4515
  };
4516
4516
  if (y(), K === "smooth") {
4517
4517
  let M = !1;
@@ -4524,7 +4524,7 @@ const Kr = He(
4524
4524
  g = Xt(z(t, yx(150)), ee);
4525
4525
  return x = setTimeout(() => {
4526
4526
  y();
4527
- }, 1200), Ie(c, !0), I("scrolling from index to", { behavior: K, index: ie, top: J }, Nt.DEBUG), { behavior: K, top: J };
4527
+ }, 1200), Ie(c, !0), N("scrolling from index to", { behavior: K, index: ie, top: J }, Nt.DEBUG), { behavior: K, top: J };
4528
4528
  }
4529
4529
  )
4530
4530
  ),
@@ -4578,7 +4578,7 @@ const qr = He(
4578
4578
  u
4579
4579
  ), Ke(
4580
4580
  z(
4581
- ut(t, i),
4581
+ ct(t, i),
4582
4582
  _e(a, n, e, u),
4583
4583
  be(([[, d], f, { sizeTree: h }, m, b]) => d && (!Xe(h) || zi(m)) && !f && !b),
4584
4584
  _e(c)
@@ -4626,7 +4626,7 @@ const Dr = "up", Nr = "down", Sx = "none", Cx = {
4626
4626
  );
4627
4627
  de(
4628
4628
  z(
4629
- ut(we(o), we(f)),
4629
+ ct(we(o), we(f)),
4630
4630
  re(([w, y]) => w <= y),
4631
4631
  Qe()
4632
4632
  ),
@@ -4634,14 +4634,14 @@ const Dr = "up", Nr = "down", Sx = "none", Cx = {
4634
4634
  ), de(z(a, gn(50)), u);
4635
4635
  const b = Ot(
4636
4636
  z(
4637
- ut(r, we(s), we(t), we(e), we(d)),
4637
+ ct(r, we(s), we(t), we(e), we(d)),
4638
4638
  sn((w, [{ scrollHeight: y, scrollTop: R }, S, C, k, E]) => {
4639
- const N = R + S - y > -E, _ = {
4639
+ const I = R + S - y > -E, _ = {
4640
4640
  scrollHeight: y,
4641
4641
  scrollTop: R,
4642
4642
  viewportHeight: S
4643
4643
  };
4644
- if (N) {
4644
+ if (I) {
4645
4645
  let F, V;
4646
4646
  return R > w.state.scrollTop ? (F = "SCROLLED_DOWN", V = w.state.scrollTop - R) : (F = "SIZE_DECREASED", V = w.state.scrollTop - R || w.scrollTopDelta), {
4647
4647
  atBottom: !0,
@@ -4650,10 +4650,10 @@ const Dr = "up", Nr = "down", Sx = "none", Cx = {
4650
4650
  state: _
4651
4651
  };
4652
4652
  }
4653
- let I;
4654
- return _.scrollHeight > w.state.scrollHeight ? I = "SIZE_INCREASED" : S < w.state.viewportHeight ? I = "VIEWPORT_HEIGHT_DECREASING" : R < w.state.scrollTop ? I = "SCROLLING_UPWARDS" : I = "NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM", {
4653
+ let N;
4654
+ return _.scrollHeight > w.state.scrollHeight ? N = "SIZE_INCREASED" : S < w.state.viewportHeight ? N = "VIEWPORT_HEIGHT_DECREASING" : R < w.state.scrollTop ? N = "SCROLLING_UPWARDS" : N = "NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM", {
4655
4655
  atBottom: !1,
4656
- notAtBottomBecause: I,
4656
+ notAtBottomBecause: N,
4657
4657
  state: _
4658
4658
  };
4659
4659
  }, Cx),
@@ -4757,7 +4757,7 @@ const qi = He(
4757
4757
  ([{ deviation: e, fixedHeaderHeight: t, headerHeight: n, scrollTop: r, viewportHeight: o }]) => {
4758
4758
  const s = Le(), i = q(0), a = q(0), c = q(0), u = yt(
4759
4759
  z(
4760
- ut(
4760
+ ct(
4761
4761
  we(r),
4762
4762
  we(o),
4763
4763
  we(n),
@@ -4782,10 +4782,10 @@ const qi = He(
4782
4782
  ]) => {
4783
4783
  const R = d - w, S = g + x, C = Math.max(h - R, 0);
4784
4784
  let k = pl;
4785
- const E = gl(y, _o), N = gl(y, jo);
4786
- return m -= w, m += h + x, b += h + x, b -= w, m > d + S - E && (k = Dr), b < d - C + f + N && (k = Nr), k !== pl ? [
4785
+ const E = gl(y, _o), I = gl(y, jo);
4786
+ return m -= w, m += h + x, b += h + x, b -= w, m > d + S - E && (k = Dr), b < d - C + f + I && (k = Nr), k !== pl ? [
4787
4787
  Math.max(R - h - ml(v, _o, k) - E, 0),
4788
- R - C - x + f + ml(v, jo, k) + N
4788
+ R - C - x + f + ml(v, jo, k) + I
4789
4789
  ] : null;
4790
4790
  }
4791
4791
  ),
@@ -4906,7 +4906,7 @@ const Gn = He(
4906
4906
  de(s.topItemsIndexes, v);
4907
4907
  const w = yt(
4908
4908
  z(
4909
- ut(
4909
+ ct(
4910
4910
  m,
4911
4911
  b,
4912
4912
  we(c, Or),
@@ -4919,8 +4919,8 @@ const Gn = He(
4919
4919
  we(n),
4920
4920
  e
4921
4921
  ),
4922
- be(([C, k, , E, , , , , , , N]) => {
4923
- const _ = N && N.length !== E;
4922
+ be(([C, k, , E, , , , , , , I]) => {
4923
+ const _ = I && I.length !== E;
4924
4924
  return C && !k && !_;
4925
4925
  }),
4926
4926
  re(
@@ -4929,19 +4929,19 @@ const Gn = He(
4929
4929
  ,
4930
4930
  [C, k],
4931
4931
  E,
4932
- N,
4933
- _,
4934
4932
  I,
4933
+ _,
4934
+ N,
4935
4935
  F,
4936
4936
  V,
4937
4937
  P,
4938
4938
  G
4939
4939
  ]) => {
4940
- const W = N, { offsetTree: K, sizeTree: D } = W, O = st(g);
4940
+ const W = I, { offsetTree: K, sizeTree: D } = W, O = st(g);
4941
4941
  if (E === 0)
4942
4942
  return { ...Ls, totalCount: E };
4943
4943
  if (C === 0 && k === 0)
4944
- return O === 0 ? { ...Ls, totalCount: E } : lu(O, _, N, V, P, G || []);
4944
+ return O === 0 ? { ...Ls, totalCount: E } : lu(O, _, I, V, P, G || []);
4945
4945
  if (Xe(D))
4946
4946
  return O > 0 ? null : mo(
4947
4947
  Rx(Ki(_, E), W, G),
@@ -4961,7 +4961,7 @@ const Gn = He(
4961
4961
  ie.push({ data: G == null ? void 0 : G[oe], index: oe, offset: L, size: H }), L += H;
4962
4962
  }
4963
4963
  }
4964
- if (!I)
4964
+ if (!N)
4965
4965
  return mo([], ie, E, P, W, V);
4966
4966
  const J = F.length > 0 ? F[F.length - 1] + 1 : 0, ee = hx(K, C, k, J);
4967
4967
  if (ee.length === 0)
@@ -5070,7 +5070,7 @@ const Gn = He(
5070
5070
  ([{ fixedFooterHeight: e, fixedHeaderHeight: t, footerHeight: n, headerHeight: r }, { listState: o }]) => {
5071
5071
  const s = Le(), i = yt(
5072
5072
  z(
5073
- ut(n, e, r, t, o),
5073
+ ct(n, e, r, t, o),
5074
5074
  re(([a, c, u, d, f]) => a + c + u + d + f.offsetBottom + f.bottom)
5075
5075
  ),
5076
5076
  0
@@ -5083,7 +5083,7 @@ const Gn = He(
5083
5083
  ([{ viewportHeight: e }, { totalListHeight: t }]) => {
5084
5084
  const n = q(!1), r = yt(
5085
5085
  z(
5086
- ut(n, e, t),
5086
+ ct(n, e, t),
5087
5087
  be(([o]) => o),
5088
5088
  re(([, o, s]) => Math.max(0, o - s)),
5089
5089
  gn(0),
@@ -5116,8 +5116,8 @@ const Gn = He(
5116
5116
  _e(t, c, n, s, o, r, a),
5117
5117
  _e(e),
5118
5118
  re(([[f, h, m, b, v, g, x, w], y]) => {
5119
- const { align: R, behavior: S, calculateViewLocation: C = Ex, done: k, ...E } = f, N = ou(f, h, b - 1), _ = Mr(N, h.offsetTree, y) + v + g, I = _ + Jt(h.sizeTree, N)[1], F = w + g, V = w + m - x, P = C({
5120
- itemBottom: I,
5119
+ const { align: R, behavior: S, calculateViewLocation: C = Ex, done: k, ...E } = f, I = ou(f, h, b - 1), _ = Mr(I, h.offsetTree, y) + v + g, N = _ + Jt(h.sizeTree, I)[1], F = w + g, V = w + m - x, P = C({
5120
+ itemBottom: N,
5121
5121
  itemTop: _,
5122
5122
  locationParams: { align: R, behavior: S, ...E },
5123
5123
  viewportBottom: V,
@@ -5170,11 +5170,11 @@ const Ix = (e, t) => typeof e == "function" ? vl(e(t)) : t && vl(e), Nx = He(
5170
5170
  }
5171
5171
  Ke(
5172
5172
  z(
5173
- ut(z(we(t), Bn(1)), c),
5173
+ ct(z(we(t), Bn(1)), c),
5174
5174
  _e(we(b), s, a, f),
5175
- re(([[S, C], k, E, N, _]) => {
5176
- let I = C && N, F = "auto";
5177
- return I && (F = Ix(k, E || _), I = I && !!F), { followOutputBehavior: F, shouldFollow: I, totalCount: S };
5175
+ re(([[S, C], k, E, I, _]) => {
5176
+ let N = C && I, F = "auto";
5177
+ return N && (F = Ix(k, E || _), N = N && !!F), { followOutputBehavior: F, shouldFollow: N, totalCount: S };
5178
5178
  }),
5179
5179
  be(({ shouldFollow: S }) => S)
5180
5180
  ),
@@ -5194,7 +5194,7 @@ const Ix = (e, t) => typeof e == "function" ? vl(e(t)) : t && vl(e), Nx = He(
5194
5194
  }
5195
5195
  Ke(
5196
5196
  z(
5197
- ut(we(b), t, u),
5197
+ ct(we(b), t, u),
5198
5198
  be(([S, , C]) => S && C),
5199
5199
  sn(
5200
5200
  ({ value: S }, [, C]) => ({ refreshed: S === C, value: C }),
@@ -5208,7 +5208,7 @@ const Ix = (e, t) => typeof e == "function" ? vl(e(t)) : t && vl(e), Nx = He(
5208
5208
  }
5209
5209
  ), Ke(v, () => {
5210
5210
  w(st(b) !== !1);
5211
- }), Ke(ut(we(b), o), ([S, C]) => {
5211
+ }), Ke(ct(we(b), o), ([S, C]) => {
5212
5212
  S && !C.atBottom && C.notAtBottomBecause === "VIEWPORT_HEIGHT_DECREASING" && x("auto");
5213
5213
  });
5214
5214
  const y = q(null), R = Le();
@@ -5226,9 +5226,9 @@ const Ix = (e, t) => typeof e == "function" ? vl(e(t)) : t && vl(e), Nx = He(
5226
5226
  R
5227
5227
  ), Ke(
5228
5228
  z(
5229
- ut(z(R, Bn(1)), c),
5229
+ ct(z(R, Bn(1)), c),
5230
5230
  _e(we(y), a, f, h),
5231
- re(([[S, C], k, E, N, _]) => C && E && (k == null ? void 0 : k({ context: _, totalCount: S, scrollingInProgress: N }))),
5231
+ re(([[S, C], k, E, I, _]) => C && E && (k == null ? void 0 : k({ context: _, totalCount: S, scrollingInProgress: I }))),
5232
5232
  be((S) => !!S),
5233
5233
  gn(0)
5234
5234
  ),
@@ -5316,7 +5316,7 @@ const Ix = (e, t) => typeof e == "function" ? vl(e(t)) : t && vl(e), Nx = He(
5316
5316
  ),
5317
5317
  t
5318
5318
  ), Ke(
5319
- z(ut(t, e, n), _e(r)),
5319
+ z(ct(t, e, n), _e(r)),
5320
5320
  ([[o, s, i], a]) => {
5321
5321
  o && a && a.change && a.change(s, i);
5322
5322
  }
@@ -5328,7 +5328,7 @@ const Ix = (e, t) => typeof e == "function" ? vl(e(t)) : t && vl(e), Nx = He(
5328
5328
  const n = Le(), r = Le(), o = Le(), s = q(!1), i = q(void 0);
5329
5329
  return de(
5330
5330
  z(
5331
- ut(n, r),
5331
+ ct(n, r),
5332
5332
  re(([{ scrollHeight: a, scrollTop: c, viewportHeight: u }, { offsetTop: d }]) => ({
5333
5333
  scrollHeight: a,
5334
5334
  scrollTop: Math.max(0, c - d),
@@ -5423,9 +5423,9 @@ const Mx = hu(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
5423
5423
  _e(i),
5424
5424
  sn(
5425
5425
  ([, x, w, y], [{ bottom: R, items: S, offsetBottom: C, totalCount: k }, E]) => {
5426
- const N = R + C;
5426
+ const I = R + C;
5427
5427
  let _ = 0;
5428
- return w === k && x.length > 0 && S.length > 0 && (S[0].originalIndex === 0 && x[0].originalIndex === 0 || (_ = N - y, _ !== 0 && (_ += E))), [_, S, k, N];
5428
+ return w === k && x.length > 0 && S.length > 0 && (S[0].originalIndex === 0 && x[0].originalIndex === 0 || (_ = I - y, _ !== 0 && (_ += E))), [_, S, k, I];
5429
5429
  },
5430
5430
  [0, [], 0, 0]
5431
5431
  ),
@@ -5442,7 +5442,7 @@ const Mx = hu(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
5442
5442
  y && Mx() ? Ie(e, w - x) : g(-x);
5443
5443
  }), Ke(
5444
5444
  z(
5445
- ut(yt(s, !1), e, b),
5445
+ ct(yt(s, !1), e, b),
5446
5446
  be(([x, w, y]) => !x && !y && w !== 0),
5447
5447
  re(([x, w]) => w),
5448
5448
  gn(1)
@@ -5467,11 +5467,11 @@ const Mx = hu(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
5467
5467
  {
5468
5468
  let k = 0;
5469
5469
  const E = Pr(R, 0);
5470
- let N = 0, _ = 0;
5471
- for (; N < x; ) {
5472
- N++, k += E;
5473
- let I = w.length === _ + 1 ? 1 / 0 : w[_ + 1] - w[_] - 1;
5474
- N + I > x && (k -= E, I = x - N + 1), N += I, k += C(I), _++;
5470
+ let I = 0, _ = 0;
5471
+ for (; I < x; ) {
5472
+ I++, k += E;
5473
+ let N = w.length === _ + 1 ? 1 / 0 : w[_ + 1] - w[_] - 1;
5474
+ I + N > x && (k -= E, N = x - I + 1), I += N, k += C(N), _++;
5475
5475
  }
5476
5476
  return k;
5477
5477
  }
@@ -5551,10 +5551,10 @@ const Mx = hu(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
5551
5551
  C,
5552
5552
  { topItemCount: k },
5553
5553
  { groupCounts: E },
5554
- N
5555
- ]) => (de(R.rangeChanged, N.scrollSeekRangeChanged), de(
5554
+ I
5555
+ ]) => (de(R.rangeChanged, I.scrollSeekRangeChanged), de(
5556
5556
  z(
5557
- N.windowViewportRect,
5557
+ I.windowViewportRect,
5558
5558
  re((_) => _.visibleHeight)
5559
5559
  ),
5560
5560
  v.viewportHeight
@@ -5584,7 +5584,7 @@ const Mx = hu(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
5584
5584
  // exported from stateFlagsSystem
5585
5585
  ...R,
5586
5586
  // the bag of IO from featureGroup1System
5587
- ...N,
5587
+ ...I,
5588
5588
  ...v,
5589
5589
  sizes: c,
5590
5590
  ...g
@@ -5787,7 +5787,7 @@ const zx = /* @__PURE__ */ He(() => {
5787
5787
  ([e, t]) => ({ ...e, ...t }),
5788
5788
  et(pu, zx)
5789
5789
  ), Hx = ({ height: e }) => /* @__PURE__ */ l.jsx("div", { style: { height: e } }), Ux = { overflowAnchor: "none", position: Yi(), zIndex: 1 }, bu = { overflowAnchor: "none" }, Wx = { ...bu, display: "inline-block", height: "100%" }, bl = /* @__PURE__ */ B.memo(function({ showTopList: e = !1 }) {
5790
- const t = Te("listState"), n = Ut("sizeRanges"), r = Te("useWindowScroll"), o = Te("customScrollParent"), s = Ut("windowScrollContainerState"), i = Ut("scrollContainerState"), a = o || r ? s : i, c = Te("itemContent"), u = Te("context"), d = Te("groupContent"), f = Te("trackItemSizes"), h = Te("itemSize"), m = Te("log"), b = Ut("gap"), v = Te("horizontalDirection"), { callbackRef: g } = sx(
5790
+ const t = Te("listState"), n = Wt("sizeRanges"), r = Te("useWindowScroll"), o = Te("customScrollParent"), s = Wt("windowScrollContainerState"), i = Wt("scrollContainerState"), a = o || r ? s : i, c = Te("itemContent"), u = Te("context"), d = Te("groupContent"), f = Te("trackItemSizes"), h = Te("itemSize"), m = Te("log"), b = Wt("gap"), v = Te("horizontalDirection"), { callbackRef: g } = sx(
5791
5791
  n,
5792
5792
  h,
5793
5793
  f,
@@ -5801,17 +5801,17 @@ const zx = /* @__PURE__ */ He(() => {
5801
5801
  Ji("deviation", (P) => {
5802
5802
  x !== P && w(P);
5803
5803
  });
5804
- const y = Te("EmptyPlaceholder"), R = Te("ScrollSeekPlaceholder") || Hx, S = Te("ListComponent"), C = Te("ItemComponent"), k = Te("GroupComponent"), E = Te("computeItemKey"), N = Te("isSeeking"), _ = Te("groupIndices").length > 0, I = Te("alignToBottom"), F = Te("initialItemFinalLocationReached"), V = e ? {} : {
5804
+ const y = Te("EmptyPlaceholder"), R = Te("ScrollSeekPlaceholder") || Hx, S = Te("ListComponent"), C = Te("ItemComponent"), k = Te("GroupComponent"), E = Te("computeItemKey"), I = Te("isSeeking"), _ = Te("groupIndices").length > 0, N = Te("alignToBottom"), F = Te("initialItemFinalLocationReached"), V = e ? {} : {
5805
5805
  boxSizing: "border-box",
5806
5806
  ...v ? {
5807
5807
  display: "inline-block",
5808
5808
  height: "100%",
5809
- marginLeft: x !== 0 ? x : I ? "auto" : 0,
5809
+ marginLeft: x !== 0 ? x : N ? "auto" : 0,
5810
5810
  paddingLeft: t.offsetTop,
5811
5811
  paddingRight: t.offsetBottom,
5812
5812
  whiteSpace: "nowrap"
5813
5813
  } : {
5814
- marginTop: x !== 0 ? x : I ? "auto" : 0,
5814
+ marginTop: x !== 0 ? x : N ? "auto" : 0,
5815
5815
  paddingBottom: t.offsetBottom,
5816
5816
  paddingTop: t.offsetTop
5817
5817
  },
@@ -5826,7 +5826,7 @@ const zx = /* @__PURE__ */ He(() => {
5826
5826
  style: V,
5827
5827
  children: (e ? t.topItems : t.items).map((P) => {
5828
5828
  const G = P.originalIndex, W = E(G + t.firstItemIndex, P.data, u);
5829
- return N ? /* @__PURE__ */ co(
5829
+ return I ? /* @__PURE__ */ co(
5830
5830
  R,
5831
5831
  {
5832
5832
  ...bt(R, u),
@@ -5894,7 +5894,7 @@ function Gx(e, t) {
5894
5894
  return { item: typeof e == "string" ? void 0 : t };
5895
5895
  }
5896
5896
  const Yx = /* @__PURE__ */ B.memo(function() {
5897
- const e = Te("HeaderComponent"), t = Ut("headerHeight"), n = Te("HeaderFooterTag"), r = qn(
5897
+ const e = Te("HeaderComponent"), t = Wt("headerHeight"), n = Te("HeaderFooterTag"), r = qn(
5898
5898
  B.useMemo(
5899
5899
  () => (s) => {
5900
5900
  t(yn(s, "height"));
@@ -5906,7 +5906,7 @@ const Yx = /* @__PURE__ */ B.memo(function() {
5906
5906
  ), o = Te("context");
5907
5907
  return e ? /* @__PURE__ */ l.jsx(n, { ref: r, children: /* @__PURE__ */ l.jsx(e, { ...bt(e, o) }) }) : null;
5908
5908
  }), Xx = /* @__PURE__ */ B.memo(function() {
5909
- const e = Te("FooterComponent"), t = Ut("footerHeight"), n = Te("HeaderFooterTag"), r = qn(
5909
+ const e = Te("FooterComponent"), t = Wt("footerHeight"), n = Te("HeaderFooterTag"), r = qn(
5910
5910
  B.useMemo(
5911
5911
  () => (s) => {
5912
5912
  t(yn(s, "height"));
@@ -5971,7 +5971,7 @@ function Su({ useEmitter: e, useEmitterValue: t, usePublisher: n }) {
5971
5971
  });
5972
5972
  }
5973
5973
  const Jx = ({ children: e }) => {
5974
- const t = B.useContext(gu), n = Ut("viewportHeight"), r = Ut("fixedItemHeight"), o = Te("alignToBottom"), s = Te("horizontalDirection"), i = B.useMemo(
5974
+ const t = B.useContext(gu), n = Wt("viewportHeight"), r = Wt("fixedItemHeight"), o = Te("alignToBottom"), s = Te("horizontalDirection"), i = B.useMemo(
5975
5975
  () => qc(n, (c) => yn(c, s ? "width" : "height")),
5976
5976
  [n, s]
5977
5977
  ), a = qn(i, !0, Te("skipAnimationFrameInResizeObserver"));
@@ -5979,7 +5979,7 @@ const Jx = ({ children: e }) => {
5979
5979
  t && (n(t.viewportHeight), r(t.itemHeight));
5980
5980
  }, [t, n, r]), /* @__PURE__ */ l.jsx("div", { "data-viewport-type": "element", ref: a, style: os(o), children: e });
5981
5981
  }, Zx = ({ children: e }) => {
5982
- const t = B.useContext(gu), n = Ut("windowViewportRect"), r = Ut("fixedItemHeight"), o = Te("customScrollParent"), s = Yc(
5982
+ const t = B.useContext(gu), n = Wt("windowViewportRect"), r = Wt("fixedItemHeight"), o = Te("customScrollParent"), s = Yc(
5983
5983
  n,
5984
5984
  o,
5985
5985
  Te("skipAnimationFrameInResizeObserver")
@@ -6004,7 +6004,7 @@ const Jx = ({ children: e }) => {
6004
6004
  Component: tv,
6005
6005
  useEmitter: Ji,
6006
6006
  useEmitterValue: Te,
6007
- usePublisher: Ut
6007
+ usePublisher: Wt
6008
6008
  } = /* @__PURE__ */ mu(
6009
6009
  Bx,
6010
6010
  {
@@ -6064,7 +6064,7 @@ const Jx = ({ children: e }) => {
6064
6064
  }
6065
6065
  },
6066
6066
  ev
6067
- ), nv = /* @__PURE__ */ yu({ useEmitter: Ji, useEmitterValue: Te, usePublisher: Ut }), rv = /* @__PURE__ */ Su({ useEmitter: Ji, useEmitterValue: Te, usePublisher: Ut }), ov = tv, sv = /* @__PURE__ */ He(() => {
6067
+ ), nv = /* @__PURE__ */ yu({ useEmitter: Ji, useEmitterValue: Te, usePublisher: Wt }), rv = /* @__PURE__ */ Su({ useEmitter: Ji, useEmitterValue: Te, usePublisher: Wt }), ov = tv, sv = /* @__PURE__ */ He(() => {
6068
6068
  const e = q((u) => /* @__PURE__ */ l.jsxs("td", { children: [
6069
6069
  "Item $",
6070
6070
  u
@@ -6144,7 +6144,7 @@ const cv = /* @__PURE__ */ He(
6144
6144
  { customScrollParent: g, useWindowScroll: x, windowScrollContainerState: w, windowScrollTo: y, windowViewportRect: R },
6145
6145
  S
6146
6146
  ]) => {
6147
- const C = q(0), k = q(0), E = q(yl), N = q({ height: 0, width: 0 }), _ = q({ height: 0, width: 0 }), I = Le(), F = Le(), V = q(0), P = q(null), G = q({ column: 0, row: 0 }), W = Le(), K = Le(), D = q(!1), O = q(0), ie = q(!0), J = q(!1), ee = q(!1);
6147
+ const C = q(0), k = q(0), E = q(yl), I = q({ height: 0, width: 0 }), _ = q({ height: 0, width: 0 }), N = Le(), F = Le(), V = q(0), P = q(null), G = q({ column: 0, row: 0 }), W = Le(), K = Le(), D = q(!1), O = q(0), ie = q(!0), J = q(!1), ee = q(!1);
6148
6148
  Ke(
6149
6149
  z(
6150
6150
  b,
@@ -6156,12 +6156,12 @@ const cv = /* @__PURE__ */ He(
6156
6156
  }
6157
6157
  ), Ke(
6158
6158
  z(
6159
- ut(b, ie, _, N, O, J),
6159
+ ct(b, ie, _, I, O, J),
6160
6160
  be(([j, H, Q, le, , oe]) => j && !H && Q.height !== 0 && le.height !== 0 && !oe)
6161
6161
  ),
6162
6162
  ([, , , , j]) => {
6163
6163
  Ie(J, !0), Vi(1, () => {
6164
- Ie(I, j);
6164
+ Ie(N, j);
6165
6165
  }), Xt(z(u), () => {
6166
6166
  Ie(t, [0, 0]), Ie(ie, !0);
6167
6167
  });
@@ -6180,20 +6180,20 @@ const cv = /* @__PURE__ */ He(
6180
6180
  be(([, j]) => j != null)
6181
6181
  ),
6182
6182
  ([, j]) => {
6183
- j && (Ie(N, j.viewport), Ie(_, j.item), Ie(G, j.gap), j.scrollTop > 0 && (Ie(D, !0), Xt(z(u, Bn(1)), (H) => {
6183
+ j && (Ie(I, j.viewport), Ie(_, j.item), Ie(G, j.gap), j.scrollTop > 0 && (Ie(D, !0), Xt(z(u, Bn(1)), (H) => {
6184
6184
  Ie(D, !1);
6185
6185
  }), Ie(c, { top: j.scrollTop })));
6186
6186
  }
6187
6187
  ), de(
6188
6188
  z(
6189
- N,
6189
+ I,
6190
6190
  re(({ height: j }) => j)
6191
6191
  ),
6192
6192
  f
6193
6193
  ), de(
6194
6194
  z(
6195
- ut(
6196
- we(N, to),
6195
+ ct(
6196
+ we(I, to),
6197
6197
  we(_, to),
6198
6198
  we(G, (j, H) => j && j.column === H.column && j.row === H.row),
6199
6199
  we(u)
@@ -6208,12 +6208,12 @@ const cv = /* @__PURE__ */ He(
6208
6208
  W
6209
6209
  ), de(
6210
6210
  z(
6211
- ut(
6211
+ ct(
6212
6212
  we(C),
6213
6213
  r,
6214
6214
  we(G, lv),
6215
6215
  we(_, to),
6216
- we(N, to),
6216
+ we(I, to),
6217
6217
  we(P),
6218
6218
  we(k),
6219
6219
  we(D),
@@ -6234,18 +6234,18 @@ const cv = /* @__PURE__ */ He(
6234
6234
  ke,
6235
6235
  Be
6236
6236
  ]) => {
6237
- const { column: Ze, row: qe } = le, { height: dt, width: ft } = oe, { width: ce } = $e;
6237
+ const { column: Ze, row: qe } = le, { height: ut, width: dt } = oe, { width: ce } = $e;
6238
6238
  if (ve === 0 && (j === 0 || ce === 0))
6239
6239
  return yl;
6240
- if (ft === 0) {
6240
+ if (dt === 0) {
6241
6241
  const tt = Ki(Be, j), Ne = tt + Math.max(ve - 1, 0);
6242
6242
  return av(Tl(tt, Ne, De));
6243
6243
  }
6244
- const ue = Cu(ce, ft, Ze);
6244
+ const ue = Cu(ce, dt, Ze);
6245
6245
  let he, ye;
6246
- ke ? H === 0 && Q === 0 && ve > 0 ? (he = 0, ye = ve - 1) : (he = ue * Po((H + qe) / (dt + qe)), ye = ue * Sl((Q + qe) / (dt + qe)) - 1, ye = zs(j - 1, Ar(ye, ue - 1)), he = zs(ye, Ar(0, he))) : (he = 0, ye = -1);
6247
- const Pe = Tl(he, ye, De), { bottom: Ue, top: $ } = Rl($e, le, oe, Pe), Y = Sl(j / ue), Ae = Y * dt + (Y - 1) * qe - Ue;
6248
- return { bottom: Ue, itemHeight: dt, items: Pe, itemWidth: ft, offsetBottom: Ae, offsetTop: $, top: $ };
6246
+ ke ? H === 0 && Q === 0 && ve > 0 ? (he = 0, ye = ve - 1) : (he = ue * Po((H + qe) / (ut + qe)), ye = ue * Sl((Q + qe) / (ut + qe)) - 1, ye = zs(j - 1, Ar(ye, ue - 1)), he = zs(ye, Ar(0, he))) : (he = 0, ye = -1);
6247
+ const Pe = Tl(he, ye, De), { bottom: Ue, top: $ } = Rl($e, le, oe, Pe), Y = Sl(j / ue), Ae = Y * ut + (Y - 1) * qe - Ue;
6248
+ return { bottom: Ue, itemHeight: ut, items: Pe, itemWidth: dt, offsetBottom: Ae, offsetTop: $, top: $ };
6249
6249
  }
6250
6250
  )
6251
6251
  ),
@@ -6259,7 +6259,7 @@ const cv = /* @__PURE__ */ He(
6259
6259
  C
6260
6260
  ), de(
6261
6261
  z(
6262
- ut(N, _, E, G),
6262
+ ct(I, _, E, G),
6263
6263
  be(([j, H, { items: Q }]) => Q.length > 0 && H.height !== 0 && j.height !== 0),
6264
6264
  re(([j, H, { items: Q }, le]) => {
6265
6265
  const { bottom: oe, top: $e } = Rl(j, le, H, Q);
@@ -6280,7 +6280,7 @@ const cv = /* @__PURE__ */ He(
6280
6280
  );
6281
6281
  const Z = Ot(
6282
6282
  z(
6283
- ut(E, C),
6283
+ ct(E, C),
6284
6284
  be(([{ items: j }]) => j.length > 0),
6285
6285
  _e(M),
6286
6286
  be(([[j, H], Q]) => {
@@ -6312,8 +6312,8 @@ const cv = /* @__PURE__ */ He(
6312
6312
  );
6313
6313
  de(fe, m.scrollSeekRangeChanged), de(
6314
6314
  z(
6315
- I,
6316
- _e(N, _, C, G),
6315
+ N,
6316
+ _e(I, _, C, G),
6317
6317
  re(([j, H, Q, le, oe]) => {
6318
6318
  const $e = iu(j), { align: De, behavior: ve, offset: ke } = $e;
6319
6319
  let Be = $e.index;
@@ -6336,7 +6336,7 @@ const cv = /* @__PURE__ */ He(
6336
6336
  R,
6337
6337
  re((j) => ({ height: j.visibleHeight, width: j.visibleWidth }))
6338
6338
  ),
6339
- N
6339
+ I
6340
6340
  ), {
6341
6341
  customScrollParent: g,
6342
6342
  // input
@@ -6354,12 +6354,12 @@ const cv = /* @__PURE__ */ He(
6354
6354
  scrollContainerState: a,
6355
6355
  scrollHeight: F,
6356
6356
  scrollTo: c,
6357
- scrollToIndex: I,
6357
+ scrollToIndex: N,
6358
6358
  scrollTop: u,
6359
6359
  smoothScrollTargetReached: d,
6360
6360
  totalCount: C,
6361
6361
  useWindowScroll: x,
6362
- viewportDimensions: N,
6362
+ viewportDimensions: I,
6363
6363
  windowScrollContainerState: w,
6364
6364
  windowScrollTo: y,
6365
6365
  windowViewportRect: R,
@@ -6426,7 +6426,7 @@ const uv = /* @__PURE__ */ He(() => {
6426
6426
  ([e, t]) => ({ ...e, ...t }),
6427
6427
  et(cv, uv)
6428
6428
  ), fv = /* @__PURE__ */ B.memo(function() {
6429
- const e = nt("gridState"), t = nt("listClassName"), n = nt("itemClassName"), r = nt("itemContent"), o = nt("computeItemKey"), s = nt("isSeeking"), i = Wt("scrollHeight"), a = nt("ItemComponent"), c = nt("ListComponent"), u = nt("ScrollSeekPlaceholder"), d = nt("context"), f = Wt("itemDimensions"), h = Wt("gap"), m = nt("log"), b = nt("stateRestoreInProgress"), v = Wt("reportReadyState"), g = qn(
6429
+ const e = nt("gridState"), t = nt("listClassName"), n = nt("itemClassName"), r = nt("itemContent"), o = nt("computeItemKey"), s = nt("isSeeking"), i = Vt("scrollHeight"), a = nt("ItemComponent"), c = nt("ListComponent"), u = nt("ScrollSeekPlaceholder"), d = nt("context"), f = Vt("itemDimensions"), h = Vt("gap"), m = nt("log"), b = nt("stateRestoreInProgress"), v = Vt("reportReadyState"), g = qn(
6430
6430
  B.useMemo(
6431
6431
  () => (x) => {
6432
6432
  const w = x.parentElement.parentElement.scrollHeight;
@@ -6481,7 +6481,7 @@ const uv = /* @__PURE__ */ He(() => {
6481
6481
  }
6482
6482
  );
6483
6483
  }), hv = B.memo(function() {
6484
- const e = nt("HeaderComponent"), t = Wt("headerHeight"), n = nt("headerFooterTag"), r = qn(
6484
+ const e = nt("HeaderComponent"), t = Vt("headerHeight"), n = nt("headerFooterTag"), r = qn(
6485
6485
  B.useMemo(
6486
6486
  () => (s) => {
6487
6487
  t(yn(s, "height"));
@@ -6493,7 +6493,7 @@ const uv = /* @__PURE__ */ He(() => {
6493
6493
  ), o = nt("context");
6494
6494
  return e ? /* @__PURE__ */ l.jsx(n, { ref: r, children: /* @__PURE__ */ l.jsx(e, { ...bt(e, o) }) }) : null;
6495
6495
  }), pv = B.memo(function() {
6496
- const e = nt("FooterComponent"), t = Wt("footerHeight"), n = nt("headerFooterTag"), r = qn(
6496
+ const e = nt("FooterComponent"), t = Vt("footerHeight"), n = nt("headerFooterTag"), r = qn(
6497
6497
  B.useMemo(
6498
6498
  () => (s) => {
6499
6499
  t(yn(s, "height"));
@@ -6505,7 +6505,7 @@ const uv = /* @__PURE__ */ He(() => {
6505
6505
  ), o = nt("context");
6506
6506
  return e ? /* @__PURE__ */ l.jsx(n, { ref: r, children: /* @__PURE__ */ l.jsx(e, { ...bt(e, o) }) }) : null;
6507
6507
  }), mv = ({ children: e }) => {
6508
- const t = B.useContext(xu), n = Wt("itemDimensions"), r = Wt("viewportDimensions"), o = qn(
6508
+ const t = B.useContext(xu), n = Vt("itemDimensions"), r = Vt("viewportDimensions"), o = qn(
6509
6509
  B.useMemo(
6510
6510
  () => (s) => {
6511
6511
  r(s.getBoundingClientRect());
@@ -6519,7 +6519,7 @@ const uv = /* @__PURE__ */ He(() => {
6519
6519
  t && (r({ height: t.viewportHeight, width: t.viewportWidth }), n({ height: t.itemHeight, width: t.itemWidth }));
6520
6520
  }, [t, r, n]), /* @__PURE__ */ l.jsx("div", { ref: o, style: os(!1), children: e });
6521
6521
  }, gv = ({ children: e }) => {
6522
- const t = B.useContext(xu), n = Wt("windowViewportRect"), r = Wt("itemDimensions"), o = nt("customScrollParent"), s = Yc(n, o, !1);
6522
+ const t = B.useContext(xu), n = Vt("windowViewportRect"), r = Vt("itemDimensions"), o = nt("customScrollParent"), s = Yc(n, o, !1);
6523
6523
  return B.useEffect(() => {
6524
6524
  t && (r({ height: t.itemHeight, width: t.itemWidth }), n({ offsetTop: 0, visibleHeight: t.viewportHeight, visibleWidth: t.viewportWidth }));
6525
6525
  }, [t, n, r]), /* @__PURE__ */ l.jsx("div", { ref: s, style: os(!1), children: e });
@@ -6533,7 +6533,7 @@ const uv = /* @__PURE__ */ He(() => {
6533
6533
  }), {
6534
6534
  useEmitter: Tu,
6535
6535
  useEmitterValue: nt,
6536
- usePublisher: Wt
6536
+ usePublisher: Vt
6537
6537
  } = /* @__PURE__ */ mu(
6538
6538
  dv,
6539
6539
  {
@@ -6575,7 +6575,7 @@ const uv = /* @__PURE__ */ He(() => {
6575
6575
  }
6576
6576
  },
6577
6577
  xv
6578
- ), vv = /* @__PURE__ */ yu({ useEmitter: Tu, useEmitterValue: nt, usePublisher: Wt }), wv = /* @__PURE__ */ Su({ useEmitter: Tu, useEmitterValue: nt, usePublisher: Wt });
6578
+ ), vv = /* @__PURE__ */ yu({ useEmitter: Tu, useEmitterValue: nt, usePublisher: Vt }), wv = /* @__PURE__ */ Su({ useEmitter: Tu, useEmitterValue: nt, usePublisher: Vt });
6579
6579
  function kl(e, t, n) {
6580
6580
  return t !== "normal" && !(t != null && t.endsWith("px")) && n(`${e} was not resolved to pixel value correctly`, t, Nt.WARN), t === "normal" ? 0 : parseInt(t ?? "0", 10);
6581
6581
  }
@@ -8499,7 +8499,7 @@ function Bs({
8499
8499
  className: t = "",
8500
8500
  allowHtml: n = !1
8501
8501
  }) {
8502
- const r = Yt(() => {
8502
+ const r = Ut(() => {
8503
8503
  try {
8504
8504
  if (!n) {
8505
8505
  const o = e.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, "").replace(/<iframe\b[^<]*(?:(?!<\/iframe>)<[^<]*)*<\/iframe>/gi, "").replace(/javascript:/gi, "").replace(/on\w+\s*=/gi, "");
@@ -8673,8 +8673,8 @@ var lw = "DismissableLayer", vi = "dismissableLayer.update", cw = "dismissableLa
8673
8673
  onDismiss: a,
8674
8674
  ...c
8675
8675
  } = e, u = p.useContext(Lu), [d, f] = p.useState(null), h = (d == null ? void 0 : d.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, m] = p.useState({}), b = Me(t, (k) => f(k)), v = Array.from(u.layers), [g] = [...u.layersWithOutsidePointerEventsDisabled].slice(-1), x = v.indexOf(g), w = d ? v.indexOf(d) : -1, y = u.layersWithOutsidePointerEventsDisabled.size > 0, R = w >= x, S = hw((k) => {
8676
- const E = k.target, N = [...u.branches].some((_) => _.contains(E));
8677
- !R || N || (o == null || o(k), i == null || i(k), k.defaultPrevented || a == null || a());
8676
+ const E = k.target, I = [...u.branches].some((_) => _.contains(E));
8677
+ !R || I || (o == null || o(k), i == null || i(k), k.defaultPrevented || a == null || a());
8678
8678
  }, h), C = pw((k) => {
8679
8679
  const E = k.target;
8680
8680
  [...u.branches].some((_) => _.contains(E)) || (s == null || s(k), i == null || i(k), k.defaultPrevented || a == null || a());
@@ -9334,8 +9334,8 @@ function nb(e) {
9334
9334
  return !1;
9335
9335
  if (!r.current && "changedTouches" in v && (y || R) && (r.current = S), !S)
9336
9336
  return !0;
9337
- var N = r.current || S;
9338
- return Zw(N, g, v, N === "h" ? y : R);
9337
+ var I = r.current || S;
9338
+ return Zw(I, g, v, I === "h" ? y : R);
9339
9339
  }, []), c = p.useCallback(function(v) {
9340
9340
  var g = v;
9341
9341
  if (!(!er.length || er[er.length - 1] !== s)) {
@@ -9771,7 +9771,7 @@ function yb({ isOpen: e, onClose: t, fileId: n, fileName: r, mimeType: o }) {
9771
9771
  }
9772
9772
  }
9773
9773
  }, [n]);
9774
- ct(() => {
9774
+ pt(() => {
9775
9775
  e && n && h();
9776
9776
  }, [e, n, h]);
9777
9777
  const m = async () => {
@@ -10041,7 +10041,7 @@ function Jl(e) {
10041
10041
  }
10042
10042
  function Ab(e, t, n = 16) {
10043
10043
  const [r, o] = me(e), s = rt(e), i = rt(null), a = rt(null);
10044
- return ct(() => {
10044
+ return pt(() => {
10045
10045
  if (s.current = e, !t) {
10046
10046
  i.current && cancelAnimationFrame(i.current), a.current && clearTimeout(a.current), o(e);
10047
10047
  return;
@@ -10055,7 +10055,7 @@ function Ab(e, t, n = 16) {
10055
10055
  }
10056
10056
  function _b({ className: e }) {
10057
10057
  const [t, n] = me(0);
10058
- return ct(() => {
10058
+ return pt(() => {
10059
10059
  const r = setInterval(() => n((o) => (o + 1) % 4), 500);
10060
10060
  return () => clearInterval(r);
10061
10061
  }, []), /* @__PURE__ */ l.jsxs(
@@ -10091,7 +10091,7 @@ const jb = B.memo(function({
10091
10091
  onCancelEdit: x,
10092
10092
  onCopy: w
10093
10093
  }) {
10094
- const [y, R] = me(!1), [S, C] = me("collapsed"), [k, E] = me(!1), { currentThreadId: N } = Fi(), { toast: _ } = oa(), [I, F] = me({}), [V, P] = me(!1), [G, W] = me(null), K = u === "phone" || u === "half-screen", D = t.role, O = D === "tool", ie = !(r && D !== "user"), J = B.useMemo(() => {
10094
+ const [y, R] = me(!1), [S, C] = me("collapsed"), [k, E] = me(!1), { currentThreadId: I } = Fi(), { toast: _ } = oa(), [N, F] = me({}), [V, P] = me(!1), [G, W] = me(null), K = u === "phone" || u === "half-screen", D = t.role, O = D === "tool", ie = !(r && D !== "user"), J = B.useMemo(() => {
10095
10095
  switch (D) {
10096
10096
  case "user":
10097
10097
  return "text-[hsl(var(--chat-bubble-user-text))]";
@@ -10104,15 +10104,15 @@ const jb = B.memo(function({
10104
10104
  default:
10105
10105
  return "text-[hsl(var(--chat-bubble-ai-text))]";
10106
10106
  }
10107
- }, [D]), ee = Yt(() => Tb(t.content), [t.content]), M = Yt(() => Rb(t.content), [t.content]), Z = Yt(
10107
+ }, [D]), ee = Ut(() => Tb(t.content), [t.content]), M = Ut(() => Rb(t.content), [t.content]), Z = Ut(
10108
10108
  () => t.content.filter((ce) => ce.type === "image_url"),
10109
10109
  [t.content]
10110
- ), Re = Yt(
10110
+ ), Re = Ut(
10111
10111
  () => t.content.filter((ce) => ce.type === "file"),
10112
10112
  [t.content]
10113
- ), fe = Yt(() => Eb(t.content), [t.content]);
10114
- Yt(() => Ib(t.content), [t.content]);
10115
- const L = Yt(() => fe.length <= Pn ? fe : `${fe.slice(0, Pn)}
10113
+ ), fe = Ut(() => Eb(t.content), [t.content]);
10114
+ Ut(() => Ib(t.content), [t.content]);
10115
+ const L = Ut(() => fe.length <= Pn ? fe : `${fe.slice(0, Pn)}
10116
10116
  … [truncated ${fe.length - Pn} chars]`, [fe]), j = Ab(ee, r, o), H = B.useCallback(async (ce = "all") => {
10117
10117
  const he = ce === "visible" && O ? L : O ? fe : ee;
10118
10118
  async function ye(Pe) {
@@ -10143,7 +10143,7 @@ const jb = B.memo(function({
10143
10143
  ce.preventDefault();
10144
10144
  return;
10145
10145
  }
10146
- if (I[he]) {
10146
+ if (N[he]) {
10147
10147
  ce.preventDefault();
10148
10148
  return;
10149
10149
  }
@@ -10159,7 +10159,7 @@ const jb = B.memo(function({
10159
10159
  ce.preventDefault(), F((Y) => ({ ...Y, [he]: !0 }));
10160
10160
  const Ue = `${ue.name}_${ue.size}_${Date.now()}`, $ = _({ title: "Fetching file...", description: "", open: !0 });
10161
10161
  try {
10162
- const Y = await tw(N ?? void 0);
10162
+ const Y = await tw(I ?? void 0);
10163
10163
  if (!Y || !Array.isArray(Y))
10164
10164
  throw new Error("Invalid file list response");
10165
10165
  const Ae = Y.find((tt) => !tt || typeof tt != "object" || !((tt.filename ?? "") === (ue.name ?? "")) ? !1 : typeof ue.size == "number" && typeof tt.size == "number" ? tt.size === ue.size : !0);
@@ -10187,7 +10187,7 @@ const jb = B.memo(function({
10187
10187
  } catch (ye) {
10188
10188
  console.error("File click error:", ye), F((Pe) => ({ ...Pe, [he]: !1 }));
10189
10189
  }
10190
- }, [ie, I, _, N]), $e = B.useCallback(() => {
10190
+ }, [ie, N, _, I]), $e = B.useCallback(() => {
10191
10191
  const ue = X(K ? "h-3 w-3" : "h-4 w-4", "opacity-60 flex-shrink-0", J);
10192
10192
  switch (D) {
10193
10193
  case "user":
@@ -10268,10 +10268,10 @@ const jb = B.memo(function({
10268
10268
  className: `inline-flex items-center gap-2 rounded px-2 py-1 text-xs bg-gray-100 border hover:bg-gray-200
10269
10269
  dark:bg-background/10 dark:border-border/30 dark:hover:bg-background/20`,
10270
10270
  children: [
10271
- I[ue] ? /* @__PURE__ */ l.jsx(gc, { className: "h-4 w-4 animate-spin" }) : null,
10271
+ N[ue] ? /* @__PURE__ */ l.jsx(gc, { className: "h-4 w-4 animate-spin" }) : null,
10272
10272
  /* @__PURE__ */ l.jsxs("span", { className: "truncate max-w-[180px]", children: [
10273
10273
  ye,
10274
- I[ue] ? " (processing)" : ""
10274
+ N[ue] ? " (processing)" : ""
10275
10275
  ] })
10276
10276
  ]
10277
10277
  },
@@ -10279,7 +10279,7 @@ const jb = B.memo(function({
10279
10279
  );
10280
10280
  }
10281
10281
  return null;
10282
- }, [oe, I]), Be = B.useCallback(() => /* @__PURE__ */ l.jsxs("div", { className: "flex items-center gap-2 p-2 bg-muted/30 rounded", children: [
10282
+ }, [oe, N]), Be = B.useCallback(() => /* @__PURE__ */ l.jsxs("div", { className: "flex items-center gap-2 p-2 bg-muted/30 rounded", children: [
10283
10283
  /* @__PURE__ */ l.jsx(ni, { className: "h-4 w-4 text-muted-foreground" }),
10284
10284
  /* @__PURE__ */ l.jsx("span", { className: "text-sm text-muted-foreground", children: "File upload" })
10285
10285
  ] }), []), Ze = B.useCallback(() => {
@@ -10332,7 +10332,7 @@ const jb = B.memo(function({
10332
10332
  ] });
10333
10333
  }
10334
10334
  return /* @__PURE__ */ l.jsx(Bs, { content: ee.trim(), allowHtml: !1 });
10335
- }, [ee, D, h, m, k, K]), dt = B.useCallback(() => {
10335
+ }, [ee, D, h, m, k, K]), ut = B.useCallback(() => {
10336
10336
  if (!(ee.trim().length > 0 || Z.length > 0 || Re.length > 0) && !r)
10337
10337
  return Be();
10338
10338
  if (t.model === "reflection") {
@@ -10384,7 +10384,7 @@ const jb = B.memo(function({
10384
10384
  Ze,
10385
10385
  qe,
10386
10386
  J
10387
- ]), ft = Yt(() => Nb(t), [t]);
10387
+ ]), dt = Ut(() => Nb(t), [t]);
10388
10388
  return /* @__PURE__ */ l.jsxs(l.Fragment, { children: [
10389
10389
  /* @__PURE__ */ l.jsx("div", { className: X(De(), b.container), children: /* @__PURE__ */ l.jsxs("div", { className: X(ve(), b.content), children: [
10390
10390
  (a || c || O) && /* @__PURE__ */ l.jsxs(
@@ -10399,7 +10399,7 @@ const jb = B.memo(function({
10399
10399
  children: [
10400
10400
  /* @__PURE__ */ l.jsxs("div", { className: "flex items-center gap-2", children: [
10401
10401
  $e(),
10402
- c && ft && /* @__PURE__ */ l.jsx("span", { className: X("font-medium", K ? "text-xs" : "text-sm"), children: ft }),
10402
+ c && dt && /* @__PURE__ */ l.jsx("span", { className: X("font-medium", K ? "text-xs" : "text-sm"), children: dt }),
10403
10403
  O && M.name && /* @__PURE__ */ l.jsxs(
10404
10404
  xi,
10405
10405
  {
@@ -10511,7 +10511,7 @@ const jb = B.memo(function({
10511
10511
  ]
10512
10512
  }
10513
10513
  ),
10514
- /* @__PURE__ */ l.jsx("div", { className: "relative", children: dt() }),
10514
+ /* @__PURE__ */ l.jsx("div", { className: "relative", children: ut() }),
10515
10515
  O && S === "expanded" && (M.toolCallId || M.name) && /* @__PURE__ */ l.jsxs("div", { className: X("mt-2 pt-2 border-t border-current/10 text-xs opacity-60", K && "text-xs"), children: [
10516
10516
  M.name && /* @__PURE__ */ l.jsxs("div", { children: [
10517
10517
  "Function: ",
@@ -10693,9 +10693,9 @@ const Ql = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, wd = B.forwa
10693
10693
  onScrollAway: g,
10694
10694
  onAtBottom: x
10695
10695
  }, w) => {
10696
- const y = rt(null), R = rt(null), S = rt(!1), [C, k] = me(!0), E = Ye((I) => {
10697
- k(I), g && g(!I), x && x(I);
10698
- }, [g, x]), N = Yt(() => {
10696
+ const y = rt(null), R = rt(null), S = rt(!1), [C, k] = me(!0), E = Ye((N) => {
10697
+ k(N), g && g(!N), x && x(N);
10698
+ }, [g, x]), I = Ut(() => {
10699
10699
  if (a)
10700
10700
  return async () => {
10701
10701
  if (!S.current) {
@@ -10707,38 +10707,31 @@ const Ql = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, wd = B.forwa
10707
10707
  }
10708
10708
  }
10709
10709
  };
10710
- }, [a]), _ = rt(!1);
10711
- return ct(() => {
10712
- if (!b || v) {
10713
- _.current !== !1 && (_.current = !1);
10714
- return;
10715
- }
10716
- const I = C ? "auto" : !1;
10717
- _.current !== I && (_.current = I);
10718
- }, [C, b, v]), 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(
10710
+ }, [a]), _ = Ut(() => !b || v ? !1 : C ? "auto" : !1, [C, b, v]);
10711
+ 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(
10719
10712
  ov,
10720
10713
  {
10721
- ref: (I) => {
10722
- y.current = I;
10714
+ ref: (N) => {
10715
+ y.current = N;
10723
10716
  },
10724
- scrollerRef: (I) => {
10725
- R.current = I instanceof HTMLDivElement ? I : null;
10717
+ scrollerRef: (N) => {
10718
+ R.current = N instanceof HTMLDivElement ? N : null;
10726
10719
  },
10727
10720
  data: e,
10728
- followOutput: _.current,
10721
+ followOutput: _,
10729
10722
  overscan: 200,
10730
10723
  increaseViewportBy: { top: 100, bottom: 200 },
10731
10724
  defaultItemHeight: 80,
10732
10725
  atBottomThreshold: 50,
10733
10726
  alignToBottom: !1,
10734
10727
  startReached: () => {
10735
- N && N();
10728
+ I && I();
10736
10729
  },
10737
10730
  atBottomStateChange: E,
10738
10731
  style: { height: "100%", overscrollBehavior: "contain" },
10739
- computeItemKey: (I, F) => Ql(F, I),
10740
- itemContent: (I, F) => {
10741
- const V = Ql(F, I);
10732
+ computeItemKey: (N, F) => Ql(F, N),
10733
+ itemContent: (N, F) => {
10734
+ const V = Ql(F, N);
10742
10735
  return /* @__PURE__ */ l.jsx(
10743
10736
  "div",
10744
10737
  {
@@ -10752,7 +10745,7 @@ const Ql = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, wd = B.forwa
10752
10745
  jb,
10753
10746
  {
10754
10747
  message: F,
10755
- messageIndex: I,
10748
+ messageIndex: N,
10756
10749
  isStreamingMessage: t && n === F.id,
10757
10750
  streamingDebounceMs: r,
10758
10751
  isEditing: i === F.id,
@@ -10763,7 +10756,7 @@ const Ql = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, wd = B.forwa
10763
10756
  truncateToolMessages: !1,
10764
10757
  toolMessagePreviewLength: 200,
10765
10758
  onEdit: c,
10766
- onRegenerate: () => u(I),
10759
+ onRegenerate: () => u(N),
10767
10760
  onCancelEdit: d
10768
10761
  }
10769
10762
  )
@@ -11142,7 +11135,7 @@ const Zb = (e) => ({
11142
11135
  }, m = ha(o), b = fa(m), v = await i.getDimensions(u), g = m === "y", x = g ? "top" : "left", w = g ? "bottom" : "right", y = g ? "clientHeight" : "clientWidth", R = s.reference[b] + s.reference[m] - h[m] - s.floating[b], S = h[m] - s.reference[m], C = await (i.getOffsetParent == null ? void 0 : i.getOffsetParent(u));
11143
11136
  let k = C ? C[y] : 0;
11144
11137
  (!k || !await (i.isElement == null ? void 0 : i.isElement(C))) && (k = a.floating[y] || s.floating[b]);
11145
- const E = R / 2 - S / 2, N = k / 2 - v[b] / 2 - 1, _ = Tn(f[x], N), I = Tn(f[w], N), F = _, V = k - v[b] - I, P = k / 2 - v[b] / 2 + E, G = yi(F, P, V), W = !c.arrow && gr(o) != null && P !== G && s.reference[b] / 2 - (P < F ? _ : I) - v[b] / 2 < 0, K = W ? P < F ? P - F : P - V : 0;
11138
+ const E = R / 2 - S / 2, I = k / 2 - v[b] / 2 - 1, _ = Tn(f[x], I), N = Tn(f[w], I), F = _, V = k - v[b] - N, P = k / 2 - v[b] / 2 + E, G = yi(F, P, V), W = !c.arrow && gr(o) != null && P !== G && s.reference[b] / 2 - (P < F ? _ : N) - v[b] / 2 < 0, K = W ? P < F ? P - F : P - V : 0;
11146
11139
  return {
11147
11140
  [m]: h[m] + K,
11148
11141
  data: {
@@ -11181,18 +11174,18 @@ const Zb = (e) => ({
11181
11174
  return {};
11182
11175
  const x = vn(o), w = an(a), y = vn(a) === a, R = await (c.isRTL == null ? void 0 : c.isRTL(u.floating)), S = h || (y || !v ? [$o(a)] : Vb(a)), C = b !== "none";
11183
11176
  !h && C && S.push(...Yb(a, v, b, R));
11184
- const k = [a, ...S], E = await $r(t, g), N = [];
11177
+ const k = [a, ...S], E = await $r(t, g), I = [];
11185
11178
  let _ = ((r = s.flip) == null ? void 0 : r.overflows) || [];
11186
- if (d && N.push(E[x]), f) {
11179
+ if (d && I.push(E[x]), f) {
11187
11180
  const P = Wb(o, i, R);
11188
- N.push(E[P[0]], E[P[1]]);
11181
+ I.push(E[P[0]], E[P[1]]);
11189
11182
  }
11190
11183
  if (_ = [..._, {
11191
11184
  placement: o,
11192
- overflows: N
11193
- }], !N.every((P) => P <= 0)) {
11194
- var I, F;
11195
- const P = (((I = s.flip) == null ? void 0 : I.index) || 0) + 1, G = k[P];
11185
+ overflows: I
11186
+ }], !I.every((P) => P <= 0)) {
11187
+ var N, F;
11188
+ const P = (((N = s.flip) == null ? void 0 : N.index) || 0) + 1, G = k[P];
11196
11189
  if (G && (!(f === "alignment" ? w !== an(G) : !1) || // We leave the current main axis only if every placement on that axis
11197
11190
  // overflows the main axis.
11198
11191
  _.every((D) => an(D.placement) === w ? D.overflows[0] > 0 : !0)))
@@ -11461,16 +11454,16 @@ const ny = function(e) {
11461
11454
  const w = v - d.top - d.bottom, y = b - d.left - d.right, R = Tn(v - d[g], w), S = Tn(b - d[x], y), C = !t.middlewareData.shift;
11462
11455
  let k = R, E = S;
11463
11456
  if ((n = t.middlewareData.shift) != null && n.enabled.x && (E = y), (r = t.middlewareData.shift) != null && r.enabled.y && (k = w), C && !h) {
11464
- const _ = jt(d.left, 0), I = jt(d.right, 0), F = jt(d.top, 0), V = jt(d.bottom, 0);
11465
- m ? E = b - 2 * (_ !== 0 || I !== 0 ? _ + I : jt(d.left, d.right)) : k = v - 2 * (F !== 0 || V !== 0 ? F + V : jt(d.top, d.bottom));
11457
+ const _ = jt(d.left, 0), N = jt(d.right, 0), F = jt(d.top, 0), V = jt(d.bottom, 0);
11458
+ m ? E = b - 2 * (_ !== 0 || N !== 0 ? _ + N : jt(d.left, d.right)) : k = v - 2 * (F !== 0 || V !== 0 ? F + V : jt(d.top, d.bottom));
11466
11459
  }
11467
11460
  await c({
11468
11461
  ...t,
11469
11462
  availableWidth: E,
11470
11463
  availableHeight: k
11471
11464
  });
11472
- const N = await i.getDimensions(a.floating);
11473
- return b !== N.width || v !== N.height ? {
11465
+ const I = await i.getDimensions(a.floating);
11466
+ return b !== I.width || v !== I.height ? {
11474
11467
  reset: {
11475
11468
  rects: !0
11476
11469
  }
@@ -12048,7 +12041,7 @@ function By(e) {
12048
12041
  D !== C.current && (C.current = D, v(D));
12049
12042
  }, []), y = p.useCallback((D) => {
12050
12043
  D !== k.current && (k.current = D, x(D));
12051
- }, []), R = s || b, S = i || g, C = p.useRef(null), k = p.useRef(null), E = p.useRef(d), N = c != null, _ = Qs(c), I = Qs(o), F = Qs(u), V = p.useCallback(() => {
12044
+ }, []), R = s || b, S = i || g, C = p.useRef(null), k = p.useRef(null), E = p.useRef(d), I = c != null, _ = Qs(c), N = Qs(o), F = Qs(u), V = p.useCallback(() => {
12052
12045
  if (!C.current || !k.current)
12053
12046
  return;
12054
12047
  const D = {
@@ -12056,7 +12049,7 @@ function By(e) {
12056
12049
  strategy: n,
12057
12050
  middleware: h
12058
12051
  };
12059
- I.current && (D.platform = I.current), $y(C.current, k.current, D).then((O) => {
12052
+ N.current && (D.platform = N.current), $y(C.current, k.current, D).then((O) => {
12060
12053
  const ie = {
12061
12054
  ...O,
12062
12055
  // The floating element's position may be recomputed while it's closed
@@ -12069,7 +12062,7 @@ function By(e) {
12069
12062
  f(ie);
12070
12063
  }));
12071
12064
  });
12072
- }, [h, t, n, I, F]);
12065
+ }, [h, t, n, N, F]);
12073
12066
  Co(() => {
12074
12067
  u === !1 && E.current.isPositioned && (E.current.isPositioned = !1, f((D) => ({
12075
12068
  ...D,
@@ -12085,7 +12078,7 @@ function By(e) {
12085
12078
  return _.current(R, S, V);
12086
12079
  V();
12087
12080
  }
12088
- }, [R, S, V, _, N]);
12081
+ }, [R, S, V, _, I]);
12089
12082
  const G = p.useMemo(() => ({
12090
12083
  reference: C,
12091
12084
  floating: k,
@@ -12238,15 +12231,15 @@ var wa = "PopperContent", [Qy, e0] = Pd(wa), $d = p.forwardRef(
12238
12231
  updatePositionStrategy: m = "optimized",
12239
12232
  onPlaced: b,
12240
12233
  ...v
12241
- } = e, g = Od(wa, n), [x, w] = p.useState(null), y = Me(t, ($e) => w($e)), [R, S] = p.useState(null), C = jd(R), k = (C == null ? void 0 : C.width) ?? 0, E = (C == null ? void 0 : C.height) ?? 0, N = r + (s !== "center" ? "-" + s : ""), _ = typeof d == "number" ? d : { top: 0, right: 0, bottom: 0, left: 0, ...d }, I = Array.isArray(u) ? u : [u], F = I.length > 0, V = {
12234
+ } = e, g = Od(wa, n), [x, w] = p.useState(null), y = Me(t, ($e) => w($e)), [R, S] = p.useState(null), C = jd(R), k = (C == null ? void 0 : C.width) ?? 0, E = (C == null ? void 0 : C.height) ?? 0, I = r + (s !== "center" ? "-" + s : ""), _ = typeof d == "number" ? d : { top: 0, right: 0, bottom: 0, left: 0, ...d }, N = Array.isArray(u) ? u : [u], F = N.length > 0, V = {
12242
12235
  padding: _,
12243
- boundary: I.filter(n0),
12236
+ boundary: N.filter(n0),
12244
12237
  // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
12245
12238
  altBoundary: F
12246
12239
  }, { refs: P, floatingStyles: G, placement: W, isPositioned: K, middlewareData: D } = By({
12247
12240
  // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
12248
12241
  strategy: "fixed",
12249
- placement: N,
12242
+ placement: I,
12250
12243
  whileElementsMounted: (...$e) => _y(...$e, {
12251
12244
  animationFrame: m === "always"
12252
12245
  }),
@@ -12465,11 +12458,11 @@ var c0 = p.forwardRef((e, t) => {
12465
12458
  S.current = !0;
12466
12459
  }),
12467
12460
  onFocus: ae(e.onFocus, (E) => {
12468
- const N = !S.current;
12469
- if (E.target === E.currentTarget && N && !x) {
12461
+ const I = !S.current;
12462
+ if (E.target === E.currentTarget && I && !x) {
12470
12463
  const _ = new CustomEvent(ei, o0);
12471
12464
  if (E.currentTarget.dispatchEvent(_), !_.defaultPrevented) {
12472
- const I = R().filter((W) => W.focusable), F = I.find((W) => W.active), V = I.find((W) => W.id === v), G = [F, V, ...I].filter(
12465
+ const N = R().filter((W) => W.focusable), F = N.find((W) => W.active), V = N.find((W) => W.id === v), G = [F, V, ...N].filter(
12473
12466
  Boolean
12474
12467
  ).map((W) => W.ref.current);
12475
12468
  Jd(G, d);
@@ -12623,14 +12616,14 @@ var ya = "MenuPortal", [R0, nf] = Xn(ya, {
12623
12616
  return /* @__PURE__ */ l.jsx(R0, { scope: t, forceMount: n, children: /* @__PURE__ */ l.jsx(Dt, { present: n || s.open, children: /* @__PURE__ */ l.jsx(ls, { asChild: !0, container: o, children: r }) }) });
12624
12617
  };
12625
12618
  rf.displayName = ya;
12626
- var Vt = "MenuContent", [k0, Sa] = Xn(Vt), of = p.forwardRef(
12619
+ var Kt = "MenuContent", [k0, Sa] = Xn(Kt), of = p.forwardRef(
12627
12620
  (e, t) => {
12628
- const n = nf(Vt, e.__scopeMenu), { forceMount: r = n.forceMount, ...o } = e, s = Jn(Vt, e.__scopeMenu), i = Zr(Vt, e.__scopeMenu);
12621
+ const n = nf(Kt, e.__scopeMenu), { forceMount: r = n.forceMount, ...o } = e, s = Jn(Kt, e.__scopeMenu), i = Zr(Kt, e.__scopeMenu);
12629
12622
  return /* @__PURE__ */ l.jsx(zr.Provider, { scope: e.__scopeMenu, children: /* @__PURE__ */ l.jsx(Dt, { present: r || s.open, children: /* @__PURE__ */ l.jsx(zr.Slot, { scope: e.__scopeMenu, children: i.modal ? /* @__PURE__ */ l.jsx(E0, { ...o, ref: t }) : /* @__PURE__ */ l.jsx(I0, { ...o, ref: t }) }) }) });
12630
12623
  }
12631
12624
  ), E0 = p.forwardRef(
12632
12625
  (e, t) => {
12633
- const n = Jn(Vt, e.__scopeMenu), r = p.useRef(null), o = Me(t, r);
12626
+ const n = Jn(Kt, e.__scopeMenu), r = p.useRef(null), o = Me(t, r);
12634
12627
  return p.useEffect(() => {
12635
12628
  const s = r.current;
12636
12629
  if (s) return ia(s);
@@ -12652,7 +12645,7 @@ var Vt = "MenuContent", [k0, Sa] = Xn(Vt), of = p.forwardRef(
12652
12645
  );
12653
12646
  }
12654
12647
  ), I0 = p.forwardRef((e, t) => {
12655
- const n = Jn(Vt, e.__scopeMenu);
12648
+ const n = Jn(Kt, e.__scopeMenu);
12656
12649
  return /* @__PURE__ */ l.jsx(
12657
12650
  Ca,
12658
12651
  {
@@ -12681,14 +12674,14 @@ var Vt = "MenuContent", [k0, Sa] = Xn(Vt), of = p.forwardRef(
12681
12674
  onDismiss: m,
12682
12675
  disableOutsideScroll: b,
12683
12676
  ...v
12684
- } = e, g = Jn(Vt, n), x = Zr(Vt, n), w = bs(n), y = ef(n), R = b0(n), [S, C] = p.useState(null), k = p.useRef(null), E = Me(t, k, g.onContentChange), N = p.useRef(0), _ = p.useRef(""), I = p.useRef(0), F = p.useRef(null), V = p.useRef("right"), P = p.useRef(0), G = b ? us : p.Fragment, W = b ? { as: N0, allowPinchZoom: !0 } : void 0, K = (O) => {
12677
+ } = e, g = Jn(Kt, n), x = Zr(Kt, n), w = bs(n), y = ef(n), R = b0(n), [S, C] = p.useState(null), k = p.useRef(null), E = Me(t, k, g.onContentChange), I = p.useRef(0), _ = p.useRef(""), N = p.useRef(0), F = p.useRef(null), V = p.useRef("right"), P = p.useRef(0), G = b ? us : p.Fragment, W = b ? { as: N0, allowPinchZoom: !0 } : void 0, K = (O) => {
12685
12678
  var L, j;
12686
12679
  const ie = _.current + O, J = R().filter((H) => !H.disabled), ee = document.activeElement, M = (L = J.find((H) => H.ref.current === ee)) == null ? void 0 : L.textValue, Z = J.map((H) => H.textValue), Re = B0(Z, ie, M), fe = (j = J.find((H) => H.textValue === Re)) == null ? void 0 : j.ref.current;
12687
12680
  (function H(Q) {
12688
- _.current = Q, window.clearTimeout(N.current), Q !== "" && (N.current = window.setTimeout(() => H(""), 1e3));
12681
+ _.current = Q, window.clearTimeout(I.current), Q !== "" && (I.current = window.setTimeout(() => H(""), 1e3));
12689
12682
  })(ie), fe && setTimeout(() => fe.focus());
12690
12683
  };
12691
- p.useEffect(() => () => window.clearTimeout(N.current), []), sa();
12684
+ p.useEffect(() => () => window.clearTimeout(I.current), []), sa();
12692
12685
  const D = p.useCallback((O) => {
12693
12686
  var J, ee;
12694
12687
  return V.current === ((J = F.current) == null ? void 0 : J.side) && U0(O, (ee = F.current) == null ? void 0 : ee.area);
@@ -12717,7 +12710,7 @@ var Vt = "MenuContent", [k0, Sa] = Xn(Vt), of = p.forwardRef(
12717
12710
  },
12718
12711
  [D]
12719
12712
  ),
12720
- pointerGraceTimerRef: I,
12713
+ pointerGraceTimerRef: N,
12721
12714
  onPointerGraceIntentChange: p.useCallback((O) => {
12722
12715
  F.current = O;
12723
12716
  }, []),
@@ -12777,7 +12770,7 @@ var Vt = "MenuContent", [k0, Sa] = Xn(Vt), of = p.forwardRef(
12777
12770
  Zd.includes(O.key) && fe.reverse(), F0(fe);
12778
12771
  }),
12779
12772
  onBlur: ae(e.onBlur, (O) => {
12780
- O.currentTarget.contains(O.target) || (window.clearTimeout(N.current), _.current = "");
12773
+ O.currentTarget.contains(O.target) || (window.clearTimeout(I.current), _.current = "");
12781
12774
  }),
12782
12775
  onPointerMove: ae(
12783
12776
  e.onPointerMove,
@@ -12801,7 +12794,7 @@ var Vt = "MenuContent", [k0, Sa] = Xn(Vt), of = p.forwardRef(
12801
12794
  );
12802
12795
  }
12803
12796
  );
12804
- of.displayName = Vt;
12797
+ of.displayName = Kt;
12805
12798
  var A0 = "MenuGroup", Ta = p.forwardRef(
12806
12799
  (e, t) => {
12807
12800
  const { __scopeMenu: n, ...r } = e;
@@ -13061,7 +13054,7 @@ var $0 = "MenuSub", [yT, xf] = Xn($0), Er = "MenuSubTrigger", vf = p.forwardRef(
13061
13054
  vf.displayName = Er;
13062
13055
  var wf = "MenuSubContent", bf = p.forwardRef(
13063
13056
  (e, t) => {
13064
- const n = nf(Vt, e.__scopeMenu), { forceMount: r = n.forceMount, ...o } = e, s = Jn(Vt, e.__scopeMenu), i = Zr(Vt, e.__scopeMenu), a = xf(wf, e.__scopeMenu), c = p.useRef(null), u = Me(t, c);
13057
+ const n = nf(Kt, e.__scopeMenu), { forceMount: r = n.forceMount, ...o } = e, s = Jn(Kt, e.__scopeMenu), i = Zr(Kt, e.__scopeMenu), a = xf(wf, e.__scopeMenu), c = p.useRef(null), u = Me(t, c);
13065
13058
  return /* @__PURE__ */ l.jsx(zr.Provider, { scope: e.__scopeMenu, children: /* @__PURE__ */ l.jsx(Dt, { present: r || s.open, children: /* @__PURE__ */ l.jsx(zr.Slot, { scope: e.__scopeMenu, children: /* @__PURE__ */ l.jsx(
13066
13059
  Ca,
13067
13060
  {
@@ -13453,19 +13446,19 @@ function ti({
13453
13446
  lastCheckpointNs: C,
13454
13447
  listCheckpoints: k,
13455
13448
  navigateToCheckpoint: E,
13456
- returnToLatest: N,
13449
+ returnToLatest: I,
13457
13450
  hasMoreHistory: _,
13458
- isLoadingHistory: I,
13451
+ isLoadingHistory: N,
13459
13452
  loadOlderMessages: F,
13460
13453
  api: V
13461
- } = Fi(), [P, G] = me(null), [W, K] = me(""), [D, O] = me(null), [ie, J] = me([]), [ee, M] = me(!1), [Z, Re] = me(null), [fe, L] = me(null), [j, H] = me(!1), [Q, le] = me(null), [oe, $e] = me([]), [De, ve] = me(null), [ke, Be] = me(null), [Ze, qe] = me(!1), dt = rt(null), ft = rt(null), ce = rt(null), [ue, he] = me("desktop");
13462
- ct(() => {
13454
+ } = Fi(), [P, G] = me(null), [W, K] = me(""), [D, O] = me(null), [ie, J] = me([]), [ee, M] = me(!1), [Z, Re] = me(null), [fe, L] = me(null), [j, H] = me(!1), [Q, le] = me(null), [oe, $e] = me([]), [De, ve] = me(null), [ke, Be] = me(null), [Ze, qe] = me(!1), ut = rt(null), dt = rt(null), ce = rt(null), [ue, he] = me("desktop");
13455
+ pt(() => {
13463
13456
  const te = () => {
13464
13457
  const pe = window.innerWidth;
13465
13458
  he(pe < 640 ? "phone" : pe < 1024 ? "tablet" : "desktop");
13466
13459
  };
13467
13460
  return te(), window.addEventListener("resize", te), () => window.removeEventListener("resize", te);
13468
- }, []), ct(() => {
13461
+ }, []), pt(() => {
13469
13462
  let te = !1;
13470
13463
  if (!b) {
13471
13464
  $e([]), ve(null), Be(null), ce.current = null;
@@ -13494,18 +13487,18 @@ function ti({
13494
13487
  }), () => {
13495
13488
  te = !0;
13496
13489
  };
13497
- }, [b, S, C, De, k]), ct(() => {
13490
+ }, [b, S, C, De, k]), pt(() => {
13498
13491
  S && (ve(S), Be(C ?? null));
13499
13492
  }, [S, C]);
13500
13493
  const ye = Ye(async () => {
13501
- if (!(!_ || I))
13494
+ if (!(!_ || N))
13502
13495
  try {
13503
13496
  await F();
13504
13497
  } catch (te) {
13505
13498
  console.warn("loadOlderMessages failed", te);
13506
13499
  }
13507
- }, [_, I, F]);
13508
- ct(() => {
13500
+ }, [_, N, F]);
13501
+ pt(() => {
13509
13502
  (async () => {
13510
13503
  if (!V.baseUrl) {
13511
13504
  le(null);
@@ -13518,7 +13511,7 @@ function ti({
13518
13511
  console.warn("Failed to fetch default message:", pe), le(null);
13519
13512
  }
13520
13513
  })();
13521
- }, [V]), ct(() => {
13514
+ }, [V]), pt(() => {
13522
13515
  w && !j && (m == null || m(w));
13523
13516
  }, [w, j, m]);
13524
13517
  const Pe = (te) => {
@@ -13607,7 +13600,7 @@ function ti({
13607
13600
  qe(!0);
13608
13601
  try {
13609
13602
  if (!te) {
13610
- await N(), ve(null), Be(null);
13603
+ await I(), ve(null), Be(null);
13611
13604
  return;
13612
13605
  }
13613
13606
  const pe = oe.find((Fe) => Fe.checkpointId === te), je = (pe == null ? void 0 : pe.checkpointNs) ?? null;
@@ -13616,7 +13609,7 @@ function ti({
13616
13609
  qe(!1);
13617
13610
  }
13618
13611
  }
13619
- }, At = `flex flex-1 w-full flex-col min-h-0 min-w-0 max-h-full overflow-hidden bg-transparent ${e} ${d.container || ""}`, ht = `flex-1 min-h-0 min-w-0 max-h-full w-full overflow-hidden overscroll-contain break-words break-anywhere p-4 bg-transparent ${d.messagesArea || ""}`, Rt = `flex-shrink-0 w-full border-t p-4 bg-transparent ${d.inputArea || ""}`;
13612
+ }, At = `flex flex-1 w-full flex-col min-h-0 min-w-0 max-h-full overflow-hidden bg-transparent ${e} ${d.container || ""}`, ft = `flex-1 min-h-0 min-w-0 max-h-full w-full overflow-hidden overscroll-contain break-words break-anywhere p-4 bg-transparent ${d.messagesArea || ""}`, Rt = `flex-shrink-0 w-full border-t p-4 bg-transparent ${d.inputArea || ""}`;
13620
13613
  return /* @__PURE__ */ l.jsxs("div", { className: At, children: [
13621
13614
  !!w && !j && /* @__PURE__ */ l.jsxs("div", { className: "flex-shrink-0 bg-red-50 border border-red-200 text-red-800 px-4 py-2 text-sm flex items-center justify-between", children: [
13622
13615
  /* @__PURE__ */ l.jsx("span", { children: w }),
@@ -13656,7 +13649,7 @@ function ti({
13656
13649
  /* @__PURE__ */ l.jsx(
13657
13650
  wd,
13658
13651
  {
13659
- className: ht,
13652
+ className: ft,
13660
13653
  style: r ? { maxHeight: r } : void 0,
13661
13654
  messages: v,
13662
13655
  isStreaming: g,
@@ -13698,7 +13691,7 @@ function ti({
13698
13691
  /* @__PURE__ */ l.jsx(
13699
13692
  "input",
13700
13693
  {
13701
- ref: dt,
13694
+ ref: ut,
13702
13695
  type: "file",
13703
13696
  multiple: !0,
13704
13697
  onChange: (te) => Ne(te),
@@ -13725,7 +13718,7 @@ function ti({
13725
13718
  /* @__PURE__ */ l.jsx(
13726
13719
  "input",
13727
13720
  {
13728
- ref: ft,
13721
+ ref: dt,
13729
13722
  type: "file",
13730
13723
  accept: ".xls,.xlsx,.xlsm",
13731
13724
  onChange: Lt,
@@ -13758,7 +13751,7 @@ function ti({
13758
13751
  /* @__PURE__ */ l.jsxs(Kf, { align: "start", sideOffset: 6, className: "w-52", children: [
13759
13752
  a && /* @__PURE__ */ l.jsxs(ki, { onClick: () => {
13760
13753
  var te;
13761
- return (te = dt.current) == null ? void 0 : te.click();
13754
+ return (te = ut.current) == null ? void 0 : te.click();
13762
13755
  }, className: "cursor-pointer", children: [
13763
13756
  /* @__PURE__ */ l.jsx(ni, { className: "h-4 w-4 mr-2" }),
13764
13757
  " Attach files or images"
@@ -13768,7 +13761,7 @@ function ti({
13768
13761
  {
13769
13762
  onClick: () => {
13770
13763
  var te;
13771
- ee || (te = ft.current) == null || te.click();
13764
+ ee || (te = dt.current) == null || te.click();
13772
13765
  },
13773
13766
  className: `cursor-pointer ${ee ? "opacity-60 pointer-events-none" : ""}`,
13774
13767
  children: [
@@ -13820,7 +13813,7 @@ function Ei(e, [t, n]) {
13820
13813
  function PS(e, t) {
13821
13814
  return p.useReducer((n, r) => t[n][r] ?? n, e);
13822
13815
  }
13823
- var Ea = "ScrollArea", [qf, CT] = fn(Ea), [OS, qt] = qf(Ea), Gf = p.forwardRef(
13816
+ var Ea = "ScrollArea", [qf, CT] = fn(Ea), [OS, Gt] = qf(Ea), Gf = p.forwardRef(
13824
13817
  (e, t) => {
13825
13818
  const {
13826
13819
  __scopeScrollArea: n,
@@ -13828,7 +13821,7 @@ var Ea = "ScrollArea", [qf, CT] = fn(Ea), [OS, qt] = qf(Ea), Gf = p.forwardRef(
13828
13821
  dir: o,
13829
13822
  scrollHideDelay: s = 600,
13830
13823
  ...i
13831
- } = e, [a, c] = p.useState(null), [u, d] = p.useState(null), [f, h] = p.useState(null), [m, b] = p.useState(null), [v, g] = p.useState(null), [x, w] = p.useState(0), [y, R] = p.useState(0), [S, C] = p.useState(!1), [k, E] = p.useState(!1), N = Me(t, (I) => c(I)), _ = ms(o);
13824
+ } = e, [a, c] = p.useState(null), [u, d] = p.useState(null), [f, h] = p.useState(null), [m, b] = p.useState(null), [v, g] = p.useState(null), [x, w] = p.useState(0), [y, R] = p.useState(0), [S, C] = p.useState(!1), [k, E] = p.useState(!1), I = Me(t, (N) => c(N)), _ = ms(o);
13832
13825
  return /* @__PURE__ */ l.jsx(
13833
13826
  OS,
13834
13827
  {
@@ -13856,7 +13849,7 @@ var Ea = "ScrollArea", [qf, CT] = fn(Ea), [OS, qt] = qf(Ea), Gf = p.forwardRef(
13856
13849
  {
13857
13850
  dir: _,
13858
13851
  ...i,
13859
- ref: N,
13852
+ ref: I,
13860
13853
  style: {
13861
13854
  position: "relative",
13862
13855
  // Pass corner sizes as CSS vars to reduce re-renders of context consumers
@@ -13873,7 +13866,7 @@ var Ea = "ScrollArea", [qf, CT] = fn(Ea), [OS, qt] = qf(Ea), Gf = p.forwardRef(
13873
13866
  Gf.displayName = Ea;
13874
13867
  var Yf = "ScrollAreaViewport", Xf = p.forwardRef(
13875
13868
  (e, t) => {
13876
- const { __scopeScrollArea: n, children: r, nonce: o, ...s } = e, i = qt(Yf, n), a = p.useRef(null), c = Me(t, a, i.onViewportChange);
13869
+ const { __scopeScrollArea: n, children: r, nonce: o, ...s } = e, i = Gt(Yf, n), a = p.useRef(null), c = Me(t, a, i.onViewportChange);
13877
13870
  return /* @__PURE__ */ l.jsxs(l.Fragment, { children: [
13878
13871
  /* @__PURE__ */ l.jsx(
13879
13872
  "style",
@@ -13915,7 +13908,7 @@ var Yf = "ScrollAreaViewport", Xf = p.forwardRef(
13915
13908
  Xf.displayName = Yf;
13916
13909
  var pn = "ScrollAreaScrollbar", Ia = p.forwardRef(
13917
13910
  (e, t) => {
13918
- const { forceMount: n, ...r } = e, o = qt(pn, e.__scopeScrollArea), { onScrollbarXEnabledChange: s, onScrollbarYEnabledChange: i } = o, a = e.orientation === "horizontal";
13911
+ const { forceMount: n, ...r } = e, o = Gt(pn, e.__scopeScrollArea), { onScrollbarXEnabledChange: s, onScrollbarYEnabledChange: i } = o, a = e.orientation === "horizontal";
13919
13912
  return p.useEffect(() => (a ? s(!0) : i(!0), () => {
13920
13913
  a ? s(!1) : i(!1);
13921
13914
  }), [a, s, i]), o.type === "hover" ? /* @__PURE__ */ l.jsx(MS, { ...r, ref: t, forceMount: n }) : o.type === "scroll" ? /* @__PURE__ */ l.jsx(DS, { ...r, ref: t, forceMount: n }) : o.type === "auto" ? /* @__PURE__ */ l.jsx(Jf, { ...r, ref: t, forceMount: n }) : o.type === "always" ? /* @__PURE__ */ l.jsx(Na, { ...r, ref: t }) : null;
@@ -13923,7 +13916,7 @@ var pn = "ScrollAreaScrollbar", Ia = p.forwardRef(
13923
13916
  );
13924
13917
  Ia.displayName = pn;
13925
13918
  var MS = p.forwardRef((e, t) => {
13926
- const { forceMount: n, ...r } = e, o = qt(pn, e.__scopeScrollArea), [s, i] = p.useState(!1);
13919
+ const { forceMount: n, ...r } = e, o = Gt(pn, e.__scopeScrollArea), [s, i] = p.useState(!1);
13927
13920
  return p.useEffect(() => {
13928
13921
  const a = o.scrollArea;
13929
13922
  let c = 0;
@@ -13946,7 +13939,7 @@ var MS = p.forwardRef((e, t) => {
13946
13939
  }
13947
13940
  ) });
13948
13941
  }), DS = p.forwardRef((e, t) => {
13949
- const { forceMount: n, ...r } = e, o = qt(pn, e.__scopeScrollArea), s = e.orientation === "horizontal", i = Ts(() => c("SCROLL_END"), 100), [a, c] = PS("hidden", {
13942
+ const { forceMount: n, ...r } = e, o = Gt(pn, e.__scopeScrollArea), s = e.orientation === "horizontal", i = Ts(() => c("SCROLL_END"), 100), [a, c] = PS("hidden", {
13950
13943
  hidden: {
13951
13944
  SCROLL: "scrolling"
13952
13945
  },
@@ -13990,7 +13983,7 @@ var MS = p.forwardRef((e, t) => {
13990
13983
  }
13991
13984
  ) });
13992
13985
  }), Jf = p.forwardRef((e, t) => {
13993
- const n = qt(pn, e.__scopeScrollArea), { forceMount: r, ...o } = e, [s, i] = p.useState(!1), a = e.orientation === "horizontal", c = Ts(() => {
13986
+ const n = Gt(pn, e.__scopeScrollArea), { forceMount: r, ...o } = e, [s, i] = p.useState(!1), a = e.orientation === "horizontal", c = Ts(() => {
13994
13987
  if (n.viewport) {
13995
13988
  const u = n.viewport.offsetWidth < n.viewport.scrollWidth, d = n.viewport.offsetHeight < n.viewport.scrollHeight;
13996
13989
  i(a ? u : d);
@@ -14005,7 +13998,7 @@ var MS = p.forwardRef((e, t) => {
14005
13998
  }
14006
13999
  ) });
14007
14000
  }), Na = p.forwardRef((e, t) => {
14008
- const { orientation: n = "vertical", ...r } = e, o = qt(pn, e.__scopeScrollArea), s = p.useRef(null), i = p.useRef(0), [a, c] = p.useState({
14001
+ const { orientation: n = "vertical", ...r } = e, o = Gt(pn, e.__scopeScrollArea), s = p.useRef(null), i = p.useRef(0), [a, c] = p.useState({
14009
14002
  content: 0,
14010
14003
  viewport: 0,
14011
14004
  scrollbar: { size: 0, paddingStart: 0, paddingEnd: 0 }
@@ -14059,7 +14052,7 @@ var MS = p.forwardRef((e, t) => {
14059
14052
  }
14060
14053
  ) : null;
14061
14054
  }), LS = p.forwardRef((e, t) => {
14062
- const { sizes: n, onSizesChange: r, ...o } = e, s = qt(pn, e.__scopeScrollArea), [i, a] = p.useState(), c = p.useRef(null), u = Me(t, c, s.onScrollbarXChange);
14055
+ const { sizes: n, onSizesChange: r, ...o } = e, s = Gt(pn, e.__scopeScrollArea), [i, a] = p.useState(), c = p.useRef(null), u = Me(t, c, s.onScrollbarXChange);
14063
14056
  return p.useEffect(() => {
14064
14057
  c.current && a(getComputedStyle(c.current));
14065
14058
  }, [c]), /* @__PURE__ */ l.jsx(
@@ -14098,7 +14091,7 @@ var MS = p.forwardRef((e, t) => {
14098
14091
  }
14099
14092
  );
14100
14093
  }), $S = p.forwardRef((e, t) => {
14101
- const { sizes: n, onSizesChange: r, ...o } = e, s = qt(pn, e.__scopeScrollArea), [i, a] = p.useState(), c = p.useRef(null), u = Me(t, c, s.onScrollbarYChange);
14094
+ const { sizes: n, onSizesChange: r, ...o } = e, s = Gt(pn, e.__scopeScrollArea), [i, a] = p.useState(), c = p.useRef(null), u = Me(t, c, s.onScrollbarYChange);
14102
14095
  return p.useEffect(() => {
14103
14096
  c.current && a(getComputedStyle(c.current));
14104
14097
  }, [c]), /* @__PURE__ */ l.jsx(
@@ -14150,19 +14143,19 @@ var MS = p.forwardRef((e, t) => {
14150
14143
  onWheelScroll: d,
14151
14144
  onResize: f,
14152
14145
  ...h
14153
- } = e, m = qt(pn, n), [b, v] = p.useState(null), g = Me(t, (N) => v(N)), x = p.useRef(null), w = p.useRef(""), y = m.viewport, R = r.content - r.viewport, S = gt(d), C = gt(c), k = Ts(f, 10);
14154
- function E(N) {
14146
+ } = e, m = Gt(pn, n), [b, v] = p.useState(null), g = Me(t, (I) => v(I)), x = p.useRef(null), w = p.useRef(""), y = m.viewport, R = r.content - r.viewport, S = gt(d), C = gt(c), k = Ts(f, 10);
14147
+ function E(I) {
14155
14148
  if (x.current) {
14156
- const _ = N.clientX - x.current.left, I = N.clientY - x.current.top;
14157
- u({ x: _, y: I });
14149
+ const _ = I.clientX - x.current.left, N = I.clientY - x.current.top;
14150
+ u({ x: _, y: N });
14158
14151
  }
14159
14152
  }
14160
14153
  return p.useEffect(() => {
14161
- const N = (_) => {
14162
- const I = _.target;
14163
- (b == null ? void 0 : b.contains(I)) && S(_, R);
14154
+ const I = (_) => {
14155
+ const N = _.target;
14156
+ (b == null ? void 0 : b.contains(N)) && S(_, R);
14164
14157
  };
14165
- return document.addEventListener("wheel", N, { passive: !1 }), () => document.removeEventListener("wheel", N, { passive: !1 });
14158
+ return document.addEventListener("wheel", I, { passive: !1 }), () => document.removeEventListener("wheel", I, { passive: !1 });
14166
14159
  }, [y, b, R, S]), p.useEffect(C, [r, C]), dr(b, k), dr(m.content, k), /* @__PURE__ */ l.jsx(
14167
14160
  FS,
14168
14161
  {
@@ -14179,13 +14172,13 @@ var MS = p.forwardRef((e, t) => {
14179
14172
  ...h,
14180
14173
  ref: g,
14181
14174
  style: { position: "absolute", ...h.style },
14182
- onPointerDown: ae(e.onPointerDown, (N) => {
14183
- N.button === 0 && (N.target.setPointerCapture(N.pointerId), x.current = b.getBoundingClientRect(), w.current = document.body.style.webkitUserSelect, document.body.style.webkitUserSelect = "none", m.viewport && (m.viewport.style.scrollBehavior = "auto"), E(N));
14175
+ onPointerDown: ae(e.onPointerDown, (I) => {
14176
+ I.button === 0 && (I.target.setPointerCapture(I.pointerId), x.current = b.getBoundingClientRect(), w.current = document.body.style.webkitUserSelect, document.body.style.webkitUserSelect = "none", m.viewport && (m.viewport.style.scrollBehavior = "auto"), E(I));
14184
14177
  }),
14185
14178
  onPointerMove: ae(e.onPointerMove, E),
14186
- onPointerUp: ae(e.onPointerUp, (N) => {
14187
- const _ = N.target;
14188
- _.hasPointerCapture(N.pointerId) && _.releasePointerCapture(N.pointerId), document.body.style.webkitUserSelect = w.current, m.viewport && (m.viewport.style.scrollBehavior = ""), x.current = null;
14179
+ onPointerUp: ae(e.onPointerUp, (I) => {
14180
+ const _ = I.target;
14181
+ _.hasPointerCapture(I.pointerId) && _.releasePointerCapture(I.pointerId), document.body.style.webkitUserSelect = w.current, m.viewport && (m.viewport.style.scrollBehavior = ""), x.current = null;
14189
14182
  })
14190
14183
  }
14191
14184
  )
@@ -14198,7 +14191,7 @@ var MS = p.forwardRef((e, t) => {
14198
14191
  }
14199
14192
  ), zS = p.forwardRef(
14200
14193
  (e, t) => {
14201
- const { __scopeScrollArea: n, style: r, ...o } = e, s = qt(Wo, n), i = Zf(Wo, n), { onThumbPositionChange: a } = i, c = Me(
14194
+ const { __scopeScrollArea: n, style: r, ...o } = e, s = Gt(Wo, n), i = Zf(Wo, n), { onThumbPositionChange: a } = i, c = Me(
14202
14195
  t,
14203
14196
  (f) => i.onThumbChange(f)
14204
14197
  ), u = p.useRef(void 0), d = Ts(() => {
@@ -14238,13 +14231,13 @@ var MS = p.forwardRef((e, t) => {
14238
14231
  eh.displayName = Wo;
14239
14232
  var Aa = "ScrollAreaCorner", th = p.forwardRef(
14240
14233
  (e, t) => {
14241
- const n = qt(Aa, e.__scopeScrollArea), r = !!(n.scrollbarX && n.scrollbarY);
14234
+ const n = Gt(Aa, e.__scopeScrollArea), r = !!(n.scrollbarX && n.scrollbarY);
14242
14235
  return n.type !== "scroll" && r ? /* @__PURE__ */ l.jsx(BS, { ...e, ref: t }) : null;
14243
14236
  }
14244
14237
  );
14245
14238
  th.displayName = Aa;
14246
14239
  var BS = p.forwardRef((e, t) => {
14247
- const { __scopeScrollArea: n, ...r } = e, o = qt(Aa, n), [s, i] = p.useState(0), [a, c] = p.useState(0), u = !!(s && a);
14240
+ const { __scopeScrollArea: n, ...r } = e, o = Gt(Aa, n), [s, i] = p.useState(0), [a, c] = p.useState(0), u = !!(s && a);
14248
14241
  return dr(o.scrollbarX, () => {
14249
14242
  var f;
14250
14243
  const d = ((f = o.scrollbarX) == null ? void 0 : f.offsetHeight) || 0;
@@ -14379,8 +14372,8 @@ function fc({
14379
14372
  createThread: v,
14380
14373
  deleteThread: g,
14381
14374
  renameThread: x
14382
- } = Fi(), [w, y] = me(h ?? []), [R, S] = me(!1), [C, k] = me(null), [E, N] = me(null), [_, I] = me(""), [F, V] = me(!1);
14383
- ct(() => {
14375
+ } = Fi(), [w, y] = me(h ?? []), [R, S] = me(!1), [C, k] = me(null), [E, I] = me(null), [_, N] = me(""), [F, V] = me(!1);
14376
+ pt(() => {
14384
14377
  y(h ?? []);
14385
14378
  }, [h]);
14386
14379
  const P = async (M) => {
@@ -14407,16 +14400,16 @@ function fc({
14407
14400
  console.error("Failed to delete thread:", Re);
14408
14401
  }
14409
14402
  }, K = (M, Z) => {
14410
- Z.stopPropagation(), N(M.threadId), I(M.title || `Thread ${M.threadId.slice(0, 8)}`);
14403
+ Z.stopPropagation(), I(M.threadId), N(M.title || `Thread ${M.threadId.slice(0, 8)}`);
14411
14404
  }, D = async (M) => {
14412
14405
  if (_.trim())
14413
14406
  try {
14414
- await x(M, _.trim()), N(null), I("");
14407
+ await x(M, _.trim()), I(null), N("");
14415
14408
  } catch (Z) {
14416
14409
  console.error("Failed to update title:", Z);
14417
14410
  }
14418
14411
  }, O = () => {
14419
- N(null), I("");
14412
+ I(null), N("");
14420
14413
  }, ie = (M, Z) => {
14421
14414
  M.key === "Enter" ? D(Z) : M.key === "Escape" && O();
14422
14415
  }, J = (M) => {
@@ -14457,7 +14450,7 @@ function fc({
14457
14450
  children: [
14458
14451
  /* @__PURE__ */ l.jsxs("div", { className: "flex items-center justify-between", children: [
14459
14452
  /* @__PURE__ */ l.jsx("div", { className: "flex-1 min-w-0", children: E === M.threadId ? /* @__PURE__ */ l.jsxs("div", { className: "flex items-center gap-2", onClick: (Z) => Z.stopPropagation(), children: [
14460
- /* @__PURE__ */ l.jsx(Uo, { value: _, onChange: (Z) => I(Z.target.value), onKeyDown: (Z) => ie(Z, M.threadId), className: "h-6 text-sm", autoFocus: !0 }),
14453
+ /* @__PURE__ */ l.jsx(Uo, { value: _, onChange: (Z) => N(Z.target.value), onKeyDown: (Z) => ie(Z, M.threadId), className: "h-6 text-sm", autoFocus: !0 }),
14461
14454
  /* @__PURE__ */ l.jsx(We, { variant: "ghost", size: "sm", onClick: () => D(M.threadId), className: "h-6 w-6 p-0", children: /* @__PURE__ */ l.jsx(Mi, { size: 12 }) }),
14462
14455
  /* @__PURE__ */ l.jsx(We, { variant: "ghost", size: "sm", onClick: O, className: "h-6 w-6 p-0", children: /* @__PURE__ */ l.jsx(rr, { size: 12 }) })
14463
14456
  ] }) : /* @__PURE__ */ l.jsxs(l.Fragment, { children: [
@@ -14786,12 +14779,12 @@ var iC = [" ", "Enter", "ArrowUp", "ArrowDown"], aC = [" ", "Enter"], Vn = "Sele
14786
14779
  defaultProp: o ?? !1,
14787
14780
  onChange: s,
14788
14781
  caller: Vn
14789
- }), [N, _] = Hn({
14782
+ }), [I, _] = Hn({
14790
14783
  prop: i,
14791
14784
  defaultProp: a,
14792
14785
  onChange: c,
14793
14786
  caller: Vn
14794
- }), I = p.useRef(null), F = g ? b || !!g.closest("form") : !0, [V, P] = p.useState(/* @__PURE__ */ new Set()), G = Array.from(V).map((W) => W.props.value).join(";");
14787
+ }), N = p.useRef(null), F = g ? b || !!g.closest("form") : !0, [V, P] = p.useState(/* @__PURE__ */ new Set()), G = Array.from(V).map((W) => W.props.value).join(";");
14795
14788
  return /* @__PURE__ */ l.jsx(Hd, { ...v, children: /* @__PURE__ */ l.jsxs(
14796
14789
  cC,
14797
14790
  {
@@ -14804,12 +14797,12 @@ var iC = [" ", "Enter", "ArrowUp", "ArrowDown"], aC = [" ", "Enter"], Vn = "Sele
14804
14797
  valueNodeHasChildren: R,
14805
14798
  onValueNodeHasChildrenChange: S,
14806
14799
  contentId: ln(),
14807
- value: N,
14800
+ value: I,
14808
14801
  onValueChange: _,
14809
14802
  open: k,
14810
14803
  onOpenChange: E,
14811
14804
  dir: C,
14812
- triggerPointerDownPosRef: I,
14805
+ triggerPointerDownPosRef: N,
14813
14806
  disabled: h,
14814
14807
  children: [
14815
14808
  /* @__PURE__ */ l.jsx(ks.Provider, { scope: t, children: /* @__PURE__ */ l.jsx(
@@ -14836,12 +14829,12 @@ var iC = [" ", "Enter", "ArrowUp", "ArrowDown"], aC = [" ", "Enter"], Vn = "Sele
14836
14829
  tabIndex: -1,
14837
14830
  name: d,
14838
14831
  autoComplete: f,
14839
- value: N,
14832
+ value: I,
14840
14833
  onChange: (W) => _(W.target.value),
14841
14834
  disabled: h,
14842
14835
  form: b,
14843
14836
  children: [
14844
- N === void 0 ? /* @__PURE__ */ l.jsx("option", { value: "" }) : null,
14837
+ I === void 0 ? /* @__PURE__ */ l.jsx("option", { value: "" }) : null,
14845
14838
  Array.from(V)
14846
14839
  ]
14847
14840
  },
@@ -14938,7 +14931,7 @@ var Kn = "SelectContent", Ih = p.forwardRef(
14938
14931
  }
14939
14932
  );
14940
14933
  Ih.displayName = Kn;
14941
- var Gt = 10, [Nh, An] = vr(Kn), pC = "SelectContentImpl", mC = lr("SelectContent.RemoveScroll"), Ah = p.forwardRef(
14934
+ var Yt = 10, [Nh, An] = vr(Kn), pC = "SelectContentImpl", mC = lr("SelectContent.RemoveScroll"), Ah = p.forwardRef(
14942
14935
  (e, t) => {
14943
14936
  const {
14944
14937
  __scopeSelect: n,
@@ -14960,7 +14953,7 @@ var Gt = 10, [Nh, An] = vr(Kn), pC = "SelectContentImpl", mC = lr("SelectContent
14960
14953
  avoidCollisions: g,
14961
14954
  //
14962
14955
  ...x
14963
- } = e, w = Nn(Kn, n), [y, R] = p.useState(null), [S, C] = p.useState(null), k = Me(t, (L) => R(L)), [E, N] = p.useState(null), [_, I] = p.useState(
14956
+ } = e, w = Nn(Kn, n), [y, R] = p.useState(null), [S, C] = p.useState(null), k = Me(t, (L) => R(L)), [E, I] = p.useState(null), [_, N] = p.useState(
14964
14957
  null
14965
14958
  ), F = Es(n), [V, P] = p.useState(!1), G = p.useRef(!1);
14966
14959
  p.useEffect(() => {
@@ -15009,13 +15002,13 @@ var Gt = 10, [Nh, An] = vr(Kn), pC = "SelectContentImpl", mC = lr("SelectContent
15009
15002
  }), ee = p.useCallback(
15010
15003
  (L, j, H) => {
15011
15004
  const Q = !G.current && !H;
15012
- (w.value !== void 0 && w.value === j || Q) && (N(L), Q && (G.current = !0));
15005
+ (w.value !== void 0 && w.value === j || Q) && (I(L), Q && (G.current = !0));
15013
15006
  },
15014
15007
  [w.value]
15015
15008
  ), M = p.useCallback(() => y == null ? void 0 : y.focus(), [y]), Z = p.useCallback(
15016
15009
  (L, j, H) => {
15017
15010
  const Q = !G.current && !H;
15018
- (w.value !== void 0 && w.value === j || Q) && I(L);
15011
+ (w.value !== void 0 && w.value === j || Q) && N(L);
15019
15012
  },
15020
15013
  [w.value]
15021
15014
  ), Re = r === "popper" ? Ii : _h, fe = Re === Ii ? {
@@ -15112,28 +15105,28 @@ Ah.displayName = pC;
15112
15105
  var gC = "SelectItemAlignedPosition", _h = p.forwardRef((e, t) => {
15113
15106
  const { __scopeSelect: n, onPlaced: r, ...o } = e, s = Nn(Kn, n), i = An(Kn, n), [a, c] = p.useState(null), [u, d] = p.useState(null), f = Me(t, (k) => d(k)), h = Es(n), m = p.useRef(!1), b = p.useRef(!0), { viewport: v, selectedItem: g, selectedItemText: x, focusSelectedItem: w } = i, y = p.useCallback(() => {
15114
15107
  if (s.trigger && s.valueNode && a && u && v && g && x) {
15115
- const k = s.trigger.getBoundingClientRect(), E = u.getBoundingClientRect(), N = s.valueNode.getBoundingClientRect(), _ = x.getBoundingClientRect();
15108
+ const k = s.trigger.getBoundingClientRect(), E = u.getBoundingClientRect(), I = s.valueNode.getBoundingClientRect(), _ = x.getBoundingClientRect();
15116
15109
  if (s.dir !== "rtl") {
15117
- const le = _.left - E.left, oe = N.left - le, $e = k.left - oe, De = k.width + $e, ve = Math.max(De, E.width), ke = window.innerWidth - Gt, Be = Ei(oe, [
15118
- Gt,
15110
+ const le = _.left - E.left, oe = I.left - le, $e = k.left - oe, De = k.width + $e, ve = Math.max(De, E.width), ke = window.innerWidth - Yt, Be = Ei(oe, [
15111
+ Yt,
15119
15112
  // Prevents the content from going off the starting edge of the
15120
15113
  // viewport. It may still go off the ending edge, but this can be
15121
15114
  // controlled by the user since they may want to manage overflow in a
15122
15115
  // specific way.
15123
15116
  // https://github.com/radix-ui/primitives/issues/2049
15124
- Math.max(Gt, ke - ve)
15117
+ Math.max(Yt, ke - ve)
15125
15118
  ]);
15126
15119
  a.style.minWidth = De + "px", a.style.left = Be + "px";
15127
15120
  } else {
15128
- const le = E.right - _.right, oe = window.innerWidth - N.right - le, $e = window.innerWidth - k.right - oe, De = k.width + $e, ve = Math.max(De, E.width), ke = window.innerWidth - Gt, Be = Ei(oe, [
15129
- Gt,
15130
- Math.max(Gt, ke - ve)
15121
+ const le = E.right - _.right, oe = window.innerWidth - I.right - le, $e = window.innerWidth - k.right - oe, De = k.width + $e, ve = Math.max(De, E.width), ke = window.innerWidth - Yt, Be = Ei(oe, [
15122
+ Yt,
15123
+ Math.max(Yt, ke - ve)
15131
15124
  ]);
15132
15125
  a.style.minWidth = De + "px", a.style.right = Be + "px";
15133
15126
  }
15134
- const I = h(), F = window.innerHeight - Gt * 2, V = v.scrollHeight, P = window.getComputedStyle(u), G = parseInt(P.borderTopWidth, 10), W = parseInt(P.paddingTop, 10), K = parseInt(P.borderBottomWidth, 10), D = parseInt(P.paddingBottom, 10), O = G + W + V + D + K, ie = Math.min(g.offsetHeight * 5, O), J = window.getComputedStyle(v), ee = parseInt(J.paddingTop, 10), M = parseInt(J.paddingBottom, 10), Z = k.top + k.height / 2 - Gt, Re = F - Z, fe = g.offsetHeight / 2, L = g.offsetTop + fe, j = G + W + L, H = O - j;
15127
+ const N = h(), F = window.innerHeight - Yt * 2, V = v.scrollHeight, P = window.getComputedStyle(u), G = parseInt(P.borderTopWidth, 10), W = parseInt(P.paddingTop, 10), K = parseInt(P.borderBottomWidth, 10), D = parseInt(P.paddingBottom, 10), O = G + W + V + D + K, ie = Math.min(g.offsetHeight * 5, O), J = window.getComputedStyle(v), ee = parseInt(J.paddingTop, 10), M = parseInt(J.paddingBottom, 10), Z = k.top + k.height / 2 - Yt, Re = F - Z, fe = g.offsetHeight / 2, L = g.offsetTop + fe, j = G + W + L, H = O - j;
15135
15128
  if (j <= Z) {
15136
- const le = I.length > 0 && g === I[I.length - 1].ref.current;
15129
+ const le = N.length > 0 && g === N[N.length - 1].ref.current;
15137
15130
  a.style.bottom = "0px";
15138
15131
  const oe = u.clientHeight - v.offsetTop - v.offsetHeight, $e = Math.max(
15139
15132
  Re,
@@ -15142,7 +15135,7 @@ var gC = "SelectItemAlignedPosition", _h = p.forwardRef((e, t) => {
15142
15135
  ), De = j + $e;
15143
15136
  a.style.height = De + "px";
15144
15137
  } else {
15145
- const le = I.length > 0 && g === I[0].ref.current;
15138
+ const le = N.length > 0 && g === N[0].ref.current;
15146
15139
  a.style.top = "0px";
15147
15140
  const $e = Math.max(
15148
15141
  Z,
@@ -15151,7 +15144,7 @@ var gC = "SelectItemAlignedPosition", _h = p.forwardRef((e, t) => {
15151
15144
  ) + H;
15152
15145
  a.style.height = $e + "px", v.scrollTop = j - Z + v.offsetTop;
15153
15146
  }
15154
- a.style.margin = `${Gt}px 0`, a.style.minHeight = ie + "px", a.style.maxHeight = F + "px", r == null || r(), requestAnimationFrame(() => m.current = !0);
15147
+ a.style.margin = `${Yt}px 0`, a.style.minHeight = ie + "px", a.style.maxHeight = F + "px", r == null || r(), requestAnimationFrame(() => m.current = !0);
15155
15148
  }
15156
15149
  }, [
15157
15150
  h,
@@ -15218,7 +15211,7 @@ var xC = "SelectPopperPosition", Ii = p.forwardRef((e, t) => {
15218
15211
  const {
15219
15212
  __scopeSelect: n,
15220
15213
  align: r = "start",
15221
- collisionPadding: o = Gt,
15214
+ collisionPadding: o = Yt,
15222
15215
  ...s
15223
15216
  } = e, i = Is(n);
15224
15217
  return /* @__PURE__ */ l.jsx(
@@ -15281,7 +15274,7 @@ var [vC, _a] = vr(Kn, {}), Ni = "SelectViewport", jh = p.forwardRef(
15281
15274
  if (h != null && h.current && f) {
15282
15275
  const m = Math.abs(c.current - d.scrollTop);
15283
15276
  if (m > 0) {
15284
- const b = window.innerHeight - Gt * 2, v = parseFloat(f.style.minHeight), g = parseFloat(f.style.height), x = Math.max(v, g);
15277
+ const b = window.innerHeight - Yt * 2, v = parseFloat(f.style.minHeight), g = parseFloat(f.style.height), x = Math.max(v, g);
15285
15278
  if (x < b) {
15286
15279
  const w = x + m, y = Math.min(b, w), R = w - y;
15287
15280
  f.style.height = y + "px", f.style.bottom === "0px" && (d.scrollTop = R > 0 ? R : 0, f.style.justifyContent = "flex-end");
@@ -15857,10 +15850,10 @@ const VC = {
15857
15850
  };
15858
15851
  function IT({ settings: e, onSettingsChange: t, className: n = "" }) {
15859
15852
  const [r, o] = me(!1), [s, i] = me(!1), [a, c] = me(e), [u, d] = me(!1), { toast: f } = oa();
15860
- ct(() => {
15853
+ pt(() => {
15861
15854
  const g = JSON.stringify(a) !== JSON.stringify(e);
15862
15855
  d(g);
15863
- }, [a, e]), ct(() => {
15856
+ }, [a, e]), pt(() => {
15864
15857
  c(e);
15865
15858
  }, [e]);
15866
15859
  const h = () => {