Path: blob/master/sites/whatsapp-phishing/vendor/bootstrap/js/popper.js
739 views
/**!1* @fileOverview Kickass library to create and place poppers near their reference elements.2* @version 1.12.53* @license4* Copyright (c) 2016 Federico Zivolo and contributors5*6* Permission is hereby granted, free of charge, to any person obtaining a copy7* of this software and associated documentation files (the "Software"), to deal8* in the Software without restriction, including without limitation the rights9* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell10* copies of the Software, and to permit persons to whom the Software is11* furnished to do so, subject to the following conditions:12*13* The above copyright notice and this permission notice shall be included in all14* copies or substantial portions of the Software.15*16* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR17* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,18* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE19* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER20* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,21* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE22* SOFTWARE.23*/24(function (global, factory) {25typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :26typeof define === 'function' && define.amd ? define(factory) :27(global.Popper = factory());28}(this, (function () { 'use strict';2930var nativeHints = ['native code', '[object MutationObserverConstructor]'];3132/**33* Determine if a function is implemented natively (as opposed to a polyfill).34* @method35* @memberof Popper.Utils36* @argument {Function | undefined} fn the function to check37* @returns {Boolean}38*/39var isNative = (function (fn) {40return nativeHints.some(function (hint) {41return (fn || '').toString().indexOf(hint) > -1;42});43});4445var isBrowser = typeof window !== 'undefined';46var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];47var timeoutDuration = 0;48for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {49if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {50timeoutDuration = 1;51break;52}53}5455function microtaskDebounce(fn) {56var scheduled = false;57var i = 0;58var elem = document.createElement('span');5960// MutationObserver provides a mechanism for scheduling microtasks, which61// are scheduled *before* the next task. This gives us a way to debounce62// a function but ensure it's called *before* the next paint.63var observer = new MutationObserver(function () {64fn();65scheduled = false;66});6768observer.observe(elem, { attributes: true });6970return function () {71if (!scheduled) {72scheduled = true;73elem.setAttribute('x-index', i);74i = i + 1; // don't use compund (+=) because it doesn't get optimized in V875}76};77}7879function taskDebounce(fn) {80var scheduled = false;81return function () {82if (!scheduled) {83scheduled = true;84setTimeout(function () {85scheduled = false;86fn();87}, timeoutDuration);88}89};90}9192// It's common for MutationObserver polyfills to be seen in the wild, however93// these rely on Mutation Events which only occur when an element is connected94// to the DOM. The algorithm used in this module does not use a connected element,95// and so we must ensure that a *native* MutationObserver is available.96var supportsNativeMutationObserver = isBrowser && isNative(window.MutationObserver);9798/**99* Create a debounced version of a method, that's asynchronously deferred100* but called in the minimum time possible.101*102* @method103* @memberof Popper.Utils104* @argument {Function} fn105* @returns {Function}106*/107var debounce = supportsNativeMutationObserver ? microtaskDebounce : taskDebounce;108109/**110* Check if the given variable is a function111* @method112* @memberof Popper.Utils113* @argument {Any} functionToCheck - variable to check114* @returns {Boolean} answer to: is a function?115*/116function isFunction(functionToCheck) {117var getType = {};118return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';119}120121/**122* Get CSS computed property of the given element123* @method124* @memberof Popper.Utils125* @argument {Eement} element126* @argument {String} property127*/128function getStyleComputedProperty(element, property) {129if (element.nodeType !== 1) {130return [];131}132// NOTE: 1 DOM access here133var css = window.getComputedStyle(element, null);134return property ? css[property] : css;135}136137/**138* Returns the parentNode or the host of the element139* @method140* @memberof Popper.Utils141* @argument {Element} element142* @returns {Element} parent143*/144function getParentNode(element) {145if (element.nodeName === 'HTML') {146return element;147}148return element.parentNode || element.host;149}150151/**152* Returns the scrolling parent of the given element153* @method154* @memberof Popper.Utils155* @argument {Element} element156* @returns {Element} scroll parent157*/158function getScrollParent(element) {159// Return body, `getScroll` will take care to get the correct `scrollTop` from it160if (!element || ['HTML', 'BODY', '#document'].indexOf(element.nodeName) !== -1) {161return window.document.body;162}163164// Firefox want us to check `-x` and `-y` variations as well165166var _getStyleComputedProp = getStyleComputedProperty(element),167overflow = _getStyleComputedProp.overflow,168overflowX = _getStyleComputedProp.overflowX,169overflowY = _getStyleComputedProp.overflowY;170171if (/(auto|scroll)/.test(overflow + overflowY + overflowX)) {172return element;173}174175return getScrollParent(getParentNode(element));176}177178/**179* Returns the offset parent of the given element180* @method181* @memberof Popper.Utils182* @argument {Element} element183* @returns {Element} offset parent184*/185function getOffsetParent(element) {186// NOTE: 1 DOM access here187var offsetParent = element && element.offsetParent;188var nodeName = offsetParent && offsetParent.nodeName;189190if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {191return window.document.documentElement;192}193194// .offsetParent will return the closest TD or TABLE in case195// no offsetParent is present, I hate this job...196if (['TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {197return getOffsetParent(offsetParent);198}199200return offsetParent;201}202203function isOffsetContainer(element) {204var nodeName = element.nodeName;205206if (nodeName === 'BODY') {207return false;208}209return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;210}211212/**213* Finds the root node (document, shadowDOM root) of the given element214* @method215* @memberof Popper.Utils216* @argument {Element} node217* @returns {Element} root node218*/219function getRoot(node) {220if (node.parentNode !== null) {221return getRoot(node.parentNode);222}223224return node;225}226227/**228* Finds the offset parent common to the two provided nodes229* @method230* @memberof Popper.Utils231* @argument {Element} element1232* @argument {Element} element2233* @returns {Element} common offset parent234*/235function findCommonOffsetParent(element1, element2) {236// This check is needed to avoid errors in case one of the elements isn't defined for any reason237if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {238return window.document.documentElement;239}240241// Here we make sure to give as "start" the element that comes first in the DOM242var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;243var start = order ? element1 : element2;244var end = order ? element2 : element1;245246// Get common ancestor container247var range = document.createRange();248range.setStart(start, 0);249range.setEnd(end, 0);250var commonAncestorContainer = range.commonAncestorContainer;251252// Both nodes are inside #document253254if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {255if (isOffsetContainer(commonAncestorContainer)) {256return commonAncestorContainer;257}258259return getOffsetParent(commonAncestorContainer);260}261262// one of the nodes is inside shadowDOM, find which one263var element1root = getRoot(element1);264if (element1root.host) {265return findCommonOffsetParent(element1root.host, element2);266} else {267return findCommonOffsetParent(element1, getRoot(element2).host);268}269}270271/**272* Gets the scroll value of the given element in the given side (top and left)273* @method274* @memberof Popper.Utils275* @argument {Element} element276* @argument {String} side `top` or `left`277* @returns {number} amount of scrolled pixels278*/279function getScroll(element) {280var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';281282var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';283var nodeName = element.nodeName;284285if (nodeName === 'BODY' || nodeName === 'HTML') {286var html = window.document.documentElement;287var scrollingElement = window.document.scrollingElement || html;288return scrollingElement[upperSide];289}290291return element[upperSide];292}293294/*295* Sum or subtract the element scroll values (left and top) from a given rect object296* @method297* @memberof Popper.Utils298* @param {Object} rect - Rect object you want to change299* @param {HTMLElement} element - The element from the function reads the scroll values300* @param {Boolean} subtract - set to true if you want to subtract the scroll values301* @return {Object} rect - The modifier rect object302*/303function includeScroll(rect, element) {304var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;305306var scrollTop = getScroll(element, 'top');307var scrollLeft = getScroll(element, 'left');308var modifier = subtract ? -1 : 1;309rect.top += scrollTop * modifier;310rect.bottom += scrollTop * modifier;311rect.left += scrollLeft * modifier;312rect.right += scrollLeft * modifier;313return rect;314}315316/*317* Helper to detect borders of a given element318* @method319* @memberof Popper.Utils320* @param {CSSStyleDeclaration} styles321* Result of `getStyleComputedProperty` on the given element322* @param {String} axis - `x` or `y`323* @return {number} borders - The borders size of the given axis324*/325326function getBordersSize(styles, axis) {327var sideA = axis === 'x' ? 'Left' : 'Top';328var sideB = sideA === 'Left' ? 'Right' : 'Bottom';329330return +styles['border' + sideA + 'Width'].split('px')[0] + +styles['border' + sideB + 'Width'].split('px')[0];331}332333/**334* Tells if you are running Internet Explorer 10335* @method336* @memberof Popper.Utils337* @returns {Boolean} isIE10338*/339var isIE10 = undefined;340341var isIE10$1 = function () {342if (isIE10 === undefined) {343isIE10 = navigator.appVersion.indexOf('MSIE 10') !== -1;344}345return isIE10;346};347348function getSize(axis, body, html, computedStyle) {349return Math.max(body['offset' + axis], body['scroll' + axis], html['client' + axis], html['offset' + axis], html['scroll' + axis], isIE10$1() ? html['offset' + axis] + computedStyle['margin' + (axis === 'Height' ? 'Top' : 'Left')] + computedStyle['margin' + (axis === 'Height' ? 'Bottom' : 'Right')] : 0);350}351352function getWindowSizes() {353var body = window.document.body;354var html = window.document.documentElement;355var computedStyle = isIE10$1() && window.getComputedStyle(html);356357return {358height: getSize('Height', body, html, computedStyle),359width: getSize('Width', body, html, computedStyle)360};361}362363var classCallCheck = function (instance, Constructor) {364if (!(instance instanceof Constructor)) {365throw new TypeError("Cannot call a class as a function");366}367};368369var createClass = function () {370function defineProperties(target, props) {371for (var i = 0; i < props.length; i++) {372var descriptor = props[i];373descriptor.enumerable = descriptor.enumerable || false;374descriptor.configurable = true;375if ("value" in descriptor) descriptor.writable = true;376Object.defineProperty(target, descriptor.key, descriptor);377}378}379380return function (Constructor, protoProps, staticProps) {381if (protoProps) defineProperties(Constructor.prototype, protoProps);382if (staticProps) defineProperties(Constructor, staticProps);383return Constructor;384};385}();386387388389390391var defineProperty = function (obj, key, value) {392if (key in obj) {393Object.defineProperty(obj, key, {394value: value,395enumerable: true,396configurable: true,397writable: true398});399} else {400obj[key] = value;401}402403return obj;404};405406var _extends = Object.assign || function (target) {407for (var i = 1; i < arguments.length; i++) {408var source = arguments[i];409410for (var key in source) {411if (Object.prototype.hasOwnProperty.call(source, key)) {412target[key] = source[key];413}414}415}416417return target;418};419420/**421* Given element offsets, generate an output similar to getBoundingClientRect422* @method423* @memberof Popper.Utils424* @argument {Object} offsets425* @returns {Object} ClientRect like output426*/427function getClientRect(offsets) {428return _extends({}, offsets, {429right: offsets.left + offsets.width,430bottom: offsets.top + offsets.height431});432}433434/**435* Get bounding client rect of given element436* @method437* @memberof Popper.Utils438* @param {HTMLElement} element439* @return {Object} client rect440*/441function getBoundingClientRect(element) {442var rect = {};443444// IE10 10 FIX: Please, don't ask, the element isn't445// considered in DOM in some circumstances...446// This isn't reproducible in IE10 compatibility mode of IE11447if (isIE10$1()) {448try {449rect = element.getBoundingClientRect();450var scrollTop = getScroll(element, 'top');451var scrollLeft = getScroll(element, 'left');452rect.top += scrollTop;453rect.left += scrollLeft;454rect.bottom += scrollTop;455rect.right += scrollLeft;456} catch (err) {}457} else {458rect = element.getBoundingClientRect();459}460461var result = {462left: rect.left,463top: rect.top,464width: rect.right - rect.left,465height: rect.bottom - rect.top466};467468// subtract scrollbar size from sizes469var sizes = element.nodeName === 'HTML' ? getWindowSizes() : {};470var width = sizes.width || element.clientWidth || result.right - result.left;471var height = sizes.height || element.clientHeight || result.bottom - result.top;472473var horizScrollbar = element.offsetWidth - width;474var vertScrollbar = element.offsetHeight - height;475476// if an hypothetical scrollbar is detected, we must be sure it's not a `border`477// we make this check conditional for performance reasons478if (horizScrollbar || vertScrollbar) {479var styles = getStyleComputedProperty(element);480horizScrollbar -= getBordersSize(styles, 'x');481vertScrollbar -= getBordersSize(styles, 'y');482483result.width -= horizScrollbar;484result.height -= vertScrollbar;485}486487return getClientRect(result);488}489490function getOffsetRectRelativeToArbitraryNode(children, parent) {491var isIE10 = isIE10$1();492var isHTML = parent.nodeName === 'HTML';493var childrenRect = getBoundingClientRect(children);494var parentRect = getBoundingClientRect(parent);495var scrollParent = getScrollParent(children);496497var styles = getStyleComputedProperty(parent);498var borderTopWidth = +styles.borderTopWidth.split('px')[0];499var borderLeftWidth = +styles.borderLeftWidth.split('px')[0];500501var offsets = getClientRect({502top: childrenRect.top - parentRect.top - borderTopWidth,503left: childrenRect.left - parentRect.left - borderLeftWidth,504width: childrenRect.width,505height: childrenRect.height506});507offsets.marginTop = 0;508offsets.marginLeft = 0;509510// Subtract margins of documentElement in case it's being used as parent511// we do this only on HTML because it's the only element that behaves512// differently when margins are applied to it. The margins are included in513// the box of the documentElement, in the other cases not.514if (!isIE10 && isHTML) {515var marginTop = +styles.marginTop.split('px')[0];516var marginLeft = +styles.marginLeft.split('px')[0];517518offsets.top -= borderTopWidth - marginTop;519offsets.bottom -= borderTopWidth - marginTop;520offsets.left -= borderLeftWidth - marginLeft;521offsets.right -= borderLeftWidth - marginLeft;522523// Attach marginTop and marginLeft because in some circumstances we may need them524offsets.marginTop = marginTop;525offsets.marginLeft = marginLeft;526}527528if (isIE10 ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {529offsets = includeScroll(offsets, parent);530}531532return offsets;533}534535function getViewportOffsetRectRelativeToArtbitraryNode(element) {536var html = window.document.documentElement;537var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);538var width = Math.max(html.clientWidth, window.innerWidth || 0);539var height = Math.max(html.clientHeight, window.innerHeight || 0);540541var scrollTop = getScroll(html);542var scrollLeft = getScroll(html, 'left');543544var offset = {545top: scrollTop - relativeOffset.top + relativeOffset.marginTop,546left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,547width: width,548height: height549};550551return getClientRect(offset);552}553554/**555* Check if the given element is fixed or is inside a fixed parent556* @method557* @memberof Popper.Utils558* @argument {Element} element559* @argument {Element} customContainer560* @returns {Boolean} answer to "isFixed?"561*/562function isFixed(element) {563var nodeName = element.nodeName;564if (nodeName === 'BODY' || nodeName === 'HTML') {565return false;566}567if (getStyleComputedProperty(element, 'position') === 'fixed') {568return true;569}570return isFixed(getParentNode(element));571}572573/**574* Computed the boundaries limits and return them575* @method576* @memberof Popper.Utils577* @param {HTMLElement} popper578* @param {HTMLElement} reference579* @param {number} padding580* @param {HTMLElement} boundariesElement - Element used to define the boundaries581* @returns {Object} Coordinates of the boundaries582*/583function getBoundaries(popper, reference, padding, boundariesElement) {584// NOTE: 1 DOM access here585var boundaries = { top: 0, left: 0 };586var offsetParent = findCommonOffsetParent(popper, reference);587588// Handle viewport case589if (boundariesElement === 'viewport') {590boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent);591} else {592// Handle other cases based on DOM element used as boundaries593var boundariesNode = void 0;594if (boundariesElement === 'scrollParent') {595boundariesNode = getScrollParent(getParentNode(popper));596if (boundariesNode.nodeName === 'BODY') {597boundariesNode = window.document.documentElement;598}599} else if (boundariesElement === 'window') {600boundariesNode = window.document.documentElement;601} else {602boundariesNode = boundariesElement;603}604605var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent);606607// In case of HTML, we need a different computation608if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {609var _getWindowSizes = getWindowSizes(),610height = _getWindowSizes.height,611width = _getWindowSizes.width;612613boundaries.top += offsets.top - offsets.marginTop;614boundaries.bottom = height + offsets.top;615boundaries.left += offsets.left - offsets.marginLeft;616boundaries.right = width + offsets.left;617} else {618// for all the other DOM elements, this one is good619boundaries = offsets;620}621}622623// Add paddings624boundaries.left += padding;625boundaries.top += padding;626boundaries.right -= padding;627boundaries.bottom -= padding;628629return boundaries;630}631632function getArea(_ref) {633var width = _ref.width,634height = _ref.height;635636return width * height;637}638639/**640* Utility used to transform the `auto` placement to the placement with more641* available space.642* @method643* @memberof Popper.Utils644* @argument {Object} data - The data object generated by update method645* @argument {Object} options - Modifiers configuration and options646* @returns {Object} The data object, properly modified647*/648function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {649var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;650651if (placement.indexOf('auto') === -1) {652return placement;653}654655var boundaries = getBoundaries(popper, reference, padding, boundariesElement);656657var rects = {658top: {659width: boundaries.width,660height: refRect.top - boundaries.top661},662right: {663width: boundaries.right - refRect.right,664height: boundaries.height665},666bottom: {667width: boundaries.width,668height: boundaries.bottom - refRect.bottom669},670left: {671width: refRect.left - boundaries.left,672height: boundaries.height673}674};675676var sortedAreas = Object.keys(rects).map(function (key) {677return _extends({678key: key679}, rects[key], {680area: getArea(rects[key])681});682}).sort(function (a, b) {683return b.area - a.area;684});685686var filteredAreas = sortedAreas.filter(function (_ref2) {687var width = _ref2.width,688height = _ref2.height;689return width >= popper.clientWidth && height >= popper.clientHeight;690});691692var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;693694var variation = placement.split('-')[1];695696return computedPlacement + (variation ? '-' + variation : '');697}698699/**700* Get offsets to the reference element701* @method702* @memberof Popper.Utils703* @param {Object} state704* @param {Element} popper - the popper element705* @param {Element} reference - the reference element (the popper will be relative to this)706* @returns {Object} An object containing the offsets which will be applied to the popper707*/708function getReferenceOffsets(state, popper, reference) {709var commonOffsetParent = findCommonOffsetParent(popper, reference);710return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent);711}712713/**714* Get the outer sizes of the given element (offset size + margins)715* @method716* @memberof Popper.Utils717* @argument {Element} element718* @returns {Object} object containing width and height properties719*/720function getOuterSizes(element) {721var styles = window.getComputedStyle(element);722var x = parseFloat(styles.marginTop) + parseFloat(styles.marginBottom);723var y = parseFloat(styles.marginLeft) + parseFloat(styles.marginRight);724var result = {725width: element.offsetWidth + y,726height: element.offsetHeight + x727};728return result;729}730731/**732* Get the opposite placement of the given one733* @method734* @memberof Popper.Utils735* @argument {String} placement736* @returns {String} flipped placement737*/738function getOppositePlacement(placement) {739var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };740return placement.replace(/left|right|bottom|top/g, function (matched) {741return hash[matched];742});743}744745/**746* Get offsets to the popper747* @method748* @memberof Popper.Utils749* @param {Object} position - CSS position the Popper will get applied750* @param {HTMLElement} popper - the popper element751* @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)752* @param {String} placement - one of the valid placement options753* @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper754*/755function getPopperOffsets(popper, referenceOffsets, placement) {756placement = placement.split('-')[0];757758// Get popper node sizes759var popperRect = getOuterSizes(popper);760761// Add position, width and height to our offsets object762var popperOffsets = {763width: popperRect.width,764height: popperRect.height765};766767// depending by the popper placement we have to compute its offsets slightly differently768var isHoriz = ['right', 'left'].indexOf(placement) !== -1;769var mainSide = isHoriz ? 'top' : 'left';770var secondarySide = isHoriz ? 'left' : 'top';771var measurement = isHoriz ? 'height' : 'width';772var secondaryMeasurement = !isHoriz ? 'height' : 'width';773774popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;775if (placement === secondarySide) {776popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];777} else {778popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];779}780781return popperOffsets;782}783784/**785* Mimics the `find` method of Array786* @method787* @memberof Popper.Utils788* @argument {Array} arr789* @argument prop790* @argument value791* @returns index or -1792*/793function find(arr, check) {794// use native find if supported795if (Array.prototype.find) {796return arr.find(check);797}798799// use `filter` to obtain the same behavior of `find`800return arr.filter(check)[0];801}802803/**804* Return the index of the matching object805* @method806* @memberof Popper.Utils807* @argument {Array} arr808* @argument prop809* @argument value810* @returns index or -1811*/812function findIndex(arr, prop, value) {813// use native findIndex if supported814if (Array.prototype.findIndex) {815return arr.findIndex(function (cur) {816return cur[prop] === value;817});818}819820// use `find` + `indexOf` if `findIndex` isn't supported821var match = find(arr, function (obj) {822return obj[prop] === value;823});824return arr.indexOf(match);825}826827/**828* Loop trough the list of modifiers and run them in order,829* each of them will then edit the data object.830* @method831* @memberof Popper.Utils832* @param {dataObject} data833* @param {Array} modifiers834* @param {String} ends - Optional modifier name used as stopper835* @returns {dataObject}836*/837function runModifiers(modifiers, data, ends) {838var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));839840modifiersToRun.forEach(function (modifier) {841if (modifier.function) {842console.warn('`modifier.function` is deprecated, use `modifier.fn`!');843}844var fn = modifier.function || modifier.fn;845if (modifier.enabled && isFunction(fn)) {846// Add properties to offsets to make them a complete clientRect object847// we do this before each modifier to make sure the previous one doesn't848// mess with these values849data.offsets.popper = getClientRect(data.offsets.popper);850data.offsets.reference = getClientRect(data.offsets.reference);851852data = fn(data, modifier);853}854});855856return data;857}858859/**860* Updates the position of the popper, computing the new offsets and applying861* the new style.<br />862* Prefer `scheduleUpdate` over `update` because of performance reasons.863* @method864* @memberof Popper865*/866function update() {867// if popper is destroyed, don't perform any further update868if (this.state.isDestroyed) {869return;870}871872var data = {873instance: this,874styles: {},875arrowStyles: {},876attributes: {},877flipped: false,878offsets: {}879};880881// compute reference element offsets882data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference);883884// compute auto placement, store placement inside the data object,885// modifiers will be able to edit `placement` if needed886// and refer to originalPlacement to know the original value887data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);888889// store the computed placement inside `originalPlacement`890data.originalPlacement = data.placement;891892// compute the popper offsets893data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);894data.offsets.popper.position = 'absolute';895896// run the modifiers897data = runModifiers(this.modifiers, data);898899// the first `update` will call `onCreate` callback900// the other ones will call `onUpdate` callback901if (!this.state.isCreated) {902this.state.isCreated = true;903this.options.onCreate(data);904} else {905this.options.onUpdate(data);906}907}908909/**910* Helper used to know if the given modifier is enabled.911* @method912* @memberof Popper.Utils913* @returns {Boolean}914*/915function isModifierEnabled(modifiers, modifierName) {916return modifiers.some(function (_ref) {917var name = _ref.name,918enabled = _ref.enabled;919return enabled && name === modifierName;920});921}922923/**924* Get the prefixed supported property name925* @method926* @memberof Popper.Utils927* @argument {String} property (camelCase)928* @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)929*/930function getSupportedPropertyName(property) {931var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];932var upperProp = property.charAt(0).toUpperCase() + property.slice(1);933934for (var i = 0; i < prefixes.length - 1; i++) {935var prefix = prefixes[i];936var toCheck = prefix ? '' + prefix + upperProp : property;937if (typeof window.document.body.style[toCheck] !== 'undefined') {938return toCheck;939}940}941return null;942}943944/**945* Destroy the popper946* @method947* @memberof Popper948*/949function destroy() {950this.state.isDestroyed = true;951952// touch DOM only if `applyStyle` modifier is enabled953if (isModifierEnabled(this.modifiers, 'applyStyle')) {954this.popper.removeAttribute('x-placement');955this.popper.style.left = '';956this.popper.style.position = '';957this.popper.style.top = '';958this.popper.style[getSupportedPropertyName('transform')] = '';959}960961this.disableEventListeners();962963// remove the popper if user explicity asked for the deletion on destroy964// do not use `remove` because IE11 doesn't support it965if (this.options.removeOnDestroy) {966this.popper.parentNode.removeChild(this.popper);967}968return this;969}970971function attachToScrollParents(scrollParent, event, callback, scrollParents) {972var isBody = scrollParent.nodeName === 'BODY';973var target = isBody ? window : scrollParent;974target.addEventListener(event, callback, { passive: true });975976if (!isBody) {977attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);978}979scrollParents.push(target);980}981982/**983* Setup needed event listeners used to update the popper position984* @method985* @memberof Popper.Utils986* @private987*/988function setupEventListeners(reference, options, state, updateBound) {989// Resize event listener on window990state.updateBound = updateBound;991window.addEventListener('resize', state.updateBound, { passive: true });992993// Scroll event listener on scroll parents994var scrollElement = getScrollParent(reference);995attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);996state.scrollElement = scrollElement;997state.eventsEnabled = true;998999return state;1000}10011002/**1003* It will add resize/scroll events and start recalculating1004* position of the popper element when they are triggered.1005* @method1006* @memberof Popper1007*/1008function enableEventListeners() {1009if (!this.state.eventsEnabled) {1010this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);1011}1012}10131014/**1015* Remove event listeners used to update the popper position1016* @method1017* @memberof Popper.Utils1018* @private1019*/1020function removeEventListeners(reference, state) {1021// Remove resize event listener on window1022window.removeEventListener('resize', state.updateBound);10231024// Remove scroll event listener on scroll parents1025state.scrollParents.forEach(function (target) {1026target.removeEventListener('scroll', state.updateBound);1027});10281029// Reset state1030state.updateBound = null;1031state.scrollParents = [];1032state.scrollElement = null;1033state.eventsEnabled = false;1034return state;1035}10361037/**1038* It will remove resize/scroll events and won't recalculate popper position1039* when they are triggered. It also won't trigger onUpdate callback anymore,1040* unless you call `update` method manually.1041* @method1042* @memberof Popper1043*/1044function disableEventListeners() {1045if (this.state.eventsEnabled) {1046window.cancelAnimationFrame(this.scheduleUpdate);1047this.state = removeEventListeners(this.reference, this.state);1048}1049}10501051/**1052* Tells if a given input is a number1053* @method1054* @memberof Popper.Utils1055* @param {*} input to check1056* @return {Boolean}1057*/1058function isNumeric(n) {1059return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);1060}10611062/**1063* Set the style to the given popper1064* @method1065* @memberof Popper.Utils1066* @argument {Element} element - Element to apply the style to1067* @argument {Object} styles1068* Object with a list of properties and values which will be applied to the element1069*/1070function setStyles(element, styles) {1071Object.keys(styles).forEach(function (prop) {1072var unit = '';1073// add unit if the value is numeric and is one of the following1074if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {1075unit = 'px';1076}1077element.style[prop] = styles[prop] + unit;1078});1079}10801081/**1082* Set the attributes to the given popper1083* @method1084* @memberof Popper.Utils1085* @argument {Element} element - Element to apply the attributes to1086* @argument {Object} styles1087* Object with a list of properties and values which will be applied to the element1088*/1089function setAttributes(element, attributes) {1090Object.keys(attributes).forEach(function (prop) {1091var value = attributes[prop];1092if (value !== false) {1093element.setAttribute(prop, attributes[prop]);1094} else {1095element.removeAttribute(prop);1096}1097});1098}10991100/**1101* @function1102* @memberof Modifiers1103* @argument {Object} data - The data object generated by `update` method1104* @argument {Object} data.styles - List of style properties - values to apply to popper element1105* @argument {Object} data.attributes - List of attribute properties - values to apply to popper element1106* @argument {Object} options - Modifiers configuration and options1107* @returns {Object} The same data object1108*/1109function applyStyle(data) {1110// any property present in `data.styles` will be applied to the popper,1111// in this way we can make the 3rd party modifiers add custom styles to it1112// Be aware, modifiers could override the properties defined in the previous1113// lines of this modifier!1114setStyles(data.instance.popper, data.styles);11151116// any property present in `data.attributes` will be applied to the popper,1117// they will be set as HTML attributes of the element1118setAttributes(data.instance.popper, data.attributes);11191120// if arrowElement is defined and arrowStyles has some properties1121if (data.arrowElement && Object.keys(data.arrowStyles).length) {1122setStyles(data.arrowElement, data.arrowStyles);1123}11241125return data;1126}11271128/**1129* Set the x-placement attribute before everything else because it could be used1130* to add margins to the popper margins needs to be calculated to get the1131* correct popper offsets.1132* @method1133* @memberof Popper.modifiers1134* @param {HTMLElement} reference - The reference element used to position the popper1135* @param {HTMLElement} popper - The HTML element used as popper.1136* @param {Object} options - Popper.js options1137*/1138function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {1139// compute reference element offsets1140var referenceOffsets = getReferenceOffsets(state, popper, reference);11411142// compute auto placement, store placement inside the data object,1143// modifiers will be able to edit `placement` if needed1144// and refer to originalPlacement to know the original value1145var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);11461147popper.setAttribute('x-placement', placement);11481149// Apply `position` to popper before anything else because1150// without the position applied we can't guarantee correct computations1151setStyles(popper, { position: 'absolute' });11521153return options;1154}11551156/**1157* @function1158* @memberof Modifiers1159* @argument {Object} data - The data object generated by `update` method1160* @argument {Object} options - Modifiers configuration and options1161* @returns {Object} The data object, properly modified1162*/1163function computeStyle(data, options) {1164var x = options.x,1165y = options.y;1166var popper = data.offsets.popper;11671168// Remove this legacy support in Popper.js v211691170var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {1171return modifier.name === 'applyStyle';1172}).gpuAcceleration;1173if (legacyGpuAccelerationOption !== undefined) {1174console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');1175}1176var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;11771178var offsetParent = getOffsetParent(data.instance.popper);1179var offsetParentRect = getBoundingClientRect(offsetParent);11801181// Styles1182var styles = {1183position: popper.position1184};11851186// floor sides to avoid blurry text1187var offsets = {1188left: Math.floor(popper.left),1189top: Math.floor(popper.top),1190bottom: Math.floor(popper.bottom),1191right: Math.floor(popper.right)1192};11931194var sideA = x === 'bottom' ? 'top' : 'bottom';1195var sideB = y === 'right' ? 'left' : 'right';11961197// if gpuAcceleration is set to `true` and transform is supported,1198// we use `translate3d` to apply the position to the popper we1199// automatically use the supported prefixed version if needed1200var prefixedProperty = getSupportedPropertyName('transform');12011202// now, let's make a step back and look at this code closely (wtf?)1203// If the content of the popper grows once it's been positioned, it1204// may happen that the popper gets misplaced because of the new content1205// overflowing its reference element1206// To avoid this problem, we provide two options (x and y), which allow1207// the consumer to define the offset origin.1208// If we position a popper on top of a reference element, we can set1209// `x` to `top` to make the popper grow towards its top instead of1210// its bottom.1211var left = void 0,1212top = void 0;1213if (sideA === 'bottom') {1214top = -offsetParentRect.height + offsets.bottom;1215} else {1216top = offsets.top;1217}1218if (sideB === 'right') {1219left = -offsetParentRect.width + offsets.right;1220} else {1221left = offsets.left;1222}1223if (gpuAcceleration && prefixedProperty) {1224styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';1225styles[sideA] = 0;1226styles[sideB] = 0;1227styles.willChange = 'transform';1228} else {1229// othwerise, we use the standard `top`, `left`, `bottom` and `right` properties1230var invertTop = sideA === 'bottom' ? -1 : 1;1231var invertLeft = sideB === 'right' ? -1 : 1;1232styles[sideA] = top * invertTop;1233styles[sideB] = left * invertLeft;1234styles.willChange = sideA + ', ' + sideB;1235}12361237// Attributes1238var attributes = {1239'x-placement': data.placement1240};12411242// Update `data` attributes, styles and arrowStyles1243data.attributes = _extends({}, attributes, data.attributes);1244data.styles = _extends({}, styles, data.styles);1245data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);12461247return data;1248}12491250/**1251* Helper used to know if the given modifier depends from another one.<br />1252* It checks if the needed modifier is listed and enabled.1253* @method1254* @memberof Popper.Utils1255* @param {Array} modifiers - list of modifiers1256* @param {String} requestingName - name of requesting modifier1257* @param {String} requestedName - name of requested modifier1258* @returns {Boolean}1259*/1260function isModifierRequired(modifiers, requestingName, requestedName) {1261var requesting = find(modifiers, function (_ref) {1262var name = _ref.name;1263return name === requestingName;1264});12651266var isRequired = !!requesting && modifiers.some(function (modifier) {1267return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;1268});12691270if (!isRequired) {1271var _requesting = '`' + requestingName + '`';1272var requested = '`' + requestedName + '`';1273console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');1274}1275return isRequired;1276}12771278/**1279* @function1280* @memberof Modifiers1281* @argument {Object} data - The data object generated by update method1282* @argument {Object} options - Modifiers configuration and options1283* @returns {Object} The data object, properly modified1284*/1285function arrow(data, options) {1286// arrow depends on keepTogether in order to work1287if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {1288return data;1289}12901291var arrowElement = options.element;12921293// if arrowElement is a string, suppose it's a CSS selector1294if (typeof arrowElement === 'string') {1295arrowElement = data.instance.popper.querySelector(arrowElement);12961297// if arrowElement is not found, don't run the modifier1298if (!arrowElement) {1299return data;1300}1301} else {1302// if the arrowElement isn't a query selector we must check that the1303// provided DOM node is child of its popper node1304if (!data.instance.popper.contains(arrowElement)) {1305console.warn('WARNING: `arrow.element` must be child of its popper element!');1306return data;1307}1308}13091310var placement = data.placement.split('-')[0];1311var _data$offsets = data.offsets,1312popper = _data$offsets.popper,1313reference = _data$offsets.reference;13141315var isVertical = ['left', 'right'].indexOf(placement) !== -1;13161317var len = isVertical ? 'height' : 'width';1318var sideCapitalized = isVertical ? 'Top' : 'Left';1319var side = sideCapitalized.toLowerCase();1320var altSide = isVertical ? 'left' : 'top';1321var opSide = isVertical ? 'bottom' : 'right';1322var arrowElementSize = getOuterSizes(arrowElement)[len];13231324//1325// extends keepTogether behavior making sure the popper and its1326// reference have enough pixels in conjuction1327//13281329// top/left side1330if (reference[opSide] - arrowElementSize < popper[side]) {1331data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);1332}1333// bottom/right side1334if (reference[side] + arrowElementSize > popper[opSide]) {1335data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];1336}13371338// compute center of the popper1339var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;13401341// Compute the sideValue using the updated popper offsets1342// take popper margin in account because we don't have this info available1343var popperMarginSide = getStyleComputedProperty(data.instance.popper, 'margin' + sideCapitalized).replace('px', '');1344var sideValue = center - getClientRect(data.offsets.popper)[side] - popperMarginSide;13451346// prevent arrowElement from being placed not contiguously to its popper1347sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);13481349data.arrowElement = arrowElement;1350data.offsets.arrow = {};1351data.offsets.arrow[side] = Math.round(sideValue);1352data.offsets.arrow[altSide] = ''; // make sure to unset any eventual altSide value from the DOM node13531354return data;1355}13561357/**1358* Get the opposite placement variation of the given one1359* @method1360* @memberof Popper.Utils1361* @argument {String} placement variation1362* @returns {String} flipped placement variation1363*/1364function getOppositeVariation(variation) {1365if (variation === 'end') {1366return 'start';1367} else if (variation === 'start') {1368return 'end';1369}1370return variation;1371}13721373/**1374* List of accepted placements to use as values of the `placement` option.<br />1375* Valid placements are:1376* - `auto`1377* - `top`1378* - `right`1379* - `bottom`1380* - `left`1381*1382* Each placement can have a variation from this list:1383* - `-start`1384* - `-end`1385*1386* Variations are interpreted easily if you think of them as the left to right1387* written languages. Horizontally (`top` and `bottom`), `start` is left and `end`1388* is right.<br />1389* Vertically (`left` and `right`), `start` is top and `end` is bottom.1390*1391* Some valid examples are:1392* - `top-end` (on top of reference, right aligned)1393* - `right-start` (on right of reference, top aligned)1394* - `bottom` (on bottom, centered)1395* - `auto-right` (on the side with more space available, alignment depends by placement)1396*1397* @static1398* @type {Array}1399* @enum {String}1400* @readonly1401* @method placements1402* @memberof Popper1403*/1404var 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'];14051406// Get rid of `auto` `auto-start` and `auto-end`1407var validPlacements = placements.slice(3);14081409/**1410* Given an initial placement, returns all the subsequent placements1411* clockwise (or counter-clockwise).1412*1413* @method1414* @memberof Popper.Utils1415* @argument {String} placement - A valid placement (it accepts variations)1416* @argument {Boolean} counter - Set to true to walk the placements counterclockwise1417* @returns {Array} placements including their variations1418*/1419function clockwise(placement) {1420var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;14211422var index = validPlacements.indexOf(placement);1423var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));1424return counter ? arr.reverse() : arr;1425}14261427var BEHAVIORS = {1428FLIP: 'flip',1429CLOCKWISE: 'clockwise',1430COUNTERCLOCKWISE: 'counterclockwise'1431};14321433/**1434* @function1435* @memberof Modifiers1436* @argument {Object} data - The data object generated by update method1437* @argument {Object} options - Modifiers configuration and options1438* @returns {Object} The data object, properly modified1439*/1440function flip(data, options) {1441// if `inner` modifier is enabled, we can't use the `flip` modifier1442if (isModifierEnabled(data.instance.modifiers, 'inner')) {1443return data;1444}14451446if (data.flipped && data.placement === data.originalPlacement) {1447// seems like flip is trying to loop, probably there's not enough space on any of the flippable sides1448return data;1449}14501451var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement);14521453var placement = data.placement.split('-')[0];1454var placementOpposite = getOppositePlacement(placement);1455var variation = data.placement.split('-')[1] || '';14561457var flipOrder = [];14581459switch (options.behavior) {1460case BEHAVIORS.FLIP:1461flipOrder = [placement, placementOpposite];1462break;1463case BEHAVIORS.CLOCKWISE:1464flipOrder = clockwise(placement);1465break;1466case BEHAVIORS.COUNTERCLOCKWISE:1467flipOrder = clockwise(placement, true);1468break;1469default:1470flipOrder = options.behavior;1471}14721473flipOrder.forEach(function (step, index) {1474if (placement !== step || flipOrder.length === index + 1) {1475return data;1476}14771478placement = data.placement.split('-')[0];1479placementOpposite = getOppositePlacement(placement);14801481var popperOffsets = data.offsets.popper;1482var refOffsets = data.offsets.reference;14831484// using floor because the reference offsets may contain decimals we are not going to consider here1485var floor = Math.floor;1486var 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);14871488var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);1489var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);1490var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);1491var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);14921493var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;14941495// flip the variation if required1496var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;1497var flippedVariation = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);14981499if (overlapsRef || overflowsBoundaries || flippedVariation) {1500// this boolean to detect any flip loop1501data.flipped = true;15021503if (overlapsRef || overflowsBoundaries) {1504placement = flipOrder[index + 1];1505}15061507if (flippedVariation) {1508variation = getOppositeVariation(variation);1509}15101511data.placement = placement + (variation ? '-' + variation : '');15121513// this object contains `position`, we want to preserve it along with1514// any additional property we may add in the future1515data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));15161517data = runModifiers(data.instance.modifiers, data, 'flip');1518}1519});1520return data;1521}15221523/**1524* @function1525* @memberof Modifiers1526* @argument {Object} data - The data object generated by update method1527* @argument {Object} options - Modifiers configuration and options1528* @returns {Object} The data object, properly modified1529*/1530function keepTogether(data) {1531var _data$offsets = data.offsets,1532popper = _data$offsets.popper,1533reference = _data$offsets.reference;15341535var placement = data.placement.split('-')[0];1536var floor = Math.floor;1537var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;1538var side = isVertical ? 'right' : 'bottom';1539var opSide = isVertical ? 'left' : 'top';1540var measurement = isVertical ? 'width' : 'height';15411542if (popper[side] < floor(reference[opSide])) {1543data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];1544}1545if (popper[opSide] > floor(reference[side])) {1546data.offsets.popper[opSide] = floor(reference[side]);1547}15481549return data;1550}15511552/**1553* Converts a string containing value + unit into a px value number1554* @function1555* @memberof {modifiers~offset}1556* @private1557* @argument {String} str - Value + unit string1558* @argument {String} measurement - `height` or `width`1559* @argument {Object} popperOffsets1560* @argument {Object} referenceOffsets1561* @returns {Number|String}1562* Value in pixels, or original string if no values were extracted1563*/1564function toValue(str, measurement, popperOffsets, referenceOffsets) {1565// separate value from unit1566var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);1567var value = +split[1];1568var unit = split[2];15691570// If it's not a number it's an operator, I guess1571if (!value) {1572return str;1573}15741575if (unit.indexOf('%') === 0) {1576var element = void 0;1577switch (unit) {1578case '%p':1579element = popperOffsets;1580break;1581case '%':1582case '%r':1583default:1584element = referenceOffsets;1585}15861587var rect = getClientRect(element);1588return rect[measurement] / 100 * value;1589} else if (unit === 'vh' || unit === 'vw') {1590// if is a vh or vw, we calculate the size based on the viewport1591var size = void 0;1592if (unit === 'vh') {1593size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);1594} else {1595size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);1596}1597return size / 100 * value;1598} else {1599// if is an explicit pixel unit, we get rid of the unit and keep the value1600// if is an implicit unit, it's px, and we return just the value1601return value;1602}1603}16041605/**1606* Parse an `offset` string to extrapolate `x` and `y` numeric offsets.1607* @function1608* @memberof {modifiers~offset}1609* @private1610* @argument {String} offset1611* @argument {Object} popperOffsets1612* @argument {Object} referenceOffsets1613* @argument {String} basePlacement1614* @returns {Array} a two cells array with x and y offsets in numbers1615*/1616function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {1617var offsets = [0, 0];16181619// Use height if placement is left or right and index is 0 otherwise use width1620// in this way the first offset will use an axis and the second one1621// will use the other one1622var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;16231624// Split the offset string to obtain a list of values and operands1625// The regex addresses values with the plus or minus sign in front (+10, -20, etc)1626var fragments = offset.split(/(\+|\-)/).map(function (frag) {1627return frag.trim();1628});16291630// Detect if the offset string contains a pair of values or a single one1631// they could be separated by comma or space1632var divider = fragments.indexOf(find(fragments, function (frag) {1633return frag.search(/,|\s/) !== -1;1634}));16351636if (fragments[divider] && fragments[divider].indexOf(',') === -1) {1637console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');1638}16391640// If divider is found, we divide the list of values and operands to divide1641// them by ofset X and Y.1642var splitRegex = /\s*,\s*|\s+/;1643var ops = divider !== -1 ? [fragments.slice(0, divider).concat([fragments[divider].split(splitRegex)[0]]), [fragments[divider].split(splitRegex)[1]].concat(fragments.slice(divider + 1))] : [fragments];16441645// Convert the values with units to absolute pixels to allow our computations1646ops = ops.map(function (op, index) {1647// Most of the units rely on the orientation of the popper1648var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';1649var mergeWithPrevious = false;1650return op1651// This aggregates any `+` or `-` sign that aren't considered operators1652// e.g.: 10 + +5 => [10, +, +5]1653.reduce(function (a, b) {1654if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {1655a[a.length - 1] = b;1656mergeWithPrevious = true;1657return a;1658} else if (mergeWithPrevious) {1659a[a.length - 1] += b;1660mergeWithPrevious = false;1661return a;1662} else {1663return a.concat(b);1664}1665}, [])1666// Here we convert the string values into number values (in px)1667.map(function (str) {1668return toValue(str, measurement, popperOffsets, referenceOffsets);1669});1670});16711672// Loop trough the offsets arrays and execute the operations1673ops.forEach(function (op, index) {1674op.forEach(function (frag, index2) {1675if (isNumeric(frag)) {1676offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);1677}1678});1679});1680return offsets;1681}16821683/**1684* @function1685* @memberof Modifiers1686* @argument {Object} data - The data object generated by update method1687* @argument {Object} options - Modifiers configuration and options1688* @argument {Number|String} options.offset=01689* The offset value as described in the modifier description1690* @returns {Object} The data object, properly modified1691*/1692function offset(data, _ref) {1693var offset = _ref.offset;1694var placement = data.placement,1695_data$offsets = data.offsets,1696popper = _data$offsets.popper,1697reference = _data$offsets.reference;16981699var basePlacement = placement.split('-')[0];17001701var offsets = void 0;1702if (isNumeric(+offset)) {1703offsets = [+offset, 0];1704} else {1705offsets = parseOffset(offset, popper, reference, basePlacement);1706}17071708if (basePlacement === 'left') {1709popper.top += offsets[0];1710popper.left -= offsets[1];1711} else if (basePlacement === 'right') {1712popper.top += offsets[0];1713popper.left += offsets[1];1714} else if (basePlacement === 'top') {1715popper.left += offsets[0];1716popper.top -= offsets[1];1717} else if (basePlacement === 'bottom') {1718popper.left += offsets[0];1719popper.top += offsets[1];1720}17211722data.popper = popper;1723return data;1724}17251726/**1727* @function1728* @memberof Modifiers1729* @argument {Object} data - The data object generated by `update` method1730* @argument {Object} options - Modifiers configuration and options1731* @returns {Object} The data object, properly modified1732*/1733function preventOverflow(data, options) {1734var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);17351736// If offsetParent is the reference element, we really want to1737// go one step up and use the next offsetParent as reference to1738// avoid to make this modifier completely useless and look like broken1739if (data.instance.reference === boundariesElement) {1740boundariesElement = getOffsetParent(boundariesElement);1741}17421743var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement);1744options.boundaries = boundaries;17451746var order = options.priority;1747var popper = data.offsets.popper;17481749var check = {1750primary: function primary(placement) {1751var value = popper[placement];1752if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {1753value = Math.max(popper[placement], boundaries[placement]);1754}1755return defineProperty({}, placement, value);1756},1757secondary: function secondary(placement) {1758var mainSide = placement === 'right' ? 'left' : 'top';1759var value = popper[mainSide];1760if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {1761value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));1762}1763return defineProperty({}, mainSide, value);1764}1765};17661767order.forEach(function (placement) {1768var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';1769popper = _extends({}, popper, check[side](placement));1770});17711772data.offsets.popper = popper;17731774return data;1775}17761777/**1778* @function1779* @memberof Modifiers1780* @argument {Object} data - The data object generated by `update` method1781* @argument {Object} options - Modifiers configuration and options1782* @returns {Object} The data object, properly modified1783*/1784function shift(data) {1785var placement = data.placement;1786var basePlacement = placement.split('-')[0];1787var shiftvariation = placement.split('-')[1];17881789// if shift shiftvariation is specified, run the modifier1790if (shiftvariation) {1791var _data$offsets = data.offsets,1792reference = _data$offsets.reference,1793popper = _data$offsets.popper;17941795var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;1796var side = isVertical ? 'left' : 'top';1797var measurement = isVertical ? 'width' : 'height';17981799var shiftOffsets = {1800start: defineProperty({}, side, reference[side]),1801end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])1802};18031804data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);1805}18061807return data;1808}18091810/**1811* @function1812* @memberof Modifiers1813* @argument {Object} data - The data object generated by update method1814* @argument {Object} options - Modifiers configuration and options1815* @returns {Object} The data object, properly modified1816*/1817function hide(data) {1818if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {1819return data;1820}18211822var refRect = data.offsets.reference;1823var bound = find(data.instance.modifiers, function (modifier) {1824return modifier.name === 'preventOverflow';1825}).boundaries;18261827if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {1828// Avoid unnecessary DOM access if visibility hasn't changed1829if (data.hide === true) {1830return data;1831}18321833data.hide = true;1834data.attributes['x-out-of-boundaries'] = '';1835} else {1836// Avoid unnecessary DOM access if visibility hasn't changed1837if (data.hide === false) {1838return data;1839}18401841data.hide = false;1842data.attributes['x-out-of-boundaries'] = false;1843}18441845return data;1846}18471848/**1849* @function1850* @memberof Modifiers1851* @argument {Object} data - The data object generated by `update` method1852* @argument {Object} options - Modifiers configuration and options1853* @returns {Object} The data object, properly modified1854*/1855function inner(data) {1856var placement = data.placement;1857var basePlacement = placement.split('-')[0];1858var _data$offsets = data.offsets,1859popper = _data$offsets.popper,1860reference = _data$offsets.reference;18611862var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;18631864var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;18651866popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);18671868data.placement = getOppositePlacement(placement);1869data.offsets.popper = getClientRect(popper);18701871return data;1872}18731874/**1875* Modifier function, each modifier can have a function of this type assigned1876* to its `fn` property.<br />1877* These functions will be called on each update, this means that you must1878* make sure they are performant enough to avoid performance bottlenecks.1879*1880* @function ModifierFn1881* @argument {dataObject} data - The data object generated by `update` method1882* @argument {Object} options - Modifiers configuration and options1883* @returns {dataObject} The data object, properly modified1884*/18851886/**1887* Modifiers are plugins used to alter the behavior of your poppers.<br />1888* Popper.js uses a set of 9 modifiers to provide all the basic functionalities1889* needed by the library.1890*1891* Usually you don't want to override the `order`, `fn` and `onLoad` props.1892* All the other properties are configurations that could be tweaked.1893* @namespace modifiers1894*/1895var modifiers = {1896/**1897* Modifier used to shift the popper on the start or end of its reference1898* element.<br />1899* It will read the variation of the `placement` property.<br />1900* It can be one either `-end` or `-start`.1901* @memberof modifiers1902* @inner1903*/1904shift: {1905/** @prop {number} order=100 - Index used to define the order of execution */1906order: 100,1907/** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */1908enabled: true,1909/** @prop {ModifierFn} */1910fn: shift1911},19121913/**1914* The `offset` modifier can shift your popper on both its axis.1915*1916* It accepts the following units:1917* - `px` or unitless, interpreted as pixels1918* - `%` or `%r`, percentage relative to the length of the reference element1919* - `%p`, percentage relative to the length of the popper element1920* - `vw`, CSS viewport width unit1921* - `vh`, CSS viewport height unit1922*1923* For length is intended the main axis relative to the placement of the popper.<br />1924* This means that if the placement is `top` or `bottom`, the length will be the1925* `width`. In case of `left` or `right`, it will be the height.1926*1927* You can provide a single value (as `Number` or `String`), or a pair of values1928* as `String` divided by a comma or one (or more) white spaces.<br />1929* The latter is a deprecated method because it leads to confusion and will be1930* removed in v2.<br />1931* Additionally, it accepts additions and subtractions between different units.1932* Note that multiplications and divisions aren't supported.1933*1934* Valid examples are:1935* ```1936* 101937* '10%'1938* '10, 10'1939* '10%, 10'1940* '10 + 10%'1941* '10 - 5vh + 3%'1942* '-10px + 5vh, 5px - 6%'1943* ```1944* > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap1945* > with their reference element, unfortunately, you will have to disable the `flip` modifier.1946* > More on this [reading this issue](https://github.com/FezVrasta/popper.js/issues/373)1947*1948* @memberof modifiers1949* @inner1950*/1951offset: {1952/** @prop {number} order=200 - Index used to define the order of execution */1953order: 200,1954/** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */1955enabled: true,1956/** @prop {ModifierFn} */1957fn: offset,1958/** @prop {Number|String} offset=01959* The offset value as described in the modifier description1960*/1961offset: 01962},19631964/**1965* Modifier used to prevent the popper from being positioned outside the boundary.1966*1967* An scenario exists where the reference itself is not within the boundaries.<br />1968* We can say it has "escaped the boundaries" — or just "escaped".<br />1969* In this case we need to decide whether the popper should either:1970*1971* - detach from the reference and remain "trapped" in the boundaries, or1972* - if it should ignore the boundary and "escape with its reference"1973*1974* When `escapeWithReference` is set to`true` and reference is completely1975* outside its boundaries, the popper will overflow (or completely leave)1976* the boundaries in order to remain attached to the edge of the reference.1977*1978* @memberof modifiers1979* @inner1980*/1981preventOverflow: {1982/** @prop {number} order=300 - Index used to define the order of execution */1983order: 300,1984/** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */1985enabled: true,1986/** @prop {ModifierFn} */1987fn: preventOverflow,1988/**1989* @prop {Array} [priority=['left','right','top','bottom']]1990* Popper will try to prevent overflow following these priorities by default,1991* then, it could overflow on the left and on top of the `boundariesElement`1992*/1993priority: ['left', 'right', 'top', 'bottom'],1994/**1995* @prop {number} padding=51996* Amount of pixel used to define a minimum distance between the boundaries1997* and the popper this makes sure the popper has always a little padding1998* between the edges of its container1999*/2000padding: 5,2001/**2002* @prop {String|HTMLElement} boundariesElement='scrollParent'2003* Boundaries used by the modifier, can be `scrollParent`, `window`,2004* `viewport` or any DOM element.2005*/2006boundariesElement: 'scrollParent'2007},20082009/**2010* Modifier used to make sure the reference and its popper stay near eachothers2011* without leaving any gap between the two. Expecially useful when the arrow is2012* enabled and you want to assure it to point to its reference element.2013* It cares only about the first axis, you can still have poppers with margin2014* between the popper and its reference element.2015* @memberof modifiers2016* @inner2017*/2018keepTogether: {2019/** @prop {number} order=400 - Index used to define the order of execution */2020order: 400,2021/** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */2022enabled: true,2023/** @prop {ModifierFn} */2024fn: keepTogether2025},20262027/**2028* This modifier is used to move the `arrowElement` of the popper to make2029* sure it is positioned between the reference element and its popper element.2030* It will read the outer size of the `arrowElement` node to detect how many2031* pixels of conjuction are needed.2032*2033* It has no effect if no `arrowElement` is provided.2034* @memberof modifiers2035* @inner2036*/2037arrow: {2038/** @prop {number} order=500 - Index used to define the order of execution */2039order: 500,2040/** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */2041enabled: true,2042/** @prop {ModifierFn} */2043fn: arrow,2044/** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */2045element: '[x-arrow]'2046},20472048/**2049* Modifier used to flip the popper's placement when it starts to overlap its2050* reference element.2051*2052* Requires the `preventOverflow` modifier before it in order to work.2053*2054* **NOTE:** this modifier will interrupt the current update cycle and will2055* restart it if it detects the need to flip the placement.2056* @memberof modifiers2057* @inner2058*/2059flip: {2060/** @prop {number} order=600 - Index used to define the order of execution */2061order: 600,2062/** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */2063enabled: true,2064/** @prop {ModifierFn} */2065fn: flip,2066/**2067* @prop {String|Array} behavior='flip'2068* The behavior used to change the popper's placement. It can be one of2069* `flip`, `clockwise`, `counterclockwise` or an array with a list of valid2070* placements (with optional variations).2071*/2072behavior: 'flip',2073/**2074* @prop {number} padding=52075* The popper will flip if it hits the edges of the `boundariesElement`2076*/2077padding: 5,2078/**2079* @prop {String|HTMLElement} boundariesElement='viewport'2080* The element which will define the boundaries of the popper position,2081* the popper will never be placed outside of the defined boundaries2082* (except if keepTogether is enabled)2083*/2084boundariesElement: 'viewport'2085},20862087/**2088* Modifier used to make the popper flow toward the inner of the reference element.2089* By default, when this modifier is disabled, the popper will be placed outside2090* the reference element.2091* @memberof modifiers2092* @inner2093*/2094inner: {2095/** @prop {number} order=700 - Index used to define the order of execution */2096order: 700,2097/** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */2098enabled: false,2099/** @prop {ModifierFn} */2100fn: inner2101},21022103/**2104* Modifier used to hide the popper when its reference element is outside of the2105* popper boundaries. It will set a `x-out-of-boundaries` attribute which can2106* be used to hide with a CSS selector the popper when its reference is2107* out of boundaries.2108*2109* Requires the `preventOverflow` modifier before it in order to work.2110* @memberof modifiers2111* @inner2112*/2113hide: {2114/** @prop {number} order=800 - Index used to define the order of execution */2115order: 800,2116/** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */2117enabled: true,2118/** @prop {ModifierFn} */2119fn: hide2120},21212122/**2123* Computes the style that will be applied to the popper element to gets2124* properly positioned.2125*2126* Note that this modifier will not touch the DOM, it just prepares the styles2127* so that `applyStyle` modifier can apply it. This separation is useful2128* in case you need to replace `applyStyle` with a custom implementation.2129*2130* This modifier has `850` as `order` value to maintain backward compatibility2131* with previous versions of Popper.js. Expect the modifiers ordering method2132* to change in future major versions of the library.2133*2134* @memberof modifiers2135* @inner2136*/2137computeStyle: {2138/** @prop {number} order=850 - Index used to define the order of execution */2139order: 850,2140/** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */2141enabled: true,2142/** @prop {ModifierFn} */2143fn: computeStyle,2144/**2145* @prop {Boolean} gpuAcceleration=true2146* If true, it uses the CSS 3d transformation to position the popper.2147* Otherwise, it will use the `top` and `left` properties.2148*/2149gpuAcceleration: true,2150/**2151* @prop {string} [x='bottom']2152* Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.2153* Change this if your popper should grow in a direction different from `bottom`2154*/2155x: 'bottom',2156/**2157* @prop {string} [x='left']2158* Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.2159* Change this if your popper should grow in a direction different from `right`2160*/2161y: 'right'2162},21632164/**2165* Applies the computed styles to the popper element.2166*2167* All the DOM manipulations are limited to this modifier. This is useful in case2168* you want to integrate Popper.js inside a framework or view library and you2169* want to delegate all the DOM manipulations to it.2170*2171* Note that if you disable this modifier, you must make sure the popper element2172* has its position set to `absolute` before Popper.js can do its work!2173*2174* Just disable this modifier and define you own to achieve the desired effect.2175*2176* @memberof modifiers2177* @inner2178*/2179applyStyle: {2180/** @prop {number} order=900 - Index used to define the order of execution */2181order: 900,2182/** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */2183enabled: true,2184/** @prop {ModifierFn} */2185fn: applyStyle,2186/** @prop {Function} */2187onLoad: applyStyleOnLoad,2188/**2189* @deprecated since version 1.10.0, the property moved to `computeStyle` modifier2190* @prop {Boolean} gpuAcceleration=true2191* If true, it uses the CSS 3d transformation to position the popper.2192* Otherwise, it will use the `top` and `left` properties.2193*/2194gpuAcceleration: undefined2195}2196};21972198/**2199* The `dataObject` is an object containing all the informations used by Popper.js2200* this object get passed to modifiers and to the `onCreate` and `onUpdate` callbacks.2201* @name dataObject2202* @property {Object} data.instance The Popper.js instance2203* @property {String} data.placement Placement applied to popper2204* @property {String} data.originalPlacement Placement originally defined on init2205* @property {Boolean} data.flipped True if popper has been flipped by flip modifier2206* @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper.2207* @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier2208* @property {Object} data.styles Any CSS property defined here will be applied to the popper, it expects the JavaScript nomenclature (eg. `marginBottom`)2209* @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow, it expects the JavaScript nomenclature (eg. `marginBottom`)2210* @property {Object} data.boundaries Offsets of the popper boundaries2211* @property {Object} data.offsets The measurements of popper, reference and arrow elements.2212* @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values2213* @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values2214* @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 02215*/22162217/**2218* Default options provided to Popper.js constructor.<br />2219* These can be overriden using the `options` argument of Popper.js.<br />2220* To override an option, simply pass as 3rd argument an object with the same2221* structure of this object, example:2222* ```2223* new Popper(ref, pop, {2224* modifiers: {2225* preventOverflow: { enabled: false }2226* }2227* })2228* ```2229* @type {Object}2230* @static2231* @memberof Popper2232*/2233var Defaults = {2234/**2235* Popper's placement2236* @prop {Popper.placements} placement='bottom'2237*/2238placement: 'bottom',22392240/**2241* Whether events (resize, scroll) are initially enabled2242* @prop {Boolean} eventsEnabled=true2243*/2244eventsEnabled: true,22452246/**2247* Set to true if you want to automatically remove the popper when2248* you call the `destroy` method.2249* @prop {Boolean} removeOnDestroy=false2250*/2251removeOnDestroy: false,22522253/**2254* Callback called when the popper is created.<br />2255* By default, is set to no-op.<br />2256* Access Popper.js instance with `data.instance`.2257* @prop {onCreate}2258*/2259onCreate: function onCreate() {},22602261/**2262* Callback called when the popper is updated, this callback is not called2263* on the initialization/creation of the popper, but only on subsequent2264* updates.<br />2265* By default, is set to no-op.<br />2266* Access Popper.js instance with `data.instance`.2267* @prop {onUpdate}2268*/2269onUpdate: function onUpdate() {},22702271/**2272* List of modifiers used to modify the offsets before they are applied to the popper.2273* They provide most of the functionalities of Popper.js2274* @prop {modifiers}2275*/2276modifiers: modifiers2277};22782279/**2280* @callback onCreate2281* @param {dataObject} data2282*/22832284/**2285* @callback onUpdate2286* @param {dataObject} data2287*/22882289// Utils2290// Methods2291var Popper = function () {2292/**2293* Create a new Popper.js instance2294* @class Popper2295* @param {HTMLElement|referenceObject} reference - The reference element used to position the popper2296* @param {HTMLElement} popper - The HTML element used as popper.2297* @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)2298* @return {Object} instance - The generated Popper.js instance2299*/2300function Popper(reference, popper) {2301var _this = this;23022303var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};2304classCallCheck(this, Popper);23052306this.scheduleUpdate = function () {2307return requestAnimationFrame(_this.update);2308};23092310// make update() debounced, so that it only runs at most once-per-tick2311this.update = debounce(this.update.bind(this));23122313// with {} we create a new object with the options inside it2314this.options = _extends({}, Popper.Defaults, options);23152316// init state2317this.state = {2318isDestroyed: false,2319isCreated: false,2320scrollParents: []2321};23222323// get reference and popper elements (allow jQuery wrappers)2324this.reference = reference.jquery ? reference[0] : reference;2325this.popper = popper.jquery ? popper[0] : popper;23262327// Deep merge modifiers options2328this.options.modifiers = {};2329Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {2330_this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});2331});23322333// Refactoring modifiers' list (Object => Array)2334this.modifiers = Object.keys(this.options.modifiers).map(function (name) {2335return _extends({2336name: name2337}, _this.options.modifiers[name]);2338})2339// sort the modifiers by order2340.sort(function (a, b) {2341return a.order - b.order;2342});23432344// modifiers have the ability to execute arbitrary code when Popper.js get inited2345// such code is executed in the same order of its modifier2346// they could add new properties to their options configuration2347// BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!2348this.modifiers.forEach(function (modifierOptions) {2349if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {2350modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);2351}2352});23532354// fire the first update to position the popper in the right place2355this.update();23562357var eventsEnabled = this.options.eventsEnabled;2358if (eventsEnabled) {2359// setup event listeners, they will take care of update the position in specific situations2360this.enableEventListeners();2361}23622363this.state.eventsEnabled = eventsEnabled;2364}23652366// We can't use class properties because they don't get listed in the2367// class prototype and break stuff like Sinon stubs236823692370createClass(Popper, [{2371key: 'update',2372value: function update$$1() {2373return update.call(this);2374}2375}, {2376key: 'destroy',2377value: function destroy$$1() {2378return destroy.call(this);2379}2380}, {2381key: 'enableEventListeners',2382value: function enableEventListeners$$1() {2383return enableEventListeners.call(this);2384}2385}, {2386key: 'disableEventListeners',2387value: function disableEventListeners$$1() {2388return disableEventListeners.call(this);2389}23902391/**2392* Schedule an update, it will run on the next UI update available2393* @method scheduleUpdate2394* @memberof Popper2395*/239623972398/**2399* Collection of utilities useful when writing custom modifiers.2400* Starting from version 1.7, this method is available only if you2401* include `popper-utils.js` before `popper.js`.2402*2403* **DEPRECATION**: This way to access PopperUtils is deprecated2404* and will be removed in v2! Use the PopperUtils module directly instead.2405* Due to the high instability of the methods contained in Utils, we can't2406* guarantee them to follow semver. Use them at your own risk!2407* @static2408* @private2409* @type {Object}2410* @deprecated since version 1.82411* @member Utils2412* @memberof Popper2413*/24142415}]);2416return Popper;2417}();24182419/**2420* The `referenceObject` is an object that provides an interface compatible with Popper.js2421* and lets you use it as replacement of a real DOM node.<br />2422* You can use this method to position a popper relatively to a set of coordinates2423* in case you don't have a DOM node to use as reference.2424*2425* ```2426* new Popper(referenceObject, popperNode);2427* ```2428*2429* NB: This feature isn't supported in Internet Explorer 102430* @name referenceObject2431* @property {Function} data.getBoundingClientRect2432* A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.2433* @property {number} data.clientWidth2434* An ES6 getter that will return the width of the virtual reference element.2435* @property {number} data.clientHeight2436* An ES6 getter that will return the height of the virtual reference element.2437*/243824392440Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;2441Popper.placements = placements;2442Popper.Defaults = Defaults;24432444return Popper;24452446})));2447//# sourceMappingURL=popper.js.map244824492450