vue-tippy 4.12.0 → 4.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/src/components/Tippy.d.ts +421 -0
  2. package/dist/src/components/Tippy.d.ts.map +1 -0
  3. package/dist/src/components/TippySingleton.d.ts +266 -0
  4. package/dist/src/components/TippySingleton.d.ts.map +1 -0
  5. package/dist/src/composables/index.d.ts +4 -0
  6. package/dist/src/composables/index.d.ts.map +1 -0
  7. package/dist/src/composables/useSingleton.d.ts +6 -0
  8. package/dist/src/composables/useSingleton.d.ts.map +1 -0
  9. package/dist/src/composables/useTippy.d.ts +27 -0
  10. package/dist/src/composables/useTippy.d.ts.map +1 -0
  11. package/dist/src/composables/useTippyComponent.d.ts +8 -0
  12. package/dist/src/composables/useTippyComponent.d.ts.map +1 -0
  13. package/dist/src/directive/index.d.ts +4 -0
  14. package/dist/src/directive/index.d.ts.map +1 -0
  15. package/dist/src/index.d.ts +13 -0
  16. package/dist/src/index.d.ts.map +1 -0
  17. package/dist/src/plugin/index.d.ts +4 -0
  18. package/dist/src/plugin/index.d.ts.map +1 -0
  19. package/dist/src/types/index.d.ts +21 -0
  20. package/dist/src/types/index.d.ts.map +1 -0
  21. package/dist/vue-tippy.cjs +4789 -0
  22. package/dist/vue-tippy.d.ts +750 -0
  23. package/dist/vue-tippy.esm-browser.js +4460 -0
  24. package/dist/vue-tippy.esm.js +42 -10
  25. package/dist/vue-tippy.iife.js +4792 -0
  26. package/dist/vue-tippy.iife.prod.js +6 -0
  27. package/dist/vue-tippy.min.js +1 -1
  28. package/dist/vue-tippy.mjs +4460 -0
  29. package/dist/vue-tippy.prod.cjs +4473 -0
  30. package/dist/vue-tippy.umd.js +42 -10
  31. package/package.json +1 -1
  32. package/src/components/Tippy.vue +21 -15
  33. package/src/components/TippyNoStyles.vue +21 -15
  34. package/src/index.js +8 -2
