@iress-oss/ids-components 5.20.8 → 5.20.9

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 (438) hide show
  1. package/dist/AutocompleteNoResults-B9WjoXJo.js +10 -0
  2. package/dist/Badge-BqaFutTZ.js +40 -0
  3. package/dist/CheckboxGroup-WLxp9nIX.js +79 -0
  4. package/dist/CheckboxMark.types-CW7xyywE.js +17 -0
  5. package/dist/ClearButton-s0_b3pvJ.js +25 -0
  6. package/dist/ComboboxHiddenInput-DH3V3Dyg.js +27 -0
  7. package/dist/Expander-B3_k6HJq.js +55 -0
  8. package/dist/InputBase-BnBuTYZm.js +48 -0
  9. package/dist/LabelBase-CV1O4V_d.js +51 -0
  10. package/dist/Loading.module-DdUL1FMv.js +16 -0
  11. package/dist/LogoFromSrc-7oPJTvAO.js +50 -0
  12. package/dist/LongLoading-Dw8sUYlh.js +117 -0
  13. package/dist/MenuItem.module-guf-3YyL.js +24 -0
  14. package/dist/Placeholder-C1YrHg4w.js +35 -0
  15. package/dist/Popover.module-6flgSLob.js +10 -0
  16. package/dist/PopoverProvider-DgUOscvy.js +109 -0
  17. package/dist/Progress-BypnLSGF.js +35 -0
  18. package/dist/RadioGroup-DtA0WE3l.js +78 -0
  19. package/dist/SelectControl-D8Y9Up2f.js +28 -0
  20. package/dist/Skeleton-D_iuo6Xw.js +34 -0
  21. package/dist/SkipLink-rElTLeMe.js +15 -0
  22. package/dist/SlideoutProvider-DnaE67W-.js +125 -0
  23. package/dist/SliderTicks-BqTI-XhQ.js +47 -0
  24. package/dist/StartUpLoading-DFAMmjg3.js +68 -0
  25. package/dist/Tab-C08D4jxr.js +68 -0
  26. package/dist/TabSet.module-q8a7ksiF.js +13 -0
  27. package/dist/Table.module-DnaTe51E.js +32 -0
  28. package/dist/Toggle-CF22OY-P.js +66 -0
  29. package/dist/Tooltip-BxM_1Wtq.js +60 -0
  30. package/dist/ValidationBase-A2Ed7iem.js +29 -0
  31. package/dist/ValidationSummary-D6Wa4vOf.js +38 -0
  32. package/dist/chunk-efA98nb6.js +13 -0
  33. package/dist/classnames-BTnCYmAN.js +31 -0
  34. package/dist/components/Alert/Alert.js +2 -11
  35. package/dist/components/Alert/Alert.types.js +8 -8
  36. package/dist/components/Alert/index.js +3 -6
  37. package/dist/components/Autocomplete/Autocomplete.js +2 -45
  38. package/dist/components/Autocomplete/Autocomplete.types.js +0 -1
  39. package/dist/components/Autocomplete/components/AutocompleteInstructions.js +10 -10
  40. package/dist/components/Autocomplete/components/AutocompleteNoResults.js +2 -5
  41. package/dist/components/Autocomplete/hooks/useAutocompleteSearch.js +2 -191
  42. package/dist/components/Autocomplete/index.js +3 -6
  43. package/dist/components/Badge/Badge.js +2 -49
  44. package/dist/components/Badge/Badge.types.js +14 -14
  45. package/dist/components/Badge/index.js +3 -7
  46. package/dist/components/Button/Button.js +2 -10
  47. package/dist/components/Button/Button.types.js +22 -20
  48. package/dist/components/Button/CloseButton/CloseButton.js +2 -7
  49. package/dist/components/Button/CloseButton/CloseButton.types.js +0 -1
  50. package/dist/components/Button/index.js +3 -11
  51. package/dist/components/ButtonGroup/ButtonGroup.js +2 -72
  52. package/dist/components/ButtonGroup/ButtonGroup.types.js +0 -1
  53. package/dist/components/ButtonGroup/ButtonGroupProvider.js +26 -33
  54. package/dist/components/ButtonGroup/hooks/useButtonGroup.js +6 -6
  55. package/dist/components/ButtonGroup/hooks/useIDSButtonGroupItem.js +2 -6
  56. package/dist/components/ButtonGroup/index.js +3 -6
  57. package/dist/components/Card/Card.js +34 -48
  58. package/dist/components/Card/Card.types.js +8 -5
  59. package/dist/components/Card/components/ButtonCard.js +29 -37
  60. package/dist/components/Card/components/LinkCard.js +28 -36
  61. package/dist/components/Card/helpers/composeIDSCard.js +18 -26
  62. package/dist/components/Card/helpers/composeIDSCardSlots.js +47 -32
  63. package/dist/components/Card/index.js +7 -15
  64. package/dist/components/Checkbox/Checkbox.js +2 -15
  65. package/dist/components/Checkbox/Checkbox.types.js +0 -1
  66. package/dist/components/Checkbox/helpers/mapCheckboxGroupOptions.js +12 -19
  67. package/dist/components/Checkbox/index.js +2 -4
  68. package/dist/components/CheckboxGroup/CheckboxGroup.js +2 -99
  69. package/dist/components/CheckboxGroup/CheckboxGroup.types.js +10 -10
  70. package/dist/components/CheckboxGroup/CheckboxGroupContext.js +5 -5
  71. package/dist/components/CheckboxGroup/index.js +3 -7
  72. package/dist/components/CheckboxMark/CheckboxMark.js +29 -40
  73. package/dist/components/CheckboxMark/CheckboxMark.types.js +2 -16
  74. package/dist/components/CheckboxMark/index.js +3 -6
  75. package/dist/components/Col/Col.js +14 -33
  76. package/dist/components/Col/Col.types.js +67 -65
  77. package/dist/components/Col/index.js +3 -12
  78. package/dist/components/Combobox/Combobox.js +2 -48
  79. package/dist/components/Combobox/Combobox.types.js +0 -1
  80. package/dist/components/Combobox/MultiCombobox/MultiCombobox.js +2 -46
  81. package/dist/components/Combobox/MultiCombobox/MultiCombobox.types.js +0 -1
  82. package/dist/components/Combobox/components/ComboboxHiddenInput.js +2 -8
  83. package/dist/components/Combobox/components/ComboboxResults.js +2 -41
  84. package/dist/components/Combobox/components/ComboboxResultsDescriptor.js +2 -40
  85. package/dist/components/Combobox/hooks/useComboboxFlags.js +11 -14
  86. package/dist/components/Combobox/hooks/useComboboxInlineCompletion.js +39 -59
  87. package/dist/components/Combobox/index.js +2 -5
  88. package/dist/components/Container/Container.js +12 -21
  89. package/dist/components/Container/Container.types.js +6 -4
  90. package/dist/components/Container/index.js +3 -6
  91. package/dist/components/Divider/Divider.js +14 -21
  92. package/dist/components/Divider/Divider.types.js +6 -4
  93. package/dist/components/Divider/index.js +2 -5
  94. package/dist/components/Expander/Expander.js +2 -80
  95. package/dist/components/Expander/Expander.types.js +10 -6
  96. package/dist/components/Expander/index.js +3 -7
  97. package/dist/components/Field/Field.js +2 -71
  98. package/dist/components/Field/Field.types.js +0 -1
  99. package/dist/components/Field/FieldGroup/FieldGroup.js +2 -77
  100. package/dist/components/Field/FieldGroup/FieldGroup.types.js +0 -1
  101. package/dist/components/Field/components/FieldAppendToLabel.js +2 -43
  102. package/dist/components/Field/components/FieldLegend.js +9 -6
  103. package/dist/components/Field/helpers/getUniqueItemsByKey.js +4 -8
  104. package/dist/components/Field/index.js +2 -6
  105. package/dist/components/Filter/Filter.js +2 -45
  106. package/dist/components/Filter/Filter.types.js +0 -1
  107. package/dist/components/Filter/components/FilterLabel.js +6 -10
  108. package/dist/components/Filter/components/FilterResetButton.js +2 -39
  109. package/dist/components/Filter/components/FilterSearch.js +2 -39
  110. package/dist/components/Filter/hooks/useFilterFlags.js +15 -24
  111. package/dist/components/Filter/index.js +2 -4
  112. package/dist/components/Form/Form.js +2 -6
  113. package/dist/components/Form/Form.types.js +6 -4
  114. package/dist/components/Form/FormContext.js +5 -7
  115. package/dist/components/Form/FormField/FormField.js +2 -91
  116. package/dist/components/Form/FormField/FormField.types.js +6 -4
  117. package/dist/components/Form/FormField/FormFieldset.js +2 -81
  118. package/dist/components/Form/FormField/helpers/getErrorTypeMessage.js +9 -19
  119. package/dist/components/Form/FormField/helpers/transformCustomRulesToValidateRule.js +23 -33
  120. package/dist/components/Form/HookForm/HookForm.js +2 -12
  121. package/dist/components/Form/components/FormValidationSummary.js +22 -22
  122. package/dist/components/Form/hooks/useNoDefaultValueInForms.js +6 -13
  123. package/dist/components/Form/index.js +4 -13
  124. package/dist/components/HeadingWithDeprecatedFallback/HeadingWithDeprecatedFallback.js +12 -14
  125. package/dist/components/Hide/Hide.js +2 -7
  126. package/dist/components/Hide/Hide.types.js +8 -5
  127. package/dist/components/Hide/helpers/composeHideClasses.js +2 -40
  128. package/dist/components/Hide/index.js +3 -7
  129. package/dist/components/Icon/Icon.js +2 -40
  130. package/dist/components/Icon/Icon.types.js +35 -30
  131. package/dist/components/Icon/index.js +3 -15
  132. package/dist/components/Inline/Inline.js +2 -41
  133. package/dist/components/Inline/Inline.types.js +6 -4
  134. package/dist/components/Inline/index.js +3 -6
  135. package/dist/components/Input/ClearButton/ClearButton.js +2 -20
  136. package/dist/components/Input/Input.js +2 -14
  137. package/dist/components/Input/Input.types.js +15 -15
  138. package/dist/components/Input/InputBase/InputBase.js +2 -9
  139. package/dist/components/Input/InputBase/InputBase.types.js +0 -1
  140. package/dist/components/Input/index.js +3 -7
  141. package/dist/components/InputCurrency/InputCurrency.js +2 -8
  142. package/dist/components/InputCurrency/InputCurrency.types.js +0 -1
  143. package/dist/components/InputCurrency/index.js +2 -4
  144. package/dist/components/Label/Label.js +9 -6
  145. package/dist/components/Label/Label.types.js +0 -1
  146. package/dist/components/Label/LabelBase/LabelBase.js +2 -70
  147. package/dist/components/Label/LabelBase/LabelBase.types.js +0 -1
  148. package/dist/components/Label/index.js +2 -4
  149. package/dist/components/Menu/Menu.js +49 -63
  150. package/dist/components/Menu/Menu.types.js +17 -10
  151. package/dist/components/Menu/MenuDivider/MenuDivider.js +2 -39
  152. package/dist/components/Menu/MenuHeading/MenuHeading.js +2 -8
  153. package/dist/components/Menu/MenuItem/MenuItem.js +2 -11
  154. package/dist/components/Menu/MenuItem/MenuItem.types.js +10 -6
  155. package/dist/components/Menu/MenuItem/hooks/useMenuItemAria.js +11 -16
  156. package/dist/components/Menu/MenuItem/hooks/useMenuItemButtonProps.js +44 -46
  157. package/dist/components/Menu/MenuItem/hooks/useMenuItemComposite.js +17 -14
  158. package/dist/components/Menu/MenuItem/hooks/useMenuItemInteractions.js +53 -64
  159. package/dist/components/Menu/MenuItem/hooks/useMenuItemRole.js +8 -8
  160. package/dist/components/Menu/MenuProvider.js +45 -66
  161. package/dist/components/Menu/MenuText/MenuText.js +2 -40
  162. package/dist/components/Menu/helpers/mapMenuItems.js +2 -47
  163. package/dist/components/Menu/hooks/useMenu.js +6 -6
  164. package/dist/components/Menu/hooks/useMenuAria.js +13 -18
  165. package/dist/components/Menu/hooks/useMenuComposite.js +7 -7
  166. package/dist/components/Menu/hooks/useMenuRole.js +11 -12
  167. package/dist/components/Menu/hooks/useMenuStyles.js +2 -26
  168. package/dist/components/Menu/index.js +10 -29
  169. package/dist/components/Modal/Modal.js +2 -16
  170. package/dist/components/Modal/Modal.types.js +9 -4
  171. package/dist/components/Modal/ModalProvider.js +26 -31
  172. package/dist/components/Modal/hooks/useIDSProvidedModal.js +12 -12
  173. package/dist/components/Modal/hooks/useModal.js +11 -19
  174. package/dist/components/Modal/index.js +5 -11
  175. package/dist/components/Navbar/Navbar.js +2 -13
  176. package/dist/components/Navbar/Navbar.types.js +6 -4
  177. package/dist/components/Navbar/components/HomeLinkContent.js +2 -6
  178. package/dist/components/Navbar/components/LogoFromSrc.js +2 -6
  179. package/dist/components/Navbar/components/NavbarLogo.js +2 -8
  180. package/dist/components/Navbar/index.js +3 -6
  181. package/dist/components/Panel/Panel.js +21 -35
  182. package/dist/components/Panel/Panel.types.js +12 -11
  183. package/dist/components/Panel/index.js +3 -8
  184. package/dist/components/Placeholder/Placeholder.js +2 -42
  185. package/dist/components/Placeholder/Placeholder.types.js +0 -1
  186. package/dist/components/Placeholder/index.js +2 -4
  187. package/dist/components/Popover/InputPopover/InputPopover.js +51 -87
  188. package/dist/components/Popover/InputPopover/InputPopover.types.js +0 -1
  189. package/dist/components/Popover/InputPopover/InputPopoverActivator.js +50 -58
  190. package/dist/components/Popover/InputPopover/InputPopoverProvider.js +86 -107
  191. package/dist/components/Popover/Popover.js +59 -97
  192. package/dist/components/Popover/Popover.types.js +14 -15
  193. package/dist/components/Popover/PopoverProvider.js +2 -15
  194. package/dist/components/Popover/components/NestedPopoverActivator.js +9 -9
  195. package/dist/components/Popover/components/PopoverActivator.js +63 -81
  196. package/dist/components/Popover/components/PopoverContent.js +51 -58
  197. package/dist/components/Popover/helpers/composeFloatingProps.js +42 -33
  198. package/dist/components/Popover/helpers/composePopoverWidth.js +7 -4
  199. package/dist/components/Popover/helpers/handlePopoverTabKey.js +23 -29
  200. package/dist/components/Popover/helpers/hasFocus.js +7 -7
  201. package/dist/components/Popover/helpers/waitUntilTrue.js +11 -11
  202. package/dist/components/Popover/hooks/usePopover.js +6 -6
  203. package/dist/components/Popover/hooks/usePopoverActivatorInteractions.js +23 -32
  204. package/dist/components/Popover/hooks/usePopoverAria.js +12 -17
  205. package/dist/components/Popover/hooks/usePopoverImperativeHandle.js +20 -24
  206. package/dist/components/Popover/hooks/usePopoverItem.js +20 -16
  207. package/dist/components/Popover/hooks/usePopoverNavigation.js +32 -31
  208. package/dist/components/Popover/hooks/usePopoverState.js +21 -28
  209. package/dist/components/Popover/index.js +5 -13
  210. package/dist/components/Progress/Progress.js +2 -48
  211. package/dist/components/Progress/Progress.types.js +0 -1
  212. package/dist/components/Progress/index.js +2 -4
  213. package/dist/components/Provider/Provider.js +2 -38
  214. package/dist/components/Provider/index.js +2 -4
  215. package/dist/components/Radio/Radio.js +2 -11
  216. package/dist/components/Radio/Radio.types.js +0 -1
  217. package/dist/components/Radio/helpers/mapRadioGroupOptions.js +12 -19
  218. package/dist/components/Radio/index.js +2 -4
  219. package/dist/components/RadioGroup/RadioGroup.js +2 -98
  220. package/dist/components/RadioGroup/RadioGroup.types.js +11 -11
  221. package/dist/components/RadioGroup/RadioGroupContext.js +5 -5
  222. package/dist/components/RadioGroup/index.js +3 -8
  223. package/dist/components/Readonly/Readonly.js +2 -43
  224. package/dist/components/Readonly/Readonly.types.js +0 -1
  225. package/dist/components/Readonly/index.js +2 -4
  226. package/dist/components/RichSelect/RichSelect.js +2 -42
  227. package/dist/components/RichSelect/RichSelect.types.js +0 -1
  228. package/dist/components/RichSelect/SelectBody/SelectBody.js +2 -56
  229. package/dist/components/RichSelect/SelectBody/SelectBody.types.js +0 -1
  230. package/dist/components/RichSelect/SelectCreate/SelectCreate.js +2 -63
  231. package/dist/components/RichSelect/SelectCreate/SelectCreate.types.js +0 -1
  232. package/dist/components/RichSelect/SelectHeading/SelectHeading.js +2 -40
  233. package/dist/components/RichSelect/SelectHeading/SelectHeading.types.js +0 -1
  234. package/dist/components/RichSelect/SelectLabel/SelectLabel.js +2 -12
  235. package/dist/components/RichSelect/SelectLabel/SelectLabel.types.js +0 -1
  236. package/dist/components/RichSelect/SelectMenu/SelectMenu.js +2 -44
  237. package/dist/components/RichSelect/SelectMenu/SelectMenu.types.js +0 -1
  238. package/dist/components/RichSelect/SelectMenu/SelectMenuItem.js +2 -39
  239. package/dist/components/RichSelect/SelectSearch/SelectSearch.js +2 -39
  240. package/dist/components/RichSelect/SelectSearch/SelectSearch.types.js +0 -1
  241. package/dist/components/RichSelect/SelectSearchInput/SelectSearchInput.js +2 -8
  242. package/dist/components/RichSelect/SelectSearchInput/SelectSearchInput.types.js +0 -1
  243. package/dist/components/RichSelect/SelectTags/SelectTags.js +2 -45
  244. package/dist/components/RichSelect/SelectTags/SelectTags.types.js +0 -1
  245. package/dist/components/RichSelect/components/SelectActivator.js +2 -7
  246. package/dist/components/RichSelect/components/SelectHiddenInput.js +18 -29
  247. package/dist/components/RichSelect/components/SelectOptions.js +2 -40
  248. package/dist/components/RichSelect/hooks/useRichSelectState.js +15 -17
  249. package/dist/components/RichSelect/index.js +3 -16
  250. package/dist/components/Row/Row.js +2 -41
  251. package/dist/components/Row/Row.types.js +6 -4
  252. package/dist/components/Row/index.js +3 -6
  253. package/dist/components/Select/Select.js +2 -14
  254. package/dist/components/Select/Select.types.js +0 -1
  255. package/dist/components/Select/SelectOption/SelectOption.js +8 -8
  256. package/dist/components/Select/components/SelectControl.js +2 -9
  257. package/dist/components/Select/components/SelectReadonly.js +2 -40
  258. package/dist/components/Select/helpers/mapSelectOptions.js +2 -21
  259. package/dist/components/Select/helpers/nodesToSelectOptions.js +2 -9
  260. package/dist/components/Select/index.js +3 -9
  261. package/dist/components/Skeleton/Skeleton.js +2 -44
  262. package/dist/components/Skeleton/Skeleton.types.js +10 -6
  263. package/dist/components/Skeleton/index.js +3 -7
  264. package/dist/components/SkipLink/SkipLink.js +2 -30
  265. package/dist/components/SkipLink/SkipLink.types.js +0 -1
  266. package/dist/components/SkipLink/index.js +2 -4
  267. package/dist/components/Slideout/Slideout.js +2 -18
  268. package/dist/components/Slideout/Slideout.types.js +14 -14
  269. package/dist/components/Slideout/SlideoutProvider.js +2 -8
  270. package/dist/components/Slideout/components/SlideoutInner.js +2 -8
  271. package/dist/components/Slideout/hooks/useIDSProvidedSlideout.js +12 -12
  272. package/dist/components/Slideout/hooks/useSlideout.js +11 -19
  273. package/dist/components/Slideout/index.js +5 -16
  274. package/dist/components/Slider/Slider.js +2 -12
  275. package/dist/components/Slider/Slider.types.js +0 -1
  276. package/dist/components/Slider/components/SliderTicks.js +2 -10
  277. package/dist/components/Slider/index.js +2 -4
  278. package/dist/components/Spinner/Spinner.js +2 -6
  279. package/dist/components/Spinner/Spinner.types.js +0 -1
  280. package/dist/components/Spinner/index.js +2 -4
  281. package/dist/components/Stack/Stack.js +15 -26
  282. package/dist/components/Stack/Stack.types.js +6 -4
  283. package/dist/components/Stack/index.js +3 -6
  284. package/dist/components/TabSet/Tab/Tab.js +2 -100
  285. package/dist/components/TabSet/Tab/Tab.types.js +0 -1
  286. package/dist/components/TabSet/TabSet.js +37 -58
  287. package/dist/components/TabSet/TabSet.types.js +10 -6
  288. package/dist/components/TabSet/TabSetProvider.js +45 -49
  289. package/dist/components/TabSet/components/TabSetItem.js +24 -44
  290. package/dist/components/TabSet/helpers/mapTabs.js +2 -33
  291. package/dist/components/TabSet/hooks/useTabSetItems.js +5 -5
  292. package/dist/components/TabSet/index.js +21 -11
  293. package/dist/components/Table/Table.js +2 -18
  294. package/dist/components/Table/Table.types.js +22 -22
  295. package/dist/components/Table/TableBody/TableBody.js +2 -125
  296. package/dist/components/Table/TableBody/TableBody.types.js +0 -1
  297. package/dist/components/Table/TableContext.js +9 -9
  298. package/dist/components/Table/TableFormattedValue/TableFormattedValue.js +11 -17
  299. package/dist/components/Table/TableFormattedValue/TableFormattedValue.types.js +0 -1
  300. package/dist/components/Table/TableProvider.js +31 -38
  301. package/dist/components/Table/components/TableBodyCell.js +16 -30
  302. package/dist/components/Table/components/TableEmpty.js +15 -11
  303. package/dist/components/Table/components/TableHeader.js +2 -8
  304. package/dist/components/Table/components/TableHeaderCell.js +2 -8
  305. package/dist/components/Table/components/TableRows.js +29 -48
  306. package/dist/components/Table/components/TableSortButton.js +2 -7
  307. package/dist/components/Table/helpers/composeIDSTableColumnDefs.js +29 -41
  308. package/dist/components/Table/helpers/composeIDSTableInitialSorting.js +6 -9
  309. package/dist/components/Table/helpers/findColumnByKey.js +4 -4
  310. package/dist/components/Table/helpers/getFormatFromValue.js +7 -10
  311. package/dist/components/Table/helpers/hasColumns.js +4 -4
  312. package/dist/components/Table/hooks/useIDSTableColumnSort.js +18 -23
  313. package/dist/components/Table/hooks/useIDSTableColumnStyles.js +21 -23
  314. package/dist/components/Table/hooks/useTable.js +5 -5
  315. package/dist/components/Table/index.js +4 -15
  316. package/dist/components/Tag/Tag.js +2 -8
  317. package/dist/components/Tag/Tag.types.js +0 -1
  318. package/dist/components/Tag/TagInput/TagInput.js +2 -8
  319. package/dist/components/Tag/TagInput/TagInput.types.js +0 -1
  320. package/dist/components/Tag/components/TagListInput/TagListInput.js +2 -8
  321. package/dist/components/Tag/components/TagListInput/TagListInput.types.js +0 -1
  322. package/dist/components/Tag/index.js +2 -5
  323. package/dist/components/Text/Text.js +19 -34
  324. package/dist/components/Text/Text.types.js +18 -18
  325. package/dist/components/Text/index.js +3 -6
  326. package/dist/components/Toaster/Toast/Toast.js +2 -13
  327. package/dist/components/Toaster/Toast/Toast.types.js +12 -9
  328. package/dist/components/Toaster/Toast/ToastAnimated.js +2 -9
  329. package/dist/components/Toaster/Toast/ToastIcon.js +2 -6
  330. package/dist/components/Toaster/Toaster.js +2 -11
  331. package/dist/components/Toaster/Toaster.types.js +23 -25
  332. package/dist/components/Toaster/ToasterProvider.js +2 -7
  333. package/dist/components/Toaster/hooks/useToaster.js +2 -26
  334. package/dist/components/Toaster/index.js +4 -17
  335. package/dist/components/Toggle/Toggle.js +2 -102
  336. package/dist/components/Toggle/Toggle.types.js +10 -10
  337. package/dist/components/Toggle/index.js +3 -7
  338. package/dist/components/Tooltip/Tooltip.js +2 -77
  339. package/dist/components/Tooltip/Tooltip.types.js +0 -1
  340. package/dist/components/Tooltip/index.js +2 -4
  341. package/dist/components/ValidationMessage/ValidationBase/ValidationBase.js +2 -51
  342. package/dist/components/ValidationMessage/ValidationBase/ValidationBase.types.js +0 -1
  343. package/dist/components/ValidationMessage/ValidationLink/ValidationLink.js +15 -21
  344. package/dist/components/ValidationMessage/ValidationLink/ValidationLink.types.js +0 -1
  345. package/dist/components/ValidationMessage/ValidationMessage.js +11 -8
  346. package/dist/components/ValidationMessage/ValidationMessage.types.js +0 -1
  347. package/dist/components/ValidationMessage/ValidationSummary/ValidationSummary.js +2 -69
  348. package/dist/components/ValidationMessage/ValidationSummary/ValidationSummary.types.js +0 -1
  349. package/dist/components/ValidationMessage/index.js +4 -8
  350. package/dist/constants-C4s0aMXs.js +161 -0
  351. package/dist/constants.js +2 -193
  352. package/dist/enums.js +42 -22
  353. package/dist/floating-ui.react-Dj2ev6bJ.js +3098 -0
  354. package/dist/fuzzysort-BZ6Yv-YR.js +377 -0
  355. package/dist/helpers/dom/closestCrossShadow.js +19 -24
  356. package/dist/helpers/dom/domUtils.js +10 -11
  357. package/dist/helpers/dom/focusableElements.js +7 -9
  358. package/dist/helpers/dom/getActiveElement.js +7 -7
  359. package/dist/helpers/dom/hasShadowDom.js +4 -4
  360. package/dist/helpers/form/getFormControlValueAsString.js +4 -4
  361. package/dist/helpers/form/getFormControlValueAsStringIfDefined.js +6 -7
  362. package/dist/helpers/form/getValueAsEvent.js +6 -6
  363. package/dist/helpers/form/isValidFormInputElement.js +4 -4
  364. package/dist/helpers/formatting/capitalizeFirstLetter.js +4 -4
  365. package/dist/helpers/formatting/formatCurrency.js +14 -21
  366. package/dist/helpers/formatting/formatDate.js +16 -22
  367. package/dist/helpers/formatting/formatDateTime.js +49 -54
  368. package/dist/helpers/formatting/formatObjectKey.js +4 -4
  369. package/dist/helpers/formatting/formatPercentage.js +6 -6
  370. package/dist/helpers/formatting/stringReplacer.js +8 -8
  371. package/dist/helpers/formatting/toArray.js +4 -4
  372. package/dist/helpers/formatting/toCSSLengthValue.js +6 -6
  373. package/dist/helpers/label-value/composeLabelValueDescriptor.js +9 -12
  374. package/dist/helpers/label-value/getQueryRangeExclusive.js +10 -13
  375. package/dist/helpers/label-value/getValueFromLabelValues.js +7 -7
  376. package/dist/helpers/label-value/highlightQueryInLabel.js +7 -6
  377. package/dist/helpers/label-value/highlightQueryInLabelValue.js +8 -8
  378. package/dist/helpers/label-value/searchLabelValues.js +12 -11
  379. package/dist/helpers/responsive/getResponsiveLayoutModifiers.js +8 -10
  380. package/dist/helpers/responsive/getResponsivePaddingClasses.js +6 -10
  381. package/dist/helpers/transition/getTransitionDuration.js +5 -7
  382. package/dist/helpers/transition/timeStringToNumber.js +4 -4
  383. package/dist/helpers/utility/generateScopedName.js +8 -9
  384. package/dist/helpers/utility/idsLogger.js +5 -9
  385. package/dist/helpers/utility/propagateTestid.js +4 -4
  386. package/dist/hooks/index.js +5 -11
  387. package/dist/hooks/useAriaRelationship.js +20 -35
  388. package/dist/hooks/useBreakpoint.js +16 -16
  389. package/dist/hooks/useControlledState.js +35 -53
  390. package/dist/hooks/useIdIfNeeded.js +7 -7
  391. package/dist/hooks/useResponsiveProps.js +25 -25
  392. package/dist/index.esm-BCkAygZA.js +169 -0
  393. package/dist/interfaces.js +0 -1
  394. package/dist/lib-CUMSFn3v.js +1415 -0
  395. package/dist/main-CTy1XcUn.js +4604 -0
  396. package/dist/main.js +88 -336
  397. package/dist/patterns/Loading/Loading.js +2 -8
  398. package/dist/patterns/Loading/LoadingSuspense.js +2 -7
  399. package/dist/patterns/Loading/components/ComponentLoading.js +2 -10
  400. package/dist/patterns/Loading/components/DefaultLoading.js +2 -9
  401. package/dist/patterns/Loading/components/LongLoading.js +2 -132
  402. package/dist/patterns/Loading/components/PageLoading.js +2 -14
  403. package/dist/patterns/Loading/components/StartUpLoading.js +2 -107
  404. package/dist/patterns/Loading/components/ValidateLoading.js +2 -9
  405. package/dist/patterns/Loading/hooks/useEstimatedProgressValue.js +25 -25
  406. package/dist/patterns/Loading/hooks/useShouldRenderLoading.js +26 -23
  407. package/dist/patterns/Loading/hooks/useShowIndicator.js +18 -19
  408. package/dist/patterns/Loading/hooks/useSuspenseResource.js +19 -26
  409. package/dist/patterns/Loading/index.js +2 -5
  410. package/dist/style.css +2 -1
  411. package/dist/types.js +0 -1
  412. package/dist/useAutocompleteSearch-CBgqGiKn.js +179 -0
  413. package/dist/useIDSButtonGroupItem-BkzYQzAi.js +21 -0
  414. package/dist/useMenuStyles-cry3mes_.js +20 -0
  415. package/package.json +15 -15
  416. package/dist/AutocompleteNoResults-B60rzwfa.js +0 -12
  417. package/dist/ComboboxHiddenInput-BUswpU00.js +0 -32
  418. package/dist/FieldAppendToLabel-BK8cAMZT.js +0 -77
  419. package/dist/InputBase-B6gEHXZ7.js +0 -56
  420. package/dist/Loading.module-BXP_0EH0.js +0 -13
  421. package/dist/LoadingSuspense-CuQm3zqO.js +0 -5740
  422. package/dist/LogoFromSrc-BvialtyP.js +0 -59
  423. package/dist/MenuItem.module-BFPHZtJl.js +0 -24
  424. package/dist/Popover.module-oIsv6lht.js +0 -11
  425. package/dist/PopoverProvider-BMBTLkRr.js +0 -142
  426. package/dist/SelectControl-Bf6qXlwP.js +0 -47
  427. package/dist/SlideoutProvider-CQh140HM.js +0 -200
  428. package/dist/SliderTicks-DRFLh0Rw.js +0 -74
  429. package/dist/TabSet.module-Dks7jQfN.js +0 -13
  430. package/dist/Table.module-BARl9Jy6.js +0 -32
  431. package/dist/_commonjsHelpers-C6fGbg64.js +0 -6
  432. package/dist/floating-ui.react-DfIjfJIq.js +0 -3503
  433. package/dist/fuzzysort-BNka47rs.js +0 -395
  434. package/dist/index-BaVtNOfa.js +0 -1693
  435. package/dist/index-DLnR8XTt.js +0 -47
  436. package/dist/index-cbHCAGLB.js +0 -40
  437. package/dist/index.esm-CL8gh5wr.js +0 -192
  438. package/dist/useIDSButtonGroupItem-DXJpvTGd.js +0 -29
