vendor: 2,867 bytes, lines 1-91
1/*! 2 * Bootstrap v5.0.1 (https://getbootstrap.com/) 3 * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) 4 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 5 */ 6(function (global, factory) { 7 typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : 8 typeof define === 'function' && define.amd ? define(factory) : 9 (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.bootstrap = factory()); 10}(this, (function () { 'use strict'; 11 12 /** 13 * -------------------------------------------------------------------------- 14 * Bootstrap (v5.0.1): dom/selector-engine.js 15 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 16 * -------------------------------------------------------------------------- 17 */ 18 19 /** 20 * ------------------------------------------------------------------------ 21 * Constants 22 * ------------------------------------------------------------------------ 23 */ 24 const NODE_TEXT = 3; 25 const SelectorEngine = { 26 find(selector, element = document.documentElement) { 27 return [].concat(...Element.prototype.querySelectorAll.call(element, selector)); 28 }, 29 30 findOne(selector, element = document.documentElement) { 31 return Element.prototype.querySelector.call(element, selector); 32 }, 33 34 children(element, selector) { 35 return [].concat(...element.children).filter(child => child.matches(selector)); 36 }, 37 38 parents(element, selector) { 39 const parents = []; 40 let ancestor = element.parentNode; 41 42 while (ancestor && ancestor.nodeType === Node.ELEMENT_NODE && ancestor.nodeType !== NODE_TEXT) { 43 if (ancestor.matches(selector)) { 44 parents.push(ancestor); 45 } 46 47 ancestor = ancestor.parentNode; 48 } 49 50 return parents; 51 }, 52 53 prev(element, selector) { 54 let previous = element.previousElementSibling; 55 56 while (previous) { 57 if (previous.matches(selector)) { 58 return [previous]; 59 } 60 61 previous = previous.previousElementSibling; 62 } 63 64 return []; 65 }, 66 67 next(element, selector) { 68 let next = element.nextElementSibling; 69 70 while (next) { 71 if (next.matches(selector)) { 72 return [next]; 73 } 74 75 next = next.nextElementSibling; 76 } 77 78 return []; 79 } 80 81 }; 82 83 /** 84 * -------------------------------------------------------------------------- 85 * Bootstrap (v5.0.1): util/index.js 86 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 87 * -------------------------------------------------------------------------- 88 */ 89 90 const MAX_UID = 1000000; 91 const MILLISECONDS_MULTIPLIER = 1000;
vendor: 9,486 bytes, lines 92-416
92 const TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp) 93 94 const toType = obj => { 95 if (obj === null || obj === undefined) { 96 return `${obj}`; 97 } 98 99 return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase(); 100 }; 101 /** 102 * -------------------------------------------------------------------------- 103 * Public Util Api 104 * -------------------------------------------------------------------------- 105 */ 106 107 108 const getUID = prefix => { 109 do { 110 prefix += Math.floor(Math.random() * MAX_UID); 111 } while (document.getElementById(prefix)); 112 113 return prefix; 114 }; 115 116 const getSelector = element => { 117 let selector = element.getAttribute('data-bs-target'); 118 119 if (!selector || selector === '#') { 120 let hrefAttr = element.getAttribute('href'); // The only valid content that could double as a selector are IDs or classes, 121 // so everything starting with `#` or `.`. If a "real" URL is used as the selector, 122 // `document.querySelector` will rightfully complain it is invalid. 123 // See https://github.com/twbs/bootstrap/issues/32273 124 125 if (!hrefAttr || !hrefAttr.includes('#') && !hrefAttr.startsWith('.')) { 126 return null; 127 } // Just in case some CMS puts out a full URL with the anchor appended 128 129 130 if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) { 131 hrefAttr = `#${hrefAttr.split('#')[1]}`; 132 } 133 134 selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null; 135 } 136 137 return selector; 138 }; 139 140 const getSelectorFromElement = element => { 141 const selector = getSelector(element); 142 143 if (selector) { 144 return document.querySelector(selector) ? selector : null; 145 } 146 147 return null; 148 }; 149 150 const getElementFromSelector = element => { 151 const selector = getSelector(element); 152 return selector ? document.querySelector(selector) : null; 153 }; 154 155 const getTransitionDurationFromElement = element => { 156 if (!element) { 157 return 0; 158 } // Get transition-duration of the element 159 160 161 let { 162 transitionDuration, 163 transitionDelay 164 } = window.getComputedStyle(element); 165 const floatTransitionDuration = Number.parseFloat(transitionDuration); 166 const floatTransitionDelay = Number.parseFloat(transitionDelay); // Return 0 if element or transition duration is not found 167 168 if (!floatTransitionDuration && !floatTransitionDelay) { 169 return 0; 170 } // If multiple durations are defined, take the first 171 172 173 transitionDuration = transitionDuration.split(',')[0]; 174 transitionDelay = transitionDelay.split(',')[0]; 175 return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER; 176 }; 177 178 const triggerTransitionEnd = element => { 179 element.dispatchEvent(new Event(TRANSITION_END)); 180 }; 181 182 const isElement$1 = obj => { 183 if (!obj || typeof obj !== 'object') { 184 return false; 185 } 186 187 if (typeof obj.jquery !== 'undefined') { 188 obj = obj[0]; 189 } 190 191 return typeof obj.nodeType !== 'undefined'; 192 }; 193 194 const getElement = obj => { 195 if (isElement$1(obj)) { 196 // it's a jQuery object or a node element 197 return obj.jquery ? obj[0] : obj; 198 } 199 200 if (typeof obj === 'string' && obj.length > 0) { 201 return SelectorEngine.findOne(obj); 202 } 203 204 return null; 205 }; 206 207 const emulateTransitionEnd = (element, duration) => { 208 let called = false; 209 const durationPadding = 5; 210 const emulatedDuration = duration + durationPadding; 211 212 function listener() { 213 called = true; 214 element.removeEventListener(TRANSITION_END, listener); 215 } 216 217 element.addEventListener(TRANSITION_END, listener); 218 setTimeout(() => { 219 if (!called) { 220 triggerTransitionEnd(element); 221 } 222 }, emulatedDuration); 223 }; 224 225 const typeCheckConfig = (componentName, config, configTypes) => { 226 Object.keys(configTypes).forEach(property => { 227 const expectedTypes = configTypes[property]; 228 const value = config[property]; 229 const valueType = value && isElement$1(value) ? 'element' : toType(value); 230 231 if (!new RegExp(expectedTypes).test(valueType)) { 232 throw new TypeError(`${componentName.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`); 233 } 234 }); 235 }; 236 237 const isVisible = element => { 238 if (!element) { 239 return false; 240 } 241 242 if (element.style && element.parentNode && element.parentNode.style) { 243 const elementStyle = getComputedStyle(element); 244 const parentNodeStyle = getComputedStyle(element.parentNode); 245 return elementStyle.display !== 'none' && parentNodeStyle.display !== 'none' && elementStyle.visibility !== 'hidden'; 246 } 247 248 return false; 249 }; 250 251 const isDisabled = element => { 252 if (!element || element.nodeType !== Node.ELEMENT_NODE) { 253 return true; 254 } 255 256 if (element.classList.contains('disabled')) { 257 return true; 258 } 259 260 if (typeof element.disabled !== 'undefined') { 261 return element.disabled; 262 } 263 264 return element.hasAttribute('disabled') && element.getAttribute('disabled') !== 'false'; 265 }; 266 267 const findShadowRoot = element => { 268 if (!document.documentElement.attachShadow) { 269 return null; 270 } // Can find the shadow root otherwise it'll return the document 271 272 273 if (typeof element.getRootNode === 'function') { 274 const root = element.getRootNode(); 275 return root instanceof ShadowRoot ? root : null; 276 } 277 278 if (element instanceof ShadowRoot) { 279 return element; 280 } // when we don't find a shadow root 281 282 283 if (!element.parentNode) { 284 return null; 285 } 286 287 return findShadowRoot(element.parentNode); 288 }; 289 290 const noop = () => {}; 291 292 const reflow = element => element.offsetHeight; 293 294 const getjQuery = () => { 295 const { 296 jQuery 297 } = window; 298 299 if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) { 300 return jQuery; 301 } 302 303 return null; 304 }; 305 306 const onDOMContentLoaded = callback => { 307 if (document.readyState === 'loading') { 308 document.addEventListener('DOMContentLoaded', callback); 309 } else { 310 callback(); 311 } 312 }; 313 314 const isRTL = () => document.documentElement.dir === 'rtl'; 315 316 const defineJQueryPlugin = plugin => { 317 onDOMContentLoaded(() => { 318 const $ = getjQuery(); 319 /* istanbul ignore if */ 320 321 if ($) { 322 const name = plugin.NAME; 323 const JQUERY_NO_CONFLICT = $.fn[name]; 324 $.fn[name] = plugin.jQueryInterface; 325 $.fn[name].Constructor = plugin; 326 327 $.fn[name].noConflict = () => { 328 $.fn[name] = JQUERY_NO_CONFLICT; 329 return plugin.jQueryInterface; 330 }; 331 } 332 }); 333 }; 334 335 const execute = callback => { 336 if (typeof callback === 'function') { 337 callback(); 338 } 339 }; 340 341 /** 342 * -------------------------------------------------------------------------- 343 * Bootstrap (v5.0.1): dom/data.js 344 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 345 * -------------------------------------------------------------------------- 346 */ 347 348 /** 349 * ------------------------------------------------------------------------ 350 * Constants 351 * ------------------------------------------------------------------------ 352 */ 353 const elementMap = new Map(); 354 var Data = { 355 set(element, key, instance) { 356 if (!elementMap.has(element)) { 357 elementMap.set(element, new Map()); 358 } 359 360 const instanceMap = elementMap.get(element); // make it clear we only want one instance per element 361 // can be removed later when multiple key/instances are fine to be used 362 363 if (!instanceMap.has(key) && instanceMap.size !== 0) { 364 // eslint-disable-next-line no-console 365 console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(instanceMap.keys())[0]}.`); 366 return; 367 } 368 369 instanceMap.set(key, instance); 370 }, 371 372 get(element, key) { 373 if (elementMap.has(element)) { 374 return elementMap.get(element).get(key) || null; 375 } 376 377 return null; 378 }, 379 380 remove(element, key) { 381 if (!elementMap.has(element)) { 382 return; 383 } 384 385 const instanceMap = elementMap.get(element); 386 instanceMap.delete(key); // free up element references if there are no instances left for an element 387 388 if (instanceMap.size === 0) { 389 elementMap.delete(element); 390 } 391 } 392 393 }; 394 395 /** 396 * -------------------------------------------------------------------------- 397 * Bootstrap (v5.0.1): dom/event-handler.js 398 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 399 * -------------------------------------------------------------------------- 400 */ 401 /** 402 * ------------------------------------------------------------------------ 403 * Constants 404 * ------------------------------------------------------------------------ 405 */ 406 407 const namespaceRegex = /[^.]*(?=\..*)\.|.*/; 408 const stripNameRegex = /\..*/; 409 const stripUidRegex = /::\d+$/; 410 const eventRegistry = {}; // Events storage 411 412 let uidEvent = 1; 413 const customEvents = { 414 mouseenter: 'mouseover', 415 mouseleave: 'mouseout' 416 };
417 const customEventsRegex = /^(mouseenter|mouseleave)/i; 418 const nativeEvents = new Set(['click', 'dblclick', 'mouseup', 'mousedown', 'contextmenu', 'mousewheel', 'DOMMouseScroll', 'mouseover', 'mouseout', 'mousemove', 'selectstart', 'selectend', 'keydown', 'keypress', 'keyup', 'orientationchange', 'touchstart', 'touchmove', 'touchend', 'touchcancel', 'pointerdown', 'pointermove', 'pointerup', 'pointerleave', 'pointercancel', 'gesturestart', 'gesturechange', 'gestureend', 'focus', 'blur', 'change', 'reset', 'select', 'submit', 'focusin', 'focusout', 'load', 'unload', 'beforeunload', 'resize', 'move', 'DOMContentLoaded', 'readystatechange', 'error', 'abort', 'scroll']); 419 /** 420 * ------------------------------------------------------------------------ 421 * Private methods 422 * ------------------------------------------------------------------------ 423 */ 424 425 function getUidEvent(element, uid) { 426 return uid && `${uid}::${uidEvent++}` || element.uidEvent || uidEvent++; 427 } 428 429 function getEvent(element) { 430 const uid = getUidEvent(element); 431 element.uidEvent = uid; 432 eventRegistry[uid] = eventRegistry[uid] || {}; 433 return eventRegistry[uid]; 434 } 435 436 function bootstrapHandler(element, fn) { 437 return function handler(event) { 438 event.delegateTarget = element; 439 440 if (handler.oneOff) { 441 EventHandler.off(element, event.type, fn); 442 } 443 444 return fn.apply(element, [event]);
vendor: 8,615 bytes, lines 445-712
445 }; 446 } 447 448 function bootstrapDelegationHandler(element, selector, fn) { 449 return function handler(event) { 450 const domElements = element.querySelectorAll(selector); 451 452 for (let { 453 target 454 } = event; target && target !== this; target = target.parentNode) { 455 for (let i = domElements.length; i--;) { 456 if (domElements[i] === target) { 457 event.delegateTarget = target; 458 459 if (handler.oneOff) { 460 // eslint-disable-next-line unicorn/consistent-destructuring 461 EventHandler.off(element, event.type, selector, fn); 462 } 463 464 return fn.apply(target, [event]); 465 } 466 } 467 } // To please ESLint 468 469 470 return null; 471 }; 472 } 473 474 function findHandler(events, handler, delegationSelector = null) { 475 const uidEventList = Object.keys(events); 476 477 for (let i = 0, len = uidEventList.length; i < len; i++) { 478 const event = events[uidEventList[i]]; 479 480 if (event.originalHandler === handler && event.delegationSelector === delegationSelector) { 481 return event; 482 } 483 } 484 485 return null; 486 } 487 488 function normalizeParams(originalTypeEvent, handler, delegationFn) { 489 const delegation = typeof handler === 'string'; 490 const originalHandler = delegation ? delegationFn : handler; 491 let typeEvent = getTypeEvent(originalTypeEvent); 492 const isNative = nativeEvents.has(typeEvent); 493 494 if (!isNative) { 495 typeEvent = originalTypeEvent; 496 } 497 498 return [delegation, originalHandler, typeEvent]; 499 } 500 501 function addHandler(element, originalTypeEvent, handler, delegationFn, oneOff) { 502 if (typeof originalTypeEvent !== 'string' || !element) { 503 return; 504 } 505 506 if (!handler) { 507 handler = delegationFn; 508 delegationFn = null; 509 } // in case of mouseenter or mouseleave wrap the handler within a function that checks for its DOM position 510 // this prevents the handler from being dispatched the same way as mouseover or mouseout does 511 512 513 if (customEventsRegex.test(originalTypeEvent)) { 514 const wrapFn = fn => { 515 return function (event) { 516 if (!event.relatedTarget || event.relatedTarget !== event.delegateTarget && !event.delegateTarget.contains(event.relatedTarget)) { 517 return fn.call(this, event); 518 } 519 }; 520 }; 521 522 if (delegationFn) { 523 delegationFn = wrapFn(delegationFn); 524 } else { 525 handler = wrapFn(handler); 526 } 527 } 528 529 const [delegation, originalHandler, typeEvent] = normalizeParams(originalTypeEvent, handler, delegationFn); 530 const events = getEvent(element); 531 const handlers = events[typeEvent] || (events[typeEvent] = {}); 532 const previousFn = findHandler(handlers, originalHandler, delegation ? handler : null); 533 534 if (previousFn) { 535 previousFn.oneOff = previousFn.oneOff && oneOff; 536 return; 537 } 538 539 const uid = getUidEvent(originalHandler, originalTypeEvent.replace(namespaceRegex, '')); 540 const fn = delegation ? bootstrapDelegationHandler(element, handler, delegationFn) : bootstrapHandler(element, handler); 541 fn.delegationSelector = delegation ? handler : null; 542 fn.originalHandler = originalHandler; 543 fn.oneOff = oneOff; 544 fn.uidEvent = uid; 545 handlers[uid] = fn; 546 element.addEventListener(typeEvent, fn, delegation); 547 } 548 549 function removeHandler(element, events, typeEvent, handler, delegationSelector) { 550 const fn = findHandler(events[typeEvent], handler, delegationSelector); 551 552 if (!fn) { 553 return; 554 } 555 556 element.removeEventListener(typeEvent, fn, Boolean(delegationSelector)); 557 delete events[typeEvent][fn.uidEvent]; 558 } 559 560 function removeNamespacedHandlers(element, events, typeEvent, namespace) { 561 const storeElementEvent = events[typeEvent] || {}; 562 Object.keys(storeElementEvent).forEach(handlerKey => { 563 if (handlerKey.includes(namespace)) { 564 const event = storeElementEvent[handlerKey]; 565 removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector); 566 } 567 }); 568 } 569 570 function getTypeEvent(event) { 571 // allow to get the native events from namespaced events ('click.bs.button' --> 'click') 572 event = event.replace(stripNameRegex, ''); 573 return customEvents[event] || event; 574 } 575 576 const EventHandler = { 577 on(element, event, handler, delegationFn) { 578 addHandler(element, event, handler, delegationFn, false); 579 }, 580 581 one(element, event, handler, delegationFn) { 582 addHandler(element, event, handler, delegationFn, true); 583 }, 584 585 off(element, originalTypeEvent, handler, delegationFn) { 586 if (typeof originalTypeEvent !== 'string' || !element) { 587 return; 588 } 589 590 const [delegation, originalHandler, typeEvent] = normalizeParams(originalTypeEvent, handler, delegationFn); 591 const inNamespace = typeEvent !== originalTypeEvent; 592 const events = getEvent(element); 593 const isNamespace = originalTypeEvent.startsWith('.'); 594 595 if (typeof originalHandler !== 'undefined') { 596 // Simplest case: handler is passed, remove that listener ONLY. 597 if (!events || !events[typeEvent]) { 598 return; 599 } 600 601 removeHandler(element, events, typeEvent, originalHandler, delegation ? handler : null); 602 return; 603 } 604 605 if (isNamespace) { 606 Object.keys(events).forEach(elementEvent => { 607 removeNamespacedHandlers(element, events, elementEvent, originalTypeEvent.slice(1)); 608 }); 609 } 610 611 const storeElementEvent = events[typeEvent] || {}; 612 Object.keys(storeElementEvent).forEach(keyHandlers => { 613 const handlerKey = keyHandlers.replace(stripUidRegex, ''); 614 615 if (!inNamespace || originalTypeEvent.includes(handlerKey)) { 616 const event = storeElementEvent[keyHandlers]; 617 removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector); 618 } 619 }); 620 }, 621 622 trigger(element, event, args) { 623 if (typeof event !== 'string' || !element) { 624 return null; 625 } 626 627 const $ = getjQuery(); 628 const typeEvent = getTypeEvent(event); 629 const inNamespace = event !== typeEvent; 630 const isNative = nativeEvents.has(typeEvent); 631 let jQueryEvent; 632 let bubbles = true; 633 let nativeDispatch = true; 634 let defaultPrevented = false; 635 let evt = null; 636 637 if (inNamespace && $) { 638 jQueryEvent = $.Event(event, args); 639 $(element).trigger(jQueryEvent); 640 bubbles = !jQueryEvent.isPropagationStopped(); 641 nativeDispatch = !jQueryEvent.isImmediatePropagationStopped(); 642 defaultPrevented = jQueryEvent.isDefaultPrevented(); 643 } 644 645 if (isNative) { 646 evt = document.createEvent('HTMLEvents'); 647 evt.initEvent(typeEvent, bubbles, true); 648 } else { 649 evt = new CustomEvent(event, { 650 bubbles, 651 cancelable: true 652 }); 653 } // merge custom information in our event 654 655 656 if (typeof args !== 'undefined') { 657 Object.keys(args).forEach(key => { 658 Object.defineProperty(evt, key, { 659 get() { 660 return args[key]; 661 } 662 663 }); 664 }); 665 } 666 667 if (defaultPrevented) { 668 evt.preventDefault(); 669 } 670 671 if (nativeDispatch) { 672 element.dispatchEvent(evt); 673 } 674 675 if (evt.defaultPrevented && typeof jQueryEvent !== 'undefined') { 676 jQueryEvent.preventDefault(); 677 } 678 679 return evt; 680 } 681 682 }; 683 684 /** 685 * -------------------------------------------------------------------------- 686 * Bootstrap (v5.0.1): base-component.js 687 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 688 * -------------------------------------------------------------------------- 689 */ 690 /** 691 * ------------------------------------------------------------------------ 692 * Constants 693 * ------------------------------------------------------------------------ 694 */ 695 696 const VERSION = '5.0.1'; 697 698 class BaseComponent { 699 constructor(element) { 700 element = getElement(element); 701 702 if (!element) { 703 return; 704 } 705 706 this._element = element; 707 Data.set(this._element, this.constructor.DATA_KEY, this); 708 } 709 710 dispose() { 711 Data.remove(this._element, this.constructor.DATA_KEY); 712 EventHandler.off(this._element, this.constructor.EVENT_KEY);
713 Object.getOwnPropertyNames(this).forEach(propertyName => { 714 this[propertyName] = null; 715 }); 716 } 717 718 _queueCallback(callback, element, isAnimated = true) { 719 if (!isAnimated) { 720 execute(callback); 721 return; 722 } 723 724 const transitionDuration = getTransitionDurationFromElement(element); 725 EventHandler.one(element, 'transitionend', () => execute(callback)); 726 emulateTransitionEnd(element, transitionDuration); 727 } 728 /** Static */ 729 730 731 static getInstance(element) { 732 return Data.get(element, this.DATA_KEY); 733 } 734 735 static get VERSION() { 736 return VERSION; 737 } 738 739 static get NAME() { 740 throw new Error('You have to implement the static method "NAME", for each component!'); 741 } 742 743 static get DATA_KEY() { 744 return `bs.${this.NAME}`; 745 } 746 747 static get EVENT_KEY() { 748 return `.${this.DATA_KEY}`; 749 } 750 751 } 752 753 /** 754 * -------------------------------------------------------------------------- 755 * Bootstrap (v5.0.1): alert.js 756 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 757 * -------------------------------------------------------------------------- 758 */ 759 /** 760 * ------------------------------------------------------------------------ 761 * Constants 762 * ------------------------------------------------------------------------ 763 */ 764 765 const NAME$c = 'alert'; 766 const DATA_KEY$b = 'bs.alert'; 767 const EVENT_KEY$b = `.${DATA_KEY$b}`; 768 const DATA_API_KEY$8 = '.data-api'; 769 const SELECTOR_DISMISS = '[data-bs-dismiss="alert"]'; 770 const EVENT_CLOSE = `close${EVENT_KEY$b}`; 771 const EVENT_CLOSED = `closed${EVENT_KEY$b}`; 772 const EVENT_CLICK_DATA_API$7 = `click${EVENT_KEY$b}${DATA_API_KEY$8}`; 773 const CLASS_NAME_ALERT = 'alert'; 774 const CLASS_NAME_FADE$6 = 'fade'; 775 const CLASS_NAME_SHOW$9 = 'show'; 776 /** 777 * ------------------------------------------------------------------------ 778 * Class Definition 779 * ------------------------------------------------------------------------ 780 */ 781 782 class Alert extends BaseComponent { 783 // Getters 784 static get NAME() { 785 return NAME$c; 786 } // Public 787 788 789 close(element) { 790 const rootElement = element ? this._getRootElement(element) : this._element; 791 792 const customEvent = this._triggerCloseEvent(rootElement); 793 794 if (customEvent === null || customEvent.defaultPrevented) { 795 return; 796 } 797 798 this._removeElement(rootElement); 799 } // Private 800 801 802 _getRootElement(element) { 803 return getElementFromSelector(element) || element.closest(`.${CLASS_NAME_ALERT}`); 804 } 805 806 _triggerCloseEvent(element) { 807 return EventHandler.trigger(element, EVENT_CLOSE); 808 } 809 810 _removeElement(element) { 811 element.classList.remove(CLASS_NAME_SHOW$9); 812 const isAnimated = element.classList.contains(CLASS_NAME_FADE$6); 813 814 this._queueCallback(() => this._destroyElement(element), element, isAnimated); 815 } 816 817 _destroyElement(element) { 818 if (element.parentNode) { 819 element.parentNode.removeChild(element); 820 } 821 822 EventHandler.trigger(element, EVENT_CLOSED); 823 } // Static 824 825 826 static jQueryInterface(config) { 827 return this.each(function () { 828 let data = Data.get(this, DATA_KEY$b); 829 830 if (!data) { 831 data = new Alert(this); 832 } 833 834 if (config === 'close') { 835 data[config](this); 836 } 837 }); 838 } 839 840 static handleDismiss(alertInstance) { 841 return function (event) { 842 if (event) { 843 event.preventDefault(); 844 } 845 846 alertInstance.close(this); 847 }; 848 } 849 850 } 851 /** 852 * ------------------------------------------------------------------------ 853 * Data Api implementation 854 * ------------------------------------------------------------------------ 855 */ 856 857 858 EventHandler.on(document, EVENT_CLICK_DATA_API$7, SELECTOR_DISMISS, Alert.handleDismiss(new Alert())); 859 /** 860 * ------------------------------------------------------------------------ 861 * jQuery 862 * ------------------------------------------------------------------------ 863 * add .Alert to jQuery only if jQuery is present 864 */ 865 866 defineJQueryPlugin(Alert); 867 868 /** 869 * -------------------------------------------------------------------------- 870 * Bootstrap (v5.0.1): button.js 871 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 872 * -------------------------------------------------------------------------- 873 */ 874 /** 875 * ------------------------------------------------------------------------ 876 * Constants 877 * ------------------------------------------------------------------------ 878 */ 879 880 const NAME$b = 'button'; 881 const DATA_KEY$a = 'bs.button'; 882 const EVENT_KEY$a = `.${DATA_KEY$a}`; 883 const DATA_API_KEY$7 = '.data-api'; 884 const CLASS_NAME_ACTIVE$3 = 'active'; 885 const SELECTOR_DATA_TOGGLE$5 = '[data-bs-toggle="button"]'; 886 const EVENT_CLICK_DATA_API$6 = `click${EVENT_KEY$a}${DATA_API_KEY$7}`; 887 /** 888 * ------------------------------------------------------------------------ 889 * Class Definition 890 * ------------------------------------------------------------------------ 891 */ 892 893 class Button extends BaseComponent { 894 // Getters 895 static get NAME() { 896 return NAME$b; 897 } // Public 898 899 900 toggle() { 901 // Toggle class and sync the `aria-pressed` attribute with the return value of the `.toggle(
901)` method 902 this._element.setAttribute('aria-pressed', this._element.classList.toggle(CLASS_NAME_ACTIVE$3)); 903 } // Static 904 905 906 static jQueryInterface(config) { 907 return this.each(function () { 908 let data = Data.get(this, DATA_KEY$a); 909 910 if (!data) { 911 data = new Button(this); 912 } 913 914 if (config === 'toggle') { 915 data[config](); 916 } 917 }); 918 } 919 920 } 921 /** 922 * ------------------------------------------------------------------------ 923 * Data Api implementation 924 * ------------------------------------------------------------------------ 925 */ 926 927 928 EventHandler.on(document, EVENT_CLICK_DATA_API$6, SELECTOR_DATA_TOGGLE$5, event => { 929 event.preventDefault(); 930 const button = event.target.closest(SELECTOR_DATA_TOGGLE$5); 931 let data = Data.get(button, DATA_KEY$a); 932 933 if (!data) { 934 data = new Button(button); 935 } 936 937 data.toggle(); 938 }); 939 /** 940 * ------------------------------------------------------------------------ 941 * jQuery 942 * ------------------------------------------------------------------------ 943 * add .Button to jQuery only if jQuery is present 944 */ 945 946 defineJQueryPlugin(Button); 947 948 /** 949 * -------------------------------------------------------------------------- 950 * Bootstrap (v5.0.1): dom/manipulator.js 951 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 952 * -------------------------------------------------------------------------- 953 */ 954 function normalizeData(val) { 955 if (val === 'true') { 956 return true; 957 } 958 959 if (val === 'false') { 960 return false; 961 } 962 963 if (val === Number(val).toString()) { 964 return Number(val); 965 } 966 967 if (val === '' || val === 'null') { 968 return null; 969 } 970 971 return val; 972 } 973 974 function normalizeDataKey(key) { 975 return key.replace(/[A-Z]/g, chr => `-${chr.toLowerCase()}`); 976 } 977 978 const Manipulator = { 979 setDataAttribute(element, key, value) { 980 element.setAttribute(`data-bs-${normalizeDataKey(key)}`, value); 981 }, 982 983 removeDataAttribute(element, key) { 984 element.removeAttribute(`data-bs-${normalizeDataKey(key)}`); 985 }, 986 987 getDataAttributes(element) { 988 if (!element) { 989 return {}; 990 } 991 992 const attributes = {}; 993 Object.keys(element.dataset).filter(key => key.startsWith('bs')).forEach(key => { 994 let pureKey = key.replace(/^bs/, ''); 995 pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1, pureKey.length); 996 attributes[pureKey] = normalizeData(element.dataset[key]); 997 }); 998 return attributes; 999 }, 1000 1001 getDataAttribute(element, key) { 1002 return normalizeData(element.getAttribute(`data-bs-${normalizeDataKey(key)}`)); 1003 }, 1004 1005 offset(element) { 1006 const rect = element.getBoundingClientRect(); 1007 return { 1008 top: rect.top + document.body.scrollTop, 1009 left: rect.left + document.body.scrollLeft 1010 }; 1011 }, 1012 1013 position(element) { 1014 return { 1015 top: element.offsetTop, 1016 left: element.offsetLeft 1017 }; 1018 } 1019 1020 }; 1021 1022 /** 1023 * -------------------------------------------------------------------------- 1024 * Bootstrap (v5.0.1): collapse.js 1025 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 1026 * -------------------------------------------------------------------------- 1027 */ 1028 /** 1029 * ------------------------------------------------------------------------ 1030 * Constants 1031 * ------------------------------------------------------------------------ 1032 */ 1033 1034 const NAME$9 = 'collapse'; 1035 const DATA_KEY$8 = 'bs.collapse'; 1036 const EVENT_KEY$8 = `.${DATA_KEY$8}`; 1037 const DATA_API_KEY$5 = '.data-api'; 1038 const Default$8 = { 1039 toggle: true, 1040 parent: '' 1041 }; 1042 const DefaultType$8 = { 1043 toggle: 'boolean', 1044 parent: '(string|element)' 1045 }; 1046 const EVENT_SHOW$5 = `show${EVENT_KEY$8}`; 1047 const EVENT_SHOWN$5 = `shown${EVENT_KEY$8}`; 1048 const EVENT_HIDE$5 = `hide${EVENT_KEY$8}`; 1049 const EVENT_HIDDEN$5 = `hidden${EVENT_KEY$8}`; 1050 const EVENT_CLICK_DATA_API$4 = `click${EVENT_KEY$8}${DATA_API_KEY$5}`; 1051 const CLASS_NAME_SHOW$8 = 'show'; 1052 const CLASS_NAME_COLLAPSE = 'collapse'; 1053 const CLASS_NAME_COLLAPSING = 'collapsing'; 1054 const CLASS_NAME_COLLAPSED = 'collapsed'; 1055 const WIDTH = 'width'; 1056 const HEIGHT = 'height'; 1057 const SELECTOR_ACTIVES = '.show, .collapsing'; 1058 const SELECTOR_DATA_TOGGLE$4 = '[data-bs-toggle="collapse"]'; 1059 /** 1060 * ------------------------------------------------------------------------ 1061 * Class Definition 1062 * ------------------------------------------------------------------------ 1063 */ 1064 1065 class Collapse extends BaseComponent { 1066 constructor(element, config) { 1067 super(element); 1068 this._isTransitioning = false; 1069 this._config = this._getConfig(config); 1070 this._triggerArray = SelectorEngine.find(`${SELECTOR_DATA_TOGGLE$4}
1070[href="#${this._element.id}"],` + `${SELECTOR_DATA_TOGGLE$4}[data-bs-target="#${this._element.id}"]`); 1071 const toggleList = SelectorEngine.find(SELECTOR_DATA_TOGGLE$4); 1072 1073 for (let i = 0, len = toggleList.length; i < len; i++) { 1074 const elem = toggleList[i]; 1075 const selector = getSelectorFromElement(elem); 1076 const filterElement = SelectorEngine.find(selector).filter(foundElem => foundElem === this._element); 1077 1078 if (selector !== null && filterElement.length) { 1079 this._selector = selector; 1080 1081 this._triggerArray.push(elem); 1082 } 1083 } 1084 1085 this._parent = this._config.parent ? this._getParent() : null; 1086 1087 if (!this._config.parent) { 1088 this._addAriaAndCollapsedClass(this._element, this._triggerArray); 1089 } 1090 1091 if (this._config.toggle) { 1092 this.toggle(); 1093 } 1094 } // Getters 1095 1096 1097 static get Default() { 1098 return Default$8; 1099 } 1100 1101 static get NAME() { 1102 return NAME$9; 1103 } // Public 1104 1105 1106 toggle() { 1107 if (this._element.classList.contains(CLASS_NAME_SHOW$8)) { 1108 this.hide(); 1109 } else { 1110 this.show(); 1111 } 1112 } 1113 1114 show() { 1115 if (this._isTransitioning || this._element.classList.contains(CLASS_NAME_SHOW$8)) { 1116 return; 1117 } 1118 1119 let actives; 1120 let activesData; 1121 1122 if (this._parent) { 1123 actives = SelectorEngine.find(SELECTOR_ACTIVES, this._parent).filter(elem => { 1124 if (typeof this._config.parent === 'string') { 1125 return elem.getAttribute('data-bs-parent') === this._config.parent; 1126 } 1127 1128 return elem.classList.contains(CLASS_NAME_COLLAPSE); 1129 }); 1130 1131 if (actives.length === 0) { 1132 actives = null; 1133 } 1134 } 1135 1136 const container = SelectorEngine.findOne(this._selector); 1137 1138 if (actives) { 1139 const tempActiveData = actives.find(elem => container !== elem); 1140 activesData = tempActiveData ? Data.get(tempActiveData, DATA_KEY$8) : null; 1141 1142 if (activesData && activesData._isTransitioning) { 1143 return; 1144 } 1145 } 1146 1147 const startEvent = EventHandler.trigger(this._element, EVENT_SHOW$5); 1148 1149 if (startEvent.defaultPrevented) { 1150 return; 1151 } 1152 1153 if (actives) { 1154 actives.forEach(elemActive => { 1155 if (container !== elemActive) { 1156 Collapse.collapseInterface(elemActive, 'hide'); 1157 } 1158 1159 if (!activesData) { 1160 Data.set(elemActive, DATA_KEY$8, null); 1161 } 1162 }); 1163 } 1164 1165 const dimension = this._getDimension(); 1166 1167 this._element.classList.remove(CLASS_NAME_COLLAPSE); 1168 1169 this._element.classList.add(CLASS_NAME_COLLAPSING); 1170 1171 this._element.style[dimension] = 0; 1172 1173 if (this._triggerArray.length) { 1174 this._triggerArray.forEach(element => { 1175 element.classList.remove(CLASS_NAME_COLLAPSED); 1176 element.setAttribute('aria-expanded', true); 1177 }); 1178 } 1179 1180 this.setTransitioning(true); 1181 1182 const complete = () => { 1183 this._element.classList.remove(CLASS_NAME_COLLAPSING); 1184 1185 this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$8); 1186 1187 this._element.style[dimension] = ''; 1188 this.setTransitioning(false); 1189 EventHandler.trigger(this._element, EVENT_SHOWN$5); 1190 }; 1191 1192 const capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1); 1193 const scrollSize = `scroll${capitalizedDimension}`; 1194 1195 this._queueCallback(complete, this._element, true); 1196 1197 this._element.style[dimension] = `${this._element[scrollSize]}px`; 1198 } 1199 1200 hide() { 1201 if (this._isTransitioning || !this._element.classList.contains(CLASS_NAME_SHOW$8)) { 1202 return; 1203 } 1204 1205 const startEvent = EventHandler.trigger(this._element, EVENT_HIDE$5); 1206 1207 if (startEvent.defaultPrevented) { 1208 return; 1209 } 1210 1211 const dimension = this._getDimension(); 1212 1213 this._element.style[dimension] = `${this._element.getBoundingClientRect()[dimension]}px`; 1214 reflow(this._element); 1215 1216 this._element.classList.add(CLASS_NAME_COLLAPSING); 1217 1218 this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$8); 1219 1220 const triggerArrayLength = this._triggerArray.length; 1221 1222 if (triggerArrayLength > 0) { 1223 for (let i = 0; i < triggerArrayLength; i++) { 1224 const trigger = this._triggerArray[i]; 1225 const elem = getElementFromSelector(trigger); 1226 1227 if (elem && !elem.classList.contains(CLASS_NAME_SHOW$8)) { 1228 trigger.classList.add(CLASS_NAME_COLLAPSED); 1229 trigger.setAttribute('aria-expanded', false); 1230 } 1231 } 1232 } 1233 1234 this.setTransitioning(true); 1235 1236 const complete = () => { 1237 this.setTransitioning(false); 1238 1239 this._element.classList.remove(CLASS_NAME_COLLAPSING); 1240 1241 this._element.classList.add(CLASS_NAME_COLLAPSE); 1242 1243 EventHandler.trigger(this._element, EVENT_HIDDEN$5);
1244 }; 1245 1246 this._element.style[dimension] = ''; 1247 1248 this._queueCallback(complete, this._element, true); 1249 } 1250 1251 setTransitioning(isTransitioning) { 1252 this._isTransitioning = isTransitioning; 1253 } // Private 1254 1255 1256 _getConfig(config) { 1257 config = { ...Default$8, 1258 ...config 1259 }; 1260 config.toggle = Boolean(config.toggle); // Coerce string values 1261 1262 typeCheckConfig(NAME$9, config, DefaultType$8); 1263 return config; 1264 } 1265 1266 _getDimension() { 1267 return this._element.classList.contains(WIDTH) ? WIDTH : HEIGHT; 1268 } 1269 1270 _getParent() { 1271 let { 1272 parent 1273 } = this._config; 1274 parent = getElement(parent); 1275 const selector = `${SELECTOR_DATA_TOGGLE$4}[data-bs-parent="${parent}"]`; 1276 SelectorEngine.find(selector, parent).forEach(element => { 1277 const selected = getElementFromSelector(element); 1278 1279 this._addAriaAndCollapsedClass(selected, [element]); 1280 }); 1281 return parent; 1282 } 1283 1284 _addAriaAndCollapsedClass(element, triggerArray) { 1285 if (!element || !triggerArray.length) { 1286 return; 1287 } 1288 1289 const isOpen = element.classList.contains(CLASS_NAME_SHOW$8); 1290 triggerArray.forEach(elem => { 1291 if (isOpen) { 1292 elem.classList.remove(CLASS_NAME_COLLAPSED); 1293 } else { 1294 elem.classList.add(CLASS_NAME_COLLAPSED); 1295 } 1296 1297 elem.setAttribute('aria-expanded', isOpen); 1298 }); 1299 } // Static 1300 1301 1302 static collapseInterface(element, config) { 1303 let data = Data.get(element, DATA_KEY$8); 1304 const _config = { ...Default$8, 1305 ...Manipulator.getDataAttributes(element), 1306 ...(typeof config === 'object' && config ? config : {}) 1307 }; 1308 1309 if (!data && _config.toggle && typeof config === 'string' && /show|hide/.test(config)) { 1310 _config.toggle = false; 1311 } 1312 1313 if (!data) { 1314 data = new Collapse(element, _config); 1315 } 1316 1317 if (typeof config === 'string') { 1318 if (typeof data[config] === 'undefined') { 1319 throw new TypeError(`No method named "${config}"`); 1320 } 1321 1322 data[config](); 1323 } 1324 } 1325 1326 static jQueryInterface(config) { 1327 return this.each(function () { 1328 Collapse.collapseInterface(this, config); 1329 }); 1330 } 1331 1332 } 1333 /** 1334 * ------------------------------------------------------------------------ 1335 * Data Api implementation 1336 * ------------------------------------------------------------------------ 1337 */ 1338 1339 1340 EventHandler.on(document, EVENT_CLICK_DATA_API$4, SELECTOR_DATA_TOGGLE$4, function (event) { 1341 // preventDefault only for <a> elements (which change the URL) not inside the collapsible element 1342 if (event.target.tagName === 'A' || event.delegateTarget && event.delegateTarget.tagName === 'A') { 1343 event.preventDefault(); 1344 } 1345 1346 const triggerData = Manipulator.getDataAttributes(this); 1347 const selector = getSelectorFromElement(this); 1348 const selectorElements = SelectorEngine.find(selector); 1349 selectorElements.forEach(element => { 1350 const data = Data.get(element, DATA_KEY$8); 1351 let config; 1352 1353 if (data) { 1354 // update parent attribute 1355 if (data._parent === null && typeof triggerData.parent === 'string') { 1356 data._config.parent = triggerData.parent; 1357 data._parent = data._getParent(); 1358 } 1359 1360 config = 'toggle'; 1361 } else { 1362 config = triggerData; 1363 } 1364 1365 Collapse.collapseInterface(element, config); 1366 }); 1367 }); 1368 /** 1369 * ------------------------------------------------------------------------ 1370 * jQuery 1371 * ------------------------------------------------------------------------ 1372 * add .Collapse to jQuery only if jQuery is present 1373 */ 1374 1375 defineJQueryPlugin(Collapse); 1376 1377 var top = 'top'; 1378 var bottom = 'bottom'; 1379 var right = 'right'; 1380 var left = 'left'; 1381 var auto = 'auto'; 1382 var basePlacements = [top, bottom, right, left]; 1383 var start = 'start'; 1384 var end = 'end'; 1385 var clippingParents = 'clippingParents'; 1386 var viewport = 'viewport'; 1387 var popper = 'popper'; 1388 var reference = 'reference'; 1389 var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) { 1390 return acc.concat([placement + "-" + start, placement + "-" + end]); 1391 }, []); 1392 var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) { 1393 return acc.concat([placement, placement + "-" + start, placement + "-" + end]); 1394 }, []); // modifiers that need to read the DOM 1395 1396 var beforeRead = 'beforeRead'; 1397 var read = 'read'; 1398 var afterRead = 'afterRead'; // pure-logic modifiers 1399 1400 var beforeMain = 'beforeMain'; 1401 var main = 'main'; 1402 var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state) 1403 1404 var beforeWrite = 'beforeWrite'; 1405 var write = 'write'; 1406 var afterWrite = 'afterWrite'; 1407 var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite]; 1408 1409 function getNodeName(element) { 1410 return element ? (element.nodeName || '').toLowerCase() : null; 1411 } 1412 1413 function getWindow(node) { 1414 if (node == null) { 1415 return window; 1416 } 1417 1418 if (node.toString() !== '[object Window]') { 1419 var ownerDocument = node.ownerDocument; 1420 return ownerDocument ? ownerDocument.defaultView || window : window; 1421 } 1422 1423 return node; 1424 } 1425 1426 function isElement(node) { 1427 var OwnElement = getWindow(node).Element; 1428 return node instanceof OwnElement || node instanceof Element; 1429 } 1430 1431 function isHTMLElement(node) { 1432 var OwnElement = getWindow(node).HTMLElement; 1433 return node instanceof OwnElement || node instanceof HTMLElement; 1434 } 1435 1436 function isShadowRoot(node) { 1437 // IE 11 has no ShadowRoot 1438 if (typeof ShadowRoot === 'undefined') { 1439 return false; 1440 } 1441 1442 var OwnElement = getWindow(node).ShadowRoot; 1443 return node instanceof OwnElement || node instanceof ShadowRoot; 1444 } 1445 1446 // and applies them to the HTMLElements such as popper and arrow 1447 1448 function applyStyles(_ref) { 1449 var state = _ref.state;
vendor: 8,112 bytes, lines 1450-1704
1450 Object.keys(state.elements).forEach(function (name) { 1451 var style = state.styles[name] || {}; 1452 var attributes = state.attributes[name] || {}; 1453 var element = state.elements[name]; // arrow is optional + virtual elements 1454 1455 if (!isHTMLElement(element) || !getNodeName(element)) { 1456 return; 1457 } // Flow doesn't support to extend this property, but it's the most 1458 // effective way to apply styles to an HTMLElement 1459 // $FlowFixMe[cannot-write] 1460 1461 1462 Object.assign(element.style, style); 1463 Object.keys(attributes).forEach(function (name) { 1464 var value = attributes[name]; 1465 1466 if (value === false) { 1467 element.removeAttribute(name); 1468 } else { 1469 element.setAttribute(name, value === true ? '' : value); 1470 } 1471 }); 1472 }); 1473 } 1474 1475 function effect$2(_ref2) { 1476 var state = _ref2.state; 1477 var initialStyles = { 1478 popper: { 1479 position: state.options.strategy, 1480 left: '0', 1481 top: '0', 1482 margin: '0' 1483 }, 1484 arrow: { 1485 position: 'absolute' 1486 }, 1487 reference: {} 1488 }; 1489 Object.assign(state.elements.popper.style, initialStyles.popper); 1490 state.styles = initialStyles; 1491 1492 if (state.elements.arrow) { 1493 Object.assign(state.elements.arrow.style, initialStyles.arrow); 1494 } 1495 1496 return function () { 1497 Object.keys(state.elements).forEach(function (name) { 1498 var element = state.elements[name]; 1499 var attributes = state.attributes[name] || {}; 1500 var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them 1501 1502 var style = styleProperties.reduce(function (style, property) { 1503 style[property] = ''; 1504 return style; 1505 }, {}); // arrow is optional + virtual elements 1506 1507 if (!isHTMLElement(element) || !getNodeName(element)) { 1508 return; 1509 } 1510 1511 Object.assign(element.style, style); 1512 Object.keys(attributes).forEach(function (attribute) { 1513 element.removeAttribute(attribute); 1514 }); 1515 }); 1516 }; 1517 } // eslint-disable-next-line import/no-unused-modules 1518 1519 1520 var applyStyles$1 = { 1521 name: 'applyStyles', 1522 enabled: true, 1523 phase: 'write', 1524 fn: applyStyles, 1525 effect: effect$2, 1526 requires: ['computeStyles'] 1527 }; 1528 1529 function getBasePlacement(placement) { 1530 return placement.split('-')[0]; 1531 } 1532 1533 function getBoundingClientRect(element) { 1534 var rect = element.getBoundingClientRect(); 1535 return { 1536 width: rect.width, 1537 height: rect.height, 1538 top: rect.top, 1539 right: rect.right, 1540 bottom: rect.bottom, 1541 left: rect.left, 1542 x: rect.left, 1543 y: rect.top 1544 }; 1545 } 1546 1547 // means it doesn't take into account transforms. 1548 1549 function getLayoutRect(element) { 1550 var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed. 1551 // Fixes https://github.com/popperjs/popper-core/issues/1223 1552 1553 var width = element.offsetWidth; 1554 var height = element.offsetHeight; 1555 1556 if (Math.abs(clientRect.width - width) <= 1) { 1557 width = clientRect.width; 1558 } 1559 1560 if (Math.abs(clientRect.height - height) <= 1) { 1561 height = clientRect.height; 1562 } 1563 1564 return { 1565 x: element.offsetLeft, 1566 y: element.offsetTop, 1567 width: width, 1568 height: height 1569 }; 1570 } 1571 1572 function contains(parent, child) { 1573 var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method 1574 1575 if (parent.contains(child)) { 1576 return true; 1577 } // then fallback to custom implementation with Shadow DOM support 1578 else if (rootNode && isShadowRoot(rootNode)) { 1579 var next = child; 1580 1581 do { 1582 if (next && parent.isSameNode(next)) { 1583 return true; 1584 } // $FlowFixMe[prop-missing]: need a better way to handle this... 1585 1586 1587 next = next.parentNode || next.host; 1588 } while (next); 1589 } // Give up, the result is false 1590 1591 1592 return false; 1593 } 1594 1595 function getComputedStyle$1(element) { 1596 return getWindow(element).getComputedStyle(element); 1597 } 1598 1599 function isTableElement(element) { 1600 return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0; 1601 } 1602 1603 function getDocumentElement(element) { 1604 // $FlowFixMe[incompatible-return]: assume body is always available 1605 return ((isElement(element) ? element.ownerDocument : // $FlowFixMe[prop-missing] 1606 element.document) || window.document).documentElement; 1607 } 1608 1609 function getParentNode(element) { 1610 if (getNodeName(element) === 'html') { 1611 return element; 1612 } 1613 1614 return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle 1615 // $FlowFixMe[incompatible-return] 1616 // $FlowFixMe[prop-missing] 1617 element.assignedSlot || // step into the shadow DOM of the parent of a slotted node 1618 element.parentNode || ( // DOM Element detected 1619 isShadowRoot(element) ? element.host : null) || // ShadowRoot detected 1620 // $FlowFixMe[incompatible-call]: HTMLElement is a Node 1621 getDocumentElement(element) // fallback 1622 1623 ); 1624 } 1625 1626 function getTrueOffsetParent(element) { 1627 if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837 1628 getComputedStyle$1(element).position === 'fixed') { 1629 return null; 1630 } 1631 1632 return element.offsetParent; 1633 } // `.offsetParent` reports `null` for fixed elements, while absolute elements 1634 // return the containing block 1635 1636 1637 function getContainingBlock(element) { 1638 var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') !== -1; 1639 var isIE = navigator.userAgent.indexOf('Trident') !== -1; 1640 1641 if (isIE && isHTMLElement(element)) { 1642 // In IE 9, 10 and 11 fixed elements containing block is always established by the viewport 1643 var elementCss = getComputedStyle$1(element); 1644 1645 if (elementCss.position === 'fixed') { 1646 return null; 1647 } 1648 } 1649 1650 var currentNode = getParentNode(element); 1651 1652 while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) { 1653 var css = getComputedStyle$1(currentNode); // This is non-exhaustive but covers the most common CSS properties that 1654 // create a containing block. 1655 // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block 1656 1657 if (css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === 'filter' || isFirefox && css.filter && css.filter !== 'none') { 1658 return currentNode; 1659 } else { 1660 currentNode = currentNode.parentNode; 1661 } 1662 } 1663 1664 return null; 1665 } // Gets the closest ancestor positioned element. Handles some edge cases, 1666 // such as table ancestors and cross browser bugs. 1667 1668 1669 function getOffsetParent(element) { 1670 var window = getWindow(element); 1671 var offsetParent = getTrueOffsetParent(element); 1672 1673 while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === 'static') { 1674 offsetParent = getTrueOffsetParent(offsetParent); 1675 } 1676 1677 if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle$1(offsetParent).position === 'static')) { 1678 return window; 1679 } 1680 1681 return offsetParent || getContainingBlock(element) || window; 1682 } 1683 1684 function getMainAxisFromPlacement(placement) { 1685 return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y'; 1686 } 1687 1688 var max = Math.max; 1689 var min = Math.min; 1690 var round = Math.round; 1691 1692 function within(min$1, value, max$1) { 1693 return max(min$1, min(value, max$1)); 1694 } 1695 1696 function getFreshSideObject() { 1697 return { 1698 top: 0, 1699 right: 0, 1700 bottom: 0, 1701 left: 0 1702 }; 1703 } 1704
vendor: 4,881 bytes, lines 1705-1846
1705 function mergePaddingObject(paddingObject) { 1706 return Object.assign({}, getFreshSideObject(), paddingObject); 1707 } 1708 1709 function expandToHashMap(value, keys) { 1710 return keys.reduce(function (hashMap, key) { 1711 hashMap[key] = value; 1712 return hashMap; 1713 }, {}); 1714 } 1715 1716 var toPaddingObject = function toPaddingObject(padding, state) { 1717 padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, { 1718 placement: state.placement 1719 })) : padding; 1720 return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements)); 1721 }; 1722 1723 function arrow(_ref) { 1724 var _state$modifiersData$; 1725 1726 var state = _ref.state, 1727 name = _ref.name, 1728 options = _ref.options; 1729 var arrowElement = state.elements.arrow; 1730 var popperOffsets = state.modifiersData.popperOffsets; 1731 var basePlacement = getBasePlacement(state.placement); 1732 var axis = getMainAxisFromPlacement(basePlacement); 1733 var isVertical = [left, right].indexOf(basePlacement) >= 0; 1734 var len = isVertical ? 'height' : 'width'; 1735 1736 if (!arrowElement || !popperOffsets) { 1737 return; 1738 } 1739 1740 var paddingObject = toPaddingObject(options.padding, state); 1741 var arrowRect = getLayoutRect(arrowElement); 1742 var minProp = axis === 'y' ? top : left; 1743 var maxProp = axis === 'y' ? bottom : right; 1744 var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len]; 1745 var startDiff = popperOffsets[axis] - state.rects.reference[axis]; 1746 var arrowOffsetParent = getOffsetParent(arrowElement); 1747 var clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0; 1748 var centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the popper if the center point is 1749 // outside of the popper bounds 1750 1751 var min = paddingObject[minProp]; 1752 var max = clientSize - arrowRect[len] - paddingObject[maxProp]; 1753 var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference; 1754 var offset = within(min, center, max); // Prevents breaking syntax highlighting... 1755 1756 var axisProp = axis; 1757 state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset, _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$); 1758 } 1759 1760 function effect$1(_ref2) { 1761 var state = _ref2.state, 1762 options = _ref2.options; 1763 var _options$element = options.element, 1764 arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element; 1765 1766 if (arrowElement == null) { 1767 return; 1768 } // CSS selector 1769 1770 1771 if (typeof arrowElement === 'string') { 1772 arrowElement = state.elements.popper.querySelector(arrowElement); 1773 1774 if (!arrowElement) { 1775 return; 1776 } 1777 } 1778 1779 if (!contains(state.elements.popper, arrowElement)) { 1780 1781 return; 1782 } 1783 1784 state.elements.arrow = arrowElement; 1785 } // eslint-disable-next-line import/no-unused-modules 1786 1787 1788 var arrow$1 = { 1789 name: 'arrow', 1790 enabled: true, 1791 phase: 'main', 1792 fn: arrow, 1793 effect: effect$1, 1794 requires: ['popperOffsets'], 1795 requiresIfExists: ['preventOverflow'] 1796 }; 1797 1798 var unsetSides = { 1799 top: 'auto', 1800 right: 'auto', 1801 bottom: 'auto', 1802 left: 'auto' 1803 }; // Round the offsets to the nearest suitable subpixel based on the DPR. 1804 // Zooming can change the DPR, but it seems to report a value that will 1805 // cleanly divide the values into the appropriate subpixels. 1806 1807 function roundOffsetsByDPR(_ref) { 1808 var x = _ref.x, 1809 y = _ref.y; 1810 var win = window; 1811 var dpr = win.devicePixelRatio || 1; 1812 return { 1813 x: round(round(x * dpr) / dpr) || 0, 1814 y: round(round(y * dpr) / dpr) || 0 1815 }; 1816 } 1817 1818 function mapToStyles(_ref2) { 1819 var _Object$assign2; 1820 1821 var popper = _ref2.popper, 1822 popperRect = _ref2.popperRect, 1823 placement = _ref2.placement, 1824 offsets = _ref2.offsets, 1825 position = _ref2.position, 1826 gpuAcceleration = _ref2.gpuAcceleration, 1827 adaptive = _ref2.adaptive, 1828 roundOffsets = _ref2.roundOffsets; 1829 1830 var _ref3 = roundOffsets === true ? roundOffsetsByDPR(offsets) : typeof roundOffsets === 'function' ? roundOffsets(offsets) : offsets, 1831 _ref3$x = _ref3.x, 1832 x = _ref3$x === void 0 ? 0 : _ref3$x, 1833 _ref3$y = _ref3.y, 1834 y = _ref3$y === void 0 ? 0 : _ref3$y; 1835 1836 var hasX = offsets.hasOwnProperty('x'); 1837 var hasY = offsets.hasOwnProperty('y'); 1838 var sideX = left; 1839 var sideY = top; 1840 var win = window; 1841 1842 if (adaptive) { 1843 var offsetParent = getOffsetParent(popper); 1844 var heightProp = 'clientHeight'; 1845 var widthProp = 'clientWidth'; 1846
vendor: 4,138 bytes, lines 1847-1962
1847 if (offsetParent === getWindow(popper)) { 1848 offsetParent = getDocumentElement(popper); 1849 1850 if (getComputedStyle$1(offsetParent).position !== 'static') { 1851 heightProp = 'scrollHeight'; 1852 widthProp = 'scrollWidth'; 1853 } 1854 } // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it 1855 1856 1857 offsetParent = offsetParent; 1858 1859 if (placement === top) { 1860 sideY = bottom; // $FlowFixMe[prop-missing] 1861 1862 y -= offsetParent[heightProp] - popperRect.height; 1863 y *= gpuAcceleration ? 1 : -1; 1864 } 1865 1866 if (placement === left) { 1867 sideX = right; // $FlowFixMe[prop-missing] 1868 1869 x -= offsetParent[widthProp] - popperRect.width; 1870 x *= gpuAcceleration ? 1 : -1; 1871 } 1872 } 1873 1874 var commonStyles = Object.assign({ 1875 position: position 1876 }, adaptive && unsetSides); 1877 1878 if (gpuAcceleration) { 1879 var _Object$assign; 1880 1881 return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) < 2 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign)); 1882 } 1883 1884 return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2)); 1885 } 1886 1887 function computeStyles(_ref4) { 1888 var state = _ref4.state, 1889 options = _ref4.options; 1890 var _options$gpuAccelerat = options.gpuAcceleration, 1891 gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat, 1892 _options$adaptive = options.adaptive, 1893 adaptive = _options$adaptive === void 0 ? true : _options$adaptive, 1894 _options$roundOffsets = options.roundOffsets, 1895 roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets; 1896 1897 var commonStyles = { 1898 placement: getBasePlacement(state.placement), 1899 popper: state.elements.popper, 1900 popperRect: state.rects.popper, 1901 gpuAcceleration: gpuAcceleration 1902 }; 1903 1904 if (state.modifiersData.popperOffsets != null) { 1905 state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, { 1906 offsets: state.modifiersData.popperOffsets, 1907 position: state.options.strategy, 1908 adaptive: adaptive, 1909 roundOffsets: roundOffsets 1910 }))); 1911 } 1912 1913 if (state.modifiersData.arrow != null) { 1914 state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, { 1915 offsets: state.modifiersData.arrow, 1916 position: 'absolute', 1917 adaptive: false, 1918 roundOffsets: roundOffsets 1919 }))); 1920 } 1921 1922 state.attributes.popper = Object.assign({}, state.attributes.popper, { 1923 'data-popper-placement': state.placement 1924 }); 1925 } // eslint-disable-next-line import/no-unused-modules 1926 1927 1928 var computeStyles$1 = { 1929 name: 'computeStyles', 1930 enabled: true, 1931 phase: 'beforeWrite', 1932 fn: computeStyles, 1933 data: {} 1934 }; 1935 1936 var passive = { 1937 passive: true 1938 }; 1939 1940 function effect(_ref) { 1941 var state = _ref.state, 1942 instance = _ref.instance, 1943 options = _ref.options; 1944 var _options$scroll = options.scroll, 1945 scroll = _options$scroll === void 0 ? true : _options$scroll, 1946 _options$resize = options.resize, 1947 resize = _options$resize === void 0 ? true : _options$resize; 1948 var window = getWindow(state.elements.popper); 1949 var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper); 1950 1951 if (scroll) { 1952 scrollParents.forEach(function (scrollParent) { 1953 scrollParent.addEventListener('scroll', instance.update, passive); 1954 }); 1955 } 1956 1957 if (resize) { 1958 window.addEventListener('resize', instance.update, passive); 1959 } 1960 1961 return function () { 1962 if (scroll) {
vendor: 2,467 bytes, lines 1963-2041
1963 scrollParents.forEach(function (scrollParent) { 1964 scrollParent.removeEventListener('scroll', instance.update, passive); 1965 }); 1966 } 1967 1968 if (resize) { 1969 window.removeEventListener('resize', instance.update, passive); 1970 } 1971 }; 1972 } // eslint-disable-next-line import/no-unused-modules 1973 1974 1975 var eventListeners = { 1976 name: 'eventListeners', 1977 enabled: true, 1978 phase: 'write', 1979 fn: function fn() {}, 1980 effect: effect, 1981 data: {} 1982 }; 1983 1984 var hash$1 = { 1985 left: 'right', 1986 right: 'left', 1987 bottom: 'top', 1988 top: 'bottom' 1989 }; 1990 function getOppositePlacement(placement) { 1991 return placement.replace(/left|right|bottom|top/g, function (matched) { 1992 return hash$1[matched]; 1993 }); 1994 } 1995 1996 var hash = { 1997 start: 'end', 1998 end: 'start' 1999 }; 2000 function getOppositeVariationPlacement(placement) { 2001 return placement.replace(/start|end/g, function (matched) { 2002 return hash[matched]; 2003 }); 2004 } 2005 2006 function getWindowScroll(node) { 2007 var win = getWindow(node); 2008 var scrollLeft = win.pageXOffset; 2009 var scrollTop = win.pageYOffset; 2010 return { 2011 scrollLeft: scrollLeft, 2012 scrollTop: scrollTop 2013 }; 2014 } 2015 2016 function getWindowScrollBarX(element) { 2017 // If <html> has a CSS width greater than the viewport, then this will be 2018 // incorrect for RTL. 2019 // Popper 1 is broken in this case and never had a bug report so let's assume 2020 // it's not an issue. I don't think anyone ever specifies width on <html> 2021 // anyway. 2022 // Browsers where the left scrollbar doesn't cause an issue report `0` for 2023 // this (e.g. Edge 2019, IE11, Safari) 2024 return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft; 2025 } 2026 2027 function getViewportRect(element) { 2028 var win = getWindow(element); 2029 var html = getDocumentElement(element); 2030 var visualViewport = win.visualViewport; 2031 var width = html.clientWidth; 2032 var height = html.clientHeight; 2033 var x = 0; 2034 var y = 0; // NB: This isn't supported on iOS <= 12. If the keyboard is open, the popper 2035 // can be obscured underneath it. 2036 // Also, `html.clientHeight` adds the bottom bar height in Safari iOS, even 2037 // if it isn't open, so if this isn't available, the popper will be detected 2038 // to overflow the bottom of the screen too early. 2039 2040 if (visualViewport) { 2041 width = visualViewport.width;
vendor: 5,408 bytes, lines 2042-2177
2042 height = visualViewport.height; // Uses Layout Viewport (like Chrome; Safari does not currently) 2043 // In Chrome, it returns a value very close to 0 (+/-) but contains rounding 2044 // errors due to floating point numbers, so we need to check precision. 2045 // Safari returns a number <= 0, usually < -1 when pinch-zoomed 2046 // Feature detection fails in mobile emulation mode in Chrome. 2047 // Math.abs(win.innerWidth / visualViewport.scale - visualViewport.width) < 2048 // 0.001 2049 // Fallback here: "Not Safari" userAgent 2050 2051 if (!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) { 2052 x = visualViewport.offsetLeft; 2053 y = visualViewport.offsetTop; 2054 } 2055 } 2056 2057 return { 2058 width: width, 2059 height: height, 2060 x: x + getWindowScrollBarX(element), 2061 y: y 2062 }; 2063 } 2064 2065 // of the `<html>` and `<body>` rect bounds if horizontally scrollable 2066 2067 function getDocumentRect(element) { 2068 var _element$ownerDocumen; 2069 2070 var html = getDocumentElement(element); 2071 var winScroll = getWindowScroll(element); 2072 var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body; 2073 var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0); 2074 var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0); 2075 var x = -winScroll.scrollLeft + getWindowScrollBarX(element); 2076 var y = -winScroll.scrollTop; 2077 2078 if (getComputedStyle$1(body || html).direction === 'rtl') { 2079 x += max(html.clientWidth, body ? body.clientWidth : 0) - width; 2080 } 2081 2082 return { 2083 width: width, 2084 height: height, 2085 x: x, 2086 y: y 2087 }; 2088 } 2089 2090 function isScrollParent(element) { 2091 // Firefox wants us to check `-x` and `-y` variations as well 2092 var _getComputedStyle = getComputedStyle$1(element), 2093 overflow = _getComputedStyle.overflow, 2094 overflowX = _getComputedStyle.overflowX, 2095 overflowY = _getComputedStyle.overflowY; 2096 2097 return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX); 2098 } 2099 2100 function getScrollParent(node) { 2101 if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) { 2102 // $FlowFixMe[incompatible-return]: assume body is always available 2103 return node.ownerDocument.body; 2104 } 2105 2106 if (isHTMLElement(node) && isScrollParent(node)) { 2107 return node; 2108 } 2109 2110 return getScrollParent(getParentNode(node)); 2111 } 2112 2113 /* 2114 given a DOM element, return the list of all scroll parents, up the list of ancesors 2115 until we get to the top window object. This list is what we attach scroll listeners 2116 to, because if any of these parent elements scroll, we'll need to re-calculate the 2117 reference element's position. 2118 */ 2119 2120 function listScrollParents(element, list) { 2121 var _element$ownerDocumen; 2122 2123 if (list === void 0) { 2124 list = []; 2125 } 2126 2127 var scrollParent = getScrollParent(element); 2128 var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body); 2129 var win = getWindow(scrollParent); 2130 var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent; 2131 var updatedList = list.concat(target); 2132 return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here 2133 updatedList.concat(listScrollParents(getParentNode(target))); 2134 } 2135 2136 function rectToClientRect(rect) { 2137 return Object.assign({}, rect, { 2138 left: rect.x, 2139 top: rect.y, 2140 right: rect.x + rect.width, 2141 bottom: rect.y + rect.height 2142 }); 2143 } 2144 2145 function getInnerBoundingClientRect(element) { 2146 var rect = getBoundingClientRect(element); 2147 rect.top = rect.top + element.clientTop; 2148 rect.left = rect.left + element.clientLeft; 2149 rect.bottom = rect.top + element.clientHeight; 2150 rect.right = rect.left + element.clientWidth; 2151 rect.width = element.clientWidth; 2152 rect.height = element.clientHeight; 2153 rect.x = rect.left; 2154 rect.y = rect.top; 2155 return rect; 2156 } 2157 2158 function getClientRectFromMixedType(element, clippingParent) { 2159 return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isHTMLElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element))); 2160 } // A "clipping parent" is an overflowable container with the characteristic of 2161 // clipping (or hiding) overflowing elements with a position different from 2162 // `initial` 2163 2164 2165 function getClippingParents(element) { 2166 var clippingParents = listScrollParents(getParentNode(element)); 2167 var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle$1(element).position) >= 0; 2168 var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element; 2169 2170 if (!isElement(clipperElement)) { 2171 return []; 2172 } // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414 2173 2174 2175 return clippingParents.filter(function (clippingParent) { 2176 return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body'; 2177 });
vendor: 4,186 bytes, lines 2178-2292
2178 } // Gets the maximum area that the element is visible in due to any number of 2179 // clipping parents 2180 2181 2182 function getClippingRect(element, boundary, rootBoundary) { 2183 var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary); 2184 var clippingParents = [].concat(mainClippingParents, [rootBoundary]); 2185 var firstClippingParent = clippingParents[0]; 2186 var clippingRect = clippingParents.reduce(function (accRect, clippingParent) { 2187 var rect = getClientRectFromMixedType(element, clippingParent); 2188 accRect.top = max(rect.top, accRect.top); 2189 accRect.right = min(rect.right, accRect.right); 2190 accRect.bottom = min(rect.bottom, accRect.bottom); 2191 accRect.left = max(rect.left, accRect.left); 2192 return accRect; 2193 }, getClientRectFromMixedType(element, firstClippingParent)); 2194 clippingRect.width = clippingRect.right - clippingRect.left; 2195 clippingRect.height = clippingRect.bottom - clippingRect.top; 2196 clippingRect.x = clippingRect.left; 2197 clippingRect.y = clippingRect.top; 2198 return clippingRect; 2199 } 2200 2201 function getVariation(placement) { 2202 return placement.split('-')[1]; 2203 } 2204 2205 function computeOffsets(_ref) { 2206 var reference = _ref.reference, 2207 element = _ref.element, 2208 placement = _ref.placement; 2209 var basePlacement = placement ? getBasePlacement(placement) : null; 2210 var variation = placement ? getVariation(placement) : null; 2211 var commonX = reference.x + reference.width / 2 - element.width / 2; 2212 var commonY = reference.y + reference.height / 2 - element.height / 2; 2213 var offsets; 2214 2215 switch (basePlacement) { 2216 case top: 2217 offsets = { 2218 x: commonX, 2219 y: reference.y - element.height 2220 }; 2221 break; 2222 2223 case bottom: 2224 offsets = { 2225 x: commonX, 2226 y: reference.y + reference.height 2227 }; 2228 break; 2229 2230 case right: 2231 offsets = { 2232 x: reference.x + reference.width, 2233 y: commonY 2234 }; 2235 break; 2236 2237 case left: 2238 offsets = { 2239 x: reference.x - element.width, 2240 y: commonY 2241 }; 2242 break; 2243 2244 default: 2245 offsets = { 2246 x: reference.x, 2247 y: reference.y 2248 }; 2249 } 2250 2251 var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null; 2252 2253 if (mainAxis != null) { 2254 var len = mainAxis === 'y' ? 'height' : 'width'; 2255 2256 switch (variation) { 2257 case start: 2258 offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2); 2259 break; 2260 2261 case end: 2262 offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2); 2263 break; 2264 } 2265 } 2266 2267 return offsets; 2268 } 2269 2270 function detectOverflow(state, options) { 2271 if (options === void 0) { 2272 options = {}; 2273 } 2274 2275 var _options = options, 2276 _options$placement = _options.placement, 2277 placement = _options$placement === void 0 ? state.placement : _options$placement, 2278 _options$boundary = _options.boundary, 2279 boundary = _options$boundary === void 0 ? clippingParents : _options$boundary, 2280 _options$rootBoundary = _options.rootBoundary, 2281 rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary, 2282 _options$elementConte = _options.elementContext, 2283 elementContext = _options$elementConte === void 0 ? popper : _options$elementConte, 2284 _options$altBoundary = _options.altBoundary, 2285 altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary, 2286 _options$padding = _options.padding, 2287 padding = _options$padding === void 0 ? 0 : _options$padding; 2288 var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements)); 2289 var altContext = elementContext === popper ? reference : popper; 2290 var referenceElement = state.elements.reference; 2291 var popperRect = state.rects.popper; 2292 var element = state.elements[altBoundary ? altContext : elementContext];
vendor: 8,503 bytes, lines 2293-2524
2293 var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary); 2294 var referenceClientRect = getBoundingClientRect(referenceElement); 2295 var popperOffsets = computeOffsets({ 2296 reference: referenceClientRect, 2297 element: popperRect, 2298 strategy: 'absolute', 2299 placement: placement 2300 }); 2301 var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets)); 2302 var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect 2303 // 0 or negative = within the clipping rect 2304 2305 var overflowOffsets = { 2306 top: clippingClientRect.top - elementClientRect.top + paddingObject.top, 2307 bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom, 2308 left: clippingClientRect.left - elementClientRect.left + paddingObject.left, 2309 right: elementClientRect.right - clippingClientRect.right + paddingObject.right 2310 }; 2311 var offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element 2312 2313 if (elementContext === popper && offsetData) { 2314 var offset = offsetData[placement]; 2315 Object.keys(overflowOffsets).forEach(function (key) { 2316 var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1; 2317 var axis = [top, bottom].indexOf(key) >= 0 ? 'y' : 'x'; 2318 overflowOffsets[key] += offset[axis] * multiply; 2319 }); 2320 } 2321 2322 return overflowOffsets; 2323 } 2324 2325 function computeAutoPlacement(state, options) { 2326 if (options === void 0) { 2327 options = {}; 2328 } 2329 2330 var _options = options, 2331 placement = _options.placement, 2332 boundary = _options.boundary, 2333 rootBoundary = _options.rootBoundary, 2334 padding = _options.padding, 2335 flipVariations = _options.flipVariations, 2336 _options$allowedAutoP = _options.allowedAutoPlacements, 2337 allowedAutoPlacements = _options$allowedAutoP === void 0 ? placements : _options$allowedAutoP; 2338 var variation = getVariation(placement); 2339 var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) { 2340 return getVariation(placement) === variation; 2341 }) : basePlacements; 2342 var allowedPlacements = placements$1.filter(function (placement) { 2343 return allowedAutoPlacements.indexOf(placement) >= 0; 2344 }); 2345 2346 if (allowedPlacements.length === 0) { 2347 allowedPlacements = placements$1; 2348 } // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions... 2349 2350 2351 var overflows = allowedPlacements.reduce(function (acc, placement) { 2352 acc[placement] = detectOverflow(state, { 2353 placement: placement, 2354 boundary: boundary, 2355 rootBoundary: rootBoundary, 2356 padding: padding 2357 })[getBasePlacement(placement)]; 2358 return acc; 2359 }, {}); 2360 return Object.keys(overflows).sort(function (a, b) { 2361 return overflows[a] - overflows[b]; 2362 }); 2363 } 2364 2365 function getExpandedFallbackPlacements(placement) { 2366 if (getBasePlacement(placement) === auto) { 2367 return []; 2368 } 2369 2370 var oppositePlacement = getOppositePlacement(placement); 2371 return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)]; 2372 } 2373 2374 function flip(_ref) { 2375 var state = _ref.state, 2376 options = _ref.options, 2377 name = _ref.name; 2378 2379 if (state.modifiersData[name]._skip) { 2380 return; 2381 } 2382 2383 var _options$mainAxis = options.mainAxis, 2384 checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis, 2385 _options$altAxis = options.altAxis, 2386 checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis, 2387 specifiedFallbackPlacements = options.fallbackPlacements, 2388 padding = options.padding, 2389 boundary = options.boundary, 2390 rootBoundary = options.rootBoundary, 2391 altBoundary = options.altBoundary, 2392 _options$flipVariatio = options.flipVariations, 2393 flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio, 2394 allowedAutoPlacements = options.allowedAutoPlacements; 2395 var preferredPlacement = state.options.placement; 2396 var basePlacement = getBasePlacement(preferredPlacement); 2397 var isBasePlacement = basePlacement === preferredPlacement; 2398 var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement)); 2399 var placements = [preferredPlacement].concat(fallbackPlacements).reduce(function (acc, placement) { 2400 return acc.concat(getBasePlacement(placement) === auto ? computeAutoPlacement(state, { 2401 placement: placement, 2402 boundary: boundary, 2403 rootBoundary: rootBoundary, 2404 padding: padding, 2405 flipVariations: flipVariations, 2406 allowedAutoPlacements: allowedAutoPlacements 2407 }) : placement); 2408 }, []); 2409 var referenceRect = state.rects.reference; 2410 var popperRect = state.rects.popper; 2411 var checksMap = new Map(); 2412 var makeFallbackChecks = true; 2413 var firstFittingPlacement = placements[0]; 2414 2415 for (var i = 0; i < placements.length; i++) { 2416 var placement = placements[i]; 2417 2418 var _basePlacement = getBasePlacement(placement); 2419 2420 var isStartVariation = getVariation(placement) === start; 2421 var isVertical = [top, bottom].indexOf(_basePlacement) >= 0; 2422 var len = isVertical ? 'width' : 'height'; 2423 var overflow = detectOverflow(state, { 2424 placement: placement, 2425 boundary: boundary, 2426 rootBoundary: rootBoundary, 2427 altBoundary: altBoundary, 2428 padding: padding 2429 }); 2430 var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top; 2431 2432 if (referenceRect[len] > popperRect[len]) { 2433 mainVariationSide = getOppositePlacement(mainVariationSide); 2434 } 2435 2436 var altVariationSide = getOppositePlacement(mainVariationSide); 2437 var checks = []; 2438 2439 if (checkMainAxis) { 2440 checks.push(overflow[_basePlacement] <= 0); 2441 } 2442 2443 if (checkAltAxis) { 2444 checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0); 2445 } 2446 2447 if (checks.every(function (check) { 2448 return check; 2449 })) { 2450 firstFittingPlacement = placement; 2451 makeFallbackChecks = false; 2452 break; 2453 } 2454 2455 checksMap.set(placement, checks); 2456 } 2457 2458 if (makeFallbackChecks) { 2459 // `2` may be desired in some cases – research later 2460 var numberOfChecks = flipVariations ? 3 : 1; 2461 2462 var _loop = function _loop(_i) { 2463 var fittingPlacement = placements.find(function (placement) { 2464 var checks = checksMap.get(placement); 2465 2466 if (checks) { 2467 return checks.slice(0, _i).every(function (check) { 2468 return check; 2469 }); 2470 } 2471 }); 2472 2473 if (fittingPlacement) { 2474 firstFittingPlacement = fittingPlacement; 2475 return "break"; 2476 } 2477 }; 2478 2479 for (var _i = numberOfChecks; _i > 0; _i--) { 2480 var _ret = _loop(_i); 2481 2482 if (_ret === "break") break; 2483 } 2484 } 2485 2486 if (state.placement !== firstFittingPlacement) { 2487 state.modifiersData[name]._skip = true; 2488 state.placement = firstFittingPlacement; 2489 state.reset = true; 2490 } 2491 } // eslint-disable-next-line import/no-unused-modules 2492 2493 2494 var flip$1 = { 2495 name: 'flip', 2496 enabled: true, 2497 phase: 'main', 2498 fn: flip, 2499 requiresIfExists: ['offset'], 2500 data: { 2501 _skip: false 2502 } 2503 }; 2504 2505 function getSideOffsets(overflow, rect, preventedOffsets) { 2506 if (preventedOffsets === void 0) { 2507 preventedOffsets = { 2508 x: 0, 2509 y: 0 2510 }; 2511 } 2512 2513 return { 2514 top: overflow.top - rect.height - preventedOffsets.y, 2515 right: overflow.right - rect.width + preventedOffsets.x, 2516 bottom: overflow.bottom - rect.height + preventedOffsets.y, 2517 left: overflow.left - rect.width - preventedOffsets.x 2518 }; 2519 } 2520 2521 function isAnySideFullyClipped(overflow) { 2522 return [top, right, bottom, left].some(function (side) { 2523 return overflow[side] >= 0; 2524 });
vendor: 4,738 bytes, lines 2525-2665
2525 } 2526 2527 function hide$1(_ref) { 2528 var state = _ref.state, 2529 name = _ref.name; 2530 var referenceRect = state.rects.reference; 2531 var popperRect = state.rects.popper; 2532 var preventedOffsets = state.modifiersData.preventOverflow; 2533 var referenceOverflow = detectOverflow(state, { 2534 elementContext: 'reference' 2535 }); 2536 var popperAltOverflow = detectOverflow(state, { 2537 altBoundary: true 2538 }); 2539 var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect); 2540 var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets); 2541 var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets); 2542 var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets); 2543 state.modifiersData[name] = { 2544 referenceClippingOffsets: referenceClippingOffsets, 2545 popperEscapeOffsets: popperEscapeOffsets, 2546 isReferenceHidden: isReferenceHidden, 2547 hasPopperEscaped: hasPopperEscaped 2548 }; 2549 state.attributes.popper = Object.assign({}, state.attributes.popper, { 2550 'data-popper-reference-hidden': isReferenceHidden, 2551 'data-popper-escaped': hasPopperEscaped 2552 }); 2553 } // eslint-disable-next-line import/no-unused-modules 2554 2555 2556 var hide$2 = { 2557 name: 'hide', 2558 enabled: true, 2559 phase: 'main', 2560 requiresIfExists: ['preventOverflow'], 2561 fn: hide$1 2562 }; 2563 2564 function distanceAndSkiddingToXY(placement, rects, offset) { 2565 var basePlacement = getBasePlacement(placement); 2566 var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1; 2567 2568 var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, { 2569 placement: placement 2570 })) : offset, 2571 skidding = _ref[0], 2572 distance = _ref[1]; 2573 2574 skidding = skidding || 0; 2575 distance = (distance || 0) * invertDistance; 2576 return [left, right].indexOf(basePlacement) >= 0 ? { 2577 x: distance, 2578 y: skidding 2579 } : { 2580 x: skidding, 2581 y: distance 2582 }; 2583 } 2584 2585 function offset(_ref2) { 2586 var state = _ref2.state, 2587 options = _ref2.options, 2588 name = _ref2.name; 2589 var _options$offset = options.offset, 2590 offset = _options$offset === void 0 ? [0, 0] : _options$offset; 2591 var data = placements.reduce(function (acc, placement) { 2592 acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset); 2593 return acc; 2594 }, {}); 2595 var _data$state$placement = data[state.placement], 2596 x = _data$state$placement.x, 2597 y = _data$state$placement.y; 2598 2599 if (state.modifiersData.popperOffsets != null) { 2600 state.modifiersData.popperOffsets.x += x; 2601 state.modifiersData.popperOffsets.y += y; 2602 } 2603 2604 state.modifiersData[name] = data; 2605 } // eslint-disable-next-line import/no-unused-modules 2606 2607 2608 var offset$1 = { 2609 name: 'offset', 2610 enabled: true, 2611 phase: 'main', 2612 requires: ['popperOffsets'], 2613 fn: offset 2614 }; 2615 2616 function popperOffsets(_ref) { 2617 var state = _ref.state, 2618 name = _ref.name; 2619 // Offsets are the actual position the popper needs to have to be 2620 // properly positioned near its reference element 2621 // This is the most basic placement, and will be adjusted by 2622 // the modifiers in the next step 2623 state.modifiersData[name] = computeOffsets({ 2624 reference: state.rects.reference, 2625 element: state.rects.popper, 2626 strategy: 'absolute', 2627 placement: state.placement 2628 }); 2629 } // eslint-disable-next-line import/no-unused-modules 2630 2631 2632 var popperOffsets$1 = { 2633 name: 'popperOffsets', 2634 enabled: true, 2635 phase: 'read', 2636 fn: popperOffsets, 2637 data: {} 2638 }; 2639 2640 function getAltAxis(axis) { 2641 return axis === 'x' ? 'y' : 'x'; 2642 } 2643 2644 function preventOverflow(_ref) { 2645 var state = _ref.state, 2646 options = _ref.options, 2647 name = _ref.name; 2648 var _options$mainAxis = options.mainAxis, 2649 checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis, 2650 _options$altAxis = options.altAxis, 2651 checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis, 2652 boundary = options.boundary, 2653 rootBoundary = options.rootBoundary, 2654 altBoundary = options.altBoundary, 2655 padding = options.padding, 2656 _options$tether = options.tether, 2657 tether = _options$tether === void 0 ? true : _options$tether, 2658 _options$tetherOffset = options.tetherOffset, 2659 tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset; 2660 var overflow = detectOverflow(state, { 2661 boundary: boundary, 2662 rootBoundary: rootBoundary, 2663 padding: padding, 2664 altBoundary: altBoundary 2665 });
vendor: 4,416 bytes, lines 2666-2763
2666 var basePlacement = getBasePlacement(state.placement); 2667 var variation = getVariation(state.placement); 2668 var isBasePlacement = !variation; 2669 var mainAxis = getMainAxisFromPlacement(basePlacement); 2670 var altAxis = getAltAxis(mainAxis); 2671 var popperOffsets = state.modifiersData.popperOffsets; 2672 var referenceRect = state.rects.reference; 2673 var popperRect = state.rects.popper; 2674 var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, { 2675 placement: state.placement 2676 })) : tetherOffset; 2677 var data = { 2678 x: 0, 2679 y: 0 2680 }; 2681 2682 if (!popperOffsets) { 2683 return; 2684 } 2685 2686 if (checkMainAxis || checkAltAxis) { 2687 var mainSide = mainAxis === 'y' ? top : left; 2688 var altSide = mainAxis === 'y' ? bottom : right; 2689 var len = mainAxis === 'y' ? 'height' : 'width'; 2690 var offset = popperOffsets[mainAxis]; 2691 var min$1 = popperOffsets[mainAxis] + overflow[mainSide]; 2692 var max$1 = popperOffsets[mainAxis] - overflow[altSide]; 2693 var additive = tether ? -popperRect[len] / 2 : 0; 2694 var minLen = variation === start ? referenceRect[len] : popperRect[len]; 2695 var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go 2696 // outside the reference bounds 2697 2698 var arrowElement = state.elements.arrow; 2699 var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : { 2700 width: 0, 2701 height: 0 2702 }; 2703 var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : getFreshSideObject(); 2704 var arrowPaddingMin = arrowPaddingObject[mainSide]; 2705 var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want 2706 // to include its full size in the calculation. If the reference is small 2707 // and near the edge of a boundary, the popper can overflow even if the 2708 // reference is not overflowing as well (e.g. virtual elements with no 2709 // width or height) 2710 2711 var arrowLen = within(0, referenceRect[len], arrowRect[len]); 2712 var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - tetherOffsetValue : minLen - arrowLen - arrowPaddingMin - tetherOffsetValue; 2713 var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + tetherOffsetValue : maxLen + arrowLen + arrowPaddingMax + tetherOffsetValue; 2714 var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow); 2715 var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0; 2716 var offsetModifierValue = state.modifiersData.offset ? state.modifiersData.offset[state.placement][mainAxis] : 0; 2717 var tetherMin = popperOffsets[mainAxis] + minOffset - offsetModifierValue - clientOffset; 2718 var tetherMax = popperOffsets[mainAxis] + maxOffset - offsetModifierValue; 2719 2720 if (checkMainAxis) { 2721 var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset, tether ? max(max$1, tetherMax) : max$1); 2722 popperOffsets[mainAxis] = preventedOffset; 2723 data[mainAxis] = preventedOffset - offset; 2724 } 2725 2726 if (checkAltAxis) { 2727 var _mainSide = mainAxis === 'x' ? top : left; 2728 2729 var _altSide = mainAxis === 'x' ? bottom : right; 2730 2731 var _offset = popperOffsets[altAxis]; 2732 2733 var _min = _offset + overflow[_mainSide]; 2734 2735 var _max = _offset - overflow[_altSide]; 2736 2737 var _preventedOffset = within(tether ? min(_min, tetherMin) : _min, _offset, tether ? max(_max, tetherMax) : _max); 2738 2739 popperOffsets[altAxis] = _preventedOffset; 2740 data[altAxis] = _preventedOffset - _offset; 2741 } 2742 } 2743 2744 state.modifiersData[name] = data; 2745 } // eslint-disable-next-line import/no-unused-modules 2746 2747 2748 var preventOverflow$1 = { 2749 name: 'preventOverflow', 2750 enabled: true, 2751 phase: 'main', 2752 fn: preventOverflow, 2753 requiresIfExists: ['offset'] 2754 }; 2755 2756 function getHTMLElementScroll(element) { 2757 return { 2758 scrollLeft: element.scrollLeft, 2759 scrollTop: element.scrollTop 2760 }; 2761 } 2762 2763 function getNodeScroll(node) {
vendor: 6,009 bytes, lines 2764-2949
2764 if (node === getWindow(node) || !isHTMLElement(node)) { 2765 return getWindowScroll(node); 2766 } else { 2767 return getHTMLElementScroll(node); 2768 } 2769 } 2770 2771 // Composite means it takes into account transforms as well as layout. 2772 2773 function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) { 2774 if (isFixed === void 0) { 2775 isFixed = false; 2776 } 2777 2778 var documentElement = getDocumentElement(offsetParent); 2779 var rect = getBoundingClientRect(elementOrVirtualElement); 2780 var isOffsetParentAnElement = isHTMLElement(offsetParent); 2781 var scroll = { 2782 scrollLeft: 0, 2783 scrollTop: 0 2784 }; 2785 var offsets = { 2786 x: 0, 2787 y: 0 2788 }; 2789 2790 if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) { 2791 if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078 2792 isScrollParent(documentElement)) { 2793 scroll = getNodeScroll(offsetParent); 2794 } 2795 2796 if (isHTMLElement(offsetParent)) { 2797 offsets = getBoundingClientRect(offsetParent); 2798 offsets.x += offsetParent.clientLeft; 2799 offsets.y += offsetParent.clientTop; 2800 } else if (documentElement) { 2801 offsets.x = getWindowScrollBarX(documentElement); 2802 } 2803 } 2804 2805 return { 2806 x: rect.left + scroll.scrollLeft - offsets.x, 2807 y: rect.top + scroll.scrollTop - offsets.y, 2808 width: rect.width, 2809 height: rect.height 2810 }; 2811 } 2812 2813 function order(modifiers) { 2814 var map = new Map(); 2815 var visited = new Set(); 2816 var result = []; 2817 modifiers.forEach(function (modifier) { 2818 map.set(modifier.name, modifier); 2819 }); // On visiting object, check for its dependencies and visit them recursively 2820 2821 function sort(modifier) { 2822 visited.add(modifier.name); 2823 var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []); 2824 requires.forEach(function (dep) { 2825 if (!visited.has(dep)) { 2826 var depModifier = map.get(dep); 2827 2828 if (depModifier) { 2829 sort(depModifier); 2830 } 2831 } 2832 }); 2833 result.push(modifier); 2834 } 2835 2836 modifiers.forEach(function (modifier) { 2837 if (!visited.has(modifier.name)) { 2838 // check for visited object 2839 sort(modifier); 2840 } 2841 }); 2842 return result; 2843 } 2844 2845 function orderModifiers(modifiers) { 2846 // order based on dependencies 2847 var orderedModifiers = order(modifiers); // order based on phase 2848 2849 return modifierPhases.reduce(function (acc, phase) { 2850 return acc.concat(orderedModifiers.filter(function (modifier) { 2851 return modifier.phase === phase; 2852 })); 2853 }, []); 2854 } 2855 2856 function debounce(fn) { 2857 var pending; 2858 return function () { 2859 if (!pending) { 2860 pending = new Promise(function (resolve) { 2861 Promise.resolve().then(function () { 2862 pending = undefined; 2863 resolve(fn()); 2864 }); 2865 }); 2866 } 2867 2868 return pending; 2869 }; 2870 } 2871 2872 function mergeByName(modifiers) { 2873 var merged = modifiers.reduce(function (merged, current) { 2874 var existing = merged[current.name]; 2875 merged[current.name] = existing ? Object.assign({}, existing, current, { 2876 options: Object.assign({}, existing.options, current.options), 2877 data: Object.assign({}, existing.data, current.data) 2878 }) : current; 2879 return merged; 2880 }, {}); // IE11 does not support Object.values 2881 2882 return Object.keys(merged).map(function (key) { 2883 return merged[key]; 2884 }); 2885 } 2886 2887 var DEFAULT_OPTIONS = { 2888 placement: 'bottom', 2889 modifiers: [], 2890 strategy: 'absolute' 2891 }; 2892 2893 function areValidElements() { 2894 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 2895 args[_key] = arguments[_key]; 2896 } 2897 2898 return !args.some(function (element) { 2899 return !(element && typeof element.getBoundingClientRect === 'function'); 2900 }); 2901 } 2902 2903 function popperGenerator(generatorOptions) { 2904 if (generatorOptions === void 0) { 2905 generatorOptions = {}; 2906 } 2907 2908 var _generatorOptions = generatorOptions, 2909 _generatorOptions$def = _generatorOptions.defaultModifiers, 2910 defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def, 2911 _generatorOptions$def2 = _generatorOptions.defaultOptions, 2912 defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2; 2913 return function createPopper(reference, popper, options) { 2914 if (options === void 0) { 2915 options = defaultOptions; 2916 } 2917 2918 var state = { 2919 placement: 'bottom', 2920 orderedModifiers: [], 2921 options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions), 2922 modifiersData: {}, 2923 elements: { 2924 reference: reference, 2925 popper: popper 2926 }, 2927 attributes: {}, 2928 styles: {} 2929 }; 2930 var effectCleanupFns = []; 2931 var isDestroyed = false; 2932 var instance = { 2933 state: state, 2934 setOptions: function setOptions(options) { 2935 cleanupModifierEffects(); 2936 state.options = Object.assign({}, defaultOptions, state.options, options); 2937 state.scrollParents = { 2938 reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [], 2939 popper: listScrollParents(popper) 2940 }; // Orders the modifiers based on their dependencies and `phase` 2941 // properties 2942 2943 var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers 2944 2945 state.orderedModifiers = orderedModifiers.filter(function (m) { 2946 return m.enabled; 2947 }); // Validate the provided modifiers so that the consumer will get warned 2948 2949 runModifierEffects();
vendor: 4,113 bytes, lines 2950-3049
2950 return instance.update(); 2951 }, 2952 // Sync update – it will always be executed, even if not necessary. This 2953 // is useful for low frequency updates where sync behavior simplifies the 2954 // logic. 2955 // For high frequency updates (e.g. `resize` and `scroll` events), always 2956 // prefer the async Popper#update method 2957 forceUpdate: function forceUpdate() { 2958 if (isDestroyed) { 2959 return; 2960 } 2961 2962 var _state$elements = state.elements, 2963 reference = _state$elements.reference, 2964 popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements 2965 // anymore 2966 2967 if (!areValidElements(reference, popper)) { 2968 2969 return; 2970 } // Store the reference and popper rects to be read by modifiers 2971 2972 2973 state.rects = { 2974 reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'), 2975 popper: getLayoutRect(popper) 2976 }; // Modifiers have the ability to reset the current update cycle. The 2977 // most common use case for this is the `flip` modifier changing the 2978 // placement, which then needs to re-run all the modifiers, because the 2979 // logic was previously ran for the previous placement and is therefore 2980 // stale/incorrect 2981 2982 state.reset = false; 2983 state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier 2984 // is filled with the initial data specified by the modifier. This means 2985 // it doesn't persist and is fresh on each update. 2986 // To ensure persistent data, use `${name}#persistent` 2987 2988 state.orderedModifiers.forEach(function (modifier) { 2989 return state.modifiersData[modifier.name] = Object.assign({}, modifier.data); 2990 }); 2991 2992 for (var index = 0; index < state.orderedModifiers.length; index++) { 2993 2994 if (state.reset === true) { 2995 state.reset = false; 2996 index = -1; 2997 continue; 2998 } 2999 3000 var _state$orderedModifie = state.orderedModifiers[index], 3001 fn = _state$orderedModifie.fn, 3002 _state$orderedModifie2 = _state$orderedModifie.options, 3003 _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2, 3004 name = _state$orderedModifie.name; 3005 3006 if (typeof fn === 'function') { 3007 state = fn({ 3008 state: state, 3009 options: _options, 3010 name: name, 3011 instance: instance 3012 }) || state; 3013 } 3014 } 3015 }, 3016 // Async and optimistically optimized update – it will not be executed if 3017 // not necessary (debounced to run at most once-per-tick) 3018 update: debounce(function () { 3019 return new Promise(function (resolve) { 3020 instance.forceUpdate(); 3021 resolve(state); 3022 }); 3023 }), 3024 destroy: function destroy() { 3025 cleanupModifierEffects(); 3026 isDestroyed = true; 3027 } 3028 }; 3029 3030 if (!areValidElements(reference, popper)) { 3031 3032 return instance; 3033 } 3034 3035 instance.setOptions(options).then(function (state) { 3036 if (!isDestroyed && options.onFirstUpdate) { 3037 options.onFirstUpdate(state); 3038 } 3039 }); // Modifiers have the ability to execute arbitrary code before the first 3040 // update cycle runs. They will be executed in the same order as the update 3041 // cycle. This is useful when a modifier adds some persistent data that 3042 // other modifiers need to use, but the modifier is run after the dependent 3043 // one. 3044 3045 function runModifierEffects() { 3046 state.orderedModifiers.forEach(function (_ref3) { 3047 var name = _ref3.name, 3048 _ref3$options = _ref3.options, 3049 options = _ref3$options === void 0 ? {}
3049 : _ref3$options, 3050 effect = _ref3.effect; 3051 3052 if (typeof effect === 'function') { 3053 var cleanupFn = effect({ 3054 state: state, 3055 name: name, 3056 instance: instance, 3057 options: options 3058 }); 3059 3060 var noopFn = function noopFn() {}; 3061 3062 effectCleanupFns.push(cleanupFn || noopFn); 3063 } 3064 }); 3065 } 3066 3067 function cleanupModifierEffects() { 3068 effectCleanupFns.forEach(function (fn) { 3069 return fn(); 3070 }); 3071 effectCleanupFns = []; 3072 } 3073 3074 return instance; 3075 }; 3076 } 3077 var createPopper$2 = /*#__PURE__*/popperGenerator(); // eslint-disable-next-line import/no-unused-modules 3078 3079 var defaultModifiers$1 = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1]; 3080 var createPopper$1 = /*#__PURE__*/popperGenerator({ 3081 defaultModifiers: defaultModifiers$1 3082 }); // eslint-disable-next-line import/no-unused-modules 3083 3084 var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$2]; 3085 var createPopper = /*#__PURE__*/popperGenerator({ 3086 defaultModifiers: defaultModifiers 3087 }); // eslint-disable-next-line import/no-unused-modules 3088 3089 var Popper = /*#__PURE__*/Object.freeze({ 3090 __proto__: null, 3091 popperGenerator: popperGenerator, 3092 detectOverflow: detectOverflow, 3093 createPopperBase: createPopper$2, 3094 createPopper: createPopper, 3095 createPopperLite: createPopper$1, 3096 top: top, 3097 bottom: bottom, 3098 right: right, 3099 left: left, 3100 auto: auto, 3101 basePlacements: basePlacements, 3102 start: start, 3103 end: end, 3104 clippingParents: clippingParents, 3105 viewport: viewport, 3106 popper: popper, 3107 reference: reference, 3108 variationPlacements: variationPlacements, 3109 placements: placements, 3110 beforeRead: beforeRead, 3111 read: read, 3112 afterRead: afterRead, 3113 beforeMain: beforeMain, 3114 main: main, 3115 afterMain: afterMain, 3116 beforeWrite: beforeWrite, 3117 write: write, 3118 afterWrite: afterWrite, 3119 modifierPhases: modifierPhases, 3120 applyStyles: applyStyles$1, 3121 arrow: arrow$1, 3122 computeStyles: computeStyles$1, 3123 eventListeners: eventListeners, 3124 flip: flip$1, 3125 hide: hide$2, 3126 offset: offset$1, 3127 popperOffsets: popperOffsets$1, 3128 preventOverflow: preventOverflow$1 3129 }); 3130 3131 /** 3132 * -------------------------------------------------------------------------- 3133 * Bootstrap (v5.0.1): dropdown.js 3134 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 3135 * -------------------------------------------------------------------------- 3136 */ 3137 /** 3138 * ------------------------------------------------------------------------ 3139 * Constants 3140 * ------------------------------------------------------------------------ 3141 */ 3142 3143 const NAME$8 = 'dropdown'; 3144 const DATA_KEY$7 = 'bs.dropdown'; 3145 const EVENT_KEY$7 = `.${DATA_KEY$7}`; 3146 const DATA_API_KEY$4 = '.data-api'; 3147 const ESCAPE_KEY$2 = 'Escape'; 3148 const SPACE_KEY = 'Space'; 3149 const TAB_KEY = 'Tab'; 3150 const ARROW_UP_KEY = 'ArrowUp'; 3151 const ARROW_DOWN_KEY = 'ArrowDown'; 3152 const RIGHT_MOUSE_BUTTON = 2; // MouseEvent.button value for the secondary button, usually the right button 3153 3154 const REGEXP_KEYDOWN = new RegExp(`${ARROW_UP_KEY}|${ARROW_DOWN_KEY}|${ESCAPE_KEY$2}`); 3155 const EVENT_HIDE$4 = `hide${EVENT_KEY$7}`; 3156 const EVENT_HIDDEN$4 = `hidden${EVENT_KEY$7}`; 3157 const EVENT_SHOW$4 = `show${EVENT_KEY$7}`; 3158 const EVENT_SHOWN$4 = `shown${EVENT_KEY$7}`; 3159 const EVENT_CLICK = `click${EVENT_KEY$7}`; 3160 const EVENT_CLICK_DATA_API$3 = `click${EVENT_KEY$7}${DATA_API_KEY$4}`; 3161 const EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY$7}${DATA_API_KEY$4}`; 3162 const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY$7}${DATA_API_KEY$4}`; 3163 const CLASS_NAME_SHOW$7 = 'show'; 3164 const CLASS_NAME_DROPUP = 'dropup'; 3165 const CLASS_NAME_DROPEND = 'dropend'; 3166 const CLASS_NAME_DROPSTART = 'dropstart'; 3167 const CLASS_NAME_NAVBAR = 'navbar'; 3168 const SELECTOR_DATA_TOGGLE$3 = '[data-bs-toggle="dropdown"]'; 3169 const SELECTOR_MENU = '.dropdown-menu'; 3170 const SELECTOR_NAVBAR_NAV = '.navbar-nav'; 3171 const SELECTOR_VISIBLE_ITEMS = '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'; 3172 const PLACEMENT_TOP = isRTL() ? 'top-end' : 'top-start'; 3173 const PLACEMENT_TOPEND = isRTL() ? 'top-start' : 'top-end'; 3174 const PLACEMENT_BOTTOM = isRTL() ? 'bottom-end' : 'bottom-start'; 3175 const PLACEMENT_BOTTOMEND = isRTL() ? 'bottom-start' : 'bottom-end'; 3176 const PLACEMENT_RIGHT = isRTL() ? 'left-start' : 'right-start'; 3177 const PLACEMENT_LEFT = isRTL() ? 'right-start' : 'left-start'; 3178 const Default$7 = { 3179 offset: [0, 2], 3180 boundary: 'clippingParents', 3181 reference: 'toggle', 3182 display: 'dynamic', 3183 popperConfig: null, 3184 autoClose: true 3185 }; 3186 const DefaultType$7 = { 3187 offset: '(array|string|function)', 3188 boundary: '(string|element)', 3189 reference: '(string|element|object)', 3190 display: 'string', 3191 popperConfig: '(null|object|function)', 3192 autoClose: '(boolean|string)' 3193 }; 3194 /** 3195 * ------------------------------------------------------------------------ 3196 * Class Definition 3197 * ------------------------------------------------------------------------ 3198 */ 3199 3200 class Dropdown extends BaseComponent { 3201 constructor(element, config) { 3202 super(element); 3203 this._popper = null; 3204 this._config = this._getConfig(config); 3205 this._menu = this._getMenuElement(); 3206 this._inNavbar = this._detectNavbar(); 3207 3208 this._addEventListeners(); 3209 } // Getters 3210 3211 3212 static get Default() { 3213 return Default$7; 3214 } 3215 3216 static get DefaultType() { 3217 return DefaultType$7; 3218 } 3219 3220 static get NAME() { 3221 return NAME$8; 3222 } // Public 3223 3224 3225 toggle() { 3226 if (isDisabled(this._element)) { 3227 return; 3228 } 3229 3230 const isActive = this._element.classList.contains(CLASS_NAME_SHOW$7); 3231 3232 if (isActive) { 3233 this.hide(); 3234 return; 3235 } 3236 3237 this.show(); 3238 } 3239 3240 show() { 3241 if (isDisabled(this._element) || this._menu.classList.contains(CLASS_NAME_SHOW$7)) { 3242 return; 3243 } 3244 3245 const parent = Dropdown.getParentFromElement(this._element); 3246 const relatedTarget = { 3247 relatedTarget: this._element 3248 }; 3249 const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$4, relatedTarget); 3250 3251 if (showEvent.defaultPrevented) { 3252 return; 3253 } // Totally disable Popper for Dropdowns in Navbar 3254 3255 3256 if (this._inNavbar) { 3257 Manipulator.setDataAttribute(this._menu, 'popper', 'none'); 3258 } else { 3259 if (typeof Popper === 'undefined') { 3260 throw new TypeError('Bootstrap\'s dropdowns require Popper (https://popper.js.org)'); 3261 } 3262 3263 let referenceElement = this._element; 3264 3265 if (this._config.reference === 'parent') { 3266 referenceElement = parent; 3267 } else if (isElement$1(this._config.reference)) { 3268 referenceElement = getElement(this._config.reference); 3269 } else if (typeof this._config.reference === 'object') { 3270 referenceElement = this._config.reference; 3271 } 3272 3273 const popperConfig = this._getPopperConfig(); 3274 3275 const isDisplayStatic = popperConfig.modifiers.find(modifier =>
3275 modifier.name === 'applyStyles' && modifier.enabled === false); 3276 this._popper = createPopper(referenceElement, this._menu, popperConfig); 3277 3278 if (isDisplayStatic) { 3279 Manipulator.setDataAttribute(this._menu, 'popper', 'static'); 3280 } 3281 } // If this is a touch-enabled device we add extra 3282 // empty mouseover listeners to the body's immediate children; 3283 // only needed because of broken event delegation on iOS 3284 // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html 3285 3286 3287 if ('ontouchstart' in document.documentElement && !parent.closest(SELECTOR_NAVBAR_NAV)) { 3288 [].concat(...document.body.children).forEach(elem => EventHandler.on(elem, 'mouseover', noop)); 3289 } 3290 3291 this._element.focus(); 3292 3293 this._element.setAttribute('aria-expanded', true); 3294 3295 this._menu.classList.toggle(CLASS_NAME_SHOW$7); 3296 3297 this._element.classList.toggle(CLASS_NAME_SHOW$7); 3298 3299 EventHandler.trigger(this._element, EVENT_SHOWN$4, relatedTarget); 3300 } 3301 3302 hide() { 3303 if (isDisabled(this._element) || !this._menu.classList.contains(CLASS_NAME_SHOW$7)) { 3304 return; 3305 } 3306 3307 const relatedTarget = { 3308 relatedTarget: this._element 3309 }; 3310 3311 this._completeHide(relatedTarget); 3312 } 3313 3314 dispose() { 3315 if (this._popper) { 3316 this._popper.destroy(); 3317 } 3318 3319 super.dispose(); 3320 } 3321 3322 update() { 3323 this._inNavbar = this._detectNavbar(); 3324 3325 if (this._popper) { 3326 this._popper.update(); 3327 } 3328 } // Private 3329 3330 3331 _addEventListeners() { 3332 EventHandler.on(this._element, EVENT_CLICK, event => { 3333 event.preventDefault(); 3334 this.toggle(); 3335 }); 3336 } 3337 3338 _completeHide(relatedTarget) { 3339 const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$4, relatedTarget); 3340 3341 if (hideEvent.defaultPrevented) { 3342 return; 3343 } // If this is a touch-enabled device we remove the extra 3344 // empty mouseover listeners we added for iOS support 3345 3346 3347 if ('ontouchstart' in document.documentElement) { 3348 [].concat(...document.body.children).forEach(elem => EventHandler.off(elem, 'mouseover', noop)); 3349 } 3350 3351 if (this._popper) { 3352 this._popper.destroy(); 3353 } 3354 3355 this._menu.classList.remove(CLASS_NAME_SHOW$7); 3356 3357 this._element.classList.remove(CLASS_NAME_SHOW$7); 3358 3359 this._element.setAttribute('aria-expanded', 'false'); 3360 3361 Manipulator.removeDataAttribute(this._menu, 'popper'); 3362 EventHandler.trigger(this._element, EVENT_HIDDEN$4, relatedTarget); 3363 } 3364 3365 _getConfig(config) { 3366 config = { ...this.constructor.Default, 3367 ...Manipulator.getDataAttributes(this._element), 3368 ...config 3369 }; 3370 typeCheckConfig(NAME$8, config, this.constructor.DefaultType); 3371 3372 if (typeof config.reference === 'object' && !isElement$1(config.reference) && typeof config.reference.getBoundingClientRect !== 'function') { 3373 // Popper virtual elements require a getBoundingClientRect method 3374 throw new TypeError(`${NAME$8.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`); 3375 } 3376 3377 return config; 3378 } 3379 3380 _getMenuElement() { 3381 return SelectorEngine.next(this._element, SELECTOR_MENU)[0]; 3382 } 3383 3384 _getPlacement() { 3385 const parentDropdown = this._element.parentNode; 3386 3387 if (parentDropdown.classList.contains(CLASS_NAME_DROPEND)) { 3388 return PLACEMENT_RIGHT; 3389 } 3390 3391 if (parentDropdown.classList.contains(CLASS_NAME_DROPSTART)) { 3392 return PLACEMENT_LEFT; 3393 } // We need to trim the value because custom properties can also include spaces 3394 3395 3396 const isEnd = getComputedStyle(this._menu).getPropertyValue('--bs-position').trim() === 'end'; 3397 3398 if (parentDropdown.classList.contains(CLASS_NAME_DROPUP)) { 3399 return isEnd ? PLACEMENT_TOPEND : PLACEMENT_TOP; 3400 } 3401 3402 return isEnd ? PLACEMENT_BOTTOMEND : PLACEMENT_BOTTOM; 3403 } 3404 3405 _detectNavbar() { 3406 return this._element.closest(`.${CLASS_NAME_NAVBAR}`) !== null; 3407 } 3408 3409 _getOffset() { 3410 const { 3411 offset 3412 } = this._config; 3413 3414 if (typeof offset === 'string') { 3415 return offset.split(',').map(val => Number.parseInt(val, 10)); 3416 } 3417 3418 if (typeof offset === 'function') { 3419 return popperData => offset(popperData, this._element); 3420 } 3421 3422 return offset; 3423 } 3424 3425 _getPopperConfig() { 3426 const defaultBsPopperConfig = { 3427 placement: this._getPlacement(), 3428 modifiers: [{ 3429 name: 'preventOverflow', 3430 options: {
3431 boundary: this._config.boundary 3432 } 3433 }, { 3434 name: 'offset', 3435 options: { 3436 offset: this._getOffset() 3437 } 3438 }] 3439 }; // Disable Popper if we have a static display 3440 3441 if (this._config.display === 'static') { 3442 defaultBsPopperConfig.modifiers = [{ 3443 name: 'applyStyles', 3444 enabled: false 3445 }]; 3446 } 3447 3448 return { ...defaultBsPopperConfig, 3449 ...(typeof this._config.popperConfig === 'function' ? this._config.popperConfig(defaultBsPopperConfig) : this._config.popperConfig) 3450 }; 3451 } 3452 3453 _selectMenuItem(event) { 3454 const items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, this._menu).filter(isVisible); 3455 3456 if (!items.length) { 3457 return; 3458 } 3459 3460 let index = items.indexOf(event.target); // Up 3461 3462 if (event.key === ARROW_UP_KEY && index > 0) { 3463 index--; 3464 } // Down 3465 3466 3467 if (event.key === ARROW_DOWN_KEY && index < items.length - 1) { 3468 index++; 3469 } // index is -1 if the first keydown is an ArrowUp 3470 3471 3472 index = index === -1 ? 0 : index; 3473 items[index].focus(); 3474 } // Static 3475 3476 3477 static dropdownInterface(element, config) { 3478 let data = Data.get(element, DATA_KEY$7); 3479 3480 const _config = typeof config === 'object' ? config : null; 3481 3482 if (!data) { 3483 data = new Dropdown(element, _config); 3484 } 3485 3486 if (typeof config === 'string') { 3487 if (typeof data[config] === 'undefined') { 3488 throw new TypeError(`No method named "${config}"`); 3489 } 3490 3491 data[config](); 3492 } 3493 } 3494 3495 static jQueryInterface(config) { 3496 return this.each(function () { 3497 Dropdown.dropdownInterface(this, config); 3498 }); 3499 } 3500 3501 static clearMenus(event) { 3502 if (event && (event.button === RIGHT_MOUSE_BUTTON || event.type === 'keyup' && event.key !== TAB_KEY)) { 3503 return; 3504 } 3505 3506 const toggles = SelectorEngine.find(SELECTOR_DATA_TOGGLE$3); 3507 3508 for (let i = 0, len = toggles.length; i < len; i++) { 3509 const context = Data.get(toggles[i], DATA_KEY$7); 3510 3511 if (!context || context._config.autoClose === false) { 3512 continue; 3513 } 3514 3515 if (!context._element.classList.contains(CLASS_NAME_SHOW$7)) { 3516 continue; 3517 } 3518 3519 const relatedTarget = { 3520 relatedTarget: context._element 3521 }; 3522 3523 if (event) { 3524 const composedPath = event.composedPath(); 3525 const isMenuTarget = composedPath.includes(context._menu); 3526 3527 if (composedPath.includes(context._element) || context._config.autoClose === 'inside' && !isMenuTarget || context._config.autoClose === 'outside' && isMenuTarget) { 3528 continue; 3529 } // Tab navigation through the dropdown menu or events from contained inputs shouldn't close the menu 3530 3531 3532 if (context._menu.contains(event.target) && (event.type === 'keyup' && event.key === TAB_KEY || /input|select|option|textarea|form/i.test(event.target.tagName))) { 3533 continue; 3534 } 3535 3536 if (event.type === 'click') { 3537 relatedTarget.clickEvent = event; 3538 } 3539 } 3540 3541 context._completeHide(relatedTarget); 3542 } 3543 } 3544 3545 static getParentFromElement(element) { 3546 return getElementFromSelector(element) || element.parentNode; 3547 } 3548 3549 static dataApiKeydownHandler(event) { 3550 // If not input/textarea: 3551 // - And not a key in REGEXP_KEYDOWN => not a dropdown command 3552 // If input/textarea: 3553 // - If space key => not a dropdown command 3554 // - If key is other than escape 3555 // - If key is not up or down => not a dropdown command 3556 // - If trigger inside the menu => not a dropdown command 3557 if (/input|textarea/i.test(event.target.tagName) ? event.key === SPACE_KEY || event.key !== ESCAPE_KEY$2 && (event.key !== ARROW_DOWN_KEY && event.key !== ARROW_UP_KEY || event.target.closest(SELECTOR_MENU)) : !REGEXP_KEYDOWN.test(event.key)) { 3558 return; 3559 } 3560 3561 const isActive = this.classList.contains(CLASS_NAME_SHOW$7); 3562 3563 if (!isActive && event.key === ESCAPE_KEY$2) { 3564 return; 3565 } 3566 3567 event.preventDefault(); 3568 event.stopPropagation(); 3569 3570 if (isDisabled(this)) { 3571 return; 3572 } 3573 3574 const getToggleButton = () =>
3574 this.matches(SELECTOR_DATA_TOGGLE$3) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE$3)[0]; 3575 3576 if (event.key === ESCAPE_KEY$2) { 3577 getToggleButton().focus(); 3578 Dropdown.clearMenus(); 3579 return; 3580 } 3581 3582 if (!isActive && (event.key === ARROW_UP_KEY || event.key === ARROW_DOWN_KEY)) { 3583 getToggleButton().click(); 3584 return; 3585 } 3586 3587 if (!isActive || event.key === SPACE_KEY) { 3588 Dropdown.clearMenus(); 3589 return; 3590 } 3591 3592 Dropdown.getInstance(getToggleButton())._selectMenuItem(event); 3593 } 3594 3595 } 3596 /** 3597 * ------------------------------------------------------------------------ 3598 * Data Api implementation 3599 * ------------------------------------------------------------------------ 3600 */ 3601 3602 3603 EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_DATA_TOGGLE$3, Dropdown.dataApiKeydownHandler); 3604 EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_MENU, Dropdown.dataApiKeydownHandler); 3605 EventHandler.on(document, EVENT_CLICK_DATA_API$3, Dropdown.clearMenus); 3606 EventHandler.on(document, EVENT_KEYUP_DATA_API, Dropdown.clearMenus); 3607 EventHandler.on(document, EVENT_CLICK_DATA_API$3, SELECTOR_DATA_TOGGLE$3, function (event) { 3608 event.preventDefault(); 3609 Dropdown.dropdownInterface(this); 3610 }); 3611 /** 3612 * ------------------------------------------------------------------------ 3613 * jQuery 3614 * ------------------------------------------------------------------------ 3615 * add .Dropdown to jQuery only if jQuery is present 3616 */ 3617 3618 defineJQueryPlugin(Dropdown); 3619 3620 /** 3621 * -------------------------------------------------------------------------- 3622 * Bootstrap (v5.0.1): util/scrollBar.js 3623 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 3624 * -------------------------------------------------------------------------- 3625 */ 3626 const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top'; 3627 const SELECTOR_STICKY_CONTENT = '.sticky-top'; 3628 3629 const getWidth = () => { 3630 // https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes 3631 const documentWidth = document.documentElement.clientWidth; 3632 return Math.abs(window.innerWidth - documentWidth); 3633 }; 3634 3635 const hide = (width = getWidth()) => { 3636 _disableOverFlow(); // give padding to element to balances the hidden scrollbar width 3637 3638 3639 _setElementAttributes('body', 'paddingRight', calculatedValue => calculatedValue + width); // trick: We adjust positive paddingRight and negative marginRight to sticky-top elements, to keep shown fullwidth 3640 3641 3642 _setElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight', calculatedValue => calculatedValue + width); 3643 3644 _setElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight', calculatedValue => calculatedValue - width); 3645 }; 3646 3647 const _disableOverFlow = () => { 3648 const actualValue = document.body.style.overflow; 3649 3650 if (actualValue) { 3651 Manipulator.setDataAttribute(document.body, 'overflow', actualValue); 3652 } 3653 3654 document.body.style.overflow = 'hidden'; 3655 }; 3656 3657 const _setElementAttributes = (selector, styleProp, callback) => { 3658 const scrollbarWidth = getWidth(); 3659 SelectorEngine.find(selector).forEach(element => { 3660 if (element !== document.body && window.innerWidth > element.clientWidth + scrollbarWidth) { 3661 return; 3662 } 3663 3664 const actualValue = element.style[styleProp]; 3665 const calculatedValue = window.getComputedStyle(element)[styleProp]; 3666 Manipulator.setDataAttribute(element, styleProp, actualValue); 3667 element.style[styleProp] = `${callback(Number.parseFloat(calculatedValue))}px`; 3668 }); 3669 }; 3670 3671 const reset = () => { 3672 _resetElementAttributes('body', 'overflow'); 3673 3674 _resetElementAttributes('body', 'paddingRight'); 3675 3676 _resetElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight'); 3677 3678 _resetElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight'); 3679 }; 3680 3681 const _resetElementAttributes = (selector, styleProp) => { 3682 SelectorEngine.find(selector).forEach(element => { 3683 const value = Manipulator.getDataAttribute(element, styleProp); 3684 3685 if (typeof value === 'undefined') { 3686 element.style.removeProperty(styleProp); 3687 } else { 3688 Manipulator.removeDataAttribute(element, styleProp); 3689 element.style[styleProp] = value; 3690 } 3691 });
3692 }; 3693 3694 /** 3695 * -------------------------------------------------------------------------- 3696 * Bootstrap (v5.0.1): util/backdrop.js 3697 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 3698 * -------------------------------------------------------------------------- 3699 */ 3700 const Default$6 = { 3701 isVisible: true, 3702 // if false, we use the backdrop helper without adding any element to the dom 3703 isAnimated: false, 3704 rootElement: document.body, 3705 // give the choice to place backdrop under different elements 3706 clickCallback: null 3707 }; 3708 const DefaultType$6 = { 3709 isVisible: 'boolean', 3710 isAnimated: 'boolean', 3711 rootElement: 'element', 3712 clickCallback: '(function|null)' 3713 }; 3714 const NAME$7 = 'backdrop'; 3715 const CLASS_NAME_BACKDROP = 'modal-backdrop'; 3716 const CLASS_NAME_FADE$5 = 'fade'; 3717 const CLASS_NAME_SHOW$6 = 'show'; 3718 const EVENT_MOUSEDOWN = `mousedown.bs.${NAME$7}`; 3719 3720 class Backdrop { 3721 constructor(config) { 3722 this._config = this._getConfig(config); 3723 this._isAppended = false; 3724 this._element = null; 3725 } 3726 3727 show(callback) { 3728 if (!this._config.isVisible) { 3729 execute(callback); 3730 return; 3731 } 3732 3733 this._append(); 3734 3735 if (this._config.isAnimated) { 3736 reflow(this._getElement()); 3737 } 3738 3739 this._getElement().classList.add(CLASS_NAME_SHOW$6); 3740 3741 this._emulateAnimation(() => { 3742 execute(callback); 3743 }); 3744 } 3745 3746 hide(callback) { 3747 if (!this._config.isVisible) { 3748 execute(callback); 3749 return; 3750 } 3751 3752 this._getElement().classList.remove(CLASS_NAME_SHOW$6); 3753 3754 this._emulateAnimation(() => { 3755 this.dispose(); 3756 execute(callback); 3757 }); 3758 } // Private 3759 3760 3761 _getElement() { 3762 if (!this._element) { 3763 const backdrop = document.createElement('div'); 3764 backdrop.className = CLASS_NAME_BACKDROP; 3765 3766 if (this._config.isAnimated) { 3767 backdrop.classList.add(CLASS_NAME_FADE$5); 3768 } 3769 3770 this._element = backdrop; 3771 } 3772 3773 return this._element; 3774 } 3775 3776 _getConfig(config) { 3777 config = { ...Default$6, 3778 ...(typeof config === 'object' ? config : {}) 3779 }; 3780 config.rootElement = config.rootElement || document.body; 3781 typeCheckConfig(NAME$7, config, DefaultType$6); 3782 return config; 3783 } 3784 3785 _append() { 3786 if (this._isAppended) { 3787 return; 3788 } 3789 3790 this._config.rootElement.appendChild(this._getElement()); 3791 3792 EventHandler.on(this._getElement(), EVENT_MOUSEDOWN, () => { 3793 execute(this._config.clickCallback); 3794 }); 3795 this._isAppended = true; 3796 } 3797 3798 dispose() { 3799 if (!this._isAppended) { 3800 return; 3801 } 3802 3803 EventHandler.off(this._element, EVENT_MOUSEDOWN); 3804 3805 this._getElement().parentNode.removeChild(this._element); 3806 3807 this._isAppended = false; 3808 } 3809 3810 _emulateAnimation(callback) { 3811 if (!this._config.isAnimated) { 3812 execute(callback); 3813 return; 3814 } 3815 3816 const backdropTransitionDuration = getTransitionDurationFromElement(this._getElement()); 3817 EventHandler.one(this._getElement(), 'transitionend', () => execute(callback)); 3818 emulateTransitionEnd(this._getElement(), backdropTransitionDuration); 3819 } 3820 3821 } 3822 3823 /** 3824 * -------------------------------------------------------------------------- 3825 * Bootstrap (v5.0.1): modal.js 3826 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 3827 * -------------------------------------------------------------------------- 3828 */ 3829 /** 3830 * ------------------------------------------------------------------------ 3831 * Constants 3832 * ------------------------------------------------------------------------ 3833 */ 3834 3835 const NAME$6 = 'modal'; 3836 const DATA_KEY$6 = 'bs.modal'; 3837 const EVENT_KEY$6 = `.${DATA_KEY$6}`; 3838 const DATA_API_KEY$3 = '.data-api'; 3839 const ESCAPE_KEY$1 = 'Escape'; 3840 const Default$5 = { 3841 backdrop: true, 3842 keyboard: true, 3843 focus: true 3844 }; 3845 const DefaultType$5 = { 3846 backdrop: '(boolean|string)', 3847 keyboard: 'boolean', 3848 focus: 'boolean' 3849 }; 3850 const EVENT_HIDE$3 = `hide${EVENT_KEY$6}`; 3851 const EVENT_HIDE_PREVENTED = `hidePrevented${EVENT_KEY$6}`; 3852 const EVENT_HIDDEN$3 = `hidden${EVENT_KEY$6}`; 3853 const EVENT_SHOW$3 = `show${EVENT_KEY$6}`; 3854 const EVENT_SHOWN$3 = `shown${EVENT_KEY$6}`; 3855 const EVENT_FOCUSIN$2 = `focusin${EVENT_KEY$6}`; 3856 const EVENT_RESIZE = `resize${EVENT_KEY$6}`; 3857 const EVENT_CLICK_DISMISS$2 = `click.dismiss${EVENT_KEY$6}`; 3858 const EVENT_KEYDOWN_DISMISS$1 = `keydown.dismiss${EVENT_KEY$6}`; 3859 const EVENT_MOUSEUP_DISMISS = `mouseup.dismiss${EVENT_KEY$6}`; 3860 const EVENT_MOUSEDOWN_DISMISS = `mousedown.dismiss${EVENT_KEY$6}`; 3861 const EVENT_CLICK_DATA_API$2 = `click${EVENT_KEY$6}${DATA_API_KEY$3}`; 3862 const CLASS_NAME_OPEN = 'modal-open'; 3863 const CLASS_NAME_FADE$4 = 'fade'; 3864 const CLASS_NAME_SHOW$5 = 'show'; 3865 const CLASS_NAME_STATIC = 'modal-static'; 3866 const SELECTOR_DIALOG = '.modal-dialog'; 3867 const SELECTOR_MODAL_BODY = '.modal-body'; 3868 const SELECTOR_DATA_TOGGLE$2 = '[data-bs-toggle="modal"]'; 3869 const SELECTOR_DATA_DISMISS$2 = '[data-bs-dismiss="modal"]'; 3870 /** 3871 * ------------------------------------------------------------------------ 3872 * Class Definition 3873 * ------------------------------------------------------------------------ 3874 */ 3875 3876 class Modal extends BaseComponent { 3877 constructor(element, config) { 3878 super(element); 3879 this._config = this._getConfig(config); 3880 this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, this._element); 3881 this._backdrop = this._initializeBackDrop(); 3882 this._isShown = false; 3883 this._ignoreBackdropClick = false; 3884 this._isTransitioning = false; 3885 } // Getters 3886 3887 3888 static get Default() { 3889 return Default$5; 3890 } 3891 3892 static get NAME() { 3893 return NAME$6; 3894 } // Public 3895 3896 3897 toggle(relatedTarget) { 3898 return this._isShown ? this.hide() : this.show(relatedTarget); 3899 } 3900 3901 show(relatedTarget) { 3902 if (this._isShown || this._isTransitioning) { 3903 return; 3904 } 3905 3906 if (this._isAnimated()) { 3907 this._isTransitioning = true; 3908 } 3909 3910 const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$3, { 3911 relatedTarget 3912 }); 3913 3914 if (this._isShown || showEvent.defaultPrevented) { 3915 return; 3916 } 3917 3918 this._isShown = true; 3919 hide(); 3920 document.body.classList.add(CLASS_NAME_OPEN); 3921 3922 this._adjustDialog(); 3923 3924 this._setEscapeEvent(); 3925 3926 this._setResizeEvent(); 3927 3928 EventHandler.on(this._element, EVENT_CLICK_DISMISS$2, SELECTOR_DATA_DISMISS$2, event => this.hide(event)); 3929 EventHandler.on(this._dialog, EVENT_MOUSEDOWN_DISMISS, () => { 3930 EventHandler.one(this._element, EVENT_MOUSEUP_DISMISS, event => { 3931 if (event.target === this._element) { 3932 this._ignoreBackdropClick = true; 3933 } 3934 }); 3935 }); 3936 3937 this._showBackdrop(() => this._showElement(relatedTarget)); 3938 } 3939 3940 hide(event) { 3941 if (event) { 3942 event.preventDefault(); 3943 } 3944 3945 if (!this._isShown || this._isTransitioning) { 3946 return; 3947 } 3948 3949 const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$3); 3950 3951 if (hideEvent.defaultPrevented) { 3952 return; 3953 } 3954 3955 this._isShown = false; 3956 3957 const isAnimated = this._isAnimated(); 3958 3959 if (isAnimated) { 3960 this._isTransitioning = true; 3961 } 3962 3963 this._setEscapeEvent(); 3964 3965 this._setResizeEvent(); 3966 3967 EventHandler.off(document, EVENT_FOCUSIN$2); 3968 3969 this._element.classList.remove(CLASS_NAME_SHOW$5); 3970 3971 EventHandler.off(this._element, EVENT_CLICK_DISMISS$2); 3972 EventHandler.off(this._dialog, EVENT_MOUSEDOWN_DISMISS); 3973 3974 this._queueCallback(() => this._hideModal(), this._element, isAnimated); 3975 } 3976 3977 dispose() { 3978 [window, this._dialog].forEach(htmlElement => EventHandler.off(htmlElement, EVENT_KEY$6)); 3979 3980 this._backdrop.dispose(); 3981 3982 super.dispose(); 3983 /** 3984 * `document` has 2 events `EVENT_FOCUSIN` and `EVENT_CLICK_DATA_API` 3985 * Do not move `document` in `htmlElements` array 3986 * It will remove `EVENT_CLICK_DATA_API` event that should remain 3987 */ 3988 3989 EventHandler.off(document, EVENT_FOCUSIN$2); 3990 } 3991 3992 handleUpdate() { 3993 this._adjustDialog(); 3994 } // Private 3995 3996 3997 _initializeBackDrop() { 3998 return new Backdrop({ 3999 isVisible: Boolean(this._config.backdrop), 4000 // 'static' option will be translated to true, and booleans will keep their value 4001 isAnimated: this._isAnimated() 4002 }); 4003 } 4004 4005 _getConfig(config) { 4006 config = { ...Default$5, 4007 ...Manipulator.getDataAttributes(this._element), 4008 ...config 4009 }; 4010 typeCheckConfig(NAME$6, config, DefaultType$5); 4011 return config; 4012 } 4013 4014 _showElement(relatedTarget) { 4015 const isAnimated = this._isAnimated(); 4016 4017 const modalBody = SelectorEngine.findOne(SELECTOR_MODAL_BODY, this._dialog); 4018 4019 if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) { 4020 // Don't move modal's DOM position 4021 document.body.appendChild(this._element); 4022 } 4023 4024 this._element.style.display = 'block'; 4025 4026 this._element.removeAttribute('aria-hidden'); 4027 4028 this._element.setAttribute('aria-modal', true); 4029 4030 this._element.setAttribute('role', 'dialog'); 4031 4032 this._element.scrollTop = 0; 4033 4034 if (modalBody) { 4035 modalBody.scrollTop = 0; 4036 } 4037 4038 if (isAnimated) { 4039 reflow(this._element); 4040 } 4041 4042 this._element.classList.add(CLASS_NAME_SHOW$5); 4043 4044 if (this._config.focus) { 4045 this._enforceFocus(); 4046 } 4047 4048 const transitionComplete = () => { 4049 if (this._config.focus) { 4050 this._element.focus(); 4051 } 4052 4053 this._isTransitioning = false; 4054 EventHandler.trigger(this._element, EVENT_SHOWN$3, { 4055 relatedTarget 4056 }); 4057 }; 4058 4059 this._queueCallback(transitionComplete, this._dialog, isAnimated); 4060 } 4061 4062 _enforceFocus() { 4063 EventHandler.off(document, EVENT_FOCUSIN$2); // guard against infinite focus loop 4064 4065 EventHandler.on(document, EVENT_FOCUSIN$2, event => { 4066 if (document !== event.target && this._element !== event.target && !this._element.contains(event.target)) { 4067 this._element.focus(); 4068 } 4069 }); 4070 } 4071 4072 _setEscapeEvent() { 4073 if (this._isShown) { 4074 EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS$1, event => { 4075 if (this._config.keyboard && event.key === ESCAPE_KEY$1) { 4076 event.preventDefault(); 4077 this.hide(); 4078 } else if (!this._config.keyboard && event.key === ESCAPE_KEY$1) { 4079 this._triggerBackdropTransition(); 4080 } 4081 }); 4082 } else { 4083 EventHandler.off(this._element, EVENT_KEYDOWN_DISMISS$1); 4084 } 4085 } 4086 4087 _setResizeEvent() { 4088 if (this._isShown) { 4089 EventHandler.on(window, EVENT_RESIZE, () => this._adjustDialog()); 4090 } else { 4091 EventHandler.off(window, EVENT_RESIZE); 4092 } 4093 } 4094 4095 _hideModal() { 4096 this._element.style.display = 'none'; 4097 4098 this._element.setAttribute('aria-hidden', true); 4099 4100 this._element.removeAttribute('aria-modal'); 4101 4102 this._element.removeAttribute('role'); 4103 4104 this._isTransitioning = false; 4105 4106 this._backdrop.hide(() => { 4107 document.body.classList.remove(CLASS_NAME_OPEN); 4108 4109 this._resetAdjustments(); 4110 4111 reset(); 4112 EventHandler.trigger(this._element, EVENT_HIDDEN$3); 4113 }); 4114 } 4115 4116 _showBackdrop(callback) { 4117 EventHandler.on(this._element, EVENT_CLICK_DISMISS$2, event => { 4118 if (this._ignoreBackdropClick) { 4119 this._ignoreBackdropClick = false; 4120 return; 4121 } 4122 4123 if (event.target !== event.currentTarget) { 4124 return; 4125 } 4126 4127 if (this._config.backdrop === true) { 4128 this.hide(); 4129 } else if (this._config.backdrop === 'static') { 4130 this._triggerBackdropTransition(); 4131 } 4132 }); 4133 4134 this._backdrop.show(callback); 4135 } 4136 4137 _isAnimated() { 4138 return this._element.classList.contains(CLASS_NAME_FADE$4); 4139 } 4140 4141 _triggerBackdropTransition() { 4142 const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED); 4143 4144 if (hideEvent.defaultPrevented) { 4145 return; 4146 } 4147 4148 const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight; 4149 4150 if (!isModalOverflowing) { 4151 this._element.style.overflowY = 'hidden'; 4152 } 4153 4154 this._element.classList.add(CLASS_NAME_STATIC); 4155 4156 const modalTransitionDuration = getTransitionDurationFromElement(this._dialog); 4157 EventHandler.off(this._element, 'transitionend'); 4158 EventHandler.one(this._element, 'transitionend', () => { 4159 this._element.classList.remove(CLASS_NAME_STATIC); 4160 4161 if (!isModalOverflowing) { 4162 EventHandler.one(this._element, 'transitionend', () => { 4163 this._element.style.overflowY = ''; 4164 }); 4165 emulateTransitionEnd(this._element, modalTransitionDuration); 4166 } 4167 }); 4168 emulateTransitionEnd(this._element, modalTransitionDuration); 4169 4170 this._element.focus(); 4171 } // ---------------------------------------------------------------------- 4172 // the following methods are used to handle overflowing modals 4173 // ---------------------------------------------------------------------- 4174 4175 4176 _adjustDialog() { 4177 const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight; 4178 const scrollbarWidth = getWidth(); 4179 const isBodyOverflowing = scrollbarWidth > 0; 4180 4181 if (!isBodyOverflowing && isModalOverflowing && !isRTL() || isBodyOverflowing && !isModalOverflowing && isRTL()) { 4182 this._element.style.paddingLeft = `${scrollbarWidth}px`; 4183 } 4184 4185 if (isBodyOverflowing && !isModalOverflowing && !isRTL() || !isBodyOverflowing && isModalOverflowing && isRTL()) { 4186 this._element.style.paddingRight = `${scrollbarWidth}px`; 4187 } 4188 } 4189 4190 _resetAdjustments() { 4191 this._element.style.paddingLeft = ''; 4192 this._element.style.paddingRight = ''; 4193 } // Static 4194 4195 4196 static jQueryInterface(config, relatedTarget) { 4197 return this.each(function () { 4198 const data = Modal.getInstance(this) || new Modal(this, typeof config === 'object' ? config : {}); 4199 4200 if (typeof config !== 'string') { 4201 return; 4202 } 4203 4204 if (typeof data[config] === 'undefined') {
4205 throw new TypeError(`No method named "${config}"`); 4206 } 4207 4208 data[config](relatedTarget); 4209 }); 4210 } 4211 4212 } 4213 /** 4214 * ------------------------------------------------------------------------ 4215 * Data Api implementation 4216 * ------------------------------------------------------------------------ 4217 */ 4218 4219 4220 EventHandler.on(document, EVENT_CLICK_DATA_API$2, SELECTOR_DATA_TOGGLE$2, function (event) { 4221 const target = getElementFromSelector(this); 4222 4223 if (['A', 'AREA'].includes(this.tagName)) { 4224 event.preventDefault(); 4225 } 4226 4227 EventHandler.one(target, EVENT_SHOW$3, showEvent => { 4228 if (showEvent.defaultPrevented) { 4229 // only register focus restorer if modal will actually get shown 4230 return; 4231 } 4232 4233 EventHandler.one(target, EVENT_HIDDEN$3, () => { 4234 if (isVisible(this)) { 4235 this.focus(); 4236 } 4237 }); 4238 }); 4239 const data = Modal.getInstance(target) || new Modal(target); 4240 data.toggle(this); 4241 }); 4242 /** 4243 * ------------------------------------------------------------------------ 4244 * jQuery 4245 * ------------------------------------------------------------------------ 4246 * add .Modal to jQuery only if jQuery is present 4247 */ 4248 4249 defineJQueryPlugin(Modal); 4250 4251 /** 4252 * -------------------------------------------------------------------------- 4253 * Bootstrap (v5.0.1): offcanvas.js 4254 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 4255 * -------------------------------------------------------------------------- 4256 */ 4257 /** 4258 * ------------------------------------------------------------------------ 4259 * Constants 4260 * ------------------------------------------------------------------------ 4261 */ 4262 4263 const NAME$5 = 'offcanvas'; 4264 const DATA_KEY$5 = 'bs.offcanvas'; 4265 const EVENT_KEY$5 = `.${DATA_KEY$5}`; 4266 const DATA_API_KEY$2 = '.data-api'; 4267 const EVENT_LOAD_DATA_API$1 = `load${EVENT_KEY$5}${DATA_API_KEY$2}`; 4268 const ESCAPE_KEY = 'Escape'; 4269 const Default$4 = { 4270 backdrop: true, 4271 keyboard: true, 4272 scroll: false 4273 }; 4274 const DefaultType$4 = { 4275 backdrop: 'boolean', 4276 keyboard: 'boolean', 4277 scroll: 'boolean' 4278 }; 4279 const CLASS_NAME_SHOW$4 = 'show'; 4280 const OPEN_SELECTOR = '.offcanvas.show'; 4281 const EVENT_SHOW$2 = `show${EVENT_KEY$5}`; 4282 const EVENT_SHOWN$2 = `shown${EVENT_KEY$5}`; 4283 const EVENT_HIDE$2 = `hide${EVENT_KEY$5}`; 4284 const EVENT_HIDDEN$2 = `hidden${EVENT_KEY$5}`; 4285 const EVENT_FOCUSIN$1 = `focusin${EVENT_KEY$5}`; 4286 const EVENT_CLICK_DATA_API$1 = `click${EVENT_KEY$5}${DATA_API_KEY$2}`; 4287 const EVENT_CLICK_DISMISS$1 = `click.dismiss${EVENT_KEY$5}`; 4288 const EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY$5}`; 4289 const SELECTOR_DATA_DISMISS$1 = '[data-bs-dismiss="offcanvas"]'; 4290 const SELECTOR_DATA_TOGGLE$1 = '[data-bs-toggle="offcanvas"]'; 4291 /** 4292 * ------------------------------------------------------------------------ 4293 * Class Definition 4294 * ------------------------------------------------------------------------ 4295 */ 4296 4297 class Offcanvas extends BaseComponent { 4298 constructor(element, config) { 4299 super(element); 4300 this._config = this._getConfig(config); 4301 this._isShown = false; 4302 this._backdrop = this._initializeBackDrop(); 4303 4304 this._addEventListeners(); 4305 } // Getters 4306 4307 4308 static get NAME() { 4309 return NAME$5; 4310 } 4311 4312 static get Default() { 4313 return Default$4; 4314 } // Public 4315 4316 4317 toggle(relatedTarget) { 4318 return this._isShown ? this.hide() : this.show(relatedTarget); 4319 } 4320 4321 show(relatedTarget) { 4322 if (this._isShown) { 4323 return; 4324 } 4325 4326 const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$2, { 4327 relatedTarget 4328 }); 4329 4330 if (showEvent.defaultPrevented) { 4331 return; 4332 } 4333 4334 this._isShown = true; 4335 this._element.style.visibility = 'visible'; 4336 4337 this._backdrop.show(); 4338 4339 if (!this._config.scroll) { 4340 hide(); 4341 4342 this._enforceFocusOnElement(this._element); 4343 } 4344 4345 this._element.removeAttribute('aria-hidden'); 4346 4347 this._element.setAttribute('aria-modal', true); 4348 4349 this._element.setAttribute('role', 'dialog'); 4350 4351 this._element.classList.add(CLASS_NAME_SHOW$4); 4352 4353 const completeCallBack = () => { 4354 EventHandler.trigger(this._element, EVENT_SHOWN$2, { 4355 relatedTarget 4356 }); 4357 }; 4358 4359 this._queueCallback(completeCallBack, this._element, true); 4360 } 4361 4362 hide() { 4363 if (!this._isShown) { 4364 return; 4365 } 4366 4367 const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$2); 4368 4369 if (hideEvent.defaultPrevented) { 4370 return; 4371 } 4372 4373 EventHandler.off(document, EVENT_FOCUSIN$1); 4374 4375 this._element.blur(); 4376 4377 this._isShown = false; 4378 4379 this._element.classList.remove(CLASS_NAME_SHOW$4); 4380 4381 this._backdrop.hide(); 4382 4383 const completeCallback = () => { 4384 this._element.setAttribute('aria-hidden', true); 4385 4386 this._element.removeAttribute('aria-modal'); 4387 4388 this._element.removeAttribute('role'); 4389 4390 this._element.style.visibility = 'hidden'; 4391 4392 if (!this._config.scroll) { 4393 reset(); 4394 } 4395 4396 EventHandler.trigger(this._element, EVENT_HIDDEN$2); 4397 }; 4398 4399 this._queueCallback(completeCallback, this._element, true); 4400 } 4401 4402 dispose() { 4403 this._backdrop.dispose(); 4404 4405 super.dispose(); 4406 EventHandler.off(document, EVENT_FOCUSIN$1); 4407 } // Private 4408 4409 4410 _getConfig(config) { 4411 config = { ...Default$4, 4412 ...Manipulator.getDataAttributes(this._element), 4413 ...(typeof config === 'object' ? config : {}) 4414 }; 4415 typeCheckConfig(NAME$5, config, DefaultType$4); 4416 return config; 4417 } 4418 4419 _initializeBackDrop() { 4420 return new Backdrop({ 4421 isVisible: this._config.backdrop, 4422 isAnimated: true, 4423 rootElement: this._element.parentNode, 4424 clickCallback: () => this.hide() 4425 }); 4426 } 4427 4428 _enforceFocusOnElement(element) { 4429 EventHandler.off(document, EVENT_FOCUSIN$1); // guard against infinite focus loop 4430 4431 EventHandler.on(document, EVENT_FOCUSIN$1, event => { 4432 if (document !== event.target && element !== event.target && !element.contains(event.target)) { 4433 element.focus(); 4434 } 4435 }); 4436 element.focus(); 4437 } 4438 4439 _addEventListeners() { 4440 EventHandler.on(this._element, EVENT_CLICK_DISMISS$1, SELECTOR_DATA_DISMISS$1, () => this.hide()); 4441 EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, event => { 4442 if (this._config.keyboard && event.key === ESCAPE_KEY) { 4443 this.hide(); 4444 } 4445 }); 4446 } // Static 4447 4448 4449 static jQueryInterface(config) { 4450 return this.each(function () { 4451 const data = Data.get(this, DATA_KEY$5) || new Offcanvas(this, typeof config === 'object' ? config : {}); 4452 4453 if (typeof config !== 'string') { 4454 return; 4455 } 4456 4457 if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
4458 throw new TypeError(`No method named "${config}"`); 4459 } 4460 4461 data[config](this); 4462 }); 4463 } 4464 4465 } 4466 /** 4467 * ------------------------------------------------------------------------ 4468 * Data Api implementation 4469 * ------------------------------------------------------------------------ 4470 */ 4471 4472 4473 EventHandler.on(document, EVENT_CLICK_DATA_API$1, SELECTOR_DATA_TOGGLE$1, function (event) { 4474 const target = getElementFromSelector(this); 4475 4476 if (['A', 'AREA'].includes(this.tagName)) { 4477 event.preventDefault(); 4478 } 4479 4480 if (isDisabled(this)) { 4481 return; 4482 } 4483 4484 EventHandler.one(target, EVENT_HIDDEN$2, () => { 4485 // focus on trigger when it is closed 4486 if (isVisible(this)) { 4487 this.focus(); 4488 } 4489 }); // avoid conflict when clicking a toggler of an offcanvas, while another is open 4490 4491 const allReadyOpen = SelectorEngine.findOne(OPEN_SELECTOR); 4492 4493 if (allReadyOpen && allReadyOpen !== target) { 4494 Offcanvas.getInstance(allReadyOpen).hide(); 4495 } 4496 4497 const data = Data.get(target, DATA_KEY$5) || new Offcanvas(target); 4498 data.toggle(this); 4499 }); 4500 EventHandler.on(window, EVENT_LOAD_DATA_API$1, () => { 4501 SelectorEngine.find(OPEN_SELECTOR).forEach(el => (Data.get(el, DATA_KEY$5) || new Offcanvas(el)).show()); 4502 }); 4503 /** 4504 * ------------------------------------------------------------------------ 4505 * jQuery 4506 * ------------------------------------------------------------------------ 4507 */ 4508 4509 defineJQueryPlugin(Offcanvas); 4510 4511 /** 4512 * -------------------------------------------------------------------------- 4513 * Bootstrap (v5.0.1): util/sanitizer.js 4514 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 4515 * -------------------------------------------------------------------------- 4516 */ 4517 const uriAttrs = new Set(['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href']); 4518 const ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i; 4519 /** 4520 * A pattern that recognizes a commonly useful subset of URLs that are safe. 4521 * 4522 * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts 4523 */ 4524 4525 const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^#&/:?]*(?:[#/?]|$))/i; 4526 /** 4527 * A pattern that matches safe data URLs. Only matches image, video and audio types. 4528 * 4529 * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts 4530 */ 4531 4532 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; 4533 4534 const allowedAttribute = (attr, allowedAttributeList) => { 4535 const attrName = attr.nodeName.toLowerCase(); 4536 4537 if (allowedAttributeList.includes(attrName)) { 4538 if (uriAttrs.has(attrName)) { 4539 return Boolean(SAFE_URL_PATTERN.test(attr.nodeValue) || DATA_URL_PATTERN.test(attr.nodeValue)); 4540 } 4541 4542 return true; 4543 } 4544 4545 const regExp = allowedAttributeList.filter(attrRegex => attrRegex instanceof RegExp); // Check if a regular expression validates the attribute. 4546 4547 for (let i = 0, len = regExp.length; i < len; i++) { 4548 if (regExp[i].test(attrName)) { 4549 return true; 4550 } 4551 } 4552 4553 return false; 4554 }; 4555 4556 const DefaultAllowlist = { 4557 // Global attributes allowed on any supplied element below. 4558 '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN], 4559 a: ['target', 'href', 'title', 'rel'], 4560 area: [], 4561 b: [], 4562 br: [], 4563 col: [], 4564 code: [], 4565 div: [], 4566 em: [], 4567 hr: [], 4568 h1: [], 4569 h2: [], 4570 h3: [], 4571 h4: [], 4572 h5: [], 4573 h6: [], 4574 i: [], 4575 img: ['src', 'srcset', 'alt', 'title', 'width', 'height'], 4576 li: [], 4577 ol: [], 4578 p: [], 4579 pre: [], 4580 s: [], 4581 small: [], 4582 span: [], 4583 sub: [], 4584 sup: [], 4585 strong: [], 4586 u: [], 4587 ul: [] 4588 }; 4589 function sanitizeHtml(unsafeHtml, allowList, sanitizeFn) { 4590 if (!unsafeHtml.length) { 4591 return unsafeHtml; 4592 } 4593 4594 if (sanitizeFn && typeof sanitizeFn === 'function') { 4595 return sanitizeFn(unsafeHtml); 4596 } 4597 4598 const domParser = new window.DOMParser(); 4599 const createdDocument = domParser.parseFromString(unsafeHtml, 'text/html'); 4600 const allowlistKeys = Object.keys(allowList); 4601 const elements = [].concat(...createdDocument.body.querySelectorAll('*')); 4602 4603 for (let i = 0, len = elements.length; i < len; i++) { 4604 const el = elements[i]; 4605 const elName = el.nodeName.toLowerCase(); 4606 4607 if (!allowlistKeys.includes(elName)) { 4608 el.parentNode.removeChild(el); 4609 continue; 4610 } 4611 4612 const attributeList = [].concat(...el.attributes); 4613 const allowedAttributes = [].concat(allowList['*'] || [], allowList[elName] || []); 4614 attributeList.forEach(attr => { 4615 if (!allowedAttribute(attr, allowedAttributes)) { 4616 el.removeAttribute(attr.nodeName); 4617 } 4618 }); 4619 } 4620 4621 return createdDocument.body.innerHTML; 4622 } 4623 4624 /** 4625 * -------------------------------------------------------------------------- 4626 * Bootstrap (v5.0.1): tooltip.js 4627 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 4628 * -------------------------------------------------------------------------- 4629 */ 4630 /** 4631 * ------------------------------------------------------------------------ 4632 * Constants 4633 * ------------------------------------------------------------------------ 4634 */ 4635 4636 const NAME$4 = 'tooltip'; 4637 const DATA_KEY$4 = 'bs.tooltip'; 4638 const EVENT_KEY$4 = `.${DATA_KEY$4}`; 4639 const CLASS_PREFIX$1 = 'bs-tooltip'; 4640 const BSCLS_PREFIX_REGEX$1 = new RegExp(`(^|\\s)${CLASS_PREFIX$1}\\S+`, 'g'); 4641 const DISALLOWED_ATTRIBUTES = new Set(['sanitize', 'allowList', 'sanitizeFn']); 4642 const DefaultType$3 = { 4643 animation: 'boolean', 4644 template: 'string', 4645 title: '(string|element|function)', 4646 trigger: 'string', 4647 delay: '(number|object)', 4648 html: 'boolean', 4649 selector: '(string|boolean)', 4650 placement: '(string|function)', 4651 offset: '(array|string|function)', 4652 container: '(string|element|boolean)', 4653 fallbackPlacements: 'array', 4654 boundary: '(string|element)', 4655 customClass: '(string|function)', 4656 sanitize: 'boolean', 4657 sanitizeFn: '(null|function)', 4658 allowList: 'object', 4659 popperConfig: '(null|object|function)' 4660 }; 4661 const AttachmentMap = { 4662 AUTO: 'auto', 4663 TOP: 'top', 4664 RIGHT: isRTL() ? 'left' : 'right', 4665 BOTTOM: 'bottom', 4666 LEFT: isRTL() ? 'right' : 'left' 4667 }; 4668 const Default$3 = { 4669 animation: true, 4670 template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-arrow"></div>' + '<div class="tooltip-inner"></div>' + '</div>', 4671 trigger: 'hover focus', 4672 title: '', 4673 delay: 0, 4674 html: false, 4675 selector: false, 4676 placement: 'top', 4677 offset: [0, 6], 4678 container: false, 4679 fallbackPlacements: ['top', 'right', 'bottom', 'left'], 4680 boundary: 'clippingParents', 4681 customClass: '', 4682 sanitize: true, 4683 sanitizeFn: null, 4684 allowList: DefaultAllowlist, 4685 popperConfig: null 4686 }; 4687 const Event$2 = { 4688 HIDE: `hide${EVENT_KEY$4}`, 4689 HIDDEN: `hidden${EVENT_KEY$4}`, 4690 SHOW: `show${EVENT_KEY$4}`, 4691 SHOWN: `shown${EVENT_KEY$4}`, 4692 INSERTED: `inserted${EVENT_KEY$4}`, 4693 CLICK: `click${EVENT_KEY$4}`, 4694 FOCUSIN: `focusin${EVENT_KEY$4}`, 4695 FOCUSOUT: `focusout${EVENT_KEY$4}`, 4696 MOUSEENTER: `mouseenter${EVENT_KEY$4}`, 4697 MOUSELEAVE: `mouseleave${EVENT_KEY$4}` 4698 }; 4699 const CLASS_NAME_FADE$3 = 'fade'; 4700 const CLASS_NAME_MODAL = 'modal'; 4701 const CLASS_NAME_SHOW$3 = 'show'; 4702 const HOVER_STATE_SHOW = 'show'; 4703 const HOVER_STATE_OUT = 'out'; 4704 const SELECTOR_TOOLTIP_INNER = '.tooltip-inner'; 4705 const TRIGGER_HOVER = 'hover'; 4706 const TRIGGER_FOCUS = 'focus'; 4707 const TRIGGER_CLICK = 'click'; 4708 const TRIGGER_MANUAL = 'manual'; 4709 /** 4710 * ------------------------------------------------------------------------ 4711 * Class Definition 4712 * ------------------------------------------------------------------------ 4713 */ 4714 4715 class Tooltip extends BaseComponent { 4716 constructor(element, config) { 4717 if (typeof Popper === 'undefined') { 4718 throw new TypeError('Bootstrap\'s tooltips require Popper (https://popper.js.org)'); 4719 } 4720 4721 super(element); // private 4722 4723 this._isEnabled = true; 4724 this._timeout = 0; 4725 this._hoverState = ''; 4726 this._activeTrigger = {}; 4727 this._popper = null; // Protected 4728 4729 this._config = this._getConfig(config); 4730 this.tip = null; 4731 4732 this._setListeners(); 4733 } // Getters 4734 4735 4736 static get Default() { 4737 return Default$3; 4738 } 4739 4740 static get NAME() { 4741 return NAME$4; 4742 } 4743 4744 static get Event() { 4745 return Event$2; 4746 } 4747 4748 static get DefaultType() { 4749 return DefaultType$3; 4750 } // Public 4751 4752 4753 enable() { 4754 this._isEnabled = true; 4755 } 4756 4757 disable() { 4758 this._isEnabled = false; 4759 } 4760 4761 toggleEnabled() { 4762 this._isEnabled = !this._isEnabled; 4763 } 4764 4765 toggle(event) { 4766 if (!this._isEnabled) { 4767 return; 4768 } 4769 4770 if (event) { 4771 const context = this._initializeOnDelegatedTarget(event); 4772 4773 context._activeTrigger.click = !context._activeTrigger.click; 4774 4775 if (context._isWithActiveTrigger()) { 4776 context._enter(null, context); 4777 } else { 4778 context._leave(null, context); 4779 } 4780 } else { 4781 if (this.getTipElement().classList.contains(CLASS_NAME_SHOW$3)) { 4782 this._leave(null, this); 4783 4784 return; 4785 } 4786 4787 this._enter(null, this); 4788 } 4789 } 4790 4791 dispose() { 4792 clearTimeout(this._timeout); 4793 EventHandler.off(this._element.closest(`.${CLASS_NAME_MODAL}`), 'hide.bs.modal', this._hideModalHandler); 4794 4795 if (this.tip && this.tip.parentNode) { 4796 this.tip.parentNode.removeChild(this.tip); 4797 } 4798 4799 if (this._popper) { 4800 this._popper.destroy(); 4801 } 4802 4803 super.dispose(); 4804 } 4805 4806 show() { 4807 if (this._element.style.display === 'none') { 4808 throw new Error('Please use show on visible elements'); 4809 } 4810 4811 if (!(this.isWithContent() && this._isEnabled)) { 4812 return; 4813 } 4814 4815 const showEvent = EventHandler.trigger(this._element, this.constructor.Event.SHOW); 4816 const shadowRoot = findShadowRoot(this._element); 4817 const isInTheDom = shadowRoot === null ? this._element.ownerDocument.documentElement.contains(this._element) : shadowRoot.contains(this._element); 4818 4819 if (showEvent.defaultPrevented || !isInTheDom) { 4820 return; 4821 } 4822 4823 const tip = this.getTipElement(); 4824 const tipId = getUID(this.constructor.NAME);
4825 tip.setAttribute('id', tipId); 4826 4827 this._element.setAttribute('aria-describedby', tipId); 4828 4829 this.setContent(); 4830 4831 if (this._config.animation) { 4832 tip.classList.add(CLASS_NAME_FADE$3); 4833 } 4834 4835 const placement = typeof this._config.placement === 'function' ? this._config.placement.call(this, tip, this._element) : this._config.placement; 4836 4837 const attachment = this._getAttachment(placement); 4838 4839 this._addAttachmentClass(attachment); 4840 4841 const { 4842 container 4843 } = this._config; 4844 Data.set(tip, this.constructor.DATA_KEY, this); 4845 4846 if (!this._element.ownerDocument.documentElement.contains(this.tip)) { 4847 container.appendChild(tip); 4848 EventHandler.trigger(this._element, this.constructor.Event.INSERTED); 4849 } 4850 4851 if (this._popper) { 4852 this._popper.update(); 4853 } else { 4854 this._popper = createPopper(this._element, tip, this._getPopperConfig(attachment)); 4855 } 4856 4857 tip.classList.add(CLASS_NAME_SHOW$3); 4858 const customClass = typeof this._config.customClass === 'function' ? this._config.customClass() : this._config.customClass; 4859 4860 if (customClass) { 4861 tip.classList.add(...customClass.split(' ')); 4862 } // If this is a touch-enabled device we add extra 4863 // empty mouseover listeners to the body's immediate children; 4864 // only needed because of broken event delegation on iOS 4865 // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html 4866 4867 4868 if ('ontouchstart' in document.documentElement) { 4869 [].concat(...document.body.children).forEach(element => { 4870 EventHandler.on(element, 'mouseover', noop); 4871 }); 4872 } 4873 4874 const complete = () => { 4875 const prevHoverState = this._hoverState; 4876 this._hoverState = null; 4877 EventHandler.trigger(this._element, this.constructor.Event.SHOWN); 4878 4879 if (prevHoverState === HOVER_STATE_OUT) { 4880 this._leave(null, this); 4881 } 4882 }; 4883 4884 const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE$3); 4885 4886 this._queueCallback(complete, this.tip, isAnimated); 4887 } 4888 4889 hide() { 4890 if (!this._popper) { 4891 return; 4892 } 4893 4894 const tip = this.getTipElement(); 4895 4896 const complete = () => { 4897 if (this._isWithActiveTrigger()) { 4898 return; 4899 } 4900 4901 if (this._hoverState !== HOVER_STATE_SHOW && tip.parentNode) { 4902 tip.parentNode.removeChild(tip); 4903 } 4904 4905 this._cleanTipClass(); 4906 4907 this._element.removeAttribute('aria-describedby'); 4908 4909 EventHandler.trigger(this._element, this.constructor.Event.HIDDEN); 4910 4911 if (this._popper) { 4912 this._popper.destroy(); 4913 4914 this._popper = null; 4915 } 4916 }; 4917 4918 const hideEvent = EventHandler.trigger(this._element, this.constructor.Event.HIDE); 4919 4920 if (hideEvent.defaultPrevented) { 4921 return; 4922 } 4923 4924 tip.classList.remove(CLASS_NAME_SHOW$3); // If this is a touch-enabled device we remove the extra 4925 // empty mouseover listeners we added for iOS support 4926 4927 if ('ontouchstart' in document.documentElement) { 4928 [].concat(...document.body.children).forEach(element => EventHandler.off(element, 'mouseover', noop)); 4929 } 4930 4931 this._activeTrigger[TRIGGER_CLICK] = false; 4932 this._activeTrigger[TRIGGER_FOCUS] = false; 4933 this._activeTrigger[TRIGGER_HOVER] = false; 4934 const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE$3); 4935 4936 this._queueCallback(complete, this.tip, isAnimated); 4937 4938 this._hoverState = ''; 4939 } 4940 4941 update() { 4942 if (this._popper !== null) { 4943 this._popper.update(); 4944 } 4945 } // Protected 4946 4947 4948 isWithContent() { 4949 return Boolean(this.getTitle()); 4950 } 4951 4952 getTipElement() { 4953 if (this.tip) { 4954 return this.tip; 4955 } 4956 4957 const element = document.createElement('div'); 4958 element.innerHTML = this._config.template; 4959 this.tip = element.children[0]; 4960 return this.tip; 4961 } 4962 4963 setContent() { 4964 const tip = this.getTipElement(); 4965 this.setElementContent(SelectorEngine.findOne(SELECTOR_TOOLTIP_INNER, tip), this.getTitle()); 4966 tip.classList.remove(CLASS_NAME_FADE$3, CLASS_NAME_SHOW$3); 4967 } 4968 4969 setElementContent(element, content) { 4970 if (element === null) { 4971 return; 4972 } 4973 4974 if (isElement$1(content)) { 4975 content = getElement(content); // content is a DOM node or a jQuery 4976 4977 if (this._config.html) { 4978 if (content.parentNode !== element) { 4979 element.innerHTML = ''; 4980 element.appendChild(content); 4981 } 4982 } else { 4983 element.textContent = content.textContent; 4984 } 4985 4986 return; 4987 } 4988 4989 if (this._config.html) { 4990 if (this._config.sanitize) { 4991 content = sanitizeHtml(content, this._config.allowList, this._config.sanitizeFn); 4992 } 4993 4994 element.innerHTML = content; 4995 } else { 4996 element.textContent = content; 4997 } 4998 } 4999 5000 getTitle() { 5001 let title = this._element.getAttribute('data-bs-original-title'); 5002 5003 if (!title) { 5004 title = typeof this._config.title === 'function' ? this._config.title.call(this._element) : this._config.title; 5005 } 5006 5007 return title; 5008 } 5009 5010 updateAttachment(attachment) { 5011 if (attachment === 'right') { 5012 return 'end'; 5013 } 5014 5015 if (attachment === 'left') { 5016 return 'start'; 5017 } 5018 5019 return attachment; 5020 } // Private 5021 5022 5023 _initializeOnDelegatedTarget(event, context) { 5024 const dataKey = this.constructor.DATA_KEY; 5025 context = context || Data.get(event.delegateTarget, dataKey); 5026 5027 if (!context) { 5028 context = new this.constructor(event.delegateTarget, this._getDelegateConfig()); 5029 Data.set(event.delegateTarget, dataKey, context); 5030 } 5031 5032 return context; 5033 } 5034 5035 _getOffset() { 5036 const { 5037 offset 5038 } = this._config; 5039 5040 if (typeof offset === 'string') { 5041 return offset.split(',').map(val => Number.parseInt(val, 10)); 5042 } 5043 5044 if (typeof offset === 'function') { 5045 return popperData => offset(popperData, this._element); 5046 } 5047 5048 return offset; 5049 } 5050 5051 _getPopperConfig(attachment) { 5052 const defaultBsPopperConfig = { 5053 placement: attachment, 5054 modifiers: [{ 5055 name: 'flip', 5056 options: { 5057 fallbackPlacements: this._config.fallbackPlacements 5058 } 5059 }, { 5060 name: 'offset', 5061 options: { 5062 offset: this._getOffset() 5063 } 5064 }, { 5065 name: 'preventOverflow', 5066 options: {
5067 boundary: this._config.boundary 5068 } 5069 }, { 5070 name: 'arrow', 5071 options: { 5072 element: `.${this.constructor.NAME}-arrow` 5073 } 5074 }, { 5075 name: 'onChange', 5076 enabled: true, 5077 phase: 'beforeMain', 5078 fn: data => this._handlePopperPlacementChange(data) 5079 }], 5080 // onFirstUpdate: data => { 5081 // if (data.options.placement !== data.placement) { 5082 // this._handlePopperPlacementChange(data); 5083 // } 5084 // } 5085 }; 5086 return { ...defaultBsPopperConfig, 5087 ...(typeof this._config.popperConfig === 'function' ? this._config.popperConfig(defaultBsPopperConfig) : this._config.popperConfig) 5088 }; 5089 } 5090 5091 _addAttachmentClass(attachment) { 5092 // this.getTipElement().classList.add(`${CLASS_PREFIX$1}-${this.updateAttachment(attachment)}`); 5093 this.getTipElement().classList.add(`${CLASS_PREFIX$1}-auto`); 5094 } 5095 5096 _getAttachment(placement) { 5097 return AttachmentMap[placement.toUpperCase()]; 5098 } 5099 5100 _setListeners() { 5101 const triggers = this._config.trigger.split(' '); 5102 5103 triggers.forEach(trigger => { 5104 if (trigger === 'click') { 5105 EventHandler.on(this._element, this.constructor.Event.CLICK, this._config.selector, event => this.toggle(event)); 5106 } else if (trigger !== TRIGGER_MANUAL) { 5107 const eventIn = trigger === TRIGGER_HOVER ? this.constructor.Event.MOUSEENTER : this.constructor.Event.FOCUSIN; 5108 const eventOut = trigger === TRIGGER_HOVER ? this.constructor.Event.MOUSELEAVE : this.constructor.Event.FOCUSOUT; 5109 EventHandler.on(this._element, eventIn, this._config.selector, event => this._enter(event)); 5110 EventHandler.on(this._element, eventOut, this._config.selector, event => this._leave(event)); 5111 } 5112 }); 5113 5114 this._hideModalHandler = () => { 5115 if (this._element) { 5116 this.hide(); 5117 } 5118 }; 5119 5120 EventHandler.on(this._element.closest(`.${CLASS_NAME_MODAL}`), 'hide.bs.modal', this._hideModalHandler); 5121 5122 if (this._config.selector) { 5123 this._config = { ...this._config, 5124 trigger: 'manual', 5125 selector: '' 5126 }; 5127 } else { 5128 this._fixTitle(); 5129 } 5130 } 5131 5132 _fixTitle() { 5133 const title = this._element.getAttribute('title'); 5134 5135 const originalTitleType = typeof this._element.getAttribute('data-bs-original-title'); 5136 5137 if (title || originalTitleType !== 'string') { 5138 this._element.setAttribute('data-bs-original-title', title || ''); 5139 5140 if (title && !this._element.getAttribute('aria-label') && !this._element.textContent && 'DIV' != this._element.tagName) { 5141 this._element.setAttribute('aria-label', title); 5142 } 5143 5144 this._element.setAttribute('title', ''); 5145 } 5146 } 5147 5148 _enter(event, context) { 5149 context = this._initializeOnDelegatedTarget(event, context); 5150 5151 if (event) { 5152 context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true; 5153 } 5154 5155 if (context.getTipElement().classList.contains(CLASS_NAME_SHOW$3) || context._hoverState === HOVER_STATE_SHOW) { 5156 context._hoverState = HOVER_STATE_SHOW; 5157 return; 5158 } 5159 5160 clearTimeout(context._timeout); 5161 context._hoverState = HOVER_STATE_SHOW; 5162 5163 if (!context._config.delay || !context._config.delay.show) { 5164 context.show(); 5165 return; 5166 } 5167 5168 context._timeout = setTimeout(() => { 5169 if (context._hoverState === HOVER_STATE_SHOW) { 5170 context.show(); 5171 } 5172 }, context._config.delay.show); 5173 } 5174 5175 _leave(event, context) { 5176 context = this._initializeOnDelegatedTarget(event, context); 5177 5178 if (event) { 5179 context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = context._element.contains(event.relatedTarget); 5180 } 5181 5182 if (context._isWithActiveTrigger()) { 5183 return; 5184 } 5185 5186 clearTimeout(context._timeout); 5187 context._hoverState = HOVER_STATE_OUT; 5188 5189 if (!context._config.delay || !context._config.delay.hide) { 5190 context.hide(); 5191 return; 5192 } 5193 5194 context._timeout = setTimeout(() => { 5195 if (context._hoverState === HOVER_STATE_OUT) { 5196 context.hide(); 5197 } 5198 }, context._config.delay.hide); 5199 } 5200 5201 _isWithActiveTrigger() { 5202 for (const trigger in this._activeTrigger) { 5203 if (this._activeTrigger[trigger]) { 5204 return true; 5205 } 5206 } 5207 5208 return false; 5209 } 5210 5211 _getConfig(config) { 5212 const dataAttributes = Manipulator.getDataAttributes(this._element);
5213 Object.keys(dataAttributes).forEach(dataAttr => { 5214 if (DISALLOWED_ATTRIBUTES.has(dataAttr)) { 5215 delete dataAttributes[dataAttr]; 5216 } 5217 }); 5218 config = { ...this.constructor.Default, 5219 ...dataAttributes, 5220 ...(typeof config === 'object' && config ? config : {}) 5221 }; 5222 config.container = config.container === false ? document.body : getElement(config.container); 5223 5224 if (typeof config.delay === 'number') { 5225 config.delay = { 5226 show: config.delay, 5227 hide: config.delay 5228 }; 5229 } 5230 5231 if (typeof config.title === 'number') { 5232 config.title = config.title.toString(); 5233 } 5234 5235 if (typeof config.content === 'number') { 5236 config.content = config.content.toString(); 5237 } 5238 5239 typeCheckConfig(NAME$4, config, this.constructor.DefaultType); 5240 5241 if (config.sanitize) { 5242 config.template = sanitizeHtml(config.template, config.allowList, config.sanitizeFn); 5243 } 5244 5245 return config; 5246 } 5247 5248 _getDelegateConfig() { 5249 const config = {}; 5250 5251 if (this._config) { 5252 for (const key in this._config) { 5253 if (this.constructor.Default[key] !== this._config[key]) { 5254 config[key] = this._config[key]; 5255 } 5256 } 5257 } 5258 5259 return config; 5260 } 5261 5262 _cleanTipClass() { 5263 const tip = this.getTipElement(); 5264 const tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX$1); 5265 5266 if (tabClass !== null && tabClass.length > 0) { 5267 tabClass.map(token => token.trim()).forEach(tClass => tip.classList.remove(tClass)); 5268 } 5269 } 5270 5271 _handlePopperPlacementChange(popperData) { 5272 const { 5273 state 5274 } = popperData; 5275 5276 if (!state) { 5277 return; 5278 } 5279 5280 this.tip = state.elements.popper; 5281 5282 this._cleanTipClass(); 5283 5284 this._addAttachmentClass(this._getAttachment(state.placement)); 5285 this.tip.setAttribute('data-popper-placement', state.placement); 5286 } // Static 5287 5288 5289 static jQueryInterface(config) { 5290 return this.each(function () { 5291 let data = Data.get(this, DATA_KEY$4); 5292 5293 const _config = typeof config === 'object' && config; 5294 5295 if (!data && /dispose|hide/.test(config)) { 5296 return; 5297 } 5298 5299 if (!data) { 5300 data = new Tooltip(this, _config); 5301 } 5302 5303 if (typeof config === 'string') { 5304 if (typeof data[config] === 'undefined') { 5305 throw new TypeError(`No method named "${config}"`); 5306 } 5307 5308 data[config](); 5309 } 5310 }); 5311 } 5312 5313 } 5314 /** 5315 * ------------------------------------------------------------------------ 5316 * jQuery 5317 * ------------------------------------------------------------------------ 5318 * add .Tooltip to jQuery only if jQuery is present 5319 */ 5320 5321 5322 defineJQueryPlugin(Tooltip); 5323 5324 /** 5325 * -------------------------------------------------------------------------- 5326 * Bootstrap (v5.0.1): popover.js 5327 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 5328 * -------------------------------------------------------------------------- 5329 */ 5330 /** 5331 * ------------------------------------------------------------------------ 5332 * Constants 5333 * ------------------------------------------------------------------------ 5334 */ 5335 5336 const NAME$3 = 'popover'; 5337 const DATA_KEY$3 = 'bs.popover'; 5338 const EVENT_KEY$3 = `.${DATA_KEY$3}`; 5339 const CLASS_PREFIX = 'bs-popover'; 5340 const BSCLS_PREFIX_REGEX = new RegExp(`(^|\\s)${CLASS_PREFIX}\\S+`, 'g'); 5341 const Default$2 = { ...Tooltip.Default, 5342 placement: 'right', 5343 offset: [0, 8], 5344 trigger: 'click', 5345 content: '', 5346 template: '<div class="popover" role="tooltip">' + '<div class="popover-arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div>' + '</div>' 5347 }; 5348 const DefaultType$2 = { ...Tooltip.DefaultType, 5349 content: '(string|element|function)' 5350 }; 5351 const Event$1 = { 5352 HIDE: `hide${EVENT_KEY$3}`, 5353 HIDDEN: `hidden${EVENT_KEY$3}`, 5354 SHOW: `show${EVENT_KEY$3}`, 5355 SHOWN: `shown${EVENT_KEY$3}`, 5356 INSERTED: `inserted${EVENT_KEY$3}`, 5357 CLICK: `click${EVENT_KEY$3}`, 5358 FOCUSIN: `focusin${EVENT_KEY$3}`, 5359 FOCUSOUT: `focusout${EVENT_KEY$3}`, 5360 MOUSEENTER: `mouseenter${EVENT_KEY$3}`, 5361 MOUSELEAVE: `mouseleave${EVENT_KEY$3}` 5362 }; 5363 const CLASS_NAME_FADE$2 = 'fade'; 5364 const CLASS_NAME_SHOW$2 = 'show'; 5365 const SELECTOR_TITLE = '.popover-header'; 5366 const SELECTOR_CONTENT = '.popover-body'; 5367 /** 5368 * ------------------------------------------------------------------------ 5369 * Class Definition 5370 * ------------------------------------------------------------------------ 5371 */ 5372 5373 class Popover extends Tooltip { 5374 // Getters 5375 static get Default() { 5376 return Default$2; 5377 } 5378 5379 static get NAME() { 5380 return NAME$3; 5381 } 5382 5383 static get Event() { 5384 return Event$1; 5385 } 5386 5387 static get DefaultType() { 5388 return DefaultType$2; 5389 } // Overrides 5390 5391 5392 isWithContent() { 5393 return this.getTitle() || this._getContent(); 5394 } 5395 5396 setContent() { 5397 const tip = this.getTipElement(); // we use append for html objects to maintain js events 5398 5399 this.setElementContent(SelectorEngine.findOne(SELECTOR_TITLE, tip), this.getTitle()); 5400 5401 let content = this._getContent(); 5402 5403 if (typeof content === 'function') { 5404 content = content.call(this._element); 5405 } 5406 5407 this.setElementContent(SelectorEngine.findOne(SELECTOR_CONTENT, tip), content); 5408 tip.classList.remove(CLASS_NAME_FADE$2, CLASS_NAME_SHOW$2); 5409 } // Private 5410 5411 5412 _addAttachmentClass(attachment) { 5413 this.getTipElement().classList.add(`${CLASS_PREFIX}-${this.updateAttachment(attachment)}`); 5414 } 5415 5416 _getContent() { 5417 return this._element.getAttribute('data-bs-content') || this._config.content; 5418 } 5419 5420 _cleanTipClass() { 5421 const tip = this.getTipElement(); 5422 const tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX); 5423 5424 if (tabClass !== null && tabClass.length > 0) { 5425 tabClass.map(token =>
5425 token.trim()).forEach(tClass => tip.classList.remove(tClass)); 5426 } 5427 } // Static 5428 5429 5430 static jQueryInterface(config) { 5431 return this.each(function () { 5432 let data = Data.get(this, DATA_KEY$3); 5433 5434 const _config = typeof config === 'object' ? config : null; 5435 5436 if (!data && /dispose|hide/.test(config)) { 5437 return; 5438 } 5439 5440 if (!data) { 5441 data = new Popover(this, _config); 5442 Data.set(this, DATA_KEY$3, data); 5443 } 5444 5445 if (typeof config === 'string') { 5446 if (typeof data[config] === 'undefined') { 5447 throw new TypeError(`No method named "${config}"`); 5448 } 5449 5450 data[config](); 5451 } 5452 }); 5453 } 5454 5455 } 5456 /** 5457 * ------------------------------------------------------------------------ 5458 * jQuery 5459 * ------------------------------------------------------------------------ 5460 * add .Popover to jQuery only if jQuery is present 5461 */ 5462 5463 5464 defineJQueryPlugin(Popover); 5465 5466 /** 5467 * -------------------------------------------------------------------------- 5468 * Bootstrap (v5.0.1): scrollspy.js 5469 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 5470 * -------------------------------------------------------------------------- 5471 */ 5472 /** 5473 * ------------------------------------------------------------------------ 5474 * Constants 5475 * ------------------------------------------------------------------------ 5476 */ 5477 5478 const NAME$2 = 'scrollspy'; 5479 const DATA_KEY$2 = 'bs.scrollspy'; 5480 const EVENT_KEY$2 = `.${DATA_KEY$2}`; 5481 const DATA_API_KEY$1 = '.data-api'; 5482 const Default$1 = { 5483 offset: 10, 5484 method: 'auto', 5485 target: '' 5486 }; 5487 const DefaultType$1 = { 5488 offset: 'number', 5489 method: 'string', 5490 target: '(string|element)' 5491 }; 5492 const EVENT_ACTIVATE = `activate${EVENT_KEY$2}`; 5493 const EVENT_SCROLL = `scroll${EVENT_KEY$2}`; 5494 const EVENT_LOAD_DATA_API = `load${EVENT_KEY$2}${DATA_API_KEY$1}`; 5495 const CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item'; 5496 const CLASS_NAME_ACTIVE$1 = 'active'; 5497 const SELECTOR_DATA_SPY = '[data-bs-spy="scroll"]'; 5498 const SELECTOR_NAV_LIST_GROUP$1 = '.nav, .list-group'; 5499 const SELECTOR_NAV_LINKS = '.nav-link'; 5500 const SELECTOR_NAV_ITEMS = '.nav-item'; 5501 const SELECTOR_LIST_ITEMS = '.list-group-item'; 5502 const SELECTOR_DROPDOWN$1 = '.dropdown'; 5503 const SELECTOR_DROPDOWN_TOGGLE$1 = '.dropdown-toggle'; 5504 const METHOD_OFFSET = 'offset'; 5505 const METHOD_POSITION = 'position'; 5506 /** 5507 * ------------------------------------------------------------------------ 5508 * Class Definition 5509 * ------------------------------------------------------------------------ 5510 */ 5511 5512 class ScrollSpy extends BaseComponent { 5513 constructor(element, config) { 5514 super(element); 5515 this._scrollElement = this._element.tagName === 'BODY' ? window : this._element; 5516 this._config = this._getConfig(config); 5517 this._selector = `${this._config.target} ${SELECTOR_NAV_LINKS}, ${this._config.target} ${SELECTOR_LIST_ITEMS}, ${this._config.target} .${CLASS_NAME_DROPDOWN_ITEM}`; 5518 this._offsets = []; 5519 this._targets = []; 5520 this._activeTarget = null; 5521 this._scrollHeight = 0; 5522 EventHandler.on(this._scrollElement, EVENT_SCROLL, () => this._process()); 5523 this.refresh(); 5524 5525 this._process(); 5526 } // Getters 5527 5528 5529 static get Default() { 5530 return Default$1; 5531 } 5532 5533 static get NAME() { 5534 return NAME$2; 5535 } // Public 5536 5537 5538 refresh() { 5539 const autoMethod = this._scrollElement === this._scrollElement.window ? METHOD_OFFSET : METHOD_POSITION; 5540 const offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method; 5541 const offsetBase = offsetMethod === METHOD_POSITION ? this._getScrollTop() : 0; 5542 this._offsets = []; 5543 this._targets = []; 5544 this._scrollHeight = this._getScrollHeight(); 5545 const targets = SelectorEngine.find(this._selector); 5546 targets.map(element => { 5547 const targetSelector = getSelectorFromElement(element); 5548 const target = targetSelector ? SelectorEngine.findOne(targetSelector) : null; 5549 5550 if (target) { 5551 const targetBCR = target.getBoundingClientRect(); 5552 5553 if (targetBCR.width || targetBCR.height) { 5554 if ( this._scrollElement === this._scrollElement.window && 'offset' == offsetMethod ) { 5555 return [targetBCR.top + this._scrollElement.window.pageYOffset + offsetBase, targetSelector]; 5556 } 5557 return [Manipulator[offsetMethod](target).top + offsetBase, targetSelector]; 5558 } 5559 } 5560 5561 return null; 5562 }).filter(item => item).sort((a, b) =>
5562 a[0] - b[0]).forEach(item => { 5563 this._offsets.push(item[0]); 5564 5565 this._targets.push(item[1]); 5566 }); 5567 } 5568 5569 dispose() { 5570 EventHandler.off(this._scrollElement, EVENT_KEY$2); 5571 super.dispose(); 5572 } // Private 5573 5574 5575 _getConfig(config) { 5576 config = { ...Default$1, 5577 ...Manipulator.getDataAttributes(this._element), 5578 ...(typeof config === 'object' && config ? config : {}) 5579 }; 5580 5581 if (typeof config.target !== 'string' && isElement$1(config.target)) { 5582 let { 5583 id 5584 } = config.target; 5585 5586 if (!id) { 5587 id = getUID(NAME$2); 5588 config.target.id = id; 5589 } 5590 5591 config.target = `#${id}`; 5592 } 5593 5594 typeCheckConfig(NAME$2, config, DefaultType$1); 5595 return config; 5596 } 5597 5598 _getScrollTop() { 5599 return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop; 5600 } 5601 5602 _getScrollHeight() { 5603 return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight); 5604 } 5605 5606 _getOffsetHeight() { 5607 return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height; 5608 } 5609 5610 _process() { 5611 const scrollTop = this._getScrollTop() + this._config.offset; 5612 5613 const scrollHeight = this._getScrollHeight(); 5614 5615 const maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight(); 5616 5617 if (this._scrollHeight !== scrollHeight) { 5618 this.refresh(); 5619 } 5620 5621 if (scrollTop >= maxScroll) { 5622 const target = this._targets[this._targets.length - 1]; 5623 5624 if (this._activeTarget !== target) { 5625 this._activate(target); 5626 } 5627 5628 return; 5629 } 5630 5631 if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) { 5632 this._activeTarget = null; 5633 5634 this._clear(); 5635 5636 return; 5637 } 5638 5639 for (let i = this._offsets.length; i--;) { 5640 const isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]); 5641 5642 if (isActiveTarget) { 5643 this._activate(this._targets[i]); 5644 } 5645 } 5646 } 5647 5648 _activate(target) { 5649 this._activeTarget = target; 5650 5651 this._clear(); 5652 5653 const queries = this._selector.split(',').map(selector => `${selector}[data-bs-target="${target}"],${selector}[href="${target}"]`); 5654 5655 const link = SelectorEngine.findOne(queries.join(',')); 5656 5657 if (link.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) { 5658 SelectorEngine.findOne(SELECTOR_DROPDOWN_TOGGLE$1, link.closest(SELECTOR_DROPDOWN$1)).classList.add(CLASS_NAME_ACTIVE$1); 5659 link.classList.add(CLASS_NAME_ACTIVE$1); 5660 } else { 5661 // Set triggered link as active 5662 link.classList.add(CLASS_NAME_ACTIVE$1); 5663 SelectorEngine.parents(link, SELECTOR_NAV_LIST_GROUP$1).forEach(listGroup => { 5664 // Set triggered links parents as active
5665 // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor 5666 SelectorEngine.prev(listGroup, `${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}`).forEach(item => item.classList.add(CLASS_NAME_ACTIVE$1)); // Handle special case when .nav-link is inside .nav-item 5667 5668 SelectorEngine.prev(listGroup, SELECTOR_NAV_ITEMS).forEach(navItem => { 5669 SelectorEngine.children(navItem, SELECTOR_NAV_LINKS).forEach(item => item.classList.add(CLASS_NAME_ACTIVE$1)); 5670 }); 5671 }); 5672 } 5673 5674 EventHandler.trigger(this._scrollElement, EVENT_ACTIVATE, { 5675 relatedTarget: target 5676 }); 5677 } 5678 5679 _clear() { 5680 SelectorEngine.find(this._selector).filter(node => node.classList.contains(CLASS_NAME_ACTIVE$1)).forEach(node => node.classList.remove(CLASS_NAME_ACTIVE$1)); 5681 } // Static 5682 5683 5684 static jQueryInterface(config) { 5685 return this.each(function () { 5686 const data = ScrollSpy.getInstance(this) || new ScrollSpy(this, typeof config === 'object' ? config : {}); 5687 5688 if (typeof config !== 'string') { 5689 return; 5690 } 5691 5692 if (typeof data[config] === 'undefined') { 5693 throw new TypeError(`No method named "${config}"`); 5694 } 5695 5696 data[config](); 5697 }); 5698 } 5699 5700 } 5701 /** 5702 * ------------------------------------------------------------------------ 5703 * Data Api implementation 5704 * ------------------------------------------------------------------------ 5705 */ 5706 5707 5708 EventHandler.on(window, EVENT_LOAD_DATA_API, () => { 5709 SelectorEngine.find(SELECTOR_DATA_SPY).forEach(spy => new ScrollSpy(spy)); 5710 }); 5711 /** 5712 * ------------------------------------------------------------------------ 5713 * jQuery 5714 * ------------------------------------------------------------------------ 5715 * add .ScrollSpy to jQuery only if jQuery is present 5716 */ 5717 5718 defineJQueryPlugin(ScrollSpy); 5719 5720 /** 5721 * -------------------------------------------------------------------------- 5722 * Bootstrap (v5.0.1): tab.js 5723 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 5724 * -------------------------------------------------------------------------- 5725 */ 5726 /** 5727 * ------------------------------------------------------------------------ 5728 * Constants 5729 * ------------------------------------------------------------------------ 5730 */ 5731 5732 const NAME$1 = 'tab'; 5733 const DATA_KEY$1 = 'bs.tab'; 5734 const EVENT_KEY$1 = `.${DATA_KEY$1}`; 5735 const DATA_API_KEY = '.data-api'; 5736 const EVENT_HIDE$1 = `hide${EVENT_KEY$1}`; 5737 const EVENT_HIDDEN$1 = `hidden${EVENT_KEY$1}`; 5738 const EVENT_SHOW$1 = `show${EVENT_KEY$1}`; 5739 const EVENT_SHOWN$1 = `shown${EVENT_KEY$1}`; 5740 const EVENT_CLICK_DATA_API = `click${EVENT_KEY$1}${DATA_API_KEY}`; 5741 const CLASS_NAME_DROPDOWN_MENU = 'dropdown-menu'; 5742 const CLASS_NAME_ACTIVE = 'active'; 5743 const CLASS_NAME_FADE$1 = 'fade'; 5744 const CLASS_NAME_SHOW$1 = 'show'; 5745 const SELECTOR_DROPDOWN = '.dropdown'; 5746 const SELECTOR_NAV_LIST_GROUP = '.nav, .list-group'; 5747 const SELECTOR_ACTIVE = '.active'; 5748 const SELECTOR_ACTIVE_UL = ':scope > li > .active'; 5749 const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]'; 5750 const SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle'; 5751 const SELECTOR_DROPDOWN_ACTIVE_CHILD = ':scope > .dropdown-menu .active'; 5752 /** 5753 * ------------------------------------------------------------------------ 5754 * Class Definition 5755 * ------------------------------------------------------------------------ 5756 */ 5757 5758 class Tab extends BaseComponent { 5759 // Getters 5760 static get NAME() { 5761 return NAME$1; 5762 } // Public 5763 5764 5765 show() { 5766 if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && this._element.classList.contains(CLASS_NAME_ACTIVE)) { 5767 return; 5768 } 5769 5770 let previous; 5771 const target = getElementFromSelector(this._element); 5772 5773 const listElement = this._element.closest(SELECTOR_NAV_LIST_GROUP); 5774 5775 if (listElement) { 5776 const itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? SELECTOR_ACTIVE_UL : SELECTOR_ACTIVE; 5777 previous = SelectorEngine.find(itemSelector, listElement); 5778 previous = previous[previous.length - 1]; 5779 } 5780 5781 const hideEvent = previous ? EventHandler.trigger(previous, EVENT_HIDE$1, { 5782 relatedTarget: this._element 5783 }) : null; 5784 const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$1, { 5785 relatedTarget: previous 5786 }); 5787 5788 if (showEvent.defaultPrevented || hideEvent !== null && hideEvent.defaultPrevented) { 5789 return; 5790 } 5791 5792 this._activate(this._element, listElement); 5793 5794 const complete = () => { 5795 EventHandler.trigger(previous, EVENT_HIDDEN$1, { 5796 relatedTarget: this._element 5797 }); 5798 EventHandler.trigger(this._element, EVENT_SHOWN$1, { 5799 relatedTarget: previous 5800 }); 5801 }; 5802 5803 if (target) { 5804 this._activate(target, target.parentNode, complete); 5805 } else { 5806 complete(); 5807 } 5808 } // Private 5809 5810 5811 _activate(element, container, callback) { 5812 const activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? SelectorEngine.find(SELECTOR_ACTIVE_UL, container) : SelectorEngine.children(container, SELECTOR_ACTIVE); 5813 const active = activeElements[0]; 5814 const isTransitioning = callback && active && active.classList.contains(CLASS_NAME_FADE$1); 5815 5816 const complete = () => this._transitionComplete(element, active, callback); 5817 5818 if (active && isTransitioning) { 5819 active.classList.remove(CLASS_NAME_SHOW$1); 5820 5821 this._queueCallback(complete, element, true); 5822 } else { 5823 complete(); 5824 } 5825 } 5826 5827 _transitionComplete(element, active, callback) { 5828 if (active) { 5829 active.classList.remove(CLASS_NAME_ACTIVE);
5830 const dropdownChild = SelectorEngine.findOne(SELECTOR_DROPDOWN_ACTIVE_CHILD, active.parentNode); 5831 5832 if (dropdownChild) { 5833 dropdownChild.classList.remove(CLASS_NAME_ACTIVE); 5834 } 5835 5836 if (active.getAttribute('role') === 'tab') { 5837 active.setAttribute('aria-selected', false); 5838 } 5839 } 5840 5841 element.classList.add(CLASS_NAME_ACTIVE); 5842 5843 if (element.getAttribute('role') === 'tab') { 5844 element.setAttribute('aria-selected', true); 5845 } 5846 5847 reflow(element); 5848 5849 if (element.classList.contains(CLASS_NAME_FADE$1)) { 5850 element.classList.add(CLASS_NAME_SHOW$1); 5851 } 5852 5853 let parent = element.parentNode; 5854 5855 if (parent && parent.nodeName === 'LI') { 5856 parent = parent.parentNode; 5857 } 5858 5859 if (parent && parent.classList.contains(CLASS_NAME_DROPDOWN_MENU)) { 5860 const dropdownElement = element.closest(SELECTOR_DROPDOWN); 5861 5862 if (dropdownElement) { 5863 SelectorEngine.find(SELECTOR_DROPDOWN_TOGGLE, dropdownElement).forEach(dropdown => dropdown.classList.add(CLASS_NAME_ACTIVE)); 5864 } 5865 5866 element.setAttribute('aria-expanded', true); 5867 } 5868 5869 if (callback) { 5870 callback(); 5871 } 5872 } // Static 5873 5874 5875 static jQueryInterface(config) { 5876 return this.each(function () { 5877 const data = Data.get(this, DATA_KEY$1) || new Tab(this); 5878 5879 if (typeof config === 'string') { 5880 if (typeof data[config] === 'undefined') { 5881 throw new TypeError(`No method named "${config}"`); 5882 } 5883 5884 data[config](); 5885 } 5886 }); 5887 } 5888 5889 } 5890 /** 5891 * ------------------------------------------------------------------------ 5892 * Data Api implementation 5893 * ------------------------------------------------------------------------ 5894 */ 5895 5896 5897 EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) { 5898 if (['A', 'AREA'].includes(this.tagName)) { 5899 event.preventDefault(); 5900 } 5901 5902 if (isDisabled(this)) { 5903 return; 5904 } 5905 5906 const data = Data.get(this, DATA_KEY$1) || new Tab(this); 5907 data.show(); 5908 }); 5909 /** 5910 * ------------------------------------------------------------------------ 5911 * jQuery 5912 * ------------------------------------------------------------------------ 5913 * add .Tab to jQuery only if jQuery is present 5914 */ 5915 5916 defineJQueryPlugin(Tab); 5917 5918 /** 5919 * -------------------------------------------------------------------------- 5920 * Bootstrap (v5.0.1): toast.js 5921 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 5922 * -------------------------------------------------------------------------- 5923 */ 5924 /** 5925 * ------------------------------------------------------------------------ 5926 * Constants 5927 * ------------------------------------------------------------------------ 5928 */ 5929 5930 const NAME = 'toast'; 5931 const DATA_KEY = 'bs.toast'; 5932 const EVENT_KEY = `.${DATA_KEY}`; 5933 const EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY}`; 5934 const EVENT_MOUSEOVER = `mouseover${EVENT_KEY}`; 5935 const EVENT_MOUSEOUT = `mouseout${EVENT_KEY}`; 5936 const EVENT_FOCUSIN = `focusin${EVENT_KEY}`; 5937 const EVENT_FOCUSOUT = `focusout${EVENT_KEY}`; 5938 const EVENT_HIDE = `hide${EVENT_KEY}`; 5939 const EVENT_HIDDEN = `hidden${EVENT_KEY}`; 5940 const EVENT_SHOW = `show${EVENT_KEY}`; 5941 const EVENT_SHOWN = `shown${EVENT_KEY}`; 5942 const CLASS_NAME_FADE = 'fade'; 5943 const CLASS_NAME_HIDE = 'hide'; 5944 const CLASS_NAME_SHOW = 'show'; 5945 const CLASS_NAME_SHOWING = 'showing'; 5946 const DefaultType = { 5947 animation: 'boolean', 5948 autohide: 'boolean', 5949 delay: 'number' 5950 }; 5951 const Default = { 5952 animation: true, 5953 autohide: true, 5954 delay: 5000 5955 }; 5956 const SELECTOR_DATA_DISMISS = '[data-bs-dismiss="toast"]'; 5957 /** 5958 * ------------------------------------------------------------------------ 5959 * Class Definition 5960 * ------------------------------------------------------------------------ 5961 */ 5962 5963 class Toast extends BaseComponent { 5964 constructor(element, config) { 5965 super(element); 5966 this._config = this._getConfig(config); 5967 this._timeout = null; 5968 this._hasMouseInteraction = false; 5969 this._hasKeyboardInteraction = false; 5970 5971 this._setListeners(); 5972 } // Getters 5973 5974 5975 static get DefaultType() { 5976 return DefaultType; 5977 } 5978 5979 static get Default() { 5980 return Default; 5981 } 5982 5983 static get NAME() { 5984 return NAME; 5985 } // Public 5986 5987 5988 show() { 5989 const showEvent = EventHandler.trigger(this._element, EVENT_SHOW); 5990 5991 if (showEvent.defaultPrevented) { 5992 return; 5993 } 5994 5995 this._clearTimeout(); 5996 5997 if (this._config.animation) { 5998 this._element.classList.add(CLASS_NAME_FADE); 5999 } 6000 6001 const complete = () => { 6002 this._element.classList.remove(CLASS_NAME_SHOWING); 6003 6004 this._element.classList.add(CLASS_NAME_SHOW); 6005 6006 EventHandler.trigger(this._element, EVENT_SHOWN); 6007 6008 this._maybeScheduleHide(); 6009 }; 6010 6011 this._element.classList.remove(CLASS_NAME_HIDE); 6012 6013 reflow(this._element); 6014 6015 this._element.classList.add(CLASS_NAME_SHOWING); 6016 6017 this._queueCallback(complete, this._element, this._config.animation); 6018 } 6019 6020 hide() { 6021 if (!this._element.classList.contains(CLASS_NAME_SHOW)) { 6022 return; 6023 } 6024 6025 const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE); 6026 6027 if (hideEvent.defaultPrevented) { 6028 return; 6029 } 6030 6031 const complete = () => { 6032 this._element.classList.add(CLASS_NAME_HIDE); 6033 6034 EventHandler.trigger(this._element, EVENT_HIDDEN); 6035 }; 6036 6037 this._element.classList.remove(CLASS_NAME_SHOW); 6038 6039 this._queueCallback(complete, this._element, this._config.animation); 6040 } 6041 6042 dispose() { 6043 this._clearTimeout(); 6044 6045 if (this._element.classList.contains(CLASS_NAME_SHOW)) { 6046 this._element.classList.remove(CLASS_NAME_SHOW); 6047 } 6048 6049 super.dispose(); 6050 } // Private 6051 6052 6053 _getConfig(config) { 6054 config = { ...Default, 6055 ...Manipulator.getDataAttributes(this._element), 6056 ...(typeof config === 'object' && config ? config : {}) 6057 }; 6058 typeCheckConfig(NAME, config, this.constructor.DefaultType); 6059 return config; 6060 } 6061 6062 _maybeScheduleHide() { 6063 if (!this._config.autohide) { 6064 return; 6065 } 6066 6067 if (this._hasMouseInteraction || this._hasKeyboardInteraction) { 6068 return; 6069 } 6070 6071 this._timeout = setTimeout(() => { 6072 this.hide(); 6073 }, this._config.delay); 6074 } 6075 6076 _onInteraction(event, isInteracting) { 6077 switch (event.type) { 6078 case 'mouseover': 6079 case 'mouseout': 6080 this._hasMouseInteraction = isInteracting; 6081 break; 6082 6083 case 'focusin': 6084 case 'focusout': 6085 this._hasKeyboardInteraction = isInteracting; 6086 break; 6087 } 6088 6089 if (isInteracting) { 6090 this._clearTimeout(); 6091 6092 return; 6093 } 6094 6095 const nextElement = event.relatedTarget; 6096 6097 if (this._element === nextElement || this._element.contains(nextElement)) { 6098 return; 6099 } 6100 6101 this._maybeScheduleHide(); 6102 } 6103 6104 _setListeners() { 6105 EventHandler.on(this._element, EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, () => this.hide()); 6106 EventHandler.on(this._element, EVENT_MOUSEOVER, event => this._onInteraction(event, true)); 6107 EventHandler.on(this._element, EVENT_MOUSEOUT, event => this._onInteraction(event, false)); 6108 EventHandler.on(this._element, EVENT_FOCUSIN, event => this._onInteraction(event, true)); 6109 EventHandler.on(this._element, EVENT_FOCUSOUT, event => this._onInteraction(event, false)); 6110 } 6111 6112 _clearTimeout() { 6113 clearTimeout(this._timeout); 6114 this._timeout = null; 6115 } // Static 6116 6117 6118 static jQueryInterface(config) { 6119 return this.each(function () { 6120 let data = Data.get(this, DATA_KEY); 6121 6122 const _config = typeof config === 'object' && config; 6123 6124 if (!data) { 6125 data = new Toast(this, _config); 6126 } 6127 6128 if (typeof config === 'string') { 6129 if (typeof data[config] === 'undefined') {
6130 throw new TypeError(`No method named "${config}"`); 6131 } 6132 6133 data[config](this); 6134 } 6135 }); 6136 } 6137 6138 } 6139 /** 6140 * ------------------------------------------------------------------------ 6141 * jQuery 6142 * ------------------------------------------------------------------------ 6143 * add .Toast to jQuery only if jQuery is present 6144 */ 6145 6146 6147 defineJQueryPlugin(Toast); 6148 6149 /** 6150 * -------------------------------------------------------------------------- 6151 * Bootstrap (v5.0.1): index.umd.js 6152 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 6153 * -------------------------------------------------------------------------- 6154 */ 6155 var index_umd = { 6156 Alert, 6157 Button, 6158 //Carousel, 6159 Collapse, 6160 Dropdown, 6161 Modal, 6162 Offcanvas, 6163 Popover, 6164 ScrollSpy, 6165 Tab, 6166 Toast, 6167 Tooltip 6168 }; 6169 6170 return index_umd; 6171 6172})));
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.