source: src/main/resources/static/js/bootstrap.bundle.js@ 881a233

Last change on this file since 881a233 was 5577566, checked in by NikolaCenevski <cenevskinikola@…>, 3 years ago

prototip part 2

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