react-tooltip 5.5.2 → 5.6.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.
@@ -8,2290 +8,2592 @@
8
8
 
9
9
  var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0);
10
10
 
11
- var jsxRuntime = {exports: {}};
12
-
13
- var reactJsxRuntime_development = {};
11
+ function getSide(placement) {
12
+ return placement.split('-')[0];
13
+ }
14
14
 
15
- /** @license React v16.14.0
16
- * react-jsx-runtime.development.js
17
- *
18
- * Copyright (c) Facebook, Inc. and its affiliates.
19
- *
20
- * This source code is licensed under the MIT license found in the
21
- * LICENSE file in the root directory of this source tree.
22
- */
15
+ function getAlignment(placement) {
16
+ return placement.split('-')[1];
17
+ }
23
18
 
24
- (function (exports) {
19
+ function getMainAxisFromPlacement(placement) {
20
+ return ['top', 'bottom'].includes(getSide(placement)) ? 'x' : 'y';
21
+ }
25
22
 
26
- {
27
- (function() {
23
+ function getLengthFromAxis(axis) {
24
+ return axis === 'y' ? 'height' : 'width';
25
+ }
28
26
 
29
- var React = require$$0__default["default"];
27
+ function computeCoordsFromPlacement(_ref, placement, rtl) {
28
+ let {
29
+ reference,
30
+ floating
31
+ } = _ref;
32
+ const commonX = reference.x + reference.width / 2 - floating.width / 2;
33
+ const commonY = reference.y + reference.height / 2 - floating.height / 2;
34
+ const mainAxis = getMainAxisFromPlacement(placement);
35
+ const length = getLengthFromAxis(mainAxis);
36
+ const commonAlign = reference[length] / 2 - floating[length] / 2;
37
+ const side = getSide(placement);
38
+ const isVertical = mainAxis === 'x';
39
+ let coords;
30
40
 
31
- // ATTENTION
32
- // When adding new symbols to this file,
33
- // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
34
- // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
35
- // nor polyfill, then a plain number is used for performance.
36
- var REACT_ELEMENT_TYPE = 0xeac7;
37
- var REACT_PORTAL_TYPE = 0xeaca;
38
- exports.Fragment = 0xeacb;
39
- var REACT_STRICT_MODE_TYPE = 0xeacc;
40
- var REACT_PROFILER_TYPE = 0xead2;
41
- var REACT_PROVIDER_TYPE = 0xeacd;
42
- var REACT_CONTEXT_TYPE = 0xeace;
43
- var REACT_FORWARD_REF_TYPE = 0xead0;
44
- var REACT_SUSPENSE_TYPE = 0xead1;
45
- var REACT_SUSPENSE_LIST_TYPE = 0xead8;
46
- var REACT_MEMO_TYPE = 0xead3;
47
- var REACT_LAZY_TYPE = 0xead4;
48
- var REACT_BLOCK_TYPE = 0xead9;
49
- var REACT_SERVER_BLOCK_TYPE = 0xeada;
50
- var REACT_FUNDAMENTAL_TYPE = 0xead5;
51
- var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1;
52
- var REACT_LEGACY_HIDDEN_TYPE = 0xeae3;
41
+ switch (side) {
42
+ case 'top':
43
+ coords = {
44
+ x: commonX,
45
+ y: reference.y - floating.height
46
+ };
47
+ break;
53
48
 
54
- if (typeof Symbol === 'function' && Symbol.for) {
55
- var symbolFor = Symbol.for;
56
- REACT_ELEMENT_TYPE = symbolFor('react.element');
57
- REACT_PORTAL_TYPE = symbolFor('react.portal');
58
- exports.Fragment = symbolFor('react.fragment');
59
- REACT_STRICT_MODE_TYPE = symbolFor('react.strict_mode');
60
- REACT_PROFILER_TYPE = symbolFor('react.profiler');
61
- REACT_PROVIDER_TYPE = symbolFor('react.provider');
62
- REACT_CONTEXT_TYPE = symbolFor('react.context');
63
- REACT_FORWARD_REF_TYPE = symbolFor('react.forward_ref');
64
- REACT_SUSPENSE_TYPE = symbolFor('react.suspense');
65
- REACT_SUSPENSE_LIST_TYPE = symbolFor('react.suspense_list');
66
- REACT_MEMO_TYPE = symbolFor('react.memo');
67
- REACT_LAZY_TYPE = symbolFor('react.lazy');
68
- REACT_BLOCK_TYPE = symbolFor('react.block');
69
- REACT_SERVER_BLOCK_TYPE = symbolFor('react.server.block');
70
- REACT_FUNDAMENTAL_TYPE = symbolFor('react.fundamental');
71
- symbolFor('react.scope');
72
- symbolFor('react.opaque.id');
73
- REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode');
74
- symbolFor('react.offscreen');
75
- REACT_LEGACY_HIDDEN_TYPE = symbolFor('react.legacy_hidden');
76
- }
49
+ case 'bottom':
50
+ coords = {
51
+ x: commonX,
52
+ y: reference.y + reference.height
53
+ };
54
+ break;
77
55
 
78
- var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
79
- var FAUX_ITERATOR_SYMBOL = '@@iterator';
80
- function getIteratorFn(maybeIterable) {
81
- if (maybeIterable === null || typeof maybeIterable !== 'object') {
82
- return null;
83
- }
56
+ case 'right':
57
+ coords = {
58
+ x: reference.x + reference.width,
59
+ y: commonY
60
+ };
61
+ break;
84
62
 
85
- var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
63
+ case 'left':
64
+ coords = {
65
+ x: reference.x - floating.width,
66
+ y: commonY
67
+ };
68
+ break;
86
69
 
87
- if (typeof maybeIterator === 'function') {
88
- return maybeIterator;
89
- }
70
+ default:
71
+ coords = {
72
+ x: reference.x,
73
+ y: reference.y
74
+ };
75
+ }
90
76
 
91
- return null;
92
- }
77
+ switch (getAlignment(placement)) {
78
+ case 'start':
79
+ coords[mainAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
80
+ break;
93
81
 
94
- var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
82
+ case 'end':
83
+ coords[mainAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
84
+ break;
85
+ }
95
86
 
96
- function error(format) {
97
- {
98
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
99
- args[_key2 - 1] = arguments[_key2];
100
- }
87
+ return coords;
88
+ }
101
89
 
102
- printWarning('error', format, args);
103
- }
104
- }
90
+ /**
91
+ * Computes the `x` and `y` coordinates that will place the floating element
92
+ * next to a reference element when it is given a certain positioning strategy.
93
+ *
94
+ * This export does not have any `platform` interface logic. You will need to
95
+ * write one for the platform you are using Floating UI with.
96
+ */
105
97
 
106
- function printWarning(level, format, args) {
107
- // When changing this logic, you might want to also
108
- // update consoleWithStackDev.www.js as well.
109
- {
110
- var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
111
- var stack = '';
98
+ const computePosition$1 = async (reference, floating, config) => {
99
+ const {
100
+ placement = 'bottom',
101
+ strategy = 'absolute',
102
+ middleware = [],
103
+ platform
104
+ } = config;
105
+ const validMiddleware = middleware.filter(Boolean);
106
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
112
107
 
113
- if (currentlyValidatingElement) {
114
- var name = getComponentName(currentlyValidatingElement.type);
115
- var owner = currentlyValidatingElement._owner;
116
- stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner.type));
117
- }
108
+ {
109
+ if (platform == null) {
110
+ console.error(['Floating UI: `platform` property was not passed to config. If you', 'want to use Floating UI on the web, install @floating-ui/dom', 'instead of the /core package. Otherwise, you can create your own', '`platform`: https://floating-ui.com/docs/platform'].join(' '));
111
+ }
118
112
 
119
- stack += ReactDebugCurrentFrame.getStackAddendum();
113
+ if (validMiddleware.filter(_ref => {
114
+ let {
115
+ name
116
+ } = _ref;
117
+ return name === 'autoPlacement' || name === 'flip';
118
+ }).length > 1) {
119
+ throw new Error(['Floating UI: duplicate `flip` and/or `autoPlacement` middleware', 'detected. This will lead to an infinite loop. Ensure only one of', 'either has been passed to the `middleware` array.'].join(' '));
120
+ }
120
121
 
121
- if (stack !== '') {
122
- format += '%s';
123
- args = args.concat([stack]);
124
- }
122
+ if (!reference || !floating) {
123
+ console.error(['Floating UI: The reference and/or floating element was not defined', 'when `computePosition()` was called. Ensure that both elements have', 'been created and can be measured.'].join(' '));
124
+ }
125
+ }
125
126
 
126
- var argsWithFormat = args.map(function (item) {
127
- return '' + item;
128
- }); // Careful: RN currently depends on this prefix
127
+ let rects = await platform.getElementRects({
128
+ reference,
129
+ floating,
130
+ strategy
131
+ });
132
+ let {
133
+ x,
134
+ y
135
+ } = computeCoordsFromPlacement(rects, placement, rtl);
136
+ let statefulPlacement = placement;
137
+ let middlewareData = {};
138
+ let resetCount = 0;
129
139
 
130
- argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
131
- // breaks IE9: https://github.com/facebook/react/issues/13610
132
- // eslint-disable-next-line react-internal/no-production-logging
140
+ for (let i = 0; i < validMiddleware.length; i++) {
141
+ const {
142
+ name,
143
+ fn
144
+ } = validMiddleware[i];
145
+ const {
146
+ x: nextX,
147
+ y: nextY,
148
+ data,
149
+ reset
150
+ } = await fn({
151
+ x,
152
+ y,
153
+ initialPlacement: placement,
154
+ placement: statefulPlacement,
155
+ strategy,
156
+ middlewareData,
157
+ rects,
158
+ platform,
159
+ elements: {
160
+ reference,
161
+ floating
162
+ }
163
+ });
164
+ x = nextX != null ? nextX : x;
165
+ y = nextY != null ? nextY : y;
166
+ middlewareData = { ...middlewareData,
167
+ [name]: { ...middlewareData[name],
168
+ ...data
169
+ }
170
+ };
133
171
 
134
- Function.prototype.apply.call(console[level], console, argsWithFormat);
135
- }
136
- }
172
+ {
173
+ if (resetCount > 50) {
174
+ console.warn(['Floating UI: The middleware lifecycle appears to be running in an', 'infinite loop. This is usually caused by a `reset` continually', 'being returned without a break condition.'].join(' '));
175
+ }
176
+ }
137
177
 
138
- // Filter certain DOM attributes (e.g. src, href) if their values are empty strings.
178
+ if (reset && resetCount <= 50) {
179
+ resetCount++;
139
180
 
140
- var enableScopeAPI = false; // Experimental Create Event Handle API.
181
+ if (typeof reset === 'object') {
182
+ if (reset.placement) {
183
+ statefulPlacement = reset.placement;
184
+ }
141
185
 
142
- function isValidElementType(type) {
143
- if (typeof type === 'string' || typeof type === 'function') {
144
- return true;
145
- } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
186
+ if (reset.rects) {
187
+ rects = reset.rects === true ? await platform.getElementRects({
188
+ reference,
189
+ floating,
190
+ strategy
191
+ }) : reset.rects;
192
+ }
146
193
 
194
+ ({
195
+ x,
196
+ y
197
+ } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
198
+ }
147
199
 
148
- if (type === exports.Fragment || type === REACT_PROFILER_TYPE || type === REACT_DEBUG_TRACING_MODE_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || type === REACT_LEGACY_HIDDEN_TYPE || enableScopeAPI ) {
149
- return true;
150
- }
200
+ i = -1;
201
+ continue;
202
+ }
203
+ }
151
204
 
152
- if (typeof type === 'object' && type !== null) {
153
- if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_BLOCK_TYPE || type[0] === REACT_SERVER_BLOCK_TYPE) {
154
- return true;
155
- }
156
- }
205
+ return {
206
+ x,
207
+ y,
208
+ placement: statefulPlacement,
209
+ strategy,
210
+ middlewareData
211
+ };
212
+ };
157
213
 
158
- return false;
159
- }
214
+ function expandPaddingObject(padding) {
215
+ return {
216
+ top: 0,
217
+ right: 0,
218
+ bottom: 0,
219
+ left: 0,
220
+ ...padding
221
+ };
222
+ }
160
223
 
224
+ function getSideObjectFromPadding(padding) {
225
+ return typeof padding !== 'number' ? expandPaddingObject(padding) : {
226
+ top: padding,
227
+ right: padding,
228
+ bottom: padding,
229
+ left: padding
230
+ };
231
+ }
161
232
 
162
- var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
163
- function describeComponentFrame (name, source, ownerName) {
164
- var sourceInfo = '';
233
+ function rectToClientRect(rect) {
234
+ return { ...rect,
235
+ top: rect.y,
236
+ left: rect.x,
237
+ right: rect.x + rect.width,
238
+ bottom: rect.y + rect.height
239
+ };
240
+ }
165
241
 
166
- if (source) {
167
- var path = source.fileName;
168
- var fileName = path.replace(BEFORE_SLASH_RE, '');
242
+ /**
243
+ * Resolves with an object of overflow side offsets that determine how much the
244
+ * element is overflowing a given clipping boundary.
245
+ * - positive = overflowing the boundary by that number of pixels
246
+ * - negative = how many pixels left before it will overflow
247
+ * - 0 = lies flush with the boundary
248
+ * @see https://floating-ui.com/docs/detectOverflow
249
+ */
250
+ async function detectOverflow(middlewareArguments, options) {
251
+ var _await$platform$isEle;
169
252
 
170
- {
171
- // In DEV, include code for a common special case:
172
- // prefer "folder/index.js" instead of just "index.js".
173
- if (/^index\./.test(fileName)) {
174
- var match = path.match(BEFORE_SLASH_RE);
253
+ if (options === void 0) {
254
+ options = {};
255
+ }
175
256
 
176
- if (match) {
177
- var pathBeforeSlash = match[1];
257
+ const {
258
+ x,
259
+ y,
260
+ platform,
261
+ rects,
262
+ elements,
263
+ strategy
264
+ } = middlewareArguments;
265
+ const {
266
+ boundary = 'clippingAncestors',
267
+ rootBoundary = 'viewport',
268
+ elementContext = 'floating',
269
+ altBoundary = false,
270
+ padding = 0
271
+ } = options;
272
+ const paddingObject = getSideObjectFromPadding(padding);
273
+ const altContext = elementContext === 'floating' ? 'reference' : 'floating';
274
+ const element = elements[altBoundary ? altContext : elementContext];
275
+ const clippingClientRect = rectToClientRect(await platform.getClippingRect({
276
+ 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))),
277
+ boundary,
278
+ rootBoundary,
279
+ strategy
280
+ }));
281
+ const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
282
+ rect: elementContext === 'floating' ? { ...rects.floating,
283
+ x,
284
+ y
285
+ } : rects.reference,
286
+ offsetParent: await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating)),
287
+ strategy
288
+ }) : rects[elementContext]);
289
+ return {
290
+ top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
291
+ bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
292
+ left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
293
+ right: elementClientRect.right - clippingClientRect.right + paddingObject.right
294
+ };
295
+ }
178
296
 
179
- if (pathBeforeSlash) {
180
- var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
181
- fileName = folderName + '/' + fileName;
182
- }
183
- }
184
- }
185
- }
297
+ const min$1 = Math.min;
298
+ const max$1 = Math.max;
186
299
 
187
- sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
188
- } else if (ownerName) {
189
- sourceInfo = ' (created by ' + ownerName + ')';
190
- }
300
+ function within(min$1$1, value, max$1$1) {
301
+ return max$1(min$1$1, min$1(value, max$1$1));
302
+ }
191
303
 
192
- return '\n in ' + (name || 'Unknown') + sourceInfo;
193
- }
304
+ /**
305
+ * Positions an inner element of the floating element such that it is centered
306
+ * to the reference element.
307
+ * @see https://floating-ui.com/docs/arrow
308
+ */
309
+ const arrow = options => ({
310
+ name: 'arrow',
311
+ options,
194
312
 
195
- var Resolved = 1;
196
- function refineResolvedLazyComponent(lazyComponent) {
197
- return lazyComponent._status === Resolved ? lazyComponent._result : null;
198
- }
313
+ async fn(middlewareArguments) {
314
+ // Since `element` is required, we don't Partial<> the type
315
+ const {
316
+ element,
317
+ padding = 0
318
+ } = options != null ? options : {};
319
+ const {
320
+ x,
321
+ y,
322
+ placement,
323
+ rects,
324
+ platform
325
+ } = middlewareArguments;
199
326
 
200
- function getWrappedName(outerType, innerType, wrapperName) {
201
- var functionName = innerType.displayName || innerType.name || '';
202
- return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
203
- }
327
+ if (element == null) {
328
+ {
329
+ console.warn('Floating UI: No `element` was passed to the `arrow` middleware.');
330
+ }
204
331
 
205
- function getComponentName(type) {
206
- if (type == null) {
207
- // Host root, text node or just invalid type.
208
- return null;
209
- }
332
+ return {};
333
+ }
210
334
 
211
- {
212
- if (typeof type.tag === 'number') {
213
- error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
214
- }
215
- }
335
+ const paddingObject = getSideObjectFromPadding(padding);
336
+ const coords = {
337
+ x,
338
+ y
339
+ };
340
+ const axis = getMainAxisFromPlacement(placement);
341
+ const alignment = getAlignment(placement);
342
+ const length = getLengthFromAxis(axis);
343
+ const arrowDimensions = await platform.getDimensions(element);
344
+ const minProp = axis === 'y' ? 'top' : 'left';
345
+ const maxProp = axis === 'y' ? 'bottom' : 'right';
346
+ const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
347
+ const startDiff = coords[axis] - rects.reference[axis];
348
+ const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
349
+ let clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
216
350
 
217
- if (typeof type === 'function') {
218
- return type.displayName || type.name || null;
219
- }
351
+ if (clientSize === 0) {
352
+ clientSize = rects.floating[length];
353
+ }
220
354
 
221
- if (typeof type === 'string') {
222
- return type;
223
- }
355
+ const centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the floating element if the center
356
+ // point is outside the floating element's bounds
224
357
 
225
- switch (type) {
226
- case exports.Fragment:
227
- return 'Fragment';
358
+ const min = paddingObject[minProp];
359
+ const max = clientSize - arrowDimensions[length] - paddingObject[maxProp];
360
+ const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
361
+ const offset = within(min, center, max); // Make sure that arrow points at the reference
228
362
 
229
- case REACT_PORTAL_TYPE:
230
- return 'Portal';
363
+ const alignmentPadding = alignment === 'start' ? paddingObject[minProp] : paddingObject[maxProp];
364
+ const shouldAddOffset = alignmentPadding > 0 && center !== offset && rects.reference[length] <= rects.floating[length];
365
+ const alignmentOffset = shouldAddOffset ? center < min ? min - center : max - center : 0;
366
+ return {
367
+ [axis]: coords[axis] - alignmentOffset,
368
+ data: {
369
+ [axis]: offset,
370
+ centerOffset: center - offset
371
+ }
372
+ };
373
+ }
231
374
 
232
- case REACT_PROFILER_TYPE:
233
- return "Profiler";
375
+ });
234
376
 
235
- case REACT_STRICT_MODE_TYPE:
236
- return 'StrictMode';
377
+ const hash$1 = {
378
+ left: 'right',
379
+ right: 'left',
380
+ bottom: 'top',
381
+ top: 'bottom'
382
+ };
383
+ function getOppositePlacement(placement) {
384
+ return placement.replace(/left|right|bottom|top/g, matched => hash$1[matched]);
385
+ }
237
386
 
238
- case REACT_SUSPENSE_TYPE:
239
- return 'Suspense';
387
+ function getAlignmentSides(placement, rects, rtl) {
388
+ if (rtl === void 0) {
389
+ rtl = false;
390
+ }
240
391
 
241
- case REACT_SUSPENSE_LIST_TYPE:
242
- return 'SuspenseList';
243
- }
392
+ const alignment = getAlignment(placement);
393
+ const mainAxis = getMainAxisFromPlacement(placement);
394
+ const length = getLengthFromAxis(mainAxis);
395
+ let mainAlignmentSide = mainAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
244
396
 
245
- if (typeof type === 'object') {
246
- switch (type.$$typeof) {
247
- case REACT_CONTEXT_TYPE:
248
- return 'Context.Consumer';
397
+ if (rects.reference[length] > rects.floating[length]) {
398
+ mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
399
+ }
249
400
 
250
- case REACT_PROVIDER_TYPE:
251
- return 'Context.Provider';
401
+ return {
402
+ main: mainAlignmentSide,
403
+ cross: getOppositePlacement(mainAlignmentSide)
404
+ };
405
+ }
252
406
 
253
- case REACT_FORWARD_REF_TYPE:
254
- return getWrappedName(type, type.render, 'ForwardRef');
407
+ const hash = {
408
+ start: 'end',
409
+ end: 'start'
410
+ };
411
+ function getOppositeAlignmentPlacement(placement) {
412
+ return placement.replace(/start|end/g, matched => hash[matched]);
413
+ }
255
414
 
256
- case REACT_MEMO_TYPE:
257
- return getComponentName(type.type);
415
+ const sides = ['top', 'right', 'bottom', 'left'];
416
+ const allPlacements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + "-start", side + "-end"), []);
258
417
 
259
- case REACT_BLOCK_TYPE:
260
- return getComponentName(type.render);
418
+ function getPlacementList(alignment, autoAlignment, allowedPlacements) {
419
+ const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter(placement => getAlignment(placement) === alignment), ...allowedPlacements.filter(placement => getAlignment(placement) !== alignment)] : allowedPlacements.filter(placement => getSide(placement) === placement);
420
+ return allowedPlacementsSortedByAlignment.filter(placement => {
421
+ if (alignment) {
422
+ return getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : false);
423
+ }
261
424
 
262
- case REACT_LAZY_TYPE:
263
- {
264
- var thenable = type;
265
- var resolvedThenable = refineResolvedLazyComponent(thenable);
425
+ return true;
426
+ });
427
+ }
266
428
 
