teodor-new-chat-ui 4.3.296 → 4.3.297

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
@@ -136,14 +136,14 @@ function Em() {
136
136
  }
137
137
  return null;
138
138
  }
139
- var I = Object.assign, z = 0, N, Y, $, A, J, q, pe;
139
+ var I = Object.assign, z = 0, N, Y, $, A, Z, q, pe;
140
140
  function be() {
141
141
  }
142
142
  be.__reactDisabledLog = !0;
143
143
  function Ee() {
144
144
  {
145
145
  if (z === 0) {
146
- N = console.log, Y = console.info, $ = console.warn, A = console.error, J = console.group, q = console.groupCollapsed, pe = console.groupEnd;
146
+ N = console.log, Y = console.info, $ = console.warn, A = console.error, Z = console.group, q = console.groupCollapsed, pe = console.groupEnd;
147
147
  var R = {
148
148
  configurable: !0,
149
149
  enumerable: !0,
@@ -185,7 +185,7 @@ function Em() {
185
185
  value: A
186
186
  }),
187
187
  group: I({}, R, {
188
- value: J
188
+ value: Z
189
189
  }),
190
190
  groupCollapsed: I({}, R, {
191
191
  value: q
@@ -212,16 +212,16 @@ function Em() {
212
212
  ` + K + R;
213
213
  }
214
214
  }
215
- var H = !1, ne;
215
+ var H = !1, re;
216
216
  {
217
217
  var ie = typeof WeakMap == "function" ? WeakMap : Map;
218
- ne = new ie();
218
+ re = new ie();
219
219
  }
220
220
  function oe(R, V) {
221
221
  if (!R || H)
222
222
  return "";
223
223
  {
224
- var ae = ne.get(R);
224
+ var ae = re.get(R);
225
225
  if (ae !== void 0)
226
226
  return ae;
227
227
  }
@@ -274,9 +274,9 @@ function Em() {
274
274
  if (wt !== 1 || bt !== 1)
275
275
  do
276
276
  if (wt--, bt--, bt < 0 || Be[wt] !== _t[bt]) {
277
- var Q = `
277
+ var te = `
278
278
  ` + Be[wt].replace(" at new ", " at ");
279
- return R.displayName && Q.includes("<anonymous>") && (Q = Q.replace("<anonymous>", R.displayName)), typeof R == "function" && ne.set(R, Q), Q;
279
+ return R.displayName && te.includes("<anonymous>") && (te = te.replace("<anonymous>", R.displayName)), typeof R == "function" && re.set(R, te), te;
280
280
  }
281
281
  while (wt >= 1 && bt >= 0);
282
282
  break;
@@ -286,20 +286,20 @@ function Em() {
286
286
  H = !1, W.current = at, G(), Error.prepareStackTrace = Qe;
287
287
  }
288
288
  var ue = R ? R.displayName || R.name : "", de = ue ? D(ue) : "";
289
- return typeof R == "function" && ne.set(R, de), de;
289
+ return typeof R == "function" && re.set(R, de), de;
290
290
  }
291
- function Me(R, V, ae) {
291
+ function Oe(R, V, ae) {
292
292
  return oe(R, !1);
293
293
  }
294
- function Ze(R) {
294
+ function Je(R) {
295
295
  var V = R.prototype;
296
296
  return !!(V && V.isReactComponent);
297
297
  }
298
- function Pe(R, V, ae) {
298
+ function De(R, V, ae) {
299
299
  if (R == null)
300
300
  return "";
301
301
  if (typeof R == "function")
302
- return oe(R, Ze(R));
302
+ return oe(R, Je(R));
303
303
  if (typeof R == "string")
304
304
  return D(R);
305
305
  switch (R) {
@@ -311,13 +311,13 @@ function Em() {
311
311
  if (typeof R == "object")
312
312
  switch (R.$$typeof) {
313
313
  case l:
314
- return Me(R.render);
314
+ return Oe(R.render);
315
315
  case f:
316
- return Pe(R.type, V, ae);
316
+ return De(R.type, V, ae);
317
317
  case p: {
318
318
  var Te = R, Qe = Te._payload, at = Te._init;
319
319
  try {
320
- return Pe(at(Qe), V, ae);
320
+ return De(at(Qe), V, ae);
321
321
  } catch {
322
322
  }
323
323
  }
@@ -325,9 +325,9 @@ function Em() {
325
325
  return "";
326
326
  }
327
327
  var se = Object.prototype.hasOwnProperty, he = {}, Le = g.ReactDebugCurrentFrame;
328
- function De(R) {
328
+ function Me(R) {
329
329
  if (R) {
330
- var V = R._owner, ae = Pe(R.type, R._source, V ? V.type : null);
330
+ var V = R._owner, ae = De(R.type, R._source, V ? V.type : null);
331
331
  Le.setExtraStackFrame(ae);
332
332
  } else
333
333
  Le.setExtraStackFrame(null);
@@ -347,7 +347,7 @@ function Em() {
347
347
  } catch (wt) {
348
348
  Be = wt;
349
349
  }
350
- Be && !(Be instanceof Error) && (De(Qe), w("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", Te || "React class", ae, Ve, typeof Be), De(null)), Be instanceof Error && !(Be.message in he) && (he[Be.message] = !0, De(Qe), w("Failed %s type: %s", ae, Be.message), De(null));
350
+ Be && !(Be instanceof Error) && (Me(Qe), w("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", Te || "React class", ae, Ve, typeof Be), Me(null)), Be instanceof Error && !(Be.message in he) && (he[Be.message] = !0, Me(Qe), w("Failed %s type: %s", ae, Be.message), Me(null));
351
351
  }
352
352
  }
353
353
  }
@@ -422,7 +422,7 @@ function Em() {
422
422
  });
423
423
  }
424
424
  }
425
- var Je = function(R, V, ae, Te, Qe, at, Ve) {
425
+ var Ze = function(R, V, ae, Te, Qe, at, Ve) {
426
426
  var Be = {
427
427
  // This tag allows us to uniquely identify this as a React Element
428
428
  $$typeof: t,
@@ -466,20 +466,20 @@ function Em() {
466
466
  var bt = typeof R == "function" ? R.displayName || R.name || "Unknown" : R;
467
467
  Be && Yt(Ve, bt), _t && Xt(Ve, bt);
468
468
  }
469
- return Je(R, Be, _t, Qe, Te, ht.current, Ve);
469
+ return Ze(R, Be, _t, Qe, Te, ht.current, Ve);
470
470
  }
471
471
  }
472
- var Ot = g.ReactCurrentOwner, re = g.ReactDebugCurrentFrame;
472
+ var Ot = g.ReactCurrentOwner, ee = g.ReactDebugCurrentFrame;
473
473
  function j(R) {
474
474
  if (R) {
475
- var V = R._owner, ae = Pe(R.type, R._source, V ? V.type : null);
476
- re.setExtraStackFrame(ae);
475
+ var V = R._owner, ae = De(R.type, R._source, V ? V.type : null);
476
+ ee.setExtraStackFrame(ae);
477
477
  } else
478
- re.setExtraStackFrame(null);
478
+ ee.setExtraStackFrame(null);
479
479
  }
480
480
  var X;
481
481
  X = !1;
482
- function ee(R) {
482
+ function J(R) {
483
483
  return typeof R == "object" && R !== null && R.$$typeof === t;
484
484
  }
485
485
  function me() {
@@ -530,15 +530,15 @@ Check the top-level render call using <` + ae + ">.");
530
530
  if (ze(R))
531
531
  for (var ae = 0; ae < R.length; ae++) {
532
532
  var Te = R[ae];
533
- ee(Te) && vt(Te, V);
533
+ J(Te) && vt(Te, V);
534
534
  }
535
- else if (ee(R))
535
+ else if (J(R))
536
536
  R._store && (R._store.validated = !0);
537
537
  else if (R) {
538
538
  var Qe = x(R);
539
539
  if (typeof Qe == "function" && Qe !== R.entries)
540
540
  for (var at = Qe.call(R), Ve; !(Ve = at.next()).done; )
541
- ee(Ve.value) && vt(Ve.value, V);
541
+ J(Ve.value) && vt(Ve.value, V);
542
542
  }
543
543
  }
544
544
  }
@@ -595,17 +595,17 @@ Check the top-level render call using <` + ae + ">.");
595
595
  if (bt == null)
596
596
  return bt;
597
597
  if (Ve) {
598
- var Q = V.children;
599
- if (Q !== void 0)
598
+ var te = V.children;
599
+ if (te !== void 0)
600
600
  if (Te)
601
- if (ze(Q)) {
602
- for (var ue = 0; ue < Q.length; ue++)
603
- Ce(Q[ue], R);
604
- Object.freeze && Object.freeze(Q);
601
+ if (ze(te)) {
602
+ for (var ue = 0; ue < te.length; ue++)
603
+ Ce(te[ue], R);
604
+ Object.freeze && Object.freeze(te);
605
605
  } else
606
606
  w("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
607
607
  else
608
- Ce(Q, R);
608
+ Ce(te, R);
609
609
  }
610
610
  if (se.call(V, "key")) {
611
611
  var de = F(R), ve = Object.keys(V).filter(function(sn) {
@@ -1919,10 +1919,10 @@ const uu = (e) => {
1919
1919
  );
1920
1920
  }
1921
1921
  k = k || "text";
1922
- let J = await f[M.findKey(f, k) || "text"]($, m);
1922
+ let Z = await f[M.findKey(f, k) || "text"]($, m);
1923
1923
  return !A && I && I(), await new Promise((q, pe) => {
1924
1924
  lu(q, pe, {
1925
- data: J,
1925
+ data: Z,
1926
1926
  headers: Ut.from($.headers),
1927
1927
  status: $.status,
1928
1928
  statusText: $.statusText,
@@ -3043,12 +3043,12 @@ function Ox(e = {}) {
3043
3043
  b.current && (b.current.abort(), b.current = null), l(!0), d(null), e.autoAppendAssistant !== !1 && p(""), m(null), k.current = null, E.current = null, _.current = null;
3044
3044
  const Y = new AbortController();
3045
3045
  b.current = Y;
3046
- let $ = null, A = null, J = !1;
3046
+ let $ = null, A = null, Z = !1;
3047
3047
  return S.current = {
3048
3048
  threadId: I.threadId ?? null,
3049
3049
  headers: {}
3050
3050
  }, (async () => {
3051
- var pe, be, Ee, G, W, K, D, H, ne, ie, oe, Me, Ze, Pe, se, he, Le, De;
3051
+ var pe, be, Ee, G, W, K, D, H, re, ie, oe, Oe, Je, De, se, he, Le, Me;
3052
3052
  const q = (Ue) => {
3053
3053
  var qe;
3054
3054
  try {
@@ -3068,13 +3068,13 @@ function Ox(e = {}) {
3068
3068
  Ue = { Authorization: `Bearer ${r}` };
3069
3069
  else if (typeof window < "u") {
3070
3070
  const Ie = window.__AUTH_TOKEN__, Ot = ((pe = window.localStorage) == null ? void 0 : pe.getItem("authToken")) || null;
3071
- let re = null;
3071
+ let ee = null;
3072
3072
  try {
3073
3073
  const X = (be = window.localStorage) == null ? void 0 : be.getItem("chat-settings");
3074
- X && (re = ((Ee = JSON.parse(X)) == null ? void 0 : Ee.apiKey) || null);
3074
+ X && (ee = ((Ee = JSON.parse(X)) == null ? void 0 : Ee.apiKey) || null);
3075
3075
  } catch {
3076
3076
  }
3077
- const j = Ie || Ot || re || null;
3077
+ const j = Ie || Ot || ee || null;
3078
3078
  j && (Ue = { Authorization: `Bearer ${j}` });
3079
3079
  }
3080
3080
  } catch {
@@ -3087,8 +3087,8 @@ function Ox(e = {}) {
3087
3087
  let qe = {};
3088
3088
  if (typeof window < "u")
3089
3089
  try {
3090
- const Je = (G = window.localStorage) == null ? void 0 : G.getItem("authSessionId");
3091
- Je && (qe = { "X-Session-Id": Je });
3090
+ const Ze = (G = window.localStorage) == null ? void 0 : G.getItem("authSessionId");
3091
+ Ze && (qe = { "X-Session-Id": Ze });
3092
3092
  } catch {
3093
3093
  }
3094
3094
  const ze = {
@@ -3107,14 +3107,14 @@ function Ox(e = {}) {
3107
3107
  credentials: i
3108
3108
  });
3109
3109
  if (S.current && (S.current.headers = ze), !Ge.ok || !Ge.body) {
3110
- const Je = await Ge.text().catch(() => "");
3110
+ const Ze = await Ge.text().catch(() => "");
3111
3111
  console.debug(
3112
3112
  "[use-chat] non-OK response",
3113
3113
  Ge.status,
3114
- Je == null ? void 0 : Je.slice(0, 500)
3114
+ Ze == null ? void 0 : Ze.slice(0, 500)
3115
3115
  );
3116
- const Ie = `stream ${Ge.status}${Je ? ": " + Je : ""}`;
3117
- throw (W = N == null ? void 0 : N.onConnectionError) == null || W.call(N, Ie), J = !0, $ = "error", A = Ie, new Error(Ie);
3116
+ const Ie = `stream ${Ge.status}${Ze ? ": " + Ze : ""}`;
3117
+ throw (W = N == null ? void 0 : N.onConnectionError) == null || W.call(N, Ie), Z = !0, $ = "error", A = Ie, new Error(Ie);
3118
3118
  }
3119
3119
  w(!0);
3120
3120
  const tt = Ge.body.getReader(), It = new TextDecoder();
@@ -3123,8 +3123,8 @@ function Ox(e = {}) {
3123
3123
  let mt = 0, it = null;
3124
3124
  const We = () => {
3125
3125
  if (lt.length) {
3126
- const Je = lt.join("");
3127
- lt = [], T.current && p((Ie) => Ie + Je);
3126
+ const Ze = lt.join("");
3127
+ lt = [], T.current && p((Ie) => Ie + Ze);
3128
3128
  }
3129
3129
  it = null;
3130
3130
  }, At = () => {
@@ -3132,27 +3132,27 @@ function Ox(e = {}) {
3132
3132
  };
3133
3133
  let Nt = Date.now();
3134
3134
  const Yt = setInterval(() => {
3135
- var Je;
3135
+ var Ze;
3136
3136
  if (Date.now() - Nt > 18e5) {
3137
3137
  const Ie = "Stream idle timeout";
3138
- d(Ie), $ = "error", A = Ie, Y.abort(), (Je = N == null ? void 0 : N.onError) == null || Je.call(N, Ie);
3138
+ d(Ie), $ = "error", A = Ie, Y.abort(), (Ze = N == null ? void 0 : N.onError) == null || Ze.call(N, Ie);
3139
3139
  }
3140
3140
  }, 5e3), Xt = 1024 * 1024;
3141
3141
  try {
3142
- const Je = Ge.headers.get("X-Thread-Id") || Ge.headers.get("x-thread-id"), Ie = Ge.headers.get("X-Thread-Created") || Ge.headers.get("x-thread-created"), Ot = Je ?? null, re = String(Ie ?? "").toLowerCase() === "true";
3142
+ const Ze = Ge.headers.get("X-Thread-Id") || Ge.headers.get("x-thread-id"), Ie = Ge.headers.get("X-Thread-Created") || Ge.headers.get("x-thread-created"), Ot = Ze ?? null, ee = String(Ie ?? "").toLowerCase() === "true";
3143
3143
  for (S.current && !S.current.threadId && (S.current = {
3144
3144
  ...S.current,
3145
3145
  threadId: Ot
3146
- }), (K = N == null ? void 0 : N.onOpen) == null || K.call(N, { threadId: Ot, created: re }); ; ) {
3146
+ }), (K = N == null ? void 0 : N.onOpen) == null || K.call(N, { threadId: Ot, created: ee }); ; ) {
3147
3147
  const { value: j, done: X } = await tt.read();
3148
3148
  if (X) break;
3149
3149
  ht += It.decode(j, { stream: !0 }), ht.length > Xt && (ht = "", console.warn("Stream buffer reset: exceeded 1MB"));
3150
- let ee;
3151
- for (; (ee = ht.indexOf(`
3150
+ let J;
3151
+ for (; (J = ht.indexOf(`
3152
3152
 
3153
3153
  `)) >= 0; ) {
3154
- const me = ht.slice(0, ee);
3155
- ht = ht.slice(ee + 2);
3154
+ const me = ht.slice(0, J);
3155
+ ht = ht.slice(J + 2);
3156
3156
  const $e = Dx(me);
3157
3157
  if (!$e) continue;
3158
3158
  let St;
@@ -3215,10 +3215,10 @@ function Ox(e = {}) {
3215
3215
  m(Se.checkpointId);
3216
3216
  else if (Se.type === "error") {
3217
3217
  const Ce = Se;
3218
- if (d(Ce.message), $ = "error", A = Ce.message, Ce.error_type === "auth_error" || Ce.code === "TOKEN_EXPIRED" || ((ne = Ce.message) == null ? void 0 : ne.includes("token")) || ((ie = Ce.message) == null ? void 0 : ie.includes("401")) || ((oe = Ce.message) == null ? void 0 : oe.includes("unauthorized")) || ((Me = Ce.message) == null ? void 0 : Me.includes("Unauthorized"))) {
3218
+ if (d(Ce.message), $ = "error", A = Ce.message, Ce.error_type === "auth_error" || Ce.code === "TOKEN_EXPIRED" || ((re = Ce.message) == null ? void 0 : re.includes("token")) || ((ie = Ce.message) == null ? void 0 : ie.includes("401")) || ((oe = Ce.message) == null ? void 0 : oe.includes("unauthorized")) || ((Oe = Ce.message) == null ? void 0 : Oe.includes("Unauthorized"))) {
3219
3219
  console.error("[use-chat] Auth error detected:", Ce.message);
3220
3220
  try {
3221
- (Ze = N == null ? void 0 : N.onAuthError) == null || Ze.call(N, Ce.message);
3221
+ (Je = N == null ? void 0 : N.onAuthError) == null || Je.call(N, Ce.message);
3222
3222
  } catch (Ir) {
3223
3223
  console.warn("[use-chat] onAuthError handler failed", Ir);
3224
3224
  }
@@ -3228,12 +3228,12 @@ function Ox(e = {}) {
3228
3228
  }
3229
3229
  }
3230
3230
  We(), $ === null && !Y.signal.aborted && ($ = "complete");
3231
- } catch (Je) {
3232
- if (Je.name === "AbortError")
3231
+ } catch (Ze) {
3232
+ if (Ze.name === "AbortError")
3233
3233
  $ = $ ?? "aborted";
3234
3234
  else {
3235
- const Ie = Je.message || String(Je);
3236
- $ = "error", A = Ie, d(Ie), (Pe = N == null ? void 0 : N.onError) == null || Pe.call(N, Ie);
3235
+ const Ie = Ze.message || String(Ze);
3236
+ $ = "error", A = Ie, d(Ie), (De = N == null ? void 0 : N.onError) == null || De.call(N, Ie);
3237
3237
  }
3238
3238
  } finally {
3239
3239
  try {
@@ -3249,12 +3249,12 @@ function Ox(e = {}) {
3249
3249
  $ = $ ?? "aborted";
3250
3250
  else {
3251
3251
  const qe = Ue.message || String(Ue);
3252
- $ = "error", A = qe, d(qe), (he = N == null ? void 0 : N.onError) == null || he.call(N, qe), J || ((Le = N == null ? void 0 : N.onConnectionError) == null || Le.call(N, qe), J = !0);
3252
+ $ = "error", A = qe, d(qe), (he = N == null ? void 0 : N.onError) == null || he.call(N, qe), Z || ((Le = N == null ? void 0 : N.onConnectionError) == null || Le.call(N, qe), Z = !0);
3253
3253
  }
3254
3254
  } finally {
3255
3255
  const Ue = C.current, qe = k.current, ze = E.current, Ke = _.current, Ge = $ ?? (Y.signal.aborted ? "aborted" : A ? "error" : "complete");
3256
3256
  try {
3257
- (De = N == null ? void 0 : N.onClosed) == null || De.call(N, {
3257
+ (Me = N == null ? void 0 : N.onClosed) == null || Me.call(N, {
3258
3258
  reason: Ge,
3259
3259
  lastSeq: Ue,
3260
3260
  lastCheckpointId: qe,
@@ -3862,7 +3862,7 @@ function Vx({
3862
3862
  }
3863
3863
  },
3864
3864
  onClosed: (F) => {
3865
- var Y, $, A, J;
3865
+ var Y, $, A, Z;
3866
3866
  const I = ((Y = h.current) == null ? void 0 : Y.manualStop) ?? !1, z = f.current ?? (($ = h.current) == null ? void 0 : $.threadIdGuess) ?? ((A = F.lastStateHistory) == null ? void 0 : A.threadId) ?? null;
3867
3867
  (F.reason === "complete" || F.reason === "aborted" && I) && g(z);
3868
3868
  const N = {
@@ -3878,7 +3878,7 @@ function Vx({
3878
3878
  console.warn("[useChatStreamingService] onStreamClosed handler failed", q);
3879
3879
  }
3880
3880
  try {
3881
- (J = O == null ? void 0 : O.onClosed) == null || J.call(O, N);
3881
+ (Z = O == null ? void 0 : O.onClosed) == null || Z.call(O, N);
3882
3882
  } catch (q) {
3883
3883
  console.warn("[useChatStreamingService] downstream onClosed handler failed", q);
3884
3884
  }
@@ -3924,96 +3924,102 @@ function Kx({
3924
3924
  onAuthError: i,
3925
3925
  onThreadChange: a
3926
3926
  }) {
3927
- const { api: l, baseUrl: c } = xu(), d = nt(() => En(c), [c]), [f, p] = ye([]), [h, m] = ye(t), [y, x] = ye(!1), [g, w] = ye(null), [b, T] = ye(!1), [C, S] = ye(null), { state: k, seed: E, prepend: _, pushUser: L, onEvent: P } = zx(), [O, F] = ye(!1), [I, z] = ye(!1), [N, Y] = ye(null), [$, A] = ye([]), [J, q] = ye([]), [pe, be] = ye(!1), Ee = nt(
3928
- () => $.flatMap((re) => re.messages ?? []),
3927
+ const { api: l, baseUrl: c } = xu(), d = nt(() => En(c), [c]), [f, p] = ye([]), [h, m] = ye(t), [y, x] = ye(!1), [g, w] = ye(null), [b, T] = ye(!1), [C, S] = ye(null), { state: k, seed: E, prepend: _, pushUser: L, onEvent: P } = zx(), [O, F] = ye(!1), [I, z] = ye(!1), [N, Y] = ye(null), [$, A] = ye([]), [Z, q] = ye([]), [pe, be] = ye(!1), Ee = nt(
3928
+ () => $.flatMap((ee) => ee.messages ?? []),
3929
3929
  [$]
3930
- ), G = nt(() => Px(Ee), [Ee]), W = He(h), K = He(null), D = He(null), H = He(null), ne = He(null), ie = He(!1), oe = He(null), Me = He(/* @__PURE__ */ new Map()), Ze = He(/* @__PURE__ */ new Set());
3930
+ ), G = nt(() => Px(Ee), [Ee]), W = He(h), K = He(null), D = He(null), H = He(null), re = He(null), ie = He(!1), oe = He(null), Oe = He(/* @__PURE__ */ new Map()), Je = He(/* @__PURE__ */ new Map());
3931
3931
  Tt(() => {
3932
3932
  W.current = h;
3933
3933
  }, [h]);
3934
- const Pe = _e(async () => {
3934
+ const De = _e(async () => {
3935
3935
  x(!0), w(null);
3936
3936
  try {
3937
- const re = await l.listThreads();
3938
- p(re ?? []);
3939
- } catch (re) {
3940
- const j = String(re);
3937
+ const ee = await l.listThreads();
3938
+ p(ee ?? []);
3939
+ } catch (ee) {
3940
+ const j = String(ee);
3941
3941
  w(j), s == null || s(j);
3942
3942
  } finally {
3943
3943
  x(!1);
3944
3944
  }
3945
- }, [l, s]), se = _e((re) => {
3946
- if (!(re != null && re.threadId)) return;
3945
+ }, [l, s]), se = _e((ee) => {
3946
+ if (!(ee != null && ee.threadId)) return;
3947
3947
  const j = {
3948
- threadId: re.threadId,
3949
- title: re.title || `Thread ${re.threadId.slice(0, 8)}`,
3950
- createdAt: re.createdAt || (/* @__PURE__ */ new Date()).toISOString(),
3951
- updatedAt: re.updatedAt || (/* @__PURE__ */ new Date()).toISOString(),
3952
- messageCount: re.messageCount ?? 1
3948
+ threadId: ee.threadId,
3949
+ title: ee.title || `Thread ${ee.threadId.slice(0, 8)}`,
3950
+ createdAt: ee.createdAt || (/* @__PURE__ */ new Date()).toISOString(),
3951
+ updatedAt: ee.updatedAt || (/* @__PURE__ */ new Date()).toISOString(),
3952
+ messageCount: ee.messageCount ?? 1
3953
3953
  };
3954
3954
  p((X) => X.some((me) => me.threadId === j.threadId) ? (console.debug("[ChatSessionProvider] thread_info: thread already in list", j.threadId), X) : (console.debug("[ChatSessionProvider] thread_info: adding thread to list", j.threadId), [j, ...X]));
3955
3955
  }, []), he = _e(
3956
- (re) => {
3957
- const j = re.threadId ?? W.current;
3956
+ (ee) => {
3957
+ const j = ee.threadId ?? W.current;
3958
3958
  if (!j || W.current && W.current !== j)
3959
3959
  return;
3960
- const { checkpoints: X, timeline: ee } = cr(re);
3960
+ const { checkpoints: X, timeline: J } = cr(ee);
3961
3961
  if (!X.length)
3962
3962
  return;
3963
3963
  const me = X.find(($e) => $e.messages && $e.messages.length > 0) ?? X.find(($e) => !!$e.checkpointId) ?? X[0];
3964
3964
  E((me == null ? void 0 : me.messages) ?? [], {
3965
3965
  checkpointId: (me == null ? void 0 : me.checkpointId) ?? null,
3966
3966
  checkpointNs: (me == null ? void 0 : me.checkpointNs) ?? null
3967
- }), q(ee), A(X), F(!!(me != null && me.nextCursor)), Y((me == null ? void 0 : me.nextCursor) ?? null), Ze.current.add(j), oe.current = `${j}:latest`, D.current = null, H.current = null;
3967
+ }), q(J), A(X), F(!!(me != null && me.nextCursor)), Y((me == null ? void 0 : me.nextCursor) ?? null), oe.current = `${j}:latest`, D.current = null, H.current = null;
3968
3968
  },
3969
3969
  [E]
3970
- ), Le = _e((re) => {
3971
- console.log("[ChatSessionProvider] 🎯 Received thread_info:", re.threadId), se(re), W.current !== re.threadId && ((re.created ?? !W.current) && (D.current = re.threadId), H.current = re.threadId, console.log("[ChatSessionProvider] thread_info: marking to skip auto-load for new thread"), m(re.threadId));
3972
- }, [se]), { startStream: De, stop: Ue, isStreaming: qe, error: ze, setAuthToken: Ke } = Vx({
3970
+ ), Le = _e((ee) => {
3971
+ console.log("[ChatSessionProvider] 🎯 Received thread_info:", ee.threadId), se(ee), W.current !== ee.threadId && ((ee.created ?? !W.current) && (D.current = ee.threadId), H.current = ee.threadId, console.log("[ChatSessionProvider] thread_info: marking to skip auto-load for new thread"), m(ee.threadId));
3972
+ }, [se]), { startStream: Me, stop: Ue, isStreaming: qe, error: ze, setAuthToken: Ke } = Vx({
3973
3973
  baseUrl: d,
3974
3974
  onThreadInfo: Le,
3975
3975
  onMessageEvent: P,
3976
3976
  onStateHistory: he,
3977
- onUnhandledEvent: (re) => {
3978
- console.warn("[ChatSessionProvider] Unhandled event:", re.type);
3977
+ onUnhandledEvent: (ee) => {
3978
+ console.warn("[ChatSessionProvider] Unhandled event:", ee.type);
3979
3979
  },
3980
3980
  onAuthError: i
3981
3981
  }), Ge = _e(
3982
- async (re) => {
3982
+ async (ee) => {
3983
3983
  try {
3984
- const j = await l.createThread(re);
3985
- return m(j.threadId), await Pe(), j.threadId;
3984
+ const j = await l.createThread(ee);
3985
+ return m(j.threadId), await De(), j.threadId;
3986
3986
  } catch (j) {
3987
3987
  return s == null || s(String(j)), null;
3988
3988
  }
3989
3989
  },
3990
- [l, Pe, s]
3990
+ [l, De, s]
3991
3991
  ), tt = _e(
3992
- async (re) => {
3992
+ async (ee) => {
3993
+ const j = f;
3994
+ p((J) => J.filter((me) => me.threadId !== ee));
3995
+ const X = new AbortController();
3996
+ Je.current.set(ee, X);
3993
3997
  try {
3994
- await l.deleteThread(re), W.current === re && (m(null), E([], {})), await Pe();
3995
- } catch (j) {
3996
- s == null || s(String(j));
3998
+ await l.deleteThread(ee), W.current === ee && (m(null), E([], {})), console.log("[ChatSessionProvider] Thread deleted successfully:", ee);
3999
+ } catch (J) {
4000
+ console.error("[ChatSessionProvider] Delete failed, restoring thread:", ee, J), p(j), s == null || s(`Failed to delete thread: ${String(J)}`);
4001
+ } finally {
4002
+ Je.current.delete(ee);
3997
4003
  }
3998
4004
  },
3999
- [l, Pe, E, s]
4005
+ [f, l, E, s]
4000
4006
  ), It = _e(
4001
- async (re, j) => {
4007
+ async (ee, j) => {
4002
4008
  try {
4003
- await l.updateThread(re, j), await Pe();
4009
+ await l.updateThread(ee, j), await De();
4004
4010
  } catch (X) {
4005
4011
  s == null || s(String(X));
4006
4012
  }
4007
4013
  },
4008
- [l, Pe, s]
4014
+ [l, De, s]
4009
4015
  ), ht = _e(
4010
- async (re, j) => {
4011
- if (!re) return;
4012
- const X = `${re}:${j ?? "latest"}`, ee = Me.current.get(X);
4013
- if (ee)
4014
- return ee;
4016
+ async (ee, j) => {
4017
+ if (!ee) return;
4018
+ const X = `${ee}:${j ?? "latest"}`, J = Oe.current.get(X);
4019
+ if (J)
4020
+ return J;
4015
4021
  const me = (async () => {
4016
- const $e = re;
4022
+ const $e = ee;
4017
4023
  T(!0), S(null);
4018
4024
  try {
4019
4025
  const St = await l.getStateHistory({
@@ -4038,22 +4044,22 @@ function Kx({
4038
4044
  T(!1);
4039
4045
  }
4040
4046
  })();
4041
- Me.current.set(X, me);
4047
+ Oe.current.set(X, me);
4042
4048
  try {
4043
4049
  await me;
4044
4050
  } finally {
4045
- Me.current.delete(X);
4051
+ Oe.current.delete(X);
4046
4052
  }
4047
- return W.current === re && (oe.current = X), me;
4053
+ return W.current === ee && (oe.current = X), me;
4048
4054
  },
4049
4055
  [l, E, s]
4050
4056
  ), lt = _e(
4051
- async (re, j) => {
4052
- ne.current = re;
4057
+ async (ee, j) => {
4058
+ re.current = ee;
4053
4059
  try {
4054
- await ht(re, j);
4060
+ await ht(ee, j);
4055
4061
  } finally {
4056
- ne.current === re && (ne.current = null);
4062
+ re.current === ee && (re.current = null);
4057
4063
  }
4058
4064
  },
4059
4065
  [ht]
@@ -4069,16 +4075,16 @@ function Kx({
4069
4075
  K.current = h;
4070
4076
  return;
4071
4077
  }
4072
- if (ne.current === h) {
4073
- ne.current = null, K.current = h;
4078
+ if (re.current === h) {
4079
+ re.current = null, K.current = h;
4074
4080
  return;
4075
4081
  }
4076
4082
  if (K.current === h)
4077
4083
  return;
4078
4084
  K.current = h;
4079
- const re = !ie.current && !!n && h === t;
4085
+ const ee = !ie.current && !!n && h === t;
4080
4086
  let j;
4081
- re && n ? (j = n, ie.current = !0, console.log(
4087
+ ee && n ? (j = n, ie.current = !0, console.log(
4082
4088
  "[ChatSessionProvider] Loading thread with checkpoint:",
4083
4089
  j,
4084
4090
  r ? `(ns: ${r})` : ""
@@ -4096,26 +4102,26 @@ function Kx({
4096
4102
  lt
4097
4103
  ]);
4098
4104
  const mt = _e(
4099
- async (re, j) => {
4105
+ async (ee, j) => {
4100
4106
  const X = W.current;
4101
4107
  if (!X) return;
4102
- const ee = X;
4108
+ const J = X;
4103
4109
  be(!0);
4104
4110
  try {
4105
4111
  const me = await l.getStateHistory({
4106
- threadId: ee,
4107
- checkpointId: re,
4112
+ threadId: J,
4113
+ checkpointId: ee,
4108
4114
  checkpointNs: j ?? void 0
4109
4115
  });
4110
- if (W.current !== ee) {
4111
- console.log(`[ChatSessionProvider] Thread changed during checkpoint navigation (was ${ee}, now ${W.current}), discarding stale data`);
4116
+ if (W.current !== J) {
4117
+ console.log(`[ChatSessionProvider] Thread changed during checkpoint navigation (was ${J}, now ${W.current}), discarding stale data`);
4112
4118
  return;
4113
4119
  }
4114
4120
  const { checkpoints: $e, timeline: St } = cr(me), Se = $e.find(
4115
- (vt) => vt.checkpointId === re && (j ? vt.checkpointNs === j : !0)
4121
+ (vt) => vt.checkpointId === ee && (j ? vt.checkpointNs === j : !0)
4116
4122
  );
4117
4123
  if (!Se) {
4118
- console.warn("[ChatSessionProvider] Requested checkpoint not found:", { checkpointId: re, checkpointNs: j });
4124
+ console.warn("[ChatSessionProvider] Requested checkpoint not found:", { checkpointId: ee, checkpointNs: j });
4119
4125
  return;
4120
4126
  }
4121
4127
  q(St), A($e), E(Se.messages ?? [], {
@@ -4123,16 +4129,16 @@ function Kx({
4123
4129
  checkpointNs: Se.checkpointNs ?? null
4124
4130
  });
4125
4131
  } catch (me) {
4126
- W.current === ee && (s == null || s(String(me)));
4132
+ W.current === J && (s == null || s(String(me)));
4127
4133
  } finally {
4128
4134
  be(!1);
4129
4135
  }
4130
4136
  },
4131
4137
  [l, E, s]
4132
4138
  ), it = _e(
4133
- (re, j) => {
4139
+ (ee, j) => {
4134
4140
  E(k.messages, {
4135
- checkpointId: re ?? null,
4141
+ checkpointId: ee ?? null,
4136
4142
  checkpointNs: j ?? null
4137
4143
  });
4138
4144
  },
@@ -4141,24 +4147,24 @@ function Kx({
4141
4147
  W.current && await lt(W.current);
4142
4148
  }, [lt]), At = _e(async () => {
4143
4149
  if (!W.current || !N) return;
4144
- const re = W.current;
4150
+ const ee = W.current;
4145
4151
  z(!0);
4146
4152
  try {
4147
4153
  const j = await l.getStateHistory({
4148
- threadId: re,
4154
+ threadId: ee,
4149
4155
  checkpointId: N
4150
4156
  });
4151
- if (W.current !== re) {
4152
- console.log(`[ChatSessionProvider] Thread changed during history load (was ${re}, now ${W.current}), discarding stale data`);
4157
+ if (W.current !== ee) {
4158
+ console.log(`[ChatSessionProvider] Thread changed during history load (was ${ee}, now ${W.current}), discarding stale data`);
4153
4159
  return;
4154
4160
  }
4155
4161
  const { checkpoints: X } = cr(j);
4156
4162
  if (X.length > 0) {
4157
- const ee = X[X.length - 1];
4158
- _((ee == null ? void 0 : ee.messages) ?? []), F(!!(ee != null && ee.nextCursor)), Y((ee == null ? void 0 : ee.nextCursor) ?? null);
4163
+ const J = X[X.length - 1];
4164
+ _((J == null ? void 0 : J.messages) ?? []), F(!!(J != null && J.nextCursor)), Y((J == null ? void 0 : J.nextCursor) ?? null);
4159
4165
  }
4160
4166
  } catch (j) {
4161
- W.current === re && (s == null || s(String(j)));
4167
+ W.current === ee && (s == null || s(String(j)));
4162
4168
  } finally {
4163
4169
  z(!1);
4164
4170
  }
@@ -4166,41 +4172,41 @@ function Kx({
4166
4172
  E([], {}), m(null), Ue(), A([]), q([]), F(!1), Y(null), T(!1), be(!1), z(!1), S(null);
4167
4173
  try {
4168
4174
  await l.getAgent("default");
4169
- } catch (re) {
4170
- console.warn("[ChatSessionProvider] Failed to refetch agent after clearing thread:", re);
4175
+ } catch (ee) {
4176
+ console.warn("[ChatSessionProvider] Failed to refetch agent after clearing thread:", ee);
4171
4177
  }
4172
4178
  }, [E, Ue, l]), Yt = _e(
4173
- async (re, j, X) => {
4174
- const ee = W.current;
4175
- if (!ee)
4179
+ async (ee, j, X) => {
4180
+ const J = W.current;
4181
+ if (!J)
4176
4182
  throw new Error("No active thread to handle interrupt");
4177
4183
  const me = j ? X ?? !0 : !1;
4178
4184
  try {
4179
4185
  const $e = {
4180
- threadId: ee,
4186
+ threadId: J,
4181
4187
  checkpointId: k.lastCheckpointId ?? void 0,
4182
4188
  checkpointNs: k.lastCheckpointNs ?? void 0,
4183
4189
  // The command is the key: backend extracts this and routes to LangGraph
4184
4190
  command: { kind: "resume", value: me }
4185
4191
  };
4186
- De($e);
4192
+ Me($e);
4187
4193
  } catch ($e) {
4188
- throw console.error(`[ChatSessionProvider] Failed to handle interrupt ${re}:`, $e), $e;
4194
+ throw console.error(`[ChatSessionProvider] Failed to handle interrupt ${ee}:`, $e), $e;
4189
4195
  }
4190
4196
  },
4191
- [k.lastCheckpointId, k.lastCheckpointNs, De]
4197
+ [k.lastCheckpointId, k.lastCheckpointNs, Me]
4192
4198
  );
4193
4199
  Tt(() => {
4194
- Pe();
4195
- }, [Pe]), Tt(() => {
4200
+ De();
4201
+ }, [De]), Tt(() => {
4196
4202
  a == null || a(h);
4197
4203
  }, [h, a]);
4198
4204
  const Xt = _e(
4199
- async (re, j) => {
4205
+ async (ee, j) => {
4200
4206
  let X = W.current;
4201
- const ee = (re == null ? void 0 : re.text) ?? "";
4202
- if (!X && !ee) return;
4203
- if (!X && ee) {
4207
+ const J = (ee == null ? void 0 : ee.text) ?? "";
4208
+ if (!X && !J) return;
4209
+ if (!X && J) {
4204
4210
  const vt = Math.floor(Date.now() / 1e3).toString(16).padStart(8, "0"), Ce = Array.from(
4205
4211
  { length: 4 },
4206
4212
  () => Math.floor(Math.random() * 4294967295).toString(16).padStart(8, "0")
@@ -4209,9 +4215,9 @@ function Kx({
4209
4215
  }
4210
4216
  const { contentParts: me } = await dx(
4211
4217
  l,
4212
- (re == null ? void 0 : re.attachments) ?? []
4218
+ (ee == null ? void 0 : ee.attachments) ?? []
4213
4219
  ), $e = [...me];
4214
- ee != null && ee.trim() && $e.push({ type: "text", text: ee });
4220
+ J != null && J.trim() && $e.push({ type: "text", text: J });
4215
4221
  const St = {
4216
4222
  id: `msg-${Date.now()}`,
4217
4223
  role: "user",
@@ -4227,10 +4233,10 @@ function Kx({
4227
4233
  checkpointId: (j == null ? void 0 : j.checkpointId) ?? k.lastCheckpointId ?? void 0,
4228
4234
  checkpointNs: (j == null ? void 0 : j.checkpointNs) ?? k.lastCheckpointNs ?? void 0
4229
4235
  };
4230
- De(Se);
4236
+ Me(Se);
4231
4237
  },
4232
- [l, Ge, L, k, De]
4233
- ), Je = nt(
4238
+ [l, Ge, L, k, Me]
4239
+ ), Ze = nt(
4234
4240
  () => ({
4235
4241
  threads: f,
4236
4242
  currentThreadId: h,
@@ -4241,10 +4247,10 @@ function Kx({
4241
4247
  createThread: Ge,
4242
4248
  deleteThread: tt,
4243
4249
  renameThread: It,
4244
- refreshThreads: Pe
4250
+ refreshThreads: De
4245
4251
  }
4246
4252
  }),
4247
- [f, h, y, g, Ge, tt, It, Pe]
4253
+ [f, h, y, g, Ge, tt, It, De]
4248
4254
  ), Ie = nt(
4249
4255
  () => ({
4250
4256
  threadId: h,
@@ -4255,7 +4261,7 @@ function Kx({
4255
4261
  namespace: k.lastCheckpointNs ?? null
4256
4262
  },
4257
4263
  checkpoints: $,
4258
- timelineCheckpoints: J,
4264
+ timelineCheckpoints: Z,
4259
4265
  metadata: null,
4260
4266
  isLoading: b,
4261
4267
  isHistoryLoading: I,
@@ -4276,7 +4282,7 @@ function Kx({
4276
4282
  h,
4277
4283
  k,
4278
4284
  $,
4279
- J,
4285
+ Z,
4280
4286
  b,
4281
4287
  I,
4282
4288
  pe,
@@ -4303,7 +4309,7 @@ function Kx({
4303
4309
  }),
4304
4310
  [qe, ze, Xt, Ue, Ke]
4305
4311
  );
4306
- return /* @__PURE__ */ u.jsx(Cu.Provider, { value: Je, children: /* @__PURE__ */ u.jsx(Tu.Provider, { value: Ie, children: /* @__PURE__ */ u.jsx(ku.Provider, { value: Ot, children: e }) }) });
4312
+ return /* @__PURE__ */ u.jsx(Cu.Provider, { value: Ze, children: /* @__PURE__ */ u.jsx(Tu.Provider, { value: Ie, children: /* @__PURE__ */ u.jsx(ku.Provider, { value: Ot, children: e }) }) });
4307
4313
  }
4308
4314
  function da() {
4309
4315
  const e = fs(Cu);
@@ -4345,7 +4351,7 @@ function ii({
4345
4351
  }
4346
4352
  ) });
4347
4353
  }
4348
- function te(...e) {
4354
+ function ne(...e) {
4349
4355
  return km(Tm(e));
4350
4356
  }
4351
4357
  const Gx = hs(
@@ -4378,7 +4384,7 @@ const Gx = hs(
4378
4384
  return /* @__PURE__ */ u.jsx(
4379
4385
  i,
4380
4386
  {
4381
- className: te(Gx({ variant: t, size: n, className: e })),
4387
+ className: ne(Gx({ variant: t, size: n, className: e })),
4382
4388
  ref: s,
4383
4389
  ...o
4384
4390
  }
@@ -4390,7 +4396,7 @@ const Ru = v.forwardRef(
4390
4396
  ({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
4391
4397
  "textarea",
4392
4398
  {
4393
- className: te(
4399
+ className: ne(
4394
4400
  "flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
4395
4401
  e
4396
4402
  ),
@@ -4443,7 +4449,7 @@ function Yx({
4443
4449
  id: Y,
4444
4450
  shouldClear: !0
4445
4451
  }, b(() => {
4446
- var $, A, J;
4452
+ var $, A, Z;
4447
4453
  try {
4448
4454
  const q = l(N);
4449
4455
  q && typeof q.then == "function" ? q.then(() => {
@@ -4454,7 +4460,7 @@ function Yx({
4454
4460
  ((pe = S.current) == null ? void 0 : pe.id) === Y && (S.current = null);
4455
4461
  }) : ((($ = S.current) == null ? void 0 : $.id) === Y && S.current.shouldClear && (m || (x(""), T.current && (T.current.style.height = "auto"), a == null || a(""))), ((A = S.current) == null ? void 0 : A.id) === Y && (S.current = null));
4456
4462
  } catch {
4457
- ((J = S.current) == null ? void 0 : J.id) === Y && (S.current = null);
4463
+ ((Z = S.current) == null ? void 0 : Z.id) === Y && (S.current = null);
4458
4464
  }
4459
4465
  });
4460
4466
  },
@@ -5374,7 +5380,7 @@ const Py = (e) => ({
5374
5380
  A === "y";
5375
5381
  }
5376
5382
  return !0;
5377
- }).map(($) => [$.placement, $.overflows.filter((A) => A > 0).reduce((A, J) => A + J, 0)]).sort(($, A) => $[1] - A[1])[0]) == null ? void 0 : F[0];
5383
+ }).map(($) => [$.placement, $.overflows.filter((A) => A > 0).reduce((A, Z) => A + Z, 0)]).sort(($, A) => $[1] - A[1])[0]) == null ? void 0 : F[0];
5378
5384
  Y && (N = Y);
5379
5385
  break;
5380
5386
  }
@@ -6215,7 +6221,7 @@ function Sv(e) {
6215
6221
  middleware: p
6216
6222
  };
6217
6223
  P.current && ($.platform = P.current), vv(S.current, k.current, $).then((A) => {
6218
- const J = {
6224
+ const Z = {
6219
6225
  ...A,
6220
6226
  // The floating element's position may be recomputed while it's closed
6221
6227
  // but still mounted (such as when transitioning out). To ensure
@@ -6223,8 +6229,8 @@ function Sv(e) {
6223
6229
  // setting it to `true` when `open === false` (must be specified).
6224
6230
  isPositioned: O.current !== !1
6225
6231
  };
6226
- I.current && !Xo(E.current, J) && (E.current = J, ms.flushSync(() => {
6227
- f(J);
6232
+ I.current && !Xo(E.current, Z) && (E.current = Z, ms.flushSync(() => {
6233
+ f(Z);
6228
6234
  }));
6229
6235
  });
6230
6236
  }, [p, t, n, P, O]);
@@ -6260,17 +6266,17 @@ function Sv(e) {
6260
6266
  };
6261
6267
  if (!N.floating)
6262
6268
  return $;
6263
- const A = Ql(N.floating, d.x), J = Ql(N.floating, d.y);
6269
+ const A = Ql(N.floating, d.x), Z = Ql(N.floating, d.y);
6264
6270
  return a ? {
6265
6271
  ...$,
6266
- transform: "translate(" + A + "px, " + J + "px)",
6272
+ transform: "translate(" + A + "px, " + Z + "px)",
6267
6273
  ...Bu(N.floating) >= 1.5 && {
6268
6274
  willChange: "transform"
6269
6275
  }
6270
6276
  } : {
6271
6277
  position: n,
6272
6278
  left: A,
6273
- top: J
6279
+ top: Z
6274
6280
  };
6275
6281
  }, [n, a, N.floating, d.x, d.y]);
6276
6282
  return v.useMemo(() => ({
@@ -6380,7 +6386,7 @@ var qu = "PopperAnchor", Gu = v.forwardRef(
6380
6386
  Gu.displayName = qu;
6381
6387
  var Ca = "PopperContent", [Ov, Mv] = Wu(Ca), Yu = v.forwardRef(
6382
6388
  (e, t) => {
6383
- var K, D, H, ne, ie, oe;
6389
+ var K, D, H, re, ie, oe;
6384
6390
  const {
6385
6391
  __scopePopper: n,
6386
6392
  side: r = "bottom",
@@ -6396,7 +6402,7 @@ var Ca = "PopperContent", [Ov, Mv] = Wu(Ca), Yu = v.forwardRef(
6396
6402
  updatePositionStrategy: h = "optimized",
6397
6403
  onPlaced: m,
6398
6404
  ...y
6399
- } = e, x = Vu(Ca, n), [g, w] = v.useState(null), b = Xe(t, (Me) => w(Me)), [T, C] = v.useState(null), S = Uu(T), k = (S == null ? void 0 : S.width) ?? 0, E = (S == null ? void 0 : S.height) ?? 0, _ = r + (s !== "center" ? "-" + s : ""), L = typeof d == "number" ? d : { top: 0, right: 0, bottom: 0, left: 0, ...d }, P = Array.isArray(c) ? c : [c], O = P.length > 0, F = {
6405
+ } = e, x = Vu(Ca, n), [g, w] = v.useState(null), b = Xe(t, (Oe) => w(Oe)), [T, C] = v.useState(null), S = Uu(T), k = (S == null ? void 0 : S.width) ?? 0, E = (S == null ? void 0 : S.height) ?? 0, _ = r + (s !== "center" ? "-" + s : ""), L = typeof d == "number" ? d : { top: 0, right: 0, bottom: 0, left: 0, ...d }, P = Array.isArray(c) ? c : [c], O = P.length > 0, F = {
6400
6406
  padding: L,
6401
6407
  boundary: P.filter(Lv),
6402
6408
  // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
@@ -6405,7 +6411,7 @@ var Ca = "PopperContent", [Ov, Mv] = Wu(Ca), Yu = v.forwardRef(
6405
6411
  // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
6406
6412
  strategy: "fixed",
6407
6413
  placement: _,
6408
- whileElementsMounted: (...Me) => fv(...Me, {
6414
+ whileElementsMounted: (...Oe) => fv(...Oe, {
6409
6415
  animationFrame: h === "always"
6410
6416
  }),
6411
6417
  elements: {
@@ -6422,16 +6428,16 @@ var Ca = "PopperContent", [Ov, Mv] = Wu(Ca), Yu = v.forwardRef(
6422
6428
  l && Ev({ ...F }),
6423
6429
  Iv({
6424
6430
  ...F,
6425
- apply: ({ elements: Me, rects: Ze, availableWidth: Pe, availableHeight: se }) => {
6426
- const { width: he, height: Le } = Ze.reference, De = Me.floating.style;
6427
- De.setProperty("--radix-popper-available-width", `${Pe}px`), De.setProperty("--radix-popper-available-height", `${se}px`), De.setProperty("--radix-popper-anchor-width", `${he}px`), De.setProperty("--radix-popper-anchor-height", `${Le}px`);
6431
+ apply: ({ elements: Oe, rects: Je, availableWidth: De, availableHeight: se }) => {
6432
+ const { width: he, height: Le } = Je.reference, Me = Oe.floating.style;
6433
+ Me.setProperty("--radix-popper-available-width", `${De}px`), Me.setProperty("--radix-popper-available-height", `${se}px`), Me.setProperty("--radix-popper-anchor-width", `${he}px`), Me.setProperty("--radix-popper-anchor-height", `${Le}px`);
6428
6434
  }
6429
6435
  }),
6430
6436
  T && Av({ element: T, padding: a }),
6431
6437
  $v({ arrowWidth: k, arrowHeight: E }),
6432
6438
  p && Nv({ strategy: "referenceHidden", ...F })
6433
6439
  ]
6434
- }), [A, J] = Zu(N), q = jt(m);
6440
+ }), [A, Z] = Zu(N), q = jt(m);
6435
6441
  Pt(() => {
6436
6442
  Y && (q == null || q());
6437
6443
  }, [Y, q]);
@@ -6450,7 +6456,7 @@ var Ca = "PopperContent", [Ov, Mv] = Wu(Ca), Yu = v.forwardRef(
6450
6456
  minWidth: "max-content",
6451
6457
  zIndex: G,
6452
6458
  "--radix-popper-transform-origin": [
6453
- (ne = $.transformOrigin) == null ? void 0 : ne.x,
6459
+ (re = $.transformOrigin) == null ? void 0 : re.x,
6454
6460
  (ie = $.transformOrigin) == null ? void 0 : ie.y
6455
6461
  ].join(" "),
6456
6462
  // hide the content if using the hide middleware and should be hidden
@@ -6475,7 +6481,7 @@ var Ca = "PopperContent", [Ov, Mv] = Wu(Ca), Yu = v.forwardRef(
6475
6481
  Ae.div,
6476
6482
  {
6477
6483
  "data-side": A,
6478
- "data-align": J,
6484
+ "data-align": Z,
6479
6485
  ...y,
6480
6486
  ref: b,
6481
6487
  style: {
@@ -7434,10 +7440,10 @@ var tn = "MenuContent", [Xw, Ea] = tr(tn), Cd = v.forwardRef(
7434
7440
  ...y
7435
7441
  } = e, x = nr(tn, n), g = fo(tn, n), w = js(n), b = vd(n), T = Ww(n), [C, S] = v.useState(null), k = v.useRef(null), E = Xe(t, k, x.onContentChange), _ = v.useRef(0), L = v.useRef(""), P = v.useRef(0), O = v.useRef(null), F = v.useRef("right"), I = v.useRef(0), z = m ? _s : v.Fragment, N = m ? { as: Qw, allowPinchZoom: !0 } : void 0, Y = (A) => {
7436
7442
  var K, D;
7437
- const J = L.current + A, q = T().filter((H) => !H.disabled), pe = document.activeElement, be = (K = q.find((H) => H.ref.current === pe)) == null ? void 0 : K.textValue, Ee = q.map((H) => H.textValue), G = db(Ee, J, be), W = (D = q.find((H) => H.textValue === G)) == null ? void 0 : D.ref.current;
7438
- (function H(ne) {
7439
- L.current = ne, window.clearTimeout(_.current), ne !== "" && (_.current = window.setTimeout(() => H(""), 1e3));
7440
- })(J), W && setTimeout(() => W.focus());
7443
+ const Z = L.current + A, q = T().filter((H) => !H.disabled), pe = document.activeElement, be = (K = q.find((H) => H.ref.current === pe)) == null ? void 0 : K.textValue, Ee = q.map((H) => H.textValue), G = db(Ee, Z, be), W = (D = q.find((H) => H.textValue === G)) == null ? void 0 : D.ref.current;
7444
+ (function H(re) {
7445
+ L.current = re, window.clearTimeout(_.current), re !== "" && (_.current = window.setTimeout(() => H(""), 1e3));
7446
+ })(Z), W && setTimeout(() => W.focus());
7441
7447
  };
7442
7448
  v.useEffect(() => () => window.clearTimeout(_.current), []), ma();
7443
7449
  const $ = v.useCallback((A) => {
@@ -7457,8 +7463,8 @@ var tn = "MenuContent", [Xw, Ea] = tr(tn), Cd = v.forwardRef(
7457
7463
  ),
7458
7464
  onItemLeave: v.useCallback(
7459
7465
  (A) => {
7460
- var J;
7461
- $(A) || ((J = k.current) == null || J.focus(), S(null));
7466
+ var Z;
7467
+ $(A) || ((Z = k.current) == null || Z.focus(), S(null));
7462
7468
  },
7463
7469
  [$]
7464
7470
  ),
@@ -7478,8 +7484,8 @@ var tn = "MenuContent", [Xw, Ea] = tr(tn), Cd = v.forwardRef(
7478
7484
  asChild: !0,
7479
7485
  trapped: o,
7480
7486
  onMountAutoFocus: fe(s, (A) => {
7481
- var J;
7482
- A.preventDefault(), (J = k.current) == null || J.focus({ preventScroll: !0 });
7487
+ var Z;
7488
+ A.preventDefault(), (Z = k.current) == null || Z.focus({ preventScroll: !0 });
7483
7489
  }),
7484
7490
  onUnmountAutoFocus: i,
7485
7491
  children: /* @__PURE__ */ u.jsx(
@@ -7533,8 +7539,8 @@ var tn = "MenuContent", [Xw, Ea] = tr(tn), Cd = v.forwardRef(
7533
7539
  onPointerMove: fe(
7534
7540
  e.onPointerMove,
7535
7541
  Yr((A) => {
7536
- const J = A.target, q = I.current !== A.clientX;
7537
- if (A.currentTarget.contains(J) && q) {
7542
+ const Z = A.target, q = I.current !== A.clientX;
7543
+ if (A.currentTarget.contains(Z) && q) {
7538
7544
  const pe = A.clientX > I.current ? "right" : "left";
7539
7545
  F.current = pe, I.current = A.clientX;
7540
7546
  }
@@ -8070,7 +8076,7 @@ const Yb = Kb, Xb = qb, Jb = v.forwardRef(({ className: e, inset: t, children: n
8070
8076
  cf,
8071
8077
  {
8072
8078
  ref: o,
8073
- className: te(
8079
+ className: ne(
8074
8080
  "flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",
8075
8081
  t && "pl-8",
8076
8082
  e
@@ -8087,7 +8093,7 @@ const Zb = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
8087
8093
  uf,
8088
8094
  {
8089
8095
  ref: n,
8090
- className: te(
8096
+ className: ne(
8091
8097
  "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
8092
8098
  e
8093
8099
  ),
@@ -8100,7 +8106,7 @@ const df = v.forwardRef(({ className: e, sideOffset: t = 4, ...n }, r) => /* @__
8100
8106
  {
8101
8107
  ref: r,
8102
8108
  sideOffset: t,
8103
- className: te(
8109
+ className: ne(
8104
8110
  "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
8105
8111
  e
8106
8112
  ),
@@ -8112,7 +8118,7 @@ const Hi = v.forwardRef(({ className: e, inset: t, ...n }, r) => /* @__PURE__ */
8112
8118
  rf,
8113
8119
  {
8114
8120
  ref: r,
8115
- className: te(
8121
+ className: ne(
8116
8122
  "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
8117
8123
  t && "pl-8",
8118
8124
  e
@@ -8125,7 +8131,7 @@ const Qb = v.forwardRef(({ className: e, children: t, checked: n, ...r }, o) =>
8125
8131
  of,
8126
8132
  {
8127
8133
  ref: o,
8128
- className: te(
8134
+ className: ne(
8129
8135
  "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
8130
8136
  e
8131
8137
  ),
@@ -8142,7 +8148,7 @@ const e0 = v.forwardRef(({ className: e, children: t, ...n }, r) => /* @__PURE__
8142
8148
  sf,
8143
8149
  {
8144
8150
  ref: r,
8145
- className: te(
8151
+ className: ne(
8146
8152
  "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
8147
8153
  e
8148
8154
  ),
@@ -8158,7 +8164,7 @@ const t0 = v.forwardRef(({ className: e, inset: t, ...n }, r) => /* @__PURE__ */
8158
8164
  nf,
8159
8165
  {
8160
8166
  ref: r,
8161
- className: te(
8167
+ className: ne(
8162
8168
  "px-2 py-1.5 text-sm font-semibold",
8163
8169
  t && "pl-8",
8164
8170
  e
@@ -8171,7 +8177,7 @@ const n0 = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
8171
8177
  lf,
8172
8178
  {
8173
8179
  ref: n,
8174
- className: te("-mx-1 my-1 h-px bg-muted", e),
8180
+ className: ne("-mx-1 my-1 h-px bg-muted", e),
8175
8181
  ...t
8176
8182
  }
8177
8183
  ));
@@ -8253,7 +8259,7 @@ function pt(...e) {
8253
8259
  function st(e, t) {
8254
8260
  return e($n, t);
8255
8261
  }
8256
- function Oe(e, t) {
8262
+ function Pe(e, t) {
8257
8263
  e(Ms, t);
8258
8264
  }
8259
8265
  function Pa(e) {
@@ -8364,7 +8370,7 @@ function d0(e) {
8364
8370
  }
8365
8371
  };
8366
8372
  }
8367
- function Z(e) {
8373
+ function Q(e) {
8368
8374
  let t = e;
8369
8375
  const n = Ye();
8370
8376
  return (r, o) => {
@@ -8383,7 +8389,7 @@ function Z(e) {
8383
8389
  };
8384
8390
  }
8385
8391
  function $t(e, t) {
8386
- return Ds(Z(t), (n) => ge(e, n));
8392
+ return Ds(Q(t), (n) => ge(e, n));
8387
8393
  }
8388
8394
  function Ye() {
8389
8395
  const e = [];
@@ -8433,7 +8439,7 @@ function Rt(...e) {
8433
8439
  return e.forEach((s, i) => {
8434
8440
  const a = Math.pow(2, i);
8435
8441
  st(s, (l) => {
8436
- n[i] = l, r = r | a, r === o && Oe(t, n);
8442
+ n[i] = l, r = r | a, r === o && Pe(t, n);
8437
8443
  });
8438
8444
  }), function(s, i) {
8439
8445
  switch (s) {
@@ -8467,12 +8473,12 @@ const h0 = {
8467
8473
  2: "warn"
8468
8474
  }, m0 = () => typeof globalThis > "u" ? window : globalThis, Fn = et(
8469
8475
  () => {
8470
- const e = Z(
8476
+ const e = Q(
8471
8477
  3
8472
8478
  /* ERROR */
8473
8479
  );
8474
8480
  return {
8475
- log: Z((t, n, r = 1) => {
8481
+ log: Q((t, n, r = 1) => {
8476
8482
  var o;
8477
8483
  const s = (o = m0().VIRTUOSO_LOG_LEVEL) != null ? o : Ct(e);
8478
8484
  r >= s && console[h0[r]](
@@ -8595,7 +8601,7 @@ function mf(e, t, n) {
8595
8601
  }
8596
8602
  const zt = et(
8597
8603
  () => {
8598
- const e = Ye(), t = Ye(), n = Z(0), r = Ye(), o = Z(0), s = Ye(), i = Ye(), a = Z(0), l = Z(0), c = Z(0), d = Z(0), f = Ye(), p = Ye(), h = Z(!1), m = Z(!1), y = Z(!1);
8604
+ const e = Ye(), t = Ye(), n = Q(0), r = Ye(), o = Q(0), s = Ye(), i = Ye(), a = Q(0), l = Q(0), c = Q(0), d = Q(0), f = Ye(), p = Ye(), h = Q(!1), m = Q(!1), y = Q(!1);
8599
8605
  return ge(
8600
8606
  U(
8601
8607
  e,
@@ -8775,7 +8781,7 @@ function Zr(e, t) {
8775
8781
  return !!(e && e[0] === t[0] && e[1] === t[1]);
8776
8782
  }
8777
8783
  const Ma = et(
8778
- () => ({ recalcInProgress: Z(!1) }),
8784
+ () => ({ recalcInProgress: Q(!1) }),
8779
8785
  [],
8780
8786
  { singleton: !0 }
8781
8787
  );
@@ -8943,7 +8949,7 @@ const N0 = {
8943
8949
  offsetWidth: "width"
8944
8950
  }, Cn = et(
8945
8951
  ([{ log: e }, { recalcInProgress: t }]) => {
8946
- const n = Ye(), r = Ye(), o = $t(r, 0), s = Ye(), i = Ye(), a = Z(0), l = Z([]), c = Z(void 0), d = Z(void 0), f = Z((C, S) => Mn(C, N0[S])), p = Z(void 0), h = Z(0), m = w0(), y = $t(
8952
+ const n = Ye(), r = Ye(), o = $t(r, 0), s = Ye(), i = Ye(), a = Q(0), l = Q([]), c = Q(void 0), d = Q(void 0), f = Q((C, S) => Mn(C, N0[S])), p = Q(void 0), h = Q(0), m = w0(), y = $t(
8947
8953
  U(n, Fe(l, e, h), vn(k0, m), ft()),
8948
8954
  m
8949
8955
  ), x = $t(
@@ -9029,10 +9035,10 @@ const N0 = {
9029
9035
  (C) => {
9030
9036
  const { groupIndices: S } = Ct(y);
9031
9037
  if (C > 0)
9032
- Oe(t, !0), Oe(s, C + dc(C, S));
9038
+ Pe(t, !0), Pe(s, C + dc(C, S));
9033
9039
  else if (C < 0) {
9034
9040
  const k = Ct(x);
9035
- k.length > 0 && (C -= dc(-C, k)), Oe(i, C);
9041
+ k.length > 0 && (C -= dc(-C, k)), Pe(i, C);
9036
9042
  }
9037
9043
  }
9038
9044
  ), st(U(a, Fe(e)), ([C, S]) => {
@@ -9215,7 +9221,7 @@ const kf = et(
9215
9221
  pt(Cn, zt)
9216
9222
  ), zn = et(
9217
9223
  ([{ log: e }]) => {
9218
- const t = Z(!1), n = Gt(
9224
+ const t = Q(!1), n = Gt(
9219
9225
  U(
9220
9226
  t,
9221
9227
  Re((r) => r),
@@ -9248,10 +9254,10 @@ const po = et(
9248
9254
  },
9249
9255
  { log: p }
9250
9256
  ]) => {
9251
- const h = Ye(), m = Ye(), y = Z(0);
9257
+ const h = Ye(), m = Ye(), y = Q(0);
9252
9258
  let x = null, g = null, w = null;
9253
9259
  function b() {
9254
- x && (x(), x = null), w && (w(), w = null), g && (clearTimeout(g), g = null), Oe(l, !1);
9260
+ x && (x(), x = null), w && (w(), w = null), g && (clearTimeout(g), g = null), Pe(l, !1);
9255
9261
  }
9256
9262
  return ge(
9257
9263
  U(
@@ -9265,11 +9271,11 @@ const po = et(
9265
9271
  F,
9266
9272
  I
9267
9273
  ]) => {
9268
- const z = Rf(T), { align: N, behavior: Y, offset: $ } = z, A = k - 1, J = Tf(z, C, A);
9269
- let q = Qr(J, C.offsetTree, O) + _;
9270
- N === "end" ? (q += F + fn(C.sizeTree, J)[1] - S + I, J === A && (q += L)) : N === "center" ? q += (F + fn(C.sizeTree, J)[1] - S + I) / 2 : q -= E, $ && (q += $);
9274
+ const z = Rf(T), { align: N, behavior: Y, offset: $ } = z, A = k - 1, Z = Tf(z, C, A);
9275
+ let q = Qr(Z, C.offsetTree, O) + _;
9276
+ N === "end" ? (q += F + fn(C.sizeTree, Z)[1] - S + I, Z === A && (q += L)) : N === "center" ? q += (F + fn(C.sizeTree, Z)[1] - S + I) / 2 : q -= E, $ && (q += $);
9271
9277
  const pe = (be) => {
9272
- b(), be ? (P("retrying to scroll to", { location: T }, Wt.DEBUG), Oe(h, T)) : (Oe(m, !0), P("list did not change, scroll successful", {}, Wt.DEBUG));
9278
+ b(), be ? (P("retrying to scroll to", { location: T }, Wt.DEBUG), Pe(h, T)) : (Pe(m, !0), P("list did not change, scroll successful", {}, Wt.DEBUG));
9273
9279
  };
9274
9280
  if (b(), Y === "smooth") {
9275
9281
  let be = !1;
@@ -9282,7 +9288,7 @@ const po = et(
9282
9288
  x = cn(U(t, j0(150)), pe);
9283
9289
  return g = setTimeout(() => {
9284
9290
  b();
9285
- }, 1200), Oe(l, !0), P("scrolling from index to", { behavior: Y, index: J, top: q }, Wt.DEBUG), { behavior: Y, top: q };
9291
+ }, 1200), Pe(l, !0), P("scrolling from index to", { behavior: Y, index: Z, top: q }, Wt.DEBUG), { behavior: Y, top: q };
9286
9292
  }
9287
9293
  )
9288
9294
  ),
@@ -9317,7 +9323,7 @@ function $a(e, t) {
9317
9323
  }
9318
9324
  const ho = et(
9319
9325
  ([{ defaultItemSize: e, listRefresh: t, sizes: n }, { scrollTop: r }, { scrollTargetReached: o, scrollToIndex: s }, { didMount: i }]) => {
9320
- const a = Z(!0), l = Z(0), c = Z(!0);
9326
+ const a = Q(!0), l = Q(0), c = Q(!0);
9321
9327
  return ge(
9322
9328
  U(
9323
9329
  i,
@@ -9343,11 +9349,11 @@ const ho = et(
9343
9349
  ),
9344
9350
  ([, d]) => {
9345
9351
  cn(o, () => {
9346
- Oe(c, !0);
9352
+ Pe(c, !0);
9347
9353
  }), La(4, () => {
9348
9354
  cn(r, () => {
9349
- Oe(a, !0);
9350
- }), Oe(s, d);
9355
+ Pe(a, !0);
9356
+ }), Pe(s, d);
9351
9357
  });
9352
9358
  }
9353
9359
  ), {
@@ -9372,7 +9378,7 @@ const eo = "up", Fr = "down", P0 = "none", O0 = {
9372
9378
  viewportHeight: 0
9373
9379
  }
9374
9380
  }, M0 = 0, mo = et(([{ footerHeight: e, headerHeight: t, scrollBy: n, scrollContainerState: r, scrollTop: o, viewportHeight: s }]) => {
9375
- const i = Z(!1), a = Z(!0), l = Ye(), c = Ye(), d = Z(4), f = Z(M0), p = $t(
9381
+ const i = Q(!1), a = Q(!0), l = Ye(), c = Ye(), d = Q(4), f = Q(M0), p = $t(
9376
9382
  U(
9377
9383
  Ui(U(ke(o), Jn(1), gn(!0)), U(ke(o), Jn(1), gn(!1), lc(100))),
9378
9384
  ft()
@@ -9458,7 +9464,7 @@ const eo = "up", Fr = "down", P0 = "none", O0 = {
9458
9464
  ),
9459
9465
  i
9460
9466
  ), ge(U(i, kn(50)), l);
9461
- const x = Z(Fr);
9467
+ const x = Q(Fr);
9462
9468
  ge(
9463
9469
  U(
9464
9470
  r,
@@ -9472,7 +9478,7 @@ const eo = "up", Fr = "down", P0 = "none", O0 = {
9472
9478
  ),
9473
9479
  x
9474
9480
  ), ge(U(r, kn(50), gn(P0)), x);
9475
- const g = Z(0);
9481
+ const g = Q(0);
9476
9482
  return ge(
9477
9483
  U(
9478
9484
  p,
@@ -9513,7 +9519,7 @@ function hc(e, t) {
9513
9519
  }
9514
9520
  const Fa = et(
9515
9521
  ([{ deviation: e, fixedHeaderHeight: t, headerHeight: n, scrollTop: r, viewportHeight: o }]) => {
9516
- const s = Ye(), i = Z(0), a = Z(0), l = Z(0), c = $t(
9522
+ const s = Ye(), i = Q(0), a = Q(0), l = Q(0), c = $t(
9517
9523
  U(
9518
9524
  Rt(
9519
9525
  ke(r),
@@ -9660,7 +9666,7 @@ const or = et(
9660
9666
  { didMount: h },
9661
9667
  { recalcInProgress: m }
9662
9668
  ]) => {
9663
- const y = Z([]), x = Z(0), g = Ye();
9669
+ const y = Q([]), x = Q(0), g = Ye();
9664
9670
  ge(s.topItemsIndexes, y);
9665
9671
  const w = $t(
9666
9672
  U(
@@ -9709,18 +9715,18 @@ const or = et(
9709
9715
  N,
9710
9716
  F
9711
9717
  );
9712
- const J = [];
9718
+ const Z = [];
9713
9719
  if (O.length > 0) {
9714
9720
  const G = O[0], W = O[O.length - 1];
9715
9721
  let K = 0;
9716
9722
  for (const D of Ls($, G, W)) {
9717
- const H = D.value, ne = Math.max(D.start, G), ie = Math.min(D.end, W);
9718
- for (let oe = ne; oe <= ie; oe++)
9719
- J.push({ data: z == null ? void 0 : z[oe], index: oe, offset: K, size: H }), K += H;
9723
+ const H = D.value, re = Math.max(D.start, G), ie = Math.min(D.end, W);
9724
+ for (let oe = re; oe <= ie; oe++)
9725
+ Z.push({ data: z == null ? void 0 : z[oe], index: oe, offset: K, size: H }), K += H;
9720
9726
  }
9721
9727
  }
9722
9728
  if (!P)
9723
- return Bo([], J, E, I, N, F);
9729
+ return Bo([], Z, E, I, N, F);
9724
9730
  const q = O.length > 0 ? O[O.length - 1] + 1 : 0, pe = T0(Y, S, k, q);
9725
9731
  if (pe.length === 0)
9726
9732
  return null;
@@ -9728,19 +9734,19 @@ const or = et(
9728
9734
  for (const W of pe) {
9729
9735
  const K = W.value;
9730
9736
  let D = K.offset, H = W.start;
9731
- const ne = K.size;
9737
+ const re = K.size;
9732
9738
  if (K.offset < S) {
9733
- H += Math.floor((S - K.offset + I) / (ne + I));
9739
+ H += Math.floor((S - K.offset + I) / (re + I));
9734
9740
  const oe = H - W.start;
9735
- D += oe * ne + oe * I;
9741
+ D += oe * re + oe * I;
9736
9742
  }
9737
- H < q && (D += (q - H) * ne, H = q);
9743
+ H < q && (D += (q - H) * re, H = q);
9738
9744
  const ie = Math.min(W.end, be);
9739
9745
  for (let oe = H; oe <= ie && !(D >= k); oe++)
9740
- G.push({ data: z == null ? void 0 : z[oe], index: oe, offset: D, size: ne }), D += ne + I;
9746
+ G.push({ data: z == null ? void 0 : z[oe], index: oe, offset: D, size: re }), D += re + I;
9741
9747
  }
9742
9748
  });
9743
- return Bo(Ee, J, E, I, N, F);
9749
+ return Bo(Ee, Z, E, I, N, F);
9744
9750
  }
9745
9751
  ),
9746
9752
  //@ts-expect-error filter needs to be fixed
@@ -9839,7 +9845,7 @@ const or = et(
9839
9845
  { singleton: !0 }
9840
9846
  ), L0 = et(
9841
9847
  ([{ viewportHeight: e }, { totalListHeight: t }]) => {
9842
- const n = Z(!1), r = $t(
9848
+ const n = Q(!1), r = $t(
9843
9849
  U(
9844
9850
  Rt(n, e, t),
9845
9851
  Re(([o]) => o),
@@ -9854,7 +9860,7 @@ const or = et(
9854
9860
  pt(zt, Nf),
9855
9861
  { singleton: !0 }
9856
9862
  ), Af = et(() => ({
9857
- context: Z(null)
9863
+ context: Q(null)
9858
9864
  })), $0 = ({
9859
9865
  itemBottom: e,
9860
9866
  itemTop: t,
@@ -9917,10 +9923,10 @@ const F0 = (e, t) => typeof e == "function" ? gc(e(t)) : t && gc(e), z0 = et(
9917
9923
  { context: p },
9918
9924
  { scrollIntoView: h }
9919
9925
  ]) => {
9920
- const m = Z(!1), y = Ye();
9926
+ const m = Q(!1), y = Ye();
9921
9927
  let x = null;
9922
9928
  function g(C) {
9923
- Oe(i, {
9929
+ Pe(i, {
9924
9930
  align: "end",
9925
9931
  behavior: C,
9926
9932
  index: "LAST"
@@ -9969,7 +9975,7 @@ const F0 = (e, t) => typeof e == "function" ? gc(e(t)) : t && gc(e), z0 = et(
9969
9975
  }), st(Rt(ke(m), o), ([C, S]) => {
9970
9976
  C && !S.atBottom && S.notAtBottomBecause === "VIEWPORT_HEIGHT_DECREASING" && g("auto");
9971
9977
  });
9972
- const b = Z(null), T = Ye();
9978
+ const b = Q(null), T = Ye();
9973
9979
  return ge(
9974
9980
  Ui(
9975
9981
  U(
@@ -9992,9 +9998,9 @@ const F0 = (e, t) => typeof e == "function" ? gc(e(t)) : t && gc(e), z0 = et(
9992
9998
  ),
9993
9999
  (C) => {
9994
10000
  x && (x(), x = null), Ct(n) ? requestAnimationFrame(() => {
9995
- Ct(d)("scrolling into view", {}), Oe(h, C);
10001
+ Ct(d)("scrolling into view", {}), Pe(h, C);
9996
10002
  }) : x = cn(e, () => {
9997
- Ct(d)("scrolling into view", {}), Oe(h, C), x = null;
10003
+ Ct(d)("scrolling into view", {}), Pe(h, C), x = null;
9998
10004
  });
9999
10005
  }
10000
10006
  ), { autoscrollToBottom: y, followOutput: m, scrollIntoViewOnChange: b };
@@ -10025,7 +10031,7 @@ const F0 = (e, t) => typeof e == "function" ? gc(e(t)) : t && gc(e), z0 = et(
10025
10031
  { singleton: !0 }
10026
10032
  ), H0 = et(
10027
10033
  ([{ didMount: e }, { scrollTo: t }, { listState: n }]) => {
10028
- const r = Z(0);
10034
+ const r = Q(0);
10029
10035
  return st(
10030
10036
  U(
10031
10037
  e,
@@ -10042,7 +10048,7 @@ const F0 = (e, t) => typeof e == "function" ? gc(e(t)) : t && gc(e), z0 = et(
10042
10048
  ),
10043
10049
  () => {
10044
10050
  requestAnimationFrame(() => {
10045
- Oe(t, o);
10051
+ Pe(t, o);
10046
10052
  });
10047
10053
  }
10048
10054
  );
@@ -10055,7 +10061,7 @@ const F0 = (e, t) => typeof e == "function" ? gc(e(t)) : t && gc(e), z0 = et(
10055
10061
  { singleton: !0 }
10056
10062
  ), jf = et(
10057
10063
  ([{ scrollVelocity: e }]) => {
10058
- const t = Z(!1), n = Ye(), r = Z(!1);
10064
+ const t = Q(!1), n = Ye(), r = Q(!1);
10059
10065
  return ge(
10060
10066
  U(
10061
10067
  e,
@@ -10083,7 +10089,7 @@ const F0 = (e, t) => typeof e == "function" ? gc(e(t)) : t && gc(e), z0 = et(
10083
10089
  pt(mo),
10084
10090
  { singleton: !0 }
10085
10091
  ), za = et(([{ scrollContainerState: e, scrollTo: t }]) => {
10086
- const n = Ye(), r = Ye(), o = Ye(), s = Z(!1), i = Z(void 0);
10092
+ const n = Ye(), r = Ye(), o = Ye(), s = Q(!1), i = Q(void 0);
10087
10093
  return ge(
10088
10094
  U(
10089
10095
  Rt(n, r),
@@ -10122,7 +10128,7 @@ const F0 = (e, t) => typeof e == "function" ? gc(e(t)) : t && gc(e), z0 = et(
10122
10128
  { didMount: s },
10123
10129
  { useWindowScroll: i, windowScrollContainerState: a, windowViewportRect: l }
10124
10130
  ]) => {
10125
- const c = Ye(), d = Z(void 0), f = Z(null), p = Z(null);
10131
+ const c = Ye(), d = Q(void 0), f = Q(null), p = Q(null);
10126
10132
  return ge(a, f), ge(l, p), st(
10127
10133
  U(
10128
10134
  c,
@@ -10152,7 +10158,7 @@ function W0(e) {
10152
10158
  return { align: "start", index: 0, offset: e.scrollTop };
10153
10159
  }
10154
10160
  const V0 = et(([{ topItemsIndexes: e }]) => {
10155
- const t = Z(0);
10161
+ const t = Q(0);
10156
10162
  return ge(
10157
10163
  U(
10158
10164
  t,
@@ -10194,10 +10200,10 @@ const K0 = Pf(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
10194
10200
  )
10195
10201
  );
10196
10202
  function x(g) {
10197
- g > 0 ? (Oe(t, { behavior: "auto", top: -g }), Oe(e, 0)) : (Oe(e, 0), Oe(t, { behavior: "auto", top: -g }));
10203
+ g > 0 ? (Pe(t, { behavior: "auto", top: -g }), Pe(e, 0)) : (Pe(e, 0), Pe(t, { behavior: "auto", top: -g }));
10198
10204
  }
10199
10205
  return st(U(y, Fe(e, s)), ([g, w, b]) => {
10200
- b && K0() ? Oe(e, w - g) : x(-g);
10206
+ b && K0() ? Pe(e, w - g) : x(-g);
10201
10207
  }), st(
10202
10208
  U(
10203
10209
  Rt($t(s, !1), e, m),
@@ -10236,9 +10242,9 @@ const K0 = Pf(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
10236
10242
  })
10237
10243
  ),
10238
10244
  (g) => {
10239
- Oe(e, g), requestAnimationFrame(() => {
10240
- Oe(t, { top: g }), requestAnimationFrame(() => {
10241
- Oe(e, 0), Oe(m, !1);
10245
+ Pe(e, g), requestAnimationFrame(() => {
10246
+ Pe(t, { top: g }), requestAnimationFrame(() => {
10247
+ Pe(e, 0), Pe(m, !1);
10242
10248
  });
10243
10249
  });
10244
10250
  }
@@ -10375,22 +10381,22 @@ const Eo = typeof document < "u" ? B.useLayoutEffect : B.useEffect;
10375
10381
  function Mf(e, t, n) {
10376
10382
  const r = Object.keys(t.required || {}), o = Object.keys(t.optional || {}), s = Object.keys(t.methods || {}), i = Object.keys(t.events || {}), a = B.createContext({});
10377
10383
  function l(x, g) {
10378
- x.propsReady && Oe(x.propsReady, !1);
10384
+ x.propsReady && Pe(x.propsReady, !1);
10379
10385
  for (const w of r) {
10380
10386
  const b = x[t.required[w]];
10381
- Oe(b, g[w]);
10387
+ Pe(b, g[w]);
10382
10388
  }
10383
10389
  for (const w of o)
10384
10390
  if (w in g) {
10385
10391
  const b = x[t.optional[w]];
10386
- Oe(b, g[w]);
10392
+ Pe(b, g[w]);
10387
10393
  }
10388
- x.propsReady && Oe(x.propsReady, !0);
10394
+ x.propsReady && Pe(x.propsReady, !0);
10389
10395
  }
10390
10396
  function c(x) {
10391
10397
  return s.reduce((g, w) => (g[w] = (b) => {
10392
10398
  const T = x[t.methods[w]];
10393
- Oe(T, b);
10399
+ Pe(T, b);
10394
10400
  }, g), {});
10395
10401
  }
10396
10402
  function d(x) {
@@ -10415,7 +10421,7 @@ function Mf(e, t, n) {
10415
10421
  const g = B.useContext(a);
10416
10422
  return B.useCallback(
10417
10423
  (w) => {
10418
- Oe(g[x], w);
10424
+ Pe(g[x], w);
10419
10425
  },
10420
10426
  [g, x]
10421
10427
  );
@@ -10516,7 +10522,7 @@ function Ha(e) {
10516
10522
  return e;
10517
10523
  }
10518
10524
  const J0 = /* @__PURE__ */ et(() => {
10519
- const e = Z((a) => `Item ${a}`), t = Z((a) => `Group ${a}`), n = Z({}), r = Z(Ha), o = Z("div"), s = Z(Rr), i = (a, l = null) => $t(
10525
+ const e = Q((a) => `Item ${a}`), t = Q((a) => `Group ${a}`), n = Q({}), r = Q(Ha), o = Q("div"), s = Q(Rr), i = (a, l = null) => $t(
10520
10526
  U(
10521
10527
  n,
10522
10528
  le((c) => c[a]),
@@ -10823,13 +10829,13 @@ const lS = ({ children: e }) => {
10823
10829
  },
10824
10830
  dS
10825
10831
  ), pS = /* @__PURE__ */ Bf({ useEmitter: Ua, useEmitterValue: Ne, usePublisher: Qt }), hS = /* @__PURE__ */ Hf({ useEmitter: Ua, useEmitterValue: Ne, usePublisher: Qt }), mS = fS, gS = /* @__PURE__ */ et(() => {
10826
- const e = Z((c) => /* @__PURE__ */ u.jsxs("td", { children: [
10832
+ const e = Q((c) => /* @__PURE__ */ u.jsxs("td", { children: [
10827
10833
  "Item $",
10828
10834
  c
10829
- ] })), t = Z(null), n = Z((c) => /* @__PURE__ */ u.jsxs("td", { colSpan: 1e3, children: [
10835
+ ] })), t = Q(null), n = Q((c) => /* @__PURE__ */ u.jsxs("td", { colSpan: 1e3, children: [
10830
10836
  "Group ",
10831
10837
  c
10832
- ] })), r = Z(null), o = Z(null), s = Z({}), i = Z(Ha), a = Z(Rr), l = (c, d = null) => $t(
10838
+ ] })), r = Q(null), o = Q(null), s = Q({}), i = Q(Ha), a = Q(Rr), l = (c, d = null) => $t(
10833
10839
  U(
10834
10840
  s,
10835
10841
  le((f) => f[c]),
@@ -10902,7 +10908,7 @@ const wS = /* @__PURE__ */ et(
10902
10908
  { customScrollParent: x, useWindowScroll: g, windowScrollContainerState: w, windowScrollTo: b, windowViewportRect: T },
10903
10909
  C
10904
10910
  ]) => {
10905
- const S = Z(0), k = Z(0), E = Z(vc), _ = Z({ height: 0, width: 0 }), L = Z({ height: 0, width: 0 }), P = Ye(), O = Ye(), F = Z(0), I = Z(null), z = Z({ column: 0, row: 0 }), N = Ye(), Y = Ye(), $ = Z(!1), A = Z(0), J = Z(!0), q = Z(!1), pe = Z(!1);
10911
+ const S = Q(0), k = Q(0), E = Q(vc), _ = Q({ height: 0, width: 0 }), L = Q({ height: 0, width: 0 }), P = Ye(), O = Ye(), F = Q(0), I = Q(null), z = Q({ column: 0, row: 0 }), N = Ye(), Y = Ye(), $ = Q(!1), A = Q(0), Z = Q(!0), q = Q(!1), pe = Q(!1);
10906
10912
  st(
10907
10913
  U(
10908
10914
  m,
@@ -10910,18 +10916,18 @@ const wS = /* @__PURE__ */ et(
10910
10916
  Re(([D, H]) => !!H)
10911
10917
  ),
10912
10918
  () => {
10913
- Oe(J, !1);
10919
+ Pe(Z, !1);
10914
10920
  }
10915
10921
  ), st(
10916
10922
  U(
10917
- Rt(m, J, L, _, A, q),
10918
- Re(([D, H, ne, ie, , oe]) => D && !H && ne.height !== 0 && ie.height !== 0 && !oe)
10923
+ Rt(m, Z, L, _, A, q),
10924
+ Re(([D, H, re, ie, , oe]) => D && !H && re.height !== 0 && ie.height !== 0 && !oe)
10919
10925
  ),
10920
10926
  ([, , , , D]) => {
10921
- Oe(q, !0), La(1, () => {
10922
- Oe(P, D);
10927
+ Pe(q, !0), La(1, () => {
10928
+ Pe(P, D);
10923
10929
  }), cn(U(c), () => {
10924
- Oe(t, [0, 0]), Oe(J, !0);
10930
+ Pe(t, [0, 0]), Pe(Z, !0);
10925
10931
  });
10926
10932
  }
10927
10933
  ), ge(
@@ -10938,9 +10944,9 @@ const wS = /* @__PURE__ */ et(
10938
10944
  Re(([, D]) => D != null)
10939
10945
  ),
10940
10946
  ([, D]) => {
10941
- D && (Oe(_, D.viewport), Oe(L, D.item), Oe(z, D.gap), D.scrollTop > 0 && (Oe($, !0), cn(U(c, Jn(1)), (H) => {
10942
- Oe($, !1);
10943
- }), Oe(l, { top: D.scrollTop })));
10947
+ D && (Pe(_, D.viewport), Pe(L, D.item), Pe(z, D.gap), D.scrollTop > 0 && (Pe($, !0), cn(U(c, Jn(1)), (H) => {
10948
+ Pe($, !1);
10949
+ }), Pe(l, { top: D.scrollTop })));
10944
10950
  }
10945
10951
  ), ge(
10946
10952
  U(
@@ -10956,8 +10962,8 @@ const wS = /* @__PURE__ */ et(
10956
10962
  ke(z, (D, H) => D && D.column === H.column && D.row === H.row),
10957
10963
  ke(c)
10958
10964
  ),
10959
- le(([D, H, ne, ie]) => ({
10960
- gap: ne,
10965
+ le(([D, H, re, ie]) => ({
10966
+ gap: re,
10961
10967
  item: H,
10962
10968
  scrollTop: ie,
10963
10969
  viewport: D
@@ -10975,34 +10981,34 @@ const wS = /* @__PURE__ */ et(
10975
10981
  ke(I),
10976
10982
  ke(k),
10977
10983
  ke($),
10978
- ke(J),
10984
+ ke(Z),
10979
10985
  ke(A)
10980
10986
  ),
10981
10987
  Re(([, , , , , , , D]) => !D),
10982
10988
  le(
10983
10989
  ([
10984
10990
  D,
10985
- [H, ne],
10991
+ [H, re],
10986
10992
  ie,
10987
10993
  oe,
10988
- Me,
10989
- Ze,
10990
- Pe,
10994
+ Oe,
10995
+ Je,
10996
+ De,
10991
10997
  ,
10992
10998
  se,
10993
10999
  he
10994
11000
  ]) => {
10995
- const { column: Le, row: De } = ie, { height: Ue, width: qe } = oe, { width: ze } = Me;
10996
- if (Pe === 0 && (D === 0 || ze === 0))
11001
+ const { column: Le, row: Me } = ie, { height: Ue, width: qe } = oe, { width: ze } = Oe;
11002
+ if (De === 0 && (D === 0 || ze === 0))
10997
11003
  return vc;
10998
11004
  if (qe === 0) {
10999
- const We = $a(he, D), At = We + Math.max(Pe - 1, 0);
11000
- return yS(Sc(We, At, Ze));
11005
+ const We = $a(he, D), At = We + Math.max(De - 1, 0);
11006
+ return yS(Sc(We, At, Je));
11001
11007
  }
11002
11008
  const Ke = Uf(ze, qe, Le);
11003
11009
  let Ge, tt;
11004
- se ? H === 0 && ne === 0 && Pe > 0 ? (Ge = 0, tt = Pe - 1) : (Ge = Ke * ns((H + De) / (Ue + De)), tt = Ke * wc((ne + De) / (Ue + De)) - 1, tt = bi(D - 1, zr(tt, Ke - 1)), Ge = bi(tt, zr(0, Ge))) : (Ge = 0, tt = -1);
11005
- const It = Sc(Ge, tt, Ze), { bottom: ht, top: lt } = Cc(Me, ie, oe, It), mt = wc(D / Ke), it = mt * Ue + (mt - 1) * De - ht;
11010
+ se ? H === 0 && re === 0 && De > 0 ? (Ge = 0, tt = De - 1) : (Ge = Ke * ns((H + Me) / (Ue + Me)), tt = Ke * wc((re + Me) / (Ue + Me)) - 1, tt = bi(D - 1, zr(tt, Ke - 1)), Ge = bi(tt, zr(0, Ge))) : (Ge = 0, tt = -1);
11011
+ const It = Sc(Ge, tt, Je), { bottom: ht, top: lt } = Cc(Oe, ie, oe, It), mt = wc(D / Ke), it = mt * Ue + (mt - 1) * Me - ht;
11006
11012
  return { bottom: ht, itemHeight: Ue, items: It, itemWidth: qe, offsetBottom: it, offsetTop: lt, top: lt };
11007
11013
  }
11008
11014
  )
@@ -11018,16 +11024,16 @@ const wS = /* @__PURE__ */ et(
11018
11024
  ), ge(
11019
11025
  U(
11020
11026
  Rt(_, L, E, z),
11021
- Re(([D, H, { items: ne }]) => ne.length > 0 && H.height !== 0 && D.height !== 0),
11022
- le(([D, H, { items: ne }, ie]) => {
11023
- const { bottom: oe, top: Me } = Cc(D, ie, H, ne);
11024
- return [Me, oe];
11027
+ Re(([D, H, { items: re }]) => re.length > 0 && H.height !== 0 && D.height !== 0),
11028
+ le(([D, H, { items: re }, ie]) => {
11029
+ const { bottom: oe, top: Oe } = Cc(D, ie, H, re);
11030
+ return [Oe, oe];
11025
11031
  }),
11026
11032
  ft(Zr)
11027
11033
  ),
11028
11034
  t
11029
11035
  );
11030
- const be = Z(!1);
11036
+ const be = Q(!1);
11031
11037
  ge(
11032
11038
  U(
11033
11039
  c,
@@ -11041,9 +11047,9 @@ const wS = /* @__PURE__ */ et(
11041
11047
  Rt(E, S),
11042
11048
  Re(([{ items: D }]) => D.length > 0),
11043
11049
  Fe(be),
11044
- Re(([[D, H], ne]) => {
11050
+ Re(([[D, H], re]) => {
11045
11051
  const ie = D.items[D.items.length - 1].index === H - 1;
11046
- return (ne || D.bottom > 0 && D.itemHeight > 0 && D.offsetBottom === 0 && D.items.length === H) && ie;
11052
+ return (re || D.bottom > 0 && D.itemHeight > 0 && D.offsetBottom === 0 && D.items.length === H) && ie;
11047
11053
  }),
11048
11054
  le(([[, D]]) => D - 1),
11049
11055
  ft()
@@ -11072,12 +11078,12 @@ const wS = /* @__PURE__ */ et(
11072
11078
  U(
11073
11079
  P,
11074
11080
  Fe(_, L, S, z),
11075
- le(([D, H, ne, ie, oe]) => {
11076
- const Me = Rf(D), { align: Ze, behavior: Pe, offset: se } = Me;
11077
- let he = Me.index;
11081
+ le(([D, H, re, ie, oe]) => {
11082
+ const Oe = Rf(D), { align: Je, behavior: De, offset: se } = Oe;
11083
+ let he = Oe.index;
11078
11084
  he === "LAST" && (he = ie - 1), he = zr(0, he, bi(ie - 1, he));
11079
- let Le = Gi(H, oe, ne, he);
11080
- return Ze === "end" ? Le = bc(Le - H.height + ne.height) : Ze === "center" && (Le = bc(Le - H.height / 2 + ne.height / 2)), se && (Le += se), { behavior: Pe, top: Le };
11085
+ let Le = Gi(H, oe, re, he);
11086
+ return Je === "end" ? Le = bc(Le - H.height + re.height) : Je === "center" && (Le = bc(Le - H.height / 2 + re.height / 2)), se && (Le += se), { behavior: De, top: Le };
11081
11087
  })
11082
11088
  ),
11083
11089
  l
@@ -11154,14 +11160,14 @@ function Gi(e, t, n, r) {
11154
11160
  return i > 0 ? i + t.row : i;
11155
11161
  }
11156
11162
  const bS = /* @__PURE__ */ et(() => {
11157
- const e = Z((f) => `Item ${f}`), t = Z({}), n = Z(null), r = Z("virtuoso-grid-item"), o = Z("virtuoso-grid-list"), s = Z(Ha), i = Z("div"), a = Z(Rr), l = (f, p = null) => $t(
11163
+ const e = Q((f) => `Item ${f}`), t = Q({}), n = Q(null), r = Q("virtuoso-grid-item"), o = Q("virtuoso-grid-list"), s = Q(Ha), i = Q("div"), a = Q(Rr), l = (f, p = null) => $t(
11158
11164
  U(
11159
11165
  t,
11160
11166
  le((h) => h[f]),
11161
11167
  ft()
11162
11168
  ),
11163
11169
  p
11164
- ), c = Z(!1), d = Z(!1);
11170
+ ), c = Q(!1), d = Q(!1);
11165
11171
  return ge(ke(d), c), {
11166
11172
  components: t,
11167
11173
  computeItemKey: s,
@@ -11354,13 +11360,13 @@ const _S = hs(
11354
11360
  }
11355
11361
  );
11356
11362
  function Vf({ className: e, variant: t, ...n }) {
11357
- return /* @__PURE__ */ u.jsx("div", { className: te(_S({ variant: t }), e), ...n });
11363
+ return /* @__PURE__ */ u.jsx("div", { className: ne(_S({ variant: t }), e), ...n });
11358
11364
  }
11359
11365
  const Br = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
11360
11366
  "div",
11361
11367
  {
11362
11368
  ref: n,
11363
- className: te(
11369
+ className: ne(
11364
11370
  "rounded-lg border bg-card text-card-foreground shadow-sm",
11365
11371
  e
11366
11372
  ),
@@ -11372,7 +11378,7 @@ const Hr = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
11372
11378
  "div",
11373
11379
  {
11374
11380
  ref: n,
11375
- className: te("flex flex-col space-y-1.5 p-6", e),
11381
+ className: ne("flex flex-col space-y-1.5 p-6", e),
11376
11382
  ...t
11377
11383
  }
11378
11384
  ));
@@ -11381,7 +11387,7 @@ const Ur = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
11381
11387
  "h3",
11382
11388
  {
11383
11389
  ref: n,
11384
- className: te(
11390
+ className: ne(
11385
11391
  "text-2xl font-semibold leading-none tracking-tight",
11386
11392
  e
11387
11393
  ),
@@ -11393,18 +11399,18 @@ const Kf = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
11393
11399
  "p",
11394
11400
  {
11395
11401
  ref: n,
11396
- className: te("text-sm text-muted-foreground", e),
11402
+ className: ne("text-sm text-muted-foreground", e),
11397
11403
  ...t
11398
11404
  }
11399
11405
  ));
11400
11406
  Kf.displayName = "CardDescription";
11401
- const Wr = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx("div", { ref: n, className: te("p-6 pt-0", e), ...t }));
11407
+ const Wr = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx("div", { ref: n, className: ne("p-6 pt-0", e), ...t }));
11402
11408
  Wr.displayName = "CardContent";
11403
11409
  const qf = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
11404
11410
  "div",
11405
11411
  {
11406
11412
  ref: n,
11407
- className: te("flex items-center p-6 pt-0", e),
11413
+ className: ne("flex items-center p-6 pt-0", e),
11408
11414
  ...t
11409
11415
  }
11410
11416
  ));
@@ -11847,7 +11853,7 @@ const JS = fp, ZS = pp, mp = v.forwardRef(({ className: e, ...t }, n) => /* @__P
11847
11853
  Bs,
11848
11854
  {
11849
11855
  ref: n,
11850
- className: te(
11856
+ className: ne(
11851
11857
  "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
11852
11858
  e
11853
11859
  ),
@@ -11877,7 +11883,7 @@ const gp = v.forwardRef(({ className: e, children: t, ...n }, r) => {
11877
11883
  Hs,
11878
11884
  {
11879
11885
  ref: r,
11880
- className: te(
11886
+ className: ne(
11881
11887
  "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
11882
11888
  e
11883
11889
  ),
@@ -11901,7 +11907,7 @@ const xp = ({
11901
11907
  }) => /* @__PURE__ */ u.jsx(
11902
11908
  "div",
11903
11909
  {
11904
- className: te(
11910
+ className: ne(
11905
11911
  "flex flex-col space-y-1.5 text-center sm:text-left",
11906
11912
  e
11907
11913
  ),
@@ -11913,7 +11919,7 @@ const yp = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
11913
11919
  qn,
11914
11920
  {
11915
11921
  ref: n,
11916
- className: te(
11922
+ className: ne(
11917
11923
  "text-lg font-semibold leading-none tracking-tight",
11918
11924
  e
11919
11925
  ),
@@ -11925,7 +11931,7 @@ const QS = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
11925
11931
  Us,
11926
11932
  {
11927
11933
  ref: n,
11928
- className: te("text-sm text-muted-foreground", e),
11934
+ className: ne("text-sm text-muted-foreground", e),
11929
11935
  ...t
11930
11936
  }
11931
11937
  ));
@@ -13634,7 +13640,7 @@ function as({
13634
13640
  return /* @__PURE__ */ u.jsx(
13635
13641
  "div",
13636
13642
  {
13637
- className: te(
13643
+ className: ne(
13638
13644
  "markdown prose prose-sm max-w-none break-words",
13639
13645
  // In dark mode, use prose-invert for better contrast in dark bubbles
13640
13646
  "dark:prose-invert",
@@ -13713,7 +13719,7 @@ function SC({ className: e }) {
13713
13719
  "span",
13714
13720
  {
13715
13721
  "aria-live": "polite",
13716
- className: te("inline-block text-xs opacity-70 ml-1", e),
13722
+ className: ne("inline-block text-xs opacity-70 ml-1", e),
13717
13723
  children: [
13718
13724
  "Is thinking",
13719
13725
  ".".repeat(t)
@@ -13748,7 +13754,7 @@ const Oc = B.memo(function({
13748
13754
  defaultCheckpointId: E = null,
13749
13755
  messageParentCheckpointId: _ = null
13750
13756
  }) {
13751
- const [L, P] = ye(!1), [O, F] = ye("preview"), [I, z] = ye(!1), { currentThreadId: N } = da(), { respondToInterrupt: Y } = fa(), $ = l === "phone" || l === "half-screen", A = t.role, J = A === "tool", q = nt(() => "type" in t && t.type === "default_message" ? t : null, [t]), pe = !!q, be = !(r && A !== "user"), {
13757
+ const [L, P] = ye(!1), [O, F] = ye("preview"), [I, z] = ye(!1), { currentThreadId: N } = da(), { respondToInterrupt: Y } = fa(), $ = l === "phone" || l === "half-screen", A = t.role, Z = A === "tool", q = nt(() => "type" in t && t.type === "default_message" ? t : null, [t]), pe = !!q, be = !(r && A !== "user"), {
13752
13758
  uploadingFiles: Ee,
13753
13759
  handleFileClick: G,
13754
13760
  fileViewerOpen: W,
@@ -13767,24 +13773,24 @@ const Oc = B.memo(function({
13767
13773
  default:
13768
13774
  return "text-[hsl(var(--chat-bubble-ai-text))]";
13769
13775
  }
13770
- }, [A]), ne = nt(() => q ? "" : vC(t.content), [q, t]), ie = nt(() => q ? {} : Rp(t), [q, t]), oe = nt(
13776
+ }, [A]), re = nt(() => q ? "" : vC(t.content), [q, t]), ie = nt(() => q ? {} : Rp(t), [q, t]), oe = nt(
13771
13777
  () => q ? [] : t.content.filter((j) => j.type === "image_url"),
13772
13778
  [q, t]
13773
- ), Me = nt(
13779
+ ), Oe = nt(
13774
13780
  () => q ? [] : t.content.filter((j) => j.type === "file"),
13775
13781
  [q, t]
13776
- ), Ze = nt(
13782
+ ), Je = nt(
13777
13783
  () => q ? [] : t.content.filter((j) => j.type === "interrupt"),
13778
13784
  [q, t]
13779
- ), Pe = (g == null ? void 0 : g.id) ?? (g == null ? void 0 : g.interrupt_id), se = Ao(Pe), he = g == null ? void 0 : g.value, Le = nt(() => q ? "" : wC(t.content), [q, t]), De = B.useCallback(async () => {
13780
- const j = J ? Le : ne;
13781
- async function X(ee) {
13785
+ ), De = (g == null ? void 0 : g.id) ?? (g == null ? void 0 : g.interrupt_id), se = Ao(De), he = g == null ? void 0 : g.value, Le = nt(() => q ? "" : wC(t.content), [q, t]), Me = B.useCallback(async () => {
13786
+ const j = Z ? Le : re;
13787
+ async function X(J) {
13782
13788
  if (navigator.clipboard && typeof navigator.clipboard.writeText == "function") {
13783
- await navigator.clipboard.writeText(ee);
13789
+ await navigator.clipboard.writeText(J);
13784
13790
  return;
13785
13791
  }
13786
13792
  if (navigator.clipboard && typeof navigator.clipboard.write == "function" && typeof ClipboardItem < "u") {
13787
- const me = new Blob([ee], { type: "text/plain" });
13793
+ const me = new Blob([J], { type: "text/plain" });
13788
13794
  await navigator.clipboard.write([
13789
13795
  new ClipboardItem({
13790
13796
  "text/plain": me
@@ -13796,20 +13802,20 @@ const Oc = B.memo(function({
13796
13802
  }
13797
13803
  try {
13798
13804
  await X(j), P(!0), setTimeout(() => P(!1), 2e3), x == null || x(j);
13799
- } catch (ee) {
13800
- console.error("Failed to copy:", ee);
13805
+ } catch (J) {
13806
+ console.error("Failed to copy:", J);
13801
13807
  }
13802
- }, [J, Le, ne, x]), Ue = B.useCallback(() => {
13808
+ }, [Z, Le, re, x]), Ue = B.useCallback(() => {
13803
13809
  if (!h) return;
13804
- const j = J ? Le : ne, X = "type" in t && t.type === "default_message" ? void 0 : {
13810
+ const j = Z ? Le : re, X = "type" in t && t.type === "default_message" ? void 0 : {
13805
13811
  checkpointId: t.checkpointId ?? null,
13806
13812
  checkpointNs: t.checkpointNs ?? null
13807
13813
  };
13808
13814
  h(t.id, j, X);
13809
- }, [h, t.id, J, Le, ne, t]), qe = B.useCallback(() => {
13815
+ }, [h, t.id, Z, Le, re, t]), qe = B.useCallback(() => {
13810
13816
  m == null || m(n);
13811
13817
  }, [m, n]), ze = B.useCallback(() => {
13812
- const X = te($ ? "h-3 w-3" : "h-4 w-4", "opacity-60 flex-shrink-0", H);
13818
+ const X = ne($ ? "h-3 w-3" : "h-4 w-4", "opacity-60 flex-shrink-0", H);
13813
13819
  switch (A) {
13814
13820
  case "user":
13815
13821
  return /* @__PURE__ */ u.jsx(am, { className: X });
@@ -13824,21 +13830,21 @@ const Oc = B.memo(function({
13824
13830
  const j = "group relative mb-4 flex w-full";
13825
13831
  switch (A) {
13826
13832
  case "user":
13827
- return te(j, "justify-end");
13833
+ return ne(j, "justify-end");
13828
13834
  case "assistant":
13829
13835
  case "tool":
13830
13836
  case "system":
13831
- return te(j, "justify-start");
13837
+ return ne(j, "justify-start");
13832
13838
  default:
13833
13839
  return j;
13834
13840
  }
13835
13841
  }, [A]), Ge = B.useCallback(() => {
13836
- const j = te(
13842
+ const j = ne(
13837
13843
  "rounded-lg px-4 py-3 relative min-w-0 max-w-full break-words",
13838
13844
  $ && "px-3 py-2 text-sm"
13839
13845
  );
13840
13846
  if (pe)
13841
- return te(
13847
+ return ne(
13842
13848
  j,
13843
13849
  "w-full",
13844
13850
  "bg-[hsl(var(--chat-bubble-ai))] text-[hsl(var(--chat-bubble-ai-text))]",
@@ -13846,25 +13852,25 @@ const Oc = B.memo(function({
13846
13852
  );
13847
13853
  switch (A) {
13848
13854
  case "user":
13849
- return te(
13855
+ return ne(
13850
13856
  j,
13851
13857
  "w-full md:max-w-[95%]",
13852
13858
  "bg-[hsl(var(--chat-bubble-user))] text-[hsl(var(--chat-bubble-user-text))]",
13853
13859
  "border border-transparent"
13854
13860
  );
13855
13861
  case "assistant":
13856
- return te(
13862
+ return ne(
13857
13863
  j,
13858
13864
  "w-full md:max-w-[95%]",
13859
13865
  "bg-[hsl(var(--chat-bubble-ai))] text-[hsl(var(--chat-bubble-ai-text))]",
13860
13866
  "border border-border/60 dark:border-border/40"
13861
13867
  );
13862
13868
  case "tool":
13863
- return te(j, "w-full md:max-w-[95%] bg-secondary/50 text-secondary-foreground border border-dashed");
13869
+ return ne(j, "w-full md:max-w-[95%] bg-secondary/50 text-secondary-foreground border border-dashed");
13864
13870
  case "system":
13865
- return te(j, "w-full md:max-w-[85%] bg-accent/40 text-muted-foreground border");
13871
+ return ne(j, "w-full md:max-w-[85%] bg-accent/40 text-muted-foreground border");
13866
13872
  default:
13867
- return te(
13873
+ return ne(
13868
13874
  j,
13869
13875
  "w-full md:max-w-[95%]",
13870
13876
  "bg-[hsl(var(--chat-bubble-ai))] text-[hsl(var(--chat-bubble-ai-text))]",
@@ -13873,9 +13879,9 @@ const Oc = B.memo(function({
13873
13879
  }
13874
13880
  }, [$, pe, A]);
13875
13881
  if (pe && q)
13876
- return /* @__PURE__ */ u.jsx("div", { className: te(Ke(), p.container), children: /* @__PURE__ */ u.jsxs("div", { className: te(Ge(), p.content), children: [
13882
+ return /* @__PURE__ */ u.jsx("div", { className: ne(Ke(), p.container), children: /* @__PURE__ */ u.jsxs("div", { className: ne(Ge(), p.content), children: [
13877
13883
  /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2 mb-2 pb-2 border-b border-current/10", children: [
13878
- /* @__PURE__ */ u.jsx(Qs, { className: te("h-4 w-4", H) }),
13884
+ /* @__PURE__ */ u.jsx(Qs, { className: ne("h-4 w-4", H) }),
13879
13885
  a && /* @__PURE__ */ u.jsx("span", { className: "font-medium text-sm", children: "Assistant" })
13880
13886
  ] }),
13881
13887
  /* @__PURE__ */ u.jsx(
@@ -13898,8 +13904,8 @@ const Oc = B.memo(function({
13898
13904
  }
13899
13905
  try {
13900
13906
  b == null || b(), await Y(X, !0);
13901
- } catch (ee) {
13902
- console.error("Failed to approve interrupt:", ee);
13907
+ } catch (J) {
13908
+ console.error("Failed to approve interrupt:", J);
13903
13909
  } finally {
13904
13910
  T == null || T();
13905
13911
  }
@@ -13915,14 +13921,14 @@ const Oc = B.memo(function({
13915
13921
  }
13916
13922
  try {
13917
13923
  b == null || b(), await Y(X, !1);
13918
- } catch (ee) {
13919
- console.error("Failed to reject interrupt:", ee);
13924
+ } catch (J) {
13925
+ console.error("Failed to reject interrupt:", J);
13920
13926
  } finally {
13921
13927
  T == null || T();
13922
13928
  }
13923
13929
  }, [w, T, b, Y]), ht = B.useCallback(({ part: j, i: X }) => {
13924
13930
  if (j.type === "text") {
13925
- const ee = j.text ?? "", me = ee.trim(), $e = Va(me);
13931
+ const J = j.text ?? "", me = J.trim(), $e = Va(me);
13926
13932
  return $e && A !== "tool" ? /* @__PURE__ */ u.jsx(Ep, { data: $e }, X) : A === "user" && c && me.length > d ? /* @__PURE__ */ u.jsx(
13927
13933
  kC,
13928
13934
  {
@@ -13933,27 +13939,27 @@ const Oc = B.memo(function({
13933
13939
  isCompact: $
13934
13940
  },
13935
13941
  X
13936
- ) : /* @__PURE__ */ u.jsx(as, { content: ee, allowHtml: !1 }, X);
13942
+ ) : /* @__PURE__ */ u.jsx(as, { content: J, allowHtml: !1 }, X);
13937
13943
  }
13938
13944
  if (j.type === "image_url") {
13939
- const ee = j;
13945
+ const J = j;
13940
13946
  return /* @__PURE__ */ u.jsx("div", { className: "my-2", children: /* @__PURE__ */ u.jsx(
13941
13947
  "img",
13942
13948
  {
13943
- src: ee.url,
13944
- alt: ee.alt ?? "",
13949
+ src: J.url,
13950
+ alt: J.alt ?? "",
13945
13951
  loading: "lazy",
13946
13952
  className: "border rounded max-h-[420px] w-auto object-contain"
13947
13953
  }
13948
13954
  ) }, X);
13949
13955
  }
13950
13956
  if (j.type === "file") {
13951
- const ee = j, me = ee.name || "file";
13957
+ const J = j, me = J.name || "file";
13952
13958
  return /* @__PURE__ */ u.jsxs(
13953
13959
  "a",
13954
13960
  {
13955
- href: ee.url,
13956
- onClick: ($e) => G($e, ee, X),
13961
+ href: J.url,
13962
+ onClick: ($e) => G($e, J, X),
13957
13963
  className: `inline-flex items-center gap-2 rounded px-2 py-1 text-xs bg-gray-100 border hover:bg-gray-200
13958
13964
  dark:bg-background/10 dark:border-border/30 dark:hover:bg-background/20`,
13959
13965
  children: [
@@ -13968,9 +13974,9 @@ const Oc = B.memo(function({
13968
13974
  );
13969
13975
  }
13970
13976
  if (j.type === "interrupt") {
13971
- const ee = j, me = Ao(
13972
- (ee == null ? void 0 : ee.id) ?? (ee == null ? void 0 : ee.interrupt_id)
13973
- ), $e = !!(se && me && me === se), St = $e ? he ?? (ee == null ? void 0 : ee.value) : ee == null ? void 0 : ee.value, Se = me ? { ...ee, id: me, interrupt_id: me } : ee;
13977
+ const J = j, me = Ao(
13978
+ (J == null ? void 0 : J.id) ?? (J == null ? void 0 : J.interrupt_id)
13979
+ ), $e = !!(se && me && me === se), St = $e ? he ?? (J == null ? void 0 : J.value) : J == null ? void 0 : J.value, Se = me ? { ...J, id: me, interrupt_id: me } : J;
13974
13980
  return /* @__PURE__ */ u.jsx(
13975
13981
  CC,
13976
13982
  {
@@ -13999,17 +14005,17 @@ const Oc = B.memo(function({
13999
14005
  he,
14000
14006
  g,
14001
14007
  w,
14002
- Ze
14008
+ Je
14003
14009
  ]), lt = B.useCallback(() => /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2 p-2 bg-muted/30 rounded", children: [
14004
14010
  /* @__PURE__ */ u.jsx(ki, { className: "h-4 w-4 text-muted-foreground" }),
14005
14011
  /* @__PURE__ */ u.jsx("span", { className: "text-sm text-muted-foreground", children: "File upload" })
14006
14012
  ] }), []), mt = B.useCallback(() => {
14007
- const j = ne.trim().length > 0 || oe.length > 0 || Me.length > 0 || Ze.length > 0;
14008
- if (!J && Me.length > 0 && !r)
14013
+ const j = re.trim().length > 0 || oe.length > 0 || Oe.length > 0 || Je.length > 0;
14014
+ if (!Z && Oe.length > 0 && !r)
14009
14015
  return lt();
14010
- if (!J && !j && !r)
14016
+ if (!Z && !j && !r)
14011
14017
  return null;
14012
- if (J)
14018
+ if (Z)
14013
14019
  return /* @__PURE__ */ u.jsx(
14014
14020
  RC,
14015
14021
  {
@@ -14018,55 +14024,55 @@ const Oc = B.memo(function({
14018
14024
  },
14019
14025
  t.id
14020
14026
  );
14021
- if (!J && !q) {
14022
- const X = t, ee = /* @__PURE__ */ u.jsx("div", { className: "space-y-2", children: X.content.map((me, $e) => /* @__PURE__ */ u.jsx(ht, { part: me, i: $e }, $e)) });
14027
+ if (!Z && !q) {
14028
+ const X = t, J = /* @__PURE__ */ u.jsx("div", { className: "space-y-2", children: X.content.map((me, $e) => /* @__PURE__ */ u.jsx(ht, { part: me, i: $e }, $e)) });
14023
14029
  return r ? /* @__PURE__ */ u.jsxs("div", { "aria-busy": "true", role: "status", children: [
14024
- ee,
14030
+ J,
14025
14031
  /* @__PURE__ */ u.jsx(SC, { className: H })
14026
- ] }) : ee;
14032
+ ] }) : J;
14027
14033
  }
14028
14034
  }, [
14029
- ne,
14035
+ re,
14030
14036
  oe.length,
14031
- Me.length,
14032
- Ze.length,
14037
+ Oe.length,
14038
+ Je.length,
14033
14039
  r,
14034
- J,
14040
+ Z,
14035
14041
  O,
14036
14042
  lt,
14037
14043
  H
14038
14044
  ]), it = nt(() => q ? "Assistant" : bC(t), [q, t]), We = B.useMemo(() => q ? [] : Array.isArray(C) ? C : [], [C, q]), At = B.useMemo(() => {
14039
14045
  var j;
14040
14046
  return We.length ? E && We.some((X) => X.id === E) ? E : ((j = We[0]) == null ? void 0 : j.id) ?? null : null;
14041
- }, [E, We]), Yt = B.useMemo(() => !We.length || !S ? null : We.some((j) => j.id === S) ? S : null, [S, We]) ?? At, Xt = A === "user" && We.length > 0 && typeof k == "function", Je = B.useCallback(
14047
+ }, [E, We]), Yt = B.useMemo(() => !We.length || !S ? null : We.some((j) => j.id === S) ? S : null, [S, We]) ?? At, Xt = A === "user" && We.length > 0 && typeof k == "function", Ze = B.useCallback(
14042
14048
  (j) => {
14043
14049
  if (!k) return;
14044
- const X = (j == null ? void 0 : j.id) ?? null, ee = (j == null ? void 0 : j.parentId) ?? _ ?? null;
14045
- k(X, ee);
14050
+ const X = (j == null ? void 0 : j.id) ?? null, J = (j == null ? void 0 : j.parentId) ?? _ ?? null;
14051
+ k(X, J);
14046
14052
  },
14047
14053
  [_, k]
14048
- ), Ie = B.useMemo(() => Yt ? We.findIndex((j) => j.id === Yt) : -1, [Yt, We]), Ot = B.useMemo(() => Ie < 0 ? null : We[Ie] ?? null, [Ie, We]), re = B.useCallback((j) => {
14054
+ ), Ie = B.useMemo(() => Yt ? We.findIndex((j) => j.id === Yt) : -1, [Yt, We]), Ot = B.useMemo(() => Ie < 0 ? null : We[Ie] ?? null, [Ie, We]), ee = B.useCallback((j) => {
14049
14055
  const X = [];
14050
14056
  if (j.step !== null && X.push(`Step ${j.step}`), j.source && X.push(j.source), !j.createdAt)
14051
14057
  return X.length ? X.join(" • ") : j.id.slice(0, 8);
14052
- let ee = "";
14058
+ let J = "";
14053
14059
  try {
14054
14060
  const me = new Date(j.createdAt);
14055
- Number.isNaN(me.getTime()) || (ee = new Intl.DateTimeFormat(void 0, {
14061
+ Number.isNaN(me.getTime()) || (J = new Intl.DateTimeFormat(void 0, {
14056
14062
  hour: "2-digit",
14057
14063
  minute: "2-digit"
14058
14064
  }).format(me));
14059
14065
  } catch {
14060
- ee = "";
14066
+ J = "";
14061
14067
  }
14062
- return `${ee}`;
14068
+ return `${J}`;
14063
14069
  }, []);
14064
- return J && !f ? null : /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
14065
- /* @__PURE__ */ u.jsx("div", { className: te(Ke(), p.container), children: /* @__PURE__ */ u.jsxs("div", { className: te(Ge(), p.content), children: [
14066
- (i || a || J) && /* @__PURE__ */ u.jsxs(
14070
+ return Z && !f ? null : /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
14071
+ /* @__PURE__ */ u.jsx("div", { className: ne(Ke(), p.container), children: /* @__PURE__ */ u.jsxs("div", { className: ne(Ge(), p.content), children: [
14072
+ (i || a || Z) && /* @__PURE__ */ u.jsxs(
14067
14073
  "div",
14068
14074
  {
14069
- className: te(
14075
+ className: ne(
14070
14076
  "flex items-center justify-between mb-2 pb-2 border-b border-current/10",
14071
14077
  $ && "mb-1 pb-1",
14072
14078
  H,
@@ -14075,12 +14081,12 @@ const Oc = B.memo(function({
14075
14081
  children: [
14076
14082
  /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2", children: [
14077
14083
  ze(),
14078
- a && it && /* @__PURE__ */ u.jsx("span", { className: te("font-medium", $ ? "text-xs" : "text-sm"), children: it }),
14079
- J && /* @__PURE__ */ u.jsxs(
14084
+ a && it && /* @__PURE__ */ u.jsx("span", { className: ne("font-medium", $ ? "text-xs" : "text-sm"), children: it }),
14085
+ Z && /* @__PURE__ */ u.jsxs(
14080
14086
  Vf,
14081
14087
  {
14082
14088
  variant: "outline",
14083
- className: te(
14089
+ className: ne(
14084
14090
  "text-xs flex items-center gap-1 cursor-pointer select-none",
14085
14091
  H,
14086
14092
  "border border-current/40",
@@ -14107,14 +14113,14 @@ const Oc = B.memo(function({
14107
14113
  "button",
14108
14114
  {
14109
14115
  type: "button",
14110
- className: te(
14116
+ className: ne(
14111
14117
  "flex items-center justify-center rounded border px-1.5 py-1 transition-colors",
14112
14118
  Ie > 0 ? "border-border text-foreground hover:bg-muted/60" : "border-border text-muted-foreground cursor-not-allowed"
14113
14119
  ),
14114
14120
  onClick: () => {
14115
14121
  if (Ie <= 0) return;
14116
14122
  const j = We[Ie - 1];
14117
- j && Je(j);
14123
+ j && Ze(j);
14118
14124
  },
14119
14125
  "aria-label": "Previous checkpoint",
14120
14126
  disabled: Ie <= 0,
@@ -14127,20 +14133,20 @@ const Oc = B.memo(function({
14127
14133
  " / ",
14128
14134
  We.length
14129
14135
  ] }),
14130
- /* @__PURE__ */ u.jsx("span", { className: "text-muted-foreground", children: re(Ot) })
14136
+ /* @__PURE__ */ u.jsx("span", { className: "text-muted-foreground", children: ee(Ot) })
14131
14137
  ] }),
14132
14138
  /* @__PURE__ */ u.jsx(
14133
14139
  "button",
14134
14140
  {
14135
14141
  type: "button",
14136
- className: te(
14142
+ className: ne(
14137
14143
  "flex items-center justify-center rounded border px-1.5 py-1 transition-colors",
14138
14144
  Ie < We.length - 1 ? "border-border text-foreground hover:bg-muted/60" : "border-border text-muted-foreground cursor-not-allowed"
14139
14145
  ),
14140
14146
  onClick: () => {
14141
14147
  if (Ie >= We.length - 1) return;
14142
14148
  const j = We[Ie + 1];
14143
- j && Je(j);
14149
+ j && Ze(j);
14144
14150
  },
14145
14151
  "aria-label": "Next checkpoint",
14146
14152
  disabled: Ie >= We.length - 1,
@@ -14151,7 +14157,7 @@ const Oc = B.memo(function({
14151
14157
  i && t.createdAt && /* @__PURE__ */ u.jsx(
14152
14158
  "time",
14153
14159
  {
14154
- className: te("text-xs opacity-60", H, $ && "text-xs"),
14160
+ className: ne("text-xs opacity-60", H, $ && "text-xs"),
14155
14161
  dateTime: new Date(t.createdAt).toISOString(),
14156
14162
  title: new Date(t.createdAt).toLocaleString(),
14157
14163
  children: new Intl.DateTimeFormat(void 0, { hour: "2-digit", minute: "2-digit" }).format(new Date(t.createdAt))
@@ -14160,7 +14166,7 @@ const Oc = B.memo(function({
14160
14166
  s && !o && /* @__PURE__ */ u.jsxs(
14161
14167
  "div",
14162
14168
  {
14163
- className: te(
14169
+ className: ne(
14164
14170
  "opacity-0 group-hover:opacity-100 transition-opacity",
14165
14171
  "flex items-center gap-1",
14166
14172
  p.actions
@@ -14171,11 +14177,11 @@ const Oc = B.memo(function({
14171
14177
  {
14172
14178
  variant: "ghost",
14173
14179
  size: "sm",
14174
- onClick: () => De(),
14175
- className: te("h-6 w-6 p-0 hover:bg-foreground/10", H, $ && "h-5 w-5"),
14180
+ onClick: () => Me(),
14181
+ className: ne("h-6 w-6 p-0 hover:bg-foreground/10", H, $ && "h-5 w-5"),
14176
14182
  "aria-label": "Copy message",
14177
14183
  title: "Copy message",
14178
- children: /* @__PURE__ */ u.jsx(ol, { className: te(L ? "text-success" : H, $ ? "h-3 w-3" : "h-4 w-4") })
14184
+ children: /* @__PURE__ */ u.jsx(ol, { className: ne(L ? "text-success" : H, $ ? "h-3 w-3" : "h-4 w-4") })
14179
14185
  }
14180
14186
  ) }),
14181
14187
  A === "user" && h && /* @__PURE__ */ u.jsx(
@@ -14184,9 +14190,9 @@ const Oc = B.memo(function({
14184
14190
  variant: "ghost",
14185
14191
  size: "sm",
14186
14192
  onClick: Ue,
14187
- className: te("h-6 w-6 p-0 hover:bg-foreground/10", H, $ && "h-5 w-5"),
14193
+ className: ne("h-6 w-6 p-0 hover:bg-foreground/10", H, $ && "h-5 w-5"),
14188
14194
  "aria-label": "Edit message",
14189
- children: /* @__PURE__ */ u.jsx(sl, { className: te(H, $ ? "h-3 w-3" : "h-4 w-4") })
14195
+ children: /* @__PURE__ */ u.jsx(sl, { className: ne(H, $ ? "h-3 w-3" : "h-4 w-4") })
14190
14196
  }
14191
14197
  ),
14192
14198
  A === "assistant" && m && /* @__PURE__ */ u.jsx(
@@ -14195,9 +14201,9 @@ const Oc = B.memo(function({
14195
14201
  variant: "ghost",
14196
14202
  size: "sm",
14197
14203
  onClick: qe,
14198
- className: te("h-6 w-6 p-0 hover:bg-foreground/10", H, $ && "h-5 w-5"),
14204
+ className: ne("h-6 w-6 p-0 hover:bg-foreground/10", H, $ && "h-5 w-5"),
14199
14205
  "aria-label": "Regenerate response",
14200
- children: /* @__PURE__ */ u.jsx(Ri, { className: te(H, $ ? "h-3 w-3" : "h-4 w-4") })
14206
+ children: /* @__PURE__ */ u.jsx(Ri, { className: ne(H, $ ? "h-3 w-3" : "h-4 w-4") })
14201
14207
  }
14202
14208
  )
14203
14209
  ]
@@ -14208,7 +14214,7 @@ const Oc = B.memo(function({
14208
14214
  }
14209
14215
  ),
14210
14216
  /* @__PURE__ */ u.jsx("div", { className: "relative", children: mt() }),
14211
- J && O === "expanded" && (ie.toolCallId || ie.name) && /* @__PURE__ */ u.jsxs("div", { className: te("mt-2 pt-2 border-t border-current/10 text-xs opacity-60", $ && "text-xs"), children: [
14217
+ Z && O === "expanded" && (ie.toolCallId || ie.name) && /* @__PURE__ */ u.jsxs("div", { className: ne("mt-2 pt-2 border-t border-current/10 text-xs opacity-60", $ && "text-xs"), children: [
14212
14218
  ie.name && /* @__PURE__ */ u.jsxs("div", { children: [
14213
14219
  "Function: ",
14214
14220
  ie.name
@@ -14218,10 +14224,10 @@ const Oc = B.memo(function({
14218
14224
  ie.toolCallId
14219
14225
  ] })
14220
14226
  ] }),
14221
- !(i || a || J) && s && !o && /* @__PURE__ */ u.jsxs(
14227
+ !(i || a || Z) && s && !o && /* @__PURE__ */ u.jsxs(
14222
14228
  "div",
14223
14229
  {
14224
- className: te(
14230
+ className: ne(
14225
14231
  "absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity",
14226
14232
  "flex items-center gap-1",
14227
14233
  p.actions
@@ -14232,9 +14238,9 @@ const Oc = B.memo(function({
14232
14238
  {
14233
14239
  variant: "ghost",
14234
14240
  size: "sm",
14235
- onClick: () => De(),
14236
- className: te("h-6 w-6 p-0 hover:bg-background/50 text-current", $ && "h-5 w-5"),
14237
- children: /* @__PURE__ */ u.jsx(ol, { className: te(L ? "text-success" : "text-current", $ ? "h-3 w-3" : "h-4 w-4") })
14241
+ onClick: () => Me(),
14242
+ className: ne("h-6 w-6 p-0 hover:bg-background/50 text-current", $ && "h-5 w-5"),
14243
+ children: /* @__PURE__ */ u.jsx(ol, { className: ne(L ? "text-success" : "text-current", $ ? "h-3 w-3" : "h-4 w-4") })
14238
14244
  }
14239
14245
  ),
14240
14246
  A === "user" && h && /* @__PURE__ */ u.jsx(
@@ -14243,8 +14249,8 @@ const Oc = B.memo(function({
14243
14249
  variant: "ghost",
14244
14250
  size: "sm",
14245
14251
  onClick: Ue,
14246
- className: te("h-6 w-6 p-0 hover:bg-background/50 text-current", $ && "h-5 w-5"),
14247
- children: /* @__PURE__ */ u.jsx(sl, { className: te("text-current", $ ? "h-3 w-3" : "h-4 w-4") })
14252
+ className: ne("h-6 w-6 p-0 hover:bg-background/50 text-current", $ && "h-5 w-5"),
14253
+ children: /* @__PURE__ */ u.jsx(sl, { className: ne("text-current", $ ? "h-3 w-3" : "h-4 w-4") })
14248
14254
  }
14249
14255
  ),
14250
14256
  A === "assistant" && m && /* @__PURE__ */ u.jsx(
@@ -14253,8 +14259,8 @@ const Oc = B.memo(function({
14253
14259
  variant: "ghost",
14254
14260
  size: "sm",
14255
14261
  onClick: qe,
14256
- className: te("h-6 w-6 p-0 hover:bg-background/50 text-current", $ && "h-5 w-5"),
14257
- children: /* @__PURE__ */ u.jsx(Ri, { className: te("text-current", $ ? "h-3 w-3" : "h-4 w-4") })
14262
+ className: ne("h-6 w-6 p-0 hover:bg-background/50 text-current", $ && "h-5 w-5"),
14263
+ children: /* @__PURE__ */ u.jsx(Ri, { className: ne("text-current", $ ? "h-3 w-3" : "h-4 w-4") })
14258
14264
  }
14259
14265
  )
14260
14266
  ]
@@ -14311,7 +14317,7 @@ function CC({
14311
14317
  return /* @__PURE__ */ u.jsxs(
14312
14318
  Br,
14313
14319
  {
14314
- className: te(
14320
+ className: ne(
14315
14321
  "border-blue-200 dark:border-blue-800 bg-blue-50/50 dark:bg-blue-950/10 transition-shadow",
14316
14322
  o ? "shadow-md ring-1 ring-blue-300 dark:ring-blue-500/70" : "opacity-80"
14317
14323
  ),
@@ -14429,10 +14435,10 @@ function kC({
14429
14435
  }) {
14430
14436
  const s = Math.max(e.length - r, 0), i = e.substring(0, r);
14431
14437
  return /* @__PURE__ */ u.jsxs("div", { className: "flex flex-col gap-1", children: [
14432
- /* @__PURE__ */ u.jsx("div", { className: te("text-sm text-[hsl(var(--chat-bubble-user-text))]", o && "text-xs"), children: t ? /* @__PURE__ */ u.jsx(as, { content: e, allowHtml: !1 }) : /* @__PURE__ */ u.jsxs(
14438
+ /* @__PURE__ */ u.jsx("div", { className: ne("text-sm text-[hsl(var(--chat-bubble-user-text))]", o && "text-xs"), children: t ? /* @__PURE__ */ u.jsx(as, { content: e, allowHtml: !1 }) : /* @__PURE__ */ u.jsxs(
14433
14439
  "pre",
14434
14440
  {
14435
- className: te(
14441
+ className: ne(
14436
14442
  "font-sans whitespace-pre-wrap break-words bg-transparent p-0 m-0 text-[hsl(var(--chat-bubble-user-text))]",
14437
14443
  o && "text-xs"
14438
14444
  ),
@@ -14613,17 +14619,17 @@ const EC = ({
14613
14619
  messagePreviews: O,
14614
14620
  createSyntheticThinkingMessage: F = !1
14615
14621
  }, I) => {
14616
- const z = He(null), N = He(null), Y = He(!1), [$, A] = ye(!0), J = nt(() => w ? e.some((se) => "type" in se && se.type === "default_message" ? !1 : Array.isArray(se == null ? void 0 : se.content) && se.content.some(
14622
+ const z = He(null), N = He(null), Y = He(!1), [$, A] = ye(!0), Z = nt(() => w ? e.some((se) => "type" in se && se.type === "default_message" ? !1 : Array.isArray(se == null ? void 0 : se.content) && se.content.some(
14617
14623
  (he) => he && he.type === "interrupt" && (he.id ?? he.interrupt_id) === w.id
14618
14624
  )) : !1, [w, e]), q = nt(() => {
14619
- if (!w || J)
14625
+ if (!w || Z)
14620
14626
  return null;
14621
14627
  const se = w.id && String(w.id).trim() ? String(w.id).trim() : "pending-interrupt";
14622
14628
  let he;
14623
14629
  const Le = w.value;
14624
14630
  if (Le && typeof Le == "object" && !Array.isArray(Le)) {
14625
- const De = Le.title;
14626
- typeof De == "string" && De.trim() && (he = De.trim());
14631
+ const Me = Le.title;
14632
+ typeof Me == "string" && Me.trim() && (he = Me.trim());
14627
14633
  }
14628
14634
  return {
14629
14635
  id: `interrupt-${se}`,
@@ -14638,7 +14644,7 @@ const EC = ({
14638
14644
  }
14639
14645
  ]
14640
14646
  };
14641
- }, [w, J]), pe = nt(() => q ? [...e, q] : e, [e, q]), be = nt(() => !F || !t ? pe : !pe.some((he) => he.role === "assistant") && pe.length > 0 ? [
14647
+ }, [w, Z]), pe = nt(() => q ? [...e, q] : e, [e, q]), be = nt(() => !F || !t ? pe : !pe.some((he) => he.role === "assistant") && pe.length > 0 ? [
14642
14648
  ...pe,
14643
14649
  {
14644
14650
  id: "thinking-assistant",
@@ -14649,13 +14655,13 @@ const EC = ({
14649
14655
  ] : pe, [pe, t, F]), Ee = nt(() => S ? be : be.filter((se) => (se == null ? void 0 : se.role) !== "tool"), [be, S]), G = nt(() => {
14650
14656
  const se = /* @__PURE__ */ new Set(), he = [];
14651
14657
  for (let Le = Ee.length - 1; Le >= 0; Le--) {
14652
- const De = Ee[Le];
14653
- if (!De) continue;
14654
- if ("type" in De && De.type === "default_message") {
14655
- he.push(De);
14658
+ const Me = Ee[Le];
14659
+ if (!Me) continue;
14660
+ if ("type" in Me && Me.type === "default_message") {
14661
+ he.push(Me);
14656
14662
  continue;
14657
14663
  }
14658
- const Ue = De, qe = IC(Ue);
14664
+ const Ue = Me, qe = IC(Ue);
14659
14665
  se.has(qe) || (se.add(qe), he.push(Ue));
14660
14666
  }
14661
14667
  return he.reverse();
@@ -14673,7 +14679,7 @@ const EC = ({
14673
14679
  }
14674
14680
  }
14675
14681
  };
14676
- }, [a]), D = nt(() => !m || y ? !1 : $ ? "auto" : !1, [$, m, y]), H = P ?? [], ne = H.length > 0, ie = nt(() => {
14682
+ }, [a]), D = nt(() => !m || y ? !1 : $ ? "auto" : !1, [$, m, y]), H = P ?? [], re = H.length > 0, ie = nt(() => {
14677
14683
  if (typeof h != "string") return null;
14678
14684
  const se = h.trim();
14679
14685
  return se ? {
@@ -14683,7 +14689,7 @@ const EC = ({
14683
14689
  content: se,
14684
14690
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
14685
14691
  } : null;
14686
- }, [h]), oe = ne ? /* @__PURE__ */ u.jsx(
14692
+ }, [h]), oe = re ? /* @__PURE__ */ u.jsx(
14687
14693
  EC,
14688
14694
  {
14689
14695
  timelineEntries: H,
@@ -14691,7 +14697,7 @@ const EC = ({
14691
14697
  onSelectCheckpoint: L,
14692
14698
  messagePreviews: O
14693
14699
  }
14694
- ) : null, Me = ["flex h-full flex-col md:flex-row", f].filter(Boolean).join(" "), Ze = () => ie ? /* @__PURE__ */ u.jsx("div", { className: "p-6 h-full overflow-y-auto", children: /* @__PURE__ */ u.jsx("div", { className: "w-full max-w-full", children: /* @__PURE__ */ u.jsx(
14700
+ ) : null, Oe = ["flex h-full flex-col md:flex-row", f].filter(Boolean).join(" "), Je = () => ie ? /* @__PURE__ */ u.jsx("div", { className: "p-6 h-full overflow-y-auto", children: /* @__PURE__ */ u.jsx("div", { className: "w-full max-w-full", children: /* @__PURE__ */ u.jsx(
14695
14701
  Oc,
14696
14702
  {
14697
14703
  message: ie,
@@ -14708,7 +14714,7 @@ const EC = ({
14708
14714
  onCancelEdit: () => {
14709
14715
  }
14710
14716
  }
14711
- ) }) }) : /* @__PURE__ */ u.jsx("div", { className: "flex h-full items-center justify-center py-8 text-center text-muted-foreground", children: h ?? "No messages yet. Start a conversation!" }), Pe = G.length > 0;
14717
+ ) }) }) : /* @__PURE__ */ u.jsx("div", { className: "flex h-full items-center justify-center py-8 text-center text-muted-foreground", children: h ?? "No messages yet. Start a conversation!" }), De = G.length > 0;
14712
14718
  return Qh(
14713
14719
  I,
14714
14720
  () => ({
@@ -14733,9 +14739,9 @@ const EC = ({
14733
14739
  }
14734
14740
  }),
14735
14741
  [G]
14736
- ), /* @__PURE__ */ u.jsxs("div", { className: Me, style: p, children: [
14742
+ ), /* @__PURE__ */ u.jsxs("div", { className: Oe, style: p, children: [
14737
14743
  oe,
14738
- /* @__PURE__ */ u.jsx("div", { className: "relative flex-1 min-h-0", children: Pe ? /* @__PURE__ */ u.jsx(
14744
+ /* @__PURE__ */ u.jsx("div", { className: "relative flex-1 min-h-0", children: De ? /* @__PURE__ */ u.jsx(
14739
14745
  mS,
14740
14746
  {
14741
14747
  ref: (se) => {
@@ -14759,9 +14765,9 @@ const EC = ({
14759
14765
  computeItemKey: (se, he) => Mc(he, se),
14760
14766
  itemContent: (se, he) => {
14761
14767
  var ht;
14762
- const Le = Mc(he, se), De = "type" in he && he.type === "default_message";
14768
+ const Le = Mc(he, se), Me = "type" in he && he.type === "default_message";
14763
14769
  let Ue = [], qe = null, ze = {}, Ke = {}, Ge = null, tt = null;
14764
- if (!De) {
14770
+ if (!Me) {
14765
14771
  const lt = he, mt = lt.checkpointId ?? null;
14766
14772
  ze = lt.additionalKwargs ?? {}, Ke = lt.responseMetadata ?? {};
14767
14773
  const it = mt && k ? k.get(mt) ?? null : null;
@@ -14817,7 +14823,7 @@ const EC = ({
14817
14823
  );
14818
14824
  }
14819
14825
  }
14820
- ) : Ze() })
14826
+ ) : Je() })
14821
14827
  ] });
14822
14828
  });
14823
14829
  Ip.displayName = "MessageList";
@@ -14854,7 +14860,7 @@ function Ti({
14854
14860
  metadata: L,
14855
14861
  timelineCheckpoints: P,
14856
14862
  messagePreviews: O
14857
- } = fa(), { isStreaming: F, error: I, connectionState: z, submit: N, stop: Y } = qx(), $ = g ?? x ?? null, A = (k == null ? void 0 : k.id) ?? null, J = (k == null ? void 0 : k.namespace) ?? null, q = (L == null ? void 0 : L.assemblingMessageId) ?? null, pe = _, [be, Ee] = ye(!1);
14863
+ } = fa(), { isStreaming: F, error: I, connectionState: z, submit: N, stop: Y } = qx(), $ = g ?? x ?? null, A = (k == null ? void 0 : k.id) ?? null, Z = (k == null ? void 0 : k.namespace) ?? null, q = (L == null ? void 0 : L.assemblingMessageId) ?? null, pe = _, [be, Ee] = ye(!1);
14858
14864
  Tt(() => {
14859
14865
  pe || Ee(!1);
14860
14866
  }, [pe]);
@@ -14862,24 +14868,24 @@ function Ti({
14862
14868
  Ee(!0);
14863
14869
  }, []), W = _e(() => {
14864
14870
  Ee(!1);
14865
- }, []), K = !!pe || be, [D, H] = ye(null), [ne, ie] = ye(""), [oe, Me] = ye(null), [Ze, Pe] = ye(null), [se, he] = ye([]), [Le, De] = ye(0), [Ue, qe] = ye(0), [ze, Ke] = ye(!1), [Ge, tt] = ye(null), [It, ht] = ye(null), [lt, mt] = ye(!1), [it, We] = ye(null), At = He(!1), [Nt, Yt] = ye(() => Dc.value), Xt = He(Nt), Je = He(null), Ie = _e((Q) => {
14866
- Dc.value = Q, Yt(Q);
14867
- }, []), [Ot, re] = ye(!1), j = He(null), X = _e(
14868
- (Q, ue) => {
14869
- if (!Q || typeof Q != "object") return null;
14870
- const de = Q[ue];
14871
+ }, []), K = !!pe || be, [D, H] = ye(null), [re, ie] = ye(""), [oe, Oe] = ye(null), [Je, De] = ye(null), [se, he] = ye([]), [Le, Me] = ye(0), [Ue, qe] = ye(0), [ze, Ke] = ye(!1), [Ge, tt] = ye(null), [It, ht] = ye(null), [lt, mt] = ye(!1), [it, We] = ye(null), At = He(!1), [Nt, Yt] = ye(() => Dc.value), Xt = He(Nt), Ze = He(null), Ie = _e((te) => {
14872
+ Dc.value = te, Yt(te);
14873
+ }, []), [Ot, ee] = ye(!1), j = He(null), X = _e(
14874
+ (te, ue) => {
14875
+ if (!te || typeof te != "object") return null;
14876
+ const de = te[ue];
14871
14877
  return typeof de == "number" ? de : null;
14872
14878
  },
14873
14879
  []
14874
- ), ee = _e(
14875
- (Q, ue) => {
14876
- if (!Q || typeof Q != "object") return null;
14877
- const de = Q[ue];
14880
+ ), J = _e(
14881
+ (te, ue) => {
14882
+ if (!te || typeof te != "object") return null;
14883
+ const de = te[ue];
14878
14884
  return typeof de == "string" && de.trim() ? de : null;
14879
14885
  },
14880
14886
  []
14881
14887
  ), me = nt(() => {
14882
- const Q = (ve) => {
14888
+ const te = (ve) => {
14883
14889
  if (!Array.isArray(ve) || ve.length === 0)
14884
14890
  return null;
14885
14891
  const ct = ve.map((gt) => {
@@ -14894,7 +14900,7 @@ function Ti({
14894
14900
  }).filter((gt) => !!(gt && gt.length));
14895
14901
  return ct.length ? ct.join(", ") : null;
14896
14902
  }, ue = Array.isArray(E) ? E.map((ve) => {
14897
- const ct = Q(ve.next);
14903
+ const ct = te(ve.next);
14898
14904
  return ct ? {
14899
14905
  ...ve,
14900
14906
  metadata: {
@@ -14911,11 +14917,11 @@ function Ti({
14911
14917
  return Number.isNaN(Ar) || Number.isNaN(_r) ? 0 : _r - Ar;
14912
14918
  }), ue;
14913
14919
  }, [E, X]), { checkpointMetaById: $e, checkpointIndexByKey: St } = nt(() => {
14914
- const Q = /* @__PURE__ */ new Map(), ue = /* @__PURE__ */ new Map();
14920
+ const te = /* @__PURE__ */ new Map(), ue = /* @__PURE__ */ new Map();
14915
14921
  for (const de of me) {
14916
14922
  const ve = de.checkpointId ?? null;
14917
14923
  if (!ve) continue;
14918
- const ct = X(de.metadata, "step"), gt = ee(de.metadata, "source"), sn = {
14924
+ const ct = X(de.metadata, "step"), gt = J(de.metadata, "source"), sn = {
14919
14925
  id: ve,
14920
14926
  step: ct,
14921
14927
  source: gt,
@@ -14923,7 +14929,7 @@ function Ti({
14923
14929
  namespace: de.checkpointNs ?? null,
14924
14930
  parentId: de.parentId ?? null
14925
14931
  };
14926
- if (Q.set(ve, sn), ct !== null && gt) {
14932
+ if (te.set(ve, sn), ct !== null && gt) {
14927
14933
  const Ar = `${ct}:${gt}`, _r = ue.get(Ar) ?? [];
14928
14934
  _r.push(sn), ue.set(Ar, _r);
14929
14935
  }
@@ -14933,12 +14939,12 @@ function Ti({
14933
14939
  const gt = ve.createdAt ?? "";
14934
14940
  return (ct.createdAt ?? "").localeCompare(gt);
14935
14941
  });
14936
- return { checkpointMetaById: Q, checkpointIndexByKey: ue };
14937
- }, [me, X, ee]), Se = P ?? [], vt = He(null), Ce = He(null), rt = _e(() => {
14938
- vt.current && (vt.current.value = ""), Ce.current && (Ce.current.value = ""), De((Q) => Q + 1), qe((Q) => Q + 1);
14942
+ return { checkpointMetaById: te, checkpointIndexByKey: ue };
14943
+ }, [me, X, J]), Se = P ?? [], vt = He(null), Ce = He(null), rt = _e(() => {
14944
+ vt.current && (vt.current.value = ""), Ce.current && (Ce.current.value = ""), Me((te) => te + 1), qe((te) => te + 1);
14939
14945
  }, []), Ir = _e(
14940
- (Q) => {
14941
- Ie(Q);
14946
+ (te) => {
14947
+ Ie(te);
14942
14948
  },
14943
14949
  [Ie]
14944
14950
  ), Nr = He(!1);
@@ -14947,22 +14953,22 @@ function Ti({
14947
14953
  }, [F, rt]);
14948
14954
  const [go, Xs] = ye("desktop");
14949
14955
  Tt(() => {
14950
- const Q = () => {
14956
+ const te = () => {
14951
14957
  const ue = window.innerWidth;
14952
14958
  Xs(ue < 640 ? "phone" : ue < 1024 ? "tablet" : "desktop");
14953
14959
  };
14954
- return Q(), window.addEventListener("resize", Q), () => window.removeEventListener("resize", Q);
14960
+ return te(), window.addEventListener("resize", te), () => window.removeEventListener("resize", te);
14955
14961
  }, []), Tt(() => {
14956
14962
  At.current = !1;
14957
14963
  }, [$]), Tt(() => {
14958
14964
  Xt.current = Nt;
14959
14965
  }, [Nt]), Tt(() => {
14960
14966
  if (!D) {
14961
- Je.current = null;
14967
+ Ze.current = null;
14962
14968
  return;
14963
14969
  }
14964
- Je.current === null && (Je.current = Xt.current), Ie(ne ?? "");
14965
- }, [ne, D, Ie]), Tt(() => {
14970
+ Ze.current === null && (Ze.current = Xt.current), Ie(re ?? "");
14971
+ }, [re, D, Ie]), Tt(() => {
14966
14972
  (async () => {
14967
14973
  if (!y.baseUrl) {
14968
14974
  We(null);
@@ -14978,26 +14984,26 @@ function Ti({
14978
14984
  }, [y.baseUrl]), Tt(() => {
14979
14985
  I && !lt && (m == null || m(I));
14980
14986
  }, [I, lt, m]);
14981
- const Js = (Q) => {
14982
- if (Q.length > Fo)
14983
- return `Message too long (${Q.length}/${Fo} characters)`;
14987
+ const Js = (te) => {
14988
+ if (te.length > Fo)
14989
+ return `Message too long (${te.length}/${Fo} characters)`;
14984
14990
  try {
14985
- return s0(Q), null;
14991
+ return s0(te), null;
14986
14992
  } catch (ue) {
14987
14993
  return (ue == null ? void 0 : ue.message) || "Invalid message";
14988
14994
  }
14989
- }, Zs = async (Q) => {
14990
- const ue = Q.trim();
14995
+ }, Zs = async (te) => {
14996
+ const ue = te.trim();
14991
14997
  if (!(!ue && se.length === 0)) {
14992
14998
  if (ue) {
14993
14999
  const de = Js(ue);
14994
15000
  if (de) {
14995
- Pe(de);
15001
+ De(de);
14996
15002
  return;
14997
15003
  }
14998
15004
  }
14999
15005
  try {
15000
- const de = A ?? void 0, ve = J ?? void 0, ct = D ? {
15006
+ const de = A ?? void 0, ve = Z ?? void 0, ct = D ? {
15001
15007
  edit: !0,
15002
15008
  originalMessageId: D,
15003
15009
  ...oe != null && oe.checkpointId ? { originalCheckpointId: oe.checkpointId } : {},
@@ -15013,29 +15019,29 @@ function Ti({
15013
15019
  checkpointId: de,
15014
15020
  checkpointNs: ve
15015
15021
  }
15016
- ), p == null || p(ue), Ie(""), Pe(null), he([]), rt(), H(null), ie(""), Me(null);
15022
+ ), p == null || p(ue), Ie(""), De(null), he([]), rt(), H(null), ie(""), Oe(null);
15017
15023
  } catch (de) {
15018
15024
  const ve = (de == null ? void 0 : de.message) || "Failed to send message";
15019
- Pe(ve), m == null || m(ve);
15025
+ De(ve), m == null || m(ve);
15020
15026
  }
15021
15027
  }
15022
15028
  }, xo = B.useCallback(
15023
- (Q, ue, de) => {
15024
- c && (Je.current = Nt, H(Q), ie(ue), Ie(ue), Pe(null), Me({
15029
+ (te, ue, de) => {
15030
+ c && (Ze.current = Nt, H(te), ie(ue), Ie(ue), De(null), Oe({
15025
15031
  checkpointId: (de == null ? void 0 : de.checkpointId) ?? null,
15026
15032
  checkpointNs: (de == null ? void 0 : de.checkpointNs) ?? null
15027
15033
  }));
15028
15034
  },
15029
15035
  [Nt, c, Ie]
15030
15036
  ), R = B.useCallback(() => {
15031
- H(null), ie(""), Me(null), Pe(null), Ie(Je.current ?? Nt), Je.current = null;
15037
+ H(null), ie(""), Oe(null), De(null), Ie(Ze.current ?? Nt), Ze.current = null;
15032
15038
  }, [Nt, Ie]), V = _e(
15033
- (Q, ue, de) => {
15034
- xo(Q, ue, de);
15039
+ (te, ue, de) => {
15040
+ xo(te, ue, de);
15035
15041
  },
15036
15042
  [xo]
15037
- ), ae = _e((Q) => {
15038
- for (let ue = Q - 1; ue >= 0; ue--)
15043
+ ), ae = _e((te) => {
15044
+ for (let ue = te - 1; ue >= 0; ue--)
15039
15045
  if (w[ue].role === "user") {
15040
15046
  const de = w[ue].content || [], ct = de.filter((gt) => gt.type === "text").map((gt) => gt.text).join("") || (() => {
15041
15047
  try {
@@ -15048,21 +15054,21 @@ function Ti({
15048
15054
  { text: ct },
15049
15055
  {
15050
15056
  checkpointId: A ?? void 0,
15051
- checkpointNs: J ?? void 0
15057
+ checkpointNs: Z ?? void 0
15052
15058
  }
15053
15059
  );
15054
15060
  break;
15055
15061
  }
15056
- }, [w, N, A, J]), Te = (Q) => {
15057
- const ue = Array.from(Q.target.files || []);
15058
- he((de) => [...de, ...ue]), Q.target.value = "";
15059
- }, Qe = (Q) => {
15062
+ }, [w, N, A, Z]), Te = (te) => {
15063
+ const ue = Array.from(te.target.files || []);
15064
+ he((de) => [...de, ...ue]), te.target.value = "";
15065
+ }, Qe = (te) => {
15060
15066
  he((ue) => {
15061
- const de = ue.filter((ve, ct) => Q !== ct);
15067
+ const de = ue.filter((ve, ct) => te !== ct);
15062
15068
  return de.length === 0 && rt(), de;
15063
15069
  });
15064
- }, at = async (Q) => {
15065
- const ue = (Q.target.files || [])[0];
15070
+ }, at = async (te) => {
15071
+ const ue = (te.target.files || [])[0];
15066
15072
  if (ue) {
15067
15073
  tt(null), ht(null), Ke(!0);
15068
15074
  try {
@@ -15070,7 +15076,7 @@ function Ti({
15070
15076
  { attachments: [ue] },
15071
15077
  {
15072
15078
  checkpointId: A ?? void 0,
15073
- checkpointNs: J ?? void 0
15079
+ checkpointNs: Z ?? void 0
15074
15080
  }
15075
15081
  );
15076
15082
  const de = `Uploaded ${ue.name} - processing through chat stream`;
@@ -15079,42 +15085,42 @@ function Ti({
15079
15085
  const ve = de instanceof Error ? de.message : "Failed to upload Excel file";
15080
15086
  console.error("Excel upload failed", de), tt(ve), m == null || m(ve);
15081
15087
  } finally {
15082
- Ke(!1), Q.target.value = "", rt();
15088
+ Ke(!1), te.target.value = "", rt();
15083
15089
  }
15084
15090
  }
15085
- }, Ve = async (Q) => {
15091
+ }, Ve = async (te) => {
15086
15092
  if (x) {
15087
- re(!0);
15093
+ ee(!0);
15088
15094
  try {
15089
- if (!Q) {
15095
+ if (!te) {
15090
15096
  await S(), requestAnimationFrame(() => {
15091
15097
  var ve;
15092
15098
  (ve = j.current) == null || ve.scrollToLatest();
15093
15099
  });
15094
15100
  return;
15095
15101
  }
15096
- const ue = me.find((ve) => ve.checkpointId === Q), de = (ue == null ? void 0 : ue.checkpointNs) ?? null;
15097
- await C(Q, de), requestAnimationFrame(() => {
15102
+ const ue = me.find((ve) => ve.checkpointId === te), de = (ue == null ? void 0 : ue.checkpointNs) ?? null;
15103
+ await C(te, de), requestAnimationFrame(() => {
15098
15104
  var ve;
15099
15105
  (ve = j.current) == null || ve.scrollToTop();
15100
15106
  });
15101
15107
  } finally {
15102
- re(!1);
15108
+ ee(!1);
15103
15109
  }
15104
15110
  }
15105
15111
  }, Be = _e(
15106
- async (Q) => {
15107
- await Ve(Q);
15112
+ async (te) => {
15113
+ await Ve(te);
15108
15114
  },
15109
15115
  [Ve]
15110
15116
  ), _t = `flex flex-1 w-full flex-col min-h-0 min-w-0 max-h-full overflow-hidden bg-transparent ${e} ${f.container || ""}`, wt = `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 ${f.messagesArea || ""}`, bt = `flex-shrink-0 w-full border-t p-4 bg-transparent ${f.inputArea || ""}`;
15111
15117
  return _e(
15112
- (Q) => {
15113
- if (!Q)
15118
+ (te) => {
15119
+ if (!te)
15114
15120
  return "Latest";
15115
15121
  const ue = [];
15116
- Q.step !== null && ue.push(`Step ${Q.step}`), Q.source && ue.push(Q.source);
15117
- const de = Q.createdAt ? new Date(Q.createdAt) : null, ve = de && !Number.isNaN(de.getTime()) ? de.toLocaleString() : Q.createdAt ?? Q.id, ct = ue.length ? ` — ${ue.join(" • ")}` : "";
15122
+ te.step !== null && ue.push(`Step ${te.step}`), te.source && ue.push(te.source);
15123
+ const de = te.createdAt ? new Date(te.createdAt) : null, ve = de && !Number.isNaN(de.getTime()) ? de.toLocaleString() : te.createdAt ?? te.id, ct = ue.length ? ` — ${ue.join(" • ")}` : "";
15118
15124
  return `${ve}${ct}`;
15119
15125
  },
15120
15126
  []
@@ -15212,14 +15218,14 @@ function Ti({
15212
15218
  ref: vt,
15213
15219
  type: "file",
15214
15220
  multiple: !0,
15215
- onChange: (Q) => Te(Q),
15221
+ onChange: (te) => Te(te),
15216
15222
  className: "hidden"
15217
15223
  },
15218
15224
  Le
15219
15225
  ),
15220
- se.length > 0 && /* @__PURE__ */ u.jsx("div", { className: "flex flex-wrap gap-2", children: se.map((Q, ue) => /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2 bg-gray-100 dark:bg-gray-800 rounded-lg px-3 py-2 text-sm text-gray-900 dark:text-gray-100", children: [
15226
+ se.length > 0 && /* @__PURE__ */ u.jsx("div", { className: "flex flex-wrap gap-2", children: se.map((te, ue) => /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2 bg-gray-100 dark:bg-gray-800 rounded-lg px-3 py-2 text-sm text-gray-900 dark:text-gray-100", children: [
15221
15227
  /* @__PURE__ */ u.jsx(ki, { size: 14 }),
15222
- /* @__PURE__ */ u.jsx("span", { className: "truncate max-w-[150px]", children: Q.name }),
15228
+ /* @__PURE__ */ u.jsx("span", { className: "truncate max-w-[150px]", children: te.name }),
15223
15229
  /* @__PURE__ */ u.jsx(
15224
15230
  ot,
15225
15231
  {
@@ -15227,7 +15233,7 @@ function Ti({
15227
15233
  size: "sm",
15228
15234
  onClick: () => Qe(ue),
15229
15235
  className: "h-4 w-4 p-0 text-gray-500 dark:text-gray-400 hover:text-red-500 dark:hover:text-red-400",
15230
- "aria-label": `Remove ${Q.name}`,
15236
+ "aria-label": `Remove ${te.name}`,
15231
15237
  children: /* @__PURE__ */ u.jsx(dr, { size: 12 })
15232
15238
  }
15233
15239
  )
@@ -15253,7 +15259,7 @@ function Ti({
15253
15259
  Ge && !ze && /* @__PURE__ */ u.jsx("div", { className: "text-sm rounded border border-red-200 bg-red-50 px-3 py-2 text-red-600", children: Ge })
15254
15260
  ] })
15255
15261
  ] }),
15256
- Ze && /* @__PURE__ */ u.jsx("div", { className: "mb-3 text-sm text-red-600 bg-red-50 border border-red-200 rounded px-3 py-2", children: Ze }),
15262
+ Je && /* @__PURE__ */ u.jsx("div", { className: "mb-3 text-sm text-red-600 bg-red-50 border border-red-200 rounded px-3 py-2", children: Je }),
15257
15263
  /* @__PURE__ */ u.jsxs("div", { className: "flex items-end gap-2", children: [
15258
15264
  (a || l) && /* @__PURE__ */ u.jsxs(Yb, { children: [
15259
15265
  /* @__PURE__ */ u.jsx(Xb, { asChild: !0, children: /* @__PURE__ */ u.jsx(
@@ -15270,8 +15276,8 @@ function Ti({
15270
15276
  ) }),
15271
15277
  /* @__PURE__ */ u.jsxs(df, { align: "start", sideOffset: 6, className: "w-52", children: [
15272
15278
  a && /* @__PURE__ */ u.jsxs(Hi, { onClick: () => {
15273
- var Q;
15274
- return (Q = vt.current) == null ? void 0 : Q.click();
15279
+ var te;
15280
+ return (te = vt.current) == null ? void 0 : te.click();
15275
15281
  }, className: "cursor-pointer", children: [
15276
15282
  /* @__PURE__ */ u.jsx(ki, { className: "h-4 w-4 mr-2" }),
15277
15283
  " Attach files or images"
@@ -15280,8 +15286,8 @@ function Ti({
15280
15286
  Hi,
15281
15287
  {
15282
15288
  onClick: () => {
15283
- var Q;
15284
- ze || (Q = Ce.current) == null || Q.click();
15289
+ var te;
15290
+ ze || (te = Ce.current) == null || te.click();
15285
15291
  },
15286
15292
  className: `cursor-pointer ${ze ? "opacity-60 pointer-events-none" : ""}`,
15287
15293
  children: [
@@ -15295,7 +15301,7 @@ function Ti({
15295
15301
  /* @__PURE__ */ u.jsx("div", { className: "flex-1", children: /* @__PURE__ */ u.jsx(
15296
15302
  Xx,
15297
15303
  {
15298
- initialValue: ne,
15304
+ initialValue: re,
15299
15305
  editingMessageId: D,
15300
15306
  value: Nt,
15301
15307
  onValueChange: Ir,
@@ -15307,7 +15313,7 @@ function Ti({
15307
15313
  onCancelEdit: R,
15308
15314
  onStop: Y,
15309
15315
  allowEmptySend: se.length > 0,
15310
- textareaClassName: `resize-none min-h-[44px] max-h-[20rem] w-full transition-colors ${D ? "border-blue-400 bg-blue-50 text-blue-900 dark:border-blue-500 dark:bg-blue-950/60 dark:text-blue-50" : ""} ${Ze ? "border-red-400" : ""} ${f.textarea || ""}`
15316
+ textareaClassName: `resize-none min-h-[44px] max-h-[20rem] w-full transition-colors ${D ? "border-blue-400 bg-blue-50 text-blue-900 dark:border-blue-500 dark:bg-blue-950/60 dark:text-blue-50" : ""} ${Je ? "border-red-400" : ""} ${f.textarea || ""}`
15311
15317
  }
15312
15318
  ) })
15313
15319
  ] })
@@ -15319,7 +15325,7 @@ const ls = v.forwardRef(
15319
15325
  "input",
15320
15326
  {
15321
15327
  type: t,
15322
- className: te(
15328
+ className: ne(
15323
15329
  "flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
15324
15330
  e
15325
15331
  ),
@@ -15847,7 +15853,7 @@ const Hp = v.forwardRef(({ className: e, children: t, ...n }, r) => /* @__PURE__
15847
15853
  Bp,
15848
15854
  {
15849
15855
  ref: r,
15850
- className: te("relative overflow-hidden", e),
15856
+ className: ne("relative overflow-hidden", e),
15851
15857
  ...n,
15852
15858
  children: [
15853
15859
  /* @__PURE__ */ u.jsx(zC, { className: "h-full w-full rounded-[inherit] overflow-auto", children: t }),
@@ -15862,7 +15868,7 @@ const Up = v.forwardRef(({ className: e, orientation: t = "vertical", ...n }, r)
15862
15868
  {
15863
15869
  ref: r,
15864
15870
  orientation: t,
15865
- className: te(
15871
+ className: ne(
15866
15872
  "flex touch-none select-none transition-colors",
15867
15873
  t === "vertical" && "h-full w-2.5 border-l border-l-transparent p-[1px]",
15868
15874
  t === "horizontal" && "h-2.5 flex-col border-t border-t-transparent p-[1px]",
@@ -15953,10 +15959,10 @@ function Fc({
15953
15959
  } catch (W) {
15954
15960
  console.error("Failed to update title:", W);
15955
15961
  }
15956
- }, J = () => {
15962
+ }, Z = () => {
15957
15963
  L(null), O("");
15958
15964
  }, q = (G, W) => {
15959
- G.key === "Enter" ? A(W) : G.key === "Escape" && J();
15965
+ G.key === "Enter" ? A(W) : G.key === "Escape" && Z();
15960
15966
  }, pe = (G) => {
15961
15967
  if (!G) return "";
15962
15968
  try {
@@ -16004,7 +16010,7 @@ function Fc({
16004
16010
  /* @__PURE__ */ u.jsx("div", { className: "flex-1 min-w-0", children: _ === G.threadId ? /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2", onClick: (W) => W.stopPropagation(), children: [
16005
16011
  /* @__PURE__ */ u.jsx(ls, { value: P, onChange: (W) => O(W.target.value), onKeyDown: (W) => q(W, G.threadId), className: "h-6 text-sm", autoFocus: !0 }),
16006
16012
  /* @__PURE__ */ u.jsx(ot, { variant: "ghost", size: "sm", onClick: () => A(G.threadId), className: "h-6 w-6 p-0", children: /* @__PURE__ */ u.jsx(ra, { size: 12 }) }),
16007
- /* @__PURE__ */ u.jsx(ot, { variant: "ghost", size: "sm", onClick: J, className: "h-6 w-6 p-0", children: /* @__PURE__ */ u.jsx(dr, { size: 12 }) })
16013
+ /* @__PURE__ */ u.jsx(ot, { variant: "ghost", size: "sm", onClick: Z, className: "h-6 w-6 p-0", children: /* @__PURE__ */ u.jsx(dr, { size: 12 }) })
16008
16014
  ] }) : /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
16009
16015
  /* @__PURE__ */ u.jsx("div", { className: "font-medium text-sm truncate text-gray-900 dark:text-slate-100", children: Ee(G) }),
16010
16016
  /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2 text-xs text-gray-500 dark:text-slate-400 mt-1", children: [
@@ -16157,7 +16163,7 @@ const GC = hs(
16157
16163
  Yp,
16158
16164
  {
16159
16165
  ref: n,
16160
- className: te(GC(), e),
16166
+ className: ne(GC(), e),
16161
16167
  ...t
16162
16168
  }
16163
16169
  ));
@@ -16286,7 +16292,7 @@ var nh = Jp, QC = Qp;
16286
16292
  const jn = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
16287
16293
  nh,
16288
16294
  {
16289
- className: te(
16295
+ className: ne(
16290
16296
  "peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",
16291
16297
  e
16292
16298
  ),
@@ -16295,7 +16301,7 @@ const jn = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
16295
16301
  children: /* @__PURE__ */ u.jsx(
16296
16302
  QC,
16297
16303
  {
16298
- className: te(
16304
+ className: ne(
16299
16305
  "pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0"
16300
16306
  )
16301
16307
  }
@@ -16532,9 +16538,9 @@ var an = 10, [fh, Hn] = Er(er), uT = "SelectContentImpl", dT = gr("SelectContent
16532
16538
  }, [b]), ma();
16533
16539
  const N = v.useCallback(
16534
16540
  (K) => {
16535
- const [D, ...H] = O().map((oe) => oe.ref.current), [ne] = H.slice(-1), ie = document.activeElement;
16541
+ const [D, ...H] = O().map((oe) => oe.ref.current), [re] = H.slice(-1), ie = document.activeElement;
16536
16542
  for (const oe of K)
16537
- if (oe === ie || (oe == null || oe.scrollIntoView({ block: "nearest" }), oe === D && C && (C.scrollTop = 0), oe === ne && C && (C.scrollTop = C.scrollHeight), oe == null || oe.focus(), document.activeElement !== ie)) return;
16543
+ if (oe === ie || (oe == null || oe.scrollIntoView({ block: "nearest" }), oe === D && C && (C.scrollTop = 0), oe === re && C && (C.scrollTop = C.scrollHeight), oe == null || oe.focus(), document.activeElement !== ie)) return;
16538
16544
  },
16539
16545
  [O, C]
16540
16546
  ), Y = v.useCallback(
@@ -16548,14 +16554,14 @@ var an = 10, [fh, Hn] = Er(er), uT = "SelectContentImpl", dT = gr("SelectContent
16548
16554
  v.useEffect(() => {
16549
16555
  if (b) {
16550
16556
  let K = { x: 0, y: 0 };
16551
- const D = (ne) => {
16557
+ const D = (re) => {
16552
16558
  var ie, oe;
16553
16559
  K = {
16554
- x: Math.abs(Math.round(ne.pageX) - (((ie = A.current) == null ? void 0 : ie.x) ?? 0)),
16555
- y: Math.abs(Math.round(ne.pageY) - (((oe = A.current) == null ? void 0 : oe.y) ?? 0))
16560
+ x: Math.abs(Math.round(re.pageX) - (((ie = A.current) == null ? void 0 : ie.x) ?? 0)),
16561
+ y: Math.abs(Math.round(re.pageY) - (((oe = A.current) == null ? void 0 : oe.y) ?? 0))
16556
16562
  };
16557
- }, H = (ne) => {
16558
- K.x <= 10 && K.y <= 10 ? ne.preventDefault() : b.contains(ne.target) || $(!1), document.removeEventListener("pointermove", D), A.current = null;
16563
+ }, H = (re) => {
16564
+ K.x <= 10 && K.y <= 10 ? re.preventDefault() : b.contains(re.target) || $(!1), document.removeEventListener("pointermove", D), A.current = null;
16559
16565
  };
16560
16566
  return A.current !== null && (document.addEventListener("pointermove", D), document.addEventListener("pointerup", H, { capture: !0, once: !0 })), () => {
16561
16567
  document.removeEventListener("pointermove", D), document.removeEventListener("pointerup", H, { capture: !0 });
@@ -16567,19 +16573,19 @@ var an = 10, [fh, Hn] = Er(er), uT = "SelectContentImpl", dT = gr("SelectContent
16567
16573
  window.removeEventListener("blur", K), window.removeEventListener("resize", K);
16568
16574
  };
16569
16575
  }, [$]);
16570
- const [J, q] = Ah((K) => {
16571
- const D = O().filter((ie) => !ie.disabled), H = D.find((ie) => ie.ref.current === document.activeElement), ne = _h(D, K, H);
16572
- ne && setTimeout(() => ne.ref.current.focus());
16576
+ const [Z, q] = Ah((K) => {
16577
+ const D = O().filter((ie) => !ie.disabled), H = D.find((ie) => ie.ref.current === document.activeElement), re = _h(D, K, H);
16578
+ re && setTimeout(() => re.ref.current.focus());
16573
16579
  }), pe = v.useCallback(
16574
16580
  (K, D, H) => {
16575
- const ne = !z.current && !H;
16576
- (w.value !== void 0 && w.value === D || ne) && (_(K), ne && (z.current = !0));
16581
+ const re = !z.current && !H;
16582
+ (w.value !== void 0 && w.value === D || re) && (_(K), re && (z.current = !0));
16577
16583
  },
16578
16584
  [w.value]
16579
16585
  ), be = v.useCallback(() => b == null ? void 0 : b.focus(), [b]), Ee = v.useCallback(
16580
16586
  (K, D, H) => {
16581
- const ne = !z.current && !H;
16582
- (w.value !== void 0 && w.value === D || ne) && P(K);
16587
+ const re = !z.current && !H;
16588
+ (w.value !== void 0 && w.value === D || re) && P(K);
16583
16589
  },
16584
16590
  [w.value]
16585
16591
  ), G = r === "popper" ? Xi : hh, W = G === Xi ? {
@@ -16609,7 +16615,7 @@ var an = 10, [fh, Hn] = Er(er), uT = "SelectContentImpl", dT = gr("SelectContent
16609
16615
  selectedItemText: L,
16610
16616
  position: r,
16611
16617
  isPositioned: F,
16612
- searchRef: J,
16618
+ searchRef: Z,
16613
16619
  children: /* @__PURE__ */ u.jsx(_s, { as: dT, allowPinchZoom: !0, children: /* @__PURE__ */ u.jsx(
16614
16620
  Cs,
16615
16621
  {
@@ -16654,12 +16660,12 @@ var an = 10, [fh, Hn] = Er(er), uT = "SelectContentImpl", dT = gr("SelectContent
16654
16660
  onKeyDown: fe(g.onKeyDown, (K) => {
16655
16661
  const D = K.ctrlKey || K.altKey || K.metaKey;
16656
16662
  if (K.key === "Tab" && K.preventDefault(), !D && K.key.length === 1 && q(K.key), ["ArrowUp", "ArrowDown", "Home", "End"].includes(K.key)) {
16657
- let ne = O().filter((ie) => !ie.disabled).map((ie) => ie.ref.current);
16658
- if (["ArrowUp", "End"].includes(K.key) && (ne = ne.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(K.key)) {
16659
- const ie = K.target, oe = ne.indexOf(ie);
16660
- ne = ne.slice(oe + 1);
16663
+ let re = O().filter((ie) => !ie.disabled).map((ie) => ie.ref.current);
16664
+ if (["ArrowUp", "End"].includes(K.key) && (re = re.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(K.key)) {
16665
+ const ie = K.target, oe = re.indexOf(ie);
16666
+ re = re.slice(oe + 1);
16661
16667
  }
16662
- setTimeout(() => N(ne)), K.preventDefault();
16668
+ setTimeout(() => N(re)), K.preventDefault();
16663
16669
  }
16664
16670
  })
16665
16671
  }
@@ -16678,44 +16684,44 @@ var fT = "SelectItemAlignedPosition", hh = v.forwardRef((e, t) => {
16678
16684
  if (s.trigger && s.valueNode && a && c && y && x && g) {
16679
16685
  const k = s.trigger.getBoundingClientRect(), E = c.getBoundingClientRect(), _ = s.valueNode.getBoundingClientRect(), L = g.getBoundingClientRect();
16680
16686
  if (s.dir !== "rtl") {
16681
- const ie = L.left - E.left, oe = _.left - ie, Me = k.left - oe, Ze = k.width + Me, Pe = Math.max(Ze, E.width), se = window.innerWidth - an, he = Yi(oe, [
16687
+ const ie = L.left - E.left, oe = _.left - ie, Oe = k.left - oe, Je = k.width + Oe, De = Math.max(Je, E.width), se = window.innerWidth - an, he = Yi(oe, [
16682
16688
  an,
16683
16689
  // Prevents the content from going off the starting edge of the
16684
16690
  // viewport. It may still go off the ending edge, but this can be
16685
16691
  // controlled by the user since they may want to manage overflow in a
16686
16692
  // specific way.
16687
16693
  // https://github.com/radix-ui/primitives/issues/2049
16688
- Math.max(an, se - Pe)
16694
+ Math.max(an, se - De)
16689
16695
  ]);
16690
- a.style.minWidth = Ze + "px", a.style.left = he + "px";
16696
+ a.style.minWidth = Je + "px", a.style.left = he + "px";
16691
16697
  } else {
16692
- const ie = E.right - L.right, oe = window.innerWidth - _.right - ie, Me = window.innerWidth - k.right - oe, Ze = k.width + Me, Pe = Math.max(Ze, E.width), se = window.innerWidth - an, he = Yi(oe, [
16698
+ const ie = E.right - L.right, oe = window.innerWidth - _.right - ie, Oe = window.innerWidth - k.right - oe, Je = k.width + Oe, De = Math.max(Je, E.width), se = window.innerWidth - an, he = Yi(oe, [
16693
16699
  an,
16694
- Math.max(an, se - Pe)
16700
+ Math.max(an, se - De)
16695
16701
  ]);
16696
- a.style.minWidth = Ze + "px", a.style.right = he + "px";
16702
+ a.style.minWidth = Je + "px", a.style.right = he + "px";
16697
16703
  }
16698
- const P = p(), O = window.innerHeight - an * 2, F = y.scrollHeight, I = window.getComputedStyle(c), z = parseInt(I.borderTopWidth, 10), N = parseInt(I.paddingTop, 10), Y = parseInt(I.borderBottomWidth, 10), $ = parseInt(I.paddingBottom, 10), A = z + N + F + $ + Y, J = Math.min(x.offsetHeight * 5, A), q = window.getComputedStyle(y), pe = parseInt(q.paddingTop, 10), be = parseInt(q.paddingBottom, 10), Ee = k.top + k.height / 2 - an, G = O - Ee, W = x.offsetHeight / 2, K = x.offsetTop + W, D = z + N + K, H = A - D;
16704
+ const P = p(), O = window.innerHeight - an * 2, F = y.scrollHeight, I = window.getComputedStyle(c), z = parseInt(I.borderTopWidth, 10), N = parseInt(I.paddingTop, 10), Y = parseInt(I.borderBottomWidth, 10), $ = parseInt(I.paddingBottom, 10), A = z + N + F + $ + Y, Z = Math.min(x.offsetHeight * 5, A), q = window.getComputedStyle(y), pe = parseInt(q.paddingTop, 10), be = parseInt(q.paddingBottom, 10), Ee = k.top + k.height / 2 - an, G = O - Ee, W = x.offsetHeight / 2, K = x.offsetTop + W, D = z + N + K, H = A - D;
16699
16705
  if (D <= Ee) {
16700
16706
  const ie = P.length > 0 && x === P[P.length - 1].ref.current;
16701
16707
  a.style.bottom = "0px";
16702
- const oe = c.clientHeight - y.offsetTop - y.offsetHeight, Me = Math.max(
16708
+ const oe = c.clientHeight - y.offsetTop - y.offsetHeight, Oe = Math.max(
16703
16709
  G,
16704
16710
  W + // viewport might have padding bottom, include it to avoid a scrollable viewport
16705
16711
  (ie ? be : 0) + oe + Y
16706
- ), Ze = D + Me;
16707
- a.style.height = Ze + "px";
16712
+ ), Je = D + Oe;
16713
+ a.style.height = Je + "px";
16708
16714
  } else {
16709
16715
  const ie = P.length > 0 && x === P[0].ref.current;
16710
16716
  a.style.top = "0px";
16711
- const Me = Math.max(
16717
+ const Oe = Math.max(
16712
16718
  Ee,
16713
16719
  z + y.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
16714
16720
  (ie ? pe : 0) + W
16715
16721
  ) + H;
16716
- a.style.height = Me + "px", y.scrollTop = D - Ee + y.offsetTop;
16722
+ a.style.height = Oe + "px", y.scrollTop = D - Ee + y.offsetTop;
16717
16723
  }
16718
- a.style.margin = `${an}px 0`, a.style.minHeight = J + "px", a.style.maxHeight = O + "px", r == null || r(), requestAnimationFrame(() => h.current = !0);
16724
+ a.style.margin = `${an}px 0`, a.style.minHeight = Z + "px", a.style.maxHeight = O + "px", r == null || r(), requestAnimationFrame(() => h.current = !0);
16719
16725
  }
16720
16726
  }, [
16721
16727
  p,
@@ -17135,7 +17141,7 @@ const zc = CT, Bc = TT, ta = v.forwardRef(({ className: e, children: t, ...n },
17135
17141
  jh,
17136
17142
  {
17137
17143
  ref: r,
17138
- className: te(
17144
+ className: ne(
17139
17145
  "flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
17140
17146
  e
17141
17147
  ),
@@ -17151,7 +17157,7 @@ const Fh = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
17151
17157
  Dh,
17152
17158
  {
17153
17159
  ref: n,
17154
- className: te(
17160
+ className: ne(
17155
17161
  "flex cursor-default items-center justify-center py-1",
17156
17162
  e
17157
17163
  ),
@@ -17164,7 +17170,7 @@ const zh = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
17164
17170
  Lh,
17165
17171
  {
17166
17172
  ref: n,
17167
- className: te(
17173
+ className: ne(
17168
17174
  "flex cursor-default items-center justify-center py-1",
17169
17175
  e
17170
17176
  ),
@@ -17177,7 +17183,7 @@ const na = v.forwardRef(({ className: e, children: t, position: n = "popper", ..
17177
17183
  Ph,
17178
17184
  {
17179
17185
  ref: o,
17180
- className: te(
17186
+ className: ne(
17181
17187
  "relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
17182
17188
  n === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
17183
17189
  e
@@ -17189,7 +17195,7 @@ const na = v.forwardRef(({ className: e, children: t, position: n = "popper", ..
17189
17195
  /* @__PURE__ */ u.jsx(
17190
17196
  ET,
17191
17197
  {
17192
- className: te(
17198
+ className: ne(
17193
17199
  "p-1",
17194
17200
  n === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
17195
17201
  ),
@@ -17205,7 +17211,7 @@ const AT = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
17205
17211
  Oh,
17206
17212
  {
17207
17213
  ref: n,
17208
- className: te("py-1.5 pl-8 pr-2 text-sm font-semibold", e),
17214
+ className: ne("py-1.5 pl-8 pr-2 text-sm font-semibold", e),
17209
17215
  ...t
17210
17216
  }
17211
17217
  ));
@@ -17214,7 +17220,7 @@ const Un = v.forwardRef(({ className: e, children: t, ...n }, r) => /* @__PURE__
17214
17220
  Mh,
17215
17221
  {
17216
17222
  ref: r,
17217
- className: te(
17223
+ className: ne(
17218
17224
  "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
17219
17225
  e
17220
17226
  ),
@@ -17230,7 +17236,7 @@ const _T = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
17230
17236
  $h,
17231
17237
  {
17232
17238
  ref: n,
17233
- className: te("-mx-1 my-1 h-px bg-muted", e),
17239
+ className: ne("-mx-1 my-1 h-px bg-muted", e),
17234
17240
  ...t
17235
17241
  }
17236
17242
  ));
@@ -17259,7 +17265,7 @@ const Uh = v.forwardRef(
17259
17265
  ref: o,
17260
17266
  decorative: n,
17261
17267
  orientation: t,
17262
- className: te(
17268
+ className: ne(
17263
17269
  "shrink-0 bg-border",
17264
17270
  t === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
17265
17271
  e
@@ -17272,7 +17278,7 @@ Uh.displayName = Hh.displayName;
17272
17278
  const MT = fp, DT = XS, LT = pp, Wh = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
17273
17279
  Bs,
17274
17280
  {
17275
- className: te(
17281
+ className: ne(
17276
17282
  "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
17277
17283
  e
17278
17284
  ),
@@ -17302,7 +17308,7 @@ const $T = hs(
17302
17308
  Hs,
17303
17309
  {
17304
17310
  ref: o,
17305
- className: te($T({ side: e }), t),
17311
+ className: ne($T({ side: e }), t),
17306
17312
  ...r,
17307
17313
  children: [
17308
17314
  n,
@@ -17321,7 +17327,7 @@ const Kh = ({
17321
17327
  }) => /* @__PURE__ */ u.jsx(
17322
17328
  "div",
17323
17329
  {
17324
- className: te(
17330
+ className: ne(
17325
17331
  "flex flex-col space-y-2 text-center sm:text-left",
17326
17332
  e
17327
17333
  ),
@@ -17333,7 +17339,7 @@ const qh = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
17333
17339
  qn,
17334
17340
  {
17335
17341
  ref: n,
17336
- className: te("text-lg font-semibold text-foreground", e),
17342
+ className: ne("text-lg font-semibold text-foreground", e),
17337
17343
  ...t
17338
17344
  }
17339
17345
  ));
@@ -17342,7 +17348,7 @@ const Gh = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
17342
17348
  Us,
17343
17349
  {
17344
17350
  ref: n,
17345
- className: te("text-sm text-muted-foreground", e),
17351
+ className: ne("text-sm text-muted-foreground", e),
17346
17352
  ...t
17347
17353
  }
17348
17354
  ));