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