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