@txnlab/use-wallet-ui-react 1.0.0 → 1.2.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.
Files changed (75) hide show
  1. package/README.md +20 -0
  2. package/dist/cjs/chunks/floating-ui.react-O3sXJ80G.cjs +5 -0
  3. package/dist/cjs/chunks/floating-ui.react-O3sXJ80G.cjs.map +1 -0
  4. package/dist/cjs/index.cjs +15 -18
  5. package/dist/cjs/index.cjs.map +1 -1
  6. package/dist/cjs/plugins/export-key.cjs +9 -0
  7. package/dist/cjs/plugins/export-key.cjs.map +1 -0
  8. package/dist/esm/chunks/floating-ui.react-Co7v2aHO.js +2619 -0
  9. package/dist/esm/chunks/floating-ui.react-Co7v2aHO.js.map +1 -0
  10. package/dist/esm/index.js +4932 -7775
  11. package/dist/esm/index.js.map +1 -1
  12. package/dist/esm/plugins/export-key.js +3030 -0
  13. package/dist/esm/plugins/export-key.js.map +1 -0
  14. package/dist/style.css +109 -1
  15. package/dist/types/components/AlgoSymbol.d.ts +11 -0
  16. package/dist/types/components/AlgoSymbol.d.ts.map +1 -0
  17. package/dist/types/components/ConnectWalletButton.d.ts +9 -0
  18. package/dist/types/components/ConnectWalletButton.d.ts.map +1 -0
  19. package/dist/types/components/ConnectWalletMenu.d.ts +10 -0
  20. package/dist/types/components/ConnectWalletMenu.d.ts.map +1 -0
  21. package/dist/types/components/ConnectedWalletButton.d.ts +9 -0
  22. package/dist/types/components/ConnectedWalletButton.d.ts.map +1 -0
  23. package/dist/types/components/ConnectedWalletMenu.d.ts +10 -0
  24. package/dist/types/components/ConnectedWalletMenu.d.ts.map +1 -0
  25. package/dist/types/components/NfdAvatar.d.ts +24 -0
  26. package/dist/types/components/NfdAvatar.d.ts.map +1 -0
  27. package/dist/types/components/WalletButton.d.ts +12 -0
  28. package/dist/types/components/WalletButton.d.ts.map +1 -0
  29. package/dist/types/components/WalletList.d.ts +7 -0
  30. package/dist/types/components/WalletList.d.ts.map +1 -0
  31. package/dist/types/hooks/useAccountInfo.d.ts +12 -0
  32. package/dist/types/hooks/useAccountInfo.d.ts.map +1 -0
  33. package/dist/types/hooks/useNfd.d.ts +32 -0
  34. package/dist/types/hooks/useNfd.d.ts.map +1 -0
  35. package/dist/types/hooks/useResolvedTheme.d.ts +11 -0
  36. package/dist/types/hooks/useResolvedTheme.d.ts.map +1 -0
  37. package/dist/types/index.d.cts +17 -197
  38. package/dist/types/index.d.ts +17 -197
  39. package/dist/types/index.d.ts.map +1 -0
  40. package/dist/types/plugins/PluginContext.d.ts +29 -0
  41. package/dist/types/plugins/PluginContext.d.ts.map +1 -0
  42. package/dist/types/plugins/PluginDialogRenderer.d.ts +10 -0
  43. package/dist/types/plugins/PluginDialogRenderer.d.ts.map +1 -0
  44. package/dist/types/plugins/PluginLifecycleManager.d.ts +9 -0
  45. package/dist/types/plugins/PluginLifecycleManager.d.ts.map +1 -0
  46. package/dist/types/plugins/PluginSlot.d.ts +10 -0
  47. package/dist/types/plugins/PluginSlot.d.ts.map +1 -0
  48. package/dist/types/plugins/export-key/ExportKeyDialog.d.ts +6 -0
  49. package/dist/types/plugins/export-key/ExportKeyDialog.d.ts.map +1 -0
  50. package/dist/types/plugins/export-key/ExportKeyMenuButton.d.ts +5 -0
  51. package/dist/types/plugins/export-key/ExportKeyMenuButton.d.ts.map +1 -0
  52. package/dist/types/plugins/export-key/constants.d.ts +2 -0
  53. package/dist/types/plugins/export-key/constants.d.ts.map +1 -0
  54. package/dist/types/plugins/export-key/index.d.cts +12 -0
  55. package/dist/types/plugins/export-key/index.d.ts +12 -0
  56. package/dist/types/plugins/export-key/index.d.ts.map +1 -0
  57. package/dist/types/plugins/index.d.ts +6 -0
  58. package/dist/types/plugins/index.d.ts.map +1 -0
  59. package/dist/types/plugins/types.d.ts +109 -0
  60. package/dist/types/plugins/types.d.ts.map +1 -0
  61. package/dist/types/providers/WalletUIProvider.d.ts +58 -0
  62. package/dist/types/providers/WalletUIProvider.d.ts.map +1 -0
  63. package/dist/types/test/setup.d.ts +2 -0
  64. package/dist/types/test/setup.d.ts.map +1 -0
  65. package/dist/types/utils/cn.d.ts +16 -0
  66. package/dist/types/utils/cn.d.ts.map +1 -0
  67. package/dist/types/utils/fontLoader.d.ts +8 -0
  68. package/dist/types/utils/fontLoader.d.ts.map +1 -0
  69. package/dist/types/utils/index.d.ts +3 -0
  70. package/dist/types/utils/index.d.ts.map +1 -0
  71. package/dist/types/utils/ipfs.d.ts +10 -0
  72. package/dist/types/utils/ipfs.d.ts.map +1 -0
  73. package/dist/types/utils/ipfs.test.d.ts +2 -0
  74. package/dist/types/utils/ipfs.test.d.ts.map +1 -0
  75. package/package.json +23 -13
