teodor-new-chat-ui 4.3.199 → 4.3.201

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 co, useContext as xs, useRef as Ze, useCallback as Ie, useReducer as im, useEffect as Ct, useMemo as at, useState as me, useLayoutEffect as am, createElement as Do, useImperativeHandle as lm } from "react";
5
+ import z, { createContext as co, useContext as xs, useRef as Ze, useCallback as Ie, useReducer as im, useEffect as Ct, useMemo as at, useState as ge, useLayoutEffect as am, createElement as Do, 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 ji, ChevronUp as da, ChevronDown as ys, ChevronLeft as xm, Copy as dl, Edit as fl, RotateCcw as _i, Info as ym, Loader2 as zr, 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 jm } from "lucide-react";
7
7
  import { Slot as _m, createSlot as Tr } from "@radix-ui/react-slot";
8
8
  import { cva as vs } from "class-variance-authority";
@@ -57,17 +57,17 @@ function Dm() {
57
57
  var g = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
58
58
  function w(R) {
59
59
  {
60
- for (var K = arguments.length, ae = new Array(K > 1 ? K - 1 : 0), we = 1; we < K; we++)
61
- ae[we - 1] = arguments[we];
60
+ for (var K = arguments.length, ae = new Array(K > 1 ? K - 1 : 0), Se = 1; Se < K; Se++)
61
+ ae[Se - 1] = arguments[Se];
62
62
  b("error", R, ae);
63
63
  }
64
64
  }
65
65
  function b(R, K, ae) {
66
66
  {
67
- var we = g.ReactDebugCurrentFrame, Ye = we.getStackAddendum();
67
+ var Se = g.ReactDebugCurrentFrame, Ye = Se.getStackAddendum();
68
68
  Ye !== "" && (K += "%s", ae = ae.concat([Ye]));
69
- var it = ae.map(function(He) {
70
- return String(He);
69
+ var it = ae.map(function(Ue) {
70
+ return String(Ue);
71
71
  });
72
72
  it.unshift("Warning: " + K), Function.prototype.apply.call(console[R], console, it);
73
73
  }
@@ -82,9 +82,9 @@ function Dm() {
82
82
  R.$$typeof === I || R.getModuleId !== void 0));
83
83
  }
84
84
  function _(R, K, ae) {
85
- var we = R.displayName;
86
- if (we)
87
- return we;
85
+ var Se = R.displayName;
86
+ if (Se)
87
+ return Se;
88
88
  var Ye = K.displayName || K.name || "";
89
89
  return Ye !== "" ? ae + "(" + Ye + ")" : ae;
90
90
  }
@@ -123,12 +123,12 @@ function Dm() {
123
123
  case l:
124
124
  return _(R, R.render, "ForwardRef");
125
125
  case f:
126
- var we = R.displayName || null;
127
- return we !== null ? we : F(R.type) || "Memo";
126
+ var Se = R.displayName || null;
127
+ return Se !== null ? Se : F(R.type) || "Memo";
128
128
  case p: {
129
- var Ye = R, it = Ye._payload, He = Ye._init;
129
+ var Ye = R, it = Ye._payload, Ue = Ye._init;
130
130
  try {
131
- return F(He(it));
131
+ return F(Ue(it));
132
132
  } catch {
133
133
  return null;
134
134
  }
@@ -137,9 +137,9 @@ function Dm() {
137
137
  return null;
138
138
  }
139
139
  var j = Object.assign, $ = 0, A, B, D, O, J, X, fe;
140
- function Re() {
140
+ function Ee() {
141
141
  }
142
- Re.__reactDisabledLog = !0;
142
+ Ee.__reactDisabledLog = !0;
143
143
  function Ne() {
144
144
  {
145
145
  if ($ === 0) {
@@ -147,7 +147,7 @@ function Dm() {
147
147
  var R = {
148
148
  configurable: !0,
149
149
  enumerable: !0,
150
- value: Re,
150
+ value: Ee,
151
151
  writable: !0
152
152
  };
153
153
  Object.defineProperties(console, {
@@ -205,8 +205,8 @@ function Dm() {
205
205
  try {
206
206
  throw Error();
207
207
  } catch (Ye) {
208
- var we = Ye.stack.trim().match(/\n( *(at )?)/);
209
- W = we && we[1] || "";
208
+ var Se = Ye.stack.trim().match(/\n( *(at )?)/);
209
+ W = Se && Se[1] || "";
210
210
  }
211
211
  return `
212
212
  ` + W + R;
@@ -225,7 +225,7 @@ function Dm() {
225
225
  if (ae !== void 0)
226
226
  return ae;
227
227
  }
228
- var we;
228
+ var Se;
229
229
  H = !0;
230
230
  var Ye = Error.prepareStackTrace;
231
231
  Error.prepareStackTrace = void 0;
@@ -233,52 +233,52 @@ function Dm() {
233
233
  it = ee.current, ee.current = null, Ne();
234
234
  try {
235
235
  if (K) {
236
- var He = function() {
236
+ var Ue = function() {
237
237
  throw Error();
238
238
  };
239
- if (Object.defineProperty(He.prototype, "props", {
239
+ if (Object.defineProperty(Ue.prototype, "props", {
240
240
  set: function() {
241
241
  throw Error();
242
242
  }
243
243
  }), typeof Reflect == "object" && Reflect.construct) {
244
244
  try {
245
- Reflect.construct(He, []);
245
+ Reflect.construct(Ue, []);
246
246
  } catch (Ft) {
247
- we = Ft;
247
+ Se = Ft;
248
248
  }
249
- Reflect.construct(R, [], He);
249
+ Reflect.construct(R, [], Ue);
250
250
  } else {
251
251
  try {
252
- He.call();
252
+ Ue.call();
253
253
  } catch (Ft) {
254
- we = Ft;
254
+ Se = Ft;
255
255
  }
256
- R.call(He.prototype);
256
+ R.call(Ue.prototype);
257
257
  }
258
258
  } else {
259
259
  try {
260
260
  throw Error();
261
261
  } catch (Ft) {
262
- we = Ft;
262
+ Se = Ft;
263
263
  }
264
264
  R();
265
265
  }
266
266
  } catch (Ft) {
267
- if (Ft && we && typeof Ft.stack == "string") {
268
- for (var $e = Ft.stack.split(`
269
- `), Ot = we.stack.split(`
270
- `), St = $e.length - 1, yt = Ot.length - 1; St >= 1 && yt >= 0 && $e[St] !== Ot[yt]; )
271
- yt--;
272
- for (; St >= 1 && yt >= 0; St--, yt--)
273
- if ($e[St] !== Ot[yt]) {
274
- if (St !== 1 || yt !== 1)
267
+ if (Ft && Se && typeof Ft.stack == "string") {
268
+ for (var Fe = Ft.stack.split(`
269
+ `), Ot = Se.stack.split(`
270
+ `), St = Fe.length - 1, vt = Ot.length - 1; St >= 1 && vt >= 0 && Fe[St] !== Ot[vt]; )
271
+ vt--;
272
+ for (; St >= 1 && vt >= 0; St--, vt--)
273
+ if (Fe[St] !== Ot[vt]) {
274
+ if (St !== 1 || vt !== 1)
275
275
  do
276
- if (St--, yt--, yt < 0 || $e[St] !== Ot[yt]) {
276
+ if (St--, vt--, vt < 0 || Fe[St] !== Ot[vt]) {
277
277
  var Kt = `
278
- ` + $e[St].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 (St >= 1 && yt >= 0);
281
+ while (St >= 1 && vt >= 0);
282
282
  break;
283
283
  }
284
284
  }
@@ -288,7 +288,7 @@ function Dm() {
288
288
  var Fn = R ? R.displayName || R.name : "", Nn = Fn ? M(Fn) : "";
289
289
  return typeof R == "function" && te.set(R, Nn), Nn;
290
290
  }
291
- function Le(R, K, ae) {
291
+ function De(R, K, ae) {
292
292
  return ne(R, !1);
293
293
  }
294
294
  function Q(R) {
@@ -311,11 +311,11 @@ function Dm() {
311
311
  if (typeof R == "object")
312
312
  switch (R.$$typeof) {
313
313
  case l:
314
- return Le(R.render);
314
+ return De(R.render);
315
315
  case f:
316
316
  return se(R.type, K, ae);
317
317
  case p: {
318
- var we = R, Ye = we._payload, it = we._init;
318
+ var Se = R, Ye = Se._payload, it = Se._init;
319
319
  try {
320
320
  return se(it(Ye), K, ae);
321
321
  } catch {
@@ -324,30 +324,30 @@ function Dm() {
324
324
  }
325
325
  return "";
326
326
  }
327
- var Se = Object.prototype.hasOwnProperty, je = {}, Ke = g.ReactDebugCurrentFrame;
328
- function Be(R) {
327
+ var Te = Object.prototype.hasOwnProperty, je = {}, Ke = g.ReactDebugCurrentFrame;
328
+ function ze(R) {
329
329
  if (R) {
330
330
  var K = R._owner, ae = se(R.type, R._source, K ? K.type : null);
331
331
  Ke.setExtraStackFrame(ae);
332
332
  } else
333
333
  Ke.setExtraStackFrame(null);
334
334
  }
335
- function ze(R, K, ae, we, Ye) {
335
+ function $e(R, K, ae, Se, Ye) {
336
336
  {
337
- var it = Function.call.bind(Se);
338
- for (var He in R)
339
- if (it(R, He)) {
340
- var $e = void 0;
337
+ var it = Function.call.bind(Te);
338
+ for (var Ue in R)
339
+ if (it(R, Ue)) {
340
+ var Fe = void 0;
341
341
  try {
342
- if (typeof R[He] != "function") {
343
- var Ot = Error((we || "React class") + ": " + ae + " type `" + He + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof R[He] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
342
+ if (typeof R[Ue] != "function") {
343
+ var Ot = Error((Se || "React class") + ": " + ae + " type `" + Ue + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof R[Ue] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
344
344
  throw Ot.name = "Invariant Violation", Ot;
345
345
  }
346
- $e = R[He](K, He, we, ae, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
346
+ Fe = R[Ue](K, Ue, Se, ae, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
347
347
  } catch (St) {
348
- $e = St;
348
+ Fe = St;
349
349
  }
350
- $e && !($e instanceof Error) && (Be(Ye), 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).", we || "React class", ae, He, typeof $e), Be(null)), $e instanceof Error && !($e.message in je) && (je[$e.message] = !0, Be(Ye), w("Failed %s type: %s", ae, $e.message), Be(null));
350
+ Fe && !(Fe instanceof Error) && (ze(Ye), 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).", Se || "React class", ae, Ue, typeof Fe), ze(null)), Fe instanceof Error && !(Fe.message in je) && (je[Fe.message] = !0, ze(Ye), w("Failed %s type: %s", ae, Fe.message), ze(null));
351
351
  }
352
352
  }
353
353
  }
@@ -371,7 +371,7 @@ function Dm() {
371
371
  function nt(R) {
372
372
  return "" + R;
373
373
  }
374
- function Tt(R) {
374
+ function jt(R) {
375
375
  if (Je(R))
376
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);
377
377
  }
@@ -380,30 +380,30 @@ function Dm() {
380
380
  ref: !0,
381
381
  __self: !0,
382
382
  __source: !0
383
- }, kt, wt;
383
+ }, Tt, bt;
384
384
  function re(R) {
385
- if (Se.call(R, "ref")) {
385
+ if (Te.call(R, "ref")) {
386
386
  var K = Object.getOwnPropertyDescriptor(R, "ref").get;
387
387
  if (K && K.isReactWarning)
388
388
  return !1;
389
389
  }
390
390
  return R.ref !== void 0;
391
391
  }
392
- function Ce(R) {
393
- if (Se.call(R, "key")) {
392
+ function we(R) {
393
+ if (Te.call(R, "key")) {
394
394
  var K = Object.getOwnPropertyDescriptor(R, "key").get;
395
395
  if (K && K.isReactWarning)
396
396
  return !1;
397
397
  }
398
398
  return R.key !== void 0;
399
399
  }
400
- function Ue(R, K) {
400
+ function Be(R, K) {
401
401
  typeof R.ref == "string" && ut.current;
402
402
  }
403
- function Pe(R, K) {
403
+ function He(R, K) {
404
404
  {
405
405
  var ae = function() {
406
- kt || (kt = !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)", K));
406
+ Tt || (Tt = !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)", K));
407
407
  };
408
408
  ae.isReactWarning = !0, Object.defineProperty(R, "key", {
409
409
  get: ae,
@@ -411,10 +411,10 @@ function Dm() {
411
411
  });
412
412
  }
413
413
  }
414
- function st(R, K) {
414
+ function mt(R, K) {
415
415
  {
416
416
  var ae = function() {
417
- wt || (wt = !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)", K));
417
+ bt || (bt = !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)", K));
418
418
  };
419
419
  ae.isReactWarning = !0, Object.defineProperty(R, "ref", {
420
420
  get: ae,
@@ -422,54 +422,54 @@ function Dm() {
422
422
  });
423
423
  }
424
424
  }
425
- var Ee = function(R, K, ae, we, Ye, it, He) {
426
- var $e = {
425
+ var xe = function(R, K, ae, Se, Ye, it, Ue) {
426
+ var Fe = {
427
427
  // This tag allows us to uniquely identify this as a React Element
428
428
  $$typeof: t,
429
429
  // Built-in properties that belong on the element
430
430
  type: R,
431
431
  key: K,
432
432
  ref: ae,
433
- props: He,
433
+ props: Ue,
434
434
  // Record the component responsible for creating this element.
435
435
  _owner: it
436
436
  };
437
- return $e._store = {}, Object.defineProperty($e._store, "validated", {
437
+ return Fe._store = {}, Object.defineProperty(Fe._store, "validated", {
438
438
  configurable: !1,
439
439
  enumerable: !1,
440
440
  writable: !0,
441
441
  value: !1
442
- }), Object.defineProperty($e, "_self", {
442
+ }), Object.defineProperty(Fe, "_self", {
443
443
  configurable: !1,
444
444
  enumerable: !1,
445
445
  writable: !1,
446
- value: we
447
- }), Object.defineProperty($e, "_source", {
446
+ value: Se
447
+ }), Object.defineProperty(Fe, "_source", {
448
448
  configurable: !1,
449
449
  enumerable: !1,
450
450
  writable: !1,
451
451
  value: Ye
452
- }), Object.freeze && (Object.freeze($e.props), Object.freeze($e)), $e;
452
+ }), Object.freeze && (Object.freeze(Fe.props), Object.freeze(Fe)), Fe;
453
453
  };
454
- function ye(R, K, ae, we, Ye) {
454
+ function pe(R, K, ae, Se, Ye) {
455
455
  {
456
- var it, He = {}, $e = null, Ot = null;
457
- ae !== void 0 && (Tt(ae), $e = "" + ae), Ce(K) && (Tt(K.key), $e = "" + K.key), re(K) && (Ot = K.ref, Ue(K, Ye));
456
+ var it, Ue = {}, Fe = null, Ot = null;
457
+ ae !== void 0 && (jt(ae), Fe = "" + ae), we(K) && (jt(K.key), Fe = "" + K.key), re(K) && (Ot = K.ref, Be(K, Ye));
458
458
  for (it in K)
459
- Se.call(K, it) && !lt.hasOwnProperty(it) && (He[it] = K[it]);
459
+ Te.call(K, it) && !lt.hasOwnProperty(it) && (Ue[it] = K[it]);
460
460
  if (R && R.defaultProps) {
461
461
  var St = R.defaultProps;
462
462
  for (it in St)
463
- He[it] === void 0 && (He[it] = St[it]);
463
+ Ue[it] === void 0 && (Ue[it] = St[it]);
464
464
  }
465
- if ($e || Ot) {
466
- var yt = typeof R == "function" ? R.displayName || R.name || "Unknown" : R;
467
- $e && Pe(He, yt), Ot && st(He, yt);
465
+ if (Fe || Ot) {
466
+ var vt = typeof R == "function" ? R.displayName || R.name || "Unknown" : R;
467
+ Fe && He(Ue, vt), Ot && mt(Ue, vt);
468
468
  }
469
- return Ee(R, $e, Ot, Ye, we, ut.current, He);
469
+ return xe(R, Fe, Ot, Ye, Se, ut.current, Ue);
470
470
  }
471
471
  }
472
- var bt = g.ReactCurrentOwner, _t = g.ReactDebugCurrentFrame;
472
+ var st = g.ReactCurrentOwner, _t = g.ReactDebugCurrentFrame;
473
473
  function V(R) {
474
474
  if (R) {
475
475
  var K = R._owner, ae = se(R.type, R._source, K ? K.type : null);
@@ -477,15 +477,15 @@ function Dm() {
477
477
  } else
478
478
  _t.setExtraStackFrame(null);
479
479
  }
480
- var ve;
481
- ve = !1;
482
- function ge(R) {
480
+ var be;
481
+ be = !1;
482
+ function ye(R) {
483
483
  return typeof R == "object" && R !== null && R.$$typeof === t;
484
484
  }
485
485
  function ht() {
486
486
  {
487
- if (bt.current) {
488
- var R = F(bt.current.type);
487
+ if (st.current) {
488
+ var R = F(st.current.type);
489
489
  if (R)
490
490
  return `
491
491
 
@@ -494,11 +494,11 @@ Check the render method of \`` + R + "`.";
494
494
  return "";
495
495
  }
496
496
  }
497
- function mt(R) {
497
+ function gt(R) {
498
498
  return "";
499
499
  }
500
- var Rt = {};
501
- function Oe(R) {
500
+ var kt = {};
501
+ function Pe(R) {
502
502
  {
503
503
  var K = ht();
504
504
  if (!K) {
@@ -515,12 +515,12 @@ Check the top-level render call using <` + ae + ">.");
515
515
  if (!R._store || R._store.validated || R.key != null)
516
516
  return;
517
517
  R._store.validated = !0;
518
- var ae = Oe(K);
519
- if (Rt[ae])
518
+ var ae = Pe(K);
519
+ if (kt[ae])
520
520
  return;
521
- Rt[ae] = !0;
522
- var we = "";
523
- R && R._owner && R._owner !== bt.current && (we = " It was passed a child from " + F(R._owner.type) + "."), V(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.', ae, we), V(null);
521
+ kt[ae] = !0;
522
+ var Se = "";
523
+ R && R._owner && R._owner !== st.current && (Se = " It was passed a child from " + F(R._owner.type) + "."), V(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.', ae, Se), V(null);
524
524
  }
525
525
  }
526
526
  function ct(R, K) {
@@ -529,20 +529,20 @@ Check the top-level render call using <` + ae + ">.");
529
529
  return;
530
530
  if (Ge(R))
531
531
  for (var ae = 0; ae < R.length; ae++) {
532
- var we = R[ae];
533
- ge(we) && Vt(we, K);
532
+ var Se = R[ae];
533
+ ye(Se) && Vt(Se, K);
534
534
  }
535
- else if (ge(R))
535
+ else if (ye(R))
536
536
  R._store && (R._store.validated = !0);
537
537
  else if (R) {
538
538
  var Ye = m(R);
539
539
  if (typeof Ye == "function" && Ye !== R.entries)
540
- for (var it = Ye.call(R), He; !(He = it.next()).done; )
541
- ge(He.value) && Vt(He.value, K);
540
+ for (var it = Ye.call(R), Ue; !(Ue = it.next()).done; )
541
+ ye(Ue.value) && Vt(Ue.value, K);
542
542
  }
543
543
  }
544
544
  }
545
- function Et(R) {
545
+ function Rt(R) {
546
546
  {
547
547
  var K = R.type;
548
548
  if (K == null || typeof K == "string")
@@ -557,10 +557,10 @@ Check the top-level render call using <` + ae + ">.");
557
557
  else
558
558
  return;
559
559
  if (ae) {
560
- var we = F(K);
561
- ze(ae, R.props, "prop", we, R);
562
- } else if (K.PropTypes !== void 0 && !ve) {
563
- ve = !0;
560
+ var Se = F(K);
561
+ $e(ae, R.props, "prop", Se, R);
562
+ } else if (K.PropTypes !== void 0 && !be) {
563
+ be = !0;
564
564
  var Ye = F(K);
565
565
  w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", Ye || "Unknown");
566
566
  }
@@ -570,9 +570,9 @@ Check the top-level render call using <` + ae + ">.");
570
570
  function Dn(R) {
571
571
  {
572
572
  for (var K = Object.keys(R.props), ae = 0; ae < K.length; ae++) {
573
- var we = K[ae];
574
- if (we !== "children" && we !== "key") {
575
- V(R), w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", we), V(null);
573
+ var Se = K[ae];
574
+ if (Se !== "children" && Se !== "key") {
575
+ V(R), w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", Se), V(null);
576
576
  break;
577
577
  }
578
578
  }
@@ -580,24 +580,24 @@ Check the top-level render call using <` + ae + ">.");
580
580
  }
581
581
  }
582
582
  var Jn = {};
583
- function Ln(R, K, ae, we, Ye, it) {
583
+ function Ln(R, K, ae, Se, Ye, it) {
584
584
  {
585
- var He = E(R);
586
- if (!He) {
587
- var $e = "";
588
- (R === void 0 || typeof R == "object" && R !== null && Object.keys(R).length === 0) && ($e += " 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 ? $e += Ot : $e += ht();
585
+ var Ue = E(R);
586
+ if (!Ue) {
587
+ var Fe = "";
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 = gt();
590
+ Ot ? Fe += Ot : Fe += ht();
591
591
  var St;
592
- R === null ? St = "null" : Ge(R) ? St = "array" : R !== void 0 && R.$$typeof === t ? (St = "<" + (F(R.type) || "Unknown") + " />", $e = " 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, $e);
592
+ R === null ? St = "null" : Ge(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 yt = ye(R, K, ae, Ye, it);
595
- if (yt == null)
596
- return yt;
597
- if (He) {
594
+ var vt = pe(R, K, ae, Ye, it);
595
+ if (vt == null)
596
+ return vt;
597
+ if (Ue) {
598
598
  var Kt = K.children;
599
599
  if (Kt !== void 0)
600
- if (we)
600
+ if (Se)
601
601
  if (Ge(Kt)) {
602
602
  for (var Fn = 0; Fn < Kt.length; Fn++)
603
603
  ct(Kt[Fn], R);
@@ -607,7 +607,7 @@ Check the top-level render call using <` + ae + ">.");
607
607
  else
608
608
  ct(Kt, R);
609
609
  }
610
- if (Se.call(K, "key")) {
610
+ if (Te.call(K, "key")) {
611
611
  var Nn = F(R), Ft = Object.keys(K).filter(function(oe) {
612
612
  return oe !== "key";
613
613
  }), Dr = Ft.length > 0 ? "{key: someKey, " + Ft.join(": ..., ") + ": ...}" : "{key: someKey}";
@@ -621,7 +621,7 @@ React keys must be passed directly to JSX without using spread:
621
621
  <%s key={someKey} {...props} />`, Dr, Nn, q, Nn), Jn[Nn + Dr] = !0;
622
622
  }
623
623
  }
624
- return R === r ? Dn(yt) : Et(yt), yt;
624
+ return R === r ? Dn(vt) : Rt(vt), vt;
625
625
  }
626
626
  }
627
627
  function ti(R, K, ae) {
@@ -874,10 +874,10 @@ const xg = (e) => {
874
874
  asap: wg,
875
875
  isIterable: bg
876
876
  };
877
- function Me(e, t, n, r, o) {
877
+ function Oe(e, t, n, r, o) {
878
878
  Error.call(this), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack, this.message = e, this.name = "AxiosError", t && (this.code = t), n && (this.config = n), r && (this.request = r), o && (this.response = o, this.status = o.status ? o.status : null);
879
879
  }
880
- P.inherits(Me, Error, {
880
+ P.inherits(Oe, Error, {
881
881
  toJSON: function() {
882
882
  return {
883
883
  // Standard
@@ -898,7 +898,7 @@ P.inherits(Me, Error, {
898
898
  };
899
899
  }
900
900
  });
901
- const au = Me.prototype, lu = {};
901
+ const au = Oe.prototype, lu = {};
902
902
  [
903
903
  "ERR_BAD_OPTION_VALUE",
904
904
  "ERR_BAD_OPTION",
@@ -916,15 +916,15 @@ const au = Me.prototype, lu = {};
916
916
  ].forEach((e) => {
917
917
  lu[e] = { value: e };
918
918
  });
919
- Object.defineProperties(Me, lu);
919
+ Object.defineProperties(Oe, lu);
920
920
  Object.defineProperty(au, "isAxiosError", { value: !0 });
921
- Me.from = (e, t, n, r, o, s) => {
921
+ Oe.from = (e, t, n, r, o, s) => {
922
922
  const i = Object.create(au);
923
923
  P.toFlatObject(e, i, function(d) {
924
924
  return d !== Error.prototype;
925
925
  }, (c) => c !== "isAxiosError");
926
926
  const a = e && e.message ? e.message : "Error", l = t == null && e ? e.code : t;
927
- return Me.call(i, a, l, n, r, o), e && i.cause == null && Object.defineProperty(i, "cause", { value: e, configurable: !0 }), i.name = e && e.name || "Error", s && Object.assign(i, s), i;
927
+ return Oe.call(i, a, l, n, r, o), e && i.cause == null && Object.defineProperty(i, "cause", { value: e, configurable: !0 }), i.name = e && e.name || "Error", s && Object.assign(i, s), i;
928
928
  };
929
929
  const Sg = null;
930
930
  function Mi(e) {
@@ -964,7 +964,7 @@ function Ts(e, t, n) {
964
964
  if (P.isBoolean(x))
965
965
  return x.toString();
966
966
  if (!l && P.isBlob(x))
967
- throw new Me("Blob is not supported. Use a Buffer instead.");
967
+ throw new Oe("Blob is not supported. Use a Buffer instead.");
968
968
  return P.isArrayBuffer(x) || P.isTypedArray(x) ? l && typeof Blob == "function" ? new Blob([x]) : Buffer.from(x) : x;
969
969
  }
970
970
  function d(x, y, m) {
@@ -1215,7 +1215,7 @@ const ho = {
1215
1215
  return JSON.parse(t, this.parseReviver);
1216
1216
  } catch (a) {
1217
1217
  if (i)
1218
- throw a.name === "SyntaxError" ? Me.from(a, Me.ERR_BAD_RESPONSE, this, null, this.response) : a;
1218
+ throw a.name === "SyntaxError" ? Oe.from(a, Oe.ERR_BAD_RESPONSE, this, null, this.response) : a;
1219
1219
  }
1220
1220
  }
1221
1221
  return t;
@@ -1458,16 +1458,16 @@ function hu(e) {
1458
1458
  return !!(e && e.__CANCEL__);
1459
1459
  }
1460
1460
  function Ar(e, t, n) {
1461
- Me.call(this, e ?? "canceled", Me.ERR_CANCELED, t, n), this.name = "CanceledError";
1461
+ Oe.call(this, e ?? "canceled", Oe.ERR_CANCELED, t, n), this.name = "CanceledError";
1462
1462
  }
1463
- P.inherits(Ar, Me, {
1463
+ P.inherits(Ar, Oe, {
1464
1464
  __CANCEL__: !0
1465
1465
  });
1466
1466
  function mu(e, t, n) {
1467
1467
  const r = n.config.validateStatus;
1468
- !n.status || !r || r(n.status) ? e(n) : t(new Me(
1468
+ !n.status || !r || r(n.status) ? e(n) : t(new Oe(
1469
1469
  "Request failed with status code " + n.status,
1470
- [Me.ERR_BAD_REQUEST, Me.ERR_BAD_RESPONSE][Math.floor(n.status / 100) - 4],
1470
+ [Oe.ERR_BAD_REQUEST, Oe.ERR_BAD_RESPONSE][Math.floor(n.status / 100) - 4],
1471
1471
  n.config,
1472
1472
  n.request,
1473
1473
  n
@@ -1690,16 +1690,16 @@ const xu = (e) => {
1690
1690
  "onloadend" in m ? m.onloadend = g : m.onreadystatechange = function() {
1691
1691
  !m || m.readyState !== 4 || m.status === 0 && !(m.responseURL && m.responseURL.indexOf("file:") === 0) || setTimeout(g);
1692
1692
  }, m.onabort = function() {
1693
- m && (r(new Me("Request aborted", Me.ECONNABORTED, e, m)), m = null);
1693
+ m && (r(new Oe("Request aborted", Oe.ECONNABORTED, e, m)), m = null);
1694
1694
  }, m.onerror = function(T) {
1695
- const C = T && T.message ? T.message : "Network Error", S = new Me(C, Me.ERR_NETWORK, e, m);
1695
+ const C = T && T.message ? T.message : "Network Error", S = new Oe(C, Oe.ERR_NETWORK, e, m);
1696
1696
  S.event = T || null, r(S), m = null;
1697
1697
  }, m.ontimeout = function() {
1698
1698
  let T = o.timeout ? "timeout of " + o.timeout + "ms exceeded" : "timeout exceeded";
1699
1699
  const C = o.transitional || fu;
1700
- o.timeoutErrorMessage && (T = o.timeoutErrorMessage), r(new Me(
1700
+ o.timeoutErrorMessage && (T = o.timeoutErrorMessage), r(new Oe(
1701
1701
  T,
1702
- C.clarifyTimeoutError ? Me.ETIMEDOUT : Me.ECONNABORTED,
1702
+ C.clarifyTimeoutError ? Oe.ETIMEDOUT : Oe.ECONNABORTED,
1703
1703
  e,
1704
1704
  m
1705
1705
  )), m = null;
@@ -1710,7 +1710,7 @@ const xu = (e) => {
1710
1710
  }, o.cancelToken && o.cancelToken.subscribe(d), o.signal && (o.signal.aborted ? d() : o.signal.addEventListener("abort", d)));
1711
1711
  const w = Wg(o.url);
1712
1712
  if (w && zt.protocols.indexOf(w) === -1) {
1713
- r(new Me("Unsupported protocol " + w + ":", Me.ERR_BAD_REQUEST, e));
1713
+ r(new Oe("Unsupported protocol " + w + ":", Oe.ERR_BAD_REQUEST, e));
1714
1714
  return;
1715
1715
  }
1716
1716
  m.send(s || null);
@@ -1723,11 +1723,11 @@ const xu = (e) => {
1723
1723
  if (!o) {
1724
1724
  o = !0, a();
1725
1725
  const d = c instanceof Error ? c : this.reason;
1726
- r.abort(d instanceof Me ? d : new Ar(d instanceof Error ? d.message : d));
1726
+ r.abort(d instanceof Oe ? d : new Ar(d instanceof Error ? d.message : d));
1727
1727
  }
1728
1728
  };
1729
1729
  let i = t && setTimeout(() => {
1730
- i = null, s(new Me(`timeout ${t} of ms exceeded`, Me.ETIMEDOUT));
1730
+ i = null, s(new Oe(`timeout ${t} of ms exceeded`, Oe.ETIMEDOUT));
1731
1731
  }, t);
1732
1732
  const a = () => {
1733
1733
  e && (i && clearTimeout(i), i = null, e.forEach((c) => {
@@ -1832,7 +1832,7 @@ const xu = (e) => {
1832
1832
  let g = y && y[x];
1833
1833
  if (g)
1834
1834
  return g.call(y);
1835
- throw new Me(`Response type '${x}' is not supported`, Me.ERR_NOT_SUPPORT, m);
1835
+ throw new Oe(`Response type '${x}' is not supported`, Oe.ERR_NOT_SUPPORT, m);
1836
1836
  });
1837
1837
  });
1838
1838
  const p = async (x) => {
@@ -1882,11 +1882,11 @@ const xu = (e) => {
1882
1882
  duplex: "half"
1883
1883
  }), fe;
1884
1884
  if (P.isFormData(g) && (fe = X.headers.get("content-type")) && N.setContentType(fe), X.body) {
1885
- const [Re, Ne] = wl(
1885
+ const [Ee, Ne] = wl(
1886
1886
  $,
1887
1887
  Xo(bl(S))
1888
1888
  );
1889
- g = Cl(X.body, Tl, Re, Ne);
1889
+ g = Cl(X.body, Tl, Ee, Ne);
1890
1890
  }
1891
1891
  }
1892
1892
  P.isString(I) || (I = I ? "include" : "omit");
@@ -1907,12 +1907,12 @@ const xu = (e) => {
1907
1907
  ["status", "statusText", "headers"].forEach((G) => {
1908
1908
  X[G] = D[G];
1909
1909
  });
1910
- const fe = P.toFiniteNumber(D.headers.get("content-length")), [Re, Ne] = C && wl(
1910
+ const fe = P.toFiniteNumber(D.headers.get("content-length")), [Ee, Ne] = C && wl(
1911
1911
  fe,
1912
1912
  Xo(bl(C), !0)
1913
1913
  ) || [];
1914
1914
  D = new r(
1915
- Cl(D.body, Tl, Re, () => {
1915
+ Cl(D.body, Tl, Ee, () => {
1916
1916
  Ne && Ne(), j && j();
1917
1917
  }),
1918
1918
  X
@@ -1932,11 +1932,11 @@ const xu = (e) => {
1932
1932
  });
1933
1933
  } catch (A) {
1934
1934
  throw j && j(), A && A.name === "TypeError" && /Load failed|fetch/i.test(A.message) ? Object.assign(
1935
- new Me("Network Error", Me.ERR_NETWORK, x, F),
1935
+ new Oe("Network Error", Oe.ERR_NETWORK, x, F),
1936
1936
  {
1937
1937
  cause: A.cause || A
1938
1938
  }
1939
- ) : Me.from(A, A && A.code, x, F);
1939
+ ) : Oe.from(A, A && A.code, x, F);
1940
1940
  }
1941
1941
  };
1942
1942
  }, sx = /* @__PURE__ */ new Map(), yu = (e) => {
@@ -1978,7 +1978,7 @@ const Il = (e) => `- ${e}`, ix = (e) => P.isFunction(e) || e === null || e === !
1978
1978
  r = e[i];
1979
1979
  let a;
1980
1980
  if (o = r, !ix(r) && (o = Li[(a = String(r)).toLowerCase()], o === void 0))
1981
- throw new Me(`Unknown adapter '${a}'`);
1981
+ throw new Oe(`Unknown adapter '${a}'`);
1982
1982
  if (o && (P.isFunction(o) || (o = o.get(t))))
1983
1983
  break;
1984
1984
  s[a || "#" + i] = o;
@@ -1990,7 +1990,7 @@ const Il = (e) => `- ${e}`, ix = (e) => P.isFunction(e) || e === null || e === !
1990
1990
  let a = n ? i.length > 1 ? `since :
1991
1991
  ` + i.map(Il).join(`
1992
1992
  `) : " " + Il(i[0]) : "as no adapter specified";
1993
- throw new Me(
1993
+ throw new Oe(
1994
1994
  "There is no suitable adapter to dispatch the request " + a,
1995
1995
  "ERR_NOT_SUPPORT"
1996
1996
  );
@@ -2034,9 +2034,9 @@ ks.transitional = function(t, n, r) {
2034
2034
  }
2035
2035
  return (s, i, a) => {
2036
2036
  if (t === !1)
2037
- throw new Me(
2037
+ throw new Oe(
2038
2038
  o(i, " has been removed" + (n ? " in " + n : "")),
2039
- Me.ERR_DEPRECATED
2039
+ Oe.ERR_DEPRECATED
2040
2040
  );
2041
2041
  return n && !Al[i] && (Al[i] = !0, console.warn(
2042
2042
  o(
@@ -2051,7 +2051,7 @@ ks.spelling = function(t) {
2051
2051
  };
2052
2052
  function ax(e, t, n) {
2053
2053
  if (typeof e != "object")
2054
- throw new Me("options must be an object", Me.ERR_BAD_OPTION_VALUE);
2054
+ throw new Oe("options must be an object", Oe.ERR_BAD_OPTION_VALUE);
2055
2055
  const r = Object.keys(e);
2056
2056
  let o = r.length;
2057
2057
  for (; o-- > 0; ) {
@@ -2059,11 +2059,11 @@ function ax(e, t, n) {
2059
2059
  if (i) {
2060
2060
  const a = e[s], l = a === void 0 || i(a, s, e);
2061
2061
  if (l !== !0)
2062
- throw new Me("option " + s + " must be " + l, Me.ERR_BAD_OPTION_VALUE);
2062
+ throw new Oe("option " + s + " must be " + l, Oe.ERR_BAD_OPTION_VALUE);
2063
2063
  continue;
2064
2064
  }
2065
2065
  if (n !== !0)
2066
- throw new Me("Unknown option " + s, Me.ERR_BAD_OPTION);
2066
+ throw new Oe("Unknown option " + s, Oe.ERR_BAD_OPTION);
2067
2067
  }
2068
2068
  }
2069
2069
  const $o = {
@@ -2349,26 +2349,26 @@ function Su(e) {
2349
2349
  return Su(or(e, o));
2350
2350
  }, n;
2351
2351
  }
2352
- const Nt = Su(ho);
2353
- Nt.Axios = nr;
2354
- Nt.CanceledError = Ar;
2355
- Nt.CancelToken = lx;
2356
- Nt.isCancel = hu;
2357
- Nt.VERSION = wu;
2358
- Nt.toFormData = Ts;
2359
- Nt.AxiosError = Me;
2360
- Nt.Cancel = Nt.CanceledError;
2361
- Nt.all = function(t) {
2352
+ const It = Su(ho);
2353
+ It.Axios = nr;
2354
+ It.CanceledError = Ar;
2355
+ It.CancelToken = lx;
2356
+ It.isCancel = hu;
2357
+ It.VERSION = wu;
2358
+ It.toFormData = Ts;
2359
+ It.AxiosError = Oe;
2360
+ It.Cancel = It.CanceledError;
2361
+ It.all = function(t) {
2362
2362
  return Promise.all(t);
2363
2363
  };
2364
- Nt.spread = cx;
2365
- Nt.isAxiosError = ux;
2366
- Nt.mergeConfig = or;
2367
- Nt.AxiosHeaders = Yt;
2368
- Nt.formToJSON = (e) => pu(P.isHTMLForm(e) ? new FormData(e) : e);
2369
- Nt.getAdapter = vu.getAdapter;
2370
- Nt.HttpStatusCode = Fi;
2371
- Nt.default = Nt;
2364
+ It.spread = cx;
2365
+ It.isAxiosError = ux;
2366
+ It.mergeConfig = or;
2367
+ It.AxiosHeaders = Yt;
2368
+ It.formToJSON = (e) => pu(P.isHTMLForm(e) ? new FormData(e) : e);
2369
+ It.getAdapter = vu.getAdapter;
2370
+ It.HttpStatusCode = Fi;
2371
+ It.default = It;
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
- } = Nt, jl = typeof window < "u" ? window.__API_BASE_URL__ : void 0, _l = jl ? _n(jl) : void 0;
2389
+ } = It, jl = typeof window < "u" ? window.__API_BASE_URL__ : void 0, _l = jl ? _n(jl) : void 0;
2390
2390
  function _n(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 = Nt.create({
2405
+ const px = 3e4, hx = 9e4, ln = It.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
  ..._l ? { baseURL: _l } : {},
@@ -2618,7 +2618,7 @@ function Ur(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) => jx(I, E)).filter((I) => !!I), d = qt(e.config), f = qt(d == null ? void 0 : d.configurable), p = At(f, ["checkpoint_id", "checkpointId"]), h = At(f, ["checkpoint_ns", "checkpointNs"]), x = qt(e == null ? void 0 : e.parentConfig), y = qt(x == null ? void 0 : x.configurable), m = At(y, ["checkpoint_id", "checkpointId"]) ?? null, g = At(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 = At(C, ["branch_label", "branchLabel"]), k = At(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) => jx(I, E)).filter((I) => !!I), d = qt(e.config), f = qt(d == null ? void 0 : d.configurable), p = Nt(f, ["checkpoint_id", "checkpointId"]), h = Nt(f, ["checkpoint_ns", "checkpointNs"]), x = qt(e == null ? void 0 : e.parentConfig), y = qt(x == null ? void 0 : x.configurable), m = Nt(y, ["checkpoint_id", "checkpointId"]) ?? null, g = Nt(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 = Nt(C, ["branch_label", "branchLabel"]), k = Nt(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 = At(n, ["id", "task_id", "taskId"]) ?? t, o = At(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 = Nt(n, ["id", "task_id", "taskId"]) ?? t, o = Nt(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 Wr(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 = At(n, ["type", "event", "kind"]), o = At(n, ["id", "interrupt_id", "interruptId", "value_id"]) ?? (r && r.toLowerCase().includes("interrupt") ? t : void 0);
2790
+ const n = e, r = Nt(n, ["type", "event", "kind"]), o = Nt(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 jx(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 = At(c, ["createdAt", "created_at"]) ?? At(o, ["created_at", "createdAt"]), p = At(c, ["checkpointId", "checkpoint_id"]), h = At(c, ["checkpointNs", "checkpoint_ns"]), x = _x(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 = Nt(c, ["createdAt", "created_at"]) ?? Nt(o, ["created_at", "createdAt"]), p = Nt(c, ["checkpointId", "checkpoint_id"]), h = Nt(c, ["checkpointNs", "checkpoint_ns"]), x = _x(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 = At(t, ["url", "src"]);
2866
+ const o = Nt(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 = At(t, ["url"]);
2872
+ const o = Nt(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 = At(t, ["text", "content"]);
2890
+ const o = Nt(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 = At(e, ["id", "call_id"]) ?? t, r = At(e, ["name"]) ?? At(qt(e.function), ["name"]);
2899
+ const n = Nt(e, ["id", "call_id"]) ?? t, r = Nt(e, ["name"]) ?? Nt(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 At(e, t) {
2932
+ function Nt(e, t) {
2933
2933
  if (e)
2934
2934
  for (const n of t) {
2935
2935
  const r = e[n];
@@ -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(() => _n(e.baseUrl), [e.baseUrl]), n = e.streamPath ?? "/runs/stream", [r, o] = me(e.token ?? null), s = Ze(e.headers ?? {}), i = e.credentials ?? "include", [a, l] = me(!1), [c, d] = me(null), [f, p] = me(""), [h, x] = me(null), [y, m] = me(0), [g, w] = me(!1), b = Ze(null), T = Ze(!0), C = Ze(0), S = Ze(null), k = Ze(null), N = Ze(null), I = Ze(null), E = Ie((j) => {
3396
+ const t = at(() => _n(e.baseUrl), [e.baseUrl]), n = e.streamPath ?? "/runs/stream", [r, o] = ge(e.token ?? null), s = Ze(e.headers ?? {}), i = e.credentials ?? "include", [a, l] = ge(!1), [c, d] = ge(null), [f, p] = ge(""), [h, x] = ge(null), [y, m] = ge(0), [g, w] = ge(!1), b = Ze(null), T = Ze(!0), C = Ze(0), S = Ze(null), k = Ze(null), N = Ze(null), I = Ze(null), E = Ie((j) => {
3397
3397
  o(j);
3398
3398
  }, []), _ = Ie(() => {
3399
3399
  p(""), x(null), d(null), k.current = null, N.current = null, I.current = null;
@@ -3410,34 +3410,34 @@ function Kx(e = {}) {
3410
3410
  threadId: j.threadId ?? null,
3411
3411
  headers: {}
3412
3412
  }, (async () => {
3413
- var fe, Re, Ne, G, ee, W, M, H, te, ie, ne, Le, Q, se, Se, je, Ke, Be;
3414
- const X = (ze) => {
3413
+ var fe, Ee, Ne, G, ee, W, M, H, te, ie, ne, De, Q, se, Te, je, Ke, ze;
3414
+ const X = ($e) => {
3415
3415
  var qe;
3416
3416
  try {
3417
- const Ge = JSON.parse(JSON.stringify(ze));
3417
+ const Ge = JSON.parse(JSON.stringify($e));
3418
3418
  return (qe = Ge == null ? void 0 : Ge.payload) != null && qe.files_info && Array.isArray(Ge.payload.files_info) && (Ge.payload.files_info = Ge.payload.files_info.map((Qe) => ({
3419
3419
  ...Qe,
3420
3420
  data: Qe != null && Qe.data ? `<base64 ${String(Qe.data).length} chars>` : Qe == null ? void 0 : Qe.data
3421
3421
  }))), Ge;
3422
3422
  } catch {
3423
- return ze;
3423
+ return $e;
3424
3424
  }
3425
3425
  };
3426
3426
  try {
3427
- let ze = {};
3427
+ let $e = {};
3428
3428
  try {
3429
3429
  if (r)
3430
- ze = { Authorization: `Bearer ${r}` };
3430
+ $e = { Authorization: `Bearer ${r}` };
3431
3431
  else if (typeof window < "u") {
3432
- const ye = window.__AUTH_TOKEN__, bt = ((fe = window.localStorage) == null ? void 0 : fe.getItem("authToken")) || null;
3432
+ const pe = window.__AUTH_TOKEN__, st = ((fe = window.localStorage) == null ? void 0 : fe.getItem("authToken")) || null;
3433
3433
  let _t = null;
3434
3434
  try {
3435
- const ve = (Re = window.localStorage) == null ? void 0 : Re.getItem("chat-settings");
3436
- ve && (_t = ((Ne = JSON.parse(ve)) == null ? void 0 : Ne.apiKey) || null);
3435
+ const be = (Ee = window.localStorage) == null ? void 0 : Ee.getItem("chat-settings");
3436
+ be && (_t = ((Ne = JSON.parse(be)) == null ? void 0 : Ne.apiKey) || null);
3437
3437
  } catch {
3438
3438
  }
3439
- const V = ye || bt || _t || null;
3440
- V && (ze = { Authorization: `Bearer ${V}` });
3439
+ const V = pe || st || _t || null;
3440
+ V && ($e = { Authorization: `Bearer ${V}` });
3441
3441
  }
3442
3442
  } catch {
3443
3443
  }
@@ -3449,12 +3449,12 @@ function Kx(e = {}) {
3449
3449
  let qe = {};
3450
3450
  if (typeof window < "u")
3451
3451
  try {
3452
- const Ee = (G = window.localStorage) == null ? void 0 : G.getItem("authSessionId");
3453
- Ee && (qe = { "X-Session-Id": Ee });
3452
+ const xe = (G = window.localStorage) == null ? void 0 : G.getItem("authSessionId");
3453
+ xe && (qe = { "X-Session-Id": xe });
3454
3454
  } catch {
3455
3455
  }
3456
3456
  const Ge = {
3457
- ...ze,
3457
+ ...$e,
3458
3458
  ...qe,
3459
3459
  ...s.current
3460
3460
  }, Qe = {
@@ -3469,115 +3469,115 @@ function Kx(e = {}) {
3469
3469
  credentials: i
3470
3470
  });
3471
3471
  if (S.current && (S.current.headers = Ge), !Je.ok || !Je.body) {
3472
- const Ee = await Je.text().catch(() => "");
3472
+ const xe = await Je.text().catch(() => "");
3473
3473
  console.debug(
3474
3474
  "[use-chat] non-OK response",
3475
3475
  Je.status,
3476
- Ee == null ? void 0 : Ee.slice(0, 500)
3476
+ xe == null ? void 0 : xe.slice(0, 500)
3477
3477
  );
3478
- const ye = `stream ${Je.status}${Ee ? ": " + Ee : ""}`;
3479
- throw (ee = A == null ? void 0 : A.onConnectionError) == null || ee.call(A, ye), J = !0, D = "error", O = ye, new Error(ye);
3478
+ const pe = `stream ${Je.status}${xe ? ": " + xe : ""}`;
3479
+ throw (ee = A == null ? void 0 : A.onConnectionError) == null || ee.call(A, pe), J = !0, D = "error", O = pe, new Error(pe);
3480
3480
  }
3481
3481
  w(!0);
3482
- const nt = Je.body.getReader(), Tt = new TextDecoder();
3482
+ const nt = Je.body.getReader(), jt = new TextDecoder();
3483
3483
  let ut = "", lt = [];
3484
3484
  C.current = 0, m(0);
3485
- let kt = 0, wt = null;
3485
+ let Tt = 0, bt = null;
3486
3486
  const re = () => {
3487
3487
  if (lt.length) {
3488
- const Ee = lt.join("");
3489
- lt = [], T.current && p((ye) => ye + Ee);
3488
+ const xe = lt.join("");
3489
+ lt = [], T.current && p((pe) => pe + xe);
3490
3490
  }
3491
- wt = null;
3492
- }, Ce = () => {
3493
- typeof window < "u" && wt == null && (wt = requestAnimationFrame(re));
3491
+ bt = null;
3492
+ }, we = () => {
3493
+ typeof window < "u" && bt == null && (bt = requestAnimationFrame(re));
3494
3494
  };
3495
- let Ue = Date.now();
3496
- const Pe = setInterval(() => {
3497
- var Ee;
3498
- if (Date.now() - Ue > 18e5) {
3499
- const ye = "Stream idle timeout";
3500
- d(ye), D = "error", O = ye, B.abort(), (Ee = A == null ? void 0 : A.onError) == null || Ee.call(A, ye);
3495
+ let Be = Date.now();
3496
+ const He = setInterval(() => {
3497
+ var xe;
3498
+ if (Date.now() - Be > 18e5) {
3499
+ const pe = "Stream idle timeout";
3500
+ d(pe), D = "error", O = pe, B.abort(), (xe = A == null ? void 0 : A.onError) == null || xe.call(A, pe);
3501
3501
  }
3502
- }, 5e3), st = 1024 * 1024;
3502
+ }, 5e3), mt = 1024 * 1024;
3503
3503
  try {
3504
- const Ee = Je.headers.get("X-Thread-Id") || Je.headers.get("x-thread-id"), ye = Je.headers.get("X-Thread-Created") || Je.headers.get("x-thread-created"), bt = Ee ?? null, _t = String(ye ?? "").toLowerCase() === "true";
3504
+ const xe = Je.headers.get("X-Thread-Id") || Je.headers.get("x-thread-id"), pe = Je.headers.get("X-Thread-Created") || Je.headers.get("x-thread-created"), st = xe ?? null, _t = String(pe ?? "").toLowerCase() === "true";
3505
3505
  for (S.current && !S.current.threadId && (S.current = {
3506
3506
  ...S.current,
3507
- threadId: bt
3508
- }), (W = A == null ? void 0 : A.onOpen) == null || W.call(A, { threadId: bt, created: _t }); ; ) {
3509
- const { value: V, done: ve } = await nt.read();
3510
- if (ve) break;
3511
- ut += Tt.decode(V, { stream: !0 }), ut.length > st && (ut = "", console.warn("Stream buffer reset: exceeded 1MB"));
3512
- let ge;
3513
- for (; (ge = ut.indexOf(`
3507
+ threadId: st
3508
+ }), (W = A == null ? void 0 : A.onOpen) == null || W.call(A, { threadId: st, created: _t }); ; ) {
3509
+ const { value: V, done: be } = await nt.read();
3510
+ if (be) break;
3511
+ ut += jt.decode(V, { stream: !0 }), ut.length > mt && (ut = "", console.warn("Stream buffer reset: exceeded 1MB"));
3512
+ let ye;
3513
+ for (; (ye = ut.indexOf(`
3514
3514
 
3515
3515
  `)) >= 0; ) {
3516
- const ht = ut.slice(0, ge);
3517
- ut = ut.slice(ge + 2);
3518
- const mt = Gx(ht);
3519
- if (!mt) continue;
3520
- let Rt;
3516
+ const ht = ut.slice(0, ye);
3517
+ ut = ut.slice(ye + 2);
3518
+ const gt = Gx(ht);
3519
+ if (!gt) continue;
3520
+ let kt;
3521
3521
  try {
3522
- Rt = JSON.parse(mt);
3522
+ kt = JSON.parse(gt);
3523
3523
  } catch {
3524
- console.debug("[use-chat] malformed SSE:", mt.slice(0, 200));
3524
+ console.debug("[use-chat] malformed SSE:", gt.slice(0, 200));
3525
3525
  continue;
3526
3526
  }
3527
- const Oe = qx(Rt) ? Rt.data : Rt;
3528
- Ue = Date.now();
3529
- const Vt = Oe.seq;
3527
+ const Pe = qx(kt) ? kt.data : kt;
3528
+ Be = Date.now();
3529
+ const Vt = Pe.seq;
3530
3530
  if (Vt !== void 0) {
3531
- if (Vt <= kt) {
3532
- console.debug("[use-chat] drop duplicate/out-of-order event", { seq: Vt, lastProcessedSeq: kt, type: Oe.type });
3531
+ if (Vt <= Tt) {
3532
+ console.debug("[use-chat] drop duplicate/out-of-order event", { seq: Vt, lastProcessedSeq: Tt, type: Pe.type });
3533
3533
  continue;
3534
3534
  }
3535
- kt > 0 && Vt > kt + 1 && ((M = A == null ? void 0 : A.onGap) == null || M.call(A, { from: kt, to: Vt })), kt = Vt, C.current = Vt, m(Vt);
3535
+ Tt > 0 && Vt > Tt + 1 && ((M = A == null ? void 0 : A.onGap) == null || M.call(A, { from: Tt, to: Vt })), Tt = Vt, C.current = Vt, m(Vt);
3536
3536
  }
3537
3537
  if (console.debug("[use-chat] received event", {
3538
- seq: Oe.seq,
3539
- type: Oe.type,
3538
+ seq: Pe.seq,
3539
+ type: Pe.type,
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((Et) => Et.type), textLen: (Oe.delta || []).filter((Et) => Et.type === "text").map((Et) => String(Et.text || "").length) } : Oe.content || Oe.delta ? { hasContent: !0 } : {};
3544
- } catch (Et) {
3545
- return { err: String(Et) };
3543
+ return Pe.type === "message_delta" ? { deltaTypes: (ct = Pe.delta) == null ? void 0 : ct.map((Rt) => Rt.type), textLen: (Pe.delta || []).filter((Rt) => Rt.type === "text").map((Rt) => String(Rt.text || "").length) } : Pe.content || Pe.delta ? { hasContent: !0 } : {};
3544
+ } catch (Rt) {
3545
+ return { err: String(Rt) };
3546
3546
  }
3547
3547
  })()
3548
- }), Oe.type === "checkpoint")
3549
- k.current = Oe.checkpointId ?? null, N.current = Oe.checkpointNs ?? null, x(Oe.checkpointId ?? null);
3550
- else if (Oe.type === "state_history") {
3551
- I.current = Oe;
3548
+ }), Pe.type === "checkpoint")
3549
+ k.current = Pe.checkpointId ?? null, N.current = Pe.checkpointNs ?? null, x(Pe.checkpointId ?? null);
3550
+ else if (Pe.type === "state_history") {
3551
+ I.current = Pe;
3552
3552
  try {
3553
- const Et = Ur(Oe).latest;
3554
- Et && (k.current = Et.checkpointId ?? null, N.current = Et.checkpointNs ?? null, x(Et.checkpointId ?? null));
3553
+ const Rt = Ur(Pe).latest;
3554
+ Rt && (k.current = Rt.checkpointId ?? null, N.current = Rt.checkpointNs ?? null, x(Rt.checkpointId ?? null));
3555
3555
  } catch (ct) {
3556
3556
  console.warn("[use-chat] Failed to hydrate state_history payload", ct);
3557
3557
  }
3558
3558
  }
3559
3559
  try {
3560
- $ == null || $(Oe);
3560
+ $ == null || $(Pe);
3561
3561
  } catch (ct) {
3562
- console.error("[use-chat] Error in onEvent callback:", ct, "for event:", Oe.type);
3562
+ console.error("[use-chat] Error in onEvent callback:", ct, "for event:", Pe.type);
3563
3563
  }
3564
- if (Oe.type === "token" && e.autoAppendAssistant !== !1)
3565
- lt.push(Oe.content), Ce();
3566
- else if (Oe.type === "message_delta") {
3567
- const ct = Oe.delta.filter((Et) => Et.type === "text").map((Et) => Et.text).join("");
3568
- ct && e.autoAppendAssistant !== !1 && (lt.push(ct), Ce());
3569
- } else if (Oe.type === "heartbeat") {
3564
+ if (Pe.type === "token" && e.autoAppendAssistant !== !1)
3565
+ lt.push(Pe.content), we();
3566
+ else if (Pe.type === "message_delta") {
3567
+ const ct = Pe.delta.filter((Rt) => Rt.type === "text").map((Rt) => Rt.text).join("");
3568
+ ct && e.autoAppendAssistant !== !1 && (lt.push(ct), we());
3569
+ } else if (Pe.type === "heartbeat") {
3570
3570
  console.debug("[use-chat] heartbeat received");
3571
3571
  try {
3572
- (H = A == null ? void 0 : A.onHeartbeat) == null || H.call(A, Oe);
3572
+ (H = A == null ? void 0 : A.onHeartbeat) == null || H.call(A, Pe);
3573
3573
  } catch (ct) {
3574
3574
  console.warn("[use-chat] heartbeat callback failed", ct);
3575
3575
  }
3576
- } else if (wt !== null && cancelAnimationFrame(wt), re(), Oe.type === "checkpoint")
3577
- x(Oe.checkpointId);
3578
- else if (Oe.type === "error") {
3579
- const ct = Oe;
3580
- if (d(ct.message), D = "error", O = ct.message, ct.error_type === "auth_error" || ct.code === "TOKEN_EXPIRED" || ((te = ct.message) == null ? void 0 : te.includes("token")) || ((ie = ct.message) == null ? void 0 : ie.includes("401")) || ((ne = ct.message) == null ? void 0 : ne.includes("unauthorized")) || ((Le = ct.message) == null ? void 0 : Le.includes("Unauthorized"))) {
3576
+ } else if (bt !== null && cancelAnimationFrame(bt), re(), Pe.type === "checkpoint")
3577
+ x(Pe.checkpointId);
3578
+ else if (Pe.type === "error") {
3579
+ const ct = Pe;
3580
+ if (d(ct.message), D = "error", O = ct.message, ct.error_type === "auth_error" || ct.code === "TOKEN_EXPIRED" || ((te = ct.message) == null ? void 0 : te.includes("token")) || ((ie = ct.message) == null ? void 0 : ie.includes("401")) || ((ne = ct.message) == null ? void 0 : ne.includes("unauthorized")) || ((De = ct.message) == null ? void 0 : De.includes("Unauthorized"))) {
3581
3581
  console.error("[use-chat] Auth error detected:", ct.message);
3582
3582
  try {
3583
3583
  (Q = A == null ? void 0 : A.onAuthError) == null || Q.call(A, ct.message);
@@ -3590,35 +3590,35 @@ function Kx(e = {}) {
3590
3590
  }
3591
3591
  }
3592
3592
  re(), D === null && !B.signal.aborted && (D = "complete");
3593
- } catch (Ee) {
3594
- if (Ee.name === "AbortError")
3593
+ } catch (xe) {
3594
+ if (xe.name === "AbortError")
3595
3595
  D = D ?? "aborted";
3596
3596
  else {
3597
- const ye = Ee.message || String(Ee);
3598
- D = "error", O = ye, d(ye), (se = A == null ? void 0 : A.onError) == null || se.call(A, ye);
3597
+ const pe = xe.message || String(xe);
3598
+ D = "error", O = pe, d(pe), (se = A == null ? void 0 : A.onError) == null || se.call(A, pe);
3599
3599
  }
3600
3600
  } finally {
3601
3601
  try {
3602
3602
  await nt.cancel();
3603
3603
  } catch {
3604
3604
  } finally {
3605
- (Se = nt.releaseLock) == null || Se.call(nt);
3605
+ (Te = nt.releaseLock) == null || Te.call(nt);
3606
3606
  }
3607
- wt !== null && typeof window < "u" && window.cancelAnimationFrame(wt), clearInterval(Pe);
3607
+ bt !== null && typeof window < "u" && window.cancelAnimationFrame(bt), clearInterval(He);
3608
3608
  }
3609
- } catch (ze) {
3610
- if (ze.name === "AbortError")
3609
+ } catch ($e) {
3610
+ if ($e.name === "AbortError")
3611
3611
  D = D ?? "aborted";
3612
3612
  else {
3613
- const qe = ze.message || String(ze);
3613
+ const qe = $e.message || String($e);
3614
3614
  D = "error", O = qe, d(qe), (je = A == null ? void 0 : A.onError) == null || je.call(A, qe), J || ((Ke = A == null ? void 0 : A.onConnectionError) == null || Ke.call(A, qe), J = !0);
3615
3615
  }
3616
3616
  } finally {
3617
- const ze = C.current, qe = k.current, Ge = N.current, Qe = I.current, Je = D ?? (B.signal.aborted ? "aborted" : O ? "error" : "complete");
3617
+ const $e = C.current, qe = k.current, Ge = N.current, Qe = I.current, Je = D ?? (B.signal.aborted ? "aborted" : O ? "error" : "complete");
3618
3618
  try {
3619
- (Be = A == null ? void 0 : A.onClosed) == null || Be.call(A, {
3619
+ (ze = A == null ? void 0 : A.onClosed) == null || ze.call(A, {
3620
3620
  reason: Je,
3621
- lastSeq: ze,
3621
+ lastSeq: $e,
3622
3622
  lastCheckpointId: qe,
3623
3623
  lastCheckpointNs: Ge,
3624
3624
  lastStateHistory: Qe,
@@ -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(() => _n(p), [p]), [x, y] = me([]), [m, g] = me(t), [w, b] = me(!1), [T, C] = me(null), [S, k] = me(!1), [N, I] = me(null), { state: E, seed: _, prepend: L, pushUser: F, onEvent: j } = Bx(), [$, A] = me(!1), [B, D] = me(!1), [O, J] = me(null), [X, fe] = me([]), [Re, Ne] = me(!1), { setCacheForThread: G, checkpointExists: ee } = Lx(), W = Ze(m), M = Ze(null);
3875
+ const { api: f, baseUrl: p } = Tu(), h = at(() => _n(p), [p]), [x, y] = ge([]), [m, g] = ge(t), [w, b] = ge(!1), [T, C] = ge(null), [S, k] = ge(!1), [N, I] = ge(null), { state: E, seed: _, prepend: L, pushUser: F, onEvent: j } = Bx(), [$, A] = ge(!1), [B, D] = ge(!1), [O, J] = ge(null), [X, fe] = ge([]), [Ee, Ne] = ge(!1), { setCacheForThread: G, checkpointExists: ee } = Lx(), W = Ze(m), M = Ze(null);
3876
3876
  Ct(() => {
3877
3877
  W.current = m;
3878
3878
  }, [m]);
3879
- const H = Ze(), { startStream: te, stop: ie, isStreaming: ne, error: Le, setAuthToken: Q } = Yx({
3879
+ const H = Ze(), { startStream: te, stop: ie, isStreaming: ne, error: De, setAuthToken: Q } = Yx({
3880
3880
  baseUrl: h,
3881
3881
  onThreadInfo: (re) => {
3882
3882
  console.log("[ChatSessionProvider] Thread info:", re.threadId), W.current !== re.threadId && g(re.threadId);
@@ -3892,18 +3892,18 @@ function Xx({
3892
3892
  const re = await f.listThreads();
3893
3893
  y(re ?? []);
3894
3894
  } catch (re) {
3895
- const Ce = String(re);
3896
- C(Ce), l == null || l(Ce);
3895
+ const we = String(re);
3896
+ C(we), l == null || l(we);
3897
3897
  } finally {
3898
3898
  b(!1);
3899
3899
  }
3900
- }, [f, l]), Se = Ie(
3900
+ }, [f, l]), Te = Ie(
3901
3901
  async (re) => {
3902
3902
  try {
3903
- const Ce = await f.createThread(re);
3904
- return g(Ce.threadId), await se(), Ce.threadId;
3905
- } catch (Ce) {
3906
- return l == null || l(String(Ce)), null;
3903
+ const we = await f.createThread(re);
3904
+ return g(we.threadId), await se(), we.threadId;
3905
+ } catch (we) {
3906
+ return l == null || l(String(we)), null;
3907
3907
  }
3908
3908
  },
3909
3909
  [f, se, l]
@@ -3911,40 +3911,48 @@ function Xx({
3911
3911
  async (re) => {
3912
3912
  try {
3913
3913
  await f.deleteThread(re), W.current === re && (g(null), _([], {})), await se();
3914
- } catch (Ce) {
3915
- l == null || l(String(Ce));
3914
+ } catch (we) {
3915
+ l == null || l(String(we));
3916
3916
  }
3917
3917
  },
3918
3918
  [f, se, _, l]
3919
3919
  ), Ke = Ie(
3920
- async (re, Ce) => {
3920
+ async (re, we) => {
3921
3921
  try {
3922
- await f.updateThread(re, Ce), await se();
3923
- } catch (Ue) {
3924
- l == null || l(String(Ue));
3922
+ await f.updateThread(re, we), await se();
3923
+ } catch (Be) {
3924
+ l == null || l(String(Be));
3925
3925
  }
3926
3926
  },
3927
3927
  [f, se, l]
3928
- ), Be = Ie(
3929
- async (re, Ce) => {
3928
+ ), ze = Ie(
3929
+ async (re, we) => {
3930
3930
  if (re) {
3931
3931
  k(!0), I(null);
3932
3932
  try {
3933
- const Ue = await f.getStateHistory({
3933
+ const Be = await f.getStateHistory({
3934
3934
  threadId: re,
3935
- checkpointId: Ce
3936
- }), { latest: Pe, checkpoints: st } = Ur(Ue), Ee = st.filter((ye) => ye.checkpointId).map((ye) => ({
3937
- checkpointId: ye.checkpointId,
3938
- checkpointNs: ye.checkpointNs ?? void 0,
3939
- createdAt: ye.createdAt ?? ""
3935
+ checkpointId: we
3936
+ }), { checkpoints: He } = Ur(Be), mt = He.filter((pe) => pe.checkpointId).map((pe) => ({
3937
+ checkpointId: pe.checkpointId,
3938
+ checkpointNs: pe.checkpointNs ?? void 0,
3939
+ createdAt: pe.createdAt ?? ""
3940
3940
  }));
3941
- G(re, Ee), _((Pe == null ? void 0 : Pe.messages) ?? [], {
3942
- checkpointId: (Pe == null ? void 0 : Pe.checkpointId) ?? null,
3943
- checkpointNs: (Pe == null ? void 0 : Pe.checkpointNs) ?? null
3944
- }), fe(st), A(!!(Pe != null && Pe.nextCursor)), J((Pe == null ? void 0 : Pe.nextCursor) ?? null);
3945
- } catch (Ue) {
3946
- const Pe = String(Ue);
3947
- I(Pe), l == null || l(Pe);
3941
+ G(re, mt);
3942
+ const xe = He.find(
3943
+ (pe) => pe.messages && pe.messages.length > 0
3944
+ ) ?? He[0];
3945
+ console.log("[ChatSessionProvider] Loaded thread:", {
3946
+ requestedCheckpointId: we,
3947
+ dataCheckpointId: xe == null ? void 0 : xe.checkpointId,
3948
+ totalCheckpoints: He.length
3949
+ }), _((xe == null ? void 0 : xe.messages) ?? [], {
3950
+ checkpointId: (xe == null ? void 0 : xe.checkpointId) ?? null,
3951
+ checkpointNs: (xe == null ? void 0 : xe.checkpointNs) ?? null
3952
+ }), fe(He), A(!!(xe != null && xe.nextCursor)), J((xe == null ? void 0 : xe.nextCursor) ?? null);
3953
+ } catch (Be) {
3954
+ const He = String(Be);
3955
+ I(He), l == null || l(He);
3948
3956
  } finally {
3949
3957
  k(!1);
3950
3958
  }
@@ -3953,58 +3961,64 @@ function Xx({
3953
3961
  [f, _, l, G]
3954
3962
  );
3955
3963
  Ct(() => {
3956
- H.current = Be;
3957
- }, [Be]);
3958
- const ze = Ie(
3959
- async (re, Ce) => {
3960
- const Ue = W.current;
3961
- if (Ue) {
3964
+ H.current = ze;
3965
+ }, [ze]);
3966
+ const $e = Ie(
3967
+ async (re, we) => {
3968
+ const Be = W.current;
3969
+ if (Be) {
3962
3970
  Ne(!0);
3963
3971
  try {
3964
- const Pe = await f.getStateHistory({
3965
- threadId: Ue,
3972
+ const He = await f.getStateHistory({
3973
+ threadId: Be,
3966
3974
  checkpointId: re,
3967
- checkpointNs: Ce ?? void 0
3968
- }), { checkpoints: st } = Ur(Pe), Ee = st.find(
3969
- (ye) => ye.checkpointId === re && (Ce ? ye.checkpointNs === Ce : !0)
3975
+ checkpointNs: we ?? void 0
3976
+ }), { checkpoints: mt } = Ur(He), xe = mt.filter((st) => st.checkpointId).map((st) => ({
3977
+ checkpointId: st.checkpointId,
3978
+ checkpointNs: st.checkpointNs ?? void 0,
3979
+ createdAt: st.createdAt ?? ""
3980
+ }));
3981
+ G(Be, xe);
3982
+ const pe = mt.find(
3983
+ (st) => st.checkpointId === re && (we ? st.checkpointNs === we : !0)
3970
3984
  );
3971
- if (!Ee) {
3972
- console.warn("[ChatSessionProvider] Requested checkpoint not found in response:", { checkpointId: re, checkpointNs: Ce });
3985
+ if (!pe) {
3986
+ console.warn("[ChatSessionProvider] Requested checkpoint not found in response:", { checkpointId: re, checkpointNs: we });
3973
3987
  return;
3974
3988
  }
3975
- _((Ee == null ? void 0 : Ee.messages) ?? [], {
3976
- checkpointId: (Ee == null ? void 0 : Ee.checkpointId) ?? null,
3977
- checkpointNs: (Ee == null ? void 0 : Ee.checkpointNs) ?? null
3989
+ fe(mt), _((pe == null ? void 0 : pe.messages) ?? [], {
3990
+ checkpointId: (pe == null ? void 0 : pe.checkpointId) ?? null,
3991
+ checkpointNs: (pe == null ? void 0 : pe.checkpointNs) ?? null
3978
3992
  });
3979
- } catch (Pe) {
3980
- l == null || l(String(Pe));
3993
+ } catch (He) {
3994
+ l == null || l(String(He));
3981
3995
  } finally {
3982
3996
  Ne(!1);
3983
3997
  }
3984
3998
  }
3985
3999
  },
3986
- [f, _, l]
4000
+ [f, _, l, G]
3987
4001
  ), qe = Ie(
3988
- (re, Ce) => {
4002
+ (re, we) => {
3989
4003
  _(E.messages, {
3990
4004
  checkpointId: re ?? null,
3991
- checkpointNs: Ce ?? null
4005
+ checkpointNs: we ?? null
3992
4006
  });
3993
4007
  },
3994
4008
  [_, E.messages]
3995
4009
  ), Ge = Ie(async () => {
3996
- W.current && await Be(W.current);
3997
- }, [Be]), Qe = Ie(async () => {
4010
+ W.current && await ze(W.current);
4011
+ }, [ze]), Qe = Ie(async () => {
3998
4012
  if (!(!W.current || !O)) {
3999
4013
  D(!0);
4000
4014
  try {
4001
4015
  const re = await f.getStateHistory({
4002
4016
  threadId: W.current,
4003
4017
  checkpointId: O
4004
- }), { checkpoints: Ce } = Ur(re);
4005
- if (Ce.length > 0) {
4006
- const Ue = Ce[Ce.length - 1];
4007
- L((Ue == null ? void 0 : Ue.messages) ?? []), A(!!(Ue != null && Ue.nextCursor)), J((Ue == null ? void 0 : Ue.nextCursor) ?? null);
4018
+ }), { checkpoints: we } = Ur(re);
4019
+ if (we.length > 0) {
4020
+ const Be = we[we.length - 1];
4021
+ L((Be == null ? void 0 : Be.messages) ?? []), A(!!(Be != null && Be.nextCursor)), J((Be == null ? void 0 : Be.nextCursor) ?? null);
4008
4022
  }
4009
4023
  } catch (re) {
4010
4024
  l == null || l(String(re));
@@ -4015,65 +4029,60 @@ function Xx({
4015
4029
  }, [f, O, L, l]), Je = Ie(async () => {
4016
4030
  _([], {}), fe([]), A(!1), J(null);
4017
4031
  }, [_]), nt = Ie(
4018
- async (re, Ce) => {
4019
- console.log("[ChatSessionProvider] Interrupt:", re, Ce);
4032
+ async (re, we) => {
4033
+ console.log("[ChatSessionProvider] Interrupt:", re, we);
4020
4034
  },
4021
4035
  []
4022
4036
  );
4023
4037
  Ct(() => {
4024
4038
  se();
4025
4039
  }, [se]);
4026
- const Tt = Ze();
4040
+ const jt = Ze();
4027
4041
  Ct(() => {
4028
- Tt.current = ze;
4029
- }, [ze]), Ct(() => {
4030
- var Ee;
4042
+ jt.current = $e;
4043
+ }, [$e]), Ct(() => {
4044
+ var mt, xe;
4031
4045
  if (!o || !m || S === !0 || M.current === m)
4032
4046
  return;
4033
4047
  M.current = m;
4034
- const re = localStorage.getItem("lastCheckpointId"), Ce = localStorage.getItem("lastCheckpointNs"), Ue = n, Pe = r;
4035
- (Ee = H.current) == null || Ee.call(H, m);
4036
- let st = { id: re, ns: Ce };
4037
- if (st.id || (st = { id: Ue, ns: Pe }), st.id && ee(m, st.id)) {
4038
- const ye = setTimeout(() => {
4039
- var bt;
4040
- ee(m, st.id) && ((bt = Tt.current) == null || bt.call(Tt, st.id, st.ns ?? void 0));
4041
- }, 50);
4042
- return () => clearTimeout(ye);
4043
- }
4048
+ const re = localStorage.getItem("lastCheckpointId");
4049
+ localStorage.getItem("lastCheckpointNs");
4050
+ const we = n, Be = r;
4051
+ let He = { id: re };
4052
+ He.id || (He = { id: we, ns: Be }), He.id ? (console.log("[ChatSessionProvider] Loading thread with checkpoint:", He.id), (mt = H.current) == null || mt.call(H, m, He.id)) : (console.log("[ChatSessionProvider] Loading thread with latest checkpoint"), (xe = H.current) == null || xe.call(H, m));
4044
4053
  }, [o, m, S, ee, n, r]), Ct(() => {
4045
4054
  d == null || d(m);
4046
4055
  }, [m, d]), Ct(() => {
4047
4056
  E.lastCheckpointId && (localStorage.setItem("lastCheckpointId", E.lastCheckpointId), E.lastCheckpointNs && localStorage.setItem("lastCheckpointNs", E.lastCheckpointNs));
4048
4057
  }, [E.lastCheckpointId, E.lastCheckpointNs]);
4049
4058
  const ut = Ie(
4050
- async (re, Ce) => {
4051
- const Ue = W.current, Pe = (re == null ? void 0 : re.text) ?? "";
4052
- if (!Ue && !Pe) return;
4053
- if (!Ue) {
4054
- await Se("New Chat");
4059
+ async (re, we) => {
4060
+ const Be = W.current, He = (re == null ? void 0 : re.text) ?? "";
4061
+ if (!Be && !He) return;
4062
+ if (!Be) {
4063
+ await Te("New Chat");
4055
4064
  return;
4056
4065
  }
4057
- const { contentParts: st } = await wx(
4066
+ const { contentParts: mt } = await wx(
4058
4067
  f,
4059
4068
  (re == null ? void 0 : re.attachments) ?? []
4060
- ), Ee = [...st];
4061
- Pe != null && Pe.trim() && Ee.push({ type: "text", text: Pe });
4062
- const ye = {
4069
+ ), xe = [...mt];
4070
+ He != null && He.trim() && xe.push({ type: "text", text: He });
4071
+ const pe = {
4063
4072
  id: `msg-${Date.now()}`,
4064
4073
  role: "user",
4065
- content: Ee,
4074
+ content: xe,
4066
4075
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
4067
4076
  };
4068
- F(ye);
4069
- const bt = {
4070
- threadId: Ue,
4071
- checkpointId: (Ce == null ? void 0 : Ce.checkpointId) ?? E.lastCheckpointId ?? void 0,
4072
- checkpointNs: (Ce == null ? void 0 : Ce.checkpointNs) ?? E.lastCheckpointNs ?? void 0
4077
+ F(pe);
4078
+ const st = {
4079
+ threadId: Be,
4080
+ checkpointId: (we == null ? void 0 : we.checkpointId) ?? E.lastCheckpointId ?? void 0,
4081
+ checkpointNs: (we == null ? void 0 : we.checkpointNs) ?? E.lastCheckpointNs ?? void 0
4073
4082
  };
4074
- te(bt);
4083
+ te(st);
4075
4084
  },
4076
- [f, Se, F, E, te]
4085
+ [f, Te, F, E, te]
4077
4086
  ), lt = at(
4078
4087
  () => ({
4079
4088
  threads: x,
@@ -4082,14 +4091,14 @@ function Xx({
4082
4091
  isLoading: w,
4083
4092
  error: T,
4084
4093
  actions: {
4085
- createThread: Se,
4094
+ createThread: Te,
4086
4095
  deleteThread: je,
4087
4096
  renameThread: Ke,
4088
4097
  refreshThreads: se
4089
4098
  }
4090
4099
  }),
4091
- [x, m, w, T, Se, je, Ke, se]
4092
- ), kt = at(
4100
+ [x, m, w, T, Te, je, Ke, se]
4101
+ ), Tt = at(
4093
4102
  () => ({
4094
4103
  threadId: m,
4095
4104
  messages: E.messages,
@@ -4102,15 +4111,15 @@ function Xx({
4102
4111
  metadata: null,
4103
4112
  isLoading: S,
4104
4113
  isHistoryLoading: B,
4105
- isLoadingCheckpoint: Re,
4114
+ isLoadingCheckpoint: Ee,
4106
4115
  error: N,
4107
4116
  hasMore: $,
4108
4117
  loadOlder: Qe,
4109
4118
  clearState: Je,
4110
- navigateToCheckpoint: ze,
4119
+ navigateToCheckpoint: $e,
4111
4120
  setCurrentCheckpointId: qe,
4112
4121
  returnToLatest: Ge,
4113
- loadThread: Be,
4122
+ loadThread: ze,
4114
4123
  clearThread: Je,
4115
4124
  respondToInterrupt: nt
4116
4125
  }),
@@ -4120,30 +4129,30 @@ function Xx({
4120
4129
  X,
4121
4130
  S,
4122
4131
  B,
4123
- Re,
4132
+ Ee,
4124
4133
  N,
4125
4134
  $,
4126
4135
  Qe,
4127
4136
  Je,
4128
- ze,
4137
+ $e,
4129
4138
  qe,
4130
4139
  Ge,
4131
- Be,
4140
+ ze,
4132
4141
  nt
4133
4142
  ]
4134
- ), wt = at(
4143
+ ), bt = at(
4135
4144
  () => ({
4136
4145
  isStreaming: ne,
4137
- error: Le,
4146
+ error: De,
4138
4147
  connectionState: ne ? "connected" : "idle",
4139
4148
  submit: ut,
4140
4149
  send: ut,
4141
4150
  stop: ie,
4142
4151
  setAuthToken: Q
4143
4152
  }),
4144
- [ne, Le, ut, ie, Q]
4153
+ [ne, De, ut, ie, Q]
4145
4154
  );
4146
- return /* @__PURE__ */ u.jsx(Au.Provider, { value: lt, children: /* @__PURE__ */ u.jsx(ju.Provider, { value: kt, children: /* @__PURE__ */ u.jsx(_u.Provider, { value: wt, children: e }) }) });
4155
+ return /* @__PURE__ */ u.jsx(Au.Provider, { value: lt, children: /* @__PURE__ */ u.jsx(ju.Provider, { value: Tt, children: /* @__PURE__ */ u.jsx(_u.Provider, { value: bt, children: e }) }) });
4147
4156
  }
4148
4157
  function xa() {
4149
4158
  const e = xs(Au);
@@ -4287,8 +4296,8 @@ function Qx({
4287
4296
  try {
4288
4297
  const X = l(A);
4289
4298
  X && typeof X.then == "function" ? X.then(() => {
4290
- var fe, Re;
4291
- ((fe = S.current) == null ? void 0 : fe.id) === B && S.current.shouldClear && (x || (m(""), T.current && (T.current.style.height = "auto"), a == null || a(""))), ((Re = S.current) == null ? void 0 : Re.id) === B && (S.current = null);
4299
+ var fe, Ee;
4300
+ ((fe = S.current) == null ? void 0 : fe.id) === B && S.current.shouldClear && (x || (m(""), T.current && (T.current.style.height = "auto"), a == null || a(""))), ((Ee = S.current) == null ? void 0 : Ee.id) === B && (S.current = null);
4292
4301
  }).catch(() => {
4293
4302
  var fe;
4294
4303
  ((fe = S.current) == null ? void 0 : fe.id) === B && (S.current = null);
@@ -6236,7 +6245,7 @@ var Na = "PopperContent", [Fv, $v] = Ju(Na), nd = v.forwardRef(
6236
6245
  updatePositionStrategy: h = "optimized",
6237
6246
  onPlaced: x,
6238
6247
  ...y
6239
- } = e, m = Zu(Na, n), [g, w] = v.useState(null), b = Ve(t, (Le) => w(Le)), [T, C] = v.useState(null), S = Xu(T), k = (S == null ? void 0 : S.width) ?? 0, N = (S == null ? void 0 : S.height) ?? 0, I = r + (s !== "center" ? "-" + s : ""), E = typeof d == "number" ? d : { top: 0, right: 0, bottom: 0, left: 0, ...d }, _ = Array.isArray(c) ? c : [c], L = _.length > 0, F = {
6248
+ } = e, m = Zu(Na, n), [g, w] = v.useState(null), b = Ve(t, (De) => w(De)), [T, C] = v.useState(null), S = Xu(T), k = (S == null ? void 0 : S.width) ?? 0, N = (S == null ? void 0 : S.height) ?? 0, I = r + (s !== "center" ? "-" + s : ""), E = typeof d == "number" ? d : { top: 0, right: 0, bottom: 0, left: 0, ...d }, _ = Array.isArray(c) ? c : [c], L = _.length > 0, F = {
6240
6249
  padding: E,
6241
6250
  boundary: _.filter(Bv),
6242
6251
  // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
@@ -6245,7 +6254,7 @@ var Na = "PopperContent", [Fv, $v] = Ju(Na), nd = v.forwardRef(
6245
6254
  // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
6246
6255
  strategy: "fixed",
6247
6256
  placement: I,
6248
- whileElementsMounted: (...Le) => gv(...Le, {
6257
+ whileElementsMounted: (...De) => gv(...De, {
6249
6258
  animationFrame: h === "always"
6250
6259
  }),
6251
6260
  elements: {
@@ -6262,9 +6271,9 @@ var Na = "PopperContent", [Fv, $v] = Ju(Na), nd = v.forwardRef(
6262
6271
  l && jv({ ...F }),
6263
6272
  _v({
6264
6273
  ...F,
6265
- apply: ({ elements: Le, rects: Q, availableWidth: se, availableHeight: Se }) => {
6266
- const { width: je, height: Ke } = Q.reference, Be = Le.floating.style;
6267
- Be.setProperty("--radix-popper-available-width", `${se}px`), Be.setProperty("--radix-popper-available-height", `${Se}px`), Be.setProperty("--radix-popper-anchor-width", `${je}px`), Be.setProperty("--radix-popper-anchor-height", `${Ke}px`);
6274
+ apply: ({ elements: De, rects: Q, availableWidth: se, availableHeight: Te }) => {
6275
+ const { width: je, height: Ke } = Q.reference, ze = De.floating.style;
6276
+ ze.setProperty("--radix-popper-available-width", `${se}px`), ze.setProperty("--radix-popper-available-height", `${Te}px`), ze.setProperty("--radix-popper-anchor-width", `${je}px`), ze.setProperty("--radix-popper-anchor-height", `${Ke}px`);
6268
6277
  }
6269
6278
  }),
6270
6279
  T && Ov({ element: T, padding: a }),
@@ -6275,7 +6284,7 @@ var Na = "PopperContent", [Fv, $v] = Ju(Na), nd = v.forwardRef(
6275
6284
  Lt(() => {
6276
6285
  B && (X == null || X());
6277
6286
  }, [B, X]);
6278
- const fe = (W = D.arrow) == null ? void 0 : W.x, Re = (M = D.arrow) == null ? void 0 : M.y, Ne = ((H = D.arrow) == null ? void 0 : H.centerOffset) !== 0, [G, ee] = v.useState();
6287
+ const fe = (W = D.arrow) == null ? void 0 : W.x, Ee = (M = D.arrow) == null ? void 0 : M.y, Ne = ((H = D.arrow) == null ? void 0 : H.centerOffset) !== 0, [G, ee] = v.useState();
6279
6288
  return Lt(() => {
6280
6289
  g && ee(window.getComputedStyle(g).zIndex);
6281
6290
  }, [g]), /* @__PURE__ */ u.jsx(
@@ -6309,7 +6318,7 @@ var Na = "PopperContent", [Fv, $v] = Ju(Na), nd = v.forwardRef(
6309
6318
  placedSide: O,
6310
6319
  onArrowChange: C,
6311
6320
  arrowX: fe,
6312
- arrowY: Re,
6321
+ arrowY: Ee,
6313
6322
  shouldHideArrow: Ne,
6314
6323
  children: /* @__PURE__ */ u.jsx(
6315
6324
  _e.div,
@@ -6713,7 +6722,7 @@ function wi(e, t) {
6713
6722
  return typeof e == "function" ? e(t) : e && (e.current = t), e;
6714
6723
  }
6715
6724
  function dw(e, t) {
6716
- var n = me(function() {
6725
+ var n = ge(function() {
6717
6726
  return {
6718
6727
  // value
6719
6728
  value: e,
@@ -7274,7 +7283,7 @@ var an = "MenuContent", [eb, Pa] = dr(an), Ad = v.forwardRef(
7274
7283
  ...y
7275
7284
  } = e, m = fr(an, n), g = yo(an, n), w = Ls(n), b = Rd(n), T = Gw(n), [C, S] = v.useState(null), k = v.useRef(null), N = Ve(t, k, m.onContentChange), I = v.useRef(0), E = v.useRef(""), _ = v.useRef(0), L = v.useRef(null), F = v.useRef("right"), j = v.useRef(0), $ = x ? Ds : v.Fragment, A = x ? { as: rb, allowPinchZoom: !0 } : void 0, B = (O) => {
7276
7285
  var W, M;
7277
- const J = E.current + O, X = T().filter((H) => !H.disabled), fe = document.activeElement, Re = (W = X.find((H) => H.ref.current === fe)) == null ? void 0 : W.textValue, Ne = X.map((H) => H.textValue), G = mb(Ne, J, Re), ee = (M = X.find((H) => H.textValue === G)) == null ? void 0 : M.ref.current;
7286
+ const J = E.current + O, X = T().filter((H) => !H.disabled), fe = document.activeElement, Ee = (W = X.find((H) => H.ref.current === fe)) == null ? void 0 : W.textValue, Ne = X.map((H) => H.textValue), G = mb(Ne, J, Ee), ee = (M = X.find((H) => H.textValue === G)) == null ? void 0 : M.ref.current;
7278
7287
  (function H(te) {
7279
7288
  E.current = te, window.clearTimeout(I.current), te !== "" && (I.current = window.setTimeout(() => H(""), 1e3));
7280
7289
  })(J), ee && setTimeout(() => ee.focus());
@@ -7359,8 +7368,8 @@ var an = "MenuContent", [eb, Pa] = dr(an), Ad = v.forwardRef(
7359
7368
  ref: N,
7360
7369
  style: { outline: "none", ...y.style },
7361
7370
  onKeyDown: de(y.onKeyDown, (O) => {
7362
- const X = O.target.closest("[data-radix-menu-content]") === O.currentTarget, fe = O.ctrlKey || O.altKey || O.metaKey, Re = O.key.length === 1;
7363
- X && (O.key === "Tab" && O.preventDefault(), !fe && Re && B(O.key));
7371
+ const X = O.target.closest("[data-radix-menu-content]") === O.currentTarget, fe = O.ctrlKey || O.altKey || O.metaKey, Ee = O.key.length === 1;
7372
+ X && (O.key === "Tab" && O.preventDefault(), !fe && Ee && B(O.key));
7364
7373
  const Ne = k.current;
7365
7374
  if (O.target !== Ne || !Vw.includes(O.key)) return;
7366
7375
  O.preventDefault();
@@ -8087,22 +8096,22 @@ function Bs(e, t) {
8087
8096
  function p0(e, t) {
8088
8097
  return t(e);
8089
8098
  }
8090
- function xt(...e) {
8099
+ function yt(...e) {
8091
8100
  return e;
8092
8101
  }
8093
8102
  function ot(e, t) {
8094
8103
  return e(Kn, t);
8095
8104
  }
8096
- function De(e, t) {
8105
+ function Me(e, t) {
8097
8106
  e(zs, t);
8098
8107
  }
8099
8108
  function $a(e) {
8100
8109
  e(Pr);
8101
8110
  }
8102
- function It(e) {
8111
+ function Et(e) {
8103
8112
  return e(vf);
8104
8113
  }
8105
- function pe(e, t) {
8114
+ function he(e, t) {
8106
8115
  return ot(e, d0(t, zs));
8107
8116
  }
8108
8117
  function pn(e, t) {
@@ -8122,13 +8131,13 @@ function mc(e) {
8122
8131
  function bf(e, t) {
8123
8132
  return e === t;
8124
8133
  }
8125
- function gt(e = bf) {
8134
+ function xt(e = bf) {
8126
8135
  let t;
8127
8136
  return (n) => (r) => {
8128
8137
  e(t, r) || (t = r, n(r));
8129
8138
  };
8130
8139
  }
8131
- function ke(e) {
8140
+ function Re(e) {
8132
8141
  return (t) => (n) => {
8133
8142
  e(n) && t(n);
8134
8143
  };
@@ -8171,7 +8180,7 @@ function An(e) {
8171
8180
  }, e));
8172
8181
  };
8173
8182
  }
8174
- function Fe(...e) {
8183
+ function Le(...e) {
8175
8184
  const t = new Array(e.length);
8176
8185
  let n = 0, r = null;
8177
8186
  const o = Math.pow(2, e.length) - 1;
@@ -8223,7 +8232,7 @@ function Y(e) {
8223
8232
  };
8224
8233
  }
8225
8234
  function Ht(e, t) {
8226
- return Bs(Y(t), (n) => pe(e, n));
8235
+ return Bs(Y(t), (n) => he(e, n));
8227
8236
  }
8228
8237
  function We() {
8229
8238
  const e = [];
@@ -8246,7 +8255,7 @@ function We() {
8246
8255
  };
8247
8256
  }
8248
8257
  function en(e) {
8249
- return Bs(We(), (t) => pe(e, t));
8258
+ return Bs(We(), (t) => he(e, t));
8250
8259
  }
8251
8260
  function et(e, t = [], { singleton: n } = { singleton: !0 }) {
8252
8261
  return {
@@ -8266,14 +8275,14 @@ function x0(e) {
8266
8275
  };
8267
8276
  return n(e);
8268
8277
  }
8269
- function jt(...e) {
8278
+ function At(...e) {
8270
8279
  const t = We(), n = new Array(e.length);
8271
8280
  let r = 0;
8272
8281
  const o = Math.pow(2, e.length) - 1;
8273
8282
  return e.forEach((s, i) => {
8274
8283
  const a = Math.pow(2, i);
8275
8284
  ot(s, (l) => {
8276
- n[i] = l, r = r | a, r === o && De(t, n);
8285
+ n[i] = l, r = r | a, r === o && Me(t, n);
8277
8286
  });
8278
8287
  }), function(s, i) {
8279
8288
  switch (s) {
@@ -8286,8 +8295,8 @@ function jt(...e) {
8286
8295
  }
8287
8296
  };
8288
8297
  }
8289
- function Te(e, t = bf) {
8290
- return U(e, gt(t));
8298
+ function ke(e, t = bf) {
8299
+ return U(e, xt(t));
8291
8300
  }
8292
8301
  function Yi(...e) {
8293
8302
  return function(t, n) {
@@ -8314,7 +8323,7 @@ const y0 = {
8314
8323
  return {
8315
8324
  log: Y((t, n, r = 1) => {
8316
8325
  var o;
8317
- const s = (o = v0().VIRTUOSO_LOG_LEVEL) != null ? o : It(e);
8326
+ const s = (o = v0().VIRTUOSO_LOG_LEVEL) != null ? o : Et(e);
8318
8327
  r >= s && console[y0[r]](
8319
8328
  "%creact-virtuoso: %c%s %o",
8320
8329
  "color: #0253b3; font-weight: bold",
@@ -8436,19 +8445,19 @@ function Sf(e, t, n) {
8436
8445
  const Wt = et(
8437
8446
  () => {
8438
8447
  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);
8439
- return pe(
8448
+ return he(
8440
8449
  U(
8441
8450
  e,
8442
8451
  ce(({ scrollTop: m }) => m)
8443
8452
  ),
8444
8453
  t
8445
- ), pe(
8454
+ ), he(
8446
8455
  U(
8447
8456
  e,
8448
8457
  ce(({ scrollHeight: m }) => m)
8449
8458
  ),
8450
8459
  i
8451
- ), pe(t, o), {
8460
+ ), he(t, o), {
8452
8461
  deviation: n,
8453
8462
  fixedFooterHeight: c,
8454
8463
  fixedHeaderHeight: l,
@@ -8784,12 +8793,12 @@ const P0 = {
8784
8793
  }, En = et(
8785
8794
  ([{ log: e }, { recalcInProgress: t }]) => {
8786
8795
  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(
8787
- U(n, Fe(l, e, h), Cn(N0, x), gt()),
8796
+ U(n, Le(l, e, h), Cn(N0, x), xt()),
8788
8797
  x
8789
8798
  ), m = Ht(
8790
8799
  U(
8791
8800
  l,
8792
- gt(),
8801
+ xt(),
8793
8802
  Cn((C, S) => ({ current: S, prev: C.current }), {
8794
8803
  current: [],
8795
8804
  prev: []
@@ -8798,11 +8807,11 @@ const P0 = {
8798
8807
  ),
8799
8808
  []
8800
8809
  );
8801
- pe(
8810
+ he(
8802
8811
  U(
8803
8812
  l,
8804
- ke((C) => C.length > 0),
8805
- Fe(y, h),
8813
+ Re((C) => C.length > 0),
8814
+ Le(y, h),
8806
8815
  ce(([C, S, k]) => {
8807
8816
  const N = C.reduce((I, E, _) => Zt(I, E, so(E, S.offsetTree, k) || _), Sr());
8808
8817
  return {
@@ -8813,11 +8822,11 @@ const P0 = {
8813
8822
  })
8814
8823
  ),
8815
8824
  y
8816
- ), pe(
8825
+ ), he(
8817
8826
  U(
8818
8827
  r,
8819
- Fe(y),
8820
- ke(([C, { lastIndex: S }]) => C < S),
8828
+ Le(y),
8829
+ Re(([C, { lastIndex: S }]) => C < S),
8821
8830
  ce(([C, { lastIndex: S, lastSize: k }]) => [
8822
8831
  {
8823
8832
  endIndex: S,
@@ -8827,7 +8836,7 @@ const P0 = {
8827
8836
  ])
8828
8837
  ),
8829
8838
  n
8830
- ), pe(c, d);
8839
+ ), he(c, d);
8831
8840
  const g = Ht(
8832
8841
  U(
8833
8842
  c,
@@ -8835,10 +8844,10 @@ const P0 = {
8835
8844
  ),
8836
8845
  !0
8837
8846
  );
8838
- pe(
8847
+ he(
8839
8848
  U(
8840
8849
  d,
8841
- ke((C) => C !== void 0 && ft(It(y).sizeTree)),
8850
+ Re((C) => C !== void 0 && ft(Et(y).sizeTree)),
8842
8851
  ce((C) => [{ endIndex: 0, size: C, startIndex: 0 }])
8843
8852
  ),
8844
8853
  n
@@ -8846,7 +8855,7 @@ const P0 = {
8846
8855
  const w = en(
8847
8856
  U(
8848
8857
  n,
8849
- Fe(y),
8858
+ Le(y),
8850
8859
  Cn(
8851
8860
  ({ sizes: C }, [S, k]) => ({
8852
8861
  changed: k !== C,
@@ -8867,15 +8876,15 @@ const P0 = {
8867
8876
  ce((C) => C.diff)
8868
8877
  ),
8869
8878
  (C) => {
8870
- const { groupIndices: S } = It(y);
8879
+ const { groupIndices: S } = Et(y);
8871
8880
  if (C > 0)
8872
- De(t, !0), De(s, C + yc(C, S));
8881
+ Me(t, !0), Me(s, C + yc(C, S));
8873
8882
  else if (C < 0) {
8874
- const k = It(m);
8875
- k.length > 0 && (C -= yc(-C, k)), De(i, C);
8883
+ const k = Et(m);
8884
+ k.length > 0 && (C -= yc(-C, k)), Me(i, C);
8876
8885
  }
8877
8886
  }
8878
- ), ot(U(a, Fe(e)), ([C, S]) => {
8887
+ ), ot(U(a, Le(e)), ([C, S]) => {
8879
8888
  C < 0 && S(
8880
8889
  "`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",
8881
8890
  { firstItemIndex: a },
@@ -8883,10 +8892,10 @@ const P0 = {
8883
8892
  );
8884
8893
  });
8885
8894
  const b = en(s);
8886
- pe(
8895
+ he(
8887
8896
  U(
8888
8897
  s,
8889
- Fe(y),
8898
+ Le(y),
8890
8899
  ce(([C, S]) => {
8891
8900
  const k = S.groupIndices.length > 0, N = [], I = S.lastSize;
8892
8901
  if (k) {
@@ -8947,23 +8956,23 @@ const P0 = {
8947
8956
  const T = en(
8948
8957
  U(
8949
8958
  i,
8950
- Fe(y, h),
8959
+ Le(y, h),
8951
8960
  ce(([C, { offsetTree: S }, k]) => {
8952
8961
  const N = -C;
8953
8962
  return so(N, S, k);
8954
8963
  })
8955
8964
  )
8956
8965
  );
8957
- return pe(
8966
+ return he(
8958
8967
  U(
8959
8968
  i,
8960
- Fe(y, h),
8969
+ Le(y, h),
8961
8970
  ce(([C, S, k]) => {
8962
8971
  if (S.groupIndices.length > 0) {
8963
8972
  if (ft(S.sizeTree))
8964
8973
  return S;
8965
8974
  let N = Sr();
8966
- const I = It(m);
8975
+ const I = Et(m);
8967
8976
  let E = 0, _ = 0, L = 0;
8968
8977
  for (; E < -C; ) {
8969
8978
  L = I[_];
@@ -9014,7 +9023,7 @@ const P0 = {
9014
9023
  unshiftWith: s
9015
9024
  };
9016
9025
  },
9017
- xt(qn, Ba),
9026
+ yt(qn, Ba),
9018
9027
  { singleton: !0 }
9019
9028
  );
9020
9029
  function O0(e) {
@@ -9029,44 +9038,44 @@ function O0(e) {
9029
9038
  const _f = et(
9030
9039
  ([{ groupIndices: e, sizes: t, totalCount: n }, { headerHeight: r, scrollTop: o }]) => {
9031
9040
  const s = We(), i = We(), a = en(U(s, ce(O0)));
9032
- return pe(
9041
+ return he(
9033
9042
  U(
9034
9043
  a,
9035
9044
  ce((l) => l.totalCount)
9036
9045
  ),
9037
9046
  n
9038
- ), pe(
9047
+ ), he(
9039
9048
  U(
9040
9049
  a,
9041
9050
  ce((l) => l.groupIndices)
9042
9051
  ),
9043
9052
  e
9044
- ), pe(
9053
+ ), he(
9045
9054
  U(
9046
- jt(o, t, r),
9047
- ke(([l, c]) => Us(c)),
9055
+ At(o, t, r),
9056
+ Re(([l, c]) => Us(c)),
9048
9057
  ce(([l, c, d]) => gn(c.groupOffsetTree, Math.max(l - d, 0), "v")[0]),
9049
- gt(),
9058
+ xt(),
9050
9059
  ce((l) => [l])
9051
9060
  ),
9052
9061
  i
9053
9062
  ), { groupCounts: s, topItemsIndexes: i };
9054
9063
  },
9055
- xt(En, Wt)
9064
+ yt(En, Wt)
9056
9065
  ), Gn = et(
9057
9066
  ([{ log: e }]) => {
9058
9067
  const t = Y(!1), n = en(
9059
9068
  U(
9060
9069
  t,
9061
- ke((r) => r),
9062
- gt()
9070
+ Re((r) => r),
9071
+ xt()
9063
9072
  )
9064
9073
  );
9065
9074
  return ot(t, (r) => {
9066
- r && It(e)("props updated", {}, Xt.DEBUG);
9075
+ r && Et(e)("props updated", {}, Xt.DEBUG);
9067
9076
  }), { didMount: n, propsReady: t };
9068
9077
  },
9069
- xt(qn),
9078
+ yt(qn),
9070
9079
  { singleton: !0 }
9071
9080
  ), M0 = typeof document < "u" && "scrollBehavior" in document.documentElement.style;
9072
9081
  function Pf(e) {
@@ -9091,13 +9100,13 @@ const vo = et(
9091
9100
  const h = We(), x = We(), y = Y(0);
9092
9101
  let m = null, g = null, w = null;
9093
9102
  function b() {
9094
- m && (m(), m = null), w && (w(), w = null), g && (clearTimeout(g), g = null), De(l, !1);
9103
+ m && (m(), m = null), w && (w(), w = null), g && (clearTimeout(g), g = null), Me(l, !1);
9095
9104
  }
9096
- return pe(
9105
+ return he(
9097
9106
  U(
9098
9107
  h,
9099
- Fe(n, f, r, y, a, i, p),
9100
- Fe(e, s, o),
9108
+ Le(n, f, r, y, a, i, p),
9109
+ Le(e, s, o),
9101
9110
  ce(
9102
9111
  ([
9103
9112
  [T, C, S, k, N, I, E, _],
@@ -9108,21 +9117,21 @@ const vo = et(
9108
9117
  const $ = Pf(T), { align: A, behavior: B, offset: D } = $, O = k - 1, J = jf($, C, O);
9109
9118
  let X = so(J, C.offsetTree, L) + I;
9110
9119
  A === "end" ? (X += F + gn(C.sizeTree, J)[1] - S + j, J === O && (X += E)) : A === "center" ? X += (F + gn(C.sizeTree, J)[1] - S + j) / 2 : X -= N, D && (X += D);
9111
- const fe = (Re) => {
9112
- b(), Re ? (_("retrying to scroll to", { location: T }, Xt.DEBUG), De(h, T)) : (De(x, !0), _("list did not change, scroll successful", {}, Xt.DEBUG));
9120
+ const fe = (Ee) => {
9121
+ b(), Ee ? (_("retrying to scroll to", { location: T }, Xt.DEBUG), Me(h, T)) : (Me(x, !0), _("list did not change, scroll successful", {}, Xt.DEBUG));
9113
9122
  };
9114
9123
  if (b(), B === "smooth") {
9115
- let Re = !1;
9124
+ let Ee = !1;
9116
9125
  w = ot(t, (Ne) => {
9117
- Re = Re || Ne;
9126
+ Ee = Ee || Ne;
9118
9127
  }), m = pn(d, () => {
9119
- fe(Re);
9128
+ fe(Ee);
9120
9129
  });
9121
9130
  } else
9122
9131
  m = pn(U(t, D0(150)), fe);
9123
9132
  return g = setTimeout(() => {
9124
9133
  b();
9125
- }, 1200), De(l, !0), _("scrolling from index to", { behavior: B, index: J, top: X }, Xt.DEBUG), { behavior: B, top: X };
9134
+ }, 1200), Me(l, !0), _("scrolling from index to", { behavior: B, index: J, top: X }, Xt.DEBUG), { behavior: B, top: X };
9126
9135
  }
9127
9136
  )
9128
9137
  ),
@@ -9133,7 +9142,7 @@ const vo = et(
9133
9142
  topListHeight: y
9134
9143
  };
9135
9144
  },
9136
- xt(En, Wt, qn),
9145
+ yt(En, Wt, qn),
9137
9146
  { singleton: !0 }
9138
9147
  );
9139
9148
  function D0(e) {
@@ -9158,36 +9167,36 @@ function Wa(e, t) {
9158
9167
  const wo = et(
9159
9168
  ([{ defaultItemSize: e, listRefresh: t, sizes: n }, { scrollTop: r }, { scrollTargetReached: o, scrollToIndex: s }, { didMount: i }]) => {
9160
9169
  const a = Y(!0), l = Y(0), c = Y(!0);
9161
- return pe(
9170
+ return he(
9162
9171
  U(
9163
9172
  i,
9164
- Fe(l),
9165
- ke(([d, f]) => !!f),
9173
+ Le(l),
9174
+ Re(([d, f]) => !!f),
9166
9175
  wn(!1)
9167
9176
  ),
9168
9177
  a
9169
- ), pe(
9178
+ ), he(
9170
9179
  U(
9171
9180
  i,
9172
- Fe(l),
9173
- ke(([d, f]) => !!f),
9181
+ Le(l),
9182
+ Re(([d, f]) => !!f),
9174
9183
  wn(!1)
9175
9184
  ),
9176
9185
  c
9177
9186
  ), ot(
9178
9187
  U(
9179
- jt(t, i),
9180
- Fe(a, n, e, c),
9181
- ke(([[, d], f, { sizeTree: p }, h, x]) => d && (!ft(p) || Fa(h)) && !f && !x),
9182
- Fe(l)
9188
+ At(t, i),
9189
+ Le(a, n, e, c),
9190
+ Re(([[, d], f, { sizeTree: p }, h, x]) => d && (!ft(p) || Fa(h)) && !f && !x),
9191
+ Le(l)
9183
9192
  ),
9184
9193
  ([, d]) => {
9185
9194
  pn(o, () => {
9186
- De(c, !0);
9195
+ Me(c, !0);
9187
9196
  }), Ua(4, () => {
9188
9197
  pn(r, () => {
9189
- De(a, !0);
9190
- }), De(s, d);
9198
+ Me(a, !0);
9199
+ }), Me(s, d);
9191
9200
  });
9192
9201
  }
9193
9202
  ), {
@@ -9196,7 +9205,7 @@ const wo = et(
9196
9205
  scrolledToInitialItem: a
9197
9206
  };
9198
9207
  },
9199
- xt(En, Wt, vo, Gn),
9208
+ yt(En, Wt, vo, Gn),
9200
9209
  { singleton: !0 }
9201
9210
  );
9202
9211
  function Of(e, t) {
@@ -9214,25 +9223,25 @@ const io = "up", Vr = "down", L0 = "none", F0 = {
9214
9223
  }, $0 = 0, bo = et(([{ footerHeight: e, headerHeight: t, scrollBy: n, scrollContainerState: r, scrollTop: o, viewportHeight: s }]) => {
9215
9224
  const i = Y(!1), a = Y(!0), l = We(), c = We(), d = Y(4), f = Y($0), p = Ht(
9216
9225
  U(
9217
- Yi(U(Te(o), ar(1), wn(!0)), U(Te(o), ar(1), wn(!1), mc(100))),
9218
- gt()
9226
+ Yi(U(ke(o), ar(1), wn(!0)), U(ke(o), ar(1), wn(!1), mc(100))),
9227
+ xt()
9219
9228
  ),
9220
9229
  !1
9221
9230
  ), h = Ht(
9222
- U(Yi(U(n, wn(!0)), U(n, wn(!1), mc(200))), gt()),
9231
+ U(Yi(U(n, wn(!0)), U(n, wn(!1), mc(200))), xt()),
9223
9232
  !1
9224
9233
  );
9225
- pe(
9234
+ he(
9226
9235
  U(
9227
- jt(Te(o), Te(f)),
9236
+ At(ke(o), ke(f)),
9228
9237
  ce(([w, b]) => w <= b),
9229
- gt()
9238
+ xt()
9230
9239
  ),
9231
9240
  a
9232
- ), pe(U(a, An(50)), c);
9241
+ ), he(U(a, An(50)), c);
9233
9242
  const x = en(
9234
9243
  U(
9235
- jt(r, Te(s), Te(t), Te(e), Te(d)),
9244
+ At(r, ke(s), ke(t), ke(e), ke(d)),
9236
9245
  Cn((w, [{ scrollHeight: b, scrollTop: T }, C, S, k, N]) => {
9237
9246
  const I = T + C - b > -N, E = {
9238
9247
  scrollHeight: b,
@@ -9255,7 +9264,7 @@ const io = "up", Vr = "down", L0 = "none", F0 = {
9255
9264
  state: E
9256
9265
  };
9257
9266
  }, F0),
9258
- gt((w, b) => w && w.atBottom === b.atBottom)
9267
+ xt((w, b) => w && w.atBottom === b.atBottom)
9259
9268
  )
9260
9269
  ), y = Ht(
9261
9270
  U(
@@ -9286,46 +9295,46 @@ const io = "up", Vr = "down", L0 = "none", F0 = {
9286
9295
  },
9287
9296
  { changed: !1, jump: 0, scrollHeight: 0, scrollTop: 0 }
9288
9297
  ),
9289
- ke((w) => w.changed),
9298
+ Re((w) => w.changed),
9290
9299
  ce((w) => w.jump)
9291
9300
  ),
9292
9301
  0
9293
9302
  );
9294
- pe(
9303
+ he(
9295
9304
  U(
9296
9305
  x,
9297
9306
  ce((w) => w.atBottom)
9298
9307
  ),
9299
9308
  i
9300
- ), pe(U(i, An(50)), l);
9309
+ ), he(U(i, An(50)), l);
9301
9310
  const m = Y(Vr);
9302
- pe(
9311
+ he(
9303
9312
  U(
9304
9313
  r,
9305
9314
  ce(({ scrollTop: w }) => w),
9306
- gt(),
9315
+ xt(),
9307
9316
  Cn(
9308
- (w, b) => It(h) ? { direction: w.direction, prevScrollTop: b } : { direction: b < w.prevScrollTop ? io : Vr, prevScrollTop: b },
9317
+ (w, b) => Et(h) ? { direction: w.direction, prevScrollTop: b } : { direction: b < w.prevScrollTop ? io : Vr, prevScrollTop: b },
9309
9318
  { direction: Vr, prevScrollTop: 0 }
9310
9319
  ),
9311
9320
  ce((w) => w.direction)
9312
9321
  ),
9313
9322
  m
9314
- ), pe(U(r, An(50), wn(L0)), m);
9323
+ ), he(U(r, An(50), wn(L0)), m);
9315
9324
  const g = Y(0);
9316
- return pe(
9325
+ return he(
9317
9326
  U(
9318
9327
  p,
9319
- ke((w) => !w),
9328
+ Re((w) => !w),
9320
9329
  wn(0)
9321
9330
  ),
9322
9331
  g
9323
- ), pe(
9332
+ ), he(
9324
9333
  U(
9325
9334
  o,
9326
9335
  An(100),
9327
- Fe(p),
9328
- ke(([w, b]) => !!b),
9336
+ Le(p),
9337
+ Re(([w, b]) => !!b),
9329
9338
  Cn(([w, b], [T]) => [b, T], [0, 0]),
9330
9339
  ce(([w, b]) => b - w)
9331
9340
  ),
@@ -9343,7 +9352,7 @@ const io = "up", Vr = "down", L0 = "none", F0 = {
9343
9352
  scrollDirection: m,
9344
9353
  scrollVelocity: g
9345
9354
  };
9346
- }, xt(Wt)), ss = "top", is = "bottom", vc = "none";
9355
+ }, yt(Wt)), ss = "top", is = "bottom", vc = "none";
9347
9356
  function wc(e, t, n) {
9348
9357
  return typeof e == "number" ? n === io && t === ss || n === Vr && t === is ? e : 0 : n === io ? t === ss ? e.main : e.reverse : t === is ? e.main : e.reverse;
9349
9358
  }
@@ -9355,16 +9364,16 @@ const Va = et(
9355
9364
  ([{ deviation: e, fixedHeaderHeight: t, headerHeight: n, scrollTop: r, viewportHeight: o }]) => {
9356
9365
  const s = We(), i = Y(0), a = Y(0), l = Y(0), c = Ht(
9357
9366
  U(
9358
- jt(
9359
- Te(r),
9360
- Te(o),
9361
- Te(n),
9362
- Te(s, oo),
9363
- Te(l),
9364
- Te(i),
9365
- Te(t),
9366
- Te(e),
9367
- Te(a)
9367
+ At(
9368
+ ke(r),
9369
+ ke(o),
9370
+ ke(n),
9371
+ ke(s, oo),
9372
+ ke(l),
9373
+ ke(i),
9374
+ ke(t),
9375
+ ke(e),
9376
+ ke(a)
9368
9377
  ),
9369
9378
  ce(
9370
9379
  ([
@@ -9387,8 +9396,8 @@ const Va = et(
9387
9396
  ] : null;
9388
9397
  }
9389
9398
  ),
9390
- ke((d) => d != null),
9391
- gt(oo)
9399
+ Re((d) => d != null),
9400
+ xt(oo)
9392
9401
  ),
9393
9402
  [0, 0]
9394
9403
  );
@@ -9402,7 +9411,7 @@ const Va = et(
9402
9411
  visibleRange: c
9403
9412
  };
9404
9413
  },
9405
- xt(Wt),
9414
+ yt(Wt),
9406
9415
  { singleton: !0 }
9407
9416
  );
9408
9417
  function z0(e, t, n) {
@@ -9501,23 +9510,23 @@ const hr = et(
9501
9510
  { recalcInProgress: x }
9502
9511
  ]) => {
9503
9512
  const y = Y([]), m = Y(0), g = We();
9504
- pe(s.topItemsIndexes, y);
9513
+ he(s.topItemsIndexes, y);
9505
9514
  const w = Ht(
9506
9515
  U(
9507
- jt(
9516
+ At(
9508
9517
  h,
9509
9518
  x,
9510
- Te(l, oo),
9511
- Te(o),
9512
- Te(r),
9513
- Te(c),
9519
+ ke(l, oo),
9520
+ ke(o),
9521
+ ke(r),
9522
+ ke(c),
9514
9523
  d,
9515
- Te(y),
9516
- Te(t),
9517
- Te(n),
9524
+ ke(y),
9525
+ ke(t),
9526
+ ke(n),
9518
9527
  e
9519
9528
  ),
9520
- ke(([S, k, , N, , , , , , , I]) => {
9529
+ Re(([S, k, , N, , , , , , , I]) => {
9521
9530
  const E = I && I.length !== N;
9522
9531
  return S && !k && !E;
9523
9532
  }),
@@ -9535,7 +9544,7 @@ const hr = et(
9535
9544
  j,
9536
9545
  $
9537
9546
  ]) => {
9538
- const A = I, { offsetTree: B, sizeTree: D } = A, O = It(m);
9547
+ const A = I, { offsetTree: B, sizeTree: D } = A, O = Et(m);
9539
9548
  if (N === 0)
9540
9549
  return { ...Ti, totalCount: N };
9541
9550
  if (S === 0 && k === 0)
@@ -9564,7 +9573,7 @@ const hr = et(
9564
9573
  const X = L.length > 0 ? L[L.length - 1] + 1 : 0, fe = I0(B, S, k, X);
9565
9574
  if (fe.length === 0)
9566
9575
  return null;
9567
- const Re = N - 1, Ne = Bs([], (G) => {
9576
+ const Ee = N - 1, Ne = Bs([], (G) => {
9568
9577
  for (const ee of fe) {
9569
9578
  const W = ee.value;
9570
9579
  let M = W.offset, H = ee.start;
@@ -9575,7 +9584,7 @@ const hr = et(
9575
9584
  M += ne * te + ne * j;
9576
9585
  }
9577
9586
  H < X && (M += (X - H) * te, H = X);
9578
- const ie = Math.min(ee.end, Re);
9587
+ const ie = Math.min(ee.end, Ee);
9579
9588
  for (let ne = H; ne <= ie && !(M >= k); ne++)
9580
9589
  G.push({ data: $ == null ? void 0 : $[ne], index: ne, offset: M, size: te }), M += te + j;
9581
9590
  }
@@ -9584,31 +9593,31 @@ const hr = et(
9584
9593
  }
9585
9594
  ),
9586
9595
  //@ts-expect-error filter needs to be fixed
9587
- ke((S) => S !== null),
9588
- gt()
9596
+ Re((S) => S !== null),
9597
+ xt()
9589
9598
  ),
9590
9599
  Ti
9591
9600
  );
9592
- pe(
9601
+ he(
9593
9602
  U(
9594
9603
  e,
9595
- ke(Fa),
9604
+ Re(Fa),
9596
9605
  ce((S) => S == null ? void 0 : S.length)
9597
9606
  ),
9598
9607
  o
9599
- ), pe(
9608
+ ), he(
9600
9609
  U(
9601
9610
  w,
9602
9611
  ce((S) => S.topListHeight)
9603
9612
  ),
9604
9613
  f
9605
- ), pe(f, a), pe(
9614
+ ), he(f, a), he(
9606
9615
  U(
9607
9616
  w,
9608
9617
  ce((S) => [S.top, S.bottom])
9609
9618
  ),
9610
9619
  i
9611
- ), pe(
9620
+ ), he(
9612
9621
  U(
9613
9622
  w,
9614
9623
  ce((S) => S.items)
@@ -9618,25 +9627,25 @@ const hr = et(
9618
9627
  const b = en(
9619
9628
  U(
9620
9629
  w,
9621
- ke(({ items: S }) => S.length > 0),
9622
- Fe(o, e),
9623
- ke(([{ items: S }, k]) => S[S.length - 1].originalIndex === k - 1),
9630
+ Re(({ items: S }) => S.length > 0),
9631
+ Le(o, e),
9632
+ Re(([{ items: S }, k]) => S[S.length - 1].originalIndex === k - 1),
9624
9633
  ce(([, S, k]) => [S - 1, k]),
9625
- gt(oo),
9634
+ xt(oo),
9626
9635
  ce(([S]) => S)
9627
9636
  )
9628
9637
  ), T = en(
9629
9638
  U(
9630
9639
  w,
9631
9640
  An(200),
9632
- ke(({ items: S, topItems: k }) => S.length > 0 && S[0].originalIndex === k.length),
9641
+ Re(({ items: S, topItems: k }) => S.length > 0 && S[0].originalIndex === k.length),
9633
9642
  ce(({ items: S }) => S[0].index),
9634
- gt()
9643
+ xt()
9635
9644
  )
9636
9645
  ), C = en(
9637
9646
  U(
9638
9647
  w,
9639
- ke(({ items: S }) => S.length > 0),
9648
+ Re(({ items: S }) => S.length > 0),
9640
9649
  ce(({ items: S }) => {
9641
9650
  let k = 0, N = S.length - 1;
9642
9651
  for (; S[k].type === "group" && k < N; )
@@ -9648,12 +9657,12 @@ const hr = et(
9648
9657
  startIndex: S[k].index
9649
9658
  };
9650
9659
  }),
9651
- gt(If)
9660
+ xt(If)
9652
9661
  )
9653
9662
  );
9654
9663
  return { endReached: b, initialItemCount: m, itemsRendered: g, listState: w, rangeChanged: C, startReached: T, topItemsIndexes: y, ...p };
9655
9664
  },
9656
- xt(
9665
+ yt(
9657
9666
  En,
9658
9667
  _f,
9659
9668
  Va,
@@ -9668,30 +9677,30 @@ const hr = et(
9668
9677
  ([{ fixedFooterHeight: e, fixedHeaderHeight: t, footerHeight: n, headerHeight: r }, { listState: o }]) => {
9669
9678
  const s = We(), i = Ht(
9670
9679
  U(
9671
- jt(n, e, r, t, o),
9680
+ At(n, e, r, t, o),
9672
9681
  ce(([a, l, c, d, f]) => a + l + c + d + f.offsetBottom + f.bottom)
9673
9682
  ),
9674
9683
  0
9675
9684
  );
9676
- return pe(Te(i), s), { totalListHeight: i, totalListHeightChanged: s };
9685
+ return he(ke(i), s), { totalListHeight: i, totalListHeightChanged: s };
9677
9686
  },
9678
- xt(Wt, hr),
9687
+ yt(Wt, hr),
9679
9688
  { singleton: !0 }
9680
9689
  ), B0 = et(
9681
9690
  ([{ viewportHeight: e }, { totalListHeight: t }]) => {
9682
9691
  const n = Y(!1), r = Ht(
9683
9692
  U(
9684
- jt(n, e, t),
9685
- ke(([o]) => o),
9693
+ At(n, e, t),
9694
+ Re(([o]) => o),
9686
9695
  ce(([, o, s]) => Math.max(0, o - s)),
9687
9696
  An(0),
9688
- gt()
9697
+ xt()
9689
9698
  ),
9690
9699
  0
9691
9700
  );
9692
9701
  return { alignToBottom: n, paddingTopAddition: r };
9693
9702
  },
9694
- xt(Wt, Df),
9703
+ yt(Wt, Df),
9695
9704
  { singleton: !0 }
9696
9705
  ), Lf = et(() => ({
9697
9706
  context: Y(null)
@@ -9708,11 +9717,11 @@ const hr = et(
9708
9717
  { scrollToIndex: c }
9709
9718
  ]) => {
9710
9719
  const d = We();
9711
- return pe(
9720
+ return he(
9712
9721
  U(
9713
9722
  d,
9714
- Fe(t, l, n, s, o, r, a),
9715
- Fe(e),
9723
+ Le(t, l, n, s, o, r, a),
9724
+ Le(e),
9716
9725
  ce(([[f, p, h, x, y, m, g, w], b]) => {
9717
9726
  const { align: T, behavior: C, calculateViewLocation: S = H0, done: k, ...N } = f, I = jf(f, p, x - 1), E = so(I, p.offsetTree, b) + y + m, _ = E + gn(p.sizeTree, I)[1], L = w + m, F = w + h - g, j = S({
9718
9727
  itemBottom: _,
@@ -9724,22 +9733,22 @@ const hr = et(
9724
9733
  return j ? k && pn(
9725
9734
  U(
9726
9735
  i,
9727
- ke(($) => !$),
9736
+ Re(($) => !$),
9728
9737
  // skips the initial publish of false, and the cleanup call.
9729
9738
  // but if scrollingInProgress is true, we skip the initial publish.
9730
- ar(It(i) ? 1 : 2)
9739
+ ar(Et(i) ? 1 : 2)
9731
9740
  ),
9732
9741
  k
9733
9742
  ) : k && k(), j;
9734
9743
  }),
9735
- ke((f) => f !== null)
9744
+ Re((f) => f !== null)
9736
9745
  ),
9737
9746
  c
9738
9747
  ), {
9739
9748
  scrollIntoView: d
9740
9749
  };
9741
9750
  },
9742
- xt(En, Wt, vo, hr, qn),
9751
+ yt(En, Wt, vo, hr, qn),
9743
9752
  { singleton: !0 }
9744
9753
  );
9745
9754
  function Cc(e) {
@@ -9760,7 +9769,7 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = et(
9760
9769
  const x = Y(!1), y = We();
9761
9770
  let m = null;
9762
9771
  function g(C) {
9763
- De(i, {
9772
+ Me(i, {
9764
9773
  align: "end",
9765
9774
  behavior: C,
9766
9775
  index: "LAST"
@@ -9768,78 +9777,78 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = et(
9768
9777
  }
9769
9778
  ot(
9770
9779
  U(
9771
- jt(U(Te(t), ar(1)), l),
9772
- Fe(Te(x), s, a, f),
9780
+ At(U(ke(t), ar(1)), l),
9781
+ Le(ke(x), s, a, f),
9773
9782
  ce(([[C, S], k, N, I, E]) => {
9774
9783
  let _ = S && I, L = "auto";
9775
9784
  return _ && (L = U0(k, N || E), _ = _ && !!L), { followOutputBehavior: L, shouldFollow: _, totalCount: C };
9776
9785
  }),
9777
- ke(({ shouldFollow: C }) => C)
9786
+ Re(({ shouldFollow: C }) => C)
9778
9787
  ),
9779
9788
  ({ followOutputBehavior: C, totalCount: S }) => {
9780
- m && (m(), m = null), It(n) ? requestAnimationFrame(() => {
9781
- It(d)("following output to ", { totalCount: S }, Xt.DEBUG), g(C);
9789
+ m && (m(), m = null), Et(n) ? requestAnimationFrame(() => {
9790
+ Et(d)("following output to ", { totalCount: S }, Xt.DEBUG), g(C);
9782
9791
  }) : m = pn(e, () => {
9783
- It(d)("following output to ", { totalCount: S }, Xt.DEBUG), g(C), m = null;
9792
+ Et(d)("following output to ", { totalCount: S }, Xt.DEBUG), g(C), m = null;
9784
9793
  });
9785
9794
  }
9786
9795
  );
9787
9796
  function w(C) {
9788
9797
  const S = pn(o, (k) => {
9789
- C && !k.atBottom && k.notAtBottomBecause === "SIZE_INCREASED" && !m && (It(d)("scrolling to bottom due to increased size", {}, Xt.DEBUG), g("auto"));
9798
+ C && !k.atBottom && k.notAtBottomBecause === "SIZE_INCREASED" && !m && (Et(d)("scrolling to bottom due to increased size", {}, Xt.DEBUG), g("auto"));
9790
9799
  });
9791
9800
  setTimeout(S, 100);
9792
9801
  }
9793
9802
  ot(
9794
9803
  U(
9795
- jt(Te(x), t, c),
9796
- ke(([C, , S]) => C && S),
9804
+ At(ke(x), t, c),
9805
+ Re(([C, , S]) => C && S),
9797
9806
  Cn(
9798
9807
  ({ value: C }, [, S]) => ({ refreshed: C === S, value: S }),
9799
9808
  { refreshed: !1, value: 0 }
9800
9809
  ),
9801
- ke(({ refreshed: C }) => C),
9802
- Fe(x, t)
9810
+ Re(({ refreshed: C }) => C),
9811
+ Le(x, t)
9803
9812
  ),
9804
9813
  ([, C]) => {
9805
- It(a) && w(C !== !1);
9814
+ Et(a) && w(C !== !1);
9806
9815
  }
9807
9816
  ), ot(y, () => {
9808
- w(It(x) !== !1);
9809
- }), ot(jt(Te(x), o), ([C, S]) => {
9817
+ w(Et(x) !== !1);
9818
+ }), ot(At(ke(x), o), ([C, S]) => {
9810
9819
  C && !S.atBottom && S.notAtBottomBecause === "VIEWPORT_HEIGHT_DECREASING" && g("auto");
9811
9820
  });
9812
9821
  const b = Y(null), T = We();
9813
- return pe(
9822
+ return he(
9814
9823
  Yi(
9815
9824
  U(
9816
- Te(r),
9825
+ ke(r),
9817
9826
  ce((C) => {
9818
9827
  var S;
9819
9828
  return (S = C == null ? void 0 : C.length) != null ? S : 0;
9820
9829
  })
9821
9830
  ),
9822
- U(Te(t))
9831
+ U(ke(t))
9823
9832
  ),
9824
9833
  T
9825
9834
  ), ot(
9826
9835
  U(
9827
- jt(U(T, ar(1)), l),
9828
- Fe(Te(b), a, f, p),
9836
+ At(U(T, ar(1)), l),
9837
+ Le(ke(b), a, f, p),
9829
9838
  ce(([[C, S], k, N, I, E]) => S && N && (k == null ? void 0 : k({ context: E, totalCount: C, scrollingInProgress: I }))),
9830
- ke((C) => !!C),
9839
+ Re((C) => !!C),
9831
9840
  An(0)
9832
9841
  ),
9833
9842
  (C) => {
9834
- m && (m(), m = null), It(n) ? requestAnimationFrame(() => {
9835
- It(d)("scrolling into view", {}), De(h, C);
9843
+ m && (m(), m = null), Et(n) ? requestAnimationFrame(() => {
9844
+ Et(d)("scrolling into view", {}), Me(h, C);
9836
9845
  }) : m = pn(e, () => {
9837
- It(d)("scrolling into view", {}), De(h, C), m = null;
9846
+ Et(d)("scrolling into view", {}), Me(h, C), m = null;
9838
9847
  });
9839
9848
  }
9840
9849
  ), { autoscrollToBottom: y, followOutput: x, scrollIntoViewOnChange: b };
9841
9850
  },
9842
- xt(
9851
+ yt(
9843
9852
  En,
9844
9853
  bo,
9845
9854
  vo,
@@ -9851,17 +9860,17 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = et(
9851
9860
  Ff
9852
9861
  )
9853
9862
  ), V0 = et(
9854
- ([{ data: e, firstItemIndex: t, gap: n, sizes: r }, { initialTopMostItemIndex: o }, { initialItemCount: s, listState: i }, { didMount: a }]) => (pe(
9863
+ ([{ data: e, firstItemIndex: t, gap: n, sizes: r }, { initialTopMostItemIndex: o }, { initialItemCount: s, listState: i }, { didMount: a }]) => (he(
9855
9864
  U(
9856
9865
  a,
9857
- Fe(s),
9858
- ke(([, l]) => l !== 0),
9859
- Fe(o, r, t, n, e),
9866
+ Le(s),
9867
+ Re(([, l]) => l !== 0),
9868
+ Le(o, r, t, n, e),
9860
9869
  ce(([[, l], c, d, f, p, h = []]) => Mf(l, c, d, f, p, h))
9861
9870
  ),
9862
9871
  i
9863
9872
  ), {}),
9864
- xt(En, wo, hr, Gn),
9873
+ yt(En, wo, hr, Gn),
9865
9874
  { singleton: !0 }
9866
9875
  ), K0 = et(
9867
9876
  ([{ didMount: e }, { scrollTo: t }, { listState: n }]) => {
@@ -9869,8 +9878,8 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = et(
9869
9878
  return ot(
9870
9879
  U(
9871
9880
  e,
9872
- Fe(r),
9873
- ke(([, o]) => o !== 0),
9881
+ Le(r),
9882
+ Re(([, o]) => o !== 0),
9874
9883
  ce(([, o]) => ({ top: o }))
9875
9884
  ),
9876
9885
  (o) => {
@@ -9878,11 +9887,11 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = et(
9878
9887
  U(
9879
9888
  n,
9880
9889
  ar(1),
9881
- ke((s) => s.items.length > 1)
9890
+ Re((s) => s.items.length > 1)
9882
9891
  ),
9883
9892
  () => {
9884
9893
  requestAnimationFrame(() => {
9885
- De(t, o);
9894
+ Me(t, o);
9886
9895
  });
9887
9896
  }
9888
9897
  );
@@ -9891,16 +9900,16 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = et(
9891
9900
  initialScrollTop: r
9892
9901
  };
9893
9902
  },
9894
- xt(Gn, Wt, hr),
9903
+ yt(Gn, Wt, hr),
9895
9904
  { singleton: !0 }
9896
9905
  ), $f = et(
9897
9906
  ([{ scrollVelocity: e }]) => {
9898
9907
  const t = Y(!1), n = We(), r = Y(!1);
9899
- return pe(
9908
+ return he(
9900
9909
  U(
9901
9910
  e,
9902
- Fe(r, t, n),
9903
- ke(([o, s]) => !!s),
9911
+ Le(r, t, n),
9912
+ Re(([o, s]) => !!s),
9904
9913
  ce(([o, s, i, a]) => {
9905
9914
  const { enter: l, exit: c } = s;
9906
9915
  if (i) {
@@ -9910,23 +9919,23 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = et(
9910
9919
  return !0;
9911
9920
  return i;
9912
9921
  }),
9913
- gt()
9922
+ xt()
9914
9923
  ),
9915
9924
  t
9916
9925
  ), ot(
9917
- U(jt(t, e, n), Fe(r)),
9926
+ U(At(t, e, n), Le(r)),
9918
9927
  ([[o, s, i], a]) => {
9919
9928
  o && a && a.change && a.change(s, i);
9920
9929
  }
9921
9930
  ), { isSeeking: t, scrollSeekConfiguration: r, scrollSeekRangeChanged: n, scrollVelocity: e };
9922
9931
  },
9923
- xt(bo),
9932
+ yt(bo),
9924
9933
  { singleton: !0 }
9925
9934
  ), Ka = et(([{ scrollContainerState: e, scrollTo: t }]) => {
9926
9935
  const n = We(), r = We(), o = We(), s = Y(!1), i = Y(void 0);
9927
- return pe(
9936
+ return he(
9928
9937
  U(
9929
- jt(n, r),
9938
+ At(n, r),
9930
9939
  ce(([{ scrollHeight: a, scrollTop: l, viewportHeight: c }, { offsetTop: d }]) => ({
9931
9940
  scrollHeight: a,
9932
9941
  scrollTop: Math.max(0, l - d),
@@ -9934,10 +9943,10 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = et(
9934
9943
  }))
9935
9944
  ),
9936
9945
  e
9937
- ), pe(
9946
+ ), he(
9938
9947
  U(
9939
9948
  t,
9940
- Fe(r),
9949
+ Le(r),
9941
9950
  ce(([a, { offsetTop: l }]) => ({
9942
9951
  ...a,
9943
9952
  top: a.top + l
@@ -9954,7 +9963,7 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = et(
9954
9963
  windowScrollTo: o,
9955
9964
  windowViewportRect: r
9956
9965
  };
9957
- }, xt(Wt)), q0 = et(
9966
+ }, yt(Wt)), q0 = et(
9958
9967
  ([
9959
9968
  { sizeRanges: e, sizes: t },
9960
9969
  { headerHeight: n, scrollTop: r },
@@ -9963,21 +9972,21 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = et(
9963
9972
  { useWindowScroll: i, windowScrollContainerState: a, windowViewportRect: l }
9964
9973
  ]) => {
9965
9974
  const c = We(), d = Y(void 0), f = Y(null), p = Y(null);
9966
- return pe(a, f), pe(l, p), ot(
9975
+ return he(a, f), he(l, p), ot(
9967
9976
  U(
9968
9977
  c,
9969
- Fe(t, r, i, f, p, n)
9978
+ Le(t, r, i, f, p, n)
9970
9979
  ),
9971
9980
  ([h, x, y, m, g, w, b]) => {
9972
9981
  const T = A0(x.sizeTree);
9973
9982
  m && g !== null && w !== null && (y = g.scrollTop - w.offsetTop), y -= b, h({ ranges: T, scrollTop: y });
9974
9983
  }
9975
- ), pe(U(d, ke(Fa), ce(G0)), o), pe(
9984
+ ), he(U(d, Re(Fa), ce(G0)), o), he(
9976
9985
  U(
9977
9986
  s,
9978
- Fe(d),
9979
- ke(([, h]) => h !== void 0),
9980
- gt(),
9987
+ Le(d),
9988
+ Re(([, h]) => h !== void 0),
9989
+ xt(),
9981
9990
  ce(([, h]) => h.ranges)
9982
9991
  ),
9983
9992
  e
@@ -9986,22 +9995,22 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = et(
9986
9995
  restoreStateFrom: d
9987
9996
  };
9988
9997
  },
9989
- xt(En, Wt, wo, Gn, Ka)
9998
+ yt(En, Wt, wo, Gn, Ka)
9990
9999
  );
9991
10000
  function G0(e) {
9992
10001
  return { align: "start", index: 0, offset: e.scrollTop };
9993
10002
  }
9994
10003
  const Y0 = et(([{ topItemsIndexes: e }]) => {
9995
10004
  const t = Y(0);
9996
- return pe(
10005
+ return he(
9997
10006
  U(
9998
10007
  t,
9999
- ke((n) => n >= 0),
10008
+ Re((n) => n >= 0),
10000
10009
  ce((n) => Array.from({ length: n }).map((r, o) => o))
10001
10010
  ),
10002
10011
  e
10003
10012
  ), { topItemCount: t };
10004
- }, xt(hr));
10013
+ }, yt(hr));
10005
10014
  function zf(e) {
10006
10015
  let t = !1, n;
10007
10016
  return () => (t || (t = !0, n = e()), n);
@@ -10018,7 +10027,7 @@ const X0 = zf(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
10018
10027
  const y = en(
10019
10028
  U(
10020
10029
  l,
10021
- Fe(i),
10030
+ Le(i),
10022
10031
  Cn(
10023
10032
  ([, g, w, b], [{ bottom: T, items: C, offsetBottom: S, totalCount: k }, N]) => {
10024
10033
  const I = T + S;
@@ -10027,26 +10036,26 @@ const X0 = zf(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
10027
10036
  },
10028
10037
  [0, [], 0, 0]
10029
10038
  ),
10030
- ke(([g]) => g !== 0),
10031
- Fe(r, a, n, o, h, x),
10032
- ke(([, g, w, b, , , T]) => !T && !b && g !== 0 && w === io),
10039
+ Re(([g]) => g !== 0),
10040
+ Le(r, a, n, o, h, x),
10041
+ Re(([, g, w, b, , , T]) => !T && !b && g !== 0 && w === io),
10033
10042
  ce(([[g], , , , , w]) => (w("Upward scrolling compensation", { amount: g }, Xt.DEBUG), g))
10034
10043
  )
10035
10044
  );
10036
10045
  function m(g) {
10037
- g > 0 ? (De(t, { behavior: "auto", top: -g }), De(e, 0)) : (De(e, 0), De(t, { behavior: "auto", top: -g }));
10046
+ g > 0 ? (Me(t, { behavior: "auto", top: -g }), Me(e, 0)) : (Me(e, 0), Me(t, { behavior: "auto", top: -g }));
10038
10047
  }
10039
- return ot(U(y, Fe(e, s)), ([g, w, b]) => {
10040
- b && X0() ? De(e, w - g) : m(-g);
10048
+ return ot(U(y, Le(e, s)), ([g, w, b]) => {
10049
+ b && X0() ? Me(e, w - g) : m(-g);
10041
10050
  }), ot(
10042
10051
  U(
10043
- jt(Ht(s, !1), e, x),
10044
- ke(([g, w, b]) => !g && !b && w !== 0),
10052
+ At(Ht(s, !1), e, x),
10053
+ Re(([g, w, b]) => !g && !b && w !== 0),
10045
10054
  ce(([g, w]) => w),
10046
10055
  An(1)
10047
10056
  ),
10048
10057
  m
10049
- ), pe(
10058
+ ), he(
10050
10059
  U(
10051
10060
  f,
10052
10061
  ce((g) => ({ top: -g }))
@@ -10055,7 +10064,7 @@ const X0 = zf(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
10055
10064
  ), ot(
10056
10065
  U(
10057
10066
  c,
10058
- Fe(p, d),
10067
+ Le(p, d),
10059
10068
  ce(([g, { groupIndices: w, lastSize: b, sizeTree: T }, C]) => {
10060
10069
  function S(k) {
10061
10070
  return k * (b + C);
@@ -10076,15 +10085,15 @@ const X0 = zf(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
10076
10085
  })
10077
10086
  ),
10078
10087
  (g) => {
10079
- De(e, g), requestAnimationFrame(() => {
10080
- De(t, { top: g }), requestAnimationFrame(() => {
10081
- De(e, 0), De(x, !1);
10088
+ Me(e, g), requestAnimationFrame(() => {
10089
+ Me(t, { top: g }), requestAnimationFrame(() => {
10090
+ Me(e, 0), Me(x, !1);
10082
10091
  });
10083
10092
  });
10084
10093
  }
10085
10094
  ), { deviation: e };
10086
10095
  },
10087
- xt(Wt, bo, hr, En, qn, Ba)
10096
+ yt(Wt, bo, hr, En, qn, Ba)
10088
10097
  ), Z0 = et(
10089
10098
  ([
10090
10099
  e,
@@ -10111,7 +10120,7 @@ const X0 = zf(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
10111
10120
  ...c,
10112
10121
  ...d
10113
10122
  }),
10114
- xt(
10123
+ yt(
10115
10124
  Va,
10116
10125
  V0,
10117
10126
  Gn,
@@ -10150,7 +10159,7 @@ const X0 = zf(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
10150
10159
  { topItemCount: k },
10151
10160
  { groupCounts: N },
10152
10161
  I
10153
- ]) => (pe(T.rangeChanged, I.scrollSeekRangeChanged), pe(
10162
+ ]) => (he(T.rangeChanged, I.scrollSeekRangeChanged), he(
10154
10163
  U(
10155
10164
  I.windowViewportRect,
10156
10165
  ce((E) => E.visibleHeight)
@@ -10187,7 +10196,7 @@ const X0 = zf(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
10187
10196
  sizes: l,
10188
10197
  ...m
10189
10198
  }),
10190
- xt(
10199
+ yt(
10191
10200
  En,
10192
10201
  wo,
10193
10202
  Wt,
@@ -10215,22 +10224,22 @@ const _o = typeof document < "u" ? z.useLayoutEffect : z.useEffect;
10215
10224
  function Hf(e, t, n) {
10216
10225
  const r = Object.keys(t.required || {}), o = Object.keys(t.optional || {}), s = Object.keys(t.methods || {}), i = Object.keys(t.events || {}), a = z.createContext({});
10217
10226
  function l(m, g) {
10218
- m.propsReady && De(m.propsReady, !1);
10227
+ m.propsReady && Me(m.propsReady, !1);
10219
10228
  for (const w of r) {
10220
10229
  const b = m[t.required[w]];
10221
- De(b, g[w]);
10230
+ Me(b, g[w]);
10222
10231
  }
10223
10232
  for (const w of o)
10224
10233
  if (w in g) {
10225
10234
  const b = m[t.optional[w]];
10226
- De(b, g[w]);
10235
+ Me(b, g[w]);
10227
10236
  }
10228
- m.propsReady && De(m.propsReady, !0);
10237
+ m.propsReady && Me(m.propsReady, !0);
10229
10238
  }
10230
10239
  function c(m) {
10231
10240
  return s.reduce((g, w) => (g[w] = (b) => {
10232
10241
  const T = m[t.methods[w]];
10233
- De(T, b);
10242
+ Me(T, b);
10234
10243
  }, g), {});
10235
10244
  }
10236
10245
  function d(m) {
@@ -10255,7 +10264,7 @@ function Hf(e, t, n) {
10255
10264
  const g = z.useContext(a);
10256
10265
  return z.useCallback(
10257
10266
  (w) => {
10258
- De(g[m], w);
10267
+ Me(g[m], w);
10259
10268
  },
10260
10269
  [g, m]
10261
10270
  );
@@ -10266,11 +10275,11 @@ function Hf(e, t, n) {
10266
10275
  );
10267
10276
  return z.useSyncExternalStore(
10268
10277
  w,
10269
- () => It(g),
10270
- () => It(g)
10278
+ () => Et(g),
10279
+ () => Et(g)
10271
10280
  );
10272
10281
  }, x = (m) => {
10273
- const g = z.useContext(a)[m], [w, b] = z.useState(hc(It, g));
10282
+ const g = z.useContext(a)[m], [w, b] = z.useState(hc(Et, g));
10274
10283
  return _o(
10275
10284
  () => ot(g, (T) => {
10276
10285
  T !== w && b(pc(T));
@@ -10360,7 +10369,7 @@ const tS = /* @__PURE__ */ et(() => {
10360
10369
  U(
10361
10370
  n,
10362
10371
  ce((c) => c[a]),
10363
- gt()
10372
+ xt()
10364
10373
  ),
10365
10374
  l
10366
10375
  );
@@ -10383,7 +10392,7 @@ const tS = /* @__PURE__ */ et(() => {
10383
10392
  };
10384
10393
  }), nS = /* @__PURE__ */ et(
10385
10394
  ([e, t]) => ({ ...e, ...t }),
10386
- xt(Bf, tS)
10395
+ yt(Bf, tS)
10387
10396
  ), 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 }) {
10388
10397
  const t = Ae("listState"), n = on("sizeRanges"), r = Ae("useWindowScroll"), o = Ae("customScrollParent"), s = on("windowScrollContainerState"), i = on("scrollContainerState"), a = o || r ? s : i, l = Ae("itemContent"), c = Ae("context"), d = Ae("groupContent"), f = Ae("trackItemSizes"), p = Ae("itemSize"), h = Ae("log"), x = on("gap"), y = Ae("horizontalDirection"), { callbackRef: m } = w0(
10389
10398
  n,
@@ -10673,7 +10682,7 @@ const fS = ({ children: e }) => {
10673
10682
  U(
10674
10683
  s,
10675
10684
  ce((f) => f[c]),
10676
- gt()
10685
+ xt()
10677
10686
  ),
10678
10687
  d
10679
10688
  );
@@ -10698,7 +10707,7 @@ const fS = ({ children: e }) => {
10698
10707
  GroupComponent: l("Group", "tr")
10699
10708
  };
10700
10709
  });
10701
- xt(Bf, wS);
10710
+ yt(Bf, wS);
10702
10711
  qa();
10703
10712
  const Rc = {
10704
10713
  bottom: 0,
@@ -10746,55 +10755,55 @@ const TS = /* @__PURE__ */ et(
10746
10755
  ot(
10747
10756
  U(
10748
10757
  x,
10749
- Fe(O),
10750
- ke(([M, H]) => !!H)
10758
+ Le(O),
10759
+ Re(([M, H]) => !!H)
10751
10760
  ),
10752
10761
  () => {
10753
- De(J, !1);
10762
+ Me(J, !1);
10754
10763
  }
10755
10764
  ), ot(
10756
10765
  U(
10757
- jt(x, J, E, I, O, X),
10758
- ke(([M, H, te, ie, , ne]) => M && !H && te.height !== 0 && ie.height !== 0 && !ne)
10766
+ At(x, J, E, I, O, X),
10767
+ Re(([M, H, te, ie, , ne]) => M && !H && te.height !== 0 && ie.height !== 0 && !ne)
10759
10768
  ),
10760
10769
  ([, , , , M]) => {
10761
- De(X, !0), Ua(1, () => {
10762
- De(_, M);
10770
+ Me(X, !0), Ua(1, () => {
10771
+ Me(_, M);
10763
10772
  }), pn(U(c), () => {
10764
- De(t, [0, 0]), De(J, !0);
10773
+ Me(t, [0, 0]), Me(J, !0);
10765
10774
  });
10766
10775
  }
10767
- ), pe(
10776
+ ), he(
10768
10777
  U(
10769
10778
  B,
10770
- ke((M) => M != null && M.scrollTop > 0),
10779
+ Re((M) => M != null && M.scrollTop > 0),
10771
10780
  wn(0)
10772
10781
  ),
10773
10782
  k
10774
10783
  ), ot(
10775
10784
  U(
10776
10785
  x,
10777
- Fe(B),
10778
- ke(([, M]) => M != null)
10786
+ Le(B),
10787
+ Re(([, M]) => M != null)
10779
10788
  ),
10780
10789
  ([, M]) => {
10781
- M && (De(I, M.viewport), De(E, M.item), De($, M.gap), M.scrollTop > 0 && (De(D, !0), pn(U(c, ar(1)), (H) => {
10782
- De(D, !1);
10783
- }), De(l, { top: M.scrollTop })));
10790
+ M && (Me(I, M.viewport), Me(E, M.item), Me($, M.gap), M.scrollTop > 0 && (Me(D, !0), pn(U(c, ar(1)), (H) => {
10791
+ Me(D, !1);
10792
+ }), Me(l, { top: M.scrollTop })));
10784
10793
  }
10785
- ), pe(
10794
+ ), he(
10786
10795
  U(
10787
10796
  I,
10788
10797
  ce(({ height: M }) => M)
10789
10798
  ),
10790
10799
  f
10791
- ), pe(
10800
+ ), he(
10792
10801
  U(
10793
- jt(
10794
- Te(I, Po),
10795
- Te(E, Po),
10796
- Te($, (M, H) => M && M.column === H.column && M.row === H.row),
10797
- Te(c)
10802
+ At(
10803
+ ke(I, Po),
10804
+ ke(E, Po),
10805
+ ke($, (M, H) => M && M.column === H.column && M.row === H.row),
10806
+ ke(c)
10798
10807
  ),
10799
10808
  ce(([M, H, te, ie]) => ({
10800
10809
  gap: te,
@@ -10804,120 +10813,120 @@ const TS = /* @__PURE__ */ et(
10804
10813
  }))
10805
10814
  ),
10806
10815
  A
10807
- ), pe(
10816
+ ), he(
10808
10817
  U(
10809
- jt(
10810
- Te(S),
10818
+ At(
10819
+ ke(S),
10811
10820
  r,
10812
- Te($, CS),
10813
- Te(E, Po),
10814
- Te(I, Po),
10815
- Te(j),
10816
- Te(k),
10817
- Te(D),
10818
- Te(J),
10819
- Te(O)
10821
+ ke($, CS),
10822
+ ke(E, Po),
10823
+ ke(I, Po),
10824
+ ke(j),
10825
+ ke(k),
10826
+ ke(D),
10827
+ ke(J),
10828
+ ke(O)
10820
10829
  ),
10821
- ke(([, , , , , , , M]) => !M),
10830
+ Re(([, , , , , , , M]) => !M),
10822
10831
  ce(
10823
10832
  ([
10824
10833
  M,
10825
10834
  [H, te],
10826
10835
  ie,
10827
10836
  ne,
10828
- Le,
10837
+ De,
10829
10838
  Q,
10830
10839
  se,
10831
10840
  ,
10832
- Se,
10841
+ Te,
10833
10842
  je
10834
10843
  ]) => {
10835
- const { column: Ke, row: Be } = ie, { height: ze, width: qe } = ne, { width: Ge } = Le;
10844
+ const { column: Ke, row: ze } = ie, { height: $e, width: qe } = ne, { width: Ge } = De;
10836
10845
  if (se === 0 && (M === 0 || Ge === 0))
10837
10846
  return Rc;
10838
10847
  if (qe === 0) {
10839
- const re = Wa(je, M), Ce = re + Math.max(se - 1, 0);
10840
- return SS(Nc(re, Ce, Q));
10848
+ const re = Wa(je, M), we = re + Math.max(se - 1, 0);
10849
+ return SS(Nc(re, we, Q));
10841
10850
  }
10842
10851
  const Qe = Xf(Ge, qe, Ke);
10843
10852
  let Je, nt;
10844
- Se ? H === 0 && te === 0 && se > 0 ? (Je = 0, nt = se - 1) : (Je = Qe * as((H + Be) / (ze + Be)), nt = Qe * Ec((te + Be) / (ze + Be)) - 1, nt = Ei(M - 1, Kr(nt, Qe - 1)), Je = Ei(nt, Kr(0, Je))) : (Je = 0, nt = -1);
10845
- const Tt = Nc(Je, nt, Q), { bottom: ut, top: lt } = Ac(Le, ie, ne, Tt), kt = Ec(M / Qe), wt = kt * ze + (kt - 1) * Be - ut;
10846
- return { bottom: ut, itemHeight: ze, items: Tt, itemWidth: qe, offsetBottom: wt, offsetTop: lt, top: lt };
10853
+ Te ? H === 0 && te === 0 && se > 0 ? (Je = 0, nt = se - 1) : (Je = Qe * as((H + ze) / ($e + ze)), nt = Qe * Ec((te + ze) / ($e + ze)) - 1, nt = Ei(M - 1, Kr(nt, Qe - 1)), Je = Ei(nt, Kr(0, Je))) : (Je = 0, nt = -1);
10854
+ const jt = Nc(Je, nt, Q), { bottom: ut, top: lt } = Ac(De, ie, ne, jt), Tt = Ec(M / Qe), bt = Tt * $e + (Tt - 1) * ze - ut;
10855
+ return { bottom: ut, itemHeight: $e, items: jt, itemWidth: qe, offsetBottom: bt, offsetTop: lt, top: lt };
10847
10856
  }
10848
10857
  )
10849
10858
  ),
10850
10859
  N
10851
- ), pe(
10860
+ ), he(
10852
10861
  U(
10853
10862
  j,
10854
- ke((M) => M !== null),
10863
+ Re((M) => M !== null),
10855
10864
  ce((M) => M.length)
10856
10865
  ),
10857
10866
  S
10858
- ), pe(
10867
+ ), he(
10859
10868
  U(
10860
- jt(I, E, N, $),
10861
- ke(([M, H, { items: te }]) => te.length > 0 && H.height !== 0 && M.height !== 0),
10869
+ At(I, E, N, $),
10870
+ Re(([M, H, { items: te }]) => te.length > 0 && H.height !== 0 && M.height !== 0),
10862
10871
  ce(([M, H, { items: te }, ie]) => {
10863
- const { bottom: ne, top: Le } = Ac(M, ie, H, te);
10864
- return [Le, ne];
10872
+ const { bottom: ne, top: De } = Ac(M, ie, H, te);
10873
+ return [De, ne];
10865
10874
  }),
10866
- gt(oo)
10875
+ xt(oo)
10867
10876
  ),
10868
10877
  t
10869
10878
  );
10870
- const Re = Y(!1);
10871
- pe(
10879
+ const Ee = Y(!1);
10880
+ he(
10872
10881
  U(
10873
10882
  c,
10874
- Fe(Re),
10883
+ Le(Ee),
10875
10884
  ce(([M, H]) => H || M !== 0)
10876
10885
  ),
10877
- Re
10886
+ Ee
10878
10887
  );
10879
10888
  const Ne = en(
10880
10889
  U(
10881
- jt(N, S),
10882
- ke(([{ items: M }]) => M.length > 0),
10883
- Fe(Re),
10884
- ke(([[M, H], te]) => {
10890
+ At(N, S),
10891
+ Re(([{ items: M }]) => M.length > 0),
10892
+ Le(Ee),
10893
+ Re(([[M, H], te]) => {
10885
10894
  const ie = M.items[M.items.length - 1].index === H - 1;
10886
10895
  return (te || M.bottom > 0 && M.itemHeight > 0 && M.offsetBottom === 0 && M.items.length === H) && ie;
10887
10896
  }),
10888
10897
  ce(([[, M]]) => M - 1),
10889
- gt()
10898
+ xt()
10890
10899
  )
10891
10900
  ), G = en(
10892
10901
  U(
10893
- Te(N),
10894
- ke(({ items: M }) => M.length > 0 && M[0].index === 0),
10902
+ ke(N),
10903
+ Re(({ items: M }) => M.length > 0 && M[0].index === 0),
10895
10904
  wn(0),
10896
- gt()
10905
+ xt()
10897
10906
  )
10898
10907
  ), ee = en(
10899
10908
  U(
10900
- Te(N),
10901
- Fe(D),
10902
- ke(([{ items: M }, H]) => M.length > 0 && !H),
10909
+ ke(N),
10910
+ Le(D),
10911
+ Re(([{ items: M }, H]) => M.length > 0 && !H),
10903
10912
  ce(([{ items: M }]) => ({
10904
10913
  endIndex: M[M.length - 1].index,
10905
10914
  startIndex: M[0].index
10906
10915
  })),
10907
- gt(If),
10916
+ xt(If),
10908
10917
  An(0)
10909
10918
  )
10910
10919
  );
10911
- pe(ee, h.scrollSeekRangeChanged), pe(
10920
+ he(ee, h.scrollSeekRangeChanged), he(
10912
10921
  U(
10913
10922
  _,
10914
- Fe(I, E, S, $),
10923
+ Le(I, E, S, $),
10915
10924
  ce(([M, H, te, ie, ne]) => {
10916
- const Le = Pf(M), { align: Q, behavior: se, offset: Se } = Le;
10917
- let je = Le.index;
10925
+ const De = Pf(M), { align: Q, behavior: se, offset: Te } = De;
10926
+ let je = De.index;
10918
10927
  je === "LAST" && (je = ie - 1), je = Kr(0, je, Ei(ie - 1, je));
10919
10928
  let Ke = ea(H, ne, te, je);
10920
- return Q === "end" ? Ke = Ic(Ke - H.height + te.height) : Q === "center" && (Ke = Ic(Ke - H.height / 2 + te.height / 2)), Se && (Ke += Se), { behavior: se, top: Ke };
10929
+ return Q === "end" ? Ke = Ic(Ke - H.height + te.height) : Q === "center" && (Ke = Ic(Ke - H.height / 2 + te.height / 2)), Te && (Ke += Te), { behavior: se, top: Ke };
10921
10930
  })
10922
10931
  ),
10923
10932
  l
@@ -10929,7 +10938,7 @@ const TS = /* @__PURE__ */ et(
10929
10938
  ),
10930
10939
  0
10931
10940
  );
10932
- return pe(
10941
+ return he(
10933
10942
  U(
10934
10943
  T,
10935
10944
  ce((M) => ({ height: M.visibleHeight, width: M.visibleWidth }))
@@ -10977,7 +10986,7 @@ const TS = /* @__PURE__ */ et(
10977
10986
  ...C
10978
10987
  };
10979
10988
  },
10980
- xt(Va, Wt, bo, $f, Gn, Ka, qn)
10989
+ yt(Va, Wt, bo, $f, Gn, Ka, qn)
10981
10990
  );
10982
10991
  function Xf(e, t, n) {
10983
10992
  return Kr(1, as((e + n) / (as(t) + n)));
@@ -10998,11 +11007,11 @@ const kS = /* @__PURE__ */ et(() => {
10998
11007
  U(
10999
11008
  t,
11000
11009
  ce((h) => h[f]),
11001
- gt()
11010
+ xt()
11002
11011
  ),
11003
11012
  p
11004
11013
  ), c = Y(!1), d = Y(!1);
11005
- return pe(Te(d), c), {
11014
+ return he(ke(d), c), {
11006
11015
  components: t,
11007
11016
  computeItemKey: s,
11008
11017
  context: n,
@@ -11022,9 +11031,9 @@ const kS = /* @__PURE__ */ et(() => {
11022
11031
  };
11023
11032
  }), RS = /* @__PURE__ */ et(
11024
11033
  ([e, t]) => ({ ...e, ...t }),
11025
- xt(TS, kS)
11034
+ yt(TS, kS)
11026
11035
  ), ES = /* @__PURE__ */ z.memo(function() {
11027
- const e = vt("gridState"), t = vt("listClassName"), n = vt("itemClassName"), r = vt("itemContent"), o = vt("computeItemKey"), s = vt("isSeeking"), i = sn("scrollHeight"), a = vt("ItemComponent"), l = vt("ListComponent"), c = vt("ScrollSeekPlaceholder"), d = vt("context"), f = sn("itemDimensions"), p = sn("gap"), h = vt("log"), x = vt("stateRestoreInProgress"), y = sn("reportReadyState"), m = pr(
11036
+ 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(
11028
11037
  z.useMemo(
11029
11038
  () => (g) => {
11030
11039
  const w = g.parentElement.parentElement.scrollHeight;
@@ -11079,7 +11088,7 @@ const kS = /* @__PURE__ */ et(() => {
11079
11088
  }
11080
11089
  );
11081
11090
  }), IS = z.memo(function() {
11082
- const e = vt("HeaderComponent"), t = sn("headerHeight"), n = vt("headerFooterTag"), r = pr(
11091
+ const e = wt("HeaderComponent"), t = sn("headerHeight"), n = wt("headerFooterTag"), r = pr(
11083
11092
  z.useMemo(
11084
11093
  () => (s) => {
11085
11094
  t(Un(s, "height"));
@@ -11088,10 +11097,10 @@ const kS = /* @__PURE__ */ et(() => {
11088
11097
  ),
11089
11098
  !0,
11090
11099
  !1
11091
- ), o = vt("context");
11100
+ ), o = wt("context");
11092
11101
  return e ? /* @__PURE__ */ u.jsx(n, { ref: r, children: /* @__PURE__ */ u.jsx(e, { ...Bt(e, o) }) }) : null;
11093
11102
  }), NS = z.memo(function() {
11094
- const e = vt("FooterComponent"), t = sn("footerHeight"), n = vt("headerFooterTag"), r = pr(
11103
+ const e = wt("FooterComponent"), t = sn("footerHeight"), n = wt("headerFooterTag"), r = pr(
11095
11104
  z.useMemo(
11096
11105
  () => (s) => {
11097
11106
  t(Un(s, "height"));
@@ -11100,7 +11109,7 @@ const kS = /* @__PURE__ */ et(() => {
11100
11109
  ),
11101
11110
  !0,
11102
11111
  !1
11103
- ), o = vt("context");
11112
+ ), o = wt("context");
11104
11113
  return e ? /* @__PURE__ */ u.jsx(n, { ref: r, children: /* @__PURE__ */ u.jsx(e, { ...Bt(e, o) }) }) : null;
11105
11114
  }), AS = ({ children: e }) => {
11106
11115
  const t = z.useContext(Wf), n = sn("itemDimensions"), r = sn("viewportDimensions"), o = pr(
@@ -11117,12 +11126,12 @@ const kS = /* @__PURE__ */ et(() => {
11117
11126
  t && (r({ height: t.viewportHeight, width: t.viewportWidth }), n({ height: t.itemHeight, width: t.itemWidth }));
11118
11127
  }, [t, r, n]), /* @__PURE__ */ u.jsx("div", { ref: o, style: Ws(!1), children: e });
11119
11128
  }, jS = ({ children: e }) => {
11120
- const t = z.useContext(Wf), n = sn("windowViewportRect"), r = sn("itemDimensions"), o = vt("customScrollParent"), s = Sf(n, o, !1);
11129
+ const t = z.useContext(Wf), n = sn("windowViewportRect"), r = sn("itemDimensions"), o = wt("customScrollParent"), s = Sf(n, o, !1);
11121
11130
  return z.useEffect(() => {
11122
11131
  t && (r({ height: t.itemHeight, width: t.itemWidth }), n({ offsetTop: 0, visibleHeight: t.viewportHeight, visibleWidth: t.viewportWidth }));
11123
11132
  }, [t, n, r]), /* @__PURE__ */ u.jsx("div", { ref: s, style: Ws(!1), children: e });
11124
11133
  }, _S = /* @__PURE__ */ z.memo(function({ ...e }) {
11125
- const t = vt("useWindowScroll"), n = vt("customScrollParent"), r = n || t ? OS : PS, o = n || t ? jS : AS, s = vt("context");
11134
+ const t = wt("useWindowScroll"), n = wt("customScrollParent"), r = n || t ? OS : PS, o = n || t ? jS : AS, s = wt("context");
11126
11135
  return /* @__PURE__ */ u.jsx(r, { ...e, ...Bt(r, s), children: /* @__PURE__ */ u.jsxs(o, { children: [
11127
11136
  /* @__PURE__ */ u.jsx(IS, {}),
11128
11137
  /* @__PURE__ */ u.jsx(ES, {}),
@@ -11130,7 +11139,7 @@ const kS = /* @__PURE__ */ et(() => {
11130
11139
  ] }) });
11131
11140
  }), {
11132
11141
  useEmitter: Jf,
11133
- useEmitterValue: vt,
11142
+ useEmitterValue: wt,
11134
11143
  usePublisher: sn
11135
11144
  } = /* @__PURE__ */ Hf(
11136
11145
  RS,
@@ -11173,7 +11182,7 @@ const kS = /* @__PURE__ */ et(() => {
11173
11182
  }
11174
11183
  },
11175
11184
  _S
11176
- ), PS = /* @__PURE__ */ Gf({ useEmitter: Jf, useEmitterValue: vt, usePublisher: sn }), OS = /* @__PURE__ */ Yf({ useEmitter: Jf, useEmitterValue: vt, usePublisher: sn });
11185
+ ), PS = /* @__PURE__ */ Gf({ useEmitter: Jf, useEmitterValue: wt, usePublisher: sn }), OS = /* @__PURE__ */ Yf({ useEmitter: Jf, useEmitterValue: wt, usePublisher: sn });
11177
11186
  function jc(e, t, n) {
11178
11187
  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);
11179
11188
  }
@@ -11771,7 +11780,7 @@ const rC = v.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
11771
11780
  ));
11772
11781
  rC.displayName = Gs.displayName;
11773
11782
  function oC({ isOpen: e, onClose: t, fileId: n, fileName: r, mimeType: o }) {
11774
- const [s, i] = me(!1), [a, l] = me(null), [c, d] = me(null), { toast: f } = Xa(), p = z.useCallback(async () => {
11783
+ const [s, i] = ge(!1), [a, l] = ge(null), [c, d] = ge(null), { toast: f } = Xa(), p = z.useCallback(async () => {
11775
11784
  if (n) {
11776
11785
  i(!0), d(null), l(null);
11777
11786
  try {
@@ -12469,7 +12478,7 @@ class tl {
12469
12478
  }
12470
12479
  }
12471
12480
  }
12472
- const xe = {
12481
+ const ve = {
12473
12482
  newline: /^(?: *(?:\n|$))+/,
12474
12483
  code: /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,
12475
12484
  fences: /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,
@@ -12486,37 +12495,37 @@ const xe = {
12486
12495
  _paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,
12487
12496
  text: /^[^\n]+/
12488
12497
  };
12489
- xe._label = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
12490
- xe._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
12491
- xe.def = pt(xe.def).replace("label", xe._label).replace("title", xe._title).getRegex();
12492
- xe.bullet = /(?:[*+-]|\d{1,9}[.)])/;
12493
- xe.listItemStart = pt(/^( *)(bull) */).replace("bull", xe.bullet).getRegex();
12494
- xe.list = pt(xe.list).replace(/bull/g, xe.bullet).replace("hr", "\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def", "\\n+(?=" + xe.def.source + ")").getRegex();
12495
- xe._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";
12496
- xe._comment = /<!--(?!-?>)[\s\S]*?(?:-->|$)/;
12497
- xe.html = pt(xe.html, "i").replace("comment", xe._comment).replace("tag", xe._tag).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
12498
- xe.paragraph = pt(xe._paragraph).replace("hr", xe.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", xe._tag).getRegex();
12499
- xe.blockquote = pt(xe.blockquote).replace("paragraph", xe.paragraph).getRegex();
12500
- xe.normal = { ...xe };
12501
- xe.gfm = {
12502
- ...xe.normal,
12498
+ ve._label = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
12499
+ ve._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
12500
+ ve.def = pt(ve.def).replace("label", ve._label).replace("title", ve._title).getRegex();
12501
+ ve.bullet = /(?:[*+-]|\d{1,9}[.)])/;
12502
+ ve.listItemStart = pt(/^( *)(bull) */).replace("bull", ve.bullet).getRegex();
12503
+ 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();
12504
+ 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";
12505
+ ve._comment = /<!--(?!-?>)[\s\S]*?(?:-->|$)/;
12506
+ ve.html = pt(ve.html, "i").replace("comment", ve._comment).replace("tag", ve._tag).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
12507
+ 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();
12508
+ ve.blockquote = pt(ve.blockquote).replace("paragraph", ve.paragraph).getRegex();
12509
+ ve.normal = { ...ve };
12510
+ ve.gfm = {
12511
+ ...ve.normal,
12503
12512
  table: "^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"
12504
12513
  // Cells
12505
12514
  };
12506
- xe.gfm.table = pt(xe.gfm.table).replace("hr", xe.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", xe._tag).getRegex();
12507
- xe.gfm.paragraph = pt(xe._paragraph).replace("hr", xe.hr).replace("heading", " {0,3}#{1,6} ").replace("|lheading", "").replace("table", xe.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", xe._tag).getRegex();
12508
- xe.pedantic = {
12509
- ...xe.normal,
12515
+ 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();
12516
+ 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();
12517
+ ve.pedantic = {
12518
+ ...ve.normal,
12510
12519
  html: pt(
12511
12520
  `^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`
12512
- ).replace("comment", xe._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(),
12521
+ ).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(),
12513
12522
  def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
12514
12523
  heading: /^(#{1,6})(.*)(?:\n+|$)/,
12515
12524
  fences: us,
12516
12525
  // fences not supported
12517
12526
  lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
12518
- paragraph: pt(xe.normal._paragraph).replace("hr", xe.hr).replace("heading", ` *#{1,6} *[^
12519
- ]`).replace("lheading", xe.lheading).replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").getRegex()
12527
+ paragraph: pt(ve.normal._paragraph).replace("hr", ve.hr).replace("heading", ` *#{1,6} *[^
12528
+ ]`).replace("lheading", ve.lheading).replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").getRegex()
12520
12529
  };
12521
12530
  const ue = {
12522
12531
  escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
@@ -12546,7 +12555,7 @@ ue._punctuation = "!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~";
12546
12555
  ue.punctuation = pt(ue.punctuation).replace(/punctuation/g, ue._punctuation).getRegex();
12547
12556
  ue.blockSkip = /\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g;
12548
12557
  ue.escapedEmSt = /(?:^|[^\\])(?:\\\\)*\\[*_]/g;
12549
- ue._comment = pt(xe._comment).replace("(?:-->|$)", "-->").getRegex();
12558
+ ue._comment = pt(ve._comment).replace("(?:-->|$)", "-->").getRegex();
12550
12559
  ue.emStrong.lDelim = pt(ue.emStrong.lDelim).replace(/punct/g, ue._punctuation).getRegex();
12551
12560
  ue.emStrong.rDelimAst = pt(ue.emStrong.rDelimAst, "g").replace(/punct/g, ue._punctuation).getRegex();
12552
12561
  ue.emStrong.rDelimUnd = pt(ue.emStrong.rDelimUnd, "g").replace(/punct/g, ue._punctuation).getRegex();
@@ -12560,8 +12569,8 @@ ue._label = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
12560
12569
  ue._href = /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;
12561
12570
  ue._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;
12562
12571
  ue.link = pt(ue.link).replace("label", ue._label).replace("href", ue._href).replace("title", ue._title).getRegex();
12563
- ue.reflink = pt(ue.reflink).replace("label", ue._label).replace("ref", xe._label).getRegex();
12564
- ue.nolink = pt(ue.nolink).replace("ref", xe._label).getRegex();
12572
+ ue.reflink = pt(ue.reflink).replace("label", ue._label).replace("ref", ve._label).getRegex();
12573
+ ue.nolink = pt(ue.nolink).replace("ref", ve._label).getRegex();
12565
12574
  ue.reflinkSearch = pt(ue.reflinkSearch, "g").replace("reflink", ue.reflink).replace("nolink", ue.nolink).getRegex();
12566
12575
  ue.normal = { ...ue };
12567
12576
  ue.pedantic = {
@@ -12614,17 +12623,17 @@ class Wn {
12614
12623
  top: !0
12615
12624
  };
12616
12625
  const n = {
12617
- block: xe.normal,
12626
+ block: ve.normal,
12618
12627
  inline: ue.normal
12619
12628
  };
12620
- this.options.pedantic ? (n.block = xe.pedantic, n.inline = ue.pedantic) : this.options.gfm && (n.block = xe.gfm, this.options.breaks ? n.inline = ue.breaks : n.inline = ue.gfm), this.tokenizer.rules = n;
12629
+ this.options.pedantic ? (n.block = ve.pedantic, n.inline = ue.pedantic) : this.options.gfm && (n.block = ve.gfm, this.options.breaks ? n.inline = ue.breaks : n.inline = ue.gfm), this.tokenizer.rules = n;
12621
12630
  }
12622
12631
  /**
12623
12632
  * Expose Rules
12624
12633
  */
12625
12634
  static get rules() {
12626
12635
  return {
12627
- block: xe,
12636
+ block: ve,
12628
12637
  inline: ue
12629
12638
  };
12630
12639
  }
@@ -13260,7 +13269,7 @@ function _p(e, t) {
13260
13269
  return (n, r, o) => {
13261
13270
  typeof r == "function" && (o = r, r = null);
13262
13271
  const s = { ...r };
13263
- r = { ...he.defaults, ...s };
13272
+ r = { ...me.defaults, ...s };
13264
13273
  const i = bC(r.silent, r.async, o);
13265
13274
  if (typeof n > "u" || n === null)
13266
13275
  return i(new Error("marked(): input parameter is undefined or null"));
@@ -13278,7 +13287,7 @@ function _p(e, t) {
13278
13287
  let p;
13279
13288
  if (!f)
13280
13289
  try {
13281
- r.walkTokens && he.walkTokens(l, r.walkTokens), p = t(l, r), r.hooks && (p = r.hooks.postprocess(p));
13290
+ r.walkTokens && me.walkTokens(l, r.walkTokens), p = t(l, r), r.hooks && (p = r.hooks.postprocess(p));
13282
13291
  } catch (h) {
13283
13292
  f = h;
13284
13293
  }
@@ -13286,7 +13295,7 @@ function _p(e, t) {
13286
13295
  };
13287
13296
  if (!a || a.length < 3 || (delete r.highlight, !l.length)) return c();
13288
13297
  let d = 0;
13289
- he.walkTokens(l, function(f) {
13298
+ me.walkTokens(l, function(f) {
13290
13299
  f.type === "code" && (d++, setTimeout(() => {
13291
13300
  a(f.text, f.lang, function(p, h) {
13292
13301
  if (p)
@@ -13298,11 +13307,11 @@ function _p(e, t) {
13298
13307
  return;
13299
13308
  }
13300
13309
  if (r.async)
13301
- return Promise.resolve(r.hooks ? r.hooks.preprocess(n) : n).then((a) => e(a, r)).then((a) => r.walkTokens ? Promise.all(he.walkTokens(a, r.walkTokens)).then(() => a) : a).then((a) => t(a, r)).then((a) => r.hooks ? r.hooks.postprocess(a) : a).catch(i);
13310
+ 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);
13302
13311
  try {
13303
13312
  r.hooks && (n = r.hooks.preprocess(n));
13304
13313
  const a = e(n, r);
13305
- r.walkTokens && he.walkTokens(a, r.walkTokens);
13314
+ r.walkTokens && me.walkTokens(a, r.walkTokens);
13306
13315
  let l = t(a, r);
13307
13316
  return r.hooks && (l = r.hooks.postprocess(l)), l;
13308
13317
  } catch (a) {
@@ -13310,19 +13319,19 @@ function _p(e, t) {
13310
13319
  }
13311
13320
  };
13312
13321
  }
13313
- function he(e, t, n) {
13322
+ function me(e, t, n) {
13314
13323
  return _p(Wn.lex, Vn.parse)(e, t, n);
13315
13324
  }
13316
- he.options = he.setOptions = function(e) {
13317
- return he.defaults = { ...he.defaults, ...e }, sC(he.defaults), he;
13325
+ me.options = me.setOptions = function(e) {
13326
+ return me.defaults = { ...me.defaults, ...e }, sC(me.defaults), me;
13318
13327
  };
13319
- he.getDefaults = Rp;
13320
- he.defaults = mr;
13321
- he.use = function(...e) {
13322
- const t = he.defaults.extensions || { renderers: {}, childTokens: {} };
13328
+ me.getDefaults = Rp;
13329
+ me.defaults = mr;
13330
+ me.use = function(...e) {
13331
+ const t = me.defaults.extensions || { renderers: {}, childTokens: {} };
13323
13332
  e.forEach((n) => {
13324
13333
  const r = { ...n };
13325
- if (r.async = he.defaults.async || r.async || !1, n.extensions && (n.extensions.forEach((o) => {
13334
+ if (r.async = me.defaults.async || r.async || !1, n.extensions && (n.extensions.forEach((o) => {
13326
13335
  if (!o.name)
13327
13336
  throw new Error("extension name required");
13328
13337
  if (o.renderer) {
@@ -13339,7 +13348,7 @@ he.use = function(...e) {
13339
13348
  }
13340
13349
  o.childTokens && (t.childTokens[o.name] = o.childTokens);
13341
13350
  }), r.extensions = t), n.renderer) {
13342
- const o = he.defaults.renderer || new nl();
13351
+ const o = me.defaults.renderer || new nl();
13343
13352
  for (const s in n.renderer) {
13344
13353
  const i = o[s];
13345
13354
  o[s] = (...a) => {
@@ -13350,7 +13359,7 @@ he.use = function(...e) {
13350
13359
  r.renderer = o;
13351
13360
  }
13352
13361
  if (n.tokenizer) {
13353
- const o = he.defaults.tokenizer || new tl();
13362
+ const o = me.defaults.tokenizer || new tl();
13354
13363
  for (const s in n.tokenizer) {
13355
13364
  const i = o[s];
13356
13365
  o[s] = (...a) => {
@@ -13361,11 +13370,11 @@ he.use = function(...e) {
13361
13370
  r.tokenizer = o;
13362
13371
  }
13363
13372
  if (n.hooks) {
13364
- const o = he.defaults.hooks || new ds();
13373
+ const o = me.defaults.hooks || new ds();
13365
13374
  for (const s in n.hooks) {
13366
13375
  const i = o[s];
13367
13376
  ds.passThroughHooks.has(s) ? o[s] = (a) => {
13368
- if (he.defaults.async)
13377
+ if (me.defaults.async)
13369
13378
  return Promise.resolve(n.hooks[s].call(o, a)).then((c) => i.call(o, c));
13370
13379
  const l = n.hooks[s].call(o, a);
13371
13380
  return i.call(o, l);
@@ -13377,54 +13386,54 @@ he.use = function(...e) {
13377
13386
  r.hooks = o;
13378
13387
  }
13379
13388
  if (n.walkTokens) {
13380
- const o = he.defaults.walkTokens;
13389
+ const o = me.defaults.walkTokens;
13381
13390
  r.walkTokens = function(s) {
13382
13391
  let i = [];
13383
13392
  return i.push(n.walkTokens.call(this, s)), o && (i = i.concat(o.call(this, s))), i;
13384
13393
  };
13385
13394
  }
13386
- he.setOptions(r);
13395
+ me.setOptions(r);
13387
13396
  });
13388
13397
  };
13389
- he.walkTokens = function(e, t) {
13398
+ me.walkTokens = function(e, t) {
13390
13399
  let n = [];
13391
13400
  for (const r of e)
13392
- switch (n = n.concat(t.call(he, r)), r.type) {
13401
+ switch (n = n.concat(t.call(me, r)), r.type) {
13393
13402
  case "table": {
13394
13403
  for (const o of r.header)
13395
- n = n.concat(he.walkTokens(o.tokens, t));
13404
+ n = n.concat(me.walkTokens(o.tokens, t));
13396
13405
  for (const o of r.rows)
13397
13406
  for (const s of o)
13398
- n = n.concat(he.walkTokens(s.tokens, t));
13407
+ n = n.concat(me.walkTokens(s.tokens, t));
13399
13408
  break;
13400
13409
  }
13401
13410
  case "list": {
13402
- n = n.concat(he.walkTokens(r.items, t));
13411
+ n = n.concat(me.walkTokens(r.items, t));
13403
13412
  break;
13404
13413
  }
13405
13414
  default:
13406
- he.defaults.extensions && he.defaults.extensions.childTokens && he.defaults.extensions.childTokens[r.type] ? he.defaults.extensions.childTokens[r.type].forEach(function(o) {
13407
- n = n.concat(he.walkTokens(r[o], t));
13408
- }) : r.tokens && (n = n.concat(he.walkTokens(r.tokens, t)));
13415
+ me.defaults.extensions && me.defaults.extensions.childTokens && me.defaults.extensions.childTokens[r.type] ? me.defaults.extensions.childTokens[r.type].forEach(function(o) {
13416
+ n = n.concat(me.walkTokens(r[o], t));
13417
+ }) : r.tokens && (n = n.concat(me.walkTokens(r.tokens, t)));
13409
13418
  }
13410
13419
  return n;
13411
13420
  };
13412
- he.parseInline = _p(Wn.lexInline, Vn.parseInline);
13413
- he.Parser = Vn;
13414
- he.parser = Vn.parse;
13415
- he.Renderer = nl;
13416
- he.TextRenderer = Ap;
13417
- he.Lexer = Wn;
13418
- he.lexer = Wn.lex;
13419
- he.Tokenizer = tl;
13420
- he.Slugger = jp;
13421
- he.Hooks = ds;
13422
- he.parse = he;
13423
- he.options;
13424
- he.setOptions;
13425
- he.use;
13426
- he.walkTokens;
13427
- he.parseInline;
13421
+ me.parseInline = _p(Wn.lexInline, Vn.parseInline);
13422
+ me.Parser = Vn;
13423
+ me.parser = Vn.parse;
13424
+ me.Renderer = nl;
13425
+ me.TextRenderer = Ap;
13426
+ me.Lexer = Wn;
13427
+ me.lexer = Wn.lex;
13428
+ me.Tokenizer = tl;
13429
+ me.Slugger = jp;
13430
+ me.Hooks = ds;
13431
+ me.parse = me;
13432
+ me.options;
13433
+ me.setOptions;
13434
+ me.use;
13435
+ me.walkTokens;
13436
+ me.parseInline;
13428
13437
  Vn.parse;
13429
13438
  Wn.lex;
13430
13439
  function fs({
@@ -13437,9 +13446,9 @@ function fs({
13437
13446
  try {
13438
13447
  if (!n) {
13439
13448
  const i = e.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, "").replace(/<iframe\b[^<]*(?:(?!<\/iframe>)<[^<]*)*<\/iframe>/gi, "").replace(/javascript:/gi, "").replace(/on\w+\s*=/gi, "");
13440
- return typeof he.parse == "function" ? he.parse(i) : he(i);
13449
+ return typeof me.parse == "function" ? me.parse(i) : me(i);
13441
13450
  }
13442
- return typeof he.parse == "function" ? he.parse(e) : he(e);
13451
+ return typeof me.parse == "function" ? me.parse(e) : me(e);
13443
13452
  } catch (i) {
13444
13453
  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>`;
13445
13454
  }
@@ -13545,7 +13554,7 @@ function zc(e) {
13545
13554
  return `${e.id}:${t}:${n}`;
13546
13555
  }
13547
13556
  function RC({ className: e }) {
13548
- const [t, n] = me(0);
13557
+ const [t, n] = ge(0);
13549
13558
  return Ct(() => {
13550
13559
  const r = setInterval(() => n((o) => (o + 1) % 4), 500);
13551
13560
  return () => clearInterval(r);
@@ -13588,13 +13597,13 @@ const Bc = z.memo(function({
13588
13597
  defaultCheckpointId: N = null,
13589
13598
  messageParentCheckpointId: I = null
13590
13599
  }) {
13591
- const [E, _] = me(!1), [L, F] = me("preview"), [j, $] = me(!1), { currentThreadId: A } = xa(), { respondToInterrupt: B } = ya(), D = l === "phone" || l === "half-screen", O = t.role, J = O === "tool", X = at(() => "type" in t && t.type === "default_message" ? t : null, [t]), fe = !!X, Re = !(r && O !== "user"), {
13600
+ const [E, _] = ge(!1), [L, F] = ge("preview"), [j, $] = ge(!1), { currentThreadId: A } = xa(), { respondToInterrupt: B } = ya(), D = l === "phone" || l === "half-screen", O = t.role, J = O === "tool", X = at(() => "type" in t && t.type === "default_message" ? t : null, [t]), fe = !!X, Ee = !(r && O !== "user"), {
13592
13601
  uploadingFiles: Ne,
13593
13602
  handleFileClick: G,
13594
13603
  fileViewerOpen: ee,
13595
13604
  currentFileInfo: W,
13596
13605
  closeFileViewer: M
13597
- } = IC({ allowFileOpen: Re, currentThreadId: A }), H = z.useMemo(() => {
13606
+ } = IC({ allowFileOpen: Ee, currentThreadId: A }), H = z.useMemo(() => {
13598
13607
  switch (O) {
13599
13608
  case "user":
13600
13609
  return "text-[hsl(var(--chat-bubble-user-text))]";
@@ -13610,21 +13619,21 @@ const Bc = z.memo(function({
13610
13619
  }, [O]), te = at(() => X ? "" : CC(t.content), [X, t]), ie = at(() => X ? {} : Pp(t), [X, t]), ne = at(
13611
13620
  () => X ? [] : t.content.filter((V) => V.type === "image_url"),
13612
13621
  [X, t]
13613
- ), Le = at(
13622
+ ), De = at(
13614
13623
  () => X ? [] : t.content.filter((V) => V.type === "file"),
13615
13624
  [X, t]
13616
13625
  ), Q = at(
13617
13626
  () => X ? [] : t.content.filter((V) => V.type === "interrupt"),
13618
13627
  [X, t]
13619
- ), se = (g == null ? void 0 : g.id) ?? (g == null ? void 0 : g.interrupt_id), Se = Mo(se), je = g == null ? void 0 : g.value, Ke = at(() => X ? "" : TC(t.content), [X, t]), Be = z.useCallback(async () => {
13628
+ ), se = (g == null ? void 0 : g.id) ?? (g == null ? void 0 : g.interrupt_id), Te = Mo(se), je = g == null ? void 0 : g.value, Ke = at(() => X ? "" : TC(t.content), [X, t]), ze = z.useCallback(async () => {
13620
13629
  const V = J ? Ke : te;
13621
- async function ve(ge) {
13630
+ async function be(ye) {
13622
13631
  if (navigator.clipboard && typeof navigator.clipboard.writeText == "function") {
13623
- await navigator.clipboard.writeText(ge);
13632
+ await navigator.clipboard.writeText(ye);
13624
13633
  return;
13625
13634
  }
13626
13635
  if (navigator.clipboard && typeof navigator.clipboard.write == "function" && typeof ClipboardItem < "u") {
13627
- const ht = new Blob([ge], { type: "text/plain" });
13636
+ const ht = new Blob([ye], { type: "text/plain" });
13628
13637
  await navigator.clipboard.write([
13629
13638
  new ClipboardItem({
13630
13639
  "text/plain": ht
@@ -13635,30 +13644,30 @@ const Bc = z.memo(function({
13635
13644
  throw new Error("Clipboard API not supported in this context.");
13636
13645
  }
13637
13646
  try {
13638
- await ve(V), _(!0), setTimeout(() => _(!1), 2e3), m == null || m(V);
13639
- } catch (ge) {
13640
- console.error("Failed to copy:", ge);
13647
+ await be(V), _(!0), setTimeout(() => _(!1), 2e3), m == null || m(V);
13648
+ } catch (ye) {
13649
+ console.error("Failed to copy:", ye);
13641
13650
  }
13642
- }, [J, Ke, te, m]), ze = z.useCallback(() => {
13651
+ }, [J, Ke, te, m]), $e = z.useCallback(() => {
13643
13652
  if (!h) return;
13644
- const V = J ? Ke : te, ve = "type" in t && t.type === "default_message" ? void 0 : {
13653
+ const V = J ? Ke : te, be = "type" in t && t.type === "default_message" ? void 0 : {
13645
13654
  checkpointId: t.checkpointId ?? null,
13646
13655
  checkpointNs: t.checkpointNs ?? null
13647
13656
  };
13648
- h(t.id, V, ve);
13657
+ h(t.id, V, be);
13649
13658
  }, [h, t.id, J, Ke, te, t]), qe = z.useCallback(() => {
13650
13659
  x == null || x(n);
13651
13660
  }, [x, n]), Ge = z.useCallback(() => {
13652
- const ve = Z(D ? "h-3 w-3" : "h-4 w-4", "opacity-60 flex-shrink-0", H);
13661
+ const be = Z(D ? "h-3 w-3" : "h-4 w-4", "opacity-60 flex-shrink-0", H);
13653
13662
  switch (O) {
13654
13663
  case "user":
13655
- return /* @__PURE__ */ u.jsx(gm, { className: ve });
13664
+ return /* @__PURE__ */ u.jsx(gm, { className: be });
13656
13665
  case "assistant":
13657
- return /* @__PURE__ */ u.jsx(si, { className: ve });
13666
+ return /* @__PURE__ */ u.jsx(si, { className: be });
13658
13667
  case "tool":
13659
- return /* @__PURE__ */ u.jsx(mm, { className: ve });
13668
+ return /* @__PURE__ */ u.jsx(mm, { className: be });
13660
13669
  default:
13661
- return /* @__PURE__ */ u.jsx(si, { className: ve });
13670
+ return /* @__PURE__ */ u.jsx(si, { className: be });
13662
13671
  }
13663
13672
  }, [D, H, O]), Qe = z.useCallback(() => {
13664
13673
  const V = "group relative mb-4 flex w-full";
@@ -13729,41 +13738,41 @@ const Bc = z.memo(function({
13729
13738
  const nt = z.useCallback(async (V) => {
13730
13739
  if (w)
13731
13740
  return;
13732
- const ve = Mo(
13741
+ const be = Mo(
13733
13742
  (V == null ? void 0 : V.id) ?? (V == null ? void 0 : V.interrupt_id)
13734
13743
  );
13735
- if (!ve) {
13744
+ if (!be) {
13736
13745
  console.warn("Interrupt part missing id", V);
13737
13746
  return;
13738
13747
  }
13739
13748
  try {
13740
- b == null || b(), await B(ve, !0);
13741
- } catch (ge) {
13742
- console.error("Failed to approve interrupt:", ge);
13749
+ b == null || b(), await B(be, !0);
13750
+ } catch (ye) {
13751
+ console.error("Failed to approve interrupt:", ye);
13743
13752
  } finally {
13744
13753
  T == null || T();
13745
13754
  }
13746
- }, [w, T, b, B]), Tt = z.useCallback(async (V) => {
13755
+ }, [w, T, b, B]), jt = z.useCallback(async (V) => {
13747
13756
  if (w)
13748
13757
  return;
13749
- const ve = Mo(
13758
+ const be = Mo(
13750
13759
  (V == null ? void 0 : V.id) ?? (V == null ? void 0 : V.interrupt_id)
13751
13760
  );
13752
- if (!ve) {
13761
+ if (!be) {
13753
13762
  console.warn("Interrupt part missing id", V);
13754
13763
  return;
13755
13764
  }
13756
13765
  try {
13757
- b == null || b(), await B(ve, !1);
13758
- } catch (ge) {
13759
- console.error("Failed to reject interrupt:", ge);
13766
+ b == null || b(), await B(be, !1);
13767
+ } catch (ye) {
13768
+ console.error("Failed to reject interrupt:", ye);
13760
13769
  } finally {
13761
13770
  T == null || T();
13762
13771
  }
13763
- }, [w, T, b, B]), ut = z.useCallback(({ part: V, i: ve }) => {
13772
+ }, [w, T, b, B]), ut = z.useCallback(({ part: V, i: be }) => {
13764
13773
  if (V.type === "text") {
13765
- const ge = V.text ?? "", ht = ge.trim(), mt = Ja(ht);
13766
- return mt && O !== "tool" ? /* @__PURE__ */ u.jsx(Op, { data: mt }, ve) : O === "user" && c && ht.length > d ? /* @__PURE__ */ u.jsx(
13774
+ const ye = V.text ?? "", ht = ye.trim(), gt = Ja(ht);
13775
+ return gt && O !== "tool" ? /* @__PURE__ */ u.jsx(Op, { data: gt }, be) : O === "user" && c && ht.length > d ? /* @__PURE__ */ u.jsx(
13767
13776
  NC,
13768
13777
  {
13769
13778
  text: ht,
@@ -13772,56 +13781,56 @@ const Bc = z.memo(function({
13772
13781
  previewLength: d,
13773
13782
  isCompact: D
13774
13783
  },
13775
- ve
13776
- ) : /* @__PURE__ */ u.jsx(fs, { content: ge, allowHtml: !1 }, ve);
13784
+ be
13785
+ ) : /* @__PURE__ */ u.jsx(fs, { content: ye, allowHtml: !1 }, be);
13777
13786
  }
13778
13787
  if (V.type === "image_url") {
13779
- const ge = V;
13788
+ const ye = V;
13780
13789
  return /* @__PURE__ */ u.jsx("div", { className: "my-2", children: /* @__PURE__ */ u.jsx(
13781
13790
  "img",
13782
13791
  {
13783
- src: ge.url,
13784
- alt: ge.alt ?? "",
13792
+ src: ye.url,
13793
+ alt: ye.alt ?? "",
13785
13794
  loading: "lazy",
13786
13795
  className: "border rounded max-h-[420px] w-auto object-contain"
13787
13796
  }
13788
- ) }, ve);
13797
+ ) }, be);
13789
13798
  }
13790
13799
  if (V.type === "file") {
13791
- const ge = V, ht = ge.name || "file";
13800
+ const ye = V, ht = ye.name || "file";
13792
13801
  return /* @__PURE__ */ u.jsxs(
13793
13802
  "a",
13794
13803
  {
13795
- href: ge.url,
13796
- onClick: (mt) => G(mt, ge, ve),
13804
+ href: ye.url,
13805
+ onClick: (gt) => G(gt, ye, be),
13797
13806
  className: `inline-flex items-center gap-2 rounded px-2 py-1 text-xs bg-gray-100 border hover:bg-gray-200
13798
13807
  dark:bg-background/10 dark:border-border/30 dark:hover:bg-background/20`,
13799
13808
  children: [
13800
- Ne[ve] ? /* @__PURE__ */ u.jsx(ua, { className: "h-4 w-4 animate-spin" }) : null,
13809
+ Ne[be] ? /* @__PURE__ */ u.jsx(ua, { className: "h-4 w-4 animate-spin" }) : null,
13801
13810
  /* @__PURE__ */ u.jsxs("span", { className: "truncate max-w-[180px]", children: [
13802
13811
  ht,
13803
- Ne[ve] ? " (processing)" : ""
13812
+ Ne[be] ? " (processing)" : ""
13804
13813
  ] })
13805
13814
  ]
13806
13815
  },
13807
- ve
13816
+ be
13808
13817
  );
13809
13818
  }
13810
13819
  if (V.type === "interrupt") {
13811
- const ge = V, ht = Mo(
13812
- (ge == null ? void 0 : ge.id) ?? (ge == null ? void 0 : ge.interrupt_id)
13813
- ), mt = !!(Se && ht && ht === Se), Rt = mt ? je ?? (ge == null ? void 0 : ge.value) : ge == null ? void 0 : ge.value, Oe = ht ? { ...ge, id: ht, interrupt_id: ht } : ge;
13820
+ const ye = V, ht = Mo(
13821
+ (ye == null ? void 0 : ye.id) ?? (ye == null ? void 0 : ye.interrupt_id)
13822
+ ), gt = !!(Te && ht && ht === Te), kt = gt ? je ?? (ye == null ? void 0 : ye.value) : ye == null ? void 0 : ye.value, Pe = ht ? { ...ye, id: ht, interrupt_id: ht } : ye;
13814
13823
  return /* @__PURE__ */ u.jsx(
13815
13824
  EC,
13816
13825
  {
13817
- interruptPart: Oe,
13826
+ interruptPart: Pe,
13818
13827
  onApprove: nt,
13819
- onReject: Tt,
13828
+ onReject: jt,
13820
13829
  disabled: w,
13821
- isActive: mt,
13822
- payload: Rt
13830
+ isActive: gt,
13831
+ payload: kt
13823
13832
  },
13824
- ve
13833
+ be
13825
13834
  );
13826
13835
  }
13827
13836
  return null;
@@ -13829,13 +13838,13 @@ const Bc = z.memo(function({
13829
13838
  G,
13830
13839
  Ne,
13831
13840
  nt,
13832
- Tt,
13841
+ jt,
13833
13842
  O,
13834
13843
  c,
13835
13844
  d,
13836
13845
  j,
13837
13846
  D,
13838
- Se,
13847
+ Te,
13839
13848
  je,
13840
13849
  g,
13841
13850
  w,
@@ -13843,9 +13852,9 @@ const Bc = z.memo(function({
13843
13852
  ]), lt = z.useCallback(() => /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2 p-2 bg-muted/30 rounded", children: [
13844
13853
  /* @__PURE__ */ u.jsx(ji, { className: "h-4 w-4 text-muted-foreground" }),
13845
13854
  /* @__PURE__ */ u.jsx("span", { className: "text-sm text-muted-foreground", children: "File upload" })
13846
- ] }), []), kt = z.useCallback(() => {
13847
- const V = te.trim().length > 0 || ne.length > 0 || Le.length > 0 || Q.length > 0;
13848
- if (!J && Le.length > 0 && !r)
13855
+ ] }), []), Tt = z.useCallback(() => {
13856
+ const V = te.trim().length > 0 || ne.length > 0 || De.length > 0 || Q.length > 0;
13857
+ if (!J && De.length > 0 && !r)
13849
13858
  return lt();
13850
13859
  if (!J && !V && !r)
13851
13860
  return null;
@@ -13859,47 +13868,47 @@ const Bc = z.memo(function({
13859
13868
  t.id
13860
13869
  );
13861
13870
  if (!J && !X) {
13862
- const ve = t, ge = /* @__PURE__ */ u.jsx("div", { className: "space-y-2", children: ve.content.map((ht, mt) => /* @__PURE__ */ u.jsx(ut, { part: ht, i: mt }, mt)) });
13871
+ const be = t, ye = /* @__PURE__ */ u.jsx("div", { className: "space-y-2", children: be.content.map((ht, gt) => /* @__PURE__ */ u.jsx(ut, { part: ht, i: gt }, gt)) });
13863
13872
  return r ? /* @__PURE__ */ u.jsxs("div", { "aria-busy": "true", role: "status", children: [
13864
- ge,
13873
+ ye,
13865
13874
  /* @__PURE__ */ u.jsx(RC, { className: H })
13866
- ] }) : ge;
13875
+ ] }) : ye;
13867
13876
  }
13868
13877
  }, [
13869
13878
  te,
13870
13879
  ne.length,
13871
- Le.length,
13880
+ De.length,
13872
13881
  Q.length,
13873
13882
  r,
13874
13883
  J,
13875
13884
  L,
13876
13885
  lt,
13877
13886
  H
13878
- ]), wt = at(() => X ? "Assistant" : kC(t), [X, t]), re = z.useMemo(() => X ? [] : Array.isArray(C) ? C : [], [C, X]), Ce = z.useMemo(() => {
13887
+ ]), bt = at(() => X ? "Assistant" : kC(t), [X, t]), re = z.useMemo(() => X ? [] : Array.isArray(C) ? C : [], [C, X]), we = z.useMemo(() => {
13879
13888
  var V;
13880
- return re.length ? N && re.some((ve) => ve.id === N) ? N : ((V = re[0]) == null ? void 0 : V.id) ?? null : null;
13881
- }, [N, re]), Pe = z.useMemo(() => !re.length || !S ? null : re.some((V) => V.id === S) ? S : null, [S, re]) ?? Ce, st = O === "user" && re.length > 0 && typeof k == "function", Ee = z.useCallback(
13889
+ return re.length ? N && re.some((be) => be.id === N) ? N : ((V = re[0]) == null ? void 0 : V.id) ?? null : null;
13890
+ }, [N, re]), He = z.useMemo(() => !re.length || !S ? null : re.some((V) => V.id === S) ? S : null, [S, re]) ?? we, mt = O === "user" && re.length > 0 && typeof k == "function", xe = z.useCallback(
13882
13891
  (V) => {
13883
13892
  if (!k) return;
13884
- const ve = (V == null ? void 0 : V.id) ?? null, ge = (V == null ? void 0 : V.parentId) ?? I ?? null;
13885
- k(ve, ge);
13893
+ const be = (V == null ? void 0 : V.id) ?? null, ye = (V == null ? void 0 : V.parentId) ?? I ?? null;
13894
+ k(be, ye);
13886
13895
  },
13887
13896
  [I, k]
13888
- ), ye = z.useMemo(() => Pe ? re.findIndex((V) => V.id === Pe) : -1, [Pe, re]), bt = z.useMemo(() => ye < 0 ? null : re[ye] ?? null, [ye, re]), _t = z.useCallback((V) => {
13889
- const ve = [];
13890
- if (V.step !== null && ve.push(`Step ${V.step}`), V.source && ve.push(V.source), !V.createdAt)
13891
- return ve.length ? ve.join(" • ") : V.id.slice(0, 8);
13892
- let ge = "";
13897
+ ), pe = z.useMemo(() => He ? re.findIndex((V) => V.id === He) : -1, [He, re]), st = z.useMemo(() => pe < 0 ? null : re[pe] ?? null, [pe, re]), _t = z.useCallback((V) => {
13898
+ const be = [];
13899
+ if (V.step !== null && be.push(`Step ${V.step}`), V.source && be.push(V.source), !V.createdAt)
13900
+ return be.length ? be.join(" • ") : V.id.slice(0, 8);
13901
+ let ye = "";
13893
13902
  try {
13894
13903
  const ht = new Date(V.createdAt);
13895
- Number.isNaN(ht.getTime()) || (ge = new Intl.DateTimeFormat(void 0, {
13904
+ Number.isNaN(ht.getTime()) || (ye = new Intl.DateTimeFormat(void 0, {
13896
13905
  hour: "2-digit",
13897
13906
  minute: "2-digit"
13898
13907
  }).format(ht));
13899
13908
  } catch {
13900
- ge = "";
13909
+ ye = "";
13901
13910
  }
13902
- return `${ge}`;
13911
+ return `${ye}`;
13903
13912
  }, []);
13904
13913
  return J && !f ? null : /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
13905
13914
  /* @__PURE__ */ u.jsx("div", { className: Z(Qe(), p.container), children: /* @__PURE__ */ u.jsxs("div", { className: Z(Je(), p.content), children: [
@@ -13915,7 +13924,7 @@ const Bc = z.memo(function({
13915
13924
  children: [
13916
13925
  /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2", children: [
13917
13926
  Ge(),
13918
- a && wt && /* @__PURE__ */ u.jsx("span", { className: Z("font-medium", D ? "text-xs" : "text-sm"), children: wt }),
13927
+ a && bt && /* @__PURE__ */ u.jsx("span", { className: Z("font-medium", D ? "text-xs" : "text-sm"), children: bt }),
13919
13928
  J && /* @__PURE__ */ u.jsxs(
13920
13929
  Zf,
13921
13930
  {
@@ -13931,7 +13940,7 @@ const Bc = z.memo(function({
13931
13940
  "aria-expanded": L === "expanded",
13932
13941
  onClick: () => F((V) => V === "expanded" ? "preview" : "expanded"),
13933
13942
  onKeyDown: (V) => {
13934
- (V.key === "Enter" || V.key === " ") && (V.preventDefault(), F((ve) => ve === "expanded" ? "preview" : "expanded"));
13943
+ (V.key === "Enter" || V.key === " ") && (V.preventDefault(), F((be) => be === "expanded" ? "preview" : "expanded"));
13935
13944
  },
13936
13945
  children: [
13937
13946
  /* @__PURE__ */ u.jsx("span", { children: ie.name ?? "Tool Output" }),
@@ -13942,32 +13951,32 @@ const Bc = z.memo(function({
13942
13951
  )
13943
13952
  ] }),
13944
13953
  /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2", children: [
13945
- st && bt && ye >= 0 && /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2 text-xs", children: [
13954
+ mt && st && pe >= 0 && /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2 text-xs", children: [
13946
13955
  /* @__PURE__ */ u.jsx(
13947
13956
  "button",
13948
13957
  {
13949
13958
  type: "button",
13950
13959
  className: Z(
13951
13960
  "flex items-center justify-center rounded border px-1.5 py-1 transition-colors",
13952
- ye > 0 ? "border-border text-foreground hover:bg-muted/60" : "border-border text-muted-foreground cursor-not-allowed"
13961
+ pe > 0 ? "border-border text-foreground hover:bg-muted/60" : "border-border text-muted-foreground cursor-not-allowed"
13953
13962
  ),
13954
13963
  onClick: () => {
13955
- if (ye <= 0) return;
13956
- const V = re[ye - 1];
13957
- V && Ee(V);
13964
+ if (pe <= 0) return;
13965
+ const V = re[pe - 1];
13966
+ V && xe(V);
13958
13967
  },
13959
13968
  "aria-label": "Previous checkpoint",
13960
- disabled: ye <= 0,
13969
+ disabled: pe <= 0,
13961
13970
  children: /* @__PURE__ */ u.jsx(xm, { className: "h-3 w-3" })
13962
13971
  }
13963
13972
  ),
13964
13973
  /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2", children: [
13965
13974
  /* @__PURE__ */ u.jsxs("span", { className: "whitespace-nowrap", children: [
13966
- ye + 1,
13975
+ pe + 1,
13967
13976
  " / ",
13968
13977
  re.length
13969
13978
  ] }),
13970
- /* @__PURE__ */ u.jsx("span", { className: "text-muted-foreground", children: _t(bt) })
13979
+ /* @__PURE__ */ u.jsx("span", { className: "text-muted-foreground", children: _t(st) })
13971
13980
  ] }),
13972
13981
  /* @__PURE__ */ u.jsx(
13973
13982
  "button",
@@ -13975,15 +13984,15 @@ const Bc = z.memo(function({
13975
13984
  type: "button",
13976
13985
  className: Z(
13977
13986
  "flex items-center justify-center rounded border px-1.5 py-1 transition-colors",
13978
- ye < re.length - 1 ? "border-border text-foreground hover:bg-muted/60" : "border-border text-muted-foreground cursor-not-allowed"
13987
+ pe < re.length - 1 ? "border-border text-foreground hover:bg-muted/60" : "border-border text-muted-foreground cursor-not-allowed"
13979
13988
  ),
13980
13989
  onClick: () => {
13981
- if (ye >= re.length - 1) return;
13982
- const V = re[ye + 1];
13983
- V && Ee(V);
13990
+ if (pe >= re.length - 1) return;
13991
+ const V = re[pe + 1];
13992
+ V && xe(V);
13984
13993
  },
13985
13994
  "aria-label": "Next checkpoint",
13986
- disabled: ye >= re.length - 1,
13995
+ disabled: pe >= re.length - 1,
13987
13996
  children: /* @__PURE__ */ u.jsx(Xc, { className: "h-3 w-3" })
13988
13997
  }
13989
13998
  )
@@ -14011,7 +14020,7 @@ const Bc = z.memo(function({
14011
14020
  {
14012
14021
  variant: "ghost",
14013
14022
  size: "sm",
14014
- onClick: () => Be(),
14023
+ onClick: () => ze(),
14015
14024
  className: Z("h-6 w-6 p-0 hover:bg-foreground/10", H, D && "h-5 w-5"),
14016
14025
  "aria-label": "Copy message",
14017
14026
  title: "Copy message",
@@ -14023,7 +14032,7 @@ const Bc = z.memo(function({
14023
14032
  {
14024
14033
  variant: "ghost",
14025
14034
  size: "sm",
14026
- onClick: ze,
14035
+ onClick: $e,
14027
14036
  className: Z("h-6 w-6 p-0 hover:bg-foreground/10", H, D && "h-5 w-5"),
14028
14037
  "aria-label": "Edit message",
14029
14038
  children: /* @__PURE__ */ u.jsx(fl, { className: Z(H, D ? "h-3 w-3" : "h-4 w-4") })
@@ -14047,7 +14056,7 @@ const Bc = z.memo(function({
14047
14056
  ]
14048
14057
  }
14049
14058
  ),
14050
- /* @__PURE__ */ u.jsx("div", { className: "relative", children: kt() }),
14059
+ /* @__PURE__ */ u.jsx("div", { className: "relative", children: Tt() }),
14051
14060
  J && L === "expanded" && (ie.toolCallId || ie.name) && /* @__PURE__ */ u.jsxs("div", { className: Z("mt-2 pt-2 border-t border-current/10 text-xs opacity-60", D && "text-xs"), children: [
14052
14061
  ie.name && /* @__PURE__ */ u.jsxs("div", { children: [
14053
14062
  "Function: ",
@@ -14072,7 +14081,7 @@ const Bc = z.memo(function({
14072
14081
  {
14073
14082
  variant: "ghost",
14074
14083
  size: "sm",
14075
- onClick: () => Be(),
14084
+ onClick: () => ze(),
14076
14085
  className: Z("h-6 w-6 p-0 hover:bg-background/50 text-current", D && "h-5 w-5"),
14077
14086
  children: /* @__PURE__ */ u.jsx(dl, { className: Z(E ? "text-success" : "text-current", D ? "h-3 w-3" : "h-4 w-4") })
14078
14087
  }
@@ -14082,7 +14091,7 @@ const Bc = z.memo(function({
14082
14091
  {
14083
14092
  variant: "ghost",
14084
14093
  size: "sm",
14085
- onClick: ze,
14094
+ onClick: $e,
14086
14095
  className: Z("h-6 w-6 p-0 hover:bg-background/50 text-current", D && "h-5 w-5"),
14087
14096
  children: /* @__PURE__ */ u.jsx(fl, { className: Z("text-current", D ? "h-3 w-3" : "h-4 w-4") })
14088
14097
  }
@@ -14189,7 +14198,7 @@ function EC({
14189
14198
  );
14190
14199
  }
14191
14200
  function IC(e) {
14192
- const { allowFileOpen: t, currentThreadId: n } = e, { toast: r } = Xa(), [o, s] = me({}), [i, a] = me(null), [l, c] = me(!1), d = z.useCallback(() => {
14201
+ const { allowFileOpen: t, currentThreadId: n } = e, { toast: r } = Xa(), [o, s] = ge({}), [i, a] = ge(null), [l, c] = ge(!1), d = z.useCallback(() => {
14193
14202
  c(!1), a(null);
14194
14203
  }, []), f = z.useCallback((h) => {
14195
14204
  a(h), c(!0);
@@ -14377,16 +14386,16 @@ const Hc = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, jC = (e) =>
14377
14386
  onSelectCheckpoint: E,
14378
14387
  timelineCheckpoints: _
14379
14388
  }, L) => {
14380
- const F = Ze(null), j = Ze(null), $ = Ze(!1), [A, B] = me(!0), D = at(() => w ? e.some((Q) => "type" in Q && Q.type === "default_message" ? !1 : Array.isArray(Q == null ? void 0 : Q.content) && Q.content.some(
14389
+ const F = Ze(null), j = Ze(null), $ = Ze(!1), [A, B] = ge(!0), D = at(() => w ? e.some((Q) => "type" in Q && Q.type === "default_message" ? !1 : Array.isArray(Q == null ? void 0 : Q.content) && Q.content.some(
14381
14390
  (se) => se && se.type === "interrupt" && (se.id ?? se.interrupt_id) === w.id
14382
14391
  )) : !1, [w, e]), O = at(() => {
14383
14392
  if (!w || D)
14384
14393
  return null;
14385
14394
  const Q = w.id && String(w.id).trim() ? String(w.id).trim() : "pending-interrupt";
14386
14395
  let se;
14387
- const Se = w.value;
14388
- if (Se && typeof Se == "object" && !Array.isArray(Se)) {
14389
- const je = Se.title;
14396
+ const Te = w.value;
14397
+ if (Te && typeof Te == "object" && !Array.isArray(Te)) {
14398
+ const je = Te.title;
14390
14399
  typeof je == "string" && je.trim() && (se = je.trim());
14391
14400
  }
14392
14401
  return {
@@ -14397,25 +14406,25 @@ const Hc = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, jC = (e) =>
14397
14406
  {
14398
14407
  type: "interrupt",
14399
14408
  id: Q,
14400
- value: Se,
14409
+ value: Te,
14401
14410
  title: se
14402
14411
  }
14403
14412
  ]
14404
14413
  };
14405
14414
  }, [w, D]), J = at(() => O ? [...e, O] : e, [e, O]), X = at(() => S ? J : J.filter((Q) => (Q == null ? void 0 : Q.role) !== "tool"), [J, S]), fe = at(() => {
14406
14415
  const Q = /* @__PURE__ */ new Set(), se = [];
14407
- for (let Se = X.length - 1; Se >= 0; Se--) {
14408
- const je = X[Se];
14416
+ for (let Te = X.length - 1; Te >= 0; Te--) {
14417
+ const je = X[Te];
14409
14418
  if (!je) continue;
14410
14419
  if ("type" in je && je.type === "default_message") {
14411
14420
  se.push(je);
14412
14421
  continue;
14413
14422
  }
14414
- const Ke = je, Be = jC(Ke);
14415
- Q.has(Be) || (Q.add(Be), se.push(Ke));
14423
+ const Ke = je, ze = jC(Ke);
14424
+ Q.has(ze) || (Q.add(ze), se.push(Ke));
14416
14425
  }
14417
14426
  return se.reverse();
14418
- }, [X]), Re = Ie((Q) => {
14427
+ }, [X]), Ee = Ie((Q) => {
14419
14428
  B(Q), m && m(!Q), g && g(Q);
14420
14429
  }, [m, g]), Ne = at(() => {
14421
14430
  if (a)
@@ -14505,16 +14514,16 @@ const Hc = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, jC = (e) =>
14505
14514
  onCancelEdit: () => {
14506
14515
  }
14507
14516
  }
14508
- ) }) }) : /* @__PURE__ */ u.jsx("div", { className: "flex h-full items-center justify-center py-8 text-center text-muted-foreground", children: h ?? "No messages yet. Start a conversation!" }), Le = fe.length > 0;
14517
+ ) }) }) : /* @__PURE__ */ u.jsx("div", { className: "flex h-full items-center justify-center py-8 text-center text-muted-foreground", children: h ?? "No messages yet. Start a conversation!" }), De = fe.length > 0;
14509
14518
  return lm(
14510
14519
  L,
14511
14520
  () => ({
14512
14521
  scrollToLatest: () => {
14513
14522
  var Q, se;
14514
14523
  if (F.current && fe.length > 0) {
14515
- const Se = fe.length - 1;
14524
+ const Te = fe.length - 1;
14516
14525
  (se = (Q = F.current).scrollToIndex) == null || se.call(Q, {
14517
- index: Se,
14526
+ index: Te,
14518
14527
  align: "end",
14519
14528
  behavior: "auto"
14520
14529
  });
@@ -14532,7 +14541,7 @@ const Hc = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, jC = (e) =>
14532
14541
  [fe]
14533
14542
  ), /* @__PURE__ */ u.jsxs("div", { className: ie, style: p, children: [
14534
14543
  te,
14535
- /* @__PURE__ */ u.jsx("div", { className: "relative flex-1 min-h-0", children: Le ? /* @__PURE__ */ u.jsx(
14544
+ /* @__PURE__ */ u.jsx("div", { className: "relative flex-1 min-h-0", children: De ? /* @__PURE__ */ u.jsx(
14536
14545
  vS,
14537
14546
  {
14538
14547
  ref: (Q) => {
@@ -14551,26 +14560,26 @@ const Hc = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, jC = (e) =>
14551
14560
  startReached: () => {
14552
14561
  Ne && Ne();
14553
14562
  },
14554
- atBottomStateChange: Re,
14563
+ atBottomStateChange: Ee,
14555
14564
  style: { height: "100%", overscrollBehavior: "contain" },
14556
14565
  computeItemKey: (Q, se) => Hc(se, Q),
14557
14566
  itemContent: (Q, se) => {
14558
14567
  var nt;
14559
- const Se = Hc(se, Q), je = "type" in se && se.type === "default_message";
14560
- let Ke = [], Be = null, ze = {}, qe = {}, Ge = null, Qe = null;
14568
+ const Te = Hc(se, Q), je = "type" in se && se.type === "default_message";
14569
+ let Ke = [], ze = null, $e = {}, qe = {}, Ge = null, Qe = null;
14561
14570
  if (!je) {
14562
- const Tt = se, ut = Tt.checkpointId ?? null;
14563
- ze = Tt.additionalKwargs ?? {}, qe = Tt.responseMetadata ?? {};
14571
+ const jt = se, ut = jt.checkpointId ?? null;
14572
+ $e = jt.additionalKwargs ?? {}, qe = jt.responseMetadata ?? {};
14564
14573
  const lt = ut && k ? k.get(ut) ?? null : null;
14565
- Ge = typeof ze.step == "number" ? ze.step : typeof qe.step == "number" ? qe.step : (lt == null ? void 0 : lt.step) ?? null;
14566
- const kt = typeof ze.source == "string" ? ze.source : typeof qe.source == "string" ? qe.source : (lt == null ? void 0 : lt.source) ?? null;
14567
- Qe = kt ? String(kt) : null;
14568
- const wt = Ge !== null && Qe ? `${Ge}:${Qe}` : null;
14569
- wt && (N != null && N.has(wt)) ? Ke = N.get(wt) ?? [] : ut && lt && (Ke = [lt]), Be = ut ?? ((nt = Ke[0]) == null ? void 0 : nt.id) ?? null;
14574
+ Ge = typeof $e.step == "number" ? $e.step : typeof qe.step == "number" ? qe.step : (lt == null ? void 0 : lt.step) ?? null;
14575
+ const Tt = typeof $e.source == "string" ? $e.source : typeof qe.source == "string" ? qe.source : (lt == null ? void 0 : lt.source) ?? null;
14576
+ Qe = Tt ? String(Tt) : null;
14577
+ const bt = Ge !== null && Qe ? `${Ge}:${Qe}` : null;
14578
+ bt && (N != null && N.has(bt)) ? Ke = N.get(bt) ?? [] : ut && lt && (Ke = [lt]), ze = ut ?? ((nt = Ke[0]) == null ? void 0 : nt.id) ?? null;
14570
14579
  }
14571
14580
  const Je = (() => {
14572
- if (typeof ze.parentCheckpointId == "string")
14573
- return ze.parentCheckpointId;
14581
+ if (typeof $e.parentCheckpointId == "string")
14582
+ return $e.parentCheckpointId;
14574
14583
  if (typeof qe.parentCheckpointId == "string")
14575
14584
  return qe.parentCheckpointId;
14576
14585
  })();
@@ -14578,7 +14587,7 @@ const Hc = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, jC = (e) =>
14578
14587
  "div",
14579
14588
  {
14580
14589
  className: "relative mb-4 last:mb-0",
14581
- "data-message-id": Se,
14590
+ "data-message-id": Te,
14582
14591
  style: {
14583
14592
  minHeight: "60px",
14584
14593
  containIntrinsicSize: "auto 120px"
@@ -14606,7 +14615,7 @@ const Hc = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, jC = (e) =>
14606
14615
  checkpointCandidates: Ke,
14607
14616
  activeCheckpointId: I ?? null,
14608
14617
  onSelectCheckpoint: E,
14609
- defaultCheckpointId: Be,
14618
+ defaultCheckpointId: ze,
14610
14619
  messageParentCheckpointId: Je
14611
14620
  }
14612
14621
  )
@@ -14651,7 +14660,7 @@ function Ai({
14651
14660
  checkpoints: E,
14652
14661
  interrupt: _,
14653
14662
  metadata: L
14654
- } = ya(), { isStreaming: F, error: j, 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, fe = _, [Re, Ne] = me(!1);
14663
+ } = ya(), { isStreaming: F, error: j, 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, fe = _, [Ee, Ne] = ge(!1);
14655
14664
  Ct(() => {
14656
14665
  fe || Ne(!1);
14657
14666
  }, [fe]);
@@ -14659,40 +14668,40 @@ function Ai({
14659
14668
  Ne(!0);
14660
14669
  }, []), ee = Ie(() => {
14661
14670
  Ne(!1);
14662
- }, []), W = !!fe || Re, [M, H] = me(null), [te, ie] = me(""), [ne, Le] = me(null), [Q, se] = me(null), [Se, je] = me([]), [Ke, Be] = me(0), [ze, qe] = me(0), [Ge, Qe] = me(!1), [Je, nt] = me(null), [Tt, ut] = me(null), [lt, kt] = me(!1), [wt, re] = me(null), [Ce, Ue] = me(!1), Pe = Ze(!1), [st, Ee] = me(() => Uc.value), ye = Ze(st), bt = Ze(null), _t = Ie((q) => {
14663
- Uc.value = q, Ee(q);
14664
- }, []), [V, ve] = me(!1), ge = Ze(null), ht = Ie((q) => {
14671
+ }, []), W = !!fe || Ee, [M, H] = ge(null), [te, ie] = ge(""), [ne, De] = ge(null), [Q, se] = ge(null), [Te, je] = ge([]), [Ke, ze] = ge(0), [$e, qe] = ge(0), [Ge, Qe] = ge(!1), [Je, nt] = ge(null), [jt, ut] = ge(null), [lt, Tt] = ge(!1), [bt, re] = ge(null), [we, Be] = ge(!1), He = Ze(!1), [mt, xe] = ge(() => Uc.value), pe = Ze(mt), st = Ze(null), _t = Ie((q) => {
14672
+ Uc.value = q, xe(q);
14673
+ }, []), [V, be] = ge(!1), ye = Ze(null), ht = Ie((q) => {
14665
14674
  if (!Array.isArray(q))
14666
14675
  return { text: null, messageId: null };
14667
14676
  for (let oe = q.length - 1; oe >= 0; oe--) {
14668
14677
  const le = q[oe];
14669
14678
  if (!le || le.role !== "user") continue;
14670
- const be = (le.content ?? []).filter((Xe) => (Xe == null ? void 0 : Xe.type) === "text").map((Xe) => Xe.text).filter((Xe) => typeof Xe == "string" && Xe.trim().length > 0);
14679
+ const Ce = (le.content ?? []).filter((Xe) => (Xe == null ? void 0 : Xe.type) === "text").map((Xe) => Xe.text).filter((Xe) => typeof Xe == "string" && Xe.trim().length > 0);
14671
14680
  return {
14672
- text: be.length ? be.join(" ").trim() : null,
14681
+ text: Ce.length ? Ce.join(" ").trim() : null,
14673
14682
  messageId: le.id ?? null
14674
14683
  };
14675
14684
  }
14676
14685
  return { text: null, messageId: null };
14677
- }, []), mt = Ie(
14686
+ }, []), gt = Ie(
14678
14687
  (q, oe) => {
14679
14688
  if (!q || typeof q != "object") return null;
14680
14689
  const le = q[oe];
14681
14690
  return typeof le == "number" ? le : null;
14682
14691
  },
14683
14692
  []
14684
- ), Rt = Ie(
14693
+ ), kt = Ie(
14685
14694
  (q, oe) => {
14686
14695
  if (!q || typeof q != "object") return null;
14687
14696
  const le = q[oe];
14688
14697
  return typeof le == "string" && le.trim() ? le : null;
14689
14698
  },
14690
14699
  []
14691
- ), Oe = at(() => {
14692
- const q = (be) => {
14693
- if (!Array.isArray(be) || be.length === 0)
14700
+ ), Pe = at(() => {
14701
+ const q = (Ce) => {
14702
+ if (!Array.isArray(Ce) || Ce.length === 0)
14694
14703
  return null;
14695
- const dt = be.map((Xe) => {
14704
+ const dt = Ce.map((Xe) => {
14696
14705
  if (typeof Xe == "string")
14697
14706
  return Xe.trim();
14698
14707
  if (Xe && typeof Xe == "object" && "type" in Xe) {
@@ -14703,88 +14712,88 @@ function Ai({
14703
14712
  return null;
14704
14713
  }).filter((Xe) => !!(Xe && Xe.length));
14705
14714
  return dt.length ? dt.join(", ") : null;
14706
- }, oe = Array.isArray(E) ? E.map((be) => {
14707
- const dt = q(be.next);
14715
+ }, oe = Array.isArray(E) ? E.map((Ce) => {
14716
+ const dt = q(Ce.next);
14708
14717
  return dt ? {
14709
- ...be,
14718
+ ...Ce,
14710
14719
  metadata: {
14711
- ...be.metadata ?? {},
14720
+ ...Ce.metadata ?? {},
14712
14721
  next: dt
14713
14722
  }
14714
- } : be;
14723
+ } : Ce;
14715
14724
  }) : [];
14716
- return oe.some((be) => mt(be.metadata, "step") !== null) && oe.sort((be, dt) => {
14717
- const Xe = mt(be.metadata, "step"), tt = mt(dt.metadata, "step");
14725
+ return oe.some((Ce) => gt(Ce.metadata, "step") !== null) && oe.sort((Ce, dt) => {
14726
+ const Xe = gt(Ce.metadata, "step"), tt = gt(dt.metadata, "step");
14718
14727
  if (Xe !== null || tt !== null)
14719
14728
  return (tt ?? Number.NEGATIVE_INFINITY) - (Xe ?? Number.NEGATIVE_INFINITY);
14720
- const Mt = Date.parse(be.createdAt ?? ""), tn = Date.parse(dt.createdAt ?? "");
14729
+ const Mt = Date.parse(Ce.createdAt ?? ""), tn = Date.parse(dt.createdAt ?? "");
14721
14730
  return Number.isNaN(Mt) || Number.isNaN(tn) ? 0 : tn - Mt;
14722
14731
  }), oe;
14723
- }, [E, mt]), { checkpointMetaById: Vt, checkpointIndexByKey: ct } = at(() => {
14732
+ }, [E, gt]), { checkpointMetaById: Vt, checkpointIndexByKey: ct } = at(() => {
14724
14733
  const q = /* @__PURE__ */ new Map(), oe = /* @__PURE__ */ new Map();
14725
- for (const le of Oe) {
14726
- const be = le.checkpointId ?? null;
14727
- if (!be) continue;
14728
- const dt = mt(le.metadata, "step"), Xe = Rt(le.metadata, "source"), tt = {
14729
- id: be,
14734
+ for (const le of Pe) {
14735
+ const Ce = le.checkpointId ?? null;
14736
+ if (!Ce) continue;
14737
+ const dt = gt(le.metadata, "step"), Xe = kt(le.metadata, "source"), tt = {
14738
+ id: Ce,
14730
14739
  step: dt,
14731
14740
  source: Xe,
14732
14741
  createdAt: le.createdAt ?? null,
14733
14742
  namespace: le.checkpointNs ?? null,
14734
14743
  parentId: le.parentId ?? null
14735
14744
  };
14736
- if (q.set(be, tt), dt !== null && Xe) {
14745
+ if (q.set(Ce, tt), dt !== null && Xe) {
14737
14746
  const Mt = `${dt}:${Xe}`, tn = oe.get(Mt) ?? [];
14738
14747
  tn.push(tt), oe.set(Mt, tn);
14739
14748
  }
14740
14749
  }
14741
14750
  for (const le of oe.values())
14742
- le.sort((be, dt) => {
14743
- const Xe = be.createdAt ?? "";
14751
+ le.sort((Ce, dt) => {
14752
+ const Xe = Ce.createdAt ?? "";
14744
14753
  return (dt.createdAt ?? "").localeCompare(Xe);
14745
14754
  });
14746
14755
  return { checkpointMetaById: q, checkpointIndexByKey: oe };
14747
- }, [Oe, mt, Rt]), Et = at(() => {
14756
+ }, [Pe, gt, kt]), Rt = at(() => {
14748
14757
  var Xe;
14749
- if (!Oe.length) return [];
14750
- const q = [...Oe].reverse(), oe = (tt, Mt) => {
14758
+ if (!Pe.length) return [];
14759
+ const q = [...Pe].reverse(), oe = (tt, Mt) => {
14751
14760
  const tn = tt.checkpointId ?? null;
14752
14761
  if (!tn) return null;
14753
- const Zn = Rt(tt.metadata, "source");
14754
- Rt(tt.metadata, "next");
14755
- const { text: ll, messageId: nm } = ht(tt.messages), oi = ll && ll.replace(/\s+/g, " ").trim() || Rt(tt.metadata, "title") || Rt(tt.metadata, "label") || Mt || Zn || "Checkpoint", rm = oi.length > 60 ? `${oi.slice(0, 57)}…` : oi;
14762
+ const Zn = kt(tt.metadata, "source");
14763
+ kt(tt.metadata, "next");
14764
+ const { text: ll, messageId: nm } = ht(tt.messages), oi = ll && ll.replace(/\s+/g, " ").trim() || kt(tt.metadata, "title") || kt(tt.metadata, "label") || Mt || Zn || "Checkpoint", rm = oi.length > 60 ? `${oi.slice(0, 57)}…` : oi;
14756
14765
  return {
14757
14766
  id: tn,
14758
14767
  label: rm,
14759
14768
  messageId: nm ?? null,
14760
14769
  createdAt: tt.createdAt ?? null,
14761
- step: mt(tt.metadata, "step"),
14770
+ step: gt(tt.metadata, "step"),
14762
14771
  source: Zn ?? null,
14763
- next: Rt(tt.metadata, "next")
14772
+ next: kt(tt.metadata, "next")
14764
14773
  };
14765
- }, le = [], be = /* @__PURE__ */ new Set();
14774
+ }, le = [], Ce = /* @__PURE__ */ new Set();
14766
14775
  for (const tt of q) {
14767
- const Mt = ((Xe = Rt(tt.metadata, "source")) == null ? void 0 : Xe.toLowerCase()) ?? null;
14776
+ const Mt = ((Xe = kt(tt.metadata, "source")) == null ? void 0 : Xe.toLowerCase()) ?? null;
14768
14777
  if (!(Mt === "input" || Mt === "user_input" || Mt === "user")) continue;
14769
14778
  const Zn = oe(tt, "User input");
14770
- Zn && !be.has(Zn.id) && (le.push(Zn), be.add(Zn.id));
14779
+ Zn && !Ce.has(Zn.id) && (le.push(Zn), Ce.add(Zn.id));
14771
14780
  }
14772
14781
  if (!le.length)
14773
14782
  for (const tt of q) {
14774
14783
  const Mt = oe(tt);
14775
- Mt && !be.has(Mt.id) && (le.push(Mt), be.add(Mt.id));
14784
+ Mt && !Ce.has(Mt.id) && (le.push(Mt), Ce.add(Mt.id));
14776
14785
  }
14777
- const dt = Oe.find((tt) => {
14786
+ const dt = Pe.find((tt) => {
14778
14787
  var tn;
14779
- return (((tn = Rt(tt.metadata, "source")) == null ? void 0 : tn.toLowerCase()) ?? null) === "loop";
14788
+ return (((tn = kt(tt.metadata, "source")) == null ? void 0 : tn.toLowerCase()) ?? null) === "loop";
14780
14789
  });
14781
14790
  if (dt) {
14782
14791
  const tt = oe(dt, "Latest loop");
14783
- tt && !be.has(tt.id) && (le.push(tt), be.add(tt.id));
14792
+ tt && !Ce.has(tt.id) && (le.push(tt), Ce.add(tt.id));
14784
14793
  }
14785
14794
  return le;
14786
- }, [Oe, ht, mt, Rt]), Dn = Ze(null), Jn = Ze(null), Ln = Ie(() => {
14787
- Dn.current && (Dn.current.value = ""), Jn.current && (Jn.current.value = ""), Be((q) => q + 1), qe((q) => q + 1);
14795
+ }, [Pe, ht, gt, kt]), Dn = Ze(null), Jn = Ze(null), Ln = Ie(() => {
14796
+ Dn.current && (Dn.current.value = ""), Jn.current && (Jn.current.value = ""), ze((q) => q + 1), qe((q) => q + 1);
14788
14797
  }, []), ti = Ie(
14789
14798
  (q) => {
14790
14799
  _t(q);
@@ -14794,7 +14803,7 @@ function Ai({
14794
14803
  Ct(() => {
14795
14804
  So.current && !F && (je([]), Ln()), So.current = F;
14796
14805
  }, [F, Ln]);
14797
- const [ni, ri] = me("desktop");
14806
+ const [ni, ri] = ge("desktop");
14798
14807
  Ct(() => {
14799
14808
  const q = () => {
14800
14809
  const oe = window.innerWidth;
@@ -14802,24 +14811,24 @@ function Ai({
14802
14811
  };
14803
14812
  return q(), window.addEventListener("resize", q), () => window.removeEventListener("resize", q);
14804
14813
  }, []), Ct(() => {
14805
- Ue(!1), Pe.current = !1;
14814
+ Be(!1), He.current = !1;
14806
14815
  }, [D]), Ct(() => {
14807
- ye.current = st;
14808
- }, [st]), Ct(() => {
14816
+ pe.current = mt;
14817
+ }, [mt]), Ct(() => {
14809
14818
  if (!M) {
14810
- bt.current = null;
14819
+ st.current = null;
14811
14820
  return;
14812
14821
  }
14813
- bt.current === null && (bt.current = ye.current), _t(te ?? "");
14822
+ st.current === null && (st.current = pe.current), _t(te ?? "");
14814
14823
  }, [te, M, _t]);
14815
14824
  const R = Ie(async () => {
14816
- if (!(!b || T || !Ce))
14825
+ if (!(!b || T || !we))
14817
14826
  try {
14818
14827
  await S();
14819
14828
  } catch (q) {
14820
14829
  console.warn("loadOlder failed", q);
14821
14830
  }
14822
- }, [b, Ce, T, S]);
14831
+ }, [b, we, T, S]);
14823
14832
  Ct(() => {
14824
14833
  (async () => {
14825
14834
  if (!y.baseUrl) {
@@ -14846,7 +14855,7 @@ function Ai({
14846
14855
  }
14847
14856
  }, ae = async (q) => {
14848
14857
  const oe = q.trim();
14849
- if (!(!oe && Se.length === 0)) {
14858
+ if (!(!oe && Te.length === 0)) {
14850
14859
  if (oe) {
14851
14860
  const le = K(oe);
14852
14861
  if (le) {
@@ -14855,7 +14864,7 @@ function Ai({
14855
14864
  }
14856
14865
  }
14857
14866
  try {
14858
- const le = O ?? void 0, be = J ?? void 0, dt = M ? {
14867
+ const le = O ?? void 0, Ce = J ?? void 0, dt = M ? {
14859
14868
  edit: !0,
14860
14869
  originalMessageId: M,
14861
14870
  ...ne != null && ne.checkpointId ? { originalCheckpointId: ne.checkpointId } : {},
@@ -14864,35 +14873,35 @@ function Ai({
14864
14873
  await A(
14865
14874
  {
14866
14875
  text: oe || "",
14867
- attachments: Se,
14876
+ attachments: Te,
14868
14877
  messageAdditionalKwargs: dt
14869
14878
  },
14870
14879
  {
14871
14880
  checkpointId: le,
14872
- checkpointNs: be
14881
+ checkpointNs: Ce
14873
14882
  }
14874
- ), p == null || p(oe), _t(""), se(null), je([]), Ln(), H(null), ie(""), Le(null);
14883
+ ), p == null || p(oe), _t(""), se(null), je([]), Ln(), H(null), ie(""), De(null);
14875
14884
  } catch (le) {
14876
- const be = (le == null ? void 0 : le.message) || "Failed to send message";
14877
- se(be), x == null || x(be);
14885
+ const Ce = (le == null ? void 0 : le.message) || "Failed to send message";
14886
+ se(Ce), x == null || x(Ce);
14878
14887
  }
14879
14888
  }
14880
- }, we = z.useCallback(
14889
+ }, Se = z.useCallback(
14881
14890
  (q, oe, le) => {
14882
- c && (bt.current = st, H(q), ie(oe), _t(oe), se(null), Le({
14891
+ c && (st.current = mt, H(q), ie(oe), _t(oe), se(null), De({
14883
14892
  checkpointId: (le == null ? void 0 : le.checkpointId) ?? null,
14884
14893
  checkpointNs: (le == null ? void 0 : le.checkpointNs) ?? null
14885
14894
  }));
14886
14895
  },
14887
- [st, c, _t]
14896
+ [mt, c, _t]
14888
14897
  ), Ye = z.useCallback(() => {
14889
- H(null), ie(""), Le(null), se(null), _t(bt.current ?? st), bt.current = null;
14890
- }, [st, _t]), it = Ie(
14898
+ H(null), ie(""), De(null), se(null), _t(st.current ?? mt), st.current = null;
14899
+ }, [mt, _t]), it = Ie(
14891
14900
  (q, oe, le) => {
14892
- we(q, oe, le);
14901
+ Se(q, oe, le);
14893
14902
  },
14894
- [we]
14895
- ), He = Ie((q) => {
14903
+ [Se]
14904
+ ), Ue = Ie((q) => {
14896
14905
  for (let oe = q - 1; oe >= 0; oe--)
14897
14906
  if (w[oe].role === "user") {
14898
14907
  const le = w[oe].content || [], dt = le.filter((Xe) => Xe.type === "text").map((Xe) => Xe.text).join("") || (() => {
@@ -14911,12 +14920,12 @@ function Ai({
14911
14920
  );
14912
14921
  break;
14913
14922
  }
14914
- }, [w, A, O, J]), $e = (q) => {
14923
+ }, [w, A, O, J]), Fe = (q) => {
14915
14924
  const oe = Array.from(q.target.files || []);
14916
14925
  je((le) => [...le, ...oe]), q.target.value = "";
14917
14926
  }, Ot = (q) => {
14918
14927
  je((oe) => {
14919
- const le = oe.filter((be, dt) => q !== dt);
14928
+ const le = oe.filter((Ce, dt) => q !== dt);
14920
14929
  return le.length === 0 && Ln(), le;
14921
14930
  });
14922
14931
  }, St = async (q) => {
@@ -14934,45 +14943,45 @@ function Ai({
14934
14943
  const le = `Uploaded ${oe.name} - processing through chat stream`;
14935
14944
  ut(le);
14936
14945
  } catch (le) {
14937
- const be = le instanceof Error ? le.message : "Failed to upload Excel file";
14938
- console.error("Excel upload failed", le), nt(be), x == null || x(be);
14946
+ const Ce = le instanceof Error ? le.message : "Failed to upload Excel file";
14947
+ console.error("Excel upload failed", le), nt(Ce), x == null || x(Ce);
14939
14948
  } finally {
14940
14949
  Qe(!1), q.target.value = "", Ln();
14941
14950
  }
14942
14951
  }
14943
- }, yt = async (q) => {
14952
+ }, vt = async (q) => {
14944
14953
  if (m) {
14945
- ve(!0);
14954
+ be(!0);
14946
14955
  try {
14947
14956
  if (!q) {
14948
- await N(), Ue(!1), requestAnimationFrame(() => {
14949
- var be;
14950
- (be = ge.current) == null || be.scrollToLatest();
14957
+ await N(), Be(!1), requestAnimationFrame(() => {
14958
+ var Ce;
14959
+ (Ce = ye.current) == null || Ce.scrollToLatest();
14951
14960
  });
14952
14961
  return;
14953
14962
  }
14954
- const oe = Oe.find((be) => be.checkpointId === q), le = (oe == null ? void 0 : oe.checkpointNs) ?? null;
14955
- await k(q, le), Ue(!0), requestAnimationFrame(() => {
14956
- var be;
14957
- (be = ge.current) == null || be.scrollToTop();
14963
+ const oe = Pe.find((Ce) => Ce.checkpointId === q), le = (oe == null ? void 0 : oe.checkpointNs) ?? null;
14964
+ await k(q, le), Be(!0), requestAnimationFrame(() => {
14965
+ var Ce;
14966
+ (Ce = ye.current) == null || Ce.scrollToTop();
14958
14967
  });
14959
14968
  } finally {
14960
- ve(!1);
14969
+ be(!1);
14961
14970
  }
14962
14971
  }
14963
14972
  }, Kt = Ie(
14964
14973
  async (q) => {
14965
- await yt(q);
14974
+ await vt(q);
14966
14975
  },
14967
- [yt]
14976
+ [vt]
14968
14977
  ), 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 = Ie(
14969
14978
  (q) => {
14970
14979
  if (!q)
14971
14980
  return "Latest";
14972
14981
  const oe = [];
14973
14982
  q.step !== null && oe.push(`Step ${q.step}`), q.source && oe.push(q.source);
14974
- const le = q.createdAt ? new Date(q.createdAt) : null, be = le && !Number.isNaN(le.getTime()) ? le.toLocaleString() : q.createdAt ?? q.id, dt = oe.length ? ` — ${oe.join(" • ")}` : "";
14975
- return `${be}${dt}`;
14983
+ const le = q.createdAt ? new Date(q.createdAt) : null, Ce = le && !Number.isNaN(le.getTime()) ? le.toLocaleString() : q.createdAt ?? q.id, dt = oe.length ? ` — ${oe.join(" • ")}` : "";
14984
+ return `${Ce}${dt}`;
14976
14985
  },
14977
14986
  []
14978
14987
  );
@@ -14984,14 +14993,14 @@ function Ai({
14984
14993
  {
14985
14994
  variant: "ghost",
14986
14995
  size: "sm",
14987
- onClick: () => kt(!0),
14996
+ onClick: () => Tt(!0),
14988
14997
  className: "text-red-800 hover:bg-red-100",
14989
14998
  "aria-label": "Dismiss error",
14990
14999
  children: /* @__PURE__ */ u.jsx(vr, { size: 16 })
14991
15000
  }
14992
15001
  )
14993
15002
  ] }),
14994
- m && Oe.length > 0 && /* @__PURE__ */ u.jsxs("div", { className: "flex-shrink-0 flex items-center gap-2 px-4 py-2 border-b border-border bg-muted/60 text-xs dark:bg-muted/50", children: [
15003
+ m && Pe.length > 0 && /* @__PURE__ */ u.jsxs("div", { className: "flex-shrink-0 flex items-center gap-2 px-4 py-2 border-b border-border bg-muted/60 text-xs dark:bg-muted/50", children: [
14995
15004
  /* @__PURE__ */ u.jsx("span", { className: "opacity-70", children: "Checkpoint:" }),
14996
15005
  /* @__PURE__ */ u.jsxs(
14997
15006
  "select",
@@ -15000,11 +15009,11 @@ function Ai({
15000
15009
  value: O ?? "",
15001
15010
  onChange: (q) => {
15002
15011
  const oe = q.target.value || null;
15003
- yt(oe);
15012
+ vt(oe);
15004
15013
  },
15005
15014
  children: [
15006
15015
  /* @__PURE__ */ u.jsx("option", { value: "", children: "Latest" }),
15007
- Oe.map((q) => {
15016
+ Pe.map((q) => {
15008
15017
  const oe = Vt.get(q.checkpointId ?? "") ?? null;
15009
15018
  return /* @__PURE__ */ u.jsx("option", { value: q.checkpointId ?? void 0, children: Dr(oe) }, q.checkpointId);
15010
15019
  })
@@ -15021,7 +15030,7 @@ function Ai({
15021
15030
  /* @__PURE__ */ u.jsx(
15022
15031
  Mp,
15023
15032
  {
15024
- ref: ge,
15033
+ ref: ye,
15025
15034
  className: "h-full",
15026
15035
  style: { height: "100%" },
15027
15036
  messages: w,
@@ -15033,22 +15042,22 @@ function Ai({
15033
15042
  enableMessageEditing: c,
15034
15043
  editingMessageId: M,
15035
15044
  onStartReached: () => {
15036
- Ce && R();
15045
+ we && R();
15037
15046
  },
15038
15047
  onScrollAway: (q) => {
15039
- if (!Pe.current) {
15040
- Pe.current = !0;
15048
+ if (!He.current) {
15049
+ He.current = !0;
15041
15050
  return;
15042
15051
  }
15043
- q && Ue(!0);
15052
+ q && Be(!0);
15044
15053
  },
15045
15054
  onEdit: it,
15046
- onRegenerate: He,
15055
+ onRegenerate: Ue,
15047
15056
  onCancelEdit: Ye,
15048
- emptyMessage: wt ?? void 0,
15057
+ emptyMessage: bt ?? void 0,
15049
15058
  isNavigatingCheckpoint: V,
15050
15059
  activeInterrupt: fe,
15051
- disableInterruptActions: Re,
15060
+ disableInterruptActions: Ee,
15052
15061
  onInterruptActionStart: G,
15053
15062
  onInterruptActionEnd: ee,
15054
15063
  showToolMessages: d,
@@ -15056,7 +15065,7 @@ function Ai({
15056
15065
  checkpointIndexByKey: ct,
15057
15066
  activeCheckpointId: O,
15058
15067
  onSelectCheckpoint: Kt,
15059
- timelineCheckpoints: Et
15068
+ timelineCheckpoints: Rt
15060
15069
  }
15061
15070
  ),
15062
15071
  ($ === "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: [
@@ -15100,12 +15109,12 @@ function Ai({
15100
15109
  ref: Dn,
15101
15110
  type: "file",
15102
15111
  multiple: !0,
15103
- onChange: (q) => $e(q),
15112
+ onChange: (q) => Fe(q),
15104
15113
  className: "hidden"
15105
15114
  },
15106
15115
  Ke
15107
15116
  ),
15108
- Se.length > 0 && /* @__PURE__ */ u.jsx("div", { className: "flex flex-wrap gap-2", children: Se.map((q, oe) => /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2 bg-gray-100 dark:bg-gray-800 rounded-lg px-3 py-2 text-sm text-gray-900 dark:text-gray-100", children: [
15117
+ Te.length > 0 && /* @__PURE__ */ u.jsx("div", { className: "flex flex-wrap gap-2", children: Te.map((q, oe) => /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2 bg-gray-100 dark:bg-gray-800 rounded-lg px-3 py-2 text-sm text-gray-900 dark:text-gray-100", children: [
15109
15118
  /* @__PURE__ */ u.jsx(ji, { size: 14 }),
15110
15119
  /* @__PURE__ */ u.jsx("span", { className: "truncate max-w-[150px]", children: q.name }),
15111
15120
  /* @__PURE__ */ u.jsx(
@@ -15131,13 +15140,13 @@ function Ai({
15131
15140
  onChange: St,
15132
15141
  className: "hidden"
15133
15142
  },
15134
- ze
15143
+ $e
15135
15144
  ),
15136
15145
  Ge && /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
15137
15146
  /* @__PURE__ */ u.jsx(zr, { className: "h-4 w-4 animate-spin" }),
15138
15147
  " Uploading Excel file..."
15139
15148
  ] }),
15140
- Tt && !Ge && /* @__PURE__ */ u.jsx("div", { className: "text-sm rounded border border-emerald-200 bg-emerald-50 px-3 py-2 text-emerald-700", children: Tt }),
15149
+ jt && !Ge && /* @__PURE__ */ u.jsx("div", { className: "text-sm rounded border border-emerald-200 bg-emerald-50 px-3 py-2 text-emerald-700", children: jt }),
15141
15150
  Je && !Ge && /* @__PURE__ */ u.jsx("div", { className: "text-sm rounded border border-red-200 bg-red-50 px-3 py-2 text-red-600", children: Je })
15142
15151
  ] })
15143
15152
  ] }),
@@ -15185,7 +15194,7 @@ function Ai({
15185
15194
  {
15186
15195
  initialValue: te,
15187
15196
  editingMessageId: M,
15188
- value: st,
15197
+ value: mt,
15189
15198
  onValueChange: ti,
15190
15199
  placeholder: M ? "Edit your message..." : t,
15191
15200
  isStreaming: F,
@@ -15194,7 +15203,7 @@ function Ai({
15194
15203
  onSend: ae,
15195
15204
  onCancelEdit: Ye,
15196
15205
  onStop: B,
15197
- allowEmptySend: Se.length > 0,
15206
+ allowEmptySend: Te.length > 0,
15198
15207
  textareaClassName: `resize-none min-h-[44px] max-h-[20rem] w-full transition-colors ${M ? "border-blue-400 bg-blue-50 text-blue-900 dark:border-blue-500 dark:bg-blue-950/60 dark:text-blue-50" : ""} ${Q ? "border-red-400" : ""} ${f.textarea || ""}`
15199
15208
  }
15200
15209
  ) })
@@ -15781,7 +15790,7 @@ function Kc({
15781
15790
  setCurrentThreadId: h,
15782
15791
  isLoading: x,
15783
15792
  actions: y
15784
- } = xa(), { loadThread: m } = ya(), { createThread: g, deleteThread: w, renameThread: b } = y, [T, C] = me(Array.isArray(f) ? f : []), S = Ze(T.length > 0), k = Ze(null), N = Ze(0), [I, E] = me(null), [_, L] = me(""), [F, j] = me(!1);
15793
+ } = xa(), { loadThread: m } = ya(), { createThread: g, deleteThread: w, renameThread: b } = y, [T, C] = ge(Array.isArray(f) ? f : []), S = Ze(T.length > 0), k = Ze(null), N = Ze(0), [I, E] = ge(null), [_, L] = ge(""), [F, j] = ge(!1);
15785
15794
  Ct(() => {
15786
15795
  const G = Array.isArray(f) ? f : [];
15787
15796
  if (G.length > 0) {
@@ -15853,8 +15862,8 @@ function Kc({
15853
15862
  } catch {
15854
15863
  return "";
15855
15864
  }
15856
- }, Re = (G) => G.title || `Thread ${G.threadId.slice(0, 8)}`, Ne = (G) => {
15857
- const ee = Re(G);
15865
+ }, Ee = (G) => G.title || `Thread ${G.threadId.slice(0, 8)}`, Ne = (G) => {
15866
+ const ee = Ee(G);
15858
15867
  return ee.length <= Vc ? ee : `${ee.slice(0, Vc)}...`;
15859
15868
  };
15860
15869
  return /* @__PURE__ */ u.jsxs("div", { className: `flex flex-col h-full ${e} ${s.container || ""}`, children: [
@@ -16464,7 +16473,7 @@ var dn = 10, [vh, Xn] = Mr(ur), pT = "SelectContentImpl", hT = Tr("SelectContent
16464
16473
  (w.value !== void 0 && w.value === M || te) && (I(W), te && ($.current = !0));
16465
16474
  },
16466
16475
  [w.value]
16467
- ), Re = v.useCallback(() => b == null ? void 0 : b.focus(), [b]), Ne = v.useCallback(
16476
+ ), Ee = v.useCallback(() => b == null ? void 0 : b.focus(), [b]), Ne = v.useCallback(
16468
16477
  (W, M, H) => {
16469
16478
  const te = !$.current && !H;
16470
16479
  (w.value !== void 0 && w.value === M || te) && _(W);
@@ -16491,7 +16500,7 @@ var dn = 10, [vh, Xn] = Mr(ur), pT = "SelectContentImpl", hT = Tr("SelectContent
16491
16500
  onViewportChange: S,
16492
16501
  itemRefCallback: fe,
16493
16502
  selectedItem: N,
16494
- onItemLeave: Re,
16503
+ onItemLeave: Ee,
16495
16504
  itemTextRefCallback: Ne,
16496
16505
  focusSelectedItem: B,
16497
16506
  selectedItemText: E,
@@ -16566,42 +16575,42 @@ var mT = "SelectItemAlignedPosition", bh = v.forwardRef((e, t) => {
16566
16575
  if (s.trigger && s.valueNode && a && c && y && m && g) {
16567
16576
  const k = s.trigger.getBoundingClientRect(), N = c.getBoundingClientRect(), I = s.valueNode.getBoundingClientRect(), E = g.getBoundingClientRect();
16568
16577
  if (s.dir !== "rtl") {
16569
- const ie = E.left - N.left, ne = I.left - ie, Le = k.left - ne, Q = k.width + Le, se = Math.max(Q, N.width), Se = window.innerWidth - dn, je = ta(ne, [
16578
+ const ie = E.left - N.left, ne = I.left - ie, De = k.left - ne, Q = k.width + De, se = Math.max(Q, N.width), Te = window.innerWidth - dn, je = ta(ne, [
16570
16579
  dn,
16571
16580
  // Prevents the content from going off the starting edge of the
16572
16581
  // viewport. It may still go off the ending edge, but this can be
16573
16582
  // controlled by the user since they may want to manage overflow in a
16574
16583
  // specific way.
16575
16584
  // https://github.com/radix-ui/primitives/issues/2049
16576
- Math.max(dn, Se - se)
16585
+ Math.max(dn, Te - se)
16577
16586
  ]);
16578
16587
  a.style.minWidth = Q + "px", a.style.left = je + "px";
16579
16588
  } else {
16580
- const ie = N.right - E.right, ne = window.innerWidth - I.right - ie, Le = window.innerWidth - k.right - ne, Q = k.width + Le, se = Math.max(Q, N.width), Se = window.innerWidth - dn, je = ta(ne, [
16589
+ const ie = N.right - E.right, ne = window.innerWidth - I.right - ie, De = window.innerWidth - k.right - ne, Q = k.width + De, se = Math.max(Q, N.width), Te = window.innerWidth - dn, je = ta(ne, [
16581
16590
  dn,
16582
- Math.max(dn, Se - se)
16591
+ Math.max(dn, Te - se)
16583
16592
  ]);
16584
16593
  a.style.minWidth = Q + "px", a.style.right = je + "px";
16585
16594
  }
16586
- const _ = p(), L = window.innerHeight - dn * 2, F = y.scrollHeight, j = window.getComputedStyle(c), $ = parseInt(j.borderTopWidth, 10), A = parseInt(j.paddingTop, 10), B = parseInt(j.borderBottomWidth, 10), D = parseInt(j.paddingBottom, 10), O = $ + A + F + D + B, J = Math.min(m.offsetHeight * 5, O), X = window.getComputedStyle(y), fe = parseInt(X.paddingTop, 10), Re = parseInt(X.paddingBottom, 10), Ne = k.top + k.height / 2 - dn, G = L - Ne, ee = m.offsetHeight / 2, W = m.offsetTop + ee, M = $ + A + W, H = O - M;
16595
+ const _ = p(), L = window.innerHeight - dn * 2, F = y.scrollHeight, j = window.getComputedStyle(c), $ = parseInt(j.borderTopWidth, 10), A = parseInt(j.paddingTop, 10), B = parseInt(j.borderBottomWidth, 10), D = parseInt(j.paddingBottom, 10), O = $ + A + F + D + B, J = Math.min(m.offsetHeight * 5, O), X = window.getComputedStyle(y), fe = parseInt(X.paddingTop, 10), Ee = parseInt(X.paddingBottom, 10), Ne = k.top + k.height / 2 - dn, G = L - Ne, ee = m.offsetHeight / 2, W = m.offsetTop + ee, M = $ + A + W, H = O - M;
16587
16596
  if (M <= Ne) {
16588
16597
  const ie = _.length > 0 && m === _[_.length - 1].ref.current;
16589
16598
  a.style.bottom = "0px";
16590
- const ne = c.clientHeight - y.offsetTop - y.offsetHeight, Le = Math.max(
16599
+ const ne = c.clientHeight - y.offsetTop - y.offsetHeight, De = Math.max(
16591
16600
  G,
16592
16601
  ee + // viewport might have padding bottom, include it to avoid a scrollable viewport
16593
- (ie ? Re : 0) + ne + B
16594
- ), Q = M + Le;
16602
+ (ie ? Ee : 0) + ne + B
16603
+ ), Q = M + De;
16595
16604
  a.style.height = Q + "px";
16596
16605
  } else {
16597
16606
  const ie = _.length > 0 && m === _[0].ref.current;
16598
16607
  a.style.top = "0px";
16599
- const Le = Math.max(
16608
+ const De = Math.max(
16600
16609
  Ne,
16601
16610
  $ + y.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
16602
16611
  (ie ? fe : 0) + ee
16603
16612
  ) + H;
16604
- a.style.height = Le + "px", y.scrollTop = M - Ne + y.offsetTop;
16613
+ a.style.height = De + "px", y.scrollTop = M - Ne + y.offsetTop;
16605
16614
  }
16606
16615
  a.style.margin = `${dn}px 0`, a.style.minHeight = J + "px", a.style.maxHeight = L + "px", r == null || r(), requestAnimationFrame(() => h.current = !0);
16607
16616
  }
@@ -17255,7 +17264,7 @@ const HT = {
17255
17264
  }
17256
17265
  };
17257
17266
  function Tk({ settings: e, onSettingsChange: t, className: n = "" }) {
17258
- const [r, o] = me(!1), [s, i] = me(!1), [a, l] = me(e), [c, d] = me(!1), { toast: f } = Xa();
17267
+ const [r, o] = ge(!1), [s, i] = ge(!1), [a, l] = ge(e), [c, d] = ge(!1), { toast: f } = Xa();
17259
17268
  Ct(() => {
17260
17269
  const m = JSON.stringify(a) !== JSON.stringify(e);
17261
17270
  d(m);