react-tooltip 4.5.1 → 5.0.0-beta.1

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