@altinn/altinn-components 0.54.2 → 0.55.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (302) hide show
  1. package/dist/{PersonCircle-DlX_3kRO.js → ChevronUpDown-DqGsU4MC.js} +5 -5
  2. package/dist/Eye-BrbjRZJp.js +24 -0
  3. package/dist/InboxFill-vGck_zM_.js +81 -0
  4. package/dist/InformationSquare-D3WAxfVw.js +24 -0
  5. package/dist/Trash-DBcymOP9.js +81 -0
  6. package/dist/assets/AccountMenuButton.css +1 -1
  7. package/dist/assets/AccountSelector.css +1 -1
  8. package/dist/assets/AutocompleteBase.css +1 -1
  9. package/dist/assets/ButtonGroup.css +1 -1
  10. package/dist/assets/ButtonIcon.css +1 -1
  11. package/dist/assets/DashboardCard.css +1 -0
  12. package/dist/assets/DashboardHeader.css +1 -0
  13. package/dist/assets/DialogListItem.css +1 -1
  14. package/dist/assets/Dropdown.css +1 -0
  15. package/dist/assets/DropdownBase.css +1 -1
  16. package/dist/assets/GlobalHeader.css +1 -1
  17. package/dist/assets/ItemControls.css +1 -0
  18. package/dist/assets/ItemLabel.css +1 -0
  19. package/dist/assets/ItemMedia.css +1 -0
  20. package/dist/assets/MenuItem.css +1 -1
  21. package/dist/assets/MenuListDivider.css +1 -0
  22. package/dist/assets/MenuListHeading.css +1 -0
  23. package/dist/assets/MenuListItem.css +1 -0
  24. package/dist/assets/MenuListSearch.css +1 -0
  25. package/dist/assets/MetaItemIcon.css +1 -1
  26. package/dist/assets/SearchField.css +1 -1
  27. package/dist/assets/SeenByLogButton.css +1 -0
  28. package/dist/assets/Switch.css +1 -0
  29. package/dist/assets/TabMenu.css +1 -0
  30. package/dist/assets/Tooltip.css +1 -0
  31. package/dist/assets/menuList.css +1 -0
  32. package/dist/components/Account/AccountList.js +1 -1
  33. package/dist/components/Account/AccountListVirtual.js +4 -4
  34. package/dist/components/Account/AccountMenu.js +14 -11
  35. package/dist/components/Account/AccountMenuButton.js +58 -56
  36. package/dist/components/Attachment/AttachmentLink.js +47 -41
  37. package/dist/components/Avatar/Avatar.js +11 -12
  38. package/dist/components/Avatar/AvatarGroup.js +38 -28
  39. package/dist/components/Banner/Banner.js +20 -38
  40. package/dist/components/Button/ButtonGroup.js +28 -12
  41. package/dist/components/Button/ButtonIcon.js +15 -15
  42. package/dist/components/Button/FloatingActionButton.js +22 -19
  43. package/dist/components/Byline/Byline.js +1 -1
  44. package/dist/components/ContextMenu/ContextMenu.js +73 -67
  45. package/dist/components/Dashboard/DashboardCard.js +24 -21
  46. package/dist/components/Dashboard/DashboardHeader.js +16 -14
  47. package/dist/components/Dashboard/index.js +2 -4
  48. package/dist/components/Datepicker/Datepicker.js +16 -14
  49. package/dist/components/Datepicker/DatepickerHeader.js +13 -13
  50. package/dist/components/Dialog/DialogActions.js +9 -9
  51. package/dist/components/Dialog/DialogAttachments.js +1 -1
  52. package/dist/components/Dialog/DialogListItem.js +113 -112
  53. package/dist/components/Dialog/DialogMetadata.js +83 -154
  54. package/dist/components/Dialog/DialogSeenBy.js +24 -41
  55. package/dist/components/Dialog/DialogTabs.js +4 -4
  56. package/dist/components/Dialog/SeenByLog.js +7 -7
  57. package/dist/components/Dialog/SeenByLogButton.js +12 -6
  58. package/dist/components/Dropdown/DrawerOrDropdown.js +1 -1
  59. package/dist/components/Dropdown/Dropdown.js +160 -0
  60. package/dist/components/Dropdown/DropdownBase.js +12 -12
  61. package/dist/components/Dropdown/FloatingDropdown.js +119 -74
  62. package/dist/components/Dropdown/index.js +18 -16
  63. package/dist/components/DsComponents/index.js +2 -2
  64. package/dist/components/Forms/SearchField.js +44 -29
  65. package/dist/components/Forms/Switch.js +10 -8
  66. package/dist/components/GlobalHeader/AccountSelector.js +55 -55
  67. package/dist/components/GlobalHeader/GlobalHeader.js +55 -54
  68. package/dist/components/GlobalHeader/GlobalSearch.js +1 -1
  69. package/dist/components/GlobalHeader/GlobalSearchButton.js +1 -0
  70. package/dist/components/GlobalMenu/BackButton.js +1 -1
  71. package/dist/components/GlobalMenu/GlobalMenu.js +52 -43
  72. package/dist/components/GlobalMenu/GlobalMenuButton.js +15 -14
  73. package/dist/components/GlobalMenu/LocaleSwitcher.js +30 -24
  74. package/dist/components/GlobalMenu_old/BackButton.js +1 -1
  75. package/dist/components/GlobalMenu_old/CurrentAccount.js +8 -9
  76. package/dist/components/GlobalMenu_old/EndUserLabel.js +29 -10
  77. package/dist/components/GlobalMenu_old/GlobalMenu.js +15 -8
  78. package/dist/components/GlobalMenu_old/GlobalMenuButton.js +1 -1
  79. package/dist/components/Header/Header.js +6 -6
  80. package/dist/components/Header/HeaderBase.js +1 -1
  81. package/dist/components/Header/LocaleSwitcher.js +10 -10
  82. package/dist/components/Icon/Icon.js +19 -20
  83. package/dist/components/Icon/ProgressIcon.js +1 -0
  84. package/dist/components/Icon/index.js +4 -6
  85. package/dist/components/Item/ItemControls.js +8 -0
  86. package/dist/components/Item/ItemLabel.js +34 -0
  87. package/dist/components/Item/ItemMedia.js +33 -0
  88. package/dist/components/Item/index.js +8 -0
  89. package/dist/components/Layout/Layout.js +4 -4
  90. package/dist/components/Menu/Menu.js +67 -45
  91. package/dist/components/Menu/MenuItem.js +192 -66
  92. package/dist/components/Menu/MenuItems.js +154 -71
  93. package/dist/components/Menu/MenuList.js +39 -0
  94. package/dist/components/Menu/MenuListDivider.js +8 -0
  95. package/dist/components/Menu/MenuListGroup.js +7 -0
  96. package/dist/components/Menu/MenuListHeading.js +7 -0
  97. package/dist/components/Menu/MenuListItem.js +34 -0
  98. package/dist/components/Menu/MenuListSearch.js +83 -0
  99. package/dist/components/Menu/MenuOption.js +4 -87
  100. package/dist/components/Menu/TabMenu.js +15 -0
  101. package/dist/components/Menu/VirtualizedMenuItems.js +227 -0
  102. package/dist/components/Menu/aria.js +9 -0
  103. package/dist/components/Menu/example.data.js +373 -0
  104. package/dist/components/Menu/example.hooks.js +75 -0
  105. package/dist/components/Menu/index.js +24 -25
  106. package/dist/components/Menu/types.js +1 -0
  107. package/dist/components/Menu/useDropdownMenuController.js +43 -0
  108. package/dist/components/Menu/useMenuSearch.js +146 -0
  109. package/dist/components/Menu/useMenuVirtualization.js +5 -0
  110. package/dist/components/Metadata/MetaItemIcon.js +4 -4
  111. package/dist/components/Notifications/NotificationItemBase.js +49 -50
  112. package/dist/components/Page/ContactButtons.js +13 -10
  113. package/dist/components/Page/PageTabs.js +4 -13
  114. package/dist/components/Searchbar/Autocomplete.js +34 -32
  115. package/dist/components/Searchbar/AutocompleteBase.js +3 -3
  116. package/dist/components/Searchbar/AutocompleteItem.js +29 -42
  117. package/dist/components/Settings/SettingsItemBase.js +25 -26
  118. package/dist/components/Settings/UsedByLog.js +6 -6
  119. package/dist/components/Toolbar/DatepickerFilter.js +87 -0
  120. package/dist/components/Toolbar/SelectDateFilter.js +51 -0
  121. package/dist/components/Toolbar/Toolbar.js +18 -104
  122. package/dist/components/Toolbar/ToolbarFilter.js +69 -73
  123. package/dist/components/Toolbar/ToolbarFilterAddMenu.js +82 -0
  124. package/dist/components/Toolbar/ToolbarFilterButton.js +46 -0
  125. package/dist/components/Toolbar/ToolbarFilterMenu.js +117 -0
  126. package/dist/components/Toolbar/ToolbarMenu.js +58 -21
  127. package/dist/components/Toolbar/ToolbarSearch.js +15 -10
  128. package/dist/components/Toolbar/example.data.js +388 -0
  129. package/dist/components/Toolbar/example.hooks.js +68 -0
  130. package/dist/components/Toolbar/formatDateRange.js +19 -0
  131. package/dist/components/Toolbar/index.js +12 -14
  132. package/dist/components/Toolbar/useFilter.js +63 -0
  133. package/dist/components/Tooltip/Tooltip.js +101 -0
  134. package/dist/components/Tooltip/index.js +4 -0
  135. package/dist/components/UserListItem/UserListItem.js +15 -13
  136. package/dist/components/index.js +389 -386
  137. package/dist/floating-ui.dom-bEgaHJCq.js +997 -0
  138. package/dist/global.css +1 -1
  139. package/dist/hooks/useAccountSelector.js +9 -9
  140. package/dist/hooks/useMenu.js +48 -47
  141. package/dist/index--jNxJmA8.js +2000 -0
  142. package/dist/index.js +402 -399
  143. package/dist/menuList.module-DFH60CqT.js +6 -0
  144. package/dist/{textfield-DAuYWtUj.js → textfield-Drdr9bio.js} +40 -39
  145. package/dist/types/lib/components/Account/AccountList.d.ts +2 -2
  146. package/dist/types/lib/components/Account/AccountList.stories.d.ts +3 -4
  147. package/dist/types/lib/components/Account/AccountMenu.d.ts +3 -3
  148. package/dist/types/lib/components/Account/AccountMenu.stories.d.ts +1 -1
  149. package/dist/types/lib/components/Account/AccountMenuButton.stories.d.ts +10 -2
  150. package/dist/types/lib/components/Attachment/AttachmentLink.d.ts +3 -1
  151. package/dist/types/lib/components/Attachment/AttachmentLink.stories.d.ts +1 -1
  152. package/dist/types/lib/components/Button/ButtonGroup.d.ts +3 -1
  153. package/dist/types/lib/components/Button/ButtonGroup.stories.d.ts +1 -1
  154. package/dist/types/lib/components/Button/FloatingActionButton.d.ts +1 -6
  155. package/dist/types/lib/components/ContextMenu/ContextMenu.d.ts +7 -8
  156. package/dist/types/lib/components/Dashboard/DashboardCard.d.ts +2 -2
  157. package/dist/types/lib/components/Dashboard/DashboardHeader.d.ts +2 -2
  158. package/dist/types/lib/components/Dashboard/index.d.ts +0 -1
  159. package/dist/types/lib/components/Dialog/DialogTabs.d.ts +2 -4
  160. package/dist/types/lib/components/Dialog/SeenByLogButton.d.ts +8 -5
  161. package/dist/types/lib/components/Dropdown/Dropdown.d.ts +22 -0
  162. package/dist/types/lib/components/Dropdown/Dropdown.stories.d.ts +14 -0
  163. package/dist/types/lib/components/Dropdown/DropdownBase.d.ts +3 -2
  164. package/dist/types/lib/components/Dropdown/index.d.ts +1 -0
  165. package/dist/types/lib/components/Forms/SearchField.d.ts +2 -1
  166. package/dist/types/lib/components/Forms/SearchField.stories.d.ts +1 -1
  167. package/dist/types/lib/components/Forms/Switch.d.ts +2 -1
  168. package/dist/types/lib/components/Forms/Switch.stories.d.ts +1 -1
  169. package/dist/types/lib/components/GlobalMenu/GlobalMenu.d.ts +1 -1
  170. package/dist/types/lib/components/GlobalMenu/GlobalMenu.stories.d.ts +1 -3
  171. package/dist/types/lib/components/GlobalMenu/LocaleSwitcher.d.ts +1 -1
  172. package/dist/types/lib/components/Header/HeaderButton.d.ts +0 -4
  173. package/dist/types/lib/components/Header/HeaderButton.stories.d.ts +0 -1
  174. package/dist/types/lib/components/Icon/Icon.d.ts +3 -2
  175. package/dist/types/lib/components/Icon/index.d.ts +0 -1
  176. package/dist/types/lib/components/Item/ItemControls.d.ts +7 -0
  177. package/dist/types/lib/components/Item/ItemLabel.d.ts +14 -0
  178. package/dist/types/lib/components/Item/ItemMedia.d.ts +9 -0
  179. package/dist/types/lib/components/Item/index.d.ts +3 -0
  180. package/dist/types/lib/components/Menu/Menu.d.ts +4 -7
  181. package/dist/types/lib/components/Menu/Menu.stories.d.ts +64 -4
  182. package/dist/types/lib/components/Menu/MenuItem.d.ts +53 -21
  183. package/dist/types/lib/components/Menu/MenuItems.d.ts +21 -14
  184. package/dist/types/lib/components/Menu/MenuList.d.ts +21 -0
  185. package/dist/types/lib/components/Menu/MenuListDivider.d.ts +6 -0
  186. package/dist/types/lib/components/Menu/MenuListGroup.d.ts +8 -0
  187. package/dist/types/lib/components/Menu/MenuListHeading.d.ts +8 -0
  188. package/dist/types/lib/components/Menu/MenuListItem.d.ts +9 -0
  189. package/dist/types/lib/components/Menu/MenuListSearch.d.ts +15 -0
  190. package/dist/types/lib/components/Menu/MenuListSearch.stories.d.ts +18 -0
  191. package/dist/types/lib/components/Menu/MenuOption.d.ts +5 -16
  192. package/dist/types/lib/components/Menu/TabMenu.d.ts +8 -0
  193. package/dist/types/lib/components/Menu/VirtualizedMenu.stories.d.ts +22 -0
  194. package/dist/types/lib/components/Menu/VirtualizedMenuItems.d.ts +2 -0
  195. package/dist/types/lib/components/Menu/aria.d.ts +1 -0
  196. package/dist/types/lib/components/Menu/example.hooks.d.ts +24 -0
  197. package/dist/types/lib/components/Menu/index.d.ts +10 -9
  198. package/dist/types/lib/components/Menu/types.d.ts +1 -0
  199. package/dist/types/lib/components/Menu/useDropdownMenuController.d.ts +27 -0
  200. package/dist/types/lib/components/Menu/useMenuSearch.d.ts +129 -0
  201. package/dist/types/lib/components/Menu/useMenuVirtualization.d.ts +35 -0
  202. package/dist/types/lib/components/Page/ContactButtons.d.ts +6 -2
  203. package/dist/types/lib/components/Page/PageTabs.d.ts +3 -10
  204. package/dist/types/lib/components/Page/PageTabs.stories.d.ts +1 -1
  205. package/dist/types/lib/components/Searchbar/AutocompleteItem.d.ts +3 -3
  206. package/dist/types/lib/components/Searchbar/Searchbar.stories.d.ts +1 -1
  207. package/dist/types/lib/components/Toolbar/DatepickerFilter.d.ts +15 -0
  208. package/dist/types/lib/components/Toolbar/SelectDateFilter.d.ts +8 -0
  209. package/dist/types/lib/components/Toolbar/SelectDateFilter.stories.d.ts +9 -0
  210. package/dist/types/lib/components/Toolbar/Toolbar.d.ts +6 -19
  211. package/dist/types/lib/components/Toolbar/Toolbar.stories.d.ts +21 -19
  212. package/dist/types/lib/components/Toolbar/ToolbarFilter.d.ts +11 -23
  213. package/dist/types/lib/components/Toolbar/ToolbarFilter.stories.d.ts +6 -13
  214. package/dist/types/lib/components/Toolbar/ToolbarFilterAddMenu.d.ts +8 -0
  215. package/dist/types/lib/components/Toolbar/ToolbarFilterButton.d.ts +15 -0
  216. package/dist/types/lib/components/Toolbar/ToolbarFilterMenu.d.ts +15 -0
  217. package/dist/types/lib/components/Toolbar/ToolbarMenu.d.ts +5 -10
  218. package/dist/types/lib/components/Toolbar/ToolbarSearch.d.ts +3 -5
  219. package/dist/types/lib/components/Toolbar/ToolbarSearch.stories.d.ts +635 -1
  220. package/dist/types/lib/components/Toolbar/example.hooks.d.ts +41 -0
  221. package/dist/types/lib/components/Toolbar/formatDateRange.d.ts +10 -0
  222. package/dist/types/lib/components/Toolbar/index.d.ts +4 -5
  223. package/dist/types/lib/components/Toolbar/useFilter.d.ts +173 -0
  224. package/dist/types/lib/components/Tooltip/Tooltip.d.ts +8 -0
  225. package/dist/types/lib/components/Tooltip/Tooltip.stories.d.ts +9 -0
  226. package/dist/types/lib/components/Tooltip/index.d.ts +1 -0
  227. package/dist/types/lib/components/Transmission/Transmission.stories.d.ts +2 -2
  228. package/dist/types/lib/components/Typography/Heading.d.ts +2 -2
  229. package/dist/types/lib/components/UserListItem/UserListItem.d.ts +3 -1
  230. package/dist/types/lib/components/UserListItem/UserListItem.stories.d.ts +7 -1
  231. package/dist/types/lib/components/index.d.ts +2 -0
  232. package/dist/types/lib/hooks/useAccountSelector.d.ts +2 -2
  233. package/dist/types/lib/hooks/useMenu.d.ts +3 -1
  234. package/dist/{index-De5bF0Gf.js → useMenuVirtualization-DpvWCsyD.js} +216 -165
  235. package/package.json +1 -1
  236. package/dist/assets/ContextMenu.css +0 -1
  237. package/dist/assets/IconOrAvatar.css +0 -1
  238. package/dist/assets/MenuBase.css +0 -1
  239. package/dist/assets/MenuHeader.css +0 -1
  240. package/dist/assets/MenuInputField.css +0 -1
  241. package/dist/assets/MenuItemBase.css +0 -1
  242. package/dist/assets/MenuItemIcon.css +0 -1
  243. package/dist/assets/MenuItemLabel.css +0 -1
  244. package/dist/assets/MenuItemsVirtual.css +0 -1
  245. package/dist/assets/MenuOption.css +0 -1
  246. package/dist/assets/MenuSearch.css +0 -1
  247. package/dist/assets/PageTabs.css +0 -1
  248. package/dist/assets/ToolbarBase.css +0 -1
  249. package/dist/assets/ToolbarButton.css +0 -1
  250. package/dist/assets/ToolbarDaterange.css +0 -1
  251. package/dist/assets/ToolbarFilterBase.css +0 -1
  252. package/dist/components/Dashboard/DashboardIcon.js +0 -11
  253. package/dist/components/Datepicker/DatepickerBase.js +0 -8
  254. package/dist/components/GlobalMenu/EndUserLabel.js +0 -13
  255. package/dist/components/GlobalMenu/LocaleButton.js +0 -13
  256. package/dist/components/Icon/IconOrAvatar.js +0 -33
  257. package/dist/components/Menu/MenuBase.js +0 -56
  258. package/dist/components/Menu/MenuHeader.js +0 -8
  259. package/dist/components/Menu/MenuInputField.js +0 -31
  260. package/dist/components/Menu/MenuItemBase.js +0 -58
  261. package/dist/components/Menu/MenuItemIcon.js +0 -27
  262. package/dist/components/Menu/MenuItemLabel.js +0 -76
  263. package/dist/components/Menu/MenuItemsVirtual.js +0 -168
  264. package/dist/components/Menu/MenuSearch.js +0 -41
  265. package/dist/components/Toolbar/ToolbarAccountMenu.js +0 -52
  266. package/dist/components/Toolbar/ToolbarAdd.js +0 -24
  267. package/dist/components/Toolbar/ToolbarBase.js +0 -8
  268. package/dist/components/Toolbar/ToolbarButton.js +0 -115
  269. package/dist/components/Toolbar/ToolbarDaterange.js +0 -58
  270. package/dist/components/Toolbar/ToolbarFilterBase.js +0 -17
  271. package/dist/components/Toolbar/ToolbarOptions.js +0 -84
  272. package/dist/index-DttADHE1.js +0 -2993
  273. package/dist/types/lib/components/ContextMenu/ContextMenu.stories.d.ts +0 -8
  274. package/dist/types/lib/components/Dashboard/DashboardIcon.d.ts +0 -7
  275. package/dist/types/lib/components/Datepicker/DatepickerBase.d.ts +0 -6
  276. package/dist/types/lib/components/GlobalMenu/EndUserLabel.d.ts +0 -5
  277. package/dist/types/lib/components/GlobalMenu/LocaleButton.d.ts +0 -3
  278. package/dist/types/lib/components/Icon/IconOrAvatar.d.ts +0 -13
  279. package/dist/types/lib/components/Menu/MenuBase.d.ts +0 -42
  280. package/dist/types/lib/components/Menu/MenuHeader.d.ts +0 -4
  281. package/dist/types/lib/components/Menu/MenuInputField.d.ts +0 -12
  282. package/dist/types/lib/components/Menu/MenuItemBase.d.ts +0 -28
  283. package/dist/types/lib/components/Menu/MenuItemIcon.d.ts +0 -10
  284. package/dist/types/lib/components/Menu/MenuItemLabel.d.ts +0 -15
  285. package/dist/types/lib/components/Menu/MenuItemsVirtual.d.ts +0 -2
  286. package/dist/types/lib/components/Menu/MenuSearch.d.ts +0 -10
  287. package/dist/types/lib/components/Menu/MenuSearch.stories.d.ts +0 -18
  288. package/dist/types/lib/components/Toolbar/ToolbarAccountMenu.d.ts +0 -8
  289. package/dist/types/lib/components/Toolbar/ToolbarAdd.d.ts +0 -8
  290. package/dist/types/lib/components/Toolbar/ToolbarAdd.stories.d.ts +0 -13
  291. package/dist/types/lib/components/Toolbar/ToolbarBase.d.ts +0 -5
  292. package/dist/types/lib/components/Toolbar/ToolbarButton.d.ts +0 -16
  293. package/dist/types/lib/components/Toolbar/ToolbarButton.stories.d.ts +0 -15
  294. package/dist/types/lib/components/Toolbar/ToolbarDate.stories.d.ts +0 -26
  295. package/dist/types/lib/components/Toolbar/ToolbarDaterange.d.ts +0 -11
  296. package/dist/types/lib/components/Toolbar/ToolbarDaterange.stories.d.ts +0 -15
  297. package/dist/types/lib/components/Toolbar/ToolbarFilterBase.d.ts +0 -8
  298. package/dist/types/lib/components/Toolbar/ToolbarMenu.stories.d.ts +0 -19
  299. package/dist/types/lib/components/Toolbar/ToolbarOptions.d.ts +0 -22
  300. package/dist/types/lib/components/Toolbar/ToolbarOptions.stories.d.ts +0 -12
  301. /package/dist/assets/{DatepickerBase.css → Datepicker.css} +0 -0
  302. /package/dist/types/lib/components/GlobalHeader/{AccountSector.stories.d.ts → AccountSelector.stories.d.ts} +0 -0
