PageSourceSearch

https://geranoilarisa.com/templates/tech/vendor/popper.js

js geranoilarisa.com collected 2026-09-27 11:58:13 UTC 85,365 bytes, 2,540 lines download raw bytes

vendor: 5,675 bytes, lines 1-199
1/**!
2 * @fileOverview Kickass library to create and place poppers near their reference elements.
3 * @version 1.14.4
4 * @license
5 * Copyright (c) 2016 Federico Zivolo and contributors
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal
9 * in the Software without restriction, including without limitation the rights
10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 * copies of the Software, and to permit persons to whom the Software is
12 * furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included in all
15 * copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 * SOFTWARE.
24 */
25(function (global, factory) {
26	typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
27	typeof define === 'function' && define.amd ? define(factory) :
28	(global.Popper = factory());
29}(this, (function () { 'use strict';
30
31var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
32
33var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
34var timeoutDuration = 0;
35for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
36  if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
37    timeoutDuration = 1;
38    break;
39  }
40}
41
42function microtaskDebounce(fn) {
43  var called = false;
44  return function () {
45    if (called) {
46      return;
47    }
48    called = true;
49    window.Promise.resolve().then(function () {
50      called = false;
51      fn();
52    });
53  };
54}
55
56function taskDebounce(fn) {
57  var scheduled = false;
58  return function () {
59    if (!scheduled) {
60      scheduled = true;
61      setTimeout(function () {
62        scheduled = false;
63        fn();
64      }, timeoutDuration);
65    }
66  };
67}
68
69var supportsMicroTasks = isBrowser && window.Promise;
70
71/**
72* Create a debounced version of a method, that's asynchronously deferred
73* but called in the minimum time possible.
74*
75* @method
76* @memberof Popper.Utils
77* @argument {Function} fn
78* @returns {Function}
79*/
80var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
81
82/**
83 * Check if the given variable is a function
84 * @method
85 * @memberof Popper.Utils
86 * @argument {Any} functionToCheck - variable to check
87 * @returns {Boolean} answer to: is a function?
88 */
89function isFunction(functionToCheck) {
90  var getType = {};
91  return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
92}
93
94/**
95 * Get CSS computed property of the given element
96 * @method
97 * @memberof Popper.Utils
98 * @argument {Eement} element
99 * @argument {String} property
100 */
101function getStyleComputedProperty(element, property) {
102  if (element.nodeType !== 1) {
103    return [];
104  }
105  // NOTE: 1 DOM access here
106  var css = getComputedStyle(element, null);
107  return property ? css[property] : css;
108}
109
110/**
111 * Returns the parentNode or the host of the element
112 * @method
113 * @memberof Popper.Utils
114 * @argument {Element} element
115 * @returns {Element} parent
116 */
117function getParentNode(element) {
118  if (element.nodeName === 'HTML') {
119    return element;
120  }
121  return element.parentNode || element.host;
122}
123
124/**
125 * Returns the scrolling parent of the given element
126 * @method
127 * @memberof Popper.Utils
128 * @argument {Element} element
129 * @returns {Element} scroll parent
130 */
131function getScrollParent(element) {
132  // Return body, `getScroll` will take care to get the correct `scrollTop` from it
133  if (!element) {
134    return document.body;
135  }
136
137  switch (element.nodeName) {
138    case 'HTML':
139    case 'BODY':
140      return element.ownerDocument.body;
141    case '#document':
142      return element.body;
143  }
144
145  // Firefox want us to check `-x` and `-y` variations as well
146
147  var _getStyleComputedProp = getStyleComputedProperty(element),
148      overflow = _getStyleComputedProp.overflow,
149      overflowX = _getStyleComputedProp.overflowX,
150      overflowY = _getStyleComputedProp.overflowY;
151
152  if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
153    return element;
154  }
155
156  return getScrollParent(getParentNode(element));
157}
158
159var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
160var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
161
162/**
163 * Determines if the browser is Internet Explorer
164 * @method
165 * @memberof Popper.Utils
166 * @param {Number} version to check
167 * @returns {Boolean} isIE
168 */
169function isIE(version) {
170  if (version === 11) {
171    return isIE11;
172  }
173  if (version === 10) {
174    return isIE10;
175  }
176  return isIE11 || isIE10;
177}
178
179/**
180 * Returns the offset parent of the given element
181 * @method
182 * @memberof Popper.Utils
183 * @argument {Element} element
184 * @returns {Element} offset parent
185 */
186function getOffsetParent(element) {
187  if (!element) {
188    return document.documentElement;
189  }
190
191  var noOffsetParent = isIE(10) ? document.body : null;
192
193  // NOTE: 1 DOM access here
194  var offsetParent = element.offsetParent;
195  // Skip hidden elements which don't have an offsetParent
196  while (offsetParent === noOffsetParent && element.nextElementSibling) {
197    offsetParent = (element = element.nextElementSibling).offsetParent;
198  }
199
200  var nodeName = offsetParent && offsetParent.nodeName;
201
202  if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
203    return element ? element.ownerDocument.documentElement : document.documentElement;
204  }
205
206  // .offsetParent will return the closest TD or TABLE in case
207  // no offsetParent is present, I hate this job...
208  if ([
vendor: 11,763 bytes, lines 208-576
208'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
209    return getOffsetParent(offsetParent);
210  }
211
212  return offsetParent;
213}
214
215function isOffsetContainer(element) {
216  var nodeName = element.nodeName;
217
218  if (nodeName === 'BODY') {
219    return false;
220  }
221  return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
222}
223
224/**
225 * Finds the root node (document, shadowDOM root) of the given element
226 * @method
227 * @memberof Popper.Utils
228 * @argument {Element} node
229 * @returns {Element} root node
230 */
231function getRoot(node) {
232  if (node.parentNode !== null) {
233    return getRoot(node.parentNode);
234  }
235
236  return node;
237}
238
239/**
240 * Finds the offset parent common to the two provided nodes
241 * @method
242 * @memberof Popper.Utils
243 * @argument {Element} element1
244 * @argument {Element} element2
245 * @returns {Element} common offset parent
246 */
247function findCommonOffsetParent(element1, element2) {
248  // This check is needed to avoid errors in case one of the elements isn't defined for any reason
249  if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
250    return document.documentElement;
251  }
252
253  // Here we make sure to give as "start" the element that comes first in the DOM
254  var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
255  var start = order ? element1 : element2;
256  var end = order ? element2 : element1;
257
258  // Get common ancestor container
259  var range = document.createRange();
260  range.setStart(start, 0);
261  range.setEnd(end, 0);
262  var commonAncestorContainer = range.commonAncestorContainer;
263
264  // Both nodes are inside #document
265
266  if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
267    if (isOffsetContainer(commonAncestorContainer)) {
268      return commonAncestorContainer;
269    }
270
271    return getOffsetParent(commonAncestorContainer);
272  }
273
274  // one of the nodes is inside shadowDOM, find which one
275  var element1root = getRoot(element1);
276  if (element1root.host) {
277    return findCommonOffsetParent(element1root.host, element2);
278  } else {
279    return findCommonOffsetParent(element1, getRoot(element2).host);
280  }
281}
282
283/**
284 * Gets the scroll value of the given element in the given side (top and left)
285 * @method
286 * @memberof Popper.Utils
287 * @argument {Element} element
288 * @argument {String} side `top` or `left`
289 * @returns {number} amount of scrolled pixels
290 */
291function getScroll(element) {
292  var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
293
294  var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
295  var nodeName = element.nodeName;
296
297  if (nodeName === 'BODY' || nodeName === 'HTML') {
298    var html = element.ownerDocument.documentElement;
299    var scrollingElement = element.ownerDocument.scrollingElement || html;
300    return scrollingElement[upperSide];
301  }
302
303  return element[upperSide];
304}
305
306/*
307 * Sum or subtract the element scroll values (left and top) from a given rect object
308 * @method
309 * @memberof Popper.Utils
310 * @param {Object} rect - Rect object you want to change
311 * @param {HTMLElement} element - The element from the function reads the scroll values
312 * @param {Boolean} subtract - set to true if you want to subtract the scroll values
313 * @return {Object} rect - The modifier rect object
314 */
315function includeScroll(rect, element) {
316  var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
317
318  var scrollTop = getScroll(element, 'top');
319  var scrollLeft = getScroll(element, 'left');
320  var modifier = subtract ? -1 : 1;
321  rect.top += scrollTop * modifier;
322  rect.bottom += scrollTop * modifier;
323  rect.left += scrollLeft * modifier;
324  rect.right += scrollLeft * modifier;
325  return rect;
326}
327
328/*
329 * Helper to detect borders of a given element
330 * @method
331 * @memberof Popper.Utils
332 * @param {CSSStyleDeclaration} styles
333 * Result of `getStyleComputedProperty` on the given element
334 * @param {String} axis - `x` or `y`
335 * @return {number} borders - The borders size of the given axis
336 */
337
338function getBordersSize(styles, axis) {
339  var sideA = axis === 'x' ? 'Left' : 'Top';
340  var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
341
342  return parseFloat(styles['border' + sideA + 'Width'], 10) + parseFloat(styles['border' + sideB + 'Width'], 10);
343}
344
345function getSize(axis, body, html, computedStyle) {
346  return Math.max(body['offset' + axis], body['scroll' + axis], html['client' + axis], html['offset' + axis], html['scroll' + axis], isIE(10) ? parseInt(html['offset' + axis]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Top' : 'Left')]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Bottom' : 'Right')]) : 0);
347}
348
349function getWindowSizes(document) {
350  var body = document.body;
351  var html = document.documentElement;
352  var computedStyle = isIE(10) && getComputedStyle(html);
353
354  return {
355    height: getSize('Height', body, html, computedStyle),
356    width: getSize('Width', body, html, computedStyle)
357  };
358}
359
360var classCallCheck = function (instance, Constructor) {
361  if (!(instance instanceof Constructor)) {
362    throw new TypeError("Cannot call a class as a function");
363  }
364};
365
366var createClass = function () {
367  function defineProperties(target, props) {
368    for (var i = 0; i < props.length; i++) {
369      var descriptor = props[i];
370      descriptor.enumerable = descriptor.enumerable || false;
371      descriptor.configurable = true;
372      if ("value" in descriptor) descriptor.writable = true;
373      Object.defineProperty(target, descriptor.key, descriptor);
374    }
375  }
376
377  return function (Constructor, protoProps, staticProps) {
378    if (protoProps) defineProperties(Constructor.prototype, protoProps);
379    if (staticProps) defineProperties(Constructor, staticProps);
380    return Constructor;
381  };
382}();
383
384
385
386
387
388var defineProperty = function (obj, key, value) {
389  if (key in obj) {
390    Object.defineProperty(obj, key, {
391      value: value,
392      enumerable: true,
393      configurable: true,
394      writable: true
395    });
396  } else {
397    obj[key] = value;
398  }
399
400  return obj;
401};
402
403var _extends = Object.assign || function (target) {
404  for (var i = 1; i < arguments.length; i++) {
405    var source = arguments[i];
406
407    for (var key in source) {
408      if (Object.prototype.hasOwnProperty.call(source, key)) {
409        target[key] = source[key];
410      }
411    }
412  }
413
414  return target;
415};
416
417/**
418 * Given element offsets, generate an output similar to getBoundingClientRect
419 * @method
420 * @memberof Popper.Utils
421 * @argument {Object} offsets
422 * @returns {Object} ClientRect like output
423 */
424function getClientRect(offsets) {
425  return _extends({}, offsets, {
426    right: offsets.left + offsets.width,
427    bottom: offsets.top + offsets.height
428  });
429}
430
431/**
432 * Get bounding client rect of given element
433 * @method
434 * @memberof Popper.Utils
435 * @param {HTMLElement} element
436 * @return {Object} client rect
437 */
438function getBoundingClientRect(element) {
439  var rect = {};
440
441  // IE10 10 FIX: Please, don't ask, the element isn't
442  // considered in DOM in some circumstances...
443  // This isn't reproducible in IE10 compatibility mode of IE11
444  try {
445    if (isIE(10)) {
446      rect = element.getBoundingClientRect();
447      var scrollTop = getScroll(element, 'top');
448      var scrollLeft = getScroll(element, 'left');
449      rect.top += scrollTop;
450      rect.left += scrollLeft;
451      rect.bottom += scrollTop;
452      rect.right += scrollLeft;
453    } else {
454      rect = element.getBoundingClientRect();
455    }
456  } catch (e) {}
457
458  var result = {
459    left: rect.left,
460    top: rect.top,
461    width: rect.right - rect.left,
462    height: rect.bottom - rect.top
463  };
464
465  // subtract scrollbar size from sizes
466  var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
467  var width = sizes.width || element.clientWidth || result.right - result.left;
468  var height = sizes.height || element.clientHeight || result.bottom - result.top;
469
470  var horizScrollbar = element.offsetWidth - width;
471  var vertScrollbar = element.offsetHeight - height;
472
473  // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
474  // we make this check conditional for performance reasons
475  if (horizScrollbar || vertScrollbar) {
476    var styles = getStyleComputedProperty(element);
477    horizScrollbar -= getBordersSize(styles, 'x');
478    vertScrollbar -= getBordersSize(styles, 'y');
479
480    result.width -= horizScrollbar;
481    result.height -= vertScrollbar;
482  }
483
484  return getClientRect(result);
485}
486
487function getOffsetRectRelativeToArbitraryNode(children, parent) {
488  var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
489
490  var isIE10 = isIE(10);
491  var isHTML = parent.nodeName === 'HTML';
492  var childrenRect = getBoundingClientRect(children);
493  var parentRect = getBoundingClientRect(parent);
494  var scrollParent = getScrollParent(children);
495
496  var styles = getStyleComputedProperty(parent);
497  var borderTopWidth = parseFloat(styles.borderTopWidth, 10);
498  var borderLeftWidth = parseFloat(styles.borderLeftWidth, 10);
499
500  // In cases where the parent is fixed, we must ignore negative scroll in offset calc
501  if (fixedPosition && isHTML) {
502    parentRect.top = Math.max(parentRect.top, 0);
503    parentRect.left = Math.max(parentRect.left, 0);
504  }
505  var offsets = getClientRect({
506    top: childrenRect.top - parentRect.top - borderTopWidth,
507    left: childrenRect.left - parentRect.left - borderLeftWidth,
508    width: childrenRect.width,
509    height: childrenRect.height
510  });
511  offsets.marginTop = 0;
512  offsets.marginLeft = 0;
513
514  // Subtract margins of documentElement in case it's being used as parent
515  // we do this only on HTML because it's the only element that behaves
516  // differently when margins are applied to it. The margins are included in
517  // the box of the documentElement, in the other cases not.
518  if (!isIE10 && isHTML) {
519    var marginTop = parseFloat(styles.marginTop, 10);
520    var marginLeft = parseFloat(styles.marginLeft, 10);
521
522    offsets.top -= borderTopWidth - marginTop;
523    offsets.bottom -= borderTopWidth - marginTop;
524    offsets.left -= borderLeftWidth - marginLeft;
525    offsets.right -= borderLeftWidth - marginLeft;
526
527    // Attach marginTop and marginLeft because in some circumstances we may need them
528    offsets.marginTop = marginTop;
529    offsets.marginLeft = marginLeft;
530  }
531
532  if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
533    offsets = includeScroll(offsets, parent);
534  }
535
536  return offsets;
537}
538
539function getViewportOffsetRectRelativeToArtbitraryNode(element) {
540  var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
541
542  var html = element.ownerDocument.documentElement;
543  var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
544  var width = Math.max(html.clientWidth, window.innerWidth || 0);
545  var height = Math.max(html.clientHeight, window.innerHeight || 0);
546
547  var scrollTop = !excludeScroll ? getScroll(html) : 0;
548  var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
549
550  var offset = {
551    top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
552    left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
553    width: width,
554    height: height
555  };
556
557  return getClientRect(offset);
558}
559
560/**
561 * Check if the given element is fixed or is inside a fixed parent
562 * @method
563 * @memberof Popper.Utils
564 * @argument {Element} element
565 * @argument {Element} customContainer
566 * @returns {Boolean} answer to "isFixed?"
567 */
568function isFixed(element) {
569  var nodeName = element.nodeName;
570  if (nodeName === 'BODY' || nodeName === 'HTML') {
571    return false;
572  }
573  if (getStyleComputedProperty(element, 'position') === 'fixed') {
574    return true;
575  }
576  
vendor: 5,350 bytes, lines 576-739
576return isFixed(getParentNode(element));
577}
578
579/**
580 * Finds the first parent of an element that has a transformed property defined
581 * @method
582 * @memberof Popper.Utils
583 * @argument {Element} element
584 * @returns {Element} first transformed parent or documentElement
585 */
586
587function getFixedPositionOffsetParent(element) {
588  // This check is needed to avoid errors in case one of the elements isn't defined for any reason
589  if (!element || !element.parentElement || isIE()) {
590    return document.documentElement;
591  }
592  var el = element.parentElement;
593  while (el && getStyleComputedProperty(el, 'transform') === 'none') {
594    el = el.parentElement;
595  }
596  return el || document.documentElement;
597}
598
599/**
600 * Computed the boundaries limits and return them
601 * @method
602 * @memberof Popper.Utils
603 * @param {HTMLElement} popper
604 * @param {HTMLElement} reference
605 * @param {number} padding
606 * @param {HTMLElement} boundariesElement - Element used to define the boundaries
607 * @param {Boolean} fixedPosition - Is in fixed position mode
608 * @returns {Object} Coordinates of the boundaries
609 */
610function getBoundaries(popper, reference, padding, boundariesElement) {
611  var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
612
613  // NOTE: 1 DOM access here
614
615  var boundaries = { top: 0, left: 0 };
616  var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, reference);
617
618  // Handle viewport case
619  if (boundariesElement === 'viewport') {
620    boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
621  } else {
622    // Handle other cases based on DOM element used as boundaries
623    var boundariesNode = void 0;
624    if (boundariesElement === 'scrollParent') {
625      boundariesNode = getScrollParent(getParentNode(reference));
626      if (boundariesNode.nodeName === 'BODY') {
627        boundariesNode = popper.ownerDocument.documentElement;
628      }
629    } else if (boundariesElement === 'window') {
630      boundariesNode = popper.ownerDocument.documentElement;
631    } else {
632      boundariesNode = boundariesElement;
633    }
634
635    var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
636
637    // In case of HTML, we need a different computation
638    if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
639      var _getWindowSizes = getWindowSizes(popper.ownerDocument),
640          height = _getWindowSizes.height,
641          width = _getWindowSizes.width;
642
643      boundaries.top += offsets.top - offsets.marginTop;
644      boundaries.bottom = height + offsets.top;
645      boundaries.left += offsets.left - offsets.marginLeft;
646      boundaries.right = width + offsets.left;
647    } else {
648      // for all the other DOM elements, this one is good
649      boundaries = offsets;
650    }
651  }
652
653  // Add paddings
654  padding = padding || 0;
655  var isPaddingNumber = typeof padding === 'number';
656  boundaries.left += isPaddingNumber ? padding : padding.left || 0;
657  boundaries.top += isPaddingNumber ? padding : padding.top || 0;
658  boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
659  boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
660
661  return boundaries;
662}
663
664function getArea(_ref) {
665  var width = _ref.width,
666      height = _ref.height;
667
668  return width * height;
669}
670
671/**
672 * Utility used to transform the `auto` placement to the placement with more
673 * available space.
674 * @method
675 * @memberof Popper.Utils
676 * @argument {Object} data - The data object generated by update method
677 * @argument {Object} options - Modifiers configuration and options
678 * @returns {Object} The data object, properly modified
679 */
680function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
681  var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
682
683  if (placement.indexOf('auto') === -1) {
684    return placement;
685  }
686
687  var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
688
689  var rects = {
690    top: {
691      width: boundaries.width,
692      height: refRect.top - boundaries.top
693    },
694    right: {
695      width: boundaries.right - refRect.right,
696      height: boundaries.height
697    },
698    bottom: {
699      width: boundaries.width,
700      height: boundaries.bottom - refRect.bottom
701    },
702    left: {
703      width: refRect.left - boundaries.left,
704      height: boundaries.height
705    }
706  };
707
708  var sortedAreas = Object.keys(rects).map(function (key) {
709    return _extends({
710      key: key
711    }, rects[key], {
712      area: getArea(rects[key])
713    });
714  }).sort(function (a, b) {
715    return b.area - a.area;
716  });
717
718  var filteredAreas = sortedAreas.filter(function (_ref2) {
719    var width = _ref2.width,
720        height = _ref2.height;
721    return width >= popper.clientWidth && height >= popper.clientHeight;
722  });
723
724  var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
725
726  var variation = placement.split('-')[1];
727
728  return computedPlacement + (variation ? '-' + variation : '');
729}
730
731/**
732 * Get offsets to the reference element
733 * @method
734 * @memberof Popper.Utils
735 * @param {Object} state
736 * @param {Element} popper - the popper element
737 * @param {Element} reference - the reference element (the popper will be relative to this)
738 * @param {Element} fixedPosition - is in fixed position mode
739 * @returns {Object}
739 An object containing the offsets which will be applied to the popper
740 */
741function getReferenceOffsets(state, popper, reference) {
742  var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
743
744  var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, reference);
745  return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
746}
747
748/**
749 * Get the outer sizes of the given element (offset size + margins)
750 * @method
751 * @memberof Popper.Utils
752 * @argument {Element} element
753 * @returns {Object} object containing width and height properties
754 */
755function getOuterSizes(element) {
756  var styles = getComputedStyle(element);
757  var x = parseFloat(styles.marginTop) + parseFloat(styles.marginBottom);
758  var y = parseFloat(styles.marginLeft) + parseFloat(styles.marginRight
vendor: 14,252 bytes, lines 758-1210
758);
759  var result = {
760    width: element.offsetWidth + y,
761    height: element.offsetHeight + x
762  };
763  return result;
764}
765
766/**
767 * Get the opposite placement of the given one
768 * @method
769 * @memberof Popper.Utils
770 * @argument {String} placement
771 * @returns {String} flipped placement
772 */
773function getOppositePlacement(placement) {
774  var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
775  return placement.replace(/left|right|bottom|top/g, function (matched) {
776    return hash[matched];
777  });
778}
779
780/**
781 * Get offsets to the popper
782 * @method
783 * @memberof Popper.Utils
784 * @param {Object} position - CSS position the Popper will get applied
785 * @param {HTMLElement} popper - the popper element
786 * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
787 * @param {String} placement - one of the valid placement options
788 * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
789 */
790function getPopperOffsets(popper, referenceOffsets, placement) {
791  placement = placement.split('-')[0];
792
793  // Get popper node sizes
794  var popperRect = getOuterSizes(popper);
795
796  // Add position, width and height to our offsets object
797  var popperOffsets = {
798    width: popperRect.width,
799    height: popperRect.height
800  };
801
802  // depending by the popper placement we have to compute its offsets slightly differently
803  var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
804  var mainSide = isHoriz ? 'top' : 'left';
805  var secondarySide = isHoriz ? 'left' : 'top';
806  var measurement = isHoriz ? 'height' : 'width';
807  var secondaryMeasurement = !isHoriz ? 'height' : 'width';
808
809  popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
810  if (placement === secondarySide) {
811    popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
812  } else {
813    popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
814  }
815
816  return popperOffsets;
817}
818
819/**
820 * Mimics the `find` method of Array
821 * @method
822 * @memberof Popper.Utils
823 * @argument {Array} arr
824 * @argument prop
825 * @argument value
826 * @returns index or -1
827 */
828function find(arr, check) {
829  // use native find if supported
830  if (Array.prototype.find) {
831    return arr.find(check);
832  }
833
834  // use `filter` to obtain the same behavior of `find`
835  return arr.filter(check)[0];
836}
837
838/**
839 * Return the index of the matching object
840 * @method
841 * @memberof Popper.Utils
842 * @argument {Array} arr
843 * @argument prop
844 * @argument value
845 * @returns index or -1
846 */
847function findIndex(arr, prop, value) {
848  // use native findIndex if supported
849  if (Array.prototype.findIndex) {
850    return arr.findIndex(function (cur) {
851      return cur[prop] === value;
852    });
853  }
854
855  // use `find` + `indexOf` if `findIndex` isn't supported
856  var match = find(arr, function (obj) {
857    return obj[prop] === value;
858  });
859  return arr.indexOf(match);
860}
861
862/**
863 * Loop trough the list of modifiers and run them in order,
864 * each of them will then edit the data object.
865 * @method
866 * @memberof Popper.Utils
867 * @param {dataObject} data
868 * @param {Array} modifiers
869 * @param {String} ends - Optional modifier name used as stopper
870 * @returns {dataObject}
871 */
872function runModifiers(modifiers, data, ends) {
873  var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
874
875  modifiersToRun.forEach(function (modifier) {
876    if (modifier['function']) {
877      // eslint-disable-line dot-notation
878      console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
879    }
880    var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
881    if (modifier.enabled && isFunction(fn)) {
882      // Add properties to offsets to make them a complete clientRect object
883      // we do this before each modifier to make sure the previous one doesn't
884      // mess with these values
885      data.offsets.popper = getClientRect(data.offsets.popper);
886      data.offsets.reference = getClientRect(data.offsets.reference);
887
888      data = fn(data, modifier);
889    }
890  });
891
892  return data;
893}
894
895/**
896 * Updates the position of the popper, computing the new offsets and applying
897 * the new style.<br />
898 * Prefer `scheduleUpdate` over `update` because of performance reasons.
899 * @method
900 * @memberof Popper
901 */
902function update() {
903  // if popper is destroyed, don't perform any further update
904  if (this.state.isDestroyed) {
905    return;
906  }
907
908  var data = {
909    instance: this,
910    styles: {},
911    arrowStyles: {},
912    attributes: {},
913    flipped: false,
914    offsets: {}
915  };
916
917  // compute reference element offsets
918  data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
919
920  // compute auto placement, store placement inside the data object,
921  // modifiers will be able to edit `placement` if needed
922  // and refer to originalPlacement to know the original value
923  data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
924
925  // store the computed placement inside `originalPlacement`
926  data.originalPlacement = data.placement;
927
928  data.positionFixed = this.options.positionFixed;
929
930  // compute the popper offsets
931  data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
932
933  data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
934
935  // run the modifiers
936  data = runModifiers(this.modifiers, data);
937
938  // the first `update` will call `onCreate` callback
939  // the other ones will call `onUpdate` callback
940  if (!this.state.isCreated) {
941    this.state.isCreated = true;
942    this.options.onCreate(data);
943  } else {
944    this.options.onUpdate(data);
945  }
946}
947
948/**
949 * Helper used to know if the given modifier is enabled.
950 * @method
951 * @memberof Popper.Utils
952 * @returns {Boolean}
953 */
954function isModifierEnabled(modifiers, modifierName) {
955  return modifiers.some(function (_ref) {
956    var name = _ref.name,
957        enabled = _ref.enabled;
958    return enabled && name === modifierName;
959  });
960}
961
962/**
963 * Get the prefixed supported property name
964 * @method
965 * @memberof Popper.Utils
966 * @argument {String} property (camelCase)
967 * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
968 */
969function getSupportedPropertyName(property) {
970  var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
971  var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
972
973  for (var i = 0; i < prefixes.length; i++) {
974    var prefix = prefixes[i];
975    var toCheck = prefix ? '' + prefix + upperProp : property;
976    if (typeof document.body.style[toCheck] !== 'undefined') {
977      return toCheck;
978    }
979  }
980  return null;
981}
982
983/**
984 * Destroys the popper.
985 * @method
986 * @memberof Popper
987 */
988function destroy() {
989  this.state.isDestroyed = true;
990
991  // touch DOM only if `applyStyle` modifier is enabled
992  if (isModifierEnabled(this.modifiers, 'applyStyle')) {
993    this.popper.removeAttribute('x-placement');
994    this.popper.style.position = '';
995    this.popper.style.top = '';
996    this.popper.style.left = '';
997    this.popper.style.right = '';
998    this.popper.style.bottom = '';
999    this.popper.style.willChange = '';
1000    this.popper.style[getSupportedPropertyName('transform')] = '';
1001  }
1002
1003  this.disableEventListeners();
1004
1005  // remove the popper if user explicity asked for the deletion on destroy
1006  // do not use `remove` because IE11 doesn't support it
1007  if (this.options.removeOnDestroy) {
1008    this.popper.parentNode.removeChild(this.popper);
1009  }
1010  return this;
1011}
1012
1013/**
1014 * Get the window associated with the element
1015 * @argument {Element} element
1016 * @returns {Window}
1017 */
1018function getWindow(element) {
1019  var ownerDocument = element.ownerDocument;
1020  return ownerDocument ? ownerDocument.defaultView : window;
1021}
1022
1023function attachToScrollParents(scrollParent, event, callback, scrollParents) {
1024  var isBody = scrollParent.nodeName === 'BODY';
1025  var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
1026  target.addEventListener(event, callback, { passive: true });
1027
1028  if (!isBody) {
1029    attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
1030  }
1031  scrollParents.push(target);
1032}
1033
1034/**
1035 * Setup needed event listeners used to update the popper position
1036 * @method
1037 * @memberof Popper.Utils
1038 * @private
1039 */
1040function setupEventListeners(reference, options, state, updateBound) {
1041  // Resize event listener on window
1042  state.updateBound = updateBound;
1043  getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
1044
1045  // Scroll event listener on scroll parents
1046  var scrollElement = getScrollParent(reference);
1047  attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
1048  state.scrollElement = scrollElement;
1049  state.eventsEnabled = true;
1050
1051  return state;
1052}
1053
1054/**
1055 * It will add resize/scroll events and start recalculating
1056 * position of the popper element when they are triggered.
1057 * @method
1058 * @memberof Popper
1059 */
1060function enableEventListeners() {
1061  if (!this.state.eventsEnabled) {
1062    this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
1063  }
1064}
1065
1066/**
1067 * Remove event listeners used to update the popper position
1068 * @method
1069 * @memberof Popper.Utils
1070 * @private
1071 */
1072function removeEventListeners(reference, state) {
1073  // Remove resize event listener on window
1074  getWindow(reference).removeEventListener('resize', state.updateBound);
1075
1076  // Remove scroll event listener on scroll parents
1077  state.scrollParents.forEach(function (target) {
1078    target.removeEventListener('scroll', state.updateBound);
1079  });
1080
1081  // Reset state
1082  state.updateBound = null;
1083  state.scrollParents = [];
1084  state.scrollElement = null;
1085  state.eventsEnabled = false;
1086  return state;
1087}
1088
1089/**
1090 * It will remove resize/scroll events and won't recalculate popper position
1091 * when they are triggered. It also won't trigger `onUpdate` callback anymore,
1092 * unless you call `update` method manually.
1093 * @method
1094 * @memberof Popper
1095 */
1096function disableEventListeners() {
1097  if (this.state.eventsEnabled) {
1098    cancelAnimationFrame(this.scheduleUpdate);
1099    this.state = removeEventListeners(this.reference, this.state);
1100  }
1101}
1102
1103/**
1104 * Tells if a given input is a number
1105 * @method
1106 * @memberof Popper.Utils
1107 * @param {*} input to check
1108 * @return {Boolean}
1109 */
1110function isNumeric(n) {
1111  return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
1112}
1113
1114/**
1115 * Set the style to the given popper
1116 * @method
1117 * @memberof Popper.Utils
1118 * @argument {Element} element - Element to apply the style to
1119 * @argument {Object} styles
1120 * Object with a list of properties and values which will be applied to the element
1121 */
1122function setStyles(element, styles) {
1123  Object.keys(styles).forEach(function (prop) {
1124    var unit = '';
1125    // add unit if the value is numeric and is one of the following
1126    if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
1127      unit = 'px';
1128    }
1129    element.style[prop] = styles[prop] + unit;
1130  });
1131}
1132
1133/**
1134 * Set the attributes to the given popper
1135 * @method
1136 * @memberof Popper.Utils
1137 * @argument {Element} element - Element to apply the attributes to
1138 * @argument {Object} styles
1139 * Object with a list of properties and values which will be applied to the element
1140 */
1141function setAttributes(element, attributes) {
1142  Object.keys(attributes).forEach(function (prop) {
1143    var value = attributes[prop];
1144    if (value !== false) {
1145      element.setAttribute(prop, attributes[prop]);
1146    } else {
1147      element.removeAttribute(prop);
1148    }
1149  });
1150}
1151
1152/**
1153 * @function
1154 * @memberof Modifiers
1155 * @argument {Object} data - The data object generated by `update` method
1156 * @argument {Object} data.styles - List of style properties - values to apply to popper element
1157 * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
1158 * @argument {Object} options - Modifiers configuration and options
1159 * @returns {Object} The same data object
1160 */
1161function applyStyle(data) {
1162  // any property present in `data.styles` will be applied to the popper,
1163  // in this way we can make the 3rd party modifiers add custom styles to it
1164  // Be aware, modifiers could override the properties defined in the previous
1165  // lines of this modifier!
1166  setStyles(data.instance.popper, data.styles);
1167
1168  // any property present in `data.attributes` will be applied to the popper,
1169  // they will be set as HTML attributes of the element
1170  setAttributes(data.instance.popper, data.attributes);
1171
1172  // if arrowElement is defined and arrowStyles has some properties
1173  if (data.arrowElement && Object.keys(data.arrowStyles).length) {
1174    setStyles(data.arrowElement, data.arrowStyles);
1175  }
1176
1177  return data;
1178}
1179
1180/**
1181 * Set the x-placement attribute before everything else because it could be used
1182 * to add margins to the popper margins needs to be calculated to get the
1183 * correct popper offsets.
1184 * @method
1185 * @memberof Popper.modifiers
1186 * @param {HTMLElement} reference - The reference element used to position the popper
1187 * @param {HTMLElement} popper - The HTML element used as popper
1188 * @param {Object} options - Popper.js options
1189 */
1190function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
1191  // compute reference element offsets
1192  var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
1193
1194  // compute auto placement, store placement inside the data object,
1195  // modifiers will be able to edit `placement` if needed
1196  // and refer to originalPlacement to know the original value
1197  var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
1198
1199  popper.setAttribute('x-placement', placement);
1200
1201  // Apply `position` to popper before anything else because
1202  // without the position applied we can't guarantee correct computations
1203  setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
1204
1205  return options;
1206}
1207
1208/**
1209 * @function
1210 * @memberof 
1210Modifiers
1211 * @argument {Object} data - The data object generated by `update` method
1212 * @argument {Object} options - Modifiers configuration and options
1213 * @returns {Object} The data object, properly modified
1214 */
1215function computeStyle(data, options) {
1216  var x = options.x,
1217      y = options.y;
1218  var popper = data.offsets.popper;
1219
1220  // Remove this legacy support in Popper.js v2
1221
1222  var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
1223    return modifier.name === 'applyStyle';
1224  }).gpuAcceleration;
1225  if (legacyGpuAccelerationOption !== undefined) {
1226    console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
1227  }
1228  var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
1229
1230  var offsetParent = getOffsetParent(data.instance.popper);
1231  var offsetParentRect = getBoundingClientRect(offsetParent);
1232
1233  // Styles
1234  var styles = {
1235    position: popper.position
1236  };
1237
1238  // Avoid blurry text by using full pixel integers.
1239  // For pixel-perfect positioning, top/bottom prefers rounded
1240  // values, while left/right prefers floored values.
1241  var offsets = {
1242    left: Math.floor(popper.left),
1243    top: Math.round(popper.top),
1244    bottom: Math.round(popper.bottom),
1245    right: Math.floor(popper.right)
1246  };
1247
1248  var sideA = x === 'bottom' ? 'top' : 'bottom';
1249  var sideB = y === 'right' ? 'left' : 'right';
1250
1251  // if gpuAcceleration is set to `true` and transform is supported,
1252  //  we use `translate3d` to apply the position to the popper we
1253  // automatically use the supported prefixed version if needed
1254  var prefixedProperty = getSupportedPropertyName('transform');
1255
1256  // now, let's make a step back and look at this code closely (wtf?)
1257  // If the content of the popper grows once it's been positioned, it
1258  // may happen that the popper gets misplaced because of the new content
1259  // overflowing its reference element
1260  // To avoid this problem, we provide two options (x and y), which allow
1261  // the consumer to define the offset origin.
1262  // If we position a popper on top of a reference element, we can set
1263  // `x` to `top` to make the popper grow towards its top instead of
1264  // its bottom.
1265  var left = void 0,
1266      top = void 0;
1267  if (sideA === 'bottom') {
1268    // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
1269    // and not the bottom of the html element
1270    if (offsetParent.nodeName === 'HTML') {
1271      top = -offsetParent.clientHeight + offsets.bottom;
1272    } else {
1273      top = -offsetParentRect.height + offsets.bottom;
1274    }
1275  } else {
1276    top = offsets.top;
1277  }
1278  if (sideB === 'right') {
vendor: 5,843 bytes, lines 1279-1450
1279    if (offsetParent.nodeName === 'HTML') {
1280      left = -offsetParent.clientWidth + offsets.right;
1281    } else {
1282      left = -offsetParentRect.width + offsets.right;
1283    }
1284  } else {
1285    left = offsets.left;
1286  }
1287  if (gpuAcceleration && prefixedProperty) {
1288    styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
1289    styles[sideA] = 0;
1290    styles[sideB] = 0;
1291    styles.willChange = 'transform';
1292  } else {
1293    // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
1294    var invertTop = sideA === 'bottom' ? -1 : 1;
1295    var invertLeft = sideB === 'right' ? -1 : 1;
1296    styles[sideA] = top * invertTop;
1297    styles[sideB] = left * invertLeft;
1298    styles.willChange = sideA + ', ' + sideB;
1299  }
1300
1301  // Attributes
1302  var attributes = {
1303    'x-placement': data.placement
1304  };
1305
1306  // Update `data` attributes, styles and arrowStyles
1307  data.attributes = _extends({}, attributes, data.attributes);
1308  data.styles = _extends({}, styles, data.styles);
1309  data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
1310
1311  return data;
1312}
1313
1314/**
1315 * Helper used to know if the given modifier depends from another one.<br />
1316 * It checks if the needed modifier is listed and enabled.
1317 * @method
1318 * @memberof Popper.Utils
1319 * @param {Array} modifiers - list of modifiers
1320 * @param {String} requestingName - name of requesting modifier
1321 * @param {String} requestedName - name of requested modifier
1322 * @returns {Boolean}
1323 */
1324function isModifierRequired(modifiers, requestingName, requestedName) {
1325  var requesting = find(modifiers, function (_ref) {
1326    var name = _ref.name;
1327    return name === requestingName;
1328  });
1329
1330  var isRequired = !!requesting && modifiers.some(function (modifier) {
1331    return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
1332  });
1333
1334  if (!isRequired) {
1335    var _requesting = '`' + requestingName + '`';
1336    var requested = '`' + requestedName + '`';
1337    console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
1338  }
1339  return isRequired;
1340}
1341
1342/**
1343 * @function
1344 * @memberof Modifiers
1345 * @argument {Object} data - The data object generated by update method
1346 * @argument {Object} options - Modifiers configuration and options
1347 * @returns {Object} The data object, properly modified
1348 */
1349function arrow(data, options) {
1350  var _data$offsets$arrow;
1351
1352  // arrow depends on keepTogether in order to work
1353  if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
1354    return data;
1355  }
1356
1357  var arrowElement = options.element;
1358
1359  // if arrowElement is a string, suppose it's a CSS selector
1360  if (typeof arrowElement === 'string') {
1361    arrowElement = data.instance.popper.querySelector(arrowElement);
1362
1363    // if arrowElement is not found, don't run the modifier
1364    if (!arrowElement) {
1365      return data;
1366    }
1367  } else {
1368    // if the arrowElement isn't a query selector we must check that the
1369    // provided DOM node is child of its popper node
1370    if (!data.instance.popper.contains(arrowElement)) {
1371      console.warn('WARNING: `arrow.element` must be child of its popper element!');
1372      return data;
1373    }
1374  }
1375
1376  var placement = data.placement.split('-')[0];
1377  var _data$offsets = data.offsets,
1378      popper = _data$offsets.popper,
1379      reference = _data$offsets.reference;
1380
1381  var isVertical = ['left', 'right'].indexOf(placement) !== -1;
1382
1383  var len = isVertical ? 'height' : 'width';
1384  var sideCapitalized = isVertical ? 'Top' : 'Left';
1385  var side = sideCapitalized.toLowerCase();
1386  var altSide = isVertical ? 'left' : 'top';
1387  var opSide = isVertical ? 'bottom' : 'right';
1388  var arrowElementSize = getOuterSizes(arrowElement)[len];
1389
1390  //
1391  // extends keepTogether behavior making sure the popper and its
1392  // reference have enough pixels in conjunction
1393  //
1394
1395  // top/left side
1396  if (reference[opSide] - arrowElementSize < popper[side]) {
1397    data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
1398  }
1399  // bottom/right side
1400  if (reference[side] + arrowElementSize > popper[opSide]) {
1401    data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
1402  }
1403  data.offsets.popper = getClientRect(data.offsets.popper);
1404
1405  // compute center of the popper
1406  var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
1407
1408  // Compute the sideValue using the updated popper offsets
1409  // take popper margin in account because we don't have this info available
1410  var css = getStyleComputedProperty(data.instance.popper);
1411  var popperMarginSide = parseFloat(css['margin' + sideCapitalized], 10);
1412  var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width'], 10);
1413  var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
1414
1415  // prevent arrowElement from being placed not contiguously to its popper
1416  sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
1417
1418  data.arrowElement = arrowElement;
1419  data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
1420
1421  return data;
1422}
1423
1424/**
1425 * Get the opposite placement variation of the given one
1426 * @method
1427 * @memberof Popper.Utils
1428 * @argument {String} placement variation
1429 * @returns {String} flipped placement variation
1430 */
1431function getOppositeVariation(variation) {
1432  if (variation === 'end') {
1433    return 'start';
1434  } else if (variation === 'start') {
1435    return 'end';
1436  }
1437  return variation;
1438}
1439
1440/**
1441 * List of accepted placements to use as values of the `placement` option.<br />
1442 * Valid placements are:
1443 * - `auto`
1444 * - `top`
1445 * - `right`
1446 * - `bottom`
1447 * - `left`
1448 *
1449 * Each placement can have a variation from this list:
1450 * - `-start`
1451 * - `-end`
1452 *
1453 * Variations are interpreted easily if you think of them as the left to right
1454 * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
1455 * is right.<br />
1456 * Vertically (`left` and `right`), `start` is top and `end` is bottom.
1457 *
1458 * Some valid examples are:
1459 * - `top-end` (on top of reference, right aligned)
1460 * - `right-start` (on right of reference, top aligned)
1461 * - `bottom` (on bottom, centered)
1462 * - `auto-end` (on the side with more space available, alignment depends by placement)
1463 *
1464 * @static
1465 * @type {Array}
1466 * @enum {String}
1467 * @readonly
1468 * @method placements
1469 * @memberof Popper
1470 */
1471var placements = ['auto-start', 'auto', 'auto-end', 'top-start', 'top', 'top-end', 'right-start', 'right', 'right-end', 'bottom-end', 'bottom', 'bottom-start', 'left-end', 'left', 'left-start'];
1472
1473// Get rid of `auto` `auto-start` and `auto-end`
1474var validPlacements = placements.slice(3);
1475
1476/**
1477 * Given an initial placement, returns all the subsequent placements
1478 * clockwise (or counter-clockwise).
1479 *
1480 * @method
1481 * @memberof Popper.Utils
1482 * @argument {String} placement - A valid placement (it accepts variations)
1483 * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
1484 * @returns {Array} placements including their variations
1485 */
1486function clockwise(placement) {
1487  var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1488
1489  var index = validPlacements.indexOf(placement);
1490  var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
1491  return counter ? arr.reverse() : arr;
1492}
1493
1494var BEHAVIORS = {
1495  FLIP: 'flip',
1496  CLOCKWISE: 'clockwise',
1497  COUNTERCLOCKWISE: 'counterclockwise'
1498};
1499
1500/**
1501 * @function
1502 * @memberof Modifiers
1503 * @argument {Object} data - The data object generated by update method
1504 * @argument {Object} options - Modifiers configuration and options
1505 * @returns {Object} The data object, properly modified
1506 */
1507function flip(data, options) {
1508  // if `inner` modifier is enabled, we can't use the `flip` modifier
1509  if (isModifierEnabled(data.instance.modifiers, 'inner')) {
1510    return data;
1511  }
1512
1513  if (data.flipped && data.placement === data.originalPlacement) {
1514    // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
1515    return data;
1516  }
1517
1518  var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
1519
1520  var placement = data.placement.split('-')[0];
1521  var placementOpposite = getOppositePlacement(placement);
1522  var variation = data.placement.split('-')[1] || '';
1523
1524  var flipOrder = [];
1525
1526  switch (options.behavior) {
1527    case BEHAVIORS.FLIP:
1528      flipOrder = [placement, placementOpposite];
1529      break;
1530    case BEHAVIORS.CLOCKWISE:
1531      flipOrder = clockwise(placement);
1532      break;
1533    case BEHAVIORS.COUNTERCLOCKWISE:
1534      flipOrder = clockwise(placement, true);
1535      break;
1536    default:
1537      flipOrder = options.behavior;
1538  }
1539
1540  flipOrder.forEach(function (step, index) {
1541    if (placement !== step || flipOrder.length === index + 1) {
1542      return data;
1543    }
1544
1545    placement = data.placement.split('-')[0];
1546    placementOpposite = getOppositePlacement(placement);
1547
1548    var popperOffsets = data.offsets.popper;
1549    var refOffsets = data.offsets.reference;
1550
1551    // using floor because the reference offsets may contain decimals we are not going to consider here
1552    var floor = Math.floor;
1553    var overlapsRef = placement === 'left' && floor(popperOffsets.right) > floor(refOffsets.left) || placement === 'right' && floor(popperOffsets.left) < floor(refOffsets.right) || placement === 'top' && floor(popperOffsets.bottom) > floor(refOffsets.top) || placement === 'bottom' && floor(popperOffsets.top) < floor(refOffsets.bottom);
1554
1555    var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
1556    var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
1557    var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
1558    var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
1559
1560    var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
1561
1562    // flip the variation if required
1563    var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
1564    var flippedVariation = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom)
vendor: 21,083 bytes, lines 1564-2171
1564;
1565
1566    if (overlapsRef || overflowsBoundaries || flippedVariation) {
1567      // this boolean to detect any flip loop
1568      data.flipped = true;
1569
1570      if (overlapsRef || overflowsBoundaries) {
1571        placement = flipOrder[index + 1];
1572      }
1573
1574      if (flippedVariation) {
1575        variation = getOppositeVariation(variation);
1576      }
1577
1578      data.placement = placement + (variation ? '-' + variation : '');
1579
1580      // this object contains `position`, we want to preserve it along with
1581      // any additional property we may add in the future
1582      data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
1583
1584      data = runModifiers(data.instance.modifiers, data, 'flip');
1585    }
1586  });
1587  return data;
1588}
1589
1590/**
1591 * @function
1592 * @memberof Modifiers
1593 * @argument {Object} data - The data object generated by update method
1594 * @argument {Object} options - Modifiers configuration and options
1595 * @returns {Object} The data object, properly modified
1596 */
1597function keepTogether(data) {
1598  var _data$offsets = data.offsets,
1599      popper = _data$offsets.popper,
1600      reference = _data$offsets.reference;
1601
1602  var placement = data.placement.split('-')[0];
1603  var floor = Math.floor;
1604  var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
1605  var side = isVertical ? 'right' : 'bottom';
1606  var opSide = isVertical ? 'left' : 'top';
1607  var measurement = isVertical ? 'width' : 'height';
1608
1609  if (popper[side] < floor(reference[opSide])) {
1610    data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
1611  }
1612  if (popper[opSide] > floor(reference[side])) {
1613    data.offsets.popper[opSide] = floor(reference[side]);
1614  }
1615
1616  return data;
1617}
1618
1619/**
1620 * Converts a string containing value + unit into a px value number
1621 * @function
1622 * @memberof {modifiers~offset}
1623 * @private
1624 * @argument {String} str - Value + unit string
1625 * @argument {String} measurement - `height` or `width`
1626 * @argument {Object} popperOffsets
1627 * @argument {Object} referenceOffsets
1628 * @returns {Number|String}
1629 * Value in pixels, or original string if no values were extracted
1630 */
1631function toValue(str, measurement, popperOffsets, referenceOffsets) {
1632  // separate value from unit
1633  var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
1634  var value = +split[1];
1635  var unit = split[2];
1636
1637  // If it's not a number it's an operator, I guess
1638  if (!value) {
1639    return str;
1640  }
1641
1642  if (unit.indexOf('%') === 0) {
1643    var element = void 0;
1644    switch (unit) {
1645      case '%p':
1646        element = popperOffsets;
1647        break;
1648      case '%':
1649      case '%r':
1650      default:
1651        element = referenceOffsets;
1652    }
1653
1654    var rect = getClientRect(element);
1655    return rect[measurement] / 100 * value;
1656  } else if (unit === 'vh' || unit === 'vw') {
1657    // if is a vh or vw, we calculate the size based on the viewport
1658    var size = void 0;
1659    if (unit === 'vh') {
1660      size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
1661    } else {
1662      size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
1663    }
1664    return size / 100 * value;
1665  } else {
1666    // if is an explicit pixel unit, we get rid of the unit and keep the value
1667    // if is an implicit unit, it's px, and we return just the value
1668    return value;
1669  }
1670}
1671
1672/**
1673 * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
1674 * @function
1675 * @memberof {modifiers~offset}
1676 * @private
1677 * @argument {String} offset
1678 * @argument {Object} popperOffsets
1679 * @argument {Object} referenceOffsets
1680 * @argument {String} basePlacement
1681 * @returns {Array} a two cells array with x and y offsets in numbers
1682 */
1683function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
1684  var offsets = [0, 0];
1685
1686  // Use height if placement is left or right and index is 0 otherwise use width
1687  // in this way the first offset will use an axis and the second one
1688  // will use the other one
1689  var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
1690
1691  // Split the offset string to obtain a list of values and operands
1692  // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
1693  var fragments = offset.split(/(\+|\-)/).map(function (frag) {
1694    return frag.trim();
1695  });
1696
1697  // Detect if the offset string contains a pair of values or a single one
1698  // they could be separated by comma or space
1699  var divider = fragments.indexOf(find(fragments, function (frag) {
1700    return frag.search(/,|\s/) !== -1;
1701  }));
1702
1703  if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
1704    console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
1705  }
1706
1707  // If divider is found, we divide the list of values and operands to divide
1708  // them by ofset X and Y.
1709  var splitRegex = /\s*,\s*|\s+/;
1710  var ops = divider !== -1 ? [fragments.slice(0, divider).concat([fragments[divider].split(splitRegex)[0]]), [fragments[divider].split(splitRegex)[1]].concat(fragments.slice(divider + 1))] : [fragments];
1711
1712  // Convert the values with units to absolute pixels to allow our computations
1713  ops = ops.map(function (op, index) {
1714    // Most of the units rely on the orientation of the popper
1715    var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
1716    var mergeWithPrevious = false;
1717    return op
1718    // This aggregates any `+` or `-` sign that aren't considered operators
1719    // e.g.: 10 + +5 => [10, +, +5]
1720    .reduce(function (a, b) {
1721      if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
1722        a[a.length - 1] = b;
1723        mergeWithPrevious = true;
1724        return a;
1725      } else if (mergeWithPrevious) {
1726        a[a.length - 1] += b;
1727        mergeWithPrevious = false;
1728        return a;
1729      } else {
1730        return a.concat(b);
1731      }
1732    }, [])
1733    // Here we convert the string values into number values (in px)
1734    .map(function (str) {
1735      return toValue(str, measurement, popperOffsets, referenceOffsets);
1736    });
1737  });
1738
1739  // Loop trough the offsets arrays and execute the operations
1740  ops.forEach(function (op, index) {
1741    op.forEach(function (frag, index2) {
1742      if (isNumeric(frag)) {
1743        offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
1744      }
1745    });
1746  });
1747  return offsets;
1748}
1749
1750/**
1751 * @function
1752 * @memberof Modifiers
1753 * @argument {Object} data - The data object generated by update method
1754 * @argument {Object} options - Modifiers configuration and options
1755 * @argument {Number|String} options.offset=0
1756 * The offset value as described in the modifier description
1757 * @returns {Object} The data object, properly modified
1758 */
1759function offset(data, _ref) {
1760  var offset = _ref.offset;
1761  var placement = data.placement,
1762      _data$offsets = data.offsets,
1763      popper = _data$offsets.popper,
1764      reference = _data$offsets.reference;
1765
1766  var basePlacement = placement.split('-')[0];
1767
1768  var offsets = void 0;
1769  if (isNumeric(+offset)) {
1770    offsets = [+offset, 0];
1771  } else {
1772    offsets = parseOffset(offset, popper, reference, basePlacement);
1773  }
1774
1775  if (basePlacement === 'left') {
1776    popper.top += offsets[0];
1777    popper.left -= offsets[1];
1778  } else if (basePlacement === 'right') {
1779    popper.top += offsets[0];
1780    popper.left += offsets[1];
1781  } else if (basePlacement === 'top') {
1782    popper.left += offsets[0];
1783    popper.top -= offsets[1];
1784  } else if (basePlacement === 'bottom') {
1785    popper.left += offsets[0];
1786    popper.top += offsets[1];
1787  }
1788
1789  data.popper = popper;
1790  return data;
1791}
1792
1793/**
1794 * @function
1795 * @memberof Modifiers
1796 * @argument {Object} data - The data object generated by `update` method
1797 * @argument {Object} options - Modifiers configuration and options
1798 * @returns {Object} The data object, properly modified
1799 */
1800function preventOverflow(data, options) {
1801  var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
1802
1803  // If offsetParent is the reference element, we really want to
1804  // go one step up and use the next offsetParent as reference to
1805  // avoid to make this modifier completely useless and look like broken
1806  if (data.instance.reference === boundariesElement) {
1807    boundariesElement = getOffsetParent(boundariesElement);
1808  }
1809
1810  // NOTE: DOM access here
1811  // resets the popper's position so that the document size can be calculated excluding
1812  // the size of the popper element itself
1813  var transformProp = getSupportedPropertyName('transform');
1814  var popperStyles = data.instance.popper.style; // assignment to help minification
1815  var top = popperStyles.top,
1816      left = popperStyles.left,
1817      transform = popperStyles[transformProp];
1818
1819  popperStyles.top = '';
1820  popperStyles.left = '';
1821  popperStyles[transformProp] = '';
1822
1823  var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
1824
1825  // NOTE: DOM access here
1826  // restores the original style properties after the offsets have been computed
1827  popperStyles.top = top;
1828  popperStyles.left = left;
1829  popperStyles[transformProp] = transform;
1830
1831  options.boundaries = boundaries;
1832
1833  var order = options.priority;
1834  var popper = data.offsets.popper;
1835
1836  var check = {
1837    primary: function primary(placement) {
1838      var value = popper[placement];
1839      if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
1840        value = Math.max(popper[placement], boundaries[placement]);
1841      }
1842      return defineProperty({}, placement, value);
1843    },
1844    secondary: function secondary(placement) {
1845      var mainSide = placement === 'right' ? 'left' : 'top';
1846      var value = popper[mainSide];
1847      if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
1848        value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
1849      }
1850      return defineProperty({}, mainSide, value);
1851    }
1852  };
1853
1854  order.forEach(function (placement) {
1855    var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
1856    popper = _extends({}, popper, check[side](placement));
1857  });
1858
1859  data.offsets.popper = popper;
1860
1861  return data;
1862}
1863
1864/**
1865 * @function
1866 * @memberof Modifiers
1867 * @argument {Object} data - The data object generated by `update` method
1868 * @argument {Object} options - Modifiers configuration and options
1869 * @returns {Object} The data object, properly modified
1870 */
1871function shift(data) {
1872  var placement = data.placement;
1873  var basePlacement = placement.split('-')[0];
1874  var shiftvariation = placement.split('-')[1];
1875
1876  // if shift shiftvariation is specified, run the modifier
1877  if (shiftvariation) {
1878    var _data$offsets = data.offsets,
1879        reference = _data$offsets.reference,
1880        popper = _data$offsets.popper;
1881
1882    var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
1883    var side = isVertical ? 'left' : 'top';
1884    var measurement = isVertical ? 'width' : 'height';
1885
1886    var shiftOffsets = {
1887      start: defineProperty({}, side, reference[side]),
1888      end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
1889    };
1890
1891    data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
1892  }
1893
1894  return data;
1895}
1896
1897/**
1898 * @function
1899 * @memberof Modifiers
1900 * @argument {Object} data - The data object generated by update method
1901 * @argument {Object} options - Modifiers configuration and options
1902 * @returns {Object} The data object, properly modified
1903 */
1904function hide(data) {
1905  if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
1906    return data;
1907  }
1908
1909  var refRect = data.offsets.reference;
1910  var bound = find(data.instance.modifiers, function (modifier) {
1911    return modifier.name === 'preventOverflow';
1912  }).boundaries;
1913
1914  if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
1915    // Avoid unnecessary DOM access if visibility hasn't changed
1916    if (data.hide === true) {
1917      return data;
1918    }
1919
1920    data.hide = true;
1921    data.attributes['x-out-of-boundaries'] = '';
1922  } else {
1923    // Avoid unnecessary DOM access if visibility hasn't changed
1924    if (data.hide === false) {
1925      return data;
1926    }
1927
1928    data.hide = false;
1929    data.attributes['x-out-of-boundaries'] = false;
1930  }
1931
1932  return data;
1933}
1934
1935/**
1936 * @function
1937 * @memberof Modifiers
1938 * @argument {Object} data - The data object generated by `update` method
1939 * @argument {Object} options - Modifiers configuration and options
1940 * @returns {Object} The data object, properly modified
1941 */
1942function inner(data) {
1943  var placement = data.placement;
1944  var basePlacement = placement.split('-')[0];
1945  var _data$offsets = data.offsets,
1946      popper = _data$offsets.popper,
1947      reference = _data$offsets.reference;
1948
1949  var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
1950
1951  var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
1952
1953  popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
1954
1955  data.placement = getOppositePlacement(placement);
1956  data.offsets.popper = getClientRect(popper);
1957
1958  return data;
1959}
1960
1961/**
1962 * Modifier function, each modifier can have a function of this type assigned
1963 * to its `fn` property.<br />
1964 * These functions will be called on each update, this means that you must
1965 * make sure they are performant enough to avoid performance bottlenecks.
1966 *
1967 * @function ModifierFn
1968 * @argument {dataObject} data - The data object generated by `update` method
1969 * @argument {Object} options - Modifiers configuration and options
1970 * @returns {dataObject} The data object, properly modified
1971 */
1972
1973/**
1974 * Modifiers are plugins used to alter the behavior of your poppers.<br />
1975 * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
1976 * needed by the library.
1977 *
1978 * Usually you don't want to override the `order`, `fn` and `onLoad` props.
1979 * All the other properties are configurations that could be tweaked.
1980 * @namespace modifiers
1981 */
1982var modifiers = {
1983  /**
1984   * Modifier used to shift the popper on the start or end of its reference
1985   * element.<br />
1986   * It will read the variation of the `placement` property.<br />
1987   * It can be one either `-end` or `-start`.
1988   * @memberof modifiers
1989   * @inner
1990   */
1991  shift: {
1992    /** @prop {number} order=100 - Index used to define the order of execution */
1993    order: 100,
1994    /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
1995    enabled: true,
1996    /** @prop {ModifierFn} */
1997    fn: shift
1998  },
1999
2000  /**
2001   * The `offset` modifier can shift your popper on both its axis.
2002   *
2003   * It accepts the following units:
2004   * - `px` or unit-less, interpreted as pixels
2005   * - `%` or `%r`, percentage relative to the length of the reference element
2006   * - `%p`, percentage relative to the length of the popper element
2007   * - `vw`, CSS viewport width unit
2008   * - `vh`, CSS viewport height unit
2009   *
2010   * For length is intended the main axis relative to the placement of the popper.<br />
2011   * This means that if the placement is `top` or `bottom`, the length will be the
2012   * `width`. In case of `left` or `right`, it will be the `height`.
2013   *
2014   * You can provide a single value (as `Number` or `String`), or a pair of values
2015   * as `String` divided by a comma or one (or more) white spaces.<br />
2016   * The latter is a deprecated method because it leads to confusion and will be
2017   * removed in v2.<br />
2018   * Additionally, it accepts additions and subtractions between different units.
2019   * Note that multiplications and divisions aren't supported.
2020   *
2021   * Valid examples are:
2022   * ```
2023   * 10
2024   * '10%'
2025   * '10, 10'
2026   * '10%, 10'
2027   * '10 + 10%'
2028   * '10 - 5vh + 3%'
2029   * '-10px + 5vh, 5px - 6%'
2030   * ```
2031   * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
2032   * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
2033   * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
2034   *
2035   * @memberof modifiers
2036   * @inner
2037   */
2038  offset: {
2039    /** @prop {number} order=200 - Index used to define the order of execution */
2040    order: 200,
2041    /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
2042    enabled: true,
2043    /** @prop {ModifierFn} */
2044    fn: offset,
2045    /** @prop {Number|String} offset=0
2046     * The offset value as described in the modifier description
2047     */
2048    offset: 0
2049  },
2050
2051  /**
2052   * Modifier used to prevent the popper from being positioned outside the boundary.
2053   *
2054   * A scenario exists where the reference itself is not within the boundaries.<br />
2055   * We can say it has "escaped the boundaries" — or just "escaped".<br />
2056   * In this case we need to decide whether the popper should either:
2057   *
2058   * - detach from the reference and remain "trapped" in the boundaries, or
2059   * - if it should ignore the boundary and "escape with its reference"
2060   *
2061   * When `escapeWithReference` is set to`true` and reference is completely
2062   * outside its boundaries, the popper will overflow (or completely leave)
2063   * the boundaries in order to remain attached to the edge of the reference.
2064   *
2065   * @memberof modifiers
2066   * @inner
2067   */
2068  preventOverflow: {
2069    /** @prop {number} order=300 - Index used to define the order of execution */
2070    order: 300,
2071    /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
2072    enabled: true,
2073    /** @prop {ModifierFn} */
2074    fn: preventOverflow,
2075    /**
2076     * @prop {Array} [priority=['left','right','top','bottom']]
2077     * Popper will try to prevent overflow following these priorities by default,
2078     * then, it could overflow on the left and on top of the `boundariesElement`
2079     */
2080    priority: ['left', 'right', 'top', 'bottom'],
2081    /**
2082     * @prop {number} padding=5
2083     * Amount of pixel used to define a minimum distance between the boundaries
2084     * and the popper. This makes sure the popper always has a little padding
2085     * between the edges of its container
2086     */
2087    padding: 5,
2088    /**
2089     * @prop {String|HTMLElement} boundariesElement='scrollParent'
2090     * Boundaries used by the modifier. Can be `scrollParent`, `window`,
2091     * `viewport` or any DOM element.
2092     */
2093    boundariesElement: 'scrollParent'
2094  },
2095
2096  /**
2097   * Modifier used to make sure the reference and its popper stay near each other
2098   * without leaving any gap between the two. Especially useful when the arrow is
2099   * enabled and you want to ensure that it points to its reference element.
2100   * It cares only about the first axis. You can still have poppers with margin
2101   * between the popper and its reference element.
2102   * @memberof modifiers
2103   * @inner
2104   */
2105  keepTogether: {
2106    /** @prop {number} order=400 - Index used to define the order of execution */
2107    order: 400,
2108    /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
2109    enabled: true,
2110    /** @prop {ModifierFn} */
2111    fn: keepTogether
2112  },
2113
2114  /**
2115   * This modifier is used to move the `arrowElement` of the popper to make
2116   * sure it is positioned between the reference element and its popper element.
2117   * It will read the outer size of the `arrowElement` node to detect how many
2118   * pixels of conjunction are needed.
2119   *
2120   * It has no effect if no `arrowElement` is provided.
2121   * @memberof modifiers
2122   * @inner
2123   */
2124  arrow: {
2125    /** @prop {number} order=500 - Index used to define the order of execution */
2126    order: 500,
2127    /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
2128    enabled: true,
2129    /** @prop {ModifierFn} */
2130    fn: arrow,
2131    /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
2132    element: '[x-arrow]'
2133  },
2134
2135  /**
2136   * Modifier used to flip the popper's placement when it starts to overlap its
2137   * reference element.
2138   *
2139   * Requires the `preventOverflow` modifier before it in order to work.
2140   *
2141   * **NOTE:** this modifier will interrupt the current update cycle and will
2142   * restart it if it detects the need to flip the placement.
2143   * @memberof modifiers
2144   * @inner
2145   */
2146  flip: {
2147    /** @prop {number} order=600 - Index used to define the order of execution */
2148    order: 600,
2149    /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
2150    enabled: true,
2151    /** @prop {ModifierFn} */
2152    fn: flip,
2153    /**
2154     * @prop {String|Array} behavior='flip'
2155     * The behavior used to change the popper's placement. It can be one of
2156     * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
2157     * placements (with optional variations)
2158     */
2159    behavior: 'flip',
2160    /**
2161     * @prop {number} padding=5
2162     * The popper will flip if it hits the edges of the `boundariesElement`
2163     */
2164    padding: 5,
2165    /**
2166     * @prop {String|HTMLElement} boundariesElement='viewport'
2167     * The element which will define the boundaries of the popper position.
2168     * The popper will never be placed outside of the defined boundaries
2169     * (except if `keepTogether` is enabled)
2170     */
2171    boundariesElement: 'viewport'
2171
2172  },
2173
2174  /**
2175   * Modifier used to make the popper flow toward the inner of the reference element.
2176   * By default, when this modifier is disabled, the popper will be placed outside
2177   * the reference element.
2178   * @memberof modifiers
2179   * @inner
2180   */
2181  inner: {
2182    /** @prop {number} order=700 - Index used to define the order of execution */
2183    order: 700,
2184    /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
2185    enabled: false,
2186    /** @prop {ModifierFn} */
2187    fn: inner
2188  },
2189
2190  /**
2191   * Modifier used to hide the popper when its reference element is outside of the
2192   * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
2193   * be used to hide with a CSS selector the popper when its reference is
2194   * out of boundaries.
2195   *
2196   * Requires the `preventOverflow` modifier before it in order to work.
2197   * @memberof modifiers
2198   * @inner
2199   */
2200  hide: {
2201    /** @prop {number} order=800 - Index used to define the order of execution */
2202    order: 800,
2203    /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
2204    enabled: true,
2205    /** @prop {ModifierFn} */
2206    fn: hide
2207  },
2208
2209  /**
2210   * Computes the style that will be applied to the popper element to gets
2211   * properly positioned.
2212   *
2213   * Note that this modifier will not touch the DOM, it just prepares the styles
2214   * so that `applyStyle` modifier can apply it. This separation is useful
2215   * in case you need to replace `applyStyle` with a custom implementation.
2216   *
2217   * This modifier has `850` as `order` value to maintain backward compatibility
2218   * with previous versions of Popper.js. Expect the modifiers ordering method
2219   * to change in future major versions of the library.
2220   *
2221   * @memberof modifiers
2222   * @inner
2223   */
2224  computeStyle: {
2225    /** @prop {number} order=850 - Index used to define the order of execution */
2226    order: 850,
2227    /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
2228    enabled: true,
2229    /** @prop {ModifierFn} */
2230    fn: computeStyle,
2231    /**
2232     * @prop {Boolean} gpuAcceleration=true
2233     * If true, it uses the CSS 3D transformation to position the popper.
2234     * Otherwise, it will use the `top` and `left` properties
2235     */
2236    gpuAcceleration: true,
2237    /**
2238     * @prop {string} [x='bottom']
2239     * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
2240     * Change this if your popper should grow in a direction different from `bottom`
2241     */
2242    x: 'bottom',
2243    /**
2244     * @prop {string} [x='left']
2245     * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
2246     * Change this if your popper should grow in a direction different from `right`
2247     */
2248    y: 'right'
2249  },
2250
2251  /**
2252   * Applies the computed styles to the popper element.
2253   *
2254   * All the DOM manipulations are limited to this modifier. This is useful in case
2255   * you want to integrate Popper.js inside a framework or view library and you
2256   * want to delegate all the DOM manipulations to it.
2257   *
2258   * Note that if you disable this modifier, you must make sure the popper element
2259   * has its position set to `absolute` before Popper.js can do its work!
2260   *
2261   * Just disable this modifier and define your own to achieve the desired effect.
2262   *
2263   * @memberof modifiers
2264   * @inner
2265   */
2266  applyStyle: {
2267    /** @prop {number} order=900 - Index used to define the order of execution */
2268    order: 900,
2269    /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
2270    enabled: true,
2271    /** @prop {ModifierFn} */
2272    fn: applyStyle,
2273    /** @prop {Function} */
2274    onLoad: applyStyleOnLoad,
2275    /**
2276     * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
2277     * @prop {Boolean} gpuAcceleration=true
2278     * If true, it uses the CSS 3D transformation to position the popper.
2279     * Otherwise, it will use the `top` and `left` properties
2280     */
2281    gpuAcceleration: undefined
2282  }
2283};
2284
2285/**
2286 * The `dataObject` is an object containing all the information used by Popper.js.
2287 * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
2288 * @name dataObject
2289 * @property {Object} data.instance The Popper.js instance
2290 * @property {String} data.placement Placement applied to popper
2291 * @property {String} data.originalPlacement Placement originally defined on init
2292 * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
2293 * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
2294 * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
2295 * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
2296 * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
2297 * @property {Object} data.boundaries Offsets of the popper boundaries
2298 * @property {Object} data.offsets The measurements of popper, reference and arrow elements
2299 * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
2300 * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
2301 * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
2302 */
2303
2304/**
2305 * Default options provided to Popper.js constructor.<br />
2306 * These can be overridden using the `options` argument of Popper.js.<br />
2307 * To override an option, simply pass an object with the same
2308 * structure of the `options` object, as the 3rd argument. For example:
2309 * ```
2310 * new Popper(ref, pop, {
2311 *   modifiers: {
2312 *     preventOverflow: { enabled: false }
2313 *   }
2314 * })
2315 * ```
2316 * @type {Object}
2317 * @static
2318 * @memberof Popper
2319 */
2320var Defaults = {
2321  /**
2322   * Popper's placement.
2323   * @prop {Popper.placements} placement='bottom'
2324   */
2325  placement: 'bottom',
2326
2327  /**
2328   * Set this to true if you want popper to position it self in 'fixed' mode
2329   * @prop {Boolean} positionFixed=false
2330   */
2331  positionFixed: false,
2332
2333  /**
2334   * Whether events (resize, scroll) are initially enabled.
2335   * @prop {Boolean} eventsEnabled=true
2336   */
2337  eventsEnabled: true,
2338
2339  /**
2340   * Set to true if you want to automatically remove the popper when
2341   * you call the `destroy` method.
2342   * @prop {Boolean} removeOnDestroy=false
2343   */
2344  removeOnDestroy: false,
2345
2346  /**
2347   * Callback called when the popper is created.<br />
2348   * By default, it is set to no-op.<br />
2349   * Access Popper.js instance with `data.instance`.
2350   * @prop {onCreate}
2351   */
2352  onCreate: function onCreate() {},
2353
2354  /**
2355   * Callback called when the popper is updated. This callback is not called
2356   * on the initialization/creation of the popper, but only on subsequent
2357   * updates.<br />
2358   * By default, it is set to no-op.<br />
2359   * Access Popper.js instance with `data.instance`.
2360   * @prop {onUpdate}
2361   */
2362  onUpdate: function onUpdate() {},
2363
2364  /**
2365   * List of modifiers used to modify the offsets before they are applied to the popper.
2366   * They provide most of the functionalities of Popper.js.
2367   * @prop {modifiers}
2368   */
2369  modifiers: modifiers
2370};
2371
2372/**
2373 * @callback onCreate
2374 * @param {dataObject} data
2375 */
2376
2377/**
2378 * @callback onUpdate
2379 * @param {dataObject} data
2380 */
2381
2382// Utils
2383// Methods
2384var Popper = function () {
2385  /**
2386   * Creates a new Popper.js instance.
2387   * @class Popper
2388   * @param {HTMLElement|referenceObject} reference - The reference element used to position the popper
2389   * @param {HTMLElement} popper - The HT
vendor: 5,138 bytes, lines 2389-2540
2389ML element used as the popper
2390   * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
2391   * @return {Object} instance - The generated Popper.js instance
2392   */
2393  function Popper(reference, popper) {
2394    var _this = this;
2395
2396    var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
2397    classCallCheck(this, Popper);
2398
2399    this.scheduleUpdate = function () {
2400      return requestAnimationFrame(_this.update);
2401    };
2402
2403    // make update() debounced, so that it only runs at most once-per-tick
2404    this.update = debounce(this.update.bind(this));
2405
2406    // with {} we create a new object with the options inside it
2407    this.options = _extends({}, Popper.Defaults, options);
2408
2409    // init state
2410    this.state = {
2411      isDestroyed: false,
2412      isCreated: false,
2413      scrollParents: []
2414    };
2415
2416    // get reference and popper elements (allow jQuery wrappers)
2417    this.reference = reference && reference.jquery ? reference[0] : reference;
2418    this.popper = popper && popper.jquery ? popper[0] : popper;
2419
2420    // Deep merge modifiers options
2421    this.options.modifiers = {};
2422    Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
2423      _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
2424    });
2425
2426    // Refactoring modifiers' list (Object => Array)
2427    this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
2428      return _extends({
2429        name: name
2430      }, _this.options.modifiers[name]);
2431    })
2432    // sort the modifiers by order
2433    .sort(function (a, b) {
2434      return a.order - b.order;
2435    });
2436
2437    // modifiers have the ability to execute arbitrary code when Popper.js get inited
2438    // such code is executed in the same order of its modifier
2439    // they could add new properties to their options configuration
2440    // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
2441    this.modifiers.forEach(function (modifierOptions) {
2442      if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
2443        modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
2444      }
2445    });
2446
2447    // fire the first update to position the popper in the right place
2448    this.update();
2449
2450    var eventsEnabled = this.options.eventsEnabled;
2451    if (eventsEnabled) {
2452      // setup event listeners, they will take care of update the position in specific situations
2453      this.enableEventListeners();
2454    }
2455
2456    this.state.eventsEnabled = eventsEnabled;
2457  }
2458
2459  // We can't use class properties because they don't get listed in the
2460  // class prototype and break stuff like Sinon stubs
2461
2462
2463  createClass(Popper, [{
2464    key: 'update',
2465    value: function update$$1() {
2466      return update.call(this);
2467    }
2468  }, {
2469    key: 'destroy',
2470    value: function destroy$$1() {
2471      return destroy.call(this);
2472    }
2473  }, {
2474    key: 'enableEventListeners',
2475    value: function enableEventListeners$$1() {
2476      return enableEventListeners.call(this);
2477    }
2478  }, {
2479    key: 'disableEventListeners',
2480    value: function disableEventListeners$$1() {
2481      return disableEventListeners.call(this);
2482    }
2483
2484    /**
2485     * Schedules an update. It will run on the next UI update available.
2486     * @method scheduleUpdate
2487     * @memberof Popper
2488     */
2489
2490
2491    /**
2492     * Collection of utilities useful when writing custom modifiers.
2493     * Starting from version 1.7, this method is available only if you
2494     * include `popper-utils.js` before `popper.js`.
2495     *
2496     * **DEPRECATION**: This way to access PopperUtils is deprecated
2497     * and will be removed in v2! Use the PopperUtils module directly instead.
2498     * Due to the high instability of the methods contained in Utils, we can't
2499     * guarantee them to follow semver. Use them at your own risk!
2500     * @static
2501     * @private
2502     * @type {Object}
2503     * @deprecated since version 1.8
2504     * @member Utils
2505     * @memberof Popper
2506     */
2507
2508  }]);
2509  return Popper;
2510}();
2511
2512/**
2513 * The `referenceObject` is an object that provides an interface compatible with Popper.js
2514 * and lets you use it as replacement of a real DOM node.<br />
2515 * You can use this method to position a popper relatively to a set of coordinates
2516 * in case you don't have a DOM node to use as reference.
2517 *
2518 * ```
2519 * new Popper(referenceObject, popperNode);
2520 * ```
2521 *
2522 * NB: This feature isn't supported in Internet Explorer 10.
2523 * @name referenceObject
2524 * @property {Function} data.getBoundingClientRect
2525 * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
2526 * @property {number} data.clientWidth
2527 * An ES6 getter that will return the width of the virtual reference element.
2528 * @property {number} data.clientHeight
2529 * An ES6 getter that will return the height of the virtual reference element.
2530 */
2531
2532
2533Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
2534Popper.placements = placements;
2535Popper.Defaults = Defaults;
2536
2537return Popper;
2538
2539})));
2540//# sourceMappingURL=popper.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.