@kakadu/components 1.7.5 → 1.7.6

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,10 +1,9 @@
1
- import { j as C } from "../jsx-runtime-B4hRZ52C.mjs";
2
- import Ie, { createContext as Ae, useRef as te, useState as re, useCallback as J, useMemo as ne, useEffect as H, useContext as je } from "react";
1
+ import { j as N } from "../jsx-runtime-B4hRZ52C.mjs";
2
+ import je, { createContext as Ie, useRef as te, useState as re, useCallback as J, useMemo as ne, useEffect as H, useContext as Ae } from "react";
3
3
  import { cx as pe } from "@kuma-ui/core";
4
4
  import { createPortal as xe } from "react-dom";
5
5
  import { a as _e } from "../icon-C6X3pQX0.mjs";
6
- import Le from "../theme.mjs";
7
- import Be from "./text-button.mjs";
6
+ import Le from "./text-button.mjs";
8
7
  function we(r) {
9
8
  if (Object.prototype.hasOwnProperty.call(r, "__esModule")) return r;
10
9
  var e = r.default;
@@ -29,7 +28,7 @@ var Q = { exports: {} };
29
28
  * tabbable 6.4.0
30
29
  * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
31
30
  */
32
- var ke = ["input:not([inert]):not([inert] *)", "select:not([inert]):not([inert] *)", "textarea:not([inert]):not([inert] *)", "a[href]:not([inert]):not([inert] *)", "button:not([inert]):not([inert] *)", "[tabindex]:not(slot):not([inert]):not([inert] *)", "audio[controls]:not([inert]):not([inert] *)", "video[controls]:not([inert]):not([inert] *)", '[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)', "details>summary:first-of-type:not([inert]):not([inert] *)", "details:not([inert]):not([inert] *)"], ie = /* @__PURE__ */ ke.join(","), Ee = typeof Element > "u", W = Ee ? function() {
31
+ var ke = ["input:not([inert]):not([inert] *)", "select:not([inert]):not([inert] *)", "textarea:not([inert]):not([inert] *)", "a[href]:not([inert]):not([inert] *)", "button:not([inert]):not([inert] *)", "[tabindex]:not(slot):not([inert]):not([inert] *)", "audio[controls]:not([inert]):not([inert] *)", "video[controls]:not([inert]):not([inert] *)", '[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)', "details>summary:first-of-type:not([inert]):not([inert] *)", "details:not([inert]):not([inert] *)"], ie = /* @__PURE__ */ ke.join(","), Ee = typeof Element > "u", z = Ee ? function() {
33
32
  } : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector, oe = !Ee && Element.prototype.getRootNode ? function(r) {
34
33
  var e;
35
34
  return r == null || (e = r.getRootNode) === null || e === void 0 ? void 0 : e.call(r);
@@ -38,73 +37,73 @@ var ke = ["input:not([inert]):not([inert] *)", "select:not([inert]):not([inert]
38
37
  }, ue = function(e, t) {
39
38
  var a;
40
39
  t === void 0 && (t = !0);
41
- var u = e == null || (a = e.getAttribute) === null || a === void 0 ? void 0 : a.call(e, "inert"), l = u === "" || u === "true", n = l || t && e && // closest does not exist on shadow roots, so we fall back to a manual
40
+ var u = e == null || (a = e.getAttribute) === null || a === void 0 ? void 0 : a.call(e, "inert"), c = u === "" || u === "true", n = c || t && e && // closest does not exist on shadow roots, so we fall back to a manual
42
41
  // lookup upward, in case it is not defined.
43
42
  (typeof e.closest == "function" ? e.closest("[inert]") : ue(e.parentNode));
44
43
  return n;
45
- }, Me = function(e) {
44
+ }, Be = function(e) {
46
45
  var t, a = e == null || (t = e.getAttribute) === null || t === void 0 ? void 0 : t.call(e, "contenteditable");
47
46
  return a === "" || a === "true";
48
47
  }, Fe = function(e, t, a) {
49
48
  if (ue(e))
50
49
  return [];
51
50
  var u = Array.prototype.slice.apply(e.querySelectorAll(ie));
52
- return t && W.call(e, ie) && u.unshift(e), u = u.filter(a), u;
51
+ return t && z.call(e, ie) && u.unshift(e), u = u.filter(a), u;
53
52
  }, se = function(e, t, a) {
54
- for (var u = [], l = Array.from(e); l.length; ) {
55
- var n = l.shift();
53
+ for (var u = [], c = Array.from(e); c.length; ) {
54
+ var n = c.shift();
56
55
  if (!ue(n, !1))
57
56
  if (n.tagName === "SLOT") {
58
- var p = n.assignedElements(), y = p.length ? p : n.children, k = se(y, !0, a);
57
+ var b = n.assignedElements(), g = b.length ? b : n.children, k = se(g, !0, a);
59
58
  a.flatten ? u.push.apply(u, k) : u.push({
60
59
  scopeParent: n,
61
60
  candidates: k
62
61
  });
63
62
  } else {
64
- var S = W.call(n, ie);
63
+ var S = z.call(n, ie);
65
64
  S && a.filter(n) && (t || !e.includes(n)) && u.push(n);
66
65
  var D = n.shadowRoot || // check for an undisclosed shadow
67
66
  typeof a.getShadowRoot == "function" && a.getShadowRoot(n), R = !ue(D, !1) && (!a.shadowRootFilter || a.shadowRootFilter(n));
68
67
  if (D && R) {
69
- var j = se(D === !0 ? n.children : D.children, !0, a);
70
- a.flatten ? u.push.apply(u, j) : u.push({
68
+ var I = se(D === !0 ? n.children : D.children, !0, a);
69
+ a.flatten ? u.push.apply(u, I) : u.push({
71
70
  scopeParent: n,
72
- candidates: j
71
+ candidates: I
73
72
  });
74
73
  } else
75
- l.unshift.apply(l, n.children);
74
+ c.unshift.apply(c, n.children);
76
75
  }
77
76
  }
78
77
  return u;
79
78
  }, Se = function(e) {
80
79
  return !isNaN(parseInt(e.getAttribute("tabindex"), 10));
81
- }, q = function(e) {
80
+ }, V = function(e) {
82
81
  if (!e)
83
82
  throw new Error("No node provided");
84
- return e.tabIndex < 0 && (/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName) || Me(e)) && !Se(e) ? 0 : e.tabIndex;
85
- }, Ke = function(e, t) {
86
- var a = q(e);
83
+ return e.tabIndex < 0 && (/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName) || Be(e)) && !Se(e) ? 0 : e.tabIndex;
84
+ }, Me = function(e, t) {
85
+ var a = V(e);
87
86
  return a < 0 && t && !Se(e) ? 0 : a;
88
- }, qe = function(e, t) {
87
+ }, Ke = function(e, t) {
89
88
  return e.tabIndex === t.tabIndex ? e.documentOrder - t.documentOrder : e.tabIndex - t.tabIndex;
90
89
  }, Oe = function(e) {
91
90
  return e.tagName === "INPUT";
92
- }, Ve = function(e) {
91
+ }, qe = function(e) {
93
92
  return Oe(e) && e.type === "hidden";
94
- }, $e = function(e) {
93
+ }, Ve = function(e) {
95
94
  var t = e.tagName === "DETAILS" && Array.prototype.slice.apply(e.children).some(function(a) {
96
95
  return a.tagName === "SUMMARY";
97
96
  });
98
97
  return t;
99
- }, Ge = function(e, t) {
98
+ }, $e = function(e, t) {
100
99
  for (var a = 0; a < e.length; a++)
101
100
  if (e[a].checked && e[a].form === t)
102
101
  return e[a];
103
- }, Ue = function(e) {
102
+ }, Ge = function(e) {
104
103
  if (!e.name)
105
104
  return !0;
106
- var t = e.form || oe(e), a = function(p) {
107
- return t.querySelectorAll('input[type="radio"][name="' + p + '"]');
105
+ var t = e.form || oe(e), a = function(b) {
106
+ return t.querySelectorAll('input[type="radio"][name="' + b + '"]');
108
107
  }, u;
109
108
  if (typeof window < "u" && typeof window.CSS < "u" && typeof window.CSS.escape == "function")
110
109
  u = a(window.CSS.escape(e.name));
@@ -114,29 +113,29 @@ var ke = ["input:not([inert]):not([inert] *)", "select:not([inert]):not([inert]
114
113
  } catch (n) {
115
114
  return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s", n.message), !1;
116
115
  }
117
- var l = Ge(u, e.form);
118
- return !l || l === e;
119
- }, We = function(e) {
116
+ var c = $e(u, e.form);
117
+ return !c || c === e;
118
+ }, Ue = function(e) {
120
119
  return Oe(e) && e.type === "radio";
120
+ }, We = function(e) {
121
+ return Ue(e) && !Ge(e);
121
122
  }, ze = function(e) {
122
- return We(e) && !Ue(e);
123
- }, Ye = function(e) {
124
- var t, a = e && oe(e), u = (t = a) === null || t === void 0 ? void 0 : t.host, l = !1;
123
+ var t, a = e && oe(e), u = (t = a) === null || t === void 0 ? void 0 : t.host, c = !1;
125
124
  if (a && a !== e) {
126
- var n, p, y;
127
- for (l = !!((n = u) !== null && n !== void 0 && (p = n.ownerDocument) !== null && p !== void 0 && p.contains(u) || e != null && (y = e.ownerDocument) !== null && y !== void 0 && y.contains(e)); !l && u; ) {
125
+ var n, b, g;
126
+ for (c = !!((n = u) !== null && n !== void 0 && (b = n.ownerDocument) !== null && b !== void 0 && b.contains(u) || e != null && (g = e.ownerDocument) !== null && g !== void 0 && g.contains(e)); !c && u; ) {
128
127
  var k, S, D;
129
- a = oe(u), u = (k = a) === null || k === void 0 ? void 0 : k.host, l = !!((S = u) !== null && S !== void 0 && (D = S.ownerDocument) !== null && D !== void 0 && D.contains(u));
128
+ a = oe(u), u = (k = a) === null || k === void 0 ? void 0 : k.host, c = !!((S = u) !== null && S !== void 0 && (D = S.ownerDocument) !== null && D !== void 0 && D.contains(u));
130
129
  }
131
130
  }
132
- return l;
131
+ return c;
133
132
  }, be = function(e) {
134
133
  var t = e.getBoundingClientRect(), a = t.width, u = t.height;
135
134
  return a === 0 && u === 0;
136
- }, He = function(e, t) {
135
+ }, Ye = function(e, t) {
137
136
  var a = t.displayCheck, u = t.getShadowRoot;
138
137
  if (a === "full-native" && "checkVisibility" in e) {
139
- var l = e.checkVisibility({
138
+ var c = e.checkVisibility({
140
139
  // Checking opacity might be desirable for some use cases, but natively,
141
140
  // opacity zero elements _are_ focusable and tabbable.
142
141
  checkOpacity: !1,
@@ -149,40 +148,40 @@ var ke = ["input:not([inert]):not([inert] *)", "select:not([inert]):not([inert]
149
148
  // we include it anyway.
150
149
  checkVisibilityCSS: !0
151
150
  });
152
- return !l;
151
+ return !c;
153
152
  }
154
153
  if (getComputedStyle(e).visibility === "hidden")
155
154
  return !0;
156
- var n = W.call(e, "details>summary:first-of-type"), p = n ? e.parentElement : e;
157
- if (W.call(p, "details:not([open]) *"))
155
+ var n = z.call(e, "details>summary:first-of-type"), b = n ? e.parentElement : e;
156
+ if (z.call(b, "details:not([open]) *"))
158
157
  return !0;
159
158
  if (!a || a === "full" || // full-native can run this branch when it falls through in case
160
159
  // Element#checkVisibility is unsupported
161
160
  a === "full-native" || a === "legacy-full") {
162
161
  if (typeof u == "function") {
163
- for (var y = e; e; ) {
162
+ for (var g = e; e; ) {
164
163
  var k = e.parentElement, S = oe(e);
165
164
  if (k && !k.shadowRoot && u(k) === !0)
166
165
  return be(e);
167
166
  e.assignedSlot ? e = e.assignedSlot : !k && S !== e.ownerDocument ? e = S.host : e = k;
168
167
  }
169
- e = y;
168
+ e = g;
170
169
  }
171
- if (Ye(e))
170
+ if (ze(e))
172
171
  return !e.getClientRects().length;
173
172
  if (a !== "legacy-full")
174
173
  return !0;
175
174
  } else if (a === "non-zero-area")
176
175
  return be(e);
177
176
  return !1;
178
- }, Ze = function(e) {
177
+ }, He = function(e) {
179
178
  if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))
180
179
  for (var t = e.parentElement; t; ) {
181
180
  if (t.tagName === "FIELDSET" && t.disabled) {
182
181
  for (var a = 0; a < t.children.length; a++) {
183
182
  var u = t.children.item(a);
184
183
  if (u.tagName === "LEGEND")
185
- return W.call(t, "fieldset[disabled] *") ? !0 : !u.contains(e);
184
+ return z.call(t, "fieldset[disabled] *") ? !0 : !u.contains(e);
186
185
  }
187
186
  return !0;
188
187
  }
@@ -190,26 +189,26 @@ var ke = ["input:not([inert]):not([inert] *)", "select:not([inert]):not([inert]
190
189
  }
191
190
  return !1;
192
191
  }, ce = function(e, t) {
193
- return !(t.disabled || Ve(t) || He(t, e) || // For a details element with a summary, the summary element gets the focus
194
- $e(t) || Ze(t));
192
+ return !(t.disabled || qe(t) || Ye(t, e) || // For a details element with a summary, the summary element gets the focus
193
+ Ve(t) || He(t));
195
194
  }, de = function(e, t) {
196
- return !(ze(t) || q(t) < 0 || !ce(e, t));
197
- }, Xe = function(e) {
195
+ return !(We(t) || V(t) < 0 || !ce(e, t));
196
+ }, Ze = function(e) {
198
197
  var t = parseInt(e.getAttribute("tabindex"), 10);
199
198
  return !!(isNaN(t) || t >= 0);
200
199
  }, De = function(e) {
201
200
  var t = [], a = [];
202
- return e.forEach(function(u, l) {
203
- var n = !!u.scopeParent, p = n ? u.scopeParent : u, y = Ke(p, n), k = n ? De(u.candidates) : p;
204
- y === 0 ? n ? t.push.apply(t, k) : t.push(p) : a.push({
205
- documentOrder: l,
206
- tabIndex: y,
201
+ return e.forEach(function(u, c) {
202
+ var n = !!u.scopeParent, b = n ? u.scopeParent : u, g = Me(b, n), k = n ? De(u.candidates) : b;
203
+ g === 0 ? n ? t.push.apply(t, k) : t.push(b) : a.push({
204
+ documentOrder: c,
205
+ tabIndex: g,
207
206
  item: u,
208
207
  isScope: n,
209
208
  content: k
210
209
  });
211
- }), a.sort(qe).reduce(function(u, l) {
212
- return l.isScope ? u.push.apply(u, l.content) : u.push(l.content), u;
210
+ }), a.sort(Ke).reduce(function(u, c) {
211
+ return c.isScope ? u.push.apply(u, c.content) : u.push(c.content), u;
213
212
  }, []).concat(t);
214
213
  }, Ne = function(e, t) {
215
214
  t = t || {};
@@ -218,7 +217,7 @@ var ke = ["input:not([inert]):not([inert] *)", "select:not([inert]):not([inert]
218
217
  filter: de.bind(null, t),
219
218
  flatten: !1,
220
219
  getShadowRoot: t.getShadowRoot,
221
- shadowRootFilter: Xe
220
+ shadowRootFilter: Ze
222
221
  }) : a = Fe(e, t.includeContainer, de.bind(null, t)), De(a);
223
222
  }, Re = function(e, t) {
224
223
  t = t || {};
@@ -228,21 +227,21 @@ var ke = ["input:not([inert]):not([inert] *)", "select:not([inert]):not([inert]
228
227
  flatten: !0,
229
228
  getShadowRoot: t.getShadowRoot
230
229
  }) : a = Fe(e, t.includeContainer, ce.bind(null, t)), a;
231
- }, U = function(e, t) {
230
+ }, W = function(e, t) {
232
231
  if (t = t || {}, !e)
233
232
  throw new Error("No node provided");
234
- return W.call(e, ie) === !1 ? !1 : de(t, e);
235
- }, Je = /* @__PURE__ */ ke.concat("iframe:not([inert]):not([inert] *)").join(","), ae = function(e, t) {
233
+ return z.call(e, ie) === !1 ? !1 : de(t, e);
234
+ }, Xe = /* @__PURE__ */ ke.concat("iframe:not([inert]):not([inert] *)").join(","), ae = function(e, t) {
236
235
  if (t = t || {}, !e)
237
236
  throw new Error("No node provided");
238
- return W.call(e, Je) === !1 ? !1 : ce(t, e);
237
+ return z.call(e, Xe) === !1 ? !1 : ce(t, e);
239
238
  };
240
- const Qe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
239
+ const Je = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
241
240
  __proto__: null,
242
241
  focusable: Re,
243
- getTabIndex: q,
242
+ getTabIndex: V,
244
243
  isFocusable: ae,
245
- isTabbable: U,
244
+ isTabbable: W,
246
245
  tabbable: Ne
247
246
  }, Symbol.toStringTag, { value: "Module" }));
248
247
  /*!
@@ -254,7 +253,7 @@ function ve(r, e) {
254
253
  for (var t = 0, a = Array(e); t < e; t++) a[t] = r[t];
255
254
  return a;
256
255
  }
257
- function et(r) {
256
+ function Qe(r) {
258
257
  if (Array.isArray(r)) return ve(r);
259
258
  }
260
259
  function he(r, e) {
@@ -274,8 +273,8 @@ function he(r, e) {
274
273
  value: r[a++]
275
274
  };
276
275
  },
277
- e: function(y) {
278
- throw y;
276
+ e: function(g) {
277
+ throw g;
279
278
  },
280
279
  f: u
281
280
  };
@@ -283,39 +282,39 @@ function he(r, e) {
283
282
  throw new TypeError(`Invalid attempt to iterate non-iterable instance.
284
283
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
285
284
  }
286
- var l, n = !0, p = !1;
285
+ var c, n = !0, b = !1;
287
286
  return {
288
287
  s: function() {
289
288
  t = t.call(r);
290
289
  },
291
290
  n: function() {
292
- var y = t.next();
293
- return n = y.done, y;
291
+ var g = t.next();
292
+ return n = g.done, g;
294
293
  },
295
- e: function(y) {
296
- p = !0, l = y;
294
+ e: function(g) {
295
+ b = !0, c = g;
297
296
  },
298
297
  f: function() {
299
298
  try {
300
299
  n || t.return == null || t.return();
301
300
  } finally {
302
- if (p) throw l;
301
+ if (b) throw c;
303
302
  }
304
303
  }
305
304
  };
306
305
  }
307
- function tt(r, e, t) {
308
- return (e = ot(e)) in r ? Object.defineProperty(r, e, {
306
+ function et(r, e, t) {
307
+ return (e = it(e)) in r ? Object.defineProperty(r, e, {
309
308
  value: t,
310
309
  enumerable: !0,
311
310
  configurable: !0,
312
311
  writable: !0
313
312
  }) : r[e] = t, r;
314
313
  }
315
- function rt(r) {
314
+ function tt(r) {
316
315
  if (typeof Symbol < "u" && r[Symbol.iterator] != null || r["@@iterator"] != null) return Array.from(r);
317
316
  }
318
- function at() {
317
+ function rt() {
319
318
  throw new TypeError(`Invalid attempt to spread non-iterable instance.
320
319
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
321
320
  }
@@ -333,17 +332,17 @@ function me(r) {
333
332
  for (var e = 1; e < arguments.length; e++) {
334
333
  var t = arguments[e] != null ? arguments[e] : {};
335
334
  e % 2 ? ye(Object(t), !0).forEach(function(a) {
336
- tt(r, a, t[a]);
335
+ et(r, a, t[a]);
337
336
  }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(r, Object.getOwnPropertyDescriptors(t)) : ye(Object(t)).forEach(function(a) {
338
337
  Object.defineProperty(r, a, Object.getOwnPropertyDescriptor(t, a));
339
338
  });
340
339
  }
341
340
  return r;
342
341
  }
343
- function nt(r) {
344
- return et(r) || rt(r) || Pe(r) || at();
342
+ function at(r) {
343
+ return Qe(r) || tt(r) || Pe(r) || rt();
345
344
  }
346
- function it(r, e) {
345
+ function nt(r, e) {
347
346
  if (typeof r != "object" || !r) return r;
348
347
  var t = r[Symbol.toPrimitive];
349
348
  if (t !== void 0) {
@@ -353,8 +352,8 @@ function it(r, e) {
353
352
  }
354
353
  return (e === "string" ? String : Number)(r);
355
354
  }
356
- function ot(r) {
357
- var e = it(r, "string");
355
+ function it(r) {
356
+ var e = nt(r, "string");
358
357
  return typeof e == "symbol" ? e : e + "";
359
358
  }
360
359
  function Pe(r, e) {
@@ -391,15 +390,15 @@ var B = {
391
390
  var t = B.getActiveTrap(e);
392
391
  t && !t._isManuallyPaused() && t._setPausedState(!1);
393
392
  }
394
- }, ut = function(e) {
393
+ }, ot = function(e) {
395
394
  return e.tagName && e.tagName.toLowerCase() === "input" && typeof e.select == "function";
396
- }, st = function(e) {
395
+ }, ut = function(e) {
397
396
  return (e == null ? void 0 : e.key) === "Escape" || (e == null ? void 0 : e.key) === "Esc" || (e == null ? void 0 : e.keyCode) === 27;
398
397
  }, X = function(e) {
399
398
  return (e == null ? void 0 : e.key) === "Tab" || (e == null ? void 0 : e.keyCode) === 9;
400
- }, ct = function(e) {
399
+ }, st = function(e) {
401
400
  return X(e) && !e.shiftKey;
402
- }, lt = function(e) {
401
+ }, ct = function(e) {
403
402
  return X(e) && e.shiftKey;
404
403
  }, ge = function(e) {
405
404
  return setTimeout(e, 0);
@@ -409,14 +408,14 @@ var B = {
409
408
  return typeof e == "function" ? e.apply(void 0, a) : e;
410
409
  }, ee = function(e) {
411
410
  return e.target.shadowRoot && typeof e.composedPath == "function" ? e.composedPath()[0] : e.target;
412
- }, ft = [], dt = function(e, t) {
413
- var a = (t == null ? void 0 : t.document) || document, u = (t == null ? void 0 : t.trapStack) || ft, l = me({
411
+ }, lt = [], ft = function(e, t) {
412
+ var a = (t == null ? void 0 : t.document) || document, u = (t == null ? void 0 : t.trapStack) || lt, c = me({
414
413
  returnFocusOnDeactivate: !0,
415
414
  escapeDeactivates: !0,
416
415
  delayInitialFocus: !0,
417
416
  isolateSubtrees: !1,
418
- isKeyForward: ct,
419
- isKeyBackward: lt
417
+ isKeyForward: st,
418
+ isKeyBackward: ct
420
419
  }, t), n = {
421
420
  // containers given to createFocusTrap()
422
421
  /** @type {Array<HTMLElement>} */
@@ -461,35 +460,35 @@ var B = {
461
460
  delayInitialFocusTimer: void 0,
462
461
  // the most recent KeyboardEvent for the configured nav key (typically [SHIFT+]TAB), if any
463
462
  recentNavEvent: void 0
464
- }, p, y = function(o, i, f) {
465
- return o && o[i] !== void 0 ? o[i] : l[f || i];
463
+ }, b, g = function(o, i, l) {
464
+ return o && o[i] !== void 0 ? o[i] : c[l || i];
466
465
  }, k = function(o, i) {
467
- var f = typeof (i == null ? void 0 : i.composedPath) == "function" ? i.composedPath() : void 0;
468
- return n.containerGroups.findIndex(function(g) {
469
- var h = g.container, T = g.tabbableNodes;
470
- return h.contains(o) || // fall back to explicit tabbable search which will take into consideration any
466
+ var l = typeof (i == null ? void 0 : i.composedPath) == "function" ? i.composedPath() : void 0;
467
+ return n.containerGroups.findIndex(function(m) {
468
+ var y = m.container, w = m.tabbableNodes;
469
+ return y.contains(o) || // fall back to explicit tabbable search which will take into consideration any
471
470
  // web components if the `tabbableOptions.getShadowRoot` option was used for
472
471
  // the trap, enabling shadow DOM support in tabbable (`Node.contains()` doesn't
473
472
  // look inside web components even if open)
474
- (f == null ? void 0 : f.includes(h)) || T.find(function(v) {
475
- return v === o;
473
+ (l == null ? void 0 : l.includes(y)) || w.find(function(p) {
474
+ return p === o;
476
475
  });
477
476
  });
478
477
  }, S = function(o) {
479
- var i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, f = i.hasFallback, g = f === void 0 ? !1 : f, h = i.params, T = h === void 0 ? [] : h, v = l[o];
480
- if (typeof v == "function" && (v = v.apply(void 0, nt(T))), v === !0 && (v = void 0), !v) {
481
- if (v === void 0 || v === !1)
482
- return v;
478
+ var i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, l = i.hasFallback, m = l === void 0 ? !1 : l, y = i.params, w = y === void 0 ? [] : y, p = c[o];
479
+ if (typeof p == "function" && (p = p.apply(void 0, at(w))), p === !0 && (p = void 0), !p) {
480
+ if (p === void 0 || p === !1)
481
+ return p;
483
482
  throw new Error("`".concat(o, "` was specified but was not a node, or did not return a node"));
484
483
  }
485
- var E = v;
486
- if (typeof v == "string") {
484
+ var E = p;
485
+ if (typeof p == "string") {
487
486
  try {
488
- E = a.querySelector(v);
487
+ E = a.querySelector(p);
489
488
  } catch (F) {
490
489
  throw new Error("`".concat(o, '` appears to be an invalid selector; error="').concat(F.message, '"'));
491
490
  }
492
- if (!E && !g)
491
+ if (!E && !m)
493
492
  throw new Error("`".concat(o, "` as selector refers to no known node"));
494
493
  }
495
494
  return E;
@@ -499,12 +498,12 @@ var B = {
499
498
  });
500
499
  if (o === !1)
501
500
  return !1;
502
- if (o === void 0 || o && !ae(o, l.tabbableOptions))
501
+ if (o === void 0 || o && !ae(o, c.tabbableOptions))
503
502
  if (k(a.activeElement) >= 0)
504
503
  o = a.activeElement;
505
504
  else {
506
- var i = n.tabbableGroups[0], f = i && i.firstTabbableNode;
507
- o = f || S("fallbackFocus");
505
+ var i = n.tabbableGroups[0], l = i && i.firstTabbableNode;
506
+ o = l || S("fallbackFocus");
508
507
  }
509
508
  else o === null && (o = S("fallbackFocus"));
510
509
  if (!o)
@@ -512,23 +511,23 @@ var B = {
512
511
  return o;
513
512
  }, R = function() {
514
513
  if (n.containerGroups = n.containers.map(function(o) {
515
- var i = Ne(o, l.tabbableOptions), f = Re(o, l.tabbableOptions), g = i.length > 0 ? i[0] : void 0, h = i.length > 0 ? i[i.length - 1] : void 0, T = f.find(function(F) {
516
- return U(F);
517
- }), v = f.slice().reverse().find(function(F) {
518
- return U(F);
514
+ var i = Ne(o, c.tabbableOptions), l = Re(o, c.tabbableOptions), m = i.length > 0 ? i[0] : void 0, y = i.length > 0 ? i[i.length - 1] : void 0, w = l.find(function(F) {
515
+ return W(F);
516
+ }), p = l.slice().reverse().find(function(F) {
517
+ return W(F);
519
518
  }), E = !!i.find(function(F) {
520
- return q(F) > 0;
519
+ return V(F) > 0;
521
520
  });
522
521
  return {
523
522
  container: o,
524
523
  tabbableNodes: i,
525
- focusableNodes: f,
524
+ focusableNodes: l,
526
525
  /** True if at least one node with positive `tabindex` was found in this container. */
527
526
  posTabIndexesFound: E,
528
527
  /** First tabbable node in container, __tabindex__ order; `undefined` if none. */
529
- firstTabbableNode: g,
528
+ firstTabbableNode: m,
530
529
  /** Last tabbable node in container, __tabindex__ order; `undefined` if none. */
531
- lastTabbableNode: h,
530
+ lastTabbableNode: y,
532
531
  // NOTE: DOM order is NOT NECESSARILY "document position" order, but figuring that out
533
532
  // would require more than just https://developer.mozilla.org/en-US/docs/Web/API/Node/compareDocumentPosition
534
533
  // because that API doesn't work with Shadow DOM as well as it should (@see
@@ -537,9 +536,9 @@ var B = {
537
536
  // "close enough most of the time" alternative for positive tabindexes which should generally
538
537
  // be avoided anyway...
539
538
  /** First tabbable node in container, __DOM__ order; `undefined` if none. */
540
- firstDomTabbableNode: T,
539
+ firstDomTabbableNode: w,
541
540
  /** Last tabbable node in container, __DOM__ order; `undefined` if none. */
542
- lastDomTabbableNode: v,
541
+ lastDomTabbableNode: p,
543
542
  /**
544
543
  * Finds the __tabbable__ node that follows the given node in the specified direction,
545
544
  * in this container, if any.
@@ -548,13 +547,13 @@ var B = {
548
547
  * in reverse.
549
548
  * @returns {HTMLElement|undefined} The next tabbable node, if any.
550
549
  */
551
- nextTabbableNode: function(P) {
552
- var L = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0, A = i.indexOf(P);
553
- return A < 0 ? L ? f.slice(f.indexOf(P) + 1).find(function(G) {
554
- return U(G);
555
- }) : f.slice(0, f.indexOf(P)).reverse().find(function(G) {
556
- return U(G);
557
- }) : i[A + (L ? 1 : -1)];
550
+ nextTabbableNode: function(C) {
551
+ var _ = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0, A = i.indexOf(C);
552
+ return A < 0 ? _ ? l.slice(l.indexOf(C) + 1).find(function(U) {
553
+ return W(U);
554
+ }) : l.slice(0, l.indexOf(C)).reverse().find(function(U) {
555
+ return W(U);
556
+ }) : i[A + (_ ? 1 : -1)];
558
557
  }
559
558
  };
560
559
  }), n.tabbableGroups = n.containerGroups.filter(function(o) {
@@ -565,189 +564,189 @@ var B = {
565
564
  return o.posTabIndexesFound;
566
565
  }) && n.containerGroups.length > 1)
567
566
  throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.");
568
- }, j = function(o) {
567
+ }, I = function(o) {
569
568
  var i = o.activeElement;
570
569
  if (i)
571
- return i.shadowRoot && i.shadowRoot.activeElement !== null ? j(i.shadowRoot) : i;
572
- }, N = function(o) {
573
- if (o !== !1 && o !== j(document)) {
570
+ return i.shadowRoot && i.shadowRoot.activeElement !== null ? I(i.shadowRoot) : i;
571
+ }, j = function(o) {
572
+ if (o !== !1 && o !== I(document)) {
574
573
  if (!o || !o.focus) {
575
- N(D());
574
+ j(D());
576
575
  return;
577
576
  }
578
577
  o.focus({
579
- preventScroll: !!l.preventScroll
580
- }), n.mostRecentlyFocusedNode = o, ut(o) && o.select();
578
+ preventScroll: !!c.preventScroll
579
+ }), n.mostRecentlyFocusedNode = o, ot(o) && o.select();
581
580
  }
582
581
  }, x = function(o) {
583
582
  var i = S("setReturnFocus", {
584
583
  params: [o]
585
584
  });
586
585
  return i || (i === !1 ? !1 : o);
587
- }, I = function(o) {
588
- var i = o.target, f = o.event, g = o.isBackward, h = g === void 0 ? !1 : g;
589
- i = i || ee(f), R();
590
- var T = null;
586
+ }, P = function(o) {
587
+ var i = o.target, l = o.event, m = o.isBackward, y = m === void 0 ? !1 : m;
588
+ i = i || ee(l), R();
589
+ var w = null;
591
590
  if (n.tabbableGroups.length > 0) {
592
- var v = k(i, f), E = v >= 0 ? n.containerGroups[v] : void 0;
593
- if (v < 0)
594
- h ? T = n.tabbableGroups[n.tabbableGroups.length - 1].lastTabbableNode : T = n.tabbableGroups[0].firstTabbableNode;
595
- else if (h) {
591
+ var p = k(i, l), E = p >= 0 ? n.containerGroups[p] : void 0;
592
+ if (p < 0)
593
+ y ? w = n.tabbableGroups[n.tabbableGroups.length - 1].lastTabbableNode : w = n.tabbableGroups[0].firstTabbableNode;
594
+ else if (y) {
596
595
  var F = n.tabbableGroups.findIndex(function(le) {
597
596
  var fe = le.firstTabbableNode;
598
597
  return i === fe;
599
598
  });
600
- if (F < 0 && (E.container === i || ae(i, l.tabbableOptions) && !U(i, l.tabbableOptions) && !E.nextTabbableNode(i, !1)) && (F = v), F >= 0) {
601
- var P = F === 0 ? n.tabbableGroups.length - 1 : F - 1, L = n.tabbableGroups[P];
602
- T = q(i) >= 0 ? L.lastTabbableNode : L.lastDomTabbableNode;
603
- } else X(f) || (T = E.nextTabbableNode(i, !1));
599
+ if (F < 0 && (E.container === i || ae(i, c.tabbableOptions) && !W(i, c.tabbableOptions) && !E.nextTabbableNode(i, !1)) && (F = p), F >= 0) {
600
+ var C = F === 0 ? n.tabbableGroups.length - 1 : F - 1, _ = n.tabbableGroups[C];
601
+ w = V(i) >= 0 ? _.lastTabbableNode : _.lastDomTabbableNode;
602
+ } else X(l) || (w = E.nextTabbableNode(i, !1));
604
603
  } else {
605
604
  var A = n.tabbableGroups.findIndex(function(le) {
606
605
  var fe = le.lastTabbableNode;
607
606
  return i === fe;
608
607
  });
609
- if (A < 0 && (E.container === i || ae(i, l.tabbableOptions) && !U(i, l.tabbableOptions) && !E.nextTabbableNode(i)) && (A = v), A >= 0) {
610
- var G = A === n.tabbableGroups.length - 1 ? 0 : A + 1, K = n.tabbableGroups[G];
611
- T = q(i) >= 0 ? K.firstTabbableNode : K.firstDomTabbableNode;
612
- } else X(f) || (T = E.nextTabbableNode(i));
608
+ if (A < 0 && (E.container === i || ae(i, c.tabbableOptions) && !W(i, c.tabbableOptions) && !E.nextTabbableNode(i)) && (A = p), A >= 0) {
609
+ var U = A === n.tabbableGroups.length - 1 ? 0 : A + 1, q = n.tabbableGroups[U];
610
+ w = V(i) >= 0 ? q.firstTabbableNode : q.firstDomTabbableNode;
611
+ } else X(l) || (w = E.nextTabbableNode(i));
613
612
  }
614
613
  } else
615
- T = S("fallbackFocus");
616
- return T;
617
- }, _ = function(o) {
614
+ w = S("fallbackFocus");
615
+ return w;
616
+ }, L = function(o) {
618
617
  var i = ee(o);
619
618
  if (!(k(i, o) >= 0)) {
620
- if (Z(l.clickOutsideDeactivates, o)) {
621
- p.deactivate({
619
+ if (Z(c.clickOutsideDeactivates, o)) {
620
+ b.deactivate({
622
621
  // NOTE: by setting `returnFocus: false`, deactivate() will do nothing,
623
622
  // which will result in the outside click setting focus to the node
624
623
  // that was clicked (and if not focusable, to "nothing"); by setting
625
624
  // `returnFocus: true`, we'll attempt to re-focus the node originally-focused
626
625
  // on activation (or the configured `setReturnFocus` node), whether the
627
626
  // outside click was on a focusable node or not
628
- returnFocus: l.returnFocusOnDeactivate
627
+ returnFocus: c.returnFocusOnDeactivate
629
628
  });
630
629
  return;
631
630
  }
632
- Z(l.allowOutsideClick, o) || o.preventDefault();
631
+ Z(c.allowOutsideClick, o) || o.preventDefault();
633
632
  }
634
- }, V = function(o) {
635
- var i = ee(o), f = k(i, o) >= 0;
636
- if (f || i instanceof Document)
637
- f && (n.mostRecentlyFocusedNode = i);
633
+ }, M = function(o) {
634
+ var i = ee(o), l = k(i, o) >= 0;
635
+ if (l || i instanceof Document)
636
+ l && (n.mostRecentlyFocusedNode = i);
638
637
  else {
639
638
  o.stopImmediatePropagation();
640
- var g, h = !0;
639
+ var m, y = !0;
641
640
  if (n.mostRecentlyFocusedNode)
642
- if (q(n.mostRecentlyFocusedNode) > 0) {
643
- var T = k(n.mostRecentlyFocusedNode), v = n.containerGroups[T].tabbableNodes;
644
- if (v.length > 0) {
645
- var E = v.findIndex(function(F) {
641
+ if (V(n.mostRecentlyFocusedNode) > 0) {
642
+ var w = k(n.mostRecentlyFocusedNode), p = n.containerGroups[w].tabbableNodes;
643
+ if (p.length > 0) {
644
+ var E = p.findIndex(function(F) {
646
645
  return F === n.mostRecentlyFocusedNode;
647
646
  });
648
- E >= 0 && (l.isKeyForward(n.recentNavEvent) ? E + 1 < v.length && (g = v[E + 1], h = !1) : E - 1 >= 0 && (g = v[E - 1], h = !1));
647
+ E >= 0 && (c.isKeyForward(n.recentNavEvent) ? E + 1 < p.length && (m = p[E + 1], y = !1) : E - 1 >= 0 && (m = p[E - 1], y = !1));
649
648
  }
650
649
  } else
651
650
  n.containerGroups.some(function(F) {
652
- return F.tabbableNodes.some(function(P) {
653
- return q(P) > 0;
651
+ return F.tabbableNodes.some(function(C) {
652
+ return V(C) > 0;
654
653
  });
655
- }) || (h = !1);
654
+ }) || (y = !1);
656
655
  else
657
- h = !1;
658
- h && (g = I({
656
+ y = !1;
657
+ y && (m = P({
659
658
  // move FROM the MRU node, not event-related node (which will be the node that is
660
659
  // outside the trap causing the focus escape we're trying to fix)
661
660
  target: n.mostRecentlyFocusedNode,
662
- isBackward: l.isKeyBackward(n.recentNavEvent)
663
- })), N(g || n.mostRecentlyFocusedNode || D());
661
+ isBackward: c.isKeyBackward(n.recentNavEvent)
662
+ })), j(m || n.mostRecentlyFocusedNode || D());
664
663
  }
665
664
  n.recentNavEvent = void 0;
666
- }, z = function(o) {
665
+ }, Y = function(o) {
667
666
  var i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
668
667
  n.recentNavEvent = o;
669
- var f = I({
668
+ var l = P({
670
669
  event: o,
671
670
  isBackward: i
672
671
  });
673
- f && (X(o) && o.preventDefault(), N(f));
672
+ l && (X(o) && o.preventDefault(), j(l));
674
673
  }, $ = function(o) {
675
- (l.isKeyForward(o) || l.isKeyBackward(o)) && z(o, l.isKeyBackward(o));
676
- }, Y = function(o) {
677
- st(o) && Z(l.escapeDeactivates, o) !== !1 && (o.preventDefault(), p.deactivate());
678
- }, M = function(o) {
674
+ (c.isKeyForward(o) || c.isKeyBackward(o)) && Y(o, c.isKeyBackward(o));
675
+ }, G = function(o) {
676
+ ut(o) && Z(c.escapeDeactivates, o) !== !1 && (o.preventDefault(), b.deactivate());
677
+ }, K = function(o) {
679
678
  var i = ee(o);
680
- k(i, o) >= 0 || Z(l.clickOutsideDeactivates, o) || Z(l.allowOutsideClick, o) || (o.preventDefault(), o.stopImmediatePropagation());
681
- }, d = function() {
679
+ k(i, o) >= 0 || Z(c.clickOutsideDeactivates, o) || Z(c.allowOutsideClick, o) || (o.preventDefault(), o.stopImmediatePropagation());
680
+ }, v = function() {
682
681
  if (n.active)
683
- return B.activateTrap(u, p), n.delayInitialFocusTimer = l.delayInitialFocus ? ge(function() {
684
- N(D());
685
- }) : N(D()), a.addEventListener("focusin", V, !0), a.addEventListener("mousedown", _, {
682
+ return B.activateTrap(u, b), n.delayInitialFocusTimer = c.delayInitialFocus ? ge(function() {
683
+ j(D());
684
+ }) : j(D()), a.addEventListener("focusin", M, !0), a.addEventListener("mousedown", L, {
686
685
  capture: !0,
687
686
  passive: !1
688
- }), a.addEventListener("touchstart", _, {
687
+ }), a.addEventListener("touchstart", L, {
689
688
  capture: !0,
690
689
  passive: !1
691
- }), a.addEventListener("click", M, {
690
+ }), a.addEventListener("click", K, {
692
691
  capture: !0,
693
692
  passive: !1
694
693
  }), a.addEventListener("keydown", $, {
695
694
  capture: !0,
696
695
  passive: !1
697
- }), a.addEventListener("keydown", Y), p;
698
- }, s = function(o) {
699
- n.active && !n.paused && p._setSubtreeIsolation(!1), n.adjacentElements.clear(), n.alreadySilent.clear();
700
- var i = /* @__PURE__ */ new Set(), f = /* @__PURE__ */ new Set(), g = he(o), h;
696
+ }), a.addEventListener("keydown", G), b;
697
+ }, f = function(o) {
698
+ n.active && !n.paused && b._setSubtreeIsolation(!1), n.adjacentElements.clear(), n.alreadySilent.clear();
699
+ var i = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set(), m = he(o), y;
701
700
  try {
702
- for (g.s(); !(h = g.n()).done; ) {
703
- var T = h.value;
704
- i.add(T);
705
- for (var v = typeof ShadowRoot < "u" && T.getRootNode() instanceof ShadowRoot, E = T; E; ) {
701
+ for (m.s(); !(y = m.n()).done; ) {
702
+ var w = y.value;
703
+ i.add(w);
704
+ for (var p = typeof ShadowRoot < "u" && w.getRootNode() instanceof ShadowRoot, E = w; E; ) {
706
705
  i.add(E);
707
- var F = E.parentElement, P = [];
708
- F ? P = F.children : !F && v && (P = E.getRootNode().children, F = E.getRootNode().host, v = typeof ShadowRoot < "u" && F.getRootNode() instanceof ShadowRoot);
709
- var L = he(P), A;
706
+ var F = E.parentElement, C = [];
707
+ F ? C = F.children : !F && p && (C = E.getRootNode().children, F = E.getRootNode().host, p = typeof ShadowRoot < "u" && F.getRootNode() instanceof ShadowRoot);
708
+ var _ = he(C), A;
710
709
  try {
711
- for (L.s(); !(A = L.n()).done; ) {
712
- var G = A.value;
713
- f.add(G);
710
+ for (_.s(); !(A = _.n()).done; ) {
711
+ var U = A.value;
712
+ l.add(U);
714
713
  }
715
- } catch (K) {
716
- L.e(K);
714
+ } catch (q) {
715
+ _.e(q);
717
716
  } finally {
718
- L.f();
717
+ _.f();
719
718
  }
720
719
  E = F;
721
720
  }
722
721
  }
723
- } catch (K) {
724
- g.e(K);
722
+ } catch (q) {
723
+ m.e(q);
725
724
  } finally {
726
- g.f();
725
+ m.f();
727
726
  }
728
- i.forEach(function(K) {
729
- f.delete(K);
730
- }), n.adjacentElements = f;
731
- }, m = function() {
727
+ i.forEach(function(q) {
728
+ l.delete(q);
729
+ }), n.adjacentElements = l;
730
+ }, d = function() {
732
731
  if (n.active)
733
- return a.removeEventListener("focusin", V, !0), a.removeEventListener("mousedown", _, !0), a.removeEventListener("touchstart", _, !0), a.removeEventListener("click", M, !0), a.removeEventListener("keydown", $, !0), a.removeEventListener("keydown", Y), p;
734
- }, c = function(o) {
735
- var i = o.some(function(f) {
736
- var g = Array.from(f.removedNodes);
737
- return g.some(function(h) {
738
- return h === n.mostRecentlyFocusedNode;
732
+ return a.removeEventListener("focusin", M, !0), a.removeEventListener("mousedown", L, !0), a.removeEventListener("touchstart", L, !0), a.removeEventListener("click", K, !0), a.removeEventListener("keydown", $, !0), a.removeEventListener("keydown", G), b;
733
+ }, s = function(o) {
734
+ var i = o.some(function(l) {
735
+ var m = Array.from(l.removedNodes);
736
+ return m.some(function(y) {
737
+ return y === n.mostRecentlyFocusedNode;
739
738
  });
740
739
  });
741
- i && N(D());
742
- }, w = typeof window < "u" && "MutationObserver" in window ? new MutationObserver(c) : void 0, O = function() {
743
- w && (w.disconnect(), n.active && !n.paused && n.containers.map(function(o) {
744
- w.observe(o, {
740
+ i && j(D());
741
+ }, T = typeof window < "u" && "MutationObserver" in window ? new MutationObserver(s) : void 0, O = function() {
742
+ T && (T.disconnect(), n.active && !n.paused && n.containers.map(function(o) {
743
+ T.observe(o, {
745
744
  subtree: !0,
746
745
  childList: !0
747
746
  });
748
747
  }));
749
748
  };
750
- return p = {
749
+ return b = {
751
750
  get active() {
752
751
  return n.active;
753
752
  },
@@ -757,25 +756,25 @@ var B = {
757
756
  activate: function(o) {
758
757
  if (n.active)
759
758
  return this;
760
- var i = y(o, "onActivate"), f = y(o, "onPostActivate"), g = y(o, "checkCanFocusTrap"), h = B.getActiveTrap(u), T = !1;
761
- if (h && !h.paused) {
762
- var v;
763
- (v = h._setSubtreeIsolation) === null || v === void 0 || v.call(h, !1), T = !0;
759
+ var i = g(o, "onActivate"), l = g(o, "onPostActivate"), m = g(o, "checkCanFocusTrap"), y = B.getActiveTrap(u), w = !1;
760
+ if (y && !y.paused) {
761
+ var p;
762
+ (p = y._setSubtreeIsolation) === null || p === void 0 || p.call(y, !1), w = !0;
764
763
  }
765
764
  try {
766
- g || R(), n.active = !0, n.paused = !1, n.nodeFocusedBeforeActivation = j(a), i == null || i();
765
+ m || R(), n.active = !0, n.paused = !1, n.nodeFocusedBeforeActivation = I(a), i == null || i();
767
766
  var E = function() {
768
- g && R(), d(), O(), l.isolateSubtrees && p._setSubtreeIsolation(!0), f == null || f();
767
+ m && R(), v(), O(), c.isolateSubtrees && b._setSubtreeIsolation(!0), l == null || l();
769
768
  };
770
- if (g)
771
- return g(n.containers.concat()).then(E, E), this;
769
+ if (m)
770
+ return m(n.containers.concat()).then(E, E), this;
772
771
  E();
773
- } catch (P) {
774
- if (h === B.getActiveTrap(u) && T) {
772
+ } catch (C) {
773
+ if (y === B.getActiveTrap(u) && w) {
775
774
  var F;
776
- (F = h._setSubtreeIsolation) === null || F === void 0 || F.call(h, !0);
775
+ (F = y._setSubtreeIsolation) === null || F === void 0 || F.call(y, !0);
777
776
  }
778
- throw P;
777
+ throw C;
779
778
  }
780
779
  return this;
781
780
  },
@@ -783,19 +782,19 @@ var B = {
783
782
  if (!n.active)
784
783
  return this;
785
784
  var i = me({
786
- onDeactivate: l.onDeactivate,
787
- onPostDeactivate: l.onPostDeactivate,
788
- checkCanReturnFocus: l.checkCanReturnFocus
785
+ onDeactivate: c.onDeactivate,
786
+ onPostDeactivate: c.onPostDeactivate,
787
+ checkCanReturnFocus: c.checkCanReturnFocus
789
788
  }, o);
790
- clearTimeout(n.delayInitialFocusTimer), n.delayInitialFocusTimer = void 0, n.paused || p._setSubtreeIsolation(!1), n.alreadySilent.clear(), m(), n.active = !1, n.paused = !1, O(), B.deactivateTrap(u, p);
791
- var f = y(i, "onDeactivate"), g = y(i, "onPostDeactivate"), h = y(i, "checkCanReturnFocus"), T = y(i, "returnFocus", "returnFocusOnDeactivate");
792
- f == null || f();
793
- var v = function() {
789
+ clearTimeout(n.delayInitialFocusTimer), n.delayInitialFocusTimer = void 0, n.paused || b._setSubtreeIsolation(!1), n.alreadySilent.clear(), d(), n.active = !1, n.paused = !1, O(), B.deactivateTrap(u, b);
790
+ var l = g(i, "onDeactivate"), m = g(i, "onPostDeactivate"), y = g(i, "checkCanReturnFocus"), w = g(i, "returnFocus", "returnFocusOnDeactivate");
791
+ l == null || l();
792
+ var p = function() {
794
793
  ge(function() {
795
- T && N(x(n.nodeFocusedBeforeActivation)), g == null || g();
794
+ w && j(x(n.nodeFocusedBeforeActivation)), m == null || m();
796
795
  });
797
796
  };
798
- return T && h ? (h(x(n.nodeFocusedBeforeActivation)).then(v, v), this) : (v(), this);
797
+ return w && y ? (y(x(n.nodeFocusedBeforeActivation)).then(p, p), this) : (p(), this);
799
798
  },
800
799
  pause: function(o) {
801
800
  return n.active ? (n.manuallyPaused = !0, this._setPausedState(!0, o)) : this;
@@ -805,11 +804,11 @@ var B = {
805
804
  },
806
805
  updateContainerElements: function(o) {
807
806
  var i = [].concat(o).filter(Boolean);
808
- return n.containers = i.map(function(f) {
809
- return typeof f == "string" ? a.querySelector(f) : f;
810
- }), l.isolateSubtrees && s(n.containers), n.active && (R(), l.isolateSubtrees && !n.paused && p._setSubtreeIsolation(!0)), O(), this;
807
+ return n.containers = i.map(function(l) {
808
+ return typeof l == "string" ? a.querySelector(l) : l;
809
+ }), c.isolateSubtrees && f(n.containers), n.active && (R(), c.isolateSubtrees && !n.paused && b._setSubtreeIsolation(!0)), O(), this;
811
810
  }
812
- }, Object.defineProperties(p, {
811
+ }, Object.defineProperties(b, {
813
812
  _isManuallyPaused: {
814
813
  value: function() {
815
814
  return n.manuallyPaused;
@@ -820,29 +819,29 @@ var B = {
820
819
  if (n.paused === o)
821
820
  return this;
822
821
  if (n.paused = o, o) {
823
- var f = y(i, "onPause"), g = y(i, "onPostPause");
824
- f == null || f(), m(), O(), p._setSubtreeIsolation(!1), g == null || g();
822
+ var l = g(i, "onPause"), m = g(i, "onPostPause");
823
+ l == null || l(), d(), O(), b._setSubtreeIsolation(!1), m == null || m();
825
824
  } else {
826
- var h = y(i, "onUnpause"), T = y(i, "onPostUnpause");
827
- h == null || h(), p._setSubtreeIsolation(!0), R(), d(), O(), T == null || T();
825
+ var y = g(i, "onUnpause"), w = g(i, "onPostUnpause");
826
+ y == null || y(), b._setSubtreeIsolation(!0), R(), v(), O(), w == null || w();
828
827
  }
829
828
  return this;
830
829
  }
831
830
  },
832
831
  _setSubtreeIsolation: {
833
832
  value: function(o) {
834
- l.isolateSubtrees && n.adjacentElements.forEach(function(i) {
835
- var f;
833
+ c.isolateSubtrees && n.adjacentElements.forEach(function(i) {
834
+ var l;
836
835
  if (o)
837
- switch (l.isolateSubtrees) {
836
+ switch (c.isolateSubtrees) {
838
837
  case "aria-hidden":
839
- (i.ariaHidden === "true" || ((f = i.getAttribute("aria-hidden")) === null || f === void 0 ? void 0 : f.toLowerCase()) === "true") && n.alreadySilent.add(i), i.setAttribute("aria-hidden", "true");
838
+ (i.ariaHidden === "true" || ((l = i.getAttribute("aria-hidden")) === null || l === void 0 ? void 0 : l.toLowerCase()) === "true") && n.alreadySilent.add(i), i.setAttribute("aria-hidden", "true");
840
839
  break;
841
840
  default:
842
841
  (i.inert || i.hasAttribute("inert")) && n.alreadySilent.add(i), i.setAttribute("inert", !0);
843
842
  break;
844
843
  }
845
- else if (!n.alreadySilent.has(i)) switch (l.isolateSubtrees) {
844
+ else if (!n.alreadySilent.has(i)) switch (c.isolateSubtrees) {
846
845
  case "aria-hidden":
847
846
  i.removeAttribute("aria-hidden");
848
847
  break;
@@ -853,113 +852,113 @@ var B = {
853
852
  });
854
853
  }
855
854
  }
856
- }), p.updateContainerElements(e), p;
855
+ }), b.updateContainerElements(e), b;
857
856
  };
858
- const vt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
857
+ const dt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
859
858
  __proto__: null,
860
- createFocusTrap: dt
861
- }, Symbol.toStringTag, { value: "Module" })), pt = /* @__PURE__ */ we(vt), bt = /* @__PURE__ */ we(Qe);
859
+ createFocusTrap: ft
860
+ }, Symbol.toStringTag, { value: "Module" })), vt = /* @__PURE__ */ we(dt), pt = /* @__PURE__ */ we(Je);
862
861
  var Te;
863
- function ht() {
862
+ function bt() {
864
863
  if (Te) return Q.exports;
865
864
  Te = 1;
866
- function r(d) {
865
+ function r(v) {
867
866
  "@babel/helpers - typeof";
868
- return r = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(s) {
869
- return typeof s;
870
- } : function(s) {
871
- return s && typeof Symbol == "function" && s.constructor === Symbol && s !== Symbol.prototype ? "symbol" : typeof s;
872
- }, r(d);
867
+ return r = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(f) {
868
+ return typeof f;
869
+ } : function(f) {
870
+ return f && typeof Symbol == "function" && f.constructor === Symbol && f !== Symbol.prototype ? "symbol" : typeof f;
871
+ }, r(v);
873
872
  }
874
873
  var e, t;
875
- function a(d, s) {
876
- if (!(d instanceof s)) throw new TypeError("Cannot call a class as a function");
874
+ function a(v, f) {
875
+ if (!(v instanceof f)) throw new TypeError("Cannot call a class as a function");
877
876
  }
878
- function u(d, s) {
879
- for (var m = 0; m < s.length; m++) {
880
- var c = s[m];
881
- c.enumerable = c.enumerable || !1, c.configurable = !0, "value" in c && (c.writable = !0), Object.defineProperty(d, N(c.key), c);
877
+ function u(v, f) {
878
+ for (var d = 0; d < f.length; d++) {
879
+ var s = f[d];
880
+ s.enumerable = s.enumerable || !1, s.configurable = !0, "value" in s && (s.writable = !0), Object.defineProperty(v, j(s.key), s);
882
881
  }
883
882
  }
884
- function l(d, s, m) {
885
- return s && u(d.prototype, s), Object.defineProperty(d, "prototype", { writable: !1 }), d;
883
+ function c(v, f, d) {
884
+ return f && u(v.prototype, f), Object.defineProperty(v, "prototype", { writable: !1 }), v;
886
885
  }
887
- function n(d, s, m) {
888
- return s = S(s), p(d, k() ? Reflect.construct(s, m || [], S(d).constructor) : s.apply(d, m));
886
+ function n(v, f, d) {
887
+ return f = S(f), b(v, k() ? Reflect.construct(f, d || [], S(v).constructor) : f.apply(v, d));
889
888
  }
890
- function p(d, s) {
891
- if (s && (r(s) == "object" || typeof s == "function")) return s;
892
- if (s !== void 0) throw new TypeError("Derived constructors may only return object or undefined");
893
- return y(d);
889
+ function b(v, f) {
890
+ if (f && (r(f) == "object" || typeof f == "function")) return f;
891
+ if (f !== void 0) throw new TypeError("Derived constructors may only return object or undefined");
892
+ return g(v);
894
893
  }
895
- function y(d) {
896
- if (d === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
897
- return d;
894
+ function g(v) {
895
+ if (v === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
896
+ return v;
898
897
  }
899
898
  function k() {
900
899
  try {
901
- var d = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
900
+ var v = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
902
901
  }));
903
902
  } catch {
904
903
  }
905
904
  return (k = function() {
906
- return !!d;
905
+ return !!v;
907
906
  })();
908
907
  }
909
- function S(d) {
910
- return S = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(s) {
911
- return s.__proto__ || Object.getPrototypeOf(s);
912
- }, S(d);
908
+ function S(v) {
909
+ return S = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(f) {
910
+ return f.__proto__ || Object.getPrototypeOf(f);
911
+ }, S(v);
913
912
  }
914
- function D(d, s) {
915
- if (typeof s != "function" && s !== null) throw new TypeError("Super expression must either be null or a function");
916
- d.prototype = Object.create(s && s.prototype, { constructor: { value: d, writable: !0, configurable: !0 } }), Object.defineProperty(d, "prototype", { writable: !1 }), s && R(d, s);
913
+ function D(v, f) {
914
+ if (typeof f != "function" && f !== null) throw new TypeError("Super expression must either be null or a function");
915
+ v.prototype = Object.create(f && f.prototype, { constructor: { value: v, writable: !0, configurable: !0 } }), Object.defineProperty(v, "prototype", { writable: !1 }), f && R(v, f);
917
916
  }
918
- function R(d, s) {
919
- return R = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(m, c) {
920
- return m.__proto__ = c, m;
921
- }, R(d, s);
917
+ function R(v, f) {
918
+ return R = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(d, s) {
919
+ return d.__proto__ = s, d;
920
+ }, R(v, f);
922
921
  }
923
- function j(d, s, m) {
924
- return (s = N(s)) in d ? Object.defineProperty(d, s, { value: m, enumerable: !0, configurable: !0, writable: !0 }) : d[s] = m, d;
922
+ function I(v, f, d) {
923
+ return (f = j(f)) in v ? Object.defineProperty(v, f, { value: d, enumerable: !0, configurable: !0, writable: !0 }) : v[f] = d, v;
925
924
  }
926
- function N(d) {
927
- var s = x(d, "string");
928
- return r(s) == "symbol" ? s : s + "";
925
+ function j(v) {
926
+ var f = x(v, "string");
927
+ return r(f) == "symbol" ? f : f + "";
929
928
  }
930
- function x(d, s) {
931
- if (r(d) != "object" || !d) return d;
932
- var m = d[Symbol.toPrimitive];
933
- if (m !== void 0) {
934
- var c = m.call(d, s);
935
- if (r(c) != "object") return c;
929
+ function x(v, f) {
930
+ if (r(v) != "object" || !v) return v;
931
+ var d = v[Symbol.toPrimitive];
932
+ if (d !== void 0) {
933
+ var s = d.call(v, f);
934
+ if (r(s) != "object") return s;
936
935
  throw new TypeError("@@toPrimitive must return a primitive value.");
937
936
  }
938
- return (s === "string" ? String : Number)(d);
937
+ return (f === "string" ? String : Number)(v);
939
938
  }
940
- var I = Ie, _ = pt, V = _.createFocusTrap, z = bt, $ = z.isFocusable, Y = parseInt((e = (t = /^(\d+)\./.exec(I.version)) === null || t === void 0 ? void 0 : t[1]) !== null && e !== void 0 ? e : 0, 10), M = /* @__PURE__ */ (function(d) {
941
- function s(m) {
942
- var c;
943
- a(this, s), c = n(this, s, [m]), j(c, "getNodeForOption", function(b) {
944
- var o, i = (o = this.internalOptions[b]) !== null && o !== void 0 ? o : this.originalOptions[b];
939
+ var P = je, L = vt, M = L.createFocusTrap, Y = pt, $ = Y.isFocusable, G = parseInt((e = (t = /^(\d+)\./.exec(P.version)) === null || t === void 0 ? void 0 : t[1]) !== null && e !== void 0 ? e : 0, 10), K = /* @__PURE__ */ (function(v) {
940
+ function f(d) {
941
+ var s;
942
+ a(this, f), s = n(this, f, [d]), I(s, "getNodeForOption", function(h) {
943
+ var o, i = (o = this.internalOptions[h]) !== null && o !== void 0 ? o : this.originalOptions[h];
945
944
  if (typeof i == "function") {
946
- for (var f = arguments.length, g = new Array(f > 1 ? f - 1 : 0), h = 1; h < f; h++)
947
- g[h - 1] = arguments[h];
948
- i = i.apply(void 0, g);
945
+ for (var l = arguments.length, m = new Array(l > 1 ? l - 1 : 0), y = 1; y < l; y++)
946
+ m[y - 1] = arguments[y];
947
+ i = i.apply(void 0, m);
949
948
  }
950
949
  if (i === !0 && (i = void 0), !i) {
951
950
  if (i === void 0 || i === !1)
952
951
  return i;
953
- throw new Error("`".concat(b, "` was specified but was not a node, or did not return a node"));
952
+ throw new Error("`".concat(h, "` was specified but was not a node, or did not return a node"));
954
953
  }
955
- var T = i;
954
+ var w = i;
956
955
  if (typeof i == "string") {
957
- var v;
958
- if (T = (v = this.getDocument()) === null || v === void 0 ? void 0 : v.querySelector(i), !T)
959
- throw new Error("`".concat(b, "` as selector refers to no known node"));
956
+ var p;
957
+ if (w = (p = this.getDocument()) === null || p === void 0 ? void 0 : p.querySelector(i), !w)
958
+ throw new Error("`".concat(h, "` as selector refers to no known node"));
960
959
  }
961
- return T;
962
- }), c.handleDeactivate = c.handleDeactivate.bind(c), c.handlePostDeactivate = c.handlePostDeactivate.bind(c), c.handleClickOutsideDeactivates = c.handleClickOutsideDeactivates.bind(c), c.internalOptions = {
960
+ return w;
961
+ }), s.handleDeactivate = s.handleDeactivate.bind(s), s.handlePostDeactivate = s.handlePostDeactivate.bind(s), s.handleClickOutsideDeactivates = s.handleClickOutsideDeactivates.bind(s), s.internalOptions = {
963
962
  // We need to hijack the returnFocusOnDeactivate option,
964
963
  // because React can move focus into the element before we arrived at
965
964
  // this lifecycle hook (e.g. with autoFocus inputs). So the component
@@ -969,14 +968,14 @@ function ht() {
969
968
  // the rest of these are also related to deactivation of the trap, and we
970
969
  // need to use them and control them as well
971
970
  checkCanReturnFocus: null,
972
- onDeactivate: c.handleDeactivate,
973
- onPostDeactivate: c.handlePostDeactivate,
971
+ onDeactivate: s.handleDeactivate,
972
+ onPostDeactivate: s.handlePostDeactivate,
974
973
  // we need to special-case this setting as well so that we can know if we should
975
974
  // NOT return focus if the trap gets auto-deactivated as the result of an
976
975
  // outside click (otherwise, we'll always think we should return focus because
977
976
  // of how we manage that flag internally here)
978
- clickOutsideDeactivates: c.handleClickOutsideDeactivates
979
- }, c.originalOptions = {
977
+ clickOutsideDeactivates: s.handleClickOutsideDeactivates
978
+ }, s.originalOptions = {
980
979
  // because of the above `internalOptions`, we maintain our own flag for
981
980
  // this option, and default it to `true` because that's focus-trap's default
982
981
  returnFocusOnDeactivate: !0,
@@ -989,18 +988,18 @@ function ht() {
989
988
  // the user's setting, defaulted to false since focus-trap defaults this to false
990
989
  clickOutsideDeactivates: !1
991
990
  };
992
- var w = m.focusTrapOptions;
993
- for (var O in w)
994
- if (Object.prototype.hasOwnProperty.call(w, O)) {
991
+ var T = d.focusTrapOptions;
992
+ for (var O in T)
993
+ if (Object.prototype.hasOwnProperty.call(T, O)) {
995
994
  if (O === "returnFocusOnDeactivate" || O === "onDeactivate" || O === "onPostDeactivate" || O === "checkCanReturnFocus" || O === "clickOutsideDeactivates") {
996
- c.originalOptions[O] = w[O];
995
+ s.originalOptions[O] = T[O];
997
996
  continue;
998
997
  }
999
- c.internalOptions[O] = w[O];
998
+ s.internalOptions[O] = T[O];
1000
999
  }
1001
- return c.outsideClick = null, c.focusTrapElements = m.containerElements || [], c.updatePreviousElement(), c;
1000
+ return s.outsideClick = null, s.focusTrapElements = d.containerElements || [], s.updatePreviousElement(), s;
1002
1001
  }
1003
- return D(s, d), l(s, [{
1002
+ return D(f, v), c(f, [{
1004
1003
  key: "getDocument",
1005
1004
  value: function() {
1006
1005
  return this.props.focusTrapOptions.document || (typeof document < "u" ? document : void 0);
@@ -1008,15 +1007,15 @@ function ht() {
1008
1007
  }, {
1009
1008
  key: "getReturnFocusNode",
1010
1009
  value: function() {
1011
- var c = this.getNodeForOption("setReturnFocus", this.previouslyFocusedElement);
1012
- return c || (c === !1 ? !1 : this.previouslyFocusedElement);
1010
+ var s = this.getNodeForOption("setReturnFocus", this.previouslyFocusedElement);
1011
+ return s || (s === !1 ? !1 : this.previouslyFocusedElement);
1013
1012
  }
1014
1013
  /** Update the previously focused element with the currently focused element. */
1015
1014
  }, {
1016
1015
  key: "updatePreviousElement",
1017
1016
  value: function() {
1018
- var c = this.getDocument();
1019
- c && (this.previouslyFocusedElement = c.activeElement);
1017
+ var s = this.getDocument();
1018
+ s && (this.previouslyFocusedElement = s.activeElement);
1020
1019
  }
1021
1020
  }, {
1022
1021
  key: "deactivateTrap",
@@ -1040,12 +1039,12 @@ function ht() {
1040
1039
  }
1041
1040
  }, {
1042
1041
  key: "handleClickOutsideDeactivates",
1043
- value: function(c) {
1044
- var w = typeof this.originalOptions.clickOutsideDeactivates == "function" ? this.originalOptions.clickOutsideDeactivates.call(null, c) : this.originalOptions.clickOutsideDeactivates;
1045
- return w && (this.outsideClick = {
1046
- target: c.target,
1047
- allowDeactivation: w
1048
- }), w;
1042
+ value: function(s) {
1043
+ var T = typeof this.originalOptions.clickOutsideDeactivates == "function" ? this.originalOptions.clickOutsideDeactivates.call(null, s) : this.originalOptions.clickOutsideDeactivates;
1044
+ return T && (this.outsideClick = {
1045
+ target: s.target,
1046
+ allowDeactivation: T
1047
+ }), T;
1049
1048
  }
1050
1049
  }, {
1051
1050
  key: "handleDeactivate",
@@ -1055,20 +1054,20 @@ function ht() {
1055
1054
  }, {
1056
1055
  key: "handlePostDeactivate",
1057
1056
  value: function() {
1058
- var c = this, w = function() {
1059
- var b = c.getReturnFocusNode(), o = !!// did the consumer allow it?
1060
- (c.originalOptions.returnFocusOnDeactivate && // can we actually focus the node?
1061
- b !== null && b !== void 0 && b.focus && // was there an outside click that allowed deactivation?
1062
- (!c.outsideClick || // did the consumer allow deactivation when the outside node was clicked?
1063
- c.outsideClick.allowDeactivation && // is the outside node NOT focusable (implying that it did NOT receive focus
1057
+ var s = this, T = function() {
1058
+ var h = s.getReturnFocusNode(), o = !!// did the consumer allow it?
1059
+ (s.originalOptions.returnFocusOnDeactivate && // can we actually focus the node?
1060
+ h !== null && h !== void 0 && h.focus && // was there an outside click that allowed deactivation?
1061
+ (!s.outsideClick || // did the consumer allow deactivation when the outside node was clicked?
1062
+ s.outsideClick.allowDeactivation && // is the outside node NOT focusable (implying that it did NOT receive focus
1064
1063
  // as a result of the click-through) -- in which case do NOT restore focus
1065
1064
  // to `returnFocusNode` because focus should remain on the outside node
1066
- !$(c.outsideClick.target, c.internalOptions.tabbableOptions))), i = c.internalOptions.preventScroll, f = i === void 0 ? !1 : i;
1067
- o && b.focus({
1068
- preventScroll: f
1069
- }), c.originalOptions.onPostDeactivate && c.originalOptions.onPostDeactivate.call(null), c.outsideClick = null;
1065
+ !$(s.outsideClick.target, s.internalOptions.tabbableOptions))), i = s.internalOptions.preventScroll, l = i === void 0 ? !1 : i;
1066
+ o && h.focus({
1067
+ preventScroll: l
1068
+ }), s.originalOptions.onPostDeactivate && s.originalOptions.onPostDeactivate.call(null), s.outsideClick = null;
1070
1069
  };
1071
- this.originalOptions.checkCanReturnFocus ? this.originalOptions.checkCanReturnFocus.call(null, this.getReturnFocusNode()).then(w, w) : w();
1070
+ this.originalOptions.checkCanReturnFocus ? this.originalOptions.checkCanReturnFocus.call(null, this.getReturnFocusNode()).then(T, T) : T();
1072
1071
  }
1073
1072
  }, {
1074
1073
  key: "setupFocusTrap",
@@ -1076,8 +1075,8 @@ function ht() {
1076
1075
  if (this.focusTrap)
1077
1076
  this.props.active && !this.focusTrap.active && (this.focusTrap.activate(), this.props.paused && this.focusTrap.pause());
1078
1077
  else {
1079
- var c = this.focusTrapElements.some(Boolean);
1080
- c && (this.focusTrap = this.props._createFocusTrap(this.focusTrapElements, this.internalOptions), this.props.active && this.focusTrap.activate(), this.props.paused && this.focusTrap.pause());
1078
+ var s = this.focusTrapElements.some(Boolean);
1079
+ s && (this.focusTrap = this.props._createFocusTrap(this.focusTrapElements, this.internalOptions), this.props.active && this.focusTrap.activate(), this.props.paused && this.focusTrap.pause());
1081
1080
  }
1082
1081
  }
1083
1082
  }, {
@@ -1087,17 +1086,17 @@ function ht() {
1087
1086
  }
1088
1087
  }, {
1089
1088
  key: "componentDidUpdate",
1090
- value: function(c) {
1089
+ value: function(s) {
1091
1090
  if (this.focusTrap) {
1092
- c.containerElements !== this.props.containerElements && this.focusTrap.updateContainerElements(this.props.containerElements);
1093
- var w = !c.active && this.props.active, O = c.active && !this.props.active, b = !c.paused && this.props.paused, o = c.paused && !this.props.paused;
1094
- if (w && (this.updatePreviousElement(), this.focusTrap.activate()), O) {
1091
+ s.containerElements !== this.props.containerElements && this.focusTrap.updateContainerElements(this.props.containerElements);
1092
+ var T = !s.active && this.props.active, O = s.active && !this.props.active, h = !s.paused && this.props.paused, o = s.paused && !this.props.paused;
1093
+ if (T && (this.updatePreviousElement(), this.focusTrap.activate()), O) {
1095
1094
  this.deactivateTrap();
1096
1095
  return;
1097
1096
  }
1098
- b && this.focusTrap.pause(), o && this.focusTrap.unpause();
1097
+ h && this.focusTrap.pause(), o && this.focusTrap.unpause();
1099
1098
  } else
1100
- c.containerElements !== this.props.containerElements && (this.focusTrapElements = this.props.containerElements), this.props.active && (this.updatePreviousElement(), this.setupFocusTrap());
1099
+ s.containerElements !== this.props.containerElements && (this.focusTrapElements = this.props.containerElements), this.props.active && (this.updatePreviousElement(), this.setupFocusTrap());
1101
1100
  }
1102
1101
  }, {
1103
1102
  key: "componentWillUnmount",
@@ -1107,140 +1106,147 @@ function ht() {
1107
1106
  }, {
1108
1107
  key: "render",
1109
1108
  value: function() {
1110
- var c = this, w = this.props.children ? I.Children.only(this.props.children) : void 0;
1111
- if (w) {
1112
- if (w.type && w.type === I.Fragment)
1109
+ var s = this, T = this.props.children ? P.Children.only(this.props.children) : void 0;
1110
+ if (T) {
1111
+ if (T.type && T.type === P.Fragment)
1113
1112
  throw new Error("A focus-trap cannot use a Fragment as its child container. Try replacing it with a <div> element.");
1114
1113
  var O = function(i) {
1115
- var f = c.props.containerElements;
1116
- w && (Y >= 19 ? typeof w.props.ref == "function" ? w.props.ref(i) : w.props.ref && (w.props.ref.current = i) : typeof w.ref == "function" ? w.ref(i) : w.ref && (w.ref.current = i)), c.focusTrapElements = f || [i];
1117
- }, b = I.cloneElement(w, {
1114
+ var l = s.props.containerElements;
1115
+ T && (G >= 19 ? typeof T.props.ref == "function" ? T.props.ref(i) : T.props.ref && (T.props.ref.current = i) : typeof T.ref == "function" ? T.ref(i) : T.ref && (T.ref.current = i)), s.focusTrapElements = l || [i];
1116
+ }, h = P.cloneElement(T, {
1118
1117
  ref: O
1119
1118
  });
1120
- return b;
1119
+ return h;
1121
1120
  }
1122
1121
  return null;
1123
1122
  }
1124
1123
  }]);
1125
- })(I.Component);
1126
- return M.defaultProps = {
1124
+ })(P.Component);
1125
+ return K.defaultProps = {
1127
1126
  active: !0,
1128
1127
  paused: !1,
1129
1128
  focusTrapOptions: {},
1130
- _createFocusTrap: V
1131
- }, Q.exports = M, Q.exports.FocusTrap = M, Q.exports;
1129
+ _createFocusTrap: M
1130
+ }, Q.exports = K, Q.exports.FocusTrap = K, Q.exports;
1132
1131
  }
1133
- var yt = ht();
1134
- const Ce = Ae({
1132
+ var ht = bt();
1133
+ const Ce = Ie({
1135
1134
  isVisible: !1
1136
1135
  }), {
1137
- Provider: mt
1136
+ Provider: yt
1138
1137
  } = Ce;
1139
- function gt() {
1140
- return je(Ce);
1138
+ function mt() {
1139
+ return Ae(Ce);
1141
1140
  }
1142
- function Tt() {
1141
+ function gt() {
1143
1142
  const {
1144
1143
  close: r
1145
- } = gt(), e = J(() => {
1144
+ } = mt(), e = J(() => {
1146
1145
  r == null || r();
1147
1146
  }, [r]);
1148
- return /* @__PURE__ */ C.jsxs(C.Fragment, { children: [
1149
- /* @__PURE__ */ C.jsx("div", { className: "kakadu-components-2543813221" }),
1150
- /* @__PURE__ */ C.jsx("div", { className: "kakadu-components-840864829", children: /* @__PURE__ */ C.jsx(Be, { iconLeft: _e.times, label: "Close", className: "kakadu-components-3855719072", onClick: e }) })
1147
+ return /* @__PURE__ */ N.jsxs(N.Fragment, { children: [
1148
+ /* @__PURE__ */ N.jsx("div", { className: "kakadu-components-2543813221" }),
1149
+ /* @__PURE__ */ N.jsx("div", { className: "kakadu-components-840864829", children: /* @__PURE__ */ N.jsx(Le, { iconLeft: _e.times, label: "Close", className: "kakadu-components-3855719072", onClick: e }) })
1151
1150
  ] });
1152
1151
  }
1153
- function Nt({
1152
+ function Tt({
1153
+ decorators: r,
1154
+ children: e
1155
+ }) {
1156
+ return r.length === 0 ? e : r.reduceRight((t, a) => /* @__PURE__ */ N.jsx(a, { children: t }), e);
1157
+ }
1158
+ function Dt({
1154
1159
  root: r,
1155
- maxWidth: e,
1156
- className: t,
1157
- isVisible: a,
1158
- isFullWidth: u = !1,
1159
- shouldCloseOnOutsideClick: l = !0,
1160
- shouldCloseOnEscapePress: n = !0,
1161
- showCloseButton: p = !0,
1162
- onClose: y,
1163
- children: k
1160
+ decorators: e = [],
1161
+ maxWidth: t,
1162
+ className: a,
1163
+ isVisible: u,
1164
+ isFullWidth: c = !1,
1165
+ shouldCloseOnOutsideClick: n = !0,
1166
+ shouldCloseOnEscapePress: b = !0,
1167
+ showCloseButton: g = !0,
1168
+ onClose: k,
1169
+ children: S
1164
1170
  }) {
1165
- const S = te(null), D = te(null), [R, j] = re(!1), [N, x] = re(!1), I = J((s) => {
1166
- S.current = s, x(!1);
1167
- }, []), _ = te(null), V = J((s) => {
1168
- s && (_.current = s);
1169
- }, []), [z, $] = re(a ?? !1), Y = ne(() => ({
1170
- isVisible: z,
1171
- setInitialFocus: V,
1172
- close: I
1173
- }), [z, V, I]);
1171
+ const D = te(null), R = te(null), [I, j] = re(!1), [x, P] = re(!1), L = J((d) => {
1172
+ D.current = d, P(!1);
1173
+ }, []), M = te(null), Y = J((d) => {
1174
+ d && (M.current = d);
1175
+ }, []), [$, G] = re(u ?? !1), K = ne(() => ({
1176
+ isVisible: $,
1177
+ setInitialFocus: Y,
1178
+ close: L
1179
+ }), [$, Y, L]);
1174
1180
  H(() => {
1175
- a && (j(!0), $(!0));
1176
- }, [a]), H(() => {
1177
- if (a) {
1178
- const s = setTimeout(() => {
1179
- x(!0);
1181
+ u && (j(!0), G(!0));
1182
+ }, [u]), H(() => {
1183
+ if (u) {
1184
+ const d = setTimeout(() => {
1185
+ P(!0);
1180
1186
  }, 100);
1181
1187
  return () => {
1182
- clearTimeout(s);
1188
+ clearTimeout(d);
1183
1189
  };
1184
1190
  }
1185
- x(!1);
1186
- }, [a]), H(() => {
1187
- if (R && !N) {
1188
- const s = setTimeout(() => {
1189
- y == null || y(S.current ?? void 0), $(!1);
1191
+ P(!1);
1192
+ }, [u]), H(() => {
1193
+ if (I && !x) {
1194
+ const d = setTimeout(() => {
1195
+ k == null || k(D.current ?? void 0), G(!1);
1190
1196
  }, 370);
1191
1197
  return () => {
1192
- clearTimeout(s);
1198
+ clearTimeout(d);
1193
1199
  };
1194
1200
  }
1195
- }, [R, N, y]), H(() => {
1196
- const s = D.current;
1197
- if (a && l && s) {
1198
- const m = (c) => {
1199
- s === c.target && x(!1);
1201
+ }, [I, x, k]), H(() => {
1202
+ const d = R.current;
1203
+ if (u && n && d) {
1204
+ const s = (T) => {
1205
+ d === T.target && P(!1);
1200
1206
  };
1201
- return s.addEventListener("click", m), () => {
1202
- s.removeEventListener("click", m);
1207
+ return d.addEventListener("click", s), () => {
1208
+ d.removeEventListener("click", s);
1203
1209
  };
1204
1210
  }
1205
- }, [a, l]), H(() => {
1206
- if (!a || !n)
1211
+ }, [u, n]), H(() => {
1212
+ if (!u || !b)
1207
1213
  return;
1208
- const s = (m) => {
1209
- m.key === "Escape" && x(!1);
1214
+ const d = (s) => {
1215
+ s.key === "Escape" && P(!1);
1210
1216
  };
1211
- return window.addEventListener("keydown", s), () => {
1212
- window.removeEventListener("keydown", s);
1217
+ return window.addEventListener("keydown", d), () => {
1218
+ window.removeEventListener("keydown", d);
1213
1219
  };
1214
- }, [a, n]);
1215
- const M = ne(() => ({
1216
- initialFocus: () => _.current ?? void 0,
1220
+ }, [u, b]);
1221
+ const v = ne(() => ({
1222
+ initialFocus: () => M.current ?? void 0,
1217
1223
  onActivate: () => {
1218
- var s;
1219
- return (s = _.current) == null ? void 0 : s.focus();
1224
+ var d;
1225
+ return (d = M.current) == null ? void 0 : d.focus();
1220
1226
  }
1221
- }), []), d = /* @__PURE__ */ C.jsx("div", { style: {
1222
- "--max-width": e ? `${e}px` : void 0
1223
- }, className: pe(r ? Le : void 0, "kakadu-components-2807459246", N && "kakadu-components-1399012551", t), children: /* @__PURE__ */ C.jsx(yt.FocusTrap, { active: N, focusTrapOptions: M, children: /* @__PURE__ */ C.jsx("div", { ref: D, className: "kakadu-components-3521538255", children: /* @__PURE__ */ C.jsx("div", { className: pe("kakadu-components-1982320206", u && "kakadu-components-3904045733", N && "kakadu-components-3829535111"), children: /* @__PURE__ */ C.jsxs(mt, { value: Y, children: [
1224
- p ? /* @__PURE__ */ C.jsx(Tt, {}) : null,
1225
- /* @__PURE__ */ C.jsx("div", { className: "kakadu-components-2617708556", children: k })
1226
- ] }) }) }) }) });
1227
- return r ? xe(d, r) : d;
1227
+ }), []), f = /* @__PURE__ */ N.jsx(Tt, { decorators: e, children: /* @__PURE__ */ N.jsx("div", { style: {
1228
+ "--max-width": t ? `${t}px` : void 0
1229
+ }, className: pe("kakadu-components-4119461136", x && "kakadu-components-2522346797", a), children: /* @__PURE__ */ N.jsx(ht.FocusTrap, { active: x, focusTrapOptions: v, children: /* @__PURE__ */ N.jsx("div", { ref: R, className: "kakadu-components-3001745367", children: /* @__PURE__ */ N.jsx("div", { className: pe("kakadu-components-3903793117", c && "kakadu-components-2700481558", x && "kakadu-components-2379306144"), children: /* @__PURE__ */ N.jsxs(yt, { value: K, children: [
1230
+ g ? /* @__PURE__ */ N.jsx(gt, {}) : null,
1231
+ /* @__PURE__ */ N.jsx("div", { className: "kakadu-components-4238836556", children: S })
1232
+ ] }) }) }) }) }) });
1233
+ return r ? xe(f, r) : f;
1228
1234
  }
1229
- function Rt(r, e) {
1230
- const [t, a] = re(!1), u = te(void 0), l = J(async () => (a(!0), new Promise((y) => {
1231
- u.current = y;
1232
- })), []), n = J((y) => {
1235
+ function Nt(r, e) {
1236
+ const [t, a] = re(!1), u = te(void 0), c = J(async () => (a(!0), new Promise((g) => {
1237
+ u.current = g;
1238
+ })), []), n = J((g) => {
1233
1239
  var k;
1234
- a(!1), (k = u.current) == null || k.call(u, y), u.current = void 0;
1235
- }, []), p = ne(() => /* @__PURE__ */ C.jsx(r, { ...e, isVisible: t, onClose: n }), [r, e, t, n]);
1240
+ a(!1), (k = u.current) == null || k.call(u, g), u.current = void 0;
1241
+ }, []), b = ne(() => /* @__PURE__ */ N.jsx(r, { ...e, isVisible: t, onClose: n }), [r, e, t, n]);
1236
1242
  return ne(() => ({
1237
1243
  isVisible: t,
1238
- show: l,
1239
- modal: p
1240
- }), [t, l, p]);
1244
+ show: c,
1245
+ modal: b
1246
+ }), [t, c, b]);
1241
1247
  }
1242
1248
  export {
1243
- Nt as default,
1244
- Rt as useModal,
1245
- gt as useModalContext
1249
+ Dt as default,
1250
+ Nt as useModal,
1251
+ mt as useModalContext
1246
1252
  };