@jobber/components 9.6.0 → 9.6.2

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 (187) hide show
  1. package/dist/ActivityIndicator-cjs.js +1 -0
  2. package/dist/ActivityIndicator-es.js +1 -0
  3. package/dist/Autocomplete/index.cjs +2 -0
  4. package/dist/Autocomplete/index.mjs +2 -0
  5. package/dist/Autocomplete-cjs.js +6 -4
  6. package/dist/Autocomplete-es.js +3 -1
  7. package/dist/Banner-cjs.js +1 -0
  8. package/dist/Banner-es.js +1 -0
  9. package/dist/Card/index.cjs +2 -1
  10. package/dist/Card/index.mjs +2 -1
  11. package/dist/Chip/index.cjs +2 -0
  12. package/dist/Chip/index.mjs +2 -0
  13. package/dist/Chip-cjs.js +1 -0
  14. package/dist/Chip-es.js +1 -0
  15. package/dist/Chips/InternalChipDismissible/hooks/index.cjs +2 -0
  16. package/dist/Chips/InternalChipDismissible/hooks/index.mjs +2 -0
  17. package/dist/Chips/InternalChipDismissible/index.cjs +2 -0
  18. package/dist/Chips/InternalChipDismissible/index.mjs +2 -0
  19. package/dist/Chips/index.cjs +2 -0
  20. package/dist/Chips/index.mjs +2 -0
  21. package/dist/Combobox/index.cjs +4 -2
  22. package/dist/Combobox/index.mjs +4 -2
  23. package/dist/{ComboboxSeparator-cjs.js → ComboboxChipRemove-cjs.js} +455 -501
  24. package/dist/{ComboboxSeparator-es.js → ComboboxChipRemove-es.js} +456 -500
  25. package/dist/ComboboxPrimitive-cjs.js +30 -29
  26. package/dist/ComboboxPrimitive-es.js +3 -2
  27. package/dist/ConfirmationModal/index.cjs +2 -0
  28. package/dist/ConfirmationModal/index.mjs +2 -0
  29. package/dist/ConfirmationModal-cjs.js +1 -0
  30. package/dist/ConfirmationModal-es.js +1 -0
  31. package/dist/DataDump/index.cjs +2 -1
  32. package/dist/DataDump/index.mjs +2 -1
  33. package/dist/DataDump-cjs.js +1 -0
  34. package/dist/DataDump-es.js +1 -0
  35. package/dist/DataList/components/DataListActions/index.cjs +2 -0
  36. package/dist/DataList/components/DataListActions/index.mjs +2 -0
  37. package/dist/DataList/components/DataListBulkActions/index.cjs +2 -0
  38. package/dist/DataList/components/DataListBulkActions/index.mjs +2 -0
  39. package/dist/DataList/components/DataListFilters/components/DataListSort/index.cjs +2 -0
  40. package/dist/DataList/components/DataListFilters/components/DataListSort/index.mjs +2 -0
  41. package/dist/DataList/components/DataListFilters/index.cjs +2 -0
  42. package/dist/DataList/components/DataListFilters/index.mjs +2 -0
  43. package/dist/DataList/components/DataListHeader/index.cjs +2 -0
  44. package/dist/DataList/components/DataListHeader/index.mjs +2 -0
  45. package/dist/DataList/components/DataListItem/index.cjs +2 -0
  46. package/dist/DataList/components/DataListItem/index.mjs +2 -0
  47. package/dist/DataList/components/DataListItemActions/index.cjs +2 -0
  48. package/dist/DataList/components/DataListItemActions/index.mjs +2 -0
  49. package/dist/DataList/components/DataListItemActionsOverflow/index.cjs +2 -0
  50. package/dist/DataList/components/DataListItemActionsOverflow/index.mjs +2 -0
  51. package/dist/DataList/components/DataListItems/index.cjs +2 -0
  52. package/dist/DataList/components/DataListItems/index.mjs +2 -0
  53. package/dist/DataList/components/DataListLayout/index.cjs +2 -0
  54. package/dist/DataList/components/DataListLayout/index.mjs +2 -0
  55. package/dist/DataList/components/DataListLayoutActions/index.cjs +2 -0
  56. package/dist/DataList/components/DataListLayoutActions/index.mjs +2 -0
  57. package/dist/DataList/index.cjs +2 -0
  58. package/dist/DataList/index.mjs +2 -0
  59. package/dist/DataTable-cjs.js +1 -0
  60. package/dist/DataTable-es.js +1 -0
  61. package/dist/DatePicker/index.cjs +2 -0
  62. package/dist/DatePicker/index.mjs +2 -0
  63. package/dist/DatePicker-cjs.js +8 -7
  64. package/dist/DatePicker-es.js +6 -5
  65. package/dist/Dialog/index.cjs +2 -1
  66. package/dist/Dialog/index.mjs +2 -1
  67. package/dist/DrawerDescription-cjs.js +99 -268
  68. package/dist/DrawerDescription-es.js +103 -270
  69. package/dist/DrawerGrid-cjs.js +1 -0
  70. package/dist/DrawerGrid-es.js +1 -0
  71. package/dist/DrawerTitle-cjs.js +6 -2
  72. package/dist/DrawerTitle-es.js +7 -3
  73. package/dist/FeatureSwitch-cjs.js +1 -0
  74. package/dist/FeatureSwitch-es.js +1 -0
  75. package/dist/FieldDescription-cjs.js +181 -184
  76. package/dist/FieldDescription-es.js +184 -187
  77. package/dist/FilterPicker/components/FilterPickerActivator/index.cjs +2 -0
  78. package/dist/FilterPicker/components/FilterPickerActivator/index.mjs +2 -0
  79. package/dist/FilterPicker/components/FilterPickerContent/index.cjs +2 -0
  80. package/dist/FilterPicker/components/FilterPickerContent/index.mjs +2 -0
  81. package/dist/FilterPicker/components/FilterPickerTrigger/index.cjs +2 -0
  82. package/dist/FilterPicker/components/FilterPickerTrigger/index.mjs +2 -0
  83. package/dist/FilterPicker/index.cjs +2 -0
  84. package/dist/FilterPicker/index.mjs +2 -0
  85. package/dist/FilterPickerContent-cjs.js +5 -4
  86. package/dist/FilterPickerContent-es.js +2 -1
  87. package/dist/FormFieldWrapper-cjs.js +1 -0
  88. package/dist/FormFieldWrapper-es.js +1 -0
  89. package/dist/FormatFile/index.cjs +2 -0
  90. package/dist/FormatFile/index.mjs +2 -0
  91. package/dist/FormatFile-cjs.js +1 -0
  92. package/dist/FormatFile-es.js +1 -0
  93. package/dist/Gallery/index.cjs +2 -0
  94. package/dist/Gallery/index.mjs +2 -0
  95. package/dist/InputAvatar-cjs.js +1 -0
  96. package/dist/InputAvatar-es.js +1 -0
  97. package/dist/InputDate/index.cjs +2 -0
  98. package/dist/InputDate/index.mjs +2 -0
  99. package/dist/InputDate-cjs.js +1 -0
  100. package/dist/InputDate-es.js +1 -0
  101. package/dist/InputNumber/index.cjs +2 -1
  102. package/dist/InputNumber/index.mjs +2 -1
  103. package/dist/InternalChipDismissible-cjs.js +1 -0
  104. package/dist/InternalChipDismissible-es.js +1 -0
  105. package/dist/LightBox/index.cjs +2 -0
  106. package/dist/LightBox/index.mjs +2 -0
  107. package/dist/LightBox-cjs.js +1 -0
  108. package/dist/LightBox-es.js +1 -0
  109. package/dist/Menu/index.cjs +2 -1
  110. package/dist/Menu/index.mjs +2 -1
  111. package/dist/Menu-cjs.js +6 -4
  112. package/dist/Menu-es.js +3 -1
  113. package/dist/MenuSubmenuTrigger-cjs.js +164 -206
  114. package/dist/MenuSubmenuTrigger-es.js +152 -194
  115. package/dist/Modal/index.cjs +3 -1
  116. package/dist/Modal/index.mjs +4 -2
  117. package/dist/NumberFieldInput-cjs.js +308 -187
  118. package/dist/NumberFieldInput-es.js +308 -187
  119. package/dist/Page/index.cjs +2 -1
  120. package/dist/Page/index.mjs +2 -1
  121. package/dist/Page-cjs.js +1 -0
  122. package/dist/Page-es.js +1 -0
  123. package/dist/Popover/index.cjs +2 -0
  124. package/dist/Popover/index.mjs +2 -0
  125. package/dist/Popover-cjs.js +9 -7
  126. package/dist/Popover-es.js +3 -1
  127. package/dist/ProgressBar-cjs.js +1 -0
  128. package/dist/ProgressBar-es.js +1 -0
  129. package/dist/ScrollAreaViewport-cjs.js +1093 -747
  130. package/dist/ScrollAreaViewport-es.js +1081 -734
  131. package/dist/Select/index.cjs +2 -1
  132. package/dist/Select/index.mjs +2 -1
  133. package/dist/SelectGroupLabel-cjs.js +306 -207
  134. package/dist/SelectGroupLabel-es.js +302 -203
  135. package/dist/SideDrawer-cjs.js +1 -0
  136. package/dist/SideDrawer-es.js +1 -0
  137. package/dist/Spinner-cjs.js +1 -0
  138. package/dist/Spinner-es.js +1 -0
  139. package/dist/Tooltip/index.cjs +2 -0
  140. package/dist/Tooltip/index.mjs +2 -0
  141. package/dist/Tooltip-cjs.js +7 -6
  142. package/dist/Tooltip-es.js +2 -1
  143. package/dist/dialogReturnFocus-cjs.js +1 -1
  144. package/dist/dialogReturnFocus-es.js +2 -2
  145. package/dist/floating-ui.react-cjs.js +192 -2564
  146. package/dist/floating-ui.react-dom-cjs.js +2103 -0
  147. package/dist/floating-ui.react-dom-es.js +2072 -0
  148. package/dist/floating-ui.react-es.js +156 -2519
  149. package/dist/floating-ui.utils-cjs.js +342 -0
  150. package/dist/floating-ui.utils-es.js +300 -0
  151. package/dist/index.cjs +4 -3
  152. package/dist/index.mjs +4 -3
  153. package/dist/primitives/BottomSheet/index.cjs +1 -1
  154. package/dist/primitives/BottomSheet/index.mjs +1 -1
  155. package/dist/primitives/ComboboxPrimitive/index.cjs +4 -2
  156. package/dist/primitives/ComboboxPrimitive/index.mjs +4 -2
  157. package/dist/primitives/SelectPrimitive/index.cjs +2 -0
  158. package/dist/primitives/SelectPrimitive/index.mjs +2 -0
  159. package/dist/primitives/index.cjs +3 -2
  160. package/dist/primitives/index.mjs +3 -2
  161. package/dist/scrollEdges-cjs.js +11 -1
  162. package/dist/scrollEdges-es.js +11 -1
  163. package/dist/sharedHelpers/i18n/index.cjs +1 -0
  164. package/dist/sharedHelpers/i18n/index.d.ts +1 -0
  165. package/dist/sharedHelpers/i18n/index.mjs +1 -1
  166. package/dist/sharedHelpers/i18n/releasedLanguages.d.ts +12 -0
  167. package/dist/sharedHelpers/i18n/useReleasedLocale.d.ts +6 -0
  168. package/dist/showToast-cjs.js +1 -1
  169. package/dist/showToast-es.js +1 -1
  170. package/dist/testUtils/releasedLanguages.d.ts +16 -0
  171. package/dist/unstyledPrimitives/index.cjs +478 -720
  172. package/dist/unstyledPrimitives/index.mjs +421 -663
  173. package/dist/useAtlantisI18n-cjs.js +44 -11
  174. package/dist/useAtlantisI18n-es.js +44 -12
  175. package/dist/useCompositeListItem-cjs.js +361 -2108
  176. package/dist/useCompositeListItem-es.js +331 -2076
  177. package/dist/useLabel-cjs.js +3 -2
  178. package/dist/useLabel-es.js +3 -2
  179. package/dist/useRenderElement-cjs.js +7 -9
  180. package/dist/useRenderElement-es.js +7 -9
  181. package/dist/useScrollLock-cjs.js +344 -819
  182. package/dist/useScrollLock-es.js +296 -732
  183. package/dist/useScrollToActive-cjs.js +5 -4
  184. package/dist/useScrollToActive-es.js +2 -1
  185. package/package.json +3 -3
  186. package/dist/scrollable-cjs.js +0 -58
  187. package/dist/scrollable-es.js +0 -54
