teodor-new-chat-ui 4.3.192 → 4.3.193

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -2,7 +2,7 @@ var om = Object.defineProperty;
2
2
  var sm = (e, t, n) => t in e ? om(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
3
  var cl = (e, t, n) => sm(e, typeof t != "symbol" ? t + "" : t, n);
4
4
  import * as v from "react";
5
- import z, { createContext as lo, useContext as xs, useRef as Je, useCallback as Ne, useReducer as im, useEffect as St, useMemo as at, useState as ye, useLayoutEffect as am, createElement as Mo, useImperativeHandle as lm } from "react";
5
+ import z, { createContext as lo, useContext as xs, useRef as Xe, useCallback as Ne, useReducer as im, useEffect as Ct, useMemo as at, useState as ye, useLayoutEffect as am, createElement as Mo, useImperativeHandle as lm } from "react";
6
6
  import { Square as cm, Send as um, ChevronRight as Xc, Check as ca, Circle as dm, X as vr, ExternalLink as fm, Download as pm, Image as hm, FileText as ul, Loader as ua, Bot as si, Wrench as mm, User as gm, Paperclip as _i, ChevronUp as da, ChevronDown as ys, ChevronLeft as xm, Copy as dl, Edit as fl, RotateCcw as ji, Info as ym, Loader2 as Do, Edit3 as Jc, Plus as vm, FileSpreadsheet as wm, MessageSquarePlus as bm, MessageSquare as Sm, Calendar as Cm, Trash2 as Tm, Settings as km, Server as Rm, EyeOff as Em, Eye as Im, Layout as Nm, MessageCircle as Am, Save as _m } from "lucide-react";
7
7
  import { Slot as jm, createSlot as Tr } from "@radix-ui/react-slot";
8
8
  import { cva as vs } from "class-variance-authority";
@@ -267,18 +267,18 @@ function Dm() {
267
267
  if (Ft && be && typeof Ft.stack == "string") {
268
268
  for (var Fe = Ft.stack.split(`
269
269
  `), Ot = be.stack.split(`
270
- `), bt = Fe.length - 1, vt = Ot.length - 1; bt >= 1 && vt >= 0 && Fe[bt] !== Ot[vt]; )
271
- vt--;
272
- for (; bt >= 1 && vt >= 0; bt--, vt--)
273
- if (Fe[bt] !== Ot[vt]) {
274
- if (bt !== 1 || vt !== 1)
270
+ `), St = Fe.length - 1, wt = Ot.length - 1; St >= 1 && wt >= 0 && Fe[St] !== Ot[wt]; )
271
+ wt--;
272
+ for (; St >= 1 && wt >= 0; St--, wt--)
273
+ if (Fe[St] !== Ot[wt]) {
274
+ if (St !== 1 || wt !== 1)
275
275
  do
276
- if (bt--, vt--, vt < 0 || Fe[bt] !== Ot[vt]) {
276
+ if (St--, wt--, wt < 0 || Fe[St] !== Ot[wt]) {
277
277
  var Kt = `
278
- ` + Fe[bt].replace(" at new ", " at ");
278
+ ` + Fe[St].replace(" at new ", " at ");
279
279
  return R.displayName && Kt.includes("<anonymous>") && (Kt = Kt.replace("<anonymous>", R.displayName)), typeof R == "function" && te.set(R, Kt), Kt;
280
280
  }
281
- while (bt >= 1 && vt >= 0);
281
+ while (St >= 1 && wt >= 0);
282
282
  break;
283
283
  }
284
284
  }
@@ -325,7 +325,7 @@ function Dm() {
325
325
  return "";
326
326
  }
327
327
  var Ie = Object.prototype.hasOwnProperty, ke = {}, $e = g.ReactDebugCurrentFrame;
328
- function Ze(R) {
328
+ function Je(R) {
329
329
  if (R) {
330
330
  var V = R._owner, se = ue(R.type, R._source, V ? V.type : null);
331
331
  $e.setExtraStackFrame(se);
@@ -344,10 +344,10 @@ function Dm() {
344
344
  throw Ot.name = "Invariant Violation", Ot;
345
345
  }
346
346
  Fe = R[Be](V, Be, be, se, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
347
- } catch (bt) {
348
- Fe = bt;
347
+ } catch (St) {
348
+ Fe = St;
349
349
  }
350
- Fe && !(Fe instanceof Error) && (Ze(Ge), 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).", be || "React class", se, Be, typeof Fe), Ze(null)), Fe instanceof Error && !(Fe.message in ke) && (ke[Fe.message] = !0, Ze(Ge), w("Failed %s type: %s", se, Fe.message), Ze(null));
350
+ Fe && !(Fe instanceof Error) && (Je(Ge), 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).", be || "React class", se, Be, typeof Fe), Je(null)), Fe instanceof Error && !(Fe.message in ke) && (ke[Fe.message] = !0, Je(Ge), w("Failed %s type: %s", se, Fe.message), Je(null));
351
351
  }
352
352
  }
353
353
  }
@@ -355,7 +355,7 @@ function Dm() {
355
355
  function Ue(R) {
356
356
  return Ke(R);
357
357
  }
358
- function Qe(R) {
358
+ function Ze(R) {
359
359
  {
360
360
  var V = typeof Symbol == "function" && Symbol.toStringTag, se = V && R[Symbol.toStringTag] || R.constructor.name || "Object";
361
361
  return se;
@@ -363,25 +363,25 @@ function Dm() {
363
363
  }
364
364
  function qe(R) {
365
365
  try {
366
- return nt(R), !1;
366
+ return tt(R), !1;
367
367
  } catch {
368
368
  return !0;
369
369
  }
370
370
  }
371
- function nt(R) {
371
+ function tt(R) {
372
372
  return "" + R;
373
373
  }
374
- function Nt(R) {
374
+ function At(R) {
375
375
  if (qe(R))
376
- return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Qe(R)), nt(R);
376
+ return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Ze(R)), tt(R);
377
377
  }
378
- var ht = g.ReactCurrentOwner, lt = {
378
+ var mt = g.ReactCurrentOwner, lt = {
379
379
  key: !0,
380
380
  ref: !0,
381
381
  __self: !0,
382
382
  __source: !0
383
- }, fe, ge;
384
- function he(R) {
383
+ }, fe, pe;
384
+ function me(R) {
385
385
  if (Ie.call(R, "ref")) {
386
386
  var V = Object.getOwnPropertyDescriptor(R, "ref").get;
387
387
  if (V && V.isReactWarning)
@@ -397,10 +397,10 @@ function Dm() {
397
397
  }
398
398
  return R.key !== void 0;
399
399
  }
400
- function Xe(R, V) {
401
- typeof R.ref == "string" && ht.current;
400
+ function gt(R, V) {
401
+ typeof R.ref == "string" && mt.current;
402
402
  }
403
- function At(R, V) {
403
+ function rt(R, V) {
404
404
  {
405
405
  var se = function() {
406
406
  fe || (fe = !0, w("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", V));
@@ -411,10 +411,10 @@ function Dm() {
411
411
  });
412
412
  }
413
413
  }
414
- function yt(R, V) {
414
+ function ut(R, V) {
415
415
  {
416
416
  var se = function() {
417
- ge || (ge = !0, w("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", V));
417
+ pe || (pe = !0, w("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", V));
418
418
  };
419
419
  se.isReactWarning = !0, Object.defineProperty(R, "ref", {
420
420
  get: se,
@@ -422,7 +422,7 @@ function Dm() {
422
422
  });
423
423
  }
424
424
  }
425
- var et = function(R, V, se, be, Ge, it, Be) {
425
+ var Qe = function(R, V, se, be, Ge, it, Be) {
426
426
  var Fe = {
427
427
  // This tag allows us to uniquely identify this as a React Element
428
428
  $$typeof: t,
@@ -454,19 +454,19 @@ function Dm() {
454
454
  function ze(R, V, se, be, Ge) {
455
455
  {
456
456
  var it, Be = {}, Fe = null, Ot = null;
457
- se !== void 0 && (Nt(se), Fe = "" + se), je(V) && (Nt(V.key), Fe = "" + V.key), he(V) && (Ot = V.ref, Xe(V, Ge));
457
+ se !== void 0 && (At(se), Fe = "" + se), je(V) && (At(V.key), Fe = "" + V.key), me(V) && (Ot = V.ref, gt(V, Ge));
458
458
  for (it in V)
459
459
  Ie.call(V, it) && !lt.hasOwnProperty(it) && (Be[it] = V[it]);
460
460
  if (R && R.defaultProps) {
461
- var bt = R.defaultProps;
462
- for (it in bt)
463
- Be[it] === void 0 && (Be[it] = bt[it]);
461
+ var St = R.defaultProps;
462
+ for (it in St)
463
+ Be[it] === void 0 && (Be[it] = St[it]);
464
464
  }
465
465
  if (Fe || Ot) {
466
- var vt = typeof R == "function" ? R.displayName || R.name || "Unknown" : R;
467
- Fe && At(Be, vt), Ot && yt(Be, vt);
466
+ var wt = typeof R == "function" ? R.displayName || R.name || "Unknown" : R;
467
+ Fe && rt(Be, wt), Ot && ut(Be, wt);
468
468
  }
469
- return et(R, Fe, Ot, Ge, be, ht.current, Be);
469
+ return Qe(R, Fe, Ot, Ge, be, mt.current, Be);
470
470
  }
471
471
  }
472
472
  var Pt = g.ReactCurrentOwner, _t = g.ReactDebugCurrentFrame;
@@ -482,7 +482,7 @@ function Dm() {
482
482
  function xe(R) {
483
483
  return typeof R == "object" && R !== null && R.$$typeof === t;
484
484
  }
485
- function pt() {
485
+ function ht() {
486
486
  {
487
487
  if (Pt.current) {
488
488
  var R = F(Pt.current.type);
@@ -494,13 +494,13 @@ Check the render method of \`` + R + "`.";
494
494
  return "";
495
495
  }
496
496
  }
497
- function mt(R) {
497
+ function xt(R) {
498
498
  return "";
499
499
  }
500
- var Ct = {};
500
+ var Tt = {};
501
501
  function Oe(R) {
502
502
  {
503
- var V = pt();
503
+ var V = ht();
504
504
  if (!V) {
505
505
  var se = typeof R == "string" ? R : R.displayName || R.name;
506
506
  se && (V = `
@@ -516,9 +516,9 @@ Check the top-level render call using <` + se + ">.");
516
516
  return;
517
517
  R._store.validated = !0;
518
518
  var se = Oe(V);
519
- if (Ct[se])
519
+ if (Tt[se])
520
520
  return;
521
- Ct[se] = !0;
521
+ Tt[se] = !0;
522
522
  var be = "";
523
523
  R && R._owner && R._owner !== Pt.current && (be = " It was passed a child from " + F(R._owner.type) + "."), W(R), w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', se, be), W(null);
524
524
  }
@@ -542,7 +542,7 @@ Check the top-level render call using <` + se + ">.");
542
542
  }
543
543
  }
544
544
  }
545
- function Tt(R) {
545
+ function kt(R) {
546
546
  {
547
547
  var V = R.type;
548
548
  if (V == null || typeof V == "string")
@@ -586,14 +586,14 @@ Check the top-level render call using <` + se + ">.");
586
586
  if (!Be) {
587
587
  var Fe = "";
588
588
  (R === void 0 || typeof R == "object" && R !== null && Object.keys(R).length === 0) && (Fe += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
589
- var Ot = mt();
590
- Ot ? Fe += Ot : Fe += pt();
591
- var bt;
592
- R === null ? bt = "null" : Ue(R) ? bt = "array" : R !== void 0 && R.$$typeof === t ? (bt = "<" + (F(R.type) || "Unknown") + " />", Fe = " Did you accidentally export a JSX literal instead of a component?") : bt = typeof R, w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", bt, Fe);
589
+ var Ot = xt();
590
+ Ot ? Fe += Ot : Fe += ht();
591
+ var St;
592
+ R === null ? St = "null" : Ue(R) ? St = "array" : R !== void 0 && R.$$typeof === t ? (St = "<" + (F(R.type) || "Unknown") + " />", Fe = " Did you accidentally export a JSX literal instead of a component?") : St = typeof R, w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", St, Fe);
593
593
  }
594
- var vt = ze(R, V, se, Ge, it);
595
- if (vt == null)
596
- return vt;
594
+ var wt = ze(R, V, se, Ge, it);
595
+ if (wt == null)
596
+ return wt;
597
597
  if (Be) {
598
598
  var Kt = V.children;
599
599
  if (Kt !== void 0)
@@ -621,7 +621,7 @@ React keys must be passed directly to JSX without using spread:
621
621
  <%s key={someKey} {...props} />`, Dr, Nn, G, Nn), Jn[Nn + Dr] = !0;
622
622
  }
623
623
  }
624
- return R === r ? Dn(vt) : Tt(vt), vt;
624
+ return R === r ? Dn(wt) : kt(wt), wt;
625
625
  }
626
626
  }
627
627
  function ti(R, V, se) {
@@ -2349,26 +2349,26 @@ function Su(e) {
2349
2349
  return Su(or(e, o));
2350
2350
  }, n;
2351
2351
  }
2352
- const Rt = Su(po);
2353
- Rt.Axios = nr;
2354
- Rt.CanceledError = Ar;
2355
- Rt.CancelToken = lx;
2356
- Rt.isCancel = hu;
2357
- Rt.VERSION = wu;
2358
- Rt.toFormData = Ts;
2359
- Rt.AxiosError = Me;
2360
- Rt.Cancel = Rt.CanceledError;
2361
- Rt.all = function(t) {
2352
+ const Et = Su(po);
2353
+ Et.Axios = nr;
2354
+ Et.CanceledError = Ar;
2355
+ Et.CancelToken = lx;
2356
+ Et.isCancel = hu;
2357
+ Et.VERSION = wu;
2358
+ Et.toFormData = Ts;
2359
+ Et.AxiosError = Me;
2360
+ Et.Cancel = Et.CanceledError;
2361
+ Et.all = function(t) {
2362
2362
  return Promise.all(t);
2363
2363
  };
2364
- Rt.spread = cx;
2365
- Rt.isAxiosError = ux;
2366
- Rt.mergeConfig = or;
2367
- Rt.AxiosHeaders = Yt;
2368
- Rt.formToJSON = (e) => pu(P.isHTMLForm(e) ? new FormData(e) : e);
2369
- Rt.getAdapter = vu.getAdapter;
2370
- Rt.HttpStatusCode = Fi;
2371
- Rt.default = Rt;
2364
+ Et.spread = cx;
2365
+ Et.isAxiosError = ux;
2366
+ Et.mergeConfig = or;
2367
+ Et.AxiosHeaders = Yt;
2368
+ Et.formToJSON = (e) => pu(P.isHTMLForm(e) ? new FormData(e) : e);
2369
+ Et.getAdapter = vu.getAdapter;
2370
+ Et.HttpStatusCode = Fi;
2371
+ Et.default = Et;
2372
2372
  const {
2373
2373
  Axios: QT,
2374
2374
  AxiosError: ek,
@@ -2386,7 +2386,7 @@ const {
2386
2386
  formToJSON: fk,
2387
2387
  getAdapter: pk,
2388
2388
  mergeConfig: hk
2389
- } = Rt, _l = typeof window < "u" ? window.__API_BASE_URL__ : void 0, jl = _l ? jn(_l) : void 0;
2389
+ } = Et, _l = typeof window < "u" ? window.__API_BASE_URL__ : void 0, jl = _l ? jn(_l) : void 0;
2390
2390
  function jn(e) {
2391
2391
  const n = (e != null && e.trim() ? e.trim() : "/api/chat").replace(/\/+$/, "");
2392
2392
  return n ? n.endsWith("/chat") ? n : `${n}/chat` : "/api/chat";
@@ -2402,7 +2402,7 @@ function zi(e) {
2402
2402
  function fx(e) {
2403
2403
  return $i.add(e), () => $i.delete(e);
2404
2404
  }
2405
- const px = 3e4, hx = 9e4, ln = Rt.create({
2405
+ const px = 3e4, hx = 9e4, ln = Et.create({
2406
2406
  // Only set baseURL when configured — do NOT fall back to localhost. Falling back causes
2407
2407
  // noisy network requests to the frontend Dev server when the backend isn't configured.
2408
2408
  ...jl ? { baseURL: jl } : {},
@@ -2618,7 +2618,7 @@ function Hr(e) {
2618
2618
  }
2619
2619
  function ku(e, t) {
2620
2620
  if (!ma(e)) return null;
2621
- const n = e.values ?? { messages: [] }, r = Array.isArray(n == null ? void 0 : n.messages) ? n.messages : [], { messages: o, ...s } = n, i = Object.keys(s).length ? s : null, a = e.tasks, l = Array.isArray(a) ? a.filter((I) => !!I && typeof I == "object").map((I) => ({ ...I })) : a === null ? null : void 0, c = r.map((I, E) => _x(I, E)).filter((I) => !!I), d = qt(e.config), f = qt(d == null ? void 0 : d.configurable), p = Et(f, ["checkpoint_id", "checkpointId"]), h = Et(f, ["checkpoint_ns", "checkpointNs"]), x = qt(e == null ? void 0 : e.parentConfig), y = qt(x == null ? void 0 : x.configurable), m = Et(y, ["checkpoint_id", "checkpointId"]) ?? null, g = Et(y, ["checkpoint_ns", "checkpointNs"]) ?? null, w = e == null ? void 0 : e.createdAt, b = typeof w == "string" && w.trim() ? w : new Date(Date.now() - t).toISOString(), T = c[c.length - 1] ?? null, C = qt(e == null ? void 0 : e.metadata), S = Et(C, ["branch_label", "branchLabel"]), k = Et(y, ["checkpoint_id", "checkpointId"]), N = Array.isArray(e.next) ? [...e.next] : (e == null ? void 0 : e.next) === null ? null : void 0;
2621
+ const n = e.values ?? { messages: [] }, r = Array.isArray(n == null ? void 0 : n.messages) ? n.messages : [], { messages: o, ...s } = n, i = Object.keys(s).length ? s : null, a = e.tasks, l = Array.isArray(a) ? a.filter((I) => !!I && typeof I == "object").map((I) => ({ ...I })) : a === null ? null : void 0, c = r.map((I, E) => _x(I, E)).filter((I) => !!I), d = qt(e.config), f = qt(d == null ? void 0 : d.configurable), p = It(f, ["checkpoint_id", "checkpointId"]), h = It(f, ["checkpoint_ns", "checkpointNs"]), x = qt(e == null ? void 0 : e.parentConfig), y = qt(x == null ? void 0 : x.configurable), m = It(y, ["checkpoint_id", "checkpointId"]) ?? null, g = It(y, ["checkpoint_ns", "checkpointNs"]) ?? null, w = e == null ? void 0 : e.createdAt, b = typeof w == "string" && w.trim() ? w : new Date(Date.now() - t).toISOString(), T = c[c.length - 1] ?? null, C = qt(e == null ? void 0 : e.metadata), S = It(C, ["branch_label", "branchLabel"]), k = It(y, ["checkpoint_id", "checkpointId"]), N = Array.isArray(e.next) ? [...e.next] : (e == null ? void 0 : e.next) === null ? null : void 0;
2622
2622
  return {
2623
2623
  messages: c,
2624
2624
  checkpointId: p ?? null,
@@ -2734,7 +2734,7 @@ function Ax(e, t) {
2734
2734
  }
2735
2735
  const n = qt(e);
2736
2736
  if (!n) return null;
2737
- const r = Et(n, ["id", "task_id", "taskId"]) ?? t, o = Et(n, ["name"]) ?? "task", s = Array.isArray(n.interrupts) ? n.interrupts : void 0, i = Object.prototype.hasOwnProperty.call(n, "state") ? n.state : void 0;
2737
+ const r = It(n, ["id", "task_id", "taskId"]) ?? t, o = It(n, ["name"]) ?? "task", s = Array.isArray(n.interrupts) ? n.interrupts : void 0, i = Object.prototype.hasOwnProperty.call(n, "state") ? n.state : void 0;
2738
2738
  return { id: r, name: o, interrupts: s, state: i };
2739
2739
  }
2740
2740
  function Ur(e, t, n = 0, r = /* @__PURE__ */ new Set()) {
@@ -2787,7 +2787,7 @@ function Ru(e, t) {
2787
2787
  if (!e)
2788
2788
  return null;
2789
2789
  if (typeof e == "object" && !Array.isArray(e)) {
2790
- const n = e, r = Et(n, ["type", "event", "kind"]), o = Et(n, ["id", "interrupt_id", "interruptId", "value_id"]) ?? (r && r.toLowerCase().includes("interrupt") ? t : void 0);
2790
+ const n = e, r = It(n, ["type", "event", "kind"]), o = It(n, ["id", "interrupt_id", "interruptId", "value_id"]) ?? (r && r.toLowerCase().includes("interrupt") ? t : void 0);
2791
2791
  if (!(Object.prototype.hasOwnProperty.call(n, "value") || Object.prototype.hasOwnProperty.call(n, "data") || Object.prototype.hasOwnProperty.call(n, "payload")) && !(r && r.toLowerCase().includes("interrupt")))
2792
2792
  return null;
2793
2793
  const i = Object.prototype.hasOwnProperty.call(n, "value") ? n.value : Object.prototype.hasOwnProperty.call(n, "data") ? n.data : Object.prototype.hasOwnProperty.call(n, "payload") ? n.payload : n, a = o && o.trim() ? o : t;
@@ -2819,7 +2819,7 @@ function _x(e, t) {
2819
2819
  ).toLowerCase(), i = bx[s];
2820
2820
  if (!i)
2821
2821
  return null;
2822
- const a = o.id ?? o.message_id ?? o.run_id ?? null, l = typeof a == "string" && a.trim() ? a : `history-${i}-${t}`, c = qt(o.additional_kwargs) ?? qt(o.additionalKwargs), d = qt(o.response_metadata) ?? qt(o.responseMetadata), f = Et(c, ["createdAt", "created_at"]) ?? Et(o, ["created_at", "createdAt"]), p = Et(c, ["checkpointId", "checkpoint_id"]), h = Et(c, ["checkpointNs", "checkpoint_ns"]), x = jx(o.content), y = {
2822
+ const a = o.id ?? o.message_id ?? o.run_id ?? null, l = typeof a == "string" && a.trim() ? a : `history-${i}-${t}`, c = qt(o.additional_kwargs) ?? qt(o.additionalKwargs), d = qt(o.response_metadata) ?? qt(o.responseMetadata), f = It(c, ["createdAt", "created_at"]) ?? It(o, ["created_at", "createdAt"]), p = It(c, ["checkpointId", "checkpoint_id"]), h = It(c, ["checkpointNs", "checkpoint_ns"]), x = jx(o.content), y = {
2823
2823
  id: l,
2824
2824
  role: i,
2825
2825
  content: x
@@ -2863,13 +2863,13 @@ function Ml(e) {
2863
2863
  return o.trim() ? { type: "text", text: o } : null;
2864
2864
  }
2865
2865
  if (n === "image" || n === "image_url") {
2866
- const o = Et(t, ["url", "src"]);
2866
+ const o = It(t, ["url", "src"]);
2867
2867
  if (!o) return null;
2868
2868
  const s = { type: "image_url", url: o };
2869
2869
  return typeof t.mimeType == "string" && (s.mimeType = t.mimeType), typeof t.alt == "string" && (s.alt = t.alt), s;
2870
2870
  }
2871
2871
  if (n === "file") {
2872
- const o = Et(t, ["url"]);
2872
+ const o = It(t, ["url"]);
2873
2873
  if (!o) return null;
2874
2874
  const s = { type: "file", url: o };
2875
2875
  return typeof t.mimeType == "string" && (s.mimeType = t.mimeType), typeof t.name == "string" && (s.name = t.name), typeof t.size == "number" && (s.size = t.size), typeof t.sourceType == "string" && (s.sourceType = t.sourceType), s;
@@ -2887,7 +2887,7 @@ function Ml(e) {
2887
2887
  ...t
2888
2888
  };
2889
2889
  if (n === "tool") {
2890
- const o = Et(t, ["text", "content"]);
2890
+ const o = It(t, ["text", "content"]);
2891
2891
  if (o)
2892
2892
  return { type: "text", text: o };
2893
2893
  }
@@ -2896,7 +2896,7 @@ function Ml(e) {
2896
2896
  }
2897
2897
  function Eu(e, t) {
2898
2898
  var s;
2899
- const n = Et(e, ["id", "call_id"]) ?? t, r = Et(e, ["name"]) ?? Et(qt(e.function), ["name"]);
2899
+ const n = It(e, ["id", "call_id"]) ?? t, r = It(e, ["name"]) ?? It(qt(e.function), ["name"]);
2900
2900
  if (!n || !r) return null;
2901
2901
  const o = Mx(e.args ?? e.arguments ?? ((s = qt(e.function)) == null ? void 0 : s.arguments));
2902
2902
  return { type: "tool_call", id: n, name: r, args: o };
@@ -2929,7 +2929,7 @@ function qt(e) {
2929
2929
  if (!(!e || typeof e != "object" || Array.isArray(e)))
2930
2930
  return { ...e };
2931
2931
  }
2932
- function Et(e, t) {
2932
+ function It(e, t) {
2933
2933
  if (e)
2934
2934
  for (const n of t) {
2935
2935
  const r = e[n];
@@ -2951,7 +2951,7 @@ function Dx(e, t) {
2951
2951
  return r ? Object.keys(n).length ? n : void 0 : e;
2952
2952
  }
2953
2953
  function Lx() {
2954
- const e = Je(/* @__PURE__ */ new Map()), t = Ne(
2954
+ const e = Xe(/* @__PURE__ */ new Map()), t = Ne(
2955
2955
  (a, l) => {
2956
2956
  e.current.set(a, l);
2957
2957
  },
@@ -3047,7 +3047,7 @@ function zx(e, t) {
3047
3047
  }
3048
3048
  }
3049
3049
  function Bx(e = []) {
3050
- const [t, n] = im(zx, { ...$x, messages: e }), r = Je([]), o = Je(null), s = Je(null), i = Ne(() => {
3050
+ const [t, n] = im(zx, { ...$x, messages: e }), r = Xe([]), o = Xe(null), s = Xe(null), i = Ne(() => {
3051
3051
  o.current !== null && typeof window < "u" && window.cancelAnimationFrame(o.current), s.current !== null && clearTimeout(s.current), o.current = null, s.current = null;
3052
3052
  const d = r.current;
3053
3053
  d.length && (r.current = [], n({ type: "batch", payload: { events: d } }));
@@ -3056,7 +3056,7 @@ function Bx(e = []) {
3056
3056
  }, [i]), l = Ne((d) => {
3057
3057
  r.current.push(d), a();
3058
3058
  }, [a]);
3059
- St(() => () => {
3059
+ Ct(() => () => {
3060
3060
  o.current !== null && typeof window < "u" && window.cancelAnimationFrame(o.current), s.current !== null && clearTimeout(s.current), r.current = [];
3061
3061
  }, []);
3062
3062
  const c = at(() => ({
@@ -3393,7 +3393,7 @@ function Vx(e) {
3393
3393
  return t[t.length - 1] || null;
3394
3394
  }
3395
3395
  function Kx(e = {}) {
3396
- const t = at(() => jn(e.baseUrl), [e.baseUrl]), n = e.streamPath ?? "/runs/stream", [r, o] = ye(e.token ?? null), s = Je(e.headers ?? {}), i = e.credentials ?? "include", [a, l] = ye(!1), [c, d] = ye(null), [f, p] = ye(""), [h, x] = ye(null), [y, m] = ye(0), [g, w] = ye(!1), b = Je(null), T = Je(!0), C = Je(0), S = Je(null), k = Je(null), N = Je(null), I = Je(null), E = Ne((_) => {
3396
+ const t = at(() => jn(e.baseUrl), [e.baseUrl]), n = e.streamPath ?? "/runs/stream", [r, o] = ye(e.token ?? null), s = Xe(e.headers ?? {}), i = e.credentials ?? "include", [a, l] = ye(!1), [c, d] = ye(null), [f, p] = ye(""), [h, x] = ye(null), [y, m] = ye(0), [g, w] = ye(!1), b = Xe(null), T = Xe(!0), C = Xe(0), S = Xe(null), k = Xe(null), N = Xe(null), I = Xe(null), E = Ne((_) => {
3397
3397
  o(_);
3398
3398
  }, []), j = Ne(() => {
3399
3399
  p(""), x(null), d(null), k.current = null, N.current = null, I.current = null;
@@ -3410,14 +3410,14 @@ function Kx(e = {}) {
3410
3410
  threadId: _.threadId ?? null,
3411
3411
  headers: {}
3412
3412
  }, (async () => {
3413
- var de, Ee, Ae, K, ee, q, M, H, te, oe, ne, Te, Z, ue, Ie, ke, $e, Ze;
3413
+ var de, Ee, Ae, K, ee, q, M, H, te, oe, ne, Te, Z, ue, Ie, ke, $e, Je;
3414
3414
  const X = (He) => {
3415
3415
  var Ke;
3416
3416
  try {
3417
3417
  const Ue = JSON.parse(JSON.stringify(He));
3418
- return (Ke = Ue == null ? void 0 : Ue.payload) != null && Ke.files_info && Array.isArray(Ue.payload.files_info) && (Ue.payload.files_info = Ue.payload.files_info.map((Qe) => ({
3419
- ...Qe,
3420
- data: Qe != null && Qe.data ? `<base64 ${String(Qe.data).length} chars>` : Qe == null ? void 0 : Qe.data
3418
+ return (Ke = Ue == null ? void 0 : Ue.payload) != null && Ke.files_info && Array.isArray(Ue.payload.files_info) && (Ue.payload.files_info = Ue.payload.files_info.map((Ze) => ({
3419
+ ...Ze,
3420
+ data: Ze != null && Ze.data ? `<base64 ${String(Ze.data).length} chars>` : Ze == null ? void 0 : Ze.data
3421
3421
  }))), Ue;
3422
3422
  } catch {
3423
3423
  return He;
@@ -3449,83 +3449,83 @@ function Kx(e = {}) {
3449
3449
  let Ke = {};
3450
3450
  if (typeof window < "u")
3451
3451
  try {
3452
- const et = (K = window.localStorage) == null ? void 0 : K.getItem("authSessionId");
3453
- et && (Ke = { "X-Session-Id": et });
3452
+ const Qe = (K = window.localStorage) == null ? void 0 : K.getItem("authSessionId");
3453
+ Qe && (Ke = { "X-Session-Id": Qe });
3454
3454
  } catch {
3455
3455
  }
3456
3456
  const Ue = {
3457
3457
  ...He,
3458
3458
  ...Ke,
3459
3459
  ...s.current
3460
- }, Qe = {
3460
+ }, Ze = {
3461
3461
  "Content-Type": "application/json",
3462
3462
  Accept: "text/event-stream",
3463
3463
  ...Ue
3464
3464
  }, qe = await fetch(t + n, {
3465
3465
  method: "POST",
3466
- headers: Qe,
3466
+ headers: Ze,
3467
3467
  body: JSON.stringify(_),
3468
3468
  signal: B.signal,
3469
3469
  credentials: i
3470
3470
  });
3471
3471
  if (S.current && (S.current.headers = Ue), !qe.ok || !qe.body) {
3472
- const et = await qe.text().catch(() => "");
3472
+ const Qe = await qe.text().catch(() => "");
3473
3473
  console.debug(
3474
3474
  "[use-chat] non-OK response",
3475
3475
  qe.status,
3476
- et == null ? void 0 : et.slice(0, 500)
3476
+ Qe == null ? void 0 : Qe.slice(0, 500)
3477
3477
  );
3478
- const ze = `stream ${qe.status}${et ? ": " + et : ""}`;
3478
+ const ze = `stream ${qe.status}${Qe ? ": " + Qe : ""}`;
3479
3479
  throw (ee = A == null ? void 0 : A.onConnectionError) == null || ee.call(A, ze), J = !0, D = "error", O = ze, new Error(ze);
3480
3480
  }
3481
3481
  w(!0);
3482
- const nt = qe.body.getReader(), Nt = new TextDecoder();
3483
- let ht = "", lt = [];
3482
+ const tt = qe.body.getReader(), At = new TextDecoder();
3483
+ let mt = "", lt = [];
3484
3484
  C.current = 0, m(0);
3485
- let fe = 0, ge = null;
3486
- const he = () => {
3485
+ let fe = 0, pe = null;
3486
+ const me = () => {
3487
3487
  if (lt.length) {
3488
- const et = lt.join("");
3489
- lt = [], T.current && p((ze) => ze + et);
3488
+ const Qe = lt.join("");
3489
+ lt = [], T.current && p((ze) => ze + Qe);
3490
3490
  }
3491
- ge = null;
3491
+ pe = null;
3492
3492
  }, je = () => {
3493
- typeof window < "u" && ge == null && (ge = requestAnimationFrame(he));
3493
+ typeof window < "u" && pe == null && (pe = requestAnimationFrame(me));
3494
3494
  };
3495
- let Xe = Date.now();
3496
- const At = setInterval(() => {
3497
- var et;
3498
- if (Date.now() - Xe > 18e5) {
3495
+ let gt = Date.now();
3496
+ const rt = setInterval(() => {
3497
+ var Qe;
3498
+ if (Date.now() - gt > 18e5) {
3499
3499
  const ze = "Stream idle timeout";
3500
- d(ze), D = "error", O = ze, B.abort(), (et = A == null ? void 0 : A.onError) == null || et.call(A, ze);
3500
+ d(ze), D = "error", O = ze, B.abort(), (Qe = A == null ? void 0 : A.onError) == null || Qe.call(A, ze);
3501
3501
  }
3502
- }, 5e3), yt = 1024 * 1024;
3502
+ }, 5e3), ut = 1024 * 1024;
3503
3503
  try {
3504
- const et = qe.headers.get("X-Thread-Id") || qe.headers.get("x-thread-id"), ze = qe.headers.get("X-Thread-Created") || qe.headers.get("x-thread-created"), Pt = et ?? null, _t = String(ze ?? "").toLowerCase() === "true";
3504
+ const Qe = qe.headers.get("X-Thread-Id") || qe.headers.get("x-thread-id"), ze = qe.headers.get("X-Thread-Created") || qe.headers.get("x-thread-created"), Pt = Qe ?? null, _t = String(ze ?? "").toLowerCase() === "true";
3505
3505
  for (S.current && !S.current.threadId && (S.current = {
3506
3506
  ...S.current,
3507
3507
  threadId: Pt
3508
3508
  }), (q = A == null ? void 0 : A.onOpen) == null || q.call(A, { threadId: Pt, created: _t }); ; ) {
3509
- const { value: W, done: we } = await nt.read();
3509
+ const { value: W, done: we } = await tt.read();
3510
3510
  if (we) break;
3511
- ht += Nt.decode(W, { stream: !0 }), ht.length > yt && (ht = "", console.warn("Stream buffer reset: exceeded 1MB"));
3511
+ mt += At.decode(W, { stream: !0 }), mt.length > ut && (mt = "", console.warn("Stream buffer reset: exceeded 1MB"));
3512
3512
  let xe;
3513
- for (; (xe = ht.indexOf(`
3513
+ for (; (xe = mt.indexOf(`
3514
3514
 
3515
3515
  `)) >= 0; ) {
3516
- const pt = ht.slice(0, xe);
3517
- ht = ht.slice(xe + 2);
3518
- const mt = Gx(pt);
3519
- if (!mt) continue;
3520
- let Ct;
3516
+ const ht = mt.slice(0, xe);
3517
+ mt = mt.slice(xe + 2);
3518
+ const xt = Gx(ht);
3519
+ if (!xt) continue;
3520
+ let Tt;
3521
3521
  try {
3522
- Ct = JSON.parse(mt);
3522
+ Tt = JSON.parse(xt);
3523
3523
  } catch {
3524
- console.debug("[use-chat] malformed SSE:", mt.slice(0, 200));
3524
+ console.debug("[use-chat] malformed SSE:", xt.slice(0, 200));
3525
3525
  continue;
3526
3526
  }
3527
- const Oe = qx(Ct) ? Ct.data : Ct;
3528
- Xe = Date.now();
3527
+ const Oe = qx(Tt) ? Tt.data : Tt;
3528
+ gt = Date.now();
3529
3529
  const Vt = Oe.seq;
3530
3530
  if (Vt !== void 0) {
3531
3531
  if (Vt <= fe) {
@@ -3540,9 +3540,9 @@ function Kx(e = {}) {
3540
3540
  preview: (() => {
3541
3541
  var ct;
3542
3542
  try {
3543
- return Oe.type === "message_delta" ? { deltaTypes: (ct = Oe.delta) == null ? void 0 : ct.map((Tt) => Tt.type), textLen: (Oe.delta || []).filter((Tt) => Tt.type === "text").map((Tt) => String(Tt.text || "").length) } : Oe.content || Oe.delta ? { hasContent: !0 } : {};
3544
- } catch (Tt) {
3545
- return { err: String(Tt) };
3543
+ return Oe.type === "message_delta" ? { deltaTypes: (ct = Oe.delta) == null ? void 0 : ct.map((kt) => kt.type), textLen: (Oe.delta || []).filter((kt) => kt.type === "text").map((kt) => String(kt.text || "").length) } : Oe.content || Oe.delta ? { hasContent: !0 } : {};
3544
+ } catch (kt) {
3545
+ return { err: String(kt) };
3546
3546
  }
3547
3547
  })()
3548
3548
  }), Oe.type === "checkpoint")
@@ -3550,8 +3550,8 @@ function Kx(e = {}) {
3550
3550
  else if (Oe.type === "state_history") {
3551
3551
  I.current = Oe;
3552
3552
  try {
3553
- const Tt = Hr(Oe).latest;
3554
- Tt && (k.current = Tt.checkpointId ?? null, N.current = Tt.checkpointNs ?? null, x(Tt.checkpointId ?? null));
3553
+ const kt = Hr(Oe).latest;
3554
+ kt && (k.current = kt.checkpointId ?? null, N.current = kt.checkpointNs ?? null, x(kt.checkpointId ?? null));
3555
3555
  } catch (ct) {
3556
3556
  console.warn("[use-chat] Failed to hydrate state_history payload", ct);
3557
3557
  }
@@ -3564,7 +3564,7 @@ function Kx(e = {}) {
3564
3564
  if (Oe.type === "token" && e.autoAppendAssistant !== !1)
3565
3565
  lt.push(Oe.content), je();
3566
3566
  else if (Oe.type === "message_delta") {
3567
- const ct = Oe.delta.filter((Tt) => Tt.type === "text").map((Tt) => Tt.text).join("");
3567
+ const ct = Oe.delta.filter((kt) => kt.type === "text").map((kt) => kt.text).join("");
3568
3568
  ct && e.autoAppendAssistant !== !1 && (lt.push(ct), je());
3569
3569
  } else if (Oe.type === "heartbeat") {
3570
3570
  console.debug("[use-chat] heartbeat received");
@@ -3573,7 +3573,7 @@ function Kx(e = {}) {
3573
3573
  } catch (ct) {
3574
3574
  console.warn("[use-chat] heartbeat callback failed", ct);
3575
3575
  }
3576
- } else if (ge !== null && cancelAnimationFrame(ge), he(), Oe.type === "checkpoint")
3576
+ } else if (pe !== null && cancelAnimationFrame(pe), me(), Oe.type === "checkpoint")
3577
3577
  x(Oe.checkpointId);
3578
3578
  else if (Oe.type === "error") {
3579
3579
  const ct = Oe;
@@ -3589,22 +3589,22 @@ function Kx(e = {}) {
3589
3589
  }
3590
3590
  }
3591
3591
  }
3592
- he(), D === null && !B.signal.aborted && (D = "complete");
3593
- } catch (et) {
3594
- if (et.name === "AbortError")
3592
+ me(), D === null && !B.signal.aborted && (D = "complete");
3593
+ } catch (Qe) {
3594
+ if (Qe.name === "AbortError")
3595
3595
  D = D ?? "aborted";
3596
3596
  else {
3597
- const ze = et.message || String(et);
3597
+ const ze = Qe.message || String(Qe);
3598
3598
  D = "error", O = ze, d(ze), (ue = A == null ? void 0 : A.onError) == null || ue.call(A, ze);
3599
3599
  }
3600
3600
  } finally {
3601
3601
  try {
3602
- await nt.cancel();
3602
+ await tt.cancel();
3603
3603
  } catch {
3604
3604
  } finally {
3605
- (Ie = nt.releaseLock) == null || Ie.call(nt);
3605
+ (Ie = tt.releaseLock) == null || Ie.call(tt);
3606
3606
  }
3607
- ge !== null && typeof window < "u" && window.cancelAnimationFrame(ge), clearInterval(At);
3607
+ pe !== null && typeof window < "u" && window.cancelAnimationFrame(pe), clearInterval(rt);
3608
3608
  }
3609
3609
  } catch (He) {
3610
3610
  if (He.name === "AbortError")
@@ -3614,18 +3614,18 @@ function Kx(e = {}) {
3614
3614
  D = "error", O = Ke, d(Ke), (ke = A == null ? void 0 : A.onError) == null || ke.call(A, Ke), J || (($e = A == null ? void 0 : A.onConnectionError) == null || $e.call(A, Ke), J = !0);
3615
3615
  }
3616
3616
  } finally {
3617
- const He = C.current, Ke = k.current, Ue = N.current, Qe = I.current, qe = D ?? (B.signal.aborted ? "aborted" : O ? "error" : "complete");
3617
+ const He = C.current, Ke = k.current, Ue = N.current, Ze = I.current, qe = D ?? (B.signal.aborted ? "aborted" : O ? "error" : "complete");
3618
3618
  try {
3619
- (Ze = A == null ? void 0 : A.onClosed) == null || Ze.call(A, {
3619
+ (Je = A == null ? void 0 : A.onClosed) == null || Je.call(A, {
3620
3620
  reason: qe,
3621
3621
  lastSeq: He,
3622
3622
  lastCheckpointId: Ke,
3623
3623
  lastCheckpointNs: Ue,
3624
- lastStateHistory: Qe,
3624
+ lastStateHistory: Ze,
3625
3625
  error: O
3626
3626
  });
3627
- } catch (nt) {
3628
- console.warn("[use-chat] onClosed callback failed", nt);
3627
+ } catch (tt) {
3628
+ console.warn("[use-chat] onClosed callback failed", tt);
3629
3629
  }
3630
3630
  l(!1), w(!1), b.current = null, C.current = 0, m(0), S.current = null;
3631
3631
  }
@@ -3633,7 +3633,7 @@ function Kx(e = {}) {
3633
3633
  },
3634
3634
  [t, n, r, e.autoAppendAssistant]
3635
3635
  );
3636
- return St(() => () => {
3636
+ return Ct(() => () => {
3637
3637
  var _;
3638
3638
  T.current = !1, (_ = b.current) == null || _.abort();
3639
3639
  }, []), {
@@ -3674,7 +3674,7 @@ function Yx({
3674
3674
  onAuthError: a,
3675
3675
  onHeartbeat: l
3676
3676
  }) {
3677
- const c = Je(null), d = Je(null), f = Je(/* @__PURE__ */ new Map()), p = Je(null), h = Ne((I) => {
3677
+ const c = Xe(null), d = Xe(null), f = Xe(/* @__PURE__ */ new Map()), p = Xe(null), h = Ne((I) => {
3678
3678
  try {
3679
3679
  const E = globalThis.structuredClone;
3680
3680
  if (typeof E == "function")
@@ -3872,11 +3872,11 @@ function Xx({
3872
3872
  onAuthError: c,
3873
3873
  onThreadChange: d
3874
3874
  }) {
3875
- const { api: f, baseUrl: p } = Tu(), h = at(() => jn(p), [p]), [x, y] = ye([]), [m, g] = ye(t), [w, b] = ye(!1), [T, C] = ye(null), [S, k] = ye(!1), [N, I] = ye(null), { state: E, seed: j, prepend: L, pushUser: F, onEvent: _ } = Bx(), [$, A] = ye(!1), [B, D] = ye(!1), [O, J] = ye(null), [X, de] = ye([]), { setCacheForThread: Ee, checkpointExists: Ae } = Lx(), K = Je(m), ee = Je(null);
3876
- St(() => {
3875
+ const { api: f, baseUrl: p } = Tu(), h = at(() => jn(p), [p]), [x, y] = ye([]), [m, g] = ye(t), [w, b] = ye(!1), [T, C] = ye(null), [S, k] = ye(!1), [N, I] = ye(null), { state: E, seed: j, prepend: L, pushUser: F, onEvent: _ } = Bx(), [$, A] = ye(!1), [B, D] = ye(!1), [O, J] = ye(null), [X, de] = ye([]), { setCacheForThread: Ee, checkpointExists: Ae } = Lx(), K = Xe(m), ee = Xe(null);
3876
+ Ct(() => {
3877
3877
  K.current = m;
3878
3878
  }, [m]);
3879
- const q = Je(), { startStream: M, stop: H, isStreaming: te, error: oe, setAuthToken: ne } = Yx({
3879
+ const q = Xe(), { startStream: M, stop: H, isStreaming: te, error: oe, setAuthToken: ne } = Yx({
3880
3880
  baseUrl: h,
3881
3881
  onThreadInfo: (fe) => {
3882
3882
  console.log("[ChatSessionProvider] Thread info:", fe.threadId), K.current !== fe.threadId && g(fe.threadId);
@@ -3892,18 +3892,18 @@ function Xx({
3892
3892
  const fe = await f.listThreads();
3893
3893
  y(fe ?? []);
3894
3894
  } catch (fe) {
3895
- const ge = String(fe);
3896
- C(ge), l == null || l(ge);
3895
+ const pe = String(fe);
3896
+ C(pe), l == null || l(pe);
3897
3897
  } finally {
3898
3898
  b(!1);
3899
3899
  }
3900
3900
  }, [f, l]), Z = Ne(
3901
3901
  async (fe) => {
3902
3902
  try {
3903
- const ge = await f.createThread(fe);
3904
- return g(ge.threadId), await Te(), ge.threadId;
3905
- } catch (ge) {
3906
- return l == null || l(String(ge)), null;
3903
+ const pe = await f.createThread(fe);
3904
+ return g(pe.threadId), await Te(), pe.threadId;
3905
+ } catch (pe) {
3906
+ return l == null || l(String(pe)), null;
3907
3907
  }
3908
3908
  },
3909
3909
  [f, Te, l]
@@ -3911,39 +3911,39 @@ function Xx({
3911
3911
  async (fe) => {
3912
3912
  try {
3913
3913
  await f.deleteThread(fe), K.current === fe && (g(null), j([], {})), await Te();
3914
- } catch (ge) {
3915
- l == null || l(String(ge));
3914
+ } catch (pe) {
3915
+ l == null || l(String(pe));
3916
3916
  }
3917
3917
  },
3918
3918
  [f, Te, j, l]
3919
3919
  ), Ie = Ne(
3920
- async (fe, ge) => {
3920
+ async (fe, pe) => {
3921
3921
  try {
3922
- await f.updateThread(fe, ge), await Te();
3923
- } catch (he) {
3924
- l == null || l(String(he));
3922
+ await f.updateThread(fe, pe), await Te();
3923
+ } catch (me) {
3924
+ l == null || l(String(me));
3925
3925
  }
3926
3926
  },
3927
3927
  [f, Te, l]
3928
3928
  ), ke = Ne(
3929
- async (fe, ge) => {
3929
+ async (fe, pe) => {
3930
3930
  if (fe) {
3931
3931
  k(!0), I(null);
3932
3932
  try {
3933
- const he = await f.getStateHistory({
3933
+ const me = await f.getStateHistory({
3934
3934
  threadId: fe,
3935
- checkpointId: ge
3936
- }), { latest: je, checkpoints: Xe } = Hr(he), At = Xe.filter((yt) => yt.checkpointId).map((yt) => ({
3937
- checkpointId: yt.checkpointId,
3938
- checkpointNs: yt.checkpointNs ?? void 0,
3939
- createdAt: yt.createdAt ?? ""
3935
+ checkpointId: pe
3936
+ }), { latest: je, checkpoints: gt } = Hr(me), rt = gt.filter((ut) => ut.checkpointId).map((ut) => ({
3937
+ checkpointId: ut.checkpointId,
3938
+ checkpointNs: ut.checkpointNs ?? void 0,
3939
+ createdAt: ut.createdAt ?? ""
3940
3940
  }));
3941
- Ee(fe, At), j((je == null ? void 0 : je.messages) ?? [], {
3941
+ Ee(fe, rt), j((je == null ? void 0 : je.messages) ?? [], {
3942
3942
  checkpointId: (je == null ? void 0 : je.checkpointId) ?? null,
3943
3943
  checkpointNs: (je == null ? void 0 : je.checkpointNs) ?? null
3944
- }), de(Xe), A(!!(je != null && je.nextCursor)), J((je == null ? void 0 : je.nextCursor) ?? null);
3945
- } catch (he) {
3946
- const je = String(he);
3944
+ }), de(gt), A(!!(je != null && je.nextCursor)), J((je == null ? void 0 : je.nextCursor) ?? null);
3945
+ } catch (me) {
3946
+ const je = String(me);
3947
3947
  I(je), l == null || l(je);
3948
3948
  } finally {
3949
3949
  k(!1);
@@ -3952,33 +3952,39 @@ function Xx({
3952
3952
  },
3953
3953
  [f, j, l, Ee]
3954
3954
  );
3955
- St(() => {
3955
+ Ct(() => {
3956
3956
  q.current = ke;
3957
3957
  }, [ke]);
3958
3958
  const $e = Ne(
3959
- async (fe, ge) => {
3960
- const he = K.current;
3961
- if (he)
3959
+ async (fe, pe) => {
3960
+ const me = K.current;
3961
+ if (me)
3962
3962
  try {
3963
3963
  const je = await f.getStateHistory({
3964
- threadId: he,
3964
+ threadId: me,
3965
3965
  checkpointId: fe,
3966
- checkpointNs: ge ?? void 0
3967
- }), { latest: Xe } = Hr(je);
3968
- j((Xe == null ? void 0 : Xe.messages) ?? [], {
3969
- checkpointId: (Xe == null ? void 0 : Xe.checkpointId) ?? null,
3970
- checkpointNs: (Xe == null ? void 0 : Xe.checkpointNs) ?? null
3966
+ checkpointNs: pe ?? void 0
3967
+ }), { checkpoints: gt } = Hr(je), rt = gt.find(
3968
+ (ut) => ut.checkpointId === fe && (pe ? ut.checkpointNs === pe : !0)
3969
+ );
3970
+ if (!rt) {
3971
+ console.warn("[ChatSessionProvider] Requested checkpoint not found in response:", { checkpointId: fe, checkpointNs: pe });
3972
+ return;
3973
+ }
3974
+ j((rt == null ? void 0 : rt.messages) ?? [], {
3975
+ checkpointId: (rt == null ? void 0 : rt.checkpointId) ?? null,
3976
+ checkpointNs: (rt == null ? void 0 : rt.checkpointNs) ?? null
3971
3977
  });
3972
3978
  } catch (je) {
3973
3979
  l == null || l(String(je));
3974
3980
  }
3975
3981
  },
3976
3982
  [f, j, l]
3977
- ), Ze = Ne(
3978
- (fe, ge) => {
3983
+ ), Je = Ne(
3984
+ (fe, pe) => {
3979
3985
  j(E.messages, {
3980
3986
  checkpointId: fe ?? null,
3981
- checkpointNs: ge ?? null
3987
+ checkpointNs: pe ?? null
3982
3988
  });
3983
3989
  },
3984
3990
  [j, E.messages]
@@ -3991,10 +3997,10 @@ function Xx({
3991
3997
  const fe = await f.getStateHistory({
3992
3998
  threadId: K.current,
3993
3999
  checkpointId: O
3994
- }), { checkpoints: ge } = Hr(fe);
3995
- if (ge.length > 0) {
3996
- const he = ge[ge.length - 1];
3997
- L((he == null ? void 0 : he.messages) ?? []), A(!!(he != null && he.nextCursor)), J((he == null ? void 0 : he.nextCursor) ?? null);
4000
+ }), { checkpoints: pe } = Hr(fe);
4001
+ if (pe.length > 0) {
4002
+ const me = pe[pe.length - 1];
4003
+ L((me == null ? void 0 : me.messages) ?? []), A(!!(me != null && me.nextCursor)), J((me == null ? void 0 : me.nextCursor) ?? null);
3998
4004
  }
3999
4005
  } catch (fe) {
4000
4006
  l == null || l(String(fe));
@@ -4004,67 +4010,67 @@ function Xx({
4004
4010
  }
4005
4011
  }, [f, O, L, l]), Ue = Ne(async () => {
4006
4012
  j([], {}), de([]), A(!1), J(null);
4007
- }, [j]), Qe = Ne(
4008
- async (fe, ge) => {
4009
- console.log("[ChatSessionProvider] Interrupt:", fe, ge);
4013
+ }, [j]), Ze = Ne(
4014
+ async (fe, pe) => {
4015
+ console.log("[ChatSessionProvider] Interrupt:", fe, pe);
4010
4016
  },
4011
4017
  []
4012
4018
  );
4013
- St(() => {
4019
+ Ct(() => {
4014
4020
  Te();
4015
4021
  }, [Te]);
4016
- const qe = Je();
4017
- St(() => {
4022
+ const qe = Xe();
4023
+ Ct(() => {
4018
4024
  qe.current = $e;
4019
- }, [$e]), St(() => {
4020
- var At;
4025
+ }, [$e]), Ct(() => {
4026
+ var rt;
4021
4027
  if (!o || !m || S === !0 || ee.current === m)
4022
4028
  return;
4023
4029
  ee.current = m;
4024
- const fe = n, ge = r, he = localStorage.getItem("lastCheckpointId"), je = localStorage.getItem("lastCheckpointNs");
4025
- (At = q.current) == null || At.call(q, m);
4026
- let Xe = { id: fe, ns: ge };
4027
- if (Xe.id || (Xe = { id: he, ns: je }), Xe.id && Ae(m, Xe.id)) {
4028
- const yt = setTimeout(() => {
4029
- var et;
4030
- Ae(m, Xe.id) && ((et = qe.current) == null || et.call(qe, Xe.id, Xe.ns ?? void 0));
4030
+ const fe = n, pe = r, me = localStorage.getItem("lastCheckpointId"), je = localStorage.getItem("lastCheckpointNs");
4031
+ (rt = q.current) == null || rt.call(q, m);
4032
+ let gt = { id: fe, ns: pe };
4033
+ if (gt.id || (gt = { id: me, ns: je }), gt.id && Ae(m, gt.id)) {
4034
+ const ut = setTimeout(() => {
4035
+ var Qe;
4036
+ Ae(m, gt.id) && ((Qe = qe.current) == null || Qe.call(qe, gt.id, gt.ns ?? void 0));
4031
4037
  }, 50);
4032
- return () => clearTimeout(yt);
4038
+ return () => clearTimeout(ut);
4033
4039
  }
4034
- }, [o, m, S, Ae, n, r]), St(() => {
4040
+ }, [o, m, S, Ae, n, r]), Ct(() => {
4035
4041
  d == null || d(m);
4036
- }, [m, d]), St(() => {
4042
+ }, [m, d]), Ct(() => {
4037
4043
  E.lastCheckpointId && (localStorage.setItem("lastCheckpointId", E.lastCheckpointId), E.lastCheckpointNs && localStorage.setItem("lastCheckpointNs", E.lastCheckpointNs));
4038
4044
  }, [E.lastCheckpointId, E.lastCheckpointNs]);
4039
- const nt = Ne(
4040
- async (fe, ge) => {
4041
- const he = K.current, je = (fe == null ? void 0 : fe.text) ?? "";
4042
- if (!he && !je) return;
4043
- if (!he) {
4045
+ const tt = Ne(
4046
+ async (fe, pe) => {
4047
+ const me = K.current, je = (fe == null ? void 0 : fe.text) ?? "";
4048
+ if (!me && !je) return;
4049
+ if (!me) {
4044
4050
  await Z("New Chat");
4045
4051
  return;
4046
4052
  }
4047
- const { contentParts: Xe } = await wx(
4053
+ const { contentParts: gt } = await wx(
4048
4054
  f,
4049
4055
  (fe == null ? void 0 : fe.attachments) ?? []
4050
- ), At = [...Xe];
4051
- je != null && je.trim() && At.push({ type: "text", text: je });
4052
- const yt = {
4056
+ ), rt = [...gt];
4057
+ je != null && je.trim() && rt.push({ type: "text", text: je });
4058
+ const ut = {
4053
4059
  id: `msg-${Date.now()}`,
4054
4060
  role: "user",
4055
- content: At,
4061
+ content: rt,
4056
4062
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
4057
4063
  };
4058
- F(yt);
4059
- const et = {
4060
- threadId: he,
4061
- checkpointId: (ge == null ? void 0 : ge.checkpointId) ?? E.lastCheckpointId ?? void 0,
4062
- checkpointNs: (ge == null ? void 0 : ge.checkpointNs) ?? E.lastCheckpointNs ?? void 0
4064
+ F(ut);
4065
+ const Qe = {
4066
+ threadId: me,
4067
+ checkpointId: (pe == null ? void 0 : pe.checkpointId) ?? E.lastCheckpointId ?? void 0,
4068
+ checkpointNs: (pe == null ? void 0 : pe.checkpointNs) ?? E.lastCheckpointNs ?? void 0
4063
4069
  };
4064
- M(et);
4070
+ M(Qe);
4065
4071
  },
4066
4072
  [f, Z, F, E, M]
4067
- ), Nt = at(
4073
+ ), At = at(
4068
4074
  () => ({
4069
4075
  threads: x,
4070
4076
  currentThreadId: m,
@@ -4079,7 +4085,7 @@ function Xx({
4079
4085
  }
4080
4086
  }),
4081
4087
  [x, m, w, T, Z, ue, Ie, Te]
4082
- ), ht = at(
4088
+ ), mt = at(
4083
4089
  () => ({
4084
4090
  threadId: m,
4085
4091
  messages: E.messages,
@@ -4097,11 +4103,11 @@ function Xx({
4097
4103
  loadOlder: Ke,
4098
4104
  clearState: Ue,
4099
4105
  navigateToCheckpoint: $e,
4100
- setCurrentCheckpointId: Ze,
4106
+ setCurrentCheckpointId: Je,
4101
4107
  returnToLatest: He,
4102
4108
  loadThread: ke,
4103
4109
  clearThread: Ue,
4104
- respondToInterrupt: Qe
4110
+ respondToInterrupt: Ze
4105
4111
  }),
4106
4112
  [
4107
4113
  m,
@@ -4114,24 +4120,24 @@ function Xx({
4114
4120
  Ke,
4115
4121
  Ue,
4116
4122
  $e,
4117
- Ze,
4123
+ Je,
4118
4124
  He,
4119
4125
  ke,
4120
- Qe
4126
+ Ze
4121
4127
  ]
4122
4128
  ), lt = at(
4123
4129
  () => ({
4124
4130
  isStreaming: te,
4125
4131
  error: oe,
4126
4132
  connectionState: te ? "connected" : "idle",
4127
- submit: nt,
4128
- send: nt,
4133
+ submit: tt,
4134
+ send: tt,
4129
4135
  stop: H,
4130
4136
  setAuthToken: ne
4131
4137
  }),
4132
- [te, oe, nt, H, ne]
4138
+ [te, oe, tt, H, ne]
4133
4139
  );
4134
- return /* @__PURE__ */ u.jsx(Au.Provider, { value: Nt, children: /* @__PURE__ */ u.jsx(_u.Provider, { value: ht, children: /* @__PURE__ */ u.jsx(ju.Provider, { value: lt, children: e }) }) });
4140
+ return /* @__PURE__ */ u.jsx(Au.Provider, { value: At, children: /* @__PURE__ */ u.jsx(_u.Provider, { value: mt, children: /* @__PURE__ */ u.jsx(ju.Provider, { value: lt, children: e }) }) });
4135
4141
  }
4136
4142
  function xa() {
4137
4143
  const e = xs(Au);
@@ -6251,8 +6257,8 @@ var Na = "PopperContent", [Fv, $v] = Ju(Na), nd = v.forwardRef(
6251
6257
  jv({
6252
6258
  ...F,
6253
6259
  apply: ({ elements: Te, rects: Z, availableWidth: ue, availableHeight: Ie }) => {
6254
- const { width: ke, height: $e } = Z.reference, Ze = Te.floating.style;
6255
- Ze.setProperty("--radix-popper-available-width", `${ue}px`), Ze.setProperty("--radix-popper-available-height", `${Ie}px`), Ze.setProperty("--radix-popper-anchor-width", `${ke}px`), Ze.setProperty("--radix-popper-anchor-height", `${$e}px`);
6260
+ const { width: ke, height: $e } = Z.reference, Je = Te.floating.style;
6261
+ Je.setProperty("--radix-popper-available-width", `${ue}px`), Je.setProperty("--radix-popper-available-height", `${Ie}px`), Je.setProperty("--radix-popper-anchor-width", `${ke}px`), Je.setProperty("--radix-popper-anchor-height", `${$e}px`);
6256
6262
  }
6257
6263
  }),
6258
6264
  T && Ov({ element: T, padding: a }),
@@ -8075,7 +8081,7 @@ function Bs(e, t) {
8075
8081
  function p0(e, t) {
8076
8082
  return t(e);
8077
8083
  }
8078
- function xt(...e) {
8084
+ function vt(...e) {
8079
8085
  return e;
8080
8086
  }
8081
8087
  function st(e, t) {
@@ -8087,10 +8093,10 @@ function De(e, t) {
8087
8093
  function $a(e) {
8088
8094
  e(Pr);
8089
8095
  }
8090
- function kt(e) {
8096
+ function Rt(e) {
8091
8097
  return e(vf);
8092
8098
  }
8093
- function pe(e, t) {
8099
+ function he(e, t) {
8094
8100
  return st(e, d0(t, zs));
8095
8101
  }
8096
8102
  function pn(e, t) {
@@ -8110,7 +8116,7 @@ function mc(e) {
8110
8116
  function bf(e, t) {
8111
8117
  return e === t;
8112
8118
  }
8113
- function gt(e = bf) {
8119
+ function yt(e = bf) {
8114
8120
  let t;
8115
8121
  return (n) => (r) => {
8116
8122
  e(t, r) || (t = r, n(r));
@@ -8211,7 +8217,7 @@ function Y(e) {
8211
8217
  };
8212
8218
  }
8213
8219
  function Ht(e, t) {
8214
- return Bs(Y(t), (n) => pe(e, n));
8220
+ return Bs(Y(t), (n) => he(e, n));
8215
8221
  }
8216
8222
  function We() {
8217
8223
  const e = [];
@@ -8234,9 +8240,9 @@ function We() {
8234
8240
  };
8235
8241
  }
8236
8242
  function en(e) {
8237
- return Bs(We(), (t) => pe(e, t));
8243
+ return Bs(We(), (t) => he(e, t));
8238
8244
  }
8239
- function tt(e, t = [], { singleton: n } = { singleton: !0 }) {
8245
+ function et(e, t = [], { singleton: n } = { singleton: !0 }) {
8240
8246
  return {
8241
8247
  constructor: e,
8242
8248
  dependencies: t,
@@ -8254,7 +8260,7 @@ function x0(e) {
8254
8260
  };
8255
8261
  return n(e);
8256
8262
  }
8257
- function It(...e) {
8263
+ function Nt(...e) {
8258
8264
  const t = We(), n = new Array(e.length);
8259
8265
  let r = 0;
8260
8266
  const o = Math.pow(2, e.length) - 1;
@@ -8275,7 +8281,7 @@ function It(...e) {
8275
8281
  };
8276
8282
  }
8277
8283
  function Ce(e, t = bf) {
8278
- return U(e, gt(t));
8284
+ return U(e, yt(t));
8279
8285
  }
8280
8286
  function Yi(...e) {
8281
8287
  return function(t, n) {
@@ -8293,7 +8299,7 @@ const y0 = {
8293
8299
  3: "error",
8294
8300
  1: "log",
8295
8301
  2: "warn"
8296
- }, v0 = () => typeof globalThis > "u" ? window : globalThis, qn = tt(
8302
+ }, v0 = () => typeof globalThis > "u" ? window : globalThis, qn = et(
8297
8303
  () => {
8298
8304
  const e = Y(
8299
8305
  3
@@ -8302,7 +8308,7 @@ const y0 = {
8302
8308
  return {
8303
8309
  log: Y((t, n, r = 1) => {
8304
8310
  var o;
8305
- const s = (o = v0().VIRTUOSO_LOG_LEVEL) != null ? o : kt(e);
8311
+ const s = (o = v0().VIRTUOSO_LOG_LEVEL) != null ? o : Rt(e);
8306
8312
  r >= s && console[y0[r]](
8307
8313
  "%creact-virtuoso: %c%s %o",
8308
8314
  "color: #0253b3; font-weight: bold",
@@ -8421,22 +8427,22 @@ function Sf(e, t, n) {
8421
8427
  }
8422
8428
  }, [a, t, i]), s;
8423
8429
  }
8424
- const Wt = tt(
8430
+ const Wt = et(
8425
8431
  () => {
8426
8432
  const e = We(), t = We(), n = Y(0), r = We(), o = Y(0), s = We(), i = We(), a = Y(0), l = Y(0), c = Y(0), d = Y(0), f = We(), p = We(), h = Y(!1), x = Y(!1), y = Y(!1);
8427
- return pe(
8433
+ return he(
8428
8434
  U(
8429
8435
  e,
8430
8436
  ae(({ scrollTop: m }) => m)
8431
8437
  ),
8432
8438
  t
8433
- ), pe(
8439
+ ), he(
8434
8440
  U(
8435
8441
  e,
8436
8442
  ae(({ scrollHeight: m }) => m)
8437
8443
  ),
8438
8444
  i
8439
- ), pe(t, o), {
8445
+ ), he(t, o), {
8440
8446
  deviation: n,
8441
8447
  fixedFooterHeight: c,
8442
8448
  fixedHeaderHeight: l,
@@ -8473,15 +8479,15 @@ function Cf(e, t) {
8473
8479
  }
8474
8480
  return s.push({ end: 1 / 0, start: r, value: o }), s;
8475
8481
  }
8476
- function dt(e) {
8482
+ function ft(e) {
8477
8483
  return e === to;
8478
8484
  }
8479
8485
  function no(e, t) {
8480
- if (!dt(e))
8486
+ if (!ft(e))
8481
8487
  return t === e.k ? e.v : t < e.k ? no(e.l, t) : no(e.r, t);
8482
8488
  }
8483
8489
  function gn(e, t, n = "k") {
8484
- if (dt(e))
8490
+ if (ft(e))
8485
8491
  return [-1 / 0, void 0];
8486
8492
  if (Number(e[n]) === t)
8487
8493
  return [e.k, e.v];
@@ -8492,24 +8498,24 @@ function gn(e, t, n = "k") {
8492
8498
  return gn(e.l, t, n);
8493
8499
  }
8494
8500
  function Zt(e, t, n) {
8495
- return dt(e) ? Rf(t, n, 1) : t === e.k ? jt(e, { k: t, v: n }) : t < e.k ? xc(jt(e, { l: Zt(e.l, t, n) })) : xc(jt(e, { r: Zt(e.r, t, n) }));
8501
+ return ft(e) ? Rf(t, n, 1) : t === e.k ? jt(e, { k: t, v: n }) : t < e.k ? xc(jt(e, { l: Zt(e.l, t, n) })) : xc(jt(e, { r: Zt(e.r, t, n) }));
8496
8502
  }
8497
8503
  function Sr() {
8498
8504
  return to;
8499
8505
  }
8500
8506
  function Hs(e, t, n) {
8501
- if (dt(e))
8507
+ if (ft(e))
8502
8508
  return [];
8503
8509
  const r = gn(e, t)[0];
8504
8510
  return S0(Ji(e, r, n));
8505
8511
  }
8506
8512
  function Xi(e, t) {
8507
- if (dt(e)) return to;
8513
+ if (ft(e)) return to;
8508
8514
  const { k: n, l: r, r: o } = e;
8509
8515
  if (t === n) {
8510
- if (dt(r))
8516
+ if (ft(r))
8511
8517
  return o;
8512
- if (dt(o))
8518
+ if (ft(o))
8513
8519
  return r;
8514
8520
  {
8515
8521
  const [s, i] = kf(r);
@@ -8518,10 +8524,10 @@ function Xi(e, t) {
8518
8524
  } else return t < n ? Vo(jt(e, { l: Xi(r, t) })) : Vo(jt(e, { r: Xi(o, t) }));
8519
8525
  }
8520
8526
  function tr(e) {
8521
- return dt(e) ? [] : [...tr(e.l), { k: e.k, v: e.v }, ...tr(e.r)];
8527
+ return ft(e) ? [] : [...tr(e.l), { k: e.k, v: e.v }, ...tr(e.r)];
8522
8528
  }
8523
8529
  function Ji(e, t, n) {
8524
- if (dt(e))
8530
+ if (ft(e))
8525
8531
  return [];
8526
8532
  const { k: r, l: o, r: s, v: i } = e;
8527
8533
  let a = [];
@@ -8534,7 +8540,7 @@ function Vo(e) {
8534
8540
  if (n > r.lvl + 1) {
8535
8541
  if (Ci(t))
8536
8542
  return Ef(jt(e, { lvl: n - 1 }));
8537
- if (!dt(t) && !dt(t.r))
8543
+ if (!ft(t) && !ft(t.r))
8538
8544
  return jt(t.r, {
8539
8545
  l: jt(t, { r: t.r.l }),
8540
8546
  lvl: n,
@@ -8547,7 +8553,7 @@ function Vo(e) {
8547
8553
  } else {
8548
8554
  if (Ci(e))
8549
8555
  return Zi(jt(e, { lvl: n - 1 }));
8550
- if (!dt(r) && !dt(r.l)) {
8556
+ if (!ft(r) && !ft(r.l)) {
8551
8557
  const o = r.l, s = Ci(o) ? r.lvl - 1 : r.lvl;
8552
8558
  return jt(o, {
8553
8559
  l: jt(e, {
@@ -8571,13 +8577,13 @@ function jt(e, t) {
8571
8577
  );
8572
8578
  }
8573
8579
  function Tf(e) {
8574
- return dt(e.r) ? e.l : Vo(jt(e, { r: Tf(e.r) }));
8580
+ return ft(e.r) ? e.l : Vo(jt(e, { r: Tf(e.r) }));
8575
8581
  }
8576
8582
  function Ci(e) {
8577
- return dt(e) || e.lvl > e.r.lvl;
8583
+ return ft(e) || e.lvl > e.r.lvl;
8578
8584
  }
8579
8585
  function kf(e) {
8580
- return dt(e.r) ? [e.k, e.v] : kf(e.r);
8586
+ return ft(e.r) ? [e.k, e.v] : kf(e.r);
8581
8587
  }
8582
8588
  function Rf(e, t, n, r = to, o = to) {
8583
8589
  return { k: e, l: r, lvl: n, r: o, v: t };
@@ -8587,11 +8593,11 @@ function xc(e) {
8587
8593
  }
8588
8594
  function Ef(e) {
8589
8595
  const { l: t } = e;
8590
- return !dt(t) && t.lvl === e.lvl ? jt(t, { r: jt(e, { l: t.r }) }) : e;
8596
+ return !ft(t) && t.lvl === e.lvl ? jt(t, { r: jt(e, { l: t.r }) }) : e;
8591
8597
  }
8592
8598
  function Zi(e) {
8593
8599
  const { lvl: t, r: n } = e;
8594
- return !dt(n) && !dt(n.r) && n.lvl === t && n.r.lvl === t ? jt(n, { l: jt(e, { r: n.l }), lvl: t + 1 }) : e;
8600
+ return !ft(n) && !ft(n.r) && n.lvl === t && n.r.lvl === t ? jt(n, { l: jt(e, { r: n.l }), lvl: t + 1 }) : e;
8595
8601
  }
8596
8602
  function S0(e) {
8597
8603
  return Cf(e, ({ k: t, v: n }) => ({ index: t, value: n }));
@@ -8602,7 +8608,7 @@ function If(e, t) {
8602
8608
  function ro(e, t) {
8603
8609
  return !!(e && e[0] === t[0] && e[1] === t[1]);
8604
8610
  }
8605
- const Ba = tt(
8611
+ const Ba = et(
8606
8612
  () => ({ recalcInProgress: Y(!1) }),
8607
8613
  [],
8608
8614
  { singleton: !0 }
@@ -8636,7 +8642,7 @@ function Un(e, t) {
8636
8642
  return Math.round(e.getBoundingClientRect()[t]);
8637
8643
  }
8638
8644
  function Us(e) {
8639
- return !dt(e.groupOffsetTree);
8645
+ return !ft(e.groupOffsetTree);
8640
8646
  }
8641
8647
  function Ha({ index: e }, t) {
8642
8648
  return t === e ? 0 : t < e ? -1 : 1;
@@ -8653,10 +8659,10 @@ function T0() {
8653
8659
  };
8654
8660
  }
8655
8661
  function k0(e, t) {
8656
- let n = dt(e) ? 0 : 1 / 0;
8662
+ let n = ft(e) ? 0 : 1 / 0;
8657
8663
  for (const r of t) {
8658
8664
  const { endIndex: o, size: s, startIndex: i } = r;
8659
- if (n = Math.min(n, i), dt(e)) {
8665
+ if (n = Math.min(n, i), ft(e)) {
8660
8666
  e = Zt(e, 0, s);
8661
8667
  continue;
8662
8668
  }
@@ -8706,7 +8712,7 @@ function N0(e, [t, n, r, o]) {
8706
8712
  t.length > 0 && r("received item sizes", t, Xt.DEBUG);
8707
8713
  const s = e.sizeTree;
8708
8714
  let i = s, a = 0;
8709
- if (n.length > 0 && dt(s) && t.length === 2) {
8715
+ if (n.length > 0 && ft(s) && t.length === 2) {
8710
8716
  const p = t[0].size, h = t[1].size;
8711
8717
  i = n.reduce((x, y) => Zt(Zt(x, y, p), y + 1, h), i);
8712
8718
  } else
@@ -8769,15 +8775,15 @@ function j0(e) {
8769
8775
  const P0 = {
8770
8776
  offsetHeight: "height",
8771
8777
  offsetWidth: "width"
8772
- }, En = tt(
8778
+ }, En = et(
8773
8779
  ([{ log: e }, { recalcInProgress: t }]) => {
8774
8780
  const n = We(), r = We(), o = Ht(r, 0), s = We(), i = We(), a = Y(0), l = Y([]), c = Y(void 0), d = Y(void 0), f = Y((C, S) => Un(C, P0[S])), p = Y(void 0), h = Y(0), x = T0(), y = Ht(
8775
- U(n, Le(l, e, h), Cn(N0, x), gt()),
8781
+ U(n, Le(l, e, h), Cn(N0, x), yt()),
8776
8782
  x
8777
8783
  ), m = Ht(
8778
8784
  U(
8779
8785
  l,
8780
- gt(),
8786
+ yt(),
8781
8787
  Cn((C, S) => ({ current: S, prev: C.current }), {
8782
8788
  current: [],
8783
8789
  prev: []
@@ -8786,7 +8792,7 @@ const P0 = {
8786
8792
  ),
8787
8793
  []
8788
8794
  );
8789
- pe(
8795
+ he(
8790
8796
  U(
8791
8797
  l,
8792
8798
  Re((C) => C.length > 0),
@@ -8801,7 +8807,7 @@ const P0 = {
8801
8807
  })
8802
8808
  ),
8803
8809
  y
8804
- ), pe(
8810
+ ), he(
8805
8811
  U(
8806
8812
  r,
8807
8813
  Le(y),
@@ -8815,7 +8821,7 @@ const P0 = {
8815
8821
  ])
8816
8822
  ),
8817
8823
  n
8818
- ), pe(c, d);
8824
+ ), he(c, d);
8819
8825
  const g = Ht(
8820
8826
  U(
8821
8827
  c,
@@ -8823,10 +8829,10 @@ const P0 = {
8823
8829
  ),
8824
8830
  !0
8825
8831
  );
8826
- pe(
8832
+ he(
8827
8833
  U(
8828
8834
  d,
8829
- Re((C) => C !== void 0 && dt(kt(y).sizeTree)),
8835
+ Re((C) => C !== void 0 && ft(Rt(y).sizeTree)),
8830
8836
  ae((C) => [{ endIndex: 0, size: C, startIndex: 0 }])
8831
8837
  ),
8832
8838
  n
@@ -8855,11 +8861,11 @@ const P0 = {
8855
8861
  ae((C) => C.diff)
8856
8862
  ),
8857
8863
  (C) => {
8858
- const { groupIndices: S } = kt(y);
8864
+ const { groupIndices: S } = Rt(y);
8859
8865
  if (C > 0)
8860
8866
  De(t, !0), De(s, C + yc(C, S));
8861
8867
  else if (C < 0) {
8862
- const k = kt(m);
8868
+ const k = Rt(m);
8863
8869
  k.length > 0 && (C -= yc(-C, k)), De(i, C);
8864
8870
  }
8865
8871
  }
@@ -8871,7 +8877,7 @@ const P0 = {
8871
8877
  );
8872
8878
  });
8873
8879
  const b = en(s);
8874
- pe(
8880
+ he(
8875
8881
  U(
8876
8882
  s,
8877
8883
  Le(y),
@@ -8942,16 +8948,16 @@ const P0 = {
8942
8948
  })
8943
8949
  )
8944
8950
  );
8945
- return pe(
8951
+ return he(
8946
8952
  U(
8947
8953
  i,
8948
8954
  Le(y, h),
8949
8955
  ae(([C, S, k]) => {
8950
8956
  if (S.groupIndices.length > 0) {
8951
- if (dt(S.sizeTree))
8957
+ if (ft(S.sizeTree))
8952
8958
  return S;
8953
8959
  let N = Sr();
8954
- const I = kt(m);
8960
+ const I = Rt(m);
8955
8961
  let E = 0, j = 0, L = 0;
8956
8962
  for (; E < -C; ) {
8957
8963
  L = I[j];
@@ -9002,7 +9008,7 @@ const P0 = {
9002
9008
  unshiftWith: s
9003
9009
  };
9004
9010
  },
9005
- xt(qn, Ba),
9011
+ vt(qn, Ba),
9006
9012
  { singleton: !0 }
9007
9013
  );
9008
9014
  function O0(e) {
@@ -9014,54 +9020,54 @@ function O0(e) {
9014
9020
  }
9015
9021
  );
9016
9022
  }
9017
- const jf = tt(
9023
+ const jf = et(
9018
9024
  ([{ groupIndices: e, sizes: t, totalCount: n }, { headerHeight: r, scrollTop: o }]) => {
9019
9025
  const s = We(), i = We(), a = en(U(s, ae(O0)));
9020
- return pe(
9026
+ return he(
9021
9027
  U(
9022
9028
  a,
9023
9029
  ae((l) => l.totalCount)
9024
9030
  ),
9025
9031
  n
9026
- ), pe(
9032
+ ), he(
9027
9033
  U(
9028
9034
  a,
9029
9035
  ae((l) => l.groupIndices)
9030
9036
  ),
9031
9037
  e
9032
- ), pe(
9038
+ ), he(
9033
9039
  U(
9034
- It(o, t, r),
9040
+ Nt(o, t, r),
9035
9041
  Re(([l, c]) => Us(c)),
9036
9042
  ae(([l, c, d]) => gn(c.groupOffsetTree, Math.max(l - d, 0), "v")[0]),
9037
- gt(),
9043
+ yt(),
9038
9044
  ae((l) => [l])
9039
9045
  ),
9040
9046
  i
9041
9047
  ), { groupCounts: s, topItemsIndexes: i };
9042
9048
  },
9043
- xt(En, Wt)
9044
- ), Gn = tt(
9049
+ vt(En, Wt)
9050
+ ), Gn = et(
9045
9051
  ([{ log: e }]) => {
9046
9052
  const t = Y(!1), n = en(
9047
9053
  U(
9048
9054
  t,
9049
9055
  Re((r) => r),
9050
- gt()
9056
+ yt()
9051
9057
  )
9052
9058
  );
9053
9059
  return st(t, (r) => {
9054
- r && kt(e)("props updated", {}, Xt.DEBUG);
9060
+ r && Rt(e)("props updated", {}, Xt.DEBUG);
9055
9061
  }), { didMount: n, propsReady: t };
9056
9062
  },
9057
- xt(qn),
9063
+ vt(qn),
9058
9064
  { singleton: !0 }
9059
9065
  ), M0 = typeof document < "u" && "scrollBehavior" in document.documentElement.style;
9060
9066
  function Pf(e) {
9061
9067
  const t = typeof e == "number" ? { index: e } : e;
9062
9068
  return t.align || (t.align = "start"), (!t.behavior || !M0) && (t.behavior = "auto"), t.offset || (t.offset = 0), t;
9063
9069
  }
9064
- const yo = tt(
9070
+ const yo = et(
9065
9071
  ([
9066
9072
  { gap: e, listRefresh: t, sizes: n, totalCount: r },
9067
9073
  {
@@ -9081,7 +9087,7 @@ const yo = tt(
9081
9087
  function b() {
9082
9088
  m && (m(), m = null), w && (w(), w = null), g && (clearTimeout(g), g = null), De(l, !1);
9083
9089
  }
9084
- return pe(
9090
+ return he(
9085
9091
  U(
9086
9092
  h,
9087
9093
  Le(n, f, r, y, a, i, p),
@@ -9121,7 +9127,7 @@ const yo = tt(
9121
9127
  topListHeight: y
9122
9128
  };
9123
9129
  },
9124
- xt(En, Wt, qn),
9130
+ vt(En, Wt, qn),
9125
9131
  { singleton: !0 }
9126
9132
  );
9127
9133
  function D0(e) {
@@ -9143,10 +9149,10 @@ function Wa(e, t) {
9143
9149
  const n = t - 1;
9144
9150
  return typeof e == "number" ? e : e.index === "LAST" ? n : e.index;
9145
9151
  }
9146
- const vo = tt(
9152
+ const vo = et(
9147
9153
  ([{ defaultItemSize: e, listRefresh: t, sizes: n }, { scrollTop: r }, { scrollTargetReached: o, scrollToIndex: s }, { didMount: i }]) => {
9148
9154
  const a = Y(!0), l = Y(0), c = Y(!0);
9149
- return pe(
9155
+ return he(
9150
9156
  U(
9151
9157
  i,
9152
9158
  Le(l),
@@ -9154,7 +9160,7 @@ const vo = tt(
9154
9160
  wn(!1)
9155
9161
  ),
9156
9162
  a
9157
- ), pe(
9163
+ ), he(
9158
9164
  U(
9159
9165
  i,
9160
9166
  Le(l),
@@ -9164,9 +9170,9 @@ const vo = tt(
9164
9170
  c
9165
9171
  ), st(
9166
9172
  U(
9167
- It(t, i),
9173
+ Nt(t, i),
9168
9174
  Le(a, n, e, c),
9169
- Re(([[, d], f, { sizeTree: p }, h, x]) => d && (!dt(p) || Fa(h)) && !f && !x),
9175
+ Re(([[, d], f, { sizeTree: p }, h, x]) => d && (!ft(p) || Fa(h)) && !f && !x),
9170
9176
  Le(l)
9171
9177
  ),
9172
9178
  ([, d]) => {
@@ -9184,7 +9190,7 @@ const vo = tt(
9184
9190
  scrolledToInitialItem: a
9185
9191
  };
9186
9192
  },
9187
- xt(En, Wt, yo, Gn),
9193
+ vt(En, Wt, yo, Gn),
9188
9194
  { singleton: !0 }
9189
9195
  );
9190
9196
  function Of(e, t) {
@@ -9199,28 +9205,28 @@ const so = "up", Wr = "down", L0 = "none", F0 = {
9199
9205
  scrollTop: 0,
9200
9206
  viewportHeight: 0
9201
9207
  }
9202
- }, $0 = 0, wo = tt(([{ footerHeight: e, headerHeight: t, scrollBy: n, scrollContainerState: r, scrollTop: o, viewportHeight: s }]) => {
9208
+ }, $0 = 0, wo = et(([{ footerHeight: e, headerHeight: t, scrollBy: n, scrollContainerState: r, scrollTop: o, viewportHeight: s }]) => {
9203
9209
  const i = Y(!1), a = Y(!0), l = We(), c = We(), d = Y(4), f = Y($0), p = Ht(
9204
9210
  U(
9205
9211
  Yi(U(Ce(o), ar(1), wn(!0)), U(Ce(o), ar(1), wn(!1), mc(100))),
9206
- gt()
9212
+ yt()
9207
9213
  ),
9208
9214
  !1
9209
9215
  ), h = Ht(
9210
- U(Yi(U(n, wn(!0)), U(n, wn(!1), mc(200))), gt()),
9216
+ U(Yi(U(n, wn(!0)), U(n, wn(!1), mc(200))), yt()),
9211
9217
  !1
9212
9218
  );
9213
- pe(
9219
+ he(
9214
9220
  U(
9215
- It(Ce(o), Ce(f)),
9221
+ Nt(Ce(o), Ce(f)),
9216
9222
  ae(([w, b]) => w <= b),
9217
- gt()
9223
+ yt()
9218
9224
  ),
9219
9225
  a
9220
- ), pe(U(a, An(50)), c);
9226
+ ), he(U(a, An(50)), c);
9221
9227
  const x = en(
9222
9228
  U(
9223
- It(r, Ce(s), Ce(t), Ce(e), Ce(d)),
9229
+ Nt(r, Ce(s), Ce(t), Ce(e), Ce(d)),
9224
9230
  Cn((w, [{ scrollHeight: b, scrollTop: T }, C, S, k, N]) => {
9225
9231
  const I = T + C - b > -N, E = {
9226
9232
  scrollHeight: b,
@@ -9243,7 +9249,7 @@ const so = "up", Wr = "down", L0 = "none", F0 = {
9243
9249
  state: E
9244
9250
  };
9245
9251
  }, F0),
9246
- gt((w, b) => w && w.atBottom === b.atBottom)
9252
+ yt((w, b) => w && w.atBottom === b.atBottom)
9247
9253
  )
9248
9254
  ), y = Ht(
9249
9255
  U(
@@ -9279,36 +9285,36 @@ const so = "up", Wr = "down", L0 = "none", F0 = {
9279
9285
  ),
9280
9286
  0
9281
9287
  );
9282
- pe(
9288
+ he(
9283
9289
  U(
9284
9290
  x,
9285
9291
  ae((w) => w.atBottom)
9286
9292
  ),
9287
9293
  i
9288
- ), pe(U(i, An(50)), l);
9294
+ ), he(U(i, An(50)), l);
9289
9295
  const m = Y(Wr);
9290
- pe(
9296
+ he(
9291
9297
  U(
9292
9298
  r,
9293
9299
  ae(({ scrollTop: w }) => w),
9294
- gt(),
9300
+ yt(),
9295
9301
  Cn(
9296
- (w, b) => kt(h) ? { direction: w.direction, prevScrollTop: b } : { direction: b < w.prevScrollTop ? so : Wr, prevScrollTop: b },
9302
+ (w, b) => Rt(h) ? { direction: w.direction, prevScrollTop: b } : { direction: b < w.prevScrollTop ? so : Wr, prevScrollTop: b },
9297
9303
  { direction: Wr, prevScrollTop: 0 }
9298
9304
  ),
9299
9305
  ae((w) => w.direction)
9300
9306
  ),
9301
9307
  m
9302
- ), pe(U(r, An(50), wn(L0)), m);
9308
+ ), he(U(r, An(50), wn(L0)), m);
9303
9309
  const g = Y(0);
9304
- return pe(
9310
+ return he(
9305
9311
  U(
9306
9312
  p,
9307
9313
  Re((w) => !w),
9308
9314
  wn(0)
9309
9315
  ),
9310
9316
  g
9311
- ), pe(
9317
+ ), he(
9312
9318
  U(
9313
9319
  o,
9314
9320
  An(100),
@@ -9331,7 +9337,7 @@ const so = "up", Wr = "down", L0 = "none", F0 = {
9331
9337
  scrollDirection: m,
9332
9338
  scrollVelocity: g
9333
9339
  };
9334
- }, xt(Wt)), ss = "top", is = "bottom", vc = "none";
9340
+ }, vt(Wt)), ss = "top", is = "bottom", vc = "none";
9335
9341
  function wc(e, t, n) {
9336
9342
  return typeof e == "number" ? n === so && t === ss || n === Wr && t === is ? e : 0 : n === so ? t === ss ? e.main : e.reverse : t === is ? e.main : e.reverse;
9337
9343
  }
@@ -9339,11 +9345,11 @@ function bc(e, t) {
9339
9345
  var n;
9340
9346
  return typeof e == "number" ? e : (n = e[t]) != null ? n : 0;
9341
9347
  }
9342
- const Va = tt(
9348
+ const Va = et(
9343
9349
  ([{ deviation: e, fixedHeaderHeight: t, headerHeight: n, scrollTop: r, viewportHeight: o }]) => {
9344
9350
  const s = We(), i = Y(0), a = Y(0), l = Y(0), c = Ht(
9345
9351
  U(
9346
- It(
9352
+ Nt(
9347
9353
  Ce(r),
9348
9354
  Ce(o),
9349
9355
  Ce(n),
@@ -9376,7 +9382,7 @@ const Va = tt(
9376
9382
  }
9377
9383
  ),
9378
9384
  Re((d) => d != null),
9379
- gt(ro)
9385
+ yt(ro)
9380
9386
  ),
9381
9387
  [0, 0]
9382
9388
  );
@@ -9390,7 +9396,7 @@ const Va = tt(
9390
9396
  visibleRange: c
9391
9397
  };
9392
9398
  },
9393
- xt(Wt),
9399
+ vt(Wt),
9394
9400
  { singleton: !0 }
9395
9401
  );
9396
9402
  function z0(e, t, n) {
@@ -9477,7 +9483,7 @@ function Sc(e, t, n) {
9477
9483
  }
9478
9484
  return s;
9479
9485
  }
9480
- const hr = tt(
9486
+ const hr = et(
9481
9487
  ([
9482
9488
  { data: e, firstItemIndex: t, gap: n, sizes: r, totalCount: o },
9483
9489
  s,
@@ -9489,10 +9495,10 @@ const hr = tt(
9489
9495
  { recalcInProgress: x }
9490
9496
  ]) => {
9491
9497
  const y = Y([]), m = Y(0), g = We();
9492
- pe(s.topItemsIndexes, y);
9498
+ he(s.topItemsIndexes, y);
9493
9499
  const w = Ht(
9494
9500
  U(
9495
- It(
9501
+ Nt(
9496
9502
  h,
9497
9503
  x,
9498
9504
  Ce(l, ro),
@@ -9523,12 +9529,12 @@ const hr = tt(
9523
9529
  _,
9524
9530
  $
9525
9531
  ]) => {
9526
- const A = I, { offsetTree: B, sizeTree: D } = A, O = kt(m);
9532
+ const A = I, { offsetTree: B, sizeTree: D } = A, O = Rt(m);
9527
9533
  if (N === 0)
9528
9534
  return { ...Ti, totalCount: N };
9529
9535
  if (S === 0 && k === 0)
9530
9536
  return O === 0 ? { ...Ti, totalCount: N } : Mf(O, E, I, F, _, $ || []);
9531
- if (dt(D))
9537
+ if (ft(D))
9532
9538
  return O > 0 ? null : Ko(
9533
9539
  z0(Wa(E, N), A, $),
9534
9540
  [],
@@ -9573,30 +9579,30 @@ const hr = tt(
9573
9579
  ),
9574
9580
  //@ts-expect-error filter needs to be fixed
9575
9581
  Re((S) => S !== null),
9576
- gt()
9582
+ yt()
9577
9583
  ),
9578
9584
  Ti
9579
9585
  );
9580
- pe(
9586
+ he(
9581
9587
  U(
9582
9588
  e,
9583
9589
  Re(Fa),
9584
9590
  ae((S) => S == null ? void 0 : S.length)
9585
9591
  ),
9586
9592
  o
9587
- ), pe(
9593
+ ), he(
9588
9594
  U(
9589
9595
  w,
9590
9596
  ae((S) => S.topListHeight)
9591
9597
  ),
9592
9598
  f
9593
- ), pe(f, a), pe(
9599
+ ), he(f, a), he(
9594
9600
  U(
9595
9601
  w,
9596
9602
  ae((S) => [S.top, S.bottom])
9597
9603
  ),
9598
9604
  i
9599
- ), pe(
9605
+ ), he(
9600
9606
  U(
9601
9607
  w,
9602
9608
  ae((S) => S.items)
@@ -9610,7 +9616,7 @@ const hr = tt(
9610
9616
  Le(o, e),
9611
9617
  Re(([{ items: S }, k]) => S[S.length - 1].originalIndex === k - 1),
9612
9618
  ae(([, S, k]) => [S - 1, k]),
9613
- gt(ro),
9619
+ yt(ro),
9614
9620
  ae(([S]) => S)
9615
9621
  )
9616
9622
  ), T = en(
@@ -9619,7 +9625,7 @@ const hr = tt(
9619
9625
  An(200),
9620
9626
  Re(({ items: S, topItems: k }) => S.length > 0 && S[0].originalIndex === k.length),
9621
9627
  ae(({ items: S }) => S[0].index),
9622
- gt()
9628
+ yt()
9623
9629
  )
9624
9630
  ), C = en(
9625
9631
  U(
@@ -9636,12 +9642,12 @@ const hr = tt(
9636
9642
  startIndex: S[k].index
9637
9643
  };
9638
9644
  }),
9639
- gt(If)
9645
+ yt(If)
9640
9646
  )
9641
9647
  );
9642
9648
  return { endReached: b, initialItemCount: m, itemsRendered: g, listState: w, rangeChanged: C, startReached: T, topItemsIndexes: y, ...p };
9643
9649
  },
9644
- xt(
9650
+ vt(
9645
9651
  En,
9646
9652
  jf,
9647
9653
  Va,
@@ -9652,36 +9658,36 @@ const hr = tt(
9652
9658
  Ba
9653
9659
  ),
9654
9660
  { singleton: !0 }
9655
- ), Df = tt(
9661
+ ), Df = et(
9656
9662
  ([{ fixedFooterHeight: e, fixedHeaderHeight: t, footerHeight: n, headerHeight: r }, { listState: o }]) => {
9657
9663
  const s = We(), i = Ht(
9658
9664
  U(
9659
- It(n, e, r, t, o),
9665
+ Nt(n, e, r, t, o),
9660
9666
  ae(([a, l, c, d, f]) => a + l + c + d + f.offsetBottom + f.bottom)
9661
9667
  ),
9662
9668
  0
9663
9669
  );
9664
- return pe(Ce(i), s), { totalListHeight: i, totalListHeightChanged: s };
9670
+ return he(Ce(i), s), { totalListHeight: i, totalListHeightChanged: s };
9665
9671
  },
9666
- xt(Wt, hr),
9672
+ vt(Wt, hr),
9667
9673
  { singleton: !0 }
9668
- ), B0 = tt(
9674
+ ), B0 = et(
9669
9675
  ([{ viewportHeight: e }, { totalListHeight: t }]) => {
9670
9676
  const n = Y(!1), r = Ht(
9671
9677
  U(
9672
- It(n, e, t),
9678
+ Nt(n, e, t),
9673
9679
  Re(([o]) => o),
9674
9680
  ae(([, o, s]) => Math.max(0, o - s)),
9675
9681
  An(0),
9676
- gt()
9682
+ yt()
9677
9683
  ),
9678
9684
  0
9679
9685
  );
9680
9686
  return { alignToBottom: n, paddingTopAddition: r };
9681
9687
  },
9682
- xt(Wt, Df),
9688
+ vt(Wt, Df),
9683
9689
  { singleton: !0 }
9684
- ), Lf = tt(() => ({
9690
+ ), Lf = et(() => ({
9685
9691
  context: Y(null)
9686
9692
  })), H0 = ({
9687
9693
  itemBottom: e,
@@ -9689,14 +9695,14 @@ const hr = tt(
9689
9695
  locationParams: { align: n, behavior: r, ...o },
9690
9696
  viewportBottom: s,
9691
9697
  viewportTop: i
9692
- }) => t < i ? { ...o, align: n ?? "start", behavior: r } : e > s ? { ...o, align: n ?? "end", behavior: r } : null, Ff = tt(
9698
+ }) => t < i ? { ...o, align: n ?? "start", behavior: r } : e > s ? { ...o, align: n ?? "end", behavior: r } : null, Ff = et(
9693
9699
  ([
9694
9700
  { gap: e, sizes: t, totalCount: n },
9695
9701
  { fixedFooterHeight: r, fixedHeaderHeight: o, headerHeight: s, scrollingInProgress: i, scrollTop: a, viewportHeight: l },
9696
9702
  { scrollToIndex: c }
9697
9703
  ]) => {
9698
9704
  const d = We();
9699
- return pe(
9705
+ return he(
9700
9706
  U(
9701
9707
  d,
9702
9708
  Le(t, l, n, s, o, r, a),
@@ -9715,7 +9721,7 @@ const hr = tt(
9715
9721
  Re(($) => !$),
9716
9722
  // skips the initial publish of false, and the cleanup call.
9717
9723
  // but if scrollingInProgress is true, we skip the initial publish.
9718
- ar(kt(i) ? 1 : 2)
9724
+ ar(Rt(i) ? 1 : 2)
9719
9725
  ),
9720
9726
  k
9721
9727
  ) : k && k(), _;
@@ -9727,13 +9733,13 @@ const hr = tt(
9727
9733
  scrollIntoView: d
9728
9734
  };
9729
9735
  },
9730
- xt(En, Wt, yo, hr, qn),
9736
+ vt(En, Wt, yo, hr, qn),
9731
9737
  { singleton: !0 }
9732
9738
  );
9733
9739
  function Cc(e) {
9734
9740
  return e ? e === "smooth" ? "smooth" : "auto" : !1;
9735
9741
  }
9736
- const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = tt(
9742
+ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = et(
9737
9743
  ([
9738
9744
  { listRefresh: e, totalCount: t, fixedItemSize: n, data: r },
9739
9745
  { atBottomState: o, isAtBottom: s },
@@ -9756,7 +9762,7 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = tt(
9756
9762
  }
9757
9763
  st(
9758
9764
  U(
9759
- It(U(Ce(t), ar(1)), l),
9765
+ Nt(U(Ce(t), ar(1)), l),
9760
9766
  Le(Ce(x), s, a, f),
9761
9767
  ae(([[C, S], k, N, I, E]) => {
9762
9768
  let j = S && I, L = "auto";
@@ -9765,22 +9771,22 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = tt(
9765
9771
  Re(({ shouldFollow: C }) => C)
9766
9772
  ),
9767
9773
  ({ followOutputBehavior: C, totalCount: S }) => {
9768
- m && (m(), m = null), kt(n) ? requestAnimationFrame(() => {
9769
- kt(d)("following output to ", { totalCount: S }, Xt.DEBUG), g(C);
9774
+ m && (m(), m = null), Rt(n) ? requestAnimationFrame(() => {
9775
+ Rt(d)("following output to ", { totalCount: S }, Xt.DEBUG), g(C);
9770
9776
  }) : m = pn(e, () => {
9771
- kt(d)("following output to ", { totalCount: S }, Xt.DEBUG), g(C), m = null;
9777
+ Rt(d)("following output to ", { totalCount: S }, Xt.DEBUG), g(C), m = null;
9772
9778
  });
9773
9779
  }
9774
9780
  );
9775
9781
  function w(C) {
9776
9782
  const S = pn(o, (k) => {
9777
- C && !k.atBottom && k.notAtBottomBecause === "SIZE_INCREASED" && !m && (kt(d)("scrolling to bottom due to increased size", {}, Xt.DEBUG), g("auto"));
9783
+ C && !k.atBottom && k.notAtBottomBecause === "SIZE_INCREASED" && !m && (Rt(d)("scrolling to bottom due to increased size", {}, Xt.DEBUG), g("auto"));
9778
9784
  });
9779
9785
  setTimeout(S, 100);
9780
9786
  }
9781
9787
  st(
9782
9788
  U(
9783
- It(Ce(x), t, c),
9789
+ Nt(Ce(x), t, c),
9784
9790
  Re(([C, , S]) => C && S),
9785
9791
  Cn(
9786
9792
  ({ value: C }, [, S]) => ({ refreshed: C === S, value: S }),
@@ -9790,15 +9796,15 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = tt(
9790
9796
  Le(x, t)
9791
9797
  ),
9792
9798
  ([, C]) => {
9793
- kt(a) && w(C !== !1);
9799
+ Rt(a) && w(C !== !1);
9794
9800
  }
9795
9801
  ), st(y, () => {
9796
- w(kt(x) !== !1);
9797
- }), st(It(Ce(x), o), ([C, S]) => {
9802
+ w(Rt(x) !== !1);
9803
+ }), st(Nt(Ce(x), o), ([C, S]) => {
9798
9804
  C && !S.atBottom && S.notAtBottomBecause === "VIEWPORT_HEIGHT_DECREASING" && g("auto");
9799
9805
  });
9800
9806
  const b = Y(null), T = We();
9801
- return pe(
9807
+ return he(
9802
9808
  Yi(
9803
9809
  U(
9804
9810
  Ce(r),
@@ -9812,22 +9818,22 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = tt(
9812
9818
  T
9813
9819
  ), st(
9814
9820
  U(
9815
- It(U(T, ar(1)), l),
9821
+ Nt(U(T, ar(1)), l),
9816
9822
  Le(Ce(b), a, f, p),
9817
9823
  ae(([[C, S], k, N, I, E]) => S && N && (k == null ? void 0 : k({ context: E, totalCount: C, scrollingInProgress: I }))),
9818
9824
  Re((C) => !!C),
9819
9825
  An(0)
9820
9826
  ),
9821
9827
  (C) => {
9822
- m && (m(), m = null), kt(n) ? requestAnimationFrame(() => {
9823
- kt(d)("scrolling into view", {}), De(h, C);
9828
+ m && (m(), m = null), Rt(n) ? requestAnimationFrame(() => {
9829
+ Rt(d)("scrolling into view", {}), De(h, C);
9824
9830
  }) : m = pn(e, () => {
9825
- kt(d)("scrolling into view", {}), De(h, C), m = null;
9831
+ Rt(d)("scrolling into view", {}), De(h, C), m = null;
9826
9832
  });
9827
9833
  }
9828
9834
  ), { autoscrollToBottom: y, followOutput: x, scrollIntoViewOnChange: b };
9829
9835
  },
9830
- xt(
9836
+ vt(
9831
9837
  En,
9832
9838
  wo,
9833
9839
  yo,
@@ -9838,8 +9844,8 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = tt(
9838
9844
  Lf,
9839
9845
  Ff
9840
9846
  )
9841
- ), V0 = tt(
9842
- ([{ data: e, firstItemIndex: t, gap: n, sizes: r }, { initialTopMostItemIndex: o }, { initialItemCount: s, listState: i }, { didMount: a }]) => (pe(
9847
+ ), V0 = et(
9848
+ ([{ data: e, firstItemIndex: t, gap: n, sizes: r }, { initialTopMostItemIndex: o }, { initialItemCount: s, listState: i }, { didMount: a }]) => (he(
9843
9849
  U(
9844
9850
  a,
9845
9851
  Le(s),
@@ -9849,9 +9855,9 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = tt(
9849
9855
  ),
9850
9856
  i
9851
9857
  ), {}),
9852
- xt(En, vo, hr, Gn),
9858
+ vt(En, vo, hr, Gn),
9853
9859
  { singleton: !0 }
9854
- ), K0 = tt(
9860
+ ), K0 = et(
9855
9861
  ([{ didMount: e }, { scrollTo: t }, { listState: n }]) => {
9856
9862
  const r = Y(0);
9857
9863
  return st(
@@ -9879,12 +9885,12 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = tt(
9879
9885
  initialScrollTop: r
9880
9886
  };
9881
9887
  },
9882
- xt(Gn, Wt, hr),
9888
+ vt(Gn, Wt, hr),
9883
9889
  { singleton: !0 }
9884
- ), $f = tt(
9890
+ ), $f = et(
9885
9891
  ([{ scrollVelocity: e }]) => {
9886
9892
  const t = Y(!1), n = We(), r = Y(!1);
9887
- return pe(
9893
+ return he(
9888
9894
  U(
9889
9895
  e,
9890
9896
  Le(r, t, n),
@@ -9898,23 +9904,23 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = tt(
9898
9904
  return !0;
9899
9905
  return i;
9900
9906
  }),
9901
- gt()
9907
+ yt()
9902
9908
  ),
9903
9909
  t
9904
9910
  ), st(
9905
- U(It(t, e, n), Le(r)),
9911
+ U(Nt(t, e, n), Le(r)),
9906
9912
  ([[o, s, i], a]) => {
9907
9913
  o && a && a.change && a.change(s, i);
9908
9914
  }
9909
9915
  ), { isSeeking: t, scrollSeekConfiguration: r, scrollSeekRangeChanged: n, scrollVelocity: e };
9910
9916
  },
9911
- xt(wo),
9917
+ vt(wo),
9912
9918
  { singleton: !0 }
9913
- ), Ka = tt(([{ scrollContainerState: e, scrollTo: t }]) => {
9919
+ ), Ka = et(([{ scrollContainerState: e, scrollTo: t }]) => {
9914
9920
  const n = We(), r = We(), o = We(), s = Y(!1), i = Y(void 0);
9915
- return pe(
9921
+ return he(
9916
9922
  U(
9917
- It(n, r),
9923
+ Nt(n, r),
9918
9924
  ae(([{ scrollHeight: a, scrollTop: l, viewportHeight: c }, { offsetTop: d }]) => ({
9919
9925
  scrollHeight: a,
9920
9926
  scrollTop: Math.max(0, l - d),
@@ -9922,7 +9928,7 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = tt(
9922
9928
  }))
9923
9929
  ),
9924
9930
  e
9925
- ), pe(
9931
+ ), he(
9926
9932
  U(
9927
9933
  t,
9928
9934
  Le(r),
@@ -9942,7 +9948,7 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = tt(
9942
9948
  windowScrollTo: o,
9943
9949
  windowViewportRect: r
9944
9950
  };
9945
- }, xt(Wt)), q0 = tt(
9951
+ }, vt(Wt)), q0 = et(
9946
9952
  ([
9947
9953
  { sizeRanges: e, sizes: t },
9948
9954
  { headerHeight: n, scrollTop: r },
@@ -9951,7 +9957,7 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = tt(
9951
9957
  { useWindowScroll: i, windowScrollContainerState: a, windowViewportRect: l }
9952
9958
  ]) => {
9953
9959
  const c = We(), d = Y(void 0), f = Y(null), p = Y(null);
9954
- return pe(a, f), pe(l, p), st(
9960
+ return he(a, f), he(l, p), st(
9955
9961
  U(
9956
9962
  c,
9957
9963
  Le(t, r, i, f, p, n)
@@ -9960,12 +9966,12 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = tt(
9960
9966
  const T = A0(x.sizeTree);
9961
9967
  m && g !== null && w !== null && (y = g.scrollTop - w.offsetTop), y -= b, h({ ranges: T, scrollTop: y });
9962
9968
  }
9963
- ), pe(U(d, Re(Fa), ae(G0)), o), pe(
9969
+ ), he(U(d, Re(Fa), ae(G0)), o), he(
9964
9970
  U(
9965
9971
  s,
9966
9972
  Le(d),
9967
9973
  Re(([, h]) => h !== void 0),
9968
- gt(),
9974
+ yt(),
9969
9975
  ae(([, h]) => h.ranges)
9970
9976
  ),
9971
9977
  e
@@ -9974,14 +9980,14 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = tt(
9974
9980
  restoreStateFrom: d
9975
9981
  };
9976
9982
  },
9977
- xt(En, Wt, vo, Gn, Ka)
9983
+ vt(En, Wt, vo, Gn, Ka)
9978
9984
  );
9979
9985
  function G0(e) {
9980
9986
  return { align: "start", index: 0, offset: e.scrollTop };
9981
9987
  }
9982
- const Y0 = tt(([{ topItemsIndexes: e }]) => {
9988
+ const Y0 = et(([{ topItemsIndexes: e }]) => {
9983
9989
  const t = Y(0);
9984
- return pe(
9990
+ return he(
9985
9991
  U(
9986
9992
  t,
9987
9993
  Re((n) => n >= 0),
@@ -9989,12 +9995,12 @@ const Y0 = tt(([{ topItemsIndexes: e }]) => {
9989
9995
  ),
9990
9996
  e
9991
9997
  ), { topItemCount: t };
9992
- }, xt(hr));
9998
+ }, vt(hr));
9993
9999
  function zf(e) {
9994
10000
  let t = !1, n;
9995
10001
  return () => (t || (t = !0, n = e()), n);
9996
10002
  }
9997
- const X0 = zf(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.test(navigator.userAgent)), J0 = tt(
10003
+ const X0 = zf(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.test(navigator.userAgent)), J0 = et(
9998
10004
  ([
9999
10005
  { deviation: e, scrollBy: t, scrollingInProgress: n, scrollTop: r },
10000
10006
  { isAtBottom: o, isScrolling: s, lastJumpDueToItemResize: i, scrollDirection: a },
@@ -10028,13 +10034,13 @@ const X0 = zf(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
10028
10034
  b && X0() ? De(e, w - g) : m(-g);
10029
10035
  }), st(
10030
10036
  U(
10031
- It(Ht(s, !1), e, x),
10037
+ Nt(Ht(s, !1), e, x),
10032
10038
  Re(([g, w, b]) => !g && !b && w !== 0),
10033
10039
  ae(([g, w]) => w),
10034
10040
  An(1)
10035
10041
  ),
10036
10042
  m
10037
- ), pe(
10043
+ ), he(
10038
10044
  U(
10039
10045
  f,
10040
10046
  ae((g) => ({ top: -g }))
@@ -10072,8 +10078,8 @@ const X0 = zf(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
10072
10078
  }
10073
10079
  ), { deviation: e };
10074
10080
  },
10075
- xt(Wt, wo, hr, En, qn, Ba)
10076
- ), Z0 = tt(
10081
+ vt(Wt, wo, hr, En, qn, Ba)
10082
+ ), Z0 = et(
10077
10083
  ([
10078
10084
  e,
10079
10085
  t,
@@ -10099,7 +10105,7 @@ const X0 = zf(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
10099
10105
  ...c,
10100
10106
  ...d
10101
10107
  }),
10102
- xt(
10108
+ vt(
10103
10109
  Va,
10104
10110
  V0,
10105
10111
  Gn,
@@ -10112,7 +10118,7 @@ const X0 = zf(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
10112
10118
  qn,
10113
10119
  Lf
10114
10120
  )
10115
- ), Bf = tt(
10121
+ ), Bf = et(
10116
10122
  ([
10117
10123
  {
10118
10124
  data: e,
@@ -10138,7 +10144,7 @@ const X0 = zf(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
10138
10144
  { topItemCount: k },
10139
10145
  { groupCounts: N },
10140
10146
  I
10141
- ]) => (pe(T.rangeChanged, I.scrollSeekRangeChanged), pe(
10147
+ ]) => (he(T.rangeChanged, I.scrollSeekRangeChanged), he(
10142
10148
  U(
10143
10149
  I.windowViewportRect,
10144
10150
  ae((E) => E.visibleHeight)
@@ -10175,7 +10181,7 @@ const X0 = zf(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
10175
10181
  sizes: l,
10176
10182
  ...m
10177
10183
  }),
10178
- xt(
10184
+ vt(
10179
10185
  En,
10180
10186
  vo,
10181
10187
  Wt,
@@ -10254,11 +10260,11 @@ function Hf(e, t, n) {
10254
10260
  );
10255
10261
  return z.useSyncExternalStore(
10256
10262
  w,
10257
- () => kt(g),
10258
- () => kt(g)
10263
+ () => Rt(g),
10264
+ () => Rt(g)
10259
10265
  );
10260
10266
  }, x = (m) => {
10261
- const g = z.useContext(a)[m], [w, b] = z.useState(hc(kt, g));
10267
+ const g = z.useContext(a)[m], [w, b] = z.useState(hc(Rt, g));
10262
10268
  return _o(
10263
10269
  () => st(g, (T) => {
10264
10270
  T !== w && b(pc(T));
@@ -10343,12 +10349,12 @@ const Ri = "-webkit-sticky", Tc = "sticky", qa = zf(() => {
10343
10349
  function Ga(e) {
10344
10350
  return e;
10345
10351
  }
10346
- const tS = /* @__PURE__ */ tt(() => {
10352
+ const tS = /* @__PURE__ */ et(() => {
10347
10353
  const e = Y((a) => `Item ${a}`), t = Y((a) => `Group ${a}`), n = Y({}), r = Y(Ga), o = Y("div"), s = Y(Or), i = (a, l = null) => Ht(
10348
10354
  U(
10349
10355
  n,
10350
10356
  ae((c) => c[a]),
10351
- gt()
10357
+ yt()
10352
10358
  ),
10353
10359
  l
10354
10360
  );
@@ -10369,9 +10375,9 @@ const tS = /* @__PURE__ */ tt(() => {
10369
10375
  ScrollSeekPlaceholder: i("ScrollSeekPlaceholder"),
10370
10376
  TopItemListComponent: i("TopItemList")
10371
10377
  };
10372
- }), nS = /* @__PURE__ */ tt(
10378
+ }), nS = /* @__PURE__ */ et(
10373
10379
  ([e, t]) => ({ ...e, ...t }),
10374
- xt(Bf, tS)
10380
+ vt(Bf, tS)
10375
10381
  ), rS = ({ height: e }) => /* @__PURE__ */ u.jsx("div", { style: { height: e } }), oS = { overflowAnchor: "none", position: qa(), zIndex: 1 }, qf = { overflowAnchor: "none" }, sS = { ...qf, display: "inline-block", height: "100%" }, kc = /* @__PURE__ */ z.memo(function({ showTopList: e = !1 }) {
10376
10382
  const t = _e("listState"), n = on("sizeRanges"), r = _e("useWindowScroll"), o = _e("customScrollParent"), s = on("windowScrollContainerState"), i = on("scrollContainerState"), a = o || r ? s : i, l = _e("itemContent"), c = _e("context"), d = _e("groupContent"), f = _e("trackItemSizes"), p = _e("itemSize"), h = _e("log"), x = on("gap"), y = _e("horizontalDirection"), { callbackRef: m } = w0(
10377
10383
  n,
@@ -10650,7 +10656,7 @@ const fS = ({ children: e }) => {
10650
10656
  }
10651
10657
  },
10652
10658
  mS
10653
- ), xS = /* @__PURE__ */ Gf({ useEmitter: Ya, useEmitterValue: _e, usePublisher: on }), yS = /* @__PURE__ */ Yf({ useEmitter: Ya, useEmitterValue: _e, usePublisher: on }), vS = gS, wS = /* @__PURE__ */ tt(() => {
10659
+ ), xS = /* @__PURE__ */ Gf({ useEmitter: Ya, useEmitterValue: _e, usePublisher: on }), yS = /* @__PURE__ */ Yf({ useEmitter: Ya, useEmitterValue: _e, usePublisher: on }), vS = gS, wS = /* @__PURE__ */ et(() => {
10654
10660
  const e = Y((c) => /* @__PURE__ */ u.jsxs("td", { children: [
10655
10661
  "Item $",
10656
10662
  c
@@ -10661,7 +10667,7 @@ const fS = ({ children: e }) => {
10661
10667
  U(
10662
10668
  s,
10663
10669
  ae((f) => f[c]),
10664
- gt()
10670
+ yt()
10665
10671
  ),
10666
10672
  d
10667
10673
  );
@@ -10686,7 +10692,7 @@ const fS = ({ children: e }) => {
10686
10692
  GroupComponent: l("Group", "tr")
10687
10693
  };
10688
10694
  });
10689
- xt(Bf, wS);
10695
+ vt(Bf, wS);
10690
10696
  qa();
10691
10697
  const Rc = {
10692
10698
  bottom: 0,
@@ -10720,7 +10726,7 @@ function jo(e, t) {
10720
10726
  function CS(e, t) {
10721
10727
  return e && e.column === t.column && e.row === t.row;
10722
10728
  }
10723
- const TS = /* @__PURE__ */ tt(
10729
+ const TS = /* @__PURE__ */ et(
10724
10730
  ([
10725
10731
  { increaseViewportBy: e, listBoundary: t, overscan: n, visibleRange: r },
10726
10732
  { footerHeight: o, headerHeight: s, scrollBy: i, scrollContainerState: a, scrollTo: l, scrollTop: c, smoothScrollTargetReached: d, viewportHeight: f },
@@ -10742,7 +10748,7 @@ const TS = /* @__PURE__ */ tt(
10742
10748
  }
10743
10749
  ), st(
10744
10750
  U(
10745
- It(x, J, E, I, O, X),
10751
+ Nt(x, J, E, I, O, X),
10746
10752
  Re(([M, H, te, oe, , ne]) => M && !H && te.height !== 0 && oe.height !== 0 && !ne)
10747
10753
  ),
10748
10754
  ([, , , , M]) => {
@@ -10752,7 +10758,7 @@ const TS = /* @__PURE__ */ tt(
10752
10758
  De(t, [0, 0]), De(J, !0);
10753
10759
  });
10754
10760
  }
10755
- ), pe(
10761
+ ), he(
10756
10762
  U(
10757
10763
  B,
10758
10764
  Re((M) => M != null && M.scrollTop > 0),
@@ -10770,15 +10776,15 @@ const TS = /* @__PURE__ */ tt(
10770
10776
  De(D, !1);
10771
10777
  }), De(l, { top: M.scrollTop })));
10772
10778
  }
10773
- ), pe(
10779
+ ), he(
10774
10780
  U(
10775
10781
  I,
10776
10782
  ae(({ height: M }) => M)
10777
10783
  ),
10778
10784
  f
10779
- ), pe(
10785
+ ), he(
10780
10786
  U(
10781
- It(
10787
+ Nt(
10782
10788
  Ce(I, jo),
10783
10789
  Ce(E, jo),
10784
10790
  Ce($, (M, H) => M && M.column === H.column && M.row === H.row),
@@ -10792,9 +10798,9 @@ const TS = /* @__PURE__ */ tt(
10792
10798
  }))
10793
10799
  ),
10794
10800
  A
10795
- ), pe(
10801
+ ), he(
10796
10802
  U(
10797
- It(
10803
+ Nt(
10798
10804
  Ce(S),
10799
10805
  r,
10800
10806
  Ce($, CS),
@@ -10820,43 +10826,43 @@ const TS = /* @__PURE__ */ tt(
10820
10826
  Ie,
10821
10827
  ke
10822
10828
  ]) => {
10823
- const { column: $e, row: Ze } = oe, { height: He, width: Ke } = ne, { width: Ue } = Te;
10829
+ const { column: $e, row: Je } = oe, { height: He, width: Ke } = ne, { width: Ue } = Te;
10824
10830
  if (ue === 0 && (M === 0 || Ue === 0))
10825
10831
  return Rc;
10826
10832
  if (Ke === 0) {
10827
- const he = Wa(ke, M), je = he + Math.max(ue - 1, 0);
10828
- return SS(Nc(he, je, Z));
10833
+ const me = Wa(ke, M), je = me + Math.max(ue - 1, 0);
10834
+ return SS(Nc(me, je, Z));
10829
10835
  }
10830
- const Qe = Xf(Ue, Ke, $e);
10831
- let qe, nt;
10832
- Ie ? H === 0 && te === 0 && ue > 0 ? (qe = 0, nt = ue - 1) : (qe = Qe * as((H + Ze) / (He + Ze)), nt = Qe * Ec((te + Ze) / (He + Ze)) - 1, nt = Ei(M - 1, Vr(nt, Qe - 1)), qe = Ei(nt, Vr(0, qe))) : (qe = 0, nt = -1);
10833
- const Nt = Nc(qe, nt, Z), { bottom: ht, top: lt } = Ac(Te, oe, ne, Nt), fe = Ec(M / Qe), ge = fe * He + (fe - 1) * Ze - ht;
10834
- return { bottom: ht, itemHeight: He, items: Nt, itemWidth: Ke, offsetBottom: ge, offsetTop: lt, top: lt };
10836
+ const Ze = Xf(Ue, Ke, $e);
10837
+ let qe, tt;
10838
+ Ie ? H === 0 && te === 0 && ue > 0 ? (qe = 0, tt = ue - 1) : (qe = Ze * as((H + Je) / (He + Je)), tt = Ze * Ec((te + Je) / (He + Je)) - 1, tt = Ei(M - 1, Vr(tt, Ze - 1)), qe = Ei(tt, Vr(0, qe))) : (qe = 0, tt = -1);
10839
+ const At = Nc(qe, tt, Z), { bottom: mt, top: lt } = Ac(Te, oe, ne, At), fe = Ec(M / Ze), pe = fe * He + (fe - 1) * Je - mt;
10840
+ return { bottom: mt, itemHeight: He, items: At, itemWidth: Ke, offsetBottom: pe, offsetTop: lt, top: lt };
10835
10841
  }
10836
10842
  )
10837
10843
  ),
10838
10844
  N
10839
- ), pe(
10845
+ ), he(
10840
10846
  U(
10841
10847
  _,
10842
10848
  Re((M) => M !== null),
10843
10849
  ae((M) => M.length)
10844
10850
  ),
10845
10851
  S
10846
- ), pe(
10852
+ ), he(
10847
10853
  U(
10848
- It(I, E, N, $),
10854
+ Nt(I, E, N, $),
10849
10855
  Re(([M, H, { items: te }]) => te.length > 0 && H.height !== 0 && M.height !== 0),
10850
10856
  ae(([M, H, { items: te }, oe]) => {
10851
10857
  const { bottom: ne, top: Te } = Ac(M, oe, H, te);
10852
10858
  return [Te, ne];
10853
10859
  }),
10854
- gt(ro)
10860
+ yt(ro)
10855
10861
  ),
10856
10862
  t
10857
10863
  );
10858
10864
  const Ee = Y(!1);
10859
- pe(
10865
+ he(
10860
10866
  U(
10861
10867
  c,
10862
10868
  Le(Ee),
@@ -10866,7 +10872,7 @@ const TS = /* @__PURE__ */ tt(
10866
10872
  );
10867
10873
  const Ae = en(
10868
10874
  U(
10869
- It(N, S),
10875
+ Nt(N, S),
10870
10876
  Re(([{ items: M }]) => M.length > 0),
10871
10877
  Le(Ee),
10872
10878
  Re(([[M, H], te]) => {
@@ -10874,14 +10880,14 @@ const TS = /* @__PURE__ */ tt(
10874
10880
  return (te || M.bottom > 0 && M.itemHeight > 0 && M.offsetBottom === 0 && M.items.length === H) && oe;
10875
10881
  }),
10876
10882
  ae(([[, M]]) => M - 1),
10877
- gt()
10883
+ yt()
10878
10884
  )
10879
10885
  ), K = en(
10880
10886
  U(
10881
10887
  Ce(N),
10882
10888
  Re(({ items: M }) => M.length > 0 && M[0].index === 0),
10883
10889
  wn(0),
10884
- gt()
10890
+ yt()
10885
10891
  )
10886
10892
  ), ee = en(
10887
10893
  U(
@@ -10892,11 +10898,11 @@ const TS = /* @__PURE__ */ tt(
10892
10898
  endIndex: M[M.length - 1].index,
10893
10899
  startIndex: M[0].index
10894
10900
  })),
10895
- gt(If),
10901
+ yt(If),
10896
10902
  An(0)
10897
10903
  )
10898
10904
  );
10899
- pe(ee, h.scrollSeekRangeChanged), pe(
10905
+ he(ee, h.scrollSeekRangeChanged), he(
10900
10906
  U(
10901
10907
  j,
10902
10908
  Le(I, E, S, $),
@@ -10917,7 +10923,7 @@ const TS = /* @__PURE__ */ tt(
10917
10923
  ),
10918
10924
  0
10919
10925
  );
10920
- return pe(
10926
+ return he(
10921
10927
  U(
10922
10928
  T,
10923
10929
  ae((M) => ({ height: M.visibleHeight, width: M.visibleWidth }))
@@ -10965,7 +10971,7 @@ const TS = /* @__PURE__ */ tt(
10965
10971
  ...C
10966
10972
  };
10967
10973
  },
10968
- xt(Va, Wt, wo, $f, Gn, Ka, qn)
10974
+ vt(Va, Wt, wo, $f, Gn, Ka, qn)
10969
10975
  );
10970
10976
  function Xf(e, t, n) {
10971
10977
  return Vr(1, as((e + n) / (as(t) + n)));
@@ -10981,16 +10987,16 @@ function ea(e, t, n, r) {
10981
10987
  const o = Xf(e.width, n.width, t.column), s = as(r / o), i = s * n.height + Vr(0, s - 1) * t.row;
10982
10988
  return i > 0 ? i + t.row : i;
10983
10989
  }
10984
- const kS = /* @__PURE__ */ tt(() => {
10990
+ const kS = /* @__PURE__ */ et(() => {
10985
10991
  const e = Y((f) => `Item ${f}`), t = Y({}), n = Y(null), r = Y("virtuoso-grid-item"), o = Y("virtuoso-grid-list"), s = Y(Ga), i = Y("div"), a = Y(Or), l = (f, p = null) => Ht(
10986
10992
  U(
10987
10993
  t,
10988
10994
  ae((h) => h[f]),
10989
- gt()
10995
+ yt()
10990
10996
  ),
10991
10997
  p
10992
10998
  ), c = Y(!1), d = Y(!1);
10993
- return pe(Ce(d), c), {
10999
+ return he(Ce(d), c), {
10994
11000
  components: t,
10995
11001
  computeItemKey: s,
10996
11002
  context: n,
@@ -11008,11 +11014,11 @@ const kS = /* @__PURE__ */ tt(() => {
11008
11014
  scrollerRef: a,
11009
11015
  ScrollSeekPlaceholder: l("ScrollSeekPlaceholder", "div")
11010
11016
  };
11011
- }), RS = /* @__PURE__ */ tt(
11017
+ }), RS = /* @__PURE__ */ et(
11012
11018
  ([e, t]) => ({ ...e, ...t }),
11013
- xt(TS, kS)
11019
+ vt(TS, kS)
11014
11020
  ), ES = /* @__PURE__ */ z.memo(function() {
11015
- const e = wt("gridState"), t = wt("listClassName"), n = wt("itemClassName"), r = wt("itemContent"), o = wt("computeItemKey"), s = wt("isSeeking"), i = sn("scrollHeight"), a = wt("ItemComponent"), l = wt("ListComponent"), c = wt("ScrollSeekPlaceholder"), d = wt("context"), f = sn("itemDimensions"), p = sn("gap"), h = wt("log"), x = wt("stateRestoreInProgress"), y = sn("reportReadyState"), m = pr(
11021
+ const e = bt("gridState"), t = bt("listClassName"), n = bt("itemClassName"), r = bt("itemContent"), o = bt("computeItemKey"), s = bt("isSeeking"), i = sn("scrollHeight"), a = bt("ItemComponent"), l = bt("ListComponent"), c = bt("ScrollSeekPlaceholder"), d = bt("context"), f = sn("itemDimensions"), p = sn("gap"), h = bt("log"), x = bt("stateRestoreInProgress"), y = sn("reportReadyState"), m = pr(
11016
11022
  z.useMemo(
11017
11023
  () => (g) => {
11018
11024
  const w = g.parentElement.parentElement.scrollHeight;
@@ -11067,7 +11073,7 @@ const kS = /* @__PURE__ */ tt(() => {
11067
11073
  }
11068
11074
  );
11069
11075
  }), IS = z.memo(function() {
11070
- const e = wt("HeaderComponent"), t = sn("headerHeight"), n = wt("headerFooterTag"), r = pr(
11076
+ const e = bt("HeaderComponent"), t = sn("headerHeight"), n = bt("headerFooterTag"), r = pr(
11071
11077
  z.useMemo(
11072
11078
  () => (s) => {
11073
11079
  t(Un(s, "height"));
@@ -11076,10 +11082,10 @@ const kS = /* @__PURE__ */ tt(() => {
11076
11082
  ),
11077
11083
  !0,
11078
11084
  !1
11079
- ), o = wt("context");
11085
+ ), o = bt("context");
11080
11086
  return e ? /* @__PURE__ */ u.jsx(n, { ref: r, children: /* @__PURE__ */ u.jsx(e, { ...Bt(e, o) }) }) : null;
11081
11087
  }), NS = z.memo(function() {
11082
- const e = wt("FooterComponent"), t = sn("footerHeight"), n = wt("headerFooterTag"), r = pr(
11088
+ const e = bt("FooterComponent"), t = sn("footerHeight"), n = bt("headerFooterTag"), r = pr(
11083
11089
  z.useMemo(
11084
11090
  () => (s) => {
11085
11091
  t(Un(s, "height"));
@@ -11088,7 +11094,7 @@ const kS = /* @__PURE__ */ tt(() => {
11088
11094
  ),
11089
11095
  !0,
11090
11096
  !1
11091
- ), o = wt("context");
11097
+ ), o = bt("context");
11092
11098
  return e ? /* @__PURE__ */ u.jsx(n, { ref: r, children: /* @__PURE__ */ u.jsx(e, { ...Bt(e, o) }) }) : null;
11093
11099
  }), AS = ({ children: e }) => {
11094
11100
  const t = z.useContext(Wf), n = sn("itemDimensions"), r = sn("viewportDimensions"), o = pr(
@@ -11105,12 +11111,12 @@ const kS = /* @__PURE__ */ tt(() => {
11105
11111
  t && (r({ height: t.viewportHeight, width: t.viewportWidth }), n({ height: t.itemHeight, width: t.itemWidth }));
11106
11112
  }, [t, r, n]), /* @__PURE__ */ u.jsx("div", { ref: o, style: Ws(!1), children: e });
11107
11113
  }, _S = ({ children: e }) => {
11108
- const t = z.useContext(Wf), n = sn("windowViewportRect"), r = sn("itemDimensions"), o = wt("customScrollParent"), s = Sf(n, o, !1);
11114
+ const t = z.useContext(Wf), n = sn("windowViewportRect"), r = sn("itemDimensions"), o = bt("customScrollParent"), s = Sf(n, o, !1);
11109
11115
  return z.useEffect(() => {
11110
11116
  t && (r({ height: t.itemHeight, width: t.itemWidth }), n({ offsetTop: 0, visibleHeight: t.viewportHeight, visibleWidth: t.viewportWidth }));
11111
11117
  }, [t, n, r]), /* @__PURE__ */ u.jsx("div", { ref: s, style: Ws(!1), children: e });
11112
11118
  }, jS = /* @__PURE__ */ z.memo(function({ ...e }) {
11113
- const t = wt("useWindowScroll"), n = wt("customScrollParent"), r = n || t ? OS : PS, o = n || t ? _S : AS, s = wt("context");
11119
+ const t = bt("useWindowScroll"), n = bt("customScrollParent"), r = n || t ? OS : PS, o = n || t ? _S : AS, s = bt("context");
11114
11120
  return /* @__PURE__ */ u.jsx(r, { ...e, ...Bt(r, s), children: /* @__PURE__ */ u.jsxs(o, { children: [
11115
11121
  /* @__PURE__ */ u.jsx(IS, {}),
11116
11122
  /* @__PURE__ */ u.jsx(ES, {}),
@@ -11118,7 +11124,7 @@ const kS = /* @__PURE__ */ tt(() => {
11118
11124
  ] }) });
11119
11125
  }), {
11120
11126
  useEmitter: Jf,
11121
- useEmitterValue: wt,
11127
+ useEmitterValue: bt,
11122
11128
  usePublisher: sn
11123
11129
  } = /* @__PURE__ */ Hf(
11124
11130
  RS,
@@ -11161,7 +11167,7 @@ const kS = /* @__PURE__ */ tt(() => {
11161
11167
  }
11162
11168
  },
11163
11169
  jS
11164
- ), PS = /* @__PURE__ */ Gf({ useEmitter: Jf, useEmitterValue: wt, usePublisher: sn }), OS = /* @__PURE__ */ Yf({ useEmitter: Jf, useEmitterValue: wt, usePublisher: sn });
11170
+ ), PS = /* @__PURE__ */ Gf({ useEmitter: Jf, useEmitterValue: bt, usePublisher: sn }), OS = /* @__PURE__ */ Yf({ useEmitter: Jf, useEmitterValue: bt, usePublisher: sn });
11165
11171
  function _c(e, t, n) {
11166
11172
  return t !== "normal" && !(t != null && t.endsWith("px")) && n(`${e} was not resolved to pixel value correctly`, t, Xt.WARN), t === "normal" ? 0 : parseInt(t ?? "0", 10);
11167
11173
  }
@@ -11772,7 +11778,7 @@ function oC({ isOpen: e, onClose: t, fileId: n, fileName: r, mimeType: o }) {
11772
11778
  }
11773
11779
  }
11774
11780
  }, [n]);
11775
- St(() => {
11781
+ Ct(() => {
11776
11782
  e && n && p();
11777
11783
  }, [e, n, p]);
11778
11784
  const h = async () => {
@@ -11914,7 +11920,7 @@ function Np(e) {
11914
11920
  return e.replace(cC, (t, n) => (n = n.toLowerCase(), n === "colon" ? ":" : n.charAt(0) === "#" ? n.charAt(1) === "x" ? String.fromCharCode(parseInt(n.substring(2), 16)) : String.fromCharCode(+n.substring(1)) : ""));
11915
11921
  }
11916
11922
  const uC = /(^|[^\[])\^/g;
11917
- function ft(e, t) {
11923
+ function pt(e, t) {
11918
11924
  e = typeof e == "string" ? e : e.source, t = t || "";
11919
11925
  const n = {
11920
11926
  replace: (r, o) => (o = o.source || o, o = o.replace(uC, "$1"), e = e.replace(r, o), n),
@@ -12476,26 +12482,26 @@ const ve = {
12476
12482
  };
12477
12483
  ve._label = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
12478
12484
  ve._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
12479
- ve.def = ft(ve.def).replace("label", ve._label).replace("title", ve._title).getRegex();
12485
+ ve.def = pt(ve.def).replace("label", ve._label).replace("title", ve._title).getRegex();
12480
12486
  ve.bullet = /(?:[*+-]|\d{1,9}[.)])/;
12481
- ve.listItemStart = ft(/^( *)(bull) */).replace("bull", ve.bullet).getRegex();
12482
- ve.list = ft(ve.list).replace(/bull/g, ve.bullet).replace("hr", "\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def", "\\n+(?=" + ve.def.source + ")").getRegex();
12487
+ ve.listItemStart = pt(/^( *)(bull) */).replace("bull", ve.bullet).getRegex();
12488
+ ve.list = pt(ve.list).replace(/bull/g, ve.bullet).replace("hr", "\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def", "\\n+(?=" + ve.def.source + ")").getRegex();
12483
12489
  ve._tag = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";
12484
12490
  ve._comment = /<!--(?!-?>)[\s\S]*?(?:-->|$)/;
12485
- ve.html = ft(ve.html, "i").replace("comment", ve._comment).replace("tag", ve._tag).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
12486
- ve.paragraph = ft(ve._paragraph).replace("hr", ve.hr).replace("heading", " {0,3}#{1,6} ").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", ve._tag).getRegex();
12487
- ve.blockquote = ft(ve.blockquote).replace("paragraph", ve.paragraph).getRegex();
12491
+ ve.html = pt(ve.html, "i").replace("comment", ve._comment).replace("tag", ve._tag).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
12492
+ ve.paragraph = pt(ve._paragraph).replace("hr", ve.hr).replace("heading", " {0,3}#{1,6} ").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", ve._tag).getRegex();
12493
+ ve.blockquote = pt(ve.blockquote).replace("paragraph", ve.paragraph).getRegex();
12488
12494
  ve.normal = { ...ve };
12489
12495
  ve.gfm = {
12490
12496
  ...ve.normal,
12491
12497
  table: "^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"
12492
12498
  // Cells
12493
12499
  };
12494
- ve.gfm.table = ft(ve.gfm.table).replace("hr", ve.hr).replace("heading", " {0,3}#{1,6} ").replace("blockquote", " {0,3}>").replace("code", " {4}[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", ve._tag).getRegex();
12495
- ve.gfm.paragraph = ft(ve._paragraph).replace("hr", ve.hr).replace("heading", " {0,3}#{1,6} ").replace("|lheading", "").replace("table", ve.gfm.table).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", ve._tag).getRegex();
12500
+ ve.gfm.table = pt(ve.gfm.table).replace("hr", ve.hr).replace("heading", " {0,3}#{1,6} ").replace("blockquote", " {0,3}>").replace("code", " {4}[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", ve._tag).getRegex();
12501
+ ve.gfm.paragraph = pt(ve._paragraph).replace("hr", ve.hr).replace("heading", " {0,3}#{1,6} ").replace("|lheading", "").replace("table", ve.gfm.table).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", ve._tag).getRegex();
12496
12502
  ve.pedantic = {
12497
12503
  ...ve.normal,
12498
- html: ft(
12504
+ html: pt(
12499
12505
  `^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`
12500
12506
  ).replace("comment", ve._comment).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),
12501
12507
  def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
@@ -12503,7 +12509,7 @@ ve.pedantic = {
12503
12509
  fences: us,
12504
12510
  // fences not supported
12505
12511
  lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
12506
- paragraph: ft(ve.normal._paragraph).replace("hr", ve.hr).replace("heading", ` *#{1,6} *[^
12512
+ paragraph: pt(ve.normal._paragraph).replace("hr", ve.hr).replace("heading", ` *#{1,6} *[^
12507
12513
  ]`).replace("lheading", ve.lheading).replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").getRegex()
12508
12514
  };
12509
12515
  const le = {
@@ -12531,26 +12537,26 @@ const le = {
12531
12537
  punctuation: /^([\spunctuation])/
12532
12538
  };
12533
12539
  le._punctuation = "!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~";
12534
- le.punctuation = ft(le.punctuation).replace(/punctuation/g, le._punctuation).getRegex();
12540
+ le.punctuation = pt(le.punctuation).replace(/punctuation/g, le._punctuation).getRegex();
12535
12541
  le.blockSkip = /\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g;
12536
12542
  le.escapedEmSt = /(?:^|[^\\])(?:\\\\)*\\[*_]/g;
12537
- le._comment = ft(ve._comment).replace("(?:-->|$)", "-->").getRegex();
12538
- le.emStrong.lDelim = ft(le.emStrong.lDelim).replace(/punct/g, le._punctuation).getRegex();
12539
- le.emStrong.rDelimAst = ft(le.emStrong.rDelimAst, "g").replace(/punct/g, le._punctuation).getRegex();
12540
- le.emStrong.rDelimUnd = ft(le.emStrong.rDelimUnd, "g").replace(/punct/g, le._punctuation).getRegex();
12543
+ le._comment = pt(ve._comment).replace("(?:-->|$)", "-->").getRegex();
12544
+ le.emStrong.lDelim = pt(le.emStrong.lDelim).replace(/punct/g, le._punctuation).getRegex();
12545
+ le.emStrong.rDelimAst = pt(le.emStrong.rDelimAst, "g").replace(/punct/g, le._punctuation).getRegex();
12546
+ le.emStrong.rDelimUnd = pt(le.emStrong.rDelimUnd, "g").replace(/punct/g, le._punctuation).getRegex();
12541
12547
  le._escapes = /\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;
12542
12548
  le._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;
12543
12549
  le._email = /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/;
12544
- le.autolink = ft(le.autolink).replace("scheme", le._scheme).replace("email", le._email).getRegex();
12550
+ le.autolink = pt(le.autolink).replace("scheme", le._scheme).replace("email", le._email).getRegex();
12545
12551
  le._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;
12546
- le.tag = ft(le.tag).replace("comment", le._comment).replace("attribute", le._attribute).getRegex();
12552
+ le.tag = pt(le.tag).replace("comment", le._comment).replace("attribute", le._attribute).getRegex();
12547
12553
  le._label = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
12548
12554
  le._href = /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;
12549
12555
  le._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;
12550
- le.link = ft(le.link).replace("label", le._label).replace("href", le._href).replace("title", le._title).getRegex();
12551
- le.reflink = ft(le.reflink).replace("label", le._label).replace("ref", ve._label).getRegex();
12552
- le.nolink = ft(le.nolink).replace("ref", ve._label).getRegex();
12553
- le.reflinkSearch = ft(le.reflinkSearch, "g").replace("reflink", le.reflink).replace("nolink", le.nolink).getRegex();
12556
+ le.link = pt(le.link).replace("label", le._label).replace("href", le._href).replace("title", le._title).getRegex();
12557
+ le.reflink = pt(le.reflink).replace("label", le._label).replace("ref", ve._label).getRegex();
12558
+ le.nolink = pt(le.nolink).replace("ref", ve._label).getRegex();
12559
+ le.reflinkSearch = pt(le.reflinkSearch, "g").replace("reflink", le.reflink).replace("nolink", le.nolink).getRegex();
12554
12560
  le.normal = { ...le };
12555
12561
  le.pedantic = {
12556
12562
  ...le.normal,
@@ -12566,23 +12572,23 @@ le.pedantic = {
12566
12572
  endAst: /\*(?!\*)/g,
12567
12573
  endUnd: /_(?!_)/g
12568
12574
  },
12569
- link: ft(/^!?\[(label)\]\((.*?)\)/).replace("label", le._label).getRegex(),
12570
- reflink: ft(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", le._label).getRegex()
12575
+ link: pt(/^!?\[(label)\]\((.*?)\)/).replace("label", le._label).getRegex(),
12576
+ reflink: pt(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", le._label).getRegex()
12571
12577
  };
12572
12578
  le.gfm = {
12573
12579
  ...le.normal,
12574
- escape: ft(le.escape).replace("])", "~|])").getRegex(),
12580
+ escape: pt(le.escape).replace("])", "~|])").getRegex(),
12575
12581
  _extended_email: /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,
12576
12582
  url: /^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,
12577
12583
  _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
12578
12584
  del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,
12579
12585
  text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
12580
12586
  };
12581
- le.gfm.url = ft(le.gfm.url, "i").replace("email", le.gfm._extended_email).getRegex();
12587
+ le.gfm.url = pt(le.gfm.url, "i").replace("email", le.gfm._extended_email).getRegex();
12582
12588
  le.breaks = {
12583
12589
  ...le.gfm,
12584
- br: ft(le.br).replace("{2,}", "*").getRegex(),
12585
- text: ft(le.gfm.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
12590
+ br: pt(le.br).replace("{2,}", "*").getRegex(),
12591
+ text: pt(le.gfm.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
12586
12592
  };
12587
12593
  function wC(e) {
12588
12594
  return e.replace(/---/g, "—").replace(/--/g, "–").replace(/(^|[-\u2014/(\[{"\s])'/g, "$1‘").replace(/'/g, "’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g, "$1“").replace(/"/g, "”").replace(/\.{3}/g, "…");
@@ -13248,7 +13254,7 @@ function jp(e, t) {
13248
13254
  return (n, r, o) => {
13249
13255
  typeof r == "function" && (o = r, r = null);
13250
13256
  const s = { ...r };
13251
- r = { ...me.defaults, ...s };
13257
+ r = { ...ge.defaults, ...s };
13252
13258
  const i = bC(r.silent, r.async, o);
13253
13259
  if (typeof n > "u" || n === null)
13254
13260
  return i(new Error("marked(): input parameter is undefined or null"));
@@ -13266,7 +13272,7 @@ function jp(e, t) {
13266
13272
  let p;
13267
13273
  if (!f)
13268
13274
  try {
13269
- r.walkTokens && me.walkTokens(l, r.walkTokens), p = t(l, r), r.hooks && (p = r.hooks.postprocess(p));
13275
+ r.walkTokens && ge.walkTokens(l, r.walkTokens), p = t(l, r), r.hooks && (p = r.hooks.postprocess(p));
13270
13276
  } catch (h) {
13271
13277
  f = h;
13272
13278
  }
@@ -13274,7 +13280,7 @@ function jp(e, t) {
13274
13280
  };
13275
13281
  if (!a || a.length < 3 || (delete r.highlight, !l.length)) return c();
13276
13282
  let d = 0;
13277
- me.walkTokens(l, function(f) {
13283
+ ge.walkTokens(l, function(f) {
13278
13284
  f.type === "code" && (d++, setTimeout(() => {
13279
13285
  a(f.text, f.lang, function(p, h) {
13280
13286
  if (p)
@@ -13286,11 +13292,11 @@ function jp(e, t) {
13286
13292
  return;
13287
13293
  }
13288
13294
  if (r.async)
13289
- return Promise.resolve(r.hooks ? r.hooks.preprocess(n) : n).then((a) => e(a, r)).then((a) => r.walkTokens ? Promise.all(me.walkTokens(a, r.walkTokens)).then(() => a) : a).then((a) => t(a, r)).then((a) => r.hooks ? r.hooks.postprocess(a) : a).catch(i);
13295
+ return Promise.resolve(r.hooks ? r.hooks.preprocess(n) : n).then((a) => e(a, r)).then((a) => r.walkTokens ? Promise.all(ge.walkTokens(a, r.walkTokens)).then(() => a) : a).then((a) => t(a, r)).then((a) => r.hooks ? r.hooks.postprocess(a) : a).catch(i);
13290
13296
  try {
13291
13297
  r.hooks && (n = r.hooks.preprocess(n));
13292
13298
  const a = e(n, r);
13293
- r.walkTokens && me.walkTokens(a, r.walkTokens);
13299
+ r.walkTokens && ge.walkTokens(a, r.walkTokens);
13294
13300
  let l = t(a, r);
13295
13301
  return r.hooks && (l = r.hooks.postprocess(l)), l;
13296
13302
  } catch (a) {
@@ -13298,19 +13304,19 @@ function jp(e, t) {
13298
13304
  }
13299
13305
  };
13300
13306
  }
13301
- function me(e, t, n) {
13307
+ function ge(e, t, n) {
13302
13308
  return jp(Wn.lex, Vn.parse)(e, t, n);
13303
13309
  }
13304
- me.options = me.setOptions = function(e) {
13305
- return me.defaults = { ...me.defaults, ...e }, sC(me.defaults), me;
13310
+ ge.options = ge.setOptions = function(e) {
13311
+ return ge.defaults = { ...ge.defaults, ...e }, sC(ge.defaults), ge;
13306
13312
  };
13307
- me.getDefaults = Rp;
13308
- me.defaults = mr;
13309
- me.use = function(...e) {
13310
- const t = me.defaults.extensions || { renderers: {}, childTokens: {} };
13313
+ ge.getDefaults = Rp;
13314
+ ge.defaults = mr;
13315
+ ge.use = function(...e) {
13316
+ const t = ge.defaults.extensions || { renderers: {}, childTokens: {} };
13311
13317
  e.forEach((n) => {
13312
13318
  const r = { ...n };
13313
- if (r.async = me.defaults.async || r.async || !1, n.extensions && (n.extensions.forEach((o) => {
13319
+ if (r.async = ge.defaults.async || r.async || !1, n.extensions && (n.extensions.forEach((o) => {
13314
13320
  if (!o.name)
13315
13321
  throw new Error("extension name required");
13316
13322
  if (o.renderer) {
@@ -13327,7 +13333,7 @@ me.use = function(...e) {
13327
13333
  }
13328
13334
  o.childTokens && (t.childTokens[o.name] = o.childTokens);
13329
13335
  }), r.extensions = t), n.renderer) {
13330
- const o = me.defaults.renderer || new nl();
13336
+ const o = ge.defaults.renderer || new nl();
13331
13337
  for (const s in n.renderer) {
13332
13338
  const i = o[s];
13333
13339
  o[s] = (...a) => {
@@ -13338,7 +13344,7 @@ me.use = function(...e) {
13338
13344
  r.renderer = o;
13339
13345
  }
13340
13346
  if (n.tokenizer) {
13341
- const o = me.defaults.tokenizer || new tl();
13347
+ const o = ge.defaults.tokenizer || new tl();
13342
13348
  for (const s in n.tokenizer) {
13343
13349
  const i = o[s];
13344
13350
  o[s] = (...a) => {
@@ -13349,11 +13355,11 @@ me.use = function(...e) {
13349
13355
  r.tokenizer = o;
13350
13356
  }
13351
13357
  if (n.hooks) {
13352
- const o = me.defaults.hooks || new ds();
13358
+ const o = ge.defaults.hooks || new ds();
13353
13359
  for (const s in n.hooks) {
13354
13360
  const i = o[s];
13355
13361
  ds.passThroughHooks.has(s) ? o[s] = (a) => {
13356
- if (me.defaults.async)
13362
+ if (ge.defaults.async)
13357
13363
  return Promise.resolve(n.hooks[s].call(o, a)).then((c) => i.call(o, c));
13358
13364
  const l = n.hooks[s].call(o, a);
13359
13365
  return i.call(o, l);
@@ -13365,54 +13371,54 @@ me.use = function(...e) {
13365
13371
  r.hooks = o;
13366
13372
  }
13367
13373
  if (n.walkTokens) {
13368
- const o = me.defaults.walkTokens;
13374
+ const o = ge.defaults.walkTokens;
13369
13375
  r.walkTokens = function(s) {
13370
13376
  let i = [];
13371
13377
  return i.push(n.walkTokens.call(this, s)), o && (i = i.concat(o.call(this, s))), i;
13372
13378
  };
13373
13379
  }
13374
- me.setOptions(r);
13380
+ ge.setOptions(r);
13375
13381
  });
13376
13382
  };
13377
- me.walkTokens = function(e, t) {
13383
+ ge.walkTokens = function(e, t) {
13378
13384
  let n = [];
13379
13385
  for (const r of e)
13380
- switch (n = n.concat(t.call(me, r)), r.type) {
13386
+ switch (n = n.concat(t.call(ge, r)), r.type) {
13381
13387
  case "table": {
13382
13388
  for (const o of r.header)
13383
- n = n.concat(me.walkTokens(o.tokens, t));
13389
+ n = n.concat(ge.walkTokens(o.tokens, t));
13384
13390
  for (const o of r.rows)
13385
13391
  for (const s of o)
13386
- n = n.concat(me.walkTokens(s.tokens, t));
13392
+ n = n.concat(ge.walkTokens(s.tokens, t));
13387
13393
  break;
13388
13394
  }
13389
13395
  case "list": {
13390
- n = n.concat(me.walkTokens(r.items, t));
13396
+ n = n.concat(ge.walkTokens(r.items, t));
13391
13397
  break;
13392
13398
  }
13393
13399
  default:
13394
- me.defaults.extensions && me.defaults.extensions.childTokens && me.defaults.extensions.childTokens[r.type] ? me.defaults.extensions.childTokens[r.type].forEach(function(o) {
13395
- n = n.concat(me.walkTokens(r[o], t));
13396
- }) : r.tokens && (n = n.concat(me.walkTokens(r.tokens, t)));
13400
+ ge.defaults.extensions && ge.defaults.extensions.childTokens && ge.defaults.extensions.childTokens[r.type] ? ge.defaults.extensions.childTokens[r.type].forEach(function(o) {
13401
+ n = n.concat(ge.walkTokens(r[o], t));
13402
+ }) : r.tokens && (n = n.concat(ge.walkTokens(r.tokens, t)));
13397
13403
  }
13398
13404
  return n;
13399
13405
  };
13400
- me.parseInline = jp(Wn.lexInline, Vn.parseInline);
13401
- me.Parser = Vn;
13402
- me.parser = Vn.parse;
13403
- me.Renderer = nl;
13404
- me.TextRenderer = Ap;
13405
- me.Lexer = Wn;
13406
- me.lexer = Wn.lex;
13407
- me.Tokenizer = tl;
13408
- me.Slugger = _p;
13409
- me.Hooks = ds;
13410
- me.parse = me;
13411
- me.options;
13412
- me.setOptions;
13413
- me.use;
13414
- me.walkTokens;
13415
- me.parseInline;
13406
+ ge.parseInline = jp(Wn.lexInline, Vn.parseInline);
13407
+ ge.Parser = Vn;
13408
+ ge.parser = Vn.parse;
13409
+ ge.Renderer = nl;
13410
+ ge.TextRenderer = Ap;
13411
+ ge.Lexer = Wn;
13412
+ ge.lexer = Wn.lex;
13413
+ ge.Tokenizer = tl;
13414
+ ge.Slugger = _p;
13415
+ ge.Hooks = ds;
13416
+ ge.parse = ge;
13417
+ ge.options;
13418
+ ge.setOptions;
13419
+ ge.use;
13420
+ ge.walkTokens;
13421
+ ge.parseInline;
13416
13422
  Vn.parse;
13417
13423
  Wn.lex;
13418
13424
  function fs({
@@ -13425,9 +13431,9 @@ function fs({
13425
13431
  try {
13426
13432
  if (!n) {
13427
13433
  const i = e.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, "").replace(/<iframe\b[^<]*(?:(?!<\/iframe>)<[^<]*)*<\/iframe>/gi, "").replace(/javascript:/gi, "").replace(/on\w+\s*=/gi, "");
13428
- return typeof me.parse == "function" ? me.parse(i) : me(i);
13434
+ return typeof ge.parse == "function" ? ge.parse(i) : ge(i);
13429
13435
  }
13430
- return typeof me.parse == "function" ? me.parse(e) : me(e);
13436
+ return typeof ge.parse == "function" ? ge.parse(e) : ge(e);
13431
13437
  } catch (i) {
13432
13438
  return console.error("[MarkdownContent] parse error", i), `<pre class="font-mono text-xs bg-background/50 rounded border p-2 whitespace-pre-wrap break-words">Error rendering markdown: ${String(i)}</pre>`;
13433
13439
  }
@@ -13534,7 +13540,7 @@ function zc(e) {
13534
13540
  }
13535
13541
  function RC({ className: e }) {
13536
13542
  const [t, n] = ye(0);
13537
- return St(() => {
13543
+ return Ct(() => {
13538
13544
  const r = setInterval(() => n((o) => (o + 1) % 4), 500);
13539
13545
  return () => clearInterval(r);
13540
13546
  }, []), /* @__PURE__ */ u.jsxs(
@@ -13604,7 +13610,7 @@ const Bc = z.memo(function({
13604
13610
  ), Z = at(
13605
13611
  () => X ? [] : t.content.filter((W) => W.type === "interrupt"),
13606
13612
  [X, t]
13607
- ), ue = (g == null ? void 0 : g.id) ?? (g == null ? void 0 : g.interrupt_id), Ie = Oo(ue), ke = g == null ? void 0 : g.value, $e = at(() => X ? "" : TC(t.content), [X, t]), Ze = z.useCallback(async () => {
13613
+ ), ue = (g == null ? void 0 : g.id) ?? (g == null ? void 0 : g.interrupt_id), Ie = Oo(ue), ke = g == null ? void 0 : g.value, $e = at(() => X ? "" : TC(t.content), [X, t]), Je = z.useCallback(async () => {
13608
13614
  const W = J ? $e : te;
13609
13615
  async function we(xe) {
13610
13616
  if (navigator.clipboard && typeof navigator.clipboard.writeText == "function") {
@@ -13612,10 +13618,10 @@ const Bc = z.memo(function({
13612
13618
  return;
13613
13619
  }
13614
13620
  if (navigator.clipboard && typeof navigator.clipboard.write == "function" && typeof ClipboardItem < "u") {
13615
- const pt = new Blob([xe], { type: "text/plain" });
13621
+ const ht = new Blob([xe], { type: "text/plain" });
13616
13622
  await navigator.clipboard.write([
13617
13623
  new ClipboardItem({
13618
- "text/plain": pt
13624
+ "text/plain": ht
13619
13625
  })
13620
13626
  ]);
13621
13627
  return;
@@ -13648,7 +13654,7 @@ const Bc = z.memo(function({
13648
13654
  default:
13649
13655
  return /* @__PURE__ */ u.jsx(si, { className: we });
13650
13656
  }
13651
- }, [D, H, O]), Qe = z.useCallback(() => {
13657
+ }, [D, H, O]), Ze = z.useCallback(() => {
13652
13658
  const W = "group relative mb-4 flex w-full";
13653
13659
  switch (O) {
13654
13660
  case "user":
@@ -13701,7 +13707,7 @@ const Bc = z.memo(function({
13701
13707
  }
13702
13708
  }, [D, de, O]);
13703
13709
  if (de && X)
13704
- return /* @__PURE__ */ u.jsx("div", { className: Q(Qe(), p.container), children: /* @__PURE__ */ u.jsxs("div", { className: Q(qe(), p.content), children: [
13710
+ return /* @__PURE__ */ u.jsx("div", { className: Q(Ze(), p.container), children: /* @__PURE__ */ u.jsxs("div", { className: Q(qe(), p.content), children: [
13705
13711
  /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2 mb-2 pb-2 border-b border-current/10", children: [
13706
13712
  /* @__PURE__ */ u.jsx(si, { className: Q("h-4 w-4", H) }),
13707
13713
  a && /* @__PURE__ */ u.jsx("span", { className: "font-medium text-sm", children: "Assistant" })
@@ -13714,7 +13720,7 @@ const Bc = z.memo(function({
13714
13720
  }
13715
13721
  )
13716
13722
  ] }) });
13717
- const nt = z.useCallback(async (W) => {
13723
+ const tt = z.useCallback(async (W) => {
13718
13724
  if (w)
13719
13725
  return;
13720
13726
  const we = Oo(
@@ -13731,7 +13737,7 @@ const Bc = z.memo(function({
13731
13737
  } finally {
13732
13738
  T == null || T();
13733
13739
  }
13734
- }, [w, T, b, B]), Nt = z.useCallback(async (W) => {
13740
+ }, [w, T, b, B]), At = z.useCallback(async (W) => {
13735
13741
  if (w)
13736
13742
  return;
13737
13743
  const we = Oo(
@@ -13748,13 +13754,13 @@ const Bc = z.memo(function({
13748
13754
  } finally {
13749
13755
  T == null || T();
13750
13756
  }
13751
- }, [w, T, b, B]), ht = z.useCallback(({ part: W, i: we }) => {
13757
+ }, [w, T, b, B]), mt = z.useCallback(({ part: W, i: we }) => {
13752
13758
  if (W.type === "text") {
13753
- const xe = W.text ?? "", pt = xe.trim(), mt = Ja(pt);
13754
- return mt && O !== "tool" ? /* @__PURE__ */ u.jsx(Op, { data: mt }, we) : O === "user" && c && pt.length > d ? /* @__PURE__ */ u.jsx(
13759
+ const xe = W.text ?? "", ht = xe.trim(), xt = Ja(ht);
13760
+ return xt && O !== "tool" ? /* @__PURE__ */ u.jsx(Op, { data: xt }, we) : O === "user" && c && ht.length > d ? /* @__PURE__ */ u.jsx(
13755
13761
  NC,
13756
13762
  {
13757
- text: pt,
13763
+ text: ht,
13758
13764
  expanded: _,
13759
13765
  onExpandedChange: $,
13760
13766
  previewLength: d,
@@ -13776,18 +13782,18 @@ const Bc = z.memo(function({
13776
13782
  ) }, we);
13777
13783
  }
13778
13784
  if (W.type === "file") {
13779
- const xe = W, pt = xe.name || "file";
13785
+ const xe = W, ht = xe.name || "file";
13780
13786
  return /* @__PURE__ */ u.jsxs(
13781
13787
  "a",
13782
13788
  {
13783
13789
  href: xe.url,
13784
- onClick: (mt) => K(mt, xe, we),
13790
+ onClick: (xt) => K(xt, xe, we),
13785
13791
  className: `inline-flex items-center gap-2 rounded px-2 py-1 text-xs bg-gray-100 border hover:bg-gray-200
13786
13792
  dark:bg-background/10 dark:border-border/30 dark:hover:bg-background/20`,
13787
13793
  children: [
13788
13794
  Ae[we] ? /* @__PURE__ */ u.jsx(ua, { className: "h-4 w-4 animate-spin" }) : null,
13789
13795
  /* @__PURE__ */ u.jsxs("span", { className: "truncate max-w-[180px]", children: [
13790
- pt,
13796
+ ht,
13791
13797
  Ae[we] ? " (processing)" : ""
13792
13798
  ] })
13793
13799
  ]
@@ -13796,18 +13802,18 @@ const Bc = z.memo(function({
13796
13802
  );
13797
13803
  }
13798
13804
  if (W.type === "interrupt") {
13799
- const xe = W, pt = Oo(
13805
+ const xe = W, ht = Oo(
13800
13806
  (xe == null ? void 0 : xe.id) ?? (xe == null ? void 0 : xe.interrupt_id)
13801
- ), mt = !!(Ie && pt && pt === Ie), Ct = mt ? ke ?? (xe == null ? void 0 : xe.value) : xe == null ? void 0 : xe.value, Oe = pt ? { ...xe, id: pt, interrupt_id: pt } : xe;
13807
+ ), xt = !!(Ie && ht && ht === Ie), Tt = xt ? ke ?? (xe == null ? void 0 : xe.value) : xe == null ? void 0 : xe.value, Oe = ht ? { ...xe, id: ht, interrupt_id: ht } : xe;
13802
13808
  return /* @__PURE__ */ u.jsx(
13803
13809
  EC,
13804
13810
  {
13805
13811
  interruptPart: Oe,
13806
- onApprove: nt,
13807
- onReject: Nt,
13812
+ onApprove: tt,
13813
+ onReject: At,
13808
13814
  disabled: w,
13809
- isActive: mt,
13810
- payload: Ct
13815
+ isActive: xt,
13816
+ payload: Tt
13811
13817
  },
13812
13818
  we
13813
13819
  );
@@ -13816,8 +13822,8 @@ const Bc = z.memo(function({
13816
13822
  }, [
13817
13823
  K,
13818
13824
  Ae,
13819
- nt,
13820
- Nt,
13825
+ tt,
13826
+ At,
13821
13827
  O,
13822
13828
  c,
13823
13829
  d,
@@ -13847,7 +13853,7 @@ const Bc = z.memo(function({
13847
13853
  t.id
13848
13854
  );
13849
13855
  if (!J && !X) {
13850
- const we = t, xe = /* @__PURE__ */ u.jsx("div", { className: "space-y-2", children: we.content.map((pt, mt) => /* @__PURE__ */ u.jsx(ht, { part: pt, i: mt }, mt)) });
13856
+ const we = t, xe = /* @__PURE__ */ u.jsx("div", { className: "space-y-2", children: we.content.map((ht, xt) => /* @__PURE__ */ u.jsx(mt, { part: ht, i: xt }, xt)) });
13851
13857
  return r ? /* @__PURE__ */ u.jsxs("div", { "aria-busy": "true", role: "status", children: [
13852
13858
  xe,
13853
13859
  /* @__PURE__ */ u.jsx(RC, { className: H })
@@ -13863,34 +13869,34 @@ const Bc = z.memo(function({
13863
13869
  L,
13864
13870
  lt,
13865
13871
  H
13866
- ]), ge = at(() => X ? "Assistant" : kC(t), [X, t]), he = z.useMemo(() => X ? [] : Array.isArray(C) ? C : [], [C, X]), je = z.useMemo(() => {
13872
+ ]), pe = at(() => X ? "Assistant" : kC(t), [X, t]), me = z.useMemo(() => X ? [] : Array.isArray(C) ? C : [], [C, X]), je = z.useMemo(() => {
13867
13873
  var W;
13868
- return he.length ? N && he.some((we) => we.id === N) ? N : ((W = he[0]) == null ? void 0 : W.id) ?? null : null;
13869
- }, [N, he]), At = z.useMemo(() => !he.length || !S ? null : he.some((W) => W.id === S) ? S : null, [S, he]) ?? je, yt = O === "user" && he.length > 0 && typeof k == "function", et = z.useCallback(
13874
+ return me.length ? N && me.some((we) => we.id === N) ? N : ((W = me[0]) == null ? void 0 : W.id) ?? null : null;
13875
+ }, [N, me]), rt = z.useMemo(() => !me.length || !S ? null : me.some((W) => W.id === S) ? S : null, [S, me]) ?? je, ut = O === "user" && me.length > 0 && typeof k == "function", Qe = z.useCallback(
13870
13876
  (W) => {
13871
13877
  if (!k) return;
13872
13878
  const we = (W == null ? void 0 : W.id) ?? null, xe = (W == null ? void 0 : W.parentId) ?? I ?? null;
13873
13879
  k(we, xe);
13874
13880
  },
13875
13881
  [I, k]
13876
- ), ze = z.useMemo(() => At ? he.findIndex((W) => W.id === At) : -1, [At, he]), Pt = z.useMemo(() => ze < 0 ? null : he[ze] ?? null, [ze, he]), _t = z.useCallback((W) => {
13882
+ ), ze = z.useMemo(() => rt ? me.findIndex((W) => W.id === rt) : -1, [rt, me]), Pt = z.useMemo(() => ze < 0 ? null : me[ze] ?? null, [ze, me]), _t = z.useCallback((W) => {
13877
13883
  const we = [];
13878
13884
  if (W.step !== null && we.push(`Step ${W.step}`), W.source && we.push(W.source), !W.createdAt)
13879
13885
  return we.length ? we.join(" • ") : W.id.slice(0, 8);
13880
13886
  let xe = "";
13881
13887
  try {
13882
- const pt = new Date(W.createdAt);
13883
- Number.isNaN(pt.getTime()) || (xe = new Intl.DateTimeFormat(void 0, {
13888
+ const ht = new Date(W.createdAt);
13889
+ Number.isNaN(ht.getTime()) || (xe = new Intl.DateTimeFormat(void 0, {
13884
13890
  hour: "2-digit",
13885
13891
  minute: "2-digit"
13886
- }).format(pt));
13892
+ }).format(ht));
13887
13893
  } catch {
13888
13894
  xe = "";
13889
13895
  }
13890
13896
  return `${xe}`;
13891
13897
  }, []);
13892
13898
  return J && !f ? null : /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
13893
- /* @__PURE__ */ u.jsx("div", { className: Q(Qe(), p.container), children: /* @__PURE__ */ u.jsxs("div", { className: Q(qe(), p.content), children: [
13899
+ /* @__PURE__ */ u.jsx("div", { className: Q(Ze(), p.container), children: /* @__PURE__ */ u.jsxs("div", { className: Q(qe(), p.content), children: [
13894
13900
  (i || a || J) && /* @__PURE__ */ u.jsxs(
13895
13901
  "div",
13896
13902
  {
@@ -13903,7 +13909,7 @@ const Bc = z.memo(function({
13903
13909
  children: [
13904
13910
  /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2", children: [
13905
13911
  Ue(),
13906
- a && ge && /* @__PURE__ */ u.jsx("span", { className: Q("font-medium", D ? "text-xs" : "text-sm"), children: ge }),
13912
+ a && pe && /* @__PURE__ */ u.jsx("span", { className: Q("font-medium", D ? "text-xs" : "text-sm"), children: pe }),
13907
13913
  J && /* @__PURE__ */ u.jsxs(
13908
13914
  Zf,
13909
13915
  {
@@ -13930,7 +13936,7 @@ const Bc = z.memo(function({
13930
13936
  )
13931
13937
  ] }),
13932
13938
  /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2", children: [
13933
- yt && Pt && ze >= 0 && /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2 text-xs", children: [
13939
+ ut && Pt && ze >= 0 && /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2 text-xs", children: [
13934
13940
  /* @__PURE__ */ u.jsx(
13935
13941
  "button",
13936
13942
  {
@@ -13941,8 +13947,8 @@ const Bc = z.memo(function({
13941
13947
  ),
13942
13948
  onClick: () => {
13943
13949
  if (ze <= 0) return;
13944
- const W = he[ze - 1];
13945
- W && et(W);
13950
+ const W = me[ze - 1];
13951
+ W && Qe(W);
13946
13952
  },
13947
13953
  "aria-label": "Previous checkpoint",
13948
13954
  disabled: ze <= 0,
@@ -13953,7 +13959,7 @@ const Bc = z.memo(function({
13953
13959
  /* @__PURE__ */ u.jsxs("span", { className: "whitespace-nowrap", children: [
13954
13960
  ze + 1,
13955
13961
  " / ",
13956
- he.length
13962
+ me.length
13957
13963
  ] }),
13958
13964
  /* @__PURE__ */ u.jsx("span", { className: "text-muted-foreground", children: _t(Pt) })
13959
13965
  ] }),
@@ -13963,15 +13969,15 @@ const Bc = z.memo(function({
13963
13969
  type: "button",
13964
13970
  className: Q(
13965
13971
  "flex items-center justify-center rounded border px-1.5 py-1 transition-colors",
13966
- ze < he.length - 1 ? "border-border text-foreground hover:bg-muted/60" : "border-border text-muted-foreground cursor-not-allowed"
13972
+ ze < me.length - 1 ? "border-border text-foreground hover:bg-muted/60" : "border-border text-muted-foreground cursor-not-allowed"
13967
13973
  ),
13968
13974
  onClick: () => {
13969
- if (ze >= he.length - 1) return;
13970
- const W = he[ze + 1];
13971
- W && et(W);
13975
+ if (ze >= me.length - 1) return;
13976
+ const W = me[ze + 1];
13977
+ W && Qe(W);
13972
13978
  },
13973
13979
  "aria-label": "Next checkpoint",
13974
- disabled: ze >= he.length - 1,
13980
+ disabled: ze >= me.length - 1,
13975
13981
  children: /* @__PURE__ */ u.jsx(Xc, { className: "h-3 w-3" })
13976
13982
  }
13977
13983
  )
@@ -13999,7 +14005,7 @@ const Bc = z.memo(function({
13999
14005
  {
14000
14006
  variant: "ghost",
14001
14007
  size: "sm",
14002
- onClick: () => Ze(),
14008
+ onClick: () => Je(),
14003
14009
  className: Q("h-6 w-6 p-0 hover:bg-foreground/10", H, D && "h-5 w-5"),
14004
14010
  "aria-label": "Copy message",
14005
14011
  title: "Copy message",
@@ -14060,7 +14066,7 @@ const Bc = z.memo(function({
14060
14066
  {
14061
14067
  variant: "ghost",
14062
14068
  size: "sm",
14063
- onClick: () => Ze(),
14069
+ onClick: () => Je(),
14064
14070
  className: Q("h-6 w-6 p-0 hover:bg-background/50 text-current", D && "h-5 w-5"),
14065
14071
  children: /* @__PURE__ */ u.jsx(dl, { className: Q(E ? "text-success" : "text-current", D ? "h-3 w-3" : "h-4 w-4") })
14066
14072
  }
@@ -14365,7 +14371,7 @@ const Hc = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, _C = (e) =>
14365
14371
  onSelectCheckpoint: E,
14366
14372
  timelineCheckpoints: j
14367
14373
  }, L) => {
14368
- const F = Je(null), _ = Je(null), $ = Je(!1), [A, B] = ye(!0), D = at(() => w ? e.some((Z) => "type" in Z && Z.type === "default_message" ? !1 : Array.isArray(Z == null ? void 0 : Z.content) && Z.content.some(
14374
+ const F = Xe(null), _ = Xe(null), $ = Xe(!1), [A, B] = ye(!0), D = at(() => w ? e.some((Z) => "type" in Z && Z.type === "default_message" ? !1 : Array.isArray(Z == null ? void 0 : Z.content) && Z.content.some(
14369
14375
  (ue) => ue && ue.type === "interrupt" && (ue.id ?? ue.interrupt_id) === w.id
14370
14376
  )) : !1, [w, e]), O = at(() => {
14371
14377
  if (!w || D)
@@ -14399,8 +14405,8 @@ const Hc = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, _C = (e) =>
14399
14405
  ue.push(ke);
14400
14406
  continue;
14401
14407
  }
14402
- const $e = ke, Ze = _C($e);
14403
- Z.has(Ze) || (Z.add(Ze), ue.push($e));
14408
+ const $e = ke, Je = _C($e);
14409
+ Z.has(Je) || (Z.add(Je), ue.push($e));
14404
14410
  }
14405
14411
  return ue.reverse();
14406
14412
  }, [X]), Ee = Ne((Z) => {
@@ -14543,18 +14549,18 @@ const Hc = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, _C = (e) =>
14543
14549
  style: { height: "100%", overscrollBehavior: "contain" },
14544
14550
  computeItemKey: (Z, ue) => Hc(ue, Z),
14545
14551
  itemContent: (Z, ue) => {
14546
- var nt;
14552
+ var tt;
14547
14553
  const Ie = Hc(ue, Z), ke = "type" in ue && ue.type === "default_message";
14548
- let $e = [], Ze = null, He = {}, Ke = {}, Ue = null, Qe = null;
14554
+ let $e = [], Je = null, He = {}, Ke = {}, Ue = null, Ze = null;
14549
14555
  if (!ke) {
14550
- const Nt = ue, ht = Nt.checkpointId ?? null;
14551
- He = Nt.additionalKwargs ?? {}, Ke = Nt.responseMetadata ?? {};
14552
- const lt = ht && k ? k.get(ht) ?? null : null;
14556
+ const At = ue, mt = At.checkpointId ?? null;
14557
+ He = At.additionalKwargs ?? {}, Ke = At.responseMetadata ?? {};
14558
+ const lt = mt && k ? k.get(mt) ?? null : null;
14553
14559
  Ue = typeof He.step == "number" ? He.step : typeof Ke.step == "number" ? Ke.step : (lt == null ? void 0 : lt.step) ?? null;
14554
14560
  const fe = typeof He.source == "string" ? He.source : typeof Ke.source == "string" ? Ke.source : (lt == null ? void 0 : lt.source) ?? null;
14555
- Qe = fe ? String(fe) : null;
14556
- const ge = Ue !== null && Qe ? `${Ue}:${Qe}` : null;
14557
- ge && (N != null && N.has(ge)) ? $e = N.get(ge) ?? [] : ht && lt && ($e = [lt]), Ze = ht ?? ((nt = $e[0]) == null ? void 0 : nt.id) ?? null;
14561
+ Ze = fe ? String(fe) : null;
14562
+ const pe = Ue !== null && Ze ? `${Ue}:${Ze}` : null;
14563
+ pe && (N != null && N.has(pe)) ? $e = N.get(pe) ?? [] : mt && lt && ($e = [lt]), Je = mt ?? ((tt = $e[0]) == null ? void 0 : tt.id) ?? null;
14558
14564
  }
14559
14565
  const qe = (() => {
14560
14566
  if (typeof He.parentCheckpointId == "string")
@@ -14594,7 +14600,7 @@ const Hc = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, _C = (e) =>
14594
14600
  checkpointCandidates: $e,
14595
14601
  activeCheckpointId: I ?? null,
14596
14602
  onSelectCheckpoint: E,
14597
- defaultCheckpointId: Ze,
14603
+ defaultCheckpointId: Je,
14598
14604
  messageParentCheckpointId: qe
14599
14605
  }
14600
14606
  )
@@ -14640,16 +14646,16 @@ function Ai({
14640
14646
  interrupt: j,
14641
14647
  metadata: L
14642
14648
  } = ya(), { isStreaming: F, error: _, connectionState: $, submit: A, stop: B } = Jx(), D = g ?? m ?? null, O = (I == null ? void 0 : I.id) ?? null, J = (I == null ? void 0 : I.namespace) ?? null, X = (L == null ? void 0 : L.assemblingMessageId) ?? null, de = j, [Ee, Ae] = ye(!1);
14643
- St(() => {
14649
+ Ct(() => {
14644
14650
  de || Ae(!1);
14645
14651
  }, [de]);
14646
14652
  const K = Ne(() => {
14647
14653
  Ae(!0);
14648
14654
  }, []), ee = Ne(() => {
14649
14655
  Ae(!1);
14650
- }, []), q = !!de || Ee, [M, H] = ye(null), [te, oe] = ye(""), [ne, Te] = ye(null), [Z, ue] = ye(null), [Ie, ke] = ye([]), [$e, Ze] = ye(0), [He, Ke] = ye(0), [Ue, Qe] = ye(!1), [qe, nt] = ye(null), [Nt, ht] = ye(null), [lt, fe] = ye(!1), [ge, he] = ye(null), [je, Xe] = ye(!1), At = Je(!1), [yt, et] = ye(() => Uc.value), ze = Je(yt), Pt = Je(null), _t = Ne((G) => {
14651
- Uc.value = G, et(G);
14652
- }, []), [W, we] = ye(!1), xe = Je(null), pt = Ne((G) => {
14656
+ }, []), q = !!de || Ee, [M, H] = ye(null), [te, oe] = ye(""), [ne, Te] = ye(null), [Z, ue] = ye(null), [Ie, ke] = ye([]), [$e, Je] = ye(0), [He, Ke] = ye(0), [Ue, Ze] = ye(!1), [qe, tt] = ye(null), [At, mt] = ye(null), [lt, fe] = ye(!1), [pe, me] = ye(null), [je, gt] = ye(!1), rt = Xe(!1), [ut, Qe] = ye(() => Uc.value), ze = Xe(ut), Pt = Xe(null), _t = Ne((G) => {
14657
+ Uc.value = G, Qe(G);
14658
+ }, []), [W, we] = ye(!1), xe = Xe(null), ht = Ne((G) => {
14653
14659
  if (!Array.isArray(G))
14654
14660
  return { text: null, messageId: null };
14655
14661
  for (let re = G.length - 1; re >= 0; re--) {
@@ -14662,14 +14668,14 @@ function Ai({
14662
14668
  };
14663
14669
  }
14664
14670
  return { text: null, messageId: null };
14665
- }, []), mt = Ne(
14671
+ }, []), xt = Ne(
14666
14672
  (G, re) => {
14667
14673
  if (!G || typeof G != "object") return null;
14668
14674
  const ie = G[re];
14669
14675
  return typeof ie == "number" ? ie : null;
14670
14676
  },
14671
14677
  []
14672
- ), Ct = Ne(
14678
+ ), Tt = Ne(
14673
14679
  (G, re) => {
14674
14680
  if (!G || typeof G != "object") return null;
14675
14681
  const ie = G[re];
@@ -14680,120 +14686,120 @@ function Ai({
14680
14686
  const G = (Se) => {
14681
14687
  if (!Array.isArray(Se) || Se.length === 0)
14682
14688
  return null;
14683
- const ut = Se.map((Ye) => {
14689
+ const dt = Se.map((Ye) => {
14684
14690
  if (typeof Ye == "string")
14685
14691
  return Ye.trim();
14686
14692
  if (Ye && typeof Ye == "object" && "type" in Ye) {
14687
- const rt = Ye;
14688
- if (typeof rt.type == "string")
14689
- return rt.type;
14693
+ const nt = Ye;
14694
+ if (typeof nt.type == "string")
14695
+ return nt.type;
14690
14696
  }
14691
14697
  return null;
14692
14698
  }).filter((Ye) => !!(Ye && Ye.length));
14693
- return ut.length ? ut.join(", ") : null;
14699
+ return dt.length ? dt.join(", ") : null;
14694
14700
  }, re = Array.isArray(E) ? E.map((Se) => {
14695
- const ut = G(Se.next);
14696
- return ut ? {
14701
+ const dt = G(Se.next);
14702
+ return dt ? {
14697
14703
  ...Se,
14698
14704
  metadata: {
14699
14705
  ...Se.metadata ?? {},
14700
- next: ut
14706
+ next: dt
14701
14707
  }
14702
14708
  } : Se;
14703
14709
  }) : [];
14704
- return re.some((Se) => mt(Se.metadata, "step") !== null) && re.sort((Se, ut) => {
14705
- const Ye = mt(Se.metadata, "step"), rt = mt(ut.metadata, "step");
14706
- if (Ye !== null || rt !== null)
14707
- return (rt ?? Number.NEGATIVE_INFINITY) - (Ye ?? Number.NEGATIVE_INFINITY);
14708
- const Mt = Date.parse(Se.createdAt ?? ""), tn = Date.parse(ut.createdAt ?? "");
14710
+ return re.some((Se) => xt(Se.metadata, "step") !== null) && re.sort((Se, dt) => {
14711
+ const Ye = xt(Se.metadata, "step"), nt = xt(dt.metadata, "step");
14712
+ if (Ye !== null || nt !== null)
14713
+ return (nt ?? Number.NEGATIVE_INFINITY) - (Ye ?? Number.NEGATIVE_INFINITY);
14714
+ const Mt = Date.parse(Se.createdAt ?? ""), tn = Date.parse(dt.createdAt ?? "");
14709
14715
  return Number.isNaN(Mt) || Number.isNaN(tn) ? 0 : tn - Mt;
14710
14716
  }), re;
14711
- }, [E, mt]), { checkpointMetaById: Vt, checkpointIndexByKey: ct } = at(() => {
14717
+ }, [E, xt]), { checkpointMetaById: Vt, checkpointIndexByKey: ct } = at(() => {
14712
14718
  const G = /* @__PURE__ */ new Map(), re = /* @__PURE__ */ new Map();
14713
14719
  for (const ie of Oe) {
14714
14720
  const Se = ie.checkpointId ?? null;
14715
14721
  if (!Se) continue;
14716
- const ut = mt(ie.metadata, "step"), Ye = Ct(ie.metadata, "source"), rt = {
14722
+ const dt = xt(ie.metadata, "step"), Ye = Tt(ie.metadata, "source"), nt = {
14717
14723
  id: Se,
14718
- step: ut,
14724
+ step: dt,
14719
14725
  source: Ye,
14720
14726
  createdAt: ie.createdAt ?? null,
14721
14727
  namespace: ie.checkpointNs ?? null,
14722
14728
  parentId: ie.parentId ?? null
14723
14729
  };
14724
- if (G.set(Se, rt), ut !== null && Ye) {
14725
- const Mt = `${ut}:${Ye}`, tn = re.get(Mt) ?? [];
14726
- tn.push(rt), re.set(Mt, tn);
14730
+ if (G.set(Se, nt), dt !== null && Ye) {
14731
+ const Mt = `${dt}:${Ye}`, tn = re.get(Mt) ?? [];
14732
+ tn.push(nt), re.set(Mt, tn);
14727
14733
  }
14728
14734
  }
14729
14735
  for (const ie of re.values())
14730
- ie.sort((Se, ut) => {
14736
+ ie.sort((Se, dt) => {
14731
14737
  const Ye = Se.createdAt ?? "";
14732
- return (ut.createdAt ?? "").localeCompare(Ye);
14738
+ return (dt.createdAt ?? "").localeCompare(Ye);
14733
14739
  });
14734
14740
  return { checkpointMetaById: G, checkpointIndexByKey: re };
14735
- }, [Oe, mt, Ct]), Tt = at(() => {
14741
+ }, [Oe, xt, Tt]), kt = at(() => {
14736
14742
  var Ye;
14737
14743
  if (!Oe.length) return [];
14738
- const G = [...Oe].reverse(), re = (rt, Mt) => {
14739
- const tn = rt.checkpointId ?? null;
14744
+ const G = [...Oe].reverse(), re = (nt, Mt) => {
14745
+ const tn = nt.checkpointId ?? null;
14740
14746
  if (!tn) return null;
14741
- const Zn = Ct(rt.metadata, "source");
14742
- Ct(rt.metadata, "next");
14743
- const { text: ll, messageId: nm } = pt(rt.messages), oi = ll && ll.replace(/\s+/g, " ").trim() || Ct(rt.metadata, "title") || Ct(rt.metadata, "label") || Mt || Zn || "Checkpoint", rm = oi.length > 60 ? `${oi.slice(0, 57)}…` : oi;
14747
+ const Zn = Tt(nt.metadata, "source");
14748
+ Tt(nt.metadata, "next");
14749
+ const { text: ll, messageId: nm } = ht(nt.messages), oi = ll && ll.replace(/\s+/g, " ").trim() || Tt(nt.metadata, "title") || Tt(nt.metadata, "label") || Mt || Zn || "Checkpoint", rm = oi.length > 60 ? `${oi.slice(0, 57)}…` : oi;
14744
14750
  return {
14745
14751
  id: tn,
14746
14752
  label: rm,
14747
14753
  messageId: nm ?? null,
14748
- createdAt: rt.createdAt ?? null,
14749
- step: mt(rt.metadata, "step"),
14754
+ createdAt: nt.createdAt ?? null,
14755
+ step: xt(nt.metadata, "step"),
14750
14756
  source: Zn ?? null,
14751
- next: Ct(rt.metadata, "next")
14757
+ next: Tt(nt.metadata, "next")
14752
14758
  };
14753
14759
  }, ie = [], Se = /* @__PURE__ */ new Set();
14754
- for (const rt of G) {
14755
- const Mt = ((Ye = Ct(rt.metadata, "source")) == null ? void 0 : Ye.toLowerCase()) ?? null;
14760
+ for (const nt of G) {
14761
+ const Mt = ((Ye = Tt(nt.metadata, "source")) == null ? void 0 : Ye.toLowerCase()) ?? null;
14756
14762
  if (!(Mt === "input" || Mt === "user_input" || Mt === "user")) continue;
14757
- const Zn = re(rt, "User input");
14763
+ const Zn = re(nt, "User input");
14758
14764
  Zn && !Se.has(Zn.id) && (ie.push(Zn), Se.add(Zn.id));
14759
14765
  }
14760
14766
  if (!ie.length)
14761
- for (const rt of G) {
14762
- const Mt = re(rt);
14767
+ for (const nt of G) {
14768
+ const Mt = re(nt);
14763
14769
  Mt && !Se.has(Mt.id) && (ie.push(Mt), Se.add(Mt.id));
14764
14770
  }
14765
- const ut = Oe.find((rt) => {
14771
+ const dt = Oe.find((nt) => {
14766
14772
  var tn;
14767
- return (((tn = Ct(rt.metadata, "source")) == null ? void 0 : tn.toLowerCase()) ?? null) === "loop";
14773
+ return (((tn = Tt(nt.metadata, "source")) == null ? void 0 : tn.toLowerCase()) ?? null) === "loop";
14768
14774
  });
14769
- if (ut) {
14770
- const rt = re(ut, "Latest loop");
14771
- rt && !Se.has(rt.id) && (ie.push(rt), Se.add(rt.id));
14775
+ if (dt) {
14776
+ const nt = re(dt, "Latest loop");
14777
+ nt && !Se.has(nt.id) && (ie.push(nt), Se.add(nt.id));
14772
14778
  }
14773
14779
  return ie;
14774
- }, [Oe, pt, mt, Ct]), Dn = Je(null), Jn = Je(null), Ln = Ne(() => {
14775
- Dn.current && (Dn.current.value = ""), Jn.current && (Jn.current.value = ""), Ze((G) => G + 1), Ke((G) => G + 1);
14780
+ }, [Oe, ht, xt, Tt]), Dn = Xe(null), Jn = Xe(null), Ln = Ne(() => {
14781
+ Dn.current && (Dn.current.value = ""), Jn.current && (Jn.current.value = ""), Je((G) => G + 1), Ke((G) => G + 1);
14776
14782
  }, []), ti = Ne(
14777
14783
  (G) => {
14778
14784
  _t(G);
14779
14785
  },
14780
14786
  [_t]
14781
- ), bo = Je(!1);
14782
- St(() => {
14787
+ ), bo = Xe(!1);
14788
+ Ct(() => {
14783
14789
  bo.current && !F && (ke([]), Ln()), bo.current = F;
14784
14790
  }, [F, Ln]);
14785
14791
  const [ni, ri] = ye("desktop");
14786
- St(() => {
14792
+ Ct(() => {
14787
14793
  const G = () => {
14788
14794
  const re = window.innerWidth;
14789
14795
  ri(re < 640 ? "phone" : re < 1024 ? "tablet" : "desktop");
14790
14796
  };
14791
14797
  return G(), window.addEventListener("resize", G), () => window.removeEventListener("resize", G);
14792
- }, []), St(() => {
14793
- Xe(!1), At.current = !1;
14794
- }, [D]), St(() => {
14795
- ze.current = yt;
14796
- }, [yt]), St(() => {
14798
+ }, []), Ct(() => {
14799
+ gt(!1), rt.current = !1;
14800
+ }, [D]), Ct(() => {
14801
+ ze.current = ut;
14802
+ }, [ut]), Ct(() => {
14797
14803
  if (!M) {
14798
14804
  Pt.current = null;
14799
14805
  return;
@@ -14808,20 +14814,20 @@ function Ai({
14808
14814
  console.warn("loadOlder failed", G);
14809
14815
  }
14810
14816
  }, [b, je, T, S]);
14811
- St(() => {
14817
+ Ct(() => {
14812
14818
  (async () => {
14813
14819
  if (!y.baseUrl) {
14814
- he(null);
14820
+ me(null);
14815
14821
  return;
14816
14822
  }
14817
14823
  try {
14818
14824
  const ie = (await y.getAgent("default")).uiDefaultMessage || "";
14819
- he(ie || null);
14825
+ me(ie || null);
14820
14826
  } catch (re) {
14821
- console.warn("Failed to fetch default message:", re), he(null);
14827
+ console.warn("Failed to fetch default message:", re), me(null);
14822
14828
  }
14823
14829
  })();
14824
- }, [y.baseUrl]), St(() => {
14830
+ }, [y.baseUrl]), Ct(() => {
14825
14831
  _ && !lt && (x == null || x(_));
14826
14832
  }, [_, lt, x]);
14827
14833
  const V = (G) => {
@@ -14843,7 +14849,7 @@ function Ai({
14843
14849
  }
14844
14850
  }
14845
14851
  try {
14846
- const ie = O ?? void 0, Se = J ?? void 0, ut = M ? {
14852
+ const ie = O ?? void 0, Se = J ?? void 0, dt = M ? {
14847
14853
  edit: !0,
14848
14854
  originalMessageId: M,
14849
14855
  ...ne != null && ne.checkpointId ? { originalCheckpointId: ne.checkpointId } : {},
@@ -14853,7 +14859,7 @@ function Ai({
14853
14859
  {
14854
14860
  text: re || "",
14855
14861
  attachments: Ie,
14856
- messageAdditionalKwargs: ut
14862
+ messageAdditionalKwargs: dt
14857
14863
  },
14858
14864
  {
14859
14865
  checkpointId: ie,
@@ -14867,15 +14873,15 @@ function Ai({
14867
14873
  }
14868
14874
  }, be = z.useCallback(
14869
14875
  (G, re, ie) => {
14870
- c && (Pt.current = yt, H(G), oe(re), _t(re), ue(null), Te({
14876
+ c && (Pt.current = ut, H(G), oe(re), _t(re), ue(null), Te({
14871
14877
  checkpointId: (ie == null ? void 0 : ie.checkpointId) ?? null,
14872
14878
  checkpointNs: (ie == null ? void 0 : ie.checkpointNs) ?? null
14873
14879
  }));
14874
14880
  },
14875
- [yt, c, _t]
14881
+ [ut, c, _t]
14876
14882
  ), Ge = z.useCallback(() => {
14877
- H(null), oe(""), Te(null), ue(null), _t(Pt.current ?? yt), Pt.current = null;
14878
- }, [yt, _t]), it = Ne(
14883
+ H(null), oe(""), Te(null), ue(null), _t(Pt.current ?? ut), Pt.current = null;
14884
+ }, [ut, _t]), it = Ne(
14879
14885
  (G, re, ie) => {
14880
14886
  be(G, re, ie);
14881
14887
  },
@@ -14883,15 +14889,15 @@ function Ai({
14883
14889
  ), Be = Ne((G) => {
14884
14890
  for (let re = G - 1; re >= 0; re--)
14885
14891
  if (w[re].role === "user") {
14886
- const ie = w[re].content || [], ut = ie.filter((Ye) => Ye.type === "text").map((Ye) => Ye.text).join("") || (() => {
14892
+ const ie = w[re].content || [], dt = ie.filter((Ye) => Ye.type === "text").map((Ye) => Ye.text).join("") || (() => {
14887
14893
  try {
14888
14894
  return JSON.stringify(ie, null, 2);
14889
14895
  } catch {
14890
14896
  return String(ie);
14891
14897
  }
14892
14898
  })();
14893
- ut && A(
14894
- { text: ut },
14899
+ dt && A(
14900
+ { text: dt },
14895
14901
  {
14896
14902
  checkpointId: O ?? void 0,
14897
14903
  checkpointNs: J ?? void 0
@@ -14904,13 +14910,13 @@ function Ai({
14904
14910
  ke((ie) => [...ie, ...re]), G.target.value = "";
14905
14911
  }, Ot = (G) => {
14906
14912
  ke((re) => {
14907
- const ie = re.filter((Se, ut) => G !== ut);
14913
+ const ie = re.filter((Se, dt) => G !== dt);
14908
14914
  return ie.length === 0 && Ln(), ie;
14909
14915
  });
14910
- }, bt = async (G) => {
14916
+ }, St = async (G) => {
14911
14917
  const re = (G.target.files || [])[0];
14912
14918
  if (re) {
14913
- nt(null), ht(null), Qe(!0);
14919
+ tt(null), mt(null), Ze(!0);
14914
14920
  try {
14915
14921
  await A(
14916
14922
  { attachments: [re] },
@@ -14920,27 +14926,27 @@ function Ai({
14920
14926
  }
14921
14927
  );
14922
14928
  const ie = `Uploaded ${re.name} - processing through chat stream`;
14923
- ht(ie);
14929
+ mt(ie);
14924
14930
  } catch (ie) {
14925
14931
  const Se = ie instanceof Error ? ie.message : "Failed to upload Excel file";
14926
- console.error("Excel upload failed", ie), nt(Se), x == null || x(Se);
14932
+ console.error("Excel upload failed", ie), tt(Se), x == null || x(Se);
14927
14933
  } finally {
14928
- Qe(!1), G.target.value = "", Ln();
14934
+ Ze(!1), G.target.value = "", Ln();
14929
14935
  }
14930
14936
  }
14931
- }, vt = async (G) => {
14937
+ }, wt = async (G) => {
14932
14938
  if (m) {
14933
14939
  we(!0);
14934
14940
  try {
14935
14941
  if (!G) {
14936
- await N(), Xe(!1), requestAnimationFrame(() => {
14942
+ await N(), gt(!1), requestAnimationFrame(() => {
14937
14943
  var Se;
14938
14944
  (Se = xe.current) == null || Se.scrollToLatest();
14939
14945
  });
14940
14946
  return;
14941
14947
  }
14942
14948
  const re = Oe.find((Se) => Se.checkpointId === G), ie = (re == null ? void 0 : re.checkpointNs) ?? null;
14943
- await k(G, ie), Xe(!0), requestAnimationFrame(() => {
14949
+ await k(G, ie), gt(!0), requestAnimationFrame(() => {
14944
14950
  var Se;
14945
14951
  (Se = xe.current) == null || Se.scrollToTop();
14946
14952
  });
@@ -14950,17 +14956,17 @@ function Ai({
14950
14956
  }
14951
14957
  }, Kt = Ne(
14952
14958
  async (G) => {
14953
- await vt(G);
14959
+ await wt(G);
14954
14960
  },
14955
- [vt]
14961
+ [wt]
14956
14962
  ), Fn = `flex flex-1 w-full flex-col min-h-0 min-w-0 max-h-full overflow-hidden bg-transparent ${e} ${f.container || ""}`, Nn = `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 || ""}`, Ft = `flex-shrink-0 w-full border-t p-4 bg-transparent ${f.inputArea || ""}`, Dr = Ne(
14957
14963
  (G) => {
14958
14964
  if (!G)
14959
14965
  return "Latest";
14960
14966
  const re = [];
14961
14967
  G.step !== null && re.push(`Step ${G.step}`), G.source && re.push(G.source);
14962
- const ie = G.createdAt ? new Date(G.createdAt) : null, Se = ie && !Number.isNaN(ie.getTime()) ? ie.toLocaleString() : G.createdAt ?? G.id, ut = re.length ? ` — ${re.join(" • ")}` : "";
14963
- return `${Se}${ut}`;
14968
+ const ie = G.createdAt ? new Date(G.createdAt) : null, Se = ie && !Number.isNaN(ie.getTime()) ? ie.toLocaleString() : G.createdAt ?? G.id, dt = re.length ? ` — ${re.join(" • ")}` : "";
14969
+ return `${Se}${dt}`;
14964
14970
  },
14965
14971
  []
14966
14972
  );
@@ -14988,7 +14994,7 @@ function Ai({
14988
14994
  value: O ?? "",
14989
14995
  onChange: (G) => {
14990
14996
  const re = G.target.value || null;
14991
- vt(re);
14997
+ wt(re);
14992
14998
  },
14993
14999
  children: [
14994
15000
  /* @__PURE__ */ u.jsx("option", { value: "", children: "Latest" }),
@@ -15024,16 +15030,16 @@ function Ai({
15024
15030
  je && R();
15025
15031
  },
15026
15032
  onScrollAway: (G) => {
15027
- if (!At.current) {
15028
- At.current = !0;
15033
+ if (!rt.current) {
15034
+ rt.current = !0;
15029
15035
  return;
15030
15036
  }
15031
- G && Xe(!0);
15037
+ G && gt(!0);
15032
15038
  },
15033
15039
  onEdit: it,
15034
15040
  onRegenerate: Be,
15035
15041
  onCancelEdit: Ge,
15036
- emptyMessage: ge ?? void 0,
15042
+ emptyMessage: pe ?? void 0,
15037
15043
  isNavigatingCheckpoint: W,
15038
15044
  activeInterrupt: de,
15039
15045
  disableInterruptActions: Ee,
@@ -15044,7 +15050,7 @@ function Ai({
15044
15050
  checkpointIndexByKey: ct,
15045
15051
  activeCheckpointId: O,
15046
15052
  onSelectCheckpoint: Kt,
15047
- timelineCheckpoints: Tt
15053
+ timelineCheckpoints: kt
15048
15054
  }
15049
15055
  ),
15050
15056
  ($ === "reconnecting" || $ === "connecting") && /* @__PURE__ */ u.jsx("div", { className: "pointer-events-none absolute top-3 right-3 z-20 rounded-full bg-muted/80 px-3 py-1 text-xs font-medium text-foreground shadow-sm backdrop-blur-sm dark:bg-muted/60", children: /* @__PURE__ */ u.jsxs("span", { className: "flex items-center gap-2", children: [
@@ -15112,7 +15118,7 @@ function Ai({
15112
15118
  ref: Jn,
15113
15119
  type: "file",
15114
15120
  accept: ".xls,.xlsx,.xlsm",
15115
- onChange: bt,
15121
+ onChange: St,
15116
15122
  className: "hidden"
15117
15123
  },
15118
15124
  He
@@ -15121,7 +15127,7 @@ function Ai({
15121
15127
  /* @__PURE__ */ u.jsx(Do, { className: "h-4 w-4 animate-spin" }),
15122
15128
  " Uploading Excel file..."
15123
15129
  ] }),
15124
- Nt && !Ue && /* @__PURE__ */ u.jsx("div", { className: "text-sm rounded border border-emerald-200 bg-emerald-50 px-3 py-2 text-emerald-700", children: Nt }),
15130
+ At && !Ue && /* @__PURE__ */ u.jsx("div", { className: "text-sm rounded border border-emerald-200 bg-emerald-50 px-3 py-2 text-emerald-700", children: At }),
15125
15131
  qe && !Ue && /* @__PURE__ */ u.jsx("div", { className: "text-sm rounded border border-red-200 bg-red-50 px-3 py-2 text-red-600", children: qe })
15126
15132
  ] })
15127
15133
  ] }),
@@ -15169,7 +15175,7 @@ function Ai({
15169
15175
  {
15170
15176
  initialValue: te,
15171
15177
  editingMessageId: M,
15172
- value: yt,
15178
+ value: ut,
15173
15179
  onValueChange: ti,
15174
15180
  placeholder: M ? "Edit your message..." : t,
15175
15181
  isStreaming: F,
@@ -15765,15 +15771,15 @@ function Kc({
15765
15771
  setCurrentThreadId: h,
15766
15772
  isLoading: x,
15767
15773
  actions: y
15768
- } = xa(), { loadThread: m } = ya(), { createThread: g, deleteThread: w, renameThread: b } = y, [T, C] = ye(Array.isArray(f) ? f : []), S = Je(T.length > 0), k = Je(null), N = Je(0), [I, E] = ye(null), [j, L] = ye(""), [F, _] = ye(!1);
15769
- St(() => {
15774
+ } = xa(), { loadThread: m } = ya(), { createThread: g, deleteThread: w, renameThread: b } = y, [T, C] = ye(Array.isArray(f) ? f : []), S = Xe(T.length > 0), k = Xe(null), N = Xe(0), [I, E] = ye(null), [j, L] = ye(""), [F, _] = ye(!1);
15775
+ Ct(() => {
15770
15776
  const K = Array.isArray(f) ? f : [];
15771
15777
  if (K.length > 0) {
15772
15778
  S.current = !0, C(K);
15773
15779
  return;
15774
15780
  }
15775
15781
  x || (S.current = !1, C(K));
15776
- }, [f, x]), St(() => {
15782
+ }, [f, x]), Ct(() => {
15777
15783
  if (!k.current) return;
15778
15784
  const K = k.current.querySelector(
15779
15785
  "[data-radix-scroll-area-viewport]"
@@ -17240,10 +17246,10 @@ const HT = {
17240
17246
  };
17241
17247
  function Tk({ settings: e, onSettingsChange: t, className: n = "" }) {
17242
17248
  const [r, o] = ye(!1), [s, i] = ye(!1), [a, l] = ye(e), [c, d] = ye(!1), { toast: f } = Xa();
17243
- St(() => {
17249
+ Ct(() => {
17244
17250
  const m = JSON.stringify(a) !== JSON.stringify(e);
17245
17251
  d(m);
17246
- }, [a, e]), St(() => {
17252
+ }, [a, e]), Ct(() => {
17247
17253
  l(e);
17248
17254
  }, [e]);
17249
17255
  const p = () => {