@teodorruskvi/chat-core 0.1.35 → 0.1.37
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 +708 -696
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +5 -5
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -29,8 +29,8 @@ const et = "-", Zt = (e) => {
|
|
|
29
29
|
return i[0] === "" && i.length !== 1 && i.shift(), Tt(i, t) || en(a);
|
|
30
30
|
},
|
|
31
31
|
getConflictingClassGroupIds: (a, i) => {
|
|
32
|
-
const
|
|
33
|
-
return i && r[a] ? [...
|
|
32
|
+
const u = n[a] || [];
|
|
33
|
+
return i && r[a] ? [...u, ...r[a]] : u;
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
36
|
}, Tt = (e, t) => {
|
|
@@ -120,18 +120,18 @@ const et = "-", Zt = (e) => {
|
|
|
120
120
|
n.has(s) ? n.set(s, a) : o(s, a);
|
|
121
121
|
}
|
|
122
122
|
};
|
|
123
|
-
},
|
|
123
|
+
}, xt = "!", sn = (e) => {
|
|
124
124
|
const {
|
|
125
125
|
separator: t,
|
|
126
126
|
experimentalParseClassName: n
|
|
127
127
|
} = e, r = t.length === 1, o = t[0], s = t.length, a = (i) => {
|
|
128
|
-
const
|
|
128
|
+
const u = [];
|
|
129
129
|
let c = 0, l = 0, p;
|
|
130
130
|
for (let w = 0; w < i.length; w++) {
|
|
131
131
|
let k = i[w];
|
|
132
132
|
if (c === 0) {
|
|
133
133
|
if (k === o && (r || i.slice(w, w + s) === t)) {
|
|
134
|
-
|
|
134
|
+
u.push(i.slice(l, w)), l = w + s;
|
|
135
135
|
continue;
|
|
136
136
|
}
|
|
137
137
|
if (k === "/") {
|
|
@@ -141,9 +141,9 @@ const et = "-", Zt = (e) => {
|
|
|
141
141
|
}
|
|
142
142
|
k === "[" ? c++ : k === "]" && c--;
|
|
143
143
|
}
|
|
144
|
-
const m =
|
|
144
|
+
const m = u.length === 0 ? i : i.substring(l), h = m.startsWith(xt), v = h ? m.substring(1) : m, f = p && p > l ? p - l : void 0;
|
|
145
145
|
return {
|
|
146
|
-
modifiers:
|
|
146
|
+
modifiers: u,
|
|
147
147
|
hasImportantModifier: h,
|
|
148
148
|
baseClassName: v,
|
|
149
149
|
maybePostfixModifierPosition: f
|
|
@@ -165,15 +165,15 @@ const et = "-", Zt = (e) => {
|
|
|
165
165
|
cache: on(e.cacheSize),
|
|
166
166
|
parseClassName: sn(e),
|
|
167
167
|
...Zt(e)
|
|
168
|
-
}), ln = /\s+/,
|
|
168
|
+
}), ln = /\s+/, un = (e, t) => {
|
|
169
169
|
const {
|
|
170
170
|
parseClassName: n,
|
|
171
171
|
getClassGroupId: r,
|
|
172
172
|
getConflictingClassGroupIds: o
|
|
173
173
|
} = t, s = [], a = e.trim().split(ln);
|
|
174
174
|
let i = "";
|
|
175
|
-
for (let
|
|
176
|
-
const c = a[
|
|
175
|
+
for (let u = a.length - 1; u >= 0; u -= 1) {
|
|
176
|
+
const c = a[u], {
|
|
177
177
|
modifiers: l,
|
|
178
178
|
hasImportantModifier: p,
|
|
179
179
|
baseClassName: m,
|
|
@@ -191,54 +191,54 @@ const et = "-", Zt = (e) => {
|
|
|
191
191
|
}
|
|
192
192
|
v = !1;
|
|
193
193
|
}
|
|
194
|
-
const w = an(l).join(":"), k = p ? w +
|
|
195
|
-
if (s.includes(
|
|
194
|
+
const w = an(l).join(":"), k = p ? w + xt : w, E = k + f;
|
|
195
|
+
if (s.includes(E))
|
|
196
196
|
continue;
|
|
197
|
-
s.push(
|
|
197
|
+
s.push(E);
|
|
198
198
|
const I = o(f, v);
|
|
199
|
-
for (let
|
|
200
|
-
const P = I[
|
|
199
|
+
for (let N = 0; N < I.length; ++N) {
|
|
200
|
+
const P = I[N];
|
|
201
201
|
s.push(k + P);
|
|
202
202
|
}
|
|
203
203
|
i = c + (i.length > 0 ? " " + i : i);
|
|
204
204
|
}
|
|
205
205
|
return i;
|
|
206
206
|
};
|
|
207
|
-
function
|
|
207
|
+
function dn() {
|
|
208
208
|
let e = 0, t, n, r = "";
|
|
209
209
|
for (; e < arguments.length; )
|
|
210
|
-
(t = arguments[e++]) && (n =
|
|
210
|
+
(t = arguments[e++]) && (n = At(t)) && (r && (r += " "), r += n);
|
|
211
211
|
return r;
|
|
212
212
|
}
|
|
213
|
-
const
|
|
213
|
+
const At = (e) => {
|
|
214
214
|
if (typeof e == "string")
|
|
215
215
|
return e;
|
|
216
216
|
let t, n = "";
|
|
217
217
|
for (let r = 0; r < e.length; r++)
|
|
218
|
-
e[r] && (t =
|
|
218
|
+
e[r] && (t = At(e[r])) && (n && (n += " "), n += t);
|
|
219
219
|
return n;
|
|
220
220
|
};
|
|
221
221
|
function fn(e, ...t) {
|
|
222
222
|
let n, r, o, s = a;
|
|
223
|
-
function a(
|
|
223
|
+
function a(u) {
|
|
224
224
|
const c = t.reduce((l, p) => p(l), e());
|
|
225
|
-
return n = cn(c), r = n.cache.get, o = n.cache.set, s = i, i(
|
|
225
|
+
return n = cn(c), r = n.cache.get, o = n.cache.set, s = i, i(u);
|
|
226
226
|
}
|
|
227
|
-
function i(
|
|
228
|
-
const c = r(
|
|
227
|
+
function i(u) {
|
|
228
|
+
const c = r(u);
|
|
229
229
|
if (c)
|
|
230
230
|
return c;
|
|
231
|
-
const l =
|
|
232
|
-
return o(
|
|
231
|
+
const l = un(u, n);
|
|
232
|
+
return o(u, l), l;
|
|
233
233
|
}
|
|
234
234
|
return function() {
|
|
235
|
-
return s(
|
|
235
|
+
return s(dn.apply(null, arguments));
|
|
236
236
|
};
|
|
237
237
|
}
|
|
238
|
-
const
|
|
238
|
+
const K = (e) => {
|
|
239
239
|
const t = (n) => n[e] || [];
|
|
240
240
|
return t.isThemeGetter = !0, t;
|
|
241
|
-
}, St = /^\[(?:([a-z-]+):)?(.+)\]$/i, pn = /^\d+\/\d+$/, gn = /* @__PURE__ */ new Set(["px", "full", "screen"]), mn = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/, hn = /\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$/, yn = /^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/, bn = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/, wn = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/, fe = (e) =>
|
|
241
|
+
}, St = /^\[(?:([a-z-]+):)?(.+)\]$/i, pn = /^\d+\/\d+$/, gn = /* @__PURE__ */ new Set(["px", "full", "screen"]), mn = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/, hn = /\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$/, yn = /^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/, bn = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/, wn = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/, fe = (e) => xe(e) || gn.has(e) || pn.test(e), be = (e) => Ce(e, "length", Cn), xe = (e) => !!e && !Number.isNaN(Number(e)), He = (e) => Ce(e, "number", xe), Pe = (e) => !!e && Number.isInteger(Number(e)), vn = (e) => e.endsWith("%") && xe(e.slice(0, -1)), j = (e) => St.test(e), we = (e) => mn.test(e), kn = /* @__PURE__ */ new Set(["length", "size", "percentage"]), In = (e) => Ce(e, kn, Ct), Tn = (e) => Ce(e, "position", Ct), xn = /* @__PURE__ */ new Set(["image", "url"]), An = (e) => Ce(e, xn, En), Sn = (e) => Ce(e, "", Mn), _e = () => !0, Ce = (e, t, n) => {
|
|
242
242
|
const r = St.exec(e);
|
|
243
243
|
return r ? r[1] ? typeof t == "string" ? r[1] === t : t.has(r[1]) : n(r[2]) : !1;
|
|
244
244
|
}, Cn = (e) => (
|
|
@@ -247,36 +247,36 @@ const D = (e) => {
|
|
|
247
247
|
// I could also use lookbehind assertion in `lengthUnitRegex` but that isn't supported widely enough.
|
|
248
248
|
hn.test(e) && !yn.test(e)
|
|
249
249
|
), Ct = () => !1, Mn = (e) => bn.test(e), En = (e) => wn.test(e), Pn = () => {
|
|
250
|
-
const e =
|
|
250
|
+
const e = K("colors"), t = K("spacing"), n = K("blur"), r = K("brightness"), o = K("borderColor"), s = K("borderRadius"), a = K("borderSpacing"), i = K("borderWidth"), u = K("contrast"), c = K("grayscale"), l = K("hueRotate"), p = K("invert"), m = K("gap"), h = K("gradientColorStops"), v = K("gradientColorStopPositions"), f = K("inset"), w = K("margin"), k = K("opacity"), E = K("padding"), I = K("saturate"), N = K("scale"), P = K("sepia"), T = K("skew"), S = K("space"), g = K("translate"), b = () => ["auto", "contain", "none"], O = () => ["auto", "hidden", "clip", "visible", "scroll"], U = () => ["auto", j, t], C = () => [j, t], M = () => ["", fe, be], L = () => ["auto", xe, j], R = () => ["bottom", "center", "left", "left-bottom", "left-top", "right", "right-bottom", "right-top", "top"], V = () => ["solid", "dashed", "dotted", "double", "none"], D = () => ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"], A = () => ["start", "end", "center", "between", "around", "evenly", "stretch"], y = () => ["", "0", j], F = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"], $ = () => [xe, j];
|
|
251
251
|
return {
|
|
252
252
|
cacheSize: 500,
|
|
253
253
|
separator: ":",
|
|
254
254
|
theme: {
|
|
255
255
|
colors: [_e],
|
|
256
256
|
spacing: [fe, be],
|
|
257
|
-
blur: ["none", "", we,
|
|
258
|
-
brightness:
|
|
257
|
+
blur: ["none", "", we, j],
|
|
258
|
+
brightness: $(),
|
|
259
259
|
borderColor: [e],
|
|
260
|
-
borderRadius: ["none", "", "full", we,
|
|
261
|
-
borderSpacing:
|
|
262
|
-
borderWidth:
|
|
263
|
-
contrast:
|
|
264
|
-
grayscale:
|
|
265
|
-
hueRotate:
|
|
266
|
-
invert:
|
|
267
|
-
gap:
|
|
260
|
+
borderRadius: ["none", "", "full", we, j],
|
|
261
|
+
borderSpacing: C(),
|
|
262
|
+
borderWidth: M(),
|
|
263
|
+
contrast: $(),
|
|
264
|
+
grayscale: y(),
|
|
265
|
+
hueRotate: $(),
|
|
266
|
+
invert: y(),
|
|
267
|
+
gap: C(),
|
|
268
268
|
gradientColorStops: [e],
|
|
269
269
|
gradientColorStopPositions: [vn, be],
|
|
270
270
|
inset: U(),
|
|
271
271
|
margin: U(),
|
|
272
|
-
opacity:
|
|
273
|
-
padding:
|
|
274
|
-
saturate:
|
|
275
|
-
scale:
|
|
276
|
-
sepia:
|
|
277
|
-
skew:
|
|
278
|
-
space:
|
|
279
|
-
translate:
|
|
272
|
+
opacity: $(),
|
|
273
|
+
padding: C(),
|
|
274
|
+
saturate: $(),
|
|
275
|
+
scale: $(),
|
|
276
|
+
sepia: y(),
|
|
277
|
+
skew: $(),
|
|
278
|
+
space: C(),
|
|
279
|
+
translate: C()
|
|
280
280
|
},
|
|
281
281
|
classGroups: {
|
|
282
282
|
// Layout
|
|
@@ -285,7 +285,7 @@ const D = (e) => {
|
|
|
285
285
|
* @see https://tailwindcss.com/docs/aspect-ratio
|
|
286
286
|
*/
|
|
287
287
|
aspect: [{
|
|
288
|
-
aspect: ["auto", "square", "video",
|
|
288
|
+
aspect: ["auto", "square", "video", j]
|
|
289
289
|
}],
|
|
290
290
|
/**
|
|
291
291
|
* Container
|
|
@@ -304,14 +304,14 @@ const D = (e) => {
|
|
|
304
304
|
* @see https://tailwindcss.com/docs/break-after
|
|
305
305
|
*/
|
|
306
306
|
"break-after": [{
|
|
307
|
-
"break-after":
|
|
307
|
+
"break-after": F()
|
|
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":
|
|
314
|
+
"break-before": F()
|
|
315
315
|
}],
|
|
316
316
|
/**
|
|
317
317
|
* Break Inside
|
|
@@ -370,49 +370,49 @@ const D = (e) => {
|
|
|
370
370
|
* @see https://tailwindcss.com/docs/object-position
|
|
371
371
|
*/
|
|
372
372
|
"object-position": [{
|
|
373
|
-
object: [...
|
|
373
|
+
object: [...R(), j]
|
|
374
374
|
}],
|
|
375
375
|
/**
|
|
376
376
|
* Overflow
|
|
377
377
|
* @see https://tailwindcss.com/docs/overflow
|
|
378
378
|
*/
|
|
379
379
|
overflow: [{
|
|
380
|
-
overflow:
|
|
380
|
+
overflow: O()
|
|
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":
|
|
387
|
+
"overflow-x": O()
|
|
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":
|
|
394
|
+
"overflow-y": O()
|
|
395
395
|
}],
|
|
396
396
|
/**
|
|
397
397
|
* Overscroll Behavior
|
|
398
398
|
* @see https://tailwindcss.com/docs/overscroll-behavior
|
|
399
399
|
*/
|
|
400
400
|
overscroll: [{
|
|
401
|
-
overscroll:
|
|
401
|
+
overscroll: b()
|
|
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":
|
|
408
|
+
"overscroll-x": b()
|
|
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":
|
|
415
|
+
"overscroll-y": b()
|
|
416
416
|
}],
|
|
417
417
|
/**
|
|
418
418
|
* Position
|
|
@@ -492,7 +492,7 @@ const D = (e) => {
|
|
|
492
492
|
* @see https://tailwindcss.com/docs/z-index
|
|
493
493
|
*/
|
|
494
494
|
z: [{
|
|
495
|
-
z: ["auto", Pe,
|
|
495
|
+
z: ["auto", Pe, j]
|
|
496
496
|
}],
|
|
497
497
|
// Flexbox and Grid
|
|
498
498
|
/**
|
|
@@ -521,28 +521,28 @@ const D = (e) => {
|
|
|
521
521
|
* @see https://tailwindcss.com/docs/flex
|
|
522
522
|
*/
|
|
523
523
|
flex: [{
|
|
524
|
-
flex: ["1", "auto", "initial", "none",
|
|
524
|
+
flex: ["1", "auto", "initial", "none", j]
|
|
525
525
|
}],
|
|
526
526
|
/**
|
|
527
527
|
* Flex Grow
|
|
528
528
|
* @see https://tailwindcss.com/docs/flex-grow
|
|
529
529
|
*/
|
|
530
530
|
grow: [{
|
|
531
|
-
grow:
|
|
531
|
+
grow: y()
|
|
532
532
|
}],
|
|
533
533
|
/**
|
|
534
534
|
* Flex Shrink
|
|
535
535
|
* @see https://tailwindcss.com/docs/flex-shrink
|
|
536
536
|
*/
|
|
537
537
|
shrink: [{
|
|
538
|
-
shrink:
|
|
538
|
+
shrink: y()
|
|
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,
|
|
545
|
+
order: ["first", "last", "none", Pe, j]
|
|
546
546
|
}],
|
|
547
547
|
/**
|
|
548
548
|
* Grid Template Columns
|
|
@@ -557,22 +557,22 @@ const D = (e) => {
|
|
|
557
557
|
*/
|
|
558
558
|
"col-start-end": [{
|
|
559
559
|
col: ["auto", {
|
|
560
|
-
span: ["full", Pe,
|
|
561
|
-
},
|
|
560
|
+
span: ["full", Pe, j]
|
|
561
|
+
}, j]
|
|
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":
|
|
568
|
+
"col-start": L()
|
|
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":
|
|
575
|
+
"col-end": L()
|
|
576
576
|
}],
|
|
577
577
|
/**
|
|
578
578
|
* Grid Template Rows
|
|
@@ -587,22 +587,22 @@ const D = (e) => {
|
|
|
587
587
|
*/
|
|
588
588
|
"row-start-end": [{
|
|
589
589
|
row: ["auto", {
|
|
590
|
-
span: [Pe,
|
|
591
|
-
},
|
|
590
|
+
span: [Pe, j]
|
|
591
|
+
}, j]
|
|
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":
|
|
598
|
+
"row-start": L()
|
|
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":
|
|
605
|
+
"row-end": L()
|
|
606
606
|
}],
|
|
607
607
|
/**
|
|
608
608
|
* Grid Auto Flow
|
|
@@ -616,14 +616,14 @@ const D = (e) => {
|
|
|
616
616
|
* @see https://tailwindcss.com/docs/grid-auto-columns
|
|
617
617
|
*/
|
|
618
618
|
"auto-cols": [{
|
|
619
|
-
"auto-cols": ["auto", "min", "max", "fr",
|
|
619
|
+
"auto-cols": ["auto", "min", "max", "fr", j]
|
|
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",
|
|
626
|
+
"auto-rows": ["auto", "min", "max", "fr", j]
|
|
627
627
|
}],
|
|
628
628
|
/**
|
|
629
629
|
* Gap
|
|
@@ -651,7 +651,7 @@ const D = (e) => {
|
|
|
651
651
|
* @see https://tailwindcss.com/docs/justify-content
|
|
652
652
|
*/
|
|
653
653
|
"justify-content": [{
|
|
654
|
-
justify: ["normal", ...
|
|
654
|
+
justify: ["normal", ...A()]
|
|
655
655
|
}],
|
|
656
656
|
/**
|
|
657
657
|
* Justify Items
|
|
@@ -672,7 +672,7 @@ const D = (e) => {
|
|
|
672
672
|
* @see https://tailwindcss.com/docs/align-content
|
|
673
673
|
*/
|
|
674
674
|
"align-content": [{
|
|
675
|
-
content: ["normal", ...
|
|
675
|
+
content: ["normal", ...A(), "baseline"]
|
|
676
676
|
}],
|
|
677
677
|
/**
|
|
678
678
|
* Align Items
|
|
@@ -693,7 +693,7 @@ const D = (e) => {
|
|
|
693
693
|
* @see https://tailwindcss.com/docs/place-content
|
|
694
694
|
*/
|
|
695
695
|
"place-content": [{
|
|
696
|
-
"place-content": [...
|
|
696
|
+
"place-content": [...A(), "baseline"]
|
|
697
697
|
}],
|
|
698
698
|
/**
|
|
699
699
|
* Place Items
|
|
@@ -715,63 +715,63 @@ const D = (e) => {
|
|
|
715
715
|
* @see https://tailwindcss.com/docs/padding
|
|
716
716
|
*/
|
|
717
717
|
p: [{
|
|
718
|
-
p: [
|
|
718
|
+
p: [E]
|
|
719
719
|
}],
|
|
720
720
|
/**
|
|
721
721
|
* Padding X
|
|
722
722
|
* @see https://tailwindcss.com/docs/padding
|
|
723
723
|
*/
|
|
724
724
|
px: [{
|
|
725
|
-
px: [
|
|
725
|
+
px: [E]
|
|
726
726
|
}],
|
|
727
727
|
/**
|
|
728
728
|
* Padding Y
|
|
729
729
|
* @see https://tailwindcss.com/docs/padding
|
|
730
730
|
*/
|
|
731
731
|
py: [{
|
|
732
|
-
py: [
|
|
732
|
+
py: [E]
|
|
733
733
|
}],
|
|
734
734
|
/**
|
|
735
735
|
* Padding Start
|
|
736
736
|
* @see https://tailwindcss.com/docs/padding
|
|
737
737
|
*/
|
|
738
738
|
ps: [{
|
|
739
|
-
ps: [
|
|
739
|
+
ps: [E]
|
|
740
740
|
}],
|
|
741
741
|
/**
|
|
742
742
|
* Padding End
|
|
743
743
|
* @see https://tailwindcss.com/docs/padding
|
|
744
744
|
*/
|
|
745
745
|
pe: [{
|
|
746
|
-
pe: [
|
|
746
|
+
pe: [E]
|
|
747
747
|
}],
|
|
748
748
|
/**
|
|
749
749
|
* Padding Top
|
|
750
750
|
* @see https://tailwindcss.com/docs/padding
|
|
751
751
|
*/
|
|
752
752
|
pt: [{
|
|
753
|
-
pt: [
|
|
753
|
+
pt: [E]
|
|
754
754
|
}],
|
|
755
755
|
/**
|
|
756
756
|
* Padding Right
|
|
757
757
|
* @see https://tailwindcss.com/docs/padding
|
|
758
758
|
*/
|
|
759
759
|
pr: [{
|
|
760
|
-
pr: [
|
|
760
|
+
pr: [E]
|
|
761
761
|
}],
|
|
762
762
|
/**
|
|
763
763
|
* Padding Bottom
|
|
764
764
|
* @see https://tailwindcss.com/docs/padding
|
|
765
765
|
*/
|
|
766
766
|
pb: [{
|
|
767
|
-
pb: [
|
|
767
|
+
pb: [E]
|
|
768
768
|
}],
|
|
769
769
|
/**
|
|
770
770
|
* Padding Left
|
|
771
771
|
* @see https://tailwindcss.com/docs/padding
|
|
772
772
|
*/
|
|
773
773
|
pl: [{
|
|
774
|
-
pl: [
|
|
774
|
+
pl: [E]
|
|
775
775
|
}],
|
|
776
776
|
/**
|
|
777
777
|
* Margin
|
|
@@ -841,7 +841,7 @@ const D = (e) => {
|
|
|
841
841
|
* @see https://tailwindcss.com/docs/space
|
|
842
842
|
*/
|
|
843
843
|
"space-x": [{
|
|
844
|
-
"space-x": [
|
|
844
|
+
"space-x": [S]
|
|
845
845
|
}],
|
|
846
846
|
/**
|
|
847
847
|
* Space Between X Reverse
|
|
@@ -853,7 +853,7 @@ const D = (e) => {
|
|
|
853
853
|
* @see https://tailwindcss.com/docs/space
|
|
854
854
|
*/
|
|
855
855
|
"space-y": [{
|
|
856
|
-
"space-y": [
|
|
856
|
+
"space-y": [S]
|
|
857
857
|
}],
|
|
858
858
|
/**
|
|
859
859
|
* Space Between Y Reverse
|
|
@@ -866,21 +866,21 @@ const D = (e) => {
|
|
|
866
866
|
* @see https://tailwindcss.com/docs/width
|
|
867
867
|
*/
|
|
868
868
|
w: [{
|
|
869
|
-
w: ["auto", "min", "max", "fit", "svw", "lvw", "dvw",
|
|
869
|
+
w: ["auto", "min", "max", "fit", "svw", "lvw", "dvw", j, 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": [
|
|
876
|
+
"min-w": [j, 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": [
|
|
883
|
+
"max-w": [j, t, "none", "full", "min", "max", "fit", "prose", {
|
|
884
884
|
screen: [we]
|
|
885
885
|
}, we]
|
|
886
886
|
}],
|
|
@@ -889,28 +889,28 @@ const D = (e) => {
|
|
|
889
889
|
* @see https://tailwindcss.com/docs/height
|
|
890
890
|
*/
|
|
891
891
|
h: [{
|
|
892
|
-
h: [
|
|
892
|
+
h: [j, 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": [
|
|
899
|
+
"min-h": [j, 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": [
|
|
906
|
+
"max-h": [j, 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: [
|
|
913
|
+
size: [j, t, "auto", "min", "max", "fit"]
|
|
914
914
|
}],
|
|
915
915
|
// Typography
|
|
916
916
|
/**
|
|
@@ -979,35 +979,35 @@ const D = (e) => {
|
|
|
979
979
|
* @see https://tailwindcss.com/docs/letter-spacing
|
|
980
980
|
*/
|
|
981
981
|
tracking: [{
|
|
982
|
-
tracking: ["tighter", "tight", "normal", "wide", "wider", "widest",
|
|
982
|
+
tracking: ["tighter", "tight", "normal", "wide", "wider", "widest", j]
|
|
983
983
|
}],
|
|
984
984
|
/**
|
|
985
985
|
* Line Clamp
|
|
986
986
|
* @see https://tailwindcss.com/docs/line-clamp
|
|
987
987
|
*/
|
|
988
988
|
"line-clamp": [{
|
|
989
|
-
"line-clamp": ["none",
|
|
989
|
+
"line-clamp": ["none", xe, He]
|
|
990
990
|
}],
|
|
991
991
|
/**
|
|
992
992
|
* Line Height
|
|
993
993
|
* @see https://tailwindcss.com/docs/line-height
|
|
994
994
|
*/
|
|
995
995
|
leading: [{
|
|
996
|
-
leading: ["none", "tight", "snug", "normal", "relaxed", "loose", fe,
|
|
996
|
+
leading: ["none", "tight", "snug", "normal", "relaxed", "loose", fe, j]
|
|
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",
|
|
1003
|
+
"list-image": ["none", j]
|
|
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",
|
|
1010
|
+
list: ["none", "disc", "decimal", j]
|
|
1011
1011
|
}],
|
|
1012
1012
|
/**
|
|
1013
1013
|
* List Style Position
|
|
@@ -1076,7 +1076,7 @@ const D = (e) => {
|
|
|
1076
1076
|
* @see https://tailwindcss.com/docs/text-underline-offset
|
|
1077
1077
|
*/
|
|
1078
1078
|
"underline-offset": [{
|
|
1079
|
-
"underline-offset": ["auto", fe,
|
|
1079
|
+
"underline-offset": ["auto", fe, j]
|
|
1080
1080
|
}],
|
|
1081
1081
|
/**
|
|
1082
1082
|
* Text Decoration Color
|
|
@@ -1107,14 +1107,14 @@ const D = (e) => {
|
|
|
1107
1107
|
* @see https://tailwindcss.com/docs/text-indent
|
|
1108
1108
|
*/
|
|
1109
1109
|
indent: [{
|
|
1110
|
-
indent:
|
|
1110
|
+
indent: C()
|
|
1111
1111
|
}],
|
|
1112
1112
|
/**
|
|
1113
1113
|
* Vertical Alignment
|
|
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",
|
|
1117
|
+
align: ["baseline", "top", "middle", "bottom", "text-top", "text-bottom", "sub", "super", j]
|
|
1118
1118
|
}],
|
|
1119
1119
|
/**
|
|
1120
1120
|
* Whitespace
|
|
@@ -1142,7 +1142,7 @@ const D = (e) => {
|
|
|
1142
1142
|
* @see https://tailwindcss.com/docs/content
|
|
1143
1143
|
*/
|
|
1144
1144
|
content: [{
|
|
1145
|
-
content: ["none",
|
|
1145
|
+
content: ["none", j]
|
|
1146
1146
|
}],
|
|
1147
1147
|
// Backgrounds
|
|
1148
1148
|
/**
|
|
@@ -1179,7 +1179,7 @@ const D = (e) => {
|
|
|
1179
1179
|
* @see https://tailwindcss.com/docs/background-position
|
|
1180
1180
|
*/
|
|
1181
1181
|
"bg-position": [{
|
|
1182
|
-
bg: [...
|
|
1182
|
+
bg: [...R(), Tn]
|
|
1183
1183
|
}],
|
|
1184
1184
|
/**
|
|
1185
1185
|
* Background Repeat
|
|
@@ -1204,7 +1204,7 @@ const D = (e) => {
|
|
|
1204
1204
|
"bg-image": [{
|
|
1205
1205
|
bg: ["none", {
|
|
1206
1206
|
"gradient-to": ["t", "tr", "r", "br", "b", "bl", "l", "tl"]
|
|
1207
|
-
},
|
|
1207
|
+
}, An]
|
|
1208
1208
|
}],
|
|
1209
1209
|
/**
|
|
1210
1210
|
* Background Color
|
|
@@ -1558,7 +1558,7 @@ const D = (e) => {
|
|
|
1558
1558
|
* @see https://tailwindcss.com/docs/outline-offset
|
|
1559
1559
|
*/
|
|
1560
1560
|
"outline-offset": [{
|
|
1561
|
-
"outline-offset": [fe,
|
|
1561
|
+
"outline-offset": [fe, j]
|
|
1562
1562
|
}],
|
|
1563
1563
|
/**
|
|
1564
1564
|
* Outline Width
|
|
@@ -1579,7 +1579,7 @@ const D = (e) => {
|
|
|
1579
1579
|
* @see https://tailwindcss.com/docs/ring-width
|
|
1580
1580
|
*/
|
|
1581
1581
|
"ring-w": [{
|
|
1582
|
-
ring:
|
|
1582
|
+
ring: M()
|
|
1583
1583
|
}],
|
|
1584
1584
|
/**
|
|
1585
1585
|
* Ring Width Inset
|
|
@@ -1641,14 +1641,14 @@ const D = (e) => {
|
|
|
1641
1641
|
* @see https://tailwindcss.com/docs/mix-blend-mode
|
|
1642
1642
|
*/
|
|
1643
1643
|
"mix-blend": [{
|
|
1644
|
-
"mix-blend": [...
|
|
1644
|
+
"mix-blend": [...D(), "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":
|
|
1651
|
+
"bg-blend": D()
|
|
1652
1652
|
}],
|
|
1653
1653
|
// Filters
|
|
1654
1654
|
/**
|
|
@@ -1678,14 +1678,14 @@ const D = (e) => {
|
|
|
1678
1678
|
* @see https://tailwindcss.com/docs/contrast
|
|
1679
1679
|
*/
|
|
1680
1680
|
contrast: [{
|
|
1681
|
-
contrast: [
|
|
1681
|
+
contrast: [u]
|
|
1682
1682
|
}],
|
|
1683
1683
|
/**
|
|
1684
1684
|
* Drop Shadow
|
|
1685
1685
|
* @see https://tailwindcss.com/docs/drop-shadow
|
|
1686
1686
|
*/
|
|
1687
1687
|
"drop-shadow": [{
|
|
1688
|
-
"drop-shadow": ["", "none", we,
|
|
1688
|
+
"drop-shadow": ["", "none", we, j]
|
|
1689
1689
|
}],
|
|
1690
1690
|
/**
|
|
1691
1691
|
* Grayscale
|
|
@@ -1749,7 +1749,7 @@ const D = (e) => {
|
|
|
1749
1749
|
* @see https://tailwindcss.com/docs/backdrop-contrast
|
|
1750
1750
|
*/
|
|
1751
1751
|
"backdrop-contrast": [{
|
|
1752
|
-
"backdrop-contrast": [
|
|
1752
|
+
"backdrop-contrast": [u]
|
|
1753
1753
|
}],
|
|
1754
1754
|
/**
|
|
1755
1755
|
* Backdrop Grayscale
|
|
@@ -1842,35 +1842,35 @@ const D = (e) => {
|
|
|
1842
1842
|
* @see https://tailwindcss.com/docs/transition-property
|
|
1843
1843
|
*/
|
|
1844
1844
|
transition: [{
|
|
1845
|
-
transition: ["none", "all", "", "colors", "opacity", "shadow", "transform",
|
|
1845
|
+
transition: ["none", "all", "", "colors", "opacity", "shadow", "transform", j]
|
|
1846
1846
|
}],
|
|
1847
1847
|
/**
|
|
1848
1848
|
* Transition Duration
|
|
1849
1849
|
* @see https://tailwindcss.com/docs/transition-duration
|
|
1850
1850
|
*/
|
|
1851
1851
|
duration: [{
|
|
1852
|
-
duration:
|
|
1852
|
+
duration: $()
|
|
1853
1853
|
}],
|
|
1854
1854
|
/**
|
|
1855
1855
|
* Transition Timing Function
|
|
1856
1856
|
* @see https://tailwindcss.com/docs/transition-timing-function
|
|
1857
1857
|
*/
|
|
1858
1858
|
ease: [{
|
|
1859
|
-
ease: ["linear", "in", "out", "in-out",
|
|
1859
|
+
ease: ["linear", "in", "out", "in-out", j]
|
|
1860
1860
|
}],
|
|
1861
1861
|
/**
|
|
1862
1862
|
* Transition Delay
|
|
1863
1863
|
* @see https://tailwindcss.com/docs/transition-delay
|
|
1864
1864
|
*/
|
|
1865
1865
|
delay: [{
|
|
1866
|
-
delay:
|
|
1866
|
+
delay: $()
|
|
1867
1867
|
}],
|
|
1868
1868
|
/**
|
|
1869
1869
|
* Animation
|
|
1870
1870
|
* @see https://tailwindcss.com/docs/animation
|
|
1871
1871
|
*/
|
|
1872
1872
|
animate: [{
|
|
1873
|
-
animate: ["none", "spin", "ping", "pulse", "bounce",
|
|
1873
|
+
animate: ["none", "spin", "ping", "pulse", "bounce", j]
|
|
1874
1874
|
}],
|
|
1875
1875
|
// Transforms
|
|
1876
1876
|
/**
|
|
@@ -1885,28 +1885,28 @@ const D = (e) => {
|
|
|
1885
1885
|
* @see https://tailwindcss.com/docs/scale
|
|
1886
1886
|
*/
|
|
1887
1887
|
scale: [{
|
|
1888
|
-
scale: [
|
|
1888
|
+
scale: [N]
|
|
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": [
|
|
1895
|
+
"scale-x": [N]
|
|
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": [
|
|
1902
|
+
"scale-y": [N]
|
|
1903
1903
|
}],
|
|
1904
1904
|
/**
|
|
1905
1905
|
* Rotate
|
|
1906
1906
|
* @see https://tailwindcss.com/docs/rotate
|
|
1907
1907
|
*/
|
|
1908
1908
|
rotate: [{
|
|
1909
|
-
rotate: [Pe,
|
|
1909
|
+
rotate: [Pe, j]
|
|
1910
1910
|
}],
|
|
1911
1911
|
/**
|
|
1912
1912
|
* Translate X
|
|
@@ -1927,21 +1927,21 @@ const D = (e) => {
|
|
|
1927
1927
|
* @see https://tailwindcss.com/docs/skew
|
|
1928
1928
|
*/
|
|
1929
1929
|
"skew-x": [{
|
|
1930
|
-
"skew-x": [
|
|
1930
|
+
"skew-x": [T]
|
|
1931
1931
|
}],
|
|
1932
1932
|
/**
|
|
1933
1933
|
* Skew Y
|
|
1934
1934
|
* @see https://tailwindcss.com/docs/skew
|
|
1935
1935
|
*/
|
|
1936
1936
|
"skew-y": [{
|
|
1937
|
-
"skew-y": [
|
|
1937
|
+
"skew-y": [T]
|
|
1938
1938
|
}],
|
|
1939
1939
|
/**
|
|
1940
1940
|
* Transform Origin
|
|
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",
|
|
1944
|
+
origin: ["center", "top", "top-right", "right", "bottom-right", "bottom", "bottom-left", "left", "top-left", j]
|
|
1945
1945
|
}],
|
|
1946
1946
|
// Interactivity
|
|
1947
1947
|
/**
|
|
@@ -1963,7 +1963,7 @@ const D = (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",
|
|
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", j]
|
|
1967
1967
|
}],
|
|
1968
1968
|
/**
|
|
1969
1969
|
* Caret Color
|
|
@@ -1998,126 +1998,126 @@ const D = (e) => {
|
|
|
1998
1998
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
1999
1999
|
*/
|
|
2000
2000
|
"scroll-m": [{
|
|
2001
|
-
"scroll-m":
|
|
2001
|
+
"scroll-m": C()
|
|
2002
2002
|
}],
|
|
2003
2003
|
/**
|
|
2004
2004
|
* Scroll Margin X
|
|
2005
2005
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
2006
2006
|
*/
|
|
2007
2007
|
"scroll-mx": [{
|
|
2008
|
-
"scroll-mx":
|
|
2008
|
+
"scroll-mx": C()
|
|
2009
2009
|
}],
|
|
2010
2010
|
/**
|
|
2011
2011
|
* Scroll Margin Y
|
|
2012
2012
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
2013
2013
|
*/
|
|
2014
2014
|
"scroll-my": [{
|
|
2015
|
-
"scroll-my":
|
|
2015
|
+
"scroll-my": C()
|
|
2016
2016
|
}],
|
|
2017
2017
|
/**
|
|
2018
2018
|
* Scroll Margin Start
|
|
2019
2019
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
2020
2020
|
*/
|
|
2021
2021
|
"scroll-ms": [{
|
|
2022
|
-
"scroll-ms":
|
|
2022
|
+
"scroll-ms": C()
|
|
2023
2023
|
}],
|
|
2024
2024
|
/**
|
|
2025
2025
|
* Scroll Margin End
|
|
2026
2026
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
2027
2027
|
*/
|
|
2028
2028
|
"scroll-me": [{
|
|
2029
|
-
"scroll-me":
|
|
2029
|
+
"scroll-me": C()
|
|
2030
2030
|
}],
|
|
2031
2031
|
/**
|
|
2032
2032
|
* Scroll Margin Top
|
|
2033
2033
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
2034
2034
|
*/
|
|
2035
2035
|
"scroll-mt": [{
|
|
2036
|
-
"scroll-mt":
|
|
2036
|
+
"scroll-mt": C()
|
|
2037
2037
|
}],
|
|
2038
2038
|
/**
|
|
2039
2039
|
* Scroll Margin Right
|
|
2040
2040
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
2041
2041
|
*/
|
|
2042
2042
|
"scroll-mr": [{
|
|
2043
|
-
"scroll-mr":
|
|
2043
|
+
"scroll-mr": C()
|
|
2044
2044
|
}],
|
|
2045
2045
|
/**
|
|
2046
2046
|
* Scroll Margin Bottom
|
|
2047
2047
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
2048
2048
|
*/
|
|
2049
2049
|
"scroll-mb": [{
|
|
2050
|
-
"scroll-mb":
|
|
2050
|
+
"scroll-mb": C()
|
|
2051
2051
|
}],
|
|
2052
2052
|
/**
|
|
2053
2053
|
* Scroll Margin Left
|
|
2054
2054
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
2055
2055
|
*/
|
|
2056
2056
|
"scroll-ml": [{
|
|
2057
|
-
"scroll-ml":
|
|
2057
|
+
"scroll-ml": C()
|
|
2058
2058
|
}],
|
|
2059
2059
|
/**
|
|
2060
2060
|
* Scroll Padding
|
|
2061
2061
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
2062
2062
|
*/
|
|
2063
2063
|
"scroll-p": [{
|
|
2064
|
-
"scroll-p":
|
|
2064
|
+
"scroll-p": C()
|
|
2065
2065
|
}],
|
|
2066
2066
|
/**
|
|
2067
2067
|
* Scroll Padding X
|
|
2068
2068
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
2069
2069
|
*/
|
|
2070
2070
|
"scroll-px": [{
|
|
2071
|
-
"scroll-px":
|
|
2071
|
+
"scroll-px": C()
|
|
2072
2072
|
}],
|
|
2073
2073
|
/**
|
|
2074
2074
|
* Scroll Padding Y
|
|
2075
2075
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
2076
2076
|
*/
|
|
2077
2077
|
"scroll-py": [{
|
|
2078
|
-
"scroll-py":
|
|
2078
|
+
"scroll-py": C()
|
|
2079
2079
|
}],
|
|
2080
2080
|
/**
|
|
2081
2081
|
* Scroll Padding Start
|
|
2082
2082
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
2083
2083
|
*/
|
|
2084
2084
|
"scroll-ps": [{
|
|
2085
|
-
"scroll-ps":
|
|
2085
|
+
"scroll-ps": C()
|
|
2086
2086
|
}],
|
|
2087
2087
|
/**
|
|
2088
2088
|
* Scroll Padding End
|
|
2089
2089
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
2090
2090
|
*/
|
|
2091
2091
|
"scroll-pe": [{
|
|
2092
|
-
"scroll-pe":
|
|
2092
|
+
"scroll-pe": C()
|
|
2093
2093
|
}],
|
|
2094
2094
|
/**
|
|
2095
2095
|
* Scroll Padding Top
|
|
2096
2096
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
2097
2097
|
*/
|
|
2098
2098
|
"scroll-pt": [{
|
|
2099
|
-
"scroll-pt":
|
|
2099
|
+
"scroll-pt": C()
|
|
2100
2100
|
}],
|
|
2101
2101
|
/**
|
|
2102
2102
|
* Scroll Padding Right
|
|
2103
2103
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
2104
2104
|
*/
|
|
2105
2105
|
"scroll-pr": [{
|
|
2106
|
-
"scroll-pr":
|
|
2106
|
+
"scroll-pr": C()
|
|
2107
2107
|
}],
|
|
2108
2108
|
/**
|
|
2109
2109
|
* Scroll Padding Bottom
|
|
2110
2110
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
2111
2111
|
*/
|
|
2112
2112
|
"scroll-pb": [{
|
|
2113
|
-
"scroll-pb":
|
|
2113
|
+
"scroll-pb": C()
|
|
2114
2114
|
}],
|
|
2115
2115
|
/**
|
|
2116
2116
|
* Scroll Padding Left
|
|
2117
2117
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
2118
2118
|
*/
|
|
2119
2119
|
"scroll-pl": [{
|
|
2120
|
-
"scroll-pl":
|
|
2120
|
+
"scroll-pl": C()
|
|
2121
2121
|
}],
|
|
2122
2122
|
/**
|
|
2123
2123
|
* Scroll Snap Align
|
|
@@ -2185,7 +2185,7 @@ const D = (e) => {
|
|
|
2185
2185
|
* @see https://tailwindcss.com/docs/will-change
|
|
2186
2186
|
*/
|
|
2187
2187
|
"will-change": [{
|
|
2188
|
-
"will-change": ["auto", "scroll", "contents", "transform",
|
|
2188
|
+
"will-change": ["auto", "scroll", "contents", "transform", j]
|
|
2189
2189
|
}],
|
|
2190
2190
|
// SVG
|
|
2191
2191
|
/**
|
|
@@ -2279,7 +2279,7 @@ const D = (e) => {
|
|
|
2279
2279
|
function to(...e) {
|
|
2280
2280
|
return _n(Yt(e));
|
|
2281
2281
|
}
|
|
2282
|
-
function
|
|
2282
|
+
function Nn(e) {
|
|
2283
2283
|
let t = !1, n = "";
|
|
2284
2284
|
for (const o of e) {
|
|
2285
2285
|
if (o === "\\") {
|
|
@@ -2300,7 +2300,7 @@ function tt(e) {
|
|
|
2300
2300
|
try {
|
|
2301
2301
|
return JSON.parse(t);
|
|
2302
2302
|
} catch {
|
|
2303
|
-
const n =
|
|
2303
|
+
const n = Nn(t);
|
|
2304
2304
|
if (n)
|
|
2305
2305
|
try {
|
|
2306
2306
|
return JSON.parse(n);
|
|
@@ -2310,7 +2310,7 @@ function tt(e) {
|
|
|
2310
2310
|
return null;
|
|
2311
2311
|
}
|
|
2312
2312
|
}
|
|
2313
|
-
function
|
|
2313
|
+
function Rn(e) {
|
|
2314
2314
|
return typeof e != "string" ? !1 : /^[\s\n]*[-*]\s|^[\s\n]*#+\s|```|^\s*\[.*\]\(|^>\s/.test(e);
|
|
2315
2315
|
}
|
|
2316
2316
|
function zn(e) {
|
|
@@ -2399,7 +2399,7 @@ function Pt(e) {
|
|
|
2399
2399
|
}
|
|
2400
2400
|
function no(e) {
|
|
2401
2401
|
const t = Pt(e);
|
|
2402
|
-
return typeof e == "string" &&
|
|
2402
|
+
return typeof e == "string" && Rn(e) ? { content: e, isMarkdown: !0 } : { content: t, isMarkdown: !1 };
|
|
2403
2403
|
}
|
|
2404
2404
|
function $n(e) {
|
|
2405
2405
|
const t = (r) => {
|
|
@@ -2448,12 +2448,12 @@ function le(e) {
|
|
|
2448
2448
|
);
|
|
2449
2449
|
}
|
|
2450
2450
|
function nt(e) {
|
|
2451
|
-
var w, k,
|
|
2451
|
+
var w, k, E, I, N, P;
|
|
2452
2452
|
if (!e || typeof e != "object") return null;
|
|
2453
2453
|
const t = le(e), n = Kn(t);
|
|
2454
2454
|
if (!n)
|
|
2455
2455
|
return null;
|
|
2456
|
-
const r = Array.isArray(t.toolCalls) ? t.toolCalls.map(rt) : void 0, o = Vn(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 ?? ((w = t.additionalKwargs) == null ? void 0 : w.createdAt) ?? (/* @__PURE__ */ new Date()).toISOString(), i = t.name ?? ((k = t.additionalKwargs) == null ? void 0 : k.agentName) ?? void 0,
|
|
2456
|
+
const r = Array.isArray(t.toolCalls) ? t.toolCalls.map(rt) : void 0, o = Vn(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 ?? ((w = t.additionalKwargs) == null ? void 0 : w.createdAt) ?? (/* @__PURE__ */ new Date()).toISOString(), i = t.name ?? ((k = t.additionalKwargs) == null ? void 0 : k.agentName) ?? void 0, u = t.model ?? ((E = t.additionalKwargs) == null ? void 0 : E.model) ?? void 0, c = t.toolCallId ?? void 0, l = t.additionalKwargs ?? void 0, p = t.responseMetadata ?? void 0, m = t.checkpointId ?? ((I = t.additionalKwargs) == null ? void 0 : I.checkpointId) ?? void 0, h = t.checkpointNs ?? ((N = t.additionalKwargs) == null ? void 0 : N.checkpointNs) ?? void 0, v = typeof t.toolStreaming == "boolean" ? t.toolStreaming : !!((P = t.additionalKwargs) != null && P.toolStreaming);
|
|
2457
2457
|
return {
|
|
2458
2458
|
...t,
|
|
2459
2459
|
id: s,
|
|
@@ -2461,7 +2461,7 @@ function nt(e) {
|
|
|
2461
2461
|
content: o,
|
|
2462
2462
|
createdAt: a,
|
|
2463
2463
|
name: i,
|
|
2464
|
-
model:
|
|
2464
|
+
model: u,
|
|
2465
2465
|
toolCallId: c,
|
|
2466
2466
|
toolCalls: r,
|
|
2467
2467
|
checkpointId: m,
|
|
@@ -2493,7 +2493,7 @@ function rt(e) {
|
|
|
2493
2493
|
};
|
|
2494
2494
|
}
|
|
2495
2495
|
function Vn(e, t) {
|
|
2496
|
-
return Array.isArray(e) ? e.map((n) => n.type === "tool_call" || n.type === "tool" ? t ? null : rt(le(n)) : n).filter(
|
|
2496
|
+
return typeof e == "string" ? [{ type: "text", text: e }] : Array.isArray(e) ? e.map((n) => typeof n == "string" ? { type: "text", text: n } : n.type === "tool_call" || n.type === "tool" ? t ? null : rt(le(n)) : n).filter(
|
|
2497
2497
|
(n) => !!(n && typeof n == "object" && typeof n.type == "string")
|
|
2498
2498
|
) : [];
|
|
2499
2499
|
}
|
|
@@ -2504,12 +2504,12 @@ function Kn(e) {
|
|
|
2504
2504
|
const r = t.type;
|
|
2505
2505
|
return r === "human" ? "user" : r === "ai" ? "assistant" : r === "tool" ? "tool" : r === "system" ? "system" : null;
|
|
2506
2506
|
}
|
|
2507
|
-
function
|
|
2507
|
+
function ut(e) {
|
|
2508
2508
|
if (!e) return null;
|
|
2509
2509
|
const t = String(e).toLowerCase();
|
|
2510
2510
|
return t === "running" || t === "pending" ? "pending" : t === "completed" || t === "success" ? "completed" : t === "error" || t === "failed" || t === "failure" ? "error" : null;
|
|
2511
2511
|
}
|
|
2512
|
-
function
|
|
2512
|
+
function dt(e) {
|
|
2513
2513
|
return (Array.isArray(e.toolCalls) ? e.toolCalls : Mt(e)).map(rt);
|
|
2514
2514
|
}
|
|
2515
2515
|
function We(e, t) {
|
|
@@ -2535,10 +2535,10 @@ function Gn(e, t) {
|
|
|
2535
2535
|
}
|
|
2536
2536
|
function Hn(e, t = []) {
|
|
2537
2537
|
if (Array.isArray(e)) {
|
|
2538
|
-
const o = e.filter((a) => a.role === "assistant").flatMap((a) =>
|
|
2538
|
+
const o = e.filter((a) => a.role === "assistant").flatMap((a) => dt(a)), s = /* @__PURE__ */ new Map();
|
|
2539
2539
|
return o.forEach((a) => s.set(a.id, a)), Array.from(s.values()).map((a) => {
|
|
2540
2540
|
var p, m, h;
|
|
2541
|
-
const i = We(a.id, e) || We(a.id, t),
|
|
2541
|
+
const i = We(a.id, e) || We(a.id, t), u = Array.isArray((p = i == null ? void 0 : i.additionalKwargs) == null ? void 0 : p.toolProgress) ? (m = i == null ? void 0 : i.additionalKwargs) == null ? void 0 : m.toolProgress : void 0, c = (i == null ? void 0 : i.artifact) ?? a.artifact, l = ut(a.status) ?? ((h = i == null ? void 0 : i.additionalKwargs) != null && h.toolStreaming ? "pending" : null) ?? (i ? "completed" : "pending");
|
|
2542
2542
|
if (i && !a.content && l === "completed") {
|
|
2543
2543
|
const v = ce(i);
|
|
2544
2544
|
typeof v == "string" && (a.content = v);
|
|
@@ -2547,16 +2547,16 @@ function Hn(e, t = []) {
|
|
|
2547
2547
|
call: a,
|
|
2548
2548
|
result: i,
|
|
2549
2549
|
state: l,
|
|
2550
|
-
progress:
|
|
2550
|
+
progress: u,
|
|
2551
2551
|
artifact: c
|
|
2552
2552
|
};
|
|
2553
2553
|
});
|
|
2554
2554
|
}
|
|
2555
2555
|
if (e.role !== "assistant") return [];
|
|
2556
|
-
const n =
|
|
2556
|
+
const n = dt(e);
|
|
2557
2557
|
return n.length === 0 ? [] : n.map((r) => {
|
|
2558
|
-
var
|
|
2559
|
-
const o = We(r.id, t) ?? Gn(e, r), s = Array.isArray((
|
|
2558
|
+
var u, c, l;
|
|
2559
|
+
const o = We(r.id, t) ?? Gn(e, r), s = Array.isArray((u = o == null ? void 0 : o.additionalKwargs) == null ? void 0 : u.toolProgress) ? (c = o == null ? void 0 : o.additionalKwargs) == null ? void 0 : c.toolProgress : void 0, a = (o == null ? void 0 : o.artifact) ?? r.artifact, i = ut(r.status) ?? ((l = o == null ? void 0 : o.additionalKwargs) != null && l.toolStreaming ? "pending" : null) ?? (o ? "completed" : "pending");
|
|
2560
2560
|
if (o && !r.content && i === "completed") {
|
|
2561
2561
|
const p = ce(o);
|
|
2562
2562
|
typeof p == "string" && (r.content = p);
|
|
@@ -2573,7 +2573,7 @@ function Hn(e, t = []) {
|
|
|
2573
2573
|
function oo(e, t = []) {
|
|
2574
2574
|
return Hn(e, t).map((n) => n.artifact).filter((n) => !!n);
|
|
2575
2575
|
}
|
|
2576
|
-
const
|
|
2576
|
+
const Ne = {
|
|
2577
2577
|
authToken: "authToken",
|
|
2578
2578
|
authTokenExpiresAt: "authTokenExpiresAt",
|
|
2579
2579
|
authSessionId: "authSessionId",
|
|
@@ -2593,11 +2593,11 @@ function _t() {
|
|
|
2593
2593
|
function ke(e) {
|
|
2594
2594
|
Ge = e, Ye.forEach((t) => t(e));
|
|
2595
2595
|
}
|
|
2596
|
-
function
|
|
2596
|
+
function Nt(e) {
|
|
2597
2597
|
return Ye.add(e), () => Ye.delete(e);
|
|
2598
2598
|
}
|
|
2599
2599
|
const Wn = 12e4, qn = 12e4;
|
|
2600
|
-
let Ze = Wn,
|
|
2600
|
+
let Ze = Wn, Rt = qn;
|
|
2601
2601
|
const oe = Xt.create({
|
|
2602
2602
|
// BaseURL is set dynamically via ApiProvider -> api.updateConfig
|
|
2603
2603
|
timeout: Ze,
|
|
@@ -2608,10 +2608,10 @@ function ft(e) {
|
|
|
2608
2608
|
}
|
|
2609
2609
|
function Jn(e) {
|
|
2610
2610
|
const t = ft(e.requestTimeoutMs), n = ft(e.historyTimeoutMs);
|
|
2611
|
-
t !== null && (Ze = t, oe.defaults.timeout = Ze), n !== null && (
|
|
2611
|
+
t !== null && (Ze = t, oe.defaults.timeout = Ze), n !== null && (Rt = n);
|
|
2612
2612
|
}
|
|
2613
2613
|
function Xn() {
|
|
2614
|
-
return
|
|
2614
|
+
return Rt;
|
|
2615
2615
|
}
|
|
2616
2616
|
oe.interceptors.request.use((e) => (Ge && (e.headers.Authorization = `Bearer ${Ge}`), e));
|
|
2617
2617
|
oe.interceptors.response.use(
|
|
@@ -2619,7 +2619,7 @@ oe.interceptors.response.use(
|
|
|
2619
2619
|
if (typeof window < "u" && (e != null && e.data))
|
|
2620
2620
|
try {
|
|
2621
2621
|
const t = e.data, n = t.data || {}, r = typeof t.token == "string" && t.token || typeof n.token == "string" && n.token || null, o = typeof t.expires_at == "number" && t.expires_at || typeof n.expires_at == "number" && n.expires_at || typeof t.expiresAt == "number" && t.expiresAt || typeof n.expiresAt == "number" && n.expiresAt || null;
|
|
2622
|
-
r && (localStorage.setItem(
|
|
2622
|
+
r && (localStorage.setItem(Ne.authToken, r), ke(r)), o && localStorage.setItem(Ne.authTokenExpiresAt, o.toString()), (r || o) && window.dispatchEvent(
|
|
2623
2623
|
new CustomEvent("smartorg:chat-token-updated", {
|
|
2624
2624
|
detail: { token: r, expiresAt: o }
|
|
2625
2625
|
})
|
|
@@ -2673,7 +2673,7 @@ class Yn {
|
|
|
2673
2673
|
ke(t);
|
|
2674
2674
|
}
|
|
2675
2675
|
onTokenChange(t) {
|
|
2676
|
-
return
|
|
2676
|
+
return Nt(t);
|
|
2677
2677
|
}
|
|
2678
2678
|
// ---- Thread Management ----
|
|
2679
2679
|
async listThreads() {
|
|
@@ -2844,7 +2844,7 @@ class er {
|
|
|
2844
2844
|
ke(t);
|
|
2845
2845
|
}
|
|
2846
2846
|
onTokenChange(t) {
|
|
2847
|
-
return
|
|
2847
|
+
return Nt(t);
|
|
2848
2848
|
}
|
|
2849
2849
|
// ---- User Management ----
|
|
2850
2850
|
async listUsers() {
|
|
@@ -2856,8 +2856,8 @@ const tr = new er(), Lt = Se(null);
|
|
|
2856
2856
|
function nr({ children: e, apiConfig: t }) {
|
|
2857
2857
|
const n = zt, r = tr;
|
|
2858
2858
|
if (t) {
|
|
2859
|
-
const s = n.baseUrl, a = r.baseUrl, i = n.getAuthToken(),
|
|
2860
|
-
(t.baseUrl || t.chatBaseUrl ||
|
|
2859
|
+
const s = n.baseUrl, a = r.baseUrl, i = n.getAuthToken(), u = t.requestTimeoutMs !== void 0 || t.historyTimeoutMs !== void 0;
|
|
2860
|
+
(t.baseUrl || t.chatBaseUrl || u) && (u || t.chatBaseUrl && t.chatBaseUrl !== s || t.baseUrl && !s.startsWith(t.baseUrl)) && n.updateConfig(t), (t.baseUrl || t.authBaseUrl) && (t.authBaseUrl && t.authBaseUrl !== a || t.baseUrl && !a.startsWith(t.baseUrl)) && r.updateConfig(t), t.apiKey !== void 0 && t.apiKey !== i && (n.updateConfig({ apiKey: t.apiKey }), r.updateConfig({ apiKey: t.apiKey }));
|
|
2861
2861
|
}
|
|
2862
2862
|
const o = {
|
|
2863
2863
|
token: n.getAuthToken(),
|
|
@@ -2879,7 +2879,7 @@ async function rr(e) {
|
|
|
2879
2879
|
const o = r.result, s = new Uint8Array(o);
|
|
2880
2880
|
let a = "";
|
|
2881
2881
|
const i = s.byteLength;
|
|
2882
|
-
for (let
|
|
2882
|
+
for (let u = 0; u < i; u++) a += String.fromCharCode(s[u]);
|
|
2883
2883
|
t(btoa(a));
|
|
2884
2884
|
} catch (o) {
|
|
2885
2885
|
n(o);
|
|
@@ -2944,7 +2944,7 @@ function io(e) {
|
|
|
2944
2944
|
}).join("|") : "", r = "checkpointId" in e && e.checkpointId ? `cp:${e.checkpointId}` : "", o = "checkpointNs" in e && e.checkpointNs ? `ns:${e.checkpointNs}` : "", s = [r, o].filter(Boolean).join("|");
|
|
2945
2945
|
return `${e.id}:${t}:${n}${s ? `:${s}` : ""}`;
|
|
2946
2946
|
}
|
|
2947
|
-
function
|
|
2947
|
+
function Ae() {
|
|
2948
2948
|
const e = Ue(Lt);
|
|
2949
2949
|
if (!e) throw new Error("useApi must be used within ApiProvider");
|
|
2950
2950
|
return e;
|
|
@@ -2970,29 +2970,29 @@ function lr(e = {}) {
|
|
|
2970
2970
|
q(() => {
|
|
2971
2971
|
i.current = e;
|
|
2972
2972
|
}, [e]);
|
|
2973
|
-
const
|
|
2974
|
-
var U,
|
|
2975
|
-
const
|
|
2976
|
-
if (!
|
|
2977
|
-
(U =
|
|
2978
|
-
}, []), [c, l] = B(!1), [p, m] = B(null), [h, v] = B(!1), [f, w] = B(null), k = H(null),
|
|
2973
|
+
const u = z((g) => {
|
|
2974
|
+
var U, C, M, L, R, V, D, A, y, F;
|
|
2975
|
+
const b = i.current;
|
|
2976
|
+
if (!b) return;
|
|
2977
|
+
(U = b.onEvent) == null || U.call(b, g), g.type === "thread_info" && ((C = b.onThreadInfo) == null || C.call(b, g)), g.type === "values" && Array.isArray(g.checkpoints) && ((M = b.handleValuesEvent) == null || M.call(b, g)), g.type === "metadata" && ((L = b.onMetadataEvent) == null || L.call(b, g)), typeof g.type == "string" && (g.type === "custom" || g.type.startsWith("custom.")) && ((R = b.onCustomEvent) == null || R.call(b, g)), g.type === "updates" && ((V = b.onUpdateEvent) == null || V.call(b, g)), g.type === "tool.end" ? (D = b.onToolEnd) == null || D.call(b, g) : g.type === "tool.start" && ((A = b.onToolStart) == null || A.call(b, g)), g.type === "heartbeat" && ((y = b.onHeartbeat) == null || y.call(b, g)), g.type === "token" && ((F = b.onToken) == null || F.call(b, g.token));
|
|
2978
|
+
}, []), [c, l] = B(!1), [p, m] = B(null), [h, v] = B(!1), [f, w] = B(null), k = H(null), E = H(!0), I = H(null), N = z((g) => {
|
|
2979
2979
|
o(g);
|
|
2980
2980
|
}, []), P = z(() => {
|
|
2981
2981
|
m(null), w(null);
|
|
2982
|
-
}, []),
|
|
2983
|
-
var
|
|
2982
|
+
}, []), T = z(() => {
|
|
2983
|
+
var C, M;
|
|
2984
2984
|
console.debug("[use-chat] stop() invoked - aborting stream");
|
|
2985
|
-
const g = (
|
|
2986
|
-
var
|
|
2987
|
-
(
|
|
2985
|
+
const g = (C = I.current) == null ? void 0 : C.threadId, b = (M = I.current) == null ? void 0 : M.runId, O = () => {
|
|
2986
|
+
var L;
|
|
2987
|
+
(L = k.current) == null || L.abort(), k.current = null, I.current = null, l(!1), v(!1);
|
|
2988
2988
|
};
|
|
2989
|
-
(
|
|
2990
|
-
console.warn("[use-chat] cancel run failed:",
|
|
2991
|
-
}) : Promise.resolve()).finally(
|
|
2992
|
-
}, []),
|
|
2989
|
+
(b || g ? zt.cancelRun(b || g).catch((L) => {
|
|
2990
|
+
console.warn("[use-chat] cancel run failed:", L);
|
|
2991
|
+
}) : Promise.resolve()).finally(O);
|
|
2992
|
+
}, []), S = z(
|
|
2993
2993
|
(g) => {
|
|
2994
2994
|
k.current && (k.current.abort(), k.current = null);
|
|
2995
|
-
const
|
|
2995
|
+
const b = {
|
|
2996
2996
|
text: typeof g.content == "string" ? g.content : g.text,
|
|
2997
2997
|
threadId: g.threadId,
|
|
2998
2998
|
attachments: g.attachments,
|
|
@@ -3004,59 +3004,59 @@ function lr(e = {}) {
|
|
|
3004
3004
|
command: g.command
|
|
3005
3005
|
};
|
|
3006
3006
|
l(!0), m(null), w(null);
|
|
3007
|
-
const
|
|
3008
|
-
k.current =
|
|
3009
|
-
let U = null,
|
|
3007
|
+
const O = new AbortController();
|
|
3008
|
+
k.current = O;
|
|
3009
|
+
let U = null, C = !1;
|
|
3010
3010
|
return I.current = {
|
|
3011
|
-
threadId:
|
|
3011
|
+
threadId: b.threadId ?? void 0,
|
|
3012
3012
|
runId: void 0,
|
|
3013
3013
|
// Will be updated from headers
|
|
3014
3014
|
headers: {},
|
|
3015
3015
|
isStreaming: !0
|
|
3016
3016
|
}, (async () => {
|
|
3017
|
-
var
|
|
3017
|
+
var M, L, R, V, D, A;
|
|
3018
3018
|
try {
|
|
3019
|
-
let
|
|
3019
|
+
let y = {};
|
|
3020
3020
|
try {
|
|
3021
3021
|
if (r)
|
|
3022
|
-
|
|
3022
|
+
y = { Authorization: `Bearer ${r}` };
|
|
3023
3023
|
else if (typeof window < "u") {
|
|
3024
|
-
const ee = window.__AUTH_TOKEN__, ve = ((
|
|
3024
|
+
const ee = window.__AUTH_TOKEN__, ve = ((M = window.localStorage) == null ? void 0 : M.getItem(Ne.authToken)) || null;
|
|
3025
3025
|
let X = null;
|
|
3026
3026
|
try {
|
|
3027
|
-
const me = (
|
|
3028
|
-
me && (X = ((
|
|
3027
|
+
const me = (L = window.localStorage) == null ? void 0 : L.getItem(Ne.chatSettings);
|
|
3028
|
+
me && (X = ((R = JSON.parse(me)) == null ? void 0 : R.apiKey) || null);
|
|
3029
3029
|
} catch {
|
|
3030
3030
|
}
|
|
3031
3031
|
const Y = ee || ve || X || null;
|
|
3032
|
-
Y && (
|
|
3032
|
+
Y && (y = { Authorization: `Bearer ${Y}` });
|
|
3033
3033
|
}
|
|
3034
3034
|
} catch {
|
|
3035
3035
|
}
|
|
3036
3036
|
console.debug("[use-chat] POST", t + n);
|
|
3037
|
-
let
|
|
3037
|
+
let F = {};
|
|
3038
3038
|
if (typeof window < "u")
|
|
3039
3039
|
try {
|
|
3040
|
-
const W = (V = window.localStorage) == null ? void 0 : V.getItem(
|
|
3041
|
-
W && (
|
|
3040
|
+
const W = (V = window.localStorage) == null ? void 0 : V.getItem(Ne.authSessionId);
|
|
3041
|
+
W && (F = { "X-Session-Id": W });
|
|
3042
3042
|
} catch {
|
|
3043
3043
|
}
|
|
3044
|
-
const
|
|
3045
|
-
...
|
|
3046
|
-
|
|
3044
|
+
const $ = {
|
|
3045
|
+
...y,
|
|
3046
|
+
...F,
|
|
3047
3047
|
...s.current
|
|
3048
|
-
},
|
|
3048
|
+
}, d = {
|
|
3049
3049
|
"Content-Type": "application/json",
|
|
3050
3050
|
Accept: "text/event-stream",
|
|
3051
|
-
|
|
3051
|
+
...$
|
|
3052
3052
|
}, x = await fetch(t + n, {
|
|
3053
3053
|
method: "POST",
|
|
3054
|
-
headers:
|
|
3055
|
-
body: JSON.stringify(
|
|
3056
|
-
signal:
|
|
3054
|
+
headers: d,
|
|
3055
|
+
body: JSON.stringify(b),
|
|
3056
|
+
signal: O.signal,
|
|
3057
3057
|
credentials: a
|
|
3058
3058
|
});
|
|
3059
|
-
if (I.current && (I.current.headers =
|
|
3059
|
+
if (I.current && (I.current.headers = $), !x.ok || !x.body) {
|
|
3060
3060
|
const W = await x.text().catch(() => "");
|
|
3061
3061
|
console.debug(
|
|
3062
3062
|
"[use-chat] non-OK response",
|
|
@@ -3068,10 +3068,10 @@ function lr(e = {}) {
|
|
|
3068
3068
|
}
|
|
3069
3069
|
v(!0);
|
|
3070
3070
|
const _ = x.body.getReader(), te = new TextDecoder();
|
|
3071
|
-
let J = "",
|
|
3071
|
+
let J = "", G = 0, Z = Date.now();
|
|
3072
3072
|
const ae = setInterval(() => {
|
|
3073
|
-
Date.now() - Z > 18e5 && (m("Stream idle timeout"), U = "error",
|
|
3074
|
-
}, 5e3),
|
|
3073
|
+
Date.now() - Z > 18e5 && (m("Stream idle timeout"), U = "error", O.abort());
|
|
3074
|
+
}, 5e3), ue = 1024 * 1024;
|
|
3075
3075
|
try {
|
|
3076
3076
|
const W = x.headers.get("X-Thread-Id") || x.headers.get("x-thread-id"), ee = x.headers.get("X-Run-Id") || x.headers.get("x-run-id");
|
|
3077
3077
|
for (I.current && (I.current = {
|
|
@@ -3081,7 +3081,7 @@ function lr(e = {}) {
|
|
|
3081
3081
|
}); ; ) {
|
|
3082
3082
|
const { value: ve, done: X } = await _.read();
|
|
3083
3083
|
if (X) break;
|
|
3084
|
-
J += te.decode(ve, { stream: !0 }), J.length >
|
|
3084
|
+
J += te.decode(ve, { stream: !0 }), J.length > ue && (J = "", console.warn("Stream buffer reset: exceeded 1MB"));
|
|
3085
3085
|
let Y;
|
|
3086
3086
|
for (; (Y = J.indexOf(`
|
|
3087
3087
|
|
|
@@ -3089,12 +3089,12 @@ function lr(e = {}) {
|
|
|
3089
3089
|
const me = J.slice(0, Y);
|
|
3090
3090
|
J = J.slice(Y + 2);
|
|
3091
3091
|
const Le = me.split(/\r?\n/), je = [];
|
|
3092
|
-
let
|
|
3092
|
+
let de = null;
|
|
3093
3093
|
for (const ye of Le)
|
|
3094
3094
|
if (!ye.startsWith(":") && ye) {
|
|
3095
3095
|
if (ye.startsWith("event:")) {
|
|
3096
3096
|
const Te = ye.slice(6).trim();
|
|
3097
|
-
Te && (
|
|
3097
|
+
Te && (de = Te);
|
|
3098
3098
|
continue;
|
|
3099
3099
|
}
|
|
3100
3100
|
if (ye.startsWith("data:")) {
|
|
@@ -3112,7 +3112,7 @@ function lr(e = {}) {
|
|
|
3112
3112
|
console.debug("[use-chat] malformed SSE:", Ie.slice(0, 200));
|
|
3113
3113
|
continue;
|
|
3114
3114
|
}
|
|
3115
|
-
|
|
3115
|
+
de && typeof ne == "object" && ne !== null && !("type" in ne) && (ne.type = de);
|
|
3116
3116
|
const Me = cr(ne) ? ne.data : ne;
|
|
3117
3117
|
if (!Me) {
|
|
3118
3118
|
console.warn("[use-chat] dropped envelope event without payload", ne);
|
|
@@ -3122,16 +3122,16 @@ function lr(e = {}) {
|
|
|
3122
3122
|
Z = Date.now();
|
|
3123
3123
|
const he = Ee.seq;
|
|
3124
3124
|
if (he !== void 0) {
|
|
3125
|
-
if (he <=
|
|
3126
|
-
console.debug("[use-chat] drop duplicate/out-of-order event", { seq: he, lastProcessedSeq:
|
|
3125
|
+
if (he <= G) {
|
|
3126
|
+
console.debug("[use-chat] drop duplicate/out-of-order event", { seq: he, lastProcessedSeq: G, type: Ee.type });
|
|
3127
3127
|
continue;
|
|
3128
3128
|
}
|
|
3129
|
-
|
|
3129
|
+
G = he;
|
|
3130
3130
|
}
|
|
3131
|
-
|
|
3131
|
+
u(Ee);
|
|
3132
3132
|
}
|
|
3133
3133
|
}
|
|
3134
|
-
U === null && !
|
|
3134
|
+
U === null && !O.signal.aborted && (U = "complete");
|
|
3135
3135
|
} catch (W) {
|
|
3136
3136
|
if (W.name === "AbortError")
|
|
3137
3137
|
U = U ?? "aborted";
|
|
@@ -3144,41 +3144,41 @@ function lr(e = {}) {
|
|
|
3144
3144
|
await _.cancel();
|
|
3145
3145
|
} catch {
|
|
3146
3146
|
} finally {
|
|
3147
|
-
(
|
|
3147
|
+
(D = _.releaseLock) == null || D.call(_);
|
|
3148
3148
|
}
|
|
3149
3149
|
clearInterval(ae);
|
|
3150
3150
|
}
|
|
3151
|
-
} catch (
|
|
3152
|
-
if (
|
|
3151
|
+
} catch (y) {
|
|
3152
|
+
if (y.name === "AbortError")
|
|
3153
3153
|
U = U ?? "aborted";
|
|
3154
3154
|
else {
|
|
3155
|
-
const
|
|
3156
|
-
U = "error", m(
|
|
3155
|
+
const F = y.message || String(y);
|
|
3156
|
+
U = "error", m(F), C || (C = !0, (A = e.onConnectionError) == null || A.call(e, F));
|
|
3157
3157
|
}
|
|
3158
3158
|
} finally {
|
|
3159
3159
|
try {
|
|
3160
3160
|
if (e.onFinish) {
|
|
3161
|
-
const
|
|
3161
|
+
const y = {
|
|
3162
3162
|
lastSeq: 0,
|
|
3163
3163
|
lastCheckpointId: null,
|
|
3164
3164
|
lastCheckpointNs: null,
|
|
3165
3165
|
lastValues: null
|
|
3166
3166
|
// Let the reducer/history hook provide the final values
|
|
3167
3167
|
};
|
|
3168
|
-
e.onFinish(
|
|
3168
|
+
e.onFinish(y);
|
|
3169
3169
|
}
|
|
3170
|
-
} catch (
|
|
3171
|
-
console.warn("[use-chat] onClosed callback failed",
|
|
3170
|
+
} catch (y) {
|
|
3171
|
+
console.warn("[use-chat] onClosed callback failed", y);
|
|
3172
3172
|
}
|
|
3173
3173
|
l(!1), v(!1), k.current = null, I.current = null;
|
|
3174
3174
|
}
|
|
3175
3175
|
})(), Promise.resolve();
|
|
3176
3176
|
},
|
|
3177
|
-
[t, n, r, e,
|
|
3177
|
+
[t, n, r, e, u]
|
|
3178
3178
|
);
|
|
3179
3179
|
return q(() => () => {
|
|
3180
3180
|
var g;
|
|
3181
|
-
|
|
3181
|
+
E.current = !1, (g = k.current) == null || g.abort();
|
|
3182
3182
|
}, []), {
|
|
3183
3183
|
isStreaming: c,
|
|
3184
3184
|
error: p,
|
|
@@ -3191,10 +3191,10 @@ function lr(e = {}) {
|
|
|
3191
3191
|
// Deprecated: use checkpoint from reducer
|
|
3192
3192
|
lastSeq: 0,
|
|
3193
3193
|
connected: h,
|
|
3194
|
-
stream:
|
|
3195
|
-
stop:
|
|
3194
|
+
stream: S,
|
|
3195
|
+
stop: T,
|
|
3196
3196
|
clear: P,
|
|
3197
|
-
setToken:
|
|
3197
|
+
setToken: N,
|
|
3198
3198
|
values: {},
|
|
3199
3199
|
// Provide empty object for backward compatibility
|
|
3200
3200
|
interrupt: () => Promise.resolve(),
|
|
@@ -3203,10 +3203,10 @@ function lr(e = {}) {
|
|
|
3203
3203
|
connectionState: p ? "error" : c ? h ? "connected" : "connecting" : "idle",
|
|
3204
3204
|
messages: [],
|
|
3205
3205
|
// useStream doesn't maintain messages, use useChatSession instead
|
|
3206
|
-
submit:
|
|
3206
|
+
submit: S
|
|
3207
3207
|
};
|
|
3208
3208
|
}
|
|
3209
|
-
const
|
|
3209
|
+
const ur = ["detail", "message", "error", "description", "title"];
|
|
3210
3210
|
function $e(e) {
|
|
3211
3211
|
if (!e) return null;
|
|
3212
3212
|
if (typeof e == "string") {
|
|
@@ -3223,7 +3223,7 @@ function $e(e) {
|
|
|
3223
3223
|
}
|
|
3224
3224
|
if (typeof e == "object") {
|
|
3225
3225
|
const t = e;
|
|
3226
|
-
for (const n of
|
|
3226
|
+
for (const n of ur) {
|
|
3227
3227
|
const r = $e(t[n]);
|
|
3228
3228
|
if (r)
|
|
3229
3229
|
return r;
|
|
@@ -3235,7 +3235,7 @@ function $e(e) {
|
|
|
3235
3235
|
}
|
|
3236
3236
|
return null;
|
|
3237
3237
|
}
|
|
3238
|
-
function
|
|
3238
|
+
function dr(e) {
|
|
3239
3239
|
if (!e) return "Request failed";
|
|
3240
3240
|
const t = e.response, n = $e(t == null ? void 0 : t.data);
|
|
3241
3241
|
if (n) return n;
|
|
@@ -3256,31 +3256,31 @@ function fr({
|
|
|
3256
3256
|
onThreadChange: r,
|
|
3257
3257
|
onCurrentThreadDeleted: o
|
|
3258
3258
|
}) {
|
|
3259
|
-
const [s, a] = B([]), [i,
|
|
3259
|
+
const [s, a] = B([]), [i, u] = B(t), [c, l] = B(!1), [p, m] = B(null), [h, v] = B([]), [f, w] = B(!1), [, k] = B(null), [E, I] = B(null), [N, P] = B(!1), T = H(i), S = H(/* @__PURE__ */ new Map());
|
|
3260
3260
|
q(() => {
|
|
3261
|
-
|
|
3261
|
+
T.current = i;
|
|
3262
3262
|
}, [i]), q(() => {
|
|
3263
|
-
t !== void 0 && t !==
|
|
3263
|
+
t !== void 0 && t !== T.current && u(t);
|
|
3264
3264
|
}, [t]);
|
|
3265
3265
|
const g = z(async () => {
|
|
3266
3266
|
l(!0), m(null);
|
|
3267
3267
|
try {
|
|
3268
|
-
const
|
|
3269
|
-
a(
|
|
3270
|
-
} catch (
|
|
3271
|
-
const
|
|
3272
|
-
m(
|
|
3268
|
+
const A = await e.listThreads();
|
|
3269
|
+
a(A ?? []);
|
|
3270
|
+
} catch (A) {
|
|
3271
|
+
const y = String(A);
|
|
3272
|
+
m(y), n == null || n(y);
|
|
3273
3273
|
} finally {
|
|
3274
3274
|
l(!1);
|
|
3275
3275
|
}
|
|
3276
|
-
}, [e, n]),
|
|
3276
|
+
}, [e, n]), b = z(async () => {
|
|
3277
3277
|
w(!0), k(null);
|
|
3278
3278
|
try {
|
|
3279
|
-
const
|
|
3280
|
-
v(
|
|
3281
|
-
} catch (
|
|
3282
|
-
const
|
|
3283
|
-
k(
|
|
3279
|
+
const A = await e.listSharedThreads();
|
|
3280
|
+
v(A ?? []);
|
|
3281
|
+
} catch (A) {
|
|
3282
|
+
const y = String(A);
|
|
3283
|
+
k(y), n == null || n(y);
|
|
3284
3284
|
} finally {
|
|
3285
3285
|
w(!1);
|
|
3286
3286
|
}
|
|
@@ -3288,117 +3288,117 @@ function fr({
|
|
|
3288
3288
|
q(() => {
|
|
3289
3289
|
g();
|
|
3290
3290
|
}, [g]), q(() => {
|
|
3291
|
-
|
|
3292
|
-
}, [
|
|
3291
|
+
b();
|
|
3292
|
+
}, [b]), q(() => {
|
|
3293
3293
|
r == null || r(i);
|
|
3294
3294
|
}, [i, r]);
|
|
3295
|
-
const
|
|
3296
|
-
async (
|
|
3295
|
+
const O = z(
|
|
3296
|
+
async (A, y) => {
|
|
3297
3297
|
try {
|
|
3298
|
-
const
|
|
3299
|
-
return
|
|
3300
|
-
} catch (
|
|
3301
|
-
const
|
|
3302
|
-
return n == null || n(
|
|
3298
|
+
const F = y && typeof y == "object" ? { id: y.id, name: y.name ?? "" } : void 0, $ = await e.createThread(A, F);
|
|
3299
|
+
return u($.threadId), await g(), $.threadId;
|
|
3300
|
+
} catch (F) {
|
|
3301
|
+
const $ = String(F);
|
|
3302
|
+
return n == null || n($), null;
|
|
3303
3303
|
}
|
|
3304
3304
|
},
|
|
3305
3305
|
[e, n, g]
|
|
3306
3306
|
), U = z(
|
|
3307
|
-
async (
|
|
3308
|
-
const
|
|
3309
|
-
a((
|
|
3310
|
-
const
|
|
3311
|
-
|
|
3307
|
+
async (A) => {
|
|
3308
|
+
const y = s;
|
|
3309
|
+
a(($) => $.filter((d) => d.threadId !== A));
|
|
3310
|
+
const F = new AbortController();
|
|
3311
|
+
S.current.set(A, F);
|
|
3312
3312
|
try {
|
|
3313
|
-
await e.deleteThread(
|
|
3314
|
-
} catch (
|
|
3315
|
-
a(
|
|
3316
|
-
const
|
|
3317
|
-
n == null || n(
|
|
3313
|
+
await e.deleteThread(A), T.current === A && (u(null), o == null || o());
|
|
3314
|
+
} catch ($) {
|
|
3315
|
+
a(y);
|
|
3316
|
+
const d = String($);
|
|
3317
|
+
n == null || n(d);
|
|
3318
3318
|
} finally {
|
|
3319
|
-
|
|
3319
|
+
S.current.delete(A);
|
|
3320
3320
|
}
|
|
3321
3321
|
},
|
|
3322
3322
|
[e, o, n, s]
|
|
3323
|
-
),
|
|
3324
|
-
async (
|
|
3323
|
+
), C = z(
|
|
3324
|
+
async (A, y) => {
|
|
3325
3325
|
try {
|
|
3326
|
-
await e.updateThread(
|
|
3327
|
-
} catch (
|
|
3328
|
-
n == null || n(String(
|
|
3326
|
+
await e.updateThread(A, y), await g();
|
|
3327
|
+
} catch (F) {
|
|
3328
|
+
n == null || n(String(F));
|
|
3329
3329
|
}
|
|
3330
3330
|
},
|
|
3331
3331
|
[e, n, g]
|
|
3332
|
-
),
|
|
3333
|
-
async (
|
|
3332
|
+
), M = z(
|
|
3333
|
+
async (A, y) => {
|
|
3334
3334
|
P(!0), I("Sharing thread…");
|
|
3335
3335
|
try {
|
|
3336
|
-
await e.shareThread(
|
|
3337
|
-
} catch (
|
|
3338
|
-
const
|
|
3339
|
-
throw n == null || n(
|
|
3336
|
+
await e.shareThread(A, y), await b(), I("Shared successfully");
|
|
3337
|
+
} catch (F) {
|
|
3338
|
+
const $ = dr(F);
|
|
3339
|
+
throw n == null || n($), I(`Failed to share: ${$}`), new Error($);
|
|
3340
3340
|
} finally {
|
|
3341
3341
|
P(!1);
|
|
3342
3342
|
}
|
|
3343
3343
|
},
|
|
3344
|
-
[e, n,
|
|
3345
|
-
),
|
|
3346
|
-
async (
|
|
3344
|
+
[e, n, b]
|
|
3345
|
+
), L = z(
|
|
3346
|
+
async (A, y) => {
|
|
3347
3347
|
try {
|
|
3348
|
-
await e.unshareThread(
|
|
3349
|
-
} catch (
|
|
3350
|
-
const
|
|
3351
|
-
throw n == null || n(
|
|
3348
|
+
await e.unshareThread(A, y), await b();
|
|
3349
|
+
} catch (F) {
|
|
3350
|
+
const $ = String(F);
|
|
3351
|
+
throw n == null || n($), F;
|
|
3352
3352
|
}
|
|
3353
3353
|
},
|
|
3354
|
-
[e, n,
|
|
3355
|
-
),
|
|
3354
|
+
[e, n, b]
|
|
3355
|
+
), R = Q(
|
|
3356
3356
|
() => ({
|
|
3357
|
-
createThread:
|
|
3357
|
+
createThread: O,
|
|
3358
3358
|
deleteThread: U,
|
|
3359
|
-
renameThread:
|
|
3359
|
+
renameThread: C,
|
|
3360
3360
|
refreshThreads: g,
|
|
3361
|
-
refreshSharedThreads:
|
|
3362
|
-
shareThread:
|
|
3363
|
-
unshareThread:
|
|
3361
|
+
refreshSharedThreads: b,
|
|
3362
|
+
shareThread: M,
|
|
3363
|
+
unshareThread: L
|
|
3364
3364
|
}),
|
|
3365
|
-
[
|
|
3366
|
-
), V = z((
|
|
3367
|
-
if (!(
|
|
3368
|
-
const
|
|
3369
|
-
threadId:
|
|
3370
|
-
title:
|
|
3371
|
-
project:
|
|
3372
|
-
createdAt:
|
|
3373
|
-
updatedAt:
|
|
3374
|
-
messageCount:
|
|
3365
|
+
[O, U, C, g, b, M, L]
|
|
3366
|
+
), V = z((A) => {
|
|
3367
|
+
if (!(A != null && A.threadId)) return;
|
|
3368
|
+
const y = {
|
|
3369
|
+
threadId: A.threadId,
|
|
3370
|
+
title: A.title || `Thread ${A.threadId.slice(0, 8)}`,
|
|
3371
|
+
project: A.project,
|
|
3372
|
+
createdAt: A.createdAt || (/* @__PURE__ */ new Date()).toISOString(),
|
|
3373
|
+
updatedAt: A.updatedAt || (/* @__PURE__ */ new Date()).toISOString(),
|
|
3374
|
+
messageCount: A.messageCount ?? 1
|
|
3375
3375
|
};
|
|
3376
|
-
a((
|
|
3377
|
-
let
|
|
3378
|
-
const
|
|
3376
|
+
a((F) => {
|
|
3377
|
+
let $ = !1;
|
|
3378
|
+
const d = F.map((x) => x.threadId === y.threadId ? ($ = !0, console.debug("[useThreadsState] thread_info: updating existing thread", y.threadId), {
|
|
3379
3379
|
...x,
|
|
3380
|
-
title:
|
|
3381
|
-
project:
|
|
3382
|
-
updatedAt:
|
|
3383
|
-
messageCount:
|
|
3380
|
+
title: y.title ?? x.title,
|
|
3381
|
+
project: y.project ?? x.project,
|
|
3382
|
+
updatedAt: y.updatedAt ?? x.updatedAt,
|
|
3383
|
+
messageCount: y.messageCount ?? x.messageCount
|
|
3384
3384
|
}) : x);
|
|
3385
|
-
return
|
|
3385
|
+
return $ ? d : (console.debug("[useThreadsState] thread_info: adding thread to list", y.threadId), [y, ...F]);
|
|
3386
3386
|
});
|
|
3387
|
-
}, []),
|
|
3387
|
+
}, []), D = z(() => I(null), []);
|
|
3388
3388
|
return {
|
|
3389
3389
|
threads: s,
|
|
3390
3390
|
currentThreadId: i,
|
|
3391
|
-
currentThreadIdRef:
|
|
3392
|
-
setCurrentThreadId:
|
|
3391
|
+
currentThreadIdRef: T,
|
|
3392
|
+
setCurrentThreadId: u,
|
|
3393
3393
|
isLoadingThreads: c,
|
|
3394
3394
|
threadsError: p,
|
|
3395
3395
|
sharedThreads: h,
|
|
3396
3396
|
isLoadingSharedThreads: f,
|
|
3397
|
-
actions:
|
|
3397
|
+
actions: R,
|
|
3398
3398
|
addThreadFromEvent: V,
|
|
3399
|
-
shareInFlight:
|
|
3400
|
-
shareStatus:
|
|
3401
|
-
clearShareStatus:
|
|
3399
|
+
shareInFlight: N,
|
|
3400
|
+
shareStatus: E,
|
|
3401
|
+
clearShareStatus: D
|
|
3402
3402
|
};
|
|
3403
3403
|
}
|
|
3404
3404
|
const Ft = Se(null);
|
|
@@ -3408,11 +3408,11 @@ function pr({
|
|
|
3408
3408
|
onError: n,
|
|
3409
3409
|
onThreadChange: r
|
|
3410
3410
|
}) {
|
|
3411
|
-
const { chatApi: o } =
|
|
3411
|
+
const { chatApi: o } = Ae(), {
|
|
3412
3412
|
threads: s,
|
|
3413
3413
|
currentThreadId: a,
|
|
3414
3414
|
setCurrentThreadId: i,
|
|
3415
|
-
currentThreadIdRef:
|
|
3415
|
+
currentThreadIdRef: u,
|
|
3416
3416
|
isLoadingThreads: c,
|
|
3417
3417
|
threadsError: l,
|
|
3418
3418
|
sharedThreads: p,
|
|
@@ -3427,12 +3427,12 @@ function pr({
|
|
|
3427
3427
|
initialThreadId: t,
|
|
3428
3428
|
onError: n,
|
|
3429
3429
|
onThreadChange: r
|
|
3430
|
-
}),
|
|
3430
|
+
}), E = Q(
|
|
3431
3431
|
() => ({
|
|
3432
3432
|
threads: s,
|
|
3433
3433
|
currentThreadId: a,
|
|
3434
3434
|
setCurrentThreadId: i,
|
|
3435
|
-
currentThreadIdRef:
|
|
3435
|
+
currentThreadIdRef: u,
|
|
3436
3436
|
isLoading: c,
|
|
3437
3437
|
error: l,
|
|
3438
3438
|
sharedThreads: p,
|
|
@@ -3447,7 +3447,7 @@ function pr({
|
|
|
3447
3447
|
s,
|
|
3448
3448
|
a,
|
|
3449
3449
|
i,
|
|
3450
|
-
|
|
3450
|
+
u,
|
|
3451
3451
|
c,
|
|
3452
3452
|
l,
|
|
3453
3453
|
p,
|
|
@@ -3459,7 +3459,7 @@ function pr({
|
|
|
3459
3459
|
v
|
|
3460
3460
|
]
|
|
3461
3461
|
);
|
|
3462
|
-
return /* @__PURE__ */ ie(Ft.Provider, { value:
|
|
3462
|
+
return /* @__PURE__ */ ie(Ft.Provider, { value: E, children: e });
|
|
3463
3463
|
}
|
|
3464
3464
|
function ot(e) {
|
|
3465
3465
|
const t = Ue(Ft);
|
|
@@ -3586,21 +3586,21 @@ function br(e = []) {
|
|
|
3586
3586
|
typeof window < "u" && typeof window.requestAnimationFrame == "function" ? o.current === null && (o.current = window.requestAnimationFrame(() => s())) : setTimeout(s, 8);
|
|
3587
3587
|
}, [s]), i = z((c) => {
|
|
3588
3588
|
r.current.push(c), a();
|
|
3589
|
-
}, [a]),
|
|
3589
|
+
}, [a]), u = Q(() => ({
|
|
3590
3590
|
setStatus: (c, l) => n({ type: "status", payload: { status: c, error: l } }),
|
|
3591
3591
|
reset: (c) => n({ type: "reset", payload: { messages: c } }),
|
|
3592
3592
|
seed: (c, l) => n({ type: "seed", payload: { messages: c, ...l ?? {} } }),
|
|
3593
3593
|
pushUser: (c, l) => n({ type: "user_message", payload: { message: c, editingMessageId: l } }),
|
|
3594
3594
|
onEvent: i
|
|
3595
3595
|
}), [i]);
|
|
3596
|
-
return { state: t, dispatch: n, ...
|
|
3596
|
+
return { state: t, dispatch: n, ...u };
|
|
3597
3597
|
}
|
|
3598
3598
|
function gt(e, t) {
|
|
3599
3599
|
var a;
|
|
3600
3600
|
const n = t, r = n == null ? void 0 : n.origin, o = n == null ? void 0 : n.scope, s = r === "task" || typeof o == "string" && o.startsWith("tools:");
|
|
3601
3601
|
if (t.type === "checkpoint") {
|
|
3602
|
-
const i = t.checkpointNs ?? e.lastCheckpointNs ?? null,
|
|
3603
|
-
return { ...e, lastCheckpointId: t.checkpointId, lastCheckpointNs: i, messages:
|
|
3602
|
+
const i = t.checkpointNs ?? e.lastCheckpointNs ?? null, u = hr(e.messages, t.checkpointId, i);
|
|
3603
|
+
return { ...e, lastCheckpointId: t.checkpointId, lastCheckpointNs: i, messages: u };
|
|
3604
3604
|
}
|
|
3605
3605
|
if (t.type === "status") {
|
|
3606
3606
|
const i = n.status === "completed" || n.status === "error" ? "idle" : n.status === "interrupted" ? "awaiting_input" : e.status;
|
|
@@ -3616,7 +3616,7 @@ function gt(e, t) {
|
|
|
3616
3616
|
return { ...e, status: "error", error: t.message, messages: [...e.messages, i] };
|
|
3617
3617
|
}
|
|
3618
3618
|
if (t.type === "values" && ((a = n.values) != null && a.messages)) {
|
|
3619
|
-
const i = n.values,
|
|
3619
|
+
const i = n.values, u = Array.isArray(i.messages) ? i.messages : [], c = Be(u), { messages: l, ...p } = i;
|
|
3620
3620
|
if (s) {
|
|
3621
3621
|
const m = typeof o == "string" && o.length > 0 ? o : "task";
|
|
3622
3622
|
return {
|
|
@@ -3636,22 +3636,22 @@ function gt(e, t) {
|
|
|
3636
3636
|
return t.type === "messages/partial" ? wr(e, n) : t.type === "tool.start" ? s ? e : vr(e, t) : t.type === "tool.progress" ? s ? e : kr(e, t) : t.type === "tool.end" ? s ? e : Ir(e, t) : t.type === "artifact.update" ? Tr(e, t) : e;
|
|
3637
3637
|
}
|
|
3638
3638
|
function wr(e, t) {
|
|
3639
|
-
const r = (t.messages || [t]).find((
|
|
3639
|
+
const r = (t.messages || [t]).find((u) => u.type === "ai" || u.role === "assistant");
|
|
3640
3640
|
if (!r) return e;
|
|
3641
3641
|
const o = r.id, s = r.content ?? "", a = e.assemblingId !== o;
|
|
3642
3642
|
let i = [...e.messages];
|
|
3643
3643
|
if (a) {
|
|
3644
|
-
const
|
|
3644
|
+
const u = nt({
|
|
3645
3645
|
...r,
|
|
3646
3646
|
role: "assistant",
|
|
3647
3647
|
content: typeof s == "string" ? [{ type: "text", text: s }] : s
|
|
3648
3648
|
});
|
|
3649
|
-
|
|
3649
|
+
u && i.push(u);
|
|
3650
3650
|
} else {
|
|
3651
|
-
const
|
|
3652
|
-
if (
|
|
3653
|
-
const c = i[
|
|
3654
|
-
i[
|
|
3651
|
+
const u = i.findIndex((c) => c.id === o);
|
|
3652
|
+
if (u !== -1) {
|
|
3653
|
+
const c = i[u], l = s;
|
|
3654
|
+
i[u] = {
|
|
3655
3655
|
...c,
|
|
3656
3656
|
content: [{ type: "text", text: l }]
|
|
3657
3657
|
};
|
|
@@ -3680,21 +3680,21 @@ function vr(e, t) {
|
|
|
3680
3680
|
const o = n.name || "tool", s = `Starting ${o}...`;
|
|
3681
3681
|
let a = [...e.messages], i = st(a, r);
|
|
3682
3682
|
if (i === -1) {
|
|
3683
|
-
for (let
|
|
3684
|
-
if (a[
|
|
3685
|
-
i =
|
|
3683
|
+
for (let u = a.length - 1; u >= 0; u--)
|
|
3684
|
+
if (a[u].role === "assistant") {
|
|
3685
|
+
i = u;
|
|
3686
3686
|
break;
|
|
3687
3687
|
}
|
|
3688
3688
|
}
|
|
3689
3689
|
if (i !== -1) {
|
|
3690
|
-
const
|
|
3690
|
+
const u = a[i], c = [...u.toolCalls || []], l = c.findIndex((p) => p.id === r);
|
|
3691
3691
|
l >= 0 ? c[l] = { ...c[l], status: "running", content: s } : c.push({
|
|
3692
3692
|
id: r,
|
|
3693
3693
|
name: o,
|
|
3694
3694
|
args: n.args || {},
|
|
3695
3695
|
status: "running",
|
|
3696
3696
|
content: s
|
|
3697
|
-
}), a[i] = { ...
|
|
3697
|
+
}), a[i] = { ...u, toolCalls: c };
|
|
3698
3698
|
}
|
|
3699
3699
|
return { ...e, messages: a };
|
|
3700
3700
|
}
|
|
@@ -3705,7 +3705,7 @@ function kr(e, t) {
|
|
|
3705
3705
|
const o = st(r, n);
|
|
3706
3706
|
if (o !== -1) {
|
|
3707
3707
|
const s = r[o], a = ce(t.content), i = (s.toolCalls || []).map(
|
|
3708
|
-
(
|
|
3708
|
+
(u) => u.id === n ? { ...u, content: typeof a == "string" ? a : u.content } : u
|
|
3709
3709
|
);
|
|
3710
3710
|
r[o] = { ...s, toolCalls: i };
|
|
3711
3711
|
}
|
|
@@ -3717,7 +3717,7 @@ function Ir(e, t) {
|
|
|
3717
3717
|
let r = [...e.messages];
|
|
3718
3718
|
const o = st(r, n), s = ce(t.content ?? t.error);
|
|
3719
3719
|
if (o !== -1) {
|
|
3720
|
-
const i = r[o],
|
|
3720
|
+
const i = r[o], u = (i.toolCalls || []).map(
|
|
3721
3721
|
(c) => c.id === n ? {
|
|
3722
3722
|
...c,
|
|
3723
3723
|
status: t.error ? "failed" : "completed",
|
|
@@ -3725,7 +3725,7 @@ function Ir(e, t) {
|
|
|
3725
3725
|
artifact: t.artifact
|
|
3726
3726
|
} : c
|
|
3727
3727
|
);
|
|
3728
|
-
r[o] = { ...i, toolCalls:
|
|
3728
|
+
r[o] = { ...i, toolCalls: u };
|
|
3729
3729
|
}
|
|
3730
3730
|
const a = {
|
|
3731
3731
|
id: `tool-${n}`,
|
|
@@ -3748,7 +3748,7 @@ function Tr(e, t) {
|
|
|
3748
3748
|
});
|
|
3749
3749
|
return t.partial_data && s.artifact && (s.artifact = { ...s.artifact, ...t.partial_data }), { ...e, messages: $t(e.messages, o, s) };
|
|
3750
3750
|
}
|
|
3751
|
-
function
|
|
3751
|
+
function Re(e) {
|
|
3752
3752
|
if (!(!e || typeof e != "object" || Array.isArray(e)))
|
|
3753
3753
|
return { ...e };
|
|
3754
3754
|
}
|
|
@@ -3760,7 +3760,7 @@ function Fe(e, t) {
|
|
|
3760
3760
|
return r.trim();
|
|
3761
3761
|
}
|
|
3762
3762
|
}
|
|
3763
|
-
function
|
|
3763
|
+
function xr(e, t) {
|
|
3764
3764
|
if (!e) return null;
|
|
3765
3765
|
for (const n of t) {
|
|
3766
3766
|
const r = e[n];
|
|
@@ -3770,12 +3770,12 @@ function Ar(e, t) {
|
|
|
3770
3770
|
return null;
|
|
3771
3771
|
}
|
|
3772
3772
|
function mt(e) {
|
|
3773
|
-
const t =
|
|
3773
|
+
const t = Re(e);
|
|
3774
3774
|
if (t)
|
|
3775
|
-
return
|
|
3775
|
+
return Re(t.configurable) ?? t;
|
|
3776
3776
|
}
|
|
3777
|
-
async function
|
|
3778
|
-
var i,
|
|
3777
|
+
async function Ar(e, t) {
|
|
3778
|
+
var i, u;
|
|
3779
3779
|
if (!e) return e ?? null;
|
|
3780
3780
|
const n = le(e), r = Array.isArray(n.checkpoints) ? n.checkpoints : n.checkpoints ? Object.values(n.checkpoints) : [], o = /* @__PURE__ */ new Set();
|
|
3781
3781
|
for (const c of r) {
|
|
@@ -3804,7 +3804,7 @@ async function xr(e, t) {
|
|
|
3804
3804
|
})
|
|
3805
3805
|
), a = new Map(s);
|
|
3806
3806
|
for (const c of r) {
|
|
3807
|
-
const l = (
|
|
3807
|
+
const l = (u = c == null ? void 0 : c.values) == null ? void 0 : u.messages;
|
|
3808
3808
|
if (Array.isArray(l))
|
|
3809
3809
|
for (const p of l) {
|
|
3810
3810
|
const m = p == null ? void 0 : p.content;
|
|
@@ -3830,31 +3830,31 @@ function ht(e) {
|
|
|
3830
3830
|
};
|
|
3831
3831
|
}
|
|
3832
3832
|
function Sr(e, t) {
|
|
3833
|
-
var P,
|
|
3833
|
+
var P, T;
|
|
3834
3834
|
if (!e) return null;
|
|
3835
|
-
const n = ((P = e.values) == null ? void 0 : P.activeAgent) ?? null, r = (
|
|
3835
|
+
const n = ((P = e.values) == null ? void 0 : P.activeAgent) ?? null, r = (T = e.values) == null ? void 0 : T.messages, s = (Array.isArray(r) ? r : []).map((S) => Cr(S, n)).filter((S) => !!S), a = Re(e.metadata) ?? {}, i = mt(e.config), u = Re(e.parentConfig), c = mt(u), l = Fe(i, ["checkpointId"]), p = Fe(i, ["checkpointNs"]), m = Fe(c, ["checkpointId"]), h = Re(e.config), v = Array.isArray(e.tasks) ? e.tasks.map((S) => ({ ...S })) : e.tasks ?? null, f = Array.isArray(e.next) ? [...e.next] : e.next ?? null, w = typeof e.createdAt == "string" && e.createdAt.trim() ? e.createdAt : new Date(Date.now() - t).toISOString(), k = {
|
|
3836
3836
|
...a,
|
|
3837
|
-
step:
|
|
3837
|
+
step: xr(a, ["step"]) ?? 0,
|
|
3838
3838
|
source: Fe(a, ["source"]) ?? null
|
|
3839
|
-
},
|
|
3840
|
-
...
|
|
3841
|
-
checkpointId:
|
|
3842
|
-
checkpointNs:
|
|
3843
|
-
})), I = e.values,
|
|
3839
|
+
}, E = s.map((S) => ({
|
|
3840
|
+
...S,
|
|
3841
|
+
checkpointId: S.checkpointId ?? l ?? null,
|
|
3842
|
+
checkpointNs: S.checkpointNs ?? p ?? null
|
|
3843
|
+
})), I = e.values, N = Array.isArray(e.interrupts) ? e.interrupts : Array.isArray(I == null ? void 0 : I.interrupts) ? I.interrupts : [];
|
|
3844
3844
|
return {
|
|
3845
3845
|
checkpointId: l ?? null,
|
|
3846
3846
|
checkpointNs: p ?? null,
|
|
3847
3847
|
createdAt: w,
|
|
3848
3848
|
parentId: m ?? null,
|
|
3849
|
-
messages:
|
|
3849
|
+
messages: E,
|
|
3850
3850
|
interrupt: Mr(
|
|
3851
|
-
|
|
3851
|
+
N,
|
|
3852
3852
|
t,
|
|
3853
3853
|
l ?? null
|
|
3854
3854
|
),
|
|
3855
3855
|
metadata: k,
|
|
3856
3856
|
config: h ?? null,
|
|
3857
|
-
parentConfig:
|
|
3857
|
+
parentConfig: u ?? null,
|
|
3858
3858
|
next: f,
|
|
3859
3859
|
tasks: v,
|
|
3860
3860
|
values: e.values ?? {}
|
|
@@ -3903,10 +3903,10 @@ function _r(e) {
|
|
|
3903
3903
|
for (let c = 0; c < e.length; c++) {
|
|
3904
3904
|
const l = e[c], p = l.checkpointId, m = p ?? `cp-${c}`, h = l.metadata ?? {}, v = typeof h.step == "number" ? h.step : null, f = typeof h.source == "string" ? h.source : null;
|
|
3905
3905
|
let w = null, k = null;
|
|
3906
|
-
const
|
|
3907
|
-
for (const
|
|
3908
|
-
|
|
3909
|
-
const I = l.next && l.next.length > 0 ? String(l.next[0]) : null,
|
|
3906
|
+
const E = Array.isArray(l.messages) ? l.messages : [];
|
|
3907
|
+
for (const T of E)
|
|
3908
|
+
T.role === "user" && (k || (k = T), T.id && (w = T.id));
|
|
3909
|
+
const I = l.next && l.next.length > 0 ? String(l.next[0]) : null, N = l.parentConfig ?? null, P = {
|
|
3910
3910
|
id: m,
|
|
3911
3911
|
step: v,
|
|
3912
3912
|
source: f,
|
|
@@ -3914,12 +3914,12 @@ function _r(e) {
|
|
|
3914
3914
|
namespace: l.checkpointNs ?? null,
|
|
3915
3915
|
parentId: l.parentId ?? null,
|
|
3916
3916
|
next: I,
|
|
3917
|
-
parentConfig:
|
|
3917
|
+
parentConfig: N,
|
|
3918
3918
|
userMessageId: w
|
|
3919
3919
|
};
|
|
3920
3920
|
if (o.push(P), p && t.set(p, P), p && k) {
|
|
3921
|
-
const
|
|
3922
|
-
|
|
3921
|
+
const T = Pr(k);
|
|
3922
|
+
T && r.set(p, T);
|
|
3923
3923
|
}
|
|
3924
3924
|
n.push({
|
|
3925
3925
|
id: m,
|
|
@@ -3928,7 +3928,7 @@ function _r(e) {
|
|
|
3928
3928
|
source: f,
|
|
3929
3929
|
createdAt: l.createdAt ?? null,
|
|
3930
3930
|
next: I,
|
|
3931
|
-
parentConfig:
|
|
3931
|
+
parentConfig: N
|
|
3932
3932
|
});
|
|
3933
3933
|
}
|
|
3934
3934
|
const s = /* @__PURE__ */ new Map();
|
|
@@ -3988,7 +3988,7 @@ function co(e, t, n) {
|
|
|
3988
3988
|
attempts: r
|
|
3989
3989
|
};
|
|
3990
3990
|
}
|
|
3991
|
-
function
|
|
3991
|
+
function Nr(e) {
|
|
3992
3992
|
return Q(() => _r(e), [e]);
|
|
3993
3993
|
}
|
|
3994
3994
|
function Dt({
|
|
@@ -4001,103 +4001,115 @@ function Dt({
|
|
|
4001
4001
|
isStreaming: a,
|
|
4002
4002
|
getMessages: i
|
|
4003
4003
|
}) {
|
|
4004
|
-
const [
|
|
4005
|
-
() => ht(
|
|
4006
|
-
[
|
|
4007
|
-
).checkpoints, m =
|
|
4004
|
+
const [u, c] = B(null), p = Q(
|
|
4005
|
+
() => ht(u),
|
|
4006
|
+
[u]
|
|
4007
|
+
).checkpoints, m = Nr(p), h = m.timeline, [v, f] = B(!1), [w, k] = B(!1), [E, I] = B(null), N = H(o), P = H(null), T = H(null);
|
|
4008
4008
|
q(() => {
|
|
4009
|
-
|
|
4009
|
+
N.current = o;
|
|
4010
4010
|
}, [o]);
|
|
4011
|
-
const
|
|
4012
|
-
async (
|
|
4013
|
-
const
|
|
4014
|
-
threadId:
|
|
4015
|
-
checkpointId:
|
|
4016
|
-
checkpointNs:
|
|
4017
|
-
}),
|
|
4011
|
+
const S = z(
|
|
4012
|
+
async (M) => {
|
|
4013
|
+
const L = await e.getState({
|
|
4014
|
+
threadId: M.threadId,
|
|
4015
|
+
checkpointId: M.checkpointId,
|
|
4016
|
+
checkpointNs: M.checkpointNs
|
|
4017
|
+
}), R = {
|
|
4018
4018
|
version: "values@1",
|
|
4019
|
-
threadId:
|
|
4020
|
-
checkpoints: [
|
|
4021
|
-
}, V = t ? await
|
|
4022
|
-
return
|
|
4019
|
+
threadId: M.threadId,
|
|
4020
|
+
checkpoints: [L]
|
|
4021
|
+
}, V = t ? await Ar(R, t) : R, { latest: D } = ht(V);
|
|
4022
|
+
return D;
|
|
4023
4023
|
},
|
|
4024
4024
|
[e, t]
|
|
4025
4025
|
), g = z(
|
|
4026
|
-
async (
|
|
4027
|
-
var
|
|
4028
|
-
if (!
|
|
4029
|
-
const
|
|
4030
|
-
if (P.current ===
|
|
4031
|
-
(
|
|
4032
|
-
const
|
|
4033
|
-
|
|
4026
|
+
async (M, L) => {
|
|
4027
|
+
var A;
|
|
4028
|
+
if (!M) return;
|
|
4029
|
+
const R = `${M}:${L ?? "latest"}`, V = i();
|
|
4030
|
+
if (P.current === R && !v && V.length > 0) return;
|
|
4031
|
+
(A = T.current) == null || A.abort();
|
|
4032
|
+
const D = new AbortController();
|
|
4033
|
+
T.current = D, f(!0), I(null);
|
|
4034
4034
|
try {
|
|
4035
|
-
const
|
|
4036
|
-
threadId:
|
|
4037
|
-
checkpointId:
|
|
4035
|
+
const y = await S({
|
|
4036
|
+
threadId: M,
|
|
4037
|
+
checkpointId: L ?? void 0
|
|
4038
4038
|
});
|
|
4039
|
-
if (
|
|
4040
|
-
n((
|
|
4041
|
-
checkpointId: (
|
|
4042
|
-
checkpointNs: (
|
|
4043
|
-
pendingInterrupt: (
|
|
4044
|
-
values:
|
|
4045
|
-
}), P.current =
|
|
4046
|
-
const
|
|
4047
|
-
threadId:
|
|
4039
|
+
if (N.current !== M) return;
|
|
4040
|
+
n((y == null ? void 0 : y.messages) ?? [], {
|
|
4041
|
+
checkpointId: (y == null ? void 0 : y.checkpointId) ?? null,
|
|
4042
|
+
checkpointNs: (y == null ? void 0 : y.checkpointNs) ?? null,
|
|
4043
|
+
pendingInterrupt: (y == null ? void 0 : y.interrupt) ?? null,
|
|
4044
|
+
values: y == null ? void 0 : y.values
|
|
4045
|
+
}), P.current = R;
|
|
4046
|
+
const F = await e.getStateHistory({
|
|
4047
|
+
threadId: M,
|
|
4048
4048
|
limit: 100,
|
|
4049
4049
|
includeMessages: !1
|
|
4050
4050
|
});
|
|
4051
|
-
|
|
4052
|
-
} catch (
|
|
4053
|
-
if (!Qt(
|
|
4054
|
-
const
|
|
4055
|
-
I(
|
|
4051
|
+
N.current === M && c(F);
|
|
4052
|
+
} catch (y) {
|
|
4053
|
+
if (!Qt(y)) {
|
|
4054
|
+
const F = String(y);
|
|
4055
|
+
I(F), r == null || r(F);
|
|
4056
4056
|
}
|
|
4057
4057
|
} finally {
|
|
4058
4058
|
f(!1);
|
|
4059
4059
|
}
|
|
4060
4060
|
},
|
|
4061
|
-
[e, n,
|
|
4062
|
-
),
|
|
4063
|
-
async (
|
|
4061
|
+
[e, n, S, r, v, i]
|
|
4062
|
+
), b = z(
|
|
4063
|
+
async (M, L) => {
|
|
4064
4064
|
if (o) {
|
|
4065
4065
|
k(!0);
|
|
4066
4066
|
try {
|
|
4067
|
-
const
|
|
4067
|
+
const R = await S({
|
|
4068
4068
|
threadId: o,
|
|
4069
|
-
checkpointId:
|
|
4070
|
-
checkpointNs:
|
|
4069
|
+
checkpointId: M,
|
|
4070
|
+
checkpointNs: L ?? void 0
|
|
4071
4071
|
});
|
|
4072
|
-
n((
|
|
4073
|
-
checkpointId: (
|
|
4074
|
-
checkpointNs: (
|
|
4075
|
-
pendingInterrupt: (
|
|
4076
|
-
values:
|
|
4072
|
+
n((R == null ? void 0 : R.messages) ?? [], {
|
|
4073
|
+
checkpointId: (R == null ? void 0 : R.checkpointId) ?? M,
|
|
4074
|
+
checkpointNs: (R == null ? void 0 : R.checkpointNs) ?? L,
|
|
4075
|
+
pendingInterrupt: (R == null ? void 0 : R.interrupt) ?? null,
|
|
4076
|
+
values: R == null ? void 0 : R.values
|
|
4077
4077
|
});
|
|
4078
|
-
} catch (
|
|
4079
|
-
console.error("[useThreadHistoryState] Navigation failed",
|
|
4078
|
+
} catch (R) {
|
|
4079
|
+
console.error("[useThreadHistoryState] Navigation failed", R);
|
|
4080
4080
|
} finally {
|
|
4081
4081
|
k(!1);
|
|
4082
4082
|
}
|
|
4083
4083
|
}
|
|
4084
4084
|
},
|
|
4085
|
-
[o,
|
|
4086
|
-
),
|
|
4085
|
+
[o, S, n]
|
|
4086
|
+
), O = z(async () => {
|
|
4087
4087
|
o && await g(o);
|
|
4088
4088
|
}, [o, g]), U = z(
|
|
4089
|
-
async (
|
|
4090
|
-
|
|
4091
|
-
|
|
4089
|
+
async (M) => {
|
|
4090
|
+
var V;
|
|
4091
|
+
const L = (M == null ? void 0 : M.threadId) || o;
|
|
4092
|
+
if (!L || o !== L) return;
|
|
4093
|
+
if (c(M), P.current = `${L}:latest`, (V = M.values) != null && V.messages) {
|
|
4094
|
+
const D = await S({
|
|
4095
|
+
threadId: L
|
|
4096
|
+
});
|
|
4097
|
+
D && n(D.messages ?? [], {
|
|
4098
|
+
checkpointId: D.checkpointId ?? null,
|
|
4099
|
+
checkpointNs: D.checkpointNs ?? null,
|
|
4100
|
+
pendingInterrupt: D.interrupt ?? null,
|
|
4101
|
+
values: D.values
|
|
4102
|
+
});
|
|
4103
|
+
}
|
|
4092
4104
|
},
|
|
4093
|
-
[o]
|
|
4105
|
+
[o, S, n]
|
|
4094
4106
|
);
|
|
4095
4107
|
q(() => {
|
|
4096
4108
|
if (!s || !o || v || a) return;
|
|
4097
|
-
const
|
|
4098
|
-
P.current !==
|
|
4109
|
+
const M = `${o}:latest`;
|
|
4110
|
+
P.current !== M && g(o);
|
|
4099
4111
|
}, [s, o, v, a, g]);
|
|
4100
|
-
const
|
|
4112
|
+
const C = z(() => {
|
|
4101
4113
|
c(null), f(!1), k(!1), I(null), P.current = null;
|
|
4102
4114
|
}, []);
|
|
4103
4115
|
return {
|
|
@@ -4106,20 +4118,20 @@ function Dt({
|
|
|
4106
4118
|
checkpointIndex: m,
|
|
4107
4119
|
isLoadingThread: v,
|
|
4108
4120
|
isLoadingCheckpoint: w,
|
|
4109
|
-
threadStateError:
|
|
4121
|
+
threadStateError: E,
|
|
4110
4122
|
loadThread: g,
|
|
4111
|
-
navigateToCheckpoint:
|
|
4112
|
-
setCurrentCheckpointId: (
|
|
4113
|
-
n(i(), { checkpointId:
|
|
4123
|
+
navigateToCheckpoint: b,
|
|
4124
|
+
setCurrentCheckpointId: (M, L) => {
|
|
4125
|
+
n(i(), { checkpointId: M, checkpointNs: L });
|
|
4114
4126
|
},
|
|
4115
|
-
returnToLatest:
|
|
4127
|
+
returnToLatest: O,
|
|
4116
4128
|
handleValuesEvent: U,
|
|
4117
4129
|
markSkipNextLoad: () => {
|
|
4118
4130
|
},
|
|
4119
4131
|
markStreamPendingThread: () => {
|
|
4120
4132
|
},
|
|
4121
|
-
resetHistoryState:
|
|
4122
|
-
clearState:
|
|
4133
|
+
resetHistoryState: C,
|
|
4134
|
+
clearState: C
|
|
4123
4135
|
};
|
|
4124
4136
|
}
|
|
4125
4137
|
const Vt = Se(null), Kt = Se(null);
|
|
@@ -4128,7 +4140,7 @@ function Gt(e) {
|
|
|
4128
4140
|
if (!t && !(e != null && e.optional)) throw new Error("useThreadState must be used within a ThreadStateProvider");
|
|
4129
4141
|
return t;
|
|
4130
4142
|
}
|
|
4131
|
-
function
|
|
4143
|
+
function Rr() {
|
|
4132
4144
|
const e = Ue(Kt);
|
|
4133
4145
|
if (!e)
|
|
4134
4146
|
throw new Error("useThreadStateUpdater must be used within a ThreadStateProvider");
|
|
@@ -4143,24 +4155,24 @@ function zr({
|
|
|
4143
4155
|
isStreaming: s,
|
|
4144
4156
|
onError: a
|
|
4145
4157
|
}) {
|
|
4146
|
-
const { chatApi: i, fileApi:
|
|
4158
|
+
const { chatApi: i, fileApi: u } = Ae(), { currentThreadId: c } = ot(), { state: l, seed: p, onEvent: m, dispatch: h } = br(), {
|
|
4147
4159
|
threadCheckpoints: v,
|
|
4148
4160
|
threadTimeline: f,
|
|
4149
4161
|
checkpointIndex: w,
|
|
4150
4162
|
isLoadingThread: k,
|
|
4151
|
-
isLoadingCheckpoint:
|
|
4163
|
+
isLoadingCheckpoint: E,
|
|
4152
4164
|
threadStateError: I,
|
|
4153
|
-
loadThread:
|
|
4165
|
+
loadThread: N,
|
|
4154
4166
|
navigateToCheckpoint: P,
|
|
4155
|
-
setCurrentCheckpointId:
|
|
4156
|
-
returnToLatest:
|
|
4167
|
+
setCurrentCheckpointId: T,
|
|
4168
|
+
returnToLatest: S,
|
|
4157
4169
|
handleValuesEvent: g,
|
|
4158
|
-
markSkipNextLoad:
|
|
4159
|
-
markStreamPendingThread:
|
|
4170
|
+
markSkipNextLoad: b,
|
|
4171
|
+
markStreamPendingThread: O,
|
|
4160
4172
|
resetHistoryState: U
|
|
4161
4173
|
} = Dt({
|
|
4162
4174
|
api: i,
|
|
4163
|
-
fileApi:
|
|
4175
|
+
fileApi: u,
|
|
4164
4176
|
seed: p,
|
|
4165
4177
|
onError: a,
|
|
4166
4178
|
currentThreadId: c,
|
|
@@ -4170,23 +4182,19 @@ function zr({
|
|
|
4170
4182
|
autoLoadInitial: o,
|
|
4171
4183
|
isStreaming: s,
|
|
4172
4184
|
getMessages: z(() => l.messages, [l.messages])
|
|
4173
|
-
})
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
}, [c, p, U]);
|
|
4177
|
-
const S = H(null), E = z(
|
|
4178
|
-
(u) => {
|
|
4179
|
-
S.current = u;
|
|
4185
|
+
}), C = H(null), M = z(
|
|
4186
|
+
(d) => {
|
|
4187
|
+
C.current = d;
|
|
4180
4188
|
},
|
|
4181
4189
|
[]
|
|
4182
|
-
),
|
|
4183
|
-
(
|
|
4184
|
-
|
|
4190
|
+
), L = H(null), R = z(
|
|
4191
|
+
(d) => {
|
|
4192
|
+
L.current = d;
|
|
4185
4193
|
},
|
|
4186
4194
|
[]
|
|
4187
|
-
), V = Q(() => ({ assemblingMessageId: l.assemblingId ?? null }), [l.assemblingId]),
|
|
4188
|
-
(
|
|
4189
|
-
const _ = jt(
|
|
4195
|
+
), V = Q(() => ({ assemblingMessageId: l.assemblingId ?? null }), [l.assemblingId]), D = z(
|
|
4196
|
+
(d, x) => {
|
|
4197
|
+
const _ = jt(d, "user");
|
|
4190
4198
|
return h({
|
|
4191
4199
|
type: "user_message",
|
|
4192
4200
|
payload: {
|
|
@@ -4196,9 +4204,9 @@ function zr({
|
|
|
4196
4204
|
}), _;
|
|
4197
4205
|
},
|
|
4198
4206
|
[h]
|
|
4199
|
-
),
|
|
4200
|
-
|
|
4201
|
-
}, [p, U]),
|
|
4207
|
+
), A = z(async () => {
|
|
4208
|
+
C.current ? await C.current() : (p([], {}), U());
|
|
4209
|
+
}, [p, U]), y = Q(() => On(l.messages), [l.messages]), F = Q(
|
|
4202
4210
|
() => ({
|
|
4203
4211
|
status: l.status,
|
|
4204
4212
|
threadId: c,
|
|
@@ -4215,38 +4223,38 @@ function zr({
|
|
|
4215
4223
|
metadata: V,
|
|
4216
4224
|
values: l.values ?? {},
|
|
4217
4225
|
isLoading: k,
|
|
4218
|
-
isLoadingCheckpoint:
|
|
4226
|
+
isLoadingCheckpoint: E,
|
|
4219
4227
|
error: I,
|
|
4220
4228
|
loadOlder: async () => {
|
|
4221
4229
|
},
|
|
4222
4230
|
// Placeholder
|
|
4223
|
-
seedFromSnapshot: (
|
|
4224
|
-
p(
|
|
4225
|
-
checkpointId:
|
|
4226
|
-
checkpointNs:
|
|
4227
|
-
pendingInterrupt:
|
|
4228
|
-
values:
|
|
4231
|
+
seedFromSnapshot: (d) => {
|
|
4232
|
+
p(d.messages, {
|
|
4233
|
+
checkpointId: d.checkpointId,
|
|
4234
|
+
checkpointNs: d.checkpointNs,
|
|
4235
|
+
pendingInterrupt: d.interrupt,
|
|
4236
|
+
values: d.values
|
|
4229
4237
|
});
|
|
4230
4238
|
},
|
|
4231
|
-
clearState:
|
|
4239
|
+
clearState: A,
|
|
4232
4240
|
navigateToCheckpoint: P,
|
|
4233
|
-
setCurrentCheckpointId:
|
|
4234
|
-
returnToLatest:
|
|
4235
|
-
loadThread: async (
|
|
4236
|
-
await
|
|
4241
|
+
setCurrentCheckpointId: T,
|
|
4242
|
+
returnToLatest: S,
|
|
4243
|
+
loadThread: async (d, x, _) => {
|
|
4244
|
+
await N(d, x, { clearProgress: !1 });
|
|
4237
4245
|
},
|
|
4238
|
-
clearThread:
|
|
4239
|
-
respondToInterrupt: async (
|
|
4240
|
-
|
|
4246
|
+
clearThread: A,
|
|
4247
|
+
respondToInterrupt: async (d, x, _) => {
|
|
4248
|
+
L.current && await L.current(d, x, _);
|
|
4241
4249
|
},
|
|
4242
4250
|
messagePreviews: w.messagePreviews,
|
|
4243
4251
|
handleValuesEvent: g,
|
|
4244
|
-
markSkipNextLoad:
|
|
4245
|
-
markStreamPendingThread:
|
|
4252
|
+
markSkipNextLoad: b,
|
|
4253
|
+
markStreamPendingThread: O,
|
|
4246
4254
|
resetHistoryState: U,
|
|
4247
|
-
pushUser:
|
|
4255
|
+
pushUser: D,
|
|
4248
4256
|
onEvent: m,
|
|
4249
|
-
artifacts:
|
|
4257
|
+
artifacts: y
|
|
4250
4258
|
}),
|
|
4251
4259
|
[
|
|
4252
4260
|
c,
|
|
@@ -4261,29 +4269,29 @@ function zr({
|
|
|
4261
4269
|
w,
|
|
4262
4270
|
V,
|
|
4263
4271
|
k,
|
|
4264
|
-
|
|
4272
|
+
E,
|
|
4265
4273
|
I,
|
|
4266
4274
|
p,
|
|
4267
|
-
b,
|
|
4268
|
-
P,
|
|
4269
4275
|
A,
|
|
4270
|
-
|
|
4271
|
-
|
|
4276
|
+
P,
|
|
4277
|
+
T,
|
|
4278
|
+
S,
|
|
4279
|
+
N,
|
|
4272
4280
|
g,
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4281
|
+
b,
|
|
4282
|
+
O,
|
|
4283
|
+
D,
|
|
4276
4284
|
m,
|
|
4277
|
-
|
|
4285
|
+
y
|
|
4278
4286
|
]
|
|
4279
|
-
),
|
|
4287
|
+
), $ = Q(
|
|
4280
4288
|
() => ({
|
|
4281
|
-
registerClearThread:
|
|
4282
|
-
registerRespondToInterrupt:
|
|
4289
|
+
registerClearThread: M,
|
|
4290
|
+
registerRespondToInterrupt: R
|
|
4283
4291
|
}),
|
|
4284
|
-
[
|
|
4292
|
+
[M, R]
|
|
4285
4293
|
);
|
|
4286
|
-
return /* @__PURE__ */ ie(Kt.Provider, { value:
|
|
4294
|
+
return /* @__PURE__ */ ie(Kt.Provider, { value: $, children: /* @__PURE__ */ ie(Vt.Provider, { value: F, children: e }) });
|
|
4287
4295
|
}
|
|
4288
4296
|
const Ht = Se(null), Ur = Se(!1);
|
|
4289
4297
|
function Lr({
|
|
@@ -4295,29 +4303,29 @@ function Lr({
|
|
|
4295
4303
|
onUpdateEvent: s,
|
|
4296
4304
|
onCustomEvent: a,
|
|
4297
4305
|
onMetadataEvent: i,
|
|
4298
|
-
onFinish:
|
|
4306
|
+
onFinish: u,
|
|
4299
4307
|
onStreamingChange: c
|
|
4300
4308
|
}) {
|
|
4301
|
-
const { chatApi: l, baseUrl: p } =
|
|
4309
|
+
const { chatApi: l, baseUrl: p } = Ae(), m = p, h = pe(t), v = pe(n), f = pe(r), w = pe(o), k = pe(s), E = pe(a), I = pe(i), N = pe(u), P = pe(c), T = Q(
|
|
4302
4310
|
() => ({
|
|
4303
4311
|
onError: h,
|
|
4304
4312
|
onAuthError: v,
|
|
4305
4313
|
onConnectionError: f,
|
|
4306
4314
|
onMetadataEvent: I,
|
|
4307
|
-
onCustomEvent:
|
|
4315
|
+
onCustomEvent: E,
|
|
4308
4316
|
onUpdateEvent: k,
|
|
4309
4317
|
onToolEnd: w,
|
|
4310
|
-
onFinish:
|
|
4318
|
+
onFinish: N
|
|
4311
4319
|
}),
|
|
4312
4320
|
[
|
|
4313
4321
|
h,
|
|
4314
4322
|
v,
|
|
4315
4323
|
f,
|
|
4316
4324
|
I,
|
|
4317
|
-
|
|
4325
|
+
E,
|
|
4318
4326
|
k,
|
|
4319
4327
|
w,
|
|
4320
|
-
|
|
4328
|
+
N
|
|
4321
4329
|
]
|
|
4322
4330
|
);
|
|
4323
4331
|
return /* @__PURE__ */ ie(Ur.Provider, { value: !0, children: /* @__PURE__ */ ie(
|
|
@@ -4325,7 +4333,7 @@ function Lr({
|
|
|
4325
4333
|
{
|
|
4326
4334
|
api: l,
|
|
4327
4335
|
streamBaseUrl: m,
|
|
4328
|
-
handlers:
|
|
4336
|
+
handlers: T,
|
|
4329
4337
|
onStreamingChange: P,
|
|
4330
4338
|
children: e
|
|
4331
4339
|
}
|
|
@@ -4338,7 +4346,7 @@ function jr({
|
|
|
4338
4346
|
handlers: r,
|
|
4339
4347
|
onStreamingChange: o
|
|
4340
4348
|
}) {
|
|
4341
|
-
const { setCurrentThreadId: s, currentThreadIdRef: a, addThreadFromEvent: i, currentThreadId:
|
|
4349
|
+
const { setCurrentThreadId: s, currentThreadIdRef: a, addThreadFromEvent: i, currentThreadId: u } = ot(), {
|
|
4342
4350
|
interrupt: c,
|
|
4343
4351
|
checkpoint: l,
|
|
4344
4352
|
timelineCheckpoints: p,
|
|
@@ -4348,18 +4356,18 @@ function jr({
|
|
|
4348
4356
|
resetHistoryState: f,
|
|
4349
4357
|
pushUser: w,
|
|
4350
4358
|
onEvent: k,
|
|
4351
|
-
messages:
|
|
4352
|
-
} = Gt(), { registerClearThread: I, registerRespondToInterrupt:
|
|
4353
|
-
(
|
|
4354
|
-
i(
|
|
4359
|
+
messages: E
|
|
4360
|
+
} = Gt(), { registerClearThread: I, registerRespondToInterrupt: N } = Rr(), P = z(
|
|
4361
|
+
(d) => {
|
|
4362
|
+
i(d), v(d.threadId), a.current !== d.threadId && ((d.created ?? !a.current) && h(d.threadId), s(d.threadId));
|
|
4355
4363
|
},
|
|
4356
4364
|
[i, h, v, s, a]
|
|
4357
|
-
),
|
|
4365
|
+
), T = lr({
|
|
4358
4366
|
baseUrl: n,
|
|
4359
4367
|
onEvent: k,
|
|
4360
|
-
onError: (
|
|
4368
|
+
onError: (d) => {
|
|
4361
4369
|
var x;
|
|
4362
|
-
(x = r.onError) == null || x.call(r, (
|
|
4370
|
+
(x = r.onError) == null || x.call(r, (d == null ? void 0 : d.message) ?? String(d));
|
|
4363
4371
|
},
|
|
4364
4372
|
onAuthError: r.onAuthError,
|
|
4365
4373
|
onConnectionError: r.onConnectionError,
|
|
@@ -4372,122 +4380,122 @@ function jr({
|
|
|
4372
4380
|
handleValuesEvent: m
|
|
4373
4381
|
});
|
|
4374
4382
|
q(() => {
|
|
4375
|
-
o == null || o(
|
|
4376
|
-
}, [
|
|
4377
|
-
const { stream:
|
|
4383
|
+
o == null || o(T.isStreaming);
|
|
4384
|
+
}, [T.isStreaming, o]);
|
|
4385
|
+
const { stream: S, stop: g, clear: b, isStreaming: O, error: U, connected: C, streamedMessages: M, activeMessageId: L } = T;
|
|
4378
4386
|
q(() => {
|
|
4379
|
-
|
|
4380
|
-
}, [
|
|
4381
|
-
const
|
|
4382
|
-
async (
|
|
4383
|
-
await
|
|
4387
|
+
u !== void 0 && b();
|
|
4388
|
+
}, [u, b]);
|
|
4389
|
+
const R = z(
|
|
4390
|
+
async (d, x) => {
|
|
4391
|
+
await S(d, x);
|
|
4384
4392
|
},
|
|
4385
|
-
[
|
|
4393
|
+
[S]
|
|
4386
4394
|
), V = H(l);
|
|
4387
4395
|
q(() => {
|
|
4388
4396
|
V.current = l;
|
|
4389
4397
|
}, [l]);
|
|
4390
|
-
const
|
|
4391
|
-
async (
|
|
4398
|
+
const D = z(
|
|
4399
|
+
async (d, x, _) => {
|
|
4392
4400
|
const te = a.current;
|
|
4393
4401
|
if (!te)
|
|
4394
4402
|
throw new Error("No active thread to handle interrupt");
|
|
4395
|
-
const J =
|
|
4403
|
+
const J = d ? x ?? !0 : !1, G = V.current, Z = (_ == null ? void 0 : _.checkpointId) ?? G.id ?? void 0, ae = (_ == null ? void 0 : _.checkpointNs) ?? G.namespace ?? void 0, ue = {
|
|
4396
4404
|
threadId: te,
|
|
4397
4405
|
checkpointId: Z,
|
|
4398
4406
|
checkpointNs: ae,
|
|
4399
4407
|
command: { kind: "resume", value: J },
|
|
4400
4408
|
payload: _ == null ? void 0 : _.payload
|
|
4401
4409
|
};
|
|
4402
|
-
|
|
4410
|
+
R(ue);
|
|
4403
4411
|
},
|
|
4404
|
-
[a,
|
|
4412
|
+
[a, R]
|
|
4405
4413
|
);
|
|
4406
4414
|
q(() => {
|
|
4407
|
-
|
|
4408
|
-
}, [
|
|
4409
|
-
const
|
|
4410
|
-
g(),
|
|
4411
|
-
}, [
|
|
4415
|
+
N(D);
|
|
4416
|
+
}, [D, N]);
|
|
4417
|
+
const A = z(async () => {
|
|
4418
|
+
g(), b(), f(), s(null);
|
|
4419
|
+
}, [b, f, s, g]);
|
|
4412
4420
|
q(() => {
|
|
4413
|
-
I(
|
|
4414
|
-
}, [
|
|
4415
|
-
const
|
|
4416
|
-
async (
|
|
4417
|
-
|
|
4421
|
+
I(A);
|
|
4422
|
+
}, [A, I]);
|
|
4423
|
+
const y = z(
|
|
4424
|
+
async (d, x) => {
|
|
4425
|
+
O && g();
|
|
4418
4426
|
let _ = a.current;
|
|
4419
|
-
const te = (
|
|
4427
|
+
const te = (d == null ? void 0 : d.text) ?? "", J = (d == null ? void 0 : d.attachments) ?? [], G = (te == null ? void 0 : te.trim()) ?? "", Z = { ...(d == null ? void 0 : d.payload) ?? {} }, ae = Array.isArray(Z.messages) ? Z.messages : void 0;
|
|
4420
4428
|
ae && delete Z.messages;
|
|
4421
|
-
const
|
|
4422
|
-
if (!_ && !
|
|
4429
|
+
const ue = !!(ae && ae.length), W = !!(d.contentParts && d.contentParts.length > 0);
|
|
4430
|
+
if (!_ && !G && J.length === 0 && !ue && !W) return;
|
|
4423
4431
|
if (!_) {
|
|
4424
4432
|
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);
|
|
4425
4433
|
_ = `${he}${ye}`, h(_), s(_);
|
|
4426
4434
|
}
|
|
4427
4435
|
let ee = null;
|
|
4428
|
-
|
|
4436
|
+
d.contentParts && d.contentParts.length > 0 && (ee = d.contentParts);
|
|
4429
4437
|
const { contentParts: ve, filesInfo: X } = ee ? { contentParts: ee, filesInfo: [] } : await or(J), Y = [...ve];
|
|
4430
|
-
|
|
4431
|
-
const me =
|
|
4432
|
-
let
|
|
4438
|
+
G && Y.push({ type: "text", text: te });
|
|
4439
|
+
const me = d == null ? void 0 : d.originalMessageId, Le = !!(d != null && d.edit && me), je = !ue && Y.length > 0;
|
|
4440
|
+
let de = null;
|
|
4433
4441
|
if (je) {
|
|
4434
4442
|
const he = Le ? me : `msg-${Date.now()}`;
|
|
4435
|
-
|
|
4443
|
+
de = jt({
|
|
4436
4444
|
id: he,
|
|
4437
4445
|
role: "user",
|
|
4438
4446
|
content: Y,
|
|
4439
4447
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
4440
|
-
}, "user"), Le ? w(
|
|
4448
|
+
}, "user"), Le ? w(de, { editingMessageId: me }) : w(de);
|
|
4441
4449
|
}
|
|
4442
|
-
const Ie =
|
|
4450
|
+
const Ie = ue ? ae : de ? [de] : [], ne = {
|
|
4443
4451
|
...Z,
|
|
4444
4452
|
...X.length ? { files_info: X } : {}
|
|
4445
4453
|
};
|
|
4446
4454
|
Ie.length ? ne.messages = Ie : "messages" in ne || (ne.messages = []);
|
|
4447
|
-
const Me = (
|
|
4448
|
-
if (
|
|
4455
|
+
const Me = (d == null ? void 0 : d.checkpointId) ?? l.id ?? void 0;
|
|
4456
|
+
if (d != null && d.edit && !Me)
|
|
4449
4457
|
throw new Error(
|
|
4450
4458
|
`[streaming] Missing checkpointId for edit submit. threadId=${_ ?? "null"}`
|
|
4451
4459
|
);
|
|
4452
4460
|
const Ee = {
|
|
4453
4461
|
threadId: _,
|
|
4454
|
-
content:
|
|
4462
|
+
content: d == null ? void 0 : d.text,
|
|
4455
4463
|
payload: ne,
|
|
4456
|
-
config:
|
|
4464
|
+
config: d == null ? void 0 : d.config,
|
|
4457
4465
|
checkpointId: Me,
|
|
4458
|
-
command:
|
|
4459
|
-
edit:
|
|
4466
|
+
command: d == null ? void 0 : d.command,
|
|
4467
|
+
edit: d == null ? void 0 : d.edit
|
|
4460
4468
|
};
|
|
4461
|
-
return
|
|
4469
|
+
return R(Ee, x);
|
|
4462
4470
|
},
|
|
4463
|
-
[l, a,
|
|
4464
|
-
),
|
|
4465
|
-
const
|
|
4466
|
-
if (!
|
|
4467
|
-
return
|
|
4471
|
+
[l, a, O, h, w, R, g, p]
|
|
4472
|
+
), F = Q(() => {
|
|
4473
|
+
const d = Object.keys(M).length > 0;
|
|
4474
|
+
if (!O && !d)
|
|
4475
|
+
return E;
|
|
4468
4476
|
const x = /* @__PURE__ */ new Map();
|
|
4469
|
-
return
|
|
4477
|
+
return E.forEach((_) => x.set(_.id, _)), Object.values(M).forEach((_) => {
|
|
4470
4478
|
x.set(_.id, _);
|
|
4471
4479
|
}), Array.from(x.values());
|
|
4472
|
-
}, [
|
|
4480
|
+
}, [O, M, E]), $ = Q(
|
|
4473
4481
|
() => ({
|
|
4474
|
-
isStreaming:
|
|
4482
|
+
isStreaming: O,
|
|
4475
4483
|
error: U,
|
|
4476
|
-
connectionState: U ? "error" :
|
|
4477
|
-
messages:
|
|
4478
|
-
activeMessageId:
|
|
4479
|
-
submit:
|
|
4484
|
+
connectionState: U ? "error" : O ? C ? "connected" : "connecting" : "idle",
|
|
4485
|
+
messages: F,
|
|
4486
|
+
activeMessageId: L,
|
|
4487
|
+
submit: y,
|
|
4480
4488
|
stop: g,
|
|
4481
4489
|
interrupt: c,
|
|
4482
4490
|
resume: () => Promise.resolve(),
|
|
4483
|
-
goto: (
|
|
4491
|
+
goto: (d, x) => Promise.resolve(),
|
|
4484
4492
|
clearError: () => {
|
|
4485
4493
|
}
|
|
4486
4494
|
// TODO: Implement error clearing
|
|
4487
4495
|
}),
|
|
4488
|
-
[
|
|
4496
|
+
[O, U, y, g, c, C, F]
|
|
4489
4497
|
);
|
|
4490
|
-
return /* @__PURE__ */ ie(Ht.Provider, { value:
|
|
4498
|
+
return /* @__PURE__ */ ie(Ht.Provider, { value: $, children: e });
|
|
4491
4499
|
}
|
|
4492
4500
|
function pe(e) {
|
|
4493
4501
|
const t = H(e);
|
|
@@ -4540,7 +4548,7 @@ function uo({
|
|
|
4540
4548
|
autoLoadInitial: s = !0,
|
|
4541
4549
|
onConnectionError: a,
|
|
4542
4550
|
onError: i,
|
|
4543
|
-
onAuthError:
|
|
4551
|
+
onAuthError: u,
|
|
4544
4552
|
onThreadChange: c,
|
|
4545
4553
|
onToolEnd: l,
|
|
4546
4554
|
onUpdateEvent: p,
|
|
@@ -4548,33 +4556,33 @@ function uo({
|
|
|
4548
4556
|
onMetadataEvent: h,
|
|
4549
4557
|
onFinish: v
|
|
4550
4558
|
}) {
|
|
4551
|
-
const f = $r(t), [w, k] = B(!1),
|
|
4559
|
+
const f = $r(t), [w, k] = B(!1), E = ge(i), I = ge(u), N = ge(a), P = ge(c), T = ge(l), S = ge(p), g = ge(m), b = ge(h), O = ge(v), U = Q(
|
|
4552
4560
|
() => ({
|
|
4553
|
-
onError:
|
|
4561
|
+
onError: E,
|
|
4554
4562
|
onAuthError: I,
|
|
4555
|
-
onConnectionError:
|
|
4556
|
-
onToolEnd:
|
|
4557
|
-
onUpdateEvent:
|
|
4563
|
+
onConnectionError: N,
|
|
4564
|
+
onToolEnd: T,
|
|
4565
|
+
onUpdateEvent: S,
|
|
4558
4566
|
onCustomEvent: g,
|
|
4559
|
-
onMetadataEvent:
|
|
4560
|
-
onFinish:
|
|
4567
|
+
onMetadataEvent: b,
|
|
4568
|
+
onFinish: O
|
|
4561
4569
|
}),
|
|
4562
4570
|
[
|
|
4563
|
-
|
|
4571
|
+
E,
|
|
4564
4572
|
I,
|
|
4565
|
-
|
|
4566
|
-
|
|
4567
|
-
|
|
4573
|
+
N,
|
|
4574
|
+
T,
|
|
4575
|
+
S,
|
|
4568
4576
|
g,
|
|
4569
|
-
|
|
4570
|
-
|
|
4577
|
+
b,
|
|
4578
|
+
O
|
|
4571
4579
|
]
|
|
4572
4580
|
);
|
|
4573
4581
|
return /* @__PURE__ */ ie(nr, { apiConfig: f, children: /* @__PURE__ */ ie(
|
|
4574
4582
|
pr,
|
|
4575
4583
|
{
|
|
4576
4584
|
initialThreadId: n,
|
|
4577
|
-
onError:
|
|
4585
|
+
onError: E,
|
|
4578
4586
|
onThreadChange: P,
|
|
4579
4587
|
children: /* @__PURE__ */ ie(
|
|
4580
4588
|
zr,
|
|
@@ -4583,7 +4591,7 @@ function uo({
|
|
|
4583
4591
|
initialCheckpointId: r,
|
|
4584
4592
|
initialCheckpointNs: o,
|
|
4585
4593
|
autoLoadInitial: s,
|
|
4586
|
-
onError:
|
|
4594
|
+
onError: E,
|
|
4587
4595
|
isStreaming: w,
|
|
4588
4596
|
children: /* @__PURE__ */ ie(
|
|
4589
4597
|
Lr,
|
|
@@ -4698,13 +4706,13 @@ function Wr() {
|
|
|
4698
4706
|
};
|
|
4699
4707
|
}
|
|
4700
4708
|
function fo(e) {
|
|
4701
|
-
const { allowFileOpen: t, currentThreadId: n } = e, { fileApi: r } =
|
|
4702
|
-
l(!1),
|
|
4709
|
+
const { allowFileOpen: t, currentThreadId: n } = e, { fileApi: r } = Ae(), { toast: o } = Wr(), [s, a] = B({}), [i, u] = B(null), [c, l] = B(!1), p = z(() => {
|
|
4710
|
+
l(!1), u(null);
|
|
4703
4711
|
}, []), m = z((v) => {
|
|
4704
|
-
|
|
4712
|
+
u(v), l(!0);
|
|
4705
4713
|
}, []), h = z(
|
|
4706
4714
|
async (v, f, w) => {
|
|
4707
|
-
var k,
|
|
4715
|
+
var k, E;
|
|
4708
4716
|
if (!t) {
|
|
4709
4717
|
v.preventDefault();
|
|
4710
4718
|
return;
|
|
@@ -4714,49 +4722,49 @@ function fo(e) {
|
|
|
4714
4722
|
return;
|
|
4715
4723
|
}
|
|
4716
4724
|
try {
|
|
4717
|
-
const I = String(f.url ?? ""),
|
|
4718
|
-
if (
|
|
4725
|
+
const I = String(f.url ?? ""), N = I.match(/\/chat\/files\/([^/]+)(?:\/(view|download))?/);
|
|
4726
|
+
if (N) {
|
|
4719
4727
|
v.preventDefault();
|
|
4720
|
-
const P =
|
|
4721
|
-
m({ id: P, name:
|
|
4728
|
+
const P = N[1], T = f.name || `file_${P}`, S = f.mimeType || "application/octet-stream";
|
|
4729
|
+
m({ id: P, name: T, mimeType: S });
|
|
4722
4730
|
return;
|
|
4723
4731
|
}
|
|
4724
4732
|
if (I.startsWith("data:")) {
|
|
4725
|
-
v.preventDefault(), a((
|
|
4733
|
+
v.preventDefault(), a((T) => ({ ...T, [w]: !0 }));
|
|
4726
4734
|
const P = o({ title: "Fetching file...", description: "", open: !0 });
|
|
4727
4735
|
try {
|
|
4728
|
-
const
|
|
4729
|
-
if (!
|
|
4736
|
+
const T = await r.listFiles(n ?? void 0);
|
|
4737
|
+
if (!T || !Array.isArray(T))
|
|
4730
4738
|
throw new Error("Invalid file list response");
|
|
4731
|
-
const
|
|
4732
|
-
if (!(
|
|
4739
|
+
const S = T.find((g) => !g || typeof g != "object" || !((g.filename ?? "") === (f.name ?? "")) ? !1 : typeof f.size == "number" && typeof g.size == "number" ? g.size === f.size : !0);
|
|
4740
|
+
if (!(S != null && S.id))
|
|
4733
4741
|
throw new Error(`File "${f.name}" is not yet available on the server`);
|
|
4734
|
-
if (!
|
|
4742
|
+
if (!S.id || !S.filename)
|
|
4735
4743
|
throw new Error("Invalid file data received from server");
|
|
4736
4744
|
m({
|
|
4737
|
-
id:
|
|
4738
|
-
name: f.name ||
|
|
4739
|
-
mimeType: f.mimeType ||
|
|
4745
|
+
id: S.id,
|
|
4746
|
+
name: f.name || S.filename || `file_${S.id}`,
|
|
4747
|
+
mimeType: f.mimeType || S.mime_type || "application/octet-stream"
|
|
4740
4748
|
}), (k = P.update) == null || k.call(P, {
|
|
4741
4749
|
id: P.id,
|
|
4742
4750
|
title: "Success",
|
|
4743
4751
|
description: `Opened ${f.name}`,
|
|
4744
4752
|
open: !0
|
|
4745
4753
|
});
|
|
4746
|
-
} catch (
|
|
4747
|
-
console.error("Failed to fetch server file:",
|
|
4748
|
-
const
|
|
4749
|
-
(
|
|
4754
|
+
} catch (T) {
|
|
4755
|
+
console.error("Failed to fetch server file:", T);
|
|
4756
|
+
const S = T instanceof Error ? T.message : "Unknown error occurred";
|
|
4757
|
+
(E = P.update) == null || E.call(P, { id: P.id, title: "Failed", description: S }), o({
|
|
4750
4758
|
title: "Failed to fetch file",
|
|
4751
|
-
description:
|
|
4759
|
+
description: S,
|
|
4752
4760
|
open: !0
|
|
4753
4761
|
});
|
|
4754
4762
|
} finally {
|
|
4755
|
-
a((
|
|
4763
|
+
a((T) => ({ ...T, [w]: !1 }));
|
|
4756
4764
|
}
|
|
4757
4765
|
}
|
|
4758
4766
|
} catch (I) {
|
|
4759
|
-
console.error("File click error:", I), a((
|
|
4767
|
+
console.error("File click error:", I), a((N) => ({ ...N, [w]: !1 }));
|
|
4760
4768
|
}
|
|
4761
4769
|
},
|
|
4762
4770
|
[t, s, o, n, m]
|
|
@@ -4811,16 +4819,16 @@ function Jr(e) {
|
|
|
4811
4819
|
function go(e) {
|
|
4812
4820
|
return Q(() => {
|
|
4813
4821
|
const t = e.content.filter(
|
|
4814
|
-
(
|
|
4822
|
+
(u) => u.type === "text"
|
|
4815
4823
|
);
|
|
4816
4824
|
if (!t.length)
|
|
4817
4825
|
return null;
|
|
4818
4826
|
let r = t.flatMap(
|
|
4819
|
-
(
|
|
4827
|
+
(u) => qr(u.text ?? "")
|
|
4820
4828
|
);
|
|
4821
4829
|
if (!r.length) {
|
|
4822
|
-
const
|
|
4823
|
-
`), c = tt(
|
|
4830
|
+
const u = t.map((l) => l.text ?? "").join(`
|
|
4831
|
+
`), c = tt(u);
|
|
4824
4832
|
c && typeof c == "object" && (r = [c]);
|
|
4825
4833
|
}
|
|
4826
4834
|
if (!r.length)
|
|
@@ -4842,8 +4850,8 @@ function go(e) {
|
|
|
4842
4850
|
}, [e]);
|
|
4843
4851
|
}
|
|
4844
4852
|
function Xr(e) {
|
|
4845
|
-
var
|
|
4846
|
-
const t = typeof e == "string" ? e : e == null ? void 0 : e.threadId, n = typeof e == "object" ? e.lazy : !1, r = ot({ optional: !0 }), o = Gt({ optional: !0 }), s = Fr(), { currentThreadId: a, setCurrentThreadId: i, actions:
|
|
4853
|
+
var O;
|
|
4854
|
+
const t = typeof e == "string" ? e : e == null ? void 0 : e.threadId, n = typeof e == "object" ? e.lazy : !1, r = ot({ optional: !0 }), o = Gt({ optional: !0 }), s = Fr(), { currentThreadId: a, setCurrentThreadId: i, actions: u } = r || {
|
|
4847
4855
|
currentThreadId: null,
|
|
4848
4856
|
setCurrentThreadId: () => {
|
|
4849
4857
|
},
|
|
@@ -4856,28 +4864,32 @@ function Xr(e) {
|
|
|
4856
4864
|
threadCheckpoints: f,
|
|
4857
4865
|
loadThread: w
|
|
4858
4866
|
} = Dt({
|
|
4859
|
-
api:
|
|
4860
|
-
fileApi:
|
|
4867
|
+
api: Ae().chatApi,
|
|
4868
|
+
fileApi: Ae().fileApi,
|
|
4861
4869
|
seed: m,
|
|
4862
4870
|
currentThreadId: c ? t : null,
|
|
4863
4871
|
initialThreadId: c ? t : null,
|
|
4864
4872
|
isStreaming: !1,
|
|
4865
4873
|
getMessages: () => l,
|
|
4866
4874
|
autoLoadInitial: c && !n
|
|
4867
|
-
})
|
|
4875
|
+
});
|
|
4876
|
+
q(() => {
|
|
4877
|
+
!c && !n && a && (o != null && o.loadThread) && o.loadThread(a);
|
|
4878
|
+
}, [c, n, a, o == null ? void 0 : o.loadThread]);
|
|
4879
|
+
const k = Q(() => {
|
|
4868
4880
|
var U;
|
|
4869
4881
|
return ((U = f[0]) == null ? void 0 : U.values) || {};
|
|
4870
|
-
}, [f]),
|
|
4882
|
+
}, [f]), E = Q(() => ({ timeline: [], messagePreviews: {} }), []), I = t || a, N = c ? h ? "loading" : "idle" : (o == null ? void 0 : o.status) || "idle", P = c ? l : (s == null ? void 0 : s.messages) || [], T = c ? h : (o == null ? void 0 : o.isLoading) || !1, S = c ? k : (o == null ? void 0 : o.values) || {}, g = c ? {} : (o == null ? void 0 : o.taskMessagesByScope) || {}, b = c ? v : (s == null ? void 0 : s.error) || (o == null ? void 0 : o.error) || null;
|
|
4871
4883
|
return {
|
|
4872
4884
|
// UNIFIED: Single thread ID concept
|
|
4873
4885
|
threadId: I,
|
|
4874
|
-
status:
|
|
4886
|
+
status: N,
|
|
4875
4887
|
messages: P,
|
|
4876
|
-
isLoading:
|
|
4877
|
-
isHistoryLoading:
|
|
4878
|
-
error:
|
|
4888
|
+
isLoading: T,
|
|
4889
|
+
isHistoryLoading: T,
|
|
4890
|
+
error: b,
|
|
4879
4891
|
// Values & Metadata
|
|
4880
|
-
values:
|
|
4892
|
+
values: S,
|
|
4881
4893
|
taskMessagesByScope: g,
|
|
4882
4894
|
metadata: c ? {} : o == null ? void 0 : o.metadata,
|
|
4883
4895
|
// Actions & State relating to Global/Active Thread only
|
|
@@ -4889,7 +4901,7 @@ function Xr(e) {
|
|
|
4889
4901
|
}),
|
|
4890
4902
|
checkpoint: c ? f[0] ? { id: f[0].checkpointId, namespace: f[0].checkpointNs } : null : (o == null ? void 0 : o.checkpoint) || null,
|
|
4891
4903
|
checkpoints: c ? f : (o == null ? void 0 : o.checkpoints) || [],
|
|
4892
|
-
checkpointIndex: c ?
|
|
4904
|
+
checkpointIndex: c ? E : (o == null ? void 0 : o.checkpointIndex) || { timeline: [], messagePreviews: {} },
|
|
4893
4905
|
interrupt: c ? null : (o == null ? void 0 : o.interrupt) || null,
|
|
4894
4906
|
respondToInterrupt: c ? async () => {
|
|
4895
4907
|
} : (o == null ? void 0 : o.respondToInterrupt) || (async () => {
|
|
@@ -4899,7 +4911,7 @@ function Xr(e) {
|
|
|
4899
4911
|
isStreaming: (s == null ? void 0 : s.isStreaming) || !1,
|
|
4900
4912
|
activeMessageId: (s == null ? void 0 : s.activeMessageId) || null,
|
|
4901
4913
|
connectionState: (s == null ? void 0 : s.connectionState) || "disconnected",
|
|
4902
|
-
streamingAssistantId: !c && (s != null && s.isStreaming) && ((
|
|
4914
|
+
streamingAssistantId: !c && (s != null && s.isStreaming) && ((O = o == null ? void 0 : o.metadata) != null && O.assemblingMessageId) ? o.metadata.assemblingMessageId : null,
|
|
4903
4915
|
// Actions
|
|
4904
4916
|
submit: (s == null ? void 0 : s.submit) || (async () => {
|
|
4905
4917
|
}),
|
|
@@ -4914,10 +4926,10 @@ function Xr(e) {
|
|
|
4914
4926
|
} : async () => {
|
|
4915
4927
|
},
|
|
4916
4928
|
// Thread Management
|
|
4917
|
-
createThread:
|
|
4918
|
-
deleteThread:
|
|
4919
|
-
renameThread:
|
|
4920
|
-
shareThread:
|
|
4929
|
+
createThread: u == null ? void 0 : u.createThread,
|
|
4930
|
+
deleteThread: u == null ? void 0 : u.deleteThread,
|
|
4931
|
+
renameThread: u == null ? void 0 : u.renameThread,
|
|
4932
|
+
shareThread: u == null ? void 0 : u.shareThread,
|
|
4921
4933
|
threads: (r == null ? void 0 : r.threads) || [],
|
|
4922
4934
|
isThreadsLoading: (r == null ? void 0 : r.isLoading) || !1
|
|
4923
4935
|
};
|
|
@@ -4931,42 +4943,42 @@ function mo({
|
|
|
4931
4943
|
onExcelUploadSuccess: s,
|
|
4932
4944
|
onError: a,
|
|
4933
4945
|
enableMessageEditing: i,
|
|
4934
|
-
messages:
|
|
4946
|
+
messages: u,
|
|
4935
4947
|
setPendingAssistantResponse: c,
|
|
4936
4948
|
project: l,
|
|
4937
4949
|
onEvent: p,
|
|
4938
4950
|
threadId: m,
|
|
4939
4951
|
clearComposerOnSend: h = !0
|
|
4940
4952
|
}) {
|
|
4941
|
-
const { messages: v } = Xr(), [f, w] = B(null), [k,
|
|
4953
|
+
const { messages: v } = Xr(), [f, w] = B(null), [k, E] = B(""), [I, N] = B(null), [P, T] = B(null), [S, g] = B(!1), [b, O] = B(""), U = H(b), C = H(null);
|
|
4942
4954
|
q(() => {
|
|
4943
4955
|
if (!f)
|
|
4944
4956
|
if (m) {
|
|
4945
|
-
const
|
|
4946
|
-
|
|
4957
|
+
const d = localStorage.getItem(qe(m));
|
|
4958
|
+
O(d || "");
|
|
4947
4959
|
} else
|
|
4948
|
-
|
|
4960
|
+
O("");
|
|
4949
4961
|
}, [m, f]);
|
|
4950
|
-
const
|
|
4951
|
-
|
|
4962
|
+
const M = z((d) => {
|
|
4963
|
+
O(d), !f && m && localStorage.setItem(qe(m), d);
|
|
4952
4964
|
}, [m, f]);
|
|
4953
4965
|
q(() => {
|
|
4954
|
-
U.current =
|
|
4955
|
-
}, [
|
|
4966
|
+
U.current = b;
|
|
4967
|
+
}, [b]), q(() => {
|
|
4956
4968
|
if (!f) {
|
|
4957
|
-
|
|
4969
|
+
C.current = null;
|
|
4958
4970
|
return;
|
|
4959
4971
|
}
|
|
4960
|
-
|
|
4961
|
-
}, [k, f,
|
|
4962
|
-
const
|
|
4963
|
-
(
|
|
4964
|
-
|
|
4972
|
+
C.current === null && (C.current = U.current), M(k ?? "");
|
|
4973
|
+
}, [k, f, M]);
|
|
4974
|
+
const L = z(
|
|
4975
|
+
(d) => {
|
|
4976
|
+
M(d);
|
|
4965
4977
|
},
|
|
4966
|
-
[
|
|
4967
|
-
),
|
|
4968
|
-
const _ = Array.isArray(x) ? { files: x } : x ?? {}, te = _.files ?? [], J = _.contentParts ?? [],
|
|
4969
|
-
if (!(!
|
|
4978
|
+
[M]
|
|
4979
|
+
), R = async (d, x) => {
|
|
4980
|
+
const _ = Array.isArray(x) ? { files: x } : x ?? {}, te = _.files ?? [], J = _.contentParts ?? [], G = d.trim();
|
|
4981
|
+
if (!(!G && te.length === 0 && J.length === 0))
|
|
4970
4982
|
try {
|
|
4971
4983
|
const Z = te.map(async (X) => {
|
|
4972
4984
|
try {
|
|
@@ -4975,7 +4987,7 @@ function mo({
|
|
|
4975
4987
|
} catch (Y) {
|
|
4976
4988
|
throw console.error("Failed to upload file", X.name, Y), new Error(`Failed to upload ${X.name}`);
|
|
4977
4989
|
}
|
|
4978
|
-
}),
|
|
4990
|
+
}), ue = (await Promise.all(Z)).map(({ record: X }) => {
|
|
4979
4991
|
const Y = X.mime_type;
|
|
4980
4992
|
return Y.startsWith("image/") ? {
|
|
4981
4993
|
type: "image_url",
|
|
@@ -4987,10 +4999,10 @@ function mo({
|
|
|
4987
4999
|
name: X.filename,
|
|
4988
5000
|
size: X.size
|
|
4989
5001
|
};
|
|
4990
|
-
}), W = [...J, ...
|
|
5002
|
+
}), W = [...J, ...ue], ee = f ? (I == null ? void 0 : I.checkpointId) ?? n ?? void 0 : n ?? void 0, ve = f ? (I == null ? void 0 : I.checkpointNs) ?? r ?? void 0 : r ?? void 0;
|
|
4991
5003
|
await e(
|
|
4992
5004
|
{
|
|
4993
|
-
text:
|
|
5005
|
+
text: G || "",
|
|
4994
5006
|
contentParts: W,
|
|
4995
5007
|
attachments: te,
|
|
4996
5008
|
payload: t.payload,
|
|
@@ -5002,18 +5014,18 @@ function mo({
|
|
|
5002
5014
|
config: t.config
|
|
5003
5015
|
},
|
|
5004
5016
|
p ? { onEvent: p } : void 0
|
|
5005
|
-
), o == null || o(
|
|
5017
|
+
), o == null || o(G), c(!0), h && (m && localStorage.removeItem(qe(m)), M("")), T(null), w(null), E(""), N(null);
|
|
5006
5018
|
} catch (Z) {
|
|
5007
5019
|
const ae = (Z == null ? void 0 : Z.message) || "Failed to send message";
|
|
5008
|
-
|
|
5020
|
+
T(ae), a == null || a(ae), c(!1);
|
|
5009
5021
|
}
|
|
5010
|
-
}, V = (
|
|
5011
|
-
x ||
|
|
5012
|
-
},
|
|
5013
|
-
async (
|
|
5022
|
+
}, V = (d, x) => {
|
|
5023
|
+
x || R(d, { files: [] });
|
|
5024
|
+
}, D = z(
|
|
5025
|
+
async (d) => {
|
|
5014
5026
|
await e(
|
|
5015
5027
|
{
|
|
5016
|
-
attachments: [
|
|
5028
|
+
attachments: [d],
|
|
5017
5029
|
payload: t.payload,
|
|
5018
5030
|
checkpointId: n ?? void 0,
|
|
5019
5031
|
checkpointNs: r ?? void 0,
|
|
@@ -5021,30 +5033,30 @@ function mo({
|
|
|
5021
5033
|
config: t.config
|
|
5022
5034
|
},
|
|
5023
5035
|
p ? { onEvent: p } : void 0
|
|
5024
|
-
), s == null || s({ file:
|
|
5036
|
+
), s == null || s({ file: d });
|
|
5025
5037
|
},
|
|
5026
5038
|
[n, r, t, s, e]
|
|
5027
|
-
),
|
|
5028
|
-
(
|
|
5029
|
-
i && (
|
|
5039
|
+
), A = z(
|
|
5040
|
+
(d, x, _) => {
|
|
5041
|
+
i && (C.current = b, w(d), E(x), N({
|
|
5030
5042
|
checkpointId: (_ == null ? void 0 : _.checkpointId) ?? null,
|
|
5031
5043
|
checkpointNs: (_ == null ? void 0 : _.checkpointNs) ?? null
|
|
5032
|
-
}),
|
|
5044
|
+
}), T(null));
|
|
5033
5045
|
},
|
|
5034
|
-
[
|
|
5035
|
-
),
|
|
5036
|
-
w(null),
|
|
5037
|
-
const
|
|
5038
|
-
|
|
5039
|
-
}, []),
|
|
5046
|
+
[b, i]
|
|
5047
|
+
), y = z(() => {
|
|
5048
|
+
w(null), E(""), N(null), T(null);
|
|
5049
|
+
const d = C.current;
|
|
5050
|
+
d !== null && O(d), C.current = null;
|
|
5051
|
+
}, []), F = z((d) => {
|
|
5040
5052
|
let x = null;
|
|
5041
|
-
for (let
|
|
5042
|
-
if (
|
|
5043
|
-
x =
|
|
5053
|
+
for (let G = d - 1; G >= 0; G--)
|
|
5054
|
+
if (u[G].role === "user") {
|
|
5055
|
+
x = u[G];
|
|
5044
5056
|
break;
|
|
5045
5057
|
}
|
|
5046
5058
|
if (!x) return;
|
|
5047
|
-
const _ = Array.isArray(x.content) ? x.content : [], J = _.filter((
|
|
5059
|
+
const _ = Array.isArray(x.content) ? x.content : [], J = _.filter((G) => (G == null ? void 0 : G.type) === "text").map((G) => G.text).join("") || (() => {
|
|
5048
5060
|
try {
|
|
5049
5061
|
return JSON.stringify(_, null, 2);
|
|
5050
5062
|
} catch {
|
|
@@ -5063,22 +5075,22 @@ function mo({
|
|
|
5063
5075
|
},
|
|
5064
5076
|
p ? { onEvent: p } : void 0
|
|
5065
5077
|
);
|
|
5066
|
-
}, [
|
|
5078
|
+
}, [u, e, n, r, t]);
|
|
5067
5079
|
return {
|
|
5068
5080
|
editingMessageId: f,
|
|
5069
5081
|
editingInitialValue: k,
|
|
5070
5082
|
inputError: P,
|
|
5071
|
-
setInputError:
|
|
5072
|
-
dismissError:
|
|
5083
|
+
setInputError: T,
|
|
5084
|
+
dismissError: S,
|
|
5073
5085
|
setDismissError: g,
|
|
5074
|
-
composerValue:
|
|
5075
|
-
handleComposerChange:
|
|
5076
|
-
handleSendMessage:
|
|
5086
|
+
composerValue: b,
|
|
5087
|
+
handleComposerChange: L,
|
|
5088
|
+
handleSendMessage: R,
|
|
5077
5089
|
handleQuickPrompt: V,
|
|
5078
|
-
handleExcelUpload:
|
|
5079
|
-
startEditing:
|
|
5080
|
-
cancelEditing:
|
|
5081
|
-
handleRegenerateCb:
|
|
5090
|
+
handleExcelUpload: D,
|
|
5091
|
+
startEditing: A,
|
|
5092
|
+
cancelEditing: y,
|
|
5093
|
+
handleRegenerateCb: F,
|
|
5082
5094
|
displayMessages: v
|
|
5083
5095
|
};
|
|
5084
5096
|
}
|
|
@@ -5133,17 +5145,17 @@ export {
|
|
|
5133
5145
|
ro as hasContent,
|
|
5134
5146
|
ht as hydrateHistorySnapshots,
|
|
5135
5147
|
Et as isFileLike,
|
|
5136
|
-
|
|
5148
|
+
Rn as looksLikeMarkdown,
|
|
5137
5149
|
io as messageSignature,
|
|
5138
5150
|
so as normalizeInterruptId,
|
|
5139
|
-
|
|
5151
|
+
Nt as onChatTokenChanged,
|
|
5140
5152
|
tt as parseJsonSafe,
|
|
5141
5153
|
Pt as pretty,
|
|
5142
|
-
|
|
5154
|
+
Ar as refreshHistoryFileUrls,
|
|
5143
5155
|
Ke as sanitizeForDisplay,
|
|
5144
5156
|
ke as setChatToken,
|
|
5145
5157
|
$n as stringifyTool,
|
|
5146
|
-
|
|
5158
|
+
Ae as useApi,
|
|
5147
5159
|
mo as useChatController,
|
|
5148
5160
|
Xr as useChatSession,
|
|
5149
5161
|
fo as useFilePreview,
|
|
@@ -5153,7 +5165,7 @@ export {
|
|
|
5153
5165
|
yo as useStreamingMarkdownBuffer,
|
|
5154
5166
|
Dt as useThreadHistoryState,
|
|
5155
5167
|
Gt as useThreadState,
|
|
5156
|
-
|
|
5168
|
+
Rr as useThreadStateUpdater,
|
|
5157
5169
|
ot as useThreads,
|
|
5158
5170
|
fr as useThreadsState,
|
|
5159
5171
|
go as useToolPayload
|