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