PluginProbe
Booking Calendar / 11.4.3
Booking Calendar v11.4.3
11.8.4 11.8.3 11.8.2 11.8.1 11.8 11.7 11.6.1 11.6 11.5 11.4.3 11.4.2 11.4.1 11.4 11.3 11.2.1 11.2 11.1 11.0 10.15.7 10.15.6 10.1.3 10.10 10.10.1 10.10.2 10.11 All 204 releases
booking / vendors / _custom / popper / popper-lite.js

popper-lite.js in Booking Calendar 11.4.3, at vendors/_custom/popper/popper-lite.js

1,422 lines 48.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * @popperjs/core v2.11.2 - MIT License
3 */
4
5 (function (global, factory) {
6 typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
7 typeof define === 'function' && define.amd ? define(['exports'], factory) :
8 (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Popper = {}));
9 }(this, (function (exports) { 'use strict';
10
11 function getWindow(node) {
12 if (node == null) {
13 return window;
14 }
15
16 if (node.toString() !== '[object Window]') {
17 var ownerDocument = node.ownerDocument;
18 return ownerDocument ? ownerDocument.defaultView || window : window;
19 }
20
21 return node;
22 }
23
24 function isElement(node) {
25 var OwnElement = getWindow(node).Element;
26 return node instanceof OwnElement || node instanceof Element;
27 }
28
29 function isHTMLElement(node) {
30 var OwnElement = getWindow(node).HTMLElement;
31 return node instanceof OwnElement || node instanceof HTMLElement;
32 }
33
34 function isShadowRoot(node) {
35 // IE 11 has no ShadowRoot
36 if (typeof ShadowRoot === 'undefined') {
37 return false;
38 }
39
40 var OwnElement = getWindow(node).ShadowRoot;
41 return node instanceof OwnElement || node instanceof ShadowRoot;
42 }
43
44 var max = Math.max;
45 var min = Math.min;
46 var round = Math.round;
47
48 function getBoundingClientRect(element, includeScale) {
49 if (includeScale === void 0) {
50 includeScale = false;
51 }
52
53 var rect = element.getBoundingClientRect();
54 var scaleX = 1;
55 var scaleY = 1;
56
57 if (isHTMLElement(element) && includeScale) {
58 var offsetHeight = element.offsetHeight;
59 var offsetWidth = element.offsetWidth; // Do not attempt to divide by 0, otherwise we get `Infinity` as scale
60 // Fallback to 1 in case both values are `0`
61
62 if (offsetWidth > 0) {
63 scaleX = round(rect.width) / offsetWidth || 1;
64 }
65
66 if (offsetHeight > 0) {
67 scaleY = round(rect.height) / offsetHeight || 1;
68 }
69 }
70
71 return {
72 width: rect.width / scaleX,
73 height: rect.height / scaleY,
74 top: rect.top / scaleY,
75 right: rect.right / scaleX,
76 bottom: rect.bottom / scaleY,
77 left: rect.left / scaleX,
78 x: rect.left / scaleX,
79 y: rect.top / scaleY
80 };
81 }
82
83 function getWindowScroll(node) {
84 var win = getWindow(node);
85 var scrollLeft = win.pageXOffset;
86 var scrollTop = win.pageYOffset;
87 return {
88 scrollLeft: scrollLeft,
89 scrollTop: scrollTop
90 };
91 }
92
93 function getHTMLElementScroll(element) {
94 return {
95 scrollLeft: element.scrollLeft,
96 scrollTop: element.scrollTop
97 };
98 }
99
100 function getNodeScroll(node) {
101 if (node === getWindow(node) || !isHTMLElement(node)) {
102 return getWindowScroll(node);
103 } else {
104 return getHTMLElementScroll(node);
105 }
106 }
107
108 function getNodeName(element) {
109 return element ? (element.nodeName || '').toLowerCase() : null;
110 }
111
112 function getDocumentElement(element) {
113 // $FlowFixMe[incompatible-return]: assume body is always available
114 return ((isElement(element) ? element.ownerDocument : // $FlowFixMe[prop-missing]
115 element.document) || window.document).documentElement;
116 }
117
118 function getWindowScrollBarX(element) {
119 // If <html> has a CSS width greater than the viewport, then this will be
120 // incorrect for RTL.
121 // Popper 1 is broken in this case and never had a bug report so let's assume
122 // it's not an issue. I don't think anyone ever specifies width on <html>
123 // anyway.
124 // Browsers where the left scrollbar doesn't cause an issue report `0` for
125 // this (e.g. Edge 2019, IE11, Safari)
126 return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
127 }
128
129 function getComputedStyle(element) {
130 return getWindow(element).getComputedStyle(element);
131 }
132
133 function isScrollParent(element) {
134 // Firefox wants us to check `-x` and `-y` variations as well
135 var _getComputedStyle = getComputedStyle(element),
136 overflow = _getComputedStyle.overflow,
137 overflowX = _getComputedStyle.overflowX,
138 overflowY = _getComputedStyle.overflowY;
139
140 return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
141 }
142
143 function isElementScaled(element) {
144 var rect = element.getBoundingClientRect();
145 var scaleX = round(rect.width) / element.offsetWidth || 1;
146 var scaleY = round(rect.height) / element.offsetHeight || 1;
147 return scaleX !== 1 || scaleY !== 1;
148 } // Returns the composite rect of an element relative to its offsetParent.
149 // Composite means it takes into account transforms as well as layout.
150
151
152 function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
153 if (isFixed === void 0) {
154 isFixed = false;
155 }
156
157 var isOffsetParentAnElement = isHTMLElement(offsetParent);
158 var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
159 var documentElement = getDocumentElement(offsetParent);
160 var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled);
161 var scroll = {
162 scrollLeft: 0,
163 scrollTop: 0
164 };
165 var offsets = {
166 x: 0,
167 y: 0
168 };
169
170 if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
171 if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078
172 isScrollParent(documentElement)) {
173 scroll = getNodeScroll(offsetParent);
174 }
175
176 if (isHTMLElement(offsetParent)) {
177 offsets = getBoundingClientRect(offsetParent, true);
178 offsets.x += offsetParent.clientLeft;
179 offsets.y += offsetParent.clientTop;
180 } else if (documentElement) {
181 offsets.x = getWindowScrollBarX(documentElement);
182 }
183 }
184
185 return {
186 x: rect.left + scroll.scrollLeft - offsets.x,
187 y: rect.top + scroll.scrollTop - offsets.y,
188 width: rect.width,
189 height: rect.height
190 };
191 }
192
193 // means it doesn't take into account transforms.
194
195 function getLayoutRect(element) {
196 var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.
197 // Fixes https://github.com/popperjs/popper-core/issues/1223
198
199 var width = element.offsetWidth;
200 var height = element.offsetHeight;
201
202 if (Math.abs(clientRect.width - width) <= 1) {
203 width = clientRect.width;
204 }
205
206 if (Math.abs(clientRect.height - height) <= 1) {
207 height = clientRect.height;
208 }
209
210 return {
211 x: element.offsetLeft,
212 y: element.offsetTop,
213 width: width,
214 height: height
215 };
216 }
217
218 function getParentNode(element) {
219 if (getNodeName(element) === 'html') {
220 return element;
221 }
222
223 return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
224 // $FlowFixMe[incompatible-return]
225 // $FlowFixMe[prop-missing]
226 element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
227 element.parentNode || ( // DOM Element detected
228 isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
229 // $FlowFixMe[incompatible-call]: HTMLElement is a Node
230 getDocumentElement(element) // fallback
231
232 );
233 }
234
235 function getScrollParent(node) {
236 if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {
237 // $FlowFixMe[incompatible-return]: assume body is always available
238 return node.ownerDocument.body;
239 }
240
241 if (isHTMLElement(node) && isScrollParent(node)) {
242 return node;
243 }
244
245 return getScrollParent(getParentNode(node));
246 }
247
248 /*
249 given a DOM element, return the list of all scroll parents, up the list of ancesors
250 until we get to the top window object. This list is what we attach scroll listeners
251 to, because if any of these parent elements scroll, we'll need to re-calculate the
252 reference element's position.
253 */
254
255 function listScrollParents(element, list) {
256 var _element$ownerDocumen;
257
258 if (list === void 0) {
259 list = [];
260 }
261
262 var scrollParent = getScrollParent(element);
263 var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
264 var win = getWindow(scrollParent);
265 var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
266 var updatedList = list.concat(target);
267 return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
268 updatedList.concat(listScrollParents(getParentNode(target)));
269 }
270
271 function isTableElement(element) {
272 return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0;
273 }
274
275 function getTrueOffsetParent(element) {
276 if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
277 getComputedStyle(element).position === 'fixed') {
278 return null;
279 }
280
281 return element.offsetParent;
282 } // `.offsetParent` reports `null` for fixed elements, while absolute elements
283 // return the containing block
284
285
286 function getContainingBlock(element) {
287 var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') !== -1;
288 var isIE = navigator.userAgent.indexOf('Trident') !== -1;
289
290 if (isIE && isHTMLElement(element)) {
291 // In IE 9, 10 and 11 fixed elements containing block is always established by the viewport
292 var elementCss = getComputedStyle(element);
293
294 if (elementCss.position === 'fixed') {
295 return null;
296 }
297 }
298
299 var currentNode = getParentNode(element);
300
301 while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
302 var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that
303 // create a containing block.
304 // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
305
306 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') {
307 return currentNode;
308 } else {
309 currentNode = currentNode.parentNode;
310 }
311 }
312
313 return null;
314 } // Gets the closest ancestor positioned element. Handles some edge cases,
315 // such as table ancestors and cross browser bugs.
316
317
318 function getOffsetParent(element) {
319 var window = getWindow(element);
320 var offsetParent = getTrueOffsetParent(element);
321
322 while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {
323 offsetParent = getTrueOffsetParent(offsetParent);
324 }
325
326 if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static')) {
327 return window;
328 }
329
330 return offsetParent || getContainingBlock(element) || window;
331 }
332
333 var top = 'top';
334 var bottom = 'bottom';
335 var right = 'right';
336 var left = 'left';
337 var auto = 'auto';
338 var basePlacements = [top, bottom, right, left];
339 var start = 'start';
340 var end = 'end';
341 var clippingParents = 'clippingParents';
342 var viewport = 'viewport';
343 var popper = 'popper';
344 var reference = 'reference';
345
346 var beforeRead = 'beforeRead';
347 var read = 'read';
348 var afterRead = 'afterRead'; // pure-logic modifiers
349
350 var beforeMain = 'beforeMain';
351 var main = 'main';
352 var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)
353
354 var beforeWrite = 'beforeWrite';
355 var write = 'write';
356 var afterWrite = 'afterWrite';
357 var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
358
359 function order(modifiers) {
360 var map = new Map();
361 var visited = new Set();
362 var result = [];
363 modifiers.forEach(function (modifier) {
364 map.set(modifier.name, modifier);
365 }); // On visiting object, check for its dependencies and visit them recursively
366
367 function sort(modifier) {
368 visited.add(modifier.name);
369 var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
370 requires.forEach(function (dep) {
371 if (!visited.has(dep)) {
372 var depModifier = map.get(dep);
373
374 if (depModifier) {
375 sort(depModifier);
376 }
377 }
378 });
379 result.push(modifier);
380 }
381
382 modifiers.forEach(function (modifier) {
383 if (!visited.has(modifier.name)) {
384 // check for visited object
385 sort(modifier);
386 }
387 });
388 return result;
389 }
390
391 function orderModifiers(modifiers) {
392 // order based on dependencies
393 var orderedModifiers = order(modifiers); // order based on phase
394
395 return modifierPhases.reduce(function (acc, phase) {
396 return acc.concat(orderedModifiers.filter(function (modifier) {
397 return modifier.phase === phase;
398 }));
399 }, []);
400 }
401
402 function debounce(fn) {
403 var pending;
404 return function () {
405 if (!pending) {
406 pending = new Promise(function (resolve) {
407 Promise.resolve().then(function () {
408 pending = undefined;
409 resolve(fn());
410 });
411 });
412 }
413
414 return pending;
415 };
416 }
417
418 function format(str) {
419 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
420 args[_key - 1] = arguments[_key];
421 }
422
423 return [].concat(args).reduce(function (p, c) {
424 return p.replace(/%s/, c);
425 }, str);
426 }
427
428 var INVALID_MODIFIER_ERROR = 'Popper: modifier "%s" provided an invalid %s property, expected %s but got %s';
429 var MISSING_DEPENDENCY_ERROR = 'Popper: modifier "%s" requires "%s", but "%s" modifier is not available';
430 var VALID_PROPERTIES = ['name', 'enabled', 'phase', 'fn', 'effect', 'requires', 'options'];
431 function validateModifiers(modifiers) {
432 modifiers.forEach(function (modifier) {
433 [].concat(Object.keys(modifier), VALID_PROPERTIES) // IE11-compatible replacement for `new Set(iterable)`
434 .filter(function (value, index, self) {
435 return self.indexOf(value) === index;
436 }).forEach(function (key) {
437 switch (key) {
438 case 'name':
439 if (typeof modifier.name !== 'string') {
440 console.error(format(INVALID_MODIFIER_ERROR, String(modifier.name), '"name"', '"string"', "\"" + String(modifier.name) + "\""));
441 }
442
443 break;
444
445 case 'enabled':
446 if (typeof modifier.enabled !== 'boolean') {
447 console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"enabled"', '"boolean"', "\"" + String(modifier.enabled) + "\""));
448 }
449
450 break;
451
452 case 'phase':
453 if (modifierPhases.indexOf(modifier.phase) < 0) {
454 console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"phase"', "either " + modifierPhases.join(', '), "\"" + String(modifier.phase) + "\""));
455 }
456
457 break;
458
459 case 'fn':
460 if (typeof modifier.fn !== 'function') {
461 console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"fn"', '"function"', "\"" + String(modifier.fn) + "\""));
462 }
463
464 break;
465
466 case 'effect':
467 if (modifier.effect != null && typeof modifier.effect !== 'function') {
468 console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"effect"', '"function"', "\"" + String(modifier.fn) + "\""));
469 }
470
471 break;
472
473 case 'requires':
474 if (modifier.requires != null && !Array.isArray(modifier.requires)) {
475 console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requires"', '"array"', "\"" + String(modifier.requires) + "\""));
476 }
477
478 break;
479
480 case 'requiresIfExists':
481 if (!Array.isArray(modifier.requiresIfExists)) {
482 console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requiresIfExists"', '"array"', "\"" + String(modifier.requiresIfExists) + "\""));
483 }
484
485 break;
486
487 case 'options':
488 case 'data':
489 break;
490
491 default:
492 console.error("PopperJS: an invalid property has been provided to the \"" + modifier.name + "\" modifier, valid properties are " + VALID_PROPERTIES.map(function (s) {
493 return "\"" + s + "\"";
494 }).join(', ') + "; but \"" + key + "\" was provided.");
495 }
496
497 modifier.requires && modifier.requires.forEach(function (requirement) {
498 if (modifiers.find(function (mod) {
499 return mod.name === requirement;
500 }) == null) {
501 console.error(format(MISSING_DEPENDENCY_ERROR, String(modifier.name), requirement, requirement));
502 }
503 });
504 });
505 });
506 }
507
508 function uniqueBy(arr, fn) {
509 var identifiers = new Set();
510 return arr.filter(function (item) {
511 var identifier = fn(item);
512
513 if (!identifiers.has(identifier)) {
514 identifiers.add(identifier);
515 return true;
516 }
517 });
518 }
519
520 function getBasePlacement(placement) {
521 return placement.split('-')[0];
522 }
523
524 function mergeByName(modifiers) {
525 var merged = modifiers.reduce(function (merged, current) {
526 var existing = merged[current.name];
527 merged[current.name] = existing ? Object.assign({}, existing, current, {
528 options: Object.assign({}, existing.options, current.options),
529 data: Object.assign({}, existing.data, current.data)
530 }) : current;
531 return merged;
532 }, {}); // IE11 does not support Object.values
533
534 return Object.keys(merged).map(function (key) {
535 return merged[key];
536 });
537 }
538
539 function getViewportRect(element) {
540 var win = getWindow(element);
541 var html = getDocumentElement(element);
542 var visualViewport = win.visualViewport;
543 var width = html.clientWidth;
544 var height = html.clientHeight;
545 var x = 0;
546 var y = 0; // NB: This isn't supported on iOS <= 12. If the keyboard is open, the popper
547 // can be obscured underneath it.
548 // Also, `html.clientHeight` adds the bottom bar height in Safari iOS, even
549 // if it isn't open, so if this isn't available, the popper will be detected
550 // to overflow the bottom of the screen too early.
551
552 if (visualViewport) {
553 width = visualViewport.width;
554 height = visualViewport.height; // Uses Layout Viewport (like Chrome; Safari does not currently)
555 // In Chrome, it returns a value very close to 0 (+/-) but contains rounding
556 // errors due to floating point numbers, so we need to check precision.
557 // Safari returns a number <= 0, usually < -1 when pinch-zoomed
558 // Feature detection fails in mobile emulation mode in Chrome.
559 // Math.abs(win.innerWidth / visualViewport.scale - visualViewport.width) <
560 // 0.001
561 // Fallback here: "Not Safari" userAgent
562
563 if (!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
564 x = visualViewport.offsetLeft;
565 y = visualViewport.offsetTop;
566 }
567 }
568
569 return {
570 width: width,
571 height: height,
572 x: x + getWindowScrollBarX(element),
573 y: y
574 };
575 }
576
577 // of the `<html>` and `<body>` rect bounds if horizontally scrollable
578
579 function getDocumentRect(element) {
580 var _element$ownerDocumen;
581
582 var html = getDocumentElement(element);
583 var winScroll = getWindowScroll(element);
584 var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
585 var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
586 var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
587 var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
588 var y = -winScroll.scrollTop;
589
590 if (getComputedStyle(body || html).direction === 'rtl') {
591 x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
592 }
593
594 return {
595 width: width,
596 height: height,
597 x: x,
598 y: y
599 };
600 }
601
602 function contains(parent, child) {
603 var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method
604
605 if (parent.contains(child)) {
606 return true;
607 } // then fallback to custom implementation with Shadow DOM support
608 else if (rootNode && isShadowRoot(rootNode)) {
609 var next = child;
610
611 do {
612 if (next && parent.isSameNode(next)) {
613 return true;
614 } // $FlowFixMe[prop-missing]: need a better way to handle this...
615
616
617 next = next.parentNode || next.host;
618 } while (next);
619 } // Give up, the result is false
620
621
622 return false;
623 }
624
625 function rectToClientRect(rect) {
626 return Object.assign({}, rect, {
627 left: rect.x,
628 top: rect.y,
629 right: rect.x + rect.width,
630 bottom: rect.y + rect.height
631 });
632 }
633
634 function getInnerBoundingClientRect(element) {
635 var rect = getBoundingClientRect(element);
636 rect.top = rect.top + element.clientTop;
637 rect.left = rect.left + element.clientLeft;
638 rect.bottom = rect.top + element.clientHeight;
639 rect.right = rect.left + element.clientWidth;
640 rect.width = element.clientWidth;
641 rect.height = element.clientHeight;
642 rect.x = rect.left;
643 rect.y = rect.top;
644 return rect;
645 }
646
647 function getClientRectFromMixedType(element, clippingParent) {
648 return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
649 } // A "clipping parent" is an overflowable container with the characteristic of
650 // clipping (or hiding) overflowing elements with a position different from
651 // `initial`
652
653
654 function getClippingParents(element) {
655 var clippingParents = listScrollParents(getParentNode(element));
656 var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle(element).position) >= 0;
657 var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
658
659 if (!isElement(clipperElement)) {
660 return [];
661 } // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414
662
663
664 return clippingParents.filter(function (clippingParent) {
665 return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';
666 });
667 } // Gets the maximum area that the element is visible in due to any number of
668 // clipping parents
669
670
671 function getClippingRect(element, boundary, rootBoundary) {
672 var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);
673 var clippingParents = [].concat(mainClippingParents, [rootBoundary]);
674 var firstClippingParent = clippingParents[0];
675 var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {
676 var rect = getClientRectFromMixedType(element, clippingParent);
677 accRect.top = max(rect.top, accRect.top);
678 accRect.right = min(rect.right, accRect.right);
679 accRect.bottom = min(rect.bottom, accRect.bottom);
680 accRect.left = max(rect.left, accRect.left);
681 return accRect;
682 }, getClientRectFromMixedType(element, firstClippingParent));
683 clippingRect.width = clippingRect.right - clippingRect.left;
684 clippingRect.height = clippingRect.bottom - clippingRect.top;
685 clippingRect.x = clippingRect.left;
686 clippingRect.y = clippingRect.top;
687 return clippingRect;
688 }
689
690 function getVariation(placement) {
691 return placement.split('-')[1];
692 }
693
694 function getMainAxisFromPlacement(placement) {
695 return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';
696 }
697
698 function computeOffsets(_ref) {
699 var reference = _ref.reference,
700 element = _ref.element,
701 placement = _ref.placement;
702 var basePlacement = placement ? getBasePlacement(placement) : null;
703 var variation = placement ? getVariation(placement) : null;
704 var commonX = reference.x + reference.width / 2 - element.width / 2;
705 var commonY = reference.y + reference.height / 2 - element.height / 2;
706 var offsets;
707
708 switch (basePlacement) {
709 case top:
710 offsets = {
711 x: commonX,
712 y: reference.y - element.height
713 };
714 break;
715
716 case bottom:
717 offsets = {
718 x: commonX,
719 y: reference.y + reference.height
720 };
721 break;
722
723 case right:
724 offsets = {
725 x: reference.x + reference.width,
726 y: commonY
727 };
728 break;
729
730 case left:
731 offsets = {
732 x: reference.x - element.width,
733 y: commonY
734 };
735 break;
736
737 default:
738 offsets = {
739 x: reference.x,
740 y: reference.y
741 };
742 }
743
744 var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
745
746 if (mainAxis != null) {
747 var len = mainAxis === 'y' ? 'height' : 'width';
748
749 switch (variation) {
750 case start:
751 offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);
752 break;
753
754 case end:
755 offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);
756 break;
757 }
758 }
759
760 return offsets;
761 }
762
763 function getFreshSideObject() {
764 return {
765 top: 0,
766 right: 0,
767 bottom: 0,
768 left: 0
769 };
770 }
771
772 function mergePaddingObject(paddingObject) {
773 return Object.assign({}, getFreshSideObject(), paddingObject);
774 }
775
776 function expandToHashMap(value, keys) {
777 return keys.reduce(function (hashMap, key) {
778 hashMap[key] = value;
779 return hashMap;
780 }, {});
781 }
782
783 function detectOverflow(state, options) {
784 if (options === void 0) {
785 options = {};
786 }
787
788 var _options = options,
789 _options$placement = _options.placement,
790 placement = _options$placement === void 0 ? state.placement : _options$placement,
791 _options$boundary = _options.boundary,
792 boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,
793 _options$rootBoundary = _options.rootBoundary,
794 rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary,
795 _options$elementConte = _options.elementContext,
796 elementContext = _options$elementConte === void 0 ? popper : _options$elementConte,
797 _options$altBoundary = _options.altBoundary,
798 altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary,
799 _options$padding = _options.padding,
800 padding = _options$padding === void 0 ? 0 : _options$padding;
801 var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
802 var altContext = elementContext === popper ? reference : popper;
803 var popperRect = state.rects.popper;
804 var element = state.elements[altBoundary ? altContext : elementContext];
805 var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary);
806 var referenceClientRect = getBoundingClientRect(state.elements.reference);
807 var popperOffsets = computeOffsets({
808 reference: referenceClientRect,
809 element: popperRect,
810 strategy: 'absolute',
811 placement: placement
812 });
813 var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));
814 var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect
815 // 0 or negative = within the clipping rect
816
817 var overflowOffsets = {
818 top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
819 bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
820 left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
821 right: elementClientRect.right - clippingClientRect.right + paddingObject.right
822 };
823 var offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element
824
825 if (elementContext === popper && offsetData) {
826 var offset = offsetData[placement];
827 Object.keys(overflowOffsets).forEach(function (key) {
828 var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
829 var axis = [top, bottom].indexOf(key) >= 0 ? 'y' : 'x';
830 overflowOffsets[key] += offset[axis] * multiply;
831 });
832 }
833
834 return overflowOffsets;
835 }
836
837 var INVALID_ELEMENT_ERROR = 'Popper: Invalid reference or popper argument provided. They must be either a DOM element or virtual element.';
838 var INFINITE_LOOP_ERROR = 'Popper: An infinite loop in the modifiers cycle has been detected! The cycle has been interrupted to prevent a browser crash.';
839 var DEFAULT_OPTIONS = {
840 placement: 'bottom',
841 modifiers: [],
842 strategy: 'absolute'
843 };
844
845 function areValidElements() {
846 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
847 args[_key] = arguments[_key];
848 }
849
850 return !args.some(function (element) {
851 return !(element && typeof element.getBoundingClientRect === 'function');
852 });
853 }
854
855 function popperGenerator(generatorOptions) {
856 if (generatorOptions === void 0) {
857 generatorOptions = {};
858 }
859
860 var _generatorOptions = generatorOptions,
861 _generatorOptions$def = _generatorOptions.defaultModifiers,
862 defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def,
863 _generatorOptions$def2 = _generatorOptions.defaultOptions,
864 defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
865 return function createPopper(reference, popper, options) {
866 if (options === void 0) {
867 options = defaultOptions;
868 }
869
870 var state = {
871 placement: 'bottom',
872 orderedModifiers: [],
873 options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
874 modifiersData: {},
875 elements: {
876 reference: reference,
877 popper: popper
878 },
879 attributes: {},
880 styles: {}
881 };
882 var effectCleanupFns = [];
883 var isDestroyed = false;
884 var instance = {
885 state: state,
886 setOptions: function setOptions(setOptionsAction) {
887 var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;
888 cleanupModifierEffects();
889 state.options = Object.assign({}, defaultOptions, state.options, options);
890 state.scrollParents = {
891 reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
892 popper: listScrollParents(popper)
893 }; // Orders the modifiers based on their dependencies and `phase`
894 // properties
895
896 var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers
897
898 state.orderedModifiers = orderedModifiers.filter(function (m) {
899 return m.enabled;
900 }); // Validate the provided modifiers so that the consumer will get warned
901 // if one of the modifiers is invalid for any reason
902
903 {
904 var modifiers = uniqueBy([].concat(orderedModifiers, state.options.modifiers), function (_ref) {
905 var name = _ref.name;
906 return name;
907 });
908 validateModifiers(modifiers);
909
910 if (getBasePlacement(state.options.placement) === auto) {
911 var flipModifier = state.orderedModifiers.find(function (_ref2) {
912 var name = _ref2.name;
913 return name === 'flip';
914 });
915
916 if (!flipModifier) {
917 console.error(['Popper: "auto" placements require the "flip" modifier be', 'present and enabled to work.'].join(' '));
918 }
919 }
920
921 var _getComputedStyle = getComputedStyle(popper),
922 marginTop = _getComputedStyle.marginTop,
923 marginRight = _getComputedStyle.marginRight,
924 marginBottom = _getComputedStyle.marginBottom,
925 marginLeft = _getComputedStyle.marginLeft; // We no longer take into account `margins` on the popper, and it can
926 // cause bugs with positioning, so we'll warn the consumer
927
928
929 if ([marginTop, marginRight, marginBottom, marginLeft].some(function (margin) {
930 return parseFloat(margin);
931 })) {
932 console.warn(['Popper: CSS "margin" styles cannot be used to apply padding', 'between the popper and its reference element or boundary.', 'To replicate margin, use the `offset` modifier, as well as', 'the `padding` option in the `preventOverflow` and `flip`', 'modifiers.'].join(' '));
933 }
934 }
935
936 runModifierEffects();
937 return instance.update();
938 },
939 // Sync update – it will always be executed, even if not necessary. This
940 // is useful for low frequency updates where sync behavior simplifies the
941 // logic.
942 // For high frequency updates (e.g. `resize` and `scroll` events), always
943 // prefer the async Popper#update method
944 forceUpdate: function forceUpdate() {
945 if (isDestroyed) {
946 return;
947 }
948
949 var _state$elements = state.elements,
950 reference = _state$elements.reference,
951 popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements
952 // anymore
953
954 if (!areValidElements(reference, popper)) {
955 {
956 console.error(INVALID_ELEMENT_ERROR);
957 }
958
959 return;
960 } // Store the reference and popper rects to be read by modifiers
961
962
963 state.rects = {
964 reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'),
965 popper: getLayoutRect(popper)
966 }; // Modifiers have the ability to reset the current update cycle. The
967 // most common use case for this is the `flip` modifier changing the
968 // placement, which then needs to re-run all the modifiers, because the
969 // logic was previously ran for the previous placement and is therefore
970 // stale/incorrect
971
972 state.reset = false;
973 state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier
974 // is filled with the initial data specified by the modifier. This means
975 // it doesn't persist and is fresh on each update.
976 // To ensure persistent data, use `${name}#persistent`
977
978 state.orderedModifiers.forEach(function (modifier) {
979 return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
980 });
981 var __debug_loops__ = 0;
982
983 for (var index = 0; index < state.orderedModifiers.length; index++) {
984 {
985 __debug_loops__ += 1;
986
987 if (__debug_loops__ > 100) {
988 console.error(INFINITE_LOOP_ERROR);
989 break;
990 }
991 }
992
993 if (state.reset === true) {
994 state.reset = false;
995 index = -1;
996 continue;
997 }
998
999 var _state$orderedModifie = state.orderedModifiers[index],
1000 fn = _state$orderedModifie.fn,
1001 _state$orderedModifie2 = _state$orderedModifie.options,
1002 _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,
1003 name = _state$orderedModifie.name;
1004
1005 if (typeof fn === 'function') {
1006 state = fn({
1007 state: state,
1008 options: _options,
1009 name: name,
1010 instance: instance
1011 }) || state;
1012 }
1013 }
1014 },
1015 // Async and optimistically optimized update – it will not be executed if
1016 // not necessary (debounced to run at most once-per-tick)
1017 update: debounce(function () {
1018 return new Promise(function (resolve) {
1019 instance.forceUpdate();
1020 resolve(state);
1021 });
1022 }),
1023 destroy: function destroy() {
1024 cleanupModifierEffects();
1025 isDestroyed = true;
1026 }
1027 };
1028
1029 if (!areValidElements(reference, popper)) {
1030 {
1031 console.error(INVALID_ELEMENT_ERROR);
1032 }
1033
1034 return instance;
1035 }
1036
1037 instance.setOptions(options).then(function (state) {
1038 if (!isDestroyed && options.onFirstUpdate) {
1039 options.onFirstUpdate(state);
1040 }
1041 }); // Modifiers have the ability to execute arbitrary code before the first
1042 // update cycle runs. They will be executed in the same order as the update
1043 // cycle. This is useful when a modifier adds some persistent data that
1044 // other modifiers need to use, but the modifier is run after the dependent
1045 // one.
1046
1047 function runModifierEffects() {
1048 state.orderedModifiers.forEach(function (_ref3) {
1049 var name = _ref3.name,
1050 _ref3$options = _ref3.options,
1051 options = _ref3$options === void 0 ? {} : _ref3$options,
1052 effect = _ref3.effect;
1053
1054 if (typeof effect === 'function') {
1055 var cleanupFn = effect({
1056 state: state,
1057 name: name,
1058 instance: instance,
1059 options: options
1060 });
1061
1062 var noopFn = function noopFn() {};
1063
1064 effectCleanupFns.push(cleanupFn || noopFn);
1065 }
1066 });
1067 }
1068
1069 function cleanupModifierEffects() {
1070 effectCleanupFns.forEach(function (fn) {
1071 return fn();
1072 });
1073 effectCleanupFns = [];
1074 }
1075
1076 return instance;
1077 };
1078 }
1079
1080 var passive = {
1081 passive: true
1082 };
1083
1084 function effect$1(_ref) {
1085 var state = _ref.state,
1086 instance = _ref.instance,
1087 options = _ref.options;
1088 var _options$scroll = options.scroll,
1089 scroll = _options$scroll === void 0 ? true : _options$scroll,
1090 _options$resize = options.resize,
1091 resize = _options$resize === void 0 ? true : _options$resize;
1092 var window = getWindow(state.elements.popper);
1093 var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
1094
1095 if (scroll) {
1096 scrollParents.forEach(function (scrollParent) {
1097 scrollParent.addEventListener('scroll', instance.update, passive);
1098 });
1099 }
1100
1101 if (resize) {
1102 window.addEventListener('resize', instance.update, passive);
1103 }
1104
1105 return function () {
1106 if (scroll) {
1107 scrollParents.forEach(function (scrollParent) {
1108 scrollParent.removeEventListener('scroll', instance.update, passive);
1109 });
1110 }
1111
1112 if (resize) {
1113 window.removeEventListener('resize', instance.update, passive);
1114 }
1115 };
1116 } // eslint-disable-next-line import/no-unused-modules
1117
1118
1119 var eventListeners = {
1120 name: 'eventListeners',
1121 enabled: true,
1122 phase: 'write',
1123 fn: function fn() {},
1124 effect: effect$1,
1125 data: {}
1126 };
1127
1128 function popperOffsets(_ref) {
1129 var state = _ref.state,
1130 name = _ref.name;
1131 // Offsets are the actual position the popper needs to have to be
1132 // properly positioned near its reference element
1133 // This is the most basic placement, and will be adjusted by
1134 // the modifiers in the next step
1135 state.modifiersData[name] = computeOffsets({
1136 reference: state.rects.reference,
1137 element: state.rects.popper,
1138 strategy: 'absolute',
1139 placement: state.placement
1140 });
1141 } // eslint-disable-next-line import/no-unused-modules
1142
1143
1144 var popperOffsets$1 = {
1145 name: 'popperOffsets',
1146 enabled: true,
1147 phase: 'read',
1148 fn: popperOffsets,
1149 data: {}
1150 };
1151
1152 var unsetSides = {
1153 top: 'auto',
1154 right: 'auto',
1155 bottom: 'auto',
1156 left: 'auto'
1157 }; // Round the offsets to the nearest suitable subpixel based on the DPR.
1158 // Zooming can change the DPR, but it seems to report a value that will
1159 // cleanly divide the values into the appropriate subpixels.
1160
1161 function roundOffsetsByDPR(_ref) {
1162 var x = _ref.x,
1163 y = _ref.y;
1164 var win = window;
1165 var dpr = win.devicePixelRatio || 1;
1166 return {
1167 x: round(x * dpr) / dpr || 0,
1168 y: round(y * dpr) / dpr || 0
1169 };
1170 }
1171
1172 function mapToStyles(_ref2) {
1173 var _Object$assign2;
1174
1175 var popper = _ref2.popper,
1176 popperRect = _ref2.popperRect,
1177 placement = _ref2.placement,
1178 variation = _ref2.variation,
1179 offsets = _ref2.offsets,
1180 position = _ref2.position,
1181 gpuAcceleration = _ref2.gpuAcceleration,
1182 adaptive = _ref2.adaptive,
1183 roundOffsets = _ref2.roundOffsets,
1184 isFixed = _ref2.isFixed;
1185 var _offsets$x = offsets.x,
1186 x = _offsets$x === void 0 ? 0 : _offsets$x,
1187 _offsets$y = offsets.y,
1188 y = _offsets$y === void 0 ? 0 : _offsets$y;
1189
1190 var _ref3 = typeof roundOffsets === 'function' ? roundOffsets({
1191 x: x,
1192 y: y
1193 }) : {
1194 x: x,
1195 y: y
1196 };
1197
1198 x = _ref3.x;
1199 y = _ref3.y;
1200 var hasX = offsets.hasOwnProperty('x');
1201 var hasY = offsets.hasOwnProperty('y');
1202 var sideX = left;
1203 var sideY = top;
1204 var win = window;
1205
1206 if (adaptive) {
1207 var offsetParent = getOffsetParent(popper);
1208 var heightProp = 'clientHeight';
1209 var widthProp = 'clientWidth';
1210
1211 if (offsetParent === getWindow(popper)) {
1212 offsetParent = getDocumentElement(popper);
1213
1214 if (getComputedStyle(offsetParent).position !== 'static' && position === 'absolute') {
1215 heightProp = 'scrollHeight';
1216 widthProp = 'scrollWidth';
1217 }
1218 } // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it
1219
1220
1221 offsetParent = offsetParent;
1222
1223 if (placement === top || (placement === left || placement === right) && variation === end) {
1224 sideY = bottom;
1225 var offsetY = isFixed && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing]
1226 offsetParent[heightProp];
1227 y -= offsetY - popperRect.height;
1228 y *= gpuAcceleration ? 1 : -1;
1229 }
1230
1231 if (placement === left || (placement === top || placement === bottom) && variation === end) {
1232 sideX = right;
1233 var offsetX = isFixed && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing]
1234 offsetParent[widthProp];
1235 x -= offsetX - popperRect.width;
1236 x *= gpuAcceleration ? 1 : -1;
1237 }
1238 }
1239
1240 var commonStyles = Object.assign({
1241 position: position
1242 }, adaptive && unsetSides);
1243
1244 var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
1245 x: x,
1246 y: y
1247 }) : {
1248 x: x,
1249 y: y
1250 };
1251
1252 x = _ref4.x;
1253 y = _ref4.y;
1254
1255 if (gpuAcceleration) {
1256 var _Object$assign;
1257
1258 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));
1259 }
1260
1261 return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
1262 }
1263
1264 function computeStyles(_ref5) {
1265 var state = _ref5.state,
1266 options = _ref5.options;
1267 var _options$gpuAccelerat = options.gpuAcceleration,
1268 gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,
1269 _options$adaptive = options.adaptive,
1270 adaptive = _options$adaptive === void 0 ? true : _options$adaptive,
1271 _options$roundOffsets = options.roundOffsets,
1272 roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
1273
1274 {
1275 var transitionProperty = getComputedStyle(state.elements.popper).transitionProperty || '';
1276
1277 if (adaptive && ['transform', 'top', 'right', 'bottom', 'left'].some(function (property) {
1278 return transitionProperty.indexOf(property) >= 0;
1279 })) {
1280 console.warn(['Popper: Detected CSS transitions on at least one of the following', 'CSS properties: "transform", "top", "right", "bottom", "left".', '\n\n', 'Disable the "computeStyles" modifier\'s `adaptive` option to allow', 'for smooth transitions, or remove these properties from the CSS', 'transition declaration on the popper element if only transitioning', 'opacity or background-color for example.', '\n\n', 'We recommend using the popper element as a wrapper around an inner', 'element that can have any CSS property transitioned for animations.'].join(' '));
1281 }
1282 }
1283
1284 var commonStyles = {
1285 placement: getBasePlacement(state.placement),
1286 variation: getVariation(state.placement),
1287 popper: state.elements.popper,
1288 popperRect: state.rects.popper,
1289 gpuAcceleration: gpuAcceleration,
1290 isFixed: state.options.strategy === 'fixed'
1291 };
1292
1293 if (state.modifiersData.popperOffsets != null) {
1294 state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
1295 offsets: state.modifiersData.popperOffsets,
1296 position: state.options.strategy,
1297 adaptive: adaptive,
1298 roundOffsets: roundOffsets
1299 })));
1300 }
1301
1302 if (state.modifiersData.arrow != null) {
1303 state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
1304 offsets: state.modifiersData.arrow,
1305 position: 'absolute',
1306 adaptive: false,
1307 roundOffsets: roundOffsets
1308 })));
1309 }
1310
1311 state.attributes.popper = Object.assign({}, state.attributes.popper, {
1312 'data-popper-placement': state.placement
1313 });
1314 } // eslint-disable-next-line import/no-unused-modules
1315
1316
1317 var computeStyles$1 = {
1318 name: 'computeStyles',
1319 enabled: true,
1320 phase: 'beforeWrite',
1321 fn: computeStyles,
1322 data: {}
1323 };
1324
1325 // and applies them to the HTMLElements such as popper and arrow
1326
1327 function applyStyles(_ref) {
1328 var state = _ref.state;
1329 Object.keys(state.elements).forEach(function (name) {
1330 var style = state.styles[name] || {};
1331 var attributes = state.attributes[name] || {};
1332 var element = state.elements[name]; // arrow is optional + virtual elements
1333
1334 if (!isHTMLElement(element) || !getNodeName(element)) {
1335 return;
1336 } // Flow doesn't support to extend this property, but it's the most
1337 // effective way to apply styles to an HTMLElement
1338 // $FlowFixMe[cannot-write]
1339
1340
1341 Object.assign(element.style, style);
1342 Object.keys(attributes).forEach(function (name) {
1343 var value = attributes[name];
1344
1345 if (value === false) {
1346 element.removeAttribute(name);
1347 } else {
1348 element.setAttribute(name, value === true ? '' : value);
1349 }
1350 });
1351 });
1352 }
1353
1354 function effect(_ref2) {
1355 var state = _ref2.state;
1356 var initialStyles = {
1357 popper: {
1358 position: state.options.strategy,
1359 left: '0',
1360 top: '0',
1361 margin: '0'
1362 },
1363 arrow: {
1364 position: 'absolute'
1365 },
1366 reference: {}
1367 };
1368 Object.assign(state.elements.popper.style, initialStyles.popper);
1369 state.styles = initialStyles;
1370
1371 if (state.elements.arrow) {
1372 Object.assign(state.elements.arrow.style, initialStyles.arrow);
1373 }
1374
1375 return function () {
1376 Object.keys(state.elements).forEach(function (name) {
1377 var element = state.elements[name];
1378 var attributes = state.attributes[name] || {};
1379 var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them
1380
1381 var style = styleProperties.reduce(function (style, property) {
1382 style[property] = '';
1383 return style;
1384 }, {}); // arrow is optional + virtual elements
1385
1386 if (!isHTMLElement(element) || !getNodeName(element)) {
1387 return;
1388 }
1389
1390 Object.assign(element.style, style);
1391 Object.keys(attributes).forEach(function (attribute) {
1392 element.removeAttribute(attribute);
1393 });
1394 });
1395 };
1396 } // eslint-disable-next-line import/no-unused-modules
1397
1398
1399 var applyStyles$1 = {
1400 name: 'applyStyles',
1401 enabled: true,
1402 phase: 'write',
1403 fn: applyStyles,
1404 effect: effect,
1405 requires: ['computeStyles']
1406 };
1407
1408 var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1];
1409 var createPopper = /*#__PURE__*/popperGenerator({
1410 defaultModifiers: defaultModifiers
1411 }); // eslint-disable-next-line import/no-unused-modules
1412
1413 exports.createPopper = createPopper;
1414 exports.defaultModifiers = defaultModifiers;
1415 exports.detectOverflow = detectOverflow;
1416 exports.popperGenerator = popperGenerator;
1417
1418 Object.defineProperty(exports, '__esModule', { value: true });
1419
1420 })));
1421 //# sourceMappingURL=popper-lite.js.map
1422