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