267
- if (resolvedThenable) {
268
- return getComponentName(resolvedThenable);
269
- }
429
+ /**
430
+ * Automatically chooses the `placement` which has the most space available.
431
+ * @see https://floating-ui.com/docs/autoPlacement
432
+ */
433
+ const autoPlacement = function (options) {
434
+ if (options === void 0) {
435
+ options = {};
436
+ }
270
437
 
271
- break;
272
- }
273
- }
274
- }
438
+ return {
439
+ name: 'autoPlacement',
440
+ options,
275
441
 
276
- return null;
277
- }
442
+ async fn(middlewareArguments) {
443
+ var _middlewareData$autoP, _middlewareData$autoP2, _middlewareData$autoP3, _middlewareData$autoP4, _placementsSortedByLe;
278
444
 
279
- var loggedTypeFailures = {};
280
- ReactSharedInternals.ReactDebugCurrentFrame;
281
- var currentlyValidatingElement = null;
445
+ const {
446
+ x,
447
+ y,
448
+ rects,
449
+ middlewareData,
450
+ placement,
451
+ platform,
452
+ elements
453
+ } = middlewareArguments;
454
+ const {
455
+ alignment = null,
456
+ allowedPlacements = allPlacements,
457
+ autoAlignment = true,
458
+ ...detectOverflowOptions
459
+ } = options;
460
+ const placements = getPlacementList(alignment, autoAlignment, allowedPlacements);
461
+ const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
462
+ const currentIndex = (_middlewareData$autoP = (_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.index) != null ? _middlewareData$autoP : 0;
463
+ const currentPlacement = placements[currentIndex];
282
464
 
283
- function setCurrentlyValidatingElement(element) {
284
- {
285
- currentlyValidatingElement = element;
286
- }
287
- }
465
+ if (currentPlacement == null) {
466
+ return {};
467
+ }
288
468
 
289
- function checkPropTypes(typeSpecs, values, location, componentName, element) {
290
- {
291
- // $FlowFixMe This is okay but Flow doesn't know it.
292
- var has = Function.call.bind(Object.prototype.hasOwnProperty);
469
+ const {
470
+ main,
471
+ cross
472
+ } = getAlignmentSides(currentPlacement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))); // Make `computeCoords` start from the right place
293
473
 
294
- for (var typeSpecName in typeSpecs) {
295
- if (has(typeSpecs, typeSpecName)) {
296
- var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
297
- // fail the render phase where it didn't fail before. So we log it.
298
- // After these have been cleaned up, we'll let them throw.
474
+ if (placement !== currentPlacement) {
475
+ return {
476
+ x,
477
+ y,
478
+ reset: {
479
+ placement: placements[0]
480
+ }
481
+ };
482
+ }
299
483
 
300
- try {
301
- // This is intentionally an invariant that gets caught. It's the same
302
- // behavior as without this statement except with a better message.
303
- if (typeof typeSpecs[typeSpecName] !== 'function') {
304
- var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');
305
- err.name = 'Invariant Violation';
306
- throw err;
307
- }
484
+ const currentOverflows = [overflow[getSide(currentPlacement)], overflow[main], overflow[cross]];
485
+ const allOverflows = [...((_middlewareData$autoP3 = (_middlewareData$autoP4 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP4.overflows) != null ? _middlewareData$autoP3 : []), {
486
+ placement: currentPlacement,
487
+ overflows: currentOverflows
488
+ }];
489
+ const nextPlacement = placements[currentIndex + 1]; // There are more placements to check
308
490
 
309
- error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
310
- } catch (ex) {
311
- error$1 = ex;
312
- }
491
+ if (nextPlacement) {
492
+ return {
493
+ data: {
494
+ index: currentIndex + 1,
495
+ overflows: allOverflows
496
+ },
497
+ reset: {
498
+ placement: nextPlacement
499
+ }
500
+ };
501
+ }
313
502
 
314
- if (error$1 && !(error$1 instanceof Error)) {
315
- setCurrentlyValidatingElement(element);
503
+ const placementsSortedByLeastOverflow = allOverflows.slice().sort((a, b) => a.overflows[0] - b.overflows[0]);
504
+ const placementThatFitsOnAllSides = (_placementsSortedByLe = placementsSortedByLeastOverflow.find(_ref => {
505
+ let {
506
+ overflows
507
+ } = _ref;
508
+ return overflows.every(overflow => overflow <= 0);
509
+ })) == null ? void 0 : _placementsSortedByLe.placement;
510
+ const resetPlacement = placementThatFitsOnAllSides != null ? placementThatFitsOnAllSides : placementsSortedByLeastOverflow[0].placement;
316
511
 
317
- error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1);
512
+ if (resetPlacement !== placement) {
513
+ return {
514
+ data: {
515
+ index: currentIndex + 1,
516
+ overflows: allOverflows
517
+ },
518
+ reset: {
519
+ placement: resetPlacement
520
+ }
521
+ };
522
+ }
318
523
 
319
- setCurrentlyValidatingElement(null);
320
- }
524
+ return {};
525
+ }
321
526
 
322
- if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
323
- // Only monitor this failure once because there tends to be a lot of the
324
- // same error.
325
- loggedTypeFailures[error$1.message] = true;
326
- setCurrentlyValidatingElement(element);
527
+ };
528
+ };
327
529
 
328
- error('Failed %s type: %s', location, error$1.message);
530
+ function getExpandedPlacements(placement) {
531
+ const oppositePlacement = getOppositePlacement(placement);
532
+ return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
533
+ }
329
534
 
330
- setCurrentlyValidatingElement(null);
331
- }
332
- }
333
- }
334
- }
335
- }
535
+ /**
536
+ * Changes the placement of the floating element to one that will fit if the
537
+ * initially specified `placement` does not.
538
+ * @see https://floating-ui.com/docs/flip
539
+ */
540
+ const flip = function (options) {
541
+ if (options === void 0) {
542
+ options = {};
543
+ }
336
544
 
337
- var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
338
- var hasOwnProperty = Object.prototype.hasOwnProperty;
339
- var RESERVED_PROPS = {
340
- key: true,
341
- ref: true,
342
- __self: true,
343
- __source: true
344
- };
345
- var specialPropKeyWarningShown;
346
- var specialPropRefWarningShown;
347
- var didWarnAboutStringRefs;
545
+ return {
546
+ name: 'flip',
547
+ options,
348
548
 
349
- {
350
- didWarnAboutStringRefs = {};
351
- }
549
+ async fn(middlewareArguments) {
550
+ var _middlewareData$flip;
352
551
 
353
- function hasValidRef(config) {
354
- {
355
- if (hasOwnProperty.call(config, 'ref')) {
356
- var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
552
+ const {
553
+ placement,
554
+ middlewareData,
555
+ rects,
556
+ initialPlacement,
557
+ platform,
558
+ elements
559
+ } = middlewareArguments;
560
+ const {
561
+ mainAxis: checkMainAxis = true,
562
+ crossAxis: checkCrossAxis = true,
563
+ fallbackPlacements: specifiedFallbackPlacements,
564
+ fallbackStrategy = 'bestFit',
565
+ flipAlignment = true,
566
+ ...detectOverflowOptions
567
+ } = options;
568
+ const side = getSide(placement);
569
+ const isBasePlacement = side === initialPlacement;
570
+ const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
571
+ const placements = [initialPlacement, ...fallbackPlacements];
572
+ const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
573
+ const overflows = [];
574
+ let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
357
575
 
358
- if (getter && getter.isReactWarning) {
359
- return false;
360
- }
361
- }
362
- }
576
+ if (checkMainAxis) {
577
+ overflows.push(overflow[side]);
578
+ }
363
579
 
364
- return config.ref !== undefined;
365
- }
580
+ if (checkCrossAxis) {
581
+ const {
582
+ main,
583
+ cross
584
+ } = getAlignmentSides(placement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
585
+ overflows.push(overflow[main], overflow[cross]);
586
+ }
366
587
 
367
- function hasValidKey(config) {
368
- {
369
- if (hasOwnProperty.call(config, 'key')) {
370
- var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
588
+ overflowsData = [...overflowsData, {
589
+ placement,
590
+ overflows
591
+ }]; // One or more sides is overflowing
371
592
 
372
- if (getter && getter.isReactWarning) {
373
- return false;
374
- }
375
- }
376
- }
593
+ if (!overflows.every(side => side <= 0)) {
594
+ var _middlewareData$flip$, _middlewareData$flip2;
377
595
 
378
- return config.key !== undefined;
379
- }
596
+ const nextIndex = ((_middlewareData$flip$ = (_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) != null ? _middlewareData$flip$ : 0) + 1;
597
+ const nextPlacement = placements[nextIndex];
380
598
 
381
- function warnIfStringRefCannotBeAutoConverted(config, self) {
382
- {
383
- if (typeof config.ref === 'string' && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) {
384
- var componentName = getComponentName(ReactCurrentOwner.current.type);
599
+ if (nextPlacement) {
600
+ // Try next placement and re-run the lifecycle
601
+ return {
602
+ data: {
603
+ index: nextIndex,
604
+ overflows: overflowsData
605
+ },
606
+ reset: {
607
+ placement: nextPlacement
608
+ }
609
+ };
610
+ }
385
611
 
386
- if (!didWarnAboutStringRefs[componentName]) {
387
- error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', getComponentName(ReactCurrentOwner.current.type), config.ref);
388
-
389
- didWarnAboutStringRefs[componentName] = true;
390
- }
391
- }
392
- }
393
- }
394
-
395
- function defineKeyPropWarningGetter(props, displayName) {
396
- {
397
- var warnAboutAccessingKey = function () {
398
- if (!specialPropKeyWarningShown) {
399
- specialPropKeyWarningShown = true;
400
-
401
- error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
402
- }
403
- };
404
-
405
- warnAboutAccessingKey.isReactWarning = true;
406
- Object.defineProperty(props, 'key', {
407
- get: warnAboutAccessingKey,
408
- configurable: true
409
- });
410
- }
411
- }
412
-
413
- function defineRefPropWarningGetter(props, displayName) {
414
- {
415
- var warnAboutAccessingRef = function () {
416
- if (!specialPropRefWarningShown) {
417
- specialPropRefWarningShown = true;
418
-
419
- error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
420
- }
421
- };
422
-
423
- warnAboutAccessingRef.isReactWarning = true;
424
- Object.defineProperty(props, 'ref', {
425
- get: warnAboutAccessingRef,
426
- configurable: true
427
- });
428
- }
429
- }
430
- /**
431
- * Factory method to create a new React element. This no longer adheres to
432
- * the class pattern, so do not use new to call it. Also, instanceof check
433
- * will not work. Instead test $$typeof field against Symbol.for('react.element') to check
434
- * if something is a React Element.
435
- *
436
- * @param {*} type
437
- * @param {*} props
438
- * @param {*} key
439
- * @param {string|object} ref
440
- * @param {*} owner
441
- * @param {*} self A *temporary* helper to detect places where `this` is
442
- * different from the `owner` when React.createElement is called, so that we
443
- * can warn. We want to get rid of owner and replace string `ref`s with arrow
444
- * functions, and as long as `this` and owner are the same, there will be no
445
- * change in behavior.
446
- * @param {*} source An annotation object (added by a transpiler or otherwise)
447
- * indicating filename, line number, and/or other information.
448
- * @internal
449
- */
612
+ let resetPlacement = 'bottom';
450
613
 
614
+ switch (fallbackStrategy) {
615
+ case 'bestFit':
616
+ {
617
+ var _overflowsData$map$so;
451
618
 
452
- var ReactElement = function (type, key, ref, self, source, owner, props) {
453
- var element = {
454
- // This tag allows us to uniquely identify this as a React Element
455
- $$typeof: REACT_ELEMENT_TYPE,
456
- // Built-in properties that belong on the element
457
- type: type,
458
- key: key,
459
- ref: ref,
460
- props: props,
461
- // Record the component responsible for creating this element.
462
- _owner: owner
463
- };
619
+ const placement = (_overflowsData$map$so = overflowsData.map(d => [d, 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].placement;
464
620
 
465
- {
466
- // The validation flag is currently mutative. We put it on
467
- // an external backing store so that we can freeze the whole object.
468
- // This can be replaced with a WeakMap once they are implemented in
469
- // commonly used development environments.
470
- element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
471
- // the validation flag non-enumerable (where possible, which should
472
- // include every environment we run tests in), so the test framework
473
- // ignores it.
621
+ if (placement) {
622
+ resetPlacement = placement;
623
+ }
474
624
 
475
- Object.defineProperty(element._store, 'validated', {
476
- configurable: false,
477
- enumerable: false,
478
- writable: true,
479
- value: false
480
- }); // self and source are DEV only properties.
625
+ break;
626
+ }
481
627
 
482
- Object.defineProperty(element, '_self', {
483
- configurable: false,
484
- enumerable: false,
485
- writable: false,
486
- value: self
487
- }); // Two elements created in two different places should be considered
488
- // equal for testing purposes and therefore we hide it from enumeration.
628
+ case 'initialPlacement':
629
+ resetPlacement = initialPlacement;
630
+ break;
631
+ }
489
632
 
490
- Object.defineProperty(element, '_source', {
491
- configurable: false,
492
- enumerable: false,
493
- writable: false,
494
- value: source
495
- });
633
+ if (placement !== resetPlacement) {
634
+ return {
635
+ reset: {
636
+ placement: resetPlacement
637
+ }
638
+ };
639
+ }
640
+ }
496
641
 
497
- if (Object.freeze) {
498
- Object.freeze(element.props);
499
- Object.freeze(element);
500
- }
501
- }
642
+ return {};
643
+ }
502
644
 
503
- return element;
504
- };
505
- /**
506
- * https://github.com/reactjs/rfcs/pull/107
507
- * @param {*} type
508
- * @param {object} props
509
- * @param {string} key
510
- */
645
+ };
646
+ };
511
647
 
512
- function jsxDEV(type, config, maybeKey, source, self) {
513
- {
514
- var propName; // Reserved names are extracted
648
+ async function convertValueToCoords(middlewareArguments, value) {
649
+ const {
650
+ placement,
651
+ platform,
652
+ elements
653
+ } = middlewareArguments;
654
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
655
+ const side = getSide(placement);
656
+ const alignment = getAlignment(placement);
657
+ const isVertical = getMainAxisFromPlacement(placement) === 'x';
658
+ const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
659
+ const crossAxisMulti = rtl && isVertical ? -1 : 1;
660
+ const rawValue = typeof value === 'function' ? value(middlewareArguments) : value; // eslint-disable-next-line prefer-const
515
661
 
516
- var props = {};
517
- var key = null;
518
- var ref = null; // Currently, key can be spread in as a prop. This causes a potential
519
- // issue if key is also explicitly declared (ie. <div {...props} key="Hi" />
520
- // or <div key="Hi" {...props} /> ). We want to deprecate key spread,
521
- // but as an intermediary step, we will use jsxDEV for everything except
522
- // <div {...props} key="Hi" />, because we aren't currently able to tell if
523
- // key is explicitly declared to be undefined or not.
662
+ let {
663
+ mainAxis,
664
+ crossAxis,
665
+ alignmentAxis
666
+ } = typeof rawValue === 'number' ? {
667
+ mainAxis: rawValue,
668
+ crossAxis: 0,
669
+ alignmentAxis: null
670
+ } : {
671
+ mainAxis: 0,
672
+ crossAxis: 0,
673
+ alignmentAxis: null,
674
+ ...rawValue
675
+ };
524
676
 
525
- if (maybeKey !== undefined) {
526
- key = '' + maybeKey;
527
- }
677
+ if (alignment && typeof alignmentAxis === 'number') {
678
+ crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
679
+ }
528
680
 
529
- if (hasValidKey(config)) {
530
- key = '' + config.key;
531
- }
681
+ return isVertical ? {
682
+ x: crossAxis * crossAxisMulti,
683
+ y: mainAxis * mainAxisMulti
684
+ } : {
685
+ x: mainAxis * mainAxisMulti,
686
+ y: crossAxis * crossAxisMulti
687
+ };
688
+ }
689
+ /**
690
+ * Displaces the floating element from its reference element.
691
+ * @see https://floating-ui.com/docs/offset
692
+ */
532
693
 
533
- if (hasValidRef(config)) {
534
- ref = config.ref;
535
- warnIfStringRefCannotBeAutoConverted(config, self);
536
- } // Remaining properties are added to a new props object
694
+ const offset = function (value) {
695
+ if (value === void 0) {
696
+ value = 0;
697
+ }
537
698
 
699
+ return {
700
+ name: 'offset',
701
+ options: value,
538
702
 
539
- for (propName in config) {
540
- if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
541
- props[propName] = config[propName];
542
- }
543
- } // Resolve default props
703
+ async fn(middlewareArguments) {
704
+ const {
705
+ x,
706
+ y
707
+ } = middlewareArguments;
708
+ const diffCoords = await convertValueToCoords(middlewareArguments, value);
709
+ return {
710
+ x: x + diffCoords.x,
711
+ y: y + diffCoords.y,
712
+ data: diffCoords
713
+ };
714
+ }
544
715
 
716
+ };
717
+ };
545
718
 
546
- if (type && type.defaultProps) {
547
- var defaultProps = type.defaultProps;
719
+ function getCrossAxis(axis) {
720
+ return axis === 'x' ? 'y' : 'x';
721
+ }
548
722
 
549
- for (propName in defaultProps) {
550
- if (props[propName] === undefined) {
551
- props[propName] = defaultProps[propName];
552
- }
553
- }
554
- }
723
+ /**
724
+ * Shifts the floating element in order to keep it in view when it will overflow
725
+ * a clipping boundary.
726
+ * @see https://floating-ui.com/docs/shift
727
+ */
728
+ const shift = function (options) {
729
+ if (options === void 0) {
730
+ options = {};
731
+ }
555
732
 
556
- if (key || ref) {
557
- var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
733
+ return {
734
+ name: 'shift',
735
+ options,
558
736
 
559
- if (key) {
560
- defineKeyPropWarningGetter(props, displayName);
561
- }
562
-
563
- if (ref) {
564
- defineRefPropWarningGetter(props, displayName);
565
- }
566
- }
737
+ async fn(middlewareArguments) {
738
+ const {
739
+ x,
740
+ y,
741
+ placement
742
+ } = middlewareArguments;
743
+ const {
744
+ mainAxis: checkMainAxis = true,
745
+ crossAxis: checkCrossAxis = false,
746
+ limiter = {
747
+ fn: _ref => {
748
+ let {
749
+ x,
750
+ y
751
+ } = _ref;
752
+ return {
753
+ x,
754
+ y
755
+ };
756
+ }
757
+ },
758
+ ...detectOverflowOptions
759
+ } = options;
760
+ const coords = {
761
+ x,
762
+ y
763
+ };
764
+ const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
765
+ const mainAxis = getMainAxisFromPlacement(getSide(placement));
766
+ const crossAxis = getCrossAxis(mainAxis);
767
+ let mainAxisCoord = coords[mainAxis];
768
+ let crossAxisCoord = coords[crossAxis];
567
769
 
568
- return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
569
- }
570
- }
770
+ if (checkMainAxis) {
771
+ const minSide = mainAxis === 'y' ? 'top' : 'left';
772
+ const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
773
+ const min = mainAxisCoord + overflow[minSide];
774
+ const max = mainAxisCoord - overflow[maxSide];
775
+ mainAxisCoord = within(min, mainAxisCoord, max);
776
+ }
571
777
 
572
- var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
573
- ReactSharedInternals.ReactDebugCurrentFrame;
778
+ if (checkCrossAxis) {
779
+ const minSide = crossAxis === 'y' ? 'top' : 'left';
780
+ const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
781
+ const min = crossAxisCoord + overflow[minSide];
782
+ const max = crossAxisCoord - overflow[maxSide];
783
+ crossAxisCoord = within(min, crossAxisCoord, max);
784
+ }
574
785
 
575
- function setCurrentlyValidatingElement$1(element) {
576
- currentlyValidatingElement = element;
577
- }
786
+ const limitedCoords = limiter.fn({ ...middlewareArguments,
787
+ [mainAxis]: mainAxisCoord,
788
+ [crossAxis]: crossAxisCoord
789
+ });
790
+ return { ...limitedCoords,
791
+ data: {
792
+ x: limitedCoords.x - x,
793
+ y: limitedCoords.y - y
794
+ }
795
+ };
796
+ }
578
797
 
579
- var propTypesMisspellWarningShown;
798
+ };
799
+ };
580
800
 
581
- {
582
- propTypesMisspellWarningShown = false;
583
- }
584
- /**
585
- * Verifies the object is a ReactElement.
586
- * See https://reactjs.org/docs/react-api.html#isvalidelement
587
- * @param {?object} object
588
- * @return {boolean} True if `object` is a ReactElement.
589
- * @final
590
- */
801
+ /**
802
+ * Provides data to change the size of the floating element. For instance,
803
+ * prevent it from overflowing its clipping boundary or match the width of the
804
+ * reference element.
805
+ * @see https://floating-ui.com/docs/size
806
+ */
807
+ const size = function (options) {
808
+ if (options === void 0) {
809
+ options = {};
810
+ }
591
811
 
592
- function isValidElement(object) {
593
- {
594
- return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
595
- }
596
- }
812
+ return {
813
+ name: 'size',
814
+ options,
597
815
 
598
- function getDeclarationErrorAddendum() {
599
- {
600
- if (ReactCurrentOwner$1.current) {
601
- var name = getComponentName(ReactCurrentOwner$1.current.type);
816
+ async fn(middlewareArguments) {
817
+ const {
818
+ placement,
819
+ rects,
820
+ platform,
821
+ elements
822
+ } = middlewareArguments;
823
+ const {
824
+ apply = () => {},
825
+ ...detectOverflowOptions
826
+ } = options;
827
+ const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
828
+ const side = getSide(placement);
829
+ const alignment = getAlignment(placement);
830
+ let heightSide;
831
+ let widthSide;
832
+
833
+ if (side === 'top' || side === 'bottom') {
834
+ heightSide = side;
835
+ widthSide = alignment === ((await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))) ? 'start' : 'end') ? 'left' : 'right';
836
+ } else {
837
+ widthSide = side;
838
+ heightSide = alignment === 'end' ? 'top' : 'bottom';
839
+ }
602
840
 
603
- if (name) {
604
- return '\n\nCheck the render method of `' + name + '`.';
605
- }
606
- }
841
+ const xMin = max$1(overflow.left, 0);
842
+ const xMax = max$1(overflow.right, 0);
843
+ const yMin = max$1(overflow.top, 0);
844
+ const yMax = max$1(overflow.bottom, 0);
845
+ const dimensions = {
846
+ availableHeight: rects.floating.height - (['left', 'right'].includes(placement) ? 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max$1(overflow.top, overflow.bottom)) : overflow[heightSide]),
847
+ availableWidth: rects.floating.width - (['top', 'bottom'].includes(placement) ? 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max$1(overflow.left, overflow.right)) : overflow[widthSide])
848
+ };
849
+ await apply({ ...middlewareArguments,
850
+ ...dimensions
851
+ });
852
+ const nextDimensions = await platform.getDimensions(elements.floating);
607
853
 
608
- return '';
609
- }
610
- }
854
+ if (rects.floating.width !== nextDimensions.width || rects.floating.height !== nextDimensions.height) {
855
+ return {
856
+ reset: {
857
+ rects: true
858
+ }
859
+ };
860
+ }
611
861
 
612
- function getSourceInfoErrorAddendum(source) {
613
- {
614
- if (source !== undefined) {
615
- var fileName = source.fileName.replace(/^.*[\\\/]/, '');
616
- var lineNumber = source.lineNumber;
617
- return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
618
- }
862
+ return {};
863
+ }
619
864
 
620
- return '';
621
- }
622
- }
623
- /**
624
- * Warn if there's no key explicitly set on dynamic arrays of children or
625
- * object keys are not valid. This allows us to keep track of children between
626
- * updates.
627
- */
865
+ };
866
+ };
628
867
 
