@spear-ai/spectral 1.9.1 → 1.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (241) hide show
  1. package/README.md +6 -5
  2. package/dist/.js +113 -239
  3. package/dist/Accordion-CDXdSAST.js +363 -0
  4. package/dist/Accordion.js +3 -498
  5. package/dist/Alert/AlertBase.js +69 -152
  6. package/dist/Alert.js +58 -106
  7. package/dist/AnimatePresence-D-9jXfgI.js +178 -0
  8. package/dist/App.js +6 -6
  9. package/dist/Avatar.js +83 -65
  10. package/dist/Badge.d.ts +1 -3
  11. package/dist/Badge.js +21 -25
  12. package/dist/Button.js +102 -178
  13. package/dist/ButtonGroup/ButtonGroupButton.js +38 -40
  14. package/dist/ButtonGroup.js +55 -59
  15. package/dist/ButtonIcon.js +58 -134
  16. package/dist/Calendar-s4lyijkn.js +3109 -0
  17. package/dist/Checkbox/CheckboxBase.js +94 -126
  18. package/dist/Checkbox.d.ts +1 -1
  19. package/dist/Checkbox.js +40 -105
  20. package/dist/Combobox/ComboboxBase.js +2 -79
  21. package/dist/Combobox.js +106 -172
  22. package/dist/ComboboxBase-D8Nf4xC-.js +491 -0
  23. package/dist/ControlGroup/ControlGroupSelect.d.ts +1 -1
  24. package/dist/ControlGroup/ControlGroupSelect.js +85 -101
  25. package/dist/ControlGroup.js +45 -48
  26. package/dist/DataCard/Card.js +37 -12
  27. package/dist/DataCard.d.ts +1 -1
  28. package/dist/DataCard.js +36 -16
  29. package/dist/DateTimePicker/Calendar.js +2 -2967
  30. package/dist/DateTimePicker/DateTimeDisplayInput.d.ts +1 -1
  31. package/dist/DateTimePicker/DateTimeDisplayInput.js +379 -275
  32. package/dist/DateTimePicker/DateTimeInput.d.ts +1 -1
  33. package/dist/DateTimePicker/DateTimeInput.js +133 -141
  34. package/dist/DateTimePicker/DateTimeUtils.js +2 -2193
  35. package/dist/DateTimePicker/TimePeriodSelect.d.ts +1 -1
  36. package/dist/DateTimePicker/TimePeriodSelect.js +45 -20
  37. package/dist/DateTimePicker/TimePicker.d.ts +1 -1
  38. package/dist/DateTimePicker/TimePicker.js +76 -60
  39. package/dist/DateTimePicker.d.ts +2 -2
  40. package/dist/DateTimePicker.js +87 -205
  41. package/dist/DateTimeUtils-DVvG6H-p.js +2098 -0
  42. package/dist/Dialog.js +74 -74
  43. package/dist/Drawer.js +67 -37
  44. package/dist/HoverCard-CYDsIiVK.js +201 -0
  45. package/dist/HoverCard.d.ts +1 -1
  46. package/dist/HoverCard.js +2 -218
  47. package/dist/Icons/AnalyzeIcon.js +50 -57
  48. package/dist/Icons/AnnotationsIcon.js +20 -15
  49. package/dist/Icons/ApprovedIcon.js +26 -18
  50. package/dist/Icons/ArrowDownIcon.js +20 -6
  51. package/dist/Icons/ArrowUpIcon.js +20 -6
  52. package/dist/Icons/BoxToolIcon.js +17 -12
  53. package/dist/Icons/CalendarIcon.js +43 -20
  54. package/dist/Icons/CheckCircleIcon.js +26 -10
  55. package/dist/Icons/CheckSquareIcon.js +26 -10
  56. package/dist/Icons/CheckmarkIcon.js +22 -9
  57. package/dist/Icons/ChevronDownIcon.js +22 -9
  58. package/dist/Icons/ChevronUpIcon.js +22 -9
  59. package/dist/Icons/ClockIcon.js +26 -18
  60. package/dist/Icons/CloseCircleIcon.js +26 -10
  61. package/dist/Icons/CloseIcon.js +18 -9
  62. package/dist/Icons/DashboardIcon.js +36 -10
  63. package/dist/Icons/DatabaseIcon.js +36 -19
  64. package/dist/Icons/DeleteIcon.js +36 -19
  65. package/dist/Icons/DurationIcon.js +57 -22
  66. package/dist/Icons/EditIcon.js +26 -27
  67. package/dist/Icons/EmailIcon.js +26 -10
  68. package/dist/Icons/EraserIcon.js +41 -25
  69. package/dist/Icons/ErrorIcon.js +27 -11
  70. package/dist/Icons/EyeClosedIcon.js +29 -13
  71. package/dist/Icons/EyeClosedIcon2.js +27 -11
  72. package/dist/Icons/EyeOpenIcon.js +22 -9
  73. package/dist/Icons/FileDownloadIcon.js +43 -20
  74. package/dist/Icons/GoToFirstIcon.js +26 -9
  75. package/dist/Icons/GoToLastIcon.js +26 -9
  76. package/dist/Icons/HarmonicCursorsIcon.js +23 -9
  77. package/dist/Icons/IconBase.d.ts +3 -3
  78. package/dist/Icons/IconBase.js +49 -66
  79. package/dist/Icons/InfoIcon.js +36 -10
  80. package/dist/Icons/KeyboardIcon.js +26 -27
  81. package/dist/Icons/LabelIcon.js +19 -14
  82. package/dist/Icons/LassoIcon.js +36 -28
  83. package/dist/Icons/LineToolIcon.js +48 -39
  84. package/dist/Icons/LiveViewIcon.js +50 -12
  85. package/dist/Icons/LoaderIcon.js +67 -27
  86. package/dist/Icons/LocationIcon.js +26 -27
  87. package/dist/Icons/LogoutIcon.js +20 -15
  88. package/dist/Icons/MeasureIcon.js +78 -25
  89. package/dist/Icons/MessagesIcon.js +33 -18
  90. package/dist/Icons/MetadataIcon.js +20 -15
  91. package/dist/Icons/MinusIcon.d.ts +1 -1
  92. package/dist/Icons/MinusIcon.js +18 -6
  93. package/dist/Icons/OntologyIcon.js +87 -71
  94. package/dist/Icons/PanelIconClose.js +28 -10
  95. package/dist/Icons/PanelIconOpen.js +28 -10
  96. package/dist/Icons/PlayIcon.js +20 -6
  97. package/dist/Icons/PlusIcon.js +20 -14
  98. package/dist/Icons/PolygonIcon.js +50 -39
  99. package/dist/Icons/ProgressCheckIcon.d.ts +5 -0
  100. package/dist/Icons/ProgressCheckIcon.js +58 -0
  101. package/dist/Icons/ResetIcon.js +17 -12
  102. package/dist/Icons/ReviewedIcon.js +36 -19
  103. package/dist/Icons/ScissorsIcon.js +22 -17
  104. package/dist/Icons/SearchIcon.js +26 -9
  105. package/dist/Icons/SettingsIcon.js +26 -27
  106. package/dist/Icons/SortAscendingIcon.js +50 -12
  107. package/dist/Icons/SortAtoZIcon.js +50 -12
  108. package/dist/Icons/SortDescendingIcon.js +50 -12
  109. package/dist/Icons/SortZtoAIcon.js +50 -12
  110. package/dist/Icons/StackIcon.js +26 -9
  111. package/dist/Icons/StarIcon.js +20 -6
  112. package/dist/Icons/TrashIcon.js +17 -12
  113. package/dist/Icons/UndoIcon.js +20 -15
  114. package/dist/Icons/User2Icon.js +26 -10
  115. package/dist/Icons/UserIcon.js +19 -14
  116. package/dist/Icons/WarningIcon.js +19 -14
  117. package/dist/Icons/ZoomAllIcon.js +71 -15
  118. package/dist/Icons/ZoomXIcon.js +36 -10
  119. package/dist/Icons/ZoomYIcon.js +36 -10
  120. package/dist/Icons/index.d.ts +1 -0
  121. package/dist/Icons.js +68 -136
  122. package/dist/IconsAnimated/PanelLeftCloseIcon.js +66 -36
  123. package/dist/IconsAnimated/PanelLeftOpenIcon.js +66 -36
  124. package/dist/IconsAnimated.js +3 -6
  125. package/dist/Input/InputUtils.js +51 -52
  126. package/dist/Input.js +132 -185
  127. package/dist/InputNumeric.d.ts +14 -0
  128. package/dist/InputNumeric.js +137 -0
  129. package/dist/InputOTP-cVn5Bzyp.js +461 -0
  130. package/dist/InputOTP.js +2 -382
  131. package/dist/Kbd.d.ts +1 -1
  132. package/dist/Kbd.js +182 -86
  133. package/dist/Label.js +12 -14
  134. package/dist/MultiSelect/MultiSelectBase.js +331 -403
  135. package/dist/MultiSelect.d.ts +1 -1
  136. package/dist/MultiSelect.js +23 -23
  137. package/dist/Popover.js +28 -32
  138. package/dist/RadioButton.d.ts +17 -0
  139. package/dist/RadioButton.js +33 -0
  140. package/dist/RadioButtonGroup/RadioButtonGroupBase.d.ts +3 -1
  141. package/dist/RadioButtonGroup/RadioButtonGroupBase.js +49 -46
  142. package/dist/RadioButtonGroup.d.ts +1 -1
  143. package/dist/RadioButtonGroup.js +11 -8
  144. package/dist/RadioGroup-w_q6RGEK.js +447 -0
  145. package/dist/RadioGroup.js +2 -505
  146. package/dist/Select.js +163 -186
  147. package/dist/Separator.js +16 -19
  148. package/dist/Skeleton.js +10 -6
  149. package/dist/Slider-BzzZT3Zm.js +490 -0
  150. package/dist/Slider.js +2 -562
  151. package/dist/SpectralProvider.js +8 -5
  152. package/dist/Switch/SwitchBase.js +91 -95
  153. package/dist/Switch-CVzRJ-0n.js +126 -0
  154. package/dist/Switch.d.ts +1 -1
  155. package/dist/Switch.js +2 -134
  156. package/dist/Tabs/TabsBase.js +242 -250
  157. package/dist/Tabs/tabsUtils.js +65 -73
  158. package/dist/Tabs.d.ts +1 -1
  159. package/dist/Tabs.js +73 -103
  160. package/dist/Textarea/TextareaUtils.js +35 -46
  161. package/dist/Textarea.js +83 -160
  162. package/dist/Toast-9zqXxKKO.js +711 -0
  163. package/dist/Toast.js +2 -885
  164. package/dist/Toggle/ToggleBase.js +46 -56
  165. package/dist/Toggle.d.ts +1 -1
  166. package/dist/Toggle.js +52 -62
  167. package/dist/ToggleGroup/ToggleGroupBase.js +128 -104
  168. package/dist/ToggleGroup.d.ts +1 -1
  169. package/dist/ToggleGroup.js +52 -63
  170. package/dist/Tooltip-D1K8kY1y.js +389 -0
  171. package/dist/Tooltip.js +2 -365
  172. package/dist/Tray.js +174 -217
  173. package/dist/chunk-h9knIhTc.js +20 -0
  174. package/dist/clsx-jM1GlMvB.js +16 -0
  175. package/dist/dist-3Af8168y.js +913 -0
  176. package/dist/dist-7HRQ5IKN.js +249 -0
  177. package/dist/dist-B2k1iWFp.js +129 -0
  178. package/dist/dist-B4FgboI8.js +122 -0
  179. package/dist/dist-B4g6zpUF.js +33 -0
  180. package/dist/dist-B9tup-4O.js +216 -0
  181. package/dist/dist-BK1K0g9W.js +29 -0
  182. package/dist/dist-Bfjk-jx9.js +28 -0
  183. package/dist/dist-Bft31cJh.js +65 -0
  184. package/dist/dist-BtdmHAzK.js +190 -0
  185. package/dist/dist-C0Hifjgh.js +1287 -0
  186. package/dist/dist-CGzgmYB9.js +68 -0
  187. package/dist/dist-ClmepHp4.js +10 -0
  188. package/dist/dist-D8Wb_MX9.js +6 -0
  189. package/dist/dist-Dtvmk11N.js +12 -0
  190. package/dist/dist-fW81qjVl.js +677 -0
  191. package/dist/dist-s1uWaZYZ.js +11 -0
  192. package/dist/es2015-YHaMV-St.js +701 -0
  193. package/dist/hooks/useAccordionAutoScroll.js +66 -67
  194. package/dist/hooks/useControllableState.js +14 -13
  195. package/dist/hooks/useConvertToOklch.d.ts +3 -0
  196. package/dist/hooks/useConvertToOklch.d.ts.map +1 -0
  197. package/dist/hooks/useConvertToOklch.js +51 -0
  198. package/dist/hooks/useTheme.js +21 -17
  199. package/dist/index.d.ts +3 -1
  200. package/dist/index.d.ts.map +1 -1
  201. package/dist/main.js +18954 -27224
  202. package/dist/primitives/button.js +39 -41
  203. package/dist/primitives/input-group.js +57 -73
  204. package/dist/primitives/input.js +11 -20
  205. package/dist/primitives/popover.js +34 -28
  206. package/dist/primitives/select.js +70 -138
  207. package/dist/primitives/slot.js +32 -31
  208. package/dist/primitives/textarea.js +10 -16
  209. package/dist/proxy-Dn10Pl_g.js +4920 -0
  210. package/dist/styles/main.css +2 -1
  211. package/dist/styles/spectral.css +1 -1
  212. package/dist/twUtils-VNWgstKL.js +1673 -0
  213. package/dist/use-animation-CBUDycyW.js +57 -0
  214. package/dist/utils/constants.js +4 -4
  215. package/dist/utils/formFieldUtils.js +136 -148
  216. package/dist/utils/sharedUtils.js +26 -7
  217. package/dist/utils/twUtils.js +2 -2919
  218. package/package.json +24 -28
  219. package/dist/ComboboxBase-CxNxYtdT.js +0 -408
  220. package/dist/clsx-OuTLNxxd.js +0 -16
  221. package/dist/index-0ioNhtNM.js +0 -10
  222. package/dist/index-6oYKCvIn.js +0 -677
  223. package/dist/index-BFOf48AQ.js +0 -69
  224. package/dist/index-BZPx6jYI.js +0 -8
  225. package/dist/index-BlHU_t18.js +0 -142
  226. package/dist/index-Bm1RbF6w.js +0 -1037
  227. package/dist/index-Bv2OIg5P.js +0 -225
  228. package/dist/index-CKEI0pDv.js +0 -56
  229. package/dist/index-CM_hWgfC.js +0 -32
  230. package/dist/index-C_YVr64u.js +0 -1538
  231. package/dist/index-Cl8VeY0o.js +0 -149
  232. package/dist/index-CwSyIPrv.js +0 -13
  233. package/dist/index-D29mdTf5.js +0 -34
  234. package/dist/index-DEYs15GP.js +0 -66
  235. package/dist/index-Dc0No4pV.js +0 -233
  236. package/dist/index-T6XEa11q.js +0 -822
  237. package/dist/index-pBCLb6Gr.js +0 -240
  238. package/dist/index-psiVrsnE.js +0 -27
  239. package/dist/index-rKs9bXHr.js +0 -6
  240. package/dist/proxy-CO_-Vget.js +0 -4975
  241. package/dist/use-animation-DhEPRwZ3.js +0 -62
