vendor: 1,687 bytes, lines 1-56
1/** 2 * -------------------------------------------------------------------------- 3 * Bootstrap dom/data.js 4 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 5 * -------------------------------------------------------------------------- 6 */ 7 8/** 9 * Constants 10 */ 11 12const elementMap = new Map(); 13var Data = { 14 set(element, key, instance) { 15 if (!elementMap.has(element)) { 16 elementMap.set(element, new Map()); 17 } 18 const instanceMap = elementMap.get(element); 19 20 // make it clear we only want one instance per element 21 // can be removed later when multiple key/instances are fine to be used 22 if (!instanceMap.has(key) && instanceMap.size !== 0) { 23 // eslint-disable-next-line no-console 24 console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(instanceMap.keys())[0]}.`); 25 return; 26 } 27 instanceMap.set(key, instance); 28 }, 29 get(element, key) { 30 if (elementMap.has(element)) { 31 return elementMap.get(element).get(key) || null; 32 } 33 return null; 34 }, 35 remove(element, key) { 36 if (!elementMap.has(element)) { 37 return; 38 } 39 const instanceMap = elementMap.get(element); 40 instanceMap.delete(key); 41 42 // free up element references if there are no instances left for an element 43 if (instanceMap.size === 0) { 44 elementMap.delete(element); 45 } 46 } 47}; 48 49/** 50 * -------------------------------------------------------------------------- 51 * Bootstrap util/index.js 52 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 53 * -------------------------------------------------------------------------- 54 */ 55 56const MAX_UID = 1_000_
vendor: 7,593 bytes, lines 56-312
56000; 57const MILLISECONDS_MULTIPLIER = 1000; 58const TRANSITION_END = 'transitionend'; 59 60/** 61 * Properly escape IDs selectors to handle weird IDs 62 * @param {string} selector 63 * @returns {string} 64 */ 65const parseSelector = selector => { 66 if (selector && window.CSS && window.CSS.escape) { 67 // document.querySelector needs escaping to handle IDs (html5+) containing for instance / 68 selector = selector.replace(/#([^\s"#']+)/g, (match, id) => `#${CSS.escape(id)}`); 69 } 70 return selector; 71}; 72 73// Shout-out Angus Croll (https://goo.gl/pxwQGp) 74const toType = object => { 75 if (object === null || object === undefined) { 76 return `${object}`; 77 } 78 return Object.prototype.toString.call(object).match(/\s([a-z]+)/i)[1].toLowerCase(); 79}; 80 81/** 82 * Public Util API 83 */ 84 85const getUID = prefix => { 86 do { 87 prefix += Math.floor(Math.random() * MAX_UID); 88 } while (document.getElementById(prefix)); 89 return prefix; 90}; 91const getTransitionDurationFromElement = element => { 92 if (!element) { 93 return 0; 94 } 95 96 // Get transition-duration of the element 97 let { 98 transitionDuration, 99 transitionDelay 100 } = window.getComputedStyle(element); 101 const floatTransitionDuration = Number.parseFloat(transitionDuration); 102 const floatTransitionDelay = Number.parseFloat(transitionDelay); 103 104 // Return 0 if element or transition duration is not found 105 if (!floatTransitionDuration && !floatTransitionDelay) { 106 return 0; 107 } 108 109 // If multiple durations are defined, take the first 110 transitionDuration = transitionDuration.split(',')[0]; 111 transitionDelay = transitionDelay.split(',')[0]; 112 return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER; 113}; 114const triggerTransitionEnd = element => { 115 element.dispatchEvent(new Event(TRANSITION_END)); 116}; 117const isElement = object => { 118 if (!object || typeof object !== 'object') { 119 return false; 120 } 121 if (typeof object.jquery !== 'undefined') { 122 object = object[0]; 123 } 124 return typeof object.nodeType !== 'undefined'; 125}; 126const getElement = object => { 127 // it's a jQuery object or a node element 128 if (isElement(object)) { 129 return object.jquery ? object[0] : object; 130 } 131 if (typeof object === 'string' && object.length > 0) { 132 return document.querySelector(parseSelector(object)); 133 } 134 return null; 135}; 136const isVisible = element => { 137 if (!isElement(element) || element.getClientRects().length === 0) { 138 return false; 139 } 140 const elementIsVisible = getComputedStyle(element).getPropertyValue('visibility') === 'visible'; 141 // Handle `details` element as its content may falsie appear visible when it is closed 142 const closedDetails = element.closest('details:not([open])'); 143 if (!closedDetails) { 144 return elementIsVisible; 145 } 146 if (closedDetails !== element) { 147 const summary = element.closest('summary'); 148 if (summary && summary.parentNode !== closedDetails) { 149 return false; 150 } 151 if (summary === null) { 152 return false; 153 } 154 } 155 return elementIsVisible; 156}; 157const isDisabled = element => { 158 if (!element || element.nodeType !== Node.ELEMENT_NODE) { 159 return true; 160 } 161 if (element.classList.contains('disabled')) { 162 return true; 163 } 164 if (typeof element.disabled !== 'undefined') { 165 return element.disabled; 166 } 167 return element.hasAttribute('disabled') && element.getAttribute('disabled') !== 'false'; 168}; 169const findShadowRoot = element => { 170 if (!document.documentElement.attachShadow) { 171 return null; 172 } 173 174 // Can find the shadow root otherwise it'll return the document 175 if (typeof element.getRootNode === 'function') { 176 const root = element.getRootNode(); 177 return root instanceof ShadowRoot ? root : null; 178 } 179 if (element instanceof ShadowRoot) { 180 return element; 181 } 182 183 // when we don't find a shadow root 184 if (!element.parentNode) { 185 return null; 186 } 187 return findShadowRoot(element.parentNode); 188}; 189const noop = () => {}; 190 191/** 192 * Trick to restart an element's animation 193 * 194 * @param {HTMLElement} element 195 * @return void 196 * 197 * @see https://www.harrytheo.com/blog/2021/02/restart-a-css-animation-with-javascript/#restarting-a-css-animation 198 */ 199const reflow = element => { 200 element.offsetHeight; // eslint-disable-line no-unused-expressions 201}; 202const getjQuery = () => { 203 if (window.jQuery && !document.body.hasAttribute('data-bs-no-jquery')) { 204 return window.jQuery; 205 } 206 return null; 207}; 208const DOMContentLoadedCallbacks = []; 209const onDOMContentLoaded = callback => { 210 if (document.readyState === 'loading') { 211 // add listener on the first call when the document is in loading state 212 if (!DOMContentLoadedCallbacks.length) { 213 document.addEventListener('DOMContentLoaded', () => { 214 for (const callback of DOMContentLoadedCallbacks) { 215 callback(); 216 } 217 }); 218 } 219 DOMContentLoadedCallbacks.push(callback); 220 } else { 221 callback(); 222 } 223}; 224const isRTL = () => document.documentElement.dir === 'rtl'; 225const defineJQueryPlugin = plugin => { 226 onDOMContentLoaded(() => { 227 const $ = getjQuery(); 228 /* istanbul ignore if */ 229 if ($) { 230 const name = plugin.NAME; 231 const JQUERY_NO_CONFLICT = $.fn[name]; 232 $.fn[name] = plugin.jQueryInterface; 233 $.fn[name].Constructor = plugin; 234 $.fn[name].noConflict = () => { 235 $.fn[name] = JQUERY_NO_CONFLICT; 236 return plugin.jQueryInterface; 237 }; 238 } 239 }); 240}; 241const execute = (possibleCallback, args = [], defaultValue = possibleCallback) => { 242 return typeof possibleCallback === 'function' ? possibleCallback.call(...args) : defaultValue; 243}; 244const executeAfterTransition = (callback, transitionElement, waitForTransition = true) => { 245 if (!waitForTransition) { 246 execute(callback); 247 return; 248 } 249 const durationPadding = 5; 250 const emulatedDuration = getTransitionDurationFromElement(transitionElement) + durationPadding; 251 let called = false; 252 const handler = ({ 253 target 254 }) => { 255 if (target !== transitionElement) { 256 return; 257 } 258 called = true; 259 transitionElement.removeEventListener(TRANSITION_END, handler); 260 execute(callback); 261 }; 262 transitionElement.addEventListener(TRANSITION_END, handler); 263 setTimeout(() => { 264 if (!called) { 265 triggerTransitionEnd(transitionElement); 266 } 267 }, emulatedDuration); 268}; 269 270/** 271 * Return the previous/next element of a list. 272 * 273 * @param {array} list The list of elements 274 * @param activeElement The active element 275 * @param shouldGetNext Choose to get next or previous element 276 * @param isCycleAllowed 277 * @return {Element|elem} The proper element 278 */ 279const getNextActiveElement = (list, activeElement, shouldGetNext, isCycleAllowed) => { 280 const listLength = list.length; 281 let index = list.indexOf(activeElement); 282 283 // if the element does not exist in the list return an element 284 // depending on the direction and if cycle is allowed 285 if (index === -1) { 286 return !shouldGetNext && isCycleAllowed ? list[listLength - 1] : list[0]; 287 } 288 index += shouldGetNext ? 1 : -1; 289 if (isCycleAllowed) { 290 index = (index + listLength) % listLength; 291 } 292 return list[Math.max(0, Math.min(index, listLength - 1))]; 293}; 294 295/** 296 * -------------------------------------------------------------------------- 297 * Bootstrap dom/event-handler.js 298 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 299 * -------------------------------------------------------------------------- 300 */ 301 302 303/** 304 * Constants 305 */ 306 307const namespaceRegex = /[^.]*(?=\..*)\.|.*/; 308const stripNameRegex = /\..*/; 309const stripUidRegex = /::\d+$/; 310const eventRegistry = {}; // Events storage 311let uidEvent = 1; 312const customEvents = {
vendor: 7,611 bytes, lines 313-505
313 mouseenter: 'mouseover', 314 mouseleave: 'mouseout' 315}; 316const 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']); 317 318/** 319 * Private methods 320 */ 321 322function makeEventUid(element, uid) { 323 return uid && `${uid}::${uidEvent++}` || element.uidEvent || uidEvent++; 324} 325function getElementEvents(element) { 326 const uid = makeEventUid(element); 327 element.uidEvent = uid; 328 eventRegistry[uid] = eventRegistry[uid] || {}; 329 return eventRegistry[uid]; 330} 331function bootstrapHandler(element, fn) { 332 return function handler(event) { 333 hydrateObj(event, { 334 delegateTarget: element 335 }); 336 if (handler.oneOff) { 337 EventHandler.off(element, event.type, fn); 338 } 339 return fn.apply(element, [event]); 340 }; 341} 342function bootstrapDelegationHandler(element, selector, fn) { 343 return function handler(event) { 344 const domElements = element.querySelectorAll(selector); 345 for (let { 346 target 347 } = event; target && target !== this; target = target.parentNode) { 348 for (const domElement of domElements) { 349 if (domElement !== target) { 350 continue; 351 } 352 hydrateObj(event, { 353 delegateTarget: target 354 }); 355 if (handler.oneOff) { 356 EventHandler.off(element, event.type, selector, fn); 357 } 358 return fn.apply(target, [event]); 359 } 360 } 361 }; 362} 363function findHandler(events, callable, delegationSelector = null) { 364 return Object.values(events).find(event => event.callable === callable && event.delegationSelector === delegationSelector); 365} 366function normalizeParameters(originalTypeEvent, handler, delegationFunction) { 367 const isDelegated = typeof handler === 'string'; 368 // TODO: tooltip passes `false` instead of selector, so we need to check 369 const callable = isDelegated ? delegationFunction : handler || delegationFunction; 370 let typeEvent = getTypeEvent(originalTypeEvent); 371 if (!nativeEvents.has(typeEvent)) { 372 typeEvent = originalTypeEvent; 373 } 374 return [isDelegated, callable, typeEvent]; 375} 376function addHandler(element, originalTypeEvent, handler, delegationFunction, oneOff) { 377 if (typeof originalTypeEvent !== 'string' || !element) { 378 return; 379 } 380 let [isDelegated, callable, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction); 381 382 // in case of mouseenter or mouseleave wrap the handler within a function that checks for its DOM position 383 // this prevents the handler from being dispatched the same way as mouseover or mouseout does 384 if (originalTypeEvent in customEvents) { 385 const wrapFunction = fn => { 386 return function (event) { 387 if (!event.relatedTarget || event.relatedTarget !== event.delegateTarget && !event.delegateTarget.contains(event.relatedTarget)) { 388 return fn.call(this, event); 389 } 390 }; 391 }; 392 callable = wrapFunction(callable); 393 } 394 const events = getElementEvents(element); 395 const handlers = events[typeEvent] || (events[typeEvent] = {}); 396 const previousFunction = findHandler(handlers, callable, isDelegated ? handler : null); 397 if (previousFunction) { 398 previousFunction.oneOff = previousFunction.oneOff && oneOff; 399 return; 400 } 401 const uid = makeEventUid(callable, originalTypeEvent.replace(namespaceRegex, '')); 402 const fn = isDelegated ? bootstrapDelegationHandler(element, handler, callable) : bootstrapHandler(element, callable); 403 fn.delegationSelector = isDelegated ? handler : null; 404 fn.callable = callable; 405 fn.oneOff = oneOff; 406 fn.uidEvent = uid; 407 handlers[uid] = fn; 408 element.addEventListener(typeEvent, fn, isDelegated); 409} 410function removeHandler(element, events, typeEvent, handler, delegationSelector) { 411 const fn = findHandler(events[typeEvent], handler, delegationSelector); 412 if (!fn) { 413 return; 414 } 415 element.removeEventListener(typeEvent, fn, Boolean(delegationSelector)); 416 delete events[typeEvent][fn.uidEvent]; 417} 418function removeNamespacedHandlers(element, events, typeEvent, namespace) { 419 const storeElementEvent = events[typeEvent] || {}; 420 for (const [handlerKey, event] of Object.entries(storeElementEvent)) { 421 if (handlerKey.includes(namespace)) { 422 removeHandler(element, events, typeEvent, event.callable, event.delegationSelector); 423 } 424 } 425} 426function getTypeEvent(event) { 427 // allow to get the native events from namespaced events ('click.bs.button' --> 'click') 428 event = event.replace(stripNameRegex, ''); 429 return customEvents[event] || event; 430} 431const EventHandler = { 432 on(element, event, handler, delegationFunction) { 433 addHandler(element, event, handler, delegationFunction, false); 434 }, 435 one(element, event, handler, delegationFunction) { 436 addHandler(element, event, handler, delegationFunction, true); 437 }, 438 off(element, originalTypeEvent, handler, delegationFunction) { 439 if (typeof originalTypeEvent !== 'string' || !element) { 440 return; 441 } 442 const [isDelegated, callable, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction); 443 const inNamespace = typeEvent !== originalTypeEvent; 444 const events = getElementEvents(element); 445 const storeElementEvent = events[typeEvent] || {}; 446 const isNamespace = originalTypeEvent.startsWith('.'); 447 if (typeof callable !== 'undefined') { 448 // Simplest case: handler is passed, remove that listener ONLY. 449 if (!Object.keys(storeElementEvent).length) { 450 return; 451 } 452 removeHandler(element, events, typeEvent, callable, isDelegated ? handler : null); 453 return; 454 } 455 if (isNamespace) { 456 for (const elementEvent of Object.keys(events)) { 457 removeNamespacedHandlers(element, events, elementEvent, originalTypeEvent.slice(1)); 458 } 459 } 460 for (const [keyHandlers, event] of Object.entries(storeElementEvent)) { 461 const handlerKey = keyHandlers.replace(stripUidRegex, ''); 462 if (!inNamespace || originalTypeEvent.includes(handlerKey)) { 463 removeHandler(element, events, typeEvent, event.callable, event.delegationSelector); 464 } 465 } 466 }, 467 trigger(element, event, args) { 468 if (typeof event !== 'string' || !element) { 469 return null; 470 } 471 const $ = getjQuery(); 472 const typeEvent = getTypeEvent(event); 473 const inNamespace = event !== typeEvent; 474 let jQueryEvent = null; 475 let bubbles = true; 476 let nativeDispatch = true; 477 let defaultPrevented = false; 478 if (inNamespace && $) { 479 jQueryEvent = $.Event(event, args); 480 $(element).trigger(jQueryEvent); 481 bubbles = !jQueryEvent.isPropagationStopped(); 482 nativeDispatch = !jQueryEvent.isImmediatePropagationStopped(); 483 defaultPrevented = jQueryEvent.isDefaultPrevented(); 484 } 485 const evt = hydrateObj(new Event(event, { 486 bubbles, 487 cancelable: true 488 }), args); 489 if (defaultPrevented) { 490 evt.preventDefault(); 491 } 492 if (nativeDispatch) { 493 element.dispatchEvent(evt); 494 } 495 if (evt.defaultPrevented && jQueryEvent) { 496 jQueryEvent.preventDefault(); 497 } 498 return evt; 499 } 500}; 501function hydrateObj(obj, meta = {}) { 502 for (const [key, value] of Object.entries(meta)) { 503 try { 504 obj[key] = value; 505 } catch
vendor: 27,658 bytes, lines 505-1468
505{ 506 Object.defineProperty(obj, key, { 507 configurable: true, 508 get() { 509 return value; 510 } 511 }); 512 } 513 } 514 return obj; 515} 516 517/** 518 * -------------------------------------------------------------------------- 519 * Bootstrap dom/manipulator.js 520 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 521 * -------------------------------------------------------------------------- 522 */ 523 524function normalizeData(value) { 525 if (value === 'true') { 526 return true; 527 } 528 if (value === 'false') { 529 return false; 530 } 531 if (value === Number(value).toString()) { 532 return Number(value); 533 } 534 if (value === '' || value === 'null') { 535 return null; 536 } 537 if (typeof value !== 'string') { 538 return value; 539 } 540 try { 541 return JSON.parse(decodeURIComponent(value)); 542 } catch { 543 return value; 544 } 545} 546function normalizeDataKey(key) { 547 return key.replace(/[A-Z]/g, chr => `-${chr.toLowerCase()}`); 548} 549const Manipulator = { 550 setDataAttribute(element, key, value) { 551 element.setAttribute(`data-bs-${normalizeDataKey(key)}`, value); 552 }, 553 removeDataAttribute(element, key) { 554 element.removeAttribute(`data-bs-${normalizeDataKey(key)}`); 555 }, 556 getDataAttributes(element) { 557 if (!element) { 558 return {}; 559 } 560 const attributes = {}; 561 const bsKeys = Object.keys(element.dataset).filter(key => key.startsWith('bs') && !key.startsWith('bsConfig')); 562 for (const key of bsKeys) { 563 let pureKey = key.replace(/^bs/, ''); 564 pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1); 565 attributes[pureKey] = normalizeData(element.dataset[key]); 566 } 567 return attributes; 568 }, 569 getDataAttribute(element, key) { 570 return normalizeData(element.getAttribute(`data-bs-${normalizeDataKey(key)}`)); 571 } 572}; 573 574/** 575 * -------------------------------------------------------------------------- 576 * Bootstrap util/config.js 577 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 578 * -------------------------------------------------------------------------- 579 */ 580 581 582/** 583 * Class definition 584 */ 585 586class Config { 587 // Getters 588 static get Default() { 589 return {}; 590 } 591 static get DefaultType() { 592 return {}; 593 } 594 static get NAME() { 595 throw new Error('You have to implement the static method "NAME", for each component!'); 596 } 597 _getConfig(config) { 598 config = this._mergeConfigObj(config); 599 config = this._configAfterMerge(config); 600 this._typeCheckConfig(config); 601 return config; 602 } 603 _configAfterMerge(config) { 604 return config; 605 } 606 _mergeConfigObj(config, element) { 607 const jsonConfig = isElement(element) ? Manipulator.getDataAttribute(element, 'config') : {}; // try to parse 608 609 return { 610 ...this.constructor.Default, 611 ...(typeof jsonConfig === 'object' ? jsonConfig : {}), 612 ...(isElement(element) ? Manipulator.getDataAttributes(element) : {}), 613 ...(typeof config === 'object' ? config : {}) 614 }; 615 } 616 _typeCheckConfig(config, configTypes = this.constructor.DefaultType) { 617 for (const [property, expectedTypes] of Object.entries(configTypes)) { 618 const value = config[property]; 619 const valueType = isElement(value) ? 'element' : toType(value); 620 if (!new RegExp(expectedTypes).test(valueType)) { 621 throw new TypeError(`${this.constructor.NAME.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`); 622 } 623 } 624 } 625} 626 627/** 628 * -------------------------------------------------------------------------- 629 * Bootstrap base-component.js 630 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 631 * -------------------------------------------------------------------------- 632 */ 633 634 635/** 636 * Constants 637 */ 638 639const VERSION = '5.3.8'; 640 641/** 642 * Class definition 643 */ 644 645class BaseComponent extends Config { 646 constructor(element, config) { 647 super(); 648 element = getElement(element); 649 if (!element) { 650 return; 651 } 652 this._element = element; 653 this._config = this._getConfig(config); 654 Data.set(this._element, this.constructor.DATA_KEY, this); 655 } 656 657 // Public 658 dispose() { 659 Data.remove(this._element, this.constructor.DATA_KEY); 660 EventHandler.off(this._element, this.constructor.EVENT_KEY); 661 for (const propertyName of Object.getOwnPropertyNames(this)) { 662 this[propertyName] = null; 663 } 664 } 665 666 // Private 667 _queueCallback(callback, element, isAnimated = true) { 668 executeAfterTransition(callback, element, isAnimated); 669 } 670 _getConfig(config) { 671 config = this._mergeConfigObj(config, this._element); 672 config = this._configAfterMerge(config); 673 this._typeCheckConfig(config); 674 return config; 675 } 676 677 // Static 678 static getInstance(element) { 679 return Data.get(getElement(element), this.DATA_KEY); 680 } 681 static getOrCreateInstance(element, config = {}) { 682 return this.getInstance(element) || new this(element, typeof config === 'object' ? config : null); 683 } 684 static get VERSION() { 685 return VERSION; 686 } 687 static get DATA_KEY() { 688 return `bs.${this.NAME}`; 689 } 690 static get EVENT_KEY() { 691 return `.${this.DATA_KEY}`; 692 } 693 static eventName(name) { 694 return `${name}${this.EVENT_KEY}`; 695 } 696} 697 698/** 699 * -------------------------------------------------------------------------- 700 * Bootstrap dom/selector-engine.js 701 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 702 * -------------------------------------------------------------------------- 703 */ 704 705const getSelector = element => { 706 let selector = element.getAttribute('data-bs-target'); 707 if (!selector || selector === '#') { 708 let hrefAttribute = element.getAttribute('href'); 709 710 // The only valid content that could double as a selector are IDs or classes, 711 // so everything starting with `#` or `.`. If a "real" URL is used as the selector, 712 // `document.querySelector` will rightfully complain it is invalid. 713 // See https://github.com/twbs/bootstrap/issues/32273 714 if (!hrefAttribute || !hrefAttribute.includes('#') && !hrefAttribute.startsWith('.')) { 715 return null; 716 } 717 718 // Just in case some CMS puts out a full URL with the anchor appended 719 if (hrefAttribute.includes('#') && !hrefAttribute.startsWith('#')) { 720 hrefAttribute = `#${hrefAttribute.split('#')[1]}`; 721 } 722 selector = hrefAttribute && hrefAttribute !== '#' ? hrefAttribute.trim() : null; 723 } 724 return selector ? selector.split(',').map(sel => parseSelector(sel)).join(',') : null; 725}; 726const SelectorEngine = { 727 find(selector, element = document.documentElement) { 728 return [].concat(...Element.prototype.querySelectorAll.call(element, selector)); 729 }, 730 findOne(selector, element = document.documentElement) { 731 return Element.prototype.querySelector.call(element, selector); 732 }, 733 children(element, selector) { 734 return [].concat(...element.children).filter(child => child.matches(selector)); 735 }, 736 parents(element, selector) { 737 const parents = []; 738 let ancestor = element.parentNode.closest(selector); 739 while (ancestor) { 740 parents.push(ancestor); 741 ancestor = ancestor.parentNode.closest(selector); 742 } 743 return parents; 744 }, 745 prev(element, selector) { 746 let previous = element.previousElementSibling; 747 while (previous) { 748 if (previous.matches(selector)) { 749 return [previous]; 750 } 751 previous = previous.previousElementSibling; 752 } 753 return []; 754 }, 755 // TODO: this is now unused; remove later along with prev() 756 next(element, selector) { 757 let next = element.nextElementSibling; 758 while (next) { 759 if (next.matches(selector)) { 760 return [next]; 761 } 762 next = next.nextElementSibling; 763 } 764 return []; 765 }, 766 focusableChildren(element) { 767 const focusables = ['a', 'button', 'input', 'textarea', 'select', 'details', '[tabindex]', '[contenteditable="true"]'].map(selector => `${selector}:not([tabindex^="-"])`).join(','); 768 return this.find(focusables, element).filter(el => !isDisabled(el) && isVisible(el)); 769 }, 770 getSelectorFromElement(element) { 771 const selector = getSelector(element); 772 if (selector) { 773 return SelectorEngine.findOne(selector) ? selector : null; 774 } 775 return null; 776 }, 777 getElementFromSelector(element) { 778 const selector = getSelector(element); 779 return selector ? SelectorEngine.findOne(selector) : null; 780 }, 781 getMultipleElementsFromSelector(element) { 782 const selector = getSelector(element); 783 return selector ? SelectorEngine.find(selector) : []; 784 } 785}; 786 787/** 788 * -------------------------------------------------------------------------- 789 * Bootstrap util/component-functions.js 790 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 791 * -------------------------------------------------------------------------- 792 */ 793 794const enableDismissTrigger = (component, method = 'hide') => { 795 const clickEvent = `click.dismiss${component.EVENT_KEY}`; 796 const name = component.NAME; 797 EventHandler.on(document, clickEvent, `[data-bs-dismiss="${name}"]`, function (event) { 798 if (['A', 'AREA'].includes(this.tagName)) { 799 event.preventDefault(); 800 } 801 if (isDisabled(this)) { 802 return; 803 } 804 const target = SelectorEngine.getElementFromSelector(this) || this.closest(`.${name}`); 805 const instance = component.getOrCreateInstance(target); 806 807 // Method argument is left, for Alert and only, as it doesn't implement the 'hide' method 808 instance[method](); 809 }); 810}; 811 812/** 813 * -------------------------------------------------------------------------- 814 * Bootstrap util/swipe.js 815 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 816 * -------------------------------------------------------------------------- 817 */ 818 819 820/** 821 * Constants 822 */ 823 824const NAME$3 = 'swipe'; 825const EVENT_KEY$1 = '.bs.swipe'; 826const EVENT_TOUCHSTART = `touchstart${EVENT_KEY$1}`; 827const EVENT_TOUCHMOVE = `touchmove${EVENT_KEY$1}`; 828const EVENT_TOUCHEND = `touchend${EVENT_KEY$1}`; 829const EVENT_POINTERDOWN = `pointerdown${EVENT_KEY$1}`; 830const EVENT_POINTERUP = `pointerup${EVENT_KEY$1}`; 831const POINTER_TYPE_TOUCH = 'touch'; 832const POINTER_TYPE_PEN = 'pen'; 833const CLASS_NAME_POINTER_EVENT = 'pointer-event'; 834const SWIPE_THRESHOLD = 40; 835const Default$3 = { 836 endCallback: null, 837 leftCallback: null, 838 rightCallback: null 839}; 840const DefaultType$3 = { 841 endCallback: '(function|null)', 842 leftCallback: '(function|null)', 843 rightCallback: '(function|null)' 844}; 845 846/** 847 * Class definition 848 */ 849 850class Swipe extends Config { 851 constructor(element, config) { 852 super(); 853 this._element = element; 854 if (!element || !Swipe.isSupported()) { 855 return; 856 } 857 this._config = this._getConfig(config); 858 this._deltaX = 0; 859 this._supportPointerEvents = Boolean(window.PointerEvent); 860 this._initEvents(); 861 } 862 863 // Getters 864 static get Default() { 865 return Default$3; 866 } 867 static get DefaultType() { 868 return DefaultType$3; 869 } 870 static get NAME() { 871 return NAME$3; 872 } 873 874 // Public 875 dispose() { 876 EventHandler.off(this._element, EVENT_KEY$1); 877 } 878 879 // Private 880 _start(event) { 881 if (!this._supportPointerEvents) { 882 this._deltaX = event.touches[0].clientX; 883 return; 884 } 885 if (this._eventIsPointerPenTouch(event)) { 886 this._deltaX = event.clientX; 887 } 888 } 889 _end(event) { 890 if (this._eventIsPointerPenTouch(event)) { 891 this._deltaX = event.clientX - this._deltaX; 892 } 893 this._handleSwipe(); 894 execute(this._config.endCallback); 895 } 896 _move(event) { 897 this._deltaX = event.touches && event.touches.length > 1 ? 0 : event.touches[0].clientX - this._deltaX; 898 } 899 _handleSwipe() { 900 const absDeltaX = Math.abs(this._deltaX); 901 if (absDeltaX <= SWIPE_THRESHOLD) { 902 return; 903 } 904 const direction = absDeltaX / this._deltaX; 905 this._deltaX = 0; 906 if (!direction) { 907 return; 908 } 909 execute(direction > 0 ? this._config.rightCallback : this._config.leftCallback); 910 } 911 _initEvents() { 912 if (this._supportPointerEvents) { 913 EventHandler.on(this._element, EVENT_POINTERDOWN, event => this._start(event)); 914 EventHandler.on(this._element, EVENT_POINTERUP, event => this._end(event)); 915 this._element.classList.add(CLASS_NAME_POINTER_EVENT); 916 } else { 917 EventHandler.on(this._element, EVENT_TOUCHSTART, event => this._start(event)); 918 EventHandler.on(this._element, EVENT_TOUCHMOVE, event => this._move(event)); 919 EventHandler.on(this._element, EVENT_TOUCHEND, event => this._end(event)); 920 } 921 } 922 _eventIsPointerPenTouch(event) { 923 return this._supportPointerEvents && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH); 924 } 925 926 // Static 927 static isSupported() { 928 return 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0; 929 } 930} 931 932/** 933 * -------------------------------------------------------------------------- 934 * Bootstrap util/backdrop.js 935 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 936 * -------------------------------------------------------------------------- 937 */ 938 939 940/** 941 * Constants 942 */ 943 944const NAME$2 = 'backdrop'; 945const CLASS_NAME_FADE = 'fade'; 946const CLASS_NAME_SHOW = 'show'; 947const EVENT_MOUSEDOWN = `mousedown.bs.${NAME$2}`; 948const Default$2 = { 949 className: 'modal-backdrop', 950 clickCallback: null, 951 isAnimated: false, 952 isVisible: true, 953 // if false, we use the backdrop helper without adding any element to the dom 954 rootElement: 'body' // give the choice to place backdrop under different elements 955}; 956const DefaultType$2 = { 957 className: 'string', 958 clickCallback: '(function|null)', 959 isAnimated: 'boolean', 960 isVisible: 'boolean', 961 rootElement: '(element|string)' 962}; 963 964/** 965 * Class definition 966 */ 967 968class Backdrop extends Config { 969 constructor(config) { 970 super(); 971 this._config = this._getConfig(config); 972 this._isAppended = false; 973 this._element = null; 974 } 975 976 // Getters 977 static get Default() { 978 return Default$2; 979 } 980 static get DefaultType() { 981 return DefaultType$2; 982 } 983 static get NAME() { 984 return NAME$2; 985 } 986 987 // Public 988 show(callback) { 989 if (!this._config.isVisible) { 990 execute(callback); 991 return; 992 } 993 this._append(); 994 const element = this._getElement(); 995 if (this._config.isAnimated) { 996 reflow(element); 997 } 998 element.classList.add(CLASS_NAME_SHOW); 999 this._emulateAnimation(() => { 1000 execute(callback); 1001 }); 1002 } 1003 hide(callback) { 1004 if (!this._config.isVisible) { 1005 execute(callback); 1006 return; 1007 } 1008 this._getElement().classList.remove(CLASS_NAME_SHOW); 1009 this._emulateAnimation(() => { 1010 this.dispose(); 1011 execute(callback); 1012 }); 1013 } 1014 dispose() { 1015 if (!this._isAppended) { 1016 return; 1017 } 1018 EventHandler.off(this._element, EVENT_MOUSEDOWN); 1019 this._element.remove(); 1020 this._isAppended = false; 1021 } 1022 1023 // Private 1024 _getElement() { 1025 if (!this._element) { 1026 const backdrop = document.createElement('div'); 1027 backdrop.className = this._config.className; 1028 if (this._config.isAnimated) { 1029 backdrop.classList.add(CLASS_NAME_FADE); 1030 } 1031 this._element = backdrop; 1032 } 1033 return this._element; 1034 } 1035 _configAfterMerge(config) { 1036 // use getElement() with the default "body" to get a fresh Element on each instantiation 1037 config.rootElement = getElement(config.rootElement); 1038 return config; 1039 } 1040 _append() { 1041 if (this._isAppended) { 1042 return; 1043 } 1044 const element = this._getElement(); 1045 this._config.rootElement.append(element); 1046 EventHandler.on(element, EVENT_MOUSEDOWN, () => { 1047 execute(this._config.clickCallback); 1048 }); 1049 this._isAppended = true; 1050 } 1051 _emulateAnimation(callback) { 1052 executeAfterTransition(callback, this._getElement(), this._config.isAnimated); 1053 } 1054} 1055 1056/** 1057 * -------------------------------------------------------------------------- 1058 * Bootstrap util/focustrap.js 1059 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 1060 * -------------------------------------------------------------------------- 1061 */ 1062 1063 1064/** 1065 * Constants 1066 */ 1067 1068const NAME$1 = 'focustrap'; 1069const DATA_KEY = 'bs.focustrap'; 1070const EVENT_KEY = `.${DATA_KEY}`; 1071const EVENT_FOCUSIN = `focusin${EVENT_KEY}`; 1072const EVENT_KEYDOWN_TAB = `keydown.tab${EVENT_KEY}`; 1073const TAB_KEY = 'Tab'; 1074const TAB_NAV_FORWARD = 'forward'; 1075const TAB_NAV_BACKWARD = 'backward'; 1076const Default$1 = { 1077 autofocus: true, 1078 trapElement: null // The element to trap focus inside of 1079}; 1080const DefaultType$1 = { 1081 autofocus: 'boolean', 1082 trapElement: 'element' 1083}; 1084 1085/** 1086 * Class definition 1087 */ 1088 1089class FocusTrap extends Config { 1090 constructor(config) { 1091 super(); 1092 this._config = this._getConfig(config); 1093 this._isActive = false; 1094 this._lastTabNavDirection = null; 1095 } 1096 1097 // Getters 1098 static get Default() { 1099 return Default$1; 1100 } 1101 static get DefaultType() { 1102 return DefaultType$1; 1103 } 1104 static get NAME() { 1105 return NAME$1; 1106 } 1107 1108 // Public 1109 activate() { 1110 if (this._isActive) { 1111 return; 1112 } 1113 if (this._config.autofocus) { 1114 this._config.trapElement.focus(); 1115 } 1116 EventHandler.off(document, EVENT_KEY); // guard against infinite focus loop 1117 EventHandler.on(document, EVENT_FOCUSIN, event => this._handleFocusin(event)); 1118 EventHandler.on(document, EVENT_KEYDOWN_TAB, event => this._handleKeydown(event)); 1119 this._isActive = true; 1120 } 1121 deactivate() { 1122 if (!this._isActive) { 1123 return; 1124 } 1125 this._isActive = false; 1126 EventHandler.off(document, EVENT_KEY); 1127 } 1128 1129 // Private 1130 _handleFocusin(event) { 1131 const { 1132 trapElement 1133 } = this._config; 1134 if (event.target === document || event.target === trapElement || trapElement.contains(event.target)) { 1135 return; 1136 } 1137 const elements = SelectorEngine.focusableChildren(trapElement); 1138 if (elements.length === 0) { 1139 trapElement.focus(); 1140 } else if (this._lastTabNavDirection === TAB_NAV_BACKWARD) { 1141 elements[elements.length - 1].focus(); 1142 } else { 1143 elements[0].focus(); 1144 } 1145 } 1146 _handleKeydown(event) { 1147 if (event.key !== TAB_KEY) { 1148 return; 1149 } 1150 this._lastTabNavDirection = event.shiftKey ? TAB_NAV_BACKWARD : TAB_NAV_FORWARD; 1151 } 1152} 1153 1154/** 1155 * -------------------------------------------------------------------------- 1156 * Bootstrap util/scrollBar.js 1157 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 1158 * -------------------------------------------------------------------------- 1159 */ 1160 1161 1162/** 1163 * Constants 1164 */ 1165 1166const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top'; 1167const SELECTOR_STICKY_CONTENT = '.sticky-top'; 1168const PROPERTY_PADDING = 'padding-right'; 1169const PROPERTY_MARGIN = 'margin-right'; 1170 1171/** 1172 * Class definition 1173 */ 1174 1175class ScrollBarHelper { 1176 constructor() { 1177 this._element = document.body; 1178 } 1179 1180 // Public 1181 getWidth() { 1182 // https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes 1183 const documentWidth = document.documentElement.clientWidth; 1184 return Math.abs(window.innerWidth - documentWidth); 1185 } 1186 hide() { 1187 const width = this.getWidth(); 1188 this._disableOverFlow(); 1189 // give padding to element to balance the hidden scrollbar width 1190 this._setElementAttributes(this._element, PROPERTY_PADDING, calculatedValue => calculatedValue + width); 1191 // trick: We adjust positive paddingRight and negative marginRight to sticky-top elements to keep showing fullwidth 1192 this._setElementAttributes(SELECTOR_FIXED_CONTENT, PROPERTY_PADDING, calculatedValue => calculatedValue + width); 1193 this._setElementAttributes(SELECTOR_STICKY_CONTENT, PROPERTY_MARGIN, calculatedValue => calculatedValue - width); 1194 } 1195 reset() { 1196 this._resetElementAttributes(this._element, 'overflow'); 1197 this._resetElementAttributes(this._element, PROPERTY_PADDING); 1198 this._resetElementAttributes(SELECTOR_FIXED_CONTENT, PROPERTY_PADDING); 1199 this._resetElementAttributes(SELECTOR_STICKY_CONTENT, PROPERTY_MARGIN); 1200 } 1201 isOverflowing() { 1202 return this.getWidth() > 0; 1203 } 1204 1205 // Private 1206 _disableOverFlow() { 1207 this._saveInitialAttribute(this._element, 'overflow'); 1208 this._element.style.overflow = 'hidden'; 1209 } 1210 _setElementAttributes(selector, styleProperty, callback) { 1211 const scrollbarWidth = this.getWidth(); 1212 const manipulationCallBack = element => { 1213 if (element !== this._element && window.innerWidth > element.clientWidth + scrollbarWidth) { 1214 return; 1215 } 1216 this._saveInitialAttribute(element, styleProperty); 1217 const calculatedValue = window.getComputedStyle(element).getPropertyValue(styleProperty); 1218 element.style.setProperty(styleProperty, `${callback(Number.parseFloat(calculatedValue))}px`); 1219 }; 1220 this._applyManipulationCallback(selector, manipulationCallBack); 1221 } 1222 _saveInitialAttribute(element, styleProperty) { 1223 const actualValue = element.style.getPropertyValue(styleProperty); 1224 if (actualValue) { 1225 Manipulator.setDataAttribute(element, styleProperty, actualValue); 1226 } 1227 } 1228 _resetElementAttributes(selector, styleProperty) { 1229 const manipulationCallBack = element => { 1230 const value = Manipulator.getDataAttribute(element, styleProperty); 1231 // We only want to remove the property if the value is `null`; the value can also be zero 1232 if (value === null) { 1233 element.style.removeProperty(styleProperty); 1234 return; 1235 } 1236 Manipulator.removeDataAttribute(element, styleProperty); 1237 element.style.setProperty(styleProperty, value); 1238 }; 1239 this._applyManipulationCallback(selector, manipulationCallBack); 1240 } 1241 _applyManipulationCallback(selector, callBack) { 1242 if (isElement(selector)) { 1243 callBack(selector); 1244 return; 1245 } 1246 for (const sel of SelectorEngine.find(selector, this._element)) { 1247 callBack(sel); 1248 } 1249 } 1250} 1251 1252/** 1253 * -------------------------------------------------------------------------- 1254 * Bootstrap util/sanitizer.js 1255 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 1256 * -------------------------------------------------------------------------- 1257 */ 1258 1259// js-docs-start allow-list 1260const ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i; 1261const DefaultAllowlist = { 1262 // Global attributes allowed on any supplied element below. 1263 '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN], 1264 a: ['target', 'href', 'title', 'rel'], 1265 area: [], 1266 b: [], 1267 br: [], 1268 col: [], 1269 code: [], 1270 dd: [], 1271 div: [], 1272 dl: [], 1273 dt: [], 1274 em: [], 1275 hr: [], 1276 h1: [], 1277 h2: [], 1278 h3: [], 1279 h4: [], 1280 h5: [], 1281 h6: [], 1282 i: [], 1283 img: ['src', 'srcset', 'alt', 'title', 'width', 'height'], 1284 li: [], 1285 ol: [], 1286 p: [], 1287 pre: [], 1288 s: [], 1289 small: [], 1290 span: [], 1291 sub: [], 1292 sup: [], 1293 strong: [], 1294 u: [], 1295 ul: [] 1296}; 1297// js-docs-end allow-list 1298 1299const uriAttributes = new Set(['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href']); 1300 1301/** 1302 * A pattern that recognizes URLs that are safe wrt. XSS in URL navigation 1303 * contexts. 1304 * 1305 * Shout-out to Angular https://github.com/angular/angular/blob/15.2.8/packages/core/src/sanitization/url_sanitizer.ts#L38 1306 */ 1307const SAFE_URL_PATTERN = /^(?!javascript:)(?:[a-z0-9+.-]+:|[^&:/?#]*(?:[/?#]|$))/i; 1308const allowedAttribute = (attribute, allowedAttributeList) => { 1309 const attributeName = attribute.nodeName.toLowerCase(); 1310 if (allowedAttributeList.includes(attributeName)) { 1311 if (uriAttributes.has(attributeName)) { 1312 return Boolean(SAFE_URL_PATTERN.test(attribute.nodeValue)); 1313 } 1314 return true; 1315 } 1316 1317 // Check if a regular expression validates the attribute. 1318 return allowedAttributeList.filter(attributeRegex => attributeRegex instanceof RegExp).some(regex => regex.test(attributeName)); 1319}; 1320function sanitizeHtml(unsafeHtml, allowList, sanitizeFunction) { 1321 if (!unsafeHtml.length) { 1322 return unsafeHtml; 1323 } 1324 if (sanitizeFunction && typeof sanitizeFunction === 'function') { 1325 return sanitizeFunction(unsafeHtml); 1326 } 1327 const domParser = new window.DOMParser(); 1328 const createdDocument = domParser.parseFromString(unsafeHtml, 'text/html'); 1329 const elements = [].concat(...createdDocument.body.querySelectorAll('*')); 1330 for (const element of elements) { 1331 const elementName = element.nodeName.toLowerCase(); 1332 if (!Object.keys(allowList).includes(elementName)) { 1333 element.remove(); 1334 continue; 1335 } 1336 const attributeList = [].concat(...element.attributes); 1337 const allowedAttributes = [].concat(allowList['*'] || [], allowList[elementName] || []); 1338 for (const attribute of attributeList) { 1339 if (!allowedAttribute(attribute, allowedAttributes)) { 1340 element.removeAttribute(attribute.nodeName); 1341 } 1342 } 1343 } 1344 return createdDocument.body.innerHTML; 1345} 1346 1347/** 1348 * -------------------------------------------------------------------------- 1349 * Bootstrap util/template-factory.js 1350 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 1351 * -------------------------------------------------------------------------- 1352 */ 1353 1354 1355/** 1356 * Constants 1357 */ 1358 1359const NAME = 'TemplateFactory'; 1360const Default = { 1361 allowList: DefaultAllowlist, 1362 content: {}, 1363 // { selector : text , selector2 : text2 , } 1364 extraClass: '', 1365 html: false, 1366 sanitize: true, 1367 sanitizeFn: null, 1368 template: '<div></div>' 1369}; 1370const DefaultType = { 1371 allowList: 'object', 1372 content: 'object', 1373 extraClass: '(string|function)', 1374 html: 'boolean', 1375 sanitize: 'boolean', 1376 sanitizeFn: '(null|function)', 1377 template: 'string' 1378}; 1379const DefaultContentType = { 1380 entry: '(string|element|function|null)', 1381 selector: '(string|element)' 1382}; 1383 1384/** 1385 * Class definition 1386 */ 1387 1388class TemplateFactory extends Config { 1389 constructor(config) { 1390 super(); 1391 this._config = this._getConfig(config); 1392 } 1393 1394 // Getters 1395 static get Default() { 1396 return Default; 1397 } 1398 static get DefaultType() { 1399 return DefaultType; 1400 } 1401 static get NAME() { 1402 return NAME; 1403 } 1404 1405 // Public 1406 getContent() { 1407 return Object.values(this._config.content).map(config => this._resolvePossibleFunction(config)).filter(Boolean); 1408 } 1409 hasContent() { 1410 return this.getContent().length > 0; 1411 } 1412 changeContent(content) { 1413 this._checkContent(content); 1414 this._config.content = { 1415 ...this._config.content, 1416 ...content 1417 }; 1418 return this; 1419 } 1420 toHtml() { 1421 const templateWrapper = document.createElement('div'); 1422 templateWrapper.innerHTML = this._maybeSanitize(this._config.template); 1423 for (const [selector, text] of Object.entries(this._config.content)) { 1424 this._setContent(templateWrapper, text, selector); 1425 } 1426 const template = templateWrapper.children[0]; 1427 const extraClass = this._resolvePossibleFunction(this._config.extraClass); 1428 if (extraClass) { 1429 template.classList.add(...extraClass.split(' ')); 1430 } 1431 return template; 1432 } 1433 1434 // Private 1435 _typeCheckConfig(config) { 1436 super._typeCheckConfig(config); 1437 this._checkContent(config.content); 1438 } 1439 _checkContent(arg) { 1440 for (const [selector, content] of Object.entries(arg)) { 1441 super._typeCheckConfig({ 1442 selector, 1443 entry: content 1444 }, DefaultContentType); 1445 } 1446 } 1447 _setContent(template, content, selector) { 1448 const templateElement = SelectorEngine.findOne(selector, template); 1449 if (!templateElement) { 1450 return; 1451 } 1452 content = this._resolvePossibleFunction(content); 1453 if (!content) { 1454 templateElement.remove(); 1455 return; 1456 } 1457 if (isElement(content)) { 1458 this._putElementInTemplate(getElement(content), templateElement); 1459 return; 1460 } 1461 if (this._config.html) { 1462 templateElement.innerHTML = this._maybeSanitize(content); 1463 return; 1464 } 1465 templateElement.textContent = content; 1466 } 1467 _maybeSanitize(arg) { 1468 return this._config.sanitize ? sanitizeHtml(arg, this._config.allowList, this._config.sanitizeFn) : arg;
1469 } 1470 _resolvePossibleFunction(arg) { 1471 return execute(arg, [undefined, this]); 1472 } 1473 _putElementInTemplate(element, templateElement) { 1474 if (this._config.html) { 1475 templateElement.innerHTML = ''; 1476 templateElement.append(element); 1477 return; 1478 } 1479 templateElement.textContent = element.textContent; 1480 } 1481} 1482 1483export { BaseComponent as B, DefaultAllowlist as D, EventHandler as E, FocusTrap as F, Manipulator as M, SelectorEngine as S, TemplateFactory as T, Swipe as a, getNextActiveElement as b, isRTL as c, defineJQueryPlugin as d, enableDismissTrigger as e, isDisabled as f, getElement as g, isElement as h, isVisible as i, execute as j, ScrollBarHelper as k, Backdrop as l, findShadowRoot as m, noop as n, getUID as o, reflow as r, triggerTransitionEnd as t };
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.