@@ -0,0 +1,2619 @@
1
+ import * as g from "react";
2
+ import { useLayoutEffect as un } from "react";
3
+ import { jsxs as fn, jsx as fe, Fragment as Hn } from "react/jsx-runtime";
4
+ import * as dn from "react-dom";
5
+ function tt() {
6
+ return typeof window < "u";
7
+ }
8
+ function xe(e) {
9
+ return St(e) ? (e.nodeName || "").toLowerCase() : "#document";
10
+ }
11
+ function J(e) {
12
+ var t;
13
+ return (e == null || (t = e.ownerDocument) == null ? void 0 : t.defaultView) || window;
14
+ }
15
+ function ce(e) {
16
+ var t;
17
+ return (t = (St(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : t.documentElement;
18
+ }
19
+ function St(e) {
20
+ return tt() ? e instanceof Node || e instanceof J(e).Node : !1;
21
+ }
22
+ function B(e) {
23
+ return tt() ? e instanceof Element || e instanceof J(e).Element : !1;
24
+ }
25
+ function q(e) {
26
+ return tt() ? e instanceof HTMLElement || e instanceof J(e).HTMLElement : !1;
27
+ }
28
+ function Ue(e) {
29
+ return !tt() || typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof J(e).ShadowRoot;
30
+ }
31
+ function Le(e) {
32
+ const {
33
+ overflow: t,
34
+ overflowX: n,
35
+ overflowY: r,
36
+ display: o
37
+ } = te(e);
38
+ return /auto|scroll|overlay|hidden|clip/.test(t + r + n) && o !== "inline" && o !== "contents";
39
+ }
40
+ function Kn(e) {
41
+ return /^(table|td|th)$/.test(xe(e));
42
+ }
43
+ function nt(e) {
44
+ try {
45
+ if (e.matches(":popover-open"))
46
+ return !0;
47
+ } catch {
48
+ }
49
+ try {
50
+ return e.matches(":modal");
51
+ } catch {
52
+ return !1;
53
+ }
54
+ }
55
+ const qn = /transform|translate|scale|rotate|perspective|filter/, jn = /paint|layout|strict|content/, Ee = (e) => !!e && e !== "none";
56
+ let at;
57
+ function Tt(e) {
58
+ const t = B(e) ? te(e) : e;
59
+ return Ee(t.transform) || Ee(t.translate) || Ee(t.scale) || Ee(t.rotate) || Ee(t.perspective) || !rt() && (Ee(t.backdropFilter) || Ee(t.filter)) || qn.test(t.willChange || "") || jn.test(t.contain || "");
60
+ }
61
+ function Un(e) {
62
+ let t = me(e);
63
+ for (; q(t) && !de(t); ) {
64
+ if (Tt(t))
65
+ return t;
66
+ if (nt(t))
67
+ return null;
68
+ t = me(t);
69
+ }
70
+ return null;
71
+ }
72
+ function rt() {
73
+ return at == null && (at = typeof CSS < "u" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none")), at;
74
+ }
75
+ function de(e) {
76
+ return /^(html|body|#document)$/.test(xe(e));
77
+ }
78
+ function te(e) {
79
+ return J(e).getComputedStyle(e);
80
+ }
81
+ function ot(e) {
82
+ return B(e) ? {
83
+ scrollLeft: e.scrollLeft,
84
+ scrollTop: e.scrollTop
85
+ } : {
86
+ scrollLeft: e.scrollX,
87
+ scrollTop: e.scrollY
88
+ };
89
+ }
90
+ function me(e) {
91
+ if (xe(e) === "html")
92
+ return e;
93
+ const t = (
94
+ // Step into the shadow DOM of the parent of a slotted node.
95
+ e.assignedSlot || // DOM Element detected.
96
+ e.parentNode || // ShadowRoot detected.
97
+ Ue(e) && e.host || // Fallback.
98
+ ce(e)
99
+ );
100
+ return Ue(t) ? t.host : t;
101
+ }
102
+ function mn(e) {
103
+ const t = me(e);
104
+ return de(t) ? e.ownerDocument ? e.ownerDocument.body : e.body : q(t) && Le(t) ? t : mn(t);
105
+ }
106
+ function ye(e, t, n) {
107
+ var r;
108
+ t === void 0 && (t = []), n === void 0 && (n = !0);
109
+ const o = mn(e), i = o === ((r = e.ownerDocument) == null ? void 0 : r.body), s = J(o);
110
+ if (i) {
111
+ const c = bt(s);
112
+ return t.concat(s, s.visualViewport || [], Le(o) ? o : [], c && n ? ye(c) : []);
113
+ } else
114
+ return t.concat(o, ye(o, [], n));
115
+ }
116
+ function bt(e) {
117
+ return e.parent && Object.getPrototypeOf(e.parent) ? e.frameElement : null;
118
+ }
119
+ const Pe = Math.min, G = Math.max, Xe = Math.round, Ve = Math.floor, se = (e) => ({
120
+ x: e,
121
+ y: e
122
+ }), Xn = {
123
+ left: "right",
124
+ right: "left",
125
+ bottom: "top",
126
+ top: "bottom"
127
+ };
128
+ function Dt(e, t, n) {
129
+ return G(e, Pe(t, n));
130
+ }
131
+ function Ne(e, t) {
132
+ return typeof e == "function" ? e(t) : e;
133
+ }
134
+ function we(e) {
135
+ return e.split("-")[0];
136
+ }
137
+ function $e(e) {
138
+ return e.split("-")[1];
139
+ }
140
+ function gn(e) {
141
+ return e === "x" ? "y" : "x";
142
+ }
143
+ function pn(e) {
144
+ return e === "y" ? "height" : "width";
145
+ }
146
+ function ue(e) {
147
+ const t = e[0];
148
+ return t === "t" || t === "b" ? "y" : "x";
149
+ }
150
+ function hn(e) {
151
+ return gn(ue(e));
152
+ }
153
+ function Yn(e, t, n) {
154
+ n === void 0 && (n = !1);
155
+ const r = $e(e), o = hn(e), i = pn(o);
156
+ let s = o === "x" ? r === (n ? "end" : "start") ? "right" : "left" : r === "start" ? "bottom" : "top";
157
+ return t.reference[i] > t.floating[i] && (s = Ye(s)), [s, Ye(s)];
158
+ }
159
+ function zn(e) {
160
+ const t = Ye(e);
161
+ return [vt(e), t, vt(t)];
162
+ }
163
+ function vt(e) {
164
+ return e.includes("start") ? e.replace("start", "end") : e.replace("end", "start");
165
+ }
166
+ const kt = ["left", "right"], Ft = ["right", "left"], Gn = ["top", "bottom"], Zn = ["bottom", "top"];
167
+ function Jn(e, t, n) {
168
+ switch (e) {
169
+ case "top":
170
+ case "bottom":
171
+ return n ? t ? Ft : kt : t ? kt : Ft;
172
+ case "left":
173
+ case "right":
174
+ return t ? Gn : Zn;
175
+ default:
176
+ return [];
177
+ }
178
+ }
179
+ function Qn(e, t, n, r) {
180
+ const o = $e(e);
181
+ let i = Jn(we(e), n === "start", r);
182
+ return o && (i = i.map((s) => s + "-" + o), t && (i = i.concat(i.map(vt)))), i;
183
+ }
184
+ function Ye(e) {
185
+ const t = we(e);
186
+ return Xn[t] + e.slice(t.length);
187
+ }
188
+ function er(e) {
189
+ return {
190
+ top: 0,
191
+ right: 0,
192
+ bottom: 0,
193
+ left: 0,
194
+ ...e
195
+ };
196
+ }
197
+ function tr(e) {
198
+ return typeof e != "number" ? er(e) : {
199
+ top: e,
200
+ right: e,
201
+ bottom: e,
202
+ left: e
203
+ };
204
+ }
205
+ function ze(e) {
206
+ const {
207
+ x: t,
208
+ y: n,
209
+ width: r,
210
+ height: o
211
+ } = e;
212
+ return {
213
+ width: r,
214
+ height: o,
215
+ top: n,
216
+ left: t,
217
+ right: t + r,
218
+ bottom: n + o,
219
+ x: t,
220
+ y: n
221
+ };
222
+ }
223
+ /*!
224
+ * tabbable 6.2.0
225
+ * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
226
+ */
227
+ var nr = ["input:not([inert])", "select:not([inert])", "textarea:not([inert])", "a[href]:not([inert])", "button:not([inert])", "[tabindex]:not(slot):not([inert])", "audio[controls]:not([inert])", "video[controls]:not([inert])", '[contenteditable]:not([contenteditable="false"]):not([inert])', "details>summary:first-of-type:not([inert])", "details:not([inert])"], Ge = /* @__PURE__ */ nr.join(","), bn = typeof Element > "u", De = bn ? function() {
228
+ } : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector, Ze = !bn && Element.prototype.getRootNode ? function(e) {
229
+ var t;
230
+ return e == null || (t = e.getRootNode) === null || t === void 0 ? void 0 : t.call(e);
231
+ } : function(e) {
232
+ return e == null ? void 0 : e.ownerDocument;
233
+ }, Je = function e(t, n) {
234
+ var r;
235
+ n === void 0 && (n = !0);
236
+ var o = t == null || (r = t.getAttribute) === null || r === void 0 ? void 0 : r.call(t, "inert"), i = o === "" || o === "true", s = i || n && t && e(t.parentNode);
237
+ return s;
238
+ }, rr = function(t) {
239
+ var n, r = t == null || (n = t.getAttribute) === null || n === void 0 ? void 0 : n.call(t, "contenteditable");
240
+ return r === "" || r === "true";
241
+ }, vn = function(t, n, r) {
242
+ if (Je(t))
243
+ return [];
244
+ var o = Array.prototype.slice.apply(t.querySelectorAll(Ge));
245
+ return n && De.call(t, Ge) && o.unshift(t), o = o.filter(r), o;
246
+ }, yn = function e(t, n, r) {
247
+ for (var o = [], i = Array.from(t); i.length; ) {
248
+ var s = i.shift();
249
+ if (!Je(s, !1))
250
+ if (s.tagName === "SLOT") {
251
+ var c = s.assignedElements(), l = c.length ? c : s.children, a = e(l, !0, r);
252
+ r.flatten ? o.push.apply(o, a) : o.push({
253
+ scopeParent: s,
254
+ candidates: a
255
+ });
256
+ } else {
257
+ var u = De.call(s, Ge);
258
+ u && r.filter(s) && (n || !t.includes(s)) && o.push(s);
259
+ var d = s.shadowRoot || // check for an undisclosed shadow
260
+ typeof r.getShadowRoot == "function" && r.getShadowRoot(s), p = !Je(d, !1) && (!r.shadowRootFilter || r.shadowRootFilter(s));
261
+ if (d && p) {
262
+ var f = e(d === !0 ? s.children : d.children, !0, r);
263
+ r.flatten ? o.push.apply(o, f) : o.push({
264
+ scopeParent: s,
265
+ candidates: f
266
+ });
267
+ } else
268
+ i.unshift.apply(i, s.children);
269
+ }
270
+ }
271
+ return o;
272
+ }, wn = function(t) {
273
+ return !isNaN(parseInt(t.getAttribute("tabindex"), 10));
274
+ }, xn = function(t) {
275
+ if (!t)
276
+ throw new Error("No node provided");
277
+ return t.tabIndex < 0 && (/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName) || rr(t)) && !wn(t) ? 0 : t.tabIndex;
278
+ }, or = function(t, n) {
279
+ var r = xn(t);
280
+ return r < 0 && n && !wn(t) ? 0 : r;
281
+ }, ir = function(t, n) {
282
+ return t.tabIndex === n.tabIndex ? t.documentOrder - n.documentOrder : t.tabIndex - n.tabIndex;
283
+ }, Rn = function(t) {
284
+ return t.tagName === "INPUT";
285
+ }, sr = function(t) {
286
+ return Rn(t) && t.type === "hidden";
287
+ }, cr = function(t) {
288
+ var n = t.tagName === "DETAILS" && Array.prototype.slice.apply(t.children).some(function(r) {
289
+ return r.tagName === "SUMMARY";
290
+ });
291
+ return n;
292
+ }, lr = function(t, n) {
293
+ for (var r = 0; r < t.length; r++)
294
+ if (t[r].checked && t[r].form === n)
295
+ return t[r];
296
+ }, ar = function(t) {
297
+ if (!t.name)
298
+ return !0;
299
+ var n = t.form || Ze(t), r = function(c) {
300
+ return n.querySelectorAll('input[type="radio"][name="' + c + '"]');
301
+ }, o;
302
+ if (typeof window < "u" && typeof window.CSS < "u" && typeof window.CSS.escape == "function")
303
+ o = r(window.CSS.escape(t.name));
304
+ else
305
+ try {
306
+ o = r(t.name);
307
+ } catch (s) {
308
+ return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s", s.message), !1;
309
+ }
310
+ var i = lr(o, t.form);
311
+ return !i || i === t;
312
+ }, ur = function(t) {
313
+ return Rn(t) && t.type === "radio";
314
+ }, fr = function(t) {
315
+ return ur(t) && !ar(t);
316
+ }, dr = function(t) {
317
+ var n, r = t && Ze(t), o = (n = r) === null || n === void 0 ? void 0 : n.host, i = !1;
318
+ if (r && r !== t) {
319
+ var s, c, l;
320
+ for (i = !!((s = o) !== null && s !== void 0 && (c = s.ownerDocument) !== null && c !== void 0 && c.contains(o) || t != null && (l = t.ownerDocument) !== null && l !== void 0 && l.contains(t)); !i && o; ) {
321
+ var a, u, d;
322
+ r = Ze(o), o = (a = r) === null || a === void 0 ? void 0 : a.host, i = !!((u = o) !== null && u !== void 0 && (d = u.ownerDocument) !== null && d !== void 0 && d.contains(o));
323
+ }
324
+ }
325
+ return i;
326
+ }, Lt = function(t) {
327
+ var n = t.getBoundingClientRect(), r = n.width, o = n.height;
328
+ return r === 0 && o === 0;
329
+ }, mr = function(t, n) {
330
+ var r = n.displayCheck, o = n.getShadowRoot;
331
+ if (getComputedStyle(t).visibility === "hidden")
332
+ return !0;
333
+ var i = De.call(t, "details>summary:first-of-type"), s = i ? t.parentElement : t;
334
+ if (De.call(s, "details:not([open]) *"))
335
+ return !0;
336
+ if (!r || r === "full" || r === "legacy-full") {
337
+ if (typeof o == "function") {
338
+ for (var c = t; t; ) {
339
+ var l = t.parentElement, a = Ze(t);
340
+ if (l && !l.shadowRoot && o(l) === !0)
341
+ return Lt(t);
342
+ t.assignedSlot ? t = t.assignedSlot : !l && a !== t.ownerDocument ? t = a.host : t = l;
343
+ }
344
+ t = c;
345
+ }
346
+ if (dr(t))
347
+ return !t.getClientRects().length;
348
+ if (r !== "legacy-full")
349
+ return !0;
350
+ } else if (r === "non-zero-area")
351
+ return Lt(t);
352
+ return !1;
353
+ }, gr = function(t) {
354
+ if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))
355
+ for (var n = t.parentElement; n; ) {
356
+ if (n.tagName === "FIELDSET" && n.disabled) {
357
+ for (var r = 0; r < n.children.length; r++) {
358
+ var o = n.children.item(r);
359
+ if (o.tagName === "LEGEND")
360
+ return De.call(n, "fieldset[disabled] *") ? !0 : !o.contains(t);
361
+ }
362
+ return !0;
363
+ }
364
+ n = n.parentElement;
365
+ }
366
+ return !1;
367
+ }, yt = function(t, n) {
368
+ return !(n.disabled || // we must do an inert look up to filter out any elements inside an inert ancestor
369
+ // because we're limited in the type of selectors we can use in JSDom (see related
370
+ // note related to `candidateSelectors`)
371
+ Je(n) || sr(n) || mr(n, t) || // For a details element with a summary, the summary element gets the focus
372
+ cr(n) || gr(n));
373
+ }, wt = function(t, n) {
374
+ return !(fr(n) || xn(n) < 0 || !yt(t, n));
375
+ }, pr = function(t) {
376
+ var n = parseInt(t.getAttribute("tabindex"), 10);
377
+ return !!(isNaN(n) || n >= 0);
378
+ }, hr = function e(t) {
379
+ var n = [], r = [];
380
+ return t.forEach(function(o, i) {
381
+ var s = !!o.scopeParent, c = s ? o.scopeParent : o, l = or(c, s), a = s ? e(o.candidates) : c;
382
+ l === 0 ? s ? n.push.apply(n, a) : n.push(c) : r.push({
383
+ documentOrder: i,
384
+ tabIndex: l,
385
+ item: o,
386
+ isScope: s,
387
+ content: a
388
+ });
389
+ }), r.sort(ir).reduce(function(o, i) {
390
+ return i.isScope ? o.push.apply(o, i.content) : o.push(i.content), o;
391
+ }, []).concat(n);
392
+ }, it = function(t, n) {
393
+ n = n || {};
394
+ var r;
395
+ return n.getShadowRoot ? r = yn([t], n.includeContainer, {
396
+ filter: wt.bind(null, n),
397
+ flatten: !1,
398
+ getShadowRoot: n.getShadowRoot,
399
+ shadowRootFilter: pr
400
+ }) : r = vn(t, n.includeContainer, wt.bind(null, n)), hr(r);
401
+ }, br = function(t, n) {
402
+ n = n || {};
403
+ var r;
404
+ return n.getShadowRoot ? r = yn([t], n.includeContainer, {
405
+ filter: yt.bind(null, n),
406
+ flatten: !0,
407
+ getShadowRoot: n.getShadowRoot
408
+ }) : r = vn(t, n.includeContainer, yt.bind(null, n)), r;
409
+ }, En = function(t, n) {
410
+ if (n = n || {}, !t)
411
+ throw new Error("No node provided");
412
+ return De.call(t, Ge) === !1 ? !1 : wt(n, t);
413
+ };
414
+ function Sn() {
415
+ const e = navigator.userAgentData;
416
+ return e != null && e.platform ? e.platform : navigator.platform;
417
+ }
418
+ function Tn() {
419
+ const e = navigator.userAgentData;
420
+ return e && Array.isArray(e.brands) ? e.brands.map((t) => {
421
+ let {
422
+ brand: n,
423
+ version: r
424
+ } = t;
425
+ return n + "/" + r;
426
+ }).join(" ") : navigator.userAgent;
427
+ }
428
+ function vr() {
429
+ return /apple/i.test(navigator.vendor);
430
+ }
431
+ function xt() {
432
+ const e = /android/i;
433
+ return e.test(Sn()) || e.test(Tn());
434
+ }
435
+ function yr() {
436
+ return Tn().includes("jsdom/");
437
+ }
438
+ const Nt = "data-floating-ui-focusable", wr = "input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";
439
+ function Ae(e) {
440
+ let t = e.activeElement;
441
+ for (; ((n = t) == null || (n = n.shadowRoot) == null ? void 0 : n.activeElement) != null; ) {
442
+ var n;
443
+ t = t.shadowRoot.activeElement;
444
+ }
445
+ return t;
446
+ }
447
+ function z(e, t) {
448
+ if (!e || !t)
449
+ return !1;
450
+ const n = t.getRootNode == null ? void 0 : t.getRootNode();
451
+ if (e.contains(t))
452
+ return !0;
453
+ if (n && Ue(n)) {
454
+ let r = t;
455
+ for (; r; ) {
456
+ if (e === r)
457
+ return !0;
458
+ r = r.parentNode || r.host;
459
+ }
460
+ }
461
+ return !1;
462
+ }
463
+ function be(e) {
464
+ return "composedPath" in e ? e.composedPath()[0] : e.target;
465
+ }
466
+ function ut(e, t) {
467
+ if (t == null)
468
+ return !1;
469
+ if ("composedPath" in e)
470
+ return e.composedPath().includes(t);
471
+ const n = e;
472
+ return n.target != null && t.contains(n.target);
473
+ }
474
+ function xr(e) {
475
+ return e.matches("html,body");
476
+ }
477
+ function re(e) {
478
+ return (e == null ? void 0 : e.ownerDocument) || document;
479
+ }
480
+ function Cn(e) {
481
+ return q(e) && e.matches(wr);
482
+ }
483
+ function $t(e) {
484
+ return e ? e.getAttribute("role") === "combobox" && Cn(e) : !1;
485
+ }
486
+ function Rt(e) {
487
+ return e ? e.hasAttribute(Nt) ? e : e.querySelector("[" + Nt + "]") || e : null;
488
+ }
489
+ function Oe(e, t, n) {
490
+ return n === void 0 && (n = !0), e.filter((o) => {
491
+ var i;
492
+ return o.parentId === t && (!n || ((i = o.context) == null ? void 0 : i.open));
493
+ }).flatMap((o) => [o, ...Oe(e, o.id, n)]);
494
+ }
495
+ function _t(e, t) {
496
+ var n;
497
+ let r = [], o = (n = e.find((i) => i.id === t)) == null ? void 0 : n.parentId;
498
+ for (; o; ) {
499
+ const i = e.find((s) => s.id === o);
500
+ o = i == null ? void 0 : i.parentId, i && (r = r.concat(i));
501
+ }
502
+ return r;
503
+ }
504
+ function ft(e) {
505
+ e.preventDefault(), e.stopPropagation();
506
+ }
507
+ function Rr(e) {
508
+ return "nativeEvent" in e;
509
+ }
510
+ function Er(e) {
511
+ return e.mozInputSource === 0 && e.isTrusted ? !0 : xt() && e.pointerType ? e.type === "click" && e.buttons === 1 : e.detail === 0 && !e.pointerType;
512
+ }
513
+ function Sr(e) {
514
+ return yr() ? !1 : !xt() && e.width === 0 && e.height === 0 || xt() && e.width === 1 && e.height === 1 && e.pressure === 0 && e.detail === 0 && e.pointerType === "mouse" || // iOS VoiceOver returns 0.333• for width/height.
515
+ e.width < 1 && e.height < 1 && e.pressure === 0 && e.detail === 0 && e.pointerType === "touch";
516
+ }
517
+ function Wt(e, t) {
518
+ return ["mouse", "pen"].includes(e);
519
+ }
520
+ var Tr = typeof document < "u", Cr = function() {
521
+ }, Z = Tr ? un : Cr;
522
+ const Ar = {
523
+ ...g
524
+ };
525
+ function dt(e) {
526
+ const t = g.useRef(e);
527
+ return Z(() => {
528
+ t.current = e;
529
+ }), t;
530
+ }
531
+ const Or = Ar.useInsertionEffect, Ir = Or || ((e) => e());
532
+ function ie(e) {
533
+ const t = g.useRef(() => {
534
+ if (process.env.NODE_ENV !== "production")
535
+ throw new Error("Cannot call an event handler while rendering.");
536
+ });
537
+ return Ir(() => {
538
+ t.current = e;
539
+ }), g.useCallback(function() {
540
+ for (var n = arguments.length, r = new Array(n), o = 0; o < n; o++)
541
+ r[o] = arguments[o];
542
+ return t.current == null ? void 0 : t.current(...r);
543
+ }, []);
544
+ }
545
+ const _e = () => ({
546
+ getShadowRoot: !0,
547
+ displayCheck: (
548
+ // JSDOM does not support the `tabbable` library. To solve this we can
549
+ // check if `ResizeObserver` is a real function (not polyfilled), which
550
+ // determines if the current environment is JSDOM-like.
551
+ typeof ResizeObserver == "function" && ResizeObserver.toString().includes("[native code]") ? "full" : "none"
552
+ )
553
+ });
554
+ function An(e, t) {
555
+ const n = it(e, _e()), r = n.length;
556
+ if (r === 0) return;
557
+ const o = Ae(re(e)), i = n.indexOf(o), s = i === -1 ? t === 1 ? 0 : r - 1 : i + t;
558
+ return n[s];
559
+ }
560
+ function On(e) {
561
+ return An(re(e).body, 1) || e;
562
+ }
563
+ function In(e) {
564
+ return An(re(e).body, -1) || e;
565
+ }
566
+ function ke(e, t) {
567
+ const n = t || e.currentTarget, r = e.relatedTarget;
568
+ return !r || !z(n, r);
569
+ }
570
+ function Mr(e) {
571
+ it(e, _e()).forEach((n) => {
572
+ n.dataset.tabindex = n.getAttribute("tabindex") || "", n.setAttribute("tabindex", "-1");
573
+ });
574
+ }
575
+ function Bt(e) {
576
+ e.querySelectorAll("[data-tabindex]").forEach((n) => {
577
+ const r = n.dataset.tabindex;
578
+ delete n.dataset.tabindex, r ? n.setAttribute("tabindex", r) : n.removeAttribute("tabindex");
579
+ });
580
+ }
581
+ function Vt(e, t, n) {
582
+ let {
583
+ reference: r,
584
+ floating: o
585
+ } = e;
586
+ const i = ue(t), s = hn(t), c = pn(s), l = we(t), a = i === "y", u = r.x + r.width / 2 - o.width / 2, d = r.y + r.height / 2 - o.height / 2, p = r[c] / 2 - o[c] / 2;
587
+ let f;
588
+ switch (l) {
589
+ case "top":
590
+ f = {
591
+ x: u,
592
+ y: r.y - o.height
593
+ };
594
+ break;
595
+ case "bottom":
596
+ f = {
597
+ x: u,
598
+ y: r.y + r.height
599
+ };
600
+ break;
601
+ case "right":
602
+ f = {
603
+ x: r.x + r.width,
604
+ y: d
605
+ };
606
+ break;
607
+ case "left":
608
+ f = {
609
+ x: r.x - o.width,
610
+ y: d
611
+ };
612
+ break;
613
+ default:
614
+ f = {
615
+ x: r.x,
616
+ y: r.y
617
+ };
618
+ }
619
+ switch ($e(t)) {
620
+ case "start":
621
+ f[s] -= p * (n && a ? -1 : 1);
622
+ break;
623
+ case "end":
624
+ f[s] += p * (n && a ? -1 : 1);
625
+ break;
626
+ }
627
+ return f;
628
+ }
629
+ async function Mn(e, t) {
630
+ var n;
631
+ t === void 0 && (t = {});
632
+ const {
633
+ x: r,
634
+ y: o,
635
+ platform: i,
636
+ rects: s,
637
+ elements: c,
638
+ strategy: l
639
+ } = e, {
640
+ boundary: a = "clippingAncestors",
641
+ rootBoundary: u = "viewport",
642
+ elementContext: d = "floating",
643
+ altBoundary: p = !1,
644
+ padding: f = 0
645
+ } = Ne(t, e), h = tr(f), x = c[p ? d === "floating" ? "reference" : "floating" : d], y = ze(await i.getClippingRect({
646
+ element: (n = await (i.isElement == null ? void 0 : i.isElement(x))) == null || n ? x : x.contextElement || await (i.getDocumentElement == null ? void 0 : i.getDocumentElement(c.floating)),
647
+ boundary: a,
648
+ rootBoundary: u,
649
+ strategy: l
650
+ })), b = d === "floating" ? {
651
+ x: r,
652
+ y: o,
653
+ width: s.floating.width,
654
+ height: s.floating.height
655
+ } : s.reference, v = await (i.getOffsetParent == null ? void 0 : i.getOffsetParent(c.floating)), S = await (i.isElement == null ? void 0 : i.isElement(v)) ? await (i.getScale == null ? void 0 : i.getScale(v)) || {
656
+ x: 1,
657
+ y: 1
658
+ } : {
659
+ x: 1,
660
+ y: 1
661
+ }, A = ze(i.convertOffsetParentRelativeRectToViewportRelativeRect ? await i.convertOffsetParentRelativeRectToViewportRelativeRect({
662
+ elements: c,
663
+ rect: b,
664
+ offsetParent: v,
665
+ strategy: l
666
+ }) : b);
667
+ return {
668
+ top: (y.top - A.top + h.top) / S.y,
669
+ bottom: (A.bottom - y.bottom + h.bottom) / S.y,
670
+ left: (y.left - A.left + h.left) / S.x,
671
+ right: (A.right - y.right + h.right) / S.x
672
+ };
673
+ }
674
+ const Pr = 50, Dr = async (e, t, n) => {
675
+ const {
676
+ placement: r = "bottom",
677
+ strategy: o = "absolute",
678
+ middleware: i = [],
679
+ platform: s
680
+ } = n, c = s.detectOverflow ? s : {
681
+ ...s,
682
+ detectOverflow: Mn
683
+ }, l = await (s.isRTL == null ? void 0 : s.isRTL(t));
684
+ let a = await s.getElementRects({
685
+ reference: e,
686
+ floating: t,
687
+ strategy: o
688
+ }), {
689
+ x: u,
690
+ y: d
691
+ } = Vt(a, r, l), p = r, f = 0;
692
+ const h = {};
693
+ for (let m = 0; m < i.length; m++) {
694
+ const x = i[m];
695
+ if (!x)
696
+ continue;
697
+ const {
698
+ name: y,
699
+ fn: b
700
+ } = x, {
701
+ x: v,
702
+ y: S,
703
+ data: A,
704
+ reset: O
705
+ } = await b({
706
+ x: u,
707
+ y: d,
708
+ initialPlacement: r,
709
+ placement: p,
710
+ strategy: o,
711
+ middlewareData: h,
712
+ rects: a,
713
+ platform: c,
714
+ elements: {
715
+ reference: e,
716
+ floating: t
717
+ }
718
+ });
719
+ u = v ?? u, d = S ?? d, h[y] = {
720
+ ...h[y],
721
+ ...A
722
+ }, O && f < Pr && (f++, typeof O == "object" && (O.placement && (p = O.placement), O.rects && (a = O.rects === !0 ? await s.getElementRects({
723
+ reference: e,
724
+ floating: t,
725
+ strategy: o
726
+ }) : O.rects), {
727
+ x: u,
728
+ y: d
729
+ } = Vt(a, p, l)), m = -1);
730
+ }
731
+ return {
732
+ x: u,
733
+ y: d,
734
+ placement: p,
735
+ strategy: o,
736
+ middlewareData: h
737
+ };
738
+ }, kr = function(e) {
739
+ return e === void 0 && (e = {}), {
740
+ name: "flip",
741
+ options: e,
742
+ async fn(t) {
743
+ var n, r;
744
+ const {
745
+ placement: o,
746
+ middlewareData: i,
747
+ rects: s,
748
+ initialPlacement: c,
749
+ platform: l,
750
+ elements: a
751
+ } = t, {
752
+ mainAxis: u = !0,
753
+ crossAxis: d = !0,
754
+ fallbackPlacements: p,
755
+ fallbackStrategy: f = "bestFit",
756
+ fallbackAxisSideDirection: h = "none",
757
+ flipAlignment: m = !0,
758
+ ...x
759
+ } = Ne(e, t);
760
+ if ((n = i.arrow) != null && n.alignmentOffset)
761
+ return {};
762
+ const y = we(o), b = ue(c), v = we(c) === c, S = await (l.isRTL == null ? void 0 : l.isRTL(a.floating)), A = p || (v || !m ? [Ye(c)] : zn(c)), O = h !== "none";
763
+ !p && O && A.push(...Qn(c, m, h, S));
764
+ const M = [c, ...A], $ = await l.detectOverflow(t, x), j = [];
765
+ let W = ((r = i.flip) == null ? void 0 : r.overflows) || [];
766
+ if (u && j.push($[y]), d) {
767
+ const R = Yn(o, s, S);
768
+ j.push($[R[0]], $[R[1]]);
769
+ }
770
+ if (W = [...W, {
771
+ placement: o,
772
+ overflows: j
773
+ }], !j.every((R) => R <= 0)) {
774
+ var _, X;
775
+ const R = (((_ = i.flip) == null ? void 0 : _.index) || 0) + 1, E = M[R];
776
+ if (E && (!(d === "alignment" ? b !== ue(E) : !1) || // We leave the current main axis only if every placement on that axis
777
+ // overflows the main axis.
778
+ W.every((w) => ue(w.placement) === b ? w.overflows[0] > 0 : !0)))
779
+ return {
780
+ data: {
781
+ index: R,
782
+ overflows: W
783
+ },
784
+ reset: {
785
+ placement: E
786
+ }
787
+ };
788
+ let k = (X = W.filter((L) => L.overflows[0] <= 0).sort((L, w) => L.overflows[1] - w.overflows[1])[0]) == null ? void 0 : X.placement;
789
+ if (!k)
790
+ switch (f) {
791
+ case "bestFit": {
792
+ var H;
793
+ const L = (H = W.filter((w) => {
794
+ if (O) {
795
+ const I = ue(w.placement);
796
+ return I === b || // Create a bias to the `y` side axis due to horizontal
797
+ // reading directions favoring greater width.
798
+ I === "y";
799
+ }
800
+ return !0;
801
+ }).map((w) => [w.placement, w.overflows.filter((I) => I > 0).reduce((I, N) => I + N, 0)]).sort((w, I) => w[1] - I[1])[0]) == null ? void 0 : H[0];
802
+ L && (k = L);
803
+ break;
804
+ }
805
+ case "initialPlacement":
806
+ k = c;
807
+ break;
808
+ }
809
+ if (o !== k)
810
+ return {
811
+ reset: {
812
+ placement: k
813
+ }
814
+ };
815
+ }
816
+ return {};
817
+ }
818
+ };
819
+ }, Fr = /* @__PURE__ */ new Set(["left", "top"]);
820
+ async function Lr(e, t) {
821
+ const {
822
+ placement: n,
823
+ platform: r,
824
+ elements: o
825
+ } = e, i = await (r.isRTL == null ? void 0 : r.isRTL(o.floating)), s = we(n), c = $e(n), l = ue(n) === "y", a = Fr.has(s) ? -1 : 1, u = i && l ? -1 : 1, d = Ne(t, e);
826
+ let {
827
+ mainAxis: p,
828
+ crossAxis: f,
829
+ alignmentAxis: h
830
+ } = typeof d == "number" ? {
831
+ mainAxis: d,
832
+ crossAxis: 0,
833
+ alignmentAxis: null
834
+ } : {
835
+ mainAxis: d.mainAxis || 0,
836
+ crossAxis: d.crossAxis || 0,
837
+ alignmentAxis: d.alignmentAxis
838
+ };
839
+ return c && typeof h == "number" && (f = c === "end" ? h * -1 : h), l ? {
840
+ x: f * u,
841
+ y: p * a
842
+ } : {
843
+ x: p * a,
844
+ y: f * u
845
+ };
846
+ }
847
+ const Nr = function(e) {
848
+ return e === void 0 && (e = 0), {
849
+ name: "offset",
850
+ options: e,
851
+ async fn(t) {
852
+ var n, r;
853
+ const {
854
+ x: o,
855
+ y: i,
856
+ placement: s,
857
+ middlewareData: c
858
+ } = t, l = await Lr(t, e);
859
+ return s === ((n = c.offset) == null ? void 0 : n.placement) && (r = c.arrow) != null && r.alignmentOffset ? {} : {
860
+ x: o + l.x,
861
+ y: i + l.y,
862
+ data: {
863
+ ...l,
864
+ placement: s
865
+ }
866
+ };
867
+ }
868
+ };
869
+ }, $r = function(e) {
870
+ return e === void 0 && (e = {}), {
871
+ name: "shift",
872
+ options: e,
873
+ async fn(t) {
874
+ const {
875
+ x: n,
876
+ y: r,
877
+ placement: o,
878
+ platform: i
879
+ } = t, {
880
+ mainAxis: s = !0,
881
+ crossAxis: c = !1,
882
+ limiter: l = {
883
+ fn: (y) => {
884
+ let {
885
+ x: b,
886
+ y: v
887
+ } = y;
888
+ return {
889
+ x: b,
890
+ y: v
891
+ };
892
+ }
893
+ },
894
+ ...a
895
+ } = Ne(e, t), u = {
896
+ x: n,
897
+ y: r
898
+ }, d = await i.detectOverflow(t, a), p = ue(we(o)), f = gn(p);
899
+ let h = u[f], m = u[p];
900
+ if (s) {
901
+ const y = f === "y" ? "top" : "left", b = f === "y" ? "bottom" : "right", v = h + d[y], S = h - d[b];
902
+ h = Dt(v, h, S);
903
+ }
904
+ if (c) {
905
+ const y = p === "y" ? "top" : "left", b = p === "y" ? "bottom" : "right", v = m + d[y], S = m - d[b];
906
+ m = Dt(v, m, S);
907
+ }
908
+ const x = l.fn({
909
+ ...t,
910
+ [f]: h,
911
+ [p]: m
912
+ });
913
+ return {
914
+ ...x,
915
+ data: {
916
+ x: x.x - n,
917
+ y: x.y - r,
918
+ enabled: {
919
+ [f]: s,
920
+ [p]: c
921
+ }
922
+ }
923
+ };
924
+ }
925
+ };
926
+ }, _r = function(e) {
927
+ return e === void 0 && (e = {}), {
928
+ name: "size",
929
+ options: e,
930
+ async fn(t) {
931
+ var n, r;
932
+ const {
933
+ placement: o,
934
+ rects: i,
935
+ platform: s,
936
+ elements: c
937
+ } = t, {
938
+ apply: l = () => {
939
+ },
940
+ ...a
941
+ } = Ne(e, t), u = await s.detectOverflow(t, a), d = we(o), p = $e(o), f = ue(o) === "y", {
942
+ width: h,
943
+ height: m
944
+ } = i.floating;
945
+ let x, y;
946
+ d === "top" || d === "bottom" ? (x = d, y = p === (await (s.isRTL == null ? void 0 : s.isRTL(c.floating)) ? "start" : "end") ? "left" : "right") : (y = d, x = p === "end" ? "top" : "bottom");
947
+ const b = m - u.top - u.bottom, v = h - u.left - u.right, S = Pe(m - u[x], b), A = Pe(h - u[y], v), O = !t.middlewareData.shift;
948
+ let M = S, $ = A;
949
+ if ((n = t.middlewareData.shift) != null && n.enabled.x && ($ = v), (r = t.middlewareData.shift) != null && r.enabled.y && (M = b), O && !p) {
950
+ const W = G(u.left, 0), _ = G(u.right, 0), X = G(u.top, 0), H = G(u.bottom, 0);
951
+ f ? $ = h - 2 * (W !== 0 || _ !== 0 ? W + _ : G(u.left, u.right)) : M = m - 2 * (X !== 0 || H !== 0 ? X + H : G(u.top, u.bottom));
952
+ }
953
+ await l({
954
+ ...t,
955
+ availableWidth: $,
956
+ availableHeight: M
957
+ });
958
+ const j = await s.getDimensions(c.floating);
959
+ return h !== j.width || m !== j.height ? {
960
+ reset: {
961
+ rects: !0
962
+ }
963
+ } : {};
964
+ }
965
+ };
966
+ };
967
+ function Pn(e) {
968
+ const t = te(e);
969
+ let n = parseFloat(t.width) || 0, r = parseFloat(t.height) || 0;
970
+ const o = q(e), i = o ? e.offsetWidth : n, s = o ? e.offsetHeight : r, c = Xe(n) !== i || Xe(r) !== s;
971
+ return c && (n = i, r = s), {
972
+ width: n,
973
+ height: r,
974
+ $: c
975
+ };
976
+ }
977
+ function Ct(e) {
978
+ return B(e) ? e : e.contextElement;
979
+ }
980
+ function Ie(e) {
981
+ const t = Ct(e);
982
+ if (!q(t))
983
+ return se(1);
984
+ const n = t.getBoundingClientRect(), {
985
+ width: r,
986
+ height: o,
987
+ $: i
988
+ } = Pn(t);
989
+ let s = (i ? Xe(n.width) : n.width) / r, c = (i ? Xe(n.height) : n.height) / o;
990
+ return (!s || !Number.isFinite(s)) && (s = 1), (!c || !Number.isFinite(c)) && (c = 1), {
991
+ x: s,
992
+ y: c
993
+ };
994
+ }
995
+ const Wr = /* @__PURE__ */ se(0);
996
+ function Dn(e) {
997
+ const t = J(e);
998
+ return !rt() || !t.visualViewport ? Wr : {
999
+ x: t.visualViewport.offsetLeft,
1000
+ y: t.visualViewport.offsetTop
1001
+ };
1002
+ }
1003
+ function Br(e, t, n) {
1004
+ return t === void 0 && (t = !1), !n || t && n !== J(e) ? !1 : t;
1005
+ }
1006
+ function Se(e, t, n, r) {
1007
+ t === void 0 && (t = !1), n === void 0 && (n = !1);
1008
+ const o = e.getBoundingClientRect(), i = Ct(e);
1009
+ let s = se(1);
1010
+ t && (r ? B(r) && (s = Ie(r)) : s = Ie(e));
1011
+ const c = Br(i, n, r) ? Dn(i) : se(0);
1012
+ let l = (o.left + c.x) / s.x, a = (o.top + c.y) / s.y, u = o.width / s.x, d = o.height / s.y;
1013
+ if (i) {
1014
+ const p = J(i), f = r && B(r) ? J(r) : r;
1015
+ let h = p, m = bt(h);
1016
+ for (; m && r && f !== h; ) {
1017
+ const x = Ie(m), y = m.getBoundingClientRect(), b = te(m), v = y.left + (m.clientLeft + parseFloat(b.paddingLeft)) * x.x, S = y.top + (m.clientTop + parseFloat(b.paddingTop)) * x.y;
1018
+ l *= x.x, a *= x.y, u *= x.x, d *= x.y, l += v, a += S, h = J(m), m = bt(h);
1019
+ }
1020
+ }
1021
+ return ze({
1022
+ width: u,
1023
+ height: d,
1024
+ x: l,
1025
+ y: a
1026
+ });
1027
+ }
1028
+ function st(e, t) {
1029
+ const n = ot(e).scrollLeft;
1030
+ return t ? t.left + n : Se(ce(e)).left + n;
1031
+ }
1032
+ function kn(e, t) {
1033
+ const n = e.getBoundingClientRect(), r = n.left + t.scrollLeft - st(e, n), o = n.top + t.scrollTop;
1034
+ return {
1035
+ x: r,
1036
+ y: o
1037
+ };
1038
+ }
1039
+ function Vr(e) {
1040
+ let {
1041
+ elements: t,
1042
+ rect: n,
1043
+ offsetParent: r,
1044
+ strategy: o
1045
+ } = e;
1046
+ const i = o === "fixed", s = ce(r), c = t ? nt(t.floating) : !1;
1047
+ if (r === s || c && i)
1048
+ return n;
1049
+ let l = {
1050
+ scrollLeft: 0,
1051
+ scrollTop: 0
1052
+ }, a = se(1);
1053
+ const u = se(0), d = q(r);
1054
+ if ((d || !d && !i) && ((xe(r) !== "body" || Le(s)) && (l = ot(r)), d)) {
1055
+ const f = Se(r);
1056
+ a = Ie(r), u.x = f.x + r.clientLeft, u.y = f.y + r.clientTop;
1057
+ }
1058
+ const p = s && !d && !i ? kn(s, l) : se(0);
1059
+ return {
1060
+ width: n.width * a.x,
1061
+ height: n.height * a.y,
1062
+ x: n.x * a.x - l.scrollLeft * a.x + u.x + p.x,
1063
+ y: n.y * a.y - l.scrollTop * a.y + u.y + p.y
1064
+ };
1065
+ }
1066
+ function Hr(e) {
1067
+ return Array.from(e.getClientRects());
1068
+ }
1069
+ function Kr(e) {
1070
+ const t = ce(e), n = ot(e), r = e.ownerDocument.body, o = G(t.scrollWidth, t.clientWidth, r.scrollWidth, r.clientWidth), i = G(t.scrollHeight, t.clientHeight, r.scrollHeight, r.clientHeight);
1071
+ let s = -n.scrollLeft + st(e);
1072
+ const c = -n.scrollTop;
1073
+ return te(r).direction === "rtl" && (s += G(t.clientWidth, r.clientWidth) - o), {
1074
+ width: o,
1075
+ height: i,
1076
+ x: s,
1077
+ y: c
1078
+ };
1079
+ }
1080
+ const Ht = 25;
1081
+ function qr(e, t) {
1082
+ const n = J(e), r = ce(e), o = n.visualViewport;
1083
+ let i = r.clientWidth, s = r.clientHeight, c = 0, l = 0;
1084
+ if (o) {
1085
+ i = o.width, s = o.height;
1086
+ const u = rt();
1087
+ (!u || u && t === "fixed") && (c = o.offsetLeft, l = o.offsetTop);
1088
+ }
1089
+ const a = st(r);
1090
+ if (a <= 0) {
1091
+ const u = r.ownerDocument, d = u.body, p = getComputedStyle(d), f = u.compatMode === "CSS1Compat" && parseFloat(p.marginLeft) + parseFloat(p.marginRight) || 0, h = Math.abs(r.clientWidth - d.clientWidth - f);
1092
+ h <= Ht && (i -= h);
1093
+ } else a <= Ht && (i += a);
1094
+ return {
1095
+ width: i,
1096
+ height: s,
1097
+ x: c,
1098
+ y: l
1099
+ };
1100
+ }
1101
+ function jr(e, t) {
1102
+ const n = Se(e, !0, t === "fixed"), r = n.top + e.clientTop, o = n.left + e.clientLeft, i = q(e) ? Ie(e) : se(1), s = e.clientWidth * i.x, c = e.clientHeight * i.y, l = o * i.x, a = r * i.y;
1103
+ return {
1104
+ width: s,
1105
+ height: c,
1106
+ x: l,
1107
+ y: a
1108
+ };
1109
+ }
1110
+ function Kt(e, t, n) {
1111
+ let r;
1112
+ if (t === "viewport")
1113
+ r = qr(e, n);
1114
+ else if (t === "document")
1115
+ r = Kr(ce(e));
1116
+ else if (B(t))
1117
+ r = jr(t, n);
1118
+ else {
1119
+ const o = Dn(e);
1120
+ r = {
1121
+ x: t.x - o.x,
1122
+ y: t.y - o.y,
1123
+ width: t.width,
1124
+ height: t.height
1125
+ };
1126
+ }
1127
+ return ze(r);
1128
+ }
1129
+ function Fn(e, t) {
1130
+ const n = me(e);
1131
+ return n === t || !B(n) || de(n) ? !1 : te(n).position === "fixed" || Fn(n, t);
1132
+ }
1133
+ function Ur(e, t) {
1134
+ const n = t.get(e);
1135
+ if (n)
1136
+ return n;
1137
+ let r = ye(e, [], !1).filter((c) => B(c) && xe(c) !== "body"), o = null;
1138
+ const i = te(e).position === "fixed";
1139
+ let s = i ? me(e) : e;
1140
+ for (; B(s) && !de(s); ) {
1141
+ const c = te(s), l = Tt(s);
1142
+ !l && c.position === "fixed" && (o = null), (i ? !l && !o : !l && c.position === "static" && !!o && (o.position === "absolute" || o.position === "fixed") || Le(s) && !l && Fn(e, s)) ? r = r.filter((u) => u !== s) : o = c, s = me(s);
1143
+ }
1144
+ return t.set(e, r), r;
1145
+ }
1146
+ function Xr(e) {
1147
+ let {
1148
+ element: t,
1149
+ boundary: n,
1150
+ rootBoundary: r,
1151
+ strategy: o
1152
+ } = e;
1153
+ const s = [...n === "clippingAncestors" ? nt(t) ? [] : Ur(t, this._c) : [].concat(n), r], c = Kt(t, s[0], o);
1154
+ let l = c.top, a = c.right, u = c.bottom, d = c.left;
1155
+ for (let p = 1; p < s.length; p++) {
1156
+ const f = Kt(t, s[p], o);
1157
+ l = G(f.top, l), a = Pe(f.right, a), u = Pe(f.bottom, u), d = G(f.left, d);
1158
+ }
1159
+ return {
1160
+ width: a - d,
1161
+ height: u - l,
1162
+ x: d,
1163
+ y: l
1164
+ };
1165
+ }
1166
+ function Yr(e) {
1167
+ const {
1168
+ width: t,
1169
+ height: n
1170
+ } = Pn(e);
1171
+ return {
1172
+ width: t,
1173
+ height: n
1174
+ };
1175
+ }
1176
+ function zr(e, t, n) {
1177
+ const r = q(t), o = ce(t), i = n === "fixed", s = Se(e, !0, i, t);
1178
+ let c = {
1179
+ scrollLeft: 0,
1180
+ scrollTop: 0
1181
+ };
1182
+ const l = se(0);
1183
+ function a() {
1184
+ l.x = st(o);
1185
+ }
1186
+ if (r || !r && !i)
1187
+ if ((xe(t) !== "body" || Le(o)) && (c = ot(t)), r) {
1188
+ const f = Se(t, !0, i, t);
1189
+ l.x = f.x + t.clientLeft, l.y = f.y + t.clientTop;
1190
+ } else o && a();
1191
+ i && !r && o && a();
1192
+ const u = o && !r && !i ? kn(o, c) : se(0), d = s.left + c.scrollLeft - l.x - u.x, p = s.top + c.scrollTop - l.y - u.y;
1193
+ return {
1194
+ x: d,
1195
+ y: p,
1196
+ width: s.width,
1197
+ height: s.height
1198
+ };
1199
+ }
1200
+ function mt(e) {
1201
+ return te(e).position === "static";
1202
+ }
1203
+ function qt(e, t) {
1204
+ if (!q(e) || te(e).position === "fixed")
1205
+ return null;
1206
+ if (t)
1207
+ return t(e);
1208
+ let n = e.offsetParent;
1209
+ return ce(e) === n && (n = n.ownerDocument.body), n;
1210
+ }
1211
+ function Ln(e, t) {
1212
+ const n = J(e);
1213
+ if (nt(e))
1214
+ return n;
1215
+ if (!q(e)) {
1216
+ let o = me(e);
1217
+ for (; o && !de(o); ) {
1218
+ if (B(o) && !mt(o))
1219
+ return o;
1220
+ o = me(o);
1221
+ }
1222
+ return n;
1223
+ }
1224
+ let r = qt(e, t);
1225
+ for (; r && Kn(r) && mt(r); )
1226
+ r = qt(r, t);
1227
+ return r && de(r) && mt(r) && !Tt(r) ? n : r || Un(e) || n;
1228
+ }
1229
+ const Gr = async function(e) {
1230
+ const t = this.getOffsetParent || Ln, n = this.getDimensions, r = await n(e.floating);
1231
+ return {
1232
+ reference: zr(e.reference, await t(e.floating), e.strategy),
1233
+ floating: {
1234
+ x: 0,
1235
+ y: 0,
1236
+ width: r.width,
1237
+ height: r.height
1238
+ }
1239
+ };
1240
+ };
1241
+ function Zr(e) {
1242
+ return te(e).direction === "rtl";
1243
+ }
1244
+ const Jr = {
1245
+ convertOffsetParentRelativeRectToViewportRelativeRect: Vr,
1246
+ getDocumentElement: ce,
1247
+ getClippingRect: Xr,
1248
+ getOffsetParent: Ln,
1249
+ getElementRects: Gr,
1250
+ getClientRects: Hr,
1251
+ getDimensions: Yr,
1252
+ getScale: Ie,
1253
+ isElement: B,
1254
+ isRTL: Zr
1255
+ };
1256
+ function Nn(e, t) {
1257
+ return e.x === t.x && e.y === t.y && e.width === t.width && e.height === t.height;
1258
+ }
1259
+ function Qr(e, t) {
1260
+ let n = null, r;
1261
+ const o = ce(e);
1262
+ function i() {
1263
+ var c;
1264
+ clearTimeout(r), (c = n) == null || c.disconnect(), n = null;
1265
+ }
1266
+ function s(c, l) {
1267
+ c === void 0 && (c = !1), l === void 0 && (l = 1), i();
1268
+ const a = e.getBoundingClientRect(), {
1269
+ left: u,
1270
+ top: d,
1271
+ width: p,
1272
+ height: f
1273
+ } = a;
1274
+ if (c || t(), !p || !f)
1275
+ return;
1276
+ const h = Ve(d), m = Ve(o.clientWidth - (u + p)), x = Ve(o.clientHeight - (d + f)), y = Ve(u), v = {
1277
+ rootMargin: -h + "px " + -m + "px " + -x + "px " + -y + "px",
1278
+ threshold: G(0, Pe(1, l)) || 1
1279
+ };
1280
+ let S = !0;
1281
+ function A(O) {
1282
+ const M = O[0].intersectionRatio;
1283
+ if (M !== l) {
1284
+ if (!S)
1285
+ return s();
1286
+ M ? s(!1, M) : r = setTimeout(() => {
1287
+ s(!1, 1e-7);
1288
+ }, 1e3);
1289
+ }
1290
+ M === 1 && !Nn(a, e.getBoundingClientRect()) && s(), S = !1;
1291
+ }
1292
+ try {
1293
+ n = new IntersectionObserver(A, {
1294
+ ...v,
1295
+ // Handle <iframe>s
1296
+ root: o.ownerDocument
1297
+ });
1298
+ } catch {
1299
+ n = new IntersectionObserver(A, v);
1300
+ }
1301
+ n.observe(e);
1302
+ }
1303
+ return s(!0), i;
1304
+ }
1305
+ function No(e, t, n, r) {
1306
+ r === void 0 && (r = {});
1307
+ const {
1308
+ ancestorScroll: o = !0,
1309
+ ancestorResize: i = !0,
1310
+ elementResize: s = typeof ResizeObserver == "function",
1311
+ layoutShift: c = typeof IntersectionObserver == "function",
1312
+ animationFrame: l = !1
1313
+ } = r, a = Ct(e), u = o || i ? [...a ? ye(a) : [], ...t ? ye(t) : []] : [];
1314
+ u.forEach((y) => {
1315
+ o && y.addEventListener("scroll", n, {
1316
+ passive: !0
1317
+ }), i && y.addEventListener("resize", n);
1318
+ });
1319
+ const d = a && c ? Qr(a, n) : null;
1320
+ let p = -1, f = null;
1321
+ s && (f = new ResizeObserver((y) => {
1322
+ let [b] = y;
1323
+ b && b.target === a && f && t && (f.unobserve(t), cancelAnimationFrame(p), p = requestAnimationFrame(() => {
1324
+ var v;
1325
+ (v = f) == null || v.observe(t);
1326
+ })), n();
1327
+ }), a && !l && f.observe(a), t && f.observe(t));
1328
+ let h, m = l ? Se(e) : null;
1329
+ l && x();
1330
+ function x() {
1331
+ const y = Se(e);
1332
+ m && !Nn(m, y) && n(), m = y, h = requestAnimationFrame(x);
1333
+ }
1334
+ return n(), () => {
1335
+ var y;
1336
+ u.forEach((b) => {
1337
+ o && b.removeEventListener("scroll", n), i && b.removeEventListener("resize", n);
1338
+ }), d == null || d(), (y = f) == null || y.disconnect(), f = null, l && cancelAnimationFrame(h);
1339
+ };
1340
+ }
1341
+ const $o = Mn, eo = Nr, to = $r, no = kr, ro = _r, oo = (e, t, n) => {
1342
+ const r = /* @__PURE__ */ new Map(), o = {
1343
+ platform: Jr,
1344
+ ...n
1345
+ }, i = {
1346
+ ...o.platform,
1347
+ _c: r
1348
+ };
1349
+ return Dr(e, t, {
1350
+ ...o,
1351
+ platform: i
1352
+ });
1353
+ };
1354
+ var io = typeof document < "u", so = function() {
1355
+ }, je = io ? un : so;
1356
+ function Qe(e, t) {
1357
+ if (e === t)
1358
+ return !0;
1359
+ if (typeof e != typeof t)
1360
+ return !1;
1361
+ if (typeof e == "function" && e.toString() === t.toString())
1362
+ return !0;
1363
+ let n, r, o;
1364
+ if (e && t && typeof e == "object") {
1365
+ if (Array.isArray(e)) {
1366
+ if (n = e.length, n !== t.length) return !1;
1367
+ for (r = n; r-- !== 0; )
1368
+ if (!Qe(e[r], t[r]))
1369
+ return !1;
1370
+ return !0;
1371
+ }
1372
+ if (o = Object.keys(e), n = o.length, n !== Object.keys(t).length)
1373
+ return !1;
1374
+ for (r = n; r-- !== 0; )
1375
+ if (!{}.hasOwnProperty.call(t, o[r]))
1376
+ return !1;
1377
+ for (r = n; r-- !== 0; ) {
1378
+ const i = o[r];
1379
+ if (!(i === "_owner" && e.$$typeof) && !Qe(e[i], t[i]))
1380
+ return !1;
1381
+ }
1382
+ return !0;
1383
+ }
1384
+ return e !== e && t !== t;
1385
+ }
1386
+ function $n(e) {
1387
+ return typeof window > "u" ? 1 : (e.ownerDocument.defaultView || window).devicePixelRatio || 1;
1388
+ }
1389
+ function jt(e, t) {
1390
+ const n = $n(e);
1391
+ return Math.round(t * n) / n;
1392
+ }
1393
+ function gt(e) {
1394
+ const t = g.useRef(e);
1395
+ return je(() => {
1396
+ t.current = e;
1397
+ }), t;
1398
+ }
1399
+ function co(e) {
1400
+ e === void 0 && (e = {});
1401
+ const {
1402
+ placement: t = "bottom",
1403
+ strategy: n = "absolute",
1404
+ middleware: r = [],
1405
+ platform: o,
1406
+ elements: {
1407
+ reference: i,
1408
+ floating: s
1409
+ } = {},
1410
+ transform: c = !0,
1411
+ whileElementsMounted: l,
1412
+ open: a
1413
+ } = e, [u, d] = g.useState({
1414
+ x: 0,
1415
+ y: 0,
1416
+ strategy: n,
1417
+ placement: t,
1418
+ middlewareData: {},
1419
+ isPositioned: !1
1420
+ }), [p, f] = g.useState(r);
1421
+ Qe(p, r) || f(r);
1422
+ const [h, m] = g.useState(null), [x, y] = g.useState(null), b = g.useCallback((w) => {
1423
+ w !== O.current && (O.current = w, m(w));
1424
+ }, []), v = g.useCallback((w) => {
1425
+ w !== M.current && (M.current = w, y(w));
1426
+ }, []), S = i || h, A = s || x, O = g.useRef(null), M = g.useRef(null), $ = g.useRef(u), j = l != null, W = gt(l), _ = gt(o), X = gt(a), H = g.useCallback(() => {
1427
+ if (!O.current || !M.current)
1428
+ return;
1429
+ const w = {
1430
+ placement: t,
1431
+ strategy: n,
1432
+ middleware: p
1433
+ };
1434
+ _.current && (w.platform = _.current), oo(O.current, M.current, w).then((I) => {
1435
+ const N = {
1436
+ ...I,
1437
+ // The floating element's position may be recomputed while it's closed
1438
+ // but still mounted (such as when transitioning out). To ensure
1439
+ // `isPositioned` will be `false` initially on the next open, avoid
1440
+ // setting it to `true` when `open === false` (must be specified).
1441
+ isPositioned: X.current !== !1
1442
+ };
1443
+ R.current && !Qe($.current, N) && ($.current = N, dn.flushSync(() => {
1444
+ d(N);
1445
+ }));
1446
+ });
1447
+ }, [p, t, n, _, X]);
1448
+ je(() => {
1449
+ a === !1 && $.current.isPositioned && ($.current.isPositioned = !1, d((w) => ({
1450
+ ...w,
1451
+ isPositioned: !1
1452
+ })));
1453
+ }, [a]);
1454
+ const R = g.useRef(!1);
1455
+ je(() => (R.current = !0, () => {
1456
+ R.current = !1;
1457
+ }), []), je(() => {
1458
+ if (S && (O.current = S), A && (M.current = A), S && A) {
1459
+ if (W.current)
1460
+ return W.current(S, A, H);
1461
+ H();
1462
+ }
1463
+ }, [S, A, H, W, j]);
1464
+ const E = g.useMemo(() => ({
1465
+ reference: O,
1466
+ floating: M,
1467
+ setReference: b,
1468
+ setFloating: v
1469
+ }), [b, v]), k = g.useMemo(() => ({
1470
+ reference: S,
1471
+ floating: A
1472
+ }), [S, A]), L = g.useMemo(() => {
1473
+ const w = {
1474
+ position: n,
1475
+ left: 0,
1476
+ top: 0
1477
+ };
1478
+ if (!k.floating)
1479
+ return w;
1480
+ const I = jt(k.floating, u.x), N = jt(k.floating, u.y);
1481
+ return c ? {
1482
+ ...w,
1483
+ transform: "translate(" + I + "px, " + N + "px)",
1484
+ ...$n(k.floating) >= 1.5 && {
1485
+ willChange: "transform"
1486
+ }
1487
+ } : {
1488
+ position: n,
1489
+ left: I,
1490
+ top: N
1491
+ };
1492
+ }, [n, c, k.floating, u.x, u.y]);
1493
+ return g.useMemo(() => ({
1494
+ ...u,
1495
+ update: H,
1496
+ refs: E,
1497
+ elements: k,
1498
+ floatingStyles: L
1499
+ }), [u, H, E, k, L]);
1500
+ }
1501
+ const _o = (e, t) => {
1502
+ const n = eo(e);
1503
+ return {
1504
+ name: n.name,
1505
+ fn: n.fn,
1506
+ options: [e, t]
1507
+ };
1508
+ }, Wo = (e, t) => {
1509
+ const n = to(e);
1510
+ return {
1511
+ name: n.name,
1512
+ fn: n.fn,
1513
+ options: [e, t]
1514
+ };
1515
+ }, Bo = (e, t) => {
1516
+ const n = no(e);
1517
+ return {
1518
+ name: n.name,
1519
+ fn: n.fn,
1520
+ options: [e, t]
1521
+ };
1522
+ }, Vo = (e, t) => {
1523
+ const n = ro(e);
1524
+ return {
1525
+ name: n.name,
1526
+ fn: n.fn,
1527
+ options: [e, t]
1528
+ };
1529
+ };
1530
+ function Ho(e) {
1531
+ const t = g.useRef(void 0), n = g.useCallback((r) => {
1532
+ const o = e.map((i) => {
1533
+ if (i != null) {
1534
+ if (typeof i == "function") {
1535
+ const s = i, c = s(r);
1536
+ return typeof c == "function" ? c : () => {
1537
+ s(null);
1538
+ };
1539
+ }
1540
+ return i.current = r, () => {
1541
+ i.current = null;
1542
+ };
1543
+ }
1544
+ });
1545
+ return () => {
1546
+ o.forEach((i) => i == null ? void 0 : i());
1547
+ };
1548
+ }, e);
1549
+ return g.useMemo(() => e.every((r) => r == null) ? null : (r) => {
1550
+ t.current && (t.current(), t.current = void 0), r != null && (t.current = n(r));
1551
+ }, e);
1552
+ }
1553
+ const lo = "data-floating-ui-focusable", Ut = "active", Xt = "selected", ao = {
1554
+ ...g
1555
+ };
1556
+ let Yt = !1, uo = 0;
1557
+ const zt = () => (
1558
+ // Ensure the id is unique with multiple independent versions of Floating UI
1559
+ // on <React 18
1560
+ "floating-ui-" + Math.random().toString(36).slice(2, 6) + uo++
1561
+ );
1562
+ function fo() {
1563
+ const [e, t] = g.useState(() => Yt ? zt() : void 0);
1564
+ return Z(() => {
1565
+ e == null && t(zt());
1566
+ }, []), g.useEffect(() => {
1567
+ Yt = !0;
1568
+ }, []), e;
1569
+ }
1570
+ const mo = ao.useId, At = mo || fo;
1571
+ let Et;
1572
+ process.env.NODE_ENV !== "production" && (Et = /* @__PURE__ */ new Set());
1573
+ function go() {
1574
+ for (var e, t = arguments.length, n = new Array(t), r = 0; r < t; r++)
1575
+ n[r] = arguments[r];
1576
+ const o = "Floating UI: " + n.join(" ");
1577
+ if (!((e = Et) != null && e.has(o))) {
1578
+ var i;
1579
+ (i = Et) == null || i.add(o), console.error(o);
1580
+ }
1581
+ }
1582
+ function po() {
1583
+ const e = /* @__PURE__ */ new Map();
1584
+ return {
1585
+ emit(t, n) {
1586
+ var r;
1587
+ (r = e.get(t)) == null || r.forEach((o) => o(n));
1588
+ },
1589
+ on(t, n) {
1590
+ e.has(t) || e.set(t, /* @__PURE__ */ new Set()), e.get(t).add(n);
1591
+ },
1592
+ off(t, n) {
1593
+ var r;
1594
+ (r = e.get(t)) == null || r.delete(n);
1595
+ }
1596
+ };
1597
+ }
1598
+ const ho = /* @__PURE__ */ g.createContext(null), bo = /* @__PURE__ */ g.createContext(null), _n = () => {
1599
+ var e;
1600
+ return ((e = g.useContext(ho)) == null ? void 0 : e.id) || null;
1601
+ }, Ot = () => g.useContext(bo);
1602
+ function Fe(e) {
1603
+ return "data-floating-ui-" + e;
1604
+ }
1605
+ function vo(e) {
1606
+ e.current !== -1 && (clearTimeout(e.current), e.current = -1);
1607
+ }
1608
+ let Gt = 0;
1609
+ function Ce(e, t) {
1610
+ t === void 0 && (t = {});
1611
+ const {
1612
+ preventScroll: n = !1,
1613
+ cancelPrevious: r = !0,
1614
+ sync: o = !1
1615
+ } = t;
1616
+ r && cancelAnimationFrame(Gt);
1617
+ const i = () => e == null ? void 0 : e.focus({
1618
+ preventScroll: n
1619
+ });
1620
+ o ? i() : Gt = requestAnimationFrame(i);
1621
+ }
1622
+ function yo(e) {
1623
+ return (e == null ? void 0 : e.ownerDocument) || document;
1624
+ }
1625
+ const Me = {
1626
+ inert: /* @__PURE__ */ new WeakMap(),
1627
+ "aria-hidden": /* @__PURE__ */ new WeakMap(),
1628
+ none: /* @__PURE__ */ new WeakMap()
1629
+ };
1630
+ function Zt(e) {
1631
+ return e === "inert" ? Me.inert : e === "aria-hidden" ? Me["aria-hidden"] : Me.none;
1632
+ }
1633
+ let He = /* @__PURE__ */ new WeakSet(), Ke = {}, pt = 0;
1634
+ const wo = () => typeof HTMLElement < "u" && "inert" in HTMLElement.prototype;
1635
+ function Wn(e) {
1636
+ return e ? Ue(e) ? e.host : Wn(e.parentNode) : null;
1637
+ }
1638
+ const xo = (e, t) => t.map((n) => {
1639
+ if (e.contains(n))
1640
+ return n;
1641
+ const r = Wn(n);
1642
+ return e.contains(r) ? r : null;
1643
+ }).filter((n) => n != null);
1644
+ function Ro(e, t, n, r) {
1645
+ const o = "data-floating-ui-inert", i = r ? "inert" : n ? "aria-hidden" : null, s = xo(t, e), c = /* @__PURE__ */ new Set(), l = new Set(s), a = [];
1646
+ Ke[o] || (Ke[o] = /* @__PURE__ */ new WeakMap());
1647
+ const u = Ke[o];
1648
+ s.forEach(d), p(t), c.clear();
1649
+ function d(f) {
1650
+ !f || c.has(f) || (c.add(f), f.parentNode && d(f.parentNode));
1651
+ }
1652
+ function p(f) {
1653
+ !f || l.has(f) || [].forEach.call(f.children, (h) => {
1654
+ if (xe(h) !== "script")
1655
+ if (c.has(h))
1656
+ p(h);
1657
+ else {
1658
+ const m = i ? h.getAttribute(i) : null, x = m !== null && m !== "false", y = Zt(i), b = (y.get(h) || 0) + 1, v = (u.get(h) || 0) + 1;
1659
+ y.set(h, b), u.set(h, v), a.push(h), b === 1 && x && He.add(h), v === 1 && h.setAttribute(o, ""), !x && i && h.setAttribute(i, i === "inert" ? "" : "true");
1660
+ }
1661
+ });
1662
+ }
1663
+ return pt++, () => {
1664
+ a.forEach((f) => {
1665
+ const h = Zt(i), x = (h.get(f) || 0) - 1, y = (u.get(f) || 0) - 1;
1666
+ h.set(f, x), u.set(f, y), x || (!He.has(f) && i && f.removeAttribute(i), He.delete(f)), y || f.removeAttribute(o);
1667
+ }), pt--, pt || (Me.inert = /* @__PURE__ */ new WeakMap(), Me["aria-hidden"] = /* @__PURE__ */ new WeakMap(), Me.none = /* @__PURE__ */ new WeakMap(), He = /* @__PURE__ */ new WeakSet(), Ke = {});
1668
+ };
1669
+ }
1670
+ function Jt(e, t, n) {
1671
+ t === void 0 && (t = !1), n === void 0 && (n = !1);
1672
+ const r = yo(e[0]).body;
1673
+ return Ro(e.concat(Array.from(r.querySelectorAll('[aria-live],[role="status"],output'))), r, t, n);
1674
+ }
1675
+ const It = {
1676
+ border: 0,
1677
+ clip: "rect(0 0 0 0)",
1678
+ height: "1px",
1679
+ margin: "-1px",
1680
+ overflow: "hidden",
1681
+ padding: 0,
1682
+ position: "fixed",
1683
+ whiteSpace: "nowrap",
1684
+ width: "1px",
1685
+ top: 0,
1686
+ left: 0
1687
+ }, et = /* @__PURE__ */ g.forwardRef(function(t, n) {
1688
+ const [r, o] = g.useState();
1689
+ Z(() => {
1690
+ vr() && o("button");
1691
+ }, []);
1692
+ const i = {
1693
+ ref: n,
1694
+ tabIndex: 0,
1695
+ // Role is only for VoiceOver
1696
+ role: r,
1697
+ "aria-hidden": r ? void 0 : !0,
1698
+ [Fe("focus-guard")]: "",
1699
+ style: It
1700
+ };
1701
+ return /* @__PURE__ */ fe("span", {
1702
+ ...t,
1703
+ ...i
1704
+ });
1705
+ }), Eo = {
1706
+ clipPath: "inset(50%)",
1707
+ position: "fixed",
1708
+ top: 0,
1709
+ left: 0
1710
+ }, Bn = /* @__PURE__ */ g.createContext(null), Qt = /* @__PURE__ */ Fe("portal");
1711
+ function So(e) {
1712
+ e === void 0 && (e = {});
1713
+ const {
1714
+ id: t,
1715
+ root: n
1716
+ } = e, r = At(), o = Vn(), [i, s] = g.useState(null), c = g.useRef(null);
1717
+ return Z(() => () => {
1718
+ i == null || i.remove(), queueMicrotask(() => {
1719
+ c.current = null;
1720
+ });
1721
+ }, [i]), Z(() => {
1722
+ if (!r || c.current) return;
1723
+ const l = t ? document.getElementById(t) : null;
1724
+ if (!l) return;
1725
+ const a = document.createElement("div");
1726
+ a.id = r, a.setAttribute(Qt, ""), l.appendChild(a), c.current = a, s(a);
1727
+ }, [t, r]), Z(() => {
1728
+ if (n === null || !r || c.current) return;
1729
+ let l = n || (o == null ? void 0 : o.portalNode);
1730
+ l && !St(l) && (l = l.current), l = l || document.body;
1731
+ let a = null;
1732
+ t && (a = document.createElement("div"), a.id = t, l.appendChild(a));
1733
+ const u = document.createElement("div");
1734
+ u.id = r, u.setAttribute(Qt, ""), l = a || l, l.appendChild(u), c.current = u, s(u);
1735
+ }, [t, n, r, o]), i;
1736
+ }
1737
+ function Ko(e) {
1738
+ const {
1739
+ children: t,
1740
+ id: n,
1741
+ root: r,
1742
+ preserveTabOrder: o = !0
1743
+ } = e, i = So({
1744
+ id: n,
1745
+ root: r
1746
+ }), [s, c] = g.useState(null), l = g.useRef(null), a = g.useRef(null), u = g.useRef(null), d = g.useRef(null), p = s == null ? void 0 : s.modal, f = s == null ? void 0 : s.open, h = (
1747
+ // The FocusManager and therefore floating element are currently open/
1748
+ // rendered.
1749
+ !!s && // Guards are only for non-modal focus management.
1750
+ !s.modal && // Don't render if unmount is transitioning.
1751
+ s.open && o && !!(r || i)
1752
+ );
1753
+ return g.useEffect(() => {
1754
+ if (!i || !o || p)
1755
+ return;
1756
+ function m(x) {
1757
+ i && ke(x) && (x.type === "focusin" ? Bt : Mr)(i);
1758
+ }
1759
+ return i.addEventListener("focusin", m, !0), i.addEventListener("focusout", m, !0), () => {
1760
+ i.removeEventListener("focusin", m, !0), i.removeEventListener("focusout", m, !0);
1761
+ };
1762
+ }, [i, o, p]), g.useEffect(() => {
1763
+ i && (f || Bt(i));
1764
+ }, [f, i]), /* @__PURE__ */ fn(Bn.Provider, {
1765
+ value: g.useMemo(() => ({
1766
+ preserveTabOrder: o,
1767
+ beforeOutsideRef: l,
1768
+ afterOutsideRef: a,
1769
+ beforeInsideRef: u,
1770
+ afterInsideRef: d,
1771
+ portalNode: i,
1772
+ setFocusManagerState: c
1773
+ }), [o, i]),
1774
+ children: [h && i && /* @__PURE__ */ fe(et, {
1775
+ "data-type": "outside",
1776
+ ref: l,
1777
+ onFocus: (m) => {
1778
+ if (ke(m, i)) {
1779
+ var x;
1780
+ (x = u.current) == null || x.focus();
1781
+ } else {
1782
+ const y = s ? s.domReference : null, b = In(y);
1783
+ b == null || b.focus();
1784
+ }
1785
+ }
1786
+ }), h && i && /* @__PURE__ */ fe("span", {
1787
+ "aria-owns": i.id,
1788
+ style: Eo
1789
+ }), i && /* @__PURE__ */ dn.createPortal(t, i), h && i && /* @__PURE__ */ fe(et, {
1790
+ "data-type": "outside",
1791
+ ref: a,
1792
+ onFocus: (m) => {
1793
+ if (ke(m, i)) {
1794
+ var x;
1795
+ (x = d.current) == null || x.focus();
1796
+ } else {
1797
+ const y = s ? s.domReference : null, b = On(y);
1798
+ b == null || b.focus(), s != null && s.closeOnFocusOut && (s == null || s.onOpenChange(!1, m.nativeEvent, "focus-out"));
1799
+ }
1800
+ }
1801
+ })]
1802
+ });
1803
+ }
1804
+ const Vn = () => g.useContext(Bn);
1805
+ function en(e) {
1806
+ return g.useMemo(() => (t) => {
1807
+ e.forEach((n) => {
1808
+ n && (n.current = t);
1809
+ });
1810
+ }, e);
1811
+ }
1812
+ const tn = 20;
1813
+ let ve = [];
1814
+ function Mt() {
1815
+ ve = ve.filter((e) => {
1816
+ var t;
1817
+ return (t = e.deref()) == null ? void 0 : t.isConnected;
1818
+ });
1819
+ }
1820
+ function To(e) {
1821
+ Mt(), e && xe(e) !== "body" && (ve.push(new WeakRef(e)), ve.length > tn && (ve = ve.slice(-tn)));
1822
+ }
1823
+ function nn() {
1824
+ Mt();
1825
+ const e = ve[ve.length - 1];
1826
+ return e == null ? void 0 : e.deref();
1827
+ }
1828
+ function Co(e) {
1829
+ const t = _e();
1830
+ return En(e, t) ? e : it(e, t)[0] || e;
1831
+ }
1832
+ function rn(e, t) {
1833
+ var n;
1834
+ if (!t.current.includes("floating") && !((n = e.getAttribute("role")) != null && n.includes("dialog")))
1835
+ return;
1836
+ const r = _e(), i = br(e, r).filter((c) => {
1837
+ const l = c.getAttribute("data-tabindex") || "";
1838
+ return En(c, r) || c.hasAttribute("data-tabindex") && !l.startsWith("-");
1839
+ }), s = e.getAttribute("tabindex");
1840
+ t.current.includes("floating") || i.length === 0 ? s !== "0" && e.setAttribute("tabindex", "0") : (s !== "-1" || e.hasAttribute("data-tabindex") && e.getAttribute("data-tabindex") !== "-1") && (e.setAttribute("tabindex", "-1"), e.setAttribute("data-tabindex", "-1"));
1841
+ }
1842
+ const Ao = /* @__PURE__ */ g.forwardRef(function(t, n) {
1843
+ return /* @__PURE__ */ fe("button", {
1844
+ ...t,
1845
+ type: "button",
1846
+ ref: n,
1847
+ tabIndex: -1,
1848
+ style: It
1849
+ });
1850
+ });
1851
+ function qo(e) {
1852
+ const {
1853
+ context: t,
1854
+ children: n,
1855
+ disabled: r = !1,
1856
+ order: o = ["content"],
1857
+ guards: i = !0,
1858
+ initialFocus: s = 0,
1859
+ returnFocus: c = !0,
1860
+ restoreFocus: l = !1,
1861
+ modal: a = !0,
1862
+ visuallyHiddenDismiss: u = !1,
1863
+ closeOnFocusOut: d = !0,
1864
+ outsideElementsInert: p = !1,
1865
+ getInsideElements: f = () => []
1866
+ } = e, {
1867
+ open: h,
1868
+ onOpenChange: m,
1869
+ events: x,
1870
+ dataRef: y,
1871
+ elements: {
1872
+ domReference: b,
1873
+ floating: v
1874
+ }
1875
+ } = t, S = ie(() => {
1876
+ var T;
1877
+ return (T = y.current.floatingContext) == null ? void 0 : T.nodeId;
1878
+ }), A = ie(f), O = typeof s == "number" && s < 0, M = $t(b) && O, $ = wo(), j = $ ? i : !0, W = !j || $ && p, _ = dt(o), X = dt(s), H = dt(c), R = Ot(), E = Vn(), k = g.useRef(null), L = g.useRef(null), w = g.useRef(!1), I = g.useRef(!1), N = g.useRef(-1), ne = g.useRef(-1), Te = E != null, P = Rt(v), oe = ie(function(T) {
1879
+ return T === void 0 && (T = P), T ? it(T, _e()) : [];
1880
+ }), K = ie((T) => {
1881
+ const D = oe(T);
1882
+ return _.current.map((C) => b && C === "reference" ? b : P && C === "floating" ? P : D).filter(Boolean).flat();
1883
+ });
1884
+ g.useEffect(() => {
1885
+ if (r || !a) return;
1886
+ function T(C) {
1887
+ if (C.key === "Tab") {
1888
+ z(P, Ae(re(P))) && oe().length === 0 && !M && ft(C);
1889
+ const V = K(), U = be(C);
1890
+ _.current[0] === "reference" && U === b && (ft(C), C.shiftKey ? Ce(V[V.length - 1]) : Ce(V[1])), _.current[1] === "floating" && U === P && C.shiftKey && (ft(C), Ce(V[0]));
1891
+ }
1892
+ }
1893
+ const D = re(P);
1894
+ return D.addEventListener("keydown", T), () => {
1895
+ D.removeEventListener("keydown", T);
1896
+ };
1897
+ }, [r, b, P, a, _, M, oe, K]), g.useEffect(() => {
1898
+ if (r || !v) return;
1899
+ function T(D) {
1900
+ const C = be(D), U = oe().indexOf(C);
1901
+ U !== -1 && (N.current = U);
1902
+ }
1903
+ return v.addEventListener("focusin", T), () => {
1904
+ v.removeEventListener("focusin", T);
1905
+ };
1906
+ }, [r, v, oe]), g.useEffect(() => {
1907
+ if (r || !d) return;
1908
+ function T() {
1909
+ I.current = !0, setTimeout(() => {
1910
+ I.current = !1;
1911
+ });
1912
+ }
1913
+ function D(U) {
1914
+ const F = U.relatedTarget, le = U.currentTarget, ee = be(U);
1915
+ queueMicrotask(() => {
1916
+ const Y = S(), Re = !(z(b, F) || z(v, F) || z(F, v) || z(E == null ? void 0 : E.portalNode, F) || F != null && F.hasAttribute(Fe("focus-guard")) || R && (Oe(R.nodesRef.current, Y).find((pe) => {
1917
+ var ae, he;
1918
+ return z((ae = pe.context) == null ? void 0 : ae.elements.floating, F) || z((he = pe.context) == null ? void 0 : he.elements.domReference, F);
1919
+ }) || _t(R.nodesRef.current, Y).find((pe) => {
1920
+ var ae, he, Pt;
1921
+ return [(ae = pe.context) == null ? void 0 : ae.elements.floating, Rt((he = pe.context) == null ? void 0 : he.elements.floating)].includes(F) || ((Pt = pe.context) == null ? void 0 : Pt.elements.domReference) === F;
1922
+ })));
1923
+ if (le === b && P && rn(P, _), l && le !== b && !(ee != null && ee.isConnected) && Ae(re(P)) === re(P).body) {
1924
+ q(P) && P.focus();
1925
+ const pe = N.current, ae = oe(), he = ae[pe] || ae[ae.length - 1] || P;
1926
+ q(he) && he.focus();
1927
+ }
1928
+ if (y.current.insideReactTree) {
1929
+ y.current.insideReactTree = !1;
1930
+ return;
1931
+ }
1932
+ (M || !a) && F && Re && !I.current && // Fix React 18 Strict Mode returnFocus due to double rendering.
1933
+ F !== nn() && (w.current = !0, m(!1, U, "focus-out"));
1934
+ });
1935
+ }
1936
+ const C = !!(!R && E);
1937
+ function V() {
1938
+ vo(ne), y.current.insideReactTree = !0, ne.current = window.setTimeout(() => {
1939
+ y.current.insideReactTree = !1;
1940
+ });
1941
+ }
1942
+ if (v && q(b))
1943
+ return b.addEventListener("focusout", D), b.addEventListener("pointerdown", T), v.addEventListener("focusout", D), C && v.addEventListener("focusout", V, !0), () => {
1944
+ b.removeEventListener("focusout", D), b.removeEventListener("pointerdown", T), v.removeEventListener("focusout", D), C && v.removeEventListener("focusout", V, !0);
1945
+ };
1946
+ }, [r, b, v, P, a, R, E, m, d, l, oe, M, S, _, y]);
1947
+ const Q = g.useRef(null), ge = g.useRef(null), ct = en([Q, E == null ? void 0 : E.beforeInsideRef]), lt = en([ge, E == null ? void 0 : E.afterInsideRef]);
1948
+ g.useEffect(() => {
1949
+ var T, D;
1950
+ if (r || !v) return;
1951
+ const C = Array.from((E == null || (T = E.portalNode) == null ? void 0 : T.querySelectorAll("[" + Fe("portal") + "]")) || []), U = (D = (R ? _t(R.nodesRef.current, S()) : []).find((ee) => {
1952
+ var Y;
1953
+ return $t(((Y = ee.context) == null ? void 0 : Y.elements.domReference) || null);
1954
+ })) == null || (D = D.context) == null ? void 0 : D.elements.domReference, F = [v, U, ...C, ...A(), k.current, L.current, Q.current, ge.current, E == null ? void 0 : E.beforeOutsideRef.current, E == null ? void 0 : E.afterOutsideRef.current, _.current.includes("reference") || M ? b : null].filter((ee) => ee != null), le = a || M ? Jt(F, !W, W) : Jt(F);
1955
+ return () => {
1956
+ le();
1957
+ };
1958
+ }, [r, b, v, a, _, E, M, j, W, R, S, A]), Z(() => {
1959
+ if (r || !q(P)) return;
1960
+ const T = re(P), D = Ae(T);
1961
+ queueMicrotask(() => {
1962
+ const C = K(P), V = X.current, U = (typeof V == "number" ? C[V] : V.current) || P, F = z(P, D);
1963
+ !O && !F && h && Ce(U, {
1964
+ preventScroll: U === P
1965
+ });
1966
+ });
1967
+ }, [r, h, P, O, K, X]), Z(() => {
1968
+ if (r || !P) return;
1969
+ const T = re(P), D = Ae(T);
1970
+ To(D);
1971
+ function C(F) {
1972
+ let {
1973
+ reason: le,
1974
+ event: ee,
1975
+ nested: Y
1976
+ } = F;
1977
+ if (["hover", "safe-polygon"].includes(le) && ee.type === "mouseleave" && (w.current = !0), le === "outside-press")
1978
+ if (Y)
1979
+ w.current = !1;
1980
+ else if (Er(ee) || Sr(ee))
1981
+ w.current = !1;
1982
+ else {
1983
+ let Re = !1;
1984
+ document.createElement("div").focus({
1985
+ get preventScroll() {
1986
+ return Re = !0, !1;
1987
+ }
1988
+ }), Re ? w.current = !1 : w.current = !0;
1989
+ }
1990
+ }
1991
+ x.on("openchange", C);
1992
+ const V = T.createElement("span");
1993
+ V.setAttribute("tabindex", "-1"), V.setAttribute("aria-hidden", "true"), Object.assign(V.style, It), Te && b && b.insertAdjacentElement("afterend", V);
1994
+ function U() {
1995
+ if (typeof H.current == "boolean") {
1996
+ const F = b || nn();
1997
+ return F && F.isConnected ? F : V;
1998
+ }
1999
+ return H.current.current || V;
2000
+ }
2001
+ return () => {
2002
+ x.off("openchange", C);
2003
+ const F = Ae(T), le = z(v, F) || R && Oe(R.nodesRef.current, S(), !1).some((Y) => {
2004
+ var Re;
2005
+ return z((Re = Y.context) == null ? void 0 : Re.elements.floating, F);
2006
+ }), ee = U();
2007
+ queueMicrotask(() => {
2008
+ const Y = Co(ee);
2009
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2010
+ H.current && !w.current && q(Y) && // If the focus moved somewhere else after mount, avoid returning focus
2011
+ // since it likely entered a different element which should be
2012
+ // respected: https://github.com/floating-ui/floating-ui/issues/2607
2013
+ (!(Y !== F && F !== T.body) || le) && Y.focus({
2014
+ preventScroll: !0
2015
+ }), V.remove();
2016
+ });
2017
+ };
2018
+ }, [r, v, P, H, y, x, R, Te, b, S]), g.useEffect(() => (queueMicrotask(() => {
2019
+ w.current = !1;
2020
+ }), () => {
2021
+ queueMicrotask(Mt);
2022
+ }), [r]), Z(() => {
2023
+ if (!r && E)
2024
+ return E.setFocusManagerState({
2025
+ modal: a,
2026
+ closeOnFocusOut: d,
2027
+ open: h,
2028
+ onOpenChange: m,
2029
+ domReference: b
2030
+ }), () => {
2031
+ E.setFocusManagerState(null);
2032
+ };
2033
+ }, [r, E, a, h, m, d, b]), Z(() => {
2034
+ r || P && rn(P, _);
2035
+ }, [r, P, _]);
2036
+ function We(T) {
2037
+ return r || !u || !a ? null : /* @__PURE__ */ fe(Ao, {
2038
+ ref: T === "start" ? k : L,
2039
+ onClick: (D) => m(!1, D.nativeEvent),
2040
+ children: typeof u == "string" ? u : "Dismiss"
2041
+ });
2042
+ }
2043
+ const Be = !r && j && (a ? !M : !0) && (Te || a);
2044
+ return /* @__PURE__ */ fn(Hn, {
2045
+ children: [Be && /* @__PURE__ */ fe(et, {
2046
+ "data-type": "inside",
2047
+ ref: ct,
2048
+ onFocus: (T) => {
2049
+ if (a) {
2050
+ const C = K();
2051
+ Ce(o[0] === "reference" ? C[0] : C[C.length - 1]);
2052
+ } else if (E != null && E.preserveTabOrder && E.portalNode)
2053
+ if (w.current = !1, ke(T, E.portalNode)) {
2054
+ const C = On(b);
2055
+ C == null || C.focus();
2056
+ } else {
2057
+ var D;
2058
+ (D = E.beforeOutsideRef.current) == null || D.focus();
2059
+ }
2060
+ }
2061
+ }), !M && We("start"), n, We("end"), Be && /* @__PURE__ */ fe(et, {
2062
+ "data-type": "inside",
2063
+ ref: lt,
2064
+ onFocus: (T) => {
2065
+ if (a)
2066
+ Ce(K()[0]);
2067
+ else if (E != null && E.preserveTabOrder && E.portalNode)
2068
+ if (d && (w.current = !0), ke(T, E.portalNode)) {
2069
+ const C = In(b);
2070
+ C == null || C.focus();
2071
+ } else {
2072
+ var D;
2073
+ (D = E.afterOutsideRef.current) == null || D.focus();
2074
+ }
2075
+ }
2076
+ })]
2077
+ });
2078
+ }
2079
+ let qe = 0;
2080
+ const on = "--floating-ui-scrollbar-width";
2081
+ function Oo() {
2082
+ const e = Sn(), t = /iP(hone|ad|od)|iOS/.test(e) || // iPads can claim to be MacIntel
2083
+ e === "MacIntel" && navigator.maxTouchPoints > 1, n = document.body.style, o = Math.round(document.documentElement.getBoundingClientRect().left) + document.documentElement.scrollLeft ? "paddingLeft" : "paddingRight", i = window.innerWidth - document.documentElement.clientWidth, s = n.left ? parseFloat(n.left) : window.scrollX, c = n.top ? parseFloat(n.top) : window.scrollY;
2084
+ if (n.overflow = "hidden", n.setProperty(on, i + "px"), i && (n[o] = i + "px"), t) {
2085
+ var l, a;
2086
+ const u = ((l = window.visualViewport) == null ? void 0 : l.offsetLeft) || 0, d = ((a = window.visualViewport) == null ? void 0 : a.offsetTop) || 0;
2087
+ Object.assign(n, {
2088
+ position: "fixed",
2089
+ top: -(c - Math.floor(d)) + "px",
2090
+ left: -(s - Math.floor(u)) + "px",
2091
+ right: "0"
2092
+ });
2093
+ }
2094
+ return () => {
2095
+ Object.assign(n, {
2096
+ overflow: "",
2097
+ [o]: ""
2098
+ }), n.removeProperty(on), t && (Object.assign(n, {
2099
+ position: "",
2100
+ top: "",
2101
+ left: "",
2102
+ right: ""
2103
+ }), window.scrollTo(s, c));
2104
+ };
2105
+ }
2106
+ let sn = () => {
2107
+ };
2108
+ const jo = /* @__PURE__ */ g.forwardRef(function(t, n) {
2109
+ const {
2110
+ lockScroll: r = !1,
2111
+ ...o
2112
+ } = t;
2113
+ return Z(() => {
2114
+ if (r)
2115
+ return qe++, qe === 1 && (sn = Oo()), () => {
2116
+ qe--, qe === 0 && sn();
2117
+ };
2118
+ }, [r]), /* @__PURE__ */ fe("div", {
2119
+ ref: n,
2120
+ ...o,
2121
+ style: {
2122
+ position: "fixed",
2123
+ overflow: "auto",
2124
+ top: 0,
2125
+ right: 0,
2126
+ bottom: 0,
2127
+ left: 0,
2128
+ ...o.style
2129
+ }
2130
+ });
2131
+ });
2132
+ function cn(e) {
2133
+ return q(e.target) && e.target.tagName === "BUTTON";
2134
+ }
2135
+ function Io(e) {
2136
+ return q(e.target) && e.target.tagName === "A";
2137
+ }
2138
+ function ln(e) {
2139
+ return Cn(e);
2140
+ }
2141
+ function Uo(e, t) {
2142
+ t === void 0 && (t = {});
2143
+ const {
2144
+ open: n,
2145
+ onOpenChange: r,
2146
+ dataRef: o,
2147
+ elements: {
2148
+ domReference: i
2149
+ }
2150
+ } = e, {
2151
+ enabled: s = !0,
2152
+ event: c = "click",
2153
+ toggle: l = !0,
2154
+ ignoreMouse: a = !1,
2155
+ keyboardHandlers: u = !0,
2156
+ stickIfOpen: d = !0
2157
+ } = t, p = g.useRef(), f = g.useRef(!1), h = g.useMemo(() => ({
2158
+ onPointerDown(m) {
2159
+ p.current = m.pointerType;
2160
+ },
2161
+ onMouseDown(m) {
2162
+ const x = p.current;
2163
+ m.button === 0 && c !== "click" && (Wt(x) && a || (n && l && (!(o.current.openEvent && d) || o.current.openEvent.type === "mousedown") ? r(!1, m.nativeEvent, "click") : (m.preventDefault(), r(!0, m.nativeEvent, "click"))));
2164
+ },
2165
+ onClick(m) {
2166
+ const x = p.current;
2167
+ if (c === "mousedown" && p.current) {
2168
+ p.current = void 0;
2169
+ return;
2170
+ }
2171
+ Wt(x) && a || (n && l && (!(o.current.openEvent && d) || o.current.openEvent.type === "click") ? r(!1, m.nativeEvent, "click") : r(!0, m.nativeEvent, "click"));
2172
+ },
2173
+ onKeyDown(m) {
2174
+ p.current = void 0, !(m.defaultPrevented || !u || cn(m)) && (m.key === " " && !ln(i) && (m.preventDefault(), f.current = !0), !Io(m) && m.key === "Enter" && r(!(n && l), m.nativeEvent, "click"));
2175
+ },
2176
+ onKeyUp(m) {
2177
+ m.defaultPrevented || !u || cn(m) || ln(i) || m.key === " " && f.current && (f.current = !1, r(!(n && l), m.nativeEvent, "click"));
2178
+ }
2179
+ }), [o, i, c, a, u, r, n, d, l]);
2180
+ return g.useMemo(() => s ? {
2181
+ reference: h
2182
+ } : {}, [s, h]);
2183
+ }
2184
+ const Mo = {
2185
+ pointerdown: "onPointerDown",
2186
+ mousedown: "onMouseDown",
2187
+ click: "onClick"
2188
+ }, Po = {
2189
+ pointerdown: "onPointerDownCapture",
2190
+ mousedown: "onMouseDownCapture",
2191
+ click: "onClickCapture"
2192
+ }, an = (e) => {
2193
+ var t, n;
2194
+ return {
2195
+ escapeKey: typeof e == "boolean" ? e : (t = e == null ? void 0 : e.escapeKey) != null ? t : !1,
2196
+ outsidePress: typeof e == "boolean" ? e : (n = e == null ? void 0 : e.outsidePress) != null ? n : !0
2197
+ };
2198
+ };
2199
+ function Xo(e, t) {
2200
+ t === void 0 && (t = {});
2201
+ const {
2202
+ open: n,
2203
+ onOpenChange: r,
2204
+ elements: o,
2205
+ dataRef: i
2206
+ } = e, {
2207
+ enabled: s = !0,
2208
+ escapeKey: c = !0,
2209
+ outsidePress: l = !0,
2210
+ outsidePressEvent: a = "pointerdown",
2211
+ referencePress: u = !1,
2212
+ referencePressEvent: d = "pointerdown",
2213
+ ancestorScroll: p = !1,
2214
+ bubbles: f,
2215
+ capture: h
2216
+ } = t, m = Ot(), x = ie(typeof l == "function" ? l : () => !1), y = typeof l == "function" ? x : l, b = g.useRef(!1), {
2217
+ escapeKey: v,
2218
+ outsidePress: S
2219
+ } = an(f), {
2220
+ escapeKey: A,
2221
+ outsidePress: O
2222
+ } = an(h), M = g.useRef(!1), $ = ie((R) => {
2223
+ var E;
2224
+ if (!n || !s || !c || R.key !== "Escape" || M.current)
2225
+ return;
2226
+ const k = (E = i.current.floatingContext) == null ? void 0 : E.nodeId, L = m ? Oe(m.nodesRef.current, k) : [];
2227
+ if (!v && (R.stopPropagation(), L.length > 0)) {
2228
+ let w = !0;
2229
+ if (L.forEach((I) => {
2230
+ var N;
2231
+ if ((N = I.context) != null && N.open && !I.context.dataRef.current.__escapeKeyBubbles) {
2232
+ w = !1;
2233
+ return;
2234
+ }
2235
+ }), !w)
2236
+ return;
2237
+ }
2238
+ r(!1, Rr(R) ? R.nativeEvent : R, "escape-key");
2239
+ }), j = ie((R) => {
2240
+ var E;
2241
+ const k = () => {
2242
+ var L;
2243
+ $(R), (L = be(R)) == null || L.removeEventListener("keydown", k);
2244
+ };
2245
+ (E = be(R)) == null || E.addEventListener("keydown", k);
2246
+ }), W = ie((R) => {
2247
+ var E;
2248
+ const k = i.current.insideReactTree;
2249
+ i.current.insideReactTree = !1;
2250
+ const L = b.current;
2251
+ if (b.current = !1, a === "click" && L || k || typeof y == "function" && !y(R))
2252
+ return;
2253
+ const w = be(R), I = "[" + Fe("inert") + "]", N = re(o.floating).querySelectorAll(I);
2254
+ let ne = B(w) ? w : null;
2255
+ for (; ne && !de(ne); ) {
2256
+ const K = me(ne);
2257
+ if (de(K) || !B(K))
2258
+ break;
2259
+ ne = K;
2260
+ }
2261
+ if (N.length && B(w) && !xr(w) && // Clicked on a direct ancestor (e.g. FloatingOverlay).
2262
+ !z(w, o.floating) && // If the target root element contains none of the markers, then the
2263
+ // element was injected after the floating element rendered.
2264
+ Array.from(N).every((K) => !z(ne, K)))
2265
+ return;
2266
+ if (q(w) && H) {
2267
+ const K = de(w), Q = te(w), ge = /auto|scroll/, ct = K || ge.test(Q.overflowX), lt = K || ge.test(Q.overflowY), We = ct && w.clientWidth > 0 && w.scrollWidth > w.clientWidth, Be = lt && w.clientHeight > 0 && w.scrollHeight > w.clientHeight, T = Q.direction === "rtl", D = Be && (T ? R.offsetX <= w.offsetWidth - w.clientWidth : R.offsetX > w.clientWidth), C = We && R.offsetY > w.clientHeight;
2268
+ if (D || C)
2269
+ return;
2270
+ }
2271
+ const Te = (E = i.current.floatingContext) == null ? void 0 : E.nodeId, P = m && Oe(m.nodesRef.current, Te).some((K) => {
2272
+ var Q;
2273
+ return ut(R, (Q = K.context) == null ? void 0 : Q.elements.floating);
2274
+ });
2275
+ if (ut(R, o.floating) || ut(R, o.domReference) || P)
2276
+ return;
2277
+ const oe = m ? Oe(m.nodesRef.current, Te) : [];
2278
+ if (oe.length > 0) {
2279
+ let K = !0;
2280
+ if (oe.forEach((Q) => {
2281
+ var ge;
2282
+ if ((ge = Q.context) != null && ge.open && !Q.context.dataRef.current.__outsidePressBubbles) {
2283
+ K = !1;
2284
+ return;
2285
+ }
2286
+ }), !K)
2287
+ return;
2288
+ }
2289
+ r(!1, R, "outside-press");
2290
+ }), _ = ie((R) => {
2291
+ var E;
2292
+ const k = () => {
2293
+ var L;
2294
+ W(R), (L = be(R)) == null || L.removeEventListener(a, k);
2295
+ };
2296
+ (E = be(R)) == null || E.addEventListener(a, k);
2297
+ });
2298
+ g.useEffect(() => {
2299
+ if (!n || !s)
2300
+ return;
2301
+ i.current.__escapeKeyBubbles = v, i.current.__outsidePressBubbles = S;
2302
+ let R = -1;
2303
+ function E(N) {
2304
+ r(!1, N, "ancestor-scroll");
2305
+ }
2306
+ function k() {
2307
+ window.clearTimeout(R), M.current = !0;
2308
+ }
2309
+ function L() {
2310
+ R = window.setTimeout(
2311
+ () => {
2312
+ M.current = !1;
2313
+ },
2314
+ // 0ms or 1ms don't work in Safari. 5ms appears to consistently work.
2315
+ // Only apply to WebKit for the test to remain 0ms.
2316
+ rt() ? 5 : 0
2317
+ );
2318
+ }
2319
+ const w = re(o.floating);
2320
+ c && (w.addEventListener("keydown", A ? j : $, A), w.addEventListener("compositionstart", k), w.addEventListener("compositionend", L)), y && w.addEventListener(a, O ? _ : W, O);
2321
+ let I = [];
2322
+ return p && (B(o.domReference) && (I = ye(o.domReference)), B(o.floating) && (I = I.concat(ye(o.floating))), !B(o.reference) && o.reference && o.reference.contextElement && (I = I.concat(ye(o.reference.contextElement)))), I = I.filter((N) => {
2323
+ var ne;
2324
+ return N !== ((ne = w.defaultView) == null ? void 0 : ne.visualViewport);
2325
+ }), I.forEach((N) => {
2326
+ N.addEventListener("scroll", E, {
2327
+ passive: !0
2328
+ });
2329
+ }), () => {
2330
+ c && (w.removeEventListener("keydown", A ? j : $, A), w.removeEventListener("compositionstart", k), w.removeEventListener("compositionend", L)), y && w.removeEventListener(a, O ? _ : W, O), I.forEach((N) => {
2331
+ N.removeEventListener("scroll", E);
2332
+ }), window.clearTimeout(R);
2333
+ };
2334
+ }, [i, o, c, y, a, n, r, p, s, v, S, $, A, j, W, O, _]), g.useEffect(() => {
2335
+ i.current.insideReactTree = !1;
2336
+ }, [i, y, a]);
2337
+ const X = g.useMemo(() => ({
2338
+ onKeyDown: $,
2339
+ ...u && {
2340
+ [Mo[d]]: (R) => {
2341
+ r(!1, R.nativeEvent, "reference-press");
2342
+ },
2343
+ ...d !== "click" && {
2344
+ onClick(R) {
2345
+ r(!1, R.nativeEvent, "reference-press");
2346
+ }
2347
+ }
2348
+ }
2349
+ }), [$, r, u, d]), H = g.useMemo(() => {
2350
+ function R(E) {
2351
+ E.button === 0 && (b.current = !0);
2352
+ }
2353
+ return {
2354
+ onKeyDown: $,
2355
+ onMouseDown: R,
2356
+ onMouseUp: R,
2357
+ [Po[a]]: () => {
2358
+ i.current.insideReactTree = !0;
2359
+ }
2360
+ };
2361
+ }, [$, a, i]);
2362
+ return g.useMemo(() => s ? {
2363
+ reference: X,
2364
+ floating: H
2365
+ } : {}, [s, X, H]);
2366
+ }
2367
+ function Do(e) {
2368
+ const {
2369
+ open: t = !1,
2370
+ onOpenChange: n,
2371
+ elements: r
2372
+ } = e, o = At(), i = g.useRef({}), [s] = g.useState(() => po()), c = _n() != null;
2373
+ if (process.env.NODE_ENV !== "production") {
2374
+ const f = r.reference;
2375
+ f && !B(f) && go("Cannot pass a virtual element to the `elements.reference` option,", "as it must be a real DOM element. Use `refs.setPositionReference()`", "instead.");
2376
+ }
2377
+ const [l, a] = g.useState(r.reference), u = ie((f, h, m) => {
2378
+ i.current.openEvent = f ? h : void 0, s.emit("openchange", {
2379
+ open: f,
2380
+ event: h,
2381
+ reason: m,
2382
+ nested: c
2383
+ }), n == null || n(f, h, m);
2384
+ }), d = g.useMemo(() => ({
2385
+ setPositionReference: a
2386
+ }), []), p = g.useMemo(() => ({
2387
+ reference: l || r.reference || null,
2388
+ floating: r.floating || null,
2389
+ domReference: r.reference
2390
+ }), [l, r.reference, r.floating]);
2391
+ return g.useMemo(() => ({
2392
+ dataRef: i,
2393
+ open: t,
2394
+ onOpenChange: u,
2395
+ elements: p,
2396
+ events: s,
2397
+ floatingId: o,
2398
+ refs: d
2399
+ }), [t, u, p, s, o, d]);
2400
+ }
2401
+ function Yo(e) {
2402
+ e === void 0 && (e = {});
2403
+ const {
2404
+ nodeId: t
2405
+ } = e, n = Do({
2406
+ ...e,
2407
+ elements: {
2408
+ reference: null,
2409
+ floating: null,
2410
+ ...e.elements
2411
+ }
2412
+ }), r = e.rootContext || n, o = r.elements, [i, s] = g.useState(null), [c, l] = g.useState(null), u = (o == null ? void 0 : o.domReference) || i, d = g.useRef(null), p = Ot();
2413
+ Z(() => {
2414
+ u && (d.current = u);
2415
+ }, [u]);
2416
+ const f = co({
2417
+ ...e,
2418
+ elements: {
2419
+ ...o,
2420
+ ...c && {
2421
+ reference: c
2422
+ }
2423
+ }
2424
+ }), h = g.useCallback((v) => {
2425
+ const S = B(v) ? {
2426
+ getBoundingClientRect: () => v.getBoundingClientRect(),
2427
+ getClientRects: () => v.getClientRects(),
2428
+ contextElement: v
2429
+ } : v;
2430
+ l(S), f.refs.setReference(S);
2431
+ }, [f.refs]), m = g.useCallback((v) => {
2432
+ (B(v) || v === null) && (d.current = v, s(v)), (B(f.refs.reference.current) || f.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to
2433
+ // `null` to support `positionReference` + an unstable `reference`
2434
+ // callback ref.
2435
+ v !== null && !B(v)) && f.refs.setReference(v);
2436
+ }, [f.refs]), x = g.useMemo(() => ({
2437
+ ...f.refs,
2438
+ setReference: m,
2439
+ setPositionReference: h,
2440
+ domReference: d
2441
+ }), [f.refs, m, h]), y = g.useMemo(() => ({
2442
+ ...f.elements,
2443
+ domReference: u
2444
+ }), [f.elements, u]), b = g.useMemo(() => ({
2445
+ ...f,
2446
+ ...r,
2447
+ refs: x,
2448
+ elements: y,
2449
+ nodeId: t
2450
+ }), [f, x, y, t, r]);
2451
+ return Z(() => {
2452
+ r.dataRef.current.floatingContext = b;
2453
+ const v = p == null ? void 0 : p.nodesRef.current.find((S) => S.id === t);
2454
+ v && (v.context = b);
2455
+ }), g.useMemo(() => ({
2456
+ ...f,
2457
+ context: b,
2458
+ refs: x,
2459
+ elements: y
2460
+ }), [f, x, y, b]);
2461
+ }
2462
+ function ht(e, t, n) {
2463
+ const r = /* @__PURE__ */ new Map(), o = n === "item";
2464
+ let i = e;
2465
+ if (o && e) {
2466
+ const {
2467
+ [Ut]: s,
2468
+ [Xt]: c,
2469
+ ...l
2470
+ } = e;
2471
+ i = l;
2472
+ }
2473
+ return {
2474
+ ...n === "floating" && {
2475
+ tabIndex: -1,
2476
+ [lo]: ""
2477
+ },
2478
+ ...i,
2479
+ ...t.map((s) => {
2480
+ const c = s ? s[n] : null;
2481
+ return typeof c == "function" ? e ? c(e) : null : c;
2482
+ }).concat(e).reduce((s, c) => (c && Object.entries(c).forEach((l) => {
2483
+ let [a, u] = l;
2484
+ if (!(o && [Ut, Xt].includes(a)))
2485
+ if (a.indexOf("on") === 0) {
2486
+ if (r.has(a) || r.set(a, []), typeof u == "function") {
2487
+ var d;
2488
+ (d = r.get(a)) == null || d.push(u), s[a] = function() {
2489
+ for (var p, f = arguments.length, h = new Array(f), m = 0; m < f; m++)
2490
+ h[m] = arguments[m];
2491
+ return (p = r.get(a)) == null ? void 0 : p.map((x) => x(...h)).find((x) => x !== void 0);
2492
+ };
2493
+ }
2494
+ } else
2495
+ s[a] = u;
2496
+ }), s), {})
2497
+ };
2498
+ }
2499
+ function zo(e) {
2500
+ e === void 0 && (e = []);
2501
+ const t = e.map((c) => c == null ? void 0 : c.reference), n = e.map((c) => c == null ? void 0 : c.floating), r = e.map((c) => c == null ? void 0 : c.item), o = g.useCallback(
2502
+ (c) => ht(c, e, "reference"),
2503
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2504
+ t
2505
+ ), i = g.useCallback(
2506
+ (c) => ht(c, e, "floating"),
2507
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2508
+ n
2509
+ ), s = g.useCallback(
2510
+ (c) => ht(c, e, "item"),
2511
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2512
+ r
2513
+ );
2514
+ return g.useMemo(() => ({
2515
+ getReferenceProps: o,
2516
+ getFloatingProps: i,
2517
+ getItemProps: s
2518
+ }), [o, i, s]);
2519
+ }
2520
+ const ko = /* @__PURE__ */ new Map([["select", "listbox"], ["combobox", "listbox"], ["label", !1]]);
2521
+ function Go(e, t) {
2522
+ var n, r;
2523
+ t === void 0 && (t = {});
2524
+ const {
2525
+ open: o,
2526
+ elements: i,
2527
+ floatingId: s
2528
+ } = e, {
2529
+ enabled: c = !0,
2530
+ role: l = "dialog"
2531
+ } = t, a = At(), u = ((n = i.domReference) == null ? void 0 : n.id) || a, d = g.useMemo(() => {
2532
+ var b;
2533
+ return ((b = Rt(i.floating)) == null ? void 0 : b.id) || s;
2534
+ }, [i.floating, s]), p = (r = ko.get(l)) != null ? r : l, h = _n() != null, m = g.useMemo(() => p === "tooltip" || l === "label" ? {
2535
+ ["aria-" + (l === "label" ? "labelledby" : "describedby")]: o ? d : void 0
2536
+ } : {
2537
+ "aria-expanded": o ? "true" : "false",
2538
+ "aria-haspopup": p === "alertdialog" ? "dialog" : p,
2539
+ "aria-controls": o ? d : void 0,
2540
+ ...p === "listbox" && {
2541
+ role: "combobox"
2542
+ },
2543
+ ...p === "menu" && {
2544
+ id: u
2545
+ },
2546
+ ...p === "menu" && h && {
2547
+ role: "menuitem"
2548
+ },
2549
+ ...l === "select" && {
2550
+ "aria-autocomplete": "none"
2551
+ },
2552
+ ...l === "combobox" && {
2553
+ "aria-autocomplete": "list"
2554
+ }
2555
+ }, [p, d, h, o, u, l]), x = g.useMemo(() => {
2556
+ const b = {
2557
+ id: d,
2558
+ ...p && {
2559
+ role: p
2560
+ }
2561
+ };
2562
+ return p === "tooltip" || l === "label" ? b : {
2563
+ ...b,
2564
+ ...p === "menu" && {
2565
+ "aria-labelledby": u
2566
+ }
2567
+ };
2568
+ }, [p, d, u, l]), y = g.useCallback((b) => {
2569
+ let {
2570
+ active: v,
2571
+ selected: S
2572
+ } = b;
2573
+ const A = {
2574
+ role: "option",
2575
+ ...v && {
2576
+ id: d + "-fui-option"
2577
+ }
2578
+ };
2579
+ switch (l) {
2580
+ case "select":
2581
+ case "combobox":
2582
+ return {
2583
+ ...A,
2584
+ "aria-selected": S
2585
+ };
2586
+ }
2587
+ return {};
2588
+ }, [d, l]);
2589
+ return g.useMemo(() => c ? {
2590
+ reference: m,
2591
+ floating: x,
2592
+ item: y
2593
+ } : {}, [c, m, x, y]);
2594
+ }
2595
+ export {
2596
+ Ko as F,
2597
+ Uo as a,
2598
+ Xo as b,
2599
+ Go as c,
2600
+ zo as d,
2601
+ At as e,
2602
+ Ho as f,
2603
+ jo as g,
2604
+ qo as h,
2605
+ co as i,
2606
+ B as j,
2607
+ Ne as k,
2608
+ $o as l,
2609
+ G as m,
2610
+ Pe as n,
2611
+ _o as o,
2612
+ Bo as p,
2613
+ Vo as q,
2614
+ Xe as r,
2615
+ Wo as s,
2616
+ No as t,
2617
+ Yo as u
2618
+ };
2619
+ //# sourceMappingURL=floating-ui.react-Co7v2aHO.js.map