@box/box-ai-agent-selector 0.34.6 → 0.35.0
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.
@@ -1,160 +1,4750 @@
|
|
1
|
-
import
|
2
|
-
import {
|
3
|
-
import
|
4
|
-
import {
|
5
|
-
import {
|
6
|
-
import {
|
7
|
-
import
|
8
|
-
import {
|
9
|
-
import {
|
10
|
-
import
|
11
|
-
import {
|
12
|
-
import {
|
13
|
-
import
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
1
|
+
import * as ce from "react";
|
2
|
+
import qr, { isValidElement as Gr, useLayoutEffect as ci, useEffect as W, useRef as Y, useCallback as xe, useState as X, useMemo as He, useReducer as li, createContext as ge, useContext as et } from "react";
|
3
|
+
import { jsx as M, jsxs as Fe, Fragment as mt } from "react/jsx-runtime";
|
4
|
+
import { flushSync as Yr, createPortal as fr } from "react-dom";
|
5
|
+
import { useFullTextTooltip as fi, FilterChip as Nt, Tooltip as di, Status as pi, LoadingIndicator as mi, Button as vi } from "@box/blueprint-web";
|
6
|
+
import { AlertBadge as gi } from "@box/blueprint-web-assets/icons/Fill";
|
7
|
+
import Mt from "clsx";
|
8
|
+
import { useIntl as hi } from "react-intl";
|
9
|
+
import { BoxAiAgent as bi } from "./box-ai-agent.js";
|
10
|
+
import { LOGGER_BASE_CONFIG as an, LOGGER_ACTION_CLICK as cn, LOGGER_TARGET as ln } from "./constants.js";
|
11
|
+
import { ACTIONS as yi } from "./contexts/actions.js";
|
12
|
+
import { useAgentsDispatch as Si } from "./contexts/context.js";
|
13
|
+
import Qe from "./messages.js";
|
14
|
+
import { R as fn } from "../../chunks/types.js";
|
15
|
+
import '../../styles/box-ai-agent-selector.css';var wi = Object.defineProperty, Ei = Object.defineProperties, xi = Object.getOwnPropertyDescriptors, Wt = Object.getOwnPropertySymbols, Xr = Object.prototype.hasOwnProperty, Jr = Object.prototype.propertyIsEnumerable, dr = (e, t, r) => t in e ? wi(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, O = (e, t) => {
|
16
|
+
for (var r in t || (t = {}))
|
17
|
+
Xr.call(t, r) && dr(e, r, t[r]);
|
18
|
+
if (Wt)
|
19
|
+
for (var r of Wt(t))
|
20
|
+
Jr.call(t, r) && dr(e, r, t[r]);
|
21
|
+
return e;
|
22
|
+
}, $ = (e, t) => Ei(e, xi(t)), J = (e, t) => {
|
23
|
+
var r = {};
|
24
|
+
for (var n in e)
|
25
|
+
Xr.call(e, n) && t.indexOf(n) < 0 && (r[n] = e[n]);
|
26
|
+
if (e != null && Wt)
|
27
|
+
for (var n of Wt(e))
|
28
|
+
t.indexOf(n) < 0 && Jr.call(e, n) && (r[n] = e[n]);
|
29
|
+
return r;
|
30
|
+
}, Pi = Object.defineProperty, Ii = Object.defineProperties, Ci = Object.getOwnPropertyDescriptors, zt = Object.getOwnPropertySymbols, Qr = Object.prototype.hasOwnProperty, Zr = Object.prototype.propertyIsEnumerable, pr = (e, t, r) => t in e ? Pi(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, te = (e, t) => {
|
31
|
+
for (var r in t || (t = {}))
|
32
|
+
Qr.call(t, r) && pr(e, r, t[r]);
|
33
|
+
if (zt)
|
34
|
+
for (var r of zt(t))
|
35
|
+
Zr.call(t, r) && pr(e, r, t[r]);
|
36
|
+
return e;
|
37
|
+
}, ve = (e, t) => Ii(e, Ci(t)), eo = (e, t) => {
|
38
|
+
var r = {};
|
39
|
+
for (var n in e)
|
40
|
+
Qr.call(e, n) && t.indexOf(n) < 0 && (r[n] = e[n]);
|
41
|
+
if (e != null && zt)
|
42
|
+
for (var n of zt(e))
|
43
|
+
t.indexOf(n) < 0 && Zr.call(e, n) && (r[n] = e[n]);
|
44
|
+
return r;
|
25
45
|
};
|
26
|
-
function
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
46
|
+
function Kt(...e) {
|
47
|
+
}
|
48
|
+
function Oi(e, t) {
|
49
|
+
if (_i(e)) {
|
50
|
+
const r = Di(t) ? t() : t;
|
51
|
+
return e(r);
|
52
|
+
}
|
53
|
+
return e;
|
54
|
+
}
|
55
|
+
function _i(e) {
|
56
|
+
return typeof e == "function";
|
57
|
+
}
|
58
|
+
function Di(e) {
|
59
|
+
return typeof e == "function";
|
60
|
+
}
|
61
|
+
function Ne(e, t) {
|
62
|
+
return typeof Object.hasOwn == "function" ? Object.hasOwn(e, t) : Object.prototype.hasOwnProperty.call(e, t);
|
63
|
+
}
|
64
|
+
function Te(...e) {
|
65
|
+
return (...t) => {
|
66
|
+
for (const r of e)
|
67
|
+
typeof r == "function" && r(...t);
|
68
|
+
};
|
69
|
+
}
|
70
|
+
function Ai(e) {
|
71
|
+
return e.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
|
72
|
+
}
|
73
|
+
function Ti(e, t) {
|
74
|
+
const r = te({}, e);
|
75
|
+
for (const n of t)
|
76
|
+
Ne(r, n) && delete r[n];
|
77
|
+
return r;
|
78
|
+
}
|
79
|
+
function Li(e, t) {
|
80
|
+
const r = {};
|
81
|
+
for (const n of t)
|
82
|
+
Ne(e, n) && (r[n] = e[n]);
|
83
|
+
return r;
|
84
|
+
}
|
85
|
+
function to(e) {
|
86
|
+
return e;
|
87
|
+
}
|
88
|
+
function he(e, t) {
|
89
|
+
if (!e)
|
90
|
+
throw typeof t != "string" ? new Error("Invariant failed") : new Error(t);
|
91
|
+
}
|
92
|
+
function Ri(e) {
|
93
|
+
return Object.keys(e);
|
94
|
+
}
|
95
|
+
function Xt(e) {
|
96
|
+
return e.disabled || e["aria-disabled"] === !0 || e["aria-disabled"] === "true";
|
97
|
+
}
|
98
|
+
function rt(e) {
|
99
|
+
const t = {};
|
100
|
+
for (const r in e)
|
101
|
+
e[r] !== void 0 && (t[r] = e[r]);
|
102
|
+
return t;
|
103
|
+
}
|
104
|
+
function U(...e) {
|
105
|
+
for (const t of e)
|
106
|
+
if (t !== void 0) return t;
|
107
|
+
}
|
108
|
+
function wn(e, t) {
|
109
|
+
typeof e == "function" ? e(t) : e && (e.current = t);
|
110
|
+
}
|
111
|
+
function Fi(e) {
|
112
|
+
return !e || !Gr(e) ? !1 : "ref" in e.props || "ref" in e;
|
113
|
+
}
|
114
|
+
function Ni(e) {
|
115
|
+
return Fi(e) ? O({}, e.props).ref || e.ref : null;
|
116
|
+
}
|
117
|
+
function Mi(e, t) {
|
118
|
+
const r = O({}, e);
|
119
|
+
for (const n in t) {
|
120
|
+
if (!Ne(t, n)) continue;
|
121
|
+
if (n === "className") {
|
122
|
+
const i = "className";
|
123
|
+
r[i] = e[i] ? `${e[i]} ${t[i]}` : t[i];
|
124
|
+
continue;
|
125
|
+
}
|
126
|
+
if (n === "style") {
|
127
|
+
const i = "style";
|
128
|
+
r[i] = e[i] ? O(O({}, e[i]), t[i]) : t[i];
|
129
|
+
continue;
|
130
|
+
}
|
131
|
+
const o = t[n];
|
132
|
+
if (typeof o == "function" && n.startsWith("on")) {
|
133
|
+
const i = e[n];
|
134
|
+
if (typeof i == "function") {
|
135
|
+
r[n] = (...s) => {
|
136
|
+
o(...s), i(...s);
|
137
|
+
};
|
138
|
+
continue;
|
139
|
+
}
|
140
|
+
}
|
141
|
+
r[n] = o;
|
142
|
+
}
|
143
|
+
return r;
|
144
|
+
}
|
145
|
+
var yt = ki();
|
146
|
+
function ki() {
|
147
|
+
var e;
|
148
|
+
return typeof window < "u" && !!((e = window.document) != null && e.createElement);
|
149
|
+
}
|
150
|
+
function ne(e) {
|
151
|
+
return e ? "self" in e ? e.document : e.ownerDocument || document : document;
|
152
|
+
}
|
153
|
+
function no(e) {
|
154
|
+
return e ? "self" in e ? e.self : ne(e).defaultView || window : self;
|
155
|
+
}
|
156
|
+
function We(e, t = !1) {
|
157
|
+
const { activeElement: r } = ne(e);
|
158
|
+
if (!(r != null && r.nodeName))
|
159
|
+
return null;
|
160
|
+
if (Fn(r) && r.contentDocument)
|
161
|
+
return We(
|
162
|
+
r.contentDocument.body,
|
163
|
+
t
|
164
|
+
);
|
165
|
+
if (t) {
|
166
|
+
const n = r.getAttribute("aria-activedescendant");
|
167
|
+
if (n) {
|
168
|
+
const o = ne(r).getElementById(n);
|
169
|
+
if (o)
|
170
|
+
return o;
|
171
|
+
}
|
172
|
+
}
|
173
|
+
return r;
|
174
|
+
}
|
175
|
+
function se(e, t) {
|
176
|
+
return e === t || e.contains(t);
|
177
|
+
}
|
178
|
+
function Fn(e) {
|
179
|
+
return e.tagName === "IFRAME";
|
180
|
+
}
|
181
|
+
function Xe(e) {
|
182
|
+
const t = e.tagName.toLowerCase();
|
183
|
+
return t === "button" ? !0 : t === "input" && e.type ? Vi.indexOf(e.type) !== -1 : !1;
|
184
|
+
}
|
185
|
+
var Vi = [
|
186
|
+
"button",
|
187
|
+
"color",
|
188
|
+
"file",
|
189
|
+
"image",
|
190
|
+
"reset",
|
191
|
+
"submit"
|
192
|
+
];
|
193
|
+
function ro(e) {
|
194
|
+
if (typeof e.checkVisibility == "function")
|
195
|
+
return e.checkVisibility();
|
196
|
+
const t = e;
|
197
|
+
return t.offsetWidth > 0 || t.offsetHeight > 0 || e.getClientRects().length > 0;
|
198
|
+
}
|
199
|
+
function ze(e) {
|
200
|
+
try {
|
201
|
+
const t = e instanceof HTMLInputElement && e.selectionStart !== null, r = e.tagName === "TEXTAREA";
|
202
|
+
return t || r || !1;
|
203
|
+
} catch {
|
204
|
+
return !1;
|
205
|
+
}
|
206
|
+
}
|
207
|
+
function En(e) {
|
208
|
+
return e.isContentEditable || ze(e);
|
209
|
+
}
|
210
|
+
function $i(e) {
|
211
|
+
if (ze(e))
|
212
|
+
return e.value;
|
213
|
+
if (e.isContentEditable) {
|
214
|
+
const t = ne(e).createRange();
|
215
|
+
return t.selectNodeContents(e), t.toString();
|
216
|
+
}
|
217
|
+
return "";
|
218
|
+
}
|
219
|
+
function Bi(e) {
|
220
|
+
let t = 0, r = 0;
|
221
|
+
if (ze(e))
|
222
|
+
t = e.selectionStart || 0, r = e.selectionEnd || 0;
|
223
|
+
else if (e.isContentEditable) {
|
224
|
+
const n = ne(e).getSelection();
|
225
|
+
if (n != null && n.rangeCount && n.anchorNode && se(e, n.anchorNode) && n.focusNode && se(e, n.focusNode)) {
|
226
|
+
const o = n.getRangeAt(0), i = o.cloneRange();
|
227
|
+
i.selectNodeContents(e), i.setEnd(o.startContainer, o.startOffset), t = i.toString().length, i.setEnd(o.endContainer, o.endOffset), r = i.toString().length;
|
228
|
+
}
|
229
|
+
}
|
230
|
+
return { start: t, end: r };
|
231
|
+
}
|
232
|
+
function Nn(e, t) {
|
233
|
+
const r = ["dialog", "menu", "listbox", "tree", "grid"], n = e == null ? void 0 : e.getAttribute("role");
|
234
|
+
return n && r.indexOf(n) !== -1 ? n : t;
|
235
|
+
}
|
236
|
+
function Ki(e, t) {
|
237
|
+
var r;
|
238
|
+
const n = {
|
239
|
+
menu: "menuitem",
|
240
|
+
listbox: "option",
|
241
|
+
tree: "treeitem"
|
242
|
+
}, o = Nn(e);
|
243
|
+
return o && (r = n[o]) != null ? r : t;
|
244
|
+
}
|
245
|
+
function oo(e) {
|
246
|
+
if (!e) return null;
|
247
|
+
const t = (r) => r === "auto" || r === "scroll";
|
248
|
+
if (e.clientHeight && e.scrollHeight > e.clientHeight) {
|
249
|
+
const { overflowY: r } = getComputedStyle(e);
|
250
|
+
if (t(r)) return e;
|
251
|
+
} else if (e.clientWidth && e.scrollWidth > e.clientWidth) {
|
252
|
+
const { overflowX: r } = getComputedStyle(e);
|
253
|
+
if (t(r)) return e;
|
254
|
+
}
|
255
|
+
return oo(e.parentElement) || document.scrollingElement || document.body;
|
256
|
+
}
|
257
|
+
function io(e, t) {
|
258
|
+
const r = e.map((o, i) => [i, o]);
|
259
|
+
let n = !1;
|
260
|
+
return r.sort(([o, i], [s, u]) => {
|
261
|
+
const a = t(i), d = t(u);
|
262
|
+
return a === d || !a || !d ? 0 : Hi(a, d) ? (o > s && (n = !0), -1) : (o < s && (n = !0), 1);
|
263
|
+
}), n ? r.map(([o, i]) => i) : e;
|
264
|
+
}
|
265
|
+
function Hi(e, t) {
|
266
|
+
return !!(t.compareDocumentPosition(e) & Node.DOCUMENT_POSITION_PRECEDING);
|
267
|
+
}
|
268
|
+
function Wi() {
|
269
|
+
return yt && !!navigator.maxTouchPoints;
|
270
|
+
}
|
271
|
+
function Mn() {
|
272
|
+
return yt ? /mac|iphone|ipad|ipod/i.test(navigator.platform) : !1;
|
273
|
+
}
|
274
|
+
function kn() {
|
275
|
+
return yt && Mn() && /apple/i.test(navigator.vendor);
|
276
|
+
}
|
277
|
+
function zi() {
|
278
|
+
return yt && /firefox\//i.test(navigator.userAgent);
|
279
|
+
}
|
280
|
+
function Ui() {
|
281
|
+
return yt && navigator.platform.startsWith("Mac") && !Wi();
|
282
|
+
}
|
283
|
+
function so(e) {
|
284
|
+
return !!(e.currentTarget && !se(e.currentTarget, e.target));
|
285
|
+
}
|
286
|
+
function me(e) {
|
287
|
+
return e.target === e.currentTarget;
|
288
|
+
}
|
289
|
+
function ji(e) {
|
290
|
+
const t = e.currentTarget;
|
291
|
+
if (!t) return !1;
|
292
|
+
const r = Mn();
|
293
|
+
if (r && !e.metaKey || !r && !e.ctrlKey) return !1;
|
294
|
+
const n = t.tagName.toLowerCase();
|
295
|
+
return n === "a" || n === "button" && t.type === "submit" || n === "input" && t.type === "submit";
|
296
|
+
}
|
297
|
+
function qi(e) {
|
298
|
+
const t = e.currentTarget;
|
299
|
+
if (!t) return !1;
|
300
|
+
const r = t.tagName.toLowerCase();
|
301
|
+
return e.altKey ? r === "a" || r === "button" && t.type === "submit" || r === "input" && t.type === "submit" : !1;
|
302
|
+
}
|
303
|
+
function dt(e, t) {
|
304
|
+
const r = new FocusEvent("blur", t), n = e.dispatchEvent(r), o = ve(te({}, t), { bubbles: !0 });
|
305
|
+
return e.dispatchEvent(new FocusEvent("focusout", o)), n;
|
306
|
+
}
|
307
|
+
function Gi(e, t, r) {
|
308
|
+
const n = new KeyboardEvent(t, r);
|
309
|
+
return e.dispatchEvent(n);
|
310
|
+
}
|
311
|
+
function mr(e, t) {
|
312
|
+
const r = new MouseEvent("click", t);
|
313
|
+
return e.dispatchEvent(r);
|
314
|
+
}
|
315
|
+
function pt(e, t) {
|
316
|
+
const r = t || e.currentTarget, n = e.relatedTarget;
|
317
|
+
return !n || !se(r, n);
|
318
|
+
}
|
319
|
+
function vt(e, t, r, n) {
|
320
|
+
const i = ((u) => {
|
321
|
+
const a = requestAnimationFrame(u);
|
322
|
+
return () => cancelAnimationFrame(a);
|
323
|
+
})(() => {
|
324
|
+
e.removeEventListener(t, s, !0), r();
|
325
|
+
}), s = () => {
|
326
|
+
i(), r();
|
327
|
+
};
|
328
|
+
return e.addEventListener(t, s, { once: !0, capture: !0 }), i;
|
329
|
+
}
|
330
|
+
function Ce(e, t, r, n = window) {
|
331
|
+
const o = [];
|
332
|
+
try {
|
333
|
+
n.document.addEventListener(e, t, r);
|
334
|
+
for (const s of Array.from(n.frames))
|
335
|
+
o.push(Ce(e, t, r, s));
|
336
|
+
} catch {
|
337
|
+
}
|
338
|
+
return () => {
|
339
|
+
try {
|
340
|
+
n.document.removeEventListener(e, t, r);
|
341
|
+
} catch {
|
342
|
+
}
|
343
|
+
for (const s of o)
|
344
|
+
s();
|
345
|
+
};
|
346
|
+
}
|
347
|
+
var Vn = O({}, ce), vr = Vn.useId;
|
348
|
+
Vn.useDeferredValue;
|
349
|
+
var gr = Vn.useInsertionEffect, ee = yt ? ci : W;
|
350
|
+
function Yi(e) {
|
351
|
+
const [t] = X(e);
|
352
|
+
return t;
|
353
|
+
}
|
354
|
+
function Xi(e) {
|
355
|
+
const t = Y(e);
|
356
|
+
return ee(() => {
|
357
|
+
t.current = e;
|
358
|
+
}), t;
|
359
|
+
}
|
360
|
+
function j(e) {
|
361
|
+
const t = Y(() => {
|
362
|
+
throw new Error("Cannot call an event handler while rendering.");
|
363
|
+
});
|
364
|
+
return gr ? gr(() => {
|
365
|
+
t.current = e;
|
366
|
+
}) : t.current = e, xe((...r) => {
|
367
|
+
var n;
|
368
|
+
return (n = t.current) == null ? void 0 : n.call(t, ...r);
|
369
|
+
}, []);
|
370
|
+
}
|
371
|
+
function uo(e) {
|
372
|
+
const [t, r] = X(null);
|
373
|
+
return ee(() => {
|
374
|
+
if (t == null || !e) return;
|
375
|
+
let n = null;
|
376
|
+
return e((o) => (n = o, t)), () => {
|
377
|
+
e(n);
|
378
|
+
};
|
379
|
+
}, [t, e]), [t, r];
|
380
|
+
}
|
381
|
+
function de(...e) {
|
382
|
+
return He(() => {
|
383
|
+
if (e.some(Boolean))
|
384
|
+
return (t) => {
|
385
|
+
for (const r of e)
|
386
|
+
wn(r, t);
|
387
|
+
};
|
388
|
+
}, e);
|
389
|
+
}
|
390
|
+
function ot(e) {
|
391
|
+
if (vr) {
|
392
|
+
const n = vr();
|
393
|
+
return e || n;
|
394
|
+
}
|
395
|
+
const [t, r] = X(e);
|
396
|
+
return ee(() => {
|
397
|
+
if (e || t) return;
|
398
|
+
const n = Math.random().toString(36).slice(2, 8);
|
399
|
+
r(`id-${n}`);
|
400
|
+
}, [e, t]), e || t;
|
401
|
+
}
|
402
|
+
function ao(e, t) {
|
403
|
+
const r = (i) => {
|
404
|
+
if (typeof i == "string")
|
405
|
+
return i;
|
406
|
+
}, [n, o] = X(() => r(t));
|
407
|
+
return ee(() => {
|
408
|
+
const i = e && "current" in e ? e.current : e;
|
409
|
+
o((i == null ? void 0 : i.tagName.toLowerCase()) || r(t));
|
410
|
+
}, [e, t]), n;
|
411
|
+
}
|
412
|
+
function Ji(e, t, r) {
|
413
|
+
const n = Yi(r), [o, i] = X(n);
|
414
|
+
return W(() => {
|
415
|
+
const s = e && "current" in e ? e.current : e;
|
416
|
+
if (!s) return;
|
417
|
+
const u = () => {
|
418
|
+
const d = s.getAttribute(t);
|
419
|
+
i(d ?? n);
|
420
|
+
}, a = new MutationObserver(u);
|
421
|
+
return a.observe(s, { attributeFilter: [t] }), u(), () => a.disconnect();
|
422
|
+
}, [e, t, n]), o;
|
423
|
+
}
|
424
|
+
function Jt(e, t) {
|
425
|
+
const r = Y(!1);
|
426
|
+
W(() => {
|
427
|
+
if (r.current)
|
428
|
+
return e();
|
429
|
+
r.current = !0;
|
430
|
+
}, t), W(
|
431
|
+
() => () => {
|
432
|
+
r.current = !1;
|
433
|
+
},
|
434
|
+
[]
|
435
|
+
);
|
436
|
+
}
|
437
|
+
function Qi() {
|
438
|
+
return li(() => [], []);
|
439
|
+
}
|
440
|
+
function fe(e) {
|
441
|
+
return j(
|
442
|
+
typeof e == "function" ? e : () => e
|
443
|
+
);
|
444
|
+
}
|
445
|
+
function le(e, t, r = []) {
|
446
|
+
const n = xe(
|
447
|
+
(o) => (e.wrapElement && (o = e.wrapElement(o)), t(o)),
|
448
|
+
[...r, e.wrapElement]
|
449
|
+
);
|
450
|
+
return $(O({}, e), { wrapElement: n });
|
451
|
+
}
|
452
|
+
function co(e = !1, t) {
|
453
|
+
const [r, n] = X(null);
|
454
|
+
return { portalRef: de(n, t), portalNode: r, domReady: !e || r };
|
455
|
+
}
|
456
|
+
function lo(e, t, r) {
|
457
|
+
const n = e.onLoadedMetadataCapture, o = He(() => Object.assign(() => {
|
458
|
+
}, $(O({}, n), { [t]: r })), [n, t, r]);
|
459
|
+
return [n == null ? void 0 : n[t], { onLoadedMetadataCapture: o }];
|
460
|
+
}
|
461
|
+
function Zi() {
|
462
|
+
return W(() => {
|
463
|
+
Ce("mousemove", ts, !0), Ce("mousedown", kt, !0), Ce("mouseup", kt, !0), Ce("keydown", kt, !0), Ce("scroll", kt, !0);
|
464
|
+
}, []), j(() => $n);
|
465
|
+
}
|
466
|
+
var $n = !1, hr = 0, br = 0;
|
467
|
+
function es(e) {
|
468
|
+
const t = e.movementX || e.screenX - hr, r = e.movementY || e.screenY - br;
|
469
|
+
return hr = e.screenX, br = e.screenY, t || r || process.env.NODE_ENV === "test";
|
470
|
+
}
|
471
|
+
function ts(e) {
|
472
|
+
es(e) && ($n = !0);
|
473
|
+
}
|
474
|
+
function kt() {
|
475
|
+
$n = !1;
|
476
|
+
}
|
477
|
+
function G(e) {
|
478
|
+
const t = ce.forwardRef((r, n) => e($(O({}, r), { ref: n })));
|
479
|
+
return t.displayName = e.displayName || e.name, t;
|
480
|
+
}
|
481
|
+
function Bn(e, t) {
|
482
|
+
return ce.memo(e, t);
|
483
|
+
}
|
484
|
+
function Q(e, t) {
|
485
|
+
const r = t, { wrapElement: n, render: o } = r, i = J(r, ["wrapElement", "render"]), s = de(t.ref, Ni(o));
|
486
|
+
let u;
|
487
|
+
if (ce.isValidElement(o)) {
|
488
|
+
const a = $(O({}, o.props), { ref: s });
|
489
|
+
u = ce.cloneElement(o, Mi(i, a));
|
490
|
+
} else o ? u = o(i) : u = /* @__PURE__ */ M(e, O({}, i));
|
491
|
+
return n ? n(u) : u;
|
492
|
+
}
|
493
|
+
function Z(e) {
|
494
|
+
const t = (r = {}) => e(r);
|
495
|
+
return t.displayName = e.name, t;
|
496
|
+
}
|
497
|
+
function it(e = [], t = []) {
|
498
|
+
const r = ce.createContext(void 0), n = ce.createContext(void 0), o = () => ce.useContext(r), i = (d = !1) => {
|
499
|
+
const f = ce.useContext(n), c = o();
|
500
|
+
return d ? f : f || c;
|
501
|
+
}, s = () => {
|
502
|
+
const d = ce.useContext(n), f = o();
|
503
|
+
if (!(d && d === f))
|
504
|
+
return f;
|
505
|
+
}, u = (d) => e.reduceRight(
|
506
|
+
(f, c) => /* @__PURE__ */ M(c, $(O({}, d), { children: f })),
|
507
|
+
/* @__PURE__ */ M(r.Provider, O({}, d))
|
508
|
+
);
|
509
|
+
return {
|
510
|
+
context: r,
|
511
|
+
scopedContext: n,
|
512
|
+
useContext: o,
|
513
|
+
useScopedContext: i,
|
514
|
+
useProviderContext: s,
|
515
|
+
ContextProvider: u,
|
516
|
+
ScopedContextProvider: (d) => /* @__PURE__ */ M(u, $(O({}, d), { children: t.reduceRight(
|
517
|
+
(f, c) => /* @__PURE__ */ M(c, $(O({}, d), { children: f })),
|
518
|
+
/* @__PURE__ */ M(n.Provider, O({}, d))
|
519
|
+
) }))
|
520
|
+
};
|
521
|
+
}
|
522
|
+
var _t = it(), ns = _t.useContext;
|
523
|
+
_t.useScopedContext;
|
524
|
+
_t.useProviderContext;
|
525
|
+
var rs = _t.ContextProvider, os = _t.ScopedContextProvider, Dt = it(
|
526
|
+
[rs],
|
527
|
+
[os]
|
528
|
+
), Kn = Dt.useContext;
|
529
|
+
Dt.useScopedContext;
|
530
|
+
var is = Dt.useProviderContext, Hn = Dt.ContextProvider, fo = Dt.ScopedContextProvider, ss = ge(
|
531
|
+
void 0
|
532
|
+
), us = ge(
|
533
|
+
void 0
|
534
|
+
), At = it();
|
535
|
+
At.useContext;
|
536
|
+
At.useScopedContext;
|
537
|
+
var Wn = At.useProviderContext, as = At.ContextProvider, cs = At.ScopedContextProvider, zn = it(
|
538
|
+
[as],
|
539
|
+
[cs]
|
540
|
+
), Qt = zn.useProviderContext, ls = zn.ContextProvider, Un = zn.ScopedContextProvider, fs = ge(void 0), ds = ge(void 0), Tt = it(
|
541
|
+
[ls],
|
542
|
+
[Un]
|
543
|
+
), ps = Tt.useContext;
|
544
|
+
Tt.useScopedContext;
|
545
|
+
var Zt = Tt.useProviderContext, po = Tt.ContextProvider, en = Tt.ScopedContextProvider;
|
546
|
+
ge(
|
547
|
+
void 0
|
548
|
+
);
|
549
|
+
var ms = it(
|
550
|
+
[po, Hn],
|
551
|
+
[en, fo]
|
552
|
+
), vs = ms.useProviderContext;
|
553
|
+
ge(
|
554
|
+
void 0
|
555
|
+
);
|
556
|
+
ge(!1);
|
557
|
+
function St(e, t) {
|
558
|
+
const r = e.__unstableInternals;
|
559
|
+
return he(r, "Invalid store"), r[t];
|
560
|
+
}
|
561
|
+
function Ke(e, ...t) {
|
562
|
+
let r = e, n = r, o = Symbol(), i = Kt;
|
563
|
+
const s = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set(), f = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new WeakMap(), l = /* @__PURE__ */ new WeakMap(), p = (L) => (a.add(L), () => a.delete(L)), b = () => {
|
564
|
+
const L = s.size, S = Symbol();
|
565
|
+
s.add(S);
|
566
|
+
const A = () => {
|
567
|
+
s.delete(S), !s.size && i();
|
568
|
+
};
|
569
|
+
if (L) return A;
|
570
|
+
const F = Ri(r).map(
|
571
|
+
(T) => Te(
|
572
|
+
...t.map((D) => {
|
573
|
+
var v;
|
574
|
+
const R = (v = D == null ? void 0 : D.getState) == null ? void 0 : v.call(D);
|
575
|
+
if (R && Ne(R, T))
|
576
|
+
return $e(D, [T], (K) => {
|
577
|
+
C(
|
578
|
+
T,
|
579
|
+
K[T],
|
580
|
+
// @ts-expect-error - Not public API. This is just to prevent
|
581
|
+
// infinite loops.
|
582
|
+
!0
|
583
|
+
);
|
584
|
+
});
|
585
|
+
})
|
586
|
+
)
|
587
|
+
), N = [];
|
588
|
+
for (const T of a)
|
589
|
+
N.push(T());
|
590
|
+
const I = t.map(jn);
|
591
|
+
return i = Te(...F, ...N, ...I), A;
|
592
|
+
}, g = (L, S, A = d) => (A.add(S), l.set(S, L), () => {
|
593
|
+
var F;
|
594
|
+
(F = c.get(S)) == null || F(), c.delete(S), l.delete(S), A.delete(S);
|
595
|
+
}), E = (L, S) => g(L, S), w = (L, S) => (c.set(S, S(r, r)), g(L, S)), P = (L, S) => (c.set(S, S(r, n)), g(L, S, f)), h = (L) => Ke(Li(r, L), _), m = (L) => Ke(Ti(r, L), _), y = () => r, C = (L, S, A = !1) => {
|
596
|
+
var F;
|
597
|
+
if (!Ne(r, L)) return;
|
598
|
+
const N = Oi(S, r[L]);
|
599
|
+
if (N === r[L]) return;
|
600
|
+
if (!A)
|
601
|
+
for (const v of t)
|
602
|
+
(F = v == null ? void 0 : v.setState) == null || F.call(v, L, N);
|
603
|
+
const I = r;
|
604
|
+
r = ve(te({}, r), { [L]: N });
|
605
|
+
const T = Symbol();
|
606
|
+
o = T, u.add(L);
|
607
|
+
const D = (v, R, K) => {
|
608
|
+
var x;
|
609
|
+
const k = l.get(v), B = (H) => K ? K.has(H) : H === L;
|
610
|
+
(!k || k.some(B)) && ((x = c.get(v)) == null || x(), c.set(v, v(r, R)));
|
611
|
+
};
|
612
|
+
for (const v of d)
|
613
|
+
D(v, I);
|
614
|
+
queueMicrotask(() => {
|
615
|
+
if (o !== T) return;
|
616
|
+
const v = r;
|
617
|
+
for (const R of f)
|
618
|
+
D(R, n, u);
|
619
|
+
n = v, u.clear();
|
620
|
+
});
|
621
|
+
}, _ = {
|
622
|
+
getState: y,
|
623
|
+
setState: C,
|
624
|
+
__unstableInternals: {
|
625
|
+
setup: p,
|
626
|
+
init: b,
|
627
|
+
subscribe: E,
|
628
|
+
sync: w,
|
629
|
+
batch: P,
|
630
|
+
pick: h,
|
631
|
+
omit: m
|
632
|
+
}
|
633
|
+
};
|
634
|
+
return _;
|
635
|
+
}
|
636
|
+
function Oe(e, ...t) {
|
637
|
+
if (e)
|
638
|
+
return St(e, "setup")(...t);
|
639
|
+
}
|
640
|
+
function jn(e, ...t) {
|
641
|
+
if (e)
|
642
|
+
return St(e, "init")(...t);
|
643
|
+
}
|
644
|
+
function qn(e, ...t) {
|
645
|
+
if (e)
|
646
|
+
return St(e, "subscribe")(...t);
|
647
|
+
}
|
648
|
+
function $e(e, ...t) {
|
649
|
+
if (e)
|
650
|
+
return St(e, "sync")(...t);
|
651
|
+
}
|
652
|
+
function Ut(e, ...t) {
|
653
|
+
if (e)
|
654
|
+
return St(e, "batch")(...t);
|
655
|
+
}
|
656
|
+
function Gn(e, ...t) {
|
657
|
+
if (e)
|
658
|
+
return St(e, "omit")(...t);
|
659
|
+
}
|
660
|
+
function Yn(...e) {
|
661
|
+
const t = e.reduce((n, o) => {
|
662
|
+
var i;
|
663
|
+
const s = (i = o == null ? void 0 : o.getState) == null ? void 0 : i.call(o);
|
664
|
+
return s ? Object.assign(n, s) : n;
|
665
|
+
}, {}), r = Ke(t, ...e);
|
666
|
+
return Object.assign({}, ...e, r);
|
667
|
+
}
|
668
|
+
function tn(e, t) {
|
669
|
+
if (process.env.NODE_ENV === "production" || !t) return;
|
670
|
+
const r = Object.entries(e).filter(([i, s]) => i.startsWith("default") && s !== void 0).map(([i]) => {
|
671
|
+
var s;
|
672
|
+
const u = i.replace("default", "");
|
673
|
+
return `${((s = u[0]) == null ? void 0 : s.toLowerCase()) || ""}${u.slice(1)}`;
|
674
|
+
});
|
675
|
+
if (!r.length) return;
|
676
|
+
const n = t.getState();
|
677
|
+
if (r.filter(
|
678
|
+
(i) => Ne(n, i)
|
679
|
+
).length)
|
680
|
+
throw new Error(
|
681
|
+
`Passing a store prop in conjunction with a default state is not supported.
|
682
|
+
|
683
|
+
const store = useSelectStore();
|
684
|
+
<SelectProvider store={store} defaultValue="Apple" />
|
685
|
+
^ ^
|
686
|
+
|
687
|
+
Instead, pass the default state to the topmost store:
|
688
|
+
|
689
|
+
const store = useSelectStore({ defaultValue: "Apple" });
|
690
|
+
<SelectProvider store={store} />
|
691
|
+
|
692
|
+
See https://github.com/ariakit/ariakit/pull/2745 for more details.
|
693
|
+
|
694
|
+
If there's a particular need for this, please submit a feature request at https://github.com/ariakit/ariakit
|
695
|
+
`
|
696
|
+
);
|
697
|
+
}
|
698
|
+
function gs(e) {
|
699
|
+
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
700
|
+
}
|
701
|
+
var xn = { exports: {} }, dn = {};
|
702
|
+
/**
|
703
|
+
* @license React
|
704
|
+
* use-sync-external-store-shim.production.min.js
|
705
|
+
*
|
706
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
707
|
+
*
|
708
|
+
* This source code is licensed under the MIT license found in the
|
709
|
+
* LICENSE file in the root directory of this source tree.
|
710
|
+
*/
|
711
|
+
var yr;
|
712
|
+
function hs() {
|
713
|
+
if (yr) return dn;
|
714
|
+
yr = 1;
|
715
|
+
var e = qr;
|
716
|
+
function t(c, l) {
|
717
|
+
return c === l && (c !== 0 || 1 / c === 1 / l) || c !== c && l !== l;
|
718
|
+
}
|
719
|
+
var r = typeof Object.is == "function" ? Object.is : t, n = e.useState, o = e.useEffect, i = e.useLayoutEffect, s = e.useDebugValue;
|
720
|
+
function u(c, l) {
|
721
|
+
var p = l(), b = n({ inst: { value: p, getSnapshot: l } }), g = b[0].inst, E = b[1];
|
722
|
+
return i(function() {
|
723
|
+
g.value = p, g.getSnapshot = l, a(g) && E({ inst: g });
|
724
|
+
}, [c, p, l]), o(function() {
|
725
|
+
return a(g) && E({ inst: g }), c(function() {
|
726
|
+
a(g) && E({ inst: g });
|
727
|
+
});
|
728
|
+
}, [c]), s(p), p;
|
729
|
+
}
|
730
|
+
function a(c) {
|
731
|
+
var l = c.getSnapshot;
|
732
|
+
c = c.value;
|
733
|
+
try {
|
734
|
+
var p = l();
|
735
|
+
return !r(c, p);
|
736
|
+
} catch {
|
737
|
+
return !0;
|
738
|
+
}
|
739
|
+
}
|
740
|
+
function d(c, l) {
|
741
|
+
return l();
|
742
|
+
}
|
743
|
+
var f = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? d : u;
|
744
|
+
return dn.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : f, dn;
|
745
|
+
}
|
746
|
+
var pn = {};
|
747
|
+
/**
|
748
|
+
* @license React
|
749
|
+
* use-sync-external-store-shim.development.js
|
750
|
+
*
|
751
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
752
|
+
*
|
753
|
+
* This source code is licensed under the MIT license found in the
|
754
|
+
* LICENSE file in the root directory of this source tree.
|
755
|
+
*/
|
756
|
+
var Sr;
|
757
|
+
function bs() {
|
758
|
+
return Sr || (Sr = 1, process.env.NODE_ENV !== "production" && function() {
|
759
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
760
|
+
var e = qr, t = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
761
|
+
function r(h) {
|
762
|
+
{
|
763
|
+
for (var m = arguments.length, y = new Array(m > 1 ? m - 1 : 0), C = 1; C < m; C++)
|
764
|
+
y[C - 1] = arguments[C];
|
765
|
+
n("error", h, y);
|
766
|
+
}
|
767
|
+
}
|
768
|
+
function n(h, m, y) {
|
769
|
+
{
|
770
|
+
var C = t.ReactDebugCurrentFrame, _ = C.getStackAddendum();
|
771
|
+
_ !== "" && (m += "%s", y = y.concat([_]));
|
772
|
+
var L = y.map(function(S) {
|
773
|
+
return String(S);
|
774
|
+
});
|
775
|
+
L.unshift("Warning: " + m), Function.prototype.apply.call(console[h], console, L);
|
776
|
+
}
|
777
|
+
}
|
778
|
+
function o(h, m) {
|
779
|
+
return h === m && (h !== 0 || 1 / h === 1 / m) || h !== h && m !== m;
|
780
|
+
}
|
781
|
+
var i = typeof Object.is == "function" ? Object.is : o, s = e.useState, u = e.useEffect, a = e.useLayoutEffect, d = e.useDebugValue, f = !1, c = !1;
|
782
|
+
function l(h, m, y) {
|
783
|
+
f || e.startTransition !== void 0 && (f = !0, r("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));
|
784
|
+
var C = m();
|
785
|
+
if (!c) {
|
786
|
+
var _ = m();
|
787
|
+
i(C, _) || (r("The result of getSnapshot should be cached to avoid an infinite loop"), c = !0);
|
788
|
+
}
|
789
|
+
var L = s({
|
790
|
+
inst: {
|
791
|
+
value: C,
|
792
|
+
getSnapshot: m
|
793
|
+
}
|
794
|
+
}), S = L[0].inst, A = L[1];
|
795
|
+
return a(function() {
|
796
|
+
S.value = C, S.getSnapshot = m, p(S) && A({
|
797
|
+
inst: S
|
798
|
+
});
|
799
|
+
}, [h, C, m]), u(function() {
|
800
|
+
p(S) && A({
|
801
|
+
inst: S
|
802
|
+
});
|
803
|
+
var F = function() {
|
804
|
+
p(S) && A({
|
805
|
+
inst: S
|
806
|
+
});
|
807
|
+
};
|
808
|
+
return h(F);
|
809
|
+
}, [h]), d(C), C;
|
810
|
+
}
|
811
|
+
function p(h) {
|
812
|
+
var m = h.getSnapshot, y = h.value;
|
813
|
+
try {
|
814
|
+
var C = m();
|
815
|
+
return !i(y, C);
|
816
|
+
} catch {
|
817
|
+
return !0;
|
818
|
+
}
|
819
|
+
}
|
820
|
+
function b(h, m, y) {
|
821
|
+
return m();
|
822
|
+
}
|
823
|
+
var g = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", E = !g, w = E ? b : l, P = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : w;
|
824
|
+
pn.useSyncExternalStore = P, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
825
|
+
}()), pn;
|
826
|
+
}
|
827
|
+
process.env.NODE_ENV === "production" ? xn.exports = hs() : xn.exports = bs();
|
828
|
+
var ys = xn.exports;
|
829
|
+
const Ss = /* @__PURE__ */ gs(ys);
|
830
|
+
var { useSyncExternalStore: mo } = Ss, vo = () => () => {
|
831
|
+
};
|
832
|
+
function _e(e, t = to) {
|
833
|
+
const r = ce.useCallback(
|
834
|
+
(o) => e ? qn(e, null, o) : vo(),
|
835
|
+
[e]
|
836
|
+
), n = () => {
|
837
|
+
const o = typeof t == "string" ? t : null, i = typeof t == "function" ? t : null, s = e == null ? void 0 : e.getState();
|
838
|
+
if (i) return i(s);
|
839
|
+
if (s && o && Ne(s, o))
|
840
|
+
return s[o];
|
841
|
+
};
|
842
|
+
return mo(r, n, n);
|
843
|
+
}
|
844
|
+
function go(e, t) {
|
845
|
+
const r = ce.useRef(
|
846
|
+
{}
|
847
|
+
), n = ce.useCallback(
|
848
|
+
(i) => e ? qn(e, null, i) : vo(),
|
849
|
+
[e]
|
850
|
+
), o = () => {
|
851
|
+
const i = e == null ? void 0 : e.getState();
|
852
|
+
let s = !1;
|
853
|
+
const u = r.current;
|
854
|
+
for (const a in t) {
|
855
|
+
const d = t[a];
|
856
|
+
if (typeof d == "function") {
|
857
|
+
const f = d(i);
|
858
|
+
f !== u[a] && (u[a] = f, s = !0);
|
859
|
+
}
|
860
|
+
if (typeof d == "string") {
|
861
|
+
if (!i || !Ne(i, d)) continue;
|
862
|
+
const f = i[d];
|
863
|
+
f !== u[a] && (u[a] = f, s = !0);
|
864
|
+
}
|
865
|
+
}
|
866
|
+
return s && (r.current = O({}, u)), r.current;
|
867
|
+
};
|
868
|
+
return mo(n, o, o);
|
869
|
+
}
|
870
|
+
function pe(e, t, r, n) {
|
871
|
+
const o = Ne(t, r) ? t[r] : void 0, i = n ? t[n] : void 0, s = Xi({ value: o, setValue: i });
|
872
|
+
ee(() => $e(e, [r], (u, a) => {
|
873
|
+
const { value: d, setValue: f } = s.current;
|
874
|
+
f && u[r] !== a[r] && u[r] !== d && f(u[r]);
|
875
|
+
}), [e, r]), ee(() => {
|
876
|
+
if (o !== void 0)
|
877
|
+
return e.setState(r, o), Ut(e, [r], () => {
|
878
|
+
o !== void 0 && e.setState(r, o);
|
879
|
+
});
|
880
|
+
});
|
881
|
+
}
|
882
|
+
function Xn(e, t) {
|
883
|
+
const [r, n] = ce.useState(() => e(t));
|
884
|
+
ee(() => jn(r), [r]);
|
885
|
+
const o = ce.useCallback(
|
886
|
+
(u) => _e(r, u),
|
887
|
+
[r]
|
888
|
+
), i = ce.useMemo(
|
889
|
+
() => $(O({}, r), { useState: o }),
|
890
|
+
[r, o]
|
891
|
+
), s = j(() => {
|
892
|
+
n((u) => e(O(O({}, t), u.getState())));
|
893
|
+
});
|
894
|
+
return [i, s];
|
895
|
+
}
|
896
|
+
function ws(e) {
|
897
|
+
var t;
|
898
|
+
const r = e.find((i) => !!i.element), n = [...e].reverse().find((i) => !!i.element);
|
899
|
+
let o = (t = r == null ? void 0 : r.element) == null ? void 0 : t.parentElement;
|
900
|
+
for (; o && (n != null && n.element); ) {
|
901
|
+
if (n && o.contains(n.element))
|
902
|
+
return o;
|
903
|
+
o = o.parentElement;
|
904
|
+
}
|
905
|
+
return ne(o).body;
|
906
|
+
}
|
907
|
+
function Es(e) {
|
908
|
+
return e == null ? void 0 : e.__unstablePrivateStore;
|
909
|
+
}
|
910
|
+
function xs(e = {}) {
|
911
|
+
var t;
|
912
|
+
tn(e, e.store);
|
913
|
+
const r = (t = e.store) == null ? void 0 : t.getState(), n = U(
|
914
|
+
e.items,
|
915
|
+
r == null ? void 0 : r.items,
|
916
|
+
e.defaultItems,
|
917
|
+
[]
|
918
|
+
), o = new Map(n.map((l) => [l.id, l])), i = {
|
919
|
+
items: n,
|
920
|
+
renderedItems: U(r == null ? void 0 : r.renderedItems, [])
|
921
|
+
}, s = Es(e.store), u = Ke(
|
922
|
+
{ items: n, renderedItems: i.renderedItems },
|
923
|
+
s
|
924
|
+
), a = Ke(i, e.store), d = (l) => {
|
925
|
+
const p = io(l, (b) => b.element);
|
926
|
+
u.setState("renderedItems", p), a.setState("renderedItems", p);
|
927
|
+
};
|
928
|
+
Oe(a, () => jn(u)), Oe(u, () => Ut(u, ["items"], (l) => {
|
929
|
+
a.setState("items", l.items);
|
930
|
+
})), Oe(u, () => Ut(u, ["renderedItems"], (l) => {
|
931
|
+
let p = !0, b = requestAnimationFrame(() => {
|
932
|
+
const { renderedItems: P } = a.getState();
|
933
|
+
l.renderedItems !== P && d(l.renderedItems);
|
934
|
+
});
|
935
|
+
if (typeof IntersectionObserver != "function")
|
936
|
+
return () => cancelAnimationFrame(b);
|
937
|
+
const g = () => {
|
938
|
+
if (p) {
|
939
|
+
p = !1;
|
940
|
+
return;
|
941
|
+
}
|
942
|
+
cancelAnimationFrame(b), b = requestAnimationFrame(() => d(l.renderedItems));
|
943
|
+
}, E = ws(l.renderedItems), w = new IntersectionObserver(g, { root: E });
|
944
|
+
for (const P of l.renderedItems)
|
945
|
+
P.element && w.observe(P.element);
|
946
|
+
return () => {
|
947
|
+
cancelAnimationFrame(b), w.disconnect();
|
948
|
+
};
|
949
|
+
}));
|
950
|
+
const f = (l, p, b = !1) => {
|
951
|
+
let g;
|
952
|
+
return p((w) => {
|
953
|
+
const P = w.findIndex(({ id: m }) => m === l.id), h = w.slice();
|
954
|
+
if (P !== -1) {
|
955
|
+
g = w[P];
|
956
|
+
const m = te(te({}, g), l);
|
957
|
+
h[P] = m, o.set(l.id, m);
|
958
|
+
} else
|
959
|
+
h.push(l), o.set(l.id, l);
|
960
|
+
return h;
|
961
|
+
}), () => {
|
962
|
+
p((w) => {
|
963
|
+
if (!g)
|
964
|
+
return b && o.delete(l.id), w.filter(({ id: m }) => m !== l.id);
|
965
|
+
const P = w.findIndex(({ id: m }) => m === l.id);
|
966
|
+
if (P === -1) return w;
|
967
|
+
const h = w.slice();
|
968
|
+
return h[P] = g, o.set(l.id, g), h;
|
969
|
+
});
|
970
|
+
};
|
971
|
+
}, c = (l) => f(
|
972
|
+
l,
|
973
|
+
(p) => u.setState("items", p),
|
974
|
+
!0
|
975
|
+
);
|
976
|
+
return ve(te({}, a), {
|
977
|
+
registerItem: c,
|
978
|
+
renderItem: (l) => Te(
|
979
|
+
c(l),
|
980
|
+
f(
|
981
|
+
l,
|
982
|
+
(p) => u.setState("renderedItems", p)
|
983
|
+
)
|
984
|
+
),
|
985
|
+
item: (l) => {
|
986
|
+
if (!l) return null;
|
987
|
+
let p = o.get(l);
|
988
|
+
if (!p) {
|
989
|
+
const { items: b } = u.getState();
|
990
|
+
p = b.find((g) => g.id === l), p && o.set(l, p);
|
991
|
+
}
|
992
|
+
return p || null;
|
993
|
+
},
|
994
|
+
// @ts-expect-error Internal
|
995
|
+
__unstablePrivateStore: u
|
996
|
+
});
|
997
|
+
}
|
998
|
+
function Ps(e, t, r) {
|
999
|
+
return Jt(t, [r.store]), pe(e, r, "items", "setItems"), e;
|
1000
|
+
}
|
1001
|
+
function ho(e) {
|
1002
|
+
return Array.isArray(e) ? e : typeof e < "u" ? [e] : [];
|
1003
|
+
}
|
1004
|
+
function bo(e) {
|
1005
|
+
const t = [];
|
1006
|
+
for (const r of e)
|
1007
|
+
t.push(...r);
|
1008
|
+
return t;
|
1009
|
+
}
|
1010
|
+
function Pn(e) {
|
1011
|
+
return e.slice().reverse();
|
1012
|
+
}
|
1013
|
+
var Is = { id: null };
|
1014
|
+
function ke(e, t) {
|
1015
|
+
return e.find((r) => t ? !r.disabled && r.id !== t : !r.disabled);
|
1016
|
+
}
|
1017
|
+
function Cs(e, t) {
|
1018
|
+
return e.filter((r) => t ? !r.disabled && r.id !== t : !r.disabled);
|
1019
|
+
}
|
1020
|
+
function wr(e, t) {
|
1021
|
+
return e.filter((r) => r.rowId === t);
|
1022
|
+
}
|
1023
|
+
function Os(e, t, r = !1) {
|
1024
|
+
const n = e.findIndex((o) => o.id === t);
|
1025
|
+
return [
|
1026
|
+
...e.slice(n + 1),
|
1027
|
+
...r ? [Is] : [],
|
1028
|
+
...e.slice(0, n)
|
1029
|
+
];
|
1030
|
+
}
|
1031
|
+
function yo(e) {
|
1032
|
+
const t = [];
|
1033
|
+
for (const r of e) {
|
1034
|
+
const n = t.find((o) => {
|
1035
|
+
var i;
|
1036
|
+
return ((i = o[0]) == null ? void 0 : i.rowId) === r.rowId;
|
1037
|
+
});
|
1038
|
+
n ? n.push(r) : t.push([r]);
|
1039
|
+
}
|
1040
|
+
return t;
|
1041
|
+
}
|
1042
|
+
function So(e) {
|
1043
|
+
let t = 0;
|
1044
|
+
for (const { length: r } of e)
|
1045
|
+
r > t && (t = r);
|
1046
|
+
return t;
|
1047
|
+
}
|
1048
|
+
function _s(e) {
|
1049
|
+
return {
|
1050
|
+
id: "__EMPTY_ITEM__",
|
1051
|
+
disabled: !0,
|
1052
|
+
rowId: e
|
1053
|
+
};
|
1054
|
+
}
|
1055
|
+
function Ds(e, t, r) {
|
1056
|
+
const n = So(e);
|
1057
|
+
for (const o of e)
|
1058
|
+
for (let i = 0; i < n; i += 1) {
|
1059
|
+
const s = o[i];
|
1060
|
+
if (!s || r && s.disabled) {
|
1061
|
+
const a = i === 0 && r ? ke(o) : o[i - 1];
|
1062
|
+
o[i] = a && t !== a.id && r ? a : _s(a == null ? void 0 : a.rowId);
|
1063
|
+
}
|
1064
|
+
}
|
1065
|
+
return e;
|
1066
|
+
}
|
1067
|
+
function As(e) {
|
1068
|
+
const t = yo(e), r = So(t), n = [];
|
1069
|
+
for (let o = 0; o < r; o += 1)
|
1070
|
+
for (const i of t) {
|
1071
|
+
const s = i[o];
|
1072
|
+
s && n.push(ve(te({}, s), {
|
1073
|
+
// If there's no rowId, it means that it's not a grid composite, but
|
1074
|
+
// a single row instead. So, instead of verticalizing it, that is,
|
1075
|
+
// assigning a different rowId based on the column index, we keep it
|
1076
|
+
// undefined so they will be part of the same row. This is useful
|
1077
|
+
// when using up/down on one-dimensional composites.
|
1078
|
+
rowId: s.rowId ? `${o}` : void 0
|
1079
|
+
}));
|
1080
|
+
}
|
1081
|
+
return n;
|
1082
|
+
}
|
1083
|
+
function Ts(e = {}) {
|
1084
|
+
var t;
|
1085
|
+
const r = (t = e.store) == null ? void 0 : t.getState(), n = xs(e), o = U(
|
1086
|
+
e.activeId,
|
1087
|
+
r == null ? void 0 : r.activeId,
|
1088
|
+
e.defaultActiveId
|
1089
|
+
), i = ve(te({}, n.getState()), {
|
1090
|
+
id: U(
|
1091
|
+
e.id,
|
1092
|
+
r == null ? void 0 : r.id,
|
1093
|
+
`id-${Math.random().toString(36).slice(2, 8)}`
|
1094
|
+
),
|
1095
|
+
activeId: o,
|
1096
|
+
baseElement: U(r == null ? void 0 : r.baseElement, null),
|
1097
|
+
includesBaseElement: U(
|
1098
|
+
e.includesBaseElement,
|
1099
|
+
r == null ? void 0 : r.includesBaseElement,
|
1100
|
+
o === null
|
1101
|
+
),
|
1102
|
+
moves: U(r == null ? void 0 : r.moves, 0),
|
1103
|
+
orientation: U(
|
1104
|
+
e.orientation,
|
1105
|
+
r == null ? void 0 : r.orientation,
|
1106
|
+
"both"
|
1107
|
+
),
|
1108
|
+
rtl: U(e.rtl, r == null ? void 0 : r.rtl, !1),
|
1109
|
+
virtualFocus: U(
|
1110
|
+
e.virtualFocus,
|
1111
|
+
r == null ? void 0 : r.virtualFocus,
|
1112
|
+
!1
|
1113
|
+
),
|
1114
|
+
focusLoop: U(e.focusLoop, r == null ? void 0 : r.focusLoop, !1),
|
1115
|
+
focusWrap: U(e.focusWrap, r == null ? void 0 : r.focusWrap, !1),
|
1116
|
+
focusShift: U(e.focusShift, r == null ? void 0 : r.focusShift, !1)
|
1117
|
+
}), s = Ke(i, n, e.store);
|
1118
|
+
Oe(
|
1119
|
+
s,
|
1120
|
+
() => $e(s, ["renderedItems", "activeId"], (a) => {
|
1121
|
+
s.setState("activeId", (d) => {
|
1122
|
+
var f;
|
1123
|
+
return d !== void 0 ? d : (f = ke(a.renderedItems)) == null ? void 0 : f.id;
|
1124
|
+
});
|
1125
|
+
})
|
1126
|
+
);
|
1127
|
+
const u = (a = "next", d = {}) => {
|
1128
|
+
var f, c;
|
1129
|
+
const l = s.getState(), {
|
1130
|
+
skip: p = 0,
|
1131
|
+
activeId: b = l.activeId,
|
1132
|
+
focusShift: g = l.focusShift,
|
1133
|
+
focusLoop: E = l.focusLoop,
|
1134
|
+
focusWrap: w = l.focusWrap,
|
1135
|
+
includesBaseElement: P = l.includesBaseElement,
|
1136
|
+
renderedItems: h = l.renderedItems,
|
1137
|
+
rtl: m = l.rtl
|
1138
|
+
} = d, y = a === "up" || a === "down", C = a === "next" || a === "down", _ = C ? m && !y : !m || y, L = g && !p;
|
1139
|
+
let S = y ? bo(
|
1140
|
+
Ds(yo(h), b, L)
|
1141
|
+
) : h;
|
1142
|
+
if (S = _ ? Pn(S) : S, S = y ? As(S) : S, b == null)
|
1143
|
+
return (f = ke(S)) == null ? void 0 : f.id;
|
1144
|
+
const A = S.find((x) => x.id === b);
|
1145
|
+
if (!A)
|
1146
|
+
return (c = ke(S)) == null ? void 0 : c.id;
|
1147
|
+
const F = S.some((x) => x.rowId), N = S.indexOf(A), I = S.slice(N + 1), T = wr(I, A.rowId);
|
1148
|
+
if (p) {
|
1149
|
+
const x = Cs(T, b), k = x.slice(p)[0] || // If we can't find an item, just return the last one.
|
1150
|
+
x[x.length - 1];
|
1151
|
+
return k == null ? void 0 : k.id;
|
1152
|
+
}
|
1153
|
+
const D = E && (y ? E !== "horizontal" : E !== "vertical"), v = F && w && (y ? w !== "horizontal" : w !== "vertical"), R = C ? (!F || y) && D && P : y ? P : !1;
|
1154
|
+
if (D) {
|
1155
|
+
const x = v && !R ? S : wr(S, A.rowId), k = Os(x, b, R), B = ke(k, b);
|
1156
|
+
return B == null ? void 0 : B.id;
|
1157
|
+
}
|
1158
|
+
if (v) {
|
1159
|
+
const x = ke(
|
1160
|
+
// We can use nextItems, which contains all the next items, including
|
1161
|
+
// items from other rows, to wrap between rows. However, if there is a
|
1162
|
+
// null item (the composite container), we'll only use the next items in
|
1163
|
+
// the row. So moving next from the last item will focus on the
|
1164
|
+
// composite container. On grid composites, horizontal navigation never
|
1165
|
+
// focuses on the composite container, only vertical.
|
1166
|
+
R ? T : I,
|
1167
|
+
b
|
1168
|
+
);
|
1169
|
+
return R ? (x == null ? void 0 : x.id) || null : x == null ? void 0 : x.id;
|
1170
|
+
}
|
1171
|
+
const K = ke(T, b);
|
1172
|
+
return !K && R ? null : K == null ? void 0 : K.id;
|
1173
|
+
};
|
1174
|
+
return ve(te(te({}, n), s), {
|
1175
|
+
setBaseElement: (a) => s.setState("baseElement", a),
|
1176
|
+
setActiveId: (a) => s.setState("activeId", a),
|
1177
|
+
move: (a) => {
|
1178
|
+
a !== void 0 && (s.setState("activeId", a), s.setState("moves", (d) => d + 1));
|
1179
|
+
},
|
1180
|
+
first: () => {
|
1181
|
+
var a;
|
1182
|
+
return (a = ke(s.getState().renderedItems)) == null ? void 0 : a.id;
|
1183
|
+
},
|
1184
|
+
last: () => {
|
1185
|
+
var a;
|
1186
|
+
return (a = ke(Pn(s.getState().renderedItems))) == null ? void 0 : a.id;
|
1187
|
+
},
|
1188
|
+
next: (a) => (a !== void 0 && typeof a == "number" && (a = { skip: a }), u("next", a)),
|
1189
|
+
previous: (a) => (a !== void 0 && typeof a == "number" && (a = { skip: a }), u("previous", a)),
|
1190
|
+
down: (a) => (a !== void 0 && typeof a == "number" && (a = { skip: a }), u("down", a)),
|
1191
|
+
up: (a) => (a !== void 0 && typeof a == "number" && (a = { skip: a }), u("up", a))
|
1192
|
+
});
|
1193
|
+
}
|
1194
|
+
function Ls(e) {
|
1195
|
+
const t = ot(e.id);
|
1196
|
+
return O({ id: t }, e);
|
1197
|
+
}
|
1198
|
+
function Rs(e, t, r) {
|
1199
|
+
return e = Ps(e, t, r), pe(e, r, "activeId", "setActiveId"), pe(e, r, "includesBaseElement"), pe(e, r, "virtualFocus"), pe(e, r, "orientation"), pe(e, r, "rtl"), pe(e, r, "focusLoop"), pe(e, r, "focusWrap"), pe(e, r, "focusShift"), e;
|
1200
|
+
}
|
1201
|
+
function wo(e = {}) {
|
1202
|
+
const t = Yn(
|
1203
|
+
e.store,
|
1204
|
+
Gn(e.disclosure, ["contentElement", "disclosureElement"])
|
1205
|
+
);
|
1206
|
+
tn(e, t);
|
1207
|
+
const r = t == null ? void 0 : t.getState(), n = U(
|
1208
|
+
e.open,
|
1209
|
+
r == null ? void 0 : r.open,
|
1210
|
+
e.defaultOpen,
|
1211
|
+
!1
|
1212
|
+
), o = U(e.animated, r == null ? void 0 : r.animated, !1), i = {
|
1213
|
+
open: n,
|
1214
|
+
animated: o,
|
1215
|
+
animating: !!o && n,
|
1216
|
+
mounted: n,
|
1217
|
+
contentElement: U(r == null ? void 0 : r.contentElement, null),
|
1218
|
+
disclosureElement: U(r == null ? void 0 : r.disclosureElement, null)
|
1219
|
+
}, s = Ke(i, t);
|
1220
|
+
return Oe(
|
1221
|
+
s,
|
1222
|
+
() => $e(s, ["animated", "animating"], (u) => {
|
1223
|
+
u.animated || s.setState("animating", !1);
|
1224
|
+
})
|
1225
|
+
), Oe(
|
1226
|
+
s,
|
1227
|
+
() => qn(s, ["open"], () => {
|
1228
|
+
s.getState().animated && s.setState("animating", !0);
|
1229
|
+
})
|
1230
|
+
), Oe(
|
1231
|
+
s,
|
1232
|
+
() => $e(s, ["open", "animating"], (u) => {
|
1233
|
+
s.setState("mounted", u.open || u.animating);
|
1234
|
+
})
|
1235
|
+
), ve(te({}, s), {
|
1236
|
+
disclosure: e.disclosure,
|
1237
|
+
setOpen: (u) => s.setState("open", u),
|
1238
|
+
show: () => s.setState("open", !0),
|
1239
|
+
hide: () => s.setState("open", !1),
|
1240
|
+
toggle: () => s.setState("open", (u) => !u),
|
1241
|
+
stopAnimation: () => s.setState("animating", !1),
|
1242
|
+
setContentElement: (u) => s.setState("contentElement", u),
|
1243
|
+
setDisclosureElement: (u) => s.setState("disclosureElement", u)
|
1244
|
+
});
|
1245
|
+
}
|
1246
|
+
function Eo(e, t, r) {
|
1247
|
+
return Jt(t, [r.store, r.disclosure]), pe(e, r, "open", "setOpen"), pe(e, r, "mounted", "setMounted"), pe(e, r, "animated"), Object.assign(e, { disclosure: r.disclosure });
|
1248
|
+
}
|
1249
|
+
function Fs(e = {}) {
|
1250
|
+
const [t, r] = Xn(wo, e);
|
1251
|
+
return Eo(t, r, e);
|
1252
|
+
}
|
1253
|
+
function xo(e = {}) {
|
1254
|
+
return wo(e);
|
1255
|
+
}
|
1256
|
+
function Po(e, t, r) {
|
1257
|
+
return Eo(e, t, r);
|
1258
|
+
}
|
1259
|
+
function Ns(e = {}) {
|
1260
|
+
const [t, r] = Xn(xo, e);
|
1261
|
+
return Po(t, r, e);
|
1262
|
+
}
|
1263
|
+
function Ms(e = {}) {
|
1264
|
+
var t = e, {
|
1265
|
+
popover: r
|
1266
|
+
} = t, n = eo(t, [
|
1267
|
+
"popover"
|
1268
|
+
]);
|
1269
|
+
const o = Yn(
|
1270
|
+
n.store,
|
1271
|
+
Gn(r, [
|
1272
|
+
"arrowElement",
|
1273
|
+
"anchorElement",
|
1274
|
+
"contentElement",
|
1275
|
+
"popoverElement",
|
1276
|
+
"disclosureElement"
|
1277
|
+
])
|
1278
|
+
);
|
1279
|
+
tn(n, o);
|
1280
|
+
const i = o == null ? void 0 : o.getState(), s = xo(ve(te({}, n), { store: o })), u = U(
|
1281
|
+
n.placement,
|
1282
|
+
i == null ? void 0 : i.placement,
|
1283
|
+
"bottom"
|
1284
|
+
), a = ve(te({}, s.getState()), {
|
1285
|
+
placement: u,
|
1286
|
+
currentPlacement: u,
|
1287
|
+
anchorElement: U(i == null ? void 0 : i.anchorElement, null),
|
1288
|
+
popoverElement: U(i == null ? void 0 : i.popoverElement, null),
|
1289
|
+
arrowElement: U(i == null ? void 0 : i.arrowElement, null),
|
1290
|
+
rendered: Symbol("rendered")
|
1291
|
+
}), d = Ke(a, s, o);
|
1292
|
+
return ve(te(te({}, s), d), {
|
1293
|
+
setAnchorElement: (f) => d.setState("anchorElement", f),
|
1294
|
+
setPopoverElement: (f) => d.setState("popoverElement", f),
|
1295
|
+
setArrowElement: (f) => d.setState("arrowElement", f),
|
1296
|
+
render: () => d.setState("rendered", Symbol("rendered"))
|
1297
|
+
});
|
1298
|
+
}
|
1299
|
+
function ks(e, t, r) {
|
1300
|
+
return Jt(t, [r.popover]), pe(e, r, "placement"), Po(e, t, r);
|
1301
|
+
}
|
1302
|
+
function Vs(e = {}) {
|
1303
|
+
var t = e, {
|
1304
|
+
combobox: r
|
1305
|
+
} = t, n = eo(t, [
|
1306
|
+
"combobox"
|
1307
|
+
]);
|
1308
|
+
const o = Yn(
|
1309
|
+
n.store,
|
1310
|
+
Gn(r, [
|
1311
|
+
"value",
|
1312
|
+
"items",
|
1313
|
+
"renderedItems",
|
1314
|
+
"baseElement",
|
1315
|
+
"arrowElement",
|
1316
|
+
"anchorElement",
|
1317
|
+
"contentElement",
|
1318
|
+
"popoverElement",
|
1319
|
+
"disclosureElement"
|
1320
|
+
])
|
1321
|
+
);
|
1322
|
+
tn(n, o);
|
1323
|
+
const i = o.getState(), s = Ts(ve(te({}, n), {
|
1324
|
+
store: o,
|
1325
|
+
virtualFocus: U(
|
1326
|
+
n.virtualFocus,
|
1327
|
+
i.virtualFocus,
|
1328
|
+
!0
|
1329
|
+
),
|
1330
|
+
includesBaseElement: U(
|
1331
|
+
n.includesBaseElement,
|
1332
|
+
i.includesBaseElement,
|
1333
|
+
!1
|
1334
|
+
),
|
1335
|
+
activeId: U(
|
1336
|
+
n.activeId,
|
1337
|
+
i.activeId,
|
1338
|
+
n.defaultActiveId,
|
1339
|
+
null
|
1340
|
+
),
|
1341
|
+
orientation: U(
|
1342
|
+
n.orientation,
|
1343
|
+
i.orientation,
|
1344
|
+
"vertical"
|
1345
|
+
)
|
1346
|
+
})), u = Ms(ve(te({}, n), {
|
1347
|
+
store: o,
|
1348
|
+
placement: U(
|
1349
|
+
n.placement,
|
1350
|
+
i.placement,
|
1351
|
+
"bottom-start"
|
1352
|
+
)
|
1353
|
+
})), a = new String(""), d = ve(te(te({}, s.getState()), u.getState()), {
|
1354
|
+
value: U(
|
1355
|
+
n.value,
|
1356
|
+
i.value,
|
1357
|
+
n.defaultValue,
|
1358
|
+
a
|
1359
|
+
),
|
1360
|
+
setValueOnMove: U(
|
1361
|
+
n.setValueOnMove,
|
1362
|
+
i.setValueOnMove,
|
1363
|
+
!1
|
1364
|
+
),
|
1365
|
+
labelElement: U(i.labelElement, null),
|
1366
|
+
selectElement: U(i.selectElement, null),
|
1367
|
+
listElement: U(i.listElement, null)
|
1368
|
+
}), f = Ke(d, s, u, o);
|
1369
|
+
return Oe(
|
1370
|
+
f,
|
1371
|
+
() => $e(f, ["value", "items"], (c) => {
|
1372
|
+
if (c.value !== a || !c.items.length) return;
|
1373
|
+
const l = c.items.find(
|
1374
|
+
(p) => !p.disabled && p.value != null
|
1375
|
+
);
|
1376
|
+
(l == null ? void 0 : l.value) != null && f.setState("value", l.value);
|
1377
|
+
})
|
1378
|
+
), Oe(
|
1379
|
+
f,
|
1380
|
+
() => $e(f, ["mounted"], (c) => {
|
1381
|
+
c.mounted || f.setState("activeId", d.activeId);
|
1382
|
+
})
|
1383
|
+
), Oe(
|
1384
|
+
f,
|
1385
|
+
() => $e(f, ["mounted", "items", "value"], (c) => {
|
1386
|
+
if (r || c.mounted) return;
|
1387
|
+
const l = ho(c.value), p = l[l.length - 1];
|
1388
|
+
if (p == null) return;
|
1389
|
+
const b = c.items.find(
|
1390
|
+
(g) => !g.disabled && g.value === p
|
1391
|
+
);
|
1392
|
+
b && f.setState("activeId", b.id);
|
1393
|
+
})
|
1394
|
+
), Oe(
|
1395
|
+
f,
|
1396
|
+
() => Ut(f, ["setValueOnMove", "moves"], (c) => {
|
1397
|
+
const { mounted: l, value: p, activeId: b } = f.getState();
|
1398
|
+
if (!c.setValueOnMove && l || Array.isArray(p) || !c.moves || !b) return;
|
1399
|
+
const g = s.item(b);
|
1400
|
+
!g || g.disabled || g.value == null || f.setState("value", g.value);
|
1401
|
+
})
|
1402
|
+
), ve(te(te(te({}, s), u), f), {
|
1403
|
+
combobox: r,
|
1404
|
+
setValue: (c) => f.setState("value", c),
|
1405
|
+
setLabelElement: (c) => f.setState("labelElement", c),
|
1406
|
+
setSelectElement: (c) => f.setState("selectElement", c),
|
1407
|
+
setListElement: (c) => f.setState("listElement", c)
|
1408
|
+
});
|
1409
|
+
}
|
1410
|
+
function $s(e) {
|
1411
|
+
const t = vs();
|
1412
|
+
return e = $(O({}, e), {
|
1413
|
+
combobox: e.combobox !== void 0 ? e.combobox : t
|
1414
|
+
}), Ls(e);
|
1415
|
+
}
|
1416
|
+
function Bs(e, t, r) {
|
1417
|
+
return Jt(t, [r.combobox]), pe(e, r, "value", "setValue"), pe(e, r, "setValueOnMove"), Object.assign(
|
1418
|
+
ks(
|
1419
|
+
Rs(e, t, r),
|
1420
|
+
t,
|
1421
|
+
r
|
1422
|
+
),
|
1423
|
+
{ combobox: r.combobox }
|
1424
|
+
);
|
1425
|
+
}
|
1426
|
+
function Ks(e = {}) {
|
1427
|
+
e = $s(e);
|
1428
|
+
const [t, r] = Xn(Vs, e);
|
1429
|
+
return Bs(t, r, e);
|
1430
|
+
}
|
1431
|
+
var Lt = it(
|
1432
|
+
[po, Hn],
|
1433
|
+
[en, fo]
|
1434
|
+
), Io = Lt.useContext, Hs = Lt.useScopedContext, Jn = Lt.useProviderContext, Ws = Lt.ContextProvider, Co = Lt.ScopedContextProvider, zs = ge(!1), Er = ge(null), Oo = ge(!0), nn = "input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], summary, iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false'])";
|
1435
|
+
function Us(e) {
|
1436
|
+
return Number.parseInt(e.getAttribute("tabindex") || "0", 10) < 0;
|
1437
|
+
}
|
1438
|
+
function De(e) {
|
1439
|
+
return !(!e.matches(nn) || !ro(e) || e.closest("[inert]"));
|
1440
|
+
}
|
1441
|
+
function Ct(e) {
|
1442
|
+
if (!De(e) || Us(e)) return !1;
|
1443
|
+
if (!("form" in e) || !e.form || e.checked || e.type !== "radio") return !0;
|
1444
|
+
const t = e.form.elements.namedItem(e.name);
|
1445
|
+
if (!t || !("length" in t)) return !0;
|
1446
|
+
const r = We(e);
|
1447
|
+
return !r || r === e || !("form" in r) || r.form !== e.form || r.name !== e.name;
|
1448
|
+
}
|
1449
|
+
function Qn(e, t) {
|
1450
|
+
const r = Array.from(
|
1451
|
+
e.querySelectorAll(nn)
|
1452
|
+
);
|
1453
|
+
t && r.unshift(e);
|
1454
|
+
const n = r.filter(De);
|
1455
|
+
return n.forEach((o, i) => {
|
1456
|
+
if (Fn(o) && o.contentDocument) {
|
1457
|
+
const s = o.contentDocument.body;
|
1458
|
+
n.splice(i, 1, ...Qn(s));
|
1459
|
+
}
|
1460
|
+
}), n;
|
1461
|
+
}
|
1462
|
+
function rn(e, t, r) {
|
1463
|
+
const n = Array.from(
|
1464
|
+
e.querySelectorAll(nn)
|
1465
|
+
), o = n.filter(Ct);
|
1466
|
+
return t && Ct(e) && o.unshift(e), o.forEach((i, s) => {
|
1467
|
+
if (Fn(i) && i.contentDocument) {
|
1468
|
+
const u = i.contentDocument.body, a = rn(
|
1469
|
+
u,
|
1470
|
+
!1,
|
1471
|
+
r
|
1472
|
+
);
|
1473
|
+
o.splice(s, 1, ...a);
|
1474
|
+
}
|
1475
|
+
}), !o.length && r ? n : o;
|
1476
|
+
}
|
1477
|
+
function js(e, t, r) {
|
1478
|
+
const [n] = rn(
|
1479
|
+
e,
|
1480
|
+
t,
|
1481
|
+
r
|
1482
|
+
);
|
1483
|
+
return n || null;
|
1484
|
+
}
|
1485
|
+
function qs(e, t, r, n) {
|
1486
|
+
const o = We(e), i = Qn(e, t), s = i.indexOf(o), u = i.slice(s + 1);
|
1487
|
+
return u.find(Ct) || (r ? i.find(Ct) : null) || (n ? u[0] : null) || null;
|
1488
|
+
}
|
1489
|
+
function mn(e, t) {
|
1490
|
+
return qs(
|
1491
|
+
document.body,
|
1492
|
+
!1,
|
1493
|
+
e,
|
1494
|
+
t
|
1495
|
+
);
|
1496
|
+
}
|
1497
|
+
function Gs(e, t, r, n) {
|
1498
|
+
const o = We(e), i = Qn(e, t).reverse(), s = i.indexOf(o);
|
1499
|
+
return i.slice(s + 1).find(Ct) || null || null || null;
|
1500
|
+
}
|
1501
|
+
function xr(e, t) {
|
1502
|
+
return Gs(
|
1503
|
+
document.body,
|
1504
|
+
!1
|
1505
|
+
);
|
1506
|
+
}
|
1507
|
+
function Ys(e) {
|
1508
|
+
for (; e && !De(e); )
|
1509
|
+
e = e.closest(nn);
|
1510
|
+
return e || null;
|
1511
|
+
}
|
1512
|
+
function jt(e) {
|
1513
|
+
const t = We(e);
|
1514
|
+
if (!t) return !1;
|
1515
|
+
if (t === e) return !0;
|
1516
|
+
const r = t.getAttribute("aria-activedescendant");
|
1517
|
+
return r ? r === e.id : !1;
|
1518
|
+
}
|
1519
|
+
function _o(e) {
|
1520
|
+
const t = We(e);
|
1521
|
+
if (!t) return !1;
|
1522
|
+
if (se(e, t)) return !0;
|
1523
|
+
const r = t.getAttribute("aria-activedescendant");
|
1524
|
+
return !r || !("id" in e) ? !1 : r === e.id ? !0 : !!e.querySelector(`#${CSS.escape(r)}`);
|
1525
|
+
}
|
1526
|
+
function Do(e) {
|
1527
|
+
!_o(e) && De(e) && e.focus();
|
1528
|
+
}
|
1529
|
+
function Xs(e) {
|
1530
|
+
var t;
|
1531
|
+
const r = (t = e.getAttribute("tabindex")) != null ? t : "";
|
1532
|
+
e.setAttribute("data-tabindex", r), e.setAttribute("tabindex", "-1");
|
1533
|
+
}
|
1534
|
+
function Js(e, t) {
|
1535
|
+
const r = rn(e, t);
|
1536
|
+
for (const n of r)
|
1537
|
+
Xs(n);
|
1538
|
+
}
|
1539
|
+
function Qs(e) {
|
1540
|
+
const t = e.querySelectorAll("[data-tabindex]"), r = (n) => {
|
1541
|
+
const o = n.getAttribute("data-tabindex");
|
1542
|
+
n.removeAttribute("data-tabindex"), o ? n.setAttribute("tabindex", o) : n.removeAttribute("tabindex");
|
1543
|
+
};
|
1544
|
+
e.hasAttribute("data-tabindex") && r(e);
|
1545
|
+
for (const n of t)
|
1546
|
+
r(n);
|
1547
|
+
}
|
1548
|
+
function Zs(e, t) {
|
1549
|
+
"scrollIntoView" in e ? (e.focus({ preventScroll: !0 }), e.scrollIntoView(te({ block: "nearest", inline: "nearest" }, t))) : e.focus();
|
1550
|
+
}
|
1551
|
+
var eu = "div", Pr = kn(), tu = [
|
1552
|
+
"text",
|
1553
|
+
"search",
|
1554
|
+
"url",
|
1555
|
+
"tel",
|
1556
|
+
"email",
|
1557
|
+
"password",
|
1558
|
+
"number",
|
1559
|
+
"date",
|
1560
|
+
"month",
|
1561
|
+
"week",
|
1562
|
+
"time",
|
1563
|
+
"datetime",
|
1564
|
+
"datetime-local"
|
1565
|
+
], Ao = Symbol("safariFocusAncestor");
|
1566
|
+
function nu(e) {
|
1567
|
+
return e ? !!e[Ao] : !1;
|
1568
|
+
}
|
1569
|
+
function Ir(e, t) {
|
1570
|
+
e && (e[Ao] = t);
|
1571
|
+
}
|
1572
|
+
function ru(e) {
|
1573
|
+
const { tagName: t, readOnly: r, type: n } = e;
|
1574
|
+
return t === "TEXTAREA" && !r || t === "SELECT" && !r ? !0 : t === "INPUT" && !r ? tu.includes(n) : !!(e.isContentEditable || e.getAttribute("role") === "combobox" && e.dataset.name);
|
1575
|
+
}
|
1576
|
+
function ou(e) {
|
1577
|
+
return "labels" in e ? e.labels : null;
|
1578
|
+
}
|
1579
|
+
function Cr(e) {
|
1580
|
+
return e.tagName.toLowerCase() === "input" && e.type ? e.type === "radio" || e.type === "checkbox" : !1;
|
1581
|
+
}
|
1582
|
+
function iu(e) {
|
1583
|
+
return e ? e === "button" || e === "summary" || e === "input" || e === "select" || e === "textarea" || e === "a" : !0;
|
1584
|
+
}
|
1585
|
+
function su(e) {
|
1586
|
+
return e ? e === "button" || e === "input" || e === "select" || e === "textarea" : !0;
|
1587
|
+
}
|
1588
|
+
function uu(e, t, r, n, o) {
|
1589
|
+
return e ? t ? r && !n ? -1 : void 0 : r ? o : o || 0 : o;
|
1590
|
+
}
|
1591
|
+
function vn(e, t) {
|
1592
|
+
return j((r) => {
|
1593
|
+
e == null || e(r), !r.defaultPrevented && t && (r.stopPropagation(), r.preventDefault());
|
1594
|
+
});
|
1595
|
+
}
|
1596
|
+
var Zn = !0;
|
1597
|
+
function au(e) {
|
1598
|
+
const t = e.target;
|
1599
|
+
t && "hasAttribute" in t && (t.hasAttribute("data-focus-visible") || (Zn = !1));
|
1600
|
+
}
|
1601
|
+
function cu(e) {
|
1602
|
+
e.metaKey || e.ctrlKey || e.altKey || (Zn = !0);
|
1603
|
+
}
|
1604
|
+
var on = Z(
|
1605
|
+
function(t) {
|
1606
|
+
var r = t, {
|
1607
|
+
focusable: n = !0,
|
1608
|
+
accessibleWhenDisabled: o,
|
1609
|
+
autoFocus: i,
|
1610
|
+
onFocusVisible: s
|
1611
|
+
} = r, u = J(r, [
|
1612
|
+
"focusable",
|
1613
|
+
"accessibleWhenDisabled",
|
1614
|
+
"autoFocus",
|
1615
|
+
"onFocusVisible"
|
1616
|
+
]);
|
1617
|
+
const a = Y(null);
|
1618
|
+
W(() => {
|
1619
|
+
n && (Ce("mousedown", au, !0), Ce("keydown", cu, !0));
|
1620
|
+
}, [n]), Pr && W(() => {
|
1621
|
+
if (!n) return;
|
1622
|
+
const v = a.current;
|
1623
|
+
if (!v || !Cr(v)) return;
|
1624
|
+
const R = ou(v);
|
1625
|
+
if (!R) return;
|
1626
|
+
const K = () => queueMicrotask(() => v.focus());
|
1627
|
+
for (const x of R)
|
1628
|
+
x.addEventListener("mouseup", K);
|
1629
|
+
return () => {
|
1630
|
+
for (const x of R)
|
1631
|
+
x.removeEventListener("mouseup", K);
|
1632
|
+
};
|
1633
|
+
}, [n]);
|
1634
|
+
const d = n && Xt(u), f = !!d && !o, [c, l] = X(!1);
|
1635
|
+
W(() => {
|
1636
|
+
n && f && c && l(!1);
|
1637
|
+
}, [n, f, c]), W(() => {
|
1638
|
+
if (!n || !c) return;
|
1639
|
+
const v = a.current;
|
1640
|
+
if (!v || typeof IntersectionObserver > "u") return;
|
1641
|
+
const R = new IntersectionObserver(() => {
|
1642
|
+
De(v) || l(!1);
|
1643
|
+
});
|
1644
|
+
return R.observe(v), () => R.disconnect();
|
1645
|
+
}, [n, c]);
|
1646
|
+
const p = vn(
|
1647
|
+
u.onKeyPressCapture,
|
1648
|
+
d
|
1649
|
+
), b = vn(
|
1650
|
+
u.onMouseDownCapture,
|
1651
|
+
d
|
1652
|
+
), g = vn(u.onClickCapture, d), E = u.onMouseDown, w = j((v) => {
|
1653
|
+
if (E == null || E(v), v.defaultPrevented || !n) return;
|
1654
|
+
const R = v.currentTarget;
|
1655
|
+
if (!Pr || so(v) || !Xe(R) && !Cr(R)) return;
|
1656
|
+
let K = !1;
|
1657
|
+
const x = () => {
|
1658
|
+
K = !0;
|
1659
|
+
}, k = { capture: !0, once: !0 };
|
1660
|
+
R.addEventListener("focusin", x, k);
|
1661
|
+
const B = Ys(R.parentElement);
|
1662
|
+
Ir(B, !0), vt(R, "mouseup", () => {
|
1663
|
+
R.removeEventListener("focusin", x, !0), Ir(B, !1), !K && Do(R);
|
1664
|
+
});
|
1665
|
+
}), P = (v, R) => {
|
1666
|
+
if (R && (v.currentTarget = R), !n) return;
|
1667
|
+
const K = v.currentTarget;
|
1668
|
+
K && jt(K) && (s == null || s(v), !v.defaultPrevented && (K.dataset.focusVisible = "true", l(!0)));
|
1669
|
+
}, h = u.onKeyDownCapture, m = j((v) => {
|
1670
|
+
if (h == null || h(v), v.defaultPrevented || !n || c || v.metaKey || v.altKey || v.ctrlKey || !me(v)) return;
|
1671
|
+
const R = v.currentTarget;
|
1672
|
+
vt(R, "focusout", () => P(v, R));
|
1673
|
+
}), y = u.onFocusCapture, C = j((v) => {
|
1674
|
+
if (y == null || y(v), v.defaultPrevented || !n) return;
|
1675
|
+
if (!me(v)) {
|
1676
|
+
l(!1);
|
1677
|
+
return;
|
1678
|
+
}
|
1679
|
+
const R = v.currentTarget, K = () => P(v, R);
|
1680
|
+
Zn || ru(v.target) ? vt(v.target, "focusout", K) : l(!1);
|
1681
|
+
}), _ = u.onBlur, L = j((v) => {
|
1682
|
+
_ == null || _(v), n && pt(v) && l(!1);
|
1683
|
+
}), S = et(Oo), A = j((v) => {
|
1684
|
+
n && i && v && S && queueMicrotask(() => {
|
1685
|
+
jt(v) || De(v) && v.focus();
|
1686
|
+
});
|
1687
|
+
}), F = ao(a), N = n && iu(F), I = n && su(F), T = u.style, D = He(() => f ? O({ pointerEvents: "none" }, T) : T, [f, T]);
|
1688
|
+
return u = $(O({
|
1689
|
+
"data-focus-visible": n && c || void 0,
|
1690
|
+
"data-autofocus": i || void 0,
|
1691
|
+
"aria-disabled": d || void 0
|
1692
|
+
}, u), {
|
1693
|
+
ref: de(a, A, u.ref),
|
1694
|
+
style: D,
|
1695
|
+
tabIndex: uu(
|
1696
|
+
n,
|
1697
|
+
f,
|
1698
|
+
N,
|
1699
|
+
I,
|
1700
|
+
u.tabIndex
|
1701
|
+
),
|
1702
|
+
disabled: I && f ? !0 : void 0,
|
1703
|
+
// TODO: Test Focusable contentEditable.
|
1704
|
+
contentEditable: d ? void 0 : u.contentEditable,
|
1705
|
+
onKeyPressCapture: p,
|
1706
|
+
onClickCapture: g,
|
1707
|
+
onMouseDownCapture: b,
|
1708
|
+
onMouseDown: w,
|
1709
|
+
onKeyDownCapture: m,
|
1710
|
+
onFocusCapture: C,
|
1711
|
+
onBlur: L
|
1712
|
+
}), rt(u);
|
1713
|
+
}
|
1714
|
+
);
|
1715
|
+
G(function(t) {
|
1716
|
+
const r = on(t);
|
1717
|
+
return Q(eu, r);
|
1718
|
+
});
|
1719
|
+
var lu = "button";
|
1720
|
+
function Or(e) {
|
1721
|
+
if (!e.isTrusted) return !1;
|
1722
|
+
const t = e.currentTarget;
|
1723
|
+
return e.key === "Enter" ? Xe(t) || t.tagName === "SUMMARY" || t.tagName === "A" : e.key === " " ? Xe(t) || t.tagName === "SUMMARY" || t.tagName === "INPUT" || t.tagName === "SELECT" : !1;
|
1724
|
+
}
|
1725
|
+
var fu = Symbol("command"), er = Z(
|
1726
|
+
function(t) {
|
1727
|
+
var r = t, { clickOnEnter: n = !0, clickOnSpace: o = !0 } = r, i = J(r, ["clickOnEnter", "clickOnSpace"]);
|
1728
|
+
const s = Y(null), [u, a] = X(!1);
|
1729
|
+
W(() => {
|
1730
|
+
s.current && a(Xe(s.current));
|
1731
|
+
}, []);
|
1732
|
+
const [d, f] = X(!1), c = Y(!1), l = Xt(i), [p, b] = lo(i, fu, !0), g = i.onKeyDown, E = j((h) => {
|
1733
|
+
g == null || g(h);
|
1734
|
+
const m = h.currentTarget;
|
1735
|
+
if (h.defaultPrevented || p || l || !me(h) || ze(m) || m.isContentEditable) return;
|
1736
|
+
const y = n && h.key === "Enter", C = o && h.key === " ", _ = h.key === "Enter" && !n, L = h.key === " " && !o;
|
1737
|
+
if (_ || L) {
|
1738
|
+
h.preventDefault();
|
1739
|
+
return;
|
1740
|
+
}
|
1741
|
+
if (y || C) {
|
1742
|
+
const S = Or(h);
|
1743
|
+
if (y) {
|
1744
|
+
if (!S) {
|
1745
|
+
h.preventDefault();
|
1746
|
+
const A = h, F = J(A, ["view"]), N = () => mr(m, F);
|
1747
|
+
zi() ? vt(m, "keyup", N) : queueMicrotask(N);
|
1748
|
+
}
|
1749
|
+
} else C && (c.current = !0, S || (h.preventDefault(), f(!0)));
|
1750
|
+
}
|
1751
|
+
}), w = i.onKeyUp, P = j((h) => {
|
1752
|
+
if (w == null || w(h), h.defaultPrevented || p || l || h.metaKey) return;
|
1753
|
+
const m = o && h.key === " ";
|
1754
|
+
if (c.current && m && (c.current = !1, !Or(h))) {
|
1755
|
+
h.preventDefault(), f(!1);
|
1756
|
+
const y = h.currentTarget, C = h, _ = J(C, ["view"]);
|
1757
|
+
queueMicrotask(() => mr(y, _));
|
1758
|
+
}
|
1759
|
+
});
|
1760
|
+
return i = $(O(O({
|
1761
|
+
"data-active": d || void 0,
|
1762
|
+
type: u ? "button" : void 0
|
1763
|
+
}, b), i), {
|
1764
|
+
ref: de(s, i.ref),
|
1765
|
+
onKeyDown: E,
|
1766
|
+
onKeyUp: P
|
1767
|
+
}), i = on(i), i;
|
1768
|
+
}
|
1769
|
+
);
|
1770
|
+
G(function(t) {
|
1771
|
+
const r = er(t);
|
1772
|
+
return Q(lu, r);
|
1773
|
+
});
|
1774
|
+
var To = "button", Lo = Z(
|
1775
|
+
function(t) {
|
1776
|
+
const r = Y(null), n = ao(r, To), [o, i] = X(
|
1777
|
+
() => !!n && Xe({ tagName: n, type: t.type })
|
1778
|
+
);
|
1779
|
+
return W(() => {
|
1780
|
+
r.current && i(Xe(r.current));
|
1781
|
+
}, []), t = $(O({
|
1782
|
+
role: !o && n !== "a" ? "button" : void 0
|
1783
|
+
}, t), {
|
1784
|
+
ref: de(r, t.ref)
|
1785
|
+
}), t = er(t), t;
|
1786
|
+
}
|
1787
|
+
);
|
1788
|
+
G(function(t) {
|
1789
|
+
const r = Lo(t);
|
1790
|
+
return Q(To, r);
|
1791
|
+
});
|
1792
|
+
var du = "button", pu = Symbol("disclosure"), Ro = Z(
|
1793
|
+
function(t) {
|
1794
|
+
var r = t, { store: n, toggleOnClick: o = !0 } = r, i = J(r, ["store", "toggleOnClick"]);
|
1795
|
+
const s = Wn();
|
1796
|
+
n = n || s, he(
|
1797
|
+
n,
|
1798
|
+
process.env.NODE_ENV !== "production" && "Disclosure must receive a `store` prop or be wrapped in a DisclosureProvider component."
|
1799
|
+
);
|
1800
|
+
const u = Y(null), [a, d] = X(!1), f = n.useState("disclosureElement"), c = n.useState("open");
|
1801
|
+
W(() => {
|
1802
|
+
let P = f === u.current;
|
1803
|
+
f != null && f.isConnected || (n == null || n.setDisclosureElement(u.current), P = !0), d(c && P);
|
1804
|
+
}, [f, n, c]);
|
1805
|
+
const l = i.onClick, p = fe(o), [b, g] = lo(i, pu, !0), E = j((P) => {
|
1806
|
+
l == null || l(P), !P.defaultPrevented && (b || p(P) && (n == null || n.setDisclosureElement(P.currentTarget), n == null || n.toggle()));
|
1807
|
+
}), w = n.useState("contentElement");
|
1808
|
+
return i = $(O(O({
|
1809
|
+
"aria-expanded": a,
|
1810
|
+
"aria-controls": w == null ? void 0 : w.id
|
1811
|
+
}, g), i), {
|
1812
|
+
ref: de(u, i.ref),
|
1813
|
+
onClick: E
|
1814
|
+
}), i = Lo(i), i;
|
1815
|
+
}
|
1816
|
+
);
|
1817
|
+
G(function(t) {
|
1818
|
+
const r = Ro(t);
|
1819
|
+
return Q(du, r);
|
1820
|
+
});
|
1821
|
+
var mu = "button", Fo = Z(
|
1822
|
+
function(t) {
|
1823
|
+
var r = t, { store: n } = r, o = J(r, ["store"]);
|
1824
|
+
const i = Qt();
|
1825
|
+
n = n || i, he(
|
1826
|
+
n,
|
1827
|
+
process.env.NODE_ENV !== "production" && "DialogDisclosure must receive a `store` prop or be wrapped in a DialogProvider component."
|
1828
|
+
);
|
1829
|
+
const s = n.useState("contentElement");
|
1830
|
+
return o = O({
|
1831
|
+
"aria-haspopup": Nn(s, "dialog")
|
1832
|
+
}, o), o = Ro(O({ store: n }, o)), o;
|
1833
|
+
}
|
1834
|
+
);
|
1835
|
+
G(function(t) {
|
1836
|
+
const r = Fo(t);
|
1837
|
+
return Q(mu, r);
|
1838
|
+
});
|
1839
|
+
var vu = "div", No = Z(
|
1840
|
+
function(t) {
|
1841
|
+
var r = t, { store: n } = r, o = J(r, ["store"]);
|
1842
|
+
const i = Zt();
|
1843
|
+
return n = n || i, o = $(O({}, o), {
|
1844
|
+
ref: de(n == null ? void 0 : n.setAnchorElement, o.ref)
|
1845
|
+
}), o;
|
1846
|
+
}
|
1847
|
+
);
|
1848
|
+
G(function(t) {
|
1849
|
+
const r = No(t);
|
1850
|
+
return Q(vu, r);
|
1851
|
+
});
|
1852
|
+
var gu = "button", Mo = Z(function(t) {
|
1853
|
+
var r = t, { store: n } = r, o = J(r, ["store"]);
|
1854
|
+
const i = Zt();
|
1855
|
+
n = n || i, he(
|
1856
|
+
n,
|
1857
|
+
process.env.NODE_ENV !== "production" && "PopoverDisclosure must receive a `store` prop or be wrapped in a PopoverProvider component."
|
1858
|
+
);
|
1859
|
+
const s = o.onClick, u = j((a) => {
|
1860
|
+
n == null || n.setAnchorElement(a.currentTarget), s == null || s(a);
|
1861
|
+
});
|
1862
|
+
return o = le(
|
1863
|
+
o,
|
1864
|
+
(a) => /* @__PURE__ */ M(en, { value: n, children: a }),
|
1865
|
+
[n]
|
1866
|
+
), o = $(O({}, o), {
|
1867
|
+
onClick: u
|
1868
|
+
}), o = No(O({ store: n }, o)), o = Fo(O({ store: n }, o)), o;
|
1869
|
+
});
|
1870
|
+
G(function(t) {
|
1871
|
+
const r = Mo(t);
|
1872
|
+
return Q(gu, r);
|
1873
|
+
});
|
1874
|
+
var hu = "span", bu = {
|
1875
|
+
top: "4,10 8,6 12,10",
|
1876
|
+
right: "6,4 10,8 6,12",
|
1877
|
+
bottom: "4,6 8,10 12,6",
|
1878
|
+
left: "10,4 6,8 10,12"
|
1879
|
+
}, ko = Z(function(t) {
|
1880
|
+
var r = t, { store: n, placement: o } = r, i = J(r, ["store", "placement"]);
|
1881
|
+
const s = ps();
|
1882
|
+
n = n || s, he(
|
1883
|
+
n,
|
1884
|
+
process.env.NODE_ENV !== "production" && "PopoverDisclosureArrow must be wrapped in a PopoverDisclosure component."
|
1885
|
+
);
|
1886
|
+
const a = n.useState((c) => o || c.placement).split("-")[0], d = bu[a], f = He(
|
1887
|
+
() => /* @__PURE__ */ M(
|
1888
|
+
"svg",
|
1889
|
+
{
|
1890
|
+
display: "block",
|
1891
|
+
fill: "none",
|
1892
|
+
stroke: "currentColor",
|
1893
|
+
strokeLinecap: "round",
|
1894
|
+
strokeLinejoin: "round",
|
1895
|
+
strokeWidth: 1.5,
|
1896
|
+
viewBox: "0 0 16 16",
|
1897
|
+
height: "1em",
|
1898
|
+
width: "1em",
|
1899
|
+
children: /* @__PURE__ */ M("polyline", { points: d })
|
1900
|
+
}
|
1901
|
+
),
|
1902
|
+
[d]
|
1903
|
+
);
|
1904
|
+
return i = $(O({
|
1905
|
+
children: f,
|
1906
|
+
"aria-hidden": !0
|
1907
|
+
}, i), {
|
1908
|
+
style: O({
|
1909
|
+
width: "1em",
|
1910
|
+
height: "1em",
|
1911
|
+
pointerEvents: "none"
|
1912
|
+
}, i.style)
|
1913
|
+
}), rt(i);
|
1914
|
+
});
|
1915
|
+
G(
|
1916
|
+
function(t) {
|
1917
|
+
const r = ko(t);
|
1918
|
+
return Q(hu, r);
|
1919
|
+
}
|
1920
|
+
);
|
1921
|
+
var yu = "span", Su = Z(
|
1922
|
+
function(t) {
|
1923
|
+
var r = t, { store: n } = r, o = J(r, ["store"]);
|
1924
|
+
const i = Io();
|
1925
|
+
return n = n || i, o = ko(O({ store: n }, o)), o;
|
1926
|
+
}
|
1927
|
+
), wu = G(function(t) {
|
1928
|
+
const r = Su(t);
|
1929
|
+
return Q(yu, r);
|
1930
|
+
}), Eu = { id: null };
|
1931
|
+
function xu(e, t, r = !1) {
|
1932
|
+
const n = e.findIndex((o) => o.id === t);
|
1933
|
+
return [
|
1934
|
+
...e.slice(n + 1),
|
1935
|
+
...r ? [Eu] : [],
|
1936
|
+
...e.slice(0, n)
|
1937
|
+
];
|
1938
|
+
}
|
1939
|
+
function Pu(e, t) {
|
1940
|
+
return e.find((r) => !r.disabled);
|
1941
|
+
}
|
1942
|
+
function Ge(e, t) {
|
1943
|
+
return t && e.item(t) || null;
|
1944
|
+
}
|
1945
|
+
function Iu(e) {
|
1946
|
+
const t = [];
|
1947
|
+
for (const r of e) {
|
1948
|
+
const n = t.find((o) => {
|
1949
|
+
var i;
|
1950
|
+
return ((i = o[0]) == null ? void 0 : i.rowId) === r.rowId;
|
1951
|
+
});
|
1952
|
+
n ? n.push(r) : t.push([r]);
|
1953
|
+
}
|
1954
|
+
return t;
|
1955
|
+
}
|
1956
|
+
function Cu(e, t = !1) {
|
1957
|
+
if (ze(e))
|
1958
|
+
e.setSelectionRange(
|
1959
|
+
t ? e.value.length : 0,
|
1960
|
+
e.value.length
|
1961
|
+
);
|
1962
|
+
else if (e.isContentEditable) {
|
1963
|
+
const r = ne(e).getSelection();
|
1964
|
+
r == null || r.selectAllChildren(e), t && (r == null || r.collapseToEnd());
|
1965
|
+
}
|
1966
|
+
}
|
1967
|
+
var In = Symbol("FOCUS_SILENTLY");
|
1968
|
+
function Ou(e) {
|
1969
|
+
e[In] = !0, e.focus({ preventScroll: !0 });
|
1970
|
+
}
|
1971
|
+
function _u(e) {
|
1972
|
+
const t = e[In];
|
1973
|
+
return delete e[In], t;
|
1974
|
+
}
|
1975
|
+
function xt(e, t, r) {
|
1976
|
+
return !(!t || t === r || !e.item(t.id));
|
1977
|
+
}
|
1978
|
+
var Du = "div", Ve = "";
|
1979
|
+
function gn() {
|
1980
|
+
Ve = "";
|
1981
|
+
}
|
1982
|
+
function Au(e) {
|
1983
|
+
const t = e.target;
|
1984
|
+
return t && ze(t) ? !1 : e.key === " " && Ve.length ? !0 : e.key.length === 1 && !e.ctrlKey && !e.altKey && !e.metaKey && /^[\p{Letter}\p{Number}]$/u.test(e.key);
|
1985
|
+
}
|
1986
|
+
function Tu(e, t) {
|
1987
|
+
if (me(e)) return !0;
|
1988
|
+
const r = e.target;
|
1989
|
+
return r ? t.some((o) => o.element === r) : !1;
|
1990
|
+
}
|
1991
|
+
function Lu(e) {
|
1992
|
+
return e.filter((t) => !t.disabled);
|
1993
|
+
}
|
1994
|
+
function Ht(e, t) {
|
1995
|
+
var r;
|
1996
|
+
const n = ((r = e.element) == null ? void 0 : r.textContent) || e.children || // The composite item object itself doesn't include a value property, but
|
1997
|
+
// other components like Select do. Since CompositeTypeahead is a generic
|
1998
|
+
// component that can be used with those as well, we also consider the value
|
1999
|
+
// property as a fallback for the typeahead text content.
|
2000
|
+
"value" in e && e.value;
|
2001
|
+
return n ? Ai(n).trim().toLowerCase().startsWith(t.toLowerCase()) : !1;
|
2002
|
+
}
|
2003
|
+
function Ru(e, t, r) {
|
2004
|
+
if (!r) return e;
|
2005
|
+
const n = e.find((o) => o.id === r);
|
2006
|
+
return !n || !Ht(n, t) || Ve !== t && Ht(n, Ve) ? e : (Ve = t, xu(
|
2007
|
+
e.filter((o) => Ht(o, Ve)),
|
2008
|
+
r
|
2009
|
+
).filter((o) => o.id !== r));
|
2010
|
+
}
|
2011
|
+
var tr = Z(function(t) {
|
2012
|
+
var r = t, { store: n, typeahead: o = !0 } = r, i = J(r, ["store", "typeahead"]);
|
2013
|
+
const s = Kn();
|
2014
|
+
n = n || s, he(
|
2015
|
+
n,
|
2016
|
+
process.env.NODE_ENV !== "production" && "CompositeTypeahead must be a Composite component"
|
2017
|
+
);
|
2018
|
+
const u = i.onKeyDownCapture, a = Y(0), d = j((f) => {
|
2019
|
+
if (u == null || u(f), f.defaultPrevented || !o || !n) return;
|
2020
|
+
if (!Au(f))
|
2021
|
+
return gn();
|
2022
|
+
const { renderedItems: c, items: l, activeId: p, id: b } = n.getState();
|
2023
|
+
let g = Lu(
|
2024
|
+
l.length > c.length ? l : c
|
2025
|
+
);
|
2026
|
+
const E = ne(f.currentTarget), w = `[data-offscreen-id="${b}"]`, P = E.querySelectorAll(w);
|
2027
|
+
for (const y of P) {
|
2028
|
+
const C = y.ariaDisabled === "true" || "disabled" in y && !!y.disabled;
|
2029
|
+
g.push({ id: y.id, element: y, disabled: C });
|
2030
|
+
}
|
2031
|
+
if (P.length && (g = io(g, (y) => y.element)), !Tu(f, g)) return gn();
|
2032
|
+
f.preventDefault(), window.clearTimeout(a.current), a.current = window.setTimeout(() => {
|
2033
|
+
Ve = "";
|
2034
|
+
}, 500);
|
2035
|
+
const h = f.key.toLowerCase();
|
2036
|
+
Ve += h, g = Ru(g, h, p);
|
2037
|
+
const m = g.find((y) => Ht(y, Ve));
|
2038
|
+
m ? n.move(m.id) : gn();
|
2039
|
+
});
|
2040
|
+
return i = $(O({}, i), {
|
2041
|
+
onKeyDownCapture: d
|
2042
|
+
}), rt(i);
|
2043
|
+
});
|
2044
|
+
G(function(t) {
|
2045
|
+
const r = tr(t);
|
2046
|
+
return Q(Du, r);
|
2047
|
+
});
|
2048
|
+
var Fu = "button";
|
2049
|
+
function Nu(e) {
|
2050
|
+
return Array.from(e.selectedOptions).map((t) => t.value);
|
2051
|
+
}
|
2052
|
+
function Vt(e, t) {
|
2053
|
+
return () => {
|
2054
|
+
const r = t();
|
2055
|
+
if (!r) return;
|
2056
|
+
let n = 0, o = e.item(r);
|
2057
|
+
const i = o;
|
2058
|
+
for (; o && o.value == null; ) {
|
2059
|
+
const s = t(++n);
|
2060
|
+
if (!s) return;
|
2061
|
+
if (o = e.item(s), o === i) break;
|
2062
|
+
}
|
2063
|
+
return o == null ? void 0 : o.id;
|
2064
|
+
};
|
2065
|
+
}
|
2066
|
+
var Mu = Z(function(t) {
|
2067
|
+
var r = t, {
|
2068
|
+
store: n,
|
2069
|
+
name: o,
|
2070
|
+
form: i,
|
2071
|
+
required: s,
|
2072
|
+
showOnKeyDown: u = !0,
|
2073
|
+
moveOnKeyDown: a = !0,
|
2074
|
+
toggleOnPress: d = !0,
|
2075
|
+
toggleOnClick: f = d
|
2076
|
+
} = r, c = J(r, [
|
2077
|
+
"store",
|
2078
|
+
"name",
|
2079
|
+
"form",
|
2080
|
+
"required",
|
2081
|
+
"showOnKeyDown",
|
2082
|
+
"moveOnKeyDown",
|
2083
|
+
"toggleOnPress",
|
2084
|
+
"toggleOnClick"
|
2085
|
+
]);
|
2086
|
+
const l = Jn();
|
2087
|
+
n = n || l, he(
|
2088
|
+
n,
|
2089
|
+
process.env.NODE_ENV !== "production" && "Select must receive a `store` prop or be wrapped in a SelectProvider component."
|
2090
|
+
);
|
2091
|
+
const p = c.onKeyDown, b = fe(u), g = fe(a), w = n.useState("placement").split("-")[0], P = n.useState("value"), h = Array.isArray(P), m = j((D) => {
|
2092
|
+
var v;
|
2093
|
+
if (p == null || p(D), D.defaultPrevented || !n) return;
|
2094
|
+
const { orientation: R, items: K, activeId: x } = n.getState(), k = R !== "horizontal", B = R !== "vertical", H = !!((v = K.find((ue) => !ue.disabled && ue.value != null)) != null && v.rowId), oe = {
|
2095
|
+
ArrowUp: (H || k) && Vt(n, n.up),
|
2096
|
+
ArrowRight: (H || B) && Vt(n, n.next),
|
2097
|
+
ArrowDown: (H || k) && Vt(n, n.down),
|
2098
|
+
ArrowLeft: (H || B) && Vt(n, n.previous)
|
2099
|
+
}[D.key];
|
2100
|
+
oe && g(D) && (D.preventDefault(), n.move(oe()));
|
2101
|
+
const re = w === "top" || w === "bottom";
|
2102
|
+
({
|
2103
|
+
ArrowDown: re,
|
2104
|
+
ArrowUp: re,
|
2105
|
+
ArrowLeft: w === "left",
|
2106
|
+
ArrowRight: w === "right"
|
2107
|
+
})[D.key] && b(D) && (D.preventDefault(), n.move(x), vt(D.currentTarget, "keyup", n.show));
|
2108
|
+
});
|
2109
|
+
c = le(
|
2110
|
+
c,
|
2111
|
+
(D) => /* @__PURE__ */ M(Co, { value: n, children: D }),
|
2112
|
+
[n]
|
2113
|
+
);
|
2114
|
+
const [y, C] = X(!1), _ = Y(!1);
|
2115
|
+
W(() => {
|
2116
|
+
const D = _.current;
|
2117
|
+
_.current = !1, !D && C(!1);
|
2118
|
+
}, [P]);
|
2119
|
+
const L = n.useState((D) => {
|
2120
|
+
var v;
|
2121
|
+
return (v = D.labelElement) == null ? void 0 : v.id;
|
2122
|
+
}), S = c["aria-label"], A = c["aria-labelledby"] || L, F = n.useState((D) => {
|
2123
|
+
if (o)
|
2124
|
+
return D.items;
|
2125
|
+
}), N = He(() => [...new Set(F == null ? void 0 : F.map((D) => D.value).filter((D) => D != null))], [F]);
|
2126
|
+
c = le(
|
2127
|
+
c,
|
2128
|
+
(D) => o ? /* @__PURE__ */ Fe(mt, { children: [
|
2129
|
+
/* @__PURE__ */ Fe(
|
2130
|
+
"select",
|
2131
|
+
{
|
2132
|
+
style: {
|
2133
|
+
border: 0,
|
2134
|
+
clip: "rect(0 0 0 0)",
|
2135
|
+
height: "1px",
|
2136
|
+
margin: "-1px",
|
2137
|
+
overflow: "hidden",
|
2138
|
+
padding: 0,
|
2139
|
+
position: "absolute",
|
2140
|
+
whiteSpace: "nowrap",
|
2141
|
+
width: "1px"
|
2142
|
+
},
|
2143
|
+
tabIndex: -1,
|
2144
|
+
"aria-hidden": !0,
|
2145
|
+
"aria-label": S,
|
2146
|
+
"aria-labelledby": A,
|
2147
|
+
name: o,
|
2148
|
+
form: i,
|
2149
|
+
required: s,
|
2150
|
+
value: P,
|
2151
|
+
multiple: h,
|
2152
|
+
onFocus: () => {
|
2153
|
+
var v;
|
2154
|
+
return (v = n == null ? void 0 : n.getState().selectElement) == null ? void 0 : v.focus();
|
2155
|
+
},
|
2156
|
+
onChange: (v) => {
|
2157
|
+
_.current = !0, C(!0), n == null || n.setValue(
|
2158
|
+
h ? Nu(v.target) : v.target.value
|
2159
|
+
);
|
2160
|
+
},
|
2161
|
+
children: [
|
2162
|
+
ho(P).map((v) => v == null || N.includes(v) ? null : /* @__PURE__ */ M("option", { value: v, children: v }, v)),
|
2163
|
+
N.map((v) => /* @__PURE__ */ M("option", { value: v, children: v }, v))
|
2164
|
+
]
|
2165
|
+
}
|
2166
|
+
),
|
2167
|
+
D
|
2168
|
+
] }) : D,
|
2169
|
+
[
|
2170
|
+
n,
|
2171
|
+
S,
|
2172
|
+
A,
|
2173
|
+
o,
|
2174
|
+
i,
|
2175
|
+
s,
|
2176
|
+
P,
|
2177
|
+
h,
|
2178
|
+
N
|
2179
|
+
]
|
2180
|
+
);
|
2181
|
+
const I = /* @__PURE__ */ Fe(mt, { children: [
|
2182
|
+
P,
|
2183
|
+
/* @__PURE__ */ M(wu, {})
|
2184
|
+
] }), T = n.useState("contentElement");
|
2185
|
+
return c = $(O({
|
2186
|
+
role: "combobox",
|
2187
|
+
"aria-autocomplete": "none",
|
2188
|
+
"aria-labelledby": L,
|
2189
|
+
"aria-haspopup": Nn(T, "listbox"),
|
2190
|
+
"data-autofill": y || void 0,
|
2191
|
+
"data-name": o,
|
2192
|
+
children: I
|
2193
|
+
}, c), {
|
2194
|
+
ref: de(n.setSelectElement, c.ref),
|
2195
|
+
onKeyDown: m
|
2196
|
+
}), c = Mo(O({ store: n, toggleOnClick: f }, c)), c = tr(O({ store: n }, c)), c;
|
2197
|
+
}), ku = G(function(t) {
|
2198
|
+
const r = Mu(t);
|
2199
|
+
return Q(Fu, r);
|
2200
|
+
});
|
2201
|
+
function Vu(e = {}) {
|
2202
|
+
const t = Ks(e);
|
2203
|
+
return /* @__PURE__ */ M(Ws, { value: t, children: e.children });
|
2204
|
+
}
|
2205
|
+
var _r = ge(0), $u = "div";
|
2206
|
+
function Vo(e) {
|
2207
|
+
const t = e.relatedTarget;
|
2208
|
+
return (t == null ? void 0 : t.nodeType) === Node.ELEMENT_NODE ? t : null;
|
2209
|
+
}
|
2210
|
+
function Bu(e) {
|
2211
|
+
const t = Vo(e);
|
2212
|
+
return t ? se(e.currentTarget, t) : !1;
|
2213
|
+
}
|
2214
|
+
var Cn = Symbol("composite-hover");
|
2215
|
+
function Ku(e) {
|
2216
|
+
let t = Vo(e);
|
2217
|
+
if (!t) return !1;
|
2218
|
+
do {
|
2219
|
+
if (Ne(t, Cn) && t[Cn]) return !0;
|
2220
|
+
t = t.parentElement;
|
2221
|
+
} while (t);
|
2222
|
+
return !1;
|
2223
|
+
}
|
2224
|
+
var $o = Z(
|
2225
|
+
function(t) {
|
2226
|
+
var r = t, {
|
2227
|
+
store: n,
|
2228
|
+
focusOnHover: o = !0,
|
2229
|
+
blurOnHoverEnd: i = !!o
|
2230
|
+
} = r, s = J(r, [
|
2231
|
+
"store",
|
2232
|
+
"focusOnHover",
|
2233
|
+
"blurOnHoverEnd"
|
2234
|
+
]);
|
2235
|
+
const u = Kn();
|
2236
|
+
n = n || u, he(
|
2237
|
+
n,
|
2238
|
+
process.env.NODE_ENV !== "production" && "CompositeHover must be wrapped in a Composite component."
|
2239
|
+
);
|
2240
|
+
const a = Zi(), d = s.onMouseMove, f = fe(o), c = j((E) => {
|
2241
|
+
if (d == null || d(E), !E.defaultPrevented && a() && f(E)) {
|
2242
|
+
if (!_o(E.currentTarget)) {
|
2243
|
+
const w = n == null ? void 0 : n.getState().baseElement;
|
2244
|
+
w && !jt(w) && w.focus();
|
2245
|
+
}
|
2246
|
+
n == null || n.setActiveId(E.currentTarget.id);
|
2247
|
+
}
|
2248
|
+
}), l = s.onMouseLeave, p = fe(i), b = j((E) => {
|
2249
|
+
var w;
|
2250
|
+
l == null || l(E), !E.defaultPrevented && a() && (Bu(E) || Ku(E) || f(E) && p(E) && (n == null || n.setActiveId(null), (w = n == null ? void 0 : n.getState().baseElement) == null || w.focus()));
|
2251
|
+
}), g = xe((E) => {
|
2252
|
+
E && (E[Cn] = !0);
|
2253
|
+
}, []);
|
2254
|
+
return s = $(O({}, s), {
|
2255
|
+
ref: de(g, s.ref),
|
2256
|
+
onMouseMove: c,
|
2257
|
+
onMouseLeave: b
|
2258
|
+
}), rt(s);
|
2259
|
+
}
|
2260
|
+
);
|
2261
|
+
Bn(
|
2262
|
+
G(function(t) {
|
2263
|
+
const r = $o(t);
|
2264
|
+
return Q($u, r);
|
2265
|
+
})
|
2266
|
+
);
|
2267
|
+
var Hu = "div", Bo = Z(
|
2268
|
+
function(t) {
|
2269
|
+
var r = t, {
|
2270
|
+
store: n,
|
2271
|
+
shouldRegisterItem: o = !0,
|
2272
|
+
getItem: i = to,
|
2273
|
+
element: s
|
2274
|
+
} = r, u = J(r, [
|
2275
|
+
"store",
|
2276
|
+
"shouldRegisterItem",
|
2277
|
+
"getItem",
|
2278
|
+
// @ts-expect-error This prop may come from a collection renderer.
|
2279
|
+
"element"
|
2280
|
+
]);
|
2281
|
+
const a = ns();
|
2282
|
+
n = n || a;
|
2283
|
+
const d = ot(u.id), f = Y(s);
|
2284
|
+
return W(() => {
|
2285
|
+
const c = f.current;
|
2286
|
+
if (!d || !c || !o) return;
|
2287
|
+
const l = i({ id: d, element: c });
|
2288
|
+
return n == null ? void 0 : n.renderItem(l);
|
2289
|
+
}, [d, o, i, n]), u = $(O({}, u), {
|
2290
|
+
ref: de(f, u.ref)
|
2291
|
+
}), rt(u);
|
2292
|
+
}
|
2293
|
+
);
|
2294
|
+
G(function(t) {
|
2295
|
+
const r = Bo(t);
|
2296
|
+
return Q(Hu, r);
|
2297
|
+
});
|
2298
|
+
var Wu = "button";
|
2299
|
+
function zu(e) {
|
2300
|
+
return En(e) ? !0 : e.tagName === "INPUT" && !Xe(e);
|
2301
|
+
}
|
2302
|
+
function Uu(e, t = !1) {
|
2303
|
+
const r = e.clientHeight, { top: n } = e.getBoundingClientRect(), o = Math.max(r * 0.875, r - 40) * 1.5, i = t ? r - o + n : o + n;
|
2304
|
+
return e.tagName === "HTML" ? i + e.scrollTop : i;
|
2305
|
+
}
|
2306
|
+
function ju(e, t = !1) {
|
2307
|
+
const { top: r } = e.getBoundingClientRect();
|
2308
|
+
return t ? r + e.clientHeight : r;
|
2309
|
+
}
|
2310
|
+
function Dr(e, t, r, n = !1) {
|
2311
|
+
var o;
|
2312
|
+
if (!t || !r) return;
|
2313
|
+
const { renderedItems: i } = t.getState(), s = oo(e);
|
2314
|
+
if (!s) return;
|
2315
|
+
const u = Uu(s, n);
|
2316
|
+
let a, d;
|
2317
|
+
for (let f = 0; f < i.length; f += 1) {
|
2318
|
+
const c = a;
|
2319
|
+
if (a = r(f), !a) break;
|
2320
|
+
if (a === c) continue;
|
2321
|
+
const l = (o = Ge(t, a)) == null ? void 0 : o.element;
|
2322
|
+
if (!l) continue;
|
2323
|
+
const b = ju(l, n) - u, g = Math.abs(b);
|
2324
|
+
if (n && b <= 0 || !n && b >= 0) {
|
2325
|
+
d !== void 0 && d < g && (a = c);
|
2326
|
+
break;
|
2327
|
+
}
|
2328
|
+
d = g;
|
2329
|
+
}
|
2330
|
+
return a;
|
2331
|
+
}
|
2332
|
+
function qu(e, t) {
|
2333
|
+
return me(e) ? !1 : xt(t, e.target);
|
2334
|
+
}
|
2335
|
+
var Ko = Z(
|
2336
|
+
function(t) {
|
2337
|
+
var r = t, {
|
2338
|
+
store: n,
|
2339
|
+
rowId: o,
|
2340
|
+
preventScrollOnKeyDown: i = !1,
|
2341
|
+
moveOnKeyPress: s = !0,
|
2342
|
+
tabbable: u = !1,
|
2343
|
+
getItem: a,
|
2344
|
+
"aria-setsize": d,
|
2345
|
+
"aria-posinset": f
|
2346
|
+
} = r, c = J(r, [
|
2347
|
+
"store",
|
2348
|
+
"rowId",
|
2349
|
+
"preventScrollOnKeyDown",
|
2350
|
+
"moveOnKeyPress",
|
2351
|
+
"tabbable",
|
2352
|
+
"getItem",
|
2353
|
+
"aria-setsize",
|
2354
|
+
"aria-posinset"
|
2355
|
+
]);
|
2356
|
+
const l = Kn();
|
2357
|
+
n = n || l;
|
2358
|
+
const p = ot(c.id), b = Y(null), g = et(us), w = Xt(c) && !c.accessibleWhenDisabled, {
|
2359
|
+
rowId: P,
|
2360
|
+
baseElement: h,
|
2361
|
+
isActiveItem: m,
|
2362
|
+
ariaSetSize: y,
|
2363
|
+
ariaPosInSet: C,
|
2364
|
+
isTabbable: _
|
2365
|
+
} = go(n, {
|
2366
|
+
rowId(x) {
|
2367
|
+
if (o) return o;
|
2368
|
+
if (x && g != null && g.baseElement && g.baseElement === x.baseElement)
|
2369
|
+
return g.id;
|
2370
|
+
},
|
2371
|
+
baseElement(x) {
|
2372
|
+
return (x == null ? void 0 : x.baseElement) || void 0;
|
2373
|
+
},
|
2374
|
+
isActiveItem(x) {
|
2375
|
+
return !!x && x.activeId === p;
|
2376
|
+
},
|
2377
|
+
ariaSetSize(x) {
|
2378
|
+
if (d != null) return d;
|
2379
|
+
if (x && g != null && g.ariaSetSize && g.baseElement === x.baseElement)
|
2380
|
+
return g.ariaSetSize;
|
2381
|
+
},
|
2382
|
+
ariaPosInSet(x) {
|
2383
|
+
if (f != null) return f;
|
2384
|
+
if (!x || !(g != null && g.ariaPosInSet) || g.baseElement !== x.baseElement) return;
|
2385
|
+
const k = x.renderedItems.filter(
|
2386
|
+
(B) => B.rowId === P
|
2387
|
+
);
|
2388
|
+
return g.ariaPosInSet + k.findIndex((B) => B.id === p);
|
2389
|
+
},
|
2390
|
+
isTabbable(x) {
|
2391
|
+
if (!(x != null && x.renderedItems.length)) return !0;
|
2392
|
+
if (x.virtualFocus) return !1;
|
2393
|
+
if (u) return !0;
|
2394
|
+
if (x.activeId === null) return !1;
|
2395
|
+
const k = n == null ? void 0 : n.item(x.activeId);
|
2396
|
+
return k != null && k.disabled || !(k != null && k.element) ? !0 : x.activeId === p;
|
2397
|
+
}
|
2398
|
+
}), L = xe(
|
2399
|
+
(x) => {
|
2400
|
+
var k;
|
2401
|
+
const B = $(O({}, x), {
|
2402
|
+
id: p || x.id,
|
2403
|
+
rowId: P,
|
2404
|
+
disabled: !!w,
|
2405
|
+
children: (k = x.element) == null ? void 0 : k.textContent
|
2406
|
+
});
|
2407
|
+
return a ? a(B) : B;
|
2408
|
+
},
|
2409
|
+
[p, P, w, a]
|
2410
|
+
), S = c.onFocus, A = Y(!1), F = j((x) => {
|
2411
|
+
if (S == null || S(x), x.defaultPrevented || so(x) || !p || !n || qu(x, n)) return;
|
2412
|
+
const { virtualFocus: k, baseElement: B } = n.getState();
|
2413
|
+
if (n.setActiveId(p), En(x.currentTarget) && Cu(x.currentTarget), !k || !me(x) || zu(x.currentTarget) || !(B != null && B.isConnected)) return;
|
2414
|
+
kn() && x.currentTarget.hasAttribute("data-autofocus") && x.currentTarget.scrollIntoView({
|
2415
|
+
block: "nearest",
|
2416
|
+
inline: "nearest"
|
2417
|
+
}), A.current = !0, x.relatedTarget === B || xt(n, x.relatedTarget) ? Ou(B) : B.focus();
|
2418
|
+
}), N = c.onBlurCapture, I = j((x) => {
|
2419
|
+
if (N == null || N(x), x.defaultPrevented) return;
|
2420
|
+
const k = n == null ? void 0 : n.getState();
|
2421
|
+
k != null && k.virtualFocus && A.current && (A.current = !1, x.preventDefault(), x.stopPropagation());
|
2422
|
+
}), T = c.onKeyDown, D = fe(i), v = fe(s), R = j((x) => {
|
2423
|
+
if (T == null || T(x), x.defaultPrevented || !me(x) || !n) return;
|
2424
|
+
const { currentTarget: k } = x, B = n.getState(), H = n.item(p), ie = !!(H != null && H.rowId), oe = B.orientation !== "horizontal", re = B.orientation !== "vertical", be = () => !!(ie || re || !B.baseElement || !ze(B.baseElement)), ye = {
|
2425
|
+
ArrowUp: (ie || oe) && n.up,
|
2426
|
+
ArrowRight: (ie || re) && n.next,
|
2427
|
+
ArrowDown: (ie || oe) && n.down,
|
2428
|
+
ArrowLeft: (ie || re) && n.previous,
|
2429
|
+
Home: () => {
|
2430
|
+
if (be())
|
2431
|
+
return !ie || x.ctrlKey ? n == null ? void 0 : n.first() : n == null ? void 0 : n.previous(-1);
|
2432
|
+
},
|
2433
|
+
End: () => {
|
2434
|
+
if (be())
|
2435
|
+
return !ie || x.ctrlKey ? n == null ? void 0 : n.last() : n == null ? void 0 : n.next(-1);
|
2436
|
+
},
|
2437
|
+
PageUp: () => Dr(k, n, n == null ? void 0 : n.up, !0),
|
2438
|
+
PageDown: () => Dr(k, n, n == null ? void 0 : n.down)
|
2439
|
+
}[x.key];
|
2440
|
+
if (ye) {
|
2441
|
+
if (En(k)) {
|
2442
|
+
const ue = Bi(k), ut = re && x.key === "ArrowLeft", at = re && x.key === "ArrowRight", Me = oe && x.key === "ArrowUp", je = oe && x.key === "ArrowDown";
|
2443
|
+
if (at || je) {
|
2444
|
+
const { length: ct } = $i(k);
|
2445
|
+
if (ue.end !== ct) return;
|
2446
|
+
} else if ((ut || Me) && ue.start !== 0) return;
|
2447
|
+
}
|
2448
|
+
const Ie = ye();
|
2449
|
+
if (D(x) || Ie !== void 0) {
|
2450
|
+
if (!v(x)) return;
|
2451
|
+
x.preventDefault(), n.move(Ie);
|
2452
|
+
}
|
2453
|
+
}
|
2454
|
+
}), K = He(
|
2455
|
+
() => ({ id: p, baseElement: h }),
|
2456
|
+
[p, h]
|
2457
|
+
);
|
2458
|
+
return c = le(
|
2459
|
+
c,
|
2460
|
+
(x) => /* @__PURE__ */ M(ss.Provider, { value: K, children: x }),
|
2461
|
+
[K]
|
2462
|
+
), c = $(O({
|
2463
|
+
id: p,
|
2464
|
+
"data-active-item": m || void 0
|
2465
|
+
}, c), {
|
2466
|
+
ref: de(b, c.ref),
|
2467
|
+
tabIndex: _ ? c.tabIndex : -1,
|
2468
|
+
onFocus: F,
|
2469
|
+
onBlurCapture: I,
|
2470
|
+
onKeyDown: R
|
2471
|
+
}), c = er(c), c = Bo($(O({
|
2472
|
+
store: n
|
2473
|
+
}, c), {
|
2474
|
+
getItem: L,
|
2475
|
+
shouldRegisterItem: p ? c.shouldRegisterItem : !1
|
2476
|
+
})), rt($(O({}, c), {
|
2477
|
+
"aria-setsize": y,
|
2478
|
+
"aria-posinset": C
|
2479
|
+
}));
|
2480
|
+
}
|
2481
|
+
);
|
2482
|
+
Bn(
|
2483
|
+
G(function(t) {
|
2484
|
+
const r = Ko(t);
|
2485
|
+
return Q(Wu, r);
|
2486
|
+
})
|
2487
|
+
);
|
2488
|
+
var Gu = "div";
|
2489
|
+
function Yu(e, t) {
|
2490
|
+
if (t != null)
|
2491
|
+
return e == null ? !1 : Array.isArray(e) ? e.includes(t) : e === t;
|
2492
|
+
}
|
2493
|
+
var Xu = Z(
|
2494
|
+
function(t) {
|
2495
|
+
var r = t, {
|
2496
|
+
store: n,
|
2497
|
+
value: o,
|
2498
|
+
getItem: i,
|
2499
|
+
hideOnClick: s,
|
2500
|
+
setValueOnClick: u = o != null,
|
2501
|
+
preventScrollOnKeyDown: a = !0,
|
2502
|
+
focusOnHover: d = !0
|
2503
|
+
} = r, f = J(r, [
|
2504
|
+
"store",
|
2505
|
+
"value",
|
2506
|
+
"getItem",
|
2507
|
+
"hideOnClick",
|
2508
|
+
"setValueOnClick",
|
2509
|
+
"preventScrollOnKeyDown",
|
2510
|
+
"focusOnHover"
|
2511
|
+
]), c;
|
2512
|
+
const l = Hs();
|
2513
|
+
n = n || l, he(
|
2514
|
+
n,
|
2515
|
+
process.env.NODE_ENV !== "production" && "SelectItem must be wrapped in a SelectList or SelectPopover component."
|
2516
|
+
);
|
2517
|
+
const p = ot(f.id), b = Xt(f), { listElement: g, multiSelectable: E, selected: w, autoFocus: P } = go(n, {
|
2518
|
+
listElement: "listElement",
|
2519
|
+
multiSelectable(S) {
|
2520
|
+
return Array.isArray(S.value);
|
2521
|
+
},
|
2522
|
+
selected(S) {
|
2523
|
+
return Yu(S.value, o);
|
2524
|
+
},
|
2525
|
+
autoFocus(S) {
|
2526
|
+
return o == null || S.value == null || S.activeId !== p && (n != null && n.item(S.activeId)) ? !1 : Array.isArray(S.value) ? S.value[S.value.length - 1] === o : S.value === o;
|
2527
|
+
}
|
2528
|
+
}), h = xe(
|
2529
|
+
(S) => {
|
2530
|
+
const A = $(O({}, S), {
|
2531
|
+
value: b ? void 0 : o,
|
2532
|
+
children: o
|
2533
|
+
});
|
2534
|
+
return i ? i(A) : A;
|
2535
|
+
},
|
2536
|
+
[b, o, i]
|
2537
|
+
);
|
2538
|
+
s = s ?? (o != null && !E);
|
2539
|
+
const m = f.onClick, y = fe(u), C = fe(s), _ = j((S) => {
|
2540
|
+
m == null || m(S), !S.defaultPrevented && (qi(S) || ji(S) || (y(S) && o != null && (n == null || n.setValue((A) => Array.isArray(A) ? A.includes(o) ? A.filter((F) => F !== o) : [...A, o] : o)), C(S) && (n == null || n.hide())));
|
2541
|
+
});
|
2542
|
+
f = le(
|
2543
|
+
f,
|
2544
|
+
(S) => /* @__PURE__ */ M(zs.Provider, { value: w ?? !1, children: S }),
|
2545
|
+
[w]
|
2546
|
+
), f = $(O({
|
2547
|
+
id: p,
|
2548
|
+
role: Ki(g),
|
2549
|
+
"aria-selected": w,
|
2550
|
+
children: o
|
2551
|
+
}, f), {
|
2552
|
+
autoFocus: (c = f.autoFocus) != null ? c : P,
|
2553
|
+
onClick: _
|
2554
|
+
}), f = Ko(O({
|
2555
|
+
store: n,
|
2556
|
+
getItem: h,
|
2557
|
+
preventScrollOnKeyDown: a
|
2558
|
+
}, f));
|
2559
|
+
const L = fe(d);
|
2560
|
+
return f = $o($(O({
|
2561
|
+
store: n
|
2562
|
+
}, f), {
|
2563
|
+
// We have to disable focusOnHover when the popup is closed, otherwise
|
2564
|
+
// the active item will change to null (the container) when the popup is
|
2565
|
+
// closed by clicking on an item.
|
2566
|
+
focusOnHover(S) {
|
2567
|
+
if (!L(S)) return !1;
|
2568
|
+
const A = n == null ? void 0 : n.getState();
|
2569
|
+
return !!(A != null && A.open);
|
2570
|
+
}
|
2571
|
+
})), f;
|
2572
|
+
}
|
2573
|
+
), Ju = Bn(
|
2574
|
+
G(function(t) {
|
2575
|
+
const r = Xu(t);
|
2576
|
+
return Q(Gu, r);
|
2577
|
+
})
|
2578
|
+
), Qu = "div";
|
2579
|
+
function Zu(e) {
|
2580
|
+
return e.some((t) => !!t.rowId);
|
2581
|
+
}
|
2582
|
+
function ea(e) {
|
2583
|
+
const t = e.target;
|
2584
|
+
return t && !ze(t) ? !1 : e.key.length === 1 && !e.ctrlKey && !e.metaKey;
|
2585
|
+
}
|
2586
|
+
function ta(e) {
|
2587
|
+
return e.key === "Shift" || e.key === "Control" || e.key === "Alt" || e.key === "Meta";
|
2588
|
+
}
|
2589
|
+
function Ar(e, t, r) {
|
2590
|
+
return j((n) => {
|
2591
|
+
var o;
|
2592
|
+
if (t == null || t(n), n.defaultPrevented || n.isPropagationStopped() || !me(n) || ta(n) || ea(n)) return;
|
2593
|
+
const i = e.getState(), s = (o = Ge(e, i.activeId)) == null ? void 0 : o.element;
|
2594
|
+
if (!s) return;
|
2595
|
+
const u = n, a = J(u, ["view"]), d = r == null ? void 0 : r.current;
|
2596
|
+
s !== d && s.focus(), Gi(s, n.type, a) || n.preventDefault(), n.currentTarget.contains(s) && n.stopPropagation();
|
2597
|
+
});
|
2598
|
+
}
|
2599
|
+
function na(e) {
|
2600
|
+
return Pu(
|
2601
|
+
bo(Pn(Iu(e)))
|
2602
|
+
);
|
2603
|
+
}
|
2604
|
+
function ra(e) {
|
2605
|
+
const [t, r] = X(!1), n = xe(() => r(!0), []), o = e.useState(
|
2606
|
+
(i) => Ge(e, i.activeId)
|
2607
|
+
);
|
2608
|
+
return W(() => {
|
2609
|
+
const i = o == null ? void 0 : o.element;
|
2610
|
+
t && i && (r(!1), i.focus({ preventScroll: !0 }));
|
2611
|
+
}, [o, t]), n;
|
2612
|
+
}
|
2613
|
+
var Ho = Z(
|
2614
|
+
function(t) {
|
2615
|
+
var r = t, {
|
2616
|
+
store: n,
|
2617
|
+
composite: o = !0,
|
2618
|
+
focusOnMove: i = o,
|
2619
|
+
moveOnKeyPress: s = !0
|
2620
|
+
} = r, u = J(r, [
|
2621
|
+
"store",
|
2622
|
+
"composite",
|
2623
|
+
"focusOnMove",
|
2624
|
+
"moveOnKeyPress"
|
2625
|
+
]);
|
2626
|
+
const a = is();
|
2627
|
+
n = n || a, he(
|
2628
|
+
n,
|
2629
|
+
process.env.NODE_ENV !== "production" && "Composite must receive a `store` prop or be wrapped in a CompositeProvider component."
|
2630
|
+
);
|
2631
|
+
const d = Y(null), f = Y(null), c = ra(n), l = n.useState("moves"), [, p] = uo(
|
2632
|
+
o ? n.setBaseElement : null
|
2633
|
+
);
|
2634
|
+
W(() => {
|
2635
|
+
var I;
|
2636
|
+
if (!n || !l || !o || !i) return;
|
2637
|
+
const { activeId: T } = n.getState(), D = (I = Ge(n, T)) == null ? void 0 : I.element;
|
2638
|
+
D && Zs(D);
|
2639
|
+
}, [n, l, o, i]), ee(() => {
|
2640
|
+
if (!n || !l || !o) return;
|
2641
|
+
const { baseElement: I, activeId: T } = n.getState();
|
2642
|
+
if (!(T === null) || !I) return;
|
2643
|
+
const v = f.current;
|
2644
|
+
f.current = null, v && dt(v, { relatedTarget: I }), jt(I) || I.focus();
|
2645
|
+
}, [n, l, o]);
|
2646
|
+
const b = n.useState("activeId"), g = n.useState("virtualFocus");
|
2647
|
+
ee(() => {
|
2648
|
+
var I;
|
2649
|
+
if (!n || !o || !g) return;
|
2650
|
+
const T = f.current;
|
2651
|
+
if (f.current = null, !T) return;
|
2652
|
+
const v = ((I = Ge(n, b)) == null ? void 0 : I.element) || We(T);
|
2653
|
+
v !== T && dt(T, { relatedTarget: v });
|
2654
|
+
}, [n, b, g, o]);
|
2655
|
+
const E = Ar(
|
2656
|
+
n,
|
2657
|
+
u.onKeyDownCapture,
|
2658
|
+
f
|
2659
|
+
), w = Ar(
|
2660
|
+
n,
|
2661
|
+
u.onKeyUpCapture,
|
2662
|
+
f
|
2663
|
+
), P = u.onFocusCapture, h = j((I) => {
|
2664
|
+
if (P == null || P(I), I.defaultPrevented || !n) return;
|
2665
|
+
const { virtualFocus: T } = n.getState();
|
2666
|
+
if (!T) return;
|
2667
|
+
const D = I.relatedTarget, v = _u(I.currentTarget);
|
2668
|
+
me(I) && v && (I.stopPropagation(), f.current = D);
|
2669
|
+
}), m = u.onFocus, y = j((I) => {
|
2670
|
+
if (m == null || m(I), I.defaultPrevented || !o || !n) return;
|
2671
|
+
const { relatedTarget: T } = I, { virtualFocus: D } = n.getState();
|
2672
|
+
D ? me(I) && !xt(n, T) && queueMicrotask(c) : me(I) && n.setActiveId(null);
|
2673
|
+
}), C = u.onBlurCapture, _ = j((I) => {
|
2674
|
+
var T;
|
2675
|
+
if (C == null || C(I), I.defaultPrevented || !n) return;
|
2676
|
+
const { virtualFocus: D, activeId: v } = n.getState();
|
2677
|
+
if (!D) return;
|
2678
|
+
const R = (T = Ge(n, v)) == null ? void 0 : T.element, K = I.relatedTarget, x = xt(n, K), k = f.current;
|
2679
|
+
f.current = null, me(I) && x ? (K === R ? k && k !== K && dt(k, I) : R ? dt(R, I) : k && dt(k, I), I.stopPropagation()) : !xt(n, I.target) && R && dt(R, I);
|
2680
|
+
}), L = u.onKeyDown, S = fe(s), A = j((I) => {
|
2681
|
+
var T;
|
2682
|
+
if (L == null || L(I), I.defaultPrevented || !n || !me(I)) return;
|
2683
|
+
const { orientation: D, renderedItems: v, activeId: R } = n.getState(), K = Ge(n, R);
|
2684
|
+
if ((T = K == null ? void 0 : K.element) != null && T.isConnected) return;
|
2685
|
+
const x = D !== "horizontal", k = D !== "vertical", B = Zu(v);
|
2686
|
+
if ((I.key === "ArrowLeft" || I.key === "ArrowRight" || I.key === "Home" || I.key === "End") && ze(I.currentTarget)) return;
|
2687
|
+
const re = {
|
2688
|
+
ArrowUp: (B || x) && (() => {
|
2689
|
+
if (B) {
|
2690
|
+
const be = na(v);
|
2691
|
+
return be == null ? void 0 : be.id;
|
2692
|
+
}
|
2693
|
+
return n == null ? void 0 : n.last();
|
2694
|
+
}),
|
2695
|
+
ArrowRight: (B || k) && n.first,
|
2696
|
+
ArrowDown: (B || x) && n.first,
|
2697
|
+
ArrowLeft: (B || k) && n.last,
|
2698
|
+
Home: n.first,
|
2699
|
+
End: n.last,
|
2700
|
+
PageUp: n.first,
|
2701
|
+
PageDown: n.last
|
2702
|
+
}[I.key];
|
2703
|
+
if (re) {
|
2704
|
+
const be = re();
|
2705
|
+
if (be !== void 0) {
|
2706
|
+
if (!S(I)) return;
|
2707
|
+
I.preventDefault(), n.move(be);
|
2708
|
+
}
|
2709
|
+
}
|
2710
|
+
});
|
2711
|
+
u = le(
|
2712
|
+
u,
|
2713
|
+
(I) => /* @__PURE__ */ M(Hn, { value: n, children: I }),
|
2714
|
+
[n]
|
2715
|
+
);
|
2716
|
+
const F = n.useState((I) => {
|
2717
|
+
var T;
|
2718
|
+
if (n && o && I.virtualFocus)
|
2719
|
+
return (T = Ge(n, I.activeId)) == null ? void 0 : T.id;
|
2720
|
+
});
|
2721
|
+
u = $(O({
|
2722
|
+
"aria-activedescendant": F
|
2723
|
+
}, u), {
|
2724
|
+
ref: de(d, p, u.ref),
|
2725
|
+
onKeyDownCapture: E,
|
2726
|
+
onKeyUpCapture: w,
|
2727
|
+
onFocusCapture: h,
|
2728
|
+
onFocus: y,
|
2729
|
+
onBlurCapture: _,
|
2730
|
+
onKeyDown: A
|
2731
|
+
});
|
2732
|
+
const N = n.useState(
|
2733
|
+
(I) => o && (I.virtualFocus || I.activeId === null)
|
2734
|
+
);
|
2735
|
+
return u = on(O({ focusable: N }, u)), u;
|
2736
|
+
}
|
2737
|
+
);
|
2738
|
+
G(function(t) {
|
2739
|
+
const r = Ho(t);
|
2740
|
+
return Q(Qu, r);
|
2741
|
+
});
|
2742
|
+
var oa = "div";
|
2743
|
+
function Tr(e, t) {
|
2744
|
+
const r = setTimeout(t, e);
|
2745
|
+
return () => clearTimeout(r);
|
2746
|
+
}
|
2747
|
+
function ia(e) {
|
2748
|
+
let t = requestAnimationFrame(() => {
|
2749
|
+
t = requestAnimationFrame(e);
|
2750
|
+
});
|
2751
|
+
return () => cancelAnimationFrame(t);
|
2752
|
+
}
|
2753
|
+
function Lr(...e) {
|
2754
|
+
return e.join(", ").split(", ").reduce((t, r) => {
|
2755
|
+
const n = r.endsWith("ms") ? 1 : 1e3, o = Number.parseFloat(r || "0s") * n;
|
2756
|
+
return o > t ? o : t;
|
2757
|
+
}, 0);
|
2758
|
+
}
|
2759
|
+
function nr(e, t, r) {
|
2760
|
+
return !r && t !== !1 && (!e || !!t);
|
2761
|
+
}
|
2762
|
+
var rr = Z(function(t) {
|
2763
|
+
var r = t, { store: n, alwaysVisible: o } = r, i = J(r, ["store", "alwaysVisible"]);
|
2764
|
+
const s = Wn();
|
2765
|
+
n = n || s, he(
|
2766
|
+
n,
|
2767
|
+
process.env.NODE_ENV !== "production" && "DisclosureContent must receive a `store` prop or be wrapped in a DisclosureProvider component."
|
2768
|
+
);
|
2769
|
+
const u = Y(null), a = ot(i.id), [d, f] = X(null), c = n.useState("open"), l = n.useState("mounted"), p = n.useState("animated"), b = n.useState("contentElement"), g = _e(n.disclosure, "contentElement");
|
2770
|
+
ee(() => {
|
2771
|
+
u.current && (n == null || n.setContentElement(u.current));
|
2772
|
+
}, [n]), ee(() => {
|
2773
|
+
let h;
|
2774
|
+
return n == null || n.setState("animated", (m) => (h = m, !0)), () => {
|
2775
|
+
h !== void 0 && (n == null || n.setState("animated", h));
|
2776
|
+
};
|
2777
|
+
}, [n]), ee(() => {
|
2778
|
+
if (p) {
|
2779
|
+
if (!(b != null && b.isConnected)) {
|
2780
|
+
f(null);
|
2781
|
+
return;
|
2782
|
+
}
|
2783
|
+
return ia(() => {
|
2784
|
+
f(c ? "enter" : l ? "leave" : null);
|
2785
|
+
});
|
2786
|
+
}
|
2787
|
+
}, [p, b, c, l]), ee(() => {
|
2788
|
+
if (!n || !p || !d || !b) return;
|
2789
|
+
const h = () => n == null ? void 0 : n.setState("animating", !1), m = () => Yr(h);
|
2790
|
+
if (d === "leave" && c || d === "enter" && !c) return;
|
2791
|
+
if (typeof p == "number")
|
2792
|
+
return Tr(p, m);
|
2793
|
+
const {
|
2794
|
+
transitionDuration: y,
|
2795
|
+
animationDuration: C,
|
2796
|
+
transitionDelay: _,
|
2797
|
+
animationDelay: L
|
2798
|
+
} = getComputedStyle(b), {
|
2799
|
+
transitionDuration: S = "0",
|
2800
|
+
animationDuration: A = "0",
|
2801
|
+
transitionDelay: F = "0",
|
2802
|
+
animationDelay: N = "0"
|
2803
|
+
} = g ? getComputedStyle(g) : {}, I = Lr(
|
2804
|
+
_,
|
2805
|
+
L,
|
2806
|
+
F,
|
2807
|
+
N
|
2808
|
+
), T = Lr(
|
2809
|
+
y,
|
2810
|
+
C,
|
2811
|
+
S,
|
2812
|
+
A
|
2813
|
+
), D = I + T;
|
2814
|
+
if (!D) {
|
2815
|
+
d === "enter" && n.setState("animated", !1), h();
|
2816
|
+
return;
|
2817
|
+
}
|
2818
|
+
const v = 1e3 / 60, R = Math.max(D - v, 0);
|
2819
|
+
return Tr(R, m);
|
2820
|
+
}, [n, p, b, g, c, d]), i = le(
|
2821
|
+
i,
|
2822
|
+
(h) => /* @__PURE__ */ M(Un, { value: n, children: h }),
|
2823
|
+
[n]
|
2824
|
+
);
|
2825
|
+
const E = nr(l, i.hidden, o), w = i.style, P = He(() => E ? $(O({}, w), { display: "none" }) : w, [E, w]);
|
2826
|
+
return i = $(O({
|
2827
|
+
id: a,
|
2828
|
+
"data-open": c || void 0,
|
2829
|
+
"data-enter": d === "enter" || void 0,
|
2830
|
+
"data-leave": d === "leave" || void 0,
|
2831
|
+
hidden: E
|
2832
|
+
}, i), {
|
2833
|
+
ref: de(a ? n.setContentElement : null, u, i.ref),
|
2834
|
+
style: P
|
2835
|
+
}), rt(i);
|
2836
|
+
}), sa = G(function(t) {
|
2837
|
+
const r = rr(t);
|
2838
|
+
return Q(oa, r);
|
2839
|
+
});
|
2840
|
+
G(function(t) {
|
2841
|
+
var r = t, {
|
2842
|
+
unmountOnHide: n
|
2843
|
+
} = r, o = J(r, [
|
2844
|
+
"unmountOnHide"
|
2845
|
+
]);
|
2846
|
+
const i = Wn(), s = o.store || i;
|
2847
|
+
return _e(
|
2848
|
+
s,
|
2849
|
+
(a) => !n || (a == null ? void 0 : a.mounted)
|
2850
|
+
) === !1 ? null : /* @__PURE__ */ M(sa, O({}, o));
|
2851
|
+
});
|
2852
|
+
var ua = "div", Rr = ge(null), Wo = Z(
|
2853
|
+
function(t) {
|
2854
|
+
var r = t, {
|
2855
|
+
store: n,
|
2856
|
+
resetOnEscape: o = !0,
|
2857
|
+
hideOnEnter: i = !0,
|
2858
|
+
focusOnMove: s = !0,
|
2859
|
+
composite: u,
|
2860
|
+
alwaysVisible: a
|
2861
|
+
} = r, d = J(r, [
|
2862
|
+
"store",
|
2863
|
+
"resetOnEscape",
|
2864
|
+
"hideOnEnter",
|
2865
|
+
"focusOnMove",
|
2866
|
+
"composite",
|
2867
|
+
"alwaysVisible"
|
2868
|
+
]);
|
2869
|
+
const f = Io();
|
2870
|
+
n = n || f, he(
|
2871
|
+
n,
|
2872
|
+
process.env.NODE_ENV !== "production" && "SelectList must receive a `store` prop or be wrapped in a SelectProvider component."
|
2873
|
+
);
|
2874
|
+
const c = ot(d.id), l = n.useState("value"), p = Array.isArray(l), [b, g] = X(l), E = n.useState("mounted");
|
2875
|
+
W(() => {
|
2876
|
+
E || g(l);
|
2877
|
+
}, [E, l]), o = o && !p;
|
2878
|
+
const w = d.onKeyDown, P = fe(o), h = fe(i), m = j((H) => {
|
2879
|
+
w == null || w(H), !H.defaultPrevented && (H.key === "Escape" && P(H) && (n == null || n.setValue(b)), (H.key === " " || H.key === "Enter") && me(H) && h(H) && (H.preventDefault(), n == null || n.hide()));
|
2880
|
+
}), y = et(Er), C = X(), [_, L] = y || C, S = He(
|
2881
|
+
() => [_, L],
|
2882
|
+
[_]
|
2883
|
+
), [A, F] = X(null), N = et(Rr);
|
2884
|
+
W(() => {
|
2885
|
+
if (N)
|
2886
|
+
return N(n), () => N(null);
|
2887
|
+
}, [N, n]), d = le(
|
2888
|
+
d,
|
2889
|
+
(H) => /* @__PURE__ */ M(Co, { value: n, children: /* @__PURE__ */ M(Rr.Provider, { value: F, children: /* @__PURE__ */ M(Er.Provider, { value: S, children: H }) }) }),
|
2890
|
+
[n, S]
|
2891
|
+
);
|
2892
|
+
const I = !!n.combobox;
|
2893
|
+
u = u ?? (!I && A !== n);
|
2894
|
+
const [T, D] = uo(
|
2895
|
+
u ? n.setListElement : null
|
2896
|
+
), v = Ji(T, "role", d.role), K = (u || (v === "listbox" || v === "menu" || v === "tree" || v === "grid")) && p || void 0, x = nr(E, d.hidden, a), k = x ? $(O({}, d.style), { display: "none" }) : d.style;
|
2897
|
+
u && (d = O({
|
2898
|
+
role: "listbox",
|
2899
|
+
"aria-multiselectable": K
|
2900
|
+
}, d));
|
2901
|
+
const B = n.useState(
|
2902
|
+
(H) => {
|
2903
|
+
var ie;
|
2904
|
+
return _ || ((ie = H.labelElement) == null ? void 0 : ie.id);
|
2905
|
+
}
|
2906
|
+
);
|
2907
|
+
return d = $(O({
|
2908
|
+
id: c,
|
2909
|
+
"aria-labelledby": B,
|
2910
|
+
hidden: x
|
2911
|
+
}, d), {
|
2912
|
+
ref: de(D, d.ref),
|
2913
|
+
style: k,
|
2914
|
+
onKeyDown: m
|
2915
|
+
}), d = Ho($(O({ store: n }, d), { composite: u })), d = tr(O({ store: n, typeahead: !I }, d)), d;
|
2916
|
+
}
|
2917
|
+
), aa = G(function(t) {
|
2918
|
+
const r = Wo(t);
|
2919
|
+
return Q(ua, r);
|
2920
|
+
});
|
2921
|
+
function zo(e, ...t) {
|
2922
|
+
if (!e) return !1;
|
2923
|
+
const r = e.getAttribute("data-backdrop");
|
2924
|
+
return r == null ? !1 : r === "" || r === "true" || !t.length ? !0 : t.some((n) => r === n);
|
2925
|
+
}
|
2926
|
+
var hn = /* @__PURE__ */ new WeakMap();
|
2927
|
+
function Rt(e, t, r) {
|
2928
|
+
hn.has(e) || hn.set(e, /* @__PURE__ */ new Map());
|
2929
|
+
const n = hn.get(e), o = n.get(t);
|
2930
|
+
if (!o)
|
2931
|
+
return n.set(t, r()), () => {
|
2932
|
+
var u;
|
2933
|
+
(u = n.get(t)) == null || u(), n.delete(t);
|
2934
|
+
};
|
2935
|
+
const i = r(), s = () => {
|
2936
|
+
i(), o(), n.delete(t);
|
2937
|
+
};
|
2938
|
+
return n.set(t, s), () => {
|
2939
|
+
n.get(t) === s && (i(), n.set(t, o));
|
2940
|
+
};
|
2941
|
+
}
|
2942
|
+
function or(e, t, r) {
|
2943
|
+
return Rt(e, t, () => {
|
2944
|
+
const o = e.getAttribute(t);
|
2945
|
+
return e.setAttribute(t, r), () => {
|
2946
|
+
o == null ? e.removeAttribute(t) : e.setAttribute(t, o);
|
2947
|
+
};
|
2948
|
+
});
|
2949
|
+
}
|
2950
|
+
function tt(e, t, r) {
|
2951
|
+
return Rt(e, t, () => {
|
2952
|
+
const o = t in e, i = e[t];
|
2953
|
+
return e[t] = r, () => {
|
2954
|
+
o ? e[t] = i : delete e[t];
|
2955
|
+
};
|
2956
|
+
});
|
2957
|
+
}
|
2958
|
+
function On(e, t) {
|
2959
|
+
return e ? Rt(e, "style", () => {
|
2960
|
+
const n = e.style.cssText;
|
2961
|
+
return Object.assign(e.style, t), () => {
|
2962
|
+
e.style.cssText = n;
|
2963
|
+
};
|
2964
|
+
}) : () => {
|
2965
|
+
};
|
2966
|
+
}
|
2967
|
+
function ca(e, t, r) {
|
2968
|
+
return e ? Rt(e, t, () => {
|
2969
|
+
const o = e.style.getPropertyValue(t);
|
2970
|
+
return e.style.setProperty(t, r), () => {
|
2971
|
+
o ? e.style.setProperty(t, o) : e.style.removeProperty(t);
|
2972
|
+
};
|
2973
|
+
}) : () => {
|
2974
|
+
};
|
2975
|
+
}
|
2976
|
+
var la = ["SCRIPT", "STYLE"];
|
2977
|
+
function _n(e) {
|
2978
|
+
return `__ariakit-dialog-snapshot-${e}`;
|
2979
|
+
}
|
2980
|
+
function fa(e, t) {
|
2981
|
+
const r = ne(t), n = _n(e);
|
2982
|
+
if (!r.body[n]) return !0;
|
2983
|
+
do {
|
2984
|
+
if (t === r.body) return !1;
|
2985
|
+
if (t[n]) return !0;
|
2986
|
+
if (!t.parentElement) return !1;
|
2987
|
+
t = t.parentElement;
|
2988
|
+
} while (!0);
|
2989
|
+
}
|
2990
|
+
function da(e, t, r) {
|
2991
|
+
return la.includes(t.tagName) || !fa(e, t) ? !1 : !r.some(
|
2992
|
+
(n) => n && se(t, n)
|
2993
|
+
);
|
2994
|
+
}
|
2995
|
+
function ir(e, t, r, n) {
|
2996
|
+
for (let o of t) {
|
2997
|
+
if (!(o != null && o.isConnected)) continue;
|
2998
|
+
const i = t.some((a) => !a || a === o ? !1 : a.contains(o)), s = ne(o), u = o;
|
2999
|
+
for (; o.parentElement && o !== s.body; ) {
|
3000
|
+
if (n == null || n(o.parentElement, u), !i)
|
3001
|
+
for (const a of o.parentElement.children)
|
3002
|
+
da(e, a, t) && r(a, u);
|
3003
|
+
o = o.parentElement;
|
3004
|
+
}
|
3005
|
+
}
|
3006
|
+
}
|
3007
|
+
function pa(e, t) {
|
3008
|
+
const { body: r } = ne(t[0]), n = [];
|
3009
|
+
return ir(e, t, (i) => {
|
3010
|
+
n.push(tt(i, _n(e), !0));
|
3011
|
+
}), Te(tt(r, _n(e), !0), () => {
|
3012
|
+
for (const i of n)
|
3013
|
+
i();
|
3014
|
+
});
|
3015
|
+
}
|
3016
|
+
function ht(e = "", t = !1) {
|
3017
|
+
return `__ariakit-dialog-${t ? "ancestor" : "outside"}${e ? `-${e}` : ""}`;
|
3018
|
+
}
|
3019
|
+
function ma(e, t = "") {
|
3020
|
+
return Te(
|
3021
|
+
tt(e, ht(), !0),
|
3022
|
+
tt(e, ht(t), !0)
|
3023
|
+
);
|
3024
|
+
}
|
3025
|
+
function Uo(e, t = "") {
|
3026
|
+
return Te(
|
3027
|
+
tt(e, ht("", !0), !0),
|
3028
|
+
tt(e, ht(t, !0), !0)
|
3029
|
+
);
|
3030
|
+
}
|
3031
|
+
function sr(e, t) {
|
3032
|
+
const r = ht(t, !0);
|
3033
|
+
if (e[r]) return !0;
|
3034
|
+
const n = ht(t);
|
3035
|
+
do {
|
3036
|
+
if (e[n]) return !0;
|
3037
|
+
if (!e.parentElement) return !1;
|
3038
|
+
e = e.parentElement;
|
3039
|
+
} while (!0);
|
3040
|
+
}
|
3041
|
+
function Fr(e, t) {
|
3042
|
+
const r = [], n = t.map((i) => i == null ? void 0 : i.id);
|
3043
|
+
return ir(
|
3044
|
+
e,
|
3045
|
+
t,
|
3046
|
+
(i) => {
|
3047
|
+
zo(i, ...n) || r.unshift(ma(i, e));
|
3048
|
+
},
|
3049
|
+
(i, s) => {
|
3050
|
+
s.hasAttribute("data-dialog") && s.id !== e || r.unshift(Uo(i, e));
|
3051
|
+
}
|
3052
|
+
), () => {
|
3053
|
+
for (const i of r)
|
3054
|
+
i();
|
3055
|
+
};
|
3056
|
+
}
|
3057
|
+
var va = "div", ga = [
|
3058
|
+
"a",
|
3059
|
+
"button",
|
3060
|
+
"details",
|
3061
|
+
"dialog",
|
3062
|
+
"div",
|
3063
|
+
"form",
|
3064
|
+
"h1",
|
3065
|
+
"h2",
|
3066
|
+
"h3",
|
3067
|
+
"h4",
|
3068
|
+
"h5",
|
3069
|
+
"h6",
|
3070
|
+
"header",
|
3071
|
+
"img",
|
3072
|
+
"input",
|
3073
|
+
"label",
|
3074
|
+
"li",
|
3075
|
+
"nav",
|
3076
|
+
"ol",
|
3077
|
+
"p",
|
3078
|
+
"section",
|
3079
|
+
"select",
|
3080
|
+
"span",
|
3081
|
+
"summary",
|
3082
|
+
"textarea",
|
3083
|
+
"ul",
|
3084
|
+
"svg"
|
3085
|
+
];
|
3086
|
+
Z(
|
3087
|
+
function(t) {
|
3088
|
+
return t;
|
3089
|
+
}
|
3090
|
+
);
|
3091
|
+
var Dn = G(
|
3092
|
+
// @ts-expect-error
|
3093
|
+
function(t) {
|
3094
|
+
return Q(va, t);
|
3095
|
+
}
|
3096
|
+
);
|
3097
|
+
Object.assign(
|
3098
|
+
Dn,
|
3099
|
+
ga.reduce((e, t) => (e[t] = G(function(n) {
|
3100
|
+
return Q(t, n);
|
3101
|
+
}), e), {})
|
3102
|
+
);
|
3103
|
+
function ha({
|
3104
|
+
store: e,
|
3105
|
+
backdrop: t,
|
3106
|
+
alwaysVisible: r,
|
3107
|
+
hidden: n
|
3108
|
+
}) {
|
3109
|
+
const o = Y(null), i = Fs({ disclosure: e }), s = _e(e, "contentElement");
|
3110
|
+
W(() => {
|
3111
|
+
const d = o.current, f = s;
|
3112
|
+
d && f && (d.style.zIndex = getComputedStyle(f).zIndex);
|
3113
|
+
}, [s]), ee(() => {
|
3114
|
+
const d = s == null ? void 0 : s.id;
|
3115
|
+
if (!d) return;
|
3116
|
+
const f = o.current;
|
3117
|
+
if (f)
|
3118
|
+
return Uo(f, d);
|
3119
|
+
}, [s]);
|
3120
|
+
const u = rr({
|
3121
|
+
ref: o,
|
3122
|
+
store: i,
|
3123
|
+
role: "presentation",
|
3124
|
+
"data-backdrop": (s == null ? void 0 : s.id) || "",
|
3125
|
+
alwaysVisible: r,
|
3126
|
+
hidden: n ?? void 0,
|
3127
|
+
style: {
|
3128
|
+
position: "fixed",
|
3129
|
+
top: 0,
|
3130
|
+
right: 0,
|
3131
|
+
bottom: 0,
|
3132
|
+
left: 0
|
3133
|
+
}
|
3134
|
+
});
|
3135
|
+
if (!t) return null;
|
3136
|
+
if (Gr(t))
|
3137
|
+
return /* @__PURE__ */ M(Dn, $(O({}, u), { render: t }));
|
3138
|
+
const a = typeof t != "boolean" ? t : "div";
|
3139
|
+
return /* @__PURE__ */ M(Dn, $(O({}, u), { render: /* @__PURE__ */ M(a, {}) }));
|
3140
|
+
}
|
3141
|
+
function ba(e, ...t) {
|
3142
|
+
if (!e) return !1;
|
3143
|
+
const r = e.getAttribute("data-focus-trap");
|
3144
|
+
return r == null ? !1 : t.length ? r === "" ? !1 : t.some((n) => r === n) : !0;
|
3145
|
+
}
|
3146
|
+
function ya(e) {
|
3147
|
+
return or(e, "aria-hidden", "true");
|
3148
|
+
}
|
3149
|
+
function jo() {
|
3150
|
+
return "inert" in HTMLElement.prototype;
|
3151
|
+
}
|
3152
|
+
function qo(e, t) {
|
3153
|
+
if (!("style" in e)) return Kt;
|
3154
|
+
if (jo())
|
3155
|
+
return tt(e, "inert", !0);
|
3156
|
+
const n = rn(e, !0).map((o) => {
|
3157
|
+
if (t != null && t.some((s) => s && se(s, o))) return Kt;
|
3158
|
+
const i = Rt(o, "focus", () => (o.focus = Kt, () => {
|
3159
|
+
delete o.focus;
|
3160
|
+
}));
|
3161
|
+
return Te(or(o, "tabindex", "-1"), i);
|
3162
|
+
});
|
3163
|
+
return Te(
|
3164
|
+
...n,
|
3165
|
+
ya(e),
|
3166
|
+
On(e, {
|
3167
|
+
pointerEvents: "none",
|
3168
|
+
userSelect: "none",
|
3169
|
+
cursor: "default"
|
3170
|
+
})
|
3171
|
+
);
|
3172
|
+
}
|
3173
|
+
function Sa(e, t) {
|
3174
|
+
const r = [], n = t.map((i) => i == null ? void 0 : i.id);
|
3175
|
+
return ir(
|
3176
|
+
e,
|
3177
|
+
t,
|
3178
|
+
(i) => {
|
3179
|
+
zo(i, ...n) || ba(i, ...n) || r.unshift(qo(i, t));
|
3180
|
+
},
|
3181
|
+
(i) => {
|
3182
|
+
i.hasAttribute("role") && (t.some((s) => s && se(s, i)) || r.unshift(or(i, "role", "none")));
|
3183
|
+
}
|
3184
|
+
), () => {
|
3185
|
+
for (const i of r)
|
3186
|
+
i();
|
3187
|
+
};
|
3188
|
+
}
|
3189
|
+
function wa({
|
3190
|
+
attribute: e,
|
3191
|
+
contentId: t,
|
3192
|
+
contentElement: r,
|
3193
|
+
enabled: n
|
3194
|
+
}) {
|
3195
|
+
const [o, i] = Qi(), s = xe(() => {
|
3196
|
+
if (!n || !r) return !1;
|
3197
|
+
const { body: u } = ne(r), a = u.getAttribute(e);
|
3198
|
+
return !a || a === t;
|
3199
|
+
}, [o, n, r, e, t]);
|
3200
|
+
return W(() => {
|
3201
|
+
if (!n || !t || !r) return;
|
3202
|
+
const { body: u } = ne(r);
|
3203
|
+
if (s())
|
3204
|
+
return u.setAttribute(e, t), () => u.removeAttribute(e);
|
3205
|
+
const a = new MutationObserver(() => Yr(i));
|
3206
|
+
return a.observe(u, { attributeFilter: [e] }), () => a.disconnect();
|
3207
|
+
}, [o, n, t, r, s, e]), s;
|
3208
|
+
}
|
3209
|
+
function Ea(e) {
|
3210
|
+
const t = e.getBoundingClientRect().left;
|
3211
|
+
return Math.round(t) + e.scrollLeft ? "paddingLeft" : "paddingRight";
|
3212
|
+
}
|
3213
|
+
function xa(e, t, r) {
|
3214
|
+
const n = wa({
|
3215
|
+
attribute: "data-dialog-prevent-body-scroll",
|
3216
|
+
contentElement: e,
|
3217
|
+
contentId: t,
|
3218
|
+
enabled: r
|
3219
|
+
});
|
3220
|
+
W(() => {
|
3221
|
+
if (!n() || !e) return;
|
3222
|
+
const o = ne(e), i = no(e), { documentElement: s, body: u } = o, a = s.style.getPropertyValue("--scrollbar-width"), d = a ? Number.parseInt(a) : i.innerWidth - s.clientWidth, f = () => ca(
|
3223
|
+
s,
|
3224
|
+
"--scrollbar-width",
|
3225
|
+
`${d}px`
|
3226
|
+
), c = Ea(s), l = () => On(u, {
|
3227
|
+
overflow: "hidden",
|
3228
|
+
[c]: `${d}px`
|
3229
|
+
}), p = () => {
|
3230
|
+
var g, E;
|
3231
|
+
const { scrollX: w, scrollY: P, visualViewport: h } = i, m = (g = h == null ? void 0 : h.offsetLeft) != null ? g : 0, y = (E = h == null ? void 0 : h.offsetTop) != null ? E : 0, C = On(u, {
|
3232
|
+
position: "fixed",
|
3233
|
+
overflow: "hidden",
|
3234
|
+
top: `${-(P - Math.floor(y))}px`,
|
3235
|
+
left: `${-(w - Math.floor(m))}px`,
|
3236
|
+
right: "0",
|
3237
|
+
[c]: `${d}px`
|
3238
|
+
});
|
3239
|
+
return () => {
|
3240
|
+
C(), process.env.NODE_ENV !== "test" && i.scrollTo({ left: w, top: P, behavior: "instant" });
|
3241
|
+
};
|
3242
|
+
}, b = Mn() && !Ui();
|
3243
|
+
return Te(
|
3244
|
+
f(),
|
3245
|
+
b ? p() : l()
|
3246
|
+
);
|
3247
|
+
}, [n, e]);
|
3248
|
+
}
|
3249
|
+
var Nr = ge({});
|
3250
|
+
function Pa(e) {
|
3251
|
+
const t = et(Nr), [r, n] = X([]), o = xe(
|
3252
|
+
(u) => {
|
3253
|
+
var a;
|
3254
|
+
return n((d) => [...d, u]), Te((a = t.add) == null ? void 0 : a.call(t, u), () => {
|
3255
|
+
n((d) => d.filter((f) => f !== u));
|
3256
|
+
});
|
3257
|
+
},
|
3258
|
+
[t]
|
3259
|
+
);
|
3260
|
+
ee(() => $e(e, ["open", "contentElement"], (u) => {
|
3261
|
+
var a;
|
3262
|
+
if (u.open && u.contentElement)
|
3263
|
+
return (a = t.add) == null ? void 0 : a.call(t, e);
|
3264
|
+
}), [e, t]);
|
3265
|
+
const i = He(() => ({ store: e, add: o }), [e, o]);
|
3266
|
+
return { wrapElement: xe(
|
3267
|
+
(u) => /* @__PURE__ */ M(Nr.Provider, { value: i, children: u }),
|
3268
|
+
[i]
|
3269
|
+
), nestedDialogs: r };
|
3270
|
+
}
|
3271
|
+
function Ia(e) {
|
3272
|
+
const t = Y();
|
3273
|
+
return W(() => {
|
3274
|
+
if (!e) {
|
3275
|
+
t.current = null;
|
3276
|
+
return;
|
3277
|
+
}
|
3278
|
+
return Ce("mousedown", (n) => {
|
3279
|
+
t.current = n.target;
|
3280
|
+
}, !0);
|
3281
|
+
}, [e]), t;
|
3282
|
+
}
|
3283
|
+
function Ca(e) {
|
3284
|
+
return e.tagName === "HTML" ? !0 : se(ne(e).body, e);
|
3285
|
+
}
|
3286
|
+
function Oa(e, t) {
|
3287
|
+
if (!e) return !1;
|
3288
|
+
if (se(e, t)) return !0;
|
3289
|
+
const r = t.getAttribute("aria-activedescendant");
|
3290
|
+
if (r) {
|
3291
|
+
const n = ne(e).getElementById(r);
|
3292
|
+
if (n)
|
3293
|
+
return se(e, n);
|
3294
|
+
}
|
3295
|
+
return !1;
|
3296
|
+
}
|
3297
|
+
function _a(e, t) {
|
3298
|
+
if (!("clientY" in e)) return !1;
|
3299
|
+
const r = t.getBoundingClientRect();
|
3300
|
+
return r.width === 0 || r.height === 0 ? !1 : r.top <= e.clientY && e.clientY <= r.top + r.height && r.left <= e.clientX && e.clientX <= r.left + r.width;
|
3301
|
+
}
|
3302
|
+
function bn({
|
3303
|
+
store: e,
|
3304
|
+
type: t,
|
3305
|
+
listener: r,
|
3306
|
+
capture: n,
|
3307
|
+
domReady: o
|
3308
|
+
}) {
|
3309
|
+
const i = j(r), s = _e(e, "open"), u = Y(!1);
|
3310
|
+
ee(() => {
|
3311
|
+
if (!s || !o) return;
|
3312
|
+
const { contentElement: a } = e.getState();
|
3313
|
+
if (!a) return;
|
3314
|
+
const d = () => {
|
3315
|
+
u.current = !0;
|
3316
|
+
};
|
3317
|
+
return a.addEventListener("focusin", d, !0), () => a.removeEventListener("focusin", d, !0);
|
3318
|
+
}, [e, s, o]), W(() => s ? Ce(t, (d) => {
|
3319
|
+
const { contentElement: f, disclosureElement: c } = e.getState(), l = d.target;
|
3320
|
+
!f || !l || !Ca(l) || se(f, l) || Oa(c, l) || l.hasAttribute("data-focus-trap") || _a(d, f) || u.current && !sr(l, f.id) || nu(l) || i(d);
|
3321
|
+
}, n) : void 0, [s, n]);
|
3322
|
+
}
|
3323
|
+
function yn(e, t) {
|
3324
|
+
return typeof e == "function" ? e(t) : !!e;
|
3325
|
+
}
|
3326
|
+
function Da(e, t, r) {
|
3327
|
+
const n = _e(e, "open"), o = Ia(n), i = { store: e, domReady: r, capture: !0 };
|
3328
|
+
bn($(O({}, i), {
|
3329
|
+
type: "click",
|
3330
|
+
listener: (s) => {
|
3331
|
+
const { contentElement: u } = e.getState(), a = o.current;
|
3332
|
+
a && ro(a) && sr(a, u == null ? void 0 : u.id) && yn(t, s) && e.hide();
|
3333
|
+
}
|
3334
|
+
})), bn($(O({}, i), {
|
3335
|
+
type: "focusin",
|
3336
|
+
listener: (s) => {
|
3337
|
+
const { contentElement: u } = e.getState();
|
3338
|
+
u && s.target !== ne(u) && yn(t, s) && e.hide();
|
3339
|
+
}
|
3340
|
+
})), bn($(O({}, i), {
|
3341
|
+
type: "contextmenu",
|
3342
|
+
listener: (s) => {
|
3343
|
+
yn(t, s) && e.hide();
|
3344
|
+
}
|
3345
|
+
}));
|
3346
|
+
}
|
3347
|
+
function Aa(e, t) {
|
3348
|
+
const n = ne(e).createElement("button");
|
3349
|
+
return n.type = "button", n.tabIndex = -1, n.textContent = "Dismiss popup", Object.assign(n.style, {
|
3350
|
+
border: "0px",
|
3351
|
+
clip: "rect(0 0 0 0)",
|
3352
|
+
height: "1px",
|
3353
|
+
margin: "-1px",
|
3354
|
+
overflow: "hidden",
|
3355
|
+
padding: "0px",
|
3356
|
+
position: "absolute",
|
3357
|
+
whiteSpace: "nowrap",
|
3358
|
+
width: "1px"
|
3359
|
+
}), n.addEventListener("click", t), e.prepend(n), () => {
|
3360
|
+
n.removeEventListener("click", t), n.remove();
|
3361
|
+
};
|
3362
|
+
}
|
3363
|
+
var Ta = "div", Go = Z(function(t) {
|
3364
|
+
var r = t, { autoFocusOnShow: n = !0 } = r, o = J(r, ["autoFocusOnShow"]);
|
3365
|
+
return o = le(
|
3366
|
+
o,
|
3367
|
+
(i) => /* @__PURE__ */ M(Oo.Provider, { value: n, children: i }),
|
3368
|
+
[n]
|
3369
|
+
), o;
|
3370
|
+
});
|
3371
|
+
G(function(t) {
|
3372
|
+
const r = Go(t);
|
3373
|
+
return Q(Ta, r);
|
3374
|
+
});
|
3375
|
+
function La({ level: e, children: t }) {
|
3376
|
+
const r = et(_r), n = Math.max(
|
3377
|
+
Math.min(e || r + 1, 6),
|
3378
|
+
1
|
3379
|
+
);
|
3380
|
+
return /* @__PURE__ */ M(_r.Provider, { value: n, children: t });
|
3381
|
+
}
|
3382
|
+
var Ra = "span", Yo = Z(
|
3383
|
+
function(t) {
|
3384
|
+
return t = $(O({}, t), {
|
3385
|
+
style: O({
|
3386
|
+
border: 0,
|
3387
|
+
clip: "rect(0 0 0 0)",
|
3388
|
+
height: "1px",
|
3389
|
+
margin: "-1px",
|
3390
|
+
overflow: "hidden",
|
3391
|
+
padding: 0,
|
3392
|
+
position: "absolute",
|
3393
|
+
whiteSpace: "nowrap",
|
3394
|
+
width: "1px"
|
3395
|
+
}, t.style)
|
3396
|
+
}), t;
|
3397
|
+
}
|
3398
|
+
);
|
3399
|
+
G(function(t) {
|
3400
|
+
const r = Yo(t);
|
3401
|
+
return Q(Ra, r);
|
3402
|
+
});
|
3403
|
+
var Fa = "span", Na = Z(
|
3404
|
+
function(t) {
|
3405
|
+
return t = $(O({
|
3406
|
+
"data-focus-trap": "",
|
3407
|
+
tabIndex: 0,
|
3408
|
+
"aria-hidden": !0
|
3409
|
+
}, t), {
|
3410
|
+
style: O({
|
3411
|
+
// Prevents unintended scroll jumps.
|
3412
|
+
position: "fixed",
|
3413
|
+
top: 0,
|
3414
|
+
left: 0
|
3415
|
+
}, t.style)
|
3416
|
+
}), t = Yo(t), t;
|
3417
|
+
}
|
3418
|
+
), $t = G(function(t) {
|
3419
|
+
const r = Na(t);
|
3420
|
+
return Q(Fa, r);
|
3421
|
+
}), Mr = ge(null), Ma = "div";
|
3422
|
+
function ka(e) {
|
3423
|
+
return ne(e).body;
|
3424
|
+
}
|
3425
|
+
function Va(e, t) {
|
3426
|
+
return t ? typeof t == "function" ? t(e) : t : ne(e).createElement("div");
|
3427
|
+
}
|
3428
|
+
function $a(e = "id") {
|
3429
|
+
return `${e ? `${e}-` : ""}${Math.random().toString(36).slice(2, 8)}`;
|
3430
|
+
}
|
3431
|
+
function qe(e) {
|
3432
|
+
queueMicrotask(() => {
|
3433
|
+
e == null || e.focus();
|
3434
|
+
});
|
3435
|
+
}
|
3436
|
+
var Xo = Z(function(t) {
|
3437
|
+
var r = t, {
|
3438
|
+
preserveTabOrder: n,
|
3439
|
+
preserveTabOrderAnchor: o,
|
3440
|
+
portalElement: i,
|
3441
|
+
portalRef: s,
|
3442
|
+
portal: u = !0
|
3443
|
+
} = r, a = J(r, [
|
3444
|
+
"preserveTabOrder",
|
3445
|
+
"preserveTabOrderAnchor",
|
3446
|
+
"portalElement",
|
3447
|
+
"portalRef",
|
3448
|
+
"portal"
|
3449
|
+
]);
|
3450
|
+
const d = Y(null), f = de(d, a.ref), c = et(Mr), [l, p] = X(null), [b, g] = X(
|
3451
|
+
null
|
3452
|
+
), E = Y(null), w = Y(null), P = Y(null), h = Y(null);
|
3453
|
+
return ee(() => {
|
3454
|
+
const m = d.current;
|
3455
|
+
if (!m || !u) {
|
3456
|
+
p(null);
|
3457
|
+
return;
|
3458
|
+
}
|
3459
|
+
const y = Va(m, i);
|
3460
|
+
if (!y) {
|
3461
|
+
p(null);
|
3462
|
+
return;
|
3463
|
+
}
|
3464
|
+
const C = y.isConnected;
|
3465
|
+
if (C || (c || ka(m)).appendChild(y), y.id || (y.id = m.id ? `portal/${m.id}` : $a()), p(y), wn(s, y), !C)
|
3466
|
+
return () => {
|
3467
|
+
y.remove(), wn(s, null);
|
3468
|
+
};
|
3469
|
+
}, [u, i, c, s]), ee(() => {
|
3470
|
+
if (!u || !n || !o) return;
|
3471
|
+
const y = ne(o).createElement("span");
|
3472
|
+
return y.style.position = "fixed", o.insertAdjacentElement("afterend", y), g(y), () => {
|
3473
|
+
y.remove(), g(null);
|
3474
|
+
};
|
3475
|
+
}, [u, n, o]), W(() => {
|
3476
|
+
if (!l || !n) return;
|
3477
|
+
let m = 0;
|
3478
|
+
const y = (C) => {
|
3479
|
+
if (!pt(C)) return;
|
3480
|
+
const _ = C.type === "focusin";
|
3481
|
+
if (cancelAnimationFrame(m), _)
|
3482
|
+
return Qs(l);
|
3483
|
+
m = requestAnimationFrame(() => {
|
3484
|
+
Js(l, !0);
|
3485
|
+
});
|
3486
|
+
};
|
3487
|
+
return l.addEventListener("focusin", y, !0), l.addEventListener("focusout", y, !0), () => {
|
3488
|
+
cancelAnimationFrame(m), l.removeEventListener("focusin", y, !0), l.removeEventListener("focusout", y, !0);
|
3489
|
+
};
|
3490
|
+
}, [l, n]), a = le(
|
3491
|
+
a,
|
3492
|
+
(m) => {
|
3493
|
+
if (m = // While the portal node is not in the DOM, we need to pass the
|
3494
|
+
// current context to the portal context, otherwise it's going to
|
3495
|
+
// reset to the body element on nested portals.
|
3496
|
+
/* @__PURE__ */ M(Mr.Provider, { value: l || c, children: m }), !u) return m;
|
3497
|
+
if (!l)
|
3498
|
+
return /* @__PURE__ */ M(
|
3499
|
+
"span",
|
3500
|
+
{
|
3501
|
+
ref: f,
|
3502
|
+
id: a.id,
|
3503
|
+
style: { position: "fixed" },
|
3504
|
+
hidden: !0
|
3505
|
+
}
|
3506
|
+
);
|
3507
|
+
m = /* @__PURE__ */ Fe(mt, { children: [
|
3508
|
+
n && l && /* @__PURE__ */ M(
|
3509
|
+
$t,
|
3510
|
+
{
|
3511
|
+
ref: w,
|
3512
|
+
"data-focus-trap": a.id,
|
3513
|
+
className: "__focus-trap-inner-before",
|
3514
|
+
onFocus: (C) => {
|
3515
|
+
pt(C, l) ? qe(mn()) : qe(E.current);
|
3516
|
+
}
|
3517
|
+
}
|
3518
|
+
),
|
3519
|
+
m,
|
3520
|
+
n && l && /* @__PURE__ */ M(
|
3521
|
+
$t,
|
3522
|
+
{
|
3523
|
+
ref: P,
|
3524
|
+
"data-focus-trap": a.id,
|
3525
|
+
className: "__focus-trap-inner-after",
|
3526
|
+
onFocus: (C) => {
|
3527
|
+
pt(C, l) ? qe(xr()) : qe(h.current);
|
3528
|
+
}
|
3529
|
+
}
|
3530
|
+
)
|
3531
|
+
] }), l && (m = fr(m, l));
|
3532
|
+
let y = /* @__PURE__ */ Fe(mt, { children: [
|
3533
|
+
n && l && /* @__PURE__ */ M(
|
3534
|
+
$t,
|
3535
|
+
{
|
3536
|
+
ref: E,
|
3537
|
+
"data-focus-trap": a.id,
|
3538
|
+
className: "__focus-trap-outer-before",
|
3539
|
+
onFocus: (C) => {
|
3540
|
+
!(C.relatedTarget === h.current) && pt(C, l) ? qe(w.current) : qe(xr());
|
3541
|
+
}
|
3542
|
+
}
|
3543
|
+
),
|
3544
|
+
n && // We're using position: fixed here so that the browser doesn't
|
3545
|
+
// add margin to the element when setting gap on a parent element.
|
3546
|
+
/* @__PURE__ */ M("span", { "aria-owns": l == null ? void 0 : l.id, style: { position: "fixed" } }),
|
3547
|
+
n && l && /* @__PURE__ */ M(
|
3548
|
+
$t,
|
3549
|
+
{
|
3550
|
+
ref: h,
|
3551
|
+
"data-focus-trap": a.id,
|
3552
|
+
className: "__focus-trap-outer-after",
|
3553
|
+
onFocus: (C) => {
|
3554
|
+
if (pt(C, l))
|
3555
|
+
qe(P.current);
|
3556
|
+
else {
|
3557
|
+
const _ = mn();
|
3558
|
+
if (_ === w.current) {
|
3559
|
+
requestAnimationFrame(() => {
|
3560
|
+
var L;
|
3561
|
+
return (L = mn()) == null ? void 0 : L.focus();
|
3562
|
+
});
|
3563
|
+
return;
|
3564
|
+
}
|
3565
|
+
qe(_);
|
3566
|
+
}
|
3567
|
+
}
|
3568
|
+
}
|
3569
|
+
)
|
3570
|
+
] });
|
3571
|
+
return b && n && (y = fr(
|
3572
|
+
y,
|
3573
|
+
b
|
3574
|
+
)), /* @__PURE__ */ Fe(mt, { children: [
|
3575
|
+
y,
|
3576
|
+
m
|
3577
|
+
] });
|
3578
|
+
},
|
3579
|
+
[l, c, u, a.id, n, b]
|
3580
|
+
), a = $(O({}, a), {
|
3581
|
+
ref: f
|
3582
|
+
}), a;
|
3583
|
+
});
|
3584
|
+
G(function(t) {
|
3585
|
+
const r = Xo(t);
|
3586
|
+
return Q(Ma, r);
|
3587
|
+
});
|
3588
|
+
var Ba = "div", kr = kn();
|
3589
|
+
function Ka(e) {
|
3590
|
+
const t = We();
|
3591
|
+
return !t || e && se(e, t) ? !1 : !!De(t);
|
3592
|
+
}
|
3593
|
+
function Vr(e, t = !1) {
|
3594
|
+
if (!e) return null;
|
3595
|
+
const r = "current" in e ? e.current : e;
|
3596
|
+
return r ? t ? De(r) ? r : null : r : null;
|
3597
|
+
}
|
3598
|
+
var Jo = Z(function(t) {
|
3599
|
+
var r = t, {
|
3600
|
+
store: n,
|
3601
|
+
open: o,
|
3602
|
+
onClose: i,
|
3603
|
+
focusable: s = !0,
|
3604
|
+
modal: u = !0,
|
3605
|
+
portal: a = !!u,
|
3606
|
+
backdrop: d = !!u,
|
3607
|
+
hideOnEscape: f = !0,
|
3608
|
+
hideOnInteractOutside: c = !0,
|
3609
|
+
getPersistentElements: l,
|
3610
|
+
preventBodyScroll: p = !!u,
|
3611
|
+
autoFocusOnShow: b = !0,
|
3612
|
+
autoFocusOnHide: g = !0,
|
3613
|
+
initialFocus: E,
|
3614
|
+
finalFocus: w,
|
3615
|
+
unmountOnHide: P,
|
3616
|
+
unstable_treeSnapshotKey: h
|
3617
|
+
} = r, m = J(r, [
|
3618
|
+
"store",
|
3619
|
+
"open",
|
3620
|
+
"onClose",
|
3621
|
+
"focusable",
|
3622
|
+
"modal",
|
3623
|
+
"portal",
|
3624
|
+
"backdrop",
|
3625
|
+
"hideOnEscape",
|
3626
|
+
"hideOnInteractOutside",
|
3627
|
+
"getPersistentElements",
|
3628
|
+
"preventBodyScroll",
|
3629
|
+
"autoFocusOnShow",
|
3630
|
+
"autoFocusOnHide",
|
3631
|
+
"initialFocus",
|
3632
|
+
"finalFocus",
|
3633
|
+
"unmountOnHide",
|
3634
|
+
"unstable_treeSnapshotKey"
|
3635
|
+
]);
|
3636
|
+
const y = Qt(), C = Y(null), _ = Ns({
|
3637
|
+
store: n || y,
|
3638
|
+
open: o,
|
3639
|
+
setOpen(V) {
|
3640
|
+
if (V) return;
|
3641
|
+
const z = C.current;
|
3642
|
+
if (!z) return;
|
3643
|
+
const ae = new Event("close", { bubbles: !1, cancelable: !0 });
|
3644
|
+
i && z.addEventListener("close", i, { once: !0 }), z.dispatchEvent(ae), ae.defaultPrevented && _.setOpen(!0);
|
3645
|
+
}
|
3646
|
+
}), { portalRef: L, domReady: S } = co(a, m.portalRef), A = m.preserveTabOrder, F = _e(
|
3647
|
+
_,
|
3648
|
+
(V) => A && !u && V.mounted
|
3649
|
+
), N = ot(m.id), I = _e(_, "open"), T = _e(_, "mounted"), D = _e(_, "contentElement"), v = nr(T, m.hidden, m.alwaysVisible);
|
3650
|
+
xa(D, N, p && !v), Da(_, c, S);
|
3651
|
+
const { wrapElement: R, nestedDialogs: K } = Pa(_);
|
3652
|
+
m = le(m, R, [R]), ee(() => {
|
3653
|
+
if (!I) return;
|
3654
|
+
const V = C.current, z = We(V, !0);
|
3655
|
+
z && z.tagName !== "BODY" && (V && se(V, z) || _.setDisclosureElement(z));
|
3656
|
+
}, [_, I]), kr && W(() => {
|
3657
|
+
if (!T) return;
|
3658
|
+
const { disclosureElement: V } = _.getState();
|
3659
|
+
if (!V || !Xe(V)) return;
|
3660
|
+
const z = () => {
|
3661
|
+
let ae = !1;
|
3662
|
+
const q = () => {
|
3663
|
+
ae = !0;
|
3664
|
+
}, Se = { capture: !0, once: !0 };
|
3665
|
+
V.addEventListener("focusin", q, Se), vt(V, "mouseup", () => {
|
3666
|
+
V.removeEventListener("focusin", q, !0), !ae && Do(V);
|
3667
|
+
});
|
3668
|
+
};
|
3669
|
+
return V.addEventListener("mousedown", z), () => {
|
3670
|
+
V.removeEventListener("mousedown", z);
|
3671
|
+
};
|
3672
|
+
}, [_, T]), W(() => {
|
3673
|
+
if (!T || !S) return;
|
3674
|
+
const V = C.current;
|
3675
|
+
if (!V) return;
|
3676
|
+
const z = no(V), ae = z.visualViewport || z, q = () => {
|
3677
|
+
var Se, Re;
|
3678
|
+
const Et = (Re = (Se = z.visualViewport) == null ? void 0 : Se.height) != null ? Re : z.innerHeight;
|
3679
|
+
V.style.setProperty("--dialog-viewport-height", `${Et}px`);
|
3680
|
+
};
|
3681
|
+
return q(), ae.addEventListener("resize", q), () => {
|
3682
|
+
ae.removeEventListener("resize", q);
|
3683
|
+
};
|
3684
|
+
}, [T, S]), W(() => {
|
3685
|
+
if (!u || !T || !S) return;
|
3686
|
+
const V = C.current;
|
3687
|
+
if (!(!V || V.querySelector("[data-dialog-dismiss]")))
|
3688
|
+
return Aa(V, _.hide);
|
3689
|
+
}, [_, u, T, S]), ee(() => {
|
3690
|
+
if (!jo() || I || !T || !S) return;
|
3691
|
+
const V = C.current;
|
3692
|
+
if (V)
|
3693
|
+
return qo(V);
|
3694
|
+
}, [I, T, S]);
|
3695
|
+
const x = I && S;
|
3696
|
+
ee(() => {
|
3697
|
+
if (!N || !x) return;
|
3698
|
+
const V = C.current;
|
3699
|
+
return pa(N, [V]);
|
3700
|
+
}, [N, x, h]);
|
3701
|
+
const k = j(l);
|
3702
|
+
ee(() => {
|
3703
|
+
if (!N || !x) return;
|
3704
|
+
const { disclosureElement: V } = _.getState(), z = C.current, ae = k() || [], q = [
|
3705
|
+
z,
|
3706
|
+
...ae,
|
3707
|
+
...K.map((Se) => Se.getState().contentElement)
|
3708
|
+
];
|
3709
|
+
return u ? Te(
|
3710
|
+
Fr(N, q),
|
3711
|
+
Sa(N, q)
|
3712
|
+
) : Fr(N, [V, ...q]);
|
3713
|
+
}, [
|
3714
|
+
N,
|
3715
|
+
_,
|
3716
|
+
x,
|
3717
|
+
k,
|
3718
|
+
K,
|
3719
|
+
u,
|
3720
|
+
h
|
3721
|
+
]);
|
3722
|
+
const B = !!b, H = fe(b), [ie, oe] = X(!1);
|
3723
|
+
W(() => {
|
3724
|
+
if (!I || !B || !S || !(D != null && D.isConnected)) return;
|
3725
|
+
const V = Vr(E, !0) || // If no initial focus is specified, we try to focus the first element
|
3726
|
+
// with the autofocus attribute. If it's an Ariakit component, the
|
3727
|
+
// Focusable component will consume the autoFocus prop and add the
|
3728
|
+
// data-autofocus attribute to the element instead.
|
3729
|
+
D.querySelector(
|
3730
|
+
"[data-autofocus=true],[autofocus]"
|
3731
|
+
) || // We have to fallback to the first focusable element otherwise portaled
|
3732
|
+
// dialogs with preserveTabOrder set to true will not receive focus
|
3733
|
+
// properly because the elements aren't tabbable until the dialog receives
|
3734
|
+
// focus.
|
3735
|
+
js(D, !0, a && F) || // Finally, we fallback to the dialog element itself.
|
3736
|
+
D, z = De(V);
|
3737
|
+
H(z ? V : null) && (oe(!0), queueMicrotask(() => {
|
3738
|
+
V.focus(), kr && V.scrollIntoView({ block: "nearest", inline: "nearest" });
|
3739
|
+
}));
|
3740
|
+
}, [
|
3741
|
+
I,
|
3742
|
+
B,
|
3743
|
+
S,
|
3744
|
+
D,
|
3745
|
+
E,
|
3746
|
+
a,
|
3747
|
+
F,
|
3748
|
+
H
|
3749
|
+
]);
|
3750
|
+
const re = !!g, be = fe(g), [Ue, ye] = X(!1);
|
3751
|
+
W(() => {
|
3752
|
+
if (I)
|
3753
|
+
return ye(!0), () => ye(!1);
|
3754
|
+
}, [I]);
|
3755
|
+
const Ie = xe(
|
3756
|
+
(V, z = !0) => {
|
3757
|
+
const { disclosureElement: ae } = _.getState();
|
3758
|
+
if (Ka(V)) return;
|
3759
|
+
let q = Vr(w) || ae;
|
3760
|
+
if (q != null && q.id) {
|
3761
|
+
const Re = ne(q), Et = `[aria-activedescendant="${q.id}"]`, Ft = Re.querySelector(Et);
|
3762
|
+
Ft && (q = Ft);
|
3763
|
+
}
|
3764
|
+
if (q && !De(q)) {
|
3765
|
+
const Re = q.closest("[data-dialog]");
|
3766
|
+
if (Re != null && Re.id) {
|
3767
|
+
const Et = ne(Re), Ft = `[aria-controls~="${Re.id}"]`, lr = Et.querySelector(Ft);
|
3768
|
+
lr && (q = lr);
|
3769
|
+
}
|
3770
|
+
}
|
3771
|
+
const Se = q && De(q);
|
3772
|
+
if (!Se && z) {
|
3773
|
+
requestAnimationFrame(() => Ie(V, !1));
|
3774
|
+
return;
|
3775
|
+
}
|
3776
|
+
be(Se ? q : null) && Se && (q == null || q.focus());
|
3777
|
+
},
|
3778
|
+
[_, w, be]
|
3779
|
+
), ue = Y(!1);
|
3780
|
+
ee(() => {
|
3781
|
+
if (I || !Ue || !re) return;
|
3782
|
+
const V = C.current;
|
3783
|
+
ue.current = !0, Ie(V);
|
3784
|
+
}, [I, Ue, S, re, Ie]), W(() => {
|
3785
|
+
if (!Ue || !re) return;
|
3786
|
+
const V = C.current;
|
3787
|
+
return () => {
|
3788
|
+
if (ue.current) {
|
3789
|
+
ue.current = !1;
|
3790
|
+
return;
|
3791
|
+
}
|
3792
|
+
Ie(V);
|
3793
|
+
};
|
3794
|
+
}, [Ue, re, Ie]);
|
3795
|
+
const ut = fe(f);
|
3796
|
+
W(() => !S || !T ? void 0 : Ce("keydown", (z) => {
|
3797
|
+
if (z.key !== "Escape" || z.defaultPrevented) return;
|
3798
|
+
const ae = C.current;
|
3799
|
+
if (!ae || sr(ae)) return;
|
3800
|
+
const q = z.target;
|
3801
|
+
if (!q) return;
|
3802
|
+
const { disclosureElement: Se } = _.getState();
|
3803
|
+
!!(q.tagName === "BODY" || se(ae, q) || !Se || se(Se, q)) && ut(z) && _.hide();
|
3804
|
+
}, !0), [_, S, T, ut]), m = le(
|
3805
|
+
m,
|
3806
|
+
(V) => /* @__PURE__ */ M(La, { level: u ? 1 : void 0, children: V }),
|
3807
|
+
[u]
|
3808
|
+
);
|
3809
|
+
const at = m.hidden, Me = m.alwaysVisible;
|
3810
|
+
m = le(
|
3811
|
+
m,
|
3812
|
+
(V) => d ? /* @__PURE__ */ Fe(mt, { children: [
|
3813
|
+
/* @__PURE__ */ M(
|
3814
|
+
ha,
|
3815
|
+
{
|
3816
|
+
store: _,
|
3817
|
+
backdrop: d,
|
3818
|
+
hidden: at,
|
3819
|
+
alwaysVisible: Me
|
3820
|
+
}
|
3821
|
+
),
|
3822
|
+
V
|
3823
|
+
] }) : V,
|
3824
|
+
[_, d, at, Me]
|
3825
|
+
);
|
3826
|
+
const [je, ct] = X(), [lt, ft] = X();
|
3827
|
+
return m = le(
|
3828
|
+
m,
|
3829
|
+
(V) => /* @__PURE__ */ M(Un, { value: _, children: /* @__PURE__ */ M(fs.Provider, { value: ct, children: /* @__PURE__ */ M(ds.Provider, { value: ft, children: V }) }) }),
|
3830
|
+
[_]
|
3831
|
+
), m = $(O({
|
3832
|
+
id: N,
|
3833
|
+
"data-dialog": "",
|
3834
|
+
role: "dialog",
|
3835
|
+
tabIndex: s ? -1 : void 0,
|
3836
|
+
"aria-labelledby": je,
|
3837
|
+
"aria-describedby": lt
|
3838
|
+
}, m), {
|
3839
|
+
ref: de(C, m.ref)
|
3840
|
+
}), m = Go($(O({}, m), {
|
3841
|
+
autoFocusOnShow: ie
|
3842
|
+
})), m = rr(O({ store: _ }, m)), m = on($(O({}, m), { focusable: s })), m = Xo($(O({ portal: a }, m), { portalRef: L, preserveTabOrder: F })), m;
|
3843
|
+
});
|
3844
|
+
function ur(e, t = Qt) {
|
3845
|
+
return G(function(n) {
|
3846
|
+
const o = t(), i = n.store || o;
|
3847
|
+
return _e(
|
3848
|
+
i,
|
3849
|
+
(u) => !n.unmountOnHide || (u == null ? void 0 : u.mounted) || !!n.open
|
3850
|
+
) ? /* @__PURE__ */ M(e, O({}, n)) : null;
|
3851
|
+
});
|
3852
|
+
}
|
3853
|
+
ur(
|
3854
|
+
G(function(t) {
|
3855
|
+
const r = Jo(t);
|
3856
|
+
return Q(Ba, r);
|
3857
|
+
}),
|
3858
|
+
Qt
|
3859
|
+
);
|
3860
|
+
function wt(e) {
|
3861
|
+
return e.split("-")[1];
|
3862
|
+
}
|
3863
|
+
function ar(e) {
|
3864
|
+
return e === "y" ? "height" : "width";
|
3865
|
+
}
|
3866
|
+
function Be(e) {
|
3867
|
+
return e.split("-")[0];
|
3868
|
+
}
|
3869
|
+
function st(e) {
|
3870
|
+
return ["top", "bottom"].includes(Be(e)) ? "x" : "y";
|
3871
|
+
}
|
3872
|
+
function $r(e, t, r) {
|
3873
|
+
let { reference: n, floating: o } = e;
|
3874
|
+
const i = n.x + n.width / 2 - o.width / 2, s = n.y + n.height / 2 - o.height / 2, u = st(t), a = ar(u), d = n[a] / 2 - o[a] / 2, f = u === "x";
|
3875
|
+
let c;
|
3876
|
+
switch (Be(t)) {
|
3877
|
+
case "top":
|
3878
|
+
c = { x: i, y: n.y - o.height };
|
3879
|
+
break;
|
3880
|
+
case "bottom":
|
3881
|
+
c = { x: i, y: n.y + n.height };
|
3882
|
+
break;
|
3883
|
+
case "right":
|
3884
|
+
c = { x: n.x + n.width, y: s };
|
3885
|
+
break;
|
3886
|
+
case "left":
|
3887
|
+
c = { x: n.x - o.width, y: s };
|
3888
|
+
break;
|
3889
|
+
default:
|
3890
|
+
c = { x: n.x, y: n.y };
|
3891
|
+
}
|
3892
|
+
switch (wt(t)) {
|
3893
|
+
case "start":
|
3894
|
+
c[u] -= d * (r && f ? -1 : 1);
|
3895
|
+
break;
|
3896
|
+
case "end":
|
3897
|
+
c[u] += d * (r && f ? -1 : 1);
|
3898
|
+
}
|
3899
|
+
return c;
|
3900
|
+
}
|
3901
|
+
const Ha = async (e, t, r) => {
|
3902
|
+
const { placement: n = "bottom", strategy: o = "absolute", middleware: i = [], platform: s } = r, u = i.filter(Boolean), a = await (s.isRTL == null ? void 0 : s.isRTL(t));
|
3903
|
+
let d = await s.getElementRects({ reference: e, floating: t, strategy: o }), { x: f, y: c } = $r(d, n, a), l = n, p = {}, b = 0;
|
3904
|
+
for (let g = 0; g < u.length; g++) {
|
3905
|
+
const { name: E, fn: w } = u[g], { x: P, y: h, data: m, reset: y } = await w({ x: f, y: c, initialPlacement: n, placement: l, strategy: o, middlewareData: p, rects: d, platform: s, elements: { reference: e, floating: t } });
|
3906
|
+
f = P ?? f, c = h ?? c, p = { ...p, [E]: { ...p[E], ...m } }, y && b <= 50 && (b++, typeof y == "object" && (y.placement && (l = y.placement), y.rects && (d = y.rects === !0 ? await s.getElementRects({ reference: e, floating: t, strategy: o }) : y.rects), { x: f, y: c } = $r(d, l, a)), g = -1);
|
3907
|
+
}
|
3908
|
+
return { x: f, y: c, placement: l, strategy: o, middlewareData: p };
|
3909
|
+
};
|
3910
|
+
function Qo(e) {
|
3911
|
+
return typeof e != "number" ? function(t) {
|
3912
|
+
return { top: 0, right: 0, bottom: 0, left: 0, ...t };
|
3913
|
+
}(e) : { top: e, right: e, bottom: e, left: e };
|
3914
|
+
}
|
3915
|
+
function qt(e) {
|
3916
|
+
return { ...e, top: e.y, left: e.x, right: e.x + e.width, bottom: e.y + e.height };
|
3917
|
+
}
|
3918
|
+
async function cr(e, t) {
|
3919
|
+
var r;
|
3920
|
+
t === void 0 && (t = {});
|
3921
|
+
const { x: n, y: o, platform: i, rects: s, elements: u, strategy: a } = e, { boundary: d = "clippingAncestors", rootBoundary: f = "viewport", elementContext: c = "floating", altBoundary: l = !1, padding: p = 0 } = t, b = Qo(p), g = u[l ? c === "floating" ? "reference" : "floating" : c], E = qt(await i.getClippingRect({ element: (r = await (i.isElement == null ? void 0 : i.isElement(g))) == null || r ? g : g.contextElement || await (i.getDocumentElement == null ? void 0 : i.getDocumentElement(u.floating)), boundary: d, rootBoundary: f, strategy: a })), w = c === "floating" ? { ...s.floating, x: n, y: o } : s.reference, P = await (i.getOffsetParent == null ? void 0 : i.getOffsetParent(u.floating)), h = await (i.isElement == null ? void 0 : i.isElement(P)) && await (i.getScale == null ? void 0 : i.getScale(P)) || { x: 1, y: 1 }, m = qt(i.convertOffsetParentRelativeRectToViewportRelativeRect ? await i.convertOffsetParentRelativeRectToViewportRelativeRect({ rect: w, offsetParent: P, strategy: a }) : w);
|
3922
|
+
return { top: (E.top - m.top + b.top) / h.y, bottom: (m.bottom - E.bottom + b.bottom) / h.y, left: (E.left - m.left + b.left) / h.x, right: (m.right - E.right + b.right) / h.x };
|
3923
|
+
}
|
3924
|
+
const An = Math.min, Ze = Math.max;
|
3925
|
+
function Tn(e, t, r) {
|
3926
|
+
return Ze(e, An(t, r));
|
3927
|
+
}
|
3928
|
+
const Wa = (e) => ({ name: "arrow", options: e, async fn(t) {
|
3929
|
+
const { element: r, padding: n = 0 } = e, { x: o, y: i, placement: s, rects: u, platform: a, elements: d } = t;
|
3930
|
+
if (r == null) return {};
|
3931
|
+
const f = Qo(n), c = { x: o, y: i }, l = st(s), p = ar(l), b = await a.getDimensions(r), g = l === "y", E = g ? "top" : "left", w = g ? "bottom" : "right", P = g ? "clientHeight" : "clientWidth", h = u.reference[p] + u.reference[l] - c[l] - u.floating[p], m = c[l] - u.reference[l], y = await (a.getOffsetParent == null ? void 0 : a.getOffsetParent(r));
|
3932
|
+
let C = y ? y[P] : 0;
|
3933
|
+
C && await (a.isElement == null ? void 0 : a.isElement(y)) || (C = d.floating[P] || u.floating[p]);
|
3934
|
+
const _ = h / 2 - m / 2, L = f[E], S = C - b[p] - f[w], A = C / 2 - b[p] / 2 + _, F = Tn(L, A, S), N = wt(s) != null && A != F && u.reference[p] / 2 - (A < L ? f[E] : f[w]) - b[p] / 2 < 0;
|
3935
|
+
return { [l]: c[l] - (N ? A < L ? L - A : S - A : 0), data: { [l]: F, centerOffset: A - F } };
|
3936
|
+
} }), za = ["top", "right", "bottom", "left"];
|
3937
|
+
za.reduce((e, t) => e.concat(t, t + "-start", t + "-end"), []);
|
3938
|
+
const Ua = { left: "right", right: "left", bottom: "top", top: "bottom" };
|
3939
|
+
function Gt(e) {
|
3940
|
+
return e.replace(/left|right|bottom|top/g, (t) => Ua[t]);
|
3941
|
+
}
|
3942
|
+
function ja(e, t, r) {
|
3943
|
+
r === void 0 && (r = !1);
|
3944
|
+
const n = wt(e), o = st(e), i = ar(o);
|
3945
|
+
let s = o === "x" ? n === (r ? "end" : "start") ? "right" : "left" : n === "start" ? "bottom" : "top";
|
3946
|
+
return t.reference[i] > t.floating[i] && (s = Gt(s)), { main: s, cross: Gt(s) };
|
3947
|
+
}
|
3948
|
+
const qa = { start: "end", end: "start" };
|
3949
|
+
function Sn(e) {
|
3950
|
+
return e.replace(/start|end/g, (t) => qa[t]);
|
3951
|
+
}
|
3952
|
+
const Ga = function(e) {
|
3953
|
+
return e === void 0 && (e = {}), { name: "flip", options: e, async fn(t) {
|
3954
|
+
var r;
|
3955
|
+
const { placement: n, middlewareData: o, rects: i, initialPlacement: s, platform: u, elements: a } = t, { mainAxis: d = !0, crossAxis: f = !0, fallbackPlacements: c, fallbackStrategy: l = "bestFit", fallbackAxisSideDirection: p = "none", flipAlignment: b = !0, ...g } = e, E = Be(n), w = Be(s) === s, P = await (u.isRTL == null ? void 0 : u.isRTL(a.floating)), h = c || (w || !b ? [Gt(s)] : function(F) {
|
3956
|
+
const N = Gt(F);
|
3957
|
+
return [Sn(F), N, Sn(N)];
|
3958
|
+
}(s));
|
3959
|
+
c || p === "none" || h.push(...function(F, N, I, T) {
|
3960
|
+
const D = wt(F);
|
3961
|
+
let v = function(R, K, x) {
|
3962
|
+
const k = ["left", "right"], B = ["right", "left"], H = ["top", "bottom"], ie = ["bottom", "top"];
|
3963
|
+
switch (R) {
|
3964
|
+
case "top":
|
3965
|
+
case "bottom":
|
3966
|
+
return x ? K ? B : k : K ? k : B;
|
3967
|
+
case "left":
|
3968
|
+
case "right":
|
3969
|
+
return K ? H : ie;
|
3970
|
+
default:
|
3971
|
+
return [];
|
3972
|
+
}
|
3973
|
+
}(Be(F), I === "start", T);
|
3974
|
+
return D && (v = v.map((R) => R + "-" + D), N && (v = v.concat(v.map(Sn)))), v;
|
3975
|
+
}(s, b, p, P));
|
3976
|
+
const m = [s, ...h], y = await cr(t, g), C = [];
|
3977
|
+
let _ = ((r = o.flip) == null ? void 0 : r.overflows) || [];
|
3978
|
+
if (d && C.push(y[E]), f) {
|
3979
|
+
const { main: F, cross: N } = ja(n, i, P);
|
3980
|
+
C.push(y[F], y[N]);
|
3981
|
+
}
|
3982
|
+
if (_ = [..._, { placement: n, overflows: C }], !C.every((F) => F <= 0)) {
|
3983
|
+
var L, S;
|
3984
|
+
const F = (((L = o.flip) == null ? void 0 : L.index) || 0) + 1, N = m[F];
|
3985
|
+
if (N) return { data: { index: F, overflows: _ }, reset: { placement: N } };
|
3986
|
+
let I = (S = _.filter((T) => T.overflows[0] <= 0).sort((T, D) => T.overflows[1] - D.overflows[1])[0]) == null ? void 0 : S.placement;
|
3987
|
+
if (!I) switch (l) {
|
3988
|
+
case "bestFit": {
|
3989
|
+
var A;
|
3990
|
+
const T = (A = _.map((D) => [D.placement, D.overflows.filter((v) => v > 0).reduce((v, R) => v + R, 0)]).sort((D, v) => D[1] - v[1])[0]) == null ? void 0 : A[0];
|
3991
|
+
T && (I = T);
|
3992
|
+
break;
|
3993
|
+
}
|
3994
|
+
case "initialPlacement":
|
3995
|
+
I = s;
|
3996
|
+
}
|
3997
|
+
if (n !== I) return { reset: { placement: I } };
|
3998
|
+
}
|
3999
|
+
return {};
|
4000
|
+
} };
|
4001
|
+
}, Ya = function(e) {
|
4002
|
+
return e === void 0 && (e = 0), { name: "offset", options: e, async fn(t) {
|
4003
|
+
const { x: r, y: n } = t, o = await async function(i, s) {
|
4004
|
+
const { placement: u, platform: a, elements: d } = i, f = await (a.isRTL == null ? void 0 : a.isRTL(d.floating)), c = Be(u), l = wt(u), p = st(u) === "x", b = ["left", "top"].includes(c) ? -1 : 1, g = f && p ? -1 : 1, E = typeof s == "function" ? s(i) : s;
|
4005
|
+
let { mainAxis: w, crossAxis: P, alignmentAxis: h } = typeof E == "number" ? { mainAxis: E, crossAxis: 0, alignmentAxis: null } : { mainAxis: 0, crossAxis: 0, alignmentAxis: null, ...E };
|
4006
|
+
return l && typeof h == "number" && (P = l === "end" ? -1 * h : h), p ? { x: P * g, y: w * b } : { x: w * b, y: P * g };
|
4007
|
+
}(t, e);
|
4008
|
+
return { x: r + o.x, y: n + o.y, data: o };
|
4009
|
+
} };
|
4010
|
+
};
|
4011
|
+
function Zo(e) {
|
4012
|
+
return e === "x" ? "y" : "x";
|
4013
|
+
}
|
4014
|
+
const Xa = function(e) {
|
4015
|
+
return e === void 0 && (e = {}), { name: "shift", options: e, async fn(t) {
|
4016
|
+
const { x: r, y: n, placement: o } = t, { mainAxis: i = !0, crossAxis: s = !1, limiter: u = { fn: (E) => {
|
4017
|
+
let { x: w, y: P } = E;
|
4018
|
+
return { x: w, y: P };
|
4019
|
+
} }, ...a } = e, d = { x: r, y: n }, f = await cr(t, a), c = st(Be(o)), l = Zo(c);
|
4020
|
+
let p = d[c], b = d[l];
|
4021
|
+
if (i) {
|
4022
|
+
const E = c === "y" ? "bottom" : "right";
|
4023
|
+
p = Tn(p + f[c === "y" ? "top" : "left"], p, p - f[E]);
|
4024
|
+
}
|
4025
|
+
if (s) {
|
4026
|
+
const E = l === "y" ? "bottom" : "right";
|
4027
|
+
b = Tn(b + f[l === "y" ? "top" : "left"], b, b - f[E]);
|
4028
|
+
}
|
4029
|
+
const g = u.fn({ ...t, [c]: p, [l]: b });
|
4030
|
+
return { ...g, data: { x: g.x - r, y: g.y - n } };
|
4031
|
+
} };
|
4032
|
+
}, Ja = function(e) {
|
4033
|
+
return e === void 0 && (e = {}), { options: e, fn(t) {
|
4034
|
+
const { x: r, y: n, placement: o, rects: i, middlewareData: s } = t, { offset: u = 0, mainAxis: a = !0, crossAxis: d = !0 } = e, f = { x: r, y: n }, c = st(o), l = Zo(c);
|
4035
|
+
let p = f[c], b = f[l];
|
4036
|
+
const g = typeof u == "function" ? u(t) : u, E = typeof g == "number" ? { mainAxis: g, crossAxis: 0 } : { mainAxis: 0, crossAxis: 0, ...g };
|
4037
|
+
if (a) {
|
4038
|
+
const h = c === "y" ? "height" : "width", m = i.reference[c] - i.floating[h] + E.mainAxis, y = i.reference[c] + i.reference[h] - E.mainAxis;
|
4039
|
+
p < m ? p = m : p > y && (p = y);
|
4040
|
+
}
|
4041
|
+
if (d) {
|
4042
|
+
var w, P;
|
4043
|
+
const h = c === "y" ? "width" : "height", m = ["top", "left"].includes(Be(o)), y = i.reference[l] - i.floating[h] + (m && ((w = s.offset) == null ? void 0 : w[l]) || 0) + (m ? 0 : E.crossAxis), C = i.reference[l] + i.reference[h] + (m ? 0 : ((P = s.offset) == null ? void 0 : P[l]) || 0) - (m ? E.crossAxis : 0);
|
4044
|
+
b < y ? b = y : b > C && (b = C);
|
4045
|
+
}
|
4046
|
+
return { [c]: p, [l]: b };
|
4047
|
+
} };
|
4048
|
+
}, Qa = function(e) {
|
4049
|
+
return e === void 0 && (e = {}), { name: "size", options: e, async fn(t) {
|
4050
|
+
const { placement: r, rects: n, platform: o, elements: i } = t, { apply: s = () => {
|
4051
|
+
}, ...u } = e, a = await cr(t, u), d = Be(r), f = wt(r), c = st(r) === "x", { width: l, height: p } = n.floating;
|
4052
|
+
let b, g;
|
4053
|
+
d === "top" || d === "bottom" ? (b = d, g = f === (await (o.isRTL == null ? void 0 : o.isRTL(i.floating)) ? "start" : "end") ? "left" : "right") : (g = d, b = f === "end" ? "top" : "bottom");
|
4054
|
+
const E = p - a[b], w = l - a[g], P = !t.middlewareData.shift;
|
4055
|
+
let h = E, m = w;
|
4056
|
+
if (c) {
|
4057
|
+
const C = l - a.left - a.right;
|
4058
|
+
m = f || P ? An(w, C) : C;
|
4059
|
+
} else {
|
4060
|
+
const C = p - a.top - a.bottom;
|
4061
|
+
h = f || P ? An(E, C) : C;
|
4062
|
+
}
|
4063
|
+
if (P && !f) {
|
4064
|
+
const C = Ze(a.left, 0), _ = Ze(a.right, 0), L = Ze(a.top, 0), S = Ze(a.bottom, 0);
|
4065
|
+
c ? m = l - 2 * (C !== 0 || _ !== 0 ? C + _ : Ze(a.left, a.right)) : h = p - 2 * (L !== 0 || S !== 0 ? L + S : Ze(a.top, a.bottom));
|
4066
|
+
}
|
4067
|
+
await s({ ...t, availableWidth: m, availableHeight: h });
|
4068
|
+
const y = await o.getDimensions(i.floating);
|
4069
|
+
return l !== y.width || p !== y.height ? { reset: { rects: !0 } } : {};
|
4070
|
+
} };
|
4071
|
+
};
|
4072
|
+
function we(e) {
|
4073
|
+
var t;
|
4074
|
+
return ((t = e.ownerDocument) == null ? void 0 : t.defaultView) || window;
|
4075
|
+
}
|
4076
|
+
function Ae(e) {
|
4077
|
+
return we(e).getComputedStyle(e);
|
4078
|
+
}
|
4079
|
+
function ei(e) {
|
4080
|
+
return e instanceof we(e).Node;
|
4081
|
+
}
|
4082
|
+
function Je(e) {
|
4083
|
+
return ei(e) ? (e.nodeName || "").toLowerCase() : "";
|
4084
|
+
}
|
4085
|
+
let Bt;
|
4086
|
+
function ti() {
|
4087
|
+
if (Bt) return Bt;
|
4088
|
+
const e = navigator.userAgentData;
|
4089
|
+
return e && Array.isArray(e.brands) ? (Bt = e.brands.map((t) => t.brand + "/" + t.version).join(" "), Bt) : navigator.userAgent;
|
4090
|
+
}
|
4091
|
+
function Le(e) {
|
4092
|
+
return e instanceof we(e).HTMLElement;
|
4093
|
+
}
|
4094
|
+
function Ee(e) {
|
4095
|
+
return e instanceof we(e).Element;
|
4096
|
+
}
|
4097
|
+
function Br(e) {
|
4098
|
+
return typeof ShadowRoot > "u" ? !1 : e instanceof we(e).ShadowRoot || e instanceof ShadowRoot;
|
4099
|
+
}
|
4100
|
+
function Ot(e) {
|
4101
|
+
const { overflow: t, overflowX: r, overflowY: n, display: o } = Ae(e);
|
4102
|
+
return /auto|scroll|overlay|hidden|clip/.test(t + n + r) && !["inline", "contents"].includes(o);
|
4103
|
+
}
|
4104
|
+
function Za(e) {
|
4105
|
+
return ["table", "td", "th"].includes(Je(e));
|
4106
|
+
}
|
4107
|
+
function Ln(e) {
|
4108
|
+
const t = /firefox/i.test(ti()), r = Ae(e), n = r.backdropFilter || r.WebkitBackdropFilter;
|
4109
|
+
return r.transform !== "none" || r.perspective !== "none" || !!n && n !== "none" || t && r.willChange === "filter" || t && !!r.filter && r.filter !== "none" || ["transform", "perspective"].some((o) => r.willChange.includes(o)) || ["paint", "layout", "strict", "content"].some((o) => {
|
4110
|
+
const i = r.contain;
|
4111
|
+
return i != null && i.includes(o);
|
4112
|
+
});
|
4113
|
+
}
|
4114
|
+
function Rn() {
|
4115
|
+
return /^((?!chrome|android).)*safari/i.test(ti());
|
4116
|
+
}
|
4117
|
+
function sn(e) {
|
4118
|
+
return ["html", "body", "#document"].includes(Je(e));
|
4119
|
+
}
|
4120
|
+
const Kr = Math.min, Pt = Math.max, Yt = Math.round;
|
4121
|
+
function ni(e) {
|
4122
|
+
const t = Ae(e);
|
4123
|
+
let r = parseFloat(t.width) || 0, n = parseFloat(t.height) || 0;
|
4124
|
+
const o = Le(e), i = o ? e.offsetWidth : r, s = o ? e.offsetHeight : n, u = Yt(r) !== i || Yt(n) !== s;
|
4125
|
+
return u && (r = i, n = s), { width: r, height: n, fallback: u };
|
4126
|
+
}
|
4127
|
+
function ri(e) {
|
4128
|
+
return Ee(e) ? e : e.contextElement;
|
4129
|
+
}
|
4130
|
+
const oi = { x: 1, y: 1 };
|
4131
|
+
function gt(e) {
|
4132
|
+
const t = ri(e);
|
4133
|
+
if (!Le(t)) return oi;
|
4134
|
+
const r = t.getBoundingClientRect(), { width: n, height: o, fallback: i } = ni(t);
|
4135
|
+
let s = (i ? Yt(r.width) : r.width) / n, u = (i ? Yt(r.height) : r.height) / o;
|
4136
|
+
return s && Number.isFinite(s) || (s = 1), u && Number.isFinite(u) || (u = 1), { x: s, y: u };
|
4137
|
+
}
|
4138
|
+
function nt(e, t, r, n) {
|
4139
|
+
var o, i;
|
4140
|
+
t === void 0 && (t = !1), r === void 0 && (r = !1);
|
4141
|
+
const s = e.getBoundingClientRect(), u = ri(e);
|
4142
|
+
let a = oi;
|
4143
|
+
t && (n ? Ee(n) && (a = gt(n)) : a = gt(e));
|
4144
|
+
const d = u ? we(u) : window, f = Rn() && r;
|
4145
|
+
let c = (s.left + (f && ((o = d.visualViewport) == null ? void 0 : o.offsetLeft) || 0)) / a.x, l = (s.top + (f && ((i = d.visualViewport) == null ? void 0 : i.offsetTop) || 0)) / a.y, p = s.width / a.x, b = s.height / a.y;
|
4146
|
+
if (u) {
|
4147
|
+
const g = we(u), E = n && Ee(n) ? we(n) : n;
|
4148
|
+
let w = g.frameElement;
|
4149
|
+
for (; w && n && E !== g; ) {
|
4150
|
+
const P = gt(w), h = w.getBoundingClientRect(), m = getComputedStyle(w);
|
4151
|
+
h.x += (w.clientLeft + parseFloat(m.paddingLeft)) * P.x, h.y += (w.clientTop + parseFloat(m.paddingTop)) * P.y, c *= P.x, l *= P.y, p *= P.x, b *= P.y, c += h.x, l += h.y, w = we(w).frameElement;
|
4152
|
+
}
|
4153
|
+
}
|
4154
|
+
return qt({ width: p, height: b, x: c, y: l });
|
4155
|
+
}
|
4156
|
+
function Ye(e) {
|
4157
|
+
return ((ei(e) ? e.ownerDocument : e.document) || window.document).documentElement;
|
4158
|
+
}
|
4159
|
+
function un(e) {
|
4160
|
+
return Ee(e) ? { scrollLeft: e.scrollLeft, scrollTop: e.scrollTop } : { scrollLeft: e.pageXOffset, scrollTop: e.pageYOffset };
|
4161
|
+
}
|
4162
|
+
function ii(e) {
|
4163
|
+
return nt(Ye(e)).left + un(e).scrollLeft;
|
4164
|
+
}
|
4165
|
+
function bt(e) {
|
4166
|
+
if (Je(e) === "html") return e;
|
4167
|
+
const t = e.assignedSlot || e.parentNode || Br(e) && e.host || Ye(e);
|
4168
|
+
return Br(t) ? t.host : t;
|
4169
|
+
}
|
4170
|
+
function si(e) {
|
4171
|
+
const t = bt(e);
|
4172
|
+
return sn(t) ? t.ownerDocument.body : Le(t) && Ot(t) ? t : si(t);
|
4173
|
+
}
|
4174
|
+
function It(e, t) {
|
4175
|
+
var r;
|
4176
|
+
t === void 0 && (t = []);
|
4177
|
+
const n = si(e), o = n === ((r = e.ownerDocument) == null ? void 0 : r.body), i = we(n);
|
4178
|
+
return o ? t.concat(i, i.visualViewport || [], Ot(n) ? n : []) : t.concat(n, It(n));
|
4179
|
+
}
|
4180
|
+
function Hr(e, t, r) {
|
4181
|
+
let n;
|
4182
|
+
if (t === "viewport") n = function(s, u) {
|
4183
|
+
const a = we(s), d = Ye(s), f = a.visualViewport;
|
4184
|
+
let c = d.clientWidth, l = d.clientHeight, p = 0, b = 0;
|
4185
|
+
if (f) {
|
4186
|
+
c = f.width, l = f.height;
|
4187
|
+
const g = Rn();
|
4188
|
+
(!g || g && u === "fixed") && (p = f.offsetLeft, b = f.offsetTop);
|
4189
|
+
}
|
4190
|
+
return { width: c, height: l, x: p, y: b };
|
4191
|
+
}(e, r);
|
4192
|
+
else if (t === "document") n = function(s) {
|
4193
|
+
const u = Ye(s), a = un(s), d = s.ownerDocument.body, f = Pt(u.scrollWidth, u.clientWidth, d.scrollWidth, d.clientWidth), c = Pt(u.scrollHeight, u.clientHeight, d.scrollHeight, d.clientHeight);
|
4194
|
+
let l = -a.scrollLeft + ii(s);
|
4195
|
+
const p = -a.scrollTop;
|
4196
|
+
return Ae(d).direction === "rtl" && (l += Pt(u.clientWidth, d.clientWidth) - f), { width: f, height: c, x: l, y: p };
|
4197
|
+
}(Ye(e));
|
4198
|
+
else if (Ee(t)) n = function(s, u) {
|
4199
|
+
const a = nt(s, !0, u === "fixed"), d = a.top + s.clientTop, f = a.left + s.clientLeft, c = Le(s) ? gt(s) : { x: 1, y: 1 };
|
4200
|
+
return { width: s.clientWidth * c.x, height: s.clientHeight * c.y, x: f * c.x, y: d * c.y };
|
4201
|
+
}(t, r);
|
4202
|
+
else {
|
4203
|
+
const s = { ...t };
|
4204
|
+
if (Rn()) {
|
4205
|
+
var o, i;
|
4206
|
+
const u = we(e);
|
4207
|
+
s.x -= ((o = u.visualViewport) == null ? void 0 : o.offsetLeft) || 0, s.y -= ((i = u.visualViewport) == null ? void 0 : i.offsetTop) || 0;
|
4208
|
+
}
|
4209
|
+
n = s;
|
4210
|
+
}
|
4211
|
+
return qt(n);
|
4212
|
+
}
|
4213
|
+
function ui(e, t) {
|
4214
|
+
const r = bt(e);
|
4215
|
+
return !(r === t || !Ee(r) || sn(r)) && (Ae(r).position === "fixed" || ui(r, t));
|
4216
|
+
}
|
4217
|
+
function Wr(e, t) {
|
4218
|
+
return Le(e) && Ae(e).position !== "fixed" ? t ? t(e) : e.offsetParent : null;
|
4219
|
+
}
|
4220
|
+
function zr(e, t) {
|
4221
|
+
const r = we(e);
|
4222
|
+
if (!Le(e)) return r;
|
4223
|
+
let n = Wr(e, t);
|
4224
|
+
for (; n && Za(n) && Ae(n).position === "static"; ) n = Wr(n, t);
|
4225
|
+
return n && (Je(n) === "html" || Je(n) === "body" && Ae(n).position === "static" && !Ln(n)) ? r : n || function(o) {
|
4226
|
+
let i = bt(o);
|
4227
|
+
for (; Le(i) && !sn(i); ) {
|
4228
|
+
if (Ln(i)) return i;
|
4229
|
+
i = bt(i);
|
4230
|
+
}
|
4231
|
+
return null;
|
4232
|
+
}(e) || r;
|
4233
|
+
}
|
4234
|
+
function ec(e, t, r) {
|
4235
|
+
const n = Le(t), o = Ye(t), i = nt(e, !0, r === "fixed", t);
|
4236
|
+
let s = { scrollLeft: 0, scrollTop: 0 };
|
4237
|
+
const u = { x: 0, y: 0 };
|
4238
|
+
if (n || !n && r !== "fixed") if ((Je(t) !== "body" || Ot(o)) && (s = un(t)), Le(t)) {
|
4239
|
+
const a = nt(t, !0);
|
4240
|
+
u.x = a.x + t.clientLeft, u.y = a.y + t.clientTop;
|
4241
|
+
} else o && (u.x = ii(o));
|
4242
|
+
return { x: i.left + s.scrollLeft - u.x, y: i.top + s.scrollTop - u.y, width: i.width, height: i.height };
|
4243
|
+
}
|
4244
|
+
const tc = { getClippingRect: function(e) {
|
4245
|
+
let { element: t, boundary: r, rootBoundary: n, strategy: o } = e;
|
4246
|
+
const i = r === "clippingAncestors" ? function(d, f) {
|
4247
|
+
const c = f.get(d);
|
4248
|
+
if (c) return c;
|
4249
|
+
let l = It(d).filter((E) => Ee(E) && Je(E) !== "body"), p = null;
|
4250
|
+
const b = Ae(d).position === "fixed";
|
4251
|
+
let g = b ? bt(d) : d;
|
4252
|
+
for (; Ee(g) && !sn(g); ) {
|
4253
|
+
const E = Ae(g), w = Ln(g);
|
4254
|
+
w || E.position !== "fixed" || (p = null), (b ? !w && !p : !w && E.position === "static" && p && ["absolute", "fixed"].includes(p.position) || Ot(g) && !w && ui(d, g)) ? l = l.filter((P) => P !== g) : p = E, g = bt(g);
|
4255
|
+
}
|
4256
|
+
return f.set(d, l), l;
|
4257
|
+
}(t, this._c) : [].concat(r), s = [...i, n], u = s[0], a = s.reduce((d, f) => {
|
4258
|
+
const c = Hr(t, f, o);
|
4259
|
+
return d.top = Pt(c.top, d.top), d.right = Kr(c.right, d.right), d.bottom = Kr(c.bottom, d.bottom), d.left = Pt(c.left, d.left), d;
|
4260
|
+
}, Hr(t, u, o));
|
4261
|
+
return { width: a.right - a.left, height: a.bottom - a.top, x: a.left, y: a.top };
|
4262
|
+
}, convertOffsetParentRelativeRectToViewportRelativeRect: function(e) {
|
4263
|
+
let { rect: t, offsetParent: r, strategy: n } = e;
|
4264
|
+
const o = Le(r), i = Ye(r);
|
4265
|
+
if (r === i) return t;
|
4266
|
+
let s = { scrollLeft: 0, scrollTop: 0 }, u = { x: 1, y: 1 };
|
4267
|
+
const a = { x: 0, y: 0 };
|
4268
|
+
if ((o || !o && n !== "fixed") && ((Je(r) !== "body" || Ot(i)) && (s = un(r)), Le(r))) {
|
4269
|
+
const d = nt(r);
|
4270
|
+
u = gt(r), a.x = d.x + r.clientLeft, a.y = d.y + r.clientTop;
|
4271
|
+
}
|
4272
|
+
return { width: t.width * u.x, height: t.height * u.y, x: t.x * u.x - s.scrollLeft * u.x + a.x, y: t.y * u.y - s.scrollTop * u.y + a.y };
|
4273
|
+
}, isElement: Ee, getDimensions: function(e) {
|
4274
|
+
return ni(e);
|
4275
|
+
}, getOffsetParent: zr, getDocumentElement: Ye, getScale: gt, async getElementRects(e) {
|
4276
|
+
let { reference: t, floating: r, strategy: n } = e;
|
4277
|
+
const o = this.getOffsetParent || zr, i = this.getDimensions;
|
4278
|
+
return { reference: ec(t, await o(r), n), floating: { x: 0, y: 0, ...await i(r) } };
|
4279
|
+
}, getClientRects: (e) => Array.from(e.getClientRects()), isRTL: (e) => Ae(e).direction === "rtl" };
|
4280
|
+
function nc(e, t, r, n) {
|
4281
|
+
n === void 0 && (n = {});
|
4282
|
+
const { ancestorScroll: o = !0, ancestorResize: i = !0, elementResize: s = !0, animationFrame: u = !1 } = n, a = o || i ? [...Ee(e) ? It(e) : e.contextElement ? It(e.contextElement) : [], ...It(t)] : [];
|
4283
|
+
a.forEach((l) => {
|
4284
|
+
const p = !Ee(l) && l.toString().includes("V");
|
4285
|
+
!o || u && !p || l.addEventListener("scroll", r, { passive: !0 }), i && l.addEventListener("resize", r);
|
4286
|
+
});
|
4287
|
+
let d, f = null;
|
4288
|
+
s && (f = new ResizeObserver(() => {
|
4289
|
+
r();
|
4290
|
+
}), Ee(e) && !u && f.observe(e), Ee(e) || !e.contextElement || u || f.observe(e.contextElement), f.observe(t));
|
4291
|
+
let c = u ? nt(e) : null;
|
4292
|
+
return u && function l() {
|
4293
|
+
const p = nt(e);
|
4294
|
+
!c || p.x === c.x && p.y === c.y && p.width === c.width && p.height === c.height || r(), c = p, d = requestAnimationFrame(l);
|
4295
|
+
}(), r(), () => {
|
4296
|
+
var l;
|
4297
|
+
a.forEach((p) => {
|
4298
|
+
o && p.removeEventListener("scroll", r), i && p.removeEventListener("resize", r);
|
4299
|
+
}), (l = f) == null || l.disconnect(), f = null, u && cancelAnimationFrame(d);
|
4300
|
+
};
|
4301
|
+
}
|
4302
|
+
const rc = (e, t, r) => {
|
4303
|
+
const n = /* @__PURE__ */ new Map(), o = { platform: tc, ...r }, i = { ...o.platform, _c: n };
|
4304
|
+
return Ha(e, t, { ...o, platform: i });
|
4305
|
+
};
|
4306
|
+
var oc = "div";
|
4307
|
+
function Ur(e = 0, t = 0, r = 0, n = 0) {
|
4308
|
+
if (typeof DOMRect == "function")
|
4309
|
+
return new DOMRect(e, t, r, n);
|
4310
|
+
const o = {
|
4311
|
+
x: e,
|
4312
|
+
y: t,
|
4313
|
+
width: r,
|
4314
|
+
height: n,
|
4315
|
+
top: t,
|
4316
|
+
right: e + r,
|
4317
|
+
bottom: t + n,
|
4318
|
+
left: e
|
4319
|
+
};
|
4320
|
+
return $(O({}, o), { toJSON: () => o });
|
4321
|
+
}
|
4322
|
+
function ic(e) {
|
4323
|
+
if (!e) return Ur();
|
4324
|
+
const { x: t, y: r, width: n, height: o } = e;
|
4325
|
+
return Ur(t, r, n, o);
|
4326
|
+
}
|
4327
|
+
function sc(e, t) {
|
4328
|
+
return {
|
4329
|
+
contextElement: e || void 0,
|
4330
|
+
getBoundingClientRect: () => {
|
4331
|
+
const n = e, o = t == null ? void 0 : t(n);
|
4332
|
+
return o || !n ? ic(o) : n.getBoundingClientRect();
|
4333
|
+
}
|
4334
|
+
};
|
4335
|
+
}
|
4336
|
+
function uc(e) {
|
4337
|
+
return /^(?:top|bottom|left|right)(?:-(?:start|end))?$/.test(e);
|
4338
|
+
}
|
4339
|
+
function jr(e) {
|
4340
|
+
const t = window.devicePixelRatio || 1;
|
4341
|
+
return Math.round(e * t) / t;
|
4342
|
+
}
|
4343
|
+
function ac(e, t) {
|
4344
|
+
return Ya(({ placement: r }) => {
|
4345
|
+
var n;
|
4346
|
+
const o = ((e == null ? void 0 : e.clientHeight) || 0) / 2, i = typeof t.gutter == "number" ? t.gutter + o : (n = t.gutter) != null ? n : o;
|
4347
|
+
return {
|
4348
|
+
crossAxis: !!r.split("-")[1] ? void 0 : t.shift,
|
4349
|
+
mainAxis: i,
|
4350
|
+
alignmentAxis: t.shift
|
4351
|
+
};
|
4352
|
+
});
|
4353
|
+
}
|
4354
|
+
function cc(e) {
|
4355
|
+
if (e.flip === !1) return;
|
4356
|
+
const t = typeof e.flip == "string" ? e.flip.split(" ") : void 0;
|
4357
|
+
return he(
|
4358
|
+
!t || t.every(uc),
|
4359
|
+
process.env.NODE_ENV !== "production" && "`flip` expects a spaced-delimited list of placements"
|
4360
|
+
), Ga({
|
4361
|
+
padding: e.overflowPadding,
|
4362
|
+
fallbackPlacements: t
|
4363
|
+
});
|
4364
|
+
}
|
4365
|
+
function lc(e) {
|
4366
|
+
if (!(!e.slide && !e.overlap))
|
4367
|
+
return Xa({
|
4368
|
+
mainAxis: e.slide,
|
4369
|
+
crossAxis: e.overlap,
|
4370
|
+
padding: e.overflowPadding,
|
4371
|
+
limiter: Ja()
|
4372
|
+
});
|
4373
|
+
}
|
4374
|
+
function fc(e) {
|
4375
|
+
return Qa({
|
4376
|
+
padding: e.overflowPadding,
|
4377
|
+
apply({ elements: t, availableWidth: r, availableHeight: n, rects: o }) {
|
4378
|
+
const i = t.floating, s = Math.round(o.reference.width);
|
4379
|
+
r = Math.floor(r), n = Math.floor(n), i.style.setProperty(
|
4380
|
+
"--popover-anchor-width",
|
4381
|
+
`${s}px`
|
4382
|
+
), i.style.setProperty(
|
4383
|
+
"--popover-available-width",
|
4384
|
+
`${r}px`
|
4385
|
+
), i.style.setProperty(
|
4386
|
+
"--popover-available-height",
|
4387
|
+
`${n}px`
|
4388
|
+
), e.sameWidth && (i.style.width = `${s}px`), e.fitViewport && (i.style.maxWidth = `${r}px`, i.style.maxHeight = `${n}px`);
|
4389
|
+
}
|
4390
|
+
});
|
4391
|
+
}
|
4392
|
+
function dc(e, t) {
|
4393
|
+
if (e)
|
4394
|
+
return Wa({
|
4395
|
+
element: e,
|
4396
|
+
padding: t.arrowPadding
|
4397
|
+
});
|
4398
|
+
}
|
4399
|
+
var ai = Z(
|
4400
|
+
function(t) {
|
4401
|
+
var r = t, {
|
4402
|
+
store: n,
|
4403
|
+
modal: o = !1,
|
4404
|
+
portal: i = !!o,
|
4405
|
+
preserveTabOrder: s = !0,
|
4406
|
+
autoFocusOnShow: u = !0,
|
4407
|
+
wrapperProps: a,
|
4408
|
+
fixed: d = !1,
|
4409
|
+
flip: f = !0,
|
4410
|
+
shift: c = 0,
|
4411
|
+
slide: l = !0,
|
4412
|
+
overlap: p = !1,
|
4413
|
+
sameWidth: b = !1,
|
4414
|
+
fitViewport: g = !1,
|
4415
|
+
gutter: E,
|
4416
|
+
arrowPadding: w = 4,
|
4417
|
+
overflowPadding: P = 8,
|
4418
|
+
getAnchorRect: h,
|
4419
|
+
updatePosition: m
|
4420
|
+
} = r, y = J(r, [
|
4421
|
+
"store",
|
4422
|
+
"modal",
|
4423
|
+
"portal",
|
4424
|
+
"preserveTabOrder",
|
4425
|
+
"autoFocusOnShow",
|
4426
|
+
"wrapperProps",
|
4427
|
+
"fixed",
|
4428
|
+
"flip",
|
4429
|
+
"shift",
|
4430
|
+
"slide",
|
4431
|
+
"overlap",
|
4432
|
+
"sameWidth",
|
4433
|
+
"fitViewport",
|
4434
|
+
"gutter",
|
4435
|
+
"arrowPadding",
|
4436
|
+
"overflowPadding",
|
4437
|
+
"getAnchorRect",
|
4438
|
+
"updatePosition"
|
4439
|
+
]);
|
4440
|
+
const C = Zt();
|
4441
|
+
n = n || C, he(
|
4442
|
+
n,
|
4443
|
+
process.env.NODE_ENV !== "production" && "Popover must receive a `store` prop or be wrapped in a PopoverProvider component."
|
4444
|
+
);
|
4445
|
+
const _ = n.useState("arrowElement"), L = n.useState("anchorElement"), S = n.useState("disclosureElement"), A = n.useState("popoverElement"), F = n.useState("contentElement"), N = n.useState("placement"), I = n.useState("mounted"), T = n.useState("rendered"), D = Y(null), [v, R] = X(!1), { portalRef: K, domReady: x } = co(i, y.portalRef), k = j(h), B = j(m), H = !!m;
|
4446
|
+
ee(() => {
|
4447
|
+
if (!(A != null && A.isConnected)) return;
|
4448
|
+
A.style.setProperty(
|
4449
|
+
"--popover-overflow-padding",
|
4450
|
+
`${P}px`
|
4451
|
+
);
|
4452
|
+
const oe = sc(L, k), re = async () => {
|
4453
|
+
if (!I) return;
|
4454
|
+
_ || (D.current = D.current || document.createElement("div"));
|
4455
|
+
const ye = _ || D.current, Ie = [
|
4456
|
+
ac(ye, { gutter: E, shift: c }),
|
4457
|
+
cc({ flip: f, overflowPadding: P }),
|
4458
|
+
lc({ slide: l, shift: c, overlap: p, overflowPadding: P }),
|
4459
|
+
dc(ye, { arrowPadding: w }),
|
4460
|
+
fc({
|
4461
|
+
sameWidth: b,
|
4462
|
+
fitViewport: g,
|
4463
|
+
overflowPadding: P
|
4464
|
+
})
|
4465
|
+
], ue = await rc(oe, A, {
|
4466
|
+
placement: N,
|
4467
|
+
strategy: d ? "fixed" : "absolute",
|
4468
|
+
middleware: Ie
|
4469
|
+
});
|
4470
|
+
n == null || n.setState("currentPlacement", ue.placement), R(!0);
|
4471
|
+
const ut = jr(ue.x), at = jr(ue.y);
|
4472
|
+
if (Object.assign(A.style, {
|
4473
|
+
top: "0",
|
4474
|
+
left: "0",
|
4475
|
+
transform: `translate3d(${ut}px,${at}px,0)`
|
4476
|
+
}), ye && ue.middlewareData.arrow) {
|
4477
|
+
const { x: Me, y: je } = ue.middlewareData.arrow, ct = ue.placement.split("-")[0], lt = ye.clientWidth / 2, ft = ye.clientHeight / 2, V = Me != null ? Me + lt : -lt, z = je != null ? je + ft : -ft;
|
4478
|
+
A.style.setProperty(
|
4479
|
+
"--popover-transform-origin",
|
4480
|
+
{
|
4481
|
+
top: `${V}px calc(100% + ${ft}px)`,
|
4482
|
+
bottom: `${V}px ${-ft}px`,
|
4483
|
+
left: `calc(100% + ${lt}px) ${z}px`,
|
4484
|
+
right: `${-lt}px ${z}px`
|
4485
|
+
}[ct]
|
4486
|
+
), Object.assign(ye.style, {
|
4487
|
+
left: Me != null ? `${Me}px` : "",
|
4488
|
+
top: je != null ? `${je}px` : "",
|
4489
|
+
[ct]: "100%"
|
4490
|
+
});
|
4491
|
+
}
|
4492
|
+
}, Ue = nc(oe, A, async () => {
|
4493
|
+
H ? (await B({ updatePosition: re }), R(!0)) : await re();
|
4494
|
+
}, {
|
4495
|
+
// JSDOM doesn't support ResizeObserver
|
4496
|
+
elementResize: typeof ResizeObserver == "function"
|
4497
|
+
});
|
4498
|
+
return () => {
|
4499
|
+
R(!1), Ue();
|
4500
|
+
};
|
4501
|
+
}, [
|
4502
|
+
n,
|
4503
|
+
T,
|
4504
|
+
A,
|
4505
|
+
_,
|
4506
|
+
L,
|
4507
|
+
A,
|
4508
|
+
N,
|
4509
|
+
I,
|
4510
|
+
x,
|
4511
|
+
d,
|
4512
|
+
f,
|
4513
|
+
c,
|
4514
|
+
l,
|
4515
|
+
p,
|
4516
|
+
b,
|
4517
|
+
g,
|
4518
|
+
E,
|
4519
|
+
w,
|
4520
|
+
P,
|
4521
|
+
k,
|
4522
|
+
H,
|
4523
|
+
B
|
4524
|
+
]), ee(() => {
|
4525
|
+
if (!I || !x || !(A != null && A.isConnected) || !(F != null && F.isConnected)) return;
|
4526
|
+
const oe = () => {
|
4527
|
+
A.style.zIndex = getComputedStyle(F).zIndex;
|
4528
|
+
};
|
4529
|
+
oe();
|
4530
|
+
let re = requestAnimationFrame(() => {
|
4531
|
+
re = requestAnimationFrame(oe);
|
4532
|
+
});
|
4533
|
+
return () => cancelAnimationFrame(re);
|
4534
|
+
}, [I, x, A, F]);
|
4535
|
+
const ie = d ? "fixed" : "absolute";
|
4536
|
+
return y = le(
|
4537
|
+
y,
|
4538
|
+
(oe) => /* @__PURE__ */ M(
|
4539
|
+
"div",
|
4540
|
+
$(O({}, a), {
|
4541
|
+
style: O({
|
4542
|
+
// https://floating-ui.com/docs/computeposition#initial-layout
|
4543
|
+
position: ie,
|
4544
|
+
top: 0,
|
4545
|
+
left: 0,
|
4546
|
+
width: "max-content"
|
4547
|
+
}, a == null ? void 0 : a.style),
|
4548
|
+
ref: n == null ? void 0 : n.setPopoverElement,
|
4549
|
+
children: oe
|
4550
|
+
})
|
4551
|
+
),
|
4552
|
+
[n, ie, a]
|
4553
|
+
), y = le(
|
4554
|
+
y,
|
4555
|
+
(oe) => /* @__PURE__ */ M(en, { value: n, children: oe }),
|
4556
|
+
[n]
|
4557
|
+
), y = $(O({
|
4558
|
+
// data-placing is not part of the public API. We're setting this here so
|
4559
|
+
// we can wait for the popover to be positioned before other components
|
4560
|
+
// move focus into it. For example, this attribute is observed by the
|
4561
|
+
// Combobox component with the autoSelect behavior.
|
4562
|
+
"data-placing": !v || void 0
|
4563
|
+
}, y), {
|
4564
|
+
style: O({
|
4565
|
+
position: "relative"
|
4566
|
+
}, y.style)
|
4567
|
+
}), y = Jo($(O({
|
4568
|
+
store: n,
|
4569
|
+
modal: o,
|
4570
|
+
portal: i,
|
4571
|
+
preserveTabOrder: s,
|
4572
|
+
preserveTabOrderAnchor: S || L,
|
4573
|
+
autoFocusOnShow: v && u
|
4574
|
+
}, y), {
|
4575
|
+
portalRef: K
|
4576
|
+
})), y;
|
4577
|
+
}
|
4578
|
+
);
|
4579
|
+
ur(
|
4580
|
+
G(function(t) {
|
4581
|
+
const r = ai(t);
|
4582
|
+
return Q(oc, r);
|
4583
|
+
}),
|
4584
|
+
Zt
|
4585
|
+
);
|
4586
|
+
var pc = "div", mc = Z(
|
4587
|
+
function(t) {
|
4588
|
+
var r = t, { store: n, alwaysVisible: o } = r, i = J(r, ["store", "alwaysVisible"]);
|
4589
|
+
const s = Jn();
|
4590
|
+
return n = n || s, i = Wo(O({ store: n, alwaysVisible: o }, i)), i = ai(O({ store: n, alwaysVisible: o }, i)), i;
|
4591
|
+
}
|
4592
|
+
), vc = ur(
|
4593
|
+
G(function(t) {
|
4594
|
+
const r = mc(t);
|
4595
|
+
return Q(pc, r);
|
4596
|
+
}),
|
4597
|
+
Jn
|
4598
|
+
);
|
4599
|
+
const gc = "_agentSelector_wit17_1", hc = "_agentSelectorButton_wit17_4", bc = "_agentStatus_wit17_8", yc = "_agentLoader_wit17_21", Sc = "_agentError_wit17_24", wc = "_triggerChip_wit17_27", Ec = "_agentLabel_wit17_33", xc = "_dropdownIndicator_wit17_39", Pc = "_sidebar_wit17_54", Ic = "_agentListRetryButton_wit17_67", Cc = "_agentList_wit17_67", Oc = "_agentListItemIcon_wit17_99", _c = "_agentListContainer_wit17_104", Pe = {
|
4600
|
+
agentSelector: gc,
|
4601
|
+
agentSelectorButton: hc,
|
4602
|
+
agentStatus: bc,
|
4603
|
+
agentLoader: yc,
|
4604
|
+
agentError: Sc,
|
4605
|
+
triggerChip: wc,
|
4606
|
+
agentLabel: Ec,
|
4607
|
+
dropdownIndicator: xc,
|
4608
|
+
sidebar: Pc,
|
4609
|
+
agentListRetryButton: Ic,
|
4610
|
+
agentList: Cc,
|
4611
|
+
agentListItemIcon: Oc,
|
4612
|
+
agentListContainer: _c
|
4613
|
+
};
|
4614
|
+
function Hc({
|
4615
|
+
agents: e,
|
4616
|
+
contentClassName: t,
|
4617
|
+
onErrorAction: r,
|
4618
|
+
recordAction: n,
|
4619
|
+
requestState: o,
|
4620
|
+
disabled: i,
|
4621
|
+
onAgentsListOpen: s,
|
4622
|
+
selectedAgent: u,
|
4623
|
+
triggerChipClassName: a,
|
4624
|
+
variant: d = "modal"
|
37
4625
|
}) {
|
4626
|
+
var D;
|
38
4627
|
const {
|
39
|
-
formatMessage:
|
40
|
-
} =
|
41
|
-
let
|
42
|
-
|
43
|
-
const
|
44
|
-
Wrapper:
|
45
|
-
wrapperProps:
|
46
|
-
} =
|
47
|
-
ref:
|
48
|
-
textValue:
|
49
|
-
});
|
50
|
-
|
51
|
-
|
52
|
-
...
|
53
|
-
action:
|
54
|
-
target:
|
4628
|
+
formatMessage: f
|
4629
|
+
} = hi(), [c, l] = X(!1), p = o === fn.ERROR, [b, g] = X(p), E = Si(), w = o === fn.SUCCESS, P = o === fn.IN_PROGRESS, h = f(Qe.selectAgent), m = f(Qe.defaultAgent);
|
4630
|
+
let y = "";
|
4631
|
+
w ? y = (u == null ? void 0 : u.name) || h : p && (y = m);
|
4632
|
+
const C = Y(null), {
|
4633
|
+
Wrapper: _,
|
4634
|
+
wrapperProps: L
|
4635
|
+
} = fi({
|
4636
|
+
ref: C,
|
4637
|
+
textValue: y
|
4638
|
+
});
|
4639
|
+
W(() => {
|
4640
|
+
c && n && n({
|
4641
|
+
...an,
|
4642
|
+
action: cn,
|
4643
|
+
target: ln.OPEN_SELECTOR
|
55
4644
|
});
|
56
|
-
}, [
|
57
|
-
const
|
58
|
-
|
59
|
-
type:
|
60
|
-
id:
|
61
|
-
}),
|
62
|
-
...
|
63
|
-
action:
|
64
|
-
target:
|
4645
|
+
}, [c, n]);
|
4646
|
+
const S = xe((v) => {
|
4647
|
+
l(!1), E({
|
4648
|
+
type: yi.SET_SELECTED_AGENT,
|
4649
|
+
id: v.id
|
4650
|
+
}), n && n({
|
4651
|
+
...an,
|
4652
|
+
action: cn,
|
4653
|
+
target: ln.SELECT_AGENT
|
65
4654
|
});
|
66
|
-
}, [
|
67
|
-
|
68
|
-
...
|
69
|
-
action:
|
70
|
-
target:
|
4655
|
+
}, [E, n]), A = xe(() => {
|
4656
|
+
l(!1), r(), n && n({
|
4657
|
+
...an,
|
4658
|
+
action: cn,
|
4659
|
+
target: ln.RETRY_LOADING_AGENTS
|
71
4660
|
});
|
72
|
-
}, [
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
t && N && N(), c(t);
|
82
|
-
}, E = v === "sidebar" && a.sidebar, z = (t) => {
|
83
|
-
(t.key === "ArrowUp" || t.key === "ArrowDown" || t.key === "ArrowLeft" || t.key === "ArrowRight") && t.stopPropagation();
|
84
|
-
};
|
85
|
-
return /* @__PURE__ */ e(p.Group, {
|
86
|
-
className: f(a.agentSelector, K, E),
|
87
|
-
name: G,
|
88
|
-
onKeyDown: z,
|
4661
|
+
}, [r, n]), F = xe((v) => g(p && p && !c && v ? v : !1), [p, c]), N = (v) => {
|
4662
|
+
v && s && s(), l(v);
|
4663
|
+
}, I = d === "sidebar" && Pe.sidebar, T = (v) => {
|
4664
|
+
(v.key === "ArrowUp" || v.key === "ArrowDown" || v.key === "ArrowLeft" || v.key === "ArrowRight") && v.stopPropagation();
|
4665
|
+
};
|
4666
|
+
return /* @__PURE__ */ M(Nt.Group, {
|
4667
|
+
className: Mt(Pe.agentSelector, a, I),
|
4668
|
+
name: h,
|
4669
|
+
onKeyDown: T,
|
89
4670
|
type: "multiple",
|
90
|
-
children: /* @__PURE__ */
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
children: [/* @__PURE__ */
|
95
|
-
content:
|
96
|
-
onOpenChange:
|
97
|
-
open:
|
4671
|
+
children: /* @__PURE__ */ Fe(Vu, {
|
4672
|
+
defaultValue: (D = e[0]) == null ? void 0 : D.id,
|
4673
|
+
open: c,
|
4674
|
+
setOpen: N,
|
4675
|
+
children: [/* @__PURE__ */ M(di, {
|
4676
|
+
content: f(Qe.errorTooltip),
|
4677
|
+
onOpenChange: F,
|
4678
|
+
open: b,
|
98
4679
|
side: "bottom",
|
99
4680
|
variant: "error",
|
100
|
-
children: /* @__PURE__ */
|
101
|
-
|
102
|
-
|
103
|
-
|
4681
|
+
children: /* @__PURE__ */ M(ku, {
|
4682
|
+
className: Pe.selectAgentButton,
|
4683
|
+
disabled: i || P,
|
4684
|
+
render: /* @__PURE__ */ Fe(Nt.TriggerChip, {
|
4685
|
+
"aria-label": y,
|
4686
|
+
className: Pe.triggerChip,
|
104
4687
|
"data-target-id": "FilterChip.TriggerChip-agentSelectorTrigger",
|
105
4688
|
value: "trigger-chip",
|
106
|
-
children: [/* @__PURE__ */
|
107
|
-
className:
|
4689
|
+
children: [/* @__PURE__ */ M(pi, {
|
4690
|
+
className: Pe.agentStatus,
|
108
4691
|
colorIndex: 0,
|
109
|
-
text:
|
110
|
-
}),
|
111
|
-
"aria-label":
|
112
|
-
className:
|
4692
|
+
text: f(Qe.agent)
|
4693
|
+
}), P && /* @__PURE__ */ M(mi, {
|
4694
|
+
"aria-label": f(Qe.loadingMessage),
|
4695
|
+
className: Pe.agentLoader,
|
113
4696
|
variant: "default"
|
114
|
-
}),
|
115
|
-
className:
|
4697
|
+
}), p && /* @__PURE__ */ M(gi, {
|
4698
|
+
className: Pe.agentError,
|
116
4699
|
height: "1rem",
|
117
4700
|
role: "presentation",
|
118
4701
|
width: "1rem"
|
119
|
-
}), /* @__PURE__ */
|
120
|
-
...
|
121
|
-
children: /* @__PURE__ */
|
122
|
-
ref:
|
123
|
-
className:
|
124
|
-
children:
|
4702
|
+
}), /* @__PURE__ */ M(_, {
|
4703
|
+
...L,
|
4704
|
+
children: /* @__PURE__ */ M(Nt.Label, {
|
4705
|
+
ref: C,
|
4706
|
+
className: Pe.agentLabel,
|
4707
|
+
children: y
|
125
4708
|
})
|
126
|
-
}), !
|
127
|
-
className:
|
128
|
-
children: /* @__PURE__ */
|
4709
|
+
}), !P && /* @__PURE__ */ M("div", {
|
4710
|
+
className: Pe.dropdownIndicator,
|
4711
|
+
children: /* @__PURE__ */ M(Nt.DropdownIndicator, {})
|
129
4712
|
})]
|
130
4713
|
})
|
131
4714
|
})
|
132
|
-
}), /* @__PURE__ */
|
133
|
-
|
134
|
-
className:
|
135
|
-
|
136
|
-
children: /* @__PURE__ */
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
4715
|
+
}), /* @__PURE__ */ Fe(vc, {
|
4716
|
+
"aria-label": f(Qe.agentList),
|
4717
|
+
className: Mt(Pe.agentListContainer, I),
|
4718
|
+
unmountOnHide: !0,
|
4719
|
+
children: [w && /* @__PURE__ */ M(aa, {
|
4720
|
+
className: Mt(Pe.agentList, t),
|
4721
|
+
children: e.map((v, R) => /* @__PURE__ */ M(Ju, {
|
4722
|
+
clickOnEnter: !0,
|
4723
|
+
clickOnSpace: !0,
|
4724
|
+
focusable: !0,
|
4725
|
+
focusOnHover: !0,
|
4726
|
+
hideOnClick: !0,
|
4727
|
+
onClick: () => {
|
4728
|
+
S(v);
|
4729
|
+
},
|
4730
|
+
setValueOnClick: !0,
|
4731
|
+
value: v.id,
|
4732
|
+
children: /* @__PURE__ */ M(bi, {
|
4733
|
+
agent: v
|
4734
|
+
})
|
4735
|
+
}, v.id))
|
4736
|
+
}), p && /* @__PURE__ */ M(vi, {
|
4737
|
+
className: Mt(Pe.agentListRetryButton, I),
|
4738
|
+
onClick: A,
|
4739
|
+
variant: "tertiary",
|
4740
|
+
"data-target-id": "Button-errorMessage",
|
4741
|
+
children: f(Qe.errorMessage)
|
4742
|
+
})]
|
153
4743
|
})]
|
154
4744
|
})
|
155
4745
|
});
|
156
4746
|
}
|
157
4747
|
export {
|
158
|
-
|
159
|
-
|
4748
|
+
Hc as BoxAiAgentSelector,
|
4749
|
+
Hc as default
|
160
4750
|
};
|