@inertiaui/modal-react 0.19.2 → 0.19.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,14 +1,14 @@
1
- var mn = Object.defineProperty;
2
- var pn = (e, t, n) => t in e ? mn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var q = (e, t, n) => pn(e, typeof t != "symbol" ? t + "" : t, n);
1
+ var fn = Object.defineProperty;
2
+ var mn = (e, t, n) => t in e ? fn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var q = (e, t, n) => mn(e, typeof t != "symbol" ? t + "" : t, n);
4
4
  import * as Ee from "react";
5
- import E, { createContext as H, useState as L, useEffect as M, useContext as R, useRef as O, createElement as Re, useMemo as C, forwardRef as dt, useImperativeHandle as Ft, useLayoutEffect as hn, useCallback as Y, Fragment as G, isValidElement as vn, cloneElement as gn, useId as Pe, useSyncExternalStore as wn, useReducer as yn, createRef as xn } from "react";
6
- import { jsx as T, jsxs as ue, Fragment as ct } from "react/jsx-runtime";
5
+ import E, { createContext as H, useContext as R, useEffect as M, useRef as O, useState as S, createElement as Re, useMemo as C, forwardRef as ct, useImperativeHandle as St, useLayoutEffect as pn, useCallback as Y, Fragment as G, isValidElement as hn, cloneElement as vn, useId as Pe, useSyncExternalStore as gn, useReducer as wn, createRef as yn } from "react";
6
+ import { jsxs as se, Fragment as dt, jsx as T } from "react/jsx-runtime";
7
7
  import De from "axios";
