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