@midas-ds/components 1.0.2 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (175) hide show
  1. package/Button-DL6nqUco.js +182 -0
  2. package/CHANGELOG.md +15 -0
  3. package/Checkbox-q0dugR2t.js +402 -0
  4. package/{Collection-B3xUVWPF.js → Collection-KMFfVuzU.js} +179 -152
  5. package/Dialog-D6Bqrpn-.js +1952 -0
  6. package/Disclosure-dAZYXyTH.js +225 -0
  7. package/Disclosure.css +1 -0
  8. package/DragAndDrop-B0T3WgjL.js +40 -0
  9. package/FocusScope-B7CkxXNC.js +513 -0
  10. package/{Form-DXLoQL91.js → Form-BWBjJC6v.js} +79 -81
  11. package/Group-D7_8007y.js +42 -0
  12. package/Heading-RCRHv6hd.js +15 -0
  13. package/{Hidden-BQWDvze4.js → Hidden-CVlUgUJM.js} +1 -1
  14. package/Link-BnQvB-hH.js +75 -0
  15. package/ListBox-DBBiqvcR.js +474 -0
  16. package/ListKeyboardDelegate-gCXy-Xnn.js +172 -0
  17. package/PressResponder-B4g56kDz.js +31 -0
  18. package/README.md +21 -3
  19. package/{RSPContexts-EOiWkKOf.js → RSPContexts-BW2SEIqe.js} +2 -2
  20. package/SelectionManager-BfXUE1qg.js +1031 -0
  21. package/Separator-BBX9m2O2.js +49 -0
  22. package/Tag-DWt0koFj.js +728 -0
  23. package/Text-BCF0xvqL.js +15 -0
  24. package/TextField-CX4eOQf6.js +225 -0
  25. package/TextField.module-DdICj682.js +143 -0
  26. package/{VisuallyHidden-B_XzVvlX.js → VisuallyHidden-Dhr5caPC.js} +1 -1
  27. package/accordion/Accordion.d.ts +8 -8
  28. package/accordion/AccordionItem.d.ts +11 -3
  29. package/accordion/index.d.ts +0 -3
  30. package/{context-ScOIq_Gu.js → context-BpJLnOuu.js} +11 -11
  31. package/global.css +1 -0
  32. package/index-B-jHjTDC.js +120 -0
  33. package/{index-CorR1LBD.js → index-BPdc9gJ8.js} +3 -3
  34. package/{index-Dl1Q-tbj.js → index-KSgQWWiy.js} +5315 -5315
  35. package/index.d.ts +1 -0
  36. package/index.js +105 -112
  37. package/index10.js +1 -1
  38. package/index11.js +1 -1
  39. package/index12.js +1 -1
  40. package/index13.js +1 -1
  41. package/index14.js +1 -1
  42. package/index15.js +2 -2
  43. package/index16.js +2 -2
  44. package/index17.js +1 -1
  45. package/index18.js +1 -1
  46. package/index19.js +2 -2
  47. package/index2.js +1 -1
  48. package/index20.js +2 -2
  49. package/index21.js +1 -1
  50. package/index22.js +1 -1
  51. package/index23.js +1 -1
  52. package/index24.js +1 -1
  53. package/index25.js +2 -2
  54. package/index26.js +2 -2
  55. package/index27.js +2 -2
  56. package/index28.js +1 -1
  57. package/index29.js +2 -8
  58. package/index3.js +2 -4
  59. package/index30.js +17 -16
  60. package/index31.js +3 -3
  61. package/index32.js +3 -3
  62. package/index33.js +2 -2
  63. package/index34.js +3 -3
  64. package/index35.js +1 -1
  65. package/index36.js +2 -2
  66. package/index37.js +2 -2
  67. package/index38.js +2 -2
  68. package/index39.js +2 -2
  69. package/index4.js +1 -1
  70. package/index40.js +19 -12
  71. package/index41.js +61 -14
  72. package/index42.js +44 -22
  73. package/index43.js +13 -11
  74. package/index44.js +25 -4
  75. package/index45.js +16 -51
  76. package/index46.js +19 -16
  77. package/index47.js +49 -27
  78. package/index48.js +5 -18
  79. package/index49.js +25 -21
  80. package/index5.js +1 -1
  81. package/index50.js +16 -47
  82. package/index51.js +7 -3
  83. package/index52.js +18 -18
  84. package/index53.js +16 -16
  85. package/index54.js +6 -4
  86. package/index55.js +8 -21
  87. package/index56.js +13 -16
  88. package/index57.js +6 -8
  89. package/index58.js +6 -9
  90. package/index59.js +17 -13
  91. package/index6.js +1 -1
  92. package/index60.js +20 -7
  93. package/index61.js +59 -7
  94. package/index62.js +13 -17
  95. package/index63.js +9 -20
  96. package/index64.js +40 -48
  97. package/index65.js +85 -15
  98. package/index66.js +74 -11
  99. package/index67.js +23 -62
  100. package/index68.js +64 -80
  101. package/index69.js +68 -62
  102. package/index7.js +1 -1
  103. package/index70.js +138 -22
  104. package/index71.js +66 -65
  105. package/index72.js +40 -78
  106. package/index73.js +75 -133
  107. package/index74.js +69 -68
  108. package/index75.js +96 -34
  109. package/index76.js +258 -65
  110. package/index77.js +715 -63
  111. package/index78.js +478 -93
  112. package/index79.js +303 -263
  113. package/index8.js +1 -1
  114. package/index80.js +343 -678
  115. package/index81.js +242 -481
  116. package/index82.js +1329 -282
  117. package/index83.js +968 -350
  118. package/index84.js +343 -211
  119. package/index85.js +2025 -1288
  120. package/index86.js +2313 -954
  121. package/index87.js +6782 -339
  122. package/index88.js +15 -2103
  123. package/index89.js +12 -2369
  124. package/index9.js +1 -1
  125. package/index90.js +4 -6832
  126. package/index91.js +7 -15
  127. package/link/Link.d.ts +2 -2
  128. package/link-button/LinkButton.d.ts +1 -1
  129. package/package.json +7 -1
  130. package/{react.esm-D8HpDGKP.js → react.esm-sMU8Z7rL.js} +1872 -1872
  131. package/textfield/index.d.ts +0 -2
  132. package/useControlledState-Kv9K2AYu.js +30 -0
  133. package/{useDescription-D4_zk_sA.js → useDescription-B7stiK3j.js} +1 -1
  134. package/useEvent-Xk5kn5Ns.js +21 -0
  135. package/useField-DMzJIIN4.js +67 -0
  136. package/{useFilter-BnJDBCkt.js → useFilter-Bt9dbV1U.js} +1 -1
  137. package/useFocusRing-9PXyKy2A.js +1297 -0
  138. package/{useFocusable-C-N9wcwm.js → useFocusable-CcEBZe40.js} +11 -8
  139. package/{useGridSelectionCheckbox-i1rsjlC-.js → useGridSelectionCheckbox-DYgEnElE.js} +3 -3
  140. package/useHasTabbableChild-D6DwR81L.js +34 -0
  141. package/{useHighlightSelectionDescription-JVx2MW_e.js → useHighlightSelectionDescription-WYAbP4No.js} +19 -19
  142. package/useLabels-9zaZ9oa0.js +17 -0
  143. package/useListState-BfTeKTk5.js +119 -0
  144. package/{useLocalizedStringFormatter-DVCAZqcL.js → useLocalizedStringFormatter-BlCbn-hX.js} +29 -29
  145. package/{useSingleSelectListState-CmX9_L5H.js → useSingleSelectListState-DPkaL0la.js} +5 -5
  146. package/Button-CCevm2s3.js +0 -183
  147. package/Checkbox-CllWDBxF.js +0 -405
  148. package/Dialog-CLTyYwkS.js +0 -1889
  149. package/DragAndDrop-OTN7La7U.js +0 -42
  150. package/FocusScope-BR0SJ-cZ.js +0 -512
  151. package/Group-DPMuN3h8.js +0 -44
  152. package/Label-C18A_4Z5.js +0 -69
  153. package/Link-BU1h3K2a.js +0 -77
  154. package/ListBox-D21tdwTs.js +0 -463
  155. package/ListKeyboardDelegate-DxMjfMsI.js +0 -172
  156. package/PressResponder-DP8ZDNGy.js +0 -31
  157. package/SelectionManager-D4WtKtey.js +0 -988
  158. package/Separator-DLUHK9vv.js +0 -48
  159. package/Tag-CEd6WWSc.js +0 -725
  160. package/Text-DGLaY3HR.js +0 -17
  161. package/TextField-C_hq9WeT.js +0 -226
  162. package/TextField.module-Cwq1FAm7.js +0 -141
  163. package/accordion/AccordionContent.d.ts +0 -3
  164. package/accordion/AccordionTagContext.d.ts +0 -3
  165. package/accordion/AccordionTrigger.d.ts +0 -3
  166. package/index-CEg5vZQH.js +0 -132
  167. package/index-CgfokhRq.js +0 -674
  168. package/index.css +0 -1
  169. package/index92.js +0 -14
  170. package/index93.js +0 -6
  171. package/index94.js +0 -9
  172. package/useControlledState-S_TYcV_c.js +0 -45
  173. package/useFocusRing-D97-G3fT.js +0 -1324
  174. package/useHasTabbableChild-DeuCnGGv.js +0 -34
  175. package/useListState-DSOTbsL3.js +0 -119
