@wrdagency/blockout 0.0.13 → 0.0.14

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 (59) hide show
  1. package/dist/{2NBKRL7C-C6mXReCE.js → 2NBKRL7C-D-Q0qGRV.js} +3 -3
  2. package/dist/{P7GR5CS5-DNbthaqU.js → P7GR5CS5-qyeuZVEs.js} +1 -1
  3. package/dist/T7VMP3TM-BxgFbvdx.js +2106 -0
  4. package/dist/{UQQRIHDV-CFdrMoqW.js → UQQRIHDV-BGs025hb.js} +2 -2
  5. package/dist/{VIIRIBF3-B585VK9r.js → VIIRIBF3-D9clDhln.js} +1 -1
  6. package/dist/_commonjsHelpers-DaMA6jEr.js +8 -0
  7. package/dist/assets/button.css +1 -0
  8. package/dist/assets/form.css +1 -1
  9. package/dist/assets/index.css +1 -1
  10. package/dist/assets/index10.css +1 -1
  11. package/dist/assets/index11.css +1 -1
  12. package/dist/assets/index12.css +1 -0
  13. package/dist/assets/index13.css +1 -0
  14. package/dist/assets/index2.css +1 -1
  15. package/dist/assets/index3.css +1 -1
  16. package/dist/assets/index4.css +1 -1
  17. package/dist/components/breadcrumbs/index.js +23 -16
  18. package/dist/components/button/{index.d.ts → button.d.ts} +2 -3
  19. package/dist/components/button/button.js +28 -0
  20. package/dist/components/button/icon.d.ts +6 -0
  21. package/dist/components/button/icon.js +10 -0
  22. package/dist/components/button/index.js +6 -26
  23. package/dist/components/controls/base-control/affix.d.ts +6 -0
  24. package/dist/components/controls/base-control/affix.js +15 -0
  25. package/dist/components/controls/base-control/index.js +26 -21
  26. package/dist/components/controls/index.d.ts +1 -0
  27. package/dist/components/controls/index.js +10 -8
  28. package/dist/components/controls/number-control/index.d.ts +1 -1
  29. package/dist/components/controls/number-control/index.js +37 -31
  30. package/dist/components/controls/password-control/index.d.ts +7 -0
  31. package/dist/components/controls/password-control/index.js +114 -0
  32. package/dist/components/controls/select-control/index.js +9 -9
  33. package/dist/components/data-table/column.js +1 -1
  34. package/dist/components/form/components/pagination.js +1 -1
  35. package/dist/components/form/components/step.js +22 -16
  36. package/dist/components/form/index.d.ts +0 -2
  37. package/dist/components/form/types/fields.d.ts +1 -1
  38. package/dist/components/form/types/form.d.ts +1 -1
  39. package/dist/components/index.d.ts +2 -1
  40. package/dist/components/index.js +23 -19
  41. package/dist/components/markdown/index.d.ts +6 -0
  42. package/dist/components/markdown/index.js +25844 -0
  43. package/dist/components/menu/index.js +4 -4
  44. package/dist/components/menu/item.js +1 -1
  45. package/dist/components/menu/items/action.js +1 -1
  46. package/dist/components/menu/items/spacer.js +2 -2
  47. package/dist/components/menu/items/submenu.js +2 -2
  48. package/dist/components/menu/items/toggle.js +1 -1
  49. package/dist/floating-ui.dom-9sqP7IwC.js +1512 -0
  50. package/dist/hooks/index.d.ts +1 -0
  51. package/dist/hooks/index.js +4 -0
  52. package/dist/hooks/theme.d.ts +8 -0
  53. package/dist/hooks/theme.js +45 -0
  54. package/dist/index.d.ts +1 -0
  55. package/dist/index.js +30 -24
  56. package/dist/{item-C0kyELlf.js → item-D9r2-3fk.js} +5 -5
  57. package/package.json +3 -1
  58. package/dist/T7VMP3TM-B3jxXFmj.js +0 -3548
  59. package/dist/_commonjsHelpers-C6fGbg64.js +0 -6
