@sps-woodland/focused-task 8.50.2 → 8.51.1

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.
package/lib/index.js CHANGED
@@ -1,1888 +1,19 @@
1
- import { Metadata as Je, cl as se, combineEventHandlers as Me, useChildTestIdAttrBuilder as gt, selectChildren as yt, contentOf as Re } from "@sps-woodland/core";
2
- import { Button as Tt } from "@sps-woodland/buttons";
3
- import * as v from "react";
4
- import y, { useState as re, useRef as T, useCallback as _, useContext as z, useEffect as D, useReducer as Nt, useMemo as Z, createContext as kt } from "react";
5
- import St from "react-dom";
6
- import { code as De } from "@spscommerce/utils";
7
- const x = typeof document < "u" ? y.useLayoutEffect : () => {
8
- };
9
- function xt(e) {
10
- let [t, n] = re(e), r = T(t), o = T(null), i = T(() => {
11
- if (!o.current) return;
12
- let l = o.current.next();
13
- if (l.done) {
14
- o.current = null;
15
- return;
16
- }
17
- r.current === l.value ? i.current() : n(l.value);
18
- });
19
- x(() => {
20
- r.current = t, o.current && i.current();
21
- });
22
- let a = _((l) => {
23
- o.current = l(r.current), i.current();
24
- }, [
25
- i
26
- ]);
27
- return [
28
- t,
29
- a
30
- ];
31
- }
32
- const ue = {
33
- prefix: String(Math.round(Math.random() * 1e10)),
34
- current: 0
35
- }, Xe = /* @__PURE__ */ y.createContext(ue), Lt = /* @__PURE__ */ y.createContext(!1);
36
- let Ct = !!(typeof window < "u" && window.document && window.document.createElement), ve = /* @__PURE__ */ new WeakMap();
37
- function _t(e = !1) {
38
- let t = z(Xe), n = T(null);
39
- if (n.current === null && !e) {
40
- var r, o;
41
- let i = (o = y.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || o === void 0 || (r = o.ReactCurrentOwner) === null || r === void 0 ? void 0 : r.current;
42
- if (i) {
43
- let a = ve.get(i);
44
- a == null ? ve.set(i, {
45
- id: t.current,
46
- state: i.memoizedState
47
- }) : i.memoizedState !== a.state && (t.current = a.id, ve.delete(i));
48
- }
49
- n.current = ++t.current;
50
- }
51
- return n.current;
52
- }
53
- function Ft(e) {
54
- let t = z(Xe);
55
- t === ue && !Ct && process.env.NODE_ENV !== "production" && console.warn("When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server.");
56
- let n = _t(!!e), r = t === ue && process.env.NODE_ENV === "test" ? "react-aria" : `react-aria${t.prefix}`;
57
- return e || `${r}-${n}`;
58
- }
59
- function Pt(e) {
60
- let t = y.useId(), [n] = re(Qe()), r = n || process.env.NODE_ENV === "test" ? "react-aria" : `react-aria${ue.prefix}`;
61
- return e || `${r}-${t}`;
62
- }
63
- const Ot = typeof y.useId == "function" ? Pt : Ft;
64
- function Mt() {
65
- return !1;
66
- }
67
- function Rt() {
68
- return !0;
69
- }
70
- function Dt(e) {
71
- return () => {
72
- };
73
- }
74
- function Qe() {
75
- return typeof y.useSyncExternalStore == "function" ? y.useSyncExternalStore(Dt, Mt, Rt) : z(Lt);
76
- }
77
- let At = !!(typeof window < "u" && window.document && window.document.createElement), q = /* @__PURE__ */ new Map(), X;
78
- typeof FinalizationRegistry < "u" && (X = new FinalizationRegistry((e) => {
79
- q.delete(e);
80
- }));
81
- function Ze(e) {
82
- let [t, n] = re(e), r = T(null), o = Ot(t), i = T(null);
83
- if (X && X.register(i, o), At) {
84
- const a = q.get(o);
85
- a && !a.includes(r) ? a.push(r) : q.set(o, [
86
- r
87
- ]);
88
- }
89
- return x(() => {
90
- let a = o;
91
- return () => {
92
- X && X.unregister(i), q.delete(a);
93
- };
94
- }, [
95
- o
96
- ]), D(() => {
97
- let a = r.current;
98
- return a && n(a), () => {
99
- a && (r.current = null);
100
- };
101
- }), o;
102
- }
103
- function It(e, t) {
104
- if (e === t) return e;
105
- let n = q.get(e);
106
- if (n)
107
- return n.forEach((o) => o.current = t), t;
108
- let r = q.get(t);
109
- return r ? (r.forEach((o) => o.current = e), e) : t;
110
- }
111
- function Wt(e = []) {
112
- let t = Ze(), [n, r] = xt(t), o = _(() => {
113
- r(function* () {
114
- yield t, yield document.getElementById(t) ? t : void 0;
115
- });
116
- }, [
117
- t,
118
- r
119
- ]);
120
- return x(o, [
121
- t,
122
- o,
123
- ...e
124
- ]), n;
125
- }
126
- function Le(...e) {
127
- return (...t) => {
128
- for (let n of e) typeof n == "function" && n(...t);
129
- };
130
- }
131
- const S = (e) => {
132
- var t;
133
- return (t = e?.ownerDocument) !== null && t !== void 0 ? t : document;
134
- }, U = (e) => e && "window" in e && e.window === e ? e : S(e).defaultView || window;
135
- function Vt(e) {
136
- return e !== null && typeof e == "object" && "nodeType" in e && typeof e.nodeType == "number";
137
- }
138
- function Ht(e) {
139
- return Vt(e) && e.nodeType === Node.DOCUMENT_FRAGMENT_NODE && "host" in e;
140
- }
141
- let Kt = !1;
142
- function I() {
143
- return Kt;
144
- }
145
- function O(e, t) {
146
- if (!I()) return t && e ? e.contains(t) : !1;
147
- if (!e || !t) return !1;
148
- let n = t;
149
- for (; n !== null; ) {
150
- if (n === e) return !0;
151
- n.tagName === "SLOT" && n.assignedSlot ? n = n.assignedSlot.parentNode : Ht(n) ? n = n.host : n = n.parentNode;
152
- }
153
- return !1;
154
- }
155
- const L = (e = document) => {
156
- var t;
157
- if (!I()) return e.activeElement;
158
- let n = e.activeElement;
159
- for (; n && "shadowRoot" in n && (!((t = n.shadowRoot) === null || t === void 0) && t.activeElement); ) n = n.shadowRoot.activeElement;
160
- return n;
161
- };
162
- function N(e) {
163
- if (I() && e.target instanceof Element && e.target.shadowRoot) {
164
- var t, n;
165
- if ("composedPath" in e) return (t = e.composedPath()[0]) !== null && t !== void 0 ? t : null;
166
- if ("composedPath" in e.nativeEvent) return (n = e.nativeEvent.composedPath()[0]) !== null && n !== void 0 ? n : null;
167
- }
168
- return e.target;
169
- }
170
- class Bt {
171
- get currentNode() {
172
- return this._currentNode;
173
- }
174
- set currentNode(t) {
175
- if (!O(this.root, t)) throw new Error("Cannot set currentNode to a node that is not contained by the root node.");
176
- const n = [];
177
- let r = t, o = t;
178
- for (this._currentNode = t; r && r !== this.root; ) if (r.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
179
- const a = r, l = this._doc.createTreeWalker(a, this.whatToShow, {
180
- acceptNode: this._acceptNode
181
- });
182
- n.push(l), l.currentNode = o, this._currentSetFor.add(l), r = o = a.host;
183
- } else r = r.parentNode;
184
- const i = this._doc.createTreeWalker(this.root, this.whatToShow, {
185
- acceptNode: this._acceptNode
186
- });
187
- n.push(i), i.currentNode = o, this._currentSetFor.add(i), this._walkerStack = n;
188
- }
189
- get doc() {
190
- return this._doc;
191
- }
192
- firstChild() {
193
- let t = this.currentNode, n = this.nextNode();
194
- return O(t, n) ? (n && (this.currentNode = n), n) : (this.currentNode = t, null);
195
- }
196
- lastChild() {
197
- let n = this._walkerStack[0].lastChild();
198
- return n && (this.currentNode = n), n;
199
- }
200
- nextNode() {
201
- const t = this._walkerStack[0].nextNode();
202
- if (t) {
203
- if (t.shadowRoot) {
204
- var n;
205
- let o;
206
- if (typeof this.filter == "function" ? o = this.filter(t) : !((n = this.filter) === null || n === void 0) && n.acceptNode && (o = this.filter.acceptNode(t)), o === NodeFilter.FILTER_ACCEPT)
207
- return this.currentNode = t, t;
208
- let i = this.nextNode();
209
- return i && (this.currentNode = i), i;
210
- }
211
- return t && (this.currentNode = t), t;
212
- } else if (this._walkerStack.length > 1) {
213
- this._walkerStack.shift();
214
- let r = this.nextNode();
215
- return r && (this.currentNode = r), r;
216
- } else return null;
217
- }
218
- previousNode() {
219
- const t = this._walkerStack[0];
220
- if (t.currentNode === t.root) {
221
- if (this._currentSetFor.has(t))
222
- if (this._currentSetFor.delete(t), this._walkerStack.length > 1) {
223
- this._walkerStack.shift();
224
- let o = this.previousNode();
225
- return o && (this.currentNode = o), o;
226
- } else return null;
227
- return null;
228
- }
229
- const n = t.previousNode();
230
- if (n) {
231
- if (n.shadowRoot) {
232
- var r;
233
- let i;
234
- if (typeof this.filter == "function" ? i = this.filter(n) : !((r = this.filter) === null || r === void 0) && r.acceptNode && (i = this.filter.acceptNode(n)), i === NodeFilter.FILTER_ACCEPT)
235
- return n && (this.currentNode = n), n;
236
- let a = this.lastChild();
237
- return a && (this.currentNode = a), a;
238
- }
239
- return n && (this.currentNode = n), n;
240
- } else if (this._walkerStack.length > 1) {
241
- this._walkerStack.shift();
242
- let o = this.previousNode();
243
- return o && (this.currentNode = o), o;
244
- } else return null;
245
- }
246
- /**
247
- * @deprecated
248
- */
249
- nextSibling() {
250
- return null;
251
- }
252
- /**
253
- * @deprecated
254
- */
255
- previousSibling() {
256
- return null;
257
- }
258
- /**
259
- * @deprecated
260
- */
261
- parentNode() {
262
- return null;
263
- }
264
- constructor(t, n, r, o) {
265
- this._walkerStack = [], this._currentSetFor = /* @__PURE__ */ new Set(), this._acceptNode = (a) => {
266
- if (a.nodeType === Node.ELEMENT_NODE) {
267
- const c = a.shadowRoot;
268
- if (c) {
269
- const u = this._doc.createTreeWalker(c, this.whatToShow, {
270
- acceptNode: this._acceptNode
271
- });
272
- return this._walkerStack.unshift(u), NodeFilter.FILTER_ACCEPT;
273
- } else {
274
- var l;
275
- if (typeof this.filter == "function") return this.filter(a);
276
- if (!((l = this.filter) === null || l === void 0) && l.acceptNode) return this.filter.acceptNode(a);
277
- if (this.filter === null) return NodeFilter.FILTER_ACCEPT;
278
- }
279
- }
280
- return NodeFilter.FILTER_SKIP;
281
- }, this._doc = t, this.root = n, this.filter = o ?? null, this.whatToShow = r ?? NodeFilter.SHOW_ALL, this._currentNode = n, this._walkerStack.unshift(t.createTreeWalker(n, r, this._acceptNode));
282
- const i = n.shadowRoot;
283
- if (i) {
284
- const a = this._doc.createTreeWalker(i, this.whatToShow, {
285
- acceptNode: this._acceptNode
286
- });
287
- this._walkerStack.unshift(a);
288
- }
289
- }
290
- }
291
- function Ye(e, t, n, r) {
292
- return I() ? new Bt(e, t, n, r) : e.createTreeWalker(t, n, r);
293
- }
294
- function jt(...e) {
295
- return e.length === 1 && e[0] ? e[0] : (t) => {
296
- let n = !1;
297
- const r = e.map((o) => {
298
- const i = Ae(o, t);
299
- return n || (n = typeof i == "function"), i;
300
- });
301
- if (n) return () => {
302
- r.forEach((o, i) => {
303
- typeof o == "function" ? o() : Ae(e[i], null);
304
- });
305
- };
306
- };
307
- }
308
- function Ae(e, t) {
309
- if (typeof e == "function") return e(t);
310
- e != null && (e.current = t);
311
- }
312
- function et(e) {
313
- var t, n, r = "";
314
- if (typeof e == "string" || typeof e == "number") r += e;
315
- else if (typeof e == "object") if (Array.isArray(e)) {
316
- var o = e.length;
317
- for (t = 0; t < o; t++) e[t] && (n = et(e[t])) && (r && (r += " "), r += n);
318
- } else for (n in e) e[n] && (r && (r += " "), r += n);
319
- return r;
320
- }
321
- function Gt() {
322
- for (var e, t, n = 0, r = "", o = arguments.length; n < o; n++) (e = arguments[n]) && (t = et(e)) && (r && (r += " "), r += t);
323
- return r;
324
- }
325
- function qt(...e) {
326
- let t = {
327
- ...e[0]
328
- };
329
- for (let n = 1; n < e.length; n++) {
330
- let r = e[n];
331
- for (let o in r) {
332
- let i = t[o], a = r[o];
333
- typeof i == "function" && typeof a == "function" && // This is a lot faster than a regex.
334
- o[0] === "o" && o[1] === "n" && o.charCodeAt(2) >= /* 'A' */
335
- 65 && o.charCodeAt(2) <= /* 'Z' */
336
- 90 ? t[o] = Le(i, a) : (o === "className" || o === "UNSAFE_className") && typeof i == "string" && typeof a == "string" ? t[o] = Gt(i, a) : o === "id" && i && a ? t.id = It(i, a) : o === "ref" && i && a ? t.ref = jt(i, a) : t[o] = a !== void 0 ? a : i;
337
- }
338
- }
339
- return t;
340
- }
341
- const Ut = /* @__PURE__ */ new Set([
342
- "id"
343
- ]), zt = /* @__PURE__ */ new Set([
344
- "aria-label",
345
- "aria-labelledby",
346
- "aria-describedby",
347
- "aria-details"
348
- ]), Jt = /* @__PURE__ */ new Set([
349
- "href",
350
- "hrefLang",
351
- "target",
352
- "rel",
353
- "download",
354
- "ping",
355
- "referrerPolicy"
356
- ]), Xt = /* @__PURE__ */ new Set([
357
- "dir",
358
- "lang",
359
- "hidden",
360
- "inert",
361
- "translate"
362
- ]), Ie = /* @__PURE__ */ new Set([
363
- "onClick",
364
- "onAuxClick",
365
- "onContextMenu",
366
- "onDoubleClick",
367
- "onMouseDown",
368
- "onMouseEnter",
369
- "onMouseLeave",
370
- "onMouseMove",
371
- "onMouseOut",
372
- "onMouseOver",
373
- "onMouseUp",
374
- "onTouchCancel",
375
- "onTouchEnd",
376
- "onTouchMove",
377
- "onTouchStart",
378
- "onPointerDown",
379
- "onPointerMove",
380
- "onPointerUp",
381
- "onPointerCancel",
382
- "onPointerEnter",
383
- "onPointerLeave",
384
- "onPointerOver",
385
- "onPointerOut",
386
- "onGotPointerCapture",
387
- "onLostPointerCapture",
388
- "onScroll",
389
- "onWheel",
390
- "onAnimationStart",
391
- "onAnimationEnd",
392
- "onAnimationIteration",
393
- "onTransitionCancel",
394
- "onTransitionEnd",
395
- "onTransitionRun",
396
- "onTransitionStart"
397
- ]), Qt = /^(data-.*)$/;
398
- function Zt(e, t = {}) {
399
- let { labelable: n, isLink: r, global: o, events: i = o, propNames: a } = t, l = {};
400
- for (const c in e) Object.prototype.hasOwnProperty.call(e, c) && (Ut.has(c) || n && zt.has(c) || r && Jt.has(c) || o && Xt.has(c) || i && (Ie.has(c) || c.endsWith("Capture") && Ie.has(c.slice(0, -7))) || a?.has(c) || Qt.test(c)) && (l[c] = e[c]);
401
- return l;
402
- }
403
- function we(e) {
404
- if (Yt()) e.focus({
405
- preventScroll: !0
406
- });
407
- else {
408
- let t = en(e);
409
- e.focus(), tn(t);
410
- }
411
- }
412
- let ie = null;
413
- function Yt() {
414
- if (ie == null) {
415
- ie = !1;
416
- try {
417
- document.createElement("div").focus({
418
- get preventScroll() {
419
- return ie = !0, !0;
420
- }
421
- });
422
- } catch {
423
- }
424
- }
425
- return ie;
426
- }
427
- function en(e) {
428
- let t = e.parentNode, n = [], r = document.scrollingElement || document.documentElement;
429
- for (; t instanceof HTMLElement && t !== r; )
430
- (t.offsetHeight < t.scrollHeight || t.offsetWidth < t.scrollWidth) && n.push({
431
- element: t,
432
- scrollTop: t.scrollTop,
433
- scrollLeft: t.scrollLeft
434
- }), t = t.parentNode;
435
- return r instanceof HTMLElement && n.push({
436
- element: r,
437
- scrollTop: r.scrollTop,
438
- scrollLeft: r.scrollLeft
439
- }), n;
440
- }
441
- function tn(e) {
442
- for (let { element: t, scrollTop: n, scrollLeft: r } of e)
443
- t.scrollTop = n, t.scrollLeft = r;
444
- }
445
- function pe(e) {
446
- var t;
447
- if (typeof window > "u" || window.navigator == null) return !1;
448
- let n = (t = window.navigator.userAgentData) === null || t === void 0 ? void 0 : t.brands;
449
- return Array.isArray(n) && n.some((r) => e.test(r.brand)) || e.test(window.navigator.userAgent);
450
- }
451
- function Ce(e) {
452
- var t;
453
- return typeof window < "u" && window.navigator != null ? e.test(((t = window.navigator.userAgentData) === null || t === void 0 ? void 0 : t.platform) || window.navigator.platform) : !1;
454
- }
455
- function V(e) {
456
- if (process.env.NODE_ENV === "test") return e;
457
- let t = null;
458
- return () => (t == null && (t = e()), t);
459
- }
460
- const te = V(function() {
461
- return Ce(/^Mac/i);
462
- }), nn = V(function() {
463
- return Ce(/^iPhone/i);
464
- }), tt = V(function() {
465
- return Ce(/^iPad/i) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
466
- te() && navigator.maxTouchPoints > 1;
467
- }), nt = V(function() {
468
- return nn() || tt();
469
- });
470
- V(function() {
471
- return te() || nt();
472
- });
473
- const rn = V(function() {
474
- return pe(/AppleWebKit/i) && !rt();
475
- }), rt = V(function() {
476
- return pe(/Chrome/i);
477
- }), ot = V(function() {
478
- return pe(/Android/i);
479
- }), on = V(function() {
480
- return pe(/Firefox/i);
481
- });
482
- function ne(e, t, n = !0) {
483
- var r, o;
484
- let { metaKey: i, ctrlKey: a, altKey: l, shiftKey: c } = t;
485
- on() && (!((o = window.event) === null || o === void 0 || (r = o.type) === null || r === void 0) && r.startsWith("key")) && e.target === "_blank" && (te() ? i = !0 : a = !0);
486
- let u = rn() && te() && !tt() && process.env.NODE_ENV !== "test" ? new KeyboardEvent("keydown", {
487
- keyIdentifier: "Enter",
488
- metaKey: i,
489
- ctrlKey: a,
490
- altKey: l,
491
- shiftKey: c
492
- }) : new MouseEvent("click", {
493
- metaKey: i,
494
- ctrlKey: a,
495
- altKey: l,
496
- shiftKey: c,
497
- detail: 1,
498
- bubbles: !0,
499
- cancelable: !0
500
- });
501
- ne.isOpening = n, we(e), e.dispatchEvent(u), ne.isOpening = !1;
502
- }
503
- ne.isOpening = !1;
504
- let H = /* @__PURE__ */ new Map(), ge = /* @__PURE__ */ new Set();
505
- function We() {
506
- if (typeof window > "u") return;
507
- function e(r) {
508
- return "propertyName" in r;
509
- }
510
- let t = (r) => {
511
- let o = N(r);
512
- if (!e(r) || !o) return;
513
- let i = H.get(o);
514
- i || (i = /* @__PURE__ */ new Set(), H.set(o, i), o.addEventListener("transitioncancel", n, {
515
- once: !0
516
- })), i.add(r.propertyName);
517
- }, n = (r) => {
518
- let o = N(r);
519
- if (!e(r) || !o) return;
520
- let i = H.get(o);
521
- if (i && (i.delete(r.propertyName), i.size === 0 && (o.removeEventListener("transitioncancel", n), H.delete(o)), H.size === 0)) {
522
- for (let a of ge) a();
523
- ge.clear();
524
- }
525
- };
526
- document.body.addEventListener("transitionrun", t), document.body.addEventListener("transitionend", n);
527
- }
528
- typeof document < "u" && (document.readyState !== "loading" ? We() : document.addEventListener("DOMContentLoaded", We));
529
- function an() {
530
- for (const [e] of H)
531
- "isConnected" in e && !e.isConnected && H.delete(e);
532
- }
533
- function ln(e) {
534
- requestAnimationFrame(() => {
535
- an(), H.size === 0 ? e() : ge.add(e);
536
- });
537
- }
538
- function sn() {
539
- let e = T(/* @__PURE__ */ new Map()), t = _((o, i, a, l) => {
540
- let c = l?.once ? (...u) => {
541
- e.current.delete(a), a(...u);
542
- } : a;
543
- e.current.set(a, {
544
- type: i,
545
- eventTarget: o,
546
- fn: c,
547
- options: l
548
- }), o.addEventListener(i, c, l);
549
- }, []), n = _((o, i, a, l) => {
550
- var c;
551
- let u = ((c = e.current.get(a)) === null || c === void 0 ? void 0 : c.fn) || a;
552
- o.removeEventListener(i, u, l), e.current.delete(a);
553
- }, []), r = _(() => {
554
- e.current.forEach((o, i) => {
555
- n(o.eventTarget, o.type, i, o.options);
556
- });
557
- }, [
558
- n
559
- ]);
560
- return D(() => r, [
561
- r
562
- ]), {
563
- addGlobalListener: t,
564
- removeGlobalListener: n,
565
- removeAllGlobalListeners: r
566
- };
567
- }
568
- var be;
569
- const cn = (be = y.useInsertionEffect) !== null && be !== void 0 ? be : x;
570
- function Ve(e) {
571
- const t = T(null);
572
- return cn(() => {
573
- t.current = e;
574
- }, [
575
- e
576
- ]), _((...n) => {
577
- const r = t.current;
578
- return r?.(...n);
579
- }, []);
580
- }
581
- function ye(e, t) {
582
- if (!e) return !1;
583
- let n = window.getComputedStyle(e), r = document.scrollingElement || document.documentElement, o = /(auto|scroll)/.test(n.overflow + n.overflowX + n.overflowY);
584
- return e === r && n.overflow !== "hidden" && (o = !0), o && t && (o = e.scrollHeight !== e.clientHeight || e.scrollWidth !== e.clientWidth), o;
585
- }
586
- function it(e, t) {
587
- let n = e;
588
- for (ye(n, t) && (n = n.parentElement); n && !ye(n, t); ) n = n.parentElement;
589
- return n || document.scrollingElement || document.documentElement;
590
- }
591
- const un = /* @__PURE__ */ new Set([
592
- "checkbox",
593
- "radio",
594
- "range",
595
- "color",
596
- "file",
597
- "image",
598
- "button",
599
- "submit",
600
- "reset"
601
- ]);
602
- function $e(e) {
603
- return e instanceof HTMLInputElement && !un.has(e.type) || e instanceof HTMLTextAreaElement || e instanceof HTMLElement && e.isContentEditable;
604
- }
605
- function dn(e) {
606
- return e.pointerType === "" && e.isTrusted ? !0 : ot() && e.pointerType ? e.type === "click" && e.buttons === 1 : e.detail === 0 && !e.pointerType;
607
- }
608
- const fn = typeof Element < "u" && "checkVisibility" in Element.prototype;
609
- function pn(e) {
610
- const t = U(e);
611
- if (!(e instanceof t.HTMLElement) && !(e instanceof t.SVGElement)) return !1;
612
- let { display: n, visibility: r } = e.style, o = n !== "none" && r !== "hidden" && r !== "collapse";
613
- if (o) {
614
- const { getComputedStyle: i } = e.ownerDocument.defaultView;
615
- let { display: a, visibility: l } = i(e);
616
- o = a !== "none" && l !== "hidden" && l !== "collapse";
617
- }
618
- return o;
619
- }
620
- function vn(e, t) {
621
- return !e.hasAttribute("hidden") && // Ignore HiddenSelect when tree walking.
622
- !e.hasAttribute("data-react-aria-prevent-focus") && (e.nodeName === "DETAILS" && t && t.nodeName !== "SUMMARY" ? e.hasAttribute("open") : !0);
623
- }
624
- function _e(e, t) {
625
- return fn ? e.checkVisibility({
626
- visibilityProperty: !0
627
- }) && !e.closest("[data-react-aria-prevent-focus]") : e.nodeName !== "#comment" && pn(e) && vn(e, t) && (!e.parentElement || _e(e.parentElement, e));
628
- }
629
- const Fe = [
630
- "input:not([disabled]):not([type=hidden])",
631
- "select:not([disabled])",
632
- "textarea:not([disabled])",
633
- "button:not([disabled])",
634
- "a[href]",
635
- "area[href]",
636
- "summary",
637
- "iframe",
638
- "object",
639
- "embed",
640
- "audio[controls]",
641
- "video[controls]",
642
- '[contenteditable]:not([contenteditable^="false"])',
643
- "permission"
644
- ], bn = Fe.join(":not([hidden]),") + ",[tabindex]:not([disabled]):not([hidden])";
645
- Fe.push('[tabindex]:not([tabindex="-1"]):not([disabled])');
646
- const $n = Fe.join(':not([hidden]):not([tabindex="-1"]),');
647
- function mn(e) {
648
- return e.matches(bn) && _e(e) && !at(e);
649
- }
650
- function hn(e) {
651
- return e.matches($n) && _e(e) && !at(e);
652
- }
653
- function at(e) {
654
- let t = e;
655
- for (; t != null; ) {
656
- if (t instanceof t.ownerDocument.defaultView.HTMLElement && t.inert) return !0;
657
- t = t.parentElement;
658
- }
659
- return !1;
660
- }
661
- var me;
662
- const En = typeof document < "u" ? (me = y.useInsertionEffect) !== null && me !== void 0 ? me : y.useLayoutEffect : () => {
663
- };
664
- function wn(e, t, n) {
665
- let [r, o] = re(e || t), i = T(r), a = T(e !== void 0), l = e !== void 0;
666
- D(() => {
667
- let s = a.current;
668
- s !== l && process.env.NODE_ENV !== "production" && console.warn(`WARN: A component changed from ${s ? "controlled" : "uncontrolled"} to ${l ? "controlled" : "uncontrolled"}.`), a.current = l;
669
- }, [
670
- l
671
- ]);
672
- let c = l ? e : r;
673
- En(() => {
674
- i.current = c;
675
- });
676
- let [, u] = Nt(() => ({}), {}), d = _((s, ...f) => {
677
- let p = typeof s == "function" ? s(i.current) : s;
678
- Object.is(i.current, p) || (i.current = p, o(p), u(), n?.(p, ...f));
679
- }, [
680
- n
681
- ]);
682
- return [
683
- c,
684
- d
685
- ];
686
- }
687
- function lt(e) {
688
- let t = e;
689
- return t.nativeEvent = e, t.isDefaultPrevented = () => t.defaultPrevented, t.isPropagationStopped = () => t.cancelBubble, t.persist = () => {
690
- }, t;
691
- }
692
- function gn(e, t) {
693
- Object.defineProperty(e, "target", {
694
- value: t
695
- }), Object.defineProperty(e, "currentTarget", {
696
- value: t
697
- });
698
- }
699
- function yn(e) {
700
- let t = T({
701
- isFocused: !1,
702
- observer: null
703
- });
704
- return x(() => {
705
- const n = t.current;
706
- return () => {
707
- n.observer && (n.observer.disconnect(), n.observer = null);
708
- };
709
- }, []), _((n) => {
710
- let r = N(n);
711
- if (r instanceof HTMLButtonElement || r instanceof HTMLInputElement || r instanceof HTMLTextAreaElement || r instanceof HTMLSelectElement) {
712
- t.current.isFocused = !0;
713
- let o = r, i = (a) => {
714
- if (t.current.isFocused = !1, o.disabled) {
715
- let l = lt(a);
716
- e?.(l);
717
- }
718
- t.current.observer && (t.current.observer.disconnect(), t.current.observer = null);
719
- };
720
- o.addEventListener("focusout", i, {
721
- once: !0
722
- }), t.current.observer = new MutationObserver(() => {
723
- if (t.current.isFocused && o.disabled) {
724
- var a;
725
- (a = t.current.observer) === null || a === void 0 || a.disconnect();
726
- let l = o === L() ? null : L();
727
- o.dispatchEvent(new FocusEvent("blur", {
728
- relatedTarget: l
729
- })), o.dispatchEvent(new FocusEvent("focusout", {
730
- bubbles: !0,
731
- relatedTarget: l
732
- }));
733
- }
734
- }), t.current.observer.observe(o, {
735
- attributes: !0,
736
- attributeFilter: [
737
- "disabled"
738
- ]
739
- });
740
- }
741
- }, [
742
- e
743
- ]);
744
- }
745
- let Tn = !1;
746
- const st = y.createContext({
747
- register: () => {
748
- }
749
- });
750
- st.displayName = "PressResponderContext";
751
- let oe = null;
752
- const Nn = /* @__PURE__ */ new Set();
753
- let Y = /* @__PURE__ */ new Map(), G = !1, Te = !1;
754
- function Pe(e, t) {
755
- for (let n of Nn) n(e, t);
756
- }
757
- function kn(e) {
758
- return !(e.metaKey || !te() && e.altKey || e.ctrlKey || e.key === "Control" || e.key === "Shift" || e.key === "Meta");
759
- }
760
- function de(e) {
761
- G = !0, !ne.isOpening && kn(e) && (oe = "keyboard", Pe("keyboard", e));
762
- }
763
- function P(e) {
764
- oe = "pointer", "pointerType" in e && e.pointerType, (e.type === "mousedown" || e.type === "pointerdown") && (G = !0, Pe("pointer", e));
765
- }
766
- function ct(e) {
767
- !ne.isOpening && dn(e) && (G = !0, oe = "virtual");
768
- }
769
- function ut(e) {
770
- N(e) === window || N(e) === document || Tn || !e.isTrusted || (!G && !Te && (oe = "virtual", Pe("virtual", e)), G = !1, Te = !1);
771
- }
772
- function dt() {
773
- G = !1, Te = !0;
774
- }
775
- function He(e) {
776
- if (typeof window > "u" || typeof document > "u" || Y.get(U(e))) return;
777
- const t = U(e), n = S(e);
778
- let r = t.HTMLElement.prototype.focus;
779
- t.HTMLElement.prototype.focus = function() {
780
- G = !0, r.apply(this, arguments);
781
- }, n.addEventListener("keydown", de, !0), n.addEventListener("keyup", de, !0), n.addEventListener("click", ct, !0), t.addEventListener("focus", ut, !0), t.addEventListener("blur", dt, !1), typeof PointerEvent < "u" ? (n.addEventListener("pointerdown", P, !0), n.addEventListener("pointermove", P, !0), n.addEventListener("pointerup", P, !0)) : process.env.NODE_ENV === "test" && (n.addEventListener("mousedown", P, !0), n.addEventListener("mousemove", P, !0), n.addEventListener("mouseup", P, !0)), t.addEventListener("beforeunload", () => {
782
- ft(e);
783
- }, {
784
- once: !0
785
- }), Y.set(t, {
786
- focus: r
787
- });
788
- }
789
- const ft = (e, t) => {
790
- const n = U(e), r = S(e);
791
- t && r.removeEventListener("DOMContentLoaded", t), Y.has(n) && (n.HTMLElement.prototype.focus = Y.get(n).focus, r.removeEventListener("keydown", de, !0), r.removeEventListener("keyup", de, !0), r.removeEventListener("click", ct, !0), n.removeEventListener("focus", ut, !0), n.removeEventListener("blur", dt, !1), typeof PointerEvent < "u" ? (r.removeEventListener("pointerdown", P, !0), r.removeEventListener("pointermove", P, !0), r.removeEventListener("pointerup", P, !0)) : process.env.NODE_ENV === "test" && (r.removeEventListener("mousedown", P, !0), r.removeEventListener("mousemove", P, !0), r.removeEventListener("mouseup", P, !0)), Y.delete(n));
792
- };
793
- function Sn(e) {
794
- const t = S(e);
795
- let n;
796
- return t.readyState !== "loading" ? He(e) : (n = () => {
797
- He(e);
798
- }, t.addEventListener("DOMContentLoaded", n)), () => ft(e, n);
799
- }
800
- typeof document < "u" && Sn();
801
- function pt() {
802
- return oe;
803
- }
804
- function Ne(e) {
805
- if (!e.isConnected) return;
806
- const t = S(e);
807
- if (pt() === "virtual") {
808
- let n = L(t);
809
- ln(() => {
810
- const r = L(t);
811
- (r === n || r === t.body) && e.isConnected && we(e);
812
- });
813
- } else we(e);
814
- }
815
- function xn({ children: e }) {
816
- let t = Z(() => ({
817
- register: () => {
818
- }
819
- }), []);
820
- return /* @__PURE__ */ y.createElement(st.Provider, {
821
- value: t
822
- }, e);
823
- }
824
- function Ln(e) {
825
- let { isDisabled: t, onBlurWithin: n, onFocusWithin: r, onFocusWithinChange: o } = e, i = T({
826
- isFocusWithin: !1
827
- }), { addGlobalListener: a, removeAllGlobalListeners: l } = sn(), c = _((s) => {
828
- O(s.currentTarget, N(s)) && i.current.isFocusWithin && !O(s.currentTarget, s.relatedTarget) && (i.current.isFocusWithin = !1, l(), n && n(s), o && o(!1));
829
- }, [
830
- n,
831
- o,
832
- i,
833
- l
834
- ]), u = yn(c), d = _((s) => {
835
- if (!O(s.currentTarget, N(s))) return;
836
- let f = N(s);
837
- const p = S(f), m = L(p);
838
- if (!i.current.isFocusWithin && m === f) {
839
- r && r(s), o && o(!0), i.current.isFocusWithin = !0, u(s);
840
- let $ = s.currentTarget;
841
- a(p, "focus", (C) => {
842
- let b = N(C);
843
- if (i.current.isFocusWithin && !O($, b)) {
844
- let h = new p.defaultView.FocusEvent("blur", {
845
- relatedTarget: b
846
- });
847
- gn(h, $);
848
- let E = lt(h);
849
- c(E);
850
- }
851
- }, {
852
- capture: !0
853
- });
854
- }
855
- }, [
856
- r,
857
- o,
858
- u,
859
- a,
860
- c
861
- ]);
862
- return t ? {
863
- focusWithinProps: {
864
- // These cannot be null, that would conflict in mergeProps
865
- onFocus: void 0,
866
- onBlur: void 0
867
- }
868
- } : {
869
- focusWithinProps: {
870
- onFocus: d,
871
- onBlur: c
872
- }
873
- };
874
- }
875
- function Cn(e) {
876
- let { ref: t, onInteractOutside: n, isDisabled: r, onInteractOutsideStart: o } = e, i = T({
877
- isPointerDown: !1,
878
- ignoreEmulatedMouseEvents: !1
879
- }), a = Ve((c) => {
880
- n && ae(c, t) && (o && o(c), i.current.isPointerDown = !0);
881
- }), l = Ve((c) => {
882
- n && n(c);
883
- });
884
- D(() => {
885
- let c = i.current;
886
- if (r) return;
887
- const u = t.current, d = S(u);
888
- if (typeof PointerEvent < "u") {
889
- let s = (f) => {
890
- c.isPointerDown && ae(f, t) && l(f), c.isPointerDown = !1;
891
- };
892
- return d.addEventListener("pointerdown", a, !0), d.addEventListener("click", s, !0), () => {
893
- d.removeEventListener("pointerdown", a, !0), d.removeEventListener("click", s, !0);
894
- };
895
- } else if (process.env.NODE_ENV === "test") {
896
- let s = (p) => {
897
- c.ignoreEmulatedMouseEvents ? c.ignoreEmulatedMouseEvents = !1 : c.isPointerDown && ae(p, t) && l(p), c.isPointerDown = !1;
898
- }, f = (p) => {
899
- c.ignoreEmulatedMouseEvents = !0, c.isPointerDown && ae(p, t) && l(p), c.isPointerDown = !1;
900
- };
901
- return d.addEventListener("mousedown", a, !0), d.addEventListener("mouseup", s, !0), d.addEventListener("touchstart", a, !0), d.addEventListener("touchend", f, !0), () => {
902
- d.removeEventListener("mousedown", a, !0), d.removeEventListener("mouseup", s, !0), d.removeEventListener("touchstart", a, !0), d.removeEventListener("touchend", f, !0);
903
- };
904
- }
905
- }, [
906
- t,
907
- r
908
- ]);
909
- }
910
- function ae(e, t) {
911
- if (e.button > 0) return !1;
912
- let n = N(e);
913
- if (n) {
914
- const r = n.ownerDocument;
915
- if (!r || !O(r.documentElement, n) || n.closest("[data-react-aria-top-layer]")) return !1;
916
- }
917
- return t.current ? !e.composedPath().includes(t.current) : !1;
918
- }
919
- const Ke = /* @__PURE__ */ y.createContext(null), ke = "react-aria-focus-scope-restore";
920
- let g = null;
921
- function _n(e) {
922
- let { children: t, contain: n, restoreFocus: r, autoFocus: o } = e, i = T(null), a = T(null), l = T([]), { parentNode: c } = z(Ke) || {}, u = Z(() => new xe({
923
- scopeRef: l
924
- }), [
925
- l
926
- ]);
927
- x(() => {
928
- let f = c || k.root;
929
- if (k.getTreeNode(f.scopeRef) && g && !fe(g, f.scopeRef)) {
930
- let p = k.getTreeNode(g);
931
- p && (f = p);
932
- }
933
- f.addChild(u), k.addNode(u);
934
- }, [
935
- u,
936
- c
937
- ]), x(() => {
938
- let f = k.getTreeNode(l);
939
- f && (f.contain = !!n);
940
- }, [
941
- n
942
- ]), x(() => {
943
- var f;
944
- let p = (f = i.current) === null || f === void 0 ? void 0 : f.nextSibling, m = [], $ = (C) => C.stopPropagation();
945
- for (; p && p !== a.current; )
946
- m.push(p), p.addEventListener(ke, $), p = p.nextSibling;
947
- return l.current = m, () => {
948
- for (let C of m) C.removeEventListener(ke, $);
949
- };
950
- }, [
951
- t
952
- ]), An(l, r, n), Mn(l, n), In(l, r, n), Dn(l, o), D(() => {
953
- const f = L(S(l.current ? l.current[0] : void 0));
954
- let p = null;
955
- if (M(f, l.current)) {
956
- for (let m of k.traverse()) m.scopeRef && M(f, m.scopeRef.current) && (p = m);
957
- p === k.getTreeNode(l) && (g = p.scopeRef);
958
- }
959
- }, [
960
- l
961
- ]), x(() => () => {
962
- var f, p, m;
963
- let $ = (m = (p = k.getTreeNode(l)) === null || p === void 0 || (f = p.parent) === null || f === void 0 ? void 0 : f.scopeRef) !== null && m !== void 0 ? m : null;
964
- (l === g || fe(l, g)) && (!$ || k.getTreeNode($)) && (g = $), k.removeTreeNode(l);
965
- }, [
966
- l
967
- ]);
968
- let d = Z(() => Fn(l), []), s = Z(() => ({
969
- focusManager: d,
970
- parentNode: u
971
- }), [
972
- u,
973
- d
974
- ]);
975
- return /* @__PURE__ */ y.createElement(Ke.Provider, {
976
- value: s
977
- }, /* @__PURE__ */ y.createElement("span", {
978
- "data-focus-scope-start": !0,
979
- hidden: !0,
980
- ref: i
981
- }), t, /* @__PURE__ */ y.createElement("span", {
982
- "data-focus-scope-end": !0,
983
- hidden: !0,
984
- ref: a
985
- }));
986
- }
987
- function Fn(e) {
988
- return {
989
- focusNext(t = {}) {
990
- let n = e.current, { from: r, tabbable: o, wrap: i, accept: a } = t;
991
- var l;
992
- let c = r || L(S((l = n[0]) !== null && l !== void 0 ? l : void 0)), u = n[0].previousElementSibling, d = j(n), s = B(d, {
993
- tabbable: o,
994
- accept: a
995
- }, n);
996
- s.currentNode = M(c, n) ? c : u;
997
- let f = s.nextNode();
998
- return !f && i && (s.currentNode = u, f = s.nextNode()), f && W(f, !0), f;
999
- },
1000
- focusPrevious(t = {}) {
1001
- let n = e.current, { from: r, tabbable: o, wrap: i, accept: a } = t;
1002
- var l;
1003
- let c = r || L(S((l = n[0]) !== null && l !== void 0 ? l : void 0)), u = n[n.length - 1].nextElementSibling, d = j(n), s = B(d, {
1004
- tabbable: o,
1005
- accept: a
1006
- }, n);
1007
- s.currentNode = M(c, n) ? c : u;
1008
- let f = s.previousNode();
1009
- return !f && i && (s.currentNode = u, f = s.previousNode()), f && W(f, !0), f;
1010
- },
1011
- focusFirst(t = {}) {
1012
- let n = e.current, { tabbable: r, accept: o } = t, i = j(n), a = B(i, {
1013
- tabbable: r,
1014
- accept: o
1015
- }, n);
1016
- a.currentNode = n[0].previousElementSibling;
1017
- let l = a.nextNode();
1018
- return l && W(l, !0), l;
1019
- },
1020
- focusLast(t = {}) {
1021
- let n = e.current, { tabbable: r, accept: o } = t, i = j(n), a = B(i, {
1022
- tabbable: r,
1023
- accept: o
1024
- }, n);
1025
- a.currentNode = n[n.length - 1].nextElementSibling;
1026
- let l = a.previousNode();
1027
- return l && W(l, !0), l;
1028
- }
1029
- };
1030
- }
1031
- function j(e) {
1032
- return e[0].parentElement;
1033
- }
1034
- function Q(e) {
1035
- let t = k.getTreeNode(g);
1036
- for (; t && t.scopeRef !== e; ) {
1037
- if (t.contain) return !1;
1038
- t = t.parent;
1039
- }
1040
- return !0;
1041
- }
1042
- function Pn(e) {
1043
- if (!e.form)
1044
- return Array.from(S(e).querySelectorAll(`input[type="radio"][name="${CSS.escape(e.name)}"]`)).filter((r) => !r.form);
1045
- const t = e.form.elements.namedItem(e.name);
1046
- let n = U(e);
1047
- return t instanceof n.RadioNodeList ? Array.from(t).filter((r) => r instanceof n.HTMLInputElement) : t instanceof n.HTMLInputElement ? [
1048
- t
1049
- ] : [];
1050
- }
1051
- function On(e) {
1052
- if (e.checked) return !0;
1053
- const t = Pn(e);
1054
- return t.length > 0 && !t.some((n) => n.checked);
1055
- }
1056
- function Mn(e, t) {
1057
- let n = T(void 0), r = T(void 0);
1058
- x(() => {
1059
- let o = e.current;
1060
- if (!t) {
1061
- r.current && (cancelAnimationFrame(r.current), r.current = void 0);
1062
- return;
1063
- }
1064
- const i = S(o ? o[0] : void 0);
1065
- let a = (u) => {
1066
- if (u.key !== "Tab" || u.altKey || u.ctrlKey || u.metaKey || !Q(e) || u.isComposing) return;
1067
- let d = L(i), s = e.current;
1068
- if (!s || !M(d, s)) return;
1069
- let f = j(s), p = B(f, {
1070
- tabbable: !0
1071
- }, s);
1072
- if (!d) return;
1073
- p.currentNode = d;
1074
- let m = u.shiftKey ? p.previousNode() : p.nextNode();
1075
- m || (p.currentNode = u.shiftKey ? s[s.length - 1].nextElementSibling : s[0].previousElementSibling, m = u.shiftKey ? p.previousNode() : p.nextNode()), u.preventDefault(), m && W(m, !0);
1076
- }, l = (u) => {
1077
- (!g || fe(g, e)) && M(N(u), e.current) ? (g = e, n.current = N(u)) : Q(e) && !K(N(u), e) ? n.current ? n.current.focus() : g && g.current && Se(g.current) : Q(e) && (n.current = N(u));
1078
- }, c = (u) => {
1079
- r.current && cancelAnimationFrame(r.current), r.current = requestAnimationFrame(() => {
1080
- let d = pt(), s = (d === "virtual" || d === null) && ot() && rt(), f = L(i);
1081
- if (!s && f && Q(e) && !K(f, e)) {
1082
- g = e;
1083
- let m = N(u);
1084
- if (m && m.isConnected) {
1085
- var p;
1086
- n.current = m, (p = n.current) === null || p === void 0 || p.focus();
1087
- } else g.current && Se(g.current);
1088
- }
1089
- });
1090
- };
1091
- return i.addEventListener("keydown", a, !1), i.addEventListener("focusin", l, !1), o?.forEach((u) => u.addEventListener("focusin", l, !1)), o?.forEach((u) => u.addEventListener("focusout", c, !1)), () => {
1092
- i.removeEventListener("keydown", a, !1), i.removeEventListener("focusin", l, !1), o?.forEach((u) => u.removeEventListener("focusin", l, !1)), o?.forEach((u) => u.removeEventListener("focusout", c, !1));
1093
- };
1094
- }, [
1095
- e,
1096
- t
1097
- ]), x(() => () => {
1098
- r.current && cancelAnimationFrame(r.current);
1099
- }, [
1100
- r
1101
- ]);
1102
- }
1103
- function vt(e) {
1104
- return K(e);
1105
- }
1106
- function M(e, t) {
1107
- return !e || !t ? !1 : t.some((n) => O(n, e));
1108
- }
1109
- function K(e, t = null) {
1110
- if (e instanceof Element && e.closest("[data-react-aria-top-layer]")) return !0;
1111
- for (let { scopeRef: n } of k.traverse(k.getTreeNode(t)))
1112
- if (n && M(e, n.current)) return !0;
1113
- return !1;
1114
- }
1115
- function Rn(e) {
1116
- return K(e, g);
1117
- }
1118
- function fe(e, t) {
1119
- var n;
1120
- let r = (n = k.getTreeNode(t)) === null || n === void 0 ? void 0 : n.parent;
1121
- for (; r; ) {
1122
- if (r.scopeRef === e) return !0;
1123
- r = r.parent;
1124
- }
1125
- return !1;
1126
- }
1127
- function W(e, t = !1) {
1128
- if (e != null && !t) try {
1129
- Ne(e);
1130
- } catch {
1131
- }
1132
- else if (e != null) try {
1133
- e.focus();
1134
- } catch {
1135
- }
1136
- }
1137
- function bt(e, t = !0) {
1138
- let n = e[0].previousElementSibling, r = j(e), o = B(r, {
1139
- tabbable: t
1140
- }, e);
1141
- o.currentNode = n;
1142
- let i = o.nextNode();
1143
- return t && !i && (r = j(e), o = B(r, {
1144
- tabbable: !1
1145
- }, e), o.currentNode = n, i = o.nextNode()), i;
1146
- }
1147
- function Se(e, t = !0) {
1148
- W(bt(e, t));
1149
- }
1150
- function Dn(e, t) {
1151
- const n = y.useRef(t);
1152
- D(() => {
1153
- if (n.current) {
1154
- g = e;
1155
- const r = S(e.current ? e.current[0] : void 0);
1156
- !M(L(r), g.current) && e.current && Se(e.current);
1157
- }
1158
- n.current = !1;
1159
- }, [
1160
- e
1161
- ]);
1162
- }
1163
- function An(e, t, n) {
1164
- x(() => {
1165
- if (t || n) return;
1166
- let r = e.current;
1167
- const o = S(r ? r[0] : void 0);
1168
- let i = (a) => {
1169
- let l = N(a);
1170
- M(l, e.current) ? g = e : vt(l) || (g = null);
1171
- };
1172
- return o.addEventListener("focusin", i, !1), r?.forEach((a) => a.addEventListener("focusin", i, !1)), () => {
1173
- o.removeEventListener("focusin", i, !1), r?.forEach((a) => a.removeEventListener("focusin", i, !1));
1174
- };
1175
- }, [
1176
- e,
1177
- t,
1178
- n
1179
- ]);
1180
- }
1181
- function Be(e) {
1182
- let t = k.getTreeNode(g);
1183
- for (; t && t.scopeRef !== e; ) {
1184
- if (t.nodeToRestore) return !1;
1185
- t = t.parent;
1186
- }
1187
- return t?.scopeRef === e;
1188
- }
1189
- function In(e, t, n) {
1190
- const r = T(typeof document < "u" ? L(S(e.current ? e.current[0] : void 0)) : null);
1191
- x(() => {
1192
- let o = e.current;
1193
- const i = S(o ? o[0] : void 0);
1194
- if (!t || n) return;
1195
- let a = () => {
1196
- (!g || fe(g, e)) && M(L(i), e.current) && (g = e);
1197
- };
1198
- return i.addEventListener("focusin", a, !1), o?.forEach((l) => l.addEventListener("focusin", a, !1)), () => {
1199
- i.removeEventListener("focusin", a, !1), o?.forEach((l) => l.removeEventListener("focusin", a, !1));
1200
- };
1201
- }, [
1202
- e,
1203
- n
1204
- ]), x(() => {
1205
- const o = S(e.current ? e.current[0] : void 0);
1206
- if (!t) return;
1207
- let i = (a) => {
1208
- if (a.key !== "Tab" || a.altKey || a.ctrlKey || a.metaKey || !Q(e) || a.isComposing) return;
1209
- let l = o.activeElement;
1210
- if (!K(l, e) || !Be(e)) return;
1211
- let c = k.getTreeNode(e);
1212
- if (!c) return;
1213
- let u = c.nodeToRestore, d = B(o.body, {
1214
- tabbable: !0
1215
- });
1216
- d.currentNode = l;
1217
- let s = a.shiftKey ? d.previousNode() : d.nextNode();
1218
- if ((!u || !u.isConnected || u === o.body) && (u = void 0, c.nodeToRestore = void 0), (!s || !K(s, e)) && u) {
1219
- d.currentNode = u;
1220
- do
1221
- s = a.shiftKey ? d.previousNode() : d.nextNode();
1222
- while (K(s, e));
1223
- a.preventDefault(), a.stopPropagation(), s ? W(s, !0) : vt(u) ? W(u, !0) : l.blur();
1224
- }
1225
- };
1226
- return n || o.addEventListener("keydown", i, !0), () => {
1227
- n || o.removeEventListener("keydown", i, !0);
1228
- };
1229
- }, [
1230
- e,
1231
- t,
1232
- n
1233
- ]), x(() => {
1234
- const o = S(e.current ? e.current[0] : void 0);
1235
- if (!t) return;
1236
- let i = k.getTreeNode(e);
1237
- if (i) {
1238
- var a;
1239
- return i.nodeToRestore = (a = r.current) !== null && a !== void 0 ? a : void 0, () => {
1240
- let l = k.getTreeNode(e);
1241
- if (!l) return;
1242
- let c = l.nodeToRestore, u = L(o);
1243
- if (t && c && (u && K(u, e) || u === o.body && Be(e))) {
1244
- let d = k.clone();
1245
- requestAnimationFrame(() => {
1246
- if (o.activeElement === o.body) {
1247
- let s = d.getTreeNode(e);
1248
- for (; s; ) {
1249
- if (s.nodeToRestore && s.nodeToRestore.isConnected) {
1250
- je(s.nodeToRestore);
1251
- return;
1252
- }
1253
- s = s.parent;
1254
- }
1255
- for (s = d.getTreeNode(e); s; ) {
1256
- if (s.scopeRef && s.scopeRef.current && k.getTreeNode(s.scopeRef)) {
1257
- let f = bt(s.scopeRef.current, !0);
1258
- je(f);
1259
- return;
1260
- }
1261
- s = s.parent;
1262
- }
1263
- }
1264
- });
1265
- }
1266
- };
1267
- }
1268
- }, [
1269
- e,
1270
- t
1271
- ]);
1272
- }
1273
- function je(e) {
1274
- e.dispatchEvent(new CustomEvent(ke, {
1275
- bubbles: !0,
1276
- cancelable: !0
1277
- })) && W(e);
1278
- }
1279
- function B(e, t, n) {
1280
- let r = t?.tabbable ? hn : mn, o = e?.nodeType === Node.ELEMENT_NODE ? e : null, i = S(o), a = Ye(i, e || i, NodeFilter.SHOW_ELEMENT, {
1281
- acceptNode(l) {
1282
- return O(t?.from, l) || t?.tabbable && l.tagName === "INPUT" && l.getAttribute("type") === "radio" && (!On(l) || a.currentNode.tagName === "INPUT" && a.currentNode.type === "radio" && a.currentNode.name === l.name) ? NodeFilter.FILTER_REJECT : r(l) && (!n || M(l, n)) && (!t?.accept || t.accept(l)) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
1283
- }
1284
- });
1285
- return t?.from && (a.currentNode = t.from), a;
1286
- }
1287
- class Oe {
1288
- get size() {
1289
- return this.fastMap.size;
1290
- }
1291
- getTreeNode(t) {
1292
- return this.fastMap.get(t);
1293
- }
1294
- addTreeNode(t, n, r) {
1295
- let o = this.fastMap.get(n ?? null);
1296
- if (!o) return;
1297
- let i = new xe({
1298
- scopeRef: t
1299
- });
1300
- o.addChild(i), i.parent = o, this.fastMap.set(t, i), r && (i.nodeToRestore = r);
1301
- }
1302
- addNode(t) {
1303
- this.fastMap.set(t.scopeRef, t);
1304
- }
1305
- removeTreeNode(t) {
1306
- if (t === null) return;
1307
- let n = this.fastMap.get(t);
1308
- if (!n) return;
1309
- let r = n.parent;
1310
- for (let i of this.traverse()) i !== n && n.nodeToRestore && i.nodeToRestore && n.scopeRef && n.scopeRef.current && M(i.nodeToRestore, n.scopeRef.current) && (i.nodeToRestore = n.nodeToRestore);
1311
- let o = n.children;
1312
- r && (r.removeChild(n), o.size > 0 && o.forEach((i) => r && r.addChild(i))), this.fastMap.delete(n.scopeRef);
1313
- }
1314
- // Pre Order Depth First
1315
- *traverse(t = this.root) {
1316
- if (t.scopeRef != null && (yield t), t.children.size > 0) for (let n of t.children) yield* this.traverse(n);
1317
- }
1318
- clone() {
1319
- var t;
1320
- let n = new Oe();
1321
- var r;
1322
- for (let o of this.traverse()) n.addTreeNode(o.scopeRef, (r = (t = o.parent) === null || t === void 0 ? void 0 : t.scopeRef) !== null && r !== void 0 ? r : null, o.nodeToRestore);
1323
- return n;
1324
- }
1325
- constructor() {
1326
- this.fastMap = /* @__PURE__ */ new Map(), this.root = new xe({
1327
- scopeRef: null
1328
- }), this.fastMap.set(null, this.root);
1329
- }
1330
- }
1331
- class xe {
1332
- addChild(t) {
1333
- this.children.add(t), t.parent = this;
1334
- }
1335
- removeChild(t) {
1336
- this.children.delete(t), t.parent = void 0;
1337
- }
1338
- constructor(t) {
1339
- this.children = /* @__PURE__ */ new Set(), this.contain = !1, this.scopeRef = t.scopeRef;
1340
- }
1341
- }
1342
- let k = new Oe();
1343
- const Wn = /* @__PURE__ */ new WeakMap(), R = [];
1344
- function Vn(e, t) {
1345
- let { onClose: n, shouldCloseOnBlur: r, isOpen: o, isDismissable: i = !1, isKeyboardDismissDisabled: a = !1, shouldCloseOnInteractOutside: l } = e, c = T(void 0);
1346
- D(() => {
1347
- if (o && !R.includes(t))
1348
- return R.push(t), () => {
1349
- let $ = R.indexOf(t);
1350
- $ >= 0 && R.splice($, 1);
1351
- };
1352
- }, [
1353
- o,
1354
- t
1355
- ]);
1356
- let u = () => {
1357
- R[R.length - 1] === t && n && n();
1358
- }, d = ($) => {
1359
- const C = R[R.length - 1];
1360
- c.current = C, (!l || l(N($))) && C === t && ($.stopPropagation(), $.preventDefault());
1361
- }, s = ($) => {
1362
- (!l || l(N($))) && (R[R.length - 1] === t && ($.stopPropagation(), $.preventDefault()), c.current === t && u()), c.current = void 0;
1363
- }, f = ($) => {
1364
- $.key === "Escape" && !a && !$.nativeEvent.isComposing && ($.stopPropagation(), $.preventDefault(), u());
1365
- };
1366
- Cn({
1367
- ref: t,
1368
- onInteractOutside: i && o ? s : void 0,
1369
- onInteractOutsideStart: d
1370
- });
1371
- let { focusWithinProps: p } = Ln({
1372
- isDisabled: !r,
1373
- onBlurWithin: ($) => {
1374
- !$.relatedTarget || Rn($.relatedTarget) || (!l || l($.relatedTarget)) && n?.();
1375
- }
1376
- }), m = ($) => {
1377
- N($) === $.currentTarget && $.preventDefault();
1378
- };
1379
- return {
1380
- overlayProps: {
1381
- onKeyDown: f,
1382
- ...p
1383
- },
1384
- underlayProps: {
1385
- onPointerDown: m
1386
- }
1387
- };
1388
- }
1389
- function Hn(e, t, n) {
1390
- let { isOpen: r } = t;
1391
- D(() => {
1392
- n && n.current && Wn.set(n.current, t.close);
1393
- });
1394
- let o, i = Ze();
1395
- return {
1396
- triggerProps: {
1397
- "aria-haspopup": o,
1398
- "aria-expanded": r,
1399
- "aria-controls": r ? i : void 0,
1400
- onPress: t.toggle
1401
- },
1402
- overlayProps: {
1403
- id: i
1404
- }
1405
- };
1406
- }
1407
- const ee = typeof document < "u" && window.visualViewport;
1408
- let le = 0, he;
1409
- function Kn(e = {}) {
1410
- let { isDisabled: t } = e;
1411
- x(() => {
1412
- if (!t)
1413
- return le++, le === 1 && (nt() ? he = jn() : he = Bn()), () => {
1414
- le--, le === 0 && he();
1415
- };
1416
- }, [
1417
- t
1418
- ]);
1419
- }
1420
- function Bn() {
1421
- let e = window.innerWidth - document.documentElement.clientWidth;
1422
- return Le(e > 0 && // Use scrollbar-gutter when supported because it also works for fixed positioned elements.
1423
- ("scrollbarGutter" in document.documentElement.style ? ce(document.documentElement, "scrollbarGutter", "stable") : ce(document.documentElement, "paddingRight", `${e}px`)), ce(document.documentElement, "overflow", "hidden"));
1424
- }
1425
- function jn() {
1426
- let e = ce(document.documentElement, "overflow", "hidden"), t, n = !1, r = (u) => {
1427
- let d = N(u);
1428
- t = ye(d) ? d : it(d, !0), n = !1;
1429
- let s = d.ownerDocument.defaultView.getSelection();
1430
- s && !s.isCollapsed && s.containsNode(d, !0) && (n = !0), u.composedPath().some((f) => f instanceof HTMLInputElement && f.type === "range") && (n = !0), "selectionStart" in d && "selectionEnd" in d && d.selectionStart < d.selectionEnd && d.ownerDocument.activeElement === d && (n = !0);
1431
- }, o = document.createElement("style");
1432
- o.textContent = `
1433
- @layer {
1434
- * {
1435
- overscroll-behavior: contain;
1436
- }
1437
- }`.trim(), document.head.prepend(o);
1438
- let i = (u) => {
1439
- if (!(u.touches.length === 2 || n)) {
1440
- if (!t || t === document.documentElement || t === document.body) {
1441
- u.preventDefault();
1442
- return;
1443
- }
1444
- t.scrollHeight === t.clientHeight && t.scrollWidth === t.clientWidth && u.preventDefault();
1445
- }
1446
- }, a = (u) => {
1447
- let d = N(u), s = u.relatedTarget;
1448
- if (s && $e(s))
1449
- s.focus({
1450
- preventScroll: !0
1451
- }), Ge(s, $e(d));
1452
- else if (!s) {
1453
- var f;
1454
- let p = (f = d.parentElement) === null || f === void 0 ? void 0 : f.closest("[tabindex]");
1455
- p?.focus({
1456
- preventScroll: !0
1457
- });
1458
- }
1459
- }, l = HTMLElement.prototype.focus;
1460
- HTMLElement.prototype.focus = function(u) {
1461
- let d = L(), s = d != null && $e(d);
1462
- l.call(this, {
1463
- ...u,
1464
- preventScroll: !0
1465
- }), (!u || !u.preventScroll) && Ge(this, s);
1466
- };
1467
- let c = Le(Ee(document, "touchstart", r, {
1468
- passive: !1,
1469
- capture: !0
1470
- }), Ee(document, "touchmove", i, {
1471
- passive: !1,
1472
- capture: !0
1473
- }), Ee(document, "blur", a, !0));
1474
- return () => {
1475
- e(), c(), o.remove(), HTMLElement.prototype.focus = l;
1476
- };
1477
- }
1478
- function ce(e, t, n) {
1479
- let r = e.style[t];
1480
- return e.style[t] = n, () => {
1481
- e.style[t] = r;
1482
- };
1483
- }
1484
- function Ee(e, t, n, r) {
1485
- return e.addEventListener(t, n, r), () => {
1486
- e.removeEventListener(t, n, r);
1487
- };
1488
- }
1489
- function Ge(e, t) {
1490
- t || !ee ? qe(e) : ee.addEventListener("resize", () => qe(e), {
1491
- once: !0
1492
- });
1493
- }
1494
- function qe(e) {
1495
- let t = document.scrollingElement || document.documentElement, n = e;
1496
- for (; n && n !== t; ) {
1497
- let r = it(n);
1498
- if (r !== document.documentElement && r !== document.body && r !== n) {
1499
- let o = r.getBoundingClientRect(), i = n.getBoundingClientRect();
1500
- if (i.top < o.top || i.bottom > o.top + n.clientHeight) {
1501
- let a = o.bottom;
1502
- ee && (a = Math.min(a, ee.offsetTop + ee.height));
1503
- let l = i.top - o.top - ((a - o.top) / 2 - i.height / 2);
1504
- r.scrollTo({
1505
- // Clamp to the valid range to prevent over-scrolling.
1506
- top: Math.max(0, Math.min(r.scrollHeight - r.clientHeight, r.scrollTop + l)),
1507
- behavior: "smooth"
1508
- });
1509
- }
1510
- }
1511
- n = r.parentElement;
1512
- }
1513
- }
1514
- const Gn = /* @__PURE__ */ kt({});
1515
- function qn() {
1516
- var e;
1517
- return (e = z(Gn)) !== null && e !== void 0 ? e : {};
1518
- }
1519
- const Un = typeof HTMLElement < "u" && "inert" in HTMLElement.prototype;
1520
- let J = /* @__PURE__ */ new WeakMap(), F = [];
1521
- function zn(e, t) {
1522
- let n = U(e?.[0]), r = t instanceof n.Element ? {
1523
- root: t
1524
- } : t;
1525
- var o;
1526
- let i = (o = r?.root) !== null && o !== void 0 ? o : document.body, a = r?.shouldUseInert && Un, l = new Set(e), c = /* @__PURE__ */ new Set(), u = (b) => a && b instanceof n.HTMLElement ? b.inert : b.getAttribute("aria-hidden") === "true", d = (b, h) => {
1527
- a && b instanceof n.HTMLElement ? b.inert = h : h ? b.setAttribute("aria-hidden", "true") : (b.removeAttribute("aria-hidden"), b instanceof n.HTMLElement && (b.inert = !1));
1528
- }, s = /* @__PURE__ */ new Set();
1529
- if (I())
1530
- for (let b of e) {
1531
- let h = b;
1532
- for (; h && h !== i; ) {
1533
- let E = h.getRootNode();
1534
- "shadowRoot" in E && s.add(E.shadowRoot), h = E.parentNode;
1535
- }
1536
- }
1537
- let f = (b) => {
1538
- for (let w of b.querySelectorAll("[data-live-announcer], [data-react-aria-top-layer]")) l.add(w);
1539
- let h = (w) => {
1540
- if (c.has(w) || l.has(w) || w.parentElement && c.has(w.parentElement) && w.parentElement.getAttribute("role") !== "row") return NodeFilter.FILTER_REJECT;
1541
- for (let wt of l)
1542
- if (O(w, wt)) return NodeFilter.FILTER_SKIP;
1543
- return NodeFilter.FILTER_ACCEPT;
1544
- }, E = Ye(S(b), b, NodeFilter.SHOW_ELEMENT, {
1545
- acceptNode: h
1546
- }), A = h(b);
1547
- if (A === NodeFilter.FILTER_ACCEPT && p(b), A !== NodeFilter.FILTER_REJECT) {
1548
- let w = E.nextNode();
1549
- for (; w != null; )
1550
- p(w), w = E.nextNode();
1551
- }
1552
- }, p = (b) => {
1553
- var h;
1554
- let E = (h = J.get(b)) !== null && h !== void 0 ? h : 0;
1555
- u(b) && E === 0 || (E === 0 && d(b, !0), c.add(b), J.set(b, E + 1));
1556
- };
1557
- F.length && F[F.length - 1].disconnect(), f(i);
1558
- let m = new MutationObserver((b) => {
1559
- for (let h of b)
1560
- if (h.type === "childList") {
1561
- if (h.target.isConnected && ![
1562
- ...l,
1563
- ...c
1564
- ].some((E) => O(E, h.target))) for (let E of h.addedNodes)
1565
- (E instanceof HTMLElement || E instanceof SVGElement) && (E.dataset.liveAnnouncer === "true" || E.dataset.reactAriaTopLayer === "true") ? l.add(E) : E instanceof Element && f(E);
1566
- if (I()) {
1567
- for (let E of s) if (!E.isConnected) {
1568
- m.disconnect();
1569
- break;
1570
- }
1571
- }
1572
- }
1573
- });
1574
- m.observe(i, {
1575
- childList: !0,
1576
- subtree: !0
1577
- });
1578
- let $ = /* @__PURE__ */ new Set();
1579
- if (I()) for (let b of s) {
1580
- let h = new MutationObserver((E) => {
1581
- for (let A of E)
1582
- if (A.type === "childList") {
1583
- if (A.target.isConnected && ![
1584
- ...l,
1585
- ...c
1586
- ].some((w) => O(w, A.target))) for (let w of A.addedNodes)
1587
- (w instanceof HTMLElement || w instanceof SVGElement) && (w.dataset.liveAnnouncer === "true" || w.dataset.reactAriaTopLayer === "true") ? l.add(w) : w instanceof Element && f(w);
1588
- if (I()) {
1589
- for (let w of s) if (!w.isConnected) {
1590
- m.disconnect();
1591
- break;
1592
- }
1593
- }
1594
- }
1595
- });
1596
- h.observe(b, {
1597
- childList: !0,
1598
- subtree: !0
1599
- }), $.add(h);
1600
- }
1601
- let C = {
1602
- visibleNodes: l,
1603
- hiddenNodes: c,
1604
- observe() {
1605
- m.observe(i, {
1606
- childList: !0,
1607
- subtree: !0
1608
- });
1609
- },
1610
- disconnect() {
1611
- m.disconnect();
1612
- }
1613
- };
1614
- return F.push(C), () => {
1615
- if (m.disconnect(), I()) for (let b of $) b.disconnect();
1616
- for (let b of c) {
1617
- let h = J.get(b);
1618
- h != null && (h === 1 ? (d(b, !1), J.delete(b)) : J.set(b, h - 1));
1619
- }
1620
- C === F[F.length - 1] ? (F.pop(), F.length && F[F.length - 1].observe()) : F.splice(F.indexOf(C), 1);
1621
- };
1622
- }
1623
- const $t = /* @__PURE__ */ y.createContext(null);
1624
- function Jn(e) {
1625
- let t = Qe(), { portalContainer: n = t ? null : document.body, isExiting: r } = e, [o, i] = re(!1), a = Z(() => ({
1626
- contain: o,
1627
- setContain: i
1628
- }), [
1629
- o,
1630
- i
1631
- ]), { getContainer: l } = qn();
1632
- if (!e.portalContainer && l && (n = l()), !n) return null;
1633
- let c = e.children;
1634
- return e.disableFocusManagement || (c = /* @__PURE__ */ y.createElement(_n, {
1635
- restoreFocus: !0,
1636
- contain: (e.shouldContainFocus || o) && !r
1637
- }, c)), c = /* @__PURE__ */ y.createElement($t.Provider, {
1638
- value: a
1639
- }, /* @__PURE__ */ y.createElement(xn, null, c)), /* @__PURE__ */ St.createPortal(c, n);
1640
- }
1641
- function mt() {
1642
- let e = z($t), t = e?.setContain;
1643
- x(() => {
1644
- t?.(!0);
1645
- }, [
1646
- t
1647
- ]);
1648
- }
1649
- function Xn(e, t, n) {
1650
- let { overlayProps: r, underlayProps: o } = Vn({
1651
- ...e,
1652
- isOpen: t.isOpen,
1653
- onClose: t.close
1654
- }, n);
1655
- return Kn({
1656
- isDisabled: !t.isOpen
1657
- }), mt(), D(() => {
1658
- if (t.isOpen && n.current) return zn([
1659
- n.current
1660
- ], {
1661
- shouldUseInert: !0
1662
- });
1663
- }, [
1664
- t.isOpen,
1665
- n
1666
- ]), {
1667
- modalProps: qt(r),
1668
- underlayProps: o
1669
- };
1670
- }
1671
- function Qn(e, t) {
1672
- let { role: n = "dialog" } = e, r = Wt();
1673
- r = e["aria-label"] ? void 0 : r;
1674
- let o = T(!1);
1675
- return D(() => {
1676
- if (t.current && !t.current.contains(document.activeElement)) {
1677
- Ne(t.current);
1678
- let i = setTimeout(() => {
1679
- document.activeElement === t.current && (o.current = !0, t.current && (t.current.blur(), Ne(t.current)), o.current = !1);
1680
- }, 500);
1681
- return () => {
1682
- clearTimeout(i);
1683
- };
1684
- }
1685
- }, [
1686
- t
1687
- ]), mt(), {
1688
- dialogProps: {
1689
- ...Zt(e, {
1690
- labelable: !0
1691
- }),
1692
- role: n,
1693
- tabIndex: -1,
1694
- "aria-labelledby": e["aria-labelledby"] || r,
1695
- // Prevent blur events from reaching useOverlay, which may cause
1696
- // popovers to close. Since focus is contained within the dialog,
1697
- // we don't want this to occur due to the above useEffect.
1698
- onBlur: (i) => {
1699
- o.current && i.stopPropagation();
1700
- }
1701
- },
1702
- titleProps: {
1703
- id: r
1704
- }
1705
- };
1706
- }
1707
- function Zn(e, t, n) {
1708
- return t in e ? Object.defineProperty(e, t, {
1709
- value: n,
1710
- enumerable: !0,
1711
- configurable: !0,
1712
- writable: !0
1713
- }) : e[t] = n, e;
1714
- }
1715
- function Ue(e, t) {
1716
- var n = Object.keys(e);
1717
- if (Object.getOwnPropertySymbols) {
1718
- var r = Object.getOwnPropertySymbols(e);
1719
- t && (r = r.filter(function(o) {
1720
- return Object.getOwnPropertyDescriptor(e, o).enumerable;
1721
- })), n.push.apply(n, r);
1722
- }
1723
- return n;
1724
- }
1725
- function ze(e) {
1726
- for (var t = 1; t < arguments.length; t++) {
1727
- var n = arguments[t] != null ? arguments[t] : {};
1728
- t % 2 ? Ue(Object(n), !0).forEach(function(r) {
1729
- Zn(e, r, n[r]);
1730
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : Ue(Object(n)).forEach(function(r) {
1731
- Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(n, r));
1732
- });
1733
- }
1734
- return e;
1735
- }
1736
- var Yn = (e, t, n) => {
1737
- for (var r of Object.keys(e)) {
1738
- var o;
1739
- if (e[r] !== ((o = t[r]) !== null && o !== void 0 ? o : n[r]))
1740
- return !1;
1741
- }
1742
- return !0;
1743
- }, er = (e) => (t) => {
1744
- var n = e.defaultClassName, r = ze(ze({}, e.defaultVariants), t);
1745
- for (var o in r) {
1746
- var i, a = (i = r[o]) !== null && i !== void 0 ? i : e.defaultVariants[o];
1747
- if (a != null) {
1748
- var l = a;
1749
- typeof l == "boolean" && (l = l === !0 ? "true" : "false");
1750
- var c = (
1751
- // @ts-expect-error
1752
- e.variantClassNames[o][l]
1753
- );
1754
- c && (n += " " + c);
1755
- }
1756
- }
1757
- for (var [u, d] of e.compoundVariants)
1758
- Yn(u, r, e.defaultVariants) && (n += " " + d);
1759
- return n;
1760
- }, tr = "pkg_sps-woodland_focused-task__version_8_50_2__hash_1io4psq0", nr = er({ defaultClassName: "pkg_sps-woodland_focused-task__version_8_50_2__hash_1io4psq1", variantClassNames: { fullWidth: { true: "pkg_sps-woodland_focused-task__version_8_50_2__hash_1io4psq2", false: "pkg_sps-woodland_focused-task__version_8_50_2__hash_1io4psq3" } }, defaultVariants: {}, compoundVariants: [] }), rr = "pkg_sps-woodland_focused-task__version_8_50_2__hash_1io4psq4", or = "pkg_sps-woodland_focused-task__version_8_50_2__hash_1io4psq5", ir = "pkg_sps-woodland_focused-task__version_8_50_2__hash_1io4psq7", ar = "pkg_sps-woodland_focused-task__version_8_50_2__hash_1io4psq8", lr = "pkg_sps-woodland_focused-task__version_8_50_2__hash_1io4psq9", sr = "pkg_sps-woodland_focused-task__version_8_50_2__hash_1io4psqa";
1761
- function ht({
1762
- children: e,
1763
- className: t = "",
1764
- ...n
1765
- }) {
1766
- return /* @__PURE__ */ v.createElement("div", { className: se(ar, t), ...n }, /* @__PURE__ */ v.createElement("div", { className: se(lr) }, /* @__PURE__ */ v.createElement("div", { className: se(sr) }, e)));
1767
- }
1768
- Je.set(ht, { name: "FocusedTaskActions" });
1769
- function cr({
1770
- children: e,
1771
- className: t,
1772
- "data-testid": n,
1773
- onBlur: r,
1774
- onFocus: o,
1775
- overlayProps: i,
1776
- state: a,
1777
- onClose: l,
1778
- fullWidth: c = !1,
1779
- ...u
1780
- }) {
1781
- const d = v.useRef(null), { modalProps: s, underlayProps: f } = Xn(
1782
- { ...u },
1783
- a,
1784
- d
1785
- ), { dialogProps: p, titleProps: m } = Qn(u, d), $ = Me(s.onFocus, p.onFocus, o), C = Me(s.onBlur, p.onBlur, r), b = gt({ "data-testid": n }), [h, E] = yt(e, [{ type: ht }]);
1786
- function A() {
1787
- l && typeof l == "function" && l(), a.close();
1788
- }
1789
- const w = /* @__PURE__ */ v.createElement(
1790
- Tt,
1791
- {
1792
- "aria-label": "Close",
1793
- onClick: A,
1794
- kind: "icon",
1795
- icon: "x",
1796
- className: or
1797
- }
1798
- );
1799
- return /* @__PURE__ */ v.createElement(Jn, null, /* @__PURE__ */ v.createElement(
1800
- "div",
1801
- {
1802
- className: ir,
1803
- "data-react-aria-top-layer": "true",
1804
- ...f,
1805
- ...u
1806
- },
1807
- /* @__PURE__ */ v.createElement(
1808
- "div",
1809
- {
1810
- ...s,
1811
- ...p,
1812
- ...i,
1813
- onFocus: $,
1814
- onBlur: C,
1815
- ...b("dialog"),
1816
- ref: d,
1817
- className: se(tr, t)
1818
- },
1819
- /* @__PURE__ */ v.createElement("div", { ...m, className: rr }, w),
1820
- /* @__PURE__ */ v.createElement("div", { className: nr({ fullWidth: c }) }, Re(E, a.close)),
1821
- h && h.length > 0 && /* @__PURE__ */ v.createElement(v.Fragment, null, Re(h, a.close))
1822
- )
1823
- ));
1824
- }
1825
- function Et(e) {
1826
- return e.state.isOpen ? /* @__PURE__ */ v.createElement(cr, { ...e }, e.children) : /* @__PURE__ */ v.createElement(v.Fragment, null);
1827
- }
1828
- Je.set(Et, {
1829
- name: "FocusedTask",
1830
- props: {
1831
- fullWidth: { type: "boolean", default: "false" },
1832
- onBlur: { type: "() => void" },
1833
- onClose: { type: "() => void" },
1834
- onFocus: { type: "() => void" }
1835
- }
1836
- });
1837
- function ur(e) {
1838
- let [t, n] = wn(e.isOpen, e.defaultOpen || !1, e.onOpenChange);
1839
- const r = _(() => {
1840
- n(!0);
1841
- }, [
1842
- n
1843
- ]), o = _(() => {
1844
- n(!1);
1845
- }, [
1846
- n
1847
- ]), i = _(() => {
1848
- n(!t);
1849
- }, [
1850
- n,
1851
- t
1852
- ]);
1853
- return {
1854
- isOpen: t,
1855
- setOpen: n,
1856
- open: r,
1857
- close: o,
1858
- toggle: i
1859
- };
1860
- }
1861
- function mr(e = {}) {
1862
- const t = ur(e), n = T(null), { triggerProps: r, overlayProps: o } = Hn({}, t, n), { onPress: i, ...a } = r;
1863
- return {
1864
- triggerProps: {
1865
- ...a,
1866
- // Forward event to onPress (types differ but handler doesn't inspect event)
1867
- onClick: i ? (l) => i(l) : void 0,
1868
- ref: n
1869
- },
1870
- focusedTaskState: t,
1871
- focusedTaskProps: { overlayProps: o, state: t }
1872
- };
1873
- }
1874
- const dr = {
1875
- components: [Et],
1
+ import { FocusedTask as t } from "@sps-woodland/core/focused-task";
2
+ export * from "@sps-woodland/core/focused-task";
3
+ import * as e from "react";
4
+ import { code as o } from "@spscommerce/utils";
5
+ const s = {
6
+ components: [t],
1876
7
  examples: {
1877
8
  hooks: {
1878
9
  label: "Using the Hook",
1879
- description: () => /* @__PURE__ */ v.createElement(v.Fragment, null, /* @__PURE__ */ v.createElement("p", null, "To use the focused task component, you must call the ", /* @__PURE__ */ v.createElement("code", null, "useFocusedTask"), " hook. Optional arguments for this hook include:"), /* @__PURE__ */ v.createElement("dl", null, /* @__PURE__ */ v.createElement("dt", null, /* @__PURE__ */ v.createElement("code", null, "isOpen"), ": boolean"), /* @__PURE__ */ v.createElement("dd", null, "Whether the overlay is open by default (controlled)"), /* @__PURE__ */ v.createElement("dt", null, /* @__PURE__ */ v.createElement("code", null, "defaultOpen"), ": boolean"), /* @__PURE__ */ v.createElement("dd", null, "Whether the overlay is open by default (uncontrolled)."), /* @__PURE__ */ v.createElement("dt", null, /* @__PURE__ */ v.createElement("code", null, "onOpenChange"), ": function"), /* @__PURE__ */ v.createElement("dd", null, "Handler that is called when the overlay's open state changes.", /* @__PURE__ */ v.createElement("code", null, "(isOpen: boolean) => void"))), /* @__PURE__ */ v.createElement("h5", null, "Focused Task Props, Focused Task State, and Trigger Props"), /* @__PURE__ */ v.createElement("p", null, "The ", /* @__PURE__ */ v.createElement("code", null, "useFocusedTask"), " returns an object with ", /* @__PURE__ */ v.createElement("code", null, "focusedTaskProps"), ",", " ", /* @__PURE__ */ v.createElement("code", null, "focusedTaskState"), " and ", /* @__PURE__ */ v.createElement("code", null, "triggerProps")), /* @__PURE__ */ v.createElement("p", null, "The ", /* @__PURE__ */ v.createElement("code", null, "triggerProps"), " need to be spread on the element that triggers the focused task."), /* @__PURE__ */ v.createElement("p", null, "The ", /* @__PURE__ */ v.createElement("code", null, "focusedTaskState"), " object (which is also included in ", /* @__PURE__ */ v.createElement("code", null, "focusedTaskProps"), ") allows programmatic access to the state of the focused task. This includes a read only", " ", /* @__PURE__ */ v.createElement("code", null, "isOpen"), " property, a ", /* @__PURE__ */ v.createElement("code", null, "setOpen(isOpen: boolean)"), " method which can be use to set whether the overlay is open, an ", /* @__PURE__ */ v.createElement("code", null, "open()"), " method which opens the overlay, a ", /* @__PURE__ */ v.createElement("code", null, "close()"), " method which closes the overlay and a", " ", /* @__PURE__ */ v.createElement("code", null, "toggle()"), " method that toggles the overlay's visiblity."), /* @__PURE__ */ v.createElement("p", null, "The ", /* @__PURE__ */ v.createElement("code", null, "focusedTaskProps"), " should be spread on the actual ", /* @__PURE__ */ v.createElement("code", null, "FocusedTask"), " component."), /* @__PURE__ */ v.createElement("p", null, "Please refer to the examples to see its implementation"))
10
+ description: () => /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("p", null, "To use the focused task component, you must call the ", /* @__PURE__ */ e.createElement("code", null, "useFocusedTask"), " hook. Optional arguments for this hook include:"), /* @__PURE__ */ e.createElement("dl", null, /* @__PURE__ */ e.createElement("dt", null, /* @__PURE__ */ e.createElement("code", null, "isOpen"), ": boolean"), /* @__PURE__ */ e.createElement("dd", null, "Whether the overlay is open by default (controlled)"), /* @__PURE__ */ e.createElement("dt", null, /* @__PURE__ */ e.createElement("code", null, "defaultOpen"), ": boolean"), /* @__PURE__ */ e.createElement("dd", null, "Whether the overlay is open by default (uncontrolled)."), /* @__PURE__ */ e.createElement("dt", null, /* @__PURE__ */ e.createElement("code", null, "onOpenChange"), ": function"), /* @__PURE__ */ e.createElement("dd", null, "Handler that is called when the overlay's open state changes.", /* @__PURE__ */ e.createElement("code", null, "(isOpen: boolean) => void"))), /* @__PURE__ */ e.createElement("h5", null, "Focused Task Props, Focused Task State, and Trigger Props"), /* @__PURE__ */ e.createElement("p", null, "The ", /* @__PURE__ */ e.createElement("code", null, "useFocusedTask"), " returns an object with ", /* @__PURE__ */ e.createElement("code", null, "focusedTaskProps"), ",", " ", /* @__PURE__ */ e.createElement("code", null, "focusedTaskState"), " and ", /* @__PURE__ */ e.createElement("code", null, "triggerProps")), /* @__PURE__ */ e.createElement("p", null, "The ", /* @__PURE__ */ e.createElement("code", null, "triggerProps"), " need to be spread on the element that triggers the focused task."), /* @__PURE__ */ e.createElement("p", null, "The ", /* @__PURE__ */ e.createElement("code", null, "focusedTaskState"), " object (which is also included in ", /* @__PURE__ */ e.createElement("code", null, "focusedTaskProps"), ") allows programmatic access to the state of the focused task. This includes a read only", " ", /* @__PURE__ */ e.createElement("code", null, "isOpen"), " property, a ", /* @__PURE__ */ e.createElement("code", null, "setOpen(isOpen: boolean)"), " method which can be use to set whether the overlay is open, an ", /* @__PURE__ */ e.createElement("code", null, "open()"), " method which opens the overlay, a ", /* @__PURE__ */ e.createElement("code", null, "close()"), " method which closes the overlay and a", " ", /* @__PURE__ */ e.createElement("code", null, "toggle()"), " method that toggles the overlay's visiblity."), /* @__PURE__ */ e.createElement("p", null, "The ", /* @__PURE__ */ e.createElement("code", null, "focusedTaskProps"), " should be spread on the actual ", /* @__PURE__ */ e.createElement("code", null, "FocusedTask"), " component."), /* @__PURE__ */ e.createElement("p", null, "Please refer to the examples to see its implementation"))
1880
11
  },
1881
12
  standard: {
1882
13
  label: "Standard",
1883
14
  examples: {
1884
15
  basic: {
1885
- react: De`
16
+ react: o`
1886
17
  import { FocusedTask, FocusedTaskActions, useFocusedTask } from "@sps-woodland/focused-task";
1887
18
  import { Button } from "@sps-woodland/buttons";
1888
19
  import { Card } from "@sps-woodland/cards";
@@ -1928,7 +59,7 @@ const dr = {
1928
59
  label: "Fill Width",
1929
60
  examples: {
1930
61
  basic: {
1931
- react: De`
62
+ react: o`
1932
63
  import { FocusedTask, FocusedTaskActions, useFocusedTask } from "@sps-woodland/focused-task";
1933
64
  import { Button } from "@sps-woodland/buttons";
1934
65
  import { Card } from "@sps-woodland/cards";
@@ -1972,12 +103,9 @@ const dr = {
1972
103
  }
1973
104
  }
1974
105
  }
1975
- }, hr = {
1976
- "Focused Task": dr
106
+ }, l = {
107
+ "Focused Task": s
1977
108
  };
1978
109
  export {
1979
- Et as FocusedTask,
1980
- ht as FocusedTaskActions,
1981
- hr as MANIFEST,
1982
- mr as useFocusedTask
110
+ l as MANIFEST
1983
111
  };