@autoai-ui/autoui 0.0.28
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/README.md +73 -0
- package/dist/autoui.css +1 -0
- package/dist/index.cjs +50 -0
- package/dist/index.mjs +4074 -0
- package/dist/stats.html +4949 -0
- package/dist/vite.svg +1 -0
- package/package.json +101 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,4074 @@
|
|
|
1
|
+
import P, { forwardRef as yn, useMemo as Po, createContext as Bo, useContext as Ao, useState as Ct, createElement as wt, useRef as $t, useEffect as Tt, useCallback as Ne, memo as _o, lazy as Cn } from "react";
|
|
2
|
+
import Rn, { createPortal as En } from "react-dom";
|
|
3
|
+
var gt = { exports: {} }, et = {};
|
|
4
|
+
var co;
|
|
5
|
+
function kn() {
|
|
6
|
+
if (co) return et;
|
|
7
|
+
co = 1;
|
|
8
|
+
var e = Symbol.for("react.transitional.element"), t = Symbol.for("react.fragment");
|
|
9
|
+
function o(n, r, s) {
|
|
10
|
+
var i = null;
|
|
11
|
+
if (s !== void 0 && (i = "" + s), r.key !== void 0 && (i = "" + r.key), "key" in r) {
|
|
12
|
+
s = {};
|
|
13
|
+
for (var l in r)
|
|
14
|
+
l !== "key" && (s[l] = r[l]);
|
|
15
|
+
} else s = r;
|
|
16
|
+
return r = s.ref, {
|
|
17
|
+
$$typeof: e,
|
|
18
|
+
type: n,
|
|
19
|
+
key: i,
|
|
20
|
+
ref: r !== void 0 ? r : null,
|
|
21
|
+
props: s
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
return et.Fragment = t, et.jsx = o, et.jsxs = o, et;
|
|
25
|
+
}
|
|
26
|
+
var tt = {};
|
|
27
|
+
var uo;
|
|
28
|
+
function zn() {
|
|
29
|
+
return uo || (uo = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
30
|
+
function e(h) {
|
|
31
|
+
if (h == null) return null;
|
|
32
|
+
if (typeof h == "function")
|
|
33
|
+
return h.$$typeof === A ? null : h.displayName || h.name || null;
|
|
34
|
+
if (typeof h == "string") return h;
|
|
35
|
+
switch (h) {
|
|
36
|
+
case g:
|
|
37
|
+
return "Fragment";
|
|
38
|
+
case f:
|
|
39
|
+
return "Profiler";
|
|
40
|
+
case d:
|
|
41
|
+
return "StrictMode";
|
|
42
|
+
case H:
|
|
43
|
+
return "Suspense";
|
|
44
|
+
case u:
|
|
45
|
+
return "SuspenseList";
|
|
46
|
+
case z:
|
|
47
|
+
return "Activity";
|
|
48
|
+
}
|
|
49
|
+
if (typeof h == "object")
|
|
50
|
+
switch (typeof h.tag == "number" && console.error(
|
|
51
|
+
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
52
|
+
), h.$$typeof) {
|
|
53
|
+
case E:
|
|
54
|
+
return "Portal";
|
|
55
|
+
case O:
|
|
56
|
+
return h.displayName || "Context";
|
|
57
|
+
case I:
|
|
58
|
+
return (h._context.displayName || "Context") + ".Consumer";
|
|
59
|
+
case k:
|
|
60
|
+
var M = h.render;
|
|
61
|
+
return h = h.displayName, h || (h = M.displayName || M.name || "", h = h !== "" ? "ForwardRef(" + h + ")" : "ForwardRef"), h;
|
|
62
|
+
case v:
|
|
63
|
+
return M = h.displayName || null, M !== null ? M : e(h.type) || "Memo";
|
|
64
|
+
case y:
|
|
65
|
+
M = h._payload, h = h._init;
|
|
66
|
+
try {
|
|
67
|
+
return e(h(M));
|
|
68
|
+
} catch {
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
function t(h) {
|
|
74
|
+
return "" + h;
|
|
75
|
+
}
|
|
76
|
+
function o(h) {
|
|
77
|
+
try {
|
|
78
|
+
t(h);
|
|
79
|
+
var M = !1;
|
|
80
|
+
} catch {
|
|
81
|
+
M = !0;
|
|
82
|
+
}
|
|
83
|
+
if (M) {
|
|
84
|
+
M = console;
|
|
85
|
+
var q = M.error, Q = typeof Symbol == "function" && Symbol.toStringTag && h[Symbol.toStringTag] || h.constructor.name || "Object";
|
|
86
|
+
return q.call(
|
|
87
|
+
M,
|
|
88
|
+
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
89
|
+
Q
|
|
90
|
+
), t(h);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
function n(h) {
|
|
94
|
+
if (h === g) return "<>";
|
|
95
|
+
if (typeof h == "object" && h !== null && h.$$typeof === y)
|
|
96
|
+
return "<...>";
|
|
97
|
+
try {
|
|
98
|
+
var M = e(h);
|
|
99
|
+
return M ? "<" + M + ">" : "<...>";
|
|
100
|
+
} catch {
|
|
101
|
+
return "<...>";
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
function r() {
|
|
105
|
+
var h = F.A;
|
|
106
|
+
return h === null ? null : h.getOwner();
|
|
107
|
+
}
|
|
108
|
+
function s() {
|
|
109
|
+
return Error("react-stack-top-frame");
|
|
110
|
+
}
|
|
111
|
+
function i(h) {
|
|
112
|
+
if (D.call(h, "key")) {
|
|
113
|
+
var M = Object.getOwnPropertyDescriptor(h, "key").get;
|
|
114
|
+
if (M && M.isReactWarning) return !1;
|
|
115
|
+
}
|
|
116
|
+
return h.key !== void 0;
|
|
117
|
+
}
|
|
118
|
+
function l(h, M) {
|
|
119
|
+
function q() {
|
|
120
|
+
X || (X = !0, console.error(
|
|
121
|
+
"%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://react.dev/link/special-props)",
|
|
122
|
+
M
|
|
123
|
+
));
|
|
124
|
+
}
|
|
125
|
+
q.isReactWarning = !0, Object.defineProperty(h, "key", {
|
|
126
|
+
get: q,
|
|
127
|
+
configurable: !0
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
function a() {
|
|
131
|
+
var h = e(this.type);
|
|
132
|
+
return K[h] || (K[h] = !0, console.error(
|
|
133
|
+
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
134
|
+
)), h = this.props.ref, h !== void 0 ? h : null;
|
|
135
|
+
}
|
|
136
|
+
function c(h, M, q, Q, Pe, Be) {
|
|
137
|
+
var ee = q.ref;
|
|
138
|
+
return h = {
|
|
139
|
+
$$typeof: b,
|
|
140
|
+
type: h,
|
|
141
|
+
key: M,
|
|
142
|
+
props: q,
|
|
143
|
+
_owner: Q
|
|
144
|
+
}, (ee !== void 0 ? ee : null) !== null ? Object.defineProperty(h, "ref", {
|
|
145
|
+
enumerable: !1,
|
|
146
|
+
get: a
|
|
147
|
+
}) : Object.defineProperty(h, "ref", { enumerable: !1, value: null }), h._store = {}, Object.defineProperty(h._store, "validated", {
|
|
148
|
+
configurable: !1,
|
|
149
|
+
enumerable: !1,
|
|
150
|
+
writable: !0,
|
|
151
|
+
value: 0
|
|
152
|
+
}), Object.defineProperty(h, "_debugInfo", {
|
|
153
|
+
configurable: !1,
|
|
154
|
+
enumerable: !1,
|
|
155
|
+
writable: !0,
|
|
156
|
+
value: null
|
|
157
|
+
}), Object.defineProperty(h, "_debugStack", {
|
|
158
|
+
configurable: !1,
|
|
159
|
+
enumerable: !1,
|
|
160
|
+
writable: !0,
|
|
161
|
+
value: Pe
|
|
162
|
+
}), Object.defineProperty(h, "_debugTask", {
|
|
163
|
+
configurable: !1,
|
|
164
|
+
enumerable: !1,
|
|
165
|
+
writable: !0,
|
|
166
|
+
value: Be
|
|
167
|
+
}), Object.freeze && (Object.freeze(h.props), Object.freeze(h)), h;
|
|
168
|
+
}
|
|
169
|
+
function m(h, M, q, Q, Pe, Be) {
|
|
170
|
+
var ee = M.children;
|
|
171
|
+
if (ee !== void 0)
|
|
172
|
+
if (Q)
|
|
173
|
+
if (_(ee)) {
|
|
174
|
+
for (Q = 0; Q < ee.length; Q++)
|
|
175
|
+
T(ee[Q]);
|
|
176
|
+
Object.freeze && Object.freeze(ee);
|
|
177
|
+
} else
|
|
178
|
+
console.error(
|
|
179
|
+
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
180
|
+
);
|
|
181
|
+
else T(ee);
|
|
182
|
+
if (D.call(M, "key")) {
|
|
183
|
+
ee = e(h);
|
|
184
|
+
var R = Object.keys(M).filter(function(ne) {
|
|
185
|
+
return ne !== "key";
|
|
186
|
+
});
|
|
187
|
+
Q = 0 < R.length ? "{key: someKey, " + R.join(": ..., ") + ": ...}" : "{key: someKey}", Te[ee + Q] || (R = 0 < R.length ? "{" + R.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
188
|
+
`A props object containing a "key" prop is being spread into JSX:
|
|
189
|
+
let props = %s;
|
|
190
|
+
<%s {...props} />
|
|
191
|
+
React keys must be passed directly to JSX without using spread:
|
|
192
|
+
let props = %s;
|
|
193
|
+
<%s key={someKey} {...props} />`,
|
|
194
|
+
Q,
|
|
195
|
+
ee,
|
|
196
|
+
R,
|
|
197
|
+
ee
|
|
198
|
+
), Te[ee + Q] = !0);
|
|
199
|
+
}
|
|
200
|
+
if (ee = null, q !== void 0 && (o(q), ee = "" + q), i(M) && (o(M.key), ee = "" + M.key), "key" in M) {
|
|
201
|
+
q = {};
|
|
202
|
+
for (var G in M)
|
|
203
|
+
G !== "key" && (q[G] = M[G]);
|
|
204
|
+
} else q = M;
|
|
205
|
+
return ee && l(
|
|
206
|
+
q,
|
|
207
|
+
typeof h == "function" ? h.displayName || h.name || "Unknown" : h
|
|
208
|
+
), c(
|
|
209
|
+
h,
|
|
210
|
+
ee,
|
|
211
|
+
q,
|
|
212
|
+
r(),
|
|
213
|
+
Pe,
|
|
214
|
+
Be
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
function T(h) {
|
|
218
|
+
p(h) ? h._store && (h._store.validated = 1) : typeof h == "object" && h !== null && h.$$typeof === y && (h._payload.status === "fulfilled" ? p(h._payload.value) && h._payload.value._store && (h._payload.value._store.validated = 1) : h._store && (h._store.validated = 1));
|
|
219
|
+
}
|
|
220
|
+
function p(h) {
|
|
221
|
+
return typeof h == "object" && h !== null && h.$$typeof === b;
|
|
222
|
+
}
|
|
223
|
+
var x = P, b = Symbol.for("react.transitional.element"), E = Symbol.for("react.portal"), g = Symbol.for("react.fragment"), d = Symbol.for("react.strict_mode"), f = Symbol.for("react.profiler"), I = Symbol.for("react.consumer"), O = Symbol.for("react.context"), k = Symbol.for("react.forward_ref"), H = Symbol.for("react.suspense"), u = Symbol.for("react.suspense_list"), v = Symbol.for("react.memo"), y = Symbol.for("react.lazy"), z = Symbol.for("react.activity"), A = Symbol.for("react.client.reference"), F = x.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, D = Object.prototype.hasOwnProperty, _ = Array.isArray, V = console.createTask ? console.createTask : function() {
|
|
224
|
+
return null;
|
|
225
|
+
};
|
|
226
|
+
x = {
|
|
227
|
+
react_stack_bottom_frame: function(h) {
|
|
228
|
+
return h();
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
var X, K = {}, ve = x.react_stack_bottom_frame.bind(
|
|
232
|
+
x,
|
|
233
|
+
s
|
|
234
|
+
)(), we = V(n(s)), Te = {};
|
|
235
|
+
tt.Fragment = g, tt.jsx = function(h, M, q) {
|
|
236
|
+
var Q = 1e4 > F.recentlyCreatedOwnerStacks++;
|
|
237
|
+
return m(
|
|
238
|
+
h,
|
|
239
|
+
M,
|
|
240
|
+
q,
|
|
241
|
+
!1,
|
|
242
|
+
Q ? Error("react-stack-top-frame") : ve,
|
|
243
|
+
Q ? V(n(h)) : we
|
|
244
|
+
);
|
|
245
|
+
}, tt.jsxs = function(h, M, q) {
|
|
246
|
+
var Q = 1e4 > F.recentlyCreatedOwnerStacks++;
|
|
247
|
+
return m(
|
|
248
|
+
h,
|
|
249
|
+
M,
|
|
250
|
+
q,
|
|
251
|
+
!0,
|
|
252
|
+
Q ? Error("react-stack-top-frame") : ve,
|
|
253
|
+
Q ? V(n(h)) : we
|
|
254
|
+
);
|
|
255
|
+
};
|
|
256
|
+
})()), tt;
|
|
257
|
+
}
|
|
258
|
+
var fo;
|
|
259
|
+
function jn() {
|
|
260
|
+
return fo || (fo = 1, process.env.NODE_ENV === "production" ? gt.exports = kn() : gt.exports = zn()), gt.exports;
|
|
261
|
+
}
|
|
262
|
+
var C = jn();
|
|
263
|
+
function Mo(e) {
|
|
264
|
+
var t, o, n = "";
|
|
265
|
+
if (typeof e == "string" || typeof e == "number") n += e;
|
|
266
|
+
else if (typeof e == "object") if (Array.isArray(e)) {
|
|
267
|
+
var r = e.length;
|
|
268
|
+
for (t = 0; t < r; t++) e[t] && (o = Mo(e[t])) && (n && (n += " "), n += o);
|
|
269
|
+
} else for (o in e) e[o] && (n && (n += " "), n += o);
|
|
270
|
+
return n;
|
|
271
|
+
}
|
|
272
|
+
function xe() {
|
|
273
|
+
for (var e, t, o = 0, n = "", r = arguments.length; o < r; o++) (e = arguments[o]) && (t = Mo(e)) && (n && (n += " "), n += t);
|
|
274
|
+
return n;
|
|
275
|
+
}
|
|
276
|
+
const On = yn(
|
|
277
|
+
({ variant: e = "default", label: t, className: o, classNames: n = {}, ...r }, s) => {
|
|
278
|
+
const i = xe("inline-flex flex-col items-center justify-center", o), l = Po(() => {
|
|
279
|
+
switch (e) {
|
|
280
|
+
case "wave":
|
|
281
|
+
case "dots":
|
|
282
|
+
return /* @__PURE__ */ C.jsx("div", { className: xe("flex gap-1", n.wrapper), children: [...Array(3)].map((a, c) => /* @__PURE__ */ C.jsx(
|
|
283
|
+
"i",
|
|
284
|
+
{
|
|
285
|
+
className: xe("block w-2 h-2 bg-current rounded-full animate-bounce", n.dots),
|
|
286
|
+
style: {
|
|
287
|
+
animationDelay: `${c * 0.2}s`
|
|
288
|
+
}
|
|
289
|
+
},
|
|
290
|
+
c
|
|
291
|
+
)) });
|
|
292
|
+
case "simple":
|
|
293
|
+
return /* @__PURE__ */ C.jsxs(
|
|
294
|
+
"svg",
|
|
295
|
+
{
|
|
296
|
+
className: xe("animate-spin text-current", n.wrapper),
|
|
297
|
+
width: "24",
|
|
298
|
+
height: "24",
|
|
299
|
+
fill: "none",
|
|
300
|
+
viewBox: "0 0 24 24",
|
|
301
|
+
children: [
|
|
302
|
+
/* @__PURE__ */ C.jsx(
|
|
303
|
+
"circle",
|
|
304
|
+
{
|
|
305
|
+
className: xe("opacity-25", n.circle1),
|
|
306
|
+
cx: "12",
|
|
307
|
+
cy: "12",
|
|
308
|
+
r: "10",
|
|
309
|
+
stroke: "currentColor",
|
|
310
|
+
strokeWidth: "4"
|
|
311
|
+
}
|
|
312
|
+
),
|
|
313
|
+
/* @__PURE__ */ C.jsx(
|
|
314
|
+
"path",
|
|
315
|
+
{
|
|
316
|
+
className: xe("opacity-75", n.circle2),
|
|
317
|
+
fill: "currentColor",
|
|
318
|
+
d: "M4 12a8 8 0 018-8V0C5.37 0 0 5.37 0 12h4z"
|
|
319
|
+
}
|
|
320
|
+
)
|
|
321
|
+
]
|
|
322
|
+
}
|
|
323
|
+
);
|
|
324
|
+
case "spinner":
|
|
325
|
+
return /* @__PURE__ */ C.jsx("div", { className: xe("relative w-6 h-6", n.wrapper), children: [...Array(12)].map((a, c) => /* @__PURE__ */ C.jsx(
|
|
326
|
+
"i",
|
|
327
|
+
{
|
|
328
|
+
className: xe(
|
|
329
|
+
"absolute left-1/2 top-1/2 w-0.5 h-1.5 bg-current origin-center opacity-20 animate-pulse",
|
|
330
|
+
n.spinnerBars
|
|
331
|
+
),
|
|
332
|
+
style: {
|
|
333
|
+
transform: `rotate(${c * 30}deg) translateY(-8px)`,
|
|
334
|
+
animationDelay: `${c * 0.1}s`
|
|
335
|
+
}
|
|
336
|
+
},
|
|
337
|
+
c
|
|
338
|
+
)) });
|
|
339
|
+
default:
|
|
340
|
+
return /* @__PURE__ */ C.jsxs("div", { className: xe("relative w-8 h-8", n.wrapper), children: [
|
|
341
|
+
/* @__PURE__ */ C.jsx(
|
|
342
|
+
"i",
|
|
343
|
+
{
|
|
344
|
+
className: xe(
|
|
345
|
+
"absolute inset-0 rounded-full border-4 border-current border-opacity-25",
|
|
346
|
+
n.circle1
|
|
347
|
+
)
|
|
348
|
+
}
|
|
349
|
+
),
|
|
350
|
+
/* @__PURE__ */ C.jsx(
|
|
351
|
+
"i",
|
|
352
|
+
{
|
|
353
|
+
className: xe(
|
|
354
|
+
"absolute inset-0 rounded-full border-4 border-t-transparent animate-spin",
|
|
355
|
+
n.circle2
|
|
356
|
+
)
|
|
357
|
+
}
|
|
358
|
+
)
|
|
359
|
+
] });
|
|
360
|
+
}
|
|
361
|
+
}, [e, n]);
|
|
362
|
+
return /* @__PURE__ */ C.jsxs("div", { ref: s, className: i, "aria-label": t || "Loading", ...r, children: [
|
|
363
|
+
l,
|
|
364
|
+
t && /* @__PURE__ */ C.jsx("span", { className: xe("mt-2 text-sm text-gray-600", n.label), children: t })
|
|
365
|
+
] });
|
|
366
|
+
}
|
|
367
|
+
), No = Bo(void 0), Hn = ({ children: e, value: t, config: o }) => /* @__PURE__ */ C.jsx(No.Provider, { value: { ...t, config: o }, children: e }), Rt = () => {
|
|
368
|
+
const e = Ao(No);
|
|
369
|
+
if (!e)
|
|
370
|
+
throw new Error("useChatContext must be used within a ChatProvider");
|
|
371
|
+
return e;
|
|
372
|
+
};
|
|
373
|
+
function ot(...e) {
|
|
374
|
+
return e.filter(Boolean).join(" ");
|
|
375
|
+
}
|
|
376
|
+
const Pn = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='utf-8'?%3e%3c!--%20Uploaded%20to:%20SVG%20Repo,%20www.svgrepo.com,%20Generator:%20SVG%20Repo%20Mixer%20Tools%20--%3e%3csvg%20width='800px'%20height='800px'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M4%2012H20M12%204V20'%20stroke='%23000000'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e", Wo = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='utf-8'?%3e%3c!--%20Uploaded%20to:%20SVG%20Repo,%20www.svgrepo.com,%20Generator:%20SVG%20Repo%20Mixer%20Tools%20--%3e%3csvg%20width='800px'%20height='800px'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M6%206L18%2018M18%206L6%2018'%20stroke='%23000000'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e", Bn = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='utf-8'?%3e%3c!--%20Uploaded%20to:%20SVG%20Repo,%20www.svgrepo.com,%20Generator:%20SVG%20Repo%20Mixer%20Tools%20--%3e%3csvg%20width='800px'%20height='800px'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M12%206V18M12%206L7%2011M12%206L17%2011'%20stroke='%23000000'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e", An = () => {
|
|
377
|
+
const { classNames: e, handleSend: t } = Rt(), [o, n] = Ct(""), r = (s) => {
|
|
378
|
+
s.preventDefault(), t(o), n("");
|
|
379
|
+
};
|
|
380
|
+
return /* @__PURE__ */ C.jsxs(
|
|
381
|
+
"form",
|
|
382
|
+
{
|
|
383
|
+
role: "inputWrapper",
|
|
384
|
+
className: ot("autoui-chat-input", e?.inputWrapper),
|
|
385
|
+
onSubmit: r,
|
|
386
|
+
"aria-label": "Chat input area",
|
|
387
|
+
children: [
|
|
388
|
+
/* @__PURE__ */ C.jsx(
|
|
389
|
+
"input",
|
|
390
|
+
{
|
|
391
|
+
role: "input",
|
|
392
|
+
className: ot("autoui-chat-textbox", e?.input),
|
|
393
|
+
type: "text",
|
|
394
|
+
value: o,
|
|
395
|
+
onChange: (s) => n(s.target.value),
|
|
396
|
+
placeholder: "Type a message...",
|
|
397
|
+
"aria-label": "Message input"
|
|
398
|
+
}
|
|
399
|
+
),
|
|
400
|
+
/* @__PURE__ */ C.jsx(
|
|
401
|
+
"button",
|
|
402
|
+
{
|
|
403
|
+
role: "inputButton",
|
|
404
|
+
type: "submit",
|
|
405
|
+
className: ot("autoui-chat-send", e?.inputButton),
|
|
406
|
+
"aria-label": "Send message",
|
|
407
|
+
children: /* @__PURE__ */ C.jsx("img", { src: Bn, alt: "arrow up" })
|
|
408
|
+
}
|
|
409
|
+
)
|
|
410
|
+
]
|
|
411
|
+
}
|
|
412
|
+
);
|
|
413
|
+
}, _n = ({ message: e }) => {
|
|
414
|
+
const t = e.role === "user", { classNames: o } = Rt();
|
|
415
|
+
return /* @__PURE__ */ C.jsx(
|
|
416
|
+
"div",
|
|
417
|
+
{
|
|
418
|
+
role: "message",
|
|
419
|
+
className: xe("autoui-chat-message", t ? "user" : "assistant", o?.message),
|
|
420
|
+
"aria-label": t ? "User message" : "Assistant message",
|
|
421
|
+
children: /* @__PURE__ */ C.jsx("div", { className: "autoui-chat-bubble", children: e.content })
|
|
422
|
+
}
|
|
423
|
+
);
|
|
424
|
+
}, Et = 0, De = 1, Ke = 2, Fo = 4;
|
|
425
|
+
function mo(e) {
|
|
426
|
+
return () => e;
|
|
427
|
+
}
|
|
428
|
+
function Mn(e) {
|
|
429
|
+
e();
|
|
430
|
+
}
|
|
431
|
+
function Do(e, t) {
|
|
432
|
+
return (o) => e(t(o));
|
|
433
|
+
}
|
|
434
|
+
function ho(e, t) {
|
|
435
|
+
return () => e(t);
|
|
436
|
+
}
|
|
437
|
+
function Nn(e, t) {
|
|
438
|
+
return (o) => e(t, o);
|
|
439
|
+
}
|
|
440
|
+
function Ut(e) {
|
|
441
|
+
return e !== void 0;
|
|
442
|
+
}
|
|
443
|
+
function Wn(...e) {
|
|
444
|
+
return () => {
|
|
445
|
+
e.map(Mn);
|
|
446
|
+
};
|
|
447
|
+
}
|
|
448
|
+
function Qe() {
|
|
449
|
+
}
|
|
450
|
+
function kt(e, t) {
|
|
451
|
+
return t(e), e;
|
|
452
|
+
}
|
|
453
|
+
function Fn(e, t) {
|
|
454
|
+
return t(e);
|
|
455
|
+
}
|
|
456
|
+
function ie(...e) {
|
|
457
|
+
return e;
|
|
458
|
+
}
|
|
459
|
+
function Z(e, t) {
|
|
460
|
+
return e(De, t);
|
|
461
|
+
}
|
|
462
|
+
function $(e, t) {
|
|
463
|
+
e(Et, t);
|
|
464
|
+
}
|
|
465
|
+
function Gt(e) {
|
|
466
|
+
e(Ke);
|
|
467
|
+
}
|
|
468
|
+
function ae(e) {
|
|
469
|
+
return e(Fo);
|
|
470
|
+
}
|
|
471
|
+
function B(e, t) {
|
|
472
|
+
return Z(e, Nn(t, Et));
|
|
473
|
+
}
|
|
474
|
+
function Oe(e, t) {
|
|
475
|
+
const o = e(De, (n) => {
|
|
476
|
+
o(), t(n);
|
|
477
|
+
});
|
|
478
|
+
return o;
|
|
479
|
+
}
|
|
480
|
+
function po(e) {
|
|
481
|
+
let t, o;
|
|
482
|
+
return (n) => (r) => {
|
|
483
|
+
t = r, o && clearTimeout(o), o = setTimeout(() => {
|
|
484
|
+
n(t);
|
|
485
|
+
}, e);
|
|
486
|
+
};
|
|
487
|
+
}
|
|
488
|
+
function Lo(e, t) {
|
|
489
|
+
return e === t;
|
|
490
|
+
}
|
|
491
|
+
function se(e = Lo) {
|
|
492
|
+
let t;
|
|
493
|
+
return (o) => (n) => {
|
|
494
|
+
e(t, n) || (t = n, o(n));
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
function W(e) {
|
|
498
|
+
return (t) => (o) => {
|
|
499
|
+
e(o) && t(o);
|
|
500
|
+
};
|
|
501
|
+
}
|
|
502
|
+
function j(e) {
|
|
503
|
+
return (t) => Do(t, e);
|
|
504
|
+
}
|
|
505
|
+
function Ae(e) {
|
|
506
|
+
return (t) => () => {
|
|
507
|
+
t(e);
|
|
508
|
+
};
|
|
509
|
+
}
|
|
510
|
+
function w(e, ...t) {
|
|
511
|
+
const o = Dn(...t);
|
|
512
|
+
return (n, r) => {
|
|
513
|
+
switch (n) {
|
|
514
|
+
case Ke:
|
|
515
|
+
Gt(e);
|
|
516
|
+
return;
|
|
517
|
+
case De:
|
|
518
|
+
return Z(e, o(r));
|
|
519
|
+
}
|
|
520
|
+
};
|
|
521
|
+
}
|
|
522
|
+
function _e(e, t) {
|
|
523
|
+
return (o) => (n) => {
|
|
524
|
+
o(t = e(t, n));
|
|
525
|
+
};
|
|
526
|
+
}
|
|
527
|
+
function Ge(e) {
|
|
528
|
+
return (t) => (o) => {
|
|
529
|
+
e > 0 ? e-- : t(o);
|
|
530
|
+
};
|
|
531
|
+
}
|
|
532
|
+
function We(e) {
|
|
533
|
+
let t = null, o;
|
|
534
|
+
return (n) => (r) => {
|
|
535
|
+
t = r, !o && (o = setTimeout(() => {
|
|
536
|
+
o = void 0, n(t);
|
|
537
|
+
}, e));
|
|
538
|
+
};
|
|
539
|
+
}
|
|
540
|
+
function U(...e) {
|
|
541
|
+
const t = new Array(e.length);
|
|
542
|
+
let o = 0, n = null;
|
|
543
|
+
const r = Math.pow(2, e.length) - 1;
|
|
544
|
+
return e.forEach((s, i) => {
|
|
545
|
+
const l = Math.pow(2, i);
|
|
546
|
+
Z(s, (a) => {
|
|
547
|
+
const c = o;
|
|
548
|
+
o = o | l, t[i] = a, c !== r && o === r && n && (n(), n = null);
|
|
549
|
+
});
|
|
550
|
+
}), (s) => (i) => {
|
|
551
|
+
const l = () => {
|
|
552
|
+
s([i].concat(t));
|
|
553
|
+
};
|
|
554
|
+
o === r ? l() : n = l;
|
|
555
|
+
};
|
|
556
|
+
}
|
|
557
|
+
function Dn(...e) {
|
|
558
|
+
return (t) => e.reduceRight(Fn, t);
|
|
559
|
+
}
|
|
560
|
+
function Ln(e) {
|
|
561
|
+
let t, o;
|
|
562
|
+
const n = () => t?.();
|
|
563
|
+
return function(r, s) {
|
|
564
|
+
switch (r) {
|
|
565
|
+
case De:
|
|
566
|
+
return s ? o === s ? void 0 : (n(), o = s, t = Z(e, s), t) : (n(), Qe);
|
|
567
|
+
case Ke:
|
|
568
|
+
n(), o = null;
|
|
569
|
+
return;
|
|
570
|
+
}
|
|
571
|
+
};
|
|
572
|
+
}
|
|
573
|
+
function S(e) {
|
|
574
|
+
let t = e;
|
|
575
|
+
const o = Y();
|
|
576
|
+
return (n, r) => {
|
|
577
|
+
switch (n) {
|
|
578
|
+
case Et:
|
|
579
|
+
t = r;
|
|
580
|
+
break;
|
|
581
|
+
case De: {
|
|
582
|
+
r(t);
|
|
583
|
+
break;
|
|
584
|
+
}
|
|
585
|
+
case Fo:
|
|
586
|
+
return t;
|
|
587
|
+
}
|
|
588
|
+
return o(n, r);
|
|
589
|
+
};
|
|
590
|
+
}
|
|
591
|
+
function Se(e, t) {
|
|
592
|
+
return kt(S(t), (o) => B(e, o));
|
|
593
|
+
}
|
|
594
|
+
function Y() {
|
|
595
|
+
const e = [];
|
|
596
|
+
return (t, o) => {
|
|
597
|
+
switch (t) {
|
|
598
|
+
case Et:
|
|
599
|
+
e.slice().forEach((n) => {
|
|
600
|
+
n(o);
|
|
601
|
+
});
|
|
602
|
+
return;
|
|
603
|
+
case Ke:
|
|
604
|
+
e.splice(0, e.length);
|
|
605
|
+
return;
|
|
606
|
+
case De:
|
|
607
|
+
return e.push(o), () => {
|
|
608
|
+
const n = e.indexOf(o);
|
|
609
|
+
n > -1 && e.splice(n, 1);
|
|
610
|
+
};
|
|
611
|
+
}
|
|
612
|
+
};
|
|
613
|
+
}
|
|
614
|
+
function Re(e) {
|
|
615
|
+
return kt(Y(), (t) => B(e, t));
|
|
616
|
+
}
|
|
617
|
+
function J(e, t = [], { singleton: o } = { singleton: !0 }) {
|
|
618
|
+
return {
|
|
619
|
+
constructor: e,
|
|
620
|
+
dependencies: t,
|
|
621
|
+
id: Vn(),
|
|
622
|
+
singleton: o
|
|
623
|
+
};
|
|
624
|
+
}
|
|
625
|
+
const Vn = () => Symbol();
|
|
626
|
+
function $n(e) {
|
|
627
|
+
const t = /* @__PURE__ */ new Map(), o = ({ constructor: n, dependencies: r, id: s, singleton: i }) => {
|
|
628
|
+
if (i && t.has(s))
|
|
629
|
+
return t.get(s);
|
|
630
|
+
const l = n(r.map((a) => o(a)));
|
|
631
|
+
return i && t.set(s, l), l;
|
|
632
|
+
};
|
|
633
|
+
return o(e);
|
|
634
|
+
}
|
|
635
|
+
function de(...e) {
|
|
636
|
+
const t = Y(), o = new Array(e.length);
|
|
637
|
+
let n = 0;
|
|
638
|
+
const r = Math.pow(2, e.length) - 1;
|
|
639
|
+
return e.forEach((s, i) => {
|
|
640
|
+
const l = Math.pow(2, i);
|
|
641
|
+
Z(s, (a) => {
|
|
642
|
+
o[i] = a, n = n | l, n === r && $(t, o);
|
|
643
|
+
});
|
|
644
|
+
}), function(s, i) {
|
|
645
|
+
switch (s) {
|
|
646
|
+
case Ke: {
|
|
647
|
+
Gt(t);
|
|
648
|
+
return;
|
|
649
|
+
}
|
|
650
|
+
case De:
|
|
651
|
+
return n === r && i(o), Z(t, i);
|
|
652
|
+
}
|
|
653
|
+
};
|
|
654
|
+
}
|
|
655
|
+
function N(e, t = Lo) {
|
|
656
|
+
return w(e, se(t));
|
|
657
|
+
}
|
|
658
|
+
function Mt(...e) {
|
|
659
|
+
return function(t, o) {
|
|
660
|
+
switch (t) {
|
|
661
|
+
case Ke:
|
|
662
|
+
return;
|
|
663
|
+
case De:
|
|
664
|
+
return Wn(...e.map((n) => Z(n, o)));
|
|
665
|
+
}
|
|
666
|
+
};
|
|
667
|
+
}
|
|
668
|
+
var ye = /* @__PURE__ */ ((e) => (e[e.DEBUG = 0] = "DEBUG", e[e.INFO = 1] = "INFO", e[e.WARN = 2] = "WARN", e[e.ERROR = 3] = "ERROR", e))(ye || {});
|
|
669
|
+
const Un = {
|
|
670
|
+
0: "debug",
|
|
671
|
+
3: "error",
|
|
672
|
+
1: "log",
|
|
673
|
+
2: "warn"
|
|
674
|
+
}, Gn = () => typeof globalThis > "u" ? window : globalThis, Le = J(
|
|
675
|
+
() => {
|
|
676
|
+
const e = S(
|
|
677
|
+
3
|
|
678
|
+
/* ERROR */
|
|
679
|
+
);
|
|
680
|
+
return {
|
|
681
|
+
log: S((t, o, n = 1) => {
|
|
682
|
+
var r;
|
|
683
|
+
const s = (r = Gn().VIRTUOSO_LOG_LEVEL) != null ? r : ae(e);
|
|
684
|
+
n >= s && console[Un[n]](
|
|
685
|
+
"%creact-virtuoso: %c%s %o",
|
|
686
|
+
"color: #0253b3; font-weight: bold",
|
|
687
|
+
"color: initial",
|
|
688
|
+
t,
|
|
689
|
+
o
|
|
690
|
+
);
|
|
691
|
+
}),
|
|
692
|
+
logLevel: e
|
|
693
|
+
};
|
|
694
|
+
},
|
|
695
|
+
[],
|
|
696
|
+
{ singleton: !0 }
|
|
697
|
+
);
|
|
698
|
+
function Ye(e, t, o) {
|
|
699
|
+
return Yt(e, t, o).callbackRef;
|
|
700
|
+
}
|
|
701
|
+
function Yt(e, t, o) {
|
|
702
|
+
const n = P.useRef(null);
|
|
703
|
+
let r = (i) => {
|
|
704
|
+
};
|
|
705
|
+
const s = P.useMemo(() => typeof ResizeObserver < "u" ? new ResizeObserver((i) => {
|
|
706
|
+
const l = () => {
|
|
707
|
+
const a = i[0].target;
|
|
708
|
+
a.offsetParent !== null && e(a);
|
|
709
|
+
};
|
|
710
|
+
o ? l() : requestAnimationFrame(l);
|
|
711
|
+
}) : null, [e, o]);
|
|
712
|
+
return r = (i) => {
|
|
713
|
+
i && t ? (s?.observe(i), n.current = i) : (n.current && s?.unobserve(n.current), n.current = null);
|
|
714
|
+
}, { callbackRef: r, ref: n };
|
|
715
|
+
}
|
|
716
|
+
function Yn(e, t, o, n, r, s, i, l, a) {
|
|
717
|
+
const c = P.useCallback(
|
|
718
|
+
(m) => {
|
|
719
|
+
const T = qn(m.children, t, l ? "offsetWidth" : "offsetHeight", r);
|
|
720
|
+
let p = m.parentElement;
|
|
721
|
+
for (; !p.dataset.virtuosoScroller; )
|
|
722
|
+
p = p.parentElement;
|
|
723
|
+
const x = p.lastElementChild.dataset.viewportType === "window";
|
|
724
|
+
let b;
|
|
725
|
+
x && (b = p.ownerDocument.defaultView);
|
|
726
|
+
const E = i ? l ? i.scrollLeft : i.scrollTop : x ? l ? b.scrollX || b.document.documentElement.scrollLeft : b.scrollY || b.document.documentElement.scrollTop : l ? p.scrollLeft : p.scrollTop, g = i ? l ? i.scrollWidth : i.scrollHeight : x ? l ? b.document.documentElement.scrollWidth : b.document.documentElement.scrollHeight : l ? p.scrollWidth : p.scrollHeight, d = i ? l ? i.offsetWidth : i.offsetHeight : x ? l ? b.innerWidth : b.innerHeight : l ? p.offsetWidth : p.offsetHeight;
|
|
727
|
+
n({
|
|
728
|
+
scrollHeight: g,
|
|
729
|
+
scrollTop: Math.max(E, 0),
|
|
730
|
+
viewportHeight: d
|
|
731
|
+
}), s?.(
|
|
732
|
+
l ? go("column-gap", getComputedStyle(m).columnGap, r) : go("row-gap", getComputedStyle(m).rowGap, r)
|
|
733
|
+
), T !== null && e(T);
|
|
734
|
+
},
|
|
735
|
+
[e, t, r, s, i, n, l]
|
|
736
|
+
);
|
|
737
|
+
return Yt(c, o, a);
|
|
738
|
+
}
|
|
739
|
+
function qn(e, t, o, n) {
|
|
740
|
+
const r = e.length;
|
|
741
|
+
if (r === 0)
|
|
742
|
+
return null;
|
|
743
|
+
const s = [];
|
|
744
|
+
for (let i = 0; i < r; i++) {
|
|
745
|
+
const l = e.item(i);
|
|
746
|
+
if (l.dataset.index === void 0)
|
|
747
|
+
continue;
|
|
748
|
+
const a = parseInt(l.dataset.index), c = parseFloat(l.dataset.knownSize), m = t(l, o);
|
|
749
|
+
if (m === 0 && n("Zero-sized element, this should not happen", { child: l }, ye.ERROR), m === c)
|
|
750
|
+
continue;
|
|
751
|
+
const T = s[s.length - 1];
|
|
752
|
+
s.length === 0 || T.size !== m || T.endIndex !== a - 1 ? s.push({ endIndex: a, size: m, startIndex: a }) : s[s.length - 1].endIndex++;
|
|
753
|
+
}
|
|
754
|
+
return s;
|
|
755
|
+
}
|
|
756
|
+
function go(e, t, o) {
|
|
757
|
+
return t !== "normal" && !(t != null && t.endsWith("px")) && o(`${e} was not resolved to pixel value correctly`, t, ye.WARN), t === "normal" ? 0 : parseInt(t ?? "0", 10);
|
|
758
|
+
}
|
|
759
|
+
function Vo(e, t, o) {
|
|
760
|
+
const n = P.useRef(null), r = P.useCallback(
|
|
761
|
+
(a) => {
|
|
762
|
+
if (!(a != null && a.offsetParent))
|
|
763
|
+
return;
|
|
764
|
+
const c = a.getBoundingClientRect(), m = c.width;
|
|
765
|
+
let T, p;
|
|
766
|
+
if (t) {
|
|
767
|
+
const x = t.getBoundingClientRect(), b = c.top - x.top;
|
|
768
|
+
p = x.height - Math.max(0, b), T = b + t.scrollTop;
|
|
769
|
+
} else {
|
|
770
|
+
const x = i.current.ownerDocument.defaultView;
|
|
771
|
+
p = x.innerHeight - Math.max(0, c.top), T = c.top + x.scrollY;
|
|
772
|
+
}
|
|
773
|
+
n.current = {
|
|
774
|
+
offsetTop: T,
|
|
775
|
+
visibleHeight: p,
|
|
776
|
+
visibleWidth: m
|
|
777
|
+
}, e(n.current);
|
|
778
|
+
},
|
|
779
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
780
|
+
[e, t]
|
|
781
|
+
), { callbackRef: s, ref: i } = Yt(r, !0, o), l = P.useCallback(() => {
|
|
782
|
+
r(i.current);
|
|
783
|
+
}, [r, i]);
|
|
784
|
+
return P.useEffect(() => {
|
|
785
|
+
var a;
|
|
786
|
+
if (t) {
|
|
787
|
+
t.addEventListener("scroll", l);
|
|
788
|
+
const c = new ResizeObserver(() => {
|
|
789
|
+
requestAnimationFrame(l);
|
|
790
|
+
});
|
|
791
|
+
return c.observe(t), () => {
|
|
792
|
+
t.removeEventListener("scroll", l), c.unobserve(t);
|
|
793
|
+
};
|
|
794
|
+
} else {
|
|
795
|
+
const c = (a = i.current) == null ? void 0 : a.ownerDocument.defaultView;
|
|
796
|
+
return c?.addEventListener("scroll", l), c?.addEventListener("resize", l), () => {
|
|
797
|
+
c?.removeEventListener("scroll", l), c?.removeEventListener("resize", l);
|
|
798
|
+
};
|
|
799
|
+
}
|
|
800
|
+
}, [l, t, i]), s;
|
|
801
|
+
}
|
|
802
|
+
const be = J(
|
|
803
|
+
() => {
|
|
804
|
+
const e = Y(), t = Y(), o = S(0), n = Y(), r = S(0), s = Y(), i = Y(), l = S(0), a = S(0), c = S(0), m = S(0), T = Y(), p = Y(), x = S(!1), b = S(!1), E = S(!1);
|
|
805
|
+
return B(
|
|
806
|
+
w(
|
|
807
|
+
e,
|
|
808
|
+
j(({ scrollTop: g }) => g)
|
|
809
|
+
),
|
|
810
|
+
t
|
|
811
|
+
), B(
|
|
812
|
+
w(
|
|
813
|
+
e,
|
|
814
|
+
j(({ scrollHeight: g }) => g)
|
|
815
|
+
),
|
|
816
|
+
i
|
|
817
|
+
), B(t, r), {
|
|
818
|
+
deviation: o,
|
|
819
|
+
fixedFooterHeight: c,
|
|
820
|
+
fixedHeaderHeight: a,
|
|
821
|
+
footerHeight: m,
|
|
822
|
+
headerHeight: l,
|
|
823
|
+
horizontalDirection: b,
|
|
824
|
+
scrollBy: p,
|
|
825
|
+
// input
|
|
826
|
+
scrollContainerState: e,
|
|
827
|
+
scrollHeight: i,
|
|
828
|
+
scrollingInProgress: x,
|
|
829
|
+
// signals
|
|
830
|
+
scrollTo: T,
|
|
831
|
+
scrollTop: t,
|
|
832
|
+
skipAnimationFrameInResizeObserver: E,
|
|
833
|
+
smoothScrollTargetReached: n,
|
|
834
|
+
// state
|
|
835
|
+
statefulScrollTop: r,
|
|
836
|
+
viewportHeight: s
|
|
837
|
+
};
|
|
838
|
+
},
|
|
839
|
+
[],
|
|
840
|
+
{ singleton: !0 }
|
|
841
|
+
), st = { lvl: 0 };
|
|
842
|
+
function $o(e, t) {
|
|
843
|
+
const o = e.length;
|
|
844
|
+
if (o === 0)
|
|
845
|
+
return [];
|
|
846
|
+
let { index: n, value: r } = t(e[0]);
|
|
847
|
+
const s = [];
|
|
848
|
+
for (let i = 1; i < o; i++) {
|
|
849
|
+
const { index: l, value: a } = t(e[i]);
|
|
850
|
+
s.push({ end: l - 1, start: n, value: r }), n = l, r = a;
|
|
851
|
+
}
|
|
852
|
+
return s.push({ end: 1 / 0, start: n, value: r }), s;
|
|
853
|
+
}
|
|
854
|
+
function oe(e) {
|
|
855
|
+
return e === st;
|
|
856
|
+
}
|
|
857
|
+
function it(e, t) {
|
|
858
|
+
if (!oe(e))
|
|
859
|
+
return t === e.k ? e.v : t < e.k ? it(e.l, t) : it(e.r, t);
|
|
860
|
+
}
|
|
861
|
+
function He(e, t, o = "k") {
|
|
862
|
+
if (oe(e))
|
|
863
|
+
return [-1 / 0, void 0];
|
|
864
|
+
if (Number(e[o]) === t)
|
|
865
|
+
return [e.k, e.v];
|
|
866
|
+
if (Number(e[o]) < t) {
|
|
867
|
+
const n = He(e.r, t, o);
|
|
868
|
+
return n[0] === -1 / 0 ? [e.k, e.v] : n;
|
|
869
|
+
}
|
|
870
|
+
return He(e.l, t, o);
|
|
871
|
+
}
|
|
872
|
+
function Ce(e, t, o) {
|
|
873
|
+
return oe(e) ? Yo(t, o, 1) : t === e.k ? me(e, { k: t, v: o }) : t < e.k ? xo(me(e, { l: Ce(e.l, t, o) })) : xo(me(e, { r: Ce(e.r, t, o) }));
|
|
874
|
+
}
|
|
875
|
+
function Xe() {
|
|
876
|
+
return st;
|
|
877
|
+
}
|
|
878
|
+
function Ze(e, t, o) {
|
|
879
|
+
if (oe(e))
|
|
880
|
+
return [];
|
|
881
|
+
const n = He(e, t)[0];
|
|
882
|
+
return Jn(Wt(e, n, o));
|
|
883
|
+
}
|
|
884
|
+
function Nt(e, t) {
|
|
885
|
+
if (oe(e)) return st;
|
|
886
|
+
const { k: o, l: n, r } = e;
|
|
887
|
+
if (t === o) {
|
|
888
|
+
if (oe(n))
|
|
889
|
+
return r;
|
|
890
|
+
if (oe(r))
|
|
891
|
+
return n;
|
|
892
|
+
{
|
|
893
|
+
const [s, i] = Go(n);
|
|
894
|
+
return It(me(e, { k: s, l: Uo(n), v: i }));
|
|
895
|
+
}
|
|
896
|
+
} else return t < o ? It(me(e, { l: Nt(n, t) })) : It(me(e, { r: Nt(r, t) }));
|
|
897
|
+
}
|
|
898
|
+
function Ue(e) {
|
|
899
|
+
return oe(e) ? [] : [...Ue(e.l), { k: e.k, v: e.v }, ...Ue(e.r)];
|
|
900
|
+
}
|
|
901
|
+
function Wt(e, t, o) {
|
|
902
|
+
if (oe(e))
|
|
903
|
+
return [];
|
|
904
|
+
const { k: n, l: r, r: s, v: i } = e;
|
|
905
|
+
let l = [];
|
|
906
|
+
return n > t && (l = l.concat(Wt(r, t, o))), n >= t && n <= o && l.push({ k: n, v: i }), n <= o && (l = l.concat(Wt(s, t, o))), l;
|
|
907
|
+
}
|
|
908
|
+
function It(e) {
|
|
909
|
+
const { l: t, lvl: o, r: n } = e;
|
|
910
|
+
if (n.lvl >= o - 1 && t.lvl >= o - 1)
|
|
911
|
+
return e;
|
|
912
|
+
if (o > n.lvl + 1) {
|
|
913
|
+
if (Ht(t))
|
|
914
|
+
return qo(me(e, { lvl: o - 1 }));
|
|
915
|
+
if (!oe(t) && !oe(t.r))
|
|
916
|
+
return me(t.r, {
|
|
917
|
+
l: me(t, { r: t.r.l }),
|
|
918
|
+
lvl: o,
|
|
919
|
+
r: me(e, {
|
|
920
|
+
l: t.r.r,
|
|
921
|
+
lvl: o - 1
|
|
922
|
+
})
|
|
923
|
+
});
|
|
924
|
+
throw new Error("Unexpected empty nodes");
|
|
925
|
+
} else {
|
|
926
|
+
if (Ht(e))
|
|
927
|
+
return Ft(me(e, { lvl: o - 1 }));
|
|
928
|
+
if (!oe(n) && !oe(n.l)) {
|
|
929
|
+
const r = n.l, s = Ht(r) ? n.lvl - 1 : n.lvl;
|
|
930
|
+
return me(r, {
|
|
931
|
+
l: me(e, {
|
|
932
|
+
lvl: o - 1,
|
|
933
|
+
r: r.l
|
|
934
|
+
}),
|
|
935
|
+
lvl: r.lvl + 1,
|
|
936
|
+
r: Ft(me(n, { l: r.r, lvl: s }))
|
|
937
|
+
});
|
|
938
|
+
} else
|
|
939
|
+
throw new Error("Unexpected empty nodes");
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
function me(e, t) {
|
|
943
|
+
return Yo(
|
|
944
|
+
t.k !== void 0 ? t.k : e.k,
|
|
945
|
+
t.v !== void 0 ? t.v : e.v,
|
|
946
|
+
t.lvl !== void 0 ? t.lvl : e.lvl,
|
|
947
|
+
t.l !== void 0 ? t.l : e.l,
|
|
948
|
+
t.r !== void 0 ? t.r : e.r
|
|
949
|
+
);
|
|
950
|
+
}
|
|
951
|
+
function Uo(e) {
|
|
952
|
+
return oe(e.r) ? e.l : It(me(e, { r: Uo(e.r) }));
|
|
953
|
+
}
|
|
954
|
+
function Ht(e) {
|
|
955
|
+
return oe(e) || e.lvl > e.r.lvl;
|
|
956
|
+
}
|
|
957
|
+
function Go(e) {
|
|
958
|
+
return oe(e.r) ? [e.k, e.v] : Go(e.r);
|
|
959
|
+
}
|
|
960
|
+
function Yo(e, t, o, n = st, r = st) {
|
|
961
|
+
return { k: e, l: n, lvl: o, r, v: t };
|
|
962
|
+
}
|
|
963
|
+
function xo(e) {
|
|
964
|
+
return Ft(qo(e));
|
|
965
|
+
}
|
|
966
|
+
function qo(e) {
|
|
967
|
+
const { l: t } = e;
|
|
968
|
+
return !oe(t) && t.lvl === e.lvl ? me(t, { r: me(e, { l: t.r }) }) : e;
|
|
969
|
+
}
|
|
970
|
+
function Ft(e) {
|
|
971
|
+
const { lvl: t, r: o } = e;
|
|
972
|
+
return !oe(o) && !oe(o.r) && o.lvl === t && o.r.lvl === t ? me(o, { l: me(e, { r: o.l }), lvl: t + 1 }) : e;
|
|
973
|
+
}
|
|
974
|
+
function Jn(e) {
|
|
975
|
+
return $o(e, ({ k: t, v: o }) => ({ index: t, value: o }));
|
|
976
|
+
}
|
|
977
|
+
function Jo(e, t) {
|
|
978
|
+
return !!(e && e.startIndex === t.startIndex && e.endIndex === t.endIndex);
|
|
979
|
+
}
|
|
980
|
+
function lt(e, t) {
|
|
981
|
+
return !!(e && e[0] === t[0] && e[1] === t[1]);
|
|
982
|
+
}
|
|
983
|
+
const qt = J(
|
|
984
|
+
() => ({ recalcInProgress: S(!1) }),
|
|
985
|
+
[],
|
|
986
|
+
{ singleton: !0 }
|
|
987
|
+
);
|
|
988
|
+
function Xo(e, t, o) {
|
|
989
|
+
return e[bt(e, t, o)];
|
|
990
|
+
}
|
|
991
|
+
function bt(e, t, o, n = 0) {
|
|
992
|
+
let r = e.length - 1;
|
|
993
|
+
for (; n <= r; ) {
|
|
994
|
+
const s = Math.floor((n + r) / 2), i = e[s], l = o(i, t);
|
|
995
|
+
if (l === 0)
|
|
996
|
+
return s;
|
|
997
|
+
if (l === -1) {
|
|
998
|
+
if (r - n < 2)
|
|
999
|
+
return s - 1;
|
|
1000
|
+
r = s - 1;
|
|
1001
|
+
} else {
|
|
1002
|
+
if (r === n)
|
|
1003
|
+
return s;
|
|
1004
|
+
n = s + 1;
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`);
|
|
1008
|
+
}
|
|
1009
|
+
function Xn(e, t, o, n) {
|
|
1010
|
+
const r = bt(e, t, n), s = bt(e, o, n, r);
|
|
1011
|
+
return e.slice(r, s + 1);
|
|
1012
|
+
}
|
|
1013
|
+
function Fe(e, t) {
|
|
1014
|
+
return Math.round(e.getBoundingClientRect()[t]);
|
|
1015
|
+
}
|
|
1016
|
+
function zt(e) {
|
|
1017
|
+
return !oe(e.groupOffsetTree);
|
|
1018
|
+
}
|
|
1019
|
+
function Jt({ index: e }, t) {
|
|
1020
|
+
return t === e ? 0 : t < e ? -1 : 1;
|
|
1021
|
+
}
|
|
1022
|
+
function Zn() {
|
|
1023
|
+
return {
|
|
1024
|
+
groupIndices: [],
|
|
1025
|
+
groupOffsetTree: Xe(),
|
|
1026
|
+
lastIndex: 0,
|
|
1027
|
+
lastOffset: 0,
|
|
1028
|
+
lastSize: 0,
|
|
1029
|
+
offsetTree: [],
|
|
1030
|
+
sizeTree: Xe()
|
|
1031
|
+
};
|
|
1032
|
+
}
|
|
1033
|
+
function Kn(e, t) {
|
|
1034
|
+
let o = oe(e) ? 0 : 1 / 0;
|
|
1035
|
+
for (const n of t) {
|
|
1036
|
+
const { endIndex: r, size: s, startIndex: i } = n;
|
|
1037
|
+
if (o = Math.min(o, i), oe(e)) {
|
|
1038
|
+
e = Ce(e, 0, s);
|
|
1039
|
+
continue;
|
|
1040
|
+
}
|
|
1041
|
+
const l = Ze(e, i - 1, r + 1);
|
|
1042
|
+
if (l.some(sr(n)))
|
|
1043
|
+
continue;
|
|
1044
|
+
let a = !1, c = !1;
|
|
1045
|
+
for (const { end: m, start: T, value: p } of l)
|
|
1046
|
+
a ? (r >= T || s === p) && (e = Nt(e, T)) : (c = p !== s, a = !0), m > r && r >= T && p !== s && (e = Ce(e, r + 1, p));
|
|
1047
|
+
c && (e = Ce(e, i, s));
|
|
1048
|
+
}
|
|
1049
|
+
return [e, o];
|
|
1050
|
+
}
|
|
1051
|
+
function Qn(e) {
|
|
1052
|
+
return typeof e.groupIndex < "u";
|
|
1053
|
+
}
|
|
1054
|
+
function er({ offset: e }, t) {
|
|
1055
|
+
return t === e ? 0 : t < e ? -1 : 1;
|
|
1056
|
+
}
|
|
1057
|
+
function at(e, t, o) {
|
|
1058
|
+
if (t.length === 0)
|
|
1059
|
+
return 0;
|
|
1060
|
+
const { index: n, offset: r, size: s } = Xo(t, e, Jt), i = e - n, l = s * i + (i - 1) * o + r;
|
|
1061
|
+
return l > 0 ? l + o : l;
|
|
1062
|
+
}
|
|
1063
|
+
function Zo(e, t) {
|
|
1064
|
+
if (!zt(t))
|
|
1065
|
+
return e;
|
|
1066
|
+
let o = 0;
|
|
1067
|
+
for (; t.groupIndices[o] <= e + o; )
|
|
1068
|
+
o++;
|
|
1069
|
+
return e + o;
|
|
1070
|
+
}
|
|
1071
|
+
function Ko(e, t, o) {
|
|
1072
|
+
if (Qn(e))
|
|
1073
|
+
return t.groupIndices[e.groupIndex] + 1;
|
|
1074
|
+
{
|
|
1075
|
+
const n = e.index === "LAST" ? o : e.index;
|
|
1076
|
+
let r = Zo(n, t);
|
|
1077
|
+
return r = Math.max(0, r, Math.min(o, r)), r;
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1080
|
+
function tr(e, t, o, n = 0) {
|
|
1081
|
+
return n > 0 && (t = Math.max(t, Xo(e, n, Jt).offset)), $o(Xn(e, t, o, er), rr);
|
|
1082
|
+
}
|
|
1083
|
+
function or(e, [t, o, n, r]) {
|
|
1084
|
+
t.length > 0 && n("received item sizes", t, ye.DEBUG);
|
|
1085
|
+
const s = e.sizeTree;
|
|
1086
|
+
let i = s, l = 0;
|
|
1087
|
+
if (o.length > 0 && oe(s) && t.length === 2) {
|
|
1088
|
+
const p = t[0].size, x = t[1].size;
|
|
1089
|
+
i = o.reduce((b, E) => Ce(Ce(b, E, p), E + 1, x), i);
|
|
1090
|
+
} else
|
|
1091
|
+
[i, l] = Kn(i, t);
|
|
1092
|
+
if (i === s)
|
|
1093
|
+
return e;
|
|
1094
|
+
const { lastIndex: a, lastOffset: c, lastSize: m, offsetTree: T } = Dt(e.offsetTree, l, i, r);
|
|
1095
|
+
return {
|
|
1096
|
+
groupIndices: o,
|
|
1097
|
+
groupOffsetTree: o.reduce((p, x) => Ce(p, x, at(x, T, r)), Xe()),
|
|
1098
|
+
lastIndex: a,
|
|
1099
|
+
lastOffset: c,
|
|
1100
|
+
lastSize: m,
|
|
1101
|
+
offsetTree: T,
|
|
1102
|
+
sizeTree: i
|
|
1103
|
+
};
|
|
1104
|
+
}
|
|
1105
|
+
function nr(e) {
|
|
1106
|
+
return Ue(e).map(({ k: t, v: o }, n, r) => {
|
|
1107
|
+
const s = r[n + 1];
|
|
1108
|
+
return { endIndex: s ? s.k - 1 : 1 / 0, size: o, startIndex: t };
|
|
1109
|
+
});
|
|
1110
|
+
}
|
|
1111
|
+
function vo(e, t) {
|
|
1112
|
+
let o = 0, n = 0;
|
|
1113
|
+
for (; o < e; )
|
|
1114
|
+
o += t[n + 1] - t[n] - 1, n++;
|
|
1115
|
+
return n - (o === e ? 0 : 1);
|
|
1116
|
+
}
|
|
1117
|
+
function Dt(e, t, o, n) {
|
|
1118
|
+
let r = e, s = 0, i = 0, l = 0, a = 0;
|
|
1119
|
+
if (t !== 0) {
|
|
1120
|
+
a = bt(r, t - 1, Jt), l = r[a].offset;
|
|
1121
|
+
const c = He(o, t - 1);
|
|
1122
|
+
s = c[0], i = c[1], r.length && r[a].size === He(o, t)[1] && (a -= 1), r = r.slice(0, a + 1);
|
|
1123
|
+
} else
|
|
1124
|
+
r = [];
|
|
1125
|
+
for (const { start: c, value: m } of Ze(o, t, 1 / 0)) {
|
|
1126
|
+
const T = c - s, p = T * i + l + T * n;
|
|
1127
|
+
r.push({
|
|
1128
|
+
index: c,
|
|
1129
|
+
offset: p,
|
|
1130
|
+
size: m
|
|
1131
|
+
}), s = c, l = p, i = m;
|
|
1132
|
+
}
|
|
1133
|
+
return {
|
|
1134
|
+
lastIndex: s,
|
|
1135
|
+
lastOffset: l,
|
|
1136
|
+
lastSize: i,
|
|
1137
|
+
offsetTree: r
|
|
1138
|
+
};
|
|
1139
|
+
}
|
|
1140
|
+
function rr(e) {
|
|
1141
|
+
return { index: e.index, value: e };
|
|
1142
|
+
}
|
|
1143
|
+
function sr(e) {
|
|
1144
|
+
const { endIndex: t, size: o, startIndex: n } = e;
|
|
1145
|
+
return (r) => r.start === n && (r.end === t || r.end === 1 / 0) && r.value === o;
|
|
1146
|
+
}
|
|
1147
|
+
const ir = {
|
|
1148
|
+
offsetHeight: "height",
|
|
1149
|
+
offsetWidth: "width"
|
|
1150
|
+
}, Me = J(
|
|
1151
|
+
([{ log: e }, { recalcInProgress: t }]) => {
|
|
1152
|
+
const o = Y(), n = Y(), r = Se(n, 0), s = Y(), i = Y(), l = S(0), a = S([]), c = S(void 0), m = S(void 0), T = S(void 0), p = S(void 0), x = S((u, v) => Fe(u, ir[v])), b = S(void 0), E = S(0), g = Zn(), d = Se(
|
|
1153
|
+
w(o, U(a, e, E), _e(or, g), se()),
|
|
1154
|
+
g
|
|
1155
|
+
), f = Se(
|
|
1156
|
+
w(
|
|
1157
|
+
a,
|
|
1158
|
+
se(),
|
|
1159
|
+
_e((u, v) => ({ current: v, prev: u.current }), {
|
|
1160
|
+
current: [],
|
|
1161
|
+
prev: []
|
|
1162
|
+
}),
|
|
1163
|
+
j(({ prev: u }) => u)
|
|
1164
|
+
),
|
|
1165
|
+
[]
|
|
1166
|
+
);
|
|
1167
|
+
B(
|
|
1168
|
+
w(
|
|
1169
|
+
a,
|
|
1170
|
+
W((u) => u.length > 0),
|
|
1171
|
+
U(d, E),
|
|
1172
|
+
j(([u, v, y]) => {
|
|
1173
|
+
const z = u.reduce((A, F, D) => Ce(A, F, at(F, v.offsetTree, y) || D), Xe());
|
|
1174
|
+
return {
|
|
1175
|
+
...v,
|
|
1176
|
+
groupIndices: u,
|
|
1177
|
+
groupOffsetTree: z
|
|
1178
|
+
};
|
|
1179
|
+
})
|
|
1180
|
+
),
|
|
1181
|
+
d
|
|
1182
|
+
), B(
|
|
1183
|
+
w(
|
|
1184
|
+
n,
|
|
1185
|
+
U(d),
|
|
1186
|
+
W(([u, { lastIndex: v }]) => u < v),
|
|
1187
|
+
j(([u, { lastIndex: v, lastSize: y }]) => [
|
|
1188
|
+
{
|
|
1189
|
+
endIndex: v,
|
|
1190
|
+
size: y,
|
|
1191
|
+
startIndex: u
|
|
1192
|
+
}
|
|
1193
|
+
])
|
|
1194
|
+
),
|
|
1195
|
+
o
|
|
1196
|
+
), B(c, m);
|
|
1197
|
+
const I = Se(
|
|
1198
|
+
w(
|
|
1199
|
+
c,
|
|
1200
|
+
j((u) => u === void 0)
|
|
1201
|
+
),
|
|
1202
|
+
!0
|
|
1203
|
+
);
|
|
1204
|
+
B(
|
|
1205
|
+
w(
|
|
1206
|
+
m,
|
|
1207
|
+
W((u) => u !== void 0 && oe(ae(d).sizeTree)),
|
|
1208
|
+
j((u) => {
|
|
1209
|
+
const v = ae(T), y = ae(a).length > 0;
|
|
1210
|
+
return v ? y ? [
|
|
1211
|
+
{ endIndex: 0, size: v, startIndex: 0 },
|
|
1212
|
+
{ endIndex: 1, size: u, startIndex: 1 }
|
|
1213
|
+
] : [] : [{ endIndex: 0, size: u, startIndex: 0 }];
|
|
1214
|
+
})
|
|
1215
|
+
),
|
|
1216
|
+
o
|
|
1217
|
+
), B(
|
|
1218
|
+
w(
|
|
1219
|
+
p,
|
|
1220
|
+
W((u) => u !== void 0 && u.length > 0 && oe(ae(d).sizeTree)),
|
|
1221
|
+
j((u) => {
|
|
1222
|
+
const v = [];
|
|
1223
|
+
let y = u[0], z = 0;
|
|
1224
|
+
for (let A = 1; A < u.length; A++) {
|
|
1225
|
+
const F = u[A];
|
|
1226
|
+
F !== y && (v.push({
|
|
1227
|
+
endIndex: A - 1,
|
|
1228
|
+
size: y,
|
|
1229
|
+
startIndex: z
|
|
1230
|
+
}), y = F, z = A);
|
|
1231
|
+
}
|
|
1232
|
+
return v.push({
|
|
1233
|
+
endIndex: u.length - 1,
|
|
1234
|
+
size: y,
|
|
1235
|
+
startIndex: z
|
|
1236
|
+
}), v;
|
|
1237
|
+
})
|
|
1238
|
+
),
|
|
1239
|
+
o
|
|
1240
|
+
), B(
|
|
1241
|
+
w(
|
|
1242
|
+
a,
|
|
1243
|
+
U(T, m),
|
|
1244
|
+
W(([, u, v]) => u !== void 0 && v !== void 0),
|
|
1245
|
+
j(([u, v, y]) => {
|
|
1246
|
+
const z = [];
|
|
1247
|
+
for (let A = 0; A < u.length; A++) {
|
|
1248
|
+
const F = u[A], D = u[A + 1];
|
|
1249
|
+
z.push({
|
|
1250
|
+
startIndex: F,
|
|
1251
|
+
endIndex: F,
|
|
1252
|
+
size: v
|
|
1253
|
+
}), D !== void 0 && z.push({
|
|
1254
|
+
startIndex: F + 1,
|
|
1255
|
+
endIndex: D - 1,
|
|
1256
|
+
size: y
|
|
1257
|
+
});
|
|
1258
|
+
}
|
|
1259
|
+
return z;
|
|
1260
|
+
})
|
|
1261
|
+
),
|
|
1262
|
+
o
|
|
1263
|
+
);
|
|
1264
|
+
const O = Re(
|
|
1265
|
+
w(
|
|
1266
|
+
o,
|
|
1267
|
+
U(d),
|
|
1268
|
+
_e(
|
|
1269
|
+
({ sizes: u }, [v, y]) => ({
|
|
1270
|
+
changed: y !== u,
|
|
1271
|
+
sizes: y
|
|
1272
|
+
}),
|
|
1273
|
+
{ changed: !1, sizes: g }
|
|
1274
|
+
),
|
|
1275
|
+
j((u) => u.changed)
|
|
1276
|
+
)
|
|
1277
|
+
);
|
|
1278
|
+
Z(
|
|
1279
|
+
w(
|
|
1280
|
+
l,
|
|
1281
|
+
_e(
|
|
1282
|
+
(u, v) => ({ diff: u.prev - v, prev: v }),
|
|
1283
|
+
{ diff: 0, prev: 0 }
|
|
1284
|
+
),
|
|
1285
|
+
j((u) => u.diff)
|
|
1286
|
+
),
|
|
1287
|
+
(u) => {
|
|
1288
|
+
const { groupIndices: v } = ae(d);
|
|
1289
|
+
if (u > 0)
|
|
1290
|
+
$(t, !0), $(s, u + vo(u, v));
|
|
1291
|
+
else if (u < 0) {
|
|
1292
|
+
const y = ae(f);
|
|
1293
|
+
y.length > 0 && (u -= vo(-u, y)), $(i, u);
|
|
1294
|
+
}
|
|
1295
|
+
}
|
|
1296
|
+
), Z(w(l, U(e)), ([u, v]) => {
|
|
1297
|
+
u < 0 && v(
|
|
1298
|
+
"`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",
|
|
1299
|
+
{ firstItemIndex: l },
|
|
1300
|
+
ye.ERROR
|
|
1301
|
+
);
|
|
1302
|
+
});
|
|
1303
|
+
const k = Re(s);
|
|
1304
|
+
B(
|
|
1305
|
+
w(
|
|
1306
|
+
s,
|
|
1307
|
+
U(d),
|
|
1308
|
+
j(([u, v]) => {
|
|
1309
|
+
const y = v.groupIndices.length > 0, z = [], A = v.lastSize;
|
|
1310
|
+
if (y) {
|
|
1311
|
+
const F = it(v.sizeTree, 0);
|
|
1312
|
+
let D = 0, _ = 0;
|
|
1313
|
+
for (; D < u; ) {
|
|
1314
|
+
const X = v.groupIndices[_], K = v.groupIndices.length === _ + 1 ? 1 / 0 : v.groupIndices[_ + 1] - X - 1;
|
|
1315
|
+
z.push({
|
|
1316
|
+
endIndex: X,
|
|
1317
|
+
size: F,
|
|
1318
|
+
startIndex: X
|
|
1319
|
+
}), z.push({
|
|
1320
|
+
endIndex: X + 1 + K - 1,
|
|
1321
|
+
size: A,
|
|
1322
|
+
startIndex: X + 1
|
|
1323
|
+
}), _++, D += K + 1;
|
|
1324
|
+
}
|
|
1325
|
+
const V = Ue(v.sizeTree);
|
|
1326
|
+
return D !== u && V.shift(), V.reduce(
|
|
1327
|
+
(X, { k: K, v: ve }) => {
|
|
1328
|
+
let we = X.ranges;
|
|
1329
|
+
return X.prevSize !== 0 && (we = [
|
|
1330
|
+
...X.ranges,
|
|
1331
|
+
{
|
|
1332
|
+
endIndex: K + u - 1,
|
|
1333
|
+
size: X.prevSize,
|
|
1334
|
+
startIndex: X.prevIndex
|
|
1335
|
+
}
|
|
1336
|
+
]), {
|
|
1337
|
+
prevIndex: K + u,
|
|
1338
|
+
prevSize: ve,
|
|
1339
|
+
ranges: we
|
|
1340
|
+
};
|
|
1341
|
+
},
|
|
1342
|
+
{
|
|
1343
|
+
prevIndex: u,
|
|
1344
|
+
prevSize: 0,
|
|
1345
|
+
ranges: z
|
|
1346
|
+
}
|
|
1347
|
+
).ranges;
|
|
1348
|
+
}
|
|
1349
|
+
return Ue(v.sizeTree).reduce(
|
|
1350
|
+
(F, { k: D, v: _ }) => ({
|
|
1351
|
+
prevIndex: D + u,
|
|
1352
|
+
prevSize: _,
|
|
1353
|
+
ranges: [...F.ranges, { endIndex: D + u - 1, size: F.prevSize, startIndex: F.prevIndex }]
|
|
1354
|
+
}),
|
|
1355
|
+
{
|
|
1356
|
+
prevIndex: 0,
|
|
1357
|
+
prevSize: A,
|
|
1358
|
+
ranges: []
|
|
1359
|
+
}
|
|
1360
|
+
).ranges;
|
|
1361
|
+
})
|
|
1362
|
+
),
|
|
1363
|
+
o
|
|
1364
|
+
);
|
|
1365
|
+
const H = Re(
|
|
1366
|
+
w(
|
|
1367
|
+
i,
|
|
1368
|
+
U(d, E),
|
|
1369
|
+
j(([u, { offsetTree: v }, y]) => {
|
|
1370
|
+
const z = -u;
|
|
1371
|
+
return at(z, v, y);
|
|
1372
|
+
})
|
|
1373
|
+
)
|
|
1374
|
+
);
|
|
1375
|
+
return B(
|
|
1376
|
+
w(
|
|
1377
|
+
i,
|
|
1378
|
+
U(d, E),
|
|
1379
|
+
j(([u, v, y]) => {
|
|
1380
|
+
if (v.groupIndices.length > 0) {
|
|
1381
|
+
if (oe(v.sizeTree))
|
|
1382
|
+
return v;
|
|
1383
|
+
let z = Xe();
|
|
1384
|
+
const A = ae(f);
|
|
1385
|
+
let F = 0, D = 0, _ = 0;
|
|
1386
|
+
for (; F < -u; ) {
|
|
1387
|
+
_ = A[D];
|
|
1388
|
+
const V = A[D + 1] - _ - 1;
|
|
1389
|
+
D++, F += V + 1;
|
|
1390
|
+
}
|
|
1391
|
+
if (z = Ue(v.sizeTree).reduce((V, { k: X, v: K }) => Ce(V, Math.max(0, X + u), K), z), F !== -u) {
|
|
1392
|
+
const V = it(v.sizeTree, _);
|
|
1393
|
+
z = Ce(z, 0, V);
|
|
1394
|
+
const X = He(v.sizeTree, -u + 1)[1];
|
|
1395
|
+
z = Ce(z, 1, X);
|
|
1396
|
+
}
|
|
1397
|
+
return {
|
|
1398
|
+
...v,
|
|
1399
|
+
sizeTree: z,
|
|
1400
|
+
...Dt(v.offsetTree, 0, z, y)
|
|
1401
|
+
};
|
|
1402
|
+
} else {
|
|
1403
|
+
const z = Ue(v.sizeTree).reduce((A, { k: F, v: D }) => Ce(A, Math.max(0, F + u), D), Xe());
|
|
1404
|
+
return {
|
|
1405
|
+
...v,
|
|
1406
|
+
sizeTree: z,
|
|
1407
|
+
...Dt(v.offsetTree, 0, z, y)
|
|
1408
|
+
};
|
|
1409
|
+
}
|
|
1410
|
+
})
|
|
1411
|
+
),
|
|
1412
|
+
d
|
|
1413
|
+
), {
|
|
1414
|
+
beforeUnshiftWith: k,
|
|
1415
|
+
// input
|
|
1416
|
+
data: b,
|
|
1417
|
+
defaultItemSize: m,
|
|
1418
|
+
firstItemIndex: l,
|
|
1419
|
+
fixedItemSize: c,
|
|
1420
|
+
fixedGroupSize: T,
|
|
1421
|
+
gap: E,
|
|
1422
|
+
groupIndices: a,
|
|
1423
|
+
heightEstimates: p,
|
|
1424
|
+
itemSize: x,
|
|
1425
|
+
listRefresh: O,
|
|
1426
|
+
shiftWith: i,
|
|
1427
|
+
shiftWithOffset: H,
|
|
1428
|
+
sizeRanges: o,
|
|
1429
|
+
// output
|
|
1430
|
+
sizes: d,
|
|
1431
|
+
statefulTotalCount: r,
|
|
1432
|
+
totalCount: n,
|
|
1433
|
+
trackItemSizes: I,
|
|
1434
|
+
unshiftWith: s
|
|
1435
|
+
};
|
|
1436
|
+
},
|
|
1437
|
+
ie(Le, qt),
|
|
1438
|
+
{ singleton: !0 }
|
|
1439
|
+
);
|
|
1440
|
+
function lr(e) {
|
|
1441
|
+
return e.reduce(
|
|
1442
|
+
(t, o) => (t.groupIndices.push(t.totalCount), t.totalCount += o + 1, t),
|
|
1443
|
+
{
|
|
1444
|
+
groupIndices: [],
|
|
1445
|
+
totalCount: 0
|
|
1446
|
+
}
|
|
1447
|
+
);
|
|
1448
|
+
}
|
|
1449
|
+
const Qo = J(
|
|
1450
|
+
([{ groupIndices: e, sizes: t, totalCount: o }, { headerHeight: n, scrollTop: r }]) => {
|
|
1451
|
+
const s = Y(), i = Y(), l = Re(w(s, j(lr)));
|
|
1452
|
+
return B(
|
|
1453
|
+
w(
|
|
1454
|
+
l,
|
|
1455
|
+
j((a) => a.totalCount)
|
|
1456
|
+
),
|
|
1457
|
+
o
|
|
1458
|
+
), B(
|
|
1459
|
+
w(
|
|
1460
|
+
l,
|
|
1461
|
+
j((a) => a.groupIndices)
|
|
1462
|
+
),
|
|
1463
|
+
e
|
|
1464
|
+
), B(
|
|
1465
|
+
w(
|
|
1466
|
+
de(r, t, n),
|
|
1467
|
+
W(([a, c]) => zt(c)),
|
|
1468
|
+
j(([a, c, m]) => He(c.groupOffsetTree, Math.max(a - m, 0), "v")[0]),
|
|
1469
|
+
se(),
|
|
1470
|
+
j((a) => [a])
|
|
1471
|
+
),
|
|
1472
|
+
i
|
|
1473
|
+
), { groupCounts: s, topItemsIndexes: i };
|
|
1474
|
+
},
|
|
1475
|
+
ie(Me, be)
|
|
1476
|
+
), Ve = J(
|
|
1477
|
+
([{ log: e }]) => {
|
|
1478
|
+
const t = S(!1), o = Re(
|
|
1479
|
+
w(
|
|
1480
|
+
t,
|
|
1481
|
+
W((n) => n),
|
|
1482
|
+
se()
|
|
1483
|
+
)
|
|
1484
|
+
);
|
|
1485
|
+
return Z(t, (n) => {
|
|
1486
|
+
n && ae(e)("props updated", {}, ye.DEBUG);
|
|
1487
|
+
}), { didMount: o, propsReady: t };
|
|
1488
|
+
},
|
|
1489
|
+
ie(Le),
|
|
1490
|
+
{ singleton: !0 }
|
|
1491
|
+
), ar = typeof document < "u" && "scrollBehavior" in document.documentElement.style;
|
|
1492
|
+
function en(e) {
|
|
1493
|
+
const t = typeof e == "number" ? { index: e } : e;
|
|
1494
|
+
return t.align || (t.align = "start"), (!t.behavior || !ar) && (t.behavior = "auto"), t.offset || (t.offset = 0), t;
|
|
1495
|
+
}
|
|
1496
|
+
const ft = J(
|
|
1497
|
+
([
|
|
1498
|
+
{ gap: e, listRefresh: t, sizes: o, totalCount: n },
|
|
1499
|
+
{
|
|
1500
|
+
fixedFooterHeight: r,
|
|
1501
|
+
fixedHeaderHeight: s,
|
|
1502
|
+
footerHeight: i,
|
|
1503
|
+
headerHeight: l,
|
|
1504
|
+
scrollingInProgress: a,
|
|
1505
|
+
scrollTo: c,
|
|
1506
|
+
smoothScrollTargetReached: m,
|
|
1507
|
+
viewportHeight: T
|
|
1508
|
+
},
|
|
1509
|
+
{ log: p }
|
|
1510
|
+
]) => {
|
|
1511
|
+
const x = Y(), b = Y(), E = S(0);
|
|
1512
|
+
let g = null, d = null, f = null;
|
|
1513
|
+
function I() {
|
|
1514
|
+
g && (g(), g = null), f && (f(), f = null), d && (clearTimeout(d), d = null), $(a, !1);
|
|
1515
|
+
}
|
|
1516
|
+
return B(
|
|
1517
|
+
w(
|
|
1518
|
+
x,
|
|
1519
|
+
U(o, T, n, E, l, i, p),
|
|
1520
|
+
U(e, s, r),
|
|
1521
|
+
j(
|
|
1522
|
+
([
|
|
1523
|
+
[O, k, H, u, v, y, z, A],
|
|
1524
|
+
F,
|
|
1525
|
+
D,
|
|
1526
|
+
_
|
|
1527
|
+
]) => {
|
|
1528
|
+
const V = en(O), { align: X, behavior: K, offset: ve } = V, we = u - 1, Te = Ko(V, k, we);
|
|
1529
|
+
let h = at(Te, k.offsetTree, F) + y;
|
|
1530
|
+
X === "end" ? (h += D + He(k.sizeTree, Te)[1] - H + _, Te === we && (h += z)) : X === "center" ? h += (D + He(k.sizeTree, Te)[1] - H + _) / 2 : h -= v, ve && (h += ve);
|
|
1531
|
+
const M = (q) => {
|
|
1532
|
+
I(), q ? (A("retrying to scroll to", { location: O }, ye.DEBUG), $(x, O)) : ($(b, !0), A("list did not change, scroll successful", {}, ye.DEBUG));
|
|
1533
|
+
};
|
|
1534
|
+
if (I(), K === "smooth") {
|
|
1535
|
+
let q = !1;
|
|
1536
|
+
f = Z(t, (Q) => {
|
|
1537
|
+
q = q || Q;
|
|
1538
|
+
}), g = Oe(m, () => {
|
|
1539
|
+
M(q);
|
|
1540
|
+
});
|
|
1541
|
+
} else
|
|
1542
|
+
g = Oe(w(t, cr(150)), M);
|
|
1543
|
+
return d = setTimeout(() => {
|
|
1544
|
+
I();
|
|
1545
|
+
}, 1200), $(a, !0), A("scrolling from index to", { behavior: K, index: Te, top: h }, ye.DEBUG), { behavior: K, top: h };
|
|
1546
|
+
}
|
|
1547
|
+
)
|
|
1548
|
+
),
|
|
1549
|
+
c
|
|
1550
|
+
), {
|
|
1551
|
+
scrollTargetReached: b,
|
|
1552
|
+
scrollToIndex: x,
|
|
1553
|
+
topListHeight: E
|
|
1554
|
+
};
|
|
1555
|
+
},
|
|
1556
|
+
ie(Me, be, Le),
|
|
1557
|
+
{ singleton: !0 }
|
|
1558
|
+
);
|
|
1559
|
+
function cr(e) {
|
|
1560
|
+
return (t) => {
|
|
1561
|
+
const o = setTimeout(() => {
|
|
1562
|
+
t(!1);
|
|
1563
|
+
}, e);
|
|
1564
|
+
return (n) => {
|
|
1565
|
+
n && (t(!0), clearTimeout(o));
|
|
1566
|
+
};
|
|
1567
|
+
};
|
|
1568
|
+
}
|
|
1569
|
+
function Xt(e, t) {
|
|
1570
|
+
e == 0 ? t() : requestAnimationFrame(() => {
|
|
1571
|
+
Xt(e - 1, t);
|
|
1572
|
+
});
|
|
1573
|
+
}
|
|
1574
|
+
function Zt(e, t) {
|
|
1575
|
+
const o = t - 1;
|
|
1576
|
+
return typeof e == "number" ? e : e.index === "LAST" ? o : e.index;
|
|
1577
|
+
}
|
|
1578
|
+
const mt = J(
|
|
1579
|
+
([{ defaultItemSize: e, listRefresh: t, sizes: o }, { scrollTop: n }, { scrollTargetReached: r, scrollToIndex: s }, { didMount: i }]) => {
|
|
1580
|
+
const l = S(!0), a = S(0), c = S(!0);
|
|
1581
|
+
return B(
|
|
1582
|
+
w(
|
|
1583
|
+
i,
|
|
1584
|
+
U(a),
|
|
1585
|
+
W(([m, T]) => !!T),
|
|
1586
|
+
Ae(!1)
|
|
1587
|
+
),
|
|
1588
|
+
l
|
|
1589
|
+
), B(
|
|
1590
|
+
w(
|
|
1591
|
+
i,
|
|
1592
|
+
U(a),
|
|
1593
|
+
W(([m, T]) => !!T),
|
|
1594
|
+
Ae(!1)
|
|
1595
|
+
),
|
|
1596
|
+
c
|
|
1597
|
+
), Z(
|
|
1598
|
+
w(
|
|
1599
|
+
de(t, i),
|
|
1600
|
+
U(l, o, e, c),
|
|
1601
|
+
W(([[, m], T, { sizeTree: p }, x, b]) => m && (!oe(p) || Ut(x)) && !T && !b),
|
|
1602
|
+
U(a)
|
|
1603
|
+
),
|
|
1604
|
+
([, m]) => {
|
|
1605
|
+
Oe(r, () => {
|
|
1606
|
+
$(c, !0);
|
|
1607
|
+
}), Xt(4, () => {
|
|
1608
|
+
Oe(n, () => {
|
|
1609
|
+
$(l, !0);
|
|
1610
|
+
}), $(s, m);
|
|
1611
|
+
});
|
|
1612
|
+
}
|
|
1613
|
+
), {
|
|
1614
|
+
initialItemFinalLocationReached: c,
|
|
1615
|
+
initialTopMostItemIndex: a,
|
|
1616
|
+
scrolledToInitialItem: l
|
|
1617
|
+
};
|
|
1618
|
+
},
|
|
1619
|
+
ie(Me, be, ft, Ve),
|
|
1620
|
+
{ singleton: !0 }
|
|
1621
|
+
);
|
|
1622
|
+
function tn(e, t) {
|
|
1623
|
+
return Math.abs(e - t) < 1.01;
|
|
1624
|
+
}
|
|
1625
|
+
const ct = "up", nt = "down", ur = "none", dr = {
|
|
1626
|
+
atBottom: !1,
|
|
1627
|
+
notAtBottomBecause: "NOT_SHOWING_LAST_ITEM",
|
|
1628
|
+
state: {
|
|
1629
|
+
offsetBottom: 0,
|
|
1630
|
+
scrollHeight: 0,
|
|
1631
|
+
scrollTop: 0,
|
|
1632
|
+
viewportHeight: 0
|
|
1633
|
+
}
|
|
1634
|
+
}, fr = 0, ht = J(([{ footerHeight: e, headerHeight: t, scrollBy: o, scrollContainerState: n, scrollTop: r, viewportHeight: s }]) => {
|
|
1635
|
+
const i = S(!1), l = S(!0), a = Y(), c = Y(), m = S(4), T = S(fr), p = Se(
|
|
1636
|
+
w(
|
|
1637
|
+
Mt(w(N(r), Ge(1), Ae(!0)), w(N(r), Ge(1), Ae(!1), po(100))),
|
|
1638
|
+
se()
|
|
1639
|
+
),
|
|
1640
|
+
!1
|
|
1641
|
+
), x = Se(
|
|
1642
|
+
w(Mt(w(o, Ae(!0)), w(o, Ae(!1), po(200))), se()),
|
|
1643
|
+
!1
|
|
1644
|
+
);
|
|
1645
|
+
B(
|
|
1646
|
+
w(
|
|
1647
|
+
de(N(r), N(T)),
|
|
1648
|
+
j(([f, I]) => f <= I),
|
|
1649
|
+
se()
|
|
1650
|
+
),
|
|
1651
|
+
l
|
|
1652
|
+
), B(w(l, We(50)), c);
|
|
1653
|
+
const b = Re(
|
|
1654
|
+
w(
|
|
1655
|
+
de(n, N(s), N(t), N(e), N(m)),
|
|
1656
|
+
_e((f, [{ scrollHeight: I, scrollTop: O }, k, H, u, v]) => {
|
|
1657
|
+
const y = O + k - I > -v, z = {
|
|
1658
|
+
scrollHeight: I,
|
|
1659
|
+
scrollTop: O,
|
|
1660
|
+
viewportHeight: k
|
|
1661
|
+
};
|
|
1662
|
+
if (y) {
|
|
1663
|
+
let F, D;
|
|
1664
|
+
return O > f.state.scrollTop ? (F = "SCROLLED_DOWN", D = f.state.scrollTop - O) : (F = "SIZE_DECREASED", D = f.state.scrollTop - O || f.scrollTopDelta), {
|
|
1665
|
+
atBottom: !0,
|
|
1666
|
+
atBottomBecause: F,
|
|
1667
|
+
scrollTopDelta: D,
|
|
1668
|
+
state: z
|
|
1669
|
+
};
|
|
1670
|
+
}
|
|
1671
|
+
let A;
|
|
1672
|
+
return z.scrollHeight > f.state.scrollHeight ? A = "SIZE_INCREASED" : k < f.state.viewportHeight ? A = "VIEWPORT_HEIGHT_DECREASING" : O < f.state.scrollTop ? A = "SCROLLING_UPWARDS" : A = "NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM", {
|
|
1673
|
+
atBottom: !1,
|
|
1674
|
+
notAtBottomBecause: A,
|
|
1675
|
+
state: z
|
|
1676
|
+
};
|
|
1677
|
+
}, dr),
|
|
1678
|
+
se((f, I) => f && f.atBottom === I.atBottom)
|
|
1679
|
+
)
|
|
1680
|
+
), E = Se(
|
|
1681
|
+
w(
|
|
1682
|
+
n,
|
|
1683
|
+
_e(
|
|
1684
|
+
(f, { scrollHeight: I, scrollTop: O, viewportHeight: k }) => {
|
|
1685
|
+
if (tn(f.scrollHeight, I))
|
|
1686
|
+
return {
|
|
1687
|
+
changed: !1,
|
|
1688
|
+
jump: 0,
|
|
1689
|
+
scrollHeight: I,
|
|
1690
|
+
scrollTop: O
|
|
1691
|
+
};
|
|
1692
|
+
{
|
|
1693
|
+
const H = I - (O + k) < 1;
|
|
1694
|
+
return f.scrollTop !== O && H ? {
|
|
1695
|
+
changed: !0,
|
|
1696
|
+
jump: f.scrollTop - O,
|
|
1697
|
+
scrollHeight: I,
|
|
1698
|
+
scrollTop: O
|
|
1699
|
+
} : {
|
|
1700
|
+
changed: !0,
|
|
1701
|
+
jump: 0,
|
|
1702
|
+
scrollHeight: I,
|
|
1703
|
+
scrollTop: O
|
|
1704
|
+
};
|
|
1705
|
+
}
|
|
1706
|
+
},
|
|
1707
|
+
{ changed: !1, jump: 0, scrollHeight: 0, scrollTop: 0 }
|
|
1708
|
+
),
|
|
1709
|
+
W((f) => f.changed),
|
|
1710
|
+
j((f) => f.jump)
|
|
1711
|
+
),
|
|
1712
|
+
0
|
|
1713
|
+
);
|
|
1714
|
+
B(
|
|
1715
|
+
w(
|
|
1716
|
+
b,
|
|
1717
|
+
j((f) => f.atBottom)
|
|
1718
|
+
),
|
|
1719
|
+
i
|
|
1720
|
+
), B(w(i, We(50)), a);
|
|
1721
|
+
const g = S(nt);
|
|
1722
|
+
B(
|
|
1723
|
+
w(
|
|
1724
|
+
n,
|
|
1725
|
+
j(({ scrollTop: f }) => f),
|
|
1726
|
+
se(),
|
|
1727
|
+
_e(
|
|
1728
|
+
(f, I) => ae(x) ? { direction: f.direction, prevScrollTop: I } : { direction: I < f.prevScrollTop ? ct : nt, prevScrollTop: I },
|
|
1729
|
+
{ direction: nt, prevScrollTop: 0 }
|
|
1730
|
+
),
|
|
1731
|
+
j((f) => f.direction)
|
|
1732
|
+
),
|
|
1733
|
+
g
|
|
1734
|
+
), B(w(n, We(50), Ae(ur)), g);
|
|
1735
|
+
const d = S(0);
|
|
1736
|
+
return B(
|
|
1737
|
+
w(
|
|
1738
|
+
p,
|
|
1739
|
+
W((f) => !f),
|
|
1740
|
+
Ae(0)
|
|
1741
|
+
),
|
|
1742
|
+
d
|
|
1743
|
+
), B(
|
|
1744
|
+
w(
|
|
1745
|
+
r,
|
|
1746
|
+
We(100),
|
|
1747
|
+
U(p),
|
|
1748
|
+
W(([f, I]) => !!I),
|
|
1749
|
+
_e(([f, I], [O]) => [I, O], [0, 0]),
|
|
1750
|
+
j(([f, I]) => I - f)
|
|
1751
|
+
),
|
|
1752
|
+
d
|
|
1753
|
+
), {
|
|
1754
|
+
atBottomState: b,
|
|
1755
|
+
atBottomStateChange: a,
|
|
1756
|
+
atBottomThreshold: m,
|
|
1757
|
+
atTopStateChange: c,
|
|
1758
|
+
atTopThreshold: T,
|
|
1759
|
+
isAtBottom: i,
|
|
1760
|
+
isAtTop: l,
|
|
1761
|
+
isScrolling: p,
|
|
1762
|
+
lastJumpDueToItemResize: E,
|
|
1763
|
+
scrollDirection: g,
|
|
1764
|
+
scrollVelocity: d
|
|
1765
|
+
};
|
|
1766
|
+
}, ie(be)), ut = "top", dt = "bottom", wo = "none";
|
|
1767
|
+
function To(e, t, o) {
|
|
1768
|
+
return typeof e == "number" ? o === ct && t === ut || o === nt && t === dt ? e : 0 : o === ct ? t === ut ? e.main : e.reverse : t === dt ? e.main : e.reverse;
|
|
1769
|
+
}
|
|
1770
|
+
function Io(e, t) {
|
|
1771
|
+
var o;
|
|
1772
|
+
return typeof e == "number" ? e : (o = e[t]) != null ? o : 0;
|
|
1773
|
+
}
|
|
1774
|
+
const Kt = J(
|
|
1775
|
+
([{ deviation: e, fixedHeaderHeight: t, headerHeight: o, scrollTop: n, viewportHeight: r }]) => {
|
|
1776
|
+
const s = Y(), i = S(0), l = S(0), a = S(0), c = Se(
|
|
1777
|
+
w(
|
|
1778
|
+
de(
|
|
1779
|
+
N(n),
|
|
1780
|
+
N(r),
|
|
1781
|
+
N(o),
|
|
1782
|
+
N(s, lt),
|
|
1783
|
+
N(a),
|
|
1784
|
+
N(i),
|
|
1785
|
+
N(t),
|
|
1786
|
+
N(e),
|
|
1787
|
+
N(l)
|
|
1788
|
+
),
|
|
1789
|
+
j(
|
|
1790
|
+
([
|
|
1791
|
+
m,
|
|
1792
|
+
T,
|
|
1793
|
+
p,
|
|
1794
|
+
[x, b],
|
|
1795
|
+
E,
|
|
1796
|
+
g,
|
|
1797
|
+
d,
|
|
1798
|
+
f,
|
|
1799
|
+
I
|
|
1800
|
+
]) => {
|
|
1801
|
+
const O = m - f, k = g + d, H = Math.max(p - O, 0);
|
|
1802
|
+
let u = wo;
|
|
1803
|
+
const v = Io(I, ut), y = Io(I, dt);
|
|
1804
|
+
return x -= f, x += p + d, b += p + d, b -= f, x > m + k - v && (u = ct), b < m - H + T + y && (u = nt), u !== wo ? [
|
|
1805
|
+
Math.max(O - p - To(E, ut, u) - v, 0),
|
|
1806
|
+
O - H - d + T + To(E, dt, u) + y
|
|
1807
|
+
] : null;
|
|
1808
|
+
}
|
|
1809
|
+
),
|
|
1810
|
+
W((m) => m != null),
|
|
1811
|
+
se(lt)
|
|
1812
|
+
),
|
|
1813
|
+
[0, 0]
|
|
1814
|
+
);
|
|
1815
|
+
return {
|
|
1816
|
+
increaseViewportBy: l,
|
|
1817
|
+
// input
|
|
1818
|
+
listBoundary: s,
|
|
1819
|
+
overscan: a,
|
|
1820
|
+
topListHeight: i,
|
|
1821
|
+
// output
|
|
1822
|
+
visibleRange: c
|
|
1823
|
+
};
|
|
1824
|
+
},
|
|
1825
|
+
ie(be),
|
|
1826
|
+
{ singleton: !0 }
|
|
1827
|
+
);
|
|
1828
|
+
function mr(e, t, o) {
|
|
1829
|
+
if (zt(t)) {
|
|
1830
|
+
const n = Zo(e, t);
|
|
1831
|
+
return [
|
|
1832
|
+
{ index: He(t.groupOffsetTree, n)[0], offset: 0, size: 0 },
|
|
1833
|
+
{ data: o?.[0], index: n, offset: 0, size: 0 }
|
|
1834
|
+
];
|
|
1835
|
+
}
|
|
1836
|
+
return [{ data: o?.[0], index: e, offset: 0, size: 0 }];
|
|
1837
|
+
}
|
|
1838
|
+
const Pt = {
|
|
1839
|
+
bottom: 0,
|
|
1840
|
+
firstItemIndex: 0,
|
|
1841
|
+
items: [],
|
|
1842
|
+
offsetBottom: 0,
|
|
1843
|
+
offsetTop: 0,
|
|
1844
|
+
top: 0,
|
|
1845
|
+
topItems: [],
|
|
1846
|
+
topListHeight: 0,
|
|
1847
|
+
totalCount: 0
|
|
1848
|
+
};
|
|
1849
|
+
function St(e, t, o, n, r, s) {
|
|
1850
|
+
const { lastIndex: i, lastOffset: l, lastSize: a } = r;
|
|
1851
|
+
let c = 0, m = 0;
|
|
1852
|
+
if (e.length > 0) {
|
|
1853
|
+
c = e[0].offset;
|
|
1854
|
+
const E = e[e.length - 1];
|
|
1855
|
+
m = E.offset + E.size;
|
|
1856
|
+
}
|
|
1857
|
+
const T = o - i, p = l + T * a + (T - 1) * n, x = c, b = p - m;
|
|
1858
|
+
return {
|
|
1859
|
+
bottom: m,
|
|
1860
|
+
firstItemIndex: s,
|
|
1861
|
+
items: So(e, r, s),
|
|
1862
|
+
offsetBottom: b,
|
|
1863
|
+
offsetTop: c,
|
|
1864
|
+
top: x,
|
|
1865
|
+
topItems: So(t, r, s),
|
|
1866
|
+
topListHeight: t.reduce((E, g) => g.size + E, 0),
|
|
1867
|
+
totalCount: o
|
|
1868
|
+
};
|
|
1869
|
+
}
|
|
1870
|
+
function on(e, t, o, n, r, s) {
|
|
1871
|
+
let i = 0;
|
|
1872
|
+
if (o.groupIndices.length > 0)
|
|
1873
|
+
for (const m of o.groupIndices) {
|
|
1874
|
+
if (m - i >= e)
|
|
1875
|
+
break;
|
|
1876
|
+
i++;
|
|
1877
|
+
}
|
|
1878
|
+
const l = e + i, a = Zt(t, l), c = Array.from({ length: l }).map((m, T) => ({
|
|
1879
|
+
data: s[T + a],
|
|
1880
|
+
index: T + a,
|
|
1881
|
+
offset: 0,
|
|
1882
|
+
size: 0
|
|
1883
|
+
}));
|
|
1884
|
+
return St(c, [], l, r, o, n);
|
|
1885
|
+
}
|
|
1886
|
+
function So(e, t, o) {
|
|
1887
|
+
if (e.length === 0)
|
|
1888
|
+
return [];
|
|
1889
|
+
if (!zt(t))
|
|
1890
|
+
return e.map((c) => ({ ...c, index: c.index + o, originalIndex: c.index }));
|
|
1891
|
+
const n = e[0].index, r = e[e.length - 1].index, s = [], i = Ze(t.groupOffsetTree, n, r);
|
|
1892
|
+
let l, a = 0;
|
|
1893
|
+
for (const c of e) {
|
|
1894
|
+
(!l || l.end < c.index) && (l = i.shift(), a = t.groupIndices.indexOf(l.start));
|
|
1895
|
+
let m;
|
|
1896
|
+
c.index === l.start ? m = {
|
|
1897
|
+
index: a,
|
|
1898
|
+
type: "group"
|
|
1899
|
+
} : m = {
|
|
1900
|
+
groupIndex: a,
|
|
1901
|
+
index: c.index - (a + 1) + o
|
|
1902
|
+
}, s.push({
|
|
1903
|
+
...m,
|
|
1904
|
+
data: c.data,
|
|
1905
|
+
offset: c.offset,
|
|
1906
|
+
originalIndex: c.index,
|
|
1907
|
+
size: c.size
|
|
1908
|
+
});
|
|
1909
|
+
}
|
|
1910
|
+
return s;
|
|
1911
|
+
}
|
|
1912
|
+
function bo(e, t) {
|
|
1913
|
+
var o;
|
|
1914
|
+
return e === void 0 ? 0 : typeof e == "number" ? e : (o = e[t]) != null ? o : 0;
|
|
1915
|
+
}
|
|
1916
|
+
const qe = J(
|
|
1917
|
+
([
|
|
1918
|
+
{ data: e, firstItemIndex: t, gap: o, sizes: n, totalCount: r },
|
|
1919
|
+
s,
|
|
1920
|
+
{ listBoundary: i, topListHeight: l, visibleRange: a },
|
|
1921
|
+
{ initialTopMostItemIndex: c, scrolledToInitialItem: m },
|
|
1922
|
+
{ topListHeight: T },
|
|
1923
|
+
p,
|
|
1924
|
+
{ didMount: x },
|
|
1925
|
+
{ recalcInProgress: b }
|
|
1926
|
+
]) => {
|
|
1927
|
+
const E = S([]), g = S(0), d = Y(), f = S(0);
|
|
1928
|
+
B(s.topItemsIndexes, E);
|
|
1929
|
+
const I = Se(
|
|
1930
|
+
w(
|
|
1931
|
+
de(
|
|
1932
|
+
x,
|
|
1933
|
+
b,
|
|
1934
|
+
N(a, lt),
|
|
1935
|
+
N(r),
|
|
1936
|
+
N(n),
|
|
1937
|
+
N(c),
|
|
1938
|
+
m,
|
|
1939
|
+
N(E),
|
|
1940
|
+
N(t),
|
|
1941
|
+
N(o),
|
|
1942
|
+
N(f),
|
|
1943
|
+
e
|
|
1944
|
+
),
|
|
1945
|
+
W(([u, v, , y, , , , , , , , z]) => {
|
|
1946
|
+
const A = z && z.length !== y;
|
|
1947
|
+
return u && !v && !A;
|
|
1948
|
+
}),
|
|
1949
|
+
j(
|
|
1950
|
+
([
|
|
1951
|
+
,
|
|
1952
|
+
,
|
|
1953
|
+
[u, v],
|
|
1954
|
+
y,
|
|
1955
|
+
z,
|
|
1956
|
+
A,
|
|
1957
|
+
F,
|
|
1958
|
+
D,
|
|
1959
|
+
_,
|
|
1960
|
+
V,
|
|
1961
|
+
X,
|
|
1962
|
+
K
|
|
1963
|
+
]) => {
|
|
1964
|
+
var ve, we, Te, h;
|
|
1965
|
+
const M = z, { offsetTree: q, sizeTree: Q } = M, Pe = ae(g);
|
|
1966
|
+
if (y === 0)
|
|
1967
|
+
return { ...Pt, totalCount: y };
|
|
1968
|
+
if (u === 0 && v === 0)
|
|
1969
|
+
return Pe === 0 ? { ...Pt, totalCount: y } : on(Pe, A, z, _, V, K || []);
|
|
1970
|
+
if (oe(Q))
|
|
1971
|
+
return Pe > 0 ? null : St(
|
|
1972
|
+
mr(Zt(A, y), M, K),
|
|
1973
|
+
[],
|
|
1974
|
+
y,
|
|
1975
|
+
V,
|
|
1976
|
+
M,
|
|
1977
|
+
_
|
|
1978
|
+
);
|
|
1979
|
+
const Be = [];
|
|
1980
|
+
if (D.length > 0) {
|
|
1981
|
+
const fe = D[0], ce = D[D.length - 1];
|
|
1982
|
+
let he = 0;
|
|
1983
|
+
for (const ue of Ze(Q, fe, ce)) {
|
|
1984
|
+
const te = ue.value, re = Math.max(ue.start, fe), ke = Math.min(ue.end, ce);
|
|
1985
|
+
for (let ge = re; ge <= ke; ge++)
|
|
1986
|
+
Be.push({ data: K?.[ge], index: ge, offset: he, size: te }), he += te;
|
|
1987
|
+
}
|
|
1988
|
+
}
|
|
1989
|
+
if (!F)
|
|
1990
|
+
return St([], Be, y, V, M, _);
|
|
1991
|
+
const ee = D.length > 0 ? D[D.length - 1] + 1 : 0, R = tr(q, u, v, ee);
|
|
1992
|
+
if (R.length === 0)
|
|
1993
|
+
return null;
|
|
1994
|
+
const G = y - 1, ne = kt([], (fe) => {
|
|
1995
|
+
for (const ce of R) {
|
|
1996
|
+
const he = ce.value;
|
|
1997
|
+
let ue = he.offset, te = ce.start;
|
|
1998
|
+
const re = he.size;
|
|
1999
|
+
if (he.offset < u) {
|
|
2000
|
+
te += Math.floor((u - he.offset + V) / (re + V));
|
|
2001
|
+
const ge = te - ce.start;
|
|
2002
|
+
ue += ge * re + ge * V;
|
|
2003
|
+
}
|
|
2004
|
+
te < ee && (ue += (ee - te) * re, te = ee);
|
|
2005
|
+
const ke = Math.min(ce.end, G);
|
|
2006
|
+
for (let ge = te; ge <= ke && !(ue >= v); ge++)
|
|
2007
|
+
fe.push({ data: K?.[ge], index: ge, offset: ue, size: re }), ue += re + V;
|
|
2008
|
+
}
|
|
2009
|
+
}), pe = bo(X, ut), Ee = bo(X, dt);
|
|
2010
|
+
if (ne.length > 0 && (pe > 0 || Ee > 0)) {
|
|
2011
|
+
const fe = ne[0], ce = ne[ne.length - 1];
|
|
2012
|
+
if (pe > 0 && fe.index > ee) {
|
|
2013
|
+
const he = Math.min(pe, fe.index - ee), ue = [];
|
|
2014
|
+
let te = fe.offset;
|
|
2015
|
+
for (let re = fe.index - 1; re >= fe.index - he; re--) {
|
|
2016
|
+
const ke = (we = (ve = Ze(Q, re, re)[0]) == null ? void 0 : ve.value) != null ? we : fe.size;
|
|
2017
|
+
te -= ke + V, ue.unshift({ data: K?.[re], index: re, offset: te, size: ke });
|
|
2018
|
+
}
|
|
2019
|
+
ne.unshift(...ue);
|
|
2020
|
+
}
|
|
2021
|
+
if (Ee > 0 && ce.index < G) {
|
|
2022
|
+
const he = Math.min(Ee, G - ce.index);
|
|
2023
|
+
let ue = ce.offset + ce.size + V;
|
|
2024
|
+
for (let te = ce.index + 1; te <= ce.index + he; te++) {
|
|
2025
|
+
const re = (h = (Te = Ze(Q, te, te)[0]) == null ? void 0 : Te.value) != null ? h : ce.size;
|
|
2026
|
+
ne.push({ data: K?.[te], index: te, offset: ue, size: re }), ue += re + V;
|
|
2027
|
+
}
|
|
2028
|
+
}
|
|
2029
|
+
}
|
|
2030
|
+
return St(ne, Be, y, V, M, _);
|
|
2031
|
+
}
|
|
2032
|
+
),
|
|
2033
|
+
//@ts-expect-error filter needs to be fixed
|
|
2034
|
+
W((u) => u !== null),
|
|
2035
|
+
se()
|
|
2036
|
+
),
|
|
2037
|
+
Pt
|
|
2038
|
+
);
|
|
2039
|
+
B(
|
|
2040
|
+
w(
|
|
2041
|
+
e,
|
|
2042
|
+
W(Ut),
|
|
2043
|
+
j((u) => u?.length)
|
|
2044
|
+
),
|
|
2045
|
+
r
|
|
2046
|
+
), B(
|
|
2047
|
+
w(
|
|
2048
|
+
I,
|
|
2049
|
+
j((u) => u.topListHeight)
|
|
2050
|
+
),
|
|
2051
|
+
T
|
|
2052
|
+
), B(T, l), B(
|
|
2053
|
+
w(
|
|
2054
|
+
I,
|
|
2055
|
+
j((u) => [u.top, u.bottom])
|
|
2056
|
+
),
|
|
2057
|
+
i
|
|
2058
|
+
), B(
|
|
2059
|
+
w(
|
|
2060
|
+
I,
|
|
2061
|
+
j((u) => u.items)
|
|
2062
|
+
),
|
|
2063
|
+
d
|
|
2064
|
+
);
|
|
2065
|
+
const O = Re(
|
|
2066
|
+
w(
|
|
2067
|
+
I,
|
|
2068
|
+
W(({ items: u }) => u.length > 0),
|
|
2069
|
+
U(r, e),
|
|
2070
|
+
W(([{ items: u }, v]) => u[u.length - 1].originalIndex === v - 1),
|
|
2071
|
+
j(([, u, v]) => [u - 1, v]),
|
|
2072
|
+
se(lt),
|
|
2073
|
+
j(([u]) => u)
|
|
2074
|
+
)
|
|
2075
|
+
), k = Re(
|
|
2076
|
+
w(
|
|
2077
|
+
I,
|
|
2078
|
+
We(200),
|
|
2079
|
+
W(({ items: u, topItems: v }) => u.length > 0 && u[0].originalIndex === v.length),
|
|
2080
|
+
j(({ items: u }) => u[0].index),
|
|
2081
|
+
se()
|
|
2082
|
+
)
|
|
2083
|
+
), H = Re(
|
|
2084
|
+
w(
|
|
2085
|
+
I,
|
|
2086
|
+
W(({ items: u }) => u.length > 0),
|
|
2087
|
+
j(({ items: u }) => {
|
|
2088
|
+
let v = 0, y = u.length - 1;
|
|
2089
|
+
for (; u[v].type === "group" && v < y; )
|
|
2090
|
+
v++;
|
|
2091
|
+
for (; u[y].type === "group" && y > v; )
|
|
2092
|
+
y--;
|
|
2093
|
+
return {
|
|
2094
|
+
endIndex: u[y].index,
|
|
2095
|
+
startIndex: u[v].index
|
|
2096
|
+
};
|
|
2097
|
+
}),
|
|
2098
|
+
se(Jo)
|
|
2099
|
+
)
|
|
2100
|
+
);
|
|
2101
|
+
return {
|
|
2102
|
+
endReached: O,
|
|
2103
|
+
initialItemCount: g,
|
|
2104
|
+
itemsRendered: d,
|
|
2105
|
+
listState: I,
|
|
2106
|
+
minOverscanItemCount: f,
|
|
2107
|
+
rangeChanged: H,
|
|
2108
|
+
startReached: k,
|
|
2109
|
+
topItemsIndexes: E,
|
|
2110
|
+
...p
|
|
2111
|
+
};
|
|
2112
|
+
},
|
|
2113
|
+
ie(
|
|
2114
|
+
Me,
|
|
2115
|
+
Qo,
|
|
2116
|
+
Kt,
|
|
2117
|
+
mt,
|
|
2118
|
+
ft,
|
|
2119
|
+
ht,
|
|
2120
|
+
Ve,
|
|
2121
|
+
qt
|
|
2122
|
+
),
|
|
2123
|
+
{ singleton: !0 }
|
|
2124
|
+
), nn = J(
|
|
2125
|
+
([{ fixedFooterHeight: e, fixedHeaderHeight: t, footerHeight: o, headerHeight: n }, { listState: r }]) => {
|
|
2126
|
+
const s = Y(), i = Se(
|
|
2127
|
+
w(
|
|
2128
|
+
de(o, e, n, t, r),
|
|
2129
|
+
j(([l, a, c, m, T]) => l + a + c + m + T.offsetBottom + T.bottom)
|
|
2130
|
+
),
|
|
2131
|
+
0
|
|
2132
|
+
);
|
|
2133
|
+
return B(N(i), s), { totalListHeight: i, totalListHeightChanged: s };
|
|
2134
|
+
},
|
|
2135
|
+
ie(be, qe),
|
|
2136
|
+
{ singleton: !0 }
|
|
2137
|
+
), hr = J(
|
|
2138
|
+
([{ viewportHeight: e }, { totalListHeight: t }]) => {
|
|
2139
|
+
const o = S(!1), n = Se(
|
|
2140
|
+
w(
|
|
2141
|
+
de(o, e, t),
|
|
2142
|
+
W(([r]) => r),
|
|
2143
|
+
j(([, r, s]) => Math.max(0, r - s)),
|
|
2144
|
+
We(0),
|
|
2145
|
+
se()
|
|
2146
|
+
),
|
|
2147
|
+
0
|
|
2148
|
+
);
|
|
2149
|
+
return { alignToBottom: o, paddingTopAddition: n };
|
|
2150
|
+
},
|
|
2151
|
+
ie(be, nn),
|
|
2152
|
+
{ singleton: !0 }
|
|
2153
|
+
), rn = J(() => ({
|
|
2154
|
+
context: S(null)
|
|
2155
|
+
})), pr = ({
|
|
2156
|
+
itemBottom: e,
|
|
2157
|
+
itemTop: t,
|
|
2158
|
+
locationParams: { align: o, behavior: n, ...r },
|
|
2159
|
+
viewportBottom: s,
|
|
2160
|
+
viewportTop: i
|
|
2161
|
+
}) => t < i ? { ...r, align: o ?? "start", behavior: n } : e > s ? { ...r, align: o ?? "end", behavior: n } : null, sn = J(
|
|
2162
|
+
([
|
|
2163
|
+
{ gap: e, sizes: t, totalCount: o },
|
|
2164
|
+
{ fixedFooterHeight: n, fixedHeaderHeight: r, headerHeight: s, scrollingInProgress: i, scrollTop: l, viewportHeight: a },
|
|
2165
|
+
{ scrollToIndex: c }
|
|
2166
|
+
]) => {
|
|
2167
|
+
const m = Y();
|
|
2168
|
+
return B(
|
|
2169
|
+
w(
|
|
2170
|
+
m,
|
|
2171
|
+
U(t, a, o, s, r, n, l),
|
|
2172
|
+
U(e),
|
|
2173
|
+
j(([[T, p, x, b, E, g, d, f], I]) => {
|
|
2174
|
+
const { align: O, behavior: k, calculateViewLocation: H = pr, done: u, ...v } = T, y = Ko(T, p, b - 1), z = at(y, p.offsetTree, I) + E + g, A = z + He(p.sizeTree, y)[1], F = f + g, D = f + x - d, _ = H({
|
|
2175
|
+
itemBottom: A,
|
|
2176
|
+
itemTop: z,
|
|
2177
|
+
locationParams: { align: O, behavior: k, ...v },
|
|
2178
|
+
viewportBottom: D,
|
|
2179
|
+
viewportTop: F
|
|
2180
|
+
});
|
|
2181
|
+
return _ ? u && Oe(
|
|
2182
|
+
w(
|
|
2183
|
+
i,
|
|
2184
|
+
W((V) => !V),
|
|
2185
|
+
// skips the initial publish of false, and the cleanup call.
|
|
2186
|
+
// but if scrollingInProgress is true, we skip the initial publish.
|
|
2187
|
+
Ge(ae(i) ? 1 : 2)
|
|
2188
|
+
),
|
|
2189
|
+
u
|
|
2190
|
+
) : u && u(), _;
|
|
2191
|
+
}),
|
|
2192
|
+
W((T) => T !== null)
|
|
2193
|
+
),
|
|
2194
|
+
c
|
|
2195
|
+
), {
|
|
2196
|
+
scrollIntoView: m
|
|
2197
|
+
};
|
|
2198
|
+
},
|
|
2199
|
+
ie(Me, be, ft, qe, Le),
|
|
2200
|
+
{ singleton: !0 }
|
|
2201
|
+
);
|
|
2202
|
+
function yo(e) {
|
|
2203
|
+
return e ? e === "smooth" ? "smooth" : "auto" : !1;
|
|
2204
|
+
}
|
|
2205
|
+
const gr = (e, t) => typeof e == "function" ? yo(e(t)) : t && yo(e), xr = J(
|
|
2206
|
+
([
|
|
2207
|
+
{ listRefresh: e, totalCount: t, fixedItemSize: o, data: n },
|
|
2208
|
+
{ atBottomState: r, isAtBottom: s },
|
|
2209
|
+
{ scrollToIndex: i },
|
|
2210
|
+
{ scrolledToInitialItem: l },
|
|
2211
|
+
{ didMount: a, propsReady: c },
|
|
2212
|
+
{ log: m },
|
|
2213
|
+
{ scrollingInProgress: T },
|
|
2214
|
+
{ context: p },
|
|
2215
|
+
{ scrollIntoView: x }
|
|
2216
|
+
]) => {
|
|
2217
|
+
const b = S(!1), E = Y();
|
|
2218
|
+
let g = null;
|
|
2219
|
+
function d(k) {
|
|
2220
|
+
$(i, {
|
|
2221
|
+
align: "end",
|
|
2222
|
+
behavior: k,
|
|
2223
|
+
index: "LAST"
|
|
2224
|
+
});
|
|
2225
|
+
}
|
|
2226
|
+
Z(
|
|
2227
|
+
w(
|
|
2228
|
+
de(w(N(t), Ge(1)), a),
|
|
2229
|
+
U(N(b), s, l, T),
|
|
2230
|
+
j(([[k, H], u, v, y, z]) => {
|
|
2231
|
+
let A = H && y, F = "auto";
|
|
2232
|
+
return A && (F = gr(u, v || z), A = A && !!F), { followOutputBehavior: F, shouldFollow: A, totalCount: k };
|
|
2233
|
+
}),
|
|
2234
|
+
W(({ shouldFollow: k }) => k)
|
|
2235
|
+
),
|
|
2236
|
+
({ followOutputBehavior: k, totalCount: H }) => {
|
|
2237
|
+
g && (g(), g = null), ae(o) ? requestAnimationFrame(() => {
|
|
2238
|
+
ae(m)("following output to ", { totalCount: H }, ye.DEBUG), d(k);
|
|
2239
|
+
}) : g = Oe(e, () => {
|
|
2240
|
+
ae(m)("following output to ", { totalCount: H }, ye.DEBUG), d(k), g = null;
|
|
2241
|
+
});
|
|
2242
|
+
}
|
|
2243
|
+
);
|
|
2244
|
+
function f(k) {
|
|
2245
|
+
const H = Oe(r, (u) => {
|
|
2246
|
+
k && !u.atBottom && u.notAtBottomBecause === "SIZE_INCREASED" && !g && (ae(m)("scrolling to bottom due to increased size", {}, ye.DEBUG), d("auto"));
|
|
2247
|
+
});
|
|
2248
|
+
setTimeout(H, 100);
|
|
2249
|
+
}
|
|
2250
|
+
Z(
|
|
2251
|
+
w(
|
|
2252
|
+
de(N(b), t, c),
|
|
2253
|
+
W(([k, , H]) => k && H),
|
|
2254
|
+
_e(
|
|
2255
|
+
({ value: k }, [, H]) => ({ refreshed: k === H, value: H }),
|
|
2256
|
+
{ refreshed: !1, value: 0 }
|
|
2257
|
+
),
|
|
2258
|
+
W(({ refreshed: k }) => k),
|
|
2259
|
+
U(b, t)
|
|
2260
|
+
),
|
|
2261
|
+
([, k]) => {
|
|
2262
|
+
ae(l) && f(k !== !1);
|
|
2263
|
+
}
|
|
2264
|
+
), Z(E, () => {
|
|
2265
|
+
f(ae(b) !== !1);
|
|
2266
|
+
}), Z(de(N(b), r), ([k, H]) => {
|
|
2267
|
+
k && !H.atBottom && H.notAtBottomBecause === "VIEWPORT_HEIGHT_DECREASING" && d("auto");
|
|
2268
|
+
});
|
|
2269
|
+
const I = S(null), O = Y();
|
|
2270
|
+
return B(
|
|
2271
|
+
Mt(
|
|
2272
|
+
w(
|
|
2273
|
+
N(n),
|
|
2274
|
+
j((k) => {
|
|
2275
|
+
var H;
|
|
2276
|
+
return (H = k?.length) != null ? H : 0;
|
|
2277
|
+
})
|
|
2278
|
+
),
|
|
2279
|
+
w(N(t))
|
|
2280
|
+
),
|
|
2281
|
+
O
|
|
2282
|
+
), Z(
|
|
2283
|
+
w(
|
|
2284
|
+
de(w(O, Ge(1)), a),
|
|
2285
|
+
U(N(I), l, T, p),
|
|
2286
|
+
j(([[k, H], u, v, y, z]) => H && v && u?.({ context: z, totalCount: k, scrollingInProgress: y })),
|
|
2287
|
+
W((k) => !!k),
|
|
2288
|
+
We(0)
|
|
2289
|
+
),
|
|
2290
|
+
(k) => {
|
|
2291
|
+
g && (g(), g = null), ae(o) ? requestAnimationFrame(() => {
|
|
2292
|
+
ae(m)("scrolling into view", {}), $(x, k);
|
|
2293
|
+
}) : g = Oe(e, () => {
|
|
2294
|
+
ae(m)("scrolling into view", {}), $(x, k), g = null;
|
|
2295
|
+
});
|
|
2296
|
+
}
|
|
2297
|
+
), { autoscrollToBottom: E, followOutput: b, scrollIntoViewOnChange: I };
|
|
2298
|
+
},
|
|
2299
|
+
ie(
|
|
2300
|
+
Me,
|
|
2301
|
+
ht,
|
|
2302
|
+
ft,
|
|
2303
|
+
mt,
|
|
2304
|
+
Ve,
|
|
2305
|
+
Le,
|
|
2306
|
+
be,
|
|
2307
|
+
rn,
|
|
2308
|
+
sn
|
|
2309
|
+
)
|
|
2310
|
+
), vr = J(
|
|
2311
|
+
([{ data: e, firstItemIndex: t, gap: o, sizes: n }, { initialTopMostItemIndex: r }, { initialItemCount: s, listState: i }, { didMount: l }]) => (B(
|
|
2312
|
+
w(
|
|
2313
|
+
l,
|
|
2314
|
+
U(s),
|
|
2315
|
+
W(([, a]) => a !== 0),
|
|
2316
|
+
U(r, n, t, o, e),
|
|
2317
|
+
j(([[, a], c, m, T, p, x = []]) => on(a, c, m, T, p, x))
|
|
2318
|
+
),
|
|
2319
|
+
i
|
|
2320
|
+
), {}),
|
|
2321
|
+
ie(Me, mt, qe, Ve),
|
|
2322
|
+
{ singleton: !0 }
|
|
2323
|
+
), wr = J(
|
|
2324
|
+
([{ didMount: e }, { scrollTo: t }, { listState: o }]) => {
|
|
2325
|
+
const n = S(0);
|
|
2326
|
+
return Z(
|
|
2327
|
+
w(
|
|
2328
|
+
e,
|
|
2329
|
+
U(n),
|
|
2330
|
+
W(([, r]) => r !== 0),
|
|
2331
|
+
j(([, r]) => ({ top: r }))
|
|
2332
|
+
),
|
|
2333
|
+
(r) => {
|
|
2334
|
+
Oe(
|
|
2335
|
+
w(
|
|
2336
|
+
o,
|
|
2337
|
+
Ge(1),
|
|
2338
|
+
W((s) => s.items.length > 1)
|
|
2339
|
+
),
|
|
2340
|
+
() => {
|
|
2341
|
+
requestAnimationFrame(() => {
|
|
2342
|
+
$(t, r);
|
|
2343
|
+
});
|
|
2344
|
+
}
|
|
2345
|
+
);
|
|
2346
|
+
}
|
|
2347
|
+
), {
|
|
2348
|
+
initialScrollTop: n
|
|
2349
|
+
};
|
|
2350
|
+
},
|
|
2351
|
+
ie(Ve, be, qe),
|
|
2352
|
+
{ singleton: !0 }
|
|
2353
|
+
), ln = J(
|
|
2354
|
+
([{ scrollVelocity: e }]) => {
|
|
2355
|
+
const t = S(!1), o = Y(), n = S(!1);
|
|
2356
|
+
return B(
|
|
2357
|
+
w(
|
|
2358
|
+
e,
|
|
2359
|
+
U(n, t, o),
|
|
2360
|
+
W(([r, s]) => !!s),
|
|
2361
|
+
j(([r, s, i, l]) => {
|
|
2362
|
+
const { enter: a, exit: c } = s;
|
|
2363
|
+
if (i) {
|
|
2364
|
+
if (c(r, l))
|
|
2365
|
+
return !1;
|
|
2366
|
+
} else if (a(r, l))
|
|
2367
|
+
return !0;
|
|
2368
|
+
return i;
|
|
2369
|
+
}),
|
|
2370
|
+
se()
|
|
2371
|
+
),
|
|
2372
|
+
t
|
|
2373
|
+
), Z(
|
|
2374
|
+
w(de(t, e, o), U(n)),
|
|
2375
|
+
([[r, s, i], l]) => {
|
|
2376
|
+
r && l && l.change && l.change(s, i);
|
|
2377
|
+
}
|
|
2378
|
+
), { isSeeking: t, scrollSeekConfiguration: n, scrollSeekRangeChanged: o, scrollVelocity: e };
|
|
2379
|
+
},
|
|
2380
|
+
ie(ht),
|
|
2381
|
+
{ singleton: !0 }
|
|
2382
|
+
), Qt = J(([{ scrollContainerState: e, scrollTo: t }]) => {
|
|
2383
|
+
const o = Y(), n = Y(), r = Y(), s = S(!1), i = S(void 0);
|
|
2384
|
+
return B(
|
|
2385
|
+
w(
|
|
2386
|
+
de(o, n),
|
|
2387
|
+
j(([{ scrollHeight: l, scrollTop: a, viewportHeight: c }, { offsetTop: m }]) => ({
|
|
2388
|
+
scrollHeight: l,
|
|
2389
|
+
scrollTop: Math.max(0, a - m),
|
|
2390
|
+
viewportHeight: c
|
|
2391
|
+
}))
|
|
2392
|
+
),
|
|
2393
|
+
e
|
|
2394
|
+
), B(
|
|
2395
|
+
w(
|
|
2396
|
+
t,
|
|
2397
|
+
U(n),
|
|
2398
|
+
j(([l, { offsetTop: a }]) => ({
|
|
2399
|
+
...l,
|
|
2400
|
+
top: l.top + a
|
|
2401
|
+
}))
|
|
2402
|
+
),
|
|
2403
|
+
r
|
|
2404
|
+
), {
|
|
2405
|
+
customScrollParent: i,
|
|
2406
|
+
// config
|
|
2407
|
+
useWindowScroll: s,
|
|
2408
|
+
// input
|
|
2409
|
+
windowScrollContainerState: o,
|
|
2410
|
+
// signals
|
|
2411
|
+
windowScrollTo: r,
|
|
2412
|
+
windowViewportRect: n
|
|
2413
|
+
};
|
|
2414
|
+
}, ie(be)), Tr = J(
|
|
2415
|
+
([
|
|
2416
|
+
{ sizeRanges: e, sizes: t },
|
|
2417
|
+
{ headerHeight: o, scrollTop: n },
|
|
2418
|
+
{ initialTopMostItemIndex: r },
|
|
2419
|
+
{ didMount: s },
|
|
2420
|
+
{ useWindowScroll: i, windowScrollContainerState: l, windowViewportRect: a }
|
|
2421
|
+
]) => {
|
|
2422
|
+
const c = Y(), m = S(void 0), T = S(null), p = S(null);
|
|
2423
|
+
return B(l, T), B(a, p), Z(
|
|
2424
|
+
w(
|
|
2425
|
+
c,
|
|
2426
|
+
U(t, n, i, T, p, o)
|
|
2427
|
+
),
|
|
2428
|
+
([x, b, E, g, d, f, I]) => {
|
|
2429
|
+
const O = nr(b.sizeTree);
|
|
2430
|
+
g && d !== null && f !== null && (E = d.scrollTop - f.offsetTop), E -= I, x({ ranges: O, scrollTop: E });
|
|
2431
|
+
}
|
|
2432
|
+
), B(w(m, W(Ut), j(Ir)), r), B(
|
|
2433
|
+
w(
|
|
2434
|
+
s,
|
|
2435
|
+
U(m),
|
|
2436
|
+
W(([, x]) => x !== void 0),
|
|
2437
|
+
se(),
|
|
2438
|
+
j(([, x]) => x.ranges)
|
|
2439
|
+
),
|
|
2440
|
+
e
|
|
2441
|
+
), {
|
|
2442
|
+
getState: c,
|
|
2443
|
+
restoreStateFrom: m
|
|
2444
|
+
};
|
|
2445
|
+
},
|
|
2446
|
+
ie(Me, be, mt, Ve, Qt)
|
|
2447
|
+
);
|
|
2448
|
+
function Ir(e) {
|
|
2449
|
+
return { align: "start", index: 0, offset: e.scrollTop };
|
|
2450
|
+
}
|
|
2451
|
+
const Sr = J(([{ topItemsIndexes: e }]) => {
|
|
2452
|
+
const t = S(0);
|
|
2453
|
+
return B(
|
|
2454
|
+
w(
|
|
2455
|
+
t,
|
|
2456
|
+
W((o) => o >= 0),
|
|
2457
|
+
j((o) => Array.from({ length: o }).map((n, r) => r))
|
|
2458
|
+
),
|
|
2459
|
+
e
|
|
2460
|
+
), { topItemCount: t };
|
|
2461
|
+
}, ie(qe));
|
|
2462
|
+
function an(e) {
|
|
2463
|
+
let t = !1, o;
|
|
2464
|
+
return () => (t || (t = !0, o = e()), o);
|
|
2465
|
+
}
|
|
2466
|
+
const br = an(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.test(navigator.userAgent)), yr = J(
|
|
2467
|
+
([
|
|
2468
|
+
{ deviation: e, scrollBy: t, scrollingInProgress: o, scrollTop: n },
|
|
2469
|
+
{ isAtBottom: r, isScrolling: s, lastJumpDueToItemResize: i, scrollDirection: l },
|
|
2470
|
+
{ listState: a },
|
|
2471
|
+
{ beforeUnshiftWith: c, gap: m, shiftWithOffset: T, sizes: p },
|
|
2472
|
+
{ log: x },
|
|
2473
|
+
{ recalcInProgress: b }
|
|
2474
|
+
]) => {
|
|
2475
|
+
const E = Re(
|
|
2476
|
+
w(
|
|
2477
|
+
a,
|
|
2478
|
+
U(i),
|
|
2479
|
+
_e(
|
|
2480
|
+
([, d, f, I], [{ bottom: O, items: k, offsetBottom: H, totalCount: u }, v]) => {
|
|
2481
|
+
const y = O + H;
|
|
2482
|
+
let z = 0;
|
|
2483
|
+
return f === u && d.length > 0 && k.length > 0 && (k[0].originalIndex === 0 && d[0].originalIndex === 0 || (z = y - I, z !== 0 && (z += v))), [z, k, u, y];
|
|
2484
|
+
},
|
|
2485
|
+
[0, [], 0, 0]
|
|
2486
|
+
),
|
|
2487
|
+
W(([d]) => d !== 0),
|
|
2488
|
+
U(n, l, o, r, x, b),
|
|
2489
|
+
W(([, d, f, I, , , O]) => !O && !I && d !== 0 && f === ct),
|
|
2490
|
+
j(([[d], , , , , f]) => (f("Upward scrolling compensation", { amount: d }, ye.DEBUG), d))
|
|
2491
|
+
)
|
|
2492
|
+
);
|
|
2493
|
+
function g(d) {
|
|
2494
|
+
d > 0 ? ($(t, { behavior: "auto", top: -d }), $(e, 0)) : ($(e, 0), $(t, { behavior: "auto", top: -d }));
|
|
2495
|
+
}
|
|
2496
|
+
return Z(w(E, U(e, s)), ([d, f, I]) => {
|
|
2497
|
+
I && br() ? $(e, f - d) : g(-d);
|
|
2498
|
+
}), Z(
|
|
2499
|
+
w(
|
|
2500
|
+
de(Se(s, !1), e, b),
|
|
2501
|
+
W(([d, f, I]) => !d && !I && f !== 0),
|
|
2502
|
+
j(([d, f]) => f),
|
|
2503
|
+
We(1)
|
|
2504
|
+
),
|
|
2505
|
+
g
|
|
2506
|
+
), B(
|
|
2507
|
+
w(
|
|
2508
|
+
T,
|
|
2509
|
+
j((d) => ({ top: -d }))
|
|
2510
|
+
),
|
|
2511
|
+
t
|
|
2512
|
+
), Z(
|
|
2513
|
+
w(
|
|
2514
|
+
c,
|
|
2515
|
+
U(p, m),
|
|
2516
|
+
j(([d, { groupIndices: f, lastSize: I, sizeTree: O }, k]) => {
|
|
2517
|
+
function H(u) {
|
|
2518
|
+
return u * (I + k);
|
|
2519
|
+
}
|
|
2520
|
+
if (f.length === 0)
|
|
2521
|
+
return H(d);
|
|
2522
|
+
{
|
|
2523
|
+
let u = 0;
|
|
2524
|
+
const v = it(O, 0);
|
|
2525
|
+
let y = 0, z = 0;
|
|
2526
|
+
for (; y < d; ) {
|
|
2527
|
+
y++, u += v;
|
|
2528
|
+
let A = f.length === z + 1 ? 1 / 0 : f[z + 1] - f[z] - 1;
|
|
2529
|
+
y + A > d && (u -= v, A = d - y + 1), y += A, u += H(A), z++;
|
|
2530
|
+
}
|
|
2531
|
+
return u;
|
|
2532
|
+
}
|
|
2533
|
+
})
|
|
2534
|
+
),
|
|
2535
|
+
(d) => {
|
|
2536
|
+
$(e, d), requestAnimationFrame(() => {
|
|
2537
|
+
$(t, { top: d }), requestAnimationFrame(() => {
|
|
2538
|
+
$(e, 0), $(b, !1);
|
|
2539
|
+
});
|
|
2540
|
+
});
|
|
2541
|
+
}
|
|
2542
|
+
), { deviation: e };
|
|
2543
|
+
},
|
|
2544
|
+
ie(be, ht, qe, Me, Le, qt)
|
|
2545
|
+
), Cr = J(
|
|
2546
|
+
([
|
|
2547
|
+
e,
|
|
2548
|
+
t,
|
|
2549
|
+
o,
|
|
2550
|
+
n,
|
|
2551
|
+
r,
|
|
2552
|
+
s,
|
|
2553
|
+
i,
|
|
2554
|
+
l,
|
|
2555
|
+
a,
|
|
2556
|
+
c,
|
|
2557
|
+
m
|
|
2558
|
+
]) => ({
|
|
2559
|
+
...e,
|
|
2560
|
+
...t,
|
|
2561
|
+
...o,
|
|
2562
|
+
...n,
|
|
2563
|
+
...r,
|
|
2564
|
+
...s,
|
|
2565
|
+
...i,
|
|
2566
|
+
...l,
|
|
2567
|
+
...a,
|
|
2568
|
+
...c,
|
|
2569
|
+
...m
|
|
2570
|
+
}),
|
|
2571
|
+
ie(
|
|
2572
|
+
Kt,
|
|
2573
|
+
vr,
|
|
2574
|
+
Ve,
|
|
2575
|
+
ln,
|
|
2576
|
+
nn,
|
|
2577
|
+
wr,
|
|
2578
|
+
hr,
|
|
2579
|
+
Qt,
|
|
2580
|
+
sn,
|
|
2581
|
+
Le,
|
|
2582
|
+
rn
|
|
2583
|
+
)
|
|
2584
|
+
), cn = J(
|
|
2585
|
+
([
|
|
2586
|
+
{
|
|
2587
|
+
data: e,
|
|
2588
|
+
defaultItemSize: t,
|
|
2589
|
+
firstItemIndex: o,
|
|
2590
|
+
fixedItemSize: n,
|
|
2591
|
+
fixedGroupSize: r,
|
|
2592
|
+
gap: s,
|
|
2593
|
+
groupIndices: i,
|
|
2594
|
+
heightEstimates: l,
|
|
2595
|
+
itemSize: a,
|
|
2596
|
+
sizeRanges: c,
|
|
2597
|
+
sizes: m,
|
|
2598
|
+
statefulTotalCount: T,
|
|
2599
|
+
totalCount: p,
|
|
2600
|
+
trackItemSizes: x
|
|
2601
|
+
},
|
|
2602
|
+
{ initialItemFinalLocationReached: b, initialTopMostItemIndex: E, scrolledToInitialItem: g },
|
|
2603
|
+
d,
|
|
2604
|
+
f,
|
|
2605
|
+
I,
|
|
2606
|
+
O,
|
|
2607
|
+
{ scrollToIndex: k },
|
|
2608
|
+
H,
|
|
2609
|
+
{ topItemCount: u },
|
|
2610
|
+
{ groupCounts: v },
|
|
2611
|
+
y
|
|
2612
|
+
]) => {
|
|
2613
|
+
const { listState: z, minOverscanItemCount: A, topItemsIndexes: F, rangeChanged: D, ..._ } = O;
|
|
2614
|
+
return B(D, y.scrollSeekRangeChanged), B(
|
|
2615
|
+
w(
|
|
2616
|
+
y.windowViewportRect,
|
|
2617
|
+
j((V) => V.visibleHeight)
|
|
2618
|
+
),
|
|
2619
|
+
d.viewportHeight
|
|
2620
|
+
), {
|
|
2621
|
+
data: e,
|
|
2622
|
+
defaultItemHeight: t,
|
|
2623
|
+
firstItemIndex: o,
|
|
2624
|
+
fixedItemHeight: n,
|
|
2625
|
+
fixedGroupHeight: r,
|
|
2626
|
+
gap: s,
|
|
2627
|
+
groupCounts: v,
|
|
2628
|
+
heightEstimates: l,
|
|
2629
|
+
initialItemFinalLocationReached: b,
|
|
2630
|
+
initialTopMostItemIndex: E,
|
|
2631
|
+
scrolledToInitialItem: g,
|
|
2632
|
+
sizeRanges: c,
|
|
2633
|
+
topItemCount: u,
|
|
2634
|
+
topItemsIndexes: F,
|
|
2635
|
+
// input
|
|
2636
|
+
totalCount: p,
|
|
2637
|
+
...I,
|
|
2638
|
+
groupIndices: i,
|
|
2639
|
+
itemSize: a,
|
|
2640
|
+
listState: z,
|
|
2641
|
+
minOverscanItemCount: A,
|
|
2642
|
+
scrollToIndex: k,
|
|
2643
|
+
// output
|
|
2644
|
+
statefulTotalCount: T,
|
|
2645
|
+
trackItemSizes: x,
|
|
2646
|
+
// exported from stateFlagsSystem
|
|
2647
|
+
rangeChanged: D,
|
|
2648
|
+
..._,
|
|
2649
|
+
// the bag of IO from featureGroup1System
|
|
2650
|
+
...y,
|
|
2651
|
+
...d,
|
|
2652
|
+
sizes: m,
|
|
2653
|
+
...f
|
|
2654
|
+
};
|
|
2655
|
+
},
|
|
2656
|
+
ie(
|
|
2657
|
+
Me,
|
|
2658
|
+
mt,
|
|
2659
|
+
be,
|
|
2660
|
+
Tr,
|
|
2661
|
+
xr,
|
|
2662
|
+
qe,
|
|
2663
|
+
ft,
|
|
2664
|
+
yr,
|
|
2665
|
+
Sr,
|
|
2666
|
+
Qo,
|
|
2667
|
+
Cr
|
|
2668
|
+
)
|
|
2669
|
+
);
|
|
2670
|
+
function Rr(e, t) {
|
|
2671
|
+
const o = {}, n = {};
|
|
2672
|
+
let r = 0;
|
|
2673
|
+
const s = e.length;
|
|
2674
|
+
for (; r < s; )
|
|
2675
|
+
n[e[r]] = 1, r += 1;
|
|
2676
|
+
for (const i in t)
|
|
2677
|
+
Object.hasOwn(n, i) || (o[i] = t[i]);
|
|
2678
|
+
return o;
|
|
2679
|
+
}
|
|
2680
|
+
const xt = typeof document < "u" ? P.useLayoutEffect : P.useEffect;
|
|
2681
|
+
function un(e, t, o) {
|
|
2682
|
+
const n = Object.keys(t.required || {}), r = Object.keys(t.optional || {}), s = Object.keys(t.methods || {}), i = Object.keys(t.events || {}), l = P.createContext({});
|
|
2683
|
+
function a(g, d) {
|
|
2684
|
+
g.propsReady && $(g.propsReady, !1);
|
|
2685
|
+
for (const f of n) {
|
|
2686
|
+
const I = g[t.required[f]];
|
|
2687
|
+
$(I, d[f]);
|
|
2688
|
+
}
|
|
2689
|
+
for (const f of r)
|
|
2690
|
+
if (f in d) {
|
|
2691
|
+
const I = g[t.optional[f]];
|
|
2692
|
+
$(I, d[f]);
|
|
2693
|
+
}
|
|
2694
|
+
g.propsReady && $(g.propsReady, !0);
|
|
2695
|
+
}
|
|
2696
|
+
function c(g) {
|
|
2697
|
+
return s.reduce((d, f) => (d[f] = (I) => {
|
|
2698
|
+
const O = g[t.methods[f]];
|
|
2699
|
+
$(O, I);
|
|
2700
|
+
}, d), {});
|
|
2701
|
+
}
|
|
2702
|
+
function m(g) {
|
|
2703
|
+
return i.reduce((d, f) => (d[f] = Ln(g[t.events[f]]), d), {});
|
|
2704
|
+
}
|
|
2705
|
+
const T = P.forwardRef((g, d) => {
|
|
2706
|
+
const { children: f, ...I } = g, [O] = P.useState(() => kt($n(e), (u) => {
|
|
2707
|
+
a(u, I);
|
|
2708
|
+
})), [k] = P.useState(ho(m, O));
|
|
2709
|
+
xt(() => {
|
|
2710
|
+
for (const u of i)
|
|
2711
|
+
u in I && Z(k[u], I[u]);
|
|
2712
|
+
return () => {
|
|
2713
|
+
Object.values(k).map(Gt);
|
|
2714
|
+
};
|
|
2715
|
+
}, [I, k, O]), xt(() => {
|
|
2716
|
+
a(O, I);
|
|
2717
|
+
}), P.useImperativeHandle(d, mo(c(O)));
|
|
2718
|
+
const H = o;
|
|
2719
|
+
return /* @__PURE__ */ C.jsx(l.Provider, { value: O, children: o ? /* @__PURE__ */ C.jsx(H, { ...Rr([...n, ...r, ...i], I), children: f }) : f });
|
|
2720
|
+
}), p = (g) => {
|
|
2721
|
+
const d = P.useContext(l);
|
|
2722
|
+
return P.useCallback(
|
|
2723
|
+
(f) => {
|
|
2724
|
+
$(d[g], f);
|
|
2725
|
+
},
|
|
2726
|
+
[d, g]
|
|
2727
|
+
);
|
|
2728
|
+
}, x = (g) => {
|
|
2729
|
+
const d = P.useContext(l)[g], f = P.useCallback(
|
|
2730
|
+
(I) => Z(d, I),
|
|
2731
|
+
[d]
|
|
2732
|
+
);
|
|
2733
|
+
return P.useSyncExternalStore(
|
|
2734
|
+
f,
|
|
2735
|
+
() => ae(d),
|
|
2736
|
+
() => ae(d)
|
|
2737
|
+
);
|
|
2738
|
+
}, b = (g) => {
|
|
2739
|
+
const d = P.useContext(l)[g], [f, I] = P.useState(ho(ae, d));
|
|
2740
|
+
return xt(
|
|
2741
|
+
() => Z(d, (O) => {
|
|
2742
|
+
O !== f && I(mo(O));
|
|
2743
|
+
}),
|
|
2744
|
+
[d, f]
|
|
2745
|
+
), f;
|
|
2746
|
+
}, E = P.version.startsWith("18") ? x : b;
|
|
2747
|
+
return {
|
|
2748
|
+
Component: T,
|
|
2749
|
+
useEmitter: (g, d) => {
|
|
2750
|
+
const f = P.useContext(l)[g];
|
|
2751
|
+
xt(() => Z(f, d), [d, f]);
|
|
2752
|
+
},
|
|
2753
|
+
useEmitterValue: E,
|
|
2754
|
+
usePublisher: p
|
|
2755
|
+
};
|
|
2756
|
+
}
|
|
2757
|
+
const dn = P.createContext(void 0), fn = P.createContext(void 0), mn = typeof document < "u" ? P.useLayoutEffect : P.useEffect;
|
|
2758
|
+
function Bt(e) {
|
|
2759
|
+
return "self" in e;
|
|
2760
|
+
}
|
|
2761
|
+
function Er(e) {
|
|
2762
|
+
return "body" in e;
|
|
2763
|
+
}
|
|
2764
|
+
function hn(e, t, o, n = Qe, r, s) {
|
|
2765
|
+
const i = P.useRef(null), l = P.useRef(null), a = P.useRef(null), c = P.useCallback(
|
|
2766
|
+
(p) => {
|
|
2767
|
+
let x, b, E;
|
|
2768
|
+
const g = p.target;
|
|
2769
|
+
if (Er(g) || Bt(g)) {
|
|
2770
|
+
const f = Bt(g) ? g : g.defaultView;
|
|
2771
|
+
E = s ? f.scrollX : f.scrollY, x = s ? f.document.documentElement.scrollWidth : f.document.documentElement.scrollHeight, b = s ? f.innerWidth : f.innerHeight;
|
|
2772
|
+
} else
|
|
2773
|
+
E = s ? g.scrollLeft : g.scrollTop, x = s ? g.scrollWidth : g.scrollHeight, b = s ? g.offsetWidth : g.offsetHeight;
|
|
2774
|
+
const d = () => {
|
|
2775
|
+
e({
|
|
2776
|
+
scrollHeight: x,
|
|
2777
|
+
scrollTop: Math.max(E, 0),
|
|
2778
|
+
viewportHeight: b
|
|
2779
|
+
});
|
|
2780
|
+
};
|
|
2781
|
+
p.suppressFlushSync ? d() : Rn.flushSync(d), l.current !== null && (E === l.current || E <= 0 || E === x - b) && (l.current = null, t(!0), a.current && (clearTimeout(a.current), a.current = null));
|
|
2782
|
+
},
|
|
2783
|
+
[e, t, s]
|
|
2784
|
+
);
|
|
2785
|
+
P.useEffect(() => {
|
|
2786
|
+
const p = r || i.current;
|
|
2787
|
+
return n(r || i.current), c({ suppressFlushSync: !0, target: p }), p.addEventListener("scroll", c, { passive: !0 }), () => {
|
|
2788
|
+
n(null), p.removeEventListener("scroll", c);
|
|
2789
|
+
};
|
|
2790
|
+
}, [i, c, o, n, r]);
|
|
2791
|
+
function m(p) {
|
|
2792
|
+
const x = i.current;
|
|
2793
|
+
if (!x || (s ? "offsetWidth" in x && x.offsetWidth === 0 : "offsetHeight" in x && x.offsetHeight === 0))
|
|
2794
|
+
return;
|
|
2795
|
+
const b = p.behavior === "smooth";
|
|
2796
|
+
let E, g, d;
|
|
2797
|
+
Bt(x) ? (g = Math.max(
|
|
2798
|
+
Fe(x.document.documentElement, s ? "width" : "height"),
|
|
2799
|
+
s ? x.document.documentElement.scrollWidth : x.document.documentElement.scrollHeight
|
|
2800
|
+
), E = s ? x.innerWidth : x.innerHeight, d = s ? window.scrollX : window.scrollY) : (g = x[s ? "scrollWidth" : "scrollHeight"], E = Fe(x, s ? "width" : "height"), d = x[s ? "scrollLeft" : "scrollTop"]);
|
|
2801
|
+
const f = g - E;
|
|
2802
|
+
if (p.top = Math.ceil(Math.max(Math.min(f, p.top), 0)), tn(E, g) || p.top === d) {
|
|
2803
|
+
e({ scrollHeight: g, scrollTop: d, viewportHeight: E }), b && t(!0);
|
|
2804
|
+
return;
|
|
2805
|
+
}
|
|
2806
|
+
b ? (l.current = p.top, a.current && clearTimeout(a.current), a.current = setTimeout(() => {
|
|
2807
|
+
a.current = null, l.current = null, t(!0);
|
|
2808
|
+
}, 1e3)) : l.current = null, s && (p = { behavior: p.behavior, left: p.top }), x.scrollTo(p);
|
|
2809
|
+
}
|
|
2810
|
+
function T(p) {
|
|
2811
|
+
s && (p = { behavior: p.behavior, left: p.top }), i.current.scrollBy(p);
|
|
2812
|
+
}
|
|
2813
|
+
return { scrollByCallback: T, scrollerRef: i, scrollToCallback: m };
|
|
2814
|
+
}
|
|
2815
|
+
const At = "-webkit-sticky", Co = "sticky", eo = an(() => {
|
|
2816
|
+
if (typeof document > "u")
|
|
2817
|
+
return Co;
|
|
2818
|
+
const e = document.createElement("div");
|
|
2819
|
+
return e.style.position = At, e.style.position === At ? At : Co;
|
|
2820
|
+
});
|
|
2821
|
+
function to(e) {
|
|
2822
|
+
return e;
|
|
2823
|
+
}
|
|
2824
|
+
const kr = /* @__PURE__ */ J(() => {
|
|
2825
|
+
const e = S((l) => `Item ${l}`), t = S((l) => `Group ${l}`), o = S({}), n = S(to), r = S("div"), s = S(Qe), i = (l, a = null) => Se(
|
|
2826
|
+
w(
|
|
2827
|
+
o,
|
|
2828
|
+
j((c) => c[l]),
|
|
2829
|
+
se()
|
|
2830
|
+
),
|
|
2831
|
+
a
|
|
2832
|
+
);
|
|
2833
|
+
return {
|
|
2834
|
+
components: o,
|
|
2835
|
+
computeItemKey: n,
|
|
2836
|
+
EmptyPlaceholder: i("EmptyPlaceholder"),
|
|
2837
|
+
FooterComponent: i("Footer"),
|
|
2838
|
+
GroupComponent: i("Group", "div"),
|
|
2839
|
+
groupContent: t,
|
|
2840
|
+
HeaderComponent: i("Header"),
|
|
2841
|
+
HeaderFooterTag: r,
|
|
2842
|
+
ItemComponent: i("Item", "div"),
|
|
2843
|
+
itemContent: e,
|
|
2844
|
+
ListComponent: i("List", "div"),
|
|
2845
|
+
ScrollerComponent: i("Scroller", "div"),
|
|
2846
|
+
scrollerRef: s,
|
|
2847
|
+
ScrollSeekPlaceholder: i("ScrollSeekPlaceholder"),
|
|
2848
|
+
TopItemListComponent: i("TopItemList")
|
|
2849
|
+
};
|
|
2850
|
+
}), zr = /* @__PURE__ */ J(
|
|
2851
|
+
([e, t]) => ({ ...e, ...t }),
|
|
2852
|
+
ie(cn, kr)
|
|
2853
|
+
), jr = ({ height: e }) => /* @__PURE__ */ C.jsx("div", { style: { height: e } }), Or = { overflowAnchor: "none", position: eo(), zIndex: 1 }, pn = { overflowAnchor: "none" }, Hr = { ...pn, display: "inline-block", height: "100%" }, Ro = /* @__PURE__ */ P.memo(function({ showTopList: e = !1 }) {
|
|
2854
|
+
const t = L("listState"), o = ze("sizeRanges"), n = L("useWindowScroll"), r = L("customScrollParent"), s = ze("windowScrollContainerState"), i = ze("scrollContainerState"), l = r || n ? s : i, a = L("itemContent"), c = L("context"), m = L("groupContent"), T = L("trackItemSizes"), p = L("itemSize"), x = L("log"), b = ze("gap"), E = L("horizontalDirection"), { callbackRef: g } = Yn(
|
|
2855
|
+
o,
|
|
2856
|
+
p,
|
|
2857
|
+
T,
|
|
2858
|
+
e ? Qe : l,
|
|
2859
|
+
x,
|
|
2860
|
+
b,
|
|
2861
|
+
r,
|
|
2862
|
+
E,
|
|
2863
|
+
L("skipAnimationFrameInResizeObserver")
|
|
2864
|
+
), [d, f] = P.useState(0);
|
|
2865
|
+
oo("deviation", (_) => {
|
|
2866
|
+
d !== _ && f(_);
|
|
2867
|
+
});
|
|
2868
|
+
const I = L("EmptyPlaceholder"), O = L("ScrollSeekPlaceholder") || jr, k = L("ListComponent"), H = L("ItemComponent"), u = L("GroupComponent"), v = L("computeItemKey"), y = L("isSeeking"), z = L("groupIndices").length > 0, A = L("alignToBottom"), F = L("initialItemFinalLocationReached"), D = e ? {} : {
|
|
2869
|
+
boxSizing: "border-box",
|
|
2870
|
+
...E ? {
|
|
2871
|
+
display: "inline-block",
|
|
2872
|
+
height: "100%",
|
|
2873
|
+
marginLeft: d !== 0 ? d : A ? "auto" : 0,
|
|
2874
|
+
paddingLeft: t.offsetTop,
|
|
2875
|
+
paddingRight: t.offsetBottom,
|
|
2876
|
+
whiteSpace: "nowrap"
|
|
2877
|
+
} : {
|
|
2878
|
+
marginTop: d !== 0 ? d : A ? "auto" : 0,
|
|
2879
|
+
paddingBottom: t.offsetBottom,
|
|
2880
|
+
paddingTop: t.offsetTop
|
|
2881
|
+
},
|
|
2882
|
+
...F ? {} : { visibility: "hidden" }
|
|
2883
|
+
};
|
|
2884
|
+
return !e && t.totalCount === 0 && I ? /* @__PURE__ */ C.jsx(I, { ...Ie(I, c) }) : /* @__PURE__ */ C.jsx(
|
|
2885
|
+
k,
|
|
2886
|
+
{
|
|
2887
|
+
...Ie(k, c),
|
|
2888
|
+
"data-testid": e ? "virtuoso-top-item-list" : "virtuoso-item-list",
|
|
2889
|
+
ref: g,
|
|
2890
|
+
style: D,
|
|
2891
|
+
children: (e ? t.topItems : t.items).map((_) => {
|
|
2892
|
+
const V = _.originalIndex, X = v(V + t.firstItemIndex, _.data, c);
|
|
2893
|
+
return y ? /* @__PURE__ */ wt(
|
|
2894
|
+
O,
|
|
2895
|
+
{
|
|
2896
|
+
...Ie(O, c),
|
|
2897
|
+
height: _.size,
|
|
2898
|
+
index: _.index,
|
|
2899
|
+
key: X,
|
|
2900
|
+
type: _.type || "item",
|
|
2901
|
+
..._.type === "group" ? {} : { groupIndex: _.groupIndex }
|
|
2902
|
+
}
|
|
2903
|
+
) : _.type === "group" ? /* @__PURE__ */ wt(
|
|
2904
|
+
u,
|
|
2905
|
+
{
|
|
2906
|
+
...Ie(u, c),
|
|
2907
|
+
"data-index": V,
|
|
2908
|
+
"data-item-index": _.index,
|
|
2909
|
+
"data-known-size": _.size,
|
|
2910
|
+
key: X,
|
|
2911
|
+
style: Or
|
|
2912
|
+
},
|
|
2913
|
+
m(_.index, c)
|
|
2914
|
+
) : /* @__PURE__ */ wt(
|
|
2915
|
+
H,
|
|
2916
|
+
{
|
|
2917
|
+
...Ie(H, c),
|
|
2918
|
+
..._r(H, _.data),
|
|
2919
|
+
"data-index": V,
|
|
2920
|
+
"data-item-group-index": _.groupIndex,
|
|
2921
|
+
"data-item-index": _.index,
|
|
2922
|
+
"data-known-size": _.size,
|
|
2923
|
+
key: X,
|
|
2924
|
+
style: E ? Hr : pn
|
|
2925
|
+
},
|
|
2926
|
+
z ? a(_.index, _.groupIndex, _.data, c) : a(_.index, _.data, c)
|
|
2927
|
+
);
|
|
2928
|
+
})
|
|
2929
|
+
}
|
|
2930
|
+
);
|
|
2931
|
+
}), Pr = {
|
|
2932
|
+
height: "100%",
|
|
2933
|
+
outline: "none",
|
|
2934
|
+
overflowY: "auto",
|
|
2935
|
+
position: "relative",
|
|
2936
|
+
WebkitOverflowScrolling: "touch"
|
|
2937
|
+
}, Br = {
|
|
2938
|
+
outline: "none",
|
|
2939
|
+
overflowX: "auto",
|
|
2940
|
+
position: "relative"
|
|
2941
|
+
}, jt = (e) => ({
|
|
2942
|
+
height: "100%",
|
|
2943
|
+
position: "absolute",
|
|
2944
|
+
top: 0,
|
|
2945
|
+
width: "100%",
|
|
2946
|
+
...e ? { display: "flex", flexDirection: "column" } : {}
|
|
2947
|
+
}), Ar = {
|
|
2948
|
+
position: eo(),
|
|
2949
|
+
top: 0,
|
|
2950
|
+
width: "100%",
|
|
2951
|
+
zIndex: 1
|
|
2952
|
+
};
|
|
2953
|
+
function Ie(e, t) {
|
|
2954
|
+
if (typeof e != "string")
|
|
2955
|
+
return { context: t };
|
|
2956
|
+
}
|
|
2957
|
+
function _r(e, t) {
|
|
2958
|
+
return { item: typeof e == "string" ? void 0 : t };
|
|
2959
|
+
}
|
|
2960
|
+
const Mr = /* @__PURE__ */ P.memo(function() {
|
|
2961
|
+
const e = L("HeaderComponent"), t = ze("headerHeight"), o = L("HeaderFooterTag"), n = Ye(
|
|
2962
|
+
P.useMemo(
|
|
2963
|
+
() => (s) => {
|
|
2964
|
+
t(Fe(s, "height"));
|
|
2965
|
+
},
|
|
2966
|
+
[t]
|
|
2967
|
+
),
|
|
2968
|
+
!0,
|
|
2969
|
+
L("skipAnimationFrameInResizeObserver")
|
|
2970
|
+
), r = L("context");
|
|
2971
|
+
return e ? /* @__PURE__ */ C.jsx(o, { ref: n, children: /* @__PURE__ */ C.jsx(e, { ...Ie(e, r) }) }) : null;
|
|
2972
|
+
}), Nr = /* @__PURE__ */ P.memo(function() {
|
|
2973
|
+
const e = L("FooterComponent"), t = ze("footerHeight"), o = L("HeaderFooterTag"), n = Ye(
|
|
2974
|
+
P.useMemo(
|
|
2975
|
+
() => (s) => {
|
|
2976
|
+
t(Fe(s, "height"));
|
|
2977
|
+
},
|
|
2978
|
+
[t]
|
|
2979
|
+
),
|
|
2980
|
+
!0,
|
|
2981
|
+
L("skipAnimationFrameInResizeObserver")
|
|
2982
|
+
), r = L("context");
|
|
2983
|
+
return e ? /* @__PURE__ */ C.jsx(o, { ref: n, children: /* @__PURE__ */ C.jsx(e, { ...Ie(e, r) }) }) : null;
|
|
2984
|
+
});
|
|
2985
|
+
function gn({ useEmitter: e, useEmitterValue: t, usePublisher: o }) {
|
|
2986
|
+
return P.memo(function({ children: n, style: r, context: s, ...i }) {
|
|
2987
|
+
const l = o("scrollContainerState"), a = t("ScrollerComponent"), c = o("smoothScrollTargetReached"), m = t("scrollerRef"), T = t("horizontalDirection") || !1, { scrollByCallback: p, scrollerRef: x, scrollToCallback: b } = hn(
|
|
2988
|
+
l,
|
|
2989
|
+
c,
|
|
2990
|
+
a,
|
|
2991
|
+
m,
|
|
2992
|
+
void 0,
|
|
2993
|
+
T
|
|
2994
|
+
);
|
|
2995
|
+
return e("scrollTo", b), e("scrollBy", p), /* @__PURE__ */ C.jsx(
|
|
2996
|
+
a,
|
|
2997
|
+
{
|
|
2998
|
+
"data-testid": "virtuoso-scroller",
|
|
2999
|
+
"data-virtuoso-scroller": !0,
|
|
3000
|
+
ref: x,
|
|
3001
|
+
style: { ...T ? Br : Pr, ...r },
|
|
3002
|
+
tabIndex: 0,
|
|
3003
|
+
...i,
|
|
3004
|
+
...Ie(a, s),
|
|
3005
|
+
children: n
|
|
3006
|
+
}
|
|
3007
|
+
);
|
|
3008
|
+
});
|
|
3009
|
+
}
|
|
3010
|
+
function xn({ useEmitter: e, useEmitterValue: t, usePublisher: o }) {
|
|
3011
|
+
return P.memo(function({ children: n, style: r, context: s, ...i }) {
|
|
3012
|
+
const l = o("windowScrollContainerState"), a = t("ScrollerComponent"), c = o("smoothScrollTargetReached"), m = t("totalListHeight"), T = t("deviation"), p = t("customScrollParent"), x = P.useRef(null), b = t("scrollerRef"), { scrollByCallback: E, scrollerRef: g, scrollToCallback: d } = hn(
|
|
3013
|
+
l,
|
|
3014
|
+
c,
|
|
3015
|
+
a,
|
|
3016
|
+
b,
|
|
3017
|
+
p
|
|
3018
|
+
);
|
|
3019
|
+
return mn(() => {
|
|
3020
|
+
var f;
|
|
3021
|
+
return g.current = p || ((f = x.current) == null ? void 0 : f.ownerDocument.defaultView), () => {
|
|
3022
|
+
g.current = null;
|
|
3023
|
+
};
|
|
3024
|
+
}, [g, p]), e("windowScrollTo", d), e("scrollBy", E), /* @__PURE__ */ C.jsx(
|
|
3025
|
+
a,
|
|
3026
|
+
{
|
|
3027
|
+
ref: x,
|
|
3028
|
+
"data-virtuoso-scroller": !0,
|
|
3029
|
+
style: { position: "relative", ...r, ...m !== 0 ? { height: m + T } : {} },
|
|
3030
|
+
...i,
|
|
3031
|
+
...Ie(a, s),
|
|
3032
|
+
children: n
|
|
3033
|
+
}
|
|
3034
|
+
);
|
|
3035
|
+
});
|
|
3036
|
+
}
|
|
3037
|
+
const Wr = ({ children: e }) => {
|
|
3038
|
+
const t = P.useContext(dn), o = ze("viewportHeight"), n = ze("fixedItemHeight"), r = L("alignToBottom"), s = L("horizontalDirection"), i = P.useMemo(
|
|
3039
|
+
() => Do(o, (a) => Fe(a, s ? "width" : "height")),
|
|
3040
|
+
[o, s]
|
|
3041
|
+
), l = Ye(i, !0, L("skipAnimationFrameInResizeObserver"));
|
|
3042
|
+
return P.useEffect(() => {
|
|
3043
|
+
t && (o(t.viewportHeight), n(t.itemHeight));
|
|
3044
|
+
}, [t, o, n]), /* @__PURE__ */ C.jsx("div", { "data-viewport-type": "element", ref: l, style: jt(r), children: e });
|
|
3045
|
+
}, Fr = ({ children: e }) => {
|
|
3046
|
+
const t = P.useContext(dn), o = ze("windowViewportRect"), n = ze("fixedItemHeight"), r = L("customScrollParent"), s = Vo(
|
|
3047
|
+
o,
|
|
3048
|
+
r,
|
|
3049
|
+
L("skipAnimationFrameInResizeObserver")
|
|
3050
|
+
), i = L("alignToBottom");
|
|
3051
|
+
return P.useEffect(() => {
|
|
3052
|
+
t && (n(t.itemHeight), o({ offsetTop: 0, visibleHeight: t.viewportHeight, visibleWidth: 100 }));
|
|
3053
|
+
}, [t, o, n]), /* @__PURE__ */ C.jsx("div", { "data-viewport-type": "window", ref: s, style: jt(i), children: e });
|
|
3054
|
+
}, Dr = ({ children: e }) => {
|
|
3055
|
+
const t = L("TopItemListComponent") || "div", o = L("headerHeight"), n = { ...Ar, marginTop: `${o}px` }, r = L("context");
|
|
3056
|
+
return /* @__PURE__ */ C.jsx(t, { style: n, ...Ie(t, r), children: e });
|
|
3057
|
+
}, Lr = /* @__PURE__ */ P.memo(function(e) {
|
|
3058
|
+
const t = L("useWindowScroll"), o = L("topItemsIndexes").length > 0, n = L("customScrollParent"), r = L("context");
|
|
3059
|
+
return /* @__PURE__ */ C.jsxs(n || t ? Ur : $r, { ...e, context: r, children: [
|
|
3060
|
+
o && /* @__PURE__ */ C.jsx(Dr, { children: /* @__PURE__ */ C.jsx(Ro, { showTopList: !0 }) }),
|
|
3061
|
+
/* @__PURE__ */ C.jsxs(n || t ? Fr : Wr, { children: [
|
|
3062
|
+
/* @__PURE__ */ C.jsx(Mr, {}),
|
|
3063
|
+
/* @__PURE__ */ C.jsx(Ro, {}),
|
|
3064
|
+
/* @__PURE__ */ C.jsx(Nr, {})
|
|
3065
|
+
] })
|
|
3066
|
+
] });
|
|
3067
|
+
}), {
|
|
3068
|
+
Component: Vr,
|
|
3069
|
+
useEmitter: oo,
|
|
3070
|
+
useEmitterValue: L,
|
|
3071
|
+
usePublisher: ze
|
|
3072
|
+
} = /* @__PURE__ */ un(
|
|
3073
|
+
zr,
|
|
3074
|
+
{
|
|
3075
|
+
required: {},
|
|
3076
|
+
optional: {
|
|
3077
|
+
restoreStateFrom: "restoreStateFrom",
|
|
3078
|
+
context: "context",
|
|
3079
|
+
followOutput: "followOutput",
|
|
3080
|
+
scrollIntoViewOnChange: "scrollIntoViewOnChange",
|
|
3081
|
+
itemContent: "itemContent",
|
|
3082
|
+
groupContent: "groupContent",
|
|
3083
|
+
overscan: "overscan",
|
|
3084
|
+
increaseViewportBy: "increaseViewportBy",
|
|
3085
|
+
minOverscanItemCount: "minOverscanItemCount",
|
|
3086
|
+
totalCount: "totalCount",
|
|
3087
|
+
groupCounts: "groupCounts",
|
|
3088
|
+
topItemCount: "topItemCount",
|
|
3089
|
+
firstItemIndex: "firstItemIndex",
|
|
3090
|
+
initialTopMostItemIndex: "initialTopMostItemIndex",
|
|
3091
|
+
components: "components",
|
|
3092
|
+
atBottomThreshold: "atBottomThreshold",
|
|
3093
|
+
atTopThreshold: "atTopThreshold",
|
|
3094
|
+
computeItemKey: "computeItemKey",
|
|
3095
|
+
defaultItemHeight: "defaultItemHeight",
|
|
3096
|
+
fixedGroupHeight: "fixedGroupHeight",
|
|
3097
|
+
// Must be set above 'fixedItemHeight'
|
|
3098
|
+
fixedItemHeight: "fixedItemHeight",
|
|
3099
|
+
heightEstimates: "heightEstimates",
|
|
3100
|
+
itemSize: "itemSize",
|
|
3101
|
+
scrollSeekConfiguration: "scrollSeekConfiguration",
|
|
3102
|
+
headerFooterTag: "HeaderFooterTag",
|
|
3103
|
+
data: "data",
|
|
3104
|
+
initialItemCount: "initialItemCount",
|
|
3105
|
+
initialScrollTop: "initialScrollTop",
|
|
3106
|
+
alignToBottom: "alignToBottom",
|
|
3107
|
+
useWindowScroll: "useWindowScroll",
|
|
3108
|
+
customScrollParent: "customScrollParent",
|
|
3109
|
+
scrollerRef: "scrollerRef",
|
|
3110
|
+
logLevel: "logLevel",
|
|
3111
|
+
horizontalDirection: "horizontalDirection",
|
|
3112
|
+
skipAnimationFrameInResizeObserver: "skipAnimationFrameInResizeObserver"
|
|
3113
|
+
},
|
|
3114
|
+
methods: {
|
|
3115
|
+
scrollToIndex: "scrollToIndex",
|
|
3116
|
+
scrollIntoView: "scrollIntoView",
|
|
3117
|
+
scrollTo: "scrollTo",
|
|
3118
|
+
scrollBy: "scrollBy",
|
|
3119
|
+
autoscrollToBottom: "autoscrollToBottom",
|
|
3120
|
+
getState: "getState"
|
|
3121
|
+
},
|
|
3122
|
+
events: {
|
|
3123
|
+
isScrolling: "isScrolling",
|
|
3124
|
+
endReached: "endReached",
|
|
3125
|
+
startReached: "startReached",
|
|
3126
|
+
rangeChanged: "rangeChanged",
|
|
3127
|
+
atBottomStateChange: "atBottomStateChange",
|
|
3128
|
+
atTopStateChange: "atTopStateChange",
|
|
3129
|
+
totalListHeightChanged: "totalListHeightChanged",
|
|
3130
|
+
itemsRendered: "itemsRendered",
|
|
3131
|
+
groupIndices: "groupIndices"
|
|
3132
|
+
}
|
|
3133
|
+
},
|
|
3134
|
+
Lr
|
|
3135
|
+
), $r = /* @__PURE__ */ gn({ useEmitter: oo, useEmitterValue: L, usePublisher: ze }), Ur = /* @__PURE__ */ xn({ useEmitter: oo, useEmitterValue: L, usePublisher: ze }), Gr = Vr, Yr = /* @__PURE__ */ J(() => {
|
|
3136
|
+
const e = S((c) => /* @__PURE__ */ C.jsxs("td", { children: [
|
|
3137
|
+
"Item $",
|
|
3138
|
+
c
|
|
3139
|
+
] })), t = S(null), o = S((c) => /* @__PURE__ */ C.jsxs("td", { colSpan: 1e3, children: [
|
|
3140
|
+
"Group ",
|
|
3141
|
+
c
|
|
3142
|
+
] })), n = S(null), r = S(null), s = S({}), i = S(to), l = S(Qe), a = (c, m = null) => Se(
|
|
3143
|
+
w(
|
|
3144
|
+
s,
|
|
3145
|
+
j((T) => T[c]),
|
|
3146
|
+
se()
|
|
3147
|
+
),
|
|
3148
|
+
m
|
|
3149
|
+
);
|
|
3150
|
+
return {
|
|
3151
|
+
components: s,
|
|
3152
|
+
computeItemKey: i,
|
|
3153
|
+
context: t,
|
|
3154
|
+
EmptyPlaceholder: a("EmptyPlaceholder"),
|
|
3155
|
+
FillerRow: a("FillerRow"),
|
|
3156
|
+
fixedFooterContent: r,
|
|
3157
|
+
fixedHeaderContent: n,
|
|
3158
|
+
itemContent: e,
|
|
3159
|
+
groupContent: o,
|
|
3160
|
+
ScrollerComponent: a("Scroller", "div"),
|
|
3161
|
+
scrollerRef: l,
|
|
3162
|
+
ScrollSeekPlaceholder: a("ScrollSeekPlaceholder"),
|
|
3163
|
+
TableBodyComponent: a("TableBody", "tbody"),
|
|
3164
|
+
TableComponent: a("Table", "table"),
|
|
3165
|
+
TableFooterComponent: a("TableFoot", "tfoot"),
|
|
3166
|
+
TableHeadComponent: a("TableHead", "thead"),
|
|
3167
|
+
TableRowComponent: a("TableRow", "tr"),
|
|
3168
|
+
GroupComponent: a("Group", "tr")
|
|
3169
|
+
};
|
|
3170
|
+
});
|
|
3171
|
+
ie(cn, Yr);
|
|
3172
|
+
eo();
|
|
3173
|
+
const Eo = {
|
|
3174
|
+
bottom: 0,
|
|
3175
|
+
itemHeight: 0,
|
|
3176
|
+
items: [],
|
|
3177
|
+
itemWidth: 0,
|
|
3178
|
+
offsetBottom: 0,
|
|
3179
|
+
offsetTop: 0,
|
|
3180
|
+
top: 0
|
|
3181
|
+
}, qr = {
|
|
3182
|
+
bottom: 0,
|
|
3183
|
+
itemHeight: 0,
|
|
3184
|
+
items: [{ index: 0 }],
|
|
3185
|
+
itemWidth: 0,
|
|
3186
|
+
offsetBottom: 0,
|
|
3187
|
+
offsetTop: 0,
|
|
3188
|
+
top: 0
|
|
3189
|
+
}, { ceil: ko, floor: yt, max: rt, min: _t, round: zo } = Math;
|
|
3190
|
+
function jo(e, t, o) {
|
|
3191
|
+
return Array.from({ length: t - e + 1 }).map((n, r) => ({ data: o === null ? null : o[r + e], index: r + e }));
|
|
3192
|
+
}
|
|
3193
|
+
function Jr(e) {
|
|
3194
|
+
return {
|
|
3195
|
+
...qr,
|
|
3196
|
+
items: e
|
|
3197
|
+
};
|
|
3198
|
+
}
|
|
3199
|
+
function vt(e, t) {
|
|
3200
|
+
return e && e.width === t.width && e.height === t.height;
|
|
3201
|
+
}
|
|
3202
|
+
function Xr(e, t) {
|
|
3203
|
+
return e && e.column === t.column && e.row === t.row;
|
|
3204
|
+
}
|
|
3205
|
+
const Zr = /* @__PURE__ */ J(
|
|
3206
|
+
([
|
|
3207
|
+
{ increaseViewportBy: e, listBoundary: t, overscan: o, visibleRange: n },
|
|
3208
|
+
{ footerHeight: r, headerHeight: s, scrollBy: i, scrollContainerState: l, scrollTo: a, scrollTop: c, smoothScrollTargetReached: m, viewportHeight: T },
|
|
3209
|
+
p,
|
|
3210
|
+
x,
|
|
3211
|
+
{ didMount: b, propsReady: E },
|
|
3212
|
+
{ customScrollParent: g, useWindowScroll: d, windowScrollContainerState: f, windowScrollTo: I, windowViewportRect: O },
|
|
3213
|
+
k
|
|
3214
|
+
]) => {
|
|
3215
|
+
const H = S(0), u = S(0), v = S(Eo), y = S({ height: 0, width: 0 }), z = S({ height: 0, width: 0 }), A = Y(), F = Y(), D = S(0), _ = S(null), V = S({ column: 0, row: 0 }), X = Y(), K = Y(), ve = S(!1), we = S(0), Te = S(!0), h = S(!1), M = S(!1);
|
|
3216
|
+
Z(
|
|
3217
|
+
w(
|
|
3218
|
+
b,
|
|
3219
|
+
U(we),
|
|
3220
|
+
W(([R, G]) => !!G)
|
|
3221
|
+
),
|
|
3222
|
+
() => {
|
|
3223
|
+
$(Te, !1);
|
|
3224
|
+
}
|
|
3225
|
+
), Z(
|
|
3226
|
+
w(
|
|
3227
|
+
de(b, Te, z, y, we, h),
|
|
3228
|
+
W(([R, G, ne, pe, , Ee]) => R && !G && ne.height !== 0 && pe.height !== 0 && !Ee)
|
|
3229
|
+
),
|
|
3230
|
+
([, , , , R]) => {
|
|
3231
|
+
$(h, !0), Xt(1, () => {
|
|
3232
|
+
$(A, R);
|
|
3233
|
+
}), Oe(w(c), () => {
|
|
3234
|
+
$(t, [0, 0]), $(Te, !0);
|
|
3235
|
+
});
|
|
3236
|
+
}
|
|
3237
|
+
), B(
|
|
3238
|
+
w(
|
|
3239
|
+
K,
|
|
3240
|
+
W((R) => R != null && R.scrollTop > 0),
|
|
3241
|
+
Ae(0)
|
|
3242
|
+
),
|
|
3243
|
+
u
|
|
3244
|
+
), Z(
|
|
3245
|
+
w(
|
|
3246
|
+
b,
|
|
3247
|
+
U(K),
|
|
3248
|
+
W(([, R]) => R != null)
|
|
3249
|
+
),
|
|
3250
|
+
([, R]) => {
|
|
3251
|
+
R && ($(y, R.viewport), $(z, R.item), $(V, R.gap), R.scrollTop > 0 && ($(ve, !0), Oe(w(c, Ge(1)), (G) => {
|
|
3252
|
+
$(ve, !1);
|
|
3253
|
+
}), $(a, { top: R.scrollTop })));
|
|
3254
|
+
}
|
|
3255
|
+
), B(
|
|
3256
|
+
w(
|
|
3257
|
+
y,
|
|
3258
|
+
j(({ height: R }) => R)
|
|
3259
|
+
),
|
|
3260
|
+
T
|
|
3261
|
+
), B(
|
|
3262
|
+
w(
|
|
3263
|
+
de(
|
|
3264
|
+
N(y, vt),
|
|
3265
|
+
N(z, vt),
|
|
3266
|
+
N(V, (R, G) => R && R.column === G.column && R.row === G.row),
|
|
3267
|
+
N(c)
|
|
3268
|
+
),
|
|
3269
|
+
j(([R, G, ne, pe]) => ({
|
|
3270
|
+
gap: ne,
|
|
3271
|
+
item: G,
|
|
3272
|
+
scrollTop: pe,
|
|
3273
|
+
viewport: R
|
|
3274
|
+
}))
|
|
3275
|
+
),
|
|
3276
|
+
X
|
|
3277
|
+
), B(
|
|
3278
|
+
w(
|
|
3279
|
+
de(
|
|
3280
|
+
N(H),
|
|
3281
|
+
n,
|
|
3282
|
+
N(V, Xr),
|
|
3283
|
+
N(z, vt),
|
|
3284
|
+
N(y, vt),
|
|
3285
|
+
N(_),
|
|
3286
|
+
N(u),
|
|
3287
|
+
N(ve),
|
|
3288
|
+
N(Te),
|
|
3289
|
+
N(we)
|
|
3290
|
+
),
|
|
3291
|
+
W(([, , , , , , , R]) => !R),
|
|
3292
|
+
j(
|
|
3293
|
+
([
|
|
3294
|
+
R,
|
|
3295
|
+
[G, ne],
|
|
3296
|
+
pe,
|
|
3297
|
+
Ee,
|
|
3298
|
+
fe,
|
|
3299
|
+
ce,
|
|
3300
|
+
he,
|
|
3301
|
+
,
|
|
3302
|
+
ue,
|
|
3303
|
+
te
|
|
3304
|
+
]) => {
|
|
3305
|
+
const { column: re, row: ke } = pe, { height: ge, width: Ot } = Ee, { width: no } = fe;
|
|
3306
|
+
if (he === 0 && (R === 0 || no === 0))
|
|
3307
|
+
return Eo;
|
|
3308
|
+
if (Ot === 0) {
|
|
3309
|
+
const ao = Zt(te, R), bn = ao + Math.max(he - 1, 0);
|
|
3310
|
+
return Jr(jo(ao, bn, ce));
|
|
3311
|
+
}
|
|
3312
|
+
const pt = vn(no, Ot, re);
|
|
3313
|
+
let Je, $e;
|
|
3314
|
+
ue ? G === 0 && ne === 0 && he > 0 ? (Je = 0, $e = he - 1) : (Je = pt * yt((G + ke) / (ge + ke)), $e = pt * ko((ne + ke) / (ge + ke)) - 1, $e = _t(R - 1, rt($e, pt - 1)), Je = _t($e, rt(0, Je))) : (Je = 0, $e = -1);
|
|
3315
|
+
const ro = jo(Je, $e, ce), { bottom: so, top: io } = Oo(fe, pe, Ee, ro), lo = ko(R / pt), Sn = lo * ge + (lo - 1) * ke - so;
|
|
3316
|
+
return { bottom: so, itemHeight: ge, items: ro, itemWidth: Ot, offsetBottom: Sn, offsetTop: io, top: io };
|
|
3317
|
+
}
|
|
3318
|
+
)
|
|
3319
|
+
),
|
|
3320
|
+
v
|
|
3321
|
+
), B(
|
|
3322
|
+
w(
|
|
3323
|
+
_,
|
|
3324
|
+
W((R) => R !== null),
|
|
3325
|
+
j((R) => R.length)
|
|
3326
|
+
),
|
|
3327
|
+
H
|
|
3328
|
+
), B(
|
|
3329
|
+
w(
|
|
3330
|
+
de(y, z, v, V),
|
|
3331
|
+
W(([R, G, { items: ne }]) => ne.length > 0 && G.height !== 0 && R.height !== 0),
|
|
3332
|
+
j(([R, G, { items: ne }, pe]) => {
|
|
3333
|
+
const { bottom: Ee, top: fe } = Oo(R, pe, G, ne);
|
|
3334
|
+
return [fe, Ee];
|
|
3335
|
+
}),
|
|
3336
|
+
se(lt)
|
|
3337
|
+
),
|
|
3338
|
+
t
|
|
3339
|
+
);
|
|
3340
|
+
const q = S(!1);
|
|
3341
|
+
B(
|
|
3342
|
+
w(
|
|
3343
|
+
c,
|
|
3344
|
+
U(q),
|
|
3345
|
+
j(([R, G]) => G || R !== 0)
|
|
3346
|
+
),
|
|
3347
|
+
q
|
|
3348
|
+
);
|
|
3349
|
+
const Q = Re(
|
|
3350
|
+
w(
|
|
3351
|
+
de(v, H),
|
|
3352
|
+
W(([{ items: R }]) => R.length > 0),
|
|
3353
|
+
U(q),
|
|
3354
|
+
W(([[R, G], ne]) => {
|
|
3355
|
+
const pe = R.items[R.items.length - 1].index === G - 1;
|
|
3356
|
+
return (ne || R.bottom > 0 && R.itemHeight > 0 && R.offsetBottom === 0 && R.items.length === G) && pe;
|
|
3357
|
+
}),
|
|
3358
|
+
j(([[, R]]) => R - 1),
|
|
3359
|
+
se()
|
|
3360
|
+
)
|
|
3361
|
+
), Pe = Re(
|
|
3362
|
+
w(
|
|
3363
|
+
N(v),
|
|
3364
|
+
W(({ items: R }) => R.length > 0 && R[0].index === 0),
|
|
3365
|
+
Ae(0),
|
|
3366
|
+
se()
|
|
3367
|
+
)
|
|
3368
|
+
), Be = Re(
|
|
3369
|
+
w(
|
|
3370
|
+
N(v),
|
|
3371
|
+
U(ve),
|
|
3372
|
+
W(([{ items: R }, G]) => R.length > 0 && !G),
|
|
3373
|
+
j(([{ items: R }]) => ({
|
|
3374
|
+
endIndex: R[R.length - 1].index,
|
|
3375
|
+
startIndex: R[0].index
|
|
3376
|
+
})),
|
|
3377
|
+
se(Jo),
|
|
3378
|
+
We(0)
|
|
3379
|
+
)
|
|
3380
|
+
);
|
|
3381
|
+
B(Be, x.scrollSeekRangeChanged), B(
|
|
3382
|
+
w(
|
|
3383
|
+
A,
|
|
3384
|
+
U(y, z, H, V),
|
|
3385
|
+
j(([R, G, ne, pe, Ee]) => {
|
|
3386
|
+
const fe = en(R), { align: ce, behavior: he, offset: ue } = fe;
|
|
3387
|
+
let te = fe.index;
|
|
3388
|
+
te === "LAST" && (te = pe - 1), te = rt(0, te, _t(pe - 1, te));
|
|
3389
|
+
let re = Lt(G, Ee, ne, te);
|
|
3390
|
+
return ce === "end" ? re = zo(re - G.height + ne.height) : ce === "center" && (re = zo(re - G.height / 2 + ne.height / 2)), ue && (re += ue), { behavior: he, top: re };
|
|
3391
|
+
})
|
|
3392
|
+
),
|
|
3393
|
+
a
|
|
3394
|
+
);
|
|
3395
|
+
const ee = Se(
|
|
3396
|
+
w(
|
|
3397
|
+
v,
|
|
3398
|
+
j((R) => R.offsetBottom + R.bottom)
|
|
3399
|
+
),
|
|
3400
|
+
0
|
|
3401
|
+
);
|
|
3402
|
+
return B(
|
|
3403
|
+
w(
|
|
3404
|
+
O,
|
|
3405
|
+
j((R) => ({ height: R.visibleHeight, width: R.visibleWidth }))
|
|
3406
|
+
),
|
|
3407
|
+
y
|
|
3408
|
+
), {
|
|
3409
|
+
customScrollParent: g,
|
|
3410
|
+
// input
|
|
3411
|
+
data: _,
|
|
3412
|
+
deviation: D,
|
|
3413
|
+
footerHeight: r,
|
|
3414
|
+
gap: V,
|
|
3415
|
+
headerHeight: s,
|
|
3416
|
+
increaseViewportBy: e,
|
|
3417
|
+
initialItemCount: u,
|
|
3418
|
+
itemDimensions: z,
|
|
3419
|
+
overscan: o,
|
|
3420
|
+
restoreStateFrom: K,
|
|
3421
|
+
scrollBy: i,
|
|
3422
|
+
scrollContainerState: l,
|
|
3423
|
+
scrollHeight: F,
|
|
3424
|
+
scrollTo: a,
|
|
3425
|
+
scrollToIndex: A,
|
|
3426
|
+
scrollTop: c,
|
|
3427
|
+
smoothScrollTargetReached: m,
|
|
3428
|
+
totalCount: H,
|
|
3429
|
+
useWindowScroll: d,
|
|
3430
|
+
viewportDimensions: y,
|
|
3431
|
+
windowScrollContainerState: f,
|
|
3432
|
+
windowScrollTo: I,
|
|
3433
|
+
windowViewportRect: O,
|
|
3434
|
+
...x,
|
|
3435
|
+
// output
|
|
3436
|
+
gridState: v,
|
|
3437
|
+
horizontalDirection: M,
|
|
3438
|
+
initialTopMostItemIndex: we,
|
|
3439
|
+
totalListHeight: ee,
|
|
3440
|
+
...p,
|
|
3441
|
+
endReached: Q,
|
|
3442
|
+
propsReady: E,
|
|
3443
|
+
rangeChanged: Be,
|
|
3444
|
+
startReached: Pe,
|
|
3445
|
+
stateChanged: X,
|
|
3446
|
+
stateRestoreInProgress: ve,
|
|
3447
|
+
...k
|
|
3448
|
+
};
|
|
3449
|
+
},
|
|
3450
|
+
ie(Kt, be, ht, ln, Ve, Qt, Le)
|
|
3451
|
+
);
|
|
3452
|
+
function vn(e, t, o) {
|
|
3453
|
+
return rt(1, yt((e + o) / (yt(t) + o)));
|
|
3454
|
+
}
|
|
3455
|
+
function Oo(e, t, o, n) {
|
|
3456
|
+
const { height: r } = o;
|
|
3457
|
+
if (r === void 0 || n.length === 0)
|
|
3458
|
+
return { bottom: 0, top: 0 };
|
|
3459
|
+
const s = Lt(e, t, o, n[0].index);
|
|
3460
|
+
return { bottom: Lt(e, t, o, n[n.length - 1].index) + r, top: s };
|
|
3461
|
+
}
|
|
3462
|
+
function Lt(e, t, o, n) {
|
|
3463
|
+
const r = vn(e.width, o.width, t.column), s = yt(n / r), i = s * o.height + rt(0, s - 1) * t.row;
|
|
3464
|
+
return i > 0 ? i + t.row : i;
|
|
3465
|
+
}
|
|
3466
|
+
const Kr = /* @__PURE__ */ J(() => {
|
|
3467
|
+
const e = S((T) => `Item ${T}`), t = S({}), o = S(null), n = S("virtuoso-grid-item"), r = S("virtuoso-grid-list"), s = S(to), i = S("div"), l = S(Qe), a = (T, p = null) => Se(
|
|
3468
|
+
w(
|
|
3469
|
+
t,
|
|
3470
|
+
j((x) => x[T]),
|
|
3471
|
+
se()
|
|
3472
|
+
),
|
|
3473
|
+
p
|
|
3474
|
+
), c = S(!1), m = S(!1);
|
|
3475
|
+
return B(N(m), c), {
|
|
3476
|
+
components: t,
|
|
3477
|
+
computeItemKey: s,
|
|
3478
|
+
context: o,
|
|
3479
|
+
FooterComponent: a("Footer"),
|
|
3480
|
+
HeaderComponent: a("Header"),
|
|
3481
|
+
headerFooterTag: i,
|
|
3482
|
+
itemClassName: n,
|
|
3483
|
+
ItemComponent: a("Item", "div"),
|
|
3484
|
+
itemContent: e,
|
|
3485
|
+
listClassName: r,
|
|
3486
|
+
ListComponent: a("List", "div"),
|
|
3487
|
+
readyStateChanged: c,
|
|
3488
|
+
reportReadyState: m,
|
|
3489
|
+
ScrollerComponent: a("Scroller", "div"),
|
|
3490
|
+
scrollerRef: l,
|
|
3491
|
+
ScrollSeekPlaceholder: a("ScrollSeekPlaceholder", "div")
|
|
3492
|
+
};
|
|
3493
|
+
}), Qr = /* @__PURE__ */ J(
|
|
3494
|
+
([e, t]) => ({ ...e, ...t }),
|
|
3495
|
+
ie(Zr, Kr)
|
|
3496
|
+
), es = /* @__PURE__ */ P.memo(function() {
|
|
3497
|
+
const e = le("gridState"), t = le("listClassName"), o = le("itemClassName"), n = le("itemContent"), r = le("computeItemKey"), s = le("isSeeking"), i = je("scrollHeight"), l = le("ItemComponent"), a = le("ListComponent"), c = le("ScrollSeekPlaceholder"), m = le("context"), T = je("itemDimensions"), p = je("gap"), x = le("log"), b = le("stateRestoreInProgress"), E = je("reportReadyState"), g = Ye(
|
|
3498
|
+
P.useMemo(
|
|
3499
|
+
() => (d) => {
|
|
3500
|
+
const f = d.parentElement.parentElement.scrollHeight;
|
|
3501
|
+
i(f);
|
|
3502
|
+
const I = d.firstChild;
|
|
3503
|
+
if (I) {
|
|
3504
|
+
const { height: O, width: k } = I.getBoundingClientRect();
|
|
3505
|
+
T({ height: O, width: k });
|
|
3506
|
+
}
|
|
3507
|
+
p({
|
|
3508
|
+
column: Ho("column-gap", getComputedStyle(d).columnGap, x),
|
|
3509
|
+
row: Ho("row-gap", getComputedStyle(d).rowGap, x)
|
|
3510
|
+
});
|
|
3511
|
+
},
|
|
3512
|
+
[i, T, p, x]
|
|
3513
|
+
),
|
|
3514
|
+
!0,
|
|
3515
|
+
!1
|
|
3516
|
+
);
|
|
3517
|
+
return mn(() => {
|
|
3518
|
+
e.itemHeight > 0 && e.itemWidth > 0 && E(!0);
|
|
3519
|
+
}, [e]), b ? null : /* @__PURE__ */ C.jsx(
|
|
3520
|
+
a,
|
|
3521
|
+
{
|
|
3522
|
+
className: t,
|
|
3523
|
+
ref: g,
|
|
3524
|
+
...Ie(a, m),
|
|
3525
|
+
"data-testid": "virtuoso-item-list",
|
|
3526
|
+
style: { paddingBottom: e.offsetBottom, paddingTop: e.offsetTop },
|
|
3527
|
+
children: e.items.map((d) => {
|
|
3528
|
+
const f = r(d.index, d.data, m);
|
|
3529
|
+
return s ? /* @__PURE__ */ C.jsx(
|
|
3530
|
+
c,
|
|
3531
|
+
{
|
|
3532
|
+
...Ie(c, m),
|
|
3533
|
+
height: e.itemHeight,
|
|
3534
|
+
index: d.index,
|
|
3535
|
+
width: e.itemWidth
|
|
3536
|
+
},
|
|
3537
|
+
f
|
|
3538
|
+
) : /* @__PURE__ */ wt(
|
|
3539
|
+
l,
|
|
3540
|
+
{
|
|
3541
|
+
...Ie(l, m),
|
|
3542
|
+
className: o,
|
|
3543
|
+
"data-index": d.index,
|
|
3544
|
+
key: f
|
|
3545
|
+
},
|
|
3546
|
+
n(d.index, d.data, m)
|
|
3547
|
+
);
|
|
3548
|
+
})
|
|
3549
|
+
}
|
|
3550
|
+
);
|
|
3551
|
+
}), ts = P.memo(function() {
|
|
3552
|
+
const e = le("HeaderComponent"), t = je("headerHeight"), o = le("headerFooterTag"), n = Ye(
|
|
3553
|
+
P.useMemo(
|
|
3554
|
+
() => (s) => {
|
|
3555
|
+
t(Fe(s, "height"));
|
|
3556
|
+
},
|
|
3557
|
+
[t]
|
|
3558
|
+
),
|
|
3559
|
+
!0,
|
|
3560
|
+
!1
|
|
3561
|
+
), r = le("context");
|
|
3562
|
+
return e ? /* @__PURE__ */ C.jsx(o, { ref: n, children: /* @__PURE__ */ C.jsx(e, { ...Ie(e, r) }) }) : null;
|
|
3563
|
+
}), os = P.memo(function() {
|
|
3564
|
+
const e = le("FooterComponent"), t = je("footerHeight"), o = le("headerFooterTag"), n = Ye(
|
|
3565
|
+
P.useMemo(
|
|
3566
|
+
() => (s) => {
|
|
3567
|
+
t(Fe(s, "height"));
|
|
3568
|
+
},
|
|
3569
|
+
[t]
|
|
3570
|
+
),
|
|
3571
|
+
!0,
|
|
3572
|
+
!1
|
|
3573
|
+
), r = le("context");
|
|
3574
|
+
return e ? /* @__PURE__ */ C.jsx(o, { ref: n, children: /* @__PURE__ */ C.jsx(e, { ...Ie(e, r) }) }) : null;
|
|
3575
|
+
}), ns = ({ children: e }) => {
|
|
3576
|
+
const t = P.useContext(fn), o = je("itemDimensions"), n = je("viewportDimensions"), r = Ye(
|
|
3577
|
+
P.useMemo(
|
|
3578
|
+
() => (s) => {
|
|
3579
|
+
n(s.getBoundingClientRect());
|
|
3580
|
+
},
|
|
3581
|
+
[n]
|
|
3582
|
+
),
|
|
3583
|
+
!0,
|
|
3584
|
+
!1
|
|
3585
|
+
);
|
|
3586
|
+
return P.useEffect(() => {
|
|
3587
|
+
t && (n({ height: t.viewportHeight, width: t.viewportWidth }), o({ height: t.itemHeight, width: t.itemWidth }));
|
|
3588
|
+
}, [t, n, o]), /* @__PURE__ */ C.jsx("div", { ref: r, style: jt(!1), children: e });
|
|
3589
|
+
}, rs = ({ children: e }) => {
|
|
3590
|
+
const t = P.useContext(fn), o = je("windowViewportRect"), n = je("itemDimensions"), r = le("customScrollParent"), s = Vo(o, r, !1);
|
|
3591
|
+
return P.useEffect(() => {
|
|
3592
|
+
t && (n({ height: t.itemHeight, width: t.itemWidth }), o({ offsetTop: 0, visibleHeight: t.viewportHeight, visibleWidth: t.viewportWidth }));
|
|
3593
|
+
}, [t, o, n]), /* @__PURE__ */ C.jsx("div", { ref: s, style: jt(!1), children: e });
|
|
3594
|
+
}, ss = /* @__PURE__ */ P.memo(function({ ...e }) {
|
|
3595
|
+
const t = le("useWindowScroll"), o = le("customScrollParent"), n = o || t ? ls : is, r = o || t ? rs : ns, s = le("context");
|
|
3596
|
+
return /* @__PURE__ */ C.jsx(n, { ...e, ...Ie(n, s), children: /* @__PURE__ */ C.jsxs(r, { children: [
|
|
3597
|
+
/* @__PURE__ */ C.jsx(ts, {}),
|
|
3598
|
+
/* @__PURE__ */ C.jsx(es, {}),
|
|
3599
|
+
/* @__PURE__ */ C.jsx(os, {})
|
|
3600
|
+
] }) });
|
|
3601
|
+
}), {
|
|
3602
|
+
useEmitter: wn,
|
|
3603
|
+
useEmitterValue: le,
|
|
3604
|
+
usePublisher: je
|
|
3605
|
+
} = /* @__PURE__ */ un(
|
|
3606
|
+
Qr,
|
|
3607
|
+
{
|
|
3608
|
+
optional: {
|
|
3609
|
+
context: "context",
|
|
3610
|
+
totalCount: "totalCount",
|
|
3611
|
+
overscan: "overscan",
|
|
3612
|
+
itemContent: "itemContent",
|
|
3613
|
+
components: "components",
|
|
3614
|
+
computeItemKey: "computeItemKey",
|
|
3615
|
+
data: "data",
|
|
3616
|
+
initialItemCount: "initialItemCount",
|
|
3617
|
+
scrollSeekConfiguration: "scrollSeekConfiguration",
|
|
3618
|
+
headerFooterTag: "headerFooterTag",
|
|
3619
|
+
listClassName: "listClassName",
|
|
3620
|
+
itemClassName: "itemClassName",
|
|
3621
|
+
useWindowScroll: "useWindowScroll",
|
|
3622
|
+
customScrollParent: "customScrollParent",
|
|
3623
|
+
scrollerRef: "scrollerRef",
|
|
3624
|
+
logLevel: "logLevel",
|
|
3625
|
+
restoreStateFrom: "restoreStateFrom",
|
|
3626
|
+
initialTopMostItemIndex: "initialTopMostItemIndex",
|
|
3627
|
+
increaseViewportBy: "increaseViewportBy"
|
|
3628
|
+
},
|
|
3629
|
+
methods: {
|
|
3630
|
+
scrollTo: "scrollTo",
|
|
3631
|
+
scrollBy: "scrollBy",
|
|
3632
|
+
scrollToIndex: "scrollToIndex"
|
|
3633
|
+
},
|
|
3634
|
+
events: {
|
|
3635
|
+
isScrolling: "isScrolling",
|
|
3636
|
+
endReached: "endReached",
|
|
3637
|
+
startReached: "startReached",
|
|
3638
|
+
rangeChanged: "rangeChanged",
|
|
3639
|
+
atBottomStateChange: "atBottomStateChange",
|
|
3640
|
+
atTopStateChange: "atTopStateChange",
|
|
3641
|
+
stateChanged: "stateChanged",
|
|
3642
|
+
readyStateChanged: "readyStateChanged"
|
|
3643
|
+
}
|
|
3644
|
+
},
|
|
3645
|
+
ss
|
|
3646
|
+
), is = /* @__PURE__ */ gn({ useEmitter: wn, useEmitterValue: le, usePublisher: je }), ls = /* @__PURE__ */ xn({ useEmitter: wn, useEmitterValue: le, usePublisher: je });
|
|
3647
|
+
function Ho(e, t, o) {
|
|
3648
|
+
return t !== "normal" && !(t != null && t.endsWith("px")) && o(`${e} was not resolved to pixel value correctly`, t, ye.WARN), t === "normal" ? 0 : parseInt(t ?? "0", 10);
|
|
3649
|
+
}
|
|
3650
|
+
const as = () => {
|
|
3651
|
+
const { messages: e, classNames: t, isOpen: o, isLoading: n } = Rt(), r = $t(null), s = () => {
|
|
3652
|
+
const l = r.current;
|
|
3653
|
+
l && l.scrollTo({ top: l.scrollHeight, behavior: "smooth" });
|
|
3654
|
+
}, i = e?.length ?? 1;
|
|
3655
|
+
return Tt(() => {
|
|
3656
|
+
o && setTimeout(s, 0);
|
|
3657
|
+
}, [o]), /* @__PURE__ */ C.jsxs("div", { className: ot("autoui-chat-messages", t?.messageList), children: [
|
|
3658
|
+
/* @__PURE__ */ C.jsx(
|
|
3659
|
+
Gr,
|
|
3660
|
+
{
|
|
3661
|
+
data: e,
|
|
3662
|
+
overscan: 100,
|
|
3663
|
+
followOutput: "smooth",
|
|
3664
|
+
initialTopMostItemIndex: i - 1,
|
|
3665
|
+
itemContent: (l, a) => /* @__PURE__ */ C.jsx(_n, { message: a }, a.id)
|
|
3666
|
+
}
|
|
3667
|
+
),
|
|
3668
|
+
n && /* @__PURE__ */ C.jsx(On, { variant: "dots" })
|
|
3669
|
+
] });
|
|
3670
|
+
};
|
|
3671
|
+
function cs(e, t) {
|
|
3672
|
+
const o = Object.entries(t.functions).map(([i, l]) => {
|
|
3673
|
+
const a = l.params ? Object.entries(l.params).map(([c, m]) => `- ${c}: ${m}`).join(`
|
|
3674
|
+
`) : "(no documented params)";
|
|
3675
|
+
return `FUNCTION ${i}:
|
|
3676
|
+
Description: ${l.prompt}
|
|
3677
|
+
Params:
|
|
3678
|
+
${a}`;
|
|
3679
|
+
}), n = Object.entries(t.components).map(([i, l]) => {
|
|
3680
|
+
const a = l.props ? Object.entries(l.props).map(([c, m]) => `- ${c}: ${m}`).join(`
|
|
3681
|
+
`) : "(no documented props)";
|
|
3682
|
+
return `COMPONENT ${i}:
|
|
3683
|
+
Description: ${l.prompt}
|
|
3684
|
+
Props:
|
|
3685
|
+
${a}`;
|
|
3686
|
+
});
|
|
3687
|
+
return [
|
|
3688
|
+
`You are AutoUI Intent Planner.
|
|
3689
|
+
Return ONLY a valid JSON InstructionPlan and nothing else.
|
|
3690
|
+
Do not wrap in markdown fences. Do not include any fields outside the schema.
|
|
3691
|
+
|
|
3692
|
+
SCHEMA (must match exactly):
|
|
3693
|
+
{
|
|
3694
|
+
"type": "sequence",
|
|
3695
|
+
"steps": [
|
|
3696
|
+
{ "type": "function", "name": "<function name>", "params": { /* optional */ }, "assign": "<ctxKey>" },
|
|
3697
|
+
{ "type": "component", "name": "<component name>", "props": { /* optional, may reference {{ctxKey}} */ } }
|
|
3698
|
+
{ "type": "text", "text": "<actual generated text>"} }
|
|
3699
|
+
]
|
|
3700
|
+
}
|
|
3701
|
+
|
|
3702
|
+
RULES:
|
|
3703
|
+
- "type" must be exactly "sequence".
|
|
3704
|
+
- "steps" must be a non-empty array.
|
|
3705
|
+
- Use ONLY declared function/component names from the lists below.
|
|
3706
|
+
- If a component needs data, call a function first and save it under an "assign" key, then reference it in props via "{{assignKey}}".
|
|
3707
|
+
- Do not add "intent", "explanations", or any keys not in the schema.
|
|
3708
|
+
- Output a single JSON object (no arrays or strings at top-level).
|
|
3709
|
+
|
|
3710
|
+
${t.llm.appDescriptionPrompt && `Here is the description of the current app using AUTOUI library made by developer so that you would know the context of what your answers must be about. If userMessages are not related to that description below then inform user that you can only answer questions related to this current website: ${t.llm.appDescriptionPrompt} ${t.metadata?.appName}`}
|
|
3711
|
+
`,
|
|
3712
|
+
"",
|
|
3713
|
+
"Available functions:",
|
|
3714
|
+
o.join(`
|
|
3715
|
+
|
|
3716
|
+
`),
|
|
3717
|
+
"",
|
|
3718
|
+
"Available components:",
|
|
3719
|
+
n.join(`
|
|
3720
|
+
|
|
3721
|
+
`),
|
|
3722
|
+
"",
|
|
3723
|
+
`VALID EXAMPLE:
|
|
3724
|
+
{
|
|
3725
|
+
"type": "sequence",
|
|
3726
|
+
"steps": [
|
|
3727
|
+
{ "type": "function", "name": "fetchProducts", "params": { "color": "red" }, "assign": "items" },
|
|
3728
|
+
{ "type": "component", "name": "ProductList", "props": { "products": "{{items}}", "onAddToCart": "addToCart" } }
|
|
3729
|
+
{ "type": "text", "text": "Here is the product list we found for you" }
|
|
3730
|
+
]
|
|
3731
|
+
}`,
|
|
3732
|
+
"",
|
|
3733
|
+
`USER MESSAGE: "${e}"`,
|
|
3734
|
+
"",
|
|
3735
|
+
"Respond with ONLY the plan JSON (no code fences, no commentary)."
|
|
3736
|
+
].join(`
|
|
3737
|
+
`);
|
|
3738
|
+
}
|
|
3739
|
+
const us = {}, ds = async (e, t) => (await (await fetch(
|
|
3740
|
+
t.llm.baseUrl ? t.llm.baseUrl : "https://openrouter.ai/api/v1/chat/completions",
|
|
3741
|
+
{
|
|
3742
|
+
method: "POST",
|
|
3743
|
+
headers: {
|
|
3744
|
+
Authorization: t.llm.apiKey ? `Bearer ${t.llm.apiKey}` : "",
|
|
3745
|
+
"HTTP-Referer": t.metadata?.appName || "autoui library user",
|
|
3746
|
+
"X-Title": us?.VITE_OPENROUTER_SITE_TITLE ?? "AutoUI Demo",
|
|
3747
|
+
"Content-Type": "application/json"
|
|
3748
|
+
},
|
|
3749
|
+
body: JSON.stringify({
|
|
3750
|
+
model: t.llm.model ? t.llm.model : "openai/gpt-5-chat",
|
|
3751
|
+
messages: [
|
|
3752
|
+
{
|
|
3753
|
+
role: "user",
|
|
3754
|
+
content: [
|
|
3755
|
+
{
|
|
3756
|
+
type: "text",
|
|
3757
|
+
text: cs(e, t)
|
|
3758
|
+
}
|
|
3759
|
+
]
|
|
3760
|
+
}
|
|
3761
|
+
]
|
|
3762
|
+
})
|
|
3763
|
+
}
|
|
3764
|
+
)).json()).choices?.[0]?.message?.content;
|
|
3765
|
+
function fs(e) {
|
|
3766
|
+
return { processMessage: Ne(
|
|
3767
|
+
async (o) => {
|
|
3768
|
+
let n = await ds(o, e);
|
|
3769
|
+
if (typeof n == "string")
|
|
3770
|
+
try {
|
|
3771
|
+
n = JSON.parse(n);
|
|
3772
|
+
} catch {
|
|
3773
|
+
throw console.error("❌ Failed to parse plan JSON:", n), new Error("Invalid plan format: could not parse JSON");
|
|
3774
|
+
}
|
|
3775
|
+
if (!n || typeof n != "object" || !n.type || !n.steps)
|
|
3776
|
+
throw console.error("❌ Invalid plan structure:", n), new Error("Plan must be an object with 'type' and 'steps'.");
|
|
3777
|
+
return n;
|
|
3778
|
+
},
|
|
3779
|
+
[e]
|
|
3780
|
+
) };
|
|
3781
|
+
}
|
|
3782
|
+
function Vt(e, t, o) {
|
|
3783
|
+
if (e == null) return e;
|
|
3784
|
+
if (typeof e == "string") {
|
|
3785
|
+
if (e.startsWith("{{") && e.endsWith("}}")) {
|
|
3786
|
+
const n = e.slice(2, -2).trim();
|
|
3787
|
+
return t[n];
|
|
3788
|
+
}
|
|
3789
|
+
return e;
|
|
3790
|
+
}
|
|
3791
|
+
if (Array.isArray(e))
|
|
3792
|
+
return e.map((n) => Vt(n, t, o));
|
|
3793
|
+
if (typeof e == "object") {
|
|
3794
|
+
const n = {};
|
|
3795
|
+
for (const [r, s] of Object.entries(e))
|
|
3796
|
+
if (typeof s == "string" && /^on[A-Z]/.test(r) && o.functions[s]) {
|
|
3797
|
+
const i = s;
|
|
3798
|
+
n[r] = async (...l) => await o.functions[i].callFunc({ args: l });
|
|
3799
|
+
} else
|
|
3800
|
+
n[r] = Vt(s, t, o);
|
|
3801
|
+
return n;
|
|
3802
|
+
}
|
|
3803
|
+
return e;
|
|
3804
|
+
}
|
|
3805
|
+
async function ms(e, t, o, n, r) {
|
|
3806
|
+
const s = {};
|
|
3807
|
+
for (const i of e.steps)
|
|
3808
|
+
await hs(i, s, t, o, n, r);
|
|
3809
|
+
return s;
|
|
3810
|
+
}
|
|
3811
|
+
async function hs(e, t, o, n, r, s) {
|
|
3812
|
+
const i = (a) => !!a && typeof a == "object" && !Array.isArray(a);
|
|
3813
|
+
if (e.type === "function") {
|
|
3814
|
+
const a = o.functions[e.name];
|
|
3815
|
+
if (!a) throw new Error(`Unknown function: ${e.name}`);
|
|
3816
|
+
const c = a.callFunc, m = e, T = Array.isArray(m.args), p = !!m.params && typeof m.params == "object";
|
|
3817
|
+
let x;
|
|
3818
|
+
if (T) {
|
|
3819
|
+
let b = m.args;
|
|
3820
|
+
if (b.length === 1 && i(b[0]) && Array.isArray(a.params) && a.params.length > 0) {
|
|
3821
|
+
const E = b[0];
|
|
3822
|
+
b = a.params.map((g) => E[g]);
|
|
3823
|
+
}
|
|
3824
|
+
try {
|
|
3825
|
+
x = await c(...b);
|
|
3826
|
+
} catch {
|
|
3827
|
+
x = await c(b);
|
|
3828
|
+
}
|
|
3829
|
+
} else p ? x = await c(m.params) : x = await c();
|
|
3830
|
+
e.assign && (t[e.assign] = x);
|
|
3831
|
+
return;
|
|
3832
|
+
}
|
|
3833
|
+
if (e.type === "component") {
|
|
3834
|
+
console.log(
|
|
3835
|
+
"component step already includes the context of the instructionPlan, so here it is:",
|
|
3836
|
+
JSON.stringify(t)
|
|
3837
|
+
);
|
|
3838
|
+
const a = Vt(e.props ?? {}, t, o), c = n(e.name, a);
|
|
3839
|
+
r(c), s((m) => a?.children ? [
|
|
3840
|
+
...m,
|
|
3841
|
+
{ id: `${Date.now()}-a`, role: "assistant", kind: "ui", ui: { t: "fragment", children: a.children } }
|
|
3842
|
+
] : [
|
|
3843
|
+
...m,
|
|
3844
|
+
{
|
|
3845
|
+
id: `${Date.now()}-a`,
|
|
3846
|
+
role: "assistant",
|
|
3847
|
+
kind: "ui",
|
|
3848
|
+
ui: { t: "component", name: e.name, props: a }
|
|
3849
|
+
}
|
|
3850
|
+
]);
|
|
3851
|
+
return;
|
|
3852
|
+
}
|
|
3853
|
+
if (e.type === "text") {
|
|
3854
|
+
const a = e;
|
|
3855
|
+
s((c) => [...c, { id: `${Date.now()}-a`, role: "assistant", kind: "text", text: a.text }]), r(a.text ?? "");
|
|
3856
|
+
return;
|
|
3857
|
+
}
|
|
3858
|
+
return e;
|
|
3859
|
+
}
|
|
3860
|
+
function ps(e) {
|
|
3861
|
+
if (typeof e != "object" || e === null)
|
|
3862
|
+
throw new Error("Plan must be an object.");
|
|
3863
|
+
if (e.type !== "sequence")
|
|
3864
|
+
throw new Error('Plan.type must be "sequence".');
|
|
3865
|
+
if (!Array.isArray(e.steps))
|
|
3866
|
+
throw new Error("Plan.steps must be an array.");
|
|
3867
|
+
const t = /* @__PURE__ */ new Set(["function", "component", "text"]);
|
|
3868
|
+
e.steps.forEach((o, n) => {
|
|
3869
|
+
if (typeof o != "object" || o === null)
|
|
3870
|
+
throw new Error(`Step[${n}] must be an object.`);
|
|
3871
|
+
if (!t.has(o.type))
|
|
3872
|
+
throw new Error(`Step[${n}].type must be one of "function" | "component" | "text".`);
|
|
3873
|
+
if (o.type === "function") {
|
|
3874
|
+
if (typeof o.name != "string" || !o.name)
|
|
3875
|
+
throw new Error(`Step[${n}].name (function) must be a non-empty string.`);
|
|
3876
|
+
if (o.params !== void 0 && typeof o.params != "object")
|
|
3877
|
+
throw new Error(`Step[${n}].params (function) must be an object if provided.`);
|
|
3878
|
+
if (o.assign !== void 0 && typeof o.assign != "string")
|
|
3879
|
+
throw new Error(`Step[${n}].assign (function) must be a string if provided.`);
|
|
3880
|
+
}
|
|
3881
|
+
if (o.type === "component") {
|
|
3882
|
+
if (typeof o.name != "string" || !o.name)
|
|
3883
|
+
throw new Error(`Step[${n}].name (component) must be a non-empty string.`);
|
|
3884
|
+
if (o.props !== void 0 && typeof o.props != "object")
|
|
3885
|
+
throw new Error(`Step[${n}].props (component) must be an object if provided.`);
|
|
3886
|
+
}
|
|
3887
|
+
if (o.type === "text" && typeof o.text != "string")
|
|
3888
|
+
throw new Error(`Step[${n}].text (text) must be a string.`);
|
|
3889
|
+
});
|
|
3890
|
+
}
|
|
3891
|
+
async function gs(e, t, o, n, r, s) {
|
|
3892
|
+
return ps(e), await ms(e, t, o, n, r);
|
|
3893
|
+
}
|
|
3894
|
+
const xs = (e, t, o) => {
|
|
3895
|
+
let n = [];
|
|
3896
|
+
for (let r of e) {
|
|
3897
|
+
if (r.kind == "ui") {
|
|
3898
|
+
const { t: s } = r.ui;
|
|
3899
|
+
let i = s == "component" ? t(r.ui.name, r.ui.props) : "unsuccessful rerender";
|
|
3900
|
+
i && o(i), n.push({ id: r.id, role: r.role, content: i });
|
|
3901
|
+
}
|
|
3902
|
+
r.kind == "text" && (o(r.text), n.push({ id: r.id, role: r.role, content: r.text }));
|
|
3903
|
+
}
|
|
3904
|
+
return n;
|
|
3905
|
+
};
|
|
3906
|
+
function Tn(e) {
|
|
3907
|
+
const t = $t(null), o = Ne((s) => {
|
|
3908
|
+
t.current = s;
|
|
3909
|
+
}, []), n = Ne(
|
|
3910
|
+
(s, i) => {
|
|
3911
|
+
const l = e?.components?.[s];
|
|
3912
|
+
if (!l?.callComponent) throw new Error(`Unknown component: ${s}`);
|
|
3913
|
+
const a = l.callComponent;
|
|
3914
|
+
return /* @__PURE__ */ C.jsx(a, { ...i });
|
|
3915
|
+
},
|
|
3916
|
+
[e?.components]
|
|
3917
|
+
), r = Ne((s) => {
|
|
3918
|
+
console.log("setUI called with:", s), t.current?.(s);
|
|
3919
|
+
}, []);
|
|
3920
|
+
return { setUIRenderer: o, resolveComponent: n, setUI: r };
|
|
3921
|
+
}
|
|
3922
|
+
function vs(e, t) {
|
|
3923
|
+
const { resolveComponent: o, setUI: n } = Tn(t), [r, s] = Ct(() => {
|
|
3924
|
+
try {
|
|
3925
|
+
const a = localStorage.getItem(e);
|
|
3926
|
+
return a ? JSON.parse(a) : [];
|
|
3927
|
+
} catch {
|
|
3928
|
+
return [];
|
|
3929
|
+
}
|
|
3930
|
+
}), i = $t(!1);
|
|
3931
|
+
Tt(() => {
|
|
3932
|
+
i.current = !0;
|
|
3933
|
+
}, []), Tt(() => {
|
|
3934
|
+
try {
|
|
3935
|
+
const a = localStorage.getItem(e);
|
|
3936
|
+
s(a ? JSON.parse(a) : []);
|
|
3937
|
+
} catch {
|
|
3938
|
+
s([]);
|
|
3939
|
+
}
|
|
3940
|
+
}, [e]);
|
|
3941
|
+
const l = Po(
|
|
3942
|
+
() => xs(r, o, n),
|
|
3943
|
+
[r, o, n]
|
|
3944
|
+
);
|
|
3945
|
+
return Tt(() => {
|
|
3946
|
+
if (!i.current) return;
|
|
3947
|
+
const a = setTimeout(() => {
|
|
3948
|
+
localStorage.setItem(e, JSON.stringify(r));
|
|
3949
|
+
}, 50);
|
|
3950
|
+
return () => clearTimeout(a);
|
|
3951
|
+
}, [r, e]), { messages: l, serializedMessages: r, setSerializedMessages: s };
|
|
3952
|
+
}
|
|
3953
|
+
function ws({
|
|
3954
|
+
config: e,
|
|
3955
|
+
onError: t,
|
|
3956
|
+
onClose: o,
|
|
3957
|
+
storageKey: n = "autoui_chat_history",
|
|
3958
|
+
title: r,
|
|
3959
|
+
classNames: s,
|
|
3960
|
+
isOpen: i
|
|
3961
|
+
}) {
|
|
3962
|
+
const { messages: l, setSerializedMessages: a } = vs(n, e), { processMessage: c } = fs(e), { resolveComponent: m, setUI: T } = Tn(e), [p, x] = Ct(!1), b = Ne(
|
|
3963
|
+
async (I) => {
|
|
3964
|
+
if (!I.trim()) return;
|
|
3965
|
+
const k = {
|
|
3966
|
+
id: Date.now().toString(),
|
|
3967
|
+
role: "user",
|
|
3968
|
+
kind: "text",
|
|
3969
|
+
text: I,
|
|
3970
|
+
ts: Date.now()
|
|
3971
|
+
};
|
|
3972
|
+
a((H) => [...H, k]);
|
|
3973
|
+
try {
|
|
3974
|
+
x(!0);
|
|
3975
|
+
const H = await c(I);
|
|
3976
|
+
await gs(H, e, m, T, a, { validate: !0 });
|
|
3977
|
+
} catch (H) {
|
|
3978
|
+
a((u) => [
|
|
3979
|
+
...u,
|
|
3980
|
+
{
|
|
3981
|
+
id: `${Date.now()}-e`,
|
|
3982
|
+
role: "assistant",
|
|
3983
|
+
kind: "text",
|
|
3984
|
+
text: "⚠️ Something went wrong.",
|
|
3985
|
+
ts: Date.now()
|
|
3986
|
+
}
|
|
3987
|
+
]), t?.(H);
|
|
3988
|
+
} finally {
|
|
3989
|
+
x(!1);
|
|
3990
|
+
}
|
|
3991
|
+
},
|
|
3992
|
+
[c, e, m, T, a, t]
|
|
3993
|
+
), E = Ne(() => {
|
|
3994
|
+
a([]), localStorage.removeItem(n);
|
|
3995
|
+
}, [a, n]), g = Ne(
|
|
3996
|
+
() => ({
|
|
3997
|
+
onSend: b,
|
|
3998
|
+
disabled: p
|
|
3999
|
+
}),
|
|
4000
|
+
[b, p]
|
|
4001
|
+
), d = Ne(
|
|
4002
|
+
() => ({
|
|
4003
|
+
title: "AutoUI Chat",
|
|
4004
|
+
onClose: o
|
|
4005
|
+
}),
|
|
4006
|
+
[o]
|
|
4007
|
+
), f = Ne(
|
|
4008
|
+
() => ({
|
|
4009
|
+
messages: l
|
|
4010
|
+
}),
|
|
4011
|
+
[l]
|
|
4012
|
+
);
|
|
4013
|
+
return {
|
|
4014
|
+
config: e,
|
|
4015
|
+
isOpen: i,
|
|
4016
|
+
title: r,
|
|
4017
|
+
classNames: s,
|
|
4018
|
+
messages: l,
|
|
4019
|
+
isLoading: p,
|
|
4020
|
+
handleSend: b,
|
|
4021
|
+
onClose: o,
|
|
4022
|
+
handleClear: E,
|
|
4023
|
+
getChatInputProps: g,
|
|
4024
|
+
getChatHeaderProps: d,
|
|
4025
|
+
getMessageListProps: f
|
|
4026
|
+
};
|
|
4027
|
+
}
|
|
4028
|
+
const Ts = () => {
|
|
4029
|
+
const { title: e, classNames: t, onClose: o, closeIcon: n } = Rt();
|
|
4030
|
+
return /* @__PURE__ */ C.jsxs("header", { role: "header", className: xe("autoui-chat-header", t?.header), children: [
|
|
4031
|
+
/* @__PURE__ */ C.jsx("h2", { role: "title", className: xe("autoui-chat-title", t?.title), children: e }),
|
|
4032
|
+
o && /* @__PURE__ */ C.jsx("button", { role: "closeButton", className: xe("autoui-chat-closebtn", t?.closeButton), onClick: o, children: n ?? /* @__PURE__ */ C.jsx("img", { src: Wo, alt: "Open char", width: 24, height: 24 }) })
|
|
4033
|
+
] });
|
|
4034
|
+
}, Is = _o(
|
|
4035
|
+
({ config: e, title: t = "AutoUI Chat", isOpen: o = !0, classNames: n, onClose: r, onError: s, closeIcon: i }) => {
|
|
4036
|
+
const l = ws({ config: e, title: t, isOpen: o, classNames: n, onClose: r, onError: s });
|
|
4037
|
+
return o ? /* @__PURE__ */ C.jsx(Hn, { config: e, value: l, children: /* @__PURE__ */ C.jsxs("section", { role: "base", className: xe("autoui-chat", n?.base), "aria-label": "Chat", children: [
|
|
4038
|
+
/* @__PURE__ */ C.jsx(Ts, {}),
|
|
4039
|
+
/* @__PURE__ */ C.jsx(as, {}),
|
|
4040
|
+
/* @__PURE__ */ C.jsx(An, {})
|
|
4041
|
+
] }) }) : null;
|
|
4042
|
+
}
|
|
4043
|
+
), Ss = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4044
|
+
__proto__: null,
|
|
4045
|
+
Chat: Is
|
|
4046
|
+
}, Symbol.toStringTag, { value: "Module" })), In = Bo(void 0), bs = ({ config: e, children: t }) => {
|
|
4047
|
+
const [o, n] = Ct({ isOpen: !1 });
|
|
4048
|
+
return /* @__PURE__ */ C.jsx(In.Provider, { value: { value: o, setValue: n, config: e }, children: t });
|
|
4049
|
+
}, ys = () => {
|
|
4050
|
+
const e = Ao(In);
|
|
4051
|
+
if (!e)
|
|
4052
|
+
throw new Error("useModalChatContext must be used within a ModalChatProvider");
|
|
4053
|
+
return e;
|
|
4054
|
+
}, Cs = ({ onOpenChange: e, isOpen: t, className: o }) => {
|
|
4055
|
+
const n = t ?? !0, r = n ? Wo : Pn;
|
|
4056
|
+
return /* @__PURE__ */ C.jsx("button", { onClick: e, className: ot("autoui-chat-open-btn", o), children: /* @__PURE__ */ C.jsx("img", { src: r, alt: n ? "Close chat" : "Open chat", width: 24, height: 24 }) });
|
|
4057
|
+
}, Rs = Cn(
|
|
4058
|
+
() => Promise.resolve().then(() => Ss).then((e) => ({
|
|
4059
|
+
default: e.Chat
|
|
4060
|
+
}))
|
|
4061
|
+
), js = _o(({ config: e, portalContainer: t }) => /* @__PURE__ */ C.jsx(bs, { config: e, children: /* @__PURE__ */ C.jsx(Es, { config: e, portalContainer: t }) })), Es = ({ config: e, portalContainer: t }) => {
|
|
4062
|
+
const { value: o, setValue: n } = ys(), { isOpen: r } = o, s = () => n((a) => ({ ...a, isOpen: !1 })), i = () => n((a) => ({ ...a, isOpen: !a.isOpen })), l = t ?? document.body;
|
|
4063
|
+
return /* @__PURE__ */ C.jsxs(C.Fragment, { children: [
|
|
4064
|
+
/* @__PURE__ */ C.jsx(Cs, { onOpenChange: i, isOpen: r }),
|
|
4065
|
+
r && En(
|
|
4066
|
+
/* @__PURE__ */ C.jsx("div", { className: "autoui-chat-portal", children: /* @__PURE__ */ C.jsx("div", { className: "autoui-chat-wrapper", children: /* @__PURE__ */ C.jsx(Rs, { config: e, ...o, onClose: s }) }) }),
|
|
4067
|
+
l
|
|
4068
|
+
)
|
|
4069
|
+
] });
|
|
4070
|
+
};
|
|
4071
|
+
export {
|
|
4072
|
+
Is as Chat,
|
|
4073
|
+
js as ModalChat
|
|
4074
|
+
};
|