@stihl-design-system/components 1.0.0-RC.34 → 1.0.0-RC.35

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 (152) hide show
  1. package/{actionbutton.DLQJU6AV.js → actionbutton.Du5CT-Mt.js} +2 -2
  2. package/{actionlink.DEBrWfN3.js → actionlink.BK9CaQUY.js} +2 -2
  3. package/assets/Button.CmeGVEAY.css +1 -0
  4. package/assets/CustomReactSelect.BihX36Uo.css +1 -0
  5. package/assets/Fieldset.Oqu7pOBv.css +1 -0
  6. package/assets/InputFile.D7Ihod7B.css +1 -0
  7. package/assets/InputNumber.z_UqRYdv.css +1 -0
  8. package/assets/InputPassword.DZENjxJ9.css +1 -0
  9. package/assets/InputSearch.GBH9Eh6F.css +1 -0
  10. package/assets/LinkButton.88j5ckLu.css +1 -0
  11. package/assets/Select.CL0fqx7X.css +1 -0
  12. package/assets/Slider.DWLuIsNj.css +1 -0
  13. package/assets/Textarea.B1HOakic.css +1 -0
  14. package/assets/buttonround.DBpMesfr.css +1 -0
  15. package/assets/input.RPDR8qdT.css +1 -0
  16. package/{banner.CI5HnDqD.js → banner.D-RX60nJ.js} +1 -1
  17. package/{breadcrumb.CtwAux3P.js → breadcrumb.tvMByFgp.js} +3 -3
  18. package/button.CZupaV9L.js +12 -0
  19. package/buttonround.9IS0tUqw.js +96 -0
  20. package/{checkbox.DwccD0Mp.js → checkbox.XYQI-ubx.js} +2 -2
  21. package/{checkboxgroup.ZiUFfCJ1.js → checkboxgroup.CjnNJ8e6.js} +2 -2
  22. package/{chip.B0s_fS8L.js → chip.B-pxhsdb.js} +2 -2
  23. package/{chipgroup.Dpu66bo5.js → chipgroup.cGjn4LVV.js} +2 -2
  24. package/chunks/{ActionButton.DOYsEHPr.js → ActionButton.BOYQYo5M.js} +1 -1
  25. package/chunks/{ActionLink.DbyciN3Y.js → ActionLink.BlwvrnPN.js} +1 -1
  26. package/chunks/{Breadcrumb.BgnpTo01.js → Breadcrumb.Qr6bDP2N.js} +2 -2
  27. package/chunks/Button.Cn5yg7dG.js +138 -0
  28. package/chunks/{Checkbox.BcGXAuuP.js → Checkbox.D5X5T6Yg.js} +1 -1
  29. package/chunks/CheckboxGroup.CUR_0VMc.js +74 -0
  30. package/chunks/{Chip.D6pubCZV.js → Chip.DIp5hdRH.js} +1 -1
  31. package/chunks/{CustomReactSelect.Dg3wC_VH.js → CustomReactSelect.BA3hUVkh.js} +816 -800
  32. package/chunks/{Dialog.DpqSVrYR.js → Dialog.DRk_jSj5.js} +1 -1
  33. package/chunks/{Drawer.DISWybOa.js → Drawer.Dj6WeUC8.js} +1 -1
  34. package/chunks/Fieldset.C0RzpI-h.js +81 -0
  35. package/chunks/{Header.7TQL_J9t.js → Header.18sOO0Gf.js} +1 -1
  36. package/chunks/{Input.utils.Dkw7gRrr.js → Input.utils.CL1u4Ctq.js} +27 -25
  37. package/chunks/InputFile.Bki3bs3U.js +236 -0
  38. package/chunks/InputNumber.B43cqBH0.js +242 -0
  39. package/chunks/InputPassword.DcdMjsXr.js +121 -0
  40. package/chunks/InputSearch.CJm6ph8W.js +149 -0
  41. package/chunks/LinkButton.C6F-yuLL.js +139 -0
  42. package/chunks/{MegaMenu.CQbOeaib.js → MegaMenu.qttkjGbD.js} +7 -8
  43. package/chunks/{NavigationTabs.BwM-6CRm.js → NavigationTabs.CQxlahX1.js} +1 -1
  44. package/chunks/{Notification.CrojkJ0E.js → Notification.Qzz88ngL.js} +1 -1
  45. package/chunks/{Popover.Bb0Pjmvg.js → Popover.D7McfVaH.js} +9 -10
  46. package/chunks/RadioGroup.B2VCD9x-.js +106 -0
  47. package/chunks/Select.B0uMOSSD.js +147 -0
  48. package/chunks/Slider.YTIktxxD.js +306 -0
  49. package/chunks/{Stepper.PTQdQBYf.js → Stepper.BvPmbbqw.js} +2 -2
  50. package/chunks/{Tabs.DyP4whX0.js → Tabs.CoO_lrhV.js} +1 -1
  51. package/chunks/Textarea.lYiPXerd.js +181 -0
  52. package/chunks/{Toast.ug_RjGgF.js → Toast.L5HAuEOn.js} +1 -1
  53. package/chunks/floating-ui.react.COTL3jH5.js +2984 -0
  54. package/chunks/{useBreakpoint.BzR_yaIv.js → useBreakpoint.1txsny17.js} +8 -5
  55. package/combobox.CGEDlMo0.js +71 -0
  56. package/components/Button/Button.d.ts +5 -0
  57. package/components/Button/Button.utils.d.ts +4 -5
  58. package/components/CheckboxGroup/CheckboxGroup.d.ts +14 -1
  59. package/components/Combobox/Combobox.utils.d.ts +3 -2
  60. package/components/Combobox/CustomReactSelect/CustomReactSelect.d.ts +13 -0
  61. package/components/Fieldset/Fieldset.d.ts +14 -1
  62. package/components/Input/Input.d.ts +13 -0
  63. package/components/Input/Input.utils.d.ts +2 -2
  64. package/components/InputFile/InputFile.d.ts +13 -0
  65. package/components/InputFile/InputFile.utils.d.ts +4 -2
  66. package/components/InputNumber/InputNumber.d.ts +17 -4
  67. package/components/InputNumber/InputNumber.utils.d.ts +2 -2
  68. package/components/InputPassword/InputPassword.d.ts +13 -0
  69. package/components/InputPassword/InputPassword.utils.d.ts +2 -2
  70. package/components/InputSearch/InputSearch.d.ts +13 -0
  71. package/components/InputSearch/InputSearch.utils.d.ts +2 -2
  72. package/components/LinkButton/LinkButton.d.ts +5 -0
  73. package/components/LinkButton/LinkButton.utils.d.ts +4 -5
  74. package/components/RadioGroup/RadioGroup.d.ts +13 -0
  75. package/components/Select/Select.d.ts +13 -0
  76. package/components/Select/Select.utils.d.ts +2 -2
  77. package/components/Slider/Slider.d.ts +13 -0
  78. package/components/Textarea/Textarea.d.ts +13 -0
  79. package/components/Textarea/Textarea.utils.d.ts +2 -2
  80. package/{customreactselect.BFN8cYJi.js → customreactselect.BgYf8rKE.js} +4 -3
  81. package/{dialog.CzM_Cxp0.js → dialog.Bq-ZyzR8.js} +2 -2
  82. package/{drawer._A9MQ8Cj.js → drawer.DL5UzLWf.js} +2 -2
  83. package/{fieldset.CId-NtI5.js → fieldset.BFLW2D9H.js} +3 -2
  84. package/{filelist.DgVuWpR3.js → filelist.BG6SGVJ8.js} +1 -1
  85. package/{floatingactionbutton.Bsnncudt.js → floatingactionbutton.B5hJ2At2.js} +1 -1
  86. package/{header.CelAkqtp.js → header.A77yIAH3.js} +1 -1
  87. package/index.es.js +38 -38
  88. package/input.hBWqQr3X.js +190 -0
  89. package/{inputfile.BjgJGefV.js → inputfile.BSZuRujU.js} +6 -5
  90. package/{inputnumber.BcrxBVv0.js → inputnumber.CA4JiUmq.js} +7 -6
  91. package/{inputpassword.CddmBW-T.js → inputpassword.Cju_crMi.js} +4 -4
  92. package/{inputsearch.CFOASqrd.js → inputsearch.CU9AhVVv.js} +6 -5
  93. package/{link.f8MMZo-w.js → link.DoiK003-.js} +2 -2
  94. package/{linkbutton.BYAvi-_V.js → linkbutton.CWco_B7v.js} +4 -4
  95. package/{logo100years.B4d_DIiB.js → logo100years.DDzCrczW.js} +10 -10
  96. package/{megamenu.Cy9Cc-mC.js → megamenu.BurL9MfF.js} +3 -3
  97. package/{navigationtabs.Dp7D2fnc.js → navigationtabs.zhRZHjgs.js} +2 -2
  98. package/{notification.B-norGiB.js → notification.BiXdWNo7.js} +2 -2
  99. package/package.json +2 -1
  100. package/partials/index.js +30 -30
  101. package/{popover.DFVDZY-m.js → popover.79Voiadz.js} +3 -3
  102. package/{radiogroup.DaThoMfq.js → radiogroup.CwBh7u9L.js} +2 -2
  103. package/{scroller.Cu7H_VCT.js → scroller.IpfbFV8B.js} +1 -1
  104. package/{select.CMdKf7tC.js → select.NHaEtX_u.js} +5 -4
  105. package/{skiptocontent.CHVh0hbr.js → skiptocontent.X4USTODk.js} +1 -1
  106. package/slider.jnNGEyBq.js +12 -0
  107. package/{step.DKf4CHGr.js → step.D5p7qppy.js} +1 -1
  108. package/{stepper.CCP_igpJ.js → stepper.DnMc4ex6.js} +3 -3
  109. package/styles/scss/ds/lib/ds-internal/_input.scss +12 -3
  110. package/styles/scss/ds/lib/ds-internal/_link-button.scss +10 -2
  111. package/styles/scss/ds/lib/link-button.scss +11 -3
  112. package/{tablist.DZgo49nZ.js → tablist.BFE6RAPD.js} +1 -1
  113. package/{tabs.BkoT7feH.js → tabs.CsOxxQyQ.js} +2 -2
  114. package/{textarea.DMn20z4p.js → textarea.C9OAAjhG.js} +4 -3
  115. package/{toast.Dvs8woTH.js → toast.OBI9qnAM.js} +2 -2
  116. package/{toastmanager.pi_Fhd5t.js → toastmanager.CgsA-1y_.js} +1 -1
  117. package/{tooltip.QJe_bfO-.js → tooltip.Cj3AvYgB.js} +22 -23
  118. package/{topbar.Bxwvp9Lf.js → topbar.CAujTZAE.js} +2 -2
  119. package/utils/useIsomorphicLayoutEffect.d.ts +2 -2
  120. package/assets/Button.C8sNwIeW.css +0 -1
  121. package/assets/CustomReactSelect.E_jJFVew.css +0 -1
  122. package/assets/Fieldset.CW9dBvAo.css +0 -1
  123. package/assets/InputFile.BnIvK65P.css +0 -1
  124. package/assets/InputNumber.BoiCIR1f.css +0 -1
  125. package/assets/InputPassword.Dk3_vNLV.css +0 -1
  126. package/assets/InputSearch.C1_4cVCi.css +0 -1
  127. package/assets/LinkButton.B86yacK5.css +0 -1
  128. package/assets/Select.COxLltX7.css +0 -1
  129. package/assets/Slider.DPEmJ3HD.css +0 -1
  130. package/assets/Textarea.y3MW7VW0.css +0 -1
  131. package/assets/buttonround.BN3vUDc_.css +0 -1
  132. package/assets/input.DTu4g_iA.css +0 -1
  133. package/button.DHuKanZP.js +0 -13
  134. package/buttonround.CMlmEDaN.js +0 -96
  135. package/chunks/Button.DCZgBNmA.js +0 -142
  136. package/chunks/CheckboxGroup.BuFd1luB.js +0 -72
  137. package/chunks/Fieldset.DiMtr6Vw.js +0 -74
  138. package/chunks/InputFile.C8nt9Fu8.js +0 -218
  139. package/chunks/InputNumber.CbH1XJfl.js +0 -267
  140. package/chunks/InputPassword.DbdjuSiJ.js +0 -136
  141. package/chunks/InputSearch.joxmugiv.js +0 -173
  142. package/chunks/LinkButton.BZgIGgc8.js +0 -132
  143. package/chunks/RadioGroup.CexC4v2Z.js +0 -104
  144. package/chunks/Select.BEIdNMML.js +0 -164
  145. package/chunks/Slider.CR0zYHeZ.js +0 -291
  146. package/chunks/Textarea.Du2RII5u.js +0 -168
  147. package/chunks/floating-ui.dom.BT8pKtCQ.js +0 -1005
  148. package/chunks/floating-ui.react.3FjeMiuN.js +0 -1999
  149. package/combobox.jG5GRA7C.js +0 -65
  150. package/input.DuEbg7d6.js +0 -206
  151. package/slider.C5dK6KcG.js +0 -11
  152. /package/components/InputNumber/{InputNumberutils.test.d.ts → InputNumber.utils.test.d.ts} +0 -0
