teodor-new-chat-ui 4.3.431 → 4.3.433

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
@@ -172,9 +172,16 @@ function Yn(e) {
172
172
  function ix(e, t) {
173
173
  var y;
174
174
  if (!e) return null;
175
- const r = (Array.isArray((y = e.values) == null ? void 0 : y.messages) ? e.values.messages : []).filter(
176
- (C) => !!(C && typeof C == "object" && typeof C.role == "string")
177
- ), o = er(e.metadata) ?? {}, s = Yl(e.config), a = er(e.parent_config ?? e.parentConfig), i = Yl(a), l = Gn(s, ["checkpoint_id", "checkpointId"]), c = Gn(s, ["checkpoint_ns", "checkpointNs"]), d = Gn(i, ["checkpoint_id", "checkpointId"]), p = Gn(i, ["checkpoint_id", "checkpointId"]) ?? null, m = Gn(i, ["checkpoint_ns", "checkpointNs"]) ?? null, f = er(e.config), v = Array.isArray(e.tasks) ? e.tasks.map((C) => ({ ...C })) : e.tasks ?? null, g = Array.isArray(e.next) ? [...e.next] : e.next ?? null, x = typeof e.created_at == "string" && e.created_at.trim() ? e.created_at : typeof e.createdAt == "string" && e.createdAt.trim() ? e.createdAt : new Date(Date.now() - t).toISOString(), b = {
175
+ const r = (Array.isArray((y = e.values) == null ? void 0 : y.messages) ? e.values.messages : []).filter((C) => !!(C && typeof C == "object" && typeof C.role == "string")).map((C) => typeof C.content == "string" ? {
176
+ ...C,
177
+ content: [{
178
+ type: "text",
179
+ text: C.content
180
+ }]
181
+ } : Array.isArray(C.content) ? C : {
182
+ ...C,
183
+ content: []
184
+ }), o = er(e.metadata) ?? {}, s = Yl(e.config), a = er(e.parent_config ?? e.parentConfig), i = Yl(a), l = Gn(s, ["checkpoint_id", "checkpointId"]), c = Gn(s, ["checkpoint_ns", "checkpointNs"]), d = Gn(i, ["checkpoint_id", "checkpointId"]), p = Gn(i, ["checkpoint_id", "checkpointId"]) ?? null, m = Gn(i, ["checkpoint_ns", "checkpointNs"]) ?? null, f = er(e.config), v = Array.isArray(e.tasks) ? e.tasks.map((C) => ({ ...C })) : e.tasks ?? null, g = Array.isArray(e.next) ? [...e.next] : e.next ?? null, x = typeof e.created_at == "string" && e.created_at.trim() ? e.created_at : typeof e.createdAt == "string" && e.createdAt.trim() ? e.createdAt : new Date(Date.now() - t).toISOString(), b = {
178
185
  ...o,
179
186
  step: ax(o, ["step"]) ?? 0,
180
187
  source: Gn(o, ["source"]) ?? null
@@ -270,14 +277,14 @@ function dx() {
270
277
  var b = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
271
278
  function w(I) {
272
279
  {
273
- for (var Z = arguments.length, de = new Array(Z > 1 ? Z - 1 : 0), Ee = 1; Ee < Z; Ee++)
274
- de[Ee - 1] = arguments[Ee];
280
+ for (var Z = arguments.length, de = new Array(Z > 1 ? Z - 1 : 0), ke = 1; ke < Z; ke++)
281
+ de[ke - 1] = arguments[ke];
275
282
  y("error", I, de);
276
283
  }
277
284
  }
278
285
  function y(I, Z, de) {
279
286
  {
280
- var Ee = b.ReactDebugCurrentFrame, Je = Ee.getStackAddendum();
287
+ var ke = b.ReactDebugCurrentFrame, Je = ke.getStackAddendum();
281
288
  Je !== "" && (Z += "%s", de = de.concat([Je]));
282
289
  var ot = de.map(function(se) {
283
290
  return String(se);
@@ -295,9 +302,9 @@ function dx() {
295
302
  I.$$typeof === P || I.getModuleId !== void 0));
296
303
  }
297
304
  function B(I, Z, de) {
298
- var Ee = I.displayName;
299
- if (Ee)
300
- return Ee;
305
+ var ke = I.displayName;
306
+ if (ke)
307
+ return ke;
301
308
  var Je = Z.displayName || Z.name || "";
302
309
  return Je !== "" ? de + "(" + Je + ")" : de;
303
310
  }
@@ -336,8 +343,8 @@ function dx() {
336
343
  case l:
337
344
  return B(I, I.render, "ForwardRef");
338
345
  case p:
339
- var Ee = I.displayName || null;
340
- return Ee !== null ? Ee : L(I.type) || "Memo";
346
+ var ke = I.displayName || null;
347
+ return ke !== null ? ke : L(I.type) || "Memo";
341
348
  case m: {
342
349
  var Je = I, ot = Je._payload, se = Je._init;
343
350
  try {
@@ -418,8 +425,8 @@ function dx() {
418
425
  try {
419
426
  throw Error();
420
427
  } catch (Je) {
421
- var Ee = Je.stack.trim().match(/\n( *(at )?)/);
422
- U = Ee && Ee[1] || "";
428
+ var ke = Je.stack.trim().match(/\n( *(at )?)/);
429
+ U = ke && ke[1] || "";
423
430
  }
424
431
  return `
425
432
  ` + U + I;
@@ -438,7 +445,7 @@ function dx() {
438
445
  if (de !== void 0)
439
446
  return de;
440
447
  }
441
- var Ee;
448
+ var ke;
442
449
  Y = !0;
443
450
  var Je = Error.prepareStackTrace;
444
451
  Error.prepareStackTrace = void 0;
@@ -457,14 +464,14 @@ function dx() {
457
464
  try {
458
465
  Reflect.construct(se, []);
459
466
  } catch (Wt) {
460
- Ee = Wt;
467
+ ke = Wt;
461
468
  }
462
469
  Reflect.construct(I, [], se);
463
470
  } else {
464
471
  try {
465
472
  se.call();
466
473
  } catch (Wt) {
467
- Ee = Wt;
474
+ ke = Wt;
468
475
  }
469
476
  I.call(se.prototype);
470
477
  }
@@ -472,21 +479,21 @@ function dx() {
472
479
  try {
473
480
  throw Error();
474
481
  } catch (Wt) {
475
- Ee = Wt;
482
+ ke = Wt;
476
483
  }
477
484
  I();
478
485
  }
479
486
  } catch (Wt) {
480
- if (Wt && Ee && typeof Wt.stack == "string") {
487
+ if (Wt && ke && typeof Wt.stack == "string") {
481
488
  for (var ue = Wt.stack.split(`
482
- `), ke = Ee.stack.split(`
483
- `), Me = ue.length - 1, tt = ke.length - 1; Me >= 1 && tt >= 0 && ue[Me] !== ke[tt]; )
489
+ `), Re = ke.stack.split(`
490
+ `), Me = ue.length - 1, tt = Re.length - 1; Me >= 1 && tt >= 0 && ue[Me] !== Re[tt]; )
484
491
  tt--;
485
492
  for (; Me >= 1 && tt >= 0; Me--, tt--)
486
- if (ue[Me] !== ke[tt]) {
493
+ if (ue[Me] !== Re[tt]) {
487
494
  if (Me !== 1 || tt !== 1)
488
495
  do
489
- if (Me--, tt--, tt < 0 || ue[Me] !== ke[tt]) {
496
+ if (Me--, tt--, tt < 0 || ue[Me] !== Re[tt]) {
490
497
  var xt = `
491
498
  ` + ue[Me].replace(" at new ", " at ");
492
499
  return I.displayName && xt.includes("<anonymous>") && (xt = xt.replace("<anonymous>", I.displayName)), typeof I == "function" && J.set(I, xt), xt;
@@ -501,7 +508,7 @@ function dx() {
501
508
  var xr = I ? I.displayName || I.name : "", qn = xr ? O(xr) : "";
502
509
  return typeof I == "function" && J.set(I, qn), qn;
503
510
  }
504
- function ne(I, Z, de) {
511
+ function te(I, Z, de) {
505
512
  return F(I, !1);
506
513
  }
507
514
  function ce(I) {
@@ -524,11 +531,11 @@ function dx() {
524
531
  if (typeof I == "object")
525
532
  switch (I.$$typeof) {
526
533
  case l:
527
- return ne(I.render);
534
+ return te(I.render);
528
535
  case p:
529
536
  return ie(I.type, Z, de);
530
537
  case m: {
531
- var Ee = I, Je = Ee._payload, ot = Ee._init;
538
+ var ke = I, Je = ke._payload, ot = ke._init;
532
539
  try {
533
540
  return ie(ot(Je), Z, de);
534
541
  } catch {
@@ -537,7 +544,7 @@ function dx() {
537
544
  }
538
545
  return "";
539
546
  }
540
- var ge = Object.prototype.hasOwnProperty, Ne = {}, je = b.ReactDebugCurrentFrame;
547
+ var ge = Object.prototype.hasOwnProperty, Te = {}, je = b.ReactDebugCurrentFrame;
541
548
  function De(I) {
542
549
  if (I) {
543
550
  var Z = I._owner, de = ie(I.type, I._source, Z ? Z.type : null);
@@ -545,7 +552,7 @@ function dx() {
545
552
  } else
546
553
  je.setExtraStackFrame(null);
547
554
  }
548
- function He(I, Z, de, Ee, Je) {
555
+ function He(I, Z, de, ke, Je) {
549
556
  {
550
557
  var ot = Function.call.bind(ge);
551
558
  for (var se in I)
@@ -553,14 +560,14 @@ function dx() {
553
560
  var ue = void 0;
554
561
  try {
555
562
  if (typeof I[se] != "function") {
556
- var ke = Error((Ee || "React class") + ": " + de + " type `" + se + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof I[se] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
557
- throw ke.name = "Invariant Violation", ke;
563
+ var Re = Error((ke || "React class") + ": " + de + " type `" + se + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof I[se] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
564
+ throw Re.name = "Invariant Violation", Re;
558
565
  }
559
- ue = I[se](Z, se, Ee, de, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
566
+ ue = I[se](Z, se, ke, de, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
560
567
  } catch (Me) {
561
568
  ue = Me;
562
569
  }
563
- ue && !(ue instanceof Error) && (De(Je), 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).", Ee || "React class", de, se, typeof ue), De(null)), ue instanceof Error && !(ue.message in Ne) && (Ne[ue.message] = !0, De(Je), w("Failed %s type: %s", de, ue.message), De(null));
570
+ ue && !(ue instanceof Error) && (De(Je), 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).", ke || "React class", de, se, typeof ue), De(null)), ue instanceof Error && !(ue.message in Te) && (Te[ue.message] = !0, De(Je), w("Failed %s type: %s", de, ue.message), De(null));
564
571
  }
565
572
  }
566
573
  }
@@ -635,7 +642,7 @@ function dx() {
635
642
  });
636
643
  }
637
644
  }
638
- var Pt = function(I, Z, de, Ee, Je, ot, se) {
645
+ var Pt = function(I, Z, de, ke, Je, ot, se) {
639
646
  var ue = {
640
647
  // This tag allows us to uniquely identify this as a React Element
641
648
  $$typeof: t,
@@ -656,7 +663,7 @@ function dx() {
656
663
  configurable: !1,
657
664
  enumerable: !1,
658
665
  writable: !1,
659
- value: Ee
666
+ value: ke
660
667
  }), Object.defineProperty(ue, "_source", {
661
668
  configurable: !1,
662
669
  enumerable: !1,
@@ -664,10 +671,10 @@ function dx() {
664
671
  value: Je
665
672
  }), Object.freeze && (Object.freeze(ue.props), Object.freeze(ue)), ue;
666
673
  };
667
- function Te(I, Z, de, Ee, Je) {
674
+ function Ce(I, Z, de, ke, Je) {
668
675
  {
669
- var ot, se = {}, ue = null, ke = null;
670
- de !== void 0 && (Le(de), ue = "" + de), wt(Z) && (Le(Z.key), ue = "" + Z.key), _t(Z) && (ke = Z.ref, pt(Z, Je));
676
+ var ot, se = {}, ue = null, Re = null;
677
+ de !== void 0 && (Le(de), ue = "" + de), wt(Z) && (Le(Z.key), ue = "" + Z.key), _t(Z) && (Re = Z.ref, pt(Z, Je));
671
678
  for (ot in Z)
672
679
  ge.call(Z, ot) && !vt.hasOwnProperty(ot) && (se[ot] = Z[ot]);
673
680
  if (I && I.defaultProps) {
@@ -675,24 +682,24 @@ function dx() {
675
682
  for (ot in Me)
676
683
  se[ot] === void 0 && (se[ot] = Me[ot]);
677
684
  }
678
- if (ue || ke) {
685
+ if (ue || Re) {
679
686
  var tt = typeof I == "function" ? I.displayName || I.name || "Unknown" : I;
680
- ue && bt(se, tt), ke && kt(se, tt);
687
+ ue && bt(se, tt), Re && kt(se, tt);
681
688
  }
682
- return Pt(I, ue, ke, Je, Ee, We.current, se);
689
+ return Pt(I, ue, Re, Je, ke, We.current, se);
683
690
  }
684
691
  }
685
- var Ge = b.ReactCurrentOwner, Ce = b.ReactDebugCurrentFrame;
692
+ var Ge = b.ReactCurrentOwner, Ee = b.ReactDebugCurrentFrame;
686
693
  function qe(I) {
687
694
  if (I) {
688
695
  var Z = I._owner, de = ie(I.type, I._source, Z ? Z.type : null);
689
- Ce.setExtraStackFrame(de);
696
+ Ee.setExtraStackFrame(de);
690
697
  } else
691
- Ce.setExtraStackFrame(null);
698
+ Ee.setExtraStackFrame(null);
692
699
  }
693
700
  var zt;
694
701
  zt = !1;
695
- function te(I) {
702
+ function ne(I) {
696
703
  return typeof I == "object" && I !== null && I.$$typeof === t;
697
704
  }
698
705
  function we() {
@@ -732,8 +739,8 @@ Check the top-level render call using <` + de + ">.");
732
739
  if (xe[de])
733
740
  return;
734
741
  xe[de] = !0;
735
- var Ee = "";
736
- I && I._owner && I._owner !== Ge.current && (Ee = " It was passed a child from " + L(I._owner.type) + "."), qe(I), w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', de, Ee), qe(null);
742
+ var ke = "";
743
+ I && I._owner && I._owner !== Ge.current && (ke = " It was passed a child from " + L(I._owner.type) + "."), qe(I), w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', de, ke), qe(null);
737
744
  }
738
745
  }
739
746
  function Rt(I, Z) {
@@ -742,16 +749,16 @@ Check the top-level render call using <` + de + ">.");
742
749
  return;
743
750
  if (Et(I))
744
751
  for (var de = 0; de < I.length; de++) {
745
- var Ee = I[de];
746
- te(Ee) && Xe(Ee, Z);
752
+ var ke = I[de];
753
+ ne(ke) && Xe(ke, Z);
747
754
  }
748
- else if (te(I))
755
+ else if (ne(I))
749
756
  I._store && (I._store.validated = !0);
750
757
  else if (I) {
751
758
  var Je = x(I);
752
759
  if (typeof Je == "function" && Je !== I.entries)
753
760
  for (var ot = Je.call(I), se; !(se = ot.next()).done; )
754
- te(se.value) && Xe(se.value, Z);
761
+ ne(se.value) && Xe(se.value, Z);
755
762
  }
756
763
  }
757
764
  }
@@ -770,8 +777,8 @@ Check the top-level render call using <` + de + ">.");
770
777
  else
771
778
  return;
772
779
  if (de) {
773
- var Ee = L(Z);
774
- He(de, I.props, "prop", Ee, I);
780
+ var ke = L(Z);
781
+ He(de, I.props, "prop", ke, I);
775
782
  } else if (Z.PropTypes !== void 0 && !zt) {
776
783
  zt = !0;
777
784
  var Je = L(Z);
@@ -783,9 +790,9 @@ Check the top-level render call using <` + de + ">.");
783
790
  function At(I) {
784
791
  {
785
792
  for (var Z = Object.keys(I.props), de = 0; de < Z.length; de++) {
786
- var Ee = Z[de];
787
- if (Ee !== "children" && Ee !== "key") {
788
- qe(I), w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", Ee), qe(null);
793
+ var ke = Z[de];
794
+ if (ke !== "children" && ke !== "key") {
795
+ qe(I), w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", ke), qe(null);
789
796
  break;
790
797
  }
791
798
  }
@@ -793,24 +800,24 @@ Check the top-level render call using <` + de + ">.");
793
800
  }
794
801
  }
795
802
  var Ot = {};
796
- function Ae(I, Z, de, Ee, Je, ot) {
803
+ function Ae(I, Z, de, ke, Je, ot) {
797
804
  {
798
805
  var se = D(I);
799
806
  if (!se) {
800
807
  var ue = "";
801
808
  (I === void 0 || typeof I == "object" && I !== null && Object.keys(I).length === 0) && (ue += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
802
- var ke = at();
803
- ke ? ue += ke : ue += we();
809
+ var Re = at();
810
+ Re ? ue += Re : ue += we();
804
811
  var Me;
805
812
  I === null ? Me = "null" : Et(I) ? Me = "array" : I !== void 0 && I.$$typeof === t ? (Me = "<" + (L(I.type) || "Unknown") + " />", ue = " Did you accidentally export a JSX literal instead of a component?") : Me = typeof I, w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", Me, ue);
806
813
  }
807
- var tt = Te(I, Z, de, Je, ot);
814
+ var tt = Ce(I, Z, de, Je, ot);
808
815
  if (tt == null)
809
816
  return tt;
810
817
  if (se) {
811
818
  var xt = Z.children;
812
819
  if (xt !== void 0)
813
- if (Ee)
820
+ if (ke)
814
821
  if (Et(xt)) {
815
822
  for (var xr = 0; xr < xt.length; xr++)
816
823
  Rt(xt[xr], I);
@@ -3042,7 +3049,7 @@ function ew(e = {}) {
3042
3049
  threadId: $.threadId ?? null,
3043
3050
  headers: {}
3044
3051
  }, (async () => {
3045
- var X, re, U, O, Y, J, le, F, ne, ce, ie, ge, Ne, je, De, He, st, Et;
3052
+ var X, re, U, O, Y, J, le, F, te, ce, ie, ge, Te, je, De, He, st, Et;
3046
3053
  const q = (Ke) => {
3047
3054
  var Ue;
3048
3055
  try {
@@ -3062,13 +3069,13 @@ function ew(e = {}) {
3062
3069
  Ke = { Authorization: `Bearer ${r}` };
3063
3070
  else if (typeof window < "u") {
3064
3071
  const qe = window.__AUTH_TOKEN__, zt = ((X = window.localStorage) == null ? void 0 : X.getItem("authToken")) || null;
3065
- let te = null;
3072
+ let ne = null;
3066
3073
  try {
3067
3074
  const at = (re = window.localStorage) == null ? void 0 : re.getItem("chat-settings");
3068
- at && (te = ((U = JSON.parse(at)) == null ? void 0 : U.apiKey) || null);
3075
+ at && (ne = ((U = JSON.parse(at)) == null ? void 0 : U.apiKey) || null);
3069
3076
  } catch {
3070
3077
  }
3071
- const we = qe || zt || te || null;
3078
+ const we = qe || zt || ne || null;
3072
3079
  we && (Ke = { Authorization: `Bearer ${we}` });
3073
3080
  }
3074
3081
  } catch {
@@ -3081,8 +3088,8 @@ function ew(e = {}) {
3081
3088
  let Ue = {};
3082
3089
  if (typeof window < "u")
3083
3090
  try {
3084
- const Ce = (O = window.localStorage) == null ? void 0 : O.getItem("authSessionId");
3085
- Ce && (Ue = { "X-Session-Id": Ce });
3091
+ const Ee = (O = window.localStorage) == null ? void 0 : O.getItem("authSessionId");
3092
+ Ee && (Ue = { "X-Session-Id": Ee });
3086
3093
  } catch {
3087
3094
  }
3088
3095
  const Ye = {
@@ -3101,13 +3108,13 @@ function ew(e = {}) {
3101
3108
  credentials: a
3102
3109
  });
3103
3110
  if (R.current && (R.current.headers = Ye), !We.ok || !We.body) {
3104
- const Ce = await We.text().catch(() => "");
3111
+ const Ee = await We.text().catch(() => "");
3105
3112
  console.debug(
3106
3113
  "[use-chat] non-OK response",
3107
3114
  We.status,
3108
- Ce == null ? void 0 : Ce.slice(0, 500)
3115
+ Ee == null ? void 0 : Ee.slice(0, 500)
3109
3116
  );
3110
- const qe = `stream ${We.status}${Ce ? ": " + Ce : ""}`;
3117
+ const qe = `stream ${We.status}${Ee ? ": " + Ee : ""}`;
3111
3118
  throw (Y = k == null ? void 0 : k.onConnectionError) == null || Y.call(k, qe), _ = !0, G = "error", A = qe, new Error(qe);
3112
3119
  }
3113
3120
  w(!0);
@@ -3117,27 +3124,27 @@ function ew(e = {}) {
3117
3124
  let wt = 0, pt = null;
3118
3125
  const bt = () => {
3119
3126
  if (_t.length) {
3120
- const Ce = _t.join("");
3121
- _t = [], T.current && m((qe) => qe + Ce);
3127
+ const Ee = _t.join("");
3128
+ _t = [], T.current && m((qe) => qe + Ee);
3122
3129
  }
3123
3130
  pt = null;
3124
3131
  }, kt = () => {
3125
3132
  typeof window < "u" && pt == null && (pt = requestAnimationFrame(bt));
3126
3133
  };
3127
3134
  let Pt = Date.now();
3128
- const Te = setInterval(() => {
3129
- var Ce;
3135
+ const Ce = setInterval(() => {
3136
+ var Ee;
3130
3137
  if (Date.now() - Pt > 18e5) {
3131
3138
  const qe = "Stream idle timeout";
3132
- d(qe), G = "error", A = qe, K.abort(), (Ce = k == null ? void 0 : k.onError) == null || Ce.call(k, qe);
3139
+ d(qe), G = "error", A = qe, K.abort(), (Ee = k == null ? void 0 : k.onError) == null || Ee.call(k, qe);
3133
3140
  }
3134
3141
  }, 5e3), Ge = 1024 * 1024;
3135
3142
  try {
3136
- const Ce = We.headers.get("X-Thread-Id") || We.headers.get("x-thread-id"), qe = We.headers.get("X-Thread-Created") || We.headers.get("x-thread-created"), zt = Ce ?? null, te = String(qe ?? "").toLowerCase() === "true";
3143
+ const Ee = We.headers.get("X-Thread-Id") || We.headers.get("x-thread-id"), qe = We.headers.get("X-Thread-Created") || We.headers.get("x-thread-created"), zt = Ee ?? null, ne = String(qe ?? "").toLowerCase() === "true";
3137
3144
  for (R.current && !R.current.threadId && (R.current = {
3138
3145
  ...R.current,
3139
3146
  threadId: zt
3140
- }), (J = k == null ? void 0 : k.onOpen) == null || J.call(k, { threadId: zt, created: te }); ; ) {
3147
+ }), (J = k == null ? void 0 : k.onOpen) == null || J.call(k, { threadId: zt, created: ne }); ; ) {
3141
3148
  const { value: we, done: at } = await vt.read();
3142
3149
  if (at) break;
3143
3150
  ut += Mt.decode(we, { stream: !0 }), ut.length > Ge && (ut = "", console.warn("Stream buffer reset: exceeded 1MB"));
@@ -3238,10 +3245,10 @@ function ew(e = {}) {
3238
3245
  v(Ae.checkpointId);
3239
3246
  else if (Ae.type === "error") {
3240
3247
  const et = Ae;
3241
- if (d(et.message), G = "error", A = et.message, et.error_type === "auth_error" || et.code === "TOKEN_EXPIRED" || ((ne = et.message) == null ? void 0 : ne.includes("token")) || ((ce = et.message) == null ? void 0 : ce.includes("401")) || ((ie = et.message) == null ? void 0 : ie.includes("unauthorized")) || ((ge = et.message) == null ? void 0 : ge.includes("Unauthorized"))) {
3248
+ if (d(et.message), G = "error", A = et.message, et.error_type === "auth_error" || et.code === "TOKEN_EXPIRED" || ((te = et.message) == null ? void 0 : te.includes("token")) || ((ce = et.message) == null ? void 0 : ce.includes("401")) || ((ie = et.message) == null ? void 0 : ie.includes("unauthorized")) || ((ge = et.message) == null ? void 0 : ge.includes("Unauthorized"))) {
3242
3249
  console.error("[use-chat] Auth error detected:", et.message);
3243
3250
  try {
3244
- (Ne = k == null ? void 0 : k.onAuthError) == null || Ne.call(k, et.message);
3251
+ (Te = k == null ? void 0 : k.onAuthError) == null || Te.call(k, et.message);
3245
3252
  } catch (nn) {
3246
3253
  console.warn("[use-chat] onAuthError handler failed", nn);
3247
3254
  }
@@ -3251,11 +3258,11 @@ function ew(e = {}) {
3251
3258
  }
3252
3259
  }
3253
3260
  bt(), G === null && !K.signal.aborted && (G = "complete");
3254
- } catch (Ce) {
3255
- if (Ce.name === "AbortError")
3261
+ } catch (Ee) {
3262
+ if (Ee.name === "AbortError")
3256
3263
  G = G ?? "aborted";
3257
3264
  else {
3258
- const qe = Ce.message || String(Ce);
3265
+ const qe = Ee.message || String(Ee);
3259
3266
  G = "error", A = qe, d(qe), (je = k == null ? void 0 : k.onError) == null || je.call(k, qe);
3260
3267
  }
3261
3268
  } finally {
@@ -3265,7 +3272,7 @@ function ew(e = {}) {
3265
3272
  } finally {
3266
3273
  (De = vt.releaseLock) == null || De.call(vt);
3267
3274
  }
3268
- pt !== null && typeof window < "u" && window.cancelAnimationFrame(pt), clearInterval(Te);
3275
+ pt !== null && typeof window < "u" && window.cancelAnimationFrame(pt), clearInterval(Ce);
3269
3276
  }
3270
3277
  } catch (Ke) {
3271
3278
  if (Ke.name === "AbortError")
@@ -4060,14 +4067,14 @@ function yw({
4060
4067
  async (F) => {
4061
4068
  var ce, ie;
4062
4069
  if (!F.threadId) return;
4063
- const ne = F.threadId;
4070
+ const te = F.threadId;
4064
4071
  (ce = F.onStart) == null || ce.call(F), F.setLoading(!0);
4065
4072
  try {
4066
- await F.action(ne);
4073
+ await F.action(te);
4067
4074
  } catch (ge) {
4068
- if (L.current === ne) {
4069
- const Ne = String(ge);
4070
- (ie = F.handleError) == null || ie.call(F, Ne), r == null || r(Ne);
4075
+ if (L.current === te) {
4076
+ const Te = String(ge);
4077
+ (ie = F.handleError) == null || ie.call(F, Te), r == null || r(Te);
4071
4078
  }
4072
4079
  throw ge;
4073
4080
  } finally {
@@ -4076,28 +4083,28 @@ function yw({
4076
4083
  },
4077
4084
  [r]
4078
4085
  ), A = me(
4079
- async (F, ne) => {
4086
+ async (F, te) => {
4080
4087
  if (!F) return;
4081
- const ce = `${F}:${ne ?? "latest"}`, ie = K.current.get(ce);
4088
+ const ce = `${F}:${te ?? "latest"}`, ie = K.current.get(ce);
4082
4089
  if (ie)
4083
4090
  return ie;
4084
4091
  const ge = G({
4085
4092
  threadId: F,
4086
4093
  setLoading: T,
4087
4094
  onStart: () => z(null),
4088
- handleError: (Ne) => z(Ne),
4089
- action: async (Ne) => {
4095
+ handleError: (Te) => z(Te),
4096
+ action: async (Te) => {
4090
4097
  const je = await e.getStateHistory({
4091
- threadId: Ne,
4092
- checkpointId: ne ?? void 0
4098
+ threadId: Te,
4099
+ checkpointId: te ?? void 0
4093
4100
  });
4094
- if (L.current !== Ne) {
4101
+ if (L.current !== Te) {
4095
4102
  console.log(
4096
- `[useThreadHistoryState] Thread changed during load (was ${Ne}, now ${L.current}), discarding stale data`
4103
+ `[useThreadHistoryState] Thread changed during load (was ${Te}, now ${L.current}), discarding stale data`
4097
4104
  );
4098
4105
  return;
4099
4106
  }
4100
- const { checkpoints: De } = Yn(je), He = De.find((st) => st.messages && st.messages.length > 0) ?? (ne ? De.find((st) => st.checkpointId === ne) : null) ?? De[0];
4107
+ const { checkpoints: De } = Yn(je), He = De.find((st) => st.messages && st.messages.length > 0) ?? (te ? De.find((st) => st.checkpointId === te) : null) ?? De[0];
4101
4108
  t((He == null ? void 0 : He.messages) ?? [], {
4102
4109
  checkpointId: (He == null ? void 0 : He.checkpointId) ?? null,
4103
4110
  checkpointNs: (He == null ? void 0 : He.checkpointNs) ?? null
@@ -4114,10 +4121,10 @@ function yw({
4114
4121
  },
4115
4122
  [e, t, G]
4116
4123
  ), _ = me(
4117
- async (F, ne) => {
4124
+ async (F, te) => {
4118
4125
  $.current = F;
4119
4126
  try {
4120
- await A(F, ne);
4127
+ await A(F, te);
4121
4128
  } finally {
4122
4129
  $.current === F && ($.current = null);
4123
4130
  }
@@ -4129,21 +4136,21 @@ function yw({
4129
4136
  W.current = F;
4130
4137
  }, []), re = me(
4131
4138
  (F) => {
4132
- const ne = F.threadId ?? L.current;
4133
- if (!ne || L.current && L.current !== ne)
4139
+ const te = F.threadId ?? L.current;
4140
+ if (!te || L.current && L.current !== te)
4134
4141
  return;
4135
4142
  const { checkpoints: ce } = Yn(F);
4136
4143
  if (!ce.length)
4137
4144
  return;
4138
- const ie = ce.find((ge) => ge.messages && ge.messages.length > 0) ?? ce.find((ge) => !!ge.checkpointId) ?? ce[0];
4139
- t((ie == null ? void 0 : ie.messages) ?? [], {
4145
+ const ie = ce.find((Te) => Te.messages && Te.messages.length > 0) ?? ce.find((Te) => !!Te.checkpointId) ?? ce[0], ge = W.current === te;
4146
+ !c && !ge && t((ie == null ? void 0 : ie.messages) ?? [], {
4140
4147
  checkpointId: (ie == null ? void 0 : ie.checkpointId) ?? null,
4141
4148
  checkpointNs: (ie == null ? void 0 : ie.checkpointNs) ?? null
4142
- }), m(F), w(!!(ie != null && ie.nextCursor)), C((ie == null ? void 0 : ie.nextCursor) ?? null), k.current = `${ne}:latest`, V.current = null, W.current = null;
4149
+ }), m(F), w(!!(ie != null && ie.nextCursor)), C((ie == null ? void 0 : ie.nextCursor) ?? null), k.current = `${te}:latest`, V.current = null, W.current === te && (W.current = null);
4143
4150
  },
4144
- [t]
4151
+ [t, c]
4145
4152
  ), U = me(
4146
- async (F, ne) => {
4153
+ async (F, te) => {
4147
4154
  const ce = L.current;
4148
4155
  await G({
4149
4156
  threadId: ce,
@@ -4152,7 +4159,7 @@ function yw({
4152
4159
  const ge = await e.getStateHistory({
4153
4160
  threadId: ie,
4154
4161
  checkpointId: F,
4155
- checkpointNs: ne ?? void 0
4162
+ checkpointNs: te ?? void 0
4156
4163
  });
4157
4164
  if (L.current !== ie) {
4158
4165
  console.log(
@@ -4160,11 +4167,11 @@ function yw({
4160
4167
  );
4161
4168
  return;
4162
4169
  }
4163
- const { checkpoints: Ne } = Yn(ge), je = Ne.find(
4164
- (De) => De.checkpointId === F && (ne ? De.checkpointNs === ne : !0)
4170
+ const { checkpoints: Te } = Yn(ge), je = Te.find(
4171
+ (De) => De.checkpointId === F && (te ? De.checkpointNs === te : !0)
4165
4172
  );
4166
4173
  if (!je) {
4167
- console.warn("[useThreadHistoryState] Requested checkpoint not found:", { checkpointId: F, checkpointNs: ne });
4174
+ console.warn("[useThreadHistoryState] Requested checkpoint not found:", { checkpointId: F, checkpointNs: te });
4168
4175
  return;
4169
4176
  }
4170
4177
  m(ge), t(je.messages ?? [], {
@@ -4177,10 +4184,10 @@ function yw({
4177
4184
  },
4178
4185
  [e, t, G]
4179
4186
  ), O = me(
4180
- (F, ne) => {
4187
+ (F, te) => {
4181
4188
  t(d(), {
4182
4189
  checkpointId: F ?? null,
4183
- checkpointNs: ne ?? null
4190
+ checkpointNs: te ?? null
4184
4191
  });
4185
4192
  },
4186
4193
  [d, t]
@@ -4191,12 +4198,12 @@ function yw({
4191
4198
  !F || !y || await G({
4192
4199
  threadId: F,
4193
4200
  setLoading: R,
4194
- action: async (ne) => {
4201
+ action: async (te) => {
4195
4202
  const ce = await e.getStateHistory({
4196
- threadId: ne,
4203
+ threadId: te,
4197
4204
  checkpointId: y
4198
4205
  });
4199
- if (L.current !== ne)
4206
+ if (L.current !== te)
4200
4207
  return;
4201
4208
  const { checkpoints: ie } = Yn(ce);
4202
4209
  if (ie.length > 0) {
@@ -4226,14 +4233,14 @@ function yw({
4226
4233
  return;
4227
4234
  N.current = o;
4228
4235
  const F = !j.current && !!a && o === s;
4229
- let ne;
4230
- F && a ? (ne = a, j.current = !0, console.log(
4236
+ let te;
4237
+ F && a ? (te = a, j.current = !0, console.log(
4231
4238
  "[useThreadHistoryState] Loading thread with checkpoint:",
4232
- ne,
4239
+ te,
4233
4240
  i ? `(ns: ${i})` : ""
4234
4241
  )) : console.log("[useThreadHistoryState] Loading thread with latest checkpoint");
4235
- const ce = `${o}:${ne ?? "latest"}`;
4236
- k.current !== ce && _(o, ne);
4242
+ const ce = `${o}:${te ?? "latest"}`;
4243
+ k.current !== ce && _(o, te);
4237
4244
  }, [
4238
4245
  l,
4239
4246
  o,
@@ -4584,24 +4591,24 @@ function Iw({
4584
4591
  content: O,
4585
4592
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
4586
4593
  }, J ? S(F, Y) : S(F));
4587
- const ne = X ? q : F ? [F] : [], ce = {
4594
+ const te = X ? q : F ? [F] : [], ce = {
4588
4595
  ..._,
4589
4596
  ...U.length ? { files_info: U } : {}
4590
4597
  };
4591
- ne.length ? ce.messages = ne : "messages" in ce || (ce.messages = []);
4598
+ te.length ? ce.messages = te : "messages" in ce || (ce.messages = []);
4592
4599
  let ie = (j == null ? void 0 : j.checkpointId) ?? g.id ?? void 0, ge = (j == null ? void 0 : j.checkpointNs) ?? g.namespace ?? void 0;
4593
4600
  if (J && Y) {
4594
4601
  const je = kw(x, Y);
4595
4602
  ie = je.checkpointId, ge = je.checkpointNs ?? void 0;
4596
4603
  }
4597
- const Ne = {
4604
+ const Te = {
4598
4605
  threadId: k,
4599
4606
  payload: ce,
4600
4607
  checkpointId: ie,
4601
4608
  checkpointNs: ge,
4602
4609
  edit: !!(j != null && j.edit)
4603
4610
  };
4604
- B(Ne);
4611
+ B(Te);
4605
4612
  },
4606
4613
  [g, f, w, S, B, x]
4607
4614
  ), W = Ze(
@@ -6719,7 +6726,7 @@ var Gi = "PopperContent", [Sy, Ty] = Ud(Gi), Gd = h.forwardRef(
6719
6726
  updatePositionStrategy: f = "optimized",
6720
6727
  onPlaced: v,
6721
6728
  ...g
6722
- } = e, x = Wd(Gi, n), [b, w] = h.useState(null), y = ze(t, (ne) => w(ne)), [C, S] = h.useState(null), T = Hd(C), E = (T == null ? void 0 : T.width) ?? 0, R = (T == null ? void 0 : T.height) ?? 0, P = r + (s !== "center" ? "-" + s : ""), D = typeof d == "number" ? d : { top: 0, right: 0, bottom: 0, left: 0, ...d }, B = Array.isArray(c) ? c : [c], z = B.length > 0, L = {
6729
+ } = e, x = Wd(Gi, n), [b, w] = h.useState(null), y = ze(t, (te) => w(te)), [C, S] = h.useState(null), T = Hd(C), E = (T == null ? void 0 : T.width) ?? 0, R = (T == null ? void 0 : T.height) ?? 0, P = r + (s !== "center" ? "-" + s : ""), D = typeof d == "number" ? d : { top: 0, right: 0, bottom: 0, left: 0, ...d }, B = Array.isArray(c) ? c : [c], z = B.length > 0, L = {
6723
6730
  padding: D,
6724
6731
  boundary: B.filter(Ey),
6725
6732
  // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
@@ -6728,7 +6735,7 @@ var Gi = "PopperContent", [Sy, Ty] = Ud(Gi), Gd = h.forwardRef(
6728
6735
  // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
6729
6736
  strategy: "fixed",
6730
6737
  placement: P,
6731
- whileElementsMounted: (...ne) => ey(...ne, {
6738
+ whileElementsMounted: (...te) => ey(...te, {
6732
6739
  animationFrame: f === "always"
6733
6740
  }),
6734
6741
  elements: {
@@ -6745,9 +6752,9 @@ var Gi = "PopperContent", [Sy, Ty] = Ud(Gi), Gd = h.forwardRef(
6745
6752
  l && my({ ...L }),
6746
6753
  gy({
6747
6754
  ...L,
6748
- apply: ({ elements: ne, rects: ce, availableWidth: ie, availableHeight: ge }) => {
6749
- const { width: Ne, height: je } = ce.reference, De = ne.floating.style;
6750
- De.setProperty("--radix-popper-available-width", `${ie}px`), De.setProperty("--radix-popper-available-height", `${ge}px`), De.setProperty("--radix-popper-anchor-width", `${Ne}px`), De.setProperty("--radix-popper-anchor-height", `${je}px`);
6755
+ apply: ({ elements: te, rects: ce, availableWidth: ie, availableHeight: ge }) => {
6756
+ const { width: Te, height: je } = ce.reference, De = te.floating.style;
6757
+ De.setProperty("--radix-popper-available-width", `${ie}px`), De.setProperty("--radix-popper-available-height", `${ge}px`), De.setProperty("--radix-popper-anchor-width", `${Te}px`), De.setProperty("--radix-popper-anchor-height", `${je}px`);
6751
6758
  }
6752
6759
  }),
6753
6760
  C && vy({ element: C, padding: i }),
@@ -8718,7 +8725,7 @@ function dt(e = cp) {
8718
8725
  e(t, r) || (t = r, n(r));
8719
8726
  };
8720
8727
  }
8721
- function Ie(e) {
8728
+ function Ne(e) {
8722
8729
  return (t) => (n) => {
8723
8730
  e(n) && t(n);
8724
8731
  };
@@ -8876,7 +8883,7 @@ function Ct(...e) {
8876
8883
  }
8877
8884
  };
8878
8885
  }
8879
- function Re(e, t = cp) {
8886
+ function Ie(e, t = cp) {
8880
8887
  return Q(e, dt(t));
8881
8888
  }
8882
8889
  function ii(...e) {
@@ -9391,7 +9398,7 @@ const mT = {
9391
9398
  be(
9392
9399
  Q(
9393
9400
  l,
9394
- Ie((S) => S.length > 0),
9401
+ Ne((S) => S.length > 0),
9395
9402
  Be(g, f),
9396
9403
  pe(([S, T, E]) => {
9397
9404
  const R = S.reduce((P, D, B) => Qt(P, D, fo(D, T.offsetTree, E) || B), kr());
@@ -9407,7 +9414,7 @@ const mT = {
9407
9414
  Q(
9408
9415
  r,
9409
9416
  Be(g),
9410
- Ie(([S, { lastIndex: T }]) => S < T),
9417
+ Ne(([S, { lastIndex: T }]) => S < T),
9411
9418
  pe(([S, { lastIndex: T, lastSize: E }]) => [
9412
9419
  {
9413
9420
  endIndex: T,
@@ -9428,7 +9435,7 @@ const mT = {
9428
9435
  be(
9429
9436
  Q(
9430
9437
  d,
9431
- Ie((S) => S !== void 0 && lt(yt(g).sizeTree)),
9438
+ Ne((S) => S !== void 0 && lt(yt(g).sizeTree)),
9432
9439
  pe((S) => [{ endIndex: 0, size: S, startIndex: 0 }])
9433
9440
  ),
9434
9441
  n
@@ -9634,7 +9641,7 @@ const bp = Qe(
9634
9641
  ), be(
9635
9642
  Q(
9636
9643
  Ct(o, t, r),
9637
- Ie(([l, c]) => Zs(c)),
9644
+ Ne(([l, c]) => Zs(c)),
9638
9645
  pe(([l, c, d]) => mn(c.groupOffsetTree, Math.max(l - d, 0), "v")[0]),
9639
9646
  dt(),
9640
9647
  pe((l) => [l])
@@ -9648,7 +9655,7 @@ const bp = Qe(
9648
9655
  const t = oe(!1), n = tn(
9649
9656
  Q(
9650
9657
  t,
9651
- Ie((r) => r),
9658
+ Ne((r) => r),
9652
9659
  dt()
9653
9660
  )
9654
9661
  );
@@ -9752,7 +9759,7 @@ const Ao = Qe(
9752
9759
  Q(
9753
9760
  a,
9754
9761
  Be(l),
9755
- Ie(([d, p]) => !!p),
9762
+ Ne(([d, p]) => !!p),
9756
9763
  bn(!1)
9757
9764
  ),
9758
9765
  i
@@ -9760,7 +9767,7 @@ const Ao = Qe(
9760
9767
  Q(
9761
9768
  a,
9762
9769
  Be(l),
9763
- Ie(([d, p]) => !!p),
9770
+ Ne(([d, p]) => !!p),
9764
9771
  bn(!1)
9765
9772
  ),
9766
9773
  c
@@ -9768,7 +9775,7 @@ const Ao = Qe(
9768
9775
  Q(
9769
9776
  Ct(t, a),
9770
9777
  Be(i, n, e, c),
9771
- Ie(([[, d], p, { sizeTree: m }, f, v]) => d && (!lt(m) || cl(f)) && !p && !v),
9778
+ Ne(([[, d], p, { sizeTree: m }, f, v]) => d && (!lt(m) || cl(f)) && !p && !v),
9772
9779
  Be(l)
9773
9780
  ),
9774
9781
  ([, d]) => {
@@ -9804,7 +9811,7 @@ const po = "up", Zr = "down", wT = "none", bT = {
9804
9811
  }, yT = 0, jo = Qe(([{ footerHeight: e, headerHeight: t, scrollBy: n, scrollContainerState: r, scrollTop: o, viewportHeight: s }]) => {
9805
9812
  const a = oe(!1), i = oe(!0), l = Ve(), c = Ve(), d = oe(4), p = oe(yT), m = Ft(
9806
9813
  Q(
9807
- ii(Q(Re(o), ir(1), bn(!0)), Q(Re(o), ir(1), bn(!1), Qc(100))),
9814
+ ii(Q(Ie(o), ir(1), bn(!0)), Q(Ie(o), ir(1), bn(!1), Qc(100))),
9808
9815
  dt()
9809
9816
  ),
9810
9817
  !1
@@ -9814,7 +9821,7 @@ const po = "up", Zr = "down", wT = "none", bT = {
9814
9821
  );
9815
9822
  be(
9816
9823
  Q(
9817
- Ct(Re(o), Re(p)),
9824
+ Ct(Ie(o), Ie(p)),
9818
9825
  pe(([w, y]) => w <= y),
9819
9826
  dt()
9820
9827
  ),
@@ -9822,7 +9829,7 @@ const po = "up", Zr = "down", wT = "none", bT = {
9822
9829
  ), be(Q(i, Nn(50)), c);
9823
9830
  const v = tn(
9824
9831
  Q(
9825
- Ct(r, Re(s), Re(t), Re(e), Re(d)),
9832
+ Ct(r, Ie(s), Ie(t), Ie(e), Ie(d)),
9826
9833
  Tn((w, [{ scrollHeight: y, scrollTop: C }, S, T, E, R]) => {
9827
9834
  const P = C + S - y > -R, D = {
9828
9835
  scrollHeight: y,
@@ -9876,7 +9883,7 @@ const po = "up", Zr = "down", wT = "none", bT = {
9876
9883
  },
9877
9884
  { changed: !1, jump: 0, scrollHeight: 0, scrollTop: 0 }
9878
9885
  ),
9879
- Ie((w) => w.changed),
9886
+ Ne((w) => w.changed),
9880
9887
  pe((w) => w.jump)
9881
9888
  ),
9882
9889
  0
@@ -9906,7 +9913,7 @@ const po = "up", Zr = "down", wT = "none", bT = {
9906
9913
  return be(
9907
9914
  Q(
9908
9915
  m,
9909
- Ie((w) => !w),
9916
+ Ne((w) => !w),
9910
9917
  bn(0)
9911
9918
  ),
9912
9919
  b
@@ -9915,7 +9922,7 @@ const po = "up", Zr = "down", wT = "none", bT = {
9915
9922
  o,
9916
9923
  Nn(100),
9917
9924
  Be(m),
9918
- Ie(([w, y]) => !!y),
9925
+ Ne(([w, y]) => !!y),
9919
9926
  Tn(([w, y], [C]) => [y, C], [0, 0]),
9920
9927
  pe(([w, y]) => y - w)
9921
9928
  ),
@@ -9946,15 +9953,15 @@ const gl = Qe(
9946
9953
  const s = Ve(), a = oe(0), i = oe(0), l = oe(0), c = Ft(
9947
9954
  Q(
9948
9955
  Ct(
9949
- Re(r),
9950
- Re(o),
9951
- Re(n),
9952
- Re(s, uo),
9953
- Re(l),
9954
- Re(a),
9955
- Re(t),
9956
- Re(e),
9957
- Re(i)
9956
+ Ie(r),
9957
+ Ie(o),
9958
+ Ie(n),
9959
+ Ie(s, uo),
9960
+ Ie(l),
9961
+ Ie(a),
9962
+ Ie(t),
9963
+ Ie(e),
9964
+ Ie(i)
9958
9965
  ),
9959
9966
  pe(
9960
9967
  ([
@@ -9977,7 +9984,7 @@ const gl = Qe(
9977
9984
  ] : null;
9978
9985
  }
9979
9986
  ),
9980
- Ie((d) => d != null),
9987
+ Ne((d) => d != null),
9981
9988
  dt(uo)
9982
9989
  ),
9983
9990
  [0, 0]
@@ -10097,17 +10104,17 @@ const mr = Qe(
10097
10104
  Ct(
10098
10105
  f,
10099
10106
  v,
10100
- Re(l, uo),
10101
- Re(o),
10102
- Re(r),
10103
- Re(c),
10107
+ Ie(l, uo),
10108
+ Ie(o),
10109
+ Ie(r),
10110
+ Ie(c),
10104
10111
  d,
10105
- Re(g),
10106
- Re(t),
10107
- Re(n),
10112
+ Ie(g),
10113
+ Ie(t),
10114
+ Ie(n),
10108
10115
  e
10109
10116
  ),
10110
- Ie(([T, E, , R, , , , , , , P]) => {
10117
+ Ne(([T, E, , R, , , , , , , P]) => {
10111
10118
  const D = P && P.length !== R;
10112
10119
  return T && !E && !D;
10113
10120
  }),
@@ -10174,7 +10181,7 @@ const mr = Qe(
10174
10181
  }
10175
10182
  ),
10176
10183
  //@ts-expect-error filter needs to be fixed
10177
- Ie((T) => T !== null),
10184
+ Ne((T) => T !== null),
10178
10185
  dt()
10179
10186
  ),
10180
10187
  Ma
@@ -10182,7 +10189,7 @@ const mr = Qe(
10182
10189
  be(
10183
10190
  Q(
10184
10191
  e,
10185
- Ie(cl),
10192
+ Ne(cl),
10186
10193
  pe((T) => T == null ? void 0 : T.length)
10187
10194
  ),
10188
10195
  o
@@ -10208,9 +10215,9 @@ const mr = Qe(
10208
10215
  const y = tn(
10209
10216
  Q(
10210
10217
  w,
10211
- Ie(({ items: T }) => T.length > 0),
10218
+ Ne(({ items: T }) => T.length > 0),
10212
10219
  Be(o, e),
10213
- Ie(([{ items: T }, E]) => T[T.length - 1].originalIndex === E - 1),
10220
+ Ne(([{ items: T }, E]) => T[T.length - 1].originalIndex === E - 1),
10214
10221
  pe(([, T, E]) => [T - 1, E]),
10215
10222
  dt(uo),
10216
10223
  pe(([T]) => T)
@@ -10219,14 +10226,14 @@ const mr = Qe(
10219
10226
  Q(
10220
10227
  w,
10221
10228
  Nn(200),
10222
- Ie(({ items: T, topItems: E }) => T.length > 0 && T[0].originalIndex === E.length),
10229
+ Ne(({ items: T, topItems: E }) => T.length > 0 && T[0].originalIndex === E.length),
10223
10230
  pe(({ items: T }) => T[0].index),
10224
10231
  dt()
10225
10232
  )
10226
10233
  ), S = tn(
10227
10234
  Q(
10228
10235
  w,
10229
- Ie(({ items: T }) => T.length > 0),
10236
+ Ne(({ items: T }) => T.length > 0),
10230
10237
  pe(({ items: T }) => {
10231
10238
  let E = 0, R = T.length - 1;
10232
10239
  for (; T[E].type === "group" && E < R; )
@@ -10263,7 +10270,7 @@ const mr = Qe(
10263
10270
  ),
10264
10271
  0
10265
10272
  );
10266
- return be(Re(a), s), { totalListHeight: a, totalListHeightChanged: s };
10273
+ return be(Ie(a), s), { totalListHeight: a, totalListHeightChanged: s };
10267
10274
  },
10268
10275
  ft(Ut, mr),
10269
10276
  { singleton: !0 }
@@ -10272,7 +10279,7 @@ const mr = Qe(
10272
10279
  const n = oe(!1), r = Ft(
10273
10280
  Q(
10274
10281
  Ct(n, e, t),
10275
- Ie(([o]) => o),
10282
+ Ne(([o]) => o),
10276
10283
  pe(([, o, s]) => Math.max(0, o - s)),
10277
10284
  Nn(0),
10278
10285
  dt()
@@ -10314,7 +10321,7 @@ const mr = Qe(
10314
10321
  return N ? E && fn(
10315
10322
  Q(
10316
10323
  a,
10317
- Ie((V) => !V),
10324
+ Ne((V) => !V),
10318
10325
  // skips the initial publish of false, and the cleanup call.
10319
10326
  // but if scrollingInProgress is true, we skip the initial publish.
10320
10327
  ir(yt(a) ? 1 : 2)
@@ -10322,7 +10329,7 @@ const mr = Qe(
10322
10329
  E
10323
10330
  ) : E && E(), N;
10324
10331
  }),
10325
- Ie((p) => p !== null)
10332
+ Ne((p) => p !== null)
10326
10333
  ),
10327
10334
  c
10328
10335
  ), {
@@ -10358,13 +10365,13 @@ const ET = (e, t) => typeof e == "function" ? iu(e(t)) : t && iu(e), kT = Qe(
10358
10365
  }
10359
10366
  rt(
10360
10367
  Q(
10361
- Ct(Q(Re(t), ir(1)), l),
10362
- Be(Re(v), s, i, p),
10368
+ Ct(Q(Ie(t), ir(1)), l),
10369
+ Be(Ie(v), s, i, p),
10363
10370
  pe(([[S, T], E, R, P, D]) => {
10364
10371
  let B = T && P, z = "auto";
10365
10372
  return B && (z = ET(E, R || D), B = B && !!z), { followOutputBehavior: z, shouldFollow: B, totalCount: S };
10366
10373
  }),
10367
- Ie(({ shouldFollow: S }) => S)
10374
+ Ne(({ shouldFollow: S }) => S)
10368
10375
  ),
10369
10376
  ({ followOutputBehavior: S, totalCount: T }) => {
10370
10377
  x && (x(), x = null), yt(n) ? requestAnimationFrame(() => {
@@ -10382,13 +10389,13 @@ const ET = (e, t) => typeof e == "function" ? iu(e(t)) : t && iu(e), kT = Qe(
10382
10389
  }
10383
10390
  rt(
10384
10391
  Q(
10385
- Ct(Re(v), t, c),
10386
- Ie(([S, , T]) => S && T),
10392
+ Ct(Ie(v), t, c),
10393
+ Ne(([S, , T]) => S && T),
10387
10394
  Tn(
10388
10395
  ({ value: S }, [, T]) => ({ refreshed: S === T, value: T }),
10389
10396
  { refreshed: !1, value: 0 }
10390
10397
  ),
10391
- Ie(({ refreshed: S }) => S),
10398
+ Ne(({ refreshed: S }) => S),
10392
10399
  Be(v, t)
10393
10400
  ),
10394
10401
  ([, S]) => {
@@ -10396,28 +10403,28 @@ const ET = (e, t) => typeof e == "function" ? iu(e(t)) : t && iu(e), kT = Qe(
10396
10403
  }
10397
10404
  ), rt(g, () => {
10398
10405
  w(yt(v) !== !1);
10399
- }), rt(Ct(Re(v), o), ([S, T]) => {
10406
+ }), rt(Ct(Ie(v), o), ([S, T]) => {
10400
10407
  S && !T.atBottom && T.notAtBottomBecause === "VIEWPORT_HEIGHT_DECREASING" && b("auto");
10401
10408
  });
10402
10409
  const y = oe(null), C = Ve();
10403
10410
  return be(
10404
10411
  ii(
10405
10412
  Q(
10406
- Re(r),
10413
+ Ie(r),
10407
10414
  pe((S) => {
10408
10415
  var T;
10409
10416
  return (T = S == null ? void 0 : S.length) != null ? T : 0;
10410
10417
  })
10411
10418
  ),
10412
- Q(Re(t))
10419
+ Q(Ie(t))
10413
10420
  ),
10414
10421
  C
10415
10422
  ), rt(
10416
10423
  Q(
10417
10424
  Ct(Q(C, ir(1)), l),
10418
- Be(Re(y), i, p, m),
10425
+ Be(Ie(y), i, p, m),
10419
10426
  pe(([[S, T], E, R, P, D]) => T && R && (E == null ? void 0 : E({ context: D, totalCount: S, scrollingInProgress: P }))),
10420
- Ie((S) => !!S),
10427
+ Ne((S) => !!S),
10421
10428
  Nn(0)
10422
10429
  ),
10423
10430
  (S) => {
@@ -10445,7 +10452,7 @@ const ET = (e, t) => typeof e == "function" ? iu(e(t)) : t && iu(e), kT = Qe(
10445
10452
  Q(
10446
10453
  i,
10447
10454
  Be(s),
10448
- Ie(([, l]) => l !== 0),
10455
+ Ne(([, l]) => l !== 0),
10449
10456
  Be(o, r, t, n, e),
10450
10457
  pe(([[, l], c, d, p, m, f = []]) => Tp(l, c, d, p, m, f))
10451
10458
  ),
@@ -10460,7 +10467,7 @@ const ET = (e, t) => typeof e == "function" ? iu(e(t)) : t && iu(e), kT = Qe(
10460
10467
  Q(
10461
10468
  e,
10462
10469
  Be(r),
10463
- Ie(([, o]) => o !== 0),
10470
+ Ne(([, o]) => o !== 0),
10464
10471
  pe(([, o]) => ({ top: o }))
10465
10472
  ),
10466
10473
  (o) => {
@@ -10468,7 +10475,7 @@ const ET = (e, t) => typeof e == "function" ? iu(e(t)) : t && iu(e), kT = Qe(
10468
10475
  Q(
10469
10476
  n,
10470
10477
  ir(1),
10471
- Ie((s) => s.items.length > 1)
10478
+ Ne((s) => s.items.length > 1)
10472
10479
  ),
10473
10480
  () => {
10474
10481
  requestAnimationFrame(() => {
@@ -10490,7 +10497,7 @@ const ET = (e, t) => typeof e == "function" ? iu(e(t)) : t && iu(e), kT = Qe(
10490
10497
  Q(
10491
10498
  e,
10492
10499
  Be(r, t, n),
10493
- Ie(([o, s]) => !!s),
10500
+ Ne(([o, s]) => !!s),
10494
10501
  pe(([o, s, a, i]) => {
10495
10502
  const { enter: l, exit: c } = s;
10496
10503
  if (a) {
@@ -10562,11 +10569,11 @@ const ET = (e, t) => typeof e == "function" ? iu(e(t)) : t && iu(e), kT = Qe(
10562
10569
  const C = fT(v.sizeTree);
10563
10570
  x && b !== null && w !== null && (g = b.scrollTop - w.offsetTop), g -= y, f({ ranges: C, scrollTop: g });
10564
10571
  }
10565
- ), be(Q(d, Ie(cl), pe(AT)), o), be(
10572
+ ), be(Q(d, Ne(cl), pe(AT)), o), be(
10566
10573
  Q(
10567
10574
  s,
10568
10575
  Be(d),
10569
- Ie(([, f]) => f !== void 0),
10576
+ Ne(([, f]) => f !== void 0),
10570
10577
  dt(),
10571
10578
  pe(([, f]) => f.ranges)
10572
10579
  ),
@@ -10586,7 +10593,7 @@ const jT = Qe(([{ topItemsIndexes: e }]) => {
10586
10593
  return be(
10587
10594
  Q(
10588
10595
  t,
10589
- Ie((n) => n >= 0),
10596
+ Ne((n) => n >= 0),
10590
10597
  pe((n) => Array.from({ length: n }).map((r, o) => o))
10591
10598
  ),
10592
10599
  e
@@ -10617,9 +10624,9 @@ const _T = Ip(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
10617
10624
  },
10618
10625
  [0, [], 0, 0]
10619
10626
  ),
10620
- Ie(([b]) => b !== 0),
10627
+ Ne(([b]) => b !== 0),
10621
10628
  Be(r, i, n, o, f, v),
10622
- Ie(([, b, w, y, , , C]) => !C && !y && b !== 0 && w === po),
10629
+ Ne(([, b, w, y, , , C]) => !C && !y && b !== 0 && w === po),
10623
10630
  pe(([[b], , , , , w]) => (w("Upward scrolling compensation", { amount: b }, Yt.DEBUG), b))
10624
10631
  )
10625
10632
  );
@@ -10631,7 +10638,7 @@ const _T = Ip(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
10631
10638
  }), rt(
10632
10639
  Q(
10633
10640
  Ct(Ft(s, !1), e, v),
10634
- Ie(([b, w, y]) => !b && !y && w !== 0),
10641
+ Ne(([b, w, y]) => !b && !y && w !== 0),
10635
10642
  pe(([b, w]) => w),
10636
10643
  Nn(1)
10637
10644
  ),
@@ -11337,7 +11344,7 @@ const aC = /* @__PURE__ */ Qe(
11337
11344
  Q(
11338
11345
  v,
11339
11346
  Be(k),
11340
- Ie(([O, Y]) => !!Y)
11347
+ Ne(([O, Y]) => !!Y)
11341
11348
  ),
11342
11349
  () => {
11343
11350
  Oe(K, !1);
@@ -11345,7 +11352,7 @@ const aC = /* @__PURE__ */ Qe(
11345
11352
  ), rt(
11346
11353
  Q(
11347
11354
  Ct(v, K, D, P, k, G),
11348
- Ie(([O, Y, J, le, , F]) => O && !Y && J.height !== 0 && le.height !== 0 && !F)
11355
+ Ne(([O, Y, J, le, , F]) => O && !Y && J.height !== 0 && le.height !== 0 && !F)
11349
11356
  ),
11350
11357
  ([, , , , O]) => {
11351
11358
  Oe(G, !0), hl(1, () => {
@@ -11357,7 +11364,7 @@ const aC = /* @__PURE__ */ Qe(
11357
11364
  ), be(
11358
11365
  Q(
11359
11366
  $,
11360
- Ie((O) => O != null && O.scrollTop > 0),
11367
+ Ne((O) => O != null && O.scrollTop > 0),
11361
11368
  bn(0)
11362
11369
  ),
11363
11370
  E
@@ -11365,7 +11372,7 @@ const aC = /* @__PURE__ */ Qe(
11365
11372
  Q(
11366
11373
  v,
11367
11374
  Be($),
11368
- Ie(([, O]) => O != null)
11375
+ Ne(([, O]) => O != null)
11369
11376
  ),
11370
11377
  ([, O]) => {
11371
11378
  O && (Oe(P, O.viewport), Oe(D, O.item), Oe(V, O.gap), O.scrollTop > 0 && (Oe(j, !0), fn(Q(c, ir(1)), (Y) => {
@@ -11381,10 +11388,10 @@ const aC = /* @__PURE__ */ Qe(
11381
11388
  ), be(
11382
11389
  Q(
11383
11390
  Ct(
11384
- Re(P, Vo),
11385
- Re(D, Vo),
11386
- Re(V, (O, Y) => O && O.column === Y.column && O.row === Y.row),
11387
- Re(c)
11391
+ Ie(P, Vo),
11392
+ Ie(D, Vo),
11393
+ Ie(V, (O, Y) => O && O.column === Y.column && O.row === Y.row),
11394
+ Ie(c)
11388
11395
  ),
11389
11396
  pe(([O, Y, J, le]) => ({
11390
11397
  gap: J,
@@ -11397,42 +11404,42 @@ const aC = /* @__PURE__ */ Qe(
11397
11404
  ), be(
11398
11405
  Q(
11399
11406
  Ct(
11400
- Re(T),
11407
+ Ie(T),
11401
11408
  r,
11402
- Re(V, sC),
11403
- Re(D, Vo),
11404
- Re(P, Vo),
11405
- Re(N),
11406
- Re(E),
11407
- Re(j),
11408
- Re(K),
11409
- Re(k)
11409
+ Ie(V, sC),
11410
+ Ie(D, Vo),
11411
+ Ie(P, Vo),
11412
+ Ie(N),
11413
+ Ie(E),
11414
+ Ie(j),
11415
+ Ie(K),
11416
+ Ie(k)
11410
11417
  ),
11411
- Ie(([, , , , , , , O]) => !O),
11418
+ Ne(([, , , , , , , O]) => !O),
11412
11419
  pe(
11413
11420
  ([
11414
11421
  O,
11415
11422
  [Y, J],
11416
11423
  le,
11417
11424
  F,
11418
- ne,
11425
+ te,
11419
11426
  ce,
11420
11427
  ie,
11421
11428
  ,
11422
11429
  ge,
11423
- Ne
11430
+ Te
11424
11431
  ]) => {
11425
- const { column: je, row: De } = le, { height: He, width: st } = F, { width: Et } = ne;
11432
+ const { column: je, row: De } = le, { height: He, width: st } = F, { width: Et } = te;
11426
11433
  if (ie === 0 && (O === 0 || Et === 0))
11427
11434
  return uu;
11428
11435
  if (st === 0) {
11429
- const _t = ml(Ne, O), wt = _t + Math.max(ie - 1, 0);
11436
+ const _t = ml(Te, O), wt = _t + Math.max(ie - 1, 0);
11430
11437
  return oC(pu(_t, wt, ce));
11431
11438
  }
11432
11439
  const Ke = $p(Et, st, je);
11433
11440
  let Ue, Ye;
11434
11441
  ge ? Y === 0 && J === 0 && ie > 0 ? (Ue = 0, Ye = ie - 1) : (Ue = Ke * bs((Y + De) / (He + De)), Ye = Ke * du((J + De) / (He + De)) - 1, Ye = La(O - 1, Qr(Ye, Ke - 1)), Ue = La(Ye, Qr(0, Ue))) : (Ue = 0, Ye = -1);
11435
- const Le = pu(Ue, Ye, ce), { bottom: We, top: vt } = hu(ne, le, F, Le), Mt = du(O / Ke), ut = Mt * He + (Mt - 1) * De - We;
11442
+ const Le = pu(Ue, Ye, ce), { bottom: We, top: vt } = hu(te, le, F, Le), Mt = du(O / Ke), ut = Mt * He + (Mt - 1) * De - We;
11436
11443
  return { bottom: We, itemHeight: He, items: Le, itemWidth: st, offsetBottom: ut, offsetTop: vt, top: vt };
11437
11444
  }
11438
11445
  )
@@ -11441,17 +11448,17 @@ const aC = /* @__PURE__ */ Qe(
11441
11448
  ), be(
11442
11449
  Q(
11443
11450
  N,
11444
- Ie((O) => O !== null),
11451
+ Ne((O) => O !== null),
11445
11452
  pe((O) => O.length)
11446
11453
  ),
11447
11454
  T
11448
11455
  ), be(
11449
11456
  Q(
11450
11457
  Ct(P, D, R, V),
11451
- Ie(([O, Y, { items: J }]) => J.length > 0 && Y.height !== 0 && O.height !== 0),
11458
+ Ne(([O, Y, { items: J }]) => J.length > 0 && Y.height !== 0 && O.height !== 0),
11452
11459
  pe(([O, Y, { items: J }, le]) => {
11453
- const { bottom: F, top: ne } = hu(O, le, Y, J);
11454
- return [ne, F];
11460
+ const { bottom: F, top: te } = hu(O, le, Y, J);
11461
+ return [te, F];
11455
11462
  }),
11456
11463
  dt(uo)
11457
11464
  ),
@@ -11469,9 +11476,9 @@ const aC = /* @__PURE__ */ Qe(
11469
11476
  const q = tn(
11470
11477
  Q(
11471
11478
  Ct(R, T),
11472
- Ie(([{ items: O }]) => O.length > 0),
11479
+ Ne(([{ items: O }]) => O.length > 0),
11473
11480
  Be(_),
11474
- Ie(([[O, Y], J]) => {
11481
+ Ne(([[O, Y], J]) => {
11475
11482
  const le = O.items[O.items.length - 1].index === Y - 1;
11476
11483
  return (J || O.bottom > 0 && O.itemHeight > 0 && O.offsetBottom === 0 && O.items.length === Y) && le;
11477
11484
  }),
@@ -11480,16 +11487,16 @@ const aC = /* @__PURE__ */ Qe(
11480
11487
  )
11481
11488
  ), X = tn(
11482
11489
  Q(
11483
- Re(R),
11484
- Ie(({ items: O }) => O.length > 0 && O[0].index === 0),
11490
+ Ie(R),
11491
+ Ne(({ items: O }) => O.length > 0 && O[0].index === 0),
11485
11492
  bn(0),
11486
11493
  dt()
11487
11494
  )
11488
11495
  ), re = tn(
11489
11496
  Q(
11490
- Re(R),
11497
+ Ie(R),
11491
11498
  Be(j),
11492
- Ie(([{ items: O }, Y]) => O.length > 0 && !Y),
11499
+ Ne(([{ items: O }, Y]) => O.length > 0 && !Y),
11493
11500
  pe(([{ items: O }]) => ({
11494
11501
  endIndex: O[O.length - 1].index,
11495
11502
  startIndex: O[0].index
@@ -11503,10 +11510,10 @@ const aC = /* @__PURE__ */ Qe(
11503
11510
  B,
11504
11511
  Be(P, D, T, V),
11505
11512
  pe(([O, Y, J, le, F]) => {
11506
- const ne = yp(O), { align: ce, behavior: ie, offset: ge } = ne;
11507
- let Ne = ne.index;
11508
- Ne === "LAST" && (Ne = le - 1), Ne = Qr(0, Ne, La(le - 1, Ne));
11509
- let je = fi(Y, F, J, Ne);
11513
+ const te = yp(O), { align: ce, behavior: ie, offset: ge } = te;
11514
+ let Te = te.index;
11515
+ Te === "LAST" && (Te = le - 1), Te = Qr(0, Te, La(le - 1, Te));
11516
+ let je = fi(Y, F, J, Te);
11510
11517
  return ce === "end" ? je = fu(je - Y.height + J.height) : ce === "center" && (je = fu(je - Y.height / 2 + J.height / 2)), ge && (je += ge), { behavior: ie, top: je };
11511
11518
  })
11512
11519
  ),
@@ -11592,7 +11599,7 @@ const iC = /* @__PURE__ */ Qe(() => {
11592
11599
  ),
11593
11600
  m
11594
11601
  ), c = oe(!1), d = oe(!1);
11595
- return be(Re(d), c), {
11602
+ return be(Ie(d), c), {
11596
11603
  components: t,
11597
11604
  computeItemKey: s,
11598
11605
  context: n,
@@ -13854,6 +13861,8 @@ function Mo({
13854
13861
  style: r
13855
13862
  }) {
13856
13863
  const o = Ze(() => {
13864
+ if (!e || typeof e != "string" || e.trim().length === 0)
13865
+ return "";
13857
13866
  try {
13858
13867
  if (!n) {
13859
13868
  const a = e.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, "").replace(/<iframe\b[^<]*(?:(?!<\/iframe>)<[^<]*)*<\/iframe>/gi, "").replace(/javascript:/gi, "").replace(/on\w+\s*=/gi, "");
@@ -14544,20 +14553,20 @@ const _l = _g(function({
14544
14553
  contentParts: J,
14545
14554
  imageParts: le,
14546
14555
  fileParts: F,
14547
- interruptParts: ne,
14556
+ interruptParts: te,
14548
14557
  textContent: ce,
14549
14558
  toolMeta: ie,
14550
14559
  toolRaw: ge,
14551
- isToolStreaming: Ne
14560
+ isToolStreaming: Te
14552
14561
  } = Y, je = (b == null ? void 0 : b.id) ?? (b == null ? void 0 : b.interrupt_id), De = es(je), He = b == null ? void 0 : b.value, st = Ze(() => K || !m ? null : t.artifact || null, [K, t, m]), Et = me(async () => {
14553
- const Te = k ? ge : ce;
14554
- async function Ge(Ce) {
14562
+ const Ce = k ? ge : ce;
14563
+ async function Ge(Ee) {
14555
14564
  if (navigator.clipboard && typeof navigator.clipboard.writeText == "function") {
14556
- await navigator.clipboard.writeText(Ce);
14565
+ await navigator.clipboard.writeText(Ee);
14557
14566
  return;
14558
14567
  }
14559
14568
  if (navigator.clipboard && typeof navigator.clipboard.write == "function" && typeof ClipboardItem < "u") {
14560
- const qe = new Blob([Ce], { type: "text/plain" });
14569
+ const qe = new Blob([Ee], { type: "text/plain" });
14561
14570
  await navigator.clipboard.write([
14562
14571
  new ClipboardItem({
14563
14572
  "text/plain": qe
@@ -14568,17 +14577,17 @@ const _l = _g(function({
14568
14577
  throw new Error("Clipboard API not supported in this context.");
14569
14578
  }
14570
14579
  try {
14571
- await Ge(Te), D(!0), setTimeout(() => D(!1), 2e3), x == null || x(Te);
14572
- } catch (Ce) {
14573
- console.error("Failed to copy:", Ce);
14580
+ await Ge(Ce), D(!0), setTimeout(() => D(!1), 2e3), x == null || x(Ce);
14581
+ } catch (Ee) {
14582
+ console.error("Failed to copy:", Ee);
14574
14583
  }
14575
14584
  }, [k, ge, ce, x]), Ke = me(() => {
14576
14585
  if (!v || !t.id) return;
14577
- const Te = (k ? ge : ce) ?? "", Ge = "type" in t && t.type === "default_message" ? void 0 : {
14586
+ const Ce = (k ? ge : ce) ?? "", Ge = "type" in t && t.type === "default_message" ? void 0 : {
14578
14587
  checkpointId: t.checkpointId ?? null,
14579
14588
  checkpointNs: t.checkpointNs ?? null
14580
14589
  };
14581
- v(t.id, Te, Ge);
14590
+ v(t.id, Ce, Ge);
14582
14591
  }, [v, t.id, k, ge, ce, t]), Ue = me(() => {
14583
14592
  g == null || g(n);
14584
14593
  }, [g, n]), Ye = me(() => {
@@ -14594,25 +14603,25 @@ const _l = _g(function({
14594
14603
  return /* @__PURE__ */ u.jsx(xa, { className: Ge });
14595
14604
  }
14596
14605
  }, [$, O, j]), Le = me(() => {
14597
- const Te = "group relative mb-4 flex w-full";
14606
+ const Ce = "group relative mb-4 flex w-full";
14598
14607
  switch (j) {
14599
14608
  case "user":
14600
- return ee(Te, "justify-end");
14609
+ return ee(Ce, "justify-end");
14601
14610
  case "assistant":
14602
14611
  case "tool":
14603
14612
  case "system":
14604
- return ee(Te, "justify-start");
14613
+ return ee(Ce, "justify-start");
14605
14614
  default:
14606
- return Te;
14615
+ return Ce;
14607
14616
  }
14608
14617
  }, [j]), We = me(() => {
14609
- const Te = ee(
14618
+ const Ce = ee(
14610
14619
  "rounded-lg px-4 py-3 relative min-w-0 max-w-full break-words",
14611
14620
  $ && "px-3 py-2 text-sm"
14612
14621
  );
14613
14622
  if (G)
14614
14623
  return ee(
14615
- Te,
14624
+ Ce,
14616
14625
  "w-full",
14617
14626
  "bg-[hsl(var(--chat-bubble-ai))] text-[hsl(var(--chat-bubble-ai-text))]",
14618
14627
  "border border-border/60 dark:border-border/40 shadow-sm"
@@ -14620,61 +14629,61 @@ const _l = _g(function({
14620
14629
  switch (j) {
14621
14630
  case "user":
14622
14631
  return ee(
14623
- Te,
14632
+ Ce,
14624
14633
  "w-full md:max-w-[95%]",
14625
14634
  "bg-[hsl(var(--chat-bubble-user))] text-[hsl(var(--chat-bubble-user-text))]",
14626
14635
  "border border-transparent"
14627
14636
  );
14628
14637
  case "assistant":
14629
14638
  return ee(
14630
- Te,
14639
+ Ce,
14631
14640
  "w-full md:max-w-[95%]",
14632
14641
  "bg-[hsl(var(--chat-bubble-ai))] text-[hsl(var(--chat-bubble-ai-text))]",
14633
14642
  "border border-border/60 dark:border-border/40"
14634
14643
  );
14635
14644
  case "tool":
14636
- return ee(Te, "w-full md:max-w-[95%] bg-secondary/50 text-secondary-foreground border border-dashed");
14645
+ return ee(Ce, "w-full md:max-w-[95%] bg-secondary/50 text-secondary-foreground border border-dashed");
14637
14646
  case "system":
14638
- return ee(Te, "w-full md:max-w-[85%] bg-accent/40 text-muted-foreground border");
14647
+ return ee(Ce, "w-full md:max-w-[85%] bg-accent/40 text-muted-foreground border");
14639
14648
  default:
14640
14649
  return ee(
14641
- Te,
14650
+ Ce,
14642
14651
  "w-full md:max-w-[95%]",
14643
14652
  "bg-[hsl(var(--chat-bubble-ai))] text-[hsl(var(--chat-bubble-ai-text))]",
14644
14653
  "border border-border/60 dark:border-border/40"
14645
14654
  );
14646
14655
  }
14647
- }, [$, G, j]), vt = me(async (Te) => {
14656
+ }, [$, G, j]), vt = me(async (Ce) => {
14648
14657
  if (w)
14649
14658
  return;
14650
14659
  const Ge = es(
14651
- (Te == null ? void 0 : Te.id) ?? (Te == null ? void 0 : Te.interrupt_id)
14660
+ (Ce == null ? void 0 : Ce.id) ?? (Ce == null ? void 0 : Ce.interrupt_id)
14652
14661
  );
14653
14662
  if (!Ge) {
14654
- console.warn("Interrupt part missing id", Te);
14663
+ console.warn("Interrupt part missing id", Ce);
14655
14664
  return;
14656
14665
  }
14657
14666
  try {
14658
14667
  y == null || y(), await W(Ge, !0);
14659
- } catch (Ce) {
14660
- console.error("Failed to approve interrupt:", Ce);
14668
+ } catch (Ee) {
14669
+ console.error("Failed to approve interrupt:", Ee);
14661
14670
  } finally {
14662
14671
  C == null || C();
14663
14672
  }
14664
- }, [w, C, y, W]), Mt = me(async (Te) => {
14673
+ }, [w, C, y, W]), Mt = me(async (Ce) => {
14665
14674
  if (w)
14666
14675
  return;
14667
14676
  const Ge = es(
14668
- (Te == null ? void 0 : Te.id) ?? (Te == null ? void 0 : Te.interrupt_id)
14677
+ (Ce == null ? void 0 : Ce.id) ?? (Ce == null ? void 0 : Ce.interrupt_id)
14669
14678
  );
14670
14679
  if (!Ge) {
14671
- console.warn("Interrupt part missing id", Te);
14680
+ console.warn("Interrupt part missing id", Ce);
14672
14681
  return;
14673
14682
  }
14674
14683
  try {
14675
14684
  y == null || y(), await W(Ge, !1);
14676
- } catch (Ce) {
14677
- console.error("Failed to reject interrupt:", Ce);
14685
+ } catch (Ee) {
14686
+ console.error("Failed to reject interrupt:", Ee);
14678
14687
  } finally {
14679
14688
  C == null || C();
14680
14689
  }
@@ -14723,9 +14732,9 @@ const _l = _g(function({
14723
14732
  role: "button",
14724
14733
  tabIndex: 0,
14725
14734
  "aria-expanded": B === "expanded",
14726
- onClick: () => z((Te) => Te === "expanded" ? "preview" : "expanded"),
14727
- onKeyDown: (Te) => {
14728
- (Te.key === "Enter" || Te.key === " ") && (Te.preventDefault(), z((Ge) => Ge === "expanded" ? "preview" : "expanded"));
14735
+ onClick: () => z((Ce) => Ce === "expanded" ? "preview" : "expanded"),
14736
+ onKeyDown: (Ce) => {
14737
+ (Ce.key === "Enter" || Ce.key === " ") && (Ce.preventDefault(), z((Ge) => Ge === "expanded" ? "preview" : "expanded"));
14729
14738
  },
14730
14739
  children: [
14731
14740
  /* @__PURE__ */ u.jsx("span", { children: ie.name ?? "Tool Output" }),
@@ -14843,12 +14852,12 @@ const _l = _g(function({
14843
14852
  showToolMessages: p,
14844
14853
  artifactToRender: st,
14845
14854
  toolViewMode: B,
14846
- isToolStreaming: Ne,
14855
+ isToolStreaming: Te,
14847
14856
  contentParts: J,
14848
14857
  textContent: ce,
14849
14858
  imageParts: le,
14850
14859
  fileParts: F,
14851
- interruptParts: ne,
14860
+ interruptParts: te,
14852
14861
  isStreamingMessage: r,
14853
14862
  handleFileClick: q,
14854
14863
  uploadingFiles: _,
@@ -15052,16 +15061,16 @@ const bh = M.forwardRef(({
15052
15061
  createSyntheticThinkingMessage: B = !0
15053
15062
  }, z) => {
15054
15063
  const L = $e(null), N = $e(null), V = $e(!1), W = $e(!1), [$, j] = fe(!0), k = Ze(() => w ? e.some((F) => "type" in F && F.type === "default_message" ? !1 : Array.isArray(F == null ? void 0 : F.content) && F.content.some(
15055
- (ne) => ne && ne.type === "interrupt" && (ne.id ?? ne.interrupt_id) === w.id
15064
+ (te) => te && te.type === "interrupt" && (te.id ?? te.interrupt_id) === w.id
15056
15065
  )) : !1, [w, e]), K = Ze(() => {
15057
15066
  if (!w || k)
15058
15067
  return null;
15059
15068
  const F = w.id && String(w.id).trim() ? String(w.id).trim() : "pending-interrupt";
15060
- let ne;
15069
+ let te;
15061
15070
  const ce = w.value;
15062
15071
  if (ce && typeof ce == "object" && !Array.isArray(ce)) {
15063
15072
  const ie = ce.title;
15064
- typeof ie == "string" && ie.trim() && (ne = ie.trim());
15073
+ typeof ie == "string" && ie.trim() && (te = ie.trim());
15065
15074
  }
15066
15075
  return {
15067
15076
  id: `interrupt-${F}`,
@@ -15072,11 +15081,11 @@ const bh = M.forwardRef(({
15072
15081
  type: "interrupt",
15073
15082
  id: F,
15074
15083
  value: ce,
15075
- title: ne
15084
+ title: te
15076
15085
  }
15077
15086
  ]
15078
15087
  };
15079
- }, [w, k]), G = Ze(() => K ? [...e, K] : e, [e, K]), A = Ze(() => !B || !t ? G : !G.some((ne) => ne.role === "assistant") && G.length > 0 ? [
15088
+ }, [w, k]), G = Ze(() => K ? [...e, K] : e, [e, K]), A = Ze(() => !B || !t ? G : !G.some((te) => te.role === "assistant") && G.length > 0 ? [
15080
15089
  ...G,
15081
15090
  {
15082
15091
  id: "thinking-assistant",
@@ -15129,7 +15138,7 @@ const bh = M.forwardRef(({
15129
15138
  }
15130
15139
  ) }) }) : /* @__PURE__ */ u.jsx("div", { className: "flex h-full items-center justify-center py-8 text-center text-muted-foreground", children: f ?? "No messages yet. Start a conversation!" }), J = _.length, le = J > 0;
15131
15140
  return nt(() => {
15132
- var F, ne;
15141
+ var F, te;
15133
15142
  if (J === 0) {
15134
15143
  W.current = !1;
15135
15144
  return;
@@ -15137,16 +15146,16 @@ const bh = M.forwardRef(({
15137
15146
  if (!W.current)
15138
15147
  if (W.current = !0, L.current && _.length > 0) {
15139
15148
  const ce = _.length - 1;
15140
- (ne = (F = L.current).scrollToIndex) == null || ne.call(F, { index: ce, align: "end", behavior: "auto" });
15149
+ (te = (F = L.current).scrollToIndex) == null || te.call(F, { index: ce, align: "end", behavior: "auto" });
15141
15150
  } else N.current && (N.current.scrollTop = N.current.scrollHeight);
15142
15151
  }, [J, _.length]), Pg(
15143
15152
  z,
15144
15153
  () => ({
15145
15154
  scrollToLatest: () => {
15146
- var F, ne;
15155
+ var F, te;
15147
15156
  if (L.current && _.length > 0) {
15148
15157
  const ce = _.length - 1;
15149
- (ne = (F = L.current).scrollToIndex) == null || ne.call(F, {
15158
+ (te = (F = L.current).scrollToIndex) == null || te.call(F, {
15150
15159
  index: ce,
15151
15160
  align: "end",
15152
15161
  behavior: "auto"
@@ -15154,8 +15163,8 @@ const bh = M.forwardRef(({
15154
15163
  } else N.current && (N.current.scrollTop = N.current.scrollHeight);
15155
15164
  },
15156
15165
  scrollToTop: () => {
15157
- var F, ne;
15158
- L.current && _.length > 0 ? (ne = (F = L.current).scrollToIndex) == null || ne.call(F, {
15166
+ var F, te;
15167
+ L.current && _.length > 0 ? (te = (F = L.current).scrollToIndex) == null || te.call(F, {
15159
15168
  index: 0,
15160
15169
  align: "start",
15161
15170
  behavior: "auto"
@@ -15183,11 +15192,11 @@ const bh = M.forwardRef(({
15183
15192
  },
15184
15193
  atBottomStateChange: q,
15185
15194
  style: { height: "100%", overscrollBehavior: "contain" },
15186
- computeItemKey: (F, ne) => vh(ne, F),
15187
- itemContent: (F, ne) => /* @__PURE__ */ u.jsx(
15195
+ computeItemKey: (F, te) => vh(te, F),
15196
+ itemContent: (F, te) => /* @__PURE__ */ u.jsx(
15188
15197
  wh,
15189
15198
  {
15190
- message: ne,
15199
+ message: te,
15191
15200
  index: F,
15192
15201
  isStreaming: t,
15193
15202
  streamingAssistantId: n,
@@ -15254,15 +15263,15 @@ function to({
15254
15263
  re(!0);
15255
15264
  }, []), O = me(() => {
15256
15265
  re(!1);
15257
- }, []), Y = !!q || X, [J, le] = fe(null), [F, ne] = fe(""), [ce, ie] = fe(null), [ge, Ne] = fe(null), [je, De] = fe([]), [He, st] = fe(0), [Et, Ke] = fe(0), [Ue, Ye] = fe(!1), [Le, We] = fe(null), [vt, Mt] = fe(null), [ut, _t] = fe(!1), [wt, pt] = fe(null), bt = $e(!1), [kt, Pt] = fe(() => Tu.value), Te = $e(kt), Ge = $e(null), Ce = me((se) => {
15266
+ }, []), Y = !!q || X, [J, le] = fe(null), [F, te] = fe(""), [ce, ie] = fe(null), [ge, Te] = fe(null), [je, De] = fe([]), [He, st] = fe(0), [Et, Ke] = fe(0), [Ue, Ye] = fe(!1), [Le, We] = fe(null), [vt, Mt] = fe(null), [ut, _t] = fe(!1), [wt, pt] = fe(null), bt = $e(!1), [kt, Pt] = fe(() => Tu.value), Ce = $e(kt), Ge = $e(null), Ee = me((se) => {
15258
15267
  Tu.value = se, Pt(se);
15259
- }, []), [qe, zt] = fe(!1), te = $e(null), we = $e(null), at = $e(null), xe = me(() => {
15268
+ }, []), [qe, zt] = fe(!1), ne = $e(null), we = $e(null), at = $e(null), xe = me(() => {
15260
15269
  we.current && (we.current.value = ""), at.current && (at.current.value = ""), st((se) => se + 1), Ke((se) => se + 1);
15261
15270
  }, []), Fe = me(
15262
15271
  (se) => {
15263
- Ce(se);
15272
+ Ee(se);
15264
15273
  },
15265
- [Ce]
15274
+ [Ee]
15266
15275
  ), Xe = $e(!1);
15267
15276
  nt(() => {
15268
15277
  Xe.current && !L && (De([]), xe()), Xe.current = L;
@@ -15279,22 +15288,22 @@ function to({
15279
15288
  }, []), nt(() => {
15280
15289
  bt.current = !1;
15281
15290
  }, [j]), nt(() => {
15282
- Te.current = kt;
15291
+ Ce.current = kt;
15283
15292
  }, [kt]), nt(() => {
15284
15293
  if (!J) {
15285
15294
  Ge.current = null;
15286
15295
  return;
15287
15296
  }
15288
- Ge.current === null && (Ge.current = Te.current), Ce(F ?? "");
15289
- }, [F, J, Ce]), nt(() => {
15297
+ Ge.current === null && (Ge.current = Ce.current), Ee(F ?? "");
15298
+ }, [F, J, Ee]), nt(() => {
15290
15299
  (async () => {
15291
15300
  if (!x.baseUrl) {
15292
15301
  pt(null);
15293
15302
  return;
15294
15303
  }
15295
15304
  try {
15296
- const ke = (await x.getAgent("default")).uiDefaultMessage || "";
15297
- pt(ke || null);
15305
+ const Re = (await x.getAgent("default")).uiDefaultMessage || "";
15306
+ pt(Re || null);
15298
15307
  } catch (ue) {
15299
15308
  console.warn("Failed to fetch default message:", ue), pt(null);
15300
15309
  }
@@ -15305,7 +15314,7 @@ function to({
15305
15314
  const At = async (se) => {
15306
15315
  const ue = se.trim();
15307
15316
  if (!ue && je.length === 0) return;
15308
- const ke = J;
15317
+ const Re = J;
15309
15318
  try {
15310
15319
  const Me = J ? (ce == null ? void 0 : ce.checkpointId) ?? k ?? void 0 : k ?? void 0, tt = J ? (ce == null ? void 0 : ce.checkpointNs) ?? K ?? void 0 : K ?? void 0;
15311
15320
  await W(
@@ -15319,24 +15328,24 @@ function to({
15319
15328
  edit: !!J,
15320
15329
  originalMessageId: J ?? void 0
15321
15330
  }
15322
- ), f == null || f(ue), ke && A(ke), Ce(""), Ne(null), De([]), xe(), le(null), ne(""), ie(null);
15331
+ ), f == null || f(ue), Re && A(Re), Ee(""), Te(null), De([]), xe(), le(null), te(""), ie(null);
15323
15332
  } catch (Me) {
15324
15333
  const tt = (Me == null ? void 0 : Me.message) || "Failed to send message";
15325
- Ne(tt), g == null || g(tt);
15334
+ Te(tt), g == null || g(tt);
15326
15335
  }
15327
15336
  }, Ot = M.useCallback(
15328
- (se, ue, ke) => {
15329
- c && (Ge.current = kt, le(se), ne(ue), Ce(ue), Ne(null), ie({
15330
- checkpointId: (ke == null ? void 0 : ke.checkpointId) ?? null,
15331
- checkpointNs: (ke == null ? void 0 : ke.checkpointNs) ?? null
15337
+ (se, ue, Re) => {
15338
+ c && (Ge.current = kt, le(se), te(ue), Ee(ue), Te(null), ie({
15339
+ checkpointId: (Re == null ? void 0 : Re.checkpointId) ?? null,
15340
+ checkpointNs: (Re == null ? void 0 : Re.checkpointNs) ?? null
15332
15341
  }));
15333
15342
  },
15334
- [kt, c, Ce]
15343
+ [kt, c, Ee]
15335
15344
  ), Ae = M.useCallback(() => {
15336
- le(null), ne(""), ie(null), Ne(null), Ce(Ge.current ?? kt), Ge.current = null, A(null);
15337
- }, [kt, Ce]), gt = me(
15338
- (se, ue, ke) => {
15339
- Ot(se, ue, ke);
15345
+ le(null), te(""), ie(null), Te(null), Ee(Ge.current ?? kt), Ge.current = null, A(null);
15346
+ }, [kt, Ee]), gt = me(
15347
+ (se, ue, Re) => {
15348
+ Ot(se, ue, Re);
15340
15349
  },
15341
15350
  [Ot]
15342
15351
  ), et = me((se) => {
@@ -15347,11 +15356,11 @@ function to({
15347
15356
  break;
15348
15357
  }
15349
15358
  if (!ue) return;
15350
- const ke = Array.isArray(ue.content) ? ue.content : [], tt = ke.filter((xt) => (xt == null ? void 0 : xt.type) === "text").map((xt) => xt.text).join("") || (() => {
15359
+ const Re = Array.isArray(ue.content) ? ue.content : [], tt = Re.filter((xt) => (xt == null ? void 0 : xt.type) === "text").map((xt) => xt.text).join("") || (() => {
15351
15360
  try {
15352
- return JSON.stringify(ke, null, 2);
15361
+ return JSON.stringify(Re, null, 2);
15353
15362
  } catch {
15354
- return String(ke);
15363
+ return String(Re);
15355
15364
  }
15356
15365
  })();
15357
15366
  tt && W(
@@ -15365,11 +15374,11 @@ function to({
15365
15374
  );
15366
15375
  }, [y, W, k, K]), ht = (se) => {
15367
15376
  const ue = Array.from(se.target.files || []);
15368
- De((ke) => [...ke, ...ue]), se.target.value = "";
15377
+ De((Re) => [...Re, ...ue]), se.target.value = "";
15369
15378
  }, nn = (se) => {
15370
15379
  De((ue) => {
15371
- const ke = ue.filter((Me, tt) => se !== tt);
15372
- return ke.length === 0 && xe(), ke;
15380
+ const Re = ue.filter((Me, tt) => se !== tt);
15381
+ return Re.length === 0 && xe(), Re;
15373
15382
  });
15374
15383
  }, I = async (se) => {
15375
15384
  const ue = (se.target.files || [])[0];
@@ -15383,11 +15392,11 @@ function to({
15383
15392
  checkpointNs: K ?? void 0
15384
15393
  }
15385
15394
  );
15386
- const ke = `Uploaded ${ue.name} - processing through chat stream`;
15387
- Mt(ke);
15388
- } catch (ke) {
15389
- const Me = ke instanceof Error ? ke.message : "Failed to upload Excel file";
15390
- console.error("Excel upload failed", ke), We(Me), g == null || g(Me);
15395
+ const Re = `Uploaded ${ue.name} - processing through chat stream`;
15396
+ Mt(Re);
15397
+ } catch (Re) {
15398
+ const Me = Re instanceof Error ? Re.message : "Failed to upload Excel file";
15399
+ console.error("Excel upload failed", Re), We(Me), g == null || g(Me);
15391
15400
  } finally {
15392
15401
  Ye(!1), se.target.value = "", xe();
15393
15402
  }
@@ -15399,26 +15408,26 @@ function to({
15399
15408
  if (!se) {
15400
15409
  await E(), requestAnimationFrame(() => {
15401
15410
  var Me;
15402
- (Me = te.current) == null || Me.scrollToLatest();
15411
+ (Me = ne.current) == null || Me.scrollToLatest();
15403
15412
  });
15404
15413
  return;
15405
15414
  }
15406
- const ue = P.find((Me) => Me.checkpointId === se), ke = (ue == null ? void 0 : ue.checkpointNs) ?? null;
15407
- await T(se, ke), requestAnimationFrame(() => {
15415
+ const ue = P.find((Me) => Me.checkpointId === se), Re = (ue == null ? void 0 : ue.checkpointNs) ?? null;
15416
+ await T(se, Re), requestAnimationFrame(() => {
15408
15417
  var Me;
15409
- (Me = te.current) == null || Me.scrollToTop();
15418
+ (Me = ne.current) == null || Me.scrollToTop();
15410
15419
  });
15411
15420
  } finally {
15412
15421
  zt(!1);
15413
15422
  }
15414
15423
  }
15415
15424
  }, de = me(
15416
- async (se, ue, ke) => {
15417
- await Z(ke ? null : se);
15425
+ async (se, ue, Re) => {
15426
+ await Z(Re ? null : se);
15418
15427
  },
15419
15428
  [Z]
15420
- ), Ee = `flex flex-1 w-full flex-col min-h-0 min-w-0 max-h-full overflow-hidden bg-transparent ${e} ${m.container || ""}`, Je = `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 ${m.messagesArea || ""}`, ot = `relative flex-shrink-0 w-full border-t p-4 bg-transparent ${m.inputArea || ""}`;
15421
- return /* @__PURE__ */ u.jsxs("div", { className: Ee, children: [
15429
+ ), ke = `flex flex-1 w-full flex-col min-h-0 min-w-0 max-h-full overflow-hidden bg-transparent ${e} ${m.container || ""}`, Je = `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 ${m.messagesArea || ""}`, ot = `relative flex-shrink-0 w-full border-t p-4 bg-transparent ${m.inputArea || ""}`;
15430
+ return /* @__PURE__ */ u.jsxs("div", { className: ke, children: [
15422
15431
  !!N && !ut && /* @__PURE__ */ u.jsxs("div", { className: "flex-shrink-0 bg-red-50 border border-red-200 text-red-800 px-4 py-2 text-sm flex items-center justify-between", children: [
15423
15432
  /* @__PURE__ */ u.jsx("span", { children: N }),
15424
15433
  /* @__PURE__ */ u.jsx(
@@ -15442,7 +15451,7 @@ function to({
15442
15451
  /* @__PURE__ */ u.jsx(
15443
15452
  bh,
15444
15453
  {
15445
- ref: te,
15454
+ ref: ne,
15446
15455
  className: "h-full",
15447
15456
  style: { height: "100%" },
15448
15457
  messages: y,
@@ -16730,103 +16739,103 @@ function gi({
16730
16739
  shareInFlight: B,
16731
16740
  shareStatus: z,
16732
16741
  clearShareStatus: L
16733
- } = To(), { createThread: N, deleteThread: V, renameThread: W, shareThread: $ } = D, { loadThread: j } = Os(), k = a ?? T, [K, G] = fe(Array.isArray(C) ? C : []), A = $e(K.length > 0), _ = $e(null), q = $e(0), [X, re] = fe(null), [U, O] = fe(""), [Y, J] = fe(!1), [le, F] = fe(!1), [ne, ce] = fe(null), [ie, ge] = fe(""), Ne = v && v.length > 0 ? v : ok, je = rk({ defaultView: m }), De = g ?? je, He = p ?? De.view, st = me(
16734
- (te) => {
16735
- p || De.setView(te), f == null || f(te);
16742
+ } = To(), { createThread: N, deleteThread: V, renameThread: W, shareThread: $ } = D, { loadThread: j } = Os(), k = a ?? T, [K, G] = fe(Array.isArray(C) ? C : []), A = $e(K.length > 0), _ = $e(null), q = $e(0), [X, re] = fe(null), [U, O] = fe(""), [Y, J] = fe(!1), [le, F] = fe(!1), [te, ce] = fe(null), [ie, ge] = fe(""), Te = v && v.length > 0 ? v : ok, je = rk({ defaultView: m }), De = g ?? je, He = p ?? De.view, st = me(
16743
+ (ne) => {
16744
+ p || De.setView(ne), f == null || f(ne);
16736
16745
  },
16737
16746
  [p, f, De]
16738
- ), Et = Ne.find((te) => te.key === He) ?? Ne[0], Ke = (te) => {
16739
- ce(te), ge(""), F(!0);
16747
+ ), Et = Te.find((ne) => ne.key === He) ?? Te[0], Ke = (ne) => {
16748
+ ce(ne), ge(""), F(!0);
16740
16749
  }, Ue = () => {
16741
16750
  F(!1), ce(null), ge(""), L();
16742
16751
  }, Ye = me(
16743
- async (te) => {
16744
- if (!(!ne || B) && te.id)
16752
+ async (ne) => {
16753
+ if (!(!te || B) && ne.id)
16745
16754
  try {
16746
- await $(ne, te.id), setTimeout(() => Ue(), 600);
16755
+ await $(te, ne.id), setTimeout(() => Ue(), 600);
16747
16756
  } catch (we) {
16748
16757
  console.error("Failed to share thread:", we);
16749
16758
  }
16750
16759
  },
16751
- [Ue, B, ne, $]
16760
+ [Ue, B, te, $]
16752
16761
  ), Le = Ze(() => {
16753
- const te = b ?? [], we = ie.trim().toLowerCase();
16754
- return we ? y ? te.filter((at) => y(at, we)) : te.filter((at) => `${at.label} ${at.secondaryLabel ?? ""}`.toLowerCase().includes(we)) : te;
16755
- }, [b, ie, y]), We = He === "shared", vt = We ? S : K, Mt = We ? P : R, ut = We ? "No shared conversations yet" : "No conversations yet", _t = (te) => {
16756
- const we = te.sharedAt ? ` • ${Ce(te.sharedAt)}` : "";
16757
- return `Shared by ${te.sharedByUserId}${we}`;
16758
- }, wt = (te) => "sharedByUserId" in te;
16762
+ const ne = b ?? [], we = ie.trim().toLowerCase();
16763
+ return we ? y ? ne.filter((at) => y(at, we)) : ne.filter((at) => `${at.label} ${at.secondaryLabel ?? ""}`.toLowerCase().includes(we)) : ne;
16764
+ }, [b, ie, y]), We = He === "shared", vt = We ? S : K, Mt = We ? P : R, ut = We ? "No shared conversations yet" : "No conversations yet", _t = (ne) => {
16765
+ const we = ne.sharedAt ? ` • ${Ee(ne.sharedAt)}` : "";
16766
+ return `Shared by ${ne.sharedByUserId}${we}`;
16767
+ }, wt = (ne) => "sharedByUserId" in ne;
16759
16768
  nt(() => {
16760
- const te = Array.isArray(C) ? C : [];
16761
- if (te.length > 0) {
16762
- A.current = !0, G(te);
16769
+ const ne = Array.isArray(C) ? C : [];
16770
+ if (ne.length > 0) {
16771
+ A.current = !0, G(ne);
16763
16772
  return;
16764
16773
  }
16765
- R || (A.current = !1, G(te));
16774
+ R || (A.current = !1, G(ne));
16766
16775
  }, [C, R]), nt(() => {
16767
16776
  if (!_.current) return;
16768
- const te = _.current.querySelector(
16777
+ const ne = _.current.querySelector(
16769
16778
  "[data-radix-scroll-area-viewport]"
16770
16779
  );
16771
- if (!te) return;
16780
+ if (!ne) return;
16772
16781
  let we = null, at = null;
16773
16782
  return we = requestAnimationFrame(() => {
16774
16783
  at = requestAnimationFrame(() => {
16775
- te.scrollTop = q.current;
16784
+ ne.scrollTop = q.current;
16776
16785
  });
16777
16786
  }), () => {
16778
16787
  we !== null && cancelAnimationFrame(we), at !== null && cancelAnimationFrame(at);
16779
16788
  };
16780
16789
  }, [K]);
16781
- const pt = async (te) => {
16790
+ const pt = async (ne) => {
16782
16791
  try {
16783
- E(te), await j(te), i == null || i(te), l == null || l(te);
16792
+ E(ne), await j(ne), i == null || i(ne), l == null || l(ne);
16784
16793
  } catch (we) {
16785
16794
  console.error("Failed to select thread:", we);
16786
16795
  }
16787
16796
  }, bt = async () => {
16788
16797
  try {
16789
16798
  J(!0);
16790
- const te = await N();
16791
- te && (c == null || c(te), i == null || i(te));
16792
- } catch (te) {
16793
- console.error("Failed to create thread:", te);
16799
+ const ne = await N();
16800
+ ne && (c == null || c(ne), i == null || i(ne));
16801
+ } catch (ne) {
16802
+ console.error("Failed to create thread:", ne);
16794
16803
  } finally {
16795
16804
  J(!1);
16796
16805
  }
16797
- }, kt = async (te, we) => {
16806
+ }, kt = async (ne, we) => {
16798
16807
  if (we.stopPropagation(), !!confirm("Delete this thread?")) {
16799
16808
  if (_.current) {
16800
16809
  const at = _.current.querySelector("[data-radix-scroll-area-viewport]");
16801
16810
  at && (q.current = at.scrollTop);
16802
16811
  }
16803
16812
  try {
16804
- await V(te), d == null || d(te);
16813
+ await V(ne), d == null || d(ne);
16805
16814
  } catch (at) {
16806
16815
  console.error("Failed to delete thread:", at);
16807
16816
  }
16808
16817
  }
16809
- }, Pt = (te, we) => {
16810
- we.stopPropagation(), re(te.threadId), O(te.title || `Thread ${te.threadId.slice(0, 8)}`);
16811
- }, Te = async (te) => {
16818
+ }, Pt = (ne, we) => {
16819
+ we.stopPropagation(), re(ne.threadId), O(ne.title || `Thread ${ne.threadId.slice(0, 8)}`);
16820
+ }, Ce = async (ne) => {
16812
16821
  if (U.trim())
16813
16822
  try {
16814
- await W(te, U.trim()), re(null), O("");
16823
+ await W(ne, U.trim()), re(null), O("");
16815
16824
  } catch (we) {
16816
16825
  console.error("Failed to update title:", we);
16817
16826
  }
16818
16827
  }, Ge = () => {
16819
16828
  re(null), O("");
16820
- }, Ce = (te) => {
16821
- if (!te) return "";
16829
+ }, Ee = (ne) => {
16830
+ if (!ne) return "";
16822
16831
  try {
16823
- const we = new Date(te), xe = (/* @__PURE__ */ new Date()).getTime() - we.getTime(), Fe = Math.floor(xe / (1e3 * 60 * 60 * 24));
16832
+ const we = new Date(ne), xe = (/* @__PURE__ */ new Date()).getTime() - we.getTime(), Fe = Math.floor(xe / (1e3 * 60 * 60 * 24));
16824
16833
  return Fe === 0 ? we.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) : Fe === 1 ? "Yesterday" : Fe < 7 ? `${Fe} days ago` : we.toLocaleDateString();
16825
16834
  } catch {
16826
16835
  return "";
16827
16836
  }
16828
- }, qe = (te) => te.title || `Thread ${te.threadId.slice(0, 8)}`, zt = (te) => {
16829
- const we = qe(te);
16837
+ }, qe = (ne) => ne.title || `Thread ${ne.threadId.slice(0, 8)}`, zt = (ne) => {
16838
+ const we = qe(ne);
16830
16839
  return we.length <= Iu ? we : `${we.slice(0, Iu)}...`;
16831
16840
  };
16832
16841
  return /* @__PURE__ */ u.jsxs("div", { className: `flex flex-col h-full ${e} ${s.container || ""}`, children: [
@@ -16862,19 +16871,19 @@ function gi({
16862
16871
  children: Et.label
16863
16872
  }
16864
16873
  ) }),
16865
- /* @__PURE__ */ u.jsx(Gs, { align: "start", sideOffset: 6, className: "w-40", children: Ne.map((te) => /* @__PURE__ */ u.jsxs(
16874
+ /* @__PURE__ */ u.jsx(Gs, { align: "start", sideOffset: 6, className: "w-40", children: Te.map((ne) => /* @__PURE__ */ u.jsxs(
16866
16875
  nr,
16867
16876
  {
16868
16877
  className: "justify-between text-[12px]",
16869
16878
  onClick: (we) => {
16870
- we.preventDefault(), st(te.key);
16879
+ we.preventDefault(), st(ne.key);
16871
16880
  },
16872
16881
  children: [
16873
- /* @__PURE__ */ u.jsx("span", { children: te.label }),
16874
- He === te.key && /* @__PURE__ */ u.jsx(Rs, { className: "h-3 w-3" })
16882
+ /* @__PURE__ */ u.jsx("span", { children: ne.label }),
16883
+ He === ne.key && /* @__PURE__ */ u.jsx(Rs, { className: "h-3 w-3" })
16875
16884
  ]
16876
16885
  },
16877
- te.key
16886
+ ne.key
16878
16887
  )) })
16879
16888
  ] })
16880
16889
  ] })
@@ -16893,33 +16902,33 @@ function gi({
16893
16902
  ] }) : vt.length === 0 ? /* @__PURE__ */ u.jsxs("div", { className: "text-center py-8 text-slate-400", children: [
16894
16903
  /* @__PURE__ */ u.jsx(Du, { className: "w-8 h-8 mx-auto mb-2 opacity-40 text-slate-500" }),
16895
16904
  /* @__PURE__ */ u.jsx("p", { className: "text-sm text-slate-500", children: ut })
16896
- ] }) : vt.slice().sort((te, we) => new Date(we.updatedAt || we.createdAt || "").getTime() - new Date(te.updatedAt || te.createdAt || "").getTime()).map((te) => /* @__PURE__ */ u.jsx(
16905
+ ] }) : vt.slice().sort((ne, we) => new Date(we.updatedAt || we.createdAt || "").getTime() - new Date(ne.updatedAt || ne.createdAt || "").getTime()).map((ne) => /* @__PURE__ */ u.jsx(
16897
16906
  ek,
16898
16907
  {
16899
- thread: te,
16900
- isActive: k === te.threadId,
16908
+ thread: ne,
16909
+ isActive: k === ne.threadId,
16901
16910
  editingThreadId: X,
16902
16911
  editingTitle: U,
16903
16912
  onSelect: pt,
16904
16913
  onStartEditing: Pt,
16905
16914
  onEditingTitleChange: (we) => O(we),
16906
- onSaveEditing: Te,
16915
+ onSaveEditing: Ce,
16907
16916
  onCancelEditing: Ge,
16908
- onShare: () => Ke(te.threadId),
16917
+ onShare: () => Ke(ne.threadId),
16909
16918
  onDelete: kt,
16910
16919
  showEditTitle: r,
16911
16920
  showDeleteButton: n,
16912
- formatDate: Ce,
16921
+ formatDate: Ee,
16913
16922
  getDisplayThreadTitle: zt,
16914
- secondaryLine: We && wt(te) ? _t(te) : void 0,
16923
+ secondaryLine: We && wt(ne) ? _t(ne) : void 0,
16915
16924
  itemClassName: s.threadItem,
16916
16925
  activeItemClassName: s.activeThread
16917
16926
  },
16918
- te.threadId
16927
+ ne.threadId
16919
16928
  )) })
16920
16929
  }
16921
16930
  ),
16922
- /* @__PURE__ */ u.jsx(rh, { open: le, onOpenChange: (te) => !te && Ue(), children: /* @__PURE__ */ u.jsxs(kl, { className: "max-w-md p-0", children: [
16931
+ /* @__PURE__ */ u.jsx(rh, { open: le, onOpenChange: (ne) => !ne && Ue(), children: /* @__PURE__ */ u.jsxs(kl, { className: "max-w-md p-0", children: [
16923
16932
  /* @__PURE__ */ u.jsx(Rl, { children: /* @__PURE__ */ u.jsx(Il, { children: "Share thread" }) }),
16924
16933
  /* @__PURE__ */ u.jsxs(Nh, { children: [
16925
16934
  /* @__PURE__ */ u.jsx(
@@ -16927,7 +16936,7 @@ function gi({
16927
16936
  {
16928
16937
  autoFocus: !0,
16929
16938
  value: ie,
16930
- onValueChange: (te) => ge(te),
16939
+ onValueChange: (ne) => ge(ne),
16931
16940
  placeholder: "Search for recipients..."
16932
16941
  }
16933
16942
  ),
@@ -16946,10 +16955,10 @@ function gi({
16946
16955
  /* @__PURE__ */ u.jsx(Xn, { className: "h-4 w-4 animate-spin" }),
16947
16956
  "Loading recipients…"
16948
16957
  ] }) : "No matching recipients found" }),
16949
- Le.length > 0 && /* @__PURE__ */ u.jsx(Ph, { heading: "Recipients", children: Le.map((te) => /* @__PURE__ */ u.jsx(Mh, { onSelect: () => Ye(te), children: /* @__PURE__ */ u.jsxs("div", { className: "flex flex-col items-start text-sm", children: [
16950
- /* @__PURE__ */ u.jsx("span", { className: "font-medium", children: te.label }),
16951
- te.secondaryLabel && /* @__PURE__ */ u.jsx("span", { className: "text-xs text-muted-foreground", children: te.secondaryLabel })
16952
- ] }) }, te.id)) })
16958
+ Le.length > 0 && /* @__PURE__ */ u.jsx(Ph, { heading: "Recipients", children: Le.map((ne) => /* @__PURE__ */ u.jsx(Mh, { onSelect: () => Ye(ne), children: /* @__PURE__ */ u.jsxs("div", { className: "flex flex-col items-start text-sm", children: [
16959
+ /* @__PURE__ */ u.jsx("span", { className: "font-medium", children: ne.label }),
16960
+ ne.secondaryLabel && /* @__PURE__ */ u.jsx("span", { className: "text-xs text-muted-foreground", children: ne.secondaryLabel })
16961
+ ] }) }, ne.id)) })
16953
16962
  ] })
16954
16963
  ] })
16955
16964
  ] }) })
@@ -17579,7 +17588,7 @@ var yk = "SelectItemAlignedPosition", fm = h.forwardRef((e, t) => {
17579
17588
  if (s.trigger && s.valueNode && i && c && g && x && b) {
17580
17589
  const E = s.trigger.getBoundingClientRect(), R = c.getBoundingClientRect(), P = s.valueNode.getBoundingClientRect(), D = b.getBoundingClientRect();
17581
17590
  if (s.dir !== "rtl") {
17582
- const le = D.left - R.left, F = P.left - le, ne = E.left - F, ce = E.width + ne, ie = Math.max(ce, R.width), ge = window.innerWidth - dn, Ne = mi(F, [
17591
+ const le = D.left - R.left, F = P.left - le, te = E.left - F, ce = E.width + te, ie = Math.max(ce, R.width), ge = window.innerWidth - dn, Te = mi(F, [
17583
17592
  dn,
17584
17593
  // Prevents the content from going off the starting edge of the
17585
17594
  // viewport. It may still go off the ending edge, but this can be
@@ -17588,33 +17597,33 @@ var yk = "SelectItemAlignedPosition", fm = h.forwardRef((e, t) => {
17588
17597
  // https://github.com/radix-ui/primitives/issues/2049
17589
17598
  Math.max(dn, ge - ie)
17590
17599
  ]);
17591
- i.style.minWidth = ce + "px", i.style.left = Ne + "px";
17600
+ i.style.minWidth = ce + "px", i.style.left = Te + "px";
17592
17601
  } else {
17593
- const le = R.right - D.right, F = window.innerWidth - P.right - le, ne = window.innerWidth - E.right - F, ce = E.width + ne, ie = Math.max(ce, R.width), ge = window.innerWidth - dn, Ne = mi(F, [
17602
+ const le = R.right - D.right, F = window.innerWidth - P.right - le, te = window.innerWidth - E.right - F, ce = E.width + te, ie = Math.max(ce, R.width), ge = window.innerWidth - dn, Te = mi(F, [
17594
17603
  dn,
17595
17604
  Math.max(dn, ge - ie)
17596
17605
  ]);
17597
- i.style.minWidth = ce + "px", i.style.right = Ne + "px";
17606
+ i.style.minWidth = ce + "px", i.style.right = Te + "px";
17598
17607
  }
17599
17608
  const B = m(), z = window.innerHeight - dn * 2, L = g.scrollHeight, N = window.getComputedStyle(c), V = parseInt(N.borderTopWidth, 10), W = parseInt(N.paddingTop, 10), $ = parseInt(N.borderBottomWidth, 10), j = parseInt(N.paddingBottom, 10), k = V + W + L + j + $, K = Math.min(x.offsetHeight * 5, k), G = window.getComputedStyle(g), A = parseInt(G.paddingTop, 10), _ = parseInt(G.paddingBottom, 10), q = E.top + E.height / 2 - dn, X = z - q, re = x.offsetHeight / 2, U = x.offsetTop + re, O = V + W + U, Y = k - O;
17600
17609
  if (O <= q) {
17601
17610
  const le = B.length > 0 && x === B[B.length - 1].ref.current;
17602
17611
  i.style.bottom = "0px";
17603
- const F = c.clientHeight - g.offsetTop - g.offsetHeight, ne = Math.max(
17612
+ const F = c.clientHeight - g.offsetTop - g.offsetHeight, te = Math.max(
17604
17613
  X,
17605
17614
  re + // viewport might have padding bottom, include it to avoid a scrollable viewport
17606
17615
  (le ? _ : 0) + F + $
17607
- ), ce = O + ne;
17616
+ ), ce = O + te;
17608
17617
  i.style.height = ce + "px";
17609
17618
  } else {
17610
17619
  const le = B.length > 0 && x === B[0].ref.current;
17611
17620
  i.style.top = "0px";
17612
- const ne = Math.max(
17621
+ const te = Math.max(
17613
17622
  q,
17614
17623
  V + g.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
17615
17624
  (le ? A : 0) + re
17616
17625
  ) + Y;
17617
- i.style.height = ne + "px", g.scrollTop = O - q + g.offsetTop;
17626
+ i.style.height = te + "px", g.scrollTop = O - q + g.offsetTop;
17618
17627
  }
17619
17628
  i.style.margin = `${dn}px 0`, i.style.minHeight = K + "px", i.style.maxHeight = z + "px", r == null || r(), requestAnimationFrame(() => f.current = !0);
17620
17629
  }
@@ -19334,11 +19343,11 @@ function bI(e) {
19334
19343
  }
19335
19344
  var yI = (e) => {
19336
19345
  var t, n, r, o, s, a, i, l, c, d, p;
19337
- let { invert: m, toast: f, unstyled: v, interacting: g, setHeights: x, visibleToasts: b, heights: w, index: y, toasts: C, expanded: S, removeToast: T, defaultRichColors: E, closeButton: R, style: P, cancelButtonStyle: D, actionButtonStyle: B, className: z = "", descriptionClassName: L = "", duration: N, position: V, gap: W, loadingIcon: $, expandByDefault: j, classNames: k, icons: K, closeButtonAriaLabel: G = "Close toast", pauseWhenPageIsHidden: A } = e, [_, q] = M.useState(null), [X, re] = M.useState(null), [U, O] = M.useState(!1), [Y, J] = M.useState(!1), [le, F] = M.useState(!1), [ne, ce] = M.useState(!1), [ie, ge] = M.useState(!1), [Ne, je] = M.useState(0), [De, He] = M.useState(0), st = M.useRef(f.duration || N || ju), Et = M.useRef(null), Ke = M.useRef(null), Ue = y === 0, Ye = y + 1 <= b, Le = f.type, We = f.dismissible !== !1, vt = f.className || "", Mt = f.descriptionClassName || "", ut = M.useMemo(() => w.findIndex((xe) => xe.toastId === f.id) || 0, [w, f.id]), _t = M.useMemo(() => {
19346
+ let { invert: m, toast: f, unstyled: v, interacting: g, setHeights: x, visibleToasts: b, heights: w, index: y, toasts: C, expanded: S, removeToast: T, defaultRichColors: E, closeButton: R, style: P, cancelButtonStyle: D, actionButtonStyle: B, className: z = "", descriptionClassName: L = "", duration: N, position: V, gap: W, loadingIcon: $, expandByDefault: j, classNames: k, icons: K, closeButtonAriaLabel: G = "Close toast", pauseWhenPageIsHidden: A } = e, [_, q] = M.useState(null), [X, re] = M.useState(null), [U, O] = M.useState(!1), [Y, J] = M.useState(!1), [le, F] = M.useState(!1), [te, ce] = M.useState(!1), [ie, ge] = M.useState(!1), [Te, je] = M.useState(0), [De, He] = M.useState(0), st = M.useRef(f.duration || N || ju), Et = M.useRef(null), Ke = M.useRef(null), Ue = y === 0, Ye = y + 1 <= b, Le = f.type, We = f.dismissible !== !1, vt = f.className || "", Mt = f.descriptionClassName || "", ut = M.useMemo(() => w.findIndex((xe) => xe.toastId === f.id) || 0, [w, f.id]), _t = M.useMemo(() => {
19338
19347
  var xe;
19339
19348
  return (xe = f.closeButton) != null ? xe : R;
19340
- }, [f.closeButton, R]), wt = M.useMemo(() => f.duration || N || ju, [f.duration, N]), pt = M.useRef(0), bt = M.useRef(0), kt = M.useRef(0), Pt = M.useRef(null), [Te, Ge] = V.split("-"), Ce = M.useMemo(() => w.reduce((xe, Fe, Xe) => Xe >= ut ? xe : xe + Fe.height, 0), [w, ut]), qe = sI(), zt = f.invert || m, te = Le === "loading";
19341
- bt.current = M.useMemo(() => ut * W + Ce, [ut, Ce]), M.useEffect(() => {
19349
+ }, [f.closeButton, R]), wt = M.useMemo(() => f.duration || N || ju, [f.duration, N]), pt = M.useRef(0), bt = M.useRef(0), kt = M.useRef(0), Pt = M.useRef(null), [Ce, Ge] = V.split("-"), Ee = M.useMemo(() => w.reduce((xe, Fe, Xe) => Xe >= ut ? xe : xe + Fe.height, 0), [w, ut]), qe = sI(), zt = f.invert || m, ne = Le === "loading";
19350
+ bt.current = M.useMemo(() => ut * W + Ee, [ut, Ee]), M.useEffect(() => {
19342
19351
  st.current = wt;
19343
19352
  }, [wt]), M.useEffect(() => {
19344
19353
  O(!0);
@@ -19380,13 +19389,13 @@ var yI = (e) => {
19380
19389
  var xe, Fe, Xe;
19381
19390
  return K != null && K.loading ? M.createElement("div", { className: un(k == null ? void 0 : k.loader, (xe = f == null ? void 0 : f.classNames) == null ? void 0 : xe.loader, "sonner-loader"), "data-visible": Le === "loading" }, K.loading) : $ ? M.createElement("div", { className: un(k == null ? void 0 : k.loader, (Fe = f == null ? void 0 : f.classNames) == null ? void 0 : Fe.loader, "sonner-loader"), "data-visible": Le === "loading" }, $) : M.createElement(QR, { className: un(k == null ? void 0 : k.loader, (Xe = f == null ? void 0 : f.classNames) == null ? void 0 : Xe.loader), visible: Le === "loading" });
19382
19391
  }
19383
- return M.createElement("li", { tabIndex: 0, ref: Ke, className: un(z, vt, k == null ? void 0 : k.toast, (t = f == null ? void 0 : f.classNames) == null ? void 0 : t.toast, k == null ? void 0 : k.default, k == null ? void 0 : k[Le], (n = f == null ? void 0 : f.classNames) == null ? void 0 : n[Le]), "data-sonner-toast": "", "data-rich-colors": (r = f.richColors) != null ? r : E, "data-styled": !(f.jsx || f.unstyled || v), "data-mounted": U, "data-promise": !!f.promise, "data-swiped": ie, "data-removed": Y, "data-visible": Ye, "data-y-position": Te, "data-x-position": Ge, "data-index": y, "data-front": Ue, "data-swiping": le, "data-dismissible": We, "data-type": Le, "data-invert": zt, "data-swipe-out": ne, "data-swipe-direction": X, "data-expanded": !!(S || j && U), style: { "--index": y, "--toasts-before": y, "--z-index": C.length - y, "--offset": `${Y ? Ne : bt.current}px`, "--initial-height": j ? "auto" : `${De}px`, ...P, ...f.style }, onDragEnd: () => {
19392
+ return M.createElement("li", { tabIndex: 0, ref: Ke, className: un(z, vt, k == null ? void 0 : k.toast, (t = f == null ? void 0 : f.classNames) == null ? void 0 : t.toast, k == null ? void 0 : k.default, k == null ? void 0 : k[Le], (n = f == null ? void 0 : f.classNames) == null ? void 0 : n[Le]), "data-sonner-toast": "", "data-rich-colors": (r = f.richColors) != null ? r : E, "data-styled": !(f.jsx || f.unstyled || v), "data-mounted": U, "data-promise": !!f.promise, "data-swiped": ie, "data-removed": Y, "data-visible": Ye, "data-y-position": Ce, "data-x-position": Ge, "data-index": y, "data-front": Ue, "data-swiping": le, "data-dismissible": We, "data-type": Le, "data-invert": zt, "data-swipe-out": te, "data-swipe-direction": X, "data-expanded": !!(S || j && U), style: { "--index": y, "--toasts-before": y, "--z-index": C.length - y, "--offset": `${Y ? Te : bt.current}px`, "--initial-height": j ? "auto" : `${De}px`, ...P, ...f.style }, onDragEnd: () => {
19384
19393
  F(!1), q(null), Pt.current = null;
19385
19394
  }, onPointerDown: (xe) => {
19386
- te || !We || (Et.current = /* @__PURE__ */ new Date(), je(bt.current), xe.target.setPointerCapture(xe.pointerId), xe.target.tagName !== "BUTTON" && (F(!0), Pt.current = { x: xe.clientX, y: xe.clientY }));
19395
+ ne || !We || (Et.current = /* @__PURE__ */ new Date(), je(bt.current), xe.target.setPointerCapture(xe.pointerId), xe.target.tagName !== "BUTTON" && (F(!0), Pt.current = { x: xe.clientX, y: xe.clientY }));
19387
19396
  }, onPointerUp: () => {
19388
19397
  var xe, Fe, Xe, Rt;
19389
- if (ne || !We) return;
19398
+ if (te || !We) return;
19390
19399
  Pt.current = null;
19391
19400
  let It = Number(((xe = Ke.current) == null ? void 0 : xe.style.getPropertyValue("--swipe-amount-x").replace("px", "")) || 0), At = Number(((Fe = Ke.current) == null ? void 0 : Fe.style.getPropertyValue("--swipe-amount-y").replace("px", "")) || 0), Ot = (/* @__PURE__ */ new Date()).getTime() - ((Xe = Et.current) == null ? void 0 : Xe.getTime()), Ae = _ === "x" ? It : At, gt = Math.abs(Ae) / Ot;
19392
19401
  if (Math.abs(Ae) >= vI || gt > 0.11) {
@@ -19401,7 +19410,7 @@ var yI = (e) => {
19401
19410
  !_ && (Math.abs(Ot) > 1 || Math.abs(At) > 1) && q(Math.abs(Ot) > Math.abs(At) ? "x" : "y");
19402
19411
  let gt = { x: 0, y: 0 };
19403
19412
  _ === "y" ? (Ae.includes("top") || Ae.includes("bottom")) && (Ae.includes("top") && At < 0 || Ae.includes("bottom") && At > 0) && (gt.y = At) : _ === "x" && (Ae.includes("left") || Ae.includes("right")) && (Ae.includes("left") && Ot < 0 || Ae.includes("right") && Ot > 0) && (gt.x = Ot), (Math.abs(gt.x) > 0 || Math.abs(gt.y) > 0) && ge(!0), (Rt = Ke.current) == null || Rt.style.setProperty("--swipe-amount-x", `${gt.x}px`), (It = Ke.current) == null || It.style.setProperty("--swipe-amount-y", `${gt.y}px`);
19404
- } }, _t && !f.jsx ? M.createElement("button", { "aria-label": G, "data-disabled": te, "data-close-button": !0, onClick: te || !We ? () => {
19413
+ } }, _t && !f.jsx ? M.createElement("button", { "aria-label": G, "data-disabled": ne, "data-close-button": !0, onClick: ne || !We ? () => {
19405
19414
  } : () => {
19406
19415
  var xe;
19407
19416
  we(), (xe = f.onDismiss) == null || xe.call(f, f);