868
+ /**
869
+ * Provides improved positioning for inline reference elements that can span
870
+ * over multiple lines, such as hyperlinks or range selections.
871
+ * @see https://floating-ui.com/docs/inline
872
+ */
873
+ const inline = function (options) {
874
+ if (options === void 0) {
875
+ options = {};
876
+ }
629
877
 
630
- var ownerHasKeyUseWarning = {};
878
+ return {
879
+ name: 'inline',
880
+ options,
631
881
 
632
- function getCurrentComponentErrorInfo(parentType) {
633
- {
634
- var info = getDeclarationErrorAddendum();
882
+ async fn(middlewareArguments) {
883
+ var _await$platform$getCl;
635
884
 
636
- if (!info) {
637
- var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
885
+ const {
886
+ placement,
887
+ elements,
888
+ rects,
889
+ platform,
890
+ strategy
891
+ } = middlewareArguments; // A MouseEvent's client{X,Y} coords can be up to 2 pixels off a
892
+ // ClientRect's bounds, despite the event listener being triggered. A
893
+ // padding of 2 seems to handle this issue.
638
894
 
639
- if (parentName) {
640
- info = "\n\nCheck the top-level render call using <" + parentName + ">.";
641
- }
642
- }
895
+ const {
896
+ padding = 2,
897
+ x,
898
+ y
899
+ } = options;
900
+ const fallback = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
901
+ rect: rects.reference,
902
+ offsetParent: await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating)),
903
+ strategy
904
+ }) : rects.reference);
905
+ const clientRects = (_await$platform$getCl = await (platform.getClientRects == null ? void 0 : platform.getClientRects(elements.reference))) != null ? _await$platform$getCl : [];
906
+ const paddingObject = getSideObjectFromPadding(padding);
907
+
908
+ function getBoundingClientRect() {
909
+ // There are two rects and they are disjoined
910
+ if (clientRects.length === 2 && clientRects[0].left > clientRects[1].right && x != null && y != null) {
911
+ var _clientRects$find;
912
+
913
+ // Find the first rect in which the point is fully inside
914
+ return (_clientRects$find = clientRects.find(rect => x > rect.left - paddingObject.left && x < rect.right + paddingObject.right && y > rect.top - paddingObject.top && y < rect.bottom + paddingObject.bottom)) != null ? _clientRects$find : fallback;
915
+ } // There are 2 or more connected rects
916
+
917
+
918
+ if (clientRects.length >= 2) {
919
+ if (getMainAxisFromPlacement(placement) === 'x') {
920
+ const firstRect = clientRects[0];
921
+ const lastRect = clientRects[clientRects.length - 1];
922
+ const isTop = getSide(placement) === 'top';
923
+ const top = firstRect.top;
924
+ const bottom = lastRect.bottom;
925
+ const left = isTop ? firstRect.left : lastRect.left;
926
+ const right = isTop ? firstRect.right : lastRect.right;
927
+ const width = right - left;
928
+ const height = bottom - top;
929
+ return {
930
+ top,
931
+ bottom,
932
+ left,
933
+ right,
934
+ width,
935
+ height,
936
+ x: left,
937
+ y: top
938
+ };
939
+ }
643
940
 
644
- return info;
645
- }
646
- }
647
- /**
648
- * Warn if the element doesn't have an explicit key assigned to it.
649
- * This element is in an array. The array could grow and shrink or be
650
- * reordered. All children that haven't already been validated are required to
651
- * have a "key" property assigned to it. Error statuses are cached so a warning
652
- * will only be shown once.
653
- *
654
- * @internal
655
- * @param {ReactElement} element Element that requires a key.
656
- * @param {*} parentType element's parent's type.
657
- */
941
+ const isLeftSide = getSide(placement) === 'left';
942
+ const maxRight = max$1(...clientRects.map(rect => rect.right));
943
+ const minLeft = min$1(...clientRects.map(rect => rect.left));
944
+ const measureRects = clientRects.filter(rect => isLeftSide ? rect.left === minLeft : rect.right === maxRight);
945
+ const top = measureRects[0].top;
946
+ const bottom = measureRects[measureRects.length - 1].bottom;
947
+ const left = minLeft;
948
+ const right = maxRight;
949
+ const width = right - left;
950
+ const height = bottom - top;
951
+ return {
952
+ top,
953
+ bottom,
954
+ left,
955
+ right,
956
+ width,
957
+ height,
958
+ x: left,
959
+ y: top
960
+ };
961
+ }
658
962
 
963
+ return fallback;
964
+ }
659
965
 
660
- function validateExplicitKey(element, parentType) {
661
- {
662
- if (!element._store || element._store.validated || element.key != null) {
663
- return;
664
- }
966
+ const resetRects = await platform.getElementRects({
967
+ reference: {
968
+ getBoundingClientRect
969
+ },
970
+ floating: elements.floating,
971
+ strategy
972
+ });
665
973
 
666
- element._store.validated = true;
667
- var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
974
+ if (rects.reference.x !== resetRects.reference.x || rects.reference.y !== resetRects.reference.y || rects.reference.width !== resetRects.reference.width || rects.reference.height !== resetRects.reference.height) {
975
+ return {
976
+ reset: {
977
+ rects: resetRects
978
+ }
979
+ };
980
+ }
668
981
 
669
- if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
670
- return;
671
- }
982
+ return {};
983
+ }
672
984
 
673
- ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
674
- // property, it may be the creator of the child that's responsible for
675
- // assigning it a key.
985
+ };
986
+ };
676
987
 
677
- var childOwner = '';
988
+ function isWindow(value) {
989
+ return value && value.document && value.location && value.alert && value.setInterval;
990
+ }
991
+ function getWindow(node) {
992
+ if (node == null) {
993
+ return window;
994
+ }
678
995
 
679
- if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
680
- // Give the component that originally created this child.
681
- childOwner = " It was passed a child from " + getComponentName(element._owner.type) + ".";
682
- }
996
+ if (!isWindow(node)) {
997
+ const ownerDocument = node.ownerDocument;
998
+ return ownerDocument ? ownerDocument.defaultView || window : window;
999
+ }
683
1000
 
684
- setCurrentlyValidatingElement$1(element);
1001
+ return node;
1002
+ }
685
1003
 
686
- error('Each child in a list should have a unique "key" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);
1004
+ function getComputedStyle(element) {
1005
+ return getWindow(element).getComputedStyle(element);
1006
+ }
687
1007
 
688
- setCurrentlyValidatingElement$1(null);
689
- }
690
- }
691
- /**
692
- * Ensure that every element either is passed in a static location, in an
693
- * array with an explicit keys property defined, or in an object literal
694
- * with valid key property.
695
- *
696
- * @internal
697
- * @param {ReactNode} node Statically passed child of any type.
698
- * @param {*} parentType node's parent's type.
699
- */
1008
+ function getNodeName(node) {
1009
+ return isWindow(node) ? '' : node ? (node.nodeName || '').toLowerCase() : '';
1010
+ }
700
1011
 
1012
+ function getUAString() {
1013
+ const uaData = navigator.userAgentData;
701
1014
 
702
- function validateChildKeys(node, parentType) {
703
- {
704
- if (typeof node !== 'object') {
705
- return;
706
- }
1015
+ if (uaData != null && uaData.brands) {
1016
+ return uaData.brands.map(item => item.brand + "/" + item.version).join(' ');
1017
+ }
707
1018
 
708
- if (Array.isArray(node)) {
709
- for (var i = 0; i < node.length; i++) {
710
- var child = node[i];
1019
+ return navigator.userAgent;
1020
+ }
711
1021
 
712
- if (isValidElement(child)) {
713
- validateExplicitKey(child, parentType);
714
- }
715
- }
716
- } else if (isValidElement(node)) {
717
- // This element was passed in a valid location.
718
- if (node._store) {
719
- node._store.validated = true;
720
- }
721
- } else if (node) {
722
- var iteratorFn = getIteratorFn(node);
1022
+ function isHTMLElement(value) {
1023
+ return value instanceof getWindow(value).HTMLElement;
1024
+ }
1025
+ function isElement(value) {
1026
+ return value instanceof getWindow(value).Element;
1027
+ }
1028
+ function isNode(value) {
1029
+ return value instanceof getWindow(value).Node;
1030
+ }
1031
+ function isShadowRoot(node) {
1032
+ // Browsers without `ShadowRoot` support
1033
+ if (typeof ShadowRoot === 'undefined') {
1034
+ return false;
1035
+ }
723
1036
 
724
- if (typeof iteratorFn === 'function') {
725
- // Entry iterators used to provide implicit keys,
726
- // but now we print a separate warning for them later.
727
- if (iteratorFn !== node.entries) {
728
- var iterator = iteratorFn.call(node);
729
- var step;
1037
+ const OwnElement = getWindow(node).ShadowRoot;
1038
+ return node instanceof OwnElement || node instanceof ShadowRoot;
1039
+ }
1040
+ function isOverflowElement(element) {
1041
+ // Firefox wants us to check `-x` and `-y` variations as well
1042
+ const {
1043
+ overflow,
1044
+ overflowX,
1045
+ overflowY,
1046
+ display
1047
+ } = getComputedStyle(element);
1048
+ return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
1049
+ }
1050
+ function isTableElement(element) {
1051
+ return ['table', 'td', 'th'].includes(getNodeName(element));
1052
+ }
1053
+ function isContainingBlock(element) {
1054
+ // TODO: Try and use feature detection here instead
1055
+ const isFirefox = /firefox/i.test(getUAString());
1056
+ const css = getComputedStyle(element);
1057
+ const backdropFilter = css.backdropFilter || css.WebkitBackdropFilter; // This is non-exhaustive but covers the most common CSS properties that
1058
+ // create a containing block.
1059
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
730
1060
 
731
- while (!(step = iterator.next()).done) {
732
- if (isValidElement(step.value)) {
733
- validateExplicitKey(step.value, parentType);
734
- }
735
- }
736
- }
737
- }
738
- }
739
- }
740
- }
741
- /**
742
- * Given an element, validate that its props follow the propTypes definition,
743
- * provided by the type.
744
- *
745
- * @param {ReactElement} element
746
- */
1061
+ return css.transform !== 'none' || css.perspective !== 'none' || (backdropFilter ? backdropFilter !== 'none' : false) || isFirefox && css.willChange === 'filter' || isFirefox && (css.filter ? css.filter !== 'none' : false) || ['transform', 'perspective'].some(value => css.willChange.includes(value)) || ['paint', 'layout', 'strict', 'content'].some( // TS 4.1 compat
1062
+ value => {
1063
+ const contain = css.contain;
1064
+ return contain != null ? contain.includes(value) : false;
1065
+ });
1066
+ }
1067
+ function isLayoutViewport() {
1068
+ // Not Safari
1069
+ return !/^((?!chrome|android).)*safari/i.test(getUAString()); // Feature detection for this fails in various ways
1070
+ // • Always-visible scrollbar or not
1071
+ // • Width of <html>, etc.
1072
+ // const vV = win.visualViewport;
1073
+ // return vV ? Math.abs(win.innerWidth / vV.scale - vV.width) < 0.5 : true;
1074
+ }
1075
+ function isLastTraversableNode(node) {
1076
+ return ['html', 'body', '#document'].includes(getNodeName(node));
1077
+ }
747
1078
 
1079
+ const min = Math.min;
1080
+ const max = Math.max;
1081
+ const round = Math.round;
748
1082
 
749
- function validatePropTypes(element) {
750
- {
751
- var type = element.type;
1083
+ function getBoundingClientRect(element, includeScale, isFixedStrategy) {
1084
+ var _win$visualViewport$o, _win$visualViewport, _win$visualViewport$o2, _win$visualViewport2;
752
1085
 
753
- if (type === null || type === undefined || typeof type === 'string') {
754
- return;
755
- }
1086
+ if (includeScale === void 0) {
1087
+ includeScale = false;
1088
+ }
756
1089
 
757
- var propTypes;
1090
+ if (isFixedStrategy === void 0) {
1091
+ isFixedStrategy = false;
1092
+ }
758
1093
 
759
- if (typeof type === 'function') {
760
- propTypes = type.propTypes;
761
- } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
762
- // Inner props are checked in the reconciler.
763
- type.$$typeof === REACT_MEMO_TYPE)) {
764
- propTypes = type.propTypes;
765
- } else {
766
- return;
767
- }
1094
+ const clientRect = element.getBoundingClientRect();
1095
+ let scaleX = 1;
1096
+ let scaleY = 1;
768
1097
 
769
- if (propTypes) {
770
- // Intentionally inside to avoid triggering lazy initializers:
771
- var name = getComponentName(type);
772
- checkPropTypes(propTypes, element.props, 'prop', name, element);
773
- } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
774
- propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
1098
+ if (includeScale && isHTMLElement(element)) {
1099
+ scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
1100
+ scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
1101
+ }
775
1102
 
776
- var _name = getComponentName(type);
1103
+ const win = isElement(element) ? getWindow(element) : window;
1104
+ const addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
1105
+ const x = (clientRect.left + (addVisualOffsets ? (_win$visualViewport$o = (_win$visualViewport = win.visualViewport) == null ? void 0 : _win$visualViewport.offsetLeft) != null ? _win$visualViewport$o : 0 : 0)) / scaleX;
1106
+ const y = (clientRect.top + (addVisualOffsets ? (_win$visualViewport$o2 = (_win$visualViewport2 = win.visualViewport) == null ? void 0 : _win$visualViewport2.offsetTop) != null ? _win$visualViewport$o2 : 0 : 0)) / scaleY;
1107
+ const width = clientRect.width / scaleX;
1108
+ const height = clientRect.height / scaleY;
1109
+ return {
1110
+ width,
1111
+ height,
1112
+ top: y,
1113
+ right: x + width,
1114
+ bottom: y + height,
1115
+ left: x,
1116
+ x,
1117
+ y
1118
+ };
1119
+ }
777
1120
 
778
- error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
779
- }
1121
+ function getDocumentElement(node) {
1122
+ return ((isNode(node) ? node.ownerDocument : node.document) || window.document).documentElement;
1123
+ }
780
1124
 
781
- if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
782
- error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
783
- }
784
- }
785
- }
786
- /**
787
- * Given a fragment, validate that it can only be provided with fragment props
788
- * @param {ReactElement} fragment
789
- */
1125
+ function getNodeScroll(element) {
1126
+ if (isElement(element)) {
1127
+ return {
1128
+ scrollLeft: element.scrollLeft,
1129
+ scrollTop: element.scrollTop
1130
+ };
1131
+ }
790
1132
 
1133
+ return {
1134
+ scrollLeft: element.pageXOffset,
1135
+ scrollTop: element.pageYOffset
1136
+ };
1137
+ }
791
1138
 
792
- function validateFragmentProps(fragment) {
793
- {
794
- var keys = Object.keys(fragment.props);
1139
+ function getWindowScrollBarX(element) {
1140
+ // If <html> has a CSS width greater than the viewport, then this will be
1141
+ // incorrect for RTL.
1142
+ return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
1143
+ }
795
1144
 
796
- for (var i = 0; i < keys.length; i++) {
797
- var key = keys[i];
1145
+ function isScaled(element) {
1146
+ const rect = getBoundingClientRect(element);
1147
+ return round(rect.width) !== element.offsetWidth || round(rect.height) !== element.offsetHeight;
1148
+ }
798
1149
 
799
- if (key !== 'children' && key !== 'key') {
800
- setCurrentlyValidatingElement$1(fragment);
1150
+ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
1151
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
1152
+ const documentElement = getDocumentElement(offsetParent);
1153
+ const rect = getBoundingClientRect(element, // @ts-ignore - checked above (TS 4.1 compat)
1154
+ isOffsetParentAnElement && isScaled(offsetParent), strategy === 'fixed');
1155
+ let scroll = {
1156
+ scrollLeft: 0,
1157
+ scrollTop: 0
1158
+ };
1159
+ const offsets = {
1160
+ x: 0,
1161
+ y: 0
1162
+ };
801
1163
 
802
- error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
1164
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
1165
+ if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
1166
+ scroll = getNodeScroll(offsetParent);
1167
+ }
803
1168
 
804
- setCurrentlyValidatingElement$1(null);
805
- break;
806
- }
807
- }
1169
+ if (isHTMLElement(offsetParent)) {
1170
+ const offsetRect = getBoundingClientRect(offsetParent, true);
1171
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
1172
+ offsets.y = offsetRect.y + offsetParent.clientTop;
1173
+ } else if (documentElement) {
1174
+ offsets.x = getWindowScrollBarX(documentElement);
1175
+ }
1176
+ }
808
1177
 
