teodor-new-chat-ui 4.3.288 → 4.3.290
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 +384 -382
- package/dist/index.umd.js +14 -14
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -51,25 +51,25 @@ function Em() {
|
|
|
51
51
|
function y(R) {
|
|
52
52
|
if (R === null || typeof R != "object")
|
|
53
53
|
return null;
|
|
54
|
-
var
|
|
55
|
-
return typeof
|
|
54
|
+
var V = m && R[m] || R[x];
|
|
55
|
+
return typeof V == "function" ? V : null;
|
|
56
56
|
}
|
|
57
57
|
var g = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
58
58
|
function w(R) {
|
|
59
59
|
{
|
|
60
|
-
for (var
|
|
60
|
+
for (var V = arguments.length, le = new Array(V > 1 ? V - 1 : 0), Ee = 1; Ee < V; Ee++)
|
|
61
61
|
le[Ee - 1] = arguments[Ee];
|
|
62
62
|
b("error", R, le);
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
function b(R,
|
|
65
|
+
function b(R, V, le) {
|
|
66
66
|
{
|
|
67
67
|
var Ee = g.ReactDebugCurrentFrame, tt = Ee.getStackAddendum();
|
|
68
|
-
tt !== "" && (
|
|
68
|
+
tt !== "" && (V += "%s", le = le.concat([tt]));
|
|
69
69
|
var lt = le.map(function(Ke) {
|
|
70
70
|
return String(Ke);
|
|
71
71
|
});
|
|
72
|
-
lt.unshift("Warning: " +
|
|
72
|
+
lt.unshift("Warning: " + V), Function.prototype.apply.call(console[R], console, lt);
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
var T = !1, C = !1, S = !1, k = !1, E = !1, N;
|
|
@@ -81,11 +81,11 @@ function Em() {
|
|
|
81
81
|
// with.
|
|
82
82
|
R.$$typeof === N || R.getModuleId !== void 0));
|
|
83
83
|
}
|
|
84
|
-
function j(R,
|
|
84
|
+
function j(R, V, le) {
|
|
85
85
|
var Ee = R.displayName;
|
|
86
86
|
if (Ee)
|
|
87
87
|
return Ee;
|
|
88
|
-
var tt =
|
|
88
|
+
var tt = V.displayName || V.name || "";
|
|
89
89
|
return tt !== "" ? le + "(" + tt + ")" : le;
|
|
90
90
|
}
|
|
91
91
|
function P(R) {
|
|
@@ -115,8 +115,8 @@ function Em() {
|
|
|
115
115
|
if (typeof R == "object")
|
|
116
116
|
switch (R.$$typeof) {
|
|
117
117
|
case a:
|
|
118
|
-
var
|
|
119
|
-
return P(
|
|
118
|
+
var V = R;
|
|
119
|
+
return P(V) + ".Consumer";
|
|
120
120
|
case i:
|
|
121
121
|
var le = R;
|
|
122
122
|
return P(le._context) + ".Provider";
|
|
@@ -163,7 +163,7 @@ function Em() {
|
|
|
163
163
|
F++;
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
|
-
function
|
|
166
|
+
function q() {
|
|
167
167
|
{
|
|
168
168
|
if (F--, F === 0) {
|
|
169
169
|
var R = {
|
|
@@ -199,7 +199,7 @@ function Em() {
|
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
201
|
var oe = g.ReactCurrentDispatcher, Y;
|
|
202
|
-
function D(R,
|
|
202
|
+
function D(R, V, le) {
|
|
203
203
|
{
|
|
204
204
|
if (Y === void 0)
|
|
205
205
|
try {
|
|
@@ -217,7 +217,7 @@ function Em() {
|
|
|
217
217
|
var se = typeof WeakMap == "function" ? WeakMap : Map;
|
|
218
218
|
ne = new se();
|
|
219
219
|
}
|
|
220
|
-
function
|
|
220
|
+
function K(R, V) {
|
|
221
221
|
if (!R || H)
|
|
222
222
|
return "";
|
|
223
223
|
{
|
|
@@ -232,7 +232,7 @@ function Em() {
|
|
|
232
232
|
var lt;
|
|
233
233
|
lt = oe.current, oe.current = null, Ae();
|
|
234
234
|
try {
|
|
235
|
-
if (
|
|
235
|
+
if (V) {
|
|
236
236
|
var Ke = function() {
|
|
237
237
|
throw Error();
|
|
238
238
|
};
|
|
@@ -283,23 +283,23 @@ function Em() {
|
|
|
283
283
|
}
|
|
284
284
|
}
|
|
285
285
|
} finally {
|
|
286
|
-
H = !1, oe.current = lt,
|
|
286
|
+
H = !1, oe.current = lt, q(), Error.prepareStackTrace = tt;
|
|
287
287
|
}
|
|
288
288
|
var de = R ? R.displayName || R.name : "", fe = de ? D(de) : "";
|
|
289
289
|
return typeof R == "function" && ne.set(R, fe), fe;
|
|
290
290
|
}
|
|
291
|
-
function
|
|
292
|
-
return
|
|
291
|
+
function Me(R, V, le) {
|
|
292
|
+
return K(R, !1);
|
|
293
293
|
}
|
|
294
294
|
function Ue(R) {
|
|
295
|
-
var
|
|
296
|
-
return !!(
|
|
295
|
+
var V = R.prototype;
|
|
296
|
+
return !!(V && V.isReactComponent);
|
|
297
297
|
}
|
|
298
|
-
function Ze(R,
|
|
298
|
+
function Ze(R, V, le) {
|
|
299
299
|
if (R == null)
|
|
300
300
|
return "";
|
|
301
301
|
if (typeof R == "function")
|
|
302
|
-
return
|
|
302
|
+
return K(R, Ue(R));
|
|
303
303
|
if (typeof R == "string")
|
|
304
304
|
return D(R);
|
|
305
305
|
switch (R) {
|
|
@@ -311,28 +311,28 @@ function Em() {
|
|
|
311
311
|
if (typeof R == "object")
|
|
312
312
|
switch (R.$$typeof) {
|
|
313
313
|
case l:
|
|
314
|
-
return
|
|
314
|
+
return Me(R.render);
|
|
315
315
|
case f:
|
|
316
|
-
return Ze(R.type,
|
|
316
|
+
return Ze(R.type, V, le);
|
|
317
317
|
case p: {
|
|
318
318
|
var Ee = R, tt = Ee._payload, lt = Ee._init;
|
|
319
319
|
try {
|
|
320
|
-
return Ze(lt(tt),
|
|
320
|
+
return Ze(lt(tt), V, le);
|
|
321
321
|
} catch {
|
|
322
322
|
}
|
|
323
323
|
}
|
|
324
324
|
}
|
|
325
325
|
return "";
|
|
326
326
|
}
|
|
327
|
-
var re = Object.prototype.hasOwnProperty, me = {},
|
|
327
|
+
var re = Object.prototype.hasOwnProperty, me = {}, Le = g.ReactDebugCurrentFrame;
|
|
328
328
|
function Fe(R) {
|
|
329
329
|
if (R) {
|
|
330
|
-
var
|
|
331
|
-
|
|
330
|
+
var V = R._owner, le = Ze(R.type, R._source, V ? V.type : null);
|
|
331
|
+
Le.setExtraStackFrame(le);
|
|
332
332
|
} else
|
|
333
|
-
|
|
333
|
+
Le.setExtraStackFrame(null);
|
|
334
334
|
}
|
|
335
|
-
function Pe(R,
|
|
335
|
+
function Pe(R, V, le, Ee, tt) {
|
|
336
336
|
{
|
|
337
337
|
var lt = Function.call.bind(re);
|
|
338
338
|
for (var Ke in R)
|
|
@@ -343,7 +343,7 @@ function Em() {
|
|
|
343
343
|
var Pt = Error((Ee || "React class") + ": " + le + " type `" + Ke + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof R[Ke] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
344
344
|
throw Pt.name = "Invariant Violation", Pt;
|
|
345
345
|
}
|
|
346
|
-
Be = R[Ke](
|
|
346
|
+
Be = R[Ke](V, Ke, Ee, le, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
347
347
|
} catch (wt) {
|
|
348
348
|
Be = wt;
|
|
349
349
|
}
|
|
@@ -357,7 +357,7 @@ function Em() {
|
|
|
357
357
|
}
|
|
358
358
|
function Ge(R) {
|
|
359
359
|
{
|
|
360
|
-
var
|
|
360
|
+
var V = typeof Symbol == "function" && Symbol.toStringTag, le = V && R[Symbol.toStringTag] || R.constructor.name || "Object";
|
|
361
361
|
return le;
|
|
362
362
|
}
|
|
363
363
|
}
|
|
@@ -383,27 +383,27 @@ function Em() {
|
|
|
383
383
|
}, ft, it;
|
|
384
384
|
function Ve(R) {
|
|
385
385
|
if (re.call(R, "ref")) {
|
|
386
|
-
var
|
|
387
|
-
if (
|
|
386
|
+
var V = Object.getOwnPropertyDescriptor(R, "ref").get;
|
|
387
|
+
if (V && V.isReactWarning)
|
|
388
388
|
return !1;
|
|
389
389
|
}
|
|
390
390
|
return R.ref !== void 0;
|
|
391
391
|
}
|
|
392
392
|
function jt(R) {
|
|
393
393
|
if (re.call(R, "key")) {
|
|
394
|
-
var
|
|
395
|
-
if (
|
|
394
|
+
var V = Object.getOwnPropertyDescriptor(R, "key").get;
|
|
395
|
+
if (V && V.isReactWarning)
|
|
396
396
|
return !1;
|
|
397
397
|
}
|
|
398
398
|
return R.key !== void 0;
|
|
399
399
|
}
|
|
400
|
-
function Ct(R,
|
|
400
|
+
function Ct(R, V) {
|
|
401
401
|
typeof R.ref == "string" && mt.current;
|
|
402
402
|
}
|
|
403
|
-
function Zt(R,
|
|
403
|
+
function Zt(R, V) {
|
|
404
404
|
{
|
|
405
405
|
var le = function() {
|
|
406
|
-
ft || (ft = !0, w("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",
|
|
406
|
+
ft || (ft = !0, w("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", V));
|
|
407
407
|
};
|
|
408
408
|
le.isReactWarning = !0, Object.defineProperty(R, "key", {
|
|
409
409
|
get: le,
|
|
@@ -411,10 +411,10 @@ function Em() {
|
|
|
411
411
|
});
|
|
412
412
|
}
|
|
413
413
|
}
|
|
414
|
-
function ln(R,
|
|
414
|
+
function ln(R, V) {
|
|
415
415
|
{
|
|
416
416
|
var le = function() {
|
|
417
|
-
it || (it = !0, w("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",
|
|
417
|
+
it || (it = !0, w("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", V));
|
|
418
418
|
};
|
|
419
419
|
le.isReactWarning = !0, Object.defineProperty(R, "ref", {
|
|
420
420
|
get: le,
|
|
@@ -422,13 +422,13 @@ function Em() {
|
|
|
422
422
|
});
|
|
423
423
|
}
|
|
424
424
|
}
|
|
425
|
-
var Ye = function(R,
|
|
425
|
+
var Ye = function(R, V, le, Ee, tt, lt, Ke) {
|
|
426
426
|
var Be = {
|
|
427
427
|
// This tag allows us to uniquely identify this as a React Element
|
|
428
428
|
$$typeof: t,
|
|
429
429
|
// Built-in properties that belong on the element
|
|
430
430
|
type: R,
|
|
431
|
-
key:
|
|
431
|
+
key: V,
|
|
432
432
|
ref: le,
|
|
433
433
|
props: Ke,
|
|
434
434
|
// Record the component responsible for creating this element.
|
|
@@ -451,12 +451,12 @@ function Em() {
|
|
|
451
451
|
value: tt
|
|
452
452
|
}), Object.freeze && (Object.freeze(Be.props), Object.freeze(Be)), Be;
|
|
453
453
|
};
|
|
454
|
-
function _e(R,
|
|
454
|
+
function _e(R, V, le, Ee, tt) {
|
|
455
455
|
{
|
|
456
456
|
var lt, Ke = {}, Be = null, Pt = null;
|
|
457
|
-
le !== void 0 && (St(le), Be = "" + le), jt(
|
|
458
|
-
for (lt in
|
|
459
|
-
re.call(
|
|
457
|
+
le !== void 0 && (St(le), Be = "" + le), jt(V) && (St(V.key), Be = "" + V.key), Ve(V) && (Pt = V.ref, Ct(V, tt));
|
|
458
|
+
for (lt in V)
|
|
459
|
+
re.call(V, lt) && !gt.hasOwnProperty(lt) && (Ke[lt] = V[lt]);
|
|
460
460
|
if (R && R.defaultProps) {
|
|
461
461
|
var wt = R.defaultProps;
|
|
462
462
|
for (lt in wt)
|
|
@@ -472,7 +472,7 @@ function Em() {
|
|
|
472
472
|
var _t = g.ReactCurrentOwner, zt = g.ReactDebugCurrentFrame;
|
|
473
473
|
function B(R) {
|
|
474
474
|
if (R) {
|
|
475
|
-
var
|
|
475
|
+
var V = R._owner, le = Ze(R.type, R._source, V ? V.type : null);
|
|
476
476
|
zt.setExtraStackFrame(le);
|
|
477
477
|
} else
|
|
478
478
|
zt.setExtraStackFrame(null);
|
|
@@ -494,28 +494,28 @@ Check the render method of \`` + R + "`.";
|
|
|
494
494
|
return "";
|
|
495
495
|
}
|
|
496
496
|
}
|
|
497
|
-
function
|
|
497
|
+
function W(R) {
|
|
498
498
|
return "";
|
|
499
499
|
}
|
|
500
500
|
var ie = {};
|
|
501
501
|
function ee(R) {
|
|
502
502
|
{
|
|
503
|
-
var
|
|
504
|
-
if (!
|
|
503
|
+
var V = at();
|
|
504
|
+
if (!V) {
|
|
505
505
|
var le = typeof R == "string" ? R : R.displayName || R.name;
|
|
506
|
-
le && (
|
|
506
|
+
le && (V = `
|
|
507
507
|
|
|
508
508
|
Check the top-level render call using <` + le + ">.");
|
|
509
509
|
}
|
|
510
|
-
return
|
|
510
|
+
return V;
|
|
511
511
|
}
|
|
512
512
|
}
|
|
513
|
-
function Se(R,
|
|
513
|
+
function Se(R, V) {
|
|
514
514
|
{
|
|
515
515
|
if (!R._store || R._store.validated || R.key != null)
|
|
516
516
|
return;
|
|
517
517
|
R._store.validated = !0;
|
|
518
|
-
var le = ee(
|
|
518
|
+
var le = ee(V);
|
|
519
519
|
if (ie[le])
|
|
520
520
|
return;
|
|
521
521
|
ie[le] = !0;
|
|
@@ -523,14 +523,14 @@ Check the top-level render call using <` + le + ">.");
|
|
|
523
523
|
R && R._owner && R._owner !== _t.current && (Ee = " It was passed a child from " + $(R._owner.type) + "."), B(R), w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', le, Ee), B(null);
|
|
524
524
|
}
|
|
525
525
|
}
|
|
526
|
-
function ae(R,
|
|
526
|
+
function ae(R, V) {
|
|
527
527
|
{
|
|
528
528
|
if (typeof R != "object")
|
|
529
529
|
return;
|
|
530
530
|
if (We(R))
|
|
531
531
|
for (var le = 0; le < R.length; le++) {
|
|
532
532
|
var Ee = R[le];
|
|
533
|
-
ve(Ee) && Se(Ee,
|
|
533
|
+
ve(Ee) && Se(Ee, V);
|
|
534
534
|
}
|
|
535
535
|
else if (ve(R))
|
|
536
536
|
R._store && (R._store.validated = !0);
|
|
@@ -538,39 +538,39 @@ Check the top-level render call using <` + le + ">.");
|
|
|
538
538
|
var tt = y(R);
|
|
539
539
|
if (typeof tt == "function" && tt !== R.entries)
|
|
540
540
|
for (var lt = tt.call(R), Ke; !(Ke = lt.next()).done; )
|
|
541
|
-
ve(Ke.value) && Se(Ke.value,
|
|
541
|
+
ve(Ke.value) && Se(Ke.value, V);
|
|
542
542
|
}
|
|
543
543
|
}
|
|
544
544
|
}
|
|
545
545
|
function Te(R) {
|
|
546
546
|
{
|
|
547
|
-
var
|
|
548
|
-
if (
|
|
547
|
+
var V = R.type;
|
|
548
|
+
if (V == null || typeof V == "string")
|
|
549
549
|
return;
|
|
550
550
|
var le;
|
|
551
|
-
if (typeof
|
|
552
|
-
le =
|
|
553
|
-
else if (typeof
|
|
551
|
+
if (typeof V == "function")
|
|
552
|
+
le = V.propTypes;
|
|
553
|
+
else if (typeof V == "object" && (V.$$typeof === l || // Note: Memo only checks outer props here.
|
|
554
554
|
// Inner props are checked in the reconciler.
|
|
555
|
-
|
|
556
|
-
le =
|
|
555
|
+
V.$$typeof === f))
|
|
556
|
+
le = V.propTypes;
|
|
557
557
|
else
|
|
558
558
|
return;
|
|
559
559
|
if (le) {
|
|
560
|
-
var Ee = $(
|
|
560
|
+
var Ee = $(V);
|
|
561
561
|
Pe(le, R.props, "prop", Ee, R);
|
|
562
|
-
} else if (
|
|
562
|
+
} else if (V.PropTypes !== void 0 && !ye) {
|
|
563
563
|
ye = !0;
|
|
564
|
-
var tt = $(
|
|
564
|
+
var tt = $(V);
|
|
565
565
|
w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", tt || "Unknown");
|
|
566
566
|
}
|
|
567
|
-
typeof
|
|
567
|
+
typeof V.getDefaultProps == "function" && !V.getDefaultProps.isReactClassApproved && w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
568
568
|
}
|
|
569
569
|
}
|
|
570
570
|
function Ut(R) {
|
|
571
571
|
{
|
|
572
|
-
for (var
|
|
573
|
-
var Ee =
|
|
572
|
+
for (var V = Object.keys(R.props), le = 0; le < V.length; le++) {
|
|
573
|
+
var Ee = V[le];
|
|
574
574
|
if (Ee !== "children" && Ee !== "key") {
|
|
575
575
|
B(R), w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", Ee), B(null);
|
|
576
576
|
break;
|
|
@@ -580,22 +580,22 @@ Check the top-level render call using <` + le + ">.");
|
|
|
580
580
|
}
|
|
581
581
|
}
|
|
582
582
|
var Tt = {};
|
|
583
|
-
function cn(R,
|
|
583
|
+
function cn(R, V, le, Ee, tt, lt) {
|
|
584
584
|
{
|
|
585
585
|
var Ke = M(R);
|
|
586
586
|
if (!Ke) {
|
|
587
587
|
var Be = "";
|
|
588
588
|
(R === void 0 || typeof R == "object" && R !== null && Object.keys(R).length === 0) && (Be += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
589
|
-
var Pt =
|
|
589
|
+
var Pt = W();
|
|
590
590
|
Pt ? Be += Pt : Be += at();
|
|
591
591
|
var wt;
|
|
592
592
|
R === null ? wt = "null" : We(R) ? wt = "array" : R !== void 0 && R.$$typeof === t ? (wt = "<" + ($(R.type) || "Unknown") + " />", Be = " Did you accidentally export a JSX literal instead of a component?") : wt = typeof R, w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", wt, Be);
|
|
593
593
|
}
|
|
594
|
-
var bt = _e(R,
|
|
594
|
+
var bt = _e(R, V, le, tt, lt);
|
|
595
595
|
if (bt == null)
|
|
596
596
|
return bt;
|
|
597
597
|
if (Ke) {
|
|
598
|
-
var Q =
|
|
598
|
+
var Q = V.children;
|
|
599
599
|
if (Q !== void 0)
|
|
600
600
|
if (Ee)
|
|
601
601
|
if (We(Q)) {
|
|
@@ -607,8 +607,8 @@ Check the top-level render call using <` + le + ">.");
|
|
|
607
607
|
else
|
|
608
608
|
ae(Q, R);
|
|
609
609
|
}
|
|
610
|
-
if (re.call(
|
|
611
|
-
var fe = $(R), be = Object.keys(
|
|
610
|
+
if (re.call(V, "key")) {
|
|
611
|
+
var fe = $(R), be = Object.keys(V).filter(function(un) {
|
|
612
612
|
return un !== "key";
|
|
613
613
|
}), ct = be.length > 0 ? "{key: someKey, " + be.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
614
614
|
if (!Tt[fe + ct]) {
|
|
@@ -624,11 +624,11 @@ React keys must be passed directly to JSX without using spread:
|
|
|
624
624
|
return R === r ? Ut(bt) : Te(bt), bt;
|
|
625
625
|
}
|
|
626
626
|
}
|
|
627
|
-
function kt(R,
|
|
628
|
-
return cn(R,
|
|
627
|
+
function kt(R, V, le) {
|
|
628
|
+
return cn(R, V, le, !0);
|
|
629
629
|
}
|
|
630
|
-
function Mn(R,
|
|
631
|
-
return cn(R,
|
|
630
|
+
function Mn(R, V, le) {
|
|
631
|
+
return cn(R, V, le, !1);
|
|
632
632
|
}
|
|
633
633
|
var Zs = Mn, vo = kt;
|
|
634
634
|
Dr.Fragment = r, Dr.jsx = Zs, Dr.jsxs = vo;
|
|
@@ -874,10 +874,10 @@ const lg = (e) => {
|
|
|
874
874
|
asap: dg,
|
|
875
875
|
isIterable: fg
|
|
876
876
|
};
|
|
877
|
-
function
|
|
877
|
+
function De(e, t, n, r, o) {
|
|
878
878
|
Error.call(this), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack, this.message = e, this.name = "AxiosError", t && (this.code = t), n && (this.config = n), r && (this.request = r), o && (this.response = o, this.status = o.status ? o.status : null);
|
|
879
879
|
}
|
|
880
|
-
O.inherits(
|
|
880
|
+
O.inherits(De, Error, {
|
|
881
881
|
toJSON: function() {
|
|
882
882
|
return {
|
|
883
883
|
// Standard
|
|
@@ -898,7 +898,7 @@ O.inherits(Me, Error, {
|
|
|
898
898
|
};
|
|
899
899
|
}
|
|
900
900
|
});
|
|
901
|
-
const eu =
|
|
901
|
+
const eu = De.prototype, tu = {};
|
|
902
902
|
[
|
|
903
903
|
"ERR_BAD_OPTION_VALUE",
|
|
904
904
|
"ERR_BAD_OPTION",
|
|
@@ -916,15 +916,15 @@ const eu = Me.prototype, tu = {};
|
|
|
916
916
|
].forEach((e) => {
|
|
917
917
|
tu[e] = { value: e };
|
|
918
918
|
});
|
|
919
|
-
Object.defineProperties(
|
|
919
|
+
Object.defineProperties(De, tu);
|
|
920
920
|
Object.defineProperty(eu, "isAxiosError", { value: !0 });
|
|
921
|
-
|
|
921
|
+
De.from = (e, t, n, r, o, s) => {
|
|
922
922
|
const i = Object.create(eu);
|
|
923
923
|
O.toFlatObject(e, i, function(d) {
|
|
924
924
|
return d !== Error.prototype;
|
|
925
925
|
}, (c) => c !== "isAxiosError");
|
|
926
926
|
const a = e && e.message ? e.message : "Error", l = t == null && e ? e.code : t;
|
|
927
|
-
return
|
|
927
|
+
return De.call(i, a, l, n, r, o), e && i.cause == null && Object.defineProperty(i, "cause", { value: e, configurable: !0 }), i.name = e && e.name || "Error", s && Object.assign(i, s), i;
|
|
928
928
|
};
|
|
929
929
|
const pg = null;
|
|
930
930
|
function Ni(e) {
|
|
@@ -964,7 +964,7 @@ function bs(e, t, n) {
|
|
|
964
964
|
if (O.isBoolean(m))
|
|
965
965
|
return m.toString();
|
|
966
966
|
if (!l && O.isBlob(m))
|
|
967
|
-
throw new
|
|
967
|
+
throw new De("Blob is not supported. Use a Buffer instead.");
|
|
968
968
|
return O.isArrayBuffer(m) || O.isTypedArray(m) ? l && typeof Blob == "function" ? new Blob([m]) : Buffer.from(m) : m;
|
|
969
969
|
}
|
|
970
970
|
function d(m, x, y) {
|
|
@@ -1215,7 +1215,7 @@ const uo = {
|
|
|
1215
1215
|
return JSON.parse(t, this.parseReviver);
|
|
1216
1216
|
} catch (a) {
|
|
1217
1217
|
if (i)
|
|
1218
|
-
throw a.name === "SyntaxError" ?
|
|
1218
|
+
throw a.name === "SyntaxError" ? De.from(a, De.ERR_BAD_RESPONSE, this, null, this.response) : a;
|
|
1219
1219
|
}
|
|
1220
1220
|
}
|
|
1221
1221
|
return t;
|
|
@@ -1458,16 +1458,16 @@ function au(e) {
|
|
|
1458
1458
|
return !!(e && e.__CANCEL__);
|
|
1459
1459
|
}
|
|
1460
1460
|
function Er(e, t, n) {
|
|
1461
|
-
|
|
1461
|
+
De.call(this, e ?? "canceled", De.ERR_CANCELED, t, n), this.name = "CanceledError";
|
|
1462
1462
|
}
|
|
1463
|
-
O.inherits(Er,
|
|
1463
|
+
O.inherits(Er, De, {
|
|
1464
1464
|
__CANCEL__: !0
|
|
1465
1465
|
});
|
|
1466
1466
|
function lu(e, t, n) {
|
|
1467
1467
|
const r = n.config.validateStatus;
|
|
1468
|
-
!n.status || !r || r(n.status) ? e(n) : t(new
|
|
1468
|
+
!n.status || !r || r(n.status) ? e(n) : t(new De(
|
|
1469
1469
|
"Request failed with status code " + n.status,
|
|
1470
|
-
[
|
|
1470
|
+
[De.ERR_BAD_REQUEST, De.ERR_BAD_RESPONSE][Math.floor(n.status / 100) - 4],
|
|
1471
1471
|
n.config,
|
|
1472
1472
|
n.request,
|
|
1473
1473
|
n
|
|
@@ -1690,16 +1690,16 @@ const uu = (e) => {
|
|
|
1690
1690
|
"onloadend" in y ? y.onloadend = g : y.onreadystatechange = function() {
|
|
1691
1691
|
!y || y.readyState !== 4 || y.status === 0 && !(y.responseURL && y.responseURL.indexOf("file:") === 0) || setTimeout(g);
|
|
1692
1692
|
}, y.onabort = function() {
|
|
1693
|
-
y && (r(new
|
|
1693
|
+
y && (r(new De("Request aborted", De.ECONNABORTED, e, y)), y = null);
|
|
1694
1694
|
}, y.onerror = function(T) {
|
|
1695
|
-
const C = T && T.message ? T.message : "Network Error", S = new
|
|
1695
|
+
const C = T && T.message ? T.message : "Network Error", S = new De(C, De.ERR_NETWORK, e, y);
|
|
1696
1696
|
S.event = T || null, r(S), y = null;
|
|
1697
1697
|
}, y.ontimeout = function() {
|
|
1698
1698
|
let T = o.timeout ? "timeout of " + o.timeout + "ms exceeded" : "timeout exceeded";
|
|
1699
1699
|
const C = o.transitional || su;
|
|
1700
|
-
o.timeoutErrorMessage && (T = o.timeoutErrorMessage), r(new
|
|
1700
|
+
o.timeoutErrorMessage && (T = o.timeoutErrorMessage), r(new De(
|
|
1701
1701
|
T,
|
|
1702
|
-
C.clarifyTimeoutError ?
|
|
1702
|
+
C.clarifyTimeoutError ? De.ETIMEDOUT : De.ECONNABORTED,
|
|
1703
1703
|
e,
|
|
1704
1704
|
y
|
|
1705
1705
|
)), y = null;
|
|
@@ -1710,7 +1710,7 @@ const uu = (e) => {
|
|
|
1710
1710
|
}, o.cancelToken && o.cancelToken.subscribe(d), o.signal && (o.signal.aborted ? d() : o.signal.addEventListener("abort", d)));
|
|
1711
1711
|
const w = Mg(o.url);
|
|
1712
1712
|
if (w && Lt.protocols.indexOf(w) === -1) {
|
|
1713
|
-
r(new
|
|
1713
|
+
r(new De("Unsupported protocol " + w + ":", De.ERR_BAD_REQUEST, e));
|
|
1714
1714
|
return;
|
|
1715
1715
|
}
|
|
1716
1716
|
y.send(s || null);
|
|
@@ -1723,11 +1723,11 @@ const uu = (e) => {
|
|
|
1723
1723
|
if (!o) {
|
|
1724
1724
|
o = !0, a();
|
|
1725
1725
|
const d = c instanceof Error ? c : this.reason;
|
|
1726
|
-
r.abort(d instanceof
|
|
1726
|
+
r.abort(d instanceof De ? d : new Er(d instanceof Error ? d.message : d));
|
|
1727
1727
|
}
|
|
1728
1728
|
};
|
|
1729
1729
|
let i = t && setTimeout(() => {
|
|
1730
|
-
i = null, s(new
|
|
1730
|
+
i = null, s(new De(`timeout ${t} of ms exceeded`, De.ETIMEDOUT));
|
|
1731
1731
|
}, t);
|
|
1732
1732
|
const a = () => {
|
|
1733
1733
|
e && (i && clearTimeout(i), i = null, e.forEach((c) => {
|
|
@@ -1832,7 +1832,7 @@ const uu = (e) => {
|
|
|
1832
1832
|
let g = x && x[m];
|
|
1833
1833
|
if (g)
|
|
1834
1834
|
return g.call(x);
|
|
1835
|
-
throw new
|
|
1835
|
+
throw new De(`Response type '${m}' is not supported`, De.ERR_NOT_SUPPORT, y);
|
|
1836
1836
|
});
|
|
1837
1837
|
});
|
|
1838
1838
|
const p = async (m) => {
|
|
@@ -1904,8 +1904,8 @@ const uu = (e) => {
|
|
|
1904
1904
|
const _ = d && (k === "stream" || k === "response");
|
|
1905
1905
|
if (d && (C || _ && I)) {
|
|
1906
1906
|
const G = {};
|
|
1907
|
-
["status", "statusText", "headers"].forEach((
|
|
1908
|
-
G[
|
|
1907
|
+
["status", "statusText", "headers"].forEach((q) => {
|
|
1908
|
+
G[q] = L[q];
|
|
1909
1909
|
});
|
|
1910
1910
|
const pe = O.toFiniteNumber(L.headers.get("content-length")), [Re, Ae] = C && pl(
|
|
1911
1911
|
pe,
|
|
@@ -1932,11 +1932,11 @@ const uu = (e) => {
|
|
|
1932
1932
|
});
|
|
1933
1933
|
} catch (A) {
|
|
1934
1934
|
throw I && I(), A && A.name === "TypeError" && /Load failed|fetch/i.test(A.message) ? Object.assign(
|
|
1935
|
-
new
|
|
1935
|
+
new De("Network Error", De.ERR_NETWORK, m, $),
|
|
1936
1936
|
{
|
|
1937
1937
|
cause: A.cause || A
|
|
1938
1938
|
}
|
|
1939
|
-
) :
|
|
1939
|
+
) : De.from(A, A && A.code, m, $);
|
|
1940
1940
|
}
|
|
1941
1941
|
};
|
|
1942
1942
|
}, Xg = /* @__PURE__ */ new Map(), du = (e) => {
|
|
@@ -1978,7 +1978,7 @@ const bl = (e) => `- ${e}`, Jg = (e) => O.isFunction(e) || e === null || e === !
|
|
|
1978
1978
|
r = e[i];
|
|
1979
1979
|
let a;
|
|
1980
1980
|
if (o = r, !Jg(r) && (o = _i[(a = String(r)).toLowerCase()], o === void 0))
|
|
1981
|
-
throw new
|
|
1981
|
+
throw new De(`Unknown adapter '${a}'`);
|
|
1982
1982
|
if (o && (O.isFunction(o) || (o = o.get(t))))
|
|
1983
1983
|
break;
|
|
1984
1984
|
s[a || "#" + i] = o;
|
|
@@ -1990,7 +1990,7 @@ const bl = (e) => `- ${e}`, Jg = (e) => O.isFunction(e) || e === null || e === !
|
|
|
1990
1990
|
let a = n ? i.length > 1 ? `since :
|
|
1991
1991
|
` + i.map(bl).join(`
|
|
1992
1992
|
`) : " " + bl(i[0]) : "as no adapter specified";
|
|
1993
|
-
throw new
|
|
1993
|
+
throw new De(
|
|
1994
1994
|
"There is no suitable adapter to dispatch the request " + a,
|
|
1995
1995
|
"ERR_NOT_SUPPORT"
|
|
1996
1996
|
);
|
|
@@ -2034,9 +2034,9 @@ Ss.transitional = function(t, n, r) {
|
|
|
2034
2034
|
}
|
|
2035
2035
|
return (s, i, a) => {
|
|
2036
2036
|
if (t === !1)
|
|
2037
|
-
throw new
|
|
2037
|
+
throw new De(
|
|
2038
2038
|
o(i, " has been removed" + (n ? " in " + n : "")),
|
|
2039
|
-
|
|
2039
|
+
De.ERR_DEPRECATED
|
|
2040
2040
|
);
|
|
2041
2041
|
return n && !Cl[i] && (Cl[i] = !0, console.warn(
|
|
2042
2042
|
o(
|
|
@@ -2051,7 +2051,7 @@ Ss.spelling = function(t) {
|
|
|
2051
2051
|
};
|
|
2052
2052
|
function Zg(e, t, n) {
|
|
2053
2053
|
if (typeof e != "object")
|
|
2054
|
-
throw new
|
|
2054
|
+
throw new De("options must be an object", De.ERR_BAD_OPTION_VALUE);
|
|
2055
2055
|
const r = Object.keys(e);
|
|
2056
2056
|
let o = r.length;
|
|
2057
2057
|
for (; o-- > 0; ) {
|
|
@@ -2059,11 +2059,11 @@ function Zg(e, t, n) {
|
|
|
2059
2059
|
if (i) {
|
|
2060
2060
|
const a = e[s], l = a === void 0 || i(a, s, e);
|
|
2061
2061
|
if (l !== !0)
|
|
2062
|
-
throw new
|
|
2062
|
+
throw new De("option " + s + " must be " + l, De.ERR_BAD_OPTION_VALUE);
|
|
2063
2063
|
continue;
|
|
2064
2064
|
}
|
|
2065
2065
|
if (n !== !0)
|
|
2066
|
-
throw new
|
|
2066
|
+
throw new De("Unknown option " + s, De.ERR_BAD_OPTION);
|
|
2067
2067
|
}
|
|
2068
2068
|
}
|
|
2069
2069
|
const Do = {
|
|
@@ -2356,7 +2356,7 @@ It.CancelToken = Qg;
|
|
|
2356
2356
|
It.isCancel = au;
|
|
2357
2357
|
It.VERSION = pu;
|
|
2358
2358
|
It.toFormData = bs;
|
|
2359
|
-
It.AxiosError =
|
|
2359
|
+
It.AxiosError = De;
|
|
2360
2360
|
It.Cancel = It.CanceledError;
|
|
2361
2361
|
It.all = function(t) {
|
|
2362
2362
|
return Promise.all(t);
|
|
@@ -3048,7 +3048,7 @@ function Ox(e = {}) {
|
|
|
3048
3048
|
threadId: I.threadId ?? null,
|
|
3049
3049
|
headers: {}
|
|
3050
3050
|
}, (async () => {
|
|
3051
|
-
var pe, Re, Ae,
|
|
3051
|
+
var pe, Re, Ae, q, oe, Y, D, H, ne, se, K, Me, Ue, Ze, re, me, Le, Fe;
|
|
3052
3052
|
const G = (Pe) => {
|
|
3053
3053
|
var et;
|
|
3054
3054
|
try {
|
|
@@ -3087,7 +3087,7 @@ function Ox(e = {}) {
|
|
|
3087
3087
|
let et = {};
|
|
3088
3088
|
if (typeof window < "u")
|
|
3089
3089
|
try {
|
|
3090
|
-
const Ye = (
|
|
3090
|
+
const Ye = (q = window.localStorage) == null ? void 0 : q.getItem("authSessionId");
|
|
3091
3091
|
Ye && (et = { "X-Session-Id": Ye });
|
|
3092
3092
|
} catch {
|
|
3093
3093
|
}
|
|
@@ -3153,13 +3153,13 @@ function Ox(e = {}) {
|
|
|
3153
3153
|
`)) >= 0; ) {
|
|
3154
3154
|
const at = mt.slice(0, ve);
|
|
3155
3155
|
mt = mt.slice(ve + 2);
|
|
3156
|
-
const
|
|
3157
|
-
if (!
|
|
3156
|
+
const W = Dx(at);
|
|
3157
|
+
if (!W) continue;
|
|
3158
3158
|
let ie;
|
|
3159
3159
|
try {
|
|
3160
|
-
ie = JSON.parse(
|
|
3160
|
+
ie = JSON.parse(W);
|
|
3161
3161
|
} catch {
|
|
3162
|
-
console.debug("[use-chat] malformed SSE:",
|
|
3162
|
+
console.debug("[use-chat] malformed SSE:", W.slice(0, 200));
|
|
3163
3163
|
continue;
|
|
3164
3164
|
}
|
|
3165
3165
|
const ee = Mx(ie) ? ie.data : ie;
|
|
@@ -3215,7 +3215,7 @@ function Ox(e = {}) {
|
|
|
3215
3215
|
m(ee.checkpointId);
|
|
3216
3216
|
else if (ee.type === "error") {
|
|
3217
3217
|
const ae = ee;
|
|
3218
|
-
if (d(ae.message), L = "error", _ = ae.message, ae.error_type === "auth_error" || ae.code === "TOKEN_EXPIRED" || ((ne = ae.message) == null ? void 0 : ne.includes("token")) || ((se = ae.message) == null ? void 0 : se.includes("401")) || ((
|
|
3218
|
+
if (d(ae.message), L = "error", _ = ae.message, ae.error_type === "auth_error" || ae.code === "TOKEN_EXPIRED" || ((ne = ae.message) == null ? void 0 : ne.includes("token")) || ((se = ae.message) == null ? void 0 : se.includes("401")) || ((K = ae.message) == null ? void 0 : K.includes("unauthorized")) || ((Me = ae.message) == null ? void 0 : Me.includes("Unauthorized"))) {
|
|
3219
3219
|
console.error("[use-chat] Auth error detected:", ae.message);
|
|
3220
3220
|
try {
|
|
3221
3221
|
(Ue = A == null ? void 0 : A.onAuthError) == null || Ue.call(A, ae.message);
|
|
@@ -3249,7 +3249,7 @@ function Ox(e = {}) {
|
|
|
3249
3249
|
L = L ?? "aborted";
|
|
3250
3250
|
else {
|
|
3251
3251
|
const et = Pe.message || String(Pe);
|
|
3252
|
-
L = "error", _ = et, d(et), (me = A == null ? void 0 : A.onError) == null || me.call(A, et), J || ((
|
|
3252
|
+
L = "error", _ = et, d(et), (me = A == null ? void 0 : A.onError) == null || me.call(A, et), J || ((Le = A == null ? void 0 : A.onConnectionError) == null || Le.call(A, et), J = !0);
|
|
3253
3253
|
}
|
|
3254
3254
|
} finally {
|
|
3255
3255
|
const Pe = C.current, et = k.current, We = E.current, Ge = N.current, qe = L ?? (X.signal.aborted ? "aborted" : _ ? "error" : "complete");
|
|
@@ -3966,66 +3966,66 @@ function qx({
|
|
|
3966
3966
|
onThreadChange: a,
|
|
3967
3967
|
checkpointMetadataCache: l
|
|
3968
3968
|
}) {
|
|
3969
|
-
const { api: c, baseUrl: d } = xu(), f = rt(() => _n(d), [d]), [p, h] = we([]), [m, x] = we(t), [y, g] = we(!1), [w, b] = we(null), [T, C] = we(!1), [S, k] = we(null), { state: E, seed: N, prepend: M, pushUser: j, onEvent: P } = zx(), [$, I] = we(!1), [F, A] = we(!1), [X, L] = we(null), [_, J] = we([]), [G, pe] = we([]), [Re, Ae] = we(!1),
|
|
3970
|
-
(
|
|
3971
|
-
if (!
|
|
3969
|
+
const { api: c, baseUrl: d } = xu(), f = rt(() => _n(d), [d]), [p, h] = we([]), [m, x] = we(t), [y, g] = we(!1), [w, b] = we(null), [T, C] = we(!1), [S, k] = we(null), { state: E, seed: N, prepend: M, pushUser: j, onEvent: P } = zx(), [$, I] = we(!1), [F, A] = we(!1), [X, L] = we(null), [_, J] = we([]), [G, pe] = we([]), [Re, Ae] = we(!1), q = ke(
|
|
3970
|
+
(W) => {
|
|
3971
|
+
if (!W.length) return;
|
|
3972
3972
|
const ie = new Set(
|
|
3973
|
-
|
|
3973
|
+
W.map((ee) => ee.checkpointId).filter((ee) => !!(ee != null && ee.trim()))
|
|
3974
3974
|
);
|
|
3975
3975
|
J((ee) => [...ee.filter((ae) => {
|
|
3976
3976
|
const Te = ae.checkpointId;
|
|
3977
3977
|
return Te ? !ie.has(Te) : !0;
|
|
3978
|
-
}), ...
|
|
3978
|
+
}), ...W]);
|
|
3979
3979
|
},
|
|
3980
3980
|
[]
|
|
3981
|
-
), oe = ke((
|
|
3982
|
-
if (!
|
|
3983
|
-
const ie = new Set(
|
|
3984
|
-
pe((ee) => [...ee.filter((ae) => !ie.has(ae.id)), ...
|
|
3981
|
+
), oe = ke((W) => {
|
|
3982
|
+
if (!W.length) return;
|
|
3983
|
+
const ie = new Set(W.map((ee) => ee.id));
|
|
3984
|
+
pe((ee) => [...ee.filter((ae) => !ie.has(ae.id)), ...W]);
|
|
3985
3985
|
}, []), Y = rt(
|
|
3986
|
-
() => _.flatMap((
|
|
3986
|
+
() => _.flatMap((W) => W.messages ?? []),
|
|
3987
3987
|
[_]
|
|
3988
3988
|
), D = rt(() => Px(Y), [Y]), H = l ?? Kx(), { setCacheForThread: ne } = H, se = ke(
|
|
3989
|
-
(
|
|
3989
|
+
(W, ie, ee) => {
|
|
3990
3990
|
const Se = ie.filter((ae) => ae.checkpointId).map((ae) => ({
|
|
3991
3991
|
checkpointId: ae.checkpointId,
|
|
3992
3992
|
checkpointNs: ae.checkpointNs ?? void 0,
|
|
3993
3993
|
createdAt: ae.createdAt ?? ""
|
|
3994
3994
|
}));
|
|
3995
|
-
console.log(`[ChatSessionProvider] Cached metadata for ${Se.length} checkpoints from ${ee}`), ne(
|
|
3995
|
+
console.log(`[ChatSessionProvider] Cached metadata for ${Se.length} checkpoints from ${ee}`), ne(W, Se);
|
|
3996
3996
|
},
|
|
3997
3997
|
[ne]
|
|
3998
|
-
),
|
|
3998
|
+
), K = He(m), Me = He(null), Ue = He(null), Ze = He(null), re = He(null), me = He(!1), Le = He(null), Fe = He(/* @__PURE__ */ new Map());
|
|
3999
3999
|
Et(() => {
|
|
4000
|
-
|
|
4000
|
+
K.current = m;
|
|
4001
4001
|
}, [m]);
|
|
4002
4002
|
const Pe = ke(async () => {
|
|
4003
4003
|
g(!0), b(null);
|
|
4004
4004
|
try {
|
|
4005
|
-
const
|
|
4006
|
-
h(
|
|
4007
|
-
} catch (
|
|
4008
|
-
const ie = String(
|
|
4005
|
+
const W = await c.listThreads();
|
|
4006
|
+
h(W ?? []);
|
|
4007
|
+
} catch (W) {
|
|
4008
|
+
const ie = String(W);
|
|
4009
4009
|
b(ie), s == null || s(ie);
|
|
4010
4010
|
} finally {
|
|
4011
4011
|
g(!1);
|
|
4012
4012
|
}
|
|
4013
|
-
}, [c, s]), et = ke((
|
|
4014
|
-
if (!(
|
|
4013
|
+
}, [c, s]), et = ke((W) => {
|
|
4014
|
+
if (!(W != null && W.threadId)) return;
|
|
4015
4015
|
const ie = {
|
|
4016
|
-
threadId:
|
|
4017
|
-
title:
|
|
4018
|
-
createdAt:
|
|
4019
|
-
updatedAt:
|
|
4020
|
-
messageCount:
|
|
4016
|
+
threadId: W.threadId,
|
|
4017
|
+
title: W.title || `Thread ${W.threadId.slice(0, 8)}`,
|
|
4018
|
+
createdAt: W.createdAt || (/* @__PURE__ */ new Date()).toISOString(),
|
|
4019
|
+
updatedAt: W.updatedAt || (/* @__PURE__ */ new Date()).toISOString(),
|
|
4020
|
+
messageCount: W.messageCount ?? 1
|
|
4021
4021
|
};
|
|
4022
4022
|
h((ee) => ee.some((ae) => ae.threadId === ie.threadId) ? (console.debug("[ChatSessionProvider] thread_info: thread already in list", ie.threadId), ee) : (console.debug("[ChatSessionProvider] thread_info: adding thread to list", ie.threadId), [ie, ...ee]));
|
|
4023
4023
|
}, []), We = ke(
|
|
4024
|
-
(
|
|
4025
|
-
const ie =
|
|
4026
|
-
if (!ie ||
|
|
4024
|
+
(W) => {
|
|
4025
|
+
const ie = W.threadId ?? K.current;
|
|
4026
|
+
if (!ie || K.current && K.current !== ie)
|
|
4027
4027
|
return;
|
|
4028
|
-
const { checkpoints: ee, timeline: Se } = hr(
|
|
4028
|
+
const { checkpoints: ee, timeline: Se } = hr(W);
|
|
4029
4029
|
if (!ee.length)
|
|
4030
4030
|
return;
|
|
4031
4031
|
se(ie, ee, "stream state_history");
|
|
@@ -4033,24 +4033,24 @@ function qx({
|
|
|
4033
4033
|
N((ae == null ? void 0 : ae.messages) ?? [], {
|
|
4034
4034
|
checkpointId: (ae == null ? void 0 : ae.checkpointId) ?? null,
|
|
4035
4035
|
checkpointNs: (ae == null ? void 0 : ae.checkpointNs) ?? null
|
|
4036
|
-
}), oe(Se),
|
|
4036
|
+
}), oe(Se), q(ee), I(!!(ae != null && ae.nextCursor)), L((ae == null ? void 0 : ae.nextCursor) ?? null), Le.current = `${ie}:latest`, Ue.current = null, Ze.current = null;
|
|
4037
4037
|
},
|
|
4038
|
-
[
|
|
4039
|
-
), Ge = ke((
|
|
4040
|
-
console.log("[ChatSessionProvider] 🎯 Received thread_info:",
|
|
4038
|
+
[q, oe, se, N]
|
|
4039
|
+
), Ge = ke((W) => {
|
|
4040
|
+
console.log("[ChatSessionProvider] 🎯 Received thread_info:", W.threadId), et(W), K.current !== W.threadId && ((W.created ?? !K.current) && (Ue.current = W.threadId), Ze.current = W.threadId, console.log("[ChatSessionProvider] thread_info: marking to skip auto-load for new thread"), x(W.threadId));
|
|
4041
4041
|
}, [et]), { startStream: qe, stop: Qe, isStreaming: St, error: mt, setAuthToken: gt } = Vx({
|
|
4042
4042
|
baseUrl: f,
|
|
4043
4043
|
onThreadInfo: Ge,
|
|
4044
4044
|
onMessageEvent: P,
|
|
4045
4045
|
onStateHistory: We,
|
|
4046
|
-
onUnhandledEvent: (
|
|
4047
|
-
console.warn("[ChatSessionProvider] Unhandled event:",
|
|
4046
|
+
onUnhandledEvent: (W) => {
|
|
4047
|
+
console.warn("[ChatSessionProvider] Unhandled event:", W.type);
|
|
4048
4048
|
},
|
|
4049
4049
|
onAuthError: i
|
|
4050
4050
|
}), ft = ke(
|
|
4051
|
-
async (
|
|
4051
|
+
async (W) => {
|
|
4052
4052
|
try {
|
|
4053
|
-
const ie = await c.createThread(
|
|
4053
|
+
const ie = await c.createThread(W);
|
|
4054
4054
|
return x(ie.threadId), await Pe(), ie.threadId;
|
|
4055
4055
|
} catch (ie) {
|
|
4056
4056
|
return s == null || s(String(ie)), null;
|
|
@@ -4058,39 +4058,39 @@ function qx({
|
|
|
4058
4058
|
},
|
|
4059
4059
|
[c, Pe, s]
|
|
4060
4060
|
), it = ke(
|
|
4061
|
-
async (
|
|
4061
|
+
async (W) => {
|
|
4062
4062
|
try {
|
|
4063
|
-
await c.deleteThread(
|
|
4063
|
+
await c.deleteThread(W), K.current === W && (x(null), N([], {})), await Pe();
|
|
4064
4064
|
} catch (ie) {
|
|
4065
4065
|
s == null || s(String(ie));
|
|
4066
4066
|
}
|
|
4067
4067
|
},
|
|
4068
4068
|
[c, Pe, N, s]
|
|
4069
4069
|
), Ve = ke(
|
|
4070
|
-
async (
|
|
4070
|
+
async (W, ie) => {
|
|
4071
4071
|
try {
|
|
4072
|
-
await c.updateThread(
|
|
4072
|
+
await c.updateThread(W, ie), await Pe();
|
|
4073
4073
|
} catch (ee) {
|
|
4074
4074
|
s == null || s(String(ee));
|
|
4075
4075
|
}
|
|
4076
4076
|
},
|
|
4077
4077
|
[c, Pe, s]
|
|
4078
4078
|
), jt = ke(
|
|
4079
|
-
async (
|
|
4080
|
-
if (!
|
|
4081
|
-
const ee = `${
|
|
4079
|
+
async (W, ie) => {
|
|
4080
|
+
if (!W) return;
|
|
4081
|
+
const ee = `${W}:${ie ?? "latest"}`, Se = Fe.current.get(ee);
|
|
4082
4082
|
if (Se)
|
|
4083
4083
|
return Se;
|
|
4084
4084
|
const ae = (async () => {
|
|
4085
|
-
const Te =
|
|
4085
|
+
const Te = W;
|
|
4086
4086
|
C(!0), k(null);
|
|
4087
4087
|
try {
|
|
4088
4088
|
const Ut = await c.getStateHistory({
|
|
4089
4089
|
threadId: Te,
|
|
4090
4090
|
checkpointId: ie || void 0
|
|
4091
4091
|
});
|
|
4092
|
-
if (
|
|
4093
|
-
console.log(`[ChatSessionProvider] Thread changed during load (was ${Te}, now ${
|
|
4092
|
+
if (K.current !== Te) {
|
|
4093
|
+
console.log(`[ChatSessionProvider] Thread changed during load (was ${Te}, now ${K.current}), discarding stale data`);
|
|
4094
4094
|
return;
|
|
4095
4095
|
}
|
|
4096
4096
|
const { checkpoints: Tt, timeline: cn } = hr(Ut);
|
|
@@ -4101,7 +4101,7 @@ function qx({
|
|
|
4101
4101
|
checkpointNs: (kt == null ? void 0 : kt.checkpointNs) ?? null
|
|
4102
4102
|
}), pe(cn), J(Tt), I(!!(kt != null && kt.nextCursor)), L((kt == null ? void 0 : kt.nextCursor) ?? null);
|
|
4103
4103
|
} catch (Ut) {
|
|
4104
|
-
if (
|
|
4104
|
+
if (K.current === Te) {
|
|
4105
4105
|
const Tt = String(Ut);
|
|
4106
4106
|
k(Tt), s == null || s(Tt);
|
|
4107
4107
|
}
|
|
@@ -4115,16 +4115,16 @@ function qx({
|
|
|
4115
4115
|
} finally {
|
|
4116
4116
|
Fe.current.delete(ee);
|
|
4117
4117
|
}
|
|
4118
|
-
return
|
|
4118
|
+
return K.current === W && (Le.current = ee), ae;
|
|
4119
4119
|
},
|
|
4120
4120
|
[c, N, s, se]
|
|
4121
4121
|
), Ct = ke(
|
|
4122
|
-
async (
|
|
4123
|
-
re.current =
|
|
4122
|
+
async (W, ie) => {
|
|
4123
|
+
re.current = W;
|
|
4124
4124
|
try {
|
|
4125
|
-
await jt(
|
|
4125
|
+
await jt(W, ie);
|
|
4126
4126
|
} finally {
|
|
4127
|
-
re.current ===
|
|
4127
|
+
re.current === W && (re.current = null);
|
|
4128
4128
|
}
|
|
4129
4129
|
},
|
|
4130
4130
|
[jt]
|
|
@@ -4133,27 +4133,29 @@ function qx({
|
|
|
4133
4133
|
if (!o || !m || T || St)
|
|
4134
4134
|
return;
|
|
4135
4135
|
if (Ue.current === m) {
|
|
4136
|
-
Ue.current = null;
|
|
4136
|
+
Ue.current = null, Me.current = m;
|
|
4137
4137
|
return;
|
|
4138
4138
|
}
|
|
4139
|
-
if (Ze.current === m)
|
|
4139
|
+
if (Ze.current === m) {
|
|
4140
|
+
Me.current = m;
|
|
4140
4141
|
return;
|
|
4142
|
+
}
|
|
4141
4143
|
if (re.current === m) {
|
|
4142
|
-
re.current = null,
|
|
4144
|
+
re.current = null, Me.current = m;
|
|
4143
4145
|
return;
|
|
4144
4146
|
}
|
|
4145
|
-
if (
|
|
4147
|
+
if (Me.current === m)
|
|
4146
4148
|
return;
|
|
4147
|
-
|
|
4148
|
-
const
|
|
4149
|
+
Me.current = m;
|
|
4150
|
+
const W = !me.current && !!n && m === t;
|
|
4149
4151
|
let ie;
|
|
4150
|
-
|
|
4152
|
+
W && n ? (ie = n, me.current = !0, console.log(
|
|
4151
4153
|
"[ChatSessionProvider] Loading thread with checkpoint:",
|
|
4152
4154
|
ie,
|
|
4153
4155
|
r ? `(ns: ${r})` : ""
|
|
4154
4156
|
)) : console.log("[ChatSessionProvider] Loading thread with latest checkpoint");
|
|
4155
4157
|
const ee = `${m}:${ie ?? "latest"}`;
|
|
4156
|
-
|
|
4158
|
+
Le.current !== ee && Ct(m, ie);
|
|
4157
4159
|
}, [
|
|
4158
4160
|
o,
|
|
4159
4161
|
m,
|
|
@@ -4165,28 +4167,28 @@ function qx({
|
|
|
4165
4167
|
Ct
|
|
4166
4168
|
]);
|
|
4167
4169
|
const Zt = ke(
|
|
4168
|
-
async (
|
|
4169
|
-
const ee =
|
|
4170
|
+
async (W, ie) => {
|
|
4171
|
+
const ee = K.current;
|
|
4170
4172
|
if (!ee) return;
|
|
4171
4173
|
const Se = ee;
|
|
4172
4174
|
Ae(!0);
|
|
4173
4175
|
try {
|
|
4174
4176
|
const ae = await c.getStateHistory({
|
|
4175
4177
|
threadId: Se,
|
|
4176
|
-
checkpointId:
|
|
4178
|
+
checkpointId: W,
|
|
4177
4179
|
checkpointNs: ie ?? void 0
|
|
4178
4180
|
});
|
|
4179
|
-
if (
|
|
4180
|
-
console.log(`[ChatSessionProvider] Thread changed during checkpoint navigation (was ${Se}, now ${
|
|
4181
|
+
if (K.current !== Se) {
|
|
4182
|
+
console.log(`[ChatSessionProvider] Thread changed during checkpoint navigation (was ${Se}, now ${K.current}), discarding stale data`);
|
|
4181
4183
|
return;
|
|
4182
4184
|
}
|
|
4183
4185
|
const { checkpoints: Te, timeline: Ut } = hr(ae);
|
|
4184
4186
|
se(Se, Te, "checkpoint navigation");
|
|
4185
4187
|
const Tt = Te.find(
|
|
4186
|
-
(cn) => cn.checkpointId ===
|
|
4188
|
+
(cn) => cn.checkpointId === W && (ie ? cn.checkpointNs === ie : !0)
|
|
4187
4189
|
);
|
|
4188
4190
|
if (!Tt) {
|
|
4189
|
-
console.warn("[ChatSessionProvider] Requested checkpoint not found:", { checkpointId:
|
|
4191
|
+
console.warn("[ChatSessionProvider] Requested checkpoint not found:", { checkpointId: W, checkpointNs: ie });
|
|
4190
4192
|
return;
|
|
4191
4193
|
}
|
|
4192
4194
|
pe(Ut), J(Te), N(Tt.messages ?? [], {
|
|
@@ -4194,33 +4196,33 @@ function qx({
|
|
|
4194
4196
|
checkpointNs: Tt.checkpointNs ?? null
|
|
4195
4197
|
});
|
|
4196
4198
|
} catch (ae) {
|
|
4197
|
-
|
|
4199
|
+
K.current === Se && (s == null || s(String(ae)));
|
|
4198
4200
|
} finally {
|
|
4199
4201
|
Ae(!1);
|
|
4200
4202
|
}
|
|
4201
4203
|
},
|
|
4202
4204
|
[c, N, s, se]
|
|
4203
4205
|
), ln = ke(
|
|
4204
|
-
(
|
|
4206
|
+
(W, ie) => {
|
|
4205
4207
|
N(E.messages, {
|
|
4206
|
-
checkpointId:
|
|
4208
|
+
checkpointId: W ?? null,
|
|
4207
4209
|
checkpointNs: ie ?? null
|
|
4208
4210
|
});
|
|
4209
4211
|
},
|
|
4210
4212
|
[N, E.messages]
|
|
4211
4213
|
), Ye = ke(async () => {
|
|
4212
|
-
|
|
4214
|
+
K.current && await Ct(K.current);
|
|
4213
4215
|
}, [Ct]), _e = ke(async () => {
|
|
4214
|
-
if (!
|
|
4215
|
-
const
|
|
4216
|
+
if (!K.current || !X) return;
|
|
4217
|
+
const W = K.current;
|
|
4216
4218
|
A(!0);
|
|
4217
4219
|
try {
|
|
4218
4220
|
const ie = await c.getStateHistory({
|
|
4219
|
-
threadId:
|
|
4221
|
+
threadId: W,
|
|
4220
4222
|
checkpointId: X
|
|
4221
4223
|
});
|
|
4222
|
-
if (
|
|
4223
|
-
console.log(`[ChatSessionProvider] Thread changed during history load (was ${
|
|
4224
|
+
if (K.current !== W) {
|
|
4225
|
+
console.log(`[ChatSessionProvider] Thread changed during history load (was ${W}, now ${K.current}), discarding stale data`);
|
|
4224
4226
|
return;
|
|
4225
4227
|
}
|
|
4226
4228
|
const { checkpoints: ee } = hr(ie);
|
|
@@ -4229,7 +4231,7 @@ function qx({
|
|
|
4229
4231
|
M((Se == null ? void 0 : Se.messages) ?? []), I(!!(Se != null && Se.nextCursor)), L((Se == null ? void 0 : Se.nextCursor) ?? null);
|
|
4230
4232
|
}
|
|
4231
4233
|
} catch (ie) {
|
|
4232
|
-
|
|
4234
|
+
K.current === W && (s == null || s(String(ie)));
|
|
4233
4235
|
} finally {
|
|
4234
4236
|
A(!1);
|
|
4235
4237
|
}
|
|
@@ -4237,12 +4239,12 @@ function qx({
|
|
|
4237
4239
|
N([], {}), x(null), Qe(), J([]), pe([]), I(!1), L(null), C(!1), Ae(!1), A(!1), k(null);
|
|
4238
4240
|
try {
|
|
4239
4241
|
await c.getAgent("default");
|
|
4240
|
-
} catch (
|
|
4241
|
-
console.warn("[ChatSessionProvider] Failed to refetch agent after clearing thread:",
|
|
4242
|
+
} catch (W) {
|
|
4243
|
+
console.warn("[ChatSessionProvider] Failed to refetch agent after clearing thread:", W);
|
|
4242
4244
|
}
|
|
4243
4245
|
}, [N, Qe, c]), zt = ke(
|
|
4244
|
-
async (
|
|
4245
|
-
const Se =
|
|
4246
|
+
async (W, ie, ee) => {
|
|
4247
|
+
const Se = K.current;
|
|
4246
4248
|
if (!Se)
|
|
4247
4249
|
throw new Error("No active thread to handle interrupt");
|
|
4248
4250
|
const ae = ie ? ee ?? !0 : !1;
|
|
@@ -4256,7 +4258,7 @@ function qx({
|
|
|
4256
4258
|
};
|
|
4257
4259
|
qe(Te);
|
|
4258
4260
|
} catch (Te) {
|
|
4259
|
-
throw console.error(`[ChatSessionProvider] Failed to handle interrupt ${
|
|
4261
|
+
throw console.error(`[ChatSessionProvider] Failed to handle interrupt ${W}:`, Te), Te;
|
|
4260
4262
|
}
|
|
4261
4263
|
},
|
|
4262
4264
|
[E.lastCheckpointId, E.lastCheckpointNs, qe]
|
|
@@ -4267,9 +4269,9 @@ function qx({
|
|
|
4267
4269
|
a == null || a(m);
|
|
4268
4270
|
}, [m, a]);
|
|
4269
4271
|
const B = ke(
|
|
4270
|
-
async (
|
|
4271
|
-
let ee =
|
|
4272
|
-
const Se = (
|
|
4272
|
+
async (W, ie) => {
|
|
4273
|
+
let ee = K.current;
|
|
4274
|
+
const Se = (W == null ? void 0 : W.text) ?? "";
|
|
4273
4275
|
if (!ee && !Se) return;
|
|
4274
4276
|
if (!ee && Se) {
|
|
4275
4277
|
const cn = Math.floor(Date.now() / 1e3).toString(16).padStart(8, "0"), kt = Array.from(
|
|
@@ -4280,7 +4282,7 @@ function qx({
|
|
|
4280
4282
|
}
|
|
4281
4283
|
const { contentParts: ae } = await dx(
|
|
4282
4284
|
c,
|
|
4283
|
-
(
|
|
4285
|
+
(W == null ? void 0 : W.attachments) ?? []
|
|
4284
4286
|
), Te = [...ae];
|
|
4285
4287
|
Se != null && Se.trim() && Te.push({ type: "text", text: Se });
|
|
4286
4288
|
const Ut = {
|
|
@@ -6453,7 +6455,7 @@ var qu = "PopperAnchor", Gu = v.forwardRef(
|
|
|
6453
6455
|
Gu.displayName = qu;
|
|
6454
6456
|
var Ca = "PopperContent", [Mv, Dv] = Wu(Ca), Yu = v.forwardRef(
|
|
6455
6457
|
(e, t) => {
|
|
6456
|
-
var Y, D, H, ne, se,
|
|
6458
|
+
var Y, D, H, ne, se, K;
|
|
6457
6459
|
const {
|
|
6458
6460
|
__scopePopper: n,
|
|
6459
6461
|
side: r = "bottom",
|
|
@@ -6469,7 +6471,7 @@ var Ca = "PopperContent", [Mv, Dv] = Wu(Ca), Yu = v.forwardRef(
|
|
|
6469
6471
|
updatePositionStrategy: h = "optimized",
|
|
6470
6472
|
onPlaced: m,
|
|
6471
6473
|
...x
|
|
6472
|
-
} = e, y = Vu(Ca, n), [g, w] = v.useState(null), b = Je(t, (
|
|
6474
|
+
} = e, y = Vu(Ca, n), [g, w] = v.useState(null), b = Je(t, (Me) => w(Me)), [T, C] = v.useState(null), S = Uu(T), k = (S == null ? void 0 : S.width) ?? 0, E = (S == null ? void 0 : S.height) ?? 0, N = r + (s !== "center" ? "-" + s : ""), M = typeof d == "number" ? d : { top: 0, right: 0, bottom: 0, left: 0, ...d }, j = Array.isArray(c) ? c : [c], P = j.length > 0, $ = {
|
|
6473
6475
|
padding: M,
|
|
6474
6476
|
boundary: j.filter($v),
|
|
6475
6477
|
// with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
|
|
@@ -6478,7 +6480,7 @@ var Ca = "PopperContent", [Mv, Dv] = Wu(Ca), Yu = v.forwardRef(
|
|
|
6478
6480
|
// default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
|
|
6479
6481
|
strategy: "fixed",
|
|
6480
6482
|
placement: N,
|
|
6481
|
-
whileElementsMounted: (
|
|
6483
|
+
whileElementsMounted: (...Me) => pv(...Me, {
|
|
6482
6484
|
animationFrame: h === "always"
|
|
6483
6485
|
}),
|
|
6484
6486
|
elements: {
|
|
@@ -6495,9 +6497,9 @@ var Ca = "PopperContent", [Mv, Dv] = Wu(Ca), Yu = v.forwardRef(
|
|
|
6495
6497
|
l && Iv({ ...$ }),
|
|
6496
6498
|
Nv({
|
|
6497
6499
|
...$,
|
|
6498
|
-
apply: ({ elements:
|
|
6499
|
-
const { width: me, height:
|
|
6500
|
-
Fe.setProperty("--radix-popper-available-width", `${Ze}px`), Fe.setProperty("--radix-popper-available-height", `${re}px`), Fe.setProperty("--radix-popper-anchor-width", `${me}px`), Fe.setProperty("--radix-popper-anchor-height", `${
|
|
6500
|
+
apply: ({ elements: Me, rects: Ue, availableWidth: Ze, availableHeight: re }) => {
|
|
6501
|
+
const { width: me, height: Le } = Ue.reference, Fe = Me.floating.style;
|
|
6502
|
+
Fe.setProperty("--radix-popper-available-width", `${Ze}px`), Fe.setProperty("--radix-popper-available-height", `${re}px`), Fe.setProperty("--radix-popper-anchor-width", `${me}px`), Fe.setProperty("--radix-popper-anchor-height", `${Le}px`);
|
|
6501
6503
|
}
|
|
6502
6504
|
}),
|
|
6503
6505
|
T && _v({ element: T, padding: a }),
|
|
@@ -6508,7 +6510,7 @@ var Ca = "PopperContent", [Mv, Dv] = Wu(Ca), Yu = v.forwardRef(
|
|
|
6508
6510
|
Mt(() => {
|
|
6509
6511
|
X && (G == null || G());
|
|
6510
6512
|
}, [X, G]);
|
|
6511
|
-
const pe = (Y = L.arrow) == null ? void 0 : Y.x, Re = (D = L.arrow) == null ? void 0 : D.y, Ae = ((H = L.arrow) == null ? void 0 : H.centerOffset) !== 0, [
|
|
6513
|
+
const pe = (Y = L.arrow) == null ? void 0 : Y.x, Re = (D = L.arrow) == null ? void 0 : D.y, Ae = ((H = L.arrow) == null ? void 0 : H.centerOffset) !== 0, [q, oe] = v.useState();
|
|
6512
6514
|
return Mt(() => {
|
|
6513
6515
|
g && oe(window.getComputedStyle(g).zIndex);
|
|
6514
6516
|
}, [g]), /* @__PURE__ */ u.jsx(
|
|
@@ -6521,7 +6523,7 @@ var Ca = "PopperContent", [Mv, Dv] = Wu(Ca), Yu = v.forwardRef(
|
|
|
6521
6523
|
transform: X ? F.transform : "translate(0, -200%)",
|
|
6522
6524
|
// keep off the page when measuring
|
|
6523
6525
|
minWidth: "max-content",
|
|
6524
|
-
zIndex:
|
|
6526
|
+
zIndex: q,
|
|
6525
6527
|
"--radix-popper-transform-origin": [
|
|
6526
6528
|
(ne = L.transformOrigin) == null ? void 0 : ne.x,
|
|
6527
6529
|
(se = L.transformOrigin) == null ? void 0 : se.y
|
|
@@ -6529,7 +6531,7 @@ var Ca = "PopperContent", [Mv, Dv] = Wu(Ca), Yu = v.forwardRef(
|
|
|
6529
6531
|
// hide the content if using the hide middleware and should be hidden
|
|
6530
6532
|
// set visibility to hidden and disable pointer events so the UI behaves
|
|
6531
6533
|
// as if the PopperContent isn't there at all
|
|
6532
|
-
...((
|
|
6534
|
+
...((K = L.hide) == null ? void 0 : K.referenceHidden) && {
|
|
6533
6535
|
visibility: "hidden",
|
|
6534
6536
|
pointerEvents: "none"
|
|
6535
6537
|
}
|
|
@@ -7507,7 +7509,7 @@ var rn = "MenuContent", [Jw, Ea] = ir(rn), Cd = v.forwardRef(
|
|
|
7507
7509
|
...x
|
|
7508
7510
|
} = e, y = ar(rn, n), g = mo(rn, n), w = Os(n), b = vd(n), T = Vw(n), [C, S] = v.useState(null), k = v.useRef(null), E = Je(t, k, y.onContentChange), N = v.useRef(0), M = v.useRef(""), j = v.useRef(0), P = v.useRef(null), $ = v.useRef("right"), I = v.useRef(0), F = m ? Ps : v.Fragment, A = m ? { as: eb, allowPinchZoom: !0 } : void 0, X = (_) => {
|
|
7509
7511
|
var Y, D;
|
|
7510
|
-
const J = M.current + _, G = T().filter((H) => !H.disabled), pe = document.activeElement, Re = (Y = G.find((H) => H.ref.current === pe)) == null ? void 0 : Y.textValue, Ae = G.map((H) => H.textValue),
|
|
7512
|
+
const J = M.current + _, G = T().filter((H) => !H.disabled), pe = document.activeElement, Re = (Y = G.find((H) => H.ref.current === pe)) == null ? void 0 : Y.textValue, Ae = G.map((H) => H.textValue), q = fb(Ae, J, Re), oe = (D = G.find((H) => H.textValue === q)) == null ? void 0 : D.ref.current;
|
|
7511
7513
|
(function H(ne) {
|
|
7512
7514
|
M.current = ne, window.clearTimeout(N.current), ne !== "" && (N.current = window.setTimeout(() => H(""), 1e3));
|
|
7513
7515
|
})(J), oe && setTimeout(() => oe.focus());
|
|
@@ -8326,7 +8328,7 @@ function ht(...e) {
|
|
|
8326
8328
|
function st(e, t) {
|
|
8327
8329
|
return e(Un, t);
|
|
8328
8330
|
}
|
|
8329
|
-
function
|
|
8331
|
+
function $e(e, t) {
|
|
8330
8332
|
e(Ls, t);
|
|
8331
8333
|
}
|
|
8332
8334
|
function Pa(e) {
|
|
@@ -8506,7 +8508,7 @@ function Nt(...e) {
|
|
|
8506
8508
|
return e.forEach((s, i) => {
|
|
8507
8509
|
const a = Math.pow(2, i);
|
|
8508
8510
|
st(s, (l) => {
|
|
8509
|
-
n[i] = l, r = r | a, r === o &&
|
|
8511
|
+
n[i] = l, r = r | a, r === o && $e(t, n);
|
|
8510
8512
|
});
|
|
8511
8513
|
}), function(s, i) {
|
|
8512
8514
|
switch (s) {
|
|
@@ -9102,10 +9104,10 @@ const A0 = {
|
|
|
9102
9104
|
(C) => {
|
|
9103
9105
|
const { groupIndices: S } = Rt(x);
|
|
9104
9106
|
if (C > 0)
|
|
9105
|
-
|
|
9107
|
+
$e(t, !0), $e(s, C + dc(C, S));
|
|
9106
9108
|
else if (C < 0) {
|
|
9107
9109
|
const k = Rt(y);
|
|
9108
|
-
k.length > 0 && (C -= dc(-C, k)),
|
|
9110
|
+
k.length > 0 && (C -= dc(-C, k)), $e(i, C);
|
|
9109
9111
|
}
|
|
9110
9112
|
}
|
|
9111
9113
|
), st(U(a, ze(e)), ([C, S]) => {
|
|
@@ -9324,7 +9326,7 @@ const go = nt(
|
|
|
9324
9326
|
const h = Xe(), m = Xe(), x = Z(0);
|
|
9325
9327
|
let y = null, g = null, w = null;
|
|
9326
9328
|
function b() {
|
|
9327
|
-
y && (y(), y = null), w && (w(), w = null), g && (clearTimeout(g), g = null),
|
|
9329
|
+
y && (y(), y = null), w && (w(), w = null), g && (clearTimeout(g), g = null), $e(l, !1);
|
|
9328
9330
|
}
|
|
9329
9331
|
return ge(
|
|
9330
9332
|
U(
|
|
@@ -9342,7 +9344,7 @@ const go = nt(
|
|
|
9342
9344
|
let G = no(J, C.offsetTree, P) + N;
|
|
9343
9345
|
A === "end" ? (G += $ + gn(C.sizeTree, J)[1] - S + I, J === _ && (G += M)) : A === "center" ? G += ($ + gn(C.sizeTree, J)[1] - S + I) / 2 : G -= E, L && (G += L);
|
|
9344
9346
|
const pe = (Re) => {
|
|
9345
|
-
b(), Re ? (j("retrying to scroll to", { location: T }, qt.DEBUG),
|
|
9347
|
+
b(), Re ? (j("retrying to scroll to", { location: T }, qt.DEBUG), $e(h, T)) : ($e(m, !0), j("list did not change, scroll successful", {}, qt.DEBUG));
|
|
9346
9348
|
};
|
|
9347
9349
|
if (b(), X === "smooth") {
|
|
9348
9350
|
let Re = !1;
|
|
@@ -9355,7 +9357,7 @@ const go = nt(
|
|
|
9355
9357
|
y = pn(U(t, P0(150)), pe);
|
|
9356
9358
|
return g = setTimeout(() => {
|
|
9357
9359
|
b();
|
|
9358
|
-
}, 1200),
|
|
9360
|
+
}, 1200), $e(l, !0), j("scrolling from index to", { behavior: X, index: J, top: G }, qt.DEBUG), { behavior: X, top: G };
|
|
9359
9361
|
}
|
|
9360
9362
|
)
|
|
9361
9363
|
),
|
|
@@ -9416,11 +9418,11 @@ const xo = nt(
|
|
|
9416
9418
|
),
|
|
9417
9419
|
([, d]) => {
|
|
9418
9420
|
pn(o, () => {
|
|
9419
|
-
|
|
9421
|
+
$e(c, !0);
|
|
9420
9422
|
}), La(4, () => {
|
|
9421
9423
|
pn(r, () => {
|
|
9422
|
-
|
|
9423
|
-
}),
|
|
9424
|
+
$e(a, !0);
|
|
9425
|
+
}), $e(s, d);
|
|
9424
9426
|
});
|
|
9425
9427
|
}
|
|
9426
9428
|
), {
|
|
@@ -9784,12 +9786,12 @@ const cr = nt(
|
|
|
9784
9786
|
);
|
|
9785
9787
|
const J = [];
|
|
9786
9788
|
if (P.length > 0) {
|
|
9787
|
-
const
|
|
9789
|
+
const q = P[0], oe = P[P.length - 1];
|
|
9788
9790
|
let Y = 0;
|
|
9789
|
-
for (const D of Fs(L,
|
|
9790
|
-
const H = D.value, ne = Math.max(D.start,
|
|
9791
|
-
for (let
|
|
9792
|
-
J.push({ data: F == null ? void 0 : F[
|
|
9791
|
+
for (const D of Fs(L, q, oe)) {
|
|
9792
|
+
const H = D.value, ne = Math.max(D.start, q), se = Math.min(D.end, oe);
|
|
9793
|
+
for (let K = ne; K <= se; K++)
|
|
9794
|
+
J.push({ data: F == null ? void 0 : F[K], index: K, offset: Y, size: H }), Y += H;
|
|
9793
9795
|
}
|
|
9794
9796
|
}
|
|
9795
9797
|
if (!j)
|
|
@@ -9797,20 +9799,20 @@ const cr = nt(
|
|
|
9797
9799
|
const G = P.length > 0 ? P[P.length - 1] + 1 : 0, pe = k0(X, S, k, G);
|
|
9798
9800
|
if (pe.length === 0)
|
|
9799
9801
|
return null;
|
|
9800
|
-
const Re = E - 1, Ae = $s([], (
|
|
9802
|
+
const Re = E - 1, Ae = $s([], (q) => {
|
|
9801
9803
|
for (const oe of pe) {
|
|
9802
9804
|
const Y = oe.value;
|
|
9803
9805
|
let D = Y.offset, H = oe.start;
|
|
9804
9806
|
const ne = Y.size;
|
|
9805
9807
|
if (Y.offset < S) {
|
|
9806
9808
|
H += Math.floor((S - Y.offset + I) / (ne + I));
|
|
9807
|
-
const
|
|
9808
|
-
D +=
|
|
9809
|
+
const K = H - oe.start;
|
|
9810
|
+
D += K * ne + K * I;
|
|
9809
9811
|
}
|
|
9810
9812
|
H < G && (D += (G - H) * ne, H = G);
|
|
9811
9813
|
const se = Math.min(oe.end, Re);
|
|
9812
|
-
for (let
|
|
9813
|
-
|
|
9814
|
+
for (let K = H; K <= se && !(D >= k); K++)
|
|
9815
|
+
q.push({ data: F == null ? void 0 : F[K], index: K, offset: D, size: ne }), D += ne + I;
|
|
9814
9816
|
}
|
|
9815
9817
|
});
|
|
9816
9818
|
return Uo(Ae, J, E, I, A, $);
|
|
@@ -9993,7 +9995,7 @@ const z0 = (e, t) => typeof e == "function" ? gc(e(t)) : t && gc(e), B0 = nt(
|
|
|
9993
9995
|
const m = Z(!1), x = Xe();
|
|
9994
9996
|
let y = null;
|
|
9995
9997
|
function g(C) {
|
|
9996
|
-
|
|
9998
|
+
$e(i, {
|
|
9997
9999
|
align: "end",
|
|
9998
10000
|
behavior: C,
|
|
9999
10001
|
index: "LAST"
|
|
@@ -10065,9 +10067,9 @@ const z0 = (e, t) => typeof e == "function" ? gc(e(t)) : t && gc(e), B0 = nt(
|
|
|
10065
10067
|
),
|
|
10066
10068
|
(C) => {
|
|
10067
10069
|
y && (y(), y = null), Rt(n) ? requestAnimationFrame(() => {
|
|
10068
|
-
Rt(d)("scrolling into view", {}),
|
|
10070
|
+
Rt(d)("scrolling into view", {}), $e(h, C);
|
|
10069
10071
|
}) : y = pn(e, () => {
|
|
10070
|
-
Rt(d)("scrolling into view", {}),
|
|
10072
|
+
Rt(d)("scrolling into view", {}), $e(h, C), y = null;
|
|
10071
10073
|
});
|
|
10072
10074
|
}
|
|
10073
10075
|
), { autoscrollToBottom: x, followOutput: m, scrollIntoViewOnChange: b };
|
|
@@ -10115,7 +10117,7 @@ const z0 = (e, t) => typeof e == "function" ? gc(e(t)) : t && gc(e), B0 = nt(
|
|
|
10115
10117
|
),
|
|
10116
10118
|
() => {
|
|
10117
10119
|
requestAnimationFrame(() => {
|
|
10118
|
-
|
|
10120
|
+
$e(t, o);
|
|
10119
10121
|
});
|
|
10120
10122
|
}
|
|
10121
10123
|
);
|
|
@@ -10267,10 +10269,10 @@ const q0 = Pf(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
|
|
|
10267
10269
|
)
|
|
10268
10270
|
);
|
|
10269
10271
|
function y(g) {
|
|
10270
|
-
g > 0 ? (
|
|
10272
|
+
g > 0 ? ($e(t, { behavior: "auto", top: -g }), $e(e, 0)) : ($e(e, 0), $e(t, { behavior: "auto", top: -g }));
|
|
10271
10273
|
}
|
|
10272
10274
|
return st(U(x, ze(e, s)), ([g, w, b]) => {
|
|
10273
|
-
b && q0() ?
|
|
10275
|
+
b && q0() ? $e(e, w - g) : y(-g);
|
|
10274
10276
|
}), st(
|
|
10275
10277
|
U(
|
|
10276
10278
|
Nt(Ft(s, !1), e, m),
|
|
@@ -10309,9 +10311,9 @@ const q0 = Pf(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
|
|
|
10309
10311
|
})
|
|
10310
10312
|
),
|
|
10311
10313
|
(g) => {
|
|
10312
|
-
|
|
10313
|
-
|
|
10314
|
-
|
|
10314
|
+
$e(e, g), requestAnimationFrame(() => {
|
|
10315
|
+
$e(t, { top: g }), requestAnimationFrame(() => {
|
|
10316
|
+
$e(e, 0), $e(m, !1);
|
|
10315
10317
|
});
|
|
10316
10318
|
});
|
|
10317
10319
|
}
|
|
@@ -10448,22 +10450,22 @@ const No = typeof document < "u" ? z.useLayoutEffect : z.useEffect;
|
|
|
10448
10450
|
function Mf(e, t, n) {
|
|
10449
10451
|
const r = Object.keys(t.required || {}), o = Object.keys(t.optional || {}), s = Object.keys(t.methods || {}), i = Object.keys(t.events || {}), a = z.createContext({});
|
|
10450
10452
|
function l(y, g) {
|
|
10451
|
-
y.propsReady &&
|
|
10453
|
+
y.propsReady && $e(y.propsReady, !1);
|
|
10452
10454
|
for (const w of r) {
|
|
10453
10455
|
const b = y[t.required[w]];
|
|
10454
|
-
|
|
10456
|
+
$e(b, g[w]);
|
|
10455
10457
|
}
|
|
10456
10458
|
for (const w of o)
|
|
10457
10459
|
if (w in g) {
|
|
10458
10460
|
const b = y[t.optional[w]];
|
|
10459
|
-
|
|
10461
|
+
$e(b, g[w]);
|
|
10460
10462
|
}
|
|
10461
|
-
y.propsReady &&
|
|
10463
|
+
y.propsReady && $e(y.propsReady, !0);
|
|
10462
10464
|
}
|
|
10463
10465
|
function c(y) {
|
|
10464
10466
|
return s.reduce((g, w) => (g[w] = (b) => {
|
|
10465
10467
|
const T = y[t.methods[w]];
|
|
10466
|
-
|
|
10468
|
+
$e(T, b);
|
|
10467
10469
|
}, g), {});
|
|
10468
10470
|
}
|
|
10469
10471
|
function d(y) {
|
|
@@ -10488,7 +10490,7 @@ function Mf(e, t, n) {
|
|
|
10488
10490
|
const g = z.useContext(a);
|
|
10489
10491
|
return z.useCallback(
|
|
10490
10492
|
(w) => {
|
|
10491
|
-
|
|
10493
|
+
$e(g[y], w);
|
|
10492
10494
|
},
|
|
10493
10495
|
[g, y]
|
|
10494
10496
|
);
|
|
@@ -10983,18 +10985,18 @@ const bS = /* @__PURE__ */ nt(
|
|
|
10983
10985
|
Ne(([D, H]) => !!H)
|
|
10984
10986
|
),
|
|
10985
10987
|
() => {
|
|
10986
|
-
|
|
10988
|
+
$e(J, !1);
|
|
10987
10989
|
}
|
|
10988
10990
|
), st(
|
|
10989
10991
|
U(
|
|
10990
10992
|
Nt(m, J, M, N, _, G),
|
|
10991
|
-
Ne(([D, H, ne, se, ,
|
|
10993
|
+
Ne(([D, H, ne, se, , K]) => D && !H && ne.height !== 0 && se.height !== 0 && !K)
|
|
10992
10994
|
),
|
|
10993
10995
|
([, , , , D]) => {
|
|
10994
|
-
|
|
10995
|
-
|
|
10996
|
+
$e(G, !0), La(1, () => {
|
|
10997
|
+
$e(j, D);
|
|
10996
10998
|
}), pn(U(c), () => {
|
|
10997
|
-
|
|
10999
|
+
$e(t, [0, 0]), $e(J, !0);
|
|
10998
11000
|
});
|
|
10999
11001
|
}
|
|
11000
11002
|
), ge(
|
|
@@ -11011,9 +11013,9 @@ const bS = /* @__PURE__ */ nt(
|
|
|
11011
11013
|
Ne(([, D]) => D != null)
|
|
11012
11014
|
),
|
|
11013
11015
|
([, D]) => {
|
|
11014
|
-
D && (
|
|
11015
|
-
|
|
11016
|
-
}),
|
|
11016
|
+
D && ($e(N, D.viewport), $e(M, D.item), $e(F, D.gap), D.scrollTop > 0 && ($e(L, !0), pn(U(c, nr(1)), (H) => {
|
|
11017
|
+
$e(L, !1);
|
|
11018
|
+
}), $e(l, { top: D.scrollTop })));
|
|
11017
11019
|
}
|
|
11018
11020
|
), ge(
|
|
11019
11021
|
U(
|
|
@@ -11057,25 +11059,25 @@ const bS = /* @__PURE__ */ nt(
|
|
|
11057
11059
|
D,
|
|
11058
11060
|
[H, ne],
|
|
11059
11061
|
se,
|
|
11060
|
-
|
|
11061
|
-
|
|
11062
|
+
K,
|
|
11063
|
+
Me,
|
|
11062
11064
|
Ue,
|
|
11063
11065
|
Ze,
|
|
11064
11066
|
,
|
|
11065
11067
|
re,
|
|
11066
11068
|
me
|
|
11067
11069
|
]) => {
|
|
11068
|
-
const { column:
|
|
11070
|
+
const { column: Le, row: Fe } = se, { height: Pe, width: et } = K, { width: We } = Me;
|
|
11069
11071
|
if (Ze === 0 && (D === 0 || We === 0))
|
|
11070
11072
|
return vc;
|
|
11071
11073
|
if (et === 0) {
|
|
11072
11074
|
const Ve = $a(me, D), jt = Ve + Math.max(Ze - 1, 0);
|
|
11073
11075
|
return vS(Sc(Ve, jt, Ue));
|
|
11074
11076
|
}
|
|
11075
|
-
const Ge = Uf(We, et,
|
|
11077
|
+
const Ge = Uf(We, et, Le);
|
|
11076
11078
|
let qe, Qe;
|
|
11077
11079
|
re ? H === 0 && ne === 0 && Ze > 0 ? (qe = 0, Qe = Ze - 1) : (qe = Ge * os((H + Fe) / (Pe + Fe)), Qe = Ge * wc((ne + Fe) / (Pe + Fe)) - 1, Qe = bi(D - 1, Ur(Qe, Ge - 1)), qe = bi(Qe, Ur(0, qe))) : (qe = 0, Qe = -1);
|
|
11078
|
-
const St = Sc(qe, Qe, Ue), { bottom: mt, top: gt } = Cc(
|
|
11080
|
+
const St = Sc(qe, Qe, Ue), { bottom: mt, top: gt } = Cc(Me, se, K, St), ft = wc(D / Ge), it = ft * Pe + (ft - 1) * Fe - mt;
|
|
11079
11081
|
return { bottom: mt, itemHeight: Pe, items: St, itemWidth: et, offsetBottom: it, offsetTop: gt, top: gt };
|
|
11080
11082
|
}
|
|
11081
11083
|
)
|
|
@@ -11093,8 +11095,8 @@ const bS = /* @__PURE__ */ nt(
|
|
|
11093
11095
|
Nt(N, M, E, F),
|
|
11094
11096
|
Ne(([D, H, { items: ne }]) => ne.length > 0 && H.height !== 0 && D.height !== 0),
|
|
11095
11097
|
ce(([D, H, { items: ne }, se]) => {
|
|
11096
|
-
const { bottom:
|
|
11097
|
-
return [
|
|
11098
|
+
const { bottom: K, top: Me } = Cc(D, se, H, ne);
|
|
11099
|
+
return [Me, K];
|
|
11098
11100
|
}),
|
|
11099
11101
|
pt(to)
|
|
11100
11102
|
),
|
|
@@ -11121,7 +11123,7 @@ const bS = /* @__PURE__ */ nt(
|
|
|
11121
11123
|
ce(([[, D]]) => D - 1),
|
|
11122
11124
|
pt()
|
|
11123
11125
|
)
|
|
11124
|
-
),
|
|
11126
|
+
), q = Jt(
|
|
11125
11127
|
U(
|
|
11126
11128
|
Ie(E),
|
|
11127
11129
|
Ne(({ items: D }) => D.length > 0 && D[0].index === 0),
|
|
@@ -11145,12 +11147,12 @@ const bS = /* @__PURE__ */ nt(
|
|
|
11145
11147
|
U(
|
|
11146
11148
|
j,
|
|
11147
11149
|
ze(N, M, S, F),
|
|
11148
|
-
ce(([D, H, ne, se,
|
|
11149
|
-
const
|
|
11150
|
-
let me =
|
|
11150
|
+
ce(([D, H, ne, se, K]) => {
|
|
11151
|
+
const Me = Rf(D), { align: Ue, behavior: Ze, offset: re } = Me;
|
|
11152
|
+
let me = Me.index;
|
|
11151
11153
|
me === "LAST" && (me = se - 1), me = Ur(0, me, bi(se - 1, me));
|
|
11152
|
-
let
|
|
11153
|
-
return Ue === "end" ?
|
|
11154
|
+
let Le = Gi(H, K, ne, me);
|
|
11155
|
+
return Ue === "end" ? Le = bc(Le - H.height + ne.height) : Ue === "center" && (Le = bc(Le - H.height / 2 + ne.height / 2)), re && (Le += re), { behavior: Ze, top: Le };
|
|
11154
11156
|
})
|
|
11155
11157
|
),
|
|
11156
11158
|
l
|
|
@@ -11204,7 +11206,7 @@ const bS = /* @__PURE__ */ nt(
|
|
|
11204
11206
|
endReached: Ae,
|
|
11205
11207
|
propsReady: x,
|
|
11206
11208
|
rangeChanged: oe,
|
|
11207
|
-
startReached:
|
|
11209
|
+
startReached: q,
|
|
11208
11210
|
stateChanged: A,
|
|
11209
11211
|
stateRestoreInProgress: L,
|
|
11210
11212
|
...C
|
|
@@ -13823,7 +13825,7 @@ const Oc = z.memo(function({
|
|
|
13823
13825
|
}) {
|
|
13824
13826
|
const [M, j] = we(!1), [P, $] = we("preview"), [I, F] = we(!1), { currentThreadId: A } = da(), { respondToInterrupt: X } = fa(), L = l === "phone" || l === "half-screen", _ = t.role, J = _ === "tool", G = rt(() => "type" in t && t.type === "default_message" ? t : null, [t]), pe = !!G, Re = !(r && _ !== "user"), {
|
|
13825
13827
|
uploadingFiles: Ae,
|
|
13826
|
-
handleFileClick:
|
|
13828
|
+
handleFileClick: q,
|
|
13827
13829
|
fileViewerOpen: oe,
|
|
13828
13830
|
currentFileInfo: Y,
|
|
13829
13831
|
closeFileViewer: D
|
|
@@ -13840,17 +13842,17 @@ const Oc = z.memo(function({
|
|
|
13840
13842
|
default:
|
|
13841
13843
|
return "text-[hsl(var(--chat-bubble-ai-text))]";
|
|
13842
13844
|
}
|
|
13843
|
-
}, [_]), ne = rt(() => G ? "" : wC(t.content), [G, t]), se = rt(() => G ? {} : Rp(t), [G, t]),
|
|
13845
|
+
}, [_]), ne = rt(() => G ? "" : wC(t.content), [G, t]), se = rt(() => G ? {} : Rp(t), [G, t]), K = rt(
|
|
13844
13846
|
() => G ? [] : t.content.filter((B) => B.type === "image_url"),
|
|
13845
13847
|
[G, t]
|
|
13846
|
-
),
|
|
13848
|
+
), Me = rt(
|
|
13847
13849
|
() => G ? [] : t.content.filter((B) => B.type === "file"),
|
|
13848
13850
|
[G, t]
|
|
13849
13851
|
), Ue = rt(
|
|
13850
13852
|
() => G ? [] : t.content.filter((B) => B.type === "interrupt"),
|
|
13851
13853
|
[G, t]
|
|
13852
|
-
), Ze = (g == null ? void 0 : g.id) ?? (g == null ? void 0 : g.interrupt_id), re = jo(Ze), me = g == null ? void 0 : g.value,
|
|
13853
|
-
const B = J ?
|
|
13854
|
+
), Ze = (g == null ? void 0 : g.id) ?? (g == null ? void 0 : g.interrupt_id), re = jo(Ze), me = g == null ? void 0 : g.value, Le = rt(() => G ? "" : bC(t.content), [G, t]), Fe = z.useCallback(async () => {
|
|
13855
|
+
const B = J ? Le : ne;
|
|
13854
13856
|
async function ye(ve) {
|
|
13855
13857
|
if (navigator.clipboard && typeof navigator.clipboard.writeText == "function") {
|
|
13856
13858
|
await navigator.clipboard.writeText(ve);
|
|
@@ -13872,14 +13874,14 @@ const Oc = z.memo(function({
|
|
|
13872
13874
|
} catch (ve) {
|
|
13873
13875
|
console.error("Failed to copy:", ve);
|
|
13874
13876
|
}
|
|
13875
|
-
}, [J,
|
|
13877
|
+
}, [J, Le, ne, y]), Pe = z.useCallback(() => {
|
|
13876
13878
|
if (!h) return;
|
|
13877
|
-
const B = J ?
|
|
13879
|
+
const B = J ? Le : ne, ye = "type" in t && t.type === "default_message" ? void 0 : {
|
|
13878
13880
|
checkpointId: t.checkpointId ?? null,
|
|
13879
13881
|
checkpointNs: t.checkpointNs ?? null
|
|
13880
13882
|
};
|
|
13881
13883
|
h(t.id, B, ye);
|
|
13882
|
-
}, [h, t.id, J,
|
|
13884
|
+
}, [h, t.id, J, Le, ne, t]), et = z.useCallback(() => {
|
|
13883
13885
|
m == null || m(n);
|
|
13884
13886
|
}, [m, n]), We = z.useCallback(() => {
|
|
13885
13887
|
const ye = te(L ? "h-3 w-3" : "h-4 w-4", "opacity-60 flex-shrink-0", H);
|
|
@@ -13995,8 +13997,8 @@ const Oc = z.memo(function({
|
|
|
13995
13997
|
}
|
|
13996
13998
|
}, [w, T, b, X]), mt = z.useCallback(({ part: B, i: ye }) => {
|
|
13997
13999
|
if (B.type === "text") {
|
|
13998
|
-
const ve = B.text ?? "", at = ve.trim(),
|
|
13999
|
-
return
|
|
14000
|
+
const ve = B.text ?? "", at = ve.trim(), W = Va(at);
|
|
14001
|
+
return W && _ !== "tool" ? /* @__PURE__ */ u.jsx(Ep, { data: W }, ye) : _ === "user" && c && at.length > d ? /* @__PURE__ */ u.jsx(
|
|
14000
14002
|
RC,
|
|
14001
14003
|
{
|
|
14002
14004
|
text: at,
|
|
@@ -14026,7 +14028,7 @@ const Oc = z.memo(function({
|
|
|
14026
14028
|
"a",
|
|
14027
14029
|
{
|
|
14028
14030
|
href: ve.url,
|
|
14029
|
-
onClick: (
|
|
14031
|
+
onClick: (W) => q(W, ve, ye),
|
|
14030
14032
|
className: `inline-flex items-center gap-2 rounded px-2 py-1 text-xs bg-gray-100 border hover:bg-gray-200
|
|
14031
14033
|
dark:bg-background/10 dark:border-border/30 dark:hover:bg-background/20`,
|
|
14032
14034
|
children: [
|
|
@@ -14043,7 +14045,7 @@ const Oc = z.memo(function({
|
|
|
14043
14045
|
if (B.type === "interrupt") {
|
|
14044
14046
|
const ve = B, at = jo(
|
|
14045
14047
|
(ve == null ? void 0 : ve.id) ?? (ve == null ? void 0 : ve.interrupt_id)
|
|
14046
|
-
),
|
|
14048
|
+
), W = !!(re && at && at === re), ie = W ? me ?? (ve == null ? void 0 : ve.value) : ve == null ? void 0 : ve.value, ee = at ? { ...ve, id: at, interrupt_id: at } : ve;
|
|
14047
14049
|
return /* @__PURE__ */ u.jsx(
|
|
14048
14050
|
TC,
|
|
14049
14051
|
{
|
|
@@ -14051,7 +14053,7 @@ const Oc = z.memo(function({
|
|
|
14051
14053
|
onApprove: Qe,
|
|
14052
14054
|
onReject: St,
|
|
14053
14055
|
disabled: w,
|
|
14054
|
-
isActive:
|
|
14056
|
+
isActive: W,
|
|
14055
14057
|
payload: ie
|
|
14056
14058
|
},
|
|
14057
14059
|
ye
|
|
@@ -14059,7 +14061,7 @@ const Oc = z.memo(function({
|
|
|
14059
14061
|
}
|
|
14060
14062
|
return null;
|
|
14061
14063
|
}, [
|
|
14062
|
-
|
|
14064
|
+
q,
|
|
14063
14065
|
Ae,
|
|
14064
14066
|
Qe,
|
|
14065
14067
|
St,
|
|
@@ -14077,8 +14079,8 @@ const Oc = z.memo(function({
|
|
|
14077
14079
|
/* @__PURE__ */ u.jsx(ki, { className: "h-4 w-4 text-muted-foreground" }),
|
|
14078
14080
|
/* @__PURE__ */ u.jsx("span", { className: "text-sm text-muted-foreground", children: "File upload" })
|
|
14079
14081
|
] }), []), ft = z.useCallback(() => {
|
|
14080
|
-
const B = ne.trim().length > 0 ||
|
|
14081
|
-
if (!J &&
|
|
14082
|
+
const B = ne.trim().length > 0 || K.length > 0 || Me.length > 0 || Ue.length > 0;
|
|
14083
|
+
if (!J && Me.length > 0 && !r)
|
|
14082
14084
|
return gt();
|
|
14083
14085
|
if (!J && !B && !r)
|
|
14084
14086
|
return null;
|
|
@@ -14092,7 +14094,7 @@ const Oc = z.memo(function({
|
|
|
14092
14094
|
t.id
|
|
14093
14095
|
);
|
|
14094
14096
|
if (!J && !G) {
|
|
14095
|
-
const ye = t, ve = /* @__PURE__ */ u.jsx("div", { className: "space-y-2", children: ye.content.map((at,
|
|
14097
|
+
const ye = t, ve = /* @__PURE__ */ u.jsx("div", { className: "space-y-2", children: ye.content.map((at, W) => /* @__PURE__ */ u.jsx(mt, { part: at, i: W }, W)) });
|
|
14096
14098
|
return r ? /* @__PURE__ */ u.jsxs("div", { "aria-busy": "true", role: "status", children: [
|
|
14097
14099
|
ve,
|
|
14098
14100
|
/* @__PURE__ */ u.jsx(CC, { className: H })
|
|
@@ -14100,8 +14102,8 @@ const Oc = z.memo(function({
|
|
|
14100
14102
|
}
|
|
14101
14103
|
}, [
|
|
14102
14104
|
ne,
|
|
14103
|
-
|
|
14104
|
-
|
|
14105
|
+
K.length,
|
|
14106
|
+
Me.length,
|
|
14105
14107
|
Ue.length,
|
|
14106
14108
|
r,
|
|
14107
14109
|
J,
|
|
@@ -14693,9 +14695,9 @@ const IC = ({
|
|
|
14693
14695
|
return null;
|
|
14694
14696
|
const re = w.id && String(w.id).trim() ? String(w.id).trim() : "pending-interrupt";
|
|
14695
14697
|
let me;
|
|
14696
|
-
const
|
|
14697
|
-
if (
|
|
14698
|
-
const Fe =
|
|
14698
|
+
const Le = w.value;
|
|
14699
|
+
if (Le && typeof Le == "object" && !Array.isArray(Le)) {
|
|
14700
|
+
const Fe = Le.title;
|
|
14699
14701
|
typeof Fe == "string" && Fe.trim() && (me = Fe.trim());
|
|
14700
14702
|
}
|
|
14701
14703
|
return {
|
|
@@ -14706,7 +14708,7 @@ const IC = ({
|
|
|
14706
14708
|
{
|
|
14707
14709
|
type: "interrupt",
|
|
14708
14710
|
id: re,
|
|
14709
|
-
value:
|
|
14711
|
+
value: Le,
|
|
14710
14712
|
title: me
|
|
14711
14713
|
}
|
|
14712
14714
|
]
|
|
@@ -14719,10 +14721,10 @@ const IC = ({
|
|
|
14719
14721
|
content: [],
|
|
14720
14722
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
14721
14723
|
}
|
|
14722
|
-
] : pe, [pe, t, $]), Ae = rt(() => S ? Re : Re.filter((re) => (re == null ? void 0 : re.role) !== "tool"), [Re, S]),
|
|
14724
|
+
] : pe, [pe, t, $]), Ae = rt(() => S ? Re : Re.filter((re) => (re == null ? void 0 : re.role) !== "tool"), [Re, S]), q = rt(() => {
|
|
14723
14725
|
const re = /* @__PURE__ */ new Set(), me = [];
|
|
14724
|
-
for (let
|
|
14725
|
-
const Fe = Ae[
|
|
14726
|
+
for (let Le = Ae.length - 1; Le >= 0; Le--) {
|
|
14727
|
+
const Fe = Ae[Le];
|
|
14726
14728
|
if (!Fe) continue;
|
|
14727
14729
|
if ("type" in Fe && Fe.type === "default_message") {
|
|
14728
14730
|
me.push(Fe);
|
|
@@ -14756,7 +14758,7 @@ const IC = ({
|
|
|
14756
14758
|
content: re,
|
|
14757
14759
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
14758
14760
|
} : null;
|
|
14759
|
-
}, [h]),
|
|
14761
|
+
}, [h]), K = ne ? /* @__PURE__ */ u.jsx(
|
|
14760
14762
|
IC,
|
|
14761
14763
|
{
|
|
14762
14764
|
timelineEntries: H,
|
|
@@ -14764,7 +14766,7 @@ const IC = ({
|
|
|
14764
14766
|
onSelectCheckpoint: M,
|
|
14765
14767
|
messagePreviews: P
|
|
14766
14768
|
}
|
|
14767
|
-
) : null,
|
|
14769
|
+
) : null, Me = ["flex h-full flex-col md:flex-row", f].filter(Boolean).join(" "), Ue = () => se ? /* @__PURE__ */ u.jsx("div", { className: "p-6 h-full overflow-y-auto", children: /* @__PURE__ */ u.jsx("div", { className: "w-full max-w-full", children: /* @__PURE__ */ u.jsx(
|
|
14768
14770
|
Oc,
|
|
14769
14771
|
{
|
|
14770
14772
|
message: se,
|
|
@@ -14781,16 +14783,16 @@ const IC = ({
|
|
|
14781
14783
|
onCancelEdit: () => {
|
|
14782
14784
|
}
|
|
14783
14785
|
}
|
|
14784
|
-
) }) }) : /* @__PURE__ */ u.jsx("div", { className: "flex h-full items-center justify-center py-8 text-center text-muted-foreground", children: h ?? "No messages yet. Start a conversation!" }), Ze =
|
|
14786
|
+
) }) }) : /* @__PURE__ */ u.jsx("div", { className: "flex h-full items-center justify-center py-8 text-center text-muted-foreground", children: h ?? "No messages yet. Start a conversation!" }), Ze = q.length > 0;
|
|
14785
14787
|
return Qh(
|
|
14786
14788
|
I,
|
|
14787
14789
|
() => ({
|
|
14788
14790
|
scrollToLatest: () => {
|
|
14789
14791
|
var re, me;
|
|
14790
|
-
if (F.current &&
|
|
14791
|
-
const
|
|
14792
|
+
if (F.current && q.length > 0) {
|
|
14793
|
+
const Le = q.length - 1;
|
|
14792
14794
|
(me = (re = F.current).scrollToIndex) == null || me.call(re, {
|
|
14793
|
-
index:
|
|
14795
|
+
index: Le,
|
|
14794
14796
|
align: "end",
|
|
14795
14797
|
behavior: "auto"
|
|
14796
14798
|
});
|
|
@@ -14798,16 +14800,16 @@ const IC = ({
|
|
|
14798
14800
|
},
|
|
14799
14801
|
scrollToTop: () => {
|
|
14800
14802
|
var re, me;
|
|
14801
|
-
F.current &&
|
|
14803
|
+
F.current && q.length > 0 ? (me = (re = F.current).scrollToIndex) == null || me.call(re, {
|
|
14802
14804
|
index: 0,
|
|
14803
14805
|
align: "start",
|
|
14804
14806
|
behavior: "auto"
|
|
14805
14807
|
}) : A.current && (A.current.scrollTop = 0);
|
|
14806
14808
|
}
|
|
14807
14809
|
}),
|
|
14808
|
-
[
|
|
14809
|
-
), /* @__PURE__ */ u.jsxs("div", { className:
|
|
14810
|
-
|
|
14810
|
+
[q]
|
|
14811
|
+
), /* @__PURE__ */ u.jsxs("div", { className: Me, style: p, children: [
|
|
14812
|
+
K,
|
|
14811
14813
|
/* @__PURE__ */ u.jsx("div", { className: "relative flex-1 min-h-0", children: Ze ? /* @__PURE__ */ u.jsx(
|
|
14812
14814
|
gS,
|
|
14813
14815
|
{
|
|
@@ -14817,7 +14819,7 @@ const IC = ({
|
|
|
14817
14819
|
scrollerRef: (re) => {
|
|
14818
14820
|
A.current = re instanceof HTMLDivElement ? re : null;
|
|
14819
14821
|
},
|
|
14820
|
-
data:
|
|
14822
|
+
data: q,
|
|
14821
14823
|
followOutput: D,
|
|
14822
14824
|
overscan: 200,
|
|
14823
14825
|
increaseViewportBy: { top: 100, bottom: 200 },
|
|
@@ -14832,7 +14834,7 @@ const IC = ({
|
|
|
14832
14834
|
computeItemKey: (re, me) => Mc(me, re),
|
|
14833
14835
|
itemContent: (re, me) => {
|
|
14834
14836
|
var mt;
|
|
14835
|
-
const
|
|
14837
|
+
const Le = Mc(me, re), Fe = "type" in me && me.type === "default_message";
|
|
14836
14838
|
let Pe = [], et = null, We = {}, Ge = {}, qe = null, Qe = null;
|
|
14837
14839
|
if (!Fe) {
|
|
14838
14840
|
const gt = me, ft = gt.checkpointId ?? null;
|
|
@@ -14854,7 +14856,7 @@ const IC = ({
|
|
|
14854
14856
|
"div",
|
|
14855
14857
|
{
|
|
14856
14858
|
className: "relative mb-4 last:mb-0",
|
|
14857
|
-
"data-message-id":
|
|
14859
|
+
"data-message-id": Le,
|
|
14858
14860
|
style: {
|
|
14859
14861
|
minHeight: "60px",
|
|
14860
14862
|
containIntrinsicSize: "auto 120px"
|
|
@@ -14931,11 +14933,11 @@ function Ti({
|
|
|
14931
14933
|
Et(() => {
|
|
14932
14934
|
pe || Ae(!1);
|
|
14933
14935
|
}, [pe]);
|
|
14934
|
-
const
|
|
14936
|
+
const q = ke(() => {
|
|
14935
14937
|
Ae(!0);
|
|
14936
14938
|
}, []), oe = ke(() => {
|
|
14937
14939
|
Ae(!1);
|
|
14938
|
-
}, []), Y = !!pe || Re, [D, H] = we(null), [ne, se] = we(""), [
|
|
14940
|
+
}, []), Y = !!pe || Re, [D, H] = we(null), [ne, se] = we(""), [K, Me] = we(null), [Ue, Ze] = we(null), [re, me] = we([]), [Le, Fe] = we(0), [Pe, et] = we(0), [We, Ge] = we(!1), [qe, Qe] = we(null), [St, mt] = we(null), [gt, ft] = we(!1), [it, Ve] = we(null), jt = He(!1), [Ct, Zt] = we(() => Dc.value), ln = He(Ct), Ye = He(null), _e = ke((Q) => {
|
|
14939
14941
|
Dc.value = Q, Zt(Q);
|
|
14940
14942
|
}, []), [_t, zt] = we(!1), B = He(null), ye = ke(
|
|
14941
14943
|
(Q, de) => {
|
|
@@ -14983,7 +14985,7 @@ function Ti({
|
|
|
14983
14985
|
const Pr = Date.parse(be.createdAt ?? ""), Or = Date.parse(ct.createdAt ?? "");
|
|
14984
14986
|
return Number.isNaN(Pr) || Number.isNaN(Or) ? 0 : Or - Pr;
|
|
14985
14987
|
}), de;
|
|
14986
|
-
}, [E, ye]), { checkpointMetaById:
|
|
14988
|
+
}, [E, ye]), { checkpointMetaById: W, checkpointIndexByKey: ie } = rt(() => {
|
|
14987
14989
|
const Q = /* @__PURE__ */ new Map(), de = /* @__PURE__ */ new Map();
|
|
14988
14990
|
for (const fe of at) {
|
|
14989
14991
|
const be = fe.checkpointId ?? null;
|
|
@@ -15073,8 +15075,8 @@ function Ti({
|
|
|
15073
15075
|
const fe = _ ?? void 0, be = J ?? void 0, ct = D ? {
|
|
15074
15076
|
edit: !0,
|
|
15075
15077
|
originalMessageId: D,
|
|
15076
|
-
...
|
|
15077
|
-
...
|
|
15078
|
+
...K != null && K.checkpointId ? { originalCheckpointId: K.checkpointId } : {},
|
|
15079
|
+
...K != null && K.checkpointNs ? { originalCheckpointNs: K.checkpointNs } : {}
|
|
15078
15080
|
} : void 0;
|
|
15079
15081
|
await A(
|
|
15080
15082
|
{
|
|
@@ -15086,7 +15088,7 @@ function Ti({
|
|
|
15086
15088
|
checkpointId: fe,
|
|
15087
15089
|
checkpointNs: be
|
|
15088
15090
|
}
|
|
15089
|
-
), p == null || p(de), _e(""), Ze(null), me([]), Te(), H(null), se(""),
|
|
15091
|
+
), p == null || p(de), _e(""), Ze(null), me([]), Te(), H(null), se(""), Me(null);
|
|
15090
15092
|
} catch (fe) {
|
|
15091
15093
|
const be = (fe == null ? void 0 : fe.message) || "Failed to send message";
|
|
15092
15094
|
Ze(be), m == null || m(be);
|
|
@@ -15094,15 +15096,15 @@ function Ti({
|
|
|
15094
15096
|
}
|
|
15095
15097
|
}, vo = z.useCallback(
|
|
15096
15098
|
(Q, de, fe) => {
|
|
15097
|
-
c && (Ye.current = Ct, H(Q), se(de), _e(de), Ze(null),
|
|
15099
|
+
c && (Ye.current = Ct, H(Q), se(de), _e(de), Ze(null), Me({
|
|
15098
15100
|
checkpointId: (fe == null ? void 0 : fe.checkpointId) ?? null,
|
|
15099
15101
|
checkpointNs: (fe == null ? void 0 : fe.checkpointNs) ?? null
|
|
15100
15102
|
}));
|
|
15101
15103
|
},
|
|
15102
15104
|
[Ct, c, _e]
|
|
15103
15105
|
), R = z.useCallback(() => {
|
|
15104
|
-
H(null), se(""),
|
|
15105
|
-
}, [Ct, _e]),
|
|
15106
|
+
H(null), se(""), Me(null), Ze(null), _e(Ye.current ?? Ct), Ye.current = null;
|
|
15107
|
+
}, [Ct, _e]), V = ke(
|
|
15106
15108
|
(Q, de, fe) => {
|
|
15107
15109
|
vo(Q, de, fe);
|
|
15108
15110
|
},
|
|
@@ -15226,17 +15228,17 @@ function Ti({
|
|
|
15226
15228
|
layoutSize: cn,
|
|
15227
15229
|
enableMessageEditing: c,
|
|
15228
15230
|
editingMessageId: D,
|
|
15229
|
-
onEdit:
|
|
15231
|
+
onEdit: V,
|
|
15230
15232
|
onRegenerate: le,
|
|
15231
15233
|
onCancelEdit: R,
|
|
15232
15234
|
emptyMessage: it ?? void 0,
|
|
15233
15235
|
isNavigatingCheckpoint: _t,
|
|
15234
15236
|
activeInterrupt: pe,
|
|
15235
15237
|
disableInterruptActions: Re,
|
|
15236
|
-
onInterruptActionStart:
|
|
15238
|
+
onInterruptActionStart: q,
|
|
15237
15239
|
onInterruptActionEnd: oe,
|
|
15238
15240
|
showToolMessages: d,
|
|
15239
|
-
checkpointMetaById:
|
|
15241
|
+
checkpointMetaById: W,
|
|
15240
15242
|
checkpointIndexByKey: ie,
|
|
15241
15243
|
activeCheckpointId: _,
|
|
15242
15244
|
onSelectCheckpoint: Be,
|
|
@@ -15288,7 +15290,7 @@ function Ti({
|
|
|
15288
15290
|
onChange: (Q) => Ee(Q),
|
|
15289
15291
|
className: "hidden"
|
|
15290
15292
|
},
|
|
15291
|
-
|
|
15293
|
+
Le
|
|
15292
15294
|
),
|
|
15293
15295
|
re.length > 0 && /* @__PURE__ */ u.jsx("div", { className: "flex flex-wrap gap-2", children: re.map((Q, de) => /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2 bg-gray-100 dark:bg-gray-800 rounded-lg px-3 py-2 text-sm text-gray-900 dark:text-gray-100", children: [
|
|
15294
15296
|
/* @__PURE__ */ u.jsx(ki, { size: 14 }),
|
|
@@ -15968,78 +15970,78 @@ function Fc({
|
|
|
15968
15970
|
actions: x
|
|
15969
15971
|
} = da(), { loadThread: y } = fa(), { createThread: g, deleteThread: w, renameThread: b } = x, [T, C] = we(Array.isArray(f) ? f : []), S = He(T.length > 0), k = He(null), E = He(0), [N, M] = we(null), [j, P] = we(""), [$, I] = we(!1);
|
|
15970
15972
|
Et(() => {
|
|
15971
|
-
const
|
|
15972
|
-
if (
|
|
15973
|
-
S.current = !0, C(
|
|
15973
|
+
const q = Array.isArray(f) ? f : [];
|
|
15974
|
+
if (q.length > 0) {
|
|
15975
|
+
S.current = !0, C(q);
|
|
15974
15976
|
return;
|
|
15975
15977
|
}
|
|
15976
|
-
m || (S.current = !1, C(
|
|
15978
|
+
m || (S.current = !1, C(q));
|
|
15977
15979
|
}, [f, m]), Et(() => {
|
|
15978
15980
|
if (!k.current) return;
|
|
15979
|
-
const
|
|
15981
|
+
const q = k.current.querySelector(
|
|
15980
15982
|
"[data-radix-scroll-area-viewport]"
|
|
15981
15983
|
);
|
|
15982
|
-
if (!
|
|
15984
|
+
if (!q) return;
|
|
15983
15985
|
let oe = null, Y = null;
|
|
15984
15986
|
return oe = requestAnimationFrame(() => {
|
|
15985
15987
|
Y = requestAnimationFrame(() => {
|
|
15986
|
-
|
|
15988
|
+
q.scrollTop = E.current;
|
|
15987
15989
|
});
|
|
15988
15990
|
}), () => {
|
|
15989
15991
|
oe !== null && cancelAnimationFrame(oe), Y !== null && cancelAnimationFrame(Y);
|
|
15990
15992
|
};
|
|
15991
15993
|
}, [T]);
|
|
15992
|
-
const F = async (
|
|
15994
|
+
const F = async (q) => {
|
|
15993
15995
|
try {
|
|
15994
|
-
h(
|
|
15996
|
+
h(q), await y(q), a == null || a(q), l == null || l(q);
|
|
15995
15997
|
} catch (oe) {
|
|
15996
15998
|
console.error("Failed to select thread:", oe);
|
|
15997
15999
|
}
|
|
15998
16000
|
}, A = async () => {
|
|
15999
16001
|
try {
|
|
16000
16002
|
I(!0);
|
|
16001
|
-
const
|
|
16002
|
-
|
|
16003
|
-
} catch (
|
|
16004
|
-
console.error("Failed to create thread:",
|
|
16003
|
+
const q = await g();
|
|
16004
|
+
q && (c == null || c(q), a == null || a(q));
|
|
16005
|
+
} catch (q) {
|
|
16006
|
+
console.error("Failed to create thread:", q);
|
|
16005
16007
|
} finally {
|
|
16006
16008
|
I(!1);
|
|
16007
16009
|
}
|
|
16008
|
-
}, X = async (
|
|
16010
|
+
}, X = async (q, oe) => {
|
|
16009
16011
|
if (oe.stopPropagation(), !!confirm("Delete this thread?")) {
|
|
16010
16012
|
if (k.current) {
|
|
16011
16013
|
const Y = k.current.querySelector("[data-radix-scroll-area-viewport]");
|
|
16012
16014
|
Y && (E.current = Y.scrollTop);
|
|
16013
16015
|
}
|
|
16014
16016
|
try {
|
|
16015
|
-
await w(
|
|
16017
|
+
await w(q), d == null || d(q);
|
|
16016
16018
|
} catch (Y) {
|
|
16017
16019
|
console.error("Failed to delete thread:", Y);
|
|
16018
16020
|
}
|
|
16019
16021
|
}
|
|
16020
|
-
}, L = (
|
|
16021
|
-
oe.stopPropagation(), M(
|
|
16022
|
-
}, _ = async (
|
|
16022
|
+
}, L = (q, oe) => {
|
|
16023
|
+
oe.stopPropagation(), M(q.threadId), P(q.title || `Thread ${q.threadId.slice(0, 8)}`);
|
|
16024
|
+
}, _ = async (q) => {
|
|
16023
16025
|
if (j.trim())
|
|
16024
16026
|
try {
|
|
16025
|
-
await b(
|
|
16027
|
+
await b(q, j.trim()), M(null), P("");
|
|
16026
16028
|
} catch (oe) {
|
|
16027
16029
|
console.error("Failed to update title:", oe);
|
|
16028
16030
|
}
|
|
16029
16031
|
}, J = () => {
|
|
16030
16032
|
M(null), P("");
|
|
16031
|
-
}, G = (
|
|
16032
|
-
|
|
16033
|
-
}, pe = (
|
|
16034
|
-
if (!
|
|
16033
|
+
}, G = (q, oe) => {
|
|
16034
|
+
q.key === "Enter" ? _(oe) : q.key === "Escape" && J();
|
|
16035
|
+
}, pe = (q) => {
|
|
16036
|
+
if (!q) return "";
|
|
16035
16037
|
try {
|
|
16036
|
-
const oe = new Date(
|
|
16038
|
+
const oe = new Date(q), D = (/* @__PURE__ */ new Date()).getTime() - oe.getTime(), H = Math.floor(D / (1e3 * 60 * 60 * 24));
|
|
16037
16039
|
return H === 0 ? oe.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) : H === 1 ? "Yesterday" : H < 7 ? `${H} days ago` : oe.toLocaleDateString();
|
|
16038
16040
|
} catch {
|
|
16039
16041
|
return "";
|
|
16040
16042
|
}
|
|
16041
|
-
}, Re = (
|
|
16042
|
-
const oe = Re(
|
|
16043
|
+
}, Re = (q) => q.title || `Thread ${q.threadId.slice(0, 8)}`, Ae = (q) => {
|
|
16044
|
+
const oe = Re(q);
|
|
16043
16045
|
return oe.length <= $c ? oe : `${oe.slice(0, $c)}...`;
|
|
16044
16046
|
};
|
|
16045
16047
|
return /* @__PURE__ */ u.jsxs("div", { className: `flex flex-col h-full ${e} ${s.container || ""}`, children: [
|
|
@@ -16067,32 +16069,32 @@ function Fc({
|
|
|
16067
16069
|
] }) : T.length === 0 ? /* @__PURE__ */ u.jsxs("div", { className: "text-center py-8 text-slate-400", children: [
|
|
16068
16070
|
/* @__PURE__ */ u.jsx(pm, { className: "w-8 h-8 mx-auto mb-2 opacity-40 text-slate-500" }),
|
|
16069
16071
|
/* @__PURE__ */ u.jsx("p", { className: "text-sm text-slate-500", children: "No conversations yet" })
|
|
16070
|
-
] }) : T.slice().sort((
|
|
16072
|
+
] }) : T.slice().sort((q, oe) => new Date(oe.updatedAt || oe.createdAt || "").getTime() - new Date(q.updatedAt || q.createdAt || "").getTime()).map((q) => /* @__PURE__ */ u.jsxs(
|
|
16071
16073
|
"div",
|
|
16072
16074
|
{
|
|
16073
|
-
onClick: () => F(
|
|
16074
|
-
className: `group relative p-3 rounded-lg cursor-pointer transition-colors border ${(i ?? p) ===
|
|
16075
|
+
onClick: () => F(q.threadId),
|
|
16076
|
+
className: `group relative p-3 rounded-lg cursor-pointer transition-colors border ${(i ?? p) === q.threadId ? `${s.activeThread || "bg-slate-600 border-slate-500"} ` : `${s.threadItem || "bg-slate-700 border-slate-600 hover:bg-slate-600 text-gray-900 dark:text-slate-100"}`} ${s.threadItem || ""} text-gray-900 dark:text-slate-100`,
|
|
16075
16077
|
children: [
|
|
16076
16078
|
/* @__PURE__ */ u.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
16077
|
-
/* @__PURE__ */ u.jsx("div", { className: "flex-1 min-w-0", children: N ===
|
|
16078
|
-
/* @__PURE__ */ u.jsx(us, { value: j, onChange: (oe) => P(oe.target.value), onKeyDown: (oe) => G(oe,
|
|
16079
|
-
/* @__PURE__ */ u.jsx(ot, { variant: "ghost", size: "sm", onClick: () => _(
|
|
16079
|
+
/* @__PURE__ */ u.jsx("div", { className: "flex-1 min-w-0", children: N === q.threadId ? /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2", onClick: (oe) => oe.stopPropagation(), children: [
|
|
16080
|
+
/* @__PURE__ */ u.jsx(us, { value: j, onChange: (oe) => P(oe.target.value), onKeyDown: (oe) => G(oe, q.threadId), className: "h-6 text-sm", autoFocus: !0 }),
|
|
16081
|
+
/* @__PURE__ */ u.jsx(ot, { variant: "ghost", size: "sm", onClick: () => _(q.threadId), className: "h-6 w-6 p-0", children: /* @__PURE__ */ u.jsx(ra, { size: 12 }) }),
|
|
16080
16082
|
/* @__PURE__ */ u.jsx(ot, { variant: "ghost", size: "sm", onClick: J, className: "h-6 w-6 p-0", children: /* @__PURE__ */ u.jsx(gr, { size: 12 }) })
|
|
16081
16083
|
] }) : /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
|
|
16082
|
-
/* @__PURE__ */ u.jsx("div", { className: "font-medium text-sm truncate text-gray-900 dark:text-slate-100", children: Ae(
|
|
16084
|
+
/* @__PURE__ */ u.jsx("div", { className: "font-medium text-sm truncate text-gray-900 dark:text-slate-100", children: Ae(q) }),
|
|
16083
16085
|
/* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2 text-xs text-gray-500 dark:text-slate-400 mt-1", children: [
|
|
16084
16086
|
/* @__PURE__ */ u.jsx(hm, { size: 10 }),
|
|
16085
|
-
/* @__PURE__ */ u.jsx("span", { children: pe(
|
|
16087
|
+
/* @__PURE__ */ u.jsx("span", { children: pe(q.updatedAt || q.createdAt) })
|
|
16086
16088
|
] })
|
|
16087
16089
|
] }) }),
|
|
16088
16090
|
/* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity ml-2", children: [
|
|
16089
|
-
r && N !==
|
|
16091
|
+
r && N !== q.threadId && /* @__PURE__ */ u.jsx(ot, { variant: "ghost", size: "sm", onClick: (oe) => L(q, oe), className: "h-6 w-6 p-0", title: "Edit title", children: /* @__PURE__ */ u.jsx(Wc, { size: 12 }) }),
|
|
16090
16092
|
n && /* @__PURE__ */ u.jsx(
|
|
16091
16093
|
ot,
|
|
16092
16094
|
{
|
|
16093
16095
|
variant: "ghost",
|
|
16094
16096
|
size: "sm",
|
|
16095
|
-
onClick: (oe) => X(
|
|
16097
|
+
onClick: (oe) => X(q.threadId, oe),
|
|
16096
16098
|
className: "h-6 w-6 p-0 text-red-400 hover:text-red-300 hover:bg-red-900/20",
|
|
16097
16099
|
title: "Delete thread",
|
|
16098
16100
|
children: /* @__PURE__ */ u.jsx(mm, { size: 12 })
|
|
@@ -16100,10 +16102,10 @@ function Fc({
|
|
|
16100
16102
|
)
|
|
16101
16103
|
] })
|
|
16102
16104
|
] }),
|
|
16103
|
-
i ===
|
|
16105
|
+
i === q.threadId && /* @__PURE__ */ u.jsx("div", { className: "absolute left-0 top-1/2 -translate-y-1/2 w-1 h-8 bg-blue-400 rounded-r" })
|
|
16104
16106
|
]
|
|
16105
16107
|
},
|
|
16106
|
-
|
|
16108
|
+
q.threadId
|
|
16107
16109
|
)) })
|
|
16108
16110
|
}
|
|
16109
16111
|
)
|
|
@@ -16605,9 +16607,9 @@ var dn = 10, [fh, qn] = jr(sr), dT = "SelectContentImpl", fT = br("SelectContent
|
|
|
16605
16607
|
}, [b]), ma();
|
|
16606
16608
|
const A = v.useCallback(
|
|
16607
16609
|
(Y) => {
|
|
16608
|
-
const [D, ...H] = P().map((
|
|
16609
|
-
for (const
|
|
16610
|
-
if (
|
|
16610
|
+
const [D, ...H] = P().map((K) => K.ref.current), [ne] = H.slice(-1), se = document.activeElement;
|
|
16611
|
+
for (const K of Y)
|
|
16612
|
+
if (K === se || (K == null || K.scrollIntoView({ block: "nearest" }), K === D && C && (C.scrollTop = 0), K === ne && C && (C.scrollTop = C.scrollHeight), K == null || K.focus(), document.activeElement !== se)) return;
|
|
16611
16613
|
},
|
|
16612
16614
|
[P, C]
|
|
16613
16615
|
), X = v.useCallback(
|
|
@@ -16622,10 +16624,10 @@ var dn = 10, [fh, qn] = jr(sr), dT = "SelectContentImpl", fT = br("SelectContent
|
|
|
16622
16624
|
if (b) {
|
|
16623
16625
|
let Y = { x: 0, y: 0 };
|
|
16624
16626
|
const D = (ne) => {
|
|
16625
|
-
var se,
|
|
16627
|
+
var se, K;
|
|
16626
16628
|
Y = {
|
|
16627
16629
|
x: Math.abs(Math.round(ne.pageX) - (((se = _.current) == null ? void 0 : se.x) ?? 0)),
|
|
16628
|
-
y: Math.abs(Math.round(ne.pageY) - (((
|
|
16630
|
+
y: Math.abs(Math.round(ne.pageY) - (((K = _.current) == null ? void 0 : K.y) ?? 0))
|
|
16629
16631
|
};
|
|
16630
16632
|
}, H = (ne) => {
|
|
16631
16633
|
Y.x <= 10 && Y.y <= 10 ? ne.preventDefault() : b.contains(ne.target) || L(!1), document.removeEventListener("pointermove", D), _.current = null;
|
|
@@ -16655,7 +16657,7 @@ var dn = 10, [fh, qn] = jr(sr), dT = "SelectContentImpl", fT = br("SelectContent
|
|
|
16655
16657
|
(w.value !== void 0 && w.value === D || ne) && j(Y);
|
|
16656
16658
|
},
|
|
16657
16659
|
[w.value]
|
|
16658
|
-
),
|
|
16660
|
+
), q = r === "popper" ? Xi : hh, oe = q === Xi ? {
|
|
16659
16661
|
side: a,
|
|
16660
16662
|
sideOffset: l,
|
|
16661
16663
|
align: c,
|
|
@@ -16705,7 +16707,7 @@ var dn = 10, [fh, qn] = jr(sr), dT = "SelectContentImpl", fT = br("SelectContent
|
|
|
16705
16707
|
onFocusOutside: (Y) => Y.preventDefault(),
|
|
16706
16708
|
onDismiss: () => w.onOpenChange(!1),
|
|
16707
16709
|
children: /* @__PURE__ */ u.jsx(
|
|
16708
|
-
|
|
16710
|
+
q,
|
|
16709
16711
|
{
|
|
16710
16712
|
role: "listbox",
|
|
16711
16713
|
id: w.contentId,
|
|
@@ -16729,8 +16731,8 @@ var dn = 10, [fh, qn] = jr(sr), dT = "SelectContentImpl", fT = br("SelectContent
|
|
|
16729
16731
|
if (Y.key === "Tab" && Y.preventDefault(), !D && Y.key.length === 1 && G(Y.key), ["ArrowUp", "ArrowDown", "Home", "End"].includes(Y.key)) {
|
|
16730
16732
|
let ne = P().filter((se) => !se.disabled).map((se) => se.ref.current);
|
|
16731
16733
|
if (["ArrowUp", "End"].includes(Y.key) && (ne = ne.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(Y.key)) {
|
|
16732
|
-
const se = Y.target,
|
|
16733
|
-
ne = ne.slice(
|
|
16734
|
+
const se = Y.target, K = ne.indexOf(se);
|
|
16735
|
+
ne = ne.slice(K + 1);
|
|
16734
16736
|
}
|
|
16735
16737
|
setTimeout(() => A(ne)), Y.preventDefault();
|
|
16736
16738
|
}
|
|
@@ -16751,7 +16753,7 @@ var pT = "SelectItemAlignedPosition", hh = v.forwardRef((e, t) => {
|
|
|
16751
16753
|
if (s.trigger && s.valueNode && a && c && x && y && g) {
|
|
16752
16754
|
const k = s.trigger.getBoundingClientRect(), E = c.getBoundingClientRect(), N = s.valueNode.getBoundingClientRect(), M = g.getBoundingClientRect();
|
|
16753
16755
|
if (s.dir !== "rtl") {
|
|
16754
|
-
const se = M.left - E.left,
|
|
16756
|
+
const se = M.left - E.left, K = N.left - se, Me = k.left - K, Ue = k.width + Me, Ze = Math.max(Ue, E.width), re = window.innerWidth - dn, me = Yi(K, [
|
|
16755
16757
|
dn,
|
|
16756
16758
|
// Prevents the content from going off the starting edge of the
|
|
16757
16759
|
// viewport. It may still go off the ending edge, but this can be
|
|
@@ -16762,31 +16764,31 @@ var pT = "SelectItemAlignedPosition", hh = v.forwardRef((e, t) => {
|
|
|
16762
16764
|
]);
|
|
16763
16765
|
a.style.minWidth = Ue + "px", a.style.left = me + "px";
|
|
16764
16766
|
} else {
|
|
16765
|
-
const se = E.right - M.right,
|
|
16767
|
+
const se = E.right - M.right, K = window.innerWidth - N.right - se, Me = window.innerWidth - k.right - K, Ue = k.width + Me, Ze = Math.max(Ue, E.width), re = window.innerWidth - dn, me = Yi(K, [
|
|
16766
16768
|
dn,
|
|
16767
16769
|
Math.max(dn, re - Ze)
|
|
16768
16770
|
]);
|
|
16769
16771
|
a.style.minWidth = Ue + "px", a.style.right = me + "px";
|
|
16770
16772
|
}
|
|
16771
|
-
const j = p(), P = window.innerHeight - dn * 2, $ = x.scrollHeight, I = window.getComputedStyle(c), F = parseInt(I.borderTopWidth, 10), A = parseInt(I.paddingTop, 10), X = parseInt(I.borderBottomWidth, 10), L = parseInt(I.paddingBottom, 10), _ = F + A + $ + L + X, J = Math.min(y.offsetHeight * 5, _), G = window.getComputedStyle(x), pe = parseInt(G.paddingTop, 10), Re = parseInt(G.paddingBottom, 10), Ae = k.top + k.height / 2 - dn,
|
|
16773
|
+
const j = p(), P = window.innerHeight - dn * 2, $ = x.scrollHeight, I = window.getComputedStyle(c), F = parseInt(I.borderTopWidth, 10), A = parseInt(I.paddingTop, 10), X = parseInt(I.borderBottomWidth, 10), L = parseInt(I.paddingBottom, 10), _ = F + A + $ + L + X, J = Math.min(y.offsetHeight * 5, _), G = window.getComputedStyle(x), pe = parseInt(G.paddingTop, 10), Re = parseInt(G.paddingBottom, 10), Ae = k.top + k.height / 2 - dn, q = P - Ae, oe = y.offsetHeight / 2, Y = y.offsetTop + oe, D = F + A + Y, H = _ - D;
|
|
16772
16774
|
if (D <= Ae) {
|
|
16773
16775
|
const se = j.length > 0 && y === j[j.length - 1].ref.current;
|
|
16774
16776
|
a.style.bottom = "0px";
|
|
16775
|
-
const
|
|
16776
|
-
|
|
16777
|
+
const K = c.clientHeight - x.offsetTop - x.offsetHeight, Me = Math.max(
|
|
16778
|
+
q,
|
|
16777
16779
|
oe + // viewport might have padding bottom, include it to avoid a scrollable viewport
|
|
16778
|
-
(se ? Re : 0) +
|
|
16779
|
-
), Ue = D +
|
|
16780
|
+
(se ? Re : 0) + K + X
|
|
16781
|
+
), Ue = D + Me;
|
|
16780
16782
|
a.style.height = Ue + "px";
|
|
16781
16783
|
} else {
|
|
16782
16784
|
const se = j.length > 0 && y === j[0].ref.current;
|
|
16783
16785
|
a.style.top = "0px";
|
|
16784
|
-
const
|
|
16786
|
+
const Me = Math.max(
|
|
16785
16787
|
Ae,
|
|
16786
16788
|
F + x.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
|
|
16787
16789
|
(se ? pe : 0) + oe
|
|
16788
16790
|
) + H;
|
|
16789
|
-
a.style.height =
|
|
16791
|
+
a.style.height = Me + "px", x.scrollTop = D - Ae + x.offsetTop;
|
|
16790
16792
|
}
|
|
16791
16793
|
a.style.margin = `${dn}px 0`, a.style.minHeight = J + "px", a.style.maxHeight = P + "px", r == null || r(), requestAnimationFrame(() => h.current = !0);
|
|
16792
16794
|
}
|