vendor: 5,514 bytes, lines 1-149
1/*! 2 * Bootstrap v5.3.0-alpha3 (https://getbootstrap.com/) 3 * Copyright 2011-2023 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(require('@popperjs/core')) : 8 typeof define === 'function' && define.amd ? define(['@popperjs/core'], factory) : 9 (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.bootstrap = factory(global.Popper)); 10})(this, (function (Popper) { 'use strict'; 11 12 function _interopNamespaceDefault(e) { 13 const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } }); 14 if (e) { 15 for (const k in e) { 16 if (k !== 'default') { 17 const d = Object.getOwnPropertyDescriptor(e, k); 18 Object.defineProperty(n, k, d.get ? d : { 19 enumerable: true, 20 get: () => e[k] 21 }); 22 } 23 } 24 } 25 n.default = e; 26 return Object.freeze(n); 27 } 28 29 const Popper__namespace = /*#__PURE__*/_interopNamespaceDefault(Popper); 30 31 /** 32 * -------------------------------------------------------------------------- 33 * Bootstrap dom/data.js 34 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 35 * -------------------------------------------------------------------------- 36 */ 37 38 /** 39 * Constants 40 */ 41 42 const elementMap = new Map(); 43 const Data = { 44 set(element, key, instance) { 45 if (!elementMap.has(element)) { 46 elementMap.set(element, new Map()); 47 } 48 const instanceMap = elementMap.get(element); 49 50 // make it clear we only want one instance per element 51 // can be removed later when multiple key/instances are fine to be used 52 if (!instanceMap.has(key) && instanceMap.size !== 0) { 53 // eslint-disable-next-line no-console 54 console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(instanceMap.keys())[0]}.`); 55 return; 56 } 57 instanceMap.set(key, instance); 58 }, 59 get(element, key) { 60 if (elementMap.has(element)) { 61 return elementMap.get(element).get(key) || null; 62 } 63 return null; 64 }, 65 remove(element, key) { 66 if (!elementMap.has(element)) { 67 return; 68 } 69 const instanceMap = elementMap.get(element); 70 instanceMap.delete(key); 71 72 // free up element references if there are no instances left for an element 73 if (instanceMap.size === 0) { 74 elementMap.delete(element); 75 } 76 } 77 }; 78 79 /** 80 * -------------------------------------------------------------------------- 81 * Bootstrap util/index.js 82 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 83 * -------------------------------------------------------------------------- 84 */ 85 86 const MAX_UID = 1000000; 87 const MILLISECONDS_MULTIPLIER = 1000; 88 const TRANSITION_END = 'transitionend'; 89 90 /** 91 * Properly escape IDs selectors to handle weird IDs 92 * @param {string} selector 93 * @returns {string} 94 */ 95 const parseSelector = selector => { 96 if (selector && window.CSS && window.CSS.escape) { 97 // document.querySelector needs escaping to handle IDs (html5+) containing for instance / 98 selector = selector.replace(/#([^\s"#']+)/g, (match, id) => `#${CSS.escape(id)}`); 99 } 100 return selector; 101 }; 102 103 // Shout-out Angus Croll (https://goo.gl/pxwQGp) 104 const toType = object => { 105 if (object === null || object === undefined) { 106 return `${object}`; 107 } 108 return Object.prototype.toString.call(object).match(/\s([a-z]+)/i)[1].toLowerCase(); 109 }; 110 111 /** 112 * Public Util API 113 */ 114 115 const getUID = prefix => { 116 do { 117 prefix += Math.floor(Math.random() * MAX_UID); 118 } while (document.getElementById(prefix)); 119 return prefix; 120 }; 121 const getTransitionDurationFromElement = element => { 122 if (!element) { 123 return 0; 124 } 125 126 // Get transition-duration of the element 127 let { 128 transitionDuration, 129 transitionDelay 130 } = window.getComputedStyle(element); 131 const floatTransitionDuration = Number.parseFloat(transitionDuration); 132 const floatTransitionDelay = Number.parseFloat(transitionDelay); 133 134 // Return 0 if element or transition duration is not found 135 if (!floatTransitionDuration && !floatTransitionDelay) { 136 return 0; 137 } 138 139 // If multiple durations are defined, take the first 140 transitionDuration = transitionDuration.split(',')[0]; 141 transitionDelay = transitionDelay.split(',')[0]; 142 return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER; 143 }; 144 const triggerTransitionEnd = element => { 145 element.dispatchEvent(new Event(TRANSITION_END)); 146 }; 147 const isElement = object => { 148 if (!object || typeof object !== 'object') { 149 return false;
vendor: 4,800 bytes, lines 150-282
150 } 151 if (typeof object.jquery !== 'undefined') { 152 object = object[0]; 153 } 154 return typeof object.nodeType !== 'undefined'; 155 }; 156 const getElement = object => { 157 // it's a jQuery object or a node element 158 if (isElement(object)) { 159 return object.jquery ? object[0] : object; 160 } 161 if (typeof object === 'string' && object.length > 0) { 162 return document.querySelector(parseSelector(object)); 163 } 164 return null; 165 }; 166 const isVisible = element => { 167 if (!isElement(element) || element.getClientRects().length === 0) { 168 return false; 169 } 170 const elementIsVisible = getComputedStyle(element).getPropertyValue('visibility') === 'visible'; 171 // Handle `details` element as its content may falsie appear visible when it is closed 172 const closedDetails = element.closest('details:not([open])'); 173 if (!closedDetails) { 174 return elementIsVisible; 175 } 176 if (closedDetails !== element) { 177 const summary = element.closest('summary'); 178 if (summary && summary.parentNode !== closedDetails) { 179 return false; 180 } 181 if (summary === null) { 182 return false; 183 } 184 } 185 return elementIsVisible; 186 }; 187 const isDisabled = element => { 188 if (!element || element.nodeType !== Node.ELEMENT_NODE) { 189 return true; 190 } 191 if (element.classList.contains('disabled')) { 192 return true; 193 } 194 if (typeof element.disabled !== 'undefined') { 195 return element.disabled; 196 } 197 return element.hasAttribute('disabled') && element.getAttribute('disabled') !== 'false'; 198 }; 199 const findShadowRoot = element => { 200 if (!document.documentElement.attachShadow) { 201 return null; 202 } 203 204 // Can find the shadow root otherwise it'll return the document 205 if (typeof element.getRootNode === 'function') { 206 const root = element.getRootNode(); 207 return root instanceof ShadowRoot ? root : null; 208 } 209 if (element instanceof ShadowRoot) { 210 return element; 211 } 212 213 // when we don't find a shadow root 214 if (!element.parentNode) { 215 return null; 216 } 217 return findShadowRoot(element.parentNode); 218 }; 219 const noop = () => {}; 220 221 /** 222 * Trick to restart an element's animation 223 * 224 * @param {HTMLElement} element 225 * @return void 226 * 227 * @see https://www.charistheo.io/blog/2021/02/restart-a-css-animation-with-javascript/#restarting-a-css-animation 228 */ 229 const reflow = element => { 230 element.offsetHeight; // eslint-disable-line no-unused-expressions 231 }; 232 233 const getjQuery = () => { 234 if (window.jQuery && !document.body.hasAttribute('data-bs-no-jquery')) { 235 return window.jQuery; 236 } 237 return null; 238 }; 239 const DOMContentLoadedCallbacks = []; 240 const onDOMContentLoaded = callback => { 241 if (document.readyState === 'loading') { 242 // add listener on the first call when the document is in loading state 243 if (!DOMContentLoadedCallbacks.length) { 244 document.addEventListener('DOMContentLoaded', () => { 245 for (const callback of DOMContentLoadedCallbacks) { 246 callback(); 247 } 248 }); 249 } 250 DOMContentLoadedCallbacks.push(callback); 251 } else { 252 callback(); 253 } 254 }; 255 const isRTL = () => document.documentElement.dir === 'rtl'; 256 const defineJQueryPlugin = plugin => { 257 onDOMContentLoaded(() => { 258 const $ = getjQuery(); 259 /* istanbul ignore if */ 260 if ($) { 261 const name = plugin.NAME; 262 const JQUERY_NO_CONFLICT = $.fn[name]; 263 $.fn[name] = plugin.jQueryInterface; 264 $.fn[name].Constructor = plugin; 265 $.fn[name].noConflict = () => { 266 $.fn[name] = JQUERY_NO_CONFLICT; 267 return plugin.jQueryInterface; 268 }; 269 } 270 }); 271 }; 272 const execute = (possibleCallback, args = [], defaultValue = possibleCallback) => { 273 return typeof possibleCallback === 'function' ? possibleCallback(...args) : defaultValue; 274 }; 275 const executeAfterTransition = (callback, transitionElement, waitForTransition = true) => { 276 if (!waitForTransition) { 277 execute(callback); 278 return; 279 } 280 const durationPadding = 5; 281 const emulatedDuration = getTransitionDurationFromElement(transitionElement) + durationPadding; 282 let called = false;
vendor: 10,108 bytes, lines 283-507
283 const handler = ({ 284 target 285 }) => { 286 if (target !== transitionElement) { 287 return; 288 } 289 called = true; 290 transitionElement.removeEventListener(TRANSITION_END, handler); 291 execute(callback); 292 }; 293 transitionElement.addEventListener(TRANSITION_END, handler); 294 setTimeout(() => { 295 if (!called) { 296 triggerTransitionEnd(transitionElement); 297 } 298 }, emulatedDuration); 299 }; 300 301 /** 302 * Return the previous/next element of a list. 303 * 304 * @param {array} list The list of elements 305 * @param activeElement The active element 306 * @param shouldGetNext Choose to get next or previous element 307 * @param isCycleAllowed 308 * @return {Element|elem} The proper element 309 */ 310 const getNextActiveElement = (list, activeElement, shouldGetNext, isCycleAllowed) => { 311 const listLength = list.length; 312 let index = list.indexOf(activeElement); 313 314 // if the element does not exist in the list return an element 315 // depending on the direction and if cycle is allowed 316 if (index === -1) { 317 return !shouldGetNext && isCycleAllowed ? list[listLength - 1] : list[0]; 318 } 319 index += shouldGetNext ? 1 : -1; 320 if (isCycleAllowed) { 321 index = (index + listLength) % listLength; 322 } 323 return list[Math.max(0, Math.min(index, listLength - 1))]; 324 }; 325 326 /** 327 * -------------------------------------------------------------------------- 328 * Bootstrap dom/event-handler.js 329 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 330 * -------------------------------------------------------------------------- 331 */ 332 333 /** 334 * Constants 335 */ 336 337 const namespaceRegex = /[^.]*(?=\..*)\.|.*/; 338 const stripNameRegex = /\..*/; 339 const stripUidRegex = /::\d+$/; 340 const eventRegistry = {}; // Events storage 341 let uidEvent = 1; 342 const customEvents = { 343 mouseenter: 'mouseover', 344 mouseleave: 'mouseout' 345 }; 346 const nativeEvents = new Set(['click', 'dblclick', 'mouseup', 'mousedown', 'contextmenu', 'mousewheel', 'DOMMouseScroll', 'mouseover', 'mouseout', 'mousemove', 'selectstart', 'selectend', 'keydown', 'keypress', 'keyup', 'orientationchange', 'touchstart', 'touchmove', 'touchend', 'touchcancel', 'pointerdown', 'pointermove', 'pointerup', 'pointerleave', 'pointercancel', 'gesturestart', 'gesturechange', 'gestureend', 'focus', 'blur', 'change', 'reset', 'select', 'submit', 'focusin', 'focusout', 'load', 'unload', 'beforeunload', 'resize', 'move', 'DOMContentLoaded', 'readystatechange', 'error', 'abort', 'scroll']); 347 348 /** 349 * Private methods 350 */ 351 352 function makeEventUid(element, uid) { 353 return uid && `${uid}::${uidEvent++}` || element.uidEvent || uidEvent++; 354 } 355 function getElementEvents(element) { 356 const uid = makeEventUid(element); 357 element.uidEvent = uid; 358 eventRegistry[uid] = eventRegistry[uid] || {}; 359 return eventRegistry[uid]; 360 } 361 function bootstrapHandler(element, fn) { 362 return function handler(event) { 363 hydrateObj(event, { 364 delegateTarget: element 365 }); 366 if (handler.oneOff) { 367 EventHandler.off(element, event.type, fn); 368 } 369 return fn.apply(element, [event]); 370 }; 371 } 372 function bootstrapDelegationHandler(element, selector, fn) { 373 return function handler(event) { 374 const domElements = element.querySelectorAll(selector); 375 for (let { 376 target 377 } = event; target && target !== this; target = target.parentNode) { 378 for (const domElement of domElements) { 379 if (domElement !== target) { 380 continue; 381 } 382 hydrateObj(event, { 383 delegateTarget: target 384 }); 385 if (handler.oneOff) { 386 EventHandler.off(element, event.type, selector, fn); 387 } 388 return fn.apply(target, [event]); 389 } 390 } 391 }; 392 } 393 function findHandler(events, callable, delegationSelector = null) { 394 return Object.values(events).find(event => event.callable === callable && event.delegationSelector === delegationSelector); 395 } 396 function normalizeParameters(originalTypeEvent, handler, delegationFunction) { 397 const isDelegated = typeof handler === 'string'; 398 // TODO: tooltip passes `false` instead of selector, so we need to check 399 const callable = isDelegated ? delegationFunction : handler || delegationFunction; 400 let typeEvent = getTypeEvent(originalTypeEvent); 401 if (!nativeEvents.has(typeEvent)) { 402 typeEvent = originalTypeEvent; 403 } 404 return [isDelegated, callable, typeEvent]; 405 } 406 function addHandler(element, originalTypeEvent, handler, delegationFunction, oneOff) { 407 if (typeof originalTypeEvent !== 'string' || !element) { 408 return; 409 } 410 let [isDelegated, callable, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction); 411 412 // in case of mouseenter or mouseleave wrap the handler within a function that checks for its DOM position 413 // this prevents the handler from being dispatched the same way as mouseover or mouseout does 414 if (originalTypeEvent in customEvents) { 415 const wrapFunction = fn => { 416 return function (event) { 417 if (!event.relatedTarget || event.relatedTarget !== event.delegateTarget && !event.delegateTarget.contains(event.relatedTarget)) { 418 return fn.call(this, event); 419 } 420 }; 421 }; 422 callable = wrapFunction(callable); 423 } 424 const events = getElementEvents(element); 425 const handlers = events[typeEvent] || (events[typeEvent] = {}); 426 const previousFunction = findHandler(handlers, callable, isDelegated ? handler : null); 427 if (previousFunction) { 428 previousFunction.oneOff = previousFunction.oneOff && oneOff; 429 return; 430 } 431 const uid = makeEventUid(callable, originalTypeEvent.replace(namespaceRegex, '')); 432 const fn = isDelegated ? bootstrapDelegationHandler(element, handler, callable) : bootstrapHandler(element, callable); 433 fn.delegationSelector = isDelegated ? handler : null; 434 fn.callable = callable; 435 fn.oneOff = oneOff; 436 fn.uidEvent = uid; 437 handlers[uid] = fn; 438 element.addEventListener(typeEvent, fn, isDelegated); 439 } 440 function removeHandler(element, events, typeEvent, handler, delegationSelector) { 441 const fn = findHandler(events[typeEvent], handler, delegationSelector); 442 if (!fn) { 443 return; 444 } 445 element.removeEventListener(typeEvent, fn, Boolean(delegationSelector)); 446 delete events[typeEvent][fn.uidEvent]; 447 } 448 function removeNamespacedHandlers(element, events, typeEvent, namespace) { 449 const storeElementEvent = events[typeEvent] || {}; 450 for (const [handlerKey, event] of Object.entries(storeElementEvent)) { 451 if (handlerKey.includes(namespace)) { 452 removeHandler(element, events, typeEvent, event.callable, event.delegationSelector); 453 } 454 } 455 } 456 function getTypeEvent(event) { 457 // allow to get the native events from namespaced events ('click.bs.button' --> 'click') 458 event = event.replace(stripNameRegex, ''); 459 return customEvents[event] || event; 460 } 461 const EventHandler = { 462 on(element, event, handler, delegationFunction) { 463 addHandler(element, event, handler, delegationFunction, false); 464 }, 465 one(element, event, handler, delegationFunction) { 466 addHandler(element, event, handler, delegationFunction, true); 467 }, 468 off(element, originalTypeEvent, handler, delegationFunction) { 469 if (typeof originalTypeEvent !== 'string' || !element) { 470 return; 471 } 472 const [isDelegated, callable, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction); 473 const inNamespace = typeEvent !== originalTypeEvent; 474 const events = getElementEvents(element); 475 const storeElementEvent = events[typeEvent] || {}; 476 const isNamespace = originalTypeEvent.startsWith('.'); 477 if (typeof callable !== 'undefined') { 478 // Simplest case: handler is passed, remove that listener ONLY. 479 if (!Object.keys(storeElementEvent).length) { 480 return; 481 } 482 removeHandler(element, events, typeEvent, callable, isDelegated ? handler : null); 483 return; 484 } 485 if (isNamespace) { 486 for (const elementEvent of Object.keys(events)) { 487 removeNamespacedHandlers(element, events, elementEvent, originalTypeEvent.slice(1)); 488 } 489 } 490 for (const [keyHandlers, event] of Object.entries(storeElementEvent)) { 491 const handlerKey = keyHandlers.replace(stripUidRegex, ''); 492 if (!inNamespace || originalTypeEvent.includes(handlerKey)) { 493 removeHandler(element, events, typeEvent, event.callable, event.delegationSelector); 494 } 495 } 496 }, 497 trigger(element, event, args) { 498 if (typeof event !== 'string' || !element) { 499 return null; 500 } 501 const $ = getjQuery(); 502 const typeEvent = getTypeEvent(event); 503 const inNamespace = event !== typeEvent; 504 let jQueryEvent = null; 505 let bubbles = true; 506 let nativeDispatch = true; 507 let defaultPrevented = false;
vendor: 6,218 bytes, lines 508-688
508 if (inNamespace && $) { 509 jQueryEvent = $.Event(event, args); 510 $(element).trigger(jQueryEvent); 511 bubbles = !jQueryEvent.isPropagationStopped(); 512 nativeDispatch = !jQueryEvent.isImmediatePropagationStopped(); 513 defaultPrevented = jQueryEvent.isDefaultPrevented(); 514 } 515 const evt = hydrateObj(new Event(event, { 516 bubbles, 517 cancelable: true 518 }), args); 519 if (defaultPrevented) { 520 evt.preventDefault(); 521 } 522 if (nativeDispatch) { 523 element.dispatchEvent(evt); 524 } 525 if (evt.defaultPrevented && jQueryEvent) { 526 jQueryEvent.preventDefault(); 527 } 528 return evt; 529 } 530 }; 531 function hydrateObj(obj, meta = {}) { 532 for (const [key, value] of Object.entries(meta)) { 533 try { 534 obj[key] = value; 535 } catch (_unused) { 536 Object.defineProperty(obj, key, { 537 configurable: true, 538 get() { 539 return value; 540 } 541 }); 542 } 543 } 544 return obj; 545 } 546 547 /** 548 * -------------------------------------------------------------------------- 549 * Bootstrap dom/manipulator.js 550 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 551 * -------------------------------------------------------------------------- 552 */ 553 554 function normalizeData(value) { 555 if (value === 'true') { 556 return true; 557 } 558 if (value === 'false') { 559 return false; 560 } 561 if (value === Number(value).toString()) { 562 return Number(value); 563 } 564 if (value === '' || value === 'null') { 565 return null; 566 } 567 if (typeof value !== 'string') { 568 return value; 569 } 570 try { 571 return JSON.parse(decodeURIComponent(value)); 572 } catch (_unused) { 573 return value; 574 } 575 } 576 function normalizeDataKey(key) { 577 return key.replace(/[A-Z]/g, chr => `-${chr.toLowerCase()}`); 578 } 579 const Manipulator = { 580 setDataAttribute(element, key, value) { 581 element.setAttribute(`data-bs-${normalizeDataKey(key)}`, value); 582 }, 583 removeDataAttribute(element, key) { 584 element.removeAttribute(`data-bs-${normalizeDataKey(key)}`); 585 }, 586 getDataAttributes(element) { 587 if (!element) { 588 return {}; 589 } 590 const attributes = {}; 591 const bsKeys = Object.keys(element.dataset).filter(key => key.startsWith('bs') && !key.startsWith('bsConfig')); 592 for (const key of bsKeys) { 593 let pureKey = key.replace(/^bs/, ''); 594 pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1, pureKey.length); 595 attributes[pureKey] = normalizeData(element.dataset[key]); 596 } 597 return attributes; 598 }, 599 getDataAttribute(element, key) { 600 return normalizeData(element.getAttribute(`data-bs-${normalizeDataKey(key)}`)); 601 } 602 }; 603 604 /** 605 * -------------------------------------------------------------------------- 606 * Bootstrap util/config.js 607 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 608 * -------------------------------------------------------------------------- 609 */ 610 611 /** 612 * Class definition 613 */ 614 615 class Config { 616 // Getters 617 static get Default() { 618 return {}; 619 } 620 static get DefaultType() { 621 return {}; 622 } 623 static get NAME() { 624 throw new Error('You have to implement the static method "NAME", for each component!'); 625 } 626 _getConfig(config) { 627 config = this._mergeConfigObj(config); 628 config = this._configAfterMerge(config); 629 this._typeCheckConfig(config); 630 return config; 631 } 632 _configAfterMerge(config) { 633 return config; 634 } 635 _mergeConfigObj(config, element) { 636 const jsonConfig = isElement(element) ? Manipulator.getDataAttribute(element, 'config') : {}; // try to parse 637 638 return { 639 ...this.constructor.Default, 640 ...(typeof jsonConfig === 'object' ? jsonConfig : {}), 641 ...(isElement(element) ? Manipulator.getDataAttributes(element) : {}), 642 ...(typeof config === 'object' ? config : {}) 643 }; 644 } 645 _typeCheckConfig(config, configTypes = this.constructor.DefaultType) { 646 for (const [property, expectedTypes] of Object.entries(configTypes)) { 647 const value = config[property]; 648 const valueType = isElement(value) ? 'element' : toType(value); 649 if (!new RegExp(expectedTypes).test(valueType)) { 650 throw new TypeError(`${this.constructor.NAME.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`); 651 } 652 } 653 } 654 } 655 656 /** 657 * -------------------------------------------------------------------------- 658 * Bootstrap base-component.js 659 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 660 * -------------------------------------------------------------------------- 661 */ 662 663 /** 664 * Constants 665 */ 666 667 const VERSION = '5.3.0-alpha2'; 668 669 /** 670 * Class definition 671 */ 672 673 class BaseComponent extends Config { 674 constructor(element, config) { 675 super(); 676 element = getElement(element); 677 if (!element) { 678 return; 679 } 680 this._element = element; 681 this._config = this._getConfig(config); 682 Data.set(this._element, this.constructor.DATA_KEY, this); 683 } 684 685 // Public 686 dispose() { 687 Data.remove(this._element, this.constructor.DATA_KEY); 688 EventHandler.off(this._element, this.constructor.EVENT_KEY);
vendor: 42,775 bytes, lines 689-1836
689 for (const propertyName of Object.getOwnPropertyNames(this)) { 690 this[propertyName] = null; 691 } 692 } 693 _queueCallback(callback, element, isAnimated = true) { 694 executeAfterTransition(callback, element, isAnimated); 695 } 696 _getConfig(config) { 697 config = this._mergeConfigObj(config, this._element); 698 config = this._configAfterMerge(config); 699 this._typeCheckConfig(config); 700 return config; 701 } 702 703 // Static 704 static getInstance(element) { 705 return Data.get(getElement(element), this.DATA_KEY); 706 } 707 static getOrCreateInstance(element, config = {}) { 708 return this.getInstance(element) || new this(element, typeof config === 'object' ? config : null); 709 } 710 static get VERSION() { 711 return VERSION; 712 } 713 static get DATA_KEY() { 714 return `bs.${this.NAME}`; 715 } 716 static get EVENT_KEY() { 717 return `.${this.DATA_KEY}`; 718 } 719 static eventName(name) { 720 return `${name}${this.EVENT_KEY}`; 721 } 722 } 723 724 /** 725 * -------------------------------------------------------------------------- 726 * Bootstrap dom/selector-engine.js 727 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 728 * -------------------------------------------------------------------------- 729 */ 730 const getSelector = element => { 731 let selector = element.getAttribute('data-bs-target'); 732 if (!selector || selector === '#') { 733 let hrefAttribute = element.getAttribute('href'); 734 735 // The only valid content that could double as a selector are IDs or classes, 736 // so everything starting with `#` or `.`. If a "real" URL is used as the selector, 737 // `document.querySelector` will rightfully complain it is invalid. 738 // See https://github.com/twbs/bootstrap/issues/32273 739 if (!hrefAttribute || !hrefAttribute.includes('#') && !hrefAttribute.startsWith('.')) { 740 return null; 741 } 742 743 // Just in case some CMS puts out a full URL with the anchor appended 744 if (hrefAttribute.includes('#') && !hrefAttribute.startsWith('#')) { 745 hrefAttribute = `#${hrefAttribute.split('#')[1]}`; 746 } 747 selector = hrefAttribute && hrefAttribute !== '#' ? hrefAttribute.trim() : null; 748 } 749 return parseSelector(selector); 750 }; 751 const SelectorEngine = { 752 find(selector, element = document.documentElement) { 753 return [].concat(...Element.prototype.querySelectorAll.call(element, selector)); 754 }, 755 findOne(selector, element = document.documentElement) { 756 return Element.prototype.querySelector.call(element, selector); 757 }, 758 children(element, selector) { 759 return [].concat(...element.children).filter(child => child.matches(selector)); 760 }, 761 parents(element, selector) { 762 const parents = []; 763 let ancestor = element.parentNode.closest(selector); 764 while (ancestor) { 765 parents.push(ancestor); 766 ancestor = ancestor.parentNode.closest(selector); 767 } 768 return parents; 769 }, 770 prev(element, selector) { 771 let previous = element.previousElementSibling; 772 while (previous) { 773 if (previous.matches(selector)) { 774 return [previous]; 775 } 776 previous = previous.previousElementSibling; 777 } 778 return []; 779 }, 780 // TODO: this is now unused; remove later along with prev() 781 next(element, selector) { 782 let next = element.nextElementSibling; 783 while (next) { 784 if (next.matches(selector)) { 785 return [next]; 786 } 787 next = next.nextElementSibling; 788 } 789 return []; 790 }, 791 focusableChildren(element) { 792 const focusables = ['a', 'button', 'input', 'textarea', 'select', 'details', '[tabindex]', '[contenteditable="true"]'].map(selector => `${selector}:not([tabindex^="-"])`).join(','); 793 return this.find(focusables, element).filter(el => !isDisabled(el) && isVisible(el)); 794 }, 795 getSelectorFromElement(element) { 796 const selector = getSelector(element); 797 if (selector) { 798 return SelectorEngine.findOne(selector) ? selector : null; 799 } 800 return null; 801 }, 802 getElementFromSelector(element) { 803 const selector = getSelector(element); 804 return selector ? SelectorEngine.findOne(selector) : null; 805 }, 806 getMultipleElementsFromSelector(element) { 807 const selector = getSelector(element); 808 return selector ? SelectorEngine.find(selector) : []; 809 } 810 }; 811 812 /** 813 * -------------------------------------------------------------------------- 814 * Bootstrap util/component-functions.js 815 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 816 * -------------------------------------------------------------------------- 817 */ 818 const enableDismissTrigger = (component, method = 'hide') => { 819 const clickEvent = `click.dismiss${component.EVENT_KEY}`; 820 const name = component.NAME; 821 EventHandler.on(document, clickEvent, `[data-bs-dismiss="${name}"]`, function (event) { 822 if (['A', 'AREA'].includes(this.tagName)) { 823 event.preventDefault(); 824 } 825 if (isDisabled(this)) { 826 return; 827 } 828 const target = SelectorEngine.getElementFromSelector(this) || this.closest(`.${name}`); 829 const instance = component.getOrCreateInstance(target); 830 831 // Method argument is left, for Alert and only, as it doesn't implement the 'hide' method 832 instance[method](); 833 }); 834 }; 835 836 /** 837 * -------------------------------------------------------------------------- 838 * Bootstrap alert.js 839 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 840 * -------------------------------------------------------------------------- 841 */ 842 843 /** 844 * Constants 845 */ 846 847 const NAME$f = 'alert'; 848 const DATA_KEY$a = 'bs.alert'; 849 const EVENT_KEY$b = `.${DATA_KEY$a}`; 850 const EVENT_CLOSE = `close${EVENT_KEY$b}`; 851 const EVENT_CLOSED = `closed${EVENT_KEY$b}`; 852 const CLASS_NAME_FADE$5 = 'fade'; 853 const CLASS_NAME_SHOW$8 = 'show'; 854 855 /** 856 * Class definition 857 */ 858 859 class Alert extends BaseComponent { 860 // Getters 861 static get NAME() { 862 return NAME$f; 863 } 864 865 // Public 866 close() { 867 const closeEvent = EventHandler.trigger(this._element, EVENT_CLOSE); 868 if (closeEvent.defaultPrevented) { 869 return; 870 } 871 this._element.classList.remove(CLASS_NAME_SHOW$8); 872 const isAnimated = this._element.classList.contains(CLASS_NAME_FADE$5); 873 this._queueCallback(() => this._destroyElement(), this._element, isAnimated); 874 } 875 876 // Private 877 _destroyElement() { 878 this._element.remove(); 879 EventHandler.trigger(this._element, EVENT_CLOSED); 880 this.dispose(); 881 } 882 883 // Static 884 static jQueryInterface(config) { 885 return this.each(function () { 886 const data = Alert.getOrCreateInstance(this); 887 if (typeof config !== 'string') { 888 return; 889 } 890 if (data[config] === undefined || config.startsWith('_') || config === 'constructor') { 891 throw new TypeError(`No method named "${config}"`); 892 } 893 data[config](this); 894 }); 895 } 896 } 897 898 /** 899 * Data API implementation 900 */ 901 902 enableDismissTrigger(Alert, 'close'); 903 904 /** 905 * jQuery 906 */ 907 908 defineJQueryPlugin(Alert); 909 910 /** 911 * -------------------------------------------------------------------------- 912 * Bootstrap button.js 913 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 914 * -------------------------------------------------------------------------- 915 */ 916 917 /** 918 * Constants 919 */ 920 921 const NAME$e = 'button'; 922 const DATA_KEY$9 = 'bs.button'; 923 const EVENT_KEY$a = `.${DATA_KEY$9}`; 924 const DATA_API_KEY$6 = '.data-api'; 925 const CLASS_NAME_ACTIVE$3 = 'active'; 926 const SELECTOR_DATA_TOGGLE$5 = '[data-bs-toggle="button"]'; 927 const EVENT_CLICK_DATA_API$6 = `click${EVENT_KEY$a}${DATA_API_KEY$6}`; 928 929 /** 930 * Class definition 931 */ 932 933 class Button extends BaseComponent { 934 // Getters 935 static get NAME() { 936 return NAME$e; 937 } 938 939 // Public 940 toggle() { 941 // Toggle class and sync the `aria-pressed` attribute with the return value of the `.toggle()` method 942 this._element.setAttribute('aria-pressed', this._element.classList.toggle(CLASS_NAME_ACTIVE$3)); 943 } 944 945 // Static 946 static jQueryInterface(config) { 947 return this.each(function () { 948 const data = Button.getOrCreateInstance(this); 949 if (config === 'toggle') { 950 data[config](); 951 } 952 }); 953 } 954 } 955 956 /** 957 * Data API implementation 958 */ 959 960 EventHandler.on(document, EVENT_CLICK_DATA_API$6, SELECTOR_DATA_TOGGLE$5, event => { 961 event.preventDefault(); 962 const button = event.target.closest(SELECTOR_DATA_TOGGLE$5); 963 const data = Button.getOrCreateInstance(button); 964 data.toggle(); 965 }); 966 967 /** 968 * jQuery 969 */ 970 971 defineJQueryPlugin(Button); 972 973 /** 974 * -------------------------------------------------------------------------- 975 * Bootstrap util/swipe.js 976 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 977 * -------------------------------------------------------------------------- 978 */ 979 980 /** 981 * Constants 982 */ 983 984 const NAME$d = 'swipe'; 985 const EVENT_KEY$9 = '.bs.swipe'; 986 const EVENT_TOUCHSTART = `touchstart${EVENT_KEY$9}`; 987 const EVENT_TOUCHMOVE = `touchmove${EVENT_KEY$9}`; 988 const EVENT_TOUCHEND = `touchend${EVENT_KEY$9}`; 989 const EVENT_POINTERDOWN = `pointerdown${EVENT_KEY$9}`; 990 const EVENT_POINTERUP = `pointerup${EVENT_KEY$9}`; 991 const POINTER_TYPE_TOUCH = 'touch'; 992 const POINTER_TYPE_PEN = 'pen'; 993 const CLASS_NAME_POINTER_EVENT = 'pointer-event'; 994 const SWIPE_THRESHOLD = 40; 995 const Default$c = { 996 endCallback: null, 997 leftCallback: null, 998 rightCallback: null 999 }; 1000 const DefaultType$c = { 1001 endCallback: '(function|null)', 1002 leftCallback: '(function|null)', 1003 rightCallback: '(function|null)' 1004 }; 1005 1006 /** 1007 * Class definition 1008 */ 1009 1010 class Swipe extends Config { 1011 constructor(element, config) { 1012 super(); 1013 this._element = element; 1014 if (!element || !Swipe.isSupported()) { 1015 return; 1016 } 1017 this._config = this._getConfig(config); 1018 this._deltaX = 0; 1019 this._supportPointerEvents = Boolean(window.PointerEvent); 1020 this._initEvents(); 1021 } 1022 1023 // Getters 1024 static get Default() { 1025 return Default$c; 1026 } 1027 static get DefaultType() { 1028 return DefaultType$c; 1029 } 1030 static get NAME() { 1031 return NAME$d; 1032 } 1033 1034 // Public 1035 dispose() { 1036 EventHandler.off(this._element, EVENT_KEY$9); 1037 } 1038 1039 // Private 1040 _start(event) { 1041 if (!this._supportPointerEvents) { 1042 this._deltaX = event.touches[0].clientX; 1043 return; 1044 } 1045 if (this._eventIsPointerPenTouch(event)) { 1046 this._deltaX = event.clientX; 1047 } 1048 } 1049 _end(event) { 1050 if (this._eventIsPointerPenTouch(event)) { 1051 this._deltaX = event.clientX - this._deltaX; 1052 } 1053 this._handleSwipe(); 1054 execute(this._config.endCallback); 1055 } 1056 _move(event) { 1057 this._deltaX = event.touches && event.touches.length > 1 ? 0 : event.touches[0].clientX - this._deltaX; 1058 } 1059 _handleSwipe() { 1060 const absDeltaX = Math.abs(this._deltaX); 1061 if (absDeltaX <= SWIPE_THRESHOLD) { 1062 return; 1063 } 1064 const direction = absDeltaX / this._deltaX; 1065 this._deltaX = 0; 1066 if (!direction) { 1067 return; 1068 } 1069 execute(direction > 0 ? this._config.rightCallback : this._config.leftCallback); 1070 } 1071 _initEvents() { 1072 if (this._supportPointerEvents) { 1073 EventHandler.on(this._element, EVENT_POINTERDOWN, event => this._start(event)); 1074 EventHandler.on(this._element, EVENT_POINTERUP, event => this._end(event)); 1075 this._element.classList.add(CLASS_NAME_POINTER_EVENT); 1076 } else { 1077 EventHandler.on(this._element, EVENT_TOUCHSTART, event => this._start(event)); 1078 EventHandler.on(this._element, EVENT_TOUCHMOVE, event => this._move(event)); 1079 EventHandler.on(this._element, EVENT_TOUCHEND, event => this._end(event)); 1080 } 1081 } 1082 _eventIsPointerPenTouch(event) { 1083 return this._supportPointerEvents && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH); 1084 } 1085 1086 // Static 1087 static isSupported() { 1088 return 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0; 1089 } 1090 } 1091 1092 /** 1093 * -------------------------------------------------------------------------- 1094 * Bootstrap carousel.js 1095 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 1096 * -------------------------------------------------------------------------- 1097 */ 1098 1099 /** 1100 * Constants 1101 */ 1102 1103 const NAME$c = 'carousel'; 1104 const DATA_KEY$8 = 'bs.carousel'; 1105 const EVENT_KEY$8 = `.${DATA_KEY$8}`; 1106 const DATA_API_KEY$5 = '.data-api'; 1107 const ARROW_LEFT_KEY$1 = 'ArrowLeft'; 1108 const ARROW_RIGHT_KEY$1 = 'ArrowRight'; 1109 const TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch 1110 1111 const ORDER_NEXT = 'next'; 1112 const ORDER_PREV = 'prev'; 1113 const DIRECTION_LEFT = 'left'; 1114 const DIRECTION_RIGHT = 'right'; 1115 const EVENT_SLIDE = `slide${EVENT_KEY$8}`; 1116 const EVENT_SLID = `slid${EVENT_KEY$8}`; 1117 const EVENT_KEYDOWN$1 = `keydown${EVENT_KEY$8}`; 1118 const EVENT_MOUSEENTER$1 = `mouseenter${EVENT_KEY$8}`; 1119 const EVENT_MOUSELEAVE$1 = `mouseleave${EVENT_KEY$8}`; 1120 const EVENT_DRAG_START = `dragstart${EVENT_KEY$8}`; 1121 const EVENT_LOAD_DATA_API$3 = `load${EVENT_KEY$8}${DATA_API_KEY$5}`; 1122 const EVENT_CLICK_DATA_API$5 = `click${EVENT_KEY$8}${DATA_API_KEY$5}`; 1123 const CLASS_NAME_CAROUSEL = 'carousel'; 1124 const CLASS_NAME_ACTIVE$2 = 'active'; 1125 const CLASS_NAME_SLIDE = 'slide'; 1126 const CLASS_NAME_END = 'carousel-item-end'; 1127 const CLASS_NAME_START = 'carousel-item-start'; 1128 const CLASS_NAME_NEXT = 'carousel-item-next'; 1129 const CLASS_NAME_PREV = 'carousel-item-prev'; 1130 const SELECTOR_ACTIVE = '.active'; 1131 const SELECTOR_ITEM = '.carousel-item'; 1132 const SELECTOR_ACTIVE_ITEM = SELECTOR_ACTIVE + SELECTOR_ITEM; 1133 const SELECTOR_ITEM_IMG = '.carousel-item img'; 1134 const SELECTOR_INDICATORS = '.carousel-indicators'; 1135 const SELECTOR_DATA_SLIDE = '[data-bs-slide], [data-bs-slide-to]'; 1136 const SELECTOR_DATA_RIDE = '[data-bs-ride="carousel"]'; 1137 const KEY_TO_DIRECTION = { 1138 [ARROW_LEFT_KEY$1]: DIRECTION_RIGHT, 1139 [ARROW_RIGHT_KEY$1]: DIRECTION_LEFT 1140 }; 1141 const Default$b = { 1142 interval: 5000, 1143 keyboard: true, 1144 pause: 'hover', 1145 ride: false, 1146 touch: true, 1147 wrap: true 1148 }; 1149 const DefaultType$b = { 1150 interval: '(number|boolean)', 1151 // TODO:v6 remove boolean support 1152 keyboard: 'boolean', 1153 pause: '(string|boolean)', 1154 ride: '(boolean|string)', 1155 touch: 'boolean', 1156 wrap: 'boolean' 1157 }; 1158 1159 /** 1160 * Class definition 1161 */ 1162 1163 class Carousel extends BaseComponent { 1164 constructor(element, config) { 1165 super(element, config); 1166 this._interval = null; 1167 this._activeElement = null; 1168 this._isSliding = false; 1169 this.touchTimeout = null; 1170 this._swipeHelper = null; 1171 this._indicatorsElement = SelectorEngine.findOne(SELECTOR_INDICATORS, this._element); 1172 this._addEventListeners(); 1173 if (this._config.ride === CLASS_NAME_CAROUSEL) { 1174 this.cycle(); 1175 } 1176 } 1177 1178 // Getters 1179 static get Default() { 1180 return Default$b; 1181 } 1182 static get DefaultType() { 1183 return DefaultType$b; 1184 } 1185 static get NAME() { 1186 return NAME$c; 1187 } 1188 1189 // Public 1190 next() { 1191 this._slide(ORDER_NEXT); 1192 } 1193 nextWhenVisible() { 1194 // FIXME TODO use `document.visibilityState` 1195 // Don't call next when the page isn't visible 1196 // or the carousel or its parent isn't visible 1197 if (!document.hidden && isVisible(this._element)) { 1198 this.next(); 1199 } 1200 } 1201 prev() { 1202 this._slide(ORDER_PREV); 1203 } 1204 pause() { 1205 if (this._isSliding) { 1206 triggerTransitionEnd(this._element); 1207 } 1208 this._clearInterval(); 1209 } 1210 cycle() { 1211 this._clearInterval(); 1212 this._updateInterval(); 1213 this._interval = setInterval(() => this.nextWhenVisible(), this._config.interval); 1214 } 1215 _maybeEnableCycle() { 1216 if (!this._config.ride) { 1217 return; 1218 } 1219 if (this._isSliding) { 1220 EventHandler.one(this._element, EVENT_SLID, () => this.cycle()); 1221 return; 1222 } 1223 this.cycle(); 1224 } 1225 to(index) { 1226 const items = this._getItems(); 1227 if (index > items.length - 1 || index < 0) { 1228 return; 1229 } 1230 if (this._isSliding) { 1231 EventHandler.one(this._element, EVENT_SLID, () => this.to(index)); 1232 return; 1233 } 1234 const activeIndex = this._getItemIndex(this._getActive()); 1235 if (activeIndex === index) { 1236 return; 1237 } 1238 const order = index > activeIndex ? ORDER_NEXT : ORDER_PREV; 1239 this._slide(order, items[index]); 1240 } 1241 dispose() { 1242 if (this._swipeHelper) { 1243 this._swipeHelper.dispose(); 1244 } 1245 super.dispose(); 1246 } 1247 1248 // Private 1249 _configAfterMerge(config) { 1250 config.defaultInterval = config.interval; 1251 return config; 1252 } 1253 _addEventListeners() { 1254 if (this._config.keyboard) { 1255 EventHandler.on(this._element, EVENT_KEYDOWN$1, event => this._keydown(event)); 1256 } 1257 if (this._config.pause === 'hover') { 1258 EventHandler.on(this._element, EVENT_MOUSEENTER$1, () => this.pause()); 1259 EventHandler.on(this._element, EVENT_MOUSELEAVE$1, () => this._maybeEnableCycle()); 1260 } 1261 if (this._config.touch && Swipe.isSupported()) { 1262 this._addTouchEventListeners(); 1263 } 1264 } 1265 _addTouchEventListeners() { 1266 for (const img of SelectorEngine.find(SELECTOR_ITEM_IMG, this._element)) { 1267 EventHandler.on(img, EVENT_DRAG_START, event => event.preventDefault()); 1268 } 1269 const endCallBack = () => { 1270 if (this._config.pause !== 'hover') { 1271 return; 1272 } 1273 1274 // If it's a touch-enabled device, mouseenter/leave are fired as 1275 // part of the mouse compatibility events on first tap - the carousel 1276 // would stop cycling until user tapped out of it; 1277 // here, we listen for touchend, explicitly pause the carousel 1278 // (as if it's the second time we tap on it, mouseenter compat event 1279 // is NOT fired) and after a timeout (to allow for mouse compatibility 1280 // events to fire) we explicitly restart cycling 1281 1282 this.pause(); 1283 if (this.touchTimeout) { 1284 clearTimeout(this.touchTimeout); 1285 } 1286 this.touchTimeout = setTimeout(() => this._maybeEnableCycle(), TOUCHEVENT_COMPAT_WAIT + this._config.interval); 1287 }; 1288 const swipeConfig = { 1289 leftCallback: () => this._slide(this._directionToOrder(DIRECTION_LEFT)), 1290 rightCallback: () => this._slide(this._directionToOrder(DIRECTION_RIGHT)), 1291 endCallback: endCallBack 1292 }; 1293 this._swipeHelper = new Swipe(this._element, swipeConfig); 1294 } 1295 _keydown(event) { 1296 if (/input|textarea/i.test(event.target.tagName)) { 1297 return; 1298 } 1299 const direction = KEY_TO_DIRECTION[event.key]; 1300 if (direction) { 1301 event.preventDefault(); 1302 this._slide(this._directionToOrder(direction)); 1303 } 1304 } 1305 _getItemIndex(element) { 1306 return this._getItems().indexOf(element); 1307 } 1308 _setActiveIndicatorElement(index) { 1309 if (!this._indicatorsElement) { 1310 return; 1311 } 1312 const activeIndicator = SelectorEngine.findOne(SELECTOR_ACTIVE, this._indicatorsElement); 1313 activeIndicator.classList.remove(CLASS_NAME_ACTIVE$2); 1314 activeIndicator.removeAttribute('aria-current'); 1315 const newActiveIndicator = SelectorEngine.findOne(`[data-bs-slide-to="${index}"]`, this._indicatorsElement); 1316 if (newActiveIndicator) { 1317 newActiveIndicator.classList.add(CLASS_NAME_ACTIVE$2); 1318 newActiveIndicator.setAttribute('aria-current', 'true'); 1319 } 1320 } 1321 _updateInterval() { 1322 const element = this._activeElement || this._getActive(); 1323 if (!element) { 1324 return; 1325 } 1326 const elementInterval = Number.parseInt(element.getAttribute('data-bs-interval'), 10); 1327 this._config.interval = elementInterval || this._config.defaultInterval; 1328 } 1329 _slide(order, element = null) { 1330 if (this._isSliding) { 1331 return; 1332 } 1333 const activeElement = this._getActive(); 1334 const isNext = order === ORDER_NEXT; 1335 const nextElement = element || getNextActiveElement(this._getItems(), activeElement, isNext, this._config.wrap); 1336 if (nextElement === activeElement) { 1337 return; 1338 } 1339 const nextElementIndex = this._getItemIndex(nextElement); 1340 const triggerEvent = eventName => { 1341 return EventHandler.trigger(this._element, eventName, { 1342 relatedTarget: nextElement, 1343 direction: this._orderToDirection(order), 1344 from: this._getItemIndex(activeElement), 1345 to: nextElementIndex 1346 }); 1347 }; 1348 const slideEvent = triggerEvent(EVENT_SLIDE); 1349 if (slideEvent.defaultPrevented) { 1350 return; 1351 } 1352 if (!activeElement || !nextElement) { 1353 // Some weirdness is happening, so we bail 1354 // TODO: change tests that use empty divs to avoid this check 1355 return; 1356 } 1357 const isCycling = Boolean(this._interval); 1358 this.pause(); 1359 this._isSliding = true; 1360 this._setActiveIndicatorElement(nextElementIndex); 1361 this._activeElement = nextElement; 1362 const directionalClassName = isNext ? CLASS_NAME_START : CLASS_NAME_END; 1363 const orderClassName = isNext ? CLASS_NAME_NEXT : CLASS_NAME_PREV; 1364 nextElement.classList.add(orderClassName); 1365 reflow(nextElement); 1366 activeElement.classList.add(directionalClassName); 1367 nextElement.classList.add(directionalClassName); 1368 const completeCallBack = () => { 1369 nextElement.classList.remove(directionalClassName, orderClassName); 1370 nextElement.classList.add(CLASS_NAME_ACTIVE$2); 1371 activeElement.classList.remove(CLASS_NAME_ACTIVE$2, orderClassName, directionalClassName); 1372 this._isSliding = false; 1373 triggerEvent(EVENT_SLID); 1374 }; 1375 this._queueCallback(completeCallBack, activeElement, this._isAnimated()); 1376 if (isCycling) { 1377 this.cycle(); 1378 } 1379 } 1380 _isAnimated() { 1381 return this._element.classList.contains(CLASS_NAME_SLIDE); 1382 } 1383 _getActive() { 1384 return SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element); 1385 } 1386 _getItems() { 1387 return SelectorEngine.find(SELECTOR_ITEM, this._element); 1388 } 1389 _clearInterval() { 1390 if (this._interval) { 1391 clearInterval(this._interval); 1392 this._interval = null; 1393 } 1394 } 1395 _directionToOrder(direction) { 1396 if (isRTL()) { 1397 return direction === DIRECTION_LEFT ? ORDER_PREV : ORDER_NEXT; 1398 } 1399 return direction === DIRECTION_LEFT ? ORDER_NEXT : ORDER_PREV; 1400 } 1401 _orderToDirection(order) { 1402 if (isRTL()) { 1403 return order === ORDER_PREV ? DIRECTION_LEFT : DIRECTION_RIGHT; 1404 } 1405 return order === ORDER_PREV ? DIRECTION_RIGHT : DIRECTION_LEFT; 1406 } 1407 1408 // Static 1409 static jQueryInterface(config) { 1410 return this.each(function () { 1411 const data = Carousel.getOrCreateInstance(this, config); 1412 if (typeof config === 'number') { 1413 data.to(config); 1414 return; 1415 } 1416 if (typeof config === 'string') { 1417 if (data[config] === undefined || config.startsWith('_') || config === 'constructor') { 1418 throw new TypeError(`No method named "${config}"`); 1419 } 1420 data[config](); 1421 } 1422 }); 1423 } 1424 } 1425 1426 /** 1427 * Data API implementation 1428 */ 1429 1430 EventHandler.on(document, EVENT_CLICK_DATA_API$5, SELECTOR_DATA_SLIDE, function (event) { 1431 const target = SelectorEngine.getElementFromSelector(this); 1432 if (!target || !target.classList.contains(CLASS_NAME_CAROUSEL)) { 1433 return; 1434 } 1435 event.preventDefault(); 1436 const carousel = Carousel.getOrCreateInstance(target); 1437 const slideIndex = this.getAttribute('data-bs-slide-to'); 1438 if (slideIndex) { 1439 carousel.to(slideIndex); 1440 carousel._maybeEnableCycle(); 1441 return; 1442 } 1443 if (Manipulator.getDataAttribute(this, 'slide') === 'next') { 1444 carousel.next(); 1445 carousel._maybeEnableCycle(); 1446 return; 1447 } 1448 carousel.prev(); 1449 carousel._maybeEnableCycle(); 1450 }); 1451 EventHandler.on(window, EVENT_LOAD_DATA_API$3, () => { 1452 const carousels = SelectorEngine.find(SELECTOR_DATA_RIDE); 1453 for (const carousel of carousels) { 1454 Carousel.getOrCreateInstance(carousel); 1455 } 1456 }); 1457 1458 /** 1459 * jQuery 1460 */ 1461 1462 defineJQueryPlugin(Carousel); 1463 1464 /** 1465 * -------------------------------------------------------------------------- 1466 * Bootstrap collapse.js 1467 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 1468 * -------------------------------------------------------------------------- 1469 */ 1470 1471 /** 1472 * Constants 1473 */ 1474 1475 const NAME$b = 'collapse'; 1476 const DATA_KEY$7 = 'bs.collapse'; 1477 const EVENT_KEY$7 = `.${DATA_KEY$7}`; 1478 const DATA_API_KEY$4 = '.data-api'; 1479 const EVENT_SHOW$6 = `show${EVENT_KEY$7}`; 1480 const EVENT_SHOWN$6 = `shown${EVENT_KEY$7}`; 1481 const EVENT_HIDE$6 = `hide${EVENT_KEY$7}`; 1482 const EVENT_HIDDEN$6 = `hidden${EVENT_KEY$7}`; 1483 const EVENT_CLICK_DATA_API$4 = `click${EVENT_KEY$7}${DATA_API_KEY$4}`; 1484 const CLASS_NAME_SHOW$7 = 'show'; 1485 const CLASS_NAME_COLLAPSE = 'collapse'; 1486 const CLASS_NAME_COLLAPSING = 'collapsing'; 1487 const CLASS_NAME_COLLAPSED = 'collapsed'; 1488 const CLASS_NAME_DEEPER_CHILDREN = `:scope .${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`; 1489 const CLASS_NAME_HORIZONTAL = 'collapse-horizontal'; 1490 const WIDTH = 'width'; 1491 const HEIGHT = 'height'; 1492 const SELECTOR_ACTIVES = '.collapse.show, .collapse.collapsing'; 1493 const SELECTOR_DATA_TOGGLE$4 = '[data-bs-toggle="collapse"]'; 1494 const Default$a = { 1495 parent: null, 1496 toggle: true 1497 }; 1498 const DefaultType$a = { 1499 parent: '(null|element)', 1500 toggle: 'boolean' 1501 }; 1502 1503 /** 1504 * Class definition 1505 */ 1506 1507 class Collapse extends BaseComponent { 1508 constructor(element, config) { 1509 super(element, config); 1510 this._isTransitioning = false; 1511 this._triggerArray = []; 1512 const toggleList = SelectorEngine.find(SELECTOR_DATA_TOGGLE$4); 1513 for (const elem of toggleList) { 1514 const selector = SelectorEngine.getSelectorFromElement(elem); 1515 const filterElement = SelectorEngine.find(selector).filter(foundElement => foundElement === this._element); 1516 if (selector !== null && filterElement.length) { 1517 this._triggerArray.push(elem); 1518 } 1519 } 1520 this._initializeChildren(); 1521 if (!this._config.parent) { 1522 this._addAriaAndCollapsedClass(this._triggerArray, this._isShown()); 1523 } 1524 if (this._config.toggle) { 1525 this.toggle(); 1526 } 1527 } 1528 1529 // Getters 1530 static get Default() { 1531 return Default$a; 1532 } 1533 static get DefaultType() { 1534 return DefaultType$a; 1535 } 1536 static get NAME() { 1537 return NAME$b; 1538 } 1539 1540 // Public 1541 toggle() { 1542 if (this._isShown()) { 1543 this.hide(); 1544 } else { 1545 this.show(); 1546 } 1547 } 1548 show() { 1549 if (this._isTransitioning || this._isShown()) { 1550 return; 1551 } 1552 let activeChildren = []; 1553 1554 // find active children 1555 if (this._config.parent) { 1556 activeChildren = this._getFirstLevelChildren(SELECTOR_ACTIVES).filter(element => element !== this._element).map(element => Collapse.getOrCreateInstance(element, { 1557 toggle: false 1558 })); 1559 } 1560 if (activeChildren.length && activeChildren[0]._isTransitioning) { 1561 return; 1562 } 1563 const startEvent = EventHandler.trigger(this._element, EVENT_SHOW$6); 1564 if (startEvent.defaultPrevented) { 1565 return; 1566 } 1567 for (const activeInstance of activeChildren) { 1568 activeInstance.hide(); 1569 } 1570 const dimension = this._getDimension(); 1571 this._element.classList.remove(CLASS_NAME_COLLAPSE); 1572 this._element.classList.add(CLASS_NAME_COLLAPSING); 1573 this._element.style[dimension] = 0; 1574 this._addAriaAndCollapsedClass(this._triggerArray, true); 1575 this._isTransitioning = true; 1576 const complete = () => { 1577 this._isTransitioning = false; 1578 this._element.classList.remove(CLASS_NAME_COLLAPSING); 1579 this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$7); 1580 this._element.style[dimension] = ''; 1581 EventHandler.trigger(this._element, EVENT_SHOWN$6); 1582 }; 1583 const capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1); 1584 const scrollSize = `scroll${capitalizedDimension}`; 1585 this._queueCallback(complete, this._element, true); 1586 this._element.style[dimension] = `${this._element[scrollSize]}px`; 1587 } 1588 hide() { 1589 if (this._isTransitioning || !this._isShown()) { 1590 return; 1591 } 1592 const startEvent = EventHandler.trigger(this._element, EVENT_HIDE$6); 1593 if (startEvent.defaultPrevented) { 1594 return; 1595 } 1596 const dimension = this._getDimension(); 1597 this._element.style[dimension] = `${this._element.getBoundingClientRect()[dimension]}px`; 1598 reflow(this._element); 1599 this._element.classList.add(CLASS_NAME_COLLAPSING); 1600 this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$7); 1601 for (const trigger of this._triggerArray) { 1602 const element = SelectorEngine.getElementFromSelector(trigger); 1603 if (element && !this._isShown(element)) { 1604 this._addAriaAndCollapsedClass([trigger], false); 1605 } 1606 } 1607 this._isTransitioning = true; 1608 const complete = () => { 1609 this._isTransitioning = false; 1610 this._element.classList.remove(CLASS_NAME_COLLAPSING); 1611 this._element.classList.add(CLASS_NAME_COLLAPSE); 1612 EventHandler.trigger(this._element, EVENT_HIDDEN$6); 1613 }; 1614 this._element.style[dimension] = ''; 1615 this._queueCallback(complete, this._element, true); 1616 } 1617 _isShown(element = this._element) { 1618 return element.classList.contains(CLASS_NAME_SHOW$7); 1619 } 1620 1621 // Private 1622 _configAfterMerge(config) { 1623 config.toggle = Boolean(config.toggle); // Coerce string values 1624 config.parent = getElement(config.parent); 1625 return config; 1626 } 1627 _getDimension() { 1628 return this._element.classList.contains(CLASS_NAME_HORIZONTAL) ? WIDTH : HEIGHT; 1629 } 1630 _initializeChildren() { 1631 if (!this._config.parent) { 1632 return; 1633 } 1634 const children = this._getFirstLevelChildren(SELECTOR_DATA_TOGGLE$4); 1635 for (const element of children) { 1636 const selected = SelectorEngine.getElementFromSelector(element); 1637 if (selected) { 1638 this._addAriaAndCollapsedClass([element], this._isShown(selected)); 1639 } 1640 } 1641 } 1642 _getFirstLevelChildren(selector) { 1643 const children = SelectorEngine.find(CLASS_NAME_DEEPER_CHILDREN, this._config.parent); 1644 // remove children if greater depth 1645 return SelectorEngine.find(selector, this._config.parent).filter(element => !children.includes(element)); 1646 } 1647 _addAriaAndCollapsedClass(triggerArray, isOpen) { 1648 if (!triggerArray.length) { 1649 return; 1650 } 1651 for (const element of triggerArray) { 1652 element.classList.toggle(CLASS_NAME_COLLAPSED, !isOpen); 1653 element.setAttribute('aria-expanded', isOpen); 1654 } 1655 } 1656 1657 // Static 1658 static jQueryInterface(config) { 1659 const _config = {}; 1660 if (typeof config === 'string' && /show|hide/.test(config)) { 1661 _config.toggle = false; 1662 } 1663 return this.each(function () { 1664 const data = Collapse.getOrCreateInstance(this, _config); 1665 if (typeof config === 'string') { 1666 if (typeof data[config] === 'undefined') { 1667 throw new TypeError(`No method named "${config}"`); 1668 } 1669 data[config](); 1670 } 1671 }); 1672 } 1673 } 1674 1675 /** 1676 * Data API implementation 1677 */ 1678 1679 EventHandler.on(document, EVENT_CLICK_DATA_API$4, SELECTOR_DATA_TOGGLE$4, function (event) { 1680 // preventDefault only for <a> elements (which change the URL) not inside the collapsible element 1681 if (event.target.tagName === 'A' || event.delegateTarget && event.delegateTarget.tagName === 'A') { 1682 event.preventDefault(); 1683 } 1684 for (const element of SelectorEngine.getMultipleElementsFromSelector(this)) { 1685 Collapse.getOrCreateInstance(element, { 1686 toggle: false 1687 }).toggle(); 1688 } 1689 }); 1690 1691 /** 1692 * jQuery 1693 */ 1694 1695 defineJQueryPlugin(Collapse); 1696 1697 /** 1698 * -------------------------------------------------------------------------- 1699 * Bootstrap dropdown.js 1700 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 1701 * -------------------------------------------------------------------------- 1702 */ 1703 1704 /** 1705 * Constants 1706 */ 1707 1708 const NAME$a = 'dropdown'; 1709 const DATA_KEY$6 = 'bs.dropdown'; 1710 const EVENT_KEY$6 = `.${DATA_KEY$6}`; 1711 const DATA_API_KEY$3 = '.data-api'; 1712 const ESCAPE_KEY$2 = 'Escape'; 1713 const TAB_KEY$1 = 'Tab'; 1714 const ARROW_UP_KEY$1 = 'ArrowUp'; 1715 const ARROW_DOWN_KEY$1 = 'ArrowDown'; 1716 const RIGHT_MOUSE_BUTTON = 2; // MouseEvent.button value for the secondary button, usually the right button 1717 1718 const EVENT_HIDE$5 = `hide${EVENT_KEY$6}`; 1719 const EVENT_HIDDEN$5 = `hidden${EVENT_KEY$6}`; 1720 const EVENT_SHOW$5 = `show${EVENT_KEY$6}`; 1721 const EVENT_SHOWN$5 = `shown${EVENT_KEY$6}`; 1722 const EVENT_CLICK_DATA_API$3 = `click${EVENT_KEY$6}${DATA_API_KEY$3}`; 1723 const EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY$6}${DATA_API_KEY$3}`; 1724 const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY$6}${DATA_API_KEY$3}`; 1725 const CLASS_NAME_SHOW$6 = 'show'; 1726 const CLASS_NAME_DROPUP = 'dropup'; 1727 const CLASS_NAME_DROPEND = 'dropend'; 1728 const CLASS_NAME_DROPSTART = 'dropstart'; 1729 const CLASS_NAME_DROPUP_CENTER = 'dropup-center'; 1730 const CLASS_NAME_DROPDOWN_CENTER = 'dropdown-center'; 1731 const SELECTOR_DATA_TOGGLE$3 = '[data-bs-toggle="dropdown"]:not(.disabled):not(:disabled)'; 1732 const SELECTOR_DATA_TOGGLE_SHOWN = `${SELECTOR_DATA_TOGGLE$3}.${CLASS_NAME_SHOW$6}`; 1733 const SELECTOR_MENU = '.dropdown-menu'; 1734 const SELECTOR_NAVBAR = '.navbar'; 1735 const SELECTOR_NAVBAR_NAV = '.navbar-nav'; 1736 const SELECTOR_VISIBLE_ITEMS = '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'; 1737 const PLACEMENT_TOP = isRTL() ? 'top-end' : 'top-start'; 1738 const PLACEMENT_TOPEND = isRTL() ? 'top-start' : 'top-end'; 1739 const PLACEMENT_BOTTOM = isRTL() ? 'bottom-end' : 'bottom-start'; 1740 const PLACEMENT_BOTTOMEND = isRTL() ? 'bottom-start' : 'bottom-end'; 1741 const PLACEMENT_RIGHT = isRTL() ? 'left-start' : 'right-start'; 1742 const PLACEMENT_LEFT = isRTL() ? 'right-start' : 'left-start'; 1743 const PLACEMENT_TOPCENTER = 'top'; 1744 const PLACEMENT_BOTTOMCENTER = 'bottom'; 1745 const Default$9 = { 1746 autoClose: true, 1747 boundary: 'clippingParents', 1748 display: 'dynamic', 1749 offset: [0, 2], 1750 popperConfig: null, 1751 reference: 'toggle' 1752 }; 1753 const DefaultType$9 = { 1754 autoClose: '(boolean|string)', 1755 boundary: '(string|element)', 1756 display: 'string', 1757 offset: '(array|string|function)', 1758 popperConfig: '(null|object|function)', 1759 reference: '(string|element|object)' 1760 }; 1761 1762 /** 1763 * Class definition 1764 */ 1765 1766 class Dropdown extends BaseComponent { 1767 constructor(element, config) { 1768 super(element, config); 1769 this._popper = null; 1770 this._parent = this._element.parentNode; // dropdown wrapper 1771 // TODO: v6 revert #37011 & change markup https://getbootstrap.com/docs/5.3/forms/input-group/ 1772 this._menu = SelectorEngine.next(this._element, SELECTOR_MENU)[0] || SelectorEngine.prev(this._element, SELECTOR_MENU)[0] || SelectorEngine.findOne(SELECTOR_MENU, this._parent); 1773 this._inNavbar = this._detectNavbar(); 1774 } 1775 1776 // Getters 1777 static get Default() { 1778 return Default$9; 1779 } 1780 static get DefaultType() { 1781 return DefaultType$9; 1782 } 1783 static get NAME() { 1784 return NAME$a; 1785 } 1786 1787 // Public 1788 toggle() { 1789 return this._isShown() ? this.hide() : this.show(); 1790 } 1791 show() { 1792 if (isDisabled(this._element) || this._isShown()) { 1793 return; 1794 } 1795 const relatedTarget = { 1796 relatedTarget: this._element 1797 }; 1798 const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$5, relatedTarget); 1799 if (showEvent.defaultPrevented) { 1800 return; 1801 } 1802 this._createPopper(); 1803 1804 // If this is a touch-enabled device we add extra 1805 // empty mouseover listeners to the body's immediate children; 1806 // only needed because of broken event delegation on iOS 1807 // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html 1808 if ('ontouchstart' in document.documentElement && !this._parent.closest(SELECTOR_NAVBAR_NAV)) { 1809 for (const element of [].concat(...document.body.children)) { 1810 EventHandler.on(element, 'mouseover', noop); 1811 } 1812 } 1813 this._element.focus(); 1814 this._element.setAttribute('aria-expanded', true); 1815 this._menu.classList.add(CLASS_NAME_SHOW$6); 1816 this._element.classList.add(CLASS_NAME_SHOW$6); 1817 EventHandler.trigger(this._element, EVENT_SHOWN$5, relatedTarget); 1818 } 1819 hide() { 1820 if (isDisabled(this._element) || !this._isShown()) { 1821 return; 1822 } 1823 const relatedTarget = { 1824 relatedTarget: this._element 1825 }; 1826 this._completeHide(relatedTarget); 1827 } 1828 dispose() { 1829 if (this._popper) { 1830 this._popper.destroy(); 1831 } 1832 super.dispose(); 1833 } 1834 update() { 1835 this._inNavbar = this._detectNavbar(); 1836 if (this._popper) {
vendor: 4,305 bytes, lines 1837-1932
1837 this._popper.update(); 1838 } 1839 } 1840 1841 // Private 1842 _completeHide(relatedTarget) { 1843 const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$5, relatedTarget); 1844 if (hideEvent.defaultPrevented) { 1845 return; 1846 } 1847 1848 // If this is a touch-enabled device we remove the extra 1849 // empty mouseover listeners we added for iOS support 1850 if ('ontouchstart' in document.documentElement) { 1851 for (const element of [].concat(...document.body.children)) { 1852 EventHandler.off(element, 'mouseover', noop); 1853 } 1854 } 1855 if (this._popper) { 1856 this._popper.destroy(); 1857 } 1858 this._menu.classList.remove(CLASS_NAME_SHOW$6); 1859 this._element.classList.remove(CLASS_NAME_SHOW$6); 1860 this._element.setAttribute('aria-expanded', 'false'); 1861 Manipulator.removeDataAttribute(this._menu, 'popper'); 1862 EventHandler.trigger(this._element, EVENT_HIDDEN$5, relatedTarget); 1863 } 1864 _getConfig(config) { 1865 config = super._getConfig(config); 1866 if (typeof config.reference === 'object' && !isElement(config.reference) && typeof config.reference.getBoundingClientRect !== 'function') { 1867 // Popper virtual elements require a getBoundingClientRect method 1868 throw new TypeError(`${NAME$a.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`); 1869 } 1870 return config; 1871 } 1872 _createPopper() { 1873 if (typeof Popper__namespace === 'undefined') { 1874 throw new TypeError('Bootstrap\'s dropdowns require Popper (https://popper.js.org)'); 1875 } 1876 let referenceElement = this._element; 1877 if (this._config.reference === 'parent') { 1878 referenceElement = this._parent; 1879 } else if (isElement(this._config.reference)) { 1880 referenceElement = getElement(this._config.reference); 1881 } else if (typeof this._config.reference === 'object') { 1882 referenceElement = this._config.reference; 1883 } 1884 const popperConfig = this._getPopperConfig(); 1885 this._popper = Popper__namespace.createPopper(referenceElement, this._menu, popperConfig); 1886 } 1887 _isShown() { 1888 return this._menu.classList.contains(CLASS_NAME_SHOW$6); 1889 } 1890 _getPlacement() { 1891 const parentDropdown = this._parent; 1892 if (parentDropdown.classList.contains(CLASS_NAME_DROPEND)) { 1893 return PLACEMENT_RIGHT; 1894 } 1895 if (parentDropdown.classList.contains(CLASS_NAME_DROPSTART)) { 1896 return PLACEMENT_LEFT; 1897 } 1898 if (parentDropdown.classList.contains(CLASS_NAME_DROPUP_CENTER)) { 1899 return PLACEMENT_TOPCENTER; 1900 } 1901 if (parentDropdown.classList.contains(CLASS_NAME_DROPDOWN_CENTER)) { 1902 return PLACEMENT_BOTTOMCENTER; 1903 } 1904 1905 // We need to trim the value because custom properties can also include spaces 1906 const isEnd = getComputedStyle(this._menu).getPropertyValue('--bs-position').trim() === 'end'; 1907 if (parentDropdown.classList.contains(CLASS_NAME_DROPUP)) { 1908 return isEnd ? PLACEMENT_TOPEND : PLACEMENT_TOP; 1909 } 1910 return isEnd ? PLACEMENT_BOTTOMEND : PLACEMENT_BOTTOM; 1911 } 1912 _detectNavbar() { 1913 return this._element.closest(SELECTOR_NAVBAR) !== null; 1914 } 1915 _getOffset() { 1916 const { 1917 offset 1918 } = this._config; 1919 if (typeof offset === 'string') { 1920 return offset.split(',').map(value => Number.parseInt(value, 10)); 1921 } 1922 if (typeof offset === 'function') { 1923 return popperData => offset(popperData, this._element); 1924 } 1925 return offset; 1926 } 1927 _getPopperConfig() { 1928 const defaultBsPopperConfig = { 1929 placement: this._getPlacement(), 1930 modifiers: [{ 1931 name: 'preventOverflow', 1932 options: {
vendor: 3,653 bytes, lines 1933-2015
1933 boundary: this._config.boundary 1934 } 1935 }, { 1936 name: 'offset', 1937 options: { 1938 offset: this._getOffset() 1939 } 1940 }] 1941 }; 1942 1943 // Disable Popper if we have a static display or Dropdown is in Navbar 1944 if (this._inNavbar || this._config.display === 'static') { 1945 Manipulator.setDataAttribute(this._menu, 'popper', 'static'); // TODO: v6 remove 1946 defaultBsPopperConfig.modifiers = [{ 1947 name: 'applyStyles', 1948 enabled: false 1949 }]; 1950 } 1951 return { 1952 ...defaultBsPopperConfig, 1953 ...execute(this._config.popperConfig, [defaultBsPopperConfig]) 1954 }; 1955 } 1956 _selectMenuItem({ 1957 key, 1958 target 1959 }) { 1960 const items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, this._menu).filter(element => isVisible(element)); 1961 if (!items.length) { 1962 return; 1963 } 1964 1965 // if target isn't included in items (e.g. when expanding the dropdown) 1966 // allow cycling to get the last item in case key equals ARROW_UP_KEY 1967 getNextActiveElement(items, target, key === ARROW_DOWN_KEY$1, !items.includes(target)).focus(); 1968 } 1969 1970 // Static 1971 static jQueryInterface(config) { 1972 return this.each(function () { 1973 const data = Dropdown.getOrCreateInstance(this, config); 1974 if (typeof config !== 'string') { 1975 return; 1976 } 1977 if (typeof data[config] === 'undefined') { 1978 throw new TypeError(`No method named "${config}"`); 1979 } 1980 data[config](); 1981 }); 1982 } 1983 static clearMenus(event) { 1984 if (event.button === RIGHT_MOUSE_BUTTON || event.type === 'keyup' && event.key !== TAB_KEY$1) { 1985 return; 1986 } 1987 const openToggles = SelectorEngine.find(SELECTOR_DATA_TOGGLE_SHOWN); 1988 for (const toggle of openToggles) { 1989 const context = Dropdown.getInstance(toggle); 1990 if (!context || context._config.autoClose === false) { 1991 continue; 1992 } 1993 const composedPath = event.composedPath(); 1994 const isMenuTarget = composedPath.includes(context._menu); 1995 if (composedPath.includes(context._element) || context._config.autoClose === 'inside' && !isMenuTarget || context._config.autoClose === 'outside' && isMenuTarget) { 1996 continue; 1997 } 1998 1999 // Tab navigation through the dropdown menu or events from contained inputs shouldn't close the menu 2000 if (context._menu.contains(event.target) && (event.type === 'keyup' && event.key === TAB_KEY$1 || /input|select|option|textarea|form/i.test(event.target.tagName))) { 2001 continue; 2002 } 2003 const relatedTarget = { 2004 relatedTarget: context._element 2005 }; 2006 if (event.type === 'click') { 2007 relatedTarget.clickEvent = event; 2008 } 2009 context._completeHide(relatedTarget); 2010 } 2011 } 2012 static dataApiKeydownHandler(event) { 2013 // If not an UP | DOWN | ESCAPE key => not a dropdown command 2014 // If input/textarea && if key is other than ESCAPE => not a dropdown command 2015
vendor: 36,199 bytes, lines 2016-3008
2016 const isInput = /input|textarea/i.test(event.target.tagName); 2017 const isEscapeEvent = event.key === ESCAPE_KEY$2; 2018 const isUpOrDownEvent = [ARROW_UP_KEY$1, ARROW_DOWN_KEY$1].includes(event.key); 2019 if (!isUpOrDownEvent && !isEscapeEvent) { 2020 return; 2021 } 2022 if (isInput && !isEscapeEvent) { 2023 return; 2024 } 2025 event.preventDefault(); 2026 2027 // TODO: v6 revert #37011 & change markup https://getbootstrap.com/docs/5.3/forms/input-group/ 2028 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); 2029 const instance = Dropdown.getOrCreateInstance(getToggleButton); 2030 if (isUpOrDownEvent) { 2031 event.stopPropagation(); 2032 instance.show(); 2033 instance._selectMenuItem(event); 2034 return; 2035 } 2036 if (instance._isShown()) { 2037 // else is escape and we check if it is shown 2038 event.stopPropagation(); 2039 instance.hide(); 2040 getToggleButton.focus(); 2041 } 2042 } 2043 } 2044 2045 /** 2046 * Data API implementation 2047 */ 2048 2049 EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_DATA_TOGGLE$3, Dropdown.dataApiKeydownHandler); 2050 EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_MENU, Dropdown.dataApiKeydownHandler); 2051 EventHandler.on(document, EVENT_CLICK_DATA_API$3, Dropdown.clearMenus); 2052 EventHandler.on(document, EVENT_KEYUP_DATA_API, Dropdown.clearMenus); 2053 EventHandler.on(document, EVENT_CLICK_DATA_API$3, SELECTOR_DATA_TOGGLE$3, function (event) { 2054 event.preventDefault(); 2055 Dropdown.getOrCreateInstance(this).toggle(); 2056 }); 2057 2058 /** 2059 * jQuery 2060 */ 2061 2062 defineJQueryPlugin(Dropdown); 2063 2064 /** 2065 * -------------------------------------------------------------------------- 2066 * Bootstrap util/backdrop.js 2067 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 2068 * -------------------------------------------------------------------------- 2069 */ 2070 2071 /** 2072 * Constants 2073 */ 2074 2075 const NAME$9 = 'backdrop'; 2076 const CLASS_NAME_FADE$4 = 'fade'; 2077 const CLASS_NAME_SHOW$5 = 'show'; 2078 const EVENT_MOUSEDOWN = `mousedown.bs.${NAME$9}`; 2079 const Default$8 = { 2080 className: 'modal-backdrop', 2081 clickCallback: null, 2082 isAnimated: false, 2083 isVisible: true, 2084 // if false, we use the backdrop helper without adding any element to the dom 2085 rootElement: 'body' // give the choice to place backdrop under different elements 2086 }; 2087 2088 const DefaultType$8 = { 2089 className: 'string', 2090 clickCallback: '(function|null)', 2091 isAnimated: 'boolean', 2092 isVisible: 'boolean', 2093 rootElement: '(element|string)' 2094 }; 2095 2096 /** 2097 * Class definition 2098 */ 2099 2100 class Backdrop extends Config { 2101 constructor(config) { 2102 super(); 2103 this._config = this._getConfig(config); 2104 this._isAppended = false; 2105 this._element = null; 2106 } 2107 2108 // Getters 2109 static get Default() { 2110 return Default$8; 2111 } 2112 static get DefaultType() { 2113 return DefaultType$8; 2114 } 2115 static get NAME() { 2116 return NAME$9; 2117 } 2118 2119 // Public 2120 show(callback) { 2121 if (!this._config.isVisible) { 2122 execute(callback); 2123 return; 2124 } 2125 this._append(); 2126 const element = this._getElement(); 2127 if (this._config.isAnimated) { 2128 reflow(element); 2129 } 2130 element.classList.add(CLASS_NAME_SHOW$5); 2131 this._emulateAnimation(() => { 2132 execute(callback); 2133 }); 2134 } 2135 hide(callback) { 2136 if (!this._config.isVisible) { 2137 execute(callback); 2138 return; 2139 } 2140 this._getElement().classList.remove(CLASS_NAME_SHOW$5); 2141 this._emulateAnimation(() => { 2142 this.dispose(); 2143 execute(callback); 2144 }); 2145 } 2146 dispose() { 2147 if (!this._isAppended) { 2148 return; 2149 } 2150 EventHandler.off(this._element, EVENT_MOUSEDOWN); 2151 this._element.remove(); 2152 this._isAppended = false; 2153 } 2154 2155 // Private 2156 _getElement() { 2157 if (!this._element) { 2158 const backdrop = document.createElement('div'); 2159 backdrop.className = this._config.className; 2160 if (this._config.isAnimated) { 2161 backdrop.classList.add(CLASS_NAME_FADE$4); 2162 } 2163 this._element = backdrop; 2164 } 2165 return this._element; 2166 } 2167 _configAfterMerge(config) { 2168 // use getElement() with the default "body" to get a fresh Element on each instantiation 2169 config.rootElement = getElement(config.rootElement); 2170 return config; 2171 } 2172 _append() { 2173 if (this._isAppended) { 2174 return; 2175 } 2176 const element = this._getElement(); 2177 this._config.rootElement.append(element); 2178 EventHandler.on(element, EVENT_MOUSEDOWN, () => { 2179 execute(this._config.clickCallback); 2180 }); 2181 this._isAppended = true; 2182 } 2183 _emulateAnimation(callback) { 2184 executeAfterTransition(callback, this._getElement(), this._config.isAnimated); 2185 } 2186 } 2187 2188 /** 2189 * -------------------------------------------------------------------------- 2190 * Bootstrap util/focustrap.js 2191 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 2192 * -------------------------------------------------------------------------- 2193 */ 2194 2195 /** 2196 * Constants 2197 */ 2198 2199 const NAME$8 = 'focustrap'; 2200 const DATA_KEY$5 = 'bs.focustrap'; 2201 const EVENT_KEY$5 = `.${DATA_KEY$5}`; 2202 const EVENT_FOCUSIN$2 = `focusin${EVENT_KEY$5}`; 2203 const EVENT_KEYDOWN_TAB = `keydown.tab${EVENT_KEY$5}`; 2204 const TAB_KEY = 'Tab'; 2205 const TAB_NAV_FORWARD = 'forward'; 2206 const TAB_NAV_BACKWARD = 'backward'; 2207 const Default$7 = { 2208 autofocus: true, 2209 trapElement: null // The element to trap focus inside of 2210 }; 2211 2212 const DefaultType$7 = { 2213 autofocus: 'boolean', 2214 trapElement: 'element' 2215 }; 2216 2217 /** 2218 * Class definition 2219 */ 2220 2221 class FocusTrap extends Config { 2222 constructor(config) { 2223 super(); 2224 this._config = this._getConfig(config); 2225 this._isActive = false; 2226 this._lastTabNavDirection = null; 2227 } 2228 2229 // Getters 2230 static get Default() { 2231 return Default$7; 2232 } 2233 static get DefaultType() { 2234 return DefaultType$7; 2235 } 2236 static get NAME() { 2237 return NAME$8; 2238 } 2239 2240 // Public 2241 activate() { 2242 if (this._isActive) { 2243 return; 2244 } 2245 if (this._config.autofocus) { 2246 this._config.trapElement.focus(); 2247 } 2248 EventHandler.off(document, EVENT_KEY$5); // guard against infinite focus loop 2249 EventHandler.on(document, EVENT_FOCUSIN$2, event => this._handleFocusin(event)); 2250 EventHandler.on(document, EVENT_KEYDOWN_TAB, event => this._handleKeydown(event)); 2251 this._isActive = true; 2252 } 2253 deactivate() { 2254 if (!this._isActive) { 2255 return; 2256 } 2257 this._isActive = false; 2258 EventHandler.off(document, EVENT_KEY$5); 2259 } 2260 2261 // Private 2262 _handleFocusin(event) { 2263 const { 2264 trapElement 2265 } = this._config; 2266 if (event.target === document || event.target === trapElement || trapElement.contains(event.target)) { 2267 return; 2268 } 2269 const elements = SelectorEngine.focusableChildren(trapElement); 2270 if (elements.length === 0) { 2271 trapElement.focus(); 2272 } else if (this._lastTabNavDirection === TAB_NAV_BACKWARD) { 2273 elements[elements.length - 1].focus(); 2274 } else { 2275 elements[0].focus(); 2276 } 2277 } 2278 _handleKeydown(event) { 2279 if (event.key !== TAB_KEY) { 2280 return; 2281 } 2282 this._lastTabNavDirection = event.shiftKey ? TAB_NAV_BACKWARD : TAB_NAV_FORWARD; 2283 } 2284 } 2285 2286 /** 2287 * -------------------------------------------------------------------------- 2288 * Bootstrap util/scrollBar.js 2289 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 2290 * -------------------------------------------------------------------------- 2291 */ 2292 2293 /** 2294 * Constants 2295 */ 2296 2297 const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top'; 2298 const SELECTOR_STICKY_CONTENT = '.sticky-top'; 2299 const PROPERTY_PADDING = 'padding-right'; 2300 const PROPERTY_MARGIN = 'margin-right'; 2301 2302 /** 2303 * Class definition 2304 */ 2305 2306 class ScrollBarHelper { 2307 constructor() { 2308 this._element = document.body; 2309 } 2310 2311 // Public 2312 getWidth() { 2313 // https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes 2314 const documentWidth = document.documentElement.clientWidth; 2315 return Math.abs(window.innerWidth - documentWidth); 2316 } 2317 hide() { 2318 const width = this.getWidth(); 2319 this._disableOverFlow(); 2320 // give padding to element to balance the hidden scrollbar width 2321 this._setElementAttributes(this._element, PROPERTY_PADDING, calculatedValue => calculatedValue + width); 2322 // trick: We adjust positive paddingRight and negative marginRight to sticky-top elements to keep showing fullwidth 2323 this._setElementAttributes(SELECTOR_FIXED_CONTENT, PROPERTY_PADDING, calculatedValue => calculatedValue + width); 2324 this._setElementAttributes(SELECTOR_STICKY_CONTENT, PROPERTY_MARGIN, calculatedValue => calculatedValue - width); 2325 } 2326 reset() { 2327 this._resetElementAttributes(this._element, 'overflow'); 2328 this._resetElementAttributes(this._element, PROPERTY_PADDING); 2329 this._resetElementAttributes(SELECTOR_FIXED_CONTENT, PROPERTY_PADDING); 2330 this._resetElementAttributes(SELECTOR_STICKY_CONTENT, PROPERTY_MARGIN); 2331 } 2332 isOverflowing() { 2333 return this.getWidth() > 0; 2334 } 2335 2336 // Private 2337 _disableOverFlow() { 2338 this._saveInitialAttribute(this._element, 'overflow'); 2339 this._element.style.overflow = 'hidden'; 2340 } 2341 _setElementAttributes(selector, styleProperty, callback) { 2342 const scrollbarWidth = this.getWidth(); 2343 const manipulationCallBack = element => { 2344 if (element !== this._element && window.innerWidth > element.clientWidth + scrollbarWidth) { 2345 return; 2346 } 2347 this._saveInitialAttribute(element, styleProperty); 2348 const calculatedValue = window.getComputedStyle(element).getPropertyValue(styleProperty); 2349 element.style.setProperty(styleProperty, `${callback(Number.parseFloat(calculatedValue))}px`); 2350 }; 2351 this._applyManipulationCallback(selector, manipulationCallBack); 2352 } 2353 _saveInitialAttribute(element, styleProperty) { 2354 const actualValue = element.style.getPropertyValue(styleProperty); 2355 if (actualValue) { 2356 Manipulator.setDataAttribute(element, styleProperty, actualValue); 2357 } 2358 } 2359 _resetElementAttributes(selector, styleProperty) { 2360 const manipulationCallBack = element => { 2361 const value = Manipulator.getDataAttribute(element, styleProperty); 2362 // We only want to remove the property if the value is `null`; the value can also be zero 2363 if (value === null) { 2364 element.style.removeProperty(styleProperty); 2365 return; 2366 } 2367 Manipulator.removeDataAttribute(element, styleProperty); 2368 element.style.setProperty(styleProperty, value); 2369 }; 2370 this._applyManipulationCallback(selector, manipulationCallBack); 2371 } 2372 _applyManipulationCallback(selector, callBack) { 2373 if (isElement(selector)) { 2374 callBack(selector); 2375 return; 2376 } 2377 for (const sel of SelectorEngine.find(selector, this._element)) { 2378 callBack(sel); 2379 } 2380 } 2381 } 2382 2383 /** 2384 * -------------------------------------------------------------------------- 2385 * Bootstrap modal.js 2386 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 2387 * -------------------------------------------------------------------------- 2388 */ 2389 2390 /** 2391 * Constants 2392 */ 2393 2394 const NAME$7 = 'modal'; 2395 const DATA_KEY$4 = 'bs.modal'; 2396 const EVENT_KEY$4 = `.${DATA_KEY$4}`; 2397 const DATA_API_KEY$2 = '.data-api'; 2398 const ESCAPE_KEY$1 = 'Escape'; 2399 const EVENT_HIDE$4 = `hide${EVENT_KEY$4}`; 2400 const EVENT_HIDE_PREVENTED$1 = `hidePrevented${EVENT_KEY$4}`; 2401 const EVENT_HIDDEN$4 = `hidden${EVENT_KEY$4}`; 2402 const EVENT_SHOW$4 = `show${EVENT_KEY$4}`; 2403 const EVENT_SHOWN$4 = `shown${EVENT_KEY$4}`; 2404 const EVENT_RESIZE$1 = `resize${EVENT_KEY$4}`; 2405 const EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY$4}`; 2406 const EVENT_MOUSEDOWN_DISMISS = `mousedown.dismiss${EVENT_KEY$4}`; 2407 const EVENT_KEYDOWN_DISMISS$1 = `keydown.dismiss${EVENT_KEY$4}`; 2408 const EVENT_CLICK_DATA_API$2 = `click${EVENT_KEY$4}${DATA_API_KEY$2}`; 2409 const CLASS_NAME_OPEN = 'modal-open'; 2410 const CLASS_NAME_FADE$3 = 'fade'; 2411 const CLASS_NAME_SHOW$4 = 'show'; 2412 const CLASS_NAME_STATIC = 'modal-static'; 2413 const OPEN_SELECTOR$1 = '.modal.show'; 2414 const SELECTOR_DIALOG = '.modal-dialog'; 2415 const SELECTOR_MODAL_BODY = '.modal-body'; 2416 const SELECTOR_DATA_TOGGLE$2 = '[data-bs-toggle="modal"]'; 2417 const Default$6 = { 2418 backdrop: true, 2419 focus: true, 2420 keyboard: true 2421 }; 2422 const DefaultType$6 = { 2423 backdrop: '(boolean|string)', 2424 focus: 'boolean', 2425 keyboard: 'boolean' 2426 }; 2427 2428 /** 2429 * Class definition 2430 */ 2431 2432 class Modal extends BaseComponent { 2433 constructor(element, config) { 2434 super(element, config); 2435 this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, this._element); 2436 this._backdrop = this._initializeBackDrop(); 2437 this._focustrap = this._initializeFocusTrap(); 2438 this._isShown = false; 2439 this._isTransitioning = false; 2440 this._scrollBar = new ScrollBarHelper(); 2441 this._addEventListeners(); 2442 } 2443 2444 // Getters 2445 static get Default() { 2446 return Default$6; 2447 } 2448 static get DefaultType() { 2449 return DefaultType$6; 2450 } 2451 static get NAME() { 2452 return NAME$7; 2453 } 2454 2455 // Public 2456 toggle(relatedTarget) { 2457 return this._isShown ? this.hide() : this.show(relatedTarget); 2458 } 2459 show(relatedTarget) { 2460 if (this._isShown || this._isTransitioning) { 2461 return; 2462 } 2463 const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$4, { 2464 relatedTarget 2465 }); 2466 if (showEvent.defaultPrevented) { 2467 return; 2468 } 2469 this._isShown = true; 2470 this._isTransitioning = true; 2471 this._scrollBar.hide(); 2472 document.body.classList.add(CLASS_NAME_OPEN); 2473 this._adjustDialog(); 2474 this._backdrop.show(() => this._showElement(relatedTarget)); 2475 } 2476 hide() { 2477 if (!this._isShown || this._isTransitioning) { 2478 return; 2479 } 2480 const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$4); 2481 if (hideEvent.defaultPrevented) { 2482 return; 2483 } 2484 this._isShown = false; 2485 this._isTransitioning = true; 2486 this._focustrap.deactivate(); 2487 this._element.classList.remove(CLASS_NAME_SHOW$4); 2488 this._queueCallback(() => this._hideModal(), this._element, this._isAnimated()); 2489 } 2490 dispose() { 2491 EventHandler.off(window, EVENT_KEY$4); 2492 EventHandler.off(this._dialog, EVENT_KEY$4); 2493 this._backdrop.dispose(); 2494 this._focustrap.deactivate(); 2495 super.dispose(); 2496 } 2497 handleUpdate() { 2498 this._adjustDialog(); 2499 } 2500 2501 // Private 2502 _initializeBackDrop() { 2503 return new Backdrop({ 2504 isVisible: Boolean(this._config.backdrop), 2505 // 'static' option will be translated to true, and booleans will keep their value, 2506 isAnimated: this._isAnimated() 2507 }); 2508 } 2509 _initializeFocusTrap() { 2510 return new FocusTrap({ 2511 trapElement: this._element 2512 }); 2513 } 2514 _showElement(relatedTarget) { 2515 // try to append dynamic modal 2516 if (!document.body.contains(this._element)) { 2517 document.body.append(this._element); 2518 } 2519 this._element.style.display = 'block'; 2520 this._element.removeAttribute('aria-hidden'); 2521 this._element.setAttribute('aria-modal', true); 2522 this._element.setAttribute('role', 'dialog'); 2523 this._element.scrollTop = 0; 2524 const modalBody = SelectorEngine.findOne(SELECTOR_MODAL_BODY, this._dialog); 2525 if (modalBody) { 2526 modalBody.scrollTop = 0; 2527 } 2528 reflow(this._element); 2529 this._element.classList.add(CLASS_NAME_SHOW$4); 2530 const transitionComplete = () => { 2531 if (this._config.focus) { 2532 this._focustrap.activate(); 2533 } 2534 this._isTransitioning = false; 2535 EventHandler.trigger(this._element, EVENT_SHOWN$4, { 2536 relatedTarget 2537 }); 2538 }; 2539 this._queueCallback(transitionComplete, this._dialog, this._isAnimated()); 2540 } 2541 _addEventListeners() { 2542 EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS$1, event => { 2543 if (event.key !== ESCAPE_KEY$1) { 2544 return; 2545 } 2546 if (this._config.keyboard) { 2547 this.hide(); 2548 return; 2549 } 2550 this._triggerBackdropTransition(); 2551 }); 2552 EventHandler.on(window, EVENT_RESIZE$1, () => { 2553 if (this._isShown && !this._isTransitioning) { 2554 this._adjustDialog(); 2555 } 2556 }); 2557 EventHandler.on(this._element, EVENT_MOUSEDOWN_DISMISS, event => { 2558 // a bad trick to segregate clicks that may start inside dialog but end outside, and avoid listen to scrollbar clicks 2559 EventHandler.one(this._element, EVENT_CLICK_DISMISS, event2 => { 2560 if (this._element !== event.target || this._element !== event2.target) { 2561 return; 2562 } 2563 if (this._config.backdrop === 'static') { 2564 this._triggerBackdropTransition(); 2565 return; 2566 } 2567 if (this._config.backdrop) { 2568 this.hide(); 2569 } 2570 }); 2571 }); 2572 } 2573 _hideModal() { 2574 this._element.style.display = 'none'; 2575 this._element.setAttribute('aria-hidden', true); 2576 this._element.removeAttribute('aria-modal'); 2577 this._element.removeAttribute('role'); 2578 this._isTransitioning = false; 2579 this._backdrop.hide(() => { 2580 document.body.classList.remove(CLASS_NAME_OPEN); 2581 this._resetAdjustments(); 2582 this._scrollBar.reset(); 2583 EventHandler.trigger(this._element, EVENT_HIDDEN$4); 2584 }); 2585 } 2586 _isAnimated() { 2587 return this._element.classList.contains(CLASS_NAME_FADE$3); 2588 } 2589 _triggerBackdropTransition() { 2590 const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED$1); 2591 if (hideEvent.defaultPrevented) { 2592 return; 2593 } 2594 const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight; 2595 const initialOverflowY = this._element.style.overflowY; 2596 // return if the following background transition hasn't yet completed 2597 if (initialOverflowY === 'hidden' || this._element.classList.contains(CLASS_NAME_STATIC)) { 2598 return; 2599 } 2600 if (!isModalOverflowing) { 2601 this._element.style.overflowY = 'hidden'; 2602 } 2603 this._element.classList.add(CLASS_NAME_STATIC); 2604 this._queueCallback(() => { 2605 this._element.classList.remove(CLASS_NAME_STATIC); 2606 this._queueCallback(() => { 2607 this._element.style.overflowY = initialOverflowY; 2608 }, this._dialog); 2609 }, this._dialog); 2610 this._element.focus(); 2611 } 2612 2613 /** 2614 * The following methods are used to handle overflowing modals 2615 */ 2616 2617 _adjustDialog() { 2618 const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight; 2619 const scrollbarWidth = this._scrollBar.getWidth(); 2620 const isBodyOverflowing = scrollbarWidth > 0; 2621 if (isBodyOverflowing && !isModalOverflowing) { 2622 const property = isRTL() ? 'paddingLeft' : 'paddingRight'; 2623 this._element.style[property] = `${scrollbarWidth}px`; 2624 } 2625 if (!isBodyOverflowing && isModalOverflowing) { 2626 const property = isRTL() ? 'paddingRight' : 'paddingLeft'; 2627 this._element.style[property] = `${scrollbarWidth}px`; 2628 } 2629 } 2630 _resetAdjustments() { 2631 this._element.style.paddingLeft = ''; 2632 this._element.style.paddingRight = ''; 2633 } 2634 2635 // Static 2636 static jQueryInterface(config, relatedTarget) { 2637 return this.each(function () { 2638 const data = Modal.getOrCreateInstance(this, config); 2639 if (typeof config !== 'string') { 2640 return; 2641 } 2642 if (typeof data[config] === 'undefined') { 2643 throw new TypeError(`No method named "${config}"`); 2644 } 2645 data[config](relatedTarget); 2646 }); 2647 } 2648 } 2649 2650 /** 2651 * Data API implementation 2652 */ 2653 2654 EventHandler.on(document, EVENT_CLICK_DATA_API$2, SELECTOR_DATA_TOGGLE$2, function (event) { 2655 const target = SelectorEngine.getElementFromSelector(this); 2656 if (['A', 'AREA'].includes(this.tagName)) { 2657 event.preventDefault(); 2658 } 2659 EventHandler.one(target, EVENT_SHOW$4, showEvent => { 2660 if (showEvent.defaultPrevented) { 2661 // only register focus restorer if modal will actually get shown 2662 return; 2663 } 2664 EventHandler.one(target, EVENT_HIDDEN$4, () => { 2665 if (isVisible(this)) { 2666 this.focus(); 2667 } 2668 }); 2669 }); 2670 2671 // avoid conflict when clicking modal toggler while another one is open 2672 const alreadyOpen = SelectorEngine.findOne(OPEN_SELECTOR$1); 2673 if (alreadyOpen) { 2674 Modal.getInstance(alreadyOpen).hide(); 2675 } 2676 const data = Modal.getOrCreateInstance(target); 2677 data.toggle(this); 2678 }); 2679 enableDismissTrigger(Modal); 2680 2681 /** 2682 * jQuery 2683 */ 2684 2685 defineJQueryPlugin(Modal); 2686 2687 /** 2688 * -------------------------------------------------------------------------- 2689 * Bootstrap offcanvas.js 2690 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 2691 * -------------------------------------------------------------------------- 2692 */ 2693 2694 /** 2695 * Constants 2696 */ 2697 2698 const NAME$6 = 'offcanvas'; 2699 const DATA_KEY$3 = 'bs.offcanvas'; 2700 const EVENT_KEY$3 = `.${DATA_KEY$3}`; 2701 const DATA_API_KEY$1 = '.data-api'; 2702 const EVENT_LOAD_DATA_API$2 = `load${EVENT_KEY$3}${DATA_API_KEY$1}`; 2703 const ESCAPE_KEY = 'Escape'; 2704 const CLASS_NAME_SHOW$3 = 'show'; 2705 const CLASS_NAME_SHOWING$1 = 'showing'; 2706 const CLASS_NAME_HIDING = 'hiding'; 2707 const CLASS_NAME_BACKDROP = 'offcanvas-backdrop'; 2708 const OPEN_SELECTOR = '.offcanvas.show'; 2709 const EVENT_SHOW$3 = `show${EVENT_KEY$3}`; 2710 const EVENT_SHOWN$3 = `shown${EVENT_KEY$3}`; 2711 const EVENT_HIDE$3 = `hide${EVENT_KEY$3}`; 2712 const EVENT_HIDE_PREVENTED = `hidePrevented${EVENT_KEY$3}`; 2713 const EVENT_HIDDEN$3 = `hidden${EVENT_KEY$3}`; 2714 const EVENT_RESIZE = `resize${EVENT_KEY$3}`; 2715 const EVENT_CLICK_DATA_API$1 = `click${EVENT_KEY$3}${DATA_API_KEY$1}`; 2716 const EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY$3}`; 2717 const SELECTOR_DATA_TOGGLE$1 = '[data-bs-toggle="offcanvas"]'; 2718 const Default$5 = { 2719 backdrop: true, 2720 keyboard: true, 2721 scroll: false 2722 }; 2723 const DefaultType$5 = { 2724 backdrop: '(boolean|string)', 2725 keyboard: 'boolean', 2726 scroll: 'boolean' 2727 }; 2728 2729 /** 2730 * Class definition 2731 */ 2732 2733 class Offcanvas extends BaseComponent { 2734 constructor(element, config) { 2735 super(element, config); 2736 this._isShown = false; 2737 this._backdrop = this._initializeBackDrop(); 2738 this._focustrap = this._initializeFocusTrap(); 2739 this._addEventListeners(); 2740 } 2741 2742 // Getters 2743 static get Default() { 2744 return Default$5; 2745 } 2746 static get DefaultType() { 2747 return DefaultType$5; 2748 } 2749 static get NAME() { 2750 return NAME$6; 2751 } 2752 2753 // Public 2754 toggle(relatedTarget) { 2755 return this._isShown ? this.hide() : this.show(relatedTarget); 2756 } 2757 show(relatedTarget) { 2758 if (this._isShown) { 2759 return; 2760 } 2761 const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$3, { 2762 relatedTarget 2763 }); 2764 if (showEvent.defaultPrevented) { 2765 return; 2766 } 2767 this._isShown = true; 2768 this._backdrop.show(); 2769 if (!this._config.scroll) { 2770 new ScrollBarHelper().hide(); 2771 } 2772 this._element.setAttribute('aria-modal', true); 2773 this._element.setAttribute('role', 'dialog'); 2774 this._element.classList.add(CLASS_NAME_SHOWING$1); 2775 const completeCallBack = () => { 2776 if (!this._config.scroll || this._config.backdrop) { 2777 this._focustrap.activate(); 2778 } 2779 this._element.classList.add(CLASS_NAME_SHOW$3); 2780 this._element.classList.remove(CLASS_NAME_SHOWING$1); 2781 EventHandler.trigger(this._element, EVENT_SHOWN$3, { 2782 relatedTarget 2783 }); 2784 }; 2785 this._queueCallback(completeCallBack, this._element, true); 2786 } 2787 hide() { 2788 if (!this._isShown) { 2789 return; 2790 } 2791 const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$3); 2792 if (hideEvent.defaultPrevented) { 2793 return; 2794 } 2795 this._focustrap.deactivate(); 2796 this._element.blur(); 2797 this._isShown = false; 2798 this._element.classList.add(CLASS_NAME_HIDING); 2799 this._backdrop.hide(); 2800 const completeCallback = () => { 2801 this._element.classList.remove(CLASS_NAME_SHOW$3, CLASS_NAME_HIDING); 2802 this._element.removeAttribute('aria-modal'); 2803 this._element.removeAttribute('role'); 2804 if (!this._config.scroll) { 2805 new ScrollBarHelper().reset(); 2806 } 2807 EventHandler.trigger(this._element, EVENT_HIDDEN$3); 2808 }; 2809 this._queueCallback(completeCallback, this._element, true); 2810 } 2811 dispose() { 2812 this._backdrop.dispose(); 2813 this._focustrap.deactivate(); 2814 super.dispose(); 2815 } 2816 2817 // Private 2818 _initializeBackDrop() { 2819 const clickCallback = () => { 2820 if (this._config.backdrop === 'static') { 2821 EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED); 2822 return; 2823 } 2824 this.hide(); 2825 }; 2826 2827 // 'static' option will be translated to true, and booleans will keep their value 2828 const isVisible = Boolean(this._config.backdrop); 2829 return new Backdrop({ 2830 className: CLASS_NAME_BACKDROP, 2831 isVisible, 2832 isAnimated: true, 2833 rootElement: this._element.parentNode, 2834 clickCallback: isVisible ? clickCallback : null 2835 }); 2836 } 2837 _initializeFocusTrap() { 2838 return new FocusTrap({ 2839 trapElement: this._element 2840 }); 2841 } 2842 _addEventListeners() { 2843 EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, event => { 2844 if (event.key !== ESCAPE_KEY) { 2845 return; 2846 } 2847 if (this._config.keyboard) { 2848 this.hide(); 2849 return; 2850 } 2851 EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED); 2852 }); 2853 } 2854 2855 // Static 2856 static jQueryInterface(config) { 2857 return this.each(function () { 2858 const data = Offcanvas.getOrCreateInstance(this, config); 2859 if (typeof config !== 'string') { 2860 return; 2861 } 2862 if (data[config] === undefined || config.startsWith('_') || config === 'constructor') { 2863 throw new TypeError(`No method named "${config}"`); 2864 } 2865 data[config](this); 2866 }); 2867 } 2868 } 2869 2870 /** 2871 * Data API implementation 2872 */ 2873 2874 EventHandler.on(document, EVENT_CLICK_DATA_API$1, SELECTOR_DATA_TOGGLE$1, function (event) { 2875 const target = SelectorEngine.getElementFromSelector(this); 2876 if (['A', 'AREA'].includes(this.tagName)) { 2877 event.preventDefault(); 2878 } 2879 if (isDisabled(this)) { 2880 return; 2881 } 2882 EventHandler.one(target, EVENT_HIDDEN$3, () => { 2883 // focus on trigger when it is closed 2884 if (isVisible(this)) { 2885 this.focus(); 2886 } 2887 }); 2888 2889 // avoid conflict when clicking a toggler of an offcanvas, while another is open 2890 const alreadyOpen = SelectorEngine.findOne(OPEN_SELECTOR); 2891 if (alreadyOpen && alreadyOpen !== target) { 2892 Offcanvas.getInstance(alreadyOpen).hide(); 2893 } 2894 const data = Offcanvas.getOrCreateInstance(target); 2895 data.toggle(this); 2896 }); 2897 EventHandler.on(window, EVENT_LOAD_DATA_API$2, () => { 2898 for (const selector of SelectorEngine.find(OPEN_SELECTOR)) { 2899 Offcanvas.getOrCreateInstance(selector).show(); 2900 } 2901 }); 2902 EventHandler.on(window, EVENT_RESIZE, () => { 2903 for (const element of SelectorEngine.find('[aria-modal][class*=show][class*=offcanvas-]')) { 2904 if (getComputedStyle(element).position !== 'fixed') { 2905 Offcanvas.getOrCreateInstance(element).hide(); 2906 } 2907 } 2908 }); 2909 enableDismissTrigger(Offcanvas); 2910 2911 /** 2912 * jQuery 2913 */ 2914 2915 defineJQueryPlugin(Offcanvas); 2916 2917 /** 2918 * -------------------------------------------------------------------------- 2919 * Bootstrap util/sanitizer.js 2920 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 2921 * -------------------------------------------------------------------------- 2922 */ 2923 2924 const uriAttributes = new Set(['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href']); 2925 2926 /** 2927 * A pattern that recognizes a commonly useful subset of URLs that are safe. 2928 * 2929 * Shout-out to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts 2930 */ 2931 const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^#&/:?]*(?:[#/?]|$))/i; 2932 2933 /** 2934 * A pattern that matches safe data URLs. Only matches image, video and audio types. 2935 * 2936 * Shout-out to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts 2937 */ 2938 const DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[\d+/a-z]+=*$/i; 2939 const allowedAttribute = (attribute, allowedAttributeList) => { 2940 const attributeName = attribute.nodeName.toLowerCase(); 2941 if (allowedAttributeList.includes(attributeName)) { 2942 if (uriAttributes.has(attributeName)) { 2943 return Boolean(SAFE_URL_PATTERN.test(attribute.nodeValue) || DATA_URL_PATTERN.test(attribute.nodeValue)); 2944 } 2945 return true; 2946 } 2947 2948 // Check if a regular expression validates the attribute. 2949 return allowedAttributeList.filter(attributeRegex => attributeRegex instanceof RegExp).some(regex => regex.test(attributeName)); 2950 }; 2951 2952 // js-docs-start allow-list 2953 const ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i; 2954 const DefaultAllowlist = { 2955 // Global attributes allowed on any supplied element below. 2956 '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN], 2957 a: ['target', 'href', 'title', 'rel'], 2958 area: [], 2959 b: [], 2960 br: [], 2961 col: [], 2962 code: [], 2963 div: [], 2964 em: [], 2965 hr: [], 2966 h1: [], 2967 h2: [], 2968 h3: [], 2969 h4: [], 2970 h5: [], 2971 h6: [], 2972 i: [], 2973 img: ['src', 'srcset', 'alt', 'title', 'width', 'height'], 2974 li: [], 2975 ol: [], 2976 p: [], 2977 pre: [], 2978 s: [], 2979 small: [], 2980 span: [], 2981 sub: [], 2982 sup: [], 2983 strong: [], 2984 u: [], 2985 ul: [] 2986 }; 2987 // js-docs-end allow-list 2988 2989 function sanitizeHtml(unsafeHtml, allowList, sanitizeFunction) { 2990 if (!unsafeHtml.length) { 2991 return unsafeHtml; 2992 } 2993 if (sanitizeFunction && typeof sanitizeFunction === 'function') { 2994 return sanitizeFunction(unsafeHtml); 2995 } 2996 const domParser = new window.DOMParser(); 2997 const createdDocument = domParser.parseFromString(unsafeHtml, 'text/html'); 2998 const elements = [].concat(...createdDocument.body.querySelectorAll('*')); 2999 for (const element of elements) { 3000 const elementName = element.nodeName.toLowerCase(); 3001 if (!Object.keys(allowList).includes(elementName)) { 3002 element.remove(); 3003 continue; 3004 } 3005 const attributeList = [].concat(...element.attributes); 3006 const allowedAttributes = [].concat(allowList['*'] || [], allowList[elementName] || []); 3007 for (const attribute of attributeList) { 3008 if (!allowedAttribute(attribute, allowedAttributes)) {
vendor: 8,327 bytes, lines 3009-3274
3009 element.removeAttribute(attribute.nodeName); 3010 } 3011 } 3012 } 3013 return createdDocument.body.innerHTML; 3014 } 3015 3016 /** 3017 * -------------------------------------------------------------------------- 3018 * Bootstrap util/template-factory.js 3019 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 3020 * -------------------------------------------------------------------------- 3021 */ 3022 3023 /** 3024 * Constants 3025 */ 3026 3027 const NAME$5 = 'TemplateFactory'; 3028 const Default$4 = { 3029 allowList: DefaultAllowlist, 3030 content: {}, 3031 // { selector : text , selector2 : text2 , } 3032 extraClass: '', 3033 html: false, 3034 sanitize: true, 3035 sanitizeFn: null, 3036 template: '<div></div>' 3037 }; 3038 const DefaultType$4 = { 3039 allowList: 'object', 3040 content: 'object', 3041 extraClass: '(string|function)', 3042 html: 'boolean', 3043 sanitize: 'boolean', 3044 sanitizeFn: '(null|function)', 3045 template: 'string' 3046 }; 3047 const DefaultContentType = { 3048 entry: '(string|element|function|null)', 3049 selector: '(string|element)' 3050 }; 3051 3052 /** 3053 * Class definition 3054 */ 3055 3056 class TemplateFactory extends Config { 3057 constructor(config) { 3058 super(); 3059 this._config = this._getConfig(config); 3060 } 3061 3062 // Getters 3063 static get Default() { 3064 return Default$4; 3065 } 3066 static get DefaultType() { 3067 return DefaultType$4; 3068 } 3069 static get NAME() { 3070 return NAME$5; 3071 } 3072 3073 // Public 3074 getContent() { 3075 return Object.values(this._config.content).map(config => this._resolvePossibleFunction(config)).filter(Boolean); 3076 } 3077 hasContent() { 3078 return this.getContent().length > 0; 3079 } 3080 changeContent(content) { 3081 this._checkContent(content); 3082 this._config.content = { 3083 ...this._config.content, 3084 ...content 3085 }; 3086 return this; 3087 } 3088 toHtml() { 3089 const templateWrapper = document.createElement('div'); 3090 templateWrapper.innerHTML = this._maybeSanitize(this._config.template); 3091 for (const [selector, text] of Object.entries(this._config.content)) { 3092 this._setContent(templateWrapper, text, selector); 3093 } 3094 const template = templateWrapper.children[0]; 3095 const extraClass = this._resolvePossibleFunction(this._config.extraClass); 3096 if (extraClass) { 3097 template.classList.add(...extraClass.split(' ')); 3098 } 3099 return template; 3100 } 3101 3102 // Private 3103 _typeCheckConfig(config) { 3104 super._typeCheckConfig(config); 3105 this._checkContent(config.content); 3106 } 3107 _checkContent(arg) { 3108 for (const [selector, content] of Object.entries(arg)) { 3109 super._typeCheckConfig({ 3110 selector, 3111 entry: content 3112 }, DefaultContentType); 3113 } 3114 } 3115 _setContent(template, content, selector) { 3116 const templateElement = SelectorEngine.findOne(selector, template); 3117 if (!templateElement) { 3118 return; 3119 } 3120 content = this._resolvePossibleFunction(content); 3121 if (!content) { 3122 templateElement.remove(); 3123 return; 3124 } 3125 if (isElement(content)) { 3126 this._putElementInTemplate(getElement(content), templateElement); 3127 return; 3128 } 3129 if (this._config.html) { 3130 templateElement.innerHTML = this._maybeSanitize(content); 3131 return; 3132 } 3133 templateElement.textContent = content; 3134 } 3135 _maybeSanitize(arg) { 3136 return this._config.sanitize ? sanitizeHtml(arg, this._config.allowList, this._config.sanitizeFn) : arg; 3137 } 3138 _resolvePossibleFunction(arg) { 3139 return execute(arg, [this]); 3140 } 3141 _putElementInTemplate(element, templateElement) { 3142 if (this._config.html) { 3143 templateElement.innerHTML = ''; 3144 templateElement.append(element); 3145 return; 3146 } 3147 templateElement.textContent = element.textContent; 3148 } 3149 } 3150 3151 /** 3152 * -------------------------------------------------------------------------- 3153 * Bootstrap tooltip.js 3154 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 3155 * -------------------------------------------------------------------------- 3156 */ 3157 3158 /** 3159 * Constants 3160 */ 3161 3162 const NAME$4 = 'tooltip'; 3163 const DISALLOWED_ATTRIBUTES = new Set(['sanitize', 'allowList', 'sanitizeFn']); 3164 const CLASS_NAME_FADE$2 = 'fade'; 3165 const CLASS_NAME_MODAL = 'modal'; 3166 const CLASS_NAME_SHOW$2 = 'show'; 3167 const SELECTOR_TOOLTIP_INNER = '.tooltip-inner'; 3168 const SELECTOR_MODAL = `.${CLASS_NAME_MODAL}`; 3169 const EVENT_MODAL_HIDE = 'hide.bs.modal'; 3170 const TRIGGER_HOVER = 'hover'; 3171 const TRIGGER_FOCUS = 'focus'; 3172 const TRIGGER_CLICK = 'click'; 3173 const TRIGGER_MANUAL = 'manual'; 3174 const EVENT_HIDE$2 = 'hide'; 3175 const EVENT_HIDDEN$2 = 'hidden'; 3176 const EVENT_SHOW$2 = 'show'; 3177 const EVENT_SHOWN$2 = 'shown'; 3178 const EVENT_INSERTED = 'inserted'; 3179 const EVENT_CLICK$1 = 'click'; 3180 const EVENT_FOCUSIN$1 = 'focusin'; 3181 const EVENT_FOCUSOUT$1 = 'focusout'; 3182 const EVENT_MOUSEENTER = 'mouseenter'; 3183 const EVENT_MOUSELEAVE = 'mouseleave'; 3184 const AttachmentMap = { 3185 AUTO: 'auto', 3186 TOP: 'top', 3187 RIGHT: isRTL() ? 'left' : 'right', 3188 BOTTOM: 'bottom', 3189 LEFT: isRTL() ? 'right' : 'left' 3190 }; 3191 const Default$3 = { 3192 allowList: DefaultAllowlist, 3193 animation: true, 3194 boundary: 'clippingParents', 3195 container: false, 3196 customClass: '', 3197 delay: 0, 3198 fallbackPlacements: ['top', 'right', 'bottom', 'left'], 3199 html: false, 3200 offset: [0, 6], 3201 placement: 'top', 3202 popperConfig: null, 3203 sanitize: true, 3204 sanitizeFn: null, 3205 selector: false, 3206 template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-arrow"></div>' + '<div class="tooltip-inner"></div>' + '</div>', 3207 title: '', 3208 trigger: 'hover focus' 3209 }; 3210 const DefaultType$3 = { 3211 allowList: 'object', 3212 animation: 'boolean', 3213 boundary: '(string|element)', 3214 container: '(string|element|boolean)', 3215 customClass: '(string|function)', 3216 delay: '(number|object)', 3217 fallbackPlacements: 'array', 3218 html: 'boolean', 3219 offset: '(array|string|function)', 3220 placement: '(string|function)', 3221 popperConfig: '(null|object|function)', 3222 sanitize: 'boolean', 3223 sanitizeFn: '(null|function)', 3224 selector: '(string|boolean)', 3225 template: 'string', 3226 title: '(string|element|function)', 3227 trigger: 'string' 3228 }; 3229 3230 /** 3231 * Class definition 3232 */ 3233 3234 class Tooltip extends BaseComponent { 3235 constructor(element, config) { 3236 if (typeof Popper__namespace === 'undefined') { 3237 throw new TypeError('Bootstrap\'s tooltips require Popper (https://popper.js.org)'); 3238 } 3239 super(element, config); 3240 3241 // Private 3242 this._isEnabled = true; 3243 this._timeout = 0; 3244 this._isHovered = null; 3245 this._activeTrigger = {}; 3246 this._popper = null; 3247 this._templateFactory = null; 3248 this._newContent = null; 3249 3250 // Protected 3251 this.tip = null; 3252 this._setListeners(); 3253 if (!this._config.selector) { 3254 this._fixTitle(); 3255 } 3256 } 3257 3258 // Getters 3259 static get Default() { 3260 return Default$3; 3261 } 3262 static get DefaultType() { 3263 return DefaultType$3; 3264 } 3265 static get NAME() { 3266 return NAME$4; 3267 } 3268 3269 // Public 3270 enable() { 3271 this._isEnabled = true; 3272 } 3273 disable() { 3274 this._isEnabled = false;
vendor: 4,577 bytes, lines 3275-3381
3275 } 3276 toggleEnabled() { 3277 this._isEnabled = !this._isEnabled; 3278 } 3279 toggle() { 3280 if (!this._isEnabled) { 3281 return; 3282 } 3283 this._activeTrigger.click = !this._activeTrigger.click; 3284 if (this._isShown()) { 3285 this._leave(); 3286 return; 3287 } 3288 this._enter(); 3289 } 3290 dispose() { 3291 clearTimeout(this._timeout); 3292 EventHandler.off(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler); 3293 if (this._element.getAttribute('data-bs-original-title')) { 3294 this._element.setAttribute('title', this._element.getAttribute('data-bs-original-title')); 3295 } 3296 this._disposePopper(); 3297 super.dispose(); 3298 } 3299 show() { 3300 if (this._element.style.display === 'none') { 3301 throw new Error('Please use show on visible elements'); 3302 } 3303 if (!(this._isWithContent() && this._isEnabled)) { 3304 return; 3305 } 3306 const showEvent = EventHandler.trigger(this._element, this.constructor.eventName(EVENT_SHOW$2)); 3307 const shadowRoot = findShadowRoot(this._element); 3308 const isInTheDom = (shadowRoot || this._element.ownerDocument.documentElement).contains(this._element); 3309 if (showEvent.defaultPrevented || !isInTheDom) { 3310 return; 3311 } 3312 3313 // TODO: v6 remove this or make it optional 3314 this._disposePopper(); 3315 const tip = this._getTipElement(); 3316 this._element.setAttribute('aria-describedby', tip.getAttribute('id')); 3317 const { 3318 container 3319 } = this._config; 3320 if (!this._element.ownerDocument.documentElement.contains(this.tip)) { 3321 container.append(tip); 3322 EventHandler.trigger(this._element, this.constructor.eventName(EVENT_INSERTED)); 3323 } 3324 this._popper = this._createPopper(tip); 3325 tip.classList.add(CLASS_NAME_SHOW$2); 3326 3327 // If this is a touch-enabled device we add extra 3328 // empty mouseover listeners to the body's immediate children; 3329 // only needed because of broken event delegation on iOS 3330 // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html 3331 if ('ontouchstart' in document.documentElement) { 3332 for (const element of [].concat(...document.body.children)) { 3333 EventHandler.on(element, 'mouseover', noop); 3334 } 3335 } 3336 const complete = () => { 3337 EventHandler.trigger(this._element, this.constructor.eventName(EVENT_SHOWN$2)); 3338 if (this._isHovered === false) { 3339 this._leave(); 3340 } 3341 this._isHovered = false; 3342 }; 3343 this._queueCallback(complete, this.tip, this._isAnimated()); 3344 } 3345 hide() { 3346 if (!this._isShown()) { 3347 return; 3348 } 3349 const hideEvent = EventHandler.trigger(this._element, this.constructor.eventName(EVENT_HIDE$2)); 3350 if (hideEvent.defaultPrevented) { 3351 return; 3352 } 3353 const tip = this._getTipElement(); 3354 tip.classList.remove(CLASS_NAME_SHOW$2); 3355 3356 // If this is a touch-enabled device we remove the extra 3357 // empty mouseover listeners we added for iOS support 3358 if ('ontouchstart' in document.documentElement) { 3359 for (const element of [].concat(...document.body.children)) { 3360 EventHandler.off(element, 'mouseover', noop); 3361 } 3362 } 3363 this._activeTrigger[TRIGGER_CLICK] = false; 3364 this._activeTrigger[TRIGGER_FOCUS] = false; 3365 this._activeTrigger[TRIGGER_HOVER] = false; 3366 this._isHovered = null; // it is a trick to support manual triggering 3367 3368 const complete = () => { 3369 if (this._isWithActiveTrigger()) { 3370 return; 3371 } 3372 if (!this._isHovered) { 3373 this._disposePopper(); 3374 } 3375 this._element.removeAttribute('aria-describedby'); 3376 EventHandler.trigger(this._element, this.constructor.eventName(EVENT_HIDDEN$2)); 3377 }; 3378 this._queueCallback(complete, this.tip, this._isAnimated()); 3379 } 3380 update() { 3381 if (this._popper) {
vendor: 5,367 bytes, lines 3382-3517
3382 this._popper.update(); 3383 } 3384 } 3385 3386 // Protected 3387 _isWithContent() { 3388 return Boolean(this._getTitle()); 3389 } 3390 _getTipElement() { 3391 if (!this.tip) { 3392 this.tip = this._createTipElement(this._newContent || this._getContentForTemplate()); 3393 } 3394 return this.tip; 3395 } 3396 _createTipElement(content) { 3397 const tip = this._getTemplateFactory(content).toHtml(); 3398 3399 // TODO: remove this check in v6 3400 if (!tip) { 3401 return null; 3402 } 3403 tip.classList.remove(CLASS_NAME_FADE$2, CLASS_NAME_SHOW$2); 3404 // TODO: v6 the following can be achieved with CSS only 3405 tip.classList.add(`bs-${this.constructor.NAME}-auto`); 3406 const tipId = getUID(this.constructor.NAME).toString(); 3407 tip.setAttribute('id', tipId); 3408 if (this._isAnimated()) { 3409 tip.classList.add(CLASS_NAME_FADE$2); 3410 } 3411 return tip; 3412 } 3413 setContent(content) { 3414 this._newContent = content; 3415 if (this._isShown()) { 3416 this._disposePopper(); 3417 this.show(); 3418 } 3419 } 3420 _getTemplateFactory(content) { 3421 if (this._templateFactory) { 3422 this._templateFactory.changeContent(content); 3423 } else { 3424 this._templateFactory = new TemplateFactory({ 3425 ...this._config, 3426 // the `content` var has to be after `this._config` 3427 // to override config.content in case of popover 3428 content, 3429 extraClass: this._resolvePossibleFunction(this._config.customClass) 3430 }); 3431 } 3432 return this._templateFactory; 3433 } 3434 _getContentForTemplate() { 3435 return { 3436 [SELECTOR_TOOLTIP_INNER]: this._getTitle() 3437 }; 3438 } 3439 _getTitle() { 3440 return this._resolvePossibleFunction(this._config.title) || this._element.getAttribute('data-bs-original-title'); 3441 } 3442 3443 // Private 3444 _initializeOnDelegatedTarget(event) { 3445 return this.constructor.getOrCreateInstance(event.delegateTarget, this._getDelegateConfig()); 3446 } 3447 _isAnimated() { 3448 return this._config.animation || this.tip && this.tip.classList.contains(CLASS_NAME_FADE$2); 3449 } 3450 _isShown() { 3451 return this.tip && this.tip.classList.contains(CLASS_NAME_SHOW$2); 3452 } 3453 _createPopper(tip) { 3454 const placement = execute(this._config.placement, [this, tip, this._element]); 3455 const attachment = AttachmentMap[placement.toUpperCase()]; 3456 return Popper__namespace.createPopper(this._element, tip, this._getPopperConfig(attachment)); 3457 } 3458 _getOffset() { 3459 const { 3460 offset 3461 } = this._config; 3462 if (typeof offset === 'string') { 3463 return offset.split(',').map(value => Number.parseInt(value, 10)); 3464 } 3465 if (typeof offset === 'function') { 3466 return popperData => offset(popperData, this._element); 3467 } 3468 return offset; 3469 } 3470 _resolvePossibleFunction(arg) { 3471 return execute(arg, [this._element]); 3472 } 3473 _getPopperConfig(attachment) { 3474 const defaultBsPopperConfig = { 3475 placement: attachment, 3476 modifiers: [{ 3477 name: 'flip', 3478 options: { 3479 fallbackPlacements: this._config.fallbackPlacements 3480 } 3481 }, { 3482 name: 'offset', 3483 options: { 3484 offset: this._getOffset() 3485 } 3486 }, { 3487 name: 'preventOverflow', 3488 options: { 3489 boundary: this._config.boundary 3490 } 3491 }, { 3492 name: 'arrow', 3493 options: { 3494 element: `.${this.constructor.NAME}-arrow` 3495 } 3496 }, { 3497 name: 'preSetPlacement', 3498 enabled: true, 3499 phase: 'beforeMain', 3500 fn: data => { 3501 // Pre-set Popper's placement attribute in order to read the arrow sizes properly. 3502 // Otherwise, Popper mixes up the width and height dimensions since the initial arrow style is for top placement 3503 this._getTipElement().setAttribute('data-popper-placement', data.state.placement); 3504 } 3505 }] 3506 }; 3507 return { 3508 ...defaultBsPopperConfig, 3509 ...execute(this._config.popperConfig, [defaultBsPopperConfig]) 3510 }; 3511 } 3512 _setListeners() { 3513 const triggers = this._config.trigger.split(' '); 3514 for (const trigger of triggers) { 3515 if (trigger === 'click') { 3516 EventHandler.on(this._element, this.constructor.eventName(EVENT_CLICK$1), this._config.selector, event => { 3517 const context = this._initializeOnDelegatedTarget(event);
vendor: 16,617 bytes, lines 3518-3955
3518 context.toggle(); 3519 }); 3520 } else if (trigger !== TRIGGER_MANUAL) { 3521 const eventIn = trigger === TRIGGER_HOVER ? this.constructor.eventName(EVENT_MOUSEENTER) : this.constructor.eventName(EVENT_FOCUSIN$1); 3522 const eventOut = trigger === TRIGGER_HOVER ? this.constructor.eventName(EVENT_MOUSELEAVE) : this.constructor.eventName(EVENT_FOCUSOUT$1); 3523 EventHandler.on(this._element, eventIn, this._config.selector, event => { 3524 const context = this._initializeOnDelegatedTarget(event); 3525 context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true; 3526 context._enter(); 3527 }); 3528 EventHandler.on(this._element, eventOut, this._config.selector, event => { 3529 const context = this._initializeOnDelegatedTarget(event); 3530 context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = context._element.contains(event.relatedTarget); 3531 context._leave(); 3532 }); 3533 } 3534 } 3535 this._hideModalHandler = () => { 3536 if (this._element) { 3537 this.hide(); 3538 } 3539 }; 3540 EventHandler.on(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler); 3541 } 3542 _fixTitle() { 3543 const title = this._element.getAttribute('title'); 3544 if (!title) { 3545 return; 3546 } 3547 if (!this._element.getAttribute('aria-label') && !this._element.textContent.trim()) { 3548 this._element.setAttribute('aria-label', title); 3549 } 3550 this._element.setAttribute('data-bs-original-title', title); // DO NOT USE IT. Is only for backwards compatibility 3551 this._element.removeAttribute('title'); 3552 } 3553 _enter() { 3554 if (this._isShown() || this._isHovered) { 3555 this._isHovered = true; 3556 return; 3557 } 3558 this._isHovered = true; 3559 this._setTimeout(() => { 3560 if (this._isHovered) { 3561 this.show(); 3562 } 3563 }, this._config.delay.show); 3564 } 3565 _leave() { 3566 if (this._isWithActiveTrigger()) { 3567 return; 3568 } 3569 this._isHovered = false; 3570 this._setTimeout(() => { 3571 if (!this._isHovered) { 3572 this.hide(); 3573 } 3574 }, this._config.delay.hide); 3575 } 3576 _setTimeout(handler, timeout) { 3577 clearTimeout(this._timeout); 3578 this._timeout = setTimeout(handler, timeout); 3579 } 3580 _isWithActiveTrigger() { 3581 return Object.values(this._activeTrigger).includes(true); 3582 } 3583 _getConfig(config) { 3584 const dataAttributes = Manipulator.getDataAttributes(this._element); 3585 for (const dataAttribute of Object.keys(dataAttributes)) { 3586 if (DISALLOWED_ATTRIBUTES.has(dataAttribute)) { 3587 delete dataAttributes[dataAttribute]; 3588 } 3589 } 3590 config = { 3591 ...dataAttributes, 3592 ...(typeof config === 'object' && config ? config : {}) 3593 }; 3594 config = this._mergeConfigObj(config); 3595 config = this._configAfterMerge(config); 3596 this._typeCheckConfig(config); 3597 return config; 3598 } 3599 _configAfterMerge(config) { 3600 config.container = config.container === false ? document.body : getElement(config.container); 3601 if (typeof config.delay === 'number') { 3602 config.delay = { 3603 show: config.delay, 3604 hide: config.delay 3605 }; 3606 } 3607 if (typeof config.title === 'number') { 3608 config.title = config.title.toString(); 3609 } 3610 if (typeof config.content === 'number') { 3611 config.content = config.content.toString(); 3612 } 3613 return config; 3614 } 3615 _getDelegateConfig() { 3616 const config = {}; 3617 for (const [key, value] of Object.entries(this._config)) { 3618 if (this.constructor.Default[key] !== value) { 3619 config[key] = value; 3620 } 3621 } 3622 config.selector = false; 3623 config.trigger = 'manual'; 3624 3625 // In the future can be replaced with: 3626 // const keysWithDifferentValues = Object.entries(this._config).filter(entry => this.constructor.Default[entry[0]] !== this._config[entry[0]]) 3627 // `Object.fromEntries(keysWithDifferentValues)` 3628 return config; 3629 } 3630 _disposePopper() { 3631 if (this._popper) { 3632 this._popper.destroy(); 3633 this._popper = null; 3634 } 3635 if (this.tip) { 3636 this.tip.remove(); 3637 this.tip = null; 3638 } 3639 } 3640 3641 // Static 3642 static jQueryInterface(config) { 3643 return this.each(function () { 3644 const data = Tooltip.getOrCreateInstance(this, config); 3645 if (typeof config !== 'string') { 3646 return; 3647 } 3648 if (typeof data[config] === 'undefined') { 3649 throw new TypeError(`No method named "${config}"`); 3650 } 3651 data[config](); 3652 }); 3653 } 3654 } 3655 3656 /** 3657 * jQuery 3658 */ 3659 3660 defineJQueryPlugin(Tooltip); 3661 3662 /** 3663 * -------------------------------------------------------------------------- 3664 * Bootstrap popover.js 3665 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 3666 * -------------------------------------------------------------------------- 3667 */ 3668 3669 /** 3670 * Constants 3671 */ 3672 3673 const NAME$3 = 'popover'; 3674 const SELECTOR_TITLE = '.popover-header'; 3675 const SELECTOR_CONTENT = '.popover-body'; 3676 const Default$2 = { 3677 ...Tooltip.Default, 3678 content: '', 3679 offset: [0, 8], 3680 placement: 'right', 3681 template: '<div class="popover" role="tooltip">' + '<div class="popover-arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div>' + '</div>', 3682 trigger: 'click' 3683 }; 3684 const DefaultType$2 = { 3685 ...Tooltip.DefaultType, 3686 content: '(null|string|element|function)' 3687 }; 3688 3689 /** 3690 * Class definition 3691 */ 3692 3693 class Popover extends Tooltip { 3694 // Getters 3695 static get Default() { 3696 return Default$2; 3697 } 3698 static get DefaultType() { 3699 return DefaultType$2; 3700 } 3701 static get NAME() { 3702 return NAME$3; 3703 } 3704 3705 // Overrides 3706 _isWithContent() { 3707 return this._getTitle() || this._getContent(); 3708 } 3709 3710 // Private 3711 _getContentForTemplate() { 3712 return { 3713 [SELECTOR_TITLE]: this._getTitle(), 3714 [SELECTOR_CONTENT]: this._getContent() 3715 }; 3716 } 3717 _getContent() { 3718 return this._resolvePossibleFunction(this._config.content); 3719 } 3720 3721 // Static 3722 static jQueryInterface(config) { 3723 return this.each(function () { 3724 const data = Popover.getOrCreateInstance(this, config); 3725 if (typeof config !== 'string') { 3726 return; 3727 } 3728 if (typeof data[config] === 'undefined') { 3729 throw new TypeError(`No method named "${config}"`); 3730 } 3731 data[config](); 3732 }); 3733 } 3734 } 3735 3736 /** 3737 * jQuery 3738 */ 3739 3740 defineJQueryPlugin(Popover); 3741 3742 /** 3743 * -------------------------------------------------------------------------- 3744 * Bootstrap scrollspy.js 3745 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 3746 * -------------------------------------------------------------------------- 3747 */ 3748 3749 /** 3750 * Constants 3751 */ 3752 3753 const NAME$2 = 'scrollspy'; 3754 const DATA_KEY$2 = 'bs.scrollspy'; 3755 const EVENT_KEY$2 = `.${DATA_KEY$2}`; 3756 const DATA_API_KEY = '.data-api'; 3757 const EVENT_ACTIVATE = `activate${EVENT_KEY$2}`; 3758 const EVENT_CLICK = `click${EVENT_KEY$2}`; 3759 const EVENT_LOAD_DATA_API$1 = `load${EVENT_KEY$2}${DATA_API_KEY}`; 3760 const CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item'; 3761 const CLASS_NAME_ACTIVE$1 = 'active'; 3762 const SELECTOR_DATA_SPY = '[data-bs-spy="scroll"]'; 3763 const SELECTOR_TARGET_LINKS = '[href]'; 3764 const SELECTOR_NAV_LIST_GROUP = '.nav, .list-group'; 3765 const SELECTOR_NAV_LINKS = '.nav-link'; 3766 const SELECTOR_NAV_ITEMS = '.nav-item'; 3767 const SELECTOR_LIST_ITEMS = '.list-group-item'; 3768 const SELECTOR_LINK_ITEMS = `${SELECTOR_NAV_LINKS}, ${SELECTOR_NAV_ITEMS} > ${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}`; 3769 const SELECTOR_DROPDOWN = '.dropdown'; 3770 const SELECTOR_DROPDOWN_TOGGLE$1 = '.dropdown-toggle'; 3771 const Default$1 = { 3772 offset: null, 3773 // TODO: v6 @deprecated, keep it for backwards compatibility reasons 3774 rootMargin: '0px 0px -25%', 3775 smoothScroll: false, 3776 target: null, 3777 threshold: [0.1, 0.5, 1] 3778 }; 3779 const DefaultType$1 = { 3780 offset: '(number|null)', 3781 // TODO v6 @deprecated, keep it for backwards compatibility reasons 3782 rootMargin: 'string', 3783 smoothScroll: 'boolean', 3784 target: 'element', 3785 threshold: 'array' 3786 }; 3787 3788 /** 3789 * Class definition 3790 */ 3791 3792 class ScrollSpy extends BaseComponent { 3793 constructor(element, config) { 3794 super(element, config); 3795 3796 // this._element is the observablesContainer and config.target the menu links wrapper 3797 this._targetLinks = new Map(); 3798 this._observableSections = new Map(); 3799 this._rootElement = getComputedStyle(this._element).overflowY === 'visible' ? null : this._element; 3800 this._activeTarget = null; 3801 this._observer = null; 3802 this._previousScrollData = { 3803 visibleEntryTop: 0, 3804 parentScrollTop: 0 3805 }; 3806 this.refresh(); // initialize 3807 } 3808 3809 // Getters 3810 static get Default() { 3811 return Default$1; 3812 } 3813 static get DefaultType() { 3814 return DefaultType$1; 3815 } 3816 static get NAME() { 3817 return NAME$2; 3818 } 3819 3820 // Public 3821 refresh() { 3822 this._initializeTargetsAndObservables(); 3823 this._maybeEnableSmoothScroll(); 3824 if (this._observer) { 3825 this._observer.disconnect(); 3826 } else { 3827 this._observer = this._getNewObserver(); 3828 } 3829 for (const section of this._observableSections.values()) { 3830 this._observer.observe(section); 3831 } 3832 } 3833 dispose() { 3834 this._observer.disconnect(); 3835 super.dispose(); 3836 } 3837 3838 // Private 3839 _configAfterMerge(config) { 3840 // TODO: on v6 target should be given explicitly & remove the {target: 'ss-target'} case 3841 config.target = getElement(config.target) || document.body; 3842 3843 // TODO: v6 Only for backwards compatibility reasons. Use rootMargin only 3844 config.rootMargin = config.offset ? `${config.offset}px 0px -30%` : config.rootMargin; 3845 if (typeof config.threshold === 'string') { 3846 config.threshold = config.threshold.split(',').map(value => Number.parseFloat(value)); 3847 } 3848 return config; 3849 } 3850 _maybeEnableSmoothScroll() { 3851 if (!this._config.smoothScroll) { 3852 return; 3853 } 3854 3855 // unregister any previous listeners 3856 EventHandler.off(this._config.target, EVENT_CLICK); 3857 EventHandler.on(this._config.target, EVENT_CLICK, SELECTOR_TARGET_LINKS, event => { 3858 const observableSection = this._observableSections.get(event.target.hash); 3859 if (observableSection) { 3860 event.preventDefault(); 3861 const root = this._rootElement || window; 3862 const height = observableSection.offsetTop - this._element.offsetTop; 3863 if (root.scrollTo) { 3864 root.scrollTo({ 3865 top: height, 3866 behavior: 'smooth' 3867 }); 3868 return; 3869 } 3870 3871 // Chrome 60 doesn't support `scrollTo` 3872 root.scrollTop = height; 3873 } 3874 }); 3875 } 3876 _getNewObserver() { 3877 const options = { 3878 root: this._rootElement, 3879 threshold: this._config.threshold, 3880 rootMargin: this._config.rootMargin 3881 }; 3882 return new IntersectionObserver(entries => this._observerCallback(entries), options); 3883 } 3884 3885 // The logic of selection 3886 _observerCallback(entries) { 3887 const targetElement = entry => this._targetLinks.get(`#${entry.target.id}`); 3888 const activate = entry => { 3889 this._previousScrollData.visibleEntryTop = entry.target.offsetTop; 3890 this._process(targetElement(entry)); 3891 }; 3892 const parentScrollTop = (this._rootElement || document.documentElement).scrollTop; 3893 const userScrollsDown = parentScrollTop >= this._previousScrollData.parentScrollTop; 3894 this._previousScrollData.parentScrollTop = parentScrollTop; 3895 for (const entry of entries) { 3896 if (!entry.isIntersecting) { 3897 this._activeTarget = null; 3898 this._clearActiveClass(targetElement(entry)); 3899 continue; 3900 } 3901 const entryIsLowerThanPrevious = entry.target.offsetTop >= this._previousScrollData.visibleEntryTop; 3902 // if we are scrolling down, pick the bigger offsetTop 3903 if (userScrollsDown && entryIsLowerThanPrevious) { 3904 activate(entry); 3905 // if parent isn't scrolled, let's keep the first visible item, breaking the iteration 3906 if (!parentScrollTop) { 3907 return; 3908 } 3909 continue; 3910 } 3911 3912 // if we are scrolling up, pick the smallest offsetTop 3913 if (!userScrollsDown && !entryIsLowerThanPrevious) { 3914 activate(entry); 3915 } 3916 } 3917 } 3918 _initializeTargetsAndObservables() { 3919 this._targetLinks = new Map(); 3920 this._observableSections = new Map(); 3921 const targetLinks = SelectorEngine.find(SELECTOR_TARGET_LINKS, this._config.target); 3922 for (const anchor of targetLinks) { 3923 // ensure that the anchor has an id and is not disabled 3924 if (!anchor.hash || isDisabled(anchor)) { 3925 continue; 3926 } 3927 const observableSection = SelectorEngine.findOne(anchor.hash, this._element); 3928 3929 // ensure that the observableSection exists & is visible 3930 if (isVisible(observableSection)) { 3931 this._targetLinks.set(anchor.hash, anchor); 3932 this._observableSections.set(anchor.hash, observableSection); 3933 } 3934 } 3935 } 3936 _process(target) { 3937 if (this._activeTarget === target) { 3938 return; 3939 } 3940 this._clearActiveClass(this._config.target); 3941 this._activeTarget = target; 3942 target.classList.add(CLASS_NAME_ACTIVE$1); 3943 this._activateParents(target); 3944 EventHandler.trigger(this._element, EVENT_ACTIVATE, { 3945 relatedTarget: target 3946 }); 3947 } 3948 _activateParents(target) { 3949 // Activate dropdown parents 3950 if (target.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) { 3951 SelectorEngine.findOne(SELECTOR_DROPDOWN_TOGGLE$1, target.closest(SELECTOR_DROPDOWN)).classList.add(CLASS_NAME_ACTIVE$1); 3952 return; 3953 } 3954 for (const listGroup of SelectorEngine.parents(target, SELECTOR_NAV_LIST_GROUP)) { 3955 // Set triggered links parents as active
vendor: 9,371 bytes, lines 3956-4184
3956 // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor 3957 for (const item of SelectorEngine.prev(listGroup, SELECTOR_LINK_ITEMS)) { 3958 item.classList.add(CLASS_NAME_ACTIVE$1); 3959 } 3960 } 3961 } 3962 _clearActiveClass(parent) { 3963 parent.classList.remove(CLASS_NAME_ACTIVE$1); 3964 const activeNodes = SelectorEngine.find(`${SELECTOR_TARGET_LINKS}.${CLASS_NAME_ACTIVE$1}`, parent); 3965 for (const node of activeNodes) { 3966 node.classList.remove(CLASS_NAME_ACTIVE$1); 3967 } 3968 } 3969 3970 // Static 3971 static jQueryInterface(config) { 3972 return this.each(function () { 3973 const data = ScrollSpy.getOrCreateInstance(this, config); 3974 if (typeof config !== 'string') { 3975 return; 3976 } 3977 if (data[config] === undefined || config.startsWith('_') || config === 'constructor') { 3978 throw new TypeError(`No method named "${config}"`); 3979 } 3980 data[config](); 3981 }); 3982 } 3983 } 3984 3985 /** 3986 * Data API implementation 3987 */ 3988 3989 EventHandler.on(window, EVENT_LOAD_DATA_API$1, () => { 3990 for (const spy of SelectorEngine.find(SELECTOR_DATA_SPY)) { 3991 ScrollSpy.getOrCreateInstance(spy); 3992 } 3993 }); 3994 3995 /** 3996 * jQuery 3997 */ 3998 3999 defineJQueryPlugin(ScrollSpy); 4000 4001 /** 4002 * -------------------------------------------------------------------------- 4003 * Bootstrap tab.js 4004 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 4005 * -------------------------------------------------------------------------- 4006 */ 4007 4008 /** 4009 * Constants 4010 */ 4011 4012 const NAME$1 = 'tab'; 4013 const DATA_KEY$1 = 'bs.tab'; 4014 const EVENT_KEY$1 = `.${DATA_KEY$1}`; 4015 const EVENT_HIDE$1 = `hide${EVENT_KEY$1}`; 4016 const EVENT_HIDDEN$1 = `hidden${EVENT_KEY$1}`; 4017 const EVENT_SHOW$1 = `show${EVENT_KEY$1}`; 4018 const EVENT_SHOWN$1 = `shown${EVENT_KEY$1}`; 4019 const EVENT_CLICK_DATA_API = `click${EVENT_KEY$1}`; 4020 const EVENT_KEYDOWN = `keydown${EVENT_KEY$1}`; 4021 const EVENT_LOAD_DATA_API = `load${EVENT_KEY$1}`; 4022 const ARROW_LEFT_KEY = 'ArrowLeft'; 4023 const ARROW_RIGHT_KEY = 'ArrowRight'; 4024 const ARROW_UP_KEY = 'ArrowUp'; 4025 const ARROW_DOWN_KEY = 'ArrowDown'; 4026 const CLASS_NAME_ACTIVE = 'active'; 4027 const CLASS_NAME_FADE$1 = 'fade'; 4028 const CLASS_NAME_SHOW$1 = 'show'; 4029 const CLASS_DROPDOWN = 'dropdown'; 4030 const SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle'; 4031 const SELECTOR_DROPDOWN_MENU = '.dropdown-menu'; 4032 const NOT_SELECTOR_DROPDOWN_TOGGLE = ':not(.dropdown-toggle)'; 4033 const SELECTOR_TAB_PANEL = '.list-group, .nav, [role="tablist"]'; 4034 const SELECTOR_OUTER = '.nav-item, .list-group-item'; 4035 const SELECTOR_INNER = `.nav-link${NOT_SELECTOR_DROPDOWN_TOGGLE}, .list-group-item${NOT_SELECTOR_DROPDOWN_TOGGLE}, [role="tab"]${NOT_SELECTOR_DROPDOWN_TOGGLE}`; 4036 const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]'; // TODO: could only be `tab` in v6 4037 const SELECTOR_INNER_ELEM = `${SELECTOR_INNER}, ${SELECTOR_DATA_TOGGLE}`; 4038 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"]`; 4039 4040 /** 4041 * Class definition 4042 */ 4043 4044 class Tab extends BaseComponent { 4045 constructor(element) { 4046 super(element); 4047 this._parent = this._element.closest(SELECTOR_TAB_PANEL); 4048 if (!this._parent) { 4049 return; 4050 // TODO: should throw exception in v6 4051 // throw new TypeError(`${element.outerHTML} has not a valid parent ${SELECTOR_INNER_ELEM}`) 4052 } 4053 4054 // Set up initial aria attributes 4055 this._setInitialAttributes(this._parent, this._getChildren()); 4056 EventHandler.on(this._element, EVENT_KEYDOWN, event => this._keydown(event)); 4057 } 4058 4059 // Getters 4060 static get NAME() { 4061 return NAME$1; 4062 } 4063 4064 // Public 4065 show() { 4066 // Shows this elem and deactivate the active sibling if exists 4067 const innerElem = this._element; 4068 if (this._elemIsActive(innerElem)) { 4069 return; 4070 } 4071 4072 // Search for active tab on same parent to deactivate it 4073 const active = this._getActiveElem(); 4074 const hideEvent = active ? EventHandler.trigger(active, EVENT_HIDE$1, { 4075 relatedTarget: innerElem 4076 }) : null; 4077 const showEvent = EventHandler.trigger(innerElem, EVENT_SHOW$1, { 4078 relatedTarget: active 4079 }); 4080 if (showEvent.defaultPrevented || hideEvent && hideEvent.defaultPrevented) { 4081 return; 4082 } 4083 this._deactivate(active, innerElem); 4084 this._activate(innerElem, active); 4085 } 4086 4087 // Private 4088 _activate(element, relatedElem) { 4089 if (!element) { 4090 return; 4091 } 4092 element.classList.add(CLASS_NAME_ACTIVE); 4093 this._activate(SelectorEngine.getElementFromSelector(element)); // Search and activate/show the proper section 4094 4095 const complete = () => { 4096 if (element.getAttribute('role') !== 'tab') { 4097 element.classList.add(CLASS_NAME_SHOW$1); 4098 return; 4099 } 4100 element.removeAttribute('tabindex'); 4101 element.setAttribute('aria-selected', true); 4102 this._toggleDropDown(element, true); 4103 EventHandler.trigger(element, EVENT_SHOWN$1, { 4104 relatedTarget: relatedElem 4105 }); 4106 }; 4107 this._queueCallback(complete, element, element.classList.contains(CLASS_NAME_FADE$1)); 4108 } 4109 _deactivate(element, relatedElem) { 4110 if (!element) { 4111 return; 4112 } 4113 element.classList.remove(CLASS_NAME_ACTIVE); 4114 element.blur(); 4115 this._deactivate(SelectorEngine.getElementFromSelector(element)); // Search and deactivate the shown section too 4116 4117 const complete = () => { 4118 if (element.getAttribute('role') !== 'tab') { 4119 element.classList.remove(CLASS_NAME_SHOW$1); 4120 return; 4121 } 4122 element.setAttribute('aria-selected', false); 4123 element.setAttribute('tabindex', '-1'); 4124 this._toggleDropDown(element, false); 4125 EventHandler.trigger(element, EVENT_HIDDEN$1, { 4126 relatedTarget: relatedElem 4127 }); 4128 }; 4129 this._queueCallback(complete, element, element.classList.contains(CLASS_NAME_FADE$1)); 4130 } 4131 _keydown(event) { 4132 if (![ARROW_LEFT_KEY, ARROW_RIGHT_KEY, ARROW_UP_KEY, ARROW_DOWN_KEY].includes(event.key)) { 4133 return; 4134 } 4135 event.stopPropagation(); // stopPropagation/preventDefault both added to support up/down keys without scrolling the page 4136 event.preventDefault(); 4137 const isNext = [ARROW_RIGHT_KEY, ARROW_DOWN_KEY].includes(event.key); 4138 const nextActiveElement = getNextActiveElement(this._getChildren().filter(element => !isDisabled(element)), event.target, isNext, true); 4139 if (nextActiveElement) { 4140 nextActiveElement.focus({ 4141 preventScroll: true 4142 }); 4143 Tab.getOrCreateInstance(nextActiveElement).show(); 4144 } 4145 } 4146 _getChildren() { 4147 // collection of inner elements 4148 return SelectorEngine.find(SELECTOR_INNER_ELEM, this._parent); 4149 } 4150 _getActiveElem() { 4151 return this._getChildren().find(child => this._elemIsActive(child)) || null; 4152 } 4153 _setInitialAttributes(parent, children) { 4154 this._setAttributeIfNotExists(parent, 'role', 'tablist'); 4155 for (const child of children) { 4156 this._setInitialAttributesOnChild(child); 4157 } 4158 } 4159 _setInitialAttributesOnChild(child) { 4160 child = this._getInnerElement(child); 4161 const isActive = this._elemIsActive(child); 4162 const outerElem = this._getOuterElement(child); 4163 child.setAttribute('aria-selected', isActive); 4164 if (outerElem !== child) { 4165 this._setAttributeIfNotExists(outerElem, 'role', 'presentation'); 4166 } 4167 if (!isActive) { 4168 child.setAttribute('tabindex', '-1'); 4169 } 4170 this._setAttributeIfNotExists(child, 'role', 'tab'); 4171 4172 // set attributes to the related panel too 4173 this._setInitialAttributesOnTargetPanel(child); 4174 } 4175 _setInitialAttributesOnTargetPanel(child) { 4176 const target = SelectorEngine.getElementFromSelector(child); 4177 if (!target) { 4178 return; 4179 } 4180 this._setAttributeIfNotExists(target, 'role', 'tabpanel'); 4181 if (child.id) { 4182 this._setAttributeIfNotExists(target, 'aria-labelledby', `${child.id}`); 4183 } 4184 }
vendor: 8,199 bytes, lines 4185-4424
4185 _toggleDropDown(element, open) { 4186 const outerElem = this._getOuterElement(element); 4187 if (!outerElem.classList.contains(CLASS_DROPDOWN)) { 4188 return; 4189 } 4190 const toggle = (selector, className) => { 4191 const element = SelectorEngine.findOne(selector, outerElem); 4192 if (element) { 4193 element.classList.toggle(className, open); 4194 } 4195 }; 4196 toggle(SELECTOR_DROPDOWN_TOGGLE, CLASS_NAME_ACTIVE); 4197 toggle(SELECTOR_DROPDOWN_MENU, CLASS_NAME_SHOW$1); 4198 outerElem.setAttribute('aria-expanded', open); 4199 } 4200 _setAttributeIfNotExists(element, attribute, value) { 4201 if (!element.hasAttribute(attribute)) { 4202 element.setAttribute(attribute, value); 4203 } 4204 } 4205 _elemIsActive(elem) { 4206 return elem.classList.contains(CLASS_NAME_ACTIVE); 4207 } 4208 4209 // Try to get the inner element (usually the .nav-link) 4210 _getInnerElement(elem) { 4211 return elem.matches(SELECTOR_INNER_ELEM) ? elem : SelectorEngine.findOne(SELECTOR_INNER_ELEM, elem); 4212 } 4213 4214 // Try to get the outer element (usually the .nav-item) 4215 _getOuterElement(elem) { 4216 return elem.closest(SELECTOR_OUTER) || elem; 4217 } 4218 4219 // Static 4220 static jQueryInterface(config) { 4221 return this.each(function () { 4222 const data = Tab.getOrCreateInstance(this); 4223 if (typeof config !== 'string') { 4224 return; 4225 } 4226 if (data[config] === undefined || config.startsWith('_') || config === 'constructor') { 4227 throw new TypeError(`No method named "${config}"`); 4228 } 4229 data[config](); 4230 }); 4231 } 4232 } 4233 4234 /** 4235 * Data API implementation 4236 */ 4237 4238 EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) { 4239 if (['A', 'AREA'].includes(this.tagName)) { 4240 event.preventDefault(); 4241 } 4242 if (isDisabled(this)) { 4243 return; 4244 } 4245 Tab.getOrCreateInstance(this).show(); 4246 }); 4247 4248 /** 4249 * Initialize on focus 4250 */ 4251 EventHandler.on(window, EVENT_LOAD_DATA_API, () => { 4252 for (const element of SelectorEngine.find(SELECTOR_DATA_TOGGLE_ACTIVE)) { 4253 Tab.getOrCreateInstance(element); 4254 } 4255 }); 4256 /** 4257 * jQuery 4258 */ 4259 4260 defineJQueryPlugin(Tab); 4261 4262 /** 4263 * -------------------------------------------------------------------------- 4264 * Bootstrap toast.js 4265 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 4266 * -------------------------------------------------------------------------- 4267 */ 4268 4269 /** 4270 * Constants 4271 */ 4272 4273 const NAME = 'toast'; 4274 const DATA_KEY = 'bs.toast'; 4275 const EVENT_KEY = `.${DATA_KEY}`; 4276 const EVENT_MOUSEOVER = `mouseover${EVENT_KEY}`; 4277 const EVENT_MOUSEOUT = `mouseout${EVENT_KEY}`; 4278 const EVENT_FOCUSIN = `focusin${EVENT_KEY}`; 4279 const EVENT_FOCUSOUT = `focusout${EVENT_KEY}`; 4280 const EVENT_HIDE = `hide${EVENT_KEY}`; 4281 const EVENT_HIDDEN = `hidden${EVENT_KEY}`; 4282 const EVENT_SHOW = `show${EVENT_KEY}`; 4283 const EVENT_SHOWN = `shown${EVENT_KEY}`; 4284 const CLASS_NAME_FADE = 'fade'; 4285 const CLASS_NAME_HIDE = 'hide'; // @deprecated - kept here only for backwards compatibility 4286 const CLASS_NAME_SHOW = 'show'; 4287 const CLASS_NAME_SHOWING = 'showing'; 4288 const DefaultType = { 4289 animation: 'boolean', 4290 autohide: 'boolean', 4291 delay: 'number' 4292 }; 4293 const Default = { 4294 animation: true, 4295 autohide: true, 4296 delay: 5000 4297 }; 4298 4299 /** 4300 * Class definition 4301 */ 4302 4303 class Toast extends BaseComponent { 4304 constructor(element, config) { 4305 super(element, config); 4306 this._timeout = null; 4307 this._hasMouseInteraction = false; 4308 this._hasKeyboardInteraction = false; 4309 this._setListeners(); 4310 } 4311 4312 // Getters 4313 static get Default() { 4314 return Default; 4315 } 4316 static get DefaultType() { 4317 return DefaultType; 4318 } 4319 static get NAME() { 4320 return NAME; 4321 } 4322 4323 // Public 4324 show() { 4325 const showEvent = EventHandler.trigger(this._element, EVENT_SHOW); 4326 if (showEvent.defaultPrevented) { 4327 return; 4328 } 4329 this._clearTimeout(); 4330 if (this._config.animation) { 4331 this._element.classList.add(CLASS_NAME_FADE); 4332 } 4333 const complete = () => { 4334 this._element.classList.remove(CLASS_NAME_SHOWING); 4335 EventHandler.trigger(this._element, EVENT_SHOWN); 4336 this._maybeScheduleHide(); 4337 }; 4338 this._element.classList.remove(CLASS_NAME_HIDE); // @deprecated 4339 reflow(this._element); 4340 this._element.classList.add(CLASS_NAME_SHOW, CLASS_NAME_SHOWING); 4341 this._queueCallback(complete, this._element, this._config.animation); 4342 } 4343 hide() { 4344 if (!this.isShown()) { 4345 return; 4346 } 4347 const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE); 4348 if (hideEvent.defaultPrevented) { 4349 return; 4350 } 4351 const complete = () => { 4352 this._element.classList.add(CLASS_NAME_HIDE); // @deprecated 4353 this._element.classList.remove(CLASS_NAME_SHOWING, CLASS_NAME_SHOW); 4354 EventHandler.trigger(this._element, EVENT_HIDDEN); 4355 }; 4356 this._element.classList.add(CLASS_NAME_SHOWING); 4357 this._queueCallback(complete, this._element, this._config.animation); 4358 } 4359 dispose() { 4360 this._clearTimeout(); 4361 if (this.isShown()) { 4362 this._element.classList.remove(CLASS_NAME_SHOW); 4363 } 4364 super.dispose(); 4365 } 4366 isShown() { 4367 return this._element.classList.contains(CLASS_NAME_SHOW); 4368 } 4369 4370 // Private 4371 4372 _maybeScheduleHide() { 4373 if (!this._config.autohide) { 4374 return; 4375 } 4376 if (this._hasMouseInteraction || this._hasKeyboardInteraction) { 4377 return; 4378 } 4379 this._timeout = setTimeout(() => { 4380 this.hide(); 4381 }, this._config.delay); 4382 } 4383 _onInteraction(event, isInteracting) { 4384 switch (event.type) { 4385 case 'mouseover': 4386 case 'mouseout': 4387 { 4388 this._hasMouseInteraction = isInteracting; 4389 break; 4390 } 4391 case 'focusin': 4392 case 'focusout': 4393 { 4394 this._hasKeyboardInteraction = isInteracting; 4395 break; 4396 } 4397 } 4398 if (isInteracting) { 4399 this._clearTimeout(); 4400 return; 4401 } 4402 const nextElement = event.relatedTarget; 4403 if (this._element === nextElement || this._element.contains(nextElement)) { 4404 return; 4405 } 4406 this._maybeScheduleHide(); 4407 } 4408 _setListeners() { 4409 EventHandler.on(this._element, EVENT_MOUSEOVER, event => this._onInteraction(event, true)); 4410 EventHandler.on(this._element, EVENT_MOUSEOUT, event => this._onInteraction(event, false)); 4411 EventHandler.on(this._element, EVENT_FOCUSIN, event => this._onInteraction(event, true)); 4412 EventHandler.on(this._element, EVENT_FOCUSOUT, event => this._onInteraction(event, false)); 4413 } 4414 _clearTimeout() { 4415 clearTimeout(this._timeout); 4416 this._timeout = null; 4417 } 4418 4419 // Static 4420 static jQueryInterface(config) { 4421 return this.each(function () { 4422 const data = Toast.getOrCreateInstance(this, config); 4423 if (typeof config === 'string') { 4424 if (typeof data[config] === 'undefined') {
4425 throw new TypeError(`No method named "${config}"`); 4426 } 4427 data[config](this); 4428 } 4429 }); 4430 } 4431 } 4432 4433 /** 4434 * Data API implementation 4435 */ 4436 4437 enableDismissTrigger(Toast); 4438 4439 /** 4440 * jQuery 4441 */ 4442 4443 defineJQueryPlugin(Toast); 4444 4445 /** 4446 * -------------------------------------------------------------------------- 4447 * Bootstrap index.umd.js 4448 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 4449 * -------------------------------------------------------------------------- 4450 */ 4451 const index_umd = { 4452 Alert, 4453 Button, 4454 Carousel, 4455 Collapse, 4456 Dropdown, 4457 Modal, 4458 Offcanvas, 4459 Popover, 4460 ScrollSpy, 4461 Tab, 4462 Toast, 4463 Tooltip 4464 }; 4465 4466 return index_umd; 4467 4468})); 4469//# sourceMappingURL=bootstrap.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.