@@ -0,0 +1,2103 @@
1
+ 'use strict';
2
+
3
+ var floatingUi_utils = require('./floating-ui.utils-cjs.js');
4
+ var React = require('react');
5
+ var ReactDOM = require('react-dom');
6
+
7
+ function _interopNamespaceDefault(e) {
8
+ var n = Object.create(null);
9
+ if (e) {
10
+ Object.keys(e).forEach(function (k) {
11
+ if (k !== 'default') {
12
+ var d = Object.getOwnPropertyDescriptor(e, k);
13
+ Object.defineProperty(n, k, d.get ? d : {
14
+ enumerable: true,
15
+ get: function () { return e[k]; }
16
+ });
17
+ }
18
+ });
19
+ }
20
+ n.default = e;
21
+ return Object.freeze(n);
22
+ }
23
+
24
+ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
25
+ var ReactDOM__namespace = /*#__PURE__*/_interopNamespaceDefault(ReactDOM);
26
+
27
+ function computeCoordsFromPlacement(_ref, placement, rtl) {
28
+ let {
29
+ reference,
30
+ floating
31
+ } = _ref;
32
+ const sideAxis = floatingUi_utils.getSideAxis(placement);
33
+ const alignmentAxis = floatingUi_utils.getAlignmentAxis(placement);
34
+ const alignLength = floatingUi_utils.getAxisLength(alignmentAxis);
35
+ const side = floatingUi_utils.getSide(placement);
36
+ const isVertical = sideAxis === 'y';
37
+ const commonX = reference.x + reference.width / 2 - floating.width / 2;
38
+ const commonY = reference.y + reference.height / 2 - floating.height / 2;
39
+ const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
40
+ let coords;
41
+ switch (side) {
42
+ case 'top':
43
+ coords = {
44
+ x: commonX,
45
+ y: reference.y - floating.height
46
+ };
47
+ break;
48
+ case 'bottom':
49
+ coords = {
50
+ x: commonX,
51
+ y: reference.y + reference.height
52
+ };
53
+ break;
54
+ case 'right':
55
+ coords = {
56
+ x: reference.x + reference.width,
57
+ y: commonY
58
+ };
59
+ break;
60
+ case 'left':
61
+ coords = {
62
+ x: reference.x - floating.width,
63
+ y: commonY
64
+ };
65
+ break;
66
+ default:
67
+ coords = {
68
+ x: reference.x,
69
+ y: reference.y
70
+ };
71
+ }
72
+ switch (floatingUi_utils.getAlignment(placement)) {
73
+ case 'start':
74
+ coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
75
+ break;
76
+ case 'end':
77
+ coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
78
+ break;
79
+ }
80
+ return coords;
81
+ }
82
+
83
+ /**
84
+ * Resolves with an object of overflow side offsets that determine how much the
85
+ * element is overflowing a given clipping boundary on each side.
86
+ * - positive = overflowing the boundary by that number of pixels
87
+ * - negative = how many pixels left before it will overflow
88
+ * - 0 = lies flush with the boundary
89
+ * @see https://floating-ui.com/docs/detectOverflow
90
+ */
91
+ async function detectOverflow(state, options) {
92
+ var _await$platform$isEle;
93
+ if (options === void 0) {
94
+ options = {};
95
+ }
96
+ const {
97
+ x,
98
+ y,
99
+ platform,
100
+ rects,
101
+ elements,
102
+ strategy
103
+ } = state;
104
+ const {
105
+ boundary = 'clippingAncestors',
106
+ rootBoundary = 'viewport',
107
+ elementContext = 'floating',
108
+ altBoundary = false,
109
+ padding = 0
110
+ } = floatingUi_utils.evaluate(options, state);
111
+ const paddingObject = floatingUi_utils.getPaddingObject(padding);
112
+ const altContext = elementContext === 'floating' ? 'reference' : 'floating';
113
+ const element = elements[altBoundary ? altContext : elementContext];
114
+ const clippingClientRect = floatingUi_utils.rectToClientRect(await platform.getClippingRect({
115
+ 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))),
116
+ boundary,
117
+ rootBoundary,
118
+ strategy
119
+ }));
120
+ const rect = elementContext === 'floating' ? {
121
+ x,
122
+ y,
123
+ width: rects.floating.width,
124
+ height: rects.floating.height
125
+ } : rects.reference;
126
+ const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
127
+ const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
128
+ x: 1,
129
+ y: 1
130
+ } : {
131
+ x: 1,
132
+ y: 1
133
+ };
134
+ const elementClientRect = floatingUi_utils.rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
135
+ elements,
136
+ rect,
137
+ offsetParent,
138
+ strategy
139
+ }) : rect);
140
+ return {
141
+ top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
142
+ bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
143
+ left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
144
+ right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
145
+ };
146
+ }
147
+
148
+ // Maximum number of resets that can occur before bailing to avoid infinite reset loops.
149
+ const MAX_RESET_COUNT = 50;
150
+
151
+ /**
152
+ * Computes the `x` and `y` coordinates that will place the floating element
153
+ * next to a given reference element.
154
+ *
155
+ * This export does not have any `platform` interface logic. You will need to
156
+ * write one for the platform you are using Floating UI with.
157
+ */
158
+ const computePosition$1 = async (reference, floating, config) => {
159
+ const {
160
+ placement = 'bottom',
161
+ strategy = 'absolute',
162
+ middleware = [],
163
+ platform
164
+ } = config;
165
+ const platformWithDetectOverflow = platform.detectOverflow ? platform : {
166
+ ...platform,
167
+ detectOverflow
168
+ };
169
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
170
+ let rects = await platform.getElementRects({
171
+ reference,
172
+ floating,
173
+ strategy
174
+ });
175
+ let {
176
+ x,
177
+ y
178
+ } = computeCoordsFromPlacement(rects, placement, rtl);
179
+ let statefulPlacement = placement;
180
+ let resetCount = 0;
181
+ const middlewareData = {};
182
+ for (let i = 0; i < middleware.length; i++) {
183
+ const currentMiddleware = middleware[i];
184
+ if (!currentMiddleware) {
185
+ continue;
186
+ }
187
+ const {
188
+ name,
189
+ fn
190
+ } = currentMiddleware;
191
+ const {
192
+ x: nextX,
193
+ y: nextY,
194
+ data,
195
+ reset
196
+ } = await fn({
197
+ x,
198
+ y,
199
+ initialPlacement: placement,
200
+ placement: statefulPlacement,
201
+ strategy,
202
+ middlewareData,
203
+ rects,
204
+ platform: platformWithDetectOverflow,
205
+ elements: {
206
+ reference,
207
+ floating
208
+ }
209
+ });
210
+ x = nextX != null ? nextX : x;
211
+ y = nextY != null ? nextY : y;
212
+ middlewareData[name] = {
213
+ ...middlewareData[name],
214
+ ...data
215
+ };
216
+ if (reset && resetCount < MAX_RESET_COUNT) {
217
+ resetCount++;
218
+ if (typeof reset === 'object') {
219
+ if (reset.placement) {
220
+ statefulPlacement = reset.placement;
221
+ }
222
+ if (reset.rects) {
223
+ rects = reset.rects === true ? await platform.getElementRects({
224
+ reference,
225
+ floating,
226
+ strategy
227
+ }) : reset.rects;
228
+ }
229
+ ({
230
+ x,
231
+ y
232
+ } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
233
+ }
234
+ i = -1;
235
+ }
236
+ }
237
+ return {
238
+ x,
239
+ y,
240
+ placement: statefulPlacement,
241
+ strategy,
242
+ middlewareData
243
+ };
244
+ };
245
+
246
+ /**
247
+ * Provides data to position an inner element of the floating element so that it
248
+ * appears centered to the reference element.
249
+ * @see https://floating-ui.com/docs/arrow
250
+ */
251
+ const arrow$3 = options => ({
252
+ name: 'arrow',
253
+ options,
254
+ async fn(state) {
255
+ const {
256
+ x,
257
+ y,
258
+ placement,
259
+ rects,
260
+ platform,
261
+ elements,
262
+ middlewareData
263
+ } = state;
264
+ // Since `element` is required, we don't Partial<> the type.
265
+ const {
266
+ element,
267
+ padding = 0
268
+ } = floatingUi_utils.evaluate(options, state) || {};
269
+ if (element == null) {
270
+ return {};
271
+ }
272
+ const paddingObject = floatingUi_utils.getPaddingObject(padding);
273
+ const coords = {
274
+ x,
275
+ y
276
+ };
277
+ const axis = floatingUi_utils.getAlignmentAxis(placement);
278
+ const length = floatingUi_utils.getAxisLength(axis);
279
+ const arrowDimensions = await platform.getDimensions(element);
280
+ const isYAxis = axis === 'y';
281
+ const minProp = isYAxis ? 'top' : 'left';
282
+ const maxProp = isYAxis ? 'bottom' : 'right';
283
+ const clientProp = isYAxis ? 'clientHeight' : 'clientWidth';
284
+ const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
285
+ const startDiff = coords[axis] - rects.reference[axis];
286
+ const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
287
+ let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
288
+
289
+ // DOM platform can return `window` as the `offsetParent`.
290
+ if (!clientSize || !(await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent)))) {
291
+ clientSize = elements.floating[clientProp] || rects.floating[length];
292
+ }
293
+ const centerToReference = endDiff / 2 - startDiff / 2;
294
+
295
+ // If the padding is large enough that it causes the arrow to no longer be
296
+ // centered, modify the padding so that it is centered.
297
+ const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
298
+ const minPadding = floatingUi_utils.min(paddingObject[minProp], largestPossiblePadding);
299
+ const maxPadding = floatingUi_utils.min(paddingObject[maxProp], largestPossiblePadding);
300
+
301
+ // Make sure the arrow doesn't overflow the floating element if the center
302
+ // point is outside the floating element's bounds.
303
+ const min$1 = minPadding;
304
+ const max = clientSize - arrowDimensions[length] - maxPadding;
305
+ const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
306
+ const offset = floatingUi_utils.clamp(min$1, center, max);
307
+
308
+ // If the reference is small enough that the arrow's padding causes it to
309
+ // to point to nothing for an aligned placement, adjust the offset of the
310
+ // floating element itself. To ensure `shift()` continues to take action,
311
+ // a single reset is performed when this is true.
312
+ const shouldAddOffset = !middlewareData.arrow && floatingUi_utils.getAlignment(placement) != null && center !== offset && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
313
+ const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max : 0;
314
+ return {
315
+ [axis]: coords[axis] + alignmentOffset,
316
+ data: {
317
+ [axis]: offset,
318
+ centerOffset: center - offset - alignmentOffset,
319
+ ...(shouldAddOffset && {
320
+ alignmentOffset
321
+ })
322
+ },
323
+ reset: shouldAddOffset
324
+ };
325
+ }
326
+ });
327
+
328
+ function getPlacementList(alignment, autoAlignment, allowedPlacements) {
329
+ const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter(placement => floatingUi_utils.getAlignment(placement) === alignment), ...allowedPlacements.filter(placement => floatingUi_utils.getAlignment(placement) !== alignment)] : allowedPlacements.filter(placement => floatingUi_utils.getSide(placement) === placement);
330
+ return allowedPlacementsSortedByAlignment.filter(placement => {
331
+ if (alignment) {
332
+ return floatingUi_utils.getAlignment(placement) === alignment || (autoAlignment ? floatingUi_utils.getOppositeAlignmentPlacement(placement) !== placement : false);
333
+ }
334
+ return true;
335
+ });
336
+ }
337
+ /**
338
+ * Optimizes the visibility of the floating element by choosing the placement
339
+ * that has the most space available automatically, without needing to specify a
340
+ * preferred placement. Alternative to `flip`.
341
+ * @see https://floating-ui.com/docs/autoPlacement
342
+ */
343
+ const autoPlacement$2 = function (options) {
344
+ if (options === void 0) {
345
+ options = {};
346
+ }
347
+ return {
348
+ name: 'autoPlacement',
349
+ options,
350
+ async fn(state) {
351
+ var _middlewareData$autoP, _middlewareData$autoP2, _placementsThatFitOnE;
352
+ const {
353
+ rects,
354
+ middlewareData,
355
+ placement,
356
+ platform,
357
+ elements
358
+ } = state;
359
+ const {
360
+ crossAxis = false,
361
+ alignment,
362
+ allowedPlacements = floatingUi_utils.placements,
363
+ autoAlignment = true,
364
+ ...detectOverflowOptions
365
+ } = floatingUi_utils.evaluate(options, state);
366
+ const placements$1 = alignment !== undefined || allowedPlacements === floatingUi_utils.placements ? getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements;
367
+ const overflow = await platform.detectOverflow(state, detectOverflowOptions);
368
+ const currentIndex = ((_middlewareData$autoP = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP.index) || 0;
369
+ const currentPlacement = placements$1[currentIndex];
370
+ if (currentPlacement == null) {
371
+ return {};
372
+ }
373
+ const alignmentSides = floatingUi_utils.getAlignmentSides(currentPlacement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
374
+
375
+ // Make `computeCoords` start from the right place.
376
+ if (placement !== currentPlacement) {
377
+ return {
378
+ reset: {
379
+ placement: placements$1[0]
380
+ }
381
+ };
382
+ }
383
+ const currentOverflows = [overflow[floatingUi_utils.getSide(currentPlacement)], overflow[alignmentSides[0]], overflow[alignmentSides[1]]];
384
+ const allOverflows = [...(((_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.overflows) || []), {
385
+ placement: currentPlacement,
386
+ overflows: currentOverflows
387
+ }];
388
+ const nextPlacement = placements$1[currentIndex + 1];
389
+
390
+ // There are more placements to check.
391
+ if (nextPlacement) {
392
+ return {
393
+ data: {
394
+ index: currentIndex + 1,
395
+ overflows: allOverflows
396
+ },
397
+ reset: {
398
+ placement: nextPlacement
399
+ }
400
+ };
401
+ }
402
+ const placementsSortedByMostSpace = allOverflows.map(d => {
403
+ const alignment = floatingUi_utils.getAlignment(d.placement);
404
+ return [d.placement, alignment && crossAxis ?
405
+ // Check along the mainAxis and main crossAxis side.
406
+ d.overflows.slice(0, 2).reduce((acc, v) => acc + v, 0) :
407
+ // Check only the mainAxis.
408
+ d.overflows[0], d.overflows];
409
+ }).sort((a, b) => a[1] - b[1]);
410
+ const placementsThatFitOnEachSide = placementsSortedByMostSpace.filter(d => d[2].slice(0,
411
+ // Aligned placements should not check their opposite crossAxis
412
+ // side.
413
+ floatingUi_utils.getAlignment(d[0]) ? 2 : 3).every(v => v <= 0));
414
+ const resetPlacement = ((_placementsThatFitOnE = placementsThatFitOnEachSide[0]) == null ? void 0 : _placementsThatFitOnE[0]) || placementsSortedByMostSpace[0][0];
415
+ if (resetPlacement !== placement) {
416
+ return {
417
+ data: {
418
+ index: currentIndex + 1,
419
+ overflows: allOverflows
420
+ },
421
+ reset: {
422
+ placement: resetPlacement
423
+ }
424
+ };
425
+ }
426
+ return {};
427
+ }
428
+ };
429
+ };
430
+
431
+ /**
432
+ * Optimizes the visibility of the floating element by flipping the `placement`
433
+ * in order to keep it in view when the preferred placement(s) will overflow the
434
+ * clipping boundary. Alternative to `autoPlacement`.
435
+ * @see https://floating-ui.com/docs/flip
436
+ */
437
+ const flip$2 = function (options) {
438
+ if (options === void 0) {
439
+ options = {};
440
+ }
441
+ return {
442
+ name: 'flip',
443
+ options,
444
+ async fn(state) {
445
+ var _middlewareData$arrow, _middlewareData$flip;
446
+ const {
447
+ placement,
448
+ middlewareData,
449
+ rects,
450
+ initialPlacement,
451
+ platform,
452
+ elements
453
+ } = state;
454
+ const {
455
+ mainAxis: checkMainAxis = true,
456
+ crossAxis: checkCrossAxis = true,
457
+ fallbackPlacements: specifiedFallbackPlacements,
458
+ fallbackStrategy = 'bestFit',
459
+ fallbackAxisSideDirection = 'none',
460
+ flipAlignment = true,
461
+ ...detectOverflowOptions
462
+ } = floatingUi_utils.evaluate(options, state);
463
+
464
+ // If a reset by the arrow was caused due to an alignment offset being
465
+ // added, we should skip any logic now since `flip()` has already done its
466
+ // work.
467
+ // https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643
468
+ if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
469
+ return {};
470
+ }
471
+ const side = floatingUi_utils.getSide(placement);
472
+ const initialSideAxis = floatingUi_utils.getSideAxis(initialPlacement);
473
+ const isBasePlacement = floatingUi_utils.getSide(initialPlacement) === initialPlacement;
474
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
475
+ const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [floatingUi_utils.getOppositePlacement(initialPlacement)] : floatingUi_utils.getExpandedPlacements(initialPlacement));
476
+ const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== 'none';
477
+ if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
478
+ fallbackPlacements.push(...floatingUi_utils.getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
479
+ }
480
+ const placements = [initialPlacement, ...fallbackPlacements];
481
+ const overflow = await platform.detectOverflow(state, detectOverflowOptions);
482
+ const overflows = [];
483
+ let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
484
+ if (checkMainAxis) {
485
+ overflows.push(overflow[side]);
486
+ }
487
+ if (checkCrossAxis) {
488
+ const sides = floatingUi_utils.getAlignmentSides(placement, rects, rtl);
489
+ overflows.push(overflow[sides[0]], overflow[sides[1]]);
490
+ }
491
+ overflowsData = [...overflowsData, {
492
+ placement,
493
+ overflows
494
+ }];
495
+
496
+ // One or more sides is overflowing.
497
+ if (!overflows.every(side => side <= 0)) {
498
+ var _middlewareData$flip2, _overflowsData$filter;
499
+ const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
500
+ const nextPlacement = placements[nextIndex];
501
+ if (nextPlacement) {
502
+ const ignoreCrossAxisOverflow = checkCrossAxis === 'alignment' ? initialSideAxis !== floatingUi_utils.getSideAxis(nextPlacement) : false;
503
+ if (!ignoreCrossAxisOverflow ||
504
+ // We leave the current main axis only if every placement on that axis
505
+ // overflows the main axis.
506
+ overflowsData.every(d => floatingUi_utils.getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) {
507
+ // Try next placement and re-run the lifecycle.
508
+ return {
509
+ data: {
510
+ index: nextIndex,
511
+ overflows: overflowsData
512
+ },
513
+ reset: {
514
+ placement: nextPlacement
515
+ }
516
+ };
517
+ }
518
+ }
519
+
520
+ // First, find the candidates that fit on the mainAxis side of overflow,
521
+ // then find the placement that fits the best on the main crossAxis side.
522
+ 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;
523
+
524
+ // Otherwise fallback.
525
+ if (!resetPlacement) {
526
+ switch (fallbackStrategy) {
527
+ case 'bestFit':
528
+ {
529
+ var _overflowsData$filter2;
530
+ const placement = (_overflowsData$filter2 = overflowsData.filter(d => {
531
+ if (hasFallbackAxisSideDirection) {
532
+ const currentSideAxis = floatingUi_utils.getSideAxis(d.placement);
533
+ return currentSideAxis === initialSideAxis ||
534
+ // Create a bias to the `y` side axis due to horizontal
535
+ // reading directions favoring greater width.
536
+ currentSideAxis === 'y';
537
+ }
538
+ return true;
539
+ }).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$filter2[0];
540
+ if (placement) {
541
+ resetPlacement = placement;
542
+ }
543
+ break;
544
+ }
545
+ case 'initialPlacement':
546
+ resetPlacement = initialPlacement;
547
+ break;
548
+ }
549
+ }
550
+ if (placement !== resetPlacement) {
551
+ return {
552
+ reset: {
553
+ placement: resetPlacement
554
+ }
555
+ };
556
+ }
557
+ }
558
+ return {};
559
+ }
560
+ };
561
+ };
562
+
563
+ function getSideOffsets(overflow, rect) {
564
+ return {
565
+ top: overflow.top - rect.height,
566
+ right: overflow.right - rect.width,
567
+ bottom: overflow.bottom - rect.height,
568
+ left: overflow.left - rect.width
569
+ };
570
+ }
571
+ function isAnySideFullyClipped(overflow) {
572
+ return floatingUi_utils.sides.some(side => overflow[side] >= 0);
573
+ }
574
+ /**
575
+ * Provides data to hide the floating element in applicable situations, such as
576
+ * when it is not in the same clipping context as the reference element.
577
+ * @see https://floating-ui.com/docs/hide
578
+ */
579
+ const hide$2 = function (options) {
580
+ if (options === void 0) {
581
+ options = {};
582
+ }
583
+ return {
584
+ name: 'hide',
585
+ options,
586
+ async fn(state) {
587
+ const {
588
+ rects,
589
+ platform
590
+ } = state;
591
+ const {
592
+ strategy = 'referenceHidden',
593
+ ...detectOverflowOptions
594
+ } = floatingUi_utils.evaluate(options, state);
595
+ switch (strategy) {
596
+ case 'referenceHidden':
597
+ {
598
+ const overflow = await platform.detectOverflow(state, {
599
+ ...detectOverflowOptions,
600
+ elementContext: 'reference'
601
+ });
602
+ const offsets = getSideOffsets(overflow, rects.reference);
603
+ return {
604
+ data: {
605
+ referenceHiddenOffsets: offsets,
606
+ referenceHidden: isAnySideFullyClipped(offsets)
607
+ }
608
+ };
609
+ }
610
+ case 'escaped':
611
+ {
612
+ const overflow = await platform.detectOverflow(state, {
613
+ ...detectOverflowOptions,
614
+ altBoundary: true
615
+ });
616
+ const offsets = getSideOffsets(overflow, rects.floating);
617
+ return {
618
+ data: {
619
+ escapedOffsets: offsets,
620
+ escaped: isAnySideFullyClipped(offsets)
621
+ }
622
+ };
623
+ }
624
+ default:
625
+ {
626
+ return {};
627
+ }
628
+ }
629
+ }
630
+ };
631
+ };
632
+
633
+ const originSides = /*#__PURE__*/new Set(['left', 'top']);
634
+
635
+ // For type backwards-compatibility, the `OffsetOptions` type was also
636
+ // Derivable.
637
+
638
+ async function convertValueToCoords(state, options) {
639
+ const {
640
+ placement,
641
+ platform,
642
+ elements
643
+ } = state;
644
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
645
+ const side = floatingUi_utils.getSide(placement);
646
+ const alignment = floatingUi_utils.getAlignment(placement);
647
+ const isVertical = floatingUi_utils.getSideAxis(placement) === 'y';
648
+ const mainAxisMulti = originSides.has(side) ? -1 : 1;
649
+ const crossAxisMulti = rtl && isVertical ? -1 : 1;
650
+ const rawValue = floatingUi_utils.evaluate(options, state);
651
+
652
+ // eslint-disable-next-line prefer-const
653
+ let {
654
+ mainAxis,
655
+ crossAxis,
656
+ alignmentAxis
657
+ } = typeof rawValue === 'number' ? {
658
+ mainAxis: rawValue,
659
+ crossAxis: 0,
660
+ alignmentAxis: null
661
+ } : {
662
+ mainAxis: rawValue.mainAxis || 0,
663
+ crossAxis: rawValue.crossAxis || 0,
664
+ alignmentAxis: rawValue.alignmentAxis
665
+ };
666
+ if (alignment && typeof alignmentAxis === 'number') {
667
+ crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
668
+ }
669
+ return isVertical ? {
670
+ x: crossAxis * crossAxisMulti,
671
+ y: mainAxis * mainAxisMulti
672
+ } : {
673
+ x: mainAxis * mainAxisMulti,
674
+ y: crossAxis * crossAxisMulti
675
+ };
676
+ }
677
+
678
+ /**
679
+ * Modifies the placement by translating the floating element along the
680
+ * specified axes.
681
+ * A number (shorthand for `mainAxis` or distance), or an axes configuration
682
+ * object may be passed.
683
+ * @see https://floating-ui.com/docs/offset
684
+ */
685
+ const offset$2 = function (options) {
686
+ if (options === void 0) {
687
+ options = 0;
688
+ }
689
+ return {
690
+ name: 'offset',
691
+ options,
692
+ async fn(state) {
693
+ var _middlewareData$offse, _middlewareData$arrow;
694
+ const {
695
+ x,
696
+ y,
697
+ placement,
698
+ middlewareData
699
+ } = state;
700
+ const diffCoords = await convertValueToCoords(state, options);
701
+
702
+ // If the placement is the same and the arrow caused an alignment offset
703
+ // then we don't need to change the positioning coordinates.
704
+ if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
705
+ return {};
706
+ }
707
+ return {
708
+ x: x + diffCoords.x,
709
+ y: y + diffCoords.y,
710
+ data: {
711
+ ...diffCoords,
712
+ placement
713
+ }
714
+ };
715
+ }
716
+ };
717
+ };
718
+
719
+ /**
720
+ * Optimizes the visibility of the floating element by shifting it in order to
721
+ * keep it in view when it will overflow the clipping boundary.
722
+ * @see https://floating-ui.com/docs/shift
723
+ */
724
+ const shift$2 = function (options) {
725
+ if (options === void 0) {
726
+ options = {};
727
+ }
728
+ return {
729
+ name: 'shift',
730
+ options,
731
+ async fn(state) {
732
+ const {
733
+ x,
734
+ y,
735
+ placement,
736
+ platform
737
+ } = state;
738
+ const {
739
+ mainAxis: checkMainAxis = true,
740
+ crossAxis: checkCrossAxis = false,
741
+ limiter = {
742
+ fn: _ref => {
743
+ let {
744
+ x,
745
+ y
746
+ } = _ref;
747
+ return {
748
+ x,
749
+ y
750
+ };
751
+ }
752
+ },
753
+ ...detectOverflowOptions
754
+ } = floatingUi_utils.evaluate(options, state);
755
+ const coords = {
756
+ x,
757
+ y
758
+ };
759
+ const overflow = await platform.detectOverflow(state, detectOverflowOptions);
760
+ const crossAxis = floatingUi_utils.getSideAxis(floatingUi_utils.getSide(placement));
761
+ const mainAxis = floatingUi_utils.getOppositeAxis(crossAxis);
762
+ let mainAxisCoord = coords[mainAxis];
763
+ let crossAxisCoord = coords[crossAxis];
764
+ if (checkMainAxis) {
765
+ const minSide = mainAxis === 'y' ? 'top' : 'left';
766
+ const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
767
+ const min = mainAxisCoord + overflow[minSide];
768
+ const max = mainAxisCoord - overflow[maxSide];
769
+ mainAxisCoord = floatingUi_utils.clamp(min, mainAxisCoord, max);
770
+ }
771
+ if (checkCrossAxis) {
772
+ const minSide = crossAxis === 'y' ? 'top' : 'left';
773
+ const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
774
+ const min = crossAxisCoord + overflow[minSide];
775
+ const max = crossAxisCoord - overflow[maxSide];
776
+ crossAxisCoord = floatingUi_utils.clamp(min, crossAxisCoord, max);
777
+ }
778
+ const limitedCoords = limiter.fn({
779
+ ...state,
780
+ [mainAxis]: mainAxisCoord,
781
+ [crossAxis]: crossAxisCoord
782
+ });
783
+ return {
784
+ ...limitedCoords,
785
+ data: {
786
+ x: limitedCoords.x - x,
787
+ y: limitedCoords.y - y,
788
+ enabled: {
789
+ [mainAxis]: checkMainAxis,
790
+ [crossAxis]: checkCrossAxis
791
+ }
792
+ }
793
+ };
794
+ }
795
+ };
796
+ };
797
+ /**
798
+ * Built-in `limiter` that will stop `shift()` at a certain point.
799
+ */
800
+ const limitShift$2 = function (options) {
801
+ if (options === void 0) {
802
+ options = {};
803
+ }
804
+ return {
805
+ options,
806
+ fn(state) {
807
+ const {
808
+ x,
809
+ y,
810
+ placement,
811
+ rects,
812
+ middlewareData
813
+ } = state;
814
+ const {
815
+ offset = 0,
816
+ mainAxis: checkMainAxis = true,
817
+ crossAxis: checkCrossAxis = true
818
+ } = floatingUi_utils.evaluate(options, state);
819
+ const coords = {
820
+ x,
821
+ y
822
+ };
823
+ const crossAxis = floatingUi_utils.getSideAxis(placement);
824
+ const mainAxis = floatingUi_utils.getOppositeAxis(crossAxis);
825
+ let mainAxisCoord = coords[mainAxis];
826
+ let crossAxisCoord = coords[crossAxis];
827
+ const rawOffset = floatingUi_utils.evaluate(offset, state);
828
+ const computedOffset = typeof rawOffset === 'number' ? {
829
+ mainAxis: rawOffset,
830
+ crossAxis: 0
831
+ } : {
832
+ mainAxis: 0,
833
+ crossAxis: 0,
834
+ ...rawOffset
835
+ };
836
+ if (checkMainAxis) {
837
+ const len = mainAxis === 'y' ? 'height' : 'width';
838
+ const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;
839
+ const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;
840
+ if (mainAxisCoord < limitMin) {
841
+ mainAxisCoord = limitMin;
842
+ } else if (mainAxisCoord > limitMax) {
843
+ mainAxisCoord = limitMax;
844
+ }
845
+ }
846
+ if (checkCrossAxis) {
847
+ var _middlewareData$offse, _middlewareData$offse2;
848
+ const len = mainAxis === 'y' ? 'width' : 'height';
849
+ const isOriginSide = originSides.has(floatingUi_utils.getSide(placement));
850
+ 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);
851
+ 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);
852
+ if (crossAxisCoord < limitMin) {
853
+ crossAxisCoord = limitMin;
854
+ } else if (crossAxisCoord > limitMax) {
855
+ crossAxisCoord = limitMax;
856
+ }
857
+ }
858
+ return {
859
+ [mainAxis]: mainAxisCoord,
860
+ [crossAxis]: crossAxisCoord
861
+ };
862
+ }
863
+ };
864
+ };
865
+
866
+ /**
867
+ * Provides data that allows you to change the size of the floating element —
868
+ * for instance, prevent it from overflowing the clipping boundary or match the
869
+ * width of the reference element.
870
+ * @see https://floating-ui.com/docs/size
871
+ */
872
+ const size$2 = function (options) {
873
+ if (options === void 0) {
874
+ options = {};
875
+ }
876
+ return {
877
+ name: 'size',
878
+ options,
879
+ async fn(state) {
880
+ var _state$middlewareData, _state$middlewareData2;
881
+ const {
882
+ placement,
883
+ rects,
884
+ platform,
885
+ elements
886
+ } = state;
887
+ const {
888
+ apply = () => {},
889
+ ...detectOverflowOptions
890
+ } = floatingUi_utils.evaluate(options, state);
891
+ const overflow = await platform.detectOverflow(state, detectOverflowOptions);
892
+ const side = floatingUi_utils.getSide(placement);
893
+ const alignment = floatingUi_utils.getAlignment(placement);
894
+ const isYAxis = floatingUi_utils.getSideAxis(placement) === 'y';
895
+ const {
896
+ width,
897
+ height
898
+ } = rects.floating;
899
+ let heightSide;
900
+ let widthSide;
901
+ if (side === 'top' || side === 'bottom') {
902
+ heightSide = side;
903
+ widthSide = alignment === ((await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))) ? 'start' : 'end') ? 'left' : 'right';
904
+ } else {
905
+ widthSide = side;
906
+ heightSide = alignment === 'end' ? 'top' : 'bottom';
907
+ }
908
+ const maximumClippingHeight = height - overflow.top - overflow.bottom;
909
+ const maximumClippingWidth = width - overflow.left - overflow.right;
910
+ const overflowAvailableHeight = floatingUi_utils.min(height - overflow[heightSide], maximumClippingHeight);
911
+ const overflowAvailableWidth = floatingUi_utils.min(width - overflow[widthSide], maximumClippingWidth);
912
+ const noShift = !state.middlewareData.shift;
913
+ let availableHeight = overflowAvailableHeight;
914
+ let availableWidth = overflowAvailableWidth;
915
+ if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) {
916
+ availableWidth = maximumClippingWidth;
917
+ }
918
+ if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) {
919
+ availableHeight = maximumClippingHeight;
920
+ }
921
+ if (noShift && !alignment) {
922
+ const xMin = floatingUi_utils.max(overflow.left, 0);
923
+ const xMax = floatingUi_utils.max(overflow.right, 0);
924
+ const yMin = floatingUi_utils.max(overflow.top, 0);
925
+ const yMax = floatingUi_utils.max(overflow.bottom, 0);
926
+ if (isYAxis) {
927
+ availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : floatingUi_utils.max(overflow.left, overflow.right));
928
+ } else {
929
+ availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : floatingUi_utils.max(overflow.top, overflow.bottom));
930
+ }
931
+ }
932
+ await apply({
933
+ ...state,
934
+ availableWidth,
935
+ availableHeight
936
+ });
937
+ const nextDimensions = await platform.getDimensions(elements.floating);
938
+ if (width !== nextDimensions.width || height !== nextDimensions.height) {
939
+ return {
940
+ reset: {
941
+ rects: true
942
+ }
943
+ };
944
+ }
945
+ return {};
946
+ }
947
+ };
948
+ };
949
+
950
+ function getCssDimensions(element) {
951
+ const css = floatingUi_utils.getComputedStyle(element);
952
+ // In testing environments, the `width` and `height` properties are empty
953
+ // strings for SVG elements, returning NaN. Fallback to `0` in this case.
954
+ let width = parseFloat(css.width) || 0;
955
+ let height = parseFloat(css.height) || 0;
956
+ const hasOffset = floatingUi_utils.isHTMLElement(element);
957
+ const offsetWidth = hasOffset ? element.offsetWidth : width;
958
+ const offsetHeight = hasOffset ? element.offsetHeight : height;
959
+ const shouldFallback = floatingUi_utils.round(width) !== offsetWidth || floatingUi_utils.round(height) !== offsetHeight;
960
+ if (shouldFallback) {
961
+ width = offsetWidth;
962
+ height = offsetHeight;
963
+ }
964
+ return {
965
+ width,
966
+ height,
967
+ $: shouldFallback
968
+ };
969
+ }
970
+
971
+ function unwrapElement(element) {
972
+ return !floatingUi_utils.isElement(element) ? element.contextElement : element;
973
+ }
974
+
975
+ function getScale(element) {
976
+ const domElement = unwrapElement(element);
977
+ if (!floatingUi_utils.isHTMLElement(domElement)) {
978
+ return floatingUi_utils.createCoords(1);
979
+ }
980
+ const rect = domElement.getBoundingClientRect();
981
+ const {
982
+ width,
983
+ height,
984
+ $
985
+ } = getCssDimensions(domElement);
986
+ let x = ($ ? floatingUi_utils.round(rect.width) : rect.width) / width;
987
+ let y = ($ ? floatingUi_utils.round(rect.height) : rect.height) / height;
988
+
989
+ // 0, NaN, or Infinity should always fallback to 1.
990
+
991
+ if (!x || !Number.isFinite(x)) {
992
+ x = 1;
993
+ }
994
+ if (!y || !Number.isFinite(y)) {
995
+ y = 1;
996
+ }
997
+ return {
998
+ x,
999
+ y
1000
+ };
1001
+ }
1002
+
1003
+ const noOffsets = /*#__PURE__*/floatingUi_utils.createCoords(0);
1004
+ function getVisualOffsets(element) {
1005
+ const win = floatingUi_utils.getWindow(element);
1006
+ if (!floatingUi_utils.isWebKit() || !win.visualViewport) {
1007
+ return noOffsets;
1008
+ }
1009
+ return {
1010
+ x: win.visualViewport.offsetLeft,
1011
+ y: win.visualViewport.offsetTop
1012
+ };
1013
+ }
1014
+ function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
1015
+ if (isFixed === void 0) {
1016
+ isFixed = false;
1017
+ }
1018
+ if (!floatingOffsetParent || isFixed && floatingOffsetParent !== floatingUi_utils.getWindow(element)) {
1019
+ return false;
1020
+ }
1021
+ return isFixed;
1022
+ }
1023
+
1024
+ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
1025
+ if (includeScale === void 0) {
1026
+ includeScale = false;
1027
+ }
1028
+ if (isFixedStrategy === void 0) {
1029
+ isFixedStrategy = false;
1030
+ }
1031
+ const clientRect = element.getBoundingClientRect();
1032
+ const domElement = unwrapElement(element);
1033
+ let scale = floatingUi_utils.createCoords(1);
1034
+ if (includeScale) {
1035
+ if (offsetParent) {
1036
+ if (floatingUi_utils.isElement(offsetParent)) {
1037
+ scale = getScale(offsetParent);
1038
+ }
1039
+ } else {
1040
+ scale = getScale(element);
1041
+ }
1042
+ }
1043
+ const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : floatingUi_utils.createCoords(0);
1044
+ let x = (clientRect.left + visualOffsets.x) / scale.x;
1045
+ let y = (clientRect.top + visualOffsets.y) / scale.y;
1046
+ let width = clientRect.width / scale.x;
1047
+ let height = clientRect.height / scale.y;
1048
+ if (domElement) {
1049
+ const win = floatingUi_utils.getWindow(domElement);
1050
+ const offsetWin = offsetParent && floatingUi_utils.isElement(offsetParent) ? floatingUi_utils.getWindow(offsetParent) : offsetParent;
1051
+ let currentWin = win;
1052
+ let currentIFrame = floatingUi_utils.getFrameElement(currentWin);
1053
+ while (currentIFrame && offsetParent && offsetWin !== currentWin) {
1054
+ const iframeScale = getScale(currentIFrame);
1055
+ const iframeRect = currentIFrame.getBoundingClientRect();
1056
+ const css = floatingUi_utils.getComputedStyle(currentIFrame);
1057
+ const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
1058
+ const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
1059
+ x *= iframeScale.x;
1060
+ y *= iframeScale.y;
1061
+ width *= iframeScale.x;
1062
+ height *= iframeScale.y;
1063
+ x += left;
1064
+ y += top;
1065
+ currentWin = floatingUi_utils.getWindow(currentIFrame);
1066
+ currentIFrame = floatingUi_utils.getFrameElement(currentWin);
1067
+ }
1068
+ }
1069
+ return floatingUi_utils.rectToClientRect({
1070
+ width,
1071
+ height,
1072
+ x,
1073
+ y
1074
+ });
1075
+ }
1076
+
1077
+ // If <html> has a CSS width greater than the viewport, then this will be
1078
+ // incorrect for RTL.
1079
+ function getWindowScrollBarX(element, rect) {
1080
+ const leftScroll = floatingUi_utils.getNodeScroll(element).scrollLeft;
1081
+ if (!rect) {
1082
+ return getBoundingClientRect(floatingUi_utils.getDocumentElement(element)).left + leftScroll;
1083
+ }
1084
+ return rect.left + leftScroll;
1085
+ }
1086
+
1087
+ function getHTMLOffset(documentElement, scroll) {
1088
+ const htmlRect = documentElement.getBoundingClientRect();
1089
+ const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);
1090
+ const y = htmlRect.top + scroll.scrollTop;
1091
+ return {
1092
+ x,
1093
+ y
1094
+ };
1095
+ }
1096
+
1097
+ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
1098
+ let {
1099
+ elements,
1100
+ rect,
1101
+ offsetParent,
1102
+ strategy
1103
+ } = _ref;
1104
+ const isFixed = strategy === 'fixed';
1105
+ const documentElement = floatingUi_utils.getDocumentElement(offsetParent);
1106
+ const topLayer = elements ? floatingUi_utils.isTopLayer(elements.floating) : false;
1107
+ if (offsetParent === documentElement || topLayer && isFixed) {
1108
+ return rect;
1109
+ }
1110
+ let scroll = {
1111
+ scrollLeft: 0,
1112
+ scrollTop: 0
1113
+ };
1114
+ let scale = floatingUi_utils.createCoords(1);
1115
+ const offsets = floatingUi_utils.createCoords(0);
1116
+ const isOffsetParentAnElement = floatingUi_utils.isHTMLElement(offsetParent);
1117
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1118
+ if (floatingUi_utils.getNodeName(offsetParent) !== 'body' || floatingUi_utils.isOverflowElement(documentElement)) {
1119
+ scroll = floatingUi_utils.getNodeScroll(offsetParent);
1120
+ }
1121
+ if (isOffsetParentAnElement) {
1122
+ const offsetRect = getBoundingClientRect(offsetParent);
1123
+ scale = getScale(offsetParent);
1124
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
1125
+ offsets.y = offsetRect.y + offsetParent.clientTop;
1126
+ }
1127
+ }
1128
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : floatingUi_utils.createCoords(0);
1129
+ return {
1130
+ width: rect.width * scale.x,
1131
+ height: rect.height * scale.y,
1132
+ x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
1133
+ y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
1134
+ };
1135
+ }
1136
+
1137
+ function getClientRects(element) {
1138
+ return Array.from(element.getClientRects());
1139
+ }
1140
+
1141
+ // Gets the entire size of the scrollable document area, even extending outside
1142
+ // of the `<html>` and `<body>` rect bounds if horizontally scrollable.
1143
+ function getDocumentRect(element) {
1144
+ const html = floatingUi_utils.getDocumentElement(element);
1145
+ const scroll = floatingUi_utils.getNodeScroll(element);
1146
+ const body = element.ownerDocument.body;
1147
+ const width = floatingUi_utils.max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
1148
+ const height = floatingUi_utils.max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
1149
+ let x = -scroll.scrollLeft + getWindowScrollBarX(element);
1150
+ const y = -scroll.scrollTop;
1151
+ if (floatingUi_utils.getComputedStyle(body).direction === 'rtl') {
1152
+ x += floatingUi_utils.max(html.clientWidth, body.clientWidth) - width;
1153
+ }
1154
+ return {
1155
+ width,
1156
+ height,
1157
+ x,
1158
+ y
1159
+ };
1160
+ }
1161
+
1162
+ // Safety check: ensure the scrollbar space is reasonable in case this
1163
+ // calculation is affected by unusual styles.
1164
+ // Most scrollbars leave 15-18px of space.
1165
+ const SCROLLBAR_MAX = 25;
1166
+ function getViewportRect(element, strategy) {
1167
+ const win = floatingUi_utils.getWindow(element);
1168
+ const html = floatingUi_utils.getDocumentElement(element);
1169
+ const visualViewport = win.visualViewport;
1170
+ let width = html.clientWidth;
1171
+ let height = html.clientHeight;
1172
+ let x = 0;
1173
+ let y = 0;
1174
+ if (visualViewport) {
1175
+ width = visualViewport.width;
1176
+ height = visualViewport.height;
1177
+ const visualViewportBased = floatingUi_utils.isWebKit();
1178
+ if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
1179
+ x = visualViewport.offsetLeft;
1180
+ y = visualViewport.offsetTop;
1181
+ }
1182
+ }
1183
+ const windowScrollbarX = getWindowScrollBarX(html);
1184
+ // <html> `overflow: hidden` + `scrollbar-gutter: stable` reduces the
1185
+ // visual width of the <html> but this is not considered in the size
1186
+ // of `html.clientWidth`.
1187
+ if (windowScrollbarX <= 0) {
1188
+ const doc = html.ownerDocument;
1189
+ const body = doc.body;
1190
+ const bodyStyles = getComputedStyle(body);
1191
+ const bodyMarginInline = doc.compatMode === 'CSS1Compat' ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
1192
+ const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
1193
+ if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) {
1194
+ width -= clippingStableScrollbarWidth;
1195
+ }
1196
+ } else if (windowScrollbarX <= SCROLLBAR_MAX) {
1197
+ // If the <body> scrollbar is on the left, the width needs to be extended
1198
+ // by the scrollbar amount so there isn't extra space on the right.
1199
+ width += windowScrollbarX;
1200
+ }
1201
+ return {
1202
+ width,
1203
+ height,
1204
+ x,
1205
+ y
1206
+ };
1207
+ }
1208
+
1209
+ // Returns the inner client rect, subtracting scrollbars if present.
1210
+ function getInnerBoundingClientRect(element, strategy) {
1211
+ const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
1212
+ const top = clientRect.top + element.clientTop;
1213
+ const left = clientRect.left + element.clientLeft;
1214
+ const scale = floatingUi_utils.isHTMLElement(element) ? getScale(element) : floatingUi_utils.createCoords(1);
1215
+ const width = element.clientWidth * scale.x;
1216
+ const height = element.clientHeight * scale.y;
1217
+ const x = left * scale.x;
1218
+ const y = top * scale.y;
1219
+ return {
1220
+ width,
1221
+ height,
1222
+ x,
1223
+ y
1224
+ };
1225
+ }
1226
+ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
1227
+ let rect;
1228
+ if (clippingAncestor === 'viewport') {
1229
+ rect = getViewportRect(element, strategy);
1230
+ } else if (clippingAncestor === 'document') {
1231
+ rect = getDocumentRect(floatingUi_utils.getDocumentElement(element));
1232
+ } else if (floatingUi_utils.isElement(clippingAncestor)) {
1233
+ rect = getInnerBoundingClientRect(clippingAncestor, strategy);
1234
+ } else {
1235
+ const visualOffsets = getVisualOffsets(element);
1236
+ rect = {
1237
+ x: clippingAncestor.x - visualOffsets.x,
1238
+ y: clippingAncestor.y - visualOffsets.y,
1239
+ width: clippingAncestor.width,
1240
+ height: clippingAncestor.height
1241
+ };
1242
+ }
1243
+ return floatingUi_utils.rectToClientRect(rect);
1244
+ }
1245
+ function hasFixedPositionAncestor(element, stopNode) {
1246
+ const parentNode = floatingUi_utils.getParentNode(element);
1247
+ if (parentNode === stopNode || !floatingUi_utils.isElement(parentNode) || floatingUi_utils.isLastTraversableNode(parentNode)) {
1248
+ return false;
1249
+ }
1250
+ return floatingUi_utils.getComputedStyle(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
1251
+ }
1252
+
1253
+ // A "clipping ancestor" is an `overflow` element with the characteristic of
1254
+ // clipping (or hiding) child elements. This returns all clipping ancestors
1255
+ // of the given element up the tree.
1256
+ function getClippingElementAncestors(element, cache) {
1257
+ const cachedResult = cache.get(element);
1258
+ if (cachedResult) {
1259
+ return cachedResult;
1260
+ }
1261
+ let result = floatingUi_utils.getOverflowAncestors(element, [], false).filter(el => floatingUi_utils.isElement(el) && floatingUi_utils.getNodeName(el) !== 'body');
1262
+ let currentContainingBlockComputedStyle = null;
1263
+ const elementIsFixed = floatingUi_utils.getComputedStyle(element).position === 'fixed';
1264
+ let currentNode = elementIsFixed ? floatingUi_utils.getParentNode(element) : element;
1265
+
1266
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
1267
+ while (floatingUi_utils.isElement(currentNode) && !floatingUi_utils.isLastTraversableNode(currentNode)) {
1268
+ const computedStyle = floatingUi_utils.getComputedStyle(currentNode);
1269
+ const currentNodeIsContaining = floatingUi_utils.isContainingBlock(currentNode);
1270
+ if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
1271
+ currentContainingBlockComputedStyle = null;
1272
+ }
1273
+ const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === 'absolute' || currentContainingBlockComputedStyle.position === 'fixed') || floatingUi_utils.isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
1274
+ if (shouldDropCurrentNode) {
1275
+ // Drop non-containing blocks.
1276
+ result = result.filter(ancestor => ancestor !== currentNode);
1277
+ } else {
1278
+ // Record last containing block for next iteration.
1279
+ currentContainingBlockComputedStyle = computedStyle;
1280
+ }
1281
+ currentNode = floatingUi_utils.getParentNode(currentNode);
1282
+ }
1283
+ cache.set(element, result);
1284
+ return result;
1285
+ }
1286
+
1287
+ // Gets the maximum area that the element is visible in due to any number of
1288
+ // clipping ancestors.
1289
+ function getClippingRect(_ref) {
1290
+ let {
1291
+ element,
1292
+ boundary,
1293
+ rootBoundary,
1294
+ strategy
1295
+ } = _ref;
1296
+ const elementClippingAncestors = boundary === 'clippingAncestors' ? floatingUi_utils.isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
1297
+ const clippingAncestors = [...elementClippingAncestors, rootBoundary];
1298
+ const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);
1299
+ let top = firstRect.top;
1300
+ let right = firstRect.right;
1301
+ let bottom = firstRect.bottom;
1302
+ let left = firstRect.left;
1303
+ for (let i = 1; i < clippingAncestors.length; i++) {
1304
+ const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy);
1305
+ top = floatingUi_utils.max(rect.top, top);
1306
+ right = floatingUi_utils.min(rect.right, right);
1307
+ bottom = floatingUi_utils.min(rect.bottom, bottom);
1308
+ left = floatingUi_utils.max(rect.left, left);
1309
+ }
1310
+ return {
1311
+ width: right - left,
1312
+ height: bottom - top,
1313
+ x: left,
1314
+ y: top
1315
+ };
1316
+ }
1317
+
1318
+ function getDimensions(element) {
1319
+ const {
1320
+ width,
1321
+ height
1322
+ } = getCssDimensions(element);
1323
+ return {
1324
+ width,
1325
+ height
1326
+ };
1327
+ }
1328
+
1329
+ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
1330
+ const isOffsetParentAnElement = floatingUi_utils.isHTMLElement(offsetParent);
1331
+ const documentElement = floatingUi_utils.getDocumentElement(offsetParent);
1332
+ const isFixed = strategy === 'fixed';
1333
+ const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
1334
+ let scroll = {
1335
+ scrollLeft: 0,
1336
+ scrollTop: 0
1337
+ };
1338
+ const offsets = floatingUi_utils.createCoords(0);
1339
+
1340
+ // If the <body> scrollbar appears on the left (e.g. RTL systems). Use
1341
+ // Firefox with layout.scrollbar.side = 3 in about:config to test this.
1342
+ function setLeftRTLScrollbarOffset() {
1343
+ offsets.x = getWindowScrollBarX(documentElement);
1344
+ }
1345
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1346
+ if (floatingUi_utils.getNodeName(offsetParent) !== 'body' || floatingUi_utils.isOverflowElement(documentElement)) {
1347
+ scroll = floatingUi_utils.getNodeScroll(offsetParent);
1348
+ }
1349
+ if (isOffsetParentAnElement) {
1350
+ const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
1351
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
1352
+ offsets.y = offsetRect.y + offsetParent.clientTop;
1353
+ } else if (documentElement) {
1354
+ setLeftRTLScrollbarOffset();
1355
+ }
1356
+ }
1357
+ if (isFixed && !isOffsetParentAnElement && documentElement) {
1358
+ setLeftRTLScrollbarOffset();
1359
+ }
1360
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : floatingUi_utils.createCoords(0);
1361
+ const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
1362
+ const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
1363
+ return {
1364
+ x,
1365
+ y,
1366
+ width: rect.width,
1367
+ height: rect.height
1368
+ };
1369
+ }
1370
+
1371
+ function isStaticPositioned(element) {
1372
+ return floatingUi_utils.getComputedStyle(element).position === 'static';
1373
+ }
1374
+
1375
+ function getTrueOffsetParent(element, polyfill) {
1376
+ if (!floatingUi_utils.isHTMLElement(element) || floatingUi_utils.getComputedStyle(element).position === 'fixed') {
1377
+ return null;
1378
+ }
1379
+ if (polyfill) {
1380
+ return polyfill(element);
1381
+ }
1382
+ let rawOffsetParent = element.offsetParent;
1383
+
1384
+ // Firefox returns the <html> element as the offsetParent if it's non-static,
1385
+ // while Chrome and Safari return the <body> element. The <body> element must
1386
+ // be used to perform the correct calculations even if the <html> element is
1387
+ // non-static.
1388
+ if (floatingUi_utils.getDocumentElement(element) === rawOffsetParent) {
1389
+ rawOffsetParent = rawOffsetParent.ownerDocument.body;
1390
+ }
1391
+ return rawOffsetParent;
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 win = floatingUi_utils.getWindow(element);
1398
+ if (floatingUi_utils.isTopLayer(element)) {
1399
+ return win;
1400
+ }
1401
+ if (!floatingUi_utils.isHTMLElement(element)) {
1402
+ let svgOffsetParent = floatingUi_utils.getParentNode(element);
1403
+ while (svgOffsetParent && !floatingUi_utils.isLastTraversableNode(svgOffsetParent)) {
1404
+ if (floatingUi_utils.isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
1405
+ return svgOffsetParent;
1406
+ }
1407
+ svgOffsetParent = floatingUi_utils.getParentNode(svgOffsetParent);
1408
+ }
1409
+ return win;
1410
+ }
1411
+ let offsetParent = getTrueOffsetParent(element, polyfill);
1412
+ while (offsetParent && floatingUi_utils.isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
1413
+ offsetParent = getTrueOffsetParent(offsetParent, polyfill);
1414
+ }
1415
+ if (offsetParent && floatingUi_utils.isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !floatingUi_utils.isContainingBlock(offsetParent)) {
1416
+ return win;
1417
+ }
1418
+ return offsetParent || floatingUi_utils.getContainingBlock(element) || win;
1419
+ }
1420
+
1421
+ const getElementRects = async function (data) {
1422
+ const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
1423
+ const getDimensionsFn = this.getDimensions;
1424
+ const floatingDimensions = await getDimensionsFn(data.floating);
1425
+ return {
1426
+ reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
1427
+ floating: {
1428
+ x: 0,
1429
+ y: 0,
1430
+ width: floatingDimensions.width,
1431
+ height: floatingDimensions.height
1432
+ }
1433
+ };
1434
+ };
1435
+
1436
+ function isRTL(element) {
1437
+ return floatingUi_utils.getComputedStyle(element).direction === 'rtl';
1438
+ }
1439
+
1440
+ const platform = {
1441
+ convertOffsetParentRelativeRectToViewportRelativeRect,
1442
+ getDocumentElement: floatingUi_utils.getDocumentElement,
1443
+ getClippingRect,
1444
+ getOffsetParent,
1445
+ getElementRects,
1446
+ getClientRects,
1447
+ getDimensions,
1448
+ getScale,
1449
+ isElement: floatingUi_utils.isElement,
1450
+ isRTL
1451
+ };
1452
+
1453
+ function rectsAreEqual(a, b) {
1454
+ return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
1455
+ }
1456
+
1457
+ // https://samthor.au/2021/observing-dom/
1458
+ function observeMove(element, onMove) {
1459
+ let io = null;
1460
+ let timeoutId;
1461
+ const root = floatingUi_utils.getDocumentElement(element);
1462
+ function cleanup() {
1463
+ var _io;
1464
+ clearTimeout(timeoutId);
1465
+ (_io = io) == null || _io.disconnect();
1466
+ io = null;
1467
+ }
1468
+ function refresh(skip, threshold) {
1469
+ if (skip === void 0) {
1470
+ skip = false;
1471
+ }
1472
+ if (threshold === void 0) {
1473
+ threshold = 1;
1474
+ }
1475
+ cleanup();
1476
+ const elementRectForRootMargin = element.getBoundingClientRect();
1477
+ const {
1478
+ left,
1479
+ top,
1480
+ width,
1481
+ height
1482
+ } = elementRectForRootMargin;
1483
+ if (!skip) {
1484
+ onMove();
1485
+ }
1486
+ if (!width || !height) {
1487
+ return;
1488
+ }
1489
+ const insetTop = floatingUi_utils.floor(top);
1490
+ const insetRight = floatingUi_utils.floor(root.clientWidth - (left + width));
1491
+ const insetBottom = floatingUi_utils.floor(root.clientHeight - (top + height));
1492
+ const insetLeft = floatingUi_utils.floor(left);
1493
+ const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
1494
+ const options = {
1495
+ rootMargin,
1496
+ threshold: floatingUi_utils.max(0, floatingUi_utils.min(1, threshold)) || 1
1497
+ };
1498
+ let isFirstUpdate = true;
1499
+ function handleObserve(entries) {
1500
+ const ratio = entries[0].intersectionRatio;
1501
+ if (ratio !== threshold) {
1502
+ if (!isFirstUpdate) {
1503
+ return refresh();
1504
+ }
1505
+ if (!ratio) {
1506
+ // If the reference is clipped, the ratio is 0. Throttle the refresh
1507
+ // to prevent an infinite loop of updates.
1508
+ timeoutId = setTimeout(() => {
1509
+ refresh(false, 1e-7);
1510
+ }, 1000);
1511
+ } else {
1512
+ refresh(false, ratio);
1513
+ }
1514
+ }
1515
+ if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
1516
+ // It's possible that even though the ratio is reported as 1, the
1517
+ // element is not actually fully within the IntersectionObserver's root
1518
+ // area anymore. This can happen under performance constraints. This may
1519
+ // be a bug in the browser's IntersectionObserver implementation. To
1520
+ // work around this, we compare the element's bounding rect now with
1521
+ // what it was at the time we created the IntersectionObserver. If they
1522
+ // are not equal then the element moved, so we refresh.
1523
+ refresh();
1524
+ }
1525
+ isFirstUpdate = false;
1526
+ }
1527
+
1528
+ // Older browsers don't support a `document` as the root and will throw an
1529
+ // error.
1530
+ try {
1531
+ io = new IntersectionObserver(handleObserve, {
1532
+ ...options,
1533
+ // Handle <iframe>s
1534
+ root: root.ownerDocument
1535
+ });
1536
+ } catch (_e) {
1537
+ io = new IntersectionObserver(handleObserve, options);
1538
+ }
1539
+ io.observe(element);
1540
+ }
1541
+ refresh(true);
1542
+ return cleanup;
1543
+ }
1544
+
1545
+ /**
1546
+ * Automatically updates the position of the floating element when necessary.
1547
+ * Should only be called when the floating element is mounted on the DOM or
1548
+ * visible on the screen.
1549
+ * @returns cleanup function that should be invoked when the floating element is
1550
+ * removed from the DOM or hidden from the screen.
1551
+ * @see https://floating-ui.com/docs/autoUpdate
1552
+ */
1553
+ function autoUpdate(reference, floating, update, options) {
1554
+ if (options === void 0) {
1555
+ options = {};
1556
+ }
1557
+ const {
1558
+ ancestorScroll = true,
1559
+ ancestorResize = true,
1560
+ elementResize = typeof ResizeObserver === 'function',
1561
+ layoutShift = typeof IntersectionObserver === 'function',
1562
+ animationFrame = false
1563
+ } = options;
1564
+ const referenceEl = unwrapElement(reference);
1565
+ const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? floatingUi_utils.getOverflowAncestors(referenceEl) : []), ...(floating ? floatingUi_utils.getOverflowAncestors(floating) : [])] : [];
1566
+ ancestors.forEach(ancestor => {
1567
+ ancestorScroll && ancestor.addEventListener('scroll', update, {
1568
+ passive: true
1569
+ });
1570
+ ancestorResize && ancestor.addEventListener('resize', update);
1571
+ });
1572
+ const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
1573
+ let reobserveFrame = -1;
1574
+ let resizeObserver = null;
1575
+ if (elementResize) {
1576
+ resizeObserver = new ResizeObserver(_ref => {
1577
+ let [firstEntry] = _ref;
1578
+ if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) {
1579
+ // Prevent update loops when using the `size` middleware.
1580
+ // https://github.com/floating-ui/floating-ui/issues/1740
1581
+ resizeObserver.unobserve(floating);
1582
+ cancelAnimationFrame(reobserveFrame);
1583
+ reobserveFrame = requestAnimationFrame(() => {
1584
+ var _resizeObserver;
1585
+ (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
1586
+ });
1587
+ }
1588
+ update();
1589
+ });
1590
+ if (referenceEl && !animationFrame) {
1591
+ resizeObserver.observe(referenceEl);
1592
+ }
1593
+ if (floating) {
1594
+ resizeObserver.observe(floating);
1595
+ }
1596
+ }
1597
+ let frameId;
1598
+ let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
1599
+ if (animationFrame) {
1600
+ frameLoop();
1601
+ }
1602
+ function frameLoop() {
1603
+ const nextRefRect = getBoundingClientRect(reference);
1604
+ if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
1605
+ update();
1606
+ }
1607
+ prevRefRect = nextRefRect;
1608
+ frameId = requestAnimationFrame(frameLoop);
1609
+ }
1610
+ update();
1611
+ return () => {
1612
+ var _resizeObserver2;
1613
+ ancestors.forEach(ancestor => {
1614
+ ancestorScroll && ancestor.removeEventListener('scroll', update);
1615
+ ancestorResize && ancestor.removeEventListener('resize', update);
1616
+ });
1617
+ cleanupIo == null || cleanupIo();
1618
+ (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
1619
+ resizeObserver = null;
1620
+ if (animationFrame) {
1621
+ cancelAnimationFrame(frameId);
1622
+ }
1623
+ };
1624
+ }
1625
+
1626
+ /**
1627
+ * Modifies the placement by translating the floating element along the
1628
+ * specified axes.
1629
+ * A number (shorthand for `mainAxis` or distance), or an axes configuration
1630
+ * object may be passed.
1631
+ * @see https://floating-ui.com/docs/offset
1632
+ */
1633
+ const offset$1 = offset$2;
1634
+
1635
+ /**
1636
+ * Optimizes the visibility of the floating element by choosing the placement
1637
+ * that has the most space available automatically, without needing to specify a
1638
+ * preferred placement. Alternative to `flip`.
1639
+ * @see https://floating-ui.com/docs/autoPlacement
1640
+ */
1641
+ const autoPlacement$1 = autoPlacement$2;
1642
+
1643
+ /**
1644
+ * Optimizes the visibility of the floating element by shifting it in order to
1645
+ * keep it in view when it will overflow the clipping boundary.
1646
+ * @see https://floating-ui.com/docs/shift
1647
+ */
1648
+ const shift$1 = shift$2;
1649
+
1650
+ /**
1651
+ * Optimizes the visibility of the floating element by flipping the `placement`
1652
+ * in order to keep it in view when the preferred placement(s) will overflow the
1653
+ * clipping boundary. Alternative to `autoPlacement`.
1654
+ * @see https://floating-ui.com/docs/flip
1655
+ */
1656
+ const flip$1 = flip$2;
1657
+
1658
+ /**
1659
+ * Provides data that allows you to change the size of the floating element —
1660
+ * for instance, prevent it from overflowing the clipping boundary or match the
1661
+ * width of the reference element.
1662
+ * @see https://floating-ui.com/docs/size
1663
+ */
1664
+ const size$1 = size$2;
1665
+
1666
+ /**
1667
+ * Provides data to hide the floating element in applicable situations, such as
1668
+ * when it is not in the same clipping context as the reference element.
1669
+ * @see https://floating-ui.com/docs/hide
1670
+ */
1671
+ const hide$1 = hide$2;
1672
+
1673
+ /**
1674
+ * Provides data to position an inner element of the floating element so that it
1675
+ * appears centered to the reference element.
1676
+ * @see https://floating-ui.com/docs/arrow
1677
+ */
1678
+ const arrow$2 = arrow$3;
1679
+
1680
+ /**
1681
+ * Built-in `limiter` that will stop `shift()` at a certain point.
1682
+ */
1683
+ const limitShift$1 = limitShift$2;
1684
+
1685
+ /**
1686
+ * Computes the `x` and `y` coordinates that will place the floating element
1687
+ * next to a given reference element.
1688
+ */
1689
+ const computePosition = (reference, floating, options) => {
1690
+ // This caches the expensive `getClippingElementAncestors` function so that
1691
+ // multiple lifecycle resets re-use the same result. It only lives for a
1692
+ // single call. If other functions become expensive, we can add them as well.
1693
+ const cache = new Map();
1694
+ const mergedOptions = {
1695
+ platform,
1696
+ ...options
1697
+ };
1698
+ const platformWithCache = {
1699
+ ...mergedOptions.platform,
1700
+ _c: cache
1701
+ };
1702
+ return computePosition$1(reference, floating, {
1703
+ ...mergedOptions,
1704
+ platform: platformWithCache
1705
+ });
1706
+ };
1707
+
1708
+ var isClient = typeof document !== 'undefined';
1709
+
1710
+ var noop = function noop() {};
1711
+ var index = isClient ? React.useLayoutEffect : noop;
1712
+
1713
+ // Fork of `fast-deep-equal` that only does the comparisons we need and compares
1714
+ // functions
1715
+ function deepEqual(a, b) {
1716
+ if (a === b) {
1717
+ return true;
1718
+ }
1719
+ if (typeof a !== typeof b) {
1720
+ return false;
1721
+ }
1722
+ if (typeof a === 'function' && a.toString() === b.toString()) {
1723
+ return true;
1724
+ }
1725
+ let length;
1726
+ let i;
1727
+ let keys;
1728
+ if (a && b && typeof a === 'object') {
1729
+ if (Array.isArray(a)) {
1730
+ length = a.length;
1731
+ if (length !== b.length) return false;
1732
+ for (i = length; i-- !== 0;) {
1733
+ if (!deepEqual(a[i], b[i])) {
1734
+ return false;
1735
+ }
1736
+ }
1737
+ return true;
1738
+ }
1739
+ keys = Object.keys(a);
1740
+ length = keys.length;
1741
+ if (length !== Object.keys(b).length) {
1742
+ return false;
1743
+ }
1744
+ for (i = length; i-- !== 0;) {
1745
+ if (!{}.hasOwnProperty.call(b, keys[i])) {
1746
+ return false;
1747
+ }
1748
+ }
1749
+ for (i = length; i-- !== 0;) {
1750
+ const key = keys[i];
1751
+ if (key === '_owner' && a.$$typeof) {
1752
+ continue;
1753
+ }
1754
+ if (!deepEqual(a[key], b[key])) {
1755
+ return false;
1756
+ }
1757
+ }
1758
+ return true;
1759
+ }
1760
+ return a !== a && b !== b;
1761
+ }
1762
+
1763
+ function getDPR(element) {
1764
+ if (typeof window === 'undefined') {
1765
+ return 1;
1766
+ }
1767
+ const win = element.ownerDocument.defaultView || window;
1768
+ return win.devicePixelRatio || 1;
1769
+ }
1770
+
1771
+ function roundByDPR(element, value) {
1772
+ const dpr = getDPR(element);
1773
+ return Math.round(value * dpr) / dpr;
1774
+ }
1775
+
1776
+ function useLatestRef(value) {
1777
+ const ref = React__namespace.useRef(value);
1778
+ index(() => {
1779
+ ref.current = value;
1780
+ });
1781
+ return ref;
1782
+ }
1783
+
1784
+ /**
1785
+ * Provides data to position a floating element.
1786
+ * @see https://floating-ui.com/docs/useFloating
1787
+ */
1788
+ function useFloating(options) {
1789
+ if (options === void 0) {
1790
+ options = {};
1791
+ }
1792
+ const {
1793
+ placement = 'bottom',
1794
+ strategy = 'absolute',
1795
+ middleware = [],
1796
+ platform,
1797
+ elements: {
1798
+ reference: externalReference,
1799
+ floating: externalFloating
1800
+ } = {},
1801
+ transform = true,
1802
+ whileElementsMounted,
1803
+ open
1804
+ } = options;
1805
+ const [data, setData] = React__namespace.useState({
1806
+ x: 0,
1807
+ y: 0,
1808
+ strategy,
1809
+ placement,
1810
+ middlewareData: {},
1811
+ isPositioned: false
1812
+ });
1813
+ const [latestMiddleware, setLatestMiddleware] = React__namespace.useState(middleware);
1814
+ if (!deepEqual(latestMiddleware, middleware)) {
1815
+ setLatestMiddleware(middleware);
1816
+ }
1817
+ const [_reference, _setReference] = React__namespace.useState(null);
1818
+ const [_floating, _setFloating] = React__namespace.useState(null);
1819
+ const setReference = React__namespace.useCallback(node => {
1820
+ if (node !== referenceRef.current) {
1821
+ referenceRef.current = node;
1822
+ _setReference(node);
1823
+ }
1824
+ }, []);
1825
+ const setFloating = React__namespace.useCallback(node => {
1826
+ if (node !== floatingRef.current) {
1827
+ floatingRef.current = node;
1828
+ _setFloating(node);
1829
+ }
1830
+ }, []);
1831
+ const referenceEl = externalReference || _reference;
1832
+ const floatingEl = externalFloating || _floating;
1833
+ const referenceRef = React__namespace.useRef(null);
1834
+ const floatingRef = React__namespace.useRef(null);
1835
+ const dataRef = React__namespace.useRef(data);
1836
+ const hasWhileElementsMounted = whileElementsMounted != null;
1837
+ const whileElementsMountedRef = useLatestRef(whileElementsMounted);
1838
+ const platformRef = useLatestRef(platform);
1839
+ const openRef = useLatestRef(open);
1840
+ const update = React__namespace.useCallback(() => {
1841
+ if (!referenceRef.current || !floatingRef.current) {
1842
+ return;
1843
+ }
1844
+ const config = {
1845
+ placement,
1846
+ strategy,
1847
+ middleware: latestMiddleware
1848
+ };
1849
+ if (platformRef.current) {
1850
+ config.platform = platformRef.current;
1851
+ }
1852
+ computePosition(referenceRef.current, floatingRef.current, config).then(data => {
1853
+ const fullData = {
1854
+ ...data,
1855
+ // The floating element's position may be recomputed while it's closed
1856
+ // but still mounted (such as when transitioning out). To ensure
1857
+ // `isPositioned` will be `false` initially on the next open, avoid
1858
+ // setting it to `true` when `open === false` (must be specified).
1859
+ isPositioned: openRef.current !== false
1860
+ };
1861
+ if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) {
1862
+ dataRef.current = fullData;
1863
+ ReactDOM__namespace.flushSync(() => {
1864
+ setData(fullData);
1865
+ });
1866
+ }
1867
+ });
1868
+ }, [latestMiddleware, placement, strategy, platformRef, openRef]);
1869
+ index(() => {
1870
+ if (open === false && dataRef.current.isPositioned) {
1871
+ dataRef.current.isPositioned = false;
1872
+ setData(data => ({
1873
+ ...data,
1874
+ isPositioned: false
1875
+ }));
1876
+ }
1877
+ }, [open]);
1878
+ const isMountedRef = React__namespace.useRef(false);
1879
+ index(() => {
1880
+ isMountedRef.current = true;
1881
+ return () => {
1882
+ isMountedRef.current = false;
1883
+ };
1884
+ }, []);
1885
+ index(() => {
1886
+ if (referenceEl) referenceRef.current = referenceEl;
1887
+ if (floatingEl) floatingRef.current = floatingEl;
1888
+ if (referenceEl && floatingEl) {
1889
+ if (whileElementsMountedRef.current) {
1890
+ return whileElementsMountedRef.current(referenceEl, floatingEl, update);
1891
+ }
1892
+ update();
1893
+ }
1894
+ }, [referenceEl, floatingEl, update, whileElementsMountedRef, hasWhileElementsMounted]);
1895
+ const refs = React__namespace.useMemo(() => ({
1896
+ reference: referenceRef,
1897
+ floating: floatingRef,
1898
+ setReference,
1899
+ setFloating
1900
+ }), [setReference, setFloating]);
1901
+ const elements = React__namespace.useMemo(() => ({
1902
+ reference: referenceEl,
1903
+ floating: floatingEl
1904
+ }), [referenceEl, floatingEl]);
1905
+ const floatingStyles = React__namespace.useMemo(() => {
1906
+ const initialStyles = {
1907
+ position: strategy,
1908
+ left: 0,
1909
+ top: 0
1910
+ };
1911
+ if (!elements.floating) {
1912
+ return initialStyles;
1913
+ }
1914
+ const x = roundByDPR(elements.floating, data.x);
1915
+ const y = roundByDPR(elements.floating, data.y);
1916
+ if (transform) {
1917
+ return {
1918
+ ...initialStyles,
1919
+ transform: "translate(" + x + "px, " + y + "px)",
1920
+ ...(getDPR(elements.floating) >= 1.5 && {
1921
+ willChange: 'transform'
1922
+ })
1923
+ };
1924
+ }
1925
+ return {
1926
+ position: strategy,
1927
+ left: x,
1928
+ top: y
1929
+ };
1930
+ }, [strategy, transform, elements.floating, data.x, data.y]);
1931
+ return React__namespace.useMemo(() => ({
1932
+ ...data,
1933
+ update,
1934
+ refs,
1935
+ elements,
1936
+ floatingStyles
1937
+ }), [data, update, refs, elements, floatingStyles]);
1938
+ }
1939
+
1940
+ /**
1941
+ * Provides data to position an inner element of the floating element so that it
1942
+ * appears centered to the reference element.
1943
+ * This wraps the core `arrow` middleware to allow React refs as the element.
1944
+ * @see https://floating-ui.com/docs/arrow
1945
+ */
1946
+ const arrow$1 = options => {
1947
+ function isRef(value) {
1948
+ return {}.hasOwnProperty.call(value, 'current');
1949
+ }
1950
+ return {
1951
+ name: 'arrow',
1952
+ options,
1953
+ fn(state) {
1954
+ const {
1955
+ element,
1956
+ padding
1957
+ } = typeof options === 'function' ? options(state) : options;
1958
+ if (element && isRef(element)) {
1959
+ if (element.current != null) {
1960
+ return arrow$2({
1961
+ element: element.current,
1962
+ padding
1963
+ }).fn(state);
1964
+ }
1965
+ return {};
1966
+ }
1967
+ if (element) {
1968
+ return arrow$2({
1969
+ element,
1970
+ padding
1971
+ }).fn(state);
1972
+ }
1973
+ return {};
1974
+ }
1975
+ };
1976
+ };
1977
+
1978
+ /**
1979
+ * Modifies the placement by translating the floating element along the
1980
+ * specified axes.
1981
+ * A number (shorthand for `mainAxis` or distance), or an axes configuration
1982
+ * object may be passed.
1983
+ * @see https://floating-ui.com/docs/offset
1984
+ */
1985
+ const offset = (options, deps) => {
1986
+ const result = offset$1(options);
1987
+ return {
1988
+ name: result.name,
1989
+ fn: result.fn,
1990
+ options: [options, deps]
1991
+ };
1992
+ };
1993
+
1994
+ /**
1995
+ * Optimizes the visibility of the floating element by shifting it in order to
1996
+ * keep it in view when it will overflow the clipping boundary.
1997
+ * @see https://floating-ui.com/docs/shift
1998
+ */
1999
+ const shift = (options, deps) => {
2000
+ const result = shift$1(options);
2001
+ return {
2002
+ name: result.name,
2003
+ fn: result.fn,
2004
+ options: [options, deps]
2005
+ };
2006
+ };
2007
+
2008
+ /**
2009
+ * Built-in `limiter` that will stop `shift()` at a certain point.
2010
+ */
2011
+ const limitShift = (options, deps) => {
2012
+ const result = limitShift$1(options);
2013
+ return {
2014
+ fn: result.fn,
2015
+ options: [options, deps]
2016
+ };
2017
+ };
2018
+
2019
+ /**
2020
+ * Optimizes the visibility of the floating element by flipping the `placement`
2021
+ * in order to keep it in view when the preferred placement(s) will overflow the
2022
+ * clipping boundary. Alternative to `autoPlacement`.
2023
+ * @see https://floating-ui.com/docs/flip
2024
+ */
2025
+ const flip = (options, deps) => {
2026
+ const result = flip$1(options);
2027
+ return {
2028
+ name: result.name,
2029
+ fn: result.fn,
2030
+ options: [options, deps]
2031
+ };
2032
+ };
2033
+
2034
+ /**
2035
+ * Provides data that allows you to change the size of the floating element —
2036
+ * for instance, prevent it from overflowing the clipping boundary or match the
2037
+ * width of the reference element.
2038
+ * @see https://floating-ui.com/docs/size
2039
+ */
2040
+ const size = (options, deps) => {
2041
+ const result = size$1(options);
2042
+ return {
2043
+ name: result.name,
2044
+ fn: result.fn,
2045
+ options: [options, deps]
2046
+ };
2047
+ };
2048
+
2049
+ /**
2050
+ * Optimizes the visibility of the floating element by choosing the placement
2051
+ * that has the most space available automatically, without needing to specify a
2052
+ * preferred placement. Alternative to `flip`.
2053
+ * @see https://floating-ui.com/docs/autoPlacement
2054
+ */
2055
+ const autoPlacement = (options, deps) => {
2056
+ const result = autoPlacement$1(options);
2057
+ return {
2058
+ name: result.name,
2059
+ fn: result.fn,
2060
+ options: [options, deps]
2061
+ };
2062
+ };
2063
+
2064
+ /**
2065
+ * Provides data to hide the floating element in applicable situations, such as
2066
+ * when it is not in the same clipping context as the reference element.
2067
+ * @see https://floating-ui.com/docs/hide
2068
+ */
2069
+ const hide = (options, deps) => {
2070
+ const result = hide$1(options);
2071
+ return {
2072
+ name: result.name,
2073
+ fn: result.fn,
2074
+ options: [options, deps]
2075
+ };
2076
+ };
2077
+
2078
+ /**
2079
+ * Provides data to position an inner element of the floating element so that it
2080
+ * appears centered to the reference element.
2081
+ * This wraps the core `arrow` middleware to allow React refs as the element.
2082
+ * @see https://floating-ui.com/docs/arrow
2083
+ */
2084
+ const arrow = (options, deps) => {
2085
+ const result = arrow$1(options);
2086
+ return {
2087
+ name: result.name,
2088
+ fn: result.fn,
2089
+ options: [options, deps]
2090
+ };
2091
+ };
2092
+
2093
+ exports.arrow = arrow;
2094
+ exports.autoPlacement = autoPlacement;
2095
+ exports.autoUpdate = autoUpdate;
2096
+ exports.flip = flip;
2097
+ exports.hide = hide;
2098
+ exports.limitShift = limitShift;
2099
+ exports.offset = offset;
2100
+ exports.platform = platform;
2101
+ exports.shift = shift;
2102
+ exports.size = size;
2103
+ exports.useFloating = useFloating;