@arc-ui/components 11.16.0 → 11.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (230) hide show
  1. package/dist/Calendar/Calendar.cjs.js +21 -0
  2. package/dist/Calendar/Calendar.esm.js +13 -0
  3. package/dist/Calendar/package.json +7 -0
  4. package/dist/Checkbox/Checkbox.cjs.js +3 -2
  5. package/dist/Checkbox/Checkbox.esm.js +3 -2
  6. package/dist/DatePicker/DatePicker.cjs.js +565 -0
  7. package/dist/DatePicker/DatePicker.esm.js +552 -0
  8. package/dist/DatePicker/package.json +7 -0
  9. package/dist/FormControl/FormControl.cjs.js +2 -1
  10. package/dist/FormControl/FormControl.esm.js +2 -1
  11. package/dist/InformationCard/InformationCard.cjs.js +10 -9
  12. package/dist/InformationCard/InformationCard.esm.js +8 -7
  13. package/dist/MediaCard/MediaCard.cjs.js +56 -0
  14. package/dist/MediaCard/MediaCard.esm.js +48 -0
  15. package/dist/MediaCard/package.json +7 -0
  16. package/dist/Modal/Modal.cjs.js +13 -286
  17. package/dist/Modal/Modal.esm.js +6 -279
  18. package/dist/RadioGroup/RadioGroup.cjs.js +3 -2
  19. package/dist/RadioGroup/RadioGroup.esm.js +3 -2
  20. package/dist/Select/Select.cjs.js +31 -2705
  21. package/dist/Select/Select.esm.js +13 -2668
  22. package/dist/SiteFooter/SiteFooter.cjs.js +2 -2
  23. package/dist/SiteFooter/SiteFooter.esm.js +3 -3
  24. package/dist/SiteHeader/SiteHeader.cjs.js +2 -2
  25. package/dist/SiteHeader/SiteHeader.esm.js +2 -2
  26. package/dist/SiteHeaderV2/SiteHeaderV2.cjs.js +23 -0
  27. package/dist/SiteHeaderV2/SiteHeaderV2.esm.js +15 -0
  28. package/dist/SiteHeaderV2/package.json +7 -0
  29. package/dist/Switch/Switch.cjs.js +4 -3
  30. package/dist/Switch/Switch.esm.js +4 -3
  31. package/dist/Tabs/Tabs.cjs.js +5 -5
  32. package/dist/Tabs/Tabs.esm.js +5 -5
  33. package/dist/TextArea/TextArea.cjs.js +20 -20
  34. package/dist/TextArea/TextArea.esm.js +20 -20
  35. package/dist/TextInput/TextInput.cjs.js +3 -2
  36. package/dist/TextInput/TextInput.esm.js +3 -2
  37. package/dist/Toast/Toast.cjs.js +6 -7
  38. package/dist/Toast/Toast.esm.js +6 -7
  39. package/dist/TypographyCard/TypographyCard.cjs.js +13 -70
  40. package/dist/TypographyCard/TypographyCard.esm.js +14 -71
  41. package/dist/_shared/cjs/Calendar-18e255f8.js +4106 -0
  42. package/dist/_shared/cjs/CardFooter-43c32239.js +80 -0
  43. package/dist/_shared/cjs/CardLabel-768abf20.js +54 -0
  44. package/dist/_shared/cjs/{Checkbox-904ad028.js → Checkbox-4d4b432f.js} +1 -1
  45. package/dist/_shared/cjs/{index-3d69ea00.js → Combination-9974f2e2.js} +662 -145
  46. package/dist/_shared/cjs/{FormControl-166e0957.js → FormControl-b26ad353.js} +8 -5
  47. package/dist/_shared/cjs/{RadioGroup-1eddf86f.js → RadioGroup-23c964ae.js} +1 -1
  48. package/dist/_shared/cjs/{SiteFooter-97c27b29.js → SiteFooter-65b6360c.js} +2 -2
  49. package/dist/_shared/cjs/{SiteHeader.rehydrator-af3dddef.js → SiteHeader.rehydrator-df053a52.js} +8 -8
  50. package/dist/_shared/cjs/SiteHeaderV2-8ce6d4fc.js +610 -0
  51. package/dist/_shared/cjs/{Tabs-cc77dabb.js → Tabs-34db6bc1.js} +4 -4
  52. package/dist/_shared/cjs/{TextInput-fd9c756f.js → TextInput-d0370fa8.js} +19 -6
  53. package/dist/_shared/cjs/{Toast-91e96744.js → Toast-392b1d60.js} +292 -34
  54. package/dist/_shared/cjs/{index-84e6a68f.js → index-6eb396a3.js} +1 -1
  55. package/dist/_shared/cjs/{index-6542b467.js → index-74004a9c.js} +1 -1
  56. package/dist/_shared/cjs/index-77ab5c6a.js +2180 -0
  57. package/dist/_shared/cjs/{index-d31f2b65.js → index-9f99d686.js} +1 -1
  58. package/dist/_shared/cjs/{index-1641d0b4.js → index-a31e64a9.js} +1 -1
  59. package/dist/_shared/cjs/{index-49c72a87.js → index-d38f1bd0.js} +1 -1
  60. package/dist/_shared/esm/Calendar-4033fa48.js +4093 -0
  61. package/dist/_shared/esm/CardFooter-dd8d4000.js +74 -0
  62. package/dist/_shared/esm/CardLabel-d6d71407.js +46 -0
  63. package/dist/_shared/esm/{Checkbox-8a5bb9a1.js → Checkbox-720b074d.js} +1 -1
  64. package/dist/_shared/esm/{index-3e2bc99d.js → Combination-e9f7e64e.js} +643 -132
  65. package/dist/_shared/esm/{FormControl-9d4ddfec.js → FormControl-f0b8fe91.js} +8 -5
  66. package/dist/_shared/esm/{RadioGroup-238db88d.js → RadioGroup-37fdb06b.js} +1 -1
  67. package/dist/_shared/esm/{SiteFooter-94316b8b.js → SiteFooter-38ee1536.js} +1 -1
  68. package/dist/_shared/esm/{SiteHeader.rehydrator-1b507253.js → SiteHeader.rehydrator-32bdcd88.js} +2 -2
  69. package/dist/_shared/esm/SiteHeaderV2-f8377627.js +604 -0
  70. package/dist/_shared/esm/{Tabs-8719d952.js → Tabs-df9965dd.js} +4 -4
  71. package/dist/_shared/esm/{TextInput-c1e2a1dd.js → TextInput-abbab56b.js} +19 -6
  72. package/dist/_shared/esm/{Toast-7cb1e544.js → Toast-5d66e13f.js} +264 -7
  73. package/dist/_shared/esm/{index-39019a9b.js → index-044da8d0.js} +1 -1
  74. package/dist/_shared/esm/{index-6b7b075c.js → index-25a5b393.js} +1 -1
  75. package/dist/_shared/esm/{index-246b4f18.js → index-2cfab9f2.js} +1 -1
  76. package/dist/_shared/esm/{index-12f3a407.js → index-7b531fa7.js} +68 -68
  77. package/dist/_shared/esm/index-b84a20c6.js +2155 -0
  78. package/dist/_shared/esm/{index-db47e95a.js → index-ca72c9d5.js} +1 -1
  79. package/dist/_shared/esm/{index-936b5179.js → index-efa9be1a.js} +1 -1
  80. package/dist/_shared/esm/{index.es-c552c0ea.js → use-media-query-4c807227.js} +9 -9
  81. package/dist/index.es.js +1135 -791
  82. package/dist/index.es.js.map +1 -1
  83. package/dist/index.js +1136 -791
  84. package/dist/index.js.map +1 -1
  85. package/dist/styles.css +4 -4
  86. package/dist/types/components/Calendar/Calendar.d.ts +49 -0
  87. package/dist/types/components/Calendar/Calendar.provider.d.ts +21 -0
  88. package/dist/types/components/Calendar/components/CalendarDateSelect/CalendarDateSelect.d.ts +15 -0
  89. package/dist/types/components/Calendar/components/CalendarDateSelect/index.d.ts +1 -0
  90. package/dist/types/components/Calendar/components/CalendarDayGrid/CalendarDayGrid.d.ts +6 -0
  91. package/dist/types/components/Calendar/components/CalendarDayGrid/index.d.ts +1 -0
  92. package/dist/types/components/Calendar/components/CalendarDayNumber/CalendarDayNumber.d.ts +8 -0
  93. package/dist/types/components/Calendar/components/CalendarDayNumber/index.d.ts +1 -0
  94. package/dist/types/components/Calendar/components/CalendarDoubleMonthView/CalendarDoubleMonthView.d.ts +9 -0
  95. package/dist/types/components/Calendar/components/CalendarDoubleMonthView/index.d.ts +1 -0
  96. package/dist/types/components/Calendar/components/CalendarFooter/CalendarFooter.d.ts +6 -0
  97. package/dist/types/components/Calendar/components/CalendarFooter/index.d.ts +1 -0
  98. package/dist/types/components/Calendar/components/CalendarMonthView/CalendarMonthView.d.ts +9 -0
  99. package/dist/types/components/Calendar/components/CalendarMonthView/index.d.ts +1 -0
  100. package/dist/types/components/Calendar/components/CalendarMonthYearView/CalendarMonthYearView.d.ts +11 -0
  101. package/dist/types/components/Calendar/components/CalendarMonthYearView/index.d.ts +1 -0
  102. package/dist/types/components/Calendar/components/CalendarNavButton/CalendarNavButton.d.ts +10 -0
  103. package/dist/types/components/Calendar/components/CalendarNavButton/index.d.ts +1 -0
  104. package/dist/types/components/Calendar/components/CalendarWrapper/CalendarWrapper.d.ts +5 -0
  105. package/dist/types/components/Calendar/components/CalendarWrapper/index.d.ts +1 -0
  106. package/dist/types/components/Calendar/components/index.d.ts +6 -0
  107. package/dist/types/components/Calendar/constants/day-names.d.ts +5 -0
  108. package/dist/types/components/Calendar/constants/index.d.ts +1 -0
  109. package/dist/types/components/Calendar/helpers/contains-date.d.ts +1 -0
  110. package/dist/types/components/Calendar/helpers/contains-date.test.d.ts +1 -0
  111. package/dist/types/components/Calendar/helpers/date-without-time.d.ts +1 -0
  112. package/dist/types/components/Calendar/helpers/date-without-time.test.d.ts +1 -0
  113. package/dist/types/components/Calendar/helpers/get-calendar-type.d.ts +2 -0
  114. package/dist/types/components/Calendar/helpers/get-calendar-type.test.d.ts +1 -0
  115. package/dist/types/components/Calendar/helpers/get-dates-in-month.d.ts +1 -0
  116. package/dist/types/components/Calendar/helpers/get-dates-in-month.test.d.ts +1 -0
  117. package/dist/types/components/Calendar/helpers/get-double-month-display-range.d.ts +1 -0
  118. package/dist/types/components/Calendar/helpers/get-double-month-display-range.test.d.ts +1 -0
  119. package/dist/types/components/Calendar/helpers/get-focus-date.d.ts +5 -0
  120. package/dist/types/components/Calendar/helpers/get-focus-date.test.d.ts +1 -0
  121. package/dist/types/components/Calendar/helpers/get-highlighted-range.d.ts +6 -0
  122. package/dist/types/components/Calendar/helpers/get-highlighted-range.test.d.ts +1 -0
  123. package/dist/types/components/Calendar/helpers/get-keydown-date.d.ts +6 -0
  124. package/dist/types/components/Calendar/helpers/get-keydown-date.test.d.ts +1 -0
  125. package/dist/types/components/Calendar/helpers/index.d.ts +13 -0
  126. package/dist/types/components/Calendar/helpers/is-day.d.ts +2 -0
  127. package/dist/types/components/Calendar/helpers/is-day.test.d.ts +1 -0
  128. package/dist/types/components/Calendar/helpers/is-disabled-date.d.ts +1 -0
  129. package/dist/types/components/Calendar/helpers/is-disabled-date.test.d.ts +1 -0
  130. package/dist/types/components/Calendar/helpers/is-month-after-max-date.d.ts +1 -0
  131. package/dist/types/components/Calendar/helpers/is-month-after-max-date.test.d.ts +1 -0
  132. package/dist/types/components/Calendar/helpers/is-month-before-min-date.d.ts +1 -0
  133. package/dist/types/components/Calendar/helpers/is-month-before-min-date.test.d.ts +1 -0
  134. package/dist/types/components/Calendar/helpers/process-selected-range.d.ts +9 -0
  135. package/dist/types/components/Calendar/helpers/process-selected-range.test.d.ts +1 -0
  136. package/dist/types/components/Calendar/index.d.ts +2 -0
  137. package/dist/types/components/Calendar/state/handlers/calendar-keydown-handler.d.ts +3 -0
  138. package/dist/types/components/Calendar/state/handlers/day-grid-leave-handler.d.ts +3 -0
  139. package/dist/types/components/Calendar/state/handlers/day-number-select-handler.d.ts +3 -0
  140. package/dist/types/components/Calendar/state/handlers/default-handler.d.ts +2 -0
  141. package/dist/types/components/Calendar/state/handlers/dropdown-change-month-handler.d.ts +3 -0
  142. package/dist/types/components/Calendar/state/handlers/dropdown-change-year-handler.d.ts +3 -0
  143. package/dist/types/components/Calendar/state/handlers/highlight-range-handler.d.ts +3 -0
  144. package/dist/types/components/Calendar/state/handlers/index.d.ts +12 -0
  145. package/dist/types/components/Calendar/state/handlers/range-select-handler.d.ts +3 -0
  146. package/dist/types/components/Calendar/state/handlers/show-next-double-month-handler.d.ts +3 -0
  147. package/dist/types/components/Calendar/state/handlers/show-next-month-handler.d.ts +3 -0
  148. package/dist/types/components/Calendar/state/handlers/show-previous-double-month-handler.d.ts +3 -0
  149. package/dist/types/components/Calendar/state/handlers/show-previous-month-handler.d.ts +3 -0
  150. package/dist/types/components/Calendar/state/index.d.ts +2 -0
  151. package/dist/types/components/Calendar/state/reducer.d.ts +3 -0
  152. package/dist/types/components/Calendar/state/reducer.test.d.ts +1 -0
  153. package/dist/types/components/Calendar/state/types/actions.d.ts +81 -0
  154. package/dist/types/components/Calendar/state/types/state-handler.d.ts +3 -0
  155. package/dist/types/components/Calendar/state/types/state.d.ts +5 -0
  156. package/dist/types/components/Calendar/types/calendar-type.d.ts +1 -0
  157. package/dist/types/components/Calendar/types/date-select-value.d.ts +2 -0
  158. package/dist/types/components/Calendar/types/index.d.ts +6 -0
  159. package/dist/types/components/Calendar/types/key-names.d.ts +13 -0
  160. package/dist/types/components/Calendar/types/range-selection.d.ts +10 -0
  161. package/dist/types/components/Calendar/types/selection-type.d.ts +1 -0
  162. package/dist/types/components/Calendar/types/week-days.d.ts +18 -0
  163. package/dist/types/components/DatePicker/DatePicker.d.ts +17 -0
  164. package/dist/types/components/DatePicker/constants/date-format.d.ts +1 -0
  165. package/dist/types/components/DatePicker/constants/index.d.ts +1 -0
  166. package/dist/types/components/DatePicker/helpers/convert-date-string-to-date.d.ts +1 -0
  167. package/dist/types/components/DatePicker/helpers/convert-date-string-to-date.test.d.ts +1 -0
  168. package/dist/types/components/DatePicker/helpers/convert-range-string-to-dates.d.ts +1 -0
  169. package/dist/types/components/DatePicker/helpers/convert-range-string-to-dates.test.d.ts +1 -0
  170. package/dist/types/components/DatePicker/helpers/format-date.d.ts +1 -0
  171. package/dist/types/components/DatePicker/helpers/format-date.test.d.ts +1 -0
  172. package/dist/types/components/DatePicker/helpers/index.d.ts +8 -0
  173. package/dist/types/components/DatePicker/helpers/is-date-valid.d.ts +1 -0
  174. package/dist/types/components/DatePicker/helpers/is-date-valid.test.d.ts +1 -0
  175. package/dist/types/components/DatePicker/helpers/is-disabled-date.d.ts +1 -0
  176. package/dist/types/components/DatePicker/helpers/is-disabled-date.test.d.ts +1 -0
  177. package/dist/types/components/DatePicker/helpers/is-range-valid.d.ts +1 -0
  178. package/dist/types/components/DatePicker/helpers/is-range-valid.test.d.ts +1 -0
  179. package/dist/types/components/DatePicker/helpers/parse-date-string.d.ts +5 -0
  180. package/dist/types/components/DatePicker/helpers/parse-date-string.test.d.ts +1 -0
  181. package/dist/types/components/DatePicker/helpers/parse-range-string.d.ts +14 -0
  182. package/dist/types/components/DatePicker/helpers/parse-range-string.test.d.ts +1 -0
  183. package/dist/types/components/DatePicker/index.d.ts +6 -0
  184. package/dist/types/components/FormControl/FormControl.d.ts +4 -0
  185. package/dist/types/components/RadioGroup/RadioGroup.d.ts +1 -1
  186. package/dist/types/components/SiteHeaderV2/SiteHeaderV2.d.ts +77 -0
  187. package/dist/types/components/SiteHeaderV2/components/BackButton/BackButton.d.ts +5 -0
  188. package/dist/types/components/SiteHeaderV2/components/BackButton/index.d.ts +1 -0
  189. package/dist/types/components/SiteHeaderV2/components/Column/Column.d.ts +8 -0
  190. package/dist/types/components/SiteHeaderV2/components/Column/index.d.ts +1 -0
  191. package/dist/types/components/SiteHeaderV2/components/HorizontalPanel/HorizontalPanel.d.ts +13 -0
  192. package/dist/types/components/SiteHeaderV2/components/HorizontalPanel/index.d.ts +1 -0
  193. package/dist/types/components/SiteHeaderV2/components/Item/Item.d.ts +20 -0
  194. package/dist/types/components/SiteHeaderV2/components/Item/index.d.ts +1 -0
  195. package/dist/types/components/SiteHeaderV2/components/ItemGroup/ItemGroup.d.ts +27 -0
  196. package/dist/types/components/SiteHeaderV2/components/ItemGroup/index.d.ts +1 -0
  197. package/dist/types/components/SiteHeaderV2/components/MenuButton/MenuButton.d.ts +6 -0
  198. package/dist/types/components/SiteHeaderV2/components/MenuButton/index.d.ts +1 -0
  199. package/dist/types/components/SiteHeaderV2/components/NavItem/NavItem.d.ts +40 -0
  200. package/dist/types/components/SiteHeaderV2/components/NavItem/NavItemWithSubNav.d.ts +55 -0
  201. package/dist/types/components/SiteHeaderV2/components/NavItem/index.d.ts +2 -0
  202. package/dist/types/components/SiteHeaderV2/components/NodeItem/NodeItem.d.ts +8 -0
  203. package/dist/types/components/SiteHeaderV2/components/Panel/Panel.d.ts +26 -0
  204. package/dist/types/components/SiteHeaderV2/components/Panel/index.d.ts +1 -0
  205. package/dist/types/components/SiteHeaderV2/components/SubNavItem/SubNavItem.d.ts +45 -0
  206. package/dist/types/components/SiteHeaderV2/components/SubNavItem/index.d.ts +1 -0
  207. package/dist/types/components/SiteHeaderV2/components/VerticalDivider/VerticalDivider.d.ts +1 -0
  208. package/dist/types/components/SiteHeaderV2/components/VerticalDivider/index.d.ts +1 -0
  209. package/dist/types/components/SiteHeaderV2/index.d.ts +1 -0
  210. package/dist/types/components/TextArea/TextArea.d.ts +4 -0
  211. package/dist/types/components/TextInput/TextInput.d.ts +22 -3
  212. package/dist/types/components/index.d.ts +1 -0
  213. package/dist/types/private-components/CardFooter/CardFooter.d.ts +11 -0
  214. package/dist/types/private-components/CardFooter/index.d.ts +1 -0
  215. package/dist/types/private-components/CardHeading/CardHeading.d.ts +19 -0
  216. package/dist/types/private-components/CardHeading/index.d.ts +1 -0
  217. package/dist/types/private-components/CardLabel/CardLabel.d.ts +10 -0
  218. package/dist/types/private-components/CardLabel/index.d.ts +1 -0
  219. package/dist/types/private-components/index.d.ts +4 -0
  220. package/dist/types/styles.d.ts +6 -0
  221. package/package.json +4 -2
  222. package/dist/_shared/cjs/BtIconArrowRight.esm-8e8ac316.js +0 -30
  223. package/dist/_shared/cjs/index-4ecad2dd.js +0 -273
  224. package/dist/_shared/esm/BtIconArrowRight.esm-267916a4.js +0 -24
  225. package/dist/_shared/esm/index-d0307140.js +0 -264
  226. package/dist/types/internal-components/index.d.ts +0 -1
  227. package/dist/_shared/cjs/{index-56a040f4.js → index-dd1d18ea.js} +66 -66
  228. package/dist/_shared/cjs/{index.es-26dd8c5d.js → use-media-query-e61881d8.js} +8 -8
  229. /package/dist/types/{internal-components → private-components}/ConditionalWrapper/ConditionalWrapper.d.ts +0 -0
  230. /package/dist/types/{internal-components → private-components}/ConditionalWrapper/index.d.ts +0 -0