@@ -0,0 +1,2106 @@
1
+ import { y as L, x as be, D as ge, z as oe, an as zt, o as q, M as pt, r as vt, k as x, c as wn, P as gt, C as xn, a as In, b as Wt, d as Z, _ as ne, ao as Cn, i as Ee, ag as Dn, v as H, ap as _e, Y as ht, g as se, a3 as Pe, u as Le, W as bt, G as ue, j as $, s as Ce, aq as Fn, f as K, e as Y, ar as Et, as as qt, t as jt, K as An, at as Ft, a4 as ke, E as yt, I as ae, Z as On, aj as Tn, w as Ut, au as _n, av as Rn, U as nt, aw as et, A as Yt, a1 as ct, ax as Nn, ay as $n, a2 as Mn, a6 as kn, az as tt, a5 as Ln, a7 as Vn, O as Bn, p as Hn, am as Kn } from "./P7GR5CS5-qyeuZVEs.js";
2
+ import { t as St, c as Be, f as xe, l as zn, i as At, d as te, s as Ze, n as we, q as Wn, k as qn, r as jn, v as rt, e as Xt, w as Un, x as Yn, u as de, m as Gt, o as Jt, y as Xn, g as Zt, z as ot, A as Ot, B as Gn, C as Jn, F as Zn, D as Qn, E as er, G as tr, H as Ve, I as nr, J as rr, K as or } from "./UQQRIHDV-BGs025hb.js";
3
+ import { createContext as Ne, useRef as W, useEffect as z, useState as ie, useCallback as He, useMemo as Qt, useContext as Pt, isValidElement as sr } from "react";
4
+ import { jsx as R, jsxs as Xe, Fragment as Ge } from "react/jsx-runtime";
5
+ import { r as Qe, a as ir, c as ur, o as ar, f as cr, s as lr, b as dr, d as fr, l as mr } from "./floating-ui.dom-9sqP7IwC.js";
6
+ function pr(e) {
7
+ var t;
8
+ const r = e.find((s) => !!s.element), n = [...e].reverse().find((s) => !!s.element);
9
+ let o = (t = r == null ? void 0 : r.element) == null ? void 0 : t.parentElement;
10
+ for (; o && (n != null && n.element); ) {
11
+ if (n && o.contains(n.element))
12
+ return o;
13
+ o = o.parentElement;
14
+ }
15
+ return q(o).body;
16
+ }
17
+ function vr(e) {
18
+ return e == null ? void 0 : e.__unstablePrivateStore;
19
+ }
20
+ function gr(e = {}) {
21
+ var t;
22
+ St(e, e.store);
23
+ const r = (t = e.store) == null ? void 0 : t.getState(), n = L(
24
+ e.items,
25
+ r == null ? void 0 : r.items,
26
+ e.defaultItems,
27
+ []
28
+ ), o = new Map(n.map((c) => [c.id, c])), s = {
29
+ items: n,
30
+ renderedItems: L(r == null ? void 0 : r.renderedItems, [])
31
+ }, a = vr(e.store), u = Be(
32
+ { items: n, renderedItems: s.renderedItems },
33
+ a
34
+ ), i = Be(s, e.store), m = (c) => {
35
+ const g = zt(c, (h) => h.element);
36
+ u.setState("renderedItems", g), i.setState("renderedItems", g);
37
+ };
38
+ xe(i, () => zn(u)), xe(u, () => At(u, ["items"], (c) => {
39
+ i.setState("items", c.items);
40
+ })), xe(u, () => At(u, ["renderedItems"], (c) => {
41
+ let g = !0, h = requestAnimationFrame(() => {
42
+ const { renderedItems: b } = i.getState();
43
+ c.renderedItems !== b && m(c.renderedItems);
44
+ });
45
+ if (typeof IntersectionObserver != "function")
46
+ return () => cancelAnimationFrame(h);
47
+ const S = () => {
48
+ if (g) {
49
+ g = !1;
50
+ return;
51
+ }
52
+ cancelAnimationFrame(h), h = requestAnimationFrame(() => m(c.renderedItems));
53
+ }, T = pr(c.renderedItems), w = new IntersectionObserver(S, { root: T });
54
+ for (const b of c.renderedItems)
55
+ b.element && w.observe(b.element);
56
+ return () => {
57
+ cancelAnimationFrame(h), w.disconnect();
58
+ };
59
+ }));
60
+ const f = (c, g, h = !1) => {
61
+ let S;
62
+ return g((w) => {
63
+ const b = w.findIndex(({ id: d }) => d === c.id), I = w.slice();
64
+ if (b !== -1) {
65
+ S = w[b];
66
+ const d = oe(oe({}, S), c);
67
+ I[b] = d, o.set(c.id, d);
68
+ } else
69
+ I.push(c), o.set(c.id, c);
70
+ return I;
71
+ }), () => {
72
+ g((w) => {
73
+ if (!S)
74
+ return h && o.delete(c.id), w.filter(({ id: d }) => d !== c.id);
75
+ const b = w.findIndex(({ id: d }) => d === c.id);
76
+ if (b === -1) return w;
77
+ const I = w.slice();
78
+ return I[b] = S, o.set(c.id, S), I;
79
+ });
80
+ };
81
+ }, C = (c) => f(
82
+ c,
83
+ (g) => u.setState("items", g),
84
+ !0
85
+ );
86
+ return be(oe({}, i), {
87
+ registerItem: C,
88
+ renderItem: (c) => ge(
89
+ C(c),
90
+ f(
91
+ c,
92
+ (g) => u.setState("renderedItems", g)
93
+ )
94
+ ),
95
+ item: (c) => {
96
+ if (!c) return null;
97
+ let g = o.get(c);
98
+ if (!g) {
99
+ const { items: h } = u.getState();
100
+ g = h.find((S) => S.id === c), g && o.set(c, g);
101
+ }
102
+ return g || null;
103
+ },
104
+ // @ts-expect-error Internal
105
+ __unstablePrivateStore: u
106
+ });
107
+ }
108
+ function hr(e, t, r) {
109
+ return pt(t, [r.store]), te(e, r, "items", "setItems"), e;
110
+ }
111
+ function zo(e) {
112
+ return Array.isArray(e) ? e : typeof e < "u" ? [e] : [];
113
+ }
114
+ function en(e) {
115
+ const t = [];
116
+ for (const r of e)
117
+ t.push(...r);
118
+ return t;
119
+ }
120
+ function lt(e) {
121
+ return e.slice().reverse();
122
+ }
123
+ var br = { id: null };
124
+ function pe(e, t) {
125
+ return e.find((r) => t ? !r.disabled && r.id !== t : !r.disabled);
126
+ }
127
+ function Er(e, t) {
128
+ return e.filter((r) => t ? !r.disabled && r.id !== t : !r.disabled);
129
+ }
130
+ function Tt(e, t) {
131
+ return e.filter((r) => r.rowId === t);
132
+ }
133
+ function yr(e, t, r = !1) {
134
+ const n = e.findIndex((o) => o.id === t);
135
+ return [
136
+ ...e.slice(n + 1),
137
+ ...r ? [br] : [],
138
+ ...e.slice(0, n)
139
+ ];
140
+ }
141
+ function tn(e) {
142
+ const t = [];
143
+ for (const r of e) {
144
+ const n = t.find((o) => {
145
+ var s;
146
+ return ((s = o[0]) == null ? void 0 : s.rowId) === r.rowId;
147
+ });
148
+ n ? n.push(r) : t.push([r]);
149
+ }
150
+ return t;
151
+ }
152
+ function nn(e) {
153
+ let t = 0;
154
+ for (const { length: r } of e)
155
+ r > t && (t = r);
156
+ return t;
157
+ }
158
+ function Sr(e) {
159
+ return {
160
+ id: "__EMPTY_ITEM__",
161
+ disabled: !0,
162
+ rowId: e
163
+ };
164
+ }
165
+ function Pr(e, t, r) {
166
+ const n = nn(e);
167
+ for (const o of e)
168
+ for (let s = 0; s < n; s += 1) {
169
+ const a = o[s];
170
+ if (!a || r && a.disabled) {
171
+ const i = s === 0 && r ? pe(o) : o[s - 1];
172
+ o[s] = i && t !== i.id && r ? i : Sr(i == null ? void 0 : i.rowId);
173
+ }
174
+ }
175
+ return e;
176
+ }
177
+ function wr(e) {
178
+ const t = tn(e), r = nn(t), n = [];
179
+ for (let o = 0; o < r; o += 1)
180
+ for (const s of t) {
181
+ const a = s[o];
182
+ a && n.push(be(oe({}, a), {
183
+ // If there's no rowId, it means that it's not a grid composite, but
184
+ // a single row instead. So, instead of verticalizing it, that is,
185
+ // assigning a different rowId based on the column index, we keep it
186
+ // undefined so they will be part of the same row. This is useful
187
+ // when using up/down on one-dimensional composites.
188
+ rowId: a.rowId ? `${o}` : void 0
189
+ }));
190
+ }
191
+ return n;
192
+ }
193
+ function Wo(e = {}) {
194
+ var t;
195
+ const r = (t = e.store) == null ? void 0 : t.getState(), n = gr(e), o = L(
196
+ e.activeId,
197
+ r == null ? void 0 : r.activeId,
198
+ e.defaultActiveId
199
+ ), s = be(oe({}, n.getState()), {
200
+ id: L(
201
+ e.id,
202
+ r == null ? void 0 : r.id,
203
+ `id-${Math.random().toString(36).slice(2, 8)}`
204
+ ),
205
+ activeId: o,
206
+ baseElement: L(r == null ? void 0 : r.baseElement, null),
207
+ includesBaseElement: L(
208
+ e.includesBaseElement,
209
+ r == null ? void 0 : r.includesBaseElement,
210
+ o === null
211
+ ),
212
+ moves: L(r == null ? void 0 : r.moves, 0),
213
+ orientation: L(
214
+ e.orientation,
215
+ r == null ? void 0 : r.orientation,
216
+ "both"
217
+ ),
218
+ rtl: L(e.rtl, r == null ? void 0 : r.rtl, !1),
219
+ virtualFocus: L(
220
+ e.virtualFocus,
221
+ r == null ? void 0 : r.virtualFocus,
222
+ !1
223
+ ),
224
+ focusLoop: L(e.focusLoop, r == null ? void 0 : r.focusLoop, !1),
225
+ focusWrap: L(e.focusWrap, r == null ? void 0 : r.focusWrap, !1),
226
+ focusShift: L(e.focusShift, r == null ? void 0 : r.focusShift, !1)
227
+ }), a = Be(s, n, e.store);
228
+ xe(
229
+ a,
230
+ () => Ze(a, ["renderedItems", "activeId"], (i) => {
231
+ a.setState("activeId", (m) => {
232
+ var f;
233
+ return m !== void 0 ? m : (f = pe(i.renderedItems)) == null ? void 0 : f.id;
234
+ });
235
+ })
236
+ );
237
+ const u = (i = "next", m = {}) => {
238
+ var f, C;
239
+ const c = a.getState(), {
240
+ skip: g = 0,
241
+ activeId: h = c.activeId,
242
+ focusShift: S = c.focusShift,
243
+ focusLoop: T = c.focusLoop,
244
+ focusWrap: w = c.focusWrap,
245
+ includesBaseElement: b = c.includesBaseElement,
246
+ renderedItems: I = c.renderedItems,
247
+ rtl: d = c.rtl
248
+ } = m, p = i === "up" || i === "down", P = i === "next" || i === "down", E = P ? d && !p : !d || p, X = S && !g;
249
+ let D = p ? en(
250
+ Pr(tn(I), h, X)
251
+ ) : I;
252
+ if (D = E ? lt(D) : D, D = p ? wr(D) : D, h == null)
253
+ return (f = pe(D)) == null ? void 0 : f.id;
254
+ const N = D.find((_) => _.id === h);
255
+ if (!N)
256
+ return (C = pe(D)) == null ? void 0 : C.id;
257
+ const G = D.some((_) => _.rowId), B = D.indexOf(N), l = D.slice(B + 1), y = Tt(l, N.rowId);
258
+ if (g) {
259
+ const _ = Er(y, h), V = _.slice(g)[0] || // If we can't find an item, just return the last one.
260
+ _[_.length - 1];
261
+ return V == null ? void 0 : V.id;
262
+ }
263
+ const A = T && (p ? T !== "horizontal" : T !== "vertical"), M = G && w && (p ? w !== "horizontal" : w !== "vertical"), k = P ? (!G || p) && A && b : p ? b : !1;
264
+ if (A) {
265
+ const _ = M && !k ? D : Tt(D, N.rowId), V = yr(_, h, k), J = pe(V, h);
266
+ return J == null ? void 0 : J.id;
267
+ }
268
+ if (M) {
269
+ const _ = pe(
270
+ // We can use nextItems, which contains all the next items, including
271
+ // items from other rows, to wrap between rows. However, if there is a
272
+ // null item (the composite container), we'll only use the next items in
273
+ // the row. So moving next from the last item will focus on the
274
+ // composite container. On grid composites, horizontal navigation never
275
+ // focuses on the composite container, only vertical.
276
+ k ? y : l,
277
+ h
278
+ );
279
+ return k ? (_ == null ? void 0 : _.id) || null : _ == null ? void 0 : _.id;
280
+ }
281
+ const j = pe(y, h);
282
+ return !j && k ? null : j == null ? void 0 : j.id;
283
+ };
284
+ return be(oe(oe({}, n), a), {
285
+ setBaseElement: (i) => a.setState("baseElement", i),
286
+ setActiveId: (i) => a.setState("activeId", i),
287
+ move: (i) => {
288
+ i !== void 0 && (a.setState("activeId", i), a.setState("moves", (m) => m + 1));
289
+ },
290
+ first: () => {
291
+ var i;
292
+ return (i = pe(a.getState().renderedItems)) == null ? void 0 : i.id;
293
+ },
294
+ last: () => {
295
+ var i;
296
+ return (i = pe(lt(a.getState().renderedItems))) == null ? void 0 : i.id;
297
+ },
298
+ next: (i) => (i !== void 0 && typeof i == "number" && (i = { skip: i }), u("next", i)),
299
+ previous: (i) => (i !== void 0 && typeof i == "number" && (i = { skip: i }), u("previous", i)),
300
+ down: (i) => (i !== void 0 && typeof i == "number" && (i = { skip: i }), u("down", i)),
301
+ up: (i) => (i !== void 0 && typeof i == "number" && (i = { skip: i }), u("up", i))
302
+ });
303
+ }
304
+ function qo(e) {
305
+ const t = vt(e.id);
306
+ return x({ id: t }, e);
307
+ }
308
+ function jo(e, t, r) {
309
+ return e = hr(e, t, r), te(e, r, "activeId", "setActiveId"), te(e, r, "includesBaseElement"), te(e, r, "virtualFocus"), te(e, r, "orientation"), te(e, r, "rtl"), te(e, r, "focusLoop"), te(e, r, "focusWrap"), te(e, r, "focusShift"), e;
310
+ }
311
+ var Uo = Ne(
312
+ void 0
313
+ ), Ke = wn(
314
+ [In, Wt],
315
+ [gt, xn]
316
+ ), Yo = Ke.useContext, Xo = Ke.useScopedContext, Go = Ke.useProviderContext, Jo = Ke.ContextProvider, Zo = Ke.ScopedContextProvider, Qo = Ne(
317
+ void 0
318
+ ), es = Ne(!1), xr = "div";
319
+ function Ir(e) {
320
+ return e.some((t) => !!t.rowId);
321
+ }
322
+ function Cr(e) {
323
+ const t = e.target;
324
+ return t && !bt(t) ? !1 : e.key.length === 1 && !e.ctrlKey && !e.metaKey;
325
+ }
326
+ function Dr(e) {
327
+ return e.key === "Shift" || e.key === "Control" || e.key === "Alt" || e.key === "Meta";
328
+ }
329
+ function _t(e, t, r) {
330
+ return se((n) => {
331
+ var o;
332
+ if (t == null || t(n), n.defaultPrevented || n.isPropagationStopped() || !Pe(n) || Dr(n) || Cr(n)) return;
333
+ const s = e.getState(), a = (o = we(e, s.activeId)) == null ? void 0 : o.element;
334
+ if (!a) return;
335
+ const u = n, { view: i } = u, m = ne(u, ["view"]), f = r == null ? void 0 : r.current;
336
+ a !== f && a.focus(), Fn(a, n.type, m) || n.preventDefault(), n.currentTarget.contains(a) && n.stopPropagation();
337
+ });
338
+ }
339
+ function Fr(e) {
340
+ return Un(
341
+ en(lt(Yn(e)))
342
+ );
343
+ }
344
+ function Ar(e) {
345
+ const [t, r] = ie(!1), n = He(() => r(!0), []), o = e.useState(
346
+ (s) => we(e, s.activeId)
347
+ );
348
+ return z(() => {
349
+ const s = o == null ? void 0 : o.element;
350
+ t && s && (r(!1), s.focus({ preventScroll: !0 }));
351
+ }, [o, t]), n;
352
+ }
353
+ var Or = Z(
354
+ function(t) {
355
+ var r = t, {
356
+ store: n,
357
+ composite: o = !0,
358
+ focusOnMove: s = o,
359
+ moveOnKeyPress: a = !0
360
+ } = r, u = ne(r, [
361
+ "store",
362
+ "composite",
363
+ "focusOnMove",
364
+ "moveOnKeyPress"
365
+ ]);
366
+ const i = Cn();
367
+ n = n || i, Ee(
368
+ n,
369
+ process.env.NODE_ENV !== "production" && "Composite must receive a `store` prop or be wrapped in a CompositeProvider component."
370
+ );
371
+ const m = W(null), f = W(null), C = Ar(n), c = n.useState("moves"), [, g] = Dn(
372
+ o ? n.setBaseElement : null
373
+ );
374
+ z(() => {
375
+ var l;
376
+ if (!n || !c || !o || !s) return;
377
+ const { activeId: y } = n.getState(), A = (l = we(n, y)) == null ? void 0 : l.element;
378
+ A && Wn(A);
379
+ }, [n, c, o, s]), H(() => {
380
+ if (!n || !c || !o) return;
381
+ const { baseElement: l, activeId: y } = n.getState();
382
+ if (!(y === null) || !l) return;
383
+ const M = f.current;
384
+ f.current = null, M && _e(M, { relatedTarget: l }), qn(l) || l.focus();
385
+ }, [n, c, o]);
386
+ const h = n.useState("activeId"), S = n.useState("virtualFocus");
387
+ H(() => {
388
+ var l;
389
+ if (!n || !o || !S) return;
390
+ const y = f.current;
391
+ if (f.current = null, !y) return;
392
+ const M = ((l = we(n, h)) == null ? void 0 : l.element) || ht(y);
393
+ M !== y && _e(y, { relatedTarget: M });
394
+ }, [n, h, S, o]);
395
+ const T = _t(
396
+ n,
397
+ u.onKeyDownCapture,
398
+ f
399
+ ), w = _t(
400
+ n,
401
+ u.onKeyUpCapture,
402
+ f
403
+ ), b = u.onFocusCapture, I = se((l) => {
404
+ if (b == null || b(l), l.defaultPrevented || !n) return;
405
+ const { virtualFocus: y } = n.getState();
406
+ if (!y) return;
407
+ const A = l.relatedTarget, M = jn(l.currentTarget);
408
+ Pe(l) && M && (l.stopPropagation(), f.current = A);
409
+ }), d = u.onFocus, p = se((l) => {
410
+ if (d == null || d(l), l.defaultPrevented || !o || !n) return;
411
+ const { relatedTarget: y } = l, { virtualFocus: A } = n.getState();
412
+ A ? Pe(l) && !rt(n, y) && queueMicrotask(C) : Pe(l) && n.setActiveId(null);
413
+ }), P = u.onBlurCapture, E = se((l) => {
414
+ var y;
415
+ if (P == null || P(l), l.defaultPrevented || !n) return;
416
+ const { virtualFocus: A, activeId: M } = n.getState();
417
+ if (!A) return;
418
+ const k = (y = we(n, M)) == null ? void 0 : y.element, j = l.relatedTarget, _ = rt(n, j), V = f.current;
419
+ f.current = null, Pe(l) && _ ? (j === k ? V && V !== j && _e(V, l) : k ? _e(k, l) : V && _e(V, l), l.stopPropagation()) : !rt(n, l.target) && k && _e(k, l);
420
+ }), X = u.onKeyDown, D = Le(a), N = se((l) => {
421
+ var y;
422
+ if (X == null || X(l), l.nativeEvent.isComposing || l.defaultPrevented || !n || !Pe(l)) return;
423
+ const { orientation: A, renderedItems: M, activeId: k } = n.getState(), j = we(n, k);
424
+ if ((y = j == null ? void 0 : j.element) != null && y.isConnected) return;
425
+ const _ = A !== "horizontal", V = A !== "vertical", J = Ir(M);
426
+ if ((l.key === "ArrowLeft" || l.key === "ArrowRight" || l.key === "Home" || l.key === "End") && bt(l.currentTarget)) return;
427
+ const Q = {
428
+ ArrowUp: (J || _) && (() => {
429
+ if (J) {
430
+ const fe = Fr(M);
431
+ return fe == null ? void 0 : fe.id;
432
+ }
433
+ return n == null ? void 0 : n.last();
434
+ }),
435
+ ArrowRight: (J || V) && n.first,
436
+ ArrowDown: (J || _) && n.first,
437
+ ArrowLeft: (J || V) && n.last,
438
+ Home: n.first,
439
+ End: n.last,
440
+ PageUp: n.first,
441
+ PageDown: n.last
442
+ }[l.key];
443
+ if (Q) {
444
+ const fe = Q();
445
+ if (fe !== void 0) {
446
+ if (!D(l)) return;
447
+ l.preventDefault(), n.move(fe);
448
+ }
449
+ }
450
+ });
451
+ u = ue(
452
+ u,
453
+ (l) => /* @__PURE__ */ R(Wt, { value: n, children: l }),
454
+ [n]
455
+ );
456
+ const G = n.useState((l) => {
457
+ var y;
458
+ if (n && o && l.virtualFocus)
459
+ return (y = we(n, l.activeId)) == null ? void 0 : y.id;
460
+ });
461
+ u = $(x({
462
+ "aria-activedescendant": G
463
+ }, u), {
464
+ ref: Ce(m, g, u.ref),
465
+ onKeyDownCapture: T,
466
+ onKeyUpCapture: w,
467
+ onFocusCapture: I,
468
+ onFocus: p,
469
+ onBlurCapture: E,
470
+ onKeyDown: N
471
+ });
472
+ const B = n.useState(
473
+ (l) => o && (l.virtualFocus || l.activeId === null)
474
+ );
475
+ return u = Xt(x({ focusable: B }, u)), u;
476
+ }
477
+ );
478
+ K(function(t) {
479
+ const r = Or(t);
480
+ return Y(xr, r);
481
+ });
482
+ var Tr = "div";
483
+ function Rt(e, t) {
484
+ const r = setTimeout(t, e);
485
+ return () => clearTimeout(r);
486
+ }
487
+ function _r(e) {
488
+ let t = requestAnimationFrame(() => {
489
+ t = requestAnimationFrame(e);
490
+ });
491
+ return () => cancelAnimationFrame(t);
492
+ }
493
+ function Nt(...e) {
494
+ return e.join(", ").split(", ").reduce((t, r) => {
495
+ const n = r.endsWith("ms") ? 1 : 1e3, o = Number.parseFloat(r || "0s") * n;
496
+ return o > t ? o : t;
497
+ }, 0);
498
+ }
499
+ function rn(e, t, r) {
500
+ return !r && t !== !1 && (!e || !!t);
501
+ }
502
+ var wt = Z(function(t) {
503
+ var r = t, { store: n, alwaysVisible: o } = r, s = ne(r, ["store", "alwaysVisible"]);
504
+ const a = Et();
505
+ n = n || a, Ee(
506
+ n,
507
+ process.env.NODE_ENV !== "production" && "DisclosureContent must receive a `store` prop or be wrapped in a DisclosureProvider component."
508
+ );
509
+ const u = W(null), i = vt(s.id), [m, f] = ie(null), C = n.useState("open"), c = n.useState("mounted"), g = n.useState("animated"), h = n.useState("contentElement"), S = de(n.disclosure, "contentElement");
510
+ H(() => {
511
+ u.current && (n == null || n.setContentElement(u.current));
512
+ }, [n]), H(() => {
513
+ let I;
514
+ return n == null || n.setState("animated", (d) => (I = d, !0)), () => {
515
+ I !== void 0 && (n == null || n.setState("animated", I));
516
+ };
517
+ }, [n]), H(() => {
518
+ if (g) {
519
+ if (!(h != null && h.isConnected)) {
520
+ f(null);
521
+ return;
522
+ }
523
+ return _r(() => {
524
+ f(C ? "enter" : c ? "leave" : null);
525
+ });
526
+ }
527
+ }, [g, h, C, c]), H(() => {
528
+ if (!n || !g || !m || !h) return;
529
+ const I = () => n == null ? void 0 : n.setState("animating", !1), d = () => Qe.flushSync(I);
530
+ if (m === "leave" && C || m === "enter" && !C) return;
531
+ if (typeof g == "number")
532
+ return Rt(g, d);
533
+ const {
534
+ transitionDuration: p,
535
+ animationDuration: P,
536
+ transitionDelay: E,
537
+ animationDelay: X
538
+ } = getComputedStyle(h), {
539
+ transitionDuration: D = "0",
540
+ animationDuration: N = "0",
541
+ transitionDelay: G = "0",
542
+ animationDelay: B = "0"
543
+ } = S ? getComputedStyle(S) : {}, l = Nt(
544
+ E,
545
+ X,
546
+ G,
547
+ B
548
+ ), y = Nt(
549
+ p,
550
+ P,
551
+ D,
552
+ N
553
+ ), A = l + y;
554
+ if (!A) {
555
+ m === "enter" && n.setState("animated", !1), I();
556
+ return;
557
+ }
558
+ const M = 1e3 / 60, k = Math.max(A - M, 0);
559
+ return Rt(k, d);
560
+ }, [n, g, h, S, C, m]), s = ue(
561
+ s,
562
+ (I) => /* @__PURE__ */ R(qt, { value: n, children: I }),
563
+ [n]
564
+ );
565
+ const T = rn(c, s.hidden, o), w = s.style, b = Qt(() => T ? $(x({}, w), { display: "none" }) : w, [T, w]);
566
+ return s = $(x({
567
+ id: i,
568
+ "data-open": C || void 0,
569
+ "data-enter": m === "enter" || void 0,
570
+ "data-leave": m === "leave" || void 0,
571
+ hidden: T
572
+ }, s), {
573
+ ref: Ce(i ? n.setContentElement : null, u, s.ref),
574
+ style: b
575
+ }), jt(s);
576
+ }), Rr = K(function(t) {
577
+ const r = wt(t);
578
+ return Y(Tr, r);
579
+ });
580
+ K(function(t) {
581
+ var r = t, {
582
+ unmountOnHide: n
583
+ } = r, o = ne(r, [
584
+ "unmountOnHide"
585
+ ]);
586
+ const s = Et(), a = o.store || s;
587
+ return de(
588
+ a,
589
+ (i) => !n || (i == null ? void 0 : i.mounted)
590
+ ) === !1 ? null : /* @__PURE__ */ R(Rr, x({}, o));
591
+ });
592
+ function on(e = {}) {
593
+ const t = Gt(
594
+ e.store,
595
+ Jt(e.disclosure, ["contentElement", "disclosureElement"])
596
+ );
597
+ St(e, t);
598
+ const r = t == null ? void 0 : t.getState(), n = L(
599
+ e.open,
600
+ r == null ? void 0 : r.open,
601
+ e.defaultOpen,
602
+ !1
603
+ ), o = L(e.animated, r == null ? void 0 : r.animated, !1), s = {
604
+ open: n,
605
+ animated: o,
606
+ animating: !!o && n,
607
+ mounted: n,
608
+ contentElement: L(r == null ? void 0 : r.contentElement, null),
609
+ disclosureElement: L(r == null ? void 0 : r.disclosureElement, null)
610
+ }, a = Be(s, t);
611
+ return xe(
612
+ a,
613
+ () => Ze(a, ["animated", "animating"], (u) => {
614
+ u.animated || a.setState("animating", !1);
615
+ })
616
+ ), xe(
617
+ a,
618
+ () => Xn(a, ["open"], () => {
619
+ a.getState().animated && a.setState("animating", !0);
620
+ })
621
+ ), xe(
622
+ a,
623
+ () => Ze(a, ["open", "animating"], (u) => {
624
+ a.setState("mounted", u.open || u.animating);
625
+ })
626
+ ), be(oe({}, a), {
627
+ disclosure: e.disclosure,
628
+ setOpen: (u) => a.setState("open", u),
629
+ show: () => a.setState("open", !0),
630
+ hide: () => a.setState("open", !1),
631
+ toggle: () => a.setState("open", (u) => !u),
632
+ stopAnimation: () => a.setState("animating", !1),
633
+ setContentElement: (u) => a.setState("contentElement", u),
634
+ setDisclosureElement: (u) => a.setState("disclosureElement", u)
635
+ });
636
+ }
637
+ function sn(e, t, r) {
638
+ return pt(t, [r.store, r.disclosure]), te(e, r, "open", "setOpen"), te(e, r, "mounted", "setMounted"), te(e, r, "animated"), Object.assign(e, { disclosure: r.disclosure });
639
+ }
640
+ function Nr(e = {}) {
641
+ const [t, r] = Zt(on, e);
642
+ return sn(t, r, e);
643
+ }
644
+ function un(e = {}) {
645
+ return on(e);
646
+ }
647
+ function an(e, t, r) {
648
+ return sn(e, t, r);
649
+ }
650
+ function $r(e = {}) {
651
+ const [t, r] = Zt(un, e);
652
+ return an(t, r, e);
653
+ }
654
+ function ts(e = {}) {
655
+ var t = e, {
656
+ popover: r
657
+ } = t, n = An(t, [
658
+ "popover"
659
+ ]);
660
+ const o = Gt(
661
+ n.store,
662
+ Jt(r, [
663
+ "arrowElement",
664
+ "anchorElement",
665
+ "contentElement",
666
+ "popoverElement",
667
+ "disclosureElement"
668
+ ])
669
+ );
670
+ St(n, o);
671
+ const s = o == null ? void 0 : o.getState(), a = un(be(oe({}, n), { store: o })), u = L(
672
+ n.placement,
673
+ s == null ? void 0 : s.placement,
674
+ "bottom"
675
+ ), i = be(oe({}, a.getState()), {
676
+ placement: u,
677
+ currentPlacement: u,
678
+ anchorElement: L(s == null ? void 0 : s.anchorElement, null),
679
+ popoverElement: L(s == null ? void 0 : s.popoverElement, null),
680
+ arrowElement: L(s == null ? void 0 : s.arrowElement, null),
681
+ rendered: Symbol("rendered")
682
+ }), m = Be(i, a, o);
683
+ return be(oe(oe({}, a), m), {
684
+ setAnchorElement: (f) => m.setState("anchorElement", f),
685
+ setPopoverElement: (f) => m.setState("popoverElement", f),
686
+ setArrowElement: (f) => m.setState("arrowElement", f),
687
+ render: () => m.setState("rendered", Symbol("rendered"))
688
+ });
689
+ }
690
+ function ns(e, t, r) {
691
+ return pt(t, [r.popover]), te(e, r, "placement"), an(e, t, r);
692
+ }
693
+ var $t = Ne(null), Mr = "span", cn = Z(
694
+ function(t) {
695
+ return t = $(x({}, t), {
696
+ style: x({
697
+ border: 0,
698
+ clip: "rect(0 0 0 0)",
699
+ height: "1px",
700
+ margin: "-1px",
701
+ overflow: "hidden",
702
+ padding: 0,
703
+ position: "absolute",
704
+ whiteSpace: "nowrap",
705
+ width: "1px"
706
+ }, t.style)
707
+ }), t;
708
+ }
709
+ );
710
+ K(function(t) {
711
+ const r = cn(t);
712
+ return Y(Mr, r);
713
+ });
714
+ var kr = "span", Lr = Z(
715
+ function(t) {
716
+ return t = $(x({
717
+ "data-focus-trap": "",
718
+ tabIndex: 0,
719
+ "aria-hidden": !0
720
+ }, t), {
721
+ style: x({
722
+ // Prevents unintended scroll jumps.
723
+ position: "fixed",
724
+ top: 0,
725
+ left: 0
726
+ }, t.style)
727
+ }), t = cn(t), t;
728
+ }
729
+ ), Ye = K(function(t) {
730
+ const r = Lr(t);
731
+ return Y(kr, r);
732
+ }), Vr = "div";
733
+ function Br(e) {
734
+ return q(e).body;
735
+ }
736
+ function Hr(e, t) {
737
+ return t ? typeof t == "function" ? t(e) : t : q(e).createElement("div");
738
+ }
739
+ function Kr(e = "id") {
740
+ return `${e ? `${e}-` : ""}${Math.random().toString(36).slice(2, 8)}`;
741
+ }
742
+ function he(e) {
743
+ queueMicrotask(() => {
744
+ e == null || e.focus();
745
+ });
746
+ }
747
+ var ln = Z(function(t) {
748
+ var r = t, {
749
+ preserveTabOrder: n,
750
+ preserveTabOrderAnchor: o,
751
+ portalElement: s,
752
+ portalRef: a,
753
+ portal: u = !0
754
+ } = r, i = ne(r, [
755
+ "preserveTabOrder",
756
+ "preserveTabOrderAnchor",
757
+ "portalElement",
758
+ "portalRef",
759
+ "portal"
760
+ ]);
761
+ const m = W(null), f = Ce(m, i.ref), C = Pt($t), [c, g] = ie(null), [h, S] = ie(
762
+ null
763
+ ), T = W(null), w = W(null), b = W(null), I = W(null);
764
+ return H(() => {
765
+ const d = m.current;
766
+ if (!d || !u) {
767
+ g(null);
768
+ return;
769
+ }
770
+ const p = Hr(d, s);
771
+ if (!p) {
772
+ g(null);
773
+ return;
774
+ }
775
+ const P = p.isConnected;
776
+ if (P || (C || Br(d)).appendChild(p), p.id || (p.id = d.id ? `portal/${d.id}` : Kr()), g(p), Ft(a, p), !P)
777
+ return () => {
778
+ p.remove(), Ft(a, null);
779
+ };
780
+ }, [u, s, C, a]), H(() => {
781
+ if (!u || !n || !o) return;
782
+ const p = q(o).createElement("span");
783
+ return p.style.position = "fixed", o.insertAdjacentElement("afterend", p), S(p), () => {
784
+ p.remove(), S(null);
785
+ };
786
+ }, [u, n, o]), z(() => {
787
+ if (!c || !n) return;
788
+ let d = 0;
789
+ const p = (P) => {
790
+ if (!ke(P)) return;
791
+ const E = P.type === "focusin";
792
+ if (cancelAnimationFrame(d), E)
793
+ return Gn(c);
794
+ d = requestAnimationFrame(() => {
795
+ Jn(c, !0);
796
+ });
797
+ };
798
+ return c.addEventListener("focusin", p, !0), c.addEventListener("focusout", p, !0), () => {
799
+ cancelAnimationFrame(d), c.removeEventListener("focusin", p, !0), c.removeEventListener("focusout", p, !0);
800
+ };
801
+ }, [c, n]), i = ue(
802
+ i,
803
+ (d) => {
804
+ if (d = // While the portal node is not in the DOM, we need to pass the
805
+ // current context to the portal context, otherwise it's going to
806
+ // reset to the body element on nested portals.
807
+ /* @__PURE__ */ R($t.Provider, { value: c || C, children: d }), !u) return d;
808
+ if (!c)
809
+ return /* @__PURE__ */ R(
810
+ "span",
811
+ {
812
+ ref: f,
813
+ id: i.id,
814
+ style: { position: "fixed" },
815
+ hidden: !0
816
+ }
817
+ );
818
+ d = /* @__PURE__ */ Xe(Ge, { children: [
819
+ n && c && /* @__PURE__ */ R(
820
+ Ye,
821
+ {
822
+ ref: w,
823
+ "data-focus-trap": i.id,
824
+ className: "__focus-trap-inner-before",
825
+ onFocus: (P) => {
826
+ ke(P, c) ? he(ot()) : he(T.current);
827
+ }
828
+ }
829
+ ),
830
+ d,
831
+ n && c && /* @__PURE__ */ R(
832
+ Ye,
833
+ {
834
+ ref: b,
835
+ "data-focus-trap": i.id,
836
+ className: "__focus-trap-inner-after",
837
+ onFocus: (P) => {
838
+ ke(P, c) ? he(Ot()) : he(I.current);
839
+ }
840
+ }
841
+ )
842
+ ] }), c && (d = Qe.createPortal(d, c));
843
+ let p = /* @__PURE__ */ Xe(Ge, { children: [
844
+ n && c && /* @__PURE__ */ R(
845
+ Ye,
846
+ {
847
+ ref: T,
848
+ "data-focus-trap": i.id,
849
+ className: "__focus-trap-outer-before",
850
+ onFocus: (P) => {
851
+ !(P.relatedTarget === I.current) && ke(P, c) ? he(w.current) : he(Ot());
852
+ }
853
+ }
854
+ ),
855
+ n && // We're using position: fixed here so that the browser doesn't
856
+ // add margin to the element when setting gap on a parent element.
857
+ /* @__PURE__ */ R("span", { "aria-owns": c == null ? void 0 : c.id, style: { position: "fixed" } }),
858
+ n && c && /* @__PURE__ */ R(
859
+ Ye,
860
+ {
861
+ ref: I,
862
+ "data-focus-trap": i.id,
863
+ className: "__focus-trap-outer-after",
864
+ onFocus: (P) => {
865
+ if (ke(P, c))
866
+ he(b.current);
867
+ else {
868
+ const E = ot();
869
+ if (E === w.current) {
870
+ requestAnimationFrame(() => {
871
+ var X;
872
+ return (X = ot()) == null ? void 0 : X.focus();
873
+ });
874
+ return;
875
+ }
876
+ he(E);
877
+ }
878
+ }
879
+ }
880
+ )
881
+ ] });
882
+ return h && n && (p = Qe.createPortal(
883
+ p,
884
+ h
885
+ )), /* @__PURE__ */ Xe(Ge, { children: [
886
+ p,
887
+ d
888
+ ] });
889
+ },
890
+ [c, C, u, i.id, n, h]
891
+ ), i = $(x({}, i), {
892
+ ref: f
893
+ }), i;
894
+ });
895
+ K(function(t) {
896
+ const r = ln(t);
897
+ return Y(Vr, r);
898
+ });
899
+ var Mt = Ne(0);
900
+ function zr({ level: e, children: t }) {
901
+ const r = Pt(Mt), n = Math.max(
902
+ Math.min(e || r + 1, 6),
903
+ 1
904
+ );
905
+ return /* @__PURE__ */ R(Mt.Provider, { value: n, children: t });
906
+ }
907
+ var Wr = "div", dn = Z(function(t) {
908
+ var r = t, { autoFocusOnShow: n = !0 } = r, o = ne(r, ["autoFocusOnShow"]);
909
+ return o = ue(
910
+ o,
911
+ (s) => /* @__PURE__ */ R(Zn.Provider, { value: n, children: s }),
912
+ [n]
913
+ ), o;
914
+ });
915
+ K(function(t) {
916
+ const r = dn(t);
917
+ return Y(Wr, r);
918
+ });
919
+ function qr(e, t) {
920
+ const n = q(e).createElement("button");
921
+ return n.type = "button", n.tabIndex = -1, n.textContent = "Dismiss popup", Object.assign(n.style, {
922
+ border: "0px",
923
+ clip: "rect(0 0 0 0)",
924
+ height: "1px",
925
+ margin: "-1px",
926
+ overflow: "hidden",
927
+ padding: "0px",
928
+ position: "absolute",
929
+ whiteSpace: "nowrap",
930
+ width: "1px"
931
+ }), n.addEventListener("click", t), e.prepend(n), () => {
932
+ n.removeEventListener("click", t), n.remove();
933
+ };
934
+ }
935
+ function jr(e) {
936
+ const t = W();
937
+ return z(() => {
938
+ if (!e) {
939
+ t.current = null;
940
+ return;
941
+ }
942
+ return yt("mousedown", (n) => {
943
+ t.current = n.target;
944
+ }, !0);
945
+ }, [e]), t;
946
+ }
947
+ var st = /* @__PURE__ */ new WeakMap();
948
+ function ze(e, t, r) {
949
+ st.has(e) || st.set(e, /* @__PURE__ */ new Map());
950
+ const n = st.get(e), o = n.get(t);
951
+ if (!o)
952
+ return n.set(t, r()), () => {
953
+ var u;
954
+ (u = n.get(t)) == null || u(), n.delete(t);
955
+ };
956
+ const s = r(), a = () => {
957
+ s(), o(), n.delete(t);
958
+ };
959
+ return n.set(t, a), () => {
960
+ n.get(t) === a && (s(), n.set(t, o));
961
+ };
962
+ }
963
+ function xt(e, t, r) {
964
+ return ze(e, t, () => {
965
+ const o = e.getAttribute(t);
966
+ return e.setAttribute(t, r), () => {
967
+ o == null ? e.removeAttribute(t) : e.setAttribute(t, o);
968
+ };
969
+ });
970
+ }
971
+ function Ie(e, t, r) {
972
+ return ze(e, t, () => {
973
+ const o = t in e, s = e[t];
974
+ return e[t] = r, () => {
975
+ o ? e[t] = s : delete e[t];
976
+ };
977
+ });
978
+ }
979
+ function dt(e, t) {
980
+ return e ? ze(e, "style", () => {
981
+ const n = e.style.cssText;
982
+ return Object.assign(e.style, t), () => {
983
+ e.style.cssText = n;
984
+ };
985
+ }) : () => {
986
+ };
987
+ }
988
+ function Ur(e, t, r) {
989
+ return e ? ze(e, t, () => {
990
+ const o = e.style.getPropertyValue(t);
991
+ return e.style.setProperty(t, r), () => {
992
+ o ? e.style.setProperty(t, o) : e.style.removeProperty(t);
993
+ };
994
+ }) : () => {
995
+ };
996
+ }
997
+ var Yr = ["SCRIPT", "STYLE"];
998
+ function ft(e) {
999
+ return `__ariakit-dialog-snapshot-${e}`;
1000
+ }
1001
+ function Xr(e, t) {
1002
+ const r = q(t), n = ft(e);
1003
+ if (!r.body[n]) return !0;
1004
+ do {
1005
+ if (t === r.body) return !1;
1006
+ if (t[n]) return !0;
1007
+ if (!t.parentElement) return !1;
1008
+ t = t.parentElement;
1009
+ } while (!0);
1010
+ }
1011
+ function Gr(e, t, r) {
1012
+ return Yr.includes(t.tagName) || !Xr(e, t) ? !1 : !r.some(
1013
+ (n) => n && ae(t, n)
1014
+ );
1015
+ }
1016
+ function It(e, t, r, n) {
1017
+ for (let o of t) {
1018
+ if (!(o != null && o.isConnected)) continue;
1019
+ const s = t.some((i) => !i || i === o ? !1 : i.contains(o)), a = q(o), u = o;
1020
+ for (; o.parentElement && o !== a.body; ) {
1021
+ if (n == null || n(o.parentElement, u), !s)
1022
+ for (const i of o.parentElement.children)
1023
+ Gr(e, i, t) && r(i, u);
1024
+ o = o.parentElement;
1025
+ }
1026
+ }
1027
+ }
1028
+ function Jr(e, t) {
1029
+ const { body: r } = q(t[0]), n = [];
1030
+ return It(e, t, (s) => {
1031
+ n.push(Ie(s, ft(e), !0));
1032
+ }), ge(Ie(r, ft(e), !0), () => {
1033
+ for (const s of n)
1034
+ s();
1035
+ });
1036
+ }
1037
+ function fn(e, ...t) {
1038
+ if (!e) return !1;
1039
+ const r = e.getAttribute("data-backdrop");
1040
+ return r == null ? !1 : r === "" || r === "true" || !t.length ? !0 : t.some((n) => r === n);
1041
+ }
1042
+ function Re(e = "", t = !1) {
1043
+ return `__ariakit-dialog-${t ? "ancestor" : "outside"}${e ? `-${e}` : ""}`;
1044
+ }
1045
+ function Zr(e, t = "") {
1046
+ return ge(
1047
+ Ie(e, Re(), !0),
1048
+ Ie(e, Re(t), !0)
1049
+ );
1050
+ }
1051
+ function mn(e, t = "") {
1052
+ return ge(
1053
+ Ie(e, Re("", !0), !0),
1054
+ Ie(e, Re(t, !0), !0)
1055
+ );
1056
+ }
1057
+ function Ct(e, t) {
1058
+ const r = Re(t, !0);
1059
+ if (e[r]) return !0;
1060
+ const n = Re(t);
1061
+ do {
1062
+ if (e[n]) return !0;
1063
+ if (!e.parentElement) return !1;
1064
+ e = e.parentElement;
1065
+ } while (!0);
1066
+ }
1067
+ function kt(e, t) {
1068
+ const r = [], n = t.map((s) => s == null ? void 0 : s.id);
1069
+ return It(
1070
+ e,
1071
+ t,
1072
+ (s) => {
1073
+ fn(s, ...n) || r.unshift(Zr(s, e));
1074
+ },
1075
+ (s, a) => {
1076
+ a.hasAttribute("data-dialog") && a.id !== e || r.unshift(mn(s, e));
1077
+ }
1078
+ ), () => {
1079
+ for (const s of r)
1080
+ s();
1081
+ };
1082
+ }
1083
+ function Qr(e) {
1084
+ return e.tagName === "HTML" ? !0 : ae(q(e).body, e);
1085
+ }
1086
+ function eo(e, t) {
1087
+ if (!e) return !1;
1088
+ if (ae(e, t)) return !0;
1089
+ const r = t.getAttribute("aria-activedescendant");
1090
+ if (r) {
1091
+ const n = q(e).getElementById(r);
1092
+ if (n)
1093
+ return ae(e, n);
1094
+ }
1095
+ return !1;
1096
+ }
1097
+ function to(e, t) {
1098
+ if (!("clientY" in e)) return !1;
1099
+ const r = t.getBoundingClientRect();
1100
+ 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;
1101
+ }
1102
+ function it({
1103
+ store: e,
1104
+ type: t,
1105
+ listener: r,
1106
+ capture: n,
1107
+ domReady: o
1108
+ }) {
1109
+ const s = se(r), a = de(e, "open"), u = W(!1);
1110
+ H(() => {
1111
+ if (!a || !o) return;
1112
+ const { contentElement: i } = e.getState();
1113
+ if (!i) return;
1114
+ const m = () => {
1115
+ u.current = !0;
1116
+ };
1117
+ return i.addEventListener("focusin", m, !0), () => i.removeEventListener("focusin", m, !0);
1118
+ }, [e, a, o]), z(() => a ? yt(t, (m) => {
1119
+ const { contentElement: f, disclosureElement: C } = e.getState(), c = m.target;
1120
+ !f || !c || !Qr(c) || ae(f, c) || eo(C, c) || c.hasAttribute("data-focus-trap") || to(m, f) || u.current && !Ct(c, f.id) || Qn(c) || s(m);
1121
+ }, n) : void 0, [a, n]);
1122
+ }
1123
+ function ut(e, t) {
1124
+ return typeof e == "function" ? e(t) : !!e;
1125
+ }
1126
+ function no(e, t, r) {
1127
+ const n = de(e, "open"), o = jr(n), s = { store: e, domReady: r, capture: !0 };
1128
+ it($(x({}, s), {
1129
+ type: "click",
1130
+ listener: (a) => {
1131
+ const { contentElement: u } = e.getState(), i = o.current;
1132
+ i && On(i) && Ct(i, u == null ? void 0 : u.id) && ut(t, a) && e.hide();
1133
+ }
1134
+ })), it($(x({}, s), {
1135
+ type: "focusin",
1136
+ listener: (a) => {
1137
+ const { contentElement: u } = e.getState();
1138
+ u && a.target !== q(u) && ut(t, a) && e.hide();
1139
+ }
1140
+ })), it($(x({}, s), {
1141
+ type: "contextmenu",
1142
+ listener: (a) => {
1143
+ ut(t, a) && e.hide();
1144
+ }
1145
+ }));
1146
+ }
1147
+ var Lt = Ne({});
1148
+ function ro(e) {
1149
+ const t = Pt(Lt), [r, n] = ie([]), o = He(
1150
+ (u) => {
1151
+ var i;
1152
+ return n((m) => [...m, u]), ge((i = t.add) == null ? void 0 : i.call(t, u), () => {
1153
+ n((m) => m.filter((f) => f !== u));
1154
+ });
1155
+ },
1156
+ [t]
1157
+ );
1158
+ H(() => Ze(e, ["open", "contentElement"], (u) => {
1159
+ var i;
1160
+ if (u.open && u.contentElement)
1161
+ return (i = t.add) == null ? void 0 : i.call(t, e);
1162
+ }), [e, t]);
1163
+ const s = Qt(() => ({ store: e, add: o }), [e, o]);
1164
+ return { wrapElement: He(
1165
+ (u) => /* @__PURE__ */ R(Lt.Provider, { value: s, children: u }),
1166
+ [s]
1167
+ ), nestedDialogs: r };
1168
+ }
1169
+ function oo({
1170
+ attribute: e,
1171
+ contentId: t,
1172
+ contentElement: r,
1173
+ enabled: n
1174
+ }) {
1175
+ const [o, s] = Tn(), a = He(() => {
1176
+ if (!n || !r) return !1;
1177
+ const { body: u } = q(r), i = u.getAttribute(e);
1178
+ return !i || i === t;
1179
+ }, [o, n, r, e, t]);
1180
+ return z(() => {
1181
+ if (!n || !t || !r) return;
1182
+ const { body: u } = q(r);
1183
+ if (a())
1184
+ return u.setAttribute(e, t), () => u.removeAttribute(e);
1185
+ const i = new MutationObserver(() => Qe.flushSync(s));
1186
+ return i.observe(u, { attributeFilter: [e] }), () => i.disconnect();
1187
+ }, [o, n, t, r, a, e]), a;
1188
+ }
1189
+ function so(e) {
1190
+ const t = e.getBoundingClientRect().left;
1191
+ return Math.round(t) + e.scrollLeft ? "paddingLeft" : "paddingRight";
1192
+ }
1193
+ function io(e, t, r) {
1194
+ const n = oo({
1195
+ attribute: "data-dialog-prevent-body-scroll",
1196
+ contentElement: e,
1197
+ contentId: t,
1198
+ enabled: r
1199
+ });
1200
+ z(() => {
1201
+ if (!n() || !e) return;
1202
+ const o = q(e), s = Ut(e), { documentElement: a, body: u } = o, i = a.style.getPropertyValue("--scrollbar-width"), m = i ? Number.parseInt(i) : s.innerWidth - a.clientWidth, f = () => Ur(
1203
+ a,
1204
+ "--scrollbar-width",
1205
+ `${m}px`
1206
+ ), C = so(a), c = () => dt(u, {
1207
+ overflow: "hidden",
1208
+ [C]: `${m}px`
1209
+ }), g = () => {
1210
+ var S, T;
1211
+ const { scrollX: w, scrollY: b, visualViewport: I } = s, d = (S = I == null ? void 0 : I.offsetLeft) != null ? S : 0, p = (T = I == null ? void 0 : I.offsetTop) != null ? T : 0, P = dt(u, {
1212
+ position: "fixed",
1213
+ overflow: "hidden",
1214
+ top: `${-(b - Math.floor(p))}px`,
1215
+ left: `${-(w - Math.floor(d))}px`,
1216
+ right: "0",
1217
+ [C]: `${m}px`
1218
+ });
1219
+ return () => {
1220
+ P(), process.env.NODE_ENV !== "test" && s.scrollTo({ left: w, top: b, behavior: "instant" });
1221
+ };
1222
+ }, h = _n() && !Rn();
1223
+ return ge(
1224
+ f(),
1225
+ h ? g() : c()
1226
+ );
1227
+ }, [n, e]);
1228
+ }
1229
+ function uo(e, ...t) {
1230
+ if (!e) return !1;
1231
+ const r = e.getAttribute("data-focus-trap");
1232
+ return r == null ? !1 : t.length ? r === "" ? !1 : t.some((n) => r === n) : !0;
1233
+ }
1234
+ function pn() {
1235
+ return "inert" in HTMLElement.prototype;
1236
+ }
1237
+ function ao(e) {
1238
+ return xt(e, "aria-hidden", "true");
1239
+ }
1240
+ function vn(e, t) {
1241
+ if (!("style" in e)) return nt;
1242
+ if (pn())
1243
+ return Ie(e, "inert", !0);
1244
+ const n = er(e, !0).map((o) => {
1245
+ if (t != null && t.some((a) => a && ae(a, o))) return nt;
1246
+ const s = ze(o, "focus", () => (o.focus = nt, () => {
1247
+ delete o.focus;
1248
+ }));
1249
+ return ge(xt(o, "tabindex", "-1"), s);
1250
+ });
1251
+ return ge(
1252
+ ...n,
1253
+ ao(e),
1254
+ dt(e, {
1255
+ pointerEvents: "none",
1256
+ userSelect: "none",
1257
+ cursor: "default"
1258
+ })
1259
+ );
1260
+ }
1261
+ function co(e, t) {
1262
+ const r = [], n = t.map((s) => s == null ? void 0 : s.id);
1263
+ return It(
1264
+ e,
1265
+ t,
1266
+ (s) => {
1267
+ fn(s, ...n) || uo(s, ...n) || r.unshift(vn(s, t));
1268
+ },
1269
+ (s) => {
1270
+ s.hasAttribute("role") && (t.some((a) => a && ae(a, s)) || r.unshift(xt(s, "role", "none")));
1271
+ }
1272
+ ), () => {
1273
+ for (const s of r)
1274
+ s();
1275
+ };
1276
+ }
1277
+ var lo = "div", fo = [
1278
+ "a",
1279
+ "button",
1280
+ "details",
1281
+ "dialog",
1282
+ "div",
1283
+ "form",
1284
+ "h1",
1285
+ "h2",
1286
+ "h3",
1287
+ "h4",
1288
+ "h5",
1289
+ "h6",
1290
+ "header",
1291
+ "img",
1292
+ "input",
1293
+ "label",
1294
+ "li",
1295
+ "nav",
1296
+ "ol",
1297
+ "p",
1298
+ "section",
1299
+ "select",
1300
+ "span",
1301
+ "summary",
1302
+ "textarea",
1303
+ "ul",
1304
+ "svg"
1305
+ ];
1306
+ Z(
1307
+ function(t) {
1308
+ return t;
1309
+ }
1310
+ );
1311
+ var mt = K(
1312
+ // @ts-expect-error
1313
+ function(t) {
1314
+ return Y(lo, t);
1315
+ }
1316
+ );
1317
+ Object.assign(
1318
+ mt,
1319
+ fo.reduce((e, t) => (e[t] = K(function(n) {
1320
+ return Y(t, n);
1321
+ }), e), {})
1322
+ );
1323
+ function mo({
1324
+ store: e,
1325
+ backdrop: t,
1326
+ alwaysVisible: r,
1327
+ hidden: n
1328
+ }) {
1329
+ const o = W(null), s = Nr({ disclosure: e }), a = de(e, "contentElement");
1330
+ z(() => {
1331
+ const m = o.current, f = a;
1332
+ m && f && (m.style.zIndex = getComputedStyle(f).zIndex);
1333
+ }, [a]), H(() => {
1334
+ const m = a == null ? void 0 : a.id;
1335
+ if (!m) return;
1336
+ const f = o.current;
1337
+ if (f)
1338
+ return mn(f, m);
1339
+ }, [a]);
1340
+ const u = wt({
1341
+ ref: o,
1342
+ store: s,
1343
+ role: "presentation",
1344
+ "data-backdrop": (a == null ? void 0 : a.id) || "",
1345
+ alwaysVisible: r,
1346
+ hidden: n ?? void 0,
1347
+ style: {
1348
+ position: "fixed",
1349
+ top: 0,
1350
+ right: 0,
1351
+ bottom: 0,
1352
+ left: 0
1353
+ }
1354
+ });
1355
+ if (!t) return null;
1356
+ if (sr(t))
1357
+ return /* @__PURE__ */ R(mt, $(x({}, u), { render: t }));
1358
+ const i = typeof t != "boolean" ? t : "div";
1359
+ return /* @__PURE__ */ R(mt, $(x({}, u), { render: /* @__PURE__ */ R(i, {}) }));
1360
+ }
1361
+ var po = "div", Vt = kn();
1362
+ function vo(e) {
1363
+ const t = ht();
1364
+ return !t || e && ae(e, t) ? !1 : !!Ve(t);
1365
+ }
1366
+ function Bt(e, t = !1) {
1367
+ if (!e) return null;
1368
+ const r = "current" in e ? e.current : e;
1369
+ return r ? t ? Ve(r) ? r : null : r : null;
1370
+ }
1371
+ var gn = Z(function(t) {
1372
+ var r = t, {
1373
+ store: n,
1374
+ open: o,
1375
+ onClose: s,
1376
+ focusable: a = !0,
1377
+ modal: u = !0,
1378
+ portal: i = !!u,
1379
+ backdrop: m = !!u,
1380
+ hideOnEscape: f = !0,
1381
+ hideOnInteractOutside: C = !0,
1382
+ getPersistentElements: c,
1383
+ preventBodyScroll: g = !!u,
1384
+ autoFocusOnShow: h = !0,
1385
+ autoFocusOnHide: S = !0,
1386
+ initialFocus: T,
1387
+ finalFocus: w,
1388
+ unmountOnHide: b,
1389
+ unstable_treeSnapshotKey: I
1390
+ } = r, d = ne(r, [
1391
+ "store",
1392
+ "open",
1393
+ "onClose",
1394
+ "focusable",
1395
+ "modal",
1396
+ "portal",
1397
+ "backdrop",
1398
+ "hideOnEscape",
1399
+ "hideOnInteractOutside",
1400
+ "getPersistentElements",
1401
+ "preventBodyScroll",
1402
+ "autoFocusOnShow",
1403
+ "autoFocusOnHide",
1404
+ "initialFocus",
1405
+ "finalFocus",
1406
+ "unmountOnHide",
1407
+ "unstable_treeSnapshotKey"
1408
+ ]);
1409
+ const p = et(), P = W(null), E = $r({
1410
+ store: n || p,
1411
+ open: o,
1412
+ setOpen(v) {
1413
+ if (v) return;
1414
+ const F = P.current;
1415
+ if (!F) return;
1416
+ const U = new Event("close", { bubbles: !1, cancelable: !0 });
1417
+ s && F.addEventListener("close", s, { once: !0 }), F.dispatchEvent(U), U.defaultPrevented && E.setOpen(!0);
1418
+ }
1419
+ }), { portalRef: X, domReady: D } = Yt(i, d.portalRef), N = d.preserveTabOrder, G = de(
1420
+ E,
1421
+ (v) => N && !u && v.mounted
1422
+ ), B = vt(d.id), l = de(E, "open"), y = de(E, "mounted"), A = de(E, "contentElement"), M = rn(y, d.hidden, d.alwaysVisible);
1423
+ io(A, B, g && !M), no(E, C, D);
1424
+ const { wrapElement: k, nestedDialogs: j } = ro(E);
1425
+ d = ue(d, k, [k]), H(() => {
1426
+ if (!l) return;
1427
+ const v = P.current, F = ht(v, !0);
1428
+ F && F.tagName !== "BODY" && (v && ae(v, F) || E.setDisclosureElement(F));
1429
+ }, [E, l]), Vt && z(() => {
1430
+ if (!y) return;
1431
+ const { disclosureElement: v } = E.getState();
1432
+ if (!v || !ct(v)) return;
1433
+ const F = () => {
1434
+ let U = !1;
1435
+ const O = () => {
1436
+ U = !0;
1437
+ }, ee = { capture: !0, once: !0 };
1438
+ v.addEventListener("focusin", O, ee), Mn(v, "mouseup", () => {
1439
+ v.removeEventListener("focusin", O, !0), !U && nr(v);
1440
+ });
1441
+ };
1442
+ return v.addEventListener("mousedown", F), () => {
1443
+ v.removeEventListener("mousedown", F);
1444
+ };
1445
+ }, [E, y]), z(() => {
1446
+ if (!y || !D) return;
1447
+ const v = P.current;
1448
+ if (!v) return;
1449
+ const F = Ut(v), U = F.visualViewport || F, O = () => {
1450
+ var ee, le;
1451
+ const Me = (le = (ee = F.visualViewport) == null ? void 0 : ee.height) != null ? le : F.innerHeight;
1452
+ v.style.setProperty("--dialog-viewport-height", `${Me}px`);
1453
+ };
1454
+ return O(), U.addEventListener("resize", O), () => {
1455
+ U.removeEventListener("resize", O);
1456
+ };
1457
+ }, [y, D]), z(() => {
1458
+ if (!u || !y || !D) return;
1459
+ const v = P.current;
1460
+ if (!(!v || v.querySelector("[data-dialog-dismiss]")))
1461
+ return qr(v, E.hide);
1462
+ }, [E, u, y, D]), H(() => {
1463
+ if (!pn() || l || !y || !D) return;
1464
+ const v = P.current;
1465
+ if (v)
1466
+ return vn(v);
1467
+ }, [l, y, D]);
1468
+ const _ = l && D;
1469
+ H(() => {
1470
+ if (!B || !_) return;
1471
+ const v = P.current;
1472
+ return Jr(B, [v]);
1473
+ }, [B, _, I]);
1474
+ const V = se(c);
1475
+ H(() => {
1476
+ if (!B || !_) return;
1477
+ const { disclosureElement: v } = E.getState(), F = P.current, U = V() || [], O = [
1478
+ F,
1479
+ ...U,
1480
+ ...j.map((ee) => ee.getState().contentElement)
1481
+ ];
1482
+ return u ? ge(
1483
+ kt(B, O),
1484
+ co(B, O)
1485
+ ) : kt(B, [v, ...O]);
1486
+ }, [
1487
+ B,
1488
+ E,
1489
+ _,
1490
+ V,
1491
+ j,
1492
+ u,
1493
+ I
1494
+ ]);
1495
+ const J = !!h, De = Le(h), [$e, re] = ie(!1);
1496
+ z(() => {
1497
+ if (!l || !J || !D || !(A != null && A.isConnected)) return;
1498
+ const v = Bt(T, !0) || // If no initial focus is specified, we try to focus the first element
1499
+ // with the autofocus attribute. If it's an Ariakit component, the
1500
+ // Focusable component will consume the autoFocus prop and add the
1501
+ // data-autofocus attribute to the element instead.
1502
+ A.querySelector(
1503
+ "[data-autofocus=true],[autofocus]"
1504
+ ) || // We have to fallback to the first focusable element otherwise portaled
1505
+ // dialogs with preserveTabOrder set to true will not receive focus
1506
+ // properly because the elements aren't tabbable until the dialog receives
1507
+ // focus.
1508
+ tr(A, !0, i && G) || // Finally, we fallback to the dialog element itself.
1509
+ A, F = Ve(v);
1510
+ De(F ? v : null) && (re(!0), queueMicrotask(() => {
1511
+ v.focus(), Vt && F && v.scrollIntoView({ block: "nearest", inline: "nearest" });
1512
+ }));
1513
+ }, [
1514
+ l,
1515
+ J,
1516
+ D,
1517
+ A,
1518
+ T,
1519
+ i,
1520
+ G,
1521
+ De
1522
+ ]);
1523
+ const Q = !!S, fe = Le(S), [Fe, me] = ie(!1);
1524
+ z(() => {
1525
+ if (l)
1526
+ return me(!0), () => me(!1);
1527
+ }, [l]);
1528
+ const ye = He(
1529
+ (v, F = !0) => {
1530
+ const { disclosureElement: U } = E.getState();
1531
+ if (vo(v)) return;
1532
+ let O = Bt(w) || U;
1533
+ if (O != null && O.id) {
1534
+ const le = q(O), Me = `[aria-activedescendant="${O.id}"]`, Ue = le.querySelector(Me);
1535
+ Ue && (O = Ue);
1536
+ }
1537
+ if (O && !Ve(O)) {
1538
+ const le = O.closest("[data-dialog]");
1539
+ if (le != null && le.id) {
1540
+ const Me = q(le), Ue = `[aria-controls~="${le.id}"]`, Dt = Me.querySelector(Ue);
1541
+ Dt && (O = Dt);
1542
+ }
1543
+ }
1544
+ const ee = O && Ve(O);
1545
+ if (!ee && F) {
1546
+ requestAnimationFrame(() => ye(v, !1));
1547
+ return;
1548
+ }
1549
+ fe(ee ? O : null) && ee && (O == null || O.focus({ preventScroll: !0 }));
1550
+ },
1551
+ [E, w, fe]
1552
+ ), ce = W(!1);
1553
+ H(() => {
1554
+ if (l || !Fe || !Q) return;
1555
+ const v = P.current;
1556
+ ce.current = !0, ye(v);
1557
+ }, [l, Fe, D, Q, ye]), z(() => {
1558
+ if (!Fe || !Q) return;
1559
+ const v = P.current;
1560
+ return () => {
1561
+ if (ce.current) {
1562
+ ce.current = !1;
1563
+ return;
1564
+ }
1565
+ ye(v);
1566
+ };
1567
+ }, [Fe, Q, ye]);
1568
+ const We = Le(f);
1569
+ z(() => !D || !y ? void 0 : yt("keydown", (F) => {
1570
+ if (F.key !== "Escape" || F.defaultPrevented) return;
1571
+ const U = P.current;
1572
+ if (!U || Ct(U)) return;
1573
+ const O = F.target;
1574
+ if (!O) return;
1575
+ const { disclosureElement: ee } = E.getState();
1576
+ !!(O.tagName === "BODY" || ae(U, O) || !ee || ae(ee, O)) && We(F) && E.hide();
1577
+ }, !0), [E, D, y, We]), d = ue(
1578
+ d,
1579
+ (v) => /* @__PURE__ */ R(zr, { level: u ? 1 : void 0, children: v }),
1580
+ [u]
1581
+ );
1582
+ const qe = d.hidden, Se = d.alwaysVisible;
1583
+ d = ue(
1584
+ d,
1585
+ (v) => m ? /* @__PURE__ */ Xe(Ge, { children: [
1586
+ /* @__PURE__ */ R(
1587
+ mo,
1588
+ {
1589
+ store: E,
1590
+ backdrop: m,
1591
+ hidden: qe,
1592
+ alwaysVisible: Se
1593
+ }
1594
+ ),
1595
+ v
1596
+ ] }) : v,
1597
+ [E, m, qe, Se]
1598
+ );
1599
+ const [Ae, je] = ie(), [Oe, Te] = ie();
1600
+ return d = ue(
1601
+ d,
1602
+ (v) => /* @__PURE__ */ R(qt, { value: E, children: /* @__PURE__ */ R(Nn.Provider, { value: je, children: /* @__PURE__ */ R($n.Provider, { value: Te, children: v }) }) }),
1603
+ [E]
1604
+ ), d = $(x({
1605
+ id: B,
1606
+ "data-dialog": "",
1607
+ role: "dialog",
1608
+ tabIndex: a ? -1 : void 0,
1609
+ "aria-labelledby": Ae,
1610
+ "aria-describedby": Oe
1611
+ }, d), {
1612
+ ref: Ce(P, d.ref)
1613
+ }), d = dn($(x({}, d), {
1614
+ autoFocusOnShow: $e
1615
+ })), d = wt(x({ store: E }, d)), d = Xt($(x({}, d), { focusable: a })), d = ln($(x({ portal: i }, d), { portalRef: X, preserveTabOrder: G })), d;
1616
+ });
1617
+ function hn(e, t = et) {
1618
+ return K(function(n) {
1619
+ const o = t(), s = n.store || o;
1620
+ return de(
1621
+ s,
1622
+ (u) => !n.unmountOnHide || (u == null ? void 0 : u.mounted) || !!n.open
1623
+ ) ? /* @__PURE__ */ R(e, x({}, n)) : null;
1624
+ });
1625
+ }
1626
+ hn(
1627
+ K(function(t) {
1628
+ const r = gn(t);
1629
+ return Y(po, r);
1630
+ }),
1631
+ et
1632
+ );
1633
+ var go = "div";
1634
+ function Ht(e = 0, t = 0, r = 0, n = 0) {
1635
+ if (typeof DOMRect == "function")
1636
+ return new DOMRect(e, t, r, n);
1637
+ const o = {
1638
+ x: e,
1639
+ y: t,
1640
+ width: r,
1641
+ height: n,
1642
+ top: t,
1643
+ right: e + r,
1644
+ bottom: t + n,
1645
+ left: e
1646
+ };
1647
+ return $(x({}, o), { toJSON: () => o });
1648
+ }
1649
+ function ho(e) {
1650
+ if (!e) return Ht();
1651
+ const { x: t, y: r, width: n, height: o } = e;
1652
+ return Ht(t, r, n, o);
1653
+ }
1654
+ function bo(e, t) {
1655
+ return {
1656
+ contextElement: e || void 0,
1657
+ getBoundingClientRect: () => {
1658
+ const n = e, o = t == null ? void 0 : t(n);
1659
+ return o || !n ? ho(o) : n.getBoundingClientRect();
1660
+ }
1661
+ };
1662
+ }
1663
+ function Eo(e) {
1664
+ return /^(?:top|bottom|left|right)(?:-(?:start|end))?$/.test(e);
1665
+ }
1666
+ function Kt(e) {
1667
+ const t = window.devicePixelRatio || 1;
1668
+ return Math.round(e * t) / t;
1669
+ }
1670
+ function yo(e, t) {
1671
+ return ar(({ placement: r }) => {
1672
+ var n;
1673
+ const o = ((e == null ? void 0 : e.clientHeight) || 0) / 2, s = typeof t.gutter == "number" ? t.gutter + o : (n = t.gutter) != null ? n : o;
1674
+ return {
1675
+ crossAxis: !!r.split("-")[1] ? void 0 : t.shift,
1676
+ mainAxis: s,
1677
+ alignmentAxis: t.shift
1678
+ };
1679
+ });
1680
+ }
1681
+ function So(e) {
1682
+ if (e.flip === !1) return;
1683
+ const t = typeof e.flip == "string" ? e.flip.split(" ") : void 0;
1684
+ return Ee(
1685
+ !t || t.every(Eo),
1686
+ process.env.NODE_ENV !== "production" && "`flip` expects a spaced-delimited list of placements"
1687
+ ), cr({
1688
+ padding: e.overflowPadding,
1689
+ fallbackPlacements: t
1690
+ });
1691
+ }
1692
+ function Po(e) {
1693
+ if (!(!e.slide && !e.overlap))
1694
+ return lr({
1695
+ mainAxis: e.slide,
1696
+ crossAxis: e.overlap,
1697
+ padding: e.overflowPadding,
1698
+ limiter: mr()
1699
+ });
1700
+ }
1701
+ function wo(e) {
1702
+ return fr({
1703
+ padding: e.overflowPadding,
1704
+ apply({ elements: t, availableWidth: r, availableHeight: n, rects: o }) {
1705
+ const s = t.floating, a = Math.round(o.reference.width);
1706
+ r = Math.floor(r), n = Math.floor(n), s.style.setProperty(
1707
+ "--popover-anchor-width",
1708
+ `${a}px`
1709
+ ), s.style.setProperty(
1710
+ "--popover-available-width",
1711
+ `${r}px`
1712
+ ), s.style.setProperty(
1713
+ "--popover-available-height",
1714
+ `${n}px`
1715
+ ), e.sameWidth && (s.style.width = `${a}px`), e.fitViewport && (s.style.maxWidth = `${r}px`, s.style.maxHeight = `${n}px`);
1716
+ }
1717
+ });
1718
+ }
1719
+ function xo(e, t) {
1720
+ if (e)
1721
+ return dr({
1722
+ element: e,
1723
+ padding: t.arrowPadding
1724
+ });
1725
+ }
1726
+ var Io = Z(
1727
+ function(t) {
1728
+ var r = t, {
1729
+ store: n,
1730
+ modal: o = !1,
1731
+ portal: s = !!o,
1732
+ preserveTabOrder: a = !0,
1733
+ autoFocusOnShow: u = !0,
1734
+ wrapperProps: i,
1735
+ fixed: m = !1,
1736
+ flip: f = !0,
1737
+ shift: C = 0,
1738
+ slide: c = !0,
1739
+ overlap: g = !1,
1740
+ sameWidth: h = !1,
1741
+ fitViewport: S = !1,
1742
+ gutter: T,
1743
+ arrowPadding: w = 4,
1744
+ overflowPadding: b = 8,
1745
+ getAnchorRect: I,
1746
+ updatePosition: d
1747
+ } = r, p = ne(r, [
1748
+ "store",
1749
+ "modal",
1750
+ "portal",
1751
+ "preserveTabOrder",
1752
+ "autoFocusOnShow",
1753
+ "wrapperProps",
1754
+ "fixed",
1755
+ "flip",
1756
+ "shift",
1757
+ "slide",
1758
+ "overlap",
1759
+ "sameWidth",
1760
+ "fitViewport",
1761
+ "gutter",
1762
+ "arrowPadding",
1763
+ "overflowPadding",
1764
+ "getAnchorRect",
1765
+ "updatePosition"
1766
+ ]);
1767
+ const P = tt();
1768
+ n = n || P, Ee(
1769
+ n,
1770
+ process.env.NODE_ENV !== "production" && "Popover must receive a `store` prop or be wrapped in a PopoverProvider component."
1771
+ );
1772
+ const E = n.useState("arrowElement"), X = n.useState("anchorElement"), D = n.useState("disclosureElement"), N = n.useState("popoverElement"), G = n.useState("contentElement"), B = n.useState("placement"), l = n.useState("mounted"), y = n.useState("rendered"), A = W(null), [M, k] = ie(!1), { portalRef: j, domReady: _ } = Yt(s, p.portalRef), V = se(I), J = se(d), De = !!d;
1773
+ H(() => {
1774
+ if (!(N != null && N.isConnected)) return;
1775
+ N.style.setProperty(
1776
+ "--popover-overflow-padding",
1777
+ `${b}px`
1778
+ );
1779
+ const re = bo(X, V), Q = async () => {
1780
+ if (!l) return;
1781
+ E || (A.current = A.current || document.createElement("div"));
1782
+ const me = E || A.current, ye = [
1783
+ yo(me, { gutter: T, shift: C }),
1784
+ So({ flip: f, overflowPadding: b }),
1785
+ Po({ slide: c, overlap: g, overflowPadding: b }),
1786
+ xo(me, { arrowPadding: w }),
1787
+ wo({
1788
+ sameWidth: h,
1789
+ fitViewport: S,
1790
+ overflowPadding: b
1791
+ })
1792
+ ], ce = await ur(re, N, {
1793
+ placement: B,
1794
+ strategy: m ? "fixed" : "absolute",
1795
+ middleware: ye
1796
+ });
1797
+ n == null || n.setState("currentPlacement", ce.placement), k(!0);
1798
+ const We = Kt(ce.x), qe = Kt(ce.y);
1799
+ if (Object.assign(N.style, {
1800
+ top: "0",
1801
+ left: "0",
1802
+ transform: `translate3d(${We}px,${qe}px,0)`
1803
+ }), me && ce.middlewareData.arrow) {
1804
+ const { x: Se, y: Ae } = ce.middlewareData.arrow, je = ce.placement.split("-")[0], Oe = me.clientWidth / 2, Te = me.clientHeight / 2, v = Se != null ? Se + Oe : -Oe, F = Ae != null ? Ae + Te : -Te;
1805
+ N.style.setProperty(
1806
+ "--popover-transform-origin",
1807
+ {
1808
+ top: `${v}px calc(100% + ${Te}px)`,
1809
+ bottom: `${v}px ${-Te}px`,
1810
+ left: `calc(100% + ${Oe}px) ${F}px`,
1811
+ right: `${-Oe}px ${F}px`
1812
+ }[je]
1813
+ ), Object.assign(me.style, {
1814
+ left: Se != null ? `${Se}px` : "",
1815
+ top: Ae != null ? `${Ae}px` : "",
1816
+ [je]: "100%"
1817
+ });
1818
+ }
1819
+ }, Fe = ir(re, N, async () => {
1820
+ De ? (await J({ updatePosition: Q }), k(!0)) : await Q();
1821
+ }, {
1822
+ // JSDOM doesn't support ResizeObserver
1823
+ elementResize: typeof ResizeObserver == "function"
1824
+ });
1825
+ return () => {
1826
+ k(!1), Fe();
1827
+ };
1828
+ }, [
1829
+ n,
1830
+ y,
1831
+ N,
1832
+ E,
1833
+ X,
1834
+ N,
1835
+ B,
1836
+ l,
1837
+ _,
1838
+ m,
1839
+ f,
1840
+ C,
1841
+ c,
1842
+ g,
1843
+ h,
1844
+ S,
1845
+ T,
1846
+ w,
1847
+ b,
1848
+ V,
1849
+ De,
1850
+ J
1851
+ ]), H(() => {
1852
+ if (!l || !_ || !(N != null && N.isConnected) || !(G != null && G.isConnected)) return;
1853
+ const re = () => {
1854
+ N.style.zIndex = getComputedStyle(G).zIndex;
1855
+ };
1856
+ re();
1857
+ let Q = requestAnimationFrame(() => {
1858
+ Q = requestAnimationFrame(re);
1859
+ });
1860
+ return () => cancelAnimationFrame(Q);
1861
+ }, [l, _, N, G]);
1862
+ const $e = m ? "fixed" : "absolute";
1863
+ return p = ue(
1864
+ p,
1865
+ (re) => /* @__PURE__ */ R(
1866
+ "div",
1867
+ $(x({}, i), {
1868
+ style: x({
1869
+ // https://floating-ui.com/docs/computeposition#initial-layout
1870
+ position: $e,
1871
+ top: 0,
1872
+ left: 0,
1873
+ width: "max-content"
1874
+ }, i == null ? void 0 : i.style),
1875
+ ref: n == null ? void 0 : n.setPopoverElement,
1876
+ children: re
1877
+ })
1878
+ ),
1879
+ [n, $e, i]
1880
+ ), p = ue(
1881
+ p,
1882
+ (re) => /* @__PURE__ */ R(gt, { value: n, children: re }),
1883
+ [n]
1884
+ ), p = $(x({
1885
+ // data-placing is not part of the public API. We're setting this here so
1886
+ // we can wait for the popover to be positioned before other components
1887
+ // move focus into it. For example, this attribute is observed by the
1888
+ // Combobox component with the autoSelect behavior.
1889
+ "data-placing": !M || void 0
1890
+ }, p), {
1891
+ style: x({
1892
+ position: "relative"
1893
+ }, p.style)
1894
+ }), p = gn($(x({
1895
+ store: n,
1896
+ modal: o,
1897
+ portal: s,
1898
+ preserveTabOrder: a,
1899
+ preserveTabOrderAnchor: D || X,
1900
+ autoFocusOnShow: M && u
1901
+ }, p), {
1902
+ portalRef: j
1903
+ })), p;
1904
+ }
1905
+ );
1906
+ hn(
1907
+ K(function(t) {
1908
+ const r = Io(t);
1909
+ return Y(go, r);
1910
+ }),
1911
+ tt
1912
+ );
1913
+ var Co = "div", bn = Z(
1914
+ function(t) {
1915
+ var r = t, { store: n } = r, o = ne(r, ["store"]);
1916
+ const s = tt();
1917
+ return n = n || s, o = $(x({}, o), {
1918
+ ref: Ce(n == null ? void 0 : n.setAnchorElement, o.ref)
1919
+ }), o;
1920
+ }
1921
+ );
1922
+ K(function(t) {
1923
+ const r = bn(t);
1924
+ return Y(Co, r);
1925
+ });
1926
+ var En = "button", yn = Z(
1927
+ function(t) {
1928
+ const r = W(null), n = Ln(r, En), [o, s] = ie(
1929
+ () => !!n && ct({ tagName: n, type: t.type })
1930
+ );
1931
+ return z(() => {
1932
+ r.current && s(ct(r.current));
1933
+ }, []), t = $(x({
1934
+ role: !o && n !== "a" ? "button" : void 0
1935
+ }, t), {
1936
+ ref: Ce(r, t.ref)
1937
+ }), t = rr(t), t;
1938
+ }
1939
+ );
1940
+ K(function(t) {
1941
+ const r = yn(t);
1942
+ return Y(En, r);
1943
+ });
1944
+ var Do = "button", Fo = Symbol("disclosure"), Sn = Z(
1945
+ function(t) {
1946
+ var r = t, { store: n, toggleOnClick: o = !0 } = r, s = ne(r, ["store", "toggleOnClick"]);
1947
+ const a = Et();
1948
+ n = n || a, Ee(
1949
+ n,
1950
+ process.env.NODE_ENV !== "production" && "Disclosure must receive a `store` prop or be wrapped in a DisclosureProvider component."
1951
+ );
1952
+ const u = W(null), [i, m] = ie(!1), f = n.useState("disclosureElement"), C = n.useState("open");
1953
+ z(() => {
1954
+ let b = f === u.current;
1955
+ f != null && f.isConnected || (n == null || n.setDisclosureElement(u.current), b = !0), m(C && b);
1956
+ }, [f, n, C]);
1957
+ const c = s.onClick, g = Le(o), [h, S] = Vn(s, Fo, !0), T = se((b) => {
1958
+ c == null || c(b), !b.defaultPrevented && (h || g(b) && (n == null || n.setDisclosureElement(b.currentTarget), n == null || n.toggle()));
1959
+ }), w = n.useState("contentElement");
1960
+ return s = $(x(x({
1961
+ "aria-expanded": i,
1962
+ "aria-controls": w == null ? void 0 : w.id
1963
+ }, S), s), {
1964
+ ref: Ce(u, s.ref),
1965
+ onClick: T
1966
+ }), s = yn(s), s;
1967
+ }
1968
+ );
1969
+ K(function(t) {
1970
+ const r = Sn(t);
1971
+ return Y(Do, r);
1972
+ });
1973
+ var Ao = "button", Pn = Z(
1974
+ function(t) {
1975
+ var r = t, { store: n } = r, o = ne(r, ["store"]);
1976
+ const s = et();
1977
+ n = n || s, Ee(
1978
+ n,
1979
+ process.env.NODE_ENV !== "production" && "DialogDisclosure must receive a `store` prop or be wrapped in a DialogProvider component."
1980
+ );
1981
+ const a = n.useState("contentElement");
1982
+ return o = x({
1983
+ "aria-haspopup": Bn(a, "dialog")
1984
+ }, o), o = Sn(x({ store: n }, o)), o;
1985
+ }
1986
+ );
1987
+ K(function(t) {
1988
+ const r = Pn(t);
1989
+ return Y(Ao, r);
1990
+ });
1991
+ var Oo = "button", To = Z(function(t) {
1992
+ var r = t, { store: n } = r, o = ne(r, ["store"]);
1993
+ const s = tt();
1994
+ n = n || s, Ee(
1995
+ n,
1996
+ process.env.NODE_ENV !== "production" && "PopoverDisclosure must receive a `store` prop or be wrapped in a PopoverProvider component."
1997
+ );
1998
+ const a = o.onClick, u = se((i) => {
1999
+ n == null || n.setAnchorElement(i.currentTarget), a == null || a(i);
2000
+ });
2001
+ return o = ue(
2002
+ o,
2003
+ (i) => /* @__PURE__ */ R(gt, { value: n, children: i }),
2004
+ [n]
2005
+ ), o = $(x({}, o), {
2006
+ onClick: u
2007
+ }), o = bn(x({ store: n }, o)), o = Pn(x({ store: n }, o)), o;
2008
+ });
2009
+ K(function(t) {
2010
+ const r = To(t);
2011
+ return Y(Oo, r);
2012
+ });
2013
+ var _o = "div", ve = "";
2014
+ function at() {
2015
+ ve = "";
2016
+ }
2017
+ function Ro(e) {
2018
+ const t = e.target;
2019
+ return t && bt(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);
2020
+ }
2021
+ function No(e, t) {
2022
+ if (Pe(e)) return !0;
2023
+ const r = e.target;
2024
+ return r ? t.some((o) => o.element === r) : !1;
2025
+ }
2026
+ function $o(e) {
2027
+ return e.filter((t) => !t.disabled);
2028
+ }
2029
+ function Je(e, t) {
2030
+ var r;
2031
+ const n = ((r = e.element) == null ? void 0 : r.textContent) || e.children || // The composite item object itself doesn't include a value property, but
2032
+ // other components like Select do. Since CompositeTypeahead is a generic
2033
+ // component that can be used with those as well, we also consider the value
2034
+ // property as a fallback for the typeahead text content.
2035
+ "value" in e && e.value;
2036
+ return n ? Kn(n).trim().toLowerCase().startsWith(t.toLowerCase()) : !1;
2037
+ }
2038
+ function Mo(e, t, r) {
2039
+ if (!r) return e;
2040
+ const n = e.find((o) => o.id === r);
2041
+ return !n || !Je(n, t) || ve !== t && Je(n, ve) ? e : (ve = t, or(
2042
+ e.filter((o) => Je(o, ve)),
2043
+ r
2044
+ ).filter((o) => o.id !== r));
2045
+ }
2046
+ var ko = Z(function(t) {
2047
+ var r = t, { store: n, typeahead: o = !0 } = r, s = ne(r, ["store", "typeahead"]);
2048
+ const a = Hn();
2049
+ n = n || a, Ee(
2050
+ n,
2051
+ process.env.NODE_ENV !== "production" && "CompositeTypeahead must be a Composite component"
2052
+ );
2053
+ const u = s.onKeyDownCapture, i = W(0), m = se((f) => {
2054
+ if (u == null || u(f), f.defaultPrevented || !o || !n) return;
2055
+ if (!Ro(f))
2056
+ return at();
2057
+ const { renderedItems: C, items: c, activeId: g, id: h } = n.getState();
2058
+ let S = $o(
2059
+ c.length > C.length ? c : C
2060
+ );
2061
+ const T = q(f.currentTarget), w = `[data-offscreen-id="${h}"]`, b = T.querySelectorAll(w);
2062
+ for (const p of b) {
2063
+ const P = p.ariaDisabled === "true" || "disabled" in p && !!p.disabled;
2064
+ S.push({ id: p.id, element: p, disabled: P });
2065
+ }
2066
+ if (b.length && (S = zt(S, (p) => p.element)), !No(f, S)) return at();
2067
+ f.preventDefault(), window.clearTimeout(i.current), i.current = window.setTimeout(() => {
2068
+ ve = "";
2069
+ }, 500);
2070
+ const I = f.key.toLowerCase();
2071
+ ve += I, S = Mo(S, I, g);
2072
+ const d = S.find((p) => Je(p, ve));
2073
+ d ? n.move(d.id) : at();
2074
+ });
2075
+ return s = $(x({}, s), {
2076
+ onKeyDownCapture: m
2077
+ }), jt(s);
2078
+ });
2079
+ K(function(t) {
2080
+ const r = ko(t);
2081
+ return Y(_o, r);
2082
+ });
2083
+ export {
2084
+ Jo as C,
2085
+ mt as R,
2086
+ Io as a,
2087
+ hn as b,
2088
+ ts as c,
2089
+ Wo as d,
2090
+ Go as e,
2091
+ jo as f,
2092
+ Or as g,
2093
+ ko as h,
2094
+ rn as i,
2095
+ To as j,
2096
+ qo as k,
2097
+ bn as l,
2098
+ Xo as m,
2099
+ Uo as n,
2100
+ Qo as o,
2101
+ es as p,
2102
+ Yo as q,
2103
+ Zo as r,
2104
+ zo as t,
2105
+ ns as u
2106
+ };