@@ -1,1538 +0,0 @@
1
- import "./styles/main.css";
2
- import * as R from "react";
3
- import { useLayoutEffect as Ae } from "react";
4
- import * as Re from "react-dom";
5
- import { P as At, u as Yt, a as Ce, f as $t } from "./index-Dc0No4pV.js";
6
- import { jsx as j } from "react/jsx-runtime";
7
- import { u as Pe } from "./index-0ioNhtNM.js";
8
- import { u as Oe } from "./index-psiVrsnE.js";
9
- const Se = ["top", "right", "bottom", "left"], Z = Math.min, W = Math.max, at = Math.round, ct = Math.floor, I = (t) => ({
10
- x: t,
11
- y: t
12
- }), Ee = {
13
- left: "right",
14
- right: "left",
15
- bottom: "top",
16
- top: "bottom"
17
- }, Le = {
18
- start: "end",
19
- end: "start"
20
- };
21
- function yt(t, e, n) {
22
- return W(t, Z(e, n));
23
- }
24
- function q(t, e) {
25
- return typeof t == "function" ? t(e) : t;
26
- }
27
- function U(t) {
28
- return t.split("-")[0];
29
- }
30
- function tt(t) {
31
- return t.split("-")[1];
32
- }
33
- function Rt(t) {
34
- return t === "x" ? "y" : "x";
35
- }
36
- function Ct(t) {
37
- return t === "y" ? "height" : "width";
38
- }
39
- const De = /* @__PURE__ */ new Set(["top", "bottom"]);
40
- function z(t) {
41
- return De.has(U(t)) ? "y" : "x";
42
- }
43
- function Pt(t) {
44
- return Rt(z(t));
45
- }
46
- function Me(t, e, n) {
47
- n === void 0 && (n = !1);
48
- const o = tt(t), r = Pt(t), i = Ct(r);
49
- let s = r === "x" ? o === (n ? "end" : "start") ? "right" : "left" : o === "start" ? "bottom" : "top";
50
- return e.reference[i] > e.floating[i] && (s = ft(s)), [s, ft(s)];
51
- }
52
- function Te(t) {
53
- const e = ft(t);
54
- return [vt(t), e, vt(e)];
55
- }
56
- function vt(t) {
57
- return t.replace(/start|end/g, (e) => Le[e]);
58
- }
59
- const kt = ["left", "right"], Ft = ["right", "left"], $e = ["top", "bottom"], ke = ["bottom", "top"];
60
- function Fe(t, e, n) {
61
- switch (t) {
62
- case "top":
63
- case "bottom":
64
- return n ? e ? Ft : kt : e ? kt : Ft;
65
- case "left":
66
- case "right":
67
- return e ? $e : ke;
68
- default:
69
- return [];
70
- }
71
- }
72
- function Ne(t, e, n, o) {
73
- const r = tt(t);
74
- let i = Fe(U(t), n === "start", o);
75
- return r && (i = i.map((s) => s + "-" + r), e && (i = i.concat(i.map(vt)))), i;
76
- }
77
- function ft(t) {
78
- return t.replace(/left|right|bottom|top/g, (e) => Ee[e]);
79
- }
80
- function We(t) {
81
- return {
82
- top: 0,
83
- right: 0,
84
- bottom: 0,
85
- left: 0,
86
- ...t
87
- };
88
- }
89
- function jt(t) {
90
- return typeof t != "number" ? We(t) : {
91
- top: t,
92
- right: t,
93
- bottom: t,
94
- left: t
95
- };
96
- }
97
- function ut(t) {
98
- const {
99
- x: e,
100
- y: n,
101
- width: o,
102
- height: r
103
- } = t;
104
- return {
105
- width: o,
106
- height: r,
107
- top: n,
108
- left: e,
109
- right: e + o,
110
- bottom: n + r,
111
- x: e,
112
- y: n
113
- };
114
- }
115
- function Nt(t, e, n) {
116
- let {
117
- reference: o,
118
- floating: r
119
- } = t;
120
- const i = z(e), s = Pt(e), c = Ct(s), l = U(e), a = i === "y", f = o.x + o.width / 2 - r.width / 2, u = o.y + o.height / 2 - r.height / 2, p = o[c] / 2 - r[c] / 2;
121
- let d;
122
- switch (l) {
123
- case "top":
124
- d = {
125
- x: f,
126
- y: o.y - r.height
127
- };
128
- break;
129
- case "bottom":
130
- d = {
131
- x: f,
132
- y: o.y + o.height
133
- };
134
- break;
135
- case "right":
136
- d = {
137
- x: o.x + o.width,
138
- y: u
139
- };
140
- break;
141
- case "left":
142
- d = {
143
- x: o.x - r.width,
144
- y: u
145
- };
146
- break;
147
- default:
148
- d = {
149
- x: o.x,
150
- y: o.y
151
- };
152
- }
153
- switch (tt(e)) {
154
- case "start":
155
- d[s] -= p * (n && a ? -1 : 1);
156
- break;
157
- case "end":
158
- d[s] += p * (n && a ? -1 : 1);
159
- break;
160
- }
161
- return d;
162
- }
163
- const He = async (t, e, n) => {
164
- const {
165
- placement: o = "bottom",
166
- strategy: r = "absolute",
167
- middleware: i = [],
168
- platform: s
169
- } = n, c = i.filter(Boolean), l = await (s.isRTL == null ? void 0 : s.isRTL(e));
170
- let a = await s.getElementRects({
171
- reference: t,
172
- floating: e,
173
- strategy: r
174
- }), {
175
- x: f,
176
- y: u
177
- } = Nt(a, o, l), p = o, d = {}, m = 0;
178
- for (let h = 0; h < c.length; h++) {
179
- const {
180
- name: w,
181
- fn: g
182
- } = c[h], {
183
- x,
184
- y: b,
185
- data: y,
186
- reset: v
187
- } = await g({
188
- x: f,
189
- y: u,
190
- initialPlacement: o,
191
- placement: p,
192
- strategy: r,
193
- middlewareData: d,
194
- rects: a,
195
- platform: s,
196
- elements: {
197
- reference: t,
198
- floating: e
199
- }
200
- });
201
- f = x ?? f, u = b ?? u, d = {
202
- ...d,
203
- [w]: {
204
- ...d[w],
205
- ...y
206
- }
207
- }, v && m <= 50 && (m++, typeof v == "object" && (v.placement && (p = v.placement), v.rects && (a = v.rects === !0 ? await s.getElementRects({
208
- reference: t,
209
- floating: e,
210
- strategy: r
211
- }) : v.rects), {
212
- x: f,
213
- y: u
214
- } = Nt(a, p, l)), h = -1);
215
- }
216
- return {
217
- x: f,
218
- y: u,
219
- placement: p,
220
- strategy: r,
221
- middlewareData: d
222
- };
223
- };
224
- async function ot(t, e) {
225
- var n;
226
- e === void 0 && (e = {});
227
- const {
228
- x: o,
229
- y: r,
230
- platform: i,
231
- rects: s,
232
- elements: c,
233
- strategy: l
234
- } = t, {
235
- boundary: a = "clippingAncestors",
236
- rootBoundary: f = "viewport",
237
- elementContext: u = "floating",
238
- altBoundary: p = !1,
239
- padding: d = 0
240
- } = q(e, t), m = jt(d), w = c[p ? u === "floating" ? "reference" : "floating" : u], g = ut(await i.getClippingRect({
241
- element: (n = await (i.isElement == null ? void 0 : i.isElement(w))) == null || n ? w : w.contextElement || await (i.getDocumentElement == null ? void 0 : i.getDocumentElement(c.floating)),
242
- boundary: a,
243
- rootBoundary: f,
244
- strategy: l
245
- })), x = u === "floating" ? {
246
- x: o,
247
- y: r,
248
- width: s.floating.width,
249
- height: s.floating.height
250
- } : s.reference, b = await (i.getOffsetParent == null ? void 0 : i.getOffsetParent(c.floating)), y = await (i.isElement == null ? void 0 : i.isElement(b)) ? await (i.getScale == null ? void 0 : i.getScale(b)) || {
251
- x: 1,
252
- y: 1
253
- } : {
254
- x: 1,
255
- y: 1
256
- }, v = ut(i.convertOffsetParentRelativeRectToViewportRelativeRect ? await i.convertOffsetParentRelativeRectToViewportRelativeRect({
257
- elements: c,
258
- rect: x,
259
- offsetParent: b,
260
- strategy: l
261
- }) : x);
262
- return {
263
- top: (g.top - v.top + m.top) / y.y,
264
- bottom: (v.bottom - g.bottom + m.bottom) / y.y,
265
- left: (g.left - v.left + m.left) / y.x,
266
- right: (v.right - g.right + m.right) / y.x
267
- };
268
- }
269
- const _e = (t) => ({
270
- name: "arrow",
271
- options: t,
272
- async fn(e) {
273
- const {
274
- x: n,
275
- y: o,
276
- placement: r,
277
- rects: i,
278
- platform: s,
279
- elements: c,
280
- middlewareData: l
281
- } = e, {
282
- element: a,
283
- padding: f = 0
284
- } = q(t, e) || {};
285
- if (a == null)
286
- return {};
287
- const u = jt(f), p = {
288
- x: n,
289
- y: o
290
- }, d = Pt(r), m = Ct(d), h = await s.getDimensions(a), w = d === "y", g = w ? "top" : "left", x = w ? "bottom" : "right", b = w ? "clientHeight" : "clientWidth", y = i.reference[m] + i.reference[d] - p[d] - i.floating[m], v = p[d] - i.reference[d], P = await (s.getOffsetParent == null ? void 0 : s.getOffsetParent(a));
291
- let C = P ? P[b] : 0;
292
- (!C || !await (s.isElement == null ? void 0 : s.isElement(P))) && (C = c.floating[b] || i.floating[m]);
293
- const M = y / 2 - v / 2, F = C / 2 - h[m] / 2 - 1, D = Z(u[g], F), $ = Z(u[x], F), k = D, S = C - h[m] - $, O = C / 2 - h[m] / 2 + M, N = yt(k, O, S), E = !l.arrow && tt(r) != null && O !== N && i.reference[m] / 2 - (O < k ? D : $) - h[m] / 2 < 0, L = E ? O < k ? O - k : O - S : 0;
294
- return {
295
- [d]: p[d] + L,
296
- data: {
297
- [d]: N,
298
- centerOffset: O - N - L,
299
- ...E && {
300
- alignmentOffset: L
301
- }
302
- },
303
- reset: E
304
- };
305
- }
306
- }), Be = function(t) {
307
- return t === void 0 && (t = {}), {
308
- name: "flip",
309
- options: t,
310
- async fn(e) {
311
- var n, o;
312
- const {
313
- placement: r,
314
- middlewareData: i,
315
- rects: s,
316
- initialPlacement: c,
317
- platform: l,
318
- elements: a
319
- } = e, {
320
- mainAxis: f = !0,
321
- crossAxis: u = !0,
322
- fallbackPlacements: p,
323
- fallbackStrategy: d = "bestFit",
324
- fallbackAxisSideDirection: m = "none",
325
- flipAlignment: h = !0,
326
- ...w
327
- } = q(t, e);
328
- if ((n = i.arrow) != null && n.alignmentOffset)
329
- return {};
330
- const g = U(r), x = z(c), b = U(c) === c, y = await (l.isRTL == null ? void 0 : l.isRTL(a.floating)), v = p || (b || !h ? [ft(c)] : Te(c)), P = m !== "none";
331
- !p && P && v.push(...Ne(c, h, m, y));
332
- const C = [c, ...v], M = await ot(e, w), F = [];
333
- let D = ((o = i.flip) == null ? void 0 : o.overflows) || [];
334
- if (f && F.push(M[g]), u) {
335
- const O = Me(r, s, y);
336
- F.push(M[O[0]], M[O[1]]);
337
- }
338
- if (D = [...D, {
339
- placement: r,
340
- overflows: F
341
- }], !F.every((O) => O <= 0)) {
342
- var $, k;
343
- const O = ((($ = i.flip) == null ? void 0 : $.index) || 0) + 1, N = C[O];
344
- if (N && (!(u === "alignment" ? x !== z(N) : !1) || // We leave the current main axis only if every placement on that axis
345
- // overflows the main axis.
346
- D.every((A) => z(A.placement) === x ? A.overflows[0] > 0 : !0)))
347
- return {
348
- data: {
349
- index: O,
350
- overflows: D
351
- },
352
- reset: {
353
- placement: N
354
- }
355
- };
356
- let E = (k = D.filter((L) => L.overflows[0] <= 0).sort((L, A) => L.overflows[1] - A.overflows[1])[0]) == null ? void 0 : k.placement;
357
- if (!E)
358
- switch (d) {
359
- case "bestFit": {
360
- var S;
361
- const L = (S = D.filter((A) => {
362
- if (P) {
363
- const T = z(A.placement);
364
- return T === x || // Create a bias to the `y` side axis due to horizontal
365
- // reading directions favoring greater width.
366
- T === "y";
367
- }
368
- return !0;
369
- }).map((A) => [A.placement, A.overflows.filter((T) => T > 0).reduce((T, V) => T + V, 0)]).sort((A, T) => A[1] - T[1])[0]) == null ? void 0 : S[0];
370
- L && (E = L);
371
- break;
372
- }
373
- case "initialPlacement":
374
- E = c;
375
- break;
376
- }
377
- if (r !== E)
378
- return {
379
- reset: {
380
- placement: E
381
- }
382
- };
383
- }
384
- return {};
385
- }
386
- };
387
- };
388
- function Wt(t, e) {
389
- return {
390
- top: t.top - e.height,
391
- right: t.right - e.width,
392
- bottom: t.bottom - e.height,
393
- left: t.left - e.width
394
- };
395
- }
396
- function Ht(t) {
397
- return Se.some((e) => t[e] >= 0);
398
- }
399
- const Ve = function(t) {
400
- return t === void 0 && (t = {}), {
401
- name: "hide",
402
- options: t,
403
- async fn(e) {
404
- const {
405
- rects: n
406
- } = e, {
407
- strategy: o = "referenceHidden",
408
- ...r
409
- } = q(t, e);
410
- switch (o) {
411
- case "referenceHidden": {
412
- const i = await ot(e, {
413
- ...r,
414
- elementContext: "reference"
415
- }), s = Wt(i, n.reference);
416
- return {
417
- data: {
418
- referenceHiddenOffsets: s,
419
- referenceHidden: Ht(s)
420
- }
421
- };
422
- }
423
- case "escaped": {
424
- const i = await ot(e, {
425
- ...r,
426
- altBoundary: !0
427
- }), s = Wt(i, n.floating);
428
- return {
429
- data: {
430
- escapedOffsets: s,
431
- escaped: Ht(s)
432
- }
433
- };
434
- }
435
- default:
436
- return {};
437
- }
438
- }
439
- };
440
- }, qt = /* @__PURE__ */ new Set(["left", "top"]);
441
- async function ze(t, e) {
442
- const {
443
- placement: n,
444
- platform: o,
445
- elements: r
446
- } = t, i = await (o.isRTL == null ? void 0 : o.isRTL(r.floating)), s = U(n), c = tt(n), l = z(n) === "y", a = qt.has(s) ? -1 : 1, f = i && l ? -1 : 1, u = q(e, t);
447
- let {
448
- mainAxis: p,
449
- crossAxis: d,
450
- alignmentAxis: m
451
- } = typeof u == "number" ? {
452
- mainAxis: u,
453
- crossAxis: 0,
454
- alignmentAxis: null
455
- } : {
456
- mainAxis: u.mainAxis || 0,
457
- crossAxis: u.crossAxis || 0,
458
- alignmentAxis: u.alignmentAxis
459
- };
460
- return c && typeof m == "number" && (d = c === "end" ? m * -1 : m), l ? {
461
- x: d * f,
462
- y: p * a
463
- } : {
464
- x: p * a,
465
- y: d * f
466
- };
467
- }
468
- const Ie = function(t) {
469
- return t === void 0 && (t = 0), {
470
- name: "offset",
471
- options: t,
472
- async fn(e) {
473
- var n, o;
474
- const {
475
- x: r,
476
- y: i,
477
- placement: s,
478
- middlewareData: c
479
- } = e, l = await ze(e, t);
480
- return s === ((n = c.offset) == null ? void 0 : n.placement) && (o = c.arrow) != null && o.alignmentOffset ? {} : {
481
- x: r + l.x,
482
- y: i + l.y,
483
- data: {
484
- ...l,
485
- placement: s
486
- }
487
- };
488
- }
489
- };
490
- }, Xe = function(t) {
491
- return t === void 0 && (t = {}), {
492
- name: "shift",
493
- options: t,
494
- async fn(e) {
495
- const {
496
- x: n,
497
- y: o,
498
- placement: r
499
- } = e, {
500
- mainAxis: i = !0,
501
- crossAxis: s = !1,
502
- limiter: c = {
503
- fn: (w) => {
504
- let {
505
- x: g,
506
- y: x
507
- } = w;
508
- return {
509
- x: g,
510
- y: x
511
- };
512
- }
513
- },
514
- ...l
515
- } = q(t, e), a = {
516
- x: n,
517
- y: o
518
- }, f = await ot(e, l), u = z(U(r)), p = Rt(u);
519
- let d = a[p], m = a[u];
520
- if (i) {
521
- const w = p === "y" ? "top" : "left", g = p === "y" ? "bottom" : "right", x = d + f[w], b = d - f[g];
522
- d = yt(x, d, b);
523
- }
524
- if (s) {
525
- const w = u === "y" ? "top" : "left", g = u === "y" ? "bottom" : "right", x = m + f[w], b = m - f[g];
526
- m = yt(x, m, b);
527
- }
528
- const h = c.fn({
529
- ...e,
530
- [p]: d,
531
- [u]: m
532
- });
533
- return {
534
- ...h,
535
- data: {
536
- x: h.x - n,
537
- y: h.y - o,
538
- enabled: {
539
- [p]: i,
540
- [u]: s
541
- }
542
- }
543
- };
544
- }
545
- };
546
- }, Ye = function(t) {
547
- return t === void 0 && (t = {}), {
548
- options: t,
549
- fn(e) {
550
- const {
551
- x: n,
552
- y: o,
553
- placement: r,
554
- rects: i,
555
- middlewareData: s
556
- } = e, {
557
- offset: c = 0,
558
- mainAxis: l = !0,
559
- crossAxis: a = !0
560
- } = q(t, e), f = {
561
- x: n,
562
- y: o
563
- }, u = z(r), p = Rt(u);
564
- let d = f[p], m = f[u];
565
- const h = q(c, e), w = typeof h == "number" ? {
566
- mainAxis: h,
567
- crossAxis: 0
568
- } : {
569
- mainAxis: 0,
570
- crossAxis: 0,
571
- ...h
572
- };
573
- if (l) {
574
- const b = p === "y" ? "height" : "width", y = i.reference[p] - i.floating[b] + w.mainAxis, v = i.reference[p] + i.reference[b] - w.mainAxis;
575
- d < y ? d = y : d > v && (d = v);
576
- }
577
- if (a) {
578
- var g, x;
579
- const b = p === "y" ? "width" : "height", y = qt.has(U(r)), v = i.reference[u] - i.floating[b] + (y && ((g = s.offset) == null ? void 0 : g[u]) || 0) + (y ? 0 : w.crossAxis), P = i.reference[u] + i.reference[b] + (y ? 0 : ((x = s.offset) == null ? void 0 : x[u]) || 0) - (y ? w.crossAxis : 0);
580
- m < v ? m = v : m > P && (m = P);
581
- }
582
- return {
583
- [p]: d,
584
- [u]: m
585
- };
586
- }
587
- };
588
- }, je = function(t) {
589
- return t === void 0 && (t = {}), {
590
- name: "size",
591
- options: t,
592
- async fn(e) {
593
- var n, o;
594
- const {
595
- placement: r,
596
- rects: i,
597
- platform: s,
598
- elements: c
599
- } = e, {
600
- apply: l = () => {
601
- },
602
- ...a
603
- } = q(t, e), f = await ot(e, a), u = U(r), p = tt(r), d = z(r) === "y", {
604
- width: m,
605
- height: h
606
- } = i.floating;
607
- let w, g;
608
- u === "top" || u === "bottom" ? (w = u, g = p === (await (s.isRTL == null ? void 0 : s.isRTL(c.floating)) ? "start" : "end") ? "left" : "right") : (g = u, w = p === "end" ? "top" : "bottom");
609
- const x = h - f.top - f.bottom, b = m - f.left - f.right, y = Z(h - f[w], x), v = Z(m - f[g], b), P = !e.middlewareData.shift;
610
- let C = y, M = v;
611
- if ((n = e.middlewareData.shift) != null && n.enabled.x && (M = b), (o = e.middlewareData.shift) != null && o.enabled.y && (C = x), P && !p) {
612
- const D = W(f.left, 0), $ = W(f.right, 0), k = W(f.top, 0), S = W(f.bottom, 0);
613
- d ? M = m - 2 * (D !== 0 || $ !== 0 ? D + $ : W(f.left, f.right)) : C = h - 2 * (k !== 0 || S !== 0 ? k + S : W(f.top, f.bottom));
614
- }
615
- await l({
616
- ...e,
617
- availableWidth: M,
618
- availableHeight: C
619
- });
620
- const F = await s.getDimensions(c.floating);
621
- return m !== F.width || h !== F.height ? {
622
- reset: {
623
- rects: !0
624
- }
625
- } : {};
626
- }
627
- };
628
- };
629
- function mt() {
630
- return typeof window < "u";
631
- }
632
- function et(t) {
633
- return Ut(t) ? (t.nodeName || "").toLowerCase() : "#document";
634
- }
635
- function H(t) {
636
- var e;
637
- return (t == null || (e = t.ownerDocument) == null ? void 0 : e.defaultView) || window;
638
- }
639
- function Y(t) {
640
- var e;
641
- return (e = (Ut(t) ? t.ownerDocument : t.document) || window.document) == null ? void 0 : e.documentElement;
642
- }
643
- function Ut(t) {
644
- return mt() ? t instanceof Node || t instanceof H(t).Node : !1;
645
- }
646
- function _(t) {
647
- return mt() ? t instanceof Element || t instanceof H(t).Element : !1;
648
- }
649
- function X(t) {
650
- return mt() ? t instanceof HTMLElement || t instanceof H(t).HTMLElement : !1;
651
- }
652
- function _t(t) {
653
- return !mt() || typeof ShadowRoot > "u" ? !1 : t instanceof ShadowRoot || t instanceof H(t).ShadowRoot;
654
- }
655
- const qe = /* @__PURE__ */ new Set(["inline", "contents"]);
656
- function it(t) {
657
- const {
658
- overflow: e,
659
- overflowX: n,
660
- overflowY: o,
661
- display: r
662
- } = B(t);
663
- return /auto|scroll|overlay|hidden|clip/.test(e + o + n) && !qe.has(r);
664
- }
665
- const Ue = /* @__PURE__ */ new Set(["table", "td", "th"]);
666
- function Ze(t) {
667
- return Ue.has(et(t));
668
- }
669
- const Ke = [":popover-open", ":modal"];
670
- function pt(t) {
671
- return Ke.some((e) => {
672
- try {
673
- return t.matches(e);
674
- } catch {
675
- return !1;
676
- }
677
- });
678
- }
679
- const Ge = ["transform", "translate", "scale", "rotate", "perspective"], Je = ["transform", "translate", "scale", "rotate", "perspective", "filter"], Qe = ["paint", "layout", "strict", "content"];
680
- function Ot(t) {
681
- const e = St(), n = _(t) ? B(t) : t;
682
- return Ge.some((o) => n[o] ? n[o] !== "none" : !1) || (n.containerType ? n.containerType !== "normal" : !1) || !e && (n.backdropFilter ? n.backdropFilter !== "none" : !1) || !e && (n.filter ? n.filter !== "none" : !1) || Je.some((o) => (n.willChange || "").includes(o)) || Qe.some((o) => (n.contain || "").includes(o));
683
- }
684
- function tn(t) {
685
- let e = K(t);
686
- for (; X(e) && !Q(e); ) {
687
- if (Ot(e))
688
- return e;
689
- if (pt(e))
690
- return null;
691
- e = K(e);
692
- }
693
- return null;
694
- }
695
- function St() {
696
- return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
697
- }
698
- const en = /* @__PURE__ */ new Set(["html", "body", "#document"]);
699
- function Q(t) {
700
- return en.has(et(t));
701
- }
702
- function B(t) {
703
- return H(t).getComputedStyle(t);
704
- }
705
- function ht(t) {
706
- return _(t) ? {
707
- scrollLeft: t.scrollLeft,
708
- scrollTop: t.scrollTop
709
- } : {
710
- scrollLeft: t.scrollX,
711
- scrollTop: t.scrollY
712
- };
713
- }
714
- function K(t) {
715
- if (et(t) === "html")
716
- return t;
717
- const e = (
718
- // Step into the shadow DOM of the parent of a slotted node.
719
- t.assignedSlot || // DOM Element detected.
720
- t.parentNode || // ShadowRoot detected.
721
- _t(t) && t.host || // Fallback.
722
- Y(t)
723
- );
724
- return _t(e) ? e.host : e;
725
- }
726
- function Zt(t) {
727
- const e = K(t);
728
- return Q(e) ? t.ownerDocument ? t.ownerDocument.body : t.body : X(e) && it(e) ? e : Zt(e);
729
- }
730
- function rt(t, e, n) {
731
- var o;
732
- e === void 0 && (e = []), n === void 0 && (n = !0);
733
- const r = Zt(t), i = r === ((o = t.ownerDocument) == null ? void 0 : o.body), s = H(r);
734
- if (i) {
735
- const c = bt(s);
736
- return e.concat(s, s.visualViewport || [], it(r) ? r : [], c && n ? rt(c) : []);
737
- }
738
- return e.concat(r, rt(r, [], n));
739
- }
740
- function bt(t) {
741
- return t.parent && Object.getPrototypeOf(t.parent) ? t.frameElement : null;
742
- }
743
- function Kt(t) {
744
- const e = B(t);
745
- let n = parseFloat(e.width) || 0, o = parseFloat(e.height) || 0;
746
- const r = X(t), i = r ? t.offsetWidth : n, s = r ? t.offsetHeight : o, c = at(n) !== i || at(o) !== s;
747
- return c && (n = i, o = s), {
748
- width: n,
749
- height: o,
750
- $: c
751
- };
752
- }
753
- function Et(t) {
754
- return _(t) ? t : t.contextElement;
755
- }
756
- function J(t) {
757
- const e = Et(t);
758
- if (!X(e))
759
- return I(1);
760
- const n = e.getBoundingClientRect(), {
761
- width: o,
762
- height: r,
763
- $: i
764
- } = Kt(e);
765
- let s = (i ? at(n.width) : n.width) / o, c = (i ? at(n.height) : n.height) / r;
766
- return (!s || !Number.isFinite(s)) && (s = 1), (!c || !Number.isFinite(c)) && (c = 1), {
767
- x: s,
768
- y: c
769
- };
770
- }
771
- const nn = /* @__PURE__ */ I(0);
772
- function Gt(t) {
773
- const e = H(t);
774
- return !St() || !e.visualViewport ? nn : {
775
- x: e.visualViewport.offsetLeft,
776
- y: e.visualViewport.offsetTop
777
- };
778
- }
779
- function on(t, e, n) {
780
- return e === void 0 && (e = !1), !n || e && n !== H(t) ? !1 : e;
781
- }
782
- function G(t, e, n, o) {
783
- e === void 0 && (e = !1), n === void 0 && (n = !1);
784
- const r = t.getBoundingClientRect(), i = Et(t);
785
- let s = I(1);
786
- e && (o ? _(o) && (s = J(o)) : s = J(t));
787
- const c = on(i, n, o) ? Gt(i) : I(0);
788
- let l = (r.left + c.x) / s.x, a = (r.top + c.y) / s.y, f = r.width / s.x, u = r.height / s.y;
789
- if (i) {
790
- const p = H(i), d = o && _(o) ? H(o) : o;
791
- let m = p, h = bt(m);
792
- for (; h && o && d !== m; ) {
793
- const w = J(h), g = h.getBoundingClientRect(), x = B(h), b = g.left + (h.clientLeft + parseFloat(x.paddingLeft)) * w.x, y = g.top + (h.clientTop + parseFloat(x.paddingTop)) * w.y;
794
- l *= w.x, a *= w.y, f *= w.x, u *= w.y, l += b, a += y, m = H(h), h = bt(m);
795
- }
796
- }
797
- return ut({
798
- width: f,
799
- height: u,
800
- x: l,
801
- y: a
802
- });
803
- }
804
- function gt(t, e) {
805
- const n = ht(t).scrollLeft;
806
- return e ? e.left + n : G(Y(t)).left + n;
807
- }
808
- function Jt(t, e) {
809
- const n = t.getBoundingClientRect(), o = n.left + e.scrollLeft - gt(t, n), r = n.top + e.scrollTop;
810
- return {
811
- x: o,
812
- y: r
813
- };
814
- }
815
- function rn(t) {
816
- let {
817
- elements: e,
818
- rect: n,
819
- offsetParent: o,
820
- strategy: r
821
- } = t;
822
- const i = r === "fixed", s = Y(o), c = e ? pt(e.floating) : !1;
823
- if (o === s || c && i)
824
- return n;
825
- let l = {
826
- scrollLeft: 0,
827
- scrollTop: 0
828
- }, a = I(1);
829
- const f = I(0), u = X(o);
830
- if ((u || !u && !i) && ((et(o) !== "body" || it(s)) && (l = ht(o)), X(o))) {
831
- const d = G(o);
832
- a = J(o), f.x = d.x + o.clientLeft, f.y = d.y + o.clientTop;
833
- }
834
- const p = s && !u && !i ? Jt(s, l) : I(0);
835
- return {
836
- width: n.width * a.x,
837
- height: n.height * a.y,
838
- x: n.x * a.x - l.scrollLeft * a.x + f.x + p.x,
839
- y: n.y * a.y - l.scrollTop * a.y + f.y + p.y
840
- };
841
- }
842
- function sn(t) {
843
- return Array.from(t.getClientRects());
844
- }
845
- function cn(t) {
846
- const e = Y(t), n = ht(t), o = t.ownerDocument.body, r = W(e.scrollWidth, e.clientWidth, o.scrollWidth, o.clientWidth), i = W(e.scrollHeight, e.clientHeight, o.scrollHeight, o.clientHeight);
847
- let s = -n.scrollLeft + gt(t);
848
- const c = -n.scrollTop;
849
- return B(o).direction === "rtl" && (s += W(e.clientWidth, o.clientWidth) - r), {
850
- width: r,
851
- height: i,
852
- x: s,
853
- y: c
854
- };
855
- }
856
- const Bt = 25;
857
- function ln(t, e) {
858
- const n = H(t), o = Y(t), r = n.visualViewport;
859
- let i = o.clientWidth, s = o.clientHeight, c = 0, l = 0;
860
- if (r) {
861
- i = r.width, s = r.height;
862
- const f = St();
863
- (!f || f && e === "fixed") && (c = r.offsetLeft, l = r.offsetTop);
864
- }
865
- const a = gt(o);
866
- if (a <= 0) {
867
- const f = o.ownerDocument, u = f.body, p = getComputedStyle(u), d = f.compatMode === "CSS1Compat" && parseFloat(p.marginLeft) + parseFloat(p.marginRight) || 0, m = Math.abs(o.clientWidth - u.clientWidth - d);
868
- m <= Bt && (i -= m);
869
- } else a <= Bt && (i += a);
870
- return {
871
- width: i,
872
- height: s,
873
- x: c,
874
- y: l
875
- };
876
- }
877
- const an = /* @__PURE__ */ new Set(["absolute", "fixed"]);
878
- function fn(t, e) {
879
- const n = G(t, !0, e === "fixed"), o = n.top + t.clientTop, r = n.left + t.clientLeft, i = X(t) ? J(t) : I(1), s = t.clientWidth * i.x, c = t.clientHeight * i.y, l = r * i.x, a = o * i.y;
880
- return {
881
- width: s,
882
- height: c,
883
- x: l,
884
- y: a
885
- };
886
- }
887
- function Vt(t, e, n) {
888
- let o;
889
- if (e === "viewport")
890
- o = ln(t, n);
891
- else if (e === "document")
892
- o = cn(Y(t));
893
- else if (_(e))
894
- o = fn(e, n);
895
- else {
896
- const r = Gt(t);
897
- o = {
898
- x: e.x - r.x,
899
- y: e.y - r.y,
900
- width: e.width,
901
- height: e.height
902
- };
903
- }
904
- return ut(o);
905
- }
906
- function Qt(t, e) {
907
- const n = K(t);
908
- return n === e || !_(n) || Q(n) ? !1 : B(n).position === "fixed" || Qt(n, e);
909
- }
910
- function un(t, e) {
911
- const n = e.get(t);
912
- if (n)
913
- return n;
914
- let o = rt(t, [], !1).filter((c) => _(c) && et(c) !== "body"), r = null;
915
- const i = B(t).position === "fixed";
916
- let s = i ? K(t) : t;
917
- for (; _(s) && !Q(s); ) {
918
- const c = B(s), l = Ot(s);
919
- !l && c.position === "fixed" && (r = null), (i ? !l && !r : !l && c.position === "static" && !!r && an.has(r.position) || it(s) && !l && Qt(t, s)) ? o = o.filter((f) => f !== s) : r = c, s = K(s);
920
- }
921
- return e.set(t, o), o;
922
- }
923
- function dn(t) {
924
- let {
925
- element: e,
926
- boundary: n,
927
- rootBoundary: o,
928
- strategy: r
929
- } = t;
930
- const s = [...n === "clippingAncestors" ? pt(e) ? [] : un(e, this._c) : [].concat(n), o], c = s[0], l = s.reduce((a, f) => {
931
- const u = Vt(e, f, r);
932
- return a.top = W(u.top, a.top), a.right = Z(u.right, a.right), a.bottom = Z(u.bottom, a.bottom), a.left = W(u.left, a.left), a;
933
- }, Vt(e, c, r));
934
- return {
935
- width: l.right - l.left,
936
- height: l.bottom - l.top,
937
- x: l.left,
938
- y: l.top
939
- };
940
- }
941
- function mn(t) {
942
- const {
943
- width: e,
944
- height: n
945
- } = Kt(t);
946
- return {
947
- width: e,
948
- height: n
949
- };
950
- }
951
- function pn(t, e, n) {
952
- const o = X(e), r = Y(e), i = n === "fixed", s = G(t, !0, i, e);
953
- let c = {
954
- scrollLeft: 0,
955
- scrollTop: 0
956
- };
957
- const l = I(0);
958
- function a() {
959
- l.x = gt(r);
960
- }
961
- if (o || !o && !i)
962
- if ((et(e) !== "body" || it(r)) && (c = ht(e)), o) {
963
- const d = G(e, !0, i, e);
964
- l.x = d.x + e.clientLeft, l.y = d.y + e.clientTop;
965
- } else r && a();
966
- i && !o && r && a();
967
- const f = r && !o && !i ? Jt(r, c) : I(0), u = s.left + c.scrollLeft - l.x - f.x, p = s.top + c.scrollTop - l.y - f.y;
968
- return {
969
- x: u,
970
- y: p,
971
- width: s.width,
972
- height: s.height
973
- };
974
- }
975
- function wt(t) {
976
- return B(t).position === "static";
977
- }
978
- function zt(t, e) {
979
- if (!X(t) || B(t).position === "fixed")
980
- return null;
981
- if (e)
982
- return e(t);
983
- let n = t.offsetParent;
984
- return Y(t) === n && (n = n.ownerDocument.body), n;
985
- }
986
- function te(t, e) {
987
- const n = H(t);
988
- if (pt(t))
989
- return n;
990
- if (!X(t)) {
991
- let r = K(t);
992
- for (; r && !Q(r); ) {
993
- if (_(r) && !wt(r))
994
- return r;
995
- r = K(r);
996
- }
997
- return n;
998
- }
999
- let o = zt(t, e);
1000
- for (; o && Ze(o) && wt(o); )
1001
- o = zt(o, e);
1002
- return o && Q(o) && wt(o) && !Ot(o) ? n : o || tn(t) || n;
1003
- }
1004
- const hn = async function(t) {
1005
- const e = this.getOffsetParent || te, n = this.getDimensions, o = await n(t.floating);
1006
- return {
1007
- reference: pn(t.reference, await e(t.floating), t.strategy),
1008
- floating: {
1009
- x: 0,
1010
- y: 0,
1011
- width: o.width,
1012
- height: o.height
1013
- }
1014
- };
1015
- };
1016
- function gn(t) {
1017
- return B(t).direction === "rtl";
1018
- }
1019
- const wn = {
1020
- convertOffsetParentRelativeRectToViewportRelativeRect: rn,
1021
- getDocumentElement: Y,
1022
- getClippingRect: dn,
1023
- getOffsetParent: te,
1024
- getElementRects: hn,
1025
- getClientRects: sn,
1026
- getDimensions: mn,
1027
- getScale: J,
1028
- isElement: _,
1029
- isRTL: gn
1030
- };
1031
- function ee(t, e) {
1032
- return t.x === e.x && t.y === e.y && t.width === e.width && t.height === e.height;
1033
- }
1034
- function xn(t, e) {
1035
- let n = null, o;
1036
- const r = Y(t);
1037
- function i() {
1038
- var c;
1039
- clearTimeout(o), (c = n) == null || c.disconnect(), n = null;
1040
- }
1041
- function s(c, l) {
1042
- c === void 0 && (c = !1), l === void 0 && (l = 1), i();
1043
- const a = t.getBoundingClientRect(), {
1044
- left: f,
1045
- top: u,
1046
- width: p,
1047
- height: d
1048
- } = a;
1049
- if (c || e(), !p || !d)
1050
- return;
1051
- const m = ct(u), h = ct(r.clientWidth - (f + p)), w = ct(r.clientHeight - (u + d)), g = ct(f), b = {
1052
- rootMargin: -m + "px " + -h + "px " + -w + "px " + -g + "px",
1053
- threshold: W(0, Z(1, l)) || 1
1054
- };
1055
- let y = !0;
1056
- function v(P) {
1057
- const C = P[0].intersectionRatio;
1058
- if (C !== l) {
1059
- if (!y)
1060
- return s();
1061
- C ? s(!1, C) : o = setTimeout(() => {
1062
- s(!1, 1e-7);
1063
- }, 1e3);
1064
- }
1065
- C === 1 && !ee(a, t.getBoundingClientRect()) && s(), y = !1;
1066
- }
1067
- try {
1068
- n = new IntersectionObserver(v, {
1069
- ...b,
1070
- // Handle <iframe>s
1071
- root: r.ownerDocument
1072
- });
1073
- } catch {
1074
- n = new IntersectionObserver(v, b);
1075
- }
1076
- n.observe(t);
1077
- }
1078
- return s(!0), i;
1079
- }
1080
- function yn(t, e, n, o) {
1081
- o === void 0 && (o = {});
1082
- const {
1083
- ancestorScroll: r = !0,
1084
- ancestorResize: i = !0,
1085
- elementResize: s = typeof ResizeObserver == "function",
1086
- layoutShift: c = typeof IntersectionObserver == "function",
1087
- animationFrame: l = !1
1088
- } = o, a = Et(t), f = r || i ? [...a ? rt(a) : [], ...rt(e)] : [];
1089
- f.forEach((g) => {
1090
- r && g.addEventListener("scroll", n, {
1091
- passive: !0
1092
- }), i && g.addEventListener("resize", n);
1093
- });
1094
- const u = a && c ? xn(a, n) : null;
1095
- let p = -1, d = null;
1096
- s && (d = new ResizeObserver((g) => {
1097
- let [x] = g;
1098
- x && x.target === a && d && (d.unobserve(e), cancelAnimationFrame(p), p = requestAnimationFrame(() => {
1099
- var b;
1100
- (b = d) == null || b.observe(e);
1101
- })), n();
1102
- }), a && !l && d.observe(a), d.observe(e));
1103
- let m, h = l ? G(t) : null;
1104
- l && w();
1105
- function w() {
1106
- const g = G(t);
1107
- h && !ee(h, g) && n(), h = g, m = requestAnimationFrame(w);
1108
- }
1109
- return n(), () => {
1110
- var g;
1111
- f.forEach((x) => {
1112
- r && x.removeEventListener("scroll", n), i && x.removeEventListener("resize", n);
1113
- }), u?.(), (g = d) == null || g.disconnect(), d = null, l && cancelAnimationFrame(m);
1114
- };
1115
- }
1116
- const vn = Ie, bn = Xe, An = Be, Rn = je, Cn = Ve, It = _e, Pn = Ye, On = (t, e, n) => {
1117
- const o = /* @__PURE__ */ new Map(), r = {
1118
- platform: wn,
1119
- ...n
1120
- }, i = {
1121
- ...r.platform,
1122
- _c: o
1123
- };
1124
- return He(t, e, {
1125
- ...r,
1126
- platform: i
1127
- });
1128
- };
1129
- var Sn = typeof document < "u", En = function() {
1130
- }, lt = Sn ? Ae : En;
1131
- function dt(t, e) {
1132
- if (t === e)
1133
- return !0;
1134
- if (typeof t != typeof e)
1135
- return !1;
1136
- if (typeof t == "function" && t.toString() === e.toString())
1137
- return !0;
1138
- let n, o, r;
1139
- if (t && e && typeof t == "object") {
1140
- if (Array.isArray(t)) {
1141
- if (n = t.length, n !== e.length) return !1;
1142
- for (o = n; o-- !== 0; )
1143
- if (!dt(t[o], e[o]))
1144
- return !1;
1145
- return !0;
1146
- }
1147
- if (r = Object.keys(t), n = r.length, n !== Object.keys(e).length)
1148
- return !1;
1149
- for (o = n; o-- !== 0; )
1150
- if (!{}.hasOwnProperty.call(e, r[o]))
1151
- return !1;
1152
- for (o = n; o-- !== 0; ) {
1153
- const i = r[o];
1154
- if (!(i === "_owner" && t.$$typeof) && !dt(t[i], e[i]))
1155
- return !1;
1156
- }
1157
- return !0;
1158
- }
1159
- return t !== t && e !== e;
1160
- }
1161
- function ne(t) {
1162
- return typeof window > "u" ? 1 : (t.ownerDocument.defaultView || window).devicePixelRatio || 1;
1163
- }
1164
- function Xt(t, e) {
1165
- const n = ne(t);
1166
- return Math.round(e * n) / n;
1167
- }
1168
- function xt(t) {
1169
- const e = R.useRef(t);
1170
- return lt(() => {
1171
- e.current = t;
1172
- }), e;
1173
- }
1174
- function Ln(t) {
1175
- t === void 0 && (t = {});
1176
- const {
1177
- placement: e = "bottom",
1178
- strategy: n = "absolute",
1179
- middleware: o = [],
1180
- platform: r,
1181
- elements: {
1182
- reference: i,
1183
- floating: s
1184
- } = {},
1185
- transform: c = !0,
1186
- whileElementsMounted: l,
1187
- open: a
1188
- } = t, [f, u] = R.useState({
1189
- x: 0,
1190
- y: 0,
1191
- strategy: n,
1192
- placement: e,
1193
- middlewareData: {},
1194
- isPositioned: !1
1195
- }), [p, d] = R.useState(o);
1196
- dt(p, o) || d(o);
1197
- const [m, h] = R.useState(null), [w, g] = R.useState(null), x = R.useCallback((A) => {
1198
- A !== P.current && (P.current = A, h(A));
1199
- }, []), b = R.useCallback((A) => {
1200
- A !== C.current && (C.current = A, g(A));
1201
- }, []), y = i || m, v = s || w, P = R.useRef(null), C = R.useRef(null), M = R.useRef(f), F = l != null, D = xt(l), $ = xt(r), k = xt(a), S = R.useCallback(() => {
1202
- if (!P.current || !C.current)
1203
- return;
1204
- const A = {
1205
- placement: e,
1206
- strategy: n,
1207
- middleware: p
1208
- };
1209
- $.current && (A.platform = $.current), On(P.current, C.current, A).then((T) => {
1210
- const V = {
1211
- ...T,
1212
- // The floating element's position may be recomputed while it's closed
1213
- // but still mounted (such as when transitioning out). To ensure
1214
- // `isPositioned` will be `false` initially on the next open, avoid
1215
- // setting it to `true` when `open === false` (must be specified).
1216
- isPositioned: k.current !== !1
1217
- };
1218
- O.current && !dt(M.current, V) && (M.current = V, Re.flushSync(() => {
1219
- u(V);
1220
- }));
1221
- });
1222
- }, [p, e, n, $, k]);
1223
- lt(() => {
1224
- a === !1 && M.current.isPositioned && (M.current.isPositioned = !1, u((A) => ({
1225
- ...A,
1226
- isPositioned: !1
1227
- })));
1228
- }, [a]);
1229
- const O = R.useRef(!1);
1230
- lt(() => (O.current = !0, () => {
1231
- O.current = !1;
1232
- }), []), lt(() => {
1233
- if (y && (P.current = y), v && (C.current = v), y && v) {
1234
- if (D.current)
1235
- return D.current(y, v, S);
1236
- S();
1237
- }
1238
- }, [y, v, S, D, F]);
1239
- const N = R.useMemo(() => ({
1240
- reference: P,
1241
- floating: C,
1242
- setReference: x,
1243
- setFloating: b
1244
- }), [x, b]), E = R.useMemo(() => ({
1245
- reference: y,
1246
- floating: v
1247
- }), [y, v]), L = R.useMemo(() => {
1248
- const A = {
1249
- position: n,
1250
- left: 0,
1251
- top: 0
1252
- };
1253
- if (!E.floating)
1254
- return A;
1255
- const T = Xt(E.floating, f.x), V = Xt(E.floating, f.y);
1256
- return c ? {
1257
- ...A,
1258
- transform: "translate(" + T + "px, " + V + "px)",
1259
- ...ne(E.floating) >= 1.5 && {
1260
- willChange: "transform"
1261
- }
1262
- } : {
1263
- position: n,
1264
- left: T,
1265
- top: V
1266
- };
1267
- }, [n, c, E.floating, f.x, f.y]);
1268
- return R.useMemo(() => ({
1269
- ...f,
1270
- update: S,
1271
- refs: N,
1272
- elements: E,
1273
- floatingStyles: L
1274
- }), [f, S, N, E, L]);
1275
- }
1276
- const Dn = (t) => {
1277
- function e(n) {
1278
- return {}.hasOwnProperty.call(n, "current");
1279
- }
1280
- return {
1281
- name: "arrow",
1282
- options: t,
1283
- fn(n) {
1284
- const {
1285
- element: o,
1286
- padding: r
1287
- } = typeof t == "function" ? t(n) : t;
1288
- return o && e(o) ? o.current != null ? It({
1289
- element: o.current,
1290
- padding: r
1291
- }).fn(n) : {} : o ? It({
1292
- element: o,
1293
- padding: r
1294
- }).fn(n) : {};
1295
- }
1296
- };
1297
- }, Mn = (t, e) => ({
1298
- ...vn(t),
1299
- options: [t, e]
1300
- }), Tn = (t, e) => ({
1301
- ...bn(t),
1302
- options: [t, e]
1303
- }), $n = (t, e) => ({
1304
- ...Pn(t),
1305
- options: [t, e]
1306
- }), kn = (t, e) => ({
1307
- ...An(t),
1308
- options: [t, e]
1309
- }), Fn = (t, e) => ({
1310
- ...Rn(t),
1311
- options: [t, e]
1312
- }), Nn = (t, e) => ({
1313
- ...Cn(t),
1314
- options: [t, e]
1315
- }), Wn = (t, e) => ({
1316
- ...Dn(t),
1317
- options: [t, e]
1318
- });
1319
- var Hn = "Arrow", oe = R.forwardRef((t, e) => {
1320
- const { children: n, width: o = 10, height: r = 5, ...i } = t;
1321
- return /* @__PURE__ */ j(
1322
- At.svg,
1323
- {
1324
- ...i,
1325
- ref: e,
1326
- width: o,
1327
- height: r,
1328
- viewBox: "0 0 30 10",
1329
- preserveAspectRatio: "none",
1330
- children: t.asChild ? n : /* @__PURE__ */ j("polygon", { points: "0,0 30,0 15,10" })
1331
- }
1332
- );
1333
- });
1334
- oe.displayName = Hn;
1335
- var _n = oe, Lt = "Popper", [re, Gn] = Ce(Lt), [Bn, ie] = re(Lt), se = (t) => {
1336
- const { __scopePopper: e, children: n } = t, [o, r] = R.useState(null);
1337
- return /* @__PURE__ */ j(Bn, { scope: e, anchor: o, onAnchorChange: r, children: n });
1338
- };
1339
- se.displayName = Lt;
1340
- var ce = "PopperAnchor", le = R.forwardRef(
1341
- (t, e) => {
1342
- const { __scopePopper: n, virtualRef: o, ...r } = t, i = ie(ce, n), s = R.useRef(null), c = Yt(e, s), l = R.useRef(null);
1343
- return R.useEffect(() => {
1344
- const a = l.current;
1345
- l.current = o?.current || s.current, a !== l.current && i.onAnchorChange(l.current);
1346
- }), o ? null : /* @__PURE__ */ j(At.div, { ...r, ref: c });
1347
- }
1348
- );
1349
- le.displayName = ce;
1350
- var Dt = "PopperContent", [Vn, zn] = re(Dt), ae = R.forwardRef(
1351
- (t, e) => {
1352
- const {
1353
- __scopePopper: n,
1354
- side: o = "bottom",
1355
- sideOffset: r = 0,
1356
- align: i = "center",
1357
- alignOffset: s = 0,
1358
- arrowPadding: c = 0,
1359
- avoidCollisions: l = !0,
1360
- collisionBoundary: a = [],
1361
- collisionPadding: f = 0,
1362
- sticky: u = "partial",
1363
- hideWhenDetached: p = !1,
1364
- updatePositionStrategy: d = "optimized",
1365
- onPlaced: m,
1366
- ...h
1367
- } = t, w = ie(Dt, n), [g, x] = R.useState(null), b = Yt(e, (nt) => x(nt)), [y, v] = R.useState(null), P = Oe(y), C = P?.width ?? 0, M = P?.height ?? 0, F = o + (i !== "center" ? "-" + i : ""), D = typeof f == "number" ? f : { top: 0, right: 0, bottom: 0, left: 0, ...f }, $ = Array.isArray(a) ? a : [a], k = $.length > 0, S = {
1368
- padding: D,
1369
- boundary: $.filter(Xn),
1370
- // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
1371
- altBoundary: k
1372
- }, { refs: O, floatingStyles: N, placement: E, isPositioned: L, middlewareData: A } = Ln({
1373
- // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
1374
- strategy: "fixed",
1375
- placement: F,
1376
- whileElementsMounted: (...nt) => yn(...nt, {
1377
- animationFrame: d === "always"
1378
- }),
1379
- elements: {
1380
- reference: w.anchor
1381
- },
1382
- middleware: [
1383
- Mn({ mainAxis: r + M, alignmentAxis: s }),
1384
- l && Tn({
1385
- mainAxis: !0,
1386
- crossAxis: !1,
1387
- limiter: u === "partial" ? $n() : void 0,
1388
- ...S
1389
- }),
1390
- l && kn({ ...S }),
1391
- Fn({
1392
- ...S,
1393
- apply: ({ elements: nt, rects: Tt, availableWidth: xe, availableHeight: ye }) => {
1394
- const { width: ve, height: be } = Tt.reference, st = nt.floating.style;
1395
- st.setProperty("--radix-popper-available-width", `${xe}px`), st.setProperty("--radix-popper-available-height", `${ye}px`), st.setProperty("--radix-popper-anchor-width", `${ve}px`), st.setProperty("--radix-popper-anchor-height", `${be}px`);
1396
- }
1397
- }),
1398
- y && Wn({ element: y, padding: c }),
1399
- Yn({ arrowWidth: C, arrowHeight: M }),
1400
- p && Nn({ strategy: "referenceHidden", ...S })
1401
- ]
1402
- }), [T, V] = de(E), Mt = Pe(m);
1403
- $t(() => {
1404
- L && Mt?.();
1405
- }, [L, Mt]);
1406
- const me = A.arrow?.x, pe = A.arrow?.y, he = A.arrow?.centerOffset !== 0, [ge, we] = R.useState();
1407
- return $t(() => {
1408
- g && we(window.getComputedStyle(g).zIndex);
1409
- }, [g]), /* @__PURE__ */ j(
1410
- "div",
1411
- {
1412
- ref: O.setFloating,
1413
- "data-radix-popper-content-wrapper": "",
1414
- style: {
1415
- ...N,
1416
- transform: L ? N.transform : "translate(0, -200%)",
1417
- // keep off the page when measuring
1418
- minWidth: "max-content",
1419
- zIndex: ge,
1420
- "--radix-popper-transform-origin": [
1421
- A.transformOrigin?.x,
1422
- A.transformOrigin?.y
1423
- ].join(" "),
1424
- // hide the content if using the hide middleware and should be hidden
1425
- // set visibility to hidden and disable pointer events so the UI behaves
1426
- // as if the PopperContent isn't there at all
1427
- ...A.hide?.referenceHidden && {
1428
- visibility: "hidden",
1429
- pointerEvents: "none"
1430
- }
1431
- },
1432
- dir: t.dir,
1433
- children: /* @__PURE__ */ j(
1434
- Vn,
1435
- {
1436
- scope: n,
1437
- placedSide: T,
1438
- onArrowChange: v,
1439
- arrowX: me,
1440
- arrowY: pe,
1441
- shouldHideArrow: he,
1442
- children: /* @__PURE__ */ j(
1443
- At.div,
1444
- {
1445
- "data-side": T,
1446
- "data-align": V,
1447
- ...h,
1448
- ref: b,
1449
- style: {
1450
- ...h.style,
1451
- // if the PopperContent hasn't been placed yet (not all measurements done)
1452
- // we prevent animations so that users's animation don't kick in too early referring wrong sides
1453
- animation: L ? void 0 : "none"
1454
- }
1455
- }
1456
- )
1457
- }
1458
- )
1459
- }
1460
- );
1461
- }
1462
- );
1463
- ae.displayName = Dt;
1464
- var fe = "PopperArrow", In = {
1465
- top: "bottom",
1466
- right: "left",
1467
- bottom: "top",
1468
- left: "right"
1469
- }, ue = R.forwardRef(function(e, n) {
1470
- const { __scopePopper: o, ...r } = e, i = zn(fe, o), s = In[i.placedSide];
1471
- return (
1472
- // we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
1473
- // doesn't report size as we'd expect on SVG elements.
1474
- // it reports their bounding box which is effectively the largest path inside the SVG.
1475
- /* @__PURE__ */ j(
1476
- "span",
1477
- {
1478
- ref: i.onArrowChange,
1479
- style: {
1480
- position: "absolute",
1481
- left: i.arrowX,
1482
- top: i.arrowY,
1483
- [s]: 0,
1484
- transformOrigin: {
1485
- top: "",
1486
- right: "0 0",
1487
- bottom: "center 0",
1488
- left: "100% 0"
1489
- }[i.placedSide],
1490
- transform: {
1491
- top: "translateY(100%)",
1492
- right: "translateY(50%) rotate(90deg) translateX(-50%)",
1493
- bottom: "rotate(180deg)",
1494
- left: "translateY(50%) rotate(-90deg) translateX(50%)"
1495
- }[i.placedSide],
1496
- visibility: i.shouldHideArrow ? "hidden" : void 0
1497
- },
1498
- children: /* @__PURE__ */ j(
1499
- _n,
1500
- {
1501
- ...r,
1502
- ref: n,
1503
- style: {
1504
- ...r.style,
1505
- // ensures the element can be measured correctly (mostly for if SVG)
1506
- display: "block"
1507
- }
1508
- }
1509
- )
1510
- }
1511
- )
1512
- );
1513
- });
1514
- ue.displayName = fe;
1515
- function Xn(t) {
1516
- return t !== null;
1517
- }
1518
- var Yn = (t) => ({
1519
- name: "transformOrigin",
1520
- options: t,
1521
- fn(e) {
1522
- const { placement: n, rects: o, middlewareData: r } = e, s = r.arrow?.centerOffset !== 0, c = s ? 0 : t.arrowWidth, l = s ? 0 : t.arrowHeight, [a, f] = de(n), u = { start: "0%", center: "50%", end: "100%" }[f], p = (r.arrow?.x ?? 0) + c / 2, d = (r.arrow?.y ?? 0) + l / 2;
1523
- let m = "", h = "";
1524
- return a === "bottom" ? (m = s ? u : `${p}px`, h = `${-l}px`) : a === "top" ? (m = s ? u : `${p}px`, h = `${o.floating.height + l}px`) : a === "right" ? (m = `${-l}px`, h = s ? u : `${d}px`) : a === "left" && (m = `${o.floating.width + l}px`, h = s ? u : `${d}px`), { data: { x: m, y: h } };
1525
- }
1526
- });
1527
- function de(t) {
1528
- const [e, n = "center"] = t.split("-");
1529
- return [e, n];
1530
- }
1531
- var Jn = se, Qn = le, to = ae, eo = ue;
1532
- export {
1533
- Qn as A,
1534
- to as C,
1535
- Jn as R,
1536
- eo as a,
1537
- Gn as c
1538
- };