809
- if (fragment.ref !== null) {
810
- setCurrentlyValidatingElement$1(fragment);
1178
+ return {
1179
+ x: rect.left + scroll.scrollLeft - offsets.x,
1180
+ y: rect.top + scroll.scrollTop - offsets.y,
1181
+ width: rect.width,
1182
+ height: rect.height
1183
+ };
1184
+ }
811
1185
 
812
- error('Invalid attribute `ref` supplied to `React.Fragment`.');
1186
+ function getParentNode(node) {
1187
+ if (getNodeName(node) === 'html') {
1188
+ return node;
1189
+ }
813
1190
 
814
- setCurrentlyValidatingElement$1(null);
815
- }
816
- }
817
- }
1191
+ const result = // Step into the shadow DOM of the parent of a slotted node
1192
+ node.assignedSlot || // DOM Element detected
1193
+ node.parentNode || ( // ShadowRoot detected
1194
+ isShadowRoot(node) ? node.host : null) || // Fallback
1195
+ getDocumentElement(node);
1196
+ return isShadowRoot(result) ? result.host : result;
1197
+ }
818
1198
 
819
- function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
820
- {
821
- var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
822
- // succeed and there will likely be errors in render.
1199
+ function getTrueOffsetParent(element) {
1200
+ if (!isHTMLElement(element) || getComputedStyle(element).position === 'fixed') {
1201
+ return null;
1202
+ }
823
1203
 
824
- if (!validType) {
825
- var info = '';
1204
+ return element.offsetParent;
1205
+ }
826
1206
 
827
- if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
828
- info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports.";
829
- }
1207
+ function getContainingBlock(element) {
1208
+ let currentNode = getParentNode(element);
830
1209
 
831
- var sourceInfo = getSourceInfoErrorAddendum(source);
1210
+ while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
1211
+ if (isContainingBlock(currentNode)) {
1212
+ return currentNode;
1213
+ } else {
1214
+ currentNode = getParentNode(currentNode);
1215
+ }
1216
+ }
832
1217
 
833
- if (sourceInfo) {
834
- info += sourceInfo;
835
- } else {
836
- info += getDeclarationErrorAddendum();
837
- }
1218
+ return null;
1219
+ } // Gets the closest ancestor positioned element. Handles some edge cases,
1220
+ // such as table ancestors and cross browser bugs.
838
1221
 
839
- var typeString;
840
1222
 
841
- if (type === null) {
842
- typeString = 'null';
843
- } else if (Array.isArray(type)) {
844
- typeString = 'array';
845
- } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
846
- typeString = "<" + (getComponentName(type.type) || 'Unknown') + " />";
847
- info = ' Did you accidentally export a JSX literal instead of a component?';
848
- } else {
849
- typeString = typeof type;
850
- }
1223
+ function getOffsetParent(element) {
1224
+ const window = getWindow(element);
1225
+ let offsetParent = getTrueOffsetParent(element);
851
1226
 
852
- error('React.jsx: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
853
- }
1227
+ while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {
1228
+ offsetParent = getTrueOffsetParent(offsetParent);
1229
+ }
854
1230
 
855
- var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.
856
- // TODO: Drop this when these are no longer allowed as the type argument.
1231
+ if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static' && !isContainingBlock(offsetParent))) {
1232
+ return window;
1233
+ }
857
1234
 
858
- if (element == null) {
859
- return element;
860
- } // Skip key warning if the type isn't valid since our key validation logic
861
- // doesn't expect a non-string/function type and can throw confusing errors.
862
- // We don't want exception behavior to differ between dev and prod.
863
- // (Rendering will throw with a helpful message and as soon as the type is
864
- // fixed, the key warnings will appear.)
1235
+ return offsetParent || getContainingBlock(element) || window;
1236
+ }
865
1237
 
1238
+ function getDimensions(element) {
1239
+ if (isHTMLElement(element)) {
1240
+ return {
1241
+ width: element.offsetWidth,
1242
+ height: element.offsetHeight
1243
+ };
1244
+ }
866
1245
 
867
- if (validType) {
868
- var children = props.children;
1246
+ const rect = getBoundingClientRect(element);
1247
+ return {
1248
+ width: rect.width,
1249
+ height: rect.height
1250
+ };
1251
+ }
869
1252
 
870
- if (children !== undefined) {
871
- if (isStaticChildren) {
872
- if (Array.isArray(children)) {
873
- for (var i = 0; i < children.length; i++) {
874
- validateChildKeys(children[i], type);
875
- }
1253
+ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
1254
+ let {
1255
+ rect,
1256
+ offsetParent,
1257
+ strategy
1258
+ } = _ref;
1259
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
1260
+ const documentElement = getDocumentElement(offsetParent);
876
1261
 
877
- if (Object.freeze) {
878
- Object.freeze(children);
879
- }
880
- } else {
881
- error('React.jsx: Static children should always be an array. ' + 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' + 'Use the Babel transform instead.');
882
- }
883
- } else {
884
- validateChildKeys(children, type);
885
- }
886
- }
887
- }
1262
+ if (offsetParent === documentElement) {
1263
+ return rect;
1264
+ }
888
1265
 
889
- if (type === exports.Fragment) {
890
- validateFragmentProps(element);
891
- } else {
892
- validatePropTypes(element);
893
- }
1266
+ let scroll = {
1267
+ scrollLeft: 0,
1268
+ scrollTop: 0
1269
+ };
1270
+ const offsets = {
1271
+ x: 0,
1272
+ y: 0
1273
+ };
894
1274
 
895
- return element;
896
- }
897
- } // These two functions exist to still get child warnings in dev
898
- // even with the prod transform. This means that jsxDEV is purely
899
- // opt-in behavior for better messages but that we won't stop
900
- // giving you warnings if you use production apis.
1275
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
1276
+ if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
1277
+ scroll = getNodeScroll(offsetParent);
1278
+ }
901
1279
 
902
- function jsxWithValidationStatic(type, props, key) {
903
- {
904
- return jsxWithValidation(type, props, key, true);
905
- }
906
- }
907
- function jsxWithValidationDynamic(type, props, key) {
908
- {
909
- return jsxWithValidation(type, props, key, false);
910
- }
911
- }
1280
+ if (isHTMLElement(offsetParent)) {
1281
+ const offsetRect = getBoundingClientRect(offsetParent, true);
1282
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
1283
+ offsets.y = offsetRect.y + offsetParent.clientTop;
1284
+ } // This doesn't appear to be need to be negated.
1285
+ // else if (documentElement) {
1286
+ // offsets.x = getWindowScrollBarX(documentElement);
1287
+ // }
912
1288
 
913
- var jsx = jsxWithValidationDynamic ; // we may want to special case jsxs internally to take advantage of static children.
914
- // for now we can ship identical prod functions
1289
+ }
915
1290
 
916
- var jsxs = jsxWithValidationStatic ;
1291
+ return { ...rect,
1292
+ x: rect.x - scroll.scrollLeft + offsets.x,
1293
+ y: rect.y - scroll.scrollTop + offsets.y
1294
+ };
1295
+ }
917
1296
 
918
- exports.jsx = jsx;
919
- exports.jsxs = jsxs;
920
- })();
921
- }
922
- } (reactJsxRuntime_development));
1297
+ function getViewportRect(element, strategy) {
1298
+ const win = getWindow(element);
1299
+ const html = getDocumentElement(element);
1300
+ const visualViewport = win.visualViewport;
1301
+ let width = html.clientWidth;
1302
+ let height = html.clientHeight;
1303
+ let x = 0;
1304
+ let y = 0;
923
1305
 
924
- (function (module) {
1306
+ if (visualViewport) {
1307
+ width = visualViewport.width;
1308
+ height = visualViewport.height;
1309
+ const layoutViewport = isLayoutViewport();
925
1310
 
926
- {
927
- module.exports = reactJsxRuntime_development;
928
- }
929
- } (jsxRuntime));
1311
+ if (layoutViewport || !layoutViewport && strategy === 'fixed') {
1312
+ x = visualViewport.offsetLeft;
1313
+ y = visualViewport.offsetTop;
1314
+ }
1315
+ }
930
1316
 
931
- var classnames = {exports: {}};
1317
+ return {
1318
+ width,
1319
+ height,
1320
+ x,
1321
+ y
1322
+ };
1323
+ }
932
1324
 
933
- /*!
934
- Copyright (c) 2018 Jed Watson.
935
- Licensed under the MIT License (MIT), see
936
- http://jedwatson.github.io/classnames
937
- */
1325
+ // of the `<html>` and `<body>` rect bounds if horizontally scrollable
938
1326
 
939
- (function (module) {
940
- /* global define */
1327
+ function getDocumentRect(element) {
1328
+ var _element$ownerDocumen;
941
1329
 
942
- (function () {
1330
+ const html = getDocumentElement(element);
1331
+ const scroll = getNodeScroll(element);
1332
+ const body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
1333
+ const width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
1334
+ const height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
1335
+ let x = -scroll.scrollLeft + getWindowScrollBarX(element);
1336
+ const y = -scroll.scrollTop;
943
1337
 
944
- var hasOwn = {}.hasOwnProperty;
1338
+ if (getComputedStyle(body || html).direction === 'rtl') {
1339
+ x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
1340
+ }
945
1341
 
946
- function classNames() {
947
- var classes = [];
1342
+ return {
1343
+ width,
1344
+ height,
1345
+ x,
1346
+ y
1347
+ };
1348
+ }
948
1349
 
949
- for (var i = 0; i < arguments.length; i++) {
950
- var arg = arguments[i];
951
- if (!arg) continue;
1350
+ function getNearestOverflowAncestor(node) {
1351
+ const parentNode = getParentNode(node);
952
1352
 
953
- var argType = typeof arg;
1353
+ if (isLastTraversableNode(parentNode)) {
1354
+ // @ts-ignore assume body is always available
1355
+ return node.ownerDocument.body;
1356
+ }
954
1357
 
955
- if (argType === 'string' || argType === 'number') {
956
- classes.push(arg);
957
- } else if (Array.isArray(arg)) {
958
- if (arg.length) {
959
- var inner = classNames.apply(null, arg);
960
- if (inner) {
961
- classes.push(inner);
962
- }
963
- }
964
- } else if (argType === 'object') {
965
- if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
966
- classes.push(arg.toString());
967
- continue;
968
- }
1358
+ if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
1359
+ return parentNode;
1360
+ }
969
1361
 
970
- for (var key in arg) {
971
- if (hasOwn.call(arg, key) && arg[key]) {
972
- classes.push(key);
973
- }
974
- }
975
- }
976
- }
977
-
978
- return classes.join(' ');
979
- }
980
-
981
- if (module.exports) {
982
- classNames.default = classNames;
983
- module.exports = classNames;
984
- } else {
985
- window.classNames = classNames;
986
- }
987
- }());
988
- } (classnames));
989
-
990
- var classNames = classnames.exports;
991
-
992
- /* eslint-disable @typescript-eslint/no-explicit-any */
993
- /**
994
- * This function debounce the received function
995
- * @param { function } func Function to be debounced
996
- * @param { number } wait Time to wait before execut the function
997
- * @param { boolean } immediate Param to define if the function will be executed immediately
998
- */
999
- const debounce = (func, wait, immediate) => {
1000
- let timeout = null;
1001
- return function debounced(...args) {
1002
- const later = () => {
1003
- timeout = null;
1004
- if (!immediate) {
1005
- func.apply(this, args);
1006
- }
1007
- };
1008
- if (timeout) {
1009
- clearTimeout(timeout);
1010
- }
1011
- timeout = setTimeout(later, wait);
1012
- };
1013
- };
1014
-
1015
- const TooltipContent = ({ content }) => {
1016
- return jsxRuntime.exports.jsx("span", { dangerouslySetInnerHTML: { __html: content } });
1017
- };
1018
-
1019
- const DEFAULT_TOOLTIP_ID = 'DEFAULT_TOOLTIP_ID';
1020
- const DEFAULT_CONTEXT_DATA = {
1021
- anchorRefs: new Set(),
1022
- activeAnchor: { current: null },
1023
- attach: () => {
1024
- /* attach anchor element */
1025
- },
1026
- detach: () => {
1027
- /* detach anchor element */
1028
- },
1029
- setActiveAnchor: () => {
1030
- /* set active anchor */
1031
- },
1032
- };
1033
- const DEFAULT_CONTEXT_DATA_WRAPPER = {
1034
- getTooltipData: () => DEFAULT_CONTEXT_DATA,
1035
- };
1036
- const TooltipContext = require$$0.createContext(DEFAULT_CONTEXT_DATA_WRAPPER);
1037
- const TooltipProvider = ({ children }) => {
1038
- const [anchorRefMap, setAnchorRefMap] = require$$0.useState({
1039
- [DEFAULT_TOOLTIP_ID]: new Set(),
1040
- });
1041
- const [activeAnchorMap, setActiveAnchorMap] = require$$0.useState({
1042
- [DEFAULT_TOOLTIP_ID]: { current: null },
1043
- });
1044
- const attach = (tooltipId, ...refs) => {
1045
- setAnchorRefMap((oldMap) => {
1046
- var _a;
1047
- const tooltipRefs = (_a = oldMap[tooltipId]) !== null && _a !== void 0 ? _a : new Set();
1048
- refs.forEach((ref) => tooltipRefs.add(ref));
1049
- // create new object to trigger re-render
1050
- return { ...oldMap, [tooltipId]: new Set(tooltipRefs) };
1051
- });
1052
- };
1053
- const detach = (tooltipId, ...refs) => {
1054
- setAnchorRefMap((oldMap) => {
1055
- const tooltipRefs = oldMap[tooltipId];
1056
- if (!tooltipRefs) {
1057
- // tooltip not found
1058
- // maybe thow error?
1059
- return oldMap;
1060
- }
1061
- refs.forEach((ref) => tooltipRefs.delete(ref));
1062
- // create new object to trigger re-render
1063
- return { ...oldMap };
1064
- });
1065
- };
1066
- const setActiveAnchor = (tooltipId, ref) => {
1067
- setActiveAnchorMap((oldMap) => {
1068
- var _a;
1069
- if (((_a = oldMap[tooltipId]) === null || _a === void 0 ? void 0 : _a.current) === ref.current) {
1070
- return oldMap;
1071
- }
1072
- // create new object to trigger re-render
1073
- return { ...oldMap, [tooltipId]: ref };
1074
- });
1075
- };
1076
- const getTooltipData = require$$0.useCallback((tooltipId = DEFAULT_TOOLTIP_ID) => {
1077
- var _a, _b;
1078
- return ({
1079
- anchorRefs: (_a = anchorRefMap[tooltipId]) !== null && _a !== void 0 ? _a : new Set(),
1080
- activeAnchor: (_b = activeAnchorMap[tooltipId]) !== null && _b !== void 0 ? _b : { current: null },
1081
- attach: (...refs) => attach(tooltipId, ...refs),
1082
- detach: (...refs) => detach(tooltipId, ...refs),
1083
- setActiveAnchor: (ref) => setActiveAnchor(tooltipId, ref),
1084
- });
1085
- }, [anchorRefMap, activeAnchorMap, attach, detach]);
1086
- const context = require$$0.useMemo(() => {
1087
- return {
1088
- getTooltipData,
1089
- };
1090
- }, [getTooltipData]);
1091
- return jsxRuntime.exports.jsx(TooltipContext.Provider, { value: context, children: children });
1092
- };
1093
- function useTooltip(tooltipId = DEFAULT_TOOLTIP_ID) {
1094
- return require$$0.useContext(TooltipContext).getTooltipData(tooltipId);
1362
+ return getNearestOverflowAncestor(parentNode);
1095
1363
  }
1096
1364
 
1097
- const TooltipWrapper = ({ tooltipId, children, className, place, content, html, variant, offset, wrapper, events, positionStrategy, delayShow, delayHide, }) => {
1098
- const { attach, detach } = useTooltip(tooltipId);
1099
- const anchorRef = require$$0.useRef(null);
1100
- require$$0.useEffect(() => {
1101
- attach(anchorRef);
1102
- return () => {
1103
- detach(anchorRef);
1104
- };
1105
- }, []);
1106
- return (jsxRuntime.exports.jsx("span", { ref: anchorRef, className: classNames('react-tooltip-wrapper', className), "data-tooltip-place": place, "data-tooltip-content": content, "data-tooltip-html": html, "data-tooltip-variant": variant, "data-tooltip-offset": offset, "data-tooltip-wrapper": wrapper, "data-tooltip-events": events, "data-tooltip-position-strategy": positionStrategy, "data-tooltip-delay-show": delayShow, "data-tooltip-delay-hide": delayHide, children: children }));
1107
- };
1108
-
1109
- function getSide(placement) {
1110
- return placement.split('-')[0];
1111
- }
1365
+ function getOverflowAncestors(node, list) {
1366
+ var _node$ownerDocument;
1112
1367
 
1113
- function getAlignment(placement) {
1114
- return placement.split('-')[1];
1115
- }
1368
+ if (list === void 0) {
1369
+ list = [];
1370
+ }
1116
1371
 
1117
- function getMainAxisFromPlacement(placement) {
1118
- return ['top', 'bottom'].includes(getSide(placement)) ? 'x' : 'y';
1372
+ const scrollableAncestor = getNearestOverflowAncestor(node);
1373
+ const isBody = scrollableAncestor === ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.body);
1374
+ const win = getWindow(scrollableAncestor);
1375
+ const target = isBody ? [win].concat(win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : []) : scrollableAncestor;
1376
+ const updatedList = list.concat(target);
1377
+ return isBody ? updatedList : // @ts-ignore: isBody tells us target will be an HTMLElement here
1378
+ updatedList.concat(getOverflowAncestors(target));
1119
1379
  }
1120
1380
 
