teodor-new-chat-ui 4.3.208 → 4.3.209
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 +577 -581
- package/dist/index.umd.js +14 -14
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -2,7 +2,7 @@ var om = Object.defineProperty;
|
|
|
2
2
|
var sm = (e, t, n) => t in e ? om(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
3
|
var cl = (e, t, n) => sm(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
4
|
import * as v from "react";
|
|
5
|
-
import z, { createContext as co, useContext as xs, useRef as et, useCallback as Ee, useReducer as im, useEffect as
|
|
5
|
+
import z, { createContext as co, useContext as xs, useRef as et, useCallback as Ee, useReducer as im, useEffect as Nt, useMemo as lt, useState as ge, useLayoutEffect as am, createElement as Do, useImperativeHandle as lm } from "react";
|
|
6
6
|
import { Square as cm, Send as um, ChevronRight as Xc, Check as ca, Circle as dm, X as vr, ExternalLink as fm, Download as pm, Image as hm, FileText as ul, Loader as ua, Bot as si, Wrench as mm, User as gm, Paperclip as ji, ChevronUp as da, ChevronDown as ys, ChevronLeft as xm, Copy as dl, Edit as fl, RotateCcw as _i, Info as ym, Loader2 as zr, Edit3 as Jc, Plus as vm, FileSpreadsheet as wm, MessageSquarePlus as bm, MessageSquare as Sm, Calendar as Cm, Trash2 as Tm, Settings as km, Server as Rm, EyeOff as Em, Eye as Im, Layout as Nm, MessageCircle as Am, Save as jm } from "lucide-react";
|
|
7
7
|
import { Slot as _m, createSlot as Tr } from "@radix-ui/react-slot";
|
|
8
8
|
import { cva as vs } from "class-variance-authority";
|
|
@@ -57,17 +57,17 @@ function Dm() {
|
|
|
57
57
|
var m = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
58
58
|
function w(R) {
|
|
59
59
|
{
|
|
60
|
-
for (var V = arguments.length, se = new Array(V > 1 ? V - 1 : 0),
|
|
61
|
-
se[
|
|
60
|
+
for (var V = arguments.length, se = new Array(V > 1 ? V - 1 : 0), Ce = 1; Ce < V; Ce++)
|
|
61
|
+
se[Ce - 1] = arguments[Ce];
|
|
62
62
|
b("error", R, se);
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
function b(R, V, se) {
|
|
66
66
|
{
|
|
67
|
-
var
|
|
67
|
+
var Ce = m.ReactDebugCurrentFrame, Ge = Ce.getStackAddendum();
|
|
68
68
|
Ge !== "" && (V += "%s", se = se.concat([Ge]));
|
|
69
|
-
var at = se.map(function(
|
|
70
|
-
return String(
|
|
69
|
+
var at = se.map(function(Ue) {
|
|
70
|
+
return String(Ue);
|
|
71
71
|
});
|
|
72
72
|
at.unshift("Warning: " + V), Function.prototype.apply.call(console[R], console, at);
|
|
73
73
|
}
|
|
@@ -82,9 +82,9 @@ function Dm() {
|
|
|
82
82
|
R.$$typeof === E || R.getModuleId !== void 0));
|
|
83
83
|
}
|
|
84
84
|
function _(R, V, se) {
|
|
85
|
-
var
|
|
86
|
-
if (
|
|
87
|
-
return
|
|
85
|
+
var Ce = R.displayName;
|
|
86
|
+
if (Ce)
|
|
87
|
+
return Ce;
|
|
88
88
|
var Ge = V.displayName || V.name || "";
|
|
89
89
|
return Ge !== "" ? se + "(" + Ge + ")" : se;
|
|
90
90
|
}
|
|
@@ -123,12 +123,12 @@ function Dm() {
|
|
|
123
123
|
case l:
|
|
124
124
|
return _(R, R.render, "ForwardRef");
|
|
125
125
|
case f:
|
|
126
|
-
var
|
|
127
|
-
return
|
|
126
|
+
var Ce = R.displayName || null;
|
|
127
|
+
return Ce !== null ? Ce : F(R.type) || "Memo";
|
|
128
128
|
case p: {
|
|
129
|
-
var Ge = R, at = Ge._payload,
|
|
129
|
+
var Ge = R, at = Ge._payload, Ue = Ge._init;
|
|
130
130
|
try {
|
|
131
|
-
return F(
|
|
131
|
+
return F(Ue(at));
|
|
132
132
|
} catch {
|
|
133
133
|
return null;
|
|
134
134
|
}
|
|
@@ -137,9 +137,9 @@ function Dm() {
|
|
|
137
137
|
return null;
|
|
138
138
|
}
|
|
139
139
|
var j = Object.assign, $ = 0, A, B, L, M, J, Y, de;
|
|
140
|
-
function
|
|
140
|
+
function Re() {
|
|
141
141
|
}
|
|
142
|
-
|
|
142
|
+
Re.__reactDisabledLog = !0;
|
|
143
143
|
function Ae() {
|
|
144
144
|
{
|
|
145
145
|
if ($ === 0) {
|
|
@@ -147,7 +147,7 @@ function Dm() {
|
|
|
147
147
|
var R = {
|
|
148
148
|
configurable: !0,
|
|
149
149
|
enumerable: !0,
|
|
150
|
-
value:
|
|
150
|
+
value: Re,
|
|
151
151
|
writable: !0
|
|
152
152
|
};
|
|
153
153
|
Object.defineProperties(console, {
|
|
@@ -205,8 +205,8 @@ function Dm() {
|
|
|
205
205
|
try {
|
|
206
206
|
throw Error();
|
|
207
207
|
} catch (Ge) {
|
|
208
|
-
var
|
|
209
|
-
q =
|
|
208
|
+
var Ce = Ge.stack.trim().match(/\n( *(at )?)/);
|
|
209
|
+
q = Ce && Ce[1] || "";
|
|
210
210
|
}
|
|
211
211
|
return `
|
|
212
212
|
` + q + R;
|
|
@@ -225,7 +225,7 @@ function Dm() {
|
|
|
225
225
|
if (se !== void 0)
|
|
226
226
|
return se;
|
|
227
227
|
}
|
|
228
|
-
var
|
|
228
|
+
var Ce;
|
|
229
229
|
H = !0;
|
|
230
230
|
var Ge = Error.prepareStackTrace;
|
|
231
231
|
Error.prepareStackTrace = void 0;
|
|
@@ -233,40 +233,40 @@ function Dm() {
|
|
|
233
233
|
at = te.current, te.current = null, Ae();
|
|
234
234
|
try {
|
|
235
235
|
if (V) {
|
|
236
|
-
var
|
|
236
|
+
var Ue = function() {
|
|
237
237
|
throw Error();
|
|
238
238
|
};
|
|
239
|
-
if (Object.defineProperty(
|
|
239
|
+
if (Object.defineProperty(Ue.prototype, "props", {
|
|
240
240
|
set: function() {
|
|
241
241
|
throw Error();
|
|
242
242
|
}
|
|
243
243
|
}), typeof Reflect == "object" && Reflect.construct) {
|
|
244
244
|
try {
|
|
245
|
-
Reflect.construct(
|
|
245
|
+
Reflect.construct(Ue, []);
|
|
246
246
|
} catch (Ft) {
|
|
247
|
-
|
|
247
|
+
Ce = Ft;
|
|
248
248
|
}
|
|
249
|
-
Reflect.construct(R, [],
|
|
249
|
+
Reflect.construct(R, [], Ue);
|
|
250
250
|
} else {
|
|
251
251
|
try {
|
|
252
|
-
|
|
252
|
+
Ue.call();
|
|
253
253
|
} catch (Ft) {
|
|
254
|
-
|
|
254
|
+
Ce = Ft;
|
|
255
255
|
}
|
|
256
|
-
R.call(
|
|
256
|
+
R.call(Ue.prototype);
|
|
257
257
|
}
|
|
258
258
|
} else {
|
|
259
259
|
try {
|
|
260
260
|
throw Error();
|
|
261
261
|
} catch (Ft) {
|
|
262
|
-
|
|
262
|
+
Ce = Ft;
|
|
263
263
|
}
|
|
264
264
|
R();
|
|
265
265
|
}
|
|
266
266
|
} catch (Ft) {
|
|
267
|
-
if (Ft &&
|
|
267
|
+
if (Ft && Ce && typeof Ft.stack == "string") {
|
|
268
268
|
for (var ze = Ft.stack.split(`
|
|
269
|
-
`), Ot =
|
|
269
|
+
`), Ot = Ce.stack.split(`
|
|
270
270
|
`), St = ze.length - 1, yt = Ot.length - 1; St >= 1 && yt >= 0 && ze[St] !== Ot[yt]; )
|
|
271
271
|
yt--;
|
|
272
272
|
for (; St >= 1 && yt >= 0; St--, yt--)
|
|
@@ -315,7 +315,7 @@ function Dm() {
|
|
|
315
315
|
case f:
|
|
316
316
|
return ue(R.type, V, se);
|
|
317
317
|
case p: {
|
|
318
|
-
var
|
|
318
|
+
var Ce = R, Ge = Ce._payload, at = Ce._init;
|
|
319
319
|
try {
|
|
320
320
|
return ue(at(Ge), V, se);
|
|
321
321
|
} catch {
|
|
@@ -332,22 +332,22 @@ function Dm() {
|
|
|
332
332
|
} else
|
|
333
333
|
Ke.setExtraStackFrame(null);
|
|
334
334
|
}
|
|
335
|
-
function Be(R, V, se,
|
|
335
|
+
function Be(R, V, se, Ce, Ge) {
|
|
336
336
|
{
|
|
337
337
|
var at = Function.call.bind(xe);
|
|
338
|
-
for (var
|
|
339
|
-
if (at(R,
|
|
338
|
+
for (var Ue in R)
|
|
339
|
+
if (at(R, Ue)) {
|
|
340
340
|
var ze = void 0;
|
|
341
341
|
try {
|
|
342
|
-
if (typeof R[
|
|
343
|
-
var Ot = Error((
|
|
342
|
+
if (typeof R[Ue] != "function") {
|
|
343
|
+
var Ot = Error((Ce || "React class") + ": " + se + " type `" + Ue + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof R[Ue] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
344
344
|
throw Ot.name = "Invariant Violation", Ot;
|
|
345
345
|
}
|
|
346
|
-
ze = R[
|
|
346
|
+
ze = R[Ue](V, Ue, Ce, se, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
347
347
|
} catch (St) {
|
|
348
348
|
ze = St;
|
|
349
349
|
}
|
|
350
|
-
ze && !(ze instanceof Error) && (Je(Ge), w("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",
|
|
350
|
+
ze && !(ze instanceof Error) && (Je(Ge), w("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", Ce || "React class", se, Ue, typeof ze), Je(null)), ze instanceof Error && !(ze.message in Ne) && (Ne[ze.message] = !0, Je(Ge), w("Failed %s type: %s", se, ze.message), Je(null));
|
|
351
351
|
}
|
|
352
352
|
}
|
|
353
353
|
}
|
|
@@ -371,7 +371,7 @@ function Dm() {
|
|
|
371
371
|
function rt(R) {
|
|
372
372
|
return "" + R;
|
|
373
373
|
}
|
|
374
|
-
function
|
|
374
|
+
function Ct(R) {
|
|
375
375
|
if (Qe(R))
|
|
376
376
|
return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Ze(R)), rt(R);
|
|
377
377
|
}
|
|
@@ -380,7 +380,7 @@ function Dm() {
|
|
|
380
380
|
ref: !0,
|
|
381
381
|
__self: !0,
|
|
382
382
|
__source: !0
|
|
383
|
-
},
|
|
383
|
+
}, Tt, wt;
|
|
384
384
|
function Xe(R) {
|
|
385
385
|
if (xe.call(R, "ref")) {
|
|
386
386
|
var V = Object.getOwnPropertyDescriptor(R, "ref").get;
|
|
@@ -397,13 +397,13 @@ function Dm() {
|
|
|
397
397
|
}
|
|
398
398
|
return R.key !== void 0;
|
|
399
399
|
}
|
|
400
|
-
function
|
|
400
|
+
function ve(R, V) {
|
|
401
401
|
typeof R.ref == "string" && pt.current;
|
|
402
402
|
}
|
|
403
403
|
function Le(R, V) {
|
|
404
404
|
{
|
|
405
405
|
var se = function() {
|
|
406
|
-
|
|
406
|
+
Tt || (Tt = !0, w("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", V));
|
|
407
407
|
};
|
|
408
408
|
se.isReactWarning = !0, Object.defineProperty(R, "key", {
|
|
409
409
|
get: se,
|
|
@@ -411,7 +411,7 @@ function Dm() {
|
|
|
411
411
|
});
|
|
412
412
|
}
|
|
413
413
|
}
|
|
414
|
-
function
|
|
414
|
+
function He(R, V) {
|
|
415
415
|
{
|
|
416
416
|
var se = function() {
|
|
417
417
|
wt || (wt = !0, w("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", V));
|
|
@@ -422,7 +422,7 @@ function Dm() {
|
|
|
422
422
|
});
|
|
423
423
|
}
|
|
424
424
|
}
|
|
425
|
-
var
|
|
425
|
+
var pe = function(R, V, se, Ce, Ge, at, Ue) {
|
|
426
426
|
var ze = {
|
|
427
427
|
// This tag allows us to uniquely identify this as a React Element
|
|
428
428
|
$$typeof: t,
|
|
@@ -430,7 +430,7 @@ function Dm() {
|
|
|
430
430
|
type: R,
|
|
431
431
|
key: V,
|
|
432
432
|
ref: se,
|
|
433
|
-
props:
|
|
433
|
+
props: Ue,
|
|
434
434
|
// Record the component responsible for creating this element.
|
|
435
435
|
_owner: at
|
|
436
436
|
};
|
|
@@ -443,7 +443,7 @@ function Dm() {
|
|
|
443
443
|
configurable: !1,
|
|
444
444
|
enumerable: !1,
|
|
445
445
|
writable: !1,
|
|
446
|
-
value:
|
|
446
|
+
value: Ce
|
|
447
447
|
}), Object.defineProperty(ze, "_source", {
|
|
448
448
|
configurable: !1,
|
|
449
449
|
enumerable: !1,
|
|
@@ -451,34 +451,34 @@ function Dm() {
|
|
|
451
451
|
value: Ge
|
|
452
452
|
}), Object.freeze && (Object.freeze(ze.props), Object.freeze(ze)), ze;
|
|
453
453
|
};
|
|
454
|
-
function
|
|
454
|
+
function be(R, V, se, Ce, Ge) {
|
|
455
455
|
{
|
|
456
|
-
var at,
|
|
457
|
-
se !== void 0 && (
|
|
456
|
+
var at, Ue = {}, ze = null, Ot = null;
|
|
457
|
+
se !== void 0 && (Ct(se), ze = "" + se), fe(V) && (Ct(V.key), ze = "" + V.key), Xe(V) && (Ot = V.ref, ve(V, Ge));
|
|
458
458
|
for (at in V)
|
|
459
|
-
xe.call(V, at) && !ot.hasOwnProperty(at) && (
|
|
459
|
+
xe.call(V, at) && !ot.hasOwnProperty(at) && (Ue[at] = V[at]);
|
|
460
460
|
if (R && R.defaultProps) {
|
|
461
461
|
var St = R.defaultProps;
|
|
462
462
|
for (at in St)
|
|
463
|
-
|
|
463
|
+
Ue[at] === void 0 && (Ue[at] = St[at]);
|
|
464
464
|
}
|
|
465
465
|
if (ze || Ot) {
|
|
466
466
|
var yt = typeof R == "function" ? R.displayName || R.name || "Unknown" : R;
|
|
467
|
-
ze && Le(
|
|
467
|
+
ze && Le(Ue, yt), Ot && He(Ue, yt);
|
|
468
468
|
}
|
|
469
|
-
return
|
|
469
|
+
return pe(R, ze, Ot, Ge, Ce, pt.current, Ue);
|
|
470
470
|
}
|
|
471
471
|
}
|
|
472
|
-
var bt = m.ReactCurrentOwner,
|
|
472
|
+
var bt = m.ReactCurrentOwner, kt = m.ReactDebugCurrentFrame;
|
|
473
473
|
function W(R) {
|
|
474
474
|
if (R) {
|
|
475
475
|
var V = R._owner, se = ue(R.type, R._source, V ? V.type : null);
|
|
476
|
-
|
|
476
|
+
kt.setExtraStackFrame(se);
|
|
477
477
|
} else
|
|
478
|
-
|
|
478
|
+
kt.setExtraStackFrame(null);
|
|
479
479
|
}
|
|
480
|
-
var
|
|
481
|
-
|
|
480
|
+
var Se;
|
|
481
|
+
Se = !1;
|
|
482
482
|
function ye(R) {
|
|
483
483
|
return typeof R == "object" && R !== null && R.$$typeof === t;
|
|
484
484
|
}
|
|
@@ -497,7 +497,7 @@ Check the render method of \`` + R + "`.";
|
|
|
497
497
|
function mt(R) {
|
|
498
498
|
return "";
|
|
499
499
|
}
|
|
500
|
-
var
|
|
500
|
+
var Rt = {};
|
|
501
501
|
function Pe(R) {
|
|
502
502
|
{
|
|
503
503
|
var V = ht();
|
|
@@ -516,11 +516,11 @@ Check the top-level render call using <` + se + ">.");
|
|
|
516
516
|
return;
|
|
517
517
|
R._store.validated = !0;
|
|
518
518
|
var se = Pe(V);
|
|
519
|
-
if (
|
|
519
|
+
if (Rt[se])
|
|
520
520
|
return;
|
|
521
|
-
|
|
522
|
-
var
|
|
523
|
-
R && R._owner && R._owner !== bt.current && (
|
|
521
|
+
Rt[se] = !0;
|
|
522
|
+
var Ce = "";
|
|
523
|
+
R && R._owner && R._owner !== bt.current && (Ce = " It was passed a child from " + F(R._owner.type) + "."), W(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.', se, Ce), W(null);
|
|
524
524
|
}
|
|
525
525
|
}
|
|
526
526
|
function ct(R, V) {
|
|
@@ -529,20 +529,20 @@ Check the top-level render call using <` + se + ">.");
|
|
|
529
529
|
return;
|
|
530
530
|
if (qe(R))
|
|
531
531
|
for (var se = 0; se < R.length; se++) {
|
|
532
|
-
var
|
|
533
|
-
ye(
|
|
532
|
+
var Ce = R[se];
|
|
533
|
+
ye(Ce) && Vt(Ce, V);
|
|
534
534
|
}
|
|
535
535
|
else if (ye(R))
|
|
536
536
|
R._store && (R._store.validated = !0);
|
|
537
537
|
else if (R) {
|
|
538
538
|
var Ge = y(R);
|
|
539
539
|
if (typeof Ge == "function" && Ge !== R.entries)
|
|
540
|
-
for (var at = Ge.call(R),
|
|
541
|
-
ye(
|
|
540
|
+
for (var at = Ge.call(R), Ue; !(Ue = at.next()).done; )
|
|
541
|
+
ye(Ue.value) && Vt(Ue.value, V);
|
|
542
542
|
}
|
|
543
543
|
}
|
|
544
544
|
}
|
|
545
|
-
function
|
|
545
|
+
function Et(R) {
|
|
546
546
|
{
|
|
547
547
|
var V = R.type;
|
|
548
548
|
if (V == null || typeof V == "string")
|
|
@@ -557,10 +557,10 @@ Check the top-level render call using <` + se + ">.");
|
|
|
557
557
|
else
|
|
558
558
|
return;
|
|
559
559
|
if (se) {
|
|
560
|
-
var
|
|
561
|
-
Be(se, R.props, "prop",
|
|
562
|
-
} else if (V.PropTypes !== void 0 && !
|
|
563
|
-
|
|
560
|
+
var Ce = F(V);
|
|
561
|
+
Be(se, R.props, "prop", Ce, R);
|
|
562
|
+
} else if (V.PropTypes !== void 0 && !Se) {
|
|
563
|
+
Se = !0;
|
|
564
564
|
var Ge = F(V);
|
|
565
565
|
w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", Ge || "Unknown");
|
|
566
566
|
}
|
|
@@ -570,9 +570,9 @@ Check the top-level render call using <` + se + ">.");
|
|
|
570
570
|
function Dn(R) {
|
|
571
571
|
{
|
|
572
572
|
for (var V = Object.keys(R.props), se = 0; se < V.length; se++) {
|
|
573
|
-
var
|
|
574
|
-
if (
|
|
575
|
-
W(R), w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",
|
|
573
|
+
var Ce = V[se];
|
|
574
|
+
if (Ce !== "children" && Ce !== "key") {
|
|
575
|
+
W(R), w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", Ce), W(null);
|
|
576
576
|
break;
|
|
577
577
|
}
|
|
578
578
|
}
|
|
@@ -580,10 +580,10 @@ Check the top-level render call using <` + se + ">.");
|
|
|
580
580
|
}
|
|
581
581
|
}
|
|
582
582
|
var Jn = {};
|
|
583
|
-
function Ln(R, V, se,
|
|
583
|
+
function Ln(R, V, se, Ce, Ge, at) {
|
|
584
584
|
{
|
|
585
|
-
var
|
|
586
|
-
if (!
|
|
585
|
+
var Ue = I(R);
|
|
586
|
+
if (!Ue) {
|
|
587
587
|
var ze = "";
|
|
588
588
|
(R === void 0 || typeof R == "object" && R !== null && Object.keys(R).length === 0) && (ze += " 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
589
|
var Ot = mt();
|
|
@@ -591,13 +591,13 @@ Check the top-level render call using <` + se + ">.");
|
|
|
591
591
|
var St;
|
|
592
592
|
R === null ? St = "null" : qe(R) ? St = "array" : R !== void 0 && R.$$typeof === t ? (St = "<" + (F(R.type) || "Unknown") + " />", ze = " Did you accidentally export a JSX literal instead of a component?") : St = typeof R, w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", St, ze);
|
|
593
593
|
}
|
|
594
|
-
var yt =
|
|
594
|
+
var yt = be(R, V, se, Ge, at);
|
|
595
595
|
if (yt == null)
|
|
596
596
|
return yt;
|
|
597
|
-
if (
|
|
597
|
+
if (Ue) {
|
|
598
598
|
var Kt = V.children;
|
|
599
599
|
if (Kt !== void 0)
|
|
600
|
-
if (
|
|
600
|
+
if (Ce)
|
|
601
601
|
if (qe(Kt)) {
|
|
602
602
|
for (var Fn = 0; Fn < Kt.length; Fn++)
|
|
603
603
|
ct(Kt[Fn], R);
|
|
@@ -621,7 +621,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
621
621
|
<%s key={someKey} {...props} />`, Dr, Nn, K, Nn), Jn[Nn + Dr] = !0;
|
|
622
622
|
}
|
|
623
623
|
}
|
|
624
|
-
return R === r ? Dn(yt) :
|
|
624
|
+
return R === r ? Dn(yt) : Et(yt), yt;
|
|
625
625
|
}
|
|
626
626
|
}
|
|
627
627
|
function ti(R, V, se) {
|
|
@@ -1882,11 +1882,11 @@ const xu = (e) => {
|
|
|
1882
1882
|
duplex: "half"
|
|
1883
1883
|
}), de;
|
|
1884
1884
|
if (O.isFormData(m) && (de = Y.headers.get("content-type")) && N.setContentType(de), Y.body) {
|
|
1885
|
-
const [
|
|
1885
|
+
const [Re, Ae] = wl(
|
|
1886
1886
|
$,
|
|
1887
1887
|
Xo(bl(S))
|
|
1888
1888
|
);
|
|
1889
|
-
m = Cl(Y.body, Tl,
|
|
1889
|
+
m = Cl(Y.body, Tl, Re, Ae);
|
|
1890
1890
|
}
|
|
1891
1891
|
}
|
|
1892
1892
|
O.isString(E) || (E = E ? "include" : "omit");
|
|
@@ -1907,12 +1907,12 @@ const xu = (e) => {
|
|
|
1907
1907
|
["status", "statusText", "headers"].forEach((G) => {
|
|
1908
1908
|
Y[G] = L[G];
|
|
1909
1909
|
});
|
|
1910
|
-
const de = O.toFiniteNumber(L.headers.get("content-length")), [
|
|
1910
|
+
const de = O.toFiniteNumber(L.headers.get("content-length")), [Re, Ae] = C && wl(
|
|
1911
1911
|
de,
|
|
1912
1912
|
Xo(bl(C), !0)
|
|
1913
1913
|
) || [];
|
|
1914
1914
|
L = new r(
|
|
1915
|
-
Cl(L.body, Tl,
|
|
1915
|
+
Cl(L.body, Tl, Re, () => {
|
|
1916
1916
|
Ae && Ae(), j && j();
|
|
1917
1917
|
}),
|
|
1918
1918
|
Y
|
|
@@ -3061,7 +3061,7 @@ function Bx(e = []) {
|
|
|
3061
3061
|
}, [i]), l = Ee((d) => {
|
|
3062
3062
|
r.current.push(d), a();
|
|
3063
3063
|
}, [a]);
|
|
3064
|
-
|
|
3064
|
+
Nt(() => () => {
|
|
3065
3065
|
o.current !== null && typeof window < "u" && window.cancelAnimationFrame(o.current), s.current !== null && clearTimeout(s.current), r.current = [];
|
|
3066
3066
|
}, []);
|
|
3067
3067
|
const c = lt(() => ({
|
|
@@ -3415,7 +3415,7 @@ function Kx(e = {}) {
|
|
|
3415
3415
|
threadId: j.threadId ?? null,
|
|
3416
3416
|
headers: {}
|
|
3417
3417
|
}, (async () => {
|
|
3418
|
-
var de,
|
|
3418
|
+
var de, Re, Ae, G, te, q, P, H, Z, oe, ne, De, ee, ue, xe, Ne, Ke, Je;
|
|
3419
3419
|
const Y = (Be) => {
|
|
3420
3420
|
var $e;
|
|
3421
3421
|
try {
|
|
@@ -3434,14 +3434,14 @@ function Kx(e = {}) {
|
|
|
3434
3434
|
if (r)
|
|
3435
3435
|
Be = { Authorization: `Bearer ${r}` };
|
|
3436
3436
|
else if (typeof window < "u") {
|
|
3437
|
-
const
|
|
3438
|
-
let
|
|
3437
|
+
const be = window.__AUTH_TOKEN__, bt = ((de = window.localStorage) == null ? void 0 : de.getItem("authToken")) || null;
|
|
3438
|
+
let kt = null;
|
|
3439
3439
|
try {
|
|
3440
|
-
const
|
|
3441
|
-
|
|
3440
|
+
const Se = (Re = window.localStorage) == null ? void 0 : Re.getItem("chat-settings");
|
|
3441
|
+
Se && (kt = ((Ae = JSON.parse(Se)) == null ? void 0 : Ae.apiKey) || null);
|
|
3442
3442
|
} catch {
|
|
3443
3443
|
}
|
|
3444
|
-
const W =
|
|
3444
|
+
const W = be || bt || kt || null;
|
|
3445
3445
|
W && (Be = { Authorization: `Bearer ${W}` });
|
|
3446
3446
|
}
|
|
3447
3447
|
} catch {
|
|
@@ -3454,8 +3454,8 @@ function Kx(e = {}) {
|
|
|
3454
3454
|
let $e = {};
|
|
3455
3455
|
if (typeof window < "u")
|
|
3456
3456
|
try {
|
|
3457
|
-
const
|
|
3458
|
-
|
|
3457
|
+
const pe = (G = window.localStorage) == null ? void 0 : G.getItem("authSessionId");
|
|
3458
|
+
pe && ($e = { "X-Session-Id": pe });
|
|
3459
3459
|
} catch {
|
|
3460
3460
|
}
|
|
3461
3461
|
const qe = {
|
|
@@ -3474,46 +3474,46 @@ function Kx(e = {}) {
|
|
|
3474
3474
|
credentials: i
|
|
3475
3475
|
});
|
|
3476
3476
|
if (S.current && (S.current.headers = qe), !Qe.ok || !Qe.body) {
|
|
3477
|
-
const
|
|
3477
|
+
const pe = await Qe.text().catch(() => "");
|
|
3478
3478
|
console.debug(
|
|
3479
3479
|
"[use-chat] non-OK response",
|
|
3480
3480
|
Qe.status,
|
|
3481
|
-
|
|
3481
|
+
pe == null ? void 0 : pe.slice(0, 500)
|
|
3482
3482
|
);
|
|
3483
|
-
const
|
|
3484
|
-
throw (te = A == null ? void 0 : A.onConnectionError) == null || te.call(A,
|
|
3483
|
+
const be = `stream ${Qe.status}${pe ? ": " + pe : ""}`;
|
|
3484
|
+
throw (te = A == null ? void 0 : A.onConnectionError) == null || te.call(A, be), J = !0, L = "error", M = be, new Error(be);
|
|
3485
3485
|
}
|
|
3486
3486
|
w(!0);
|
|
3487
|
-
const rt = Qe.body.getReader(),
|
|
3487
|
+
const rt = Qe.body.getReader(), Ct = new TextDecoder();
|
|
3488
3488
|
let pt = "", ot = [];
|
|
3489
3489
|
C.current = 0, y(0);
|
|
3490
|
-
let
|
|
3490
|
+
let Tt = 0, wt = null;
|
|
3491
3491
|
const Xe = () => {
|
|
3492
3492
|
if (ot.length) {
|
|
3493
|
-
const
|
|
3494
|
-
ot = [], T.current && p((
|
|
3493
|
+
const pe = ot.join("");
|
|
3494
|
+
ot = [], T.current && p((be) => be + pe);
|
|
3495
3495
|
}
|
|
3496
3496
|
wt = null;
|
|
3497
3497
|
}, fe = () => {
|
|
3498
3498
|
typeof window < "u" && wt == null && (wt = requestAnimationFrame(Xe));
|
|
3499
3499
|
};
|
|
3500
|
-
let
|
|
3500
|
+
let ve = Date.now();
|
|
3501
3501
|
const Le = setInterval(() => {
|
|
3502
|
-
var
|
|
3503
|
-
if (Date.now() -
|
|
3504
|
-
const
|
|
3505
|
-
d(
|
|
3502
|
+
var pe;
|
|
3503
|
+
if (Date.now() - ve > 18e5) {
|
|
3504
|
+
const be = "Stream idle timeout";
|
|
3505
|
+
d(be), L = "error", M = be, B.abort(), (pe = A == null ? void 0 : A.onError) == null || pe.call(A, be);
|
|
3506
3506
|
}
|
|
3507
|
-
}, 5e3),
|
|
3507
|
+
}, 5e3), He = 1024 * 1024;
|
|
3508
3508
|
try {
|
|
3509
|
-
const
|
|
3509
|
+
const pe = Qe.headers.get("X-Thread-Id") || Qe.headers.get("x-thread-id"), be = Qe.headers.get("X-Thread-Created") || Qe.headers.get("x-thread-created"), bt = pe ?? null, kt = String(be ?? "").toLowerCase() === "true";
|
|
3510
3510
|
for (S.current && !S.current.threadId && (S.current = {
|
|
3511
3511
|
...S.current,
|
|
3512
3512
|
threadId: bt
|
|
3513
|
-
}), (q = A == null ? void 0 : A.onOpen) == null || q.call(A, { threadId: bt, created:
|
|
3514
|
-
const { value: W, done:
|
|
3515
|
-
if (
|
|
3516
|
-
pt +=
|
|
3513
|
+
}), (q = A == null ? void 0 : A.onOpen) == null || q.call(A, { threadId: bt, created: kt }); ; ) {
|
|
3514
|
+
const { value: W, done: Se } = await rt.read();
|
|
3515
|
+
if (Se) break;
|
|
3516
|
+
pt += Ct.decode(W, { stream: !0 }), pt.length > He && (pt = "", console.warn("Stream buffer reset: exceeded 1MB"));
|
|
3517
3517
|
let ye;
|
|
3518
3518
|
for (; (ye = pt.indexOf(`
|
|
3519
3519
|
|
|
@@ -3522,22 +3522,22 @@ function Kx(e = {}) {
|
|
|
3522
3522
|
pt = pt.slice(ye + 2);
|
|
3523
3523
|
const mt = Gx(ht);
|
|
3524
3524
|
if (!mt) continue;
|
|
3525
|
-
let
|
|
3525
|
+
let Rt;
|
|
3526
3526
|
try {
|
|
3527
|
-
|
|
3527
|
+
Rt = JSON.parse(mt);
|
|
3528
3528
|
} catch {
|
|
3529
3529
|
console.debug("[use-chat] malformed SSE:", mt.slice(0, 200));
|
|
3530
3530
|
continue;
|
|
3531
3531
|
}
|
|
3532
|
-
const Pe = qx(
|
|
3533
|
-
|
|
3532
|
+
const Pe = qx(Rt) ? Rt.data : Rt;
|
|
3533
|
+
ve = Date.now();
|
|
3534
3534
|
const Vt = Pe.seq;
|
|
3535
3535
|
if (Vt !== void 0) {
|
|
3536
|
-
if (Vt <=
|
|
3537
|
-
console.debug("[use-chat] drop duplicate/out-of-order event", { seq: Vt, lastProcessedSeq:
|
|
3536
|
+
if (Vt <= Tt) {
|
|
3537
|
+
console.debug("[use-chat] drop duplicate/out-of-order event", { seq: Vt, lastProcessedSeq: Tt, type: Pe.type });
|
|
3538
3538
|
continue;
|
|
3539
3539
|
}
|
|
3540
|
-
|
|
3540
|
+
Tt > 0 && Vt > Tt + 1 && ((P = A == null ? void 0 : A.onGap) == null || P.call(A, { from: Tt, to: Vt })), Tt = Vt, C.current = Vt, y(Vt);
|
|
3541
3541
|
}
|
|
3542
3542
|
if (console.debug("[use-chat] received event", {
|
|
3543
3543
|
seq: Pe.seq,
|
|
@@ -3545,9 +3545,9 @@ function Kx(e = {}) {
|
|
|
3545
3545
|
preview: (() => {
|
|
3546
3546
|
var ct;
|
|
3547
3547
|
try {
|
|
3548
|
-
return Pe.type === "message_delta" ? { deltaTypes: (ct = Pe.delta) == null ? void 0 : ct.map((
|
|
3549
|
-
} catch (
|
|
3550
|
-
return { err: String(
|
|
3548
|
+
return Pe.type === "message_delta" ? { deltaTypes: (ct = Pe.delta) == null ? void 0 : ct.map((Et) => Et.type), textLen: (Pe.delta || []).filter((Et) => Et.type === "text").map((Et) => String(Et.text || "").length) } : Pe.content || Pe.delta ? { hasContent: !0 } : {};
|
|
3549
|
+
} catch (Et) {
|
|
3550
|
+
return { err: String(Et) };
|
|
3551
3551
|
}
|
|
3552
3552
|
})()
|
|
3553
3553
|
}), Pe.type === "checkpoint")
|
|
@@ -3555,8 +3555,8 @@ function Kx(e = {}) {
|
|
|
3555
3555
|
else if (Pe.type === "state_history") {
|
|
3556
3556
|
E.current = Pe;
|
|
3557
3557
|
try {
|
|
3558
|
-
const
|
|
3559
|
-
|
|
3558
|
+
const Et = Ur(Pe).latest;
|
|
3559
|
+
Et && (k.current = Et.checkpointId ?? null, N.current = Et.checkpointNs ?? null, g(Et.checkpointId ?? null));
|
|
3560
3560
|
} catch (ct) {
|
|
3561
3561
|
console.warn("[use-chat] Failed to hydrate state_history payload", ct);
|
|
3562
3562
|
}
|
|
@@ -3569,7 +3569,7 @@ function Kx(e = {}) {
|
|
|
3569
3569
|
if (Pe.type === "token" && e.autoAppendAssistant !== !1)
|
|
3570
3570
|
ot.push(Pe.content), fe();
|
|
3571
3571
|
else if (Pe.type === "message_delta") {
|
|
3572
|
-
const ct = Pe.delta.filter((
|
|
3572
|
+
const ct = Pe.delta.filter((Et) => Et.type === "text").map((Et) => Et.text).join("");
|
|
3573
3573
|
ct && e.autoAppendAssistant !== !1 && (ot.push(ct), fe());
|
|
3574
3574
|
} else if (Pe.type === "heartbeat") {
|
|
3575
3575
|
console.debug("[use-chat] heartbeat received");
|
|
@@ -3595,12 +3595,12 @@ function Kx(e = {}) {
|
|
|
3595
3595
|
}
|
|
3596
3596
|
}
|
|
3597
3597
|
Xe(), L === null && !B.signal.aborted && (L = "complete");
|
|
3598
|
-
} catch (
|
|
3599
|
-
if (
|
|
3598
|
+
} catch (pe) {
|
|
3599
|
+
if (pe.name === "AbortError")
|
|
3600
3600
|
L = L ?? "aborted";
|
|
3601
3601
|
else {
|
|
3602
|
-
const
|
|
3603
|
-
L = "error", M =
|
|
3602
|
+
const be = pe.message || String(pe);
|
|
3603
|
+
L = "error", M = be, d(be), (ue = A == null ? void 0 : A.onError) == null || ue.call(A, be);
|
|
3604
3604
|
}
|
|
3605
3605
|
} finally {
|
|
3606
3606
|
try {
|
|
@@ -3638,7 +3638,7 @@ function Kx(e = {}) {
|
|
|
3638
3638
|
},
|
|
3639
3639
|
[t, n, r, e.autoAppendAssistant]
|
|
3640
3640
|
);
|
|
3641
|
-
return
|
|
3641
|
+
return Nt(() => () => {
|
|
3642
3642
|
var j;
|
|
3643
3643
|
T.current = !1, (j = b.current) == null || j.abort();
|
|
3644
3644
|
}, []), {
|
|
@@ -3878,8 +3878,8 @@ function Xx({
|
|
|
3878
3878
|
onThreadChange: d,
|
|
3879
3879
|
checkpointMetadataCache: f
|
|
3880
3880
|
}) {
|
|
3881
|
-
const { api: p, baseUrl: h } = Tu(), g = lt(() => _n(h), [h]), [x, y] = ge([]), [m, w] = ge(t), [b, T] = ge(!1), [C, S] = ge(null), [k, N] = ge(!1), [E, I] = ge(null), { state: _, seed: D, prepend: F, pushUser: j, onEvent: $ } = Bx(), [A, B] = ge(!1), [L, M] = ge(!1), [J, Y] = ge(null), [de,
|
|
3882
|
-
|
|
3881
|
+
const { api: p, baseUrl: h } = Tu(), g = lt(() => _n(h), [h]), [x, y] = ge([]), [m, w] = ge(t), [b, T] = ge(!1), [C, S] = ge(null), [k, N] = ge(!1), [E, I] = ge(null), { state: _, seed: D, prepend: F, pushUser: j, onEvent: $ } = Bx(), [A, B] = ge(!1), [L, M] = ge(!1), [J, Y] = ge(null), [de, Re] = ge([]), [Ae, G] = ge(!1), te = f ?? Lx(), { setCacheForThread: q } = te, P = et(m), H = et(null);
|
|
3882
|
+
Nt(() => {
|
|
3883
3883
|
P.current = m;
|
|
3884
3884
|
}, [m]);
|
|
3885
3885
|
const Z = et(), { startStream: oe, stop: ne, isStreaming: De, error: ee, setAuthToken: ue } = Yx({
|
|
@@ -3898,18 +3898,18 @@ function Xx({
|
|
|
3898
3898
|
const fe = await p.listThreads();
|
|
3899
3899
|
y(fe ?? []);
|
|
3900
3900
|
} catch (fe) {
|
|
3901
|
-
const
|
|
3902
|
-
S(
|
|
3901
|
+
const ve = String(fe);
|
|
3902
|
+
S(ve), l == null || l(ve);
|
|
3903
3903
|
} finally {
|
|
3904
3904
|
T(!1);
|
|
3905
3905
|
}
|
|
3906
3906
|
}, [p, l]), Ne = Ee(
|
|
3907
3907
|
async (fe) => {
|
|
3908
3908
|
try {
|
|
3909
|
-
const
|
|
3910
|
-
return w(
|
|
3911
|
-
} catch (
|
|
3912
|
-
return l == null || l(String(
|
|
3909
|
+
const ve = await p.createThread(fe);
|
|
3910
|
+
return w(ve.threadId), await xe(), ve.threadId;
|
|
3911
|
+
} catch (ve) {
|
|
3912
|
+
return l == null || l(String(ve)), null;
|
|
3913
3913
|
}
|
|
3914
3914
|
},
|
|
3915
3915
|
[p, xe, l]
|
|
@@ -3917,50 +3917,48 @@ function Xx({
|
|
|
3917
3917
|
async (fe) => {
|
|
3918
3918
|
try {
|
|
3919
3919
|
await p.deleteThread(fe), P.current === fe && (w(null), D([], {})), await xe();
|
|
3920
|
-
} catch (
|
|
3921
|
-
l == null || l(String(
|
|
3920
|
+
} catch (ve) {
|
|
3921
|
+
l == null || l(String(ve));
|
|
3922
3922
|
}
|
|
3923
3923
|
},
|
|
3924
3924
|
[p, xe, D, l]
|
|
3925
3925
|
), Je = Ee(
|
|
3926
|
-
async (fe,
|
|
3926
|
+
async (fe, ve) => {
|
|
3927
3927
|
try {
|
|
3928
|
-
await p.updateThread(fe,
|
|
3928
|
+
await p.updateThread(fe, ve), await xe();
|
|
3929
3929
|
} catch (Le) {
|
|
3930
3930
|
l == null || l(String(Le));
|
|
3931
3931
|
}
|
|
3932
3932
|
},
|
|
3933
3933
|
[p, xe, l]
|
|
3934
3934
|
), Be = Ee(
|
|
3935
|
-
(fe,
|
|
3936
|
-
const
|
|
3937
|
-
checkpointId:
|
|
3938
|
-
checkpointNs:
|
|
3939
|
-
createdAt:
|
|
3935
|
+
(fe, ve, Le) => {
|
|
3936
|
+
const He = ve.filter((pe) => pe.checkpointId).map((pe) => ({
|
|
3937
|
+
checkpointId: pe.checkpointId,
|
|
3938
|
+
checkpointNs: pe.checkpointNs ?? void 0,
|
|
3939
|
+
createdAt: pe.createdAt ?? ""
|
|
3940
3940
|
}));
|
|
3941
|
-
console.log(`[ChatSessionProvider] Cached metadata for ${
|
|
3941
|
+
console.log(`[ChatSessionProvider] Cached metadata for ${He.length} checkpoints from ${Le}`), q(fe, He);
|
|
3942
3942
|
},
|
|
3943
3943
|
[q]
|
|
3944
3944
|
), $e = Ee(
|
|
3945
|
-
async (fe,
|
|
3945
|
+
async (fe, ve) => {
|
|
3946
3946
|
if (fe) {
|
|
3947
3947
|
N(!0), I(null);
|
|
3948
3948
|
try {
|
|
3949
3949
|
const Le = await p.getStateHistory({
|
|
3950
3950
|
threadId: fe,
|
|
3951
|
-
checkpointId:
|
|
3952
|
-
}), { checkpoints:
|
|
3953
|
-
Be(fe,
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
checkpointNs: (me == null ? void 0 : me.checkpointNs) ?? null
|
|
3960
|
-
}), ke(Ue), B(!!(me != null && me.nextCursor)), Y((me == null ? void 0 : me.nextCursor) ?? null);
|
|
3951
|
+
checkpointId: ve
|
|
3952
|
+
}), { checkpoints: He } = Ur(Le);
|
|
3953
|
+
Be(fe, He, `thread load (requested: ${ve})`);
|
|
3954
|
+
let pe = ve ? He.find((be) => be.checkpointId === ve) : null;
|
|
3955
|
+
pe || (pe = He.find((be) => be.messages && be.messages.length > 0) ?? He[0]), D((pe == null ? void 0 : pe.messages) ?? [], {
|
|
3956
|
+
checkpointId: (pe == null ? void 0 : pe.checkpointId) ?? null,
|
|
3957
|
+
checkpointNs: (pe == null ? void 0 : pe.checkpointNs) ?? null
|
|
3958
|
+
}), Re(He), B(!!(pe != null && pe.nextCursor)), Y((pe == null ? void 0 : pe.nextCursor) ?? null);
|
|
3961
3959
|
} catch (Le) {
|
|
3962
|
-
const
|
|
3963
|
-
I(
|
|
3960
|
+
const He = String(Le);
|
|
3961
|
+
I(He), l == null || l(He);
|
|
3964
3962
|
} finally {
|
|
3965
3963
|
N(!1);
|
|
3966
3964
|
}
|
|
@@ -3968,34 +3966,34 @@ function Xx({
|
|
|
3968
3966
|
},
|
|
3969
3967
|
[p, D, l, Be]
|
|
3970
3968
|
);
|
|
3971
|
-
|
|
3969
|
+
Nt(() => {
|
|
3972
3970
|
Z.current = $e;
|
|
3973
3971
|
}, [$e]);
|
|
3974
3972
|
const qe = Ee(
|
|
3975
|
-
async (fe,
|
|
3973
|
+
async (fe, ve) => {
|
|
3976
3974
|
const Le = P.current;
|
|
3977
3975
|
if (Le) {
|
|
3978
3976
|
G(!0);
|
|
3979
3977
|
try {
|
|
3980
|
-
const
|
|
3978
|
+
const He = await p.getStateHistory({
|
|
3981
3979
|
threadId: Le,
|
|
3982
3980
|
checkpointId: fe,
|
|
3983
|
-
checkpointNs:
|
|
3984
|
-
}), { checkpoints:
|
|
3985
|
-
Be(Le,
|
|
3986
|
-
const
|
|
3987
|
-
(bt) => bt.checkpointId === fe && (
|
|
3981
|
+
checkpointNs: ve ?? void 0
|
|
3982
|
+
}), { checkpoints: pe } = Ur(He);
|
|
3983
|
+
Be(Le, pe, "checkpoint navigation");
|
|
3984
|
+
const be = pe.find(
|
|
3985
|
+
(bt) => bt.checkpointId === fe && (ve ? bt.checkpointNs === ve : !0)
|
|
3988
3986
|
);
|
|
3989
|
-
if (!
|
|
3990
|
-
console.warn("[ChatSessionProvider] Requested checkpoint not found:", { checkpointId: fe, checkpointNs:
|
|
3987
|
+
if (!be) {
|
|
3988
|
+
console.warn("[ChatSessionProvider] Requested checkpoint not found:", { checkpointId: fe, checkpointNs: ve });
|
|
3991
3989
|
return;
|
|
3992
3990
|
}
|
|
3993
|
-
|
|
3994
|
-
checkpointId:
|
|
3995
|
-
checkpointNs:
|
|
3991
|
+
Re(pe), D(be.messages ?? [], {
|
|
3992
|
+
checkpointId: be.checkpointId ?? null,
|
|
3993
|
+
checkpointNs: be.checkpointNs ?? null
|
|
3996
3994
|
});
|
|
3997
|
-
} catch (
|
|
3998
|
-
l == null || l(String(
|
|
3995
|
+
} catch (He) {
|
|
3996
|
+
l == null || l(String(He));
|
|
3999
3997
|
} finally {
|
|
4000
3998
|
G(!1);
|
|
4001
3999
|
}
|
|
@@ -4003,10 +4001,10 @@ function Xx({
|
|
|
4003
4001
|
},
|
|
4004
4002
|
[p, D, l, Be]
|
|
4005
4003
|
), Ze = Ee(
|
|
4006
|
-
(fe,
|
|
4004
|
+
(fe, ve) => {
|
|
4007
4005
|
D(_.messages, {
|
|
4008
4006
|
checkpointId: fe ?? null,
|
|
4009
|
-
checkpointNs:
|
|
4007
|
+
checkpointNs: ve ?? null
|
|
4010
4008
|
});
|
|
4011
4009
|
},
|
|
4012
4010
|
[D, _.messages]
|
|
@@ -4019,9 +4017,9 @@ function Xx({
|
|
|
4019
4017
|
const fe = await p.getStateHistory({
|
|
4020
4018
|
threadId: P.current,
|
|
4021
4019
|
checkpointId: J
|
|
4022
|
-
}), { checkpoints:
|
|
4023
|
-
if (
|
|
4024
|
-
const Le =
|
|
4020
|
+
}), { checkpoints: ve } = Ur(fe);
|
|
4021
|
+
if (ve.length > 0) {
|
|
4022
|
+
const Le = ve[ve.length - 1];
|
|
4025
4023
|
F((Le == null ? void 0 : Le.messages) ?? []), B(!!(Le != null && Le.nextCursor)), Y((Le == null ? void 0 : Le.nextCursor) ?? null);
|
|
4026
4024
|
}
|
|
4027
4025
|
} catch (fe) {
|
|
@@ -4030,18 +4028,18 @@ function Xx({
|
|
|
4030
4028
|
M(!1);
|
|
4031
4029
|
}
|
|
4032
4030
|
}
|
|
4033
|
-
}, [p, J, F, l]),
|
|
4034
|
-
D([], {}),
|
|
4031
|
+
}, [p, J, F, l]), Ct = Ee(async () => {
|
|
4032
|
+
D([], {}), Re([]), B(!1), Y(null);
|
|
4035
4033
|
}, [D]), pt = Ee(
|
|
4036
|
-
async (fe,
|
|
4037
|
-
console.log("[ChatSessionProvider] Interrupt:", fe,
|
|
4034
|
+
async (fe, ve) => {
|
|
4035
|
+
console.log("[ChatSessionProvider] Interrupt:", fe, ve);
|
|
4038
4036
|
},
|
|
4039
4037
|
[]
|
|
4040
4038
|
);
|
|
4041
|
-
|
|
4039
|
+
Nt(() => {
|
|
4042
4040
|
xe();
|
|
4043
|
-
}, [xe]),
|
|
4044
|
-
var
|
|
4041
|
+
}, [xe]), Nt(() => {
|
|
4042
|
+
var ve, Le;
|
|
4045
4043
|
if (!o || !m || k || H.current === m)
|
|
4046
4044
|
return;
|
|
4047
4045
|
H.current = m;
|
|
@@ -4049,41 +4047,39 @@ function Xx({
|
|
|
4049
4047
|
id: localStorage.getItem("lastCheckpointId") || n,
|
|
4050
4048
|
ns: localStorage.getItem("lastCheckpointNs") || r
|
|
4051
4049
|
};
|
|
4052
|
-
fe.id ? (console.log("[ChatSessionProvider] Loading thread with checkpoint:", fe.id), (
|
|
4053
|
-
}, [o, m, k, n, r]),
|
|
4050
|
+
fe.id ? (console.log("[ChatSessionProvider] Loading thread with checkpoint:", fe.id), (ve = Z.current) == null || ve.call(Z, m, fe.id)) : (console.log("[ChatSessionProvider] Loading thread with latest checkpoint"), (Le = Z.current) == null || Le.call(Z, m));
|
|
4051
|
+
}, [o, m, k, n, r]), Nt(() => {
|
|
4054
4052
|
d == null || d(m);
|
|
4055
|
-
}, [m, d])
|
|
4056
|
-
_.lastCheckpointId && (localStorage.setItem("lastCheckpointId", _.lastCheckpointId), _.lastCheckpointNs && localStorage.setItem("lastCheckpointNs", _.lastCheckpointNs));
|
|
4057
|
-
}, [_.lastCheckpointId, _.lastCheckpointNs]);
|
|
4053
|
+
}, [m, d]);
|
|
4058
4054
|
const ot = Ee(
|
|
4059
|
-
async (fe,
|
|
4060
|
-
const Le = P.current,
|
|
4061
|
-
if (!Le && !
|
|
4055
|
+
async (fe, ve) => {
|
|
4056
|
+
const Le = P.current, He = (fe == null ? void 0 : fe.text) ?? "";
|
|
4057
|
+
if (!Le && !He) return;
|
|
4062
4058
|
if (!Le) {
|
|
4063
4059
|
await Ne("New Chat");
|
|
4064
4060
|
return;
|
|
4065
4061
|
}
|
|
4066
|
-
const { contentParts:
|
|
4062
|
+
const { contentParts: pe } = await wx(
|
|
4067
4063
|
p,
|
|
4068
4064
|
(fe == null ? void 0 : fe.attachments) ?? []
|
|
4069
|
-
),
|
|
4070
|
-
|
|
4065
|
+
), be = [...pe];
|
|
4066
|
+
He != null && He.trim() && be.push({ type: "text", text: He });
|
|
4071
4067
|
const bt = {
|
|
4072
4068
|
id: `msg-${Date.now()}`,
|
|
4073
4069
|
role: "user",
|
|
4074
|
-
content:
|
|
4070
|
+
content: be,
|
|
4075
4071
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
4076
4072
|
};
|
|
4077
4073
|
j(bt);
|
|
4078
|
-
const
|
|
4074
|
+
const kt = {
|
|
4079
4075
|
threadId: Le,
|
|
4080
|
-
checkpointId: (
|
|
4081
|
-
checkpointNs: (
|
|
4076
|
+
checkpointId: (ve == null ? void 0 : ve.checkpointId) ?? _.lastCheckpointId ?? void 0,
|
|
4077
|
+
checkpointNs: (ve == null ? void 0 : ve.checkpointNs) ?? _.lastCheckpointNs ?? void 0
|
|
4082
4078
|
};
|
|
4083
|
-
oe(
|
|
4079
|
+
oe(kt);
|
|
4084
4080
|
},
|
|
4085
4081
|
[p, Ne, j, _, oe]
|
|
4086
|
-
),
|
|
4082
|
+
), Tt = lt(
|
|
4087
4083
|
() => ({
|
|
4088
4084
|
threads: x,
|
|
4089
4085
|
currentThreadId: m,
|
|
@@ -4115,12 +4111,12 @@ function Xx({
|
|
|
4115
4111
|
error: E,
|
|
4116
4112
|
hasMore: A,
|
|
4117
4113
|
loadOlder: rt,
|
|
4118
|
-
clearState:
|
|
4114
|
+
clearState: Ct,
|
|
4119
4115
|
navigateToCheckpoint: qe,
|
|
4120
4116
|
setCurrentCheckpointId: Ze,
|
|
4121
4117
|
returnToLatest: Qe,
|
|
4122
4118
|
loadThread: $e,
|
|
4123
|
-
clearThread:
|
|
4119
|
+
clearThread: Ct,
|
|
4124
4120
|
respondToInterrupt: pt
|
|
4125
4121
|
}),
|
|
4126
4122
|
[
|
|
@@ -4133,7 +4129,7 @@ function Xx({
|
|
|
4133
4129
|
E,
|
|
4134
4130
|
A,
|
|
4135
4131
|
rt,
|
|
4136
|
-
|
|
4132
|
+
Ct,
|
|
4137
4133
|
qe,
|
|
4138
4134
|
Ze,
|
|
4139
4135
|
Qe,
|
|
@@ -4152,7 +4148,7 @@ function Xx({
|
|
|
4152
4148
|
}),
|
|
4153
4149
|
[De, ee, ot, ne, ue]
|
|
4154
4150
|
);
|
|
4155
|
-
return /* @__PURE__ */ u.jsx(Au.Provider, { value:
|
|
4151
|
+
return /* @__PURE__ */ u.jsx(Au.Provider, { value: Tt, children: /* @__PURE__ */ u.jsx(ju.Provider, { value: wt, children: /* @__PURE__ */ u.jsx(_u.Provider, { value: Xe, children: e }) }) });
|
|
4156
4152
|
}
|
|
4157
4153
|
function xa() {
|
|
4158
4154
|
const e = xs(Au);
|
|
@@ -4298,8 +4294,8 @@ function Qx({
|
|
|
4298
4294
|
try {
|
|
4299
4295
|
const Y = l(A);
|
|
4300
4296
|
Y && typeof Y.then == "function" ? Y.then(() => {
|
|
4301
|
-
var de,
|
|
4302
|
-
((de = S.current) == null ? void 0 : de.id) === B && S.current.shouldClear && (g || (y(""), T.current && (T.current.style.height = "auto"), a == null || a(""))), ((
|
|
4297
|
+
var de, Re;
|
|
4298
|
+
((de = S.current) == null ? void 0 : de.id) === B && S.current.shouldClear && (g || (y(""), T.current && (T.current.style.height = "auto"), a == null || a(""))), ((Re = S.current) == null ? void 0 : Re.id) === B && (S.current = null);
|
|
4303
4299
|
}).catch(() => {
|
|
4304
4300
|
var de;
|
|
4305
4301
|
((de = S.current) == null ? void 0 : de.id) === B && (S.current = null);
|
|
@@ -6286,7 +6282,7 @@ var Na = "PopperContent", [Fv, $v] = Ju(Na), nd = v.forwardRef(
|
|
|
6286
6282
|
Lt(() => {
|
|
6287
6283
|
B && (Y == null || Y());
|
|
6288
6284
|
}, [B, Y]);
|
|
6289
|
-
const de = (q = L.arrow) == null ? void 0 : q.x,
|
|
6285
|
+
const de = (q = L.arrow) == null ? void 0 : q.x, Re = (P = L.arrow) == null ? void 0 : P.y, Ae = ((H = L.arrow) == null ? void 0 : H.centerOffset) !== 0, [G, te] = v.useState();
|
|
6290
6286
|
return Lt(() => {
|
|
6291
6287
|
m && te(window.getComputedStyle(m).zIndex);
|
|
6292
6288
|
}, [m]), /* @__PURE__ */ u.jsx(
|
|
@@ -6320,7 +6316,7 @@ var Na = "PopperContent", [Fv, $v] = Ju(Na), nd = v.forwardRef(
|
|
|
6320
6316
|
placedSide: M,
|
|
6321
6317
|
onArrowChange: C,
|
|
6322
6318
|
arrowX: de,
|
|
6323
|
-
arrowY:
|
|
6319
|
+
arrowY: Re,
|
|
6324
6320
|
shouldHideArrow: Ae,
|
|
6325
6321
|
children: /* @__PURE__ */ u.jsx(
|
|
6326
6322
|
_e.div,
|
|
@@ -7285,7 +7281,7 @@ var an = "MenuContent", [eb, Pa] = dr(an), Ad = v.forwardRef(
|
|
|
7285
7281
|
...x
|
|
7286
7282
|
} = e, y = fr(an, n), m = yo(an, n), w = Ls(n), b = Rd(n), T = Gw(n), [C, S] = v.useState(null), k = v.useRef(null), N = Ve(t, k, y.onContentChange), E = v.useRef(0), I = v.useRef(""), _ = v.useRef(0), D = v.useRef(null), F = v.useRef("right"), j = v.useRef(0), $ = g ? Ds : v.Fragment, A = g ? { as: rb, allowPinchZoom: !0 } : void 0, B = (M) => {
|
|
7287
7283
|
var q, P;
|
|
7288
|
-
const J = I.current + M, Y = T().filter((H) => !H.disabled), de = document.activeElement,
|
|
7284
|
+
const J = I.current + M, Y = T().filter((H) => !H.disabled), de = document.activeElement, Re = (q = Y.find((H) => H.ref.current === de)) == null ? void 0 : q.textValue, Ae = Y.map((H) => H.textValue), G = mb(Ae, J, Re), te = (P = Y.find((H) => H.textValue === G)) == null ? void 0 : P.ref.current;
|
|
7289
7285
|
(function H(Z) {
|
|
7290
7286
|
I.current = Z, window.clearTimeout(E.current), Z !== "" && (E.current = window.setTimeout(() => H(""), 1e3));
|
|
7291
7287
|
})(J), te && setTimeout(() => te.focus());
|
|
@@ -7370,8 +7366,8 @@ var an = "MenuContent", [eb, Pa] = dr(an), Ad = v.forwardRef(
|
|
|
7370
7366
|
ref: N,
|
|
7371
7367
|
style: { outline: "none", ...x.style },
|
|
7372
7368
|
onKeyDown: ce(x.onKeyDown, (M) => {
|
|
7373
|
-
const Y = M.target.closest("[data-radix-menu-content]") === M.currentTarget, de = M.ctrlKey || M.altKey || M.metaKey,
|
|
7374
|
-
Y && (M.key === "Tab" && M.preventDefault(), !de &&
|
|
7369
|
+
const Y = M.target.closest("[data-radix-menu-content]") === M.currentTarget, de = M.ctrlKey || M.altKey || M.metaKey, Re = M.key.length === 1;
|
|
7370
|
+
Y && (M.key === "Tab" && M.preventDefault(), !de && Re && B(M.key));
|
|
7375
7371
|
const Ae = k.current;
|
|
7376
7372
|
if (M.target !== Ae || !Vw.includes(M.key)) return;
|
|
7377
7373
|
M.preventDefault();
|
|
@@ -8110,10 +8106,10 @@ function Me(e, t) {
|
|
|
8110
8106
|
function $a(e) {
|
|
8111
8107
|
e(Pr);
|
|
8112
8108
|
}
|
|
8113
|
-
function
|
|
8109
|
+
function It(e) {
|
|
8114
8110
|
return e(vf);
|
|
8115
8111
|
}
|
|
8116
|
-
function
|
|
8112
|
+
function he(e, t) {
|
|
8117
8113
|
return it(e, d0(t, zs));
|
|
8118
8114
|
}
|
|
8119
8115
|
function pn(e, t) {
|
|
@@ -8234,7 +8230,7 @@ function X(e) {
|
|
|
8234
8230
|
};
|
|
8235
8231
|
}
|
|
8236
8232
|
function Ht(e, t) {
|
|
8237
|
-
return Bs(X(t), (n) =>
|
|
8233
|
+
return Bs(X(t), (n) => he(e, n));
|
|
8238
8234
|
}
|
|
8239
8235
|
function We() {
|
|
8240
8236
|
const e = [];
|
|
@@ -8257,7 +8253,7 @@ function We() {
|
|
|
8257
8253
|
};
|
|
8258
8254
|
}
|
|
8259
8255
|
function en(e) {
|
|
8260
|
-
return Bs(We(), (t) =>
|
|
8256
|
+
return Bs(We(), (t) => he(e, t));
|
|
8261
8257
|
}
|
|
8262
8258
|
function tt(e, t = [], { singleton: n } = { singleton: !0 }) {
|
|
8263
8259
|
return {
|
|
@@ -8297,7 +8293,7 @@ function _t(...e) {
|
|
|
8297
8293
|
}
|
|
8298
8294
|
};
|
|
8299
8295
|
}
|
|
8300
|
-
function
|
|
8296
|
+
function ke(e, t = bf) {
|
|
8301
8297
|
return U(e, gt(t));
|
|
8302
8298
|
}
|
|
8303
8299
|
function Yi(...e) {
|
|
@@ -8325,7 +8321,7 @@ const y0 = {
|
|
|
8325
8321
|
return {
|
|
8326
8322
|
log: X((t, n, r = 1) => {
|
|
8327
8323
|
var o;
|
|
8328
|
-
const s = (o = v0().VIRTUOSO_LOG_LEVEL) != null ? o :
|
|
8324
|
+
const s = (o = v0().VIRTUOSO_LOG_LEVEL) != null ? o : It(e);
|
|
8329
8325
|
r >= s && console[y0[r]](
|
|
8330
8326
|
"%creact-virtuoso: %c%s %o",
|
|
8331
8327
|
"color: #0253b3; font-weight: bold",
|
|
@@ -8447,19 +8443,19 @@ function Sf(e, t, n) {
|
|
|
8447
8443
|
const Wt = tt(
|
|
8448
8444
|
() => {
|
|
8449
8445
|
const e = We(), t = We(), n = X(0), r = We(), o = X(0), s = We(), i = We(), a = X(0), l = X(0), c = X(0), d = X(0), f = We(), p = We(), h = X(!1), g = X(!1), x = X(!1);
|
|
8450
|
-
return
|
|
8446
|
+
return he(
|
|
8451
8447
|
U(
|
|
8452
8448
|
e,
|
|
8453
8449
|
ae(({ scrollTop: y }) => y)
|
|
8454
8450
|
),
|
|
8455
8451
|
t
|
|
8456
|
-
),
|
|
8452
|
+
), he(
|
|
8457
8453
|
U(
|
|
8458
8454
|
e,
|
|
8459
8455
|
ae(({ scrollHeight: y }) => y)
|
|
8460
8456
|
),
|
|
8461
8457
|
i
|
|
8462
|
-
),
|
|
8458
|
+
), he(t, o), {
|
|
8463
8459
|
deviation: n,
|
|
8464
8460
|
fixedFooterHeight: c,
|
|
8465
8461
|
fixedHeaderHeight: l,
|
|
@@ -8809,7 +8805,7 @@ const P0 = {
|
|
|
8809
8805
|
),
|
|
8810
8806
|
[]
|
|
8811
8807
|
);
|
|
8812
|
-
|
|
8808
|
+
he(
|
|
8813
8809
|
U(
|
|
8814
8810
|
l,
|
|
8815
8811
|
Ie((C) => C.length > 0),
|
|
@@ -8824,7 +8820,7 @@ const P0 = {
|
|
|
8824
8820
|
})
|
|
8825
8821
|
),
|
|
8826
8822
|
x
|
|
8827
|
-
),
|
|
8823
|
+
), he(
|
|
8828
8824
|
U(
|
|
8829
8825
|
r,
|
|
8830
8826
|
Fe(x),
|
|
@@ -8838,7 +8834,7 @@ const P0 = {
|
|
|
8838
8834
|
])
|
|
8839
8835
|
),
|
|
8840
8836
|
n
|
|
8841
|
-
),
|
|
8837
|
+
), he(c, d);
|
|
8842
8838
|
const m = Ht(
|
|
8843
8839
|
U(
|
|
8844
8840
|
c,
|
|
@@ -8846,10 +8842,10 @@ const P0 = {
|
|
|
8846
8842
|
),
|
|
8847
8843
|
!0
|
|
8848
8844
|
);
|
|
8849
|
-
|
|
8845
|
+
he(
|
|
8850
8846
|
U(
|
|
8851
8847
|
d,
|
|
8852
|
-
Ie((C) => C !== void 0 && dt(
|
|
8848
|
+
Ie((C) => C !== void 0 && dt(It(x).sizeTree)),
|
|
8853
8849
|
ae((C) => [{ endIndex: 0, size: C, startIndex: 0 }])
|
|
8854
8850
|
),
|
|
8855
8851
|
n
|
|
@@ -8878,11 +8874,11 @@ const P0 = {
|
|
|
8878
8874
|
ae((C) => C.diff)
|
|
8879
8875
|
),
|
|
8880
8876
|
(C) => {
|
|
8881
|
-
const { groupIndices: S } =
|
|
8877
|
+
const { groupIndices: S } = It(x);
|
|
8882
8878
|
if (C > 0)
|
|
8883
8879
|
Me(t, !0), Me(s, C + yc(C, S));
|
|
8884
8880
|
else if (C < 0) {
|
|
8885
|
-
const k =
|
|
8881
|
+
const k = It(y);
|
|
8886
8882
|
k.length > 0 && (C -= yc(-C, k)), Me(i, C);
|
|
8887
8883
|
}
|
|
8888
8884
|
}
|
|
@@ -8894,7 +8890,7 @@ const P0 = {
|
|
|
8894
8890
|
);
|
|
8895
8891
|
});
|
|
8896
8892
|
const b = en(s);
|
|
8897
|
-
|
|
8893
|
+
he(
|
|
8898
8894
|
U(
|
|
8899
8895
|
s,
|
|
8900
8896
|
Fe(x),
|
|
@@ -8965,7 +8961,7 @@ const P0 = {
|
|
|
8965
8961
|
})
|
|
8966
8962
|
)
|
|
8967
8963
|
);
|
|
8968
|
-
return
|
|
8964
|
+
return he(
|
|
8969
8965
|
U(
|
|
8970
8966
|
i,
|
|
8971
8967
|
Fe(x, h),
|
|
@@ -8974,7 +8970,7 @@ const P0 = {
|
|
|
8974
8970
|
if (dt(S.sizeTree))
|
|
8975
8971
|
return S;
|
|
8976
8972
|
let N = Sr();
|
|
8977
|
-
const E =
|
|
8973
|
+
const E = It(y);
|
|
8978
8974
|
let I = 0, _ = 0, D = 0;
|
|
8979
8975
|
for (; I < -C; ) {
|
|
8980
8976
|
D = E[_];
|
|
@@ -9040,19 +9036,19 @@ function O0(e) {
|
|
|
9040
9036
|
const _f = tt(
|
|
9041
9037
|
([{ groupIndices: e, sizes: t, totalCount: n }, { headerHeight: r, scrollTop: o }]) => {
|
|
9042
9038
|
const s = We(), i = We(), a = en(U(s, ae(O0)));
|
|
9043
|
-
return
|
|
9039
|
+
return he(
|
|
9044
9040
|
U(
|
|
9045
9041
|
a,
|
|
9046
9042
|
ae((l) => l.totalCount)
|
|
9047
9043
|
),
|
|
9048
9044
|
n
|
|
9049
|
-
),
|
|
9045
|
+
), he(
|
|
9050
9046
|
U(
|
|
9051
9047
|
a,
|
|
9052
9048
|
ae((l) => l.groupIndices)
|
|
9053
9049
|
),
|
|
9054
9050
|
e
|
|
9055
|
-
),
|
|
9051
|
+
), he(
|
|
9056
9052
|
U(
|
|
9057
9053
|
_t(o, t, r),
|
|
9058
9054
|
Ie(([l, c]) => Us(c)),
|
|
@@ -9074,7 +9070,7 @@ const _f = tt(
|
|
|
9074
9070
|
)
|
|
9075
9071
|
);
|
|
9076
9072
|
return it(t, (r) => {
|
|
9077
|
-
r &&
|
|
9073
|
+
r && It(e)("props updated", {}, Xt.DEBUG);
|
|
9078
9074
|
}), { didMount: n, propsReady: t };
|
|
9079
9075
|
},
|
|
9080
9076
|
xt(qn),
|
|
@@ -9104,7 +9100,7 @@ const vo = tt(
|
|
|
9104
9100
|
function b() {
|
|
9105
9101
|
y && (y(), y = null), w && (w(), w = null), m && (clearTimeout(m), m = null), Me(l, !1);
|
|
9106
9102
|
}
|
|
9107
|
-
return
|
|
9103
|
+
return he(
|
|
9108
9104
|
U(
|
|
9109
9105
|
h,
|
|
9110
9106
|
Fe(n, f, r, x, a, i, p),
|
|
@@ -9119,15 +9115,15 @@ const vo = tt(
|
|
|
9119
9115
|
const $ = Pf(T), { align: A, behavior: B, offset: L } = $, M = k - 1, J = jf($, C, M);
|
|
9120
9116
|
let Y = so(J, C.offsetTree, D) + E;
|
|
9121
9117
|
A === "end" ? (Y += F + gn(C.sizeTree, J)[1] - S + j, J === M && (Y += I)) : A === "center" ? Y += (F + gn(C.sizeTree, J)[1] - S + j) / 2 : Y -= N, L && (Y += L);
|
|
9122
|
-
const de = (
|
|
9123
|
-
b(),
|
|
9118
|
+
const de = (Re) => {
|
|
9119
|
+
b(), Re ? (_("retrying to scroll to", { location: T }, Xt.DEBUG), Me(h, T)) : (Me(g, !0), _("list did not change, scroll successful", {}, Xt.DEBUG));
|
|
9124
9120
|
};
|
|
9125
9121
|
if (b(), B === "smooth") {
|
|
9126
|
-
let
|
|
9122
|
+
let Re = !1;
|
|
9127
9123
|
w = it(t, (Ae) => {
|
|
9128
|
-
|
|
9124
|
+
Re = Re || Ae;
|
|
9129
9125
|
}), y = pn(d, () => {
|
|
9130
|
-
de(
|
|
9126
|
+
de(Re);
|
|
9131
9127
|
});
|
|
9132
9128
|
} else
|
|
9133
9129
|
y = pn(U(t, D0(150)), de);
|
|
@@ -9169,7 +9165,7 @@ function Wa(e, t) {
|
|
|
9169
9165
|
const wo = tt(
|
|
9170
9166
|
([{ defaultItemSize: e, listRefresh: t, sizes: n }, { scrollTop: r }, { scrollTargetReached: o, scrollToIndex: s }, { didMount: i }]) => {
|
|
9171
9167
|
const a = X(!0), l = X(0), c = X(!0);
|
|
9172
|
-
return
|
|
9168
|
+
return he(
|
|
9173
9169
|
U(
|
|
9174
9170
|
i,
|
|
9175
9171
|
Fe(l),
|
|
@@ -9177,7 +9173,7 @@ const wo = tt(
|
|
|
9177
9173
|
wn(!1)
|
|
9178
9174
|
),
|
|
9179
9175
|
a
|
|
9180
|
-
),
|
|
9176
|
+
), he(
|
|
9181
9177
|
U(
|
|
9182
9178
|
i,
|
|
9183
9179
|
Fe(l),
|
|
@@ -9225,7 +9221,7 @@ const io = "up", Vr = "down", L0 = "none", F0 = {
|
|
|
9225
9221
|
}, $0 = 0, bo = tt(([{ footerHeight: e, headerHeight: t, scrollBy: n, scrollContainerState: r, scrollTop: o, viewportHeight: s }]) => {
|
|
9226
9222
|
const i = X(!1), a = X(!0), l = We(), c = We(), d = X(4), f = X($0), p = Ht(
|
|
9227
9223
|
U(
|
|
9228
|
-
Yi(U(
|
|
9224
|
+
Yi(U(ke(o), ar(1), wn(!0)), U(ke(o), ar(1), wn(!1), mc(100))),
|
|
9229
9225
|
gt()
|
|
9230
9226
|
),
|
|
9231
9227
|
!1
|
|
@@ -9233,17 +9229,17 @@ const io = "up", Vr = "down", L0 = "none", F0 = {
|
|
|
9233
9229
|
U(Yi(U(n, wn(!0)), U(n, wn(!1), mc(200))), gt()),
|
|
9234
9230
|
!1
|
|
9235
9231
|
);
|
|
9236
|
-
|
|
9232
|
+
he(
|
|
9237
9233
|
U(
|
|
9238
|
-
_t(
|
|
9234
|
+
_t(ke(o), ke(f)),
|
|
9239
9235
|
ae(([w, b]) => w <= b),
|
|
9240
9236
|
gt()
|
|
9241
9237
|
),
|
|
9242
9238
|
a
|
|
9243
|
-
),
|
|
9239
|
+
), he(U(a, An(50)), c);
|
|
9244
9240
|
const g = en(
|
|
9245
9241
|
U(
|
|
9246
|
-
_t(r,
|
|
9242
|
+
_t(r, ke(s), ke(t), ke(e), ke(d)),
|
|
9247
9243
|
Cn((w, [{ scrollHeight: b, scrollTop: T }, C, S, k, N]) => {
|
|
9248
9244
|
const E = T + C - b > -N, I = {
|
|
9249
9245
|
scrollHeight: b,
|
|
@@ -9302,36 +9298,36 @@ const io = "up", Vr = "down", L0 = "none", F0 = {
|
|
|
9302
9298
|
),
|
|
9303
9299
|
0
|
|
9304
9300
|
);
|
|
9305
|
-
|
|
9301
|
+
he(
|
|
9306
9302
|
U(
|
|
9307
9303
|
g,
|
|
9308
9304
|
ae((w) => w.atBottom)
|
|
9309
9305
|
),
|
|
9310
9306
|
i
|
|
9311
|
-
),
|
|
9307
|
+
), he(U(i, An(50)), l);
|
|
9312
9308
|
const y = X(Vr);
|
|
9313
|
-
|
|
9309
|
+
he(
|
|
9314
9310
|
U(
|
|
9315
9311
|
r,
|
|
9316
9312
|
ae(({ scrollTop: w }) => w),
|
|
9317
9313
|
gt(),
|
|
9318
9314
|
Cn(
|
|
9319
|
-
(w, b) =>
|
|
9315
|
+
(w, b) => It(h) ? { direction: w.direction, prevScrollTop: b } : { direction: b < w.prevScrollTop ? io : Vr, prevScrollTop: b },
|
|
9320
9316
|
{ direction: Vr, prevScrollTop: 0 }
|
|
9321
9317
|
),
|
|
9322
9318
|
ae((w) => w.direction)
|
|
9323
9319
|
),
|
|
9324
9320
|
y
|
|
9325
|
-
),
|
|
9321
|
+
), he(U(r, An(50), wn(L0)), y);
|
|
9326
9322
|
const m = X(0);
|
|
9327
|
-
return
|
|
9323
|
+
return he(
|
|
9328
9324
|
U(
|
|
9329
9325
|
p,
|
|
9330
9326
|
Ie((w) => !w),
|
|
9331
9327
|
wn(0)
|
|
9332
9328
|
),
|
|
9333
9329
|
m
|
|
9334
|
-
),
|
|
9330
|
+
), he(
|
|
9335
9331
|
U(
|
|
9336
9332
|
o,
|
|
9337
9333
|
An(100),
|
|
@@ -9367,15 +9363,15 @@ const Va = tt(
|
|
|
9367
9363
|
const s = We(), i = X(0), a = X(0), l = X(0), c = Ht(
|
|
9368
9364
|
U(
|
|
9369
9365
|
_t(
|
|
9370
|
-
|
|
9371
|
-
|
|
9372
|
-
|
|
9373
|
-
|
|
9374
|
-
|
|
9375
|
-
|
|
9376
|
-
|
|
9377
|
-
|
|
9378
|
-
|
|
9366
|
+
ke(r),
|
|
9367
|
+
ke(o),
|
|
9368
|
+
ke(n),
|
|
9369
|
+
ke(s, oo),
|
|
9370
|
+
ke(l),
|
|
9371
|
+
ke(i),
|
|
9372
|
+
ke(t),
|
|
9373
|
+
ke(e),
|
|
9374
|
+
ke(a)
|
|
9379
9375
|
),
|
|
9380
9376
|
ae(
|
|
9381
9377
|
([
|
|
@@ -9512,20 +9508,20 @@ const hr = tt(
|
|
|
9512
9508
|
{ recalcInProgress: g }
|
|
9513
9509
|
]) => {
|
|
9514
9510
|
const x = X([]), y = X(0), m = We();
|
|
9515
|
-
|
|
9511
|
+
he(s.topItemsIndexes, x);
|
|
9516
9512
|
const w = Ht(
|
|
9517
9513
|
U(
|
|
9518
9514
|
_t(
|
|
9519
9515
|
h,
|
|
9520
9516
|
g,
|
|
9521
|
-
|
|
9522
|
-
|
|
9523
|
-
|
|
9524
|
-
|
|
9517
|
+
ke(l, oo),
|
|
9518
|
+
ke(o),
|
|
9519
|
+
ke(r),
|
|
9520
|
+
ke(c),
|
|
9525
9521
|
d,
|
|
9526
|
-
|
|
9527
|
-
|
|
9528
|
-
|
|
9522
|
+
ke(x),
|
|
9523
|
+
ke(t),
|
|
9524
|
+
ke(n),
|
|
9529
9525
|
e
|
|
9530
9526
|
),
|
|
9531
9527
|
Ie(([S, k, , N, , , , , , , E]) => {
|
|
@@ -9546,7 +9542,7 @@ const hr = tt(
|
|
|
9546
9542
|
j,
|
|
9547
9543
|
$
|
|
9548
9544
|
]) => {
|
|
9549
|
-
const A = E, { offsetTree: B, sizeTree: L } = A, M =
|
|
9545
|
+
const A = E, { offsetTree: B, sizeTree: L } = A, M = It(y);
|
|
9550
9546
|
if (N === 0)
|
|
9551
9547
|
return { ...Ti, totalCount: N };
|
|
9552
9548
|
if (S === 0 && k === 0)
|
|
@@ -9575,7 +9571,7 @@ const hr = tt(
|
|
|
9575
9571
|
const Y = D.length > 0 ? D[D.length - 1] + 1 : 0, de = I0(B, S, k, Y);
|
|
9576
9572
|
if (de.length === 0)
|
|
9577
9573
|
return null;
|
|
9578
|
-
const
|
|
9574
|
+
const Re = N - 1, Ae = Bs([], (G) => {
|
|
9579
9575
|
for (const te of de) {
|
|
9580
9576
|
const q = te.value;
|
|
9581
9577
|
let P = q.offset, H = te.start;
|
|
@@ -9586,7 +9582,7 @@ const hr = tt(
|
|
|
9586
9582
|
P += ne * Z + ne * j;
|
|
9587
9583
|
}
|
|
9588
9584
|
H < Y && (P += (Y - H) * Z, H = Y);
|
|
9589
|
-
const oe = Math.min(te.end,
|
|
9585
|
+
const oe = Math.min(te.end, Re);
|
|
9590
9586
|
for (let ne = H; ne <= oe && !(P >= k); ne++)
|
|
9591
9587
|
G.push({ data: $ == null ? void 0 : $[ne], index: ne, offset: P, size: Z }), P += Z + j;
|
|
9592
9588
|
}
|
|
@@ -9600,26 +9596,26 @@ const hr = tt(
|
|
|
9600
9596
|
),
|
|
9601
9597
|
Ti
|
|
9602
9598
|
);
|
|
9603
|
-
|
|
9599
|
+
he(
|
|
9604
9600
|
U(
|
|
9605
9601
|
e,
|
|
9606
9602
|
Ie(Fa),
|
|
9607
9603
|
ae((S) => S == null ? void 0 : S.length)
|
|
9608
9604
|
),
|
|
9609
9605
|
o
|
|
9610
|
-
),
|
|
9606
|
+
), he(
|
|
9611
9607
|
U(
|
|
9612
9608
|
w,
|
|
9613
9609
|
ae((S) => S.topListHeight)
|
|
9614
9610
|
),
|
|
9615
9611
|
f
|
|
9616
|
-
),
|
|
9612
|
+
), he(f, a), he(
|
|
9617
9613
|
U(
|
|
9618
9614
|
w,
|
|
9619
9615
|
ae((S) => [S.top, S.bottom])
|
|
9620
9616
|
),
|
|
9621
9617
|
i
|
|
9622
|
-
),
|
|
9618
|
+
), he(
|
|
9623
9619
|
U(
|
|
9624
9620
|
w,
|
|
9625
9621
|
ae((S) => S.items)
|
|
@@ -9684,7 +9680,7 @@ const hr = tt(
|
|
|
9684
9680
|
),
|
|
9685
9681
|
0
|
|
9686
9682
|
);
|
|
9687
|
-
return
|
|
9683
|
+
return he(ke(i), s), { totalListHeight: i, totalListHeightChanged: s };
|
|
9688
9684
|
},
|
|
9689
9685
|
xt(Wt, hr),
|
|
9690
9686
|
{ singleton: !0 }
|
|
@@ -9719,7 +9715,7 @@ const hr = tt(
|
|
|
9719
9715
|
{ scrollToIndex: c }
|
|
9720
9716
|
]) => {
|
|
9721
9717
|
const d = We();
|
|
9722
|
-
return
|
|
9718
|
+
return he(
|
|
9723
9719
|
U(
|
|
9724
9720
|
d,
|
|
9725
9721
|
Fe(t, l, n, s, o, r, a),
|
|
@@ -9738,7 +9734,7 @@ const hr = tt(
|
|
|
9738
9734
|
Ie(($) => !$),
|
|
9739
9735
|
// skips the initial publish of false, and the cleanup call.
|
|
9740
9736
|
// but if scrollingInProgress is true, we skip the initial publish.
|
|
9741
|
-
ar(
|
|
9737
|
+
ar(It(i) ? 1 : 2)
|
|
9742
9738
|
),
|
|
9743
9739
|
k
|
|
9744
9740
|
) : k && k(), j;
|
|
@@ -9779,8 +9775,8 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = tt(
|
|
|
9779
9775
|
}
|
|
9780
9776
|
it(
|
|
9781
9777
|
U(
|
|
9782
|
-
_t(U(
|
|
9783
|
-
Fe(
|
|
9778
|
+
_t(U(ke(t), ar(1)), l),
|
|
9779
|
+
Fe(ke(g), s, a, f),
|
|
9784
9780
|
ae(([[C, S], k, N, E, I]) => {
|
|
9785
9781
|
let _ = S && E, D = "auto";
|
|
9786
9782
|
return _ && (D = U0(k, N || I), _ = _ && !!D), { followOutputBehavior: D, shouldFollow: _, totalCount: C };
|
|
@@ -9788,22 +9784,22 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = tt(
|
|
|
9788
9784
|
Ie(({ shouldFollow: C }) => C)
|
|
9789
9785
|
),
|
|
9790
9786
|
({ followOutputBehavior: C, totalCount: S }) => {
|
|
9791
|
-
y && (y(), y = null),
|
|
9792
|
-
|
|
9787
|
+
y && (y(), y = null), It(n) ? requestAnimationFrame(() => {
|
|
9788
|
+
It(d)("following output to ", { totalCount: S }, Xt.DEBUG), m(C);
|
|
9793
9789
|
}) : y = pn(e, () => {
|
|
9794
|
-
|
|
9790
|
+
It(d)("following output to ", { totalCount: S }, Xt.DEBUG), m(C), y = null;
|
|
9795
9791
|
});
|
|
9796
9792
|
}
|
|
9797
9793
|
);
|
|
9798
9794
|
function w(C) {
|
|
9799
9795
|
const S = pn(o, (k) => {
|
|
9800
|
-
C && !k.atBottom && k.notAtBottomBecause === "SIZE_INCREASED" && !y && (
|
|
9796
|
+
C && !k.atBottom && k.notAtBottomBecause === "SIZE_INCREASED" && !y && (It(d)("scrolling to bottom due to increased size", {}, Xt.DEBUG), m("auto"));
|
|
9801
9797
|
});
|
|
9802
9798
|
setTimeout(S, 100);
|
|
9803
9799
|
}
|
|
9804
9800
|
it(
|
|
9805
9801
|
U(
|
|
9806
|
-
_t(
|
|
9802
|
+
_t(ke(g), t, c),
|
|
9807
9803
|
Ie(([C, , S]) => C && S),
|
|
9808
9804
|
Cn(
|
|
9809
9805
|
({ value: C }, [, S]) => ({ refreshed: C === S, value: S }),
|
|
@@ -9813,39 +9809,39 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = tt(
|
|
|
9813
9809
|
Fe(g, t)
|
|
9814
9810
|
),
|
|
9815
9811
|
([, C]) => {
|
|
9816
|
-
|
|
9812
|
+
It(a) && w(C !== !1);
|
|
9817
9813
|
}
|
|
9818
9814
|
), it(x, () => {
|
|
9819
|
-
w(
|
|
9820
|
-
}), it(_t(
|
|
9815
|
+
w(It(g) !== !1);
|
|
9816
|
+
}), it(_t(ke(g), o), ([C, S]) => {
|
|
9821
9817
|
C && !S.atBottom && S.notAtBottomBecause === "VIEWPORT_HEIGHT_DECREASING" && m("auto");
|
|
9822
9818
|
});
|
|
9823
9819
|
const b = X(null), T = We();
|
|
9824
|
-
return
|
|
9820
|
+
return he(
|
|
9825
9821
|
Yi(
|
|
9826
9822
|
U(
|
|
9827
|
-
|
|
9823
|
+
ke(r),
|
|
9828
9824
|
ae((C) => {
|
|
9829
9825
|
var S;
|
|
9830
9826
|
return (S = C == null ? void 0 : C.length) != null ? S : 0;
|
|
9831
9827
|
})
|
|
9832
9828
|
),
|
|
9833
|
-
U(
|
|
9829
|
+
U(ke(t))
|
|
9834
9830
|
),
|
|
9835
9831
|
T
|
|
9836
9832
|
), it(
|
|
9837
9833
|
U(
|
|
9838
9834
|
_t(U(T, ar(1)), l),
|
|
9839
|
-
Fe(
|
|
9835
|
+
Fe(ke(b), a, f, p),
|
|
9840
9836
|
ae(([[C, S], k, N, E, I]) => S && N && (k == null ? void 0 : k({ context: I, totalCount: C, scrollingInProgress: E }))),
|
|
9841
9837
|
Ie((C) => !!C),
|
|
9842
9838
|
An(0)
|
|
9843
9839
|
),
|
|
9844
9840
|
(C) => {
|
|
9845
|
-
y && (y(), y = null),
|
|
9846
|
-
|
|
9841
|
+
y && (y(), y = null), It(n) ? requestAnimationFrame(() => {
|
|
9842
|
+
It(d)("scrolling into view", {}), Me(h, C);
|
|
9847
9843
|
}) : y = pn(e, () => {
|
|
9848
|
-
|
|
9844
|
+
It(d)("scrolling into view", {}), Me(h, C), y = null;
|
|
9849
9845
|
});
|
|
9850
9846
|
}
|
|
9851
9847
|
), { autoscrollToBottom: x, followOutput: g, scrollIntoViewOnChange: b };
|
|
@@ -9862,7 +9858,7 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = tt(
|
|
|
9862
9858
|
Ff
|
|
9863
9859
|
)
|
|
9864
9860
|
), V0 = tt(
|
|
9865
|
-
([{ data: e, firstItemIndex: t, gap: n, sizes: r }, { initialTopMostItemIndex: o }, { initialItemCount: s, listState: i }, { didMount: a }]) => (
|
|
9861
|
+
([{ data: e, firstItemIndex: t, gap: n, sizes: r }, { initialTopMostItemIndex: o }, { initialItemCount: s, listState: i }, { didMount: a }]) => (he(
|
|
9866
9862
|
U(
|
|
9867
9863
|
a,
|
|
9868
9864
|
Fe(s),
|
|
@@ -9907,7 +9903,7 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = tt(
|
|
|
9907
9903
|
), $f = tt(
|
|
9908
9904
|
([{ scrollVelocity: e }]) => {
|
|
9909
9905
|
const t = X(!1), n = We(), r = X(!1);
|
|
9910
|
-
return
|
|
9906
|
+
return he(
|
|
9911
9907
|
U(
|
|
9912
9908
|
e,
|
|
9913
9909
|
Fe(r, t, n),
|
|
@@ -9935,7 +9931,7 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = tt(
|
|
|
9935
9931
|
{ singleton: !0 }
|
|
9936
9932
|
), Ka = tt(([{ scrollContainerState: e, scrollTo: t }]) => {
|
|
9937
9933
|
const n = We(), r = We(), o = We(), s = X(!1), i = X(void 0);
|
|
9938
|
-
return
|
|
9934
|
+
return he(
|
|
9939
9935
|
U(
|
|
9940
9936
|
_t(n, r),
|
|
9941
9937
|
ae(([{ scrollHeight: a, scrollTop: l, viewportHeight: c }, { offsetTop: d }]) => ({
|
|
@@ -9945,7 +9941,7 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = tt(
|
|
|
9945
9941
|
}))
|
|
9946
9942
|
),
|
|
9947
9943
|
e
|
|
9948
|
-
),
|
|
9944
|
+
), he(
|
|
9949
9945
|
U(
|
|
9950
9946
|
t,
|
|
9951
9947
|
Fe(r),
|
|
@@ -9974,7 +9970,7 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = tt(
|
|
|
9974
9970
|
{ useWindowScroll: i, windowScrollContainerState: a, windowViewportRect: l }
|
|
9975
9971
|
]) => {
|
|
9976
9972
|
const c = We(), d = X(void 0), f = X(null), p = X(null);
|
|
9977
|
-
return
|
|
9973
|
+
return he(a, f), he(l, p), it(
|
|
9978
9974
|
U(
|
|
9979
9975
|
c,
|
|
9980
9976
|
Fe(t, r, i, f, p, n)
|
|
@@ -9983,7 +9979,7 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = tt(
|
|
|
9983
9979
|
const T = A0(g.sizeTree);
|
|
9984
9980
|
y && m !== null && w !== null && (x = m.scrollTop - w.offsetTop), x -= b, h({ ranges: T, scrollTop: x });
|
|
9985
9981
|
}
|
|
9986
|
-
),
|
|
9982
|
+
), he(U(d, Ie(Fa), ae(G0)), o), he(
|
|
9987
9983
|
U(
|
|
9988
9984
|
s,
|
|
9989
9985
|
Fe(d),
|
|
@@ -10004,7 +10000,7 @@ function G0(e) {
|
|
|
10004
10000
|
}
|
|
10005
10001
|
const Y0 = tt(([{ topItemsIndexes: e }]) => {
|
|
10006
10002
|
const t = X(0);
|
|
10007
|
-
return
|
|
10003
|
+
return he(
|
|
10008
10004
|
U(
|
|
10009
10005
|
t,
|
|
10010
10006
|
Ie((n) => n >= 0),
|
|
@@ -10057,7 +10053,7 @@ const X0 = zf(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
|
|
|
10057
10053
|
An(1)
|
|
10058
10054
|
),
|
|
10059
10055
|
y
|
|
10060
|
-
),
|
|
10056
|
+
), he(
|
|
10061
10057
|
U(
|
|
10062
10058
|
f,
|
|
10063
10059
|
ae((m) => ({ top: -m }))
|
|
@@ -10161,7 +10157,7 @@ const X0 = zf(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
|
|
|
10161
10157
|
{ topItemCount: k },
|
|
10162
10158
|
{ groupCounts: N },
|
|
10163
10159
|
E
|
|
10164
|
-
]) => (
|
|
10160
|
+
]) => (he(T.rangeChanged, E.scrollSeekRangeChanged), he(
|
|
10165
10161
|
U(
|
|
10166
10162
|
E.windowViewportRect,
|
|
10167
10163
|
ae((I) => I.visibleHeight)
|
|
@@ -10277,11 +10273,11 @@ function Hf(e, t, n) {
|
|
|
10277
10273
|
);
|
|
10278
10274
|
return z.useSyncExternalStore(
|
|
10279
10275
|
w,
|
|
10280
|
-
() =>
|
|
10281
|
-
() =>
|
|
10276
|
+
() => It(m),
|
|
10277
|
+
() => It(m)
|
|
10282
10278
|
);
|
|
10283
10279
|
}, g = (y) => {
|
|
10284
|
-
const m = z.useContext(a)[y], [w, b] = z.useState(hc(
|
|
10280
|
+
const m = z.useContext(a)[y], [w, b] = z.useState(hc(It, m));
|
|
10285
10281
|
return _o(
|
|
10286
10282
|
() => it(m, (T) => {
|
|
10287
10283
|
T !== w && b(pc(T));
|
|
@@ -10775,7 +10771,7 @@ const TS = /* @__PURE__ */ tt(
|
|
|
10775
10771
|
Me(t, [0, 0]), Me(J, !0);
|
|
10776
10772
|
});
|
|
10777
10773
|
}
|
|
10778
|
-
),
|
|
10774
|
+
), he(
|
|
10779
10775
|
U(
|
|
10780
10776
|
B,
|
|
10781
10777
|
Ie((P) => P != null && P.scrollTop > 0),
|
|
@@ -10793,19 +10789,19 @@ const TS = /* @__PURE__ */ tt(
|
|
|
10793
10789
|
Me(L, !1);
|
|
10794
10790
|
}), Me(l, { top: P.scrollTop })));
|
|
10795
10791
|
}
|
|
10796
|
-
),
|
|
10792
|
+
), he(
|
|
10797
10793
|
U(
|
|
10798
10794
|
E,
|
|
10799
10795
|
ae(({ height: P }) => P)
|
|
10800
10796
|
),
|
|
10801
10797
|
f
|
|
10802
|
-
),
|
|
10798
|
+
), he(
|
|
10803
10799
|
U(
|
|
10804
10800
|
_t(
|
|
10805
|
-
|
|
10806
|
-
|
|
10807
|
-
|
|
10808
|
-
|
|
10801
|
+
ke(E, Po),
|
|
10802
|
+
ke(I, Po),
|
|
10803
|
+
ke($, (P, H) => P && P.column === H.column && P.row === H.row),
|
|
10804
|
+
ke(c)
|
|
10809
10805
|
),
|
|
10810
10806
|
ae(([P, H, Z, oe]) => ({
|
|
10811
10807
|
gap: Z,
|
|
@@ -10815,19 +10811,19 @@ const TS = /* @__PURE__ */ tt(
|
|
|
10815
10811
|
}))
|
|
10816
10812
|
),
|
|
10817
10813
|
A
|
|
10818
|
-
),
|
|
10814
|
+
), he(
|
|
10819
10815
|
U(
|
|
10820
10816
|
_t(
|
|
10821
|
-
|
|
10817
|
+
ke(S),
|
|
10822
10818
|
r,
|
|
10823
|
-
|
|
10824
|
-
|
|
10825
|
-
|
|
10826
|
-
|
|
10827
|
-
|
|
10828
|
-
|
|
10829
|
-
|
|
10830
|
-
|
|
10819
|
+
ke($, CS),
|
|
10820
|
+
ke(I, Po),
|
|
10821
|
+
ke(E, Po),
|
|
10822
|
+
ke(j),
|
|
10823
|
+
ke(k),
|
|
10824
|
+
ke(L),
|
|
10825
|
+
ke(J),
|
|
10826
|
+
ke(M)
|
|
10831
10827
|
),
|
|
10832
10828
|
Ie(([, , , , , , , P]) => !P),
|
|
10833
10829
|
ae(
|
|
@@ -10853,20 +10849,20 @@ const TS = /* @__PURE__ */ tt(
|
|
|
10853
10849
|
const Ze = Xf(qe, $e, Ke);
|
|
10854
10850
|
let Qe, rt;
|
|
10855
10851
|
xe ? H === 0 && Z === 0 && ue > 0 ? (Qe = 0, rt = ue - 1) : (Qe = Ze * as((H + Je) / (Be + Je)), rt = Ze * Ec((Z + Je) / (Be + Je)) - 1, rt = Ei(P - 1, Kr(rt, Ze - 1)), Qe = Ei(rt, Kr(0, Qe))) : (Qe = 0, rt = -1);
|
|
10856
|
-
const
|
|
10857
|
-
return { bottom: pt, itemHeight: Be, items:
|
|
10852
|
+
const Ct = Nc(Qe, rt, ee), { bottom: pt, top: ot } = Ac(De, oe, ne, Ct), Tt = Ec(P / Ze), wt = Tt * Be + (Tt - 1) * Je - pt;
|
|
10853
|
+
return { bottom: pt, itemHeight: Be, items: Ct, itemWidth: $e, offsetBottom: wt, offsetTop: ot, top: ot };
|
|
10858
10854
|
}
|
|
10859
10855
|
)
|
|
10860
10856
|
),
|
|
10861
10857
|
N
|
|
10862
|
-
),
|
|
10858
|
+
), he(
|
|
10863
10859
|
U(
|
|
10864
10860
|
j,
|
|
10865
10861
|
Ie((P) => P !== null),
|
|
10866
10862
|
ae((P) => P.length)
|
|
10867
10863
|
),
|
|
10868
10864
|
S
|
|
10869
|
-
),
|
|
10865
|
+
), he(
|
|
10870
10866
|
U(
|
|
10871
10867
|
_t(E, I, N, $),
|
|
10872
10868
|
Ie(([P, H, { items: Z }]) => Z.length > 0 && H.height !== 0 && P.height !== 0),
|
|
@@ -10878,20 +10874,20 @@ const TS = /* @__PURE__ */ tt(
|
|
|
10878
10874
|
),
|
|
10879
10875
|
t
|
|
10880
10876
|
);
|
|
10881
|
-
const
|
|
10882
|
-
|
|
10877
|
+
const Re = X(!1);
|
|
10878
|
+
he(
|
|
10883
10879
|
U(
|
|
10884
10880
|
c,
|
|
10885
|
-
Fe(
|
|
10881
|
+
Fe(Re),
|
|
10886
10882
|
ae(([P, H]) => H || P !== 0)
|
|
10887
10883
|
),
|
|
10888
|
-
|
|
10884
|
+
Re
|
|
10889
10885
|
);
|
|
10890
10886
|
const Ae = en(
|
|
10891
10887
|
U(
|
|
10892
10888
|
_t(N, S),
|
|
10893
10889
|
Ie(([{ items: P }]) => P.length > 0),
|
|
10894
|
-
Fe(
|
|
10890
|
+
Fe(Re),
|
|
10895
10891
|
Ie(([[P, H], Z]) => {
|
|
10896
10892
|
const oe = P.items[P.items.length - 1].index === H - 1;
|
|
10897
10893
|
return (Z || P.bottom > 0 && P.itemHeight > 0 && P.offsetBottom === 0 && P.items.length === H) && oe;
|
|
@@ -10901,14 +10897,14 @@ const TS = /* @__PURE__ */ tt(
|
|
|
10901
10897
|
)
|
|
10902
10898
|
), G = en(
|
|
10903
10899
|
U(
|
|
10904
|
-
|
|
10900
|
+
ke(N),
|
|
10905
10901
|
Ie(({ items: P }) => P.length > 0 && P[0].index === 0),
|
|
10906
10902
|
wn(0),
|
|
10907
10903
|
gt()
|
|
10908
10904
|
)
|
|
10909
10905
|
), te = en(
|
|
10910
10906
|
U(
|
|
10911
|
-
|
|
10907
|
+
ke(N),
|
|
10912
10908
|
Fe(L),
|
|
10913
10909
|
Ie(([{ items: P }, H]) => P.length > 0 && !H),
|
|
10914
10910
|
ae(([{ items: P }]) => ({
|
|
@@ -10919,7 +10915,7 @@ const TS = /* @__PURE__ */ tt(
|
|
|
10919
10915
|
An(0)
|
|
10920
10916
|
)
|
|
10921
10917
|
);
|
|
10922
|
-
|
|
10918
|
+
he(te, h.scrollSeekRangeChanged), he(
|
|
10923
10919
|
U(
|
|
10924
10920
|
_,
|
|
10925
10921
|
Fe(E, I, S, $),
|
|
@@ -10940,7 +10936,7 @@ const TS = /* @__PURE__ */ tt(
|
|
|
10940
10936
|
),
|
|
10941
10937
|
0
|
|
10942
10938
|
);
|
|
10943
|
-
return
|
|
10939
|
+
return he(
|
|
10944
10940
|
U(
|
|
10945
10941
|
T,
|
|
10946
10942
|
ae((P) => ({ height: P.visibleHeight, width: P.visibleWidth }))
|
|
@@ -11013,7 +11009,7 @@ const kS = /* @__PURE__ */ tt(() => {
|
|
|
11013
11009
|
),
|
|
11014
11010
|
p
|
|
11015
11011
|
), c = X(!1), d = X(!1);
|
|
11016
|
-
return
|
|
11012
|
+
return he(ke(d), c), {
|
|
11017
11013
|
components: t,
|
|
11018
11014
|
computeItemKey: s,
|
|
11019
11015
|
context: n,
|
|
@@ -11795,7 +11791,7 @@ function oC({ isOpen: e, onClose: t, fileId: n, fileName: r, mimeType: o }) {
|
|
|
11795
11791
|
}
|
|
11796
11792
|
}
|
|
11797
11793
|
}, [n]);
|
|
11798
|
-
|
|
11794
|
+
Nt(() => {
|
|
11799
11795
|
e && n && p();
|
|
11800
11796
|
}, [e, n, p]);
|
|
11801
11797
|
const h = async () => {
|
|
@@ -12480,7 +12476,7 @@ class tl {
|
|
|
12480
12476
|
}
|
|
12481
12477
|
}
|
|
12482
12478
|
}
|
|
12483
|
-
const
|
|
12479
|
+
const we = {
|
|
12484
12480
|
newline: /^(?: *(?:\n|$))+/,
|
|
12485
12481
|
code: /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,
|
|
12486
12482
|
fences: /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,
|
|
@@ -12497,37 +12493,37 @@ const ve = {
|
|
|
12497
12493
|
_paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,
|
|
12498
12494
|
text: /^[^\n]+/
|
|
12499
12495
|
};
|
|
12500
|
-
|
|
12501
|
-
|
|
12502
|
-
|
|
12503
|
-
|
|
12504
|
-
|
|
12505
|
-
|
|
12506
|
-
|
|
12507
|
-
|
|
12508
|
-
|
|
12509
|
-
|
|
12510
|
-
|
|
12511
|
-
|
|
12512
|
-
|
|
12513
|
-
...
|
|
12496
|
+
we._label = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
|
|
12497
|
+
we._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
|
|
12498
|
+
we.def = ft(we.def).replace("label", we._label).replace("title", we._title).getRegex();
|
|
12499
|
+
we.bullet = /(?:[*+-]|\d{1,9}[.)])/;
|
|
12500
|
+
we.listItemStart = ft(/^( *)(bull) */).replace("bull", we.bullet).getRegex();
|
|
12501
|
+
we.list = ft(we.list).replace(/bull/g, we.bullet).replace("hr", "\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def", "\\n+(?=" + we.def.source + ")").getRegex();
|
|
12502
|
+
we._tag = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";
|
|
12503
|
+
we._comment = /<!--(?!-?>)[\s\S]*?(?:-->|$)/;
|
|
12504
|
+
we.html = ft(we.html, "i").replace("comment", we._comment).replace("tag", we._tag).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
|
|
12505
|
+
we.paragraph = ft(we._paragraph).replace("hr", we.hr).replace("heading", " {0,3}#{1,6} ").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", we._tag).getRegex();
|
|
12506
|
+
we.blockquote = ft(we.blockquote).replace("paragraph", we.paragraph).getRegex();
|
|
12507
|
+
we.normal = { ...we };
|
|
12508
|
+
we.gfm = {
|
|
12509
|
+
...we.normal,
|
|
12514
12510
|
table: "^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"
|
|
12515
12511
|
// Cells
|
|
12516
12512
|
};
|
|
12517
|
-
|
|
12518
|
-
|
|
12519
|
-
|
|
12520
|
-
...
|
|
12513
|
+
we.gfm.table = ft(we.gfm.table).replace("hr", we.hr).replace("heading", " {0,3}#{1,6} ").replace("blockquote", " {0,3}>").replace("code", " {4}[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", we._tag).getRegex();
|
|
12514
|
+
we.gfm.paragraph = ft(we._paragraph).replace("hr", we.hr).replace("heading", " {0,3}#{1,6} ").replace("|lheading", "").replace("table", we.gfm.table).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", we._tag).getRegex();
|
|
12515
|
+
we.pedantic = {
|
|
12516
|
+
...we.normal,
|
|
12521
12517
|
html: ft(
|
|
12522
12518
|
`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`
|
|
12523
|
-
).replace("comment",
|
|
12519
|
+
).replace("comment", we._comment).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),
|
|
12524
12520
|
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
|
|
12525
12521
|
heading: /^(#{1,6})(.*)(?:\n+|$)/,
|
|
12526
12522
|
fences: us,
|
|
12527
12523
|
// fences not supported
|
|
12528
12524
|
lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
12529
|
-
paragraph: ft(
|
|
12530
|
-
]`).replace("lheading",
|
|
12525
|
+
paragraph: ft(we.normal._paragraph).replace("hr", we.hr).replace("heading", ` *#{1,6} *[^
|
|
12526
|
+
]`).replace("lheading", we.lheading).replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").getRegex()
|
|
12531
12527
|
};
|
|
12532
12528
|
const le = {
|
|
12533
12529
|
escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
|
|
@@ -12557,7 +12553,7 @@ le._punctuation = "!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~";
|
|
|
12557
12553
|
le.punctuation = ft(le.punctuation).replace(/punctuation/g, le._punctuation).getRegex();
|
|
12558
12554
|
le.blockSkip = /\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g;
|
|
12559
12555
|
le.escapedEmSt = /(?:^|[^\\])(?:\\\\)*\\[*_]/g;
|
|
12560
|
-
le._comment = ft(
|
|
12556
|
+
le._comment = ft(we._comment).replace("(?:-->|$)", "-->").getRegex();
|
|
12561
12557
|
le.emStrong.lDelim = ft(le.emStrong.lDelim).replace(/punct/g, le._punctuation).getRegex();
|
|
12562
12558
|
le.emStrong.rDelimAst = ft(le.emStrong.rDelimAst, "g").replace(/punct/g, le._punctuation).getRegex();
|
|
12563
12559
|
le.emStrong.rDelimUnd = ft(le.emStrong.rDelimUnd, "g").replace(/punct/g, le._punctuation).getRegex();
|
|
@@ -12571,8 +12567,8 @@ le._label = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
|
|
|
12571
12567
|
le._href = /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;
|
|
12572
12568
|
le._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;
|
|
12573
12569
|
le.link = ft(le.link).replace("label", le._label).replace("href", le._href).replace("title", le._title).getRegex();
|
|
12574
|
-
le.reflink = ft(le.reflink).replace("label", le._label).replace("ref",
|
|
12575
|
-
le.nolink = ft(le.nolink).replace("ref",
|
|
12570
|
+
le.reflink = ft(le.reflink).replace("label", le._label).replace("ref", we._label).getRegex();
|
|
12571
|
+
le.nolink = ft(le.nolink).replace("ref", we._label).getRegex();
|
|
12576
12572
|
le.reflinkSearch = ft(le.reflinkSearch, "g").replace("reflink", le.reflink).replace("nolink", le.nolink).getRegex();
|
|
12577
12573
|
le.normal = { ...le };
|
|
12578
12574
|
le.pedantic = {
|
|
@@ -12625,17 +12621,17 @@ class Wn {
|
|
|
12625
12621
|
top: !0
|
|
12626
12622
|
};
|
|
12627
12623
|
const n = {
|
|
12628
|
-
block:
|
|
12624
|
+
block: we.normal,
|
|
12629
12625
|
inline: le.normal
|
|
12630
12626
|
};
|
|
12631
|
-
this.options.pedantic ? (n.block =
|
|
12627
|
+
this.options.pedantic ? (n.block = we.pedantic, n.inline = le.pedantic) : this.options.gfm && (n.block = we.gfm, this.options.breaks ? n.inline = le.breaks : n.inline = le.gfm), this.tokenizer.rules = n;
|
|
12632
12628
|
}
|
|
12633
12629
|
/**
|
|
12634
12630
|
* Expose Rules
|
|
12635
12631
|
*/
|
|
12636
12632
|
static get rules() {
|
|
12637
12633
|
return {
|
|
12638
|
-
block:
|
|
12634
|
+
block: we,
|
|
12639
12635
|
inline: le
|
|
12640
12636
|
};
|
|
12641
12637
|
}
|
|
@@ -13271,7 +13267,7 @@ function _p(e, t) {
|
|
|
13271
13267
|
return (n, r, o) => {
|
|
13272
13268
|
typeof r == "function" && (o = r, r = null);
|
|
13273
13269
|
const s = { ...r };
|
|
13274
|
-
r = { ...
|
|
13270
|
+
r = { ...me.defaults, ...s };
|
|
13275
13271
|
const i = bC(r.silent, r.async, o);
|
|
13276
13272
|
if (typeof n > "u" || n === null)
|
|
13277
13273
|
return i(new Error("marked(): input parameter is undefined or null"));
|
|
@@ -13289,7 +13285,7 @@ function _p(e, t) {
|
|
|
13289
13285
|
let p;
|
|
13290
13286
|
if (!f)
|
|
13291
13287
|
try {
|
|
13292
|
-
r.walkTokens &&
|
|
13288
|
+
r.walkTokens && me.walkTokens(l, r.walkTokens), p = t(l, r), r.hooks && (p = r.hooks.postprocess(p));
|
|
13293
13289
|
} catch (h) {
|
|
13294
13290
|
f = h;
|
|
13295
13291
|
}
|
|
@@ -13297,7 +13293,7 @@ function _p(e, t) {
|
|
|
13297
13293
|
};
|
|
13298
13294
|
if (!a || a.length < 3 || (delete r.highlight, !l.length)) return c();
|
|
13299
13295
|
let d = 0;
|
|
13300
|
-
|
|
13296
|
+
me.walkTokens(l, function(f) {
|
|
13301
13297
|
f.type === "code" && (d++, setTimeout(() => {
|
|
13302
13298
|
a(f.text, f.lang, function(p, h) {
|
|
13303
13299
|
if (p)
|
|
@@ -13309,11 +13305,11 @@ function _p(e, t) {
|
|
|
13309
13305
|
return;
|
|
13310
13306
|
}
|
|
13311
13307
|
if (r.async)
|
|
13312
|
-
return Promise.resolve(r.hooks ? r.hooks.preprocess(n) : n).then((a) => e(a, r)).then((a) => r.walkTokens ? Promise.all(
|
|
13308
|
+
return Promise.resolve(r.hooks ? r.hooks.preprocess(n) : n).then((a) => e(a, r)).then((a) => r.walkTokens ? Promise.all(me.walkTokens(a, r.walkTokens)).then(() => a) : a).then((a) => t(a, r)).then((a) => r.hooks ? r.hooks.postprocess(a) : a).catch(i);
|
|
13313
13309
|
try {
|
|
13314
13310
|
r.hooks && (n = r.hooks.preprocess(n));
|
|
13315
13311
|
const a = e(n, r);
|
|
13316
|
-
r.walkTokens &&
|
|
13312
|
+
r.walkTokens && me.walkTokens(a, r.walkTokens);
|
|
13317
13313
|
let l = t(a, r);
|
|
13318
13314
|
return r.hooks && (l = r.hooks.postprocess(l)), l;
|
|
13319
13315
|
} catch (a) {
|
|
@@ -13321,19 +13317,19 @@ function _p(e, t) {
|
|
|
13321
13317
|
}
|
|
13322
13318
|
};
|
|
13323
13319
|
}
|
|
13324
|
-
function
|
|
13320
|
+
function me(e, t, n) {
|
|
13325
13321
|
return _p(Wn.lex, Vn.parse)(e, t, n);
|
|
13326
13322
|
}
|
|
13327
|
-
|
|
13328
|
-
return
|
|
13323
|
+
me.options = me.setOptions = function(e) {
|
|
13324
|
+
return me.defaults = { ...me.defaults, ...e }, sC(me.defaults), me;
|
|
13329
13325
|
};
|
|
13330
|
-
|
|
13331
|
-
|
|
13332
|
-
|
|
13333
|
-
const t =
|
|
13326
|
+
me.getDefaults = Rp;
|
|
13327
|
+
me.defaults = mr;
|
|
13328
|
+
me.use = function(...e) {
|
|
13329
|
+
const t = me.defaults.extensions || { renderers: {}, childTokens: {} };
|
|
13334
13330
|
e.forEach((n) => {
|
|
13335
13331
|
const r = { ...n };
|
|
13336
|
-
if (r.async =
|
|
13332
|
+
if (r.async = me.defaults.async || r.async || !1, n.extensions && (n.extensions.forEach((o) => {
|
|
13337
13333
|
if (!o.name)
|
|
13338
13334
|
throw new Error("extension name required");
|
|
13339
13335
|
if (o.renderer) {
|
|
@@ -13350,7 +13346,7 @@ he.use = function(...e) {
|
|
|
13350
13346
|
}
|
|
13351
13347
|
o.childTokens && (t.childTokens[o.name] = o.childTokens);
|
|
13352
13348
|
}), r.extensions = t), n.renderer) {
|
|
13353
|
-
const o =
|
|
13349
|
+
const o = me.defaults.renderer || new nl();
|
|
13354
13350
|
for (const s in n.renderer) {
|
|
13355
13351
|
const i = o[s];
|
|
13356
13352
|
o[s] = (...a) => {
|
|
@@ -13361,7 +13357,7 @@ he.use = function(...e) {
|
|
|
13361
13357
|
r.renderer = o;
|
|
13362
13358
|
}
|
|
13363
13359
|
if (n.tokenizer) {
|
|
13364
|
-
const o =
|
|
13360
|
+
const o = me.defaults.tokenizer || new tl();
|
|
13365
13361
|
for (const s in n.tokenizer) {
|
|
13366
13362
|
const i = o[s];
|
|
13367
13363
|
o[s] = (...a) => {
|
|
@@ -13372,11 +13368,11 @@ he.use = function(...e) {
|
|
|
13372
13368
|
r.tokenizer = o;
|
|
13373
13369
|
}
|
|
13374
13370
|
if (n.hooks) {
|
|
13375
|
-
const o =
|
|
13371
|
+
const o = me.defaults.hooks || new ds();
|
|
13376
13372
|
for (const s in n.hooks) {
|
|
13377
13373
|
const i = o[s];
|
|
13378
13374
|
ds.passThroughHooks.has(s) ? o[s] = (a) => {
|
|
13379
|
-
if (
|
|
13375
|
+
if (me.defaults.async)
|
|
13380
13376
|
return Promise.resolve(n.hooks[s].call(o, a)).then((c) => i.call(o, c));
|
|
13381
13377
|
const l = n.hooks[s].call(o, a);
|
|
13382
13378
|
return i.call(o, l);
|
|
@@ -13388,54 +13384,54 @@ he.use = function(...e) {
|
|
|
13388
13384
|
r.hooks = o;
|
|
13389
13385
|
}
|
|
13390
13386
|
if (n.walkTokens) {
|
|
13391
|
-
const o =
|
|
13387
|
+
const o = me.defaults.walkTokens;
|
|
13392
13388
|
r.walkTokens = function(s) {
|
|
13393
13389
|
let i = [];
|
|
13394
13390
|
return i.push(n.walkTokens.call(this, s)), o && (i = i.concat(o.call(this, s))), i;
|
|
13395
13391
|
};
|
|
13396
13392
|
}
|
|
13397
|
-
|
|
13393
|
+
me.setOptions(r);
|
|
13398
13394
|
});
|
|
13399
13395
|
};
|
|
13400
|
-
|
|
13396
|
+
me.walkTokens = function(e, t) {
|
|
13401
13397
|
let n = [];
|
|
13402
13398
|
for (const r of e)
|
|
13403
|
-
switch (n = n.concat(t.call(
|
|
13399
|
+
switch (n = n.concat(t.call(me, r)), r.type) {
|
|
13404
13400
|
case "table": {
|
|
13405
13401
|
for (const o of r.header)
|
|
13406
|
-
n = n.concat(
|
|
13402
|
+
n = n.concat(me.walkTokens(o.tokens, t));
|
|
13407
13403
|
for (const o of r.rows)
|
|
13408
13404
|
for (const s of o)
|
|
13409
|
-
n = n.concat(
|
|
13405
|
+
n = n.concat(me.walkTokens(s.tokens, t));
|
|
13410
13406
|
break;
|
|
13411
13407
|
}
|
|
13412
13408
|
case "list": {
|
|
13413
|
-
n = n.concat(
|
|
13409
|
+
n = n.concat(me.walkTokens(r.items, t));
|
|
13414
13410
|
break;
|
|
13415
13411
|
}
|
|
13416
13412
|
default:
|
|
13417
|
-
|
|
13418
|
-
n = n.concat(
|
|
13419
|
-
}) : r.tokens && (n = n.concat(
|
|
13413
|
+
me.defaults.extensions && me.defaults.extensions.childTokens && me.defaults.extensions.childTokens[r.type] ? me.defaults.extensions.childTokens[r.type].forEach(function(o) {
|
|
13414
|
+
n = n.concat(me.walkTokens(r[o], t));
|
|
13415
|
+
}) : r.tokens && (n = n.concat(me.walkTokens(r.tokens, t)));
|
|
13420
13416
|
}
|
|
13421
13417
|
return n;
|
|
13422
13418
|
};
|
|
13423
|
-
|
|
13424
|
-
|
|
13425
|
-
|
|
13426
|
-
|
|
13427
|
-
|
|
13428
|
-
|
|
13429
|
-
|
|
13430
|
-
|
|
13431
|
-
|
|
13432
|
-
|
|
13433
|
-
|
|
13434
|
-
|
|
13435
|
-
|
|
13436
|
-
|
|
13437
|
-
|
|
13438
|
-
|
|
13419
|
+
me.parseInline = _p(Wn.lexInline, Vn.parseInline);
|
|
13420
|
+
me.Parser = Vn;
|
|
13421
|
+
me.parser = Vn.parse;
|
|
13422
|
+
me.Renderer = nl;
|
|
13423
|
+
me.TextRenderer = Ap;
|
|
13424
|
+
me.Lexer = Wn;
|
|
13425
|
+
me.lexer = Wn.lex;
|
|
13426
|
+
me.Tokenizer = tl;
|
|
13427
|
+
me.Slugger = jp;
|
|
13428
|
+
me.Hooks = ds;
|
|
13429
|
+
me.parse = me;
|
|
13430
|
+
me.options;
|
|
13431
|
+
me.setOptions;
|
|
13432
|
+
me.use;
|
|
13433
|
+
me.walkTokens;
|
|
13434
|
+
me.parseInline;
|
|
13439
13435
|
Vn.parse;
|
|
13440
13436
|
Wn.lex;
|
|
13441
13437
|
function fs({
|
|
@@ -13448,9 +13444,9 @@ function fs({
|
|
|
13448
13444
|
try {
|
|
13449
13445
|
if (!n) {
|
|
13450
13446
|
const i = e.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, "").replace(/<iframe\b[^<]*(?:(?!<\/iframe>)<[^<]*)*<\/iframe>/gi, "").replace(/javascript:/gi, "").replace(/on\w+\s*=/gi, "");
|
|
13451
|
-
return typeof
|
|
13447
|
+
return typeof me.parse == "function" ? me.parse(i) : me(i);
|
|
13452
13448
|
}
|
|
13453
|
-
return typeof
|
|
13449
|
+
return typeof me.parse == "function" ? me.parse(e) : me(e);
|
|
13454
13450
|
} catch (i) {
|
|
13455
13451
|
return console.error("[MarkdownContent] parse error", i), `<pre class="font-mono text-xs bg-background/50 rounded border p-2 whitespace-pre-wrap break-words">Error rendering markdown: ${String(i)}</pre>`;
|
|
13456
13452
|
}
|
|
@@ -13557,7 +13553,7 @@ function zc(e) {
|
|
|
13557
13553
|
}
|
|
13558
13554
|
function RC({ className: e }) {
|
|
13559
13555
|
const [t, n] = ge(0);
|
|
13560
|
-
return
|
|
13556
|
+
return Nt(() => {
|
|
13561
13557
|
const r = setInterval(() => n((o) => (o + 1) % 4), 500);
|
|
13562
13558
|
return () => clearInterval(r);
|
|
13563
13559
|
}, []), /* @__PURE__ */ u.jsxs(
|
|
@@ -13599,13 +13595,13 @@ const Bc = z.memo(function({
|
|
|
13599
13595
|
defaultCheckpointId: N = null,
|
|
13600
13596
|
messageParentCheckpointId: E = null
|
|
13601
13597
|
}) {
|
|
13602
|
-
const [I, _] = ge(!1), [D, F] = ge("preview"), [j, $] = ge(!1), { currentThreadId: A } = xa(), { respondToInterrupt: B } = ya(), L = l === "phone" || l === "half-screen", M = t.role, J = M === "tool", Y = lt(() => "type" in t && t.type === "default_message" ? t : null, [t]), de = !!Y,
|
|
13598
|
+
const [I, _] = ge(!1), [D, F] = ge("preview"), [j, $] = ge(!1), { currentThreadId: A } = xa(), { respondToInterrupt: B } = ya(), L = l === "phone" || l === "half-screen", M = t.role, J = M === "tool", Y = lt(() => "type" in t && t.type === "default_message" ? t : null, [t]), de = !!Y, Re = !(r && M !== "user"), {
|
|
13603
13599
|
uploadingFiles: Ae,
|
|
13604
13600
|
handleFileClick: G,
|
|
13605
13601
|
fileViewerOpen: te,
|
|
13606
13602
|
currentFileInfo: q,
|
|
13607
13603
|
closeFileViewer: P
|
|
13608
|
-
} = IC({ allowFileOpen:
|
|
13604
|
+
} = IC({ allowFileOpen: Re, currentThreadId: A }), H = z.useMemo(() => {
|
|
13609
13605
|
switch (M) {
|
|
13610
13606
|
case "user":
|
|
13611
13607
|
return "text-[hsl(var(--chat-bubble-user-text))]";
|
|
@@ -13629,7 +13625,7 @@ const Bc = z.memo(function({
|
|
|
13629
13625
|
[Y, t]
|
|
13630
13626
|
), ue = (m == null ? void 0 : m.id) ?? (m == null ? void 0 : m.interrupt_id), xe = Mo(ue), Ne = m == null ? void 0 : m.value, Ke = lt(() => Y ? "" : TC(t.content), [Y, t]), Je = z.useCallback(async () => {
|
|
13631
13627
|
const W = J ? Ke : Z;
|
|
13632
|
-
async function
|
|
13628
|
+
async function Se(ye) {
|
|
13633
13629
|
if (navigator.clipboard && typeof navigator.clipboard.writeText == "function") {
|
|
13634
13630
|
await navigator.clipboard.writeText(ye);
|
|
13635
13631
|
return;
|
|
@@ -13646,30 +13642,30 @@ const Bc = z.memo(function({
|
|
|
13646
13642
|
throw new Error("Clipboard API not supported in this context.");
|
|
13647
13643
|
}
|
|
13648
13644
|
try {
|
|
13649
|
-
await
|
|
13645
|
+
await Se(W), _(!0), setTimeout(() => _(!1), 2e3), y == null || y(W);
|
|
13650
13646
|
} catch (ye) {
|
|
13651
13647
|
console.error("Failed to copy:", ye);
|
|
13652
13648
|
}
|
|
13653
13649
|
}, [J, Ke, Z, y]), Be = z.useCallback(() => {
|
|
13654
13650
|
if (!h) return;
|
|
13655
|
-
const W = J ? Ke : Z,
|
|
13651
|
+
const W = J ? Ke : Z, Se = "type" in t && t.type === "default_message" ? void 0 : {
|
|
13656
13652
|
checkpointId: t.checkpointId ?? null,
|
|
13657
13653
|
checkpointNs: t.checkpointNs ?? null
|
|
13658
13654
|
};
|
|
13659
|
-
h(t.id, W,
|
|
13655
|
+
h(t.id, W, Se);
|
|
13660
13656
|
}, [h, t.id, J, Ke, Z, t]), $e = z.useCallback(() => {
|
|
13661
13657
|
g == null || g(n);
|
|
13662
13658
|
}, [g, n]), qe = z.useCallback(() => {
|
|
13663
|
-
const
|
|
13659
|
+
const Se = Q(L ? "h-3 w-3" : "h-4 w-4", "opacity-60 flex-shrink-0", H);
|
|
13664
13660
|
switch (M) {
|
|
13665
13661
|
case "user":
|
|
13666
|
-
return /* @__PURE__ */ u.jsx(gm, { className:
|
|
13662
|
+
return /* @__PURE__ */ u.jsx(gm, { className: Se });
|
|
13667
13663
|
case "assistant":
|
|
13668
|
-
return /* @__PURE__ */ u.jsx(si, { className:
|
|
13664
|
+
return /* @__PURE__ */ u.jsx(si, { className: Se });
|
|
13669
13665
|
case "tool":
|
|
13670
|
-
return /* @__PURE__ */ u.jsx(mm, { className:
|
|
13666
|
+
return /* @__PURE__ */ u.jsx(mm, { className: Se });
|
|
13671
13667
|
default:
|
|
13672
|
-
return /* @__PURE__ */ u.jsx(si, { className:
|
|
13668
|
+
return /* @__PURE__ */ u.jsx(si, { className: Se });
|
|
13673
13669
|
}
|
|
13674
13670
|
}, [L, H, M]), Ze = z.useCallback(() => {
|
|
13675
13671
|
const W = "group relative mb-4 flex w-full";
|
|
@@ -13740,41 +13736,41 @@ const Bc = z.memo(function({
|
|
|
13740
13736
|
const rt = z.useCallback(async (W) => {
|
|
13741
13737
|
if (w)
|
|
13742
13738
|
return;
|
|
13743
|
-
const
|
|
13739
|
+
const Se = Mo(
|
|
13744
13740
|
(W == null ? void 0 : W.id) ?? (W == null ? void 0 : W.interrupt_id)
|
|
13745
13741
|
);
|
|
13746
|
-
if (!
|
|
13742
|
+
if (!Se) {
|
|
13747
13743
|
console.warn("Interrupt part missing id", W);
|
|
13748
13744
|
return;
|
|
13749
13745
|
}
|
|
13750
13746
|
try {
|
|
13751
|
-
b == null || b(), await B(
|
|
13747
|
+
b == null || b(), await B(Se, !0);
|
|
13752
13748
|
} catch (ye) {
|
|
13753
13749
|
console.error("Failed to approve interrupt:", ye);
|
|
13754
13750
|
} finally {
|
|
13755
13751
|
T == null || T();
|
|
13756
13752
|
}
|
|
13757
|
-
}, [w, T, b, B]),
|
|
13753
|
+
}, [w, T, b, B]), Ct = z.useCallback(async (W) => {
|
|
13758
13754
|
if (w)
|
|
13759
13755
|
return;
|
|
13760
|
-
const
|
|
13756
|
+
const Se = Mo(
|
|
13761
13757
|
(W == null ? void 0 : W.id) ?? (W == null ? void 0 : W.interrupt_id)
|
|
13762
13758
|
);
|
|
13763
|
-
if (!
|
|
13759
|
+
if (!Se) {
|
|
13764
13760
|
console.warn("Interrupt part missing id", W);
|
|
13765
13761
|
return;
|
|
13766
13762
|
}
|
|
13767
13763
|
try {
|
|
13768
|
-
b == null || b(), await B(
|
|
13764
|
+
b == null || b(), await B(Se, !1);
|
|
13769
13765
|
} catch (ye) {
|
|
13770
13766
|
console.error("Failed to reject interrupt:", ye);
|
|
13771
13767
|
} finally {
|
|
13772
13768
|
T == null || T();
|
|
13773
13769
|
}
|
|
13774
|
-
}, [w, T, b, B]), pt = z.useCallback(({ part: W, i:
|
|
13770
|
+
}, [w, T, b, B]), pt = z.useCallback(({ part: W, i: Se }) => {
|
|
13775
13771
|
if (W.type === "text") {
|
|
13776
13772
|
const ye = W.text ?? "", ht = ye.trim(), mt = Ja(ht);
|
|
13777
|
-
return mt && M !== "tool" ? /* @__PURE__ */ u.jsx(Op, { data: mt },
|
|
13773
|
+
return mt && M !== "tool" ? /* @__PURE__ */ u.jsx(Op, { data: mt }, Se) : M === "user" && c && ht.length > d ? /* @__PURE__ */ u.jsx(
|
|
13778
13774
|
NC,
|
|
13779
13775
|
{
|
|
13780
13776
|
text: ht,
|
|
@@ -13783,8 +13779,8 @@ const Bc = z.memo(function({
|
|
|
13783
13779
|
previewLength: d,
|
|
13784
13780
|
isCompact: L
|
|
13785
13781
|
},
|
|
13786
|
-
|
|
13787
|
-
) : /* @__PURE__ */ u.jsx(fs, { content: ye, allowHtml: !1 },
|
|
13782
|
+
Se
|
|
13783
|
+
) : /* @__PURE__ */ u.jsx(fs, { content: ye, allowHtml: !1 }, Se);
|
|
13788
13784
|
}
|
|
13789
13785
|
if (W.type === "image_url") {
|
|
13790
13786
|
const ye = W;
|
|
@@ -13796,7 +13792,7 @@ const Bc = z.memo(function({
|
|
|
13796
13792
|
loading: "lazy",
|
|
13797
13793
|
className: "border rounded max-h-[420px] w-auto object-contain"
|
|
13798
13794
|
}
|
|
13799
|
-
) },
|
|
13795
|
+
) }, Se);
|
|
13800
13796
|
}
|
|
13801
13797
|
if (W.type === "file") {
|
|
13802
13798
|
const ye = W, ht = ye.name || "file";
|
|
@@ -13804,35 +13800,35 @@ const Bc = z.memo(function({
|
|
|
13804
13800
|
"a",
|
|
13805
13801
|
{
|
|
13806
13802
|
href: ye.url,
|
|
13807
|
-
onClick: (mt) => G(mt, ye,
|
|
13803
|
+
onClick: (mt) => G(mt, ye, Se),
|
|
13808
13804
|
className: `inline-flex items-center gap-2 rounded px-2 py-1 text-xs bg-gray-100 border hover:bg-gray-200
|
|
13809
13805
|
dark:bg-background/10 dark:border-border/30 dark:hover:bg-background/20`,
|
|
13810
13806
|
children: [
|
|
13811
|
-
Ae[
|
|
13807
|
+
Ae[Se] ? /* @__PURE__ */ u.jsx(ua, { className: "h-4 w-4 animate-spin" }) : null,
|
|
13812
13808
|
/* @__PURE__ */ u.jsxs("span", { className: "truncate max-w-[180px]", children: [
|
|
13813
13809
|
ht,
|
|
13814
|
-
Ae[
|
|
13810
|
+
Ae[Se] ? " (processing)" : ""
|
|
13815
13811
|
] })
|
|
13816
13812
|
]
|
|
13817
13813
|
},
|
|
13818
|
-
|
|
13814
|
+
Se
|
|
13819
13815
|
);
|
|
13820
13816
|
}
|
|
13821
13817
|
if (W.type === "interrupt") {
|
|
13822
13818
|
const ye = W, ht = Mo(
|
|
13823
13819
|
(ye == null ? void 0 : ye.id) ?? (ye == null ? void 0 : ye.interrupt_id)
|
|
13824
|
-
), mt = !!(xe && ht && ht === xe),
|
|
13820
|
+
), mt = !!(xe && ht && ht === xe), Rt = mt ? Ne ?? (ye == null ? void 0 : ye.value) : ye == null ? void 0 : ye.value, Pe = ht ? { ...ye, id: ht, interrupt_id: ht } : ye;
|
|
13825
13821
|
return /* @__PURE__ */ u.jsx(
|
|
13826
13822
|
EC,
|
|
13827
13823
|
{
|
|
13828
13824
|
interruptPart: Pe,
|
|
13829
13825
|
onApprove: rt,
|
|
13830
|
-
onReject:
|
|
13826
|
+
onReject: Ct,
|
|
13831
13827
|
disabled: w,
|
|
13832
13828
|
isActive: mt,
|
|
13833
|
-
payload:
|
|
13829
|
+
payload: Rt
|
|
13834
13830
|
},
|
|
13835
|
-
|
|
13831
|
+
Se
|
|
13836
13832
|
);
|
|
13837
13833
|
}
|
|
13838
13834
|
return null;
|
|
@@ -13840,7 +13836,7 @@ const Bc = z.memo(function({
|
|
|
13840
13836
|
G,
|
|
13841
13837
|
Ae,
|
|
13842
13838
|
rt,
|
|
13843
|
-
|
|
13839
|
+
Ct,
|
|
13844
13840
|
M,
|
|
13845
13841
|
c,
|
|
13846
13842
|
d,
|
|
@@ -13854,7 +13850,7 @@ const Bc = z.memo(function({
|
|
|
13854
13850
|
]), ot = z.useCallback(() => /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2 p-2 bg-muted/30 rounded", children: [
|
|
13855
13851
|
/* @__PURE__ */ u.jsx(ji, { className: "h-4 w-4 text-muted-foreground" }),
|
|
13856
13852
|
/* @__PURE__ */ u.jsx("span", { className: "text-sm text-muted-foreground", children: "File upload" })
|
|
13857
|
-
] }), []),
|
|
13853
|
+
] }), []), Tt = z.useCallback(() => {
|
|
13858
13854
|
const W = Z.trim().length > 0 || ne.length > 0 || De.length > 0 || ee.length > 0;
|
|
13859
13855
|
if (!J && De.length > 0 && !r)
|
|
13860
13856
|
return ot();
|
|
@@ -13870,7 +13866,7 @@ const Bc = z.memo(function({
|
|
|
13870
13866
|
t.id
|
|
13871
13867
|
);
|
|
13872
13868
|
if (!J && !Y) {
|
|
13873
|
-
const
|
|
13869
|
+
const Se = t, ye = /* @__PURE__ */ u.jsx("div", { className: "space-y-2", children: Se.content.map((ht, mt) => /* @__PURE__ */ u.jsx(pt, { part: ht, i: mt }, mt)) });
|
|
13874
13870
|
return r ? /* @__PURE__ */ u.jsxs("div", { "aria-busy": "true", role: "status", children: [
|
|
13875
13871
|
ye,
|
|
13876
13872
|
/* @__PURE__ */ u.jsx(RC, { className: H })
|
|
@@ -13888,18 +13884,18 @@ const Bc = z.memo(function({
|
|
|
13888
13884
|
H
|
|
13889
13885
|
]), wt = lt(() => Y ? "Assistant" : kC(t), [Y, t]), Xe = z.useMemo(() => Y ? [] : Array.isArray(C) ? C : [], [C, Y]), fe = z.useMemo(() => {
|
|
13890
13886
|
var W;
|
|
13891
|
-
return Xe.length ? N && Xe.some((
|
|
13892
|
-
}, [N, Xe]), Le = z.useMemo(() => !Xe.length || !S ? null : Xe.some((W) => W.id === S) ? S : null, [S, Xe]) ?? fe,
|
|
13887
|
+
return Xe.length ? N && Xe.some((Se) => Se.id === N) ? N : ((W = Xe[0]) == null ? void 0 : W.id) ?? null : null;
|
|
13888
|
+
}, [N, Xe]), Le = z.useMemo(() => !Xe.length || !S ? null : Xe.some((W) => W.id === S) ? S : null, [S, Xe]) ?? fe, He = M === "user" && Xe.length > 0 && typeof k == "function", pe = z.useCallback(
|
|
13893
13889
|
(W) => {
|
|
13894
13890
|
if (!k) return;
|
|
13895
|
-
const
|
|
13896
|
-
k(
|
|
13891
|
+
const Se = (W == null ? void 0 : W.id) ?? null, ye = (W == null ? void 0 : W.parentId) ?? E ?? null;
|
|
13892
|
+
k(Se, ye);
|
|
13897
13893
|
},
|
|
13898
13894
|
[E, k]
|
|
13899
|
-
),
|
|
13900
|
-
const
|
|
13901
|
-
if (W.step !== null &&
|
|
13902
|
-
return
|
|
13895
|
+
), be = z.useMemo(() => Le ? Xe.findIndex((W) => W.id === Le) : -1, [Le, Xe]), bt = z.useMemo(() => be < 0 ? null : Xe[be] ?? null, [be, Xe]), kt = z.useCallback((W) => {
|
|
13896
|
+
const Se = [];
|
|
13897
|
+
if (W.step !== null && Se.push(`Step ${W.step}`), W.source && Se.push(W.source), !W.createdAt)
|
|
13898
|
+
return Se.length ? Se.join(" • ") : W.id.slice(0, 8);
|
|
13903
13899
|
let ye = "";
|
|
13904
13900
|
try {
|
|
13905
13901
|
const ht = new Date(W.createdAt);
|
|
@@ -13942,7 +13938,7 @@ const Bc = z.memo(function({
|
|
|
13942
13938
|
"aria-expanded": D === "expanded",
|
|
13943
13939
|
onClick: () => F((W) => W === "expanded" ? "preview" : "expanded"),
|
|
13944
13940
|
onKeyDown: (W) => {
|
|
13945
|
-
(W.key === "Enter" || W.key === " ") && (W.preventDefault(), F((
|
|
13941
|
+
(W.key === "Enter" || W.key === " ") && (W.preventDefault(), F((Se) => Se === "expanded" ? "preview" : "expanded"));
|
|
13946
13942
|
},
|
|
13947
13943
|
children: [
|
|
13948
13944
|
/* @__PURE__ */ u.jsx("span", { children: oe.name ?? "Tool Output" }),
|
|
@@ -13953,32 +13949,32 @@ const Bc = z.memo(function({
|
|
|
13953
13949
|
)
|
|
13954
13950
|
] }),
|
|
13955
13951
|
/* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
13956
|
-
|
|
13952
|
+
He && bt && be >= 0 && /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2 text-xs", children: [
|
|
13957
13953
|
/* @__PURE__ */ u.jsx(
|
|
13958
13954
|
"button",
|
|
13959
13955
|
{
|
|
13960
13956
|
type: "button",
|
|
13961
13957
|
className: Q(
|
|
13962
13958
|
"flex items-center justify-center rounded border px-1.5 py-1 transition-colors",
|
|
13963
|
-
|
|
13959
|
+
be > 0 ? "border-border text-foreground hover:bg-muted/60" : "border-border text-muted-foreground cursor-not-allowed"
|
|
13964
13960
|
),
|
|
13965
13961
|
onClick: () => {
|
|
13966
|
-
if (
|
|
13967
|
-
const W = Xe[
|
|
13968
|
-
W &&
|
|
13962
|
+
if (be <= 0) return;
|
|
13963
|
+
const W = Xe[be - 1];
|
|
13964
|
+
W && pe(W);
|
|
13969
13965
|
},
|
|
13970
13966
|
"aria-label": "Previous checkpoint",
|
|
13971
|
-
disabled:
|
|
13967
|
+
disabled: be <= 0,
|
|
13972
13968
|
children: /* @__PURE__ */ u.jsx(xm, { className: "h-3 w-3" })
|
|
13973
13969
|
}
|
|
13974
13970
|
),
|
|
13975
13971
|
/* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
13976
13972
|
/* @__PURE__ */ u.jsxs("span", { className: "whitespace-nowrap", children: [
|
|
13977
|
-
|
|
13973
|
+
be + 1,
|
|
13978
13974
|
" / ",
|
|
13979
13975
|
Xe.length
|
|
13980
13976
|
] }),
|
|
13981
|
-
/* @__PURE__ */ u.jsx("span", { className: "text-muted-foreground", children:
|
|
13977
|
+
/* @__PURE__ */ u.jsx("span", { className: "text-muted-foreground", children: kt(bt) })
|
|
13982
13978
|
] }),
|
|
13983
13979
|
/* @__PURE__ */ u.jsx(
|
|
13984
13980
|
"button",
|
|
@@ -13986,15 +13982,15 @@ const Bc = z.memo(function({
|
|
|
13986
13982
|
type: "button",
|
|
13987
13983
|
className: Q(
|
|
13988
13984
|
"flex items-center justify-center rounded border px-1.5 py-1 transition-colors",
|
|
13989
|
-
|
|
13985
|
+
be < Xe.length - 1 ? "border-border text-foreground hover:bg-muted/60" : "border-border text-muted-foreground cursor-not-allowed"
|
|
13990
13986
|
),
|
|
13991
13987
|
onClick: () => {
|
|
13992
|
-
if (
|
|
13993
|
-
const W = Xe[
|
|
13994
|
-
W &&
|
|
13988
|
+
if (be >= Xe.length - 1) return;
|
|
13989
|
+
const W = Xe[be + 1];
|
|
13990
|
+
W && pe(W);
|
|
13995
13991
|
},
|
|
13996
13992
|
"aria-label": "Next checkpoint",
|
|
13997
|
-
disabled:
|
|
13993
|
+
disabled: be >= Xe.length - 1,
|
|
13998
13994
|
children: /* @__PURE__ */ u.jsx(Xc, { className: "h-3 w-3" })
|
|
13999
13995
|
}
|
|
14000
13996
|
)
|
|
@@ -14058,7 +14054,7 @@ const Bc = z.memo(function({
|
|
|
14058
14054
|
]
|
|
14059
14055
|
}
|
|
14060
14056
|
),
|
|
14061
|
-
/* @__PURE__ */ u.jsx("div", { className: "relative", children:
|
|
14057
|
+
/* @__PURE__ */ u.jsx("div", { className: "relative", children: Tt() }),
|
|
14062
14058
|
J && D === "expanded" && (oe.toolCallId || oe.name) && /* @__PURE__ */ u.jsxs("div", { className: Q("mt-2 pt-2 border-t border-current/10 text-xs opacity-60", L && "text-xs"), children: [
|
|
14063
14059
|
oe.name && /* @__PURE__ */ u.jsxs("div", { children: [
|
|
14064
14060
|
"Function: ",
|
|
@@ -14426,7 +14422,7 @@ const Hc = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, jC = (e) =>
|
|
|
14426
14422
|
ee.has(Je) || (ee.add(Je), ue.push(Ke));
|
|
14427
14423
|
}
|
|
14428
14424
|
return ue.reverse();
|
|
14429
|
-
}, [Y]),
|
|
14425
|
+
}, [Y]), Re = Ee((ee) => {
|
|
14430
14426
|
B(ee), y && y(!ee), m && m(ee);
|
|
14431
14427
|
}, [y, m]), Ae = lt(() => {
|
|
14432
14428
|
if (a)
|
|
@@ -14562,7 +14558,7 @@ const Hc = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, jC = (e) =>
|
|
|
14562
14558
|
startReached: () => {
|
|
14563
14559
|
Ae && Ae();
|
|
14564
14560
|
},
|
|
14565
|
-
atBottomStateChange:
|
|
14561
|
+
atBottomStateChange: Re,
|
|
14566
14562
|
style: { height: "100%", overscrollBehavior: "contain" },
|
|
14567
14563
|
computeItemKey: (ee, ue) => Hc(ue, ee),
|
|
14568
14564
|
itemContent: (ee, ue) => {
|
|
@@ -14570,12 +14566,12 @@ const Hc = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, jC = (e) =>
|
|
|
14570
14566
|
const xe = Hc(ue, ee), Ne = "type" in ue && ue.type === "default_message";
|
|
14571
14567
|
let Ke = [], Je = null, Be = {}, $e = {}, qe = null, Ze = null;
|
|
14572
14568
|
if (!Ne) {
|
|
14573
|
-
const
|
|
14574
|
-
Be =
|
|
14569
|
+
const Ct = ue, pt = Ct.checkpointId ?? null;
|
|
14570
|
+
Be = Ct.additionalKwargs ?? {}, $e = Ct.responseMetadata ?? {};
|
|
14575
14571
|
const ot = pt && k ? k.get(pt) ?? null : null;
|
|
14576
14572
|
qe = typeof Be.step == "number" ? Be.step : typeof $e.step == "number" ? $e.step : (ot == null ? void 0 : ot.step) ?? null;
|
|
14577
|
-
const
|
|
14578
|
-
Ze =
|
|
14573
|
+
const Tt = typeof Be.source == "string" ? Be.source : typeof $e.source == "string" ? $e.source : (ot == null ? void 0 : ot.source) ?? null;
|
|
14574
|
+
Ze = Tt ? String(Tt) : null;
|
|
14579
14575
|
const wt = qe !== null && Ze ? `${qe}:${Ze}` : null;
|
|
14580
14576
|
wt && (N != null && N.has(wt)) ? Ke = N.get(wt) ?? [] : pt && ot && (Ke = [ot]), Je = pt ?? ((rt = Ke[0]) == null ? void 0 : rt.id) ?? null;
|
|
14581
14577
|
}
|
|
@@ -14662,25 +14658,25 @@ function Ai({
|
|
|
14662
14658
|
checkpoints: I,
|
|
14663
14659
|
interrupt: _,
|
|
14664
14660
|
metadata: D
|
|
14665
|
-
} = ya(), { isStreaming: F, error: j, connectionState: $, submit: A, stop: B } = Jx(), L = m ?? y ?? null, M = (E == null ? void 0 : E.id) ?? null, J = (E == null ? void 0 : E.namespace) ?? null, Y = (D == null ? void 0 : D.assemblingMessageId) ?? null, de = _, [
|
|
14666
|
-
|
|
14661
|
+
} = ya(), { isStreaming: F, error: j, connectionState: $, submit: A, stop: B } = Jx(), L = m ?? y ?? null, M = (E == null ? void 0 : E.id) ?? null, J = (E == null ? void 0 : E.namespace) ?? null, Y = (D == null ? void 0 : D.assemblingMessageId) ?? null, de = _, [Re, Ae] = ge(!1);
|
|
14662
|
+
Nt(() => {
|
|
14667
14663
|
de || Ae(!1);
|
|
14668
14664
|
}, [de]);
|
|
14669
14665
|
const G = Ee(() => {
|
|
14670
14666
|
Ae(!0);
|
|
14671
14667
|
}, []), te = Ee(() => {
|
|
14672
14668
|
Ae(!1);
|
|
14673
|
-
}, []), q = !!de ||
|
|
14674
|
-
Uc.value = K,
|
|
14675
|
-
}, []), [W,
|
|
14669
|
+
}, []), q = !!de || Re, [P, H] = ge(null), [Z, oe] = ge(""), [ne, De] = ge(null), [ee, ue] = ge(null), [xe, Ne] = ge([]), [Ke, Je] = ge(0), [Be, $e] = ge(0), [qe, Ze] = ge(!1), [Qe, rt] = ge(null), [Ct, pt] = ge(null), [ot, Tt] = ge(!1), [wt, Xe] = ge(null), [fe, ve] = ge(!1), Le = et(!1), [He, pe] = ge(() => Uc.value), be = et(He), bt = et(null), kt = Ee((K) => {
|
|
14670
|
+
Uc.value = K, pe(K);
|
|
14671
|
+
}, []), [W, Se] = ge(!1), ye = et(null), ht = Ee((K) => {
|
|
14676
14672
|
if (!Array.isArray(K))
|
|
14677
14673
|
return { text: null, messageId: null };
|
|
14678
14674
|
for (let re = K.length - 1; re >= 0; re--) {
|
|
14679
14675
|
const ie = K[re];
|
|
14680
14676
|
if (!ie || ie.role !== "user") continue;
|
|
14681
|
-
const
|
|
14677
|
+
const Te = (ie.content ?? []).filter((Ye) => (Ye == null ? void 0 : Ye.type) === "text").map((Ye) => Ye.text).filter((Ye) => typeof Ye == "string" && Ye.trim().length > 0);
|
|
14682
14678
|
return {
|
|
14683
|
-
text:
|
|
14679
|
+
text: Te.length ? Te.join(" ").trim() : null,
|
|
14684
14680
|
messageId: ie.id ?? null
|
|
14685
14681
|
};
|
|
14686
14682
|
}
|
|
@@ -14692,7 +14688,7 @@ function Ai({
|
|
|
14692
14688
|
return typeof ie == "number" ? ie : null;
|
|
14693
14689
|
},
|
|
14694
14690
|
[]
|
|
14695
|
-
),
|
|
14691
|
+
), Rt = Ee(
|
|
14696
14692
|
(K, re) => {
|
|
14697
14693
|
if (!K || typeof K != "object") return null;
|
|
14698
14694
|
const ie = K[re];
|
|
@@ -14700,10 +14696,10 @@ function Ai({
|
|
|
14700
14696
|
},
|
|
14701
14697
|
[]
|
|
14702
14698
|
), Pe = lt(() => {
|
|
14703
|
-
const K = (
|
|
14704
|
-
if (!Array.isArray(
|
|
14699
|
+
const K = (Te) => {
|
|
14700
|
+
if (!Array.isArray(Te) || Te.length === 0)
|
|
14705
14701
|
return null;
|
|
14706
|
-
const ut =
|
|
14702
|
+
const ut = Te.map((Ye) => {
|
|
14707
14703
|
if (typeof Ye == "string")
|
|
14708
14704
|
return Ye.trim();
|
|
14709
14705
|
if (Ye && typeof Ye == "object" && "type" in Ye) {
|
|
@@ -14714,56 +14710,56 @@ function Ai({
|
|
|
14714
14710
|
return null;
|
|
14715
14711
|
}).filter((Ye) => !!(Ye && Ye.length));
|
|
14716
14712
|
return ut.length ? ut.join(", ") : null;
|
|
14717
|
-
}, re = Array.isArray(I) ? I.map((
|
|
14718
|
-
const ut = K(
|
|
14713
|
+
}, re = Array.isArray(I) ? I.map((Te) => {
|
|
14714
|
+
const ut = K(Te.next);
|
|
14719
14715
|
return ut ? {
|
|
14720
|
-
...
|
|
14716
|
+
...Te,
|
|
14721
14717
|
metadata: {
|
|
14722
|
-
...
|
|
14718
|
+
...Te.metadata ?? {},
|
|
14723
14719
|
next: ut
|
|
14724
14720
|
}
|
|
14725
|
-
} :
|
|
14721
|
+
} : Te;
|
|
14726
14722
|
}) : [];
|
|
14727
|
-
return re.some((
|
|
14728
|
-
const Ye = mt(
|
|
14723
|
+
return re.some((Te) => mt(Te.metadata, "step") !== null) && re.sort((Te, ut) => {
|
|
14724
|
+
const Ye = mt(Te.metadata, "step"), nt = mt(ut.metadata, "step");
|
|
14729
14725
|
if (Ye !== null || nt !== null)
|
|
14730
14726
|
return (nt ?? Number.NEGATIVE_INFINITY) - (Ye ?? Number.NEGATIVE_INFINITY);
|
|
14731
|
-
const Mt = Date.parse(
|
|
14727
|
+
const Mt = Date.parse(Te.createdAt ?? ""), tn = Date.parse(ut.createdAt ?? "");
|
|
14732
14728
|
return Number.isNaN(Mt) || Number.isNaN(tn) ? 0 : tn - Mt;
|
|
14733
14729
|
}), re;
|
|
14734
14730
|
}, [I, mt]), { checkpointMetaById: Vt, checkpointIndexByKey: ct } = lt(() => {
|
|
14735
14731
|
const K = /* @__PURE__ */ new Map(), re = /* @__PURE__ */ new Map();
|
|
14736
14732
|
for (const ie of Pe) {
|
|
14737
|
-
const
|
|
14738
|
-
if (!
|
|
14739
|
-
const ut = mt(ie.metadata, "step"), Ye =
|
|
14740
|
-
id:
|
|
14733
|
+
const Te = ie.checkpointId ?? null;
|
|
14734
|
+
if (!Te) continue;
|
|
14735
|
+
const ut = mt(ie.metadata, "step"), Ye = Rt(ie.metadata, "source"), nt = {
|
|
14736
|
+
id: Te,
|
|
14741
14737
|
step: ut,
|
|
14742
14738
|
source: Ye,
|
|
14743
14739
|
createdAt: ie.createdAt ?? null,
|
|
14744
14740
|
namespace: ie.checkpointNs ?? null,
|
|
14745
14741
|
parentId: ie.parentId ?? null
|
|
14746
14742
|
};
|
|
14747
|
-
if (K.set(
|
|
14743
|
+
if (K.set(Te, nt), ut !== null && Ye) {
|
|
14748
14744
|
const Mt = `${ut}:${Ye}`, tn = re.get(Mt) ?? [];
|
|
14749
14745
|
tn.push(nt), re.set(Mt, tn);
|
|
14750
14746
|
}
|
|
14751
14747
|
}
|
|
14752
14748
|
for (const ie of re.values())
|
|
14753
|
-
ie.sort((
|
|
14754
|
-
const Ye =
|
|
14749
|
+
ie.sort((Te, ut) => {
|
|
14750
|
+
const Ye = Te.createdAt ?? "";
|
|
14755
14751
|
return (ut.createdAt ?? "").localeCompare(Ye);
|
|
14756
14752
|
});
|
|
14757
14753
|
return { checkpointMetaById: K, checkpointIndexByKey: re };
|
|
14758
|
-
}, [Pe, mt,
|
|
14754
|
+
}, [Pe, mt, Rt]), Et = lt(() => {
|
|
14759
14755
|
var Ye;
|
|
14760
14756
|
if (!Pe.length) return [];
|
|
14761
14757
|
const K = [...Pe].reverse(), re = (nt, Mt) => {
|
|
14762
14758
|
const tn = nt.checkpointId ?? null;
|
|
14763
14759
|
if (!tn) return null;
|
|
14764
|
-
const Zn =
|
|
14765
|
-
|
|
14766
|
-
const { text: ll, messageId: nm } = ht(nt.messages), oi = ll && ll.replace(/\s+/g, " ").trim() ||
|
|
14760
|
+
const Zn = Rt(nt.metadata, "source");
|
|
14761
|
+
Rt(nt.metadata, "next");
|
|
14762
|
+
const { text: ll, messageId: nm } = ht(nt.messages), oi = ll && ll.replace(/\s+/g, " ").trim() || Rt(nt.metadata, "title") || Rt(nt.metadata, "label") || Mt || Zn || "Checkpoint", rm = oi.length > 60 ? `${oi.slice(0, 57)}…` : oi;
|
|
14767
14763
|
return {
|
|
14768
14764
|
id: tn,
|
|
14769
14765
|
label: rm,
|
|
@@ -14771,58 +14767,58 @@ function Ai({
|
|
|
14771
14767
|
createdAt: nt.createdAt ?? null,
|
|
14772
14768
|
step: mt(nt.metadata, "step"),
|
|
14773
14769
|
source: Zn ?? null,
|
|
14774
|
-
next:
|
|
14770
|
+
next: Rt(nt.metadata, "next")
|
|
14775
14771
|
};
|
|
14776
|
-
}, ie = [],
|
|
14772
|
+
}, ie = [], Te = /* @__PURE__ */ new Set();
|
|
14777
14773
|
for (const nt of K) {
|
|
14778
|
-
const Mt = ((Ye =
|
|
14774
|
+
const Mt = ((Ye = Rt(nt.metadata, "source")) == null ? void 0 : Ye.toLowerCase()) ?? null;
|
|
14779
14775
|
if (!(Mt === "input" || Mt === "user_input" || Mt === "user")) continue;
|
|
14780
14776
|
const Zn = re(nt, "User input");
|
|
14781
|
-
Zn && !
|
|
14777
|
+
Zn && !Te.has(Zn.id) && (ie.push(Zn), Te.add(Zn.id));
|
|
14782
14778
|
}
|
|
14783
14779
|
if (!ie.length)
|
|
14784
14780
|
for (const nt of K) {
|
|
14785
14781
|
const Mt = re(nt);
|
|
14786
|
-
Mt && !
|
|
14782
|
+
Mt && !Te.has(Mt.id) && (ie.push(Mt), Te.add(Mt.id));
|
|
14787
14783
|
}
|
|
14788
14784
|
const ut = Pe.find((nt) => {
|
|
14789
14785
|
var tn;
|
|
14790
|
-
return (((tn =
|
|
14786
|
+
return (((tn = Rt(nt.metadata, "source")) == null ? void 0 : tn.toLowerCase()) ?? null) === "loop";
|
|
14791
14787
|
});
|
|
14792
14788
|
if (ut) {
|
|
14793
14789
|
const nt = re(ut, "Latest loop");
|
|
14794
|
-
nt && !
|
|
14790
|
+
nt && !Te.has(nt.id) && (ie.push(nt), Te.add(nt.id));
|
|
14795
14791
|
}
|
|
14796
14792
|
return ie;
|
|
14797
|
-
}, [Pe, ht, mt,
|
|
14793
|
+
}, [Pe, ht, mt, Rt]), Dn = et(null), Jn = et(null), Ln = Ee(() => {
|
|
14798
14794
|
Dn.current && (Dn.current.value = ""), Jn.current && (Jn.current.value = ""), Je((K) => K + 1), $e((K) => K + 1);
|
|
14799
14795
|
}, []), ti = Ee(
|
|
14800
14796
|
(K) => {
|
|
14801
|
-
|
|
14797
|
+
kt(K);
|
|
14802
14798
|
},
|
|
14803
|
-
[
|
|
14799
|
+
[kt]
|
|
14804
14800
|
), So = et(!1);
|
|
14805
|
-
|
|
14801
|
+
Nt(() => {
|
|
14806
14802
|
So.current && !F && (Ne([]), Ln()), So.current = F;
|
|
14807
14803
|
}, [F, Ln]);
|
|
14808
14804
|
const [ni, ri] = ge("desktop");
|
|
14809
|
-
|
|
14805
|
+
Nt(() => {
|
|
14810
14806
|
const K = () => {
|
|
14811
14807
|
const re = window.innerWidth;
|
|
14812
14808
|
ri(re < 640 ? "phone" : re < 1024 ? "tablet" : "desktop");
|
|
14813
14809
|
};
|
|
14814
14810
|
return K(), window.addEventListener("resize", K), () => window.removeEventListener("resize", K);
|
|
14815
|
-
}, []),
|
|
14816
|
-
|
|
14817
|
-
}, [L]),
|
|
14818
|
-
|
|
14819
|
-
}, [
|
|
14811
|
+
}, []), Nt(() => {
|
|
14812
|
+
ve(!1), Le.current = !1;
|
|
14813
|
+
}, [L]), Nt(() => {
|
|
14814
|
+
be.current = He;
|
|
14815
|
+
}, [He]), Nt(() => {
|
|
14820
14816
|
if (!P) {
|
|
14821
14817
|
bt.current = null;
|
|
14822
14818
|
return;
|
|
14823
14819
|
}
|
|
14824
|
-
bt.current === null && (bt.current =
|
|
14825
|
-
}, [Z, P,
|
|
14820
|
+
bt.current === null && (bt.current = be.current), kt(Z ?? "");
|
|
14821
|
+
}, [Z, P, kt]);
|
|
14826
14822
|
const R = Ee(async () => {
|
|
14827
14823
|
if (!(!b || T || !fe))
|
|
14828
14824
|
try {
|
|
@@ -14831,7 +14827,7 @@ function Ai({
|
|
|
14831
14827
|
console.warn("loadOlder failed", K);
|
|
14832
14828
|
}
|
|
14833
14829
|
}, [b, fe, T, S]);
|
|
14834
|
-
|
|
14830
|
+
Nt(() => {
|
|
14835
14831
|
(async () => {
|
|
14836
14832
|
if (!x.baseUrl) {
|
|
14837
14833
|
Xe(null);
|
|
@@ -14844,7 +14840,7 @@ function Ai({
|
|
|
14844
14840
|
console.warn("Failed to fetch default message:", re), Xe(null);
|
|
14845
14841
|
}
|
|
14846
14842
|
})();
|
|
14847
|
-
}, [x.baseUrl]),
|
|
14843
|
+
}, [x.baseUrl]), Nt(() => {
|
|
14848
14844
|
j && !ot && (g == null || g(j));
|
|
14849
14845
|
}, [j, ot, g]);
|
|
14850
14846
|
const V = (K) => {
|
|
@@ -14866,7 +14862,7 @@ function Ai({
|
|
|
14866
14862
|
}
|
|
14867
14863
|
}
|
|
14868
14864
|
try {
|
|
14869
|
-
const ie = M ?? void 0,
|
|
14865
|
+
const ie = M ?? void 0, Te = J ?? void 0, ut = P ? {
|
|
14870
14866
|
edit: !0,
|
|
14871
14867
|
originalMessageId: P,
|
|
14872
14868
|
...ne != null && ne.checkpointId ? { originalCheckpointId: ne.checkpointId } : {},
|
|
@@ -14880,30 +14876,30 @@ function Ai({
|
|
|
14880
14876
|
},
|
|
14881
14877
|
{
|
|
14882
14878
|
checkpointId: ie,
|
|
14883
|
-
checkpointNs:
|
|
14879
|
+
checkpointNs: Te
|
|
14884
14880
|
}
|
|
14885
|
-
), p == null || p(re),
|
|
14881
|
+
), p == null || p(re), kt(""), ue(null), Ne([]), Ln(), H(null), oe(""), De(null);
|
|
14886
14882
|
} catch (ie) {
|
|
14887
|
-
const
|
|
14888
|
-
ue(
|
|
14883
|
+
const Te = (ie == null ? void 0 : ie.message) || "Failed to send message";
|
|
14884
|
+
ue(Te), g == null || g(Te);
|
|
14889
14885
|
}
|
|
14890
14886
|
}
|
|
14891
|
-
},
|
|
14887
|
+
}, Ce = z.useCallback(
|
|
14892
14888
|
(K, re, ie) => {
|
|
14893
|
-
c && (bt.current =
|
|
14889
|
+
c && (bt.current = He, H(K), oe(re), kt(re), ue(null), De({
|
|
14894
14890
|
checkpointId: (ie == null ? void 0 : ie.checkpointId) ?? null,
|
|
14895
14891
|
checkpointNs: (ie == null ? void 0 : ie.checkpointNs) ?? null
|
|
14896
14892
|
}));
|
|
14897
14893
|
},
|
|
14898
|
-
[
|
|
14894
|
+
[He, c, kt]
|
|
14899
14895
|
), Ge = z.useCallback(() => {
|
|
14900
|
-
H(null), oe(""), De(null), ue(null),
|
|
14901
|
-
}, [
|
|
14896
|
+
H(null), oe(""), De(null), ue(null), kt(bt.current ?? He), bt.current = null;
|
|
14897
|
+
}, [He, kt]), at = Ee(
|
|
14902
14898
|
(K, re, ie) => {
|
|
14903
|
-
|
|
14899
|
+
Ce(K, re, ie);
|
|
14904
14900
|
},
|
|
14905
|
-
[
|
|
14906
|
-
),
|
|
14901
|
+
[Ce]
|
|
14902
|
+
), Ue = Ee((K) => {
|
|
14907
14903
|
for (let re = K - 1; re >= 0; re--)
|
|
14908
14904
|
if (w[re].role === "user") {
|
|
14909
14905
|
const ie = w[re].content || [], ut = ie.filter((Ye) => Ye.type === "text").map((Ye) => Ye.text).join("") || (() => {
|
|
@@ -14927,7 +14923,7 @@ function Ai({
|
|
|
14927
14923
|
Ne((ie) => [...ie, ...re]), K.target.value = "";
|
|
14928
14924
|
}, Ot = (K) => {
|
|
14929
14925
|
Ne((re) => {
|
|
14930
|
-
const ie = re.filter((
|
|
14926
|
+
const ie = re.filter((Te, ut) => K !== ut);
|
|
14931
14927
|
return ie.length === 0 && Ln(), ie;
|
|
14932
14928
|
});
|
|
14933
14929
|
}, St = async (K) => {
|
|
@@ -14945,30 +14941,30 @@ function Ai({
|
|
|
14945
14941
|
const ie = `Uploaded ${re.name} - processing through chat stream`;
|
|
14946
14942
|
pt(ie);
|
|
14947
14943
|
} catch (ie) {
|
|
14948
|
-
const
|
|
14949
|
-
console.error("Excel upload failed", ie), rt(
|
|
14944
|
+
const Te = ie instanceof Error ? ie.message : "Failed to upload Excel file";
|
|
14945
|
+
console.error("Excel upload failed", ie), rt(Te), g == null || g(Te);
|
|
14950
14946
|
} finally {
|
|
14951
14947
|
Ze(!1), K.target.value = "", Ln();
|
|
14952
14948
|
}
|
|
14953
14949
|
}
|
|
14954
14950
|
}, yt = async (K) => {
|
|
14955
14951
|
if (y) {
|
|
14956
|
-
|
|
14952
|
+
Se(!0);
|
|
14957
14953
|
try {
|
|
14958
14954
|
if (!K) {
|
|
14959
|
-
await N(),
|
|
14960
|
-
var
|
|
14961
|
-
(
|
|
14955
|
+
await N(), ve(!1), requestAnimationFrame(() => {
|
|
14956
|
+
var Te;
|
|
14957
|
+
(Te = ye.current) == null || Te.scrollToLatest();
|
|
14962
14958
|
});
|
|
14963
14959
|
return;
|
|
14964
14960
|
}
|
|
14965
|
-
const re = Pe.find((
|
|
14966
|
-
await k(K, ie),
|
|
14967
|
-
var
|
|
14968
|
-
(
|
|
14961
|
+
const re = Pe.find((Te) => Te.checkpointId === K), ie = (re == null ? void 0 : re.checkpointNs) ?? null;
|
|
14962
|
+
await k(K, ie), ve(!0), requestAnimationFrame(() => {
|
|
14963
|
+
var Te;
|
|
14964
|
+
(Te = ye.current) == null || Te.scrollToTop();
|
|
14969
14965
|
});
|
|
14970
14966
|
} finally {
|
|
14971
|
-
|
|
14967
|
+
Se(!1);
|
|
14972
14968
|
}
|
|
14973
14969
|
}
|
|
14974
14970
|
}, Kt = Ee(
|
|
@@ -14982,8 +14978,8 @@ function Ai({
|
|
|
14982
14978
|
return "Latest";
|
|
14983
14979
|
const re = [];
|
|
14984
14980
|
K.step !== null && re.push(`Step ${K.step}`), K.source && re.push(K.source);
|
|
14985
|
-
const ie = K.createdAt ? new Date(K.createdAt) : null,
|
|
14986
|
-
return `${
|
|
14981
|
+
const ie = K.createdAt ? new Date(K.createdAt) : null, Te = ie && !Number.isNaN(ie.getTime()) ? ie.toLocaleString() : K.createdAt ?? K.id, ut = re.length ? ` — ${re.join(" • ")}` : "";
|
|
14982
|
+
return `${Te}${ut}`;
|
|
14987
14983
|
},
|
|
14988
14984
|
[]
|
|
14989
14985
|
);
|
|
@@ -14995,7 +14991,7 @@ function Ai({
|
|
|
14995
14991
|
{
|
|
14996
14992
|
variant: "ghost",
|
|
14997
14993
|
size: "sm",
|
|
14998
|
-
onClick: () =>
|
|
14994
|
+
onClick: () => Tt(!0),
|
|
14999
14995
|
className: "text-red-800 hover:bg-red-100",
|
|
15000
14996
|
"aria-label": "Dismiss error",
|
|
15001
14997
|
children: /* @__PURE__ */ u.jsx(vr, { size: 16 })
|
|
@@ -15051,15 +15047,15 @@ function Ai({
|
|
|
15051
15047
|
Le.current = !0;
|
|
15052
15048
|
return;
|
|
15053
15049
|
}
|
|
15054
|
-
K &&
|
|
15050
|
+
K && ve(!0);
|
|
15055
15051
|
},
|
|
15056
15052
|
onEdit: at,
|
|
15057
|
-
onRegenerate:
|
|
15053
|
+
onRegenerate: Ue,
|
|
15058
15054
|
onCancelEdit: Ge,
|
|
15059
15055
|
emptyMessage: wt ?? void 0,
|
|
15060
15056
|
isNavigatingCheckpoint: W,
|
|
15061
15057
|
activeInterrupt: de,
|
|
15062
|
-
disableInterruptActions:
|
|
15058
|
+
disableInterruptActions: Re,
|
|
15063
15059
|
onInterruptActionStart: G,
|
|
15064
15060
|
onInterruptActionEnd: te,
|
|
15065
15061
|
showToolMessages: d,
|
|
@@ -15067,7 +15063,7 @@ function Ai({
|
|
|
15067
15063
|
checkpointIndexByKey: ct,
|
|
15068
15064
|
activeCheckpointId: M,
|
|
15069
15065
|
onSelectCheckpoint: Kt,
|
|
15070
|
-
timelineCheckpoints:
|
|
15066
|
+
timelineCheckpoints: Et
|
|
15071
15067
|
}
|
|
15072
15068
|
),
|
|
15073
15069
|
($ === "reconnecting" || $ === "connecting") && /* @__PURE__ */ u.jsx("div", { className: "pointer-events-none absolute top-3 right-3 z-20 rounded-full bg-muted/80 px-3 py-1 text-xs font-medium text-foreground shadow-sm backdrop-blur-sm dark:bg-muted/60", children: /* @__PURE__ */ u.jsxs("span", { className: "flex items-center gap-2", children: [
|
|
@@ -15148,7 +15144,7 @@ function Ai({
|
|
|
15148
15144
|
/* @__PURE__ */ u.jsx(zr, { className: "h-4 w-4 animate-spin" }),
|
|
15149
15145
|
" Uploading Excel file..."
|
|
15150
15146
|
] }),
|
|
15151
|
-
|
|
15147
|
+
Ct && !qe && /* @__PURE__ */ u.jsx("div", { className: "text-sm rounded border border-emerald-200 bg-emerald-50 px-3 py-2 text-emerald-700", children: Ct }),
|
|
15152
15148
|
Qe && !qe && /* @__PURE__ */ u.jsx("div", { className: "text-sm rounded border border-red-200 bg-red-50 px-3 py-2 text-red-600", children: Qe })
|
|
15153
15149
|
] })
|
|
15154
15150
|
] }),
|
|
@@ -15196,7 +15192,7 @@ function Ai({
|
|
|
15196
15192
|
{
|
|
15197
15193
|
initialValue: Z,
|
|
15198
15194
|
editingMessageId: P,
|
|
15199
|
-
value:
|
|
15195
|
+
value: He,
|
|
15200
15196
|
onValueChange: ti,
|
|
15201
15197
|
placeholder: P ? "Edit your message..." : t,
|
|
15202
15198
|
isStreaming: F,
|
|
@@ -15793,14 +15789,14 @@ function Kc({
|
|
|
15793
15789
|
isLoading: g,
|
|
15794
15790
|
actions: x
|
|
15795
15791
|
} = xa(), { loadThread: y } = ya(), { createThread: m, deleteThread: w, renameThread: b } = x, [T, C] = ge(Array.isArray(f) ? f : []), S = et(T.length > 0), k = et(null), N = et(0), [E, I] = ge(null), [_, D] = ge(""), [F, j] = ge(!1);
|
|
15796
|
-
|
|
15792
|
+
Nt(() => {
|
|
15797
15793
|
const G = Array.isArray(f) ? f : [];
|
|
15798
15794
|
if (G.length > 0) {
|
|
15799
15795
|
S.current = !0, C(G);
|
|
15800
15796
|
return;
|
|
15801
15797
|
}
|
|
15802
15798
|
g || (S.current = !1, C(G));
|
|
15803
|
-
}, [f, g]),
|
|
15799
|
+
}, [f, g]), Nt(() => {
|
|
15804
15800
|
if (!k.current) return;
|
|
15805
15801
|
const G = k.current.querySelector(
|
|
15806
15802
|
"[data-radix-scroll-area-viewport]"
|
|
@@ -15864,8 +15860,8 @@ function Kc({
|
|
|
15864
15860
|
} catch {
|
|
15865
15861
|
return "";
|
|
15866
15862
|
}
|
|
15867
|
-
},
|
|
15868
|
-
const te =
|
|
15863
|
+
}, Re = (G) => G.title || `Thread ${G.threadId.slice(0, 8)}`, Ae = (G) => {
|
|
15864
|
+
const te = Re(G);
|
|
15869
15865
|
return te.length <= Vc ? te : `${te.slice(0, Vc)}...`;
|
|
15870
15866
|
};
|
|
15871
15867
|
return /* @__PURE__ */ u.jsxs("div", { className: `flex flex-col h-full ${e} ${s.container || ""}`, children: [
|
|
@@ -16475,7 +16471,7 @@ var dn = 10, [vh, Xn] = Mr(ur), pT = "SelectContentImpl", hT = Tr("SelectContent
|
|
|
16475
16471
|
(w.value !== void 0 && w.value === P || Z) && (E(q), Z && ($.current = !0));
|
|
16476
16472
|
},
|
|
16477
16473
|
[w.value]
|
|
16478
|
-
),
|
|
16474
|
+
), Re = v.useCallback(() => b == null ? void 0 : b.focus(), [b]), Ae = v.useCallback(
|
|
16479
16475
|
(q, P, H) => {
|
|
16480
16476
|
const Z = !$.current && !H;
|
|
16481
16477
|
(w.value !== void 0 && w.value === P || Z) && _(q);
|
|
@@ -16502,7 +16498,7 @@ var dn = 10, [vh, Xn] = Mr(ur), pT = "SelectContentImpl", hT = Tr("SelectContent
|
|
|
16502
16498
|
onViewportChange: S,
|
|
16503
16499
|
itemRefCallback: de,
|
|
16504
16500
|
selectedItem: N,
|
|
16505
|
-
onItemLeave:
|
|
16501
|
+
onItemLeave: Re,
|
|
16506
16502
|
itemTextRefCallback: Ae,
|
|
16507
16503
|
focusSelectedItem: B,
|
|
16508
16504
|
selectedItemText: I,
|
|
@@ -16594,14 +16590,14 @@ var mT = "SelectItemAlignedPosition", bh = v.forwardRef((e, t) => {
|
|
|
16594
16590
|
]);
|
|
16595
16591
|
a.style.minWidth = ee + "px", a.style.right = Ne + "px";
|
|
16596
16592
|
}
|
|
16597
|
-
const _ = p(), D = window.innerHeight - dn * 2, F = x.scrollHeight, j = window.getComputedStyle(c), $ = parseInt(j.borderTopWidth, 10), A = parseInt(j.paddingTop, 10), B = parseInt(j.borderBottomWidth, 10), L = parseInt(j.paddingBottom, 10), M = $ + A + F + L + B, J = Math.min(y.offsetHeight * 5, M), Y = window.getComputedStyle(x), de = parseInt(Y.paddingTop, 10),
|
|
16593
|
+
const _ = p(), D = window.innerHeight - dn * 2, F = x.scrollHeight, j = window.getComputedStyle(c), $ = parseInt(j.borderTopWidth, 10), A = parseInt(j.paddingTop, 10), B = parseInt(j.borderBottomWidth, 10), L = parseInt(j.paddingBottom, 10), M = $ + A + F + L + B, J = Math.min(y.offsetHeight * 5, M), Y = window.getComputedStyle(x), de = parseInt(Y.paddingTop, 10), Re = parseInt(Y.paddingBottom, 10), Ae = k.top + k.height / 2 - dn, G = D - Ae, te = y.offsetHeight / 2, q = y.offsetTop + te, P = $ + A + q, H = M - P;
|
|
16598
16594
|
if (P <= Ae) {
|
|
16599
16595
|
const oe = _.length > 0 && y === _[_.length - 1].ref.current;
|
|
16600
16596
|
a.style.bottom = "0px";
|
|
16601
16597
|
const ne = c.clientHeight - x.offsetTop - x.offsetHeight, De = Math.max(
|
|
16602
16598
|
G,
|
|
16603
16599
|
te + // viewport might have padding bottom, include it to avoid a scrollable viewport
|
|
16604
|
-
(oe ?
|
|
16600
|
+
(oe ? Re : 0) + ne + B
|
|
16605
16601
|
), ee = P + De;
|
|
16606
16602
|
a.style.height = ee + "px";
|
|
16607
16603
|
} else {
|
|
@@ -17267,10 +17263,10 @@ const HT = {
|
|
|
17267
17263
|
};
|
|
17268
17264
|
function Tk({ settings: e, onSettingsChange: t, className: n = "" }) {
|
|
17269
17265
|
const [r, o] = ge(!1), [s, i] = ge(!1), [a, l] = ge(e), [c, d] = ge(!1), { toast: f } = Xa();
|
|
17270
|
-
|
|
17266
|
+
Nt(() => {
|
|
17271
17267
|
const y = JSON.stringify(a) !== JSON.stringify(e);
|
|
17272
17268
|
d(y);
|
|
17273
|
-
}, [a, e]),
|
|
17269
|
+
}, [a, e]), Nt(() => {
|
|
17274
17270
|
l(e);
|
|
17275
17271
|
}, [e]);
|
|
17276
17272
|
const p = () => {
|