@@ -1,2993 +0,0 @@
1
- "use client";
2
- import { jsx as Oe } from "react/jsx-runtime";
3
- import { c as Ln } from "./lite-1fxw3LjI.js";
4
- import * as m from "react";
5
- import { useLayoutEffect as kn, useEffect as Vn, useRef as yr, createContext as jt, useReducer as Rr, useContext as Ut, forwardRef as Qe, useId as Er, useMemo as Cr, isValidElement as Ir } from "react";
6
- import { B as _n } from "./button-BB5sYVKY.js";
7
- import * as $n from "react-dom";
8
- import { S as Sr } from "./index-D7FJjvrv.js";
9
- import { L as Tr } from "./label-xTmTyPhk.js";
10
- import { I as Ar } from "./input-wBv_FkEV.js";
11
- const sn = (e, t) => {
12
- const n = {}, r = {};
13
- let o = 0;
14
- const i = e.length;
15
- for (; o < i; )
16
- r[e[o]] = 1, o += 1;
17
- for (const s in t)
18
- Object.hasOwn(r, s) || (n[s] = t[s]);
19
- return n;
20
- };
21
- function Et() {
22
- return typeof window < "u";
23
- }
24
- function Ct(e) {
25
- return Bn(e) ? (e.nodeName || "").toLowerCase() : "#document";
26
- }
27
- function et(e) {
28
- var t;
29
- return (e == null || (t = e.ownerDocument) == null ? void 0 : t.defaultView) || window;
30
- }
31
- function Or(e) {
32
- var t;
33
- return (t = (Bn(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : t.documentElement;
34
- }
35
- function Bn(e) {
36
- return Et() ? e instanceof Node || e instanceof et(e).Node : !1;
37
- }
38
- function ce(e) {
39
- return Et() ? e instanceof Element || e instanceof et(e).Element : !1;
40
- }
41
- function xe(e) {
42
- return Et() ? e instanceof HTMLElement || e instanceof et(e).HTMLElement : !1;
43
- }
44
- function Bt(e) {
45
- return !Et() || typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof et(e).ShadowRoot;
46
- }
47
- function cn(e) {
48
- return ["html", "body", "#document"].includes(Ct(e));
49
- }
50
- function Mr(e) {
51
- return et(e).getComputedStyle(e);
52
- }
53
- function Dr(e) {
54
- if (Ct(e) === "html")
55
- return e;
56
- const t = (
57
- // Step into the shadow DOM of the parent of a slotted node.
58
- e.assignedSlot || // DOM Element detected.
59
- e.parentNode || // ShadowRoot detected.
60
- Bt(e) && e.host || // Fallback.
61
- Or(e)
62
- );
63
- return Bt(t) ? t.host : t;
64
- }
65
- function we(e) {
66
- let t = e.activeElement;
67
- for (; ((n = t) == null || (n = n.shadowRoot) == null ? void 0 : n.activeElement) != null; ) {
68
- var n;
69
- t = t.shadowRoot.activeElement;
70
- }
71
- return t;
72
- }
73
- function ee(e, t) {
74
- if (!e || !t)
75
- return !1;
76
- const n = t.getRootNode == null ? void 0 : t.getRootNode();
77
- if (e.contains(t))
78
- return !0;
79
- if (n && Bt(n)) {
80
- let r = t;
81
- for (; r; ) {
82
- if (e === r)
83
- return !0;
84
- r = r.parentNode || r.host;
85
- }
86
- }
87
- return !1;
88
- }
89
- function Wn() {
90
- const e = navigator.userAgentData;
91
- return e != null && e.platform ? e.platform : navigator.platform;
92
- }
93
- function Kn() {
94
- const e = navigator.userAgentData;
95
- return e && Array.isArray(e.brands) ? e.brands.map((t) => {
96
- let {
97
- brand: n,
98
- version: r
99
- } = t;
100
- return n + "/" + r;
101
- }).join(" ") : navigator.userAgent;
102
- }
103
- function Hn(e) {
104
- return e.mozInputSource === 0 && e.isTrusted ? !0 : Wt() && e.pointerType ? e.type === "click" && e.buttons === 1 : e.detail === 0 && !e.pointerType;
105
- }
106
- function zn(e) {
107
- return Fr() ? !1 : !Wt() && e.width === 0 && e.height === 0 || Wt() && e.width === 1 && e.height === 1 && e.pressure === 0 && e.detail === 0 && e.pointerType === "mouse" || // iOS VoiceOver returns 0.333• for width/height.
108
- e.width < 1 && e.height < 1 && e.pressure === 0 && e.detail === 0 && e.pointerType === "touch";
109
- }
110
- function qn() {
111
- return /apple/i.test(navigator.vendor);
112
- }
113
- function Wt() {
114
- const e = /android/i;
115
- return e.test(Wn()) || e.test(Kn());
116
- }
117
- function Pr() {
118
- return Wn().toLowerCase().startsWith("mac") && !navigator.maxTouchPoints;
119
- }
120
- function Fr() {
121
- return Kn().includes("jsdom/");
122
- }
123
- function Nr(e) {
124
- return "nativeEvent" in e;
125
- }
126
- function Lr(e) {
127
- return e.matches("html,body");
128
- }
129
- function oe(e) {
130
- return e?.ownerDocument || document;
131
- }
132
- function Dt(e, t) {
133
- if (t == null)
134
- return !1;
135
- if ("composedPath" in e)
136
- return e.composedPath().includes(t);
137
- const n = e;
138
- return n.target != null && t.contains(n.target);
139
- }
140
- function Ne(e) {
141
- return "composedPath" in e ? e.composedPath()[0] : e.target;
142
- }
143
- const kr = "input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";
144
- function Vr(e) {
145
- return xe(e) && e.matches(kr);
146
- }
147
- function te(e) {
148
- e.preventDefault(), e.stopPropagation();
149
- }
150
- function jn(e) {
151
- return e ? e.getAttribute("role") === "combobox" && Vr(e) : !1;
152
- }
153
- const ln = Math.floor;
154
- var _r = ["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])"], gt = /* @__PURE__ */ _r.join(","), Un = typeof Element > "u", $e = Un ? function() {
155
- } : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector, pt = !Un && Element.prototype.getRootNode ? function(e) {
156
- var t;
157
- return e == null || (t = e.getRootNode) === null || t === void 0 ? void 0 : t.call(e);
158
- } : function(e) {
159
- return e?.ownerDocument;
160
- }, ht = function e(t, n) {
161
- var r;
162
- n === void 0 && (n = !0);
163
- var o = t == null || (r = t.getAttribute) === null || r === void 0 ? void 0 : r.call(t, "inert"), i = o === "" || o === "true", s = i || n && t && e(t.parentNode);
164
- return s;
165
- }, $r = function(t) {
166
- var n, r = t == null || (n = t.getAttribute) === null || n === void 0 ? void 0 : n.call(t, "contenteditable");
167
- return r === "" || r === "true";
168
- }, Br = function(t, n, r) {
169
- if (ht(t))
170
- return [];
171
- var o = Array.prototype.slice.apply(t.querySelectorAll(gt));
172
- return n && $e.call(t, gt) && o.unshift(t), o = o.filter(r), o;
173
- }, Wr = function e(t, n, r) {
174
- for (var o = [], i = Array.from(t); i.length; ) {
175
- var s = i.shift();
176
- if (!ht(s, !1))
177
- if (s.tagName === "SLOT") {
178
- var l = s.assignedElements(), a = l.length ? l : s.children, c = e(a, !0, r);
179
- r.flatten ? o.push.apply(o, c) : o.push({
180
- scopeParent: s,
181
- candidates: c
182
- });
183
- } else {
184
- var d = $e.call(s, gt);
185
- d && r.filter(s) && (n || !t.includes(s)) && o.push(s);
186
- var u = s.shadowRoot || // check for an undisclosed shadow
187
- typeof r.getShadowRoot == "function" && r.getShadowRoot(s), p = !ht(u, !1) && (!r.shadowRootFilter || r.shadowRootFilter(s));
188
- if (u && p) {
189
- var f = e(u === !0 ? s.children : u.children, !0, r);
190
- r.flatten ? o.push.apply(o, f) : o.push({
191
- scopeParent: s,
192
- candidates: f
193
- });
194
- } else
195
- i.unshift.apply(i, s.children);
196
- }
197
- }
198
- return o;
199
- }, Xn = function(t) {
200
- return !isNaN(parseInt(t.getAttribute("tabindex"), 10));
201
- }, Yn = function(t) {
202
- if (!t)
203
- throw new Error("No node provided");
204
- return t.tabIndex < 0 && (/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName) || $r(t)) && !Xn(t) ? 0 : t.tabIndex;
205
- }, Kr = function(t, n) {
206
- var r = Yn(t);
207
- return r < 0 && n && !Xn(t) ? 0 : r;
208
- }, Hr = function(t, n) {
209
- return t.tabIndex === n.tabIndex ? t.documentOrder - n.documentOrder : t.tabIndex - n.tabIndex;
210
- }, Gn = function(t) {
211
- return t.tagName === "INPUT";
212
- }, zr = function(t) {
213
- return Gn(t) && t.type === "hidden";
214
- }, qr = function(t) {
215
- var n = t.tagName === "DETAILS" && Array.prototype.slice.apply(t.children).some(function(r) {
216
- return r.tagName === "SUMMARY";
217
- });
218
- return n;
219
- }, jr = function(t, n) {
220
- for (var r = 0; r < t.length; r++)
221
- if (t[r].checked && t[r].form === n)
222
- return t[r];
223
- }, Ur = function(t) {
224
- if (!t.name)
225
- return !0;
226
- var n = t.form || pt(t), r = function(l) {
227
- return n.querySelectorAll('input[type="radio"][name="' + l + '"]');
228
- }, o;
229
- if (typeof window < "u" && typeof window.CSS < "u" && typeof window.CSS.escape == "function")
230
- o = r(window.CSS.escape(t.name));
231
- else
232
- try {
233
- o = r(t.name);
234
- } catch (s) {
235
- 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", s.message), !1;
236
- }
237
- var i = jr(o, t.form);
238
- return !i || i === t;
239
- }, Xr = function(t) {
240
- return Gn(t) && t.type === "radio";
241
- }, Yr = function(t) {
242
- return Xr(t) && !Ur(t);
243
- }, Gr = function(t) {
244
- var n, r = t && pt(t), o = (n = r) === null || n === void 0 ? void 0 : n.host, i = !1;
245
- if (r && r !== t) {
246
- var s, l, a;
247
- for (i = !!((s = o) !== null && s !== void 0 && (l = s.ownerDocument) !== null && l !== void 0 && l.contains(o) || t != null && (a = t.ownerDocument) !== null && a !== void 0 && a.contains(t)); !i && o; ) {
248
- var c, d, u;
249
- r = pt(o), o = (c = r) === null || c === void 0 ? void 0 : c.host, i = !!((d = o) !== null && d !== void 0 && (u = d.ownerDocument) !== null && u !== void 0 && u.contains(o));
250
- }
251
- }
252
- return i;
253
- }, an = function(t) {
254
- var n = t.getBoundingClientRect(), r = n.width, o = n.height;
255
- return r === 0 && o === 0;
256
- }, Zr = function(t, n) {
257
- var r = n.displayCheck, o = n.getShadowRoot;
258
- if (getComputedStyle(t).visibility === "hidden")
259
- return !0;
260
- var i = $e.call(t, "details>summary:first-of-type"), s = i ? t.parentElement : t;
261
- if ($e.call(s, "details:not([open]) *"))
262
- return !0;
263
- if (!r || r === "full" || r === "legacy-full") {
264
- if (typeof o == "function") {
265
- for (var l = t; t; ) {
266
- var a = t.parentElement, c = pt(t);
267
- if (a && !a.shadowRoot && o(a) === !0)
268
- return an(t);
269
- t.assignedSlot ? t = t.assignedSlot : !a && c !== t.ownerDocument ? t = c.host : t = a;
270
- }
271
- t = l;
272
- }
273
- if (Gr(t))
274
- return !t.getClientRects().length;
275
- if (r !== "legacy-full")
276
- return !0;
277
- } else if (r === "non-zero-area")
278
- return an(t);
279
- return !1;
280
- }, Jr = function(t) {
281
- if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))
282
- for (var n = t.parentElement; n; ) {
283
- if (n.tagName === "FIELDSET" && n.disabled) {
284
- for (var r = 0; r < n.children.length; r++) {
285
- var o = n.children.item(r);
286
- if (o.tagName === "LEGEND")
287
- return $e.call(n, "fieldset[disabled] *") ? !0 : !o.contains(t);
288
- }
289
- return !0;
290
- }
291
- n = n.parentElement;
292
- }
293
- return !1;
294
- }, Qr = function(t, n) {
295
- return !(n.disabled || // we must do an inert look up to filter out any elements inside an inert ancestor
296
- // because we're limited in the type of selectors we can use in JSDom (see related
297
- // note related to `candidateSelectors`)
298
- ht(n) || zr(n) || Zr(n, t) || // For a details element with a summary, the summary element gets the focus
299
- qr(n) || Jr(n));
300
- }, Kt = function(t, n) {
301
- return !(Yr(n) || Yn(n) < 0 || !Qr(t, n));
302
- }, eo = function(t) {
303
- var n = parseInt(t.getAttribute("tabindex"), 10);
304
- return !!(isNaN(n) || n >= 0);
305
- }, to = function e(t) {
306
- var n = [], r = [];
307
- return t.forEach(function(o, i) {
308
- var s = !!o.scopeParent, l = s ? o.scopeParent : o, a = Kr(l, s), c = s ? e(o.candidates) : l;
309
- a === 0 ? s ? n.push.apply(n, c) : n.push(l) : r.push({
310
- documentOrder: i,
311
- tabIndex: a,
312
- item: o,
313
- isScope: s,
314
- content: c
315
- });
316
- }), r.sort(Hr).reduce(function(o, i) {
317
- return i.isScope ? o.push.apply(o, i.content) : o.push(i.content), o;
318
- }, []).concat(n);
319
- }, Ze = function(t, n) {
320
- n = n || {};
321
- var r;
322
- return n.getShadowRoot ? r = Wr([t], n.includeContainer, {
323
- filter: Kt.bind(null, n),
324
- flatten: !1,
325
- getShadowRoot: n.getShadowRoot,
326
- shadowRootFilter: eo
327
- }) : r = Br(t, n.includeContainer, Kt.bind(null, n)), to(r);
328
- }, no = function(t, n) {
329
- if (n = n || {}, !t)
330
- throw new Error("No node provided");
331
- return $e.call(t, gt) === !1 ? !1 : Kt(n, t);
332
- };
333
- const Be = Math.min, ie = Math.max, bt = Math.round, lt = Math.floor, pe = (e) => ({
334
- x: e,
335
- y: e
336
- }), ro = {
337
- left: "right",
338
- right: "left",
339
- bottom: "top",
340
- top: "bottom"
341
- }, oo = {
342
- start: "end",
343
- end: "start"
344
- };
345
- function un(e, t, n) {
346
- return ie(e, Be(t, n));
347
- }
348
- function tt(e, t) {
349
- return typeof e == "function" ? e(t) : e;
350
- }
351
- function Me(e) {
352
- return e.split("-")[0];
353
- }
354
- function nt(e) {
355
- return e.split("-")[1];
356
- }
357
- function Zn(e) {
358
- return e === "x" ? "y" : "x";
359
- }
360
- function Jn(e) {
361
- return e === "y" ? "height" : "width";
362
- }
363
- const io = /* @__PURE__ */ new Set(["top", "bottom"]);
364
- function ye(e) {
365
- return io.has(Me(e)) ? "y" : "x";
366
- }
367
- function Qn(e) {
368
- return Zn(ye(e));
369
- }
370
- function so(e, t, n) {
371
- n === void 0 && (n = !1);
372
- const r = nt(e), o = Qn(e), i = Jn(o);
373
- let s = o === "x" ? r === (n ? "end" : "start") ? "right" : "left" : r === "start" ? "bottom" : "top";
374
- return t.reference[i] > t.floating[i] && (s = vt(s)), [s, vt(s)];
375
- }
376
- function co(e) {
377
- const t = vt(e);
378
- return [Ht(e), t, Ht(t)];
379
- }
380
- function Ht(e) {
381
- return e.replace(/start|end/g, (t) => oo[t]);
382
- }
383
- const fn = ["left", "right"], dn = ["right", "left"], lo = ["top", "bottom"], ao = ["bottom", "top"];
384
- function uo(e, t, n) {
385
- switch (e) {
386
- case "top":
387
- case "bottom":
388
- return n ? t ? dn : fn : t ? fn : dn;
389
- case "left":
390
- case "right":
391
- return t ? lo : ao;
392
- default:
393
- return [];
394
- }
395
- }
396
- function fo(e, t, n, r) {
397
- const o = nt(e);
398
- let i = uo(Me(e), n === "start", r);
399
- return o && (i = i.map((s) => s + "-" + o), t && (i = i.concat(i.map(Ht)))), i;
400
- }
401
- function vt(e) {
402
- return e.replace(/left|right|bottom|top/g, (t) => ro[t]);
403
- }
404
- function mo(e) {
405
- return {
406
- top: 0,
407
- right: 0,
408
- bottom: 0,
409
- left: 0,
410
- ...e
411
- };
412
- }
413
- function go(e) {
414
- return typeof e != "number" ? mo(e) : {
415
- top: e,
416
- right: e,
417
- bottom: e,
418
- left: e
419
- };
420
- }
421
- function xt(e) {
422
- const {
423
- x: t,
424
- y: n,
425
- width: r,
426
- height: o
427
- } = e;
428
- return {
429
- width: r,
430
- height: o,
431
- top: n,
432
- left: t,
433
- right: t + r,
434
- bottom: n + o,
435
- x: t,
436
- y: n
437
- };
438
- }
439
- function mn(e, t, n) {
440
- let {
441
- reference: r,
442
- floating: o
443
- } = e;
444
- const i = ye(t), s = Qn(t), l = Jn(s), a = Me(t), c = i === "y", d = r.x + r.width / 2 - o.width / 2, u = r.y + r.height / 2 - o.height / 2, p = r[l] / 2 - o[l] / 2;
445
- let f;
446
- switch (a) {
447
- case "top":
448
- f = {
449
- x: d,
450
- y: r.y - o.height
451
- };
452
- break;
453
- case "bottom":
454
- f = {
455
- x: d,
456
- y: r.y + r.height
457
- };
458
- break;
459
- case "right":
460
- f = {
461
- x: r.x + r.width,
462
- y: u
463
- };
464
- break;
465
- case "left":
466
- f = {
467
- x: r.x - o.width,
468
- y: u
469
- };
470
- break;
471
- default:
472
- f = {
473
- x: r.x,
474
- y: r.y
475
- };
476
- }
477
- switch (nt(t)) {
478
- case "start":
479
- f[s] -= p * (n && c ? -1 : 1);
480
- break;
481
- case "end":
482
- f[s] += p * (n && c ? -1 : 1);
483
- break;
484
- }
485
- return f;
486
- }
487
- const po = async (e, t, n) => {
488
- const {
489
- placement: r = "bottom",
490
- strategy: o = "absolute",
491
- middleware: i = [],
492
- platform: s
493
- } = n, l = i.filter(Boolean), a = await (s.isRTL == null ? void 0 : s.isRTL(t));
494
- let c = await s.getElementRects({
495
- reference: e,
496
- floating: t,
497
- strategy: o
498
- }), {
499
- x: d,
500
- y: u
501
- } = mn(c, r, a), p = r, f = {}, g = 0;
502
- for (let h = 0; h < l.length; h++) {
503
- const {
504
- name: x,
505
- fn: v
506
- } = l[h], {
507
- x: R,
508
- y: b,
509
- data: y,
510
- reset: P
511
- } = await v({
512
- x: d,
513
- y: u,
514
- initialPlacement: r,
515
- placement: p,
516
- strategy: o,
517
- middlewareData: f,
518
- rects: c,
519
- platform: s,
520
- elements: {
521
- reference: e,
522
- floating: t
523
- }
524
- });
525
- d = R ?? d, u = b ?? u, f = {
526
- ...f,
527
- [x]: {
528
- ...f[x],
529
- ...y
530
- }
531
- }, P && g <= 50 && (g++, typeof P == "object" && (P.placement && (p = P.placement), P.rects && (c = P.rects === !0 ? await s.getElementRects({
532
- reference: e,
533
- floating: t,
534
- strategy: o
535
- }) : P.rects), {
536
- x: d,
537
- y: u
538
- } = mn(c, p, a)), h = -1);
539
- }
540
- return {
541
- x: d,
542
- y: u,
543
- placement: p,
544
- strategy: o,
545
- middlewareData: f
546
- };
547
- };
548
- async function Xt(e, t) {
549
- var n;
550
- t === void 0 && (t = {});
551
- const {
552
- x: r,
553
- y: o,
554
- platform: i,
555
- rects: s,
556
- elements: l,
557
- strategy: a
558
- } = e, {
559
- boundary: c = "clippingAncestors",
560
- rootBoundary: d = "viewport",
561
- elementContext: u = "floating",
562
- altBoundary: p = !1,
563
- padding: f = 0
564
- } = tt(t, e), g = go(f), x = l[p ? u === "floating" ? "reference" : "floating" : u], v = xt(await i.getClippingRect({
565
- element: (n = await (i.isElement == null ? void 0 : i.isElement(x))) == null || n ? x : x.contextElement || await (i.getDocumentElement == null ? void 0 : i.getDocumentElement(l.floating)),
566
- boundary: c,
567
- rootBoundary: d,
568
- strategy: a
569
- })), R = u === "floating" ? {
570
- x: r,
571
- y: o,
572
- width: s.floating.width,
573
- height: s.floating.height
574
- } : s.reference, b = await (i.getOffsetParent == null ? void 0 : i.getOffsetParent(l.floating)), y = await (i.isElement == null ? void 0 : i.isElement(b)) ? await (i.getScale == null ? void 0 : i.getScale(b)) || {
575
- x: 1,
576
- y: 1
577
- } : {
578
- x: 1,
579
- y: 1
580
- }, P = xt(i.convertOffsetParentRelativeRectToViewportRelativeRect ? await i.convertOffsetParentRelativeRectToViewportRelativeRect({
581
- elements: l,
582
- rect: R,
583
- offsetParent: b,
584
- strategy: a
585
- }) : R);
586
- return {
587
- top: (v.top - P.top + g.top) / y.y,
588
- bottom: (P.bottom - v.bottom + g.bottom) / y.y,
589
- left: (v.left - P.left + g.left) / y.x,
590
- right: (P.right - v.right + g.right) / y.x
591
- };
592
- }
593
- const ho = function(e) {
594
- return e === void 0 && (e = {}), {
595
- name: "flip",
596
- options: e,
597
- async fn(t) {
598
- var n, r;
599
- const {
600
- placement: o,
601
- middlewareData: i,
602
- rects: s,
603
- initialPlacement: l,
604
- platform: a,
605
- elements: c
606
- } = t, {
607
- mainAxis: d = !0,
608
- crossAxis: u = !0,
609
- fallbackPlacements: p,
610
- fallbackStrategy: f = "bestFit",
611
- fallbackAxisSideDirection: g = "none",
612
- flipAlignment: h = !0,
613
- ...x
614
- } = tt(e, t);
615
- if ((n = i.arrow) != null && n.alignmentOffset)
616
- return {};
617
- const v = Me(o), R = ye(l), b = Me(l) === l, y = await (a.isRTL == null ? void 0 : a.isRTL(c.floating)), P = p || (b || !h ? [vt(l)] : co(l)), N = g !== "none";
618
- !p && N && P.push(...fo(l, h, g, y));
619
- const $ = [l, ...P], _ = await Xt(t, x), Y = [];
620
- let K = ((r = i.flip) == null ? void 0 : r.overflows) || [];
621
- if (d && Y.push(_[v]), u) {
622
- const S = so(o, s, y);
623
- Y.push(_[S[0]], _[S[1]]);
624
- }
625
- if (K = [...K, {
626
- placement: o,
627
- overflows: Y
628
- }], !Y.every((S) => S <= 0)) {
629
- var W, I;
630
- const S = (((W = i.flip) == null ? void 0 : W.index) || 0) + 1, w = $[S];
631
- if (w && (!(u === "alignment" ? R !== ye(w) : !1) || // We leave the current main axis only if every placement on that axis
632
- // overflows the main axis.
633
- K.every((E) => ye(E.placement) === R ? E.overflows[0] > 0 : !0)))
634
- return {
635
- data: {
636
- index: S,
637
- overflows: K
638
- },
639
- reset: {
640
- placement: w
641
- }
642
- };
643
- let O = (I = K.filter((D) => D.overflows[0] <= 0).sort((D, E) => D.overflows[1] - E.overflows[1])[0]) == null ? void 0 : I.placement;
644
- if (!O)
645
- switch (f) {
646
- case "bestFit": {
647
- var L;
648
- const D = (L = K.filter((E) => {
649
- if (N) {
650
- const C = ye(E.placement);
651
- return C === R || // Create a bias to the `y` side axis due to horizontal
652
- // reading directions favoring greater width.
653
- C === "y";
654
- }
655
- return !0;
656
- }).map((E) => [E.placement, E.overflows.filter((C) => C > 0).reduce((C, B) => C + B, 0)]).sort((E, C) => E[1] - C[1])[0]) == null ? void 0 : L[0];
657
- D && (O = D);
658
- break;
659
- }
660
- case "initialPlacement":
661
- O = l;
662
- break;
663
- }
664
- if (o !== O)
665
- return {
666
- reset: {
667
- placement: O
668
- }
669
- };
670
- }
671
- return {};
672
- }
673
- };
674
- }, bo = /* @__PURE__ */ new Set(["left", "top"]);
675
- async function vo(e, t) {
676
- const {
677
- placement: n,
678
- platform: r,
679
- elements: o
680
- } = e, i = await (r.isRTL == null ? void 0 : r.isRTL(o.floating)), s = Me(n), l = nt(n), a = ye(n) === "y", c = bo.has(s) ? -1 : 1, d = i && a ? -1 : 1, u = tt(t, e);
681
- let {
682
- mainAxis: p,
683
- crossAxis: f,
684
- alignmentAxis: g
685
- } = typeof u == "number" ? {
686
- mainAxis: u,
687
- crossAxis: 0,
688
- alignmentAxis: null
689
- } : {
690
- mainAxis: u.mainAxis || 0,
691
- crossAxis: u.crossAxis || 0,
692
- alignmentAxis: u.alignmentAxis
693
- };
694
- return l && typeof g == "number" && (f = l === "end" ? g * -1 : g), a ? {
695
- x: f * d,
696
- y: p * c
697
- } : {
698
- x: p * c,
699
- y: f * d
700
- };
701
- }
702
- const xo = function(e) {
703
- return e === void 0 && (e = 0), {
704
- name: "offset",
705
- options: e,
706
- async fn(t) {
707
- var n, r;
708
- const {
709
- x: o,
710
- y: i,
711
- placement: s,
712
- middlewareData: l
713
- } = t, a = await vo(t, e);
714
- return s === ((n = l.offset) == null ? void 0 : n.placement) && (r = l.arrow) != null && r.alignmentOffset ? {} : {
715
- x: o + a.x,
716
- y: i + a.y,
717
- data: {
718
- ...a,
719
- placement: s
720
- }
721
- };
722
- }
723
- };
724
- }, wo = function(e) {
725
- return e === void 0 && (e = {}), {
726
- name: "shift",
727
- options: e,
728
- async fn(t) {
729
- const {
730
- x: n,
731
- y: r,
732
- placement: o
733
- } = t, {
734
- mainAxis: i = !0,
735
- crossAxis: s = !1,
736
- limiter: l = {
737
- fn: (x) => {
738
- let {
739
- x: v,
740
- y: R
741
- } = x;
742
- return {
743
- x: v,
744
- y: R
745
- };
746
- }
747
- },
748
- ...a
749
- } = tt(e, t), c = {
750
- x: n,
751
- y: r
752
- }, d = await Xt(t, a), u = ye(Me(o)), p = Zn(u);
753
- let f = c[p], g = c[u];
754
- if (i) {
755
- const x = p === "y" ? "top" : "left", v = p === "y" ? "bottom" : "right", R = f + d[x], b = f - d[v];
756
- f = un(R, f, b);
757
- }
758
- if (s) {
759
- const x = u === "y" ? "top" : "left", v = u === "y" ? "bottom" : "right", R = g + d[x], b = g - d[v];
760
- g = un(R, g, b);
761
- }
762
- const h = l.fn({
763
- ...t,
764
- [p]: f,
765
- [u]: g
766
- });
767
- return {
768
- ...h,
769
- data: {
770
- x: h.x - n,
771
- y: h.y - r,
772
- enabled: {
773
- [p]: i,
774
- [u]: s
775
- }
776
- }
777
- };
778
- }
779
- };
780
- }, yo = function(e) {
781
- return e === void 0 && (e = {}), {
782
- name: "size",
783
- options: e,
784
- async fn(t) {
785
- var n, r;
786
- const {
787
- placement: o,
788
- rects: i,
789
- platform: s,
790
- elements: l
791
- } = t, {
792
- apply: a = () => {
793
- },
794
- ...c
795
- } = tt(e, t), d = await Xt(t, c), u = Me(o), p = nt(o), f = ye(o) === "y", {
796
- width: g,
797
- height: h
798
- } = i.floating;
799
- let x, v;
800
- u === "top" || u === "bottom" ? (x = u, v = p === (await (s.isRTL == null ? void 0 : s.isRTL(l.floating)) ? "start" : "end") ? "left" : "right") : (v = u, x = p === "end" ? "top" : "bottom");
801
- const R = h - d.top - d.bottom, b = g - d.left - d.right, y = Be(h - d[x], R), P = Be(g - d[v], b), N = !t.middlewareData.shift;
802
- let $ = y, _ = P;
803
- if ((n = t.middlewareData.shift) != null && n.enabled.x && (_ = b), (r = t.middlewareData.shift) != null && r.enabled.y && ($ = R), N && !p) {
804
- const K = ie(d.left, 0), W = ie(d.right, 0), I = ie(d.top, 0), L = ie(d.bottom, 0);
805
- f ? _ = g - 2 * (K !== 0 || W !== 0 ? K + W : ie(d.left, d.right)) : $ = h - 2 * (I !== 0 || L !== 0 ? I + L : ie(d.top, d.bottom));
806
- }
807
- await a({
808
- ...t,
809
- availableWidth: _,
810
- availableHeight: $
811
- });
812
- const Y = await s.getDimensions(l.floating);
813
- return g !== Y.width || h !== Y.height ? {
814
- reset: {
815
- rects: !0
816
- }
817
- } : {};
818
- }
819
- };
820
- };
821
- function It() {
822
- return typeof window < "u";
823
- }
824
- function qe(e) {
825
- return er(e) ? (e.nodeName || "").toLowerCase() : "#document";
826
- }
827
- function se(e) {
828
- var t;
829
- return (e == null || (t = e.ownerDocument) == null ? void 0 : t.defaultView) || window;
830
- }
831
- function be(e) {
832
- var t;
833
- return (t = (er(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : t.documentElement;
834
- }
835
- function er(e) {
836
- return It() ? e instanceof Node || e instanceof se(e).Node : !1;
837
- }
838
- function ue(e) {
839
- return It() ? e instanceof Element || e instanceof se(e).Element : !1;
840
- }
841
- function he(e) {
842
- return It() ? e instanceof HTMLElement || e instanceof se(e).HTMLElement : !1;
843
- }
844
- function gn(e) {
845
- return !It() || typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof se(e).ShadowRoot;
846
- }
847
- const Ro = /* @__PURE__ */ new Set(["inline", "contents"]);
848
- function rt(e) {
849
- const {
850
- overflow: t,
851
- overflowX: n,
852
- overflowY: r,
853
- display: o
854
- } = fe(e);
855
- return /auto|scroll|overlay|hidden|clip/.test(t + r + n) && !Ro.has(o);
856
- }
857
- const Eo = /* @__PURE__ */ new Set(["table", "td", "th"]);
858
- function Co(e) {
859
- return Eo.has(qe(e));
860
- }
861
- const Io = [":popover-open", ":modal"];
862
- function St(e) {
863
- return Io.some((t) => {
864
- try {
865
- return e.matches(t);
866
- } catch {
867
- return !1;
868
- }
869
- });
870
- }
871
- const So = ["transform", "translate", "scale", "rotate", "perspective"], To = ["transform", "translate", "scale", "rotate", "perspective", "filter"], Ao = ["paint", "layout", "strict", "content"];
872
- function Yt(e) {
873
- const t = Gt(), n = ue(e) ? fe(e) : e;
874
- return So.some((r) => n[r] ? n[r] !== "none" : !1) || (n.containerType ? n.containerType !== "normal" : !1) || !t && (n.backdropFilter ? n.backdropFilter !== "none" : !1) || !t && (n.filter ? n.filter !== "none" : !1) || To.some((r) => (n.willChange || "").includes(r)) || Ao.some((r) => (n.contain || "").includes(r));
875
- }
876
- function Oo(e) {
877
- let t = De(e);
878
- for (; he(t) && !We(t); ) {
879
- if (Yt(t))
880
- return t;
881
- if (St(t))
882
- return null;
883
- t = De(t);
884
- }
885
- return null;
886
- }
887
- function Gt() {
888
- return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
889
- }
890
- const Mo = /* @__PURE__ */ new Set(["html", "body", "#document"]);
891
- function We(e) {
892
- return Mo.has(qe(e));
893
- }
894
- function fe(e) {
895
- return se(e).getComputedStyle(e);
896
- }
897
- function Tt(e) {
898
- return ue(e) ? {
899
- scrollLeft: e.scrollLeft,
900
- scrollTop: e.scrollTop
901
- } : {
902
- scrollLeft: e.scrollX,
903
- scrollTop: e.scrollY
904
- };
905
- }
906
- function De(e) {
907
- if (qe(e) === "html")
908
- return e;
909
- const t = (
910
- // Step into the shadow DOM of the parent of a slotted node.
911
- e.assignedSlot || // DOM Element detected.
912
- e.parentNode || // ShadowRoot detected.
913
- gn(e) && e.host || // Fallback.
914
- be(e)
915
- );
916
- return gn(t) ? t.host : t;
917
- }
918
- function tr(e) {
919
- const t = De(e);
920
- return We(t) ? e.ownerDocument ? e.ownerDocument.body : e.body : he(t) && rt(t) ? t : tr(t);
921
- }
922
- function Ae(e, t, n) {
923
- var r;
924
- t === void 0 && (t = []), n === void 0 && (n = !0);
925
- const o = tr(e), i = o === ((r = e.ownerDocument) == null ? void 0 : r.body), s = se(o);
926
- if (i) {
927
- const l = zt(s);
928
- return t.concat(s, s.visualViewport || [], rt(o) ? o : [], l && n ? Ae(l) : []);
929
- }
930
- return t.concat(o, Ae(o, [], n));
931
- }
932
- function zt(e) {
933
- return e.parent && Object.getPrototypeOf(e.parent) ? e.frameElement : null;
934
- }
935
- function nr(e) {
936
- const t = fe(e);
937
- let n = parseFloat(t.width) || 0, r = parseFloat(t.height) || 0;
938
- const o = he(e), i = o ? e.offsetWidth : n, s = o ? e.offsetHeight : r, l = bt(n) !== i || bt(r) !== s;
939
- return l && (n = i, r = s), {
940
- width: n,
941
- height: r,
942
- $: l
943
- };
944
- }
945
- function Zt(e) {
946
- return ue(e) ? e : e.contextElement;
947
- }
948
- function Ve(e) {
949
- const t = Zt(e);
950
- if (!he(t))
951
- return pe(1);
952
- const n = t.getBoundingClientRect(), {
953
- width: r,
954
- height: o,
955
- $: i
956
- } = nr(t);
957
- let s = (i ? bt(n.width) : n.width) / r, l = (i ? bt(n.height) : n.height) / o;
958
- return (!s || !Number.isFinite(s)) && (s = 1), (!l || !Number.isFinite(l)) && (l = 1), {
959
- x: s,
960
- y: l
961
- };
962
- }
963
- const Do = /* @__PURE__ */ pe(0);
964
- function rr(e) {
965
- const t = se(e);
966
- return !Gt() || !t.visualViewport ? Do : {
967
- x: t.visualViewport.offsetLeft,
968
- y: t.visualViewport.offsetTop
969
- };
970
- }
971
- function Po(e, t, n) {
972
- return t === void 0 && (t = !1), !n || t && n !== se(e) ? !1 : t;
973
- }
974
- function Le(e, t, n, r) {
975
- t === void 0 && (t = !1), n === void 0 && (n = !1);
976
- const o = e.getBoundingClientRect(), i = Zt(e);
977
- let s = pe(1);
978
- t && (r ? ue(r) && (s = Ve(r)) : s = Ve(e));
979
- const l = Po(i, n, r) ? rr(i) : pe(0);
980
- let a = (o.left + l.x) / s.x, c = (o.top + l.y) / s.y, d = o.width / s.x, u = o.height / s.y;
981
- if (i) {
982
- const p = se(i), f = r && ue(r) ? se(r) : r;
983
- let g = p, h = zt(g);
984
- for (; h && r && f !== g; ) {
985
- const x = Ve(h), v = h.getBoundingClientRect(), R = fe(h), b = v.left + (h.clientLeft + parseFloat(R.paddingLeft)) * x.x, y = v.top + (h.clientTop + parseFloat(R.paddingTop)) * x.y;
986
- a *= x.x, c *= x.y, d *= x.x, u *= x.y, a += b, c += y, g = se(h), h = zt(g);
987
- }
988
- }
989
- return xt({
990
- width: d,
991
- height: u,
992
- x: a,
993
- y: c
994
- });
995
- }
996
- function At(e, t) {
997
- const n = Tt(e).scrollLeft;
998
- return t ? t.left + n : Le(be(e)).left + n;
999
- }
1000
- function or(e, t) {
1001
- const n = e.getBoundingClientRect(), r = n.left + t.scrollLeft - At(e, n), o = n.top + t.scrollTop;
1002
- return {
1003
- x: r,
1004
- y: o
1005
- };
1006
- }
1007
- function Fo(e) {
1008
- let {
1009
- elements: t,
1010
- rect: n,
1011
- offsetParent: r,
1012
- strategy: o
1013
- } = e;
1014
- const i = o === "fixed", s = be(r), l = t ? St(t.floating) : !1;
1015
- if (r === s || l && i)
1016
- return n;
1017
- let a = {
1018
- scrollLeft: 0,
1019
- scrollTop: 0
1020
- }, c = pe(1);
1021
- const d = pe(0), u = he(r);
1022
- if ((u || !u && !i) && ((qe(r) !== "body" || rt(s)) && (a = Tt(r)), he(r))) {
1023
- const f = Le(r);
1024
- c = Ve(r), d.x = f.x + r.clientLeft, d.y = f.y + r.clientTop;
1025
- }
1026
- const p = s && !u && !i ? or(s, a) : pe(0);
1027
- return {
1028
- width: n.width * c.x,
1029
- height: n.height * c.y,
1030
- x: n.x * c.x - a.scrollLeft * c.x + d.x + p.x,
1031
- y: n.y * c.y - a.scrollTop * c.y + d.y + p.y
1032
- };
1033
- }
1034
- function No(e) {
1035
- return Array.from(e.getClientRects());
1036
- }
1037
- function Lo(e) {
1038
- const t = be(e), n = Tt(e), r = e.ownerDocument.body, o = ie(t.scrollWidth, t.clientWidth, r.scrollWidth, r.clientWidth), i = ie(t.scrollHeight, t.clientHeight, r.scrollHeight, r.clientHeight);
1039
- let s = -n.scrollLeft + At(e);
1040
- const l = -n.scrollTop;
1041
- return fe(r).direction === "rtl" && (s += ie(t.clientWidth, r.clientWidth) - o), {
1042
- width: o,
1043
- height: i,
1044
- x: s,
1045
- y: l
1046
- };
1047
- }
1048
- const pn = 25;
1049
- function ko(e, t) {
1050
- const n = se(e), r = be(e), o = n.visualViewport;
1051
- let i = r.clientWidth, s = r.clientHeight, l = 0, a = 0;
1052
- if (o) {
1053
- i = o.width, s = o.height;
1054
- const d = Gt();
1055
- (!d || d && t === "fixed") && (l = o.offsetLeft, a = o.offsetTop);
1056
- }
1057
- const c = At(r);
1058
- if (c <= 0) {
1059
- const d = r.ownerDocument, u = d.body, p = getComputedStyle(u), f = d.compatMode === "CSS1Compat" && parseFloat(p.marginLeft) + parseFloat(p.marginRight) || 0, g = Math.abs(r.clientWidth - u.clientWidth - f);
1060
- g <= pn && (i -= g);
1061
- } else c <= pn && (i += c);
1062
- return {
1063
- width: i,
1064
- height: s,
1065
- x: l,
1066
- y: a
1067
- };
1068
- }
1069
- const Vo = /* @__PURE__ */ new Set(["absolute", "fixed"]);
1070
- function _o(e, t) {
1071
- const n = Le(e, !0, t === "fixed"), r = n.top + e.clientTop, o = n.left + e.clientLeft, i = he(e) ? Ve(e) : pe(1), s = e.clientWidth * i.x, l = e.clientHeight * i.y, a = o * i.x, c = r * i.y;
1072
- return {
1073
- width: s,
1074
- height: l,
1075
- x: a,
1076
- y: c
1077
- };
1078
- }
1079
- function hn(e, t, n) {
1080
- let r;
1081
- if (t === "viewport")
1082
- r = ko(e, n);
1083
- else if (t === "document")
1084
- r = Lo(be(e));
1085
- else if (ue(t))
1086
- r = _o(t, n);
1087
- else {
1088
- const o = rr(e);
1089
- r = {
1090
- x: t.x - o.x,
1091
- y: t.y - o.y,
1092
- width: t.width,
1093
- height: t.height
1094
- };
1095
- }
1096
- return xt(r);
1097
- }
1098
- function ir(e, t) {
1099
- const n = De(e);
1100
- return n === t || !ue(n) || We(n) ? !1 : fe(n).position === "fixed" || ir(n, t);
1101
- }
1102
- function $o(e, t) {
1103
- const n = t.get(e);
1104
- if (n)
1105
- return n;
1106
- let r = Ae(e, [], !1).filter((l) => ue(l) && qe(l) !== "body"), o = null;
1107
- const i = fe(e).position === "fixed";
1108
- let s = i ? De(e) : e;
1109
- for (; ue(s) && !We(s); ) {
1110
- const l = fe(s), a = Yt(s);
1111
- !a && l.position === "fixed" && (o = null), (i ? !a && !o : !a && l.position === "static" && !!o && Vo.has(o.position) || rt(s) && !a && ir(e, s)) ? r = r.filter((d) => d !== s) : o = l, s = De(s);
1112
- }
1113
- return t.set(e, r), r;
1114
- }
1115
- function Bo(e) {
1116
- let {
1117
- element: t,
1118
- boundary: n,
1119
- rootBoundary: r,
1120
- strategy: o
1121
- } = e;
1122
- const s = [...n === "clippingAncestors" ? St(t) ? [] : $o(t, this._c) : [].concat(n), r], l = s[0], a = s.reduce((c, d) => {
1123
- const u = hn(t, d, o);
1124
- return c.top = ie(u.top, c.top), c.right = Be(u.right, c.right), c.bottom = Be(u.bottom, c.bottom), c.left = ie(u.left, c.left), c;
1125
- }, hn(t, l, o));
1126
- return {
1127
- width: a.right - a.left,
1128
- height: a.bottom - a.top,
1129
- x: a.left,
1130
- y: a.top
1131
- };
1132
- }
1133
- function Wo(e) {
1134
- const {
1135
- width: t,
1136
- height: n
1137
- } = nr(e);
1138
- return {
1139
- width: t,
1140
- height: n
1141
- };
1142
- }
1143
- function Ko(e, t, n) {
1144
- const r = he(t), o = be(t), i = n === "fixed", s = Le(e, !0, i, t);
1145
- let l = {
1146
- scrollLeft: 0,
1147
- scrollTop: 0
1148
- };
1149
- const a = pe(0);
1150
- function c() {
1151
- a.x = At(o);
1152
- }
1153
- if (r || !r && !i)
1154
- if ((qe(t) !== "body" || rt(o)) && (l = Tt(t)), r) {
1155
- const f = Le(t, !0, i, t);
1156
- a.x = f.x + t.clientLeft, a.y = f.y + t.clientTop;
1157
- } else o && c();
1158
- i && !r && o && c();
1159
- const d = o && !r && !i ? or(o, l) : pe(0), u = s.left + l.scrollLeft - a.x - d.x, p = s.top + l.scrollTop - a.y - d.y;
1160
- return {
1161
- x: u,
1162
- y: p,
1163
- width: s.width,
1164
- height: s.height
1165
- };
1166
- }
1167
- function Pt(e) {
1168
- return fe(e).position === "static";
1169
- }
1170
- function bn(e, t) {
1171
- if (!he(e) || fe(e).position === "fixed")
1172
- return null;
1173
- if (t)
1174
- return t(e);
1175
- let n = e.offsetParent;
1176
- return be(e) === n && (n = n.ownerDocument.body), n;
1177
- }
1178
- function sr(e, t) {
1179
- const n = se(e);
1180
- if (St(e))
1181
- return n;
1182
- if (!he(e)) {
1183
- let o = De(e);
1184
- for (; o && !We(o); ) {
1185
- if (ue(o) && !Pt(o))
1186
- return o;
1187
- o = De(o);
1188
- }
1189
- return n;
1190
- }
1191
- let r = bn(e, t);
1192
- for (; r && Co(r) && Pt(r); )
1193
- r = bn(r, t);
1194
- return r && We(r) && Pt(r) && !Yt(r) ? n : r || Oo(e) || n;
1195
- }
1196
- const Ho = async function(e) {
1197
- const t = this.getOffsetParent || sr, n = this.getDimensions, r = await n(e.floating);
1198
- return {
1199
- reference: Ko(e.reference, await t(e.floating), e.strategy),
1200
- floating: {
1201
- x: 0,
1202
- y: 0,
1203
- width: r.width,
1204
- height: r.height
1205
- }
1206
- };
1207
- };
1208
- function zo(e) {
1209
- return fe(e).direction === "rtl";
1210
- }
1211
- const qo = {
1212
- convertOffsetParentRelativeRectToViewportRelativeRect: Fo,
1213
- getDocumentElement: be,
1214
- getClippingRect: Bo,
1215
- getOffsetParent: sr,
1216
- getElementRects: Ho,
1217
- getClientRects: No,
1218
- getDimensions: Wo,
1219
- getScale: Ve,
1220
- isElement: ue,
1221
- isRTL: zo
1222
- };
1223
- function cr(e, t) {
1224
- return e.x === t.x && e.y === t.y && e.width === t.width && e.height === t.height;
1225
- }
1226
- function jo(e, t) {
1227
- let n = null, r;
1228
- const o = be(e);
1229
- function i() {
1230
- var l;
1231
- clearTimeout(r), (l = n) == null || l.disconnect(), n = null;
1232
- }
1233
- function s(l, a) {
1234
- l === void 0 && (l = !1), a === void 0 && (a = 1), i();
1235
- const c = e.getBoundingClientRect(), {
1236
- left: d,
1237
- top: u,
1238
- width: p,
1239
- height: f
1240
- } = c;
1241
- if (l || t(), !p || !f)
1242
- return;
1243
- const g = lt(u), h = lt(o.clientWidth - (d + p)), x = lt(o.clientHeight - (u + f)), v = lt(d), b = {
1244
- rootMargin: -g + "px " + -h + "px " + -x + "px " + -v + "px",
1245
- threshold: ie(0, Be(1, a)) || 1
1246
- };
1247
- let y = !0;
1248
- function P(N) {
1249
- const $ = N[0].intersectionRatio;
1250
- if ($ !== a) {
1251
- if (!y)
1252
- return s();
1253
- $ ? s(!1, $) : r = setTimeout(() => {
1254
- s(!1, 1e-7);
1255
- }, 1e3);
1256
- }
1257
- $ === 1 && !cr(c, e.getBoundingClientRect()) && s(), y = !1;
1258
- }
1259
- try {
1260
- n = new IntersectionObserver(P, {
1261
- ...b,
1262
- // Handle <iframe>s
1263
- root: o.ownerDocument
1264
- });
1265
- } catch {
1266
- n = new IntersectionObserver(P, b);
1267
- }
1268
- n.observe(e);
1269
- }
1270
- return s(!0), i;
1271
- }
1272
- function zi(e, t, n, r) {
1273
- r === void 0 && (r = {});
1274
- const {
1275
- ancestorScroll: o = !0,
1276
- ancestorResize: i = !0,
1277
- elementResize: s = typeof ResizeObserver == "function",
1278
- layoutShift: l = typeof IntersectionObserver == "function",
1279
- animationFrame: a = !1
1280
- } = r, c = Zt(e), d = o || i ? [...c ? Ae(c) : [], ...Ae(t)] : [];
1281
- d.forEach((v) => {
1282
- o && v.addEventListener("scroll", n, {
1283
- passive: !0
1284
- }), i && v.addEventListener("resize", n);
1285
- });
1286
- const u = c && l ? jo(c, n) : null;
1287
- let p = -1, f = null;
1288
- s && (f = new ResizeObserver((v) => {
1289
- let [R] = v;
1290
- R && R.target === c && f && (f.unobserve(t), cancelAnimationFrame(p), p = requestAnimationFrame(() => {
1291
- var b;
1292
- (b = f) == null || b.observe(t);
1293
- })), n();
1294
- }), c && !a && f.observe(c), f.observe(t));
1295
- let g, h = a ? Le(e) : null;
1296
- a && x();
1297
- function x() {
1298
- const v = Le(e);
1299
- h && !cr(h, v) && n(), h = v, g = requestAnimationFrame(x);
1300
- }
1301
- return n(), () => {
1302
- var v;
1303
- d.forEach((R) => {
1304
- o && R.removeEventListener("scroll", n), i && R.removeEventListener("resize", n);
1305
- }), u?.(), (v = f) == null || v.disconnect(), f = null, a && cancelAnimationFrame(g);
1306
- };
1307
- }
1308
- const Uo = xo, qi = wo, Xo = ho, Yo = yo, Go = (e, t, n) => {
1309
- const r = /* @__PURE__ */ new Map(), o = {
1310
- platform: qo,
1311
- ...n
1312
- }, i = {
1313
- ...o.platform,
1314
- _c: r
1315
- };
1316
- return po(e, t, {
1317
- ...o,
1318
- platform: i
1319
- });
1320
- };
1321
- var dt = typeof document < "u" ? kn : Vn;
1322
- function wt(e, t) {
1323
- if (e === t)
1324
- return !0;
1325
- if (typeof e != typeof t)
1326
- return !1;
1327
- if (typeof e == "function" && e.toString() === t.toString())
1328
- return !0;
1329
- let n, r, o;
1330
- if (e && t && typeof e == "object") {
1331
- if (Array.isArray(e)) {
1332
- if (n = e.length, n !== t.length) return !1;
1333
- for (r = n; r-- !== 0; )
1334
- if (!wt(e[r], t[r]))
1335
- return !1;
1336
- return !0;
1337
- }
1338
- if (o = Object.keys(e), n = o.length, n !== Object.keys(t).length)
1339
- return !1;
1340
- for (r = n; r-- !== 0; )
1341
- if (!{}.hasOwnProperty.call(t, o[r]))
1342
- return !1;
1343
- for (r = n; r-- !== 0; ) {
1344
- const i = o[r];
1345
- if (!(i === "_owner" && e.$$typeof) && !wt(e[i], t[i]))
1346
- return !1;
1347
- }
1348
- return !0;
1349
- }
1350
- return e !== e && t !== t;
1351
- }
1352
- function lr(e) {
1353
- return typeof window > "u" ? 1 : (e.ownerDocument.defaultView || window).devicePixelRatio || 1;
1354
- }
1355
- function vn(e, t) {
1356
- const n = lr(e);
1357
- return Math.round(t * n) / n;
1358
- }
1359
- function Ft(e) {
1360
- const t = m.useRef(e);
1361
- return dt(() => {
1362
- t.current = e;
1363
- }), t;
1364
- }
1365
- function Zo(e) {
1366
- e === void 0 && (e = {});
1367
- const {
1368
- placement: t = "bottom",
1369
- strategy: n = "absolute",
1370
- middleware: r = [],
1371
- platform: o,
1372
- elements: {
1373
- reference: i,
1374
- floating: s
1375
- } = {},
1376
- transform: l = !0,
1377
- whileElementsMounted: a,
1378
- open: c
1379
- } = e, [d, u] = m.useState({
1380
- x: 0,
1381
- y: 0,
1382
- strategy: n,
1383
- placement: t,
1384
- middlewareData: {},
1385
- isPositioned: !1
1386
- }), [p, f] = m.useState(r);
1387
- wt(p, r) || f(r);
1388
- const [g, h] = m.useState(null), [x, v] = m.useState(null), R = m.useCallback((E) => {
1389
- E !== N.current && (N.current = E, h(E));
1390
- }, []), b = m.useCallback((E) => {
1391
- E !== $.current && ($.current = E, v(E));
1392
- }, []), y = i || g, P = s || x, N = m.useRef(null), $ = m.useRef(null), _ = m.useRef(d), Y = a != null, K = Ft(a), W = Ft(o), I = Ft(c), L = m.useCallback(() => {
1393
- if (!N.current || !$.current)
1394
- return;
1395
- const E = {
1396
- placement: t,
1397
- strategy: n,
1398
- middleware: p
1399
- };
1400
- W.current && (E.platform = W.current), Go(N.current, $.current, E).then((C) => {
1401
- const B = {
1402
- ...C,
1403
- // The floating element's position may be recomputed while it's closed
1404
- // but still mounted (such as when transitioning out). To ensure
1405
- // `isPositioned` will be `false` initially on the next open, avoid
1406
- // setting it to `true` when `open === false` (must be specified).
1407
- isPositioned: I.current !== !1
1408
- };
1409
- S.current && !wt(_.current, B) && (_.current = B, $n.flushSync(() => {
1410
- u(B);
1411
- }));
1412
- });
1413
- }, [p, t, n, W, I]);
1414
- dt(() => {
1415
- c === !1 && _.current.isPositioned && (_.current.isPositioned = !1, u((E) => ({
1416
- ...E,
1417
- isPositioned: !1
1418
- })));
1419
- }, [c]);
1420
- const S = m.useRef(!1);
1421
- dt(() => (S.current = !0, () => {
1422
- S.current = !1;
1423
- }), []), dt(() => {
1424
- if (y && (N.current = y), P && ($.current = P), y && P) {
1425
- if (K.current)
1426
- return K.current(y, P, L);
1427
- L();
1428
- }
1429
- }, [y, P, L, K, Y]);
1430
- const w = m.useMemo(() => ({
1431
- reference: N,
1432
- floating: $,
1433
- setReference: R,
1434
- setFloating: b
1435
- }), [R, b]), O = m.useMemo(() => ({
1436
- reference: y,
1437
- floating: P
1438
- }), [y, P]), D = m.useMemo(() => {
1439
- const E = {
1440
- position: n,
1441
- left: 0,
1442
- top: 0
1443
- };
1444
- if (!O.floating)
1445
- return E;
1446
- const C = vn(O.floating, d.x), B = vn(O.floating, d.y);
1447
- return l ? {
1448
- ...E,
1449
- transform: "translate(" + C + "px, " + B + "px)",
1450
- ...lr(O.floating) >= 1.5 && {
1451
- willChange: "transform"
1452
- }
1453
- } : {
1454
- position: n,
1455
- left: C,
1456
- top: B
1457
- };
1458
- }, [n, l, O.floating, d.x, d.y]);
1459
- return m.useMemo(() => ({
1460
- ...d,
1461
- update: L,
1462
- refs: w,
1463
- elements: O,
1464
- floatingStyles: D
1465
- }), [d, L, w, O, D]);
1466
- }
1467
- const ji = (e, t) => ({
1468
- ...Uo(e),
1469
- options: [e, t]
1470
- }), Ui = (e, t) => ({
1471
- ...Xo(e),
1472
- options: [e, t]
1473
- }), Xi = (e, t) => ({
1474
- ...Yo(e),
1475
- options: [e, t]
1476
- });
1477
- function Jo(e) {
1478
- return m.useMemo(() => e.every((t) => t == null) ? null : (t) => {
1479
- e.forEach((n) => {
1480
- typeof n == "function" ? n(t) : n != null && (n.current = t);
1481
- });
1482
- }, e);
1483
- }
1484
- const ar = {
1485
- ...m
1486
- }, Qo = ar.useInsertionEffect, ei = Qo || ((e) => e());
1487
- function ae(e) {
1488
- const t = m.useRef(() => {
1489
- if (process.env.NODE_ENV !== "production")
1490
- throw new Error("Cannot call an event handler while rendering.");
1491
- });
1492
- return ei(() => {
1493
- t.current = e;
1494
- }), m.useCallback(function() {
1495
- for (var n = arguments.length, r = new Array(n), o = 0; o < n; o++)
1496
- r[o] = arguments[o];
1497
- return t.current == null ? void 0 : t.current(...r);
1498
- }, []);
1499
- }
1500
- const Jt = "ArrowUp", ot = "ArrowDown", Ke = "ArrowLeft", je = "ArrowRight";
1501
- function at(e, t, n) {
1502
- return Math.floor(e / t) !== n;
1503
- }
1504
- function Ye(e, t) {
1505
- return t < 0 || t >= e.current.length;
1506
- }
1507
- function Nt(e, t) {
1508
- return J(e, {
1509
- disabledIndices: t
1510
- });
1511
- }
1512
- function xn(e, t) {
1513
- return J(e, {
1514
- decrement: !0,
1515
- startingIndex: e.current.length,
1516
- disabledIndices: t
1517
- });
1518
- }
1519
- function J(e, t) {
1520
- let {
1521
- startingIndex: n = -1,
1522
- decrement: r = !1,
1523
- disabledIndices: o,
1524
- amount: i = 1
1525
- } = t === void 0 ? {} : t;
1526
- const s = e.current;
1527
- let l = n;
1528
- do
1529
- l += r ? -i : i;
1530
- while (l >= 0 && l <= s.length - 1 && mt(s, l, o));
1531
- return l;
1532
- }
1533
- function ti(e, t) {
1534
- let {
1535
- event: n,
1536
- orientation: r,
1537
- loop: o,
1538
- cols: i,
1539
- disabledIndices: s,
1540
- minIndex: l,
1541
- maxIndex: a,
1542
- prevIndex: c,
1543
- stopEvent: d = !1
1544
- } = t, u = c;
1545
- if (n.key === Jt) {
1546
- if (d && te(n), c === -1)
1547
- u = a;
1548
- else if (u = J(e, {
1549
- startingIndex: u,
1550
- amount: i,
1551
- decrement: !0,
1552
- disabledIndices: s
1553
- }), o && (c - i < l || u < 0)) {
1554
- const p = c % i, f = a % i, g = a - (f - p);
1555
- f === p ? u = a : u = f > p ? g : g - i;
1556
- }
1557
- Ye(e, u) && (u = c);
1558
- }
1559
- if (n.key === ot && (d && te(n), c === -1 ? u = l : (u = J(e, {
1560
- startingIndex: c,
1561
- amount: i,
1562
- disabledIndices: s
1563
- }), o && c + i > a && (u = J(e, {
1564
- startingIndex: c % i - i,
1565
- amount: i,
1566
- disabledIndices: s
1567
- }))), Ye(e, u) && (u = c)), r === "both") {
1568
- const p = ln(c / i);
1569
- n.key === je && (d && te(n), c % i !== i - 1 ? (u = J(e, {
1570
- startingIndex: c,
1571
- disabledIndices: s
1572
- }), o && at(u, i, p) && (u = J(e, {
1573
- startingIndex: c - c % i - 1,
1574
- disabledIndices: s
1575
- }))) : o && (u = J(e, {
1576
- startingIndex: c - c % i - 1,
1577
- disabledIndices: s
1578
- })), at(u, i, p) && (u = c)), n.key === Ke && (d && te(n), c % i !== 0 ? (u = J(e, {
1579
- startingIndex: c,
1580
- decrement: !0,
1581
- disabledIndices: s
1582
- }), o && at(u, i, p) && (u = J(e, {
1583
- startingIndex: c + (i - c % i),
1584
- decrement: !0,
1585
- disabledIndices: s
1586
- }))) : o && (u = J(e, {
1587
- startingIndex: c + (i - c % i),
1588
- decrement: !0,
1589
- disabledIndices: s
1590
- })), at(u, i, p) && (u = c));
1591
- const f = ln(a / i) === p;
1592
- Ye(e, u) && (o && f ? u = n.key === Ke ? a : J(e, {
1593
- startingIndex: c - c % i - 1,
1594
- disabledIndices: s
1595
- }) : u = c);
1596
- }
1597
- return u;
1598
- }
1599
- function ni(e, t, n) {
1600
- const r = [];
1601
- let o = 0;
1602
- return e.forEach((i, s) => {
1603
- let {
1604
- width: l,
1605
- height: a
1606
- } = i;
1607
- if (l > t && process.env.NODE_ENV !== "production")
1608
- throw new Error("[Floating UI]: Invalid grid - item width at index " + s + " is greater than grid columns");
1609
- let c = !1;
1610
- for (n && (o = 0); !c; ) {
1611
- const d = [];
1612
- for (let u = 0; u < l; u++)
1613
- for (let p = 0; p < a; p++)
1614
- d.push(o + u + p * t);
1615
- o % t + l <= t && d.every((u) => r[u] == null) ? (d.forEach((u) => {
1616
- r[u] = s;
1617
- }), c = !0) : o++;
1618
- }
1619
- }), [...r];
1620
- }
1621
- function ri(e, t, n, r, o) {
1622
- if (e === -1) return -1;
1623
- const i = n.indexOf(e), s = t[e];
1624
- switch (o) {
1625
- case "tl":
1626
- return i;
1627
- case "tr":
1628
- return s ? i + s.width - 1 : i;
1629
- case "bl":
1630
- return s ? i + (s.height - 1) * r : i;
1631
- case "br":
1632
- return n.lastIndexOf(e);
1633
- }
1634
- }
1635
- function oi(e, t) {
1636
- return t.flatMap((n, r) => e.includes(n) ? [r] : []);
1637
- }
1638
- function mt(e, t, n) {
1639
- if (n)
1640
- return n.includes(t);
1641
- const r = e[t];
1642
- return r == null || r.hasAttribute("disabled") || r.getAttribute("aria-disabled") === "true";
1643
- }
1644
- let wn = 0;
1645
- function Se(e, t) {
1646
- t === void 0 && (t = {});
1647
- const {
1648
- preventScroll: n = !1,
1649
- cancelPrevious: r = !0,
1650
- sync: o = !1
1651
- } = t;
1652
- r && cancelAnimationFrame(wn);
1653
- const i = () => e?.focus({
1654
- preventScroll: n
1655
- });
1656
- o ? i() : wn = requestAnimationFrame(i);
1657
- }
1658
- var X = typeof document < "u" ? kn : Vn;
1659
- function yt() {
1660
- return yt = Object.assign ? Object.assign.bind() : function(e) {
1661
- for (var t = 1; t < arguments.length; t++) {
1662
- var n = arguments[t];
1663
- for (var r in n)
1664
- Object.prototype.hasOwnProperty.call(n, r) && (e[r] = n[r]);
1665
- }
1666
- return e;
1667
- }, yt.apply(this, arguments);
1668
- }
1669
- let yn = !1, ii = 0;
1670
- const Rn = () => (
1671
- // Ensure the id is unique with multiple independent versions of Floating UI
1672
- // on <React 18
1673
- "floating-ui-" + Math.random().toString(36).slice(2, 6) + ii++
1674
- );
1675
- function si() {
1676
- const [e, t] = m.useState(() => yn ? Rn() : void 0);
1677
- return X(() => {
1678
- e == null && t(Rn());
1679
- }, []), m.useEffect(() => {
1680
- yn = !0;
1681
- }, []), e;
1682
- }
1683
- const ci = ar.useId, Qt = ci || si;
1684
- let Je;
1685
- process.env.NODE_ENV !== "production" && (Je = /* @__PURE__ */ new Set());
1686
- function Lt() {
1687
- for (var e, t = arguments.length, n = new Array(t), r = 0; r < t; r++)
1688
- n[r] = arguments[r];
1689
- const o = "Floating UI: " + n.join(" ");
1690
- if (!((e = Je) != null && e.has(o))) {
1691
- var i;
1692
- (i = Je) == null || i.add(o), console.warn(o);
1693
- }
1694
- }
1695
- function li() {
1696
- for (var e, t = arguments.length, n = new Array(t), r = 0; r < t; r++)
1697
- n[r] = arguments[r];
1698
- const o = "Floating UI: " + n.join(" ");
1699
- if (!((e = Je) != null && e.has(o))) {
1700
- var i;
1701
- (i = Je) == null || i.add(o), console.error(o);
1702
- }
1703
- }
1704
- function ai() {
1705
- const e = /* @__PURE__ */ new Map();
1706
- return {
1707
- emit(t, n) {
1708
- var r;
1709
- (r = e.get(t)) == null || r.forEach((o) => o(n));
1710
- },
1711
- on(t, n) {
1712
- e.set(t, [...e.get(t) || [], n]);
1713
- },
1714
- off(t, n) {
1715
- var r;
1716
- e.set(t, ((r = e.get(t)) == null ? void 0 : r.filter((o) => o !== n)) || []);
1717
- }
1718
- };
1719
- }
1720
- const ui = /* @__PURE__ */ m.createContext(null), fi = /* @__PURE__ */ m.createContext(null), en = () => {
1721
- var e;
1722
- return ((e = m.useContext(ui)) == null ? void 0 : e.id) || null;
1723
- }, Ot = () => m.useContext(fi);
1724
- function He(e) {
1725
- return "data-floating-ui-" + e;
1726
- }
1727
- function Te(e) {
1728
- const t = yr(e);
1729
- return X(() => {
1730
- t.current = e;
1731
- }), t;
1732
- }
1733
- function di(e, t) {
1734
- var n;
1735
- let r = [], o = (n = e.find((i) => i.id === t)) == null ? void 0 : n.parentId;
1736
- for (; o; ) {
1737
- const i = e.find((s) => s.id === o);
1738
- o = i?.parentId, i && (r = r.concat(i));
1739
- }
1740
- return r;
1741
- }
1742
- function _e(e, t) {
1743
- let n = e.filter((o) => {
1744
- var i;
1745
- return o.parentId === t && ((i = o.context) == null ? void 0 : i.open);
1746
- }), r = n;
1747
- for (; r.length; )
1748
- r = e.filter((o) => {
1749
- var i;
1750
- return (i = r) == null ? void 0 : i.some((s) => {
1751
- var l;
1752
- return o.parentId === s.id && ((l = o.context) == null ? void 0 : l.open);
1753
- });
1754
- }), n = n.concat(r);
1755
- return n;
1756
- }
1757
- function mi(e, t) {
1758
- let n, r = -1;
1759
- function o(i, s) {
1760
- s > r && (n = i, r = s), _e(e, i).forEach((a) => {
1761
- o(a.id, s + 1);
1762
- });
1763
- }
1764
- return o(t, 0), e.find((i) => i.id === n);
1765
- }
1766
- let ke = /* @__PURE__ */ new WeakMap(), ut = /* @__PURE__ */ new WeakSet(), ft = {}, kt = 0;
1767
- const gi = () => typeof HTMLElement < "u" && "inert" in HTMLElement.prototype, ur = (e) => e && (e.host || ur(e.parentNode)), pi = (e, t) => t.map((n) => {
1768
- if (e.contains(n))
1769
- return n;
1770
- const r = ur(n);
1771
- return e.contains(r) ? r : null;
1772
- }).filter((n) => n != null);
1773
- function hi(e, t, n, r) {
1774
- const o = "data-floating-ui-inert", i = r ? "inert" : n ? "aria-hidden" : null, s = pi(t, e), l = /* @__PURE__ */ new Set(), a = new Set(s), c = [];
1775
- ft[o] || (ft[o] = /* @__PURE__ */ new WeakMap());
1776
- const d = ft[o];
1777
- s.forEach(u), p(t), l.clear();
1778
- function u(f) {
1779
- !f || l.has(f) || (l.add(f), f.parentNode && u(f.parentNode));
1780
- }
1781
- function p(f) {
1782
- !f || a.has(f) || [].forEach.call(f.children, (g) => {
1783
- if (Ct(g) !== "script")
1784
- if (l.has(g))
1785
- p(g);
1786
- else {
1787
- const h = i ? g.getAttribute(i) : null, x = h !== null && h !== "false", v = (ke.get(g) || 0) + 1, R = (d.get(g) || 0) + 1;
1788
- ke.set(g, v), d.set(g, R), c.push(g), v === 1 && x && ut.add(g), R === 1 && g.setAttribute(o, ""), !x && i && g.setAttribute(i, "true");
1789
- }
1790
- });
1791
- }
1792
- return kt++, () => {
1793
- c.forEach((f) => {
1794
- const g = (ke.get(f) || 0) - 1, h = (d.get(f) || 0) - 1;
1795
- ke.set(f, g), d.set(f, h), g || (!ut.has(f) && i && f.removeAttribute(i), ut.delete(f)), h || f.removeAttribute(o);
1796
- }), kt--, kt || (ke = /* @__PURE__ */ new WeakMap(), ke = /* @__PURE__ */ new WeakMap(), ut = /* @__PURE__ */ new WeakSet(), ft = {});
1797
- };
1798
- }
1799
- function En(e, t, n) {
1800
- t === void 0 && (t = !1), n === void 0 && (n = !1);
1801
- const r = oe(e[0]).body;
1802
- return hi(e.concat(Array.from(r.querySelectorAll("[aria-live]"))), r, t, n);
1803
- }
1804
- const ze = () => ({
1805
- getShadowRoot: !0,
1806
- displayCheck: (
1807
- // JSDOM does not support the `tabbable` library. To solve this we can
1808
- // check if `ResizeObserver` is a real function (not polyfilled), which
1809
- // determines if the current environment is JSDOM-like.
1810
- typeof ResizeObserver == "function" && ResizeObserver.toString().includes("[native code]") ? "full" : "none"
1811
- )
1812
- });
1813
- function fr(e, t) {
1814
- const n = Ze(e, ze());
1815
- t === "prev" && n.reverse();
1816
- const r = n.indexOf(we(oe(e)));
1817
- return n.slice(r + 1)[0];
1818
- }
1819
- function dr() {
1820
- return fr(document.body, "next");
1821
- }
1822
- function mr() {
1823
- return fr(document.body, "prev");
1824
- }
1825
- function Ge(e, t) {
1826
- const n = t || e.currentTarget, r = e.relatedTarget;
1827
- return !r || !ee(n, r);
1828
- }
1829
- function bi(e) {
1830
- Ze(e, ze()).forEach((n) => {
1831
- n.dataset.tabindex = n.getAttribute("tabindex") || "", n.setAttribute("tabindex", "-1");
1832
- });
1833
- }
1834
- function Cn(e) {
1835
- e.querySelectorAll("[data-tabindex]").forEach((n) => {
1836
- const r = n.dataset.tabindex;
1837
- delete n.dataset.tabindex, r ? n.setAttribute("tabindex", r) : n.removeAttribute("tabindex");
1838
- });
1839
- }
1840
- function vi(e, t, n) {
1841
- const r = e.indexOf(t);
1842
- function o(s) {
1843
- const l = He("focus-guard");
1844
- let a = r + (s ? 1 : 0), c = e[a];
1845
- for (; c && (!c.isConnected || c.hasAttribute(l) || ee(n, c)); )
1846
- s ? a++ : a--, c = e[a];
1847
- return c;
1848
- }
1849
- const i = o(!0);
1850
- return i || o(!1);
1851
- }
1852
- const tn = {
1853
- border: 0,
1854
- clip: "rect(0 0 0 0)",
1855
- height: "1px",
1856
- margin: "-1px",
1857
- overflow: "hidden",
1858
- padding: 0,
1859
- position: "fixed",
1860
- whiteSpace: "nowrap",
1861
- width: "1px",
1862
- top: 0,
1863
- left: 0
1864
- };
1865
- let xi;
1866
- function In(e) {
1867
- e.key === "Tab" && (e.target, clearTimeout(xi));
1868
- }
1869
- const Rt = /* @__PURE__ */ m.forwardRef(function(t, n) {
1870
- const [r, o] = m.useState();
1871
- X(() => (qn() && o("button"), document.addEventListener("keydown", In), () => {
1872
- document.removeEventListener("keydown", In);
1873
- }), []);
1874
- const i = {
1875
- ref: n,
1876
- tabIndex: 0,
1877
- // Role is only for VoiceOver
1878
- role: r,
1879
- "aria-hidden": r ? void 0 : !0,
1880
- [He("focus-guard")]: "",
1881
- style: tn
1882
- };
1883
- return /* @__PURE__ */ m.createElement("span", yt({}, t, i));
1884
- }), gr = /* @__PURE__ */ m.createContext(null), Sn = /* @__PURE__ */ He("portal");
1885
- function wi(e) {
1886
- e === void 0 && (e = {});
1887
- const {
1888
- id: t,
1889
- root: n
1890
- } = e, r = Qt(), o = pr(), [i, s] = m.useState(null), l = m.useRef(null);
1891
- return X(() => () => {
1892
- i?.remove(), queueMicrotask(() => {
1893
- l.current = null;
1894
- });
1895
- }, [i]), X(() => {
1896
- if (!r || l.current) return;
1897
- const a = t ? document.getElementById(t) : null;
1898
- if (!a) return;
1899
- const c = document.createElement("div");
1900
- c.id = r, c.setAttribute(Sn, ""), a.appendChild(c), l.current = c, s(c);
1901
- }, [t, r]), X(() => {
1902
- if (!r || l.current) return;
1903
- let a = n || o?.portalNode;
1904
- a && !ce(a) && (a = a.current), a = a || document.body;
1905
- let c = null;
1906
- t && (c = document.createElement("div"), c.id = t, a.appendChild(c));
1907
- const d = document.createElement("div");
1908
- d.id = r, d.setAttribute(Sn, ""), a = c || a, a.appendChild(d), l.current = d, s(d);
1909
- }, [t, n, r, o]), i;
1910
- }
1911
- function Yi(e) {
1912
- const {
1913
- children: t,
1914
- id: n,
1915
- root: r = null,
1916
- preserveTabOrder: o = !0
1917
- } = e, i = wi({
1918
- id: n,
1919
- root: r
1920
- }), [s, l] = m.useState(null), a = m.useRef(null), c = m.useRef(null), d = m.useRef(null), u = m.useRef(null), p = s?.modal, f = s?.open, g = (
1921
- // The FocusManager and therefore floating element are currently open/
1922
- // rendered.
1923
- !!s && // Guards are only for non-modal focus management.
1924
- !s.modal && // Don't render if unmount is transitioning.
1925
- s.open && o && !!(r || i)
1926
- );
1927
- return m.useEffect(() => {
1928
- if (!i || !o || p)
1929
- return;
1930
- function h(x) {
1931
- i && Ge(x) && (x.type === "focusin" ? Cn : bi)(i);
1932
- }
1933
- return i.addEventListener("focusin", h, !0), i.addEventListener("focusout", h, !0), () => {
1934
- i.removeEventListener("focusin", h, !0), i.removeEventListener("focusout", h, !0);
1935
- };
1936
- }, [i, o, p]), m.useEffect(() => {
1937
- i && (f || Cn(i));
1938
- }, [f, i]), /* @__PURE__ */ m.createElement(gr.Provider, {
1939
- value: m.useMemo(() => ({
1940
- preserveTabOrder: o,
1941
- beforeOutsideRef: a,
1942
- afterOutsideRef: c,
1943
- beforeInsideRef: d,
1944
- afterInsideRef: u,
1945
- portalNode: i,
1946
- setFocusManagerState: l
1947
- }), [o, i])
1948
- }, g && i && /* @__PURE__ */ m.createElement(Rt, {
1949
- "data-type": "outside",
1950
- ref: a,
1951
- onFocus: (h) => {
1952
- if (Ge(h, i)) {
1953
- var x;
1954
- (x = d.current) == null || x.focus();
1955
- } else {
1956
- const v = mr() || s?.refs.domReference.current;
1957
- v?.focus();
1958
- }
1959
- }
1960
- }), g && i && /* @__PURE__ */ m.createElement("span", {
1961
- "aria-owns": i.id,
1962
- style: tn
1963
- }), i && /* @__PURE__ */ $n.createPortal(t, i), g && i && /* @__PURE__ */ m.createElement(Rt, {
1964
- "data-type": "outside",
1965
- ref: c,
1966
- onFocus: (h) => {
1967
- if (Ge(h, i)) {
1968
- var x;
1969
- (x = u.current) == null || x.focus();
1970
- } else {
1971
- const v = dr() || s?.refs.domReference.current;
1972
- v?.focus(), s?.closeOnFocusOut && s?.onOpenChange(!1, h.nativeEvent, "focus-out");
1973
- }
1974
- }
1975
- }));
1976
- }
1977
- const pr = () => m.useContext(gr), qt = "data-floating-ui-focusable";
1978
- function hr(e) {
1979
- return e ? e.hasAttribute(qt) ? e : e.querySelector("[" + qt + "]") || e : null;
1980
- }
1981
- const Tn = 20;
1982
- let Fe = [];
1983
- function Vt(e) {
1984
- Fe = Fe.filter((n) => n.isConnected);
1985
- let t = e;
1986
- if (!(!t || Ct(t) === "body")) {
1987
- if (!no(t, ze())) {
1988
- const n = Ze(t, ze())[0];
1989
- n && (t = n);
1990
- }
1991
- Fe.push(t), Fe.length > Tn && (Fe = Fe.slice(-Tn));
1992
- }
1993
- }
1994
- function An() {
1995
- return Fe.slice().reverse().find((e) => e.isConnected);
1996
- }
1997
- const yi = /* @__PURE__ */ m.forwardRef(function(t, n) {
1998
- return /* @__PURE__ */ m.createElement("button", yt({}, t, {
1999
- type: "button",
2000
- ref: n,
2001
- tabIndex: -1,
2002
- style: tn
2003
- }));
2004
- });
2005
- function Gi(e) {
2006
- const {
2007
- context: t,
2008
- children: n,
2009
- disabled: r = !1,
2010
- order: o = ["content"],
2011
- guards: i = !0,
2012
- initialFocus: s = 0,
2013
- returnFocus: l = !0,
2014
- restoreFocus: a = !1,
2015
- modal: c = !0,
2016
- visuallyHiddenDismiss: d = !1,
2017
- closeOnFocusOut: u = !0
2018
- } = e, {
2019
- open: p,
2020
- refs: f,
2021
- nodeId: g,
2022
- onOpenChange: h,
2023
- events: x,
2024
- dataRef: v,
2025
- floatingId: R,
2026
- elements: {
2027
- domReference: b,
2028
- floating: y
2029
- }
2030
- } = t, P = typeof s == "number" && s < 0, N = jn(b) && P, $ = gi() ? i : !0, _ = Te(o), Y = Te(s), K = Te(l), W = Ot(), I = pr(), L = m.useRef(null), S = m.useRef(null), w = m.useRef(!1), O = m.useRef(!1), D = m.useRef(-1), E = I != null, C = hr(y), B = ae(function(V) {
2031
- return V === void 0 && (V = C), V ? Ze(V, ze()) : [];
2032
- }), Z = ae((V) => {
2033
- const M = B(V);
2034
- return _.current.map((T) => b && T === "reference" ? b : C && T === "floating" ? C : M).filter(Boolean).flat();
2035
- });
2036
- m.useEffect(() => {
2037
- w.current = !1;
2038
- }, [r]), m.useEffect(() => {
2039
- if (r || !c) return;
2040
- function V(T) {
2041
- if (T.key === "Tab") {
2042
- ee(C, we(oe(C))) && B().length === 0 && !N && te(T);
2043
- const F = Z(), q = Ne(T);
2044
- _.current[0] === "reference" && q === b && (te(T), T.shiftKey ? Se(F[F.length - 1]) : Se(F[1])), _.current[1] === "floating" && q === C && T.shiftKey && (te(T), Se(F[0]));
2045
- }
2046
- }
2047
- const M = oe(C);
2048
- return M.addEventListener("keydown", V), () => {
2049
- M.removeEventListener("keydown", V);
2050
- };
2051
- }, [r, b, C, c, _, N, B, Z]), m.useEffect(() => {
2052
- if (r || !y) return;
2053
- function V(M) {
2054
- const T = Ne(M), q = B().indexOf(T);
2055
- q !== -1 && (D.current = q);
2056
- }
2057
- return y.addEventListener("focusin", V), () => {
2058
- y.removeEventListener("focusin", V);
2059
- };
2060
- }, [r, y, B]), m.useEffect(() => {
2061
- if (r || !u) return;
2062
- function V() {
2063
- O.current = !0, setTimeout(() => {
2064
- O.current = !1;
2065
- });
2066
- }
2067
- function M(T) {
2068
- const F = T.relatedTarget;
2069
- queueMicrotask(() => {
2070
- const q = !(ee(b, F) || ee(y, F) || ee(F, y) || ee(I?.portalNode, F) || F != null && F.hasAttribute(He("focus-guard")) || W && (_e(W.nodesRef.current, g).find((G) => {
2071
- var Q, U;
2072
- return ee((Q = G.context) == null ? void 0 : Q.elements.floating, F) || ee((U = G.context) == null ? void 0 : U.elements.domReference, F);
2073
- }) || di(W.nodesRef.current, g).find((G) => {
2074
- var Q, U;
2075
- return ((Q = G.context) == null ? void 0 : Q.elements.floating) === F || ((U = G.context) == null ? void 0 : U.elements.domReference) === F;
2076
- })));
2077
- if (a && q && we(oe(C)) === oe(C).body) {
2078
- xe(C) && C.focus();
2079
- const G = D.current, Q = B(), U = Q[G] || Q[Q.length - 1] || C;
2080
- xe(U) && U.focus();
2081
- }
2082
- (N || !c) && F && q && !O.current && // Fix React 18 Strict Mode returnFocus due to double rendering.
2083
- F !== An() && (w.current = !0, h(!1, T, "focus-out"));
2084
- });
2085
- }
2086
- if (y && xe(b))
2087
- return b.addEventListener("focusout", M), b.addEventListener("pointerdown", V), y.addEventListener("focusout", M), () => {
2088
- b.removeEventListener("focusout", M), b.removeEventListener("pointerdown", V), y.removeEventListener("focusout", M);
2089
- };
2090
- }, [r, b, y, C, c, g, W, I, h, u, a, B, N]), m.useEffect(() => {
2091
- var V;
2092
- if (r) return;
2093
- const M = Array.from((I == null || (V = I.portalNode) == null ? void 0 : V.querySelectorAll("[" + He("portal") + "]")) || []);
2094
- if (y) {
2095
- const T = [y, ...M, L.current, S.current, _.current.includes("reference") || N ? b : null].filter((q) => q != null), F = c || N ? En(T, $, !$) : En(T);
2096
- return () => {
2097
- F();
2098
- };
2099
- }
2100
- }, [r, b, y, c, _, I, N, $]), X(() => {
2101
- if (r || !xe(C)) return;
2102
- const V = oe(C), M = we(V);
2103
- queueMicrotask(() => {
2104
- const T = Z(C), F = Y.current, q = (typeof F == "number" ? T[F] : F.current) || C, G = ee(C, M);
2105
- !P && !G && p && Se(q, {
2106
- preventScroll: q === C
2107
- });
2108
- });
2109
- }, [r, p, C, P, Z, Y]), X(() => {
2110
- if (r || !C) return;
2111
- let V = !1;
2112
- const M = oe(C), T = we(M);
2113
- let q = v.current.openEvent;
2114
- const G = f.domReference.current;
2115
- Vt(T);
2116
- function Q(U) {
2117
- let {
2118
- open: Pe,
2119
- reason: Re,
2120
- event: ne,
2121
- nested: Ee
2122
- } = U;
2123
- Pe && (q = ne), Re === "escape-key" && f.domReference.current && Vt(f.domReference.current), Re === "hover" && ne.type === "mouseleave" && (w.current = !0), Re === "outside-press" && (Ee ? (w.current = !1, V = !0) : w.current = !(Hn(ne) || zn(ne)));
2124
- }
2125
- return x.on("openchange", Q), () => {
2126
- x.off("openchange", Q);
2127
- const U = we(M), Pe = ee(y, U) || W && _e(W.nodesRef.current, g).some((me) => {
2128
- var Ue;
2129
- return ee((Ue = me.context) == null ? void 0 : Ue.elements.floating, U);
2130
- });
2131
- (Pe || q && ["click", "mousedown"].includes(q.type)) && f.domReference.current && Vt(f.domReference.current);
2132
- const ne = G || T, Ee = Ze(oe(ne).body, ze());
2133
- queueMicrotask(() => {
2134
- let me = An();
2135
- !me && xe(ne) && y && (me = vi(Ee, ne, y)), // eslint-disable-next-line react-hooks/exhaustive-deps
2136
- K.current && !w.current && xe(me) && // If the focus moved somewhere else after mount, avoid returning focus
2137
- // since it likely entered a different element which should be
2138
- // respected: https://github.com/floating-ui/floating-ui/issues/2607
2139
- (!(me !== U && U !== M.body) || Pe) && me.focus({
2140
- preventScroll: V
2141
- });
2142
- });
2143
- };
2144
- }, [r, y, C, K, v, f, x, W, g]), X(() => {
2145
- if (!r && I)
2146
- return I.setFocusManagerState({
2147
- modal: c,
2148
- closeOnFocusOut: u,
2149
- open: p,
2150
- onOpenChange: h,
2151
- refs: f
2152
- }), () => {
2153
- I.setFocusManagerState(null);
2154
- };
2155
- }, [r, I, c, p, h, f, u]), X(() => {
2156
- if (r || !C || typeof MutationObserver != "function" || P) return;
2157
- const V = () => {
2158
- const T = C.getAttribute("tabindex"), F = B(), q = we(oe(y)), G = F.indexOf(q);
2159
- G !== -1 && (D.current = G), _.current.includes("floating") || q !== f.domReference.current && F.length === 0 ? T !== "0" && C.setAttribute("tabindex", "0") : T !== "-1" && C.setAttribute("tabindex", "-1");
2160
- };
2161
- V();
2162
- const M = new MutationObserver(V);
2163
- return M.observe(C, {
2164
- childList: !0,
2165
- subtree: !0,
2166
- attributes: !0
2167
- }), () => {
2168
- M.disconnect();
2169
- };
2170
- }, [r, y, C, f, _, B, P]);
2171
- function ve(V) {
2172
- return r || !d || !c ? null : /* @__PURE__ */ m.createElement(yi, {
2173
- ref: V === "start" ? L : S,
2174
- onClick: (M) => h(!1, M.nativeEvent)
2175
- }, typeof d == "string" ? d : "Dismiss");
2176
- }
2177
- const de = !r && $ && (c ? !N : !0) && (E || c);
2178
- return /* @__PURE__ */ m.createElement(m.Fragment, null, de && /* @__PURE__ */ m.createElement(Rt, {
2179
- "data-type": "inside",
2180
- ref: I?.beforeInsideRef,
2181
- onFocus: (V) => {
2182
- if (c) {
2183
- const T = Z();
2184
- Se(o[0] === "reference" ? T[0] : T[T.length - 1]);
2185
- } else if (I != null && I.preserveTabOrder && I.portalNode)
2186
- if (w.current = !1, Ge(V, I.portalNode)) {
2187
- const T = dr() || b;
2188
- T?.focus();
2189
- } else {
2190
- var M;
2191
- (M = I.beforeOutsideRef.current) == null || M.focus();
2192
- }
2193
- }
2194
- }), !N && ve("start"), n, ve("end"), de && /* @__PURE__ */ m.createElement(Rt, {
2195
- "data-type": "inside",
2196
- ref: I?.afterInsideRef,
2197
- onFocus: (V) => {
2198
- if (c)
2199
- Se(Z()[0]);
2200
- else if (I != null && I.preserveTabOrder && I.portalNode)
2201
- if (u && (w.current = !0), Ge(V, I.portalNode)) {
2202
- const T = mr() || b;
2203
- T?.focus();
2204
- } else {
2205
- var M;
2206
- (M = I.afterOutsideRef.current) == null || M.focus();
2207
- }
2208
- }
2209
- }));
2210
- }
2211
- const Ri = {
2212
- pointerdown: "onPointerDown",
2213
- mousedown: "onMouseDown",
2214
- click: "onClick"
2215
- }, Ei = {
2216
- pointerdown: "onPointerDownCapture",
2217
- mousedown: "onMouseDownCapture",
2218
- click: "onClickCapture"
2219
- }, On = (e) => {
2220
- var t, n;
2221
- return {
2222
- escapeKey: typeof e == "boolean" ? e : (t = e?.escapeKey) != null ? t : !1,
2223
- outsidePress: typeof e == "boolean" ? e : (n = e?.outsidePress) != null ? n : !0
2224
- };
2225
- };
2226
- function Zi(e, t) {
2227
- t === void 0 && (t = {});
2228
- const {
2229
- open: n,
2230
- onOpenChange: r,
2231
- elements: o,
2232
- dataRef: i
2233
- } = e, {
2234
- enabled: s = !0,
2235
- escapeKey: l = !0,
2236
- outsidePress: a = !0,
2237
- outsidePressEvent: c = "pointerdown",
2238
- referencePress: d = !1,
2239
- referencePressEvent: u = "pointerdown",
2240
- ancestorScroll: p = !1,
2241
- bubbles: f,
2242
- capture: g
2243
- } = t, h = Ot(), x = ae(typeof a == "function" ? a : () => !1), v = typeof a == "function" ? x : a, R = m.useRef(!1), b = m.useRef(!1), {
2244
- escapeKey: y,
2245
- outsidePress: P
2246
- } = On(f), {
2247
- escapeKey: N,
2248
- outsidePress: $
2249
- } = On(g), _ = ae((S) => {
2250
- var w;
2251
- if (!n || !s || !l || S.key !== "Escape")
2252
- return;
2253
- const O = (w = i.current.floatingContext) == null ? void 0 : w.nodeId, D = h ? _e(h.nodesRef.current, O) : [];
2254
- if (!y && (S.stopPropagation(), D.length > 0)) {
2255
- let E = !0;
2256
- if (D.forEach((C) => {
2257
- var B;
2258
- if ((B = C.context) != null && B.open && !C.context.dataRef.current.__escapeKeyBubbles) {
2259
- E = !1;
2260
- return;
2261
- }
2262
- }), !E)
2263
- return;
2264
- }
2265
- r(!1, Nr(S) ? S.nativeEvent : S, "escape-key");
2266
- }), Y = ae((S) => {
2267
- var w;
2268
- const O = () => {
2269
- var D;
2270
- _(S), (D = Ne(S)) == null || D.removeEventListener("keydown", O);
2271
- };
2272
- (w = Ne(S)) == null || w.addEventListener("keydown", O);
2273
- }), K = ae((S) => {
2274
- var w;
2275
- const O = R.current;
2276
- R.current = !1;
2277
- const D = b.current;
2278
- if (b.current = !1, c === "click" && D || O || typeof v == "function" && !v(S))
2279
- return;
2280
- const E = Ne(S), C = "[" + He("inert") + "]", B = oe(o.floating).querySelectorAll(C);
2281
- let Z = ce(E) ? E : null;
2282
- for (; Z && !cn(Z); ) {
2283
- const M = Dr(Z);
2284
- if (cn(M) || !ce(M))
2285
- break;
2286
- Z = M;
2287
- }
2288
- if (B.length && ce(E) && !Lr(E) && // Clicked on a direct ancestor (e.g. FloatingOverlay).
2289
- !ee(E, o.floating) && // If the target root element contains none of the markers, then the
2290
- // element was injected after the floating element rendered.
2291
- Array.from(B).every((M) => !ee(Z, M)))
2292
- return;
2293
- if (xe(E) && L) {
2294
- const M = E.clientWidth > 0 && E.scrollWidth > E.clientWidth, T = E.clientHeight > 0 && E.scrollHeight > E.clientHeight;
2295
- let F = T && S.offsetX > E.clientWidth;
2296
- if (T && Mr(E).direction === "rtl" && (F = S.offsetX <= E.offsetWidth - E.clientWidth), F || M && S.offsetY > E.clientHeight)
2297
- return;
2298
- }
2299
- const ve = (w = i.current.floatingContext) == null ? void 0 : w.nodeId, de = h && _e(h.nodesRef.current, ve).some((M) => {
2300
- var T;
2301
- return Dt(S, (T = M.context) == null ? void 0 : T.elements.floating);
2302
- });
2303
- if (Dt(S, o.floating) || Dt(S, o.domReference) || de)
2304
- return;
2305
- const V = h ? _e(h.nodesRef.current, ve) : [];
2306
- if (V.length > 0) {
2307
- let M = !0;
2308
- if (V.forEach((T) => {
2309
- var F;
2310
- if ((F = T.context) != null && F.open && !T.context.dataRef.current.__outsidePressBubbles) {
2311
- M = !1;
2312
- return;
2313
- }
2314
- }), !M)
2315
- return;
2316
- }
2317
- r(!1, S, "outside-press");
2318
- }), W = ae((S) => {
2319
- var w;
2320
- const O = () => {
2321
- var D;
2322
- K(S), (D = Ne(S)) == null || D.removeEventListener(c, O);
2323
- };
2324
- (w = Ne(S)) == null || w.addEventListener(c, O);
2325
- });
2326
- m.useEffect(() => {
2327
- if (!n || !s)
2328
- return;
2329
- i.current.__escapeKeyBubbles = y, i.current.__outsidePressBubbles = P;
2330
- function S(D) {
2331
- r(!1, D, "ancestor-scroll");
2332
- }
2333
- const w = oe(o.floating);
2334
- l && w.addEventListener("keydown", N ? Y : _, N), v && w.addEventListener(c, $ ? W : K, $);
2335
- let O = [];
2336
- return p && (ce(o.domReference) && (O = Ae(o.domReference)), ce(o.floating) && (O = O.concat(Ae(o.floating))), !ce(o.reference) && o.reference && o.reference.contextElement && (O = O.concat(Ae(o.reference.contextElement)))), O = O.filter((D) => {
2337
- var E;
2338
- return D !== ((E = w.defaultView) == null ? void 0 : E.visualViewport);
2339
- }), O.forEach((D) => {
2340
- D.addEventListener("scroll", S, {
2341
- passive: !0
2342
- });
2343
- }), () => {
2344
- l && w.removeEventListener("keydown", N ? Y : _, N), v && w.removeEventListener(c, $ ? W : K, $), O.forEach((D) => {
2345
- D.removeEventListener("scroll", S);
2346
- });
2347
- };
2348
- }, [i, o, l, v, c, n, r, p, s, y, P, _, N, Y, K, $, W]), m.useEffect(() => {
2349
- R.current = !1;
2350
- }, [v, c]);
2351
- const I = m.useMemo(() => ({
2352
- onKeyDown: _,
2353
- [Ri[u]]: (S) => {
2354
- d && r(!1, S.nativeEvent, "reference-press");
2355
- }
2356
- }), [_, r, d, u]), L = m.useMemo(() => ({
2357
- onKeyDown: _,
2358
- onMouseDown() {
2359
- b.current = !0;
2360
- },
2361
- onMouseUp() {
2362
- b.current = !0;
2363
- },
2364
- [Ei[c]]: () => {
2365
- R.current = !0;
2366
- }
2367
- }), [_, c]);
2368
- return m.useMemo(() => s ? {
2369
- reference: I,
2370
- floating: L
2371
- } : {}, [s, I, L]);
2372
- }
2373
- function Ci(e) {
2374
- const {
2375
- open: t = !1,
2376
- onOpenChange: n,
2377
- elements: r
2378
- } = e, o = Qt(), i = m.useRef({}), [s] = m.useState(() => ai()), l = en() != null;
2379
- if (process.env.NODE_ENV !== "production") {
2380
- const f = r.reference;
2381
- f && !ce(f) && li("Cannot pass a virtual element to the `elements.reference` option,", "as it must be a real DOM element. Use `refs.setPositionReference()`", "instead.");
2382
- }
2383
- const [a, c] = m.useState(r.reference), d = ae((f, g, h) => {
2384
- i.current.openEvent = f ? g : void 0, s.emit("openchange", {
2385
- open: f,
2386
- event: g,
2387
- reason: h,
2388
- nested: l
2389
- }), n?.(f, g, h);
2390
- }), u = m.useMemo(() => ({
2391
- setPositionReference: c
2392
- }), []), p = m.useMemo(() => ({
2393
- reference: a || r.reference || null,
2394
- floating: r.floating || null,
2395
- domReference: r.reference
2396
- }), [a, r.reference, r.floating]);
2397
- return m.useMemo(() => ({
2398
- dataRef: i,
2399
- open: t,
2400
- onOpenChange: d,
2401
- elements: p,
2402
- events: s,
2403
- floatingId: o,
2404
- refs: u
2405
- }), [t, d, p, s, o, u]);
2406
- }
2407
- function Ji(e) {
2408
- e === void 0 && (e = {});
2409
- const {
2410
- nodeId: t
2411
- } = e, n = Ci({
2412
- ...e,
2413
- elements: {
2414
- reference: null,
2415
- floating: null,
2416
- ...e.elements
2417
- }
2418
- }), r = e.rootContext || n, o = r.elements, [i, s] = m.useState(null), [l, a] = m.useState(null), d = o?.reference || i, u = m.useRef(null), p = Ot();
2419
- X(() => {
2420
- d && (u.current = d);
2421
- }, [d]);
2422
- const f = Zo({
2423
- ...e,
2424
- elements: {
2425
- ...o,
2426
- ...l && {
2427
- reference: l
2428
- }
2429
- }
2430
- }), g = m.useCallback((b) => {
2431
- const y = ce(b) ? {
2432
- getBoundingClientRect: () => b.getBoundingClientRect(),
2433
- contextElement: b
2434
- } : b;
2435
- a(y), f.refs.setReference(y);
2436
- }, [f.refs]), h = m.useCallback((b) => {
2437
- (ce(b) || b === null) && (u.current = b, s(b)), (ce(f.refs.reference.current) || f.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to
2438
- // `null` to support `positionReference` + an unstable `reference`
2439
- // callback ref.
2440
- b !== null && !ce(b)) && f.refs.setReference(b);
2441
- }, [f.refs]), x = m.useMemo(() => ({
2442
- ...f.refs,
2443
- setReference: h,
2444
- setPositionReference: g,
2445
- domReference: u
2446
- }), [f.refs, h, g]), v = m.useMemo(() => ({
2447
- ...f.elements,
2448
- domReference: d
2449
- }), [f.elements, d]), R = m.useMemo(() => ({
2450
- ...f,
2451
- ...r,
2452
- refs: x,
2453
- elements: v,
2454
- nodeId: t
2455
- }), [f, x, v, t, r]);
2456
- return X(() => {
2457
- r.dataRef.current.floatingContext = R;
2458
- const b = p?.nodesRef.current.find((y) => y.id === t);
2459
- b && (b.context = R);
2460
- }), m.useMemo(() => ({
2461
- ...f,
2462
- context: R,
2463
- refs: x,
2464
- elements: v
2465
- }), [f, x, v, R]);
2466
- }
2467
- const Mn = "active", Dn = "selected";
2468
- function _t(e, t, n) {
2469
- const r = /* @__PURE__ */ new Map(), o = n === "item";
2470
- let i = e;
2471
- if (o && e) {
2472
- const {
2473
- [Mn]: s,
2474
- [Dn]: l,
2475
- ...a
2476
- } = e;
2477
- i = a;
2478
- }
2479
- return {
2480
- ...n === "floating" && {
2481
- tabIndex: -1,
2482
- [qt]: ""
2483
- },
2484
- ...i,
2485
- ...t.map((s) => {
2486
- const l = s ? s[n] : null;
2487
- return typeof l == "function" ? e ? l(e) : null : l;
2488
- }).concat(e).reduce((s, l) => (l && Object.entries(l).forEach((a) => {
2489
- let [c, d] = a;
2490
- if (!(o && [Mn, Dn].includes(c)))
2491
- if (c.indexOf("on") === 0) {
2492
- if (r.has(c) || r.set(c, []), typeof d == "function") {
2493
- var u;
2494
- (u = r.get(c)) == null || u.push(d), s[c] = function() {
2495
- for (var p, f = arguments.length, g = new Array(f), h = 0; h < f; h++)
2496
- g[h] = arguments[h];
2497
- return (p = r.get(c)) == null ? void 0 : p.map((x) => x(...g)).find((x) => x !== void 0);
2498
- };
2499
- }
2500
- } else
2501
- s[c] = d;
2502
- }), s), {})
2503
- };
2504
- }
2505
- function Qi(e) {
2506
- e === void 0 && (e = []);
2507
- const t = e.map((l) => l?.reference), n = e.map((l) => l?.floating), r = e.map((l) => l?.item), o = m.useCallback(
2508
- (l) => _t(l, e, "reference"),
2509
- // eslint-disable-next-line react-hooks/exhaustive-deps
2510
- t
2511
- ), i = m.useCallback(
2512
- (l) => _t(l, e, "floating"),
2513
- // eslint-disable-next-line react-hooks/exhaustive-deps
2514
- n
2515
- ), s = m.useCallback(
2516
- (l) => _t(l, e, "item"),
2517
- // eslint-disable-next-line react-hooks/exhaustive-deps
2518
- r
2519
- );
2520
- return m.useMemo(() => ({
2521
- getReferenceProps: o,
2522
- getFloatingProps: i,
2523
- getItemProps: s
2524
- }), [o, i, s]);
2525
- }
2526
- let Pn = !1;
2527
- function Mt(e, t, n) {
2528
- switch (e) {
2529
- case "vertical":
2530
- return t;
2531
- case "horizontal":
2532
- return n;
2533
- default:
2534
- return t || n;
2535
- }
2536
- }
2537
- function Fn(e, t) {
2538
- return Mt(t, e === Jt || e === ot, e === Ke || e === je);
2539
- }
2540
- function $t(e, t, n) {
2541
- return Mt(t, e === ot, n ? e === Ke : e === je) || e === "Enter" || e === " " || e === "";
2542
- }
2543
- function Ii(e, t, n) {
2544
- return Mt(t, n ? e === Ke : e === je, e === ot);
2545
- }
2546
- function Nn(e, t, n) {
2547
- return Mt(t, n ? e === je : e === Ke, e === Jt);
2548
- }
2549
- function es(e, t) {
2550
- const {
2551
- open: n,
2552
- onOpenChange: r,
2553
- elements: o
2554
- } = e, {
2555
- listRef: i,
2556
- activeIndex: s,
2557
- onNavigate: l = () => {
2558
- },
2559
- enabled: a = !0,
2560
- selectedIndex: c = null,
2561
- allowEscape: d = !1,
2562
- loop: u = !1,
2563
- nested: p = !1,
2564
- rtl: f = !1,
2565
- virtual: g = !1,
2566
- focusItemOnOpen: h = "auto",
2567
- focusItemOnHover: x = !0,
2568
- openOnArrowKeyDown: v = !0,
2569
- disabledIndices: R = void 0,
2570
- orientation: b = "vertical",
2571
- cols: y = 1,
2572
- scrollItemIntoView: P = !0,
2573
- virtualItemRef: N,
2574
- itemSizes: $,
2575
- dense: _ = !1
2576
- } = t;
2577
- process.env.NODE_ENV !== "production" && (d && (u || Lt("`useListNavigation` looping must be enabled to allow escaping."), g || Lt("`useListNavigation` must be virtual to allow escaping.")), b === "vertical" && y > 1 && Lt("In grid list navigation mode (`cols` > 1), the `orientation` should", 'be either "horizontal" or "both".'));
2578
- const Y = hr(o.floating), K = Te(Y), W = en(), I = Ot(), L = ae(l), S = m.useRef(h), w = m.useRef(c ?? -1), O = m.useRef(null), D = m.useRef(!0), E = m.useRef(L), C = m.useRef(!!o.floating), B = m.useRef(n), Z = m.useRef(!1), ve = m.useRef(!1), de = Te(R), V = Te(n), M = Te(P), T = Te(c), [F, q] = m.useState(), [G, Q] = m.useState(), U = ae(function(k, j, A) {
2579
- A === void 0 && (A = !1);
2580
- function H(z) {
2581
- g ? (q(z.id), I?.events.emit("virtualfocus", z), N && (N.current = z)) : Se(z, {
2582
- preventScroll: !0,
2583
- // Mac Safari does not move the virtual cursor unless the focus call
2584
- // is sync. However, for the very first focus call, we need to wait
2585
- // for the position to be ready in order to prevent unwanted
2586
- // scrolling. This means the virtual cursor will not move to the first
2587
- // item when first opening the floating element, but will on
2588
- // subsequent calls. `preventScroll` is supported in modern Safari,
2589
- // so we can use that instead.
2590
- // iOS Safari must be async or the first item will not be focused.
2591
- sync: Pr() && qn() ? Pn || Z.current : !1
2592
- });
2593
- }
2594
- const re = k.current[j.current];
2595
- re && H(re), requestAnimationFrame(() => {
2596
- const z = k.current[j.current] || re;
2597
- if (!z) return;
2598
- re || H(z);
2599
- const ge = M.current;
2600
- ge && Re && (A || !D.current) && (z.scrollIntoView == null || z.scrollIntoView(typeof ge == "boolean" ? {
2601
- block: "nearest",
2602
- inline: "nearest"
2603
- } : ge));
2604
- });
2605
- });
2606
- X(() => {
2607
- document.createElement("div").focus({
2608
- get preventScroll() {
2609
- return Pn = !0, !1;
2610
- }
2611
- });
2612
- }, []), X(() => {
2613
- a && (n && o.floating ? S.current && c != null && (ve.current = !0, w.current = c, L(c)) : C.current && (w.current = -1, E.current(null)));
2614
- }, [a, n, o.floating, c, L]), X(() => {
2615
- if (a && n && o.floating)
2616
- if (s == null) {
2617
- if (Z.current = !1, T.current != null)
2618
- return;
2619
- if (C.current && (w.current = -1, U(i, w)), (!B.current || !C.current) && S.current && (O.current != null || S.current === !0 && O.current == null)) {
2620
- let k = 0;
2621
- const j = () => {
2622
- i.current[0] == null ? (k < 2 && (k ? requestAnimationFrame : queueMicrotask)(j), k++) : (w.current = O.current == null || $t(O.current, b, f) || p ? Nt(i, de.current) : xn(i, de.current), O.current = null, L(w.current));
2623
- };
2624
- j();
2625
- }
2626
- } else Ye(i, s) || (w.current = s, U(i, w, ve.current), ve.current = !1);
2627
- }, [a, n, o.floating, s, T, p, i, b, f, L, U, de]), X(() => {
2628
- var k;
2629
- if (!a || o.floating || !I || g || !C.current)
2630
- return;
2631
- const j = I.nodesRef.current, A = (k = j.find((z) => z.id === W)) == null || (k = k.context) == null ? void 0 : k.elements.floating, H = we(oe(o.floating)), re = j.some((z) => z.context && ee(z.context.elements.floating, H));
2632
- A && !re && D.current && A.focus({
2633
- preventScroll: !0
2634
- });
2635
- }, [a, o.floating, I, W, g]), X(() => {
2636
- if (!a || !I || !g || W) return;
2637
- function k(j) {
2638
- Q(j.id), N && (N.current = j);
2639
- }
2640
- return I.events.on("virtualfocus", k), () => {
2641
- I.events.off("virtualfocus", k);
2642
- };
2643
- }, [a, I, g, W, N]), X(() => {
2644
- E.current = L, C.current = !!o.floating;
2645
- }), X(() => {
2646
- n || (O.current = null);
2647
- }, [n]), X(() => {
2648
- B.current = n;
2649
- }, [n]);
2650
- const Pe = s != null, Re = m.useMemo(() => {
2651
- function k(A) {
2652
- if (!n) return;
2653
- const H = i.current.indexOf(A);
2654
- H !== -1 && L(H);
2655
- }
2656
- return {
2657
- onFocus(A) {
2658
- let {
2659
- currentTarget: H
2660
- } = A;
2661
- k(H);
2662
- },
2663
- onClick: (A) => {
2664
- let {
2665
- currentTarget: H
2666
- } = A;
2667
- return H.focus({
2668
- preventScroll: !0
2669
- });
2670
- },
2671
- // Safari
2672
- ...x && {
2673
- onMouseMove(A) {
2674
- let {
2675
- currentTarget: H
2676
- } = A;
2677
- k(H);
2678
- },
2679
- onPointerLeave(A) {
2680
- let {
2681
- pointerType: H
2682
- } = A;
2683
- !D.current || H === "touch" || (w.current = -1, U(i, w), L(null), g || Se(K.current, {
2684
- preventScroll: !0
2685
- }));
2686
- }
2687
- }
2688
- };
2689
- }, [n, K, U, x, i, L, g]), ne = ae((k) => {
2690
- if (D.current = !1, Z.current = !0, !V.current && k.currentTarget === K.current)
2691
- return;
2692
- if (p && Nn(k.key, b, f)) {
2693
- te(k), r(!1, k.nativeEvent, "list-navigation"), xe(o.domReference) && !g && o.domReference.focus();
2694
- return;
2695
- }
2696
- const j = w.current, A = Nt(i, R), H = xn(i, R);
2697
- if (k.key === "Home" && (te(k), w.current = A, L(w.current)), k.key === "End" && (te(k), w.current = H, L(w.current)), y > 1) {
2698
- const re = $ || Array.from({
2699
- length: i.current.length
2700
- }, () => ({
2701
- width: 1,
2702
- height: 1
2703
- })), z = ni(re, y, _), ge = z.findIndex((le) => le != null && !mt(i.current, le, R)), it = z.reduce((le, Ce, st) => Ce != null && !mt(i.current, Ce, R) ? st : le, -1), Xe = z[ti({
2704
- current: z.map((le) => le != null ? i.current[le] : null)
2705
- }, {
2706
- event: k,
2707
- orientation: b,
2708
- loop: u,
2709
- cols: y,
2710
- // treat undefined (empty grid spaces) as disabled indices so we
2711
- // don't end up in them
2712
- disabledIndices: oi([...R || i.current.map((le, Ce) => mt(i.current, Ce) ? Ce : void 0), void 0], z),
2713
- minIndex: ge,
2714
- maxIndex: it,
2715
- prevIndex: ri(
2716
- w.current > H ? A : w.current,
2717
- re,
2718
- z,
2719
- y,
2720
- // use a corner matching the edge closest to the direction
2721
- // we're moving in so we don't end up in the same item. Prefer
2722
- // top/left over bottom/right.
2723
- k.key === ot ? "bl" : k.key === je ? "tr" : "tl"
2724
- ),
2725
- stopEvent: !0
2726
- })];
2727
- if (Xe != null && (w.current = Xe, L(w.current)), b === "both")
2728
- return;
2729
- }
2730
- if (Fn(k.key, b)) {
2731
- if (te(k), n && !g && we(k.currentTarget.ownerDocument) === k.currentTarget) {
2732
- w.current = $t(k.key, b, f) ? A : H, L(w.current);
2733
- return;
2734
- }
2735
- $t(k.key, b, f) ? u ? w.current = j >= H ? d && j !== i.current.length ? -1 : A : J(i, {
2736
- startingIndex: j,
2737
- disabledIndices: R
2738
- }) : w.current = Math.min(H, J(i, {
2739
- startingIndex: j,
2740
- disabledIndices: R
2741
- })) : u ? w.current = j <= A ? d && j !== -1 ? i.current.length : H : J(i, {
2742
- startingIndex: j,
2743
- decrement: !0,
2744
- disabledIndices: R
2745
- }) : w.current = Math.max(A, J(i, {
2746
- startingIndex: j,
2747
- decrement: !0,
2748
- disabledIndices: R
2749
- })), Ye(i, w.current) ? L(null) : L(w.current);
2750
- }
2751
- }), Ee = m.useMemo(() => g && n && Pe && {
2752
- "aria-activedescendant": G || F
2753
- }, [g, n, Pe, G, F]), me = m.useMemo(() => ({
2754
- "aria-orientation": b === "both" ? void 0 : b,
2755
- ...!jn(o.domReference) && Ee,
2756
- onKeyDown: ne,
2757
- onPointerMove() {
2758
- D.current = !0;
2759
- }
2760
- }), [Ee, ne, o.domReference, b]), Ue = m.useMemo(() => {
2761
- function k(A) {
2762
- h === "auto" && Hn(A.nativeEvent) && (S.current = !0);
2763
- }
2764
- function j(A) {
2765
- S.current = h, h === "auto" && zn(A.nativeEvent) && (S.current = !0);
2766
- }
2767
- return {
2768
- ...Ee,
2769
- onKeyDown(A) {
2770
- D.current = !1;
2771
- const H = A.key.indexOf("Arrow") === 0, re = Ii(A.key, b, f), z = Nn(A.key, b, f), ge = Fn(A.key, b), it = (p ? re : ge) || A.key === "Enter" || A.key.trim() === "";
2772
- if (g && n) {
2773
- const st = I?.nodesRef.current.find((ct) => ct.parentId == null), Ie = I && st ? mi(I.nodesRef.current, st.id) : null;
2774
- if (H && Ie && N) {
2775
- const ct = new KeyboardEvent("keydown", {
2776
- key: A.key,
2777
- bubbles: !0
2778
- });
2779
- if (re || z) {
2780
- var Xe, le;
2781
- const wr = ((Xe = Ie.context) == null ? void 0 : Xe.elements.domReference) === A.currentTarget, rn = z && !wr ? (le = Ie.context) == null ? void 0 : le.elements.domReference : re ? i.current.find((on) => on?.id === F) : null;
2782
- rn && (te(A), rn.dispatchEvent(ct), Q(void 0));
2783
- }
2784
- if (ge && Ie.context && Ie.context.open && Ie.parentId && A.currentTarget !== Ie.context.elements.domReference) {
2785
- var Ce;
2786
- te(A), (Ce = Ie.context.elements.domReference) == null || Ce.dispatchEvent(ct);
2787
- return;
2788
- }
2789
- }
2790
- return ne(A);
2791
- }
2792
- if (!(!n && !v && H)) {
2793
- if (it && (O.current = p && ge ? null : A.key), p) {
2794
- re && (te(A), n ? (w.current = Nt(i, de.current), L(w.current)) : r(!0, A.nativeEvent, "list-navigation"));
2795
- return;
2796
- }
2797
- ge && (c != null && (w.current = c), te(A), !n && v ? r(!0, A.nativeEvent, "list-navigation") : ne(A), n && L(w.current));
2798
- }
2799
- },
2800
- onFocus() {
2801
- n && !g && L(null);
2802
- },
2803
- onPointerDown: j,
2804
- onMouseDown: k,
2805
- onClick: k
2806
- };
2807
- }, [F, Ee, ne, de, h, i, p, L, r, n, v, b, f, c, I, g, N]);
2808
- return m.useMemo(() => a ? {
2809
- reference: Ue,
2810
- floating: me,
2811
- item: Re
2812
- } : {}, [a, Ue, me, Re]);
2813
- }
2814
- const Si = /* @__PURE__ */ new Map([["select", "listbox"], ["combobox", "listbox"], ["label", !1]]);
2815
- function ts(e, t) {
2816
- var n;
2817
- t === void 0 && (t = {});
2818
- const {
2819
- open: r,
2820
- floatingId: o
2821
- } = e, {
2822
- enabled: i = !0,
2823
- role: s = "dialog"
2824
- } = t, l = (n = Si.get(s)) != null ? n : s, a = Qt(), d = en() != null, u = m.useMemo(() => l === "tooltip" || s === "label" ? {
2825
- ["aria-" + (s === "label" ? "labelledby" : "describedby")]: r ? o : void 0
2826
- } : {
2827
- "aria-expanded": r ? "true" : "false",
2828
- "aria-haspopup": l === "alertdialog" ? "dialog" : l,
2829
- "aria-controls": r ? o : void 0,
2830
- ...l === "listbox" && {
2831
- role: "combobox"
2832
- },
2833
- ...l === "menu" && {
2834
- id: a
2835
- },
2836
- ...l === "menu" && d && {
2837
- role: "menuitem"
2838
- },
2839
- ...s === "select" && {
2840
- "aria-autocomplete": "none"
2841
- },
2842
- ...s === "combobox" && {
2843
- "aria-autocomplete": "list"
2844
- }
2845
- }, [l, o, d, r, a, s]), p = m.useMemo(() => {
2846
- const g = {
2847
- id: o,
2848
- ...l && {
2849
- role: l
2850
- }
2851
- };
2852
- return l === "tooltip" || s === "label" ? g : {
2853
- ...g,
2854
- ...l === "menu" && {
2855
- "aria-labelledby": a
2856
- }
2857
- };
2858
- }, [l, o, a, s]), f = m.useCallback((g) => {
2859
- let {
2860
- active: h,
2861
- selected: x
2862
- } = g;
2863
- const v = {
2864
- role: "option",
2865
- ...h && {
2866
- id: o + "-option"
2867
- }
2868
- };
2869
- switch (s) {
2870
- case "select":
2871
- return {
2872
- ...v,
2873
- "aria-selected": h && x
2874
- };
2875
- case "combobox":
2876
- return {
2877
- ...v,
2878
- ...h && {
2879
- "aria-selected": !0
2880
- }
2881
- };
2882
- }
2883
- return {};
2884
- }, [o, s]);
2885
- return m.useMemo(() => i ? {
2886
- reference: u,
2887
- floating: p,
2888
- item: f
2889
- } : {}, [i, u, p, f]);
2890
- }
2891
- const Ti = jt(void 0), br = jt({
2892
- activeIndex: 0
2893
- }), Ai = (e, t) => t.type === "SET_ACTIVE_INDEX" ? {
2894
- ...e,
2895
- activeIndex: t.payload
2896
- } : e, vr = jt(() => {
2897
- throw new Error("ComboboxIdDispatch must be used within a provider");
2898
- }), ns = ({ children: e }) => {
2899
- const [t, n] = Rr(Ai, {
2900
- activeIndex: 0
2901
- });
2902
- return Oe(br.Provider, { value: t, children: Oe(vr.Provider, { value: n, children: e }) });
2903
- };
2904
- function rs() {
2905
- return Ut(vr);
2906
- }
2907
- function Oi() {
2908
- return Ut(br);
2909
- }
2910
- const Mi = Qe(({ asChild: e, interactive: t, id: n, className: r, ...o }, i) => {
2911
- if (t && !n)
2912
- throw new Error("If ComboboxCustom is interactive, it must have an id");
2913
- const s = e ? Sr : "div", l = Er(), { activeIndex: a } = Oi(), c = Ut(Ti);
2914
- if (!c)
2915
- throw new Error("ComboboxCustom must be used within a Combobox");
2916
- const { customIds: d, setListRef: u, getItemProps: p, size: f } = c, g = Cr(() => n && d.indexOf(n) || 0, [n, d]), h = Jo([
2917
- (x) => {
2918
- u(g, x);
2919
- },
2920
- i
2921
- ]);
2922
- return Oe(Tr, { "data-size": f, asChild: !0, children: Oe(s, { ref: h, tabIndex: -1, className: Ln("ds-combobox__custom", r), id: n || l, role: "option", "aria-selected": a === g, "data-active": a === g, ...sn(["interactive"], o), ...sn(["onClick", "onPointerLeave"], p()) }) });
2923
- });
2924
- function Di(e) {
2925
- return Ir(e) && e.type === Mi;
2926
- }
2927
- function os(e) {
2928
- return Di(e) && e.props.interactive === !0;
2929
- }
2930
- const xr = "internal-option-", is = (e) => xr + e, ss = (e) => e.slice(xr.length), Pi = (e, t) => {
2931
- const n = e.value;
2932
- e.value = t;
2933
- const r = e._valueTracker;
2934
- typeof r < "u" && r.setValue(n), e.dispatchEvent(new Event("change", { bubbles: !0 }));
2935
- }, Fi = Qe(function({ className: t, ...n }, r) {
2936
- return Oe("div", { ref: r, className: Ln("ds-search", t), ...n });
2937
- }), Ni = Qe(function({ children: t = "Søk", ...n }, r) {
2938
- return Oe(_n, { ref: r, type: "submit", ...n, children: t });
2939
- }), Li = Qe(function({ "aria-label": t = "Tøm", onClick: n, ...r }, o) {
2940
- return Oe(_n, { ref: o, variant: "tertiary", type: "reset", "aria-label": t, onClick: (s) => {
2941
- const l = s.target;
2942
- let a = null;
2943
- if (l instanceof HTMLElement && (a = l.closest(".ds-search")?.querySelector("input")), !a)
2944
- throw new Error("Input is missing");
2945
- if (!(a instanceof HTMLInputElement))
2946
- throw new Error("Input is not an input element");
2947
- s.preventDefault(), Pi(a, ""), a.focus(), n?.(s);
2948
- }, icon: !0, ...r });
2949
- }), ki = Qe(function({ ...t }, n) {
2950
- return Oe(Ar, {
2951
- ref: n,
2952
- type: "search",
2953
- /* We need an empty placeholder for the clear button to be able to show/hide */
2954
- placeholder: "",
2955
- ...t
2956
- });
2957
- }), nn = Object.assign(Fi, {
2958
- Clear: Li,
2959
- Button: Ni,
2960
- Input: ki
2961
- });
2962
- nn.Clear.displayName = "Search.Clear";
2963
- nn.Button.displayName = "Search.Button";
2964
- nn.Input.displayName = "Search.Input";
2965
- export {
2966
- Ti as C,
2967
- Yi as F,
2968
- nn as S,
2969
- Jo as a,
2970
- Oi as b,
2971
- Ji as c,
2972
- ts as d,
2973
- Zi as e,
2974
- es as f,
2975
- Qi as g,
2976
- Ui as h,
2977
- os as i,
2978
- ji as j,
2979
- zi as k,
2980
- ns as l,
2981
- Pi as m,
2982
- Gi as n,
2983
- sn as o,
2984
- is as p,
2985
- Mi as q,
2986
- ss as r,
2987
- Xi as s,
2988
- Go as t,
2989
- rs as u,
2990
- Uo as v,
2991
- Xo as w,
2992
- qi as x
2993
- };