1121
- function getLengthFromAxis(axis) {
1122
- return axis === 'y' ? 'height' : 'width';
1381
+ function getInnerBoundingClientRect(element, strategy) {
1382
+ const clientRect = getBoundingClientRect(element, false, strategy === 'fixed');
1383
+ const top = clientRect.top + element.clientTop;
1384
+ const left = clientRect.left + element.clientLeft;
1385
+ return {
1386
+ top,
1387
+ left,
1388
+ x: left,
1389
+ y: top,
1390
+ right: left + element.clientWidth,
1391
+ bottom: top + element.clientHeight,
1392
+ width: element.clientWidth,
1393
+ height: element.clientHeight
1394
+ };
1123
1395
  }
1124
1396
 
1125
- function computeCoordsFromPlacement(_ref, placement, rtl) {
1126
- let {
1127
- reference,
1128
- floating
1129
- } = _ref;
1130
- const commonX = reference.x + reference.width / 2 - floating.width / 2;
1131
- const commonY = reference.y + reference.height / 2 - floating.height / 2;
1132
- const mainAxis = getMainAxisFromPlacement(placement);
1133
- const length = getLengthFromAxis(mainAxis);
1134
- const commonAlign = reference[length] / 2 - floating[length] / 2;
1135
- const side = getSide(placement);
1136
- const isVertical = mainAxis === 'x';
1137
- let coords;
1397
+ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
1398
+ if (clippingAncestor === 'viewport') {
1399
+ return rectToClientRect(getViewportRect(element, strategy));
1400
+ }
1138
1401
 
1139
- switch (side) {
1140
- case 'top':
1141
- coords = {
1142
- x: commonX,
1143
- y: reference.y - floating.height
1144
- };
1145
- break;
1402
+ if (isElement(clippingAncestor)) {
1403
+ return getInnerBoundingClientRect(clippingAncestor, strategy);
1404
+ }
1146
1405
 
1147
- case 'bottom':
1148
- coords = {
1149
- x: commonX,
1150
- y: reference.y + reference.height
1151
- };
1152
- break;
1406
+ return rectToClientRect(getDocumentRect(getDocumentElement(element)));
1407
+ } // A "clipping ancestor" is an overflowable container with the characteristic of
1408
+ // clipping (or hiding) overflowing elements with a position different from
1409
+ // `initial`
1153
1410
 
1154
- case 'right':
1155
- coords = {
1156
- x: reference.x + reference.width,
1157
- y: commonY
1158
- };
1159
- break;
1160
1411
 
1161
- case 'left':
1162
- coords = {
1163
- x: reference.x - floating.width,
1164
- y: commonY
1165
- };
1166
- break;
1412
+ function getClippingElementAncestors(element) {
1413
+ let result = getOverflowAncestors(element).filter(el => isElement(el) && getNodeName(el) !== 'body');
1414
+ let currentNode = element;
1415
+ let currentContainingBlockComputedStyle = null; // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
1167
1416
 
1168
- default:
1169
- coords = {
1170
- x: reference.x,
1171
- y: reference.y
1172
- };
1173
- }
1417
+ while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
1418
+ const computedStyle = getComputedStyle(currentNode);
1174
1419
 
1175
- switch (getAlignment(placement)) {
1176
- case 'start':
1177
- coords[mainAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
1178
- break;
1420
+ if (computedStyle.position === 'static' && currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position) && !isContainingBlock(currentNode)) {
1421
+ // Drop non-containing blocks
1422
+ result = result.filter(ancestor => ancestor !== currentNode);
1423
+ } else {
1424
+ // Record last containing block for next iteration
1425
+ currentContainingBlockComputedStyle = computedStyle;
1426
+ }
1179
1427
 
1180
- case 'end':
1181
- coords[mainAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
1182
- break;
1428
+ currentNode = getParentNode(currentNode);
1183
1429
  }
1184
1430
 
1185
- return coords;
1186
- }
1431
+ return result;
1432
+ } // Gets the maximum area that the element is visible in due to any number of
1433
+ // clipping ancestors
1187
1434
 
1188
- /**
1189
- * Computes the `x` and `y` coordinates that will place the floating element
1190
- * next to a reference element when it is given a certain positioning strategy.
1191
- *
1192
- * This export does not have any `platform` interface logic. You will need to
1193
- * write one for the platform you are using Floating UI with.
1194
- */
1195
1435
 
1196
- const computePosition$1 = async (reference, floating, config) => {
1197
- const {
1198
- placement = 'bottom',
1199
- strategy = 'absolute',
1200
- middleware = [],
1201
- platform
1202
- } = config;
1203
- const validMiddleware = middleware.filter(Boolean);
1204
- const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
1436
+ function getClippingRect(_ref) {
1437
+ let {
1438
+ element,
1439
+ boundary,
1440
+ rootBoundary,
1441
+ strategy
1442
+ } = _ref;
1443
+ const elementClippingAncestors = boundary === 'clippingAncestors' ? getClippingElementAncestors(element) : [].concat(boundary);
1444
+ const clippingAncestors = [...elementClippingAncestors, rootBoundary];
1445
+ const firstClippingAncestor = clippingAncestors[0];
1446
+ const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
1447
+ const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
1448
+ accRect.top = max(rect.top, accRect.top);
1449
+ accRect.right = min(rect.right, accRect.right);
1450
+ accRect.bottom = min(rect.bottom, accRect.bottom);
1451
+ accRect.left = max(rect.left, accRect.left);
1452
+ return accRect;
1453
+ }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
1454
+ return {
1455
+ width: clippingRect.right - clippingRect.left,
1456
+ height: clippingRect.bottom - clippingRect.top,
1457
+ x: clippingRect.left,
1458
+ y: clippingRect.top
1459
+ };
1460
+ }
1205
1461
 
1206
- {
1207
- if (platform == null) {
1208
- console.error(['Floating UI: `platform` property was not passed to config. If you', 'want to use Floating UI on the web, install @floating-ui/dom', 'instead of the /core package. Otherwise, you can create your own', '`platform`: https://floating-ui.com/docs/platform'].join(' '));
1209
- }
1462
+ const platform = {
1463
+ getClippingRect,
1464
+ convertOffsetParentRelativeRectToViewportRelativeRect,
1465
+ isElement,
1466
+ getDimensions,
1467
+ getOffsetParent,
1468
+ getDocumentElement,
1469
+ getElementRects: _ref => {
1470
+ let {
1471
+ reference,
1472
+ floating,
1473
+ strategy
1474
+ } = _ref;
1475
+ return {
1476
+ reference: getRectRelativeToOffsetParent(reference, getOffsetParent(floating), strategy),
1477
+ floating: { ...getDimensions(floating),
1478
+ x: 0,
1479
+ y: 0
1480
+ }
1481
+ };
1482
+ },
1483
+ getClientRects: element => Array.from(element.getClientRects()),
1484
+ isRTL: element => getComputedStyle(element).direction === 'rtl'
1485
+ };
1210
1486
 
1211
- if (validMiddleware.filter(_ref => {
1212
- let {
1213
- name
1214
- } = _ref;
1215
- return name === 'autoPlacement' || name === 'flip';
1216
- }).length > 1) {
1217
- throw new Error(['Floating UI: duplicate `flip` and/or `autoPlacement` middleware', 'detected. This will lead to an infinite loop. Ensure only one of', 'either has been passed to the `middleware` array.'].join(' '));
1218
- }
1487
+ /**
1488
+ * Computes the `x` and `y` coordinates that will place the floating element
1489
+ * next to a reference element when it is given a certain CSS positioning
1490
+ * strategy.
1491
+ */
1219
1492
 
1220
- if (!reference || !floating) {
1221
- console.error(['Floating UI: The reference and/or floating element was not defined', 'when `computePosition()` was called. Ensure that both elements have', 'been created and can be measured.'].join(' '));
1222
- }
1223
- }
1493
+ const computePosition = (reference, floating, options) => computePosition$1(reference, floating, {
1494
+ platform,
1495
+ ...options
1496
+ });
1224
1497
 
1225
- let rects = await platform.getElementRects({
1226
- reference,
1227
- floating,
1228
- strategy
1229
- });
1230
- let {
1231
- x,
1232
- y
1233
- } = computeCoordsFromPlacement(rects, placement, rtl);
1234
- let statefulPlacement = placement;
1235
- let middlewareData = {};
1236
- let resetCount = 0;
1498
+ var jsxRuntime = {exports: {}};
1237
1499
 
1238
- for (let i = 0; i < validMiddleware.length; i++) {
1239
- const {
1240
- name,
1241
- fn
1242
- } = validMiddleware[i];
1243
- const {
1244
- x: nextX,
1245
- y: nextY,
1246
- data,
1247
- reset
1248
- } = await fn({
1249
- x,
1250
- y,
1251
- initialPlacement: placement,
1252
- placement: statefulPlacement,
1253
- strategy,
1254
- middlewareData,
1255
- rects,
1256
- platform,
1257
- elements: {
1258
- reference,
1259
- floating
1260
- }
1261
- });
1262
- x = nextX != null ? nextX : x;
1263
- y = nextY != null ? nextY : y;
1264
- middlewareData = { ...middlewareData,
1265
- [name]: { ...middlewareData[name],
1266
- ...data
1267
- }
1268
- };
1500
+ var reactJsxRuntime_development = {};
1269
1501
 
1270
- {
1271
- if (resetCount > 50) {
1272
- console.warn(['Floating UI: The middleware lifecycle appears to be running in an', 'infinite loop. This is usually caused by a `reset` continually', 'being returned without a break condition.'].join(' '));
1273
- }
1274
- }
1502
+ /** @license React v16.14.0
1503
+ * react-jsx-runtime.development.js
1504
+ *
1505
+ * Copyright (c) Facebook, Inc. and its affiliates.
1506
+ *
1507
+ * This source code is licensed under the MIT license found in the
1508
+ * LICENSE file in the root directory of this source tree.
1509
+ */
1275
1510
 
1276
- if (reset && resetCount <= 50) {
1277
- resetCount++;
1511
+ (function (exports) {
1278
1512
 
1279
- if (typeof reset === 'object') {
1280
- if (reset.placement) {
1281
- statefulPlacement = reset.placement;
1282
- }
1513
+ {
1514
+ (function() {
1283
1515
 
1284
- if (reset.rects) {
1285
- rects = reset.rects === true ? await platform.getElementRects({
1286
- reference,
1287
- floating,
1288
- strategy
1289
- }) : reset.rects;
1290
- }
1516
+ var React = require$$0__default["default"];
1291
1517
 
1292
- ({
1293
- x,
1294
- y
1295
- } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
1296
- }
1518
+ // ATTENTION
1519
+ // When adding new symbols to this file,
1520
+ // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
1521
+ // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
1522
+ // nor polyfill, then a plain number is used for performance.
1523
+ var REACT_ELEMENT_TYPE = 0xeac7;
1524
+ var REACT_PORTAL_TYPE = 0xeaca;
1525
+ exports.Fragment = 0xeacb;
1526
+ var REACT_STRICT_MODE_TYPE = 0xeacc;
1527
+ var REACT_PROFILER_TYPE = 0xead2;
1528
+ var REACT_PROVIDER_TYPE = 0xeacd;
1529
+ var REACT_CONTEXT_TYPE = 0xeace;
1530
+ var REACT_FORWARD_REF_TYPE = 0xead0;
1531
+ var REACT_SUSPENSE_TYPE = 0xead1;
1532
+ var REACT_SUSPENSE_LIST_TYPE = 0xead8;
1533
+ var REACT_MEMO_TYPE = 0xead3;
1534
+ var REACT_LAZY_TYPE = 0xead4;
1535
+ var REACT_BLOCK_TYPE = 0xead9;
1536
+ var REACT_SERVER_BLOCK_TYPE = 0xeada;
1537
+ var REACT_FUNDAMENTAL_TYPE = 0xead5;
1538
+ var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1;
1539
+ var REACT_LEGACY_HIDDEN_TYPE = 0xeae3;
1297
1540
 
1298
- i = -1;
1299
- continue;
1300
- }
1301
- }
1541
+ if (typeof Symbol === 'function' && Symbol.for) {
1542
+ var symbolFor = Symbol.for;
1543
+ REACT_ELEMENT_TYPE = symbolFor('react.element');
1544
+ REACT_PORTAL_TYPE = symbolFor('react.portal');
1545
+ exports.Fragment = symbolFor('react.fragment');
1546
+ REACT_STRICT_MODE_TYPE = symbolFor('react.strict_mode');
1547
+ REACT_PROFILER_TYPE = symbolFor('react.profiler');
1548
+ REACT_PROVIDER_TYPE = symbolFor('react.provider');
1549
+ REACT_CONTEXT_TYPE = symbolFor('react.context');
1550
+ REACT_FORWARD_REF_TYPE = symbolFor('react.forward_ref');
1551
+ REACT_SUSPENSE_TYPE = symbolFor('react.suspense');
1552
+ REACT_SUSPENSE_LIST_TYPE = symbolFor('react.suspense_list');
1553
+ REACT_MEMO_TYPE = symbolFor('react.memo');
1554
+ REACT_LAZY_TYPE = symbolFor('react.lazy');
1555
+ REACT_BLOCK_TYPE = symbolFor('react.block');
1556
+ REACT_SERVER_BLOCK_TYPE = symbolFor('react.server.block');
1557
+ REACT_FUNDAMENTAL_TYPE = symbolFor('react.fundamental');
1558
+ symbolFor('react.scope');
1559
+ symbolFor('react.opaque.id');
1560
+ REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode');
1561
+ symbolFor('react.offscreen');
1562
+ REACT_LEGACY_HIDDEN_TYPE = symbolFor('react.legacy_hidden');
1563
+ }
1302
1564
 
1303
- return {
1304
- x,
1305
- y,
1306
- placement: statefulPlacement,
1307
- strategy,
1308
- middlewareData
1309
- };
1310
- };
1565
+ var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
1566
+ var FAUX_ITERATOR_SYMBOL = '@@iterator';
1567
+ function getIteratorFn(maybeIterable) {
1568
+ if (maybeIterable === null || typeof maybeIterable !== 'object') {
1569
+ return null;
1570
+ }
1311
1571
 
1312
- function expandPaddingObject(padding) {
1313
- return {
1314
- top: 0,
1315
- right: 0,
1316
- bottom: 0,
1317
- left: 0,
1318
- ...padding
1319
- };
1320
- }
1572
+ var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
1321
1573
 
1322
- function getSideObjectFromPadding(padding) {
1323
- return typeof padding !== 'number' ? expandPaddingObject(padding) : {
1324
- top: padding,
1325
- right: padding,
1326
- bottom: padding,
1327
- left: padding
1328
- };
1329
- }
1574
+ if (typeof maybeIterator === 'function') {
1575
+ return maybeIterator;
1576
+ }
1577
+
1578
+ return null;
1579
+ }
1580
+
1581
+ var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
1582
+
1583
+ function error(format) {
1584
+ {
1585
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
1586
+ args[_key2 - 1] = arguments[_key2];
1587
+ }
1588
+
1589
+ printWarning('error', format, args);
1590
+ }
1591
+ }
1592
+
1593
+ function printWarning(level, format, args) {
1594
+ // When changing this logic, you might want to also
1595
+ // update consoleWithStackDev.www.js as well.
1596
+ {
1597
+ var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
1598
+ var stack = '';
1599
+
1600
+ if (currentlyValidatingElement) {
1601
+ var name = getComponentName(currentlyValidatingElement.type);
1602
+ var owner = currentlyValidatingElement._owner;
1603
+ stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner.type));
1604
+ }
1605
+
1606
+ stack += ReactDebugCurrentFrame.getStackAddendum();
1607
+
1608
+ if (stack !== '') {
1609
+ format += '%s';
1610
+ args = args.concat([stack]);
1611
+ }
1612
+
1613
+ var argsWithFormat = args.map(function (item) {
1614
+ return '' + item;
1615
+ }); // Careful: RN currently depends on this prefix
1616
+
1617
+ argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
1618
+ // breaks IE9: https://github.com/facebook/react/issues/13610
1619
+ // eslint-disable-next-line react-internal/no-production-logging
1620
+
1621
+ Function.prototype.apply.call(console[level], console, argsWithFormat);
1622
+ }
1623
+ }
1624
+
1625
+ // Filter certain DOM attributes (e.g. src, href) if their values are empty strings.
1626
+
1627
+ var enableScopeAPI = false; // Experimental Create Event Handle API.
1628
+
1629
+ function isValidElementType(type) {
1630
+ if (typeof type === 'string' || typeof type === 'function') {
1631
+ return true;
1632
+ } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
1633
+
1634
+
1635
+ if (type === exports.Fragment || type === REACT_PROFILER_TYPE || type === REACT_DEBUG_TRACING_MODE_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || type === REACT_LEGACY_HIDDEN_TYPE || enableScopeAPI ) {
1636
+ return true;
1637
+ }
1638
+
1639
+ if (typeof type === 'object' && type !== null) {
1640
+ if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_BLOCK_TYPE || type[0] === REACT_SERVER_BLOCK_TYPE) {
1641
+ return true;
1642
+ }
1643
+ }
1644
+
1645
+ return false;
1646
+ }
1647
+
1648
+
1649
+ var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
1650
+ function describeComponentFrame (name, source, ownerName) {
1651
+ var sourceInfo = '';
1652
+
1653
+ if (source) {
1654
+ var path = source.fileName;
1655
+ var fileName = path.replace(BEFORE_SLASH_RE, '');
1656
+
1657
+ {
1658
+ // In DEV, include code for a common special case:
1659
+ // prefer "folder/index.js" instead of just "index.js".
1660
+ if (/^index\./.test(fileName)) {
1661
+ var match = path.match(BEFORE_SLASH_RE);
1662
+
1663
+ if (match) {
1664
+ var pathBeforeSlash = match[1];
1665
+
1666
+ if (pathBeforeSlash) {
1667
+ var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
1668
+ fileName = folderName + '/' + fileName;
1669
+ }
1670
+ }
1671
+ }
1672
+ }
1673
+
1674
+ sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
1675
+ } else if (ownerName) {
1676
+ sourceInfo = ' (created by ' + ownerName + ')';
1677
+ }
1678
+
1679
+ return '\n in ' + (name || 'Unknown') + sourceInfo;
1680
+ }
1681
+
1682
+ var Resolved = 1;
1683
+ function refineResolvedLazyComponent(lazyComponent) {
1684
+ return lazyComponent._status === Resolved ? lazyComponent._result : null;
1685
+ }
1686
+
1687
+ function getWrappedName(outerType, innerType, wrapperName) {
1688
+ var functionName = innerType.displayName || innerType.name || '';
1689
+ return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
1690
+ }
1691
+
1692
+ function getComponentName(type) {
1693
+ if (type == null) {
1694
+ // Host root, text node or just invalid type.
1695
+ return null;
1696
+ }
1697
+
1698
+ {
1699
+ if (typeof type.tag === 'number') {
1700
+ error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
1701
+ }
1702
+ }
1703
+
1704
+ if (typeof type === 'function') {
1705
+ return type.displayName || type.name || null;
1706
+ }
1707
+
1708
+ if (typeof type === 'string') {
1709
+ return type;
1710
+ }
1711
+
1712
+ switch (type) {
1713
+ case exports.Fragment:
1714
+ return 'Fragment';
1715
+
1716
+ case REACT_PORTAL_TYPE:
1717
+ return 'Portal';
1718
+
1719
+ case REACT_PROFILER_TYPE:
1720
+ return "Profiler";
1721
+
1722
+ case REACT_STRICT_MODE_TYPE:
1723
+ return 'StrictMode';
1724
+
1725
+ case REACT_SUSPENSE_TYPE:
1726
+ return 'Suspense';
1727
+
1728
+ case REACT_SUSPENSE_LIST_TYPE:
1729
+ return 'SuspenseList';
1730
+ }
1731
+
1732
+ if (typeof type === 'object') {
1733
+ switch (type.$$typeof) {
1734
+ case REACT_CONTEXT_TYPE:
1735
+ return 'Context.Consumer';
1736
+
1737
+ case REACT_PROVIDER_TYPE:
1738
+ return 'Context.Provider';
1739
+
1740
+ case REACT_FORWARD_REF_TYPE:
1741
+ return getWrappedName(type, type.render, 'ForwardRef');
1742
+
1743
+ case REACT_MEMO_TYPE:
1744
+ return getComponentName(type.type);
1330
1745
 
1331
- function rectToClientRect(rect) {
1332
- return { ...rect,
1333
- top: rect.y,
1334
- left: rect.x,
1335
- right: rect.x + rect.width,
1336
- bottom: rect.y + rect.height
1337
- };
1338
- }
1746
+ case REACT_BLOCK_TYPE:
1747
+ return getComponentName(type.render);
1339
1748
 
1340
- /**
1341
- * Resolves with an object of overflow side offsets that determine how much the
1342
- * element is overflowing a given clipping boundary.
1343
- * - positive = overflowing the boundary by that number of pixels
1344
- * - negative = how many pixels left before it will overflow
1345
- * - 0 = lies flush with the boundary
1346
- * @see https://floating-ui.com/docs/detectOverflow
1347
- */
1348
- async function detectOverflow(middlewareArguments, options) {
1349
- var _await$platform$isEle;
1749
+ case REACT_LAZY_TYPE:
1750
+ {
1751
+ var thenable = type;
1752
+ var resolvedThenable = refineResolvedLazyComponent(thenable);
1350
1753
 
1351
- if (options === void 0) {
1352
- options = {};
1353
- }
1754
+ if (resolvedThenable) {
1755
+ return getComponentName(resolvedThenable);
1756
+ }
1354
1757
 
1355
- const {
1356
- x,
1357
- y,
1358
- platform,
1359
- rects,
1360
- elements,
1361
- strategy
1362
- } = middlewareArguments;
1363
- const {
1364
- boundary = 'clippingAncestors',
1365
- rootBoundary = 'viewport',
1366
- elementContext = 'floating',
1367
- altBoundary = false,
1368
- padding = 0
1369
- } = options;
1370
- const paddingObject = getSideObjectFromPadding(padding);
1371
- const altContext = elementContext === 'floating' ? 'reference' : 'floating';
1372
- const element = elements[altBoundary ? altContext : elementContext];
1373
- const clippingClientRect = rectToClientRect(await platform.getClippingRect({
1374
- 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))),
1375
- boundary,
1376
- rootBoundary,
1377
- strategy
1378
- }));
1379
- const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
1380
- rect: elementContext === 'floating' ? { ...rects.floating,
1381
- x,
1382
- y
1383
- } : rects.reference,
1384
- offsetParent: await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating)),
1385
- strategy
1386
- }) : rects[elementContext]);
1387
- return {
1388
- top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
1389
- bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
1390
- left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
1391
- right: elementClientRect.right - clippingClientRect.right + paddingObject.right
1392
- };
1393
- }
1758
+ break;
1759
+ }
1760
+ }
1761
+ }
1394
1762
 
1395
- const min$1 = Math.min;
1396
- const max$1 = Math.max;
1763
+ return null;
1764
+ }
1397
1765
 
1398
- function within(min$1$1, value, max$1$1) {
1399
- return max$1(min$1$1, min$1(value, max$1$1));
1400
- }
1766
+ var loggedTypeFailures = {};
1767
+ ReactSharedInternals.ReactDebugCurrentFrame;
1768
+ var currentlyValidatingElement = null;
1401
1769
 
