teodor-new-chat-ui 4.3.66 → 4.3.68
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/context/services/useChatStreamingService.d.ts +1 -1
- package/dist/index.esm.js +379 -345
- package/dist/index.umd.js +11 -11
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -136,18 +136,18 @@ function lg() {
|
|
|
136
136
|
}
|
|
137
137
|
return null;
|
|
138
138
|
}
|
|
139
|
-
var N = Object.assign, j = 0,
|
|
140
|
-
function
|
|
139
|
+
var N = Object.assign, j = 0, z, re, W, $, G, ee, ae;
|
|
140
|
+
function B() {
|
|
141
141
|
}
|
|
142
|
-
|
|
142
|
+
B.__reactDisabledLog = !0;
|
|
143
143
|
function se() {
|
|
144
144
|
{
|
|
145
145
|
if (j === 0) {
|
|
146
|
-
|
|
146
|
+
z = console.log, re = console.info, W = console.warn, $ = console.error, G = console.group, ee = console.groupCollapsed, ae = console.groupEnd;
|
|
147
147
|
var R = {
|
|
148
148
|
configurable: !0,
|
|
149
149
|
enumerable: !0,
|
|
150
|
-
value:
|
|
150
|
+
value: B,
|
|
151
151
|
writable: !0
|
|
152
152
|
};
|
|
153
153
|
Object.defineProperties(console, {
|
|
@@ -173,7 +173,7 @@ function lg() {
|
|
|
173
173
|
};
|
|
174
174
|
Object.defineProperties(console, {
|
|
175
175
|
log: N({}, R, {
|
|
176
|
-
value:
|
|
176
|
+
value: z
|
|
177
177
|
}),
|
|
178
178
|
info: N({}, R, {
|
|
179
179
|
value: re
|
|
@@ -324,8 +324,8 @@ function lg() {
|
|
|
324
324
|
}
|
|
325
325
|
return "";
|
|
326
326
|
}
|
|
327
|
-
var
|
|
328
|
-
function
|
|
327
|
+
var Ze = Object.prototype.hasOwnProperty, Ye = {}, ft = m.ReactDebugCurrentFrame;
|
|
328
|
+
function Qe(R) {
|
|
329
329
|
if (R) {
|
|
330
330
|
var H = R._owner, ue = Ge(R.type, R._source, H ? H.type : null);
|
|
331
331
|
ft.setExtraStackFrame(ue);
|
|
@@ -334,7 +334,7 @@ function lg() {
|
|
|
334
334
|
}
|
|
335
335
|
function Oe(R, H, ue, Te, Ve) {
|
|
336
336
|
{
|
|
337
|
-
var $e = Function.call.bind(
|
|
337
|
+
var $e = Function.call.bind(Ze);
|
|
338
338
|
for (var Le in R)
|
|
339
339
|
if ($e(R, Le)) {
|
|
340
340
|
var L = void 0;
|
|
@@ -347,7 +347,7 @@ function lg() {
|
|
|
347
347
|
} catch (he) {
|
|
348
348
|
L = he;
|
|
349
349
|
}
|
|
350
|
-
L && !(L instanceof Error) && (
|
|
350
|
+
L && !(L instanceof Error) && (Qe(Ve), 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).", Te || "React class", ue, Le, typeof L), Qe(null)), L instanceof Error && !(L.message in Ye) && (Ye[L.message] = !0, Qe(Ve), w("Failed %s type: %s", ue, L.message), Qe(null));
|
|
351
351
|
}
|
|
352
352
|
}
|
|
353
353
|
}
|
|
@@ -382,7 +382,7 @@ function lg() {
|
|
|
382
382
|
__source: !0
|
|
383
383
|
}, mt, At;
|
|
384
384
|
function yt(R) {
|
|
385
|
-
if (
|
|
385
|
+
if (Ze.call(R, "ref")) {
|
|
386
386
|
var H = Object.getOwnPropertyDescriptor(R, "ref").get;
|
|
387
387
|
if (H && H.isReactWarning)
|
|
388
388
|
return !1;
|
|
@@ -390,14 +390,14 @@ function lg() {
|
|
|
390
390
|
return R.ref !== void 0;
|
|
391
391
|
}
|
|
392
392
|
function at(R) {
|
|
393
|
-
if (
|
|
393
|
+
if (Ze.call(R, "key")) {
|
|
394
394
|
var H = Object.getOwnPropertyDescriptor(R, "key").get;
|
|
395
395
|
if (H && H.isReactWarning)
|
|
396
396
|
return !1;
|
|
397
397
|
}
|
|
398
398
|
return R.key !== void 0;
|
|
399
399
|
}
|
|
400
|
-
function
|
|
400
|
+
function Je(R, H) {
|
|
401
401
|
typeof R.ref == "string" && qe.current;
|
|
402
402
|
}
|
|
403
403
|
function Mt(R, H) {
|
|
@@ -411,7 +411,7 @@ function lg() {
|
|
|
411
411
|
});
|
|
412
412
|
}
|
|
413
413
|
}
|
|
414
|
-
function
|
|
414
|
+
function vt(R, H) {
|
|
415
415
|
{
|
|
416
416
|
var ue = function() {
|
|
417
417
|
At || (At = !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)", H));
|
|
@@ -454,9 +454,9 @@ function lg() {
|
|
|
454
454
|
function qn(R, H, ue, Te, Ve) {
|
|
455
455
|
{
|
|
456
456
|
var $e, Le = {}, L = null, fe = null;
|
|
457
|
-
ue !== void 0 && (we(ue), L = "" + ue), at(H) && (we(H.key), L = "" + H.key), yt(H) && (fe = H.ref,
|
|
457
|
+
ue !== void 0 && (we(ue), L = "" + ue), at(H) && (we(H.key), L = "" + H.key), yt(H) && (fe = H.ref, Je(H, Ve));
|
|
458
458
|
for ($e in H)
|
|
459
|
-
|
|
459
|
+
Ze.call(H, $e) && !ht.hasOwnProperty($e) && (Le[$e] = H[$e]);
|
|
460
460
|
if (R && R.defaultProps) {
|
|
461
461
|
var he = R.defaultProps;
|
|
462
462
|
for ($e in he)
|
|
@@ -464,7 +464,7 @@ function lg() {
|
|
|
464
464
|
}
|
|
465
465
|
if (L || fe) {
|
|
466
466
|
var ke = typeof R == "function" ? R.displayName || R.name || "Unknown" : R;
|
|
467
|
-
L && Mt(Le, ke), fe &&
|
|
467
|
+
L && Mt(Le, ke), fe && vt(Le, ke);
|
|
468
468
|
}
|
|
469
469
|
return et(R, L, fe, Ve, Te, qe.current, Le);
|
|
470
470
|
}
|
|
@@ -607,7 +607,7 @@ Check the top-level render call using <` + ue + ">.");
|
|
|
607
607
|
else
|
|
608
608
|
Yt(ot, R);
|
|
609
609
|
}
|
|
610
|
-
if (
|
|
610
|
+
if (Ze.call(H, "key")) {
|
|
611
611
|
var nn = O(R), Tt = Object.keys(H).filter(function(I) {
|
|
612
612
|
return I !== "key";
|
|
613
613
|
}), Xr = Tt.length > 0 ? "{key: someKey, " + Tt.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
@@ -1882,22 +1882,22 @@ const zu = (e) => {
|
|
|
1882
1882
|
duplex: "half"
|
|
1883
1883
|
}), ae;
|
|
1884
1884
|
if (P.isFormData(m) && (ae = ee.headers.get("content-type")) && A.setContentType(ae), ee.body) {
|
|
1885
|
-
const [
|
|
1885
|
+
const [B, se] = Wl(
|
|
1886
1886
|
j,
|
|
1887
1887
|
fs(Vl(S))
|
|
1888
1888
|
);
|
|
1889
|
-
m = ql(ee.body, Gl,
|
|
1889
|
+
m = ql(ee.body, Gl, B, se);
|
|
1890
1890
|
}
|
|
1891
1891
|
}
|
|
1892
1892
|
P.isString(_) || (_ = _ ? "include" : "omit");
|
|
1893
|
-
const
|
|
1893
|
+
const z = s && "credentials" in n.prototype, re = {
|
|
1894
1894
|
...M,
|
|
1895
1895
|
signal: q,
|
|
1896
1896
|
method: v.toUpperCase(),
|
|
1897
1897
|
headers: A.normalize().toJSON(),
|
|
1898
1898
|
body: m,
|
|
1899
1899
|
duplex: "half",
|
|
1900
|
-
credentials:
|
|
1900
|
+
credentials: z ? _ : void 0
|
|
1901
1901
|
};
|
|
1902
1902
|
O = s && new n(y, re);
|
|
1903
1903
|
let W = await (s ? F(O, M) : F(y, re));
|
|
@@ -1907,12 +1907,12 @@ const zu = (e) => {
|
|
|
1907
1907
|
["status", "statusText", "headers"].forEach((Ne) => {
|
|
1908
1908
|
ee[Ne] = W[Ne];
|
|
1909
1909
|
});
|
|
1910
|
-
const ae = P.toFiniteNumber(W.headers.get("content-length")), [
|
|
1910
|
+
const ae = P.toFiniteNumber(W.headers.get("content-length")), [B, se] = C && Wl(
|
|
1911
1911
|
ae,
|
|
1912
1912
|
fs(Vl(C), !0)
|
|
1913
1913
|
) || [];
|
|
1914
1914
|
W = new r(
|
|
1915
|
-
ql(W.body, Gl,
|
|
1915
|
+
ql(W.body, Gl, B, () => {
|
|
1916
1916
|
se && se(), N && N();
|
|
1917
1917
|
}),
|
|
1918
1918
|
ee
|
|
@@ -1930,13 +1930,13 @@ const zu = (e) => {
|
|
|
1930
1930
|
request: O
|
|
1931
1931
|
});
|
|
1932
1932
|
});
|
|
1933
|
-
} catch (
|
|
1934
|
-
throw N && N(),
|
|
1933
|
+
} catch (z) {
|
|
1934
|
+
throw N && N(), z && z.name === "TypeError" && /Load failed|fetch/i.test(z.message) ? Object.assign(
|
|
1935
1935
|
new je("Network Error", je.ERR_NETWORK, x, O),
|
|
1936
1936
|
{
|
|
1937
|
-
cause:
|
|
1937
|
+
cause: z.cause || z
|
|
1938
1938
|
}
|
|
1939
|
-
) : je.from(
|
|
1939
|
+
) : je.from(z, z && z.code, x, O);
|
|
1940
1940
|
}
|
|
1941
1941
|
};
|
|
1942
1942
|
}, _x = /* @__PURE__ */ new Map(), Bu = (e) => {
|
|
@@ -2349,26 +2349,26 @@ function Vu(e) {
|
|
|
2349
2349
|
return Vu(mr(e, o));
|
|
2350
2350
|
}, n;
|
|
2351
2351
|
}
|
|
2352
|
-
const
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2352
|
+
const St = Vu(Ao);
|
|
2353
|
+
St.Axios = hr;
|
|
2354
|
+
St.CanceledError = Wr;
|
|
2355
|
+
St.CancelToken = Ox;
|
|
2356
|
+
St.isCancel = Lu;
|
|
2357
|
+
St.VERSION = Uu;
|
|
2358
|
+
St.toFormData = $s;
|
|
2359
|
+
St.AxiosError = je;
|
|
2360
|
+
St.Cancel = St.CanceledError;
|
|
2361
|
+
St.all = function(t) {
|
|
2362
2362
|
return Promise.all(t);
|
|
2363
2363
|
};
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2364
|
+
St.spread = Mx;
|
|
2365
|
+
St.isAxiosError = Dx;
|
|
2366
|
+
St.mergeConfig = mr;
|
|
2367
|
+
St.AxiosHeaders = Kt;
|
|
2368
|
+
St.formToJSON = (e) => Du(P.isHTMLForm(e) ? new FormData(e) : e);
|
|
2369
|
+
St.getAdapter = Hu.getAdapter;
|
|
2370
|
+
St.HttpStatusCode = ea;
|
|
2371
|
+
St.default = St;
|
|
2372
2372
|
const {
|
|
2373
2373
|
Axios: Gk,
|
|
2374
2374
|
AxiosError: Yk,
|
|
@@ -2386,7 +2386,7 @@ const {
|
|
|
2386
2386
|
formToJSON: aR,
|
|
2387
2387
|
getAdapter: lR,
|
|
2388
2388
|
mergeConfig: cR
|
|
2389
|
-
} =
|
|
2389
|
+
} = St, tc = typeof window < "u" ? window.__API_BASE_URL__ : void 0, nc = tc ? Wn(tc) : void 0;
|
|
2390
2390
|
function Wn(e) {
|
|
2391
2391
|
const n = (e != null && e.trim() ? e.trim() : "/api/chat").replace(/\/+$/, "");
|
|
2392
2392
|
return n ? n.endsWith("/chat") ? n : `${n}/chat` : "/api/chat";
|
|
@@ -2402,7 +2402,7 @@ function rc(e) {
|
|
|
2402
2402
|
function Fx(e) {
|
|
2403
2403
|
return ta.add(e), () => ta.delete(e);
|
|
2404
2404
|
}
|
|
2405
|
-
const cn =
|
|
2405
|
+
const cn = St.create({
|
|
2406
2406
|
// Only set baseURL when configured — do NOT fall back to localhost. Falling back causes
|
|
2407
2407
|
// noisy network requests to the frontend Dev server when the backend isn't configured.
|
|
2408
2408
|
...nc ? { baseURL: nc } : {},
|
|
@@ -3304,32 +3304,43 @@ function yy(e = {}) {
|
|
|
3304
3304
|
p(""), y(null), f(null);
|
|
3305
3305
|
}, []), M = be(async () => {
|
|
3306
3306
|
const O = k.current;
|
|
3307
|
-
if (!
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
})
|
|
3321
|
-
|
|
3322
|
-
|
|
3307
|
+
if (!O || !O.threadId) {
|
|
3308
|
+
console.warn("[use-chat] cancelActiveRun: no active run context or threadId", { ctx: O });
|
|
3309
|
+
return;
|
|
3310
|
+
}
|
|
3311
|
+
try {
|
|
3312
|
+
console.debug("[use-chat] cancelActiveRun -> sending cancel request for thread", O.threadId);
|
|
3313
|
+
const N = {
|
|
3314
|
+
...O.headers,
|
|
3315
|
+
Accept: "application/json",
|
|
3316
|
+
"Content-Type": "application/json"
|
|
3317
|
+
}, j = await fetch(t + r, {
|
|
3318
|
+
method: "POST",
|
|
3319
|
+
headers: N,
|
|
3320
|
+
body: JSON.stringify({ threadId: O.threadId }),
|
|
3321
|
+
credentials: a
|
|
3322
|
+
});
|
|
3323
|
+
if (console.debug("[use-chat] cancelActiveRun: response status", j.status), j.ok)
|
|
3324
|
+
console.debug("[use-chat] cancel request succeeded");
|
|
3325
|
+
else {
|
|
3326
|
+
const z = await j.text().catch(() => "");
|
|
3327
|
+
console.warn("[use-chat] cancel request returned non-OK status:", j.status, z);
|
|
3323
3328
|
}
|
|
3329
|
+
} catch (N) {
|
|
3330
|
+
console.warn("[use-chat] cancel request failed:", N);
|
|
3331
|
+
}
|
|
3324
3332
|
}, [t, r, a]), F = be(() => {
|
|
3325
|
-
|
|
3326
|
-
|
|
3333
|
+
console.debug("[use-chat] stop() invoked"), Promise.resolve(M()).catch(() => {
|
|
3334
|
+
}).then(() => {
|
|
3335
|
+
var O;
|
|
3336
|
+
console.debug("[use-chat] stop() - cancel completed or failed, now aborting"), (O = T.current) == null || O.abort();
|
|
3337
|
+
}), T.current = null, k.current = null, c(!1), b(!1), S.current = 0, m(0);
|
|
3327
3338
|
}, [M]), q = be(
|
|
3328
3339
|
(O, N, j) => {
|
|
3329
3340
|
T.current && (T.current.abort(), T.current = null), c(!0), f(null), e.autoAppendAssistant !== !1 && p("");
|
|
3330
|
-
const
|
|
3331
|
-
return T.current =
|
|
3332
|
-
var W, $, G, ee, ae,
|
|
3341
|
+
const z = new AbortController();
|
|
3342
|
+
return T.current = z, (async () => {
|
|
3343
|
+
var W, $, G, ee, ae, B, se, Ne, Ie;
|
|
3333
3344
|
const re = (K) => {
|
|
3334
3345
|
var D;
|
|
3335
3346
|
try {
|
|
@@ -3384,7 +3395,7 @@ function yy(e = {}) {
|
|
|
3384
3395
|
method: "POST",
|
|
3385
3396
|
headers: te,
|
|
3386
3397
|
body: JSON.stringify(O),
|
|
3387
|
-
signal:
|
|
3398
|
+
signal: z.signal,
|
|
3388
3399
|
credentials: a
|
|
3389
3400
|
});
|
|
3390
3401
|
if (k.current = {
|
|
@@ -3404,14 +3415,14 @@ function yy(e = {}) {
|
|
|
3404
3415
|
const ie = ce.body.getReader(), de = new TextDecoder();
|
|
3405
3416
|
let Be = "", Ge = [];
|
|
3406
3417
|
S.current = 0, m(0);
|
|
3407
|
-
let
|
|
3418
|
+
let Ze = 0, Ye = null;
|
|
3408
3419
|
const ft = () => {
|
|
3409
3420
|
if (Ge.length) {
|
|
3410
3421
|
const He = Ge.join("");
|
|
3411
3422
|
Ge = [], C.current && p((Z) => Z + He);
|
|
3412
3423
|
}
|
|
3413
3424
|
Ye = null;
|
|
3414
|
-
},
|
|
3425
|
+
}, Qe = () => {
|
|
3415
3426
|
typeof window < "u" && Ye == null && (Ye = requestAnimationFrame(ft));
|
|
3416
3427
|
};
|
|
3417
3428
|
let Oe = Date.now();
|
|
@@ -3419,7 +3430,7 @@ function yy(e = {}) {
|
|
|
3419
3430
|
var He;
|
|
3420
3431
|
if (Date.now() - Oe > 6e4) {
|
|
3421
3432
|
const Z = "Stream idle timeout";
|
|
3422
|
-
f(Z),
|
|
3433
|
+
f(Z), z.abort(), (He = j == null ? void 0 : j.onError) == null || He.call(j, Z);
|
|
3423
3434
|
}
|
|
3424
3435
|
}, 5e3), Ot = 1024 * 1024;
|
|
3425
3436
|
try {
|
|
@@ -3446,29 +3457,39 @@ function yy(e = {}) {
|
|
|
3446
3457
|
console.debug("[use-chat] malformed SSE:", yt.slice(0, 200));
|
|
3447
3458
|
continue;
|
|
3448
3459
|
}
|
|
3449
|
-
const
|
|
3460
|
+
const Je = vy(at) ? at.data : at;
|
|
3450
3461
|
Oe = Date.now();
|
|
3451
|
-
const Mt =
|
|
3462
|
+
const Mt = Je.seq;
|
|
3452
3463
|
if (Mt !== void 0) {
|
|
3453
|
-
if (Mt <=
|
|
3454
|
-
console.debug("[use-chat] drop duplicate/out-of-order event", { seq: Mt, lastProcessedSeq:
|
|
3464
|
+
if (Mt <= Ze) {
|
|
3465
|
+
console.debug("[use-chat] drop duplicate/out-of-order event", { seq: Mt, lastProcessedSeq: Ze, type: Je.type });
|
|
3455
3466
|
continue;
|
|
3456
3467
|
}
|
|
3457
|
-
|
|
3468
|
+
Ze > 0 && Mt > Ze + 1 && ((B = j == null ? void 0 : j.onGap) == null || B.call(j, { from: Ze, to: Mt })), Ze = Mt, S.current = Mt, m(Mt);
|
|
3458
3469
|
}
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3470
|
+
console.debug("[use-chat] received event", {
|
|
3471
|
+
seq: Je.seq,
|
|
3472
|
+
type: Je.type,
|
|
3473
|
+
preview: (() => {
|
|
3474
|
+
var vt;
|
|
3475
|
+
try {
|
|
3476
|
+
return Je.type === "message_delta" ? { deltaTypes: (vt = Je.delta) == null ? void 0 : vt.map((et) => et.type), textLen: (Je.delta || []).filter((et) => et.type === "text").map((et) => String(et.text || "").length) } : Je.content || Je.delta ? { hasContent: !0 } : {};
|
|
3477
|
+
} catch (et) {
|
|
3478
|
+
return { err: String(et) };
|
|
3479
|
+
}
|
|
3480
|
+
})()
|
|
3481
|
+
});
|
|
3482
|
+
try {
|
|
3483
|
+
N == null || N(Je);
|
|
3484
|
+
} catch (vt) {
|
|
3485
|
+
console.error("[use-chat] Error in onEvent callback:", vt, "for event:", Je.type);
|
|
3486
|
+
}
|
|
3487
|
+
if (Je.type === "token" && e.autoAppendAssistant !== !1)
|
|
3488
|
+
Ge.push(Je.content), Qe();
|
|
3489
|
+
else if (Je.type === "message_delta") {
|
|
3490
|
+
const vt = Je.delta.filter((et) => et.type === "text").map((et) => et.text).join("");
|
|
3491
|
+
vt && e.autoAppendAssistant !== !1 && (Ge.push(vt), Qe());
|
|
3492
|
+
} else Je.type === "heartbeat" ? console.debug("[use-chat] heartbeat received") : (Ye !== null && cancelAnimationFrame(Ye), ft(), Je.type === "checkpoint" ? y(Je.checkpointId) : Je.type === "error" && f(Je.message));
|
|
3472
3493
|
}
|
|
3473
3494
|
}
|
|
3474
3495
|
ft();
|
|
@@ -3494,7 +3515,7 @@ function yy(e = {}) {
|
|
|
3494
3515
|
} finally {
|
|
3495
3516
|
c(!1), b(!1), T.current = null, S.current = 0, m(0), k.current = null;
|
|
3496
3517
|
}
|
|
3497
|
-
})(), { close: () =>
|
|
3518
|
+
})(), { close: () => z.abort() };
|
|
3498
3519
|
},
|
|
3499
3520
|
[t, n, o, e.autoAppendAssistant]
|
|
3500
3521
|
);
|
|
@@ -3547,14 +3568,27 @@ function by({
|
|
|
3547
3568
|
s.current = x;
|
|
3548
3569
|
}
|
|
3549
3570
|
if (p.type === "thread_info") {
|
|
3550
|
-
console.log("[useChatStreamingService] 🎯 Received thread_info event:", p)
|
|
3571
|
+
console.log("[useChatStreamingService] 🎯 Received thread_info event:", p);
|
|
3572
|
+
try {
|
|
3573
|
+
t(p);
|
|
3574
|
+
} catch (y) {
|
|
3575
|
+
console.error("[useChatStreamingService] Error in onThreadInfo handler:", y);
|
|
3576
|
+
}
|
|
3551
3577
|
return;
|
|
3552
3578
|
}
|
|
3553
3579
|
if (ly(p)) {
|
|
3554
|
-
|
|
3580
|
+
try {
|
|
3581
|
+
n(p);
|
|
3582
|
+
} catch (y) {
|
|
3583
|
+
console.error("[useChatStreamingService] Error in onMessageEvent handler:", y);
|
|
3584
|
+
}
|
|
3555
3585
|
return;
|
|
3556
3586
|
}
|
|
3557
|
-
|
|
3587
|
+
try {
|
|
3588
|
+
r == null || r(p);
|
|
3589
|
+
} catch (y) {
|
|
3590
|
+
console.error("[useChatStreamingService] Error in onUnhandledEvent handler:", y);
|
|
3591
|
+
}
|
|
3558
3592
|
},
|
|
3559
3593
|
[n, o, t, r]
|
|
3560
3594
|
), { stream: a, stop: l, isStreaming: c, error: d, setToken: f } = yy({
|
|
@@ -3880,24 +3914,24 @@ function zy({
|
|
|
3880
3914
|
Ti(f, (I = l.getAuthToken) == null ? void 0 : I.call(l))
|
|
3881
3915
|
);
|
|
3882
3916
|
return zo(E);
|
|
3883
|
-
}), C = ct(() => Ri(b), [b]), [S, k] = xe(t), [A, _] = xe(!1), [M, F] = xe(!1), [q, O] = xe(null), [N, j] = xe(null), [
|
|
3917
|
+
}), C = ct(() => Ri(b), [b]), [S, k] = xe(t), [A, _] = xe(!1), [M, F] = xe(!1), [q, O] = xe(null), [N, j] = xe(null), [z, re] = xe(null), [W, $] = xe([]), G = be(() => {
|
|
3884
3918
|
const E = ki(m);
|
|
3885
3919
|
Lo(() => {
|
|
3886
3920
|
T(zo(E));
|
|
3887
3921
|
});
|
|
3888
|
-
}, [m]), [ee, ae] = xe(!1), [
|
|
3922
|
+
}, [m]), [ee, ae] = xe(!1), [B, se] = xe(!1), [Ne, Ie] = xe(null), [K, D] = xe(void 0), [X, te] = xe(void 0), [ce, ie] = xe(void 0), {
|
|
3889
3923
|
state: de,
|
|
3890
3924
|
dispatch: Be,
|
|
3891
3925
|
seed: Ge,
|
|
3892
|
-
prepend:
|
|
3926
|
+
prepend: Ze,
|
|
3893
3927
|
pushUser: Ye,
|
|
3894
3928
|
onEvent: ft,
|
|
3895
|
-
reset:
|
|
3929
|
+
reset: Qe
|
|
3896
3930
|
} = dy(), Oe = De(S);
|
|
3897
3931
|
lt(() => {
|
|
3898
3932
|
Oe.current = S;
|
|
3899
3933
|
}, [S]);
|
|
3900
|
-
const It = De(!1), Ot = De([]), He = De(null), Z = De(null), ve = De(/* @__PURE__ */ new Map()), we = De(S), qe = De(!1), ht = De(null), mt = De(/* @__PURE__ */ new Map()), At = De(/* @__PURE__ */ new Map()), yt = De(/* @__PURE__ */ new Map()), at = De(/* @__PURE__ */ new Map()),
|
|
3934
|
+
const It = De(!1), Ot = De([]), He = De(null), Z = De(null), ve = De(/* @__PURE__ */ new Map()), we = De(S), qe = De(!1), ht = De(null), mt = De(/* @__PURE__ */ new Map()), At = De(/* @__PURE__ */ new Map()), yt = De(/* @__PURE__ */ new Map()), at = De(/* @__PURE__ */ new Map()), Je = be(
|
|
3901
3935
|
(E) => {
|
|
3902
3936
|
if (!E) {
|
|
3903
3937
|
$([]);
|
|
@@ -3915,8 +3949,8 @@ function zy({
|
|
|
3915
3949
|
[]
|
|
3916
3950
|
);
|
|
3917
3951
|
lt(() => {
|
|
3918
|
-
|
|
3919
|
-
}, [S,
|
|
3952
|
+
Je(S);
|
|
3953
|
+
}, [S, Je]);
|
|
3920
3954
|
const Mt = be(() => {
|
|
3921
3955
|
var ne;
|
|
3922
3956
|
const E = at.current;
|
|
@@ -3926,7 +3960,7 @@ function zy({
|
|
|
3926
3960
|
const Q = (ne = I[le]) == null ? void 0 : ne[0];
|
|
3927
3961
|
Q && E.delete(Q);
|
|
3928
3962
|
}
|
|
3929
|
-
}, []),
|
|
3963
|
+
}, []), vt = be(
|
|
3930
3964
|
(E, I, Y) => {
|
|
3931
3965
|
if (!E) return;
|
|
3932
3966
|
const ne = Y === "replace" ? [] : mt.current.get(E) ?? [], le = Y === "replace" ? I : [...I, ...ne];
|
|
@@ -3937,21 +3971,21 @@ function zy({
|
|
|
3937
3971
|
const Q = /* @__PURE__ */ new Map();
|
|
3938
3972
|
for (const Ue of le) {
|
|
3939
3973
|
if (!(Ue != null && Ue.checkpointId)) continue;
|
|
3940
|
-
const Me = `${Ue.checkpointId}::${Ue.checkpointNs ?? ""}`, tt = on(Ue, { cloneMessages: !0 }),
|
|
3941
|
-
if (!
|
|
3974
|
+
const Me = `${Ue.checkpointId}::${Ue.checkpointNs ?? ""}`, tt = on(Ue, { cloneMessages: !0 }), wt = Q.get(Me);
|
|
3975
|
+
if (!wt) {
|
|
3942
3976
|
Q.set(Me, tt);
|
|
3943
3977
|
continue;
|
|
3944
3978
|
}
|
|
3945
|
-
const Nt = hc(
|
|
3946
|
-
Q.set(Me, { ...
|
|
3979
|
+
const Nt = hc(wt, tt);
|
|
3980
|
+
Q.set(Me, { ...wt, ...Nt });
|
|
3947
3981
|
}
|
|
3948
3982
|
const ze = Array.from(Q.values()).sort((Ue, Me) => {
|
|
3949
3983
|
const tt = Number.isFinite(Date.parse(Ue.createdAt ?? "")) ? Date.parse(Ue.createdAt ?? "") : 0;
|
|
3950
3984
|
return (Number.isFinite(Date.parse(Me.createdAt ?? "")) ? Date.parse(Me.createdAt ?? "") : 0) - tt;
|
|
3951
3985
|
});
|
|
3952
|
-
mt.current.set(E, ze), E === Oe.current &&
|
|
3986
|
+
mt.current.set(E, ze), E === Oe.current && Je(E);
|
|
3953
3987
|
},
|
|
3954
|
-
[
|
|
3988
|
+
[Je]
|
|
3955
3989
|
), et = be(
|
|
3956
3990
|
(E, I, Y) => {
|
|
3957
3991
|
if (!E) return;
|
|
@@ -4012,8 +4046,8 @@ function zy({
|
|
|
4012
4046
|
dn.current = C.length;
|
|
4013
4047
|
}, [C.length]), lt(() => {
|
|
4014
4048
|
const E = de.pendingInterrupt ?? ky(de.messages);
|
|
4015
|
-
cc(
|
|
4016
|
-
}, [
|
|
4049
|
+
cc(z, E) || re(E ?? null);
|
|
4050
|
+
}, [z, de.messages, de.pendingInterrupt]);
|
|
4017
4051
|
const Dt = be(async () => {
|
|
4018
4052
|
const E = dn.current > 0;
|
|
4019
4053
|
E || _(!0);
|
|
@@ -4089,7 +4123,7 @@ function zy({
|
|
|
4089
4123
|
}), re(Q.interrupt ?? null), Ie(Q.nextCursor ?? null), ae(!!Q.nextCursor), D(Q.checkpointId ?? void 0), te(Q.checkpointNs ?? void 0), ie(Q.nextCursorNs ?? void 0);
|
|
4090
4124
|
return;
|
|
4091
4125
|
}
|
|
4092
|
-
const Me = ve.current.get(le), tt = (Me == null ? void 0 : Me.snapshot) ?? null,
|
|
4126
|
+
const Me = ve.current.get(le), tt = (Me == null ? void 0 : Me.snapshot) ?? null, wt = Array.isArray(tt == null ? void 0 : tt.messages) ? tt.messages : [], Nt = on(tt), kn = Array.isArray(E == null ? void 0 : E.messages) ? E.messages : [], _t = /* @__PURE__ */ new Set(), jt = [...kn, ...wt].filter((Rt) => {
|
|
4093
4127
|
const yi = Rt == null ? void 0 : Rt.id;
|
|
4094
4128
|
return yi ? _t.has(yi) ? !1 : (_t.add(yi), !0) : !0;
|
|
4095
4129
|
}), Jr = hc(Nt, Q), Zr = {
|
|
@@ -4112,7 +4146,7 @@ function zy({
|
|
|
4112
4146
|
snapshot: on(Zr, { cloneMessages: !0 })
|
|
4113
4147
|
}), !ze)
|
|
4114
4148
|
return;
|
|
4115
|
-
kn.length &&
|
|
4149
|
+
kn.length && Ze(kn);
|
|
4116
4150
|
const Rn = E && Object.prototype.hasOwnProperty.call(E, "checkpointId") ? E.checkpointId : void 0, Qr = E && Object.prototype.hasOwnProperty.call(E, "checkpointNs") ? E.checkpointNs : void 0, En = E && Object.prototype.hasOwnProperty.call(E, "nextCursor") ? E.nextCursor : void 0, xi = E && Object.prototype.hasOwnProperty.call(E, "nextCursorNs") ? E.nextCursorNs : void 0;
|
|
4117
4151
|
Ie(
|
|
4118
4152
|
(Rt) => En !== void 0 ? En ?? Rt ?? null : Rt ?? null
|
|
@@ -4126,7 +4160,7 @@ function zy({
|
|
|
4126
4160
|
(Rt) => xi !== void 0 ? xi ?? void 0 : Rt
|
|
4127
4161
|
);
|
|
4128
4162
|
},
|
|
4129
|
-
[
|
|
4163
|
+
[Ze, Ge, re]
|
|
4130
4164
|
), lr = be(
|
|
4131
4165
|
(E) => {
|
|
4132
4166
|
if (E.threadId != null && E.threadId !== Oe.current)
|
|
@@ -4136,9 +4170,9 @@ function zy({
|
|
|
4136
4170
|
checkpointId: I.checkpointId ?? null,
|
|
4137
4171
|
checkpointNs: I.checkpointNs ?? null,
|
|
4138
4172
|
pendingInterrupt: I.interrupt ?? null
|
|
4139
|
-
}), re(I.interrupt ?? null), Ie(I.nextCursor ?? null), ae(!!I.nextCursor), D(I.checkpointId ?? void 0), te(I.checkpointNs ?? void 0), ie(I.nextCursorNs ?? void 0), we.current = E.threadId,
|
|
4173
|
+
}), re(I.interrupt ?? null), Ie(I.nextCursor ?? null), ae(!!I.nextCursor), D(I.checkpointId ?? void 0), te(I.checkpointNs ?? void 0), ie(I.nextCursorNs ?? void 0), we.current = E.threadId, Je(E.threadId ?? Oe.current ?? null);
|
|
4140
4174
|
},
|
|
4141
|
-
[Ge, re,
|
|
4175
|
+
[Ge, re, Je]
|
|
4142
4176
|
), Tn = be((E) => {
|
|
4143
4177
|
if (!E) return;
|
|
4144
4178
|
ve.current.delete(E), y(E), mt.current.delete(E), At.current.delete(E), E === Oe.current && $([]);
|
|
@@ -4150,8 +4184,8 @@ function zy({
|
|
|
4150
4184
|
we.current === E && (we.current = null);
|
|
4151
4185
|
}, [y]), pn = be(() => {
|
|
4152
4186
|
const E = Oe.current;
|
|
4153
|
-
E && Tn(E),
|
|
4154
|
-
}, [Tn,
|
|
4187
|
+
E && Tn(E), Qe([]), ae(!1), se(!1), Ie(null), D(void 0), te(void 0), ie(void 0);
|
|
4188
|
+
}, [Tn, Qe]), Hn = be(({ from: E, to: I }) => {
|
|
4155
4189
|
const Y = Oe.current;
|
|
4156
4190
|
Y && console.warn(
|
|
4157
4191
|
`[ChatSessionProvider] Stream sequence gap detected (${E} -> ${I}) for thread ${Y}`
|
|
@@ -4266,7 +4300,7 @@ function zy({
|
|
|
4266
4300
|
if (!Ue) return ze;
|
|
4267
4301
|
const Me = { ...ze.byId };
|
|
4268
4302
|
delete Me[I], Me[Q] = { ...Ue, threadId: Q };
|
|
4269
|
-
const tt = ze.order.map((
|
|
4303
|
+
const tt = ze.order.map((wt) => wt === I ? Q : wt);
|
|
4270
4304
|
return { byId: Me, order: tt };
|
|
4271
4305
|
}), k(Q), setTimeout(() => Dt(), 10), O(null), Q;
|
|
4272
4306
|
} catch (le) {
|
|
@@ -4327,31 +4361,31 @@ function zy({
|
|
|
4327
4361
|
I ?? null,
|
|
4328
4362
|
Y ?? null
|
|
4329
4363
|
), Ue = at.current.get(ze), Me = !ne && !I && !Y && Ue && Date.now() - Ue.timestamp < Dy, tt = !ne && !I && !Y;
|
|
4330
|
-
let
|
|
4364
|
+
let wt = !1;
|
|
4331
4365
|
if (tt) {
|
|
4332
4366
|
const _t = ve.current.get(E);
|
|
4333
4367
|
if (_t)
|
|
4334
|
-
lr(_t),
|
|
4368
|
+
lr(_t), wt = !0;
|
|
4335
4369
|
else {
|
|
4336
4370
|
const jt = p(E);
|
|
4337
|
-
jt && (ve.current.set(E, jt), lr(jt),
|
|
4371
|
+
jt && (ve.current.set(E, jt), lr(jt), wt = !0);
|
|
4338
4372
|
}
|
|
4339
4373
|
}
|
|
4340
|
-
const Nt = ne || !
|
|
4374
|
+
const Nt = ne || !wt || !!I || !!Y, kn = async (_t) => {
|
|
4341
4375
|
_t && F(!0), He.current = E;
|
|
4342
4376
|
try {
|
|
4343
4377
|
const jt = await qn(
|
|
4344
4378
|
{ threadId: E, checkpointId: I, checkpointNs: Y },
|
|
4345
4379
|
{ force: ne }
|
|
4346
4380
|
), { latest: Jr, checkpoints: Zr, snapshots: Rn } = na(jt);
|
|
4347
|
-
Yt(Jr, "replace", E),
|
|
4381
|
+
Yt(Jr, "replace", E), vt(E, Zr, "replace"), et(E, Rn, "replace"), j(null);
|
|
4348
4382
|
} catch (jt) {
|
|
4349
|
-
throw (!
|
|
4383
|
+
throw (!wt || ne || _t) && (i == null || i(String(jt))), j(String(jt)), jt;
|
|
4350
4384
|
} finally {
|
|
4351
4385
|
He.current = null, _t && F(!1);
|
|
4352
4386
|
}
|
|
4353
4387
|
};
|
|
4354
|
-
Nt ? await kn(!0) : tt &&
|
|
4388
|
+
Nt ? await kn(!0) : tt && wt && !Me && kn(!1).catch((_t) => {
|
|
4355
4389
|
console.warn("[ChatSessionProvider] Background refresh failed:", _t);
|
|
4356
4390
|
});
|
|
4357
4391
|
}, `loadThread-${E}`);
|
|
@@ -4362,7 +4396,7 @@ function zy({
|
|
|
4362
4396
|
Gt,
|
|
4363
4397
|
qn,
|
|
4364
4398
|
i,
|
|
4365
|
-
|
|
4399
|
+
vt,
|
|
4366
4400
|
et
|
|
4367
4401
|
]
|
|
4368
4402
|
), Le = be(async () => {
|
|
@@ -4396,7 +4430,7 @@ function zy({
|
|
|
4396
4430
|
}, [$e]), he = be(
|
|
4397
4431
|
async () => {
|
|
4398
4432
|
if (!Oe.current) throw new Error("No active thread");
|
|
4399
|
-
if (
|
|
4433
|
+
if (B || !ee) return;
|
|
4400
4434
|
const E = Ne;
|
|
4401
4435
|
if (E) {
|
|
4402
4436
|
se(!0);
|
|
@@ -4416,7 +4450,7 @@ function zy({
|
|
|
4416
4450
|
Ie(null), ie(void 0), ae(!1), j(null);
|
|
4417
4451
|
return;
|
|
4418
4452
|
}
|
|
4419
|
-
Yt(ne, "prepend", I ?? void 0), I && (
|
|
4453
|
+
Yt(ne, "prepend", I ?? void 0), I && (vt(I, le, "prepend"), et(I, Q, "prepend")), j(null);
|
|
4420
4454
|
} catch (I) {
|
|
4421
4455
|
throw j(String(I)), I;
|
|
4422
4456
|
} finally {
|
|
@@ -4432,8 +4466,8 @@ function zy({
|
|
|
4432
4466
|
X,
|
|
4433
4467
|
ce,
|
|
4434
4468
|
Ne,
|
|
4435
|
-
|
|
4436
|
-
|
|
4469
|
+
B,
|
|
4470
|
+
vt,
|
|
4437
4471
|
et
|
|
4438
4472
|
]
|
|
4439
4473
|
), ke = be(
|
|
@@ -4470,7 +4504,7 @@ function zy({
|
|
|
4470
4504
|
Q
|
|
4471
4505
|
), tt = [...Ue];
|
|
4472
4506
|
ne && ne.trim() && tt.push({ type: "text", text: ne.trim() });
|
|
4473
|
-
const
|
|
4507
|
+
const wt = !!Y, Nt = wt ? (I == null ? void 0 : I.checkpointId) ?? de.lastCheckpointId ?? void 0 : void 0, kn = wt ? (I == null ? void 0 : I.checkpointNs) ?? de.lastCheckpointNs ?? void 0 : void 0, _t = {
|
|
4474
4508
|
id: ((Qr = crypto.randomUUID) == null ? void 0 : Qr.call(crypto)) || `user-${Date.now()}`,
|
|
4475
4509
|
role: "user",
|
|
4476
4510
|
content: tt,
|
|
@@ -4575,10 +4609,10 @@ function zy({
|
|
|
4575
4609
|
messages: de.messages.slice(),
|
|
4576
4610
|
nextCursor: Ne ?? null,
|
|
4577
4611
|
nextCursorNs: ce ?? null,
|
|
4578
|
-
interrupt: de.pendingInterrupt ??
|
|
4612
|
+
interrupt: de.pendingInterrupt ?? z ?? null
|
|
4579
4613
|
}), Y = ve.current.get(E), ne = Y == null ? void 0 : Y.snapshot, le = !ne || ne.messages.length !== I.messages.length || ne.messages.some((Me, tt) => {
|
|
4580
|
-
var
|
|
4581
|
-
return (Me == null ? void 0 : Me.id) !== ((
|
|
4614
|
+
var wt;
|
|
4615
|
+
return (Me == null ? void 0 : Me.id) !== ((wt = I.messages[tt]) == null ? void 0 : wt.id);
|
|
4582
4616
|
}), Q = ((ne == null ? void 0 : ne.checkpointId) ?? null) !== I.checkpointId || ((ne == null ? void 0 : ne.checkpointNs) ?? null) !== I.checkpointNs, ze = ((ne == null ? void 0 : ne.nextCursor) ?? null) !== I.nextCursor || ((ne == null ? void 0 : ne.nextCursorNs) ?? null) !== I.nextCursorNs, Ue = !cc(
|
|
4583
4617
|
(ne == null ? void 0 : ne.interrupt) ?? null,
|
|
4584
4618
|
I.interrupt ?? null
|
|
@@ -4603,7 +4637,7 @@ function zy({
|
|
|
4603
4637
|
de.lastCheckpointNs,
|
|
4604
4638
|
de.messages,
|
|
4605
4639
|
de.pendingInterrupt,
|
|
4606
|
-
|
|
4640
|
+
z,
|
|
4607
4641
|
x
|
|
4608
4642
|
]);
|
|
4609
4643
|
const nn = ct(
|
|
@@ -4644,7 +4678,7 @@ function zy({
|
|
|
4644
4678
|
return {
|
|
4645
4679
|
threadId: S,
|
|
4646
4680
|
messages: de.messages,
|
|
4647
|
-
interrupt:
|
|
4681
|
+
interrupt: z,
|
|
4648
4682
|
checkpoint: {
|
|
4649
4683
|
id: de.lastCheckpointId ?? null,
|
|
4650
4684
|
namespace: de.lastCheckpointNs ?? null
|
|
@@ -4652,7 +4686,7 @@ function zy({
|
|
|
4652
4686
|
checkpoints: W,
|
|
4653
4687
|
metadata: Y,
|
|
4654
4688
|
isLoading: M,
|
|
4655
|
-
isHistoryLoading:
|
|
4689
|
+
isHistoryLoading: B,
|
|
4656
4690
|
error: N,
|
|
4657
4691
|
hasMore: ee,
|
|
4658
4692
|
loadOlder: he,
|
|
@@ -4668,9 +4702,9 @@ function zy({
|
|
|
4668
4702
|
Le,
|
|
4669
4703
|
pn,
|
|
4670
4704
|
S,
|
|
4671
|
-
B,
|
|
4672
|
-
ee,
|
|
4673
4705
|
z,
|
|
4706
|
+
ee,
|
|
4707
|
+
B,
|
|
4674
4708
|
M,
|
|
4675
4709
|
he,
|
|
4676
4710
|
$e,
|
|
@@ -4824,15 +4858,15 @@ function Uy({
|
|
|
4824
4858
|
k();
|
|
4825
4859
|
}, [k, m]);
|
|
4826
4860
|
const A = U.useCallback(
|
|
4827
|
-
(j, { fromUser:
|
|
4828
|
-
x || v(j),
|
|
4861
|
+
(j, { fromUser: z }) => {
|
|
4862
|
+
x || v(j), z && (a == null || a(j));
|
|
4829
4863
|
},
|
|
4830
4864
|
[x, a]
|
|
4831
4865
|
), _ = U.useCallback(
|
|
4832
4866
|
async (j) => {
|
|
4833
4867
|
j && j.preventDefault();
|
|
4834
|
-
const
|
|
4835
|
-
if (!
|
|
4868
|
+
const z = (m ?? "").trim();
|
|
4869
|
+
if (!z && !p)
|
|
4836
4870
|
return;
|
|
4837
4871
|
const re = ++C.current;
|
|
4838
4872
|
S.current = {
|
|
@@ -4841,10 +4875,10 @@ function Uy({
|
|
|
4841
4875
|
}, b(() => {
|
|
4842
4876
|
var W, $, G;
|
|
4843
4877
|
try {
|
|
4844
|
-
const ee = l(
|
|
4878
|
+
const ee = l(z);
|
|
4845
4879
|
ee && typeof ee.then == "function" ? ee.then(() => {
|
|
4846
|
-
var ae,
|
|
4847
|
-
((ae = S.current) == null ? void 0 : ae.id) === re && S.current.shouldClear && (x || (v(""), T.current && (T.current.style.height = "auto"), a == null || a(""))), ((
|
|
4880
|
+
var ae, B;
|
|
4881
|
+
((ae = S.current) == null ? void 0 : ae.id) === re && S.current.shouldClear && (x || (v(""), T.current && (T.current.style.height = "auto"), a == null || a(""))), ((B = S.current) == null ? void 0 : B.id) === re && (S.current = null);
|
|
4848
4882
|
}).catch(() => {
|
|
4849
4883
|
var ae;
|
|
4850
4884
|
((ae = S.current) == null ? void 0 : ae.id) === re && (S.current = null);
|
|
@@ -4856,8 +4890,8 @@ function Uy({
|
|
|
4856
4890
|
},
|
|
4857
4891
|
[m, l, p, x, a]
|
|
4858
4892
|
), M = U.useCallback((j) => {
|
|
4859
|
-
const
|
|
4860
|
-
A(
|
|
4893
|
+
const z = j.target.value;
|
|
4894
|
+
A(z, { fromUser: !0 }), S.current && (S.current.shouldClear = !1), T.current && (T.current.style.height = "auto", T.current.style.height = `${T.current.scrollHeight}px`);
|
|
4861
4895
|
}, [A]), F = U.useCallback(
|
|
4862
4896
|
(j) => {
|
|
4863
4897
|
j.key === "Enter" && !j.shiftKey ? (j.preventDefault(), _()) : j.key === "Escape" && t && (j.preventDefault(), c == null || c());
|
|
@@ -4952,7 +4986,7 @@ function Pe(e, t) {
|
|
|
4952
4986
|
function Ba(e) {
|
|
4953
4987
|
e(Vr);
|
|
4954
4988
|
}
|
|
4955
|
-
function
|
|
4989
|
+
function bt(e) {
|
|
4956
4990
|
return e(sd);
|
|
4957
4991
|
}
|
|
4958
4992
|
function ye(e, t) {
|
|
@@ -5119,7 +5153,7 @@ function Zy(e) {
|
|
|
5119
5153
|
};
|
|
5120
5154
|
return n(e);
|
|
5121
5155
|
}
|
|
5122
|
-
function
|
|
5156
|
+
function Ct(...e) {
|
|
5123
5157
|
const t = Ke(), n = new Array(e.length);
|
|
5124
5158
|
let r = 0;
|
|
5125
5159
|
const o = Math.pow(2, e.length) - 1;
|
|
@@ -5167,7 +5201,7 @@ const Qy = {
|
|
|
5167
5201
|
return {
|
|
5168
5202
|
log: J((t, n, r = 1) => {
|
|
5169
5203
|
var o;
|
|
5170
|
-
const s = (o = ev().VIRTUOSO_LOG_LEVEL) != null ? o :
|
|
5204
|
+
const s = (o = ev().VIRTUOSO_LOG_LEVEL) != null ? o : bt(e);
|
|
5171
5205
|
r >= s && console[Qy[r]](
|
|
5172
5206
|
"%creact-virtuoso: %c%s %o",
|
|
5173
5207
|
"color: #0253b3; font-weight: bold",
|
|
@@ -5691,7 +5725,7 @@ const pv = {
|
|
|
5691
5725
|
ye(
|
|
5692
5726
|
V(
|
|
5693
5727
|
d,
|
|
5694
|
-
Ee((C) => C !== void 0 && st(
|
|
5728
|
+
Ee((C) => C !== void 0 && st(bt(y).sizeTree)),
|
|
5695
5729
|
pe((C) => [{ endIndex: 0, size: C, startIndex: 0 }])
|
|
5696
5730
|
),
|
|
5697
5731
|
n
|
|
@@ -5720,11 +5754,11 @@ const pv = {
|
|
|
5720
5754
|
pe((C) => C.diff)
|
|
5721
5755
|
),
|
|
5722
5756
|
(C) => {
|
|
5723
|
-
const { groupIndices: S } =
|
|
5757
|
+
const { groupIndices: S } = bt(y);
|
|
5724
5758
|
if (C > 0)
|
|
5725
5759
|
Pe(t, !0), Pe(s, C + vc(C, S));
|
|
5726
5760
|
else if (C < 0) {
|
|
5727
|
-
const k =
|
|
5761
|
+
const k = bt(v);
|
|
5728
5762
|
k.length > 0 && (C -= vc(-C, k)), Pe(i, C);
|
|
5729
5763
|
}
|
|
5730
5764
|
}
|
|
@@ -5759,7 +5793,7 @@ const pv = {
|
|
|
5759
5793
|
}
|
|
5760
5794
|
const O = fr(S.sizeTree);
|
|
5761
5795
|
return F !== C && O.shift(), O.reduce(
|
|
5762
|
-
(N, { k: j, v:
|
|
5796
|
+
(N, { k: j, v: z }) => {
|
|
5763
5797
|
let re = N.ranges;
|
|
5764
5798
|
return N.prevSize !== 0 && (re = [
|
|
5765
5799
|
...N.ranges,
|
|
@@ -5770,7 +5804,7 @@ const pv = {
|
|
|
5770
5804
|
}
|
|
5771
5805
|
]), {
|
|
5772
5806
|
prevIndex: j + C,
|
|
5773
|
-
prevSize:
|
|
5807
|
+
prevSize: z,
|
|
5774
5808
|
ranges: re
|
|
5775
5809
|
};
|
|
5776
5810
|
},
|
|
@@ -5816,7 +5850,7 @@ const pv = {
|
|
|
5816
5850
|
if (st(S.sizeTree))
|
|
5817
5851
|
return S;
|
|
5818
5852
|
let A = Mr();
|
|
5819
|
-
const _ =
|
|
5853
|
+
const _ = bt(v);
|
|
5820
5854
|
let M = 0, F = 0, q = 0;
|
|
5821
5855
|
for (; M < -C; ) {
|
|
5822
5856
|
q = _[F];
|
|
@@ -5896,7 +5930,7 @@ const yd = Xe(
|
|
|
5896
5930
|
e
|
|
5897
5931
|
), ye(
|
|
5898
5932
|
V(
|
|
5899
|
-
|
|
5933
|
+
Ct(o, t, r),
|
|
5900
5934
|
Ee(([l, c]) => Ws(c)),
|
|
5901
5935
|
pe(([l, c, d]) => xn(c.groupOffsetTree, Math.max(l - d, 0), "v")[0]),
|
|
5902
5936
|
ut(),
|
|
@@ -5916,7 +5950,7 @@ const yd = Xe(
|
|
|
5916
5950
|
)
|
|
5917
5951
|
);
|
|
5918
5952
|
return rt(t, (r) => {
|
|
5919
|
-
r &&
|
|
5953
|
+
r && bt(e)("props updated", {}, qt.DEBUG);
|
|
5920
5954
|
}), { didMount: n, propsReady: t };
|
|
5921
5955
|
},
|
|
5922
5956
|
dt(rr),
|
|
@@ -5958,18 +5992,18 @@ const No = Xe(
|
|
|
5958
5992
|
O,
|
|
5959
5993
|
N
|
|
5960
5994
|
]) => {
|
|
5961
|
-
const j = vd(T), { align:
|
|
5995
|
+
const j = vd(T), { align: z, behavior: re, offset: W } = j, $ = k - 1, G = xd(j, C, $);
|
|
5962
5996
|
let ee = yo(G, C.offsetTree, q) + _;
|
|
5963
|
-
|
|
5964
|
-
const ae = (
|
|
5965
|
-
b(),
|
|
5997
|
+
z === "end" ? (ee += O + xn(C.sizeTree, G)[1] - S + N, G === $ && (ee += M)) : z === "center" ? ee += (O + xn(C.sizeTree, G)[1] - S + N) / 2 : ee -= A, W && (ee += W);
|
|
5998
|
+
const ae = (B) => {
|
|
5999
|
+
b(), B ? (F("retrying to scroll to", { location: T }, qt.DEBUG), Pe(p, T)) : (Pe(x, !0), F("list did not change, scroll successful", {}, qt.DEBUG));
|
|
5966
6000
|
};
|
|
5967
6001
|
if (b(), re === "smooth") {
|
|
5968
|
-
let
|
|
6002
|
+
let B = !1;
|
|
5969
6003
|
w = rt(t, (se) => {
|
|
5970
|
-
|
|
6004
|
+
B = B || se;
|
|
5971
6005
|
}), v = gn(d, () => {
|
|
5972
|
-
ae(
|
|
6006
|
+
ae(B);
|
|
5973
6007
|
});
|
|
5974
6008
|
} else
|
|
5975
6009
|
v = gn(V(t, xv(150)), ae);
|
|
@@ -6029,7 +6063,7 @@ const _o = Xe(
|
|
|
6029
6063
|
c
|
|
6030
6064
|
), rt(
|
|
6031
6065
|
V(
|
|
6032
|
-
|
|
6066
|
+
Ct(t, i),
|
|
6033
6067
|
Fe(a, n, e, c),
|
|
6034
6068
|
Ee(([[, d], f, { sizeTree: h }, p, x]) => d && (!st(h) || za(p)) && !f && !x),
|
|
6035
6069
|
Fe(l)
|
|
@@ -6077,7 +6111,7 @@ const vo = "up", ao = "down", yv = "none", vv = {
|
|
|
6077
6111
|
);
|
|
6078
6112
|
ye(
|
|
6079
6113
|
V(
|
|
6080
|
-
|
|
6114
|
+
Ct(Re(o), Re(f)),
|
|
6081
6115
|
pe(([w, b]) => w <= b),
|
|
6082
6116
|
ut()
|
|
6083
6117
|
),
|
|
@@ -6085,7 +6119,7 @@ const vo = "up", ao = "down", yv = "none", vv = {
|
|
|
6085
6119
|
), ye(V(a, Un(50)), c);
|
|
6086
6120
|
const x = Zt(
|
|
6087
6121
|
V(
|
|
6088
|
-
|
|
6122
|
+
Ct(r, Re(s), Re(t), Re(e), Re(d)),
|
|
6089
6123
|
Pn((w, [{ scrollHeight: b, scrollTop: T }, C, S, k, A]) => {
|
|
6090
6124
|
const _ = T + C - b > -A, M = {
|
|
6091
6125
|
scrollHeight: b,
|
|
@@ -6158,7 +6192,7 @@ const vo = "up", ao = "down", yv = "none", vv = {
|
|
|
6158
6192
|
pe(({ scrollTop: w }) => w),
|
|
6159
6193
|
ut(),
|
|
6160
6194
|
Pn(
|
|
6161
|
-
(w, b) =>
|
|
6195
|
+
(w, b) => bt(p) ? { direction: w.direction, prevScrollTop: b } : { direction: b < w.prevScrollTop ? vo : ao, prevScrollTop: b },
|
|
6162
6196
|
{ direction: ao, prevScrollTop: 0 }
|
|
6163
6197
|
),
|
|
6164
6198
|
pe((w) => w.direction)
|
|
@@ -6208,7 +6242,7 @@ const qa = Xe(
|
|
|
6208
6242
|
([{ deviation: e, fixedHeaderHeight: t, headerHeight: n, scrollTop: r, viewportHeight: o }]) => {
|
|
6209
6243
|
const s = Ke(), i = J(0), a = J(0), l = J(0), c = Bt(
|
|
6210
6244
|
V(
|
|
6211
|
-
|
|
6245
|
+
Ct(
|
|
6212
6246
|
Re(r),
|
|
6213
6247
|
Re(o),
|
|
6214
6248
|
Re(n),
|
|
@@ -6357,7 +6391,7 @@ const kr = Xe(
|
|
|
6357
6391
|
ye(s.topItemsIndexes, y);
|
|
6358
6392
|
const w = Bt(
|
|
6359
6393
|
V(
|
|
6360
|
-
|
|
6394
|
+
Ct(
|
|
6361
6395
|
p,
|
|
6362
6396
|
x,
|
|
6363
6397
|
Re(l, xo),
|
|
@@ -6388,18 +6422,18 @@ const kr = Xe(
|
|
|
6388
6422
|
N,
|
|
6389
6423
|
j
|
|
6390
6424
|
]) => {
|
|
6391
|
-
const
|
|
6425
|
+
const z = _, { offsetTree: re, sizeTree: W } = z, $ = bt(v);
|
|
6392
6426
|
if (A === 0)
|
|
6393
6427
|
return { ...Ai, totalCount: A };
|
|
6394
6428
|
if (S === 0 && k === 0)
|
|
6395
6429
|
return $ === 0 ? { ...Ai, totalCount: A } : bd($, M, _, O, N, j || []);
|
|
6396
6430
|
if (st(W))
|
|
6397
6431
|
return $ > 0 ? null : os(
|
|
6398
|
-
bv(Ka(M, A),
|
|
6432
|
+
bv(Ka(M, A), z, j),
|
|
6399
6433
|
[],
|
|
6400
6434
|
A,
|
|
6401
6435
|
N,
|
|
6402
|
-
|
|
6436
|
+
z,
|
|
6403
6437
|
O
|
|
6404
6438
|
);
|
|
6405
6439
|
const G = [];
|
|
@@ -6413,11 +6447,11 @@ const kr = Xe(
|
|
|
6413
6447
|
}
|
|
6414
6448
|
}
|
|
6415
6449
|
if (!F)
|
|
6416
|
-
return os([], G, A, N,
|
|
6450
|
+
return os([], G, A, N, z, O);
|
|
6417
6451
|
const ee = q.length > 0 ? q[q.length - 1] + 1 : 0, ae = cv(re, S, k, ee);
|
|
6418
6452
|
if (ae.length === 0)
|
|
6419
6453
|
return null;
|
|
6420
|
-
const
|
|
6454
|
+
const B = A - 1, se = Hs([], (Ne) => {
|
|
6421
6455
|
for (const Ie of ae) {
|
|
6422
6456
|
const K = Ie.value;
|
|
6423
6457
|
let D = K.offset, X = Ie.start;
|
|
@@ -6428,12 +6462,12 @@ const kr = Xe(
|
|
|
6428
6462
|
D += ie * te + ie * N;
|
|
6429
6463
|
}
|
|
6430
6464
|
X < ee && (D += (ee - X) * te, X = ee);
|
|
6431
|
-
const ce = Math.min(Ie.end,
|
|
6465
|
+
const ce = Math.min(Ie.end, B);
|
|
6432
6466
|
for (let ie = X; ie <= ce && !(D >= k); ie++)
|
|
6433
6467
|
Ne.push({ data: j == null ? void 0 : j[ie], index: ie, offset: D, size: te }), D += te + N;
|
|
6434
6468
|
}
|
|
6435
6469
|
});
|
|
6436
|
-
return os(se, G, A, N,
|
|
6470
|
+
return os(se, G, A, N, z, O);
|
|
6437
6471
|
}
|
|
6438
6472
|
),
|
|
6439
6473
|
//@ts-expect-error filter needs to be fixed
|
|
@@ -6521,7 +6555,7 @@ const kr = Xe(
|
|
|
6521
6555
|
([{ fixedFooterHeight: e, fixedHeaderHeight: t, footerHeight: n, headerHeight: r }, { listState: o }]) => {
|
|
6522
6556
|
const s = Ke(), i = Bt(
|
|
6523
6557
|
V(
|
|
6524
|
-
|
|
6558
|
+
Ct(n, e, r, t, o),
|
|
6525
6559
|
pe(([a, l, c, d, f]) => a + l + c + d + f.offsetBottom + f.bottom)
|
|
6526
6560
|
),
|
|
6527
6561
|
0
|
|
@@ -6534,7 +6568,7 @@ const kr = Xe(
|
|
|
6534
6568
|
([{ viewportHeight: e }, { totalListHeight: t }]) => {
|
|
6535
6569
|
const n = J(!1), r = Bt(
|
|
6536
6570
|
V(
|
|
6537
|
-
|
|
6571
|
+
Ct(n, e, t),
|
|
6538
6572
|
Ee(([o]) => o),
|
|
6539
6573
|
pe(([, o, s]) => Math.max(0, o - s)),
|
|
6540
6574
|
Un(0),
|
|
@@ -6580,7 +6614,7 @@ const kr = Xe(
|
|
|
6580
6614
|
Ee((j) => !j),
|
|
6581
6615
|
// skips the initial publish of false, and the cleanup call.
|
|
6582
6616
|
// but if scrollingInProgress is true, we skip the initial publish.
|
|
6583
|
-
yr(
|
|
6617
|
+
yr(bt(i) ? 1 : 2)
|
|
6584
6618
|
),
|
|
6585
6619
|
k
|
|
6586
6620
|
) : k && k(), N;
|
|
@@ -6621,7 +6655,7 @@ const Tv = (e, t) => typeof e == "function" ? Tc(e(t)) : t && Tc(e), kv = Xe(
|
|
|
6621
6655
|
}
|
|
6622
6656
|
rt(
|
|
6623
6657
|
V(
|
|
6624
|
-
|
|
6658
|
+
Ct(V(Re(t), yr(1)), l),
|
|
6625
6659
|
Fe(Re(x), s, a, f),
|
|
6626
6660
|
pe(([[C, S], k, A, _, M]) => {
|
|
6627
6661
|
let F = S && _, q = "auto";
|
|
@@ -6630,22 +6664,22 @@ const Tv = (e, t) => typeof e == "function" ? Tc(e(t)) : t && Tc(e), kv = Xe(
|
|
|
6630
6664
|
Ee(({ shouldFollow: C }) => C)
|
|
6631
6665
|
),
|
|
6632
6666
|
({ followOutputBehavior: C, totalCount: S }) => {
|
|
6633
|
-
v && (v(), v = null),
|
|
6634
|
-
|
|
6667
|
+
v && (v(), v = null), bt(n) ? requestAnimationFrame(() => {
|
|
6668
|
+
bt(d)("following output to ", { totalCount: S }, qt.DEBUG), m(C);
|
|
6635
6669
|
}) : v = gn(e, () => {
|
|
6636
|
-
|
|
6670
|
+
bt(d)("following output to ", { totalCount: S }, qt.DEBUG), m(C), v = null;
|
|
6637
6671
|
});
|
|
6638
6672
|
}
|
|
6639
6673
|
);
|
|
6640
6674
|
function w(C) {
|
|
6641
6675
|
const S = gn(o, (k) => {
|
|
6642
|
-
C && !k.atBottom && k.notAtBottomBecause === "SIZE_INCREASED" && !v && (
|
|
6676
|
+
C && !k.atBottom && k.notAtBottomBecause === "SIZE_INCREASED" && !v && (bt(d)("scrolling to bottom due to increased size", {}, qt.DEBUG), m("auto"));
|
|
6643
6677
|
});
|
|
6644
6678
|
setTimeout(S, 100);
|
|
6645
6679
|
}
|
|
6646
6680
|
rt(
|
|
6647
6681
|
V(
|
|
6648
|
-
|
|
6682
|
+
Ct(Re(x), t, c),
|
|
6649
6683
|
Ee(([C, , S]) => C && S),
|
|
6650
6684
|
Pn(
|
|
6651
6685
|
({ value: C }, [, S]) => ({ refreshed: C === S, value: S }),
|
|
@@ -6655,11 +6689,11 @@ const Tv = (e, t) => typeof e == "function" ? Tc(e(t)) : t && Tc(e), kv = Xe(
|
|
|
6655
6689
|
Fe(x, t)
|
|
6656
6690
|
),
|
|
6657
6691
|
([, C]) => {
|
|
6658
|
-
|
|
6692
|
+
bt(a) && w(C !== !1);
|
|
6659
6693
|
}
|
|
6660
6694
|
), rt(y, () => {
|
|
6661
|
-
w(
|
|
6662
|
-
}), rt(
|
|
6695
|
+
w(bt(x) !== !1);
|
|
6696
|
+
}), rt(Ct(Re(x), o), ([C, S]) => {
|
|
6663
6697
|
C && !S.atBottom && S.notAtBottomBecause === "VIEWPORT_HEIGHT_DECREASING" && m("auto");
|
|
6664
6698
|
});
|
|
6665
6699
|
const b = J(null), T = Ke();
|
|
@@ -6677,17 +6711,17 @@ const Tv = (e, t) => typeof e == "function" ? Tc(e(t)) : t && Tc(e), kv = Xe(
|
|
|
6677
6711
|
T
|
|
6678
6712
|
), rt(
|
|
6679
6713
|
V(
|
|
6680
|
-
|
|
6714
|
+
Ct(V(T, yr(1)), l),
|
|
6681
6715
|
Fe(Re(b), a, f, h),
|
|
6682
6716
|
pe(([[C, S], k, A, _, M]) => S && A && (k == null ? void 0 : k({ context: M, totalCount: C, scrollingInProgress: _ }))),
|
|
6683
6717
|
Ee((C) => !!C),
|
|
6684
6718
|
Un(0)
|
|
6685
6719
|
),
|
|
6686
6720
|
(C) => {
|
|
6687
|
-
v && (v(), v = null),
|
|
6688
|
-
|
|
6721
|
+
v && (v(), v = null), bt(n) ? requestAnimationFrame(() => {
|
|
6722
|
+
bt(d)("scrolling into view", {}), Pe(p, C);
|
|
6689
6723
|
}) : v = gn(e, () => {
|
|
6690
|
-
|
|
6724
|
+
bt(d)("scrolling into view", {}), Pe(p, C), v = null;
|
|
6691
6725
|
});
|
|
6692
6726
|
}
|
|
6693
6727
|
), { autoscrollToBottom: y, followOutput: x, scrollIntoViewOnChange: b };
|
|
@@ -6767,7 +6801,7 @@ const Tv = (e, t) => typeof e == "function" ? Tc(e(t)) : t && Tc(e), kv = Xe(
|
|
|
6767
6801
|
),
|
|
6768
6802
|
t
|
|
6769
6803
|
), rt(
|
|
6770
|
-
V(
|
|
6804
|
+
V(Ct(t, e, n), Fe(r)),
|
|
6771
6805
|
([[o, s, i], a]) => {
|
|
6772
6806
|
o && a && a.change && a.change(s, i);
|
|
6773
6807
|
}
|
|
@@ -6779,7 +6813,7 @@ const Tv = (e, t) => typeof e == "function" ? Tc(e(t)) : t && Tc(e), kv = Xe(
|
|
|
6779
6813
|
const n = Ke(), r = Ke(), o = Ke(), s = J(!1), i = J(void 0);
|
|
6780
6814
|
return ye(
|
|
6781
6815
|
V(
|
|
6782
|
-
|
|
6816
|
+
Ct(n, r),
|
|
6783
6817
|
pe(([{ scrollHeight: a, scrollTop: l, viewportHeight: c }, { offsetTop: d }]) => ({
|
|
6784
6818
|
scrollHeight: a,
|
|
6785
6819
|
scrollTop: Math.max(0, l - d),
|
|
@@ -6893,7 +6927,7 @@ const _v = Rd(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
|
|
|
6893
6927
|
b && _v() ? Pe(e, w - m) : v(-m);
|
|
6894
6928
|
}), rt(
|
|
6895
6929
|
V(
|
|
6896
|
-
|
|
6930
|
+
Ct(Bt(s, !1), e, x),
|
|
6897
6931
|
Ee(([m, w, b]) => !m && !b && w !== 0),
|
|
6898
6932
|
pe(([m, w]) => w),
|
|
6899
6933
|
Un(1)
|
|
@@ -7119,11 +7153,11 @@ function Id(e, t, n) {
|
|
|
7119
7153
|
);
|
|
7120
7154
|
return U.useSyncExternalStore(
|
|
7121
7155
|
w,
|
|
7122
|
-
() =>
|
|
7123
|
-
() =>
|
|
7156
|
+
() => bt(m),
|
|
7157
|
+
() => bt(m)
|
|
7124
7158
|
);
|
|
7125
7159
|
}, x = (v) => {
|
|
7126
|
-
const m = U.useContext(a)[v], [w, b] = U.useState(mc(
|
|
7160
|
+
const m = U.useContext(a)[v], [w, b] = U.useState(mc(bt, m));
|
|
7127
7161
|
return Bo(
|
|
7128
7162
|
() => rt(m, (T) => {
|
|
7129
7163
|
T !== w && b(pc(T));
|
|
@@ -7276,14 +7310,14 @@ const Dv = /* @__PURE__ */ Xe(() => {
|
|
|
7276
7310
|
ref: v,
|
|
7277
7311
|
style: O,
|
|
7278
7312
|
children: (e ? t.topItems : t.items).map((N) => {
|
|
7279
|
-
const j = N.originalIndex,
|
|
7313
|
+
const j = N.originalIndex, z = A(j + t.firstItemIndex, N.data, c);
|
|
7280
7314
|
return _ ? /* @__PURE__ */ Jo(
|
|
7281
7315
|
T,
|
|
7282
7316
|
{
|
|
7283
7317
|
...zt(T, c),
|
|
7284
7318
|
height: N.size,
|
|
7285
7319
|
index: N.index,
|
|
7286
|
-
key:
|
|
7320
|
+
key: z,
|
|
7287
7321
|
type: N.type || "item",
|
|
7288
7322
|
...N.type === "group" ? {} : { groupIndex: N.groupIndex }
|
|
7289
7323
|
}
|
|
@@ -7294,7 +7328,7 @@ const Dv = /* @__PURE__ */ Xe(() => {
|
|
|
7294
7328
|
"data-index": j,
|
|
7295
7329
|
"data-item-index": N.index,
|
|
7296
7330
|
"data-known-size": N.size,
|
|
7297
|
-
key:
|
|
7331
|
+
key: z,
|
|
7298
7332
|
style: $v
|
|
7299
7333
|
},
|
|
7300
7334
|
d(N.index, c)
|
|
@@ -7307,7 +7341,7 @@ const Dv = /* @__PURE__ */ Xe(() => {
|
|
|
7307
7341
|
"data-item-group-index": N.groupIndex,
|
|
7308
7342
|
"data-item-index": N.index,
|
|
7309
7343
|
"data-known-size": N.size,
|
|
7310
|
-
key:
|
|
7344
|
+
key: z,
|
|
7311
7345
|
style: y ? zv : Pd
|
|
7312
7346
|
},
|
|
7313
7347
|
M ? l(N.index, N.groupIndex, N.data, c) : l(N.index, N.data, c)
|
|
@@ -7595,7 +7629,7 @@ const sw = /* @__PURE__ */ Xe(
|
|
|
7595
7629
|
{ customScrollParent: v, useWindowScroll: m, windowScrollContainerState: w, windowScrollTo: b, windowViewportRect: T },
|
|
7596
7630
|
C
|
|
7597
7631
|
]) => {
|
|
7598
|
-
const S = J(0), k = J(0), A = J(Ec), _ = J({ height: 0, width: 0 }), M = J({ height: 0, width: 0 }), F = Ke(), q = Ke(), O = J(0), N = J(null), j = J({ column: 0, row: 0 }),
|
|
7632
|
+
const S = J(0), k = J(0), A = J(Ec), _ = J({ height: 0, width: 0 }), M = J({ height: 0, width: 0 }), F = Ke(), q = Ke(), O = J(0), N = J(null), j = J({ column: 0, row: 0 }), z = Ke(), re = Ke(), W = J(!1), $ = J(0), G = J(!0), ee = J(!1), ae = J(!1);
|
|
7599
7633
|
rt(
|
|
7600
7634
|
V(
|
|
7601
7635
|
x,
|
|
@@ -7607,7 +7641,7 @@ const sw = /* @__PURE__ */ Xe(
|
|
|
7607
7641
|
}
|
|
7608
7642
|
), rt(
|
|
7609
7643
|
V(
|
|
7610
|
-
|
|
7644
|
+
Ct(x, G, M, _, $, ee),
|
|
7611
7645
|
Ee(([D, X, te, ce, , ie]) => D && !X && te.height !== 0 && ce.height !== 0 && !ie)
|
|
7612
7646
|
),
|
|
7613
7647
|
([, , , , D]) => {
|
|
@@ -7643,7 +7677,7 @@ const sw = /* @__PURE__ */ Xe(
|
|
|
7643
7677
|
f
|
|
7644
7678
|
), ye(
|
|
7645
7679
|
V(
|
|
7646
|
-
|
|
7680
|
+
Ct(
|
|
7647
7681
|
Re(_, Ho),
|
|
7648
7682
|
Re(M, Ho),
|
|
7649
7683
|
Re(j, (D, X) => D && D.column === X.column && D.row === X.row),
|
|
@@ -7656,10 +7690,10 @@ const sw = /* @__PURE__ */ Xe(
|
|
|
7656
7690
|
viewport: D
|
|
7657
7691
|
}))
|
|
7658
7692
|
),
|
|
7659
|
-
|
|
7693
|
+
z
|
|
7660
7694
|
), ye(
|
|
7661
7695
|
V(
|
|
7662
|
-
|
|
7696
|
+
Ct(
|
|
7663
7697
|
Re(S),
|
|
7664
7698
|
r,
|
|
7665
7699
|
Re(j, ow),
|
|
@@ -7682,10 +7716,10 @@ const sw = /* @__PURE__ */ Xe(
|
|
|
7682
7716
|
Be,
|
|
7683
7717
|
Ge,
|
|
7684
7718
|
,
|
|
7685
|
-
|
|
7719
|
+
Ze,
|
|
7686
7720
|
Ye
|
|
7687
7721
|
]) => {
|
|
7688
|
-
const { column: ft, row:
|
|
7722
|
+
const { column: ft, row: Qe } = ce, { height: Oe, width: It } = ie, { width: Ot } = de;
|
|
7689
7723
|
if (Ge === 0 && (D === 0 || Ot === 0))
|
|
7690
7724
|
return Ec;
|
|
7691
7725
|
if (It === 0) {
|
|
@@ -7694,8 +7728,8 @@ const sw = /* @__PURE__ */ Xe(
|
|
|
7694
7728
|
}
|
|
7695
7729
|
const He = Dd(Ot, It, ft);
|
|
7696
7730
|
let Z, ve;
|
|
7697
|
-
|
|
7698
|
-
const we = Nc(Z, ve, Be), { bottom: qe, top: ht } = _c(de, ce, ie, we), mt = Ic(D / He), At = mt * Oe + (mt - 1) *
|
|
7731
|
+
Ze ? X === 0 && te === 0 && Ge > 0 ? (Z = 0, ve = Ge - 1) : (Z = He * xs((X + Qe) / (Oe + Qe)), ve = He * Ic((te + Qe) / (Oe + Qe)) - 1, ve = ji(D - 1, lo(ve, He - 1)), Z = ji(ve, lo(0, Z))) : (Z = 0, ve = -1);
|
|
7732
|
+
const we = Nc(Z, ve, Be), { bottom: qe, top: ht } = _c(de, ce, ie, we), mt = Ic(D / He), At = mt * Oe + (mt - 1) * Qe - qe;
|
|
7699
7733
|
return { bottom: qe, itemHeight: Oe, items: we, itemWidth: It, offsetBottom: At, offsetTop: ht, top: ht };
|
|
7700
7734
|
}
|
|
7701
7735
|
)
|
|
@@ -7710,7 +7744,7 @@ const sw = /* @__PURE__ */ Xe(
|
|
|
7710
7744
|
S
|
|
7711
7745
|
), ye(
|
|
7712
7746
|
V(
|
|
7713
|
-
|
|
7747
|
+
Ct(_, M, A, j),
|
|
7714
7748
|
Ee(([D, X, { items: te }]) => te.length > 0 && X.height !== 0 && D.height !== 0),
|
|
7715
7749
|
pe(([D, X, { items: te }, ce]) => {
|
|
7716
7750
|
const { bottom: ie, top: de } = _c(D, ce, X, te);
|
|
@@ -7720,20 +7754,20 @@ const sw = /* @__PURE__ */ Xe(
|
|
|
7720
7754
|
),
|
|
7721
7755
|
t
|
|
7722
7756
|
);
|
|
7723
|
-
const
|
|
7757
|
+
const B = J(!1);
|
|
7724
7758
|
ye(
|
|
7725
7759
|
V(
|
|
7726
7760
|
c,
|
|
7727
|
-
Fe(
|
|
7761
|
+
Fe(B),
|
|
7728
7762
|
pe(([D, X]) => X || D !== 0)
|
|
7729
7763
|
),
|
|
7730
|
-
|
|
7764
|
+
B
|
|
7731
7765
|
);
|
|
7732
7766
|
const se = Zt(
|
|
7733
7767
|
V(
|
|
7734
|
-
|
|
7768
|
+
Ct(A, S),
|
|
7735
7769
|
Ee(([{ items: D }]) => D.length > 0),
|
|
7736
|
-
Fe(
|
|
7770
|
+
Fe(B),
|
|
7737
7771
|
Ee(([[D, X], te]) => {
|
|
7738
7772
|
const ce = D.items[D.items.length - 1].index === X - 1;
|
|
7739
7773
|
return (te || D.bottom > 0 && D.itemHeight > 0 && D.offsetBottom === 0 && D.items.length === X) && ce;
|
|
@@ -7766,11 +7800,11 @@ const sw = /* @__PURE__ */ Xe(
|
|
|
7766
7800
|
F,
|
|
7767
7801
|
Fe(_, M, S, j),
|
|
7768
7802
|
pe(([D, X, te, ce, ie]) => {
|
|
7769
|
-
const de = vd(D), { align: Be, behavior: Ge, offset:
|
|
7803
|
+
const de = vd(D), { align: Be, behavior: Ge, offset: Ze } = de;
|
|
7770
7804
|
let Ye = de.index;
|
|
7771
7805
|
Ye === "LAST" && (Ye = ce - 1), Ye = lo(0, Ye, ji(ce - 1, Ye));
|
|
7772
7806
|
let ft = fa(X, ie, te, Ye);
|
|
7773
|
-
return Be === "end" ? ft = Ac(ft - X.height + te.height) : Be === "center" && (ft = Ac(ft - X.height / 2 + te.height / 2)),
|
|
7807
|
+
return Be === "end" ? ft = Ac(ft - X.height + te.height) : Be === "center" && (ft = Ac(ft - X.height / 2 + te.height / 2)), Ze && (ft += Ze), { behavior: Ge, top: ft };
|
|
7774
7808
|
})
|
|
7775
7809
|
),
|
|
7776
7810
|
l
|
|
@@ -7825,7 +7859,7 @@ const sw = /* @__PURE__ */ Xe(
|
|
|
7825
7859
|
propsReady: y,
|
|
7826
7860
|
rangeChanged: Ie,
|
|
7827
7861
|
startReached: Ne,
|
|
7828
|
-
stateChanged:
|
|
7862
|
+
stateChanged: z,
|
|
7829
7863
|
stateRestoreInProgress: W,
|
|
7830
7864
|
...C
|
|
7831
7865
|
};
|
|
@@ -11562,13 +11596,13 @@ const k0 = U.memo(function({
|
|
|
11562
11596
|
onInterruptActionStart: b,
|
|
11563
11597
|
onInterruptActionEnd: T
|
|
11564
11598
|
}) {
|
|
11565
|
-
const [C, S] = xe(!1), [k, A] = xe("preview"), [_, M] = xe(!1), { currentThreadId: F } = Fa(), { respondToInterrupt: q } = $a(), O = l === "phone" || l === "half-screen", N = t.role, j = N === "tool",
|
|
11599
|
+
const [C, S] = xe(!1), [k, A] = xe("preview"), [_, M] = xe(!1), { currentThreadId: F } = Fa(), { respondToInterrupt: q } = $a(), O = l === "phone" || l === "half-screen", N = t.role, j = N === "tool", z = !(r && N !== "user"), {
|
|
11566
11600
|
uploadingFiles: re,
|
|
11567
11601
|
handleFileClick: W,
|
|
11568
11602
|
fileViewerOpen: $,
|
|
11569
11603
|
currentFileInfo: G,
|
|
11570
11604
|
closeFileViewer: ee
|
|
11571
|
-
} = E0({ allowFileOpen:
|
|
11605
|
+
} = E0({ allowFileOpen: z, currentThreadId: F }), ae = U.useMemo(() => {
|
|
11572
11606
|
switch (N) {
|
|
11573
11607
|
case "user":
|
|
11574
11608
|
return "text-[hsl(var(--chat-bubble-user-text))]";
|
|
@@ -11581,7 +11615,7 @@ const k0 = U.memo(function({
|
|
|
11581
11615
|
default:
|
|
11582
11616
|
return "text-[hsl(var(--chat-bubble-ai-text))]";
|
|
11583
11617
|
}
|
|
11584
|
-
}, [N]),
|
|
11618
|
+
}, [N]), B = ct(() => b0(t.content), [t.content]), se = ct(() => Lf(t.content), [t.content]), Ne = ct(
|
|
11585
11619
|
() => t.content.filter((Z) => Z.type === "image_url"),
|
|
11586
11620
|
[t.content]
|
|
11587
11621
|
), Ie = ct(
|
|
@@ -11591,7 +11625,7 @@ const k0 = U.memo(function({
|
|
|
11591
11625
|
() => t.content.filter((Z) => Z.type === "interrupt"),
|
|
11592
11626
|
[t.content]
|
|
11593
11627
|
), D = (m == null ? void 0 : m.id) ?? (m == null ? void 0 : m.interrupt_id), X = Yo(D), te = m == null ? void 0 : m.value, ce = ct(() => S0(t.content), [t.content]), ie = U.useCallback(async () => {
|
|
11594
|
-
const Z = j ? ce :
|
|
11628
|
+
const Z = j ? ce : B;
|
|
11595
11629
|
async function ve(we) {
|
|
11596
11630
|
if (navigator.clipboard && typeof navigator.clipboard.writeText == "function") {
|
|
11597
11631
|
await navigator.clipboard.writeText(we);
|
|
@@ -11613,11 +11647,11 @@ const k0 = U.memo(function({
|
|
|
11613
11647
|
} catch (we) {
|
|
11614
11648
|
console.error("Failed to copy:", we);
|
|
11615
11649
|
}
|
|
11616
|
-
}, [j, ce,
|
|
11650
|
+
}, [j, ce, B, v]), de = U.useCallback(() => {
|
|
11617
11651
|
if (!p) return;
|
|
11618
|
-
const Z = j ? ce :
|
|
11652
|
+
const Z = j ? ce : B;
|
|
11619
11653
|
p(t.id, Z);
|
|
11620
|
-
}, [p, t.id, j, ce,
|
|
11654
|
+
}, [p, t.id, j, ce, B]), Be = U.useCallback(() => {
|
|
11621
11655
|
x == null || x(n);
|
|
11622
11656
|
}, [x, n]), Ge = U.useCallback(() => {
|
|
11623
11657
|
const ve = oe(O ? "h-3 w-3" : "h-4 w-4", "opacity-60 flex-shrink-0", ae);
|
|
@@ -11631,7 +11665,7 @@ const k0 = U.memo(function({
|
|
|
11631
11665
|
default:
|
|
11632
11666
|
return /* @__PURE__ */ u.jsx(Ol, { className: ve });
|
|
11633
11667
|
}
|
|
11634
|
-
}, [O, ae, N]),
|
|
11668
|
+
}, [O, ae, N]), Ze = U.useCallback(() => {
|
|
11635
11669
|
const Z = "group relative mb-4 flex w-full";
|
|
11636
11670
|
switch (N) {
|
|
11637
11671
|
case "user":
|
|
@@ -11692,7 +11726,7 @@ const k0 = U.memo(function({
|
|
|
11692
11726
|
} finally {
|
|
11693
11727
|
T == null || T();
|
|
11694
11728
|
}
|
|
11695
|
-
}, [w, T, b, q]),
|
|
11729
|
+
}, [w, T, b, q]), Qe = U.useCallback(async (Z) => {
|
|
11696
11730
|
if (w)
|
|
11697
11731
|
return;
|
|
11698
11732
|
const ve = Yo(
|
|
@@ -11765,7 +11799,7 @@ const k0 = U.memo(function({
|
|
|
11765
11799
|
{
|
|
11766
11800
|
interruptPart: At,
|
|
11767
11801
|
onApprove: ft,
|
|
11768
|
-
onReject:
|
|
11802
|
+
onReject: Qe,
|
|
11769
11803
|
disabled: w,
|
|
11770
11804
|
isActive: ht,
|
|
11771
11805
|
payload: mt
|
|
@@ -11778,7 +11812,7 @@ const k0 = U.memo(function({
|
|
|
11778
11812
|
W,
|
|
11779
11813
|
re,
|
|
11780
11814
|
ft,
|
|
11781
|
-
|
|
11815
|
+
Qe,
|
|
11782
11816
|
N,
|
|
11783
11817
|
c,
|
|
11784
11818
|
d,
|
|
@@ -11793,7 +11827,7 @@ const k0 = U.memo(function({
|
|
|
11793
11827
|
/* @__PURE__ */ u.jsx(Ki, { className: "h-4 w-4 text-muted-foreground" }),
|
|
11794
11828
|
/* @__PURE__ */ u.jsx("span", { className: "text-sm text-muted-foreground", children: "File upload" })
|
|
11795
11829
|
] }), []), Ot = U.useCallback(() => {
|
|
11796
|
-
const Z =
|
|
11830
|
+
const Z = B.trim().length > 0 || Ne.length > 0 || Ie.length > 0 || K.length > 0;
|
|
11797
11831
|
if (!j && Ie.length > 0 && !r)
|
|
11798
11832
|
return It();
|
|
11799
11833
|
if (!j && !Z && !r)
|
|
@@ -11815,7 +11849,7 @@ const k0 = U.memo(function({
|
|
|
11815
11849
|
] }) : ve;
|
|
11816
11850
|
}
|
|
11817
11851
|
}, [
|
|
11818
|
-
|
|
11852
|
+
B,
|
|
11819
11853
|
Ne.length,
|
|
11820
11854
|
Ie.length,
|
|
11821
11855
|
K.length,
|
|
@@ -11826,7 +11860,7 @@ const k0 = U.memo(function({
|
|
|
11826
11860
|
ae
|
|
11827
11861
|
]), He = ct(() => C0(t), [t]);
|
|
11828
11862
|
return j && !f ? null : /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
|
|
11829
|
-
/* @__PURE__ */ u.jsx("div", { className: oe(
|
|
11863
|
+
/* @__PURE__ */ u.jsx("div", { className: oe(Ze(), h.container), children: /* @__PURE__ */ u.jsxs("div", { className: oe(Ye(), h.content), children: [
|
|
11830
11864
|
(i || a || j) && /* @__PURE__ */ u.jsxs(
|
|
11831
11865
|
"div",
|
|
11832
11866
|
{
|
|
@@ -12240,8 +12274,8 @@ const tu = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, $f = U.forwa
|
|
|
12240
12274
|
let ee;
|
|
12241
12275
|
const ae = w.value;
|
|
12242
12276
|
if (ae && typeof ae == "object" && !Array.isArray(ae)) {
|
|
12243
|
-
const
|
|
12244
|
-
typeof
|
|
12277
|
+
const B = ae.title;
|
|
12278
|
+
typeof B == "string" && B.trim() && (ee = B.trim());
|
|
12245
12279
|
}
|
|
12246
12280
|
return {
|
|
12247
12281
|
id: `interrupt-${G}`,
|
|
@@ -12256,7 +12290,7 @@ const tu = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, $f = U.forwa
|
|
|
12256
12290
|
}
|
|
12257
12291
|
]
|
|
12258
12292
|
};
|
|
12259
|
-
}, [w, O]), j = ct(() => N ? [...e, N] : e, [e, N]),
|
|
12293
|
+
}, [w, O]), j = ct(() => N ? [...e, N] : e, [e, N]), z = ct(() => S ? j : j.filter((G) => (G == null ? void 0 : G.role) !== "tool"), [j, S]), re = be((G) => {
|
|
12260
12294
|
q(G), v && v(!G), m && m(G);
|
|
12261
12295
|
}, [v, m]), W = ct(() => {
|
|
12262
12296
|
if (a)
|
|
@@ -12271,7 +12305,7 @@ const tu = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, $f = U.forwa
|
|
|
12271
12305
|
}
|
|
12272
12306
|
};
|
|
12273
12307
|
}, [a]), $ = ct(() => !x || y ? !1 : F ? "auto" : !1, [F, x, y]);
|
|
12274
|
-
return
|
|
12308
|
+
return z.length === 0 ? /* @__PURE__ */ u.jsx("div", { className: f, style: h, children: /* @__PURE__ */ u.jsx("div", { className: "flex items-center justify-center py-8 text-muted-foreground text-center max-w-md mx-auto", children: p || "No messages yet. Start a conversation!" }) }) : /* @__PURE__ */ u.jsx("div", { className: f, style: h, children: /* @__PURE__ */ u.jsx(
|
|
12275
12309
|
ew,
|
|
12276
12310
|
{
|
|
12277
12311
|
ref: (G) => {
|
|
@@ -12280,7 +12314,7 @@ const tu = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, $f = U.forwa
|
|
|
12280
12314
|
scrollerRef: (G) => {
|
|
12281
12315
|
_.current = G instanceof HTMLDivElement ? G : null;
|
|
12282
12316
|
},
|
|
12283
|
-
data:
|
|
12317
|
+
data: z,
|
|
12284
12318
|
followOutput: $,
|
|
12285
12319
|
overscan: 200,
|
|
12286
12320
|
increaseViewportBy: { top: 100, bottom: 200 },
|
|
@@ -12701,17 +12735,17 @@ const K0 = (e) => ({
|
|
|
12701
12735
|
}, p = hl(o), x = fl(p), y = await i.getDimensions(c), v = p === "y", m = v ? "top" : "left", w = v ? "bottom" : "right", b = v ? "clientHeight" : "clientWidth", T = s.reference[x] + s.reference[p] - h[p] - s.floating[x], C = h[p] - s.reference[p], S = await (i.getOffsetParent == null ? void 0 : i.getOffsetParent(c));
|
|
12702
12736
|
let k = S ? S[b] : 0;
|
|
12703
12737
|
(!k || !await (i.isElement == null ? void 0 : i.isElement(S))) && (k = a.floating[b] || s.floating[x]);
|
|
12704
|
-
const A = T / 2 - C / 2, _ = k / 2 - y[x] / 2 - 1, M = er(f[m], _), F = er(f[w], _), q = M, O = k - y[x] - F, N = k / 2 - y[x] / 2 + A, j = ma(q, N, O),
|
|
12738
|
+
const A = T / 2 - C / 2, _ = k / 2 - y[x] / 2 - 1, M = er(f[m], _), F = er(f[w], _), q = M, O = k - y[x] - F, N = k / 2 - y[x] / 2 + A, j = ma(q, N, O), z = !l.arrow && qr(o) != null && N !== j && s.reference[x] / 2 - (N < q ? M : F) - y[x] / 2 < 0, re = z ? N < q ? N - q : N - O : 0;
|
|
12705
12739
|
return {
|
|
12706
12740
|
[p]: h[p] + re,
|
|
12707
12741
|
data: {
|
|
12708
12742
|
[p]: j,
|
|
12709
12743
|
centerOffset: N - j - re,
|
|
12710
|
-
...
|
|
12744
|
+
...z && {
|
|
12711
12745
|
alignmentOffset: re
|
|
12712
12746
|
}
|
|
12713
12747
|
},
|
|
12714
|
-
reset:
|
|
12748
|
+
reset: z
|
|
12715
12749
|
};
|
|
12716
12750
|
}
|
|
12717
12751
|
}), q0 = function(e) {
|
|
@@ -12764,8 +12798,8 @@ const K0 = (e) => ({
|
|
|
12764
12798
|
placement: j
|
|
12765
12799
|
}
|
|
12766
12800
|
};
|
|
12767
|
-
let
|
|
12768
|
-
if (!
|
|
12801
|
+
let z = (q = M.filter((re) => re.overflows[0] <= 0).sort((re, W) => re.overflows[1] - W.overflows[1])[0]) == null ? void 0 : q.placement;
|
|
12802
|
+
if (!z)
|
|
12769
12803
|
switch (p) {
|
|
12770
12804
|
case "bestFit": {
|
|
12771
12805
|
var O;
|
|
@@ -12778,17 +12812,17 @@ const K0 = (e) => ({
|
|
|
12778
12812
|
}
|
|
12779
12813
|
return !0;
|
|
12780
12814
|
}).map((W) => [W.placement, W.overflows.filter(($) => $ > 0).reduce(($, G) => $ + G, 0)]).sort((W, $) => W[1] - $[1])[0]) == null ? void 0 : O[0];
|
|
12781
|
-
re && (
|
|
12815
|
+
re && (z = re);
|
|
12782
12816
|
break;
|
|
12783
12817
|
}
|
|
12784
12818
|
case "initialPlacement":
|
|
12785
|
-
|
|
12819
|
+
z = a;
|
|
12786
12820
|
break;
|
|
12787
12821
|
}
|
|
12788
|
-
if (o !==
|
|
12822
|
+
if (o !== z)
|
|
12789
12823
|
return {
|
|
12790
12824
|
reset: {
|
|
12791
|
-
placement:
|
|
12825
|
+
placement: z
|
|
12792
12826
|
}
|
|
12793
12827
|
};
|
|
12794
12828
|
}
|
|
@@ -13652,7 +13686,7 @@ function MS(e) {
|
|
|
13652
13686
|
floating: k,
|
|
13653
13687
|
setReference: w,
|
|
13654
13688
|
setFloating: b
|
|
13655
|
-
}), [w, b]),
|
|
13689
|
+
}), [w, b]), z = g.useMemo(() => ({
|
|
13656
13690
|
reference: T,
|
|
13657
13691
|
floating: C
|
|
13658
13692
|
}), [T, C]), re = g.useMemo(() => {
|
|
@@ -13661,13 +13695,13 @@ function MS(e) {
|
|
|
13661
13695
|
left: 0,
|
|
13662
13696
|
top: 0
|
|
13663
13697
|
};
|
|
13664
|
-
if (!
|
|
13698
|
+
if (!z.floating)
|
|
13665
13699
|
return W;
|
|
13666
|
-
const $ = fu(
|
|
13700
|
+
const $ = fu(z.floating, d.x), G = fu(z.floating, d.y);
|
|
13667
13701
|
return a ? {
|
|
13668
13702
|
...W,
|
|
13669
13703
|
transform: "translate(" + $ + "px, " + G + "px)",
|
|
13670
|
-
...Xf(
|
|
13704
|
+
...Xf(z.floating) >= 1.5 && {
|
|
13671
13705
|
willChange: "transform"
|
|
13672
13706
|
}
|
|
13673
13707
|
} : {
|
|
@@ -13675,14 +13709,14 @@ function MS(e) {
|
|
|
13675
13709
|
left: $,
|
|
13676
13710
|
top: G
|
|
13677
13711
|
};
|
|
13678
|
-
}, [n, a,
|
|
13712
|
+
}, [n, a, z.floating, d.x, d.y]);
|
|
13679
13713
|
return g.useMemo(() => ({
|
|
13680
13714
|
...d,
|
|
13681
13715
|
update: O,
|
|
13682
13716
|
refs: j,
|
|
13683
|
-
elements:
|
|
13717
|
+
elements: z,
|
|
13684
13718
|
floatingStyles: re
|
|
13685
|
-
}), [d, O, j,
|
|
13719
|
+
}), [d, O, j, z, re]);
|
|
13686
13720
|
}
|
|
13687
13721
|
const DS = (e) => {
|
|
13688
13722
|
function t(n) {
|
|
@@ -13804,7 +13838,7 @@ var yl = "PopperContent", [qS, GS] = Qf(yl), oh = g.forwardRef(
|
|
|
13804
13838
|
boundary: F.filter(XS),
|
|
13805
13839
|
// with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
|
|
13806
13840
|
altBoundary: q
|
|
13807
|
-
}, { refs: N, floatingStyles: j, placement:
|
|
13841
|
+
}, { refs: N, floatingStyles: j, placement: z, isPositioned: re, middlewareData: W } = MS({
|
|
13808
13842
|
// default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
|
|
13809
13843
|
strategy: "fixed",
|
|
13810
13844
|
placement: _,
|
|
@@ -13825,20 +13859,20 @@ var yl = "PopperContent", [qS, GS] = Qf(yl), oh = g.forwardRef(
|
|
|
13825
13859
|
l && zS({ ...O }),
|
|
13826
13860
|
BS({
|
|
13827
13861
|
...O,
|
|
13828
|
-
apply: ({ elements: de, rects: Be, availableWidth: Ge, availableHeight:
|
|
13829
|
-
const { width: Ye, height: ft } = Be.reference,
|
|
13830
|
-
|
|
13862
|
+
apply: ({ elements: de, rects: Be, availableWidth: Ge, availableHeight: Ze }) => {
|
|
13863
|
+
const { width: Ye, height: ft } = Be.reference, Qe = de.floating.style;
|
|
13864
|
+
Qe.setProperty("--radix-popper-available-width", `${Ge}px`), Qe.setProperty("--radix-popper-available-height", `${Ze}px`), Qe.setProperty("--radix-popper-anchor-width", `${Ye}px`), Qe.setProperty("--radix-popper-anchor-height", `${ft}px`);
|
|
13831
13865
|
}
|
|
13832
13866
|
}),
|
|
13833
13867
|
T && US({ element: T, padding: a }),
|
|
13834
13868
|
JS({ arrowWidth: k, arrowHeight: A }),
|
|
13835
13869
|
h && HS({ strategy: "referenceHidden", ...O })
|
|
13836
13870
|
]
|
|
13837
|
-
}), [$, G] = ah(
|
|
13871
|
+
}), [$, G] = ah(z), ee = Pt(x);
|
|
13838
13872
|
Et(() => {
|
|
13839
13873
|
re && (ee == null || ee());
|
|
13840
13874
|
}, [re, ee]);
|
|
13841
|
-
const ae = (K = W.arrow) == null ? void 0 : K.x,
|
|
13875
|
+
const ae = (K = W.arrow) == null ? void 0 : K.x, B = (D = W.arrow) == null ? void 0 : D.y, se = ((X = W.arrow) == null ? void 0 : X.centerOffset) !== 0, [Ne, Ie] = g.useState();
|
|
13842
13876
|
return Et(() => {
|
|
13843
13877
|
m && Ie(window.getComputedStyle(m).zIndex);
|
|
13844
13878
|
}, [m]), /* @__PURE__ */ u.jsx(
|
|
@@ -13872,7 +13906,7 @@ var yl = "PopperContent", [qS, GS] = Qf(yl), oh = g.forwardRef(
|
|
|
13872
13906
|
placedSide: $,
|
|
13873
13907
|
onArrowChange: C,
|
|
13874
13908
|
arrowX: ae,
|
|
13875
|
-
arrowY:
|
|
13909
|
+
arrowY: B,
|
|
13876
13910
|
shouldHideArrow: se,
|
|
13877
13911
|
children: /* @__PURE__ */ u.jsx(
|
|
13878
13912
|
Ae.div,
|
|
@@ -14030,9 +14064,9 @@ var rC = g.forwardRef((e, t) => {
|
|
|
14030
14064
|
if (A.target === A.currentTarget && _ && !m) {
|
|
14031
14065
|
const M = new CustomEvent(Wi, ZS);
|
|
14032
14066
|
if (A.currentTarget.dispatchEvent(M), !M.defaultPrevented) {
|
|
14033
|
-
const F = T().filter((
|
|
14067
|
+
const F = T().filter((z) => z.focusable), q = F.find((z) => z.active), O = F.find((z) => z.id === y), j = [q, O, ...F].filter(
|
|
14034
14068
|
Boolean
|
|
14035
|
-
).map((
|
|
14069
|
+
).map((z) => z.ref.current);
|
|
14036
14070
|
xh(j, d);
|
|
14037
14071
|
}
|
|
14038
14072
|
}
|
|
@@ -14242,9 +14276,9 @@ var ln = "MenuContent", [wC, bl] = Er(ln), Th = g.forwardRef(
|
|
|
14242
14276
|
onDismiss: p,
|
|
14243
14277
|
disableOutsideScroll: x,
|
|
14244
14278
|
...y
|
|
14245
|
-
} = e, v = Ir(ln, n), m = Do(ln, n), w = li(n), b = wh(n), T = pC(n), [C, S] = g.useState(null), k = g.useRef(null), A = We(t, k, v.onContentChange), _ = g.useRef(0), M = g.useRef(""), F = g.useRef(0), q = g.useRef(null), O = g.useRef("right"), N = g.useRef(0), j = x ? Js : g.Fragment,
|
|
14279
|
+
} = e, v = Ir(ln, n), m = Do(ln, n), w = li(n), b = wh(n), T = pC(n), [C, S] = g.useState(null), k = g.useRef(null), A = We(t, k, v.onContentChange), _ = g.useRef(0), M = g.useRef(""), F = g.useRef(0), q = g.useRef(null), O = g.useRef("right"), N = g.useRef(0), j = x ? Js : g.Fragment, z = x ? { as: CC, allowPinchZoom: !0 } : void 0, re = ($) => {
|
|
14246
14280
|
var K, D;
|
|
14247
|
-
const G = M.current + $, ee = T().filter((X) => !X.disabled), ae = document.activeElement,
|
|
14281
|
+
const G = M.current + $, ee = T().filter((X) => !X.disabled), ae = document.activeElement, B = (K = ee.find((X) => X.ref.current === ae)) == null ? void 0 : K.textValue, se = ee.map((X) => X.textValue), Ne = MC(se, G, B), Ie = (D = ee.find((X) => X.textValue === Ne)) == null ? void 0 : D.ref.current;
|
|
14248
14282
|
(function X(te) {
|
|
14249
14283
|
M.current = te, window.clearTimeout(_.current), te !== "" && (_.current = window.setTimeout(() => X(""), 1e3));
|
|
14250
14284
|
})(G), Ie && setTimeout(() => Ie.focus());
|
|
@@ -14282,7 +14316,7 @@ var ln = "MenuContent", [wC, bl] = Er(ln), Th = g.forwardRef(
|
|
|
14282
14316
|
onPointerGraceIntentChange: g.useCallback(($) => {
|
|
14283
14317
|
q.current = $;
|
|
14284
14318
|
}, []),
|
|
14285
|
-
children: /* @__PURE__ */ u.jsx(j, { ...
|
|
14319
|
+
children: /* @__PURE__ */ u.jsx(j, { ...z, children: /* @__PURE__ */ u.jsx(
|
|
14286
14320
|
Gs,
|
|
14287
14321
|
{
|
|
14288
14322
|
asChild: !0,
|
|
@@ -14329,8 +14363,8 @@ var ln = "MenuContent", [wC, bl] = Er(ln), Th = g.forwardRef(
|
|
|
14329
14363
|
ref: A,
|
|
14330
14364
|
style: { outline: "none", ...y.style },
|
|
14331
14365
|
onKeyDown: ge(y.onKeyDown, ($) => {
|
|
14332
|
-
const ee = $.target.closest("[data-radix-menu-content]") === $.currentTarget, ae = $.ctrlKey || $.altKey || $.metaKey,
|
|
14333
|
-
ee && ($.key === "Tab" && $.preventDefault(), !ae &&
|
|
14366
|
+
const ee = $.target.closest("[data-radix-menu-content]") === $.currentTarget, ae = $.ctrlKey || $.altKey || $.metaKey, B = $.key.length === 1;
|
|
14367
|
+
ee && ($.key === "Tab" && $.preventDefault(), !ae && B && re($.key));
|
|
14334
14368
|
const se = k.current;
|
|
14335
14369
|
if ($.target !== se || !dC.includes($.key)) return;
|
|
14336
14370
|
$.preventDefault();
|
|
@@ -15019,16 +15053,16 @@ function Vi({
|
|
|
15019
15053
|
checkpoints: M,
|
|
15020
15054
|
interrupt: F,
|
|
15021
15055
|
metadata: q
|
|
15022
|
-
} = $a(), { isStreaming: O, error: N, submit: j, stop:
|
|
15056
|
+
} = $a(), { isStreaming: O, error: N, submit: j, stop: z } = By(), re = m ?? v ?? null, W = (_ == null ? void 0 : _.id) ?? null, $ = (_ == null ? void 0 : _.namespace) ?? null, G = (q == null ? void 0 : q.assemblingMessageId) ?? null, ee = F, [ae, B] = xe(!1);
|
|
15023
15057
|
lt(() => {
|
|
15024
|
-
ee ||
|
|
15058
|
+
ee || B(!1);
|
|
15025
15059
|
}, [ee]);
|
|
15026
15060
|
const se = be(() => {
|
|
15027
|
-
|
|
15061
|
+
B(!0);
|
|
15028
15062
|
}, []), Ne = be(() => {
|
|
15029
|
-
|
|
15030
|
-
}, []), Ie = !!ee || ae, [K, D] = xe(null), [X, te] = xe(""), [ce, ie] = xe(null), [de, Be] = xe([]), [Ge,
|
|
15031
|
-
pu.value = L,
|
|
15063
|
+
B(!1);
|
|
15064
|
+
}, []), Ie = !!ee || ae, [K, D] = xe(null), [X, te] = xe(""), [ce, ie] = xe(null), [de, Be] = xe([]), [Ge, Ze] = xe(0), [Ye, ft] = xe(0), [Qe, Oe] = xe(!1), [It, Ot] = xe(null), [He, Z] = xe(null), [ve, we] = xe(!1), [qe, ht] = xe(null), [mt, At] = xe(!1), yt = De(!1), [at, Je] = xe(() => pu.value), Mt = De(at), vt = De(null), et = be((L) => {
|
|
15065
|
+
pu.value = L, Je(L);
|
|
15032
15066
|
}, []), [qn, Gt] = xe(!1), dn = be(
|
|
15033
15067
|
(L, fe) => {
|
|
15034
15068
|
if (!L || typeof L != "object") return null;
|
|
@@ -15053,7 +15087,7 @@ function Vi({
|
|
|
15053
15087
|
return Number.isNaN(nn) || Number.isNaN(Tt) ? 0 : Tt - nn;
|
|
15054
15088
|
}), L;
|
|
15055
15089
|
}, [M, dn]), Sn = De(null), fn = De(null), gt = be(() => {
|
|
15056
|
-
Sn.current && (Sn.current.value = ""), fn.current && (fn.current.value = ""),
|
|
15090
|
+
Sn.current && (Sn.current.value = ""), fn.current && (fn.current.value = ""), Ze((L) => L + 1), ft((L) => L + 1);
|
|
15057
15091
|
}, []), hn = be(
|
|
15058
15092
|
(L) => {
|
|
15059
15093
|
et(L);
|
|
@@ -15076,10 +15110,10 @@ function Vi({
|
|
|
15076
15110
|
Mt.current = at;
|
|
15077
15111
|
}, [at]), lt(() => {
|
|
15078
15112
|
if (!K) {
|
|
15079
|
-
|
|
15113
|
+
vt.current = null;
|
|
15080
15114
|
return;
|
|
15081
15115
|
}
|
|
15082
|
-
|
|
15116
|
+
vt.current === null && (vt.current = Mt.current), et(X ?? "");
|
|
15083
15117
|
}, [X, K, et]);
|
|
15084
15118
|
const lr = be(async () => {
|
|
15085
15119
|
if (!(!b || T || !mt))
|
|
@@ -15142,11 +15176,11 @@ function Vi({
|
|
|
15142
15176
|
}
|
|
15143
15177
|
}, Hn = U.useCallback(
|
|
15144
15178
|
(L, fe) => {
|
|
15145
|
-
c && (
|
|
15179
|
+
c && (vt.current = at, D(L), te(fe), et(fe), ie(null));
|
|
15146
15180
|
},
|
|
15147
15181
|
[at, c, et]
|
|
15148
15182
|
), cr = U.useCallback(() => {
|
|
15149
|
-
D(null), te(""), ie(null), et(
|
|
15183
|
+
D(null), te(""), ie(null), et(vt.current ?? at), vt.current = null;
|
|
15150
15184
|
}, [at, et]), Ar = be((L, fe) => {
|
|
15151
15185
|
Hn(L, fe);
|
|
15152
15186
|
}, [Hn]), Nr = be((L) => {
|
|
@@ -15366,12 +15400,12 @@ function Vi({
|
|
|
15366
15400
|
},
|
|
15367
15401
|
Ye
|
|
15368
15402
|
),
|
|
15369
|
-
|
|
15403
|
+
Qe && /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
|
|
15370
15404
|
/* @__PURE__ */ u.jsx(Gi, { className: "h-4 w-4 animate-spin" }),
|
|
15371
15405
|
" Uploading Excel file..."
|
|
15372
15406
|
] }),
|
|
15373
|
-
He && !
|
|
15374
|
-
It && !
|
|
15407
|
+
He && !Qe && /* @__PURE__ */ u.jsx("div", { className: "text-sm rounded border border-emerald-200 bg-emerald-50 px-3 py-2 text-emerald-700", children: He }),
|
|
15408
|
+
It && !Qe && /* @__PURE__ */ u.jsx("div", { className: "text-sm rounded border border-red-200 bg-red-50 px-3 py-2 text-red-600", children: It })
|
|
15375
15409
|
] })
|
|
15376
15410
|
] }),
|
|
15377
15411
|
ce && /* @__PURE__ */ u.jsx("div", { className: "mb-3 text-sm text-red-600 bg-red-50 border border-red-200 rounded px-3 py-2", children: ce }),
|
|
@@ -15402,9 +15436,9 @@ function Vi({
|
|
|
15402
15436
|
{
|
|
15403
15437
|
onClick: () => {
|
|
15404
15438
|
var L;
|
|
15405
|
-
|
|
15439
|
+
Qe || (L = fn.current) == null || L.click();
|
|
15406
15440
|
},
|
|
15407
|
-
className: `cursor-pointer ${
|
|
15441
|
+
className: `cursor-pointer ${Qe ? "opacity-60 pointer-events-none" : ""}`,
|
|
15408
15442
|
children: [
|
|
15409
15443
|
/* @__PURE__ */ u.jsx(Km, { className: "h-4 w-4 mr-2" }),
|
|
15410
15444
|
" Upload Excel file"
|
|
@@ -15426,7 +15460,7 @@ function Vi({
|
|
|
15426
15460
|
maxLength: us,
|
|
15427
15461
|
onSend: pn,
|
|
15428
15462
|
onCancelEdit: cr,
|
|
15429
|
-
onStop:
|
|
15463
|
+
onStop: z,
|
|
15430
15464
|
allowEmptySend: de.length > 0,
|
|
15431
15465
|
textareaClassName: `resize-none min-h-[44px] max-h-[20rem] w-full transition-colors ${K ? "border-blue-400 bg-blue-50 text-blue-900 dark:border-blue-500 dark:bg-blue-950/60 dark:text-blue-50" : ""} ${ce ? "border-red-400" : ""} ${f.textarea || ""}`
|
|
15432
15466
|
}
|
|
@@ -16014,77 +16048,77 @@ function gu({
|
|
|
16014
16048
|
actions: x
|
|
16015
16049
|
} = Fa(), { loadThread: y } = $a(), { createThread: v, deleteThread: m, renameThread: w } = x, [b, T] = xe(Array.isArray(f) ? f : []), C = De(b.length > 0), S = De(null), k = De(0), [A, _] = xe(null), [M, F] = xe(""), [q, O] = xe(!1);
|
|
16016
16050
|
lt(() => {
|
|
16017
|
-
const
|
|
16018
|
-
if (
|
|
16019
|
-
C.current = !0, T(
|
|
16051
|
+
const B = Array.isArray(f) ? f : [];
|
|
16052
|
+
if (B.length > 0) {
|
|
16053
|
+
C.current = !0, T(B);
|
|
16020
16054
|
return;
|
|
16021
16055
|
}
|
|
16022
|
-
p || (C.current = !1, T(
|
|
16056
|
+
p || (C.current = !1, T(B));
|
|
16023
16057
|
}, [f, p]), lt(() => {
|
|
16024
16058
|
if (!S.current) return;
|
|
16025
|
-
const
|
|
16059
|
+
const B = S.current.querySelector(
|
|
16026
16060
|
"[data-radix-scroll-area-viewport]"
|
|
16027
16061
|
);
|
|
16028
|
-
if (!
|
|
16062
|
+
if (!B) return;
|
|
16029
16063
|
let se = null, Ne = null;
|
|
16030
16064
|
return se = requestAnimationFrame(() => {
|
|
16031
16065
|
Ne = requestAnimationFrame(() => {
|
|
16032
|
-
|
|
16066
|
+
B.scrollTop = k.current;
|
|
16033
16067
|
});
|
|
16034
16068
|
}), () => {
|
|
16035
16069
|
se !== null && cancelAnimationFrame(se), Ne !== null && cancelAnimationFrame(Ne);
|
|
16036
16070
|
};
|
|
16037
16071
|
}, [b]);
|
|
16038
|
-
const N = async (
|
|
16072
|
+
const N = async (B) => {
|
|
16039
16073
|
try {
|
|
16040
|
-
await y(
|
|
16074
|
+
await y(B), a == null || a(B), l == null || l(B);
|
|
16041
16075
|
} catch (se) {
|
|
16042
16076
|
console.error("Failed to select thread:", se);
|
|
16043
16077
|
}
|
|
16044
16078
|
}, j = async () => {
|
|
16045
16079
|
try {
|
|
16046
16080
|
O(!0);
|
|
16047
|
-
const
|
|
16048
|
-
c == null || c(
|
|
16049
|
-
} catch (
|
|
16050
|
-
console.error("Failed to create thread:",
|
|
16081
|
+
const B = await v();
|
|
16082
|
+
c == null || c(B), a == null || a(B);
|
|
16083
|
+
} catch (B) {
|
|
16084
|
+
console.error("Failed to create thread:", B);
|
|
16051
16085
|
} finally {
|
|
16052
16086
|
O(!1);
|
|
16053
16087
|
}
|
|
16054
|
-
},
|
|
16088
|
+
}, z = async (B, se) => {
|
|
16055
16089
|
if (se.stopPropagation(), !!confirm("Delete this thread?")) {
|
|
16056
16090
|
if (S.current) {
|
|
16057
16091
|
const Ne = S.current.querySelector("[data-radix-scroll-area-viewport]");
|
|
16058
16092
|
Ne && (k.current = Ne.scrollTop);
|
|
16059
16093
|
}
|
|
16060
16094
|
try {
|
|
16061
|
-
await m(
|
|
16095
|
+
await m(B), d == null || d(B);
|
|
16062
16096
|
} catch (Ne) {
|
|
16063
16097
|
console.error("Failed to delete thread:", Ne);
|
|
16064
16098
|
}
|
|
16065
16099
|
}
|
|
16066
|
-
}, re = (
|
|
16067
|
-
se.stopPropagation(), _(
|
|
16068
|
-
}, W = async (
|
|
16100
|
+
}, re = (B, se) => {
|
|
16101
|
+
se.stopPropagation(), _(B.threadId), F(B.title || `Thread ${B.threadId.slice(0, 8)}`);
|
|
16102
|
+
}, W = async (B) => {
|
|
16069
16103
|
if (M.trim())
|
|
16070
16104
|
try {
|
|
16071
|
-
await w(
|
|
16105
|
+
await w(B, M.trim()), _(null), F("");
|
|
16072
16106
|
} catch (se) {
|
|
16073
16107
|
console.error("Failed to update title:", se);
|
|
16074
16108
|
}
|
|
16075
16109
|
}, $ = () => {
|
|
16076
16110
|
_(null), F("");
|
|
16077
|
-
}, G = (
|
|
16078
|
-
|
|
16079
|
-
}, ee = (
|
|
16080
|
-
if (!
|
|
16111
|
+
}, G = (B, se) => {
|
|
16112
|
+
B.key === "Enter" ? W(se) : B.key === "Escape" && $();
|
|
16113
|
+
}, ee = (B) => {
|
|
16114
|
+
if (!B) return "";
|
|
16081
16115
|
try {
|
|
16082
|
-
const se = new Date(
|
|
16116
|
+
const se = new Date(B), Ie = (/* @__PURE__ */ new Date()).getTime() - se.getTime(), K = Math.floor(Ie / (1e3 * 60 * 60 * 24));
|
|
16083
16117
|
return K === 0 ? se.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) : K === 1 ? "Yesterday" : K < 7 ? `${K} days ago` : se.toLocaleDateString();
|
|
16084
16118
|
} catch {
|
|
16085
16119
|
return "";
|
|
16086
16120
|
}
|
|
16087
|
-
}, ae = (
|
|
16121
|
+
}, ae = (B) => B.title || `Thread ${B.threadId.slice(0, 8)}`;
|
|
16088
16122
|
return /* @__PURE__ */ u.jsxs("div", { className: `flex flex-col h-full ${e} ${s.container || ""}`, children: [
|
|
16089
16123
|
t && /* @__PURE__ */ u.jsx("div", { className: s.header || "flex-shrink-0 p-2 border-b bg-slate-800 border-slate-700 text-slate-100 flex justify-end", children: /* @__PURE__ */ u.jsx(
|
|
16090
16124
|
nt,
|
|
@@ -16110,32 +16144,32 @@ function gu({
|
|
|
16110
16144
|
] }) : b.length === 0 ? /* @__PURE__ */ u.jsxs("div", { className: "text-center py-8 text-slate-400", children: [
|
|
16111
16145
|
/* @__PURE__ */ u.jsx(Gm, { className: "w-8 h-8 mx-auto mb-2 opacity-40 text-slate-500" }),
|
|
16112
16146
|
/* @__PURE__ */ u.jsx("p", { className: "text-sm text-slate-500", children: "No conversations yet" })
|
|
16113
|
-
] }) : b.slice().sort((
|
|
16147
|
+
] }) : b.slice().sort((B, se) => new Date(se.updatedAt || se.createdAt || "").getTime() - new Date(B.updatedAt || B.createdAt || "").getTime()).map((B) => /* @__PURE__ */ u.jsxs(
|
|
16114
16148
|
"div",
|
|
16115
16149
|
{
|
|
16116
|
-
onClick: () => N(
|
|
16117
|
-
className: `group relative p-3 rounded-lg cursor-pointer transition-colors border ${(i ?? h) ===
|
|
16150
|
+
onClick: () => N(B.threadId),
|
|
16151
|
+
className: `group relative p-3 rounded-lg cursor-pointer transition-colors border ${(i ?? h) === B.threadId ? `${s.activeThread || "bg-slate-600 border-slate-500"} ` : `${s.threadItem || "bg-slate-700 border-slate-600 hover:bg-slate-600 text-gray-900 dark:text-slate-100"}`} ${s.threadItem || ""} text-gray-900 dark:text-slate-100`,
|
|
16118
16152
|
children: [
|
|
16119
16153
|
/* @__PURE__ */ u.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
16120
|
-
/* @__PURE__ */ u.jsx("div", { className: "flex-1 min-w-0", children: A ===
|
|
16121
|
-
/* @__PURE__ */ u.jsx(Is, { value: M, onChange: (se) => F(se.target.value), onKeyDown: (se) => G(se,
|
|
16122
|
-
/* @__PURE__ */ u.jsx(nt, { variant: "ghost", size: "sm", onClick: () => W(
|
|
16154
|
+
/* @__PURE__ */ u.jsx("div", { className: "flex-1 min-w-0", children: A === B.threadId ? /* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2", onClick: (se) => se.stopPropagation(), children: [
|
|
16155
|
+
/* @__PURE__ */ u.jsx(Is, { value: M, onChange: (se) => F(se.target.value), onKeyDown: (se) => G(se, B.threadId), className: "h-6 text-sm", autoFocus: !0 }),
|
|
16156
|
+
/* @__PURE__ */ u.jsx(nt, { variant: "ghost", size: "sm", onClick: () => W(B.threadId), className: "h-6 w-6 p-0", children: /* @__PURE__ */ u.jsx(_a, { size: 12 }) }),
|
|
16123
16157
|
/* @__PURE__ */ u.jsx(nt, { variant: "ghost", size: "sm", onClick: $, className: "h-6 w-6 p-0", children: /* @__PURE__ */ u.jsx(Or, { size: 12 }) })
|
|
16124
16158
|
] }) : /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
|
|
16125
|
-
/* @__PURE__ */ u.jsx("div", { className: "font-medium text-sm truncate text-gray-900 dark:text-slate-100", children: ae(
|
|
16159
|
+
/* @__PURE__ */ u.jsx("div", { className: "font-medium text-sm truncate text-gray-900 dark:text-slate-100", children: ae(B) }),
|
|
16126
16160
|
/* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-2 text-xs text-gray-500 dark:text-slate-400 mt-1", children: [
|
|
16127
16161
|
/* @__PURE__ */ u.jsx(Ym, { size: 10 }),
|
|
16128
|
-
/* @__PURE__ */ u.jsx("span", { children: ee(
|
|
16162
|
+
/* @__PURE__ */ u.jsx("span", { children: ee(B.updatedAt || B.createdAt) })
|
|
16129
16163
|
] })
|
|
16130
16164
|
] }) }),
|
|
16131
16165
|
/* @__PURE__ */ u.jsxs("div", { className: "flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity ml-2", children: [
|
|
16132
|
-
r && A !==
|
|
16166
|
+
r && A !== B.threadId && /* @__PURE__ */ u.jsx(nt, { variant: "ghost", size: "sm", onClick: (se) => re(B, se), className: "h-6 w-6 p-0", title: "Edit title", children: /* @__PURE__ */ u.jsx(wu, { size: 12 }) }),
|
|
16133
16167
|
n && /* @__PURE__ */ u.jsx(
|
|
16134
16168
|
nt,
|
|
16135
16169
|
{
|
|
16136
16170
|
variant: "ghost",
|
|
16137
16171
|
size: "sm",
|
|
16138
|
-
onClick: (se) => B
|
|
16172
|
+
onClick: (se) => z(B.threadId, se),
|
|
16139
16173
|
className: "h-6 w-6 p-0 text-red-400 hover:text-red-300 hover:bg-red-900/20",
|
|
16140
16174
|
title: "Delete thread",
|
|
16141
16175
|
children: /* @__PURE__ */ u.jsx(Xm, { size: 12 })
|
|
@@ -16143,10 +16177,10 @@ function gu({
|
|
|
16143
16177
|
)
|
|
16144
16178
|
] })
|
|
16145
16179
|
] }),
|
|
16146
|
-
i ===
|
|
16180
|
+
i === B.threadId && /* @__PURE__ */ u.jsx("div", { className: "absolute left-0 top-1/2 -translate-y-1/2 w-1 h-8 bg-blue-400 rounded-r" })
|
|
16147
16181
|
]
|
|
16148
16182
|
},
|
|
16149
|
-
|
|
16183
|
+
B.threadId
|
|
16150
16184
|
)) })
|
|
16151
16185
|
}
|
|
16152
16186
|
)
|
|
@@ -16471,7 +16505,7 @@ var ek = [" ", "Enter", "ArrowUp", "ArrowDown"], tk = [" ", "Enter"], Sr = "Sele
|
|
|
16471
16505
|
defaultProp: a,
|
|
16472
16506
|
onChange: l,
|
|
16473
16507
|
caller: Sr
|
|
16474
|
-
}), F = g.useRef(null), q = v ? x || !!v.closest("form") : !0, [O, N] = g.useState(/* @__PURE__ */ new Set()), j = Array.from(O).map((
|
|
16508
|
+
}), F = g.useRef(null), q = v ? x || !!v.closest("form") : !0, [O, N] = g.useState(/* @__PURE__ */ new Set()), j = Array.from(O).map((z) => z.props.value).join(";");
|
|
16475
16509
|
return /* @__PURE__ */ u.jsx(lh, { ...y, children: /* @__PURE__ */ u.jsxs(
|
|
16476
16510
|
rk,
|
|
16477
16511
|
{
|
|
@@ -16496,13 +16530,13 @@ var ek = [" ", "Enter", "ArrowUp", "ArrowDown"], tk = [" ", "Enter"], Sr = "Sele
|
|
|
16496
16530
|
ok,
|
|
16497
16531
|
{
|
|
16498
16532
|
scope: e.__scopeSelect,
|
|
16499
|
-
onNativeOptionAdd: g.useCallback((
|
|
16500
|
-
N((re) => new Set(re).add(
|
|
16533
|
+
onNativeOptionAdd: g.useCallback((z) => {
|
|
16534
|
+
N((re) => new Set(re).add(z));
|
|
16501
16535
|
}, []),
|
|
16502
|
-
onNativeOptionRemove: g.useCallback((
|
|
16536
|
+
onNativeOptionRemove: g.useCallback((z) => {
|
|
16503
16537
|
N((re) => {
|
|
16504
16538
|
const W = new Set(re);
|
|
16505
|
-
return W.delete(
|
|
16539
|
+
return W.delete(z), W;
|
|
16506
16540
|
});
|
|
16507
16541
|
}, []),
|
|
16508
16542
|
children: n
|
|
@@ -16517,7 +16551,7 @@ var ek = [" ", "Enter", "ArrowUp", "ArrowDown"], tk = [" ", "Enter"], Sr = "Sele
|
|
|
16517
16551
|
name: d,
|
|
16518
16552
|
autoComplete: f,
|
|
16519
16553
|
value: _,
|
|
16520
|
-
onChange: (
|
|
16554
|
+
onChange: (z) => M(z.target.value),
|
|
16521
16555
|
disabled: h,
|
|
16522
16556
|
form: x,
|
|
16523
16557
|
children: [
|
|
@@ -16646,7 +16680,7 @@ var mn = 10, [Yp, ir] = Yr(Cr), lk = "SelectContentImpl", ck = $r("SelectContent
|
|
|
16646
16680
|
g.useEffect(() => {
|
|
16647
16681
|
if (b) return ol(b);
|
|
16648
16682
|
}, [b]), rl();
|
|
16649
|
-
const
|
|
16683
|
+
const z = g.useCallback(
|
|
16650
16684
|
(K) => {
|
|
16651
16685
|
const [D, ...X] = q().map((ie) => ie.ref.current), [te] = X.slice(-1), ce = document.activeElement;
|
|
16652
16686
|
for (const ie of K)
|
|
@@ -16654,8 +16688,8 @@ var mn = 10, [Yp, ir] = Yr(Cr), lk = "SelectContentImpl", ck = $r("SelectContent
|
|
|
16654
16688
|
},
|
|
16655
16689
|
[q, C]
|
|
16656
16690
|
), re = g.useCallback(
|
|
16657
|
-
() =>
|
|
16658
|
-
[
|
|
16691
|
+
() => z([A, b]),
|
|
16692
|
+
[z, A, b]
|
|
16659
16693
|
);
|
|
16660
16694
|
g.useEffect(() => {
|
|
16661
16695
|
O && re();
|
|
@@ -16692,7 +16726,7 @@ var mn = 10, [Yp, ir] = Yr(Cr), lk = "SelectContentImpl", ck = $r("SelectContent
|
|
|
16692
16726
|
(w.value !== void 0 && w.value === D || te) && (_(K), te && (j.current = !0));
|
|
16693
16727
|
},
|
|
16694
16728
|
[w.value]
|
|
16695
|
-
),
|
|
16729
|
+
), B = g.useCallback(() => b == null ? void 0 : b.focus(), [b]), se = g.useCallback(
|
|
16696
16730
|
(K, D, X) => {
|
|
16697
16731
|
const te = !j.current && !X;
|
|
16698
16732
|
(w.value !== void 0 && w.value === D || te) && F(K);
|
|
@@ -16719,7 +16753,7 @@ var mn = 10, [Yp, ir] = Yr(Cr), lk = "SelectContentImpl", ck = $r("SelectContent
|
|
|
16719
16753
|
onViewportChange: S,
|
|
16720
16754
|
itemRefCallback: ae,
|
|
16721
16755
|
selectedItem: A,
|
|
16722
|
-
onItemLeave:
|
|
16756
|
+
onItemLeave: B,
|
|
16723
16757
|
itemTextRefCallback: se,
|
|
16724
16758
|
focusSelectedItem: re,
|
|
16725
16759
|
selectedItemText: M,
|
|
@@ -16775,7 +16809,7 @@ var mn = 10, [Yp, ir] = Yr(Cr), lk = "SelectContentImpl", ck = $r("SelectContent
|
|
|
16775
16809
|
const ce = K.target, ie = te.indexOf(ce);
|
|
16776
16810
|
te = te.slice(ie + 1);
|
|
16777
16811
|
}
|
|
16778
|
-
setTimeout(() =>
|
|
16812
|
+
setTimeout(() => z(te)), K.preventDefault();
|
|
16779
16813
|
}
|
|
16780
16814
|
})
|
|
16781
16815
|
}
|
|
@@ -16794,31 +16828,31 @@ var uk = "SelectItemAlignedPosition", Jp = g.forwardRef((e, t) => {
|
|
|
16794
16828
|
if (s.trigger && s.valueNode && a && c && y && v && m) {
|
|
16795
16829
|
const k = s.trigger.getBoundingClientRect(), A = c.getBoundingClientRect(), _ = s.valueNode.getBoundingClientRect(), M = m.getBoundingClientRect();
|
|
16796
16830
|
if (s.dir !== "rtl") {
|
|
16797
|
-
const ce = M.left - A.left, ie = _.left - ce, de = k.left - ie, Be = k.width + de, Ge = Math.max(Be, A.width),
|
|
16831
|
+
const ce = M.left - A.left, ie = _.left - ce, de = k.left - ie, Be = k.width + de, Ge = Math.max(Be, A.width), Ze = window.innerWidth - mn, Ye = ba(ie, [
|
|
16798
16832
|
mn,
|
|
16799
16833
|
// Prevents the content from going off the starting edge of the
|
|
16800
16834
|
// viewport. It may still go off the ending edge, but this can be
|
|
16801
16835
|
// controlled by the user since they may want to manage overflow in a
|
|
16802
16836
|
// specific way.
|
|
16803
16837
|
// https://github.com/radix-ui/primitives/issues/2049
|
|
16804
|
-
Math.max(mn,
|
|
16838
|
+
Math.max(mn, Ze - Ge)
|
|
16805
16839
|
]);
|
|
16806
16840
|
a.style.minWidth = Be + "px", a.style.left = Ye + "px";
|
|
16807
16841
|
} else {
|
|
16808
|
-
const ce = A.right - M.right, ie = window.innerWidth - _.right - ce, de = window.innerWidth - k.right - ie, Be = k.width + de, Ge = Math.max(Be, A.width),
|
|
16842
|
+
const ce = A.right - M.right, ie = window.innerWidth - _.right - ce, de = window.innerWidth - k.right - ie, Be = k.width + de, Ge = Math.max(Be, A.width), Ze = window.innerWidth - mn, Ye = ba(ie, [
|
|
16809
16843
|
mn,
|
|
16810
|
-
Math.max(mn,
|
|
16844
|
+
Math.max(mn, Ze - Ge)
|
|
16811
16845
|
]);
|
|
16812
16846
|
a.style.minWidth = Be + "px", a.style.right = Ye + "px";
|
|
16813
16847
|
}
|
|
16814
|
-
const F = h(), q = window.innerHeight - mn * 2, O = y.scrollHeight, N = window.getComputedStyle(c), j = parseInt(N.borderTopWidth, 10),
|
|
16848
|
+
const F = h(), q = window.innerHeight - mn * 2, O = y.scrollHeight, N = window.getComputedStyle(c), j = parseInt(N.borderTopWidth, 10), z = parseInt(N.paddingTop, 10), re = parseInt(N.borderBottomWidth, 10), W = parseInt(N.paddingBottom, 10), $ = j + z + O + W + re, G = Math.min(v.offsetHeight * 5, $), ee = window.getComputedStyle(y), ae = parseInt(ee.paddingTop, 10), B = parseInt(ee.paddingBottom, 10), se = k.top + k.height / 2 - mn, Ne = q - se, Ie = v.offsetHeight / 2, K = v.offsetTop + Ie, D = j + z + K, X = $ - D;
|
|
16815
16849
|
if (D <= se) {
|
|
16816
16850
|
const ce = F.length > 0 && v === F[F.length - 1].ref.current;
|
|
16817
16851
|
a.style.bottom = "0px";
|
|
16818
16852
|
const ie = c.clientHeight - y.offsetTop - y.offsetHeight, de = Math.max(
|
|
16819
16853
|
Ne,
|
|
16820
16854
|
Ie + // viewport might have padding bottom, include it to avoid a scrollable viewport
|
|
16821
|
-
(ce ?
|
|
16855
|
+
(ce ? B : 0) + ie + re
|
|
16822
16856
|
), Be = D + de;
|
|
16823
16857
|
a.style.height = Be + "px";
|
|
16824
16858
|
} else {
|