@@ -1,1324 +0,0 @@
1
- import M, { useContext as Z, useState as x, useRef as E, useCallback as h, useEffect as X, useMemo as ee, createContext as nt } from "react";
2
- import ot from "react-dom";
3
- import { c as at } from "./clsx-OuTLNxxd.js";
4
- const ue = {
5
- prefix: String(Math.round(Math.random() * 1e10)),
6
- current: 0
7
- }, Ae = /* @__PURE__ */ M.createContext(ue), it = /* @__PURE__ */ M.createContext(!1);
8
- let st = !!(typeof window < "u" && window.document && window.document.createElement), $e = /* @__PURE__ */ new WeakMap();
9
- function lt(e = !1) {
10
- let t = Z(Ae), r = E(null);
11
- if (r.current === null && !e) {
12
- var n, a;
13
- let s = (a = M.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || a === void 0 || (n = a.ReactCurrentOwner) === null || n === void 0 ? void 0 : n.current;
14
- if (s) {
15
- let i = $e.get(s);
16
- i == null ? $e.set(s, {
17
- id: t.current,
18
- state: s.memoizedState
19
- }) : s.memoizedState !== i.state && (t.current = i.id, $e.delete(s));
20
- }
21
- r.current = ++t.current;
22
- }
23
- return r.current;
24
- }
25
- function ut(e) {
26
- let t = Z(Ae);
27
- t === ue && !st && console.warn("When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server.");
28
- let r = lt(!!e), n = t === ue && process.env.NODE_ENV === "test" ? "react-aria" : `react-aria${t.prefix}`;
29
- return e || `${n}-${r}`;
30
- }
31
- function ct(e) {
32
- let t = M.useId(), [r] = x(De()), n = r || process.env.NODE_ENV === "test" ? "react-aria" : `react-aria${ue.prefix}`;
33
- return e || `${n}-${t}`;
34
- }
35
- const ft = typeof M.useId == "function" ? ct : ut;
36
- function dt() {
37
- return !1;
38
- }
39
- function pt() {
40
- return !0;
41
- }
42
- function vt(e) {
43
- return () => {
44
- };
45
- }
46
- function De() {
47
- return typeof M.useSyncExternalStore == "function" ? M.useSyncExternalStore(vt, dt, pt) : Z(it);
48
- }
49
- const G = typeof document < "u" ? M.useLayoutEffect : () => {
50
- };
51
- function V(e) {
52
- const t = E(null);
53
- return G(() => {
54
- t.current = e;
55
- }, [
56
- e
57
- ]), h((...r) => {
58
- const n = t.current;
59
- return n == null ? void 0 : n(...r);
60
- }, []);
61
- }
62
- function $t(e) {
63
- let [t, r] = x(e), n = E(null), a = V(() => {
64
- if (!n.current) return;
65
- let i = n.current.next();
66
- if (i.done) {
67
- n.current = null;
68
- return;
69
- }
70
- t === i.value ? a() : r(i.value);
71
- });
72
- G(() => {
73
- n.current && a();
74
- });
75
- let s = V((i) => {
76
- n.current = i(t), a();
77
- });
78
- return [
79
- t,
80
- s
81
- ];
82
- }
83
- let gt = !!(typeof window < "u" && window.document && window.document.createElement), W = /* @__PURE__ */ new Map();
84
- function bt(e) {
85
- let [t, r] = x(e), n = E(null), a = ft(t), s = h((i) => {
86
- n.current = i;
87
- }, []);
88
- return gt && (W.has(a) && !W.get(a).includes(s) ? W.set(a, [
89
- ...W.get(a),
90
- s
91
- ]) : W.set(a, [
92
- s
93
- ])), G(() => {
94
- let i = a;
95
- return () => {
96
- W.delete(i);
97
- };
98
- }, [
99
- a
100
- ]), X(() => {
101
- let i = n.current;
102
- i && (n.current = null, r(i));
103
- }), a;
104
- }
105
- function yt(e, t) {
106
- if (e === t) return e;
107
- let r = W.get(e);
108
- if (r)
109
- return r.forEach((a) => a(t)), t;
110
- let n = W.get(t);
111
- return n ? (n.forEach((a) => a(e)), e) : t;
112
- }
113
- function lr(e = []) {
114
- let t = bt(), [r, n] = $t(t), a = h(() => {
115
- n(function* () {
116
- yield t, yield document.getElementById(t) ? t : void 0;
117
- });
118
- }, [
119
- t,
120
- n
121
- ]);
122
- return G(a, [
123
- t,
124
- a,
125
- ...e
126
- ]), r;
127
- }
128
- function Ne(...e) {
129
- return (...t) => {
130
- for (let r of e) typeof r == "function" && r(...t);
131
- };
132
- }
133
- const T = (e) => {
134
- var t;
135
- return (t = e == null ? void 0 : e.ownerDocument) !== null && t !== void 0 ? t : document;
136
- }, C = (e) => e && "window" in e && e.window === e ? e : T(e).defaultView || window;
137
- function we(...e) {
138
- let t = {
139
- ...e[0]
140
- };
141
- for (let r = 1; r < e.length; r++) {
142
- let n = e[r];
143
- for (let a in n) {
144
- let s = t[a], i = n[a];
145
- typeof s == "function" && typeof i == "function" && // This is a lot faster than a regex.
146
- a[0] === "o" && a[1] === "n" && a.charCodeAt(2) >= /* 'A' */
147
- 65 && a.charCodeAt(2) <= /* 'Z' */
148
- 90 ? t[a] = Ne(s, i) : (a === "className" || a === "UNSAFE_className") && typeof s == "string" && typeof i == "string" ? t[a] = at(s, i) : a === "id" && s && i ? t.id = yt(s, i) : t[a] = i !== void 0 ? i : s;
149
- }
150
- }
151
- return t;
152
- }
153
- function ht(...e) {
154
- return e.length === 1 && e[0] ? e[0] : (t) => {
155
- for (let r of e)
156
- typeof r == "function" ? r(t) : r != null && (r.current = t);
157
- };
158
- }
159
- const mt = /* @__PURE__ */ new Set([
160
- "id"
161
- ]), Tt = /* @__PURE__ */ new Set([
162
- "aria-label",
163
- "aria-labelledby",
164
- "aria-describedby",
165
- "aria-details"
166
- ]), Et = /* @__PURE__ */ new Set([
167
- "href",
168
- "hrefLang",
169
- "target",
170
- "rel",
171
- "download",
172
- "ping",
173
- "referrerPolicy"
174
- ]), Pt = /^(data-.*)$/;
175
- function ur(e, t = {}) {
176
- let { labelable: r, isLink: n, propNames: a } = t, s = {};
177
- for (const i in e) Object.prototype.hasOwnProperty.call(e, i) && (mt.has(i) || r && Tt.has(i) || n && Et.has(i) || a != null && a.has(i) || Pt.test(i)) && (s[i] = e[i]);
178
- return s;
179
- }
180
- function B(e) {
181
- if (wt()) e.focus({
182
- preventScroll: !0
183
- });
184
- else {
185
- let t = xt(e);
186
- e.focus(), St(t);
187
- }
188
- }
189
- let oe = null;
190
- function wt() {
191
- if (oe == null) {
192
- oe = !1;
193
- try {
194
- document.createElement("div").focus({
195
- get preventScroll() {
196
- return oe = !0, !0;
197
- }
198
- });
199
- } catch {
200
- }
201
- }
202
- return oe;
203
- }
204
- function xt(e) {
205
- let t = e.parentNode, r = [], n = document.scrollingElement || document.documentElement;
206
- for (; t instanceof HTMLElement && t !== n; )
207
- (t.offsetHeight < t.scrollHeight || t.offsetWidth < t.scrollWidth) && r.push({
208
- element: t,
209
- scrollTop: t.scrollTop,
210
- scrollLeft: t.scrollLeft
211
- }), t = t.parentNode;
212
- return n instanceof HTMLElement && r.push({
213
- element: n,
214
- scrollTop: n.scrollTop,
215
- scrollLeft: n.scrollLeft
216
- }), r;
217
- }
218
- function St(e) {
219
- for (let { element: t, scrollTop: r, scrollLeft: n } of e)
220
- t.scrollTop = r, t.scrollLeft = n;
221
- }
222
- function pe(e) {
223
- var t;
224
- return typeof window > "u" || window.navigator == null ? !1 : ((t = window.navigator.userAgentData) === null || t === void 0 ? void 0 : t.brands.some((r) => e.test(r.brand))) || e.test(window.navigator.userAgent);
225
- }
226
- function xe(e) {
227
- var t;
228
- 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;
229
- }
230
- function A(e) {
231
- let t = null;
232
- return () => (t == null && (t = e()), t);
233
- }
234
- const Q = A(function() {
235
- return xe(/^Mac/i);
236
- }), Lt = A(function() {
237
- return xe(/^iPhone/i);
238
- }), We = A(function() {
239
- return xe(/^iPad/i) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
240
- Q() && navigator.maxTouchPoints > 1;
241
- }), Se = A(function() {
242
- return Lt() || We();
243
- }), cr = A(function() {
244
- return Q() || Se();
245
- }), Mt = A(function() {
246
- return pe(/AppleWebKit/i) && !Kt();
247
- }), Kt = A(function() {
248
- return pe(/Chrome/i);
249
- }), Ve = A(function() {
250
- return pe(/Android/i);
251
- }), Ct = A(function() {
252
- return pe(/Firefox/i);
253
- }), Ge = /* @__PURE__ */ nt({
254
- isNative: !0,
255
- open: Ft,
256
- useHref: (e) => e
257
- });
258
- function fr(e) {
259
- let { children: t, navigate: r, useHref: n } = e, a = ee(() => ({
260
- isNative: !1,
261
- open: (s, i, f, d) => {
262
- Be(s, (p) => {
263
- kt(p, i) ? r(f, d) : j(p, i);
264
- });
265
- },
266
- useHref: n || ((s) => s)
267
- }), [
268
- r,
269
- n
270
- ]);
271
- return /* @__PURE__ */ M.createElement(Ge.Provider, {
272
- value: a
273
- }, t);
274
- }
275
- function Ue() {
276
- return Z(Ge);
277
- }
278
- function kt(e, t) {
279
- let r = e.getAttribute("target");
280
- return (!r || r === "_self") && e.origin === location.origin && !e.hasAttribute("download") && !t.metaKey && // open in new tab (mac)
281
- !t.ctrlKey && // open in new tab (windows)
282
- !t.altKey && // download
283
- !t.shiftKey;
284
- }
285
- function j(e, t, r = !0) {
286
- var n, a;
287
- let { metaKey: s, ctrlKey: i, altKey: f, shiftKey: d } = t;
288
- Ct() && (!((a = window.event) === null || a === void 0 || (n = a.type) === null || n === void 0) && n.startsWith("key")) && e.target === "_blank" && (Q() ? s = !0 : i = !0);
289
- let p = Mt() && Q() && !We() ? new KeyboardEvent("keydown", {
290
- keyIdentifier: "Enter",
291
- metaKey: s,
292
- ctrlKey: i,
293
- altKey: f,
294
- shiftKey: d
295
- }) : new MouseEvent("click", {
296
- metaKey: s,
297
- ctrlKey: i,
298
- altKey: f,
299
- shiftKey: d,
300
- bubbles: !0,
301
- cancelable: !0
302
- });
303
- j.isOpening = r, B(e), e.dispatchEvent(p), j.isOpening = !1;
304
- }
305
- j.isOpening = !1;
306
- function Be(e, t) {
307
- if (e instanceof HTMLAnchorElement) t(e);
308
- else if (e.hasAttribute("data-href")) {
309
- let r = document.createElement("a");
310
- r.href = e.getAttribute("data-href"), e.hasAttribute("data-target") && (r.target = e.getAttribute("data-target")), e.hasAttribute("data-rel") && (r.rel = e.getAttribute("data-rel")), e.hasAttribute("data-download") && (r.download = e.getAttribute("data-download")), e.hasAttribute("data-ping") && (r.ping = e.getAttribute("data-ping")), e.hasAttribute("data-referrer-policy") && (r.referrerPolicy = e.getAttribute("data-referrer-policy")), e.appendChild(r), t(r), e.removeChild(r);
311
- }
312
- }
313
- function Ft(e, t) {
314
- Be(e, (r) => j(r, t));
315
- }
316
- function dr(e) {
317
- let t = Ue();
318
- var r;
319
- const n = t.useHref((r = e.href) !== null && r !== void 0 ? r : "");
320
- return {
321
- "data-href": e.href ? n : void 0,
322
- "data-target": e.target,
323
- "data-rel": e.rel,
324
- "data-download": e.download,
325
- "data-ping": e.ping,
326
- "data-referrer-policy": e.referrerPolicy
327
- };
328
- }
329
- function pr(e) {
330
- let t = Ue();
331
- var r;
332
- const n = t.useHref((r = e == null ? void 0 : e.href) !== null && r !== void 0 ? r : "");
333
- return {
334
- href: e != null && e.href ? n : void 0,
335
- target: e == null ? void 0 : e.target,
336
- rel: e == null ? void 0 : e.rel,
337
- download: e == null ? void 0 : e.download,
338
- ping: e == null ? void 0 : e.ping,
339
- referrerPolicy: e == null ? void 0 : e.referrerPolicy
340
- };
341
- }
342
- let R = /* @__PURE__ */ new Map(), he = /* @__PURE__ */ new Set();
343
- function Me() {
344
- if (typeof window > "u") return;
345
- function e(n) {
346
- return "propertyName" in n;
347
- }
348
- let t = (n) => {
349
- if (!e(n) || !n.target) return;
350
- let a = R.get(n.target);
351
- a || (a = /* @__PURE__ */ new Set(), R.set(n.target, a), n.target.addEventListener("transitioncancel", r, {
352
- once: !0
353
- })), a.add(n.propertyName);
354
- }, r = (n) => {
355
- if (!e(n) || !n.target) return;
356
- let a = R.get(n.target);
357
- if (a && (a.delete(n.propertyName), a.size === 0 && (n.target.removeEventListener("transitioncancel", r), R.delete(n.target)), R.size === 0)) {
358
- for (let s of he) s();
359
- he.clear();
360
- }
361
- };
362
- document.body.addEventListener("transitionrun", t), document.body.addEventListener("transitionend", r);
363
- }
364
- typeof document < "u" && (document.readyState !== "loading" ? Me() : document.addEventListener("DOMContentLoaded", Me));
365
- function Xe(e) {
366
- requestAnimationFrame(() => {
367
- R.size === 0 ? e() : he.add(e);
368
- });
369
- }
370
- function Ht() {
371
- let e = E(/* @__PURE__ */ new Map()), t = h((a, s, i, f) => {
372
- let d = f != null && f.once ? (...p) => {
373
- e.current.delete(i), i(...p);
374
- } : i;
375
- e.current.set(i, {
376
- type: s,
377
- eventTarget: a,
378
- fn: d,
379
- options: f
380
- }), a.addEventListener(s, i, f);
381
- }, []), r = h((a, s, i, f) => {
382
- var d;
383
- let p = ((d = e.current.get(i)) === null || d === void 0 ? void 0 : d.fn) || i;
384
- a.removeEventListener(s, p, f), e.current.delete(i);
385
- }, []), n = h(() => {
386
- e.current.forEach((a, s) => {
387
- r(a.eventTarget, a.type, s, a.options);
388
- });
389
- }, [
390
- r
391
- ]);
392
- return X(() => n, [
393
- n
394
- ]), {
395
- addGlobalListener: t,
396
- removeGlobalListener: r,
397
- removeAllGlobalListeners: n
398
- };
399
- }
400
- function It(e) {
401
- const t = E(null);
402
- return ee(() => ({
403
- get current() {
404
- return t.current;
405
- },
406
- set current(r) {
407
- t.current = r, typeof e == "function" ? e(r) : e && (e.current = r);
408
- }
409
- }), [
410
- e
411
- ]);
412
- }
413
- function Ot(e, t) {
414
- G(() => {
415
- if (e && e.ref && t)
416
- return e.ref.current = t.current, () => {
417
- e.ref && (e.ref.current = null);
418
- };
419
- });
420
- }
421
- function me(e) {
422
- return e.mozInputSource === 0 && e.isTrusted ? !0 : Ve() && e.pointerType ? e.type === "click" && e.buttons === 1 : e.detail === 0 && !e.pointerType;
423
- }
424
- function At(e) {
425
- return !Ve() && e.width === 0 && e.height === 0 || e.width === 1 && e.height === 1 && e.pressure === 0 && e.detail === 0 && e.pointerType === "mouse";
426
- }
427
- const Ke = Symbol("default");
428
- function vr({ values: e, children: t }) {
429
- for (let [r, n] of e)
430
- t = /* @__PURE__ */ M.createElement(r.Provider, {
431
- value: n
432
- }, t);
433
- return t;
434
- }
435
- function $r(e) {
436
- let { className: t, style: r, children: n, defaultClassName: a, defaultChildren: s, defaultStyle: i, values: f } = e;
437
- return ee(() => {
438
- let d, p, $;
439
- return typeof t == "function" ? d = t({
440
- ...f,
441
- defaultClassName: a
442
- }) : d = t, typeof r == "function" ? p = r({
443
- ...f,
444
- defaultStyle: i || {}
445
- }) : p = r, typeof n == "function" ? $ = n({
446
- ...f,
447
- defaultChildren: s
448
- }) : n == null ? $ = s : $ = n, {
449
- className: d ?? a,
450
- style: p || i ? {
451
- ...i,
452
- ...p
453
- } : void 0,
454
- children: $ ?? s,
455
- "data-rac": ""
456
- };
457
- }, [
458
- t,
459
- r,
460
- n,
461
- a,
462
- s,
463
- i,
464
- f
465
- ]);
466
- }
467
- function Dt(e, t) {
468
- let r = Z(e);
469
- if (t === null)
470
- return null;
471
- if (r && typeof r == "object" && "slots" in r && r.slots) {
472
- let n = new Intl.ListFormat().format(Object.keys(r.slots).map((s) => `"${s}"`));
473
- if (!t && !r.slots[Ke]) throw new Error(`A slot prop is required. Valid slot names are ${n}.`);
474
- let a = t || Ke;
475
- if (!r.slots[a])
476
- throw new Error(`Invalid slot "${t}". Valid slot names are ${n}.`);
477
- return r.slots[a];
478
- }
479
- return r;
480
- }
481
- function gr(e, t, r) {
482
- let n = Dt(r, e.slot) || {}, { ref: a, ...s } = n, i = It(ee(() => ht(t, a), [
483
- t,
484
- a
485
- ])), f = we(s, e);
486
- return "style" in s && s.style && "style" in e && e.style && (typeof s.style == "function" || typeof e.style == "function" ? f.style = (d) => {
487
- let p = typeof s.style == "function" ? s.style(d) : s.style, $ = {
488
- ...d.defaultStyle,
489
- ...p
490
- }, P = typeof e.style == "function" ? e.style({
491
- ...d,
492
- defaultStyle: $
493
- }) : e.style;
494
- return {
495
- ...$,
496
- ...P
497
- };
498
- } : f.style = {
499
- ...s.style,
500
- ...e.style
501
- }), [
502
- f,
503
- i
504
- ];
505
- }
506
- function br() {
507
- let [e, t] = x(!0), r = E(!1), n = h((a) => {
508
- r.current = !0, t(!!a);
509
- }, []);
510
- return G(() => {
511
- r.current || t(!1);
512
- }, []), [
513
- n,
514
- e
515
- ];
516
- }
517
- function yr(e, t = !0) {
518
- let [r, n] = x(!0);
519
- return je(e, r && t, h(() => n(!1), [])), r && t;
520
- }
521
- function hr(e, t) {
522
- let [r, n] = x(!1), [a, s] = x("idle");
523
- return !t && e.current && a === "idle" && (r = !0, n(!0), s("exiting")), !e.current && a === "exited" && s("idle"), je(e, r, h(() => {
524
- s("exited"), n(!1);
525
- }, [])), r;
526
- }
527
- function je(e, t, r) {
528
- let n = E(null);
529
- t && e.current && (n.current = window.getComputedStyle(e.current).animation), G(() => {
530
- if (t && e.current) {
531
- let a = window.getComputedStyle(e.current);
532
- if (a.animationName && a.animationName !== "none" && a.animation !== n.current) {
533
- let s = (f) => {
534
- f.target === e.current && (i.removeEventListener("animationend", s), ot.flushSync(() => {
535
- r();
536
- }));
537
- }, i = e.current;
538
- return i.addEventListener("animationend", s), () => {
539
- i.removeEventListener("animationend", s);
540
- };
541
- } else r();
542
- }
543
- }, [
544
- e,
545
- t,
546
- r
547
- ]);
548
- }
549
- function mr(e) {
550
- const t = /^(data-.*)$/;
551
- let r = {};
552
- for (const n in e) t.test(n) || (r[n] = e[n]);
553
- return r;
554
- }
555
- let J = "default", Te = "", le = /* @__PURE__ */ new WeakMap();
556
- function Ce(e) {
557
- if (Se()) {
558
- if (J === "default") {
559
- const t = T(e);
560
- Te = t.documentElement.style.webkitUserSelect, t.documentElement.style.webkitUserSelect = "none";
561
- }
562
- J = "disabled";
563
- } else (e instanceof HTMLElement || e instanceof SVGElement) && (le.set(e, e.style.userSelect), e.style.userSelect = "none");
564
- }
565
- function ae(e) {
566
- if (Se()) {
567
- if (J !== "disabled") return;
568
- J = "restoring", setTimeout(() => {
569
- Xe(() => {
570
- if (J === "restoring") {
571
- const t = T(e);
572
- t.documentElement.style.webkitUserSelect === "none" && (t.documentElement.style.webkitUserSelect = Te || ""), Te = "", J = "default";
573
- }
574
- });
575
- }, 300);
576
- } else if ((e instanceof HTMLElement || e instanceof SVGElement) && e && le.has(e)) {
577
- let t = le.get(e);
578
- e.style.userSelect === "none" && (e.style.userSelect = t), e.getAttribute("style") === "" && e.removeAttribute("style"), le.delete(e);
579
- }
580
- }
581
- const Ye = M.createContext({
582
- register: () => {
583
- }
584
- });
585
- Ye.displayName = "PressResponderContext";
586
- function Nt(e, t) {
587
- return t.get ? t.get.call(e) : t.value;
588
- }
589
- function ze(e, t, r) {
590
- if (!t.has(e)) throw new TypeError("attempted to " + r + " private field on non-instance");
591
- return t.get(e);
592
- }
593
- function Wt(e, t) {
594
- var r = ze(e, t, "get");
595
- return Nt(e, r);
596
- }
597
- function Vt(e, t) {
598
- if (t.has(e))
599
- throw new TypeError("Cannot initialize the same private elements twice on an object");
600
- }
601
- function Gt(e, t, r) {
602
- Vt(e, t), t.set(e, r);
603
- }
604
- function Ut(e, t, r) {
605
- if (t.set) t.set.call(e, r);
606
- else {
607
- if (!t.writable)
608
- throw new TypeError("attempted to set read only private field");
609
- t.value = r;
610
- }
611
- }
612
- function ke(e, t, r) {
613
- var n = ze(e, t, "set");
614
- return Ut(e, n, r), r;
615
- }
616
- function Bt(e) {
617
- let t = Z(Ye);
618
- if (t) {
619
- let { register: r, ...n } = t;
620
- e = we(n, e), r();
621
- }
622
- return Ot(t, e.ref), e;
623
- }
624
- var ie = /* @__PURE__ */ new WeakMap();
625
- class se {
626
- continuePropagation() {
627
- ke(this, ie, !1);
628
- }
629
- get shouldStopPropagation() {
630
- return Wt(this, ie);
631
- }
632
- constructor(t, r, n, a) {
633
- Gt(this, ie, {
634
- writable: !0,
635
- value: void 0
636
- }), ke(this, ie, !0);
637
- var s;
638
- let i = (s = a == null ? void 0 : a.target) !== null && s !== void 0 ? s : n.currentTarget;
639
- const f = i == null ? void 0 : i.getBoundingClientRect();
640
- let d, p = 0, $, P = null;
641
- n.clientX != null && n.clientY != null && ($ = n.clientX, P = n.clientY), f && ($ != null && P != null ? (d = $ - f.left, p = P - f.top) : (d = f.width / 2, p = f.height / 2)), this.type = t, this.pointerType = r, this.target = n.currentTarget, this.shiftKey = n.shiftKey, this.metaKey = n.metaKey, this.ctrlKey = n.ctrlKey, this.altKey = n.altKey, this.x = d, this.y = p;
642
- }
643
- }
644
- const Fe = Symbol("linkClicked");
645
- function Tr(e) {
646
- let {
647
- onPress: t,
648
- onPressChange: r,
649
- onPressStart: n,
650
- onPressEnd: a,
651
- onPressUp: s,
652
- isDisabled: i,
653
- isPressed: f,
654
- preventFocusOnPress: d,
655
- shouldCancelOnPointerExit: p,
656
- allowTextSelectionOnPress: $,
657
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
658
- ref: P,
659
- ...K
660
- } = Bt(e), [g, k] = x(!1), S = E({
661
- isPressed: !1,
662
- ignoreEmulatedMouseEvents: !1,
663
- ignoreClickAfterPress: !1,
664
- didFirePressStart: !1,
665
- isTriggeringEvent: !1,
666
- activePointerId: null,
667
- target: null,
668
- isOverTarget: !1,
669
- pointerType: null
670
- }), { addGlobalListener: D, removeAllGlobalListeners: z } = Ht(), F = V((o, v) => {
671
- let L = S.current;
672
- if (i || L.didFirePressStart) return !1;
673
- let c = !0;
674
- if (L.isTriggeringEvent = !0, n) {
675
- let y = new se("pressstart", v, o);
676
- n(y), c = y.shouldStopPropagation;
677
- }
678
- return r && r(!0), L.isTriggeringEvent = !1, L.didFirePressStart = !0, k(!0), c;
679
- }), m = V((o, v, L = !0) => {
680
- let c = S.current;
681
- if (!c.didFirePressStart) return !1;
682
- c.ignoreClickAfterPress = !0, c.didFirePressStart = !1, c.isTriggeringEvent = !0;
683
- let y = !0;
684
- if (a) {
685
- let l = new se("pressend", v, o);
686
- a(l), y = l.shouldStopPropagation;
687
- }
688
- if (r && r(!1), k(!1), t && L && !i) {
689
- let l = new se("press", v, o);
690
- t(l), y && (y = l.shouldStopPropagation);
691
- }
692
- return c.isTriggeringEvent = !1, y;
693
- }), _ = V((o, v) => {
694
- let L = S.current;
695
- if (i) return !1;
696
- if (s) {
697
- L.isTriggeringEvent = !0;
698
- let c = new se("pressup", v, o);
699
- return s(c), L.isTriggeringEvent = !1, c.shouldStopPropagation;
700
- }
701
- return !0;
702
- }), U = V((o) => {
703
- let v = S.current;
704
- v.isPressed && v.target && (v.isOverTarget && v.pointerType != null && m(I(v.target, o), v.pointerType, !1), v.isPressed = !1, v.isOverTarget = !1, v.activePointerId = null, v.pointerType = null, z(), $ || ae(v.target));
705
- }), ne = V((o) => {
706
- p && U(o);
707
- }), rt = ee(() => {
708
- let o = S.current, v = {
709
- onKeyDown(c) {
710
- if (ge(c.nativeEvent, c.currentTarget) && c.currentTarget.contains(c.target)) {
711
- var y;
712
- Ie(c.target, c.key) && c.preventDefault();
713
- let l = !0;
714
- if (!o.isPressed && !c.repeat) {
715
- o.target = c.currentTarget, o.isPressed = !0, l = F(c, "keyboard");
716
- let b = c.currentTarget, u = (H) => {
717
- ge(H, b) && !H.repeat && b.contains(H.target) && o.target && _(I(o.target, H), "keyboard");
718
- };
719
- D(T(c.currentTarget), "keyup", Ne(u, L), !0);
720
- }
721
- l && c.stopPropagation(), c.metaKey && Q() && ((y = o.metaKeyEvents) === null || y === void 0 || y.set(c.key, c.nativeEvent));
722
- } else c.key === "Meta" && (o.metaKeyEvents = /* @__PURE__ */ new Map());
723
- },
724
- onClick(c) {
725
- if (!(c && !c.currentTarget.contains(c.target)) && c && c.button === 0 && !o.isTriggeringEvent && !j.isOpening) {
726
- let y = !0;
727
- if (i && c.preventDefault(), !o.ignoreClickAfterPress && !o.ignoreEmulatedMouseEvents && !o.isPressed && (o.pointerType === "virtual" || me(c.nativeEvent))) {
728
- !i && !d && B(c.currentTarget);
729
- let l = F(c, "virtual"), b = _(c, "virtual"), u = m(c, "virtual");
730
- y = l && b && u;
731
- }
732
- o.ignoreEmulatedMouseEvents = !1, o.ignoreClickAfterPress = !1, y && c.stopPropagation();
733
- }
734
- }
735
- }, L = (c) => {
736
- var y;
737
- if (o.isPressed && o.target && ge(c, o.target)) {
738
- var l;
739
- Ie(c.target, c.key) && c.preventDefault();
740
- let u = c.target;
741
- m(I(o.target, c), "keyboard", o.target.contains(u)), z(), c.key !== "Enter" && Le(o.target) && o.target.contains(u) && !c[Fe] && (c[Fe] = !0, j(o.target, c, !1)), o.isPressed = !1, (l = o.metaKeyEvents) === null || l === void 0 || l.delete(c.key);
742
- } else if (c.key === "Meta" && (!((y = o.metaKeyEvents) === null || y === void 0) && y.size)) {
743
- var b;
744
- let u = o.metaKeyEvents;
745
- o.metaKeyEvents = void 0;
746
- for (let H of u.values()) (b = o.target) === null || b === void 0 || b.dispatchEvent(new KeyboardEvent("keyup", H));
747
- }
748
- };
749
- if (typeof PointerEvent < "u") {
750
- v.onPointerDown = (u) => {
751
- if (u.button !== 0 || !u.currentTarget.contains(u.target)) return;
752
- if (At(u.nativeEvent)) {
753
- o.pointerType = "virtual";
754
- return;
755
- }
756
- be(u.currentTarget) && u.preventDefault(), o.pointerType = u.pointerType;
757
- let H = !0;
758
- o.isPressed || (o.isPressed = !0, o.isOverTarget = !0, o.activePointerId = u.pointerId, o.target = u.currentTarget, !i && !d && B(u.currentTarget), $ || Ce(o.target), H = F(u, o.pointerType), D(T(u.currentTarget), "pointermove", c, !1), D(T(u.currentTarget), "pointerup", y, !1), D(T(u.currentTarget), "pointercancel", b, !1)), H && u.stopPropagation();
759
- }, v.onMouseDown = (u) => {
760
- u.currentTarget.contains(u.target) && u.button === 0 && (be(u.currentTarget) && u.preventDefault(), u.stopPropagation());
761
- }, v.onPointerUp = (u) => {
762
- !u.currentTarget.contains(u.target) || o.pointerType === "virtual" || u.button === 0 && q(u, u.currentTarget) && _(u, o.pointerType || u.pointerType);
763
- };
764
- let c = (u) => {
765
- u.pointerId === o.activePointerId && (o.target && q(u, o.target) ? !o.isOverTarget && o.pointerType != null && (o.isOverTarget = !0, F(I(o.target, u), o.pointerType)) : o.target && o.isOverTarget && o.pointerType != null && (o.isOverTarget = !1, m(I(o.target, u), o.pointerType, !1), ne(u)));
766
- }, y = (u) => {
767
- u.pointerId === o.activePointerId && o.isPressed && u.button === 0 && o.target && (q(u, o.target) && o.pointerType != null ? m(I(o.target, u), o.pointerType) : o.isOverTarget && o.pointerType != null && m(I(o.target, u), o.pointerType, !1), o.isPressed = !1, o.isOverTarget = !1, o.activePointerId = null, o.pointerType = null, z(), $ || ae(o.target), "ontouchend" in o.target && u.pointerType !== "mouse" && D(o.target, "touchend", l, {
768
- once: !0
769
- }));
770
- }, l = (u) => {
771
- _e(u.currentTarget) && u.preventDefault();
772
- }, b = (u) => {
773
- U(u);
774
- };
775
- v.onDragStart = (u) => {
776
- u.currentTarget.contains(u.target) && U(u);
777
- };
778
- } else {
779
- v.onMouseDown = (l) => {
780
- if (l.button !== 0 || !l.currentTarget.contains(l.target)) return;
781
- if (be(l.currentTarget) && l.preventDefault(), o.ignoreEmulatedMouseEvents) {
782
- l.stopPropagation();
783
- return;
784
- }
785
- o.isPressed = !0, o.isOverTarget = !0, o.target = l.currentTarget, o.pointerType = me(l.nativeEvent) ? "virtual" : "mouse", !i && !d && B(l.currentTarget), F(l, o.pointerType) && l.stopPropagation(), D(T(l.currentTarget), "mouseup", c, !1);
786
- }, v.onMouseEnter = (l) => {
787
- if (!l.currentTarget.contains(l.target)) return;
788
- let b = !0;
789
- o.isPressed && !o.ignoreEmulatedMouseEvents && o.pointerType != null && (o.isOverTarget = !0, b = F(l, o.pointerType)), b && l.stopPropagation();
790
- }, v.onMouseLeave = (l) => {
791
- if (!l.currentTarget.contains(l.target)) return;
792
- let b = !0;
793
- o.isPressed && !o.ignoreEmulatedMouseEvents && o.pointerType != null && (o.isOverTarget = !1, b = m(l, o.pointerType, !1), ne(l)), b && l.stopPropagation();
794
- }, v.onMouseUp = (l) => {
795
- l.currentTarget.contains(l.target) && !o.ignoreEmulatedMouseEvents && l.button === 0 && _(l, o.pointerType || "mouse");
796
- };
797
- let c = (l) => {
798
- if (l.button === 0) {
799
- if (o.isPressed = !1, z(), o.ignoreEmulatedMouseEvents) {
800
- o.ignoreEmulatedMouseEvents = !1;
801
- return;
802
- }
803
- o.target && q(l, o.target) && o.pointerType != null ? m(I(o.target, l), o.pointerType) : o.target && o.isOverTarget && o.pointerType != null && m(I(o.target, l), o.pointerType, !1), o.isOverTarget = !1;
804
- }
805
- };
806
- v.onTouchStart = (l) => {
807
- if (!l.currentTarget.contains(l.target)) return;
808
- let b = Xt(l.nativeEvent);
809
- if (!b) return;
810
- o.activePointerId = b.identifier, o.ignoreEmulatedMouseEvents = !0, o.isOverTarget = !0, o.isPressed = !0, o.target = l.currentTarget, o.pointerType = "touch", !i && !d && B(l.currentTarget), $ || Ce(o.target), F(N(o.target, l), o.pointerType) && l.stopPropagation(), D(C(l.currentTarget), "scroll", y, !0);
811
- }, v.onTouchMove = (l) => {
812
- if (!l.currentTarget.contains(l.target)) return;
813
- if (!o.isPressed) {
814
- l.stopPropagation();
815
- return;
816
- }
817
- let b = He(l.nativeEvent, o.activePointerId), u = !0;
818
- b && q(b, l.currentTarget) ? !o.isOverTarget && o.pointerType != null && (o.isOverTarget = !0, u = F(N(o.target, l), o.pointerType)) : o.isOverTarget && o.pointerType != null && (o.isOverTarget = !1, u = m(N(o.target, l), o.pointerType, !1), ne(N(o.target, l))), u && l.stopPropagation();
819
- }, v.onTouchEnd = (l) => {
820
- if (!l.currentTarget.contains(l.target)) return;
821
- if (!o.isPressed) {
822
- l.stopPropagation();
823
- return;
824
- }
825
- let b = He(l.nativeEvent, o.activePointerId), u = !0;
826
- b && q(b, l.currentTarget) && o.pointerType != null ? (_(N(o.target, l), o.pointerType), u = m(N(o.target, l), o.pointerType)) : o.isOverTarget && o.pointerType != null && (u = m(N(o.target, l), o.pointerType, !1)), u && l.stopPropagation(), o.isPressed = !1, o.activePointerId = null, o.isOverTarget = !1, o.ignoreEmulatedMouseEvents = !0, o.target && !$ && ae(o.target), z();
827
- }, v.onTouchCancel = (l) => {
828
- l.currentTarget.contains(l.target) && (l.stopPropagation(), o.isPressed && U(N(o.target, l)));
829
- };
830
- let y = (l) => {
831
- o.isPressed && l.target.contains(o.target) && U({
832
- currentTarget: o.target,
833
- shiftKey: !1,
834
- ctrlKey: !1,
835
- metaKey: !1,
836
- altKey: !1
837
- });
838
- };
839
- v.onDragStart = (l) => {
840
- l.currentTarget.contains(l.target) && U(l);
841
- };
842
- }
843
- return v;
844
- }, [
845
- D,
846
- i,
847
- d,
848
- z,
849
- $,
850
- U,
851
- ne,
852
- m,
853
- F,
854
- _
855
- ]);
856
- return X(() => () => {
857
- var o;
858
- $ || ae((o = S.current.target) !== null && o !== void 0 ? o : void 0);
859
- }, [
860
- $
861
- ]), {
862
- isPressed: f || g,
863
- pressProps: we(K, rt)
864
- };
865
- }
866
- function Le(e) {
867
- return e.tagName === "A" && e.hasAttribute("href");
868
- }
869
- function ge(e, t) {
870
- const { key: r, code: n } = e, a = t, s = a.getAttribute("role");
871
- return (r === "Enter" || r === " " || r === "Spacebar" || n === "Space") && !(a instanceof C(a).HTMLInputElement && !qe(a, r) || a instanceof C(a).HTMLTextAreaElement || a.isContentEditable) && // Links should only trigger with Enter key
872
- !((s === "link" || !s && Le(a)) && r !== "Enter");
873
- }
874
- function Xt(e) {
875
- const { targetTouches: t } = e;
876
- return t.length > 0 ? t[0] : null;
877
- }
878
- function He(e, t) {
879
- const r = e.changedTouches;
880
- for (let n = 0; n < r.length; n++) {
881
- const a = r[n];
882
- if (a.identifier === t) return a;
883
- }
884
- return null;
885
- }
886
- function N(e, t) {
887
- let r = 0, n = 0;
888
- return t.targetTouches && t.targetTouches.length === 1 && (r = t.targetTouches[0].clientX, n = t.targetTouches[0].clientY), {
889
- currentTarget: e,
890
- shiftKey: t.shiftKey,
891
- ctrlKey: t.ctrlKey,
892
- metaKey: t.metaKey,
893
- altKey: t.altKey,
894
- clientX: r,
895
- clientY: n
896
- };
897
- }
898
- function I(e, t) {
899
- let r = t.clientX, n = t.clientY;
900
- return {
901
- currentTarget: e,
902
- shiftKey: t.shiftKey,
903
- ctrlKey: t.ctrlKey,
904
- metaKey: t.metaKey,
905
- altKey: t.altKey,
906
- clientX: r,
907
- clientY: n
908
- };
909
- }
910
- function jt(e) {
911
- let t = 0, r = 0;
912
- return e.width !== void 0 ? t = e.width / 2 : e.radiusX !== void 0 && (t = e.radiusX), e.height !== void 0 ? r = e.height / 2 : e.radiusY !== void 0 && (r = e.radiusY), {
913
- top: e.clientY - r,
914
- right: e.clientX + t,
915
- bottom: e.clientY + r,
916
- left: e.clientX - t
917
- };
918
- }
919
- function Yt(e, t) {
920
- return !(e.left > t.right || t.left > e.right || e.top > t.bottom || t.top > e.bottom);
921
- }
922
- function q(e, t) {
923
- let r = t.getBoundingClientRect(), n = jt(e);
924
- return Yt(r, n);
925
- }
926
- function be(e) {
927
- return !(e instanceof HTMLElement) || !e.hasAttribute("draggable");
928
- }
929
- function _e(e) {
930
- return e instanceof HTMLInputElement ? !1 : e instanceof HTMLButtonElement ? e.type !== "submit" && e.type !== "reset" : !Le(e);
931
- }
932
- function Ie(e, t) {
933
- return e instanceof HTMLInputElement ? !qe(e, t) : _e(e);
934
- }
935
- const zt = /* @__PURE__ */ new Set([
936
- "checkbox",
937
- "radio",
938
- "range",
939
- "color",
940
- "file",
941
- "image",
942
- "button",
943
- "submit",
944
- "reset"
945
- ]);
946
- function qe(e, t) {
947
- return e.type === "checkbox" || e.type === "radio" ? t === " " : zt.has(e.type);
948
- }
949
- class _t {
950
- isDefaultPrevented() {
951
- return this.nativeEvent.defaultPrevented;
952
- }
953
- preventDefault() {
954
- this.defaultPrevented = !0, this.nativeEvent.preventDefault();
955
- }
956
- stopPropagation() {
957
- this.nativeEvent.stopPropagation(), this.isPropagationStopped = () => !0;
958
- }
959
- isPropagationStopped() {
960
- return !1;
961
- }
962
- persist() {
963
- }
964
- constructor(t, r) {
965
- this.nativeEvent = r, this.target = r.target, this.currentTarget = r.currentTarget, this.relatedTarget = r.relatedTarget, this.bubbles = r.bubbles, this.cancelable = r.cancelable, this.defaultPrevented = r.defaultPrevented, this.eventPhase = r.eventPhase, this.isTrusted = r.isTrusted, this.timeStamp = r.timeStamp, this.type = t;
966
- }
967
- }
968
- function Re(e) {
969
- let t = E({
970
- isFocused: !1,
971
- observer: null
972
- });
973
- G(() => {
974
- const n = t.current;
975
- return () => {
976
- n.observer && (n.observer.disconnect(), n.observer = null);
977
- };
978
- }, []);
979
- let r = V((n) => {
980
- e == null || e(n);
981
- });
982
- return h((n) => {
983
- if (n.target instanceof HTMLButtonElement || n.target instanceof HTMLInputElement || n.target instanceof HTMLTextAreaElement || n.target instanceof HTMLSelectElement) {
984
- t.current.isFocused = !0;
985
- let a = n.target, s = (i) => {
986
- t.current.isFocused = !1, a.disabled && r(new _t("blur", i)), t.current.observer && (t.current.observer.disconnect(), t.current.observer = null);
987
- };
988
- a.addEventListener("focusout", s, {
989
- once: !0
990
- }), t.current.observer = new MutationObserver(() => {
991
- if (t.current.isFocused && a.disabled) {
992
- var i;
993
- (i = t.current.observer) === null || i === void 0 || i.disconnect();
994
- let f = a === document.activeElement ? null : document.activeElement;
995
- a.dispatchEvent(new FocusEvent("blur", {
996
- relatedTarget: f
997
- })), a.dispatchEvent(new FocusEvent("focusout", {
998
- bubbles: !0,
999
- relatedTarget: f
1000
- }));
1001
- }
1002
- }), t.current.observer.observe(a, {
1003
- attributes: !0,
1004
- attributeFilter: [
1005
- "disabled"
1006
- ]
1007
- });
1008
- }
1009
- }, [
1010
- r
1011
- ]);
1012
- }
1013
- function qt(e) {
1014
- let { isDisabled: t, onFocus: r, onBlur: n, onFocusChange: a } = e;
1015
- const s = h((d) => {
1016
- if (d.target === d.currentTarget)
1017
- return n && n(d), a && a(!1), !0;
1018
- }, [
1019
- n,
1020
- a
1021
- ]), i = Re(s), f = h((d) => {
1022
- const p = T(d.target);
1023
- d.target === d.currentTarget && p.activeElement === d.target && (r && r(d), a && a(!0), i(d));
1024
- }, [
1025
- a,
1026
- r,
1027
- i
1028
- ]);
1029
- return {
1030
- focusProps: {
1031
- onFocus: !t && (r || a || n) ? f : void 0,
1032
- onBlur: !t && (n || a) ? s : void 0
1033
- }
1034
- };
1035
- }
1036
- let O = null, re = /* @__PURE__ */ new Set(), te = /* @__PURE__ */ new Map(), Y = !1, Ee = !1;
1037
- const Rt = {
1038
- Tab: !0,
1039
- Escape: !0
1040
- };
1041
- function ve(e, t) {
1042
- for (let r of re) r(e, t);
1043
- }
1044
- function Jt(e) {
1045
- return !(e.metaKey || !Q() && e.altKey || e.ctrlKey || e.key === "Control" || e.key === "Shift" || e.key === "Meta");
1046
- }
1047
- function ce(e) {
1048
- Y = !0, Jt(e) && (O = "keyboard", ve("keyboard", e));
1049
- }
1050
- function w(e) {
1051
- O = "pointer", (e.type === "mousedown" || e.type === "pointerdown") && (Y = !0, ve("pointer", e));
1052
- }
1053
- function Je(e) {
1054
- me(e) && (Y = !0, O = "virtual");
1055
- }
1056
- function Qe(e) {
1057
- e.target === window || e.target === document || (!Y && !Ee && (O = "virtual", ve("virtual", e)), Y = !1, Ee = !1);
1058
- }
1059
- function Ze() {
1060
- Y = !1, Ee = !0;
1061
- }
1062
- function fe(e) {
1063
- if (typeof window > "u" || te.get(C(e))) return;
1064
- const t = C(e), r = T(e);
1065
- let n = t.HTMLElement.prototype.focus;
1066
- t.HTMLElement.prototype.focus = function() {
1067
- Y = !0, n.apply(this, arguments);
1068
- }, r.addEventListener("keydown", ce, !0), r.addEventListener("keyup", ce, !0), r.addEventListener("click", Je, !0), t.addEventListener("focus", Qe, !0), t.addEventListener("blur", Ze, !1), typeof PointerEvent < "u" ? (r.addEventListener("pointerdown", w, !0), r.addEventListener("pointermove", w, !0), r.addEventListener("pointerup", w, !0)) : (r.addEventListener("mousedown", w, !0), r.addEventListener("mousemove", w, !0), r.addEventListener("mouseup", w, !0)), t.addEventListener("beforeunload", () => {
1069
- et(e);
1070
- }, {
1071
- once: !0
1072
- }), te.set(t, {
1073
- focus: n
1074
- });
1075
- }
1076
- const et = (e, t) => {
1077
- const r = C(e), n = T(e);
1078
- t && n.removeEventListener("DOMContentLoaded", t), te.has(r) && (r.HTMLElement.prototype.focus = te.get(r).focus, n.removeEventListener("keydown", ce, !0), n.removeEventListener("keyup", ce, !0), n.removeEventListener("click", Je, !0), r.removeEventListener("focus", Qe, !0), r.removeEventListener("blur", Ze, !1), typeof PointerEvent < "u" ? (n.removeEventListener("pointerdown", w, !0), n.removeEventListener("pointermove", w, !0), n.removeEventListener("pointerup", w, !0)) : (n.removeEventListener("mousedown", w, !0), n.removeEventListener("mousemove", w, !0), n.removeEventListener("mouseup", w, !0)), te.delete(r));
1079
- };
1080
- function Qt(e) {
1081
- const t = T(e);
1082
- let r;
1083
- return t.readyState !== "loading" ? fe(e) : (r = () => {
1084
- fe(e);
1085
- }, t.addEventListener("DOMContentLoaded", r)), () => et(e, r);
1086
- }
1087
- typeof document < "u" && Qt();
1088
- function tt() {
1089
- return O !== "pointer";
1090
- }
1091
- function Zt() {
1092
- return O;
1093
- }
1094
- function Er(e) {
1095
- O = e, ve(e, null);
1096
- }
1097
- function Pr() {
1098
- fe();
1099
- let [e, t] = x(O);
1100
- return X(() => {
1101
- let r = () => {
1102
- t(O);
1103
- };
1104
- return re.add(r), () => {
1105
- re.delete(r);
1106
- };
1107
- }, []), De() ? null : e;
1108
- }
1109
- const er = /* @__PURE__ */ new Set([
1110
- "checkbox",
1111
- "radio",
1112
- "range",
1113
- "color",
1114
- "file",
1115
- "image",
1116
- "button",
1117
- "submit",
1118
- "reset"
1119
- ]);
1120
- function tr(e, t, r) {
1121
- var n;
1122
- const a = typeof window < "u" ? C(r == null ? void 0 : r.target).HTMLInputElement : HTMLInputElement, s = typeof window < "u" ? C(r == null ? void 0 : r.target).HTMLTextAreaElement : HTMLTextAreaElement, i = typeof window < "u" ? C(r == null ? void 0 : r.target).HTMLElement : HTMLElement, f = typeof window < "u" ? C(r == null ? void 0 : r.target).KeyboardEvent : KeyboardEvent;
1123
- return e = e || (r == null ? void 0 : r.target) instanceof a && !er.has(r == null || (n = r.target) === null || n === void 0 ? void 0 : n.type) || (r == null ? void 0 : r.target) instanceof s || (r == null ? void 0 : r.target) instanceof i && (r == null ? void 0 : r.target.isContentEditable), !(e && t === "keyboard" && r instanceof f && !Rt[r.key]);
1124
- }
1125
- function rr(e, t, r) {
1126
- fe(), X(() => {
1127
- let n = (a, s) => {
1128
- tr(!!(r != null && r.isTextInput), a, s) && e(tt());
1129
- };
1130
- return re.add(n), () => {
1131
- re.delete(n);
1132
- };
1133
- }, t);
1134
- }
1135
- function nr(e) {
1136
- let { isDisabled: t, onBlurWithin: r, onFocusWithin: n, onFocusWithinChange: a } = e, s = E({
1137
- isFocusWithin: !1
1138
- }), i = h((p) => {
1139
- s.current.isFocusWithin && !p.currentTarget.contains(p.relatedTarget) && (s.current.isFocusWithin = !1, r && r(p), a && a(!1));
1140
- }, [
1141
- r,
1142
- a,
1143
- s
1144
- ]), f = Re(i), d = h((p) => {
1145
- !s.current.isFocusWithin && document.activeElement === p.target && (n && n(p), a && a(!0), s.current.isFocusWithin = !0, f(p));
1146
- }, [
1147
- n,
1148
- a,
1149
- f
1150
- ]);
1151
- return t ? {
1152
- focusWithinProps: {
1153
- // These should not have been null, that would conflict in mergeProps
1154
- onFocus: void 0,
1155
- onBlur: void 0
1156
- }
1157
- } : {
1158
- focusWithinProps: {
1159
- onFocus: d,
1160
- onBlur: i
1161
- }
1162
- };
1163
- }
1164
- let de = !1, ye = 0;
1165
- function Pe() {
1166
- de = !0, setTimeout(() => {
1167
- de = !1;
1168
- }, 50);
1169
- }
1170
- function Oe(e) {
1171
- e.pointerType === "touch" && Pe();
1172
- }
1173
- function or() {
1174
- if (!(typeof document > "u"))
1175
- return typeof PointerEvent < "u" ? document.addEventListener("pointerup", Oe) : document.addEventListener("touchend", Pe), ye++, () => {
1176
- ye--, !(ye > 0) && (typeof PointerEvent < "u" ? document.removeEventListener("pointerup", Oe) : document.removeEventListener("touchend", Pe));
1177
- };
1178
- }
1179
- function wr(e) {
1180
- let { onHoverStart: t, onHoverChange: r, onHoverEnd: n, isDisabled: a } = e, [s, i] = x(!1), f = E({
1181
- isHovered: !1,
1182
- ignoreEmulatedMouseEvents: !1,
1183
- pointerType: "",
1184
- target: null
1185
- }).current;
1186
- X(or, []);
1187
- let { hoverProps: d, triggerHoverEnd: p } = ee(() => {
1188
- let $ = (g, k) => {
1189
- if (f.pointerType = k, a || k === "touch" || f.isHovered || !g.currentTarget.contains(g.target)) return;
1190
- f.isHovered = !0;
1191
- let S = g.currentTarget;
1192
- f.target = S, t && t({
1193
- type: "hoverstart",
1194
- target: S,
1195
- pointerType: k
1196
- }), r && r(!0), i(!0);
1197
- }, P = (g, k) => {
1198
- if (f.pointerType = "", f.target = null, k === "touch" || !f.isHovered) return;
1199
- f.isHovered = !1;
1200
- let S = g.currentTarget;
1201
- n && n({
1202
- type: "hoverend",
1203
- target: S,
1204
- pointerType: k
1205
- }), r && r(!1), i(!1);
1206
- }, K = {};
1207
- return typeof PointerEvent < "u" ? (K.onPointerEnter = (g) => {
1208
- de && g.pointerType === "mouse" || $(g, g.pointerType);
1209
- }, K.onPointerLeave = (g) => {
1210
- !a && g.currentTarget.contains(g.target) && P(g, g.pointerType);
1211
- }) : (K.onTouchStart = () => {
1212
- f.ignoreEmulatedMouseEvents = !0;
1213
- }, K.onMouseEnter = (g) => {
1214
- !f.ignoreEmulatedMouseEvents && !de && $(g, "mouse"), f.ignoreEmulatedMouseEvents = !1;
1215
- }, K.onMouseLeave = (g) => {
1216
- !a && g.currentTarget.contains(g.target) && P(g, "mouse");
1217
- }), {
1218
- hoverProps: K,
1219
- triggerHoverEnd: P
1220
- };
1221
- }, [
1222
- t,
1223
- r,
1224
- n,
1225
- a,
1226
- f
1227
- ]);
1228
- return X(() => {
1229
- a && p({
1230
- currentTarget: f.target
1231
- }, f.pointerType);
1232
- }, [
1233
- a
1234
- ]), {
1235
- hoverProps: d,
1236
- isHovered: s
1237
- };
1238
- }
1239
- function xr(e) {
1240
- const t = T(e);
1241
- if (Zt() === "virtual") {
1242
- let r = t.activeElement;
1243
- Xe(() => {
1244
- t.activeElement === r && e.isConnected && B(e);
1245
- });
1246
- } else B(e);
1247
- }
1248
- function Sr(e = {}) {
1249
- let { autoFocus: t = !1, isTextInput: r, within: n } = e, a = E({
1250
- isFocused: !1,
1251
- isFocusVisible: t || tt()
1252
- }), [s, i] = x(!1), [f, d] = x(() => a.current.isFocused && a.current.isFocusVisible), p = h(() => d(a.current.isFocused && a.current.isFocusVisible), []), $ = h((g) => {
1253
- a.current.isFocused = g, i(g), p();
1254
- }, [
1255
- p
1256
- ]);
1257
- rr((g) => {
1258
- a.current.isFocusVisible = g, p();
1259
- }, [], {
1260
- isTextInput: r
1261
- });
1262
- let { focusProps: P } = qt({
1263
- isDisabled: n,
1264
- onFocusChange: $
1265
- }), { focusWithinProps: K } = nr({
1266
- isDisabled: !n,
1267
- onFocusWithinChange: $
1268
- });
1269
- return {
1270
- isFocused: s,
1271
- isFocusVisible: f,
1272
- focusProps: n ? K : P
1273
- };
1274
- }
1275
- export {
1276
- fr as $,
1277
- Ke as A,
1278
- Q as B,
1279
- Mt as C,
1280
- Ne as D,
1281
- tt as E,
1282
- V as F,
1283
- Er as G,
1284
- ht as H,
1285
- Ht as I,
1286
- cr as J,
1287
- Zt as K,
1288
- B as L,
1289
- j as M,
1290
- Pr as N,
1291
- dr as O,
1292
- We as P,
1293
- Ve as Q,
1294
- Se as R,
1295
- hr as S,
1296
- yr as T,
1297
- Gt as _,
1298
- gr as a,
1299
- wr as b,
1300
- Sr as c,
1301
- $r as d,
1302
- we as e,
1303
- nr as f,
1304
- De as g,
1305
- Ye as h,
1306
- It as i,
1307
- Ot as j,
1308
- bt as k,
1309
- G as l,
1310
- Tr as m,
1311
- ur as n,
1312
- Ue as o,
1313
- pr as p,
1314
- kt as q,
1315
- C as r,
1316
- T as s,
1317
- xr as t,
1318
- Dt as u,
1319
- br as v,
1320
- mr as w,
1321
- vr as x,
1322
- lr as y,
1323
- qt as z
1324
- };