1402
- /**
1403
- * Positions an inner element of the floating element such that it is centered
1404
- * to the reference element.
1405
- * @see https://floating-ui.com/docs/arrow
1406
- */
1407
- const arrow = options => ({
1408
- name: 'arrow',
1409
- options,
1770
+ function setCurrentlyValidatingElement(element) {
1771
+ {
1772
+ currentlyValidatingElement = element;
1773
+ }
1774
+ }
1410
1775
 
1411
- async fn(middlewareArguments) {
1412
- // Since `element` is required, we don't Partial<> the type
1413
- const {
1414
- element,
1415
- padding = 0
1416
- } = options != null ? options : {};
1417
- const {
1418
- x,
1419
- y,
1420
- placement,
1421
- rects,
1422
- platform
1423
- } = middlewareArguments;
1776
+ function checkPropTypes(typeSpecs, values, location, componentName, element) {
1777
+ {
1778
+ // $FlowFixMe This is okay but Flow doesn't know it.
1779
+ var has = Function.call.bind(Object.prototype.hasOwnProperty);
1424
1780
 
1425
- if (element == null) {
1426
- {
1427
- console.warn('Floating UI: No `element` was passed to the `arrow` middleware.');
1428
- }
1781
+ for (var typeSpecName in typeSpecs) {
1782
+ if (has(typeSpecs, typeSpecName)) {
1783
+ var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
1784
+ // fail the render phase where it didn't fail before. So we log it.
1785
+ // After these have been cleaned up, we'll let them throw.
1429
1786
 
1430
- return {};
1431
- }
1787
+ try {
1788
+ // This is intentionally an invariant that gets caught. It's the same
1789
+ // behavior as without this statement except with a better message.
1790
+ if (typeof typeSpecs[typeSpecName] !== 'function') {
1791
+ var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');
1792
+ err.name = 'Invariant Violation';
1793
+ throw err;
1794
+ }
1432
1795
 
1433
- const paddingObject = getSideObjectFromPadding(padding);
1434
- const coords = {
1435
- x,
1436
- y
1437
- };
1438
- const axis = getMainAxisFromPlacement(placement);
1439
- const alignment = getAlignment(placement);
1440
- const length = getLengthFromAxis(axis);
1441
- const arrowDimensions = await platform.getDimensions(element);
1442
- const minProp = axis === 'y' ? 'top' : 'left';
1443
- const maxProp = axis === 'y' ? 'bottom' : 'right';
1444
- const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
1445
- const startDiff = coords[axis] - rects.reference[axis];
1446
- const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
1447
- let clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
1796
+ error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
1797
+ } catch (ex) {
1798
+ error$1 = ex;
1799
+ }
1448
1800
 
1449
- if (clientSize === 0) {
1450
- clientSize = rects.floating[length];
1451
- }
1801
+ if (error$1 && !(error$1 instanceof Error)) {
1802
+ setCurrentlyValidatingElement(element);
1452
1803
 
1453
- const centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the floating element if the center
1454
- // point is outside the floating element's bounds
1804
+ error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1);
1455
1805
 
1456
- const min = paddingObject[minProp];
1457
- const max = clientSize - arrowDimensions[length] - paddingObject[maxProp];
1458
- const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
1459
- const offset = within(min, center, max); // Make sure that arrow points at the reference
1806
+ setCurrentlyValidatingElement(null);
1807
+ }
1460
1808
 
1461
- const alignmentPadding = alignment === 'start' ? paddingObject[minProp] : paddingObject[maxProp];
1462
- const shouldAddOffset = alignmentPadding > 0 && center !== offset && rects.reference[length] <= rects.floating[length];
1463
- const alignmentOffset = shouldAddOffset ? center < min ? min - center : max - center : 0;
1464
- return {
1465
- [axis]: coords[axis] - alignmentOffset,
1466
- data: {
1467
- [axis]: offset,
1468
- centerOffset: center - offset
1469
- }
1470
- };
1471
- }
1809
+ if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
1810
+ // Only monitor this failure once because there tends to be a lot of the
1811
+ // same error.
1812
+ loggedTypeFailures[error$1.message] = true;
1813
+ setCurrentlyValidatingElement(element);
1472
1814
 
1473
- });
1815
+ error('Failed %s type: %s', location, error$1.message);
1474
1816
 
1475
- const hash$1 = {
1476
- left: 'right',
1477
- right: 'left',
1478
- bottom: 'top',
1479
- top: 'bottom'
1480
- };
1481
- function getOppositePlacement(placement) {
1482
- return placement.replace(/left|right|bottom|top/g, matched => hash$1[matched]);
1483
- }
1817
+ setCurrentlyValidatingElement(null);
1818
+ }
1819
+ }
1820
+ }
1821
+ }
1822
+ }
1484
1823
 
1485
- function getAlignmentSides(placement, rects, rtl) {
1486
- if (rtl === void 0) {
1487
- rtl = false;
1488
- }
1824
+ var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
1825
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
1826
+ var RESERVED_PROPS = {
1827
+ key: true,
1828
+ ref: true,
1829
+ __self: true,
1830
+ __source: true
1831
+ };
1832
+ var specialPropKeyWarningShown;
1833
+ var specialPropRefWarningShown;
1834
+ var didWarnAboutStringRefs;
1489
1835
 
1490
- const alignment = getAlignment(placement);
1491
- const mainAxis = getMainAxisFromPlacement(placement);
1492
- const length = getLengthFromAxis(mainAxis);
1493
- let mainAlignmentSide = mainAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
1836
+ {
1837
+ didWarnAboutStringRefs = {};
1838
+ }
1494
1839
 
1495
- if (rects.reference[length] > rects.floating[length]) {
1496
- mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
1497
- }
1840
+ function hasValidRef(config) {
1841
+ {
1842
+ if (hasOwnProperty.call(config, 'ref')) {
1843
+ var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
1498
1844
 
1499
- return {
1500
- main: mainAlignmentSide,
1501
- cross: getOppositePlacement(mainAlignmentSide)
1502
- };
1503
- }
1845
+ if (getter && getter.isReactWarning) {
1846
+ return false;
1847
+ }
1848
+ }
1849
+ }
1504
1850
 
1505
- const hash = {
1506
- start: 'end',
1507
- end: 'start'
1508
- };
1509
- function getOppositeAlignmentPlacement(placement) {
1510
- return placement.replace(/start|end/g, matched => hash[matched]);
1511
- }
1851
+ return config.ref !== undefined;
1852
+ }
1512
1853
 
1513
- function getExpandedPlacements(placement) {
1514
- const oppositePlacement = getOppositePlacement(placement);
1515
- return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
1516
- }
1854
+ function hasValidKey(config) {
1855
+ {
1856
+ if (hasOwnProperty.call(config, 'key')) {
1857
+ var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
1858
+
1859
+ if (getter && getter.isReactWarning) {
1860
+ return false;
1861
+ }
1862
+ }
1863
+ }
1517
1864
 
1518
- /**
1519
- * Changes the placement of the floating element to one that will fit if the
1520
- * initially specified `placement` does not.
1521
- * @see https://floating-ui.com/docs/flip
1522
- */
1523
- const flip = function (options) {
1524
- if (options === void 0) {
1525
- options = {};
1526
- }
1865
+ return config.key !== undefined;
1866
+ }
1527
1867
 
1528
- return {
1529
- name: 'flip',
1530
- options,
1868
+ function warnIfStringRefCannotBeAutoConverted(config, self) {
1869
+ {
1870
+ if (typeof config.ref === 'string' && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) {
1871
+ var componentName = getComponentName(ReactCurrentOwner.current.type);
1531
1872
 
1532
- async fn(middlewareArguments) {
1533
- var _middlewareData$flip;
1873
+ if (!didWarnAboutStringRefs[componentName]) {
1874
+ error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', getComponentName(ReactCurrentOwner.current.type), config.ref);
1534
1875
 
1535
- const {
1536
- placement,
1537
- middlewareData,
1538
- rects,
1539
- initialPlacement,
1540
- platform,
1541
- elements
1542
- } = middlewareArguments;
1543
- const {
1544
- mainAxis: checkMainAxis = true,
1545
- crossAxis: checkCrossAxis = true,
1546
- fallbackPlacements: specifiedFallbackPlacements,
1547
- fallbackStrategy = 'bestFit',
1548
- flipAlignment = true,
1549
- ...detectOverflowOptions
1550
- } = options;
1551
- const side = getSide(placement);
1552
- const isBasePlacement = side === initialPlacement;
1553
- const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
1554
- const placements = [initialPlacement, ...fallbackPlacements];
1555
- const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
1556
- const overflows = [];
1557
- let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
1876
+ didWarnAboutStringRefs[componentName] = true;
1877
+ }
1878
+ }
1879
+ }
1880
+ }
1558
1881
 
1559
- if (checkMainAxis) {
1560
- overflows.push(overflow[side]);
1561
- }
1882
+ function defineKeyPropWarningGetter(props, displayName) {
1883
+ {
1884
+ var warnAboutAccessingKey = function () {
1885
+ if (!specialPropKeyWarningShown) {
1886
+ specialPropKeyWarningShown = true;
1562
1887
 
1563
- if (checkCrossAxis) {
1564
- const {
1565
- main,
1566
- cross
1567
- } = getAlignmentSides(placement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
1568
- overflows.push(overflow[main], overflow[cross]);
1569
- }
1888
+ error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
1889
+ }
1890
+ };
1570
1891
 
1571
- overflowsData = [...overflowsData, {
1572
- placement,
1573
- overflows
1574
- }]; // One or more sides is overflowing
1892
+ warnAboutAccessingKey.isReactWarning = true;
1893
+ Object.defineProperty(props, 'key', {
1894
+ get: warnAboutAccessingKey,
1895
+ configurable: true
1896
+ });
1897
+ }
1898
+ }
1575
1899
 
1576
- if (!overflows.every(side => side <= 0)) {
1577
- var _middlewareData$flip$, _middlewareData$flip2;
1900
+ function defineRefPropWarningGetter(props, displayName) {
1901
+ {
1902
+ var warnAboutAccessingRef = function () {
1903
+ if (!specialPropRefWarningShown) {
1904
+ specialPropRefWarningShown = true;
1578
1905
 
1579
- const nextIndex = ((_middlewareData$flip$ = (_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) != null ? _middlewareData$flip$ : 0) + 1;
1580
- const nextPlacement = placements[nextIndex];
1906
+ error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
1907
+ }
1908
+ };
1581
1909
 
1582
- if (nextPlacement) {
1583
- // Try next placement and re-run the lifecycle
1584
- return {
1585
- data: {
1586
- index: nextIndex,
1587
- overflows: overflowsData
1588
- },
1589
- reset: {
1590
- placement: nextPlacement
1591
- }
1592
- };
1593
- }
1910
+ warnAboutAccessingRef.isReactWarning = true;
1911
+ Object.defineProperty(props, 'ref', {
1912
+ get: warnAboutAccessingRef,
1913
+ configurable: true
1914
+ });
1915
+ }
1916
+ }
1917
+ /**
1918
+ * Factory method to create a new React element. This no longer adheres to
1919
+ * the class pattern, so do not use new to call it. Also, instanceof check
1920
+ * will not work. Instead test $$typeof field against Symbol.for('react.element') to check
1921
+ * if something is a React Element.
1922
+ *
1923
+ * @param {*} type
1924
+ * @param {*} props
1925
+ * @param {*} key
1926
+ * @param {string|object} ref
1927
+ * @param {*} owner
1928
+ * @param {*} self A *temporary* helper to detect places where `this` is
1929
+ * different from the `owner` when React.createElement is called, so that we
1930
+ * can warn. We want to get rid of owner and replace string `ref`s with arrow
1931
+ * functions, and as long as `this` and owner are the same, there will be no
1932
+ * change in behavior.
1933
+ * @param {*} source An annotation object (added by a transpiler or otherwise)
1934
+ * indicating filename, line number, and/or other information.
1935
+ * @internal
1936
+ */
1594
1937
 
1595
- let resetPlacement = 'bottom';
1596
1938
 
1597
- switch (fallbackStrategy) {
1598
- case 'bestFit':
1599
- {
1600
- var _overflowsData$map$so;
1939
+ var ReactElement = function (type, key, ref, self, source, owner, props) {
1940
+ var element = {
1941
+ // This tag allows us to uniquely identify this as a React Element
1942
+ $$typeof: REACT_ELEMENT_TYPE,
1943
+ // Built-in properties that belong on the element
1944
+ type: type,
1945
+ key: key,
1946
+ ref: ref,
1947
+ props: props,
1948
+ // Record the component responsible for creating this element.
1949
+ _owner: owner
1950
+ };
1601
1951
 
1602
- const placement = (_overflowsData$map$so = overflowsData.map(d => [d, 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].placement;
1952
+ {
1953
+ // The validation flag is currently mutative. We put it on
1954
+ // an external backing store so that we can freeze the whole object.
1955
+ // This can be replaced with a WeakMap once they are implemented in
1956
+ // commonly used development environments.
1957
+ element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
1958
+ // the validation flag non-enumerable (where possible, which should
1959
+ // include every environment we run tests in), so the test framework
1960
+ // ignores it.
1603
1961
 
1604
- if (placement) {
1605
- resetPlacement = placement;
1606
- }
1962
+ Object.defineProperty(element._store, 'validated', {
1963
+ configurable: false,
1964
+ enumerable: false,
1965
+ writable: true,
1966
+ value: false
1967
+ }); // self and source are DEV only properties.
1607
1968
 
1608
- break;
1609
- }
1969
+ Object.defineProperty(element, '_self', {
1970
+ configurable: false,
1971
+ enumerable: false,
1972
+ writable: false,
1973
+ value: self
1974
+ }); // Two elements created in two different places should be considered
1975
+ // equal for testing purposes and therefore we hide it from enumeration.
1610
1976
 
1611
- case 'initialPlacement':
1612
- resetPlacement = initialPlacement;
1613
- break;
1614
- }
1977
+ Object.defineProperty(element, '_source', {
1978
+ configurable: false,
1979
+ enumerable: false,
1980
+ writable: false,
1981
+ value: source
1982
+ });
1615
1983
 
1616
- if (placement !== resetPlacement) {
1617
- return {
1618
- reset: {
1619
- placement: resetPlacement
1620
- }
1621
- };
1622
- }
1623
- }
1984
+ if (Object.freeze) {
1985
+ Object.freeze(element.props);
1986
+ Object.freeze(element);
1987
+ }
1988
+ }
1624
1989
 
1625
- return {};
1626
- }
1990
+ return element;
1991
+ };
1992
+ /**
1993
+ * https://github.com/reactjs/rfcs/pull/107
1994
+ * @param {*} type
1995
+ * @param {object} props
1996
+ * @param {string} key
1997
+ */
1627
1998
 
1628
- };
1629
- };
1999
+ function jsxDEV(type, config, maybeKey, source, self) {
2000
+ {
2001
+ var propName; // Reserved names are extracted
1630
2002
 
1631
- async function convertValueToCoords(middlewareArguments, value) {
1632
- const {
1633
- placement,
1634
- platform,
1635
- elements
1636
- } = middlewareArguments;
1637
- const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
1638
- const side = getSide(placement);
1639
- const alignment = getAlignment(placement);
1640
- const isVertical = getMainAxisFromPlacement(placement) === 'x';
1641
- const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
1642
- const crossAxisMulti = rtl && isVertical ? -1 : 1;
1643
- const rawValue = typeof value === 'function' ? value(middlewareArguments) : value; // eslint-disable-next-line prefer-const
2003
+ var props = {};
2004
+ var key = null;
2005
+ var ref = null; // Currently, key can be spread in as a prop. This causes a potential
2006
+ // issue if key is also explicitly declared (ie. <div {...props} key="Hi" />
2007
+ // or <div key="Hi" {...props} /> ). We want to deprecate key spread,
2008
+ // but as an intermediary step, we will use jsxDEV for everything except
2009
+ // <div {...props} key="Hi" />, because we aren't currently able to tell if
2010
+ // key is explicitly declared to be undefined or not.
1644
2011
 
1645
- let {
1646
- mainAxis,
1647
- crossAxis,
1648
- alignmentAxis
1649
- } = typeof rawValue === 'number' ? {
1650
- mainAxis: rawValue,
1651
- crossAxis: 0,
1652
- alignmentAxis: null
1653
- } : {
1654
- mainAxis: 0,
1655
- crossAxis: 0,
1656
- alignmentAxis: null,
1657
- ...rawValue
1658
- };
2012
+ if (maybeKey !== undefined) {
2013
+ key = '' + maybeKey;
2014
+ }
1659
2015
 
1660
- if (alignment && typeof alignmentAxis === 'number') {
1661
- crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
1662
- }
2016
+ if (hasValidKey(config)) {
2017
+ key = '' + config.key;
2018
+ }
1663
2019
 
1664
- return isVertical ? {
1665
- x: crossAxis * crossAxisMulti,
1666
- y: mainAxis * mainAxisMulti
1667
- } : {
1668
- x: mainAxis * mainAxisMulti,
1669
- y: crossAxis * crossAxisMulti
1670
- };
1671
- }
1672
- /**
1673
- * Displaces the floating element from its reference element.
1674
- * @see https://floating-ui.com/docs/offset
1675
- */
2020
+ if (hasValidRef(config)) {
2021
+ ref = config.ref;
2022
+ warnIfStringRefCannotBeAutoConverted(config, self);
2023
+ } // Remaining properties are added to a new props object
1676
2024
 
1677
- const offset = function (value) {
1678
- if (value === void 0) {
1679
- value = 0;
1680
- }
1681
2025
 
1682
- return {
1683
- name: 'offset',
1684
- options: value,
2026
+ for (propName in config) {
2027
+ if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
2028
+ props[propName] = config[propName];
2029
+ }
2030
+ } // Resolve default props
1685
2031
 
1686
- async fn(middlewareArguments) {
1687
- const {
1688
- x,
1689
- y
1690
- } = middlewareArguments;
1691
- const diffCoords = await convertValueToCoords(middlewareArguments, value);
1692
- return {
1693
- x: x + diffCoords.x,
1694
- y: y + diffCoords.y,
1695
- data: diffCoords
1696
- };
1697
- }
1698
2032
 
1699
- };
1700
- };
2033
+ if (type && type.defaultProps) {
2034
+ var defaultProps = type.defaultProps;
1701
2035
 
1702
- function getCrossAxis(axis) {
1703
- return axis === 'x' ? 'y' : 'x';
1704
- }
2036
+ for (propName in defaultProps) {
2037
+ if (props[propName] === undefined) {
2038
+ props[propName] = defaultProps[propName];
2039
+ }
2040
+ }
2041
+ }
1705
2042
 
1706
- /**
1707
- * Shifts the floating element in order to keep it in view when it will overflow
1708
- * a clipping boundary.
1709
- * @see https://floating-ui.com/docs/shift
1710
- */
1711
- const shift = function (options) {
1712
- if (options === void 0) {
1713
- options = {};
1714
- }
2043
+ if (key || ref) {
2044
+ var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
1715
2045
 
1716
- return {
1717
- name: 'shift',
1718
- options,
2046
+ if (key) {
2047
+ defineKeyPropWarningGetter(props, displayName);
2048
+ }
1719
2049
 
1720
- async fn(middlewareArguments) {
1721
- const {
1722
- x,
1723
- y,
1724
- placement
1725
- } = middlewareArguments;
1726
- const {
1727
- mainAxis: checkMainAxis = true,
1728
- crossAxis: checkCrossAxis = false,
1729
- limiter = {
1730
- fn: _ref => {
1731
- let {
1732
- x,
1733
- y
1734
- } = _ref;
1735
- return {
1736
- x,
1737
- y
1738
- };
1739
- }
1740
- },
1741
- ...detectOverflowOptions
1742
- } = options;
1743
- const coords = {
1744
- x,
1745
- y
1746
- };
1747
- const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
1748
- const mainAxis = getMainAxisFromPlacement(getSide(placement));
1749
- const crossAxis = getCrossAxis(mainAxis);
1750
- let mainAxisCoord = coords[mainAxis];
1751
- let crossAxisCoord = coords[crossAxis];
2050
+ if (ref) {
2051
+ defineRefPropWarningGetter(props, displayName);
2052
+ }
2053
+ }
1752
2054
 
1753
- if (checkMainAxis) {
1754
- const minSide = mainAxis === 'y' ? 'top' : 'left';
1755
- const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
1756
- const min = mainAxisCoord + overflow[minSide];
1757
- const max = mainAxisCoord - overflow[maxSide];
1758
- mainAxisCoord = within(min, mainAxisCoord, max);
1759
- }
2055
+ return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
2056
+ }
2057
+ }
1760
2058
 
1761
- if (checkCrossAxis) {
1762
- const minSide = crossAxis === 'y' ? 'top' : 'left';
1763
- const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
1764
- const min = crossAxisCoord + overflow[minSide];
1765
- const max = crossAxisCoord - overflow[maxSide];
1766
- crossAxisCoord = within(min, crossAxisCoord, max);
1767
- }
2059
+ var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
2060
+ ReactSharedInternals.ReactDebugCurrentFrame;
1768
2061
 
1769
- const limitedCoords = limiter.fn({ ...middlewareArguments,
1770
- [mainAxis]: mainAxisCoord,
1771
- [crossAxis]: crossAxisCoord
1772
- });
1773
- return { ...limitedCoords,
1774
- data: {
1775
- x: limitedCoords.x - x,
1776
- y: limitedCoords.y - y
1777
- }
1778
- };
1779
- }
2062
+ function setCurrentlyValidatingElement$1(element) {
2063
+ currentlyValidatingElement = element;
2064
+ }
1780
2065
 
1781
- };
1782
- };
2066
+ var propTypesMisspellWarningShown;
1783
2067
 
1784
- function isWindow(value) {
1785
- return value && value.document && value.location && value.alert && value.setInterval;
1786
- }
1787
- function getWindow(node) {
1788
- if (node == null) {
1789
- return window;
1790
- }
2068
+ {
2069
+ propTypesMisspellWarningShown = false;
2070
+ }
2071
+ /**
2072
+ * Verifies the object is a ReactElement.
2073
+ * See https://reactjs.org/docs/react-api.html#isvalidelement
2074
+ * @param {?object} object
2075
+ * @return {boolean} True if `object` is a ReactElement.
2076
+ * @final
2077
+ */
1791
2078
 
1792
- if (!isWindow(node)) {
1793
- const ownerDocument = node.ownerDocument;
1794
- return ownerDocument ? ownerDocument.defaultView || window : window;
1795
- }
2079
+ function isValidElement(object) {
2080
+ {
2081
+ return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
2082
+ }
2083
+ }
1796
2084
 
1797
- return node;
1798
- }
2085
+ function getDeclarationErrorAddendum() {
2086
+ {
2087
+ if (ReactCurrentOwner$1.current) {
2088
+ var name = getComponentName(ReactCurrentOwner$1.current.type);
1799
2089
 
1800
- function getComputedStyle(element) {
1801
- return getWindow(element).getComputedStyle(element);
1802
- }
2090
+ if (name) {
2091
+ return '\n\nCheck the render method of `' + name + '`.';
2092
+ }
2093
+ }
1803
2094
 
1804
- function getNodeName(node) {
1805
- return isWindow(node) ? '' : node ? (node.nodeName || '').toLowerCase() : '';
1806
- }
2095
+ return '';
2096
+ }
2097
+ }
1807
2098
 
1808
- function getUAString() {
1809
- const uaData = navigator.userAgentData;
2099
+ function getSourceInfoErrorAddendum(source) {
2100
+ {
2101
+ if (source !== undefined) {
2102
+ var fileName = source.fileName.replace(/^.*[\\\/]/, '');
2103
+ var lineNumber = source.lineNumber;
2104
+ return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
2105
+ }
1810
2106
 
1811
- if (uaData != null && uaData.brands) {
1812
- return uaData.brands.map(item => item.brand + "/" + item.version).join(' ');
1813
- }
2107
+ return '';
2108
+ }
2109
+ }
2110
+ /**
2111
+ * Warn if there's no key explicitly set on dynamic arrays of children or
2112
+ * object keys are not valid. This allows us to keep track of children between
2113
+ * updates.
2114
+ */
1814
2115
 
1815
- return navigator.userAgent;
1816
- }
1817
2116
 
1818
- function isHTMLElement(value) {
1819
- return value instanceof getWindow(value).HTMLElement;
1820
- }
1821
- function isElement(value) {
1822
- return value instanceof getWindow(value).Element;
1823
- }
1824
- function isNode(value) {
1825
- return value instanceof getWindow(value).Node;
1826
- }
1827
- function isShadowRoot(node) {
1828
- // Browsers without `ShadowRoot` support
1829
- if (typeof ShadowRoot === 'undefined') {
1830
- return false;
1831
- }
2117
+ var ownerHasKeyUseWarning = {};
1832
2118
 
1833
- const OwnElement = getWindow(node).ShadowRoot;
1834
- return node instanceof OwnElement || node instanceof ShadowRoot;
1835
- }
1836
- function isOverflowElement(element) {
1837
- // Firefox wants us to check `-x` and `-y` variations as well
1838
- const {
1839
- overflow,
1840
- overflowX,
1841
- overflowY,
1842
- display
1843
- } = getComputedStyle(element);
1844
- return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
1845
- }
1846
- function isTableElement(element) {
1847
- return ['table', 'td', 'th'].includes(getNodeName(element));
1848
- }
1849
- function isContainingBlock(element) {
1850
- // TODO: Try and use feature detection here instead
1851
- const isFirefox = /firefox/i.test(getUAString());
1852
- const css = getComputedStyle(element);
1853
- const backdropFilter = css.backdropFilter || css.WebkitBackdropFilter; // This is non-exhaustive but covers the most common CSS properties that
1854
- // create a containing block.
1855
- // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
2119
+ function getCurrentComponentErrorInfo(parentType) {
2120
+ {
2121
+ var info = getDeclarationErrorAddendum();
1856
2122
 
1857
- return css.transform !== 'none' || css.perspective !== 'none' || (backdropFilter ? backdropFilter !== 'none' : false) || isFirefox && css.willChange === 'filter' || isFirefox && (css.filter ? css.filter !== 'none' : false) || ['transform', 'perspective'].some(value => css.willChange.includes(value)) || ['paint', 'layout', 'strict', 'content'].some( // TS 4.1 compat
1858
- value => {
1859
- const contain = css.contain;
1860
- return contain != null ? contain.includes(value) : false;
1861
- });
1862
- }
1863
- function isLayoutViewport() {
1864
- // Not Safari
1865
- return !/^((?!chrome|android).)*safari/i.test(getUAString()); // Feature detection for this fails in various ways
1866
- // • Always-visible scrollbar or not
1867
- // • Width of <html>, etc.
1868
- // const vV = win.visualViewport;
1869
- // return vV ? Math.abs(win.innerWidth / vV.scale - vV.width) < 0.5 : true;
1870
- }
1871
- function isLastTraversableNode(node) {
1872
- return ['html', 'body', '#document'].includes(getNodeName(node));
1873
- }
2123
+ if (!info) {
2124
+ var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
1874
2125
 
1875
- const min = Math.min;
1876
- const max = Math.max;
1877
- const round = Math.round;
2126
+ if (parentName) {
2127
+ info = "\n\nCheck the top-level render call using <" + parentName + ">.";
2128
+ }
2129
+ }
1878
2130
 
1879
- function getBoundingClientRect(element, includeScale, isFixedStrategy) {
1880
- var _win$visualViewport$o, _win$visualViewport, _win$visualViewport$o2, _win$visualViewport2;
2131
+ return info;
2132
+ }
2133
+ }
2134
+ /**
2135
+ * Warn if the element doesn't have an explicit key assigned to it.
2136
+ * This element is in an array. The array could grow and shrink or be
2137
+ * reordered. All children that haven't already been validated are required to
2138
+ * have a "key" property assigned to it. Error statuses are cached so a warning
2139
+ * will only be shown once.
2140
+ *
2141
+ * @internal
2142
+ * @param {ReactElement} element Element that requires a key.
2143
+ * @param {*} parentType element's parent's type.
2144
+ */
1881
2145
 
1882
- if (includeScale === void 0) {
1883
- includeScale = false;
1884
- }
1885
2146
 
1886
- if (isFixedStrategy === void 0) {
1887
- isFixedStrategy = false;
1888
- }
2147
+ function validateExplicitKey(element, parentType) {
2148
+ {
2149
+ if (!element._store || element._store.validated || element.key != null) {
2150
+ return;
2151
+ }
1889
2152
 
1890
- const clientRect = element.getBoundingClientRect();
1891
- let scaleX = 1;
1892
- let scaleY = 1;
2153
+ element._store.validated = true;
2154
+ var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
1893
2155
 
1894
- if (includeScale && isHTMLElement(element)) {
1895
- scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
1896
- scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
1897
- }
2156
+ if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
2157
+ return;
2158
+ }
1898
2159
 
1899
- const win = isElement(element) ? getWindow(element) : window;
1900
- const addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
1901
- const x = (clientRect.left + (addVisualOffsets ? (_win$visualViewport$o = (_win$visualViewport = win.visualViewport) == null ? void 0 : _win$visualViewport.offsetLeft) != null ? _win$visualViewport$o : 0 : 0)) / scaleX;
1902
- const y = (clientRect.top + (addVisualOffsets ? (_win$visualViewport$o2 = (_win$visualViewport2 = win.visualViewport) == null ? void 0 : _win$visualViewport2.offsetTop) != null ? _win$visualViewport$o2 : 0 : 0)) / scaleY;
1903
- const width = clientRect.width / scaleX;
1904
- const height = clientRect.height / scaleY;
1905
- return {
1906
- width,
1907
- height,
1908
- top: y,
1909
- right: x + width,
1910
- bottom: y + height,
1911
- left: x,
1912
- x,
1913
- y
1914
- };
1915
- }
2160
+ ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
2161
+ // property, it may be the creator of the child that's responsible for
2162
+ // assigning it a key.
1916
2163
 
1917
- function getDocumentElement(node) {
1918
- return ((isNode(node) ? node.ownerDocument : node.document) || window.document).documentElement;
1919
- }
2164
+ var childOwner = '';
1920
2165
 
1921
- function getNodeScroll(element) {
1922
- if (isElement(element)) {
1923
- return {
1924
- scrollLeft: element.scrollLeft,
1925
- scrollTop: element.scrollTop
1926
- };
1927
- }
2166
+ if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
2167
+ // Give the component that originally created this child.
2168
+ childOwner = " It was passed a child from " + getComponentName(element._owner.type) + ".";
2169
+ }
1928
2170
 
1929
- return {
1930
- scrollLeft: element.pageXOffset,
1931
- scrollTop: element.pageYOffset
1932
- };
1933
- }
2171
+ setCurrentlyValidatingElement$1(element);
1934
2172
 
1935
- function getWindowScrollBarX(element) {
1936
- // If <html> has a CSS width greater than the viewport, then this will be
1937
- // incorrect for RTL.
1938
- return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
1939
- }
2173
+ error('Each child in a list should have a unique "key" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);
1940
2174
 
1941
- function isScaled(element) {
1942
- const rect = getBoundingClientRect(element);
1943
- return round(rect.width) !== element.offsetWidth || round(rect.height) !== element.offsetHeight;
1944
- }
2175
+ setCurrentlyValidatingElement$1(null);
2176
+ }
2177
+ }
2178
+ /**
2179
+ * Ensure that every element either is passed in a static location, in an
2180
+ * array with an explicit keys property defined, or in an object literal
2181
+ * with valid key property.
2182
+ *
2183
+ * @internal
2184
+ * @param {ReactNode} node Statically passed child of any type.
2185
+ * @param {*} parentType node's parent's type.
2186
+ */
1945
2187
 
1946
- function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
1947
- const isOffsetParentAnElement = isHTMLElement(offsetParent);
1948
- const documentElement = getDocumentElement(offsetParent);
1949
- const rect = getBoundingClientRect(element, // @ts-ignore - checked above (TS 4.1 compat)
1950
- isOffsetParentAnElement && isScaled(offsetParent), strategy === 'fixed');
1951
- let scroll = {
1952
- scrollLeft: 0,
1953
- scrollTop: 0
1954
- };
1955
- const offsets = {
1956
- x: 0,
1957
- y: 0
1958
- };
1959
2188
 
1960
- if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
1961
- if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
1962
- scroll = getNodeScroll(offsetParent);
1963
- }
2189
+ function validateChildKeys(node, parentType) {
2190
+ {
2191
+ if (typeof node !== 'object') {
2192
+ return;
2193
+ }
1964
2194
 
1965
- if (isHTMLElement(offsetParent)) {
1966
- const offsetRect = getBoundingClientRect(offsetParent, true);
1967
- offsets.x = offsetRect.x + offsetParent.clientLeft;
1968
- offsets.y = offsetRect.y + offsetParent.clientTop;
1969
- } else if (documentElement) {
1970
- offsets.x = getWindowScrollBarX(documentElement);
1971
- }
1972
- }
2195
+ if (Array.isArray(node)) {
2196
+ for (var i = 0; i < node.length; i++) {
2197
+ var child = node[i];
1973
2198
 
1974
- return {
1975
- x: rect.left + scroll.scrollLeft - offsets.x,
1976
- y: rect.top + scroll.scrollTop - offsets.y,
1977
- width: rect.width,
1978
- height: rect.height
1979
- };
1980
- }
2199
+ if (isValidElement(child)) {
2200
+ validateExplicitKey(child, parentType);
2201
+ }
2202
+ }
2203
+ } else if (isValidElement(node)) {
2204
+ // This element was passed in a valid location.
2205
+ if (node._store) {
2206
+ node._store.validated = true;
2207
+ }
2208
+ } else if (node) {
2209
+ var iteratorFn = getIteratorFn(node);
1981
2210
 
1982
- function getParentNode(node) {
1983
- if (getNodeName(node) === 'html') {
1984
- return node;
1985
- }
2211
+ if (typeof iteratorFn === 'function') {
2212
+ // Entry iterators used to provide implicit keys,
2213
+ // but now we print a separate warning for them later.
2214
+ if (iteratorFn !== node.entries) {
2215
+ var iterator = iteratorFn.call(node);
2216
+ var step;
1986
2217
 
1987
- const result = // Step into the shadow DOM of the parent of a slotted node
1988
- node.assignedSlot || // DOM Element detected
1989
- node.parentNode || ( // ShadowRoot detected
1990
- isShadowRoot(node) ? node.host : null) || // Fallback
1991
- getDocumentElement(node);
1992
- return isShadowRoot(result) ? result.host : result;
1993
- }
2218
+ while (!(step = iterator.next()).done) {
2219
+ if (isValidElement(step.value)) {
2220
+ validateExplicitKey(step.value, parentType);
2221
+ }
2222
+ }
2223
+ }
2224
+ }
2225
+ }
2226
+ }
2227
+ }
2228
+ /**
2229
+ * Given an element, validate that its props follow the propTypes definition,
2230
+ * provided by the type.
2231
+ *
2232
+ * @param {ReactElement} element
2233
+ */
1994
2234
 