@@ -0,0 +1,2155 @@
1
+ import { _ as _extends } from './extends-8cc61aad.js';
2
+ import * as React from 'react';
3
+ import { useLayoutEffect, useEffect, useState, createElement, forwardRef, useRef } from 'react';
4
+ import * as $7SXl2$reactdom from 'react-dom';
5
+ import { h as $9f79659886946c16$export$e5c5a5f917a5871c, $ as $c512c27ab02ef895$export$50c7b4e9d9f19c1, b as $6ed0406888f73fc4$export$c7b2cbe3552a0d05, e as $8927f6f2acc4f386$export$250ffa63cdc0d034, f as $b1b2314f5f9a1d84$export$25bec8c6f54ee79a } from './index-7b531fa7.js';
6
+
7
+ const sides = ['top', 'right', 'bottom', 'left'];
8
+ const min = Math.min;
9
+ const max = Math.max;
10
+ const round = Math.round;
11
+ const floor = Math.floor;
12
+ const createCoords = v => ({
13
+ x: v,
14
+ y: v
15
+ });
16
+ const oppositeSideMap = {
17
+ left: 'right',
18
+ right: 'left',
19
+ bottom: 'top',
20
+ top: 'bottom'
21
+ };
22
+ const oppositeAlignmentMap = {
23
+ start: 'end',
24
+ end: 'start'
25
+ };
26
+ function clamp(start, value, end) {
27
+ return max(start, min(value, end));
28
+ }
29
+ function evaluate(value, param) {
30
+ return typeof value === 'function' ? value(param) : value;
31
+ }
32
+ function getSide(placement) {
33
+ return placement.split('-')[0];
34
+ }
35
+ function getAlignment(placement) {
36
+ return placement.split('-')[1];
37
+ }
38
+ function getOppositeAxis(axis) {
39
+ return axis === 'x' ? 'y' : 'x';
40
+ }
41
+ function getAxisLength(axis) {
42
+ return axis === 'y' ? 'height' : 'width';
43
+ }
44
+ function getSideAxis(placement) {
45
+ return ['top', 'bottom'].includes(getSide(placement)) ? 'y' : 'x';
46
+ }
47
+ function getAlignmentAxis(placement) {
48
+ return getOppositeAxis(getSideAxis(placement));
49
+ }
50
+ function getAlignmentSides(placement, rects, rtl) {
51
+ if (rtl === void 0) {
52
+ rtl = false;
53
+ }
54
+ const alignment = getAlignment(placement);
55
+ const alignmentAxis = getAlignmentAxis(placement);
56
+ const length = getAxisLength(alignmentAxis);
57
+ let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
58
+ if (rects.reference[length] > rects.floating[length]) {
59
+ mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
60
+ }
61
+ return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
62
+ }
63
+ function getExpandedPlacements(placement) {
64
+ const oppositePlacement = getOppositePlacement(placement);
65
+ return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
66
+ }
67
+ function getOppositeAlignmentPlacement(placement) {
68
+ return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
69
+ }
70
+ function getSideList(side, isStart, rtl) {
71
+ const lr = ['left', 'right'];
72
+ const rl = ['right', 'left'];
73
+ const tb = ['top', 'bottom'];
74
+ const bt = ['bottom', 'top'];
75
+ switch (side) {
76
+ case 'top':
77
+ case 'bottom':
78
+ if (rtl) return isStart ? rl : lr;
79
+ return isStart ? lr : rl;
80
+ case 'left':
81
+ case 'right':
82
+ return isStart ? tb : bt;
83
+ default:
84
+ return [];
85
+ }
86
+ }
87
+ function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
88
+ const alignment = getAlignment(placement);
89
+ let list = getSideList(getSide(placement), direction === 'start', rtl);
90
+ if (alignment) {
91
+ list = list.map(side => side + "-" + alignment);
92
+ if (flipAlignment) {
93
+ list = list.concat(list.map(getOppositeAlignmentPlacement));
94
+ }
95
+ }
96
+ return list;
97
+ }
98
+ function getOppositePlacement(placement) {
99
+ return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);
100
+ }
101
+ function expandPaddingObject(padding) {
102
+ return {
103
+ top: 0,
104
+ right: 0,
105
+ bottom: 0,
106
+ left: 0,
107
+ ...padding
108
+ };
109
+ }
110
+ function getPaddingObject(padding) {
111
+ return typeof padding !== 'number' ? expandPaddingObject(padding) : {
112
+ top: padding,
113
+ right: padding,
114
+ bottom: padding,
115
+ left: padding
116
+ };
117
+ }
118
+ function rectToClientRect(rect) {
119
+ return {
120
+ ...rect,
121
+ top: rect.y,
122
+ left: rect.x,
123
+ right: rect.x + rect.width,
124
+ bottom: rect.y + rect.height
125
+ };
126
+ }
127
+
128
+ function computeCoordsFromPlacement(_ref, placement, rtl) {
129
+ let {
130
+ reference,
131
+ floating
132
+ } = _ref;
133
+ const sideAxis = getSideAxis(placement);
134
+ const alignmentAxis = getAlignmentAxis(placement);
135
+ const alignLength = getAxisLength(alignmentAxis);
136
+ const side = getSide(placement);
137
+ const isVertical = sideAxis === 'y';
138
+ const commonX = reference.x + reference.width / 2 - floating.width / 2;
139
+ const commonY = reference.y + reference.height / 2 - floating.height / 2;
140
+ const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
141
+ let coords;
142
+ switch (side) {
143
+ case 'top':
144
+ coords = {
145
+ x: commonX,
146
+ y: reference.y - floating.height
147
+ };
148
+ break;
149
+ case 'bottom':
150
+ coords = {
151
+ x: commonX,
152
+ y: reference.y + reference.height
153
+ };
154
+ break;
155
+ case 'right':
156
+ coords = {
157
+ x: reference.x + reference.width,
158
+ y: commonY
159
+ };
160
+ break;
161
+ case 'left':
162
+ coords = {
163
+ x: reference.x - floating.width,
164
+ y: commonY
165
+ };
166
+ break;
167
+ default:
168
+ coords = {
169
+ x: reference.x,
170
+ y: reference.y
171
+ };
172
+ }
173
+ switch (getAlignment(placement)) {
174
+ case 'start':
175
+ coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
176
+ break;
177
+ case 'end':
178
+ coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
179
+ break;
180
+ }
181
+ return coords;
182
+ }
183
+
184
+ /**
185
+ * Computes the `x` and `y` coordinates that will place the floating element
186
+ * next to a reference element when it is given a certain positioning strategy.
187
+ *
188
+ * This export does not have any `platform` interface logic. You will need to
189
+ * write one for the platform you are using Floating UI with.
190
+ */
191
+ const computePosition$1 = async (reference, floating, config) => {
192
+ const {
193
+ placement = 'bottom',
194
+ strategy = 'absolute',
195
+ middleware = [],
196
+ platform
197
+ } = config;
198
+ const validMiddleware = middleware.filter(Boolean);
199
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
200
+ let rects = await platform.getElementRects({
201
+ reference,
202
+ floating,
203
+ strategy
204
+ });
205
+ let {
206
+ x,
207
+ y
208
+ } = computeCoordsFromPlacement(rects, placement, rtl);
209
+ let statefulPlacement = placement;
210
+ let middlewareData = {};
211
+ let resetCount = 0;
212
+ for (let i = 0; i < validMiddleware.length; i++) {
213
+ const {
214
+ name,
215
+ fn
216
+ } = validMiddleware[i];
217
+ const {
218
+ x: nextX,
219
+ y: nextY,
220
+ data,
221
+ reset
222
+ } = await fn({
223
+ x,
224
+ y,
225
+ initialPlacement: placement,
226
+ placement: statefulPlacement,
227
+ strategy,
228
+ middlewareData,
229
+ rects,
230
+ platform,
231
+ elements: {
232
+ reference,
233
+ floating
234
+ }
235
+ });
236
+ x = nextX != null ? nextX : x;
237
+ y = nextY != null ? nextY : y;
238
+ middlewareData = {
239
+ ...middlewareData,
240
+ [name]: {
241
+ ...middlewareData[name],
242
+ ...data
243
+ }
244
+ };
245
+ if (reset && resetCount <= 50) {
246
+ resetCount++;
247
+ if (typeof reset === 'object') {
248
+ if (reset.placement) {
249
+ statefulPlacement = reset.placement;
250
+ }
251
+ if (reset.rects) {
252
+ rects = reset.rects === true ? await platform.getElementRects({
253
+ reference,
254
+ floating,
255
+ strategy
256
+ }) : reset.rects;
257
+ }
258
+ ({
259
+ x,
260
+ y
261
+ } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
262
+ }
263
+ i = -1;
264
+ continue;
265
+ }
266
+ }
267
+ return {
268
+ x,
269
+ y,
270
+ placement: statefulPlacement,
271
+ strategy,
272
+ middlewareData
273
+ };
274
+ };
275
+
276
+ /**
277
+ * Resolves with an object of overflow side offsets that determine how much the
278
+ * element is overflowing a given clipping boundary on each side.
279
+ * - positive = overflowing the boundary by that number of pixels
280
+ * - negative = how many pixels left before it will overflow
281
+ * - 0 = lies flush with the boundary
282
+ * @see https://floating-ui.com/docs/detectOverflow
283
+ */
284
+ async function detectOverflow(state, options) {
285
+ var _await$platform$isEle;
286
+ if (options === void 0) {
287
+ options = {};
288
+ }
289
+ const {
290
+ x,
291
+ y,
292
+ platform,
293
+ rects,
294
+ elements,
295
+ strategy
296
+ } = state;
297
+ const {
298
+ boundary = 'clippingAncestors',
299
+ rootBoundary = 'viewport',
300
+ elementContext = 'floating',
301
+ altBoundary = false,
302
+ padding = 0
303
+ } = evaluate(options, state);
304
+ const paddingObject = getPaddingObject(padding);
305
+ const altContext = elementContext === 'floating' ? 'reference' : 'floating';
306
+ const element = elements[altBoundary ? altContext : elementContext];
307
+ const clippingClientRect = rectToClientRect(await platform.getClippingRect({
308
+ element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),
309
+ boundary,
310
+ rootBoundary,
311
+ strategy
312
+ }));
313
+ const rect = elementContext === 'floating' ? {
314
+ ...rects.floating,
315
+ x,
316
+ y
317
+ } : rects.reference;
318
+ const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
319
+ const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
320
+ x: 1,
321
+ y: 1
322
+ } : {
323
+ x: 1,
324
+ y: 1
325
+ };
326
+ const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
327
+ rect,
328
+ offsetParent,
329
+ strategy
330
+ }) : rect);
331
+ return {
332
+ top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
333
+ bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
334
+ left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
335
+ right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
336
+ };
337
+ }
338
+
339
+ /**
340
+ * Provides data to position an inner element of the floating element so that it
341
+ * appears centered to the reference element.
342
+ * @see https://floating-ui.com/docs/arrow
343
+ */
344
+ const arrow$1 = options => ({
345
+ name: 'arrow',
346
+ options,
347
+ async fn(state) {
348
+ const {
349
+ x,
350
+ y,
351
+ placement,
352
+ rects,
353
+ platform,
354
+ elements,
355
+ middlewareData
356
+ } = state;
357
+ // Since `element` is required, we don't Partial<> the type.
358
+ const {
359
+ element,
360
+ padding = 0
361
+ } = evaluate(options, state) || {};
362
+ if (element == null) {
363
+ return {};
364
+ }
365
+ const paddingObject = getPaddingObject(padding);
366
+ const coords = {
367
+ x,
368
+ y
369
+ };
370
+ const axis = getAlignmentAxis(placement);
371
+ const length = getAxisLength(axis);
372
+ const arrowDimensions = await platform.getDimensions(element);
373
+ const isYAxis = axis === 'y';
374
+ const minProp = isYAxis ? 'top' : 'left';
375
+ const maxProp = isYAxis ? 'bottom' : 'right';
376
+ const clientProp = isYAxis ? 'clientHeight' : 'clientWidth';
377
+ const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
378
+ const startDiff = coords[axis] - rects.reference[axis];
379
+ const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
380
+ let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
381
+
382
+ // DOM platform can return `window` as the `offsetParent`.
383
+ if (!clientSize || !(await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent)))) {
384
+ clientSize = elements.floating[clientProp] || rects.floating[length];
385
+ }
386
+ const centerToReference = endDiff / 2 - startDiff / 2;
387
+
388
+ // If the padding is large enough that it causes the arrow to no longer be
389
+ // centered, modify the padding so that it is centered.
390
+ const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
391
+ const minPadding = min(paddingObject[minProp], largestPossiblePadding);
392
+ const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);
393
+
394
+ // Make sure the arrow doesn't overflow the floating element if the center
395
+ // point is outside the floating element's bounds.
396
+ const min$1 = minPadding;
397
+ const max = clientSize - arrowDimensions[length] - maxPadding;
398
+ const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
399
+ const offset = clamp(min$1, center, max);
400
+
401
+ // If the reference is small enough that the arrow's padding causes it to
402
+ // to point to nothing for an aligned placement, adjust the offset of the
403
+ // floating element itself. To ensure `shift()` continues to take action,
404
+ // a single reset is performed when this is true.
405
+ const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center != offset && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
406
+ const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max : 0;
407
+ return {
408
+ [axis]: coords[axis] + alignmentOffset,
409
+ data: {
410
+ [axis]: offset,
411
+ centerOffset: center - offset - alignmentOffset,
412
+ ...(shouldAddOffset && {
413
+ alignmentOffset
414
+ })
415
+ },
416
+ reset: shouldAddOffset
417
+ };
418
+ }
419
+ });
420
+
421
+ /**
422
+ * Optimizes the visibility of the floating element by flipping the `placement`
423
+ * in order to keep it in view when the preferred placement(s) will overflow the
424
+ * clipping boundary. Alternative to `autoPlacement`.
425
+ * @see https://floating-ui.com/docs/flip
426
+ */
427
+ const flip = function (options) {
428
+ if (options === void 0) {
429
+ options = {};
430
+ }
431
+ return {
432
+ name: 'flip',
433
+ options,
434
+ async fn(state) {
435
+ var _middlewareData$arrow, _middlewareData$flip;
436
+ const {
437
+ placement,
438
+ middlewareData,
439
+ rects,
440
+ initialPlacement,
441
+ platform,
442
+ elements
443
+ } = state;
444
+ const {
445
+ mainAxis: checkMainAxis = true,
446
+ crossAxis: checkCrossAxis = true,
447
+ fallbackPlacements: specifiedFallbackPlacements,
448
+ fallbackStrategy = 'bestFit',
449
+ fallbackAxisSideDirection = 'none',
450
+ flipAlignment = true,
451
+ ...detectOverflowOptions
452
+ } = evaluate(options, state);
453
+
454
+ // If a reset by the arrow was caused due to an alignment offset being
455
+ // added, we should skip any logic now since `flip()` has already done its
456
+ // work.
457
+ // https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643
458
+ if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
459
+ return {};
460
+ }
461
+ const side = getSide(placement);
462
+ const isBasePlacement = getSide(initialPlacement) === initialPlacement;
463
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
464
+ const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
465
+ if (!specifiedFallbackPlacements && fallbackAxisSideDirection !== 'none') {
466
+ fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
467
+ }
468
+ const placements = [initialPlacement, ...fallbackPlacements];
469
+ const overflow = await detectOverflow(state, detectOverflowOptions);
470
+ const overflows = [];
471
+ let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
472
+ if (checkMainAxis) {
473
+ overflows.push(overflow[side]);
474
+ }
475
+ if (checkCrossAxis) {
476
+ const sides = getAlignmentSides(placement, rects, rtl);
477
+ overflows.push(overflow[sides[0]], overflow[sides[1]]);
478
+ }
479
+ overflowsData = [...overflowsData, {
480
+ placement,
481
+ overflows
482
+ }];
483
+
484
+ // One or more sides is overflowing.
485
+ if (!overflows.every(side => side <= 0)) {
486
+ var _middlewareData$flip2, _overflowsData$filter;
487
+ const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
488
+ const nextPlacement = placements[nextIndex];
489
+ if (nextPlacement) {
490
+ // Try next placement and re-run the lifecycle.
491
+ return {
492
+ data: {
493
+ index: nextIndex,
494
+ overflows: overflowsData
495
+ },
496
+ reset: {
497
+ placement: nextPlacement
498
+ }
499
+ };
500
+ }
501
+
502
+ // First, find the candidates that fit on the mainAxis side of overflow,
503
+ // then find the placement that fits the best on the main crossAxis side.
504
+ let resetPlacement = (_overflowsData$filter = overflowsData.filter(d => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
505
+
506
+ // Otherwise fallback.
507
+ if (!resetPlacement) {
508
+ switch (fallbackStrategy) {
509
+ case 'bestFit':
510
+ {
511
+ var _overflowsData$map$so;
512
+ const placement = (_overflowsData$map$so = overflowsData.map(d => [d.placement, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$map$so[0];
513
+ if (placement) {
514
+ resetPlacement = placement;
515
+ }
516
+ break;
517
+ }
518
+ case 'initialPlacement':
519
+ resetPlacement = initialPlacement;
520
+ break;
521
+ }
522
+ }
523
+ if (placement !== resetPlacement) {
524
+ return {
525
+ reset: {
526
+ placement: resetPlacement
527
+ }
528
+ };
529
+ }
530
+ }
531
+ return {};
532
+ }
533
+ };
534
+ };
535
+
536
+ function getSideOffsets(overflow, rect) {
537
+ return {
538
+ top: overflow.top - rect.height,
539
+ right: overflow.right - rect.width,
540
+ bottom: overflow.bottom - rect.height,
541
+ left: overflow.left - rect.width
542
+ };
543
+ }
544
+ function isAnySideFullyClipped(overflow) {
545
+ return sides.some(side => overflow[side] >= 0);
546
+ }
547
+ /**
548
+ * Provides data to hide the floating element in applicable situations, such as
549
+ * when it is not in the same clipping context as the reference element.
550
+ * @see https://floating-ui.com/docs/hide
551
+ */
552
+ const hide = function (options) {
553
+ if (options === void 0) {
554
+ options = {};
555
+ }
556
+ return {
557
+ name: 'hide',
558
+ options,
559
+ async fn(state) {
560
+ const {
561
+ rects
562
+ } = state;
563
+ const {
564
+ strategy = 'referenceHidden',
565
+ ...detectOverflowOptions
566
+ } = evaluate(options, state);
567
+ switch (strategy) {
568
+ case 'referenceHidden':
569
+ {
570
+ const overflow = await detectOverflow(state, {
571
+ ...detectOverflowOptions,
572
+ elementContext: 'reference'
573
+ });
574
+ const offsets = getSideOffsets(overflow, rects.reference);
575
+ return {
576
+ data: {
577
+ referenceHiddenOffsets: offsets,
578
+ referenceHidden: isAnySideFullyClipped(offsets)
579
+ }
580
+ };
581
+ }
582
+ case 'escaped':
583
+ {
584
+ const overflow = await detectOverflow(state, {
585
+ ...detectOverflowOptions,
586
+ altBoundary: true
587
+ });
588
+ const offsets = getSideOffsets(overflow, rects.floating);
589
+ return {
590
+ data: {
591
+ escapedOffsets: offsets,
592
+ escaped: isAnySideFullyClipped(offsets)
593
+ }
594
+ };
595
+ }
596
+ default:
597
+ {
598
+ return {};
599
+ }
600
+ }
601
+ }
602
+ };
603
+ };
604
+
605
+ // For type backwards-compatibility, the `OffsetOptions` type was also
606
+ // Derivable.
607
+ async function convertValueToCoords(state, options) {
608
+ const {
609
+ placement,
610
+ platform,
611
+ elements
612
+ } = state;
613
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
614
+ const side = getSide(placement);
615
+ const alignment = getAlignment(placement);
616
+ const isVertical = getSideAxis(placement) === 'y';
617
+ const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
618
+ const crossAxisMulti = rtl && isVertical ? -1 : 1;
619
+ const rawValue = evaluate(options, state);
620
+
621
+ // eslint-disable-next-line prefer-const
622
+ let {
623
+ mainAxis,
624
+ crossAxis,
625
+ alignmentAxis
626
+ } = typeof rawValue === 'number' ? {
627
+ mainAxis: rawValue,
628
+ crossAxis: 0,
629
+ alignmentAxis: null
630
+ } : {
631
+ mainAxis: 0,
632
+ crossAxis: 0,
633
+ alignmentAxis: null,
634
+ ...rawValue
635
+ };
636
+ if (alignment && typeof alignmentAxis === 'number') {
637
+ crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
638
+ }
639
+ return isVertical ? {
640
+ x: crossAxis * crossAxisMulti,
641
+ y: mainAxis * mainAxisMulti
642
+ } : {
643
+ x: mainAxis * mainAxisMulti,
644
+ y: crossAxis * crossAxisMulti
645
+ };
646
+ }
647
+
648
+ /**
649
+ * Modifies the placement by translating the floating element along the
650
+ * specified axes.
651
+ * A number (shorthand for `mainAxis` or distance), or an axes configuration
652
+ * object may be passed.
653
+ * @see https://floating-ui.com/docs/offset
654
+ */
655
+ const offset = function (options) {
656
+ if (options === void 0) {
657
+ options = 0;
658
+ }
659
+ return {
660
+ name: 'offset',
661
+ options,
662
+ async fn(state) {
663
+ const {
664
+ x,
665
+ y
666
+ } = state;
667
+ const diffCoords = await convertValueToCoords(state, options);
668
+ return {
669
+ x: x + diffCoords.x,
670
+ y: y + diffCoords.y,
671
+ data: diffCoords
672
+ };
673
+ }
674
+ };
675
+ };
676
+
677
+ /**
678
+ * Optimizes the visibility of the floating element by shifting it in order to
679
+ * keep it in view when it will overflow the clipping boundary.
680
+ * @see https://floating-ui.com/docs/shift
681
+ */
682
+ const shift = function (options) {
683
+ if (options === void 0) {
684
+ options = {};
685
+ }
686
+ return {
687
+ name: 'shift',
688
+ options,
689
+ async fn(state) {
690
+ const {
691
+ x,
692
+ y,
693
+ placement
694
+ } = state;
695
+ const {
696
+ mainAxis: checkMainAxis = true,
697
+ crossAxis: checkCrossAxis = false,
698
+ limiter = {
699
+ fn: _ref => {
700
+ let {
701
+ x,
702
+ y
703
+ } = _ref;
704
+ return {
705
+ x,
706
+ y
707
+ };
708
+ }
709
+ },
710
+ ...detectOverflowOptions
711
+ } = evaluate(options, state);
712
+ const coords = {
713
+ x,
714
+ y
715
+ };
716
+ const overflow = await detectOverflow(state, detectOverflowOptions);
717
+ const crossAxis = getSideAxis(getSide(placement));
718
+ const mainAxis = getOppositeAxis(crossAxis);
719
+ let mainAxisCoord = coords[mainAxis];
720
+ let crossAxisCoord = coords[crossAxis];
721
+ if (checkMainAxis) {
722
+ const minSide = mainAxis === 'y' ? 'top' : 'left';
723
+ const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
724
+ const min = mainAxisCoord + overflow[minSide];
725
+ const max = mainAxisCoord - overflow[maxSide];
726
+ mainAxisCoord = clamp(min, mainAxisCoord, max);
727
+ }
728
+ if (checkCrossAxis) {
729
+ const minSide = crossAxis === 'y' ? 'top' : 'left';
730
+ const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
731
+ const min = crossAxisCoord + overflow[minSide];
732
+ const max = crossAxisCoord - overflow[maxSide];
733
+ crossAxisCoord = clamp(min, crossAxisCoord, max);
734
+ }
735
+ const limitedCoords = limiter.fn({
736
+ ...state,
737
+ [mainAxis]: mainAxisCoord,
738
+ [crossAxis]: crossAxisCoord
739
+ });
740
+ return {
741
+ ...limitedCoords,
742
+ data: {
743
+ x: limitedCoords.x - x,
744
+ y: limitedCoords.y - y
745
+ }
746
+ };
747
+ }
748
+ };
749
+ };
750
+ /**
751
+ * Built-in `limiter` that will stop `shift()` at a certain point.
752
+ */
753
+ const limitShift = function (options) {
754
+ if (options === void 0) {
755
+ options = {};
756
+ }
757
+ return {
758
+ options,
759
+ fn(state) {
760
+ const {
761
+ x,
762
+ y,
763
+ placement,
764
+ rects,
765
+ middlewareData
766
+ } = state;
767
+ const {
768
+ offset = 0,
769
+ mainAxis: checkMainAxis = true,
770
+ crossAxis: checkCrossAxis = true
771
+ } = evaluate(options, state);
772
+ const coords = {
773
+ x,
774
+ y
775
+ };
776
+ const crossAxis = getSideAxis(placement);
777
+ const mainAxis = getOppositeAxis(crossAxis);
778
+ let mainAxisCoord = coords[mainAxis];
779
+ let crossAxisCoord = coords[crossAxis];
780
+ const rawOffset = evaluate(offset, state);
781
+ const computedOffset = typeof rawOffset === 'number' ? {
782
+ mainAxis: rawOffset,
783
+ crossAxis: 0
784
+ } : {
785
+ mainAxis: 0,
786
+ crossAxis: 0,
787
+ ...rawOffset
788
+ };
789
+ if (checkMainAxis) {
790
+ const len = mainAxis === 'y' ? 'height' : 'width';
791
+ const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;
792
+ const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;
793
+ if (mainAxisCoord < limitMin) {
794
+ mainAxisCoord = limitMin;
795
+ } else if (mainAxisCoord > limitMax) {
796
+ mainAxisCoord = limitMax;
797
+ }
798
+ }
799
+ if (checkCrossAxis) {
800
+ var _middlewareData$offse, _middlewareData$offse2;
801
+ const len = mainAxis === 'y' ? 'width' : 'height';
802
+ const isOriginSide = ['top', 'left'].includes(getSide(placement));
803
+ const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);
804
+ const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);
805
+ if (crossAxisCoord < limitMin) {
806
+ crossAxisCoord = limitMin;
807
+ } else if (crossAxisCoord > limitMax) {
808
+ crossAxisCoord = limitMax;
809
+ }
810
+ }
811
+ return {
812
+ [mainAxis]: mainAxisCoord,
813
+ [crossAxis]: crossAxisCoord
814
+ };
815
+ }
816
+ };
817
+ };
818
+
819
+ /**
820
+ * Provides data that allows you to change the size of the floating element —
821
+ * for instance, prevent it from overflowing the clipping boundary or match the
822
+ * width of the reference element.
823
+ * @see https://floating-ui.com/docs/size
824
+ */
825
+ const size = function (options) {
826
+ if (options === void 0) {
827
+ options = {};
828
+ }
829
+ return {
830
+ name: 'size',
831
+ options,
832
+ async fn(state) {
833
+ const {
834
+ placement,
835
+ rects,
836
+ platform,
837
+ elements
838
+ } = state;
839
+ const {
840
+ apply = () => {},
841
+ ...detectOverflowOptions
842
+ } = evaluate(options, state);
843
+ const overflow = await detectOverflow(state, detectOverflowOptions);
844
+ const side = getSide(placement);
845
+ const alignment = getAlignment(placement);
846
+ const isYAxis = getSideAxis(placement) === 'y';
847
+ const {
848
+ width,
849
+ height
850
+ } = rects.floating;
851
+ let heightSide;
852
+ let widthSide;
853
+ if (side === 'top' || side === 'bottom') {
854
+ heightSide = side;
855
+ widthSide = alignment === ((await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))) ? 'start' : 'end') ? 'left' : 'right';
856
+ } else {
857
+ widthSide = side;
858
+ heightSide = alignment === 'end' ? 'top' : 'bottom';
859
+ }
860
+ const overflowAvailableHeight = height - overflow[heightSide];
861
+ const overflowAvailableWidth = width - overflow[widthSide];
862
+ const noShift = !state.middlewareData.shift;
863
+ let availableHeight = overflowAvailableHeight;
864
+ let availableWidth = overflowAvailableWidth;
865
+ if (isYAxis) {
866
+ const maximumClippingWidth = width - overflow.left - overflow.right;
867
+ availableWidth = alignment || noShift ? min(overflowAvailableWidth, maximumClippingWidth) : maximumClippingWidth;
868
+ } else {
869
+ const maximumClippingHeight = height - overflow.top - overflow.bottom;
870
+ availableHeight = alignment || noShift ? min(overflowAvailableHeight, maximumClippingHeight) : maximumClippingHeight;
871
+ }
872
+ if (noShift && !alignment) {
873
+ const xMin = max(overflow.left, 0);
874
+ const xMax = max(overflow.right, 0);
875
+ const yMin = max(overflow.top, 0);
876
+ const yMax = max(overflow.bottom, 0);
877
+ if (isYAxis) {
878
+ availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
879
+ } else {
880
+ availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
881
+ }
882
+ }
883
+ await apply({
884
+ ...state,
885
+ availableWidth,
886
+ availableHeight
887
+ });
888
+ const nextDimensions = await platform.getDimensions(elements.floating);
889
+ if (width !== nextDimensions.width || height !== nextDimensions.height) {
890
+ return {
891
+ reset: {
892
+ rects: true
893
+ }
894
+ };
895
+ }
896
+ return {};
897
+ }
898
+ };
899
+ };
900
+
901
+ function getNodeName(node) {
902
+ if (isNode(node)) {
903
+ return (node.nodeName || '').toLowerCase();
904
+ }
905
+ // Mocked nodes in testing environments may not be instances of Node. By
906
+ // returning `#document` an infinite loop won't occur.
907
+ // https://github.com/floating-ui/floating-ui/issues/2317
908
+ return '#document';
909
+ }
910
+ function getWindow(node) {
911
+ var _node$ownerDocument;
912
+ return (node == null ? void 0 : (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
913
+ }
914
+ function getDocumentElement(node) {
915
+ var _ref;
916
+ return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
917
+ }
918
+ function isNode(value) {
919
+ return value instanceof Node || value instanceof getWindow(value).Node;
920
+ }
921
+ function isElement(value) {
922
+ return value instanceof Element || value instanceof getWindow(value).Element;
923
+ }
924
+ function isHTMLElement(value) {
925
+ return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
926
+ }
927
+ function isShadowRoot(value) {
928
+ // Browsers without `ShadowRoot` support.
929
+ if (typeof ShadowRoot === 'undefined') {
930
+ return false;
931
+ }
932
+ return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
933
+ }
934
+ function isOverflowElement(element) {
935
+ const {
936
+ overflow,
937
+ overflowX,
938
+ overflowY,
939
+ display
940
+ } = getComputedStyle(element);
941
+ return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
942
+ }
943
+ function isTableElement(element) {
944
+ return ['table', 'td', 'th'].includes(getNodeName(element));
945
+ }
946
+ function isContainingBlock(element) {
947
+ const webkit = isWebKit();
948
+ const css = getComputedStyle(element);
949
+
950
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
951
+ return css.transform !== 'none' || css.perspective !== 'none' || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || ['transform', 'perspective', 'filter'].some(value => (css.willChange || '').includes(value)) || ['paint', 'layout', 'strict', 'content'].some(value => (css.contain || '').includes(value));
952
+ }
953
+ function getContainingBlock(element) {
954
+ let currentNode = getParentNode(element);
955
+ while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
956
+ if (isContainingBlock(currentNode)) {
957
+ return currentNode;
958
+ } else {
959
+ currentNode = getParentNode(currentNode);
960
+ }
961
+ }
962
+ return null;
963
+ }
964
+ function isWebKit() {
965
+ if (typeof CSS === 'undefined' || !CSS.supports) return false;
966
+ return CSS.supports('-webkit-backdrop-filter', 'none');
967
+ }
968
+ function isLastTraversableNode(node) {
969
+ return ['html', 'body', '#document'].includes(getNodeName(node));
970
+ }
971
+ function getComputedStyle(element) {
972
+ return getWindow(element).getComputedStyle(element);
973
+ }
974
+ function getNodeScroll(element) {
975
+ if (isElement(element)) {
976
+ return {
977
+ scrollLeft: element.scrollLeft,
978
+ scrollTop: element.scrollTop
979
+ };
980
+ }
981
+ return {
982
+ scrollLeft: element.pageXOffset,
983
+ scrollTop: element.pageYOffset
984
+ };
985
+ }
986
+ function getParentNode(node) {
987
+ if (getNodeName(node) === 'html') {
988
+ return node;
989
+ }
990
+ const result =
991
+ // Step into the shadow DOM of the parent of a slotted node.
992
+ node.assignedSlot ||
993
+ // DOM Element detected.
994
+ node.parentNode ||
995
+ // ShadowRoot detected.
996
+ isShadowRoot(node) && node.host ||
997
+ // Fallback.
998
+ getDocumentElement(node);
999
+ return isShadowRoot(result) ? result.host : result;
1000
+ }
1001
+ function getNearestOverflowAncestor(node) {
1002
+ const parentNode = getParentNode(node);
1003
+ if (isLastTraversableNode(parentNode)) {
1004
+ return node.ownerDocument ? node.ownerDocument.body : node.body;
1005
+ }
1006
+ if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
1007
+ return parentNode;
1008
+ }
1009
+ return getNearestOverflowAncestor(parentNode);
1010
+ }
1011
+ function getOverflowAncestors(node, list, traverseIframes) {
1012
+ var _node$ownerDocument2;
1013
+ if (list === void 0) {
1014
+ list = [];
1015
+ }
1016
+ if (traverseIframes === void 0) {
1017
+ traverseIframes = true;
1018
+ }
1019
+ const scrollableAncestor = getNearestOverflowAncestor(node);
1020
+ const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
1021
+ const win = getWindow(scrollableAncestor);
1022
+ if (isBody) {
1023
+ return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], win.frameElement && traverseIframes ? getOverflowAncestors(win.frameElement) : []);
1024
+ }
1025
+ return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
1026
+ }
1027
+
1028
+ function getCssDimensions(element) {
1029
+ const css = getComputedStyle(element);
1030
+ // In testing environments, the `width` and `height` properties are empty
1031
+ // strings for SVG elements, returning NaN. Fallback to `0` in this case.
1032
+ let width = parseFloat(css.width) || 0;
1033
+ let height = parseFloat(css.height) || 0;
1034
+ const hasOffset = isHTMLElement(element);
1035
+ const offsetWidth = hasOffset ? element.offsetWidth : width;
1036
+ const offsetHeight = hasOffset ? element.offsetHeight : height;
1037
+ const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
1038
+ if (shouldFallback) {
1039
+ width = offsetWidth;
1040
+ height = offsetHeight;
1041
+ }
1042
+ return {
1043
+ width,
1044
+ height,
1045
+ $: shouldFallback
1046
+ };
1047
+ }
1048
+
1049
+ function unwrapElement(element) {
1050
+ return !isElement(element) ? element.contextElement : element;
1051
+ }
1052
+
1053
+ function getScale(element) {
1054
+ const domElement = unwrapElement(element);
1055
+ if (!isHTMLElement(domElement)) {
1056
+ return createCoords(1);
1057
+ }
1058
+ const rect = domElement.getBoundingClientRect();
1059
+ const {
1060
+ width,
1061
+ height,
1062
+ $
1063
+ } = getCssDimensions(domElement);
1064
+ let x = ($ ? round(rect.width) : rect.width) / width;
1065
+ let y = ($ ? round(rect.height) : rect.height) / height;
1066
+
1067
+ // 0, NaN, or Infinity should always fallback to 1.
1068
+
1069
+ if (!x || !Number.isFinite(x)) {
1070
+ x = 1;
1071
+ }
1072
+ if (!y || !Number.isFinite(y)) {
1073
+ y = 1;
1074
+ }
1075
+ return {
1076
+ x,
1077
+ y
1078
+ };
1079
+ }
1080
+
1081
+ const noOffsets = /*#__PURE__*/createCoords(0);
1082
+ function getVisualOffsets(element) {
1083
+ const win = getWindow(element);
1084
+ if (!isWebKit() || !win.visualViewport) {
1085
+ return noOffsets;
1086
+ }
1087
+ return {
1088
+ x: win.visualViewport.offsetLeft,
1089
+ y: win.visualViewport.offsetTop
1090
+ };
1091
+ }
1092
+ function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
1093
+ if (isFixed === void 0) {
1094
+ isFixed = false;
1095
+ }
1096
+ if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
1097
+ return false;
1098
+ }
1099
+ return isFixed;
1100
+ }
1101
+
1102
+ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
1103
+ if (includeScale === void 0) {
1104
+ includeScale = false;
1105
+ }
1106
+ if (isFixedStrategy === void 0) {
1107
+ isFixedStrategy = false;
1108
+ }
1109
+ const clientRect = element.getBoundingClientRect();
1110
+ const domElement = unwrapElement(element);
1111
+ let scale = createCoords(1);
1112
+ if (includeScale) {
1113
+ if (offsetParent) {
1114
+ if (isElement(offsetParent)) {
1115
+ scale = getScale(offsetParent);
1116
+ }
1117
+ } else {
1118
+ scale = getScale(element);
1119
+ }
1120
+ }
1121
+ const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
1122
+ let x = (clientRect.left + visualOffsets.x) / scale.x;
1123
+ let y = (clientRect.top + visualOffsets.y) / scale.y;
1124
+ let width = clientRect.width / scale.x;
1125
+ let height = clientRect.height / scale.y;
1126
+ if (domElement) {
1127
+ const win = getWindow(domElement);
1128
+ const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
1129
+ let currentIFrame = win.frameElement;
1130
+ while (currentIFrame && offsetParent && offsetWin !== win) {
1131
+ const iframeScale = getScale(currentIFrame);
1132
+ const iframeRect = currentIFrame.getBoundingClientRect();
1133
+ const css = getComputedStyle(currentIFrame);
1134
+ const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
1135
+ const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
1136
+ x *= iframeScale.x;
1137
+ y *= iframeScale.y;
1138
+ width *= iframeScale.x;
1139
+ height *= iframeScale.y;
1140
+ x += left;
1141
+ y += top;
1142
+ currentIFrame = getWindow(currentIFrame).frameElement;
1143
+ }
1144
+ }
1145
+ return rectToClientRect({
1146
+ width,
1147
+ height,
1148
+ x,
1149
+ y
1150
+ });
1151
+ }
1152
+
1153
+ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
1154
+ let {
1155
+ rect,
1156
+ offsetParent,
1157
+ strategy
1158
+ } = _ref;
1159
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
1160
+ const documentElement = getDocumentElement(offsetParent);
1161
+ if (offsetParent === documentElement) {
1162
+ return rect;
1163
+ }
1164
+ let scroll = {
1165
+ scrollLeft: 0,
1166
+ scrollTop: 0
1167
+ };
1168
+ let scale = createCoords(1);
1169
+ const offsets = createCoords(0);
1170
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
1171
+ if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
1172
+ scroll = getNodeScroll(offsetParent);
1173
+ }
1174
+ if (isHTMLElement(offsetParent)) {
1175
+ const offsetRect = getBoundingClientRect(offsetParent);
1176
+ scale = getScale(offsetParent);
1177
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
1178
+ offsets.y = offsetRect.y + offsetParent.clientTop;
1179
+ }
1180
+ }
1181
+ return {
1182
+ width: rect.width * scale.x,
1183
+ height: rect.height * scale.y,
1184
+ x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x,
1185
+ y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y
1186
+ };
1187
+ }
1188
+
1189
+ function getClientRects(element) {
1190
+ return Array.from(element.getClientRects());
1191
+ }
1192
+
1193
+ function getWindowScrollBarX(element) {
1194
+ // If <html> has a CSS width greater than the viewport, then this will be
1195
+ // incorrect for RTL.
1196
+ return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
1197
+ }
1198
+
1199
+ // Gets the entire size of the scrollable document area, even extending outside
1200
+ // of the `<html>` and `<body>` rect bounds if horizontally scrollable.
1201
+ function getDocumentRect(element) {
1202
+ const html = getDocumentElement(element);
1203
+ const scroll = getNodeScroll(element);
1204
+ const body = element.ownerDocument.body;
1205
+ const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
1206
+ const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
1207
+ let x = -scroll.scrollLeft + getWindowScrollBarX(element);
1208
+ const y = -scroll.scrollTop;
1209
+ if (getComputedStyle(body).direction === 'rtl') {
1210
+ x += max(html.clientWidth, body.clientWidth) - width;
1211
+ }
1212
+ return {
1213
+ width,
1214
+ height,
1215
+ x,
1216
+ y
1217
+ };
1218
+ }
1219
+
1220
+ function getViewportRect(element, strategy) {
1221
+ const win = getWindow(element);
1222
+ const html = getDocumentElement(element);
1223
+ const visualViewport = win.visualViewport;
1224
+ let width = html.clientWidth;
1225
+ let height = html.clientHeight;
1226
+ let x = 0;
1227
+ let y = 0;
1228
+ if (visualViewport) {
1229
+ width = visualViewport.width;
1230
+ height = visualViewport.height;
1231
+ const visualViewportBased = isWebKit();
1232
+ if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
1233
+ x = visualViewport.offsetLeft;
1234
+ y = visualViewport.offsetTop;
1235
+ }
1236
+ }
1237
+ return {
1238
+ width,
1239
+ height,
1240
+ x,
1241
+ y
1242
+ };
1243
+ }
1244
+
1245
+ // Returns the inner client rect, subtracting scrollbars if present.
1246
+ function getInnerBoundingClientRect(element, strategy) {
1247
+ const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
1248
+ const top = clientRect.top + element.clientTop;
1249
+ const left = clientRect.left + element.clientLeft;
1250
+ const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
1251
+ const width = element.clientWidth * scale.x;
1252
+ const height = element.clientHeight * scale.y;
1253
+ const x = left * scale.x;
1254
+ const y = top * scale.y;
1255
+ return {
1256
+ width,
1257
+ height,
1258
+ x,
1259
+ y
1260
+ };
1261
+ }
1262
+ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
1263
+ let rect;
1264
+ if (clippingAncestor === 'viewport') {
1265
+ rect = getViewportRect(element, strategy);
1266
+ } else if (clippingAncestor === 'document') {
1267
+ rect = getDocumentRect(getDocumentElement(element));
1268
+ } else if (isElement(clippingAncestor)) {
1269
+ rect = getInnerBoundingClientRect(clippingAncestor, strategy);
1270
+ } else {
1271
+ const visualOffsets = getVisualOffsets(element);
1272
+ rect = {
1273
+ ...clippingAncestor,
1274
+ x: clippingAncestor.x - visualOffsets.x,
1275
+ y: clippingAncestor.y - visualOffsets.y
1276
+ };
1277
+ }
1278
+ return rectToClientRect(rect);
1279
+ }
1280
+ function hasFixedPositionAncestor(element, stopNode) {
1281
+ const parentNode = getParentNode(element);
1282
+ if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
1283
+ return false;
1284
+ }
1285
+ return getComputedStyle(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
1286
+ }
1287
+
1288
+ // A "clipping ancestor" is an `overflow` element with the characteristic of
1289
+ // clipping (or hiding) child elements. This returns all clipping ancestors
1290
+ // of the given element up the tree.
1291
+ function getClippingElementAncestors(element, cache) {
1292
+ const cachedResult = cache.get(element);
1293
+ if (cachedResult) {
1294
+ return cachedResult;
1295
+ }
1296
+ let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');
1297
+ let currentContainingBlockComputedStyle = null;
1298
+ const elementIsFixed = getComputedStyle(element).position === 'fixed';
1299
+ let currentNode = elementIsFixed ? getParentNode(element) : element;
1300
+
1301
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
1302
+ while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
1303
+ const computedStyle = getComputedStyle(currentNode);
1304
+ const currentNodeIsContaining = isContainingBlock(currentNode);
1305
+ if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
1306
+ currentContainingBlockComputedStyle = null;
1307
+ }
1308
+ const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
1309
+ if (shouldDropCurrentNode) {
1310
+ // Drop non-containing blocks.
1311
+ result = result.filter(ancestor => ancestor !== currentNode);
1312
+ } else {
1313
+ // Record last containing block for next iteration.
1314
+ currentContainingBlockComputedStyle = computedStyle;
1315
+ }
1316
+ currentNode = getParentNode(currentNode);
1317
+ }
1318
+ cache.set(element, result);
1319
+ return result;
1320
+ }
1321
+
1322
+ // Gets the maximum area that the element is visible in due to any number of
1323
+ // clipping ancestors.
1324
+ function getClippingRect(_ref) {
1325
+ let {
1326
+ element,
1327
+ boundary,
1328
+ rootBoundary,
1329
+ strategy
1330
+ } = _ref;
1331
+ const elementClippingAncestors = boundary === 'clippingAncestors' ? getClippingElementAncestors(element, this._c) : [].concat(boundary);
1332
+ const clippingAncestors = [...elementClippingAncestors, rootBoundary];
1333
+ const firstClippingAncestor = clippingAncestors[0];
1334
+ const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
1335
+ const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
1336
+ accRect.top = max(rect.top, accRect.top);
1337
+ accRect.right = min(rect.right, accRect.right);
1338
+ accRect.bottom = min(rect.bottom, accRect.bottom);
1339
+ accRect.left = max(rect.left, accRect.left);
1340
+ return accRect;
1341
+ }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
1342
+ return {
1343
+ width: clippingRect.right - clippingRect.left,
1344
+ height: clippingRect.bottom - clippingRect.top,
1345
+ x: clippingRect.left,
1346
+ y: clippingRect.top
1347
+ };
1348
+ }
1349
+
1350
+ function getDimensions(element) {
1351
+ return getCssDimensions(element);
1352
+ }
1353
+
1354
+ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
1355
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
1356
+ const documentElement = getDocumentElement(offsetParent);
1357
+ const isFixed = strategy === 'fixed';
1358
+ const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
1359
+ let scroll = {
1360
+ scrollLeft: 0,
1361
+ scrollTop: 0
1362
+ };
1363
+ const offsets = createCoords(0);
1364
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1365
+ if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
1366
+ scroll = getNodeScroll(offsetParent);
1367
+ }
1368
+ if (isOffsetParentAnElement) {
1369
+ const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
1370
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
1371
+ offsets.y = offsetRect.y + offsetParent.clientTop;
1372
+ } else if (documentElement) {
1373
+ offsets.x = getWindowScrollBarX(documentElement);
1374
+ }
1375
+ }
1376
+ return {
1377
+ x: rect.left + scroll.scrollLeft - offsets.x,
1378
+ y: rect.top + scroll.scrollTop - offsets.y,
1379
+ width: rect.width,
1380
+ height: rect.height
1381
+ };
1382
+ }
1383
+
1384
+ function getTrueOffsetParent(element, polyfill) {
1385
+ if (!isHTMLElement(element) || getComputedStyle(element).position === 'fixed') {
1386
+ return null;
1387
+ }
1388
+ if (polyfill) {
1389
+ return polyfill(element);
1390
+ }
1391
+ return element.offsetParent;
1392
+ }
1393
+
1394
+ // Gets the closest ancestor positioned element. Handles some edge cases,
1395
+ // such as table ancestors and cross browser bugs.
1396
+ function getOffsetParent(element, polyfill) {
1397
+ const window = getWindow(element);
1398
+ if (!isHTMLElement(element)) {
1399
+ return window;
1400
+ }
1401
+ let offsetParent = getTrueOffsetParent(element, polyfill);
1402
+ while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {
1403
+ offsetParent = getTrueOffsetParent(offsetParent, polyfill);
1404
+ }
1405
+ if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static' && !isContainingBlock(offsetParent))) {
1406
+ return window;
1407
+ }
1408
+ return offsetParent || getContainingBlock(element) || window;
1409
+ }
1410
+
1411
+ const getElementRects = async function (_ref) {
1412
+ let {
1413
+ reference,
1414
+ floating,
1415
+ strategy
1416
+ } = _ref;
1417
+ const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
1418
+ const getDimensionsFn = this.getDimensions;
1419
+ return {
1420
+ reference: getRectRelativeToOffsetParent(reference, await getOffsetParentFn(floating), strategy),
1421
+ floating: {
1422
+ x: 0,
1423
+ y: 0,
1424
+ ...(await getDimensionsFn(floating))
1425
+ }
1426
+ };
1427
+ };
1428
+
1429
+ function isRTL(element) {
1430
+ return getComputedStyle(element).direction === 'rtl';
1431
+ }
1432
+
1433
+ const platform = {
1434
+ convertOffsetParentRelativeRectToViewportRelativeRect,
1435
+ getDocumentElement,
1436
+ getClippingRect,
1437
+ getOffsetParent,
1438
+ getElementRects,
1439
+ getClientRects,
1440
+ getDimensions,
1441
+ getScale,
1442
+ isElement,
1443
+ isRTL
1444
+ };
1445
+
1446
+ // https://samthor.au/2021/observing-dom/
1447
+ function observeMove(element, onMove) {
1448
+ let io = null;
1449
+ let timeoutId;
1450
+ const root = getDocumentElement(element);
1451
+ function cleanup() {
1452
+ clearTimeout(timeoutId);
1453
+ io && io.disconnect();
1454
+ io = null;
1455
+ }
1456
+ function refresh(skip, threshold) {
1457
+ if (skip === void 0) {
1458
+ skip = false;
1459
+ }
1460
+ if (threshold === void 0) {
1461
+ threshold = 1;
1462
+ }
1463
+ cleanup();
1464
+ const {
1465
+ left,
1466
+ top,
1467
+ width,
1468
+ height
1469
+ } = element.getBoundingClientRect();
1470
+ if (!skip) {
1471
+ onMove();
1472
+ }
1473
+ if (!width || !height) {
1474
+ return;
1475
+ }
1476
+ const insetTop = floor(top);
1477
+ const insetRight = floor(root.clientWidth - (left + width));
1478
+ const insetBottom = floor(root.clientHeight - (top + height));
1479
+ const insetLeft = floor(left);
1480
+ const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
1481
+ const options = {
1482
+ rootMargin,
1483
+ threshold: max(0, min(1, threshold)) || 1
1484
+ };
1485
+ let isFirstUpdate = true;
1486
+ function handleObserve(entries) {
1487
+ const ratio = entries[0].intersectionRatio;
1488
+ if (ratio !== threshold) {
1489
+ if (!isFirstUpdate) {
1490
+ return refresh();
1491
+ }
1492
+ if (!ratio) {
1493
+ timeoutId = setTimeout(() => {
1494
+ refresh(false, 1e-7);
1495
+ }, 100);
1496
+ } else {
1497
+ refresh(false, ratio);
1498
+ }
1499
+ }
1500
+ isFirstUpdate = false;
1501
+ }
1502
+
1503
+ // Older browsers don't support a `document` as the root and will throw an
1504
+ // error.
1505
+ try {
1506
+ io = new IntersectionObserver(handleObserve, {
1507
+ ...options,
1508
+ // Handle <iframe>s
1509
+ root: root.ownerDocument
1510
+ });
1511
+ } catch (e) {
1512
+ io = new IntersectionObserver(handleObserve, options);
1513
+ }
1514
+ io.observe(element);
1515
+ }
1516
+ refresh(true);
1517
+ return cleanup;
1518
+ }
1519
+
1520
+ /**
1521
+ * Automatically updates the position of the floating element when necessary.
1522
+ * Should only be called when the floating element is mounted on the DOM or
1523
+ * visible on the screen.
1524
+ * @returns cleanup function that should be invoked when the floating element is
1525
+ * removed from the DOM or hidden from the screen.
1526
+ * @see https://floating-ui.com/docs/autoUpdate
1527
+ */
1528
+ function autoUpdate(reference, floating, update, options) {
1529
+ if (options === void 0) {
1530
+ options = {};
1531
+ }
1532
+ const {
1533
+ ancestorScroll = true,
1534
+ ancestorResize = true,
1535
+ elementResize = typeof ResizeObserver === 'function',
1536
+ layoutShift = typeof IntersectionObserver === 'function',
1537
+ animationFrame = false
1538
+ } = options;
1539
+ const referenceEl = unwrapElement(reference);
1540
+ const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...getOverflowAncestors(floating)] : [];
1541
+ ancestors.forEach(ancestor => {
1542
+ ancestorScroll && ancestor.addEventListener('scroll', update, {
1543
+ passive: true
1544
+ });
1545
+ ancestorResize && ancestor.addEventListener('resize', update);
1546
+ });
1547
+ const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
1548
+ let reobserveFrame = -1;
1549
+ let resizeObserver = null;
1550
+ if (elementResize) {
1551
+ resizeObserver = new ResizeObserver(_ref => {
1552
+ let [firstEntry] = _ref;
1553
+ if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
1554
+ // Prevent update loops when using the `size` middleware.
1555
+ // https://github.com/floating-ui/floating-ui/issues/1740
1556
+ resizeObserver.unobserve(floating);
1557
+ cancelAnimationFrame(reobserveFrame);
1558
+ reobserveFrame = requestAnimationFrame(() => {
1559
+ resizeObserver && resizeObserver.observe(floating);
1560
+ });
1561
+ }
1562
+ update();
1563
+ });
1564
+ if (referenceEl && !animationFrame) {
1565
+ resizeObserver.observe(referenceEl);
1566
+ }
1567
+ resizeObserver.observe(floating);
1568
+ }
1569
+ let frameId;
1570
+ let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
1571
+ if (animationFrame) {
1572
+ frameLoop();
1573
+ }
1574
+ function frameLoop() {
1575
+ const nextRefRect = getBoundingClientRect(reference);
1576
+ if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
1577
+ update();
1578
+ }
1579
+ prevRefRect = nextRefRect;
1580
+ frameId = requestAnimationFrame(frameLoop);
1581
+ }
1582
+ update();
1583
+ return () => {
1584
+ ancestors.forEach(ancestor => {
1585
+ ancestorScroll && ancestor.removeEventListener('scroll', update);
1586
+ ancestorResize && ancestor.removeEventListener('resize', update);
1587
+ });
1588
+ cleanupIo && cleanupIo();
1589
+ resizeObserver && resizeObserver.disconnect();
1590
+ resizeObserver = null;
1591
+ if (animationFrame) {
1592
+ cancelAnimationFrame(frameId);
1593
+ }
1594
+ };
1595
+ }
1596
+
1597
+ /**
1598
+ * Computes the `x` and `y` coordinates that will place the floating element
1599
+ * next to a reference element when it is given a certain CSS positioning
1600
+ * strategy.
1601
+ */
1602
+ const computePosition = (reference, floating, options) => {
1603
+ // This caches the expensive `getClippingElementAncestors` function so that
1604
+ // multiple lifecycle resets re-use the same result. It only lives for a
1605
+ // single call. If other functions become expensive, we can add them as well.
1606
+ const cache = new Map();
1607
+ const mergedOptions = {
1608
+ platform,
1609
+ ...options
1610
+ };
1611
+ const platformWithCache = {
1612
+ ...mergedOptions.platform,
1613
+ _c: cache
1614
+ };
1615
+ return computePosition$1(reference, floating, {
1616
+ ...mergedOptions,
1617
+ platform: platformWithCache
1618
+ });
1619
+ };
1620
+
1621
+ /**
1622
+ * Provides data to position an inner element of the floating element so that it
1623
+ * appears centered to the reference element.
1624
+ * This wraps the core `arrow` middleware to allow React refs as the element.
1625
+ * @see https://floating-ui.com/docs/arrow
1626
+ */
1627
+ const arrow = options => {
1628
+ function isRef(value) {
1629
+ return {}.hasOwnProperty.call(value, 'current');
1630
+ }
1631
+ return {
1632
+ name: 'arrow',
1633
+ options,
1634
+ fn(state) {
1635
+ const {
1636
+ element,
1637
+ padding
1638
+ } = typeof options === 'function' ? options(state) : options;
1639
+ if (element && isRef(element)) {
1640
+ if (element.current != null) {
1641
+ return arrow$1({
1642
+ element: element.current,
1643
+ padding
1644
+ }).fn(state);
1645
+ }
1646
+ return {};
1647
+ } else if (element) {
1648
+ return arrow$1({
1649
+ element,
1650
+ padding
1651
+ }).fn(state);
1652
+ }
1653
+ return {};
1654
+ }
1655
+ };
1656
+ };
1657
+
1658
+ var index = typeof document !== 'undefined' ? useLayoutEffect : useEffect;
1659
+
1660
+ // Fork of `fast-deep-equal` that only does the comparisons we need and compares
1661
+ // functions
1662
+ function deepEqual(a, b) {
1663
+ if (a === b) {
1664
+ return true;
1665
+ }
1666
+ if (typeof a !== typeof b) {
1667
+ return false;
1668
+ }
1669
+ if (typeof a === 'function' && a.toString() === b.toString()) {
1670
+ return true;
1671
+ }
1672
+ let length, i, keys;
1673
+ if (a && b && typeof a == 'object') {
1674
+ if (Array.isArray(a)) {
1675
+ length = a.length;
1676
+ if (length != b.length) return false;
1677
+ for (i = length; i-- !== 0;) {
1678
+ if (!deepEqual(a[i], b[i])) {
1679
+ return false;
1680
+ }
1681
+ }
1682
+ return true;
1683
+ }
1684
+ keys = Object.keys(a);
1685
+ length = keys.length;
1686
+ if (length !== Object.keys(b).length) {
1687
+ return false;
1688
+ }
1689
+ for (i = length; i-- !== 0;) {
1690
+ if (!{}.hasOwnProperty.call(b, keys[i])) {
1691
+ return false;
1692
+ }
1693
+ }
1694
+ for (i = length; i-- !== 0;) {
1695
+ const key = keys[i];
1696
+ if (key === '_owner' && a.$$typeof) {
1697
+ continue;
1698
+ }
1699
+ if (!deepEqual(a[key], b[key])) {
1700
+ return false;
1701
+ }
1702
+ }
1703
+ return true;
1704
+ }
1705
+ return a !== a && b !== b;
1706
+ }
1707
+
1708
+ function getDPR(element) {
1709
+ if (typeof window === 'undefined') {
1710
+ return 1;
1711
+ }
1712
+ const win = element.ownerDocument.defaultView || window;
1713
+ return win.devicePixelRatio || 1;
1714
+ }
1715
+
1716
+ function roundByDPR(element, value) {
1717
+ const dpr = getDPR(element);
1718
+ return Math.round(value * dpr) / dpr;
1719
+ }
1720
+
1721
+ function useLatestRef(value) {
1722
+ const ref = React.useRef(value);
1723
+ index(() => {
1724
+ ref.current = value;
1725
+ });
1726
+ return ref;
1727
+ }
1728
+
1729
+ /**
1730
+ * Provides data to position a floating element.
1731
+ * @see https://floating-ui.com/docs/react
1732
+ */
1733
+ function useFloating(options) {
1734
+ if (options === void 0) {
1735
+ options = {};
1736
+ }
1737
+ const {
1738
+ placement = 'bottom',
1739
+ strategy = 'absolute',
1740
+ middleware = [],
1741
+ platform,
1742
+ elements: {
1743
+ reference: externalReference,
1744
+ floating: externalFloating
1745
+ } = {},
1746
+ transform = true,
1747
+ whileElementsMounted,
1748
+ open
1749
+ } = options;
1750
+ const [data, setData] = React.useState({
1751
+ x: 0,
1752
+ y: 0,
1753
+ strategy,
1754
+ placement,
1755
+ middlewareData: {},
1756
+ isPositioned: false
1757
+ });
1758
+ const [latestMiddleware, setLatestMiddleware] = React.useState(middleware);
1759
+ if (!deepEqual(latestMiddleware, middleware)) {
1760
+ setLatestMiddleware(middleware);
1761
+ }
1762
+ const [_reference, _setReference] = React.useState(null);
1763
+ const [_floating, _setFloating] = React.useState(null);
1764
+ const setReference = React.useCallback(node => {
1765
+ if (node != referenceRef.current) {
1766
+ referenceRef.current = node;
1767
+ _setReference(node);
1768
+ }
1769
+ }, [_setReference]);
1770
+ const setFloating = React.useCallback(node => {
1771
+ if (node !== floatingRef.current) {
1772
+ floatingRef.current = node;
1773
+ _setFloating(node);
1774
+ }
1775
+ }, [_setFloating]);
1776
+ const referenceEl = externalReference || _reference;
1777
+ const floatingEl = externalFloating || _floating;
1778
+ const referenceRef = React.useRef(null);
1779
+ const floatingRef = React.useRef(null);
1780
+ const dataRef = React.useRef(data);
1781
+ const whileElementsMountedRef = useLatestRef(whileElementsMounted);
1782
+ const platformRef = useLatestRef(platform);
1783
+ const update = React.useCallback(() => {
1784
+ if (!referenceRef.current || !floatingRef.current) {
1785
+ return;
1786
+ }
1787
+ const config = {
1788
+ placement,
1789
+ strategy,
1790
+ middleware: latestMiddleware
1791
+ };
1792
+ if (platformRef.current) {
1793
+ config.platform = platformRef.current;
1794
+ }
1795
+ computePosition(referenceRef.current, floatingRef.current, config).then(data => {
1796
+ const fullData = {
1797
+ ...data,
1798
+ isPositioned: true
1799
+ };
1800
+ if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) {
1801
+ dataRef.current = fullData;
1802
+ $7SXl2$reactdom.flushSync(() => {
1803
+ setData(fullData);
1804
+ });
1805
+ }
1806
+ });
1807
+ }, [latestMiddleware, placement, strategy, platformRef]);
1808
+ index(() => {
1809
+ if (open === false && dataRef.current.isPositioned) {
1810
+ dataRef.current.isPositioned = false;
1811
+ setData(data => ({
1812
+ ...data,
1813
+ isPositioned: false
1814
+ }));
1815
+ }
1816
+ }, [open]);
1817
+ const isMountedRef = React.useRef(false);
1818
+ index(() => {
1819
+ isMountedRef.current = true;
1820
+ return () => {
1821
+ isMountedRef.current = false;
1822
+ };
1823
+ }, []);
1824
+ index(() => {
1825
+ if (referenceEl) referenceRef.current = referenceEl;
1826
+ if (floatingEl) floatingRef.current = floatingEl;
1827
+ if (referenceEl && floatingEl) {
1828
+ if (whileElementsMountedRef.current) {
1829
+ return whileElementsMountedRef.current(referenceEl, floatingEl, update);
1830
+ } else {
1831
+ update();
1832
+ }
1833
+ }
1834
+ }, [referenceEl, floatingEl, update, whileElementsMountedRef]);
1835
+ const refs = React.useMemo(() => ({
1836
+ reference: referenceRef,
1837
+ floating: floatingRef,
1838
+ setReference,
1839
+ setFloating
1840
+ }), [setReference, setFloating]);
1841
+ const elements = React.useMemo(() => ({
1842
+ reference: referenceEl,
1843
+ floating: floatingEl
1844
+ }), [referenceEl, floatingEl]);
1845
+ const floatingStyles = React.useMemo(() => {
1846
+ const initialStyles = {
1847
+ position: strategy,
1848
+ left: 0,
1849
+ top: 0
1850
+ };
1851
+ if (!elements.floating) {
1852
+ return initialStyles;
1853
+ }
1854
+ const x = roundByDPR(elements.floating, data.x);
1855
+ const y = roundByDPR(elements.floating, data.y);
1856
+ if (transform) {
1857
+ return {
1858
+ ...initialStyles,
1859
+ transform: "translate(" + x + "px, " + y + "px)",
1860
+ ...(getDPR(elements.floating) >= 1.5 && {
1861
+ willChange: 'transform'
1862
+ })
1863
+ };
1864
+ }
1865
+ return {
1866
+ position: strategy,
1867
+ left: x,
1868
+ top: y
1869
+ };
1870
+ }, [strategy, transform, elements.floating, data.x, data.y]);
1871
+ return React.useMemo(() => ({
1872
+ ...data,
1873
+ update,
1874
+ refs,
1875
+ elements,
1876
+ floatingStyles
1877
+ }), [data, update, refs, elements, floatingStyles]);
1878
+ }
1879
+
1880
+ function $db6c3485150b8e66$export$1ab7ae714698c4b8(element) {
1881
+ const [size, setSize] = useState(undefined);
1882
+ $9f79659886946c16$export$e5c5a5f917a5871c(()=>{
1883
+ if (element) {
1884
+ // provide size as early as possible
1885
+ setSize({
1886
+ width: element.offsetWidth,
1887
+ height: element.offsetHeight
1888
+ });
1889
+ const resizeObserver = new ResizeObserver((entries)=>{
1890
+ if (!Array.isArray(entries)) return;
1891
+ // Since we only observe the one element, we don't need to loop over the
1892
+ // array
1893
+ if (!entries.length) return;
1894
+ const entry = entries[0];
1895
+ let width;
1896
+ let height;
1897
+ if ('borderBoxSize' in entry) {
1898
+ const borderSizeEntry = entry['borderBoxSize']; // iron out differences between browsers
1899
+ const borderSize = Array.isArray(borderSizeEntry) ? borderSizeEntry[0] : borderSizeEntry;
1900
+ width = borderSize['inlineSize'];
1901
+ height = borderSize['blockSize'];
1902
+ } else {
1903
+ // for browsers that don't support `borderBoxSize`
1904
+ // we calculate it ourselves to get the correct border box.
1905
+ width = element.offsetWidth;
1906
+ height = element.offsetHeight;
1907
+ }
1908
+ setSize({
1909
+ width: width,
1910
+ height: height
1911
+ });
1912
+ });
1913
+ resizeObserver.observe(element, {
1914
+ box: 'border-box'
1915
+ });
1916
+ return ()=>resizeObserver.unobserve(element)
1917
+ ;
1918
+ } else // We only want to reset to `undefined` when the element becomes `null`,
1919
+ // not if it changes to another element.
1920
+ setSize(undefined);
1921
+ }, [
1922
+ element
1923
+ ]);
1924
+ return size;
1925
+ }
1926
+
1927
+ /* -------------------------------------------------------------------------------------------------
1928
+ * Popper
1929
+ * -----------------------------------------------------------------------------------------------*/ const $cf1ac5d9fe0e8206$var$POPPER_NAME = 'Popper';
1930
+ const [$cf1ac5d9fe0e8206$var$createPopperContext, $cf1ac5d9fe0e8206$export$722aac194ae923] = $c512c27ab02ef895$export$50c7b4e9d9f19c1($cf1ac5d9fe0e8206$var$POPPER_NAME);
1931
+ const [$cf1ac5d9fe0e8206$var$PopperProvider, $cf1ac5d9fe0e8206$var$usePopperContext] = $cf1ac5d9fe0e8206$var$createPopperContext($cf1ac5d9fe0e8206$var$POPPER_NAME);
1932
+ const $cf1ac5d9fe0e8206$export$badac9ada3a0bdf9 = (props)=>{
1933
+ const { __scopePopper: __scopePopper , children: children } = props;
1934
+ const [anchor, setAnchor] = useState(null);
1935
+ return /*#__PURE__*/ createElement($cf1ac5d9fe0e8206$var$PopperProvider, {
1936
+ scope: __scopePopper,
1937
+ anchor: anchor,
1938
+ onAnchorChange: setAnchor
1939
+ }, children);
1940
+ };
1941
+ /* -------------------------------------------------------------------------------------------------
1942
+ * PopperAnchor
1943
+ * -----------------------------------------------------------------------------------------------*/ const $cf1ac5d9fe0e8206$var$ANCHOR_NAME = 'PopperAnchor';
1944
+ const $cf1ac5d9fe0e8206$export$ecd4e1ccab6ed6d = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
1945
+ const { __scopePopper: __scopePopper , virtualRef: virtualRef , ...anchorProps } = props;
1946
+ const context = $cf1ac5d9fe0e8206$var$usePopperContext($cf1ac5d9fe0e8206$var$ANCHOR_NAME, __scopePopper);
1947
+ const ref = useRef(null);
1948
+ const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, ref);
1949
+ useEffect(()=>{
1950
+ // Consumer can anchor the popper to something that isn't
1951
+ // a DOM node e.g. pointer position, so we override the
1952
+ // `anchorRef` with their virtual ref in this case.
1953
+ context.onAnchorChange((virtualRef === null || virtualRef === void 0 ? void 0 : virtualRef.current) || ref.current);
1954
+ });
1955
+ return virtualRef ? null : /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({}, anchorProps, {
1956
+ ref: composedRefs
1957
+ }));
1958
+ });
1959
+ /* -------------------------------------------------------------------------------------------------
1960
+ * PopperContent
1961
+ * -----------------------------------------------------------------------------------------------*/ const $cf1ac5d9fe0e8206$var$CONTENT_NAME = 'PopperContent';
1962
+ const [$cf1ac5d9fe0e8206$var$PopperContentProvider, $cf1ac5d9fe0e8206$var$useContentContext] = $cf1ac5d9fe0e8206$var$createPopperContext($cf1ac5d9fe0e8206$var$CONTENT_NAME);
1963
+ const $cf1ac5d9fe0e8206$export$bc4ae5855d3c4fc = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
1964
+ var _arrowSize$width, _arrowSize$height, _middlewareData$arrow, _middlewareData$arrow2, _middlewareData$arrow3, _middlewareData$trans, _middlewareData$trans2, _middlewareData$hide;
1965
+ const { __scopePopper: __scopePopper , side: side = 'bottom' , sideOffset: sideOffset = 0 , align: align = 'center' , alignOffset: alignOffset = 0 , arrowPadding: arrowPadding = 0 , avoidCollisions: avoidCollisions = true , collisionBoundary: collisionBoundary = [] , collisionPadding: collisionPaddingProp = 0 , sticky: sticky = 'partial' , hideWhenDetached: hideWhenDetached = false , updatePositionStrategy: updatePositionStrategy = 'optimized' , onPlaced: onPlaced , ...contentProps } = props;
1966
+ const context = $cf1ac5d9fe0e8206$var$usePopperContext($cf1ac5d9fe0e8206$var$CONTENT_NAME, __scopePopper);
1967
+ const [content, setContent] = useState(null);
1968
+ const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, (node)=>setContent(node)
1969
+ );
1970
+ const [arrow$1, setArrow] = useState(null);
1971
+ const arrowSize = $db6c3485150b8e66$export$1ab7ae714698c4b8(arrow$1);
1972
+ const arrowWidth = (_arrowSize$width = arrowSize === null || arrowSize === void 0 ? void 0 : arrowSize.width) !== null && _arrowSize$width !== void 0 ? _arrowSize$width : 0;
1973
+ const arrowHeight = (_arrowSize$height = arrowSize === null || arrowSize === void 0 ? void 0 : arrowSize.height) !== null && _arrowSize$height !== void 0 ? _arrowSize$height : 0;
1974
+ const desiredPlacement = side + (align !== 'center' ? '-' + align : '');
1975
+ const collisionPadding = typeof collisionPaddingProp === 'number' ? collisionPaddingProp : {
1976
+ top: 0,
1977
+ right: 0,
1978
+ bottom: 0,
1979
+ left: 0,
1980
+ ...collisionPaddingProp
1981
+ };
1982
+ const boundary = Array.isArray(collisionBoundary) ? collisionBoundary : [
1983
+ collisionBoundary
1984
+ ];
1985
+ const hasExplicitBoundaries = boundary.length > 0;
1986
+ const detectOverflowOptions = {
1987
+ padding: collisionPadding,
1988
+ boundary: boundary.filter($cf1ac5d9fe0e8206$var$isNotNull),
1989
+ // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
1990
+ altBoundary: hasExplicitBoundaries
1991
+ };
1992
+ const { refs: refs , floatingStyles: floatingStyles , placement: placement , isPositioned: isPositioned , middlewareData: middlewareData } = useFloating({
1993
+ // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
1994
+ strategy: 'fixed',
1995
+ placement: desiredPlacement,
1996
+ whileElementsMounted: (...args)=>{
1997
+ const cleanup = autoUpdate(...args, {
1998
+ animationFrame: updatePositionStrategy === 'always'
1999
+ });
2000
+ return cleanup;
2001
+ },
2002
+ elements: {
2003
+ reference: context.anchor
2004
+ },
2005
+ middleware: [
2006
+ offset({
2007
+ mainAxis: sideOffset + arrowHeight,
2008
+ alignmentAxis: alignOffset
2009
+ }),
2010
+ avoidCollisions && shift({
2011
+ mainAxis: true,
2012
+ crossAxis: false,
2013
+ limiter: sticky === 'partial' ? limitShift() : undefined,
2014
+ ...detectOverflowOptions
2015
+ }),
2016
+ avoidCollisions && flip({
2017
+ ...detectOverflowOptions
2018
+ }),
2019
+ size({
2020
+ ...detectOverflowOptions,
2021
+ apply: ({ elements: elements , rects: rects , availableWidth: availableWidth , availableHeight: availableHeight })=>{
2022
+ const { width: anchorWidth , height: anchorHeight } = rects.reference;
2023
+ const contentStyle = elements.floating.style;
2024
+ contentStyle.setProperty('--radix-popper-available-width', `${availableWidth}px`);
2025
+ contentStyle.setProperty('--radix-popper-available-height', `${availableHeight}px`);
2026
+ contentStyle.setProperty('--radix-popper-anchor-width', `${anchorWidth}px`);
2027
+ contentStyle.setProperty('--radix-popper-anchor-height', `${anchorHeight}px`);
2028
+ }
2029
+ }),
2030
+ arrow$1 && arrow({
2031
+ element: arrow$1,
2032
+ padding: arrowPadding
2033
+ }),
2034
+ $cf1ac5d9fe0e8206$var$transformOrigin({
2035
+ arrowWidth: arrowWidth,
2036
+ arrowHeight: arrowHeight
2037
+ }),
2038
+ hideWhenDetached && hide({
2039
+ strategy: 'referenceHidden',
2040
+ ...detectOverflowOptions
2041
+ })
2042
+ ]
2043
+ });
2044
+ const [placedSide, placedAlign] = $cf1ac5d9fe0e8206$var$getSideAndAlignFromPlacement(placement);
2045
+ const handlePlaced = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onPlaced);
2046
+ $9f79659886946c16$export$e5c5a5f917a5871c(()=>{
2047
+ if (isPositioned) handlePlaced === null || handlePlaced === void 0 || handlePlaced();
2048
+ }, [
2049
+ isPositioned,
2050
+ handlePlaced
2051
+ ]);
2052
+ const arrowX = (_middlewareData$arrow = middlewareData.arrow) === null || _middlewareData$arrow === void 0 ? void 0 : _middlewareData$arrow.x;
2053
+ const arrowY = (_middlewareData$arrow2 = middlewareData.arrow) === null || _middlewareData$arrow2 === void 0 ? void 0 : _middlewareData$arrow2.y;
2054
+ const cannotCenterArrow = ((_middlewareData$arrow3 = middlewareData.arrow) === null || _middlewareData$arrow3 === void 0 ? void 0 : _middlewareData$arrow3.centerOffset) !== 0;
2055
+ const [contentZIndex, setContentZIndex] = useState();
2056
+ $9f79659886946c16$export$e5c5a5f917a5871c(()=>{
2057
+ if (content) setContentZIndex(window.getComputedStyle(content).zIndex);
2058
+ }, [
2059
+ content
2060
+ ]);
2061
+ return /*#__PURE__*/ createElement("div", {
2062
+ ref: refs.setFloating,
2063
+ "data-radix-popper-content-wrapper": "",
2064
+ style: {
2065
+ ...floatingStyles,
2066
+ transform: isPositioned ? floatingStyles.transform : 'translate(0, -200%)',
2067
+ // keep off the page when measuring
2068
+ minWidth: 'max-content',
2069
+ zIndex: contentZIndex,
2070
+ ['--radix-popper-transform-origin']: [
2071
+ (_middlewareData$trans = middlewareData.transformOrigin) === null || _middlewareData$trans === void 0 ? void 0 : _middlewareData$trans.x,
2072
+ (_middlewareData$trans2 = middlewareData.transformOrigin) === null || _middlewareData$trans2 === void 0 ? void 0 : _middlewareData$trans2.y
2073
+ ].join(' ')
2074
+ } // Floating UI interally calculates logical alignment based the `dir` attribute on
2075
+ ,
2076
+ dir: props.dir
2077
+ }, /*#__PURE__*/ createElement($cf1ac5d9fe0e8206$var$PopperContentProvider, {
2078
+ scope: __scopePopper,
2079
+ placedSide: placedSide,
2080
+ onArrowChange: setArrow,
2081
+ arrowX: arrowX,
2082
+ arrowY: arrowY,
2083
+ shouldHideArrow: cannotCenterArrow
2084
+ }, /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
2085
+ "data-side": placedSide,
2086
+ "data-align": placedAlign
2087
+ }, contentProps, {
2088
+ ref: composedRefs,
2089
+ style: {
2090
+ ...contentProps.style,
2091
+ // if the PopperContent hasn't been placed yet (not all measurements done)
2092
+ // we prevent animations so that users's animation don't kick in too early referring wrong sides
2093
+ animation: !isPositioned ? 'none' : undefined,
2094
+ // hide the content if using the hide middleware and should be hidden
2095
+ opacity: (_middlewareData$hide = middlewareData.hide) !== null && _middlewareData$hide !== void 0 && _middlewareData$hide.referenceHidden ? 0 : undefined
2096
+ }
2097
+ }))));
2098
+ });
2099
+ /* -----------------------------------------------------------------------------------------------*/ function $cf1ac5d9fe0e8206$var$isNotNull(value) {
2100
+ return value !== null;
2101
+ }
2102
+ const $cf1ac5d9fe0e8206$var$transformOrigin = (options)=>({
2103
+ name: 'transformOrigin',
2104
+ options: options,
2105
+ fn (data) {
2106
+ var _middlewareData$arrow4, _middlewareData$arrow5, _middlewareData$arrow6, _middlewareData$arrow7, _middlewareData$arrow8;
2107
+ const { placement: placement , rects: rects , middlewareData: middlewareData } = data;
2108
+ const cannotCenterArrow = ((_middlewareData$arrow4 = middlewareData.arrow) === null || _middlewareData$arrow4 === void 0 ? void 0 : _middlewareData$arrow4.centerOffset) !== 0;
2109
+ const isArrowHidden = cannotCenterArrow;
2110
+ const arrowWidth = isArrowHidden ? 0 : options.arrowWidth;
2111
+ const arrowHeight = isArrowHidden ? 0 : options.arrowHeight;
2112
+ const [placedSide, placedAlign] = $cf1ac5d9fe0e8206$var$getSideAndAlignFromPlacement(placement);
2113
+ const noArrowAlign = {
2114
+ start: '0%',
2115
+ center: '50%',
2116
+ end: '100%'
2117
+ }[placedAlign];
2118
+ const arrowXCenter = ((_middlewareData$arrow5 = (_middlewareData$arrow6 = middlewareData.arrow) === null || _middlewareData$arrow6 === void 0 ? void 0 : _middlewareData$arrow6.x) !== null && _middlewareData$arrow5 !== void 0 ? _middlewareData$arrow5 : 0) + arrowWidth / 2;
2119
+ const arrowYCenter = ((_middlewareData$arrow7 = (_middlewareData$arrow8 = middlewareData.arrow) === null || _middlewareData$arrow8 === void 0 ? void 0 : _middlewareData$arrow8.y) !== null && _middlewareData$arrow7 !== void 0 ? _middlewareData$arrow7 : 0) + arrowHeight / 2;
2120
+ let x = '';
2121
+ let y = '';
2122
+ if (placedSide === 'bottom') {
2123
+ x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;
2124
+ y = `${-arrowHeight}px`;
2125
+ } else if (placedSide === 'top') {
2126
+ x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;
2127
+ y = `${rects.floating.height + arrowHeight}px`;
2128
+ } else if (placedSide === 'right') {
2129
+ x = `${-arrowHeight}px`;
2130
+ y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;
2131
+ } else if (placedSide === 'left') {
2132
+ x = `${rects.floating.width + arrowHeight}px`;
2133
+ y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;
2134
+ }
2135
+ return {
2136
+ data: {
2137
+ x: x,
2138
+ y: y
2139
+ }
2140
+ };
2141
+ }
2142
+ })
2143
+ ;
2144
+ function $cf1ac5d9fe0e8206$var$getSideAndAlignFromPlacement(placement) {
2145
+ const [side, align = 'center'] = placement.split('-');
2146
+ return [
2147
+ side,
2148
+ align
2149
+ ];
2150
+ }
2151
+ const $cf1ac5d9fe0e8206$export$be92b6f5f03c0fe9 = $cf1ac5d9fe0e8206$export$badac9ada3a0bdf9;
2152
+ const $cf1ac5d9fe0e8206$export$b688253958b8dfe7 = $cf1ac5d9fe0e8206$export$ecd4e1ccab6ed6d;
2153
+ const $cf1ac5d9fe0e8206$export$7c6e2c02157bb7d2 = $cf1ac5d9fe0e8206$export$bc4ae5855d3c4fc;
2154
+
2155
+ export { $cf1ac5d9fe0e8206$export$722aac194ae923 as $, $cf1ac5d9fe0e8206$export$be92b6f5f03c0fe9 as a, $cf1ac5d9fe0e8206$export$b688253958b8dfe7 as b, $cf1ac5d9fe0e8206$export$7c6e2c02157bb7d2 as c };