vendor: 2,604 bytes, lines 1-52
1/*! 2 * Understrap v1.0.1 (https://understrap.com) 3 * Copyright 2013-2025 The Understrap Authors (https://github.com/understrap/understrap/graphs/contributors) 4 * Licensed under GPL (http://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html) 5 */ 6(function (global, factory) { 7 typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('jquery')) : 8 typeof define === 'function' && define.amd ? define(['exports', 'jquery'], factory) : 9 (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.understrap = {}, global.jQuery)); 10})(this, (function (exports, $) { 'use strict'; 11 12 function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } 13 14 var $__default = /*#__PURE__*/_interopDefaultLegacy($); 15 16 /**! 17 * @fileOverview Kickass library to create and place poppers near their reference elements. 18 * @version 1.16.1 19 * @license 20 * Copyright (c) 2016 Federico Zivolo and contributors 21 * 22 * Permission is hereby granted, free of charge, to any person obtaining a copy 23 * of this software and associated documentation files (the "Software"), to deal 24 * in the Software without restriction, including without limitation the rights 25 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 26 * copies of the Software, and to permit persons to whom the Software is 27 * furnished to do so, subject to the following conditions: 28 * 29 * The above copyright notice and this permission notice shall be included in all 30 * copies or substantial portions of the Software. 31 * 32 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 33 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 34 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 35 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 36 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 37 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 38 * SOFTWARE. 39 */ 40 var isBrowser$1 = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined'; 41 42 const timeoutDuration$1 = function () { 43 const longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox']; 44 for (let i = 0; i < longerTimeoutBrowsers.length; i += 1) { 45 if (isBrowser$1 && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) { 46 return 1; 47 } 48 } 49 return 0; 50 }(); 51 52 function microtaskDebounce$1(fn) {
vendor: 4,425 bytes, lines 53-216
53 let called = false; 54 return () => { 55 if (called) { 56 return; 57 } 58 called = true; 59 window.Promise.resolve().then(() => { 60 called = false; 61 fn(); 62 }); 63 }; 64 } 65 66 function taskDebounce$1(fn) { 67 let scheduled = false; 68 return () => { 69 if (!scheduled) { 70 scheduled = true; 71 setTimeout(() => { 72 scheduled = false; 73 fn(); 74 }, timeoutDuration$1); 75 } 76 }; 77 } 78 79 const supportsMicroTasks$1 = isBrowser$1 && window.Promise; 80 81 /** 82 * Create a debounced version of a method, that's asynchronously deferred 83 * but called in the minimum time possible. 84 * 85 * @method 86 * @memberof Popper.Utils 87 * @argument {Function} fn 88 * @returns {Function} 89 */ 90 var debounce$1 = supportsMicroTasks$1 ? microtaskDebounce$1 : taskDebounce$1; 91 92 /** 93 * Check if the given variable is a function 94 * @method 95 * @memberof Popper.Utils 96 * @argument {Any} functionToCheck - variable to check 97 * @returns {Boolean} answer to: is a function? 98 */ 99 function isFunction$1(functionToCheck) { 100 const getType = {}; 101 return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]'; 102 } 103 104 /** 105 * Get CSS computed property of the given element 106 * @method 107 * @memberof Popper.Utils 108 * @argument {Eement} element 109 * @argument {String} property 110 */ 111 function getStyleComputedProperty$1(element, property) { 112 if (element.nodeType !== 1) { 113 return []; 114 } 115 // NOTE: 1 DOM access here 116 const window = element.ownerDocument.defaultView; 117 const css = window.getComputedStyle(element, null); 118 return property ? css[property] : css; 119 } 120 121 /** 122 * Returns the parentNode or the host of the element 123 * @method 124 * @memberof Popper.Utils 125 * @argument {Element} element 126 * @returns {Element} parent 127 */ 128 function getParentNode$1(element) { 129 if (element.nodeName === 'HTML') { 130 return element; 131 } 132 return element.parentNode || element.host; 133 } 134 135 /** 136 * Returns the scrolling parent of the given element 137 * @method 138 * @memberof Popper.Utils 139 * @argument {Element} element 140 * @returns {Element} scroll parent 141 */ 142 function getScrollParent$1(element) { 143 // Return body, `getScroll` will take care to get the correct `scrollTop` from it 144 if (!element) { 145 return document.body; 146 } 147 148 switch (element.nodeName) { 149 case 'HTML': 150 case 'BODY': 151 return element.ownerDocument.body; 152 case '#document': 153 return element.body; 154 } 155 156 // Firefox want us to check `-x` and `-y` variations as well 157 const { overflow, overflowX, overflowY } = getStyleComputedProperty$1(element); 158 if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) { 159 return element; 160 } 161 162 return getScrollParent$1(getParentNode$1(element)); 163 } 164 165 /** 166 * Returns the reference node of the reference object, or the reference object itself. 167 * @method 168 * @memberof Popper.Utils 169 * @param {Element|Object} reference - the reference element (the popper will be relative to this) 170 * @returns {Element} parent 171 */ 172 function getReferenceNode$1(reference) { 173 return reference && reference.referenceNode ? reference.referenceNode : reference; 174 } 175 176 const isIE11$1 = isBrowser$1 && !!(window.MSInputMethodContext && document.documentMode); 177 const isIE10$1 = isBrowser$1 && /MSIE 10/.test(navigator.userAgent); 178 179 /** 180 * Determines if the browser is Internet Explorer 181 * @method 182 * @memberof Popper.Utils 183 * @param {Number} version to check 184 * @returns {Boolean} isIE 185 */ 186 function isIE$1(version) { 187 if (version === 11) { 188 return isIE11$1; 189 } 190 if (version === 10) { 191 return isIE10$1; 192 } 193 return isIE11$1 || isIE10$1; 194 } 195 196 /** 197 * Returns the offset parent of the given element 198 * @method 199 * @memberof Popper.Utils 200 * @argument {Element} element 201 * @returns {Element} offset parent 202 */ 203 function getOffsetParent$1(element) { 204 if (!element) { 205 return document.documentElement; 206 } 207 208 const noOffsetParent = isIE$1(10) ? document.body : null; 209 210 // NOTE: 1 DOM access here 211 let offsetParent = element.offsetParent || null; 212 // Skip hidden elements which don't have an offsetParent 213 while (offsetParent === noOffsetParent && element.nextElementSibling) { 214 offsetParent = (element = element.nextElementSibling).offsetParent; 215 } 216
vendor: 21,277 bytes, lines 217-817
217 const nodeName = offsetParent && offsetParent.nodeName; 218 219 if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') { 220 return element ? element.ownerDocument.documentElement : document.documentElement; 221 } 222 223 // .offsetParent will return the closest TH, TD or TABLE in case 224 // no offsetParent is present, I hate this job... 225 if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty$1(offsetParent, 'position') === 'static') { 226 return getOffsetParent$1(offsetParent); 227 } 228 229 return offsetParent; 230 } 231 232 function isOffsetContainer$1(element) { 233 const { nodeName } = element; 234 if (nodeName === 'BODY') { 235 return false; 236 } 237 return nodeName === 'HTML' || getOffsetParent$1(element.firstElementChild) === element; 238 } 239 240 /** 241 * Finds the root node (document, shadowDOM root) of the given element 242 * @method 243 * @memberof Popper.Utils 244 * @argument {Element} node 245 * @returns {Element} root node 246 */ 247 function getRoot$1(node) { 248 if (node.parentNode !== null) { 249 return getRoot$1(node.parentNode); 250 } 251 252 return node; 253 } 254 255 /** 256 * Finds the offset parent common to the two provided nodes 257 * @method 258 * @memberof Popper.Utils 259 * @argument {Element} element1 260 * @argument {Element} element2 261 * @returns {Element} common offset parent 262 */ 263 function findCommonOffsetParent$1(element1, element2) { 264 // This check is needed to avoid errors in case one of the elements isn't defined for any reason 265 if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) { 266 return document.documentElement; 267 } 268 269 // Here we make sure to give as "start" the element that comes first in the DOM 270 const order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING; 271 const start = order ? element1 : element2; 272 const end = order ? element2 : element1; 273 274 // Get common ancestor container 275 const range = document.createRange(); 276 range.setStart(start, 0); 277 range.setEnd(end, 0); 278 const { commonAncestorContainer } = range; 279 280 // Both nodes are inside #document 281 if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) { 282 if (isOffsetContainer$1(commonAncestorContainer)) { 283 return commonAncestorContainer; 284 } 285 286 return getOffsetParent$1(commonAncestorContainer); 287 } 288 289 // one of the nodes is inside shadowDOM, find which one 290 const element1root = getRoot$1(element1); 291 if (element1root.host) { 292 return findCommonOffsetParent$1(element1root.host, element2); 293 } else { 294 return findCommonOffsetParent$1(element1, getRoot$1(element2).host); 295 } 296 } 297 298 /** 299 * Gets the scroll value of the given element in the given side (top and left) 300 * @method 301 * @memberof Popper.Utils 302 * @argument {Element} element 303 * @argument {String} side `top` or `left` 304 * @returns {number} amount of scrolled pixels 305 */ 306 function getScroll$1(element, side = 'top') { 307 const upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft'; 308 const nodeName = element.nodeName; 309 310 if (nodeName === 'BODY' || nodeName === 'HTML') { 311 const html = element.ownerDocument.documentElement; 312 const scrollingElement = element.ownerDocument.scrollingElement || html; 313 return scrollingElement[upperSide]; 314 } 315 316 return element[upperSide]; 317 } 318 319 /* 320 * Sum or subtract the element scroll values (left and top) from a given rect object 321 * @method 322 * @memberof Popper.Utils 323 * @param {Object} rect - Rect object you want to change 324 * @param {HTMLElement} element - The element from the function reads the scroll values 325 * @param {Boolean} subtract - set to true if you want to subtract the scroll values 326 * @return {Object} rect - The modifier rect object 327 */ 328 function includeScroll$1(rect, element, subtract = false) { 329 const scrollTop = getScroll$1(element, 'top'); 330 const scrollLeft = getScroll$1(element, 'left'); 331 const modifier = subtract ? -1 : 1; 332 rect.top += scrollTop * modifier; 333 rect.bottom += scrollTop * modifier; 334 rect.left += scrollLeft * modifier; 335 rect.right += scrollLeft * modifier; 336 return rect; 337 } 338 339 /* 340 * Helper to detect borders of a given element 341 * @method 342 * @memberof Popper.Utils 343 * @param {CSSStyleDeclaration} styles 344 * Result of `getStyleComputedProperty` on the given element 345 * @param {String} axis - `x` or `y` 346 * @return {number} borders - The borders size of the given axis 347 */ 348 349 function getBordersSize$1(styles, axis) { 350 const sideA = axis === 'x' ? 'Left' : 'Top'; 351 const sideB = sideA === 'Left' ? 'Right' : 'Bottom'; 352 353 return parseFloat(styles[`border${sideA}Width`]) + parseFloat(styles[`border${sideB}Width`]); 354 } 355 356 function getSize$1(axis, body, html, computedStyle) { 357 return Math.max(body[`offset${axis}`], body[`scroll${axis}`], html[`client${axis}`], html[`offset${axis}`], html[`scroll${axis}`], isIE$1(10) ? parseInt(html[`offset${axis}`]) + parseInt(computedStyle[`margin${axis === 'Height' ? 'Top' : 'Left'}`]) + parseInt(computedStyle[`margin${axis === 'Height' ? 'Bottom' : 'Right'}`]) : 0); 358 } 359 360 function getWindowSizes$1(document) { 361 const body = document.body; 362 const html = document.documentElement; 363 const computedStyle = isIE$1(10) && getComputedStyle(html); 364 365 return { 366 height: getSize$1('Height', body, html, computedStyle), 367 width: getSize$1('Width', body, html, computedStyle) 368 }; 369 } 370 371 var _extends$1 = Object.assign || function (target) { 372 for (var i = 1; i < arguments.length; i++) { 373 var source = arguments[i]; 374 375 for (var key in source) { 376 if (Object.prototype.hasOwnProperty.call(source, key)) { 377 target[key] = source[key]; 378 } 379 } 380 } 381 382 return target; 383 }; 384 385 /** 386 * Given element offsets, generate an output similar to getBoundingClientRect 387 * @method 388 * @memberof Popper.Utils 389 * @argument {Object} offsets 390 * @returns {Object} ClientRect like output 391 */ 392 function getClientRect$1(offsets) { 393 return _extends$1({}, offsets, { 394 right: offsets.left + offsets.width, 395 bottom: offsets.top + offsets.height 396 }); 397 } 398 399 /** 400 * Get bounding client rect of given element 401 * @method 402 * @memberof Popper.Utils 403 * @param {HTMLElement} element 404 * @return {Object} client rect 405 */ 406 function getBoundingClientRect$1(element) { 407 let rect = {}; 408 409 // IE10 10 FIX: Please, don't ask, the element isn't 410 // considered in DOM in some circumstances... 411 // This isn't reproducible in IE10 compatibility mode of IE11 412 try { 413 if (isIE$1(10)) { 414 rect = element.getBoundingClientRect(); 415 const scrollTop = getScroll$1(element, 'top'); 416 const scrollLeft = getScroll$1(element, 'left'); 417 rect.top += scrollTop; 418 rect.left += scrollLeft; 419 rect.bottom += scrollTop; 420 rect.right += scrollLeft; 421 } else { 422 rect = element.getBoundingClientRect(); 423 } 424 } catch (e) {} 425 426 const result = { 427 left: rect.left, 428 top: rect.top, 429 width: rect.right - rect.left, 430 height: rect.bottom - rect.top 431 }; 432 433 // subtract scrollbar size from sizes 434 const sizes = element.nodeName === 'HTML' ? getWindowSizes$1(element.ownerDocument) : {}; 435 const width = sizes.width || element.clientWidth || result.width; 436 const height = sizes.height || element.clientHeight || result.height; 437 438 let horizScrollbar = element.offsetWidth - width; 439 let vertScrollbar = element.offsetHeight - height; 440 441 // if an hypothetical scrollbar is detected, we must be sure it's not a `border` 442 // we make this check conditional for performance reasons 443 if (horizScrollbar || vertScrollbar) { 444 const styles = getStyleComputedProperty$1(element); 445 horizScrollbar -= getBordersSize$1(styles, 'x'); 446 vertScrollbar -= getBordersSize$1(styles, 'y'); 447 448 result.width -= horizScrollbar; 449 result.height -= vertScrollbar; 450 } 451 452 return getClientRect$1(result); 453 } 454 455 function getOffsetRectRelativeToArbitraryNode$1(children, parent, fixedPosition = false) { 456 const isIE10 = isIE$1(10); 457 const isHTML = parent.nodeName === 'HTML'; 458 const childrenRect = getBoundingClientRect$1(children); 459 const parentRect = getBoundingClientRect$1(parent); 460 const scrollParent = getScrollParent$1(children); 461 462 const styles = getStyleComputedProperty$1(parent); 463 const borderTopWidth = parseFloat(styles.borderTopWidth); 464 const borderLeftWidth = parseFloat(styles.borderLeftWidth); 465 466 // In cases where the parent is fixed, we must ignore negative scroll in offset calc 467 if (fixedPosition && isHTML) { 468 parentRect.top = Math.max(parentRect.top, 0); 469 parentRect.left = Math.max(parentRect.left, 0); 470 } 471 let offsets = getClientRect$1({ 472 top: childrenRect.top - parentRect.top - borderTopWidth, 473 left: childrenRect.left - parentRect.left - borderLeftWidth, 474 width: childrenRect.width, 475 height: childrenRect.height 476 }); 477 offsets.marginTop = 0; 478 offsets.marginLeft = 0; 479 480 // Subtract margins of documentElement in case it's being used as parent 481 // we do this only on HTML because it's the only element that behaves 482 // differently when margins are applied to it. The margins are included in 483 // the box of the documentElement, in the other cases not. 484 if (!isIE10 && isHTML) { 485 const marginTop = parseFloat(styles.marginTop); 486 const marginLeft = parseFloat(styles.marginLeft); 487 488 offsets.top -= borderTopWidth - marginTop; 489 offsets.bottom -= borderTopWidth - marginTop; 490 offsets.left -= borderLeftWidth - marginLeft; 491 offsets.right -= borderLeftWidth - marginLeft; 492 493 // Attach marginTop and marginLeft because in some circumstances we may need them 494 offsets.marginTop = marginTop; 495 offsets.marginLeft = marginLeft; 496 } 497 498 if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') { 499 offsets = includeScroll$1(offsets, parent); 500 } 501 502 return offsets; 503 } 504 505 function getViewportOffsetRectRelativeToArtbitraryNode$1(element, excludeScroll = false) { 506 const html = element.ownerDocument.documentElement; 507 const relativeOffset = getOffsetRectRelativeToArbitraryNode$1(element, html); 508 const width = Math.max(html.clientWidth, window.innerWidth || 0); 509 const height = Math.max(html.clientHeight, window.innerHeight || 0); 510 511 const scrollTop = !excludeScroll ? getScroll$1(html) : 0; 512 const scrollLeft = !excludeScroll ? getScroll$1(html, 'left') : 0; 513 514 const offset = { 515 top: scrollTop - relativeOffset.top + relativeOffset.marginTop, 516 left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft, 517 width, 518 height 519 }; 520 521 return getClientRect$1(offset); 522 } 523 524 /** 525 * Check if the given element is fixed or is inside a fixed parent 526 * @method 527 * @memberof Popper.Utils 528 * @argument {Element} element 529 * @argument {Element} customContainer 530 * @returns {Boolean} answer to "isFixed?" 531 */ 532 function isFixed$1(element) { 533 const nodeName = element.nodeName; 534 if (nodeName === 'BODY' || nodeName === 'HTML') { 535 return false; 536 } 537 if (getStyleComputedProperty$1(element, 'position') === 'fixed') { 538 return true; 539 } 540 const parentNode = getParentNode$1(element); 541 if (!parentNode) { 542 return false; 543 } 544 return isFixed$1(parentNode); 545 } 546 547 /** 548 * Finds the first parent of an element that has a transformed property defined 549 * @method 550 * @memberof Popper.Utils 551 * @argument {Element} element 552 * @returns {Element} first transformed parent or documentElement 553 */ 554 555 function getFixedPositionOffsetParent$1(element) { 556 // This check is needed to avoid errors in case one of the elements isn't defined for any reason 557 if (!element || !element.parentElement || isIE$1()) { 558 return document.documentElement; 559 } 560 let el = element.parentElement; 561 while (el && getStyleComputedProperty$1(el, 'transform') === 'none') { 562 el = el.parentElement; 563 } 564 return el || document.documentElement; 565 } 566 567 /** 568 * Computed the boundaries limits and return them 569 * @method 570 * @memberof Popper.Utils 571 * @param {HTMLElement} popper 572 * @param {HTMLElement} reference 573 * @param {number} padding 574 * @param {HTMLElement} boundariesElement - Element used to define the boundaries 575 * @param {Boolean} fixedPosition - Is in fixed position mode 576 * @returns {Object} Coordinates of the boundaries 577 */ 578 function getBoundaries$1(popper, reference, padding, boundariesElement, fixedPosition = false) { 579 // NOTE: 1 DOM access here 580 581 let boundaries = { top: 0, left: 0 }; 582 const offsetParent = fixedPosition ? getFixedPositionOffsetParent$1(popper) : findCommonOffsetParent$1(popper, getReferenceNode$1(reference)); 583 584 // Handle viewport case 585 if (boundariesElement === 'viewport') { 586 boundaries = getViewportOffsetRectRelativeToArtbitraryNode$1(offsetParent, fixedPosition); 587 } else { 588 // Handle other cases based on DOM element used as boundaries 589 let boundariesNode; 590 if (boundariesElement === 'scrollParent') { 591 boundariesNode = getScrollParent$1(getParentNode$1(reference)); 592 if (boundariesNode.nodeName === 'BODY') { 593 boundariesNode = popper.ownerDocument.documentElement; 594 } 595 } else if (boundariesElement === 'window') { 596 boundariesNode = popper.ownerDocument.documentElement; 597 } else { 598 boundariesNode = boundariesElement; 599 } 600 601 const offsets = getOffsetRectRelativeToArbitraryNode$1(boundariesNode, offsetParent, fixedPosition); 602 603 // In case of HTML, we need a different computation 604 if (boundariesNode.nodeName === 'HTML' && !isFixed$1(offsetParent)) { 605 const { height, width } = getWindowSizes$1(popper.ownerDocument); 606 boundaries.top += offsets.top - offsets.marginTop; 607 boundaries.bottom = height + offsets.top; 608 boundaries.left += offsets.left - offsets.marginLeft; 609 boundaries.right = width + offsets.left; 610 } else { 611 // for all the other DOM elements, this one is good 612 boundaries = offsets; 613 } 614 } 615 616 // Add paddings 617 padding = padding || 0; 618 const isPaddingNumber = typeof padding === 'number'; 619 boundaries.left += isPaddingNumber ? padding : padding.left || 0; 620 boundaries.top += isPaddingNumber ? padding : padding.top || 0; 621 boundaries.right -= isPaddingNumber ? padding : padding.right || 0; 622 boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0; 623 624 return boundaries; 625 } 626 627 function getArea$1({ width, height }) { 628 return width * height; 629 } 630 631 /** 632 * Utility used to transform the `auto` placement to the placement with more 633 * available space. 634 * @method 635 * @memberof Popper.Utils 636 * @argument {Object} data - The data object generated by update method 637 * @argument {Object} options - Modifiers configuration and options 638 * @returns {Object} The data object, properly modified 639 */ 640 function computeAutoPlacement$1(placement, refRect, popper, reference, boundariesElement, padding = 0) { 641 if (placement.indexOf('auto') === -1) { 642 return placement; 643 } 644 645 const boundaries = getBoundaries$1(popper, reference, padding, boundariesElement); 646 647 const rects = { 648 top: { 649 width: boundaries.width, 650 height: refRect.top - boundaries.top 651 }, 652 right: { 653 width: boundaries.right - refRect.right, 654 height: boundaries.height 655 }, 656 bottom: { 657 width: boundaries.width, 658 height: boundaries.bottom - refRect.bottom 659 }, 660 left: { 661 width: refRect.left - boundaries.left, 662 height: boundaries.height 663 } 664 }; 665 666 const sortedAreas = Object.keys(rects).map(key => _extends$1({ 667 key 668 }, rects[key], { 669 area: getArea$1(rects[key]) 670 })).sort((a, b) => b.area - a.area); 671 672 const filteredAreas = sortedAreas.filter(({ width, height }) => width >= popper.clientWidth && height >= popper.clientHeight); 673 674 const computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key; 675 676 const variation = placement.split('-')[1]; 677 678 return computedPlacement + (variation ? `-${variation}` : ''); 679 } 680 681 /** 682 * Get offsets to the reference element 683 * @method 684 * @memberof Popper.Utils 685 * @param {Object} state 686 * @param {Element} popper - the popper element 687 * @param {Element} reference - the reference element (the popper will be relative to this) 688 * @param {Element} fixedPosition - is in fixed position mode 689 * @returns {Object} An object containing the offsets which will be applied to the popper 690 */ 691 function getReferenceOffsets$1(state, popper, reference, fixedPosition = null) { 692 const commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent$1(popper) : findCommonOffsetParent$1(popper, getReferenceNode$1(reference)); 693 return getOffsetRectRelativeToArbitraryNode$1(reference, commonOffsetParent, fixedPosition); 694 } 695 696 /** 697 * Get the outer sizes of the given element (offset size + margins) 698 * @method 699 * @memberof Popper.Utils 700 * @argument {Element} element 701 * @returns {Object} object containing width and height properties 702 */ 703 function getOuterSizes$1(element) { 704 const window = element.ownerDocument.defaultView; 705 const styles = window.getComputedStyle(element); 706 const x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0); 707 const y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0); 708 const result = { 709 width: element.offsetWidth + y, 710 height: element.offsetHeight + x 711 }; 712 return result; 713 } 714 715 /** 716 * Get the opposite placement of the given one 717 * @method 718 * @memberof Popper.Utils 719 * @argument {String} placement 720 * @returns {String} flipped placement 721 */ 722 function getOppositePlacement$1(placement) { 723 const hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' }; 724 return placement.replace(/left|right|bottom|top/g, matched => hash[matched]); 725 } 726 727 /** 728 * Get offsets to the popper 729 * @method 730 * @memberof Popper.Utils 731 * @param {Object} position - CSS position the Popper will get applied 732 * @param {HTMLElement} popper - the popper element 733 * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this) 734 * @param {String} placement - one of the valid placement options 735 * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper 736 */ 737 function getPopperOffsets$1(popper, referenceOffsets, placement) { 738 placement = placement.split('-')[0]; 739 740 // Get popper node sizes 741 const popperRect = getOuterSizes$1(popper); 742 743 // Add position, width and height to our offsets object 744 const popperOffsets = { 745 width: popperRect.width, 746 height: popperRect.height 747 }; 748 749 // depending by the popper placement we have to compute its offsets slightly differently 750 const isHoriz = ['right', 'left'].indexOf(placement) !== -1; 751 const mainSide = isHoriz ? 'top' : 'left'; 752 const secondarySide = isHoriz ? 'left' : 'top'; 753 const measurement = isHoriz ? 'height' : 'width'; 754 const secondaryMeasurement = !isHoriz ? 'height' : 'width'; 755 756 popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2; 757 if (placement === secondarySide) { 758 popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement]; 759 } else { 760 popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement$1(secondarySide)]; 761 } 762 763 return popperOffsets; 764 } 765 766 /** 767 * Mimics the `find` method of Array 768 * @method 769 * @memberof Popper.Utils 770 * @argument {Array} arr 771 * @argument prop 772 * @argument value 773 * @returns index or -1 774 */ 775 function find$1(arr, check) { 776 // use native find if supported 777 if (Array.prototype.find) { 778 return arr.find(check); 779 } 780 781 // use `filter` to obtain the same behavior of `find` 782 return arr.filter(check)[0]; 783 } 784 785 /** 786 * Return the index of the matching object 787 * @method 788 * @memberof Popper.Utils 789 * @argument {Array} arr 790 * @argument prop 791 * @argument value 792 * @returns index or -1 793 */ 794 function findIndex$1(arr, prop, value) { 795 // use native findIndex if supported 796 if (Array.prototype.findIndex) { 797 return arr.findIndex(cur => cur[prop] === value); 798 } 799 800 // use `find` + `indexOf` if `findIndex` isn't supported 801 const match = find$1(arr, obj => obj[prop] === value); 802 return arr.indexOf(match); 803 } 804 805 /** 806 * Loop trough the list of modifiers and run them in order, 807 * each of them will then edit the data object. 808 * @method 809 * @memberof Popper.Utils 810 * @param {dataObject} data 811 * @param {Array} modifiers 812 * @param {String} ends - Optional modifier name used as stopper 813 * @returns {dataObject} 814 */ 815 function runModifiers$1(modifiers, data, ends) { 816 const modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex$1(modifiers, 'name', ends)); 817
vendor: 8,544 bytes, lines 818-1080
818 modifiersToRun.forEach(modifier => { 819 if (modifier['function']) { 820 // eslint-disable-line dot-notation 821 console.warn('`modifier.function` is deprecated, use `modifier.fn`!'); 822 } 823 const fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation 824 if (modifier.enabled && isFunction$1(fn)) { 825 // Add properties to offsets to make them a complete clientRect object 826 // we do this before each modifier to make sure the previous one doesn't 827 // mess with these values 828 data.offsets.popper = getClientRect$1(data.offsets.popper); 829 data.offsets.reference = getClientRect$1(data.offsets.reference); 830 831 data = fn(data, modifier); 832 } 833 }); 834 835 return data; 836 } 837 838 /** 839 * Updates the position of the popper, computing the new offsets and applying 840 * the new style.<br /> 841 * Prefer `scheduleUpdate` over `update` because of performance reasons. 842 * @method 843 * @memberof Popper 844 */ 845 function update$1() { 846 // if popper is destroyed, don't perform any further update 847 if (this.state.isDestroyed) { 848 return; 849 } 850 851 let data = { 852 instance: this, 853 styles: {}, 854 arrowStyles: {}, 855 attributes: {}, 856 flipped: false, 857 offsets: {} 858 }; 859 860 // compute reference element offsets 861 data.offsets.reference = getReferenceOffsets$1(this.state, this.popper, this.reference, this.options.positionFixed); 862 863 // compute auto placement, store placement inside the data object, 864 // modifiers will be able to edit `placement` if needed 865 // and refer to originalPlacement to know the original value 866 data.placement = computeAutoPlacement$1(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding); 867 868 // store the computed placement inside `originalPlacement` 869 data.originalPlacement = data.placement; 870 871 data.positionFixed = this.options.positionFixed; 872 873 // compute the popper offsets 874 data.offsets.popper = getPopperOffsets$1(this.popper, data.offsets.reference, data.placement); 875 876 data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute'; 877 878 // run the modifiers 879 data = runModifiers$1(this.modifiers, data); 880 881 // the first `update` will call `onCreate` callback 882 // the other ones will call `onUpdate` callback 883 if (!this.state.isCreated) { 884 this.state.isCreated = true; 885 this.options.onCreate(data); 886 } else { 887 this.options.onUpdate(data); 888 } 889 } 890 891 /** 892 * Helper used to know if the given modifier is enabled. 893 * @method 894 * @memberof Popper.Utils 895 * @returns {Boolean} 896 */ 897 function isModifierEnabled$1(modifiers, modifierName) { 898 return modifiers.some(({ name, enabled }) => enabled && name === modifierName); 899 } 900 901 /** 902 * Get the prefixed supported property name 903 * @method 904 * @memberof Popper.Utils 905 * @argument {String} property (camelCase) 906 * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix) 907 */ 908 function getSupportedPropertyName$1(property) { 909 const prefixes = [false, 'ms', 'Webkit', 'Moz', 'O']; 910 const upperProp = property.charAt(0).toUpperCase() + property.slice(1); 911 912 for (let i = 0; i < prefixes.length; i++) { 913 const prefix = prefixes[i]; 914 const toCheck = prefix ? `${prefix}${upperProp}` : property; 915 if (typeof document.body.style[toCheck] !== 'undefined') { 916 return toCheck; 917 } 918 } 919 return null; 920 } 921 922 /** 923 * Destroys the popper. 924 * @method 925 * @memberof Popper 926 */ 927 function destroy$1() { 928 this.state.isDestroyed = true; 929 930 // touch DOM only if `applyStyle` modifier is enabled 931 if (isModifierEnabled$1(this.modifiers, 'applyStyle')) { 932 this.popper.removeAttribute('x-placement'); 933 this.popper.style.position = ''; 934 this.popper.style.top = ''; 935 this.popper.style.left = ''; 936 this.popper.style.right = ''; 937 this.popper.style.bottom = ''; 938 this.popper.style.willChange = ''; 939 this.popper.style[getSupportedPropertyName$1('transform')] = ''; 940 } 941 942 this.disableEventListeners(); 943 944 // remove the popper if user explicitly asked for the deletion on destroy 945 // do not use `remove` because IE11 doesn't support it 946 if (this.options.removeOnDestroy) { 947 this.popper.parentNode.removeChild(this.popper); 948 } 949 return this; 950 } 951 952 /** 953 * Get the window associated with the element 954 * @argument {Element} element 955 * @returns {Window} 956 */ 957 function getWindow$1(element) { 958 const ownerDocument = element.ownerDocument; 959 return ownerDocument ? ownerDocument.defaultView : window; 960 } 961 962 function attachToScrollParents$1(scrollParent, event, callback, scrollParents) { 963 const isBody = scrollParent.nodeName === 'BODY'; 964 const target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent; 965 target.addEventListener(event, callback, { passive: true }); 966 967 if (!isBody) { 968 attachToScrollParents$1(getScrollParent$1(target.parentNode), event, callback, scrollParents); 969 } 970 scrollParents.push(target); 971 } 972 973 /** 974 * Setup needed event listeners used to update the popper position 975 * @method 976 * @memberof Popper.Utils 977 * @private 978 */ 979 function setupEventListeners$1(reference, options, state, updateBound) { 980 // Resize event listener on window 981 state.updateBound = updateBound; 982 getWindow$1(reference).addEventListener('resize', state.updateBound, { passive: true }); 983 984 // Scroll event listener on scroll parents 985 const scrollElement = getScrollParent$1(reference); 986 attachToScrollParents$1(scrollElement, 'scroll', state.updateBound, state.scrollParents); 987 state.scrollElement = scrollElement; 988 state.eventsEnabled = true; 989 990 return state; 991 } 992 993 /** 994 * It will add resize/scroll events and start recalculating 995 * position of the popper element when they are triggered. 996 * @method 997 * @memberof Popper 998 */ 999 function enableEventListeners$1() { 1000 if (!this.state.eventsEnabled) { 1001 this.state = setupEventListeners$1(this.reference, this.options, this.state, this.scheduleUpdate); 1002 } 1003 } 1004 1005 /** 1006 * Remove event listeners used to update the popper position 1007 * @method 1008 * @memberof Popper.Utils 1009 * @private 1010 */ 1011 function removeEventListeners$1(reference, state) { 1012 // Remove resize event listener on window 1013 getWindow$1(reference).removeEventListener('resize', state.updateBound); 1014 1015 // Remove scroll event listener on scroll parents 1016 state.scrollParents.forEach(target => { 1017 target.removeEventListener('scroll', state.updateBound); 1018 }); 1019 1020 // Reset state 1021 state.updateBound = null; 1022 state.scrollParents = []; 1023 state.scrollElement = null; 1024 state.eventsEnabled = false; 1025 return state; 1026 } 1027 1028 /** 1029 * It will remove resize/scroll events and won't recalculate popper position 1030 * when they are triggered. It also won't trigger `onUpdate` callback anymore, 1031 * unless you call `update` method manually. 1032 * @method 1033 * @memberof Popper 1034 */ 1035 function disableEventListeners$1() { 1036 if (this.state.eventsEnabled) { 1037 cancelAnimationFrame(this.scheduleUpdate); 1038 this.state = removeEventListeners$1(this.reference, this.state); 1039 } 1040 } 1041 1042 /** 1043 * Tells if a given input is a number 1044 * @method 1045 * @memberof Popper.Utils 1046 * @param {*} input to check 1047 * @return {Boolean} 1048 */ 1049 function isNumeric$1(n) { 1050 return n !== '' && !isNaN(parseFloat(n)) && isFinite(n); 1051 } 1052 1053 /** 1054 * Set the style to the given popper 1055 * @method 1056 * @memberof Popper.Utils 1057 * @argument {Element} element - Element to apply the style to 1058 * @argument {Object} styles 1059 * Object with a list of properties and values which will be applied to the element 1060 */ 1061 function setStyles$1(element, styles) { 1062 Object.keys(styles).forEach(prop => { 1063 let unit = ''; 1064 // add unit if the value is numeric and is one of the following 1065 if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric$1(styles[prop])) { 1066 unit = 'px'; 1067 } 1068 element.style[prop] = styles[prop] + unit; 1069 }); 1070 } 1071 1072 /** 1073 * Set the attributes to the given popper 1074 * @method 1075 * @memberof Popper.Utils 1076 * @argument {Element} element - Element to apply the attributes to 1077 * @argument {Object} styles 1078 * Object with a list of properties and values which will be applied to the element 1079 */ 1080 function setAttributes$1(element, attributes) {
1081 Object.keys(attributes).forEach(function (prop) { 1082 const value = attributes[prop]; 1083 if (value !== false) { 1084 element.setAttribute(prop, attributes[prop]); 1085 } else { 1086 element.removeAttribute(prop); 1087 } 1088 }); 1089 } 1090 1091 /** 1092 * @function 1093 * @memberof Modifiers 1094 * @argument {Object} data - The data object generated by `update` method 1095 * @argument {Object} data.styles - List of style properties - values to apply to popper element 1096 * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element 1097 * @argument {Object} options - Modifiers configuration and options 1098 * @returns {Object} The same data object 1099 */ 1100 function applyStyle$1(data) { 1101 // any property present in `data.styles` will be applied to the popper, 1102 // in this way we can make the 3rd party modifiers add custom styles to it 1103 // Be aware, modifiers could override the properties defined in the previous 1104 // lines of this modifier! 1105 setStyles$1(data.instance.popper, data.styles); 1106 1107 // any property present in `data.attributes` will be applied to the popper, 1108 // they will be set as HTML attributes of the element 1109 setAttributes$1(data.instance.popper, data.attributes); 1110 1111 // if arrowElement is defined and arrowStyles has some properties
vendor: 32,848 bytes, lines 1112-1963
1112 if (data.arrowElement && Object.keys(data.arrowStyles).length) { 1113 setStyles$1(data.arrowElement, data.arrowStyles); 1114 } 1115 1116 return data; 1117 } 1118 1119 /** 1120 * Set the x-placement attribute before everything else because it could be used 1121 * to add margins to the popper margins needs to be calculated to get the 1122 * correct popper offsets. 1123 * @method 1124 * @memberof Popper.modifiers 1125 * @param {HTMLElement} reference - The reference element used to position the popper 1126 * @param {HTMLElement} popper - The HTML element used as popper 1127 * @param {Object} options - Popper.js options 1128 */ 1129 function applyStyleOnLoad$1(reference, popper, options, modifierOptions, state) { 1130 // compute reference element offsets 1131 const referenceOffsets = getReferenceOffsets$1(state, popper, reference, options.positionFixed); 1132 1133 // compute auto placement, store placement inside the data object, 1134 // modifiers will be able to edit `placement` if needed 1135 // and refer to originalPlacement to know the original value 1136 const placement = computeAutoPlacement$1(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding); 1137 1138 popper.setAttribute('x-placement', placement); 1139 1140 // Apply `position` to popper before anything else because 1141 // without the position applied we can't guarantee correct computations 1142 setStyles$1(popper, { position: options.positionFixed ? 'fixed' : 'absolute' }); 1143 1144 return options; 1145 } 1146 1147 /** 1148 * @function 1149 * @memberof Popper.Utils 1150 * @argument {Object} data - The data object generated by `update` method 1151 * @argument {Boolean} shouldRound - If the offsets should be rounded at all 1152 * @returns {Object} The popper's position offsets rounded 1153 * 1154 * The tale of pixel-perfect positioning. It's still not 100% perfect, but as 1155 * good as it can be within reason. 1156 * Discussion here: https://github.com/FezVrasta/popper.js/pull/715 1157 * 1158 * Low DPI screens cause a popper to be blurry if not using full pixels (Safari 1159 * as well on High DPI screens). 1160 * 1161 * Firefox prefers no rounding for positioning and does not have blurriness on 1162 * high DPI screens. 1163 * 1164 * Only horizontal placement and left/right values need to be considered. 1165 */ 1166 function getRoundedOffsets$1(data, shouldRound) { 1167 const { popper, reference } = data.offsets; 1168 const { round, floor } = Math; 1169 const noRound = v => v; 1170 1171 const referenceWidth = round(reference.width); 1172 const popperWidth = round(popper.width); 1173 1174 const isVertical = ['left', 'right'].indexOf(data.placement) !== -1; 1175 const isVariation = data.placement.indexOf('-') !== -1; 1176 const sameWidthParity = referenceWidth % 2 === popperWidth % 2; 1177 const bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1; 1178 1179 const horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor; 1180 const verticalToInteger = !shouldRound ? noRound : round; 1181 1182 return { 1183 left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left), 1184 top: verticalToInteger(popper.top), 1185 bottom: verticalToInteger(popper.bottom), 1186 right: horizontalToInteger(popper.right) 1187 }; 1188 } 1189 1190 const isFirefox$1 = isBrowser$1 && /Firefox/i.test(navigator.userAgent); 1191 1192 /** 1193 * @function 1194 * @memberof Modifiers 1195 * @argument {Object} data - The data object generated by `update` method 1196 * @argument {Object} options - Modifiers configuration and options 1197 * @returns {Object} The data object, properly modified 1198 */ 1199 function computeStyle$1(data, options) { 1200 const { x, y } = options; 1201 const { popper } = data.offsets; 1202 1203 // Remove this legacy support in Popper.js v2 1204 const legacyGpuAccelerationOption = find$1(data.instance.modifiers, modifier => modifier.name === 'applyStyle').gpuAcceleration; 1205 if (legacyGpuAccelerationOption !== undefined) { 1206 console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!'); 1207 } 1208 const gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration; 1209 1210 const offsetParent = getOffsetParent$1(data.instance.popper); 1211 const offsetParentRect = getBoundingClientRect$1(offsetParent); 1212 1213 // Styles 1214 const styles = { 1215 position: popper.position 1216 }; 1217 1218 const offsets = getRoundedOffsets$1(data, window.devicePixelRatio < 2 || !isFirefox$1); 1219 1220 const sideA = x === 'bottom' ? 'top' : 'bottom'; 1221 const sideB = y === 'right' ? 'left' : 'right'; 1222 1223 // if gpuAcceleration is set to `true` and transform is supported, 1224 // we use `translate3d` to apply the position to the popper we 1225 // automatically use the supported prefixed version if needed 1226 const prefixedProperty = getSupportedPropertyName$1('transform'); 1227 1228 // now, let's make a step back and look at this code closely (wtf?) 1229 // If the content of the popper grows once it's been positioned, it 1230 // may happen that the popper gets misplaced because of the new content 1231 // overflowing its reference element 1232 // To avoid this problem, we provide two options (x and y), which allow 1233 // the consumer to define the offset origin. 1234 // If we position a popper on top of a reference element, we can set 1235 // `x` to `top` to make the popper grow towards its top instead of 1236 // its bottom. 1237 let left, top; 1238 if (sideA === 'bottom') { 1239 // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar) 1240 // and not the bottom of the html element 1241 if (offsetParent.nodeName === 'HTML') { 1242 top = -offsetParent.clientHeight + offsets.bottom; 1243 } else { 1244 top = -offsetParentRect.height + offsets.bottom; 1245 } 1246 } else { 1247 top = offsets.top; 1248 } 1249 if (sideB === 'right') { 1250 if (offsetParent.nodeName === 'HTML') { 1251 left = -offsetParent.clientWidth + offsets.right; 1252 } else { 1253 left = -offsetParentRect.width + offsets.right; 1254 } 1255 } else { 1256 left = offsets.left; 1257 } 1258 if (gpuAcceleration && prefixedProperty) { 1259 styles[prefixedProperty] = `translate3d(${left}px, ${top}px, 0)`; 1260 styles[sideA] = 0; 1261 styles[sideB] = 0; 1262 styles.willChange = 'transform'; 1263 } else { 1264 // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties 1265 const invertTop = sideA === 'bottom' ? -1 : 1; 1266 const invertLeft = sideB === 'right' ? -1 : 1; 1267 styles[sideA] = top * invertTop; 1268 styles[sideB] = left * invertLeft; 1269 styles.willChange = `${sideA}, ${sideB}`; 1270 } 1271 1272 // Attributes 1273 const attributes = { 1274 'x-placement': data.placement 1275 }; 1276 1277 // Update `data` attributes, styles and arrowStyles 1278 data.attributes = _extends$1({}, attributes, data.attributes); 1279 data.styles = _extends$1({}, styles, data.styles); 1280 data.arrowStyles = _extends$1({}, data.offsets.arrow, data.arrowStyles); 1281 1282 return data; 1283 } 1284 1285 /** 1286 * Helper used to know if the given modifier depends from another one.<br /> 1287 * It checks if the needed modifier is listed and enabled. 1288 * @method 1289 * @memberof Popper.Utils 1290 * @param {Array} modifiers - list of modifiers 1291 * @param {String} requestingName - name of requesting modifier 1292 * @param {String} requestedName - name of requested modifier 1293 * @returns {Boolean} 1294 */ 1295 function isModifierRequired$1(modifiers, requestingName, requestedName) { 1296 const requesting = find$1(modifiers, ({ name }) => name === requestingName); 1297 1298 const isRequired = !!requesting && modifiers.some(modifier => { 1299 return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order; 1300 }); 1301 1302 if (!isRequired) { 1303 const requesting = `\`${requestingName}\``; 1304 const requested = `\`${requestedName}\``; 1305 console.warn(`${requested} modifier is required by ${requesting} modifier in order to work, be sure to include it before ${requesting}!`); 1306 } 1307 return isRequired; 1308 } 1309 1310 /** 1311 * @function 1312 * @memberof Modifiers 1313 * @argument {Object} data - The data object generated by update method 1314 * @argument {Object} options - Modifiers configuration and options 1315 * @returns {Object} The data object, properly modified 1316 */ 1317 function arrow$1(data, options) { 1318 // arrow depends on keepTogether in order to work 1319 if (!isModifierRequired$1(data.instance.modifiers, 'arrow', 'keepTogether')) { 1320 return data; 1321 } 1322 1323 let arrowElement = options.element; 1324 1325 // if arrowElement is a string, suppose it's a CSS selector 1326 if (typeof arrowElement === 'string') { 1327 arrowElement = data.instance.popper.querySelector(arrowElement); 1328 1329 // if arrowElement is not found, don't run the modifier 1330 if (!arrowElement) { 1331 return data; 1332 } 1333 } else { 1334 // if the arrowElement isn't a query selector we must check that the 1335 // provided DOM node is child of its popper node 1336 if (!data.instance.popper.contains(arrowElement)) { 1337 console.warn('WARNING: `arrow.element` must be child of its popper element!'); 1338 return data; 1339 } 1340 } 1341 1342 const placement = data.placement.split('-')[0]; 1343 const { popper, reference } = data.offsets; 1344 const isVertical = ['left', 'right'].indexOf(placement) !== -1; 1345 1346 const len = isVertical ? 'height' : 'width'; 1347 const sideCapitalized = isVertical ? 'Top' : 'Left'; 1348 const side = sideCapitalized.toLowerCase(); 1349 const altSide = isVertical ? 'left' : 'top'; 1350 const opSide = isVertical ? 'bottom' : 'right'; 1351 const arrowElementSize = getOuterSizes$1(arrowElement)[len]; 1352 1353 // 1354 // extends keepTogether behavior making sure the popper and its 1355 // reference have enough pixels in conjunction 1356 // 1357 1358 // top/left side 1359 if (reference[opSide] - arrowElementSize < popper[side]) { 1360 data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize); 1361 } 1362 // bottom/right side 1363 if (reference[side] + arrowElementSize > popper[opSide]) { 1364 data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide]; 1365 } 1366 data.offsets.popper = getClientRect$1(data.offsets.popper); 1367 1368 // compute center of the popper 1369 const center = reference[side] + reference[len] / 2 - arrowElementSize / 2; 1370 1371 // Compute the sideValue using the updated popper offsets 1372 // take popper margin in account because we don't have this info available 1373 const css = getStyleComputedProperty$1(data.instance.popper); 1374 const popperMarginSide = parseFloat(css[`margin${sideCapitalized}`]); 1375 const popperBorderSide = parseFloat(css[`border${sideCapitalized}Width`]); 1376 let sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide; 1377 1378 // prevent arrowElement from being placed not contiguously to its popper 1379 sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0); 1380 1381 data.arrowElement = arrowElement; 1382 data.offsets.arrow = { 1383 [side]: Math.round(sideValue), 1384 [altSide]: '' // make sure to unset any eventual altSide value from the DOM node 1385 }; 1386 1387 return data; 1388 } 1389 1390 /** 1391 * Get the opposite placement variation of the given one 1392 * @method 1393 * @memberof Popper.Utils 1394 * @argument {String} placement variation 1395 * @returns {String} flipped placement variation 1396 */ 1397 function getOppositeVariation$1(variation) { 1398 if (variation === 'end') { 1399 return 'start'; 1400 } else if (variation === 'start') { 1401 return 'end'; 1402 } 1403 return variation; 1404 } 1405 1406 /** 1407 * List of accepted placements to use as values of the `placement` option.<br /> 1408 * Valid placements are: 1409 * - `auto` 1410 * - `top` 1411 * - `right` 1412 * - `bottom` 1413 * - `left` 1414 * 1415 * Each placement can have a variation from this list: 1416 * - `-start` 1417 * - `-end` 1418 * 1419 * Variations are interpreted easily if you think of them as the left to right 1420 * written languages. Horizontally (`top` and `bottom`), `start` is left and `end` 1421 * is right.<br /> 1422 * Vertically (`left` and `right`), `start` is top and `end` is bottom. 1423 * 1424 * Some valid examples are: 1425 * - `top-end` (on top of reference, right aligned) 1426 * - `right-start` (on right of reference, top aligned) 1427 * - `bottom` (on bottom, centered) 1428 * - `auto-end` (on the side with more space available, alignment depends by placement) 1429 * 1430 * @static 1431 * @type {Array} 1432 * @enum {String} 1433 * @readonly 1434 * @method placements 1435 * @memberof Popper 1436 */ 1437 var placements$1 = ['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']; 1438 1439 // Get rid of `auto` `auto-start` and `auto-end` 1440 const validPlacements$1 = placements$1.slice(3); 1441 1442 /** 1443 * Given an initial placement, returns all the subsequent placements 1444 * clockwise (or counter-clockwise). 1445 * 1446 * @method 1447 * @memberof Popper.Utils 1448 * @argument {String} placement - A valid placement (it accepts variations) 1449 * @argument {Boolean} counter - Set to true to walk the placements counterclockwise 1450 * @returns {Array} placements including their variations 1451 */ 1452 function clockwise$1(placement, counter = false) { 1453 const index = validPlacements$1.indexOf(placement); 1454 const arr = validPlacements$1.slice(index + 1).concat(validPlacements$1.slice(0, index)); 1455 return counter ? arr.reverse() : arr; 1456 } 1457 1458 const BEHAVIORS$1 = { 1459 FLIP: 'flip', 1460 CLOCKWISE: 'clockwise', 1461 COUNTERCLOCKWISE: 'counterclockwise' 1462 }; 1463 1464 /** 1465 * @function 1466 * @memberof Modifiers 1467 * @argument {Object} data - The data object generated by update method 1468 * @argument {Object} options - Modifiers configuration and options 1469 * @returns {Object} The data object, properly modified 1470 */ 1471 function flip$1(data, options) { 1472 // if `inner` modifier is enabled, we can't use the `flip` modifier 1473 if (isModifierEnabled$1(data.instance.modifiers, 'inner')) { 1474 return data; 1475 } 1476 1477 if (data.flipped && data.placement === data.originalPlacement) { 1478 // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides 1479 return data; 1480 } 1481 1482 const boundaries = getBoundaries$1(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed); 1483 1484 let placement = data.placement.split('-')[0]; 1485 let placementOpposite = getOppositePlacement$1(placement); 1486 let variation = data.placement.split('-')[1] || ''; 1487 1488 let flipOrder = []; 1489 1490 switch (options.behavior) { 1491 case BEHAVIORS$1.FLIP: 1492 flipOrder = [placement, placementOpposite]; 1493 break; 1494 case BEHAVIORS$1.CLOCKWISE: 1495 flipOrder = clockwise$1(placement); 1496 break; 1497 case BEHAVIORS$1.COUNTERCLOCKWISE: 1498 flipOrder = clockwise$1(placement, true); 1499 break; 1500 default: 1501 flipOrder = options.behavior; 1502 } 1503 1504 flipOrder.forEach((step, index) => { 1505 if (placement !== step || flipOrder.length === index + 1) { 1506 return data; 1507 } 1508 1509 placement = data.placement.split('-')[0]; 1510 placementOpposite = getOppositePlacement$1(placement); 1511 1512 const popperOffsets = data.offsets.popper; 1513 const refOffsets = data.offsets.reference; 1514 1515 // using floor because the reference offsets may contain decimals we are not going to consider here 1516 const floor = Math.floor; 1517 const 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); 1518 1519 const overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left); 1520 const overflowsRight = floor(popperOffsets.right) > floor(boundaries.right); 1521 const overflowsTop = floor(popperOffsets.top) < floor(boundaries.top); 1522 const overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom); 1523 1524 const overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom; 1525 1526 // flip the variation if required 1527 const isVertical = ['top', 'bottom'].indexOf(placement) !== -1; 1528 1529 // flips variation if reference element overflows boundaries 1530 const flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom); 1531 1532 // flips variation if popper content overflows boundaries 1533 const flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop); 1534 1535 const flippedVariation = flippedVariationByRef || flippedVariationByContent; 1536 1537 if (overlapsRef || overflowsBoundaries || flippedVariation) { 1538 // this boolean to detect any flip loop 1539 data.flipped = true; 1540 1541 if (overlapsRef || overflowsBoundaries) { 1542 placement = flipOrder[index + 1]; 1543 } 1544 1545 if (flippedVariation) { 1546 variation = getOppositeVariation$1(variation); 1547 } 1548 1549 data.placement = placement + (variation ? '-' + variation : ''); 1550 1551 // this object contains `position`, we want to preserve it along with 1552 // any additional property we may add in the future 1553 data.offsets.popper = _extends$1({}, data.offsets.popper, getPopperOffsets$1(data.instance.popper, data.offsets.reference, data.placement)); 1554 1555 data = runModifiers$1(data.instance.modifiers, data, 'flip'); 1556 } 1557 }); 1558 return data; 1559 } 1560 1561 /** 1562 * @function 1563 * @memberof Modifiers 1564 * @argument {Object} data - The data object generated by update method 1565 * @argument {Object} options - Modifiers configuration and options 1566 * @returns {Object} The data object, properly modified 1567 */ 1568 function keepTogether$1(data) { 1569 const { popper, reference } = data.offsets; 1570 const placement = data.placement.split('-')[0]; 1571 const floor = Math.floor; 1572 const isVertical = ['top', 'bottom'].indexOf(placement) !== -1; 1573 const side = isVertical ? 'right' : 'bottom'; 1574 const opSide = isVertical ? 'left' : 'top'; 1575 const measurement = isVertical ? 'width' : 'height'; 1576 1577 if (popper[side] < floor(reference[opSide])) { 1578 data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement]; 1579 } 1580 if (popper[opSide] > floor(reference[side])) { 1581 data.offsets.popper[opSide] = floor(reference[side]); 1582 } 1583 1584 return data; 1585 } 1586 1587 /** 1588 * Converts a string containing value + unit into a px value number 1589 * @function 1590 * @memberof {modifiers~offset} 1591 * @private 1592 * @argument {String} str - Value + unit string 1593 * @argument {String} measurement - `height` or `width` 1594 * @argument {Object} popperOffsets 1595 * @argument {Object} referenceOffsets 1596 * @returns {Number|String} 1597 * Value in pixels, or original string if no values were extracted 1598 */ 1599 function toValue$1(str, measurement, popperOffsets, referenceOffsets) { 1600 // separate value from unit 1601 const split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/); 1602 const value = +split[1]; 1603 const unit = split[2]; 1604 1605 // If it's not a number it's an operator, I guess 1606 if (!value) { 1607 return str; 1608 } 1609 1610 if (unit.indexOf('%') === 0) { 1611 let element; 1612 switch (unit) { 1613 case '%p': 1614 element = popperOffsets; 1615 break; 1616 case '%': 1617 case '%r': 1618 default: 1619 element = referenceOffsets; 1620 } 1621 1622 const rect = getClientRect$1(element); 1623 return rect[measurement] / 100 * value; 1624 } else if (unit === 'vh' || unit === 'vw') { 1625 // if is a vh or vw, we calculate the size based on the viewport 1626 let size; 1627 if (unit === 'vh') { 1628 size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0); 1629 } else { 1630 size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0); 1631 } 1632 return size / 100 * value; 1633 } else { 1634 // if is an explicit pixel unit, we get rid of the unit and keep the value 1635 // if is an implicit unit, it's px, and we return just the value 1636 return value; 1637 } 1638 } 1639 1640 /** 1641 * Parse an `offset` string to extrapolate `x` and `y` numeric offsets. 1642 * @function 1643 * @memberof {modifiers~offset} 1644 * @private 1645 * @argument {String} offset 1646 * @argument {Object} popperOffsets 1647 * @argument {Object} referenceOffsets 1648 * @argument {String} basePlacement 1649 * @returns {Array} a two cells array with x and y offsets in numbers 1650 */ 1651 function parseOffset$1(offset, popperOffsets, referenceOffsets, basePlacement) { 1652 const offsets = [0, 0]; 1653 1654 // Use height if placement is left or right and index is 0 otherwise use width 1655 // in this way the first offset will use an axis and the second one 1656 // will use the other one 1657 const useHeight = ['right', 'left'].indexOf(basePlacement) !== -1; 1658 1659 // Split the offset string to obtain a list of values and operands 1660 // The regex addresses values with the plus or minus sign in front (+10, -20, etc) 1661 const fragments = offset.split(/(\+|\-)/).map(frag => frag.trim()); 1662 1663 // Detect if the offset string contains a pair of values or a single one 1664 // they could be separated by comma or space 1665 const divider = fragments.indexOf(find$1(fragments, frag => frag.search(/,|\s/) !== -1)); 1666 1667 if (fragments[divider] && fragments[divider].indexOf(',') === -1) { 1668 console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.'); 1669 } 1670 1671 // If divider is found, we divide the list of values and operands to divide 1672 // them by ofset X and Y. 1673 const splitRegex = /\s*,\s*|\s+/; 1674 let ops = divider !== -1 ? [fragments.slice(0, divider).concat([fragments[divider].split(splitRegex)[0]]), [fragments[divider].split(splitRegex)[1]].concat(fragments.slice(divider + 1))] : [fragments]; 1675 1676 // Convert the values with units to absolute pixels to allow our computations 1677 ops = ops.map((op, index) => { 1678 // Most of the units rely on the orientation of the popper 1679 const measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width'; 1680 let mergeWithPrevious = false; 1681 return op 1682 // This aggregates any `+` or `-` sign that aren't considered operators 1683 // e.g.: 10 + +5 => [10, +, +5] 1684 .reduce((a, b) => { 1685 if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) { 1686 a[a.length - 1] = b; 1687 mergeWithPrevious = true; 1688 return a; 1689 } else if (mergeWithPrevious) { 1690 a[a.length - 1] += b; 1691 mergeWithPrevious = false; 1692 return a; 1693 } else { 1694 return a.concat(b); 1695 } 1696 }, []) 1697 // Here we convert the string values into number values (in px) 1698 .map(str => toValue$1(str, measurement, popperOffsets, referenceOffsets)); 1699 }); 1700 1701 // Loop trough the offsets arrays and execute the operations 1702 ops.forEach((op, index) => { 1703 op.forEach((frag, index2) => { 1704 if (isNumeric$1(frag)) { 1705 offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1); 1706 } 1707 }); 1708 }); 1709 return offsets; 1710 } 1711 1712 /** 1713 * @function 1714 * @memberof Modifiers 1715 * @argument {Object} data - The data object generated by update method 1716 * @argument {Object} options - Modifiers configuration and options 1717 * @argument {Number|String} options.offset=0 1718 * The offset value as described in the modifier description 1719 * @returns {Object} The data object, properly modified 1720 */ 1721 function offset$1(data, { offset }) { 1722 const { placement, offsets: { popper, reference } } = data; 1723 const basePlacement = placement.split('-')[0]; 1724 1725 let offsets; 1726 if (isNumeric$1(+offset)) { 1727 offsets = [+offset, 0]; 1728 } else { 1729 offsets = parseOffset$1(offset, popper, reference, basePlacement); 1730 } 1731 1732 if (basePlacement === 'left') { 1733 popper.top += offsets[0]; 1734 popper.left -= offsets[1]; 1735 } else if (basePlacement === 'right') { 1736 popper.top += offsets[0]; 1737 popper.left += offsets[1]; 1738 } else if (basePlacement === 'top') { 1739 popper.left += offsets[0]; 1740 popper.top -= offsets[1]; 1741 } else if (basePlacement === 'bottom') { 1742 popper.left += offsets[0]; 1743 popper.top += offsets[1]; 1744 } 1745 1746 data.popper = popper; 1747 return data; 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 * @returns {Object} The data object, properly modified 1756 */ 1757 function preventOverflow$1(data, options) { 1758 let boundariesElement = options.boundariesElement || getOffsetParent$1(data.instance.popper); 1759 1760 // If offsetParent is the reference element, we really want to 1761 // go one step up and use the next offsetParent as reference to 1762 // avoid to make this modifier completely useless and look like broken 1763 if (data.instance.reference === boundariesElement) { 1764 boundariesElement = getOffsetParent$1(boundariesElement); 1765 } 1766 1767 // NOTE: DOM access here 1768 // resets the popper's position so that the document size can be calculated excluding 1769 // the size of the popper element itself 1770 const transformProp = getSupportedPropertyName$1('transform'); 1771 const popperStyles = data.instance.popper.style; // assignment to help minification 1772 const { top, left, [transformProp]: transform } = popperStyles; 1773 popperStyles.top = ''; 1774 popperStyles.left = ''; 1775 popperStyles[transformProp] = ''; 1776 1777 const boundaries = getBoundaries$1(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed); 1778 1779 // NOTE: DOM access here 1780 // restores the original style properties after the offsets have been computed 1781 popperStyles.top = top; 1782 popperStyles.left = left; 1783 popperStyles[transformProp] = transform; 1784 1785 options.boundaries = boundaries; 1786 1787 const order = options.priority; 1788 let popper = data.offsets.popper; 1789 1790 const check = { 1791 primary(placement) { 1792 let value = popper[placement]; 1793 if (popper[placement] < boundaries[placement] && !options.escapeWithReference) { 1794 value = Math.max(popper[placement], boundaries[placement]); 1795 } 1796 return { [placement]: value }; 1797 }, 1798 secondary(placement) { 1799 const mainSide = placement === 'right' ? 'left' : 'top'; 1800 let value = popper[mainSide]; 1801 if (popper[placement] > boundaries[placement] && !options.escapeWithReference) { 1802 value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height)); 1803 } 1804 return { [mainSide]: value }; 1805 } 1806 }; 1807 1808 order.forEach(placement => { 1809 const side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary'; 1810 popper = _extends$1({}, popper, check[side](placement)); 1811 }); 1812 1813 data.offsets.popper = popper; 1814 1815 return data; 1816 } 1817 1818 /** 1819 * @function 1820 * @memberof Modifiers 1821 * @argument {Object} data - The data object generated by `update` method 1822 * @argument {Object} options - Modifiers configuration and options 1823 * @returns {Object} The data object, properly modified 1824 */ 1825 function shift$1(data) { 1826 const placement = data.placement; 1827 const basePlacement = placement.split('-')[0]; 1828 const shiftvariation = placement.split('-')[1]; 1829 1830 // if shift shiftvariation is specified, run the modifier 1831 if (shiftvariation) { 1832 const { reference, popper } = data.offsets; 1833 const isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1; 1834 const side = isVertical ? 'left' : 'top'; 1835 const measurement = isVertical ? 'width' : 'height'; 1836 1837 const shiftOffsets = { 1838 start: { [side]: reference[side] }, 1839 end: { 1840 [side]: reference[side] + reference[measurement] - popper[measurement] 1841 } 1842 }; 1843 1844 data.offsets.popper = _extends$1({}, popper, shiftOffsets[shiftvariation]); 1845 } 1846 1847 return data; 1848 } 1849 1850 /** 1851 * @function 1852 * @memberof Modifiers 1853 * @argument {Object} data - The data object generated by update method 1854 * @argument {Object} options - Modifiers configuration and options 1855 * @returns {Object} The data object, properly modified 1856 */ 1857 function hide$1(data) { 1858 if (!isModifierRequired$1(data.instance.modifiers, 'hide', 'preventOverflow')) { 1859 return data; 1860 } 1861 1862 const refRect = data.offsets.reference; 1863 const bound = find$1(data.instance.modifiers, modifier => modifier.name === 'preventOverflow').boundaries; 1864 1865 if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) { 1866 // Avoid unnecessary DOM access if visibility hasn't changed 1867 if (data.hide === true) { 1868 return data; 1869 } 1870 1871 data.hide = true; 1872 data.attributes['x-out-of-boundaries'] = ''; 1873 } else { 1874 // Avoid unnecessary DOM access if visibility hasn't changed 1875 if (data.hide === false) { 1876 return data; 1877 } 1878 1879 data.hide = false; 1880 data.attributes['x-out-of-boundaries'] = false; 1881 } 1882 1883 return data; 1884 } 1885 1886 /** 1887 * @function 1888 * @memberof Modifiers 1889 * @argument {Object} data - The data object generated by `update` method 1890 * @argument {Object} options - Modifiers configuration and options 1891 * @returns {Object} The data object, properly modified 1892 */ 1893 function inner$1(data) { 1894 const placement = data.placement; 1895 const basePlacement = placement.split('-')[0]; 1896 const { popper, reference } = data.offsets; 1897 const isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1; 1898 1899 const subtractLength = ['top', 'left'].indexOf(basePlacement) === -1; 1900 1901 popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0); 1902 1903 data.placement = getOppositePlacement$1(placement); 1904 data.offsets.popper = getClientRect$1(popper); 1905 1906 return data; 1907 } 1908 1909 /** 1910 * Modifier function, each modifier can have a function of this type assigned 1911 * to its `fn` property.<br /> 1912 * These functions will be called on each update, this means that you must 1913 * make sure they are performant enough to avoid performance bottlenecks. 1914 * 1915 * @function ModifierFn 1916 * @argument {dataObject} data - The data object generated by `update` method 1917 * @argument {Object} options - Modifiers configuration and options 1918 * @returns {dataObject} The data object, properly modified 1919 */ 1920 1921 /** 1922 * Modifiers are plugins used to alter the behavior of your poppers.<br /> 1923 * Popper.js uses a set of 9 modifiers to provide all the basic functionalities 1924 * needed by the library. 1925 * 1926 * Usually you don't want to override the `order`, `fn` and `onLoad` props. 1927 * All the other properties are configurations that could be tweaked. 1928 * @namespace modifiers 1929 */ 1930 var modifiers$1 = { 1931 /** 1932 * Modifier used to shift the popper on the start or end of its reference 1933 * element.<br /> 1934 * It will read the variation of the `placement` property.<br /> 1935 * It can be one either `-end` or `-start`. 1936 * @memberof modifiers 1937 * @inner 1938 */ 1939 shift: { 1940 /** @prop {number} order=100 - Index used to define the order of execution */ 1941 order: 100, 1942 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 1943 enabled: true, 1944 /** @prop {ModifierFn} */ 1945 fn: shift$1 1946 }, 1947 1948 /** 1949 * The `offset` modifier can shift your popper on both its axis. 1950 * 1951 * It accepts the following units: 1952 * - `px` or unit-less, interpreted as pixels 1953 * - `%` or `%r`, percentage relative to the length of the reference element 1954 * - `%p`, percentage relative to the length of the popper element 1955 * - `vw`, CSS viewport width unit 1956 * - `vh`, CSS viewport height unit 1957 * 1958 * For length is intended the main axis relative to the placement of the popper.<br /> 1959 * This means that if the placement is `top` or `bottom`, the length will be the 1960 * `width`. In case of `left` or `right`, it will be the `height`. 1961 * 1962 * You can provide a single value (as `Number` or `String`), or a pair of values 1963 * as `String` divided by a comma or one (or more) white space
1963s.<br /> 1964 * The latter is a deprecated method because it leads to confusion and will be 1965 * removed in v2.<br /> 1966 * Additionally, it accepts additions and subtractions between different units. 1967 * Note that multiplications and divisions aren't supported. 1968 * 1969 * Valid examples are: 1970 * ``` 1971 * 10 1972 * '10%' 1973 * '10, 10' 1974 * '10%, 10' 1975 * '10 + 10%' 1976 * '10 - 5vh + 3%' 1977 * '-10px + 5vh, 5px - 6%' 1978 * ``` 1979 * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap 1980 * > with their reference element, unfortunately, you will have to disable the `flip` modifier. 1981 * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373). 1982 * 1983 * @memberof modifiers 1984 * @inner 1985 */ 1986 offset: { 1987 /** @prop {number} order=200 - Index used to define the order of execution */ 1988 order: 200, 1989 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 1990 enabled: true, 1991 /** @prop {ModifierFn} */ 1992 fn: offset$1, 1993 /** @prop {Number|String} offset=0 1994 * The offset value as described in the modifier description 1995 */ 1996 offset: 0 1997 }, 1998 1999 /** 2000 * Modifier used to prevent the popper from being positioned outside the boundary. 2001 * 2002 * A scenario exists where the reference itself is not within the boundaries.<br /> 2003 * We can say it has "escaped the boundaries" — or just "escaped".<br /> 2004 * In this case we need to decide whether the popper should either: 2005 * 2006 * - detach from the reference and remain "trapped" in the boundaries, or 2007 * - if it should ignore the boundary and "escape with its reference" 2008 * 2009 * When `escapeWithReference` is set to`true` and reference is completely 2010 * outside its boundaries, the popper will overflow (or completely leave) 2011 * the boundaries in order to remain attached to the edge of the reference. 2012 * 2013 * @memberof modifiers 2014 * @inner 2015 */ 2016 preventOverflow: { 2017 /** @prop {number} order=300 - Index used to define the order of execution */ 2018 order: 300, 2019 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 2020 enabled: true, 2021 /** @prop {ModifierFn} */ 2022 fn: preventOverflow$1, 2023 /** 2024 * @prop {Array} [priority=['left','right','top','bottom']] 2025 * Popper will try to prevent overflow following these priorities by default, 2026 * then, it could overflow on the left and on top of the `boundariesElement` 2027 */ 2028 priority: ['left', 'right', 'top', 'bottom'], 2029 /** 2030 * @prop {number} padding=5 2031 * Amount of pixel used to define a minimum distance between the boundaries 2032 * and the popper. This makes sure the popper always has a little padding 2033 * between the edges of its container 2034 */ 2035 padding: 5, 2036 /** 2037 * @prop {String|HTMLElement} boundariesElement='scrollParent' 2038 * Boundaries used by the modifier. Can be `scrollParent`, `window`, 2039 * `viewport` or any DOM element. 2040 */ 2041 boundariesElement: 'scrollParent' 2042 }, 2043 2044 /** 2045 * Modifier used to make sure the reference and its popper stay near each other 2046 * without leaving any gap between the two. Especially useful when the arrow is 2047 * enabled and you want to ensure that it points to its reference element. 2048 * It cares only about the first axis. You can still have poppers with margin 2049 * between the popper and its reference element. 2050 * @memberof modifiers 2051 * @inner 2052 */ 2053 keepTogether: { 2054 /** @prop {number} order=400 - Index used to define the order of execution */ 2055 order: 400, 2056 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 2057 enabled: true, 2058 /** @prop {ModifierFn} */ 2059 fn: keepTogether$1 2060 }, 2061 2062 /** 2063 * This modifier is used to move the `arrowElement` of the popper to make 2064 * sure it is positioned between the reference element and its popper element. 2065 * It will read the outer size of the `arrowElement` node to detect how many 2066 * pixels of conjunction are needed. 2067 * 2068 * It has no effect if no `arrowElement` is provided. 2069 * @memberof modifiers 2070 * @inner 2071 */ 2072 arrow: { 2073 /** @prop {number} order=500 - Index used to define the order of execution */ 2074 order: 500, 2075 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 2076 enabled: true, 2077 /** @prop {ModifierFn} */ 2078 fn: arrow$1, 2079 /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */ 2080 element: '[x-arrow]' 2081 }, 2082 2083 /** 2084 * Modifier used to flip the popper's placement when it starts to overlap its 2085 * reference element. 2086 * 2087 * Requires the `preventOverflow` modifier before it in order to work. 2088 * 2089 * **NOTE:** this modifier will interrupt the current update cycle and will 2090 * restart it if it detects the need to flip the placement. 2091 * @memberof modifiers 2092 * @inner 2093 */ 2094 flip: { 2095 /** @prop {number} order=600 - Index used to define the order of execution */ 2096 order: 600, 2097 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 2098 enabled: true, 2099 /** @prop {ModifierFn} */ 2100 fn: flip$1, 2101 /** 2102 * @prop {String|Array} behavior='flip' 2103 * The behavior used to change the popper's placement. It can be one of 2104 * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid 2105 * placements (with optional variations) 2106 */ 2107 behavior: 'flip', 2108 /** 2109 * @prop {number} padding=5 2110 * The popper will flip if it hits the edges of the `boundariesElement` 2111 */ 2112 padding: 5, 2113 /** 2114 * @prop {String|HTMLElement} boundariesElement='viewport' 2115 * The element which will define the boundaries of the popper position. 2116 * The popper will never be placed outside of the defined boundaries 2117 * (except if `keepTogether` is enabled) 2118 */ 2119 boundariesElement: 'viewport', 2120 /** 2121 * @prop {Boolean} flipVariations=false 2122 * The popper will switch placement variation between `-start` and `-end` when 2123 * the reference element overlaps its boundaries. 2124 * 2125 * The original placement should have a set variation. 2126 */ 2127 flipVariations: false, 2128 /** 2129 * @prop {Boolean} flipVariationsByContent=false 2130 * The popper will switch placement variation between `-start` and `-end` when 2131 * the popper element overlaps its reference boundaries. 2132 * 2133 * The original placement should have a set variation. 2134 */ 2135 flipVariationsByContent: false 2136 }, 2137 2138 /** 2139 * Modifier used to make the popper flow toward the inner of the reference element. 2140 * By default, when this modifier is disabled, the popper will be placed outside 2141 * the reference element. 2142 * @memberof modifiers 2143 * @inner 2144 */ 2145 inner: { 2146 /** @prop {number} order=700 - Index used to define the order of execution */ 2147 order: 700, 2148 /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */ 2149 enabled: false, 2150 /** @prop {ModifierFn} */ 2151 fn: inner$1 2152 }, 2153 2154 /** 2155 * Modifier used to hide the popper when its reference element is outside of the 2156 * popper boundaries. It will set a `x-out-of-boundaries` attribute which can 2157 * be used to hide with a CSS selector the popper when its reference is 2158 * out of boundaries. 2159 * 2160 * Requires the `preventOverflow` modifier before it in order to work. 2161 * @memberof modifiers 2162 * @inner 2163 */ 2164 hide: { 2165 /** @prop {number} order=800 - Index used to define the order of execution */ 2166 order: 800, 2167 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 2168 enabled: true, 2169 /** @prop {ModifierFn} */ 2170 fn: hide$1 2171 }, 2172 2173 /** 2174 * Computes the style that will be applied to the popper element to gets 2175 * properly positioned. 2176 * 2177 * Note that this modifier will not touch the DOM, it just prepares the styles 2178 * so that `applyStyle` modifier can apply it. This separation is useful 2179 * in case you need to replace `applyStyle` with a custom implementation. 2180 * 2181 * This modifier has `850` as `order` value to maintain backward compatibility 2182 * with previous versions of Popper.js. Expect the modifiers ordering method 2183 * to change in future major versions of the library. 2184 * 2185 * @memberof modifiers 2186 * @inner 2187 */ 2188 computeStyle: { 2189 /** @prop {number} order=850 - Index used to define the order of execution */ 2190 order: 850, 2191 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 2192 enabled: true, 2193 /** @prop {ModifierFn} */ 2194 fn: computeStyle$1, 2195 /** 2196 * @prop {Boolean} gpuAcceleration=true 2197 * If true, it uses the CSS 3D transformation to position the popper. 2198 * Otherwise, it will use the `top` and `left` properties 2199 */ 2200 gpuAcceleration: true, 2201 /** 2202 * @prop {string} [x='bottom'] 2203 * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin. 2204 * Change this if your popper should grow in a direction different from `bottom` 2205 */ 2206 x: 'bottom', 2207 /** 2208 * @prop {string} [x='left'] 2209 * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin. 2210 * Change this if your popper should grow in a direction different from `right` 2211 */ 2212 y: 'right' 2213 }, 2214 2215 /** 2216 * Applies the computed styles to the popper element. 2217 * 2218 * All the DOM manipulations are limited to this modifier. This is useful in case 2219 * you want to integrate Popper.js inside a framework or view library and you 2220 * want to delegate all the DOM manipulations to it. 2221 * 2222 * Note that if you disable this modifier, you must make sure the popper element 2223 * has its position set to `absolute` before Popper.js can do its work! 2224 * 2225 * Just disable this modifier and define your own to achieve the desired effect. 2226 * 2227 * @memberof modifiers 2228 * @inner 2229 */ 2230 applyStyle: { 2231 /** @prop {number} order=900 - Index used to define the order of execution */ 2232 order: 900, 2233 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 2234 enabled: true, 2235 /** @prop {ModifierFn} */
vendor: 4,873 bytes, lines 2236-2367
2236 fn: applyStyle$1, 2237 /** @prop {Function} */ 2238 onLoad: applyStyleOnLoad$1, 2239 /** 2240 * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier 2241 * @prop {Boolean} gpuAcceleration=true 2242 * If true, it uses the CSS 3D transformation to position the popper. 2243 * Otherwise, it will use the `top` and `left` properties 2244 */ 2245 gpuAcceleration: undefined 2246 } 2247 }; 2248 2249 /** 2250 * The `dataObject` is an object containing all the information used by Popper.js. 2251 * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks. 2252 * @name dataObject 2253 * @property {Object} data.instance The Popper.js instance 2254 * @property {String} data.placement Placement applied to popper 2255 * @property {String} data.originalPlacement Placement originally defined on init 2256 * @property {Boolean} data.flipped True if popper has been flipped by flip modifier 2257 * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper 2258 * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier 2259 * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`) 2260 * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`) 2261 * @property {Object} data.boundaries Offsets of the popper boundaries 2262 * @property {Object} data.offsets The measurements of popper, reference and arrow elements 2263 * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values 2264 * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values 2265 * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0 2266 */ 2267 2268 /** 2269 * Default options provided to Popper.js constructor.<br /> 2270 * These can be overridden using the `options` argument of Popper.js.<br /> 2271 * To override an option, simply pass an object with the same 2272 * structure of the `options` object, as the 3rd argument. For example: 2273 * ``` 2274 * new Popper(ref, pop, { 2275 * modifiers: { 2276 * preventOverflow: { enabled: false } 2277 * } 2278 * }) 2279 * ``` 2280 * @type {Object} 2281 * @static 2282 * @memberof Popper 2283 */ 2284 var Defaults$1 = { 2285 /** 2286 * Popper's placement. 2287 * @prop {Popper.placements} placement='bottom' 2288 */ 2289 placement: 'bottom', 2290 2291 /** 2292 * Set this to true if you want popper to position it self in 'fixed' mode 2293 * @prop {Boolean} positionFixed=false 2294 */ 2295 positionFixed: false, 2296 2297 /** 2298 * Whether events (resize, scroll) are initially enabled. 2299 * @prop {Boolean} eventsEnabled=true 2300 */ 2301 eventsEnabled: true, 2302 2303 /** 2304 * Set to true if you want to automatically remove the popper when 2305 * you call the `destroy` method. 2306 * @prop {Boolean} removeOnDestroy=false 2307 */ 2308 removeOnDestroy: false, 2309 2310 /** 2311 * Callback called when the popper is created.<br /> 2312 * By default, it is set to no-op.<br /> 2313 * Access Popper.js instance with `data.instance`. 2314 * @prop {onCreate} 2315 */ 2316 onCreate: () => {}, 2317 2318 /** 2319 * Callback called when the popper is updated. This callback is not called 2320 * on the initialization/creation of the popper, but only on subsequent 2321 * updates.<br /> 2322 * By default, it is set to no-op.<br /> 2323 * Access Popper.js instance with `data.instance`. 2324 * @prop {onUpdate} 2325 */ 2326 onUpdate: () => {}, 2327 2328 /** 2329 * List of modifiers used to modify the offsets before they are applied to the popper. 2330 * They provide most of the functionalities of Popper.js. 2331 * @prop {modifiers} 2332 */ 2333 modifiers: modifiers$1 2334 }; 2335 2336 /** 2337 * @callback onCreate 2338 * @param {dataObject} data 2339 */ 2340 2341 /** 2342 * @callback onUpdate 2343 * @param {dataObject} data 2344 */ 2345 2346 // Utils 2347 // Methods 2348 class Popper$2 { 2349 /** 2350 * Creates a new Popper.js instance. 2351 * @class Popper 2352 * @param {Element|referenceObject} reference - The reference element used to position the popper 2353 * @param {Element} popper - The HTML / XML element used as the popper 2354 * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults) 2355 * @return {Object} instance - The generated Popper.js instance 2356 */ 2357 constructor(reference, popper, options = {}) { 2358 this.scheduleUpdate = () => requestAnimationFrame(this.update); 2359 2360 // make update() debounced, so that it only runs at most once-per-tick 2361 this.update = debounce$1(this.update.bind(this)); 2362 2363 // with {} we create a new object with the options inside it 2364 this.options = _extends$1({}, Popper$2.Defaults, options); 2365 2366 // init state 2367 this.state = {
2368 isDestroyed: false, 2369 isCreated: false, 2370 scrollParents: [] 2371 }; 2372 2373 // get reference and popper elements (allow jQuery wrappers) 2374 this.reference = reference && reference.jquery ? reference[0] : reference; 2375 this.popper = popper && popper.jquery ? popper[0] : popper; 2376 2377 // Deep merge modifiers options 2378 this.options.modifiers = {}; 2379 Object.keys(_extends$1({}, Popper$2.Defaults.modifiers, options.modifiers)).forEach(name => { 2380 this.options.modifiers[name] = _extends$1({}, Popper$2.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {}); 2381 }); 2382 2383 // Refactoring modifiers' list (Object => Array) 2384 this.modifiers = Object.keys(this.options.modifiers).map(name => _extends$1({ 2385 name 2386 }, this.options.modifiers[name])) 2387 // sort the modifiers by order 2388 .sort((a, b) => a.order - b.order); 2389 2390 // modifiers have the ability to execute arbitrary code when Popper.js get inited 2391 // such code is executed in the same order of its modifier 2392 // they could add new properties to their options configuration 2393 // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`! 2394 this.modifiers.forEach(modifierOptions => { 2395 if (modifierOptions.enabled && isFunction$1(modifierOptions.onLoad)) { 2396 modifierOptions.onLoad(this.reference, this.popper, this.options, modifierOptions, this.state); 2397 } 2398 }); 2399 2400 // fire the first update to position the popper in the right place 2401 this.update(); 2402 2403 const eventsEnabled = this.options.eventsEnabled; 2404 if (eventsEnabled) { 2405 // setup event listeners, they will take care of update the position in specific situations 2406 this.enableEventListeners(); 2407 } 2408 2409 this.state.eventsEnabled = eventsEnabled; 2410 } 2411 2412 // We can't use class properties because they don't get listed in the 2413 // class prototype and break stuff like Sinon stubs 2414 update() { 2415 return update$1.call(this); 2416 } 2417 destroy() { 2418 return destroy$1.call(this); 2419 } 2420 enableEventListeners() { 2421 return enableEventListeners$1.call(this); 2422 } 2423 disableEventListeners() { 2424 return disableEventListeners$1.call(this); 2425 } 2426 2427 /** 2428 * Schedules an update. It will run on the next UI update available. 2429 * @method scheduleUpdate 2430 * @memberof Popper 2431 */ 2432 2433 2434 /** 2435 * Collection of utilities useful when writing custom modifiers. 2436 * Starting from version 1.7, this method is available only if you 2437 * include `popper-utils.js` before `popper.js`. 2438 * 2439 * **DEPRECATION**: This way to access PopperUtils is deprecated 2440 * and will be removed in v2! Use the PopperUtils module directly instead. 2441 * Due to the high instability of the methods contained in Utils, we can't 2442 * guarantee them to follow semver. Use them at your own risk! 2443 * @static 2444 * @private 2445 * @type {Object} 2446 * @deprecated since version 1.8 2447 * @member Utils 2448 * @memberof Popper 2449 */ 2450 } 2451 2452 /** 2453 * The `referenceObject` is an object that provides an interface compatible with Popper.js 2454 * and lets you use it as replacement of a real DOM node.<br /> 2455 * You can use this method to position a popper relatively to a set of coordinates 2456 * in case you don't have a DOM node to use as reference. 2457 * 2458 * ``` 2459 * new Popper(referenceObject, popperNode); 2460 * ``` 2461 * 2462 * NB: This feature isn't supported in Internet Explorer 10. 2463 * @name referenceObject 2464 * @property {Function} data.getBoundingClientRect 2465 * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method. 2466 * @property {number} data.clientWidth 2467 * An ES6 getter that will return the width of the virtual reference element. 2468 * @property {number} data.clientHeight 2469 * An ES6 getter that will return the height of the virtual reference element. 2470 */ 2471 2472 Popper$2.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils; 2473 Popper$2.placements = placements$1; 2474 Popper$2.Defaults = Defaults$1; 2475 2476 var Popper$3 = Popper$2; 2477 2478 /** 2479 * -------------------------------------------------------------------------- 2480 * Bootstrap (v4.6.0): util.js 2481 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 2482 * -------------------------------------------------------------------------- 2483 */ 2484 2485 /** 2486 * ------------------------------------------------------------------------ 2487 * Private TransitionEnd Helpers 2488 * ------------------------------------------------------------------------ 2489 */ 2490 2491 const TRANSITION_END = 'transitionend'; 2492 const MAX_UID = 1000000; 2493 const MILLISECONDS_MULTIPLIER = 1000; 2494 2495 // Shoutout AngusCroll (https://goo.gl/pxwQGp) 2496 function toType(obj) { 2497 if (obj === null || typeof obj === 'undefined') { 2498 return `${obj}` 2499 } 2500 2501 return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase() 2502 } 2503 2504 function getSpecialTransitionEndEvent() { 2505 return { 2506 bindType: TRANSITION_END, 2507 delegateType: TRANSITION_END, 2508 handle(event) { 2509 if ($__default["default"](event.target).is(this)) { 2510 return event.handleObj.handler.apply(this, arguments) // eslint-disable-line prefer-rest-params 2511 } 2512 2513 return undefined 2514 } 2515 } 2516 } 2517 2518 function transitionEndEmulator(duration) {
2519 let called = false; 2520 2521 $__default["default"](this).one(Util.TRANSITION_END, () => { 2522 called = true; 2523 }); 2524 2525 setTimeout(() => { 2526 if (!called) { 2527 Util.triggerTransitionEnd(this); 2528 } 2529 }, duration); 2530 2531 return this 2532 } 2533 2534 function setTransitionEndSupport() { 2535 $__default["default"].fn.emulateTransitionEnd = transitionEndEmulator; 2536 $__default["default"].event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent(); 2537 } 2538 2539 /** 2540 * -------------------------------------------------------------------------- 2541 * Public Util Api 2542 * -------------------------------------------------------------------------- 2543 */ 2544 2545 const Util = { 2546 TRANSITION_END: 'bsTransitionEnd', 2547 2548 getUID(prefix) { 2549 do { 2550 prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here 2551 } while (document.getElementById(prefix)) 2552 2553 return prefix 2554 }, 2555 2556 getSelectorFromElement(element) { 2557 let selector = element.getAttribute('data-target'); 2558 2559 if (!selector || selector === '#') { 2560 const hrefAttr = element.getAttribute('href'); 2561 selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : ''; 2562 } 2563 2564 try { 2565 return document.querySelector(selector) ? selector : null 2566 } catch (_) { 2567 return null 2568 } 2569 }, 2570 2571 getTransitionDurationFromElement(element) { 2572 if (!element) { 2573 return 0 2574 } 2575 2576 // Get transition-duration of the element 2577 let transitionDuration = $__default["default"](element).css('transition-duration'); 2578 let transitionDelay = $__default["default"](element).css('transition-delay'); 2579 2580 const floatTransitionDuration = parseFloat(transitionDuration); 2581 const floatTransitionDelay = parseFloat(transitionDelay); 2582 2583 // Return 0 if element or transition duration is not found 2584 if (!floatTransitionDuration && !floatTransitionDelay) { 2585 return 0 2586 } 2587 2588 // If multiple durations are defined, take the first 2589 transitionDuration = transitionDuration.split(',')[0]; 2590 transitionDelay = transitionDelay.split(',')[0]; 2591 2592 return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER 2593 }, 2594 2595 reflow(element) { 2596 return element.offsetHeight 2597 }, 2598 2599 triggerTransitionEnd(element) { 2600 $__default["default"](element).trigger(TRANSITION_END); 2601 }, 2602 2603 supportsTransitionEnd() { 2604 return Boolean(TRANSITION_END) 2605 }, 2606 2607 isElement(obj) { 2608 return (obj[0] || obj).nodeType 2609 }, 2610 2611 typeCheckConfig(componentName, config, configTypes) { 2612 for (const property in configTypes) { 2613 if (Object.prototype.hasOwnProperty.call(configTypes, property)) { 2614 const expectedTypes = configTypes[property]; 2615 const value = config[property]; 2616 const valueType = value && Util.isElement(value) ? 2617 'element' : toType(value); 2618 2619 if (!new RegExp(expectedTypes).test(valueType)) { 2620 throw new Error( 2621 `${componentName.toUpperCase()}: ` + 2622 `Option "${property}" provided type "${valueType}" ` + 2623 `but expected type "${expectedTypes}".`) 2624 } 2625 } 2626 } 2627 }, 2628 2629 findShadowRoot(element) { 2630 if (!document.documentElement.attachShadow) { 2631 return null 2632 } 2633 2634 // Can find the shadow root otherwise it'll return the document 2635 if (typeof element.getRootNode === 'function') { 2636 const root = element.getRootNode(); 2637 return root instanceof ShadowRoot ? root : null 2638 } 2639 2640 if (element instanceof ShadowRoot) { 2641 return element 2642 } 2643 2644 // when we don't find a shadow root 2645 if (!element.parentNode) { 2646 return null 2647 } 2648 2649 return Util.findShadowRoot(element.parentNode) 2650 }, 2651 2652 jQueryDetection() { 2653 if (typeof $__default["default"] === 'undefined') { 2654 throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.') 2655 } 2656 2657 const version = $__default["default"].fn.jquery.split(' ')[0].split('.'); 2658 const minMajor = 1; 2659 const ltMajor = 2; 2660 const minMinor = 9; 2661 const minPatch = 1; 2662 const maxMajor = 4; 2663 2664 if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >
2664= maxMajor) { 2665 throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0') 2666 } 2667 } 2668 }; 2669 2670 Util.jQueryDetection(); 2671 setTransitionEndSupport(); 2672 2673 /** 2674 * -------------------------------------------------------------------------- 2675 * Bootstrap (v4.6.0): alert.js 2676 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 2677 * -------------------------------------------------------------------------- 2678 */ 2679 2680 /** 2681 * ------------------------------------------------------------------------ 2682 * Constants 2683 * ------------------------------------------------------------------------ 2684 */ 2685 2686 const NAME$9 = 'alert'; 2687 const VERSION$9 = '4.6.0'; 2688 const DATA_KEY$9 = 'bs.alert'; 2689 const EVENT_KEY$9 = `.${DATA_KEY$9}`; 2690 const DATA_API_KEY$6 = '.data-api'; 2691 const JQUERY_NO_CONFLICT$9 = $__default["default"].fn[NAME$9]; 2692 2693 const SELECTOR_DISMISS = '[data-dismiss="alert"]'; 2694 2695 const EVENT_CLOSE = `close${EVENT_KEY$9}`; 2696 const EVENT_CLOSED = `closed${EVENT_KEY$9}`; 2697 const EVENT_CLICK_DATA_API$5 = `click${EVENT_KEY$9}${DATA_API_KEY$6}`; 2698 2699 const CLASS_NAME_ALERT = 'alert'; 2700 const CLASS_NAME_FADE$5 = 'fade';
2701 const CLASS_NAME_SHOW$6 = 'show'; 2702 2703 /** 2704 * ------------------------------------------------------------------------ 2705 * Class Definition 2706 * ------------------------------------------------------------------------ 2707 */ 2708 2709 class Alert { 2710 constructor(element) { 2711 this._element = element; 2712 } 2713 2714 // Getters 2715 2716 static get VERSION() { 2717 return VERSION$9 2718 } 2719 2720 // Public 2721 2722 close(element) { 2723 let rootElement = this._element; 2724 if (element) { 2725 rootElement = this._getRootElement(element); 2726 } 2727 2728 const customEvent = this._triggerCloseEvent(rootElement); 2729 2730 if (customEvent.isDefaultPrevented()) { 2731 return 2732 } 2733 2734 this._removeElement(rootElement); 2735 } 2736 2737 dispose() { 2738 $__default["default"].removeData(this._element, DATA_KEY$9); 2739 this._element = null; 2740 } 2741 2742 // Private 2743 2744 _getRootElement(element) { 2745 const selector = Util.getSelectorFromElement(element); 2746 let parent = false; 2747 2748 if (selector) { 2749 parent = document.querySelector(selector); 2750 } 2751 2752 if (!parent) { 2753 parent = $__default["default"](element).closest(`.${CLASS_NAME_ALERT}`)[0]; 2754 } 2755 2756 return parent 2757 } 2758 2759 _triggerCloseEvent(element) { 2760 const closeEvent = $__default["default"].Event(EVENT_CLOSE); 2761 2762 $__default["default"](element).trigger(closeEvent); 2763 return closeEvent 2764 } 2765 2766 _removeElement(element) { 2767 $__default["default"](element).removeClass(CLASS_NAME_SHOW$6); 2768 2769 if (!$__default["default"](element).hasClass(CLASS_NAME_FADE$5)) { 2770 this._destroyElement(element); 2771 return 2772 } 2773 2774 const transitionDuration = Util.getTransitionDurationFromElement(element); 2775 2776 $__default["default"](element) 2777 .one(Util.TRANSITION_END, event => this._destroyElement(element, event)) 2778 .emulateTransitionEnd(transitionDuration); 2779 } 2780 2781 _destroyElement(element) { 2782 $__default["default"](element) 2783 .detach() 2784 .trigger(EVENT_CLOSED) 2785 .remove(); 2786 } 2787 2788 // Static 2789 2790 static _jQueryInterface(config) { 2791 return this.each(function () { 2792 const $element = $__default["default"](this); 2793 let data = $element.data(DATA_KEY$9); 2794 2795 if (!data) { 2796 data = new Alert(this); 2797 $element.data(DATA_KEY$9, data); 2798 } 2799 2800 if (config === 'close') { 2801 data[config](this); 2802 } 2803 }) 2804 } 2805 2806 static _handleDismiss(alertInstance) { 2807 return function (event) { 2808 if (event) { 2809 event.preventDefault(); 2810 } 2811 2812 alertInstance.close(this); 2813 } 2814 } 2815 } 2816 2817 /** 2818 * ------------------------------------------------------------------------ 2819 * Data Api implementation 2820 * ------------------------------------------------------------------------ 2821 */ 2822 2823 $__default["default"](document).on( 2824 EVENT_CLICK_DATA_API$5, 2825 SELECTOR_DISMISS, 2826 Alert._handleDismiss(new Alert()) 2827 ); 2828 2829 /** 2830 * ------------------------------------------------------------------------ 2831 * jQuery 2832 * ------------------------------------------------------------------------ 2833 */ 2834 2835 $__default["default"].fn[NAME$9] = Alert._jQueryInterface; 2836 $__default["default"].fn[NAME$9].Constructor = Alert; 2837 $__default["default"].fn[NAME$9].noConflict = () => { 2838 $__default["default"].fn[NAME$9] = JQUERY_NO_CONFLICT$9; 2839 return Alert._jQueryInterface 2840 }; 2841 2842 /** 2843 * -------------------------------------------------------------------------- 2844 * Bootstrap (v4.6.0): button.js 2845 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 2846 * -------------------------------------------------------------------------- 2847 */ 2848 2849 /** 2850 * ------------------------------------------------------------------------ 2851 * Constants 2852 * ------------------------------------------------------------------------ 2853 */ 2854 2855 const NAME$8 = 'button'; 2856 const VERSION$8 = '4.6.0'; 2857 const DATA_KEY$8 = 'bs.button'; 2858 const EVENT_KEY$8 = `.${DATA_KEY$8}`; 2859 const DATA_API_KEY$5 = '.data-api'; 2860 const JQUERY_NO_CONFLICT$8 = $__default["default"].fn[NAME$8]; 2861 2862 const CLASS_NAME_ACTIVE$3 = 'active'; 2863 const CLASS_NAME_BUTTON = 'btn'; 2864 const CLASS_NAME_FOCUS = 'focus'; 2865 2866 const SELECTOR_DATA_TOGGLE_CARROT = '[data-toggle^="button"]'; 2867 const SELECTOR_DATA_TOGGLES = '[data-toggle="buttons"]'; 2868 const SELECTOR_DATA_TOGGLE$3 = '[data-toggle="button"]'; 2869 const SELECTOR_DATA_TOGGLES_BUTTONS = '[data-toggle="buttons"] .btn'; 2870 const SELECTOR_INPUT = 'input:not([type="hidden"])'; 2871 const SELECTOR_ACTIVE$2 = '.active'; 2872 const SELECTOR_BUTTON = '.btn'; 2873 2874 const EVENT_CLICK_DATA_API$4 = `click${EVENT_KEY$8}${DATA_API_KEY$5}`; 2875 const EVENT_FOCUS_BLUR_DATA_API = `focus${EVENT_KEY$8}${DATA_API_KEY$5} ` + 2876 `blur${EVENT_KEY$8}${DATA_API_KEY$5}`; 2877 const EVENT_LOAD_DATA_API$2 = `load${EVENT_KEY$8}${DATA_API_KEY$5}`; 2878 2879 /** 2880 * ------------------------------------------------------------------------ 2881 * Class Definition 2882 * ------------------------------------------------------------------------ 2883 */ 2884 2885 class Button { 2886 constructor(element) { 2887 this._element = element; 2888 this.shouldAvoidTriggerChange = false;
2889 } 2890 2891 // Getters 2892 2893 static get VERSION() { 2894 return VERSION$8 2895 } 2896 2897 // Public 2898 2899 toggle() { 2900 let triggerChangeEvent = true; 2901 let addAriaPressed = true; 2902 const rootElement = $__default["default"](this._element).closest(SELECTOR_DATA_TOGGLES)[0]; 2903 2904 if (rootElement) { 2905 const input = this._element.querySelector(SELECTOR_INPUT); 2906 2907 if (input) { 2908 if (input.type === 'radio') { 2909 if (input.checked && this._element.classList.contains(CLASS_NAME_ACTIVE$3)) { 2910 triggerChangeEvent = false; 2911 } else { 2912 const activeElement = rootElement.querySelector(SELECTOR_ACTIVE$2); 2913 2914 if (activeElement) { 2915 $__default["default"](activeElement).removeClass(CLASS_NAME_ACTIVE$3); 2916 } 2917 } 2918 } 2919 2920 if (triggerChangeEvent) { 2921 // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input 2922 if (input.type === 'checkbox' || input.type === 'radio') { 2923 input.checked = !this._element.classList.contains(CLASS_NAME_ACTIVE$3); 2924 } 2925 2926 if (!this.shouldAvoidTriggerChange) { 2927 $__default["default"](input).trigger('change'); 2928 } 2929 } 2930 2931 input.focus(); 2932 addAriaPressed = false; 2933 } 2934 } 2935 2936 if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) { 2937 if (addAriaPressed) { 2938 this._element.setAttribute('aria-pressed', !this._element.classList.contains(CLASS_NAME_ACTIVE$3)); 2939 } 2940 2941 if (triggerChangeEvent) { 2942 $__default["default"](this._element).toggleClass(CLASS_NAME_ACTIVE$3); 2943 } 2944 } 2945 } 2946 2947 dispose() { 2948 $__default["default"].removeData(this._element, DATA_KEY$8); 2949 this._element = null; 2950 } 2951 2952 // Static 2953 2954 static _jQueryInterface(config, avoidTriggerChange) { 2955 return this.each(function () { 2956 const $element = $__default["default"](this); 2957 let data = $element.data(DATA_KEY$8); 2958 2959 if (!data) { 2960 data = new Button(this); 2961 $element.data(DATA_KEY$8, data); 2962 } 2963 2964 data.shouldAvoidTriggerChange = avoidTriggerChange; 2965 2966 if (config === 'toggle') { 2967 data[config](); 2968 } 2969 }) 2970 } 2971 } 2972 2973 /** 2974 * ------------------------------------------------------------------------ 2975 * Data Api implementation 2976 * ------------------------------------------------------------------------ 2977 */ 2978 2979 $__default["default"](document) 2980 .on(EVENT_CLICK_DATA_API$4, SELECTOR_DATA_TOGGLE_CARROT, event => { 2981 let button = event.target; 2982 const initialButton = button; 2983 2984 if (!$__default["default"](button).hasClass(CLASS_NAME_BUTTON)) { 2985 button = $__default["default"](button).closest(SELECTOR_BUTTON)[0]; 2986 } 2987 2988 if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) { 2989 event.preventDefault(); // work around Firefox bug #1540995 2990 } else { 2991 const inputBtn = button.querySelector(SELECTOR_INPUT); 2992 2993 if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) { 2994 event.preventDefault(); // work around Firefox bug #1540995 2995 return 2996 } 2997 2998 if (initialButton.tagName === 'INPUT' || button.tagName !== 'LABEL') { 2999 Button._jQueryInterface.call($__default["default"](button), 'toggle', initialButton.tagName === 'INPUT'); 3000 } 3001 } 3002 }) 3003 .on(EVENT_FOCUS_BLUR_DATA_API, SELECTOR_DATA_TOGGLE_CARROT, event => { 3004 const button = $__default["default"](event.target).closest(SELECTOR_BUTTON)[0]; 3005 $__default["default"](button).toggleClass(CLASS_NAME_FOCUS, /^focus(in)?$/.test(event.type)); 3006 }); 3007 3008 $__default["default"](window).on(EVENT_LOAD_DATA_API$2, () => { 3009 // ensure correct active class is set to match the controls' actual values/states 3010 3011 // find all checkboxes/readio buttons inside data-toggle groups 3012 let buttons = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLES_BUTTONS)); 3013 for (let i = 0, len = buttons.length; i < len; i++) { 3014 const button = buttons[i]; 3015 const input = button.querySelector(SELECTOR_INPUT); 3016 if (input.checked || input.hasAttribute('checked')) { 3017 button.classList.add(CLASS_NAME_ACTIVE$3); 3018 } else { 3019 button.classList.remove(CLASS_NAME_ACTIVE$3); 3020 } 3021 } 3022 3023 // find all button toggles 3024 buttons = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLE$3)); 3025 for (let i = 0, len = buttons.length; i < len; i++) { 3026 const button = buttons[i]; 3027 if (button.getAttribute('aria-pressed') === 'true') { 3028 button.classList.add(CLASS_NAME_ACTIVE$3); 3029 } else { 3030 button.classList.remove(CLASS_NAME_ACTIVE$3); 3031 } 3032 } 3033 }); 3034 3035 /** 3036 * ------------------------------------------------------------------------ 3037 * jQuery 3038 * ------------------------------------------------------------------------ 3039 */ 3040 3041 $__default["default"].fn[NAME$8] = Button._jQueryInterface; 3042 $__default["default"].fn[NAME$8].Constructor = Button; 3043 $__default["default"].fn[NAME$8].noConflict = () => { 3044 $__default["default"].fn[NAME$8] = JQUERY_NO_CONFLICT$8; 3045 return Button._jQueryInterface 3046 }; 3047 3048 /** 3049 * -------------------------------------------------------------------------- 3050 * Bootstrap (v4.6.0): carousel.js 3051 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 3052 * -------------------------------------------------------------------------- 3053 */ 3054 3055 /** 3056 * ------------------------------------------------------------------------ 3057 * Constants 3058 * ------------------------------------------------------------------------ 3059 */ 3060 3061 const NAME$7 = 'carousel'; 3062 const VERSION$7 = '4.6.0'; 3063 const DATA_KEY$7 = 'bs.carousel'; 3064 const EVENT_KEY$7 = `.${DATA_KEY$7}`; 3065 const DATA_API_KEY$4 = '.data-api'; 3066 const JQUERY_NO_CONFLICT$7 = $__default["default"].fn[NAME$7]; 3067 const ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key 3068 const ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key 3069 const TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch 3070 const SWIPE_THRESHOLD = 40; 3071 3072 const Default$6 = { 3073 interval: 5000, 3074 keyboard: true, 3075 slide: false, 3076 pause: 'hover', 3077 wrap: true, 3078 touch: true 3079 }; 3080 3081 const DefaultType$6 = { 3082 interval: '(number|boolean)', 3083 keyboard: 'boolean', 3084 slide: '(boolean|string)', 3085 pause: '(string|boolean)', 3086 wrap: 'boolean', 3087 touch: 'boolean' 3088 }; 3089 3090 const DIRECTION_NEXT = 'next'; 3091 const DIRECTION_PREV = 'prev'; 3092 const DIRECTION_LEFT = 'left'; 3093 const DIRECTION_RIGHT = 'right'; 3094 3095 const EVENT_SLIDE = `slide${EVENT_KEY$7}`; 3096 const EVENT_SLID = `slid${EVENT_KEY$7}`; 3097 const EVENT_KEYDOWN = `keydown${EVENT_KEY$7}`; 3098 const EVENT_MOUSEENTER = `mouseenter${EVENT_KEY$7}`; 3099 const EVENT_MOUSELEAVE = `mouseleave${EVENT_KEY$7}`; 3100 const EVENT_TOUCHSTART = `touchstart${EVENT_KEY$7}`; 3101 const EVENT_TOUCHMOVE = `touchmove${EVENT_KEY$7}`; 3102 const EVENT_TOUCHEND = `touchend${EVENT_KEY$7}`; 3103 const EVENT_POINTERDOWN = `pointerdown${EVENT_KEY$7}`; 3104 const EVENT_POINTERUP = `pointerup${EVENT_KEY$7}`; 3105 const EVENT_DRAG_START = `dragstart${EVENT_KEY$7}`; 3106 const EVENT_LOAD_DATA_API$1 = `load${EVENT_KEY$7}${DATA_API_KEY$4}`; 3107 const EVENT_CLICK_DATA_API$3 = `click${EVENT_KEY$7}${DATA_API_KEY$4}`; 3108 3109 const CLASS_NAME_CAROUSEL = 'carousel'; 3110 const CLASS_NAME_ACTIVE$2 = 'active'; 3111 const CLASS_NAME_SLIDE = 'slide'; 3112 const CLASS_NAME_RIGHT = 'carousel-item-right'; 3113 const CLASS_NAME_LEFT = 'carousel-item-left'; 3114 const CLASS_NAME_NEXT = 'carousel-item-next'; 3115 const CLASS_NAME_PREV = 'carousel-item-prev'; 3116 const CLASS_NAME_POINTER_EVENT = 'pointer-event'; 3117 3118 const SELECTOR_ACTIVE$1 = '.active'; 3119 const SELECTOR_ACTIVE_ITEM = '.active.carousel-item';
3120 const SELECTOR_ITEM = '.carousel-item'; 3121 const SELECTOR_ITEM_IMG = '.carousel-item img'; 3122 const SELECTOR_NEXT_PREV = '.carousel-item-next, .carousel-item-prev'; 3123 const SELECTOR_INDICATORS = '.carousel-indicators'; 3124 const SELECTOR_DATA_SLIDE = '[data-slide], [data-slide-to]'; 3125 const SELECTOR_DATA_RIDE = '[data-ride="carousel"]'; 3126 3127 const PointerType = { 3128 TOUCH: 'touch', 3129 PEN: 'pen' 3130 }; 3131 3132 /** 3133 * ------------------------------------------------------------------------ 3134 * Class Definition 3135 * ------------------------------------------------------------------------ 3136 */ 3137 class Carousel { 3138 constructor(element, config) { 3139 this._items = null; 3140 this._interval = null; 3141 this._activeElement = null; 3142 this._isPaused = false; 3143 this._isSliding = false; 3144 this.touchTimeout = null; 3145 this.touchStartX = 0; 3146 this.touchDeltaX = 0; 3147 3148 this._config = this._getConfig(config); 3149 this._element = element; 3150 this._indicatorsElement = this._element.querySelector(SELECTOR_INDICATORS); 3151 this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0; 3152 this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent); 3153 3154 this._addEventListeners(); 3155 } 3156 3157 // Getters 3158 3159 static get VERSION() { 3160 return VERSION$7 3161 } 3162 3163 static get Default() { 3164 return Default$6 3165 } 3166 3167 // Public 3168 3169 next() { 3170 if (!this._isSliding) { 3171 this._slide(DIRECTION_NEXT); 3172 } 3173 } 3174 3175 nextWhenVisible() { 3176 const $element = $__default["default"](this._element); 3177 // Don't call next when the page isn't visible 3178 // or the carousel or its parent isn't visible 3179 if (!document.hidden && 3180 ($element.is(':visible') && $element.css('visibility') !== 'hidden')) { 3181 this.next(); 3182 } 3183 } 3184 3185 prev() { 3186 if (!this._isSliding) { 3187 this._slide(DIRECTION_PREV); 3188 } 3189 } 3190 3191 pause(event) { 3192 if (!event) { 3193 this._isPaused = true; 3194 } 3195 3196 if (this._element.querySelector(SELECTOR_NEXT_PREV)) { 3197 Util.triggerTransitionEnd(this._element); 3198 this.cycle(true); 3199 } 3200 3201 clearInterval(this._interval); 3202 this._interval = null; 3203 } 3204 3205 cycle(event) { 3206 if (!event) { 3207 this._isPaused = false; 3208 } 3209 3210 if (this._interval) { 3211 clearInterval(this._interval); 3212 this._interval = null; 3213 } 3214 3215 if (this._config.interval && !this._isPaused) { 3216 this._updateInterval(); 3217 3218 this._interval = setInterval( 3219 (document.visibilityState ? this.nextWhenVisible : this.next).bind(this), 3220 this._config.interval 3221 ); 3222 } 3223 } 3224 3225 to(index) { 3226 this._activeElement = this._element.querySelector(SELECTOR_ACTIVE_ITEM); 3227 3228 const activeIndex = this._getItemIndex(this._activeElement); 3229 3230 if (index > this._items.length - 1 || index < 0) { 3231 return 3232 } 3233 3234 if (this._isSliding) { 3235 $__default["default"](this._element).one(EVENT_SLID, () => this.to(index)); 3236 return 3237 } 3238 3239 if (activeIndex === index) { 3240 this.pause(); 3241 this.cycle(); 3242 return 3243 } 3244 3245 const direction = index > activeIndex ? 3246 DIRECTION_NEXT : 3247 DIRECTION_PREV; 3248 3249 this._slide(direction, this._items[index]); 3250 } 3251 3252 dispose() { 3253 $__default["default"](this._element).off(EVENT_KEY$7); 3254 $__default["default"].removeData(this._element, DATA_KEY$7); 3255 3256 this._items = null; 3257 this._config = null; 3258 this._element = null; 3259 this._interval = null; 3260 this._isPaused = null; 3261 this._isSliding = null; 3262 this._activeElement = null; 3263 this._indicatorsElement = null; 3264 } 3265 3266 // Private 3267 3268 _getConfig(config) { 3269 config = { 3270 ...Default$6, 3271 ...config 3272 }; 3273 Util.typeCheckConfig(NAME$7, config, DefaultType$6); 3274 return config 3275 } 3276 3277 _handleSwipe() { 3278 const absDeltax = Math.abs(this.touchDeltaX); 3279 3280 if (absDeltax <= SWIPE_THRESHOLD) { 3281 return 3282 } 3283 3284 const direction = absDeltax / this.touchDeltaX; 3285 3286 this.touchDeltaX = 0; 3287 3288 // swipe left 3289 if (direction > 0) { 3290 this.prev(); 3291 } 3292 3293 // swipe right 3294 if (direction < 0) { 3295 this.next(); 3296 } 3297 } 3298 3299 _addEventListeners() { 3300 if (this._config.keyboard) { 3301 $__default["default"](this._element).on(EVENT_KEYDOWN, event =>
3301 this._keydown(event)); 3302 } 3303 3304 if (this._config.pause === 'hover') { 3305 $__default["default"](this._element) 3306 .on(EVENT_MOUSEENTER, event => this.pause(event)) 3307 .on(EVENT_MOUSELEAVE, event => this.cycle(event)); 3308 } 3309 3310 if (this._config.touch) { 3311 this._addTouchEventListeners(); 3312 } 3313 } 3314 3315 _addTouchEventListeners() { 3316 if (!this._touchSupported) { 3317 return 3318 } 3319 3320 const start = event => { 3321 if (this._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) { 3322 this.touchStartX = event.originalEvent.clientX; 3323 } else if (!this._pointerEvent) { 3324 this.touchStartX = event.originalEvent.touches[0].clientX; 3325 } 3326 }; 3327 3328 const move = event => { 3329 // ensure swiping with one touch and not pinching 3330 if (event.originalEvent.touches && event.originalEvent.touches.length > 1) { 3331 this.touchDeltaX = 0; 3332 } else { 3333 this.touchDeltaX = event.originalEvent.touches[0].clientX - this.touchStartX; 3334 } 3335 }; 3336 3337 const end = event => { 3338 if (this._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) { 3339 this.touchDeltaX = event.originalEvent.clientX - this.touchStartX; 3340 } 3341 3342 this._handleSwipe(); 3343 if (this._config.pause === 'hover') { 3344 // If it's a touch-enabled device, mouseenter/leave are fired as 3345 // part of the mouse compatibility events on first tap - the carousel 3346 // would stop cycling until user tapped out of it; 3347 // here, we listen for touchend, explicitly pause the carousel 3348 // (as if it's the second time we tap on it, mouseenter compat event 3349 // is NOT fired) and after a timeout (to allow for mouse compatibility 3350 // events to fire) we explicitly restart cycling 3351 3352 this.pause(); 3353 if (this.touchTimeout) { 3354 clearTimeout(this.touchTimeout); 3355 } 3356 3357 this.touchTimeout = setTimeout(event => this.cycle(event), TOUCHEVENT_COMPAT_WAIT + this._config.interval); 3358 } 3359 }; 3360 3361 $__default["default"](this._element.querySelectorAll(SELECTOR_ITEM_IMG)) 3362 .on(EVENT_DRAG_START, e => e.preventDefault()); 3363 3364 if (this._pointerEvent) { 3365 $__default["default"](this._element).on(EVENT_POINTERDOWN, event => start(event)); 3366 $__default["default"](this._element).on(EVENT_POINTERUP, event => end(event)); 3367 3368 this._element.classList.add(CLASS_NAME_POINTER_EVENT); 3369 } else { 3370 $__default["default"](this._element).on(EVENT_TOUCHSTART, event => start(event)); 3371 $__default["default"](this._element).on(EVENT_TOUCHMOVE, event => move(event)); 3372 $__default["default"](this._element).on(EVENT_TOUCHEND, event => end(event)); 3373 } 3374 } 3375 3376 _keydown(event) { 3377 if (/input|textarea/i.test(event.target.tagName)) { 3378 return 3379 } 3380 3381 switch (event.which) { 3382 case ARROW_LEFT_KEYCODE: 3383 event.preventDefault(); 3384 this.prev(); 3385 break 3386 case ARROW_RIGHT_KEYCODE: 3387 event.preventDefault(); 3388 this.next(); 3389 break 3390 } 3391 } 3392 3393 _getItemIndex(element) { 3394 this._items = element && element.parentNode ? 3395 [].slice.call(element.parentNode.querySelectorAll(SELECTOR_ITEM)) : 3396 []; 3397 return this._items.indexOf(element) 3398 } 3399 3400 _getItemByDirection(direction, activeElement) { 3401 const isNextDirection = direction === DIRECTION_NEXT; 3402 const isPrevDirection = direction === DIRECTION_PREV; 3403 const activeIndex = this._getItemIndex(activeElement); 3404 const lastItemIndex = this._items.length - 1; 3405 const isGoingToWrap = isPrevDirection && activeIndex === 0 || 3406 isNextDirection && activeIndex === lastItemIndex; 3407 3408 if (isGoingToWrap && !this._config.wrap) { 3409 return activeElement 3410 } 3411 3412 const delta = direction === DIRECTION_PREV ? -1 : 1; 3413 const itemIndex = (activeIndex + delta) % this._items.length; 3414 3415 return itemIndex === -1 ? 3416 this._items[this._items.length - 1] : this._items[itemIndex] 3417 } 3418 3419 _triggerSlideEvent(relatedTarget, eventDirectionName) { 3420 const targetIndex = this._getItemIndex(relatedTarget); 3421 const fromIndex = this._getItemIndex(this._element.querySelector(SELECTOR_ACTIVE_ITEM)); 3422 const slideEvent = $__default["default"].Event(EVENT_SLIDE, { 3423 relatedTarget, 3424 direction: eventDirectionName, 3425 from: fromIndex, 3426 to: targetIndex 3427 }); 3428 3429 $__default["default"](this._element).trigger(slideEvent); 3430 3431 return slideEvent 3432 } 3433
3434 _setActiveIndicatorElement(element) { 3435 if (this._indicatorsElement) { 3436 const indicators = [].slice.call(this._indicatorsElement.querySelectorAll(SELECTOR_ACTIVE$1)); 3437 $__default["default"](indicators).removeClass(CLASS_NAME_ACTIVE$2); 3438 3439 const nextIndicator = this._indicatorsElement.children[ 3440 this._getItemIndex(element) 3441 ]; 3442 3443 if (nextIndicator) { 3444 $__default["default"](nextIndicator).addClass(CLASS_NAME_ACTIVE$2); 3445 } 3446 } 3447 } 3448 3449 _updateInterval() { 3450 const element = this._activeElement || this._element.querySelector(SELECTOR_ACTIVE_ITEM); 3451 3452 if (!element) { 3453 return 3454 } 3455 3456 const elementInterval = parseInt(element.getAttribute('data-interval'), 10); 3457 3458 if (elementInterval) { 3459 this._config.defaultInterval = this._config.defaultInterval || this._config.interval; 3460 this._config.interval = elementInterval; 3461 } else { 3462 this._config.interval = this._config.defaultInterval || this._config.interval; 3463 } 3464 } 3465 3466 _slide(direction, element) { 3467 const activeElement = this._element.querySelector(SELECTOR_ACTIVE_ITEM); 3468 const activeElementIndex = this._getItemIndex(activeElement); 3469 const nextElement = element || activeElement && 3470 this._getItemByDirection(direction, activeElement); 3471 const nextElementIndex = this._getItemIndex(nextElement); 3472 const isCycling = Boolean(this._interval); 3473 3474 let directionalClassName; 3475 let orderClassName; 3476 let eventDirectionName; 3477 3478 if (direction === DIRECTION_NEXT) { 3479 directionalClassName = CLASS_NAME_LEFT; 3480 orderClassName = CLASS_NAME_NEXT; 3481 eventDirectionName = DIRECTION_LEFT; 3482 } else { 3483 directionalClassName = CLASS_NAME_RIGHT; 3484 orderClassName = CLASS_NAME_PREV; 3485 eventDirectionName = DIRECTION_RIGHT; 3486 } 3487 3488 if (nextElement && $__default["default"](nextElement).hasClass(CLASS_NAME_ACTIVE$2)) { 3489 this._isSliding = false; 3490 return 3491 } 3492 3493 const slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName); 3494 if (slideEvent.isDefaultPrevented()) { 3495 return 3496 } 3497 3498 if (!activeElement || !nextElement) { 3499 // Some weirdness is happening, so we bail 3500 return 3501 } 3502 3503 this._isSliding = true; 3504 3505 if (isCycling) { 3506 this.pause(); 3507 } 3508 3509 this._setActiveIndicatorElement(nextElement); 3510 this._activeElement = nextElement; 3511 3512 const slidEvent = $__default["default"].Event(EVENT_SLID, { 3513 relatedTarget: nextElement, 3514 direction: eventDirectionName, 3515 from: activeElementIndex, 3516 to: nextElementIndex 3517 }); 3518 3519 if ($__default["default"](this._element).hasClass(CLASS_NAME_SLIDE)) { 3520 $__default["default"](nextElement).addClass(orderClassName); 3521 3522 Util.reflow(nextElement); 3523 3524 $__default["default"](activeElement).addClass(directionalClassName); 3525 $__default["default"](nextElement).addClass(directionalClassName); 3526 3527 const transitionDuration = Util.getTransitionDurationFromElement(activeElement); 3528 3529 $__default["default"](activeElement) 3530 .one(Util.TRANSITION_END, () => { 3531 $__default["default"](nextElement) 3532 .removeClass(`${directionalClassName} ${orderClassName}`) 3533 .addClass(CLASS_NAME_ACTIVE$2); 3534 3535 $__default["default"](activeElement).removeClass(`${CLASS_NAME_ACTIVE$2} ${orderClassName} ${directionalClassName}`); 3536 3537 this._isSliding = false; 3538 3539 setTimeout(() => $__default["default"](this._element).trigger(slidEvent), 0); 3540 }) 3541 .emulateTransitionEnd(transitionDuration); 3542 } else { 3543 $__default["default"](activeElement).removeClass(CLASS_NAME_ACTIVE$2); 3544 $__default["default"](nextElement).addClass(CLASS_NAME_ACTIVE$2); 3545 3546 this._isSliding = false; 3547 $__default["default"](this._element).trigger(slidEvent); 3548 } 3549 3550 if (isCycling) { 3551 this.cycle(); 3552 } 3553 } 3554 3555 // Static 3556 3557 static _jQueryInterface(config) { 3558 return this.each(function () { 3559 let data = $__default["default"](this).data(DATA_KEY$7); 3560 let _config = { 3561 ...Default$6, 3562 ...$__default["default"](this).data() 3563 }; 3564 3565 if (typeof config === 'object') { 3566 _config = { 3567 ..._config, 3568 ...config 3569 }; 3570 } 3571 3572 const action = typeof config === 'string' ? config : _config.slide; 3573 3574 if (!data) { 3575 data = new Carousel(this, _config); 3576 $__default["default"](this).data(DATA_KEY$7, data); 3577 } 3578 3579 if (typeof config === 'number') { 3580 data.to(config); 3581 } else if (typeof action === 'string') { 3582 if (typeof data[action] === 'undefined') {
3583 throw new TypeError(`No method named "${action}"`) 3584 } 3585 3586 data[action](); 3587 } else if (_config.interval && _config.ride) { 3588 data.pause(); 3589 data.cycle(); 3590 } 3591 }) 3592 } 3593 3594 static _dataApiClickHandler(event) { 3595 const selector = Util.getSelectorFromElement(this); 3596 3597 if (!selector) { 3598 return 3599 } 3600 3601 const target = $__default["default"](selector)[0]; 3602 3603 if (!target || !$__default["default"](target).hasClass(CLASS_NAME_CAROUSEL)) { 3604 return 3605 } 3606 3607 const config = { 3608 ...$__default["default"](target).data(), 3609 ...$__default["default"](this).data() 3610 }; 3611 const slideIndex = this.getAttribute('data-slide-to'); 3612 3613 if (slideIndex) { 3614 config.interval = false; 3615 } 3616 3617 Carousel._jQueryInterface.call($__default["default"](target), config); 3618 3619 if (slideIndex) { 3620 $__default["default"](target).data(DATA_KEY$7).to(slideIndex); 3621 } 3622 3623 event.preventDefault(); 3624 } 3625 } 3626 3627 /** 3628 * ------------------------------------------------------------------------ 3629 * Data Api implementation 3630 * ------------------------------------------------------------------------ 3631 */ 3632 3633 $__default["default"](document).on(EVENT_CLICK_DATA_API$3, SELECTOR_DATA_SLIDE, Carousel._dataApiClickHandler); 3634 3635 $__default["default"](window).on(EVENT_LOAD_DATA_API$1, () => { 3636 const carousels = [].slice.call(document.querySelectorAll(SELECTOR_DATA_RIDE)); 3637 for (let i = 0, len = carousels.length; i < len; i++) { 3638 const $carousel = $__default["default"](carousels[i]); 3639 Carousel._jQueryInterface.call($carousel, $carousel.data()); 3640 } 3641 }); 3642 3643 /** 3644 * ------------------------------------------------------------------------ 3645 * jQuery 3646 * ------------------------------------------------------------------------ 3647 */ 3648 3649 $__default["default"].fn[NAME$7] = Carousel._jQueryInterface; 3650 $__default["default"].fn[NAME$7].Constructor = Carousel; 3651 $__default["default"].fn[NAME$7].noConflict = () => { 3652 $__default["default"].fn[NAME$7] = JQUERY_NO_CONFLICT$7; 3653 return Carousel._jQueryInterface 3654 }; 3655 3656 /** 3657 * -------------------------------------------------------------------------- 3658 * Bootstrap (v4.6.0): collapse.js 3659 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 3660 * -------------------------------------------------------------------------- 3661 */ 3662 3663 /** 3664 * ------------------------------------------------------------------------ 3665 * Constants 3666 * ------------------------------------------------------------------------ 3667 */ 3668 3669 const NAME$6 = 'collapse'; 3670 const VERSION$6 = '4.6.0'; 3671 const DATA_KEY$6 = 'bs.collapse'; 3672 const EVENT_KEY$6 = `.${DATA_KEY$6}`; 3673 const DATA_API_KEY$3 = '.data-api'; 3674 const JQUERY_NO_CONFLICT$6 = $__default["default"].fn[NAME$6]; 3675 3676 const Default$5 = { 3677 toggle: true, 3678 parent: '' 3679 }; 3680 3681 const DefaultType$5 = { 3682 toggle: 'boolean', 3683 parent: '(string|element)' 3684 }; 3685 3686 const EVENT_SHOW$3 = `show${EVENT_KEY$6}`; 3687 const EVENT_SHOWN$3 = `shown${EVENT_KEY$6}`; 3688 const EVENT_HIDE$3 = `hide${EVENT_KEY$6}`; 3689 const EVENT_HIDDEN$3 = `hidden${EVENT_KEY$6}`; 3690 const EVENT_CLICK_DATA_API$2 = `click${EVENT_KEY$6}${DATA_API_KEY$3}`; 3691 3692 const CLASS_NAME_SHOW$5 = 'show'; 3693 const CLASS_NAME_COLLAPSE = 'collapse'; 3694 const CLASS_NAME_COLLAPSING = 'collapsing'; 3695 const CLASS_NAME_COLLAPSED = 'collapsed'; 3696 3697 const DIMENSION_WIDTH = 'width'; 3698 const DIMENSION_HEIGHT = 'height'; 3699 3700 const SELECTOR_ACTIVES = '.show, .collapsing'; 3701 const SELECTOR_DATA_TOGGLE$2 = '[data-toggle="collapse"]'; 3702 3703 /** 3704 * ------------------------------------------------------------------------ 3705 * Class Definition 3706 * ------------------------------------------------------------------------ 3707 */ 3708 3709 class Collapse { 3710 constructor(element, config) { 3711 this._isTransitioning = false; 3712 this._element = element; 3713 this._config = this._getConfig(config); 3714 this._triggerArray = [].slice.call(document.querySelectorAll(
3715 `[data-toggle="collapse"][href="#${element.id}"],` + 3716 `[data-toggle="collapse"][data-target="#${element.id}"]` 3717 )); 3718 3719 const toggleList = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLE$2)); 3720 for (let i = 0, len = toggleList.length; i < len; i++) { 3721 const elem = toggleList[i]; 3722 const selector = Util.getSelectorFromElement(elem); 3723 const filterElement = [].slice.call(document.querySelectorAll(selector)) 3724 .filter(foundElem => foundElem === element); 3725 3726 if (selector !== null && filterElement.length > 0) { 3727 this._selector = selector; 3728 this._triggerArray.push(elem); 3729 } 3730 } 3731 3732 this._parent = this._config.parent ? this._getParent() : null; 3733 3734 if (!this._config.parent) { 3735 this._addAriaAndCollapsedClass(this._element, this._triggerArray); 3736 } 3737 3738 if (this._config.toggle) { 3739 this.toggle(); 3740 } 3741 } 3742 3743 // Getters 3744 3745 static get VERSION() { 3746 return VERSION$6 3747 } 3748 3749 static get Default() { 3750 return Default$5 3751 } 3752 3753 // Public 3754 3755 toggle() { 3756 if ($__default["default"](this._element).hasClass(CLASS_NAME_SHOW$5)) { 3757 this.hide(); 3758 } else { 3759 this.show(); 3760 } 3761 } 3762 3763 show() { 3764 if (this._isTransitioning || 3765 $__default["default"](this._element).hasClass(CLASS_NAME_SHOW$5)) { 3766 return 3767 } 3768 3769 let actives; 3770 let activesData; 3771 3772 if (this._parent) { 3773 actives = [].slice.call(this._parent.querySelectorAll(SELECTOR_ACTIVES)) 3774 .filter(elem => { 3775 if (typeof this._config.parent === 'string') { 3776 return elem.getAttribute('data-parent') === this._config.parent 3777 } 3778 3779 return elem.classList.contains(CLASS_NAME_COLLAPSE) 3780 }); 3781 3782 if (actives.length === 0) { 3783 actives = null; 3784 } 3785 } 3786 3787 if (actives) { 3788 activesData = $__default["default"](actives).not(this._selector).data(DATA_KEY$6); 3789 if (activesData && activesData._isTransitioning) { 3790 return 3791 } 3792 } 3793 3794 const startEvent = $__default["default"].Event(EVENT_SHOW$3); 3795 $__default["default"](this._element).trigger(startEvent); 3796 if (startEvent.isDefaultPrevented()) { 3797 return 3798 } 3799 3800 if (actives) { 3801 Collapse._jQueryInterface.call($__default["default"](actives).not(this._selector), 'hide'); 3802 if (!activesData) { 3803 $__default["default"](actives).data(DATA_KEY$6, null); 3804 } 3805 } 3806 3807 const dimension = this._getDimension(); 3808 3809 $__default["default"](this._element) 3810 .removeClass(CLASS_NAME_COLLAPSE) 3811 .addClass(CLASS_NAME_COLLAPSING); 3812 3813 this._element.style[dimension] = 0; 3814 3815 if (this._triggerArray.length) { 3816 $__default["default"](this._triggerArray) 3817 .removeClass(CLASS_NAME_COLLAPSED) 3818 .attr('aria-expanded', true); 3819 } 3820 3821 this.setTransitioning(true); 3822 3823 const complete = () => { 3824 $__default["default"](this._element) 3825 .removeClass(CLASS_NAME_COLLAPSING) 3826 .addClass(`${CLASS_NAME_COLLAPSE} ${CLASS_NAME_SHOW$5}`); 3827 3828 this._element.style[dimension] = ''; 3829 3830 this.setTransitioning(false); 3831 3832 $__default["default"](this._element).trigger(EVENT_SHOWN$3); 3833 }; 3834 3835 const capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1); 3836 const scrollSize = `scroll${capitalizedDimension}`; 3837 const transitionDuration = Util.getTransitionDurationFromElement(this._element); 3838 3839 $__default["default"](this._element) 3840 .one(Util.TRANSITION_END, complete) 3841 .emulateTransitionEnd(transitionDuration); 3842 3843 this._element.style[dimension] = `${this._element[scrollSize]}px`; 3844 } 3845 3846 hide() { 3847 if (this._isTransitioning || 3848 !$__default["default"](this._element).hasClass(CLASS_NAME_SHOW$5)) { 3849 return 3850 } 3851 3852 const startEvent = $__default["default"].Event(EVENT_HIDE$3); 3853 $__default["default"](this._element).trigger(startEvent); 3854 if (startEvent.isDefaultPrevented()) { 3855 return 3856 } 3857 3858 const dimension = this._getDimension(); 3859 3860 this._element.style[dimension] = `${this._element.getBoundingClientRect()[dimension]}px`; 3861 3862 Util.reflow(this._element); 3863 3864 $__default["default"](this._element) 3865 .addClass(CLASS_NAME_COLLAPSING) 3866 .removeClass(`${CLASS_NAME_COLLAPSE} ${CLASS_NAME_SHOW$5}`); 3867 3868 const triggerArrayLength = this._triggerArray.length; 3869 if (triggerArrayLength > 0) { 3870 for (let i = 0; i < triggerArrayLength; i++) { 3871 const trigger = this._triggerArray[i]; 3872 const selector = Util.getSelectorFromElement(trigger); 3873 3874 if (selector !== null) { 3875 const $elem = $__default["default"]([].slice.call(document.querySelectorAll(selector))); 3876 if (!$elem.hasClass(CLASS_NAME_SHOW$5)) { 3877 $__default["default"](trigger).addClass(CLASS_NAME_COLLAPSED) 3878 .attr('aria-expanded', false); 3879 } 3880 } 3881 } 3882 } 3883 3884 this.setTransitioning(true); 3885 3886 const complete = () => { 3887 this.setTransitioning(false); 3888 $__default["default"](this._element) 3889 .removeClass(CLASS_NAME_COLLAPSING) 3890 .addClass(CLASS_NAME_COLLAPSE) 3891 .trigger(EVENT_HIDDEN$3); 3892 }; 3893 3894 this._element.style[dimension] = ''; 3895 const transitionDuration = Util.getTransitionDurationFromElement(this._element); 3896 3897 $__default["default"](this._element) 3898 .one(Util.TRANSITION_END, complete) 3899 .emulateTransitionEnd(transitionDuration); 3900 } 3901 3902 setTransitioning(isTransitioning) { 3903 this._isTransitioning = isTransitioning; 3904 } 3905 3906 dispose() { 3907 $__default["default"].removeData(this._element, DATA_KEY$6); 3908 3909 this._config = null; 3910 this._parent = null; 3911 this._element = null; 3912 this._triggerArray = null; 3913 this._isTransitioning = null; 3914 } 3915 3916 // Private 3917 3918 _getConfig(config) { 3919 config = { 3920 ...Default$5, 3921 ...config 3922 }; 3923 config.toggle = Boolean(config.toggle); // Coerce string values 3924 Util.typeCheckConfig(NAME$6, config, DefaultType$5); 3925 return config 3926 } 3927 3928 _getDimension() { 3929 const hasWidth = $__default["default"](this._element).hasClass(DIMENSION_WIDTH); 3930 return hasWidth ? DIMENSION_WIDTH : DIMENSION_HEIGHT 3931 } 3932 3933 _getParent() { 3934 let parent; 3935 3936 if (Util.isElement(this._config.parent)) { 3937 parent = this._config.parent; 3938 3939 // It's a jQuery object 3940 if (typeof this._config.parent.jquery !== 'undefined') { 3941 parent = this._config.parent[0]; 3942 } 3943 } else { 3944 parent = document.querySelector(this._config.parent); 3945 } 3946 3947 const selector = `[data-toggle="collapse"][data-parent="${this._config.parent}"]`; 3948 const children = [].slice.call(parent.querySelectorAll(selector)); 3949 3950 $__default["default"](children).each((i, element) => { 3951 this._addAriaAndCollapsedClass( 3952 Collapse._getTargetFromElement(element), 3953 [element] 3954 ); 3955 }); 3956 3957 return parent 3958 } 3959 3960 _addAriaAndCollapsedClass(element, triggerArray) { 3961 const isOpen = $__default["default"](element).hasClass(CLASS_NAME_SHOW$5); 3962 3963 if (triggerArray.length) { 3964 $__default["default"](triggerArray) 3965 .toggleClass(CLASS_NAME_COLLAPSED, !isOpen) 3966 .attr('aria-expanded', isOpen); 3967 } 3968 } 3969 3970 // Static 3971 3972 static _getTargetFromElement(element) { 3973 const selector = Util.getSelectorFromElement(element); 3974 return selector ? document.querySelector(selector) : null 3975 } 3976 3977 static _jQueryInterface(config) { 3978 return this.each(function () { 3979 const $element = $__default["default"](this); 3980 let data = $element.data(DATA_KEY$6); 3981 const _config = { 3982 ...Default$5, 3983 ...$element.data(), 3984 ...(typeof config === 'object' && config ? config : {}) 3985 }; 3986 3987 if (!data && _config.toggle && typeof config === 'string' && /show|hide/.test(config)) { 3988 _config.toggle = false;
3989 } 3990 3991 if (!data) { 3992 data = new Collapse(this, _config); 3993 $element.data(DATA_KEY$6, data); 3994 } 3995 3996 if (typeof config === 'string') { 3997 if (typeof data[config] === 'undefined') { 3998 throw new TypeError(`No method named "${config}"`) 3999 } 4000 4001 data[config](); 4002 } 4003 }) 4004 } 4005 } 4006 4007 /** 4008 * ------------------------------------------------------------------------ 4009 * Data Api implementation 4010 * ------------------------------------------------------------------------ 4011 */ 4012 4013 $__default["default"](document).on(EVENT_CLICK_DATA_API$2, SELECTOR_DATA_TOGGLE$2, function (event) { 4014 // preventDefault only for <a> elements (which change the URL) not inside the collapsible element 4015 if (event.currentTarget.tagName === 'A') { 4016 event.preventDefault(); 4017 } 4018 4019 const $trigger = $__default["default"](this); 4020 const selector = Util.getSelectorFromElement(this); 4021 const selectors = [].slice.call(document.querySelectorAll(selector)); 4022 4023 $__default["default"](selectors).each(function () { 4024 const $target = $__default["default"](this); 4025 const data = $target.data(DATA_KEY$6); 4026 const config = data ? 'toggle' : $trigger.data(); 4027 Collapse._jQueryInterface.call($target, config); 4028 }); 4029 }); 4030 4031 /** 4032 * ------------------------------------------------------------------------ 4033 * jQuery 4034 * ------------------------------------------------------------------------ 4035 */ 4036 4037 $__default["default"].fn[NAME$6] = Collapse._jQueryInterface; 4038 $__default["default"].fn[NAME$6].Constructor = Collapse; 4039 $__default["default"].fn[NAME$6].noConflict = () => { 4040 $__default["default"].fn[NAME$6] = JQUERY_NO_CONFLICT$6; 4041 return Collapse._jQueryInterface 4042 }; 4043 4044 /** 4045 * -------------------------------------------------------------------------- 4046 * Bootstrap (v4.6.0): modal.js 4047 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 4048 * -------------------------------------------------------------------------- 4049 */ 4050 4051 /** 4052 * ------------------------------------------------------------------------ 4053 * Constants 4054 * ------------------------------------------------------------------------ 4055 */ 4056 4057 const NAME$5 = 'modal'; 4058 const VERSION$5 = '4.6.0'; 4059 const DATA_KEY$5 = 'bs.modal'; 4060 const EVENT_KEY$5 = `.${DATA_KEY$5}`; 4061 const DATA_API_KEY$2 = '.data-api'; 4062 const JQUERY_NO_CONFLICT$5 = $__default["default"].fn[NAME$5]; 4063 const ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key 4064 4065 const Default$4 = { 4066 backdrop: true, 4067 keyboard: true, 4068 focus: true, 4069 show: true 4070 }; 4071 4072 const DefaultType$4 = { 4073 backdrop: '(boolean|string)', 4074 keyboard: 'boolean', 4075 focus: 'boolean', 4076 show: 'boolean' 4077 }; 4078 4079 const EVENT_HIDE$2 = `hide${EVENT_KEY$5}`; 4080 const EVENT_HIDE_PREVENTED = `hidePrevented${EVENT_KEY$5}`; 4081 const EVENT_HIDDEN$2 = `hidden${EVENT_KEY$5}`; 4082 const EVENT_SHOW$2 = `show${EVENT_KEY$5}`; 4083 const EVENT_SHOWN$2 = `shown${EVENT_KEY$5}`; 4084 const EVENT_FOCUSIN = `focusin${EVENT_KEY$5}`; 4085 const EVENT_RESIZE = `resize${EVENT_KEY$5}`; 4086 const EVENT_CLICK_DISMISS$1 = `click.dismiss${EVENT_KEY$5}`; 4087 const EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY$5}`; 4088 const EVENT_MOUSEUP_DISMISS = `mouseup.dismiss${EVENT_KEY$5}`; 4089 const EVENT_MOUSEDOWN_DISMISS = `mousedown.dismiss${EVENT_KEY$5}`; 4090 const EVENT_CLICK_DATA_API$1 = `click${EVENT_KEY$5}${DATA_API_KEY$2}`; 4091 4092 const CLASS_NAME_SCROLLABLE = 'modal-dialog-scrollable'; 4093 const CLASS_NAME_SCROLLBAR_MEASURER = 'modal-scrollbar-measure'; 4094 const CLASS_NAME_BACKDROP = 'modal-backdrop'; 4095 const CLASS_NAME_OPEN = 'modal-open'; 4096 const CLASS_NAME_FADE$4 = 'fade';
4097 const CLASS_NAME_SHOW$4 = 'show'; 4098 const CLASS_NAME_STATIC = 'modal-static'; 4099 4100 const SELECTOR_DIALOG = '.modal-dialog'; 4101 const SELECTOR_MODAL_BODY = '.modal-body'; 4102 const SELECTOR_DATA_TOGGLE$1 = '[data-toggle="modal"]'; 4103 const SELECTOR_DATA_DISMISS$1 = '[data-dismiss="modal"]'; 4104 const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top'; 4105 const SELECTOR_STICKY_CONTENT = '.sticky-top'; 4106 4107 /** 4108 * ------------------------------------------------------------------------ 4109 * Class Definition 4110 * ------------------------------------------------------------------------ 4111 */ 4112 4113 class Modal { 4114 constructor(element, config) { 4115 this._config = this._getConfig(config); 4116 this._element = element; 4117 this._dialog = element.querySelector(SELECTOR_DIALOG); 4118 this._backdrop = null; 4119 this._isShown = false; 4120 this._isBodyOverflowing = false; 4121 this._ignoreBackdropClick = false; 4122 this._isTransitioning = false; 4123 this._scrollbarWidth = 0; 4124 } 4125 4126 // Getters 4127 4128 static get VERSION() { 4129 return VERSION$5 4130 } 4131 4132 static get Default() { 4133 return Default$4 4134 } 4135 4136 // Public 4137 4138 toggle(relatedTarget) { 4139 return this._isShown ? this.hide() : this.show(relatedTarget) 4140 } 4141 4142 show(relatedTarget) { 4143 if (this._isShown || this._isTransitioning) { 4144 return 4145 } 4146 4147 if ($__default["default"](this._element).hasClass(CLASS_NAME_FADE$4)) { 4148 this._isTransitioning = true; 4149 } 4150 4151 const showEvent = $__default["default"].Event(EVENT_SHOW$2, { 4152 relatedTarget 4153 }); 4154 4155 $__default["default"](this._element).trigger(showEvent); 4156 4157 if (this._isShown || showEvent.isDefaultPrevented()) { 4158 return 4159 } 4160 4161 this._isShown = true; 4162 4163 this._checkScrollbar(); 4164 this._setScrollbar(); 4165 4166 this._adjustDialog(); 4167 4168 this._setEscapeEvent(); 4169 this._setResizeEvent(); 4170 4171 $__default["default"](this._element).on( 4172 EVENT_CLICK_DISMISS$1, 4173 SELECTOR_DATA_DISMISS$1, 4174 event => this.hide(event) 4175 ); 4176 4177 $__default["default"](this._dialog).on(EVENT_MOUSEDOWN_DISMISS, () => { 4178 $__default["default"](this._element).one(EVENT_MOUSEUP_DISMISS, event => { 4179 if ($__default["default"](event.target).is(this._element)) { 4180 this._ignoreBackdropClick = true; 4181 } 4182 }); 4183 }); 4184 4185 this._showBackdrop(() => this._showElement(relatedTarget)); 4186 } 4187 4188 hide(event) { 4189 if (event) { 4190 event.preventDefault(); 4191 } 4192 4193 if (!this._isShown || this._isTransitioning) { 4194 return 4195 } 4196 4197 const hideEvent = $__default["default"].Event(EVENT_HIDE$2); 4198 4199 $__default["default"](this._element).trigger(hideEvent); 4200 4201 if (!this._isShown || hideEvent.isDefaultPrevented()) { 4202 return 4203 } 4204 4205 this._isShown = false; 4206 const transition = $__default["default"](this._element).hasClass(CLASS_NAME_FADE$4); 4207 4208 if (transition) { 4209 this._isTransitioning = true; 4210 } 4211 4212 this._setEscapeEvent(); 4213 this._setResizeEvent(); 4214 4215 $__default["default"](document).off(EVENT_FOCUSIN); 4216 4217 $__default["default"](this._element).removeClass(CLASS_NAME_SHOW$4); 4218 4219 $__default["default"](this._element).off(EVENT_CLICK_DISMISS$1); 4220 $__default["default"](this._dialog).off(EVENT_MOUSEDOWN_DISMISS); 4221 4222 if (transition) { 4223 const transitionDuration = Util.getTransitionDurationFromElement(this._element); 4224 4225 $__default["default"](this._element) 4226 .one(Util.TRANSITION_END, event => this._hideModal(event)) 4227 .emulateTransitionEnd(transitionDuration); 4228 } else { 4229 this._hideModal(); 4230 } 4231 } 4232 4233 dispose() { 4234 [window, this._element, this._dialog] 4235 .forEach(htmlElement => $__default["default"](htmlElement).off(EVENT_KEY$5)); 4236 4237 /** 4238 * `document` has 2 events `EVENT_FOCUSIN` and `EVENT_CLICK_DATA_API` 4239 * Do not move `document` in `htmlElements` array 4240 * It will remove `EVENT_CLICK_DATA_API` event that should remain 4241 */ 4242 $__default["default"](document).off(EVENT_FOCUSIN); 4243 4244 $__default["default"].removeData(this._element, DATA_KEY$5); 4245 4246 this._config = null; 4247 this._element = null; 4248 this._dialog = null; 4249 this._backdrop = null; 4250 this._isShown = null; 4251 this._isBodyOverflowing = null; 4252 this._ignoreBackdropClick = null; 4253 this._isTransitioning = null; 4254 this._scrollbarWidth = null; 4255 } 4256 4257 handleUpdate() { 4258 this._adjustDialog(); 4259 } 4260 4261 // Private 4262 4263 _getConfig(config) { 4264 config = { 4265 ...Default$4, 4266 ...config 4267 }; 4268 Util.typeCheckConfig(NAME$5, config, DefaultType$4); 4269 return config 4270 } 4271 4272 _triggerBackdropTransition() { 4273 const hideEventPrevented = $__default["default"].Event(EVENT_HIDE_PREVENTED); 4274 4275 $__default["default"](this._element).trigger(hideEventPrevented); 4276 if (hideEventPrevented.isDefaultPrevented()) { 4277 return 4278 } 4279 4280 const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight; 4281 4282 if (!isModalOverflowing) { 4283 this._element.style.overflowY = 'hidden'; 4284 } 4285 4286 this._element.classList.add(CLASS_NAME_STATIC); 4287 4288 const modalTransitionDuration = Util.getTransitionDurationFromElement(this._dialog); 4289 $__default["default"](this._element).off(Util.TRANSITION_END); 4290 4291 $__default["default"](this._element).one(Util.TRANSITION_END, () => { 4292 this._element.classList.remove(CLASS_NAME_STATIC); 4293 if (!isModalOverflowing) { 4294 $__default["default"](this._element).one(Util.TRANSITION_END, () => { 4295 this._element.style.overflowY = ''; 4296 }) 4297 .emulateTransitionEnd(this._element, modalTransitionDuration); 4298 } 4299 }) 4300 .emulateTransitionEnd(modalTransitionDuration); 4301 this._element.focus(); 4302 } 4303 4304 _showElement(relatedTarget) { 4305 const transition = $__default["default"](this._element).hasClass(CLASS_NAME_FADE$4); 4306 const modalBody = this._dialog ? this._dialog.querySelector(SELECTOR_MODAL_BODY) : null; 4307 4308 if (!this._element.parentNode || 4309 this._element.parentNode.nodeType !== Node.ELEMENT_NODE) { 4310 // Don't move modal's DOM position 4311 document.body.appendChild(this._element); 4312 } 4313 4314 this._element.style.display = 'block'; 4315 this._element.removeAttribute('aria-hidden'); 4316 this._element.setAttribute('aria-modal', true); 4317 this._element.setAttribute('role', 'dialog'); 4318 4319 if ($__default["default"](this._dialog).hasClass(CLASS_NAME_SCROLLABLE) && modalBody) { 4320 modalBody.scrollTop = 0; 4321 } else { 4322 this._element.scrollTop = 0; 4323 } 4324 4325 if (transition) { 4326 Util.reflow(this._element); 4327 } 4328 4329 $__default["default"](this._element).addClass(CLASS_NAME_SHOW$4); 4330 4331 if (this._config.focus) { 4332 this._enforceFocus(); 4333 } 4334 4335 const shownEvent = $__default["default"].Event(EVENT_SHOWN$2, { 4336 relatedTarget 4337 }); 4338 4339 const transitionComplete = () => { 4340 if (this._config.focus) { 4341 this._element.focus(); 4342 } 4343 4344 this._isTransitioning = false;
4345 $__default["default"](this._element).trigger(shownEvent); 4346 }; 4347 4348 if (transition) { 4349 const transitionDuration = Util.getTransitionDurationFromElement(this._dialog); 4350 4351 $__default["default"](this._dialog) 4352 .one(Util.TRANSITION_END, transitionComplete) 4353 .emulateTransitionEnd(transitionDuration); 4354 } else { 4355 transitionComplete(); 4356 } 4357 } 4358 4359 _enforceFocus() { 4360 $__default["default"](document) 4361 .off(EVENT_FOCUSIN) // Guard against infinite focus loop 4362 .on(EVENT_FOCUSIN, event => { 4363 if (document !== event.target && 4364 this._element !== event.target && 4365 $__default["default"](this._element).has(event.target).length === 0) { 4366 this._element.focus(); 4367 } 4368 }); 4369 } 4370 4371 _setEscapeEvent() { 4372 if (this._isShown) { 4373 $__default["default"](this._element).on(EVENT_KEYDOWN_DISMISS, event => { 4374 if (this._config.keyboard && event.which === ESCAPE_KEYCODE) { 4375 event.preventDefault(); 4376 this.hide(); 4377 } else if (!this._config.keyboard && event.which === ESCAPE_KEYCODE) { 4378 this._triggerBackdropTransition(); 4379 } 4380 }); 4381 } else if (!this._isShown) { 4382 $__default["default"](this._element).off(EVENT_KEYDOWN_DISMISS); 4383 } 4384 } 4385 4386 _setResizeEvent() { 4387 if (this._isShown) { 4388 $__default["default"](window).on(EVENT_RESIZE, event => this.handleUpdate(event)); 4389 } else { 4390 $__default["default"](window).off(EVENT_RESIZE); 4391 } 4392 } 4393 4394 _hideModal() { 4395 this._element.style.display = 'none'; 4396 this._element.setAttribute('aria-hidden', true); 4397 this._element.removeAttribute('aria-modal'); 4398 this._element.removeAttribute('role'); 4399 this._isTransitioning = false; 4400 this._showBackdrop(() => { 4401 $__default["default"](document.body).removeClass(CLASS_NAME_OPEN); 4402 this._resetAdjustments(); 4403 this._resetScrollbar(); 4404 $__default["default"](this._element).trigger(EVENT_HIDDEN$2); 4405 }); 4406 } 4407 4408 _removeBackdrop() { 4409 if (this._backdrop) { 4410 $__default["default"](this._backdrop).remove(); 4411 this._backdrop = null; 4412 } 4413 } 4414 4415 _showBackdrop(callback) { 4416 const animate = $__default["default"](this._element).hasClass(CLASS_NAME_FADE$4) ? 4417 CLASS_NAME_FADE$4 : ''; 4418 4419 if (this._isShown && this._config.backdrop) { 4420 this._backdrop = document.createElement('div'); 4421 this._backdrop.className = CLASS_NAME_BACKDROP; 4422 4423 if (animate) { 4424 this._backdrop.classList.add(animate); 4425 } 4426 4427 $__default["default"](this._backdrop).appendTo(document.body); 4428 4429 $__default["default"](this._element).on(EVENT_CLICK_DISMISS$1, event => { 4430 if (this._ignoreBackdropClick) { 4431 this._ignoreBackdropClick = false; 4432 return 4433 } 4434 4435 if (event.target !== event.currentTarget) { 4436 return 4437 } 4438 4439 if (this._config.backdrop === 'static') { 4440 this._triggerBackdropTransition(); 4441 } else { 4442 this.hide(); 4443 } 4444 }); 4445 4446 if (animate) { 4447 Util.reflow(this._backdrop); 4448 } 4449 4450 $__default["default"](this._backdrop).addClass(CLASS_NAME_SHOW$4); 4451 4452 if (!callback) { 4453 return 4454 } 4455 4456 if (!animate) { 4457 callback(); 4458 return 4459 } 4460 4461 const backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop); 4462 4463 $__default["default"](this._backdrop) 4464 .one(Util.TRANSITION_END, callback) 4465 .emulateTransitionEnd(backdropTransitionDuration); 4466 } else if (!this._isShown && this._backdrop) { 4467 $__default["default"](this._backdrop).removeClass(CLASS_NAME_SHOW$4); 4468 4469 const callbackRemove = () => { 4470 this._removeBackdrop(); 4471 if (callback) { 4472 callback(); 4473 } 4474 }; 4475 4476 if ($__default["default"](this._element).hasClass(CLASS_NAME_FADE$4)) { 4477 const backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop); 4478 4479 $__default["default"](this._backdrop) 4480 .one(Util.TRANSITION_END, callbackRemove) 4481 .emulateTransitionEnd(backdropTransitionDuration); 4482 } else { 4483 callbackRemove(); 4484 } 4485 } else if (callback) { 4486 callback(); 4487 } 4488 } 4489 4490 // ---------------------------------------------------------------------- 4491 // the following methods are used to handle overflowing modals 4492 // todo (fat): these should probably be refactored out of modal.js 4493 // ---------------------------------------------------------------------- 4494 4495 _adjustDialog() { 4496 const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight; 4497 4498 if (!this._isBodyOverflowing && isModalOverflowing) { 4499 this._element.style.paddingLeft = `${this._scrollbarWidth}px`; 4500 } 4501 4502 if (this._isBodyOverflowing && !isModalOverflowing) { 4503 this._element.style.paddingRight = `${this._scrollbarWidth}px`; 4504 } 4505 } 4506 4507 _resetAdjustments() { 4508 this._element.style.paddingLeft = ''; 4509 this._element.style.paddingRight = ''; 4510 } 4511 4512 _checkScrollbar() { 4513 const rect = document.body.getBoundingClientRect(); 4514 this._isBodyOverflowing = Math.round(rect.left + rect.right) < window.innerWidth; 4515 this._scrollbarWidth = this._getScrollbarWidth(); 4516 } 4517 4518 _setScrollbar() { 4519 if (this._isBodyOverflowing) { 4520 // Note: DOMNode.style.paddingRight returns the actual value or '' if not set 4521 // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set 4522 const fixedContent = [].slice.call(document.querySelectorAll(SELECTOR_FIXED_CONTENT)); 4523 const stickyContent = [].slice.call(document.querySelectorAll(SELECTOR_STICKY_CONTENT)); 4524 4525 // Adjust fixed content padding 4526 $__default["default"](fixedContent).each((index, element) => { 4527 const actualPadding = element.style.paddingRight; 4528 const calculatedPadding = $__default["default"](element).css('padding-right'); 4529 $__default["default"](element) 4530 .data('padding-right', actualPadding) 4531 .css('padding-right', `${parseFloat(calculatedPadding) + this._scrollbarWidth}px`); 4532 }); 4533 4534 // Adjust sticky content margin 4535 $__default["default"](stickyContent).each((index, element) => { 4536 const actualMargin = element.style.marginRight; 4537 const calculatedMargin = $__default["default"](element).css('margin-right'); 4538 $__default["default"](element) 4539 .data('margin-right', actualMargin) 4540 .css('margin-right', `${parseFloat(calculatedMargin) - this._scrollbarWidth}px`); 4541 }); 4542 4543 // Adjust body padding 4544 const actualPadding = document.body.style.paddingRight; 4545 const calculatedPadding = $__default["default"](document.body).css('padding-right'); 4546 $__default["default"](document.body) 4547 .data('padding-right', actualPadding) 4548 .css('padding-right', `${parseFloat(calculatedPadding) + this._scrollbarWidth}px`); 4549 } 4550 4551 $__default["default"](document.body).addClass(CLASS_NAME_OPEN); 4552 } 4553 4554 _resetScrollbar() { 4555 // Restore fixed content padding 4556 const fixedContent = [].slice.call(document.querySelectorAll(SELECTOR_FIXED_CONTENT)); 4557 $__default["default"](fixedContent).each((index, element) => { 4558 const padding = $__default["default"](element).data('padding-right'); 4559 $__default["default"](element).removeData('padding-right'); 4560 element.style.paddingRight = padding ? padding : ''; 4561 }); 4562 4563 // Restore sticky content 4564 const elements = [].slice.call(document.querySelectorAll(`${SELECTOR_STICKY_CONTENT}`)); 4565 $__default["default"](elements).each((index, element) => { 4566 const margin = $__default["default"](element).data('margin-right'); 4567 if (typeof margin !== 'undefined') { 4568 $__default["default"](element).css('margin-right', margin).removeData('margin-right'); 4569 } 4570 }); 4571 4572 // Restore body padding 4573 const padding = $__default["default"](document.body).data('padding-right'); 4574 $__default["default"](document.body).removeData('padding-right'); 4575 document.body.style.paddingRight = padding ? padding : ''; 4576 } 4577 4578 _getScrollbarWidth() { // thx d.walsh 4579 const scrollDiv = document.createElement('div'); 4580 scrollDiv.className = CLASS_NAME_SCROLLBAR_MEASURER; 4581 document.body.appendChild(scrollDiv); 4582 const scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth; 4583 document.body.removeChild(scrollDiv); 4584 return scrollbarWidth 4585 } 4586 4587 // Static 4588 4589 static _jQueryInterface(config, relatedTarget) { 4590 return this.each(function () { 4591 let data = $__default["default"](this).data(DATA_KEY$5); 4592 const _config = { 4593 ...Default$4, 4594 ...$__default["default"](this).data(), 4595 ...(typeof config === 'object' && config ? config : {}) 4596 }; 4597 4598 if (!data) { 4599 data = new Modal(this, _config); 4600 $__default["default"](this).data(DATA_KEY$5, data); 4601 } 4602 4603 if (typeof config === 'string') { 4604 if (typeof data[config] === 'undefined') {
4605 throw new TypeError(`No method named "${config}"`) 4606 } 4607 4608 data[config](relatedTarget); 4609 } else if (_config.show) { 4610 data.show(relatedTarget); 4611 } 4612 }) 4613 } 4614 } 4615 4616 /** 4617 * ------------------------------------------------------------------------ 4618 * Data Api implementation 4619 * ------------------------------------------------------------------------ 4620 */ 4621 4622 $__default["default"](document).on(EVENT_CLICK_DATA_API$1, SELECTOR_DATA_TOGGLE$1, function (event) { 4623 let target; 4624 const selector = Util.getSelectorFromElement(this); 4625 4626 if (selector) { 4627 target = document.querySelector(selector); 4628 } 4629 4630 const config = $__default["default"](target).data(DATA_KEY$5) ? 4631 'toggle' : { 4632 ...$__default["default"](target).data(), 4633 ...$__default["default"](this).data() 4634 }; 4635 4636 if (this.tagName === 'A' || this.tagName === 'AREA') { 4637 event.preventDefault(); 4638 } 4639 4640 const $target = $__default["default"](target).one(EVENT_SHOW$2, showEvent => { 4641 if (showEvent.isDefaultPrevented()) { 4642 // Only register focus restorer if modal will actually get shown 4643 return 4644 } 4645 4646 $target.one(EVENT_HIDDEN$2, () => { 4647 if ($__default["default"](this).is(':visible')) { 4648 this.focus(); 4649 } 4650 }); 4651 }); 4652 4653 Modal._jQueryInterface.call($__default["default"](target), config, this); 4654 }); 4655 4656 /** 4657 * ------------------------------------------------------------------------ 4658 * jQuery 4659 * ------------------------------------------------------------------------ 4660 */ 4661 4662 $__default["default"].fn[NAME$5] = Modal._jQueryInterface; 4663 $__default["default"].fn[NAME$5].Constructor = Modal; 4664 $__default["default"].fn[NAME$5].noConflict = () => { 4665 $__default["default"].fn[NAME$5] = JQUERY_NO_CONFLICT$5; 4666 return Modal._jQueryInterface 4667 }; 4668 4669 /** 4670 * -------------------------------------------------------------------------- 4671 * Bootstrap (v4.6.0): tools/sanitizer.js 4672 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 4673 * -------------------------------------------------------------------------- 4674 */ 4675 4676 const uriAttrs = [ 4677 'background', 4678 'cite', 4679 'href', 4680 'itemtype', 4681 'longdesc', 4682 'poster', 4683 'src', 4684 'xlink:href' 4685 ]; 4686 4687 const ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i; 4688 4689 const DefaultWhitelist = { 4690 // Global attributes allowed on any supplied element below. 4691 '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN], 4692 a: ['target', 'href', 'title', 'rel'], 4693 area: [], 4694 b: [], 4695 br: [], 4696 col: [], 4697 code: [], 4698 div: [], 4699 em: [], 4700 hr: [], 4701 h1: [], 4702 h2: [], 4703 h3: [], 4704 h4: [], 4705 h5: [], 4706 h6: [], 4707 i: [], 4708 img: ['src', 'srcset', 'alt', 'title', 'width', 'height'], 4709 li: [], 4710 ol: [], 4711 p: [], 4712 pre: [], 4713 s: [], 4714 small: [], 4715 span: [], 4716 sub: [], 4717 sup: [], 4718 strong: [], 4719 u: [], 4720 ul: [] 4721 }; 4722 4723 /** 4724 * A pattern that recognizes a commonly useful subset of URLs that are safe. 4725 * 4726 * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts 4727 */ 4728 const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^#&/:?]*(?:[#/?]|$))/gi; 4729 4730 /** 4731 * A pattern that matches safe data URLs. Only matches image, video and audio types. 4732 * 4733 * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts 4734 */ 4735 const DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[\d+/a-z]+=*$/i; 4736 4737 function allowedAttribute(attr, allowedAttributeList) { 4738 const attrName = attr.nodeName.toLowerCase(); 4739 4740 if (allowedAttributeList.indexOf(attrName) !== -1) { 4741 if (uriAttrs.indexOf(attrName) !== -1) { 4742 return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN)) 4743 } 4744 4745 return true 4746 } 4747 4748 const regExp = allowedAttributeList.filter(attrRegex => attrRegex instanceof RegExp); 4749 4750 // Check if a regular expression validates the attribute. 4751 for (let i = 0, len = regExp.length; i < len; i++) { 4752 if (attrName.match(regExp[i])) { 4753 return true 4754 } 4755 } 4756 4757 return false 4758 } 4759 4760 function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) { 4761 if (unsafeHtml.length === 0) { 4762 return unsafeHtml 4763 } 4764 4765 if (sanitizeFn && typeof sanitizeFn === 'function') { 4766 return sanitizeFn(unsafeHtml) 4767 } 4768 4769 const domParser = new window.DOMParser(); 4770 const createdDocument = domParser.parseFromString(unsafeHtml, 'text/html'); 4771 const whitelistKeys = Object.keys(whiteList); 4772 const elements = [].slice.call(createdDocument.body.querySelectorAll('*')); 4773 4774 for (let i = 0, len = elements.length; i < len; i++) { 4775 const el = elements[i]; 4776 const elName = el.nodeName.toLowerCase(); 4777 4778 if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) { 4779 el.parentNode.removeChild(el); 4780 4781 continue 4782 } 4783 4784 const attributeList = [].slice.call(el.attributes); 4785 const whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []); 4786 4787 attributeList.forEach(attr => { 4788 if (!allowedAttribute(attr, whitelistedAttributes)) { 4789 el.removeAttribute(attr.nodeName); 4790 } 4791 }); 4792 } 4793 4794 return createdDocument.body.innerHTML 4795 }
vendor: 93,043 bytes, lines 4795-7414
4795 4796 4797 /**! 4798 * @fileOverview Kickass library to create and place poppers near their reference elements. 4799 * @version 1.16.1 4800 * @license 4801 * Copyright (c) 2016 Federico Zivolo and contributors 4802 * 4803 * Permission is hereby granted, free of charge, to any person obtaining a copy 4804 * of this software and associated documentation files (the "Software"), to deal 4805 * in the Software without restriction, including without limitation the rights 4806 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 4807 * copies of the Software, and to permit persons to whom the Software is 4808 * furnished to do so, subject to the following conditions: 4809 * 4810 * The above copyright notice and this permission notice shall be included in all 4811 * copies or substantial portions of the Software. 4812 * 4813 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 4814 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 4815 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 4816 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 4817 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 4818 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 4819 * SOFTWARE. 4820 */ 4821 var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined'; 4822 4823 var timeoutDuration = function () { 4824 var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox']; 4825 for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) { 4826 if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) { 4827 return 1; 4828 } 4829 } 4830 return 0; 4831 }(); 4832 4833 function microtaskDebounce(fn) { 4834 var called = false; 4835 return function () { 4836 if (called) { 4837 return; 4838 } 4839 called = true; 4840 window.Promise.resolve().then(function () { 4841 called = false; 4842 fn(); 4843 }); 4844 }; 4845 } 4846 4847 function taskDebounce(fn) { 4848 var scheduled = false; 4849 return function () { 4850 if (!scheduled) { 4851 scheduled = true; 4852 setTimeout(function () { 4853 scheduled = false; 4854 fn(); 4855 }, timeoutDuration); 4856 } 4857 }; 4858 } 4859 4860 var supportsMicroTasks = isBrowser && window.Promise; 4861 4862 /** 4863 * Create a debounced version of a method, that's asynchronously deferred 4864 * but called in the minimum time possible. 4865 * 4866 * @method 4867 * @memberof Popper.Utils 4868 * @argument {Function} fn 4869 * @returns {Function} 4870 */ 4871 var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce; 4872 4873 /** 4874 * Check if the given variable is a function 4875 * @method 4876 * @memberof Popper.Utils 4877 * @argument {Any} functionToCheck - variable to check 4878 * @returns {Boolean} answer to: is a function? 4879 */ 4880 function isFunction(functionToCheck) { 4881 var getType = {}; 4882 return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]'; 4883 } 4884 4885 /** 4886 * Get CSS computed property of the given element 4887 * @method 4888 * @memberof Popper.Utils 4889 * @argument {Eement} element 4890 * @argument {String} property 4891 */ 4892 function getStyleComputedProperty(element, property) { 4893 if (element.nodeType !== 1) { 4894 return []; 4895 } 4896 // NOTE: 1 DOM access here 4897 var window = element.ownerDocument.defaultView; 4898 var css = window.getComputedStyle(element, null); 4899 return property ? css[property] : css; 4900 } 4901 4902 /** 4903 * Returns the parentNode or the host of the element 4904 * @method 4905 * @memberof Popper.Utils 4906 * @argument {Element} element 4907 * @returns {Element} parent 4908 */ 4909 function getParentNode(element) { 4910 if (element.nodeName === 'HTML') { 4911 return element; 4912 } 4913 return element.parentNode || element.host; 4914 } 4915 4916 /** 4917 * Returns the scrolling parent of the given element 4918 * @method 4919 * @memberof Popper.Utils 4920 * @argument {Element} element 4921 * @returns {Element} scroll parent 4922 */ 4923 function getScrollParent(element) { 4924 // Return body, `getScroll` will take care to get the correct `scrollTop` from it 4925 if (!element) { 4926 return document.body; 4927 } 4928 4929 switch (element.nodeName) { 4930 case 'HTML': 4931 case 'BODY': 4932 return element.ownerDocument.body; 4933 case '#document': 4934 return element.body; 4935 } 4936 4937 // Firefox want us to check `-x` and `-y` variations as well 4938 4939 var _getStyleComputedProp = getStyleComputedProperty(element), 4940 overflow = _getStyleComputedProp.overflow, 4941 overflowX = _getStyleComputedProp.overflowX, 4942 overflowY = _getStyleComputedProp.overflowY; 4943 4944 if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) { 4945 return element; 4946 } 4947 4948 return getScrollParent(getParentNode(element)); 4949 } 4950 4951 /** 4952 * Returns the reference node of the reference object, or the reference object itself. 4953 * @method 4954 * @memberof Popper.Utils 4955 * @param {Element|Object} reference - the reference element (the popper will be relative to this) 4956 * @returns {Element} parent 4957 */ 4958 function getReferenceNode(reference) { 4959 return reference && reference.referenceNode ? reference.referenceNode : reference; 4960 } 4961 4962 var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode); 4963 var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent); 4964 4965 /** 4966 * Determines if the browser is Internet Explorer 4967 * @method 4968 * @memberof Popper.Utils 4969 * @param {Number} version to check 4970 * @returns {Boolean} isIE 4971 */ 4972 function isIE(version) { 4973 if (version === 11) { 4974 return isIE11; 4975 } 4976 if (version === 10) { 4977 return isIE10; 4978 } 4979 return isIE11 || isIE10; 4980 } 4981 4982 /** 4983 * Returns the offset parent of the given element 4984 * @method 4985 * @memberof Popper.Utils 4986 * @argument {Element} element 4987 * @returns {Element} offset parent 4988 */ 4989 function getOffsetParent(element) { 4990 if (!element) { 4991 return document.documentElement; 4992 } 4993 4994 var noOffsetParent = isIE(10) ? document.body : null; 4995 4996 // NOTE: 1 DOM access here 4997 var offsetParent = element.offsetParent || null; 4998 // Skip hidden elements which don't have an offsetParent 4999 while (offsetParent === noOffsetParent && element.nextElementSibling) { 5000 offsetParent = (element = element.nextElementSibling).offsetParent; 5001 } 5002 5003 var nodeName = offsetParent && offsetParent.nodeName; 5004 5005 if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') { 5006 return element ? element.ownerDocument.documentElement : document.documentElement; 5007 } 5008 5009 // .offsetParent will return the closest TH, TD or TABLE in case 5010 // no offsetParent is present, I hate this job... 5011 if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') { 5012 return getOffsetParent(offsetParent); 5013 } 5014 5015 return offsetParent; 5016 } 5017 5018 function isOffsetContainer(element) { 5019 var nodeName = element.nodeName; 5020 5021 if (nodeName === 'BODY') { 5022 return false; 5023 } 5024 return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element; 5025 } 5026 5027 /** 5028 * Finds the root node (document, shadowDOM root) of the given element 5029 * @method 5030 * @memberof Popper.Utils 5031 * @argument {Element} node 5032 * @returns {Element} root node 5033 */ 5034 function getRoot(node) { 5035 if (node.parentNode !== null) { 5036 return getRoot(node.parentNode); 5037 } 5038 5039 return node; 5040 } 5041 5042 /** 5043 * Finds the offset parent common to the two provided nodes 5044 * @method 5045 * @memberof Popper.Utils 5046 * @argument {Element} element1 5047 * @argument {Element} element2 5048 * @returns {Element} common offset parent 5049 */ 5050 function findCommonOffsetParent(element1, element2) { 5051 // This check is needed to avoid errors in case one of the elements isn't defined for any reason 5052 if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) { 5053 return document.documentElement; 5054 } 5055 5056 // Here we make sure to give as "start" the element that comes first in the DOM 5057 var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING; 5058 var start = order ? element1 : element2; 5059 var end = order ? element2 : element1; 5060 5061 // Get common ancestor container 5062 var range = document.createRange(); 5063 range.setStart(start, 0); 5064 range.setEnd(end, 0); 5065 var commonAncestorContainer = range.commonAncestorContainer; 5066 5067 // Both nodes are inside #document 5068 5069 if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) { 5070 if (isOffsetContainer(commonAncestorContainer)) { 5071 return commonAncestorContainer; 5072 } 5073 5074 return getOffsetParent(commonAncestorContainer); 5075 } 5076 5077 // one of the nodes is inside shadowDOM, find which one 5078 var element1root = getRoot(element1); 5079 if (element1root.host) { 5080 return findCommonOffsetParent(element1root.host, element2); 5081 } else { 5082 return findCommonOffsetParent(element1, getRoot(element2).host); 5083 } 5084 } 5085 5086 /** 5087 * Gets the scroll value of the given element in the given side (top and left) 5088 * @method 5089 * @memberof Popper.Utils 5090 * @argument {Element} element 5091 * @argument {String} side `top` or `left` 5092 * @returns {number} amount of scrolled pixels 5093 */ 5094 function getScroll(element) { 5095 var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top'; 5096 5097 var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft'; 5098 var nodeName = element.nodeName; 5099 5100 if (nodeName === 'BODY' || nodeName === 'HTML') { 5101 var html = element.ownerDocument.documentElement; 5102 var scrollingElement = element.ownerDocument.scrollingElement || html; 5103 return scrollingElement[upperSide]; 5104 } 5105 5106 return element[upperSide]; 5107 } 5108 5109 /* 5110 * Sum or subtract the element scroll values (left and top) from a given rect object 5111 * @method 5112 * @memberof Popper.Utils 5113 * @param {Object} rect - Rect object you want to change 5114 * @param {HTMLElement} element - The element from the function reads the scroll values 5115 * @param {Boolean} subtract - set to true if you want to subtract the scroll values 5116 * @return {Object} rect - The modifier rect object 5117 */ 5118 function includeScroll(rect, element) { 5119 var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; 5120 5121 var scrollTop = getScroll(element, 'top'); 5122 var scrollLeft = getScroll(element, 'left'); 5123 var modifier = subtract ? -1 : 1; 5124 rect.top += scrollTop * modifier; 5125 rect.bottom += scrollTop * modifier; 5126 rect.left += scrollLeft * modifier; 5127 rect.right += scrollLeft * modifier; 5128 return rect; 5129 } 5130 5131 /* 5132 * Helper to detect borders of a given element 5133 * @method 5134 * @memberof Popper.Utils 5135 * @param {CSSStyleDeclaration} styles 5136 * Result of `getStyleComputedProperty` on the given element 5137 * @param {String} axis - `x` or `y` 5138 * @return {number} borders - The borders size of the given axis 5139 */ 5140 5141 function getBordersSize(styles, axis) { 5142 var sideA = axis === 'x' ? 'Left' : 'Top'; 5143 var sideB = sideA === 'Left' ? 'Right' : 'Bottom'; 5144 5145 return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']); 5146 } 5147 5148 function getSize(axis, body, html, computedStyle) { 5149 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); 5150 } 5151 5152 function getWindowSizes(document) { 5153 var body = document.body; 5154 var html = document.documentElement; 5155 var computedStyle = isIE(10) && getComputedStyle(html); 5156 5157 return { 5158 height: getSize('Height', body, html, computedStyle), 5159 width: getSize('Width', body, html, computedStyle) 5160 }; 5161 } 5162 5163 var classCallCheck = function (instance, Constructor) { 5164 if (!(instance instanceof Constructor)) { 5165 throw new TypeError("Cannot call a class as a function"); 5166 } 5167 }; 5168 5169 var createClass = function () { 5170 function defineProperties(target, props) { 5171 for (var i = 0; i < props.length; i++) { 5172 var descriptor = props[i]; 5173 descriptor.enumerable = descriptor.enumerable || false; 5174 descriptor.configurable = true; 5175 if ("value" in descriptor) descriptor.writable = true; 5176 Object.defineProperty(target, descriptor.key, descriptor); 5177 } 5178 } 5179 5180 return function (Constructor, protoProps, staticProps) { 5181 if (protoProps) defineProperties(Constructor.prototype, protoProps); 5182 if (staticProps) defineProperties(Constructor, staticProps); 5183 return Constructor; 5184 }; 5185 }(); 5186 5187 5188 5189 5190 5191 var defineProperty = function (obj, key, value) { 5192 if (key in obj) { 5193 Object.defineProperty(obj, key, { 5194 value: value, 5195 enumerable: true, 5196 configurable: true, 5197 writable: true 5198 }); 5199 } else { 5200 obj[key] = value; 5201 } 5202 5203 return obj; 5204 }; 5205 5206 var _extends = Object.assign || function (target) { 5207 for (var i = 1; i < arguments.length; i++) { 5208 var source = arguments[i]; 5209 5210 for (var key in source) { 5211 if (Object.prototype.hasOwnProperty.call(source, key)) { 5212 target[key] = source[key]; 5213 } 5214 } 5215 } 5216 5217 return target; 5218 }; 5219 5220 /** 5221 * Given element offsets, generate an output similar to getBoundingClientRect 5222 * @method 5223 * @memberof Popper.Utils 5224 * @argument {Object} offsets 5225 * @returns {Object} ClientRect like output 5226 */ 5227 function getClientRect(offsets) { 5228 return _extends({}, offsets, { 5229 right: offsets.left + offsets.width, 5230 bottom: offsets.top + offsets.height 5231 }); 5232 } 5233 5234 /** 5235 * Get bounding client rect of given element 5236 * @method 5237 * @memberof Popper.Utils 5238 * @param {HTMLElement} element 5239 * @return {Object} client rect 5240 */ 5241 function getBoundingClientRect(element) { 5242 var rect = {}; 5243 5244 // IE10 10 FIX: Please, don't ask, the element isn't 5245 // considered in DOM in some circumstances... 5246 // This isn't reproducible in IE10 compatibility mode of IE11 5247 try { 5248 if (isIE(10)) { 5249 rect = element.getBoundingClientRect(); 5250 var scrollTop = getScroll(element, 'top'); 5251 var scrollLeft = getScroll(element, 'left'); 5252 rect.top += scrollTop; 5253 rect.left += scrollLeft; 5254 rect.bottom += scrollTop; 5255 rect.right += scrollLeft; 5256 } else { 5257 rect = element.getBoundingClientRect(); 5258 } 5259 } catch (e) {} 5260 5261 var result = { 5262 left: rect.left, 5263 top: rect.top, 5264 width: rect.right - rect.left, 5265 height: rect.bottom - rect.top 5266 }; 5267 5268 // subtract scrollbar size from sizes 5269 var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {}; 5270 var width = sizes.width || element.clientWidth || result.width; 5271 var height = sizes.height || element.clientHeight || result.height; 5272 5273 var horizScrollbar = element.offsetWidth - width; 5274 var vertScrollbar = element.offsetHeight - height; 5275 5276 // if an hypothetical scrollbar is detected, we must be sure it's not a `border` 5277 // we make this check conditional for performance reasons 5278 if (horizScrollbar || vertScrollbar) { 5279 var styles = getStyleComputedProperty(element); 5280 horizScrollbar -= getBordersSize(styles, 'x'); 5281 vertScrollbar -= getBordersSize(styles, 'y'); 5282 5283 result.width -= horizScrollbar; 5284 result.height -= vertScrollbar; 5285 } 5286 5287 return getClientRect(result); 5288 } 5289 5290 function getOffsetRectRelativeToArbitraryNode(children, parent) { 5291 var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; 5292 5293 var isIE10 = isIE(10); 5294 var isHTML = parent.nodeName === 'HTML'; 5295 var childrenRect = getBoundingClientRect(children); 5296 var parentRect = getBoundingClientRect(parent); 5297 var scrollParent = getScrollParent(children); 5298 5299 var styles = getStyleComputedProperty(parent); 5300 var borderTopWidth = parseFloat(styles.borderTopWidth); 5301 var borderLeftWidth = parseFloat(styles.borderLeftWidth); 5302 5303 // In cases where the parent is fixed, we must ignore negative scroll in offset calc 5304 if (fixedPosition && isHTML) { 5305 parentRect.top = Math.max(parentRect.top, 0); 5306 parentRect.left = Math.max(parentRect.left, 0); 5307 } 5308 var offsets = getClientRect({ 5309 top: childrenRect.top - parentRect.top - borderTopWidth, 5310 left: childrenRect.left - parentRect.left - borderLeftWidth, 5311 width: childrenRect.width, 5312 height: childrenRect.height 5313 }); 5314 offsets.marginTop = 0; 5315 offsets.marginLeft = 0; 5316 5317 // Subtract margins of documentElement in case it's being used as parent 5318 // we do this only on HTML because it's the only element that behaves 5319 // differently when margins are applied to it. The margins are included in 5320 // the box of the documentElement, in the other cases not. 5321 if (!isIE10 && isHTML) { 5322 var marginTop = parseFloat(styles.marginTop); 5323 var marginLeft = parseFloat(styles.marginLeft); 5324 5325 offsets.top -= borderTopWidth - marginTop; 5326 offsets.bottom -= borderTopWidth - marginTop; 5327 offsets.left -= borderLeftWidth - marginLeft; 5328 offsets.right -= borderLeftWidth - marginLeft; 5329 5330 // Attach marginTop and marginLeft because in some circumstances we may need them 5331 offsets.marginTop = marginTop; 5332 offsets.marginLeft = marginLeft; 5333 } 5334 5335 if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') { 5336 offsets = includeScroll(offsets, parent); 5337 } 5338 5339 return offsets; 5340 } 5341 5342 function getViewportOffsetRectRelativeToArtbitraryNode(element) { 5343 var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; 5344 5345 var html = element.ownerDocument.documentElement; 5346 var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html); 5347 var width = Math.max(html.clientWidth, window.innerWidth || 0); 5348 var height = Math.max(html.clientHeight, window.innerHeight || 0); 5349 5350 var scrollTop = !excludeScroll ? getScroll(html) : 0; 5351 var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0; 5352 5353 var offset = { 5354 top: scrollTop - relativeOffset.top + relativeOffset.marginTop, 5355 left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft, 5356 width: width, 5357 height: height 5358 }; 5359 5360 return getClientRect(offset); 5361 } 5362 5363 /** 5364 * Check if the given element is fixed or is inside a fixed parent 5365 * @method 5366 * @memberof Popper.Utils 5367 * @argument {Element} element 5368 * @argument {Element} customContainer 5369 * @returns {Boolean} answer to "isFixed?" 5370 */ 5371 function isFixed(element) { 5372 var nodeName = element.nodeName; 5373 if (nodeName === 'BODY' || nodeName === 'HTML') { 5374 return false; 5375 } 5376 if (getStyleComputedProperty(element, 'position') === 'fixed') { 5377 return true; 5378 } 5379 var parentNode = getParentNode(element); 5380 if (!parentNode) { 5381 return false; 5382 } 5383 return isFixed(parentNode); 5384 } 5385 5386 /** 5387 * Finds the first parent of an element that has a transformed property defined 5388 * @method 5389 * @memberof Popper.Utils 5390 * @argument {Element} element 5391 * @returns {Element} first transformed parent or documentElement 5392 */ 5393 5394 function getFixedPositionOffsetParent(element) { 5395 // This check is needed to avoid errors in case one of the elements isn't defined for any reason 5396 if (!element || !element.parentElement || isIE()) { 5397 return document.documentElement; 5398 } 5399 var el = element.parentElement; 5400 while (el && getStyleComputedProperty(el, 'transform') === 'none') { 5401 el = el.parentElement; 5402 } 5403 return el || document.documentElement; 5404 } 5405 5406 /** 5407 * Computed the boundaries limits and return them 5408 * @method 5409 * @memberof Popper.Utils 5410 * @param {HTMLElement} popper 5411 * @param {HTMLElement} reference 5412 * @param {number} padding 5413 * @param {HTMLElement} boundariesElement - Element used to define the boundaries 5414 * @param {Boolean} fixedPosition - Is in fixed position mode 5415 * @returns {Object} Coordinates of the boundaries 5416 */ 5417 function getBoundaries(popper, reference, padding, boundariesElement) { 5418 var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false; 5419 5420 // NOTE: 1 DOM access here 5421 5422 var boundaries = { top: 0, left: 0 }; 5423 var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference)); 5424 5425 // Handle viewport case 5426 if (boundariesElement === 'viewport') { 5427 boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition); 5428 } else { 5429 // Handle other cases based on DOM element used as boundaries 5430 var boundariesNode = void 0; 5431 if (boundariesElement === 'scrollParent') { 5432 boundariesNode = getScrollParent(getParentNode(reference)); 5433 if (boundariesNode.nodeName === 'BODY') { 5434 boundariesNode = popper.ownerDocument.documentElement; 5435 } 5436 } else if (boundariesElement === 'window') { 5437 boundariesNode = popper.ownerDocument.documentElement; 5438 } else { 5439 boundariesNode = boundariesElement; 5440 } 5441 5442 var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition); 5443 5444 // In case of HTML, we need a different computation 5445 if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) { 5446 var _getWindowSizes = getWindowSizes(popper.ownerDocument), 5447 height = _getWindowSizes.height, 5448 width = _getWindowSizes.width; 5449 5450 boundaries.top += offsets.top - offsets.marginTop; 5451 boundaries.bottom = height + offsets.top; 5452 boundaries.left += offsets.left - offsets.marginLeft; 5453 boundaries.right = width + offsets.left; 5454 } else { 5455 // for all the other DOM elements, this one is good 5456 boundaries = offsets; 5457 } 5458 } 5459 5460 // Add paddings 5461 padding = padding || 0; 5462 var isPaddingNumber = typeof padding === 'number'; 5463 boundaries.left += isPaddingNumber ? padding : padding.left || 0; 5464 boundaries.top += isPaddingNumber ? padding : padding.top || 0; 5465 boundaries.right -= isPaddingNumber ? padding : padding.right || 0; 5466 boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0; 5467 5468 return boundaries; 5469 } 5470 5471 function getArea(_ref) { 5472 var width = _ref.width, 5473 height = _ref.height; 5474 5475 return width * height; 5476 } 5477 5478 /** 5479 * Utility used to transform the `auto` placement to the placement with more 5480 * available space. 5481 * @method 5482 * @memberof Popper.Utils 5483 * @argument {Object} data - The data object generated by update method 5484 * @argument {Object} options - Modifiers configuration and options 5485 * @returns {Object} The data object, properly modified 5486 */ 5487 function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) { 5488 var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0; 5489 5490 if (placement.indexOf('auto') === -1) { 5491 return placement; 5492 } 5493 5494 var boundaries = getBoundaries(popper, reference, padding, boundariesElement); 5495 5496 var rects = { 5497 top: { 5498 width: boundaries.width, 5499 height: refRect.top - boundaries.top 5500 }, 5501 right: { 5502 width: boundaries.right - refRect.right, 5503 height: boundaries.height 5504 }, 5505 bottom: { 5506 width: boundaries.width, 5507 height: boundaries.bottom - refRect.bottom 5508 }, 5509 left: { 5510 width: refRect.left - boundaries.left, 5511 height: boundaries.height 5512 } 5513 }; 5514 5515 var sortedAreas = Object.keys(rects).map(function (key) { 5516 return _extends({ 5517 key: key 5518 }, rects[key], { 5519 area: getArea(rects[key]) 5520 }); 5521 }).sort(function (a, b) { 5522 return b.area - a.area; 5523 }); 5524 5525 var filteredAreas = sortedAreas.filter(function (_ref2) { 5526 var width = _ref2.width, 5527 height = _ref2.height; 5528 return width >= popper.clientWidth && height >= popper.clientHeight; 5529 }); 5530 5531 var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key; 5532 5533 var variation = placement.split('-')[1]; 5534 5535 return computedPlacement + (variation ? '-' + variation : ''); 5536 } 5537 5538 /** 5539 * Get offsets to the reference element 5540 * @method 5541 * @memberof Popper.Utils 5542 * @param {Object} state 5543 * @param {Element} popper - the popper element 5544 * @param {Element} reference - the reference element (the popper will be relative to this) 5545 * @param {Element} fixedPosition - is in fixed position mode 5546 * @returns {Object} An object containing the offsets which will be applied to the popper 5547 */ 5548 function getReferenceOffsets(state, popper, reference) { 5549 var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; 5550 5551 var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference)); 5552 return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition); 5553 } 5554 5555 /** 5556 * Get the outer sizes of the given element (offset size + margins) 5557 * @method 5558 * @memberof Popper.Utils 5559 * @argument {Element} element 5560 * @returns {Object} object containing width and height properties 5561 */ 5562 function getOuterSizes(element) { 5563 var window = element.ownerDocument.defaultView; 5564 var styles = window.getComputedStyle(element); 5565 var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0); 5566 var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0); 5567 var result = { 5568 width: element.offsetWidth + y, 5569 height: element.offsetHeight + x 5570 }; 5571 return result; 5572 } 5573 5574 /** 5575 * Get the opposite placement of the given one 5576 * @method 5577 * @memberof Popper.Utils 5578 * @argument {String} placement 5579 * @returns {String} flipped placement 5580 */ 5581 function getOppositePlacement(placement) { 5582 var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' }; 5583 return placement.replace(/left|right|bottom|top/g, function (matched) { 5584 return hash[matched]; 5585 }); 5586 } 5587 5588 /** 5589 * Get offsets to the popper 5590 * @method 5591 * @memberof Popper.Utils 5592 * @param {Object} position - CSS position the Popper will get applied 5593 * @param {HTMLElement} popper - the popper element 5594 * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this) 5595 * @param {String} placement - one of the valid placement options 5596 * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper 5597 */ 5598 function getPopperOffsets(popper, referenceOffsets, placement) { 5599 placement = placement.split('-')[0]; 5600 5601 // Get popper node sizes 5602 var popperRect = getOuterSizes(popper); 5603 5604 // Add position, width and height to our offsets object 5605 var popperOffsets = { 5606 width: popperRect.width, 5607 height: popperRect.height 5608 }; 5609 5610 // depending by the popper placement we have to compute its offsets slightly differently 5611 var isHoriz = ['right', 'left'].indexOf(placement) !== -1; 5612 var mainSide = isHoriz ? 'top' : 'left'; 5613 var secondarySide = isHoriz ? 'left' : 'top'; 5614 var measurement = isHoriz ? 'height' : 'width'; 5615 var secondaryMeasurement = !isHoriz ? 'height' : 'width'; 5616 5617 popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2; 5618 if (placement === secondarySide) { 5619 popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement]; 5620 } else { 5621 popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)]; 5622 } 5623 5624 return popperOffsets; 5625 } 5626 5627 /** 5628 * Mimics the `find` method of Array 5629 * @method 5630 * @memberof Popper.Utils 5631 * @argument {Array} arr 5632 * @argument prop 5633 * @argument value 5634 * @returns index or -1 5635 */ 5636 function find(arr, check) { 5637 // use native find if supported 5638 if (Array.prototype.find) { 5639 return arr.find(check); 5640 } 5641 5642 // use `filter` to obtain the same behavior of `find` 5643 return arr.filter(check)[0]; 5644 } 5645 5646 /** 5647 * Return the index of the matching object 5648 * @method 5649 * @memberof Popper.Utils 5650 * @argument {Array} arr 5651 * @argument prop 5652 * @argument value 5653 * @returns index or -1 5654 */ 5655 function findIndex(arr, prop, value) { 5656 // use native findIndex if supported 5657 if (Array.prototype.findIndex) { 5658 return arr.findIndex(function (cur) { 5659 return cur[prop] === value; 5660 }); 5661 } 5662 5663 // use `find` + `indexOf` if `findIndex` isn't supported 5664 var match = find(arr, function (obj) { 5665 return obj[prop] === value; 5666 }); 5667 return arr.indexOf(match); 5668 } 5669 5670 /** 5671 * Loop trough the list of modifiers and run them in order, 5672 * each of them will then edit the data object. 5673 * @method 5674 * @memberof Popper.Utils 5675 * @param {dataObject} data 5676 * @param {Array} modifiers 5677 * @param {String} ends - Optional modifier name used as stopper 5678 * @returns {dataObject} 5679 */ 5680 function runModifiers(modifiers, data, ends) { 5681 var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends)); 5682 5683 modifiersToRun.forEach(function (modifier) { 5684 if (modifier['function']) { 5685 // eslint-disable-line dot-notation 5686 console.warn('`modifier.function` is deprecated, use `modifier.fn`!'); 5687 } 5688 var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation 5689 if (modifier.enabled && isFunction(fn)) { 5690 // Add properties to offsets to make them a complete clientRect object 5691 // we do this before each modifier to make sure the previous one doesn't 5692 // mess with these values 5693 data.offsets.popper = getClientRect(data.offsets.popper); 5694 data.offsets.reference = getClientRect(data.offsets.reference); 5695 5696 data = fn(data, modifier); 5697 } 5698 }); 5699 5700 return data; 5701 } 5702 5703 /** 5704 * Updates the position of the popper, computing the new offsets and applying 5705 * the new style.<br /> 5706 * Prefer `scheduleUpdate` over `update` because of performance reasons. 5707 * @method 5708 * @memberof Popper 5709 */ 5710 function update() { 5711 // if popper is destroyed, don't perform any further update 5712 if (this.state.isDestroyed) { 5713 return; 5714 } 5715 5716 var data = { 5717 instance: this, 5718 styles: {}, 5719 arrowStyles: {}, 5720 attributes: {}, 5721 flipped: false, 5722 offsets: {} 5723 }; 5724 5725 // compute reference element offsets 5726 data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed); 5727 5728 // compute auto placement, store placement inside the data object, 5729 // modifiers will be able to edit `placement` if needed 5730 // and refer to originalPlacement to know the original value 5731 data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding); 5732 5733 // store the computed placement inside `originalPlacement` 5734 data.originalPlacement = data.placement; 5735 5736 data.positionFixed = this.options.positionFixed; 5737 5738 // compute the popper offsets 5739 data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement); 5740 5741 data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute'; 5742 5743 // run the modifiers 5744 data = runModifiers(this.modifiers, data); 5745 5746 // the first `update` will call `onCreate` callback 5747 // the other ones will call `onUpdate` callback 5748 if (!this.state.isCreated) { 5749 this.state.isCreated = true; 5750 this.options.onCreate(data); 5751 } else { 5752 this.options.onUpdate(data); 5753 } 5754 } 5755 5756 /** 5757 * Helper used to know if the given modifier is enabled. 5758 * @method 5759 * @memberof Popper.Utils 5760 * @returns {Boolean} 5761 */ 5762 function isModifierEnabled(modifiers, modifierName) { 5763 return modifiers.some(function (_ref) { 5764 var name = _ref.name, 5765 enabled = _ref.enabled; 5766 return enabled && name === modifierName; 5767 }); 5768 } 5769 5770 /** 5771 * Get the prefixed supported property name 5772 * @method 5773 * @memberof Popper.Utils 5774 * @argument {String} property (camelCase) 5775 * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix) 5776 */ 5777 function getSupportedPropertyName(property) { 5778 var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O']; 5779 var upperProp = property.charAt(0).toUpperCase() + property.slice(1); 5780 5781 for (var i = 0; i < prefixes.length; i++) { 5782 var prefix = prefixes[i]; 5783 var toCheck = prefix ? '' + prefix + upperProp : property; 5784 if (typeof document.body.style[toCheck] !== 'undefined') { 5785 return toCheck; 5786 } 5787 } 5788 return null; 5789 } 5790 5791 /** 5792 * Destroys the popper. 5793 * @method 5794 * @memberof Popper 5795 */ 5796 function destroy() { 5797 this.state.isDestroyed = true; 5798 5799 // touch DOM only if `applyStyle` modifier is enabled 5800 if (isModifierEnabled(this.modifiers, 'applyStyle')) { 5801 this.popper.removeAttribute('x-placement'); 5802 this.popper.style.position = ''; 5803 this.popper.style.top = ''; 5804 this.popper.style.left = ''; 5805 this.popper.style.right = ''; 5806 this.popper.style.bottom = ''; 5807 this.popper.style.willChange = ''; 5808 this.popper.style[getSupportedPropertyName('transform')] = ''; 5809 } 5810 5811 this.disableEventListeners(); 5812 5813 // remove the popper if user explicitly asked for the deletion on destroy 5814 // do not use `remove` because IE11 doesn't support it 5815 if (this.options.removeOnDestroy) { 5816 this.popper.parentNode.removeChild(this.popper); 5817 } 5818 return this; 5819 } 5820 5821 /** 5822 * Get the window associated with the element 5823 * @argument {Element} element 5824 * @returns {Window} 5825 */ 5826 function getWindow(element) { 5827 var ownerDocument = element.ownerDocument; 5828 return ownerDocument ? ownerDocument.defaultView : window; 5829 } 5830 5831 function attachToScrollParents(scrollParent, event, callback, scrollParents) { 5832 var isBody = scrollParent.nodeName === 'BODY'; 5833 var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent; 5834 target.addEventListener(event, callback, { passive: true }); 5835 5836 if (!isBody) { 5837 attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents); 5838 } 5839 scrollParents.push(target); 5840 } 5841 5842 /** 5843 * Setup needed event listeners used to update the popper position 5844 * @method 5845 * @memberof Popper.Utils 5846 * @private 5847 */ 5848 function setupEventListeners(reference, options, state, updateBound) { 5849 // Resize event listener on window 5850 state.updateBound = updateBound; 5851 getWindow(reference).addEventListener('resize', state.updateBound, { passive: true }); 5852 5853 // Scroll event listener on scroll parents 5854 var scrollElement = getScrollParent(reference); 5855 attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents); 5856 state.scrollElement = scrollElement; 5857 state.eventsEnabled = true; 5858 5859 return state; 5860 } 5861 5862 /** 5863 * It will add resize/scroll events and start recalculating 5864 * position of the popper element when they are triggered. 5865 * @method 5866 * @memberof Popper 5867 */ 5868 function enableEventListeners() { 5869 if (!this.state.eventsEnabled) { 5870 this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate); 5871 } 5872 } 5873 5874 /** 5875 * Remove event listeners used to update the popper position 5876 * @method 5877 * @memberof Popper.Utils 5878 * @private 5879 */ 5880 function removeEventListeners(reference, state) { 5881 // Remove resize event listener on window 5882 getWindow(reference).removeEventListener('resize', state.updateBound); 5883 5884 // Remove scroll event listener on scroll parents 5885 state.scrollParents.forEach(function (target) { 5886 target.removeEventListener('scroll', state.updateBound); 5887 }); 5888 5889 // Reset state 5890 state.updateBound = null; 5891 state.scrollParents = []; 5892 state.scrollElement = null; 5893 state.eventsEnabled = false; 5894 return state; 5895 } 5896 5897 /** 5898 * It will remove resize/scroll events and won't recalculate popper position 5899 * when they are triggered. It also won't trigger `onUpdate` callback anymore, 5900 * unless you call `update` method manually. 5901 * @method 5902 * @memberof Popper 5903 */ 5904 function disableEventListeners() { 5905 if (this.state.eventsEnabled) { 5906 cancelAnimationFrame(this.scheduleUpdate); 5907 this.state = removeEventListeners(this.reference, this.state); 5908 } 5909 } 5910 5911 /** 5912 * Tells if a given input is a number 5913 * @method 5914 * @memberof Popper.Utils 5915 * @param {*} input to check 5916 * @return {Boolean} 5917 */ 5918 function isNumeric(n) { 5919 return n !== '' && !isNaN(parseFloat(n)) && isFinite(n); 5920 } 5921 5922 /** 5923 * Set the style to the given popper 5924 * @method 5925 * @memberof Popper.Utils 5926 * @argument {Element} element - Element to apply the style to 5927 * @argument {Object} styles 5928 * Object with a list of properties and values which will be applied to the element 5929 */ 5930 function setStyles(element, styles) { 5931 Object.keys(styles).forEach(function (prop) { 5932 var unit = ''; 5933 // add unit if the value is numeric and is one of the following 5934 if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) { 5935 unit = 'px'; 5936 } 5937 element.style[prop] = styles[prop] + unit; 5938 }); 5939 } 5940 5941 /** 5942 * Set the attributes to the given popper 5943 * @method 5944 * @memberof Popper.Utils 5945 * @argument {Element} element - Element to apply the attributes to 5946 * @argument {Object} styles 5947 * Object with a list of properties and values which will be applied to the element 5948 */ 5949 function setAttributes(element, attributes) { 5950 Object.keys(attributes).forEach(function (prop) { 5951 var value = attributes[prop]; 5952 if (value !== false) { 5953 element.setAttribute(prop, attributes[prop]); 5954 } else { 5955 element.removeAttribute(prop); 5956 } 5957 }); 5958 } 5959 5960 /** 5961 * @function 5962 * @memberof Modifiers 5963 * @argument {Object} data - The data object generated by `update` method 5964 * @argument {Object} data.styles - List of style properties - values to apply to popper element 5965 * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element 5966 * @argument {Object} options - Modifiers configuration and options 5967 * @returns {Object} The same data object 5968 */ 5969 function applyStyle(data) { 5970 // any property present in `data.styles` will be applied to the popper, 5971 // in this way we can make the 3rd party modifiers add custom styles to it 5972 // Be aware, modifiers could override the properties defined in the previous 5973 // lines of this modifier! 5974 setStyles(data.instance.popper, data.styles); 5975 5976 // any property present in `data.attributes` will be applied to the popper, 5977 // they will be set as HTML attributes of the element 5978 setAttributes(data.instance.popper, data.attributes); 5979 5980 // if arrowElement is defined and arrowStyles has some properties 5981 if (data.arrowElement && Object.keys(data.arrowStyles).length) { 5982 setStyles(data.arrowElement, data.arrowStyles); 5983 } 5984 5985 return data; 5986 } 5987 5988 /** 5989 * Set the x-placement attribute before everything else because it could be used 5990 * to add margins to the popper margins needs to be calculated to get the 5991 * correct popper offsets. 5992 * @method 5993 * @memberof Popper.modifiers 5994 * @param {HTMLElement} reference - The reference element used to position the popper 5995 * @param {HTMLElement} popper - The HTML element used as popper 5996 * @param {Object} options - Popper.js options 5997 */ 5998 function applyStyleOnLoad(reference, popper, options, modifierOptions, state) { 5999 // compute reference element offsets 6000 var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed); 6001 6002 // compute auto placement, store placement inside the data object, 6003 // modifiers will be able to edit `placement` if needed 6004 // and refer to originalPlacement to know the original value 6005 var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding); 6006 6007 popper.setAttribute('x-placement', placement); 6008 6009 // Apply `position` to popper before anything else because 6010 // without the position applied we can't guarantee correct computations 6011 setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' }); 6012 6013 return options; 6014 } 6015 6016 /** 6017 * @function 6018 * @memberof Popper.Utils 6019 * @argument {Object} data - The data object generated by `update` method 6020 * @argument {Boolean} shouldRound - If the offsets should be rounded at all 6021 * @returns {Object} The popper's position offsets rounded 6022 * 6023 * The tale of pixel-perfect positioning. It's still not 100% perfect, but as 6024 * good as it can be within reason. 6025 * Discussion here: https://github.com/FezVrasta/popper.js/pull/715 6026 * 6027 * Low DPI screens cause a popper to be blurry if not using full pixels (Safari 6028 * as well on High DPI screens). 6029 * 6030 * Firefox prefers no rounding for positioning and does not have blurriness on 6031 * high DPI screens. 6032 * 6033 * Only horizontal placement and left/right values need to be considered. 6034 */ 6035 function getRoundedOffsets(data, shouldRound) { 6036 var _data$offsets = data.offsets, 6037 popper = _data$offsets.popper, 6038 reference = _data$offsets.reference; 6039 var round = Math.round, 6040 floor = Math.floor; 6041 6042 var noRound = function noRound(v) { 6043 return v; 6044 }; 6045 6046 var referenceWidth = round(reference.width); 6047 var popperWidth = round(popper.width); 6048 6049 var isVertical = ['left', 'right'].indexOf(data.placement) !== -1; 6050 var isVariation = data.placement.indexOf('-') !== -1; 6051 var sameWidthParity = referenceWidth % 2 === popperWidth % 2; 6052 var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1; 6053 6054 var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor; 6055 var verticalToInteger = !shouldRound ? noRound : round; 6056 6057 return { 6058 left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left), 6059 top: verticalToInteger(popper.top), 6060 bottom: verticalToInteger(popper.bottom), 6061 right: horizontalToInteger(popper.right) 6062 }; 6063 } 6064 6065 var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent); 6066 6067 /** 6068 * @function 6069 * @memberof Modifiers 6070 * @argument {Object} data - The data object generated by `update` method 6071 * @argument {Object} options - Modifiers configuration and options 6072 * @returns {Object} The data object, properly modified 6073 */ 6074 function computeStyle(data, options) { 6075 var x = options.x, 6076 y = options.y; 6077 var popper = data.offsets.popper; 6078 6079 // Remove this legacy support in Popper.js v2 6080 6081 var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) { 6082 return modifier.name === 'applyStyle'; 6083 }).gpuAcceleration; 6084 if (legacyGpuAccelerationOption !== undefined) { 6085 console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!'); 6086 } 6087 var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration; 6088 6089 var offsetParent = getOffsetParent(data.instance.popper); 6090 var offsetParentRect = getBoundingClientRect(offsetParent); 6091 6092 // Styles 6093 var styles = { 6094 position: popper.position 6095 }; 6096 6097 var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox); 6098 6099 var sideA = x === 'bottom' ? 'top' : 'bottom'; 6100 var sideB = y === 'right' ? 'left' : 'right'; 6101 6102 // if gpuAcceleration is set to `true` and transform is supported, 6103 // we use `translate3d` to apply the position to the popper we 6104 // automatically use the supported prefixed version if needed 6105 var prefixedProperty = getSupportedPropertyName('transform'); 6106 6107 // now, let's make a step back and look at this code closely (wtf?) 6108 // If the content of the popper grows once it's been positioned, it 6109 // may happen that the popper gets misplaced because of the new content 6110 // overflowing its reference element 6111 // To avoid this problem, we provide two options (x and y), which allow 6112 // the consumer to define the offset origin. 6113 // If we position a popper on top of a reference element, we can set 6114 // `x` to `top` to make the popper grow towards its top instead of 6115 // its bottom. 6116 var left = void 0, 6117 top = void 0; 6118 if (sideA === 'bottom') { 6119 // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar) 6120 // and not the bottom of the html element 6121 if (offsetParent.nodeName === 'HTML') { 6122 top = -offsetParent.clientHeight + offsets.bottom; 6123 } else { 6124 top = -offsetParentRect.height + offsets.bottom; 6125 } 6126 } else { 6127 top = offsets.top; 6128 } 6129 if (sideB === 'right') { 6130 if (offsetParent.nodeName === 'HTML') { 6131 left = -offsetParent.clientWidth + offsets.right; 6132 } else { 6133 left = -offsetParentRect.width + offsets.right; 6134 } 6135 } else { 6136 left = offsets.left; 6137 } 6138 if (gpuAcceleration && prefixedProperty) { 6139 styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)'; 6140 styles[sideA] = 0; 6141 styles[sideB] = 0; 6142 styles.willChange = 'transform'; 6143 } else { 6144 // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties 6145 var invertTop = sideA === 'bottom' ? -1 : 1; 6146 var invertLeft = sideB === 'right' ? -1 : 1; 6147 styles[sideA] = top * invertTop; 6148 styles[sideB] = left * invertLeft; 6149 styles.willChange = sideA + ', ' + sideB; 6150 } 6151 6152 // Attributes 6153 var attributes = { 6154 'x-placement': data.placement 6155 }; 6156 6157 // Update `data` attributes, styles and arrowStyles 6158 data.attributes = _extends({}, attributes, data.attributes); 6159 data.styles = _extends({}, styles, data.styles); 6160 data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles); 6161 6162 return data; 6163 } 6164 6165 /** 6166 * Helper used to know if the given modifier depends from another one.<br /> 6167 * It checks if the needed modifier is listed and enabled. 6168 * @method 6169 * @memberof Popper.Utils 6170 * @param {Array} modifiers - list of modifiers 6171 * @param {String} requestingName - name of requesting modifier 6172 * @param {String} requestedName - name of requested modifier 6173 * @returns {Boolean} 6174 */ 6175 function isModifierRequired(modifiers, requestingName, requestedName) { 6176 var requesting = find(modifiers, function (_ref) { 6177 var name = _ref.name; 6178 return name === requestingName; 6179 }); 6180 6181 var isRequired = !!requesting && modifiers.some(function (modifier) { 6182 return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order; 6183 }); 6184 6185 if (!isRequired) { 6186 var _requesting = '`' + requestingName + '`'; 6187 var requested = '`' + requestedName + '`'; 6188 console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!'); 6189 } 6190 return isRequired; 6191 } 6192 6193 /** 6194 * @function 6195 * @memberof Modifiers 6196 * @argument {Object} data - The data object generated by update method 6197 * @argument {Object} options - Modifiers configuration and options 6198 * @returns {Object} The data object, properly modified 6199 */ 6200 function arrow(data, options) { 6201 var _data$offsets$arrow; 6202 6203 // arrow depends on keepTogether in order to work 6204 if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) { 6205 return data; 6206 } 6207 6208 var arrowElement = options.element; 6209 6210 // if arrowElement is a string, suppose it's a CSS selector 6211 if (typeof arrowElement === 'string') { 6212 arrowElement = data.instance.popper.querySelector(arrowElement); 6213 6214 // if arrowElement is not found, don't run the modifier 6215 if (!arrowElement) { 6216 return data; 6217 } 6218 } else { 6219 // if the arrowElement isn't a query selector we must check that the 6220 // provided DOM node is child of its popper node 6221 if (!data.instance.popper.contains(arrowElement)) { 6222 console.warn('WARNING: `arrow.element` must be child of its popper element!'); 6223 return data; 6224 } 6225 } 6226 6227 var placement = data.placement.split('-')[0]; 6228 var _data$offsets = data.offsets, 6229 popper = _data$offsets.popper, 6230 reference = _data$offsets.reference; 6231 6232 var isVertical = ['left', 'right'].indexOf(placement) !== -1; 6233 6234 var len = isVertical ? 'height' : 'width'; 6235 var sideCapitalized = isVertical ? 'Top' : 'Left'; 6236 var side = sideCapitalized.toLowerCase(); 6237 var altSide = isVertical ? 'left' : 'top'; 6238 var opSide = isVertical ? 'bottom' : 'right'; 6239 var arrowElementSize = getOuterSizes(arrowElement)[len]; 6240 6241 // 6242 // extends keepTogether behavior making sure the popper and its 6243 // reference have enough pixels in conjunction 6244 // 6245 6246 // top/left side 6247 if (reference[opSide] - arrowElementSize < popper[side]) { 6248 data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize); 6249 } 6250 // bottom/right side 6251 if (reference[side] + arrowElementSize > popper[opSide]) { 6252 data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide]; 6253 } 6254 data.offsets.popper = getClientRect(data.offsets.popper); 6255 6256 // compute center of the popper 6257 var center = reference[side] + reference[len] / 2 - arrowElementSize / 2; 6258 6259 // Compute the sideValue using the updated popper offsets 6260 // take popper margin in account because we don't have this info available 6261 var css = getStyleComputedProperty(data.instance.popper); 6262 var popperMarginSide = parseFloat(css['margin' + sideCapitalized]); 6263 var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']); 6264 var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide; 6265 6266 // prevent arrowElement from being placed not contiguously to its popper 6267 sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0); 6268 6269 data.arrowElement = arrowElement; 6270 data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow); 6271 6272 return data; 6273 } 6274 6275 /** 6276 * Get the opposite placement variation of the given one 6277 * @method 6278 * @memberof Popper.Utils 6279 * @argument {String} placement variation 6280 * @returns {String} flipped placement variation 6281 */ 6282 function getOppositeVariation(variation) { 6283 if (variation === 'end') { 6284 return 'start'; 6285 } else if (variation === 'start') { 6286 return 'end'; 6287 } 6288 return variation; 6289 } 6290 6291 /** 6292 * List of accepted placements to use as values of the `placement` option.<br /> 6293 * Valid placements are: 6294 * - `auto` 6295 * - `top` 6296 * - `right` 6297 * - `bottom` 6298 * - `left` 6299 * 6300 * Each placement can have a variation from this list: 6301 * - `-start` 6302 * - `-end` 6303 * 6304 * Variations are interpreted easily if you think of them as the left to right 6305 * written languages. Horizontally (`top` and `bottom`), `start` is left and `end` 6306 * is right.<br /> 6307 * Vertically (`left` and `right`), `start` is top and `end` is bottom. 6308 * 6309 * Some valid examples are: 6310 * - `top-end` (on top of reference, right aligned) 6311 * - `right-start` (on right of reference, top aligned) 6312 * - `bottom` (on bottom, centered) 6313 * - `auto-end` (on the side with more space available, alignment depends by placement) 6314 * 6315 * @static 6316 * @type {Array} 6317 * @enum {String} 6318 * @readonly 6319 * @method placements 6320 * @memberof Popper 6321 */ 6322 var 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']; 6323 6324 // Get rid of `auto` `auto-start` and `auto-end` 6325 var validPlacements = placements.slice(3); 6326 6327 /** 6328 * Given an initial placement, returns all the subsequent placements 6329 * clockwise (or counter-clockwise). 6330 * 6331 * @method 6332 * @memberof Popper.Utils 6333 * @argument {String} placement - A valid placement (it accepts variations) 6334 * @argument {Boolean} counter - Set to true to walk the placements counterclockwise 6335 * @returns {Array} placements including their variations 6336 */ 6337 function clockwise(placement) { 6338 var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; 6339 6340 var index = validPlacements.indexOf(placement); 6341 var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index)); 6342 return counter ? arr.reverse() : arr; 6343 } 6344 6345 var BEHAVIORS = { 6346 FLIP: 'flip', 6347 CLOCKWISE: 'clockwise', 6348 COUNTERCLOCKWISE: 'counterclockwise' 6349 }; 6350 6351 /** 6352 * @function 6353 * @memberof Modifiers 6354 * @argument {Object} data - The data object generated by update method 6355 * @argument {Object} options - Modifiers configuration and options 6356 * @returns {Object} The data object, properly modified 6357 */ 6358 function flip(data, options) { 6359 // if `inner` modifier is enabled, we can't use the `flip` modifier 6360 if (isModifierEnabled(data.instance.modifiers, 'inner')) { 6361 return data; 6362 } 6363 6364 if (data.flipped && data.placement === data.originalPlacement) { 6365 // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides 6366 return data; 6367 } 6368 6369 var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed); 6370 6371 var placement = data.placement.split('-')[0]; 6372 var placementOpposite = getOppositePlacement(placement); 6373 var variation = data.placement.split('-')[1] || ''; 6374 6375 var flipOrder = []; 6376 6377 switch (options.behavior) { 6378 case BEHAVIORS.FLIP: 6379 flipOrder = [placement, placementOpposite]; 6380 break; 6381 case BEHAVIORS.CLOCKWISE: 6382 flipOrder = clockwise(placement); 6383 break; 6384 case BEHAVIORS.COUNTERCLOCKWISE: 6385 flipOrder = clockwise(placement, true); 6386 break; 6387 default: 6388 flipOrder = options.behavior; 6389 } 6390 6391 flipOrder.forEach(function (step, index) { 6392 if (placement !== step || flipOrder.length === index + 1) { 6393 return data; 6394 } 6395 6396 placement = data.placement.split('-')[0]; 6397 placementOpposite = getOppositePlacement(placement); 6398 6399 var popperOffsets = data.offsets.popper; 6400 var refOffsets = data.offsets.reference; 6401 6402 // using floor because the reference offsets may contain decimals we are not going to consider here 6403 var floor = Math.floor; 6404 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); 6405 6406 var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left); 6407 var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right); 6408 var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top); 6409 var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom); 6410 6411 var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom; 6412 6413 // flip the variation if required 6414 var isVertical = ['top', 'bottom'].indexOf(placement) !== -1; 6415 6416 // flips variation if reference element overflows boundaries 6417 var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom); 6418 6419 // flips variation if popper content overflows boundaries 6420 var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop); 6421 6422 var flippedVariation = flippedVariationByRef || flippedVariationByContent; 6423 6424 if (overlapsRef || overflowsBoundaries || flippedVariation) { 6425 // this boolean to detect any flip loop 6426 data.flipped = true; 6427 6428 if (overlapsRef || overflowsBoundaries) { 6429 placement = flipOrder[index + 1]; 6430 } 6431 6432 if (flippedVariation) { 6433 variation = getOppositeVariation(variation); 6434 } 6435 6436 data.placement = placement + (variation ? '-' + variation : ''); 6437 6438 // this object contains `position`, we want to preserve it along with 6439 // any additional property we may add in the future 6440 data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement)); 6441 6442 data = runModifiers(data.instance.modifiers, data, 'flip'); 6443 } 6444 }); 6445 return data; 6446 } 6447 6448 /** 6449 * @function 6450 * @memberof Modifiers 6451 * @argument {Object} data - The data object generated by update method 6452 * @argument {Object} options - Modifiers configuration and options 6453 * @returns {Object} The data object, properly modified 6454 */ 6455 function keepTogether(data) { 6456 var _data$offsets = data.offsets, 6457 popper = _data$offsets.popper, 6458 reference = _data$offsets.reference; 6459 6460 var placement = data.placement.split('-')[0]; 6461 var floor = Math.floor; 6462 var isVertical = ['top', 'bottom'].indexOf(placement) !== -1; 6463 var side = isVertical ? 'right' : 'bottom'; 6464 var opSide = isVertical ? 'left' : 'top'; 6465 var measurement = isVertical ? 'width' : 'height'; 6466 6467 if (popper[side] < floor(reference[opSide])) { 6468 data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement]; 6469 } 6470 if (popper[opSide] > floor(reference[side])) { 6471 data.offsets.popper[opSide] = floor(reference[side]); 6472 } 6473 6474 return data; 6475 } 6476 6477 /** 6478 * Converts a string containing value + unit into a px value number 6479 * @function 6480 * @memberof {modifiers~offset} 6481 * @private 6482 * @argument {String} str - Value + unit string 6483 * @argument {String} measurement - `height` or `width` 6484 * @argument {Object} popperOffsets 6485 * @argument {Object} referenceOffsets 6486 * @returns {Number|String} 6487 * Value in pixels, or original string if no values were extracted 6488 */ 6489 function toValue(str, measurement, popperOffsets, referenceOffsets) { 6490 // separate value from unit 6491 var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/); 6492 var value = +split[1]; 6493 var unit = split[2]; 6494 6495 // If it's not a number it's an operator, I guess 6496 if (!value) { 6497 return str; 6498 } 6499 6500 if (unit.indexOf('%') === 0) { 6501 var element = void 0; 6502 switch (unit) { 6503 case '%p': 6504 element = popperOffsets; 6505 break; 6506 case '%': 6507 case '%r': 6508 default: 6509 element = referenceOffsets; 6510 } 6511 6512 var rect = getClientRect(element); 6513 return rect[measurement] / 100 * value; 6514 } else if (unit === 'vh' || unit === 'vw') { 6515 // if is a vh or vw, we calculate the size based on the viewport 6516 var size = void 0; 6517 if (unit === 'vh') { 6518 size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0); 6519 } else { 6520 size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0); 6521 } 6522 return size / 100 * value; 6523 } else { 6524 // if is an explicit pixel unit, we get rid of the unit and keep the value 6525 // if is an implicit unit, it's px, and we return just the value 6526 return value; 6527 } 6528 } 6529 6530 /** 6531 * Parse an `offset` string to extrapolate `x` and `y` numeric offsets. 6532 * @function 6533 * @memberof {modifiers~offset} 6534 * @private 6535 * @argument {String} offset 6536 * @argument {Object} popperOffsets 6537 * @argument {Object} referenceOffsets 6538 * @argument {String} basePlacement 6539 * @returns {Array} a two cells array with x and y offsets in numbers 6540 */ 6541 function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) { 6542 var offsets = [0, 0]; 6543 6544 // Use height if placement is left or right and index is 0 otherwise use width 6545 // in this way the first offset will use an axis and the second one 6546 // will use the other one 6547 var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1; 6548 6549 // Split the offset string to obtain a list of values and operands 6550 // The regex addresses values with the plus or minus sign in front (+10, -20, etc) 6551 var fragments = offset.split(/(\+|\-)/).map(function (frag) { 6552 return frag.trim(); 6553 }); 6554 6555 // Detect if the offset string contains a pair of values or a single one 6556 // they could be separated by comma or space 6557 var divider = fragments.indexOf(find(fragments, function (frag) { 6558 return frag.search(/,|\s/) !== -1; 6559 })); 6560 6561 if (fragments[divider] && fragments[divider].indexOf(',') === -1) { 6562 console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.'); 6563 } 6564 6565 // If divider is found, we divide the list of values and operands to divide 6566 // them by ofset X and Y. 6567 var splitRegex = /\s*,\s*|\s+/; 6568 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]; 6569 6570 // Convert the values with units to absolute pixels to allow our computations 6571 ops = ops.map(function (op, index) { 6572 // Most of the units rely on the orientation of the popper 6573 var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width'; 6574 var mergeWithPrevious = false; 6575 return op 6576 // This aggregates any `+` or `-` sign that aren't considered operators 6577 // e.g.: 10 + +5 => [10, +, +5] 6578 .reduce(function (a, b) { 6579 if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) { 6580 a[a.length - 1] = b; 6581 mergeWithPrevious = true; 6582 return a; 6583 } else if (mergeWithPrevious) { 6584 a[a.length - 1] += b; 6585 mergeWithPrevious = false; 6586 return a; 6587 } else { 6588 return a.concat(b); 6589 } 6590 }, []) 6591 // Here we convert the string values into number values (in px) 6592 .map(function (str) { 6593 return toValue(str, measurement, popperOffsets, referenceOffsets); 6594 }); 6595 }); 6596 6597 // Loop trough the offsets arrays and execute the operations 6598 ops.forEach(function (op, index) { 6599 op.forEach(function (frag, index2) { 6600 if (isNumeric(frag)) { 6601 offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1); 6602 } 6603 }); 6604 }); 6605 return offsets; 6606 } 6607 6608 /** 6609 * @function 6610 * @memberof Modifiers 6611 * @argument {Object} data - The data object generated by update method 6612 * @argument {Object} options - Modifiers configuration and options 6613 * @argument {Number|String} options.offset=0 6614 * The offset value as described in the modifier description 6615 * @returns {Object} The data object, properly modified 6616 */ 6617 function offset(data, _ref) { 6618 var offset = _ref.offset; 6619 var placement = data.placement, 6620 _data$offsets = data.offsets, 6621 popper = _data$offsets.popper, 6622 reference = _data$offsets.reference; 6623 6624 var basePlacement = placement.split('-')[0]; 6625 6626 var offsets = void 0; 6627 if (isNumeric(+offset)) { 6628 offsets = [+offset, 0]; 6629 } else { 6630 offsets = parseOffset(offset, popper, reference, basePlacement); 6631 } 6632 6633 if (basePlacement === 'left') { 6634 popper.top += offsets[0]; 6635 popper.left -= offsets[1]; 6636 } else if (basePlacement === 'right') { 6637 popper.top += offsets[0]; 6638 popper.left += offsets[1]; 6639 } else if (basePlacement === 'top') { 6640 popper.left += offsets[0]; 6641 popper.top -= offsets[1]; 6642 } else if (basePlacement === 'bottom') { 6643 popper.left += offsets[0]; 6644 popper.top += offsets[1]; 6645 } 6646 6647 data.popper = popper; 6648 return data; 6649 } 6650 6651 /** 6652 * @function 6653 * @memberof Modifiers 6654 * @argument {Object} data - The data object generated by `update` method 6655 * @argument {Object} options - Modifiers configuration and options 6656 * @returns {Object} The data object, properly modified 6657 */ 6658 function preventOverflow(data, options) { 6659 var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper); 6660 6661 // If offsetParent is the reference element, we really want to 6662 // go one step up and use the next offsetParent as reference to 6663 // avoid to make this modifier completely useless and look like broken 6664 if (data.instance.reference === boundariesElement) { 6665 boundariesElement = getOffsetParent(boundariesElement); 6666 } 6667 6668 // NOTE: DOM access here 6669 // resets the popper's position so that the document size can be calculated excluding 6670 // the size of the popper element itself 6671 var transformProp = getSupportedPropertyName('transform'); 6672 var popperStyles = data.instance.popper.style; // assignment to help minification 6673 var top = popperStyles.top, 6674 left = popperStyles.left, 6675 transform = popperStyles[transformProp]; 6676 6677 popperStyles.top = ''; 6678 popperStyles.left = ''; 6679 popperStyles[transformProp] = ''; 6680 6681 var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed); 6682 6683 // NOTE: DOM access here 6684 // restores the original style properties after the offsets have been computed 6685 popperStyles.top = top; 6686 popperStyles.left = left; 6687 popperStyles[transformProp] = transform; 6688 6689 options.boundaries = boundaries; 6690 6691 var order = options.priority; 6692 var popper = data.offsets.popper; 6693 6694 var check = { 6695 primary: function primary(placement) { 6696 var value = popper[placement]; 6697 if (popper[placement] < boundaries[placement] && !options.escapeWithReference) { 6698 value = Math.max(popper[placement], boundaries[placement]); 6699 } 6700 return defineProperty({}, placement, value); 6701 }, 6702 secondary: function secondary(placement) { 6703 var mainSide = placement === 'right' ? 'left' : 'top'; 6704 var value = popper[mainSide]; 6705 if (popper[placement] > boundaries[placement] && !options.escapeWithReference) { 6706 value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height)); 6707 } 6708 return defineProperty({}, mainSide, value); 6709 } 6710 }; 6711 6712 order.forEach(function (placement) { 6713 var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary'; 6714 popper = _extends({}, popper, check[side](placement)); 6715 }); 6716 6717 data.offsets.popper = popper; 6718 6719 return data; 6720 } 6721 6722 /** 6723 * @function 6724 * @memberof Modifiers 6725 * @argument {Object} data - The data object generated by `update` method 6726 * @argument {Object} options - Modifiers configuration and options 6727 * @returns {Object} The data object, properly modified 6728 */ 6729 function shift(data) { 6730 var placement = data.placement; 6731 var basePlacement = placement.split('-')[0]; 6732 var shiftvariation = placement.split('-')[1]; 6733 6734 // if shift shiftvariation is specified, run the modifier 6735 if (shiftvariation) { 6736 var _data$offsets = data.offsets, 6737 reference = _data$offsets.reference, 6738 popper = _data$offsets.popper; 6739 6740 var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1; 6741 var side = isVertical ? 'left' : 'top'; 6742 var measurement = isVertical ? 'width' : 'height'; 6743 6744 var shiftOffsets = { 6745 start: defineProperty({}, side, reference[side]), 6746 end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement]) 6747 }; 6748 6749 data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]); 6750 } 6751 6752 return data; 6753 } 6754 6755 /** 6756 * @function 6757 * @memberof Modifiers 6758 * @argument {Object} data - The data object generated by update method 6759 * @argument {Object} options - Modifiers configuration and options 6760 * @returns {Object} The data object, properly modified 6761 */ 6762 function hide(data) { 6763 if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) { 6764 return data; 6765 } 6766 6767 var refRect = data.offsets.reference; 6768 var bound = find(data.instance.modifiers, function (modifier) { 6769 return modifier.name === 'preventOverflow'; 6770 }).boundaries; 6771 6772 if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) { 6773 // Avoid unnecessary DOM access if visibility hasn't changed 6774 if (data.hide === true) { 6775 return data; 6776 } 6777 6778 data.hide = true; 6779 data.attributes['x-out-of-boundaries'] = ''; 6780 } else { 6781 // Avoid unnecessary DOM access if visibility hasn't changed 6782 if (data.hide === false) { 6783 return data; 6784 } 6785 6786 data.hide = false; 6787 data.attributes['x-out-of-boundaries'] = false; 6788 } 6789 6790 return data; 6791 } 6792 6793 /** 6794 * @function 6795 * @memberof Modifiers 6796 * @argument {Object} data - The data object generated by `update` method 6797 * @argument {Object} options - Modifiers configuration and options 6798 * @returns {Object} The data object, properly modified 6799 */ 6800 function inner(data) { 6801 var placement = data.placement; 6802 var basePlacement = placement.split('-')[0]; 6803 var _data$offsets = data.offsets, 6804 popper = _data$offsets.popper, 6805 reference = _data$offsets.reference; 6806 6807 var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1; 6808 6809 var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1; 6810 6811 popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0); 6812 6813 data.placement = getOppositePlacement(placement); 6814 data.offsets.popper = getClientRect(popper); 6815 6816 return data; 6817 } 6818 6819 /** 6820 * Modifier function, each modifier can have a function of this type assigned 6821 * to its `fn` property.<br /> 6822 * These functions will be called on each update, this means that you must 6823 * make sure they are performant enough to avoid performance bottlenecks. 6824 * 6825 * @function ModifierFn 6826 * @argument {dataObject} data - The data object generated by `update` method 6827 * @argument {Object} options - Modifiers configuration and options 6828 * @returns {dataObject} The data object, properly modified 6829 */ 6830 6831 /** 6832 * Modifiers are plugins used to alter the behavior of your poppers.<br /> 6833 * Popper.js uses a set of 9 modifiers to provide all the basic functionalities 6834 * needed by the library. 6835 * 6836 * Usually you don't want to override the `order`, `fn` and `onLoad` props. 6837 * All the other properties are configurations that could be tweaked. 6838 * @namespace modifiers 6839 */ 6840 var modifiers = { 6841 /** 6842 * Modifier used to shift the popper on the start or end of its reference 6843 * element.<br /> 6844 * It will read the variation of the `placement` property.<br /> 6845 * It can be one either `-end` or `-start`. 6846 * @memberof modifiers 6847 * @inner 6848 */ 6849 shift: { 6850 /** @prop {number} order=100 - Index used to define the order of execution */ 6851 order: 100, 6852 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 6853 enabled: true, 6854 /** @prop {ModifierFn} */ 6855 fn: shift 6856 }, 6857 6858 /** 6859 * The `offset` modifier can shift your popper on both its axis. 6860 * 6861 * It accepts the following units: 6862 * - `px` or unit-less, interpreted as pixels 6863 * - `%` or `%r`, percentage relative to the length of the reference element 6864 * - `%p`, percentage relative to the length of the popper element 6865 * - `vw`, CSS viewport width unit 6866 * - `vh`, CSS viewport height unit 6867 * 6868 * For length is intended the main axis relative to the placement of the popper.<br /> 6869 * This means that if the placement is `top` or `bottom`, the length will be the 6870 * `width`. In case of `left` or `right`, it will be the `height`. 6871 * 6872 * You can provide a single value (as `Number` or `String`), or a pair of values 6873 * as `String` divided by a comma or one (or more) white spaces.<br /> 6874 * The latter is a deprecated method because it leads to confusion and will be 6875 * removed in v2.<br /> 6876 * Additionally, it accepts additions and subtractions between different units. 6877 * Note that multiplications and divisions aren't supported. 6878 * 6879 * Valid examples are: 6880 * ``` 6881 * 10 6882 * '10%' 6883 * '10, 10' 6884 * '10%, 10' 6885 * '10 + 10%' 6886 * '10 - 5vh + 3%' 6887 * '-10px + 5vh, 5px - 6%' 6888 * ``` 6889 * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap 6890 * > with their reference element, unfortunately, you will have to disable the `flip` modifier. 6891 * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373). 6892 * 6893 * @memberof modifiers 6894 * @inner 6895 */ 6896 offset: { 6897 /** @prop {number} order=200 - Index used to define the order of execution */ 6898 order: 200, 6899 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 6900 enabled: true, 6901 /** @prop {ModifierFn} */ 6902 fn: offset, 6903 /** @prop {Number|String} offset=0 6904 * The offset value as described in the modifier description 6905 */ 6906 offset: 0 6907 }, 6908 6909 /** 6910 * Modifier used to prevent the popper from being positioned outside the boundary. 6911 * 6912 * A scenario exists where the reference itself is not within the boundaries.<br /> 6913 * We can say it has "escaped the boundaries" — or just "escaped".<br /> 6914 * In this case we need to decide whether the popper should either: 6915 * 6916 * - detach from the reference and remain "trapped" in the boundaries, or 6917 * - if it should ignore the boundary and "escape with its reference" 6918 * 6919 * When `escapeWithReference` is set to`true` and reference is completely 6920 * outside its boundaries, the popper will overflow (or completely leave) 6921 * the boundaries in order to remain attached to the edge of the reference. 6922 * 6923 * @memberof modifiers 6924 * @inner 6925 */ 6926 preventOverflow: { 6927 /** @prop {number} order=300 - Index used to define the order of execution */ 6928 order: 300, 6929 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 6930 enabled: true, 6931 /** @prop {ModifierFn} */ 6932 fn: preventOverflow, 6933 /** 6934 * @prop {Array} [priority=['left','right','top','bottom']] 6935 * Popper will try to prevent overflow following these priorities by default, 6936 * then, it could overflow on the left and on top of the `boundariesElement` 6937 */ 6938 priority: ['left', 'right', 'top', 'bottom'], 6939 /** 6940 * @prop {number} padding=5 6941 * Amount of pixel used to define a minimum distance between the boundaries 6942 * and the popper. This makes sure the popper always has a little padding 6943 * between the edges of its container 6944 */ 6945 padding: 5, 6946 /** 6947 * @prop {String|HTMLElement} boundariesElement='scrollParent' 6948 * Boundaries used by the modifier. Can be `scrollParent`, `window`, 6949 * `viewport` or any DOM element. 6950 */ 6951 boundariesElement: 'scrollParent' 6952 }, 6953 6954 /** 6955 * Modifier used to make sure the reference and its popper stay near each other 6956 * without leaving any gap between the two. Especially useful when the arrow is 6957 * enabled and you want to ensure that it points to its reference element. 6958 * It cares only about the first axis. You can still have poppers with margin 6959 * between the popper and its reference element. 6960 * @memberof modifiers 6961 * @inner 6962 */ 6963 keepTogether: { 6964 /** @prop {number} order=400 - Index used to define the order of execution */ 6965 order: 400, 6966 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 6967 enabled: true, 6968 /** @prop {ModifierFn} */ 6969 fn: keepTogether 6970 }, 6971 6972 /** 6973 * This modifier is used to move the `arrowElement` of the popper to make 6974 * sure it is positioned between the reference element and its popper element. 6975 * It will read the outer size of the `arrowElement` node to detect how many 6976 * pixels of conjunction are needed. 6977 * 6978 * It has no effect if no `arrowElement` is provided. 6979 * @memberof modifiers 6980 * @inner 6981 */ 6982 arrow: { 6983 /** @prop {number} order=500 - Index used to define the order of execution */ 6984 order: 500, 6985 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 6986 enabled: true, 6987 /** @prop {ModifierFn} */ 6988 fn: arrow, 6989 /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */ 6990 element: '[x-arrow]' 6991 }, 6992 6993 /** 6994 * Modifier used to flip the popper's placement when it starts to overlap its 6995 * reference element. 6996 * 6997 * Requires the `preventOverflow` modifier before it in order to work. 6998 * 6999 * **NOTE:** this modifier will interrupt the current update cycle and will 7000 * restart it if it detects the need to flip the placement. 7001 * @memberof modifiers 7002 * @inner 7003 */ 7004 flip: { 7005 /** @prop {number} order=600 - Index used to define the order of execution */ 7006 order: 600, 7007 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 7008 enabled: true, 7009 /** @prop {ModifierFn} */ 7010 fn: flip, 7011 /** 7012 * @prop {String|Array} behavior='flip' 7013 * The behavior used to change the popper's placement. It can be one of 7014 * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid 7015 * placements (with optional variations) 7016 */ 7017 behavior: 'flip', 7018 /** 7019 * @prop {number} padding=5 7020 * The popper will flip if it hits the edges of the `boundariesElement` 7021 */ 7022 padding: 5, 7023 /** 7024 * @prop {String|HTMLElement} boundariesElement='viewport' 7025 * The element which will define the boundaries of the popper position. 7026 * The popper will never be placed outside of the defined boundaries 7027 * (except if `keepTogether` is enabled) 7028 */ 7029 boundariesElement: 'viewport', 7030 /** 7031 * @prop {Boolean} flipVariations=false 7032 * The popper will switch placement variation between `-start` and `-end` when 7033 * the reference element overlaps its boundaries. 7034 * 7035 * The original placement should have a set variation. 7036 */ 7037 flipVariations: false, 7038 /** 7039 * @prop {Boolean} flipVariationsByContent=false 7040 * The popper will switch placement variation between `-start` and `-end` when 7041 * the popper element overlaps its reference boundaries. 7042 * 7043 * The original placement should have a set variation. 7044 */ 7045 flipVariationsByContent: false 7046 }, 7047 7048 /** 7049 * Modifier used to make the popper flow toward the inner of the reference element. 7050 * By default, when this modifier is disabled, the popper will be placed outside 7051 * the reference element. 7052 * @memberof modifiers 7053 * @inner 7054 */ 7055 inner: { 7056 /** @prop {number} order=700 - Index used to define the order of execution */ 7057 order: 700, 7058 /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */ 7059 enabled: false, 7060 /** @prop {ModifierFn} */ 7061 fn: inner 7062 }, 7063 7064 /** 7065 * Modifier used to hide the popper when its reference element is outside of the 7066 * popper boundaries. It will set a `x-out-of-boundaries` attribute which can 7067 * be used to hide with a CSS selector the popper when its reference is 7068 * out of boundaries. 7069 * 7070 * Requires the `preventOverflow` modifier before it in order to work. 7071 * @memberof modifiers 7072 * @inner 7073 */ 7074 hide: { 7075 /** @prop {number} order=800 - Index used to define the order of execution */ 7076 order: 800, 7077 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 7078 enabled: true, 7079 /** @prop {ModifierFn} */ 7080 fn: hide 7081 }, 7082 7083 /** 7084 * Computes the style that will be applied to the popper element to gets 7085 * properly positioned. 7086 * 7087 * Note that this modifier will not touch the DOM, it just prepares the styles 7088 * so that `applyStyle` modifier can apply it. This separation is useful 7089 * in case you need to replace `applyStyle` with a custom implementation. 7090 * 7091 * This modifier has `850` as `order` value to maintain backward compatibility 7092 * with previous versions of Popper.js. Expect the modifiers ordering method 7093 * to change in future major versions of the library. 7094 * 7095 * @memberof modifiers 7096 * @inner 7097 */ 7098 computeStyle: { 7099 /** @prop {number} order=850 - Index used to define the order of execution */ 7100 order: 850, 7101 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 7102 enabled: true, 7103 /** @prop {ModifierFn} */ 7104 fn: computeStyle, 7105 /** 7106 * @prop {Boolean} gpuAcceleration=true 7107 * If true, it uses the CSS 3D transformation to position the popper. 7108 * Otherwise, it will use the `top` and `left` properties 7109 */ 7110 gpuAcceleration: true, 7111 /** 7112 * @prop {string} [x='bottom'] 7113 * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin. 7114 * Change this if your popper should grow in a direction different from `bottom` 7115 */ 7116 x: 'bottom', 7117 /** 7118 * @prop {string} [x='left'] 7119 * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin. 7120 * Change this if your popper should grow in a direction different from `right` 7121 */ 7122 y: 'right' 7123 }, 7124 7125 /** 7126 * Applies the computed styles to the popper element. 7127 * 7128 * All the DOM manipulations are limited to this modifier. This is useful in case 7129 * you want to integrate Popper.js inside a framework or view library and you 7130 * want to delegate all the DOM manipulations to it. 7131 * 7132 * Note that if you disable this modifier, you must make sure the popper element 7133 * has its position set to `absolute` before Popper.js can do its work! 7134 * 7135 * Just disable this modifier and define your own to achieve the desired effect. 7136 * 7137 * @memberof modifiers 7138 * @inner 7139 */ 7140 applyStyle: { 7141 /** @prop {number} order=900 - Index used to define the order of execution */ 7142 order: 900, 7143 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 7144 enabled: true, 7145 /** @prop {ModifierFn} */ 7146 fn: applyStyle, 7147 /** @prop {Function} */ 7148 onLoad: applyStyleOnLoad, 7149 /** 7150 * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier 7151 * @prop {Boolean} gpuAcceleration=true 7152 * If true, it uses the CSS 3D transformation to position the popper. 7153 * Otherwise, it will use the `top` and `left` properties 7154 */ 7155 gpuAcceleration: undefined 7156 } 7157 }; 7158 7159 /** 7160 * The `dataObject` is an object containing all the information used by Popper.js. 7161 * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks. 7162 * @name dataObject 7163 * @property {Object} data.instance The Popper.js instance 7164 * @property {String} data.placement Placement applied to popper 7165 * @property {String} data.originalPlacement Placement originally defined on init 7166 * @property {Boolean} data.flipped True if popper has been flipped by flip modifier 7167 * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper 7168 * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier 7169 * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`) 7170 * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`) 7171 * @property {Object} data.boundaries Offsets of the popper boundaries 7172 * @property {Object} data.offsets The measurements of popper, reference and arrow elements 7173 * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values 7174 * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values 7175 * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0 7176 */ 7177 7178 /** 7179 * Default options provided to Popper.js constructor.<br /> 7180 * These can be overridden using the `options` argument of Popper.js.<br /> 7181 * To override an option, simply pass an object with the same 7182 * structure of the `options` object, as the 3rd argument. For example: 7183 * ``` 7184 * new Popper(ref, pop, { 7185 * modifiers: { 7186 * preventOverflow: { enabled: false } 7187 * } 7188 * }) 7189 * ``` 7190 * @type {Object} 7191 * @static 7192 * @memberof Popper 7193 */ 7194 var Defaults = { 7195 /** 7196 * Popper's placement. 7197 * @prop {Popper.placements} placement='bottom' 7198 */ 7199 placement: 'bottom', 7200 7201 /** 7202 * Set this to true if you want popper to position it self in 'fixed' mode 7203 * @prop {Boolean} positionFixed=false 7204 */ 7205 positionFixed: false, 7206 7207 /** 7208 * Whether events (resize, scroll) are initially enabled. 7209 * @prop {Boolean} eventsEnabled=true 7210 */ 7211 eventsEnabled: true, 7212 7213 /** 7214 * Set to true if you want to automatically remove the popper when 7215 * you call the `destroy` method. 7216 * @prop {Boolean} removeOnDestroy=false 7217 */ 7218 removeOnDestroy: false, 7219 7220 /** 7221 * Callback called when the popper is created.<br /> 7222 * By default, it is set to no-op.<br /> 7223 * Access Popper.js instance with `data.instance`. 7224 * @prop {onCreate} 7225 */ 7226 onCreate: function onCreate() {}, 7227 7228 /** 7229 * Callback called when the popper is updated. This callback is not called 7230 * on the initialization/creation of the popper, but only on subsequent 7231 * updates.<br /> 7232 * By default, it is set to no-op.<br /> 7233 * Access Popper.js instance with `data.instance`. 7234 * @prop {onUpdate} 7235 */ 7236 onUpdate: function onUpdate() {}, 7237 7238 /** 7239 * List of modifiers used to modify the offsets before they are applied to the popper. 7240 * They provide most of the functionalities of Popper.js. 7241 * @prop {modifiers} 7242 */ 7243 modifiers: modifiers 7244 }; 7245 7246 /** 7247 * @callback onCreate 7248 * @param {dataObject} data 7249 */ 7250 7251 /** 7252 * @callback onUpdate 7253 * @param {dataObject} data 7254 */ 7255 7256 // Utils 7257 // Methods 7258 var Popper = function () { 7259 /** 7260 * Creates a new Popper.js instance. 7261 * @class Popper 7262 * @param {Element|referenceObject} reference - The reference element used to position the popper 7263 * @param {Element} popper - The HTML / XML element used as the popper 7264 * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults) 7265 * @return {Object} instance - The generated Popper.js instance 7266 */ 7267 function Popper(reference, popper) { 7268 var _this = this; 7269 7270 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; 7271 classCallCheck(this, Popper); 7272 7273 this.scheduleUpdate = function () { 7274 return requestAnimationFrame(_this.update); 7275 }; 7276 7277 // make update() debounced, so that it only runs at most once-per-tick 7278 this.update = debounce(this.update.bind(this)); 7279 7280 // with {} we create a new object with the options inside it 7281 this.options = _extends({}, Popper.Defaults, options); 7282 7283 // init state 7284 this.state = { 7285 isDestroyed: false, 7286 isCreated: false, 7287 scrollParents: [] 7288 }; 7289 7290 // get reference and popper elements (allow jQuery wrappers) 7291 this.reference = reference && reference.jquery ? reference[0] : reference; 7292 this.popper = popper && popper.jquery ? popper[0] : popper; 7293 7294 // Deep merge modifiers options 7295 this.options.modifiers = {}; 7296 Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) { 7297 _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {}); 7298 }); 7299 7300 // Refactoring modifiers' list (Object => Array) 7301 this.modifiers = Object.keys(this.options.modifiers).map(function (name) { 7302 return _extends({ 7303 name: name 7304 }, _this.options.modifiers[name]); 7305 }) 7306 // sort the modifiers by order 7307 .sort(function (a, b) { 7308 return a.order - b.order; 7309 }); 7310 7311 // modifiers have the ability to execute arbitrary code when Popper.js get inited 7312 // such code is executed in the same order of its modifier 7313 // they could add new properties to their options configuration 7314 // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`! 7315 this.modifiers.forEach(function (modifierOptions) { 7316 if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) { 7317 modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state); 7318 } 7319 }); 7320 7321 // fire the first update to position the popper in the right place 7322 this.update(); 7323 7324 var eventsEnabled = this.options.eventsEnabled; 7325 if (eventsEnabled) { 7326 // setup event listeners, they will take care of update the position in specific situations 7327 this.enableEventListeners(); 7328 } 7329 7330 this.state.eventsEnabled = eventsEnabled; 7331 } 7332 7333 // We can't use class properties because they don't get listed in the 7334 // class prototype and break stuff like Sinon stubs 7335 7336 7337 createClass(Popper, [{ 7338 key: 'update', 7339 value: function update$$1() { 7340 return update.call(this); 7341 } 7342 }, { 7343 key: 'destroy', 7344 value: function destroy$$1() { 7345 return destroy.call(this); 7346 } 7347 }, { 7348 key: 'enableEventListeners', 7349 value: function enableEventListeners$$1() { 7350 return enableEventListeners.call(this); 7351 } 7352 }, { 7353 key: 'disableEventListeners', 7354 value: function disableEventListeners$$1() { 7355 return disableEventListeners.call(this); 7356 } 7357 7358 /** 7359 * Schedules an update. It will run on the next UI update available. 7360 * @method scheduleUpdate 7361 * @memberof Popper 7362 */ 7363 7364 7365 /** 7366 * Collection of utilities useful when writing custom modifiers. 7367 * Starting from version 1.7, this method is available only if you 7368 * include `popper-utils.js` before `popper.js`. 7369 * 7370 * **DEPRECATION**: This way to access PopperUtils is deprecated 7371 * and will be removed in v2! Use the PopperUtils module directly instead. 7372 * Due to the high instability of the methods contained in Utils, we can't 7373 * guarantee them to follow semver. Use them at your own risk! 7374 * @static 7375 * @private 7376 * @type {Object} 7377 * @deprecated since version 1.8 7378 * @member Utils 7379 * @memberof Popper 7380 */ 7381 7382 }]); 7383 return Popper; 7384 }(); 7385 7386 /** 7387 * The `referenceObject` is an object that provides an interface compatible with Popper.js 7388 * and lets you use it as replacement of a real DOM node.<br /> 7389 * You can use this method to position a popper relatively to a set of coordinates 7390 * in case you don't have a DOM node to use as reference. 7391 * 7392 * ``` 7393 * new Popper(referenceObject, popperNode); 7394 * ``` 7395 * 7396 * NB: This feature isn't supported in Internet Explorer 10. 7397 * @name referenceObject 7398 * @property {Function} data.getBoundingClientRect 7399 * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method. 7400 * @property {number} data.clientWidth 7401 * An ES6 getter that will return the width of the virtual reference element. 7402 * @property {number} data.clientHeight 7403 * An ES6 getter that will return the height of the virtual reference element. 7404 */ 7405 7406 7407 Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils; 7408 Popper.placements = placements; 7409 Popper.Defaults = Defaults; 7410 7411 var Popper$1 = Popper; 7412 7413 /** 7414 *
7414-------------------------------------------------------------------------- 7415 * Bootstrap (v4.6.0): tooltip.js 7416 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 7417 * -------------------------------------------------------------------------- 7418 */ 7419 7420 /** 7421 * ------------------------------------------------------------------------ 7422 * Constants 7423 * ------------------------------------------------------------------------ 7424 */ 7425 7426 const NAME$4 = 'tooltip'; 7427 const VERSION$4 = '4.6.0'; 7428 const DATA_KEY$4 = 'bs.tooltip'; 7429 const EVENT_KEY$4 = `.${DATA_KEY$4}`; 7430 const JQUERY_NO_CONFLICT$4 = $__default["default"].fn[NAME$4]; 7431 const CLASS_PREFIX$1 = 'bs-tooltip'; 7432 const BSCLS_PREFIX_REGEX$1 = new RegExp(`(^|\\s)${CLASS_PREFIX$1}\\S+`, 'g'); 7433 const DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn']; 7434 7435 const DefaultType$3 = { 7436 animation: 'boolean', 7437 template: 'string', 7438 title: '(string|element|function)', 7439 trigger: 'string', 7440 delay: '(number|object)', 7441 html: 'boolean', 7442 selector: '(string|boolean)', 7443 placement: '(string|function)', 7444 offset: '(number|string|function)', 7445 container: '(string|element|boolean)', 7446 fallbackPlacement: '(string|array)', 7447 boundary: '(string|element)', 7448 customClass: '(string|function)', 7449 sanitize: 'boolean', 7450 sanitizeFn: '(null|function)', 7451 whiteList: 'object', 7452 popperConfig: '(null|object)' 7453 }; 7454 7455 const AttachmentMap = { 7456 AUTO: 'auto', 7457 TOP: 'top', 7458 RIGHT: 'right', 7459 BOTTOM: 'bottom', 7460 LEFT: 'left' 7461 }; 7462 7463 const Default$3 = { 7464 animation: true, 7465 template: '<div class="tooltip" role="tooltip">' + 7466 '<div class="arrow"></div>' + 7467 '<div class="tooltip-inner"></div></div>', 7468 trigger: 'hover focus', 7469 title: '', 7470 delay: 0, 7471 html: false, 7472 selector: false, 7473 placement: 'top', 7474 offset: 0, 7475 container: false, 7476 fallbackPlacement: 'flip', 7477 boundary: 'scrollParent', 7478 customClass: '', 7479 sanitize: true, 7480 sanitizeFn: null, 7481 whiteList: DefaultWhitelist, 7482 popperConfig: null 7483 }; 7484 7485 const HOVER_STATE_SHOW = 'show'; 7486 const HOVER_STATE_OUT = 'out'; 7487 7488 const Event$1 = { 7489 HIDE: `hide${EVENT_KEY$4}`, 7490 HIDDEN: `hidden${EVENT_KEY$4}`, 7491 SHOW: `show${EVENT_KEY$4}`, 7492 SHOWN: `shown${EVENT_KEY$4}`, 7493 INSERTED: `inserted${EVENT_KEY$4}`, 7494 CLICK: `click${EVENT_KEY$4}`, 7495 FOCUSIN: `focusin${EVENT_KEY$4}`, 7496 FOCUSOUT: `focusout${EVENT_KEY$4}`, 7497 MOUSEENTER: `mouseenter${EVENT_KEY$4}`, 7498 MOUSELEAVE: `mouseleave${EVENT_KEY$4}` 7499 }; 7500 7501 const CLASS_NAME_FADE$3 = 'fade';
7502 const CLASS_NAME_SHOW$3 = 'show'; 7503 7504 const SELECTOR_TOOLTIP_INNER = '.tooltip-inner'; 7505 const SELECTOR_ARROW = '.arrow'; 7506 7507 const TRIGGER_HOVER = 'hover'; 7508 const TRIGGER_FOCUS = 'focus'; 7509 const TRIGGER_CLICK = 'click'; 7510 const TRIGGER_MANUAL = 'manual'; 7511 7512 /** 7513 * ------------------------------------------------------------------------ 7514 * Class Definition 7515 * ------------------------------------------------------------------------ 7516 */ 7517 7518 class Tooltip { 7519 constructor(element, config) { 7520 if (typeof Popper$1 === 'undefined') { 7521 throw new TypeError('Bootstrap\'s tooltips require Popper (https://popper.js.org)') 7522 } 7523 7524 // private 7525 this._isEnabled = true; 7526 this._timeout = 0; 7527 this._hoverState = ''; 7528 this._activeTrigger = {}; 7529 this._popper = null; 7530 7531 // Protected 7532 this.element = element; 7533 this.config = this._getConfig(config); 7534 this.tip = null; 7535 7536 this._setListeners(); 7537 } 7538 7539 // Getters 7540 7541 static get VERSION() { 7542 return VERSION$4 7543 } 7544 7545 static get Default() { 7546 return Default$3 7547 } 7548 7549 static get NAME() { 7550 return NAME$4 7551 } 7552 7553 static get DATA_KEY() { 7554 return DATA_KEY$4 7555 } 7556 7557 static get Event() { 7558 return Event$1 7559 } 7560 7561 static get EVENT_KEY() { 7562 return EVENT_KEY$4 7563 } 7564 7565 static get DefaultType() { 7566 return DefaultType$3 7567 } 7568 7569 // Public 7570 7571 enable() { 7572 this._isEnabled = true; 7573 } 7574 7575 disable() { 7576 this._isEnabled = false; 7577 } 7578 7579 toggleEnabled() { 7580 this._isEnabled = !this._isEnabled; 7581 } 7582 7583 toggle(event) { 7584 if (!this._isEnabled) { 7585 return 7586 } 7587 7588 if (event) { 7589 const dataKey = this.constructor.DATA_KEY; 7590 let context = $__default["default"](event.currentTarget).data(dataKey); 7591 7592 if (!context) { 7593 context = new this.constructor( 7594 event.currentTarget, 7595 this._getDelegateConfig() 7596 ); 7597 $__default["default"](event.currentTarget).data(dataKey, context); 7598 } 7599 7600 context._activeTrigger.click = !context._activeTrigger.click; 7601 7602 if (context._isWithActiveTrigger()) { 7603 context._enter(null, context); 7604 } else { 7605 context._leave(null, context); 7606 } 7607 } else { 7608 if ($__default["default"](this.getTipElement()).hasClass(CLASS_NAME_SHOW$3)) { 7609 this._leave(null, this); 7610 return 7611 } 7612 7613 this._enter(null, this); 7614 } 7615 } 7616 7617 dispose() { 7618 clearTimeout(this._timeout); 7619 7620 $__default["default"].removeData(this.element, this.constructor.DATA_KEY); 7621 7622 $__default["default"](this.element).off(this.constructor.EVENT_KEY); 7623 $__default["default"](this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler); 7624 7625 if (this.tip) { 7626 $__default["default"](this.tip).remove(); 7627 } 7628 7629 this._isEnabled = null; 7630 this._timeout = null; 7631 this._hoverState = null; 7632 this._activeTrigger = null; 7633 if (this._popper) { 7634 this._popper.destroy(); 7635 } 7636 7637 this._popper = null; 7638 this.element = null; 7639 this.config = null; 7640 this.tip = null; 7641 } 7642 7643 show() { 7644 if ($__default["default"](this.element).css('display') === 'none') { 7645 throw new Error('Please use show on visible elements') 7646 } 7647 7648 const showEvent = $__default["default"].Event(this.constructor.Event.SHOW); 7649 if (this.isWithContent() && this._isEnabled) { 7650 $__default["default"](this.element).trigger(showEvent); 7651 7652 const shadowRoot = Util.findShadowRoot(this.element); 7653 const isInTheDom = $__default["default"].contains( 7654 shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, 7655 this.element 7656 ); 7657 7658 if (showEvent.isDefaultPrevented() || !isInTheDom) { 7659 return 7660 } 7661 7662 const tip = this.getTipElement(); 7663 const tipId = Util.getUID(this.constructor.NAME); 7664
7665 tip.setAttribute('id', tipId); 7666 this.element.setAttribute('aria-describedby', tipId); 7667 7668 this.setContent(); 7669 7670 if (this.config.animation) { 7671 $__default["default"](tip).addClass(CLASS_NAME_FADE$3); 7672 } 7673 7674 const placement = typeof this.config.placement === 'function' ? 7675 this.config.placement.call(this, tip, this.element) : 7676 this.config.placement; 7677 7678 const attachment = this._getAttachment(placement); 7679 this.addAttachmentClass(attachment); 7680 7681 const container = this._getContainer(); 7682 $__default["default"](tip).data(this.constructor.DATA_KEY, this); 7683 7684 if (!$__default["default"].contains(this.element.ownerDocument.documentElement, this.tip)) { 7685 $__default["default"](tip).appendTo(container); 7686 } 7687 7688 $__default["default"](this.element).trigger(this.constructor.Event.INSERTED); 7689 7690 this._popper = new Popper$1(this.element, tip, this._getPopperConfig(attachment)); 7691 7692 $__default["default"](tip).addClass(CLASS_NAME_SHOW$3); 7693 $__default["default"](tip).addClass(this.config.customClass); 7694 7695 // If this is a touch-enabled device we add extra 7696 // empty mouseover listeners to the body's immediate children; 7697 // only needed because of broken event delegation on iOS 7698 // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html 7699 if ('ontouchstart' in document.documentElement) { 7700 $__default["default"](document.body).children().on('mouseover', null, $__default["default"].noop); 7701 } 7702 7703 const complete = () => { 7704 if (this.config.animation) { 7705 this._fixTransition(); 7706 } 7707 7708 const prevHoverState = this._hoverState; 7709 this._hoverState = null; 7710 7711 $__default["default"](this.element).trigger(this.constructor.Event.SHOWN); 7712 7713 if (prevHoverState === HOVER_STATE_OUT) { 7714 this._leave(null, this); 7715 } 7716 }; 7717 7718 if ($__default["default"](this.tip).hasClass(CLASS_NAME_FADE$3)) { 7719 const transitionDuration = Util.getTransitionDurationFromElement(this.tip); 7720 7721 $__default["default"](this.tip) 7722 .one(Util.TRANSITION_END, complete) 7723 .emulateTransitionEnd(transitionDuration); 7724 } else { 7725 complete(); 7726 } 7727 } 7728 } 7729 7730 hide(callback) { 7731 const tip = this.getTipElement(); 7732 const hideEvent = $__default["default"].Event(this.constructor.Event.HIDE); 7733 const complete = () => { 7734 if (this._hoverState !== HOVER_STATE_SHOW && tip.parentNode) { 7735 tip.parentNode.removeChild(tip); 7736 } 7737 7738 this._cleanTipClass(); 7739 this.element.removeAttribute('aria-describedby'); 7740 $__default["default"](this.element).trigger(this.constructor.Event.HIDDEN); 7741 if (this._popper !== null) { 7742 this._popper.destroy(); 7743 } 7744 7745 if (callback) { 7746 callback(); 7747 } 7748 }; 7749 7750 $__default["default"](this.element).trigger(hideEvent); 7751 7752 if (hideEvent.isDefaultPrevented()) { 7753 return 7754 } 7755 7756 $__default["default"](tip).removeClass(CLASS_NAME_SHOW$3); 7757 7758 // If this is a touch-enabled device we remove the extra 7759 // empty mouseover listeners we added for iOS support 7760 if ('ontouchstart' in document.documentElement) { 7761 $__default["default"](document.body).children().off('mouseover', null, $__default["default"].noop); 7762 } 7763 7764 this._activeTrigger[TRIGGER_CLICK] = false; 7765 this._activeTrigger[TRIGGER_FOCUS] = false; 7766 this._activeTrigger[TRIGGER_HOVER] = false; 7767 7768 if ($__default["default"](this.tip).hasClass(CLASS_NAME_FADE$3)) { 7769 const transitionDuration = Util.getTransitionDurationFromElement(tip); 7770 7771 $__default["default"](tip) 7772 .one(Util.TRANSITION_END, complete) 7773 .emulateTransitionEnd(transitionDuration); 7774 } else { 7775 complete(); 7776 } 7777 7778 this._hoverState = ''; 7779 } 7780 7781 update() { 7782 if (this._popper !== null) { 7783 this._popper.scheduleUpdate(); 7784 } 7785 } 7786 7787 // Protected 7788 7789 isWithContent() { 7790 return Boolean(this.getTitle()) 7791 } 7792 7793 addAttachmentClass(attachment) { 7794 $__default["default"](this.getTipElement()).addClass(`${CLASS_PREFIX$1}-${attachment}`); 7795 } 7796 7797 getTipElement() { 7798 this.tip = this.tip || $__default["default"](this.config.template)[0]; 7799 return this.tip 7800 } 7801 7802 setContent() { 7803 const tip = this.getTipElement(); 7804 this.setElementContent($__default["default"](tip.querySelectorAll(SELECTOR_TOOLTIP_INNER)), this.getTitle()); 7805 $__default["default"](tip).removeClass(`${CLASS_NAME_FADE$3} ${CLASS_NAME_SHOW$3}`); 7806 } 7807 7808 setElementContent($element, content) { 7809 if (typeof content === 'object' && (content.nodeType || content.jquery)) { 7810 // Content is a DOM node or a jQuery 7811 if (this.config.html) { 7812 if (!$__default["default"](content).parent().is($element)) { 7813 $element.empty().append(content); 7814 } 7815 } else { 7816 $element.text($__default["default"](content).text()); 7817 } 7818 7819 return 7820 } 7821 7822 if (this.config.html) { 7823 if (this.config.sanitize) { 7824 content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn); 7825 } 7826 7827 $element.html(content); 7828 } else { 7829 $element.text(content); 7830 } 7831 } 7832 7833 getTitle() { 7834 let title = this.element.getAttribute('data-original-title'); 7835 7836 if (!title) { 7837 title = typeof this.config.title === 'function' ? 7838 this.config.title.call(this.element) : 7839 this.config.title; 7840 } 7841 7842 return title 7843 } 7844 7845 // Private 7846 7847 _getPopperConfig(attachment) { 7848 const defaultBsConfig = { 7849 placement: attachment, 7850 modifiers: { 7851 offset: this._getOffset(), 7852 flip: { 7853 behavior: this.config.fallbackPlacement 7854 }, 7855 arrow: { 7856 element: SELECTOR_ARROW 7857 }, 7858 preventOverflow: {
7859 boundariesElement: this.config.boundary 7860 } 7861 }, 7862 onCreate: data => { 7863 if (data.originalPlacement !== data.placement) { 7864 this._handlePopperPlacementChange(data); 7865 } 7866 }, 7867 onUpdate: data => this._handlePopperPlacementChange(data) 7868 }; 7869 7870 return { 7871 ...defaultBsConfig, 7872 ...this.config.popperConfig 7873 } 7874 } 7875 7876 _getOffset() { 7877 const offset = {}; 7878 7879 if (typeof this.config.offset === 'function') { 7880 offset.fn = data => { 7881 data.offsets = { 7882 ...data.offsets, 7883 ...(this.config.offset(data.offsets, this.element) || {}) 7884 }; 7885 7886 return data 7887 }; 7888 } else { 7889 offset.offset = this.config.offset; 7890 } 7891 7892 return offset 7893 } 7894 7895 _getContainer() { 7896 if (this.config.container === false) { 7897 return document.body 7898 } 7899 7900 if (Util.isElement(this.config.container)) { 7901 return $__default["default"](this.config.container) 7902 } 7903 7904 return $__default["default"](document).find(this.config.container) 7905 } 7906 7907 _getAttachment(placement) { 7908 return AttachmentMap[placement.toUpperCase()] 7909 } 7910 7911 _setListeners() { 7912 const triggers = this.config.trigger.split(' '); 7913 7914 triggers.forEach(trigger => { 7915 if (trigger === 'click') { 7916 $__default["default"](this.element).on( 7917 this.constructor.Event.CLICK, 7918 this.config.selector, 7919 event => this.toggle(event) 7920 ); 7921 } else if (trigger !== TRIGGER_MANUAL) { 7922 const eventIn = trigger === TRIGGER_HOVER ? 7923 this.constructor.Event.MOUSEENTER : 7924 this.constructor.Event.FOCUSIN; 7925 const eventOut = trigger === TRIGGER_HOVER ? 7926 this.constructor.Event.MOUSELEAVE : 7927 this.constructor.Event.FOCUSOUT; 7928 7929 $__default["default"](this.element) 7930 .on(eventIn, this.config.selector, event => this._enter(event)) 7931 .on(eventOut, this.config.selector, event => this._leave(event)); 7932 } 7933 }); 7934 7935 this._hideModalHandler = () => { 7936 if (this.element) { 7937 this.hide(); 7938 } 7939 }; 7940 7941 $__default["default"](this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler); 7942 7943 if (this.config.selector) { 7944 this.config = { 7945 ...this.config, 7946 trigger: 'manual', 7947 selector: '' 7948 }; 7949 } else { 7950 this._fixTitle(); 7951 } 7952 } 7953 7954 _fixTitle() { 7955 const titleType = typeof this.element.getAttribute('data-original-title'); 7956 7957 if (this.element.getAttribute('title') || titleType !== 'string') { 7958 this.element.setAttribute( 7959 'data-original-title', 7960 this.element.getAttribute('title') || '' 7961 ); 7962 7963 this.element.setAttribute('title', ''); 7964 } 7965 } 7966 7967 _enter(event, context) { 7968 const dataKey = this.constructor.DATA_KEY; 7969 context = context || $__default["default"](event.currentTarget).data(dataKey); 7970 7971 if (!context) { 7972 context = new this.constructor( 7973 event.currentTarget, 7974 this._getDelegateConfig() 7975 ); 7976 $__default["default"](event.currentTarget).data(dataKey, context); 7977 } 7978 7979 if (event) { 7980 context._activeTrigger[ 7981 event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER 7982 ] = true; 7983 } 7984 7985 if ($__default["default"](context.getTipElement()).hasClass(CLASS_NAME_SHOW$3) || context._hoverState === HOVER_STATE_SHOW) { 7986 context._hoverState = HOVER_STATE_SHOW; 7987 return 7988 } 7989 7990 clearTimeout(context._timeout); 7991 7992 context._hoverState = HOVER_STATE_SHOW; 7993 7994 if (!context.config.delay || !context.config.delay.show) { 7995 context.show(); 7996 return 7997 } 7998 7999 context._timeout = setTimeout(() => { 8000 if (context._hoverState === HOVER_STATE_SHOW) { 8001 context.show(); 8002 } 8003 }, context.config.delay.show); 8004 } 8005 8006 _leave(event, context) { 8007 const dataKey = this.constructor.DATA_KEY; 8008 context = context || $__default["default"](event.currentTarget).data(dataKey); 8009 8010 if (!context) { 8011 context = new this.constructor( 8012 event.currentTarget, 8013 this._getDelegateConfig() 8014 ); 8015 $__default["default"](event.currentTarget).data(dataKey, context); 8016 } 8017 8018 if (event) { 8019 context._activeTrigger[ 8020 event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER 8021 ] = false;
8022 } 8023 8024 if (context._isWithActiveTrigger()) { 8025 return 8026 } 8027 8028 clearTimeout(context._timeout); 8029 8030 context._hoverState = HOVER_STATE_OUT; 8031 8032 if (!context.config.delay || !context.config.delay.hide) { 8033 context.hide(); 8034 return 8035 } 8036 8037 context._timeout = setTimeout(() => { 8038 if (context._hoverState === HOVER_STATE_OUT) { 8039 context.hide(); 8040 } 8041 }, context.config.delay.hide); 8042 } 8043 8044 _isWithActiveTrigger() { 8045 for (const trigger in this._activeTrigger) { 8046 if (this._activeTrigger[trigger]) { 8047 return true 8048 } 8049 } 8050 8051 return false 8052 } 8053 8054 _getConfig(config) { 8055 const dataAttributes = $__default["default"](this.element).data(); 8056 8057 Object.keys(dataAttributes) 8058 .forEach(dataAttr => { 8059 if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) { 8060 delete dataAttributes[dataAttr]; 8061 } 8062 }); 8063 8064 config = { 8065 ...this.constructor.Default, 8066 ...dataAttributes, 8067 ...(typeof config === 'object' && config ? config : {}) 8068 }; 8069 8070 if (typeof config.delay === 'number') { 8071 config.delay = { 8072 show: config.delay, 8073 hide: config.delay 8074 }; 8075 } 8076 8077 if (typeof config.title === 'number') { 8078 config.title = config.title.toString(); 8079 } 8080 8081 if (typeof config.content === 'number') { 8082 config.content = config.content.toString(); 8083 } 8084 8085 Util.typeCheckConfig( 8086 NAME$4, 8087 config, 8088 this.constructor.DefaultType 8089 ); 8090 8091 if (config.sanitize) { 8092 config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn); 8093 } 8094 8095 return config 8096 } 8097 8098 _getDelegateConfig() { 8099 const config = {}; 8100 8101 if (this.config) { 8102 for (const key in this.config) { 8103 if (this.constructor.Default[key] !== this.config[key]) { 8104 config[key] = this.config[key]; 8105 } 8106 } 8107 } 8108 8109 return config 8110 } 8111 8112 _cleanTipClass() { 8113 const $tip = $__default["default"](this.getTipElement()); 8114 const tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1); 8115 if (tabClass !== null && tabClass.length) { 8116 $tip.removeClass(tabClass.join('')); 8117 } 8118 } 8119 8120 _handlePopperPlacementChange(popperData) { 8121 this.tip = popperData.instance.popper; 8122 this._cleanTipClass(); 8123 this.addAttachmentClass(this._getAttachment(popperData.placement)); 8124 } 8125 8126 _fixTransition() { 8127 const tip = this.getTipElement(); 8128 const initConfigAnimation = this.config.animation; 8129 8130 if (tip.getAttribute('x-placement') !== null) { 8131 return 8132 } 8133 8134 $__default["default"](tip).removeClass(CLASS_NAME_FADE$3); 8135 this.config.animation = false; 8136 this.hide(); 8137 this.show(); 8138 this.config.animation = initConfigAnimation; 8139 } 8140 8141 // Static 8142 8143 static _jQueryInterface(config) { 8144 return this.each(function () { 8145 const $element = $__default["default"](this); 8146 let data = $element.data(DATA_KEY$4); 8147 const _config = typeof config === 'object' && config; 8148 8149 if (!data && /dispose|hide/.test(config)) { 8150 return 8151 } 8152 8153 if (!data) { 8154 data = new Tooltip(this, _config); 8155 $element.data(DATA_KEY$4, data); 8156 } 8157 8158 if (typeof config === 'string') { 8159 if (typeof data[config] === 'undefined') { 8160 throw new TypeError(`No method named "${config}"`) 8161 } 8162 8163 data[config](); 8164 } 8165 }) 8166 } 8167 } 8168 8169 /** 8170 * ------------------------------------------------------------------------ 8171 * jQuery 8172 * ------------------------------------------------------------------------ 8173 */ 8174 8175 $__default["default"].fn[NAME$4] = Tooltip._jQueryInterface; 8176 $__default["default"].fn[NAME$4].Constructor = Tooltip; 8177 $__default["default"].fn[NAME$4].noConflict = () => { 8178 $__default["default"].fn[NAME$4] = JQUERY_NO_CONFLICT$4; 8179 return Tooltip._jQueryInterface 8180 }; 8181 8182 /** 8183 * -------------------------------------------------------------------------- 8184 * Bootstrap (v4.6.0): popover.js 8185 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 8186 * -------------------------------------------------------------------------- 8187 */ 8188 8189 /** 8190 * ------------------------------------------------------------------------ 8191 * Constants 8192 * ------------------------------------------------------------------------ 8193 */ 8194 8195 const NAME$3 = 'popover'; 8196 const VERSION$3 = '4.6.0'; 8197 const DATA_KEY$3 = 'bs.popover'; 8198 const EVENT_KEY$3 = `.${DATA_KEY$3}`;
8199 const JQUERY_NO_CONFLICT$3 = $__default["default"].fn[NAME$3]; 8200 const CLASS_PREFIX = 'bs-popover'; 8201 const BSCLS_PREFIX_REGEX = new RegExp(`(^|\\s)${CLASS_PREFIX}\\S+`, 'g'); 8202 8203 const Default$2 = { 8204 ...Tooltip.Default, 8205 placement: 'right', 8206 trigger: 'click', 8207 content: '', 8208 template: '<div class="popover" role="tooltip">' + 8209 '<div class="arrow"></div>' + 8210 '<h3 class="popover-header"></h3>' + 8211 '<div class="popover-body"></div></div>' 8212 }; 8213 8214 const DefaultType$2 = { 8215 ...Tooltip.DefaultType, 8216 content: '(string|element|function)' 8217 }; 8218 8219 const CLASS_NAME_FADE$2 = 'fade'; 8220 const CLASS_NAME_SHOW$2 = 'show'; 8221 8222 const SELECTOR_TITLE = '.popover-header'; 8223 const SELECTOR_CONTENT = '.popover-body'; 8224 8225 const Event = { 8226 HIDE: `hide${EVENT_KEY$3}`, 8227 HIDDEN: `hidden${EVENT_KEY$3}`, 8228 SHOW: `show${EVENT_KEY$3}`, 8229 SHOWN: `shown${EVENT_KEY$3}`, 8230 INSERTED: `inserted${EVENT_KEY$3}`, 8231 CLICK: `click${EVENT_KEY$3}`, 8232 FOCUSIN: `focusin${EVENT_KEY$3}`, 8233 FOCUSOUT: `focusout${EVENT_KEY$3}`, 8234 MOUSEENTER: `mouseenter${EVENT_KEY$3}`, 8235 MOUSELEAVE: `mouseleave${EVENT_KEY$3}` 8236 }; 8237 8238 /** 8239 * ------------------------------------------------------------------------ 8240 * Class Definition 8241 * ------------------------------------------------------------------------ 8242 */ 8243 8244 class Popover extends Tooltip { 8245 // Getters 8246 8247 static get VERSION() { 8248 return VERSION$3 8249 } 8250 8251 static get Default() { 8252 return Default$2 8253 } 8254 8255 static get NAME() { 8256 return NAME$3 8257 } 8258 8259 static get DATA_KEY() { 8260 return DATA_KEY$3 8261 } 8262 8263 static get Event() { 8264 return Event 8265 } 8266 8267 static get EVENT_KEY() { 8268 return EVENT_KEY$3 8269 } 8270 8271 static get DefaultType() { 8272 return DefaultType$2 8273 } 8274 8275 // Overrides 8276 8277 isWithContent() { 8278 return this.getTitle() || this._getContent() 8279 } 8280 8281 addAttachmentClass(attachment) { 8282 $__default["default"](this.getTipElement()).addClass(`${CLASS_PREFIX}-${attachment}`); 8283 } 8284 8285 getTipElement() { 8286 this.tip = this.tip || $__default["default"](this.config.template)[0]; 8287 return this.tip 8288 } 8289 8290 setContent() { 8291 const $tip = $__default["default"](this.getTipElement()); 8292 8293 // We use append for html objects to maintain js events 8294 this.setElementContent($tip.find(SELECTOR_TITLE), this.getTitle()); 8295 let content = this._getContent(); 8296 if (typeof content === 'function') { 8297 content = content.call(this.element); 8298 } 8299 8300 this.setElementContent($tip.find(SELECTOR_CONTENT), content); 8301 8302 $tip.removeClass(`${CLASS_NAME_FADE$2} ${CLASS_NAME_SHOW$2}`); 8303 } 8304 8305 // Private 8306 8307 _getContent() { 8308 return this.element.getAttribute('data-content') || 8309 this.config.content 8310 } 8311 8312 _cleanTipClass() { 8313 const $tip = $__default["default"](this.getTipElement()); 8314 const tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX); 8315 if (tabClass !== null && tabClass.length > 0) { 8316 $tip.removeClass(tabClass.join('')); 8317 } 8318 } 8319 8320 // Static 8321 8322 static _jQueryInterface(config) { 8323 return this.each(function () { 8324 let data = $__default["default"](this).data(DATA_KEY$3); 8325 const _config = typeof config === 'object' ? config : null; 8326 8327 if (!data && /dispose|hide/.test(config)) { 8328 return 8329 } 8330 8331 if (!data) { 8332 data = new Popover(this, _config); 8333 $__default["default"](this).data(DATA_KEY$3, data); 8334 } 8335 8336 if (typeof config === 'string') { 8337 if (typeof data[config] === 'undefined') { 8338 throw new TypeError(`No method named "${config}"`) 8339 } 8340 8341 data[config](); 8342 } 8343 }) 8344 } 8345 } 8346 8347 /** 8348 * ------------------------------------------------------------------------ 8349 * jQuery 8350 * ------------------------------------------------------------------------ 8351 */ 8352 8353 $__default["default"].fn[NAME$3] = Popover._jQueryInterface; 8354 $__default["default"].fn[NAME$3].Constructor = Popover; 8355 $__default["default"].fn[NAME$3].noConflict = () => {
8356 $__default["default"].fn[NAME$3] = JQUERY_NO_CONFLICT$3; 8357 return Popover._jQueryInterface 8358 }; 8359 8360 /** 8361 * -------------------------------------------------------------------------- 8362 * Bootstrap (v4.6.0): scrollspy.js 8363 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 8364 * -------------------------------------------------------------------------- 8365 */ 8366 8367 /** 8368 * ------------------------------------------------------------------------ 8369 * Constants 8370 * ------------------------------------------------------------------------ 8371 */ 8372 8373 const NAME$2 = 'scrollspy'; 8374 const VERSION$2 = '4.6.0'; 8375 const DATA_KEY$2 = 'bs.scrollspy'; 8376 const EVENT_KEY$2 = `.${DATA_KEY$2}`; 8377 const DATA_API_KEY$1 = '.data-api'; 8378 const JQUERY_NO_CONFLICT$2 = $__default["default"].fn[NAME$2]; 8379 8380 const Default$1 = { 8381 offset: 10, 8382 method: 'auto', 8383 target: '' 8384 }; 8385 8386 const DefaultType$1 = { 8387 offset: 'number', 8388 method: 'string', 8389 target: '(string|element)' 8390 }; 8391 8392 const EVENT_ACTIVATE = `activate${EVENT_KEY$2}`; 8393 const EVENT_SCROLL = `scroll${EVENT_KEY$2}`; 8394 const EVENT_LOAD_DATA_API = `load${EVENT_KEY$2}${DATA_API_KEY$1}`; 8395 8396 const CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item'; 8397 const CLASS_NAME_ACTIVE$1 = 'active'; 8398 8399 const SELECTOR_DATA_SPY = '[data-spy="scroll"]'; 8400 const SELECTOR_NAV_LIST_GROUP$1 = '.nav, .list-group'; 8401 const SELECTOR_NAV_LINKS = '.nav-link'; 8402 const SELECTOR_NAV_ITEMS = '.nav-item'; 8403 const SELECTOR_LIST_ITEMS = '.list-group-item'; 8404 const SELECTOR_DROPDOWN$1 = '.dropdown'; 8405 const SELECTOR_DROPDOWN_ITEMS = '.dropdown-item'; 8406 const SELECTOR_DROPDOWN_TOGGLE$1 = '.dropdown-toggle'; 8407 8408 const METHOD_OFFSET = 'offset'; 8409 const METHOD_POSITION = 'position'; 8410 8411 /** 8412 * ------------------------------------------------------------------------ 8413 * Class Definition 8414 * ------------------------------------------------------------------------ 8415 */ 8416 8417 class ScrollSpy { 8418 constructor(element, config) { 8419 this._element = element; 8420 this._scrollElement = element.tagName === 'BODY' ? window : element; 8421 this._config = this._getConfig(config); 8422 this._selector = `${this._config.target} ${SELECTOR_NAV_LINKS},` + 8423 `${this._config.target} ${SELECTOR_LIST_ITEMS},` + 8424 `${this._config.target} ${SELECTOR_DROPDOWN_ITEMS}`; 8425 this._offsets = []; 8426 this._targets = []; 8427 this._activeTarget = null; 8428 this._scrollHeight = 0; 8429 8430 $__default["default"](this._scrollElement).on(EVENT_SCROLL, event => this._process(event)); 8431 8432 this.refresh(); 8433 this._process(); 8434 } 8435 8436 // Getters 8437 8438 static get VERSION() { 8439 return VERSION$2 8440 } 8441 8442 static get Default() { 8443 return Default$1 8444 } 8445 8446 // Public 8447 8448 refresh() { 8449 const autoMethod = this._scrollElement === this._scrollElement.window ? 8450 METHOD_OFFSET : METHOD_POSITION; 8451 8452 const offsetMethod = this._config.method === 'auto' ? 8453 autoMethod : this._config.method; 8454 8455 const offsetBase = offsetMethod === METHOD_POSITION ? 8456 this._getScrollTop() : 0; 8457 8458 this._offsets = []; 8459 this._targets = []; 8460 8461 this._scrollHeight = this._getScrollHeight(); 8462 8463 const targets = [].slice.call(document.querySelectorAll(this._selector)); 8464 8465 targets 8466 .map(element => { 8467 let target; 8468 const targetSelector = Util.getSelectorFromElement(element); 8469 8470 if (targetSelector) { 8471 target = document.querySelector(targetSelector); 8472 } 8473 8474 if (target) { 8475 const targetBCR = target.getBoundingClientRect(); 8476 if (targetBCR.width || targetBCR.height) { 8477 // TODO (fat): remove sketch reliance on jQuery position/offset 8478 return [ 8479 $__default["default"](target)[offsetMethod]().top + offsetBase, 8480 targetSelector 8481 ] 8482 } 8483 } 8484 8485 return null 8486 }) 8487 .filter(item => item) 8488 .sort((a, b) => a[0] - b[0]) 8489 .forEach(item => { 8490 this._offsets.push(item[0]); 8491 this._targets.push(item[1]); 8492 }); 8493 } 8494 8495 dispose() { 8496 $__default["default"].removeData(this._element, DATA_KEY$2); 8497 $__default["default"](this._scrollElement).off(EVENT_KEY$2); 8498 8499 this._element = null; 8500 this._scrollElement = null; 8501 this._config = null; 8502 this._selector = null; 8503 this._offsets = null; 8504 this._targets = null; 8505 this._activeTarget = null; 8506 this._scrollHeight = null; 8507 } 8508 8509 // Private 8510 8511 _getConfig(config) { 8512 config = { 8513 ...Default$1, 8514 ...(typeof config === 'object' && config ? config : {}) 8515 }; 8516 8517 if (typeof config.target !== 'string' && Util.isElement(config.target)) { 8518 let id = $__default["default"](config.target).attr('id'); 8519 if (!id) { 8520 id = Util.getUID(NAME$2); 8521 $__default["default"](config.target).attr('id', id); 8522 } 8523 8524 config.target = `#${id}`; 8525 } 8526 8527 Util.typeCheckConfig(NAME$2, config, DefaultType$1); 8528 8529 return config 8530 } 8531 8532 _getScrollTop() { 8533 return this._scrollElement === window ? 8534 this._scrollElement.pageYOffset : this._scrollElement.scrollTop 8535 } 8536 8537 _getScrollHeight() { 8538 return this._scrollElement.scrollHeight || Math.max( 8539 document.body.scrollHeight, 8540 document.documentElement.scrollHeight 8541 ) 8542 } 8543 8544 _getOffsetHeight() { 8545 return this._scrollElement === window ? 8546 window.innerHeight : this._scrollElement.getBoundingClientRect().height 8547 } 8548 8549 _process() { 8550 const scrollTop = this._getScrollTop() + this._config.offset; 8551 const scrollHeight = this._getScrollHeight(); 8552 const maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight(); 8553 8554 if (this._scrollHeight !== scrollHeight) { 8555 this.refresh(); 8556 } 8557 8558 if (scrollTop >= maxScroll) { 8559 const target = this._targets[this._targets.length - 1]; 8560 8561 if (this._activeTarget !== target) { 8562 this._activate(target); 8563 } 8564 8565 return 8566 } 8567 8568 if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) { 8569 this._activeTarget = null; 8570 this._clear(); 8571 return 8572 } 8573 8574 for (let i = this._offsets.length; i--;) { 8575 const isActiveTarget = this._activeTarget !== this._targets[i] && 8576 scrollTop >= this._offsets[i] && 8577 (typeof this._offsets[i + 1] === 'undefined' || 8578 scrollTop < this._offsets[i + 1]); 8579 8580 if (isActiveTarget) { 8581 this._activate(this._targets[i]); 8582 } 8583 } 8584 } 8585 8586 _activate(target) { 8587 this._activeTarget = target; 8588 8589 this._clear(); 8590 8591 const queries = this._selector 8592 .split(',') 8593 .map(selector => `${selector}[data-target="${target}"],${selector}[href="${target}"]`); 8594 8595 const $link = $__default["default"]([].slice.call(document.querySelectorAll(queries.join(',')))); 8596
8597 if ($link.hasClass(CLASS_NAME_DROPDOWN_ITEM)) { 8598 $link.closest(SELECTOR_DROPDOWN$1) 8599 .find(SELECTOR_DROPDOWN_TOGGLE$1) 8600 .addClass(CLASS_NAME_ACTIVE$1); 8601 $link.addClass(CLASS_NAME_ACTIVE$1); 8602 } else { 8603 // Set triggered link as active 8604 $link.addClass(CLASS_NAME_ACTIVE$1); 8605 // Set triggered links parents as active 8606 // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor 8607 $link.parents(SELECTOR_NAV_LIST_GROUP$1) 8608 .prev(`${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}`) 8609 .addClass(CLASS_NAME_ACTIVE$1); 8610 // Handle special case when .nav-link is inside .nav-item 8611 $link.parents(SELECTOR_NAV_LIST_GROUP$1) 8612 .prev(SELECTOR_NAV_ITEMS) 8613 .children(SELECTOR_NAV_LINKS) 8614 .addClass(CLASS_NAME_ACTIVE$1); 8615 } 8616 8617 $__default["default"](this._scrollElement).trigger(EVENT_ACTIVATE, { 8618 relatedTarget: target 8619 }); 8620 } 8621 8622 _clear() { 8623 [].slice.call(document.querySelectorAll(this._selector)) 8624 .filter(node => node.classList.contains(CLASS_NAME_ACTIVE$1)) 8625 .forEach(node => node.classList.remove(CLASS_NAME_ACTIVE$1)); 8626 } 8627 8628 // Static 8629 8630 static _jQueryInterface(config) { 8631 return this.each(function () { 8632 let data = $__default["default"](this).data(DATA_KEY$2); 8633 const _config = typeof config === 'object' && config; 8634 8635 if (!data) { 8636 data = new ScrollSpy(this, _config); 8637 $__default["default"](this).data(DATA_KEY$2, data); 8638 } 8639 8640 if (typeof config === 'string') { 8641 if (typeof data[config] === 'undefined') { 8642 throw new TypeError(`No method named "${config}"`) 8643 } 8644 8645 data[config](); 8646 } 8647 }) 8648 } 8649 } 8650 8651 /** 8652 * ------------------------------------------------------------------------ 8653 * Data Api implementation 8654 * ------------------------------------------------------------------------ 8655 */ 8656 8657 $__default["default"](window).on(EVENT_LOAD_DATA_API, () => { 8658 const scrollSpys = [].slice.call(document.querySelectorAll(SELECTOR_DATA_SPY)); 8659 const scrollSpysLength = scrollSpys.length; 8660 8661 for (let i = scrollSpysLength; i--;) { 8662 const $spy = $__default["default"](scrollSpys[i]); 8663 ScrollSpy._jQueryInterface.call($spy, $spy.data()); 8664 } 8665 }); 8666 8667 /** 8668 * ------------------------------------------------------------------------ 8669 * jQuery 8670 * ------------------------------------------------------------------------ 8671 */ 8672 8673 $__default["default"].fn[NAME$2] = ScrollSpy._jQueryInterface; 8674 $__default["default"].fn[NAME$2].Constructor = ScrollSpy; 8675 $__default["default"].fn[NAME$2].noConflict = () => { 8676 $__default["default"].fn[NAME$2] = JQUERY_NO_CONFLICT$2; 8677 return ScrollSpy._jQueryInterface 8678 }; 8679 8680 /** 8681 * -------------------------------------------------------------------------- 8682 * Bootstrap (v4.6.0): tab.js 8683 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 8684 * -------------------------------------------------------------------------- 8685 */ 8686 8687 /** 8688 * ------------------------------------------------------------------------ 8689 * Constants 8690 * ------------------------------------------------------------------------ 8691 */ 8692 8693 const NAME$1 = 'tab'; 8694 const VERSION$1 = '4.6.0'; 8695 const DATA_KEY$1 = 'bs.tab'; 8696 const EVENT_KEY$1 = `.${DATA_KEY$1}`; 8697 const DATA_API_KEY = '.data-api'; 8698 const JQUERY_NO_CONFLICT$1 = $__default["default"].fn[NAME$1]; 8699 8700 const EVENT_HIDE$1 = `hide${EVENT_KEY$1}`; 8701 const EVENT_HIDDEN$1 = `hidden${EVENT_KEY$1}`; 8702 const EVENT_SHOW$1 = `show${EVENT_KEY$1}`; 8703 const EVENT_SHOWN$1 = `shown${EVENT_KEY$1}`; 8704 const EVENT_CLICK_DATA_API = `click${EVENT_KEY$1}${DATA_API_KEY}`; 8705 8706 const CLASS_NAME_DROPDOWN_MENU = 'dropdown-menu'; 8707 const CLASS_NAME_ACTIVE = 'active'; 8708 const CLASS_NAME_DISABLED = 'disabled'; 8709 const CLASS_NAME_FADE$1 = 'fade';
8710 const CLASS_NAME_SHOW$1 = 'show'; 8711 8712 const SELECTOR_DROPDOWN = '.dropdown'; 8713 const SELECTOR_NAV_LIST_GROUP = '.nav, .list-group'; 8714 const SELECTOR_ACTIVE = '.active'; 8715 const SELECTOR_ACTIVE_UL = '> li > .active'; 8716 const SELECTOR_DATA_TOGGLE = '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]'; 8717 const SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle'; 8718 const SELECTOR_DROPDOWN_ACTIVE_CHILD = '> .dropdown-menu .active'; 8719 8720 /** 8721 * ------------------------------------------------------------------------ 8722 * Class Definition 8723 * ------------------------------------------------------------------------ 8724 */ 8725 8726 class Tab { 8727 constructor(element) { 8728 this._element = element; 8729 } 8730 8731 // Getters 8732 8733 static get VERSION() { 8734 return VERSION$1 8735 } 8736 8737 // Public 8738 8739 show() { 8740 if (this._element.parentNode && 8741 this._element.parentNode.nodeType === Node.ELEMENT_NODE && 8742 $__default["default"](this._element).hasClass(CLASS_NAME_ACTIVE) || 8743 $__default["default"](this._element).hasClass(CLASS_NAME_DISABLED)) { 8744 return 8745 } 8746 8747 let target; 8748 let previous; 8749 const listElement = $__default["default"](this._element).closest(SELECTOR_NAV_LIST_GROUP)[0]; 8750 const selector = Util.getSelectorFromElement(this._element); 8751 8752 if (listElement) { 8753 const itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? SELECTOR_ACTIVE_UL : SELECTOR_ACTIVE; 8754 previous = $__default["default"].makeArray($__default["default"](listElement).find(itemSelector)); 8755 previous = previous[previous.length - 1]; 8756 } 8757 8758 const hideEvent = $__default["default"].Event(EVENT_HIDE$1, { 8759 relatedTarget: this._element 8760 }); 8761 8762 const showEvent = $__default["default"].Event(EVENT_SHOW$1, { 8763 relatedTarget: previous 8764 }); 8765 8766 if (previous) { 8767 $__default["default"](previous).trigger(hideEvent); 8768 } 8769 8770 $__default["default"](this._element).trigger(showEvent); 8771 8772 if (showEvent.isDefaultPrevented() || 8773 hideEvent.isDefaultPrevented()) { 8774 return 8775 } 8776 8777 if (selector) { 8778 target = document.querySelector(selector); 8779 } 8780 8781 this._activate( 8782 this._element, 8783 listElement 8784 ); 8785 8786 const complete = () => { 8787 const hiddenEvent = $__default["default"].Event(EVENT_HIDDEN$1, { 8788 relatedTarget: this._element 8789 }); 8790 8791 const shownEvent = $__default["default"].Event(EVENT_SHOWN$1, { 8792 relatedTarget: previous 8793 }); 8794 8795 $__default["default"](previous).trigger(hiddenEvent); 8796 $__default["default"](this._element).trigger(shownEvent); 8797 }; 8798 8799 if (target) { 8800 this._activate(target, target.parentNode, complete); 8801 } else { 8802 complete(); 8803 } 8804 } 8805 8806 dispose() { 8807 $__default["default"].removeData(this._element, DATA_KEY$1); 8808 this._element = null; 8809 } 8810 8811 // Private 8812 8813 _activate(element, container, callback) { 8814 const activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? 8815 $__default["default"](container).find(SELECTOR_ACTIVE_UL) : 8816 $__default["default"](container).children(SELECTOR_ACTIVE); 8817 8818 const active = activeElements[0]; 8819 const isTransitioning = callback && (active && $__default["default"](active).hasClass(CLASS_NAME_FADE$1)); 8820 const complete = () => this._transitionComplete( 8821 element, 8822 active, 8823 callback 8824 ); 8825 8826 if (active && isTransitioning) { 8827 const transitionDuration = Util.getTransitionDurationFromElement(active); 8828 8829 $__default["default"](active) 8830 .removeClass(CLASS_NAME_SHOW$1) 8831 .one(Util.TRANSITION_END, complete) 8832 .emulateTransitionEnd(transitionDuration); 8833 } else { 8834 complete(); 8835 } 8836 } 8837 8838 _transitionComplete(element, active, callback) { 8839 if (active) { 8840 $__default["default"](active).removeClass(CLASS_NAME_ACTIVE); 8841
8842 const dropdownChild = $__default["default"](active.parentNode).find( 8843 SELECTOR_DROPDOWN_ACTIVE_CHILD 8844 )[0]; 8845 8846 if (dropdownChild) { 8847 $__default["default"](dropdownChild).removeClass(CLASS_NAME_ACTIVE); 8848 } 8849 8850 if (active.getAttribute('role') === 'tab') { 8851 active.setAttribute('aria-selected', false); 8852 } 8853 } 8854 8855 $__default["default"](element).addClass(CLASS_NAME_ACTIVE); 8856 if (element.getAttribute('role') === 'tab') { 8857 element.setAttribute('aria-selected', true); 8858 } 8859 8860 Util.reflow(element); 8861 8862 if (element.classList.contains(CLASS_NAME_FADE$1)) { 8863 element.classList.add(CLASS_NAME_SHOW$1); 8864 } 8865 8866 if (element.parentNode && $__default["default"](element.parentNode).hasClass(CLASS_NAME_DROPDOWN_MENU)) { 8867 const dropdownElement = $__default["default"](element).closest(SELECTOR_DROPDOWN)[0]; 8868 8869 if (dropdownElement) { 8870 const dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(SELECTOR_DROPDOWN_TOGGLE)); 8871 8872 $__default["default"](dropdownToggleList).addClass(CLASS_NAME_ACTIVE); 8873 } 8874 8875 element.setAttribute('aria-expanded', true); 8876 } 8877 8878 if (callback) { 8879 callback(); 8880 } 8881 } 8882 8883 // Static 8884 8885 static _jQueryInterface(config) { 8886 return this.each(function () { 8887 const $this = $__default["default"](this); 8888 let data = $this.data(DATA_KEY$1); 8889 8890 if (!data) { 8891 data = new Tab(this); 8892 $this.data(DATA_KEY$1, data); 8893 } 8894 8895 if (typeof config === 'string') { 8896 if (typeof data[config] === 'undefined') { 8897 throw new TypeError(`No method named "${config}"`) 8898 } 8899 8900 data[config](); 8901 } 8902 }) 8903 } 8904 } 8905 8906 /** 8907 * ------------------------------------------------------------------------ 8908 * Data Api implementation 8909 * ------------------------------------------------------------------------ 8910 */ 8911 8912 $__default["default"](document) 8913 .on(EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) { 8914 event.preventDefault(); 8915 Tab._jQueryInterface.call($__default["default"](this), 'show'); 8916 }); 8917 8918 /** 8919 * ------------------------------------------------------------------------ 8920 * jQuery 8921 * ------------------------------------------------------------------------ 8922 */ 8923 8924 $__default["default"].fn[NAME$1] = Tab._jQueryInterface; 8925 $__default["default"].fn[NAME$1].Constructor = Tab; 8926 $__default["default"].fn[NAME$1].noConflict = () => { 8927 $__default["default"].fn[NAME$1] = JQUERY_NO_CONFLICT$1; 8928 return Tab._jQueryInterface 8929 }; 8930 8931 /** 8932 * -------------------------------------------------------------------------- 8933 * Bootstrap (v4.6.0): toast.js 8934 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 8935 * -------------------------------------------------------------------------- 8936 */ 8937 8938 /** 8939 * ------------------------------------------------------------------------ 8940 * Constants 8941 * ------------------------------------------------------------------------ 8942 */ 8943 8944 const NAME = 'toast'; 8945 const VERSION = '4.6.0'; 8946 const DATA_KEY = 'bs.toast'; 8947 const EVENT_KEY = `.${DATA_KEY}`; 8948 const JQUERY_NO_CONFLICT = $__default["default"].fn[NAME]; 8949 8950 const EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY}`; 8951 const EVENT_HIDE = `hide${EVENT_KEY}`; 8952 const EVENT_HIDDEN = `hidden${EVENT_KEY}`; 8953 const EVENT_SHOW = `show${EVENT_KEY}`; 8954 const EVENT_SHOWN = `shown${EVENT_KEY}`; 8955 8956 const CLASS_NAME_FADE = 'fade';
8957 const CLASS_NAME_HIDE = 'hide'; 8958 const CLASS_NAME_SHOW = 'show'; 8959 const CLASS_NAME_SHOWING = 'showing'; 8960 8961 const DefaultType = { 8962 animation: 'boolean', 8963 autohide: 'boolean', 8964 delay: 'number' 8965 }; 8966 8967 const Default = { 8968 animation: true, 8969 autohide: true, 8970 delay: 500 8971 }; 8972 8973 const SELECTOR_DATA_DISMISS = '[data-dismiss="toast"]'; 8974 8975 /** 8976 * ------------------------------------------------------------------------ 8977 * Class Definition 8978 * ------------------------------------------------------------------------ 8979 */ 8980 8981 class Toast { 8982 constructor(element, config) { 8983 this._element = element; 8984 this._config = this._getConfig(config); 8985 this._timeout = null; 8986 this._setListeners(); 8987 } 8988 8989 // Getters 8990 8991 static get VERSION() { 8992 return VERSION 8993 } 8994 8995 static get DefaultType() { 8996 return DefaultType 8997 } 8998 8999 static get Default() { 9000 return Default 9001 } 9002 9003 // Public 9004 9005 show() { 9006 const showEvent = $__default["default"].Event(EVENT_SHOW); 9007 9008 $__default["default"](this._element).trigger(showEvent); 9009 if (showEvent.isDefaultPrevented()) { 9010 return 9011 } 9012 9013 this._clearTimeout(); 9014 9015 if (this._config.animation) { 9016 this._element.classList.add(CLASS_NAME_FADE); 9017 } 9018 9019 const complete = () => { 9020 this._element.classList.remove(CLASS_NAME_SHOWING); 9021 this._element.classList.add(CLASS_NAME_SHOW); 9022 9023 $__default["default"](this._element).trigger(EVENT_SHOWN); 9024 9025 if (this._config.autohide) { 9026 this._timeout = setTimeout(() => { 9027 this.hide(); 9028 }, this._config.delay); 9029 } 9030 }; 9031 9032 this._element.classList.remove(CLASS_NAME_HIDE); 9033 Util.reflow(this._element); 9034 this._element.classList.add(CLASS_NAME_SHOWING); 9035 if (this._config.animation) { 9036 const transitionDuration = Util.getTransitionDurationFromElement(this._element); 9037 9038 $__default["default"](this._element) 9039 .one(Util.TRANSITION_END, complete) 9040 .emulateTransitionEnd(transitionDuration); 9041 } else { 9042 complete(); 9043 } 9044 } 9045 9046 hide() { 9047 if (!this._element.classList.contains(CLASS_NAME_SHOW)) { 9048 return 9049 } 9050 9051 const hideEvent = $__default["default"].Event(EVENT_HIDE); 9052 9053 $__default["default"](this._element).trigger(hideEvent); 9054 if (hideEvent.isDefaultPrevented()) { 9055 return 9056 } 9057 9058 this._close(); 9059 } 9060 9061 dispose() { 9062 this._clearTimeout(); 9063 9064 if (this._element.classList.contains(CLASS_NAME_SHOW)) { 9065 this._element.classList.remove(CLASS_NAME_SHOW); 9066 } 9067 9068 $__default["default"](this._element).off(EVENT_CLICK_DISMISS); 9069 9070 $__default["default"].removeData(this._element, DATA_KEY); 9071 this._element = null; 9072 this._config = null; 9073 } 9074 9075 // Private 9076 9077 _getConfig(config) { 9078 config = { 9079 ...Default, 9080 ...$__default["default"](this._element).data(), 9081 ...(typeof config === 'object' && config ? config : {}) 9082 }; 9083 9084 Util.typeCheckConfig( 9085 NAME, 9086 config, 9087 this.constructor.DefaultType 9088 ); 9089 9090 return config 9091 } 9092 9093 _setListeners() { 9094 $__default["default"](this._element).on(EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, () => this.hide()); 9095 } 9096 9097 _close() { 9098 const complete = () => { 9099 this._element.classList.add(CLASS_NAME_HIDE); 9100 $__default["default"](this._element).trigger(EVENT_HIDDEN); 9101 }; 9102 9103 this._element.classList.remove(CLASS_NAME_SHOW); 9104 if (this._config.animation) { 9105 const transitionDuration = Util.getTransitionDurationFromElement(this._element); 9106 9107 $__default["default"](this._element) 9108 .one(Util.TRANSITION_END, complete) 9109 .emulateTransitionEnd(transitionDuration); 9110 } else { 9111 complete(); 9112 } 9113 } 9114 9115 _clearTimeout() { 9116 clearTimeout(this._timeout); 9117 this._timeout = null; 9118 } 9119 9120 // Static 9121 9122 static _jQueryInterface(config) { 9123 return this.each(function () { 9124 const $element = $__default["default"](this); 9125 let data = $element.data(DATA_KEY); 9126 const _config = typeof config === 'object' && config; 9127 9128 if (!data) { 9129 data = new Toast(this, _config); 9130 $element.data(DATA_KEY, data); 9131 } 9132 9133 if (typeof config === 'string') { 9134 if (typeof data[config] === 'undefined') {
9135 throw new TypeError(`No method named "${config}"`) 9136 } 9137 9138 data[config](this); 9139 } 9140 }) 9141 } 9142 } 9143 9144 /** 9145 * ------------------------------------------------------------------------ 9146 * jQuery 9147 * ------------------------------------------------------------------------ 9148 */ 9149 9150 $__default["default"].fn[NAME] = Toast._jQueryInterface; 9151 $__default["default"].fn[NAME].Constructor = Toast; 9152 $__default["default"].fn[NAME].noConflict = () => { 9153 $__default["default"].fn[NAME] = JQUERY_NO_CONFLICT; 9154 return Toast._jQueryInterface 9155 }; 9156 9157 /** 9158 * File skip-link-focus-fix.js. 9159 * 9160 * Helps with accessibility for keyboard only users. 9161 * 9162 * Learn more: https://git.io/vWdr2 9163 */ 9164 (function () { 9165 var isWebkit = navigator.userAgent.toLowerCase().indexOf('webkit') > -1, 9166 isOpera = navigator.userAgent.toLowerCase().indexOf('opera') > -1, 9167 isIe = navigator.userAgent.toLowerCase().indexOf('msie') > -1; 9168 9169 if ((isWebkit || isOpera || isIe) && document.getElementById && window.addEventListener) { 9170 window.addEventListener('hashchange', function () { 9171 var id = location.hash.substring(1), 9172 element; 9173 9174 if (!/^[A-z0-9_-]+$/.test(id)) { 9175 return; 9176 } 9177 9178 element = document.getElementById(id); 9179 9180 if (element) { 9181 if (!/^(?:a|select|input|button|textarea)$/i.test(element.tagName)) { 9182 element.tabIndex = -1; 9183 } 9184 9185 element.focus(); 9186 } 9187 }, false); 9188 } 9189 })(); 9190 9191 (function ($) { 9192 jQuery(document).ready(function () { 9193 // animated Navbar Toggler 9194 $('.navbar-toggler').on('click', function () { 9195 $('.animated-icon').toggleClass('open'); 9196 }); // $('.dropdown-toggle').dropdown(); 9197 // $('.dropdown-toggle').prop('disabled', true); 9198 // $('.dropdown-toggle').removeAttr('data-toggle'); 9199 // $('.dropdown-toggle').prop('disabled', true).trigger('chosen:updated'); 9200 9201 $('.dropdown-menu').on('mouseover', function () { 9202 $(this).parent().addClass('is-hover'); 9203 }).on('mouseout', function () { 9204 $(this).parent().removeClass('is-hover'); 9205 }); 9206 $('.collapse').on('show.bs.collapse', function () { 9207 $('body').addClass('no-scroll'); 9208 }); 9209 $('.collapse').on('hide.bs.collapse', function () { 9210 $('body').removeClass('no-scroll'); 9211 }); // $('#').on('show.bs.dropdown', function () { 9212 // console.log($(this)); 9213 // $(this).parents('.dropdown-toggle').addClass('active'); 9214 // }); 9215 // $('.dropdown').on('hide.bs.dropdown', function () { 9216 // $(this).parents('.dropdown-toggle').removeClass('active'); 9217 // }); 9218 // Hoverable dropdown 9219 // $('.dropdown').on('mouseover', function(){ 9220 // $(this).addClass('show'); 9221 // $('.dropdown-menu').addClass('show'); 9222 // $('.dropdown-toggle').attr('aria-expanded', 'true'); 9223 // }); 9224 // $('.dropdown').on('mouseout', function(){ 9225 // $(this).removeClass('show'); 9226 // $('.dropdown-menu').removeClass('show'); 9227 // $('.dropdown-toggle').attr('aria-expanded', 'false'); 9228 // }); 9229 // Text on 404 page 9230 9231 $('body.error404 #s-1').attr('placeholder', 'Search ...'); // Header search button 9232 // handle click 9233 9234 $('.wp-block-search__button').on('click', function (e) { 9235 if ($('.wp-block-search').hasClass('collapsed')) ; else { 9236 $('.wp-block-search').addClass('collapsed'); 9237 $("input.wp-block-search__input").focus(); 9238 e.preventDefault(); 9239 } 9240 }); // Custom Switch 9241 9242 $("#teamSwitch").change(function () { 9243 $('#main > .post').toggleClass('darkMode'); 9244 }); 9245 $('.wpcf7 #stadt').attr("placeholder", "In welcher Stadt ist PHAT zu Hause?"); // video on frontpage 9246 // var video = $("#frontpage-video" ); 9247 9248 if ($('#frontpage-video').length) { 9249 var video = document.getElementById("frontpage-video"); 9250 var videoTarget = phatParams.tagline_1_url; 9251 var isPart = 3; 9252 video.addEventListener('timeupdate', ({ 9253 target 9254 }) => { 9255 if (target.currentTime < 15 && isPart === 3) { 9256 $('#video-tagline p').fadeOut('slow', function () { 9257 $('#video-tagline p').html(phatParams.tagline_1_text); 9258 $('#video-tagline p').fadeIn('slow'); 9259 }); 9260 videoTarget = phatParams.tagline_1_url; 9261 isPart = 1; 9262 } 9263 9264 if (target.currentTime >= phatParams.tagline_2_start && target.currentTime < phatParams.tagline_3_start && isPart === 1) { 9265 $('#video-tagline p').fadeOut('slow', function () { 9266 $('#video-tagline p').html(phatParams.tagline_2_text); 9267 $('#video-tagline p').fadeIn('slow'); 9268 }); 9269 isPart = 2; 9270 videoTarget = phatParams.tagline_2_url; 9271 } 9272 9273 if (target.currentTime >= phatParams.tagline_3_start && isPart === 2) { 9274 $('#video-tagline p').fadeOut('slow', function () { 9275 $('#video-tagline p').html(phatParams.tagline_3_text); 9276 $('#video-tagline p').fadeIn('slow'); 9277 }); 9278 videoTarget = phatParams.tagline_3_url; 9279 isPart = 3; 9280 } 9281 }); 9282 } 9283 9284 $('#frontpage-video').on('click', function () { 9285 window.location.href = videoTarget; 9286 }); 9287 $('ul.testimonial-slider').slick({ 9288 dots: true,
9289 arrows: false, 9290 infinite: true, 9291 autoplay: true, 9292 autoplaySpeed: 5000, 9293 speed: 600, 9294 cssEase: 'linear', 9295 pauseOnHover: true, 9296 pauseOnFocus: false // setting-name: setting-value 9297 9298 }); 9299 $('.frontpage-slider').slick({ 9300 dots: true, 9301 arrows: false, 9302 infinite: true, 9303 autoplay: true, 9304 // autoplaySpeed: 5000, 9305 speed: 600, 9306 cssEase: 'linear', 9307 pauseOnHover: true, 9308 pauseOnFocus: true // setting-name: setting-value 9309 9310 }); 9311 }); 9312 })(jQuery); 9313 9314 exports.Alert = Alert; 9315 exports.Button = Button; 9316 exports.Carousel = Carousel; 9317 exports.Collapse = Collapse; 9318 exports.Modal = Modal; 9319 exports.Popover = Popover; 9320 exports.Popper = Popper$3; 9321 exports.Scrollspy = ScrollSpy; 9322 exports.Tab = Tab; 9323 exports.Toast = Toast; 9324 exports.Tooltip = Tooltip; 9325 exports.Util = Util; 9326 9327 Object.defineProperty(exports, '__esModule', { value: true }); 9328 9329})); 9330//# sourceMappingURL=child-theme.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.