@@ -0,0 +1,4789 @@
1
+ /*!
2
+ * vue-tippy v6.0.0-alpha.63
3
+ * (c) 2022
4
+ * @license MIT
5
+ */
6
+ 'use strict';
7
+
8
+ Object.defineProperty(exports, '__esModule', { value: true });
9
+
10
+ var vue = require('vue');
11
+
12
+ var top = 'top';
13
+ var bottom = 'bottom';
14
+ var right = 'right';
15
+ var left = 'left';
16
+ var auto = 'auto';
17
+ var basePlacements = [top, bottom, right, left];
18
+ var start = 'start';
19
+ var end = 'end';
20
+ var clippingParents = 'clippingParents';
21
+ var viewport = 'viewport';
22
+ var popper = 'popper';
23
+ var reference = 'reference';
24
+ var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {
25
+ return acc.concat([placement + "-" + start, placement + "-" + end]);
26
+ }, []);
27
+ var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {
28
+ return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
29
+ }, []); // modifiers that need to read the DOM
30
+
31
+ var beforeRead = 'beforeRead';
32
+ var read = 'read';
33
+ var afterRead = 'afterRead'; // pure-logic modifiers
34
+
35
+ var beforeMain = 'beforeMain';
36
+ var main = 'main';
37
+ var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)
38
+
39
+ var beforeWrite = 'beforeWrite';
40
+ var write = 'write';
41
+ var afterWrite = 'afterWrite';
42
+ var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
43
+
44
+ function getNodeName(element) {
45
+ return element ? (element.nodeName || '').toLowerCase() : null;
46
+ }
47
+
48
+ function getWindow(node) {
49
+ if (node == null) {
50
+ return window;
51
+ }
52
+
53
+ if (node.toString() !== '[object Window]') {
54
+ var ownerDocument = node.ownerDocument;
55
+ return ownerDocument ? ownerDocument.defaultView || window : window;
56
+ }
57
+
58
+ return node;
59
+ }
60
+
61
+ function isElement(node) {
62
+ var OwnElement = getWindow(node).Element;
63
+ return node instanceof OwnElement || node instanceof Element;
64
+ }
65
+
66
+ function isHTMLElement(node) {
67
+ var OwnElement = getWindow(node).HTMLElement;
68
+ return node instanceof OwnElement || node instanceof HTMLElement;
69
+ }
70
+
71
+ function isShadowRoot(node) {
72
+ // IE 11 has no ShadowRoot
73
+ if (typeof ShadowRoot === 'undefined') {
74
+ return false;
75
+ }
76
+
77
+ var OwnElement = getWindow(node).ShadowRoot;
78
+ return node instanceof OwnElement || node instanceof ShadowRoot;
79
+ }
80
+
81
+ // and applies them to the HTMLElements such as popper and arrow
82
+
83
+ function applyStyles(_ref) {
84
+ var state = _ref.state;
85
+ Object.keys(state.elements).forEach(function (name) {
86
+ var style = state.styles[name] || {};
87
+ var attributes = state.attributes[name] || {};
88
+ var element = state.elements[name]; // arrow is optional + virtual elements
89
+
90
+ if (!isHTMLElement(element) || !getNodeName(element)) {
91
+ return;
92
+ } // Flow doesn't support to extend this property, but it's the most
93
+ // effective way to apply styles to an HTMLElement
94
+ // $FlowFixMe[cannot-write]
95
+
96
+
97
+ Object.assign(element.style, style);
98
+ Object.keys(attributes).forEach(function (name) {
99
+ var value = attributes[name];
100
+
101
+ if (value === false) {
102
+ element.removeAttribute(name);
103
+ } else {
104
+ element.setAttribute(name, value === true ? '' : value);
105
+ }
106
+ });
107
+ });
108
+ }
109
+
110
+ function effect(_ref2) {
111
+ var state = _ref2.state;
112
+ var initialStyles = {
113
+ popper: {
114
+ position: state.options.strategy,
115
+ left: '0',
116
+ top: '0',
117
+ margin: '0'
118
+ },
119
+ arrow: {
120
+ position: 'absolute'
121
+ },
122
+ reference: {}
123
+ };
124
+ Object.assign(state.elements.popper.style, initialStyles.popper);
125
+ state.styles = initialStyles;
126
+
127
+ if (state.elements.arrow) {
128
+ Object.assign(state.elements.arrow.style, initialStyles.arrow);
129
+ }
130
+
131
+ return function () {
132
+ Object.keys(state.elements).forEach(function (name) {
133
+ var element = state.elements[name];
134
+ var attributes = state.attributes[name] || {};
135
+ var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them
136
+
137
+ var style = styleProperties.reduce(function (style, property) {
138
+ style[property] = '';
139
+ return style;
140
+ }, {}); // arrow is optional + virtual elements
141
+
142
+ if (!isHTMLElement(element) || !getNodeName(element)) {
143
+ return;
144
+ }
145
+
146
+ Object.assign(element.style, style);
147
+ Object.keys(attributes).forEach(function (attribute) {
148
+ element.removeAttribute(attribute);
149
+ });
150
+ });
151
+ };
152
+ } // eslint-disable-next-line import/no-unused-modules
153
+
154
+
155
+ var applyStyles$1 = {
156
+ name: 'applyStyles',
157
+ enabled: true,
158
+ phase: 'write',
159
+ fn: applyStyles,
160
+ effect: effect,
161
+ requires: ['computeStyles']
162
+ };
163
+
164
+ function getBasePlacement(placement) {
165
+ return placement.split('-')[0];
166
+ }
167
+
168
+ var max = Math.max;
169
+ var min = Math.min;
170
+ var round = Math.round;
171
+
172
+ function getBoundingClientRect(element, includeScale) {
173
+ if (includeScale === void 0) {
174
+ includeScale = false;
175
+ }
176
+
177
+ var rect = element.getBoundingClientRect();
178
+ var scaleX = 1;
179
+ var scaleY = 1;
180
+
181
+ if (isHTMLElement(element) && includeScale) {
182
+ var offsetHeight = element.offsetHeight;
183
+ var offsetWidth = element.offsetWidth; // Do not attempt to divide by 0, otherwise we get `Infinity` as scale
184
+ // Fallback to 1 in case both values are `0`
185
+
186
+ if (offsetWidth > 0) {
187
+ scaleX = round(rect.width) / offsetWidth || 1;
188
+ }
189
+
190
+ if (offsetHeight > 0) {
191
+ scaleY = round(rect.height) / offsetHeight || 1;
192
+ }
193
+ }
194
+
195
+ return {
196
+ width: rect.width / scaleX,
197
+ height: rect.height / scaleY,
198
+ top: rect.top / scaleY,
199
+ right: rect.right / scaleX,
200
+ bottom: rect.bottom / scaleY,
201
+ left: rect.left / scaleX,
202
+ x: rect.left / scaleX,
203
+ y: rect.top / scaleY
204
+ };
205
+ }
206
+
207
+ // means it doesn't take into account transforms.
208
+
209
+ function getLayoutRect(element) {
210
+ var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.
211
+ // Fixes https://github.com/popperjs/popper-core/issues/1223
212
+
213
+ var width = element.offsetWidth;
214
+ var height = element.offsetHeight;
215
+
216
+ if (Math.abs(clientRect.width - width) <= 1) {
217
+ width = clientRect.width;
218
+ }
219
+
220
+ if (Math.abs(clientRect.height - height) <= 1) {
221
+ height = clientRect.height;
222
+ }
223
+
224
+ return {
225
+ x: element.offsetLeft,
226
+ y: element.offsetTop,
227
+ width: width,
228
+ height: height
229
+ };
230
+ }
231
+
232
+ function contains(parent, child) {
233
+ var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method
234
+
235
+ if (parent.contains(child)) {
236
+ return true;
237
+ } // then fallback to custom implementation with Shadow DOM support
238
+ else if (rootNode && isShadowRoot(rootNode)) {
239
+ var next = child;
240
+
241
+ do {
242
+ if (next && parent.isSameNode(next)) {
243
+ return true;
244
+ } // $FlowFixMe[prop-missing]: need a better way to handle this...
245
+
246
+
247
+ next = next.parentNode || next.host;
248
+ } while (next);
249
+ } // Give up, the result is false
250
+
251
+
252
+ return false;
253
+ }
254
+
255
+ function getComputedStyle(element) {
256
+ return getWindow(element).getComputedStyle(element);
257
+ }
258
+
259
+ function isTableElement(element) {
260
+ return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0;
261
+ }
262
+
263
+ function getDocumentElement(element) {
264
+ // $FlowFixMe[incompatible-return]: assume body is always available
265
+ return ((isElement(element) ? element.ownerDocument : // $FlowFixMe[prop-missing]
266
+ element.document) || window.document).documentElement;
267
+ }
268
+
269
+ function getParentNode(element) {
270
+ if (getNodeName(element) === 'html') {
271
+ return element;
272
+ }
273
+
274
+ return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
275
+ // $FlowFixMe[incompatible-return]
276
+ // $FlowFixMe[prop-missing]
277
+ element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
278
+ element.parentNode || ( // DOM Element detected
279
+ isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
280
+ // $FlowFixMe[incompatible-call]: HTMLElement is a Node
281
+ getDocumentElement(element) // fallback
282
+
283
+ );
284
+ }
285
+
286
+ function getTrueOffsetParent(element) {
287
+ if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
288
+ getComputedStyle(element).position === 'fixed') {
289
+ return null;
290
+ }
291
+
292
+ return element.offsetParent;
293
+ } // `.offsetParent` reports `null` for fixed elements, while absolute elements
294
+ // return the containing block
295
+
296
+
297
+ function getContainingBlock(element) {
298
+ var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') !== -1;
299
+ var isIE = navigator.userAgent.indexOf('Trident') !== -1;
300
+
301
+ if (isIE && isHTMLElement(element)) {
302
+ // In IE 9, 10 and 11 fixed elements containing block is always established by the viewport
303
+ var elementCss = getComputedStyle(element);
304
+
305
+ if (elementCss.position === 'fixed') {
306
+ return null;
307
+ }
308
+ }
309
+
310
+ var currentNode = getParentNode(element);
311
+
312
+ while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
313
+ var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that
314
+ // create a containing block.
315
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
316
+
317
+ if (css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === 'filter' || isFirefox && css.filter && css.filter !== 'none') {
318
+ return currentNode;
319
+ } else {
320
+ currentNode = currentNode.parentNode;
321
+ }
322
+ }
323
+
324
+ return null;
325
+ } // Gets the closest ancestor positioned element. Handles some edge cases,
326
+ // such as table ancestors and cross browser bugs.
327
+
328
+
329
+ function getOffsetParent(element) {
330
+ var window = getWindow(element);
331
+ var offsetParent = getTrueOffsetParent(element);
332
+
333
+ while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {
334
+ offsetParent = getTrueOffsetParent(offsetParent);
335
+ }
336
+
337
+ if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static')) {
338
+ return window;
339
+ }
340
+
341
+ return offsetParent || getContainingBlock(element) || window;
342
+ }
343
+
344
+ function getMainAxisFromPlacement(placement) {
345
+ return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';
346
+ }
347
+
348
+ function within(min$1, value, max$1) {
349
+ return max(min$1, min(value, max$1));
350
+ }
351
+ function withinMaxClamp(min, value, max) {
352
+ var v = within(min, value, max);
353
+ return v > max ? max : v;
354
+ }
355
+
356
+ function getFreshSideObject() {
357
+ return {
358
+ top: 0,
359
+ right: 0,
360
+ bottom: 0,
361
+ left: 0
362
+ };
363
+ }
364
+
365
+ function mergePaddingObject(paddingObject) {
366
+ return Object.assign({}, getFreshSideObject(), paddingObject);
367
+ }
368
+
369
+ function expandToHashMap(value, keys) {
370
+ return keys.reduce(function (hashMap, key) {
371
+ hashMap[key] = value;
372
+ return hashMap;
373
+ }, {});
374
+ }
375
+
376
+ var toPaddingObject = function toPaddingObject(padding, state) {
377
+ padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, {
378
+ placement: state.placement
379
+ })) : padding;
380
+ return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
381
+ };
382
+
383
+ function arrow(_ref) {
384
+ var _state$modifiersData$;
385
+
386
+ var state = _ref.state,
387
+ name = _ref.name,
388
+ options = _ref.options;
389
+ var arrowElement = state.elements.arrow;
390
+ var popperOffsets = state.modifiersData.popperOffsets;
391
+ var basePlacement = getBasePlacement(state.placement);
392
+ var axis = getMainAxisFromPlacement(basePlacement);
393
+ var isVertical = [left, right].indexOf(basePlacement) >= 0;
394
+ var len = isVertical ? 'height' : 'width';
395
+
396
+ if (!arrowElement || !popperOffsets) {
397
+ return;
398
+ }
399
+
400
+ var paddingObject = toPaddingObject(options.padding, state);
401
+ var arrowRect = getLayoutRect(arrowElement);
402
+ var minProp = axis === 'y' ? top : left;
403
+ var maxProp = axis === 'y' ? bottom : right;
404
+ var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len];
405
+ var startDiff = popperOffsets[axis] - state.rects.reference[axis];
406
+ var arrowOffsetParent = getOffsetParent(arrowElement);
407
+ var clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
408
+ var centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the popper if the center point is
409
+ // outside of the popper bounds
410
+
411
+ var min = paddingObject[minProp];
412
+ var max = clientSize - arrowRect[len] - paddingObject[maxProp];
413
+ var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
414
+ var offset = within(min, center, max); // Prevents breaking syntax highlighting...
415
+
416
+ var axisProp = axis;
417
+ state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset, _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$);
418
+ }
419
+
420
+ function effect$1(_ref2) {
421
+ var state = _ref2.state,
422
+ options = _ref2.options;
423
+ var _options$element = options.element,
424
+ arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element;
425
+
426
+ if (arrowElement == null) {
427
+ return;
428
+ } // CSS selector
429
+
430
+
431
+ if (typeof arrowElement === 'string') {
432
+ arrowElement = state.elements.popper.querySelector(arrowElement);
433
+
434
+ if (!arrowElement) {
435
+ return;
436
+ }
437
+ }
438
+
439
+ {
440
+ if (!isHTMLElement(arrowElement)) {
441
+ console.error(['Popper: "arrow" element must be an HTMLElement (not an SVGElement).', 'To use an SVG arrow, wrap it in an HTMLElement that will be used as', 'the arrow.'].join(' '));
442
+ }
443
+ }
444
+
445
+ if (!contains(state.elements.popper, arrowElement)) {
446
+ {
447
+ console.error(['Popper: "arrow" modifier\'s `element` must be a child of the popper', 'element.'].join(' '));
448
+ }
449
+
450
+ return;
451
+ }
452
+
453
+ state.elements.arrow = arrowElement;
454
+ } // eslint-disable-next-line import/no-unused-modules
455
+
456
+
457
+ var arrow$1 = {
458
+ name: 'arrow',
459
+ enabled: true,
460
+ phase: 'main',
461
+ fn: arrow,
462
+ effect: effect$1,
463
+ requires: ['popperOffsets'],
464
+ requiresIfExists: ['preventOverflow']
465
+ };
466
+
467
+ function getVariation(placement) {
468
+ return placement.split('-')[1];
469
+ }
470
+
471
+ var unsetSides = {
472
+ top: 'auto',
473
+ right: 'auto',
474
+ bottom: 'auto',
475
+ left: 'auto'
476
+ }; // Round the offsets to the nearest suitable subpixel based on the DPR.
477
+ // Zooming can change the DPR, but it seems to report a value that will
478
+ // cleanly divide the values into the appropriate subpixels.
479
+
480
+ function roundOffsetsByDPR(_ref) {
481
+ var x = _ref.x,
482
+ y = _ref.y;
483
+ var win = window;
484
+ var dpr = win.devicePixelRatio || 1;
485
+ return {
486
+ x: round(x * dpr) / dpr || 0,
487
+ y: round(y * dpr) / dpr || 0
488
+ };
489
+ }
490
+
491
+ function mapToStyles(_ref2) {
492
+ var _Object$assign2;
493
+
494
+ var popper = _ref2.popper,
495
+ popperRect = _ref2.popperRect,
496
+ placement = _ref2.placement,
497
+ variation = _ref2.variation,
498
+ offsets = _ref2.offsets,
499
+ position = _ref2.position,
500
+ gpuAcceleration = _ref2.gpuAcceleration,
501
+ adaptive = _ref2.adaptive,
502
+ roundOffsets = _ref2.roundOffsets,
503
+ isFixed = _ref2.isFixed;
504
+
505
+ var _ref3 = roundOffsets === true ? roundOffsetsByDPR(offsets) : typeof roundOffsets === 'function' ? roundOffsets(offsets) : offsets,
506
+ _ref3$x = _ref3.x,
507
+ x = _ref3$x === void 0 ? 0 : _ref3$x,
508
+ _ref3$y = _ref3.y,
509
+ y = _ref3$y === void 0 ? 0 : _ref3$y;
510
+
511
+ var hasX = offsets.hasOwnProperty('x');
512
+ var hasY = offsets.hasOwnProperty('y');
513
+ var sideX = left;
514
+ var sideY = top;
515
+ var win = window;
516
+
517
+ if (adaptive) {
518
+ var offsetParent = getOffsetParent(popper);
519
+ var heightProp = 'clientHeight';
520
+ var widthProp = 'clientWidth';
521
+
522
+ if (offsetParent === getWindow(popper)) {
523
+ offsetParent = getDocumentElement(popper);
524
+
525
+ if (getComputedStyle(offsetParent).position !== 'static' && position === 'absolute') {
526
+ heightProp = 'scrollHeight';
527
+ widthProp = 'scrollWidth';
528
+ }
529
+ } // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it
530
+
531
+
532
+ offsetParent = offsetParent;
533
+
534
+ if (placement === top || (placement === left || placement === right) && variation === end) {
535
+ sideY = bottom;
536
+ var offsetY = isFixed && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing]
537
+ offsetParent[heightProp];
538
+ y -= offsetY - popperRect.height;
539
+ y *= gpuAcceleration ? 1 : -1;
540
+ }
541
+
542
+ if (placement === left || (placement === top || placement === bottom) && variation === end) {
543
+ sideX = right;
544
+ var offsetX = isFixed && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing]
545
+ offsetParent[widthProp];
546
+ x -= offsetX - popperRect.width;
547
+ x *= gpuAcceleration ? 1 : -1;
548
+ }
549
+ }
550
+
551
+ var commonStyles = Object.assign({
552
+ position: position
553
+ }, adaptive && unsetSides);
554
+
555
+ if (gpuAcceleration) {
556
+ var _Object$assign;
557
+
558
+ return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
559
+ }
560
+
561
+ return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
562
+ }
563
+
564
+ function computeStyles(_ref4) {
565
+ var state = _ref4.state,
566
+ options = _ref4.options;
567
+ var _options$gpuAccelerat = options.gpuAcceleration,
568
+ gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,
569
+ _options$adaptive = options.adaptive,
570
+ adaptive = _options$adaptive === void 0 ? true : _options$adaptive,
571
+ _options$roundOffsets = options.roundOffsets,
572
+ roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
573
+
574
+ {
575
+ var transitionProperty = getComputedStyle(state.elements.popper).transitionProperty || '';
576
+
577
+ if (adaptive && ['transform', 'top', 'right', 'bottom', 'left'].some(function (property) {
578
+ return transitionProperty.indexOf(property) >= 0;
579
+ })) {
580
+ console.warn(['Popper: Detected CSS transitions on at least one of the following', 'CSS properties: "transform", "top", "right", "bottom", "left".', '\n\n', 'Disable the "computeStyles" modifier\'s `adaptive` option to allow', 'for smooth transitions, or remove these properties from the CSS', 'transition declaration on the popper element if only transitioning', 'opacity or background-color for example.', '\n\n', 'We recommend using the popper element as a wrapper around an inner', 'element that can have any CSS property transitioned for animations.'].join(' '));
581
+ }
582
+ }
583
+
584
+ var commonStyles = {
585
+ placement: getBasePlacement(state.placement),
586
+ variation: getVariation(state.placement),
587
+ popper: state.elements.popper,
588
+ popperRect: state.rects.popper,
589
+ gpuAcceleration: gpuAcceleration,
590
+ isFixed: state.options.strategy === 'fixed'
591
+ };
592
+
593
+ if (state.modifiersData.popperOffsets != null) {
594
+ state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
595
+ offsets: state.modifiersData.popperOffsets,
596
+ position: state.options.strategy,
597
+ adaptive: adaptive,
598
+ roundOffsets: roundOffsets
599
+ })));
600
+ }
601
+
602
+ if (state.modifiersData.arrow != null) {
603
+ state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
604
+ offsets: state.modifiersData.arrow,
605
+ position: 'absolute',
606
+ adaptive: false,
607
+ roundOffsets: roundOffsets
608
+ })));
609
+ }
610
+
611
+ state.attributes.popper = Object.assign({}, state.attributes.popper, {
612
+ 'data-popper-placement': state.placement
613
+ });
614
+ } // eslint-disable-next-line import/no-unused-modules
615
+
616
+
617
+ var computeStyles$1 = {
618
+ name: 'computeStyles',
619
+ enabled: true,
620
+ phase: 'beforeWrite',
621
+ fn: computeStyles,
622
+ data: {}
623
+ };
624
+
625
+ var passive = {
626
+ passive: true
627
+ };
628
+
629
+ function effect$2(_ref) {
630
+ var state = _ref.state,
631
+ instance = _ref.instance,
632
+ options = _ref.options;
633
+ var _options$scroll = options.scroll,
634
+ scroll = _options$scroll === void 0 ? true : _options$scroll,
635
+ _options$resize = options.resize,
636
+ resize = _options$resize === void 0 ? true : _options$resize;
637
+ var window = getWindow(state.elements.popper);
638
+ var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
639
+
640
+ if (scroll) {
641
+ scrollParents.forEach(function (scrollParent) {
642
+ scrollParent.addEventListener('scroll', instance.update, passive);
643
+ });
644
+ }
645
+
646
+ if (resize) {
647
+ window.addEventListener('resize', instance.update, passive);
648
+ }
649
+
650
+ return function () {
651
+ if (scroll) {
652
+ scrollParents.forEach(function (scrollParent) {
653
+ scrollParent.removeEventListener('scroll', instance.update, passive);
654
+ });
655
+ }
656
+
657
+ if (resize) {
658
+ window.removeEventListener('resize', instance.update, passive);
659
+ }
660
+ };
661
+ } // eslint-disable-next-line import/no-unused-modules
662
+
663
+
664
+ var eventListeners = {
665
+ name: 'eventListeners',
666
+ enabled: true,
667
+ phase: 'write',
668
+ fn: function fn() {},
669
+ effect: effect$2,
670
+ data: {}
671
+ };
672
+
673
+ var hash = {
674
+ left: 'right',
675
+ right: 'left',
676
+ bottom: 'top',
677
+ top: 'bottom'
678
+ };
679
+ function getOppositePlacement(placement) {
680
+ return placement.replace(/left|right|bottom|top/g, function (matched) {
681
+ return hash[matched];
682
+ });
683
+ }
684
+
685
+ var hash$1 = {
686
+ start: 'end',
687
+ end: 'start'
688
+ };
689
+ function getOppositeVariationPlacement(placement) {
690
+ return placement.replace(/start|end/g, function (matched) {
691
+ return hash$1[matched];
692
+ });
693
+ }
694
+
695
+ function getWindowScroll(node) {
696
+ var win = getWindow(node);
697
+ var scrollLeft = win.pageXOffset;
698
+ var scrollTop = win.pageYOffset;
699
+ return {
700
+ scrollLeft: scrollLeft,
701
+ scrollTop: scrollTop
702
+ };
703
+ }
704
+
705
+ function getWindowScrollBarX(element) {
706
+ // If <html> has a CSS width greater than the viewport, then this will be
707
+ // incorrect for RTL.
708
+ // Popper 1 is broken in this case and never had a bug report so let's assume
709
+ // it's not an issue. I don't think anyone ever specifies width on <html>
710
+ // anyway.
711
+ // Browsers where the left scrollbar doesn't cause an issue report `0` for
712
+ // this (e.g. Edge 2019, IE11, Safari)
713
+ return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
714
+ }
715
+
716
+ function getViewportRect(element) {
717
+ var win = getWindow(element);
718
+ var html = getDocumentElement(element);
719
+ var visualViewport = win.visualViewport;
720
+ var width = html.clientWidth;
721
+ var height = html.clientHeight;
722
+ var x = 0;
723
+ var y = 0; // NB: This isn't supported on iOS <= 12. If the keyboard is open, the popper
724
+ // can be obscured underneath it.
725
+ // Also, `html.clientHeight` adds the bottom bar height in Safari iOS, even
726
+ // if it isn't open, so if this isn't available, the popper will be detected
727
+ // to overflow the bottom of the screen too early.
728
+
729
+ if (visualViewport) {
730
+ width = visualViewport.width;
731
+ height = visualViewport.height; // Uses Layout Viewport (like Chrome; Safari does not currently)
732
+ // In Chrome, it returns a value very close to 0 (+/-) but contains rounding
733
+ // errors due to floating point numbers, so we need to check precision.
734
+ // Safari returns a number <= 0, usually < -1 when pinch-zoomed
735
+ // Feature detection fails in mobile emulation mode in Chrome.
736
+ // Math.abs(win.innerWidth / visualViewport.scale - visualViewport.width) <
737
+ // 0.001
738
+ // Fallback here: "Not Safari" userAgent
739
+
740
+ if (!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
741
+ x = visualViewport.offsetLeft;
742
+ y = visualViewport.offsetTop;
743
+ }
744
+ }
745
+
746
+ return {
747
+ width: width,
748
+ height: height,
749
+ x: x + getWindowScrollBarX(element),
750
+ y: y
751
+ };
752
+ }
753
+
754
+ // of the `<html>` and `<body>` rect bounds if horizontally scrollable
755
+
756
+ function getDocumentRect(element) {
757
+ var _element$ownerDocumen;
758
+
759
+ var html = getDocumentElement(element);
760
+ var winScroll = getWindowScroll(element);
761
+ var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
762
+ var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
763
+ var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
764
+ var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
765
+ var y = -winScroll.scrollTop;
766
+
767
+ if (getComputedStyle(body || html).direction === 'rtl') {
768
+ x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
769
+ }
770
+
771
+ return {
772
+ width: width,
773
+ height: height,
774
+ x: x,
775
+ y: y
776
+ };
777
+ }
778
+
779
+ function isScrollParent(element) {
780
+ // Firefox wants us to check `-x` and `-y` variations as well
781
+ var _getComputedStyle = getComputedStyle(element),
782
+ overflow = _getComputedStyle.overflow,
783
+ overflowX = _getComputedStyle.overflowX,
784
+ overflowY = _getComputedStyle.overflowY;
785
+
786
+ return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
787
+ }
788
+
789
+ function getScrollParent(node) {
790
+ if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {
791
+ // $FlowFixMe[incompatible-return]: assume body is always available
792
+ return node.ownerDocument.body;
793
+ }
794
+
795
+ if (isHTMLElement(node) && isScrollParent(node)) {
796
+ return node;
797
+ }
798
+
799
+ return getScrollParent(getParentNode(node));
800
+ }
801
+
802
+ /*
803
+ given a DOM element, return the list of all scroll parents, up the list of ancesors
804
+ until we get to the top window object. This list is what we attach scroll listeners
805
+ to, because if any of these parent elements scroll, we'll need to re-calculate the
806
+ reference element's position.
807
+ */
808
+
809
+ function listScrollParents(element, list) {
810
+ var _element$ownerDocumen;
811
+
812
+ if (list === void 0) {
813
+ list = [];
814
+ }
815
+
816
+ var scrollParent = getScrollParent(element);
817
+ var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
818
+ var win = getWindow(scrollParent);
819
+ var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
820
+ var updatedList = list.concat(target);
821
+ return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
822
+ updatedList.concat(listScrollParents(getParentNode(target)));
823
+ }
824
+
825
+ function rectToClientRect(rect) {
826
+ return Object.assign({}, rect, {
827
+ left: rect.x,
828
+ top: rect.y,
829
+ right: rect.x + rect.width,
830
+ bottom: rect.y + rect.height
831
+ });
832
+ }
833
+
834
+ function getInnerBoundingClientRect(element) {
835
+ var rect = getBoundingClientRect(element);
836
+ rect.top = rect.top + element.clientTop;
837
+ rect.left = rect.left + element.clientLeft;
838
+ rect.bottom = rect.top + element.clientHeight;
839
+ rect.right = rect.left + element.clientWidth;
840
+ rect.width = element.clientWidth;
841
+ rect.height = element.clientHeight;
842
+ rect.x = rect.left;
843
+ rect.y = rect.top;
844
+ return rect;
845
+ }
846
+
847
+ function getClientRectFromMixedType(element, clippingParent) {
848
+ return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
849
+ } // A "clipping parent" is an overflowable container with the characteristic of
850
+ // clipping (or hiding) overflowing elements with a position different from
851
+ // `initial`
852
+
853
+
854
+ function getClippingParents(element) {
855
+ var clippingParents = listScrollParents(getParentNode(element));
856
+ var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle(element).position) >= 0;
857
+ var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
858
+
859
+ if (!isElement(clipperElement)) {
860
+ return [];
861
+ } // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414
862
+
863
+
864
+ return clippingParents.filter(function (clippingParent) {
865
+ return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body' && (canEscapeClipping ? getComputedStyle(clippingParent).position !== 'static' : true);
866
+ });
867
+ } // Gets the maximum area that the element is visible in due to any number of
868
+ // clipping parents
869
+
870
+
871
+ function getClippingRect(element, boundary, rootBoundary) {
872
+ var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);
873
+ var clippingParents = [].concat(mainClippingParents, [rootBoundary]);
874
+ var firstClippingParent = clippingParents[0];
875
+ var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {
876
+ var rect = getClientRectFromMixedType(element, clippingParent);
877
+ accRect.top = max(rect.top, accRect.top);
878
+ accRect.right = min(rect.right, accRect.right);
879
+ accRect.bottom = min(rect.bottom, accRect.bottom);
880
+ accRect.left = max(rect.left, accRect.left);
881
+ return accRect;
882
+ }, getClientRectFromMixedType(element, firstClippingParent));
883
+ clippingRect.width = clippingRect.right - clippingRect.left;
884
+ clippingRect.height = clippingRect.bottom - clippingRect.top;
885
+ clippingRect.x = clippingRect.left;
886
+ clippingRect.y = clippingRect.top;
887
+ return clippingRect;
888
+ }
889
+
890
+ function computeOffsets(_ref) {
891
+ var reference = _ref.reference,
892
+ element = _ref.element,
893
+ placement = _ref.placement;
894
+ var basePlacement = placement ? getBasePlacement(placement) : null;
895
+ var variation = placement ? getVariation(placement) : null;
896
+ var commonX = reference.x + reference.width / 2 - element.width / 2;
897
+ var commonY = reference.y + reference.height / 2 - element.height / 2;
898
+ var offsets;
899
+
900
+ switch (basePlacement) {
901
+ case top:
902
+ offsets = {
903
+ x: commonX,
904
+ y: reference.y - element.height
905
+ };
906
+ break;
907
+
908
+ case bottom:
909
+ offsets = {
910
+ x: commonX,
911
+ y: reference.y + reference.height
912
+ };
913
+ break;
914
+
915
+ case right:
916
+ offsets = {
917
+ x: reference.x + reference.width,
918
+ y: commonY
919
+ };
920
+ break;
921
+
922
+ case left:
923
+ offsets = {
924
+ x: reference.x - element.width,
925
+ y: commonY
926
+ };
927
+ break;
928
+
929
+ default:
930
+ offsets = {
931
+ x: reference.x,
932
+ y: reference.y
933
+ };
934
+ }
935
+
936
+ var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
937
+
938
+ if (mainAxis != null) {
939
+ var len = mainAxis === 'y' ? 'height' : 'width';
940
+
941
+ switch (variation) {
942
+ case start:
943
+ offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);
944
+ break;
945
+
946
+ case end:
947
+ offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);
948
+ break;
949
+ }
950
+ }
951
+
952
+ return offsets;
953
+ }
954
+
955
+ function detectOverflow(state, options) {
956
+ if (options === void 0) {
957
+ options = {};
958
+ }
959
+
960
+ var _options = options,
961
+ _options$placement = _options.placement,
962
+ placement = _options$placement === void 0 ? state.placement : _options$placement,
963
+ _options$boundary = _options.boundary,
964
+ boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,
965
+ _options$rootBoundary = _options.rootBoundary,
966
+ rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary,
967
+ _options$elementConte = _options.elementContext,
968
+ elementContext = _options$elementConte === void 0 ? popper : _options$elementConte,
969
+ _options$altBoundary = _options.altBoundary,
970
+ altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary,
971
+ _options$padding = _options.padding,
972
+ padding = _options$padding === void 0 ? 0 : _options$padding;
973
+ var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
974
+ var altContext = elementContext === popper ? reference : popper;
975
+ var popperRect = state.rects.popper;
976
+ var element = state.elements[altBoundary ? altContext : elementContext];
977
+ var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary);
978
+ var referenceClientRect = getBoundingClientRect(state.elements.reference);
979
+ var popperOffsets = computeOffsets({
980
+ reference: referenceClientRect,
981
+ element: popperRect,
982
+ strategy: 'absolute',
983
+ placement: placement
984
+ });
985
+ var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));
986
+ var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect
987
+ // 0 or negative = within the clipping rect
988
+
989
+ var overflowOffsets = {
990
+ top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
991
+ bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
992
+ left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
993
+ right: elementClientRect.right - clippingClientRect.right + paddingObject.right
994
+ };
995
+ var offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element
996
+
997
+ if (elementContext === popper && offsetData) {
998
+ var offset = offsetData[placement];
999
+ Object.keys(overflowOffsets).forEach(function (key) {
1000
+ var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
1001
+ var axis = [top, bottom].indexOf(key) >= 0 ? 'y' : 'x';
1002
+ overflowOffsets[key] += offset[axis] * multiply;
1003
+ });
1004
+ }
1005
+
1006
+ return overflowOffsets;
1007
+ }
1008
+
1009
+ function computeAutoPlacement(state, options) {
1010
+ if (options === void 0) {
1011
+ options = {};
1012
+ }
1013
+
1014
+ var _options = options,
1015
+ placement = _options.placement,
1016
+ boundary = _options.boundary,
1017
+ rootBoundary = _options.rootBoundary,
1018
+ padding = _options.padding,
1019
+ flipVariations = _options.flipVariations,
1020
+ _options$allowedAutoP = _options.allowedAutoPlacements,
1021
+ allowedAutoPlacements = _options$allowedAutoP === void 0 ? placements : _options$allowedAutoP;
1022
+ var variation = getVariation(placement);
1023
+ var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) {
1024
+ return getVariation(placement) === variation;
1025
+ }) : basePlacements;
1026
+ var allowedPlacements = placements$1.filter(function (placement) {
1027
+ return allowedAutoPlacements.indexOf(placement) >= 0;
1028
+ });
1029
+
1030
+ if (allowedPlacements.length === 0) {
1031
+ allowedPlacements = placements$1;
1032
+
1033
+ {
1034
+ console.error(['Popper: The `allowedAutoPlacements` option did not allow any', 'placements. Ensure the `placement` option matches the variation', 'of the allowed placements.', 'For example, "auto" cannot be used to allow "bottom-start".', 'Use "auto-start" instead.'].join(' '));
1035
+ }
1036
+ } // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions...
1037
+
1038
+
1039
+ var overflows = allowedPlacements.reduce(function (acc, placement) {
1040
+ acc[placement] = detectOverflow(state, {
1041
+ placement: placement,
1042
+ boundary: boundary,
1043
+ rootBoundary: rootBoundary,
1044
+ padding: padding
1045
+ })[getBasePlacement(placement)];
1046
+ return acc;
1047
+ }, {});
1048
+ return Object.keys(overflows).sort(function (a, b) {
1049
+ return overflows[a] - overflows[b];
1050
+ });
1051
+ }
1052
+
1053
+ function getExpandedFallbackPlacements(placement) {
1054
+ if (getBasePlacement(placement) === auto) {
1055
+ return [];
1056
+ }
1057
+
1058
+ var oppositePlacement = getOppositePlacement(placement);
1059
+ return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
1060
+ }
1061
+
1062
+ function flip(_ref) {
1063
+ var state = _ref.state,
1064
+ options = _ref.options,
1065
+ name = _ref.name;
1066
+
1067
+ if (state.modifiersData[name]._skip) {
1068
+ return;
1069
+ }
1070
+
1071
+ var _options$mainAxis = options.mainAxis,
1072
+ checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
1073
+ _options$altAxis = options.altAxis,
1074
+ checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis,
1075
+ specifiedFallbackPlacements = options.fallbackPlacements,
1076
+ padding = options.padding,
1077
+ boundary = options.boundary,
1078
+ rootBoundary = options.rootBoundary,
1079
+ altBoundary = options.altBoundary,
1080
+ _options$flipVariatio = options.flipVariations,
1081
+ flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio,
1082
+ allowedAutoPlacements = options.allowedAutoPlacements;
1083
+ var preferredPlacement = state.options.placement;
1084
+ var basePlacement = getBasePlacement(preferredPlacement);
1085
+ var isBasePlacement = basePlacement === preferredPlacement;
1086
+ var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));
1087
+ var placements = [preferredPlacement].concat(fallbackPlacements).reduce(function (acc, placement) {
1088
+ return acc.concat(getBasePlacement(placement) === auto ? computeAutoPlacement(state, {
1089
+ placement: placement,
1090
+ boundary: boundary,
1091
+ rootBoundary: rootBoundary,
1092
+ padding: padding,
1093
+ flipVariations: flipVariations,
1094
+ allowedAutoPlacements: allowedAutoPlacements
1095
+ }) : placement);
1096
+ }, []);
1097
+ var referenceRect = state.rects.reference;
1098
+ var popperRect = state.rects.popper;
1099
+ var checksMap = new Map();
1100
+ var makeFallbackChecks = true;
1101
+ var firstFittingPlacement = placements[0];
1102
+
1103
+ for (var i = 0; i < placements.length; i++) {
1104
+ var placement = placements[i];
1105
+
1106
+ var _basePlacement = getBasePlacement(placement);
1107
+
1108
+ var isStartVariation = getVariation(placement) === start;
1109
+ var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
1110
+ var len = isVertical ? 'width' : 'height';
1111
+ var overflow = detectOverflow(state, {
1112
+ placement: placement,
1113
+ boundary: boundary,
1114
+ rootBoundary: rootBoundary,
1115
+ altBoundary: altBoundary,
1116
+ padding: padding
1117
+ });
1118
+ var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;
1119
+
1120
+ if (referenceRect[len] > popperRect[len]) {
1121
+ mainVariationSide = getOppositePlacement(mainVariationSide);
1122
+ }
1123
+
1124
+ var altVariationSide = getOppositePlacement(mainVariationSide);
1125
+ var checks = [];
1126
+
1127
+ if (checkMainAxis) {
1128
+ checks.push(overflow[_basePlacement] <= 0);
1129
+ }
1130
+
1131
+ if (checkAltAxis) {
1132
+ checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
1133
+ }
1134
+
1135
+ if (checks.every(function (check) {
1136
+ return check;
1137
+ })) {
1138
+ firstFittingPlacement = placement;
1139
+ makeFallbackChecks = false;
1140
+ break;
1141
+ }
1142
+
1143
+ checksMap.set(placement, checks);
1144
+ }
1145
+
1146
+ if (makeFallbackChecks) {
1147
+ // `2` may be desired in some cases – research later
1148
+ var numberOfChecks = flipVariations ? 3 : 1;
1149
+
1150
+ var _loop = function _loop(_i) {
1151
+ var fittingPlacement = placements.find(function (placement) {
1152
+ var checks = checksMap.get(placement);
1153
+
1154
+ if (checks) {
1155
+ return checks.slice(0, _i).every(function (check) {
1156
+ return check;
1157
+ });
1158
+ }
1159
+ });
1160
+
1161
+ if (fittingPlacement) {
1162
+ firstFittingPlacement = fittingPlacement;
1163
+ return "break";
1164
+ }
1165
+ };
1166
+
1167
+ for (var _i = numberOfChecks; _i > 0; _i--) {
1168
+ var _ret = _loop(_i);
1169
+
1170
+ if (_ret === "break") break;
1171
+ }
1172
+ }
1173
+
1174
+ if (state.placement !== firstFittingPlacement) {
1175
+ state.modifiersData[name]._skip = true;
1176
+ state.placement = firstFittingPlacement;
1177
+ state.reset = true;
1178
+ }
1179
+ } // eslint-disable-next-line import/no-unused-modules
1180
+
1181
+
1182
+ var flip$1 = {
1183
+ name: 'flip',
1184
+ enabled: true,
1185
+ phase: 'main',
1186
+ fn: flip,
1187
+ requiresIfExists: ['offset'],
1188
+ data: {
1189
+ _skip: false
1190
+ }
1191
+ };
1192
+
1193
+ function getSideOffsets(overflow, rect, preventedOffsets) {
1194
+ if (preventedOffsets === void 0) {
1195
+ preventedOffsets = {
1196
+ x: 0,
1197
+ y: 0
1198
+ };
1199
+ }
1200
+
1201
+ return {
1202
+ top: overflow.top - rect.height - preventedOffsets.y,
1203
+ right: overflow.right - rect.width + preventedOffsets.x,
1204
+ bottom: overflow.bottom - rect.height + preventedOffsets.y,
1205
+ left: overflow.left - rect.width - preventedOffsets.x
1206
+ };
1207
+ }
1208
+
1209
+ function isAnySideFullyClipped(overflow) {
1210
+ return [top, right, bottom, left].some(function (side) {
1211
+ return overflow[side] >= 0;
1212
+ });
1213
+ }
1214
+
1215
+ function hide(_ref) {
1216
+ var state = _ref.state,
1217
+ name = _ref.name;
1218
+ var referenceRect = state.rects.reference;
1219
+ var popperRect = state.rects.popper;
1220
+ var preventedOffsets = state.modifiersData.preventOverflow;
1221
+ var referenceOverflow = detectOverflow(state, {
1222
+ elementContext: 'reference'
1223
+ });
1224
+ var popperAltOverflow = detectOverflow(state, {
1225
+ altBoundary: true
1226
+ });
1227
+ var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
1228
+ var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
1229
+ var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
1230
+ var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
1231
+ state.modifiersData[name] = {
1232
+ referenceClippingOffsets: referenceClippingOffsets,
1233
+ popperEscapeOffsets: popperEscapeOffsets,
1234
+ isReferenceHidden: isReferenceHidden,
1235
+ hasPopperEscaped: hasPopperEscaped
1236
+ };
1237
+ state.attributes.popper = Object.assign({}, state.attributes.popper, {
1238
+ 'data-popper-reference-hidden': isReferenceHidden,
1239
+ 'data-popper-escaped': hasPopperEscaped
1240
+ });
1241
+ } // eslint-disable-next-line import/no-unused-modules
1242
+
1243
+
1244
+ var hide$1 = {
1245
+ name: 'hide',
1246
+ enabled: true,
1247
+ phase: 'main',
1248
+ requiresIfExists: ['preventOverflow'],
1249
+ fn: hide
1250
+ };
1251
+
1252
+ function distanceAndSkiddingToXY(placement, rects, offset) {
1253
+ var basePlacement = getBasePlacement(placement);
1254
+ var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
1255
+
1256
+ var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, {
1257
+ placement: placement
1258
+ })) : offset,
1259
+ skidding = _ref[0],
1260
+ distance = _ref[1];
1261
+
1262
+ skidding = skidding || 0;
1263
+ distance = (distance || 0) * invertDistance;
1264
+ return [left, right].indexOf(basePlacement) >= 0 ? {
1265
+ x: distance,
1266
+ y: skidding
1267
+ } : {
1268
+ x: skidding,
1269
+ y: distance
1270
+ };
1271
+ }
1272
+
1273
+ function offset(_ref2) {
1274
+ var state = _ref2.state,
1275
+ options = _ref2.options,
1276
+ name = _ref2.name;
1277
+ var _options$offset = options.offset,
1278
+ offset = _options$offset === void 0 ? [0, 0] : _options$offset;
1279
+ var data = placements.reduce(function (acc, placement) {
1280
+ acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset);
1281
+ return acc;
1282
+ }, {});
1283
+ var _data$state$placement = data[state.placement],
1284
+ x = _data$state$placement.x,
1285
+ y = _data$state$placement.y;
1286
+
1287
+ if (state.modifiersData.popperOffsets != null) {
1288
+ state.modifiersData.popperOffsets.x += x;
1289
+ state.modifiersData.popperOffsets.y += y;
1290
+ }
1291
+
1292
+ state.modifiersData[name] = data;
1293
+ } // eslint-disable-next-line import/no-unused-modules
1294
+
1295
+
1296
+ var offset$1 = {
1297
+ name: 'offset',
1298
+ enabled: true,
1299
+ phase: 'main',
1300
+ requires: ['popperOffsets'],
1301
+ fn: offset
1302
+ };
1303
+
1304
+ function popperOffsets(_ref) {
1305
+ var state = _ref.state,
1306
+ name = _ref.name;
1307
+ // Offsets are the actual position the popper needs to have to be
1308
+ // properly positioned near its reference element
1309
+ // This is the most basic placement, and will be adjusted by
1310
+ // the modifiers in the next step
1311
+ state.modifiersData[name] = computeOffsets({
1312
+ reference: state.rects.reference,
1313
+ element: state.rects.popper,
1314
+ strategy: 'absolute',
1315
+ placement: state.placement
1316
+ });
1317
+ } // eslint-disable-next-line import/no-unused-modules
1318
+
1319
+
1320
+ var popperOffsets$1 = {
1321
+ name: 'popperOffsets',
1322
+ enabled: true,
1323
+ phase: 'read',
1324
+ fn: popperOffsets,
1325
+ data: {}
1326
+ };
1327
+
1328
+ function getAltAxis(axis) {
1329
+ return axis === 'x' ? 'y' : 'x';
1330
+ }
1331
+
1332
+ function preventOverflow(_ref) {
1333
+ var state = _ref.state,
1334
+ options = _ref.options,
1335
+ name = _ref.name;
1336
+ var _options$mainAxis = options.mainAxis,
1337
+ checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
1338
+ _options$altAxis = options.altAxis,
1339
+ checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis,
1340
+ boundary = options.boundary,
1341
+ rootBoundary = options.rootBoundary,
1342
+ altBoundary = options.altBoundary,
1343
+ padding = options.padding,
1344
+ _options$tether = options.tether,
1345
+ tether = _options$tether === void 0 ? true : _options$tether,
1346
+ _options$tetherOffset = options.tetherOffset,
1347
+ tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;
1348
+ var overflow = detectOverflow(state, {
1349
+ boundary: boundary,
1350
+ rootBoundary: rootBoundary,
1351
+ padding: padding,
1352
+ altBoundary: altBoundary
1353
+ });
1354
+ var basePlacement = getBasePlacement(state.placement);
1355
+ var variation = getVariation(state.placement);
1356
+ var isBasePlacement = !variation;
1357
+ var mainAxis = getMainAxisFromPlacement(basePlacement);
1358
+ var altAxis = getAltAxis(mainAxis);
1359
+ var popperOffsets = state.modifiersData.popperOffsets;
1360
+ var referenceRect = state.rects.reference;
1361
+ var popperRect = state.rects.popper;
1362
+ var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {
1363
+ placement: state.placement
1364
+ })) : tetherOffset;
1365
+ var normalizedTetherOffsetValue = typeof tetherOffsetValue === 'number' ? {
1366
+ mainAxis: tetherOffsetValue,
1367
+ altAxis: tetherOffsetValue
1368
+ } : Object.assign({
1369
+ mainAxis: 0,
1370
+ altAxis: 0
1371
+ }, tetherOffsetValue);
1372
+ var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
1373
+ var data = {
1374
+ x: 0,
1375
+ y: 0
1376
+ };
1377
+
1378
+ if (!popperOffsets) {
1379
+ return;
1380
+ }
1381
+
1382
+ if (checkMainAxis) {
1383
+ var _offsetModifierState$;
1384
+
1385
+ var mainSide = mainAxis === 'y' ? top : left;
1386
+ var altSide = mainAxis === 'y' ? bottom : right;
1387
+ var len = mainAxis === 'y' ? 'height' : 'width';
1388
+ var offset = popperOffsets[mainAxis];
1389
+ var min$1 = offset + overflow[mainSide];
1390
+ var max$1 = offset - overflow[altSide];
1391
+ var additive = tether ? -popperRect[len] / 2 : 0;
1392
+ var minLen = variation === start ? referenceRect[len] : popperRect[len];
1393
+ var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go
1394
+ // outside the reference bounds
1395
+
1396
+ var arrowElement = state.elements.arrow;
1397
+ var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {
1398
+ width: 0,
1399
+ height: 0
1400
+ };
1401
+ var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : getFreshSideObject();
1402
+ var arrowPaddingMin = arrowPaddingObject[mainSide];
1403
+ var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want
1404
+ // to include its full size in the calculation. If the reference is small
1405
+ // and near the edge of a boundary, the popper can overflow even if the
1406
+ // reference is not overflowing as well (e.g. virtual elements with no
1407
+ // width or height)
1408
+
1409
+ var arrowLen = within(0, referenceRect[len], arrowRect[len]);
1410
+ var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
1411
+ var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
1412
+ var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
1413
+ var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
1414
+ var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
1415
+ var tetherMin = offset + minOffset - offsetModifierValue - clientOffset;
1416
+ var tetherMax = offset + maxOffset - offsetModifierValue;
1417
+ var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset, tether ? max(max$1, tetherMax) : max$1);
1418
+ popperOffsets[mainAxis] = preventedOffset;
1419
+ data[mainAxis] = preventedOffset - offset;
1420
+ }
1421
+
1422
+ if (checkAltAxis) {
1423
+ var _offsetModifierState$2;
1424
+
1425
+ var _mainSide = mainAxis === 'x' ? top : left;
1426
+
1427
+ var _altSide = mainAxis === 'x' ? bottom : right;
1428
+
1429
+ var _offset = popperOffsets[altAxis];
1430
+
1431
+ var _len = altAxis === 'y' ? 'height' : 'width';
1432
+
1433
+ var _min = _offset + overflow[_mainSide];
1434
+
1435
+ var _max = _offset - overflow[_altSide];
1436
+
1437
+ var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
1438
+
1439
+ var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
1440
+
1441
+ var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
1442
+
1443
+ var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
1444
+
1445
+ var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
1446
+
1447
+ popperOffsets[altAxis] = _preventedOffset;
1448
+ data[altAxis] = _preventedOffset - _offset;
1449
+ }
1450
+
1451
+ state.modifiersData[name] = data;
1452
+ } // eslint-disable-next-line import/no-unused-modules
1453
+
1454
+
1455
+ var preventOverflow$1 = {
1456
+ name: 'preventOverflow',
1457
+ enabled: true,
1458
+ phase: 'main',
1459
+ fn: preventOverflow,
1460
+ requiresIfExists: ['offset']
1461
+ };
1462
+
1463
+ function getHTMLElementScroll(element) {
1464
+ return {
1465
+ scrollLeft: element.scrollLeft,
1466
+ scrollTop: element.scrollTop
1467
+ };
1468
+ }
1469
+
1470
+ function getNodeScroll(node) {
1471
+ if (node === getWindow(node) || !isHTMLElement(node)) {
1472
+ return getWindowScroll(node);
1473
+ } else {
1474
+ return getHTMLElementScroll(node);
1475
+ }
1476
+ }
1477
+
1478
+ function isElementScaled(element) {
1479
+ var rect = element.getBoundingClientRect();
1480
+ var scaleX = round(rect.width) / element.offsetWidth || 1;
1481
+ var scaleY = round(rect.height) / element.offsetHeight || 1;
1482
+ return scaleX !== 1 || scaleY !== 1;
1483
+ } // Returns the composite rect of an element relative to its offsetParent.
1484
+ // Composite means it takes into account transforms as well as layout.
1485
+
1486
+
1487
+ function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
1488
+ if (isFixed === void 0) {
1489
+ isFixed = false;
1490
+ }
1491
+
1492
+ var isOffsetParentAnElement = isHTMLElement(offsetParent);
1493
+ var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
1494
+ var documentElement = getDocumentElement(offsetParent);
1495
+ var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled);
1496
+ var scroll = {
1497
+ scrollLeft: 0,
1498
+ scrollTop: 0
1499
+ };
1500
+ var offsets = {
1501
+ x: 0,
1502
+ y: 0
1503
+ };
1504
+
1505
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1506
+ if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078
1507
+ isScrollParent(documentElement)) {
1508
+ scroll = getNodeScroll(offsetParent);
1509
+ }
1510
+
1511
+ if (isHTMLElement(offsetParent)) {
1512
+ offsets = getBoundingClientRect(offsetParent, true);
1513
+ offsets.x += offsetParent.clientLeft;
1514
+ offsets.y += offsetParent.clientTop;
1515
+ } else if (documentElement) {
1516
+ offsets.x = getWindowScrollBarX(documentElement);
1517
+ }
1518
+ }
1519
+
1520
+ return {
1521
+ x: rect.left + scroll.scrollLeft - offsets.x,
1522
+ y: rect.top + scroll.scrollTop - offsets.y,
1523
+ width: rect.width,
1524
+ height: rect.height
1525
+ };
1526
+ }
1527
+
1528
+ function order(modifiers) {
1529
+ var map = new Map();
1530
+ var visited = new Set();
1531
+ var result = [];
1532
+ modifiers.forEach(function (modifier) {
1533
+ map.set(modifier.name, modifier);
1534
+ }); // On visiting object, check for its dependencies and visit them recursively
1535
+
1536
+ function sort(modifier) {
1537
+ visited.add(modifier.name);
1538
+ var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
1539
+ requires.forEach(function (dep) {
1540
+ if (!visited.has(dep)) {
1541
+ var depModifier = map.get(dep);
1542
+
1543
+ if (depModifier) {
1544
+ sort(depModifier);
1545
+ }
1546
+ }
1547
+ });
1548
+ result.push(modifier);
1549
+ }
1550
+
1551
+ modifiers.forEach(function (modifier) {
1552
+ if (!visited.has(modifier.name)) {
1553
+ // check for visited object
1554
+ sort(modifier);
1555
+ }
1556
+ });
1557
+ return result;
1558
+ }
1559
+
1560
+ function orderModifiers(modifiers) {
1561
+ // order based on dependencies
1562
+ var orderedModifiers = order(modifiers); // order based on phase
1563
+
1564
+ return modifierPhases.reduce(function (acc, phase) {
1565
+ return acc.concat(orderedModifiers.filter(function (modifier) {
1566
+ return modifier.phase === phase;
1567
+ }));
1568
+ }, []);
1569
+ }
1570
+
1571
+ function debounce(fn) {
1572
+ var pending;
1573
+ return function () {
1574
+ if (!pending) {
1575
+ pending = new Promise(function (resolve) {
1576
+ Promise.resolve().then(function () {
1577
+ pending = undefined;
1578
+ resolve(fn());
1579
+ });
1580
+ });
1581
+ }
1582
+
1583
+ return pending;
1584
+ };
1585
+ }
1586
+
1587
+ function format(str) {
1588
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1589
+ args[_key - 1] = arguments[_key];
1590
+ }
1591
+
1592
+ return [].concat(args).reduce(function (p, c) {
1593
+ return p.replace(/%s/, c);
1594
+ }, str);
1595
+ }
1596
+
1597
+ var INVALID_MODIFIER_ERROR = 'Popper: modifier "%s" provided an invalid %s property, expected %s but got %s';
1598
+ var MISSING_DEPENDENCY_ERROR = 'Popper: modifier "%s" requires "%s", but "%s" modifier is not available';
1599
+ var VALID_PROPERTIES = ['name', 'enabled', 'phase', 'fn', 'effect', 'requires', 'options'];
1600
+ function validateModifiers(modifiers) {
1601
+ modifiers.forEach(function (modifier) {
1602
+ [].concat(Object.keys(modifier), VALID_PROPERTIES) // IE11-compatible replacement for `new Set(iterable)`
1603
+ .filter(function (value, index, self) {
1604
+ return self.indexOf(value) === index;
1605
+ }).forEach(function (key) {
1606
+ switch (key) {
1607
+ case 'name':
1608
+ if (typeof modifier.name !== 'string') {
1609
+ console.error(format(INVALID_MODIFIER_ERROR, String(modifier.name), '"name"', '"string"', "\"" + String(modifier.name) + "\""));
1610
+ }
1611
+
1612
+ break;
1613
+
1614
+ case 'enabled':
1615
+ if (typeof modifier.enabled !== 'boolean') {
1616
+ console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"enabled"', '"boolean"', "\"" + String(modifier.enabled) + "\""));
1617
+ }
1618
+
1619
+ break;
1620
+
1621
+ case 'phase':
1622
+ if (modifierPhases.indexOf(modifier.phase) < 0) {
1623
+ console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"phase"', "either " + modifierPhases.join(', '), "\"" + String(modifier.phase) + "\""));
1624
+ }
1625
+
1626
+ break;
1627
+
1628
+ case 'fn':
1629
+ if (typeof modifier.fn !== 'function') {
1630
+ console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"fn"', '"function"', "\"" + String(modifier.fn) + "\""));
1631
+ }
1632
+
1633
+ break;
1634
+
1635
+ case 'effect':
1636
+ if (modifier.effect != null && typeof modifier.effect !== 'function') {
1637
+ console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"effect"', '"function"', "\"" + String(modifier.fn) + "\""));
1638
+ }
1639
+
1640
+ break;
1641
+
1642
+ case 'requires':
1643
+ if (modifier.requires != null && !Array.isArray(modifier.requires)) {
1644
+ console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requires"', '"array"', "\"" + String(modifier.requires) + "\""));
1645
+ }
1646
+
1647
+ break;
1648
+
1649
+ case 'requiresIfExists':
1650
+ if (!Array.isArray(modifier.requiresIfExists)) {
1651
+ console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requiresIfExists"', '"array"', "\"" + String(modifier.requiresIfExists) + "\""));
1652
+ }
1653
+
1654
+ break;
1655
+
1656
+ case 'options':
1657
+ case 'data':
1658
+ break;
1659
+
1660
+ default:
1661
+ console.error("PopperJS: an invalid property has been provided to the \"" + modifier.name + "\" modifier, valid properties are " + VALID_PROPERTIES.map(function (s) {
1662
+ return "\"" + s + "\"";
1663
+ }).join(', ') + "; but \"" + key + "\" was provided.");
1664
+ }
1665
+
1666
+ modifier.requires && modifier.requires.forEach(function (requirement) {
1667
+ if (modifiers.find(function (mod) {
1668
+ return mod.name === requirement;
1669
+ }) == null) {
1670
+ console.error(format(MISSING_DEPENDENCY_ERROR, String(modifier.name), requirement, requirement));
1671
+ }
1672
+ });
1673
+ });
1674
+ });
1675
+ }
1676
+
1677
+ function uniqueBy(arr, fn) {
1678
+ var identifiers = new Set();
1679
+ return arr.filter(function (item) {
1680
+ var identifier = fn(item);
1681
+
1682
+ if (!identifiers.has(identifier)) {
1683
+ identifiers.add(identifier);
1684
+ return true;
1685
+ }
1686
+ });
1687
+ }
1688
+
1689
+ function mergeByName(modifiers) {
1690
+ var merged = modifiers.reduce(function (merged, current) {
1691
+ var existing = merged[current.name];
1692
+ merged[current.name] = existing ? Object.assign({}, existing, current, {
1693
+ options: Object.assign({}, existing.options, current.options),
1694
+ data: Object.assign({}, existing.data, current.data)
1695
+ }) : current;
1696
+ return merged;
1697
+ }, {}); // IE11 does not support Object.values
1698
+
1699
+ return Object.keys(merged).map(function (key) {
1700
+ return merged[key];
1701
+ });
1702
+ }
1703
+
1704
+ var INVALID_ELEMENT_ERROR = 'Popper: Invalid reference or popper argument provided. They must be either a DOM element or virtual element.';
1705
+ var INFINITE_LOOP_ERROR = 'Popper: An infinite loop in the modifiers cycle has been detected! The cycle has been interrupted to prevent a browser crash.';
1706
+ var DEFAULT_OPTIONS = {
1707
+ placement: 'bottom',
1708
+ modifiers: [],
1709
+ strategy: 'absolute'
1710
+ };
1711
+
1712
+ function areValidElements() {
1713
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1714
+ args[_key] = arguments[_key];
1715
+ }
1716
+
1717
+ return !args.some(function (element) {
1718
+ return !(element && typeof element.getBoundingClientRect === 'function');
1719
+ });
1720
+ }
1721
+
1722
+ function popperGenerator(generatorOptions) {
1723
+ if (generatorOptions === void 0) {
1724
+ generatorOptions = {};
1725
+ }
1726
+
1727
+ var _generatorOptions = generatorOptions,
1728
+ _generatorOptions$def = _generatorOptions.defaultModifiers,
1729
+ defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def,
1730
+ _generatorOptions$def2 = _generatorOptions.defaultOptions,
1731
+ defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
1732
+ return function createPopper(reference, popper, options) {
1733
+ if (options === void 0) {
1734
+ options = defaultOptions;
1735
+ }
1736
+
1737
+ var state = {
1738
+ placement: 'bottom',
1739
+ orderedModifiers: [],
1740
+ options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
1741
+ modifiersData: {},
1742
+ elements: {
1743
+ reference: reference,
1744
+ popper: popper
1745
+ },
1746
+ attributes: {},
1747
+ styles: {}
1748
+ };
1749
+ var effectCleanupFns = [];
1750
+ var isDestroyed = false;
1751
+ var instance = {
1752
+ state: state,
1753
+ setOptions: function setOptions(setOptionsAction) {
1754
+ var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;
1755
+ cleanupModifierEffects();
1756
+ state.options = Object.assign({}, defaultOptions, state.options, options);
1757
+ state.scrollParents = {
1758
+ reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
1759
+ popper: listScrollParents(popper)
1760
+ }; // Orders the modifiers based on their dependencies and `phase`
1761
+ // properties
1762
+
1763
+ var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers
1764
+
1765
+ state.orderedModifiers = orderedModifiers.filter(function (m) {
1766
+ return m.enabled;
1767
+ }); // Validate the provided modifiers so that the consumer will get warned
1768
+ // if one of the modifiers is invalid for any reason
1769
+
1770
+ {
1771
+ var modifiers = uniqueBy([].concat(orderedModifiers, state.options.modifiers), function (_ref) {
1772
+ var name = _ref.name;
1773
+ return name;
1774
+ });
1775
+ validateModifiers(modifiers);
1776
+
1777
+ if (getBasePlacement(state.options.placement) === auto) {
1778
+ var flipModifier = state.orderedModifiers.find(function (_ref2) {
1779
+ var name = _ref2.name;
1780
+ return name === 'flip';
1781
+ });
1782
+
1783
+ if (!flipModifier) {
1784
+ console.error(['Popper: "auto" placements require the "flip" modifier be', 'present and enabled to work.'].join(' '));
1785
+ }
1786
+ }
1787
+
1788
+ var _getComputedStyle = getComputedStyle(popper),
1789
+ marginTop = _getComputedStyle.marginTop,
1790
+ marginRight = _getComputedStyle.marginRight,
1791
+ marginBottom = _getComputedStyle.marginBottom,
1792
+ marginLeft = _getComputedStyle.marginLeft; // We no longer take into account `margins` on the popper, and it can
1793
+ // cause bugs with positioning, so we'll warn the consumer
1794
+
1795
+
1796
+ if ([marginTop, marginRight, marginBottom, marginLeft].some(function (margin) {
1797
+ return parseFloat(margin);
1798
+ })) {
1799
+ console.warn(['Popper: CSS "margin" styles cannot be used to apply padding', 'between the popper and its reference element or boundary.', 'To replicate margin, use the `offset` modifier, as well as', 'the `padding` option in the `preventOverflow` and `flip`', 'modifiers.'].join(' '));
1800
+ }
1801
+ }
1802
+
1803
+ runModifierEffects();
1804
+ return instance.update();
1805
+ },
1806
+ // Sync update – it will always be executed, even if not necessary. This
1807
+ // is useful for low frequency updates where sync behavior simplifies the
1808
+ // logic.
1809
+ // For high frequency updates (e.g. `resize` and `scroll` events), always
1810
+ // prefer the async Popper#update method
1811
+ forceUpdate: function forceUpdate() {
1812
+ if (isDestroyed) {
1813
+ return;
1814
+ }
1815
+
1816
+ var _state$elements = state.elements,
1817
+ reference = _state$elements.reference,
1818
+ popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements
1819
+ // anymore
1820
+
1821
+ if (!areValidElements(reference, popper)) {
1822
+ {
1823
+ console.error(INVALID_ELEMENT_ERROR);
1824
+ }
1825
+
1826
+ return;
1827
+ } // Store the reference and popper rects to be read by modifiers
1828
+
1829
+
1830
+ state.rects = {
1831
+ reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'),
1832
+ popper: getLayoutRect(popper)
1833
+ }; // Modifiers have the ability to reset the current update cycle. The
1834
+ // most common use case for this is the `flip` modifier changing the
1835
+ // placement, which then needs to re-run all the modifiers, because the
1836
+ // logic was previously ran for the previous placement and is therefore
1837
+ // stale/incorrect
1838
+
1839
+ state.reset = false;
1840
+ state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier
1841
+ // is filled with the initial data specified by the modifier. This means
1842
+ // it doesn't persist and is fresh on each update.
1843
+ // To ensure persistent data, use `${name}#persistent`
1844
+
1845
+ state.orderedModifiers.forEach(function (modifier) {
1846
+ return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
1847
+ });
1848
+ var __debug_loops__ = 0;
1849
+
1850
+ for (var index = 0; index < state.orderedModifiers.length; index++) {
1851
+ {
1852
+ __debug_loops__ += 1;
1853
+
1854
+ if (__debug_loops__ > 100) {
1855
+ console.error(INFINITE_LOOP_ERROR);
1856
+ break;
1857
+ }
1858
+ }
1859
+
1860
+ if (state.reset === true) {
1861
+ state.reset = false;
1862
+ index = -1;
1863
+ continue;
1864
+ }
1865
+
1866
+ var _state$orderedModifie = state.orderedModifiers[index],
1867
+ fn = _state$orderedModifie.fn,
1868
+ _state$orderedModifie2 = _state$orderedModifie.options,
1869
+ _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,
1870
+ name = _state$orderedModifie.name;
1871
+
1872
+ if (typeof fn === 'function') {
1873
+ state = fn({
1874
+ state: state,
1875
+ options: _options,
1876
+ name: name,
1877
+ instance: instance
1878
+ }) || state;
1879
+ }
1880
+ }
1881
+ },
1882
+ // Async and optimistically optimized update – it will not be executed if
1883
+ // not necessary (debounced to run at most once-per-tick)
1884
+ update: debounce(function () {
1885
+ return new Promise(function (resolve) {
1886
+ instance.forceUpdate();
1887
+ resolve(state);
1888
+ });
1889
+ }),
1890
+ destroy: function destroy() {
1891
+ cleanupModifierEffects();
1892
+ isDestroyed = true;
1893
+ }
1894
+ };
1895
+
1896
+ if (!areValidElements(reference, popper)) {
1897
+ {
1898
+ console.error(INVALID_ELEMENT_ERROR);
1899
+ }
1900
+
1901
+ return instance;
1902
+ }
1903
+
1904
+ instance.setOptions(options).then(function (state) {
1905
+ if (!isDestroyed && options.onFirstUpdate) {
1906
+ options.onFirstUpdate(state);
1907
+ }
1908
+ }); // Modifiers have the ability to execute arbitrary code before the first
1909
+ // update cycle runs. They will be executed in the same order as the update
1910
+ // cycle. This is useful when a modifier adds some persistent data that
1911
+ // other modifiers need to use, but the modifier is run after the dependent
1912
+ // one.
1913
+
1914
+ function runModifierEffects() {
1915
+ state.orderedModifiers.forEach(function (_ref3) {
1916
+ var name = _ref3.name,
1917
+ _ref3$options = _ref3.options,
1918
+ options = _ref3$options === void 0 ? {} : _ref3$options,
1919
+ effect = _ref3.effect;
1920
+
1921
+ if (typeof effect === 'function') {
1922
+ var cleanupFn = effect({
1923
+ state: state,
1924
+ name: name,
1925
+ instance: instance,
1926
+ options: options
1927
+ });
1928
+
1929
+ var noopFn = function noopFn() {};
1930
+
1931
+ effectCleanupFns.push(cleanupFn || noopFn);
1932
+ }
1933
+ });
1934
+ }
1935
+
1936
+ function cleanupModifierEffects() {
1937
+ effectCleanupFns.forEach(function (fn) {
1938
+ return fn();
1939
+ });
1940
+ effectCleanupFns = [];
1941
+ }
1942
+
1943
+ return instance;
1944
+ };
1945
+ }
1946
+
1947
+ var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1];
1948
+ var createPopper = /*#__PURE__*/popperGenerator({
1949
+ defaultModifiers: defaultModifiers
1950
+ }); // eslint-disable-next-line import/no-unused-modules
1951
+
1952
+ /**!
1953
+ * tippy.js v6.3.7
1954
+ * (c) 2017-2021 atomiks
1955
+ * MIT License
1956
+ */
1957
+
1958
+ var ROUND_ARROW = '<svg width="16" height="6" xmlns="http://www.w3.org/2000/svg"><path d="M0 6s1.796-.013 4.67-3.615C5.851.9 6.93.006 8 0c1.07-.006 2.148.887 3.343 2.385C14.233 6.005 16 6 16 6H0z"></svg>';
1959
+ var BOX_CLASS = "tippy-box";
1960
+ var CONTENT_CLASS = "tippy-content";
1961
+ var BACKDROP_CLASS = "tippy-backdrop";
1962
+ var ARROW_CLASS = "tippy-arrow";
1963
+ var SVG_ARROW_CLASS = "tippy-svg-arrow";
1964
+ var TOUCH_OPTIONS = {
1965
+ passive: true,
1966
+ capture: true
1967
+ };
1968
+ var TIPPY_DEFAULT_APPEND_TO = function TIPPY_DEFAULT_APPEND_TO() {
1969
+ return document.body;
1970
+ };
1971
+
1972
+ function hasOwnProperty(obj, key) {
1973
+ return {}.hasOwnProperty.call(obj, key);
1974
+ }
1975
+ function getValueAtIndexOrReturn(value, index, defaultValue) {
1976
+ if (Array.isArray(value)) {
1977
+ var v = value[index];
1978
+ return v == null ? Array.isArray(defaultValue) ? defaultValue[index] : defaultValue : v;
1979
+ }
1980
+
1981
+ return value;
1982
+ }
1983
+ function isType(value, type) {
1984
+ var str = {}.toString.call(value);
1985
+ return str.indexOf('[object') === 0 && str.indexOf(type + "]") > -1;
1986
+ }
1987
+ function invokeWithArgsOrReturn(value, args) {
1988
+ return typeof value === 'function' ? value.apply(void 0, args) : value;
1989
+ }
1990
+ function debounce$1(fn, ms) {
1991
+ // Avoid wrapping in `setTimeout` if ms is 0 anyway
1992
+ if (ms === 0) {
1993
+ return fn;
1994
+ }
1995
+
1996
+ var timeout;
1997
+ return function (arg) {
1998
+ clearTimeout(timeout);
1999
+ timeout = setTimeout(function () {
2000
+ fn(arg);
2001
+ }, ms);
2002
+ };
2003
+ }
2004
+ function removeProperties(obj, keys) {
2005
+ var clone = Object.assign({}, obj);
2006
+ keys.forEach(function (key) {
2007
+ delete clone[key];
2008
+ });
2009
+ return clone;
2010
+ }
2011
+ function splitBySpaces(value) {
2012
+ return value.split(/\s+/).filter(Boolean);
2013
+ }
2014
+ function normalizeToArray(value) {
2015
+ return [].concat(value);
2016
+ }
2017
+ function pushIfUnique(arr, value) {
2018
+ if (arr.indexOf(value) === -1) {
2019
+ arr.push(value);
2020
+ }
2021
+ }
2022
+ function unique(arr) {
2023
+ return arr.filter(function (item, index) {
2024
+ return arr.indexOf(item) === index;
2025
+ });
2026
+ }
2027
+ function getBasePlacement$1(placement) {
2028
+ return placement.split('-')[0];
2029
+ }
2030
+ function arrayFrom(value) {
2031
+ return [].slice.call(value);
2032
+ }
2033
+ function removeUndefinedProps(obj) {
2034
+ return Object.keys(obj).reduce(function (acc, key) {
2035
+ if (obj[key] !== undefined) {
2036
+ acc[key] = obj[key];
2037
+ }
2038
+
2039
+ return acc;
2040
+ }, {});
2041
+ }
2042
+
2043
+ function div() {
2044
+ return document.createElement('div');
2045
+ }
2046
+ function isElement$1(value) {
2047
+ return ['Element', 'Fragment'].some(function (type) {
2048
+ return isType(value, type);
2049
+ });
2050
+ }
2051
+ function isNodeList(value) {
2052
+ return isType(value, 'NodeList');
2053
+ }
2054
+ function isMouseEvent(value) {
2055
+ return isType(value, 'MouseEvent');
2056
+ }
2057
+ function isReferenceElement(value) {
2058
+ return !!(value && value._tippy && value._tippy.reference === value);
2059
+ }
2060
+ function getArrayOfElements(value) {
2061
+ if (isElement$1(value)) {
2062
+ return [value];
2063
+ }
2064
+
2065
+ if (isNodeList(value)) {
2066
+ return arrayFrom(value);
2067
+ }
2068
+
2069
+ if (Array.isArray(value)) {
2070
+ return value;
2071
+ }
2072
+
2073
+ return arrayFrom(document.querySelectorAll(value));
2074
+ }
2075
+ function setTransitionDuration(els, value) {
2076
+ els.forEach(function (el) {
2077
+ if (el) {
2078
+ el.style.transitionDuration = value + "ms";
2079
+ }
2080
+ });
2081
+ }
2082
+ function setVisibilityState(els, state) {
2083
+ els.forEach(function (el) {
2084
+ if (el) {
2085
+ el.setAttribute('data-state', state);
2086
+ }
2087
+ });
2088
+ }
2089
+ function getOwnerDocument(elementOrElements) {
2090
+ var _element$ownerDocumen;
2091
+
2092
+ var _normalizeToArray = normalizeToArray(elementOrElements),
2093
+ element = _normalizeToArray[0]; // Elements created via a <template> have an ownerDocument with no reference to the body
2094
+
2095
+
2096
+ return element != null && (_element$ownerDocumen = element.ownerDocument) != null && _element$ownerDocumen.body ? element.ownerDocument : document;
2097
+ }
2098
+ function isCursorOutsideInteractiveBorder(popperTreeData, event) {
2099
+ var clientX = event.clientX,
2100
+ clientY = event.clientY;
2101
+ return popperTreeData.every(function (_ref) {
2102
+ var popperRect = _ref.popperRect,
2103
+ popperState = _ref.popperState,
2104
+ props = _ref.props;
2105
+ var interactiveBorder = props.interactiveBorder;
2106
+ var basePlacement = getBasePlacement$1(popperState.placement);
2107
+ var offsetData = popperState.modifiersData.offset;
2108
+
2109
+ if (!offsetData) {
2110
+ return true;
2111
+ }
2112
+
2113
+ var topDistance = basePlacement === 'bottom' ? offsetData.top.y : 0;
2114
+ var bottomDistance = basePlacement === 'top' ? offsetData.bottom.y : 0;
2115
+ var leftDistance = basePlacement === 'right' ? offsetData.left.x : 0;
2116
+ var rightDistance = basePlacement === 'left' ? offsetData.right.x : 0;
2117
+ var exceedsTop = popperRect.top - clientY + topDistance > interactiveBorder;
2118
+ var exceedsBottom = clientY - popperRect.bottom - bottomDistance > interactiveBorder;
2119
+ var exceedsLeft = popperRect.left - clientX + leftDistance > interactiveBorder;
2120
+ var exceedsRight = clientX - popperRect.right - rightDistance > interactiveBorder;
2121
+ return exceedsTop || exceedsBottom || exceedsLeft || exceedsRight;
2122
+ });
2123
+ }
2124
+ function updateTransitionEndListener(box, action, listener) {
2125
+ var method = action + "EventListener"; // some browsers apparently support `transition` (unprefixed) but only fire
2126
+ // `webkitTransitionEnd`...
2127
+
2128
+ ['transitionend', 'webkitTransitionEnd'].forEach(function (event) {
2129
+ box[method](event, listener);
2130
+ });
2131
+ }
2132
+ /**
2133
+ * Compared to xxx.contains, this function works for dom structures with shadow
2134
+ * dom
2135
+ */
2136
+
2137
+ function actualContains(parent, child) {
2138
+ var target = child;
2139
+
2140
+ while (target) {
2141
+ var _target$getRootNode;
2142
+
2143
+ if (parent.contains(target)) {
2144
+ return true;
2145
+ }
2146
+
2147
+ target = target.getRootNode == null ? void 0 : (_target$getRootNode = target.getRootNode()) == null ? void 0 : _target$getRootNode.host;
2148
+ }
2149
+
2150
+ return false;
2151
+ }
2152
+
2153
+ var currentInput = {
2154
+ isTouch: false
2155
+ };
2156
+ var lastMouseMoveTime = 0;
2157
+ /**
2158
+ * When a `touchstart` event is fired, it's assumed the user is using touch
2159
+ * input. We'll bind a `mousemove` event listener to listen for mouse input in
2160
+ * the future. This way, the `isTouch` property is fully dynamic and will handle
2161
+ * hybrid devices that use a mix of touch + mouse input.
2162
+ */
2163
+
2164
+ function onDocumentTouchStart() {
2165
+ if (currentInput.isTouch) {
2166
+ return;
2167
+ }
2168
+
2169
+ currentInput.isTouch = true;
2170
+
2171
+ if (window.performance) {
2172
+ document.addEventListener('mousemove', onDocumentMouseMove);
2173
+ }
2174
+ }
2175
+ /**
2176
+ * When two `mousemove` event are fired consecutively within 20ms, it's assumed
2177
+ * the user is using mouse input again. `mousemove` can fire on touch devices as
2178
+ * well, but very rarely that quickly.
2179
+ */
2180
+
2181
+ function onDocumentMouseMove() {
2182
+ var now = performance.now();
2183
+
2184
+ if (now - lastMouseMoveTime < 20) {
2185
+ currentInput.isTouch = false;
2186
+ document.removeEventListener('mousemove', onDocumentMouseMove);
2187
+ }
2188
+
2189
+ lastMouseMoveTime = now;
2190
+ }
2191
+ /**
2192
+ * When an element is in focus and has a tippy, leaving the tab/window and
2193
+ * returning causes it to show again. For mouse users this is unexpected, but
2194
+ * for keyboard use it makes sense.
2195
+ * TODO: find a better technique to solve this problem
2196
+ */
2197
+
2198
+ function onWindowBlur() {
2199
+ var activeElement = document.activeElement;
2200
+
2201
+ if (isReferenceElement(activeElement)) {
2202
+ var instance = activeElement._tippy;
2203
+
2204
+ if (activeElement.blur && !instance.state.isVisible) {
2205
+ activeElement.blur();
2206
+ }
2207
+ }
2208
+ }
2209
+ function bindGlobalEventListeners() {
2210
+ document.addEventListener('touchstart', onDocumentTouchStart, TOUCH_OPTIONS);
2211
+ window.addEventListener('blur', onWindowBlur);
2212
+ }
2213
+
2214
+ var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
2215
+ var isIE11 = isBrowser ? // @ts-ignore
2216
+ !!window.msCrypto : false;
2217
+
2218
+ function createMemoryLeakWarning(method) {
2219
+ var txt = method === 'destroy' ? 'n already-' : ' ';
2220
+ return [method + "() was called on a" + txt + "destroyed instance. This is a no-op but", 'indicates a potential memory leak.'].join(' ');
2221
+ }
2222
+ function clean(value) {
2223
+ var spacesAndTabs = /[ \t]{2,}/g;
2224
+ var lineStartWithSpaces = /^[ \t]*/gm;
2225
+ return value.replace(spacesAndTabs, ' ').replace(lineStartWithSpaces, '').trim();
2226
+ }
2227
+
2228
+ function getDevMessage(message) {
2229
+ return clean("\n %ctippy.js\n\n %c" + clean(message) + "\n\n %c\uD83D\uDC77\u200D This is a development-only message. It will be removed in production.\n ");
2230
+ }
2231
+
2232
+ function getFormattedMessage(message) {
2233
+ return [getDevMessage(message), // title
2234
+ 'color: #00C584; font-size: 1.3em; font-weight: bold;', // message
2235
+ 'line-height: 1.5', // footer
2236
+ 'color: #a6a095;'];
2237
+ } // Assume warnings and errors never have the same message
2238
+
2239
+ var visitedMessages;
2240
+
2241
+ {
2242
+ resetVisitedMessages();
2243
+ }
2244
+
2245
+ function resetVisitedMessages() {
2246
+ visitedMessages = new Set();
2247
+ }
2248
+ function warnWhen(condition, message) {
2249
+ if (condition && !visitedMessages.has(message)) {
2250
+ var _console;
2251
+
2252
+ visitedMessages.add(message);
2253
+
2254
+ (_console = console).warn.apply(_console, getFormattedMessage(message));
2255
+ }
2256
+ }
2257
+ function errorWhen(condition, message) {
2258
+ if (condition && !visitedMessages.has(message)) {
2259
+ var _console2;
2260
+
2261
+ visitedMessages.add(message);
2262
+
2263
+ (_console2 = console).error.apply(_console2, getFormattedMessage(message));
2264
+ }
2265
+ }
2266
+ function validateTargets(targets) {
2267
+ var didPassFalsyValue = !targets;
2268
+ var didPassPlainObject = Object.prototype.toString.call(targets) === '[object Object]' && !targets.addEventListener;
2269
+ errorWhen(didPassFalsyValue, ['tippy() was passed', '`' + String(targets) + '`', 'as its targets (first) argument. Valid types are: String, Element,', 'Element[], or NodeList.'].join(' '));
2270
+ errorWhen(didPassPlainObject, ['tippy() was passed a plain object which is not supported as an argument', 'for virtual positioning. Use props.getReferenceClientRect instead.'].join(' '));
2271
+ }
2272
+
2273
+ var pluginProps = {
2274
+ animateFill: false,
2275
+ followCursor: false,
2276
+ inlinePositioning: false,
2277
+ sticky: false
2278
+ };
2279
+ var renderProps = {
2280
+ allowHTML: false,
2281
+ animation: 'fade',
2282
+ arrow: true,
2283
+ content: '',
2284
+ inertia: false,
2285
+ maxWidth: 350,
2286
+ role: 'tooltip',
2287
+ theme: '',
2288
+ zIndex: 9999
2289
+ };
2290
+ var defaultProps = Object.assign({
2291
+ appendTo: TIPPY_DEFAULT_APPEND_TO,
2292
+ aria: {
2293
+ content: 'auto',
2294
+ expanded: 'auto'
2295
+ },
2296
+ delay: 0,
2297
+ duration: [300, 250],
2298
+ getReferenceClientRect: null,
2299
+ hideOnClick: true,
2300
+ ignoreAttributes: false,
2301
+ interactive: false,
2302
+ interactiveBorder: 2,
2303
+ interactiveDebounce: 0,
2304
+ moveTransition: '',
2305
+ offset: [0, 10],
2306
+ onAfterUpdate: function onAfterUpdate() {},
2307
+ onBeforeUpdate: function onBeforeUpdate() {},
2308
+ onCreate: function onCreate() {},
2309
+ onDestroy: function onDestroy() {},
2310
+ onHidden: function onHidden() {},
2311
+ onHide: function onHide() {},
2312
+ onMount: function onMount() {},
2313
+ onShow: function onShow() {},
2314
+ onShown: function onShown() {},
2315
+ onTrigger: function onTrigger() {},
2316
+ onUntrigger: function onUntrigger() {},
2317
+ onClickOutside: function onClickOutside() {},
2318
+ placement: 'top',
2319
+ plugins: [],
2320
+ popperOptions: {},
2321
+ render: null,
2322
+ showOnCreate: false,
2323
+ touch: true,
2324
+ trigger: 'mouseenter focus',
2325
+ triggerTarget: null
2326
+ }, pluginProps, renderProps);
2327
+ var defaultKeys = Object.keys(defaultProps);
2328
+ var setDefaultProps = function setDefaultProps(partialProps) {
2329
+ /* istanbul ignore else */
2330
+ {
2331
+ validateProps(partialProps, []);
2332
+ }
2333
+
2334
+ var keys = Object.keys(partialProps);
2335
+ keys.forEach(function (key) {
2336
+ defaultProps[key] = partialProps[key];
2337
+ });
2338
+ };
2339
+ function getExtendedPassedProps(passedProps) {
2340
+ var plugins = passedProps.plugins || [];
2341
+ var pluginProps = plugins.reduce(function (acc, plugin) {
2342
+ var name = plugin.name,
2343
+ defaultValue = plugin.defaultValue;
2344
+
2345
+ if (name) {
2346
+ var _name;
2347
+
2348
+ acc[name] = passedProps[name] !== undefined ? passedProps[name] : (_name = defaultProps[name]) != null ? _name : defaultValue;
2349
+ }
2350
+
2351
+ return acc;
2352
+ }, {});
2353
+ return Object.assign({}, passedProps, pluginProps);
2354
+ }
2355
+ function getDataAttributeProps(reference, plugins) {
2356
+ var propKeys = plugins ? Object.keys(getExtendedPassedProps(Object.assign({}, defaultProps, {
2357
+ plugins: plugins
2358
+ }))) : defaultKeys;
2359
+ var props = propKeys.reduce(function (acc, key) {
2360
+ var valueAsString = (reference.getAttribute("data-tippy-" + key) || '').trim();
2361
+
2362
+ if (!valueAsString) {
2363
+ return acc;
2364
+ }
2365
+
2366
+ if (key === 'content') {
2367
+ acc[key] = valueAsString;
2368
+ } else {
2369
+ try {
2370
+ acc[key] = JSON.parse(valueAsString);
2371
+ } catch (e) {
2372
+ acc[key] = valueAsString;
2373
+ }
2374
+ }
2375
+
2376
+ return acc;
2377
+ }, {});
2378
+ return props;
2379
+ }
2380
+ function evaluateProps(reference, props) {
2381
+ var out = Object.assign({}, props, {
2382
+ content: invokeWithArgsOrReturn(props.content, [reference])
2383
+ }, props.ignoreAttributes ? {} : getDataAttributeProps(reference, props.plugins));
2384
+ out.aria = Object.assign({}, defaultProps.aria, out.aria);
2385
+ out.aria = {
2386
+ expanded: out.aria.expanded === 'auto' ? props.interactive : out.aria.expanded,
2387
+ content: out.aria.content === 'auto' ? props.interactive ? null : 'describedby' : out.aria.content
2388
+ };
2389
+ return out;
2390
+ }
2391
+ function validateProps(partialProps, plugins) {
2392
+ if (partialProps === void 0) {
2393
+ partialProps = {};
2394
+ }
2395
+
2396
+ if (plugins === void 0) {
2397
+ plugins = [];
2398
+ }
2399
+
2400
+ var keys = Object.keys(partialProps);
2401
+ keys.forEach(function (prop) {
2402
+ var nonPluginProps = removeProperties(defaultProps, Object.keys(pluginProps));
2403
+ var didPassUnknownProp = !hasOwnProperty(nonPluginProps, prop); // Check if the prop exists in `plugins`
2404
+
2405
+ if (didPassUnknownProp) {
2406
+ didPassUnknownProp = plugins.filter(function (plugin) {
2407
+ return plugin.name === prop;
2408
+ }).length === 0;
2409
+ }
2410
+
2411
+ warnWhen(didPassUnknownProp, ["`" + prop + "`", "is not a valid prop. You may have spelled it incorrectly, or if it's", 'a plugin, forgot to pass it in an array as props.plugins.', '\n\n', 'All props: https://atomiks.github.io/tippyjs/v6/all-props/\n', 'Plugins: https://atomiks.github.io/tippyjs/v6/plugins/'].join(' '));
2412
+ });
2413
+ }
2414
+
2415
+ var innerHTML = function innerHTML() {
2416
+ return 'innerHTML';
2417
+ };
2418
+
2419
+ function dangerouslySetInnerHTML(element, html) {
2420
+ element[innerHTML()] = html;
2421
+ }
2422
+
2423
+ function createArrowElement(value) {
2424
+ var arrow = div();
2425
+
2426
+ if (value === true) {
2427
+ arrow.className = ARROW_CLASS;
2428
+ } else {
2429
+ arrow.className = SVG_ARROW_CLASS;
2430
+
2431
+ if (isElement$1(value)) {
2432
+ arrow.appendChild(value);
2433
+ } else {
2434
+ dangerouslySetInnerHTML(arrow, value);
2435
+ }
2436
+ }
2437
+
2438
+ return arrow;
2439
+ }
2440
+
2441
+ function setContent(content, props) {
2442
+ if (isElement$1(props.content)) {
2443
+ dangerouslySetInnerHTML(content, '');
2444
+ content.appendChild(props.content);
2445
+ } else if (typeof props.content !== 'function') {
2446
+ if (props.allowHTML) {
2447
+ dangerouslySetInnerHTML(content, props.content);
2448
+ } else {
2449
+ content.textContent = props.content;
2450
+ }
2451
+ }
2452
+ }
2453
+ function getChildren(popper) {
2454
+ var box = popper.firstElementChild;
2455
+ var boxChildren = arrayFrom(box.children);
2456
+ return {
2457
+ box: box,
2458
+ content: boxChildren.find(function (node) {
2459
+ return node.classList.contains(CONTENT_CLASS);
2460
+ }),
2461
+ arrow: boxChildren.find(function (node) {
2462
+ return node.classList.contains(ARROW_CLASS) || node.classList.contains(SVG_ARROW_CLASS);
2463
+ }),
2464
+ backdrop: boxChildren.find(function (node) {
2465
+ return node.classList.contains(BACKDROP_CLASS);
2466
+ })
2467
+ };
2468
+ }
2469
+ function render(instance) {
2470
+ var popper = div();
2471
+ var box = div();
2472
+ box.className = BOX_CLASS;
2473
+ box.setAttribute('data-state', 'hidden');
2474
+ box.setAttribute('tabindex', '-1');
2475
+ var content = div();
2476
+ content.className = CONTENT_CLASS;
2477
+ content.setAttribute('data-state', 'hidden');
2478
+ setContent(content, instance.props);
2479
+ popper.appendChild(box);
2480
+ box.appendChild(content);
2481
+ onUpdate(instance.props, instance.props);
2482
+
2483
+ function onUpdate(prevProps, nextProps) {
2484
+ var _getChildren = getChildren(popper),
2485
+ box = _getChildren.box,
2486
+ content = _getChildren.content,
2487
+ arrow = _getChildren.arrow;
2488
+
2489
+ if (nextProps.theme) {
2490
+ box.setAttribute('data-theme', nextProps.theme);
2491
+ } else {
2492
+ box.removeAttribute('data-theme');
2493
+ }
2494
+
2495
+ if (typeof nextProps.animation === 'string') {
2496
+ box.setAttribute('data-animation', nextProps.animation);
2497
+ } else {
2498
+ box.removeAttribute('data-animation');
2499
+ }
2500
+
2501
+ if (nextProps.inertia) {
2502
+ box.setAttribute('data-inertia', '');
2503
+ } else {
2504
+ box.removeAttribute('data-inertia');
2505
+ }
2506
+
2507
+ box.style.maxWidth = typeof nextProps.maxWidth === 'number' ? nextProps.maxWidth + "px" : nextProps.maxWidth;
2508
+
2509
+ if (nextProps.role) {
2510
+ box.setAttribute('role', nextProps.role);
2511
+ } else {
2512
+ box.removeAttribute('role');
2513
+ }
2514
+
2515
+ if (prevProps.content !== nextProps.content || prevProps.allowHTML !== nextProps.allowHTML) {
2516
+ setContent(content, instance.props);
2517
+ }
2518
+
2519
+ if (nextProps.arrow) {
2520
+ if (!arrow) {
2521
+ box.appendChild(createArrowElement(nextProps.arrow));
2522
+ } else if (prevProps.arrow !== nextProps.arrow) {
2523
+ box.removeChild(arrow);
2524
+ box.appendChild(createArrowElement(nextProps.arrow));
2525
+ }
2526
+ } else if (arrow) {
2527
+ box.removeChild(arrow);
2528
+ }
2529
+ }
2530
+
2531
+ return {
2532
+ popper: popper,
2533
+ onUpdate: onUpdate
2534
+ };
2535
+ } // Runtime check to identify if the render function is the default one; this
2536
+ // way we can apply default CSS transitions logic and it can be tree-shaken away
2537
+
2538
+ render.$$tippy = true;
2539
+
2540
+ var idCounter = 1;
2541
+ var mouseMoveListeners = []; // Used by `hideAll()`
2542
+
2543
+ var mountedInstances = [];
2544
+ function createTippy(reference, passedProps) {
2545
+ var props = evaluateProps(reference, Object.assign({}, defaultProps, getExtendedPassedProps(removeUndefinedProps(passedProps)))); // ===========================================================================
2546
+ // 🔒 Private members
2547
+ // ===========================================================================
2548
+
2549
+ var showTimeout;
2550
+ var hideTimeout;
2551
+ var scheduleHideAnimationFrame;
2552
+ var isVisibleFromClick = false;
2553
+ var didHideDueToDocumentMouseDown = false;
2554
+ var didTouchMove = false;
2555
+ var ignoreOnFirstUpdate = false;
2556
+ var lastTriggerEvent;
2557
+ var currentTransitionEndListener;
2558
+ var onFirstUpdate;
2559
+ var listeners = [];
2560
+ var debouncedOnMouseMove = debounce$1(onMouseMove, props.interactiveDebounce);
2561
+ var currentTarget; // ===========================================================================
2562
+ // 🔑 Public members
2563
+ // ===========================================================================
2564
+
2565
+ var id = idCounter++;
2566
+ var popperInstance = null;
2567
+ var plugins = unique(props.plugins);
2568
+ var state = {
2569
+ // Is the instance currently enabled?
2570
+ isEnabled: true,
2571
+ // Is the tippy currently showing and not transitioning out?
2572
+ isVisible: false,
2573
+ // Has the instance been destroyed?
2574
+ isDestroyed: false,
2575
+ // Is the tippy currently mounted to the DOM?
2576
+ isMounted: false,
2577
+ // Has the tippy finished transitioning in?
2578
+ isShown: false
2579
+ };
2580
+ var instance = {
2581
+ // properties
2582
+ id: id,
2583
+ reference: reference,
2584
+ popper: div(),
2585
+ popperInstance: popperInstance,
2586
+ props: props,
2587
+ state: state,
2588
+ plugins: plugins,
2589
+ // methods
2590
+ clearDelayTimeouts: clearDelayTimeouts,
2591
+ setProps: setProps,
2592
+ setContent: setContent,
2593
+ show: show,
2594
+ hide: hide,
2595
+ hideWithInteractivity: hideWithInteractivity,
2596
+ enable: enable,
2597
+ disable: disable,
2598
+ unmount: unmount,
2599
+ destroy: destroy
2600
+ }; // TODO: Investigate why this early return causes a TDZ error in the tests —
2601
+ // it doesn't seem to happen in the browser
2602
+
2603
+ /* istanbul ignore if */
2604
+
2605
+ if (!props.render) {
2606
+ {
2607
+ errorWhen(true, 'render() function has not been supplied.');
2608
+ }
2609
+
2610
+ return instance;
2611
+ } // ===========================================================================
2612
+ // Initial mutations
2613
+ // ===========================================================================
2614
+
2615
+
2616
+ var _props$render = props.render(instance),
2617
+ popper = _props$render.popper,
2618
+ onUpdate = _props$render.onUpdate;
2619
+
2620
+ popper.setAttribute('data-tippy-root', '');
2621
+ popper.id = "tippy-" + instance.id;
2622
+ instance.popper = popper;
2623
+ reference._tippy = instance;
2624
+ popper._tippy = instance;
2625
+ var pluginsHooks = plugins.map(function (plugin) {
2626
+ return plugin.fn(instance);
2627
+ });
2628
+ var hasAriaExpanded = reference.hasAttribute('aria-expanded');
2629
+ addListeners();
2630
+ handleAriaExpandedAttribute();
2631
+ handleStyles();
2632
+ invokeHook('onCreate', [instance]);
2633
+
2634
+ if (props.showOnCreate) {
2635
+ scheduleShow();
2636
+ } // Prevent a tippy with a delay from hiding if the cursor left then returned
2637
+ // before it started hiding
2638
+
2639
+
2640
+ popper.addEventListener('mouseenter', function () {
2641
+ if (instance.props.interactive && instance.state.isVisible) {
2642
+ instance.clearDelayTimeouts();
2643
+ }
2644
+ });
2645
+ popper.addEventListener('mouseleave', function () {
2646
+ if (instance.props.interactive && instance.props.trigger.indexOf('mouseenter') >= 0) {
2647
+ getDocument().addEventListener('mousemove', debouncedOnMouseMove);
2648
+ }
2649
+ });
2650
+ return instance; // ===========================================================================
2651
+ // 🔒 Private methods
2652
+ // ===========================================================================
2653
+
2654
+ function getNormalizedTouchSettings() {
2655
+ var touch = instance.props.touch;
2656
+ return Array.isArray(touch) ? touch : [touch, 0];
2657
+ }
2658
+
2659
+ function getIsCustomTouchBehavior() {
2660
+ return getNormalizedTouchSettings()[0] === 'hold';
2661
+ }
2662
+
2663
+ function getIsDefaultRenderFn() {
2664
+ var _instance$props$rende;
2665
+
2666
+ // @ts-ignore
2667
+ return !!((_instance$props$rende = instance.props.render) != null && _instance$props$rende.$$tippy);
2668
+ }
2669
+
2670
+ function getCurrentTarget() {
2671
+ return currentTarget || reference;
2672
+ }
2673
+
2674
+ function getDocument() {
2675
+ var parent = getCurrentTarget().parentNode;
2676
+ return parent ? getOwnerDocument(parent) : document;
2677
+ }
2678
+
2679
+ function getDefaultTemplateChildren() {
2680
+ return getChildren(popper);
2681
+ }
2682
+
2683
+ function getDelay(isShow) {
2684
+ // For touch or keyboard input, force `0` delay for UX reasons
2685
+ // Also if the instance is mounted but not visible (transitioning out),
2686
+ // ignore delay
2687
+ if (instance.state.isMounted && !instance.state.isVisible || currentInput.isTouch || lastTriggerEvent && lastTriggerEvent.type === 'focus') {
2688
+ return 0;
2689
+ }
2690
+
2691
+ return getValueAtIndexOrReturn(instance.props.delay, isShow ? 0 : 1, defaultProps.delay);
2692
+ }
2693
+
2694
+ function handleStyles(fromHide) {
2695
+ if (fromHide === void 0) {
2696
+ fromHide = false;
2697
+ }
2698
+
2699
+ popper.style.pointerEvents = instance.props.interactive && !fromHide ? '' : 'none';
2700
+ popper.style.zIndex = "" + instance.props.zIndex;
2701
+ }
2702
+
2703
+ function invokeHook(hook, args, shouldInvokePropsHook) {
2704
+ if (shouldInvokePropsHook === void 0) {
2705
+ shouldInvokePropsHook = true;
2706
+ }
2707
+
2708
+ pluginsHooks.forEach(function (pluginHooks) {
2709
+ if (pluginHooks[hook]) {
2710
+ pluginHooks[hook].apply(pluginHooks, args);
2711
+ }
2712
+ });
2713
+
2714
+ if (shouldInvokePropsHook) {
2715
+ var _instance$props;
2716
+
2717
+ (_instance$props = instance.props)[hook].apply(_instance$props, args);
2718
+ }
2719
+ }
2720
+
2721
+ function handleAriaContentAttribute() {
2722
+ var aria = instance.props.aria;
2723
+
2724
+ if (!aria.content) {
2725
+ return;
2726
+ }
2727
+
2728
+ var attr = "aria-" + aria.content;
2729
+ var id = popper.id;
2730
+ var nodes = normalizeToArray(instance.props.triggerTarget || reference);
2731
+ nodes.forEach(function (node) {
2732
+ var currentValue = node.getAttribute(attr);
2733
+
2734
+ if (instance.state.isVisible) {
2735
+ node.setAttribute(attr, currentValue ? currentValue + " " + id : id);
2736
+ } else {
2737
+ var nextValue = currentValue && currentValue.replace(id, '').trim();
2738
+
2739
+ if (nextValue) {
2740
+ node.setAttribute(attr, nextValue);
2741
+ } else {
2742
+ node.removeAttribute(attr);
2743
+ }
2744
+ }
2745
+ });
2746
+ }
2747
+
2748
+ function handleAriaExpandedAttribute() {
2749
+ if (hasAriaExpanded || !instance.props.aria.expanded) {
2750
+ return;
2751
+ }
2752
+
2753
+ var nodes = normalizeToArray(instance.props.triggerTarget || reference);
2754
+ nodes.forEach(function (node) {
2755
+ if (instance.props.interactive) {
2756
+ node.setAttribute('aria-expanded', instance.state.isVisible && node === getCurrentTarget() ? 'true' : 'false');
2757
+ } else {
2758
+ node.removeAttribute('aria-expanded');
2759
+ }
2760
+ });
2761
+ }
2762
+
2763
+ function cleanupInteractiveMouseListeners() {
2764
+ getDocument().removeEventListener('mousemove', debouncedOnMouseMove);
2765
+ mouseMoveListeners = mouseMoveListeners.filter(function (listener) {
2766
+ return listener !== debouncedOnMouseMove;
2767
+ });
2768
+ }
2769
+
2770
+ function onDocumentPress(event) {
2771
+ // Moved finger to scroll instead of an intentional tap outside
2772
+ if (currentInput.isTouch) {
2773
+ if (didTouchMove || event.type === 'mousedown') {
2774
+ return;
2775
+ }
2776
+ }
2777
+
2778
+ var actualTarget = event.composedPath && event.composedPath()[0] || event.target; // Clicked on interactive popper
2779
+
2780
+ if (instance.props.interactive && actualContains(popper, actualTarget)) {
2781
+ return;
2782
+ } // Clicked on the event listeners target
2783
+
2784
+
2785
+ if (normalizeToArray(instance.props.triggerTarget || reference).some(function (el) {
2786
+ return actualContains(el, actualTarget);
2787
+ })) {
2788
+ if (currentInput.isTouch) {
2789
+ return;
2790
+ }
2791
+
2792
+ if (instance.state.isVisible && instance.props.trigger.indexOf('click') >= 0) {
2793
+ return;
2794
+ }
2795
+ } else {
2796
+ invokeHook('onClickOutside', [instance, event]);
2797
+ }
2798
+
2799
+ if (instance.props.hideOnClick === true) {
2800
+ instance.clearDelayTimeouts();
2801
+ instance.hide(); // `mousedown` event is fired right before `focus` if pressing the
2802
+ // currentTarget. This lets a tippy with `focus` trigger know that it
2803
+ // should not show
2804
+
2805
+ didHideDueToDocumentMouseDown = true;
2806
+ setTimeout(function () {
2807
+ didHideDueToDocumentMouseDown = false;
2808
+ }); // The listener gets added in `scheduleShow()`, but this may be hiding it
2809
+ // before it shows, and hide()'s early bail-out behavior can prevent it
2810
+ // from being cleaned up
2811
+
2812
+ if (!instance.state.isMounted) {
2813
+ removeDocumentPress();
2814
+ }
2815
+ }
2816
+ }
2817
+
2818
+ function onTouchMove() {
2819
+ didTouchMove = true;
2820
+ }
2821
+
2822
+ function onTouchStart() {
2823
+ didTouchMove = false;
2824
+ }
2825
+
2826
+ function addDocumentPress() {
2827
+ var doc = getDocument();
2828
+ doc.addEventListener('mousedown', onDocumentPress, true);
2829
+ doc.addEventListener('touchend', onDocumentPress, TOUCH_OPTIONS);
2830
+ doc.addEventListener('touchstart', onTouchStart, TOUCH_OPTIONS);
2831
+ doc.addEventListener('touchmove', onTouchMove, TOUCH_OPTIONS);
2832
+ }
2833
+
2834
+ function removeDocumentPress() {
2835
+ var doc = getDocument();
2836
+ doc.removeEventListener('mousedown', onDocumentPress, true);
2837
+ doc.removeEventListener('touchend', onDocumentPress, TOUCH_OPTIONS);
2838
+ doc.removeEventListener('touchstart', onTouchStart, TOUCH_OPTIONS);
2839
+ doc.removeEventListener('touchmove', onTouchMove, TOUCH_OPTIONS);
2840
+ }
2841
+
2842
+ function onTransitionedOut(duration, callback) {
2843
+ onTransitionEnd(duration, function () {
2844
+ if (!instance.state.isVisible && popper.parentNode && popper.parentNode.contains(popper)) {
2845
+ callback();
2846
+ }
2847
+ });
2848
+ }
2849
+
2850
+ function onTransitionedIn(duration, callback) {
2851
+ onTransitionEnd(duration, callback);
2852
+ }
2853
+
2854
+ function onTransitionEnd(duration, callback) {
2855
+ var box = getDefaultTemplateChildren().box;
2856
+
2857
+ function listener(event) {
2858
+ if (event.target === box) {
2859
+ updateTransitionEndListener(box, 'remove', listener);
2860
+ callback();
2861
+ }
2862
+ } // Make callback synchronous if duration is 0
2863
+ // `transitionend` won't fire otherwise
2864
+
2865
+
2866
+ if (duration === 0) {
2867
+ return callback();
2868
+ }
2869
+
2870
+ updateTransitionEndListener(box, 'remove', currentTransitionEndListener);
2871
+ updateTransitionEndListener(box, 'add', listener);
2872
+ currentTransitionEndListener = listener;
2873
+ }
2874
+
2875
+ function on(eventType, handler, options) {
2876
+ if (options === void 0) {
2877
+ options = false;
2878
+ }
2879
+
2880
+ var nodes = normalizeToArray(instance.props.triggerTarget || reference);
2881
+ nodes.forEach(function (node) {
2882
+ node.addEventListener(eventType, handler, options);
2883
+ listeners.push({
2884
+ node: node,
2885
+ eventType: eventType,
2886
+ handler: handler,
2887
+ options: options
2888
+ });
2889
+ });
2890
+ }
2891
+
2892
+ function addListeners() {
2893
+ if (getIsCustomTouchBehavior()) {
2894
+ on('touchstart', onTrigger, {
2895
+ passive: true
2896
+ });
2897
+ on('touchend', onMouseLeave, {
2898
+ passive: true
2899
+ });
2900
+ }
2901
+
2902
+ splitBySpaces(instance.props.trigger).forEach(function (eventType) {
2903
+ if (eventType === 'manual') {
2904
+ return;
2905
+ }
2906
+
2907
+ on(eventType, onTrigger);
2908
+
2909
+ switch (eventType) {
2910
+ case 'mouseenter':
2911
+ on('mouseleave', onMouseLeave);
2912
+ break;
2913
+
2914
+ case 'focus':
2915
+ on(isIE11 ? 'focusout' : 'blur', onBlurOrFocusOut);
2916
+ break;
2917
+
2918
+ case 'focusin':
2919
+ on('focusout', onBlurOrFocusOut);
2920
+ break;
2921
+ }
2922
+ });
2923
+ }
2924
+
2925
+ function removeListeners() {
2926
+ listeners.forEach(function (_ref) {
2927
+ var node = _ref.node,
2928
+ eventType = _ref.eventType,
2929
+ handler = _ref.handler,
2930
+ options = _ref.options;
2931
+ node.removeEventListener(eventType, handler, options);
2932
+ });
2933
+ listeners = [];
2934
+ }
2935
+
2936
+ function onTrigger(event) {
2937
+ var _lastTriggerEvent;
2938
+
2939
+ var shouldScheduleClickHide = false;
2940
+
2941
+ if (!instance.state.isEnabled || isEventListenerStopped(event) || didHideDueToDocumentMouseDown) {
2942
+ return;
2943
+ }
2944
+
2945
+ var wasFocused = ((_lastTriggerEvent = lastTriggerEvent) == null ? void 0 : _lastTriggerEvent.type) === 'focus';
2946
+ lastTriggerEvent = event;
2947
+ currentTarget = event.currentTarget;
2948
+ handleAriaExpandedAttribute();
2949
+
2950
+ if (!instance.state.isVisible && isMouseEvent(event)) {
2951
+ // If scrolling, `mouseenter` events can be fired if the cursor lands
2952
+ // over a new target, but `mousemove` events don't get fired. This
2953
+ // causes interactive tooltips to get stuck open until the cursor is
2954
+ // moved
2955
+ mouseMoveListeners.forEach(function (listener) {
2956
+ return listener(event);
2957
+ });
2958
+ } // Toggle show/hide when clicking click-triggered tooltips
2959
+
2960
+
2961
+ if (event.type === 'click' && (instance.props.trigger.indexOf('mouseenter') < 0 || isVisibleFromClick) && instance.props.hideOnClick !== false && instance.state.isVisible) {
2962
+ shouldScheduleClickHide = true;
2963
+ } else {
2964
+ scheduleShow(event);
2965
+ }
2966
+
2967
+ if (event.type === 'click') {
2968
+ isVisibleFromClick = !shouldScheduleClickHide;
2969
+ }
2970
+
2971
+ if (shouldScheduleClickHide && !wasFocused) {
2972
+ scheduleHide(event);
2973
+ }
2974
+ }
2975
+
2976
+ function onMouseMove(event) {
2977
+ var target = event.target;
2978
+ var isCursorOverReferenceOrPopper = getCurrentTarget().contains(target) || popper.contains(target);
2979
+
2980
+ if (event.type === 'mousemove' && isCursorOverReferenceOrPopper) {
2981
+ return;
2982
+ }
2983
+
2984
+ var popperTreeData = getNestedPopperTree().concat(popper).map(function (popper) {
2985
+ var _instance$popperInsta;
2986
+
2987
+ var instance = popper._tippy;
2988
+ var state = (_instance$popperInsta = instance.popperInstance) == null ? void 0 : _instance$popperInsta.state;
2989
+
2990
+ if (state) {
2991
+ return {
2992
+ popperRect: popper.getBoundingClientRect(),
2993
+ popperState: state,
2994
+ props: props
2995
+ };
2996
+ }
2997
+
2998
+ return null;
2999
+ }).filter(Boolean);
3000
+
3001
+ if (isCursorOutsideInteractiveBorder(popperTreeData, event)) {
3002
+ cleanupInteractiveMouseListeners();
3003
+ scheduleHide(event);
3004
+ }
3005
+ }
3006
+
3007
+ function onMouseLeave(event) {
3008
+ var shouldBail = isEventListenerStopped(event) || instance.props.trigger.indexOf('click') >= 0 && isVisibleFromClick;
3009
+
3010
+ if (shouldBail) {
3011
+ return;
3012
+ }
3013
+
3014
+ if (instance.props.interactive) {
3015
+ instance.hideWithInteractivity(event);
3016
+ return;
3017
+ }
3018
+
3019
+ scheduleHide(event);
3020
+ }
3021
+
3022
+ function onBlurOrFocusOut(event) {
3023
+ if (instance.props.trigger.indexOf('focusin') < 0 && event.target !== getCurrentTarget()) {
3024
+ return;
3025
+ } // If focus was moved to within the popper
3026
+
3027
+
3028
+ if (instance.props.interactive && event.relatedTarget && popper.contains(event.relatedTarget)) {
3029
+ return;
3030
+ }
3031
+
3032
+ scheduleHide(event);
3033
+ }
3034
+
3035
+ function isEventListenerStopped(event) {
3036
+ return currentInput.isTouch ? getIsCustomTouchBehavior() !== event.type.indexOf('touch') >= 0 : false;
3037
+ }
3038
+
3039
+ function createPopperInstance() {
3040
+ destroyPopperInstance();
3041
+ var _instance$props2 = instance.props,
3042
+ popperOptions = _instance$props2.popperOptions,
3043
+ placement = _instance$props2.placement,
3044
+ offset = _instance$props2.offset,
3045
+ getReferenceClientRect = _instance$props2.getReferenceClientRect,
3046
+ moveTransition = _instance$props2.moveTransition;
3047
+ var arrow = getIsDefaultRenderFn() ? getChildren(popper).arrow : null;
3048
+ var computedReference = getReferenceClientRect ? {
3049
+ getBoundingClientRect: getReferenceClientRect,
3050
+ contextElement: getReferenceClientRect.contextElement || getCurrentTarget()
3051
+ } : reference;
3052
+ var tippyModifier = {
3053
+ name: '$$tippy',
3054
+ enabled: true,
3055
+ phase: 'beforeWrite',
3056
+ requires: ['computeStyles'],
3057
+ fn: function fn(_ref2) {
3058
+ var state = _ref2.state;
3059
+
3060
+ if (getIsDefaultRenderFn()) {
3061
+ var _getDefaultTemplateCh = getDefaultTemplateChildren(),
3062
+ box = _getDefaultTemplateCh.box;
3063
+
3064
+ ['placement', 'reference-hidden', 'escaped'].forEach(function (attr) {
3065
+ if (attr === 'placement') {
3066
+ box.setAttribute('data-placement', state.placement);
3067
+ } else {
3068
+ if (state.attributes.popper["data-popper-" + attr]) {
3069
+ box.setAttribute("data-" + attr, '');
3070
+ } else {
3071
+ box.removeAttribute("data-" + attr);
3072
+ }
3073
+ }
3074
+ });
3075
+ state.attributes.popper = {};
3076
+ }
3077
+ }
3078
+ };
3079
+ var modifiers = [{
3080
+ name: 'offset',
3081
+ options: {
3082
+ offset: offset
3083
+ }
3084
+ }, {
3085
+ name: 'preventOverflow',
3086
+ options: {
3087
+ padding: {
3088
+ top: 2,
3089
+ bottom: 2,
3090
+ left: 5,
3091
+ right: 5
3092
+ }
3093
+ }
3094
+ }, {
3095
+ name: 'flip',
3096
+ options: {
3097
+ padding: 5
3098
+ }
3099
+ }, {
3100
+ name: 'computeStyles',
3101
+ options: {
3102
+ adaptive: !moveTransition
3103
+ }
3104
+ }, tippyModifier];
3105
+
3106
+ if (getIsDefaultRenderFn() && arrow) {
3107
+ modifiers.push({
3108
+ name: 'arrow',
3109
+ options: {
3110
+ element: arrow,
3111
+ padding: 3
3112
+ }
3113
+ });
3114
+ }
3115
+
3116
+ modifiers.push.apply(modifiers, (popperOptions == null ? void 0 : popperOptions.modifiers) || []);
3117
+ instance.popperInstance = createPopper(computedReference, popper, Object.assign({}, popperOptions, {
3118
+ placement: placement,
3119
+ onFirstUpdate: onFirstUpdate,
3120
+ modifiers: modifiers
3121
+ }));
3122
+ }
3123
+
3124
+ function destroyPopperInstance() {
3125
+ if (instance.popperInstance) {
3126
+ instance.popperInstance.destroy();
3127
+ instance.popperInstance = null;
3128
+ }
3129
+ }
3130
+
3131
+ function mount() {
3132
+ var appendTo = instance.props.appendTo;
3133
+ var parentNode; // By default, we'll append the popper to the triggerTargets's parentNode so
3134
+ // it's directly after the reference element so the elements inside the
3135
+ // tippy can be tabbed to
3136
+ // If there are clipping issues, the user can specify a different appendTo
3137
+ // and ensure focus management is handled correctly manually
3138
+
3139
+ var node = getCurrentTarget();
3140
+
3141
+ if (instance.props.interactive && appendTo === TIPPY_DEFAULT_APPEND_TO || appendTo === 'parent') {
3142
+ parentNode = node.parentNode;
3143
+ } else {
3144
+ parentNode = invokeWithArgsOrReturn(appendTo, [node]);
3145
+ } // The popper element needs to exist on the DOM before its position can be
3146
+ // updated as Popper needs to read its dimensions
3147
+
3148
+
3149
+ if (!parentNode.contains(popper)) {
3150
+ parentNode.appendChild(popper);
3151
+ }
3152
+
3153
+ instance.state.isMounted = true;
3154
+ createPopperInstance();
3155
+ /* istanbul ignore else */
3156
+
3157
+ {
3158
+ // Accessibility check
3159
+ warnWhen(instance.props.interactive && appendTo === defaultProps.appendTo && node.nextElementSibling !== popper, ['Interactive tippy element may not be accessible via keyboard', 'navigation because it is not directly after the reference element', 'in the DOM source order.', '\n\n', 'Using a wrapper <div> or <span> tag around the reference element', 'solves this by creating a new parentNode context.', '\n\n', 'Specifying `appendTo: document.body` silences this warning, but it', 'assumes you are using a focus management solution to handle', 'keyboard navigation.', '\n\n', 'See: https://atomiks.github.io/tippyjs/v6/accessibility/#interactivity'].join(' '));
3160
+ }
3161
+ }
3162
+
3163
+ function getNestedPopperTree() {
3164
+ return arrayFrom(popper.querySelectorAll('[data-tippy-root]'));
3165
+ }
3166
+
3167
+ function scheduleShow(event) {
3168
+ instance.clearDelayTimeouts();
3169
+
3170
+ if (event) {
3171
+ invokeHook('onTrigger', [instance, event]);
3172
+ }
3173
+
3174
+ addDocumentPress();
3175
+ var delay = getDelay(true);
3176
+
3177
+ var _getNormalizedTouchSe = getNormalizedTouchSettings(),
3178
+ touchValue = _getNormalizedTouchSe[0],
3179
+ touchDelay = _getNormalizedTouchSe[1];
3180
+
3181
+ if (currentInput.isTouch && touchValue === 'hold' && touchDelay) {
3182
+ delay = touchDelay;
3183
+ }
3184
+
3185
+ if (delay) {
3186
+ showTimeout = setTimeout(function () {
3187
+ instance.show();
3188
+ }, delay);
3189
+ } else {
3190
+ instance.show();
3191
+ }
3192
+ }
3193
+
3194
+ function scheduleHide(event) {
3195
+ instance.clearDelayTimeouts();
3196
+ invokeHook('onUntrigger', [instance, event]);
3197
+
3198
+ if (!instance.state.isVisible) {
3199
+ removeDocumentPress();
3200
+ return;
3201
+ } // For interactive tippies, scheduleHide is added to a document.body handler
3202
+ // from onMouseLeave so must intercept scheduled hides from mousemove/leave
3203
+ // events when trigger contains mouseenter and click, and the tip is
3204
+ // currently shown as a result of a click.
3205
+
3206
+
3207
+ if (instance.props.trigger.indexOf('mouseenter') >= 0 && instance.props.trigger.indexOf('click') >= 0 && ['mouseleave', 'mousemove'].indexOf(event.type) >= 0 && isVisibleFromClick) {
3208
+ return;
3209
+ }
3210
+
3211
+ var delay = getDelay(false);
3212
+
3213
+ if (delay) {
3214
+ hideTimeout = setTimeout(function () {
3215
+ if (instance.state.isVisible) {
3216
+ instance.hide();
3217
+ }
3218
+ }, delay);
3219
+ } else {
3220
+ // Fixes a `transitionend` problem when it fires 1 frame too
3221
+ // late sometimes, we don't want hide() to be called.
3222
+ scheduleHideAnimationFrame = requestAnimationFrame(function () {
3223
+ instance.hide();
3224
+ });
3225
+ }
3226
+ } // ===========================================================================
3227
+ // 🔑 Public methods
3228
+ // ===========================================================================
3229
+
3230
+
3231
+ function enable() {
3232
+ instance.state.isEnabled = true;
3233
+ }
3234
+
3235
+ function disable() {
3236
+ // Disabling the instance should also hide it
3237
+ // https://github.com/atomiks/tippy.js-react/issues/106
3238
+ instance.hide();
3239
+ instance.state.isEnabled = false;
3240
+ }
3241
+
3242
+ function clearDelayTimeouts() {
3243
+ clearTimeout(showTimeout);
3244
+ clearTimeout(hideTimeout);
3245
+ cancelAnimationFrame(scheduleHideAnimationFrame);
3246
+ }
3247
+
3248
+ function setProps(partialProps) {
3249
+ /* istanbul ignore else */
3250
+ {
3251
+ warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('setProps'));
3252
+ }
3253
+
3254
+ if (instance.state.isDestroyed) {
3255
+ return;
3256
+ }
3257
+
3258
+ invokeHook('onBeforeUpdate', [instance, partialProps]);
3259
+ removeListeners();
3260
+ var prevProps = instance.props;
3261
+ var nextProps = evaluateProps(reference, Object.assign({}, prevProps, removeUndefinedProps(partialProps), {
3262
+ ignoreAttributes: true
3263
+ }));
3264
+ instance.props = nextProps;
3265
+ addListeners();
3266
+
3267
+ if (prevProps.interactiveDebounce !== nextProps.interactiveDebounce) {
3268
+ cleanupInteractiveMouseListeners();
3269
+ debouncedOnMouseMove = debounce$1(onMouseMove, nextProps.interactiveDebounce);
3270
+ } // Ensure stale aria-expanded attributes are removed
3271
+
3272
+
3273
+ if (prevProps.triggerTarget && !nextProps.triggerTarget) {
3274
+ normalizeToArray(prevProps.triggerTarget).forEach(function (node) {
3275
+ node.removeAttribute('aria-expanded');
3276
+ });
3277
+ } else if (nextProps.triggerTarget) {
3278
+ reference.removeAttribute('aria-expanded');
3279
+ }
3280
+
3281
+ handleAriaExpandedAttribute();
3282
+ handleStyles();
3283
+
3284
+ if (onUpdate) {
3285
+ onUpdate(prevProps, nextProps);
3286
+ }
3287
+
3288
+ if (instance.popperInstance) {
3289
+ createPopperInstance(); // Fixes an issue with nested tippies if they are all getting re-rendered,
3290
+ // and the nested ones get re-rendered first.
3291
+ // https://github.com/atomiks/tippyjs-react/issues/177
3292
+ // TODO: find a cleaner / more efficient solution(!)
3293
+
3294
+ getNestedPopperTree().forEach(function (nestedPopper) {
3295
+ // React (and other UI libs likely) requires a rAF wrapper as it flushes
3296
+ // its work in one
3297
+ requestAnimationFrame(nestedPopper._tippy.popperInstance.forceUpdate);
3298
+ });
3299
+ }
3300
+
3301
+ invokeHook('onAfterUpdate', [instance, partialProps]);
3302
+ }
3303
+
3304
+ function setContent(content) {
3305
+ instance.setProps({
3306
+ content: content
3307
+ });
3308
+ }
3309
+
3310
+ function show() {
3311
+ /* istanbul ignore else */
3312
+ {
3313
+ warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('show'));
3314
+ } // Early bail-out
3315
+
3316
+
3317
+ var isAlreadyVisible = instance.state.isVisible;
3318
+ var isDestroyed = instance.state.isDestroyed;
3319
+ var isDisabled = !instance.state.isEnabled;
3320
+ var isTouchAndTouchDisabled = currentInput.isTouch && !instance.props.touch;
3321
+ var duration = getValueAtIndexOrReturn(instance.props.duration, 0, defaultProps.duration);
3322
+
3323
+ if (isAlreadyVisible || isDestroyed || isDisabled || isTouchAndTouchDisabled) {
3324
+ return;
3325
+ } // Normalize `disabled` behavior across browsers.
3326
+ // Firefox allows events on disabled elements, but Chrome doesn't.
3327
+ // Using a wrapper element (i.e. <span>) is recommended.
3328
+
3329
+
3330
+ if (getCurrentTarget().hasAttribute('disabled')) {
3331
+ return;
3332
+ }
3333
+
3334
+ invokeHook('onShow', [instance], false);
3335
+
3336
+ if (instance.props.onShow(instance) === false) {
3337
+ return;
3338
+ }
3339
+
3340
+ instance.state.isVisible = true;
3341
+
3342
+ if (getIsDefaultRenderFn()) {
3343
+ popper.style.visibility = 'visible';
3344
+ }
3345
+
3346
+ handleStyles();
3347
+ addDocumentPress();
3348
+
3349
+ if (!instance.state.isMounted) {
3350
+ popper.style.transition = 'none';
3351
+ } // If flipping to the opposite side after hiding at least once, the
3352
+ // animation will use the wrong placement without resetting the duration
3353
+
3354
+
3355
+ if (getIsDefaultRenderFn()) {
3356
+ var _getDefaultTemplateCh2 = getDefaultTemplateChildren(),
3357
+ box = _getDefaultTemplateCh2.box,
3358
+ content = _getDefaultTemplateCh2.content;
3359
+
3360
+ setTransitionDuration([box, content], 0);
3361
+ }
3362
+
3363
+ onFirstUpdate = function onFirstUpdate() {
3364
+ var _instance$popperInsta2;
3365
+
3366
+ if (!instance.state.isVisible || ignoreOnFirstUpdate) {
3367
+ return;
3368
+ }
3369
+
3370
+ ignoreOnFirstUpdate = true; // reflow
3371
+
3372
+ void popper.offsetHeight;
3373
+ popper.style.transition = instance.props.moveTransition;
3374
+
3375
+ if (getIsDefaultRenderFn() && instance.props.animation) {
3376
+ var _getDefaultTemplateCh3 = getDefaultTemplateChildren(),
3377
+ _box = _getDefaultTemplateCh3.box,
3378
+ _content = _getDefaultTemplateCh3.content;
3379
+
3380
+ setTransitionDuration([_box, _content], duration);
3381
+ setVisibilityState([_box, _content], 'visible');
3382
+ }
3383
+
3384
+ handleAriaContentAttribute();
3385
+ handleAriaExpandedAttribute();
3386
+ pushIfUnique(mountedInstances, instance); // certain modifiers (e.g. `maxSize`) require a second update after the
3387
+ // popper has been positioned for the first time
3388
+
3389
+ (_instance$popperInsta2 = instance.popperInstance) == null ? void 0 : _instance$popperInsta2.forceUpdate();
3390
+ invokeHook('onMount', [instance]);
3391
+
3392
+ if (instance.props.animation && getIsDefaultRenderFn()) {
3393
+ onTransitionedIn(duration, function () {
3394
+ instance.state.isShown = true;
3395
+ invokeHook('onShown', [instance]);
3396
+ });
3397
+ }
3398
+ };
3399
+
3400
+ mount();
3401
+ }
3402
+
3403
+ function hide() {
3404
+ /* istanbul ignore else */
3405
+ {
3406
+ warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('hide'));
3407
+ } // Early bail-out
3408
+
3409
+
3410
+ var isAlreadyHidden = !instance.state.isVisible;
3411
+ var isDestroyed = instance.state.isDestroyed;
3412
+ var isDisabled = !instance.state.isEnabled;
3413
+ var duration = getValueAtIndexOrReturn(instance.props.duration, 1, defaultProps.duration);
3414
+
3415
+ if (isAlreadyHidden || isDestroyed || isDisabled) {
3416
+ return;
3417
+ }
3418
+
3419
+ invokeHook('onHide', [instance], false);
3420
+
3421
+ if (instance.props.onHide(instance) === false) {
3422
+ return;
3423
+ }
3424
+
3425
+ instance.state.isVisible = false;
3426
+ instance.state.isShown = false;
3427
+ ignoreOnFirstUpdate = false;
3428
+ isVisibleFromClick = false;
3429
+
3430
+ if (getIsDefaultRenderFn()) {
3431
+ popper.style.visibility = 'hidden';
3432
+ }
3433
+
3434
+ cleanupInteractiveMouseListeners();
3435
+ removeDocumentPress();
3436
+ handleStyles(true);
3437
+
3438
+ if (getIsDefaultRenderFn()) {
3439
+ var _getDefaultTemplateCh4 = getDefaultTemplateChildren(),
3440
+ box = _getDefaultTemplateCh4.box,
3441
+ content = _getDefaultTemplateCh4.content;
3442
+
3443
+ if (instance.props.animation) {
3444
+ setTransitionDuration([box, content], duration);
3445
+ setVisibilityState([box, content], 'hidden');
3446
+ }
3447
+ }
3448
+
3449
+ handleAriaContentAttribute();
3450
+ handleAriaExpandedAttribute();
3451
+
3452
+ if (instance.props.animation) {
3453
+ if (getIsDefaultRenderFn()) {
3454
+ onTransitionedOut(duration, instance.unmount);
3455
+ }
3456
+ } else {
3457
+ instance.unmount();
3458
+ }
3459
+ }
3460
+
3461
+ function hideWithInteractivity(event) {
3462
+ /* istanbul ignore else */
3463
+ {
3464
+ warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('hideWithInteractivity'));
3465
+ }
3466
+
3467
+ getDocument().addEventListener('mousemove', debouncedOnMouseMove);
3468
+ pushIfUnique(mouseMoveListeners, debouncedOnMouseMove);
3469
+ debouncedOnMouseMove(event);
3470
+ }
3471
+
3472
+ function unmount() {
3473
+ /* istanbul ignore else */
3474
+ {
3475
+ warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('unmount'));
3476
+ }
3477
+
3478
+ if (instance.state.isVisible) {
3479
+ instance.hide();
3480
+ }
3481
+
3482
+ if (!instance.state.isMounted) {
3483
+ return;
3484
+ }
3485
+
3486
+ destroyPopperInstance(); // If a popper is not interactive, it will be appended outside the popper
3487
+ // tree by default. This seems mainly for interactive tippies, but we should
3488
+ // find a workaround if possible
3489
+
3490
+ getNestedPopperTree().forEach(function (nestedPopper) {
3491
+ nestedPopper._tippy.unmount();
3492
+ });
3493
+
3494
+ if (popper.parentNode) {
3495
+ popper.parentNode.removeChild(popper);
3496
+ }
3497
+
3498
+ mountedInstances = mountedInstances.filter(function (i) {
3499
+ return i !== instance;
3500
+ });
3501
+ instance.state.isMounted = false;
3502
+ invokeHook('onHidden', [instance]);
3503
+ }
3504
+
3505
+ function destroy() {
3506
+ /* istanbul ignore else */
3507
+ {
3508
+ warnWhen(instance.state.isDestroyed, createMemoryLeakWarning('destroy'));
3509
+ }
3510
+
3511
+ if (instance.state.isDestroyed) {
3512
+ return;
3513
+ }
3514
+
3515
+ instance.clearDelayTimeouts();
3516
+ instance.unmount();
3517
+ removeListeners();
3518
+ delete reference._tippy;
3519
+ instance.state.isDestroyed = true;
3520
+ invokeHook('onDestroy', [instance]);
3521
+ }
3522
+ }
3523
+
3524
+ function tippy(targets, optionalProps) {
3525
+ if (optionalProps === void 0) {
3526
+ optionalProps = {};
3527
+ }
3528
+
3529
+ var plugins = defaultProps.plugins.concat(optionalProps.plugins || []);
3530
+ /* istanbul ignore else */
3531
+
3532
+ {
3533
+ validateTargets(targets);
3534
+ validateProps(optionalProps, plugins);
3535
+ }
3536
+
3537
+ bindGlobalEventListeners();
3538
+ var passedProps = Object.assign({}, optionalProps, {
3539
+ plugins: plugins
3540
+ });
3541
+ var elements = getArrayOfElements(targets);
3542
+ /* istanbul ignore else */
3543
+
3544
+ {
3545
+ var isSingleContentElement = isElement$1(passedProps.content);
3546
+ var isMoreThanOneReferenceElement = elements.length > 1;
3547
+ warnWhen(isSingleContentElement && isMoreThanOneReferenceElement, ['tippy() was passed an Element as the `content` prop, but more than', 'one tippy instance was created by this invocation. This means the', 'content element will only be appended to the last tippy instance.', '\n\n', 'Instead, pass the .innerHTML of the element, or use a function that', 'returns a cloned version of the element instead.', '\n\n', '1) content: element.innerHTML\n', '2) content: () => element.cloneNode(true)'].join(' '));
3548
+ }
3549
+
3550
+ var instances = elements.reduce(function (acc, reference) {
3551
+ var instance = reference && createTippy(reference, passedProps);
3552
+
3553
+ if (instance) {
3554
+ acc.push(instance);
3555
+ }
3556
+
3557
+ return acc;
3558
+ }, []);
3559
+ return isElement$1(targets) ? instances[0] : instances;
3560
+ }
3561
+
3562
+ tippy.defaultProps = defaultProps;
3563
+ tippy.setDefaultProps = setDefaultProps;
3564
+ tippy.currentInput = currentInput;
3565
+
3566
+ // every time the popper is destroyed (i.e. a new target), removing the styles
3567
+ // and causing transitions to break for singletons when the console is open, but
3568
+ // most notably for non-transform styles being used, `gpuAcceleration: false`.
3569
+
3570
+ var applyStylesModifier = Object.assign({}, applyStyles$1, {
3571
+ effect: function effect(_ref) {
3572
+ var state = _ref.state;
3573
+ var initialStyles = {
3574
+ popper: {
3575
+ position: state.options.strategy,
3576
+ left: '0',
3577
+ top: '0',
3578
+ margin: '0'
3579
+ },
3580
+ arrow: {
3581
+ position: 'absolute'
3582
+ },
3583
+ reference: {}
3584
+ };
3585
+ Object.assign(state.elements.popper.style, initialStyles.popper);
3586
+ state.styles = initialStyles;
3587
+
3588
+ if (state.elements.arrow) {
3589
+ Object.assign(state.elements.arrow.style, initialStyles.arrow);
3590
+ } // intentionally return no cleanup function
3591
+ // return () => { ... }
3592
+
3593
+ }
3594
+ });
3595
+
3596
+ var createSingleton = function createSingleton(tippyInstances, optionalProps) {
3597
+ var _optionalProps$popper;
3598
+
3599
+ if (optionalProps === void 0) {
3600
+ optionalProps = {};
3601
+ }
3602
+
3603
+ /* istanbul ignore else */
3604
+ {
3605
+ errorWhen(!Array.isArray(tippyInstances), ['The first argument passed to createSingleton() must be an array of', 'tippy instances. The passed value was', String(tippyInstances)].join(' '));
3606
+ }
3607
+
3608
+ var individualInstances = tippyInstances;
3609
+ var references = [];
3610
+ var triggerTargets = [];
3611
+ var currentTarget;
3612
+ var overrides = optionalProps.overrides;
3613
+ var interceptSetPropsCleanups = [];
3614
+ var shownOnCreate = false;
3615
+
3616
+ function setTriggerTargets() {
3617
+ triggerTargets = individualInstances.map(function (instance) {
3618
+ return normalizeToArray(instance.props.triggerTarget || instance.reference);
3619
+ }).reduce(function (acc, item) {
3620
+ return acc.concat(item);
3621
+ }, []);
3622
+ }
3623
+
3624
+ function setReferences() {
3625
+ references = individualInstances.map(function (instance) {
3626
+ return instance.reference;
3627
+ });
3628
+ }
3629
+
3630
+ function enableInstances(isEnabled) {
3631
+ individualInstances.forEach(function (instance) {
3632
+ if (isEnabled) {
3633
+ instance.enable();
3634
+ } else {
3635
+ instance.disable();
3636
+ }
3637
+ });
3638
+ }
3639
+
3640
+ function interceptSetProps(singleton) {
3641
+ return individualInstances.map(function (instance) {
3642
+ var originalSetProps = instance.setProps;
3643
+
3644
+ instance.setProps = function (props) {
3645
+ originalSetProps(props);
3646
+
3647
+ if (instance.reference === currentTarget) {
3648
+ singleton.setProps(props);
3649
+ }
3650
+ };
3651
+
3652
+ return function () {
3653
+ instance.setProps = originalSetProps;
3654
+ };
3655
+ });
3656
+ } // have to pass singleton, as it maybe undefined on first call
3657
+
3658
+
3659
+ function prepareInstance(singleton, target) {
3660
+ var index = triggerTargets.indexOf(target); // bail-out
3661
+
3662
+ if (target === currentTarget) {
3663
+ return;
3664
+ }
3665
+
3666
+ currentTarget = target;
3667
+ var overrideProps = (overrides || []).concat('content').reduce(function (acc, prop) {
3668
+ acc[prop] = individualInstances[index].props[prop];
3669
+ return acc;
3670
+ }, {});
3671
+ singleton.setProps(Object.assign({}, overrideProps, {
3672
+ getReferenceClientRect: typeof overrideProps.getReferenceClientRect === 'function' ? overrideProps.getReferenceClientRect : function () {
3673
+ var _references$index;
3674
+
3675
+ return (_references$index = references[index]) == null ? void 0 : _references$index.getBoundingClientRect();
3676
+ }
3677
+ }));
3678
+ }
3679
+
3680
+ enableInstances(false);
3681
+ setReferences();
3682
+ setTriggerTargets();
3683
+ var plugin = {
3684
+ fn: function fn() {
3685
+ return {
3686
+ onDestroy: function onDestroy() {
3687
+ enableInstances(true);
3688
+ },
3689
+ onHidden: function onHidden() {
3690
+ currentTarget = null;
3691
+ },
3692
+ onClickOutside: function onClickOutside(instance) {
3693
+ if (instance.props.showOnCreate && !shownOnCreate) {
3694
+ shownOnCreate = true;
3695
+ currentTarget = null;
3696
+ }
3697
+ },
3698
+ onShow: function onShow(instance) {
3699
+ if (instance.props.showOnCreate && !shownOnCreate) {
3700
+ shownOnCreate = true;
3701
+ prepareInstance(instance, references[0]);
3702
+ }
3703
+ },
3704
+ onTrigger: function onTrigger(instance, event) {
3705
+ prepareInstance(instance, event.currentTarget);
3706
+ }
3707
+ };
3708
+ }
3709
+ };
3710
+ var singleton = tippy(div(), Object.assign({}, removeProperties(optionalProps, ['overrides']), {
3711
+ plugins: [plugin].concat(optionalProps.plugins || []),
3712
+ triggerTarget: triggerTargets,
3713
+ popperOptions: Object.assign({}, optionalProps.popperOptions, {
3714
+ modifiers: [].concat(((_optionalProps$popper = optionalProps.popperOptions) == null ? void 0 : _optionalProps$popper.modifiers) || [], [applyStylesModifier])
3715
+ })
3716
+ }));
3717
+ var originalShow = singleton.show;
3718
+
3719
+ singleton.show = function (target) {
3720
+ originalShow(); // first time, showOnCreate or programmatic call with no params
3721
+ // default to showing first instance
3722
+
3723
+ if (!currentTarget && target == null) {
3724
+ return prepareInstance(singleton, references[0]);
3725
+ } // triggered from event (do nothing as prepareInstance already called by onTrigger)
3726
+ // programmatic call with no params when already visible (do nothing again)
3727
+
3728
+
3729
+ if (currentTarget && target == null) {
3730
+ return;
3731
+ } // target is index of instance
3732
+
3733
+
3734
+ if (typeof target === 'number') {
3735
+ return references[target] && prepareInstance(singleton, references[target]);
3736
+ } // target is a child tippy instance
3737
+
3738
+
3739
+ if (individualInstances.indexOf(target) >= 0) {
3740
+ var ref = target.reference;
3741
+ return prepareInstance(singleton, ref);
3742
+ } // target is a ReferenceElement
3743
+
3744
+
3745
+ if (references.indexOf(target) >= 0) {
3746
+ return prepareInstance(singleton, target);
3747
+ }
3748
+ };
3749
+
3750
+ singleton.showNext = function () {
3751
+ var first = references[0];
3752
+
3753
+ if (!currentTarget) {
3754
+ return singleton.show(0);
3755
+ }
3756
+
3757
+ var index = references.indexOf(currentTarget);
3758
+ singleton.show(references[index + 1] || first);
3759
+ };
3760
+
3761
+ singleton.showPrevious = function () {
3762
+ var last = references[references.length - 1];
3763
+
3764
+ if (!currentTarget) {
3765
+ return singleton.show(last);
3766
+ }
3767
+
3768
+ var index = references.indexOf(currentTarget);
3769
+ var target = references[index - 1] || last;
3770
+ singleton.show(target);
3771
+ };
3772
+
3773
+ var originalSetProps = singleton.setProps;
3774
+
3775
+ singleton.setProps = function (props) {
3776
+ overrides = props.overrides || overrides;
3777
+ originalSetProps(props);
3778
+ };
3779
+
3780
+ singleton.setInstances = function (nextInstances) {
3781
+ enableInstances(true);
3782
+ interceptSetPropsCleanups.forEach(function (fn) {
3783
+ return fn();
3784
+ });
3785
+ individualInstances = nextInstances;
3786
+ enableInstances(false);
3787
+ setReferences();
3788
+ setTriggerTargets();
3789
+ interceptSetPropsCleanups = interceptSetProps(singleton);
3790
+ singleton.setProps({
3791
+ triggerTarget: triggerTargets
3792
+ });
3793
+ };
3794
+
3795
+ interceptSetPropsCleanups = interceptSetProps(singleton);
3796
+ return singleton;
3797
+ };
3798
+
3799
+ var animateFill = {
3800
+ name: 'animateFill',
3801
+ defaultValue: false,
3802
+ fn: function fn(instance) {
3803
+ var _instance$props$rende;
3804
+
3805
+ // @ts-ignore
3806
+ if (!((_instance$props$rende = instance.props.render) != null && _instance$props$rende.$$tippy)) {
3807
+ {
3808
+ errorWhen(instance.props.animateFill, 'The `animateFill` plugin requires the default render function.');
3809
+ }
3810
+
3811
+ return {};
3812
+ }
3813
+
3814
+ var _getChildren = getChildren(instance.popper),
3815
+ box = _getChildren.box,
3816
+ content = _getChildren.content;
3817
+
3818
+ var backdrop = instance.props.animateFill ? createBackdropElement() : null;
3819
+ return {
3820
+ onCreate: function onCreate() {
3821
+ if (backdrop) {
3822
+ box.insertBefore(backdrop, box.firstElementChild);
3823
+ box.setAttribute('data-animatefill', '');
3824
+ box.style.overflow = 'hidden';
3825
+ instance.setProps({
3826
+ arrow: false,
3827
+ animation: 'shift-away'
3828
+ });
3829
+ }
3830
+ },
3831
+ onMount: function onMount() {
3832
+ if (backdrop) {
3833
+ var transitionDuration = box.style.transitionDuration;
3834
+ var duration = Number(transitionDuration.replace('ms', '')); // The content should fade in after the backdrop has mostly filled the
3835
+ // tooltip element. `clip-path` is the other alternative but is not
3836
+ // well-supported and is buggy on some devices.
3837
+
3838
+ content.style.transitionDelay = Math.round(duration / 10) + "ms";
3839
+ backdrop.style.transitionDuration = transitionDuration;
3840
+ setVisibilityState([backdrop], 'visible');
3841
+ }
3842
+ },
3843
+ onShow: function onShow() {
3844
+ if (backdrop) {
3845
+ backdrop.style.transitionDuration = '0ms';
3846
+ }
3847
+ },
3848
+ onHide: function onHide() {
3849
+ if (backdrop) {
3850
+ setVisibilityState([backdrop], 'hidden');
3851
+ }
3852
+ }
3853
+ };
3854
+ }
3855
+ };
3856
+
3857
+ function createBackdropElement() {
3858
+ var backdrop = div();
3859
+ backdrop.className = BACKDROP_CLASS;
3860
+ setVisibilityState([backdrop], 'hidden');
3861
+ return backdrop;
3862
+ }
3863
+
3864
+ var mouseCoords = {
3865
+ clientX: 0,
3866
+ clientY: 0
3867
+ };
3868
+ var activeInstances = [];
3869
+
3870
+ function storeMouseCoords(_ref) {
3871
+ var clientX = _ref.clientX,
3872
+ clientY = _ref.clientY;
3873
+ mouseCoords = {
3874
+ clientX: clientX,
3875
+ clientY: clientY
3876
+ };
3877
+ }
3878
+
3879
+ function addMouseCoordsListener(doc) {
3880
+ doc.addEventListener('mousemove', storeMouseCoords);
3881
+ }
3882
+
3883
+ function removeMouseCoordsListener(doc) {
3884
+ doc.removeEventListener('mousemove', storeMouseCoords);
3885
+ }
3886
+
3887
+ var followCursor = {
3888
+ name: 'followCursor',
3889
+ defaultValue: false,
3890
+ fn: function fn(instance) {
3891
+ var reference = instance.reference;
3892
+ var doc = getOwnerDocument(instance.props.triggerTarget || reference);
3893
+ var isInternalUpdate = false;
3894
+ var wasFocusEvent = false;
3895
+ var isUnmounted = true;
3896
+ var prevProps = instance.props;
3897
+
3898
+ function getIsInitialBehavior() {
3899
+ return instance.props.followCursor === 'initial' && instance.state.isVisible;
3900
+ }
3901
+
3902
+ function addListener() {
3903
+ doc.addEventListener('mousemove', onMouseMove);
3904
+ }
3905
+
3906
+ function removeListener() {
3907
+ doc.removeEventListener('mousemove', onMouseMove);
3908
+ }
3909
+
3910
+ function unsetGetReferenceClientRect() {
3911
+ isInternalUpdate = true;
3912
+ instance.setProps({
3913
+ getReferenceClientRect: null
3914
+ });
3915
+ isInternalUpdate = false;
3916
+ }
3917
+
3918
+ function onMouseMove(event) {
3919
+ // If the instance is interactive, avoid updating the position unless it's
3920
+ // over the reference element
3921
+ var isCursorOverReference = event.target ? reference.contains(event.target) : true;
3922
+ var followCursor = instance.props.followCursor;
3923
+ var clientX = event.clientX,
3924
+ clientY = event.clientY;
3925
+ var rect = reference.getBoundingClientRect();
3926
+ var relativeX = clientX - rect.left;
3927
+ var relativeY = clientY - rect.top;
3928
+
3929
+ if (isCursorOverReference || !instance.props.interactive) {
3930
+ instance.setProps({
3931
+ // @ts-ignore - unneeded DOMRect properties
3932
+ getReferenceClientRect: function getReferenceClientRect() {
3933
+ var rect = reference.getBoundingClientRect();
3934
+ var x = clientX;
3935
+ var y = clientY;
3936
+
3937
+ if (followCursor === 'initial') {
3938
+ x = rect.left + relativeX;
3939
+ y = rect.top + relativeY;
3940
+ }
3941
+
3942
+ var top = followCursor === 'horizontal' ? rect.top : y;
3943
+ var right = followCursor === 'vertical' ? rect.right : x;
3944
+ var bottom = followCursor === 'horizontal' ? rect.bottom : y;
3945
+ var left = followCursor === 'vertical' ? rect.left : x;
3946
+ return {
3947
+ width: right - left,
3948
+ height: bottom - top,
3949
+ top: top,
3950
+ right: right,
3951
+ bottom: bottom,
3952
+ left: left
3953
+ };
3954
+ }
3955
+ });
3956
+ }
3957
+ }
3958
+
3959
+ function create() {
3960
+ if (instance.props.followCursor) {
3961
+ activeInstances.push({
3962
+ instance: instance,
3963
+ doc: doc
3964
+ });
3965
+ addMouseCoordsListener(doc);
3966
+ }
3967
+ }
3968
+
3969
+ function destroy() {
3970
+ activeInstances = activeInstances.filter(function (data) {
3971
+ return data.instance !== instance;
3972
+ });
3973
+
3974
+ if (activeInstances.filter(function (data) {
3975
+ return data.doc === doc;
3976
+ }).length === 0) {
3977
+ removeMouseCoordsListener(doc);
3978
+ }
3979
+ }
3980
+
3981
+ return {
3982
+ onCreate: create,
3983
+ onDestroy: destroy,
3984
+ onBeforeUpdate: function onBeforeUpdate() {
3985
+ prevProps = instance.props;
3986
+ },
3987
+ onAfterUpdate: function onAfterUpdate(_, _ref2) {
3988
+ var followCursor = _ref2.followCursor;
3989
+
3990
+ if (isInternalUpdate) {
3991
+ return;
3992
+ }
3993
+
3994
+ if (followCursor !== undefined && prevProps.followCursor !== followCursor) {
3995
+ destroy();
3996
+
3997
+ if (followCursor) {
3998
+ create();
3999
+
4000
+ if (instance.state.isMounted && !wasFocusEvent && !getIsInitialBehavior()) {
4001
+ addListener();
4002
+ }
4003
+ } else {
4004
+ removeListener();
4005
+ unsetGetReferenceClientRect();
4006
+ }
4007
+ }
4008
+ },
4009
+ onMount: function onMount() {
4010
+ if (instance.props.followCursor && !wasFocusEvent) {
4011
+ if (isUnmounted) {
4012
+ onMouseMove(mouseCoords);
4013
+ isUnmounted = false;
4014
+ }
4015
+
4016
+ if (!getIsInitialBehavior()) {
4017
+ addListener();
4018
+ }
4019
+ }
4020
+ },
4021
+ onTrigger: function onTrigger(_, event) {
4022
+ if (isMouseEvent(event)) {
4023
+ mouseCoords = {
4024
+ clientX: event.clientX,
4025
+ clientY: event.clientY
4026
+ };
4027
+ }
4028
+
4029
+ wasFocusEvent = event.type === 'focus';
4030
+ },
4031
+ onHidden: function onHidden() {
4032
+ if (instance.props.followCursor) {
4033
+ unsetGetReferenceClientRect();
4034
+ removeListener();
4035
+ isUnmounted = true;
4036
+ }
4037
+ }
4038
+ };
4039
+ }
4040
+ };
4041
+
4042
+ function getProps(props, modifier) {
4043
+ var _props$popperOptions;
4044
+
4045
+ return {
4046
+ popperOptions: Object.assign({}, props.popperOptions, {
4047
+ modifiers: [].concat((((_props$popperOptions = props.popperOptions) == null ? void 0 : _props$popperOptions.modifiers) || []).filter(function (_ref) {
4048
+ var name = _ref.name;
4049
+ return name !== modifier.name;
4050
+ }), [modifier])
4051
+ })
4052
+ };
4053
+ }
4054
+
4055
+ var inlinePositioning = {
4056
+ name: 'inlinePositioning',
4057
+ defaultValue: false,
4058
+ fn: function fn(instance) {
4059
+ var reference = instance.reference;
4060
+
4061
+ function isEnabled() {
4062
+ return !!instance.props.inlinePositioning;
4063
+ }
4064
+
4065
+ var placement;
4066
+ var cursorRectIndex = -1;
4067
+ var isInternalUpdate = false;
4068
+ var triedPlacements = [];
4069
+ var modifier = {
4070
+ name: 'tippyInlinePositioning',
4071
+ enabled: true,
4072
+ phase: 'afterWrite',
4073
+ fn: function fn(_ref2) {
4074
+ var state = _ref2.state;
4075
+
4076
+ if (isEnabled()) {
4077
+ if (triedPlacements.indexOf(state.placement) !== -1) {
4078
+ triedPlacements = [];
4079
+ }
4080
+
4081
+ if (placement !== state.placement && triedPlacements.indexOf(state.placement) === -1) {
4082
+ triedPlacements.push(state.placement);
4083
+ instance.setProps({
4084
+ // @ts-ignore - unneeded DOMRect properties
4085
+ getReferenceClientRect: function getReferenceClientRect() {
4086
+ return _getReferenceClientRect(state.placement);
4087
+ }
4088
+ });
4089
+ }
4090
+
4091
+ placement = state.placement;
4092
+ }
4093
+ }
4094
+ };
4095
+
4096
+ function _getReferenceClientRect(placement) {
4097
+ return getInlineBoundingClientRect(getBasePlacement$1(placement), reference.getBoundingClientRect(), arrayFrom(reference.getClientRects()), cursorRectIndex);
4098
+ }
4099
+
4100
+ function setInternalProps(partialProps) {
4101
+ isInternalUpdate = true;
4102
+ instance.setProps(partialProps);
4103
+ isInternalUpdate = false;
4104
+ }
4105
+
4106
+ function addModifier() {
4107
+ if (!isInternalUpdate) {
4108
+ setInternalProps(getProps(instance.props, modifier));
4109
+ }
4110
+ }
4111
+
4112
+ return {
4113
+ onCreate: addModifier,
4114
+ onAfterUpdate: addModifier,
4115
+ onTrigger: function onTrigger(_, event) {
4116
+ if (isMouseEvent(event)) {
4117
+ var rects = arrayFrom(instance.reference.getClientRects());
4118
+ var cursorRect = rects.find(function (rect) {
4119
+ return rect.left - 2 <= event.clientX && rect.right + 2 >= event.clientX && rect.top - 2 <= event.clientY && rect.bottom + 2 >= event.clientY;
4120
+ });
4121
+ var index = rects.indexOf(cursorRect);
4122
+ cursorRectIndex = index > -1 ? index : cursorRectIndex;
4123
+ }
4124
+ },
4125
+ onHidden: function onHidden() {
4126
+ cursorRectIndex = -1;
4127
+ }
4128
+ };
4129
+ }
4130
+ };
4131
+ function getInlineBoundingClientRect(currentBasePlacement, boundingRect, clientRects, cursorRectIndex) {
4132
+ // Not an inline element, or placement is not yet known
4133
+ if (clientRects.length < 2 || currentBasePlacement === null) {
4134
+ return boundingRect;
4135
+ } // There are two rects and they are disjoined
4136
+
4137
+
4138
+ if (clientRects.length === 2 && cursorRectIndex >= 0 && clientRects[0].left > clientRects[1].right) {
4139
+ return clientRects[cursorRectIndex] || boundingRect;
4140
+ }
4141
+
4142
+ switch (currentBasePlacement) {
4143
+ case 'top':
4144
+ case 'bottom':
4145
+ {
4146
+ var firstRect = clientRects[0];
4147
+ var lastRect = clientRects[clientRects.length - 1];
4148
+ var isTop = currentBasePlacement === 'top';
4149
+ var top = firstRect.top;
4150
+ var bottom = lastRect.bottom;
4151
+ var left = isTop ? firstRect.left : lastRect.left;
4152
+ var right = isTop ? firstRect.right : lastRect.right;
4153
+ var width = right - left;
4154
+ var height = bottom - top;
4155
+ return {
4156
+ top: top,
4157
+ bottom: bottom,
4158
+ left: left,
4159
+ right: right,
4160
+ width: width,
4161
+ height: height
4162
+ };
4163
+ }
4164
+
4165
+ case 'left':
4166
+ case 'right':
4167
+ {
4168
+ var minLeft = Math.min.apply(Math, clientRects.map(function (rects) {
4169
+ return rects.left;
4170
+ }));
4171
+ var maxRight = Math.max.apply(Math, clientRects.map(function (rects) {
4172
+ return rects.right;
4173
+ }));
4174
+ var measureRects = clientRects.filter(function (rect) {
4175
+ return currentBasePlacement === 'left' ? rect.left === minLeft : rect.right === maxRight;
4176
+ });
4177
+ var _top = measureRects[0].top;
4178
+ var _bottom = measureRects[measureRects.length - 1].bottom;
4179
+ var _left = minLeft;
4180
+ var _right = maxRight;
4181
+
4182
+ var _width = _right - _left;
4183
+
4184
+ var _height = _bottom - _top;
4185
+
4186
+ return {
4187
+ top: _top,
4188
+ bottom: _bottom,
4189
+ left: _left,
4190
+ right: _right,
4191
+ width: _width,
4192
+ height: _height
4193
+ };
4194
+ }
4195
+
4196
+ default:
4197
+ {
4198
+ return boundingRect;
4199
+ }
4200
+ }
4201
+ }
4202
+
4203
+ var sticky = {
4204
+ name: 'sticky',
4205
+ defaultValue: false,
4206
+ fn: function fn(instance) {
4207
+ var reference = instance.reference,
4208
+ popper = instance.popper;
4209
+
4210
+ function getReference() {
4211
+ return instance.popperInstance ? instance.popperInstance.state.elements.reference : reference;
4212
+ }
4213
+
4214
+ function shouldCheck(value) {
4215
+ return instance.props.sticky === true || instance.props.sticky === value;
4216
+ }
4217
+
4218
+ var prevRefRect = null;
4219
+ var prevPopRect = null;
4220
+
4221
+ function updatePosition() {
4222
+ var currentRefRect = shouldCheck('reference') ? getReference().getBoundingClientRect() : null;
4223
+ var currentPopRect = shouldCheck('popper') ? popper.getBoundingClientRect() : null;
4224
+
4225
+ if (currentRefRect && areRectsDifferent(prevRefRect, currentRefRect) || currentPopRect && areRectsDifferent(prevPopRect, currentPopRect)) {
4226
+ if (instance.popperInstance) {
4227
+ instance.popperInstance.update();
4228
+ }
4229
+ }
4230
+
4231
+ prevRefRect = currentRefRect;
4232
+ prevPopRect = currentPopRect;
4233
+
4234
+ if (instance.state.isMounted) {
4235
+ requestAnimationFrame(updatePosition);
4236
+ }
4237
+ }
4238
+
4239
+ return {
4240
+ onMount: function onMount() {
4241
+ if (instance.props.sticky) {
4242
+ updatePosition();
4243
+ }
4244
+ }
4245
+ };
4246
+ }
4247
+ };
4248
+
4249
+ function areRectsDifferent(rectA, rectB) {
4250
+ if (rectA && rectB) {
4251
+ return rectA.top !== rectB.top || rectA.right !== rectB.right || rectA.bottom !== rectB.bottom || rectA.left !== rectB.left;
4252
+ }
4253
+
4254
+ return true;
4255
+ }
4256
+
4257
+ tippy.setDefaultProps({
4258
+ render: render
4259
+ });
4260
+
4261
+ tippy.setDefaultProps({
4262
+ //@ts-ignore
4263
+ onShow: instance => {
4264
+ if (!instance.props.content)
4265
+ return false;
4266
+ },
4267
+ });
4268
+ function useTippy(el, opts = {}, settings = { mount: true }) {
4269
+ const vm = vue.getCurrentInstance();
4270
+ const instance = vue.ref();
4271
+ const state = vue.ref({
4272
+ isEnabled: false,
4273
+ isVisible: false,
4274
+ isDestroyed: false,
4275
+ isMounted: false,
4276
+ isShown: false,
4277
+ });
4278
+ let container = null;
4279
+ const getContainer = () => {
4280
+ if (container)
4281
+ return container;
4282
+ container = document.createDocumentFragment();
4283
+ return container;
4284
+ };
4285
+ const getContent = (content) => {
4286
+ let newContent;
4287
+ let unwrappedContent = vue.isRef(content)
4288
+ ? content.value
4289
+ : content;
4290
+ if (vue.isVNode(unwrappedContent)) {
4291
+ if (vm) {
4292
+ unwrappedContent.appContext = vm.appContext;
4293
+ }
4294
+ vue.render(unwrappedContent, getContainer());
4295
+ newContent = () => getContainer();
4296
+ }
4297
+ else if (typeof unwrappedContent === 'object') {
4298
+ let comp = vue.h(unwrappedContent);
4299
+ if (vm) {
4300
+ comp.appContext = vm.appContext;
4301
+ }
4302
+ vue.render(comp, getContainer());
4303
+ newContent = () => getContainer();
4304
+ }
4305
+ else {
4306
+ newContent = unwrappedContent;
4307
+ }
4308
+ return newContent;
4309
+ };
4310
+ const getProps = (opts) => {
4311
+ let options = {};
4312
+ if (vue.isRef(opts)) {
4313
+ options = opts.value || {};
4314
+ }
4315
+ else if (vue.isReactive(opts)) {
4316
+ options = { ...opts };
4317
+ }
4318
+ else {
4319
+ options = { ...opts };
4320
+ }
4321
+ if (options.content) {
4322
+ options.content = getContent(options.content);
4323
+ }
4324
+ if (options.triggerTarget) {
4325
+ options.triggerTarget = vue.isRef(options.triggerTarget)
4326
+ ? options.triggerTarget.value
4327
+ : options.triggerTarget;
4328
+ }
4329
+ if (!options.plugins || !Array.isArray(options.plugins)) {
4330
+ options.plugins = [];
4331
+ }
4332
+ options.plugins = options.plugins.filter((plugin) => plugin.name !== 'vueTippyReactiveState');
4333
+ options.plugins.push({
4334
+ name: 'vueTippyReactiveState',
4335
+ fn: () => {
4336
+ return {
4337
+ onCreate() {
4338
+ state.value.isEnabled = true;
4339
+ },
4340
+ onMount() {
4341
+ state.value.isMounted = true;
4342
+ },
4343
+ onShow() {
4344
+ state.value.isMounted = true;
4345
+ state.value.isVisible = true;
4346
+ },
4347
+ onShown() {
4348
+ state.value.isShown = true;
4349
+ },
4350
+ onHide() {
4351
+ state.value.isMounted = false;
4352
+ state.value.isVisible = false;
4353
+ },
4354
+ onHidden() {
4355
+ state.value.isShown = false;
4356
+ },
4357
+ onUnmounted() {
4358
+ state.value.isMounted = false;
4359
+ },
4360
+ onDestroy() {
4361
+ state.value.isDestroyed = true;
4362
+ },
4363
+ };
4364
+ }
4365
+ });
4366
+ return options;
4367
+ };
4368
+ const refresh = () => {
4369
+ if (!instance.value)
4370
+ return;
4371
+ instance.value.setProps(getProps(opts));
4372
+ };
4373
+ const refreshContent = () => {
4374
+ if (!instance.value || !opts.content)
4375
+ return;
4376
+ instance.value.setContent(getContent(opts.content));
4377
+ };
4378
+ const setContent = (value) => {
4379
+ var _a;
4380
+ (_a = instance.value) === null || _a === void 0 ? void 0 : _a.setContent(getContent(value));
4381
+ };
4382
+ const setProps = (value) => {
4383
+ var _a;
4384
+ (_a = instance.value) === null || _a === void 0 ? void 0 : _a.setProps(getProps(value));
4385
+ };
4386
+ const destroy = () => {
4387
+ if (instance.value) {
4388
+ instance.value.destroy();
4389
+ instance.value = undefined;
4390
+ }
4391
+ container = null;
4392
+ };
4393
+ const show = () => {
4394
+ var _a;
4395
+ (_a = instance.value) === null || _a === void 0 ? void 0 : _a.show();
4396
+ };
4397
+ const hide = () => {
4398
+ var _a;
4399
+ (_a = instance.value) === null || _a === void 0 ? void 0 : _a.hide();
4400
+ };
4401
+ const disable = () => {
4402
+ var _a;
4403
+ (_a = instance.value) === null || _a === void 0 ? void 0 : _a.disable();
4404
+ state.value.isEnabled = false;
4405
+ };
4406
+ const enable = () => {
4407
+ var _a;
4408
+ (_a = instance.value) === null || _a === void 0 ? void 0 : _a.enable();
4409
+ state.value.isEnabled = true;
4410
+ };
4411
+ const unmount = () => {
4412
+ var _a;
4413
+ (_a = instance.value) === null || _a === void 0 ? void 0 : _a.unmount();
4414
+ };
4415
+ const mount = () => {
4416
+ if (!el)
4417
+ return;
4418
+ let target = vue.isRef(el) ? el.value : el;
4419
+ if (typeof target === 'function')
4420
+ target = target();
4421
+ if (target) {
4422
+ instance.value = tippy(target, getProps(opts));
4423
+ //@ts-ignore
4424
+ target.$tippy = response;
4425
+ }
4426
+ };
4427
+ const response = {
4428
+ tippy: instance,
4429
+ refresh,
4430
+ refreshContent,
4431
+ setContent,
4432
+ setProps,
4433
+ destroy,
4434
+ hide,
4435
+ show,
4436
+ disable,
4437
+ enable,
4438
+ unmount,
4439
+ mount,
4440
+ state,
4441
+ };
4442
+ if (settings.mount) {
4443
+ if (vm) {
4444
+ if (vm.isMounted) {
4445
+ mount();
4446
+ }
4447
+ else {
4448
+ vue.onMounted(mount);
4449
+ }
4450
+ vue.onUnmounted(() => {
4451
+ destroy();
4452
+ });
4453
+ }
4454
+ else {
4455
+ mount();
4456
+ }
4457
+ }
4458
+ if (vue.isRef(opts) || vue.isReactive(opts)) {
4459
+ vue.watch(opts, refresh, { immediate: false });
4460
+ }
4461
+ else if (vue.isRef(opts.content)) {
4462
+ vue.watch(opts.content, refreshContent, { immediate: false });
4463
+ }
4464
+ return response;
4465
+ }
4466
+
4467
+ function useTippyComponent(opts = {}, children) {
4468
+ const instance = vue.ref();
4469
+ return {
4470
+ instance,
4471
+ TippyComponent: vue.h(TippyComponent, {
4472
+ ...opts,
4473
+ onVnodeMounted: (vnode) => {
4474
+ //@ts-ignore
4475
+ instance.value = vnode.component.ctx;
4476
+ },
4477
+ }, children),
4478
+ };
4479
+ }
4480
+
4481
+ function useSingleton(instances, optionalProps) {
4482
+ const singleton = vue.ref();
4483
+ vue.onMounted(() => {
4484
+ const pendingTippyInstances = Array.isArray(instances)
4485
+ ? instances.map(i => i.value)
4486
+ : typeof instances === 'function'
4487
+ ? instances()
4488
+ : instances.value;
4489
+ const tippyInstances = pendingTippyInstances
4490
+ .map((instance) => {
4491
+ if (instance instanceof Element) {
4492
+ //@ts-ignore
4493
+ return instance._tippy;
4494
+ }
4495
+ return instance;
4496
+ })
4497
+ .filter(Boolean);
4498
+ singleton.value = createSingleton(tippyInstances, optionalProps
4499
+ ? { allowHTML: true, ...optionalProps }
4500
+ : { allowHTML: true });
4501
+ });
4502
+ return {
4503
+ singleton,
4504
+ };
4505
+ }
4506
+
4507
+ const TippyComponent = vue.defineComponent({
4508
+ props: {
4509
+ to: {
4510
+ type: [String, Function],
4511
+ },
4512
+ tag: {
4513
+ type: String,
4514
+ default: 'span'
4515
+ },
4516
+ contentTag: {
4517
+ type: String,
4518
+ default: 'span'
4519
+ },
4520
+ contentClass: {
4521
+ type: String,
4522
+ default: null
4523
+ },
4524
+ appendTo: { default: () => tippy.defaultProps['appendTo'] },
4525
+ aria: { default: () => tippy.defaultProps['aria'] },
4526
+ delay: { default: () => tippy.defaultProps['delay'] },
4527
+ duration: { default: () => tippy.defaultProps['duration'] },
4528
+ getReferenceClientRect: { default: () => tippy.defaultProps['getReferenceClientRect'] },
4529
+ hideOnClick: { type: [Boolean, String], default: () => tippy.defaultProps['hideOnClick'] },
4530
+ ignoreAttributes: { type: Boolean, default: () => tippy.defaultProps['ignoreAttributes'] },
4531
+ interactive: { type: Boolean, default: () => tippy.defaultProps['interactive'] },
4532
+ interactiveBorder: { default: () => tippy.defaultProps['interactiveBorder'] },
4533
+ interactiveDebounce: { default: () => tippy.defaultProps['interactiveDebounce'] },
4534
+ moveTransition: { default: () => tippy.defaultProps['moveTransition'] },
4535
+ offset: { default: () => tippy.defaultProps['offset'] },
4536
+ onAfterUpdate: { default: () => tippy.defaultProps['onAfterUpdate'] },
4537
+ onBeforeUpdate: { default: () => tippy.defaultProps['onBeforeUpdate'] },
4538
+ onCreate: { default: () => tippy.defaultProps['onCreate'] },
4539
+ onDestroy: { default: () => tippy.defaultProps['onDestroy'] },
4540
+ onHidden: { default: () => tippy.defaultProps['onHidden'] },
4541
+ onHide: { default: () => tippy.defaultProps['onHide'] },
4542
+ onMount: { default: () => tippy.defaultProps['onMount'] },
4543
+ onShow: { default: () => tippy.defaultProps['onShow'] },
4544
+ onShown: { default: () => tippy.defaultProps['onShown'] },
4545
+ onTrigger: { default: () => tippy.defaultProps['onTrigger'] },
4546
+ onUntrigger: { default: () => tippy.defaultProps['onUntrigger'] },
4547
+ onClickOutside: { default: () => tippy.defaultProps['onClickOutside'] },
4548
+ placement: { default: () => tippy.defaultProps['placement'] },
4549
+ plugins: { default: () => tippy.defaultProps['plugins'] },
4550
+ popperOptions: { default: () => tippy.defaultProps['popperOptions'] },
4551
+ render: { default: () => tippy.defaultProps['render'] },
4552
+ showOnCreate: { type: Boolean, default: () => tippy.defaultProps['showOnCreate'] },
4553
+ touch: { type: [Boolean, String, Array], default: () => tippy.defaultProps['touch'] },
4554
+ trigger: { default: () => tippy.defaultProps['trigger'] },
4555
+ triggerTarget: { default: () => tippy.defaultProps['triggerTarget'] },
4556
+ animateFill: { type: Boolean, default: () => tippy.defaultProps['animateFill'] },
4557
+ followCursor: { type: [Boolean, String], default: () => tippy.defaultProps['followCursor'] },
4558
+ inlinePositioning: { type: Boolean, default: () => tippy.defaultProps['inlinePositioning'] },
4559
+ sticky: { type: [Boolean, String], default: () => tippy.defaultProps['sticky'] },
4560
+ allowHTML: { type: Boolean, default: () => tippy.defaultProps['allowHTML'] },
4561
+ animation: { default: () => tippy.defaultProps['animation'] },
4562
+ arrow: { default: () => tippy.defaultProps['arrow'] },
4563
+ content: { default: () => tippy.defaultProps['content'] },
4564
+ inertia: { default: () => tippy.defaultProps['inertia'] },
4565
+ maxWidth: { default: () => tippy.defaultProps['maxWidth'] },
4566
+ role: { default: () => tippy.defaultProps['role'] },
4567
+ theme: { default: () => tippy.defaultProps['theme'] },
4568
+ zIndex: { default: () => tippy.defaultProps['zIndex'] }
4569
+ },
4570
+ emits: ['state'],
4571
+ setup(props, { slots, emit, expose }) {
4572
+ const elem = vue.ref();
4573
+ const contentElem = vue.ref();
4574
+ const mounted = vue.ref(false);
4575
+ const getOptions = () => {
4576
+ let options = { ...props };
4577
+ for (const prop of ['to', 'tag', 'contentTag', 'contentClass']) {
4578
+ if (options.hasOwnProperty(prop)) {
4579
+ // @ts-ignore
4580
+ delete options[prop];
4581
+ }
4582
+ }
4583
+ return options;
4584
+ };
4585
+ let target = elem;
4586
+ if (props.to) {
4587
+ if (typeof Element !== 'undefined' && props.to instanceof Element) {
4588
+ target = () => props.to;
4589
+ }
4590
+ else if (typeof props.to === 'string' || props.to instanceof String) {
4591
+ target = () => document.querySelector(props.to);
4592
+ }
4593
+ }
4594
+ const tippy = useTippy(target, getOptions());
4595
+ vue.onMounted(() => {
4596
+ mounted.value = true;
4597
+ vue.nextTick(() => {
4598
+ if (slots.content)
4599
+ tippy.setContent(() => contentElem.value);
4600
+ });
4601
+ });
4602
+ vue.watch(tippy.state, () => {
4603
+ emit('state', vue.unref(tippy.state));
4604
+ }, { immediate: true, deep: true });
4605
+ vue.watch(() => props, () => {
4606
+ tippy.setProps(getOptions());
4607
+ if (slots.content)
4608
+ tippy.setContent(() => contentElem.value);
4609
+ });
4610
+ let exposed = vue.reactive({
4611
+ elem,
4612
+ contentElem,
4613
+ mounted,
4614
+ ...tippy
4615
+ });
4616
+ expose(exposed);
4617
+ return () => {
4618
+ const slot = slots.default ? slots.default(exposed) : [];
4619
+ return vue.h(props.tag, { ref: elem, 'data-v-tippy': '' }, slots.content ? [
4620
+ slot,
4621
+ vue.h(props.contentTag, {
4622
+ ref: contentElem,
4623
+ style: { display: mounted.value ? 'inherit' : 'none' },
4624
+ class: props.contentClass
4625
+ }, slots.content(exposed)),
4626
+ ] : slot);
4627
+ };
4628
+ },
4629
+ });
4630
+
4631
+ const booleanProps = [
4632
+ 'a11y',
4633
+ 'allowHTML',
4634
+ 'arrow',
4635
+ 'flip',
4636
+ 'flipOnUpdate',
4637
+ 'hideOnClick',
4638
+ 'ignoreAttributes',
4639
+ 'inertia',
4640
+ 'interactive',
4641
+ 'lazy',
4642
+ 'multiple',
4643
+ 'showOnInit',
4644
+ 'touch',
4645
+ 'touchHold',
4646
+ ];
4647
+ let props = {};
4648
+ Object.keys(tippy.defaultProps).forEach((prop) => {
4649
+ if (booleanProps.includes(prop)) {
4650
+ props[prop] = {
4651
+ type: Boolean,
4652
+ default: function () {
4653
+ return tippy.defaultProps[prop];
4654
+ },
4655
+ };
4656
+ }
4657
+ else {
4658
+ props[prop] = {
4659
+ default: function () {
4660
+ return tippy.defaultProps[prop];
4661
+ },
4662
+ };
4663
+ }
4664
+ });
4665
+ const TippySingleton = vue.defineComponent({
4666
+ props,
4667
+ setup(props) {
4668
+ const instances = vue.ref([]);
4669
+ const { singleton } = useSingleton(instances, props);
4670
+ return { instances, singleton };
4671
+ },
4672
+ mounted() {
4673
+ var _a;
4674
+ const parent = this.$el.parentElement;
4675
+ const elements = parent.querySelectorAll('[data-v-tippy]');
4676
+ this.instances = Array.from(elements)
4677
+ .map((el) => el._tippy)
4678
+ .filter(Boolean);
4679
+ (_a = this.singleton) === null || _a === void 0 ? void 0 : _a.setInstances(this.instances);
4680
+ },
4681
+ render() {
4682
+ let slot = this.$slots.default ? this.$slots.default() : [];
4683
+ return vue.h(() => slot);
4684
+ },
4685
+ });
4686
+
4687
+ const directive = {
4688
+ mounted(el, binding, vnode) {
4689
+ const opts = typeof binding.value === "string" ? { content: binding.value } : binding.value || {};
4690
+ const modifiers = Object.keys(binding.modifiers || {});
4691
+ const placement = modifiers.find(modifier => modifier !== 'arrow');
4692
+ const withArrow = modifiers.findIndex(modifier => modifier === 'arrow') !== -1;
4693
+ if (placement) {
4694
+ opts.placement = opts.placement || placement;
4695
+ }
4696
+ if (withArrow) {
4697
+ opts.arrow = opts.arrow !== undefined ? opts.arrow : true;
4698
+ }
4699
+ if (vnode.props && vnode.props.onTippyShow) {
4700
+ opts.onShow = function (...args) {
4701
+ var _a;
4702
+ return (_a = vnode.props) === null || _a === void 0 ? void 0 : _a.onTippyShow(...args);
4703
+ };
4704
+ }
4705
+ if (vnode.props && vnode.props.onTippyShown) {
4706
+ opts.onShown = function (...args) {
4707
+ var _a;
4708
+ return (_a = vnode.props) === null || _a === void 0 ? void 0 : _a.onTippyShown(...args);
4709
+ };
4710
+ }
4711
+ if (vnode.props && vnode.props.onTippyHidden) {
4712
+ opts.onHidden = function (...args) {
4713
+ var _a;
4714
+ return (_a = vnode.props) === null || _a === void 0 ? void 0 : _a.onTippyHidden(...args);
4715
+ };
4716
+ }
4717
+ if (vnode.props && vnode.props.onTippyHide) {
4718
+ opts.onHide = function (...args) {
4719
+ var _a;
4720
+ return (_a = vnode.props) === null || _a === void 0 ? void 0 : _a.onTippyHide(...args);
4721
+ };
4722
+ }
4723
+ if (vnode.props && vnode.props.onTippyMount) {
4724
+ opts.onMount = function (...args) {
4725
+ var _a;
4726
+ return (_a = vnode.props) === null || _a === void 0 ? void 0 : _a.onTippyMount(...args);
4727
+ };
4728
+ }
4729
+ if (el.getAttribute('title') && !opts.content) {
4730
+ opts.content = el.getAttribute('title');
4731
+ el.removeAttribute('title');
4732
+ }
4733
+ if (el.getAttribute('content') && !opts.content) {
4734
+ opts.content = el.getAttribute('content');
4735
+ }
4736
+ useTippy(el, opts);
4737
+ },
4738
+ unmounted(el) {
4739
+ if (el.$tippy) {
4740
+ el.$tippy.destroy();
4741
+ }
4742
+ else if (el._tippy) {
4743
+ el._tippy.destroy();
4744
+ }
4745
+ },
4746
+ updated(el, binding) {
4747
+ const opts = typeof binding.value === "string" ? { content: binding.value } : binding.value || {};
4748
+ if (el.getAttribute('title') && !opts.content) {
4749
+ opts.content = el.getAttribute('title');
4750
+ el.removeAttribute('title');
4751
+ }
4752
+ if (el.getAttribute('content') && !opts.content) {
4753
+ opts.content = el.getAttribute('content');
4754
+ }
4755
+ if (el.$tippy) {
4756
+ el.$tippy.setProps(opts || {});
4757
+ }
4758
+ else if (el._tippy) {
4759
+ el._tippy.setProps(opts || {});
4760
+ }
4761
+ },
4762
+ };
4763
+
4764
+ const plugin = {
4765
+ install(app, options = {}) {
4766
+ tippy.setDefaultProps(options.defaultProps || {});
4767
+ app.directive(options.directive || 'tippy', directive);
4768
+ app.component(options.component || 'tippy', TippyComponent);
4769
+ app.component(options.componentSingleton || 'tippy-singleton', TippySingleton);
4770
+ },
4771
+ };
4772
+
4773
+ const setDefaultProps$1 = tippy.setDefaultProps;
4774
+ setDefaultProps$1({
4775
+ ignoreAttributes: true,
4776
+ plugins: [sticky, inlinePositioning, followCursor, animateFill],
4777
+ });
4778
+
4779
+ exports.Tippy = TippyComponent;
4780
+ exports.TippySingleton = TippySingleton;
4781
+ exports.default = plugin;
4782
+ exports.directive = directive;
4783
+ exports.plugin = plugin;
4784
+ exports.roundArrow = ROUND_ARROW;
4785
+ exports.setDefaultProps = setDefaultProps$1;
4786
+ exports.tippy = tippy;
4787
+ exports.useSingleton = useSingleton;
4788
+ exports.useTippy = useTippy;
4789
+ exports.useTippyComponent = useTippyComponent;