@@ -1,1999 +0,0 @@
1
- "use client";
2
- import * as u from "react";
3
- import { useLayoutEffect as Lt } from "react";
4
- import { i as Qt, b as se, f as en, o as tn, s as nn, c as rn, d as ct, e as on, g as z, h as sn, j as Ke, k as un, l as qe, m as an, n as Ot, p as Dt } from "./floating-ui.dom.BT8pKtCQ.js";
5
- import { jsxs as nt, jsx as te, Fragment as cn } from "react/jsx-runtime";
6
- import * as rt from "react-dom";
7
- /*!
8
- * tabbable 6.2.0
9
- * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
10
- */
11
- var ln = ["input:not([inert])", "select:not([inert])", "textarea:not([inert])", "a[href]:not([inert])", "button:not([inert])", "[tabindex]:not(slot):not([inert])", "audio[controls]:not([inert])", "video[controls]:not([inert])", '[contenteditable]:not([contenteditable="false"]):not([inert])', "details>summary:first-of-type:not([inert])", "details:not([inert])"], Ae = /* @__PURE__ */ ln.join(","), Nt = typeof Element > "u", Ee = Nt ? function() {
12
- } : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector, Fe = !Nt && Element.prototype.getRootNode ? function(e) {
13
- var t;
14
- return e == null || (t = e.getRootNode) === null || t === void 0 ? void 0 : t.call(e);
15
- } : function(e) {
16
- return e?.ownerDocument;
17
- }, Le = function e(t, n) {
18
- var r;
19
- n === void 0 && (n = !0);
20
- var o = t == null || (r = t.getAttribute) === null || r === void 0 ? void 0 : r.call(t, "inert"), s = o === "" || o === "true", i = s || n && t && e(t.parentNode);
21
- return i;
22
- }, fn = function(t) {
23
- var n, r = t == null || (n = t.getAttribute) === null || n === void 0 ? void 0 : n.call(t, "contenteditable");
24
- return r === "" || r === "true";
25
- }, $t = function(t, n, r) {
26
- if (Le(t))
27
- return [];
28
- var o = Array.prototype.slice.apply(t.querySelectorAll(Ae));
29
- return n && Ee.call(t, Ae) && o.unshift(t), o = o.filter(r), o;
30
- }, Wt = function e(t, n, r) {
31
- for (var o = [], s = Array.from(t); s.length; ) {
32
- var i = s.shift();
33
- if (!Le(i, !1))
34
- if (i.tagName === "SLOT") {
35
- var a = i.assignedElements(), c = a.length ? a : i.children, l = e(c, !0, r);
36
- r.flatten ? o.push.apply(o, l) : o.push({
37
- scopeParent: i,
38
- candidates: l
39
- });
40
- } else {
41
- var v = Ee.call(i, Ae);
42
- v && r.filter(i) && (n || !t.includes(i)) && o.push(i);
43
- var b = i.shadowRoot || // check for an undisclosed shadow
44
- typeof r.getShadowRoot == "function" && r.getShadowRoot(i), y = !Le(b, !1) && (!r.shadowRootFilter || r.shadowRootFilter(i));
45
- if (b && y) {
46
- var f = e(b === !0 ? i.children : b.children, !0, r);
47
- r.flatten ? o.push.apply(o, f) : o.push({
48
- scopeParent: i,
49
- candidates: f
50
- });
51
- } else
52
- s.unshift.apply(s, i.children);
53
- }
54
- }
55
- return o;
56
- }, _t = function(t) {
57
- return !isNaN(parseInt(t.getAttribute("tabindex"), 10));
58
- }, Bt = function(t) {
59
- if (!t)
60
- throw new Error("No node provided");
61
- return t.tabIndex < 0 && (/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName) || fn(t)) && !_t(t) ? 0 : t.tabIndex;
62
- }, dn = function(t, n) {
63
- var r = Bt(t);
64
- return r < 0 && n && !_t(t) ? 0 : r;
65
- }, mn = function(t, n) {
66
- return t.tabIndex === n.tabIndex ? t.documentOrder - n.documentOrder : t.tabIndex - n.tabIndex;
67
- }, Vt = function(t) {
68
- return t.tagName === "INPUT";
69
- }, vn = function(t) {
70
- return Vt(t) && t.type === "hidden";
71
- }, pn = function(t) {
72
- var n = t.tagName === "DETAILS" && Array.prototype.slice.apply(t.children).some(function(r) {
73
- return r.tagName === "SUMMARY";
74
- });
75
- return n;
76
- }, gn = function(t, n) {
77
- for (var r = 0; r < t.length; r++)
78
- if (t[r].checked && t[r].form === n)
79
- return t[r];
80
- }, bn = function(t) {
81
- if (!t.name)
82
- return !0;
83
- var n = t.form || Fe(t), r = function(a) {
84
- return n.querySelectorAll('input[type="radio"][name="' + a + '"]');
85
- }, o;
86
- if (typeof window < "u" && typeof window.CSS < "u" && typeof window.CSS.escape == "function")
87
- o = r(window.CSS.escape(t.name));
88
- else
89
- try {
90
- o = r(t.name);
91
- } catch (i) {
92
- return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s", i.message), !1;
93
- }
94
- var s = gn(o, t.form);
95
- return !s || s === t;
96
- }, hn = function(t) {
97
- return Vt(t) && t.type === "radio";
98
- }, Rn = function(t) {
99
- return hn(t) && !bn(t);
100
- }, En = function(t) {
101
- var n, r = t && Fe(t), o = (n = r) === null || n === void 0 ? void 0 : n.host, s = !1;
102
- if (r && r !== t) {
103
- var i, a, c;
104
- for (s = !!((i = o) !== null && i !== void 0 && (a = i.ownerDocument) !== null && a !== void 0 && a.contains(o) || t != null && (c = t.ownerDocument) !== null && c !== void 0 && c.contains(t)); !s && o; ) {
105
- var l, v, b;
106
- r = Fe(o), o = (l = r) === null || l === void 0 ? void 0 : l.host, s = !!((v = o) !== null && v !== void 0 && (b = v.ownerDocument) !== null && b !== void 0 && b.contains(o));
107
- }
108
- }
109
- return s;
110
- }, lt = function(t) {
111
- var n = t.getBoundingClientRect(), r = n.width, o = n.height;
112
- return r === 0 && o === 0;
113
- }, yn = function(t, n) {
114
- var r = n.displayCheck, o = n.getShadowRoot;
115
- if (getComputedStyle(t).visibility === "hidden")
116
- return !0;
117
- var s = Ee.call(t, "details>summary:first-of-type"), i = s ? t.parentElement : t;
118
- if (Ee.call(i, "details:not([open]) *"))
119
- return !0;
120
- if (!r || r === "full" || r === "legacy-full") {
121
- if (typeof o == "function") {
122
- for (var a = t; t; ) {
123
- var c = t.parentElement, l = Fe(t);
124
- if (c && !c.shadowRoot && o(c) === !0)
125
- return lt(t);
126
- t.assignedSlot ? t = t.assignedSlot : !c && l !== t.ownerDocument ? t = l.host : t = c;
127
- }
128
- t = a;
129
- }
130
- if (En(t))
131
- return !t.getClientRects().length;
132
- if (r !== "legacy-full")
133
- return !0;
134
- } else if (r === "non-zero-area")
135
- return lt(t);
136
- return !1;
137
- }, wn = function(t) {
138
- if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))
139
- for (var n = t.parentElement; n; ) {
140
- if (n.tagName === "FIELDSET" && n.disabled) {
141
- for (var r = 0; r < n.children.length; r++) {
142
- var o = n.children.item(r);
143
- if (o.tagName === "LEGEND")
144
- return Ee.call(n, "fieldset[disabled] *") ? !0 : !o.contains(t);
145
- }
146
- return !0;
147
- }
148
- n = n.parentElement;
149
- }
150
- return !1;
151
- }, Je = function(t, n) {
152
- return !(n.disabled || // we must do an inert look up to filter out any elements inside an inert ancestor
153
- // because we're limited in the type of selectors we can use in JSDom (see related
154
- // note related to `candidateSelectors`)
155
- Le(n) || vn(n) || yn(n, t) || // For a details element with a summary, the summary element gets the focus
156
- pn(n) || wn(n));
157
- }, Qe = function(t, n) {
158
- return !(Rn(n) || Bt(n) < 0 || !Je(t, n));
159
- }, xn = function(t) {
160
- var n = parseInt(t.getAttribute("tabindex"), 10);
161
- return !!(isNaN(n) || n >= 0);
162
- }, Tn = function e(t) {
163
- var n = [], r = [];
164
- return t.forEach(function(o, s) {
165
- var i = !!o.scopeParent, a = i ? o.scopeParent : o, c = dn(a, i), l = i ? e(o.candidates) : a;
166
- c === 0 ? i ? n.push.apply(n, l) : n.push(a) : r.push({
167
- documentOrder: s,
168
- tabIndex: c,
169
- item: o,
170
- isScope: i,
171
- content: l
172
- });
173
- }), r.sort(mn).reduce(function(o, s) {
174
- return s.isScope ? o.push.apply(o, s.content) : o.push(s.content), o;
175
- }, []).concat(n);
176
- }, Ne = function(t, n) {
177
- n = n || {};
178
- var r;
179
- return n.getShadowRoot ? r = Wt([t], n.includeContainer, {
180
- filter: Qe.bind(null, n),
181
- flatten: !1,
182
- getShadowRoot: n.getShadowRoot,
183
- shadowRootFilter: xn
184
- }) : r = $t(t, n.includeContainer, Qe.bind(null, n)), Tn(r);
185
- }, Sn = function(t, n) {
186
- n = n || {};
187
- var r;
188
- return n.getShadowRoot ? r = Wt([t], n.includeContainer, {
189
- filter: Je.bind(null, n),
190
- flatten: !0,
191
- getShadowRoot: n.getShadowRoot
192
- }) : r = $t(t, n.includeContainer, Je.bind(null, n)), r;
193
- }, Kt = function(t, n) {
194
- if (n = n || {}, !t)
195
- throw new Error("No node provided");
196
- return Ee.call(t, Ae) === !1 ? !1 : Qe(n, t);
197
- };
198
- function ot() {
199
- const e = navigator.userAgentData;
200
- return e != null && e.platform ? e.platform : navigator.platform;
201
- }
202
- function qt() {
203
- const e = navigator.userAgentData;
204
- return e && Array.isArray(e.brands) ? e.brands.map((t) => {
205
- let {
206
- brand: n,
207
- version: r
208
- } = t;
209
- return n + "/" + r;
210
- }).join(" ") : navigator.userAgent;
211
- }
212
- function jt() {
213
- return /apple/i.test(navigator.vendor);
214
- }
215
- function et() {
216
- const e = /android/i;
217
- return e.test(ot()) || e.test(qt());
218
- }
219
- function Cn() {
220
- return ot().toLowerCase().startsWith("mac") && !navigator.maxTouchPoints;
221
- }
222
- function Ut() {
223
- return qt().includes("jsdom/");
224
- }
225
- const ft = "data-floating-ui-focusable", In = "input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";
226
- function de(e) {
227
- let t = e.activeElement;
228
- for (; ((n = t) == null || (n = n.shadowRoot) == null ? void 0 : n.activeElement) != null; ) {
229
- var n;
230
- t = t.shadowRoot.activeElement;
231
- }
232
- return t;
233
- }
234
- function G(e, t) {
235
- if (!e || !t)
236
- return !1;
237
- const n = t.getRootNode == null ? void 0 : t.getRootNode();
238
- if (e.contains(t))
239
- return !0;
240
- if (n && Qt(n)) {
241
- let r = t;
242
- for (; r; ) {
243
- if (e === r)
244
- return !0;
245
- r = r.parentNode || r.host;
246
- }
247
- }
248
- return !1;
249
- }
250
- function ae(e) {
251
- return "composedPath" in e ? e.composedPath()[0] : e.target;
252
- }
253
- function je(e, t) {
254
- if (t == null)
255
- return !1;
256
- if ("composedPath" in e)
257
- return e.composedPath().includes(t);
258
- const n = e;
259
- return n.target != null && t.contains(n.target);
260
- }
261
- function Mn(e) {
262
- return e.matches("html,body");
263
- }
264
- function Z(e) {
265
- return e?.ownerDocument || document;
266
- }
267
- function st(e) {
268
- return se(e) && e.matches(In);
269
- }
270
- function dt(e) {
271
- return e ? e.getAttribute("role") === "combobox" && st(e) : !1;
272
- }
273
- function Pn(e) {
274
- if (!e || Ut()) return !0;
275
- try {
276
- return e.matches(":focus-visible");
277
- } catch {
278
- return !0;
279
- }
280
- }
281
- function tt(e) {
282
- return e ? e.hasAttribute(ft) ? e : e.querySelector("[" + ft + "]") || e : null;
283
- }
284
- function he(e, t, n) {
285
- return n === void 0 && (n = !0), e.filter((o) => {
286
- var s;
287
- return o.parentId === t && (!n || ((s = o.context) == null ? void 0 : s.open));
288
- }).flatMap((o) => [o, ...he(e, o.id, n)]);
289
- }
290
- function mt(e, t) {
291
- var n;
292
- let r = [], o = (n = e.find((s) => s.id === t)) == null ? void 0 : n.parentId;
293
- for (; o; ) {
294
- const s = e.find((i) => i.id === o);
295
- o = s?.parentId, s && (r = r.concat(s));
296
- }
297
- return r;
298
- }
299
- function Ue(e) {
300
- e.preventDefault(), e.stopPropagation();
301
- }
302
- function kn(e) {
303
- return "nativeEvent" in e;
304
- }
305
- function An(e) {
306
- return e.mozInputSource === 0 && e.isTrusted ? !0 : et() && e.pointerType ? e.type === "click" && e.buttons === 1 : e.detail === 0 && !e.pointerType;
307
- }
308
- function Fn(e) {
309
- return Ut() ? !1 : !et() && e.width === 0 && e.height === 0 || et() && e.width === 1 && e.height === 1 && e.pressure === 0 && e.detail === 0 && e.pointerType === "mouse" || // iOS VoiceOver returns 0.333• for width/height.
310
- e.width < 1 && e.height < 1 && e.pressure === 0 && e.detail === 0 && e.pointerType === "touch";
311
- }
312
- function we(e, t) {
313
- const n = ["mouse", "pen"];
314
- return t || n.push("", void 0), n.includes(e);
315
- }
316
- var Ln = typeof document < "u", On = function() {
317
- }, Y = Ln ? Lt : On;
318
- const Dn = {
319
- ...u
320
- };
321
- function pe(e) {
322
- const t = u.useRef(e);
323
- return Y(() => {
324
- t.current = e;
325
- }), t;
326
- }
327
- const Nn = Dn.useInsertionEffect, $n = Nn || ((e) => e());
328
- function J(e) {
329
- const t = u.useRef(() => {
330
- if (process.env.NODE_ENV !== "production")
331
- throw new Error("Cannot call an event handler while rendering.");
332
- });
333
- return $n(() => {
334
- t.current = e;
335
- }), u.useCallback(function() {
336
- for (var n = arguments.length, r = new Array(n), o = 0; o < n; o++)
337
- r[o] = arguments[o];
338
- return t.current == null ? void 0 : t.current(...r);
339
- }, []);
340
- }
341
- const Te = () => ({
342
- getShadowRoot: !0,
343
- displayCheck: (
344
- // JSDOM does not support the `tabbable` library. To solve this we can
345
- // check if `ResizeObserver` is a real function (not polyfilled), which
346
- // determines if the current environment is JSDOM-like.
347
- typeof ResizeObserver == "function" && ResizeObserver.toString().includes("[native code]") ? "full" : "none"
348
- )
349
- });
350
- function Ht(e, t) {
351
- const n = Ne(e, Te()), r = n.length;
352
- if (r === 0) return;
353
- const o = de(Z(e)), s = n.indexOf(o), i = s === -1 ? t === 1 ? 0 : r - 1 : s + t;
354
- return n[i];
355
- }
356
- function Yt(e) {
357
- return Ht(Z(e).body, 1) || e;
358
- }
359
- function Xt(e) {
360
- return Ht(Z(e).body, -1) || e;
361
- }
362
- function ye(e, t) {
363
- const n = t || e.currentTarget, r = e.relatedTarget;
364
- return !r || !G(n, r);
365
- }
366
- function Wn(e) {
367
- Ne(e, Te()).forEach((n) => {
368
- n.dataset.tabindex = n.getAttribute("tabindex") || "", n.setAttribute("tabindex", "-1");
369
- });
370
- }
371
- function vt(e) {
372
- e.querySelectorAll("[data-tabindex]").forEach((n) => {
373
- const r = n.dataset.tabindex;
374
- delete n.dataset.tabindex, r ? n.setAttribute("tabindex", r) : n.removeAttribute("tabindex");
375
- });
376
- }
377
- var _n = typeof document < "u", Bn = function() {
378
- }, ke = _n ? Lt : Bn;
379
- function Oe(e, t) {
380
- if (e === t)
381
- return !0;
382
- if (typeof e != typeof t)
383
- return !1;
384
- if (typeof e == "function" && e.toString() === t.toString())
385
- return !0;
386
- let n, r, o;
387
- if (e && t && typeof e == "object") {
388
- if (Array.isArray(e)) {
389
- if (n = e.length, n !== t.length) return !1;
390
- for (r = n; r-- !== 0; )
391
- if (!Oe(e[r], t[r]))
392
- return !1;
393
- return !0;
394
- }
395
- if (o = Object.keys(e), n = o.length, n !== Object.keys(t).length)
396
- return !1;
397
- for (r = n; r-- !== 0; )
398
- if (!{}.hasOwnProperty.call(t, o[r]))
399
- return !1;
400
- for (r = n; r-- !== 0; ) {
401
- const s = o[r];
402
- if (!(s === "_owner" && e.$$typeof) && !Oe(e[s], t[s]))
403
- return !1;
404
- }
405
- return !0;
406
- }
407
- return e !== e && t !== t;
408
- }
409
- function Gt(e) {
410
- return typeof window > "u" ? 1 : (e.ownerDocument.defaultView || window).devicePixelRatio || 1;
411
- }
412
- function pt(e, t) {
413
- const n = Gt(e);
414
- return Math.round(t * n) / n;
415
- }
416
- function He(e) {
417
- const t = u.useRef(e);
418
- return ke(() => {
419
- t.current = e;
420
- }), t;
421
- }
422
- function Vn(e) {
423
- e === void 0 && (e = {});
424
- const {
425
- placement: t = "bottom",
426
- strategy: n = "absolute",
427
- middleware: r = [],
428
- platform: o,
429
- elements: {
430
- reference: s,
431
- floating: i
432
- } = {},
433
- transform: a = !0,
434
- whileElementsMounted: c,
435
- open: l
436
- } = e, [v, b] = u.useState({
437
- x: 0,
438
- y: 0,
439
- strategy: n,
440
- placement: t,
441
- middlewareData: {},
442
- isPositioned: !1
443
- }), [y, f] = u.useState(r);
444
- Oe(y, r) || f(r);
445
- const [g, d] = u.useState(null), [w, S] = u.useState(null), p = u.useCallback((m) => {
446
- m !== W.current && (W.current = m, d(m));
447
- }, []), R = u.useCallback((m) => {
448
- m !== F.current && (F.current = m, S(m));
449
- }, []), I = s || g, $ = i || w, W = u.useRef(null), F = u.useRef(null), O = u.useRef(v), X = c != null, q = He(c), _ = He(o), K = He(l), B = u.useCallback(() => {
450
- if (!W.current || !F.current)
451
- return;
452
- const m = {
453
- placement: t,
454
- strategy: n,
455
- middleware: y
456
- };
457
- _.current && (m.platform = _.current), rn(W.current, F.current, m).then((C) => {
458
- const M = {
459
- ...C,
460
- // The floating element's position may be recomputed while it's closed
461
- // but still mounted (such as when transitioning out). To ensure
462
- // `isPositioned` will be `false` initially on the next open, avoid
463
- // setting it to `true` when `open === false` (must be specified).
464
- isPositioned: K.current !== !1
465
- };
466
- h.current && !Oe(O.current, M) && (O.current = M, rt.flushSync(() => {
467
- b(M);
468
- }));
469
- });
470
- }, [y, t, n, _, K]);
471
- ke(() => {
472
- l === !1 && O.current.isPositioned && (O.current.isPositioned = !1, b((m) => ({
473
- ...m,
474
- isPositioned: !1
475
- })));
476
- }, [l]);
477
- const h = u.useRef(!1);
478
- ke(() => (h.current = !0, () => {
479
- h.current = !1;
480
- }), []), ke(() => {
481
- if (I && (W.current = I), $ && (F.current = $), I && $) {
482
- if (q.current)
483
- return q.current(I, $, B);
484
- B();
485
- }
486
- }, [I, $, B, q, X]);
487
- const E = u.useMemo(() => ({
488
- reference: W,
489
- floating: F,
490
- setReference: p,
491
- setFloating: R
492
- }), [p, R]), D = u.useMemo(() => ({
493
- reference: I,
494
- floating: $
495
- }), [I, $]), x = u.useMemo(() => {
496
- const m = {
497
- position: n,
498
- left: 0,
499
- top: 0
500
- };
501
- if (!D.floating)
502
- return m;
503
- const C = pt(D.floating, v.x), M = pt(D.floating, v.y);
504
- return a ? {
505
- ...m,
506
- transform: "translate(" + C + "px, " + M + "px)",
507
- ...Gt(D.floating) >= 1.5 && {
508
- willChange: "transform"
509
- }
510
- } : {
511
- position: n,
512
- left: C,
513
- top: M
514
- };
515
- }, [n, a, D.floating, v.x, v.y]);
516
- return u.useMemo(() => ({
517
- ...v,
518
- update: B,
519
- refs: E,
520
- elements: D,
521
- floatingStyles: x
522
- }), [v, B, E, D, x]);
523
- }
524
- const Kn = (e) => {
525
- function t(n) {
526
- return {}.hasOwnProperty.call(n, "current");
527
- }
528
- return {
529
- name: "arrow",
530
- options: e,
531
- fn(n) {
532
- const {
533
- element: r,
534
- padding: o
535
- } = typeof e == "function" ? e(n) : e;
536
- return r && t(r) ? r.current != null ? ct({
537
- element: r.current,
538
- padding: o
539
- }).fn(n) : {} : r ? ct({
540
- element: r,
541
- padding: o
542
- }).fn(n) : {};
543
- }
544
- };
545
- }, hr = (e, t) => ({
546
- ...tn(e),
547
- options: [e, t]
548
- }), Rr = (e, t) => ({
549
- ...nn(e),
550
- options: [e, t]
551
- }), Er = (e, t) => ({
552
- ...en(e),
553
- options: [e, t]
554
- }), yr = (e, t) => ({
555
- ...Kn(e),
556
- options: [e, t]
557
- });
558
- function wr(e) {
559
- const t = u.useRef(void 0), n = u.useCallback((r) => {
560
- const o = e.map((s) => {
561
- if (s != null) {
562
- if (typeof s == "function") {
563
- const i = s, a = i(r);
564
- return typeof a == "function" ? a : () => {
565
- i(null);
566
- };
567
- }
568
- return s.current = r, () => {
569
- s.current = null;
570
- };
571
- }
572
- });
573
- return () => {
574
- o.forEach((s) => s?.());
575
- };
576
- }, e);
577
- return u.useMemo(() => e.every((r) => r == null) ? null : (r) => {
578
- t.current && (t.current(), t.current = void 0), r != null && (t.current = n(r));
579
- }, e);
580
- }
581
- const qn = "data-floating-ui-focusable", gt = "active", bt = "selected", jn = {
582
- ...u
583
- };
584
- let ht = !1, Un = 0;
585
- const Rt = () => (
586
- // Ensure the id is unique with multiple independent versions of Floating UI
587
- // on <React 18
588
- "floating-ui-" + Math.random().toString(36).slice(2, 6) + Un++
589
- );
590
- function Hn() {
591
- const [e, t] = u.useState(() => ht ? Rt() : void 0);
592
- return Y(() => {
593
- e == null && t(Rt());
594
- }, []), u.useEffect(() => {
595
- ht = !0;
596
- }, []), e;
597
- }
598
- const Yn = jn.useId, $e = Yn || Hn;
599
- let xe;
600
- process.env.NODE_ENV !== "production" && (xe = /* @__PURE__ */ new Set());
601
- function Xn() {
602
- for (var e, t = arguments.length, n = new Array(t), r = 0; r < t; r++)
603
- n[r] = arguments[r];
604
- const o = "Floating UI: " + n.join(" ");
605
- if (!((e = xe) != null && e.has(o))) {
606
- var s;
607
- (s = xe) == null || s.add(o), console.warn(o);
608
- }
609
- }
610
- function Gn() {
611
- for (var e, t = arguments.length, n = new Array(t), r = 0; r < t; r++)
612
- n[r] = arguments[r];
613
- const o = "Floating UI: " + n.join(" ");
614
- if (!((e = xe) != null && e.has(o))) {
615
- var s;
616
- (s = xe) == null || s.add(o), console.error(o);
617
- }
618
- }
619
- const xr = /* @__PURE__ */ u.forwardRef(function(t, n) {
620
- const {
621
- context: {
622
- placement: r,
623
- elements: {
624
- floating: o
625
- },
626
- middlewareData: {
627
- arrow: s,
628
- shift: i
629
- }
630
- },
631
- width: a = 14,
632
- height: c = 7,
633
- tipRadius: l = 0,
634
- strokeWidth: v = 0,
635
- staticOffset: b,
636
- stroke: y,
637
- d: f,
638
- style: {
639
- transform: g,
640
- ...d
641
- } = {},
642
- ...w
643
- } = t;
644
- process.env.NODE_ENV !== "production" && (n || Xn("The `ref` prop is required for `FloatingArrow`."));
645
- const S = $e(), [p, R] = u.useState(!1);
646
- if (Y(() => {
647
- if (!o) return;
648
- Ot(o).direction === "rtl" && R(!0);
649
- }, [o]), !o)
650
- return null;
651
- const [I, $] = r.split("-"), W = I === "top" || I === "bottom";
652
- let F = b;
653
- (W && i != null && i.x || !W && i != null && i.y) && (F = null);
654
- const O = v * 2, X = O / 2, q = a / 2 * (l / -8 + 1), _ = c / 2 * l / 4, K = !!f, B = F && $ === "end" ? "bottom" : "top";
655
- let h = F && $ === "end" ? "right" : "left";
656
- F && p && (h = $ === "end" ? "left" : "right");
657
- const E = s?.x != null ? F || s.x : "", D = s?.y != null ? F || s.y : "", x = f || "M0,0" + (" H" + a) + (" L" + (a - q) + "," + (c - _)) + (" Q" + a / 2 + "," + c + " " + q + "," + (c - _)) + " Z", m = {
658
- top: K ? "rotate(180deg)" : "",
659
- left: K ? "rotate(90deg)" : "rotate(-90deg)",
660
- bottom: K ? "" : "rotate(180deg)",
661
- right: K ? "rotate(-90deg)" : "rotate(90deg)"
662
- }[I];
663
- return /* @__PURE__ */ nt("svg", {
664
- ...w,
665
- "aria-hidden": !0,
666
- ref: n,
667
- width: K ? a : a + O,
668
- height: a,
669
- viewBox: "0 0 " + a + " " + (c > a ? c : a),
670
- style: {
671
- position: "absolute",
672
- pointerEvents: "none",
673
- [h]: E,
674
- [B]: D,
675
- [I]: W || K ? "100%" : "calc(100% - " + O / 2 + "px)",
676
- transform: [m, g].filter((C) => !!C).join(" "),
677
- ...d
678
- },
679
- children: [O > 0 && /* @__PURE__ */ te("path", {
680
- clipPath: "url(#" + S + ")",
681
- fill: "none",
682
- stroke: y,
683
- strokeWidth: O + (f ? 0 : 1),
684
- d: x
685
- }), /* @__PURE__ */ te("path", {
686
- stroke: O && !f ? w.fill : "none",
687
- d: x
688
- }), /* @__PURE__ */ te("clipPath", {
689
- id: S,
690
- children: /* @__PURE__ */ te("rect", {
691
- x: -X,
692
- y: X * (K ? -1 : 1),
693
- width: a + O,
694
- height: a
695
- })
696
- })]
697
- });
698
- });
699
- function Zn() {
700
- const e = /* @__PURE__ */ new Map();
701
- return {
702
- emit(t, n) {
703
- var r;
704
- (r = e.get(t)) == null || r.forEach((o) => o(n));
705
- },
706
- on(t, n) {
707
- e.has(t) || e.set(t, /* @__PURE__ */ new Set()), e.get(t).add(n);
708
- },
709
- off(t, n) {
710
- var r;
711
- (r = e.get(t)) == null || r.delete(n);
712
- }
713
- };
714
- }
715
- const zn = /* @__PURE__ */ u.createContext(null), Jn = /* @__PURE__ */ u.createContext(null), it = () => {
716
- var e;
717
- return ((e = u.useContext(zn)) == null ? void 0 : e.id) || null;
718
- }, We = () => u.useContext(Jn);
719
- function ge(e) {
720
- return "data-floating-ui-" + e;
721
- }
722
- function ee(e) {
723
- e.current !== -1 && (clearTimeout(e.current), e.current = -1);
724
- }
725
- const Et = /* @__PURE__ */ ge("safe-polygon");
726
- function Ye(e, t, n) {
727
- if (n && !we(n))
728
- return 0;
729
- if (typeof e == "number")
730
- return e;
731
- if (typeof e == "function") {
732
- const r = e();
733
- return typeof r == "number" ? r : r?.[t];
734
- }
735
- return e?.[t];
736
- }
737
- function Xe(e) {
738
- return typeof e == "function" ? e() : e;
739
- }
740
- function Tr(e, t) {
741
- t === void 0 && (t = {});
742
- const {
743
- open: n,
744
- onOpenChange: r,
745
- dataRef: o,
746
- events: s,
747
- elements: i
748
- } = e, {
749
- enabled: a = !0,
750
- delay: c = 0,
751
- handleClose: l = null,
752
- mouseOnly: v = !1,
753
- restMs: b = 0,
754
- move: y = !0
755
- } = t, f = We(), g = it(), d = pe(l), w = pe(c), S = pe(n), p = pe(b), R = u.useRef(), I = u.useRef(-1), $ = u.useRef(), W = u.useRef(-1), F = u.useRef(!0), O = u.useRef(!1), X = u.useRef(() => {
756
- }), q = u.useRef(!1), _ = J(() => {
757
- var x;
758
- const m = (x = o.current.openEvent) == null ? void 0 : x.type;
759
- return m?.includes("mouse") && m !== "mousedown";
760
- });
761
- u.useEffect(() => {
762
- if (!a) return;
763
- function x(m) {
764
- let {
765
- open: C
766
- } = m;
767
- C || (ee(I), ee(W), F.current = !0, q.current = !1);
768
- }
769
- return s.on("openchange", x), () => {
770
- s.off("openchange", x);
771
- };
772
- }, [a, s]), u.useEffect(() => {
773
- if (!a || !d.current || !n) return;
774
- function x(C) {
775
- _() && r(!1, C, "hover");
776
- }
777
- const m = Z(i.floating).documentElement;
778
- return m.addEventListener("mouseleave", x), () => {
779
- m.removeEventListener("mouseleave", x);
780
- };
781
- }, [i.floating, n, r, a, d, _]);
782
- const K = u.useCallback(function(x, m, C) {
783
- m === void 0 && (m = !0), C === void 0 && (C = "hover");
784
- const M = Ye(w.current, "close", R.current);
785
- M && !$.current ? (ee(I), I.current = window.setTimeout(() => r(!1, x, C), M)) : m && (ee(I), r(!1, x, C));
786
- }, [w, r]), B = J(() => {
787
- X.current(), $.current = void 0;
788
- }), h = J(() => {
789
- if (O.current) {
790
- const x = Z(i.floating).body;
791
- x.style.pointerEvents = "", x.removeAttribute(Et), O.current = !1;
792
- }
793
- }), E = J(() => o.current.openEvent ? ["click", "mousedown"].includes(o.current.openEvent.type) : !1);
794
- u.useEffect(() => {
795
- if (!a) return;
796
- function x(k) {
797
- if (ee(I), F.current = !1, v && !we(R.current) || Xe(p.current) > 0 && !Ye(w.current, "open"))
798
- return;
799
- const T = Ye(w.current, "open", R.current);
800
- T ? I.current = window.setTimeout(() => {
801
- S.current || r(!0, k, "hover");
802
- }, T) : n || r(!0, k, "hover");
803
- }
804
- function m(k) {
805
- if (E()) {
806
- h();
807
- return;
808
- }
809
- X.current();
810
- const T = Z(i.floating);
811
- if (ee(W), q.current = !1, d.current && o.current.floatingContext) {
812
- n || ee(I), $.current = d.current({
813
- ...o.current.floatingContext,
814
- tree: f,
815
- x: k.clientX,
816
- y: k.clientY,
817
- onClose() {
818
- h(), B(), E() || K(k, !0, "safe-polygon");
819
- }
820
- });
821
- const V = $.current;
822
- T.addEventListener("mousemove", V), X.current = () => {
823
- T.removeEventListener("mousemove", V);
824
- };
825
- return;
826
- }
827
- (R.current === "touch" ? !G(i.floating, k.relatedTarget) : !0) && K(k);
828
- }
829
- function C(k) {
830
- E() || o.current.floatingContext && (d.current == null || d.current({
831
- ...o.current.floatingContext,
832
- tree: f,
833
- x: k.clientX,
834
- y: k.clientY,
835
- onClose() {
836
- h(), B(), E() || K(k);
837
- }
838
- })(k));
839
- }
840
- function M() {
841
- ee(I);
842
- }
843
- function U(k) {
844
- E() || K(k, !1);
845
- }
846
- if (z(i.domReference)) {
847
- const k = i.domReference, T = i.floating;
848
- return n && k.addEventListener("mouseleave", C), y && k.addEventListener("mousemove", x, {
849
- once: !0
850
- }), k.addEventListener("mouseenter", x), k.addEventListener("mouseleave", m), T && (T.addEventListener("mouseleave", C), T.addEventListener("mouseenter", M), T.addEventListener("mouseleave", U)), () => {
851
- n && k.removeEventListener("mouseleave", C), y && k.removeEventListener("mousemove", x), k.removeEventListener("mouseenter", x), k.removeEventListener("mouseleave", m), T && (T.removeEventListener("mouseleave", C), T.removeEventListener("mouseenter", M), T.removeEventListener("mouseleave", U));
852
- };
853
- }
854
- }, [i, a, e, v, y, K, B, h, r, n, S, f, w, d, o, E, p]), Y(() => {
855
- var x;
856
- if (a && n && (x = d.current) != null && (x = x.__options) != null && x.blockPointerEvents && _()) {
857
- O.current = !0;
858
- const C = i.floating;
859
- if (z(i.domReference) && C) {
860
- var m;
861
- const M = Z(i.floating).body;
862
- M.setAttribute(Et, "");
863
- const U = i.domReference, k = f == null || (m = f.nodesRef.current.find((T) => T.id === g)) == null || (m = m.context) == null ? void 0 : m.elements.floating;
864
- return k && (k.style.pointerEvents = ""), M.style.pointerEvents = "none", U.style.pointerEvents = "auto", C.style.pointerEvents = "auto", () => {
865
- M.style.pointerEvents = "", U.style.pointerEvents = "", C.style.pointerEvents = "";
866
- };
867
- }
868
- }
869
- }, [a, n, g, i, f, d, _]), Y(() => {
870
- n || (R.current = void 0, q.current = !1, B(), h());
871
- }, [n, B, h]), u.useEffect(() => () => {
872
- B(), ee(I), ee(W), h();
873
- }, [a, i.domReference, B, h]);
874
- const D = u.useMemo(() => {
875
- function x(m) {
876
- R.current = m.pointerType;
877
- }
878
- return {
879
- onPointerDown: x,
880
- onPointerEnter: x,
881
- onMouseMove(m) {
882
- const {
883
- nativeEvent: C
884
- } = m;
885
- function M() {
886
- !F.current && !S.current && r(!0, C, "hover");
887
- }
888
- v && !we(R.current) || n || Xe(p.current) === 0 || q.current && m.movementX ** 2 + m.movementY ** 2 < 2 || (ee(W), R.current === "touch" ? M() : (q.current = !0, W.current = window.setTimeout(M, Xe(p.current))));
889
- }
890
- };
891
- }, [v, r, n, S, p]);
892
- return u.useMemo(() => a ? {
893
- reference: D
894
- } : {}, [a, D]);
895
- }
896
- let yt = 0;
897
- function be(e, t) {
898
- t === void 0 && (t = {});
899
- const {
900
- preventScroll: n = !1,
901
- cancelPrevious: r = !0,
902
- sync: o = !1
903
- } = t;
904
- r && cancelAnimationFrame(yt);
905
- const s = () => e?.focus({
906
- preventScroll: n
907
- });
908
- o ? s() : yt = requestAnimationFrame(s);
909
- }
910
- function Qn(e) {
911
- return e?.ownerDocument || document;
912
- }
913
- const Re = {
914
- inert: /* @__PURE__ */ new WeakMap(),
915
- "aria-hidden": /* @__PURE__ */ new WeakMap(),
916
- none: /* @__PURE__ */ new WeakMap()
917
- };
918
- function wt(e) {
919
- return e === "inert" ? Re.inert : e === "aria-hidden" ? Re["aria-hidden"] : Re.none;
920
- }
921
- let Ie = /* @__PURE__ */ new WeakSet(), Me = {}, Ge = 0;
922
- const er = () => typeof HTMLElement < "u" && "inert" in HTMLElement.prototype, Zt = (e) => e && (e.host || Zt(e.parentNode)), tr = (e, t) => t.map((n) => {
923
- if (e.contains(n))
924
- return n;
925
- const r = Zt(n);
926
- return e.contains(r) ? r : null;
927
- }).filter((n) => n != null);
928
- function nr(e, t, n, r) {
929
- const o = "data-floating-ui-inert", s = r ? "inert" : n ? "aria-hidden" : null, i = tr(t, e), a = /* @__PURE__ */ new Set(), c = new Set(i), l = [];
930
- Me[o] || (Me[o] = /* @__PURE__ */ new WeakMap());
931
- const v = Me[o];
932
- i.forEach(b), y(t), a.clear();
933
- function b(f) {
934
- !f || a.has(f) || (a.add(f), f.parentNode && b(f.parentNode));
935
- }
936
- function y(f) {
937
- !f || c.has(f) || [].forEach.call(f.children, (g) => {
938
- if (Dt(g) !== "script")
939
- if (a.has(g))
940
- y(g);
941
- else {
942
- const d = s ? g.getAttribute(s) : null, w = d !== null && d !== "false", S = wt(s), p = (S.get(g) || 0) + 1, R = (v.get(g) || 0) + 1;
943
- S.set(g, p), v.set(g, R), l.push(g), p === 1 && w && Ie.add(g), R === 1 && g.setAttribute(o, ""), !w && s && g.setAttribute(s, s === "inert" ? "" : "true");
944
- }
945
- });
946
- }
947
- return Ge++, () => {
948
- l.forEach((f) => {
949
- const g = wt(s), w = (g.get(f) || 0) - 1, S = (v.get(f) || 0) - 1;
950
- g.set(f, w), v.set(f, S), w || (!Ie.has(f) && s && f.removeAttribute(s), Ie.delete(f)), S || f.removeAttribute(o);
951
- }), Ge--, Ge || (Re.inert = /* @__PURE__ */ new WeakMap(), Re["aria-hidden"] = /* @__PURE__ */ new WeakMap(), Re.none = /* @__PURE__ */ new WeakMap(), Ie = /* @__PURE__ */ new WeakSet(), Me = {});
952
- };
953
- }
954
- function xt(e, t, n) {
955
- t === void 0 && (t = !1), n === void 0 && (n = !1);
956
- const r = Qn(e[0]).body;
957
- return nr(e.concat(Array.from(r.querySelectorAll('[aria-live],[role="status"],output'))), r, t, n);
958
- }
959
- const _e = {
960
- border: 0,
961
- clip: "rect(0 0 0 0)",
962
- height: "1px",
963
- margin: "-1px",
964
- overflow: "hidden",
965
- padding: 0,
966
- position: "fixed",
967
- whiteSpace: "nowrap",
968
- width: "1px",
969
- top: 0,
970
- left: 0
971
- }, De = /* @__PURE__ */ u.forwardRef(function(t, n) {
972
- const [r, o] = u.useState();
973
- Y(() => {
974
- jt() && o("button");
975
- }, []);
976
- const s = {
977
- ref: n,
978
- tabIndex: 0,
979
- // Role is only for VoiceOver
980
- role: r,
981
- "aria-hidden": r ? void 0 : !0,
982
- [ge("focus-guard")]: "",
983
- style: _e
984
- };
985
- return /* @__PURE__ */ te("span", {
986
- ...t,
987
- ...s
988
- });
989
- }), zt = /* @__PURE__ */ u.createContext(null), Tt = /* @__PURE__ */ ge("portal");
990
- function rr(e) {
991
- e === void 0 && (e = {});
992
- const {
993
- id: t,
994
- root: n
995
- } = e, r = $e(), o = Jt(), [s, i] = u.useState(null), a = u.useRef(null);
996
- return Y(() => () => {
997
- s?.remove(), queueMicrotask(() => {
998
- a.current = null;
999
- });
1000
- }, [s]), Y(() => {
1001
- if (!r || a.current) return;
1002
- const c = t ? document.getElementById(t) : null;
1003
- if (!c) return;
1004
- const l = document.createElement("div");
1005
- l.id = r, l.setAttribute(Tt, ""), c.appendChild(l), a.current = l, i(l);
1006
- }, [t, r]), Y(() => {
1007
- if (n === null || !r || a.current) return;
1008
- let c = n || o?.portalNode;
1009
- c && !on(c) && (c = c.current), c = c || document.body;
1010
- let l = null;
1011
- t && (l = document.createElement("div"), l.id = t, c.appendChild(l));
1012
- const v = document.createElement("div");
1013
- v.id = r, v.setAttribute(Tt, ""), c = l || c, c.appendChild(v), a.current = v, i(v);
1014
- }, [t, n, r, o]), s;
1015
- }
1016
- function Sr(e) {
1017
- const {
1018
- children: t,
1019
- id: n,
1020
- root: r,
1021
- preserveTabOrder: o = !0
1022
- } = e, s = rr({
1023
- id: n,
1024
- root: r
1025
- }), [i, a] = u.useState(null), c = u.useRef(null), l = u.useRef(null), v = u.useRef(null), b = u.useRef(null), y = i?.modal, f = i?.open, g = (
1026
- // The FocusManager and therefore floating element are currently open/
1027
- // rendered.
1028
- !!i && // Guards are only for non-modal focus management.
1029
- !i.modal && // Don't render if unmount is transitioning.
1030
- i.open && o && !!(r || s)
1031
- );
1032
- return u.useEffect(() => {
1033
- if (!s || !o || y)
1034
- return;
1035
- function d(w) {
1036
- s && ye(w) && (w.type === "focusin" ? vt : Wn)(s);
1037
- }
1038
- return s.addEventListener("focusin", d, !0), s.addEventListener("focusout", d, !0), () => {
1039
- s.removeEventListener("focusin", d, !0), s.removeEventListener("focusout", d, !0);
1040
- };
1041
- }, [s, o, y]), u.useEffect(() => {
1042
- s && (f || vt(s));
1043
- }, [f, s]), /* @__PURE__ */ nt(zt.Provider, {
1044
- value: u.useMemo(() => ({
1045
- preserveTabOrder: o,
1046
- beforeOutsideRef: c,
1047
- afterOutsideRef: l,
1048
- beforeInsideRef: v,
1049
- afterInsideRef: b,
1050
- portalNode: s,
1051
- setFocusManagerState: a
1052
- }), [o, s]),
1053
- children: [g && s && /* @__PURE__ */ te(De, {
1054
- "data-type": "outside",
1055
- ref: c,
1056
- onFocus: (d) => {
1057
- if (ye(d, s)) {
1058
- var w;
1059
- (w = v.current) == null || w.focus();
1060
- } else {
1061
- const S = i ? i.domReference : null, p = Xt(S);
1062
- p?.focus();
1063
- }
1064
- }
1065
- }), g && s && /* @__PURE__ */ te("span", {
1066
- "aria-owns": s.id,
1067
- style: _e
1068
- }), s && /* @__PURE__ */ rt.createPortal(t, s), g && s && /* @__PURE__ */ te(De, {
1069
- "data-type": "outside",
1070
- ref: l,
1071
- onFocus: (d) => {
1072
- if (ye(d, s)) {
1073
- var w;
1074
- (w = b.current) == null || w.focus();
1075
- } else {
1076
- const S = i ? i.domReference : null, p = Yt(S);
1077
- p?.focus(), i?.closeOnFocusOut && i?.onOpenChange(!1, d.nativeEvent, "focus-out");
1078
- }
1079
- }
1080
- })]
1081
- });
1082
- }
1083
- const Jt = () => u.useContext(zt);
1084
- function St(e) {
1085
- return u.useMemo(() => (t) => {
1086
- e.forEach((n) => {
1087
- n && (n.current = t);
1088
- });
1089
- }, e);
1090
- }
1091
- const or = 20;
1092
- let me = [];
1093
- function ut() {
1094
- me = me.filter((e) => e.isConnected);
1095
- }
1096
- function sr(e) {
1097
- ut(), e && Dt(e) !== "body" && (me.push(e), me.length > or && (me = me.slice(-20)));
1098
- }
1099
- function Ct() {
1100
- return ut(), me[me.length - 1];
1101
- }
1102
- function ir(e) {
1103
- const t = Te();
1104
- return Kt(e, t) ? e : Ne(e, t)[0] || e;
1105
- }
1106
- function It(e, t) {
1107
- var n;
1108
- if (!t.current.includes("floating") && !((n = e.getAttribute("role")) != null && n.includes("dialog")))
1109
- return;
1110
- const r = Te(), s = Sn(e, r).filter((a) => {
1111
- const c = a.getAttribute("data-tabindex") || "";
1112
- return Kt(a, r) || a.hasAttribute("data-tabindex") && !c.startsWith("-");
1113
- }), i = e.getAttribute("tabindex");
1114
- t.current.includes("floating") || s.length === 0 ? i !== "0" && e.setAttribute("tabindex", "0") : (i !== "-1" || e.hasAttribute("data-tabindex") && e.getAttribute("data-tabindex") !== "-1") && (e.setAttribute("tabindex", "-1"), e.setAttribute("data-tabindex", "-1"));
1115
- }
1116
- const ur = /* @__PURE__ */ u.forwardRef(function(t, n) {
1117
- return /* @__PURE__ */ te("button", {
1118
- ...t,
1119
- type: "button",
1120
- ref: n,
1121
- tabIndex: -1,
1122
- style: _e
1123
- });
1124
- });
1125
- function Cr(e) {
1126
- const {
1127
- context: t,
1128
- children: n,
1129
- disabled: r = !1,
1130
- order: o = ["content"],
1131
- guards: s = !0,
1132
- initialFocus: i = 0,
1133
- returnFocus: a = !0,
1134
- restoreFocus: c = !1,
1135
- modal: l = !0,
1136
- visuallyHiddenDismiss: v = !1,
1137
- closeOnFocusOut: b = !0,
1138
- outsideElementsInert: y = !1,
1139
- getInsideElements: f = () => []
1140
- } = e, {
1141
- open: g,
1142
- onOpenChange: d,
1143
- events: w,
1144
- dataRef: S,
1145
- elements: {
1146
- domReference: p,
1147
- floating: R
1148
- }
1149
- } = t, I = J(() => {
1150
- var P;
1151
- return (P = S.current.floatingContext) == null ? void 0 : P.nodeId;
1152
- }), $ = J(f), W = typeof i == "number" && i < 0, F = dt(p) && W, O = er(), X = O ? s : !0, q = !X || O && y, _ = pe(o), K = pe(i), B = pe(a), h = We(), E = Jt(), D = u.useRef(null), x = u.useRef(null), m = u.useRef(!1), C = u.useRef(!1), M = u.useRef(-1), U = u.useRef(-1), k = E != null, T = tt(R), oe = J(function(P) {
1153
- return P === void 0 && (P = T), P ? Ne(P, Te()) : [];
1154
- }), V = J((P) => {
1155
- const L = oe(P);
1156
- return _.current.map((A) => p && A === "reference" ? p : T && A === "floating" ? T : L).filter(Boolean).flat();
1157
- });
1158
- u.useEffect(() => {
1159
- if (r || !l) return;
1160
- function P(A) {
1161
- if (A.key === "Tab") {
1162
- G(T, de(Z(T))) && oe().length === 0 && !F && Ue(A);
1163
- const j = V(), H = ae(A);
1164
- _.current[0] === "reference" && H === p && (Ue(A), A.shiftKey ? be(j[j.length - 1]) : be(j[1])), _.current[1] === "floating" && H === T && A.shiftKey && (Ue(A), be(j[0]));
1165
- }
1166
- }
1167
- const L = Z(T);
1168
- return L.addEventListener("keydown", P), () => {
1169
- L.removeEventListener("keydown", P);
1170
- };
1171
- }, [r, p, T, l, _, F, oe, V]), u.useEffect(() => {
1172
- if (r || !R) return;
1173
- function P(L) {
1174
- const A = ae(L), H = oe().indexOf(A);
1175
- H !== -1 && (M.current = H);
1176
- }
1177
- return R.addEventListener("focusin", P), () => {
1178
- R.removeEventListener("focusin", P);
1179
- };
1180
- }, [r, R, oe]), u.useEffect(() => {
1181
- if (r || !b) return;
1182
- function P() {
1183
- C.current = !0, setTimeout(() => {
1184
- C.current = !1;
1185
- });
1186
- }
1187
- function L(H) {
1188
- const N = H.relatedTarget, ie = H.currentTarget, re = ae(H);
1189
- queueMicrotask(() => {
1190
- const Q = I(), ve = !(G(p, N) || G(R, N) || G(N, R) || G(E?.portalNode, N) || N != null && N.hasAttribute(ge("focus-guard")) || h && (he(h.nodesRef.current, Q).find((le) => {
1191
- var ue, fe;
1192
- return G((ue = le.context) == null ? void 0 : ue.elements.floating, N) || G((fe = le.context) == null ? void 0 : fe.elements.domReference, N);
1193
- }) || mt(h.nodesRef.current, Q).find((le) => {
1194
- var ue, fe, at;
1195
- return [(ue = le.context) == null ? void 0 : ue.elements.floating, tt((fe = le.context) == null ? void 0 : fe.elements.floating)].includes(N) || ((at = le.context) == null ? void 0 : at.elements.domReference) === N;
1196
- })));
1197
- if (ie === p && T && It(T, _), c && ie !== p && !(re != null && re.isConnected) && de(Z(T)) === Z(T).body) {
1198
- se(T) && T.focus();
1199
- const le = M.current, ue = oe(), fe = ue[le] || ue[ue.length - 1] || T;
1200
- se(fe) && fe.focus();
1201
- }
1202
- if (S.current.insideReactTree) {
1203
- S.current.insideReactTree = !1;
1204
- return;
1205
- }
1206
- (F || !l) && N && ve && !C.current && // Fix React 18 Strict Mode returnFocus due to double rendering.
1207
- N !== Ct() && (m.current = !0, d(!1, H, "focus-out"));
1208
- });
1209
- }
1210
- const A = !!(!h && E);
1211
- function j() {
1212
- ee(U), S.current.insideReactTree = !0, U.current = window.setTimeout(() => {
1213
- S.current.insideReactTree = !1;
1214
- });
1215
- }
1216
- if (R && se(p))
1217
- return p.addEventListener("focusout", L), p.addEventListener("pointerdown", P), R.addEventListener("focusout", L), A && R.addEventListener("focusout", j, !0), () => {
1218
- p.removeEventListener("focusout", L), p.removeEventListener("pointerdown", P), R.removeEventListener("focusout", L), A && R.removeEventListener("focusout", j, !0);
1219
- };
1220
- }, [r, p, R, T, l, h, E, d, b, c, oe, F, I, _, S]);
1221
- const ne = u.useRef(null), ce = u.useRef(null), Be = St([ne, E?.beforeInsideRef]), Ve = St([ce, E?.afterInsideRef]);
1222
- u.useEffect(() => {
1223
- var P, L;
1224
- if (r || !R) return;
1225
- const A = Array.from((E == null || (P = E.portalNode) == null ? void 0 : P.querySelectorAll("[" + ge("portal") + "]")) || []), H = (L = (h ? mt(h.nodesRef.current, I()) : []).find((re) => {
1226
- var Q;
1227
- return dt(((Q = re.context) == null ? void 0 : Q.elements.domReference) || null);
1228
- })) == null || (L = L.context) == null ? void 0 : L.elements.domReference, N = [R, H, ...A, ...$(), D.current, x.current, ne.current, ce.current, E?.beforeOutsideRef.current, E?.afterOutsideRef.current, _.current.includes("reference") || F ? p : null].filter((re) => re != null), ie = l || F ? xt(N, !q, q) : xt(N);
1229
- return () => {
1230
- ie();
1231
- };
1232
- }, [r, p, R, l, _, E, F, X, q, h, I, $]), Y(() => {
1233
- if (r || !se(T)) return;
1234
- const P = Z(T), L = de(P);
1235
- queueMicrotask(() => {
1236
- const A = V(T), j = K.current, H = (typeof j == "number" ? A[j] : j.current) || T, N = G(T, L);
1237
- !W && !N && g && be(H, {
1238
- preventScroll: H === T
1239
- });
1240
- });
1241
- }, [r, g, T, W, V, K]), Y(() => {
1242
- if (r || !T) return;
1243
- const P = Z(T), L = de(P);
1244
- sr(L);
1245
- function A(N) {
1246
- let {
1247
- reason: ie,
1248
- event: re,
1249
- nested: Q
1250
- } = N;
1251
- if (["hover", "safe-polygon"].includes(ie) && re.type === "mouseleave" && (m.current = !0), ie === "outside-press")
1252
- if (Q)
1253
- m.current = !1;
1254
- else if (An(re) || Fn(re))
1255
- m.current = !1;
1256
- else {
1257
- let ve = !1;
1258
- document.createElement("div").focus({
1259
- get preventScroll() {
1260
- return ve = !0, !1;
1261
- }
1262
- }), ve ? m.current = !1 : m.current = !0;
1263
- }
1264
- }
1265
- w.on("openchange", A);
1266
- const j = P.createElement("span");
1267
- j.setAttribute("tabindex", "-1"), j.setAttribute("aria-hidden", "true"), Object.assign(j.style, _e), k && p && p.insertAdjacentElement("afterend", j);
1268
- function H() {
1269
- if (typeof B.current == "boolean") {
1270
- const N = p || Ct();
1271
- return N && N.isConnected ? N : j;
1272
- }
1273
- return B.current.current || j;
1274
- }
1275
- return () => {
1276
- w.off("openchange", A);
1277
- const N = de(P), ie = G(R, N) || h && he(h.nodesRef.current, I(), !1).some((Q) => {
1278
- var ve;
1279
- return G((ve = Q.context) == null ? void 0 : ve.elements.floating, N);
1280
- }), re = H();
1281
- queueMicrotask(() => {
1282
- const Q = ir(re);
1283
- // eslint-disable-next-line react-hooks/exhaustive-deps
1284
- B.current && !m.current && se(Q) && // If the focus moved somewhere else after mount, avoid returning focus
1285
- // since it likely entered a different element which should be
1286
- // respected: https://github.com/floating-ui/floating-ui/issues/2607
1287
- (!(Q !== N && N !== P.body) || ie) && Q.focus({
1288
- preventScroll: !0
1289
- }), j.remove();
1290
- });
1291
- };
1292
- }, [r, R, T, B, S, w, h, k, p, I]), u.useEffect(() => (queueMicrotask(() => {
1293
- m.current = !1;
1294
- }), () => {
1295
- queueMicrotask(ut);
1296
- }), [r]), Y(() => {
1297
- if (!r && E)
1298
- return E.setFocusManagerState({
1299
- modal: l,
1300
- closeOnFocusOut: b,
1301
- open: g,
1302
- onOpenChange: d,
1303
- domReference: p
1304
- }), () => {
1305
- E.setFocusManagerState(null);
1306
- };
1307
- }, [r, E, l, g, d, b, p]), Y(() => {
1308
- r || T && It(T, _);
1309
- }, [r, T, _]);
1310
- function Se(P) {
1311
- return r || !v || !l ? null : /* @__PURE__ */ te(ur, {
1312
- ref: P === "start" ? D : x,
1313
- onClick: (L) => d(!1, L.nativeEvent),
1314
- children: typeof v == "string" ? v : "Dismiss"
1315
- });
1316
- }
1317
- const Ce = !r && X && (l ? !F : !0) && (k || l);
1318
- return /* @__PURE__ */ nt(cn, {
1319
- children: [Ce && /* @__PURE__ */ te(De, {
1320
- "data-type": "inside",
1321
- ref: Be,
1322
- onFocus: (P) => {
1323
- if (l) {
1324
- const A = V();
1325
- be(o[0] === "reference" ? A[0] : A[A.length - 1]);
1326
- } else if (E != null && E.preserveTabOrder && E.portalNode)
1327
- if (m.current = !1, ye(P, E.portalNode)) {
1328
- const A = Yt(p);
1329
- A?.focus();
1330
- } else {
1331
- var L;
1332
- (L = E.beforeOutsideRef.current) == null || L.focus();
1333
- }
1334
- }
1335
- }), !F && Se("start"), n, Se("end"), Ce && /* @__PURE__ */ te(De, {
1336
- "data-type": "inside",
1337
- ref: Ve,
1338
- onFocus: (P) => {
1339
- if (l)
1340
- be(V()[0]);
1341
- else if (E != null && E.preserveTabOrder && E.portalNode)
1342
- if (b && (m.current = !0), ye(P, E.portalNode)) {
1343
- const A = Xt(p);
1344
- A?.focus();
1345
- } else {
1346
- var L;
1347
- (L = E.afterOutsideRef.current) == null || L.focus();
1348
- }
1349
- }
1350
- })]
1351
- });
1352
- }
1353
- let Pe = 0;
1354
- const Mt = "--floating-ui-scrollbar-width";
1355
- function ar() {
1356
- const e = ot(), t = /iP(hone|ad|od)|iOS/.test(e) || // iPads can claim to be MacIntel
1357
- e === "MacIntel" && navigator.maxTouchPoints > 1, n = document.body.style, o = Math.round(document.documentElement.getBoundingClientRect().left) + document.documentElement.scrollLeft ? "paddingLeft" : "paddingRight", s = window.innerWidth - document.documentElement.clientWidth, i = n.left ? parseFloat(n.left) : window.scrollX, a = n.top ? parseFloat(n.top) : window.scrollY;
1358
- if (n.overflow = "hidden", n.setProperty(Mt, s + "px"), s && (n[o] = s + "px"), t) {
1359
- var c, l;
1360
- const v = ((c = window.visualViewport) == null ? void 0 : c.offsetLeft) || 0, b = ((l = window.visualViewport) == null ? void 0 : l.offsetTop) || 0;
1361
- Object.assign(n, {
1362
- position: "fixed",
1363
- top: -(a - Math.floor(b)) + "px",
1364
- left: -(i - Math.floor(v)) + "px",
1365
- right: "0"
1366
- });
1367
- }
1368
- return () => {
1369
- Object.assign(n, {
1370
- overflow: "",
1371
- [o]: ""
1372
- }), n.removeProperty(Mt), t && (Object.assign(n, {
1373
- position: "",
1374
- top: "",
1375
- left: "",
1376
- right: ""
1377
- }), window.scrollTo(i, a));
1378
- };
1379
- }
1380
- let Pt = () => {
1381
- };
1382
- const Ir = /* @__PURE__ */ u.forwardRef(function(t, n) {
1383
- const {
1384
- lockScroll: r = !1,
1385
- ...o
1386
- } = t;
1387
- return Y(() => {
1388
- if (r)
1389
- return Pe++, Pe === 1 && (Pt = ar()), () => {
1390
- Pe--, Pe === 0 && Pt();
1391
- };
1392
- }, [r]), /* @__PURE__ */ te("div", {
1393
- ref: n,
1394
- ...o,
1395
- style: {
1396
- position: "fixed",
1397
- overflow: "auto",
1398
- top: 0,
1399
- right: 0,
1400
- bottom: 0,
1401
- left: 0,
1402
- ...o.style
1403
- }
1404
- });
1405
- });
1406
- function kt(e) {
1407
- return se(e.target) && e.target.tagName === "BUTTON";
1408
- }
1409
- function cr(e) {
1410
- return se(e.target) && e.target.tagName === "A";
1411
- }
1412
- function At(e) {
1413
- return st(e);
1414
- }
1415
- function Mr(e, t) {
1416
- t === void 0 && (t = {});
1417
- const {
1418
- open: n,
1419
- onOpenChange: r,
1420
- dataRef: o,
1421
- elements: {
1422
- domReference: s
1423
- }
1424
- } = e, {
1425
- enabled: i = !0,
1426
- event: a = "click",
1427
- toggle: c = !0,
1428
- ignoreMouse: l = !1,
1429
- keyboardHandlers: v = !0,
1430
- stickIfOpen: b = !0
1431
- } = t, y = u.useRef(), f = u.useRef(!1), g = u.useMemo(() => ({
1432
- onPointerDown(d) {
1433
- y.current = d.pointerType;
1434
- },
1435
- onMouseDown(d) {
1436
- const w = y.current;
1437
- d.button === 0 && a !== "click" && (we(w, !0) && l || (n && c && (!(o.current.openEvent && b) || o.current.openEvent.type === "mousedown") ? r(!1, d.nativeEvent, "click") : (d.preventDefault(), r(!0, d.nativeEvent, "click"))));
1438
- },
1439
- onClick(d) {
1440
- const w = y.current;
1441
- if (a === "mousedown" && y.current) {
1442
- y.current = void 0;
1443
- return;
1444
- }
1445
- we(w, !0) && l || (n && c && (!(o.current.openEvent && b) || o.current.openEvent.type === "click") ? r(!1, d.nativeEvent, "click") : r(!0, d.nativeEvent, "click"));
1446
- },
1447
- onKeyDown(d) {
1448
- y.current = void 0, !(d.defaultPrevented || !v || kt(d)) && (d.key === " " && !At(s) && (d.preventDefault(), f.current = !0), !cr(d) && d.key === "Enter" && r(!(n && c), d.nativeEvent, "click"));
1449
- },
1450
- onKeyUp(d) {
1451
- d.defaultPrevented || !v || kt(d) || At(s) || d.key === " " && f.current && (f.current = !1, r(!(n && c), d.nativeEvent, "click"));
1452
- }
1453
- }), [o, s, a, l, v, r, n, b, c]);
1454
- return u.useMemo(() => i ? {
1455
- reference: g
1456
- } : {}, [i, g]);
1457
- }
1458
- const lr = {
1459
- pointerdown: "onPointerDown",
1460
- mousedown: "onMouseDown",
1461
- click: "onClick"
1462
- }, fr = {
1463
- pointerdown: "onPointerDownCapture",
1464
- mousedown: "onMouseDownCapture",
1465
- click: "onClickCapture"
1466
- }, Ft = (e) => {
1467
- var t, n;
1468
- return {
1469
- escapeKey: typeof e == "boolean" ? e : (t = e?.escapeKey) != null ? t : !1,
1470
- outsidePress: typeof e == "boolean" ? e : (n = e?.outsidePress) != null ? n : !0
1471
- };
1472
- };
1473
- function Pr(e, t) {
1474
- t === void 0 && (t = {});
1475
- const {
1476
- open: n,
1477
- onOpenChange: r,
1478
- elements: o,
1479
- dataRef: s
1480
- } = e, {
1481
- enabled: i = !0,
1482
- escapeKey: a = !0,
1483
- outsidePress: c = !0,
1484
- outsidePressEvent: l = "pointerdown",
1485
- referencePress: v = !1,
1486
- referencePressEvent: b = "pointerdown",
1487
- ancestorScroll: y = !1,
1488
- bubbles: f,
1489
- capture: g
1490
- } = t, d = We(), w = J(typeof c == "function" ? c : () => !1), S = typeof c == "function" ? w : c, p = u.useRef(!1), {
1491
- escapeKey: R,
1492
- outsidePress: I
1493
- } = Ft(f), {
1494
- escapeKey: $,
1495
- outsidePress: W
1496
- } = Ft(g), F = u.useRef(!1), O = J((h) => {
1497
- var E;
1498
- if (!n || !i || !a || h.key !== "Escape" || F.current)
1499
- return;
1500
- const D = (E = s.current.floatingContext) == null ? void 0 : E.nodeId, x = d ? he(d.nodesRef.current, D) : [];
1501
- if (!R && (h.stopPropagation(), x.length > 0)) {
1502
- let m = !0;
1503
- if (x.forEach((C) => {
1504
- var M;
1505
- if ((M = C.context) != null && M.open && !C.context.dataRef.current.__escapeKeyBubbles) {
1506
- m = !1;
1507
- return;
1508
- }
1509
- }), !m)
1510
- return;
1511
- }
1512
- r(!1, kn(h) ? h.nativeEvent : h, "escape-key");
1513
- }), X = J((h) => {
1514
- var E;
1515
- const D = () => {
1516
- var x;
1517
- O(h), (x = ae(h)) == null || x.removeEventListener("keydown", D);
1518
- };
1519
- (E = ae(h)) == null || E.addEventListener("keydown", D);
1520
- }), q = J((h) => {
1521
- var E;
1522
- const D = s.current.insideReactTree;
1523
- s.current.insideReactTree = !1;
1524
- const x = p.current;
1525
- if (p.current = !1, l === "click" && x || D || typeof S == "function" && !S(h))
1526
- return;
1527
- const m = ae(h), C = "[" + ge("inert") + "]", M = Z(o.floating).querySelectorAll(C);
1528
- let U = z(m) ? m : null;
1529
- for (; U && !qe(U); ) {
1530
- const V = an(U);
1531
- if (qe(V) || !z(V))
1532
- break;
1533
- U = V;
1534
- }
1535
- if (M.length && z(m) && !Mn(m) && // Clicked on a direct ancestor (e.g. FloatingOverlay).
1536
- !G(m, o.floating) && // If the target root element contains none of the markers, then the
1537
- // element was injected after the floating element rendered.
1538
- Array.from(M).every((V) => !G(U, V)))
1539
- return;
1540
- if (se(m) && B) {
1541
- const V = qe(m), ne = Ot(m), ce = /auto|scroll/, Be = V || ce.test(ne.overflowX), Ve = V || ce.test(ne.overflowY), Se = Be && m.clientWidth > 0 && m.scrollWidth > m.clientWidth, Ce = Ve && m.clientHeight > 0 && m.scrollHeight > m.clientHeight, P = ne.direction === "rtl", L = Ce && (P ? h.offsetX <= m.offsetWidth - m.clientWidth : h.offsetX > m.clientWidth), A = Se && h.offsetY > m.clientHeight;
1542
- if (L || A)
1543
- return;
1544
- }
1545
- const k = (E = s.current.floatingContext) == null ? void 0 : E.nodeId, T = d && he(d.nodesRef.current, k).some((V) => {
1546
- var ne;
1547
- return je(h, (ne = V.context) == null ? void 0 : ne.elements.floating);
1548
- });
1549
- if (je(h, o.floating) || je(h, o.domReference) || T)
1550
- return;
1551
- const oe = d ? he(d.nodesRef.current, k) : [];
1552
- if (oe.length > 0) {
1553
- let V = !0;
1554
- if (oe.forEach((ne) => {
1555
- var ce;
1556
- if ((ce = ne.context) != null && ce.open && !ne.context.dataRef.current.__outsidePressBubbles) {
1557
- V = !1;
1558
- return;
1559
- }
1560
- }), !V)
1561
- return;
1562
- }
1563
- r(!1, h, "outside-press");
1564
- }), _ = J((h) => {
1565
- var E;
1566
- const D = () => {
1567
- var x;
1568
- q(h), (x = ae(h)) == null || x.removeEventListener(l, D);
1569
- };
1570
- (E = ae(h)) == null || E.addEventListener(l, D);
1571
- });
1572
- u.useEffect(() => {
1573
- if (!n || !i)
1574
- return;
1575
- s.current.__escapeKeyBubbles = R, s.current.__outsidePressBubbles = I;
1576
- let h = -1;
1577
- function E(M) {
1578
- r(!1, M, "ancestor-scroll");
1579
- }
1580
- function D() {
1581
- window.clearTimeout(h), F.current = !0;
1582
- }
1583
- function x() {
1584
- h = window.setTimeout(
1585
- () => {
1586
- F.current = !1;
1587
- },
1588
- // 0ms or 1ms don't work in Safari. 5ms appears to consistently work.
1589
- // Only apply to WebKit for the test to remain 0ms.
1590
- un() ? 5 : 0
1591
- );
1592
- }
1593
- const m = Z(o.floating);
1594
- a && (m.addEventListener("keydown", $ ? X : O, $), m.addEventListener("compositionstart", D), m.addEventListener("compositionend", x)), S && m.addEventListener(l, W ? _ : q, W);
1595
- let C = [];
1596
- return y && (z(o.domReference) && (C = Ke(o.domReference)), z(o.floating) && (C = C.concat(Ke(o.floating))), !z(o.reference) && o.reference && o.reference.contextElement && (C = C.concat(Ke(o.reference.contextElement)))), C = C.filter((M) => {
1597
- var U;
1598
- return M !== ((U = m.defaultView) == null ? void 0 : U.visualViewport);
1599
- }), C.forEach((M) => {
1600
- M.addEventListener("scroll", E, {
1601
- passive: !0
1602
- });
1603
- }), () => {
1604
- a && (m.removeEventListener("keydown", $ ? X : O, $), m.removeEventListener("compositionstart", D), m.removeEventListener("compositionend", x)), S && m.removeEventListener(l, W ? _ : q, W), C.forEach((M) => {
1605
- M.removeEventListener("scroll", E);
1606
- }), window.clearTimeout(h);
1607
- };
1608
- }, [s, o, a, S, l, n, r, y, i, R, I, O, $, X, q, W, _]), u.useEffect(() => {
1609
- s.current.insideReactTree = !1;
1610
- }, [s, S, l]);
1611
- const K = u.useMemo(() => ({
1612
- onKeyDown: O,
1613
- ...v && {
1614
- [lr[b]]: (h) => {
1615
- r(!1, h.nativeEvent, "reference-press");
1616
- },
1617
- ...b !== "click" && {
1618
- onClick(h) {
1619
- r(!1, h.nativeEvent, "reference-press");
1620
- }
1621
- }
1622
- }
1623
- }), [O, r, v, b]), B = u.useMemo(() => ({
1624
- onKeyDown: O,
1625
- onMouseDown() {
1626
- p.current = !0;
1627
- },
1628
- onMouseUp() {
1629
- p.current = !0;
1630
- },
1631
- [fr[l]]: () => {
1632
- s.current.insideReactTree = !0;
1633
- }
1634
- }), [O, l, s]);
1635
- return u.useMemo(() => i ? {
1636
- reference: K,
1637
- floating: B
1638
- } : {}, [i, K, B]);
1639
- }
1640
- function dr(e) {
1641
- const {
1642
- open: t = !1,
1643
- onOpenChange: n,
1644
- elements: r
1645
- } = e, o = $e(), s = u.useRef({}), [i] = u.useState(() => Zn()), a = it() != null;
1646
- if (process.env.NODE_ENV !== "production") {
1647
- const f = r.reference;
1648
- f && !z(f) && Gn("Cannot pass a virtual element to the `elements.reference` option,", "as it must be a real DOM element. Use `refs.setPositionReference()`", "instead.");
1649
- }
1650
- const [c, l] = u.useState(r.reference), v = J((f, g, d) => {
1651
- s.current.openEvent = f ? g : void 0, i.emit("openchange", {
1652
- open: f,
1653
- event: g,
1654
- reason: d,
1655
- nested: a
1656
- }), n?.(f, g, d);
1657
- }), b = u.useMemo(() => ({
1658
- setPositionReference: l
1659
- }), []), y = u.useMemo(() => ({
1660
- reference: c || r.reference || null,
1661
- floating: r.floating || null,
1662
- domReference: r.reference
1663
- }), [c, r.reference, r.floating]);
1664
- return u.useMemo(() => ({
1665
- dataRef: s,
1666
- open: t,
1667
- onOpenChange: v,
1668
- elements: y,
1669
- events: i,
1670
- floatingId: o,
1671
- refs: b
1672
- }), [t, v, y, i, o, b]);
1673
- }
1674
- function kr(e) {
1675
- e === void 0 && (e = {});
1676
- const {
1677
- nodeId: t
1678
- } = e, n = dr({
1679
- ...e,
1680
- elements: {
1681
- reference: null,
1682
- floating: null,
1683
- ...e.elements
1684
- }
1685
- }), r = e.rootContext || n, o = r.elements, [s, i] = u.useState(null), [a, c] = u.useState(null), v = o?.domReference || s, b = u.useRef(null), y = We();
1686
- Y(() => {
1687
- v && (b.current = v);
1688
- }, [v]);
1689
- const f = Vn({
1690
- ...e,
1691
- elements: {
1692
- ...o,
1693
- ...a && {
1694
- reference: a
1695
- }
1696
- }
1697
- }), g = u.useCallback((R) => {
1698
- const I = z(R) ? {
1699
- getBoundingClientRect: () => R.getBoundingClientRect(),
1700
- getClientRects: () => R.getClientRects(),
1701
- contextElement: R
1702
- } : R;
1703
- c(I), f.refs.setReference(I);
1704
- }, [f.refs]), d = u.useCallback((R) => {
1705
- (z(R) || R === null) && (b.current = R, i(R)), (z(f.refs.reference.current) || f.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to
1706
- // `null` to support `positionReference` + an unstable `reference`
1707
- // callback ref.
1708
- R !== null && !z(R)) && f.refs.setReference(R);
1709
- }, [f.refs]), w = u.useMemo(() => ({
1710
- ...f.refs,
1711
- setReference: d,
1712
- setPositionReference: g,
1713
- domReference: b
1714
- }), [f.refs, d, g]), S = u.useMemo(() => ({
1715
- ...f.elements,
1716
- domReference: v
1717
- }), [f.elements, v]), p = u.useMemo(() => ({
1718
- ...f,
1719
- ...r,
1720
- refs: w,
1721
- elements: S,
1722
- nodeId: t
1723
- }), [f, w, S, t, r]);
1724
- return Y(() => {
1725
- r.dataRef.current.floatingContext = p;
1726
- const R = y?.nodesRef.current.find((I) => I.id === t);
1727
- R && (R.context = p);
1728
- }), u.useMemo(() => ({
1729
- ...f,
1730
- context: p,
1731
- refs: w,
1732
- elements: S
1733
- }), [f, w, S, p]);
1734
- }
1735
- function Ze() {
1736
- return Cn() && jt();
1737
- }
1738
- function Ar(e, t) {
1739
- t === void 0 && (t = {});
1740
- const {
1741
- open: n,
1742
- onOpenChange: r,
1743
- events: o,
1744
- dataRef: s,
1745
- elements: i
1746
- } = e, {
1747
- enabled: a = !0,
1748
- visibleOnly: c = !0
1749
- } = t, l = u.useRef(!1), v = u.useRef(-1), b = u.useRef(!0);
1750
- u.useEffect(() => {
1751
- if (!a) return;
1752
- const f = sn(i.domReference);
1753
- function g() {
1754
- !n && se(i.domReference) && i.domReference === de(Z(i.domReference)) && (l.current = !0);
1755
- }
1756
- function d() {
1757
- b.current = !0;
1758
- }
1759
- function w() {
1760
- b.current = !1;
1761
- }
1762
- return f.addEventListener("blur", g), Ze() && (f.addEventListener("keydown", d, !0), f.addEventListener("pointerdown", w, !0)), () => {
1763
- f.removeEventListener("blur", g), Ze() && (f.removeEventListener("keydown", d, !0), f.removeEventListener("pointerdown", w, !0));
1764
- };
1765
- }, [i.domReference, n, a]), u.useEffect(() => {
1766
- if (!a) return;
1767
- function f(g) {
1768
- let {
1769
- reason: d
1770
- } = g;
1771
- (d === "reference-press" || d === "escape-key") && (l.current = !0);
1772
- }
1773
- return o.on("openchange", f), () => {
1774
- o.off("openchange", f);
1775
- };
1776
- }, [o, a]), u.useEffect(() => () => {
1777
- ee(v);
1778
- }, []);
1779
- const y = u.useMemo(() => ({
1780
- onMouseLeave() {
1781
- l.current = !1;
1782
- },
1783
- onFocus(f) {
1784
- if (l.current) return;
1785
- const g = ae(f.nativeEvent);
1786
- if (c && z(g)) {
1787
- if (Ze() && !f.relatedTarget) {
1788
- if (!b.current && !st(g))
1789
- return;
1790
- } else if (!Pn(g))
1791
- return;
1792
- }
1793
- r(!0, f.nativeEvent, "focus");
1794
- },
1795
- onBlur(f) {
1796
- l.current = !1;
1797
- const g = f.relatedTarget, d = f.nativeEvent, w = z(g) && g.hasAttribute(ge("focus-guard")) && g.getAttribute("data-type") === "outside";
1798
- v.current = window.setTimeout(() => {
1799
- var S;
1800
- const p = de(i.domReference ? i.domReference.ownerDocument : document);
1801
- !g && p === i.domReference || G((S = s.current.floatingContext) == null ? void 0 : S.refs.floating.current, p) || G(i.domReference, p) || w || r(!1, d, "focus");
1802
- });
1803
- }
1804
- }), [s, i.domReference, r, c]);
1805
- return u.useMemo(() => a ? {
1806
- reference: y
1807
- } : {}, [a, y]);
1808
- }
1809
- function ze(e, t, n) {
1810
- const r = /* @__PURE__ */ new Map(), o = n === "item";
1811
- let s = e;
1812
- if (o && e) {
1813
- const {
1814
- [gt]: i,
1815
- [bt]: a,
1816
- ...c
1817
- } = e;
1818
- s = c;
1819
- }
1820
- return {
1821
- ...n === "floating" && {
1822
- tabIndex: -1,
1823
- [qn]: ""
1824
- },
1825
- ...s,
1826
- ...t.map((i) => {
1827
- const a = i ? i[n] : null;
1828
- return typeof a == "function" ? e ? a(e) : null : a;
1829
- }).concat(e).reduce((i, a) => (a && Object.entries(a).forEach((c) => {
1830
- let [l, v] = c;
1831
- if (!(o && [gt, bt].includes(l)))
1832
- if (l.indexOf("on") === 0) {
1833
- if (r.has(l) || r.set(l, []), typeof v == "function") {
1834
- var b;
1835
- (b = r.get(l)) == null || b.push(v), i[l] = function() {
1836
- for (var y, f = arguments.length, g = new Array(f), d = 0; d < f; d++)
1837
- g[d] = arguments[d];
1838
- return (y = r.get(l)) == null ? void 0 : y.map((w) => w(...g)).find((w) => w !== void 0);
1839
- };
1840
- }
1841
- } else
1842
- i[l] = v;
1843
- }), i), {})
1844
- };
1845
- }
1846
- function Fr(e) {
1847
- e === void 0 && (e = []);
1848
- const t = e.map((a) => a?.reference), n = e.map((a) => a?.floating), r = e.map((a) => a?.item), o = u.useCallback(
1849
- (a) => ze(a, e, "reference"),
1850
- // eslint-disable-next-line react-hooks/exhaustive-deps
1851
- t
1852
- ), s = u.useCallback(
1853
- (a) => ze(a, e, "floating"),
1854
- // eslint-disable-next-line react-hooks/exhaustive-deps
1855
- n
1856
- ), i = u.useCallback(
1857
- (a) => ze(a, e, "item"),
1858
- // eslint-disable-next-line react-hooks/exhaustive-deps
1859
- r
1860
- );
1861
- return u.useMemo(() => ({
1862
- getReferenceProps: o,
1863
- getFloatingProps: s,
1864
- getItemProps: i
1865
- }), [o, s, i]);
1866
- }
1867
- const mr = /* @__PURE__ */ new Map([["select", "listbox"], ["combobox", "listbox"], ["label", !1]]);
1868
- function Lr(e, t) {
1869
- var n, r;
1870
- t === void 0 && (t = {});
1871
- const {
1872
- open: o,
1873
- elements: s,
1874
- floatingId: i
1875
- } = e, {
1876
- enabled: a = !0,
1877
- role: c = "dialog"
1878
- } = t, l = $e(), v = ((n = s.domReference) == null ? void 0 : n.id) || l, b = u.useMemo(() => {
1879
- var p;
1880
- return ((p = tt(s.floating)) == null ? void 0 : p.id) || i;
1881
- }, [s.floating, i]), y = (r = mr.get(c)) != null ? r : c, g = it() != null, d = u.useMemo(() => y === "tooltip" || c === "label" ? {
1882
- ["aria-" + (c === "label" ? "labelledby" : "describedby")]: o ? b : void 0
1883
- } : {
1884
- "aria-expanded": o ? "true" : "false",
1885
- "aria-haspopup": y === "alertdialog" ? "dialog" : y,
1886
- "aria-controls": o ? b : void 0,
1887
- ...y === "listbox" && {
1888
- role: "combobox"
1889
- },
1890
- ...y === "menu" && {
1891
- id: v
1892
- },
1893
- ...y === "menu" && g && {
1894
- role: "menuitem"
1895
- },
1896
- ...c === "select" && {
1897
- "aria-autocomplete": "none"
1898
- },
1899
- ...c === "combobox" && {
1900
- "aria-autocomplete": "list"
1901
- }
1902
- }, [y, b, g, o, v, c]), w = u.useMemo(() => {
1903
- const p = {
1904
- id: b,
1905
- ...y && {
1906
- role: y
1907
- }
1908
- };
1909
- return y === "tooltip" || c === "label" ? p : {
1910
- ...p,
1911
- ...y === "menu" && {
1912
- "aria-labelledby": v
1913
- }
1914
- };
1915
- }, [y, b, v, c]), S = u.useCallback((p) => {
1916
- let {
1917
- active: R,
1918
- selected: I
1919
- } = p;
1920
- const $ = {
1921
- role: "option",
1922
- ...R && {
1923
- id: b + "-fui-option"
1924
- }
1925
- };
1926
- switch (c) {
1927
- case "select":
1928
- case "combobox":
1929
- return {
1930
- ...$,
1931
- "aria-selected": I
1932
- };
1933
- }
1934
- return {};
1935
- }, [b, c]);
1936
- return u.useMemo(() => a ? {
1937
- reference: d,
1938
- floating: w,
1939
- item: S
1940
- } : {}, [a, d, w, S]);
1941
- }
1942
- function vr(e, t) {
1943
- const [n, r] = u.useState(e);
1944
- return e && !n && r(!0), u.useEffect(() => {
1945
- if (!e && n) {
1946
- const o = setTimeout(() => r(!1), t);
1947
- return () => clearTimeout(o);
1948
- }
1949
- }, [e, n, t]), n;
1950
- }
1951
- function Or(e, t) {
1952
- t === void 0 && (t = {});
1953
- const {
1954
- open: n,
1955
- elements: {
1956
- floating: r
1957
- }
1958
- } = e, {
1959
- duration: o = 250
1960
- } = t, i = (typeof o == "number" ? o : o.close) || 0, [a, c] = u.useState("unmounted"), l = vr(n, i);
1961
- return !l && a === "close" && c("unmounted"), Y(() => {
1962
- if (r) {
1963
- if (n) {
1964
- c("initial");
1965
- const v = requestAnimationFrame(() => {
1966
- rt.flushSync(() => {
1967
- c("open");
1968
- });
1969
- });
1970
- return () => {
1971
- cancelAnimationFrame(v);
1972
- };
1973
- }
1974
- c("close");
1975
- }
1976
- }, [n, r]), {
1977
- isMounted: l,
1978
- status: a
1979
- };
1980
- }
1981
- export {
1982
- Cr as F,
1983
- Mr as a,
1984
- Pr as b,
1985
- Lr as c,
1986
- Fr as d,
1987
- wr as e,
1988
- Or as f,
1989
- Ir as g,
1990
- Sr as h,
1991
- Er as i,
1992
- yr as j,
1993
- xr as k,
1994
- Tr as l,
1995
- Ar as m,
1996
- hr as o,
1997
- Rr as s,
1998
- kr as u
1999
- };