@wrdagency/blockout 0.0.18 → 0.1.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 (167) hide show
  1. package/dist/2NBKRL7C-7XoDiJp9.js +85 -0
  2. package/dist/2RSXSRCN-qt84MtKs.js +61 -0
  3. package/dist/4CMBR7SL-BHIN8rB4.js +308 -0
  4. package/dist/5JTVDSTH-CG1NL6Fw.js +174 -0
  5. package/dist/5VQZOHHZ-CscZGerP.js +59 -0
  6. package/dist/6VRAQV3D-Clhw_nNS.js +201 -0
  7. package/dist/7PRQYBBV-91wrWGjk.js +17 -0
  8. package/dist/ArrowRight.es-xyNbtVOa.js +60 -0
  9. package/dist/DG5U6ZEL-CVj-Czp2.js +17 -0
  10. package/dist/F5MUBM3I-87B2_4WK.js +54 -0
  11. package/dist/LMDWO4NN--KEvZePp.js +610 -0
  12. package/dist/MTZPJQMC-DyCWBG18.js +14 -0
  13. package/dist/P7GR5CS5-BoOYUfSQ.js +19 -0
  14. package/dist/PFRGBC2K-BEg8ahbY.js +303 -0
  15. package/dist/RS7LB2H4-D0fWv5qu.js +15 -0
  16. package/dist/RZ4GPYOB-13-5LlEb.js +37 -0
  17. package/dist/S43UC3DV-Dn8EFLaT.js +22 -0
  18. package/dist/Square.es-KJLdY11q.js +72 -0
  19. package/dist/T7VMP3TM-DeRMoW8g.js +77 -0
  20. package/dist/TP7N7UIH-BHb1rEeb.js +34 -0
  21. package/dist/UQQRIHDV-Bu8e1bYU.js +69 -0
  22. package/dist/UYGDZTLQ-DcCmv5SE.js +12 -0
  23. package/dist/VIIRIBF3-D5DmZNtI.js +26 -0
  24. package/dist/WMYDSCNQ-DECXdiUT.js +1346 -0
  25. package/dist/WYCIER3C-8jmp2F15.js +175 -0
  26. package/dist/YV4JVR4I-LkUIiJWj.js +351 -0
  27. package/dist/assets/button.css +1 -1
  28. package/dist/assets/index.css +1 -1
  29. package/dist/assets/index10.css +1 -1
  30. package/dist/assets/index11.css +1 -1
  31. package/dist/assets/index12.css +1 -1
  32. package/dist/assets/index13.css +1 -1
  33. package/dist/assets/index14.css +1 -0
  34. package/dist/assets/index15.css +1 -0
  35. package/dist/assets/index16.css +1 -0
  36. package/dist/assets/index17.css +1 -0
  37. package/dist/assets/index18.css +1 -0
  38. package/dist/assets/index19.css +1 -0
  39. package/dist/assets/index2.css +1 -1
  40. package/dist/assets/index3.css +1 -1
  41. package/dist/assets/index4.css +1 -1
  42. package/dist/assets/index5.css +1 -1
  43. package/dist/assets/index6.css +1 -1
  44. package/dist/assets/index7.css +1 -1
  45. package/dist/assets/index8.css +1 -1
  46. package/dist/assets/index9.css +1 -1
  47. package/dist/assets/style.css +1 -1
  48. package/dist/assets/style2.css +1 -0
  49. package/dist/assets/style3.css +1 -0
  50. package/dist/assets/style4.css +1 -0
  51. package/dist/assets/styles.css +1 -1
  52. package/dist/components/block-editor/editor.d.ts +5 -0
  53. package/dist/components/block-editor/editor.js +6 -0
  54. package/dist/components/block-editor/index.d.ts +1 -0
  55. package/dist/components/block-editor/index.js +4 -0
  56. package/dist/components/breadcrumbs/index.js +87 -31
  57. package/dist/components/button/button.d.ts +1 -1
  58. package/dist/components/button/button.js +5 -5
  59. package/dist/components/button/icon.d.ts +1 -2
  60. package/dist/components/button/icon.js +10 -3
  61. package/dist/components/button/index.d.ts +4 -0
  62. package/dist/components/controls/base-control/affix.js +7 -7
  63. package/dist/components/controls/base-control/index.js +11 -11
  64. package/dist/components/controls/base-popover-control/index.d.ts +9 -0
  65. package/dist/components/controls/base-popover-control/index.js +47 -0
  66. package/dist/components/controls/checkbox-control/index.d.ts +8 -0
  67. package/dist/components/controls/checkbox-control/index.js +57 -0
  68. package/dist/components/controls/choice-control/choice.js +13 -11
  69. package/dist/components/controls/choice-control/index.js +1 -1
  70. package/dist/components/controls/index.d.ts +4 -1
  71. package/dist/components/controls/index.js +25 -16
  72. package/dist/components/controls/number-control/index.js +29 -27
  73. package/dist/components/controls/password-control/index.js +1 -1
  74. package/dist/components/controls/recurrence-control/index.d.ts +8 -0
  75. package/dist/components/controls/recurrence-control/index.js +208 -0
  76. package/dist/components/controls/select-control/component.d.ts +12 -0
  77. package/dist/components/controls/select-control/component.js +1879 -0
  78. package/dist/components/controls/select-control/index.d.ts +2 -12
  79. package/dist/components/controls/select-control/index.js +5 -1860
  80. package/dist/components/controls/select-control/options.d.ts +7 -0
  81. package/dist/components/controls/select-control/options.js +9 -0
  82. package/dist/components/controls/textarea-control/index.js +1 -1
  83. package/dist/components/controls/toggle-control/index.js +11 -9
  84. package/dist/components/controls/toggle-group-control/index.d.ts +19 -0
  85. package/dist/components/controls/toggle-group-control/index.js +50 -0
  86. package/dist/components/data-table/header.js +120 -171
  87. package/dist/components/data-table/index.js +1 -1
  88. package/dist/components/filesystem/file.d.ts +7 -0
  89. package/dist/components/filesystem/file.js +44 -0
  90. package/dist/components/filesystem/folder.d.ts +6 -0
  91. package/dist/components/filesystem/folder.js +160 -0
  92. package/dist/components/filesystem/icon.d.ts +7 -0
  93. package/dist/components/filesystem/icon.js +908 -0
  94. package/dist/components/filesystem/index.js +14 -0
  95. package/dist/components/filesystem/list.d.ts +4 -0
  96. package/dist/components/filesystem/list.js +18 -0
  97. package/dist/components/filesystem/root.d.ts +3 -0
  98. package/dist/components/filesystem/root.js +7 -0
  99. package/dist/components/form/components/index.js +12 -12
  100. package/dist/components/form/components/pagination.js +23 -16
  101. package/dist/components/index.d.ts +5 -0
  102. package/dist/components/index.js +50 -31
  103. package/dist/components/markdown/{index.d.ts → editor/component.d.ts} +2 -2
  104. package/dist/components/markdown/editor/component.js +25583 -0
  105. package/dist/components/markdown/editor/index.d.ts +1 -0
  106. package/dist/components/markdown/editor/index.js +4 -0
  107. package/dist/components/markdown/formats.js +29 -27
  108. package/dist/components/markdown/index.js +5 -25842
  109. package/dist/components/markdown/prose.d.ts +3 -0
  110. package/dist/components/markdown/prose.js +15 -0
  111. package/dist/components/menu/index.js +24 -23
  112. package/dist/components/menu/item.js +1 -1
  113. package/dist/components/menu/items/action.js +1 -1
  114. package/dist/components/menu/items/spacer.js +14 -42
  115. package/dist/components/menu/items/submenu.js +2 -2
  116. package/dist/components/menu/items/toggle.js +25 -91
  117. package/dist/components/progress/index.js +1 -1
  118. package/dist/components/tabs/index.js +12 -0
  119. package/dist/components/tabs/list.d.ts +7 -0
  120. package/dist/components/tabs/list.js +42 -0
  121. package/dist/components/tabs/panel.d.ts +8 -0
  122. package/dist/components/tabs/panel.js +132 -0
  123. package/dist/components/tabs/root.d.ts +9 -0
  124. package/dist/components/tabs/root.js +173 -0
  125. package/dist/components/tabs/tab.d.ts +7 -0
  126. package/dist/components/tabs/tab.js +81 -0
  127. package/dist/components/toolbar/index.js +27 -0
  128. package/dist/components/toolbar/root.d.ts +6 -0
  129. package/dist/components/toolbar/root.js +6 -0
  130. package/dist/composite-provider-DxKEAxsZ.js +10 -0
  131. package/dist/floating-ui.dom-BqewRPVB.js +1124 -0
  132. package/dist/hooks/state.d.ts +4 -0
  133. package/dist/hooks/state.js +7 -0
  134. package/dist/hooks/theme.js +7 -38
  135. package/dist/index-1AjPIqTN.js +73 -0
  136. package/dist/index-B5y9bioP.js +258 -0
  137. package/dist/index-BI5rPXbu.js +391 -0
  138. package/dist/index.js +63 -40
  139. package/dist/{item-D9r2-3fk.js → item-BrZqCoM7.js} +240 -234
  140. package/dist/options-Cfoqhxw2.js +96 -0
  141. package/dist/primitives/index.d.ts +2 -0
  142. package/dist/primitives/index.js +4 -0
  143. package/dist/primitives/resizable/index.js +1 -1
  144. package/dist/primitives/scroll-area/index.d.ts +7 -0
  145. package/dist/primitives/scroll-area/index.js +545 -0
  146. package/dist/primitives/truncate/index.d.ts +7 -0
  147. package/dist/primitives/truncate/index.js +46 -0
  148. package/dist/primitives/visually-hidden/index.d.ts +2 -2
  149. package/dist/primitives/visually-hidden/index.js +13 -3
  150. package/dist/root-CdR32nP9.js +73 -0
  151. package/dist/tslib.es6-DN7pKd6F.js +44 -0
  152. package/dist/types/date.d.ts +39 -0
  153. package/dist/types/date.js +1749 -0
  154. package/dist/types/options.d.ts +8 -6
  155. package/dist/utils/components.d.ts +5 -0
  156. package/dist/utils/components.js +14 -0
  157. package/dist/utils/date.d.ts +1 -0
  158. package/dist/utils/date.js +15 -0
  159. package/dist/utils/string.d.ts +4 -0
  160. package/dist/utils/string.js +18 -0
  161. package/package.json +4 -1
  162. package/dist/2NBKRL7C-D-Q0qGRV.js +0 -81
  163. package/dist/P7GR5CS5-qyeuZVEs.js +0 -640
  164. package/dist/T7VMP3TM-BxgFbvdx.js +0 -2106
  165. package/dist/UQQRIHDV-BGs025hb.js +0 -1046
  166. package/dist/VIIRIBF3-D9clDhln.js +0 -21
  167. package/dist/floating-ui.dom-9sqP7IwC.js +0 -1512