1995
- function getTrueOffsetParent(element) {
1996
- if (!isHTMLElement(element) || getComputedStyle(element).position === 'fixed') {
1997
- return null;
1998
- }
1999
2235
 
2000
- return element.offsetParent;
2001
- }
2236
+ function validatePropTypes(element) {
2237
+ {
2238
+ var type = element.type;
2002
2239
 
2003
- function getContainingBlock(element) {
2004
- let currentNode = getParentNode(element);
2240
+ if (type === null || type === undefined || typeof type === 'string') {
2241
+ return;
2242
+ }
2005
2243
 
2006
- while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
2007
- if (isContainingBlock(currentNode)) {
2008
- return currentNode;
2009
- } else {
2010
- currentNode = getParentNode(currentNode);
2011
- }
2012
- }
2244
+ var propTypes;
2013
2245
 
2014
- return null;
2015
- } // Gets the closest ancestor positioned element. Handles some edge cases,
2016
- // such as table ancestors and cross browser bugs.
2246
+ if (typeof type === 'function') {
2247
+ propTypes = type.propTypes;
2248
+ } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
2249
+ // Inner props are checked in the reconciler.
2250
+ type.$$typeof === REACT_MEMO_TYPE)) {
2251
+ propTypes = type.propTypes;
2252
+ } else {
2253
+ return;
2254
+ }
2255
+
2256
+ if (propTypes) {
2257
+ // Intentionally inside to avoid triggering lazy initializers:
2258
+ var name = getComponentName(type);
2259
+ checkPropTypes(propTypes, element.props, 'prop', name, element);
2260
+ } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
2261
+ propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
2262
+
2263
+ var _name = getComponentName(type);
2017
2264
 
2265
+ error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
2266
+ }
2018
2267
 
2019
- function getOffsetParent(element) {
2020
- const window = getWindow(element);
2021
- let offsetParent = getTrueOffsetParent(element);
2268
+ if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
2269
+ error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
2270
+ }
2271
+ }
2272
+ }
2273
+ /**
2274
+ * Given a fragment, validate that it can only be provided with fragment props
2275
+ * @param {ReactElement} fragment
2276
+ */
2022
2277
 
2023
- while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {
2024
- offsetParent = getTrueOffsetParent(offsetParent);
2025
- }
2026
2278
 
2027
- if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static' && !isContainingBlock(offsetParent))) {
2028
- return window;
2029
- }
2279
+ function validateFragmentProps(fragment) {
2280
+ {
2281
+ var keys = Object.keys(fragment.props);
2030
2282
 
2031
- return offsetParent || getContainingBlock(element) || window;
2032
- }
2283
+ for (var i = 0; i < keys.length; i++) {
2284
+ var key = keys[i];
2033
2285
 
2034
- function getDimensions(element) {
2035
- if (isHTMLElement(element)) {
2036
- return {
2037
- width: element.offsetWidth,
2038
- height: element.offsetHeight
2039
- };
2040
- }
2286
+ if (key !== 'children' && key !== 'key') {
2287
+ setCurrentlyValidatingElement$1(fragment);
2041
2288
 
2042
- const rect = getBoundingClientRect(element);
2043
- return {
2044
- width: rect.width,
2045
- height: rect.height
2046
- };
2047
- }
2289
+ error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
2048
2290
 
2049
- function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
2050
- let {
2051
- rect,
2052
- offsetParent,
2053
- strategy
2054
- } = _ref;
2055
- const isOffsetParentAnElement = isHTMLElement(offsetParent);
2056
- const documentElement = getDocumentElement(offsetParent);
2291
+ setCurrentlyValidatingElement$1(null);
2292
+ break;
2293
+ }
2294
+ }
2057
2295
 
2058
- if (offsetParent === documentElement) {
2059
- return rect;
2060
- }
2296
+ if (fragment.ref !== null) {
2297
+ setCurrentlyValidatingElement$1(fragment);
2061
2298
 
2062
- let scroll = {
2063
- scrollLeft: 0,
2064
- scrollTop: 0
2065
- };
2066
- const offsets = {
2067
- x: 0,
2068
- y: 0
2069
- };
2299
+ error('Invalid attribute `ref` supplied to `React.Fragment`.');
2070
2300
 
2071
- if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
2072
- if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
2073
- scroll = getNodeScroll(offsetParent);
2074
- }
2301
+ setCurrentlyValidatingElement$1(null);
2302
+ }
2303
+ }
2304
+ }
2075
2305
 
2076
- if (isHTMLElement(offsetParent)) {
2077
- const offsetRect = getBoundingClientRect(offsetParent, true);
2078
- offsets.x = offsetRect.x + offsetParent.clientLeft;
2079
- offsets.y = offsetRect.y + offsetParent.clientTop;
2080
- } // This doesn't appear to be need to be negated.
2081
- // else if (documentElement) {
2082
- // offsets.x = getWindowScrollBarX(documentElement);
2083
- // }
2306
+ function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
2307
+ {
2308
+ var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
2309
+ // succeed and there will likely be errors in render.
2084
2310
 
2085
- }
2311
+ if (!validType) {
2312
+ var info = '';
2086
2313
 
2087
- return { ...rect,
2088
- x: rect.x - scroll.scrollLeft + offsets.x,
2089
- y: rect.y - scroll.scrollTop + offsets.y
2090
- };
2091
- }
2314
+ if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
2315
+ info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports.";
2316
+ }
2092
2317
 
2093
- function getViewportRect(element, strategy) {
2094
- const win = getWindow(element);
2095
- const html = getDocumentElement(element);
2096
- const visualViewport = win.visualViewport;
2097
- let width = html.clientWidth;
2098
- let height = html.clientHeight;
2099
- let x = 0;
2100
- let y = 0;
2318
+ var sourceInfo = getSourceInfoErrorAddendum(source);
2101
2319
 
2102
- if (visualViewport) {
2103
- width = visualViewport.width;
2104
- height = visualViewport.height;
2105
- const layoutViewport = isLayoutViewport();
2320
+ if (sourceInfo) {
2321
+ info += sourceInfo;
2322
+ } else {
2323
+ info += getDeclarationErrorAddendum();
2324
+ }
2106
2325
 
2107
- if (layoutViewport || !layoutViewport && strategy === 'fixed') {
2108
- x = visualViewport.offsetLeft;
2109
- y = visualViewport.offsetTop;
2110
- }
2111
- }
2326
+ var typeString;
2112
2327
 
2113
- return {
2114
- width,
2115
- height,
2116
- x,
2117
- y
2118
- };
2119
- }
2328
+ if (type === null) {
2329
+ typeString = 'null';
2330
+ } else if (Array.isArray(type)) {
2331
+ typeString = 'array';
2332
+ } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
2333
+ typeString = "<" + (getComponentName(type.type) || 'Unknown') + " />";
2334
+ info = ' Did you accidentally export a JSX literal instead of a component?';
2335
+ } else {
2336
+ typeString = typeof type;
2337
+ }
2120
2338
 
2121
- // of the `<html>` and `<body>` rect bounds if horizontally scrollable
2339
+ error('React.jsx: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
2340
+ }
2122
2341
 
