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