teodor-new-chat-ui 4.3.230 → 4.3.231
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 +257 -257
- package/dist/index.umd.js +9 -9
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -288,7 +288,7 @@ function Dm() {
|
|
|
288
288
|
var Fn = R ? R.displayName || R.name : "", Nn = Fn ? P(Fn) : "";
|
|
289
289
|
return typeof R == "function" && te.set(R, Nn), Nn;
|
|
290
290
|
}
|
|
291
|
-
function
|
|
291
|
+
function Me(R, K, ie) {
|
|
292
292
|
return ne(R, !1);
|
|
293
293
|
}
|
|
294
294
|
function Y(R) {
|
|
@@ -311,7 +311,7 @@ function Dm() {
|
|
|
311
311
|
if (typeof R == "object")
|
|
312
312
|
switch (R.$$typeof) {
|
|
313
313
|
case l:
|
|
314
|
-
return
|
|
314
|
+
return Me(R.render);
|
|
315
315
|
case f:
|
|
316
316
|
return de(R.type, K, ie);
|
|
317
317
|
case p: {
|
|
@@ -389,7 +389,7 @@ function Dm() {
|
|
|
389
389
|
}
|
|
390
390
|
return R.ref !== void 0;
|
|
391
391
|
}
|
|
392
|
-
function
|
|
392
|
+
function Qe(R) {
|
|
393
393
|
if (ke.call(R, "key")) {
|
|
394
394
|
var K = Object.getOwnPropertyDescriptor(R, "key").get;
|
|
395
395
|
if (K && K.isReactWarning)
|
|
@@ -397,10 +397,10 @@ function Dm() {
|
|
|
397
397
|
}
|
|
398
398
|
return R.key !== void 0;
|
|
399
399
|
}
|
|
400
|
-
function
|
|
400
|
+
function je(R, K) {
|
|
401
401
|
typeof R.ref == "string" && mt.current;
|
|
402
402
|
}
|
|
403
|
-
function
|
|
403
|
+
function De(R, K) {
|
|
404
404
|
{
|
|
405
405
|
var ie = function() {
|
|
406
406
|
Ct || (Ct = !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)", K));
|
|
@@ -454,7 +454,7 @@ function Dm() {
|
|
|
454
454
|
function Fe(R, K, ie, we, Ge) {
|
|
455
455
|
{
|
|
456
456
|
var it, He = {}, $e = null, Ot = null;
|
|
457
|
-
ie !== void 0 && (St(ie), $e = "" + ie),
|
|
457
|
+
ie !== void 0 && (St(ie), $e = "" + ie), Qe(K) && (St(K.key), $e = "" + K.key), re(K) && (Ot = K.ref, je(K, Ge));
|
|
458
458
|
for (it in K)
|
|
459
459
|
ke.call(K, it) && !lt.hasOwnProperty(it) && (He[it] = K[it]);
|
|
460
460
|
if (R && R.defaultProps) {
|
|
@@ -464,7 +464,7 @@ function Dm() {
|
|
|
464
464
|
}
|
|
465
465
|
if ($e || Ot) {
|
|
466
466
|
var vt = typeof R == "function" ? R.displayName || R.name || "Unknown" : R;
|
|
467
|
-
$e &&
|
|
467
|
+
$e && De(He, vt), Ot && ut(He, vt);
|
|
468
468
|
}
|
|
469
469
|
return et(R, $e, Ot, Ge, we, mt.current, He);
|
|
470
470
|
}
|
|
@@ -498,7 +498,7 @@ Check the render method of \`` + R + "`.";
|
|
|
498
498
|
return "";
|
|
499
499
|
}
|
|
500
500
|
var Tt = {};
|
|
501
|
-
function
|
|
501
|
+
function _e(R) {
|
|
502
502
|
{
|
|
503
503
|
var K = ht();
|
|
504
504
|
if (!K) {
|
|
@@ -515,7 +515,7 @@ Check the top-level render call using <` + ie + ">.");
|
|
|
515
515
|
if (!R._store || R._store.validated || R.key != null)
|
|
516
516
|
return;
|
|
517
517
|
R._store.validated = !0;
|
|
518
|
-
var ie =
|
|
518
|
+
var ie = _e(K);
|
|
519
519
|
if (Tt[ie])
|
|
520
520
|
return;
|
|
521
521
|
Tt[ie] = !0;
|
|
@@ -874,10 +874,10 @@ const xg = (e) => {
|
|
|
874
874
|
asap: wg,
|
|
875
875
|
isIterable: bg
|
|
876
876
|
};
|
|
877
|
-
function
|
|
877
|
+
function Pe(e, t, n, r, o) {
|
|
878
878
|
Error.call(this), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack, this.message = e, this.name = "AxiosError", t && (this.code = t), n && (this.config = n), r && (this.request = r), o && (this.response = o, this.status = o.status ? o.status : null);
|
|
879
879
|
}
|
|
880
|
-
_.inherits(
|
|
880
|
+
_.inherits(Pe, Error, {
|
|
881
881
|
toJSON: function() {
|
|
882
882
|
return {
|
|
883
883
|
// Standard
|
|
@@ -898,7 +898,7 @@ _.inherits(_e, Error, {
|
|
|
898
898
|
};
|
|
899
899
|
}
|
|
900
900
|
});
|
|
901
|
-
const au =
|
|
901
|
+
const au = Pe.prototype, lu = {};
|
|
902
902
|
[
|
|
903
903
|
"ERR_BAD_OPTION_VALUE",
|
|
904
904
|
"ERR_BAD_OPTION",
|
|
@@ -916,15 +916,15 @@ const au = _e.prototype, lu = {};
|
|
|
916
916
|
].forEach((e) => {
|
|
917
917
|
lu[e] = { value: e };
|
|
918
918
|
});
|
|
919
|
-
Object.defineProperties(
|
|
919
|
+
Object.defineProperties(Pe, lu);
|
|
920
920
|
Object.defineProperty(au, "isAxiosError", { value: !0 });
|
|
921
|
-
|
|
921
|
+
Pe.from = (e, t, n, r, o, s) => {
|
|
922
922
|
const i = Object.create(au);
|
|
923
923
|
_.toFlatObject(e, i, function(d) {
|
|
924
924
|
return d !== Error.prototype;
|
|
925
925
|
}, (c) => c !== "isAxiosError");
|
|
926
926
|
const a = e && e.message ? e.message : "Error", l = t == null && e ? e.code : t;
|
|
927
|
-
return
|
|
927
|
+
return Pe.call(i, a, l, n, r, o), e && i.cause == null && Object.defineProperty(i, "cause", { value: e, configurable: !0 }), i.name = e && e.name || "Error", s && Object.assign(i, s), i;
|
|
928
928
|
};
|
|
929
929
|
const Sg = null;
|
|
930
930
|
function Mi(e) {
|
|
@@ -964,7 +964,7 @@ function Ts(e, t, n) {
|
|
|
964
964
|
if (_.isBoolean(m))
|
|
965
965
|
return m.toString();
|
|
966
966
|
if (!l && _.isBlob(m))
|
|
967
|
-
throw new
|
|
967
|
+
throw new Pe("Blob is not supported. Use a Buffer instead.");
|
|
968
968
|
return _.isArrayBuffer(m) || _.isTypedArray(m) ? l && typeof Blob == "function" ? new Blob([m]) : Buffer.from(m) : m;
|
|
969
969
|
}
|
|
970
970
|
function d(m, x, y) {
|
|
@@ -1215,7 +1215,7 @@ const ho = {
|
|
|
1215
1215
|
return JSON.parse(t, this.parseReviver);
|
|
1216
1216
|
} catch (a) {
|
|
1217
1217
|
if (i)
|
|
1218
|
-
throw a.name === "SyntaxError" ?
|
|
1218
|
+
throw a.name === "SyntaxError" ? Pe.from(a, Pe.ERR_BAD_RESPONSE, this, null, this.response) : a;
|
|
1219
1219
|
}
|
|
1220
1220
|
}
|
|
1221
1221
|
return t;
|
|
@@ -1458,16 +1458,16 @@ function hu(e) {
|
|
|
1458
1458
|
return !!(e && e.__CANCEL__);
|
|
1459
1459
|
}
|
|
1460
1460
|
function Ar(e, t, n) {
|
|
1461
|
-
|
|
1461
|
+
Pe.call(this, e ?? "canceled", Pe.ERR_CANCELED, t, n), this.name = "CanceledError";
|
|
1462
1462
|
}
|
|
1463
|
-
_.inherits(Ar,
|
|
1463
|
+
_.inherits(Ar, Pe, {
|
|
1464
1464
|
__CANCEL__: !0
|
|
1465
1465
|
});
|
|
1466
1466
|
function mu(e, t, n) {
|
|
1467
1467
|
const r = n.config.validateStatus;
|
|
1468
|
-
!n.status || !r || r(n.status) ? e(n) : t(new
|
|
1468
|
+
!n.status || !r || r(n.status) ? e(n) : t(new Pe(
|
|
1469
1469
|
"Request failed with status code " + n.status,
|
|
1470
|
-
[
|
|
1470
|
+
[Pe.ERR_BAD_REQUEST, Pe.ERR_BAD_RESPONSE][Math.floor(n.status / 100) - 4],
|
|
1471
1471
|
n.config,
|
|
1472
1472
|
n.request,
|
|
1473
1473
|
n
|
|
@@ -1690,16 +1690,16 @@ const xu = (e) => {
|
|
|
1690
1690
|
"onloadend" in y ? y.onloadend = g : y.onreadystatechange = function() {
|
|
1691
1691
|
!y || y.readyState !== 4 || y.status === 0 && !(y.responseURL && y.responseURL.indexOf("file:") === 0) || setTimeout(g);
|
|
1692
1692
|
}, y.onabort = function() {
|
|
1693
|
-
y && (r(new
|
|
1693
|
+
y && (r(new Pe("Request aborted", Pe.ECONNABORTED, e, y)), y = null);
|
|
1694
1694
|
}, y.onerror = function(T) {
|
|
1695
|
-
const C = T && T.message ? T.message : "Network Error", S = new
|
|
1695
|
+
const C = T && T.message ? T.message : "Network Error", S = new Pe(C, Pe.ERR_NETWORK, e, y);
|
|
1696
1696
|
S.event = T || null, r(S), y = null;
|
|
1697
1697
|
}, y.ontimeout = function() {
|
|
1698
1698
|
let T = o.timeout ? "timeout of " + o.timeout + "ms exceeded" : "timeout exceeded";
|
|
1699
1699
|
const C = o.transitional || fu;
|
|
1700
|
-
o.timeoutErrorMessage && (T = o.timeoutErrorMessage), r(new
|
|
1700
|
+
o.timeoutErrorMessage && (T = o.timeoutErrorMessage), r(new Pe(
|
|
1701
1701
|
T,
|
|
1702
|
-
C.clarifyTimeoutError ?
|
|
1702
|
+
C.clarifyTimeoutError ? Pe.ETIMEDOUT : Pe.ECONNABORTED,
|
|
1703
1703
|
e,
|
|
1704
1704
|
y
|
|
1705
1705
|
)), y = null;
|
|
@@ -1710,7 +1710,7 @@ const xu = (e) => {
|
|
|
1710
1710
|
}, o.cancelToken && o.cancelToken.subscribe(d), o.signal && (o.signal.aborted ? d() : o.signal.addEventListener("abort", d)));
|
|
1711
1711
|
const w = Wg(o.url);
|
|
1712
1712
|
if (w && zt.protocols.indexOf(w) === -1) {
|
|
1713
|
-
r(new
|
|
1713
|
+
r(new Pe("Unsupported protocol " + w + ":", Pe.ERR_BAD_REQUEST, e));
|
|
1714
1714
|
return;
|
|
1715
1715
|
}
|
|
1716
1716
|
y.send(s || null);
|
|
@@ -1723,11 +1723,11 @@ const xu = (e) => {
|
|
|
1723
1723
|
if (!o) {
|
|
1724
1724
|
o = !0, a();
|
|
1725
1725
|
const d = c instanceof Error ? c : this.reason;
|
|
1726
|
-
r.abort(d instanceof
|
|
1726
|
+
r.abort(d instanceof Pe ? d : new Ar(d instanceof Error ? d.message : d));
|
|
1727
1727
|
}
|
|
1728
1728
|
};
|
|
1729
1729
|
let i = t && setTimeout(() => {
|
|
1730
|
-
i = null, s(new
|
|
1730
|
+
i = null, s(new Pe(`timeout ${t} of ms exceeded`, Pe.ETIMEDOUT));
|
|
1731
1731
|
}, t);
|
|
1732
1732
|
const a = () => {
|
|
1733
1733
|
e && (i && clearTimeout(i), i = null, e.forEach((c) => {
|
|
@@ -1832,7 +1832,7 @@ const xu = (e) => {
|
|
|
1832
1832
|
let g = x && x[m];
|
|
1833
1833
|
if (g)
|
|
1834
1834
|
return g.call(x);
|
|
1835
|
-
throw new
|
|
1835
|
+
throw new Pe(`Response type '${m}' is not supported`, Pe.ERR_NOT_SUPPORT, y);
|
|
1836
1836
|
});
|
|
1837
1837
|
});
|
|
1838
1838
|
const p = async (m) => {
|
|
@@ -1932,11 +1932,11 @@ const xu = (e) => {
|
|
|
1932
1932
|
});
|
|
1933
1933
|
} catch (A) {
|
|
1934
1934
|
throw j && j(), A && A.name === "TypeError" && /Load failed|fetch/i.test(A.message) ? Object.assign(
|
|
1935
|
-
new
|
|
1935
|
+
new Pe("Network Error", Pe.ERR_NETWORK, m, F),
|
|
1936
1936
|
{
|
|
1937
1937
|
cause: A.cause || A
|
|
1938
1938
|
}
|
|
1939
|
-
) :
|
|
1939
|
+
) : Pe.from(A, A && A.code, m, F);
|
|
1940
1940
|
}
|
|
1941
1941
|
};
|
|
1942
1942
|
}, sx = /* @__PURE__ */ new Map(), yu = (e) => {
|
|
@@ -1978,7 +1978,7 @@ const Il = (e) => `- ${e}`, ix = (e) => _.isFunction(e) || e === null || e === !
|
|
|
1978
1978
|
r = e[i];
|
|
1979
1979
|
let a;
|
|
1980
1980
|
if (o = r, !ix(r) && (o = Li[(a = String(r)).toLowerCase()], o === void 0))
|
|
1981
|
-
throw new
|
|
1981
|
+
throw new Pe(`Unknown adapter '${a}'`);
|
|
1982
1982
|
if (o && (_.isFunction(o) || (o = o.get(t))))
|
|
1983
1983
|
break;
|
|
1984
1984
|
s[a || "#" + i] = o;
|
|
@@ -1990,7 +1990,7 @@ const Il = (e) => `- ${e}`, ix = (e) => _.isFunction(e) || e === null || e === !
|
|
|
1990
1990
|
let a = n ? i.length > 1 ? `since :
|
|
1991
1991
|
` + i.map(Il).join(`
|
|
1992
1992
|
`) : " " + Il(i[0]) : "as no adapter specified";
|
|
1993
|
-
throw new
|
|
1993
|
+
throw new Pe(
|
|
1994
1994
|
"There is no suitable adapter to dispatch the request " + a,
|
|
1995
1995
|
"ERR_NOT_SUPPORT"
|
|
1996
1996
|
);
|
|
@@ -2034,9 +2034,9 @@ ks.transitional = function(t, n, r) {
|
|
|
2034
2034
|
}
|
|
2035
2035
|
return (s, i, a) => {
|
|
2036
2036
|
if (t === !1)
|
|
2037
|
-
throw new
|
|
2037
|
+
throw new Pe(
|
|
2038
2038
|
o(i, " has been removed" + (n ? " in " + n : "")),
|
|
2039
|
-
|
|
2039
|
+
Pe.ERR_DEPRECATED
|
|
2040
2040
|
);
|
|
2041
2041
|
return n && !Al[i] && (Al[i] = !0, console.warn(
|
|
2042
2042
|
o(
|
|
@@ -2051,7 +2051,7 @@ ks.spelling = function(t) {
|
|
|
2051
2051
|
};
|
|
2052
2052
|
function ax(e, t, n) {
|
|
2053
2053
|
if (typeof e != "object")
|
|
2054
|
-
throw new
|
|
2054
|
+
throw new Pe("options must be an object", Pe.ERR_BAD_OPTION_VALUE);
|
|
2055
2055
|
const r = Object.keys(e);
|
|
2056
2056
|
let o = r.length;
|
|
2057
2057
|
for (; o-- > 0; ) {
|
|
@@ -2059,11 +2059,11 @@ function ax(e, t, n) {
|
|
|
2059
2059
|
if (i) {
|
|
2060
2060
|
const a = e[s], l = a === void 0 || i(a, s, e);
|
|
2061
2061
|
if (l !== !0)
|
|
2062
|
-
throw new
|
|
2062
|
+
throw new Pe("option " + s + " must be " + l, Pe.ERR_BAD_OPTION_VALUE);
|
|
2063
2063
|
continue;
|
|
2064
2064
|
}
|
|
2065
2065
|
if (n !== !0)
|
|
2066
|
-
throw new
|
|
2066
|
+
throw new Pe("Unknown option " + s, Pe.ERR_BAD_OPTION);
|
|
2067
2067
|
}
|
|
2068
2068
|
}
|
|
2069
2069
|
const $o = {
|
|
@@ -2356,7 +2356,7 @@ It.CancelToken = lx;
|
|
|
2356
2356
|
It.isCancel = hu;
|
|
2357
2357
|
It.VERSION = wu;
|
|
2358
2358
|
It.toFormData = Ts;
|
|
2359
|
-
It.AxiosError =
|
|
2359
|
+
It.AxiosError = Pe;
|
|
2360
2360
|
It.Cancel = It.CanceledError;
|
|
2361
2361
|
It.all = function(t) {
|
|
2362
2362
|
return Promise.all(t);
|
|
@@ -3415,7 +3415,7 @@ function Kx(e = {}) {
|
|
|
3415
3415
|
threadId: j.threadId ?? null,
|
|
3416
3416
|
headers: {}
|
|
3417
3417
|
}, (async () => {
|
|
3418
|
-
var pe, Re, Ee, W, ee, q, P, H, te, se, ne,
|
|
3418
|
+
var pe, Re, Ee, W, ee, q, P, H, te, se, ne, Me, Y, de, ke, Ne, ze, Be;
|
|
3419
3419
|
const J = (Ue) => {
|
|
3420
3420
|
var Ke;
|
|
3421
3421
|
try {
|
|
@@ -3494,13 +3494,13 @@ function Kx(e = {}) {
|
|
|
3494
3494
|
lt = [], T.current && p((Fe) => Fe + et);
|
|
3495
3495
|
}
|
|
3496
3496
|
ce = null;
|
|
3497
|
-
},
|
|
3497
|
+
}, Qe = () => {
|
|
3498
3498
|
typeof window < "u" && ce == null && (ce = requestAnimationFrame(re));
|
|
3499
3499
|
};
|
|
3500
|
-
let
|
|
3501
|
-
const
|
|
3500
|
+
let je = Date.now();
|
|
3501
|
+
const De = setInterval(() => {
|
|
3502
3502
|
var et;
|
|
3503
|
-
if (Date.now() -
|
|
3503
|
+
if (Date.now() - je > 18e5) {
|
|
3504
3504
|
const Fe = "Stream idle timeout";
|
|
3505
3505
|
d(Fe), D = "error", M = Fe, B.abort(), (et = A == null ? void 0 : A.onError) == null || et.call(A, Fe);
|
|
3506
3506
|
}
|
|
@@ -3529,60 +3529,60 @@ function Kx(e = {}) {
|
|
|
3529
3529
|
console.debug("[use-chat] malformed SSE:", gt.slice(0, 200));
|
|
3530
3530
|
continue;
|
|
3531
3531
|
}
|
|
3532
|
-
const
|
|
3533
|
-
|
|
3534
|
-
const Vt =
|
|
3532
|
+
const _e = qx(Tt) ? Tt.data : Tt;
|
|
3533
|
+
je = Date.now();
|
|
3534
|
+
const Vt = _e.seq;
|
|
3535
3535
|
if (Vt !== void 0) {
|
|
3536
3536
|
if (Vt <= Ct) {
|
|
3537
|
-
console.debug("[use-chat] drop duplicate/out-of-order event", { seq: Vt, lastProcessedSeq: Ct, type:
|
|
3537
|
+
console.debug("[use-chat] drop duplicate/out-of-order event", { seq: Vt, lastProcessedSeq: Ct, type: _e.type });
|
|
3538
3538
|
continue;
|
|
3539
3539
|
}
|
|
3540
3540
|
Ct > 0 && Vt > Ct + 1 && ((P = A == null ? void 0 : A.onGap) == null || P.call(A, { from: Ct, to: Vt })), Ct = Vt, C.current = Vt, y(Vt);
|
|
3541
3541
|
}
|
|
3542
3542
|
if (console.debug("[use-chat] received event", {
|
|
3543
|
-
seq:
|
|
3544
|
-
type:
|
|
3543
|
+
seq: _e.seq,
|
|
3544
|
+
type: _e.type,
|
|
3545
3545
|
preview: (() => {
|
|
3546
3546
|
var ct;
|
|
3547
3547
|
try {
|
|
3548
|
-
return
|
|
3548
|
+
return _e.type === "message_delta" ? { deltaTypes: (ct = _e.delta) == null ? void 0 : ct.map((kt) => kt.type), textLen: (_e.delta || []).filter((kt) => kt.type === "text").map((kt) => String(kt.text || "").length) } : _e.content || _e.delta ? { hasContent: !0 } : {};
|
|
3549
3549
|
} catch (kt) {
|
|
3550
3550
|
return { err: String(kt) };
|
|
3551
3551
|
}
|
|
3552
3552
|
})()
|
|
3553
|
-
}),
|
|
3554
|
-
k.current =
|
|
3555
|
-
else if (
|
|
3556
|
-
E.current =
|
|
3553
|
+
}), _e.type === "checkpoint")
|
|
3554
|
+
k.current = _e.checkpointId ?? null, N.current = _e.checkpointNs ?? null, m(_e.checkpointId ?? null);
|
|
3555
|
+
else if (_e.type === "state_history") {
|
|
3556
|
+
E.current = _e;
|
|
3557
3557
|
try {
|
|
3558
|
-
const kt = Ur(
|
|
3558
|
+
const kt = Ur(_e).latest;
|
|
3559
3559
|
kt && (k.current = kt.checkpointId ?? null, N.current = kt.checkpointNs ?? null, m(kt.checkpointId ?? null));
|
|
3560
3560
|
} catch (ct) {
|
|
3561
3561
|
console.warn("[use-chat] Failed to hydrate state_history payload", ct);
|
|
3562
3562
|
}
|
|
3563
3563
|
}
|
|
3564
3564
|
try {
|
|
3565
|
-
$ == null || $(
|
|
3565
|
+
$ == null || $(_e);
|
|
3566
3566
|
} catch (ct) {
|
|
3567
|
-
console.error("[use-chat] Error in onEvent callback:", ct, "for event:",
|
|
3567
|
+
console.error("[use-chat] Error in onEvent callback:", ct, "for event:", _e.type);
|
|
3568
3568
|
}
|
|
3569
|
-
if (
|
|
3570
|
-
lt.push(
|
|
3571
|
-
else if (
|
|
3572
|
-
const ct =
|
|
3573
|
-
ct && e.autoAppendAssistant !== !1 && (lt.push(ct),
|
|
3574
|
-
} else if (
|
|
3569
|
+
if (_e.type === "token" && e.autoAppendAssistant !== !1)
|
|
3570
|
+
lt.push(_e.content), Qe();
|
|
3571
|
+
else if (_e.type === "message_delta") {
|
|
3572
|
+
const ct = _e.delta.filter((kt) => kt.type === "text").map((kt) => kt.text).join("");
|
|
3573
|
+
ct && e.autoAppendAssistant !== !1 && (lt.push(ct), Qe());
|
|
3574
|
+
} else if (_e.type === "heartbeat") {
|
|
3575
3575
|
console.debug("[use-chat] heartbeat received");
|
|
3576
3576
|
try {
|
|
3577
|
-
(H = A == null ? void 0 : A.onHeartbeat) == null || H.call(A,
|
|
3577
|
+
(H = A == null ? void 0 : A.onHeartbeat) == null || H.call(A, _e);
|
|
3578
3578
|
} catch (ct) {
|
|
3579
3579
|
console.warn("[use-chat] heartbeat callback failed", ct);
|
|
3580
3580
|
}
|
|
3581
|
-
} else if (ce !== null && cancelAnimationFrame(ce), re(),
|
|
3582
|
-
m(
|
|
3583
|
-
else if (
|
|
3584
|
-
const ct =
|
|
3585
|
-
if (d(ct.message), D = "error", M = ct.message, ct.error_type === "auth_error" || ct.code === "TOKEN_EXPIRED" || ((te = ct.message) == null ? void 0 : te.includes("token")) || ((se = ct.message) == null ? void 0 : se.includes("401")) || ((ne = ct.message) == null ? void 0 : ne.includes("unauthorized")) || ((
|
|
3581
|
+
} else if (ce !== null && cancelAnimationFrame(ce), re(), _e.type === "checkpoint")
|
|
3582
|
+
m(_e.checkpointId);
|
|
3583
|
+
else if (_e.type === "error") {
|
|
3584
|
+
const ct = _e;
|
|
3585
|
+
if (d(ct.message), D = "error", M = ct.message, ct.error_type === "auth_error" || ct.code === "TOKEN_EXPIRED" || ((te = ct.message) == null ? void 0 : te.includes("token")) || ((se = ct.message) == null ? void 0 : se.includes("401")) || ((ne = ct.message) == null ? void 0 : ne.includes("unauthorized")) || ((Me = ct.message) == null ? void 0 : Me.includes("Unauthorized"))) {
|
|
3586
3586
|
console.error("[use-chat] Auth error detected:", ct.message);
|
|
3587
3587
|
try {
|
|
3588
3588
|
(Y = A == null ? void 0 : A.onAuthError) == null || Y.call(A, ct.message);
|
|
@@ -3609,7 +3609,7 @@ function Kx(e = {}) {
|
|
|
3609
3609
|
} finally {
|
|
3610
3610
|
(ke = rt.releaseLock) == null || ke.call(rt);
|
|
3611
3611
|
}
|
|
3612
|
-
ce !== null && typeof window < "u" && window.cancelAnimationFrame(ce), clearInterval(
|
|
3612
|
+
ce !== null && typeof window < "u" && window.cancelAnimationFrame(ce), clearInterval(De);
|
|
3613
3613
|
}
|
|
3614
3614
|
} catch (Ue) {
|
|
3615
3615
|
if (Ue.name === "AbortError")
|
|
@@ -3879,7 +3879,7 @@ function Xx({
|
|
|
3879
3879
|
Et(() => {
|
|
3880
3880
|
W.current = m;
|
|
3881
3881
|
}, [m]);
|
|
3882
|
-
const P = Je(), { startStream: H, stop: te, isStreaming: se, error: ne, setAuthToken:
|
|
3882
|
+
const P = Je(), { startStream: H, stop: te, isStreaming: se, error: ne, setAuthToken: Me } = Yx({
|
|
3883
3883
|
baseUrl: f,
|
|
3884
3884
|
onThreadInfo: (ce) => {
|
|
3885
3885
|
if (console.log("[ChatSessionProvider] Thread info:", ce.threadId), W.current === null) {
|
|
@@ -3927,19 +3927,19 @@ function Xx({
|
|
|
3927
3927
|
async (ce, re) => {
|
|
3928
3928
|
try {
|
|
3929
3929
|
await c.updateThread(ce, re), await Y();
|
|
3930
|
-
} catch (
|
|
3931
|
-
s == null || s(String(
|
|
3930
|
+
} catch (Qe) {
|
|
3931
|
+
s == null || s(String(Qe));
|
|
3932
3932
|
}
|
|
3933
3933
|
},
|
|
3934
3934
|
[c, Y, s]
|
|
3935
3935
|
), ze = Ce(
|
|
3936
|
-
(ce, re,
|
|
3937
|
-
const
|
|
3938
|
-
checkpointId:
|
|
3939
|
-
checkpointNs:
|
|
3940
|
-
createdAt:
|
|
3936
|
+
(ce, re, Qe) => {
|
|
3937
|
+
const je = re.filter((De) => De.checkpointId).map((De) => ({
|
|
3938
|
+
checkpointId: De.checkpointId,
|
|
3939
|
+
checkpointNs: De.checkpointNs ?? void 0,
|
|
3940
|
+
createdAt: De.createdAt ?? ""
|
|
3941
3941
|
}));
|
|
3942
|
-
console.log(`[ChatSessionProvider] Cached metadata for ${
|
|
3942
|
+
console.log(`[ChatSessionProvider] Cached metadata for ${je.length} checkpoints from ${Qe}`), Ee(ce, je);
|
|
3943
3943
|
},
|
|
3944
3944
|
[Ee]
|
|
3945
3945
|
), Be = Ce(
|
|
@@ -3947,20 +3947,20 @@ function Xx({
|
|
|
3947
3947
|
if (ce) {
|
|
3948
3948
|
C(!0), k(null);
|
|
3949
3949
|
try {
|
|
3950
|
-
const
|
|
3950
|
+
const Qe = await c.getStateHistory({
|
|
3951
3951
|
threadId: ce,
|
|
3952
3952
|
checkpointId: re || void 0
|
|
3953
3953
|
// Let backend pick latest if not specified
|
|
3954
|
-
}), { checkpoints:
|
|
3955
|
-
ze(ce,
|
|
3956
|
-
const
|
|
3957
|
-
E((
|
|
3958
|
-
checkpointId: (
|
|
3959
|
-
checkpointNs: (
|
|
3960
|
-
}), Z(
|
|
3961
|
-
} catch (
|
|
3962
|
-
const
|
|
3963
|
-
k(
|
|
3954
|
+
}), { checkpoints: je } = Ur(Qe);
|
|
3955
|
+
ze(ce, je, `thread load (requested: ${re})`);
|
|
3956
|
+
const De = je.find((ut) => ut.messages && ut.messages.length > 0) ?? (re ? je.find((ut) => ut.checkpointId === re) : null) ?? je[0];
|
|
3957
|
+
E((De == null ? void 0 : De.messages) ?? [], {
|
|
3958
|
+
checkpointId: (De == null ? void 0 : De.checkpointId) ?? null,
|
|
3959
|
+
checkpointNs: (De == null ? void 0 : De.checkpointNs) ?? null
|
|
3960
|
+
}), Z(je), j(!!(De != null && De.nextCursor)), D((De == null ? void 0 : De.nextCursor) ?? null);
|
|
3961
|
+
} catch (Qe) {
|
|
3962
|
+
const je = String(Qe);
|
|
3963
|
+
k(je), s == null || s(je);
|
|
3964
3964
|
} finally {
|
|
3965
3965
|
C(!1);
|
|
3966
3966
|
}
|
|
@@ -3973,29 +3973,29 @@ function Xx({
|
|
|
3973
3973
|
}, [Be]);
|
|
3974
3974
|
const Ue = Ce(
|
|
3975
3975
|
async (ce, re) => {
|
|
3976
|
-
const
|
|
3977
|
-
if (
|
|
3976
|
+
const Qe = W.current;
|
|
3977
|
+
if (Qe) {
|
|
3978
3978
|
pe(!0);
|
|
3979
3979
|
try {
|
|
3980
|
-
const
|
|
3981
|
-
threadId:
|
|
3980
|
+
const je = await c.getStateHistory({
|
|
3981
|
+
threadId: Qe,
|
|
3982
3982
|
checkpointId: ce,
|
|
3983
3983
|
checkpointNs: re ?? void 0
|
|
3984
|
-
}), { checkpoints:
|
|
3985
|
-
ze(
|
|
3986
|
-
const ut =
|
|
3984
|
+
}), { checkpoints: De } = Ur(je);
|
|
3985
|
+
ze(Qe, De, "checkpoint navigation");
|
|
3986
|
+
const ut = De.find(
|
|
3987
3987
|
(et) => et.checkpointId === ce && (re ? et.checkpointNs === re : !0)
|
|
3988
3988
|
);
|
|
3989
3989
|
if (!ut) {
|
|
3990
3990
|
console.warn("[ChatSessionProvider] Requested checkpoint not found:", { checkpointId: ce, checkpointNs: re });
|
|
3991
3991
|
return;
|
|
3992
3992
|
}
|
|
3993
|
-
Z(
|
|
3993
|
+
Z(De), E(ut.messages ?? [], {
|
|
3994
3994
|
checkpointId: ut.checkpointId ?? null,
|
|
3995
3995
|
checkpointNs: ut.checkpointNs ?? null
|
|
3996
3996
|
});
|
|
3997
|
-
} catch (
|
|
3998
|
-
s == null || s(String(
|
|
3997
|
+
} catch (je) {
|
|
3998
|
+
s == null || s(String(je));
|
|
3999
3999
|
} finally {
|
|
4000
4000
|
pe(!1);
|
|
4001
4001
|
}
|
|
@@ -4013,34 +4013,34 @@ function Xx({
|
|
|
4013
4013
|
), qe = Ce(async () => {
|
|
4014
4014
|
W.current && await Be(W.current);
|
|
4015
4015
|
}, [Be]), Ze = Ce(async () => {
|
|
4016
|
-
if (!
|
|
4016
|
+
if (!W.current || !B) return;
|
|
4017
|
+
if (q.current) {
|
|
4018
|
+
console.log("[ChatSessionProvider] Skipping history load - thread cleanup in progress");
|
|
4019
|
+
return;
|
|
4020
|
+
}
|
|
4021
|
+
A(!0);
|
|
4022
|
+
let ce = !0;
|
|
4023
|
+
try {
|
|
4024
|
+
const re = await c.getStateHistory({
|
|
4025
|
+
threadId: W.current,
|
|
4026
|
+
checkpointId: B
|
|
4027
|
+
});
|
|
4017
4028
|
if (q.current) {
|
|
4018
|
-
console.log("[ChatSessionProvider]
|
|
4029
|
+
console.log("[ChatSessionProvider] Discarding history fetch - thread was cleared"), ce = !1;
|
|
4019
4030
|
return;
|
|
4020
4031
|
}
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
const
|
|
4024
|
-
|
|
4025
|
-
checkpointId: B
|
|
4026
|
-
});
|
|
4027
|
-
if (q.current) {
|
|
4028
|
-
console.log("[ChatSessionProvider] Discarding history fetch - thread was cleared");
|
|
4029
|
-
return;
|
|
4030
|
-
}
|
|
4031
|
-
const { checkpoints: re } = Ur(ce);
|
|
4032
|
-
if (re.length > 0) {
|
|
4033
|
-
const Le = re[re.length - 1];
|
|
4034
|
-
I((Le == null ? void 0 : Le.messages) ?? []), j(!!(Le != null && Le.nextCursor)), D((Le == null ? void 0 : Le.nextCursor) ?? null);
|
|
4035
|
-
}
|
|
4036
|
-
} catch (ce) {
|
|
4037
|
-
s == null || s(String(ce));
|
|
4038
|
-
} finally {
|
|
4039
|
-
A(!1);
|
|
4032
|
+
const { checkpoints: Qe } = Ur(re);
|
|
4033
|
+
if (Qe.length > 0) {
|
|
4034
|
+
const je = Qe[Qe.length - 1];
|
|
4035
|
+
I((je == null ? void 0 : je.messages) ?? []), j(!!(je != null && je.nextCursor)), D((je == null ? void 0 : je.nextCursor) ?? null);
|
|
4040
4036
|
}
|
|
4037
|
+
} catch (re) {
|
|
4038
|
+
q.current ? (console.log("[ChatSessionProvider] Error during history fetch, but cleanup in progress - ignoring"), ce = !1) : s == null || s(String(re));
|
|
4039
|
+
} finally {
|
|
4040
|
+
ce && A(!1);
|
|
4041
4041
|
}
|
|
4042
4042
|
}, [c, B, I, s]), Xe = Ce(async () => {
|
|
4043
|
-
q.current = !0, te(), W.current = null, ee.current = null, E([], {}), Z([]), j(!1), D(null), await Promise.resolve(), q.current = !1;
|
|
4043
|
+
q.current = !0, te(), W.current = null, ee.current = null, E([], {}), Z([]), j(!1), D(null), x(null), await Promise.resolve(), q.current = !1;
|
|
4044
4044
|
}, [E, te]), rt = Ce(
|
|
4045
4045
|
async (ce, re) => {
|
|
4046
4046
|
console.log("[ChatSessionProvider] Interrupt:", ce, re);
|
|
@@ -4057,17 +4057,17 @@ function Xx({
|
|
|
4057
4057
|
}, [m, a]);
|
|
4058
4058
|
const St = Ce(
|
|
4059
4059
|
async (ce, re) => {
|
|
4060
|
-
const
|
|
4061
|
-
if (!
|
|
4062
|
-
if (!
|
|
4060
|
+
const Qe = W.current, je = (ce == null ? void 0 : ce.text) ?? "";
|
|
4061
|
+
if (!Qe && !je) return;
|
|
4062
|
+
if (!Qe) {
|
|
4063
4063
|
await de("New Chat");
|
|
4064
4064
|
return;
|
|
4065
4065
|
}
|
|
4066
|
-
const { contentParts:
|
|
4066
|
+
const { contentParts: De } = await wx(
|
|
4067
4067
|
c,
|
|
4068
4068
|
(ce == null ? void 0 : ce.attachments) ?? []
|
|
4069
|
-
), ut = [...
|
|
4070
|
-
|
|
4069
|
+
), ut = [...De];
|
|
4070
|
+
je != null && je.trim() && ut.push({ type: "text", text: je });
|
|
4071
4071
|
const et = {
|
|
4072
4072
|
id: `msg-${Date.now()}`,
|
|
4073
4073
|
role: "user",
|
|
@@ -4076,7 +4076,7 @@ function Xx({
|
|
|
4076
4076
|
};
|
|
4077
4077
|
O(et);
|
|
4078
4078
|
const Fe = {
|
|
4079
|
-
threadId:
|
|
4079
|
+
threadId: Qe,
|
|
4080
4080
|
checkpointId: (re == null ? void 0 : re.checkpointId) ?? N.lastCheckpointId ?? void 0,
|
|
4081
4081
|
checkpointNs: (re == null ? void 0 : re.checkpointNs) ?? N.lastCheckpointNs ?? void 0
|
|
4082
4082
|
};
|
|
@@ -4148,9 +4148,9 @@ function Xx({
|
|
|
4148
4148
|
submit: St,
|
|
4149
4149
|
send: St,
|
|
4150
4150
|
stop: te,
|
|
4151
|
-
setAuthToken:
|
|
4151
|
+
setAuthToken: Me
|
|
4152
4152
|
}),
|
|
4153
|
-
[se, ne, St, te,
|
|
4153
|
+
[se, ne, St, te, Me]
|
|
4154
4154
|
);
|
|
4155
4155
|
return /* @__PURE__ */ u.jsx(Au.Provider, { value: mt, children: /* @__PURE__ */ u.jsx(ju.Provider, { value: lt, children: /* @__PURE__ */ u.jsx(_u.Provider, { value: Ct, children: e }) }) });
|
|
4156
4156
|
}
|
|
@@ -6247,7 +6247,7 @@ var Na = "PopperContent", [Fv, $v] = Ju(Na), nd = v.forwardRef(
|
|
|
6247
6247
|
updatePositionStrategy: h = "optimized",
|
|
6248
6248
|
onPlaced: m,
|
|
6249
6249
|
...x
|
|
6250
|
-
} = e, y = Zu(Na, n), [g, w] = v.useState(null), b = Ve(t, (
|
|
6250
|
+
} = e, y = Zu(Na, n), [g, w] = v.useState(null), b = Ve(t, (Me) => w(Me)), [T, C] = v.useState(null), S = Xu(T), k = (S == null ? void 0 : S.width) ?? 0, N = (S == null ? void 0 : S.height) ?? 0, E = r + (s !== "center" ? "-" + s : ""), I = typeof d == "number" ? d : { top: 0, right: 0, bottom: 0, left: 0, ...d }, O = Array.isArray(c) ? c : [c], L = O.length > 0, F = {
|
|
6251
6251
|
padding: I,
|
|
6252
6252
|
boundary: O.filter(Bv),
|
|
6253
6253
|
// with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
|
|
@@ -6256,7 +6256,7 @@ var Na = "PopperContent", [Fv, $v] = Ju(Na), nd = v.forwardRef(
|
|
|
6256
6256
|
// default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
|
|
6257
6257
|
strategy: "fixed",
|
|
6258
6258
|
placement: E,
|
|
6259
|
-
whileElementsMounted: (...
|
|
6259
|
+
whileElementsMounted: (...Me) => gv(...Me, {
|
|
6260
6260
|
animationFrame: h === "always"
|
|
6261
6261
|
}),
|
|
6262
6262
|
elements: {
|
|
@@ -6273,8 +6273,8 @@ var Na = "PopperContent", [Fv, $v] = Ju(Na), nd = v.forwardRef(
|
|
|
6273
6273
|
l && jv({ ...F }),
|
|
6274
6274
|
_v({
|
|
6275
6275
|
...F,
|
|
6276
|
-
apply: ({ elements:
|
|
6277
|
-
const { width: Ne, height: ze } = Y.reference, Be =
|
|
6276
|
+
apply: ({ elements: Me, rects: Y, availableWidth: de, availableHeight: ke }) => {
|
|
6277
|
+
const { width: Ne, height: ze } = Y.reference, Be = Me.floating.style;
|
|
6278
6278
|
Be.setProperty("--radix-popper-available-width", `${de}px`), Be.setProperty("--radix-popper-available-height", `${ke}px`), Be.setProperty("--radix-popper-anchor-width", `${Ne}px`), Be.setProperty("--radix-popper-anchor-height", `${ze}px`);
|
|
6279
6279
|
}
|
|
6280
6280
|
}),
|
|
@@ -8104,7 +8104,7 @@ function yt(...e) {
|
|
|
8104
8104
|
function st(e, t) {
|
|
8105
8105
|
return e(Kn, t);
|
|
8106
8106
|
}
|
|
8107
|
-
function
|
|
8107
|
+
function Oe(e, t) {
|
|
8108
8108
|
e(zs, t);
|
|
8109
8109
|
}
|
|
8110
8110
|
function $a(e) {
|
|
@@ -8182,7 +8182,7 @@ function An(e) {
|
|
|
8182
8182
|
}, e));
|
|
8183
8183
|
};
|
|
8184
8184
|
}
|
|
8185
|
-
function
|
|
8185
|
+
function Le(...e) {
|
|
8186
8186
|
const t = new Array(e.length);
|
|
8187
8187
|
let n = 0, r = null;
|
|
8188
8188
|
const o = Math.pow(2, e.length) - 1;
|
|
@@ -8284,7 +8284,7 @@ function At(...e) {
|
|
|
8284
8284
|
return e.forEach((s, i) => {
|
|
8285
8285
|
const a = Math.pow(2, i);
|
|
8286
8286
|
st(s, (l) => {
|
|
8287
|
-
n[i] = l, r = r | a, r === o &&
|
|
8287
|
+
n[i] = l, r = r | a, r === o && Oe(t, n);
|
|
8288
8288
|
});
|
|
8289
8289
|
}), function(s, i) {
|
|
8290
8290
|
switch (s) {
|
|
@@ -8795,7 +8795,7 @@ const P0 = {
|
|
|
8795
8795
|
}, En = tt(
|
|
8796
8796
|
([{ log: e }, { recalcInProgress: t }]) => {
|
|
8797
8797
|
const n = We(), r = We(), o = Ht(r, 0), s = We(), i = We(), a = X(0), l = X([]), c = X(void 0), d = X(void 0), f = X((C, S) => Un(C, P0[S])), p = X(void 0), h = X(0), m = T0(), x = Ht(
|
|
8798
|
-
U(n,
|
|
8798
|
+
U(n, Le(l, e, h), Cn(N0, m), xt()),
|
|
8799
8799
|
m
|
|
8800
8800
|
), y = Ht(
|
|
8801
8801
|
U(
|
|
@@ -8813,7 +8813,7 @@ const P0 = {
|
|
|
8813
8813
|
U(
|
|
8814
8814
|
l,
|
|
8815
8815
|
Te((C) => C.length > 0),
|
|
8816
|
-
|
|
8816
|
+
Le(x, h),
|
|
8817
8817
|
le(([C, S, k]) => {
|
|
8818
8818
|
const N = C.reduce((E, I, O) => Zt(E, I, so(I, S.offsetTree, k) || O), Sr());
|
|
8819
8819
|
return {
|
|
@@ -8827,7 +8827,7 @@ const P0 = {
|
|
|
8827
8827
|
), he(
|
|
8828
8828
|
U(
|
|
8829
8829
|
r,
|
|
8830
|
-
|
|
8830
|
+
Le(x),
|
|
8831
8831
|
Te(([C, { lastIndex: S }]) => C < S),
|
|
8832
8832
|
le(([C, { lastIndex: S, lastSize: k }]) => [
|
|
8833
8833
|
{
|
|
@@ -8857,7 +8857,7 @@ const P0 = {
|
|
|
8857
8857
|
const w = en(
|
|
8858
8858
|
U(
|
|
8859
8859
|
n,
|
|
8860
|
-
|
|
8860
|
+
Le(x),
|
|
8861
8861
|
Cn(
|
|
8862
8862
|
({ sizes: C }, [S, k]) => ({
|
|
8863
8863
|
changed: k !== C,
|
|
@@ -8880,13 +8880,13 @@ const P0 = {
|
|
|
8880
8880
|
(C) => {
|
|
8881
8881
|
const { groupIndices: S } = Rt(x);
|
|
8882
8882
|
if (C > 0)
|
|
8883
|
-
|
|
8883
|
+
Oe(t, !0), Oe(s, C + yc(C, S));
|
|
8884
8884
|
else if (C < 0) {
|
|
8885
8885
|
const k = Rt(y);
|
|
8886
|
-
k.length > 0 && (C -= yc(-C, k)),
|
|
8886
|
+
k.length > 0 && (C -= yc(-C, k)), Oe(i, C);
|
|
8887
8887
|
}
|
|
8888
8888
|
}
|
|
8889
|
-
), st(U(a,
|
|
8889
|
+
), st(U(a, Le(e)), ([C, S]) => {
|
|
8890
8890
|
C < 0 && S(
|
|
8891
8891
|
"`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",
|
|
8892
8892
|
{ firstItemIndex: a },
|
|
@@ -8897,7 +8897,7 @@ const P0 = {
|
|
|
8897
8897
|
he(
|
|
8898
8898
|
U(
|
|
8899
8899
|
s,
|
|
8900
|
-
|
|
8900
|
+
Le(x),
|
|
8901
8901
|
le(([C, S]) => {
|
|
8902
8902
|
const k = S.groupIndices.length > 0, N = [], E = S.lastSize;
|
|
8903
8903
|
if (k) {
|
|
@@ -8958,7 +8958,7 @@ const P0 = {
|
|
|
8958
8958
|
const T = en(
|
|
8959
8959
|
U(
|
|
8960
8960
|
i,
|
|
8961
|
-
|
|
8961
|
+
Le(x, h),
|
|
8962
8962
|
le(([C, { offsetTree: S }, k]) => {
|
|
8963
8963
|
const N = -C;
|
|
8964
8964
|
return so(N, S, k);
|
|
@@ -8968,7 +8968,7 @@ const P0 = {
|
|
|
8968
8968
|
return he(
|
|
8969
8969
|
U(
|
|
8970
8970
|
i,
|
|
8971
|
-
|
|
8971
|
+
Le(x, h),
|
|
8972
8972
|
le(([C, S, k]) => {
|
|
8973
8973
|
if (S.groupIndices.length > 0) {
|
|
8974
8974
|
if (ft(S.sizeTree))
|
|
@@ -9102,13 +9102,13 @@ const vo = tt(
|
|
|
9102
9102
|
const h = We(), m = We(), x = X(0);
|
|
9103
9103
|
let y = null, g = null, w = null;
|
|
9104
9104
|
function b() {
|
|
9105
|
-
y && (y(), y = null), w && (w(), w = null), g && (clearTimeout(g), g = null),
|
|
9105
|
+
y && (y(), y = null), w && (w(), w = null), g && (clearTimeout(g), g = null), Oe(l, !1);
|
|
9106
9106
|
}
|
|
9107
9107
|
return he(
|
|
9108
9108
|
U(
|
|
9109
9109
|
h,
|
|
9110
|
-
|
|
9111
|
-
|
|
9110
|
+
Le(n, f, r, x, a, i, p),
|
|
9111
|
+
Le(e, s, o),
|
|
9112
9112
|
le(
|
|
9113
9113
|
([
|
|
9114
9114
|
[T, C, S, k, N, E, I, O],
|
|
@@ -9120,7 +9120,7 @@ const vo = tt(
|
|
|
9120
9120
|
let J = so(Z, C.offsetTree, L) + E;
|
|
9121
9121
|
A === "end" ? (J += F + gn(C.sizeTree, Z)[1] - S + j, Z === M && (J += I)) : A === "center" ? J += (F + gn(C.sizeTree, Z)[1] - S + j) / 2 : J -= N, D && (J += D);
|
|
9122
9122
|
const pe = (Re) => {
|
|
9123
|
-
b(), Re ? (O("retrying to scroll to", { location: T }, Xt.DEBUG),
|
|
9123
|
+
b(), Re ? (O("retrying to scroll to", { location: T }, Xt.DEBUG), Oe(h, T)) : (Oe(m, !0), O("list did not change, scroll successful", {}, Xt.DEBUG));
|
|
9124
9124
|
};
|
|
9125
9125
|
if (b(), B === "smooth") {
|
|
9126
9126
|
let Re = !1;
|
|
@@ -9133,7 +9133,7 @@ const vo = tt(
|
|
|
9133
9133
|
y = pn(U(t, D0(150)), pe);
|
|
9134
9134
|
return g = setTimeout(() => {
|
|
9135
9135
|
b();
|
|
9136
|
-
}, 1200),
|
|
9136
|
+
}, 1200), Oe(l, !0), O("scrolling from index to", { behavior: B, index: Z, top: J }, Xt.DEBUG), { behavior: B, top: J };
|
|
9137
9137
|
}
|
|
9138
9138
|
)
|
|
9139
9139
|
),
|
|
@@ -9172,7 +9172,7 @@ const wo = tt(
|
|
|
9172
9172
|
return he(
|
|
9173
9173
|
U(
|
|
9174
9174
|
i,
|
|
9175
|
-
|
|
9175
|
+
Le(l),
|
|
9176
9176
|
Te(([d, f]) => !!f),
|
|
9177
9177
|
wn(!1)
|
|
9178
9178
|
),
|
|
@@ -9180,7 +9180,7 @@ const wo = tt(
|
|
|
9180
9180
|
), he(
|
|
9181
9181
|
U(
|
|
9182
9182
|
i,
|
|
9183
|
-
|
|
9183
|
+
Le(l),
|
|
9184
9184
|
Te(([d, f]) => !!f),
|
|
9185
9185
|
wn(!1)
|
|
9186
9186
|
),
|
|
@@ -9188,17 +9188,17 @@ const wo = tt(
|
|
|
9188
9188
|
), st(
|
|
9189
9189
|
U(
|
|
9190
9190
|
At(t, i),
|
|
9191
|
-
|
|
9191
|
+
Le(a, n, e, c),
|
|
9192
9192
|
Te(([[, d], f, { sizeTree: p }, h, m]) => d && (!ft(p) || Fa(h)) && !f && !m),
|
|
9193
|
-
|
|
9193
|
+
Le(l)
|
|
9194
9194
|
),
|
|
9195
9195
|
([, d]) => {
|
|
9196
9196
|
pn(o, () => {
|
|
9197
|
-
|
|
9197
|
+
Oe(c, !0);
|
|
9198
9198
|
}), Ua(4, () => {
|
|
9199
9199
|
pn(r, () => {
|
|
9200
|
-
|
|
9201
|
-
}),
|
|
9200
|
+
Oe(a, !0);
|
|
9201
|
+
}), Oe(s, d);
|
|
9202
9202
|
});
|
|
9203
9203
|
}
|
|
9204
9204
|
), {
|
|
@@ -9335,7 +9335,7 @@ const io = "up", Vr = "down", L0 = "none", F0 = {
|
|
|
9335
9335
|
U(
|
|
9336
9336
|
o,
|
|
9337
9337
|
An(100),
|
|
9338
|
-
|
|
9338
|
+
Le(p),
|
|
9339
9339
|
Te(([w, b]) => !!b),
|
|
9340
9340
|
Cn(([w, b], [T]) => [b, T], [0, 0]),
|
|
9341
9341
|
le(([w, b]) => b - w)
|
|
@@ -9630,7 +9630,7 @@ const hr = tt(
|
|
|
9630
9630
|
U(
|
|
9631
9631
|
w,
|
|
9632
9632
|
Te(({ items: S }) => S.length > 0),
|
|
9633
|
-
|
|
9633
|
+
Le(o, e),
|
|
9634
9634
|
Te(([{ items: S }, k]) => S[S.length - 1].originalIndex === k - 1),
|
|
9635
9635
|
le(([, S, k]) => [S - 1, k]),
|
|
9636
9636
|
xt(oo),
|
|
@@ -9722,8 +9722,8 @@ const hr = tt(
|
|
|
9722
9722
|
return he(
|
|
9723
9723
|
U(
|
|
9724
9724
|
d,
|
|
9725
|
-
|
|
9726
|
-
|
|
9725
|
+
Le(t, l, n, s, o, r, a),
|
|
9726
|
+
Le(e),
|
|
9727
9727
|
le(([[f, p, h, m, x, y, g, w], b]) => {
|
|
9728
9728
|
const { align: T, behavior: C, calculateViewLocation: S = H0, done: k, ...N } = f, E = jf(f, p, m - 1), I = so(E, p.offsetTree, b) + x + y, O = I + gn(p.sizeTree, E)[1], L = w + y, F = w + h - g, j = S({
|
|
9729
9729
|
itemBottom: O,
|
|
@@ -9771,7 +9771,7 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = tt(
|
|
|
9771
9771
|
const m = X(!1), x = We();
|
|
9772
9772
|
let y = null;
|
|
9773
9773
|
function g(C) {
|
|
9774
|
-
|
|
9774
|
+
Oe(i, {
|
|
9775
9775
|
align: "end",
|
|
9776
9776
|
behavior: C,
|
|
9777
9777
|
index: "LAST"
|
|
@@ -9780,7 +9780,7 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = tt(
|
|
|
9780
9780
|
st(
|
|
9781
9781
|
U(
|
|
9782
9782
|
At(U(Se(t), ar(1)), l),
|
|
9783
|
-
|
|
9783
|
+
Le(Se(m), s, a, f),
|
|
9784
9784
|
le(([[C, S], k, N, E, I]) => {
|
|
9785
9785
|
let O = S && E, L = "auto";
|
|
9786
9786
|
return O && (L = U0(k, N || I), O = O && !!L), { followOutputBehavior: L, shouldFollow: O, totalCount: C };
|
|
@@ -9810,7 +9810,7 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = tt(
|
|
|
9810
9810
|
{ refreshed: !1, value: 0 }
|
|
9811
9811
|
),
|
|
9812
9812
|
Te(({ refreshed: C }) => C),
|
|
9813
|
-
|
|
9813
|
+
Le(m, t)
|
|
9814
9814
|
),
|
|
9815
9815
|
([, C]) => {
|
|
9816
9816
|
Rt(a) && w(C !== !1);
|
|
@@ -9836,16 +9836,16 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = tt(
|
|
|
9836
9836
|
), st(
|
|
9837
9837
|
U(
|
|
9838
9838
|
At(U(T, ar(1)), l),
|
|
9839
|
-
|
|
9839
|
+
Le(Se(b), a, f, p),
|
|
9840
9840
|
le(([[C, S], k, N, E, I]) => S && N && (k == null ? void 0 : k({ context: I, totalCount: C, scrollingInProgress: E }))),
|
|
9841
9841
|
Te((C) => !!C),
|
|
9842
9842
|
An(0)
|
|
9843
9843
|
),
|
|
9844
9844
|
(C) => {
|
|
9845
9845
|
y && (y(), y = null), Rt(n) ? requestAnimationFrame(() => {
|
|
9846
|
-
Rt(d)("scrolling into view", {}),
|
|
9846
|
+
Rt(d)("scrolling into view", {}), Oe(h, C);
|
|
9847
9847
|
}) : y = pn(e, () => {
|
|
9848
|
-
Rt(d)("scrolling into view", {}),
|
|
9848
|
+
Rt(d)("scrolling into view", {}), Oe(h, C), y = null;
|
|
9849
9849
|
});
|
|
9850
9850
|
}
|
|
9851
9851
|
), { autoscrollToBottom: x, followOutput: m, scrollIntoViewOnChange: b };
|
|
@@ -9865,9 +9865,9 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = tt(
|
|
|
9865
9865
|
([{ data: e, firstItemIndex: t, gap: n, sizes: r }, { initialTopMostItemIndex: o }, { initialItemCount: s, listState: i }, { didMount: a }]) => (he(
|
|
9866
9866
|
U(
|
|
9867
9867
|
a,
|
|
9868
|
-
|
|
9868
|
+
Le(s),
|
|
9869
9869
|
Te(([, l]) => l !== 0),
|
|
9870
|
-
|
|
9870
|
+
Le(o, r, t, n, e),
|
|
9871
9871
|
le(([[, l], c, d, f, p, h = []]) => Mf(l, c, d, f, p, h))
|
|
9872
9872
|
),
|
|
9873
9873
|
i
|
|
@@ -9880,7 +9880,7 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = tt(
|
|
|
9880
9880
|
return st(
|
|
9881
9881
|
U(
|
|
9882
9882
|
e,
|
|
9883
|
-
|
|
9883
|
+
Le(r),
|
|
9884
9884
|
Te(([, o]) => o !== 0),
|
|
9885
9885
|
le(([, o]) => ({ top: o }))
|
|
9886
9886
|
),
|
|
@@ -9893,7 +9893,7 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = tt(
|
|
|
9893
9893
|
),
|
|
9894
9894
|
() => {
|
|
9895
9895
|
requestAnimationFrame(() => {
|
|
9896
|
-
|
|
9896
|
+
Oe(t, o);
|
|
9897
9897
|
});
|
|
9898
9898
|
}
|
|
9899
9899
|
);
|
|
@@ -9910,7 +9910,7 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = tt(
|
|
|
9910
9910
|
return he(
|
|
9911
9911
|
U(
|
|
9912
9912
|
e,
|
|
9913
|
-
|
|
9913
|
+
Le(r, t, n),
|
|
9914
9914
|
Te(([o, s]) => !!s),
|
|
9915
9915
|
le(([o, s, i, a]) => {
|
|
9916
9916
|
const { enter: l, exit: c } = s;
|
|
@@ -9925,7 +9925,7 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = tt(
|
|
|
9925
9925
|
),
|
|
9926
9926
|
t
|
|
9927
9927
|
), st(
|
|
9928
|
-
U(At(t, e, n),
|
|
9928
|
+
U(At(t, e, n), Le(r)),
|
|
9929
9929
|
([[o, s, i], a]) => {
|
|
9930
9930
|
o && a && a.change && a.change(s, i);
|
|
9931
9931
|
}
|
|
@@ -9948,7 +9948,7 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = tt(
|
|
|
9948
9948
|
), he(
|
|
9949
9949
|
U(
|
|
9950
9950
|
t,
|
|
9951
|
-
|
|
9951
|
+
Le(r),
|
|
9952
9952
|
le(([a, { offsetTop: l }]) => ({
|
|
9953
9953
|
...a,
|
|
9954
9954
|
top: a.top + l
|
|
@@ -9977,7 +9977,7 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = tt(
|
|
|
9977
9977
|
return he(a, f), he(l, p), st(
|
|
9978
9978
|
U(
|
|
9979
9979
|
c,
|
|
9980
|
-
|
|
9980
|
+
Le(t, r, i, f, p, n)
|
|
9981
9981
|
),
|
|
9982
9982
|
([h, m, x, y, g, w, b]) => {
|
|
9983
9983
|
const T = A0(m.sizeTree);
|
|
@@ -9986,7 +9986,7 @@ const U0 = (e, t) => typeof e == "function" ? Cc(e(t)) : t && Cc(e), W0 = tt(
|
|
|
9986
9986
|
), he(U(d, Te(Fa), le(G0)), o), he(
|
|
9987
9987
|
U(
|
|
9988
9988
|
s,
|
|
9989
|
-
|
|
9989
|
+
Le(d),
|
|
9990
9990
|
Te(([, h]) => h !== void 0),
|
|
9991
9991
|
xt(),
|
|
9992
9992
|
le(([, h]) => h.ranges)
|
|
@@ -10029,7 +10029,7 @@ const X0 = zf(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
|
|
|
10029
10029
|
const x = en(
|
|
10030
10030
|
U(
|
|
10031
10031
|
l,
|
|
10032
|
-
|
|
10032
|
+
Le(i),
|
|
10033
10033
|
Cn(
|
|
10034
10034
|
([, g, w, b], [{ bottom: T, items: C, offsetBottom: S, totalCount: k }, N]) => {
|
|
10035
10035
|
const E = T + S;
|
|
@@ -10039,16 +10039,16 @@ const X0 = zf(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
|
|
|
10039
10039
|
[0, [], 0, 0]
|
|
10040
10040
|
),
|
|
10041
10041
|
Te(([g]) => g !== 0),
|
|
10042
|
-
|
|
10042
|
+
Le(r, a, n, o, h, m),
|
|
10043
10043
|
Te(([, g, w, b, , , T]) => !T && !b && g !== 0 && w === io),
|
|
10044
10044
|
le(([[g], , , , , w]) => (w("Upward scrolling compensation", { amount: g }, Xt.DEBUG), g))
|
|
10045
10045
|
)
|
|
10046
10046
|
);
|
|
10047
10047
|
function y(g) {
|
|
10048
|
-
g > 0 ? (
|
|
10048
|
+
g > 0 ? (Oe(t, { behavior: "auto", top: -g }), Oe(e, 0)) : (Oe(e, 0), Oe(t, { behavior: "auto", top: -g }));
|
|
10049
10049
|
}
|
|
10050
|
-
return st(U(x,
|
|
10051
|
-
b && X0() ?
|
|
10050
|
+
return st(U(x, Le(e, s)), ([g, w, b]) => {
|
|
10051
|
+
b && X0() ? Oe(e, w - g) : y(-g);
|
|
10052
10052
|
}), st(
|
|
10053
10053
|
U(
|
|
10054
10054
|
At(Ht(s, !1), e, m),
|
|
@@ -10066,7 +10066,7 @@ const X0 = zf(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
|
|
|
10066
10066
|
), st(
|
|
10067
10067
|
U(
|
|
10068
10068
|
c,
|
|
10069
|
-
|
|
10069
|
+
Le(p, d),
|
|
10070
10070
|
le(([g, { groupIndices: w, lastSize: b, sizeTree: T }, C]) => {
|
|
10071
10071
|
function S(k) {
|
|
10072
10072
|
return k * (b + C);
|
|
@@ -10087,9 +10087,9 @@ const X0 = zf(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
|
|
|
10087
10087
|
})
|
|
10088
10088
|
),
|
|
10089
10089
|
(g) => {
|
|
10090
|
-
|
|
10091
|
-
|
|
10092
|
-
|
|
10090
|
+
Oe(e, g), requestAnimationFrame(() => {
|
|
10091
|
+
Oe(t, { top: g }), requestAnimationFrame(() => {
|
|
10092
|
+
Oe(e, 0), Oe(m, !1);
|
|
10093
10093
|
});
|
|
10094
10094
|
});
|
|
10095
10095
|
}
|
|
@@ -10226,22 +10226,22 @@ const _o = typeof document < "u" ? z.useLayoutEffect : z.useEffect;
|
|
|
10226
10226
|
function Hf(e, t, n) {
|
|
10227
10227
|
const r = Object.keys(t.required || {}), o = Object.keys(t.optional || {}), s = Object.keys(t.methods || {}), i = Object.keys(t.events || {}), a = z.createContext({});
|
|
10228
10228
|
function l(y, g) {
|
|
10229
|
-
y.propsReady &&
|
|
10229
|
+
y.propsReady && Oe(y.propsReady, !1);
|
|
10230
10230
|
for (const w of r) {
|
|
10231
10231
|
const b = y[t.required[w]];
|
|
10232
|
-
|
|
10232
|
+
Oe(b, g[w]);
|
|
10233
10233
|
}
|
|
10234
10234
|
for (const w of o)
|
|
10235
10235
|
if (w in g) {
|
|
10236
10236
|
const b = y[t.optional[w]];
|
|
10237
|
-
|
|
10237
|
+
Oe(b, g[w]);
|
|
10238
10238
|
}
|
|
10239
|
-
y.propsReady &&
|
|
10239
|
+
y.propsReady && Oe(y.propsReady, !0);
|
|
10240
10240
|
}
|
|
10241
10241
|
function c(y) {
|
|
10242
10242
|
return s.reduce((g, w) => (g[w] = (b) => {
|
|
10243
10243
|
const T = y[t.methods[w]];
|
|
10244
|
-
|
|
10244
|
+
Oe(T, b);
|
|
10245
10245
|
}, g), {});
|
|
10246
10246
|
}
|
|
10247
10247
|
function d(y) {
|
|
@@ -10266,7 +10266,7 @@ function Hf(e, t, n) {
|
|
|
10266
10266
|
const g = z.useContext(a);
|
|
10267
10267
|
return z.useCallback(
|
|
10268
10268
|
(w) => {
|
|
10269
|
-
|
|
10269
|
+
Oe(g[y], w);
|
|
10270
10270
|
},
|
|
10271
10271
|
[g, y]
|
|
10272
10272
|
);
|
|
@@ -10757,11 +10757,11 @@ const TS = /* @__PURE__ */ tt(
|
|
|
10757
10757
|
st(
|
|
10758
10758
|
U(
|
|
10759
10759
|
m,
|
|
10760
|
-
|
|
10760
|
+
Le(M),
|
|
10761
10761
|
Te(([P, H]) => !!H)
|
|
10762
10762
|
),
|
|
10763
10763
|
() => {
|
|
10764
|
-
|
|
10764
|
+
Oe(Z, !1);
|
|
10765
10765
|
}
|
|
10766
10766
|
), st(
|
|
10767
10767
|
U(
|
|
@@ -10769,10 +10769,10 @@ const TS = /* @__PURE__ */ tt(
|
|
|
10769
10769
|
Te(([P, H, te, se, , ne]) => P && !H && te.height !== 0 && se.height !== 0 && !ne)
|
|
10770
10770
|
),
|
|
10771
10771
|
([, , , , P]) => {
|
|
10772
|
-
|
|
10773
|
-
|
|
10772
|
+
Oe(J, !0), Ua(1, () => {
|
|
10773
|
+
Oe(O, P);
|
|
10774
10774
|
}), pn(U(c), () => {
|
|
10775
|
-
|
|
10775
|
+
Oe(t, [0, 0]), Oe(Z, !0);
|
|
10776
10776
|
});
|
|
10777
10777
|
}
|
|
10778
10778
|
), he(
|
|
@@ -10785,13 +10785,13 @@ const TS = /* @__PURE__ */ tt(
|
|
|
10785
10785
|
), st(
|
|
10786
10786
|
U(
|
|
10787
10787
|
m,
|
|
10788
|
-
|
|
10788
|
+
Le(B),
|
|
10789
10789
|
Te(([, P]) => P != null)
|
|
10790
10790
|
),
|
|
10791
10791
|
([, P]) => {
|
|
10792
|
-
P && (
|
|
10793
|
-
|
|
10794
|
-
}),
|
|
10792
|
+
P && (Oe(E, P.viewport), Oe(I, P.item), Oe($, P.gap), P.scrollTop > 0 && (Oe(D, !0), pn(U(c, ar(1)), (H) => {
|
|
10793
|
+
Oe(D, !1);
|
|
10794
|
+
}), Oe(l, { top: P.scrollTop })));
|
|
10795
10795
|
}
|
|
10796
10796
|
), he(
|
|
10797
10797
|
U(
|
|
@@ -10836,24 +10836,24 @@ const TS = /* @__PURE__ */ tt(
|
|
|
10836
10836
|
[H, te],
|
|
10837
10837
|
se,
|
|
10838
10838
|
ne,
|
|
10839
|
-
|
|
10839
|
+
Me,
|
|
10840
10840
|
Y,
|
|
10841
10841
|
de,
|
|
10842
10842
|
,
|
|
10843
10843
|
ke,
|
|
10844
10844
|
Ne
|
|
10845
10845
|
]) => {
|
|
10846
|
-
const { column: ze, row: Be } = se, { height: Ue, width: Ke } = ne, { width: qe } =
|
|
10846
|
+
const { column: ze, row: Be } = se, { height: Ue, width: Ke } = ne, { width: qe } = Me;
|
|
10847
10847
|
if (de === 0 && (P === 0 || qe === 0))
|
|
10848
10848
|
return Rc;
|
|
10849
10849
|
if (Ke === 0) {
|
|
10850
|
-
const re = Wa(Ne, P),
|
|
10851
|
-
return SS(Nc(re,
|
|
10850
|
+
const re = Wa(Ne, P), Qe = re + Math.max(de - 1, 0);
|
|
10851
|
+
return SS(Nc(re, Qe, Y));
|
|
10852
10852
|
}
|
|
10853
10853
|
const Ze = Xf(qe, Ke, ze);
|
|
10854
10854
|
let Xe, rt;
|
|
10855
10855
|
ke ? H === 0 && te === 0 && de > 0 ? (Xe = 0, rt = de - 1) : (Xe = Ze * as((H + Be) / (Ue + Be)), rt = Ze * Ec((te + Be) / (Ue + Be)) - 1, rt = Ei(P - 1, Kr(rt, Ze - 1)), Xe = Ei(rt, Kr(0, Xe))) : (Xe = 0, rt = -1);
|
|
10856
|
-
const St = Nc(Xe, rt, Y), { bottom: mt, top: lt } = Ac(
|
|
10856
|
+
const St = Nc(Xe, rt, Y), { bottom: mt, top: lt } = Ac(Me, se, ne, St), Ct = Ec(P / Ze), ce = Ct * Ue + (Ct - 1) * Be - mt;
|
|
10857
10857
|
return { bottom: mt, itemHeight: Ue, items: St, itemWidth: Ke, offsetBottom: ce, offsetTop: lt, top: lt };
|
|
10858
10858
|
}
|
|
10859
10859
|
)
|
|
@@ -10871,8 +10871,8 @@ const TS = /* @__PURE__ */ tt(
|
|
|
10871
10871
|
At(E, I, N, $),
|
|
10872
10872
|
Te(([P, H, { items: te }]) => te.length > 0 && H.height !== 0 && P.height !== 0),
|
|
10873
10873
|
le(([P, H, { items: te }, se]) => {
|
|
10874
|
-
const { bottom: ne, top:
|
|
10875
|
-
return [
|
|
10874
|
+
const { bottom: ne, top: Me } = Ac(P, se, H, te);
|
|
10875
|
+
return [Me, ne];
|
|
10876
10876
|
}),
|
|
10877
10877
|
xt(oo)
|
|
10878
10878
|
),
|
|
@@ -10882,7 +10882,7 @@ const TS = /* @__PURE__ */ tt(
|
|
|
10882
10882
|
he(
|
|
10883
10883
|
U(
|
|
10884
10884
|
c,
|
|
10885
|
-
|
|
10885
|
+
Le(Re),
|
|
10886
10886
|
le(([P, H]) => H || P !== 0)
|
|
10887
10887
|
),
|
|
10888
10888
|
Re
|
|
@@ -10891,7 +10891,7 @@ const TS = /* @__PURE__ */ tt(
|
|
|
10891
10891
|
U(
|
|
10892
10892
|
At(N, S),
|
|
10893
10893
|
Te(([{ items: P }]) => P.length > 0),
|
|
10894
|
-
|
|
10894
|
+
Le(Re),
|
|
10895
10895
|
Te(([[P, H], te]) => {
|
|
10896
10896
|
const se = P.items[P.items.length - 1].index === H - 1;
|
|
10897
10897
|
return (te || P.bottom > 0 && P.itemHeight > 0 && P.offsetBottom === 0 && P.items.length === H) && se;
|
|
@@ -10909,7 +10909,7 @@ const TS = /* @__PURE__ */ tt(
|
|
|
10909
10909
|
), ee = en(
|
|
10910
10910
|
U(
|
|
10911
10911
|
Se(N),
|
|
10912
|
-
|
|
10912
|
+
Le(D),
|
|
10913
10913
|
Te(([{ items: P }, H]) => P.length > 0 && !H),
|
|
10914
10914
|
le(([{ items: P }]) => ({
|
|
10915
10915
|
endIndex: P[P.length - 1].index,
|
|
@@ -10922,10 +10922,10 @@ const TS = /* @__PURE__ */ tt(
|
|
|
10922
10922
|
he(ee, h.scrollSeekRangeChanged), he(
|
|
10923
10923
|
U(
|
|
10924
10924
|
O,
|
|
10925
|
-
|
|
10925
|
+
Le(E, I, S, $),
|
|
10926
10926
|
le(([P, H, te, se, ne]) => {
|
|
10927
|
-
const
|
|
10928
|
-
let Ne =
|
|
10927
|
+
const Me = Pf(P), { align: Y, behavior: de, offset: ke } = Me;
|
|
10928
|
+
let Ne = Me.index;
|
|
10929
10929
|
Ne === "LAST" && (Ne = se - 1), Ne = Kr(0, Ne, Ei(se - 1, Ne));
|
|
10930
10930
|
let ze = ea(H, ne, te, Ne);
|
|
10931
10931
|
return Y === "end" ? ze = Ic(ze - H.height + te.height) : Y === "center" && (ze = Ic(ze - H.height / 2 + te.height / 2)), ke && (ze += ke), { behavior: de, top: ze };
|
|
@@ -13621,7 +13621,7 @@ const Bc = z.memo(function({
|
|
|
13621
13621
|
}, [M]), te = at(() => J ? "" : CC(t.content), [J, t]), se = at(() => J ? {} : Pp(t), [J, t]), ne = at(
|
|
13622
13622
|
() => J ? [] : t.content.filter((V) => V.type === "image_url"),
|
|
13623
13623
|
[J, t]
|
|
13624
|
-
),
|
|
13624
|
+
), Me = at(
|
|
13625
13625
|
() => J ? [] : t.content.filter((V) => V.type === "file"),
|
|
13626
13626
|
[J, t]
|
|
13627
13627
|
), Y = at(
|
|
@@ -13821,11 +13821,11 @@ const Bc = z.memo(function({
|
|
|
13821
13821
|
if (V.type === "interrupt") {
|
|
13822
13822
|
const xe = V, ht = Mo(
|
|
13823
13823
|
(xe == null ? void 0 : xe.id) ?? (xe == null ? void 0 : xe.interrupt_id)
|
|
13824
|
-
), gt = !!(ke && ht && ht === ke), Tt = gt ? Ne ?? (xe == null ? void 0 : xe.value) : xe == null ? void 0 : xe.value,
|
|
13824
|
+
), gt = !!(ke && ht && ht === ke), Tt = gt ? Ne ?? (xe == null ? void 0 : xe.value) : xe == null ? void 0 : xe.value, _e = ht ? { ...xe, id: ht, interrupt_id: ht } : xe;
|
|
13825
13825
|
return /* @__PURE__ */ u.jsx(
|
|
13826
13826
|
EC,
|
|
13827
13827
|
{
|
|
13828
|
-
interruptPart:
|
|
13828
|
+
interruptPart: _e,
|
|
13829
13829
|
onApprove: rt,
|
|
13830
13830
|
onReject: St,
|
|
13831
13831
|
disabled: w,
|
|
@@ -13855,8 +13855,8 @@ const Bc = z.memo(function({
|
|
|
13855
13855
|
/* @__PURE__ */ u.jsx(ji, { className: "h-4 w-4 text-muted-foreground" }),
|
|
13856
13856
|
/* @__PURE__ */ u.jsx("span", { className: "text-sm text-muted-foreground", children: "File upload" })
|
|
13857
13857
|
] }), []), Ct = z.useCallback(() => {
|
|
13858
|
-
const V = te.trim().length > 0 || ne.length > 0 ||
|
|
13859
|
-
if (!Z &&
|
|
13858
|
+
const V = te.trim().length > 0 || ne.length > 0 || Me.length > 0 || Y.length > 0;
|
|
13859
|
+
if (!Z && Me.length > 0 && !r)
|
|
13860
13860
|
return lt();
|
|
13861
13861
|
if (!Z && !V && !r)
|
|
13862
13862
|
return null;
|
|
@@ -13879,24 +13879,24 @@ const Bc = z.memo(function({
|
|
|
13879
13879
|
}, [
|
|
13880
13880
|
te,
|
|
13881
13881
|
ne.length,
|
|
13882
|
-
|
|
13882
|
+
Me.length,
|
|
13883
13883
|
Y.length,
|
|
13884
13884
|
r,
|
|
13885
13885
|
Z,
|
|
13886
13886
|
L,
|
|
13887
13887
|
lt,
|
|
13888
13888
|
H
|
|
13889
|
-
]), ce = at(() => J ? "Assistant" : kC(t), [J, t]), re = z.useMemo(() => J ? [] : Array.isArray(C) ? C : [], [C, J]),
|
|
13889
|
+
]), ce = at(() => J ? "Assistant" : kC(t), [J, t]), re = z.useMemo(() => J ? [] : Array.isArray(C) ? C : [], [C, J]), Qe = z.useMemo(() => {
|
|
13890
13890
|
var V;
|
|
13891
13891
|
return re.length ? N && re.some((ve) => ve.id === N) ? N : ((V = re[0]) == null ? void 0 : V.id) ?? null : null;
|
|
13892
|
-
}, [N, re]),
|
|
13892
|
+
}, [N, re]), De = z.useMemo(() => !re.length || !S ? null : re.some((V) => V.id === S) ? S : null, [S, re]) ?? Qe, ut = M === "user" && re.length > 0 && typeof k == "function", et = z.useCallback(
|
|
13893
13893
|
(V) => {
|
|
13894
13894
|
if (!k) return;
|
|
13895
13895
|
const ve = (V == null ? void 0 : V.id) ?? null, xe = (V == null ? void 0 : V.parentId) ?? E ?? null;
|
|
13896
13896
|
k(ve, xe);
|
|
13897
13897
|
},
|
|
13898
13898
|
[E, k]
|
|
13899
|
-
), Fe = z.useMemo(() =>
|
|
13899
|
+
), Fe = z.useMemo(() => De ? re.findIndex((V) => V.id === De) : -1, [De, re]), Pt = z.useMemo(() => Fe < 0 ? null : re[Fe] ?? null, [Fe, re]), jt = z.useCallback((V) => {
|
|
13900
13900
|
const ve = [];
|
|
13901
13901
|
if (V.step !== null && ve.push(`Step ${V.step}`), V.source && ve.push(V.source), !V.createdAt)
|
|
13902
13902
|
return ve.length ? ve.join(" • ") : V.id.slice(0, 8);
|
|
@@ -14516,7 +14516,7 @@ const Hc = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, jC = (e) =>
|
|
|
14516
14516
|
onCancelEdit: () => {
|
|
14517
14517
|
}
|
|
14518
14518
|
}
|
|
14519
|
-
) }) }) : /* @__PURE__ */ u.jsx("div", { className: "flex h-full items-center justify-center py-8 text-center text-muted-foreground", children: h ?? "No messages yet. Start a conversation!" }),
|
|
14519
|
+
) }) }) : /* @__PURE__ */ u.jsx("div", { className: "flex h-full items-center justify-center py-8 text-center text-muted-foreground", children: h ?? "No messages yet. Start a conversation!" }), Me = pe.length > 0;
|
|
14520
14520
|
return lm(
|
|
14521
14521
|
L,
|
|
14522
14522
|
() => ({
|
|
@@ -14543,7 +14543,7 @@ const Hc = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, jC = (e) =>
|
|
|
14543
14543
|
[pe]
|
|
14544
14544
|
), /* @__PURE__ */ u.jsxs("div", { className: se, style: p, children: [
|
|
14545
14545
|
te,
|
|
14546
|
-
/* @__PURE__ */ u.jsx("div", { className: "relative flex-1 min-h-0", children:
|
|
14546
|
+
/* @__PURE__ */ u.jsx("div", { className: "relative flex-1 min-h-0", children: Me ? /* @__PURE__ */ u.jsx(
|
|
14547
14547
|
vS,
|
|
14548
14548
|
{
|
|
14549
14549
|
ref: (Y) => {
|
|
@@ -14670,7 +14670,7 @@ function Ai({
|
|
|
14670
14670
|
Ee(!0);
|
|
14671
14671
|
}, []), ee = Ce(() => {
|
|
14672
14672
|
Ee(!1);
|
|
14673
|
-
}, []), q = !!pe || Re, [P, H] = ge(null), [te, se] = ge(""), [ne,
|
|
14673
|
+
}, []), q = !!pe || Re, [P, H] = ge(null), [te, se] = ge(""), [ne, Me] = ge(null), [Y, de] = ge(null), [ke, Ne] = ge([]), [ze, Be] = ge(0), [Ue, Ke] = ge(0), [qe, Ze] = ge(!1), [Xe, rt] = ge(null), [St, mt] = ge(null), [lt, Ct] = ge(!1), [ce, re] = ge(null), [Qe, je] = ge(!1), De = Je(!1), [ut, et] = ge(() => Uc.value), Fe = Je(ut), Pt = Je(null), jt = Ce((G) => {
|
|
14674
14674
|
Uc.value = G, et(G);
|
|
14675
14675
|
}, []), [V, ve] = ge(!1), xe = Je(null), ht = Ce((G) => {
|
|
14676
14676
|
if (!Array.isArray(G))
|
|
@@ -14699,7 +14699,7 @@ function Ai({
|
|
|
14699
14699
|
return typeof ae == "string" && ae.trim() ? ae : null;
|
|
14700
14700
|
},
|
|
14701
14701
|
[]
|
|
14702
|
-
),
|
|
14702
|
+
), _e = at(() => {
|
|
14703
14703
|
const G = (be) => {
|
|
14704
14704
|
if (!Array.isArray(be) || be.length === 0)
|
|
14705
14705
|
return null;
|
|
@@ -14733,7 +14733,7 @@ function Ai({
|
|
|
14733
14733
|
}), oe;
|
|
14734
14734
|
}, [I, gt]), { checkpointMetaById: Vt, checkpointIndexByKey: ct } = at(() => {
|
|
14735
14735
|
const G = /* @__PURE__ */ new Map(), oe = /* @__PURE__ */ new Map();
|
|
14736
|
-
for (const ae of
|
|
14736
|
+
for (const ae of _e) {
|
|
14737
14737
|
const be = ae.checkpointId ?? null;
|
|
14738
14738
|
if (!be) continue;
|
|
14739
14739
|
const dt = gt(ae.metadata, "step"), Ye = Tt(ae.metadata, "source"), nt = {
|
|
@@ -14755,10 +14755,10 @@ function Ai({
|
|
|
14755
14755
|
return (dt.createdAt ?? "").localeCompare(Ye);
|
|
14756
14756
|
});
|
|
14757
14757
|
return { checkpointMetaById: G, checkpointIndexByKey: oe };
|
|
14758
|
-
}, [
|
|
14758
|
+
}, [_e, gt, Tt]), kt = at(() => {
|
|
14759
14759
|
var Ye;
|
|
14760
|
-
if (!
|
|
14761
|
-
const G = [...
|
|
14760
|
+
if (!_e.length) return [];
|
|
14761
|
+
const G = [..._e].reverse(), oe = (nt, Mt) => {
|
|
14762
14762
|
const tn = nt.checkpointId ?? null;
|
|
14763
14763
|
if (!tn) return null;
|
|
14764
14764
|
const Zn = Tt(nt.metadata, "source");
|
|
@@ -14785,7 +14785,7 @@ function Ai({
|
|
|
14785
14785
|
const Mt = oe(nt);
|
|
14786
14786
|
Mt && !be.has(Mt.id) && (ae.push(Mt), be.add(Mt.id));
|
|
14787
14787
|
}
|
|
14788
|
-
const dt =
|
|
14788
|
+
const dt = _e.find((nt) => {
|
|
14789
14789
|
var tn;
|
|
14790
14790
|
return (((tn = Tt(nt.metadata, "source")) == null ? void 0 : tn.toLowerCase()) ?? null) === "loop";
|
|
14791
14791
|
});
|
|
@@ -14794,7 +14794,7 @@ function Ai({
|
|
|
14794
14794
|
nt && !be.has(nt.id) && (ae.push(nt), be.add(nt.id));
|
|
14795
14795
|
}
|
|
14796
14796
|
return ae;
|
|
14797
|
-
}, [
|
|
14797
|
+
}, [_e, ht, gt, Tt]), Dn = Je(null), Jn = Je(null), Ln = Ce(() => {
|
|
14798
14798
|
Dn.current && (Dn.current.value = ""), Jn.current && (Jn.current.value = ""), Be((G) => G + 1), Ke((G) => G + 1);
|
|
14799
14799
|
}, []), ti = Ce(
|
|
14800
14800
|
(G) => {
|
|
@@ -14813,7 +14813,7 @@ function Ai({
|
|
|
14813
14813
|
};
|
|
14814
14814
|
return G(), window.addEventListener("resize", G), () => window.removeEventListener("resize", G);
|
|
14815
14815
|
}, []), Et(() => {
|
|
14816
|
-
|
|
14816
|
+
je(!1), De.current = !1;
|
|
14817
14817
|
}, [D]), Et(() => {
|
|
14818
14818
|
Fe.current = ut;
|
|
14819
14819
|
}, [ut]), Et(() => {
|
|
@@ -14824,13 +14824,13 @@ function Ai({
|
|
|
14824
14824
|
Pt.current === null && (Pt.current = Fe.current), jt(te ?? "");
|
|
14825
14825
|
}, [te, P, jt]);
|
|
14826
14826
|
const R = Ce(async () => {
|
|
14827
|
-
if (!(!b || T || !
|
|
14827
|
+
if (!(!b || T || !Qe))
|
|
14828
14828
|
try {
|
|
14829
14829
|
await S();
|
|
14830
14830
|
} catch (G) {
|
|
14831
14831
|
console.warn("loadOlder failed", G);
|
|
14832
14832
|
}
|
|
14833
|
-
}, [b,
|
|
14833
|
+
}, [b, Qe, T, S]);
|
|
14834
14834
|
Et(() => {
|
|
14835
14835
|
(async () => {
|
|
14836
14836
|
if (!x.baseUrl) {
|
|
@@ -14882,7 +14882,7 @@ function Ai({
|
|
|
14882
14882
|
checkpointId: ae,
|
|
14883
14883
|
checkpointNs: be
|
|
14884
14884
|
}
|
|
14885
|
-
), p == null || p(oe), jt(""), de(null), Ne([]), Ln(), H(null), se(""),
|
|
14885
|
+
), p == null || p(oe), jt(""), de(null), Ne([]), Ln(), H(null), se(""), Me(null);
|
|
14886
14886
|
} catch (ae) {
|
|
14887
14887
|
const be = (ae == null ? void 0 : ae.message) || "Failed to send message";
|
|
14888
14888
|
de(be), m == null || m(be);
|
|
@@ -14890,14 +14890,14 @@ function Ai({
|
|
|
14890
14890
|
}
|
|
14891
14891
|
}, we = z.useCallback(
|
|
14892
14892
|
(G, oe, ae) => {
|
|
14893
|
-
c && (Pt.current = ut, H(G), se(oe), jt(oe), de(null),
|
|
14893
|
+
c && (Pt.current = ut, H(G), se(oe), jt(oe), de(null), Me({
|
|
14894
14894
|
checkpointId: (ae == null ? void 0 : ae.checkpointId) ?? null,
|
|
14895
14895
|
checkpointNs: (ae == null ? void 0 : ae.checkpointNs) ?? null
|
|
14896
14896
|
}));
|
|
14897
14897
|
},
|
|
14898
14898
|
[ut, c, jt]
|
|
14899
14899
|
), Ge = z.useCallback(() => {
|
|
14900
|
-
H(null), se(""),
|
|
14900
|
+
H(null), se(""), Me(null), de(null), jt(Pt.current ?? ut), Pt.current = null;
|
|
14901
14901
|
}, [ut, jt]), it = Ce(
|
|
14902
14902
|
(G, oe, ae) => {
|
|
14903
14903
|
we(G, oe, ae);
|
|
@@ -14956,14 +14956,14 @@ function Ai({
|
|
|
14956
14956
|
ve(!0);
|
|
14957
14957
|
try {
|
|
14958
14958
|
if (!G) {
|
|
14959
|
-
await N(),
|
|
14959
|
+
await N(), je(!1), requestAnimationFrame(() => {
|
|
14960
14960
|
var be;
|
|
14961
14961
|
(be = xe.current) == null || be.scrollToLatest();
|
|
14962
14962
|
});
|
|
14963
14963
|
return;
|
|
14964
14964
|
}
|
|
14965
|
-
const oe =
|
|
14966
|
-
await k(G, ae),
|
|
14965
|
+
const oe = _e.find((be) => be.checkpointId === G), ae = (oe == null ? void 0 : oe.checkpointNs) ?? null;
|
|
14966
|
+
await k(G, ae), je(!0), requestAnimationFrame(() => {
|
|
14967
14967
|
var be;
|
|
14968
14968
|
(be = xe.current) == null || be.scrollToTop();
|
|
14969
14969
|
});
|
|
@@ -15002,7 +15002,7 @@ function Ai({
|
|
|
15002
15002
|
}
|
|
15003
15003
|
)
|
|
15004
15004
|
] }),
|
|
15005
|
-
y &&
|
|
15005
|
+
y && _e.length > 0 && /* @__PURE__ */ u.jsxs("div", { className: "flex-shrink-0 flex items-center gap-2 px-4 py-2 border-b border-border bg-muted/60 text-xs dark:bg-muted/50", children: [
|
|
15006
15006
|
/* @__PURE__ */ u.jsx("span", { className: "opacity-70", children: "Checkpoint:" }),
|
|
15007
15007
|
/* @__PURE__ */ u.jsxs(
|
|
15008
15008
|
"select",
|
|
@@ -15015,7 +15015,7 @@ function Ai({
|
|
|
15015
15015
|
},
|
|
15016
15016
|
children: [
|
|
15017
15017
|
/* @__PURE__ */ u.jsx("option", { value: "", children: "Latest" }),
|
|
15018
|
-
|
|
15018
|
+
_e.map((G) => {
|
|
15019
15019
|
const oe = Vt.get(G.checkpointId ?? "") ?? null;
|
|
15020
15020
|
return /* @__PURE__ */ u.jsx("option", { value: G.checkpointId ?? void 0, children: Dr(oe) }, G.checkpointId);
|
|
15021
15021
|
})
|
|
@@ -15044,14 +15044,14 @@ function Ai({
|
|
|
15044
15044
|
enableMessageEditing: c,
|
|
15045
15045
|
editingMessageId: P,
|
|
15046
15046
|
onStartReached: () => {
|
|
15047
|
-
|
|
15047
|
+
Qe && R();
|
|
15048
15048
|
},
|
|
15049
15049
|
onScrollAway: (G) => {
|
|
15050
|
-
if (!
|
|
15051
|
-
|
|
15050
|
+
if (!De.current) {
|
|
15051
|
+
De.current = !0;
|
|
15052
15052
|
return;
|
|
15053
15053
|
}
|
|
15054
|
-
G &&
|
|
15054
|
+
G && je(!0);
|
|
15055
15055
|
},
|
|
15056
15056
|
onEdit: it,
|
|
15057
15057
|
onRegenerate: He,
|
|
@@ -16577,7 +16577,7 @@ var mT = "SelectItemAlignedPosition", bh = v.forwardRef((e, t) => {
|
|
|
16577
16577
|
if (s.trigger && s.valueNode && a && c && x && y && g) {
|
|
16578
16578
|
const k = s.trigger.getBoundingClientRect(), N = c.getBoundingClientRect(), E = s.valueNode.getBoundingClientRect(), I = g.getBoundingClientRect();
|
|
16579
16579
|
if (s.dir !== "rtl") {
|
|
16580
|
-
const se = I.left - N.left, ne = E.left - se,
|
|
16580
|
+
const se = I.left - N.left, ne = E.left - se, Me = k.left - ne, Y = k.width + Me, de = Math.max(Y, N.width), ke = window.innerWidth - dn, Ne = ta(ne, [
|
|
16581
16581
|
dn,
|
|
16582
16582
|
// Prevents the content from going off the starting edge of the
|
|
16583
16583
|
// viewport. It may still go off the ending edge, but this can be
|
|
@@ -16588,7 +16588,7 @@ var mT = "SelectItemAlignedPosition", bh = v.forwardRef((e, t) => {
|
|
|
16588
16588
|
]);
|
|
16589
16589
|
a.style.minWidth = Y + "px", a.style.left = Ne + "px";
|
|
16590
16590
|
} else {
|
|
16591
|
-
const se = N.right - I.right, ne = window.innerWidth - E.right - se,
|
|
16591
|
+
const se = N.right - I.right, ne = window.innerWidth - E.right - se, Me = window.innerWidth - k.right - ne, Y = k.width + Me, de = Math.max(Y, N.width), ke = window.innerWidth - dn, Ne = ta(ne, [
|
|
16592
16592
|
dn,
|
|
16593
16593
|
Math.max(dn, ke - de)
|
|
16594
16594
|
]);
|
|
@@ -16598,21 +16598,21 @@ var mT = "SelectItemAlignedPosition", bh = v.forwardRef((e, t) => {
|
|
|
16598
16598
|
if (P <= Ee) {
|
|
16599
16599
|
const se = O.length > 0 && y === O[O.length - 1].ref.current;
|
|
16600
16600
|
a.style.bottom = "0px";
|
|
16601
|
-
const ne = c.clientHeight - x.offsetTop - x.offsetHeight,
|
|
16601
|
+
const ne = c.clientHeight - x.offsetTop - x.offsetHeight, Me = Math.max(
|
|
16602
16602
|
W,
|
|
16603
16603
|
ee + // viewport might have padding bottom, include it to avoid a scrollable viewport
|
|
16604
16604
|
(se ? Re : 0) + ne + B
|
|
16605
|
-
), Y = P +
|
|
16605
|
+
), Y = P + Me;
|
|
16606
16606
|
a.style.height = Y + "px";
|
|
16607
16607
|
} else {
|
|
16608
16608
|
const se = O.length > 0 && y === O[0].ref.current;
|
|
16609
16609
|
a.style.top = "0px";
|
|
16610
|
-
const
|
|
16610
|
+
const Me = Math.max(
|
|
16611
16611
|
Ee,
|
|
16612
16612
|
$ + x.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
|
|
16613
16613
|
(se ? pe : 0) + ee
|
|
16614
16614
|
) + H;
|
|
16615
|
-
a.style.height =
|
|
16615
|
+
a.style.height = Me + "px", x.scrollTop = P - Ee + x.offsetTop;
|
|
16616
16616
|
}
|
|
16617
16617
|
a.style.margin = `${dn}px 0`, a.style.minHeight = Z + "px", a.style.maxHeight = L + "px", r == null || r(), requestAnimationFrame(() => h.current = !0);
|
|
16618
16618
|
}
|