@@ -0,0 +1,1346 @@
1
+ import { e as mt, m as Nt, o as Mt, t as Vt, c as Ht, f as Lt, a as re, b as It } from "./YV4JVR4I-LkUIiJWj.js";
2
+ import { $ as kt, Y as ke, U as Re, X as $e, Z as Bt, a as K, m as y, o as E, f as V, q as Y, _ as ae, n as Ze, b as M, ah as st, D as O, l as Z, W as Ee, V as Je, a0 as oe, M as W, S as qt, e as ye, ae as jt, a1 as gt, ai as Wt, aj as Yt, a6 as Be, a8 as ht, s as zt, g as bt, C as Xt, j as qe, H as Ut, A as Kt, i as Ve, ab as Gt } from "./LMDWO4NN--KEvZePp.js";
3
+ import { createContext as Qe, useRef as j, useContext as et, useState as ne, useEffect as _, useCallback as Me, useMemo as Zt, isValidElement as Jt } from "react";
4
+ import { b as je, c as it, r as Qt, d as er, F as tr, i as rr, g as nr, e as or, j as Pe, u as sr, k as ir } from "./PFRGBC2K-BEg8ahbY.js";
5
+ import { r as Xe } from "./index-BI5rPXbu.js";
6
+ import { jsx as P, jsxs as Ce, Fragment as Ne } from "react/jsx-runtime";
7
+ import { c as ur, b as ar, u as cr, a as Et, i as lr } from "./WYCIER3C-8jmp2F15.js";
8
+ import { c as He, D as fr, d as dr, e as pr } from "./RS7LB2H4-D0fWv5qu.js";
9
+ import { b as Le, P as Pt } from "./MTZPJQMC-DyCWBG18.js";
10
+ import { a as vr, c as mr, o as gr, f as hr, s as br, l as Er, b as Pr, d as yr } from "./floating-ui.dom-BqewRPVB.js";
11
+ import { u as wr } from "./F5MUBM3I-87B2_4WK.js";
12
+ function yt(e = {}) {
13
+ return ur(e);
14
+ }
15
+ function wt(e, t, n) {
16
+ return ar(e, t, n);
17
+ }
18
+ function xr(e = {}) {
19
+ const [t, n] = mt(yt, e);
20
+ return wt(t, n, e);
21
+ }
22
+ function Sr(e = {}) {
23
+ var t = e, {
24
+ popover: n
25
+ } = t, r = kt(t, [
26
+ "popover"
27
+ ]);
28
+ const o = Nt(
29
+ r.store,
30
+ Mt(n, [
31
+ "arrowElement",
32
+ "anchorElement",
33
+ "contentElement",
34
+ "popoverElement",
35
+ "disclosureElement"
36
+ ])
37
+ );
38
+ Vt(r, o);
39
+ const s = o == null ? void 0 : o.getState(), i = yt(ke(Re({}, r), { store: o })), u = $e(
40
+ r.placement,
41
+ s == null ? void 0 : s.placement,
42
+ "bottom"
43
+ ), a = ke(Re({}, i.getState()), {
44
+ placement: u,
45
+ currentPlacement: u,
46
+ anchorElement: $e(s == null ? void 0 : s.anchorElement, null),
47
+ popoverElement: $e(s == null ? void 0 : s.popoverElement, null),
48
+ arrowElement: $e(s == null ? void 0 : s.arrowElement, null),
49
+ rendered: Symbol("rendered")
50
+ }), p = Ht(a, i, o);
51
+ return ke(Re(Re({}, i), p), {
52
+ setAnchorElement: (b) => p.setState("anchorElement", b),
53
+ setPopoverElement: (b) => p.setState("popoverElement", b),
54
+ setArrowElement: (b) => p.setState("arrowElement", b),
55
+ render: () => p.setState("rendered", Symbol("rendered"))
56
+ });
57
+ }
58
+ function Dr(e, t, n) {
59
+ return Bt(t, [n.popover]), Lt(e, n, "placement"), wt(e, t, n);
60
+ }
61
+ function $n(e = {}) {
62
+ const [t, n] = mt(Sr, e);
63
+ return Dr(t, n, e);
64
+ }
65
+ var ut = Qe(null), Or = "span", xt = K(
66
+ function(t) {
67
+ return t = y(E({}, t), {
68
+ style: E({
69
+ border: 0,
70
+ clip: "rect(0 0 0 0)",
71
+ height: "1px",
72
+ margin: "-1px",
73
+ overflow: "hidden",
74
+ padding: 0,
75
+ position: "absolute",
76
+ whiteSpace: "nowrap",
77
+ width: "1px"
78
+ }, t.style)
79
+ }), t;
80
+ }
81
+ );
82
+ V(function(t) {
83
+ const n = xt(t);
84
+ return Y(Or, n);
85
+ });
86
+ var Ar = "span", Fr = K(
87
+ function(t) {
88
+ return t = y(E({
89
+ "data-focus-trap": "",
90
+ tabIndex: 0,
91
+ "aria-hidden": !0
92
+ }, t), {
93
+ style: E({
94
+ // Prevents unintended scroll jumps.
95
+ position: "fixed",
96
+ top: 0,
97
+ left: 0
98
+ }, t.style)
99
+ }), t = xt(t), t;
100
+ }
101
+ ), _e = V(function(t) {
102
+ const n = Fr(t);
103
+ return Y(Ar, n);
104
+ }), Tr = "div";
105
+ function Rr(e) {
106
+ return O(e).body;
107
+ }
108
+ function $r(e, t) {
109
+ return t ? typeof t == "function" ? t(e) : t : O(e).createElement("div");
110
+ }
111
+ function _r(e = "id") {
112
+ return `${e ? `${e}-` : ""}${Math.random().toString(36).slice(2, 8)}`;
113
+ }
114
+ function te(e) {
115
+ queueMicrotask(() => {
116
+ e == null || e.focus();
117
+ });
118
+ }
119
+ var St = K(function(t) {
120
+ var n = t, {
121
+ preserveTabOrder: r,
122
+ preserveTabOrderAnchor: o,
123
+ portalElement: s,
124
+ portalRef: i,
125
+ portal: u = !0
126
+ } = n, a = ae(n, [
127
+ "preserveTabOrder",
128
+ "preserveTabOrderAnchor",
129
+ "portalElement",
130
+ "portalRef",
131
+ "portal"
132
+ ]);
133
+ const p = j(null), b = Ze(p, a.ref), A = et(ut), [f, H] = ne(null), [L, I] = ne(
134
+ null
135
+ ), k = j(null), C = j(null), N = j(null), F = j(null);
136
+ return M(() => {
137
+ const l = p.current;
138
+ if (!l || !u) {
139
+ H(null);
140
+ return;
141
+ }
142
+ const d = $r(l, s);
143
+ if (!d) {
144
+ H(null);
145
+ return;
146
+ }
147
+ const g = d.isConnected;
148
+ if (g || (A || Rr(l)).appendChild(d), d.id || (d.id = l.id ? `portal/${l.id}` : _r()), H(d), st(i, d), !g)
149
+ return () => {
150
+ d.remove(), st(i, null);
151
+ };
152
+ }, [u, s, A, i]), M(() => {
153
+ if (!u || !r || !o) return;
154
+ const d = O(o).createElement("span");
155
+ return d.style.position = "fixed", o.insertAdjacentElement("afterend", d), I(d), () => {
156
+ d.remove(), I(null);
157
+ };
158
+ }, [u, r, o]), _(() => {
159
+ if (!f || !r) return;
160
+ let l = 0;
161
+ const d = (g) => {
162
+ if (!Ee(g)) return;
163
+ const v = g.type === "focusin";
164
+ if (cancelAnimationFrame(l), v)
165
+ return Qt(f);
166
+ l = requestAnimationFrame(() => {
167
+ er(f, !0);
168
+ });
169
+ };
170
+ return f.addEventListener("focusin", d, !0), f.addEventListener("focusout", d, !0), () => {
171
+ cancelAnimationFrame(l), f.removeEventListener("focusin", d, !0), f.removeEventListener("focusout", d, !0);
172
+ };
173
+ }, [f, r]), a = Z(
174
+ a,
175
+ (l) => {
176
+ if (l = // While the portal node is not in the DOM, we need to pass the
177
+ // current context to the portal context, otherwise it's going to
178
+ // reset to the body element on nested portals.
179
+ /* @__PURE__ */ P(ut.Provider, { value: f || A, children: l }), !u) return l;
180
+ if (!f)
181
+ return /* @__PURE__ */ P(
182
+ "span",
183
+ {
184
+ ref: b,
185
+ id: a.id,
186
+ style: { position: "fixed" },
187
+ hidden: !0
188
+ }
189
+ );
190
+ l = /* @__PURE__ */ Ce(Ne, { children: [
191
+ r && f && /* @__PURE__ */ P(
192
+ _e,
193
+ {
194
+ ref: C,
195
+ "data-focus-trap": a.id,
196
+ className: "__focus-trap-inner-before",
197
+ onFocus: (g) => {
198
+ Ee(g, f) ? te(je()) : te(k.current);
199
+ }
200
+ }
201
+ ),
202
+ l,
203
+ r && f && /* @__PURE__ */ P(
204
+ _e,
205
+ {
206
+ ref: N,
207
+ "data-focus-trap": a.id,
208
+ className: "__focus-trap-inner-after",
209
+ onFocus: (g) => {
210
+ Ee(g, f) ? te(it()) : te(F.current);
211
+ }
212
+ }
213
+ )
214
+ ] }), f && (l = Xe.createPortal(l, f));
215
+ let d = /* @__PURE__ */ Ce(Ne, { children: [
216
+ r && f && /* @__PURE__ */ P(
217
+ _e,
218
+ {
219
+ ref: k,
220
+ "data-focus-trap": a.id,
221
+ className: "__focus-trap-outer-before",
222
+ onFocus: (g) => {
223
+ !(g.relatedTarget === F.current) && Ee(g, f) ? te(C.current) : te(it());
224
+ }
225
+ }
226
+ ),
227
+ r && // We're using position: fixed here so that the browser doesn't
228
+ // add margin to the element when setting gap on a parent element.
229
+ /* @__PURE__ */ P("span", { "aria-owns": f == null ? void 0 : f.id, style: { position: "fixed" } }),
230
+ r && f && /* @__PURE__ */ P(
231
+ _e,
232
+ {
233
+ ref: F,
234
+ "data-focus-trap": a.id,
235
+ className: "__focus-trap-outer-after",
236
+ onFocus: (g) => {
237
+ if (Ee(g, f))
238
+ te(N.current);
239
+ else {
240
+ const v = je();
241
+ if (v === C.current) {
242
+ requestAnimationFrame(() => {
243
+ var J;
244
+ return (J = je()) == null ? void 0 : J.focus();
245
+ });
246
+ return;
247
+ }
248
+ te(v);
249
+ }
250
+ }
251
+ }
252
+ )
253
+ ] });
254
+ return L && r && (d = Xe.createPortal(
255
+ d,
256
+ L
257
+ )), /* @__PURE__ */ Ce(Ne, { children: [
258
+ d,
259
+ l
260
+ ] });
261
+ },
262
+ [f, A, u, a.id, r, L]
263
+ ), a = y(E({}, a), {
264
+ ref: b
265
+ }), a;
266
+ });
267
+ V(function(t) {
268
+ const n = St(t);
269
+ return Y(Tr, n);
270
+ });
271
+ var at = Qe(0);
272
+ function Cr({ level: e, children: t }) {
273
+ const n = et(at), r = Math.max(
274
+ Math.min(e || n + 1, 6),
275
+ 1
276
+ );
277
+ return /* @__PURE__ */ P(at.Provider, { value: r, children: t });
278
+ }
279
+ var Nr = "div", Dt = K(function(t) {
280
+ var n = t, { autoFocusOnShow: r = !0 } = n, o = ae(n, ["autoFocusOnShow"]);
281
+ return o = Z(
282
+ o,
283
+ (s) => /* @__PURE__ */ P(tr.Provider, { value: r, children: s }),
284
+ [r]
285
+ ), o;
286
+ });
287
+ V(function(t) {
288
+ const n = Dt(t);
289
+ return Y(Nr, n);
290
+ });
291
+ function Mr(e, t) {
292
+ const r = O(e).createElement("button");
293
+ return r.type = "button", r.tabIndex = -1, r.textContent = "Dismiss popup", Object.assign(r.style, {
294
+ border: "0px",
295
+ clip: "rect(0 0 0 0)",
296
+ height: "1px",
297
+ margin: "-1px",
298
+ overflow: "hidden",
299
+ padding: "0px",
300
+ position: "absolute",
301
+ whiteSpace: "nowrap",
302
+ width: "1px"
303
+ }), r.addEventListener("click", t), e.prepend(r), () => {
304
+ r.removeEventListener("click", t), r.remove();
305
+ };
306
+ }
307
+ function Vr(e) {
308
+ const t = j();
309
+ return _(() => {
310
+ if (!e) {
311
+ t.current = null;
312
+ return;
313
+ }
314
+ return Je("mousedown", (r) => {
315
+ t.current = r.target;
316
+ }, !0);
317
+ }, [e]), t;
318
+ }
319
+ var We = /* @__PURE__ */ new WeakMap();
320
+ function we(e, t, n) {
321
+ We.has(e) || We.set(e, /* @__PURE__ */ new Map());
322
+ const r = We.get(e), o = r.get(t);
323
+ if (!o)
324
+ return r.set(t, n()), () => {
325
+ var u;
326
+ (u = r.get(t)) == null || u(), r.delete(t);
327
+ };
328
+ const s = n(), i = () => {
329
+ s(), o(), r.delete(t);
330
+ };
331
+ return r.set(t, i), () => {
332
+ r.get(t) === i && (s(), r.set(t, o));
333
+ };
334
+ }
335
+ function tt(e, t, n) {
336
+ return we(e, t, () => {
337
+ const o = e.getAttribute(t);
338
+ return e.setAttribute(t, n), () => {
339
+ o == null ? e.removeAttribute(t) : e.setAttribute(t, o);
340
+ };
341
+ });
342
+ }
343
+ function ue(e, t, n) {
344
+ return we(e, t, () => {
345
+ const o = t in e, s = e[t];
346
+ return e[t] = n, () => {
347
+ o ? e[t] = s : delete e[t];
348
+ };
349
+ });
350
+ }
351
+ function Ue(e, t) {
352
+ return e ? we(e, "style", () => {
353
+ const r = e.style.cssText;
354
+ return Object.assign(e.style, t), () => {
355
+ e.style.cssText = r;
356
+ };
357
+ }) : () => {
358
+ };
359
+ }
360
+ function Hr(e, t, n) {
361
+ return e ? we(e, t, () => {
362
+ const o = e.style.getPropertyValue(t);
363
+ return e.style.setProperty(t, n), () => {
364
+ o ? e.style.setProperty(t, o) : e.style.removeProperty(t);
365
+ };
366
+ }) : () => {
367
+ };
368
+ }
369
+ var Lr = ["SCRIPT", "STYLE"];
370
+ function Ke(e) {
371
+ return `__ariakit-dialog-snapshot-${e}`;
372
+ }
373
+ function Ir(e, t) {
374
+ const n = O(t), r = Ke(e);
375
+ if (!n.body[r]) return !0;
376
+ do {
377
+ if (t === n.body) return !1;
378
+ if (t[r]) return !0;
379
+ if (!t.parentElement) return !1;
380
+ t = t.parentElement;
381
+ } while (!0);
382
+ }
383
+ function kr(e, t, n) {
384
+ return Lr.includes(t.tagName) || !Ir(e, t) ? !1 : !n.some(
385
+ (r) => r && W(t, r)
386
+ );
387
+ }
388
+ function rt(e, t, n, r) {
389
+ for (let o of t) {
390
+ if (!(o != null && o.isConnected)) continue;
391
+ const s = t.some((a) => !a || a === o ? !1 : a.contains(o)), i = O(o), u = o;
392
+ for (; o.parentElement && o !== i.body; ) {
393
+ if (r == null || r(o.parentElement, u), !s)
394
+ for (const a of o.parentElement.children)
395
+ kr(e, a, t) && n(a, u);
396
+ o = o.parentElement;
397
+ }
398
+ }
399
+ }
400
+ function Br(e, t) {
401
+ const { body: n } = O(t[0]), r = [];
402
+ return rt(e, t, (s) => {
403
+ r.push(ue(s, Ke(e), !0));
404
+ }), oe(ue(n, Ke(e), !0), () => {
405
+ for (const s of r)
406
+ s();
407
+ });
408
+ }
409
+ function Ot(e, ...t) {
410
+ if (!e) return !1;
411
+ const n = e.getAttribute("data-backdrop");
412
+ return n == null ? !1 : n === "" || n === "true" || !t.length ? !0 : t.some((r) => n === r);
413
+ }
414
+ function ve(e = "", t = !1) {
415
+ return `__ariakit-dialog-${t ? "ancestor" : "outside"}${e ? `-${e}` : ""}`;
416
+ }
417
+ function qr(e, t = "") {
418
+ return oe(
419
+ ue(e, ve(), !0),
420
+ ue(e, ve(t), !0)
421
+ );
422
+ }
423
+ function At(e, t = "") {
424
+ return oe(
425
+ ue(e, ve("", !0), !0),
426
+ ue(e, ve(t, !0), !0)
427
+ );
428
+ }
429
+ function nt(e, t) {
430
+ const n = ve(t, !0);
431
+ if (e[n]) return !0;
432
+ const r = ve(t);
433
+ do {
434
+ if (e[r]) return !0;
435
+ if (!e.parentElement) return !1;
436
+ e = e.parentElement;
437
+ } while (!0);
438
+ }
439
+ function ct(e, t) {
440
+ const n = [], r = t.map((s) => s == null ? void 0 : s.id);
441
+ return rt(
442
+ e,
443
+ t,
444
+ (s) => {
445
+ Ot(s, ...r) || n.unshift(qr(s, e));
446
+ },
447
+ (s, i) => {
448
+ i.hasAttribute("data-dialog") && i.id !== e || n.unshift(At(s, e));
449
+ }
450
+ ), () => {
451
+ for (const s of n)
452
+ s();
453
+ };
454
+ }
455
+ function jr(e) {
456
+ return e.tagName === "HTML" ? !0 : W(O(e).body, e);
457
+ }
458
+ function Wr(e, t) {
459
+ if (!e) return !1;
460
+ if (W(e, t)) return !0;
461
+ const n = t.getAttribute("aria-activedescendant");
462
+ if (n) {
463
+ const r = O(e).getElementById(n);
464
+ if (r)
465
+ return W(e, r);
466
+ }
467
+ return !1;
468
+ }
469
+ function Yr(e, t) {
470
+ if (!("clientY" in e)) return !1;
471
+ const n = t.getBoundingClientRect();
472
+ return n.width === 0 || n.height === 0 ? !1 : n.top <= e.clientY && e.clientY <= n.top + n.height && n.left <= e.clientX && e.clientX <= n.left + n.width;
473
+ }
474
+ function Ye({
475
+ store: e,
476
+ type: t,
477
+ listener: n,
478
+ capture: r,
479
+ domReady: o
480
+ }) {
481
+ const s = ye(n), i = re(e, "open"), u = j(!1);
482
+ M(() => {
483
+ if (!i || !o) return;
484
+ const { contentElement: a } = e.getState();
485
+ if (!a) return;
486
+ const p = () => {
487
+ u.current = !0;
488
+ };
489
+ return a.addEventListener("focusin", p, !0), () => a.removeEventListener("focusin", p, !0);
490
+ }, [e, i, o]), _(() => i ? Je(t, (p) => {
491
+ const { contentElement: b, disclosureElement: A } = e.getState(), f = p.target;
492
+ !b || !f || !jr(f) || W(b, f) || Wr(A, f) || f.hasAttribute("data-focus-trap") || Yr(p, b) || u.current && !nt(f, b.id) || rr(f) || s(p);
493
+ }, r) : void 0, [i, r]);
494
+ }
495
+ function ze(e, t) {
496
+ return typeof e == "function" ? e(t) : !!e;
497
+ }
498
+ function zr(e, t, n) {
499
+ const r = re(e, "open"), o = Vr(r), s = { store: e, domReady: n, capture: !0 };
500
+ Ye(y(E({}, s), {
501
+ type: "click",
502
+ listener: (i) => {
503
+ const { contentElement: u } = e.getState(), a = o.current;
504
+ a && qt(a) && nt(a, u == null ? void 0 : u.id) && ze(t, i) && e.hide();
505
+ }
506
+ })), Ye(y(E({}, s), {
507
+ type: "focusin",
508
+ listener: (i) => {
509
+ const { contentElement: u } = e.getState();
510
+ u && i.target !== O(u) && ze(t, i) && e.hide();
511
+ }
512
+ })), Ye(y(E({}, s), {
513
+ type: "contextmenu",
514
+ listener: (i) => {
515
+ ze(t, i) && e.hide();
516
+ }
517
+ }));
518
+ }
519
+ var lt = Qe({});
520
+ function Xr(e) {
521
+ const t = et(lt), [n, r] = ne([]), o = Me(
522
+ (u) => {
523
+ var a;
524
+ return r((p) => [...p, u]), oe((a = t.add) == null ? void 0 : a.call(t, u), () => {
525
+ r((p) => p.filter((b) => b !== u));
526
+ });
527
+ },
528
+ [t]
529
+ );
530
+ M(() => It(e, ["open", "contentElement"], (u) => {
531
+ var a;
532
+ if (u.open && u.contentElement)
533
+ return (a = t.add) == null ? void 0 : a.call(t, e);
534
+ }), [e, t]);
535
+ const s = Zt(() => ({ store: e, add: o }), [e, o]);
536
+ return { wrapElement: Me(
537
+ (u) => /* @__PURE__ */ P(lt.Provider, { value: s, children: u }),
538
+ [s]
539
+ ), nestedDialogs: n };
540
+ }
541
+ function Ur({
542
+ attribute: e,
543
+ contentId: t,
544
+ contentElement: n,
545
+ enabled: r
546
+ }) {
547
+ const [o, s] = jt(), i = Me(() => {
548
+ if (!r || !n) return !1;
549
+ const { body: u } = O(n), a = u.getAttribute(e);
550
+ return !a || a === t;
551
+ }, [o, r, n, e, t]);
552
+ return _(() => {
553
+ if (!r || !t || !n) return;
554
+ const { body: u } = O(n);
555
+ if (i())
556
+ return u.setAttribute(e, t), () => u.removeAttribute(e);
557
+ const a = new MutationObserver(() => Xe.flushSync(s));
558
+ return a.observe(u, { attributeFilter: [e] }), () => a.disconnect();
559
+ }, [o, r, t, n, i, e]), i;
560
+ }
561
+ function Kr(e) {
562
+ const t = e.getBoundingClientRect().left;
563
+ return Math.round(t) + e.scrollLeft ? "paddingLeft" : "paddingRight";
564
+ }
565
+ function Gr(e, t, n) {
566
+ const r = Ur({
567
+ attribute: "data-dialog-prevent-body-scroll",
568
+ contentElement: e,
569
+ contentId: t,
570
+ enabled: n
571
+ });
572
+ _(() => {
573
+ if (!r() || !e) return;
574
+ const o = O(e), s = gt(e), { documentElement: i, body: u } = o, a = i.style.getPropertyValue("--scrollbar-width"), p = a ? Number.parseInt(a) : s.innerWidth - i.clientWidth, b = () => Hr(
575
+ i,
576
+ "--scrollbar-width",
577
+ `${p}px`
578
+ ), A = Kr(i), f = () => Ue(u, {
579
+ overflow: "hidden",
580
+ [A]: `${p}px`
581
+ }), H = () => {
582
+ var I, k;
583
+ const { scrollX: C, scrollY: N, visualViewport: F } = s, l = (I = F == null ? void 0 : F.offsetLeft) != null ? I : 0, d = (k = F == null ? void 0 : F.offsetTop) != null ? k : 0, g = Ue(u, {
584
+ position: "fixed",
585
+ overflow: "hidden",
586
+ top: `${-(N - Math.floor(d))}px`,
587
+ left: `${-(C - Math.floor(l))}px`,
588
+ right: "0",
589
+ [A]: `${p}px`
590
+ });
591
+ return () => {
592
+ g(), process.env.NODE_ENV !== "test" && s.scrollTo({ left: C, top: N, behavior: "instant" });
593
+ };
594
+ }, L = Wt() && !Yt();
595
+ return oe(
596
+ b(),
597
+ L ? H() : f()
598
+ );
599
+ }, [r, e]);
600
+ }
601
+ function Zr(e, ...t) {
602
+ if (!e) return !1;
603
+ const n = e.getAttribute("data-focus-trap");
604
+ return n == null ? !1 : t.length ? n === "" ? !1 : t.some((r) => n === r) : !0;
605
+ }
606
+ function Ft() {
607
+ return "inert" in HTMLElement.prototype;
608
+ }
609
+ function Jr(e) {
610
+ return tt(e, "aria-hidden", "true");
611
+ }
612
+ function Tt(e, t) {
613
+ if (!("style" in e)) return Be;
614
+ if (Ft())
615
+ return ue(e, "inert", !0);
616
+ const r = nr(e, !0).map((o) => {
617
+ if (t != null && t.some((i) => i && W(i, o))) return Be;
618
+ const s = we(o, "focus", () => (o.focus = Be, () => {
619
+ delete o.focus;
620
+ }));
621
+ return oe(tt(o, "tabindex", "-1"), s);
622
+ });
623
+ return oe(
624
+ ...r,
625
+ Jr(e),
626
+ Ue(e, {
627
+ pointerEvents: "none",
628
+ userSelect: "none",
629
+ cursor: "default"
630
+ })
631
+ );
632
+ }
633
+ function Qr(e, t) {
634
+ const n = [], r = t.map((s) => s == null ? void 0 : s.id);
635
+ return rt(
636
+ e,
637
+ t,
638
+ (s) => {
639
+ Ot(s, ...r) || Zr(s, ...r) || n.unshift(Tt(s, t));
640
+ },
641
+ (s) => {
642
+ s.hasAttribute("role") && (t.some((i) => i && W(i, s)) || n.unshift(tt(s, "role", "none")));
643
+ }
644
+ ), () => {
645
+ for (const s of n)
646
+ s();
647
+ };
648
+ }
649
+ var en = "div", tn = [
650
+ "a",
651
+ "button",
652
+ "details",
653
+ "dialog",
654
+ "div",
655
+ "form",
656
+ "h1",
657
+ "h2",
658
+ "h3",
659
+ "h4",
660
+ "h5",
661
+ "h6",
662
+ "header",
663
+ "img",
664
+ "input",
665
+ "label",
666
+ "li",
667
+ "nav",
668
+ "ol",
669
+ "p",
670
+ "section",
671
+ "select",
672
+ "span",
673
+ "summary",
674
+ "textarea",
675
+ "ul",
676
+ "svg"
677
+ ];
678
+ K(
679
+ function(t) {
680
+ return t;
681
+ }
682
+ );
683
+ var Ge = V(
684
+ // @ts-expect-error
685
+ function(t) {
686
+ return Y(en, t);
687
+ }
688
+ );
689
+ Object.assign(
690
+ Ge,
691
+ tn.reduce((e, t) => (e[t] = V(function(r) {
692
+ return Y(t, r);
693
+ }), e), {})
694
+ );
695
+ function rn({
696
+ store: e,
697
+ backdrop: t,
698
+ alwaysVisible: n,
699
+ hidden: r
700
+ }) {
701
+ const o = j(null), s = cr({ disclosure: e }), i = re(e, "contentElement");
702
+ _(() => {
703
+ const p = o.current, b = i;
704
+ p && b && (p.style.zIndex = getComputedStyle(b).zIndex);
705
+ }, [i]), M(() => {
706
+ const p = i == null ? void 0 : i.id;
707
+ if (!p) return;
708
+ const b = o.current;
709
+ if (b)
710
+ return At(b, p);
711
+ }, [i]);
712
+ const u = Et({
713
+ ref: o,
714
+ store: s,
715
+ role: "presentation",
716
+ "data-backdrop": (i == null ? void 0 : i.id) || "",
717
+ alwaysVisible: n,
718
+ hidden: r ?? void 0,
719
+ style: {
720
+ position: "fixed",
721
+ top: 0,
722
+ right: 0,
723
+ bottom: 0,
724
+ left: 0
725
+ }
726
+ });
727
+ if (!t) return null;
728
+ if (Jt(t))
729
+ return /* @__PURE__ */ P(Ge, y(E({}, u), { render: t }));
730
+ const a = typeof t != "boolean" ? t : "div";
731
+ return /* @__PURE__ */ P(Ge, y(E({}, u), { render: /* @__PURE__ */ P(a, {}) }));
732
+ }
733
+ var nn = "div", ft = Kt();
734
+ function on(e) {
735
+ const t = bt();
736
+ return !t || e && W(e, t) ? !1 : !!Pe(t);
737
+ }
738
+ function dt(e, t = !1) {
739
+ if (!e) return null;
740
+ const n = "current" in e ? e.current : e;
741
+ return n ? t ? Pe(n) ? n : null : n : null;
742
+ }
743
+ var Rt = K(function(t) {
744
+ var n = t, {
745
+ store: r,
746
+ open: o,
747
+ onClose: s,
748
+ focusable: i = !0,
749
+ modal: u = !0,
750
+ portal: a = !!u,
751
+ backdrop: p = !!u,
752
+ hideOnEscape: b = !0,
753
+ hideOnInteractOutside: A = !0,
754
+ getPersistentElements: f,
755
+ preventBodyScroll: H = !!u,
756
+ autoFocusOnShow: L = !0,
757
+ autoFocusOnHide: I = !0,
758
+ initialFocus: k,
759
+ finalFocus: C,
760
+ unmountOnHide: N,
761
+ unstable_treeSnapshotKey: F
762
+ } = n, l = ae(n, [
763
+ "store",
764
+ "open",
765
+ "onClose",
766
+ "focusable",
767
+ "modal",
768
+ "portal",
769
+ "backdrop",
770
+ "hideOnEscape",
771
+ "hideOnInteractOutside",
772
+ "getPersistentElements",
773
+ "preventBodyScroll",
774
+ "autoFocusOnShow",
775
+ "autoFocusOnHide",
776
+ "initialFocus",
777
+ "finalFocus",
778
+ "unmountOnHide",
779
+ "unstable_treeSnapshotKey"
780
+ ]);
781
+ const d = He(), g = j(null), v = xr({
782
+ store: r || d,
783
+ open: o,
784
+ setOpen(c) {
785
+ if (c) return;
786
+ const m = g.current;
787
+ if (!m) return;
788
+ const x = new Event("close", { bubbles: !1, cancelable: !0 });
789
+ s && m.addEventListener("close", s, { once: !0 }), m.dispatchEvent(x), x.defaultPrevented && v.setOpen(!0);
790
+ }
791
+ }), { portalRef: J, domReady: S } = ht(a, l.portalRef), D = l.preserveTabOrder, Q = re(
792
+ v,
793
+ (c) => D && !u && c.mounted
794
+ ), T = zt(l.id), w = re(v, "open"), R = re(v, "mounted"), B = re(v, "contentElement"), xe = lr(R, l.hidden, l.alwaysVisible);
795
+ Gr(B, T, H && !xe), zr(v, A, S);
796
+ const { wrapElement: ce, nestedDialogs: Se } = Xr(v);
797
+ l = Z(l, ce, [ce]), M(() => {
798
+ if (!w) return;
799
+ const c = g.current, m = bt(c, !0);
800
+ m && m.tagName !== "BODY" && (c && W(c, m) || v.setDisclosureElement(m));
801
+ }, [v, w]), ft && _(() => {
802
+ if (!R) return;
803
+ const { disclosureElement: c } = v.getState();
804
+ if (!c || !Xt(c)) return;
805
+ const m = () => {
806
+ let x = !1;
807
+ const h = () => {
808
+ x = !0;
809
+ }, $ = { capture: !0, once: !0 };
810
+ c.addEventListener("focusin", h, $), Ut(c, "mouseup", () => {
811
+ c.removeEventListener("focusin", h, !0), !x && ir(c);
812
+ });
813
+ };
814
+ return c.addEventListener("mousedown", m), () => {
815
+ c.removeEventListener("mousedown", m);
816
+ };
817
+ }, [v, R]), _(() => {
818
+ if (!R || !S) return;
819
+ const c = g.current;
820
+ if (!c) return;
821
+ const m = gt(c), x = m.visualViewport || m, h = () => {
822
+ var $, U;
823
+ const be = (U = ($ = m.visualViewport) == null ? void 0 : $.height) != null ? U : m.innerHeight;
824
+ c.style.setProperty("--dialog-viewport-height", `${be}px`);
825
+ };
826
+ return h(), x.addEventListener("resize", h), () => {
827
+ x.removeEventListener("resize", h);
828
+ };
829
+ }, [R, S]), _(() => {
830
+ if (!u || !R || !S) return;
831
+ const c = g.current;
832
+ if (!(!c || c.querySelector("[data-dialog-dismiss]")))
833
+ return Mr(c, v.hide);
834
+ }, [v, u, R, S]), M(() => {
835
+ if (!Ft() || w || !R || !S) return;
836
+ const c = g.current;
837
+ if (c)
838
+ return Tt(c);
839
+ }, [w, R, S]);
840
+ const ee = w && S;
841
+ M(() => {
842
+ if (!T || !ee) return;
843
+ const c = g.current;
844
+ return Br(T, [c]);
845
+ }, [T, ee, F]);
846
+ const me = ye(f);
847
+ M(() => {
848
+ if (!T || !ee) return;
849
+ const { disclosureElement: c } = v.getState(), m = g.current, x = me() || [], h = [
850
+ m,
851
+ ...x,
852
+ ...Se.map(($) => $.getState().contentElement)
853
+ ];
854
+ return u ? oe(
855
+ ct(T, h),
856
+ Qr(T, h)
857
+ ) : ct(T, [c, ...h]);
858
+ }, [
859
+ T,
860
+ v,
861
+ ee,
862
+ me,
863
+ Se,
864
+ u,
865
+ F
866
+ ]);
867
+ const ge = !!L, he = qe(L), [De, q] = ne(!1);
868
+ _(() => {
869
+ if (!w || !ge || !S || !(B != null && B.isConnected)) return;
870
+ const c = dt(k, !0) || // If no initial focus is specified, we try to focus the first element
871
+ // with the autofocus attribute. If it's an Ariakit component, the
872
+ // Focusable component will consume the autoFocus prop and add the
873
+ // data-autofocus attribute to the element instead.
874
+ B.querySelector(
875
+ "[data-autofocus=true],[autofocus]"
876
+ ) || // We have to fallback to the first focusable element otherwise portaled
877
+ // dialogs with preserveTabOrder set to true will not receive focus
878
+ // properly because the elements aren't tabbable until the dialog receives
879
+ // focus.
880
+ or(B, !0, a && Q) || // Finally, we fallback to the dialog element itself.
881
+ B, m = Pe(c);
882
+ he(m ? c : null) && (q(!0), queueMicrotask(() => {
883
+ c.focus(), ft && m && c.scrollIntoView({ block: "nearest", inline: "nearest" });
884
+ }));
885
+ }, [
886
+ w,
887
+ ge,
888
+ S,
889
+ B,
890
+ k,
891
+ a,
892
+ Q,
893
+ he
894
+ ]);
895
+ const z = !!I, Ie = qe(I), [le, G] = ne(!1);
896
+ _(() => {
897
+ if (w)
898
+ return G(!0), () => G(!1);
899
+ }, [w]);
900
+ const se = Me(
901
+ (c, m = !0) => {
902
+ const { disclosureElement: x } = v.getState();
903
+ if (on(c)) return;
904
+ let h = dt(C) || x;
905
+ if (h != null && h.id) {
906
+ const U = O(h), be = `[aria-activedescendant="${h.id}"]`, Te = U.querySelector(be);
907
+ Te && (h = Te);
908
+ }
909
+ if (h && !Pe(h)) {
910
+ const U = h.closest("[data-dialog]");
911
+ if (U != null && U.id) {
912
+ const be = O(U), Te = `[aria-controls~="${U.id}"]`, ot = be.querySelector(Te);
913
+ ot && (h = ot);
914
+ }
915
+ }
916
+ const $ = h && Pe(h);
917
+ if (!$ && m) {
918
+ requestAnimationFrame(() => se(c, !1));
919
+ return;
920
+ }
921
+ Ie($ ? h : null) && $ && (h == null || h.focus({ preventScroll: !0 }));
922
+ },
923
+ [v, C, Ie]
924
+ ), X = j(!1);
925
+ M(() => {
926
+ if (w || !le || !z) return;
927
+ const c = g.current;
928
+ X.current = !0, se(c);
929
+ }, [w, le, S, z, se]), _(() => {
930
+ if (!le || !z) return;
931
+ const c = g.current;
932
+ return () => {
933
+ if (X.current) {
934
+ X.current = !1;
935
+ return;
936
+ }
937
+ se(c);
938
+ };
939
+ }, [le, z, se]);
940
+ const Oe = qe(b);
941
+ _(() => !S || !R ? void 0 : Je("keydown", (m) => {
942
+ if (m.key !== "Escape" || m.defaultPrevented) return;
943
+ const x = g.current;
944
+ if (!x || nt(x)) return;
945
+ const h = m.target;
946
+ if (!h) return;
947
+ const { disclosureElement: $ } = v.getState();
948
+ !!(h.tagName === "BODY" || W(x, h) || !$ || W($, h)) && Oe(m) && v.hide();
949
+ }, !0), [v, S, R, Oe]), l = Z(
950
+ l,
951
+ (c) => /* @__PURE__ */ P(Cr, { level: u ? 1 : void 0, children: c }),
952
+ [u]
953
+ );
954
+ const Ae = l.hidden, ie = l.alwaysVisible;
955
+ l = Z(
956
+ l,
957
+ (c) => p ? /* @__PURE__ */ Ce(Ne, { children: [
958
+ /* @__PURE__ */ P(
959
+ rn,
960
+ {
961
+ store: v,
962
+ backdrop: p,
963
+ hidden: Ae,
964
+ alwaysVisible: ie
965
+ }
966
+ ),
967
+ c
968
+ ] }) : c,
969
+ [v, p, Ae, ie]
970
+ );
971
+ const [fe, Fe] = ne(), [de, pe] = ne();
972
+ return l = Z(
973
+ l,
974
+ (c) => /* @__PURE__ */ P(fr, { value: v, children: /* @__PURE__ */ P(dr.Provider, { value: Fe, children: /* @__PURE__ */ P(pr.Provider, { value: pe, children: c }) }) }),
975
+ [v]
976
+ ), l = y(E({
977
+ id: T,
978
+ "data-dialog": "",
979
+ role: "dialog",
980
+ tabIndex: i ? -1 : void 0,
981
+ "aria-labelledby": fe,
982
+ "aria-describedby": de
983
+ }, l), {
984
+ ref: Ze(g, l.ref)
985
+ }), l = Dt(y(E({}, l), {
986
+ autoFocusOnShow: De
987
+ })), l = Et(E({ store: v }, l)), l = sr(y(E({}, l), { focusable: i })), l = St(y(E({ portal: a }, l), { portalRef: J, preserveTabOrder: Q })), l;
988
+ });
989
+ function $t(e, t = He) {
990
+ return V(function(r) {
991
+ const o = t(), s = r.store || o;
992
+ return re(
993
+ s,
994
+ (u) => !r.unmountOnHide || (u == null ? void 0 : u.mounted) || !!r.open
995
+ ) ? /* @__PURE__ */ P(e, E({}, r)) : null;
996
+ });
997
+ }
998
+ $t(
999
+ V(function(t) {
1000
+ const n = Rt(t);
1001
+ return Y(nn, n);
1002
+ }),
1003
+ He
1004
+ );
1005
+ var sn = "div";
1006
+ function pt(e = 0, t = 0, n = 0, r = 0) {
1007
+ if (typeof DOMRect == "function")
1008
+ return new DOMRect(e, t, n, r);
1009
+ const o = {
1010
+ x: e,
1011
+ y: t,
1012
+ width: n,
1013
+ height: r,
1014
+ top: t,
1015
+ right: e + n,
1016
+ bottom: t + r,
1017
+ left: e
1018
+ };
1019
+ return y(E({}, o), { toJSON: () => o });
1020
+ }
1021
+ function un(e) {
1022
+ if (!e) return pt();
1023
+ const { x: t, y: n, width: r, height: o } = e;
1024
+ return pt(t, n, r, o);
1025
+ }
1026
+ function an(e, t) {
1027
+ return {
1028
+ contextElement: e || void 0,
1029
+ getBoundingClientRect: () => {
1030
+ const r = e, o = t == null ? void 0 : t(r);
1031
+ return o || !r ? un(o) : r.getBoundingClientRect();
1032
+ }
1033
+ };
1034
+ }
1035
+ function cn(e) {
1036
+ return /^(?:top|bottom|left|right)(?:-(?:start|end))?$/.test(e);
1037
+ }
1038
+ function vt(e) {
1039
+ const t = window.devicePixelRatio || 1;
1040
+ return Math.round(e * t) / t;
1041
+ }
1042
+ function ln(e, t) {
1043
+ return gr(({ placement: n }) => {
1044
+ var r;
1045
+ const o = ((e == null ? void 0 : e.clientHeight) || 0) / 2, s = typeof t.gutter == "number" ? t.gutter + o : (r = t.gutter) != null ? r : o;
1046
+ return {
1047
+ crossAxis: !!n.split("-")[1] ? void 0 : t.shift,
1048
+ mainAxis: s,
1049
+ alignmentAxis: t.shift
1050
+ };
1051
+ });
1052
+ }
1053
+ function fn(e) {
1054
+ if (e.flip === !1) return;
1055
+ const t = typeof e.flip == "string" ? e.flip.split(" ") : void 0;
1056
+ return Ve(
1057
+ !t || t.every(cn),
1058
+ process.env.NODE_ENV !== "production" && "`flip` expects a spaced-delimited list of placements"
1059
+ ), hr({
1060
+ padding: e.overflowPadding,
1061
+ fallbackPlacements: t
1062
+ });
1063
+ }
1064
+ function dn(e) {
1065
+ if (!(!e.slide && !e.overlap))
1066
+ return br({
1067
+ mainAxis: e.slide,
1068
+ crossAxis: e.overlap,
1069
+ padding: e.overflowPadding,
1070
+ limiter: Er()
1071
+ });
1072
+ }
1073
+ function pn(e) {
1074
+ return yr({
1075
+ padding: e.overflowPadding,
1076
+ apply({ elements: t, availableWidth: n, availableHeight: r, rects: o }) {
1077
+ const s = t.floating, i = Math.round(o.reference.width);
1078
+ n = Math.floor(n), r = Math.floor(r), s.style.setProperty(
1079
+ "--popover-anchor-width",
1080
+ `${i}px`
1081
+ ), s.style.setProperty(
1082
+ "--popover-available-width",
1083
+ `${n}px`
1084
+ ), s.style.setProperty(
1085
+ "--popover-available-height",
1086
+ `${r}px`
1087
+ ), e.sameWidth && (s.style.width = `${i}px`), e.fitViewport && (s.style.maxWidth = `${n}px`, s.style.maxHeight = `${r}px`);
1088
+ }
1089
+ });
1090
+ }
1091
+ function vn(e, t) {
1092
+ if (e)
1093
+ return Pr({
1094
+ element: e,
1095
+ padding: t.arrowPadding
1096
+ });
1097
+ }
1098
+ var mn = K(
1099
+ function(t) {
1100
+ var n = t, {
1101
+ store: r,
1102
+ modal: o = !1,
1103
+ portal: s = !!o,
1104
+ preserveTabOrder: i = !0,
1105
+ autoFocusOnShow: u = !0,
1106
+ wrapperProps: a,
1107
+ fixed: p = !1,
1108
+ flip: b = !0,
1109
+ shift: A = 0,
1110
+ slide: f = !0,
1111
+ overlap: H = !1,
1112
+ sameWidth: L = !1,
1113
+ fitViewport: I = !1,
1114
+ gutter: k,
1115
+ arrowPadding: C = 4,
1116
+ overflowPadding: N = 8,
1117
+ getAnchorRect: F,
1118
+ updatePosition: l
1119
+ } = n, d = ae(n, [
1120
+ "store",
1121
+ "modal",
1122
+ "portal",
1123
+ "preserveTabOrder",
1124
+ "autoFocusOnShow",
1125
+ "wrapperProps",
1126
+ "fixed",
1127
+ "flip",
1128
+ "shift",
1129
+ "slide",
1130
+ "overlap",
1131
+ "sameWidth",
1132
+ "fitViewport",
1133
+ "gutter",
1134
+ "arrowPadding",
1135
+ "overflowPadding",
1136
+ "getAnchorRect",
1137
+ "updatePosition"
1138
+ ]);
1139
+ const g = Le();
1140
+ r = r || g, Ve(
1141
+ r,
1142
+ process.env.NODE_ENV !== "production" && "Popover must receive a `store` prop or be wrapped in a PopoverProvider component."
1143
+ );
1144
+ const v = r.useState("arrowElement"), J = r.useState("anchorElement"), S = r.useState("disclosureElement"), D = r.useState("popoverElement"), Q = r.useState("contentElement"), T = r.useState("placement"), w = r.useState("mounted"), R = r.useState("rendered"), B = j(null), [xe, ce] = ne(!1), { portalRef: Se, domReady: ee } = ht(s, d.portalRef), me = ye(F), ge = ye(l), he = !!l;
1145
+ M(() => {
1146
+ if (!(D != null && D.isConnected)) return;
1147
+ D.style.setProperty(
1148
+ "--popover-overflow-padding",
1149
+ `${N}px`
1150
+ );
1151
+ const q = an(J, me), z = async () => {
1152
+ if (!w) return;
1153
+ v || (B.current = B.current || document.createElement("div"));
1154
+ const G = v || B.current, se = [
1155
+ ln(G, { gutter: k, shift: A }),
1156
+ fn({ flip: b, overflowPadding: N }),
1157
+ dn({ slide: f, overlap: H, overflowPadding: N }),
1158
+ vn(G, { arrowPadding: C }),
1159
+ pn({
1160
+ sameWidth: L,
1161
+ fitViewport: I,
1162
+ overflowPadding: N
1163
+ })
1164
+ ], X = await mr(q, D, {
1165
+ placement: T,
1166
+ strategy: p ? "fixed" : "absolute",
1167
+ middleware: se
1168
+ });
1169
+ r == null || r.setState("currentPlacement", X.placement), ce(!0);
1170
+ const Oe = vt(X.x), Ae = vt(X.y);
1171
+ if (Object.assign(D.style, {
1172
+ top: "0",
1173
+ left: "0",
1174
+ transform: `translate3d(${Oe}px,${Ae}px,0)`
1175
+ }), G && X.middlewareData.arrow) {
1176
+ const { x: ie, y: fe } = X.middlewareData.arrow, Fe = X.placement.split("-")[0], de = G.clientWidth / 2, pe = G.clientHeight / 2, c = ie != null ? ie + de : -de, m = fe != null ? fe + pe : -pe;
1177
+ D.style.setProperty(
1178
+ "--popover-transform-origin",
1179
+ {
1180
+ top: `${c}px calc(100% + ${pe}px)`,
1181
+ bottom: `${c}px ${-pe}px`,
1182
+ left: `calc(100% + ${de}px) ${m}px`,
1183
+ right: `${-de}px ${m}px`
1184
+ }[Fe]
1185
+ ), Object.assign(G.style, {
1186
+ left: ie != null ? `${ie}px` : "",
1187
+ top: fe != null ? `${fe}px` : "",
1188
+ [Fe]: "100%"
1189
+ });
1190
+ }
1191
+ }, le = vr(q, D, async () => {
1192
+ he ? (await ge({ updatePosition: z }), ce(!0)) : await z();
1193
+ }, {
1194
+ // JSDOM doesn't support ResizeObserver
1195
+ elementResize: typeof ResizeObserver == "function"
1196
+ });
1197
+ return () => {
1198
+ ce(!1), le();
1199
+ };
1200
+ }, [
1201
+ r,
1202
+ R,
1203
+ D,
1204
+ v,
1205
+ J,
1206
+ D,
1207
+ T,
1208
+ w,
1209
+ ee,
1210
+ p,
1211
+ b,
1212
+ A,
1213
+ f,
1214
+ H,
1215
+ L,
1216
+ I,
1217
+ k,
1218
+ C,
1219
+ N,
1220
+ me,
1221
+ he,
1222
+ ge
1223
+ ]), M(() => {
1224
+ if (!w || !ee || !(D != null && D.isConnected) || !(Q != null && Q.isConnected)) return;
1225
+ const q = () => {
1226
+ D.style.zIndex = getComputedStyle(Q).zIndex;
1227
+ };
1228
+ q();
1229
+ let z = requestAnimationFrame(() => {
1230
+ z = requestAnimationFrame(q);
1231
+ });
1232
+ return () => cancelAnimationFrame(z);
1233
+ }, [w, ee, D, Q]);
1234
+ const De = p ? "fixed" : "absolute";
1235
+ return d = Z(
1236
+ d,
1237
+ (q) => /* @__PURE__ */ P(
1238
+ "div",
1239
+ y(E({}, a), {
1240
+ style: E({
1241
+ // https://floating-ui.com/docs/computeposition#initial-layout
1242
+ position: De,
1243
+ top: 0,
1244
+ left: 0,
1245
+ width: "max-content"
1246
+ }, a == null ? void 0 : a.style),
1247
+ ref: r == null ? void 0 : r.setPopoverElement,
1248
+ children: q
1249
+ })
1250
+ ),
1251
+ [r, De, a]
1252
+ ), d = Z(
1253
+ d,
1254
+ (q) => /* @__PURE__ */ P(Pt, { value: r, children: q }),
1255
+ [r]
1256
+ ), d = y(E({
1257
+ // data-placing is not part of the public API. We're setting this here so
1258
+ // we can wait for the popover to be positioned before other components
1259
+ // move focus into it. For example, this attribute is observed by the
1260
+ // Combobox component with the autoSelect behavior.
1261
+ "data-placing": !xe || void 0
1262
+ }, d), {
1263
+ style: E({
1264
+ position: "relative"
1265
+ }, d.style)
1266
+ }), d = Rt(y(E({
1267
+ store: r,
1268
+ modal: o,
1269
+ portal: s,
1270
+ preserveTabOrder: i,
1271
+ preserveTabOrderAnchor: S || J,
1272
+ autoFocusOnShow: xe && u
1273
+ }, d), {
1274
+ portalRef: Se
1275
+ })), d;
1276
+ }
1277
+ ), _n = $t(
1278
+ V(function(t) {
1279
+ const n = mn(t);
1280
+ return Y(sn, n);
1281
+ }),
1282
+ Le
1283
+ ), gn = "div", _t = K(
1284
+ function(t) {
1285
+ var n = t, { store: r } = n, o = ae(n, ["store"]);
1286
+ const s = Le();
1287
+ return r = r || s, o = y(E({}, o), {
1288
+ ref: Ze(r == null ? void 0 : r.setAnchorElement, o.ref)
1289
+ }), o;
1290
+ }
1291
+ );
1292
+ V(function(t) {
1293
+ const n = _t(t);
1294
+ return Y(gn, n);
1295
+ });
1296
+ var hn = "button", Ct = K(
1297
+ function(t) {
1298
+ var n = t, { store: r } = n, o = ae(n, ["store"]);
1299
+ const s = He();
1300
+ r = r || s, Ve(
1301
+ r,
1302
+ process.env.NODE_ENV !== "production" && "DialogDisclosure must receive a `store` prop or be wrapped in a DialogProvider component."
1303
+ );
1304
+ const i = r.useState("contentElement");
1305
+ return o = E({
1306
+ "aria-haspopup": Gt(i, "dialog")
1307
+ }, o), o = wr(E({ store: r }, o)), o;
1308
+ }
1309
+ );
1310
+ V(function(t) {
1311
+ const n = Ct(t);
1312
+ return Y(hn, n);
1313
+ });
1314
+ var bn = "button", En = K(function(t) {
1315
+ var n = t, { store: r } = n, o = ae(n, ["store"]);
1316
+ const s = Le();
1317
+ r = r || s, Ve(
1318
+ r,
1319
+ process.env.NODE_ENV !== "production" && "PopoverDisclosure must receive a `store` prop or be wrapped in a PopoverProvider component."
1320
+ );
1321
+ const i = o.onClick, u = ye((a) => {
1322
+ r == null || r.setAnchorElement(a.currentTarget), i == null || i(a);
1323
+ });
1324
+ return o = Z(
1325
+ o,
1326
+ (a) => /* @__PURE__ */ P(Pt, { value: r, children: a }),
1327
+ [r]
1328
+ ), o = y(E({}, o), {
1329
+ onClick: u
1330
+ }), o = _t(E({ store: r }, o)), o = Ct(E({ store: r }, o)), o;
1331
+ }), Cn = V(function(t) {
1332
+ const n = En(t);
1333
+ return Y(bn, n);
1334
+ });
1335
+ export {
1336
+ Cn as P,
1337
+ Ge as R,
1338
+ _n as a,
1339
+ Dr as b,
1340
+ Sr as c,
1341
+ mn as d,
1342
+ $t as e,
1343
+ En as f,
1344
+ _t as g,
1345
+ $n as u
1346
+ };