@@ -1,3503 +0,0 @@
1
- import * as d from "react";
2
- import { useLayoutEffect as qn } from "react";
3
- import { t as St, i as Xn, f as Lr } from "./index.esm-CL8gh5wr.js";
4
- import { jsx as me, jsxs as Yn, Fragment as kr } from "react/jsx-runtime";
5
- import * as nn from "react-dom";
6
- function Pt() {
7
- return typeof window < "u";
8
- }
9
- function We(e) {
10
- return rn(e) ? (e.nodeName || "").toLowerCase() : "#document";
11
- }
12
- function pe(e) {
13
- var t;
14
- return (e == null || (t = e.ownerDocument) == null ? void 0 : t.defaultView) || window;
15
- }
16
- function Oe(e) {
17
- var t;
18
- return (t = (rn(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : t.documentElement;
19
- }
20
- function rn(e) {
21
- return Pt() ? e instanceof Node || e instanceof pe(e).Node : !1;
22
- }
23
- function Y(e) {
24
- return Pt() ? e instanceof Element || e instanceof pe(e).Element : !1;
25
- }
26
- function re(e) {
27
- return Pt() ? e instanceof HTMLElement || e instanceof pe(e).HTMLElement : !1;
28
- }
29
- function Rt(e) {
30
- return !Pt() || typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof pe(e).ShadowRoot;
31
- }
32
- function lt(e) {
33
- const {
34
- overflow: t,
35
- overflowX: n,
36
- overflowY: r,
37
- display: o
38
- } = we(e);
39
- return /auto|scroll|overlay|hidden|clip/.test(t + r + n) && o !== "inline" && o !== "contents";
40
- }
41
- function Fr(e) {
42
- return /^(table|td|th)$/.test(We(e));
43
- }
44
- function Dt(e) {
45
- try {
46
- if (e.matches(":popover-open"))
47
- return !0;
48
- } catch {
49
- }
50
- try {
51
- return e.matches(":modal");
52
- } catch {
53
- return !1;
54
- }
55
- }
56
- const Nr = /transform|translate|scale|rotate|perspective|filter/, _r = /paint|layout|strict|content/, $e = (e) => !!e && e !== "none";
57
- let Wt;
58
- function on(e) {
59
- const t = Y(e) ? we(e) : e;
60
- return $e(t.transform) || $e(t.translate) || $e(t.scale) || $e(t.rotate) || $e(t.perspective) || !Lt() && ($e(t.backdropFilter) || $e(t.filter)) || Nr.test(t.willChange || "") || _r.test(t.contain || "");
61
- }
62
- function Wr(e) {
63
- let t = Pe(e);
64
- for (; re(t) && !Se(t); ) {
65
- if (on(t))
66
- return t;
67
- if (Dt(t))
68
- return null;
69
- t = Pe(t);
70
- }
71
- return null;
72
- }
73
- function Lt() {
74
- return Wt == null && (Wt = typeof CSS < "u" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none")), Wt;
75
- }
76
- function Se(e) {
77
- return /^(html|body|#document)$/.test(We(e));
78
- }
79
- function we(e) {
80
- return pe(e).getComputedStyle(e);
81
- }
82
- function kt(e) {
83
- return Y(e) ? {
84
- scrollLeft: e.scrollLeft,
85
- scrollTop: e.scrollTop
86
- } : {
87
- scrollLeft: e.scrollX,
88
- scrollTop: e.scrollY
89
- };
90
- }
91
- function Pe(e) {
92
- if (We(e) === "html")
93
- return e;
94
- const t = (
95
- // Step into the shadow DOM of the parent of a slotted node.
96
- e.assignedSlot || // DOM Element detected.
97
- e.parentNode || // ShadowRoot detected.
98
- Rt(e) && e.host || // Fallback.
99
- Oe(e)
100
- );
101
- return Rt(t) ? t.host : t;
102
- }
103
- function Jn(e) {
104
- const t = Pe(e);
105
- return Se(t) ? e.ownerDocument ? e.ownerDocument.body : e.body : re(t) && lt(t) ? t : Jn(t);
106
- }
107
- function ke(e, t, n) {
108
- var r;
109
- t === void 0 && (t = []), n === void 0 && (n = !0);
110
- const o = Jn(e), s = o === ((r = e.ownerDocument) == null ? void 0 : r.body), i = pe(o);
111
- if (s) {
112
- const c = Qt(i);
113
- return t.concat(i, i.visualViewport || [], lt(o) ? o : [], c && n ? ke(c) : []);
114
- } else
115
- return t.concat(o, ke(o, [], n));
116
- }
117
- function Qt(e) {
118
- return e.parent && Object.getPrototypeOf(e.parent) ? e.frameElement : null;
119
- }
120
- const Kr = ["top", "right", "bottom", "left"], gn = ["start", "end"], hn = /* @__PURE__ */ Kr.reduce((e, t) => e.concat(t, t + "-" + gn[0], t + "-" + gn[1]), []), Qe = Math.min, he = Math.max, Et = Math.round, qe = Math.floor, Ee = (e) => ({
121
- x: e,
122
- y: e
123
- }), $r = {
124
- left: "right",
125
- right: "left",
126
- bottom: "top",
127
- top: "bottom"
128
- };
129
- function vn(e, t, n) {
130
- return he(e, Qe(t, n));
131
- }
132
- function Ze(e, t) {
133
- return typeof e == "function" ? e(t) : e;
134
- }
135
- function Ie(e) {
136
- return e.split("-")[0];
137
- }
138
- function Ce(e) {
139
- return e.split("-")[1];
140
- }
141
- function Qn(e) {
142
- return e === "x" ? "y" : "x";
143
- }
144
- function Zn(e) {
145
- return e === "y" ? "height" : "width";
146
- }
147
- function Me(e) {
148
- const t = e[0];
149
- return t === "t" || t === "b" ? "y" : "x";
150
- }
151
- function er(e) {
152
- return Qn(Me(e));
153
- }
154
- function tr(e, t, n) {
155
- n === void 0 && (n = !1);
156
- const r = Ce(e), o = er(e), s = Zn(o);
157
- let i = o === "x" ? r === (n ? "end" : "start") ? "right" : "left" : r === "start" ? "bottom" : "top";
158
- return t.reference[s] > t.floating[s] && (i = It(i)), [i, It(i)];
159
- }
160
- function Vr(e) {
161
- const t = It(e);
162
- return [Ct(e), t, Ct(t)];
163
- }
164
- function Ct(e) {
165
- return e.includes("start") ? e.replace("start", "end") : e.replace("end", "start");
166
- }
167
- const bn = ["left", "right"], yn = ["right", "left"], Br = ["top", "bottom"], Hr = ["bottom", "top"];
168
- function zr(e, t, n) {
169
- switch (e) {
170
- case "top":
171
- case "bottom":
172
- return n ? t ? yn : bn : t ? bn : yn;
173
- case "left":
174
- case "right":
175
- return t ? Br : Hr;
176
- default:
177
- return [];
178
- }
179
- }
180
- function Ur(e, t, n, r) {
181
- const o = Ce(e);
182
- let s = zr(Ie(e), n === "start", r);
183
- return o && (s = s.map((i) => i + "-" + o), t && (s = s.concat(s.map(Ct)))), s;
184
- }
185
- function It(e) {
186
- const t = Ie(e);
187
- return $r[t] + e.slice(t.length);
188
- }
189
- function Gr(e) {
190
- return {
191
- top: 0,
192
- right: 0,
193
- bottom: 0,
194
- left: 0,
195
- ...e
196
- };
197
- }
198
- function jr(e) {
199
- return typeof e != "number" ? Gr(e) : {
200
- top: e,
201
- right: e,
202
- bottom: e,
203
- left: e
204
- };
205
- }
206
- function Ot(e) {
207
- const {
208
- x: t,
209
- y: n,
210
- width: r,
211
- height: o
212
- } = e;
213
- return {
214
- width: r,
215
- height: o,
216
- top: n,
217
- left: t,
218
- right: t + r,
219
- bottom: n + o,
220
- x: t,
221
- y: n
222
- };
223
- }
224
- function sn() {
225
- const e = navigator.userAgentData;
226
- return e != null && e.platform ? e.platform : navigator.platform;
227
- }
228
- function nr() {
229
- const e = navigator.userAgentData;
230
- return e && Array.isArray(e.brands) ? e.brands.map((t) => {
231
- let {
232
- brand: n,
233
- version: r
234
- } = t;
235
- return n + "/" + r;
236
- }).join(" ") : navigator.userAgent;
237
- }
238
- function rr() {
239
- return /apple/i.test(navigator.vendor);
240
- }
241
- function Zt() {
242
- const e = /android/i;
243
- return e.test(sn()) || e.test(nr());
244
- }
245
- function qr() {
246
- return sn().toLowerCase().startsWith("mac") && !navigator.maxTouchPoints;
247
- }
248
- function or() {
249
- return nr().includes("jsdom/");
250
- }
251
- const wn = "data-floating-ui-focusable", Xr = "input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])", Kt = "ArrowLeft", $t = "ArrowRight", Yr = "ArrowUp", Jr = "ArrowDown";
252
- function Re(e) {
253
- let t = e.activeElement;
254
- for (; ((n = t) == null || (n = n.shadowRoot) == null ? void 0 : n.activeElement) != null; ) {
255
- var n;
256
- t = t.shadowRoot.activeElement;
257
- }
258
- return t;
259
- }
260
- function ce(e, t) {
261
- if (!e || !t)
262
- return !1;
263
- const n = t.getRootNode == null ? void 0 : t.getRootNode();
264
- if (e.contains(t))
265
- return !0;
266
- if (n && Rt(n)) {
267
- let r = t;
268
- for (; r; ) {
269
- if (e === r)
270
- return !0;
271
- r = r.parentNode || r.host;
272
- }
273
- }
274
- return !1;
275
- }
276
- function Ae(e) {
277
- return "composedPath" in e ? e.composedPath()[0] : e.target;
278
- }
279
- function Vt(e, t) {
280
- if (t == null)
281
- return !1;
282
- if ("composedPath" in e)
283
- return e.composedPath().includes(t);
284
- const n = e;
285
- return n.target != null && t.contains(n.target);
286
- }
287
- function Qr(e) {
288
- return e.matches("html,body");
289
- }
290
- function le(e) {
291
- return e?.ownerDocument || document;
292
- }
293
- function cn(e) {
294
- return re(e) && e.matches(Xr);
295
- }
296
- function en(e) {
297
- return e ? e.getAttribute("role") === "combobox" && cn(e) : !1;
298
- }
299
- function Zr(e) {
300
- if (!e || or()) return !0;
301
- try {
302
- return e.matches(":focus-visible");
303
- } catch {
304
- return !0;
305
- }
306
- }
307
- function Tt(e) {
308
- return e ? e.hasAttribute(wn) ? e : e.querySelector("[" + wn + "]") || e : null;
309
- }
310
- function Be(e, t, n) {
311
- return n === void 0 && (n = !0), e.filter((o) => {
312
- var s;
313
- return o.parentId === t && (!n || ((s = o.context) == null ? void 0 : s.open));
314
- }).flatMap((o) => [o, ...Be(e, o.id, n)]);
315
- }
316
- function eo(e, t) {
317
- let n, r = -1;
318
- function o(s, i) {
319
- i > r && (n = s, r = i), Be(e, s).forEach((f) => {
320
- o(f.id, i + 1);
321
- });
322
- }
323
- return o(t, 0), e.find((s) => s.id === n);
324
- }
325
- function xn(e, t) {
326
- var n;
327
- let r = [], o = (n = e.find((s) => s.id === t)) == null ? void 0 : n.parentId;
328
- for (; o; ) {
329
- const s = e.find((i) => i.id === o);
330
- o = s?.parentId, s && (r = r.concat(s));
331
- }
332
- return r;
333
- }
334
- function de(e) {
335
- e.preventDefault(), e.stopPropagation();
336
- }
337
- function to(e) {
338
- return "nativeEvent" in e;
339
- }
340
- function ir(e) {
341
- return e.mozInputSource === 0 && e.isTrusted ? !0 : Zt() && e.pointerType ? e.type === "click" && e.buttons === 1 : e.detail === 0 && !e.pointerType;
342
- }
343
- function sr(e) {
344
- return or() ? !1 : !Zt() && e.width === 0 && e.height === 0 || Zt() && e.width === 1 && e.height === 1 && e.pressure === 0 && e.detail === 0 && e.pointerType === "mouse" || // iOS VoiceOver returns 0.333• for width/height.
345
- e.width < 1 && e.height < 1 && e.pressure === 0 && e.detail === 0 && e.pointerType === "touch";
346
- }
347
- function st(e, t) {
348
- const n = ["mouse", "pen"];
349
- return t || n.push("", void 0), n.includes(e);
350
- }
351
- var no = typeof document < "u", ro = function() {
352
- }, X = no ? qn : ro;
353
- const oo = {
354
- ...d
355
- };
356
- function ye(e) {
357
- const t = d.useRef(e);
358
- return X(() => {
359
- t.current = e;
360
- }), t;
361
- }
362
- const io = oo.useInsertionEffect, so = io || ((e) => e());
363
- function ie(e) {
364
- const t = d.useRef(() => {
365
- if (process.env.NODE_ENV !== "production")
366
- throw new Error("Cannot call an event handler while rendering.");
367
- });
368
- return so(() => {
369
- t.current = e;
370
- }), d.useCallback(function() {
371
- for (var n = arguments.length, r = new Array(n), o = 0; o < n; o++)
372
- r[o] = arguments[o];
373
- return t.current == null ? void 0 : t.current(...r);
374
- }, []);
375
- }
376
- function gt(e, t, n) {
377
- return Math.floor(e / t) !== n;
378
- }
379
- function Xe(e, t) {
380
- return t < 0 || t >= e.current.length;
381
- }
382
- function wt(e, t) {
383
- return ue(e, {
384
- disabledIndices: t
385
- });
386
- }
387
- function tn(e, t) {
388
- return ue(e, {
389
- decrement: !0,
390
- startingIndex: e.current.length,
391
- disabledIndices: t
392
- });
393
- }
394
- function ue(e, t) {
395
- let {
396
- startingIndex: n = -1,
397
- decrement: r = !1,
398
- disabledIndices: o,
399
- amount: s = 1
400
- } = t === void 0 ? {} : t, i = n;
401
- do
402
- i += r ? -s : s;
403
- while (i >= 0 && i <= e.current.length - 1 && He(e, i, o));
404
- return i;
405
- }
406
- function cr(e, t) {
407
- let {
408
- event: n,
409
- orientation: r,
410
- loop: o,
411
- rtl: s,
412
- cols: i,
413
- disabledIndices: c,
414
- minIndex: f,
415
- maxIndex: l,
416
- prevIndex: u,
417
- stopEvent: p = !1
418
- } = t, m = u;
419
- if (n.key === Yr) {
420
- if (p && de(n), u === -1)
421
- m = l;
422
- else if (m = ue(e, {
423
- startingIndex: m,
424
- amount: i,
425
- decrement: !0,
426
- disabledIndices: c
427
- }), o && (u - i < f || m < 0)) {
428
- const a = u % i, v = l % i, g = l - (v - a);
429
- v === a ? m = l : m = v > a ? g : g - i;
430
- }
431
- Xe(e, m) && (m = u);
432
- }
433
- if (n.key === Jr && (p && de(n), u === -1 ? m = f : (m = ue(e, {
434
- startingIndex: u,
435
- amount: i,
436
- disabledIndices: c
437
- }), o && u + i > l && (m = ue(e, {
438
- startingIndex: u % i - i,
439
- amount: i,
440
- disabledIndices: c
441
- }))), Xe(e, m) && (m = u)), r === "both") {
442
- const a = qe(u / i);
443
- n.key === (s ? Kt : $t) && (p && de(n), u % i !== i - 1 ? (m = ue(e, {
444
- startingIndex: u,
445
- disabledIndices: c
446
- }), o && gt(m, i, a) && (m = ue(e, {
447
- startingIndex: u - u % i - 1,
448
- disabledIndices: c
449
- }))) : o && (m = ue(e, {
450
- startingIndex: u - u % i - 1,
451
- disabledIndices: c
452
- })), gt(m, i, a) && (m = u)), n.key === (s ? $t : Kt) && (p && de(n), u % i !== 0 ? (m = ue(e, {
453
- startingIndex: u,
454
- decrement: !0,
455
- disabledIndices: c
456
- }), o && gt(m, i, a) && (m = ue(e, {
457
- startingIndex: u + (i - u % i),
458
- decrement: !0,
459
- disabledIndices: c
460
- }))) : o && (m = ue(e, {
461
- startingIndex: u + (i - u % i),
462
- decrement: !0,
463
- disabledIndices: c
464
- })), gt(m, i, a) && (m = u));
465
- const v = qe(l / i) === a;
466
- Xe(e, m) && (o && v ? m = n.key === (s ? $t : Kt) ? l : ue(e, {
467
- startingIndex: u - u % i - 1,
468
- disabledIndices: c
469
- }) : m = u);
470
- }
471
- return m;
472
- }
473
- function ur(e, t, n) {
474
- const r = [];
475
- let o = 0;
476
- return e.forEach((s, i) => {
477
- let {
478
- width: c,
479
- height: f
480
- } = s;
481
- if (c > t && process.env.NODE_ENV !== "production")
482
- throw new Error("[Floating UI]: Invalid grid - item width at index " + i + " is greater than grid columns");
483
- let l = !1;
484
- for (n && (o = 0); !l; ) {
485
- const u = [];
486
- for (let p = 0; p < c; p++)
487
- for (let m = 0; m < f; m++)
488
- u.push(o + p + m * t);
489
- o % t + c <= t && u.every((p) => r[p] == null) ? (u.forEach((p) => {
490
- r[p] = i;
491
- }), l = !0) : o++;
492
- }
493
- }), [...r];
494
- }
495
- function lr(e, t, n, r, o) {
496
- if (e === -1) return -1;
497
- const s = n.indexOf(e), i = t[e];
498
- switch (o) {
499
- case "tl":
500
- return s;
501
- case "tr":
502
- return i ? s + i.width - 1 : s;
503
- case "bl":
504
- return i ? s + (i.height - 1) * r : s;
505
- case "br":
506
- return n.lastIndexOf(e);
507
- }
508
- }
509
- function ar(e, t) {
510
- return t.flatMap((n, r) => e.includes(n) ? [r] : []);
511
- }
512
- function He(e, t, n) {
513
- if (typeof n == "function")
514
- return n(t);
515
- if (n)
516
- return n.includes(t);
517
- const r = e.current[t];
518
- return r == null || r.hasAttribute("disabled") || r.getAttribute("aria-disabled") === "true";
519
- }
520
- const at = () => ({
521
- getShadowRoot: !0,
522
- displayCheck: (
523
- // JSDOM does not support the `tabbable` library. To solve this we can
524
- // check if `ResizeObserver` is a real function (not polyfilled), which
525
- // determines if the current environment is JSDOM-like.
526
- typeof ResizeObserver == "function" && ResizeObserver.toString().includes("[native code]") ? "full" : "none"
527
- )
528
- });
529
- function fr(e, t) {
530
- const n = St(e, at()), r = n.length;
531
- if (r === 0) return;
532
- const o = Re(le(e)), s = n.indexOf(o), i = s === -1 ? t === 1 ? 0 : r - 1 : s + t;
533
- return n[i];
534
- }
535
- function dr(e) {
536
- return fr(le(e).body, 1) || e;
537
- }
538
- function mr(e) {
539
- return fr(le(e).body, -1) || e;
540
- }
541
- function it(e, t) {
542
- const n = t || e.currentTarget, r = e.relatedTarget;
543
- return !r || !ce(n, r);
544
- }
545
- function co(e) {
546
- St(e, at()).forEach((n) => {
547
- n.dataset.tabindex = n.getAttribute("tabindex") || "", n.setAttribute("tabindex", "-1");
548
- });
549
- }
550
- function Rn(e) {
551
- e.querySelectorAll("[data-tabindex]").forEach((n) => {
552
- const r = n.dataset.tabindex;
553
- delete n.dataset.tabindex, r ? n.setAttribute("tabindex", r) : n.removeAttribute("tabindex");
554
- });
555
- }
556
- function En(e, t, n) {
557
- let {
558
- reference: r,
559
- floating: o
560
- } = e;
561
- const s = Me(t), i = er(t), c = Zn(i), f = Ie(t), l = s === "y", u = r.x + r.width / 2 - o.width / 2, p = r.y + r.height / 2 - o.height / 2, m = r[c] / 2 - o[c] / 2;
562
- let a;
563
- switch (f) {
564
- case "top":
565
- a = {
566
- x: u,
567
- y: r.y - o.height
568
- };
569
- break;
570
- case "bottom":
571
- a = {
572
- x: u,
573
- y: r.y + r.height
574
- };
575
- break;
576
- case "right":
577
- a = {
578
- x: r.x + r.width,
579
- y: p
580
- };
581
- break;
582
- case "left":
583
- a = {
584
- x: r.x - o.width,
585
- y: p
586
- };
587
- break;
588
- default:
589
- a = {
590
- x: r.x,
591
- y: r.y
592
- };
593
- }
594
- switch (Ce(t)) {
595
- case "start":
596
- a[i] -= m * (n && l ? -1 : 1);
597
- break;
598
- case "end":
599
- a[i] += m * (n && l ? -1 : 1);
600
- break;
601
- }
602
- return a;
603
- }
604
- async function uo(e, t) {
605
- var n;
606
- t === void 0 && (t = {});
607
- const {
608
- x: r,
609
- y: o,
610
- platform: s,
611
- rects: i,
612
- elements: c,
613
- strategy: f
614
- } = e, {
615
- boundary: l = "clippingAncestors",
616
- rootBoundary: u = "viewport",
617
- elementContext: p = "floating",
618
- altBoundary: m = !1,
619
- padding: a = 0
620
- } = Ze(t, e), v = jr(a), w = c[m ? p === "floating" ? "reference" : "floating" : p], x = Ot(await s.getClippingRect({
621
- element: (n = await (s.isElement == null ? void 0 : s.isElement(w))) == null || n ? w : w.contextElement || await (s.getDocumentElement == null ? void 0 : s.getDocumentElement(c.floating)),
622
- boundary: l,
623
- rootBoundary: u,
624
- strategy: f
625
- })), b = p === "floating" ? {
626
- x: r,
627
- y: o,
628
- width: i.floating.width,
629
- height: i.floating.height
630
- } : i.reference, y = await (s.getOffsetParent == null ? void 0 : s.getOffsetParent(c.floating)), C = await (s.isElement == null ? void 0 : s.isElement(y)) ? await (s.getScale == null ? void 0 : s.getScale(y)) || {
631
- x: 1,
632
- y: 1
633
- } : {
634
- x: 1,
635
- y: 1
636
- }, D = Ot(s.convertOffsetParentRelativeRectToViewportRelativeRect ? await s.convertOffsetParentRelativeRectToViewportRelativeRect({
637
- elements: c,
638
- rect: b,
639
- offsetParent: y,
640
- strategy: f
641
- }) : b);
642
- return {
643
- top: (x.top - D.top + v.top) / C.y,
644
- bottom: (D.bottom - x.bottom + v.bottom) / C.y,
645
- left: (x.left - D.left + v.left) / C.x,
646
- right: (D.right - x.right + v.right) / C.x
647
- };
648
- }
649
- const lo = 50, ao = async (e, t, n) => {
650
- const {
651
- placement: r = "bottom",
652
- strategy: o = "absolute",
653
- middleware: s = [],
654
- platform: i
655
- } = n, c = i.detectOverflow ? i : {
656
- ...i,
657
- detectOverflow: uo
658
- }, f = await (i.isRTL == null ? void 0 : i.isRTL(t));
659
- let l = await i.getElementRects({
660
- reference: e,
661
- floating: t,
662
- strategy: o
663
- }), {
664
- x: u,
665
- y: p
666
- } = En(l, r, f), m = r, a = 0;
667
- const v = {};
668
- for (let g = 0; g < s.length; g++) {
669
- const w = s[g];
670
- if (!w)
671
- continue;
672
- const {
673
- name: x,
674
- fn: b
675
- } = w, {
676
- x: y,
677
- y: C,
678
- data: D,
679
- reset: P
680
- } = await b({
681
- x: u,
682
- y: p,
683
- initialPlacement: r,
684
- placement: m,
685
- strategy: o,
686
- middlewareData: v,
687
- rects: l,
688
- platform: c,
689
- elements: {
690
- reference: e,
691
- floating: t
692
- }
693
- });
694
- u = y ?? u, p = C ?? p, v[x] = {
695
- ...v[x],
696
- ...D
697
- }, P && a < lo && (a++, typeof P == "object" && (P.placement && (m = P.placement), P.rects && (l = P.rects === !0 ? await i.getElementRects({
698
- reference: e,
699
- floating: t,
700
- strategy: o
701
- }) : P.rects), {
702
- x: u,
703
- y: p
704
- } = En(l, m, f)), g = -1);
705
- }
706
- return {
707
- x: u,
708
- y: p,
709
- placement: m,
710
- strategy: o,
711
- middlewareData: v
712
- };
713
- };
714
- function fo(e, t, n) {
715
- return (e ? [...n.filter((o) => Ce(o) === e), ...n.filter((o) => Ce(o) !== e)] : n.filter((o) => Ie(o) === o)).filter((o) => e ? Ce(o) === e || (t ? Ct(o) !== o : !1) : !0);
716
- }
717
- const mo = function(e) {
718
- return e === void 0 && (e = {}), {
719
- name: "autoPlacement",
720
- options: e,
721
- async fn(t) {
722
- var n, r, o;
723
- const {
724
- rects: s,
725
- middlewareData: i,
726
- placement: c,
727
- platform: f,
728
- elements: l
729
- } = t, {
730
- crossAxis: u = !1,
731
- alignment: p,
732
- allowedPlacements: m = hn,
733
- autoAlignment: a = !0,
734
- ...v
735
- } = Ze(e, t), g = p !== void 0 || m === hn ? fo(p || null, a, m) : m, w = await f.detectOverflow(t, v), x = ((n = i.autoPlacement) == null ? void 0 : n.index) || 0, b = g[x];
736
- if (b == null)
737
- return {};
738
- const y = tr(b, s, await (f.isRTL == null ? void 0 : f.isRTL(l.floating)));
739
- if (c !== b)
740
- return {
741
- reset: {
742
- placement: g[0]
743
- }
744
- };
745
- const C = [w[Ie(b)], w[y[0]], w[y[1]]], D = [...((r = i.autoPlacement) == null ? void 0 : r.overflows) || [], {
746
- placement: b,
747
- overflows: C
748
- }], P = g[x + 1];
749
- if (P)
750
- return {
751
- data: {
752
- index: x + 1,
753
- overflows: D
754
- },
755
- reset: {
756
- placement: P
757
- }
758
- };
759
- const N = D.map((k) => {
760
- const _ = Ce(k.placement);
761
- return [k.placement, _ && u ? (
762
- // Check along the mainAxis and main crossAxis side.
763
- k.overflows.slice(0, 2).reduce((G, W) => G + W, 0)
764
- ) : (
765
- // Check only the mainAxis.
766
- k.overflows[0]
767
- ), k.overflows];
768
- }).sort((k, _) => k[1] - _[1]), K = ((o = N.filter((k) => k[2].slice(
769
- 0,
770
- // Aligned placements should not check their opposite crossAxis
771
- // side.
772
- Ce(k[0]) ? 2 : 3
773
- ).every((_) => _ <= 0))[0]) == null ? void 0 : o[0]) || N[0][0];
774
- return K !== c ? {
775
- data: {
776
- index: x + 1,
777
- overflows: D
778
- },
779
- reset: {
780
- placement: K
781
- }
782
- } : {};
783
- }
784
- };
785
- }, po = function(e) {
786
- return e === void 0 && (e = {}), {
787
- name: "flip",
788
- options: e,
789
- async fn(t) {
790
- var n, r;
791
- const {
792
- placement: o,
793
- middlewareData: s,
794
- rects: i,
795
- initialPlacement: c,
796
- platform: f,
797
- elements: l
798
- } = t, {
799
- mainAxis: u = !0,
800
- crossAxis: p = !0,
801
- fallbackPlacements: m,
802
- fallbackStrategy: a = "bestFit",
803
- fallbackAxisSideDirection: v = "none",
804
- flipAlignment: g = !0,
805
- ...w
806
- } = Ze(e, t);
807
- if ((n = s.arrow) != null && n.alignmentOffset)
808
- return {};
809
- const x = Ie(o), b = Me(c), y = Ie(c) === c, C = await (f.isRTL == null ? void 0 : f.isRTL(l.floating)), D = m || (y || !g ? [It(c)] : Vr(c)), P = v !== "none";
810
- !m && P && D.push(...Ur(c, g, v, C));
811
- const N = [c, ...D], S = await f.detectOverflow(t, w), K = [];
812
- let k = ((r = s.flip) == null ? void 0 : r.overflows) || [];
813
- if (u && K.push(S[x]), p) {
814
- const R = tr(o, i, C);
815
- K.push(S[R[0]], S[R[1]]);
816
- }
817
- if (k = [...k, {
818
- placement: o,
819
- overflows: K
820
- }], !K.every((R) => R <= 0)) {
821
- var _, G;
822
- const R = (((_ = s.flip) == null ? void 0 : _.index) || 0) + 1, E = N[R];
823
- if (E && (!(p === "alignment" ? b !== Me(E) : !1) || // We leave the current main axis only if every placement on that axis
824
- // overflows the main axis.
825
- k.every((h) => Me(h.placement) === b ? h.overflows[0] > 0 : !0)))
826
- return {
827
- data: {
828
- index: R,
829
- overflows: k
830
- },
831
- reset: {
832
- placement: E
833
- }
834
- };
835
- let V = (G = k.filter((O) => O.overflows[0] <= 0).sort((O, h) => O.overflows[1] - h.overflows[1])[0]) == null ? void 0 : G.placement;
836
- if (!V)
837
- switch (a) {
838
- case "bestFit": {
839
- var W;
840
- const O = (W = k.filter((h) => {
841
- if (P) {
842
- const I = Me(h.placement);
843
- return I === b || // Create a bias to the `y` side axis due to horizontal
844
- // reading directions favoring greater width.
845
- I === "y";
846
- }
847
- return !0;
848
- }).map((h) => [h.placement, h.overflows.filter((I) => I > 0).reduce((I, L) => I + L, 0)]).sort((h, I) => h[1] - I[1])[0]) == null ? void 0 : W[0];
849
- O && (V = O);
850
- break;
851
- }
852
- case "initialPlacement":
853
- V = c;
854
- break;
855
- }
856
- if (o !== V)
857
- return {
858
- reset: {
859
- placement: V
860
- }
861
- };
862
- }
863
- return {};
864
- }
865
- };
866
- }, go = /* @__PURE__ */ new Set(["left", "top"]);
867
- async function ho(e, t) {
868
- const {
869
- placement: n,
870
- platform: r,
871
- elements: o
872
- } = e, s = await (r.isRTL == null ? void 0 : r.isRTL(o.floating)), i = Ie(n), c = Ce(n), f = Me(n) === "y", l = go.has(i) ? -1 : 1, u = s && f ? -1 : 1, p = Ze(t, e);
873
- let {
874
- mainAxis: m,
875
- crossAxis: a,
876
- alignmentAxis: v
877
- } = typeof p == "number" ? {
878
- mainAxis: p,
879
- crossAxis: 0,
880
- alignmentAxis: null
881
- } : {
882
- mainAxis: p.mainAxis || 0,
883
- crossAxis: p.crossAxis || 0,
884
- alignmentAxis: p.alignmentAxis
885
- };
886
- return c && typeof v == "number" && (a = c === "end" ? v * -1 : v), f ? {
887
- x: a * u,
888
- y: m * l
889
- } : {
890
- x: m * l,
891
- y: a * u
892
- };
893
- }
894
- const vo = function(e) {
895
- return e === void 0 && (e = 0), {
896
- name: "offset",
897
- options: e,
898
- async fn(t) {
899
- var n, r;
900
- const {
901
- x: o,
902
- y: s,
903
- placement: i,
904
- middlewareData: c
905
- } = t, f = await ho(t, e);
906
- return i === ((n = c.offset) == null ? void 0 : n.placement) && (r = c.arrow) != null && r.alignmentOffset ? {} : {
907
- x: o + f.x,
908
- y: s + f.y,
909
- data: {
910
- ...f,
911
- placement: i
912
- }
913
- };
914
- }
915
- };
916
- }, bo = function(e) {
917
- return e === void 0 && (e = {}), {
918
- name: "shift",
919
- options: e,
920
- async fn(t) {
921
- const {
922
- x: n,
923
- y: r,
924
- placement: o,
925
- platform: s
926
- } = t, {
927
- mainAxis: i = !0,
928
- crossAxis: c = !1,
929
- limiter: f = {
930
- fn: (x) => {
931
- let {
932
- x: b,
933
- y
934
- } = x;
935
- return {
936
- x: b,
937
- y
938
- };
939
- }
940
- },
941
- ...l
942
- } = Ze(e, t), u = {
943
- x: n,
944
- y: r
945
- }, p = await s.detectOverflow(t, l), m = Me(Ie(o)), a = Qn(m);
946
- let v = u[a], g = u[m];
947
- if (i) {
948
- const x = a === "y" ? "top" : "left", b = a === "y" ? "bottom" : "right", y = v + p[x], C = v - p[b];
949
- v = vn(y, v, C);
950
- }
951
- if (c) {
952
- const x = m === "y" ? "top" : "left", b = m === "y" ? "bottom" : "right", y = g + p[x], C = g - p[b];
953
- g = vn(y, g, C);
954
- }
955
- const w = f.fn({
956
- ...t,
957
- [a]: v,
958
- [m]: g
959
- });
960
- return {
961
- ...w,
962
- data: {
963
- x: w.x - n,
964
- y: w.y - r,
965
- enabled: {
966
- [a]: i,
967
- [m]: c
968
- }
969
- }
970
- };
971
- }
972
- };
973
- }, yo = function(e) {
974
- return e === void 0 && (e = {}), {
975
- name: "size",
976
- options: e,
977
- async fn(t) {
978
- var n, r;
979
- const {
980
- placement: o,
981
- rects: s,
982
- platform: i,
983
- elements: c
984
- } = t, {
985
- apply: f = () => {
986
- },
987
- ...l
988
- } = Ze(e, t), u = await i.detectOverflow(t, l), p = Ie(o), m = Ce(o), a = Me(o) === "y", {
989
- width: v,
990
- height: g
991
- } = s.floating;
992
- let w, x;
993
- p === "top" || p === "bottom" ? (w = p, x = m === (await (i.isRTL == null ? void 0 : i.isRTL(c.floating)) ? "start" : "end") ? "left" : "right") : (x = p, w = m === "end" ? "top" : "bottom");
994
- const b = g - u.top - u.bottom, y = v - u.left - u.right, C = Qe(g - u[w], b), D = Qe(v - u[x], y), P = !t.middlewareData.shift;
995
- let N = C, S = D;
996
- if ((n = t.middlewareData.shift) != null && n.enabled.x && (S = y), (r = t.middlewareData.shift) != null && r.enabled.y && (N = b), P && !m) {
997
- const k = he(u.left, 0), _ = he(u.right, 0), G = he(u.top, 0), W = he(u.bottom, 0);
998
- a ? S = v - 2 * (k !== 0 || _ !== 0 ? k + _ : he(u.left, u.right)) : N = g - 2 * (G !== 0 || W !== 0 ? G + W : he(u.top, u.bottom));
999
- }
1000
- await f({
1001
- ...t,
1002
- availableWidth: S,
1003
- availableHeight: N
1004
- });
1005
- const K = await i.getDimensions(c.floating);
1006
- return v !== K.width || g !== K.height ? {
1007
- reset: {
1008
- rects: !0
1009
- }
1010
- } : {};
1011
- }
1012
- };
1013
- };
1014
- function pr(e) {
1015
- const t = we(e);
1016
- let n = parseFloat(t.width) || 0, r = parseFloat(t.height) || 0;
1017
- const o = re(e), s = o ? e.offsetWidth : n, i = o ? e.offsetHeight : r, c = Et(n) !== s || Et(r) !== i;
1018
- return c && (n = s, r = i), {
1019
- width: n,
1020
- height: r,
1021
- $: c
1022
- };
1023
- }
1024
- function un(e) {
1025
- return Y(e) ? e : e.contextElement;
1026
- }
1027
- function Ye(e) {
1028
- const t = un(e);
1029
- if (!re(t))
1030
- return Ee(1);
1031
- const n = t.getBoundingClientRect(), {
1032
- width: r,
1033
- height: o,
1034
- $: s
1035
- } = pr(t);
1036
- let i = (s ? Et(n.width) : n.width) / r, c = (s ? Et(n.height) : n.height) / o;
1037
- return (!i || !Number.isFinite(i)) && (i = 1), (!c || !Number.isFinite(c)) && (c = 1), {
1038
- x: i,
1039
- y: c
1040
- };
1041
- }
1042
- const wo = /* @__PURE__ */ Ee(0);
1043
- function gr(e) {
1044
- const t = pe(e);
1045
- return !Lt() || !t.visualViewport ? wo : {
1046
- x: t.visualViewport.offsetLeft,
1047
- y: t.visualViewport.offsetTop
1048
- };
1049
- }
1050
- function xo(e, t, n) {
1051
- return t === void 0 && (t = !1), !n || t && n !== pe(e) ? !1 : t;
1052
- }
1053
- function ze(e, t, n, r) {
1054
- t === void 0 && (t = !1), n === void 0 && (n = !1);
1055
- const o = e.getBoundingClientRect(), s = un(e);
1056
- let i = Ee(1);
1057
- t && (r ? Y(r) && (i = Ye(r)) : i = Ye(e));
1058
- const c = xo(s, n, r) ? gr(s) : Ee(0);
1059
- let f = (o.left + c.x) / i.x, l = (o.top + c.y) / i.y, u = o.width / i.x, p = o.height / i.y;
1060
- if (s) {
1061
- const m = pe(s), a = r && Y(r) ? pe(r) : r;
1062
- let v = m, g = Qt(v);
1063
- for (; g && r && a !== v; ) {
1064
- const w = Ye(g), x = g.getBoundingClientRect(), b = we(g), y = x.left + (g.clientLeft + parseFloat(b.paddingLeft)) * w.x, C = x.top + (g.clientTop + parseFloat(b.paddingTop)) * w.y;
1065
- f *= w.x, l *= w.y, u *= w.x, p *= w.y, f += y, l += C, v = pe(g), g = Qt(v);
1066
- }
1067
- }
1068
- return Ot({
1069
- width: u,
1070
- height: p,
1071
- x: f,
1072
- y: l
1073
- });
1074
- }
1075
- function Ft(e, t) {
1076
- const n = kt(e).scrollLeft;
1077
- return t ? t.left + n : ze(Oe(e)).left + n;
1078
- }
1079
- function hr(e, t) {
1080
- const n = e.getBoundingClientRect(), r = n.left + t.scrollLeft - Ft(e, n), o = n.top + t.scrollTop;
1081
- return {
1082
- x: r,
1083
- y: o
1084
- };
1085
- }
1086
- function Ro(e) {
1087
- let {
1088
- elements: t,
1089
- rect: n,
1090
- offsetParent: r,
1091
- strategy: o
1092
- } = e;
1093
- const s = o === "fixed", i = Oe(r), c = t ? Dt(t.floating) : !1;
1094
- if (r === i || c && s)
1095
- return n;
1096
- let f = {
1097
- scrollLeft: 0,
1098
- scrollTop: 0
1099
- }, l = Ee(1);
1100
- const u = Ee(0), p = re(r);
1101
- if ((p || !p && !s) && ((We(r) !== "body" || lt(i)) && (f = kt(r)), p)) {
1102
- const a = ze(r);
1103
- l = Ye(r), u.x = a.x + r.clientLeft, u.y = a.y + r.clientTop;
1104
- }
1105
- const m = i && !p && !s ? hr(i, f) : Ee(0);
1106
- return {
1107
- width: n.width * l.x,
1108
- height: n.height * l.y,
1109
- x: n.x * l.x - f.scrollLeft * l.x + u.x + m.x,
1110
- y: n.y * l.y - f.scrollTop * l.y + u.y + m.y
1111
- };
1112
- }
1113
- function Eo(e) {
1114
- return Array.from(e.getClientRects());
1115
- }
1116
- function Co(e) {
1117
- const t = Oe(e), n = kt(e), r = e.ownerDocument.body, o = he(t.scrollWidth, t.clientWidth, r.scrollWidth, r.clientWidth), s = he(t.scrollHeight, t.clientHeight, r.scrollHeight, r.clientHeight);
1118
- let i = -n.scrollLeft + Ft(e);
1119
- const c = -n.scrollTop;
1120
- return we(r).direction === "rtl" && (i += he(t.clientWidth, r.clientWidth) - o), {
1121
- width: o,
1122
- height: s,
1123
- x: i,
1124
- y: c
1125
- };
1126
- }
1127
- const Cn = 25;
1128
- function Io(e, t) {
1129
- const n = pe(e), r = Oe(e), o = n.visualViewport;
1130
- let s = r.clientWidth, i = r.clientHeight, c = 0, f = 0;
1131
- if (o) {
1132
- s = o.width, i = o.height;
1133
- const u = Lt();
1134
- (!u || u && t === "fixed") && (c = o.offsetLeft, f = o.offsetTop);
1135
- }
1136
- const l = Ft(r);
1137
- if (l <= 0) {
1138
- const u = r.ownerDocument, p = u.body, m = getComputedStyle(p), a = u.compatMode === "CSS1Compat" && parseFloat(m.marginLeft) + parseFloat(m.marginRight) || 0, v = Math.abs(r.clientWidth - p.clientWidth - a);
1139
- v <= Cn && (s -= v);
1140
- } else l <= Cn && (s += l);
1141
- return {
1142
- width: s,
1143
- height: i,
1144
- x: c,
1145
- y: f
1146
- };
1147
- }
1148
- function Oo(e, t) {
1149
- const n = ze(e, !0, t === "fixed"), r = n.top + e.clientTop, o = n.left + e.clientLeft, s = re(e) ? Ye(e) : Ee(1), i = e.clientWidth * s.x, c = e.clientHeight * s.y, f = o * s.x, l = r * s.y;
1150
- return {
1151
- width: i,
1152
- height: c,
1153
- x: f,
1154
- y: l
1155
- };
1156
- }
1157
- function In(e, t, n) {
1158
- let r;
1159
- if (t === "viewport")
1160
- r = Io(e, n);
1161
- else if (t === "document")
1162
- r = Co(Oe(e));
1163
- else if (Y(t))
1164
- r = Oo(t, n);
1165
- else {
1166
- const o = gr(e);
1167
- r = {
1168
- x: t.x - o.x,
1169
- y: t.y - o.y,
1170
- width: t.width,
1171
- height: t.height
1172
- };
1173
- }
1174
- return Ot(r);
1175
- }
1176
- function vr(e, t) {
1177
- const n = Pe(e);
1178
- return n === t || !Y(n) || Se(n) ? !1 : we(n).position === "fixed" || vr(n, t);
1179
- }
1180
- function To(e, t) {
1181
- const n = t.get(e);
1182
- if (n)
1183
- return n;
1184
- let r = ke(e, [], !1).filter((c) => Y(c) && We(c) !== "body"), o = null;
1185
- const s = we(e).position === "fixed";
1186
- let i = s ? Pe(e) : e;
1187
- for (; Y(i) && !Se(i); ) {
1188
- const c = we(i), f = on(i);
1189
- !f && c.position === "fixed" && (o = null), (s ? !f && !o : !f && c.position === "static" && !!o && (o.position === "absolute" || o.position === "fixed") || lt(i) && !f && vr(e, i)) ? r = r.filter((u) => u !== i) : o = c, i = Pe(i);
1190
- }
1191
- return t.set(e, r), r;
1192
- }
1193
- function Ao(e) {
1194
- let {
1195
- element: t,
1196
- boundary: n,
1197
- rootBoundary: r,
1198
- strategy: o
1199
- } = e;
1200
- const i = [...n === "clippingAncestors" ? Dt(t) ? [] : To(t, this._c) : [].concat(n), r], c = In(t, i[0], o);
1201
- let f = c.top, l = c.right, u = c.bottom, p = c.left;
1202
- for (let m = 1; m < i.length; m++) {
1203
- const a = In(t, i[m], o);
1204
- f = he(a.top, f), l = Qe(a.right, l), u = Qe(a.bottom, u), p = he(a.left, p);
1205
- }
1206
- return {
1207
- width: l - p,
1208
- height: u - f,
1209
- x: p,
1210
- y: f
1211
- };
1212
- }
1213
- function Mo(e) {
1214
- const {
1215
- width: t,
1216
- height: n
1217
- } = pr(e);
1218
- return {
1219
- width: t,
1220
- height: n
1221
- };
1222
- }
1223
- function So(e, t, n) {
1224
- const r = re(t), o = Oe(t), s = n === "fixed", i = ze(e, !0, s, t);
1225
- let c = {
1226
- scrollLeft: 0,
1227
- scrollTop: 0
1228
- };
1229
- const f = Ee(0);
1230
- function l() {
1231
- f.x = Ft(o);
1232
- }
1233
- if (r || !r && !s)
1234
- if ((We(t) !== "body" || lt(o)) && (c = kt(t)), r) {
1235
- const a = ze(t, !0, s, t);
1236
- f.x = a.x + t.clientLeft, f.y = a.y + t.clientTop;
1237
- } else o && l();
1238
- s && !r && o && l();
1239
- const u = o && !r && !s ? hr(o, c) : Ee(0), p = i.left + c.scrollLeft - f.x - u.x, m = i.top + c.scrollTop - f.y - u.y;
1240
- return {
1241
- x: p,
1242
- y: m,
1243
- width: i.width,
1244
- height: i.height
1245
- };
1246
- }
1247
- function Bt(e) {
1248
- return we(e).position === "static";
1249
- }
1250
- function On(e, t) {
1251
- if (!re(e) || we(e).position === "fixed")
1252
- return null;
1253
- if (t)
1254
- return t(e);
1255
- let n = e.offsetParent;
1256
- return Oe(e) === n && (n = n.ownerDocument.body), n;
1257
- }
1258
- function br(e, t) {
1259
- const n = pe(e);
1260
- if (Dt(e))
1261
- return n;
1262
- if (!re(e)) {
1263
- let o = Pe(e);
1264
- for (; o && !Se(o); ) {
1265
- if (Y(o) && !Bt(o))
1266
- return o;
1267
- o = Pe(o);
1268
- }
1269
- return n;
1270
- }
1271
- let r = On(e, t);
1272
- for (; r && Fr(r) && Bt(r); )
1273
- r = On(r, t);
1274
- return r && Se(r) && Bt(r) && !on(r) ? n : r || Wr(e) || n;
1275
- }
1276
- const Po = async function(e) {
1277
- const t = this.getOffsetParent || br, n = this.getDimensions, r = await n(e.floating);
1278
- return {
1279
- reference: So(e.reference, await t(e.floating), e.strategy),
1280
- floating: {
1281
- x: 0,
1282
- y: 0,
1283
- width: r.width,
1284
- height: r.height
1285
- }
1286
- };
1287
- };
1288
- function Do(e) {
1289
- return we(e).direction === "rtl";
1290
- }
1291
- const Lo = {
1292
- convertOffsetParentRelativeRectToViewportRelativeRect: Ro,
1293
- getDocumentElement: Oe,
1294
- getClippingRect: Ao,
1295
- getOffsetParent: br,
1296
- getElementRects: Po,
1297
- getClientRects: Eo,
1298
- getDimensions: Mo,
1299
- getScale: Ye,
1300
- isElement: Y,
1301
- isRTL: Do
1302
- };
1303
- function yr(e, t) {
1304
- return e.x === t.x && e.y === t.y && e.width === t.width && e.height === t.height;
1305
- }
1306
- function ko(e, t) {
1307
- let n = null, r;
1308
- const o = Oe(e);
1309
- function s() {
1310
- var c;
1311
- clearTimeout(r), (c = n) == null || c.disconnect(), n = null;
1312
- }
1313
- function i(c, f) {
1314
- c === void 0 && (c = !1), f === void 0 && (f = 1), s();
1315
- const l = e.getBoundingClientRect(), {
1316
- left: u,
1317
- top: p,
1318
- width: m,
1319
- height: a
1320
- } = l;
1321
- if (c || t(), !m || !a)
1322
- return;
1323
- const v = qe(p), g = qe(o.clientWidth - (u + m)), w = qe(o.clientHeight - (p + a)), x = qe(u), y = {
1324
- rootMargin: -v + "px " + -g + "px " + -w + "px " + -x + "px",
1325
- threshold: he(0, Qe(1, f)) || 1
1326
- };
1327
- let C = !0;
1328
- function D(P) {
1329
- const N = P[0].intersectionRatio;
1330
- if (N !== f) {
1331
- if (!C)
1332
- return i();
1333
- N ? i(!1, N) : r = setTimeout(() => {
1334
- i(!1, 1e-7);
1335
- }, 1e3);
1336
- }
1337
- N === 1 && !yr(l, e.getBoundingClientRect()) && i(), C = !1;
1338
- }
1339
- try {
1340
- n = new IntersectionObserver(D, {
1341
- ...y,
1342
- // Handle <iframe>s
1343
- root: o.ownerDocument
1344
- });
1345
- } catch {
1346
- n = new IntersectionObserver(D, y);
1347
- }
1348
- n.observe(e);
1349
- }
1350
- return i(!0), s;
1351
- }
1352
- function wi(e, t, n, r) {
1353
- r === void 0 && (r = {});
1354
- const {
1355
- ancestorScroll: o = !0,
1356
- ancestorResize: s = !0,
1357
- elementResize: i = typeof ResizeObserver == "function",
1358
- layoutShift: c = typeof IntersectionObserver == "function",
1359
- animationFrame: f = !1
1360
- } = r, l = un(e), u = o || s ? [...l ? ke(l) : [], ...t ? ke(t) : []] : [];
1361
- u.forEach((x) => {
1362
- o && x.addEventListener("scroll", n, {
1363
- passive: !0
1364
- }), s && x.addEventListener("resize", n);
1365
- });
1366
- const p = l && c ? ko(l, n) : null;
1367
- let m = -1, a = null;
1368
- i && (a = new ResizeObserver((x) => {
1369
- let [b] = x;
1370
- b && b.target === l && a && t && (a.unobserve(t), cancelAnimationFrame(m), m = requestAnimationFrame(() => {
1371
- var y;
1372
- (y = a) == null || y.observe(t);
1373
- })), n();
1374
- }), l && !f && a.observe(l), t && a.observe(t));
1375
- let v, g = f ? ze(e) : null;
1376
- f && w();
1377
- function w() {
1378
- const x = ze(e);
1379
- g && !yr(g, x) && n(), g = x, v = requestAnimationFrame(w);
1380
- }
1381
- return n(), () => {
1382
- var x;
1383
- u.forEach((b) => {
1384
- o && b.removeEventListener("scroll", n), s && b.removeEventListener("resize", n);
1385
- }), p?.(), (x = a) == null || x.disconnect(), a = null, f && cancelAnimationFrame(v);
1386
- };
1387
- }
1388
- const Fo = vo, No = mo, _o = bo, Wo = po, Ko = yo, $o = (e, t, n) => {
1389
- const r = /* @__PURE__ */ new Map(), o = {
1390
- platform: Lo,
1391
- ...n
1392
- }, s = {
1393
- ...o.platform,
1394
- _c: r
1395
- };
1396
- return ao(e, t, {
1397
- ...o,
1398
- platform: s
1399
- });
1400
- };
1401
- var Vo = typeof document < "u", Bo = function() {
1402
- }, xt = Vo ? qn : Bo;
1403
- function At(e, t) {
1404
- if (e === t)
1405
- return !0;
1406
- if (typeof e != typeof t)
1407
- return !1;
1408
- if (typeof e == "function" && e.toString() === t.toString())
1409
- return !0;
1410
- let n, r, o;
1411
- if (e && t && typeof e == "object") {
1412
- if (Array.isArray(e)) {
1413
- if (n = e.length, n !== t.length) return !1;
1414
- for (r = n; r-- !== 0; )
1415
- if (!At(e[r], t[r]))
1416
- return !1;
1417
- return !0;
1418
- }
1419
- if (o = Object.keys(e), n = o.length, n !== Object.keys(t).length)
1420
- return !1;
1421
- for (r = n; r-- !== 0; )
1422
- if (!{}.hasOwnProperty.call(t, o[r]))
1423
- return !1;
1424
- for (r = n; r-- !== 0; ) {
1425
- const s = o[r];
1426
- if (!(s === "_owner" && e.$$typeof) && !At(e[s], t[s]))
1427
- return !1;
1428
- }
1429
- return !0;
1430
- }
1431
- return e !== e && t !== t;
1432
- }
1433
- function wr(e) {
1434
- return typeof window > "u" ? 1 : (e.ownerDocument.defaultView || window).devicePixelRatio || 1;
1435
- }
1436
- function Tn(e, t) {
1437
- const n = wr(e);
1438
- return Math.round(t * n) / n;
1439
- }
1440
- function Ht(e) {
1441
- const t = d.useRef(e);
1442
- return xt(() => {
1443
- t.current = e;
1444
- }), t;
1445
- }
1446
- function Ho(e) {
1447
- e === void 0 && (e = {});
1448
- const {
1449
- placement: t = "bottom",
1450
- strategy: n = "absolute",
1451
- middleware: r = [],
1452
- platform: o,
1453
- elements: {
1454
- reference: s,
1455
- floating: i
1456
- } = {},
1457
- transform: c = !0,
1458
- whileElementsMounted: f,
1459
- open: l
1460
- } = e, [u, p] = d.useState({
1461
- x: 0,
1462
- y: 0,
1463
- strategy: n,
1464
- placement: t,
1465
- middlewareData: {},
1466
- isPositioned: !1
1467
- }), [m, a] = d.useState(r);
1468
- At(m, r) || a(r);
1469
- const [v, g] = d.useState(null), [w, x] = d.useState(null), b = d.useCallback((h) => {
1470
- h !== P.current && (P.current = h, g(h));
1471
- }, []), y = d.useCallback((h) => {
1472
- h !== N.current && (N.current = h, x(h));
1473
- }, []), C = s || v, D = i || w, P = d.useRef(null), N = d.useRef(null), S = d.useRef(u), K = f != null, k = Ht(f), _ = Ht(o), G = Ht(l), W = d.useCallback(() => {
1474
- if (!P.current || !N.current)
1475
- return;
1476
- const h = {
1477
- placement: t,
1478
- strategy: n,
1479
- middleware: m
1480
- };
1481
- _.current && (h.platform = _.current), $o(P.current, N.current, h).then((I) => {
1482
- const L = {
1483
- ...I,
1484
- // The floating element's position may be recomputed while it's closed
1485
- // but still mounted (such as when transitioning out). To ensure
1486
- // `isPositioned` will be `false` initially on the next open, avoid
1487
- // setting it to `true` when `open === false` (must be specified).
1488
- isPositioned: G.current !== !1
1489
- };
1490
- R.current && !At(S.current, L) && (S.current = L, nn.flushSync(() => {
1491
- p(L);
1492
- }));
1493
- });
1494
- }, [m, t, n, _, G]);
1495
- xt(() => {
1496
- l === !1 && S.current.isPositioned && (S.current.isPositioned = !1, p((h) => ({
1497
- ...h,
1498
- isPositioned: !1
1499
- })));
1500
- }, [l]);
1501
- const R = d.useRef(!1);
1502
- xt(() => (R.current = !0, () => {
1503
- R.current = !1;
1504
- }), []), xt(() => {
1505
- if (C && (P.current = C), D && (N.current = D), C && D) {
1506
- if (k.current)
1507
- return k.current(C, D, W);
1508
- W();
1509
- }
1510
- }, [C, D, W, k, K]);
1511
- const E = d.useMemo(() => ({
1512
- reference: P,
1513
- floating: N,
1514
- setReference: b,
1515
- setFloating: y
1516
- }), [b, y]), V = d.useMemo(() => ({
1517
- reference: C,
1518
- floating: D
1519
- }), [C, D]), O = d.useMemo(() => {
1520
- const h = {
1521
- position: n,
1522
- left: 0,
1523
- top: 0
1524
- };
1525
- if (!V.floating)
1526
- return h;
1527
- const I = Tn(V.floating, u.x), L = Tn(V.floating, u.y);
1528
- return c ? {
1529
- ...h,
1530
- transform: "translate(" + I + "px, " + L + "px)",
1531
- ...wr(V.floating) >= 1.5 && {
1532
- willChange: "transform"
1533
- }
1534
- } : {
1535
- position: n,
1536
- left: I,
1537
- top: L
1538
- };
1539
- }, [n, c, V.floating, u.x, u.y]);
1540
- return d.useMemo(() => ({
1541
- ...u,
1542
- update: W,
1543
- refs: E,
1544
- elements: V,
1545
- floatingStyles: O
1546
- }), [u, W, E, V, O]);
1547
- }
1548
- const xi = (e, t) => {
1549
- const n = Fo(e);
1550
- return {
1551
- name: n.name,
1552
- fn: n.fn,
1553
- options: [e, t]
1554
- };
1555
- }, Ri = (e, t) => {
1556
- const n = _o(e);
1557
- return {
1558
- name: n.name,
1559
- fn: n.fn,
1560
- options: [e, t]
1561
- };
1562
- }, Ei = (e, t) => {
1563
- const n = Wo(e);
1564
- return {
1565
- name: n.name,
1566
- fn: n.fn,
1567
- options: [e, t]
1568
- };
1569
- }, Ci = (e, t) => {
1570
- const n = Ko(e);
1571
- return {
1572
- name: n.name,
1573
- fn: n.fn,
1574
- options: [e, t]
1575
- };
1576
- }, Ii = (e, t) => {
1577
- const n = No(e);
1578
- return {
1579
- name: n.name,
1580
- fn: n.fn,
1581
- options: [e, t]
1582
- };
1583
- };
1584
- function zo(e) {
1585
- const t = d.useRef(void 0), n = d.useCallback((r) => {
1586
- const o = e.map((s) => {
1587
- if (s != null) {
1588
- if (typeof s == "function") {
1589
- const i = s, c = i(r);
1590
- return typeof c == "function" ? c : () => {
1591
- i(null);
1592
- };
1593
- }
1594
- return s.current = r, () => {
1595
- s.current = null;
1596
- };
1597
- }
1598
- });
1599
- return () => {
1600
- o.forEach((s) => s?.());
1601
- };
1602
- }, e);
1603
- return d.useMemo(() => e.every((r) => r == null) ? null : (r) => {
1604
- t.current && (t.current(), t.current = void 0), r != null && (t.current = n(r));
1605
- }, e);
1606
- }
1607
- function Uo(e, t) {
1608
- const n = e.compareDocumentPosition(t);
1609
- return n & Node.DOCUMENT_POSITION_FOLLOWING || n & Node.DOCUMENT_POSITION_CONTAINED_BY ? -1 : n & Node.DOCUMENT_POSITION_PRECEDING || n & Node.DOCUMENT_POSITION_CONTAINS ? 1 : 0;
1610
- }
1611
- const xr = /* @__PURE__ */ d.createContext({
1612
- register: () => {
1613
- },
1614
- unregister: () => {
1615
- },
1616
- map: /* @__PURE__ */ new Map(),
1617
- elementsRef: {
1618
- current: []
1619
- }
1620
- });
1621
- function Go(e) {
1622
- const {
1623
- children: t,
1624
- elementsRef: n,
1625
- labelsRef: r
1626
- } = e, [o, s] = d.useState(() => /* @__PURE__ */ new Set()), i = d.useCallback((l) => {
1627
- s((u) => new Set(u).add(l));
1628
- }, []), c = d.useCallback((l) => {
1629
- s((u) => {
1630
- const p = new Set(u);
1631
- return p.delete(l), p;
1632
- });
1633
- }, []), f = d.useMemo(() => {
1634
- const l = /* @__PURE__ */ new Map();
1635
- return Array.from(o.keys()).sort(Uo).forEach((p, m) => {
1636
- l.set(p, m);
1637
- }), l;
1638
- }, [o]);
1639
- return /* @__PURE__ */ me(xr.Provider, {
1640
- value: d.useMemo(() => ({
1641
- register: i,
1642
- unregister: c,
1643
- map: f,
1644
- elementsRef: n,
1645
- labelsRef: r
1646
- }), [i, c, f, n, r]),
1647
- children: t
1648
- });
1649
- }
1650
- function jo(e) {
1651
- e === void 0 && (e = {});
1652
- const {
1653
- label: t
1654
- } = e, {
1655
- register: n,
1656
- unregister: r,
1657
- map: o,
1658
- elementsRef: s,
1659
- labelsRef: i
1660
- } = d.useContext(xr), [c, f] = d.useState(null), l = d.useRef(null), u = d.useCallback((p) => {
1661
- if (l.current = p, c !== null && (s.current[c] = p, i)) {
1662
- var m;
1663
- const a = t !== void 0;
1664
- i.current[c] = a ? t : (m = p?.textContent) != null ? m : null;
1665
- }
1666
- }, [c, s, i, t]);
1667
- return X(() => {
1668
- const p = l.current;
1669
- if (p)
1670
- return n(p), () => {
1671
- r(p);
1672
- };
1673
- }, [n, r]), X(() => {
1674
- const p = l.current ? o.get(l.current) : null;
1675
- p != null && f(p);
1676
- }, [o]), d.useMemo(() => ({
1677
- ref: u,
1678
- index: c ?? -1
1679
- }), [c, u]);
1680
- }
1681
- const qo = "data-floating-ui-focusable", An = "active", Mn = "selected", Ne = "ArrowLeft", _e = "ArrowRight", ct = "ArrowUp", Fe = "ArrowDown";
1682
- function Rr(e, t) {
1683
- return typeof e == "function" ? e(t) : e ? /* @__PURE__ */ d.cloneElement(e, t) : /* @__PURE__ */ me("div", {
1684
- ...t
1685
- });
1686
- }
1687
- const Er = /* @__PURE__ */ d.createContext({
1688
- activeIndex: 0,
1689
- onNavigate: () => {
1690
- }
1691
- }), Cr = [Ne, _e], Ir = [ct, Fe], zt = [...Cr, ...Ir], Oi = /* @__PURE__ */ d.forwardRef(function(t, n) {
1692
- const {
1693
- render: r,
1694
- orientation: o = "both",
1695
- loop: s = !0,
1696
- rtl: i = !1,
1697
- cols: c = 1,
1698
- disabledIndices: f,
1699
- activeIndex: l,
1700
- onNavigate: u,
1701
- itemSizes: p,
1702
- dense: m = !1,
1703
- ...a
1704
- } = t, [v, g] = d.useState(0), w = l ?? v, x = ie(u ?? g), b = d.useRef([]), y = r && typeof r != "function" ? r.props : {}, C = d.useMemo(() => ({
1705
- activeIndex: w,
1706
- onNavigate: x
1707
- }), [w, x]), D = c > 1;
1708
- function P(S) {
1709
- if (!zt.includes(S.key)) return;
1710
- let K = w;
1711
- const k = wt(b, f), _ = tn(b, f), G = i ? Ne : _e, W = i ? _e : Ne;
1712
- if (D) {
1713
- const h = p || Array.from({
1714
- length: b.current.length
1715
- }, () => ({
1716
- width: 1,
1717
- height: 1
1718
- })), I = ur(h, c, m), L = I.findIndex((T) => T != null && !He(b, T, f)), ee = I.reduce((T, J, j) => J != null && !He(b, J, f) ? j : T, -1), F = I[cr({
1719
- current: I.map((T) => T ? b.current[T] : null)
1720
- }, {
1721
- event: S,
1722
- orientation: o,
1723
- loop: s,
1724
- rtl: i,
1725
- cols: c,
1726
- // treat undefined (empty grid spaces) as disabled indices so we
1727
- // don't end up in them
1728
- disabledIndices: ar([...(typeof f != "function" ? f : null) || b.current.map((T, J) => He(b, J, f) ? J : void 0), void 0], I),
1729
- minIndex: L,
1730
- maxIndex: ee,
1731
- prevIndex: lr(
1732
- w > _ ? k : w,
1733
- h,
1734
- I,
1735
- c,
1736
- // use a corner matching the edge closest to the direction we're
1737
- // moving in so we don't end up in the same item. Prefer
1738
- // top/left over bottom/right.
1739
- S.key === Fe ? "bl" : S.key === G ? "tr" : "tl"
1740
- )
1741
- })];
1742
- F != null && (K = F);
1743
- }
1744
- const R = {
1745
- horizontal: [G],
1746
- vertical: [Fe],
1747
- both: [G, Fe]
1748
- }[o], E = {
1749
- horizontal: [W],
1750
- vertical: [ct],
1751
- both: [W, ct]
1752
- }[o], V = D ? zt : {
1753
- horizontal: Cr,
1754
- vertical: Ir,
1755
- both: zt
1756
- }[o];
1757
- if (K === w && [...R, ...E].includes(S.key) && (s && K === _ && R.includes(S.key) ? K = k : s && K === k && E.includes(S.key) ? K = _ : K = ue(b, {
1758
- startingIndex: K,
1759
- decrement: E.includes(S.key),
1760
- disabledIndices: f
1761
- })), K !== w && !Xe(b, K)) {
1762
- var O;
1763
- S.stopPropagation(), V.includes(S.key) && S.preventDefault(), x(K), (O = b.current[K]) == null || O.focus();
1764
- }
1765
- }
1766
- const N = {
1767
- ...a,
1768
- ...y,
1769
- ref: n,
1770
- "aria-orientation": o === "both" ? void 0 : o,
1771
- onKeyDown(S) {
1772
- a.onKeyDown == null || a.onKeyDown(S), y.onKeyDown == null || y.onKeyDown(S), P(S);
1773
- }
1774
- };
1775
- return /* @__PURE__ */ me(Er.Provider, {
1776
- value: C,
1777
- children: /* @__PURE__ */ me(Go, {
1778
- elementsRef: b,
1779
- children: Rr(r, N)
1780
- })
1781
- });
1782
- }), Ti = /* @__PURE__ */ d.forwardRef(function(t, n) {
1783
- const {
1784
- render: r,
1785
- ...o
1786
- } = t, s = r && typeof r != "function" ? r.props : {}, {
1787
- activeIndex: i,
1788
- onNavigate: c
1789
- } = d.useContext(Er), {
1790
- ref: f,
1791
- index: l
1792
- } = jo(), u = zo([f, n, s.ref]), p = i === l, m = {
1793
- ...o,
1794
- ...s,
1795
- ref: u,
1796
- tabIndex: p ? 0 : -1,
1797
- "data-active": p ? "" : void 0,
1798
- onFocus(a) {
1799
- o.onFocus == null || o.onFocus(a), s.onFocus == null || s.onFocus(a), c(l);
1800
- }
1801
- };
1802
- return Rr(r, m);
1803
- }), Xo = {
1804
- ...d
1805
- };
1806
- let Sn = !1, Yo = 0;
1807
- const Pn = () => (
1808
- // Ensure the id is unique with multiple independent versions of Floating UI
1809
- // on <React 18
1810
- "floating-ui-" + Math.random().toString(36).slice(2, 6) + Yo++
1811
- );
1812
- function Jo() {
1813
- const [e, t] = d.useState(() => Sn ? Pn() : void 0);
1814
- return X(() => {
1815
- e == null && t(Pn());
1816
- }, []), d.useEffect(() => {
1817
- Sn = !0;
1818
- }, []), e;
1819
- }
1820
- const Qo = Xo.useId, Nt = Qo || Jo;
1821
- let ut;
1822
- process.env.NODE_ENV !== "production" && (ut = /* @__PURE__ */ new Set());
1823
- function Ut() {
1824
- for (var e, t = arguments.length, n = new Array(t), r = 0; r < t; r++)
1825
- n[r] = arguments[r];
1826
- const o = "Floating UI: " + n.join(" ");
1827
- if (!((e = ut) != null && e.has(o))) {
1828
- var s;
1829
- (s = ut) == null || s.add(o), console.warn(o);
1830
- }
1831
- }
1832
- function Zo() {
1833
- for (var e, t = arguments.length, n = new Array(t), r = 0; r < t; r++)
1834
- n[r] = arguments[r];
1835
- const o = "Floating UI: " + n.join(" ");
1836
- if (!((e = ut) != null && e.has(o))) {
1837
- var s;
1838
- (s = ut) == null || s.add(o), console.error(o);
1839
- }
1840
- }
1841
- function Or() {
1842
- const e = /* @__PURE__ */ new Map();
1843
- return {
1844
- emit(t, n) {
1845
- var r;
1846
- (r = e.get(t)) == null || r.forEach((o) => o(n));
1847
- },
1848
- on(t, n) {
1849
- e.has(t) || e.set(t, /* @__PURE__ */ new Set()), e.get(t).add(n);
1850
- },
1851
- off(t, n) {
1852
- var r;
1853
- (r = e.get(t)) == null || r.delete(n);
1854
- }
1855
- };
1856
- }
1857
- const Tr = /* @__PURE__ */ d.createContext(null), Ar = /* @__PURE__ */ d.createContext(null), et = () => {
1858
- var e;
1859
- return ((e = d.useContext(Tr)) == null ? void 0 : e.id) || null;
1860
- }, tt = () => d.useContext(Ar);
1861
- function Ai(e) {
1862
- const t = Nt(), n = tt(), o = et();
1863
- return X(() => {
1864
- if (!t) return;
1865
- const s = {
1866
- id: t,
1867
- parentId: o
1868
- };
1869
- return n?.addNode(s), () => {
1870
- n?.removeNode(s);
1871
- };
1872
- }, [n, t, o]), t;
1873
- }
1874
- function Mi(e) {
1875
- const {
1876
- children: t,
1877
- id: n
1878
- } = e, r = et();
1879
- return /* @__PURE__ */ me(Tr.Provider, {
1880
- value: d.useMemo(() => ({
1881
- id: n,
1882
- parentId: r
1883
- }), [n, r]),
1884
- children: t
1885
- });
1886
- }
1887
- function Si(e) {
1888
- const {
1889
- children: t
1890
- } = e, n = d.useRef([]), r = d.useCallback((i) => {
1891
- n.current = [...n.current, i];
1892
- }, []), o = d.useCallback((i) => {
1893
- n.current = n.current.filter((c) => c !== i);
1894
- }, []), [s] = d.useState(() => Or());
1895
- return /* @__PURE__ */ me(Ar.Provider, {
1896
- value: d.useMemo(() => ({
1897
- nodesRef: n,
1898
- addNode: r,
1899
- removeNode: o,
1900
- events: s
1901
- }), [r, o, s]),
1902
- children: t
1903
- });
1904
- }
1905
- function Ue(e) {
1906
- return "data-floating-ui-" + e;
1907
- }
1908
- function ge(e) {
1909
- e.current !== -1 && (clearTimeout(e.current), e.current = -1);
1910
- }
1911
- const Dn = /* @__PURE__ */ Ue("safe-polygon");
1912
- function Gt(e, t, n) {
1913
- if (n && !st(n))
1914
- return 0;
1915
- if (typeof e == "number")
1916
- return e;
1917
- if (typeof e == "function") {
1918
- const r = e();
1919
- return typeof r == "number" ? r : r?.[t];
1920
- }
1921
- return e?.[t];
1922
- }
1923
- function jt(e) {
1924
- return typeof e == "function" ? e() : e;
1925
- }
1926
- function Pi(e, t) {
1927
- t === void 0 && (t = {});
1928
- const {
1929
- open: n,
1930
- onOpenChange: r,
1931
- dataRef: o,
1932
- events: s,
1933
- elements: i
1934
- } = e, {
1935
- enabled: c = !0,
1936
- delay: f = 0,
1937
- handleClose: l = null,
1938
- mouseOnly: u = !1,
1939
- restMs: p = 0,
1940
- move: m = !0
1941
- } = t, a = tt(), v = et(), g = ye(l), w = ye(f), x = ye(n), b = ye(p), y = d.useRef(), C = d.useRef(-1), D = d.useRef(), P = d.useRef(-1), N = d.useRef(!0), S = d.useRef(!1), K = d.useRef(() => {
1942
- }), k = d.useRef(!1), _ = ie(() => {
1943
- var O;
1944
- const h = (O = o.current.openEvent) == null ? void 0 : O.type;
1945
- return h?.includes("mouse") && h !== "mousedown";
1946
- });
1947
- d.useEffect(() => {
1948
- if (!c) return;
1949
- function O(h) {
1950
- let {
1951
- open: I
1952
- } = h;
1953
- I || (ge(C), ge(P), N.current = !0, k.current = !1);
1954
- }
1955
- return s.on("openchange", O), () => {
1956
- s.off("openchange", O);
1957
- };
1958
- }, [c, s]), d.useEffect(() => {
1959
- if (!c || !g.current || !n) return;
1960
- function O(I) {
1961
- _() && r(!1, I, "hover");
1962
- }
1963
- const h = le(i.floating).documentElement;
1964
- return h.addEventListener("mouseleave", O), () => {
1965
- h.removeEventListener("mouseleave", O);
1966
- };
1967
- }, [i.floating, n, r, c, g, _]);
1968
- const G = d.useCallback(function(O, h, I) {
1969
- h === void 0 && (h = !0), I === void 0 && (I = "hover");
1970
- const L = Gt(w.current, "close", y.current);
1971
- L && !D.current ? (ge(C), C.current = window.setTimeout(() => r(!1, O, I), L)) : h && (ge(C), r(!1, O, I));
1972
- }, [w, r]), W = ie(() => {
1973
- K.current(), D.current = void 0;
1974
- }), R = ie(() => {
1975
- if (S.current) {
1976
- const O = le(i.floating).body;
1977
- O.style.pointerEvents = "", O.removeAttribute(Dn), S.current = !1;
1978
- }
1979
- }), E = ie(() => o.current.openEvent ? ["click", "mousedown"].includes(o.current.openEvent.type) : !1);
1980
- d.useEffect(() => {
1981
- if (!c) return;
1982
- function O(F) {
1983
- if (ge(C), N.current = !1, u && !st(y.current) || jt(b.current) > 0 && !Gt(w.current, "open"))
1984
- return;
1985
- const T = Gt(w.current, "open", y.current);
1986
- T ? C.current = window.setTimeout(() => {
1987
- x.current || r(!0, F, "hover");
1988
- }, T) : n || r(!0, F, "hover");
1989
- }
1990
- function h(F) {
1991
- if (E()) {
1992
- R();
1993
- return;
1994
- }
1995
- K.current();
1996
- const T = le(i.floating);
1997
- if (ge(P), k.current = !1, g.current && o.current.floatingContext) {
1998
- n || ge(C), D.current = g.current({
1999
- ...o.current.floatingContext,
2000
- tree: a,
2001
- x: F.clientX,
2002
- y: F.clientY,
2003
- onClose() {
2004
- R(), W(), E() || G(F, !0, "safe-polygon");
2005
- }
2006
- });
2007
- const j = D.current;
2008
- T.addEventListener("mousemove", j), K.current = () => {
2009
- T.removeEventListener("mousemove", j);
2010
- };
2011
- return;
2012
- }
2013
- (y.current !== "touch" || !ce(i.floating, F.relatedTarget)) && G(F);
2014
- }
2015
- function I(F) {
2016
- E() || o.current.floatingContext && (g.current == null || g.current({
2017
- ...o.current.floatingContext,
2018
- tree: a,
2019
- x: F.clientX,
2020
- y: F.clientY,
2021
- onClose() {
2022
- R(), W(), E() || G(F);
2023
- }
2024
- })(F));
2025
- }
2026
- function L() {
2027
- ge(C);
2028
- }
2029
- function ee(F) {
2030
- E() || G(F, !1);
2031
- }
2032
- if (Y(i.domReference)) {
2033
- const F = i.domReference, T = i.floating;
2034
- return n && F.addEventListener("mouseleave", I), m && F.addEventListener("mousemove", O, {
2035
- once: !0
2036
- }), F.addEventListener("mouseenter", O), F.addEventListener("mouseleave", h), T && (T.addEventListener("mouseleave", I), T.addEventListener("mouseenter", L), T.addEventListener("mouseleave", ee)), () => {
2037
- n && F.removeEventListener("mouseleave", I), m && F.removeEventListener("mousemove", O), F.removeEventListener("mouseenter", O), F.removeEventListener("mouseleave", h), T && (T.removeEventListener("mouseleave", I), T.removeEventListener("mouseenter", L), T.removeEventListener("mouseleave", ee));
2038
- };
2039
- }
2040
- }, [i, c, e, u, m, G, W, R, r, n, x, a, w, g, o, E, b]), X(() => {
2041
- var O;
2042
- if (c && n && (O = g.current) != null && (O = O.__options) != null && O.blockPointerEvents && _()) {
2043
- S.current = !0;
2044
- const I = i.floating;
2045
- if (Y(i.domReference) && I) {
2046
- var h;
2047
- const L = le(i.floating).body;
2048
- L.setAttribute(Dn, "");
2049
- const ee = i.domReference, F = a == null || (h = a.nodesRef.current.find((T) => T.id === v)) == null || (h = h.context) == null ? void 0 : h.elements.floating;
2050
- return F && (F.style.pointerEvents = ""), L.style.pointerEvents = "none", ee.style.pointerEvents = "auto", I.style.pointerEvents = "auto", () => {
2051
- L.style.pointerEvents = "", ee.style.pointerEvents = "", I.style.pointerEvents = "";
2052
- };
2053
- }
2054
- }
2055
- }, [c, n, v, i, a, g, _]), X(() => {
2056
- n || (y.current = void 0, k.current = !1, W(), R());
2057
- }, [n, W, R]), d.useEffect(() => () => {
2058
- W(), ge(C), ge(P), R();
2059
- }, [c, i.domReference, W, R]);
2060
- const V = d.useMemo(() => {
2061
- function O(h) {
2062
- y.current = h.pointerType;
2063
- }
2064
- return {
2065
- onPointerDown: O,
2066
- onPointerEnter: O,
2067
- onMouseMove(h) {
2068
- const {
2069
- nativeEvent: I
2070
- } = h;
2071
- function L() {
2072
- !N.current && !x.current && r(!0, I, "hover");
2073
- }
2074
- u && !st(y.current) || n || jt(b.current) === 0 || k.current && h.movementX ** 2 + h.movementY ** 2 < 2 || (ge(P), y.current === "touch" ? L() : (k.current = !0, P.current = window.setTimeout(L, jt(b.current))));
2075
- }
2076
- };
2077
- }, [u, r, n, x, b]);
2078
- return d.useMemo(() => c ? {
2079
- reference: V
2080
- } : {}, [c, V]);
2081
- }
2082
- let Ln = 0;
2083
- function Ve(e, t) {
2084
- t === void 0 && (t = {});
2085
- const {
2086
- preventScroll: n = !1,
2087
- cancelPrevious: r = !0,
2088
- sync: o = !1
2089
- } = t;
2090
- r && cancelAnimationFrame(Ln);
2091
- const s = () => e?.focus({
2092
- preventScroll: n
2093
- });
2094
- o ? s() : Ln = requestAnimationFrame(s);
2095
- }
2096
- function ei(e) {
2097
- return e?.ownerDocument || document;
2098
- }
2099
- const Je = {
2100
- inert: /* @__PURE__ */ new WeakMap(),
2101
- "aria-hidden": /* @__PURE__ */ new WeakMap(),
2102
- none: /* @__PURE__ */ new WeakMap()
2103
- };
2104
- function kn(e) {
2105
- return e === "inert" ? Je.inert : e === "aria-hidden" ? Je["aria-hidden"] : Je.none;
2106
- }
2107
- let ht = /* @__PURE__ */ new WeakSet(), vt = {}, qt = 0;
2108
- const ti = () => typeof HTMLElement < "u" && "inert" in HTMLElement.prototype;
2109
- function Mr(e) {
2110
- return e ? Rt(e) ? e.host : Mr(e.parentNode) : null;
2111
- }
2112
- const ni = (e, t) => t.map((n) => {
2113
- if (e.contains(n))
2114
- return n;
2115
- const r = Mr(n);
2116
- return e.contains(r) ? r : null;
2117
- }).filter((n) => n != null);
2118
- function ri(e, t, n, r) {
2119
- const o = "data-floating-ui-inert", s = r ? "inert" : n ? "aria-hidden" : null, i = ni(t, e), c = /* @__PURE__ */ new Set(), f = new Set(i), l = [];
2120
- vt[o] || (vt[o] = /* @__PURE__ */ new WeakMap());
2121
- const u = vt[o];
2122
- i.forEach(p), m(t), c.clear();
2123
- function p(a) {
2124
- !a || c.has(a) || (c.add(a), a.parentNode && p(a.parentNode));
2125
- }
2126
- function m(a) {
2127
- !a || f.has(a) || [].forEach.call(a.children, (v) => {
2128
- if (We(v) !== "script")
2129
- if (c.has(v))
2130
- m(v);
2131
- else {
2132
- const g = s ? v.getAttribute(s) : null, w = g !== null && g !== "false", x = kn(s), b = (x.get(v) || 0) + 1, y = (u.get(v) || 0) + 1;
2133
- x.set(v, b), u.set(v, y), l.push(v), b === 1 && w && ht.add(v), y === 1 && v.setAttribute(o, ""), !w && s && v.setAttribute(s, s === "inert" ? "" : "true");
2134
- }
2135
- });
2136
- }
2137
- return qt++, () => {
2138
- l.forEach((a) => {
2139
- const v = kn(s), w = (v.get(a) || 0) - 1, x = (u.get(a) || 0) - 1;
2140
- v.set(a, w), u.set(a, x), w || (!ht.has(a) && s && a.removeAttribute(s), ht.delete(a)), x || a.removeAttribute(o);
2141
- }), qt--, qt || (Je.inert = /* @__PURE__ */ new WeakMap(), Je["aria-hidden"] = /* @__PURE__ */ new WeakMap(), Je.none = /* @__PURE__ */ new WeakMap(), ht = /* @__PURE__ */ new WeakSet(), vt = {});
2142
- };
2143
- }
2144
- function Fn(e, t, n) {
2145
- t === void 0 && (t = !1), n === void 0 && (n = !1);
2146
- const r = ei(e[0]).body;
2147
- return ri(e.concat(Array.from(r.querySelectorAll('[aria-live],[role="status"],output'))), r, t, n);
2148
- }
2149
- const ln = {
2150
- border: 0,
2151
- clip: "rect(0 0 0 0)",
2152
- height: "1px",
2153
- margin: "-1px",
2154
- overflow: "hidden",
2155
- padding: 0,
2156
- position: "fixed",
2157
- whiteSpace: "nowrap",
2158
- width: "1px",
2159
- top: 0,
2160
- left: 0
2161
- }, Mt = /* @__PURE__ */ d.forwardRef(function(t, n) {
2162
- const [r, o] = d.useState();
2163
- X(() => {
2164
- rr() && o("button");
2165
- }, []);
2166
- const s = {
2167
- ref: n,
2168
- tabIndex: 0,
2169
- // Role is only for VoiceOver
2170
- role: r,
2171
- "aria-hidden": r ? void 0 : !0,
2172
- [Ue("focus-guard")]: "",
2173
- style: ln
2174
- };
2175
- return /* @__PURE__ */ me("span", {
2176
- ...t,
2177
- ...s
2178
- });
2179
- }), oi = {
2180
- clipPath: "inset(50%)",
2181
- position: "fixed",
2182
- top: 0,
2183
- left: 0
2184
- }, Sr = /* @__PURE__ */ d.createContext(null), Nn = /* @__PURE__ */ Ue("portal");
2185
- function ii(e) {
2186
- e === void 0 && (e = {});
2187
- const {
2188
- id: t,
2189
- root: n
2190
- } = e, r = Nt(), o = Pr(), [s, i] = d.useState(null), c = d.useRef(null);
2191
- return X(() => () => {
2192
- s?.remove(), queueMicrotask(() => {
2193
- c.current = null;
2194
- });
2195
- }, [s]), X(() => {
2196
- if (!r || c.current) return;
2197
- const f = t ? document.getElementById(t) : null;
2198
- if (!f) return;
2199
- const l = document.createElement("div");
2200
- l.id = r, l.setAttribute(Nn, ""), f.appendChild(l), c.current = l, i(l);
2201
- }, [t, r]), X(() => {
2202
- if (n === null || !r || c.current) return;
2203
- let f = n || o?.portalNode;
2204
- f && !rn(f) && (f = f.current), f = f || document.body;
2205
- let l = null;
2206
- t && (l = document.createElement("div"), l.id = t, f.appendChild(l));
2207
- const u = document.createElement("div");
2208
- u.id = r, u.setAttribute(Nn, ""), f = l || f, f.appendChild(u), c.current = u, i(u);
2209
- }, [t, n, r, o]), s;
2210
- }
2211
- function Di(e) {
2212
- const {
2213
- children: t,
2214
- id: n,
2215
- root: r,
2216
- preserveTabOrder: o = !0
2217
- } = e, s = ii({
2218
- id: n,
2219
- root: r
2220
- }), [i, c] = d.useState(null), f = d.useRef(null), l = d.useRef(null), u = d.useRef(null), p = d.useRef(null), m = i?.modal, a = i?.open, v = (
2221
- // The FocusManager and therefore floating element are currently open/
2222
- // rendered.
2223
- !!i && // Guards are only for non-modal focus management.
2224
- !i.modal && // Don't render if unmount is transitioning.
2225
- i.open && o && !!(r || s)
2226
- );
2227
- return d.useEffect(() => {
2228
- if (!s || !o || m)
2229
- return;
2230
- function g(w) {
2231
- s && it(w) && (w.type === "focusin" ? Rn : co)(s);
2232
- }
2233
- return s.addEventListener("focusin", g, !0), s.addEventListener("focusout", g, !0), () => {
2234
- s.removeEventListener("focusin", g, !0), s.removeEventListener("focusout", g, !0);
2235
- };
2236
- }, [s, o, m]), d.useEffect(() => {
2237
- s && (a || Rn(s));
2238
- }, [a, s]), /* @__PURE__ */ Yn(Sr.Provider, {
2239
- value: d.useMemo(() => ({
2240
- preserveTabOrder: o,
2241
- beforeOutsideRef: f,
2242
- afterOutsideRef: l,
2243
- beforeInsideRef: u,
2244
- afterInsideRef: p,
2245
- portalNode: s,
2246
- setFocusManagerState: c
2247
- }), [o, s]),
2248
- children: [v && s && /* @__PURE__ */ me(Mt, {
2249
- "data-type": "outside",
2250
- ref: f,
2251
- onFocus: (g) => {
2252
- if (it(g, s)) {
2253
- var w;
2254
- (w = u.current) == null || w.focus();
2255
- } else {
2256
- const x = i ? i.domReference : null, b = mr(x);
2257
- b?.focus();
2258
- }
2259
- }
2260
- }), v && s && /* @__PURE__ */ me("span", {
2261
- "aria-owns": s.id,
2262
- style: oi
2263
- }), s && /* @__PURE__ */ nn.createPortal(t, s), v && s && /* @__PURE__ */ me(Mt, {
2264
- "data-type": "outside",
2265
- ref: l,
2266
- onFocus: (g) => {
2267
- if (it(g, s)) {
2268
- var w;
2269
- (w = p.current) == null || w.focus();
2270
- } else {
2271
- const x = i ? i.domReference : null, b = dr(x);
2272
- b?.focus(), i?.closeOnFocusOut && i?.onOpenChange(!1, g.nativeEvent, "focus-out");
2273
- }
2274
- }
2275
- })]
2276
- });
2277
- }
2278
- const Pr = () => d.useContext(Sr);
2279
- function _n(e) {
2280
- return d.useMemo(() => (t) => {
2281
- e.forEach((n) => {
2282
- n && (n.current = t);
2283
- });
2284
- }, e);
2285
- }
2286
- const Wn = 20;
2287
- let Le = [];
2288
- function an() {
2289
- Le = Le.filter((e) => {
2290
- var t;
2291
- return (t = e.deref()) == null ? void 0 : t.isConnected;
2292
- });
2293
- }
2294
- function si(e) {
2295
- an(), e && We(e) !== "body" && (Le.push(new WeakRef(e)), Le.length > Wn && (Le = Le.slice(-Wn)));
2296
- }
2297
- function Kn() {
2298
- an();
2299
- const e = Le[Le.length - 1];
2300
- return e?.deref();
2301
- }
2302
- function ci(e) {
2303
- const t = at();
2304
- return Xn(e, t) ? e : St(e, t)[0] || e;
2305
- }
2306
- function $n(e, t) {
2307
- var n;
2308
- if (!t.current.includes("floating") && !((n = e.getAttribute("role")) != null && n.includes("dialog")))
2309
- return;
2310
- const r = at(), s = Lr(e, r).filter((c) => {
2311
- const f = c.getAttribute("data-tabindex") || "";
2312
- return Xn(c, r) || c.hasAttribute("data-tabindex") && !f.startsWith("-");
2313
- }), i = e.getAttribute("tabindex");
2314
- t.current.includes("floating") || s.length === 0 ? i !== "0" && e.setAttribute("tabindex", "0") : (i !== "-1" || e.hasAttribute("data-tabindex") && e.getAttribute("data-tabindex") !== "-1") && (e.setAttribute("tabindex", "-1"), e.setAttribute("data-tabindex", "-1"));
2315
- }
2316
- const ui = /* @__PURE__ */ d.forwardRef(function(t, n) {
2317
- return /* @__PURE__ */ me("button", {
2318
- ...t,
2319
- type: "button",
2320
- ref: n,
2321
- tabIndex: -1,
2322
- style: ln
2323
- });
2324
- });
2325
- function Li(e) {
2326
- const {
2327
- context: t,
2328
- children: n,
2329
- disabled: r = !1,
2330
- order: o = ["content"],
2331
- guards: s = !0,
2332
- initialFocus: i = 0,
2333
- returnFocus: c = !0,
2334
- restoreFocus: f = !1,
2335
- modal: l = !0,
2336
- visuallyHiddenDismiss: u = !1,
2337
- closeOnFocusOut: p = !0,
2338
- outsideElementsInert: m = !1,
2339
- getInsideElements: a = () => []
2340
- } = e, {
2341
- open: v,
2342
- onOpenChange: g,
2343
- events: w,
2344
- dataRef: x,
2345
- elements: {
2346
- domReference: b,
2347
- floating: y
2348
- }
2349
- } = t, C = ie(() => {
2350
- var $;
2351
- return ($ = x.current.floatingContext) == null ? void 0 : $.nodeId;
2352
- }), D = ie(a), P = typeof i == "number" && i < 0, N = en(b) && P, S = ti(), K = S ? s : !0, k = !K || S && m, _ = ye(o), G = ye(i), W = ye(c), R = tt(), E = Pr(), V = d.useRef(null), O = d.useRef(null), h = d.useRef(!1), I = d.useRef(!1), L = d.useRef(-1), ee = d.useRef(-1), F = E != null, T = Tt(y), J = ie(function($) {
2353
- return $ === void 0 && ($ = T), $ ? St($, at()) : [];
2354
- }), j = ie(($) => {
2355
- const z = J($);
2356
- return _.current.map((B) => b && B === "reference" ? b : T && B === "floating" ? T : z).filter(Boolean).flat();
2357
- });
2358
- d.useEffect(() => {
2359
- if (r || !l) return;
2360
- function $(B) {
2361
- if (B.key === "Tab") {
2362
- ce(T, Re(le(T))) && J().length === 0 && !N && de(B);
2363
- const Q = j(), te = Ae(B);
2364
- _.current[0] === "reference" && te === b && (de(B), B.shiftKey ? Ve(Q[Q.length - 1]) : Ve(Q[1])), _.current[1] === "floating" && te === T && B.shiftKey && (de(B), Ve(Q[0]));
2365
- }
2366
- }
2367
- const z = le(T);
2368
- return z.addEventListener("keydown", $), () => {
2369
- z.removeEventListener("keydown", $);
2370
- };
2371
- }, [r, b, T, l, _, N, J, j]), d.useEffect(() => {
2372
- if (r || !y) return;
2373
- function $(z) {
2374
- const B = Ae(z), te = J().indexOf(B);
2375
- te !== -1 && (L.current = te);
2376
- }
2377
- return y.addEventListener("focusin", $), () => {
2378
- y.removeEventListener("focusin", $);
2379
- };
2380
- }, [r, y, J]), d.useEffect(() => {
2381
- if (r || !p) return;
2382
- function $() {
2383
- I.current = !0, setTimeout(() => {
2384
- I.current = !1;
2385
- });
2386
- }
2387
- function z(te) {
2388
- const U = te.relatedTarget, fe = te.currentTarget, se = Ae(te);
2389
- queueMicrotask(() => {
2390
- const ae = C(), xe = !(ce(b, U) || ce(y, U) || ce(U, y) || ce(E?.portalNode, U) || U != null && U.hasAttribute(Ue("focus-guard")) || R && (Be(R.nodesRef.current, ae).find((M) => {
2391
- var H, A;
2392
- return ce((H = M.context) == null ? void 0 : H.elements.floating, U) || ce((A = M.context) == null ? void 0 : A.elements.domReference, U);
2393
- }) || xn(R.nodesRef.current, ae).find((M) => {
2394
- var H, A, q;
2395
- return [(H = M.context) == null ? void 0 : H.elements.floating, Tt((A = M.context) == null ? void 0 : A.elements.floating)].includes(U) || ((q = M.context) == null ? void 0 : q.elements.domReference) === U;
2396
- })));
2397
- if (fe === b && T && $n(T, _), f && fe !== b && !(se != null && se.isConnected) && Re(le(T)) === le(T).body) {
2398
- re(T) && T.focus();
2399
- const M = L.current, H = J(), A = H[M] || H[H.length - 1] || T;
2400
- re(A) && A.focus();
2401
- }
2402
- if (x.current.insideReactTree) {
2403
- x.current.insideReactTree = !1;
2404
- return;
2405
- }
2406
- (N || !l) && U && xe && !I.current && // Fix React 18 Strict Mode returnFocus due to double rendering.
2407
- U !== Kn() && (h.current = !0, g(!1, te, "focus-out"));
2408
- });
2409
- }
2410
- const B = !!(!R && E);
2411
- function Q() {
2412
- ge(ee), x.current.insideReactTree = !0, ee.current = window.setTimeout(() => {
2413
- x.current.insideReactTree = !1;
2414
- });
2415
- }
2416
- if (y && re(b))
2417
- return b.addEventListener("focusout", z), b.addEventListener("pointerdown", $), y.addEventListener("focusout", z), B && y.addEventListener("focusout", Q, !0), () => {
2418
- b.removeEventListener("focusout", z), b.removeEventListener("pointerdown", $), y.removeEventListener("focusout", z), B && y.removeEventListener("focusout", Q, !0);
2419
- };
2420
- }, [r, b, y, T, l, R, E, g, p, f, J, N, C, _, x]);
2421
- const oe = d.useRef(null), ve = d.useRef(null), nt = _n([oe, E?.beforeInsideRef]), Ge = _n([ve, E?.afterInsideRef]);
2422
- d.useEffect(() => {
2423
- var $, z;
2424
- if (r || !y) return;
2425
- const B = Array.from((E == null || ($ = E.portalNode) == null ? void 0 : $.querySelectorAll("[" + Ue("portal") + "]")) || []), te = (z = (R ? xn(R.nodesRef.current, C()) : []).find((se) => {
2426
- var ae;
2427
- return en(((ae = se.context) == null ? void 0 : ae.elements.domReference) || null);
2428
- })) == null || (z = z.context) == null ? void 0 : z.elements.domReference, U = [y, te, ...B, ...D(), V.current, O.current, oe.current, ve.current, E?.beforeOutsideRef.current, E?.afterOutsideRef.current, _.current.includes("reference") || N ? b : null].filter((se) => se != null), fe = l || N ? Fn(U, !k, k) : Fn(U);
2429
- return () => {
2430
- fe();
2431
- };
2432
- }, [r, b, y, l, _, E, N, K, k, R, C, D]), X(() => {
2433
- if (r || !re(T)) return;
2434
- const $ = le(T), z = Re($);
2435
- queueMicrotask(() => {
2436
- const B = j(T), Q = G.current, te = (typeof Q == "number" ? B[Q] : Q.current) || T, U = ce(T, z);
2437
- !P && !U && v && Ve(te, {
2438
- preventScroll: te === T
2439
- });
2440
- });
2441
- }, [r, v, T, P, j, G]), X(() => {
2442
- if (r || !T) return;
2443
- const $ = le(T), z = Re($);
2444
- si(z);
2445
- function B(U) {
2446
- let {
2447
- reason: fe,
2448
- event: se,
2449
- nested: ae
2450
- } = U;
2451
- if (["hover", "safe-polygon"].includes(fe) && se.type === "mouseleave" && (h.current = !0), fe === "outside-press")
2452
- if (ae)
2453
- h.current = !1;
2454
- else if (ir(se) || sr(se))
2455
- h.current = !1;
2456
- else {
2457
- let xe = !1;
2458
- document.createElement("div").focus({
2459
- get preventScroll() {
2460
- return xe = !0, !1;
2461
- }
2462
- }), xe ? h.current = !1 : h.current = !0;
2463
- }
2464
- }
2465
- w.on("openchange", B);
2466
- const Q = $.createElement("span");
2467
- Q.setAttribute("tabindex", "-1"), Q.setAttribute("aria-hidden", "true"), Object.assign(Q.style, ln), F && b && b.insertAdjacentElement("afterend", Q);
2468
- function te() {
2469
- if (typeof W.current == "boolean") {
2470
- const U = b || Kn();
2471
- return U && U.isConnected ? U : Q;
2472
- }
2473
- return W.current.current || Q;
2474
- }
2475
- return () => {
2476
- w.off("openchange", B);
2477
- const U = Re($), fe = ce(y, U) || R && Be(R.nodesRef.current, C(), !1).some((ae) => {
2478
- var xe;
2479
- return ce((xe = ae.context) == null ? void 0 : xe.elements.floating, U);
2480
- }), se = te();
2481
- queueMicrotask(() => {
2482
- const ae = ci(se);
2483
- // eslint-disable-next-line react-hooks/exhaustive-deps
2484
- W.current && !h.current && re(ae) && // If the focus moved somewhere else after mount, avoid returning focus
2485
- // since it likely entered a different element which should be
2486
- // respected: https://github.com/floating-ui/floating-ui/issues/2607
2487
- (!(ae !== U && U !== $.body) || fe) && ae.focus({
2488
- preventScroll: !0
2489
- }), Q.remove();
2490
- });
2491
- };
2492
- }, [r, y, T, W, x, w, R, F, b, C]), d.useEffect(() => (queueMicrotask(() => {
2493
- h.current = !1;
2494
- }), () => {
2495
- queueMicrotask(an);
2496
- }), [r]), X(() => {
2497
- if (!r && E)
2498
- return E.setFocusManagerState({
2499
- modal: l,
2500
- closeOnFocusOut: p,
2501
- open: v,
2502
- onOpenChange: g,
2503
- domReference: b
2504
- }), () => {
2505
- E.setFocusManagerState(null);
2506
- };
2507
- }, [r, E, l, v, g, p, b]), X(() => {
2508
- r || T && $n(T, _);
2509
- }, [r, T, _]);
2510
- function Te($) {
2511
- return r || !u || !l ? null : /* @__PURE__ */ me(ui, {
2512
- ref: $ === "start" ? V : O,
2513
- onClick: (z) => g(!1, z.nativeEvent),
2514
- children: typeof u == "string" ? u : "Dismiss"
2515
- });
2516
- }
2517
- const je = !r && K && (l ? !N : !0) && (F || l);
2518
- return /* @__PURE__ */ Yn(kr, {
2519
- children: [je && /* @__PURE__ */ me(Mt, {
2520
- "data-type": "inside",
2521
- ref: nt,
2522
- onFocus: ($) => {
2523
- if (l) {
2524
- const B = j();
2525
- Ve(o[0] === "reference" ? B[0] : B[B.length - 1]);
2526
- } else if (E != null && E.preserveTabOrder && E.portalNode)
2527
- if (h.current = !1, it($, E.portalNode)) {
2528
- const B = dr(b);
2529
- B?.focus();
2530
- } else {
2531
- var z;
2532
- (z = E.beforeOutsideRef.current) == null || z.focus();
2533
- }
2534
- }
2535
- }), !N && Te("start"), n, Te("end"), je && /* @__PURE__ */ me(Mt, {
2536
- "data-type": "inside",
2537
- ref: Ge,
2538
- onFocus: ($) => {
2539
- if (l)
2540
- Ve(j()[0]);
2541
- else if (E != null && E.preserveTabOrder && E.portalNode)
2542
- if (p && (h.current = !0), it($, E.portalNode)) {
2543
- const B = mr(b);
2544
- B?.focus();
2545
- } else {
2546
- var z;
2547
- (z = E.afterOutsideRef.current) == null || z.focus();
2548
- }
2549
- }
2550
- })]
2551
- });
2552
- }
2553
- let bt = 0;
2554
- const Vn = "--floating-ui-scrollbar-width";
2555
- function li() {
2556
- const e = sn(), t = /iP(hone|ad|od)|iOS/.test(e) || // iPads can claim to be MacIntel
2557
- e === "MacIntel" && navigator.maxTouchPoints > 1, n = document.body.style, o = Math.round(document.documentElement.getBoundingClientRect().left) + document.documentElement.scrollLeft ? "paddingLeft" : "paddingRight", s = window.innerWidth - document.documentElement.clientWidth, i = n.left ? parseFloat(n.left) : window.scrollX, c = n.top ? parseFloat(n.top) : window.scrollY;
2558
- if (n.overflow = "hidden", n.setProperty(Vn, s + "px"), s && (n[o] = s + "px"), t) {
2559
- var f, l;
2560
- const u = ((f = window.visualViewport) == null ? void 0 : f.offsetLeft) || 0, p = ((l = window.visualViewport) == null ? void 0 : l.offsetTop) || 0;
2561
- Object.assign(n, {
2562
- position: "fixed",
2563
- top: -(c - Math.floor(p)) + "px",
2564
- left: -(i - Math.floor(u)) + "px",
2565
- right: "0"
2566
- });
2567
- }
2568
- return () => {
2569
- Object.assign(n, {
2570
- overflow: "",
2571
- [o]: ""
2572
- }), n.removeProperty(Vn), t && (Object.assign(n, {
2573
- position: "",
2574
- top: "",
2575
- left: "",
2576
- right: ""
2577
- }), window.scrollTo(i, c));
2578
- };
2579
- }
2580
- let Bn = () => {
2581
- };
2582
- const ki = /* @__PURE__ */ d.forwardRef(function(t, n) {
2583
- const {
2584
- lockScroll: r = !1,
2585
- ...o
2586
- } = t;
2587
- return X(() => {
2588
- if (r)
2589
- return bt++, bt === 1 && (Bn = li()), () => {
2590
- bt--, bt === 0 && Bn();
2591
- };
2592
- }, [r]), /* @__PURE__ */ me("div", {
2593
- ref: n,
2594
- ...o,
2595
- style: {
2596
- position: "fixed",
2597
- overflow: "auto",
2598
- top: 0,
2599
- right: 0,
2600
- bottom: 0,
2601
- left: 0,
2602
- ...o.style
2603
- }
2604
- });
2605
- });
2606
- function Hn(e) {
2607
- return re(e.target) && e.target.tagName === "BUTTON";
2608
- }
2609
- function ai(e) {
2610
- return re(e.target) && e.target.tagName === "A";
2611
- }
2612
- function zn(e) {
2613
- return cn(e);
2614
- }
2615
- function Fi(e, t) {
2616
- t === void 0 && (t = {});
2617
- const {
2618
- open: n,
2619
- onOpenChange: r,
2620
- dataRef: o,
2621
- elements: {
2622
- domReference: s
2623
- }
2624
- } = e, {
2625
- enabled: i = !0,
2626
- event: c = "click",
2627
- toggle: f = !0,
2628
- ignoreMouse: l = !1,
2629
- keyboardHandlers: u = !0,
2630
- stickIfOpen: p = !0
2631
- } = t, m = d.useRef(), a = d.useRef(!1), v = d.useMemo(() => ({
2632
- onPointerDown(g) {
2633
- m.current = g.pointerType;
2634
- },
2635
- onMouseDown(g) {
2636
- const w = m.current;
2637
- g.button === 0 && c !== "click" && (st(w, !0) && l || (n && f && (!(o.current.openEvent && p) || o.current.openEvent.type === "mousedown") ? r(!1, g.nativeEvent, "click") : (g.preventDefault(), r(!0, g.nativeEvent, "click"))));
2638
- },
2639
- onClick(g) {
2640
- const w = m.current;
2641
- if (c === "mousedown" && m.current) {
2642
- m.current = void 0;
2643
- return;
2644
- }
2645
- st(w, !0) && l || (n && f && (!(o.current.openEvent && p) || o.current.openEvent.type === "click") ? r(!1, g.nativeEvent, "click") : r(!0, g.nativeEvent, "click"));
2646
- },
2647
- onKeyDown(g) {
2648
- m.current = void 0, !(g.defaultPrevented || !u || Hn(g)) && (g.key === " " && !zn(s) && (g.preventDefault(), a.current = !0), !ai(g) && g.key === "Enter" && r(!(n && f), g.nativeEvent, "click"));
2649
- },
2650
- onKeyUp(g) {
2651
- g.defaultPrevented || !u || Hn(g) || zn(s) || g.key === " " && a.current && (a.current = !1, r(!(n && f), g.nativeEvent, "click"));
2652
- }
2653
- }), [o, s, c, l, u, r, n, p, f]);
2654
- return d.useMemo(() => i ? {
2655
- reference: v
2656
- } : {}, [i, v]);
2657
- }
2658
- const fi = {
2659
- pointerdown: "onPointerDown",
2660
- mousedown: "onMouseDown",
2661
- click: "onClick"
2662
- }, di = {
2663
- pointerdown: "onPointerDownCapture",
2664
- mousedown: "onMouseDownCapture",
2665
- click: "onClickCapture"
2666
- }, Un = (e) => {
2667
- var t, n;
2668
- return {
2669
- escapeKey: typeof e == "boolean" ? e : (t = e?.escapeKey) != null ? t : !1,
2670
- outsidePress: typeof e == "boolean" ? e : (n = e?.outsidePress) != null ? n : !0
2671
- };
2672
- };
2673
- function Ni(e, t) {
2674
- t === void 0 && (t = {});
2675
- const {
2676
- open: n,
2677
- onOpenChange: r,
2678
- elements: o,
2679
- dataRef: s
2680
- } = e, {
2681
- enabled: i = !0,
2682
- escapeKey: c = !0,
2683
- outsidePress: f = !0,
2684
- outsidePressEvent: l = "pointerdown",
2685
- referencePress: u = !1,
2686
- referencePressEvent: p = "pointerdown",
2687
- ancestorScroll: m = !1,
2688
- bubbles: a,
2689
- capture: v
2690
- } = t, g = tt(), w = ie(typeof f == "function" ? f : () => !1), x = typeof f == "function" ? w : f, b = d.useRef(!1), {
2691
- escapeKey: y,
2692
- outsidePress: C
2693
- } = Un(a), {
2694
- escapeKey: D,
2695
- outsidePress: P
2696
- } = Un(v), N = d.useRef(!1), S = ie((R) => {
2697
- var E;
2698
- if (!n || !i || !c || R.key !== "Escape" || N.current)
2699
- return;
2700
- const V = (E = s.current.floatingContext) == null ? void 0 : E.nodeId, O = g ? Be(g.nodesRef.current, V) : [];
2701
- if (!y && (R.stopPropagation(), O.length > 0)) {
2702
- let h = !0;
2703
- if (O.forEach((I) => {
2704
- var L;
2705
- if ((L = I.context) != null && L.open && !I.context.dataRef.current.__escapeKeyBubbles) {
2706
- h = !1;
2707
- return;
2708
- }
2709
- }), !h)
2710
- return;
2711
- }
2712
- r(!1, to(R) ? R.nativeEvent : R, "escape-key");
2713
- }), K = ie((R) => {
2714
- var E;
2715
- const V = () => {
2716
- var O;
2717
- S(R), (O = Ae(R)) == null || O.removeEventListener("keydown", V);
2718
- };
2719
- (E = Ae(R)) == null || E.addEventListener("keydown", V);
2720
- }), k = ie((R) => {
2721
- var E;
2722
- const V = s.current.insideReactTree;
2723
- s.current.insideReactTree = !1;
2724
- const O = b.current;
2725
- if (b.current = !1, l === "click" && O || V || typeof x == "function" && !x(R))
2726
- return;
2727
- const h = Ae(R), I = "[" + Ue("inert") + "]", L = le(o.floating).querySelectorAll(I);
2728
- let ee = Y(h) ? h : null;
2729
- for (; ee && !Se(ee); ) {
2730
- const j = Pe(ee);
2731
- if (Se(j) || !Y(j))
2732
- break;
2733
- ee = j;
2734
- }
2735
- if (L.length && Y(h) && !Qr(h) && // Clicked on a direct ancestor (e.g. FloatingOverlay).
2736
- !ce(h, o.floating) && // If the target root element contains none of the markers, then the
2737
- // element was injected after the floating element rendered.
2738
- Array.from(L).every((j) => !ce(ee, j)))
2739
- return;
2740
- if (re(h) && W) {
2741
- const j = Se(h), oe = we(h), ve = /auto|scroll/, nt = j || ve.test(oe.overflowX), Ge = j || ve.test(oe.overflowY), Te = nt && h.clientWidth > 0 && h.scrollWidth > h.clientWidth, je = Ge && h.clientHeight > 0 && h.scrollHeight > h.clientHeight, $ = oe.direction === "rtl", z = je && ($ ? R.offsetX <= h.offsetWidth - h.clientWidth : R.offsetX > h.clientWidth), B = Te && R.offsetY > h.clientHeight;
2742
- if (z || B)
2743
- return;
2744
- }
2745
- const F = (E = s.current.floatingContext) == null ? void 0 : E.nodeId, T = g && Be(g.nodesRef.current, F).some((j) => {
2746
- var oe;
2747
- return Vt(R, (oe = j.context) == null ? void 0 : oe.elements.floating);
2748
- });
2749
- if (Vt(R, o.floating) || Vt(R, o.domReference) || T)
2750
- return;
2751
- const J = g ? Be(g.nodesRef.current, F) : [];
2752
- if (J.length > 0) {
2753
- let j = !0;
2754
- if (J.forEach((oe) => {
2755
- var ve;
2756
- if ((ve = oe.context) != null && ve.open && !oe.context.dataRef.current.__outsidePressBubbles) {
2757
- j = !1;
2758
- return;
2759
- }
2760
- }), !j)
2761
- return;
2762
- }
2763
- r(!1, R, "outside-press");
2764
- }), _ = ie((R) => {
2765
- var E;
2766
- const V = () => {
2767
- var O;
2768
- k(R), (O = Ae(R)) == null || O.removeEventListener(l, V);
2769
- };
2770
- (E = Ae(R)) == null || E.addEventListener(l, V);
2771
- });
2772
- d.useEffect(() => {
2773
- if (!n || !i)
2774
- return;
2775
- s.current.__escapeKeyBubbles = y, s.current.__outsidePressBubbles = C;
2776
- let R = -1;
2777
- function E(L) {
2778
- r(!1, L, "ancestor-scroll");
2779
- }
2780
- function V() {
2781
- window.clearTimeout(R), N.current = !0;
2782
- }
2783
- function O() {
2784
- R = window.setTimeout(
2785
- () => {
2786
- N.current = !1;
2787
- },
2788
- // 0ms or 1ms don't work in Safari. 5ms appears to consistently work.
2789
- // Only apply to WebKit for the test to remain 0ms.
2790
- Lt() ? 5 : 0
2791
- );
2792
- }
2793
- const h = le(o.floating);
2794
- c && (h.addEventListener("keydown", D ? K : S, D), h.addEventListener("compositionstart", V), h.addEventListener("compositionend", O)), x && h.addEventListener(l, P ? _ : k, P);
2795
- let I = [];
2796
- return m && (Y(o.domReference) && (I = ke(o.domReference)), Y(o.floating) && (I = I.concat(ke(o.floating))), !Y(o.reference) && o.reference && o.reference.contextElement && (I = I.concat(ke(o.reference.contextElement)))), I = I.filter((L) => {
2797
- var ee;
2798
- return L !== ((ee = h.defaultView) == null ? void 0 : ee.visualViewport);
2799
- }), I.forEach((L) => {
2800
- L.addEventListener("scroll", E, {
2801
- passive: !0
2802
- });
2803
- }), () => {
2804
- c && (h.removeEventListener("keydown", D ? K : S, D), h.removeEventListener("compositionstart", V), h.removeEventListener("compositionend", O)), x && h.removeEventListener(l, P ? _ : k, P), I.forEach((L) => {
2805
- L.removeEventListener("scroll", E);
2806
- }), window.clearTimeout(R);
2807
- };
2808
- }, [s, o, c, x, l, n, r, m, i, y, C, S, D, K, k, P, _]), d.useEffect(() => {
2809
- s.current.insideReactTree = !1;
2810
- }, [s, x, l]);
2811
- const G = d.useMemo(() => ({
2812
- onKeyDown: S,
2813
- ...u && {
2814
- [fi[p]]: (R) => {
2815
- r(!1, R.nativeEvent, "reference-press");
2816
- },
2817
- ...p !== "click" && {
2818
- onClick(R) {
2819
- r(!1, R.nativeEvent, "reference-press");
2820
- }
2821
- }
2822
- }
2823
- }), [S, r, u, p]), W = d.useMemo(() => {
2824
- function R(E) {
2825
- E.button === 0 && (b.current = !0);
2826
- }
2827
- return {
2828
- onKeyDown: S,
2829
- onMouseDown: R,
2830
- onMouseUp: R,
2831
- [di[l]]: () => {
2832
- s.current.insideReactTree = !0;
2833
- }
2834
- };
2835
- }, [S, l, s]);
2836
- return d.useMemo(() => i ? {
2837
- reference: G,
2838
- floating: W
2839
- } : {}, [i, G, W]);
2840
- }
2841
- function mi(e) {
2842
- const {
2843
- open: t = !1,
2844
- onOpenChange: n,
2845
- elements: r
2846
- } = e, o = Nt(), s = d.useRef({}), [i] = d.useState(() => Or()), c = et() != null;
2847
- if (process.env.NODE_ENV !== "production") {
2848
- const a = r.reference;
2849
- a && !Y(a) && Zo("Cannot pass a virtual element to the `elements.reference` option,", "as it must be a real DOM element. Use `refs.setPositionReference()`", "instead.");
2850
- }
2851
- const [f, l] = d.useState(r.reference), u = ie((a, v, g) => {
2852
- s.current.openEvent = a ? v : void 0, i.emit("openchange", {
2853
- open: a,
2854
- event: v,
2855
- reason: g,
2856
- nested: c
2857
- }), n?.(a, v, g);
2858
- }), p = d.useMemo(() => ({
2859
- setPositionReference: l
2860
- }), []), m = d.useMemo(() => ({
2861
- reference: f || r.reference || null,
2862
- floating: r.floating || null,
2863
- domReference: r.reference
2864
- }), [f, r.reference, r.floating]);
2865
- return d.useMemo(() => ({
2866
- dataRef: s,
2867
- open: t,
2868
- onOpenChange: u,
2869
- elements: m,
2870
- events: i,
2871
- floatingId: o,
2872
- refs: p
2873
- }), [t, u, m, i, o, p]);
2874
- }
2875
- function _i(e) {
2876
- e === void 0 && (e = {});
2877
- const {
2878
- nodeId: t
2879
- } = e, n = mi({
2880
- ...e,
2881
- elements: {
2882
- reference: null,
2883
- floating: null,
2884
- ...e.elements
2885
- }
2886
- }), r = e.rootContext || n, o = r.elements, [s, i] = d.useState(null), [c, f] = d.useState(null), u = o?.domReference || s, p = d.useRef(null), m = tt();
2887
- X(() => {
2888
- u && (p.current = u);
2889
- }, [u]);
2890
- const a = Ho({
2891
- ...e,
2892
- elements: {
2893
- ...o,
2894
- ...c && {
2895
- reference: c
2896
- }
2897
- }
2898
- }), v = d.useCallback((y) => {
2899
- const C = Y(y) ? {
2900
- getBoundingClientRect: () => y.getBoundingClientRect(),
2901
- getClientRects: () => y.getClientRects(),
2902
- contextElement: y
2903
- } : y;
2904
- f(C), a.refs.setReference(C);
2905
- }, [a.refs]), g = d.useCallback((y) => {
2906
- (Y(y) || y === null) && (p.current = y, i(y)), (Y(a.refs.reference.current) || a.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to
2907
- // `null` to support `positionReference` + an unstable `reference`
2908
- // callback ref.
2909
- y !== null && !Y(y)) && a.refs.setReference(y);
2910
- }, [a.refs]), w = d.useMemo(() => ({
2911
- ...a.refs,
2912
- setReference: g,
2913
- setPositionReference: v,
2914
- domReference: p
2915
- }), [a.refs, g, v]), x = d.useMemo(() => ({
2916
- ...a.elements,
2917
- domReference: u
2918
- }), [a.elements, u]), b = d.useMemo(() => ({
2919
- ...a,
2920
- ...r,
2921
- refs: w,
2922
- elements: x,
2923
- nodeId: t
2924
- }), [a, w, x, t, r]);
2925
- return X(() => {
2926
- r.dataRef.current.floatingContext = b;
2927
- const y = m?.nodesRef.current.find((C) => C.id === t);
2928
- y && (y.context = b);
2929
- }), d.useMemo(() => ({
2930
- ...a,
2931
- context: b,
2932
- refs: w,
2933
- elements: x
2934
- }), [a, w, x, b]);
2935
- }
2936
- function Xt() {
2937
- return qr() && rr();
2938
- }
2939
- function Wi(e, t) {
2940
- t === void 0 && (t = {});
2941
- const {
2942
- open: n,
2943
- onOpenChange: r,
2944
- events: o,
2945
- dataRef: s,
2946
- elements: i
2947
- } = e, {
2948
- enabled: c = !0,
2949
- visibleOnly: f = !0
2950
- } = t, l = d.useRef(!1), u = d.useRef(-1), p = d.useRef(!0);
2951
- d.useEffect(() => {
2952
- if (!c) return;
2953
- const a = pe(i.domReference);
2954
- function v() {
2955
- !n && re(i.domReference) && i.domReference === Re(le(i.domReference)) && (l.current = !0);
2956
- }
2957
- function g() {
2958
- p.current = !0;
2959
- }
2960
- function w() {
2961
- p.current = !1;
2962
- }
2963
- return a.addEventListener("blur", v), Xt() && (a.addEventListener("keydown", g, !0), a.addEventListener("pointerdown", w, !0)), () => {
2964
- a.removeEventListener("blur", v), Xt() && (a.removeEventListener("keydown", g, !0), a.removeEventListener("pointerdown", w, !0));
2965
- };
2966
- }, [i.domReference, n, c]), d.useEffect(() => {
2967
- if (!c) return;
2968
- function a(v) {
2969
- let {
2970
- reason: g
2971
- } = v;
2972
- (g === "reference-press" || g === "escape-key") && (l.current = !0);
2973
- }
2974
- return o.on("openchange", a), () => {
2975
- o.off("openchange", a);
2976
- };
2977
- }, [o, c]), d.useEffect(() => () => {
2978
- ge(u);
2979
- }, []);
2980
- const m = d.useMemo(() => ({
2981
- onMouseLeave() {
2982
- l.current = !1;
2983
- },
2984
- onFocus(a) {
2985
- if (l.current) return;
2986
- const v = Ae(a.nativeEvent);
2987
- if (f && Y(v)) {
2988
- if (Xt() && !a.relatedTarget) {
2989
- if (!p.current && !cn(v))
2990
- return;
2991
- } else if (!Zr(v))
2992
- return;
2993
- }
2994
- r(!0, a.nativeEvent, "focus");
2995
- },
2996
- onBlur(a) {
2997
- l.current = !1;
2998
- const v = a.relatedTarget, g = a.nativeEvent, w = Y(v) && v.hasAttribute(Ue("focus-guard")) && v.getAttribute("data-type") === "outside";
2999
- u.current = window.setTimeout(() => {
3000
- var x;
3001
- const b = Re(i.domReference ? i.domReference.ownerDocument : document);
3002
- !v && b === i.domReference || ce((x = s.current.floatingContext) == null ? void 0 : x.refs.floating.current, b) || ce(i.domReference, b) || w || r(!1, g, "focus");
3003
- });
3004
- }
3005
- }), [s, i.domReference, r, f]);
3006
- return d.useMemo(() => c ? {
3007
- reference: m
3008
- } : {}, [c, m]);
3009
- }
3010
- function Yt(e, t, n) {
3011
- const r = /* @__PURE__ */ new Map(), o = n === "item";
3012
- let s = e;
3013
- if (o && e) {
3014
- const {
3015
- [An]: i,
3016
- [Mn]: c,
3017
- ...f
3018
- } = e;
3019
- s = f;
3020
- }
3021
- return {
3022
- ...n === "floating" && {
3023
- tabIndex: -1,
3024
- [qo]: ""
3025
- },
3026
- ...s,
3027
- ...t.map((i) => {
3028
- const c = i ? i[n] : null;
3029
- return typeof c == "function" ? e ? c(e) : null : c;
3030
- }).concat(e).reduce((i, c) => (c && Object.entries(c).forEach((f) => {
3031
- let [l, u] = f;
3032
- if (!(o && [An, Mn].includes(l)))
3033
- if (l.indexOf("on") === 0) {
3034
- if (r.has(l) || r.set(l, []), typeof u == "function") {
3035
- var p;
3036
- (p = r.get(l)) == null || p.push(u), i[l] = function() {
3037
- for (var m, a = arguments.length, v = new Array(a), g = 0; g < a; g++)
3038
- v[g] = arguments[g];
3039
- return (m = r.get(l)) == null ? void 0 : m.map((w) => w(...v)).find((w) => w !== void 0);
3040
- };
3041
- }
3042
- } else
3043
- i[l] = u;
3044
- }), i), {})
3045
- };
3046
- }
3047
- function Ki(e) {
3048
- e === void 0 && (e = []);
3049
- const t = e.map((c) => c?.reference), n = e.map((c) => c?.floating), r = e.map((c) => c?.item), o = d.useCallback(
3050
- (c) => Yt(c, e, "reference"),
3051
- // eslint-disable-next-line react-hooks/exhaustive-deps
3052
- t
3053
- ), s = d.useCallback(
3054
- (c) => Yt(c, e, "floating"),
3055
- // eslint-disable-next-line react-hooks/exhaustive-deps
3056
- n
3057
- ), i = d.useCallback(
3058
- (c) => Yt(c, e, "item"),
3059
- // eslint-disable-next-line react-hooks/exhaustive-deps
3060
- r
3061
- );
3062
- return d.useMemo(() => ({
3063
- getReferenceProps: o,
3064
- getFloatingProps: s,
3065
- getItemProps: i
3066
- }), [o, s, i]);
3067
- }
3068
- const pi = "Escape";
3069
- function _t(e, t, n) {
3070
- switch (e) {
3071
- case "vertical":
3072
- return t;
3073
- case "horizontal":
3074
- return n;
3075
- default:
3076
- return t || n;
3077
- }
3078
- }
3079
- function yt(e, t) {
3080
- return _t(t, e === ct || e === Fe, e === Ne || e === _e);
3081
- }
3082
- function Jt(e, t, n) {
3083
- return _t(t, e === Fe, n ? e === Ne : e === _e) || e === "Enter" || e === " " || e === "";
3084
- }
3085
- function Gn(e, t, n) {
3086
- return _t(t, n ? e === Ne : e === _e, e === Fe);
3087
- }
3088
- function jn(e, t, n, r) {
3089
- const o = n ? e === _e : e === Ne, s = e === ct;
3090
- return t === "both" || t === "horizontal" && r && r > 1 ? e === pi : _t(t, o, s);
3091
- }
3092
- function $i(e, t) {
3093
- const {
3094
- open: n,
3095
- onOpenChange: r,
3096
- elements: o,
3097
- floatingId: s
3098
- } = e, {
3099
- listRef: i,
3100
- activeIndex: c,
3101
- onNavigate: f = () => {
3102
- },
3103
- enabled: l = !0,
3104
- selectedIndex: u = null,
3105
- allowEscape: p = !1,
3106
- loop: m = !1,
3107
- nested: a = !1,
3108
- rtl: v = !1,
3109
- virtual: g = !1,
3110
- focusItemOnOpen: w = "auto",
3111
- focusItemOnHover: x = !0,
3112
- openOnArrowKeyDown: b = !0,
3113
- disabledIndices: y = void 0,
3114
- orientation: C = "vertical",
3115
- parentOrientation: D,
3116
- cols: P = 1,
3117
- scrollItemIntoView: N = !0,
3118
- virtualItemRef: S,
3119
- itemSizes: K,
3120
- dense: k = !1
3121
- } = t;
3122
- process.env.NODE_ENV !== "production" && (p && (m || Ut("`useListNavigation` looping must be enabled to allow escaping."), g || Ut("`useListNavigation` must be virtual to allow escaping.")), C === "vertical" && P > 1 && Ut("In grid list navigation mode (`cols` > 1), the `orientation` should", 'be either "horizontal" or "both".'));
3123
- const _ = Tt(o.floating), G = ye(_), W = et(), R = tt();
3124
- X(() => {
3125
- e.dataRef.current.orientation = C;
3126
- }, [e, C]);
3127
- const E = ie(() => {
3128
- f(h.current === -1 ? null : h.current);
3129
- }), V = en(o.domReference), O = d.useRef(w), h = d.useRef(u ?? -1), I = d.useRef(null), L = d.useRef(!0), ee = d.useRef(E), F = d.useRef(!!o.floating), T = d.useRef(n), J = d.useRef(!1), j = d.useRef(!1), oe = ye(y), ve = ye(n), nt = ye(N), Ge = ye(u), [Te, je] = d.useState(), [$, z] = d.useState(), B = ie(() => {
3130
- function M(Z) {
3131
- if (g) {
3132
- var ne;
3133
- (ne = Z.id) != null && ne.endsWith("-fui-option") && (Z.id = s + "-" + Math.random().toString(16).slice(2, 10)), je(Z.id), R?.events.emit("virtualfocus", Z), S && (S.current = Z);
3134
- } else
3135
- Ve(Z, {
3136
- sync: J.current,
3137
- preventScroll: !0
3138
- });
3139
- }
3140
- const H = i.current[h.current], A = j.current;
3141
- H && M(H), (J.current ? (Z) => Z() : requestAnimationFrame)(() => {
3142
- const Z = i.current[h.current] || H;
3143
- if (!Z) return;
3144
- H || M(Z);
3145
- const ne = nt.current;
3146
- ne && te && (A || !L.current) && (Z.scrollIntoView == null || Z.scrollIntoView(typeof ne == "boolean" ? {
3147
- block: "nearest",
3148
- inline: "nearest"
3149
- } : ne));
3150
- });
3151
- });
3152
- X(() => {
3153
- l && (n && o.floating ? O.current && u != null && (j.current = !0, h.current = u, E()) : F.current && (h.current = -1, ee.current()));
3154
- }, [l, n, o.floating, u, E]), X(() => {
3155
- if (l && n && o.floating)
3156
- if (c == null) {
3157
- if (J.current = !1, Ge.current != null)
3158
- return;
3159
- if (F.current && (h.current = -1, B()), (!T.current || !F.current) && O.current && (I.current != null || O.current === !0 && I.current == null)) {
3160
- let M = 0;
3161
- const H = () => {
3162
- i.current[0] == null ? (M < 2 && (M ? requestAnimationFrame : queueMicrotask)(H), M++) : (h.current = I.current == null || Jt(I.current, C, v) || a ? wt(i, oe.current) : tn(i, oe.current), I.current = null, E());
3163
- };
3164
- H();
3165
- }
3166
- } else Xe(i, c) || (h.current = c, B(), j.current = !1);
3167
- }, [l, n, o.floating, c, Ge, a, i, C, v, E, B, oe]), X(() => {
3168
- var M;
3169
- if (!l || o.floating || !R || g || !F.current)
3170
- return;
3171
- const H = R.nodesRef.current, A = (M = H.find((ne) => ne.id === W)) == null || (M = M.context) == null ? void 0 : M.elements.floating, q = Re(le(o.floating)), Z = H.some((ne) => ne.context && ce(ne.context.elements.floating, q));
3172
- A && !Z && L.current && A.focus({
3173
- preventScroll: !0
3174
- });
3175
- }, [l, o.floating, R, W, g]), X(() => {
3176
- if (!l || !R || !g || W) return;
3177
- function M(H) {
3178
- z(H.id), S && (S.current = H);
3179
- }
3180
- return R.events.on("virtualfocus", M), () => {
3181
- R.events.off("virtualfocus", M);
3182
- };
3183
- }, [l, R, g, W, S]), X(() => {
3184
- ee.current = E, T.current = n, F.current = !!o.floating;
3185
- }), X(() => {
3186
- n || (I.current = null, O.current = w);
3187
- }, [n, w]);
3188
- const Q = c != null, te = d.useMemo(() => {
3189
- function M(A) {
3190
- if (!ve.current) return;
3191
- const q = i.current.indexOf(A);
3192
- q !== -1 && h.current !== q && (h.current = q, E());
3193
- }
3194
- return {
3195
- onFocus(A) {
3196
- let {
3197
- currentTarget: q
3198
- } = A;
3199
- J.current = !0, M(q);
3200
- },
3201
- onClick: (A) => {
3202
- let {
3203
- currentTarget: q
3204
- } = A;
3205
- return q.focus({
3206
- preventScroll: !0
3207
- });
3208
- },
3209
- // Safari
3210
- onMouseMove(A) {
3211
- let {
3212
- currentTarget: q
3213
- } = A;
3214
- J.current = !0, j.current = !1, x && M(q);
3215
- },
3216
- onPointerLeave(A) {
3217
- let {
3218
- pointerType: q
3219
- } = A;
3220
- if (!(!L.current || q === "touch") && (J.current = !0, !!x && (h.current = -1, E(), !g))) {
3221
- var Z;
3222
- (Z = G.current) == null || Z.focus({
3223
- preventScroll: !0
3224
- });
3225
- }
3226
- }
3227
- };
3228
- }, [ve, G, x, i, E, g]), U = d.useCallback(() => {
3229
- var M;
3230
- return D ?? (R == null || (M = R.nodesRef.current.find((H) => H.id === W)) == null || (M = M.context) == null || (M = M.dataRef) == null ? void 0 : M.current.orientation);
3231
- }, [W, R, D]), fe = ie((M) => {
3232
- if (L.current = !1, J.current = !0, M.which === 229 || !ve.current && M.currentTarget === G.current)
3233
- return;
3234
- if (a && jn(M.key, C, v, P)) {
3235
- yt(M.key, U()) || de(M), r(!1, M.nativeEvent, "list-navigation"), re(o.domReference) && (g ? R?.events.emit("virtualfocus", o.domReference) : o.domReference.focus());
3236
- return;
3237
- }
3238
- const H = h.current, A = wt(i, y), q = tn(i, y);
3239
- if (V || (M.key === "Home" && (de(M), h.current = A, E()), M.key === "End" && (de(M), h.current = q, E())), P > 1) {
3240
- const Z = K || Array.from({
3241
- length: i.current.length
3242
- }, () => ({
3243
- width: 1,
3244
- height: 1
3245
- })), ne = ur(Z, P, k), rt = ne.findIndex((be) => be != null && !He(i, be, y)), ft = ne.reduce((be, Ke, dt) => Ke != null && !He(i, Ke, y) ? dt : be, -1), ot = ne[cr({
3246
- current: ne.map((be) => be != null ? i.current[be] : null)
3247
- }, {
3248
- event: M,
3249
- orientation: C,
3250
- loop: m,
3251
- rtl: v,
3252
- cols: P,
3253
- // treat undefined (empty grid spaces) as disabled indices so we
3254
- // don't end up in them
3255
- disabledIndices: ar([...(typeof y != "function" ? y : null) || i.current.map((be, Ke) => He(i, Ke, y) ? Ke : void 0), void 0], ne),
3256
- minIndex: rt,
3257
- maxIndex: ft,
3258
- prevIndex: lr(
3259
- h.current > q ? A : h.current,
3260
- Z,
3261
- ne,
3262
- P,
3263
- // use a corner matching the edge closest to the direction
3264
- // we're moving in so we don't end up in the same item. Prefer
3265
- // top/left over bottom/right.
3266
- M.key === Fe ? "bl" : M.key === (v ? Ne : _e) ? "tr" : "tl"
3267
- ),
3268
- stopEvent: !0
3269
- })];
3270
- if (ot != null && (h.current = ot, E()), C === "both")
3271
- return;
3272
- }
3273
- if (yt(M.key, C)) {
3274
- if (de(M), n && !g && Re(M.currentTarget.ownerDocument) === M.currentTarget) {
3275
- h.current = Jt(M.key, C, v) ? A : q, E();
3276
- return;
3277
- }
3278
- Jt(M.key, C, v) ? m ? h.current = H >= q ? p && H !== i.current.length ? -1 : A : ue(i, {
3279
- startingIndex: H,
3280
- disabledIndices: y
3281
- }) : h.current = Math.min(q, ue(i, {
3282
- startingIndex: H,
3283
- disabledIndices: y
3284
- })) : m ? h.current = H <= A ? p && H !== -1 ? i.current.length : q : ue(i, {
3285
- startingIndex: H,
3286
- decrement: !0,
3287
- disabledIndices: y
3288
- }) : h.current = Math.max(A, ue(i, {
3289
- startingIndex: H,
3290
- decrement: !0,
3291
- disabledIndices: y
3292
- })), Xe(i, h.current) && (h.current = -1), E();
3293
- }
3294
- }), se = d.useMemo(() => g && n && Q && {
3295
- "aria-activedescendant": $ || Te
3296
- }, [g, n, Q, $, Te]), ae = d.useMemo(() => ({
3297
- "aria-orientation": C === "both" ? void 0 : C,
3298
- ...V ? {} : se,
3299
- onKeyDown: fe,
3300
- onPointerMove() {
3301
- L.current = !0;
3302
- }
3303
- }), [se, fe, C, V]), xe = d.useMemo(() => {
3304
- function M(A) {
3305
- w === "auto" && ir(A.nativeEvent) && (O.current = !0);
3306
- }
3307
- function H(A) {
3308
- O.current = w, w === "auto" && sr(A.nativeEvent) && (O.current = !0);
3309
- }
3310
- return {
3311
- ...se,
3312
- onKeyDown(A) {
3313
- L.current = !1;
3314
- const q = A.key.startsWith("Arrow"), Z = ["Home", "End"].includes(A.key), ne = q || Z, rt = Gn(A.key, C, v), ft = jn(A.key, C, v, P), ot = Gn(A.key, U(), v), be = yt(A.key, C), Ke = (a ? ot : be) || A.key === "Enter" || A.key.trim() === "";
3315
- if (g && n) {
3316
- const mt = R?.nodesRef.current.find((pt) => pt.parentId == null), De = R && mt ? eo(R.nodesRef.current, mt.id) : null;
3317
- if (ne && De && S) {
3318
- const pt = new KeyboardEvent("keydown", {
3319
- key: A.key,
3320
- bubbles: !0
3321
- });
3322
- if (rt || ft) {
3323
- var dt, fn;
3324
- const Dr = ((dt = De.context) == null ? void 0 : dt.elements.domReference) === A.currentTarget, mn = ft && !Dr ? (fn = De.context) == null ? void 0 : fn.elements.domReference : rt ? i.current.find((pn) => pn?.id === Te) : null;
3325
- mn && (de(A), mn.dispatchEvent(pt), z(void 0));
3326
- }
3327
- if ((be || Z) && De.context && De.context.open && De.parentId && A.currentTarget !== De.context.elements.domReference) {
3328
- var dn;
3329
- de(A), (dn = De.context.elements.domReference) == null || dn.dispatchEvent(pt);
3330
- return;
3331
- }
3332
- }
3333
- return fe(A);
3334
- }
3335
- if (!(!n && !b && q)) {
3336
- if (Ke) {
3337
- const mt = yt(A.key, U());
3338
- I.current = a && mt ? null : A.key;
3339
- }
3340
- if (a) {
3341
- ot && (de(A), n ? (h.current = wt(i, oe.current), E()) : r(!0, A.nativeEvent, "list-navigation"));
3342
- return;
3343
- }
3344
- be && (u != null && (h.current = u), de(A), !n && b ? r(!0, A.nativeEvent, "list-navigation") : fe(A), n && E());
3345
- }
3346
- },
3347
- onFocus() {
3348
- n && !g && (h.current = -1, E());
3349
- },
3350
- onPointerDown: H,
3351
- onPointerEnter: H,
3352
- onMouseDown: M,
3353
- onClick: M
3354
- };
3355
- }, [Te, se, P, fe, oe, w, i, a, E, r, n, b, C, U, v, u, R, g, S]);
3356
- return d.useMemo(() => l ? {
3357
- reference: xe,
3358
- floating: ae,
3359
- item: te
3360
- } : {}, [l, xe, ae, te]);
3361
- }
3362
- const gi = /* @__PURE__ */ new Map([["select", "listbox"], ["combobox", "listbox"], ["label", !1]]);
3363
- function Vi(e, t) {
3364
- var n, r;
3365
- t === void 0 && (t = {});
3366
- const {
3367
- open: o,
3368
- elements: s,
3369
- floatingId: i
3370
- } = e, {
3371
- enabled: c = !0,
3372
- role: f = "dialog"
3373
- } = t, l = Nt(), u = ((n = s.domReference) == null ? void 0 : n.id) || l, p = d.useMemo(() => {
3374
- var b;
3375
- return ((b = Tt(s.floating)) == null ? void 0 : b.id) || i;
3376
- }, [s.floating, i]), m = (r = gi.get(f)) != null ? r : f, v = et() != null, g = d.useMemo(() => m === "tooltip" || f === "label" ? {
3377
- ["aria-" + (f === "label" ? "labelledby" : "describedby")]: o ? p : void 0
3378
- } : {
3379
- "aria-expanded": o ? "true" : "false",
3380
- "aria-haspopup": m === "alertdialog" ? "dialog" : m,
3381
- "aria-controls": o ? p : void 0,
3382
- ...m === "listbox" && {
3383
- role: "combobox"
3384
- },
3385
- ...m === "menu" && {
3386
- id: u
3387
- },
3388
- ...m === "menu" && v && {
3389
- role: "menuitem"
3390
- },
3391
- ...f === "select" && {
3392
- "aria-autocomplete": "none"
3393
- },
3394
- ...f === "combobox" && {
3395
- "aria-autocomplete": "list"
3396
- }
3397
- }, [m, p, v, o, u, f]), w = d.useMemo(() => {
3398
- const b = {
3399
- id: p,
3400
- ...m && {
3401
- role: m
3402
- }
3403
- };
3404
- return m === "tooltip" || f === "label" ? b : {
3405
- ...b,
3406
- ...m === "menu" && {
3407
- "aria-labelledby": u
3408
- }
3409
- };
3410
- }, [m, p, u, f]), x = d.useCallback((b) => {
3411
- let {
3412
- active: y,
3413
- selected: C
3414
- } = b;
3415
- const D = {
3416
- role: "option",
3417
- ...y && {
3418
- id: p + "-fui-option"
3419
- }
3420
- };
3421
- switch (f) {
3422
- case "select":
3423
- case "combobox":
3424
- return {
3425
- ...D,
3426
- "aria-selected": C
3427
- };
3428
- }
3429
- return {};
3430
- }, [p, f]);
3431
- return d.useMemo(() => c ? {
3432
- reference: g,
3433
- floating: w,
3434
- item: x
3435
- } : {}, [c, g, w, x]);
3436
- }
3437
- function hi(e, t) {
3438
- const [n, r] = d.useState(e);
3439
- return e && !n && r(!0), d.useEffect(() => {
3440
- if (!e && n) {
3441
- const o = setTimeout(() => r(!1), t);
3442
- return () => clearTimeout(o);
3443
- }
3444
- }, [e, n, t]), n;
3445
- }
3446
- function Bi(e, t) {
3447
- t === void 0 && (t = {});
3448
- const {
3449
- open: n,
3450
- elements: {
3451
- floating: r
3452
- }
3453
- } = e, {
3454
- duration: o = 250
3455
- } = t, i = (typeof o == "number" ? o : o.close) || 0, [c, f] = d.useState("unmounted"), l = hi(n, i);
3456
- return !l && c === "close" && f("unmounted"), X(() => {
3457
- if (r) {
3458
- if (n) {
3459
- f("initial");
3460
- const u = requestAnimationFrame(() => {
3461
- nn.flushSync(() => {
3462
- f("open");
3463
- });
3464
- });
3465
- return () => {
3466
- cancelAnimationFrame(u);
3467
- };
3468
- }
3469
- f("close");
3470
- }
3471
- }, [n, r]), {
3472
- isMounted: l,
3473
- status: c
3474
- };
3475
- }
3476
- export {
3477
- Oi as C,
3478
- Si as F,
3479
- Ti as a,
3480
- et as b,
3481
- Ai as c,
3482
- Mi as d,
3483
- Di as e,
3484
- Go as f,
3485
- Li as g,
3486
- Ei as h,
3487
- _i as i,
3488
- wi as j,
3489
- Ni as k,
3490
- Vi as l,
3491
- Ki as m,
3492
- $i as n,
3493
- xi as o,
3494
- Ii as p,
3495
- Ri as q,
3496
- Pi as r,
3497
- Ci as s,
3498
- Wi as t,
3499
- jo as u,
3500
- Fi as v,
3501
- Bi as w,
3502
- ki as x
3503
- };