2123
- function getDocumentRect(element) {
2124
- var _element$ownerDocumen;
2342
+ var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.
2343
+ // TODO: Drop this when these are no longer allowed as the type argument.
2125
2344
 
2126
- const html = getDocumentElement(element);
2127
- const scroll = getNodeScroll(element);
2128
- const body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
2129
- const width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
2130
- const height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
2131
- let x = -scroll.scrollLeft + getWindowScrollBarX(element);
2132
- const y = -scroll.scrollTop;
2345
+ if (element == null) {
2346
+ return element;
2347
+ } // Skip key warning if the type isn't valid since our key validation logic
2348
+ // doesn't expect a non-string/function type and can throw confusing errors.
2349
+ // We don't want exception behavior to differ between dev and prod.
2350
+ // (Rendering will throw with a helpful message and as soon as the type is
2351
+ // fixed, the key warnings will appear.)
2133
2352
 
2134
- if (getComputedStyle(body || html).direction === 'rtl') {
2135
- x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
2136
- }
2137
2353
 
2138
- return {
2139
- width,
2140
- height,
2141
- x,
2142
- y
2143
- };
2144
- }
2354
+ if (validType) {
2355
+ var children = props.children;
2145
2356
 
2146
- function getNearestOverflowAncestor(node) {
2147
- const parentNode = getParentNode(node);
2357
+ if (children !== undefined) {
2358
+ if (isStaticChildren) {
2359
+ if (Array.isArray(children)) {
2360
+ for (var i = 0; i < children.length; i++) {
2361
+ validateChildKeys(children[i], type);
2362
+ }
2148
2363
 
2149
- if (isLastTraversableNode(parentNode)) {
2150
- // @ts-ignore assume body is always available
2151
- return node.ownerDocument.body;
2152
- }
2364
+ if (Object.freeze) {
2365
+ Object.freeze(children);
2366
+ }
2367
+ } else {
2368
+ error('React.jsx: Static children should always be an array. ' + 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' + 'Use the Babel transform instead.');
2369
+ }
2370
+ } else {
2371
+ validateChildKeys(children, type);
2372
+ }
2373
+ }
2374
+ }
2153
2375
 
2154
- if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
2155
- return parentNode;
2156
- }
2376
+ if (type === exports.Fragment) {
2377
+ validateFragmentProps(element);
2378
+ } else {
2379
+ validatePropTypes(element);
2380
+ }
2157
2381
 
2158
- return getNearestOverflowAncestor(parentNode);
2159
- }
2382
+ return element;
2383
+ }
2384
+ } // These two functions exist to still get child warnings in dev
2385
+ // even with the prod transform. This means that jsxDEV is purely
2386
+ // opt-in behavior for better messages but that we won't stop
2387
+ // giving you warnings if you use production apis.
2160
2388
 
2161
- function getOverflowAncestors(node, list) {
2162
- var _node$ownerDocument;
2389
+ function jsxWithValidationStatic(type, props, key) {
2390
+ {
2391
+ return jsxWithValidation(type, props, key, true);
2392
+ }
2393
+ }
2394
+ function jsxWithValidationDynamic(type, props, key) {
2395
+ {
2396
+ return jsxWithValidation(type, props, key, false);
2397
+ }
2398
+ }
2163
2399
 
2164
- if (list === void 0) {
2165
- list = [];
2166
- }
2400
+ var jsx = jsxWithValidationDynamic ; // we may want to special case jsxs internally to take advantage of static children.
2401
+ // for now we can ship identical prod functions
2167
2402
 
2168
- const scrollableAncestor = getNearestOverflowAncestor(node);
2169
- const isBody = scrollableAncestor === ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.body);
2170
- const win = getWindow(scrollableAncestor);
2171
- const target = isBody ? [win].concat(win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : []) : scrollableAncestor;
2172
- const updatedList = list.concat(target);
2173
- return isBody ? updatedList : // @ts-ignore: isBody tells us target will be an HTMLElement here
2174
- updatedList.concat(getOverflowAncestors(target));
2175
- }
2403
+ var jsxs = jsxWithValidationStatic ;
2176
2404
 
2177
- function getInnerBoundingClientRect(element, strategy) {
2178
- const clientRect = getBoundingClientRect(element, false, strategy === 'fixed');
2179
- const top = clientRect.top + element.clientTop;
2180
- const left = clientRect.left + element.clientLeft;
2181
- return {
2182
- top,
2183
- left,
2184
- x: left,
2185
- y: top,
2186
- right: left + element.clientWidth,
2187
- bottom: top + element.clientHeight,
2188
- width: element.clientWidth,
2189
- height: element.clientHeight
2190
- };
2191
- }
2405
+ exports.jsx = jsx;
2406
+ exports.jsxs = jsxs;
2407
+ })();
2408
+ }
2409
+ } (reactJsxRuntime_development));
2192
2410
 
2193
- function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
2194
- if (clippingAncestor === 'viewport') {
2195
- return rectToClientRect(getViewportRect(element, strategy));
2196
- }
2411
+ (function (module) {
2197
2412
 
2198
- if (isElement(clippingAncestor)) {
2199
- return getInnerBoundingClientRect(clippingAncestor, strategy);
2200
- }
2413
+ {
2414
+ module.exports = reactJsxRuntime_development;
2415
+ }
2416
+ } (jsxRuntime));
2201
2417
 
2202
- return rectToClientRect(getDocumentRect(getDocumentElement(element)));
2203
- } // A "clipping ancestor" is an overflowable container with the characteristic of
2204
- // clipping (or hiding) overflowing elements with a position different from
2205
- // `initial`
2418
+ var classnames = {exports: {}};
2206
2419
 
2420
+ /*!
2421
+ Copyright (c) 2018 Jed Watson.
2422
+ Licensed under the MIT License (MIT), see
2423
+ http://jedwatson.github.io/classnames
2424
+ */
2207
2425
 
2208
- function getClippingElementAncestors(element) {
2209
- let result = getOverflowAncestors(element).filter(el => isElement(el) && getNodeName(el) !== 'body');
2210
- let currentNode = element;
2211
- let currentContainingBlockComputedStyle = null; // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
2426
+ (function (module) {
2427
+ /* global define */
2212
2428
 
2213
- while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
2214
- const computedStyle = getComputedStyle(currentNode);
2429
+ (function () {
2215
2430
 
2216
- if (computedStyle.position === 'static' && currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position) && !isContainingBlock(currentNode)) {
2217
- // Drop non-containing blocks
2218
- result = result.filter(ancestor => ancestor !== currentNode);
2219
- } else {
2220
- // Record last containing block for next iteration
2221
- currentContainingBlockComputedStyle = computedStyle;
2222
- }
2431
+ var hasOwn = {}.hasOwnProperty;
2223
2432
 
2224
- currentNode = getParentNode(currentNode);
2225
- }
2433
+ function classNames() {
2434
+ var classes = [];
2226
2435
 
2227
- return result;
2228
- } // Gets the maximum area that the element is visible in due to any number of
2229
- // clipping ancestors
2436
+ for (var i = 0; i < arguments.length; i++) {
2437
+ var arg = arguments[i];
2438
+ if (!arg) continue;
2230
2439
 
2440
+ var argType = typeof arg;
2231
2441
 
2232
- function getClippingRect(_ref) {
2233
- let {
2234
- element,
2235
- boundary,
2236
- rootBoundary,
2237
- strategy
2238
- } = _ref;
2239
- const elementClippingAncestors = boundary === 'clippingAncestors' ? getClippingElementAncestors(element) : [].concat(boundary);
2240
- const clippingAncestors = [...elementClippingAncestors, rootBoundary];
2241
- const firstClippingAncestor = clippingAncestors[0];
2242
- const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
2243
- const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
2244
- accRect.top = max(rect.top, accRect.top);
2245
- accRect.right = min(rect.right, accRect.right);
2246
- accRect.bottom = min(rect.bottom, accRect.bottom);
2247
- accRect.left = max(rect.left, accRect.left);
2248
- return accRect;
2249
- }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
2250
- return {
2251
- width: clippingRect.right - clippingRect.left,
2252
- height: clippingRect.bottom - clippingRect.top,
2253
- x: clippingRect.left,
2254
- y: clippingRect.top
2255
- };
2256
- }
2442
+ if (argType === 'string' || argType === 'number') {
2443
+ classes.push(arg);
2444
+ } else if (Array.isArray(arg)) {
2445
+ if (arg.length) {
2446
+ var inner = classNames.apply(null, arg);
2447
+ if (inner) {
2448
+ classes.push(inner);
2449
+ }
2450
+ }
2451
+ } else if (argType === 'object') {
2452
+ if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
2453
+ classes.push(arg.toString());
2454
+ continue;
2455
+ }
2257
2456
 
2258
- const platform = {
2259
- getClippingRect,
2260
- convertOffsetParentRelativeRectToViewportRelativeRect,
2261
- isElement,
2262
- getDimensions,
2263
- getOffsetParent,
2264
- getDocumentElement,
2265
- getElementRects: _ref => {
2266
- let {
2267
- reference,
2268
- floating,
2269
- strategy
2270
- } = _ref;
2271
- return {
2272
- reference: getRectRelativeToOffsetParent(reference, getOffsetParent(floating), strategy),
2273
- floating: { ...getDimensions(floating),
2274
- x: 0,
2275
- y: 0
2276
- }
2277
- };
2278
- },
2279
- getClientRects: element => Array.from(element.getClientRects()),
2280
- isRTL: element => getComputedStyle(element).direction === 'rtl'
2281
- };
2457
+ for (var key in arg) {
2458
+ if (hasOwn.call(arg, key) && arg[key]) {
2459
+ classes.push(key);
2460
+ }
2461
+ }
2462
+ }
2463
+ }
2464
+
2465
+ return classes.join(' ');
2466
+ }
2467
+
2468
+ if (module.exports) {
2469
+ classNames.default = classNames;
2470
+ module.exports = classNames;
2471
+ } else {
2472
+ window.classNames = classNames;
2473
+ }
2474
+ }());
2475
+ } (classnames));
2476
+
2477
+ var classNames = classnames.exports;
2282
2478
 
2479
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2283
2480
  /**
2284
- * Computes the `x` and `y` coordinates that will place the floating element
2285
- * next to a reference element when it is given a certain CSS positioning
2286
- * strategy.
2481
+ * This function debounce the received function
2482
+ * @param { function } func Function to be debounced
2483
+ * @param { number } wait Time to wait before execut the function
2484
+ * @param { boolean } immediate Param to define if the function will be executed immediately
2287
2485
  */
2486
+ const debounce = (func, wait, immediate) => {
2487
+ let timeout = null;
2488
+ return function debounced(...args) {
2489
+ const later = () => {
2490
+ timeout = null;
2491
+ if (!immediate) {
2492
+ func.apply(this, args);
2493
+ }
2494
+ };
2495
+ if (timeout) {
2496
+ clearTimeout(timeout);
2497
+ }
2498
+ timeout = setTimeout(later, wait);
2499
+ };
2500
+ };
2288
2501
 
2289
- const computePosition = (reference, floating, options) => computePosition$1(reference, floating, {
2290
- platform,
2291
- ...options
2292
- });
2502
+ const TooltipContent = ({ content }) => {
2503
+ return jsxRuntime.exports.jsx("span", { dangerouslySetInnerHTML: { __html: content } });
2504
+ };
2505
+
2506
+ const DEFAULT_TOOLTIP_ID = 'DEFAULT_TOOLTIP_ID';
2507
+ const DEFAULT_CONTEXT_DATA = {
2508
+ anchorRefs: new Set(),
2509
+ activeAnchor: { current: null },
2510
+ attach: () => {
2511
+ /* attach anchor element */
2512
+ },
2513
+ detach: () => {
2514
+ /* detach anchor element */
2515
+ },
2516
+ setActiveAnchor: () => {
2517
+ /* set active anchor */
2518
+ },
2519
+ };
2520
+ const DEFAULT_CONTEXT_DATA_WRAPPER = {
2521
+ getTooltipData: () => DEFAULT_CONTEXT_DATA,
2522
+ };
2523
+ const TooltipContext = require$$0.createContext(DEFAULT_CONTEXT_DATA_WRAPPER);
2524
+ const TooltipProvider = ({ children }) => {
2525
+ const [anchorRefMap, setAnchorRefMap] = require$$0.useState({
2526
+ [DEFAULT_TOOLTIP_ID]: new Set(),
2527
+ });
2528
+ const [activeAnchorMap, setActiveAnchorMap] = require$$0.useState({
2529
+ [DEFAULT_TOOLTIP_ID]: { current: null },
2530
+ });
2531
+ const attach = (tooltipId, ...refs) => {
2532
+ setAnchorRefMap((oldMap) => {
2533
+ var _a;
2534
+ const tooltipRefs = (_a = oldMap[tooltipId]) !== null && _a !== void 0 ? _a : new Set();
2535
+ refs.forEach((ref) => tooltipRefs.add(ref));
2536
+ // create new object to trigger re-render
2537
+ return { ...oldMap, [tooltipId]: new Set(tooltipRefs) };
2538
+ });
2539
+ };
2540
+ const detach = (tooltipId, ...refs) => {
2541
+ setAnchorRefMap((oldMap) => {
2542
+ const tooltipRefs = oldMap[tooltipId];
2543
+ if (!tooltipRefs) {
2544
+ // tooltip not found
2545
+ // maybe thow error?
2546
+ return oldMap;
2547
+ }
2548
+ refs.forEach((ref) => tooltipRefs.delete(ref));
2549
+ // create new object to trigger re-render
2550
+ return { ...oldMap };
2551
+ });
2552
+ };
2553
+ const setActiveAnchor = (tooltipId, ref) => {
2554
+ setActiveAnchorMap((oldMap) => {
2555
+ var _a;
2556
+ if (((_a = oldMap[tooltipId]) === null || _a === void 0 ? void 0 : _a.current) === ref.current) {
2557
+ return oldMap;
2558
+ }
2559
+ // create new object to trigger re-render
2560
+ return { ...oldMap, [tooltipId]: ref };
2561
+ });
2562
+ };
2563
+ const getTooltipData = require$$0.useCallback((tooltipId = DEFAULT_TOOLTIP_ID) => {
2564
+ var _a, _b;
2565
+ return ({
2566
+ anchorRefs: (_a = anchorRefMap[tooltipId]) !== null && _a !== void 0 ? _a : new Set(),
2567
+ activeAnchor: (_b = activeAnchorMap[tooltipId]) !== null && _b !== void 0 ? _b : { current: null },
2568
+ attach: (...refs) => attach(tooltipId, ...refs),
2569
+ detach: (...refs) => detach(tooltipId, ...refs),
2570
+ setActiveAnchor: (ref) => setActiveAnchor(tooltipId, ref),
2571
+ });
2572
+ }, [anchorRefMap, activeAnchorMap, attach, detach]);
2573
+ const context = require$$0.useMemo(() => {
2574
+ return {
2575
+ getTooltipData,
2576
+ };
2577
+ }, [getTooltipData]);
2578
+ return jsxRuntime.exports.jsx(TooltipContext.Provider, { value: context, children: children });
2579
+ };
2580
+ function useTooltip(tooltipId = DEFAULT_TOOLTIP_ID) {
2581
+ return require$$0.useContext(TooltipContext).getTooltipData(tooltipId);
2582
+ }
2583
+
2584
+ const TooltipWrapper = ({ tooltipId, children, className, place, content, html, variant, offset, wrapper, events, positionStrategy, delayShow, delayHide, }) => {
2585
+ const { attach, detach } = useTooltip(tooltipId);
2586
+ const anchorRef = require$$0.useRef(null);
2587
+ require$$0.useEffect(() => {
2588
+ attach(anchorRef);
2589
+ return () => {
2590
+ detach(anchorRef);
2591
+ };
2592
+ }, []);
2593
+ return (jsxRuntime.exports.jsx("span", { ref: anchorRef, className: classNames('react-tooltip-wrapper', className), "data-tooltip-place": place, "data-tooltip-content": content, "data-tooltip-html": html, "data-tooltip-variant": variant, "data-tooltip-offset": offset, "data-tooltip-wrapper": wrapper, "data-tooltip-events": events, "data-tooltip-position-strategy": positionStrategy, "data-tooltip-delay-show": delayShow, "data-tooltip-delay-hide": delayHide, children: children }));
2594
+ };
2293
2595
 
2294
- const computeTooltipPosition = async ({ elementReference = null, tooltipReference = null, tooltipArrowReference = null, place = 'top', offset: offsetValue = 10, strategy = 'absolute', }) => {
2596
+ const computeTooltipPosition = async ({ elementReference = null, tooltipReference = null, tooltipArrowReference = null, place = 'top', offset: offsetValue = 10, strategy = 'absolute', middlewares = [offset(Number(offsetValue)), flip(), shift({ padding: 5 })], }) => {
2295
2597
  if (!elementReference) {
2296
2598
  // elementReference can be null or undefined and we will not compute the position
2297
2599
  // eslint-disable-next-line no-console
@@ -2301,7 +2603,7 @@
2301
2603
  if (tooltipReference === null) {
2302
2604
  return { tooltipStyles: {}, tooltipArrowStyles: {} };
2303
2605
  }
2304
- const middleware = [offset(Number(offsetValue)), flip(), shift({ padding: 5 })];
2606
+ const middleware = middlewares;
2305
2607
  if (tooltipArrowReference) {
2306
2608
  middleware.push(arrow({ element: tooltipArrowReference, padding: 5 }));
2307
2609
  return computePosition(elementReference, tooltipReference, {
@@ -2342,7 +2644,7 @@
2342
2644
 
2343
2645
  const Tooltip = ({
2344
2646
  // props
2345
- id, className, classNameArrow, variant = 'dark', anchorId, place = 'top', offset = 10, events = ['hover'], positionStrategy = 'absolute', wrapper: WrapperElement = 'div', children = null, delayShow = 0, delayHide = 0, float = false, noArrow = false, clickable = false, style: externalStyles, position, afterShow, afterHide,
2647
+ id, className, classNameArrow, variant = 'dark', anchorId, place = 'top', offset = 10, events = ['hover'], positionStrategy = 'absolute', middlewares, wrapper: WrapperElement = 'div', children = null, delayShow = 0, delayHide = 0, float = false, noArrow = false, clickable = false, style: externalStyles, position, afterShow, afterHide,
2346
2648
  // props handled by controller
2347
2649
  content, html, isOpen, setIsOpen, }) => {
2348
2650
  const tooltipRef = require$$0.useRef(null);
@@ -2453,6 +2755,7 @@
2453
2755
  tooltipReference: tooltipRef.current,
2454
2756
  tooltipArrowReference: tooltipArrowRef.current,
2455
2757
  strategy: positionStrategy,
2758
+ middlewares,
2456
2759
  }).then((computedStylesData) => {
2457
2760
  setCalculatingPosition(false);
2458
2761
  if (Object.keys(computedStylesData.tooltipStyles).length) {
@@ -2583,6 +2886,7 @@
2583
2886
  tooltipReference: tooltipRef.current,
2584
2887
  tooltipArrowReference: tooltipArrowRef.current,
2585
2888
  strategy: positionStrategy,
2889
+ middlewares,
2586
2890
  }).then((computedStylesData) => {
2587
2891
  if (!mounted) {
2588
2892
  // invalidate computed positions after remount
@@ -2631,7 +2935,7 @@
2631
2935
  }), style: inlineArrowStyles, ref: tooltipArrowRef })] }));
2632
2936
  };
2633
2937
 
2634
- const TooltipController = ({ id, anchorId, content, html, className, classNameArrow, variant = 'dark', place = 'top', offset = 10, wrapper = 'div', children = null, events = ['hover'], positionStrategy = 'absolute', delayShow = 0, delayHide = 0, float = false, noArrow = false, clickable = false, style, position, isOpen, setIsOpen, afterShow, afterHide, }) => {
2938
+ const TooltipController = ({ id, anchorId, content, html, className, classNameArrow, variant = 'dark', place = 'top', offset = 10, wrapper = 'div', children = null, events = ['hover'], positionStrategy = 'absolute', middlewares, delayShow = 0, delayHide = 0, float = false, noArrow = false, clickable = false, style, position, isOpen, setIsOpen, afterShow, afterHide, }) => {
2635
2939
  const [tooltipContent, setTooltipContent] = require$$0.useState(content);
2636
2940
  const [tooltipHtml, setTooltipHtml] = require$$0.useState(html);
2637
2941
  const [tooltipPlace, setTooltipPlace] = require$$0.useState(place);
@@ -2763,6 +3067,7 @@
2763
3067
  wrapper: tooltipWrapper,
2764
3068
  events: tooltipEvents,
2765
3069
  positionStrategy: tooltipPositionStrategy,
3070
+ middlewares,
2766
3071
  delayShow: tooltipDelayShow,
2767
3072
  delayHide: tooltipDelayHide,
2768
3073
  float: tooltipFloat,
@@ -2781,6 +3086,12 @@
2781
3086
  exports.Tooltip = TooltipController;
2782
3087
  exports.TooltipProvider = TooltipProvider;
2783
3088
  exports.TooltipWrapper = TooltipWrapper;
3089
+ exports.autoPlacement = autoPlacement;
3090
+ exports.flip = flip;
3091
+ exports.inline = inline;
3092
+ exports.offset = offset;
3093
+ exports.shift = shift;
3094
+ exports.size = size;
2784
3095
 
2785
3096
  Object.defineProperty(exports, '__esModule', { value: true });
2786
3097