@teodorruskvi/chat-core 0.1.42 → 0.1.43

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
@@ -3,7 +3,7 @@ var Ht = (e, t, n) => t in e ? Gt(e, t, { enumerable: !0, configurable: !0, writ
3
3
  var st = (e, t, n) => Ht(e, typeof t != "symbol" ? t + "" : t, n);
4
4
  import { jsx as ie } from "react/jsx-runtime";
5
5
  import * as at from "react";
6
- import { createContext as Se, useContext as Ue, useState as $, useRef as K, useEffect as q, useCallback as R, useMemo as Q, useReducer as Wt } from "react";
6
+ import { createContext as Se, useContext as Ue, useState as V, useRef as K, useEffect as q, useCallback as z, useMemo as Q, useReducer as Wt } from "react";
7
7
  import qt, { isCancel as Jt } from "axios";
8
8
  function vt(e) {
9
9
  var t, n, r = "";
@@ -196,9 +196,9 @@ const Ze = "-", Qt = (e) => {
196
196
  continue;
197
197
  s.push(C);
198
198
  const T = o(d, k);
199
- for (let N = 0; N < T.length; ++N) {
200
- const w = T[N];
201
- s.push(I + w);
199
+ for (let P = 0; P < T.length; ++P) {
200
+ const b = T[P];
201
+ s.push(I + b);
202
202
  }
203
203
  i = c + (i.length > 0 ? " " + i : i);
204
204
  }
@@ -235,10 +235,10 @@ function un(e, ...t) {
235
235
  return s(ln.apply(null, arguments));
236
236
  };
237
237
  }
238
- const B = (e) => {
238
+ const $ = (e) => {
239
239
  const t = (n) => n[e] || [];
240
240
  return t.isThemeGetter = !0, t;
241
- }, xt = /^\[(?:([a-z-]+):)?(.+)\]$/i, dn = /^\d+\/\d+$/, fn = /* @__PURE__ */ new Set(["px", "full", "screen"]), pn = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/, gn = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/, mn = /^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/, hn = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/, yn = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/, fe = (e) => xe(e) || fn.has(e) || dn.test(e), be = (e) => Ce(e, "length", An), xe = (e) => !!e && !Number.isNaN(Number(e)), Ke = (e) => Ce(e, "number", xe), Pe = (e) => !!e && Number.isInteger(Number(e)), bn = (e) => e.endsWith("%") && xe(e.slice(0, -1)), U = (e) => xt.test(e), we = (e) => pn.test(e), wn = /* @__PURE__ */ new Set(["length", "size", "percentage"]), vn = (e) => Ce(e, wn, At), kn = (e) => Ce(e, "position", At), In = /* @__PURE__ */ new Set(["image", "url"]), Tn = (e) => Ce(e, In, Cn), xn = (e) => Ce(e, "", Sn), Ne = () => !0, Ce = (e, t, n) => {
241
+ }, xt = /^\[(?:([a-z-]+):)?(.+)\]$/i, dn = /^\d+\/\d+$/, fn = /* @__PURE__ */ new Set(["px", "full", "screen"]), pn = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/, gn = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/, mn = /^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/, hn = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/, yn = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/, fe = (e) => xe(e) || fn.has(e) || dn.test(e), be = (e) => Ce(e, "length", An), xe = (e) => !!e && !Number.isNaN(Number(e)), Ke = (e) => Ce(e, "number", xe), Pe = (e) => !!e && Number.isInteger(Number(e)), bn = (e) => e.endsWith("%") && xe(e.slice(0, -1)), R = (e) => xt.test(e), we = (e) => pn.test(e), wn = /* @__PURE__ */ new Set(["length", "size", "percentage"]), vn = (e) => Ce(e, wn, At), kn = (e) => Ce(e, "position", At), In = /* @__PURE__ */ new Set(["image", "url"]), Tn = (e) => Ce(e, In, Cn), xn = (e) => Ce(e, "", Sn), Ne = () => !0, Ce = (e, t, n) => {
242
242
  const r = xt.exec(e);
243
243
  return r ? r[1] ? typeof t == "string" ? r[1] === t : t.has(r[1]) : n(r[2]) : !1;
244
244
  }, An = (e) => (
@@ -247,33 +247,33 @@ const B = (e) => {
247
247
  // I could also use lookbehind assertion in `lengthUnitRegex` but that isn't supported widely enough.
248
248
  gn.test(e) && !mn.test(e)
249
249
  ), At = () => !1, Sn = (e) => hn.test(e), Cn = (e) => yn.test(e), Mn = () => {
250
- const e = B("colors"), t = B("spacing"), n = B("blur"), r = B("brightness"), o = B("borderColor"), s = B("borderRadius"), a = B("borderSpacing"), i = B("borderWidth"), u = B("contrast"), c = B("grayscale"), l = B("hueRotate"), f = B("invert"), m = B("gap"), h = B("gradientColorStops"), k = B("gradientColorStopPositions"), d = B("inset"), v = B("margin"), I = B("opacity"), C = B("padding"), T = B("saturate"), N = B("scale"), w = B("sepia"), y = B("skew"), x = B("space"), p = B("translate"), b = () => ["auto", "contain", "none"], z = () => ["auto", "hidden", "clip", "visible", "scroll"], j = () => ["auto", U, t], M = () => [U, t], O = () => ["", fe, be], E = () => ["auto", xe, U], L = () => ["bottom", "center", "left", "left-bottom", "left-top", "right", "right-bottom", "right-top", "top"], _ = () => ["solid", "dashed", "dotted", "double", "none"], G = () => ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"], F = () => ["start", "end", "center", "between", "around", "evenly", "stretch"], P = () => ["", "0", U], V = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"], Y = () => [xe, U];
250
+ const e = $("colors"), t = $("spacing"), n = $("blur"), r = $("brightness"), o = $("borderColor"), s = $("borderRadius"), a = $("borderSpacing"), i = $("borderWidth"), u = $("contrast"), c = $("grayscale"), l = $("hueRotate"), f = $("invert"), m = $("gap"), h = $("gradientColorStops"), k = $("gradientColorStopPositions"), d = $("inset"), v = $("margin"), I = $("opacity"), C = $("padding"), T = $("saturate"), P = $("scale"), b = $("sepia"), y = $("skew"), x = $("space"), p = $("translate"), w = () => ["auto", "contain", "none"], _ = () => ["auto", "hidden", "clip", "visible", "scroll"], U = () => ["auto", R, t], M = () => [R, t], E = () => ["", fe, be], j = () => ["auto", xe, R], N = () => ["bottom", "center", "left", "left-bottom", "left-top", "right", "right-bottom", "right-top", "top"], B = () => ["solid", "dashed", "dotted", "double", "none"], O = () => ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"], L = () => ["start", "end", "center", "between", "around", "evenly", "stretch"], F = () => ["", "0", R], W = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"], Y = () => [xe, R];
251
251
  return {
252
252
  cacheSize: 500,
253
253
  separator: ":",
254
254
  theme: {
255
255
  colors: [Ne],
256
256
  spacing: [fe, be],
257
- blur: ["none", "", we, U],
257
+ blur: ["none", "", we, R],
258
258
  brightness: Y(),
259
259
  borderColor: [e],
260
- borderRadius: ["none", "", "full", we, U],
260
+ borderRadius: ["none", "", "full", we, R],
261
261
  borderSpacing: M(),
262
- borderWidth: O(),
262
+ borderWidth: E(),
263
263
  contrast: Y(),
264
- grayscale: P(),
264
+ grayscale: F(),
265
265
  hueRotate: Y(),
266
- invert: P(),
266
+ invert: F(),
267
267
  gap: M(),
268
268
  gradientColorStops: [e],
269
269
  gradientColorStopPositions: [bn, be],
270
- inset: j(),
271
- margin: j(),
270
+ inset: U(),
271
+ margin: U(),
272
272
  opacity: Y(),
273
273
  padding: M(),
274
274
  saturate: Y(),
275
275
  scale: Y(),
276
- sepia: P(),
276
+ sepia: F(),
277
277
  skew: Y(),
278
278
  space: M(),
279
279
  translate: M()
@@ -285,7 +285,7 @@ const B = (e) => {
285
285
  * @see https://tailwindcss.com/docs/aspect-ratio
286
286
  */
287
287
  aspect: [{
288
- aspect: ["auto", "square", "video", U]
288
+ aspect: ["auto", "square", "video", R]
289
289
  }],
290
290
  /**
291
291
  * Container
@@ -304,14 +304,14 @@ const B = (e) => {
304
304
  * @see https://tailwindcss.com/docs/break-after
305
305
  */
306
306
  "break-after": [{
307
- "break-after": V()
307
+ "break-after": W()
308
308
  }],
309
309
  /**
310
310
  * Break Before
311
311
  * @see https://tailwindcss.com/docs/break-before
312
312
  */
313
313
  "break-before": [{
314
- "break-before": V()
314
+ "break-before": W()
315
315
  }],
316
316
  /**
317
317
  * Break Inside
@@ -370,49 +370,49 @@ const B = (e) => {
370
370
  * @see https://tailwindcss.com/docs/object-position
371
371
  */
372
372
  "object-position": [{
373
- object: [...L(), U]
373
+ object: [...N(), R]
374
374
  }],
375
375
  /**
376
376
  * Overflow
377
377
  * @see https://tailwindcss.com/docs/overflow
378
378
  */
379
379
  overflow: [{
380
- overflow: z()
380
+ overflow: _()
381
381
  }],
382
382
  /**
383
383
  * Overflow X
384
384
  * @see https://tailwindcss.com/docs/overflow
385
385
  */
386
386
  "overflow-x": [{
387
- "overflow-x": z()
387
+ "overflow-x": _()
388
388
  }],
389
389
  /**
390
390
  * Overflow Y
391
391
  * @see https://tailwindcss.com/docs/overflow
392
392
  */
393
393
  "overflow-y": [{
394
- "overflow-y": z()
394
+ "overflow-y": _()
395
395
  }],
396
396
  /**
397
397
  * Overscroll Behavior
398
398
  * @see https://tailwindcss.com/docs/overscroll-behavior
399
399
  */
400
400
  overscroll: [{
401
- overscroll: b()
401
+ overscroll: w()
402
402
  }],
403
403
  /**
404
404
  * Overscroll Behavior X
405
405
  * @see https://tailwindcss.com/docs/overscroll-behavior
406
406
  */
407
407
  "overscroll-x": [{
408
- "overscroll-x": b()
408
+ "overscroll-x": w()
409
409
  }],
410
410
  /**
411
411
  * Overscroll Behavior Y
412
412
  * @see https://tailwindcss.com/docs/overscroll-behavior
413
413
  */
414
414
  "overscroll-y": [{
415
- "overscroll-y": b()
415
+ "overscroll-y": w()
416
416
  }],
417
417
  /**
418
418
  * Position
@@ -492,7 +492,7 @@ const B = (e) => {
492
492
  * @see https://tailwindcss.com/docs/z-index
493
493
  */
494
494
  z: [{
495
- z: ["auto", Pe, U]
495
+ z: ["auto", Pe, R]
496
496
  }],
497
497
  // Flexbox and Grid
498
498
  /**
@@ -500,7 +500,7 @@ const B = (e) => {
500
500
  * @see https://tailwindcss.com/docs/flex-basis
501
501
  */
502
502
  basis: [{
503
- basis: j()
503
+ basis: U()
504
504
  }],
505
505
  /**
506
506
  * Flex Direction
@@ -521,28 +521,28 @@ const B = (e) => {
521
521
  * @see https://tailwindcss.com/docs/flex
522
522
  */
523
523
  flex: [{
524
- flex: ["1", "auto", "initial", "none", U]
524
+ flex: ["1", "auto", "initial", "none", R]
525
525
  }],
526
526
  /**
527
527
  * Flex Grow
528
528
  * @see https://tailwindcss.com/docs/flex-grow
529
529
  */
530
530
  grow: [{
531
- grow: P()
531
+ grow: F()
532
532
  }],
533
533
  /**
534
534
  * Flex Shrink
535
535
  * @see https://tailwindcss.com/docs/flex-shrink
536
536
  */
537
537
  shrink: [{
538
- shrink: P()
538
+ shrink: F()
539
539
  }],
540
540
  /**
541
541
  * Order
542
542
  * @see https://tailwindcss.com/docs/order
543
543
  */
544
544
  order: [{
545
- order: ["first", "last", "none", Pe, U]
545
+ order: ["first", "last", "none", Pe, R]
546
546
  }],
547
547
  /**
548
548
  * Grid Template Columns
@@ -557,22 +557,22 @@ const B = (e) => {
557
557
  */
558
558
  "col-start-end": [{
559
559
  col: ["auto", {
560
- span: ["full", Pe, U]
561
- }, U]
560
+ span: ["full", Pe, R]
561
+ }, R]
562
562
  }],
563
563
  /**
564
564
  * Grid Column Start
565
565
  * @see https://tailwindcss.com/docs/grid-column
566
566
  */
567
567
  "col-start": [{
568
- "col-start": E()
568
+ "col-start": j()
569
569
  }],
570
570
  /**
571
571
  * Grid Column End
572
572
  * @see https://tailwindcss.com/docs/grid-column
573
573
  */
574
574
  "col-end": [{
575
- "col-end": E()
575
+ "col-end": j()
576
576
  }],
577
577
  /**
578
578
  * Grid Template Rows
@@ -587,22 +587,22 @@ const B = (e) => {
587
587
  */
588
588
  "row-start-end": [{
589
589
  row: ["auto", {
590
- span: [Pe, U]
591
- }, U]
590
+ span: [Pe, R]
591
+ }, R]
592
592
  }],
593
593
  /**
594
594
  * Grid Row Start
595
595
  * @see https://tailwindcss.com/docs/grid-row
596
596
  */
597
597
  "row-start": [{
598
- "row-start": E()
598
+ "row-start": j()
599
599
  }],
600
600
  /**
601
601
  * Grid Row End
602
602
  * @see https://tailwindcss.com/docs/grid-row
603
603
  */
604
604
  "row-end": [{
605
- "row-end": E()
605
+ "row-end": j()
606
606
  }],
607
607
  /**
608
608
  * Grid Auto Flow
@@ -616,14 +616,14 @@ const B = (e) => {
616
616
  * @see https://tailwindcss.com/docs/grid-auto-columns
617
617
  */
618
618
  "auto-cols": [{
619
- "auto-cols": ["auto", "min", "max", "fr", U]
619
+ "auto-cols": ["auto", "min", "max", "fr", R]
620
620
  }],
621
621
  /**
622
622
  * Grid Auto Rows
623
623
  * @see https://tailwindcss.com/docs/grid-auto-rows
624
624
  */
625
625
  "auto-rows": [{
626
- "auto-rows": ["auto", "min", "max", "fr", U]
626
+ "auto-rows": ["auto", "min", "max", "fr", R]
627
627
  }],
628
628
  /**
629
629
  * Gap
@@ -651,7 +651,7 @@ const B = (e) => {
651
651
  * @see https://tailwindcss.com/docs/justify-content
652
652
  */
653
653
  "justify-content": [{
654
- justify: ["normal", ...F()]
654
+ justify: ["normal", ...L()]
655
655
  }],
656
656
  /**
657
657
  * Justify Items
@@ -672,7 +672,7 @@ const B = (e) => {
672
672
  * @see https://tailwindcss.com/docs/align-content
673
673
  */
674
674
  "align-content": [{
675
- content: ["normal", ...F(), "baseline"]
675
+ content: ["normal", ...L(), "baseline"]
676
676
  }],
677
677
  /**
678
678
  * Align Items
@@ -693,7 +693,7 @@ const B = (e) => {
693
693
  * @see https://tailwindcss.com/docs/place-content
694
694
  */
695
695
  "place-content": [{
696
- "place-content": [...F(), "baseline"]
696
+ "place-content": [...L(), "baseline"]
697
697
  }],
698
698
  /**
699
699
  * Place Items
@@ -866,21 +866,21 @@ const B = (e) => {
866
866
  * @see https://tailwindcss.com/docs/width
867
867
  */
868
868
  w: [{
869
- w: ["auto", "min", "max", "fit", "svw", "lvw", "dvw", U, t]
869
+ w: ["auto", "min", "max", "fit", "svw", "lvw", "dvw", R, t]
870
870
  }],
871
871
  /**
872
872
  * Min-Width
873
873
  * @see https://tailwindcss.com/docs/min-width
874
874
  */
875
875
  "min-w": [{
876
- "min-w": [U, t, "min", "max", "fit"]
876
+ "min-w": [R, t, "min", "max", "fit"]
877
877
  }],
878
878
  /**
879
879
  * Max-Width
880
880
  * @see https://tailwindcss.com/docs/max-width
881
881
  */
882
882
  "max-w": [{
883
- "max-w": [U, t, "none", "full", "min", "max", "fit", "prose", {
883
+ "max-w": [R, t, "none", "full", "min", "max", "fit", "prose", {
884
884
  screen: [we]
885
885
  }, we]
886
886
  }],
@@ -889,28 +889,28 @@ const B = (e) => {
889
889
  * @see https://tailwindcss.com/docs/height
890
890
  */
891
891
  h: [{
892
- h: [U, t, "auto", "min", "max", "fit", "svh", "lvh", "dvh"]
892
+ h: [R, t, "auto", "min", "max", "fit", "svh", "lvh", "dvh"]
893
893
  }],
894
894
  /**
895
895
  * Min-Height
896
896
  * @see https://tailwindcss.com/docs/min-height
897
897
  */
898
898
  "min-h": [{
899
- "min-h": [U, t, "min", "max", "fit", "svh", "lvh", "dvh"]
899
+ "min-h": [R, t, "min", "max", "fit", "svh", "lvh", "dvh"]
900
900
  }],
901
901
  /**
902
902
  * Max-Height
903
903
  * @see https://tailwindcss.com/docs/max-height
904
904
  */
905
905
  "max-h": [{
906
- "max-h": [U, t, "min", "max", "fit", "svh", "lvh", "dvh"]
906
+ "max-h": [R, t, "min", "max", "fit", "svh", "lvh", "dvh"]
907
907
  }],
908
908
  /**
909
909
  * Size
910
910
  * @see https://tailwindcss.com/docs/size
911
911
  */
912
912
  size: [{
913
- size: [U, t, "auto", "min", "max", "fit"]
913
+ size: [R, t, "auto", "min", "max", "fit"]
914
914
  }],
915
915
  // Typography
916
916
  /**
@@ -979,7 +979,7 @@ const B = (e) => {
979
979
  * @see https://tailwindcss.com/docs/letter-spacing
980
980
  */
981
981
  tracking: [{
982
- tracking: ["tighter", "tight", "normal", "wide", "wider", "widest", U]
982
+ tracking: ["tighter", "tight", "normal", "wide", "wider", "widest", R]
983
983
  }],
984
984
  /**
985
985
  * Line Clamp
@@ -993,21 +993,21 @@ const B = (e) => {
993
993
  * @see https://tailwindcss.com/docs/line-height
994
994
  */
995
995
  leading: [{
996
- leading: ["none", "tight", "snug", "normal", "relaxed", "loose", fe, U]
996
+ leading: ["none", "tight", "snug", "normal", "relaxed", "loose", fe, R]
997
997
  }],
998
998
  /**
999
999
  * List Style Image
1000
1000
  * @see https://tailwindcss.com/docs/list-style-image
1001
1001
  */
1002
1002
  "list-image": [{
1003
- "list-image": ["none", U]
1003
+ "list-image": ["none", R]
1004
1004
  }],
1005
1005
  /**
1006
1006
  * List Style Type
1007
1007
  * @see https://tailwindcss.com/docs/list-style-type
1008
1008
  */
1009
1009
  "list-style-type": [{
1010
- list: ["none", "disc", "decimal", U]
1010
+ list: ["none", "disc", "decimal", R]
1011
1011
  }],
1012
1012
  /**
1013
1013
  * List Style Position
@@ -1062,7 +1062,7 @@ const B = (e) => {
1062
1062
  * @see https://tailwindcss.com/docs/text-decoration-style
1063
1063
  */
1064
1064
  "text-decoration-style": [{
1065
- decoration: [..._(), "wavy"]
1065
+ decoration: [...B(), "wavy"]
1066
1066
  }],
1067
1067
  /**
1068
1068
  * Text Decoration Thickness
@@ -1076,7 +1076,7 @@ const B = (e) => {
1076
1076
  * @see https://tailwindcss.com/docs/text-underline-offset
1077
1077
  */
1078
1078
  "underline-offset": [{
1079
- "underline-offset": ["auto", fe, U]
1079
+ "underline-offset": ["auto", fe, R]
1080
1080
  }],
1081
1081
  /**
1082
1082
  * Text Decoration Color
@@ -1114,7 +1114,7 @@ const B = (e) => {
1114
1114
  * @see https://tailwindcss.com/docs/vertical-align
1115
1115
  */
1116
1116
  "vertical-align": [{
1117
- align: ["baseline", "top", "middle", "bottom", "text-top", "text-bottom", "sub", "super", U]
1117
+ align: ["baseline", "top", "middle", "bottom", "text-top", "text-bottom", "sub", "super", R]
1118
1118
  }],
1119
1119
  /**
1120
1120
  * Whitespace
@@ -1142,7 +1142,7 @@ const B = (e) => {
1142
1142
  * @see https://tailwindcss.com/docs/content
1143
1143
  */
1144
1144
  content: [{
1145
- content: ["none", U]
1145
+ content: ["none", R]
1146
1146
  }],
1147
1147
  // Backgrounds
1148
1148
  /**
@@ -1179,7 +1179,7 @@ const B = (e) => {
1179
1179
  * @see https://tailwindcss.com/docs/background-position
1180
1180
  */
1181
1181
  "bg-position": [{
1182
- bg: [...L(), kn]
1182
+ bg: [...N(), kn]
1183
1183
  }],
1184
1184
  /**
1185
1185
  * Background Repeat
@@ -1436,7 +1436,7 @@ const B = (e) => {
1436
1436
  * @see https://tailwindcss.com/docs/border-style
1437
1437
  */
1438
1438
  "border-style": [{
1439
- border: [..._(), "hidden"]
1439
+ border: [...B(), "hidden"]
1440
1440
  }],
1441
1441
  /**
1442
1442
  * Divide Width X
@@ -1474,7 +1474,7 @@ const B = (e) => {
1474
1474
  * @see https://tailwindcss.com/docs/divide-style
1475
1475
  */
1476
1476
  "divide-style": [{
1477
- divide: _()
1477
+ divide: B()
1478
1478
  }],
1479
1479
  /**
1480
1480
  * Border Color
@@ -1551,14 +1551,14 @@ const B = (e) => {
1551
1551
  * @see https://tailwindcss.com/docs/outline-style
1552
1552
  */
1553
1553
  "outline-style": [{
1554
- outline: ["", ..._()]
1554
+ outline: ["", ...B()]
1555
1555
  }],
1556
1556
  /**
1557
1557
  * Outline Offset
1558
1558
  * @see https://tailwindcss.com/docs/outline-offset
1559
1559
  */
1560
1560
  "outline-offset": [{
1561
- "outline-offset": [fe, U]
1561
+ "outline-offset": [fe, R]
1562
1562
  }],
1563
1563
  /**
1564
1564
  * Outline Width
@@ -1579,7 +1579,7 @@ const B = (e) => {
1579
1579
  * @see https://tailwindcss.com/docs/ring-width
1580
1580
  */
1581
1581
  "ring-w": [{
1582
- ring: O()
1582
+ ring: E()
1583
1583
  }],
1584
1584
  /**
1585
1585
  * Ring Width Inset
@@ -1641,14 +1641,14 @@ const B = (e) => {
1641
1641
  * @see https://tailwindcss.com/docs/mix-blend-mode
1642
1642
  */
1643
1643
  "mix-blend": [{
1644
- "mix-blend": [...G(), "plus-lighter", "plus-darker"]
1644
+ "mix-blend": [...O(), "plus-lighter", "plus-darker"]
1645
1645
  }],
1646
1646
  /**
1647
1647
  * Background Blend Mode
1648
1648
  * @see https://tailwindcss.com/docs/background-blend-mode
1649
1649
  */
1650
1650
  "bg-blend": [{
1651
- "bg-blend": G()
1651
+ "bg-blend": O()
1652
1652
  }],
1653
1653
  // Filters
1654
1654
  /**
@@ -1685,7 +1685,7 @@ const B = (e) => {
1685
1685
  * @see https://tailwindcss.com/docs/drop-shadow
1686
1686
  */
1687
1687
  "drop-shadow": [{
1688
- "drop-shadow": ["", "none", we, U]
1688
+ "drop-shadow": ["", "none", we, R]
1689
1689
  }],
1690
1690
  /**
1691
1691
  * Grayscale
@@ -1720,7 +1720,7 @@ const B = (e) => {
1720
1720
  * @see https://tailwindcss.com/docs/sepia
1721
1721
  */
1722
1722
  sepia: [{
1723
- sepia: [w]
1723
+ sepia: [b]
1724
1724
  }],
1725
1725
  /**
1726
1726
  * Backdrop Filter
@@ -1791,7 +1791,7 @@ const B = (e) => {
1791
1791
  * @see https://tailwindcss.com/docs/backdrop-sepia
1792
1792
  */
1793
1793
  "backdrop-sepia": [{
1794
- "backdrop-sepia": [w]
1794
+ "backdrop-sepia": [b]
1795
1795
  }],
1796
1796
  // Tables
1797
1797
  /**
@@ -1842,7 +1842,7 @@ const B = (e) => {
1842
1842
  * @see https://tailwindcss.com/docs/transition-property
1843
1843
  */
1844
1844
  transition: [{
1845
- transition: ["none", "all", "", "colors", "opacity", "shadow", "transform", U]
1845
+ transition: ["none", "all", "", "colors", "opacity", "shadow", "transform", R]
1846
1846
  }],
1847
1847
  /**
1848
1848
  * Transition Duration
@@ -1856,7 +1856,7 @@ const B = (e) => {
1856
1856
  * @see https://tailwindcss.com/docs/transition-timing-function
1857
1857
  */
1858
1858
  ease: [{
1859
- ease: ["linear", "in", "out", "in-out", U]
1859
+ ease: ["linear", "in", "out", "in-out", R]
1860
1860
  }],
1861
1861
  /**
1862
1862
  * Transition Delay
@@ -1870,7 +1870,7 @@ const B = (e) => {
1870
1870
  * @see https://tailwindcss.com/docs/animation
1871
1871
  */
1872
1872
  animate: [{
1873
- animate: ["none", "spin", "ping", "pulse", "bounce", U]
1873
+ animate: ["none", "spin", "ping", "pulse", "bounce", R]
1874
1874
  }],
1875
1875
  // Transforms
1876
1876
  /**
@@ -1885,28 +1885,28 @@ const B = (e) => {
1885
1885
  * @see https://tailwindcss.com/docs/scale
1886
1886
  */
1887
1887
  scale: [{
1888
- scale: [N]
1888
+ scale: [P]
1889
1889
  }],
1890
1890
  /**
1891
1891
  * Scale X
1892
1892
  * @see https://tailwindcss.com/docs/scale
1893
1893
  */
1894
1894
  "scale-x": [{
1895
- "scale-x": [N]
1895
+ "scale-x": [P]
1896
1896
  }],
1897
1897
  /**
1898
1898
  * Scale Y
1899
1899
  * @see https://tailwindcss.com/docs/scale
1900
1900
  */
1901
1901
  "scale-y": [{
1902
- "scale-y": [N]
1902
+ "scale-y": [P]
1903
1903
  }],
1904
1904
  /**
1905
1905
  * Rotate
1906
1906
  * @see https://tailwindcss.com/docs/rotate
1907
1907
  */
1908
1908
  rotate: [{
1909
- rotate: [Pe, U]
1909
+ rotate: [Pe, R]
1910
1910
  }],
1911
1911
  /**
1912
1912
  * Translate X
@@ -1941,7 +1941,7 @@ const B = (e) => {
1941
1941
  * @see https://tailwindcss.com/docs/transform-origin
1942
1942
  */
1943
1943
  "transform-origin": [{
1944
- origin: ["center", "top", "top-right", "right", "bottom-right", "bottom", "bottom-left", "left", "top-left", U]
1944
+ origin: ["center", "top", "top-right", "right", "bottom-right", "bottom", "bottom-left", "left", "top-left", R]
1945
1945
  }],
1946
1946
  // Interactivity
1947
1947
  /**
@@ -1963,7 +1963,7 @@ const B = (e) => {
1963
1963
  * @see https://tailwindcss.com/docs/cursor
1964
1964
  */
1965
1965
  cursor: [{
1966
- cursor: ["auto", "default", "pointer", "wait", "text", "move", "help", "not-allowed", "none", "context-menu", "progress", "cell", "crosshair", "vertical-text", "alias", "copy", "no-drop", "grab", "grabbing", "all-scroll", "col-resize", "row-resize", "n-resize", "e-resize", "s-resize", "w-resize", "ne-resize", "nw-resize", "se-resize", "sw-resize", "ew-resize", "ns-resize", "nesw-resize", "nwse-resize", "zoom-in", "zoom-out", U]
1966
+ cursor: ["auto", "default", "pointer", "wait", "text", "move", "help", "not-allowed", "none", "context-menu", "progress", "cell", "crosshair", "vertical-text", "alias", "copy", "no-drop", "grab", "grabbing", "all-scroll", "col-resize", "row-resize", "n-resize", "e-resize", "s-resize", "w-resize", "ne-resize", "nw-resize", "se-resize", "sw-resize", "ew-resize", "ns-resize", "nesw-resize", "nwse-resize", "zoom-in", "zoom-out", R]
1967
1967
  }],
1968
1968
  /**
1969
1969
  * Caret Color
@@ -2185,7 +2185,7 @@ const B = (e) => {
2185
2185
  * @see https://tailwindcss.com/docs/will-change
2186
2186
  */
2187
2187
  "will-change": [{
2188
- "will-change": ["auto", "scroll", "contents", "transform", U]
2188
+ "will-change": ["auto", "scroll", "contents", "transform", R]
2189
2189
  }],
2190
2190
  // SVG
2191
2191
  /**
@@ -2448,12 +2448,12 @@ function le(e) {
2448
2448
  );
2449
2449
  }
2450
2450
  function tt(e) {
2451
- var v, I, C, T, N, w;
2451
+ var v, I, C, T, P, b;
2452
2452
  if (!e || typeof e != "object") return null;
2453
2453
  const t = le(e), n = Vn(t);
2454
2454
  if (!n)
2455
2455
  return null;
2456
- const r = Array.isArray(t.toolCalls) ? t.toolCalls.map(nt) : void 0, o = $n(t.content ?? t.parts, !!(r != null && r.length)), s = t.id ?? `msg-${Date.now().toString(16)}-${Math.random().toString(16).slice(2)}`, a = t.createdAt ?? ((v = t.additionalKwargs) == null ? void 0 : v.createdAt) ?? (/* @__PURE__ */ new Date()).toISOString(), i = t.name ?? ((I = t.additionalKwargs) == null ? void 0 : I.agentName) ?? void 0, u = t.model ?? ((C = t.additionalKwargs) == null ? void 0 : C.model) ?? void 0, c = t.toolCallId ?? void 0, l = t.additionalKwargs ?? void 0, f = t.responseMetadata ?? void 0, m = t.checkpointId ?? ((T = t.additionalKwargs) == null ? void 0 : T.checkpointId) ?? void 0, h = t.checkpointNs ?? ((N = t.additionalKwargs) == null ? void 0 : N.checkpointNs) ?? void 0, k = typeof t.toolStreaming == "boolean" ? t.toolStreaming : !!((w = t.additionalKwargs) != null && w.toolStreaming);
2456
+ const r = Array.isArray(t.toolCalls) ? t.toolCalls.map(nt) : void 0, o = $n(t.content ?? t.parts, !!(r != null && r.length)), s = t.id ?? `msg-${Date.now().toString(16)}-${Math.random().toString(16).slice(2)}`, a = t.createdAt ?? ((v = t.additionalKwargs) == null ? void 0 : v.createdAt) ?? (/* @__PURE__ */ new Date()).toISOString(), i = t.name ?? ((I = t.additionalKwargs) == null ? void 0 : I.agentName) ?? void 0, u = t.model ?? ((C = t.additionalKwargs) == null ? void 0 : C.model) ?? void 0, c = t.toolCallId ?? void 0, l = t.additionalKwargs ?? void 0, f = t.responseMetadata ?? void 0, m = t.checkpointId ?? ((T = t.additionalKwargs) == null ? void 0 : T.checkpointId) ?? void 0, h = t.checkpointNs ?? ((P = t.additionalKwargs) == null ? void 0 : P.checkpointNs) ?? void 0, k = typeof t.toolStreaming == "boolean" ? t.toolStreaming : !!((b = t.additionalKwargs) != null && b.toolStreaming);
2457
2457
  return {
2458
2458
  ...t,
2459
2459
  id: s,
@@ -2952,33 +2952,33 @@ function ir(e) {
2952
2952
  return !!e && typeof e == "object" && "data" in e;
2953
2953
  }
2954
2954
  function cr(e = {}) {
2955
- const t = e.baseUrl || "", n = e.streamPath ?? "/stream", [r, o] = $(e.token ?? null), s = K(e.headers ?? {}), a = e.credentials ?? "include", i = K(e);
2955
+ const t = e.baseUrl || "", n = e.streamPath ?? "/stream", [r, o] = V(e.token ?? null), s = K(e.headers ?? {}), a = e.credentials ?? "include", i = K(e);
2956
2956
  q(() => {
2957
2957
  i.current = e;
2958
2958
  }, [e]);
2959
- const u = R((p) => {
2960
- var j, M, O, E, L, _, G, F, P, V;
2961
- const b = i.current;
2962
- if (!b) return;
2963
- (j = b.onEvent) == null || j.call(b, p), p.type === "thread_info" && ((M = b.onThreadInfo) == null || M.call(b, p)), p.type === "values" && Array.isArray(p.checkpoints) && ((O = b.handleValuesEvent) == null || O.call(b, p)), p.type === "metadata" && ((E = b.onMetadataEvent) == null || E.call(b, p)), typeof p.type == "string" && (p.type === "custom" || p.type.startsWith("custom.")) && ((L = b.onCustomEvent) == null || L.call(b, p)), p.type === "updates" && ((_ = b.onUpdateEvent) == null || _.call(b, p)), p.type === "tool.end" ? (G = b.onToolEnd) == null || G.call(b, p) : p.type === "tool.start" && ((F = b.onToolStart) == null || F.call(b, p)), p.type === "heartbeat" && ((P = b.onHeartbeat) == null || P.call(b, p)), p.type === "token" && ((V = b.onToken) == null || V.call(b, p.token));
2964
- }, []), [c, l] = $(!1), [f, m] = $(null), [h, k] = $(!1), [d, v] = $(null), I = K(null), C = K(!0), T = K(null), N = R((p) => {
2959
+ const u = z((p) => {
2960
+ var U, M, E, j, N, B, O, L, F, W;
2961
+ const w = i.current;
2962
+ if (!w) return;
2963
+ (U = w.onEvent) == null || U.call(w, p), p.type === "thread_info" && ((M = w.onThreadInfo) == null || M.call(w, p)), p.type === "values" && Array.isArray(p.checkpoints) && ((E = w.handleValuesEvent) == null || E.call(w, p)), p.type === "metadata" && ((j = w.onMetadataEvent) == null || j.call(w, p)), typeof p.type == "string" && (p.type === "custom" || p.type.startsWith("custom.")) && ((N = w.onCustomEvent) == null || N.call(w, p)), p.type === "updates" && ((B = w.onUpdateEvent) == null || B.call(w, p)), p.type === "tool.end" ? (O = w.onToolEnd) == null || O.call(w, p) : p.type === "tool.start" && ((L = w.onToolStart) == null || L.call(w, p)), p.type === "heartbeat" && ((F = w.onHeartbeat) == null || F.call(w, p)), p.type === "token" && ((W = w.onToken) == null || W.call(w, p.token));
2964
+ }, []), [c, l] = V(!1), [f, m] = V(null), [h, k] = V(!1), [d, v] = V(null), I = K(null), C = K(!0), T = K(null), P = z((p) => {
2965
2965
  o(p);
2966
- }, []), w = R(() => {
2966
+ }, []), b = z(() => {
2967
2967
  m(null), v(null);
2968
- }, []), y = R(() => {
2969
- var M, O;
2968
+ }, []), y = z(() => {
2969
+ var M, E;
2970
2970
  console.debug("[use-chat] stop() invoked - aborting stream");
2971
- const p = (M = T.current) == null ? void 0 : M.threadId, b = (O = T.current) == null ? void 0 : O.runId, z = () => {
2972
- var E;
2973
- (E = I.current) == null || E.abort(), I.current = null, T.current = null, l(!1), k(!1);
2971
+ const p = (M = T.current) == null ? void 0 : M.threadId, w = (E = T.current) == null ? void 0 : E.runId, _ = () => {
2972
+ var j;
2973
+ (j = I.current) == null || j.abort(), I.current = null, T.current = null, l(!1), k(!1);
2974
2974
  };
2975
- (b || p ? _t.cancelRun(b || p).catch((E) => {
2976
- console.warn("[use-chat] cancel run failed:", E);
2977
- }) : Promise.resolve()).finally(z);
2978
- }, []), x = R(
2975
+ (w || p ? _t.cancelRun(w || p).catch((j) => {
2976
+ console.warn("[use-chat] cancel run failed:", j);
2977
+ }) : Promise.resolve()).finally(_);
2978
+ }, []), x = z(
2979
2979
  (p) => {
2980
2980
  I.current && (I.current.abort(), I.current = null);
2981
- const b = {
2981
+ const w = {
2982
2982
  text: typeof p.content == "string" ? p.content : p.text,
2983
2983
  threadId: p.threadId,
2984
2984
  attachments: p.attachments,
@@ -2990,46 +2990,46 @@ function cr(e = {}) {
2990
2990
  command: p.command
2991
2991
  };
2992
2992
  l(!0), m(null), v(null);
2993
- const z = new AbortController();
2994
- I.current = z;
2995
- let j = null, M = !1;
2993
+ const _ = new AbortController();
2994
+ I.current = _;
2995
+ let U = null, M = !1;
2996
2996
  return T.current = {
2997
- threadId: b.threadId ?? void 0,
2997
+ threadId: w.threadId ?? void 0,
2998
2998
  runId: void 0,
2999
2999
  // Will be updated from headers
3000
3000
  headers: {},
3001
3001
  isStreaming: !0
3002
3002
  }, (async () => {
3003
- var O, E, L, _, G, F;
3003
+ var E, j, N, B, O, L;
3004
3004
  try {
3005
- let P = {};
3005
+ let F = {};
3006
3006
  try {
3007
3007
  if (r)
3008
- P = { Authorization: `Bearer ${r}` };
3008
+ F = { Authorization: `Bearer ${r}` };
3009
3009
  else if (typeof window < "u") {
3010
- const te = window.__AUTH_TOKEN__, ve = ((O = window.localStorage) == null ? void 0 : O.getItem(_e.authToken)) || null;
3010
+ const te = window.__AUTH_TOKEN__, ve = ((E = window.localStorage) == null ? void 0 : E.getItem(_e.authToken)) || null;
3011
3011
  let X = null;
3012
3012
  try {
3013
- const me = (E = window.localStorage) == null ? void 0 : E.getItem(_e.chatSettings);
3014
- me && (X = ((L = JSON.parse(me)) == null ? void 0 : L.apiKey) || null);
3013
+ const me = (j = window.localStorage) == null ? void 0 : j.getItem(_e.chatSettings);
3014
+ me && (X = ((N = JSON.parse(me)) == null ? void 0 : N.apiKey) || null);
3015
3015
  } catch {
3016
3016
  }
3017
3017
  const Z = te || ve || X || null;
3018
- Z && (P = { Authorization: `Bearer ${Z}` });
3018
+ Z && (F = { Authorization: `Bearer ${Z}` });
3019
3019
  }
3020
3020
  } catch {
3021
3021
  }
3022
3022
  console.debug("[use-chat] POST", t + n);
3023
- let V = {};
3023
+ let W = {};
3024
3024
  if (typeof window < "u")
3025
3025
  try {
3026
- const W = (_ = window.localStorage) == null ? void 0 : _.getItem(_e.authSessionId);
3027
- W && (V = { "X-Session-Id": W });
3026
+ const H = (B = window.localStorage) == null ? void 0 : B.getItem(_e.authSessionId);
3027
+ H && (W = { "X-Session-Id": H });
3028
3028
  } catch {
3029
3029
  }
3030
3030
  const Y = {
3031
- ...P,
3032
- ...V,
3031
+ ...F,
3032
+ ...W,
3033
3033
  ...s.current
3034
3034
  }, g = {
3035
3035
  "Content-Type": "application/json",
@@ -3038,36 +3038,36 @@ function cr(e = {}) {
3038
3038
  }, A = await fetch(t + n, {
3039
3039
  method: "POST",
3040
3040
  headers: g,
3041
- body: JSON.stringify(b),
3042
- signal: z.signal,
3041
+ body: JSON.stringify(w),
3042
+ signal: _.signal,
3043
3043
  credentials: a
3044
3044
  });
3045
3045
  if (T.current && (T.current.headers = Y), !A.ok || !A.body) {
3046
- const W = await A.text().catch(() => "");
3046
+ const H = await A.text().catch(() => "");
3047
3047
  console.debug(
3048
3048
  "[use-chat] non-OK response",
3049
3049
  A.status,
3050
- W == null ? void 0 : W.slice(0, 500)
3050
+ H == null ? void 0 : H.slice(0, 500)
3051
3051
  );
3052
- const te = `stream ${A.status}${W ? ": " + W : ""}`;
3053
- throw te && (m(te), j = "error"), new Error(te);
3052
+ const te = `stream ${A.status}${H ? ": " + H : ""}`;
3053
+ throw te && (m(te), U = "error"), new Error(te);
3054
3054
  }
3055
3055
  k(!0);
3056
- const S = A.body.getReader(), H = new TextDecoder();
3056
+ const S = A.body.getReader(), G = new TextDecoder();
3057
3057
  let J = "", D = 0, ee = Date.now();
3058
3058
  const oe = setInterval(() => {
3059
- Date.now() - ee > 18e5 && (m("Stream idle timeout"), j = "error", z.abort());
3059
+ Date.now() - ee > 18e5 && (m("Stream idle timeout"), U = "error", _.abort());
3060
3060
  }, 5e3), ue = 1024 * 1024;
3061
3061
  try {
3062
- const W = A.headers.get("X-Thread-Id") || A.headers.get("x-thread-id"), te = A.headers.get("X-Run-Id") || A.headers.get("x-run-id");
3062
+ const H = A.headers.get("X-Thread-Id") || A.headers.get("x-thread-id"), te = A.headers.get("X-Run-Id") || A.headers.get("x-run-id");
3063
3063
  for (T.current && (T.current = {
3064
3064
  ...T.current,
3065
- threadId: W ?? T.current.threadId,
3065
+ threadId: H ?? T.current.threadId,
3066
3066
  runId: te ?? T.current.runId
3067
3067
  }); ; ) {
3068
3068
  const { value: ve, done: X } = await S.read();
3069
3069
  if (X) break;
3070
- J += H.decode(ve, { stream: !0 }), J.length > ue && (J = "", console.warn("Stream buffer reset: exceeded 1MB"));
3070
+ J += G.decode(ve, { stream: !0 }), J.length > ue && (J = "", console.warn("Stream buffer reset: exceeded 1MB"));
3071
3071
  let Z;
3072
3072
  for (; (Z = J.indexOf(`
3073
3073
 
@@ -3117,44 +3117,44 @@ function cr(e = {}) {
3117
3117
  u(Ee);
3118
3118
  }
3119
3119
  }
3120
- j === null && !z.signal.aborted && (j = "complete");
3121
- } catch (W) {
3122
- if (W.name === "AbortError")
3123
- j = j ?? "aborted";
3120
+ U === null && !_.signal.aborted && (U = "complete");
3121
+ } catch (H) {
3122
+ if (H.name === "AbortError")
3123
+ U = U ?? "aborted";
3124
3124
  else {
3125
- const te = W.message || String(W);
3126
- j = "error", m(te);
3125
+ const te = H.message || String(H);
3126
+ U = "error", m(te);
3127
3127
  }
3128
3128
  } finally {
3129
3129
  try {
3130
3130
  await S.cancel();
3131
3131
  } catch {
3132
3132
  } finally {
3133
- (G = S.releaseLock) == null || G.call(S);
3133
+ (O = S.releaseLock) == null || O.call(S);
3134
3134
  }
3135
3135
  clearInterval(oe);
3136
3136
  }
3137
- } catch (P) {
3138
- if (P.name === "AbortError")
3139
- j = j ?? "aborted";
3137
+ } catch (F) {
3138
+ if (F.name === "AbortError")
3139
+ U = U ?? "aborted";
3140
3140
  else {
3141
- const V = P.message || String(P);
3142
- j = "error", m(V), M || (M = !0, (F = e.onConnectionError) == null || F.call(e, V));
3141
+ const W = F.message || String(F);
3142
+ U = "error", m(W), M || (M = !0, (L = e.onConnectionError) == null || L.call(e, W));
3143
3143
  }
3144
3144
  } finally {
3145
3145
  try {
3146
3146
  if (e.onFinish) {
3147
- const P = {
3147
+ const F = {
3148
3148
  lastSeq: 0,
3149
3149
  lastCheckpointId: null,
3150
3150
  lastCheckpointNs: null,
3151
3151
  lastValues: null
3152
3152
  // Let the reducer/history hook provide the final values
3153
3153
  };
3154
- e.onFinish(P);
3154
+ e.onFinish(F);
3155
3155
  }
3156
- } catch (P) {
3157
- console.warn("[use-chat] onClosed callback failed", P);
3156
+ } catch (F) {
3157
+ console.warn("[use-chat] onClosed callback failed", F);
3158
3158
  }
3159
3159
  l(!1), k(!1), I.current = null, T.current = null;
3160
3160
  }
@@ -3179,8 +3179,8 @@ function cr(e = {}) {
3179
3179
  connected: h,
3180
3180
  stream: x,
3181
3181
  stop: y,
3182
- clear: w,
3183
- setToken: N,
3182
+ clear: b,
3183
+ setToken: P,
3184
3184
  values: {},
3185
3185
  // Provide empty object for backward compatibility
3186
3186
  interrupt: () => Promise.resolve(),
@@ -3199,19 +3199,19 @@ function lr({
3199
3199
  onThreadChange: r,
3200
3200
  onCurrentThreadDeleted: o
3201
3201
  }) {
3202
- const [s, a] = $([]), [i, u] = $(t), [c, l] = $(!1), [f, m] = $(null), h = K(i), k = K(/* @__PURE__ */ new Map());
3202
+ const [s, a] = V([]), [i, u] = V(t), [c, l] = V(!1), [f, m] = V(null), h = K(i), k = K(/* @__PURE__ */ new Map());
3203
3203
  q(() => {
3204
3204
  h.current = i;
3205
3205
  }, [i]), q(() => {
3206
3206
  t !== void 0 && t !== h.current && u(t);
3207
3207
  }, [t]);
3208
- const d = R(async () => {
3208
+ const d = z(async () => {
3209
3209
  l(!0), m(null);
3210
3210
  try {
3211
- const w = await e.listThreads();
3212
- a(w ?? []);
3213
- } catch (w) {
3214
- const y = String(w);
3211
+ const b = await e.listThreads();
3212
+ a(b ?? []);
3213
+ } catch (b) {
3214
+ const y = String(b);
3215
3215
  m(y), n == null || n(y);
3216
3216
  } finally {
3217
3217
  l(!1);
@@ -3222,10 +3222,10 @@ function lr({
3222
3222
  }, [d]), q(() => {
3223
3223
  r == null || r(i);
3224
3224
  }, [i, r]);
3225
- const v = R(
3226
- async (w, y) => {
3225
+ const v = z(
3226
+ async (b, y) => {
3227
3227
  try {
3228
- const x = y && typeof y == "object" ? { id: y.id, name: y.name ?? "" } : void 0, p = await e.createThread(w, x);
3228
+ const x = y && typeof y == "object" ? { id: y.id, name: y.name ?? "" } : void 0, p = await e.createThread(b, x);
3229
3229
  return u(p.threadId), await d(), p.threadId;
3230
3230
  } catch (x) {
3231
3231
  const p = String(x);
@@ -3233,27 +3233,27 @@ function lr({
3233
3233
  }
3234
3234
  },
3235
3235
  [e, n, d]
3236
- ), I = R(
3237
- async (w) => {
3236
+ ), I = z(
3237
+ async (b) => {
3238
3238
  const y = s;
3239
- a((p) => p.filter((b) => b.threadId !== w));
3239
+ a((p) => p.filter((w) => w.threadId !== b));
3240
3240
  const x = new AbortController();
3241
- k.current.set(w, x);
3241
+ k.current.set(b, x);
3242
3242
  try {
3243
- await e.deleteThread(w), h.current === w && (u(null), o == null || o());
3243
+ await e.deleteThread(b), h.current === b && (u(null), o == null || o());
3244
3244
  } catch (p) {
3245
3245
  a(y);
3246
- const b = String(p);
3247
- n == null || n(b);
3246
+ const w = String(p);
3247
+ n == null || n(w);
3248
3248
  } finally {
3249
- k.current.delete(w);
3249
+ k.current.delete(b);
3250
3250
  }
3251
3251
  },
3252
3252
  [e, o, n, s]
3253
- ), C = R(
3254
- async (w, y) => {
3253
+ ), C = z(
3254
+ async (b, y) => {
3255
3255
  try {
3256
- await e.updateThread(w, y), await d();
3256
+ await e.updateThread(b, y), await d();
3257
3257
  } catch (x) {
3258
3258
  n == null || n(String(x));
3259
3259
  }
@@ -3267,26 +3267,26 @@ function lr({
3267
3267
  refreshThreads: d
3268
3268
  }),
3269
3269
  [v, I, C, d]
3270
- ), N = R((w) => {
3271
- if (!(w != null && w.threadId)) return;
3270
+ ), P = z((b) => {
3271
+ if (!(b != null && b.threadId)) return;
3272
3272
  const y = {
3273
- threadId: w.threadId,
3274
- title: w.title || `Thread ${w.threadId.slice(0, 8)}`,
3275
- project: w.project,
3276
- createdAt: w.createdAt || (/* @__PURE__ */ new Date()).toISOString(),
3277
- updatedAt: w.updatedAt || (/* @__PURE__ */ new Date()).toISOString(),
3278
- messageCount: w.messageCount ?? 1
3273
+ threadId: b.threadId,
3274
+ title: b.title || `Thread ${b.threadId.slice(0, 8)}`,
3275
+ project: b.project,
3276
+ createdAt: b.createdAt || (/* @__PURE__ */ new Date()).toISOString(),
3277
+ updatedAt: b.updatedAt || (/* @__PURE__ */ new Date()).toISOString(),
3278
+ messageCount: b.messageCount ?? 1
3279
3279
  };
3280
3280
  a((x) => {
3281
3281
  let p = !1;
3282
- const b = x.map((z) => z.threadId === y.threadId ? (p = !0, console.debug("[useThreadsState] thread_info: updating existing thread", y.threadId), {
3283
- ...z,
3284
- title: y.title ?? z.title,
3285
- project: y.project ?? z.project,
3286
- updatedAt: y.updatedAt ?? z.updatedAt,
3287
- messageCount: y.messageCount ?? z.messageCount
3288
- }) : z);
3289
- return p ? b : (console.debug("[useThreadsState] thread_info: adding thread to list", y.threadId), [y, ...x]);
3282
+ const w = x.map((_) => _.threadId === y.threadId ? (p = !0, console.debug("[useThreadsState] thread_info: updating existing thread", y.threadId), {
3283
+ ..._,
3284
+ title: y.title ?? _.title,
3285
+ project: y.project ?? _.project,
3286
+ updatedAt: y.updatedAt ?? _.updatedAt,
3287
+ messageCount: y.messageCount ?? _.messageCount
3288
+ }) : _);
3289
+ return p ? w : (console.debug("[useThreadsState] thread_info: adding thread to list", y.threadId), [y, ...x]);
3290
3290
  });
3291
3291
  }, []);
3292
3292
  return {
@@ -3297,7 +3297,7 @@ function lr({
3297
3297
  isLoadingThreads: c,
3298
3298
  threadsError: f,
3299
3299
  actions: T,
3300
- addThreadFromEvent: N
3300
+ addThreadFromEvent: P
3301
3301
  };
3302
3302
  }
3303
3303
  const jt = Se(null);
@@ -3462,13 +3462,13 @@ function gr(e, t) {
3462
3462
  }
3463
3463
  }
3464
3464
  function mr(e = []) {
3465
- const [t, n] = Wt(gr, { ...Ot, messages: e }), r = K([]), o = K(null), s = R(() => {
3465
+ const [t, n] = Wt(gr, { ...Ot, messages: e }), r = K([]), o = K(null), s = z(() => {
3466
3466
  o.current !== null && typeof window < "u" && window.cancelAnimationFrame(o.current), o.current = null;
3467
3467
  const c = r.current;
3468
3468
  c.length && (r.current = [], n({ type: "batch", payload: { events: c } }));
3469
- }, []), a = R(() => {
3469
+ }, []), a = z(() => {
3470
3470
  typeof window < "u" && typeof window.requestAnimationFrame == "function" ? o.current === null && (o.current = window.requestAnimationFrame(() => s())) : setTimeout(s, 8);
3471
- }, [s]), i = R((c) => {
3471
+ }, [s]), i = z((c) => {
3472
3472
  r.current.push(c), a();
3473
3473
  }, [a]), u = Q(() => ({
3474
3474
  setStatus: (c, l) => n({ type: "status", payload: { status: c, error: l } }),
@@ -3714,9 +3714,9 @@ function gt(e) {
3714
3714
  };
3715
3715
  }
3716
3716
  function Tr(e, t) {
3717
- var w, y;
3717
+ var b, y;
3718
3718
  if (!e) return null;
3719
- const n = ((w = e.values) == null ? void 0 : w.activeAgent) ?? null, r = (y = e.values) == null ? void 0 : y.messages, s = (Array.isArray(r) ? r : []).map((x) => xr(x, n)).filter((x) => !!x), a = ze(e.metadata) ?? {}, i = pt(e.config), u = ze(e.parentConfig), c = pt(u), l = Fe(i, ["checkpointId"]), f = Fe(i, ["checkpointNs"]), m = Fe(c, ["checkpointId"]), h = ze(e.config), k = Array.isArray(e.tasks) ? e.tasks.map((x) => ({ ...x })) : e.tasks ?? null, d = Array.isArray(e.next) ? [...e.next] : e.next ?? null, v = typeof e.createdAt == "string" && e.createdAt.trim() ? e.createdAt : new Date(Date.now() - t).toISOString(), I = {
3719
+ const n = ((b = e.values) == null ? void 0 : b.activeAgent) ?? null, r = (y = e.values) == null ? void 0 : y.messages, s = (Array.isArray(r) ? r : []).map((x) => xr(x, n)).filter((x) => !!x), a = ze(e.metadata) ?? {}, i = pt(e.config), u = ze(e.parentConfig), c = pt(u), l = Fe(i, ["checkpointId"]), f = Fe(i, ["checkpointNs"]), m = Fe(c, ["checkpointId"]), h = ze(e.config), k = Array.isArray(e.tasks) ? e.tasks.map((x) => ({ ...x })) : e.tasks ?? null, d = Array.isArray(e.next) ? [...e.next] : e.next ?? null, v = typeof e.createdAt == "string" && e.createdAt.trim() ? e.createdAt : new Date(Date.now() - t).toISOString(), I = {
3720
3720
  ...a,
3721
3721
  step: kr(a, ["step"]) ?? 0,
3722
3722
  source: Fe(a, ["source"]) ?? null
@@ -3724,7 +3724,7 @@ function Tr(e, t) {
3724
3724
  ...x,
3725
3725
  checkpointId: x.checkpointId ?? l ?? null,
3726
3726
  checkpointNs: x.checkpointNs ?? f ?? null
3727
- })), T = e.values, N = Array.isArray(e.interrupts) ? e.interrupts : Array.isArray(T == null ? void 0 : T.interrupts) ? T.interrupts : [];
3727
+ })), T = e.values, P = Array.isArray(e.interrupts) ? e.interrupts : Array.isArray(T == null ? void 0 : T.interrupts) ? T.interrupts : [];
3728
3728
  return {
3729
3729
  checkpointId: l ?? null,
3730
3730
  checkpointNs: f ?? null,
@@ -3732,7 +3732,7 @@ function Tr(e, t) {
3732
3732
  parentId: m ?? null,
3733
3733
  messages: C,
3734
3734
  interrupt: Ar(
3735
- N,
3735
+ P,
3736
3736
  t,
3737
3737
  l ?? null
3738
3738
  ),
@@ -3790,7 +3790,7 @@ function Mr(e) {
3790
3790
  const C = Array.isArray(l.messages) ? l.messages : [];
3791
3791
  for (const y of C)
3792
3792
  y.role === "user" && (I || (I = y), y.id && (v = y.id));
3793
- const T = l.next && l.next.length > 0 ? String(l.next[0]) : null, N = l.parentConfig ?? null, w = {
3793
+ const T = l.next && l.next.length > 0 ? String(l.next[0]) : null, P = l.parentConfig ?? null, b = {
3794
3794
  id: m,
3795
3795
  step: k,
3796
3796
  source: d,
@@ -3798,10 +3798,10 @@ function Mr(e) {
3798
3798
  namespace: l.checkpointNs ?? null,
3799
3799
  parentId: l.parentId ?? null,
3800
3800
  next: T,
3801
- parentConfig: N,
3801
+ parentConfig: P,
3802
3802
  userMessageId: v
3803
3803
  };
3804
- if (o.push(w), f && t.set(f, w), f && I) {
3804
+ if (o.push(b), f && t.set(f, b), f && I) {
3805
3805
  const y = Cr(I);
3806
3806
  y && r.set(f, y);
3807
3807
  }
@@ -3812,7 +3812,7 @@ function Mr(e) {
3812
3812
  source: d,
3813
3813
  createdAt: l.createdAt ?? null,
3814
3814
  next: T,
3815
- parentConfig: N
3815
+ parentConfig: P
3816
3816
  });
3817
3817
  }
3818
3818
  const s = /* @__PURE__ */ new Map();
@@ -3885,116 +3885,116 @@ function Bt({
3885
3885
  isStreaming: a,
3886
3886
  getMessages: i
3887
3887
  }) {
3888
- const [u, c] = $(null), f = Q(
3888
+ const [u, c] = V(null), f = Q(
3889
3889
  () => gt(u),
3890
3890
  [u]
3891
- ).checkpoints, m = Er(f), h = m.timeline, [k, d] = $(!1), [v, I] = $(!1), [C, T] = $(null), N = K(o), w = K(null), y = K(null), x = K(null);
3891
+ ).checkpoints, m = Er(f), h = m.timeline, [k, d] = V(!1), [v, I] = V(!1), [C, T] = V(null), P = K(o), b = K(null), y = K(null);
3892
3892
  q(() => {
3893
- N.current = o;
3893
+ P.current = o;
3894
3894
  }, [o]);
3895
- const p = R(
3895
+ const x = z(
3896
3896
  async (E) => {
3897
- const L = await e.getState({
3897
+ const j = await e.getState({
3898
3898
  threadId: E.threadId,
3899
3899
  checkpointId: E.checkpointId,
3900
3900
  checkpointNs: E.checkpointNs
3901
- }), _ = {
3901
+ }), N = {
3902
3902
  version: "values@1",
3903
3903
  threadId: E.threadId,
3904
- checkpoints: [L]
3905
- }, G = t ? await Ir(_, t) : _, { latest: F } = gt(G);
3906
- return F;
3904
+ checkpoints: [j]
3905
+ }, B = t ? await Ir(N, t) : N, { latest: O } = gt(B);
3906
+ return O;
3907
3907
  },
3908
3908
  [e, t]
3909
- ), b = R(
3910
- async (E, L) => {
3911
- var F;
3909
+ ), p = z(
3910
+ async (E, j) => {
3911
+ var O;
3912
3912
  if (!E) return;
3913
- const _ = `${E}:${L ?? "latest"}`;
3914
- if (y.current === _ || w.current === _) return;
3915
- y.current = _, (F = x.current) == null || F.abort();
3916
- const G = new AbortController();
3917
- x.current = G, d(!0), T(null);
3913
+ const N = `${E}:${j ?? "latest"}`;
3914
+ if (b.current === N || k) return;
3915
+ (O = y.current) == null || O.abort();
3916
+ const B = new AbortController();
3917
+ y.current = B, d(!0), T(null);
3918
3918
  try {
3919
- const P = await p({
3919
+ const L = await x({
3920
3920
  threadId: E,
3921
- checkpointId: L ?? void 0
3921
+ checkpointId: j ?? void 0
3922
3922
  });
3923
- if (N.current !== E) return;
3924
- n((P == null ? void 0 : P.messages) ?? [], {
3925
- checkpointId: (P == null ? void 0 : P.checkpointId) ?? null,
3926
- checkpointNs: (P == null ? void 0 : P.checkpointNs) ?? null,
3927
- pendingInterrupt: (P == null ? void 0 : P.interrupt) ?? null,
3928
- values: P == null ? void 0 : P.values
3929
- }), w.current = _;
3930
- const V = await e.getStateHistory({
3923
+ if (P.current !== E) return;
3924
+ n((L == null ? void 0 : L.messages) ?? [], {
3925
+ checkpointId: (L == null ? void 0 : L.checkpointId) ?? null,
3926
+ checkpointNs: (L == null ? void 0 : L.checkpointNs) ?? null,
3927
+ pendingInterrupt: (L == null ? void 0 : L.interrupt) ?? null,
3928
+ values: L == null ? void 0 : L.values
3929
+ }), b.current = N;
3930
+ const F = await e.getStateHistory({
3931
3931
  threadId: E,
3932
3932
  limit: 100,
3933
3933
  includeMessages: !1
3934
3934
  });
3935
- N.current === E && c(V);
3936
- } catch (P) {
3937
- if (!Jt(P)) {
3938
- const V = String(P);
3939
- T(V), r == null || r(V);
3935
+ P.current === E && c(F);
3936
+ } catch (L) {
3937
+ if (!Jt(L)) {
3938
+ const F = String(L);
3939
+ T(F), r == null || r(F);
3940
3940
  }
3941
3941
  } finally {
3942
- y.current = null, d(!1);
3942
+ d(!1);
3943
3943
  }
3944
3944
  },
3945
- [e, n, p, r, k, i]
3946
- ), z = R(
3947
- async (E, L) => {
3945
+ [e, n, x, r, k, i]
3946
+ ), w = z(
3947
+ async (E, j) => {
3948
3948
  if (o) {
3949
3949
  I(!0);
3950
3950
  try {
3951
- const _ = await p({
3951
+ const N = await x({
3952
3952
  threadId: o,
3953
3953
  checkpointId: E,
3954
- checkpointNs: L ?? void 0
3954
+ checkpointNs: j ?? void 0
3955
3955
  });
3956
- n((_ == null ? void 0 : _.messages) ?? [], {
3957
- checkpointId: (_ == null ? void 0 : _.checkpointId) ?? E,
3958
- checkpointNs: (_ == null ? void 0 : _.checkpointNs) ?? L,
3959
- pendingInterrupt: (_ == null ? void 0 : _.interrupt) ?? null,
3960
- values: _ == null ? void 0 : _.values
3956
+ n((N == null ? void 0 : N.messages) ?? [], {
3957
+ checkpointId: (N == null ? void 0 : N.checkpointId) ?? E,
3958
+ checkpointNs: (N == null ? void 0 : N.checkpointNs) ?? j,
3959
+ pendingInterrupt: (N == null ? void 0 : N.interrupt) ?? null,
3960
+ values: N == null ? void 0 : N.values
3961
3961
  });
3962
- } catch (_) {
3963
- console.error("[useThreadHistoryState] Navigation failed", _);
3962
+ } catch (N) {
3963
+ console.error("[useThreadHistoryState] Navigation failed", N);
3964
3964
  } finally {
3965
3965
  I(!1);
3966
3966
  }
3967
3967
  }
3968
3968
  },
3969
- [o, p, n]
3970
- ), j = R(async () => {
3971
- o && await b(o);
3972
- }, [o, b]), M = R(
3969
+ [o, x, n]
3970
+ ), _ = z(async () => {
3971
+ o && await p(o);
3972
+ }, [o, p]), U = z(
3973
3973
  async (E) => {
3974
- var G;
3975
- const L = (E == null ? void 0 : E.threadId) || o;
3976
- if (!L || o !== L) return;
3977
- if (c(E), w.current = `${L}:latest`, (G = E.values) != null && G.messages) {
3978
- const F = await p({
3979
- threadId: L
3974
+ var B;
3975
+ const j = (E == null ? void 0 : E.threadId) || o;
3976
+ if (!j || o !== j) return;
3977
+ if (c(E), b.current = `${j}:latest`, (B = E.values) != null && B.messages) {
3978
+ const O = await x({
3979
+ threadId: j
3980
3980
  });
3981
- F && n(F.messages ?? [], {
3982
- checkpointId: F.checkpointId ?? null,
3983
- checkpointNs: F.checkpointNs ?? null,
3984
- pendingInterrupt: F.interrupt ?? null,
3985
- values: F.values
3981
+ O && n(O.messages ?? [], {
3982
+ checkpointId: O.checkpointId ?? null,
3983
+ checkpointNs: O.checkpointNs ?? null,
3984
+ pendingInterrupt: O.interrupt ?? null,
3985
+ values: O.values
3986
3986
  });
3987
3987
  }
3988
3988
  },
3989
- [o, p, n]
3989
+ [o, x, n]
3990
3990
  );
3991
3991
  q(() => {
3992
3992
  if (!s || !o || k || a) return;
3993
3993
  const E = `${o}:latest`;
3994
- w.current !== E && b(o);
3995
- }, [s, o, k, a, b]);
3996
- const O = R(() => {
3997
- c(null), d(!1), I(!1), T(null), w.current = null;
3994
+ b.current !== E && p(o);
3995
+ }, [s, o, k, a, p]);
3996
+ const M = z(() => {
3997
+ c(null), d(!1), I(!1), T(null), b.current = null;
3998
3998
  }, []);
3999
3999
  return {
4000
4000
  threadCheckpoints: f,
@@ -4003,19 +4003,19 @@ function Bt({
4003
4003
  isLoadingThread: k,
4004
4004
  isLoadingCheckpoint: v,
4005
4005
  threadStateError: C,
4006
- loadThread: b,
4007
- navigateToCheckpoint: z,
4008
- setCurrentCheckpointId: (E, L) => {
4009
- n(i(), { checkpointId: E, checkpointNs: L });
4006
+ loadThread: p,
4007
+ navigateToCheckpoint: w,
4008
+ setCurrentCheckpointId: (E, j) => {
4009
+ n(i(), { checkpointId: E, checkpointNs: j });
4010
4010
  },
4011
- returnToLatest: j,
4012
- handleValuesEvent: M,
4011
+ returnToLatest: _,
4012
+ handleValuesEvent: U,
4013
4013
  markSkipNextLoad: () => {
4014
4014
  },
4015
4015
  markStreamPendingThread: () => {
4016
4016
  },
4017
- resetHistoryState: O,
4018
- clearState: O
4017
+ resetHistoryState: M,
4018
+ clearState: M
4019
4019
  };
4020
4020
  }
4021
4021
  const $t = Se(null), Vt = Se(null);
@@ -4046,14 +4046,14 @@ function Nr({
4046
4046
  isLoadingThread: I,
4047
4047
  isLoadingCheckpoint: C,
4048
4048
  threadStateError: T,
4049
- loadThread: N,
4050
- navigateToCheckpoint: w,
4049
+ loadThread: P,
4050
+ navigateToCheckpoint: b,
4051
4051
  setCurrentCheckpointId: y,
4052
4052
  returnToLatest: x,
4053
4053
  handleValuesEvent: p,
4054
- markSkipNextLoad: b,
4055
- markStreamPendingThread: z,
4056
- resetHistoryState: j
4054
+ markSkipNextLoad: w,
4055
+ markStreamPendingThread: _,
4056
+ resetHistoryState: U
4057
4057
  } = Bt({
4058
4058
  api: i,
4059
4059
  fileApi: u,
@@ -4065,34 +4065,34 @@ function Nr({
4065
4065
  initialCheckpointNs: r,
4066
4066
  autoLoadInitial: o,
4067
4067
  isStreaming: s,
4068
- getMessages: R(() => l.messages, [l.messages])
4069
- }), M = K(null), O = R(
4068
+ getMessages: z(() => l.messages, [l.messages])
4069
+ }), M = K(null), E = z(
4070
4070
  (A) => {
4071
4071
  M.current = A;
4072
4072
  },
4073
4073
  []
4074
- ), E = K(null), L = R(
4074
+ ), j = K(null), N = z(
4075
4075
  (A) => {
4076
- E.current = A;
4076
+ j.current = A;
4077
4077
  },
4078
4078
  []
4079
- ), _ = Q(() => ({ assemblingMessageId: l.assemblingId ?? null }), [l.assemblingId]), G = R(
4079
+ ), B = Q(() => ({ assemblingMessageId: l.assemblingId ?? null }), [l.assemblingId]), O = z(
4080
4080
  (A, S) => {
4081
- const H = Ut(A, "user");
4081
+ const G = Ut(A, "user");
4082
4082
  return h({
4083
4083
  type: "user_message",
4084
4084
  payload: {
4085
- message: H,
4085
+ message: G,
4086
4086
  editingMessageId: S == null ? void 0 : S.editingMessageId
4087
4087
  }
4088
- }), H;
4088
+ }), G;
4089
4089
  },
4090
4090
  [h]
4091
- ), F = R(async () => {
4092
- M.current ? await M.current() : (f([], {}), j());
4093
- }, [f, j]), P = R(async (A, S, H) => {
4094
- await N(A, S, { clearProgress: !1 });
4095
- }, [N]), V = Q(() => Ln(l.messages), [l.messages]), Y = Q(
4091
+ ), L = z(async () => {
4092
+ M.current ? await M.current() : (f([], {}), U());
4093
+ }, [f, U]), F = z(async (A, S, G) => {
4094
+ await P(A, S, { clearProgress: !1 });
4095
+ }, [P]), W = Q(() => Ln(l.messages), [l.messages]), Y = Q(
4096
4096
  () => ({
4097
4097
  status: l.status,
4098
4098
  threadId: c,
@@ -4106,7 +4106,7 @@ function Nr({
4106
4106
  checkpoints: k,
4107
4107
  checkpointIndex: v,
4108
4108
  timelineCheckpoints: d,
4109
- metadata: _,
4109
+ metadata: B,
4110
4110
  values: l.values ?? {},
4111
4111
  isLoading: I,
4112
4112
  isLoadingCheckpoint: C,
@@ -4122,23 +4122,23 @@ function Nr({
4122
4122
  values: A.values
4123
4123
  });
4124
4124
  },
4125
- clearState: F,
4126
- navigateToCheckpoint: w,
4125
+ clearState: L,
4126
+ navigateToCheckpoint: b,
4127
4127
  setCurrentCheckpointId: y,
4128
4128
  returnToLatest: x,
4129
- loadThread: P,
4130
- clearThread: F,
4131
- respondToInterrupt: async (A, S, H) => {
4132
- E.current && await E.current(A, S, H);
4129
+ loadThread: F,
4130
+ clearThread: L,
4131
+ respondToInterrupt: async (A, S, G) => {
4132
+ j.current && await j.current(A, S, G);
4133
4133
  },
4134
4134
  messagePreviews: v.messagePreviews,
4135
4135
  handleValuesEvent: p,
4136
- markSkipNextLoad: b,
4137
- markStreamPendingThread: z,
4138
- resetHistoryState: j,
4139
- pushUser: G,
4136
+ markSkipNextLoad: w,
4137
+ markStreamPendingThread: _,
4138
+ resetHistoryState: U,
4139
+ pushUser: O,
4140
4140
  onEvent: m,
4141
- artifacts: V
4141
+ artifacts: W
4142
4142
  }),
4143
4143
  [
4144
4144
  c,
@@ -4151,29 +4151,29 @@ function Nr({
4151
4151
  k,
4152
4152
  d,
4153
4153
  v,
4154
- _,
4154
+ B,
4155
4155
  I,
4156
4156
  C,
4157
4157
  T,
4158
4158
  f,
4159
- F,
4160
- w,
4159
+ L,
4160
+ b,
4161
4161
  y,
4162
4162
  x,
4163
- P,
4163
+ F,
4164
4164
  p,
4165
- b,
4166
- z,
4167
- G,
4165
+ w,
4166
+ _,
4167
+ O,
4168
4168
  m,
4169
- V
4169
+ W
4170
4170
  ]
4171
4171
  ), g = Q(
4172
4172
  () => ({
4173
- registerClearThread: O,
4174
- registerRespondToInterrupt: L
4173
+ registerClearThread: E,
4174
+ registerRespondToInterrupt: N
4175
4175
  }),
4176
- [O, L]
4176
+ [E, N]
4177
4177
  );
4178
4178
  return /* @__PURE__ */ ie(Vt.Provider, { value: g, children: /* @__PURE__ */ ie($t.Provider, { value: Y, children: e }) });
4179
4179
  }
@@ -4190,7 +4190,7 @@ function zr({
4190
4190
  onFinish: u,
4191
4191
  onStreamingChange: c
4192
4192
  }) {
4193
- const { chatApi: l, baseUrl: f } = Ae(), m = f, h = pe(t), k = pe(n), d = pe(r), v = pe(o), I = pe(s), C = pe(a), T = pe(i), N = pe(u), w = pe(c), y = Q(
4193
+ const { chatApi: l, baseUrl: f } = Ae(), m = f, h = pe(t), k = pe(n), d = pe(r), v = pe(o), I = pe(s), C = pe(a), T = pe(i), P = pe(u), b = pe(c), y = Q(
4194
4194
  () => ({
4195
4195
  onError: h,
4196
4196
  onAuthError: k,
@@ -4199,7 +4199,7 @@ function zr({
4199
4199
  onCustomEvent: C,
4200
4200
  onUpdateEvent: I,
4201
4201
  onToolEnd: v,
4202
- onFinish: N
4202
+ onFinish: P
4203
4203
  }),
4204
4204
  [
4205
4205
  h,
@@ -4209,7 +4209,7 @@ function zr({
4209
4209
  C,
4210
4210
  I,
4211
4211
  v,
4212
- N
4212
+ P
4213
4213
  ]
4214
4214
  );
4215
4215
  return /* @__PURE__ */ ie(_r.Provider, { value: !0, children: /* @__PURE__ */ ie(
@@ -4218,7 +4218,7 @@ function zr({
4218
4218
  api: l,
4219
4219
  streamBaseUrl: m,
4220
4220
  handlers: y,
4221
- onStreamingChange: w,
4221
+ onStreamingChange: b,
4222
4222
  children: e
4223
4223
  }
4224
4224
  ) });
@@ -4241,7 +4241,7 @@ function Rr({
4241
4241
  pushUser: v,
4242
4242
  onEvent: I,
4243
4243
  messages: C
4244
- } = Dt(), { registerClearThread: T, registerRespondToInterrupt: N } = Pr(), w = R(
4244
+ } = Dt(), { registerClearThread: T, registerRespondToInterrupt: P } = Pr(), b = z(
4245
4245
  (g) => {
4246
4246
  i(g), k(g.threadId), a.current !== g.threadId && ((g.created ?? !a.current) && h(g.threadId), s(g.threadId));
4247
4247
  },
@@ -4256,7 +4256,7 @@ function Rr({
4256
4256
  onAuthError: r.onAuthError,
4257
4257
  onConnectionError: r.onConnectionError,
4258
4258
  onFinish: r.onFinish,
4259
- onThreadInfo: w,
4259
+ onThreadInfo: b,
4260
4260
  onMetadataEvent: r.onMetadataEvent,
4261
4261
  onCustomEvent: r.onCustomEvent,
4262
4262
  onUpdateEvent: r.onUpdateEvent,
@@ -4266,52 +4266,52 @@ function Rr({
4266
4266
  q(() => {
4267
4267
  o == null || o(y.isStreaming);
4268
4268
  }, [y.isStreaming, o]);
4269
- const { stream: x, stop: p, clear: b, isStreaming: z, error: j, connected: M, streamedMessages: O, activeMessageId: E } = y;
4269
+ const { stream: x, stop: p, clear: w, isStreaming: _, error: U, connected: M, streamedMessages: E, activeMessageId: j } = y;
4270
4270
  q(() => {
4271
- u !== void 0 && b();
4272
- }, [u, b]);
4273
- const L = R(
4271
+ u !== void 0 && w();
4272
+ }, [u, w]);
4273
+ const N = z(
4274
4274
  async (g, A) => {
4275
4275
  await x(g, A);
4276
4276
  },
4277
4277
  [x]
4278
- ), _ = K(l);
4278
+ ), B = K(l);
4279
4279
  q(() => {
4280
- _.current = l;
4280
+ B.current = l;
4281
4281
  }, [l]);
4282
- const G = R(
4282
+ const O = z(
4283
4283
  async (g, A, S) => {
4284
- const H = a.current;
4285
- if (!H)
4284
+ const G = a.current;
4285
+ if (!G)
4286
4286
  throw new Error("No active thread to handle interrupt");
4287
- const J = g ? A ?? !0 : !1, D = _.current, ee = (S == null ? void 0 : S.checkpointId) ?? D.id ?? void 0, oe = (S == null ? void 0 : S.checkpointNs) ?? D.namespace ?? void 0, ue = {
4288
- threadId: H,
4287
+ const J = g ? A ?? !0 : !1, D = B.current, ee = (S == null ? void 0 : S.checkpointId) ?? D.id ?? void 0, oe = (S == null ? void 0 : S.checkpointNs) ?? D.namespace ?? void 0, ue = {
4288
+ threadId: G,
4289
4289
  checkpointId: ee,
4290
4290
  checkpointNs: oe,
4291
4291
  command: { kind: "resume", value: J },
4292
4292
  payload: S == null ? void 0 : S.payload
4293
4293
  };
4294
- L(ue);
4294
+ N(ue);
4295
4295
  },
4296
- [a, L]
4296
+ [a, N]
4297
4297
  );
4298
4298
  q(() => {
4299
- N(G);
4300
- }, [G, N]);
4301
- const F = R(async () => {
4302
- p(), b(), d(), s(null);
4303
- }, [b, d, s, p]);
4299
+ P(O);
4300
+ }, [O, P]);
4301
+ const L = z(async () => {
4302
+ p(), w(), d(), s(null);
4303
+ }, [w, d, s, p]);
4304
4304
  q(() => {
4305
- T(F);
4306
- }, [F, T]);
4307
- const P = R(
4305
+ T(L);
4306
+ }, [L, T]);
4307
+ const F = z(
4308
4308
  async (g, A) => {
4309
- z && p();
4309
+ _ && p();
4310
4310
  let S = a.current;
4311
- const H = (g == null ? void 0 : g.text) ?? "", J = (g == null ? void 0 : g.attachments) ?? [], D = (H == null ? void 0 : H.trim()) ?? "", ee = { ...(g == null ? void 0 : g.payload) ?? {} }, oe = Array.isArray(ee.messages) ? ee.messages : void 0;
4311
+ const G = (g == null ? void 0 : g.text) ?? "", J = (g == null ? void 0 : g.attachments) ?? [], D = (G == null ? void 0 : G.trim()) ?? "", ee = { ...(g == null ? void 0 : g.payload) ?? {} }, oe = Array.isArray(ee.messages) ? ee.messages : void 0;
4312
4312
  oe && delete ee.messages;
4313
- const ue = !!(oe && oe.length), W = !!(g.contentParts && g.contentParts.length > 0);
4314
- if (!S && !D && J.length === 0 && !ue && !W) return;
4313
+ const ue = !!(oe && oe.length), H = !!(g.contentParts && g.contentParts.length > 0);
4314
+ if (!S && !D && J.length === 0 && !ue && !H) return;
4315
4315
  if (!S) {
4316
4316
  const he = Math.floor(Date.now() / 1e3).toString(16).padStart(8, "0"), ye = Array.from({ length: 4 }, () => Math.floor(Math.random() * 4294967295).toString(16).padStart(8, "0")).join("").slice(0, 16);
4317
4317
  S = `${he}${ye}`, h(S), s(S);
@@ -4319,7 +4319,7 @@ function Rr({
4319
4319
  let te = null;
4320
4320
  g.contentParts && g.contentParts.length > 0 && (te = g.contentParts);
4321
4321
  const { contentParts: ve, filesInfo: X } = te ? { contentParts: te, filesInfo: [] } : await rr(J), Z = [...ve];
4322
- D && Z.push({ type: "text", text: H });
4322
+ D && Z.push({ type: "text", text: G });
4323
4323
  const me = g == null ? void 0 : g.originalMessageId, je = !!(g != null && g.edit && me), Le = !ue && Z.length > 0;
4324
4324
  let de = null;
4325
4325
  if (Le) {
@@ -4350,25 +4350,25 @@ function Rr({
4350
4350
  command: g == null ? void 0 : g.command,
4351
4351
  edit: g == null ? void 0 : g.edit
4352
4352
  };
4353
- return L(Ee, A);
4353
+ return N(Ee, A);
4354
4354
  },
4355
- [l, a, z, h, v, L, p, f]
4356
- ), V = Q(() => {
4357
- const g = Object.keys(O).length > 0;
4358
- if (!z && !g)
4355
+ [l, a, _, h, v, N, p, f]
4356
+ ), W = Q(() => {
4357
+ const g = Object.keys(E).length > 0;
4358
+ if (!_ && !g)
4359
4359
  return C;
4360
4360
  const A = /* @__PURE__ */ new Map();
4361
- return C.forEach((S) => A.set(S.id, S)), Object.values(O).forEach((S) => {
4361
+ return C.forEach((S) => A.set(S.id, S)), Object.values(E).forEach((S) => {
4362
4362
  A.set(S.id, S);
4363
4363
  }), Array.from(A.values());
4364
- }, [z, O, C]), Y = Q(
4364
+ }, [_, E, C]), Y = Q(
4365
4365
  () => ({
4366
- isStreaming: z,
4367
- error: j,
4368
- connectionState: j ? "error" : z ? M ? "connected" : "connecting" : "idle",
4369
- messages: V,
4370
- activeMessageId: E,
4371
- submit: P,
4366
+ isStreaming: _,
4367
+ error: U,
4368
+ connectionState: U ? "error" : _ ? M ? "connected" : "connecting" : "idle",
4369
+ messages: W,
4370
+ activeMessageId: j,
4371
+ submit: F,
4372
4372
  stop: p,
4373
4373
  interrupt: c,
4374
4374
  resume: () => Promise.resolve(),
@@ -4377,7 +4377,7 @@ function Rr({
4377
4377
  }
4378
4378
  // TODO: Implement error clearing
4379
4379
  }),
4380
- [z, j, P, p, c, M, V]
4380
+ [_, U, F, p, c, M, W]
4381
4381
  );
4382
4382
  return /* @__PURE__ */ ie(Kt.Provider, { value: Y, children: e });
4383
4383
  }
@@ -4385,7 +4385,7 @@ function pe(e) {
4385
4385
  const t = K(e);
4386
4386
  return q(() => {
4387
4387
  t.current = e;
4388
- }, [e]), R((...n) => {
4388
+ }, [e]), z((...n) => {
4389
4389
  const r = t.current;
4390
4390
  if (r)
4391
4391
  return r(...n);
@@ -4440,26 +4440,26 @@ function io({
4440
4440
  onMetadataEvent: h,
4441
4441
  onFinish: k
4442
4442
  }) {
4443
- const d = Lr(t), [v, I] = $(!1), C = ge(i), T = ge(u), N = ge(a), w = ge(c), y = ge(l), x = ge(f), p = ge(m), b = ge(h), z = ge(k), j = Q(
4443
+ const d = Lr(t), [v, I] = V(!1), C = ge(i), T = ge(u), P = ge(a), b = ge(c), y = ge(l), x = ge(f), p = ge(m), w = ge(h), _ = ge(k), U = Q(
4444
4444
  () => ({
4445
4445
  onError: C,
4446
4446
  onAuthError: T,
4447
- onConnectionError: N,
4447
+ onConnectionError: P,
4448
4448
  onToolEnd: y,
4449
4449
  onUpdateEvent: x,
4450
4450
  onCustomEvent: p,
4451
- onMetadataEvent: b,
4452
- onFinish: z
4451
+ onMetadataEvent: w,
4452
+ onFinish: _
4453
4453
  }),
4454
4454
  [
4455
4455
  C,
4456
4456
  T,
4457
- N,
4457
+ P,
4458
4458
  y,
4459
4459
  x,
4460
4460
  p,
4461
- b,
4462
- z
4461
+ w,
4462
+ _
4463
4463
  ]
4464
4464
  );
4465
4465
  return /* @__PURE__ */ ie(tr, { apiConfig: d, children: /* @__PURE__ */ ie(
@@ -4467,7 +4467,7 @@ function io({
4467
4467
  {
4468
4468
  initialThreadId: n,
4469
4469
  onError: C,
4470
- onThreadChange: w,
4470
+ onThreadChange: b,
4471
4471
  children: /* @__PURE__ */ ie(
4472
4472
  Nr,
4473
4473
  {
@@ -4480,7 +4480,7 @@ function io({
4480
4480
  children: /* @__PURE__ */ ie(
4481
4481
  zr,
4482
4482
  {
4483
- ...j,
4483
+ ...U,
4484
4484
  onStreamingChange: I,
4485
4485
  children: e
4486
4486
  }
@@ -4492,7 +4492,7 @@ function io({
4492
4492
  }
4493
4493
  function ge(e) {
4494
4494
  const t = K(e);
4495
- return t.current = e, R((...n) => {
4495
+ return t.current = e, z((...n) => {
4496
4496
  const r = t.current;
4497
4497
  if (r)
4498
4498
  return r(...n);
@@ -4590,11 +4590,11 @@ function Kr() {
4590
4590
  };
4591
4591
  }
4592
4592
  function co(e) {
4593
- const { allowFileOpen: t, currentThreadId: n } = e, { fileApi: r } = Ae(), { toast: o } = Kr(), [s, a] = $({}), [i, u] = $(null), [c, l] = $(!1), f = R(() => {
4593
+ const { allowFileOpen: t, currentThreadId: n } = e, { fileApi: r } = Ae(), { toast: o } = Kr(), [s, a] = V({}), [i, u] = V(null), [c, l] = V(!1), f = z(() => {
4594
4594
  l(!1), u(null);
4595
- }, []), m = R((k) => {
4595
+ }, []), m = z((k) => {
4596
4596
  u(k), l(!0);
4597
- }, []), h = R(
4597
+ }, []), h = z(
4598
4598
  async (k, d, v) => {
4599
4599
  var I, C;
4600
4600
  if (!t) {
@@ -4606,16 +4606,16 @@ function co(e) {
4606
4606
  return;
4607
4607
  }
4608
4608
  try {
4609
- const T = String(d.url ?? ""), N = T.match(/\/chat\/files\/([^/]+)(?:\/(view|download))?/);
4610
- if (N) {
4609
+ const T = String(d.url ?? ""), P = T.match(/\/chat\/files\/([^/]+)(?:\/(view|download))?/);
4610
+ if (P) {
4611
4611
  k.preventDefault();
4612
- const w = N[1], y = d.name || `file_${w}`, x = d.mimeType || "application/octet-stream";
4613
- m({ id: w, name: y, mimeType: x });
4612
+ const b = P[1], y = d.name || `file_${b}`, x = d.mimeType || "application/octet-stream";
4613
+ m({ id: b, name: y, mimeType: x });
4614
4614
  return;
4615
4615
  }
4616
4616
  if (T.startsWith("data:")) {
4617
4617
  k.preventDefault(), a((y) => ({ ...y, [v]: !0 }));
4618
- const w = o({ title: "Fetching file...", description: "", open: !0 });
4618
+ const b = o({ title: "Fetching file...", description: "", open: !0 });
4619
4619
  try {
4620
4620
  const y = await r.listFiles(n ?? void 0);
4621
4621
  if (!y || !Array.isArray(y))
@@ -4629,8 +4629,8 @@ function co(e) {
4629
4629
  id: x.id,
4630
4630
  name: d.name || x.filename || `file_${x.id}`,
4631
4631
  mimeType: d.mimeType || x.mime_type || "application/octet-stream"
4632
- }), (I = w.update) == null || I.call(w, {
4633
- id: w.id,
4632
+ }), (I = b.update) == null || I.call(b, {
4633
+ id: b.id,
4634
4634
  title: "Success",
4635
4635
  description: `Opened ${d.name}`,
4636
4636
  open: !0
@@ -4638,7 +4638,7 @@ function co(e) {
4638
4638
  } catch (y) {
4639
4639
  console.error("Failed to fetch server file:", y);
4640
4640
  const x = y instanceof Error ? y.message : "Unknown error occurred";
4641
- (C = w.update) == null || C.call(w, { id: w.id, title: "Failed", description: x }), o({
4641
+ (C = b.update) == null || C.call(b, { id: b.id, title: "Failed", description: x }), o({
4642
4642
  title: "Failed to fetch file",
4643
4643
  description: x,
4644
4644
  open: !0
@@ -4648,7 +4648,7 @@ function co(e) {
4648
4648
  }
4649
4649
  }
4650
4650
  } catch (T) {
4651
- console.error("File click error:", T), a((N) => ({ ...N, [v]: !1 }));
4651
+ console.error("File click error:", T), a((P) => ({ ...P, [v]: !1 }));
4652
4652
  }
4653
4653
  },
4654
4654
  [t, s, o, n, m]
@@ -4734,14 +4734,14 @@ function uo(e) {
4734
4734
  }, [e]);
4735
4735
  }
4736
4736
  function Wr(e) {
4737
- var z;
4737
+ var _;
4738
4738
  const t = typeof e == "string" ? e : e == null ? void 0 : e.threadId, n = typeof e == "object" ? e.lazy : !1, r = rt({ optional: !0 }), o = Dt({ optional: !0 }), s = Ur(), { currentThreadId: a, setCurrentThreadId: i, actions: u } = r || {
4739
4739
  currentThreadId: null,
4740
4740
  setCurrentThreadId: () => {
4741
4741
  },
4742
4742
  actions: {}
4743
- }, c = !!t && t !== a, [l, f] = $([]), m = R((j) => {
4744
- f(j);
4743
+ }, c = !!t && t !== a, [l, f] = V([]), m = z((U) => {
4744
+ f(U);
4745
4745
  }, []), {
4746
4746
  isLoadingThread: h,
4747
4747
  threadStateError: k,
@@ -4761,17 +4761,17 @@ function Wr(e) {
4761
4761
  !c && !n && a && (o != null && o.loadThread) && o.loadThread(a);
4762
4762
  }, [c, n, a, o == null ? void 0 : o.loadThread]);
4763
4763
  const I = Q(() => {
4764
- var j;
4765
- return ((j = d[0]) == null ? void 0 : j.values) || {};
4766
- }, [d]), C = Q(() => ({ timeline: [], messagePreviews: {} }), []), T = t || a, N = c ? h ? "loading" : "idle" : (o == null ? void 0 : o.status) || "idle", w = c ? l : (s == null ? void 0 : s.messages) || [], y = c ? h : (o == null ? void 0 : o.isLoading) || !1, x = c ? I : (o == null ? void 0 : o.values) || {}, p = c ? {} : (o == null ? void 0 : o.taskMessagesByScope) || {}, b = c ? k : (s == null ? void 0 : s.error) || (o == null ? void 0 : o.error) || null;
4764
+ var U;
4765
+ return ((U = d[0]) == null ? void 0 : U.values) || {};
4766
+ }, [d]), C = Q(() => ({ timeline: [], messagePreviews: {} }), []), T = t || a, P = c ? h ? "loading" : "idle" : (o == null ? void 0 : o.status) || "idle", b = c ? l : (s == null ? void 0 : s.messages) || [], y = c ? h : (o == null ? void 0 : o.isLoading) || !1, x = c ? I : (o == null ? void 0 : o.values) || {}, p = c ? {} : (o == null ? void 0 : o.taskMessagesByScope) || {}, w = c ? k : (s == null ? void 0 : s.error) || (o == null ? void 0 : o.error) || null;
4767
4767
  return {
4768
4768
  // UNIFIED: Single thread ID concept
4769
4769
  threadId: T,
4770
- status: N,
4771
- messages: w,
4770
+ status: P,
4771
+ messages: b,
4772
4772
  isLoading: y,
4773
4773
  isHistoryLoading: y,
4774
- error: b,
4774
+ error: w,
4775
4775
  // Values & Metadata
4776
4776
  values: x,
4777
4777
  taskMessagesByScope: p,
@@ -4795,7 +4795,7 @@ function Wr(e) {
4795
4795
  isStreaming: (s == null ? void 0 : s.isStreaming) || !1,
4796
4796
  activeMessageId: (s == null ? void 0 : s.activeMessageId) || null,
4797
4797
  connectionState: (s == null ? void 0 : s.connectionState) || "disconnected",
4798
- streamingAssistantId: !c && (s != null && s.isStreaming) && ((z = o == null ? void 0 : o.metadata) != null && z.assemblingMessageId) ? o.metadata.assemblingMessageId : null,
4798
+ streamingAssistantId: !c && (s != null && s.isStreaming) && ((_ = o == null ? void 0 : o.metadata) != null && _.assemblingMessageId) ? o.metadata.assemblingMessageId : null,
4799
4799
  // Actions
4800
4800
  submit: (s == null ? void 0 : s.submit) || (async () => {
4801
4801
  }),
@@ -4833,37 +4833,37 @@ function fo({
4833
4833
  threadId: m,
4834
4834
  clearComposerOnSend: h = !0
4835
4835
  }) {
4836
- const { messages: k } = Wr(), [d, v] = $(null), [I, C] = $(""), [T, N] = $(null), [w, y] = $(null), [x, p] = $(!1), [b, z] = $(""), j = K(b), M = K(null);
4836
+ const { messages: k } = Wr(), [d, v] = V(null), [I, C] = V(""), [T, P] = V(null), [b, y] = V(null), [x, p] = V(!1), [w, _] = V(""), U = K(w), M = K(null);
4837
4837
  q(() => {
4838
4838
  if (!d)
4839
4839
  if (m) {
4840
4840
  const g = localStorage.getItem(He(m));
4841
- z(g || "");
4841
+ _(g || "");
4842
4842
  } else
4843
- z("");
4843
+ _("");
4844
4844
  }, [m, d]);
4845
- const O = R((g) => {
4846
- z(g), !d && m && localStorage.setItem(He(m), g);
4845
+ const E = z((g) => {
4846
+ _(g), !d && m && localStorage.setItem(He(m), g);
4847
4847
  }, [m, d]);
4848
4848
  q(() => {
4849
- j.current = b;
4850
- }, [b]), q(() => {
4849
+ U.current = w;
4850
+ }, [w]), q(() => {
4851
4851
  if (!d) {
4852
4852
  M.current = null;
4853
4853
  return;
4854
4854
  }
4855
- M.current === null && (M.current = j.current), O(I ?? "");
4856
- }, [I, d, O]);
4857
- const E = R(
4855
+ M.current === null && (M.current = U.current), E(I ?? "");
4856
+ }, [I, d, E]);
4857
+ const j = z(
4858
4858
  (g) => {
4859
- O(g);
4859
+ E(g);
4860
4860
  },
4861
- [O]
4862
- ), L = async (g, A) => {
4863
- const S = Array.isArray(A) ? { files: A } : A ?? {}, H = S.files ?? [], J = S.contentParts ?? [], D = g.trim();
4864
- if (!(!D && H.length === 0 && J.length === 0))
4861
+ [E]
4862
+ ), N = async (g, A) => {
4863
+ const S = Array.isArray(A) ? { files: A } : A ?? {}, G = S.files ?? [], J = S.contentParts ?? [], D = g.trim();
4864
+ if (!(!D && G.length === 0 && J.length === 0))
4865
4865
  try {
4866
- const ee = H.map(async (X) => {
4866
+ const ee = G.map(async (X) => {
4867
4867
  try {
4868
4868
  const Z = await zt.uploadFile(X);
4869
4869
  return { file: X, record: Z };
@@ -4882,12 +4882,12 @@ function fo({
4882
4882
  name: X.filename,
4883
4883
  size: X.size
4884
4884
  };
4885
- }), W = [...J, ...ue], te = d ? (T == null ? void 0 : T.checkpointId) ?? n ?? void 0 : n ?? void 0, ve = d ? (T == null ? void 0 : T.checkpointNs) ?? r ?? void 0 : r ?? void 0;
4885
+ }), H = [...J, ...ue], te = d ? (T == null ? void 0 : T.checkpointId) ?? n ?? void 0 : n ?? void 0, ve = d ? (T == null ? void 0 : T.checkpointNs) ?? r ?? void 0 : r ?? void 0;
4886
4886
  await e(
4887
4887
  {
4888
4888
  text: D || "",
4889
- contentParts: W,
4890
- attachments: H,
4889
+ contentParts: H,
4890
+ attachments: G,
4891
4891
  payload: t.payload,
4892
4892
  edit: !!d,
4893
4893
  checkpointId: te,
@@ -4897,14 +4897,14 @@ function fo({
4897
4897
  config: t.config
4898
4898
  },
4899
4899
  f ? { onEvent: f } : void 0
4900
- ), o == null || o(D), c(!0), h && (m && localStorage.removeItem(He(m)), O("")), y(null), v(null), C(""), N(null);
4900
+ ), o == null || o(D), c(!0), h && (m && localStorage.removeItem(He(m)), E("")), y(null), v(null), C(""), P(null);
4901
4901
  } catch (ee) {
4902
4902
  const oe = (ee == null ? void 0 : ee.message) || "Failed to send message";
4903
4903
  y(oe), a == null || a(oe), c(!1);
4904
4904
  }
4905
- }, _ = (g, A) => {
4906
- A || L(g, { files: [] });
4907
- }, G = R(
4905
+ }, B = (g, A) => {
4906
+ A || N(g, { files: [] });
4907
+ }, O = z(
4908
4908
  async (g) => {
4909
4909
  await e(
4910
4910
  {
@@ -4919,19 +4919,19 @@ function fo({
4919
4919
  ), s == null || s({ file: g });
4920
4920
  },
4921
4921
  [n, r, t, s, e]
4922
- ), F = R(
4922
+ ), L = z(
4923
4923
  (g, A, S) => {
4924
- i && (M.current = b, v(g), C(A), N({
4924
+ i && (M.current = w, v(g), C(A), P({
4925
4925
  checkpointId: (S == null ? void 0 : S.checkpointId) ?? null,
4926
4926
  checkpointNs: (S == null ? void 0 : S.checkpointNs) ?? null
4927
4927
  }), y(null));
4928
4928
  },
4929
- [b, i]
4930
- ), P = R(() => {
4931
- v(null), C(""), N(null), y(null);
4929
+ [w, i]
4930
+ ), F = z(() => {
4931
+ v(null), C(""), P(null), y(null);
4932
4932
  const g = M.current;
4933
- g !== null && z(g), M.current = null;
4934
- }, []), V = R((g) => {
4933
+ g !== null && _(g), M.current = null;
4934
+ }, []), W = z((g) => {
4935
4935
  let A = null;
4936
4936
  for (let D = g - 1; D >= 0; D--)
4937
4937
  if (u[D].role === "user") {
@@ -4962,18 +4962,18 @@ function fo({
4962
4962
  return {
4963
4963
  editingMessageId: d,
4964
4964
  editingInitialValue: I,
4965
- inputError: w,
4965
+ inputError: b,
4966
4966
  setInputError: y,
4967
4967
  dismissError: x,
4968
4968
  setDismissError: p,
4969
- composerValue: b,
4970
- handleComposerChange: E,
4971
- handleSendMessage: L,
4972
- handleQuickPrompt: _,
4973
- handleExcelUpload: G,
4974
- startEditing: F,
4975
- cancelEditing: P,
4976
- handleRegenerateCb: V,
4969
+ composerValue: w,
4970
+ handleComposerChange: j,
4971
+ handleSendMessage: N,
4972
+ handleQuickPrompt: B,
4973
+ handleExcelUpload: O,
4974
+ startEditing: L,
4975
+ cancelEditing: F,
4976
+ handleRegenerateCb: W,
4977
4977
  displayMessages: k
4978
4978
  };
4979
4979
  }
@@ -4993,7 +4993,7 @@ function po(e) {
4993
4993
  }, [e]);
4994
4994
  }
4995
4995
  function go(e, t, n) {
4996
- const [r, o] = $(e), s = K(e), a = K(null);
4996
+ const [r, o] = V(e), s = K(e), a = K(null);
4997
4997
  return q(() => {
4998
4998
  s.current = e;
4999
4999
  const i = () => {