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