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