8
- import { router as le, usePage as bn } from "@inertiajs/react";
9
- import { mergeDataIntoQueryString as En } from "@inertiajs/core";
10
- import { createPortal as $n } from "react-dom";
11
- const we = {
8
+ import { router as xe, usePage as xn } from "@inertiajs/react";
9
+ import { mergeDataIntoQueryString as bn } from "@inertiajs/core";
10
+ import { createPortal as En } from "react-dom";
11
+ const ge = {
12
12
  type: "modal",
13
13
  navigate: !1,
14
14
  modal: {
@@ -28,27 +28,27 @@ const we = {
28
28
  position: "right"
29
29
  }
30
30
  };
31
- class Tn {
31
+ class $n {
32
32
  constructor() {
33
33
  this.config = {}, this.reset();
34
34
  }
35
35
  reset() {
36
- this.config = JSON.parse(JSON.stringify(we));
36
+ this.config = JSON.parse(JSON.stringify(ge));
37
37
  }
38
38
  put(t, n) {
39
39
  if (typeof t == "object") {
40
40
  this.config = {
41
- type: t.type ?? we.type,
42
- navigate: t.navigate ?? we.navigate,
43
- modal: { ...we.modal, ...t.modal ?? {} },
44
- slideover: { ...we.slideover, ...t.slideover ?? {} }
41
+ type: t.type ?? ge.type,
42
+ navigate: t.navigate ?? ge.navigate,
43
+ modal: { ...ge.modal, ...t.modal ?? {} },
44
+ slideover: { ...ge.slideover, ...t.slideover ?? {} }
45
45
  };
46
46
  return;
47
47
  }
48
48
  const r = t.split(".");
49
49
  let l = this.config;
50
- for (let a = 0; a < r.length - 1; a++)
51
- l = l[r[a]] = l[r[a]] || {};
50
+ for (let o = 0; o < r.length - 1; o++)
51
+ l = l[r[o]] = l[r[o]] || {};
52
52
  l[r[r.length - 1]] = n;
53
53
  }
54
54
  get(t) {
@@ -64,8 +64,8 @@ class Tn {
64
64
  return r;
65
65
  }
66
66
  }
67
- const _e = new Tn(), Sl = () => _e.reset(), Ll = (e, t) => _e.put(e, t), ft = (e) => _e.get(e), ce = (e, t) => _e.get(e ? `slideover.${t}` : `modal.${t}`);
68
- function xt(e, t) {
67
+ const _e = new $n(), Ll = () => _e.reset(), Sl = (e, t) => _e.put(e, t), ft = (e) => _e.get(e), ce = (e, t) => _e.get(e ? `slideover.${t}` : `modal.${t}`);
68
+ function Tn(e, t) {
69
69
  return e = typeof e == "string" ? new URL(e, window.location.origin) : e, t = typeof t == "string" ? new URL(t, window.location.origin) : t, `${e.origin}${e.pathname}` == `${t.origin}${t.pathname}`;
70
70
  }
71
71
  function et(e = "inertiaui_modal_") {
@@ -74,7 +74,7 @@ function et(e = "inertiaui_modal_") {
74
74
  function On(e, t) {
75
75
  return Array.isArray(e) ? e.filter((n) => !t.includes(n)) : Object.keys(e).reduce((n, r) => (t.includes(r) || (n[r] = e[r]), n), {});
76
76
  }
77
- function Ct(e, t) {
77
+ function Ft(e, t) {
78
78
  return Array.isArray(e) ? e.filter((n) => t.includes(n)) : t.reduce((n, r) => (r in e && (n[r] = e[r]), n), {});
79
79
  }
80
80
  function Pn(e) {
@@ -82,26 +82,26 @@ function Pn(e) {
82
82
  }
83
83
  function Mn(e, t = 3, n = 10) {
84
84
  return new Promise((r, l) => {
85
- const a = e();
86
- if (a) {
87
- r(a);
85
+ const o = e();
86
+ if (o) {
87
+ r(o);
88
88
  return;
89
89
  }
90
- let o = t * 1e3 / n;
90
+ let a = t * 1e3 / n;
91
91
  const s = setInterval(() => {
92
92
  const i = e();
93
- i && (clearInterval(s), r(i)), --o <= 0 && (clearInterval(s), l(new Error("Condition not met in time")));
93
+ i && (clearInterval(s), r(i)), --a <= 0 && (clearInterval(s), l(new Error("Condition not met in time")));
94
94
  }, n);
95
95
  });
96
96
  }
97
- function ye(e) {
97
+ function we(e) {
98
98
  return e ? (e = e.replace(/_/g, "-"), e = e.replace(/-+/g, "-"), /[A-Z]/.test(e) ? (e = e.replace(/\s+/g, "").replace(/_/g, "").replace(/(?:^|\s|-)+([A-Za-z])/g, (t, n) => n.toUpperCase()), e = e.replace(/(.)(?=[A-Z])/g, "$1-"), e.toLowerCase()) : e) : "";
99
99
  }
100
100
  const Be = H(null);
101
101
  Be.displayName = "ModalStackContext";
102
- let kt = null, At = null, $e = null, rt = null, Ie = [], fe = {};
103
- const Sn = ({ children: e }) => {
104
- const [t, n] = L([]), [r, l] = L({}), a = (v) => {
102
+ let Ct = null, kt = null, $e = null, rt = null, Ie = [], de = {};
103
+ const Ln = ({ children: e }) => {
104
+ const [t, n] = S([]), [r, l] = S({}), o = (v) => {
105
105
  n((u) => {
106
106
  const m = v([...u]), p = (g) => {
107
107
  var x;
@@ -115,10 +115,10 @@ const Sn = ({ children: e }) => {
115
115
  M(() => {
116
116
  Ie = t;
117
117
  }, [t]);
118
- class o {
118
+ class a {
119
119
  constructor(u, m, p, g, x) {
120
120
  q(this, "show", () => {
121
- a(
121
+ o(
122
122
  (u) => u.map((m) => (m.id === this.id && !m.isOpen && (m.isOpen = !0, m.shouldRender = !0), m))
123
123
  );
124
124
  });
@@ -126,7 +126,7 @@ const Sn = ({ children: e }) => {
126
126
  u ? this.show() : this.close();
127
127
  });
128
128
  q(this, "close", () => {
129
- a(
129
+ o(
130
130
  (u) => u.map((m) => {
131
131
  var p;
132
132
  return m.id === this.id && m.isOpen && (Object.keys(m.listeners).forEach((g) => {
@@ -136,7 +136,7 @@ const Sn = ({ children: e }) => {
136
136
  );
137
137
  });
138
138
  q(this, "afterLeave", () => {
139
- this.isOpen || a((u) => {
139
+ this.isOpen || o((u) => {
140
140
  const m = u.map((p) => {
141
141
  var g;
142
142
  return p.id === this.id && !p.isOpen && (p.shouldRender = !1, (g = p.afterLeaveCallback) == null || g.call(p), p.afterLeaveCallback = null), p;
@@ -145,27 +145,27 @@ const Sn = ({ children: e }) => {
145
145
  });
146
146
  });
147
147
  q(this, "on", (u, m) => {
148
- u = ye(u), this.listeners[u] = this.listeners[u] ?? [], this.listeners[u].push(m);
148
+ u = we(u), this.listeners[u] = this.listeners[u] ?? [], this.listeners[u].push(m);
149
149
  });
150
150
  q(this, "off", (u, m) => {
151
151
  var p;
152
- u = ye(u), m ? this.listeners[u] = ((p = this.listeners[u]) == null ? void 0 : p.filter((g) => g !== m)) ?? [] : delete this.listeners[u];
152
+ u = we(u), m ? this.listeners[u] = ((p = this.listeners[u]) == null ? void 0 : p.filter((g) => g !== m)) ?? [] : delete this.listeners[u];
153
153
  });
154
154
  q(this, "emit", (u, ...m) => {
155
155
  var p;
156
- (p = this.listeners[ye(u)]) == null || p.forEach((g) => g(...m));
156
+ (p = this.listeners[we(u)]) == null || p.forEach((g) => g(...m));
157
157
  });
158
158
  q(this, "registerEventListenersFromProps", (u) => {
159
159
  const m = [];
160
160
  return Object.keys(u).filter((p) => p.startsWith("on")).forEach((p) => {
161
- const g = ye(p).replace(/^on-/, "");
161
+ const g = we(p).replace(/^on-/, "");
162
162
  this.on(g, u[p]), m.push(() => this.off(g, u[p]));
163
163
  }), () => m.forEach((p) => p());
164
164
  });
165
165
  q(this, "reload", (u = {}) => {
166
166
  var p;
167
167
  let m = Object.keys(this.response.props);
168
- u.only && (m = Ct(m, u.only)), u.except && (m = On(m, u.except)), (p = this.response) != null && p.url && De.get(this.response.url, {
168
+ u.only && (m = Ft(m, u.only)), u.except && (m = On(m, u.except)), (p = this.response) != null && p.url && De.get(this.response.url, {
169
169
  headers: {
170
170
  Accept: "text/html, application/xhtml+xml",
171
171
  "X-Inertia": !0,
@@ -181,19 +181,19 @@ const Sn = ({ children: e }) => {
181
181
  });
182
182
  });
183
183
  q(this, "updateProps", (u) => {
184
- Object.assign(this.props, u), a((m) => m);
184
+ Object.assign(this.props, u), o((m) => m);
185
185
  });
186
- if (this.id = m.id ?? et(), this.isOpen = !1, this.shouldRender = !1, this.listeners = {}, this.component = u, this.props = m.props, this.response = m, this.config = p ?? {}, this.onCloseCallback = g, this.afterLeaveCallback = x, fe[this.id]) {
186
+ if (this.id = m.id ?? et(), this.isOpen = !1, this.shouldRender = !1, this.listeners = {}, this.component = u, this.props = m.props, this.response = m, this.config = p ?? {}, this.onCloseCallback = g, this.afterLeaveCallback = x, de[this.id]) {
187
187
  this.config = {
188
188
  ...this.config,
189
- ...fe[this.id].config ?? {}
189
+ ...de[this.id].config ?? {}
190
190
  };
191
- const h = fe[this.id].onClose, $ = fe[this.id].onAfterLeave;
191
+ const h = de[this.id].onClose, $ = de[this.id].onAfterLeave;
192
192
  h && (this.onCloseCallback = g ? () => {
193
193
  g(), h();
194
194
  } : h), $ && (this.afterLeaveCallback = x ? () => {
195
195
  x(), $();
196
- } : $), delete fe[this.id];
196
+ } : $), delete de[this.id];
197
197
  }
198
198
  this.index = -1, this.getParentModal = () => null, this.getChildModal = () => null, this.onTopOfStack = !0;
199
199
  }
@@ -201,11 +201,11 @@ const Sn = ({ children: e }) => {
201
201
  return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? `inertiaui_modal_${crypto.randomUUID()}` : `inertiaui_modal_${Date.now().toString(36)}_${Math.random().toString(36).substr(2, 9)}`;
202
202
  }
203
203
  }
204
- const s = (v, u = {}, m = null, p = null) => At(v.component).then((g) => i(g, v, u, m, p)), i = (v, u, m, p, g) => {
205
- const x = new o(v, u, m, p, g);
206
- return x.index = t.length, a((h) => [...h, x]), x.show(), x;
204
+ const s = (v, u = {}, m = null, p = null) => kt(v.component).then((g) => i(g, v, u, m, p)), i = (v, u, m, p, g) => {
205
+ const x = new a(v, u, m, p, g);
206
+ return x.index = t.length, o((h) => [...h, x]), x.show(), x;
207
207
  };
208
- function d(v, u, m, p) {
208
+ function c(v, u, m, p) {
209
209
  if (!r[v])
210
210
  throw new Error(`The local modal "${v}" has not been registered.`);
211
211
  const g = i(null, {}, u, m, p);
@@ -224,39 +224,39 @@ const Sn = ({ children: e }) => {
224
224
  ).then((m) => {
225
225
  const p = u.listeners ?? {};
226
226
  return Object.keys(p).forEach((g) => {
227
- const x = ye(g);
227
+ const x = we(g);
228
228
  m.on(x, p[g]);
229
229
  }), m;
230
230
  }), y = (v, u, m = {}, p = {}, g = {}, x = null, h = null, $ = "brackets", F = !1) => {
231
231
  const j = et();
232
- return new Promise((_, A) => {
232
+ return new Promise((_, N) => {
233
233
  if (v.startsWith("#")) {
234
- _(d(v.substring(1), g, x, h));
234
+ _(c(v.substring(1), g, x, h));
235
235
  return;
236
236
  }
237
- const [U, B] = En(u, v || "", m, $);
237
+ const [U, B] = bn(u, v || "", m, $);
238
238
  let X = F && t.length === 0;
239
239
  if (t.length === 0 && ($e = typeof window < "u" ? window.location.href : ""), p = {
240
240
  ...p,
241
241
  Accept: "text/html, application/xhtml+xml",
242
242
  "X-Requested-With": "XMLHttpRequest",
243
243
  "X-Inertia": !0,
244
- "X-Inertia-Version": kt,
244
+ "X-Inertia-Version": Ct,
245
245
  "X-InertiaUI-Modal": j,
246
246
  "X-InertiaUI-Modal-Use-Router": X ? 1 : 0,
247
247
  "X-InertiaUI-Modal-Base-Url": $e
248
248
  }, X)
249
- return rt = null, fe[j] = {
249
+ return rt = null, de[j] = {
250
250
  config: g,
251
251
  onClose: x,
252
252
  onAfterLeave: h
253
- }, le.visit(U, {
253
+ }, xe.visit(U, {
254
254
  method: u,
255
255
  data: B,
256
256
  headers: p,
257
257
  preserveScroll: !0,
258
258
  preserveState: !0,
259
- onError: A,
259
+ onError: N,
260
260
  onFinish: () => {
261
261
  Mn(() => rt).then(_);
262
262
  }
@@ -267,10 +267,10 @@ const Sn = ({ children: e }) => {
267
267
  data: B,
268
268
  headers: p
269
269
  }).then((P) => _(s(P.data, g, x, h))).catch((P) => {
270
- A(P);
270
+ N(P);
271
271
  });
272
272
  });
273
- }, c = {
273
+ }, d = {
274
274
  stack: t,
275
275
  localModals: r,
276
276
  push: i,
@@ -279,7 +279,7 @@ const Sn = ({ children: e }) => {
279
279
  closeAll: () => {
280
280
  Ie.reverse().forEach((v) => v.close());
281
281
  },
282
- reset: () => a(() => []),
282
+ reset: () => o(() => []),
283
283
  visit: y,
284
284
  visitModal: f,
285
285
  registerLocalModal: (v, u) => {
@@ -295,78 +295,37 @@ const Sn = ({ children: e }) => {
295
295
  });
296
296
  }
297
297
  };
298
- return /* @__PURE__ */ T(Be.Provider, { value: c, children: e });
298
+ return /* @__PURE__ */ T(Be.Provider, { value: d, children: e });
299
299
  }, Xe = () => {
300
300
  const e = R(Be);
301
301
  if (e === null)
302
302
  throw new Error("useModalStack must be used within a ModalStackProvider");
303
303
  return e;
304
- }, bt = ["closeButton", "closeExplicitly", "maxWidth", "paddingClasses", "panelClasses", "position", "slideover"], Ln = (e) => {
305
- e.initialPage && (kt = e.initialPage.version), e.resolveComponent && (At = e.resolveComponent);
306
- }, Fl = (e, t) => (Ln(t), /* @__PURE__ */ T(Sn, { children: /* @__PURE__ */ T(e, { ...t, children: ({ Component: r, props: l, key: a }) => /* @__PURE__ */ ue(ct, { children: [
304
+ }, xt = ["closeButton", "closeExplicitly", "maxWidth", "paddingClasses", "panelClasses", "position", "slideover"], Sn = (e) => {
305
+ e.initialPage && (Ct = e.initialPage.version), e.resolveComponent && (kt = e.resolveComponent);
306
+ }, Fl = (e, t) => (Sn(t), /* @__PURE__ */ T(Ln, { children: /* @__PURE__ */ T(e, { ...t, children: ({ Component: r, props: l, key: o }) => /* @__PURE__ */ se(dt, { children: [
307
307
  (() => {
308
- const s = Re(r, { key: a, ...l });
309
- return typeof r.layout == "function" ? r.layout(s) : Array.isArray(r.layout) ? r.layout.concat(s).reverse().reduce((d, f) => Re(f, l, d)) : s;
308
+ const s = Re(r, { key: o, ...l });
309
+ return typeof r.layout == "function" ? r.layout(s) : Array.isArray(r.layout) ? r.layout.concat(s).reverse().reduce((c, f) => Re(f, l, c)) : s;
310
310
  })(),
311
311
  /* @__PURE__ */ T(Fn, {})
312
312
  ] }) }) })), Fn = ({ children: e }) => {
313
313
  var s;
314
314
  const t = R(Be);
315
315
  let n = !1, r = !1;
316
- M(
317
- () => le.on("before", (i) => {
318
- if (!xt(window.location.href, i.detail.visit.url) || i.detail.visit.replace || t.length() !== 1 || !r)
319
- return !0;
320
- const {
321
- method: d,
322
- data: f,
323
- only: y,
324
- except: b,
325
- headers: w,
326
- errorBag: c,
327
- forceFormData: v,
328
- queryStringArrayFormat: u,
329
- async: m,
330
- showProgress: p,
331
- prefetch: g,
332
- fresh: x,
333
- reset: h,
334
- preserveUrl: $
335
- } = i.detail.visit;
336
- return le.visit(i.detail.visit.url, {
337
- replace: !0,
338
- preserveScroll: !0,
339
- preserveState: !0,
340
- method: d,
341
- data: f,
342
- only: y,
343
- except: b,
344
- headers: w,
345
- errorBag: c,
346
- forceFormData: v,
347
- queryStringArrayFormat: u,
348
- async: m,
349
- showProgress: p,
350
- prefetch: g,
351
- fresh: x,
352
- reset: h,
353
- preserveUrl: $
354
- }), !1;
355
- }),
356
- []
357
- ), M(() => le.on("start", () => n = !0), []), M(() => le.on("finish", () => n = !1), []), M(
358
- () => le.on("navigate", function(i) {
359
- const d = i.detail.page.props._inertiaui_modal;
360
- if (!d) {
316
+ M(() => xe.on("start", () => n = !0), []), M(() => xe.on("finish", () => n = !1), []), M(
317
+ () => xe.on("navigate", function(i) {
318
+ const c = i.detail.page.props._inertiaui_modal;
319
+ if (!c) {
361
320
  r && t.closeAll();
362
321
  return;
363
322
  }
364
- r = d, $e = d.baseUrl, t.pushFromResponseData(d, {}, () => {
365
- if (!d.baseUrl) {
323
+ r = c, $e = c.baseUrl, t.pushFromResponseData(c, {}, () => {
324
+ if (!c.baseUrl) {
366
325
  console.error("No base url in modal response data so cannot navigate back");
367
326
  return;
368
327
  }
369
- !n && window.location.href !== d.baseUrl && le.visit(d.baseUrl, {
328
+ !n && window.location.href !== c.baseUrl && xe.visit(c.baseUrl, {
370
329
  preserveScroll: !0,
371
330
  preserveState: !0
372
331
  });
@@ -378,14 +337,14 @@ const Sn = ({ children: e }) => {
378
337
  );
379
338
  const l = (i) => (Ie.length && (i.headers["X-InertiaUI-Modal-Base-Url"] = $e), i);
380
339
  M(() => (De.interceptors.request.use(l), () => De.interceptors.request.eject(l)), []);
381
- const a = bn(), o = O();
340
+ const o = xn(), a = O();
382
341
  return M(() => {
383
342
  var f, y;
384
- const i = (f = a.props) == null ? void 0 : f._inertiaui_modal, d = o.current;
385
- o.current = i, i && d && i.component === d.component && xt(i.url, d.url) && ((y = t.stack[0]) == null || y.updateProps(i.props ?? {}));
386
- }, [(s = a.props) == null ? void 0 : s._inertiaui_modal]), /* @__PURE__ */ ue(ct, { children: [
343
+ const i = (f = o.props) == null ? void 0 : f._inertiaui_modal, c = a.current;
344
+ a.current = i, i && c && i.component === c.component && Tn(i.url, c.url) && ((y = t.stack[0]) == null || y.updateProps(i.props ?? {}));
345
+ }, [(s = o.props) == null ? void 0 : s._inertiaui_modal]), /* @__PURE__ */ se(dt, { children: [
387
346
  e,
388
- t.stack.length > 0 && /* @__PURE__ */ T(It, { index: 0 })
347
+ t.stack.length > 0 && /* @__PURE__ */ T(At, { index: 0 })
389
348
  ] });
390
349
  }, mt = E.createContext(null);
391
350
  mt.displayName = "ModalIndexContext";
@@ -394,7 +353,7 @@ const Nt = () => {
394
353
  if (e === void 0)
395
354
  throw new Error("useModalIndex must be used within a ModalIndexProvider");
396
355
  return e;
397
- }, It = ({ index: e }) => {
356
+ }, At = ({ index: e }) => {
398
357
  const { stack: t } = Xe(), n = C(() => t[e], [t, e]);
399
358
  return (n == null ? void 0 : n.component) && /* @__PURE__ */ T(mt.Provider, { value: e, children: /* @__PURE__ */ T(
400
359
  n.component,
@@ -403,44 +362,44 @@ const Nt = () => {
403
362
  onModalEvent: (...r) => n.emit(...r)
404
363
  }
405
364
  ) });
406
- }, Rt = dt(({ name: e, children: t, onFocus: n = null, onBlur: r = null, onClose: l = null, onSuccess: a = null, ...o }, s) => {
407
- const i = Nt(), { stack: d, registerLocalModal: f, removeLocalModal: y } = Xe(), [b, w] = L(null), c = C(() => e ? b : d[i], [e, b, i, d]), v = C(() => {
365
+ }, It = ct(({ name: e, children: t, onFocus: n = null, onBlur: r = null, onClose: l = null, onSuccess: o = null, ...a }, s) => {
366
+ const i = Nt(), { stack: c, registerLocalModal: f, removeLocalModal: y } = Xe(), [b, w] = S(null), d = C(() => e ? b : c[i], [e, b, i, c]), v = C(() => {
408
367
  var h;
409
- return (h = d.find(($) => $.shouldRender && $.index > (c == null ? void 0 : c.index))) == null ? void 0 : h.index;
410
- }, [i, d]), u = C(() => (c == null ? void 0 : c.config.slideover) ?? o.slideover ?? ft("type") === "slideover", [o.slideover]), m = C(
368
+ return (h = c.find(($) => $.shouldRender && $.index > (d == null ? void 0 : d.index))) == null ? void 0 : h.index;
369
+ }, [i, c]), u = C(() => (d == null ? void 0 : d.config.slideover) ?? a.slideover ?? ft("type") === "slideover", [a.slideover]), m = C(
411
370
  () => ({
412
371
  slideover: u,
413
- closeButton: o.closeButton ?? ce(u, "closeButton"),
414
- closeExplicitly: o.closeExplicitly ?? ce(u, "closeExplicitly"),
415
- maxWidth: o.maxWidth ?? ce(u, "maxWidth"),
416
- paddingClasses: o.paddingClasses ?? ce(u, "paddingClasses"),
417
- panelClasses: o.panelClasses ?? ce(u, "panelClasses"),
418
- position: o.position ?? ce(u, "position"),
419
- ...c == null ? void 0 : c.config
372
+ closeButton: a.closeButton ?? ce(u, "closeButton"),
373
+ closeExplicitly: a.closeExplicitly ?? ce(u, "closeExplicitly"),
374
+ maxWidth: a.maxWidth ?? ce(u, "maxWidth"),
375
+ paddingClasses: a.paddingClasses ?? ce(u, "paddingClasses"),
376
+ panelClasses: a.panelClasses ?? ce(u, "panelClasses"),
377
+ position: a.position ?? ce(u, "position"),
378
+ ...d == null ? void 0 : d.config
420
379
  }),
421
- [o, c == null ? void 0 : c.config]
380
+ [a, d == null ? void 0 : d.config]
422
381
  );
423
382
  M(() => {
424
383
  if (e) {
425
384
  let h = null;
426
385
  return f(e, ($) => {
427
- h = $.registerEventListenersFromProps(o), w($);
386
+ h = $.registerEventListenersFromProps(a), w($);
428
387
  }), () => {
429
388
  h == null || h(), h = null, y(e);
430
389
  };
431
390
  }
432
- return c.registerEventListenersFromProps(o);
391
+ return d.registerEventListenersFromProps(a);
433
392
  }, [e]);
434
- const p = O(c);
393
+ const p = O(d);
435
394
  M(() => {
436
- p.current = c;
437
- }, [c]), M(() => {
438
- c !== null && (c.isOpen ? a == null || a() : l == null || l());
439
- }, [c == null ? void 0 : c.isOpen]);
440
- const [g, x] = L(!1);
395
+ p.current = d;
396
+ }, [d]), M(() => {
397
+ d !== null && (d.isOpen ? o == null || o() : l == null || l());
398
+ }, [d == null ? void 0 : d.isOpen]);
399
+ const [g, x] = S(!1);
441
400
  return M(() => {
442
- g && c !== null && c.isOpen && (c.onTopOfStack ? n == null || n() : r == null || r()), x(!0);
443
- }, [c == null ? void 0 : c.onTopOfStack]), Ft(
401
+ g && d !== null && d.isOpen && (d.onTopOfStack ? n == null || n() : r == null || r()), x(!0);
402
+ }, [d == null ? void 0 : d.onTopOfStack]), St(
444
403
  s,
445
404
  () => ({
446
405
  afterLeave: () => {
@@ -499,43 +458,43 @@ const Nt = () => {
499
458
  return (h = p.current) == null ? void 0 : h.shouldRender;
500
459
  }
501
460
  }),
502
- [c]
503
- ), (c == null ? void 0 : c.shouldRender) && /* @__PURE__ */ ue(ct, { children: [
461
+ [d]
462
+ ), (d == null ? void 0 : d.shouldRender) && /* @__PURE__ */ se(dt, { children: [
504
463
  typeof t == "function" ? t({
505
- afterLeave: c.afterLeave,
506
- close: c.close,
464
+ afterLeave: d.afterLeave,
465
+ close: d.close,
507
466
  config: m,
508
- emit: c.emit,
509
- getChildModal: c.getChildModal,
510
- getParentModal: c.getParentModal,
511
- id: c.id,
512
- index: c.index,
513
- isOpen: c.isOpen,
514
- modalContext: c,
515
- onTopOfStack: c.onTopOfStack,
516
- reload: c.reload,
517
- setOpen: c.setOpen,
518
- shouldRender: c.shouldRender
467
+ emit: d.emit,
468
+ getChildModal: d.getChildModal,
469
+ getParentModal: d.getParentModal,
470
+ id: d.id,
471
+ index: d.index,
472
+ isOpen: d.isOpen,
473
+ modalContext: d,
474
+ onTopOfStack: d.onTopOfStack,
475
+ reload: d.reload,
476
+ setOpen: d.setOpen,
477
+ shouldRender: d.shouldRender
519
478
  }) : t,
520
- v && /* @__PURE__ */ T(It, { index: v })
479
+ v && /* @__PURE__ */ T(At, { index: v })
521
480
  ] });
522
481
  });
523
- Rt.displayName = "HeadlessModal";
524
- function Dt(e) {
482
+ It.displayName = "HeadlessModal";
483
+ function Rt(e) {
525
484
  var t, n, r = "";
526
485
  if (typeof e == "string" || typeof e == "number") r += e;
527
486
  else if (typeof e == "object") if (Array.isArray(e)) {
528
487
  var l = e.length;
529
- for (t = 0; t < l; t++) e[t] && (n = Dt(e[t])) && (r && (r += " "), r += n);
488
+ for (t = 0; t < l; t++) e[t] && (n = Rt(e[t])) && (r && (r += " "), r += n);
530
489
  } else for (n in e) e[n] && (r && (r += " "), r += n);
531
490
  return r;
532
491
  }
533
492
  function je() {
534
- for (var e, t, n = 0, r = "", l = arguments.length; n < l; n++) (e = arguments[n]) && (t = Dt(e)) && (r && (r += " "), r += t);
493
+ for (var e, t, n = 0, r = "", l = arguments.length; n < l; n++) (e = arguments[n]) && (t = Rt(e)) && (r && (r += " "), r += t);
535
494
  return r;
536
495
  }
537
496
  var Cn = Object.defineProperty, kn = (e, t, n) => t in e ? Cn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, tt = (e, t, n) => (kn(e, typeof t != "symbol" ? t + "" : t, n), n);
538
- let An = class {
497
+ let Nn = class {
539
498
  constructor() {
540
499
  tt(this, "current", this.detect()), tt(this, "handoffState", "pending"), tt(this, "currentId", 0);
541
500
  }
@@ -563,9 +522,9 @@ let An = class {
563
522
  get isHandoffComplete() {
564
523
  return this.handoffState === "complete";
565
524
  }
566
- }, se = new An();
525
+ }, ae = new Nn();
567
526
  function Ve(e) {
568
- return se.isServer ? null : e instanceof Node ? e.ownerDocument : e != null && e.hasOwnProperty("current") && e.current instanceof Node ? e.current.ownerDocument : document;
527
+ return ae.isServer ? null : e instanceof Node ? e.ownerDocument : e != null && e.hasOwnProperty("current") && e.current instanceof Node ? e.current.ownerDocument : document;
569
528
  }
570
529
  function qe(e) {
571
530
  typeof queueMicrotask == "function" ? queueMicrotask(e) : Promise.resolve().then(e).catch((t) => setTimeout(() => {
@@ -573,8 +532,8 @@ function qe(e) {
573
532
  }));
574
533
  }
575
534
  function re() {
576
- let e = [], t = { addEventListener(n, r, l, a) {
577
- return n.addEventListener(r, l, a), t.add(() => n.removeEventListener(r, l, a));
535
+ let e = [], t = { addEventListener(n, r, l, o) {
536
+ return n.addEventListener(r, l, o), t.add(() => n.removeEventListener(r, l, o));
578
537
  }, requestAnimationFrame(...n) {
579
538
  let r = requestAnimationFrame(...n);
580
539
  return t.add(() => cancelAnimationFrame(r));
@@ -591,9 +550,9 @@ function re() {
591
550
  r.current = !1;
592
551
  });
593
552
  }, style(n, r, l) {
594
- let a = n.style.getPropertyValue(r);
553
+ let o = n.style.getPropertyValue(r);
595
554
  return Object.assign(n.style, { [r]: l }), this.add(() => {
596
- Object.assign(n.style, { [r]: a });
555
+ Object.assign(n.style, { [r]: o });
597
556
  });
598
557
  }, group(n) {
599
558
  let r = re();
@@ -609,24 +568,24 @@ function re() {
609
568
  return t;
610
569
  }
611
570
  function pt() {
612
- let [e] = L(re);
571
+ let [e] = S(re);
613
572
  return M(() => () => e.dispose(), [e]), e;
614
573
  }
615
- let N = (e, t) => {
616
- se.isServer ? M(e, t) : hn(e, t);
574
+ let A = (e, t) => {
575
+ ae.isServer ? M(e, t) : pn(e, t);
617
576
  };
618
- function de(e) {
577
+ function ue(e) {
619
578
  let t = O(e);
620
- return N(() => {
579
+ return A(() => {
621
580
  t.current = e;
622
581
  }, [e]), t;
623
582
  }
624
- let S = function(e) {
625
- let t = de(e);
583
+ let L = function(e) {
584
+ let t = ue(e);
626
585
  return E.useCallback((...n) => t.current(...n), [t]);
627
- }, Nn = H(void 0);
586
+ }, An = H(void 0);
628
587
  function In() {
629
- return R(Nn);
588
+ return R(An);
630
589
  }
631
590
  function lt(...e) {
632
591
  return Array.from(new Set(e.flatMap((t) => typeof t == "string" ? t.split(" ") : []))).filter(Boolean).join(" ");
@@ -644,48 +603,48 @@ function W() {
644
603
  let e = Dn();
645
604
  return Y((t) => Rn({ mergeRefs: e, ...t }), [e]);
646
605
  }
647
- function Rn({ ourProps: e, theirProps: t, slot: n, defaultTag: r, features: l, visible: a = !0, name: o, mergeRefs: s }) {
606
+ function Rn({ ourProps: e, theirProps: t, slot: n, defaultTag: r, features: l, visible: o = !0, name: a, mergeRefs: s }) {
648
607
  s = s ?? jn;
649
- let i = jt(t, e);
650
- if (a) return Ne(i, n, r, o, s);
651
- let d = l ?? 0;
652
- if (d & 2) {
608
+ let i = Dt(t, e);
609
+ if (o) return Ae(i, n, r, a, s);
610
+ let c = l ?? 0;
611
+ if (c & 2) {
653
612
  let { static: f = !1, ...y } = i;
654
- if (f) return Ne(y, n, r, o, s);
613
+ if (f) return Ae(y, n, r, a, s);
655
614
  }
656
- if (d & 1) {
615
+ if (c & 1) {
657
616
  let { unmount: f = !0, ...y } = i;
658
617
  return ne(f ? 0 : 1, { 0() {
659
618
  return null;
660
619
  }, 1() {
661
- return Ne({ ...y, hidden: !0, style: { display: "none" } }, n, r, o, s);
620
+ return Ae({ ...y, hidden: !0, style: { display: "none" } }, n, r, a, s);
662
621
  } });
663
622
  }
664
- return Ne(i, n, r, o, s);
623
+ return Ae(i, n, r, a, s);
665
624
  }
666
- function Ne(e, t = {}, n, r, l) {
667
- let { as: a = n, children: o, refName: s = "ref", ...i } = nt(e, ["unmount", "static"]), d = e.ref !== void 0 ? { [s]: e.ref } : {}, f = typeof o == "function" ? o(t) : o;
625
+ function Ae(e, t = {}, n, r, l) {
626
+ let { as: o = n, children: a, refName: s = "ref", ...i } = nt(e, ["unmount", "static"]), c = e.ref !== void 0 ? { [s]: e.ref } : {}, f = typeof a == "function" ? a(t) : a;
668
627
  "className" in i && i.className && typeof i.className == "function" && (i.className = i.className(t)), i["aria-labelledby"] && i["aria-labelledby"] === i.id && (i["aria-labelledby"] = void 0);
669
628
  let y = {};
670
629
  if (t) {
671
630
  let b = !1, w = [];
672
- for (let [c, v] of Object.entries(t)) typeof v == "boolean" && (b = !0), v === !0 && w.push(c.replace(/([A-Z])/g, (u) => `-${u.toLowerCase()}`));
631
+ for (let [d, v] of Object.entries(t)) typeof v == "boolean" && (b = !0), v === !0 && w.push(d.replace(/([A-Z])/g, (u) => `-${u.toLowerCase()}`));
673
632
  if (b) {
674
633
  y["data-headlessui-state"] = w.join(" ");
675
- for (let c of w) y[`data-${c}`] = "";
634
+ for (let d of w) y[`data-${d}`] = "";
676
635
  }
677
636
  }
678
- if (a === G && (Object.keys(ie(i)).length > 0 || Object.keys(ie(y)).length > 0)) if (!vn(f) || Array.isArray(f) && f.length > 1) {
679
- if (Object.keys(ie(i)).length > 0) throw new Error(['Passing props on "Fragment"!', "", `The current component <${r} /> is rendering a "Fragment".`, "However we need to passthrough the following props:", Object.keys(ie(i)).concat(Object.keys(ie(y))).map((b) => ` - ${b}`).join(`
637
+ if (o === G && (Object.keys(le(i)).length > 0 || Object.keys(le(y)).length > 0)) if (!hn(f) || Array.isArray(f) && f.length > 1) {
638
+ if (Object.keys(le(i)).length > 0) throw new Error(['Passing props on "Fragment"!', "", `The current component <${r} /> is rendering a "Fragment".`, "However we need to passthrough the following props:", Object.keys(le(i)).concat(Object.keys(le(y))).map((b) => ` - ${b}`).join(`
680
639
  `), "", "You can apply a few solutions:", ['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".', "Render a single element as the child so that we can forward the props onto that element."].map((b) => ` - ${b}`).join(`
681
640
  `)].join(`
682
641
  `));
683
642
  } else {
684
- let b = f.props, w = b == null ? void 0 : b.className, c = typeof w == "function" ? (...m) => lt(w(...m), i.className) : lt(w, i.className), v = c ? { className: c } : {}, u = jt(f.props, ie(nt(i, ["ref"])));
643
+ let b = f.props, w = b == null ? void 0 : b.className, d = typeof w == "function" ? (...m) => lt(w(...m), i.className) : lt(w, i.className), v = d ? { className: d } : {}, u = Dt(f.props, le(nt(i, ["ref"])));
685
644
  for (let m in y) m in u && delete y[m];
686
- return gn(f, Object.assign({}, u, y, d, { ref: l(Un(f), d.ref) }, v));
645
+ return vn(f, Object.assign({}, u, y, c, { ref: l(Un(f), c.ref) }, v));
687
646
  }
688
- return Re(a, Object.assign({}, nt(i, ["ref"]), a !== G && d, a !== G && y), f);
647
+ return Re(o, Object.assign({}, nt(i, ["ref"]), o !== G && c, o !== G && y), f);
689
648
  }
690
649
  function Dn() {
691
650
  let e = O([]), t = Y((n) => {
@@ -700,29 +659,29 @@ function jn(...e) {
700
659
  for (let n of e) n != null && (typeof n == "function" ? n(t) : n.current = t);
701
660
  };
702
661
  }
703
- function jt(...e) {
662
+ function Dt(...e) {
704
663
  if (e.length === 0) return {};
705
664
  if (e.length === 1) return e[0];
706
665
  let t = {}, n = {};
707
666
  for (let r of e) for (let l in r) l.startsWith("on") && typeof r[l] == "function" ? (n[l] != null || (n[l] = []), n[l].push(r[l])) : t[l] = r[l];
708
667
  if (t.disabled || t["aria-disabled"]) for (let r in n) /^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(r) && (n[r] = [(l) => {
709
- var a;
710
- return (a = l == null ? void 0 : l.preventDefault) == null ? void 0 : a.call(l);
668
+ var o;
669
+ return (o = l == null ? void 0 : l.preventDefault) == null ? void 0 : o.call(l);
711
670
  }]);
712
- for (let r in n) Object.assign(t, { [r](l, ...a) {
713
- let o = n[r];
714
- for (let s of o) {
671
+ for (let r in n) Object.assign(t, { [r](l, ...o) {
672
+ let a = n[r];
673
+ for (let s of a) {
715
674
  if ((l instanceof Event || (l == null ? void 0 : l.nativeEvent) instanceof Event) && l.defaultPrevented) return;
716
- s(l, ...a);
675
+ s(l, ...o);
717
676
  }
718
677
  } });
719
678
  return t;
720
679
  }
721
680
  function D(e) {
722
681
  var t;
723
- return Object.assign(dt(e), { displayName: (t = e.displayName) != null ? t : e.name });
682
+ return Object.assign(ct(e), { displayName: (t = e.displayName) != null ? t : e.name });
724
683
  }
725
- function ie(e) {
684
+ function le(e) {
726
685
  let t = Object.assign({}, e);
727
686
  for (let n in t) t[n] === void 0 && delete t[n];
728
687
  return t;
@@ -739,38 +698,38 @@ let Hn = "span";
739
698
  var He = ((e) => (e[e.None = 1] = "None", e[e.Focusable = 2] = "Focusable", e[e.Hidden = 4] = "Hidden", e))(He || {});
740
699
  function Wn(e, t) {
741
700
  var n;
742
- let { features: r = 1, ...l } = e, a = { ref: t, "aria-hidden": (r & 2) === 2 ? !0 : (n = l["aria-hidden"]) != null ? n : void 0, hidden: (r & 4) === 4 ? !0 : void 0, style: { position: "fixed", top: 1, left: 1, width: 1, height: 0, padding: 0, margin: -1, overflow: "hidden", clip: "rect(0, 0, 0, 0)", whiteSpace: "nowrap", borderWidth: "0", ...(r & 4) === 4 && (r & 2) !== 2 && { display: "none" } } };
743
- return W()({ ourProps: a, theirProps: l, slot: {}, defaultTag: Hn, name: "Hidden" });
701
+ let { features: r = 1, ...l } = e, o = { ref: t, "aria-hidden": (r & 2) === 2 ? !0 : (n = l["aria-hidden"]) != null ? n : void 0, hidden: (r & 4) === 4 ? !0 : void 0, style: { position: "fixed", top: 1, left: 1, width: 1, height: 0, padding: 0, margin: -1, overflow: "hidden", clip: "rect(0, 0, 0, 0)", whiteSpace: "nowrap", borderWidth: "0", ...(r & 4) === 4 && (r & 2) !== 2 && { display: "none" } } };
702
+ return W()({ ourProps: o, theirProps: l, slot: {}, defaultTag: Hn, name: "Hidden" });
744
703
  }
745
- let it = D(Wn), Ut = Symbol();
704
+ let it = D(Wn), jt = Symbol();
746
705
  function _n(e, t = !0) {
747
- return Object.assign(e, { [Ut]: t });
706
+ return Object.assign(e, { [jt]: t });
748
707
  }
749
708
  function Z(...e) {
750
709
  let t = O(e);
751
710
  M(() => {
752
711
  t.current = e;
753
712
  }, [e]);
754
- let n = S((r) => {
713
+ let n = L((r) => {
755
714
  for (let l of t.current) l != null && (typeof l == "function" ? l(r) : l.current = r);
756
715
  });
757
- return e.every((r) => r == null || (r == null ? void 0 : r[Ut])) ? void 0 : n;
716
+ return e.every((r) => r == null || (r == null ? void 0 : r[jt])) ? void 0 : n;
758
717
  }
759
718
  let ht = H(null);
760
719
  ht.displayName = "DescriptionContext";
761
- function Ht() {
720
+ function Ut() {
762
721
  let e = R(ht);
763
722
  if (e === null) {
764
723
  let t = new Error("You used a <Description /> component, but it is not inside a relevant parent.");
765
- throw Error.captureStackTrace && Error.captureStackTrace(t, Ht), t;
724
+ throw Error.captureStackTrace && Error.captureStackTrace(t, Ut), t;
766
725
  }
767
726
  return e;
768
727
  }
769
728
  function Bn() {
770
- let [e, t] = L([]);
729
+ let [e, t] = S([]);
771
730
  return [e.length > 0 ? e.join(" ") : void 0, C(() => function(n) {
772
- let r = S((a) => (t((o) => [...o, a]), () => t((o) => {
773
- let s = o.slice(), i = s.indexOf(a);
731
+ let r = L((o) => (t((a) => [...a, o]), () => t((a) => {
732
+ let s = a.slice(), i = s.indexOf(o);
774
733
  return i !== -1 && s.splice(i, 1), s;
775
734
  }))), l = C(() => ({ register: r, slot: n.slot, name: n.name, props: n.props, value: n.value }), [r, n.slot, n.name, n.props, n.value]);
776
735
  return E.createElement(ht.Provider, { value: l }, n.children);
@@ -778,13 +737,13 @@ function Bn() {
778
737
  }
779
738
  let Xn = "p";
780
739
  function Vn(e, t) {
781
- let n = Pe(), r = In(), { id: l = `headlessui-description-${n}`, ...a } = e, o = Ht(), s = Z(t);
782
- N(() => o.register(l), [l, o.register]);
783
- let i = r || !1, d = C(() => ({ ...o.slot, disabled: i }), [o.slot, i]), f = { ref: s, ...o.props, id: l };
784
- return W()({ ourProps: f, theirProps: a, slot: d, defaultTag: Xn, name: o.name || "Description" });
740
+ let n = Pe(), r = In(), { id: l = `headlessui-description-${n}`, ...o } = e, a = Ut(), s = Z(t);
741
+ A(() => a.register(l), [l, a.register]);
742
+ let i = r || !1, c = C(() => ({ ...a.slot, disabled: i }), [a.slot, i]), f = { ref: s, ...a.props, id: l };
743
+ return W()({ ourProps: f, theirProps: o, slot: c, defaultTag: Xn, name: a.name || "Description" });
785
744
  }
786
745
  let qn = D(Vn), Yn = Object.assign(qn, {});
787
- var Wt = ((e) => (e.Space = " ", e.Enter = "Enter", e.Escape = "Escape", e.Backspace = "Backspace", e.Delete = "Delete", e.ArrowLeft = "ArrowLeft", e.ArrowUp = "ArrowUp", e.ArrowRight = "ArrowRight", e.ArrowDown = "ArrowDown", e.Home = "Home", e.End = "End", e.PageUp = "PageUp", e.PageDown = "PageDown", e.Tab = "Tab", e))(Wt || {});
746
+ var Ht = ((e) => (e.Space = " ", e.Enter = "Enter", e.Escape = "Escape", e.Backspace = "Backspace", e.Delete = "Delete", e.ArrowLeft = "ArrowLeft", e.ArrowUp = "ArrowUp", e.ArrowRight = "ArrowRight", e.ArrowDown = "ArrowDown", e.Home = "Home", e.End = "End", e.PageUp = "PageUp", e.PageDown = "PageDown", e.Tab = "Tab", e))(Ht || {});
788
747
  let zn = H(() => {
789
748
  });
790
749
  function Gn({ value: e, children: t }) {
@@ -799,21 +758,21 @@ let Kn = class extends Map {
799
758
  return n === void 0 && (n = this.factory(t), this.set(t, n)), n;
800
759
  }
801
760
  };
802
- function _t(e, t) {
761
+ function Wt(e, t) {
803
762
  let n = e(), r = /* @__PURE__ */ new Set();
804
763
  return { getSnapshot() {
805
764
  return n;
806
765
  }, subscribe(l) {
807
766
  return r.add(l), () => r.delete(l);
808
- }, dispatch(l, ...a) {
809
- let o = t[l].call(n, ...a);
810
- o && (n = o, r.forEach((s) => s()));
767
+ }, dispatch(l, ...o) {
768
+ let a = t[l].call(n, ...o);
769
+ a && (n = a, r.forEach((s) => s()));
811
770
  } };
812
771
  }
813
- function Bt(e) {
814
- return wn(e.subscribe, e.getSnapshot, e.getSnapshot);
772
+ function _t(e) {
773
+ return gn(e.subscribe, e.getSnapshot, e.getSnapshot);
815
774
  }
816
- let Zn = new Kn(() => _t(() => [], { ADD(e) {
775
+ let Zn = new Kn(() => Wt(() => [], { ADD(e) {
817
776
  return this.includes(e) ? this : [...this, e];
818
777
  }, REMOVE(e) {
819
778
  let t = this.indexOf(e);
@@ -821,78 +780,78 @@ let Zn = new Kn(() => _t(() => [], { ADD(e) {
821
780
  let n = this.slice();
822
781
  return n.splice(t, 1), n;
823
782
  } }));
824
- function me(e, t) {
825
- let n = Zn.get(t), r = Pe(), l = Bt(n);
826
- if (N(() => {
783
+ function fe(e, t) {
784
+ let n = Zn.get(t), r = Pe(), l = _t(n);
785
+ if (A(() => {
827
786
  if (e) return n.dispatch("ADD", r), () => n.dispatch("REMOVE", r);
828
787
  }, [n, e]), !e) return !1;
829
- let a = l.indexOf(r), o = l.length;
830
- return a === -1 && (a = o, o += 1), a === o - 1;
788
+ let o = l.indexOf(r), a = l.length;
789
+ return o === -1 && (o = a, a += 1), o === a - 1;
831
790
  }
832
- let at = /* @__PURE__ */ new Map(), Te = /* @__PURE__ */ new Map();
833
- function Et(e) {
791
+ let ot = /* @__PURE__ */ new Map(), Te = /* @__PURE__ */ new Map();
792
+ function bt(e) {
834
793
  var t;
835
794
  let n = (t = Te.get(e)) != null ? t : 0;
836
- return Te.set(e, n + 1), n !== 0 ? () => $t(e) : (at.set(e, { "aria-hidden": e.getAttribute("aria-hidden"), inert: e.inert }), e.setAttribute("aria-hidden", "true"), e.inert = !0, () => $t(e));
795
+ return Te.set(e, n + 1), n !== 0 ? () => Et(e) : (ot.set(e, { "aria-hidden": e.getAttribute("aria-hidden"), inert: e.inert }), e.setAttribute("aria-hidden", "true"), e.inert = !0, () => Et(e));
837
796
  }
838
- function $t(e) {
797
+ function Et(e) {
839
798
  var t;
840
799
  let n = (t = Te.get(e)) != null ? t : 1;
841
800
  if (n === 1 ? Te.delete(e) : Te.set(e, n - 1), n !== 1) return;
842
- let r = at.get(e);
843
- r && (r["aria-hidden"] === null ? e.removeAttribute("aria-hidden") : e.setAttribute("aria-hidden", r["aria-hidden"]), e.inert = r.inert, at.delete(e));
801
+ let r = ot.get(e);
802
+ r && (r["aria-hidden"] === null ? e.removeAttribute("aria-hidden") : e.setAttribute("aria-hidden", r["aria-hidden"]), e.inert = r.inert, ot.delete(e));
844
803
  }
845
804
  function Jn(e, { allowed: t, disallowed: n } = {}) {
846
- let r = me(e, "inert-others");
847
- N(() => {
848
- var l, a;
805
+ let r = fe(e, "inert-others");
806
+ A(() => {
807
+ var l, o;
849
808
  if (!r) return;
850
- let o = re();
851
- for (let i of (l = n == null ? void 0 : n()) != null ? l : []) i && o.add(Et(i));
852
- let s = (a = t == null ? void 0 : t()) != null ? a : [];
809
+ let a = re();
810
+ for (let i of (l = n == null ? void 0 : n()) != null ? l : []) i && a.add(bt(i));
811
+ let s = (o = t == null ? void 0 : t()) != null ? o : [];
853
812
  for (let i of s) {
854
813
  if (!i) continue;
855
- let d = Ve(i);
856
- if (!d) continue;
814
+ let c = Ve(i);
815
+ if (!c) continue;
857
816
  let f = i.parentElement;
858
- for (; f && f !== d.body; ) {
859
- for (let y of f.children) s.some((b) => y.contains(b)) || o.add(Et(y));
817
+ for (; f && f !== c.body; ) {
818
+ for (let y of f.children) s.some((b) => y.contains(b)) || a.add(bt(y));
860
819
  f = f.parentElement;
861
820
  }
862
821
  }
863
- return o.dispose;
822
+ return a.dispose;
864
823
  }, [r, t, n]);
865
824
  }
866
825
  function Qn(e, t, n) {
867
- let r = de((l) => {
868
- let a = l.getBoundingClientRect();
869
- a.x === 0 && a.y === 0 && a.width === 0 && a.height === 0 && n();
826
+ let r = ue((l) => {
827
+ let o = l.getBoundingClientRect();
828
+ o.x === 0 && o.y === 0 && o.width === 0 && o.height === 0 && n();
870
829
  });
871
830
  M(() => {
872
831
  if (!e) return;
873
832
  let l = t === null ? null : t instanceof HTMLElement ? t : t.current;
874
833
  if (!l) return;
875
- let a = re();
834
+ let o = re();
876
835
  if (typeof ResizeObserver < "u") {
877
- let o = new ResizeObserver(() => r.current(l));
878
- o.observe(l), a.add(() => o.disconnect());
836
+ let a = new ResizeObserver(() => r.current(l));
837
+ a.observe(l), o.add(() => a.disconnect());
879
838
  }
880
839
  if (typeof IntersectionObserver < "u") {
881
- let o = new IntersectionObserver(() => r.current(l));
882
- o.observe(l), a.add(() => o.disconnect());
840
+ let a = new IntersectionObserver(() => r.current(l));
841
+ a.observe(l), o.add(() => a.disconnect());
883
842
  }
884
- return () => a.dispose();
843
+ return () => o.dispose();
885
844
  }, [t, r, e]);
886
845
  }
887
846
  let We = ["[contentEditable=true]", "[tabindex]", "a[href]", "area[href]", "button:not([disabled])", "iframe", "input:not([disabled])", "select:not([disabled])", "textarea:not([disabled])"].map((e) => `${e}:not([tabindex='-1'])`).join(","), er = ["[data-autofocus]"].map((e) => `${e}:not([tabindex='-1'])`).join(",");
888
- var J = ((e) => (e[e.First = 1] = "First", e[e.Previous = 2] = "Previous", e[e.Next = 4] = "Next", e[e.Last = 8] = "Last", e[e.WrapAround = 16] = "WrapAround", e[e.NoScroll = 32] = "NoScroll", e[e.AutoFocus = 64] = "AutoFocus", e))(J || {}), ot = ((e) => (e[e.Error = 0] = "Error", e[e.Overflow = 1] = "Overflow", e[e.Success = 2] = "Success", e[e.Underflow = 3] = "Underflow", e))(ot || {}), tr = ((e) => (e[e.Previous = -1] = "Previous", e[e.Next = 1] = "Next", e))(tr || {});
847
+ var J = ((e) => (e[e.First = 1] = "First", e[e.Previous = 2] = "Previous", e[e.Next = 4] = "Next", e[e.Last = 8] = "Last", e[e.WrapAround = 16] = "WrapAround", e[e.NoScroll = 32] = "NoScroll", e[e.AutoFocus = 64] = "AutoFocus", e))(J || {}), at = ((e) => (e[e.Error = 0] = "Error", e[e.Overflow = 1] = "Overflow", e[e.Success = 2] = "Success", e[e.Underflow = 3] = "Underflow", e))(at || {}), tr = ((e) => (e[e.Previous = -1] = "Previous", e[e.Next = 1] = "Next", e))(tr || {});
889
848
  function nr(e = document.body) {
890
849
  return e == null ? [] : Array.from(e.querySelectorAll(We)).sort((t, n) => Math.sign((t.tabIndex || Number.MAX_SAFE_INTEGER) - (n.tabIndex || Number.MAX_SAFE_INTEGER)));
891
850
  }
892
851
  function rr(e = document.body) {
893
852
  return e == null ? [] : Array.from(e.querySelectorAll(er)).sort((t, n) => Math.sign((t.tabIndex || Number.MAX_SAFE_INTEGER) - (n.tabIndex || Number.MAX_SAFE_INTEGER)));
894
853
  }
895
- var Xt = ((e) => (e[e.Strict = 0] = "Strict", e[e.Loose = 1] = "Loose", e))(Xt || {});
854
+ var Bt = ((e) => (e[e.Strict = 0] = "Strict", e[e.Loose = 1] = "Loose", e))(Bt || {});
896
855
  function lr(e, t = 0) {
897
856
  var n;
898
857
  return e === ((n = Ve(e)) == null ? void 0 : n.body) ? !1 : ne(t, { 0() {
@@ -915,33 +874,33 @@ typeof window < "u" && typeof document < "u" && (document.addEventListener("keyd
915
874
  function Q(e) {
916
875
  e == null || e.focus({ preventScroll: !0 });
917
876
  }
918
- let ar = ["textarea", "input"].join(",");
919
- function or(e) {
877
+ let or = ["textarea", "input"].join(",");
878
+ function ar(e) {
920
879
  var t, n;
921
- return (n = (t = e == null ? void 0 : e.matches) == null ? void 0 : t.call(e, ar)) != null ? n : !1;
880
+ return (n = (t = e == null ? void 0 : e.matches) == null ? void 0 : t.call(e, or)) != null ? n : !1;
922
881
  }
923
882
  function sr(e, t = (n) => n) {
924
883
  return e.slice().sort((n, r) => {
925
- let l = t(n), a = t(r);
926
- if (l === null || a === null) return 0;
927
- let o = l.compareDocumentPosition(a);
928
- return o & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : o & Node.DOCUMENT_POSITION_PRECEDING ? 1 : 0;
884
+ let l = t(n), o = t(r);
885
+ if (l === null || o === null) return 0;
886
+ let a = l.compareDocumentPosition(o);
887
+ return a & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : a & Node.DOCUMENT_POSITION_PRECEDING ? 1 : 0;
929
888
  });
930
889
  }
931
890
  function Oe(e, t, { sorted: n = !0, relativeTo: r = null, skipElements: l = [] } = {}) {
932
- let a = Array.isArray(e) ? e.length > 0 ? e[0].ownerDocument : document : e.ownerDocument, o = Array.isArray(e) ? n ? sr(e) : e : t & 64 ? rr(e) : nr(e);
933
- l.length > 0 && o.length > 1 && (o = o.filter((w) => !l.some((c) => c != null && "current" in c ? (c == null ? void 0 : c.current) === w : c === w))), r = r ?? a.activeElement;
891
+ let o = Array.isArray(e) ? e.length > 0 ? e[0].ownerDocument : document : e.ownerDocument, a = Array.isArray(e) ? n ? sr(e) : e : t & 64 ? rr(e) : nr(e);
892
+ l.length > 0 && a.length > 1 && (a = a.filter((w) => !l.some((d) => d != null && "current" in d ? (d == null ? void 0 : d.current) === w : d === w))), r = r ?? o.activeElement;
934
893
  let s = (() => {
935
894
  if (t & 5) return 1;
936
895
  if (t & 10) return -1;
937
896
  throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last");
938
897
  })(), i = (() => {
939
898
  if (t & 1) return 0;
940
- if (t & 2) return Math.max(0, o.indexOf(r)) - 1;
941
- if (t & 4) return Math.max(0, o.indexOf(r)) + 1;
942
- if (t & 8) return o.length - 1;
899
+ if (t & 2) return Math.max(0, a.indexOf(r)) - 1;
900
+ if (t & 4) return Math.max(0, a.indexOf(r)) + 1;
901
+ if (t & 8) return a.length - 1;
943
902
  throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last");
944
- })(), d = t & 32 ? { preventScroll: !0 } : {}, f = 0, y = o.length, b;
903
+ })(), c = t & 32 ? { preventScroll: !0 } : {}, f = 0, y = a.length, b;
945
904
  do {
946
905
  if (f >= y || f + y <= 0) return 0;
947
906
  let w = i + f;
@@ -950,79 +909,79 @@ function Oe(e, t, { sorted: n = !0, relativeTo: r = null, skipElements: l = [] }
950
909
  if (w < 0) return 3;
951
910
  if (w >= y) return 1;
952
911
  }
953
- b = o[w], b == null || b.focus(d), f += s;
954
- } while (b !== a.activeElement);
955
- return t & 6 && or(b) && b.select(), 2;
912
+ b = a[w], b == null || b.focus(c), f += s;
913
+ } while (b !== o.activeElement);
914
+ return t & 6 && ar(b) && b.select(), 2;
956
915
  }
957
- function Vt() {
916
+ function Xt() {
958
917
  return /iPhone/gi.test(window.navigator.platform) || /Mac/gi.test(window.navigator.platform) && window.navigator.maxTouchPoints > 0;
959
918
  }
960
919
  function ur() {
961
920
  return /Android/gi.test(window.navigator.userAgent);
962
921
  }
963
- function dr() {
964
- return Vt() || ur();
922
+ function cr() {
923
+ return Xt() || ur();
965
924
  }
966
- function xe(e, t, n, r) {
967
- let l = de(n);
925
+ function ye(e, t, n, r) {
926
+ let l = ue(n);
968
927
  M(() => {
969
928
  if (!e) return;
970
- function a(o) {
971
- l.current(o);
929
+ function o(a) {
930
+ l.current(a);
972
931
  }
973
- return document.addEventListener(t, a, r), () => document.removeEventListener(t, a, r);
932
+ return document.addEventListener(t, o, r), () => document.removeEventListener(t, o, r);
974
933
  }, [e, t, r]);
975
934
  }
976
- function qt(e, t, n, r) {
977
- let l = de(n);
935
+ function Vt(e, t, n, r) {
936
+ let l = ue(n);
978
937
  M(() => {
979
938
  if (!e) return;
980
- function a(o) {
981
- l.current(o);
939
+ function o(a) {
940
+ l.current(a);
982
941
  }
983
- return window.addEventListener(t, a, r), () => window.removeEventListener(t, a, r);
942
+ return window.addEventListener(t, o, r), () => window.removeEventListener(t, o, r);
984
943
  }, [e, t, r]);
985
944
  }
986
- const Tt = 30;
987
- function cr(e, t, n) {
988
- let r = me(e, "outside-click"), l = de(n), a = Y(function(i, d) {
945
+ const $t = 30;
946
+ function dr(e, t, n) {
947
+ let r = fe(e, "outside-click"), l = ue(n), o = Y(function(i, c) {
989
948
  if (i.defaultPrevented) return;
990
- let f = d(i);
949
+ let f = c(i);
991
950
  if (f === null || !f.getRootNode().contains(f) || !f.isConnected) return;
992
951
  let y = function b(w) {
993
952
  return typeof w == "function" ? b(w()) : Array.isArray(w) || w instanceof Set ? w : [w];
994
953
  }(t);
995
954
  for (let b of y) if (b !== null && (b.contains(f) || i.composed && i.composedPath().includes(b))) return;
996
- return !lr(f, Xt.Loose) && f.tabIndex !== -1 && i.preventDefault(), l.current(i, f);
997
- }, [l, t]), o = O(null);
998
- xe(r, "pointerdown", (i) => {
999
- var d, f;
1000
- o.current = ((f = (d = i.composedPath) == null ? void 0 : d.call(i)) == null ? void 0 : f[0]) || i.target;
1001
- }, !0), xe(r, "mousedown", (i) => {
1002
- var d, f;
1003
- o.current = ((f = (d = i.composedPath) == null ? void 0 : d.call(i)) == null ? void 0 : f[0]) || i.target;
1004
- }, !0), xe(r, "click", (i) => {
1005
- dr() || o.current && (a(i, () => o.current), o.current = null);
955
+ return !lr(f, Bt.Loose) && f.tabIndex !== -1 && i.preventDefault(), l.current(i, f);
956
+ }, [l, t]), a = O(null);
957
+ ye(r, "pointerdown", (i) => {
958
+ var c, f;
959
+ a.current = ((f = (c = i.composedPath) == null ? void 0 : c.call(i)) == null ? void 0 : f[0]) || i.target;
960
+ }, !0), ye(r, "mousedown", (i) => {
961
+ var c, f;
962
+ a.current = ((f = (c = i.composedPath) == null ? void 0 : c.call(i)) == null ? void 0 : f[0]) || i.target;
963
+ }, !0), ye(r, "click", (i) => {
964
+ cr() || a.current && (o(i, () => a.current), a.current = null);
1006
965
  }, !0);
1007
966
  let s = O({ x: 0, y: 0 });
1008
- xe(r, "touchstart", (i) => {
967
+ ye(r, "touchstart", (i) => {
1009
968
  s.current.x = i.touches[0].clientX, s.current.y = i.touches[0].clientY;
1010
- }, !0), xe(r, "touchend", (i) => {
1011
- let d = { x: i.changedTouches[0].clientX, y: i.changedTouches[0].clientY };
1012
- if (!(Math.abs(d.x - s.current.x) >= Tt || Math.abs(d.y - s.current.y) >= Tt)) return a(i, () => i.target instanceof HTMLElement ? i.target : null);
1013
- }, !0), qt(r, "blur", (i) => a(i, () => window.document.activeElement instanceof HTMLIFrameElement ? window.document.activeElement : null), !0);
969
+ }, !0), ye(r, "touchend", (i) => {
970
+ let c = { x: i.changedTouches[0].clientX, y: i.changedTouches[0].clientY };
971
+ if (!(Math.abs(c.x - s.current.x) >= $t || Math.abs(c.y - s.current.y) >= $t)) return o(i, () => i.target instanceof HTMLElement ? i.target : null);
972
+ }, !0), Vt(r, "blur", (i) => o(i, () => window.document.activeElement instanceof HTMLIFrameElement ? window.document.activeElement : null), !0);
1014
973
  }
1015
974
  function Me(...e) {
1016
975
  return C(() => Ve(...e), [...e]);
1017
976
  }
1018
- function Yt(e, t, n, r) {
1019
- let l = de(n);
977
+ function qt(e, t, n, r) {
978
+ let l = ue(n);
1020
979
  M(() => {
1021
980
  e = e ?? window;
1022
- function a(o) {
1023
- l.current(o);
981
+ function o(a) {
982
+ l.current(a);
1024
983
  }
1025
- return e.addEventListener(t, a, r), () => e.removeEventListener(t, a, r);
984
+ return e.addEventListener(t, o, r), () => e.removeEventListener(t, o, r);
1026
985
  }, [e, t, r]);
1027
986
  }
1028
987
  function fr() {
@@ -1032,14 +991,14 @@ function fr() {
1032
991
  let r = t.documentElement, l = (n = t.defaultView) != null ? n : window;
1033
992
  e = Math.max(0, l.innerWidth - r.clientWidth);
1034
993
  }, after({ doc: t, d: n }) {
1035
- let r = t.documentElement, l = Math.max(0, r.clientWidth - r.offsetWidth), a = Math.max(0, e - l);
1036
- n.style(r, "paddingRight", `${a}px`);
994
+ let r = t.documentElement, l = Math.max(0, r.clientWidth - r.offsetWidth), o = Math.max(0, e - l);
995
+ n.style(r, "paddingRight", `${o}px`);
1037
996
  } };
1038
997
  }
1039
998
  function mr() {
1040
- return Vt() ? { before({ doc: e, d: t, meta: n }) {
999
+ return Xt() ? { before({ doc: e, d: t, meta: n }) {
1041
1000
  function r(l) {
1042
- return n.containers.flatMap((a) => a()).some((a) => a.contains(l));
1001
+ return n.containers.flatMap((o) => o()).some((o) => o.contains(l));
1043
1002
  }
1044
1003
  t.microTask(() => {
1045
1004
  var l;
@@ -1047,13 +1006,13 @@ function mr() {
1047
1006
  let s = re();
1048
1007
  s.style(e.documentElement, "scrollBehavior", "auto"), t.add(() => t.microTask(() => s.dispose()));
1049
1008
  }
1050
- let a = (l = window.scrollY) != null ? l : window.pageYOffset, o = null;
1009
+ let o = (l = window.scrollY) != null ? l : window.pageYOffset, a = null;
1051
1010
  t.addEventListener(e, "click", (s) => {
1052
1011
  if (s.target instanceof HTMLElement) try {
1053
1012
  let i = s.target.closest("a");
1054
1013
  if (!i) return;
1055
- let { hash: d } = new URL(i.href), f = e.querySelector(d);
1056
- f && !r(f) && (o = f);
1014
+ let { hash: c } = new URL(i.href), f = e.querySelector(c);
1015
+ f && !r(f) && (a = f);
1057
1016
  } catch {
1058
1017
  }
1059
1018
  }, !0), t.addEventListener(e, "touchstart", (s) => {
@@ -1074,7 +1033,7 @@ function mr() {
1074
1033
  }, { passive: !1 }), t.add(() => {
1075
1034
  var s;
1076
1035
  let i = (s = window.scrollY) != null ? s : window.pageYOffset;
1077
- a !== i && window.scrollTo(0, a), o && o.isConnected && (o.scrollIntoView({ block: "nearest" }), o = null);
1036
+ o !== i && window.scrollTo(0, o), a && a.isConnected && (a.scrollIntoView({ block: "nearest" }), a = null);
1078
1037
  });
1079
1038
  });
1080
1039
  } } : {};
@@ -1089,7 +1048,7 @@ function hr(e) {
1089
1048
  for (let n of e) Object.assign(t, n(t));
1090
1049
  return t;
1091
1050
  }
1092
- let oe = _t(() => /* @__PURE__ */ new Map(), { PUSH(e, t) {
1051
+ let oe = Wt(() => /* @__PURE__ */ new Map(), { PUSH(e, t) {
1093
1052
  var n;
1094
1053
  let r = (n = this.get(e)) != null ? n : { doc: e, count: 0, d: re(), meta: /* @__PURE__ */ new Set() };
1095
1054
  return r.count++, r.meta.add(t), this.set(e, r), this;
@@ -1098,7 +1057,7 @@ let oe = _t(() => /* @__PURE__ */ new Map(), { PUSH(e, t) {
1098
1057
  return n && (n.count--, n.meta.delete(t)), this;
1099
1058
  }, SCROLL_PREVENT({ doc: e, d: t, meta: n }) {
1100
1059
  let r = { doc: e, d: t, meta: hr(n) }, l = [mr(), fr(), pr()];
1101
- l.forEach(({ before: a }) => a == null ? void 0 : a(r)), l.forEach(({ after: a }) => a == null ? void 0 : a(r));
1060
+ l.forEach(({ before: o }) => o == null ? void 0 : o(r)), l.forEach(({ after: o }) => o == null ? void 0 : o(r));
1102
1061
  }, SCROLL_ALLOW({ d: e }) {
1103
1062
  e.dispose();
1104
1063
  }, TEARDOWN({ doc: e }) {
@@ -1113,24 +1072,24 @@ oe.subscribe(() => {
1113
1072
  }
1114
1073
  });
1115
1074
  function vr(e, t, n = () => ({ containers: [] })) {
1116
- let r = Bt(oe), l = t ? r.get(t) : void 0, a = l ? l.count > 0 : !1;
1117
- return N(() => {
1075
+ let r = _t(oe), l = t ? r.get(t) : void 0, o = l ? l.count > 0 : !1;
1076
+ return A(() => {
1118
1077
  if (!(!t || !e)) return oe.dispatch("PUSH", t, n), () => oe.dispatch("POP", t, n);
1119
- }, [e, t]), a;
1078
+ }, [e, t]), o;
1120
1079
  }
1121
1080
  function gr(e, t, n = () => [document.body]) {
1122
- let r = me(e, "scroll-lock");
1081
+ let r = fe(e, "scroll-lock");
1123
1082
  vr(r, t, (l) => {
1124
- var a;
1125
- return { containers: [...(a = l.containers) != null ? a : [], n] };
1083
+ var o;
1084
+ return { containers: [...(o = l.containers) != null ? o : [], n] };
1126
1085
  });
1127
1086
  }
1128
1087
  function wr(e = 0) {
1129
- let [t, n] = L(e), r = Y((i) => n(i), [t]), l = Y((i) => n((d) => d | i), [t]), a = Y((i) => (t & i) === i, [t]), o = Y((i) => n((d) => d & ~i), [n]), s = Y((i) => n((d) => d ^ i), [n]);
1130
- return { flags: t, setFlag: r, addFlag: l, hasFlag: a, removeFlag: o, toggleFlag: s };
1088
+ let [t, n] = S(e), r = Y((i) => n(i), [t]), l = Y((i) => n((c) => c | i), [t]), o = Y((i) => (t & i) === i, [t]), a = Y((i) => n((c) => c & ~i), [n]), s = Y((i) => n((c) => c ^ i), [n]);
1089
+ return { flags: t, setFlag: r, addFlag: l, hasFlag: o, removeFlag: a, toggleFlag: s };
1131
1090
  }
1132
- var Ot, Pt;
1133
- typeof process < "u" && typeof globalThis < "u" && typeof Element < "u" && ((Ot = process == null ? void 0 : process.env) == null ? void 0 : Ot.NODE_ENV) === "test" && typeof ((Pt = Element == null ? void 0 : Element.prototype) == null ? void 0 : Pt.getAnimations) > "u" && (Element.prototype.getAnimations = function() {
1091
+ var Tt, Ot;
1092
+ typeof process < "u" && typeof globalThis < "u" && typeof Element < "u" && ((Tt = process == null ? void 0 : process.env) == null ? void 0 : Tt.NODE_ENV) === "test" && typeof ((Ot = Element == null ? void 0 : Element.prototype) == null ? void 0 : Ot.getAnimations) > "u" && (Element.prototype.getAnimations = function() {
1134
1093
  return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.", "Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.", "", "Example usage:", "```js", "import { mockAnimationsApi } from 'jsdom-testing-mocks'", "mockAnimationsApi()", "```"].join(`
1135
1094
  `)), [];
1136
1095
  });
@@ -1141,44 +1100,44 @@ function xr(e) {
1141
1100
  return t;
1142
1101
  }
1143
1102
  function br(e, t, n, r) {
1144
- let [l, a] = L(n), { hasFlag: o, addFlag: s, removeFlag: i } = wr(e && l ? 3 : 0), d = O(!1), f = O(!1), y = pt();
1145
- return N(() => {
1103
+ let [l, o] = S(n), { hasFlag: a, addFlag: s, removeFlag: i } = wr(e && l ? 3 : 0), c = O(!1), f = O(!1), y = pt();
1104
+ return A(() => {
1146
1105
  var b;
1147
1106
  if (e) {
1148
- if (n && a(!0), !t) {
1107
+ if (n && o(!0), !t) {
1149
1108
  n && s(3);
1150
1109
  return;
1151
1110
  }
1152
- return (b = r == null ? void 0 : r.start) == null || b.call(r, n), Er(t, { inFlight: d, prepare() {
1153
- f.current ? f.current = !1 : f.current = d.current, d.current = !0, !f.current && (n ? (s(3), i(4)) : (s(4), i(2)));
1111
+ return (b = r == null ? void 0 : r.start) == null || b.call(r, n), Er(t, { inFlight: c, prepare() {
1112
+ f.current ? f.current = !1 : f.current = c.current, c.current = !0, !f.current && (n ? (s(3), i(4)) : (s(4), i(2)));
1154
1113
  }, run() {
1155
1114
  f.current ? n ? (i(3), s(4)) : (i(4), s(3)) : n ? i(1) : s(1);
1156
1115
  }, done() {
1157
1116
  var w;
1158
- f.current && typeof t.getAnimations == "function" && t.getAnimations().length > 0 || (d.current = !1, i(7), n || a(!1), (w = r == null ? void 0 : r.end) == null || w.call(r, n));
1117
+ f.current && typeof t.getAnimations == "function" && t.getAnimations().length > 0 || (c.current = !1, i(7), n || o(!1), (w = r == null ? void 0 : r.end) == null || w.call(r, n));
1159
1118
  } });
1160
1119
  }
1161
- }, [e, n, t, y]), e ? [l, { closed: o(1), enter: o(2), leave: o(4), transition: o(2) || o(4) }] : [n, { closed: void 0, enter: void 0, leave: void 0, transition: void 0 }];
1120
+ }, [e, n, t, y]), e ? [l, { closed: a(1), enter: a(2), leave: a(4), transition: a(2) || a(4) }] : [n, { closed: void 0, enter: void 0, leave: void 0, transition: void 0 }];
1162
1121
  }
1163
1122
  function Er(e, { prepare: t, run: n, done: r, inFlight: l }) {
1164
- let a = re();
1165
- return Tr(e, { prepare: t, inFlight: l }), a.nextFrame(() => {
1166
- n(), a.requestAnimationFrame(() => {
1167
- a.add($r(e, r));
1123
+ let o = re();
1124
+ return Tr(e, { prepare: t, inFlight: l }), o.nextFrame(() => {
1125
+ n(), o.requestAnimationFrame(() => {
1126
+ o.add($r(e, r));
1168
1127
  });
1169
- }), a.dispose;
1128
+ }), o.dispose;
1170
1129
  }
1171
1130
  function $r(e, t) {
1172
1131
  var n, r;
1173
1132
  let l = re();
1174
1133
  if (!e) return l.dispose;
1175
- let a = !1;
1134
+ let o = !1;
1176
1135
  l.add(() => {
1177
- a = !0;
1136
+ o = !0;
1178
1137
  });
1179
- let o = (r = (n = e.getAnimations) == null ? void 0 : n.call(e).filter((s) => s instanceof CSSTransition)) != null ? r : [];
1180
- return o.length === 0 ? (t(), l.dispose) : (Promise.allSettled(o.map((s) => s.finished)).then(() => {
1181
- a || t();
1138
+ let a = (r = (n = e.getAnimations) == null ? void 0 : n.call(e).filter((s) => s instanceof CSSTransition)) != null ? r : [];
1139
+ return a.length === 0 ? (t(), l.dispose) : (Promise.allSettled(a.map((s) => s.finished)).then(() => {
1140
+ o || t();
1182
1141
  }), l.dispose);
1183
1142
  }
1184
1143
  function Tr(e, { inFlight: t, prepare: n }) {
@@ -1190,10 +1149,10 @@ function Tr(e, { inFlight: t, prepare: n }) {
1190
1149
  e.style.transition = "none", n(), e.offsetHeight, e.style.transition = r;
1191
1150
  }
1192
1151
  function vt(e, t) {
1193
- let n = O([]), r = S(e);
1152
+ let n = O([]), r = L(e);
1194
1153
  M(() => {
1195
1154
  let l = [...n.current];
1196
- for (let [a, o] of t.entries()) if (n.current[a] !== o) {
1155
+ for (let [o, a] of t.entries()) if (n.current[o] !== a) {
1197
1156
  let s = r(t, l);
1198
1157
  return n.current = t, s;
1199
1158
  }
@@ -1226,37 +1185,37 @@ Mr(() => {
1226
1185
  }
1227
1186
  window.addEventListener("click", e, { capture: !0 }), window.addEventListener("mousedown", e, { capture: !0 }), window.addEventListener("focus", e, { capture: !0 }), document.body.addEventListener("click", e, { capture: !0 }), document.body.addEventListener("mousedown", e, { capture: !0 }), document.body.addEventListener("focus", e, { capture: !0 });
1228
1187
  });
1229
- function zt(e) {
1230
- let t = S(e), n = O(!1);
1188
+ function Yt(e) {
1189
+ let t = L(e), n = O(!1);
1231
1190
  M(() => (n.current = !1, () => {
1232
1191
  n.current = !0, qe(() => {
1233
1192
  n.current && t();
1234
1193
  });
1235
1194
  }), [t]);
1236
1195
  }
1237
- function Sr() {
1196
+ function Lr() {
1238
1197
  let e = typeof document > "u";
1239
1198
  return "useSyncExternalStore" in Ee ? ((t) => t.useSyncExternalStore)(Ee)(() => () => {
1240
1199
  }, () => !1, () => !e) : !1;
1241
1200
  }
1242
- function Se() {
1243
- let e = Sr(), [t, n] = Ee.useState(se.isHandoffComplete);
1244
- return t && se.isHandoffComplete === !1 && n(!1), Ee.useEffect(() => {
1201
+ function Le() {
1202
+ let e = Lr(), [t, n] = Ee.useState(ae.isHandoffComplete);
1203
+ return t && ae.isHandoffComplete === !1 && n(!1), Ee.useEffect(() => {
1245
1204
  t !== !0 && n(!0);
1246
- }, [t]), Ee.useEffect(() => se.handoff(), []), e ? !1 : t;
1205
+ }, [t]), Ee.useEffect(() => ae.handoff(), []), e ? !1 : t;
1247
1206
  }
1248
- let Gt = H(!1);
1249
- function Lr() {
1250
- return R(Gt);
1207
+ let zt = H(!1);
1208
+ function Sr() {
1209
+ return R(zt);
1251
1210
  }
1252
- function Mt(e) {
1253
- return E.createElement(Gt.Provider, { value: e.force }, e.children);
1211
+ function Pt(e) {
1212
+ return E.createElement(zt.Provider, { value: e.force }, e.children);
1254
1213
  }
1255
1214
  function Fr(e) {
1256
- let t = Lr(), n = R(Zt), r = Me(e), [l, a] = L(() => {
1257
- var o;
1258
- if (!t && n !== null) return (o = n.current) != null ? o : null;
1259
- if (se.isServer) return null;
1215
+ let t = Sr(), n = R(Kt), r = Me(e), [l, o] = S(() => {
1216
+ var a;
1217
+ if (!t && n !== null) return (a = n.current) != null ? a : null;
1218
+ if (ae.isServer) return null;
1260
1219
  let s = r == null ? void 0 : r.getElementById("headlessui-portal-root");
1261
1220
  if (s) return s;
1262
1221
  if (r === null) return null;
@@ -1266,106 +1225,106 @@ function Fr(e) {
1266
1225
  return M(() => {
1267
1226
  l !== null && (r != null && r.body.contains(l) || r == null || r.body.appendChild(l));
1268
1227
  }, [l, r]), M(() => {
1269
- t || n !== null && a(n.current);
1270
- }, [n, a, t]), l;
1228
+ t || n !== null && o(n.current);
1229
+ }, [n, o, t]), l;
1271
1230
  }
1272
- let Kt = G, Cr = D(function(e, t) {
1231
+ let Gt = G, Cr = D(function(e, t) {
1273
1232
  let n = e, r = O(null), l = Z(_n((y) => {
1274
1233
  r.current = y;
1275
- }), t), a = Me(r), o = Fr(r), [s] = L(() => {
1234
+ }), t), o = Me(r), a = Fr(r), [s] = S(() => {
1276
1235
  var y;
1277
- return se.isServer ? null : (y = a == null ? void 0 : a.createElement("div")) != null ? y : null;
1278
- }), i = R(st), d = Se();
1279
- N(() => {
1280
- !o || !s || o.contains(s) || (s.setAttribute("data-headlessui-portal", ""), o.appendChild(s));
1281
- }, [o, s]), N(() => {
1236
+ return ae.isServer ? null : (y = o == null ? void 0 : o.createElement("div")) != null ? y : null;
1237
+ }), i = R(st), c = Le();
1238
+ A(() => {
1239
+ !a || !s || a.contains(s) || (s.setAttribute("data-headlessui-portal", ""), a.appendChild(s));
1240
+ }, [a, s]), A(() => {
1282
1241
  if (s && i) return i.register(s);
1283
- }, [i, s]), zt(() => {
1242
+ }, [i, s]), Yt(() => {
1284
1243
  var y;
1285
- !o || !s || (s instanceof Node && o.contains(s) && o.removeChild(s), o.childNodes.length <= 0 && ((y = o.parentElement) == null || y.removeChild(o)));
1244
+ !a || !s || (s instanceof Node && a.contains(s) && a.removeChild(s), a.childNodes.length <= 0 && ((y = a.parentElement) == null || y.removeChild(a)));
1286
1245
  });
1287
1246
  let f = W();
1288
- return d ? !o || !s ? null : $n(f({ ourProps: { ref: l }, theirProps: n, slot: {}, defaultTag: Kt, name: "Portal" }), s) : null;
1247
+ return c ? !a || !s ? null : En(f({ ourProps: { ref: l }, theirProps: n, slot: {}, defaultTag: Gt, name: "Portal" }), s) : null;
1289
1248
  });
1290
1249
  function kr(e, t) {
1291
- let n = Z(t), { enabled: r = !0, ...l } = e, a = W();
1292
- return r ? E.createElement(Cr, { ...l, ref: n }) : a({ ourProps: { ref: n }, theirProps: l, slot: {}, defaultTag: Kt, name: "Portal" });
1250
+ let n = Z(t), { enabled: r = !0, ...l } = e, o = W();
1251
+ return r ? E.createElement(Cr, { ...l, ref: n }) : o({ ourProps: { ref: n }, theirProps: l, slot: {}, defaultTag: Gt, name: "Portal" });
1293
1252
  }
1294
- let Ar = G, Zt = H(null);
1295
- function Nr(e, t) {
1296
- let { target: n, ...r } = e, l = { ref: Z(t) }, a = W();
1297
- return E.createElement(Zt.Provider, { value: n }, a({ ourProps: l, theirProps: r, defaultTag: Ar, name: "Popover.Group" }));
1253
+ let Nr = G, Kt = H(null);
1254
+ function Ar(e, t) {
1255
+ let { target: n, ...r } = e, l = { ref: Z(t) }, o = W();
1256
+ return E.createElement(Kt.Provider, { value: n }, o({ ourProps: l, theirProps: r, defaultTag: Nr, name: "Popover.Group" }));
1298
1257
  }
1299
1258
  let st = H(null);
1300
1259
  function Ir() {
1301
- let e = R(st), t = O([]), n = S((a) => (t.current.push(a), e && e.register(a), () => r(a))), r = S((a) => {
1302
- let o = t.current.indexOf(a);
1303
- o !== -1 && t.current.splice(o, 1), e && e.unregister(a);
1260
+ let e = R(st), t = O([]), n = L((o) => (t.current.push(o), e && e.register(o), () => r(o))), r = L((o) => {
1261
+ let a = t.current.indexOf(o);
1262
+ a !== -1 && t.current.splice(a, 1), e && e.unregister(o);
1304
1263
  }), l = C(() => ({ register: n, unregister: r, portals: t }), [n, r, t]);
1305
- return [t, C(() => function({ children: a }) {
1306
- return E.createElement(st.Provider, { value: l }, a);
1264
+ return [t, C(() => function({ children: o }) {
1265
+ return E.createElement(st.Provider, { value: l }, o);
1307
1266
  }, [l])];
1308
1267
  }
1309
- let Rr = D(kr), Jt = D(Nr), Dr = Object.assign(Rr, { Group: Jt });
1268
+ let Rr = D(kr), Zt = D(Ar), Dr = Object.assign(Rr, { Group: Zt });
1310
1269
  function jr(e, t = typeof document < "u" ? document.defaultView : null, n) {
1311
- let r = me(e, "escape");
1312
- Yt(t, "keydown", (l) => {
1313
- r && (l.defaultPrevented || l.key === Wt.Escape && n(l));
1270
+ let r = fe(e, "escape");
1271
+ qt(t, "keydown", (l) => {
1272
+ r && (l.defaultPrevented || l.key === Ht.Escape && n(l));
1314
1273
  });
1315
1274
  }
1316
1275
  function Ur() {
1317
1276
  var e;
1318
- let [t] = L(() => typeof window < "u" && typeof window.matchMedia == "function" ? window.matchMedia("(pointer: coarse)") : null), [n, r] = L((e = t == null ? void 0 : t.matches) != null ? e : !1);
1319
- return N(() => {
1277
+ let [t] = S(() => typeof window < "u" && typeof window.matchMedia == "function" ? window.matchMedia("(pointer: coarse)") : null), [n, r] = S((e = t == null ? void 0 : t.matches) != null ? e : !1);
1278
+ return A(() => {
1320
1279
  if (!t) return;
1321
- function l(a) {
1322
- r(a.matches);
1280
+ function l(o) {
1281
+ r(o.matches);
1323
1282
  }
1324
1283
  return t.addEventListener("change", l), () => t.removeEventListener("change", l);
1325
1284
  }, [t]), n;
1326
1285
  }
1327
1286
  function Hr({ defaultContainers: e = [], portals: t, mainTreeNode: n } = {}) {
1328
- let r = Me(n), l = S(() => {
1329
- var a, o;
1287
+ let r = Me(n), l = L(() => {
1288
+ var o, a;
1330
1289
  let s = [];
1331
1290
  for (let i of e) i !== null && (i instanceof HTMLElement ? s.push(i) : "current" in i && i.current instanceof HTMLElement && s.push(i.current));
1332
1291
  if (t != null && t.current) for (let i of t.current) s.push(i);
1333
- for (let i of (a = r == null ? void 0 : r.querySelectorAll("html > *, body > *")) != null ? a : []) i !== document.body && i !== document.head && i instanceof HTMLElement && i.id !== "headlessui-portal-root" && (n && (i.contains(n) || i.contains((o = n == null ? void 0 : n.getRootNode()) == null ? void 0 : o.host)) || s.some((d) => i.contains(d)) || s.push(i));
1292
+ for (let i of (o = r == null ? void 0 : r.querySelectorAll("html > *, body > *")) != null ? o : []) i !== document.body && i !== document.head && i instanceof HTMLElement && i.id !== "headlessui-portal-root" && (n && (i.contains(n) || i.contains((a = n == null ? void 0 : n.getRootNode()) == null ? void 0 : a.host)) || s.some((c) => i.contains(c)) || s.push(i));
1334
1293
  return s;
1335
1294
  });
1336
- return { resolveContainers: l, contains: S((a) => l().some((o) => o.contains(a))) };
1337
- }
1338
- let Qt = H(null);
1339
- function St({ children: e, node: t }) {
1340
- let [n, r] = L(null), l = en(t ?? n);
1341
- return E.createElement(Qt.Provider, { value: l }, e, l === null && E.createElement(it, { features: He.Hidden, ref: (a) => {
1342
- var o, s;
1343
- if (a) {
1344
- for (let i of (s = (o = Ve(a)) == null ? void 0 : o.querySelectorAll("html > *, body > *")) != null ? s : []) if (i !== document.body && i !== document.head && i instanceof HTMLElement && i != null && i.contains(a)) {
1295
+ return { resolveContainers: l, contains: L((o) => l().some((a) => a.contains(o))) };
1296
+ }
1297
+ let Jt = H(null);
1298
+ function Mt({ children: e, node: t }) {
1299
+ let [n, r] = S(null), l = Qt(t ?? n);
1300
+ return E.createElement(Jt.Provider, { value: l }, e, l === null && E.createElement(it, { features: He.Hidden, ref: (o) => {
1301
+ var a, s;
1302
+ if (o) {
1303
+ for (let i of (s = (a = Ve(o)) == null ? void 0 : a.querySelectorAll("html > *, body > *")) != null ? s : []) if (i !== document.body && i !== document.head && i instanceof HTMLElement && i != null && i.contains(o)) {
1345
1304
  r(i);
1346
1305
  break;
1347
1306
  }
1348
1307
  }
1349
1308
  } }));
1350
1309
  }
1351
- function en(e = null) {
1310
+ function Qt(e = null) {
1352
1311
  var t;
1353
- return (t = R(Qt)) != null ? t : e;
1312
+ return (t = R(Jt)) != null ? t : e;
1354
1313
  }
1355
1314
  function gt() {
1356
1315
  let e = O(!1);
1357
- return N(() => (e.current = !0, () => {
1316
+ return A(() => (e.current = !0, () => {
1358
1317
  e.current = !1;
1359
1318
  }), []), e;
1360
1319
  }
1361
1320
  var be = ((e) => (e[e.Forwards = 0] = "Forwards", e[e.Backwards = 1] = "Backwards", e))(be || {});
1362
1321
  function Wr() {
1363
1322
  let e = O(0);
1364
- return qt(!0, "keydown", (t) => {
1323
+ return Vt(!0, "keydown", (t) => {
1365
1324
  t.key === "Tab" && (e.current = t.shiftKey ? 1 : 0);
1366
1325
  }, !0), e;
1367
1326
  }
1368
- function tn(e) {
1327
+ function en(e) {
1369
1328
  if (!e) return /* @__PURE__ */ new Set();
1370
1329
  if (typeof e == "function") return new Set(e());
1371
1330
  let t = /* @__PURE__ */ new Set();
@@ -1373,44 +1332,44 @@ function tn(e) {
1373
1332
  return t;
1374
1333
  }
1375
1334
  let _r = "div";
1376
- var ae = ((e) => (e[e.None = 0] = "None", e[e.InitialFocus = 1] = "InitialFocus", e[e.TabLock = 2] = "TabLock", e[e.FocusLock = 4] = "FocusLock", e[e.RestoreFocus = 8] = "RestoreFocus", e[e.AutoFocus = 16] = "AutoFocus", e))(ae || {});
1335
+ var ie = ((e) => (e[e.None = 0] = "None", e[e.InitialFocus = 1] = "InitialFocus", e[e.TabLock = 2] = "TabLock", e[e.FocusLock = 4] = "FocusLock", e[e.RestoreFocus = 8] = "RestoreFocus", e[e.AutoFocus = 16] = "AutoFocus", e))(ie || {});
1377
1336
  function Br(e, t) {
1378
- let n = O(null), r = Z(n, t), { initialFocus: l, initialFocusFallback: a, containers: o, features: s = 15, ...i } = e;
1379
- Se() || (s = 0);
1380
- let d = Me(n);
1381
- Yr(s, { ownerDocument: d });
1382
- let f = zr(s, { ownerDocument: d, container: n, initialFocus: l, initialFocusFallback: a });
1383
- Gr(s, { ownerDocument: d, container: n, containers: o, previousActiveElement: f });
1384
- let y = Wr(), b = S((p) => {
1337
+ let n = O(null), r = Z(n, t), { initialFocus: l, initialFocusFallback: o, containers: a, features: s = 15, ...i } = e;
1338
+ Le() || (s = 0);
1339
+ let c = Me(n);
1340
+ Yr(s, { ownerDocument: c });
1341
+ let f = zr(s, { ownerDocument: c, container: n, initialFocus: l, initialFocusFallback: o });
1342
+ Gr(s, { ownerDocument: c, container: n, containers: a, previousActiveElement: f });
1343
+ let y = Wr(), b = L((p) => {
1385
1344
  let g = n.current;
1386
1345
  g && ((x) => x())(() => {
1387
1346
  ne(y.current, { [be.Forwards]: () => {
1388
- Oe(g, J.First, { skipElements: [p.relatedTarget, a] });
1347
+ Oe(g, J.First, { skipElements: [p.relatedTarget, o] });
1389
1348
  }, [be.Backwards]: () => {
1390
- Oe(g, J.Last, { skipElements: [p.relatedTarget, a] });
1349
+ Oe(g, J.Last, { skipElements: [p.relatedTarget, o] });
1391
1350
  } });
1392
1351
  });
1393
- }), w = me(!!(s & 2), "focus-trap#tab-lock"), c = pt(), v = O(!1), u = { ref: r, onKeyDown(p) {
1394
- p.key == "Tab" && (v.current = !0, c.requestAnimationFrame(() => {
1352
+ }), w = fe(!!(s & 2), "focus-trap#tab-lock"), d = pt(), v = O(!1), u = { ref: r, onKeyDown(p) {
1353
+ p.key == "Tab" && (v.current = !0, d.requestAnimationFrame(() => {
1395
1354
  v.current = !1;
1396
1355
  }));
1397
1356
  }, onBlur(p) {
1398
1357
  if (!(s & 4)) return;
1399
- let g = tn(o);
1358
+ let g = en(a);
1400
1359
  n.current instanceof HTMLElement && g.add(n.current);
1401
1360
  let x = p.relatedTarget;
1402
- x instanceof HTMLElement && x.dataset.headlessuiFocusGuard !== "true" && (nn(g, x) || (v.current ? Oe(n.current, ne(y.current, { [be.Forwards]: () => J.Next, [be.Backwards]: () => J.Previous }) | J.WrapAround, { relativeTo: p.target }) : p.target instanceof HTMLElement && Q(p.target)));
1361
+ x instanceof HTMLElement && x.dataset.headlessuiFocusGuard !== "true" && (tn(g, x) || (v.current ? Oe(n.current, ne(y.current, { [be.Forwards]: () => J.Next, [be.Backwards]: () => J.Previous }) | J.WrapAround, { relativeTo: p.target }) : p.target instanceof HTMLElement && Q(p.target)));
1403
1362
  } }, m = W();
1404
1363
  return E.createElement(E.Fragment, null, w && E.createElement(it, { as: "button", type: "button", "data-headlessui-focus-guard": !0, onFocus: b, features: He.Focusable }), m({ ourProps: u, theirProps: i, defaultTag: _r, name: "FocusTrap" }), w && E.createElement(it, { as: "button", type: "button", "data-headlessui-focus-guard": !0, onFocus: b, features: He.Focusable }));
1405
1364
  }
1406
- let Xr = D(Br), Vr = Object.assign(Xr, { features: ae });
1365
+ let Xr = D(Br), Vr = Object.assign(Xr, { features: ie });
1407
1366
  function qr(e = !0) {
1408
1367
  let t = O(ee.slice());
1409
1368
  return vt(([n], [r]) => {
1410
1369
  r === !0 && n === !1 && qe(() => {
1411
1370
  t.current.splice(0);
1412
1371
  }), r === !1 && n === !0 && (t.current = ee.slice());
1413
- }, [e, ee, t]), S(() => {
1372
+ }, [e, ee, t]), L(() => {
1414
1373
  var n;
1415
1374
  return (n = t.current.find((r) => r != null && r.isConnected)) != null ? n : null;
1416
1375
  });
@@ -1419,62 +1378,62 @@ function Yr(e, { ownerDocument: t }) {
1419
1378
  let n = !!(e & 8), r = qr(n);
1420
1379
  vt(() => {
1421
1380
  n || (t == null ? void 0 : t.activeElement) === (t == null ? void 0 : t.body) && Q(r());
1422
- }, [n]), zt(() => {
1381
+ }, [n]), Yt(() => {
1423
1382
  n && Q(r());
1424
1383
  });
1425
1384
  }
1426
1385
  function zr(e, { ownerDocument: t, container: n, initialFocus: r, initialFocusFallback: l }) {
1427
- let a = O(null), o = me(!!(e & 1), "focus-trap#initial-focus"), s = gt();
1386
+ let o = O(null), a = fe(!!(e & 1), "focus-trap#initial-focus"), s = gt();
1428
1387
  return vt(() => {
1429
1388
  if (e === 0) return;
1430
- if (!o) {
1389
+ if (!a) {
1431
1390
  l != null && l.current && Q(l.current);
1432
1391
  return;
1433
1392
  }
1434
1393
  let i = n.current;
1435
1394
  i && qe(() => {
1436
1395
  if (!s.current) return;
1437
- let d = t == null ? void 0 : t.activeElement;
1396
+ let c = t == null ? void 0 : t.activeElement;
1438
1397
  if (r != null && r.current) {
1439
- if ((r == null ? void 0 : r.current) === d) {
1440
- a.current = d;
1398
+ if ((r == null ? void 0 : r.current) === c) {
1399
+ o.current = c;
1441
1400
  return;
1442
1401
  }
1443
- } else if (i.contains(d)) {
1444
- a.current = d;
1402
+ } else if (i.contains(c)) {
1403
+ o.current = c;
1445
1404
  return;
1446
1405
  }
1447
1406
  if (r != null && r.current) Q(r.current);
1448
1407
  else {
1449
1408
  if (e & 16) {
1450
- if (Oe(i, J.First | J.AutoFocus) !== ot.Error) return;
1451
- } else if (Oe(i, J.First) !== ot.Error) return;
1409
+ if (Oe(i, J.First | J.AutoFocus) !== at.Error) return;
1410
+ } else if (Oe(i, J.First) !== at.Error) return;
1452
1411
  if (l != null && l.current && (Q(l.current), (t == null ? void 0 : t.activeElement) === l.current)) return;
1453
1412
  console.warn("There are no focusable elements inside the <FocusTrap />");
1454
1413
  }
1455
- a.current = t == null ? void 0 : t.activeElement;
1414
+ o.current = t == null ? void 0 : t.activeElement;
1456
1415
  });
1457
- }, [l, o, e]), a;
1416
+ }, [l, a, e]), o;
1458
1417
  }
1459
1418
  function Gr(e, { ownerDocument: t, container: n, containers: r, previousActiveElement: l }) {
1460
- let a = gt(), o = !!(e & 4);
1461
- Yt(t == null ? void 0 : t.defaultView, "focus", (s) => {
1462
- if (!o || !a.current) return;
1463
- let i = tn(r);
1419
+ let o = gt(), a = !!(e & 4);
1420
+ qt(t == null ? void 0 : t.defaultView, "focus", (s) => {
1421
+ if (!a || !o.current) return;
1422
+ let i = en(r);
1464
1423
  n.current instanceof HTMLElement && i.add(n.current);
1465
- let d = l.current;
1466
- if (!d) return;
1424
+ let c = l.current;
1425
+ if (!c) return;
1467
1426
  let f = s.target;
1468
- f && f instanceof HTMLElement ? nn(i, f) ? (l.current = f, Q(f)) : (s.preventDefault(), s.stopPropagation(), Q(d)) : Q(l.current);
1427
+ f && f instanceof HTMLElement ? tn(i, f) ? (l.current = f, Q(f)) : (s.preventDefault(), s.stopPropagation(), Q(c)) : Q(l.current);
1469
1428
  }, !0);
1470
1429
  }
1471
- function nn(e, t) {
1430
+ function tn(e, t) {
1472
1431
  for (let n of e) if (n.contains(t)) return !0;
1473
1432
  return !1;
1474
1433
  }
1475
- function rn(e) {
1434
+ function nn(e) {
1476
1435
  var t;
1477
- return !!(e.enter || e.enterFrom || e.enterTo || e.leave || e.leaveFrom || e.leaveTo) || ((t = e.as) != null ? t : an) !== G || E.Children.count(e.children) === 1;
1436
+ return !!(e.enter || e.enterFrom || e.enterTo || e.leave || e.leaveFrom || e.leaveTo) || ((t = e.as) != null ? t : ln) !== G || E.Children.count(e.children) === 1;
1478
1437
  }
1479
1438
  let Ge = H(null);
1480
1439
  Ge.displayName = "TransitionContext";
@@ -1494,102 +1453,102 @@ Ke.displayName = "NestingContext";
1494
1453
  function Ze(e) {
1495
1454
  return "children" in e ? Ze(e.children) : e.current.filter(({ el: t }) => t.current !== null).filter(({ state: t }) => t === "visible").length > 0;
1496
1455
  }
1497
- function ln(e, t) {
1498
- let n = de(e), r = O([]), l = gt(), a = pt(), o = S((w, c = te.Hidden) => {
1456
+ function rn(e, t) {
1457
+ let n = ue(e), r = O([]), l = gt(), o = pt(), a = L((w, d = te.Hidden) => {
1499
1458
  let v = r.current.findIndex(({ el: u }) => u === w);
1500
- v !== -1 && (ne(c, { [te.Unmount]() {
1459
+ v !== -1 && (ne(d, { [te.Unmount]() {
1501
1460
  r.current.splice(v, 1);
1502
1461
  }, [te.Hidden]() {
1503
1462
  r.current[v].state = "hidden";
1504
- } }), a.microTask(() => {
1463
+ } }), o.microTask(() => {
1505
1464
  var u;
1506
1465
  !Ze(r) && l.current && ((u = n.current) == null || u.call(n));
1507
1466
  }));
1508
- }), s = S((w) => {
1509
- let c = r.current.find(({ el: v }) => v === w);
1510
- return c ? c.state !== "visible" && (c.state = "visible") : r.current.push({ el: w, state: "visible" }), () => o(w, te.Unmount);
1511
- }), i = O([]), d = O(Promise.resolve()), f = O({ enter: [], leave: [] }), y = S((w, c, v) => {
1512
- i.current.splice(0), t && (t.chains.current[c] = t.chains.current[c].filter(([u]) => u !== w)), t == null || t.chains.current[c].push([w, new Promise((u) => {
1467
+ }), s = L((w) => {
1468
+ let d = r.current.find(({ el: v }) => v === w);
1469
+ return d ? d.state !== "visible" && (d.state = "visible") : r.current.push({ el: w, state: "visible" }), () => a(w, te.Unmount);
1470
+ }), i = O([]), c = O(Promise.resolve()), f = O({ enter: [], leave: [] }), y = L((w, d, v) => {
1471
+ i.current.splice(0), t && (t.chains.current[d] = t.chains.current[d].filter(([u]) => u !== w)), t == null || t.chains.current[d].push([w, new Promise((u) => {
1513
1472
  i.current.push(u);
1514
- })]), t == null || t.chains.current[c].push([w, new Promise((u) => {
1515
- Promise.all(f.current[c].map(([m, p]) => p)).then(() => u());
1516
- })]), c === "enter" ? d.current = d.current.then(() => t == null ? void 0 : t.wait.current).then(() => v(c)) : v(c);
1517
- }), b = S((w, c, v) => {
1518
- Promise.all(f.current[c].splice(0).map(([u, m]) => m)).then(() => {
1473
+ })]), t == null || t.chains.current[d].push([w, new Promise((u) => {
1474
+ Promise.all(f.current[d].map(([m, p]) => p)).then(() => u());
1475
+ })]), d === "enter" ? c.current = c.current.then(() => t == null ? void 0 : t.wait.current).then(() => v(d)) : v(d);
1476
+ }), b = L((w, d, v) => {
1477
+ Promise.all(f.current[d].splice(0).map(([u, m]) => m)).then(() => {
1519
1478
  var u;
1520
1479
  (u = i.current.shift()) == null || u();
1521
- }).then(() => v(c));
1480
+ }).then(() => v(d));
1522
1481
  });
1523
- return C(() => ({ children: r, register: s, unregister: o, onStart: y, onStop: b, wait: d, chains: f }), [s, o, r, y, b, f, d]);
1482
+ return C(() => ({ children: r, register: s, unregister: a, onStart: y, onStop: b, wait: c, chains: f }), [s, a, r, y, b, f, c]);
1524
1483
  }
1525
- let an = G, on = Ue.RenderStrategy;
1484
+ let ln = G, on = Ue.RenderStrategy;
1526
1485
  function Qr(e, t) {
1527
1486
  var n, r;
1528
- let { transition: l = !0, beforeEnter: a, afterEnter: o, beforeLeave: s, afterLeave: i, enter: d, enterFrom: f, enterTo: y, entered: b, leave: w, leaveFrom: c, leaveTo: v, ...u } = e, [m, p] = L(null), g = O(null), x = rn(e), h = Z(...x ? [g, t, p] : t === null ? [] : [t]), $ = (n = u.unmount) == null || n ? te.Unmount : te.Hidden, { show: F, appear: j, initial: _ } = Zr(), [A, U] = L(F ? "visible" : "hidden"), B = Jr(), { register: X, unregister: P } = B;
1529
- N(() => X(g), [X, g]), N(() => {
1487
+ let { transition: l = !0, beforeEnter: o, afterEnter: a, beforeLeave: s, afterLeave: i, enter: c, enterFrom: f, enterTo: y, entered: b, leave: w, leaveFrom: d, leaveTo: v, ...u } = e, [m, p] = S(null), g = O(null), x = nn(e), h = Z(...x ? [g, t, p] : t === null ? [] : [t]), $ = (n = u.unmount) == null || n ? te.Unmount : te.Hidden, { show: F, appear: j, initial: _ } = Zr(), [N, U] = S(F ? "visible" : "hidden"), B = Jr(), { register: X, unregister: P } = B;
1488
+ A(() => X(g), [X, g]), A(() => {
1530
1489
  if ($ === te.Hidden && g.current) {
1531
- if (F && A !== "visible") {
1490
+ if (F && N !== "visible") {
1532
1491
  U("visible");
1533
1492
  return;
1534
1493
  }
1535
- return ne(A, { hidden: () => P(g), visible: () => X(g) });
1494
+ return ne(N, { hidden: () => P(g), visible: () => X(g) });
1536
1495
  }
1537
- }, [A, g, X, P, F, $]);
1538
- let V = Se();
1539
- N(() => {
1540
- if (x && V && A === "visible" && g.current === null) throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?");
1541
- }, [g, A, V, x]);
1542
- let Le = _ && !j, Fe = j && F && _, he = O(!1), K = ln(() => {
1543
- he.current || (U("hidden"), P(g));
1544
- }, B), Ce = S((Qe) => {
1545
- he.current = !0;
1546
- let Ae = Qe ? "enter" : "leave";
1547
- K.onStart(g, Ae, (ge) => {
1548
- ge === "enter" ? a == null || a() : ge === "leave" && (s == null || s());
1496
+ }, [N, g, X, P, F, $]);
1497
+ let V = Le();
1498
+ A(() => {
1499
+ if (x && V && N === "visible" && g.current === null) throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?");
1500
+ }, [g, N, V, x]);
1501
+ let Se = _ && !j, Fe = j && F && _, pe = O(!1), K = rn(() => {
1502
+ pe.current || (U("hidden"), P(g));
1503
+ }, B), Ce = L((Qe) => {
1504
+ pe.current = !0;
1505
+ let Ne = Qe ? "enter" : "leave";
1506
+ K.onStart(g, Ne, (ve) => {
1507
+ ve === "enter" ? o == null || o() : ve === "leave" && (s == null || s());
1549
1508
  });
1550
- }), k = S((Qe) => {
1551
- let Ae = Qe ? "enter" : "leave";
1552
- he.current = !1, K.onStop(g, Ae, (ge) => {
1553
- ge === "enter" ? o == null || o() : ge === "leave" && (i == null || i());
1554
- }), Ae === "leave" && !Ze(K) && (U("hidden"), P(g));
1509
+ }), k = L((Qe) => {
1510
+ let Ne = Qe ? "enter" : "leave";
1511
+ pe.current = !1, K.onStop(g, Ne, (ve) => {
1512
+ ve === "enter" ? a == null || a() : ve === "leave" && (i == null || i());
1513
+ }), Ne === "leave" && !Ze(K) && (U("hidden"), P(g));
1555
1514
  });
1556
1515
  M(() => {
1557
1516
  x && l || (Ce(F), k(F));
1558
1517
  }, [F, x, l]);
1559
- let ke = !(!l || !x || !V || Le), [, I] = br(ke, m, F, { start: Ce, end: k }), cn = ie({ ref: h, className: ((r = lt(u.className, Fe && d, Fe && f, I.enter && d, I.enter && I.closed && f, I.enter && !I.closed && y, I.leave && w, I.leave && !I.closed && c, I.leave && I.closed && v, !I.transition && F && b)) == null ? void 0 : r.trim()) || void 0, ...xr(I) }), ve = 0;
1560
- A === "visible" && (ve |= z.Open), A === "hidden" && (ve |= z.Closed), I.enter && (ve |= z.Opening), I.leave && (ve |= z.Closing);
1561
- let fn = W();
1562
- return E.createElement(Ke.Provider, { value: K }, E.createElement(Or, { value: ve }, fn({ ourProps: cn, theirProps: u, defaultTag: an, features: on, visible: A === "visible", name: "Transition.Child" })));
1518
+ let ke = !(!l || !x || !V || Se), [, I] = br(ke, m, F, { start: Ce, end: k }), cn = le({ ref: h, className: ((r = lt(u.className, Fe && c, Fe && f, I.enter && c, I.enter && I.closed && f, I.enter && !I.closed && y, I.leave && w, I.leave && !I.closed && d, I.leave && I.closed && v, !I.transition && F && b)) == null ? void 0 : r.trim()) || void 0, ...xr(I) }), he = 0;
1519
+ N === "visible" && (he |= z.Open), N === "hidden" && (he |= z.Closed), I.enter && (he |= z.Opening), I.leave && (he |= z.Closing);
1520
+ let dn = W();
1521
+ return E.createElement(Ke.Provider, { value: K }, E.createElement(Or, { value: he }, dn({ ourProps: cn, theirProps: u, defaultTag: ln, features: on, visible: N === "visible", name: "Transition.Child" })));
1563
1522
  }
1564
1523
  function el(e, t) {
1565
- let { show: n, appear: r = !1, unmount: l = !0, ...a } = e, o = O(null), s = rn(e), i = Z(...s ? [o, t] : t === null ? [] : [t]);
1566
- Se();
1567
- let d = ze();
1568
- if (n === void 0 && d !== null && (n = (d & z.Open) === z.Open), n === void 0) throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");
1569
- let [f, y] = L(n ? "visible" : "hidden"), b = ln(() => {
1524
+ let { show: n, appear: r = !1, unmount: l = !0, ...o } = e, a = O(null), s = nn(e), i = Z(...s ? [a, t] : t === null ? [] : [t]);
1525
+ Le();
1526
+ let c = ze();
1527
+ if (n === void 0 && c !== null && (n = (c & z.Open) === z.Open), n === void 0) throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");
1528
+ let [f, y] = S(n ? "visible" : "hidden"), b = rn(() => {
1570
1529
  n || y("hidden");
1571
- }), [w, c] = L(!0), v = O([n]);
1572
- N(() => {
1573
- w !== !1 && v.current[v.current.length - 1] !== n && (v.current.push(n), c(!1));
1530
+ }), [w, d] = S(!0), v = O([n]);
1531
+ A(() => {
1532
+ w !== !1 && v.current[v.current.length - 1] !== n && (v.current.push(n), d(!1));
1574
1533
  }, [v, n]);
1575
1534
  let u = C(() => ({ show: n, appear: r, initial: w }), [n, r, w]);
1576
- N(() => {
1577
- n ? y("visible") : !Ze(b) && o.current !== null && y("hidden");
1535
+ A(() => {
1536
+ n ? y("visible") : !Ze(b) && a.current !== null && y("hidden");
1578
1537
  }, [n, b]);
1579
- let m = { unmount: l }, p = S(() => {
1538
+ let m = { unmount: l }, p = L(() => {
1580
1539
  var h;
1581
- w && c(!1), (h = e.beforeEnter) == null || h.call(e);
1582
- }), g = S(() => {
1540
+ w && d(!1), (h = e.beforeEnter) == null || h.call(e);
1541
+ }), g = L(() => {
1583
1542
  var h;
1584
- w && c(!1), (h = e.beforeLeave) == null || h.call(e);
1543
+ w && d(!1), (h = e.beforeLeave) == null || h.call(e);
1585
1544
  }), x = W();
1586
- return E.createElement(Ke.Provider, { value: b }, E.createElement(Ge.Provider, { value: u }, x({ ourProps: { ...m, as: G, children: E.createElement(sn, { ref: i, ...m, ...a, beforeEnter: p, beforeLeave: g }) }, theirProps: {}, defaultTag: G, features: on, visible: f === "visible", name: "Transition" })));
1545
+ return E.createElement(Ke.Provider, { value: b }, E.createElement(Ge.Provider, { value: u }, x({ ourProps: { ...m, as: G, children: E.createElement(an, { ref: i, ...m, ...o, beforeEnter: p, beforeLeave: g }) }, theirProps: {}, defaultTag: G, features: on, visible: f === "visible", name: "Transition" })));
1587
1546
  }
1588
1547
  function tl(e, t) {
1589
1548
  let n = R(Ge) !== null, r = ze() !== null;
1590
- return E.createElement(E.Fragment, null, !n && r ? E.createElement(ut, { ref: t, ...e }) : E.createElement(sn, { ref: t, ...e }));
1549
+ return E.createElement(E.Fragment, null, !n && r ? E.createElement(ut, { ref: t, ...e }) : E.createElement(an, { ref: t, ...e }));
1591
1550
  }
1592
- let ut = D(el), sn = D(Qr), pe = D(tl), un = Object.assign(ut, { Child: pe, Root: ut });
1551
+ let ut = D(el), an = D(Qr), me = D(tl), sn = Object.assign(ut, { Child: me, Root: ut });
1593
1552
  var nl = ((e) => (e[e.Open = 0] = "Open", e[e.Closed = 1] = "Closed", e))(nl || {}), rl = ((e) => (e[e.SetTitleId = 0] = "SetTitleId", e))(rl || {});
1594
1553
  let ll = { 0(e, t) {
1595
1554
  return e.titleId === t.id ? e : { ...e, titleId: t.id };
@@ -1607,65 +1566,65 @@ function il(e, t) {
1607
1566
  return ne(t.type, ll, e, t);
1608
1567
  }
1609
1568
  let Lt = D(function(e, t) {
1610
- let n = Pe(), { id: r = `headlessui-dialog-${n}`, open: l, onClose: a, initialFocus: o, role: s = "dialog", autoFocus: i = !0, __demoMode: d = !1, unmount: f = !1, ...y } = e, b = O(!1);
1569
+ let n = Pe(), { id: r = `headlessui-dialog-${n}`, open: l, onClose: o, initialFocus: a, role: s = "dialog", autoFocus: i = !0, __demoMode: c = !1, unmount: f = !1, ...y } = e, b = O(!1);
1611
1570
  s = function() {
1612
1571
  return s === "dialog" || s === "alertdialog" ? s : (b.current || (b.current = !0, console.warn(`Invalid role [${s}] passed to <Dialog />. Only \`dialog\` and and \`alertdialog\` are supported. Using \`dialog\` instead.`)), "dialog");
1613
1572
  }();
1614
1573
  let w = ze();
1615
1574
  l === void 0 && w !== null && (l = (w & z.Open) === z.Open);
1616
- let c = O(null), v = Z(c, t), u = Me(c), m = l ? 0 : 1, [p, g] = yn(il, { titleId: null, descriptionId: null, panelRef: xn() }), x = S(() => a(!1)), h = S((k) => g({ type: 0, id: k })), $ = Se() ? m === 0 : !1, [F, j] = Ir(), _ = { get current() {
1575
+ let d = O(null), v = Z(d, t), u = Me(d), m = l ? 0 : 1, [p, g] = wn(il, { titleId: null, descriptionId: null, panelRef: yn() }), x = L(() => o(!1)), h = L((k) => g({ type: 0, id: k })), $ = Le() ? m === 0 : !1, [F, j] = Ir(), _ = { get current() {
1617
1576
  var k;
1618
- return (k = p.panelRef.current) != null ? k : c.current;
1619
- } }, A = en(), { resolveContainers: U } = Hr({ mainTreeNode: A, portals: F, defaultContainers: [_] }), B = w !== null ? (w & z.Closing) === z.Closing : !1;
1620
- Jn(d || B ? !1 : $, { allowed: S(() => {
1577
+ return (k = p.panelRef.current) != null ? k : d.current;
1578
+ } }, N = Qt(), { resolveContainers: U } = Hr({ mainTreeNode: N, portals: F, defaultContainers: [_] }), B = w !== null ? (w & z.Closing) === z.Closing : !1;
1579
+ Jn(c || B ? !1 : $, { allowed: L(() => {
1621
1580
  var k, ke;
1622
- return [(ke = (k = c.current) == null ? void 0 : k.closest("[data-headlessui-portal]")) != null ? ke : null];
1623
- }), disallowed: S(() => {
1581
+ return [(ke = (k = d.current) == null ? void 0 : k.closest("[data-headlessui-portal]")) != null ? ke : null];
1582
+ }), disallowed: L(() => {
1624
1583
  var k;
1625
- return [(k = A == null ? void 0 : A.closest("body > *:not(#headlessui-portal-root)")) != null ? k : null];
1626
- }) }), cr($, U, (k) => {
1584
+ return [(k = N == null ? void 0 : N.closest("body > *:not(#headlessui-portal-root)")) != null ? k : null];
1585
+ }) }), dr($, U, (k) => {
1627
1586
  k.preventDefault(), x();
1628
1587
  }), jr($, u == null ? void 0 : u.defaultView, (k) => {
1629
1588
  k.preventDefault(), k.stopPropagation(), document.activeElement && "blur" in document.activeElement && typeof document.activeElement.blur == "function" && document.activeElement.blur(), x();
1630
- }), gr(d || B ? !1 : $, u, U), Qn($, c, x);
1631
- let [X, P] = Bn(), V = C(() => [{ dialogState: m, close: x, setTitleId: h, unmount: f }, p], [m, p, x, h, f]), Le = C(() => ({ open: m === 0 }), [m]), Fe = { ref: v, id: r, role: s, tabIndex: -1, "aria-modal": d ? void 0 : m === 0 ? !0 : void 0, "aria-labelledby": p.titleId, "aria-describedby": X, unmount: f }, he = !Ur(), K = ae.None;
1632
- $ && !d && (K |= ae.RestoreFocus, K |= ae.TabLock, i && (K |= ae.AutoFocus), he && (K |= ae.InitialFocus));
1589
+ }), gr(c || B ? !1 : $, u, U), Qn($, d, x);
1590
+ let [X, P] = Bn(), V = C(() => [{ dialogState: m, close: x, setTitleId: h, unmount: f }, p], [m, p, x, h, f]), Se = C(() => ({ open: m === 0 }), [m]), Fe = { ref: v, id: r, role: s, tabIndex: -1, "aria-modal": c ? void 0 : m === 0 ? !0 : void 0, "aria-labelledby": p.titleId, "aria-describedby": X, unmount: f }, pe = !Ur(), K = ie.None;
1591
+ $ && !c && (K |= ie.RestoreFocus, K |= ie.TabLock, i && (K |= ie.AutoFocus), pe && (K |= ie.InitialFocus));
1633
1592
  let Ce = W();
1634
- return E.createElement(Pr, null, E.createElement(Mt, { force: !0 }, E.createElement(Dr, null, E.createElement(wt.Provider, { value: V }, E.createElement(Jt, { target: c }, E.createElement(Mt, { force: !1 }, E.createElement(P, { slot: Le }, E.createElement(j, null, E.createElement(Vr, { initialFocus: o, initialFocusFallback: c, containers: U, features: K }, E.createElement(Gn, { value: x }, Ce({ ourProps: Fe, theirProps: y, slot: Le, defaultTag: al, features: ol, visible: m === 0, name: "Dialog" })))))))))));
1635
- }), al = "div", ol = Ue.RenderStrategy | Ue.Static;
1593
+ return E.createElement(Pr, null, E.createElement(Pt, { force: !0 }, E.createElement(Dr, null, E.createElement(wt.Provider, { value: V }, E.createElement(Zt, { target: d }, E.createElement(Pt, { force: !1 }, E.createElement(P, { slot: Se }, E.createElement(j, null, E.createElement(Vr, { initialFocus: a, initialFocusFallback: d, containers: U, features: K }, E.createElement(Gn, { value: x }, Ce({ ourProps: Fe, theirProps: y, slot: Se, defaultTag: ol, features: al, visible: m === 0, name: "Dialog" })))))))))));
1594
+ }), ol = "div", al = Ue.RenderStrategy | Ue.Static;
1636
1595
  function sl(e, t) {
1637
- let { transition: n = !1, open: r, ...l } = e, a = ze(), o = e.hasOwnProperty("open") || a !== null, s = e.hasOwnProperty("onClose");
1638
- if (!o && !s) throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");
1639
- if (!o) throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");
1596
+ let { transition: n = !1, open: r, ...l } = e, o = ze(), a = e.hasOwnProperty("open") || o !== null, s = e.hasOwnProperty("onClose");
1597
+ if (!a && !s) throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");
1598
+ if (!a) throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");
1640
1599
  if (!s) throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");
1641
- if (!a && typeof e.open != "boolean") throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${e.open}`);
1600
+ if (!o && typeof e.open != "boolean") throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${e.open}`);
1642
1601
  if (typeof e.onClose != "function") throw new Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${e.onClose}`);
1643
- return (r !== void 0 || n) && !l.static ? E.createElement(St, null, E.createElement(un, { show: r, transition: n, unmount: l.unmount }, E.createElement(Lt, { ref: t, ...l }))) : E.createElement(St, null, E.createElement(Lt, { ref: t, open: r, ...l }));
1602
+ return (r !== void 0 || n) && !l.static ? E.createElement(Mt, null, E.createElement(sn, { show: r, transition: n, unmount: l.unmount }, E.createElement(Lt, { ref: t, ...l }))) : E.createElement(Mt, null, E.createElement(Lt, { ref: t, open: r, ...l }));
1644
1603
  }
1645
1604
  let ul = "div";
1646
- function dl(e, t) {
1647
- let n = Pe(), { id: r = `headlessui-dialog-panel-${n}`, transition: l = !1, ...a } = e, [{ dialogState: o, unmount: s }, i] = Je("Dialog.Panel"), d = Z(t, i.panelRef), f = C(() => ({ open: o === 0 }), [o]), y = S((u) => {
1605
+ function cl(e, t) {
1606
+ let n = Pe(), { id: r = `headlessui-dialog-panel-${n}`, transition: l = !1, ...o } = e, [{ dialogState: a, unmount: s }, i] = Je("Dialog.Panel"), c = Z(t, i.panelRef), f = C(() => ({ open: a === 0 }), [a]), y = L((u) => {
1648
1607
  u.stopPropagation();
1649
- }), b = { ref: d, id: r, onClick: y }, w = l ? pe : G, c = l ? { unmount: s } : {}, v = W();
1650
- return E.createElement(w, { ...c }, v({ ourProps: b, theirProps: a, slot: f, defaultTag: ul, name: "Dialog.Panel" }));
1608
+ }), b = { ref: c, id: r, onClick: y }, w = l ? me : G, d = l ? { unmount: s } : {}, v = W();
1609
+ return E.createElement(w, { ...d }, v({ ourProps: b, theirProps: o, slot: f, defaultTag: ul, name: "Dialog.Panel" }));
1651
1610
  }
1652
- let cl = "div";
1611
+ let dl = "div";
1653
1612
  function fl(e, t) {
1654
- let { transition: n = !1, ...r } = e, [{ dialogState: l, unmount: a }] = Je("Dialog.Backdrop"), o = C(() => ({ open: l === 0 }), [l]), s = { ref: t, "aria-hidden": !0 }, i = n ? pe : G, d = n ? { unmount: a } : {}, f = W();
1655
- return E.createElement(i, { ...d }, f({ ourProps: s, theirProps: r, slot: o, defaultTag: cl, name: "Dialog.Backdrop" }));
1613
+ let { transition: n = !1, ...r } = e, [{ dialogState: l, unmount: o }] = Je("Dialog.Backdrop"), a = C(() => ({ open: l === 0 }), [l]), s = { ref: t, "aria-hidden": !0 }, i = n ? me : G, c = n ? { unmount: o } : {}, f = W();
1614
+ return E.createElement(i, { ...c }, f({ ourProps: s, theirProps: r, slot: a, defaultTag: dl, name: "Dialog.Backdrop" }));
1656
1615
  }
1657
1616
  let ml = "h2";
1658
1617
  function pl(e, t) {
1659
- let n = Pe(), { id: r = `headlessui-dialog-title-${n}`, ...l } = e, [{ dialogState: a, setTitleId: o }] = Je("Dialog.Title"), s = Z(t);
1660
- M(() => (o(r), () => o(null)), [r, o]);
1661
- let i = C(() => ({ open: a === 0 }), [a]), d = { ref: s, id: r };
1662
- return W()({ ourProps: d, theirProps: l, slot: i, defaultTag: ml, name: "Dialog.Title" });
1618
+ let n = Pe(), { id: r = `headlessui-dialog-title-${n}`, ...l } = e, [{ dialogState: o, setTitleId: a }] = Je("Dialog.Title"), s = Z(t);
1619
+ M(() => (a(r), () => a(null)), [r, a]);
1620
+ let i = C(() => ({ open: o === 0 }), [o]), c = { ref: s, id: r };
1621
+ return W()({ ourProps: c, theirProps: l, slot: i, defaultTag: ml, name: "Dialog.Title" });
1663
1622
  }
1664
- let hl = D(sl), yt = D(dl);
1623
+ let hl = D(sl), yt = D(cl);
1665
1624
  D(fl);
1666
1625
  let vl = D(pl), gl = Object.assign(hl, { Panel: yt, Title: vl, Description: Yn });
1667
- function dn({ onClick: e }) {
1668
- return /* @__PURE__ */ ue(
1626
+ function un({ onClick: e }) {
1627
+ return /* @__PURE__ */ se(
1669
1628
  "button",
1670
1629
  {
1671
1630
  type: "button",
@@ -1698,7 +1657,7 @@ function dn({ onClick: e }) {
1698
1657
  );
1699
1658
  }
1700
1659
  const wl = ({ modalContext: e, config: t, children: n }) => {
1701
- const [r, l] = L(!1);
1660
+ const [r, l] = S(!1);
1702
1661
  return /* @__PURE__ */ T("div", { className: "im-modal-container fixed inset-0 z-40 overflow-y-auto p-4", children: /* @__PURE__ */ T(
1703
1662
  "div",
1704
1663
  {
@@ -1708,7 +1667,7 @@ const wl = ({ modalContext: e, config: t, children: n }) => {
1708
1667
  "items-end": t.position === "bottom"
1709
1668
  }),
1710
1669
  children: /* @__PURE__ */ T(
1711
- pe,
1670
+ me,
1712
1671
  {
1713
1672
  as: "div",
1714
1673
  enterFrom: "opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",
@@ -1729,13 +1688,13 @@ const wl = ({ modalContext: e, config: t, children: n }) => {
1729
1688
  "sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-6xl": t.maxWidth === "6xl",
1730
1689
  "sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-7xl": t.maxWidth === "7xl"
1731
1690
  }),
1732
- children: /* @__PURE__ */ ue(
1691
+ children: /* @__PURE__ */ se(
1733
1692
  yt,
1734
1693
  {
1735
1694
  className: `im-modal-content relative ${t.paddingClasses} ${t.panelClasses}`,
1736
1695
  "data-inertiaui-modal-entered": r,
1737
1696
  children: [
1738
- t.closeButton && /* @__PURE__ */ T("div", { className: "absolute right-0 top-0 pr-3 pt-3", children: /* @__PURE__ */ T(dn, { onClick: e.close }) }),
1697
+ t.closeButton && /* @__PURE__ */ T("div", { className: "absolute right-0 top-0 pr-3 pt-3", children: /* @__PURE__ */ T(un, { onClick: e.close }) }),
1739
1698
  typeof n == "function" ? n({ modalContext: e, config: t }) : n
1740
1699
  ]
1741
1700
  }
@@ -1745,7 +1704,7 @@ const wl = ({ modalContext: e, config: t, children: n }) => {
1745
1704
  }
1746
1705
  ) });
1747
1706
  }, yl = ({ modalContext: e, config: t, children: n }) => {
1748
- const [r, l] = L(!1);
1707
+ const [r, l] = S(!1);
1749
1708
  return /* @__PURE__ */ T("div", { className: "im-slideover-container fixed inset-0 z-40 overflow-y-auto overflow-x-hidden", children: /* @__PURE__ */ T(
1750
1709
  "div",
1751
1710
  {
@@ -1754,7 +1713,7 @@ const wl = ({ modalContext: e, config: t, children: n }) => {
1754
1713
  "justify-end rtl:justify-start": (t == null ? void 0 : t.position) === "right"
1755
1714
  }),
1756
1715
  children: /* @__PURE__ */ T(
1757
- pe,
1716
+ me,
1758
1717
  {
1759
1718
  as: "div",
1760
1719
  enterFrom: `opacity-0 ${t.position === "left" ? "-translate-x-full" : "translate-x-full"}`,
@@ -1775,13 +1734,13 @@ const wl = ({ modalContext: e, config: t, children: n }) => {
1775
1734
  "sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-6xl": t.maxWidth === "6xl",
1776
1735
  "sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-7xl": t.maxWidth === "7xl"
1777
1736
  }),
1778
- children: /* @__PURE__ */ ue(
1737
+ children: /* @__PURE__ */ se(
1779
1738
  yt,
1780
1739
  {
1781
1740
  className: `im-slideover-content relative ${t.paddingClasses} ${t.panelClasses}`,
1782
1741
  "data-inertiaui-modal-entered": r,
1783
1742
  children: [
1784
- t.closeButton && /* @__PURE__ */ T("div", { className: "absolute right-0 top-0 pr-3 pt-3", children: /* @__PURE__ */ T(dn, { onClick: e.close }) }),
1743
+ t.closeButton && /* @__PURE__ */ T("div", { className: "absolute right-0 top-0 pr-3 pt-3", children: /* @__PURE__ */ T(un, { onClick: e.close }) }),
1785
1744
  typeof n == "function" ? n({ modalContext: e, config: t }) : n
1786
1745
  ]
1787
1746
  }
@@ -1790,23 +1749,23 @@ const wl = ({ modalContext: e, config: t, children: n }) => {
1790
1749
  )
1791
1750
  }
1792
1751
  ) });
1793
- }, xl = dt(({ name: e, children: t, onFocus: n = null, onBlur: r = null, onClose: l = null, onSuccess: a = null, onAfterLeave: o = null, ...s }, i) => {
1794
- const d = (y) => typeof t == "function" ? t(y) : t, f = O(null);
1795
- return Ft(i, () => f.current, [f]), /* @__PURE__ */ T(
1796
- Rt,
1752
+ }, xl = ct(({ name: e, children: t, onFocus: n = null, onBlur: r = null, onClose: l = null, onSuccess: o = null, onAfterLeave: a = null, ...s }, i) => {
1753
+ const c = (y) => typeof t == "function" ? t(y) : t, f = O(null);
1754
+ return St(i, () => f.current, [f]), /* @__PURE__ */ T(
1755
+ It,
1797
1756
  {
1798
1757
  ref: f,
1799
1758
  name: e,
1800
1759
  onFocus: n,
1801
1760
  onBlur: r,
1802
1761
  onClose: l,
1803
- onSuccess: a,
1762
+ onSuccess: o,
1804
1763
  ...s,
1805
1764
  children: ({
1806
1765
  afterLeave: y,
1807
1766
  close: b,
1808
1767
  config: w,
1809
- emit: c,
1768
+ emit: d,
1810
1769
  getChildModal: v,
1811
1770
  getParentModal: u,
1812
1771
  id: m,
@@ -1818,12 +1777,12 @@ const wl = ({ modalContext: e, config: t, children: n }) => {
1818
1777
  setOpen: F,
1819
1778
  shouldRender: j
1820
1779
  }) => /* @__PURE__ */ T(
1821
- un,
1780
+ sn,
1822
1781
  {
1823
1782
  appear: !0,
1824
1783
  show: g ?? !1,
1825
- afterLeave: o,
1826
- children: /* @__PURE__ */ ue(
1784
+ afterLeave: a,
1785
+ children: /* @__PURE__ */ se(
1827
1786
  gl,
1828
1787
  {
1829
1788
  as: "div",
@@ -1833,7 +1792,7 @@ const wl = ({ modalContext: e, config: t, children: n }) => {
1833
1792
  "data-inertiaui-modal-index": p,
1834
1793
  children: [
1835
1794
  p === 0 ? /* @__PURE__ */ T(
1836
- pe,
1795
+ me,
1837
1796
  {
1838
1797
  enter: "transition transform ease-in-out duration-300",
1839
1798
  enterFrom: "opacity-0",
@@ -1856,11 +1815,11 @@ const wl = ({ modalContext: e, config: t, children: n }) => {
1856
1815
  {
1857
1816
  modalContext: x,
1858
1817
  config: w,
1859
- children: d({
1818
+ children: c({
1860
1819
  afterLeave: y,
1861
1820
  close: b,
1862
1821
  config: w,
1863
- emit: c,
1822
+ emit: d,
1864
1823
  getChildModal: v,
1865
1824
  getParentModal: u,
1866
1825
  id: m,
@@ -1878,11 +1837,11 @@ const wl = ({ modalContext: e, config: t, children: n }) => {
1878
1837
  {
1879
1838
  modalContext: x,
1880
1839
  config: w,
1881
- children: d({
1840
+ children: c({
1882
1841
  afterLeave: y,
1883
1842
  close: b,
1884
1843
  config: w,
1885
- emit: c,
1844
+ emit: d,
1886
1845
  getChildModal: v,
1887
1846
  getParentModal: u,
1888
1847
  id: m,
@@ -1905,55 +1864,55 @@ const wl = ({ modalContext: e, config: t, children: n }) => {
1905
1864
  );
1906
1865
  });
1907
1866
  xl.displayName = "Modal";
1908
- const Al = ({
1867
+ const Nl = ({
1909
1868
  href: e,
1910
1869
  method: t = "get",
1911
1870
  data: n = {},
1912
1871
  as: r = "a",
1913
1872
  headers: l = {},
1914
- queryStringArrayFormat: a = "brackets",
1915
- onAfterLeave: o = null,
1873
+ queryStringArrayFormat: o = "brackets",
1874
+ onAfterLeave: a = null,
1916
1875
  onBlur: s = null,
1917
1876
  onClose: i = null,
1918
- onError: d = null,
1877
+ onError: c = null,
1919
1878
  onFocus: f = null,
1920
1879
  onStart: y = null,
1921
1880
  onSuccess: b = null,
1922
1881
  navigate: w = null,
1923
- children: c,
1882
+ children: d,
1924
1883
  ...v
1925
1884
  }) => {
1926
- const [u, m] = L(!1), [p, g] = L(null), { stack: x, visit: h } = Xe(), $ = C(() => w ?? ft("navigate"), [w]), F = {}, j = {};
1885
+ const [u, m] = S(!1), [p, g] = S(null), { stack: x, visit: h } = Xe(), $ = C(() => w ?? ft("navigate"), [w]), F = {}, j = {};
1927
1886
  Object.keys(v).forEach((P) => {
1928
- bt.includes(P) || (P.startsWith("on") && typeof v[P] == "function" ? P.toLowerCase() in window ? F[P] = v[P] : j[P] = v[P] : F[P] = v[P]);
1887
+ xt.includes(P) || (P.startsWith("on") && typeof v[P] == "function" ? P.toLowerCase() in window ? F[P] = v[P] : j[P] = v[P] : F[P] = v[P]);
1929
1888
  });
1930
- const [_, A] = L(!1);
1889
+ const [_, N] = S(!1);
1931
1890
  M(() => {
1932
- p && (p.onTopOfStack && _ ? f == null || f() : !p.onTopOfStack && !_ && (s == null || s()), A(!p.onTopOfStack));
1891
+ p && (p.onTopOfStack && _ ? f == null || f() : !p.onTopOfStack && !_ && (s == null || s()), N(!p.onTopOfStack));
1933
1892
  }, [x]);
1934
1893
  const U = Y(() => {
1935
1894
  i == null || i();
1936
1895
  }, [i]), B = Y(() => {
1937
- g(null), o == null || o();
1938
- }, [o]), X = Y(
1896
+ g(null), a == null || a();
1897
+ }, [a]), X = Y(
1939
1898
  (P) => {
1940
1899
  P == null || P.preventDefault(), !u && (e.startsWith("#") || (m(!0), y == null || y()), h(
1941
1900
  e,
1942
1901
  t,
1943
1902
  n,
1944
1903
  l,
1945
- Pn(Ct(v, bt)),
1904
+ Pn(Ft(v, xt)),
1946
1905
  () => U(x.length),
1947
1906
  B,
1948
- a,
1907
+ o,
1949
1908
  $
1950
1909
  ).then((V) => {
1951
1910
  g(V), V.registerEventListenersFromProps(j), b == null || b();
1952
1911
  }).catch((V) => {
1953
- console.error(V), d == null || d(V);
1912
+ console.error(V), c == null || c(V);
1954
1913
  }).finally(() => m(!1)));
1955
1914
  },
1956
- [e, t, n, l, a, v, U, B]
1915
+ [e, t, n, l, o, v, U, B]
1957
1916
  );
1958
1917
  return /* @__PURE__ */ T(
1959
1918
  r,
@@ -1961,27 +1920,27 @@ const Al = ({
1961
1920
  ...F,
1962
1921
  href: e,
1963
1922
  onClick: X,
1964
- children: typeof c == "function" ? c({ loading: u }) : c
1923
+ children: typeof d == "function" ? d({ loading: u }) : d
1965
1924
  }
1966
1925
  );
1967
1926
  };
1968
- function Nl() {
1927
+ function Al() {
1969
1928
  return Xe().stack[Nt()] ?? null;
1970
1929
  }
1971
1930
  const Il = (e) => (t) => (t.default.layout = (n) => Re(e, {}, n), t);
1972
1931
  export {
1973
- Rt as HeadlessModal,
1932
+ It as HeadlessModal,
1974
1933
  xl as Modal,
1975
- Al as ModalLink,
1934
+ Nl as ModalLink,
1976
1935
  Fn as ModalRoot,
1977
- Sn as ModalStackProvider,
1936
+ Ln as ModalStackProvider,
1978
1937
  ft as getConfig,
1979
- Ln as initFromPageProps,
1980
- Ll as putConfig,
1938
+ Sn as initFromPageProps,
1939
+ Sl as putConfig,
1981
1940
  Fl as renderApp,
1982
- Sl as resetConfig,
1941
+ Ll as resetConfig,
1983
1942
  Il as setPageLayout,
1984
- Nl as useModal,
1943
+ Al as useModal,
1985
1944
  Nt as useModalIndex,
1986
1945
  Xe as useModalStack
1987
1946
  };